All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thierry Reding <thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: Laxman Dewangan <ldewangan-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
Cc: swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org,
	linus.walleij-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org,
	gnurou-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org,
	linux-gpio-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH V4 3/4] gpio: tegra: Get rid of all file scoped global variables
Date: Mon, 25 Apr 2016 12:11:01 +0200	[thread overview]
Message-ID: <20160425101101.GC20630@ulmo.ba.sec> (raw)
In-Reply-To: <571DE912.3060602-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>

[-- Attachment #1: Type: text/plain, Size: 1148 bytes --]

On Mon, Apr 25, 2016 at 03:23:22PM +0530, Laxman Dewangan wrote:
> 
> On Monday 25 April 2016 03:30 PM, Thierry Reding wrote:
> > * PGP Signed by an unknown key
> > 
> > On Fri, Apr 22, 2016 at 03:39:13PM +0530, Laxman Dewangan wrote:
> > [...]
> > > diff --git a/drivers/gpio/gpio-tegra.c b/drivers/gpio/gpio-tegra.c
> > [...]
> > >   static struct gpio_chip tegra_gpio_chip = {
> > This variable is still file-scoped. Why not get rid of it at the same
> > time? It's rather pointless to remove all file-scoped variables except a
> > single one, because now the driver still isn't properly equipped to deal
> > with multiple instances (however theoretical that may be).
> > 
> 
> Yaah, Alex also pointed that to have the instance of gpio_chip in
> tegra_gpio_info and then do as
> tgi->gc = tegra_gpio_chip.
> 
> 
> same for irq_chip also.
> 
> 
> I hope this will resolve the concern.

An alternative would be to do away with tegra_gpio_chip altogether and
instead assign the fields directly within ->probe(). Both patterns seem
to be used in drivers/gpio, with the latter one being slightly more
common.

Thierry

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

WARNING: multiple messages have this Message-ID (diff)
From: Thierry Reding <thierry.reding@gmail.com>
To: Laxman Dewangan <ldewangan@nvidia.com>
Cc: swarren@wwwdotorg.org, linus.walleij@linaro.org,
	gnurou@gmail.com, linux-gpio@vger.kernel.org,
	linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH V4 3/4] gpio: tegra: Get rid of all file scoped global variables
Date: Mon, 25 Apr 2016 12:11:01 +0200	[thread overview]
Message-ID: <20160425101101.GC20630@ulmo.ba.sec> (raw)
In-Reply-To: <571DE912.3060602@nvidia.com>

[-- Attachment #1: Type: text/plain, Size: 1148 bytes --]

On Mon, Apr 25, 2016 at 03:23:22PM +0530, Laxman Dewangan wrote:
> 
> On Monday 25 April 2016 03:30 PM, Thierry Reding wrote:
> > * PGP Signed by an unknown key
> > 
> > On Fri, Apr 22, 2016 at 03:39:13PM +0530, Laxman Dewangan wrote:
> > [...]
> > > diff --git a/drivers/gpio/gpio-tegra.c b/drivers/gpio/gpio-tegra.c
> > [...]
> > >   static struct gpio_chip tegra_gpio_chip = {
> > This variable is still file-scoped. Why not get rid of it at the same
> > time? It's rather pointless to remove all file-scoped variables except a
> > single one, because now the driver still isn't properly equipped to deal
> > with multiple instances (however theoretical that may be).
> > 
> 
> Yaah, Alex also pointed that to have the instance of gpio_chip in
> tegra_gpio_info and then do as
> tgi->gc = tegra_gpio_chip.
> 
> 
> same for irq_chip also.
> 
> 
> I hope this will resolve the concern.

An alternative would be to do away with tegra_gpio_chip altogether and
instead assign the fields directly within ->probe(). Both patterns seem
to be used in drivers/gpio, with the latter one being slightly more
common.

Thierry

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

  parent reply	other threads:[~2016-04-25 10:11 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-22 10:09 [PATCH V4 1/4] gpio: tegra: Don't open code of_device_get_match_data() Laxman Dewangan
2016-04-22 10:09 ` Laxman Dewangan
2016-04-22 10:09 ` [PATCH V4 2/4] gpio: tegra: Make of_device_id compatible data to constant Laxman Dewangan
2016-04-22 10:09   ` Laxman Dewangan
2016-04-22 10:09 ` [PATCH V4 3/4] gpio: tegra: Get rid of all file scoped global variables Laxman Dewangan
2016-04-22 10:09   ` Laxman Dewangan
     [not found]   ` <1461319754-12040-3-git-send-email-ldewangan-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2016-04-25  5:13     ` Alexandre Courbot
2016-04-25  5:13       ` Alexandre Courbot
2016-04-25  8:36       ` Laxman Dewangan
2016-04-25 10:00     ` Thierry Reding
2016-04-25 10:00       ` Thierry Reding
2016-04-25  9:53       ` Laxman Dewangan
2016-04-25  9:53         ` Laxman Dewangan
     [not found]         ` <571DE912.3060602-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2016-04-25 10:11           ` Thierry Reding [this message]
2016-04-25 10:11             ` Thierry Reding
2016-04-22 10:09 ` [PATCH V4 4/4] gpio: tegra: Add support for gpio debounce Laxman Dewangan
2016-04-22 10:09   ` Laxman Dewangan
2016-04-22 19:53   ` Stephen Warren
2016-04-25  5:36   ` Alexandre Courbot
     [not found]     ` <CAAVeFuJykGNGj95r4P8vatxOA_yjsP1eQkDf9zS-dYV1piHTJA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-04-25  8:40       ` Laxman Dewangan
2016-04-25  8:40         ` Laxman Dewangan

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=20160425101101.GC20630@ulmo.ba.sec \
    --to=thierry.reding-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
    --cc=gnurou-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=ldewangan-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org \
    --cc=linus.walleij-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
    --cc=linux-gpio-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=swarren-3lzwWm7+Weoh9ZMKESR00Q@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 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.