devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mark Brown <broonie-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org>
To: Stephen Warren <swarren-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
Cc: Liam Girdwood <lrg-l0cyMroinI0@public.gmane.org>,
	Rob Herring <rob.herring-bsGFqQB8/DxBDgjK7y7TUQ@public.gmane.org>,
	John Bonesio <bones-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org>,
	"alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw@public.gmane.org"
	<alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw@public.gmane.org>,
	"linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	"devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org"
	<devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org>
Subject: Re: [PATCH v3 3/6] ASoC: WM8903: Pass pdata to wm8903_init_gpio
Date: Fri, 2 Dec 2011 01:05:51 +0000	[thread overview]
Message-ID: <20111202010549.GB31948@opensource.wolfsonmicro.com> (raw)
In-Reply-To: <74CDBE0F657A3D45AFBB94109FB122FF174FDB03FF-C7FfzLzN0UxDw2glCA4ptUEOCMrvLtNR@public.gmane.org>

On Thu, Dec 01, 2011 at 04:48:11PM -0800, Stephen Warren wrote:
> Mark Brown wrote at Thursday, December 01, 2011 5:28 PM:

> > This will break existing users in counjuntion with the previous patch.
> > Previously if the user provided platform data but left gpio_base as zero
> > we'd use -1 and let gpiolib pick for us.  Now instead the driver will
> > take that zero and pass it on to gpiolib, probably failing as the SoC
> > will have taken the low numbered GPIOs.

> Yes, I suppose that's true. However, I don't see it as a problem.

> Surely if the user provided pdata, it's their responsibility to fill
> it in correctly and completely. It seems a little random to take the
> pdata, and try to guess whether 0 means 0 or "I didn't set the value,
> so use the default". I think the same comment applies w.r.t to your

No, that's not been the general approach as it avoids breaking existing
users when you add new elements to the platform data and it means that
users don't have to worry about every single field which is much more
friendly as the number of fields gets larger.  In the case of GPIOs it
was frankly a bad idea to have 0 be a valid GPIO value in the first
place; it makes the API that little bit more fiddly to work with.

Device tree is much nicer in this regard as you can just omit properties
which is unambiguous.

> comment on patch 2 (gpio_cfg); 0 is a perfectly legitimate value for
> the register; why should the driver double-guess that value and assume
> 0 means "don't touch the pin"?

Yeah, that's annoying.  There's a reason why most of the chips do the
write of zero by setting an out of bounds bit in the pdata.  At least
for the devices I deal with directly 0 is fortunately usually a
nonsensical value to want to set anyway so it's not so important.

  parent reply	other threads:[~2011-12-02  1:05 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-01 20:49 [PATCH v3 1/6] ASoC: WM8903: Disallow all invalid gpio_cfg pdata values Stephen Warren
     [not found] ` <1322772564-27343-1-git-send-email-swarren-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2011-12-01 20:49   ` [PATCH v3 2/6] ASoC: WM8903: Create default platform data structure Stephen Warren
     [not found]     ` <1322772564-27343-2-git-send-email-swarren-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2011-12-02  0:29       ` Mark Brown
2011-12-01 20:49   ` [PATCH v3 3/6] ASoC: WM8903: Pass pdata to wm8903_init_gpio Stephen Warren
     [not found]     ` <1322772564-27343-3-git-send-email-swarren-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2011-12-02  0:27       ` Mark Brown
     [not found]         ` <20111202002730.GA31903-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org>
2011-12-02  0:48           ` Stephen Warren
     [not found]             ` <74CDBE0F657A3D45AFBB94109FB122FF174FDB03FF-C7FfzLzN0UxDw2glCA4ptUEOCMrvLtNR@public.gmane.org>
2011-12-02  1:05               ` Mark Brown [this message]
2011-12-01 20:49   ` [PATCH v3 4/6] ASoC: WM8903: Remove conditionals checking pdata != NULL Stephen Warren
2011-12-01 20:49   ` [PATCH v3 5/6] ASoC: WM8903: Get default irq_active_low from IRQ controller Stephen Warren
2011-12-01 20:49   ` [PATCH v3 6/6] ASoC: WM8903: Add device tree binding Stephen Warren
2011-12-02 10:35   ` [PATCH v3 1/6] ASoC: WM8903: Disallow all invalid gpio_cfg pdata values Mark Brown

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=20111202010549.GB31948@opensource.wolfsonmicro.com \
    --to=broonie-yzvpicuk2aatku/dhu1wvuem+bqzidxxqq4iyu8u01e@public.gmane.org \
    --cc=alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw@public.gmane.org \
    --cc=bones-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org \
    --cc=devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org \
    --cc=linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=lrg-l0cyMroinI0@public.gmane.org \
    --cc=rob.herring-bsGFqQB8/DxBDgjK7y7TUQ@public.gmane.org \
    --cc=swarren-DDmLM1+adcrQT0dZR+AlfA@public.gmane.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;
as well as URLs for NNTP newsgroup(s).