linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Zhu, Lejun" <lejun.zhu@linux.intel.com>
To: Mark Brown <broonie@kernel.org>
Cc: lee.jones@linaro.org, sameo@linux.intel.com,
	linux-kernel@vger.kernel.org, jacob.jun.pan@linux.intel.com,
	bin.yang@intel.com
Subject: Re: [PATCH RESEND v2 1/4] mfd: intel_soc_pmic: Core driver
Date: Wed, 28 May 2014 08:55:11 +0800	[thread overview]
Message-ID: <538533EF.6080101@linux.intel.com> (raw)
In-Reply-To: <20140527112024.GS12304@sirena.org.uk>


On 5/27/2014 7:20 PM, Mark Brown wrote:
> On Tue, May 27, 2014 at 08:48:58AM +0800, Zhu, Lejun wrote:
>> On 5/26/2014 10:51 PM, Mark Brown wrote:
> 
>>>> We created these names to hide the implementation of how read/write is
>>>> done from other platform specific patches interacting with this driver.
>>>> So when we change the implementation, e.g. from I2C read/write to
>>>> regmap, we don't have to touch all these patches.
> 
>>> This sort of HAL is frowned upon in the upstream kernel.
> 
>> We want to do what other MFD drivers' been doing, and make it easier for
>> the callers. A couple of similar examples are intel_msic_reg_read() and
>> lp3943_read_byte(). We want to do the same with intel_soc_pmic_readb(),
>> and I don't think it's too odd.
> 
> The odd and problematic bit is the global variable part of things -
> these wrappers are usually just doing lookup of the underlying I/O
> handle in the struct for the device and can be implemented as static
> inlines in the header.
> 

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?

Best Regards
Lejun

  reply	other threads:[~2014-05-28  0:55 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-23  0:40 [PATCH RESEND v2 0/4] mfd: Intel SoC Power Management IC Zhu, Lejun
2014-05-23  0:40 ` [PATCH RESEND v2 1/4] mfd: intel_soc_pmic: Core driver Zhu, Lejun
2014-05-23 17:49   ` Mark Brown
2014-05-26  6:01     ` Zhu, Lejun
2014-05-26 14:51       ` Mark Brown
2014-05-27  0:48         ` Zhu, Lejun
2014-05-27 11:20           ` Mark Brown
2014-05-28  0:55             ` Zhu, Lejun [this message]
2014-05-28 11:19               ` Mark Brown
2014-05-23  0:40 ` [PATCH RESEND v2 2/4] mfd: intel_soc_pmic: I2C interface Zhu, Lejun
2014-05-23 17:53   ` Mark Brown
2014-05-26  6:03     ` Zhu, Lejun
2014-05-23  0:40 ` [PATCH RESEND v2 3/4] mfd: intel_soc_pmic: Crystal Cove support Zhu, Lejun
2014-05-23  0:40 ` [PATCH RESEND v2 4/4] mfd: intel_soc_pmic: Build files Zhu, Lejun
2014-05-23 10:08 ` [PATCH RESEND v2 0/4] mfd: Intel SoC Power Management IC Lee Jones
2014-05-25 23:41   ` Zhu, Lejun

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=538533EF.6080101@linux.intel.com \
    --to=lejun.zhu@linux.intel.com \
    --cc=bin.yang@intel.com \
    --cc=broonie@kernel.org \
    --cc=jacob.jun.pan@linux.intel.com \
    --cc=lee.jones@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sameo@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).