All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stephen Warren <swarren@wwwdotorg.org>
To: Heikki Krogerus <heikki.krogerus@linux.intel.com>,
	Johannes Berg <johannes@sipsolutions.net>,
	"David S. Miller" <davem@davemloft.net>
Cc: Chen-Yu Tsai <wens@csie.org>, Rhyland Klein <rklein@nvidia.com>,
	Marc Dietrich <marvin24@gmx.de>,
	Linus Walleij <linus.walleij@linaro.org>,
	Arnd Bergmann <arnd@arndb.de>,
	Alexandre Courbot <gnurou@gmail.com>,
	linux-wireless@vger.kernel.org, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-tegra@vger.kernel.org
Subject: Re: [PATCHv2 3/5] net: rfkill: gpio: remove gpio names
Date: Tue, 25 Feb 2014 16:04:46 -0700	[thread overview]
Message-ID: <530D218E.9010007@wwwdotorg.org> (raw)
In-Reply-To: <1393330950-7283-4-git-send-email-heikki.krogerus@linux.intel.com>

On 02/25/2014 05:22 AM, Heikki Krogerus wrote:
> There is no use for them in this driver. This will fix a
> static checker warning..
> 
> net/rfkill/rfkill-gpio.c:144 rfkill_gpio_probe()
> 	warn: variable dereferenced before check 'rfkill->name'
> 
> This will also make sure that when DT support is added,
> "gpios" property can be used as no con_id labels are
> provided.

> diff --git a/net/rfkill/rfkill-gpio.c b/net/rfkill/rfkill-gpio.c

> -	gpio = devm_gpiod_get_index(&pdev->dev, rfkill->reset_name, 0);
> +	gpio = devm_gpiod_get_index(&pdev->dev, NULL, 0);

I think the correct fix here is to look up the GPIO by name rather than
by index, but simply hard-code the name rather than generating it with
sprintf(). Index lookups are hard to expand compatibly, but named-based
lookups scale much better.

In other words, I rather specifically disagree with using a plain
"gpios" property in any future DT binding, but would strongly prefer
e.g. reset-gpios/shutdown-gpios or gpios/gpio-names.

Still, I guess I don't object too much.

WARNING: multiple messages have this Message-ID (diff)
From: swarren@wwwdotorg.org (Stephen Warren)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCHv2 3/5] net: rfkill: gpio: remove gpio names
Date: Tue, 25 Feb 2014 16:04:46 -0700	[thread overview]
Message-ID: <530D218E.9010007@wwwdotorg.org> (raw)
In-Reply-To: <1393330950-7283-4-git-send-email-heikki.krogerus@linux.intel.com>

On 02/25/2014 05:22 AM, Heikki Krogerus wrote:
> There is no use for them in this driver. This will fix a
> static checker warning..
> 
> net/rfkill/rfkill-gpio.c:144 rfkill_gpio_probe()
> 	warn: variable dereferenced before check 'rfkill->name'
> 
> This will also make sure that when DT support is added,
> "gpios" property can be used as no con_id labels are
> provided.

> diff --git a/net/rfkill/rfkill-gpio.c b/net/rfkill/rfkill-gpio.c

> -	gpio = devm_gpiod_get_index(&pdev->dev, rfkill->reset_name, 0);
> +	gpio = devm_gpiod_get_index(&pdev->dev, NULL, 0);

I think the correct fix here is to look up the GPIO by name rather than
by index, but simply hard-code the name rather than generating it with
sprintf(). Index lookups are hard to expand compatibly, but named-based
lookups scale much better.

In other words, I rather specifically disagree with using a plain
"gpios" property in any future DT binding, but would strongly prefer
e.g. reset-gpios/shutdown-gpios or gpios/gpio-names.

Still, I guess I don't object too much.

  reply	other threads:[~2014-02-25 23:04 UTC|newest]

Thread overview: 54+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-25 12:22 [PATCHv2 0/5] net: rfkill: gpio: cleanup and a few new acpi ids Heikki Krogerus
2014-02-25 12:22 ` Heikki Krogerus
2014-02-25 12:22 ` Heikki Krogerus
     [not found] ` <1393330950-7283-1-git-send-email-heikki.krogerus-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2014-02-25 12:22   ` [PATCHv2 1/5] ARM: tegra: remove obsolete gpio entries Heikki Krogerus
2014-02-25 12:22     ` Heikki Krogerus
2014-02-25 12:22     ` Heikki Krogerus
2014-02-25 13:06     ` Marc Dietrich
2014-02-25 13:06       ` Marc Dietrich
2014-02-25 15:15     ` Johannes Berg
2014-02-25 15:15       ` Johannes Berg
2014-02-25 23:00     ` Stephen Warren
2014-02-25 23:00       ` Stephen Warren
2014-02-25 12:22   ` [PATCHv2 3/5] net: rfkill: gpio: remove gpio names Heikki Krogerus
2014-02-25 12:22     ` Heikki Krogerus
2014-02-25 12:22     ` Heikki Krogerus
2014-02-25 23:04     ` Stephen Warren [this message]
2014-02-25 23:04       ` Stephen Warren
2014-03-05  1:43       ` Linus Walleij
2014-03-05  1:43         ` Linus Walleij
2014-03-05  2:18         ` Stephen Warren
2014-03-05  2:18           ` Stephen Warren
     [not found]           ` <53168976.7000008-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2014-03-05  2:37             ` Linus Walleij
2014-03-05  2:37               ` Linus Walleij
2014-03-05  2:37               ` Linus Walleij
     [not found]               ` <CACRpkdYfQoDmPX0He4J2Sn2wgQn2hHoHyPqnStLRVqrvi=M+-w-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-03-05  2:59                 ` Stephen Warren
2014-03-05  2:59                   ` Stephen Warren
2014-03-05  2:59                   ` Stephen Warren
2014-03-07  3:41                   ` Linus Walleij
2014-03-07  3:41                     ` Linus Walleij
     [not found]                     ` <CACRpkdaYuZ5bXo7djOv04oyHPAFbO=pKfR7L7UBY+kZqZUHfmQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-03-07  3:43                       ` Chen-Yu Tsai
2014-03-07  3:43                         ` Chen-Yu Tsai
2014-03-07  3:43                         ` Chen-Yu Tsai
     [not found]                         ` <CAGb2v65UQZoDJhjpX+kfa6HppXdhrCHG=A5m_WaQ_DimW-Lsbg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-03-07  4:22                           ` Stephen Warren
2014-03-07  4:22                             ` Stephen Warren
2014-03-07  4:22                             ` Stephen Warren
2014-02-25 12:22 ` [PATCHv2 2/5] net: rfkill: gpio: remove unused and obsolete platform parameters Heikki Krogerus
2014-02-25 12:22   ` Heikki Krogerus
2014-02-25 12:22 ` [PATCHv2 4/5] net: rfkill: gpio: add ACPI ID for GPS module on Lenove Miix2 Heikki Krogerus
2014-02-25 12:22   ` Heikki Krogerus
     [not found]   ` <1393330950-7283-5-git-send-email-heikki.krogerus-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2014-02-25 16:40     ` Sergei Shtylyov
2014-02-25 16:40       ` Sergei Shtylyov
2014-02-25 16:40       ` Sergei Shtylyov
     [not found]       ` <530CC796.1010800-M4DtvfQ/ZS1MRgGoP+s0PdBPR1lH4CV8@public.gmane.org>
2014-02-27 10:55         ` Heikki Krogerus
2014-02-27 10:55           ` Heikki Krogerus
2014-02-27 10:55           ` Heikki Krogerus
2014-02-27 11:22           ` [PATCHv3 4/5] net: rfkill: gpio: add ACPI ID for GPS module on Lenovo Miix2 Heikki Krogerus
2014-02-27 11:22             ` Heikki Krogerus
2014-02-25 12:22 ` [PATCHv2 5/5] net: rfkill: gpio: add ACPI IDs for a Broadcom bluetooth chip Heikki Krogerus
2014-02-25 12:22   ` Heikki Krogerus
2014-02-25 15:11 ` [PATCHv2 0/5] net: rfkill: gpio: cleanup and a few new acpi ids Johannes Berg
2014-02-25 15:11   ` Johannes Berg
     [not found]   ` <1393341068.4170.7.camel-8Nb76shvtaUJvtFkdXX2HixXY32XiHfO@public.gmane.org>
2014-02-25 17:59     ` Marcel Holtmann
2014-02-25 17:59       ` Marcel Holtmann
2014-02-25 17:59       ` Marcel Holtmann

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=530D218E.9010007@wwwdotorg.org \
    --to=swarren@wwwdotorg.org \
    --cc=arnd@arndb.de \
    --cc=davem@davemloft.net \
    --cc=gnurou@gmail.com \
    --cc=heikki.krogerus@linux.intel.com \
    --cc=johannes@sipsolutions.net \
    --cc=linus.walleij@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tegra@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=marvin24@gmx.de \
    --cc=netdev@vger.kernel.org \
    --cc=rklein@nvidia.com \
    --cc=wens@csie.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.