From mboxrd@z Thu Jan 1 00:00:00 1970 From: Simon Glass Date: Mon, 14 May 2018 08:01:28 +1000 Subject: [U-Boot] [PATCH v2 03/11] pmic: Add support for setting transmission length in uclass private data In-Reply-To: <20180506202608.5899-4-lukma@denx.de> References: <20180506202608.5899-1-lukma@denx.de> <20180506202608.5899-4-lukma@denx.de> Message-ID: List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On 7 May 2018 at 06:26, Lukasz Majewski wrote: > The struct dm_pmic_info's trans_len field stores the number of types to > be transmitted per PMIC transfer. > > Signed-off-by: Lukasz Majewski > > --- > > Changes in v2: > - New patch > > drivers/power/pmic/pmic-uclass.c | 10 ++++++++++ > include/power/pmic.h | 4 ++++ > 2 files changed, 14 insertions(+) > Reviewed-by: Simon Glass Please see below. > diff --git a/drivers/power/pmic/pmic-uclass.c b/drivers/power/pmic/pmic-uclass.c > index 5e8f6d6190..88669533bd 100644 > --- a/drivers/power/pmic/pmic-uclass.c > +++ b/drivers/power/pmic/pmic-uclass.c > @@ -166,7 +166,17 @@ int pmic_clrsetbits(struct udevice *dev, uint reg, uint clr, uint set) > return pmic_reg_write(dev, reg, byte); > } > > +static int pmic_pre_probe(struct udevice *dev) > +{ > + struct dm_pmic_info *pmic_info = dev_get_uclass_priv(dev); > + > + pmic_info->trans_len = 1; > + return 0; > +} > + > UCLASS_DRIVER(pmic) = { > .id = UCLASS_PMIC, > .name = "pmic", > + .pre_probe = pmic_pre_probe, > + .per_device_auto_alloc_size = sizeof(struct dm_pmic_info), > }; > diff --git a/include/power/pmic.h b/include/power/pmic.h > index f2fe537fb7..0791c6aa2c 100644 > --- a/include/power/pmic.h > +++ b/include/power/pmic.h > @@ -298,6 +298,10 @@ int pmic_reg_write(struct udevice *dev, uint reg, uint value); > */ > int pmic_clrsetbits(struct udevice *dev, uint reg, uint clr, uint set); > > +struct dm_pmic_info { > + uint trans_len; Please add a comment for this. Also, how about uc_pmic_priv since this is device-specific private information owned by the uclass. > +}; > + > #endif /* CONFIG_DM_PMIC */ > > #ifdef CONFIG_POWER > -- > 2.11.0 >