From: Stephen Warren <swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
To: Laxman Dewangan
<ldewangan-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>,
Thierry Reding
<thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: 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 V2 2/3] gpio: tegra: Remove the need of keeping device handle for gpio driver
Date: Tue, 19 Apr 2016 10:04:20 -0600 [thread overview]
Message-ID: <57165704.9010403@wwwdotorg.org> (raw)
In-Reply-To: <571627F5.7000307-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
On 04/19/2016 06:43 AM, Laxman Dewangan wrote:
>
> On Tuesday 19 April 2016 06:03 PM, Thierry Reding wrote:
>> * PGP Signed by an unknown key
>>
>> On Tue, Apr 19, 2016 at 03:13:39PM +0530, Laxman Dewangan wrote:
>>> Remove the file static device handle variable for keeping device handle
>>> of driver as this is just required for error prints. The required device
>>> handle are available from gpiochip structure.
>>>
>>> Signed-off-by: Laxman Dewangan <ldewangan-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
>>> ---
>>> drivers/gpio/gpio-tegra.c | 8 ++++----
>>> 1 file changed, 4 insertions(+), 4 deletions(-)
>>>
>>> diff --git a/drivers/gpio/gpio-tegra.c b/drivers/gpio/gpio-tegra.c
>>> index 1b0c497..de022a9 100644
>>> --- a/drivers/gpio/gpio-tegra.c
>>> +++ b/drivers/gpio/gpio-tegra.c
>>> @@ -80,7 +80,6 @@ struct tegra_gpio_soc_config {
>>> u32 upper_offset;
>>> };
>>> -static struct device *dev;
>>> static struct irq_domain *irq_domain;
>>> static void __iomem *regs;
>>> static u32 tegra_gpio_bank_count;
>>> @@ -240,7 +239,8 @@ static int tegra_gpio_irq_set_type(struct
>>> irq_data *d, unsigned int type)
>>> ret = gpiochip_lock_as_irq(&tegra_gpio_chip, gpio);
>>> if (ret) {
>>> - dev_err(dev, "unable to lock Tegra GPIO %d as IRQ\n", gpio);
>>> + dev_err(tegra_gpio_chip.parent,
>>> + "unable to lock Tegra GPIO %d as IRQ\n", gpio);
>> Can't we get rid of the tegra_gpio_chip global variable altogether? We
>> set a struct tegra_gpio_bank * as the chip data for each of the
>> interrupts, so if we added a back link to the GPIO chip to each bank
>> we could easily get at the GPIO chip (and its parent device) from the
>> IRQ chip implementation.
>>
>
> We can get rid of all the global variables and can have only one (this
> is because our REGS macros uses the stride and changing then part of
> argument is too much change for single patch) as suggested by Stephen.
The REGS macro can take a parameter that points to the struct
tegra_gpio_chip, which in turn can point at the struct
tegra_gpio_soc_config. That doesn't sound like too many parameters/...
to me. There's little point getting rid of all-but-one global.
next prev parent reply other threads:[~2016-04-19 16:04 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-19 9:43 [PATCH V2 1/3] gpio: tegra: Don't open code of_device_get_match_data() Laxman Dewangan
2016-04-19 9:43 ` [PATCH V2 2/3] gpio: tegra: Remove the need of keeping device handle for gpio driver Laxman Dewangan
2016-04-19 12:33 ` Thierry Reding
2016-04-19 12:43 ` Laxman Dewangan
[not found] ` <571627F5.7000307-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2016-04-19 16:04 ` Stephen Warren [this message]
2016-04-19 9:43 ` [PATCH V2 3/3] gpio: tegra: Add support for gpio debounce Laxman Dewangan
[not found] ` <1461059020-25373-3-git-send-email-ldewangan-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2016-04-19 10:43 ` Jon Hunter
2016-04-19 12:36 ` Thierry Reding
2016-04-19 12:37 ` Thierry Reding
2016-04-19 12:45 ` Laxman Dewangan
2016-04-19 16:11 ` Stephen Warren
[not found] ` <571658CE.1040306-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2016-04-19 16:19 ` Laxman Dewangan
2016-04-19 16:36 ` Stephen Warren
2016-04-19 12:06 ` [PATCH V2 1/3] gpio: tegra: Don't open code of_device_get_match_data() Thierry Reding
2016-04-29 8:56 ` Linus Walleij
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=57165704.9010403@wwwdotorg.org \
--to=swarren-3lzwwm7+weoh9zmkesr00q@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=thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@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).