From: Samuel Ortiz <sameo@linux.intel.com>
To: Linus Walleij <linus.walleij@linaro.org>
Cc: Daniel Willerud <daniel.willerud@stericsson.com>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] MFD: ab8500: New ab8500_gpadc APIs and reentrance
Date: Wed, 2 Mar 2011 15:31:08 +0100 [thread overview]
Message-ID: <20110302143107.GL16181@sortiz-mobl> (raw)
In-Reply-To: <AANLkTinTP5UKWeu1eGvAA08YKJzz8=iskEPyPVSFzeCM@mail.gmail.com>
Hi Linus,
On Wed, Mar 02, 2011 at 03:12:31PM +0100, Linus Walleij wrote:
> 2011/3/2 Samuel Ortiz <sameo@linux.intel.com>:
>
> >> +/**
> >> + * ab8500_gpadc_get() - returns a reference to the primary AB8500 GPADC
> >> + * (i.e. the first GPADC in the instance list)
> >> + */
> >> +struct ab8500_gpadc *ab8500_gpadc_get(void)
> >> +{
> >> + struct ab8500_gpadc *gpadc;
> >> + gpadc = list_first_entry(&ab8500_gpadc_list, struct ab8500_gpadc, node);
> >> +
> >> + return gpadc;
> >> +}
>
> > This seems really arbitrary. We argued with Mattias about it, and giving
> > drivers access to your ADCs means they should somehow have a pointer back to
> > the right ADC. That's not the case here, and while it will just work fine
> > whenever you have one ADC on your board, you'll probably be relying on some
> > sort of device probe order otherwise.
>
> I guess the solution is to rewrite that function to take a parameter
> then, such as:
>
> struct ab8500_gpadc *ab8500_gpadc_get(char *name)
>
> If name is then just a strcmpm(dev_name(gpadc->dev), name)
> the client use will be something like:
>
> struct ab8500_gpadc *gpadc = ab8500_gpadc_get("ab8500-gpadc.0");
>
> For the first GPDC in the system (unless .init_name is specified
> by the ab8500-core when creating the device).
>
> Fair enough?
That's an original solution. It really is hacking around the device model, but
at least it's nicer than the original proposal. So, fair enough, yes.
Cheers,
Samuel.
--
Intel Open Source Technology Centre
http://oss.intel.com/
prev parent reply other threads:[~2011-03-02 14:31 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-02-22 12:24 [PATCH] MFD: ab8500: New ab8500_gpadc APIs and reentrance Daniel Willerud
2011-02-28 14:54 ` Linus Walleij
2011-03-02 11:34 ` Samuel Ortiz
2011-03-02 14:12 ` Linus Walleij
2011-03-02 14:31 ` Samuel Ortiz [this message]
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=20110302143107.GL16181@sortiz-mobl \
--to=sameo@linux.intel.com \
--cc=daniel.willerud@stericsson.com \
--cc=linus.walleij@linaro.org \
--cc=linux-kernel@vger.kernel.org \
/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