Re: [PATCH RESEND v2 1/4] mfd: intel_soc_pmic: Core driver

From: Mark Brown
Date: Wed May 28 2014 - 07:20:05 EST


On Wed, May 28, 2014 at 08:55:11AM +0800, Zhu, Lejun wrote:

> Oh I see. Sorry I missed your point. So you are saying "int
> intel_soc_pmic_readb(int reg)" is bad, but if I have:

> int intel_soc_pmic_readb(struct intel_soc_pmic *pmic, int reg)
> {
> int ret;
> unsigned int val;
>
> ret = regmap_read(pmic->regmap, reg, &val);
> if (!ret)
> ret = val;
>
> return ret;
> }

> And have the caller (device or core) look up and pass *pmic in, this
> will be OK?

Yes, that's the more common pattern - normally the caller will need
*pmic for some other purpose anyway so it saves an additional regmap
lookup if that's desired.

Attachment: signature.asc
Description: Digital signature