Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1382447

Re: [PATCH V2 2/3] gpio: tegra: Remove the need of keeping device handle for gpio driver

From Thierry Reding <thierry.reding@gmail.com>
Newsgroups linux.kernel
Subject Re: [PATCH V2 2/3] gpio: tegra: Remove the need of keeping device handle for gpio driver
Date 2016-04-19 14:40 +0200
Message-ID <rpD6F-6Tc-3@gated-at.bofh.it> (permalink)
References <rpABQ-4Lu-5@gated-at.bofh.it> <rpABS-4Lu-49@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


[Multipart message — attachments visible in raw view] - view raw

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@nvidia.com>
> ---
>  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.

>  		return ret;
>  	}
>  
> @@ -465,8 +465,6 @@ static int tegra_gpio_probe(struct platform_device *pdev)
>  	int i;
>  	int j;
>  
> -	dev = &pdev->dev;
> -
>  	config = of_device_get_match_data(&pdev->dev);
>  	if (!config) {
>  		dev_err(&pdev->dev, "Error: No device match found\n");
> @@ -488,6 +486,8 @@ static int tegra_gpio_probe(struct platform_device *pdev)
>  	}
>  
>  	tegra_gpio_chip.ngpio = tegra_gpio_bank_count * 32;
> +	tegra_gpio_chip.parent = &pdev->dev;
> +

This adds a gratuitous blank line.

Thierry

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH V2 1/3] gpio: tegra: Don't open code of_device_get_match_data() Laxman Dewangan <ldewangan@nvidia.com> - 2016-04-19 12:00 +0200
  [PATCH V2 2/3] gpio: tegra: Remove the need of keeping device handle for gpio driver Laxman Dewangan <ldewangan@nvidia.com> - 2016-04-19 12:00 +0200
    Re: [PATCH V2 2/3] gpio: tegra: Remove the need of keeping device  handle for gpio driver Thierry Reding <thierry.reding@gmail.com> - 2016-04-19 14:40 +0200
      Re: [PATCH V2 2/3] gpio: tegra: Remove the need of keeping device  handle for gpio driver Laxman Dewangan <ldewangan@nvidia.com> - 2016-04-19 15:00 +0200
        Re: [PATCH V2 2/3] gpio: tegra: Remove the need of keeping device  handle for gpio driver Stephen Warren <swarren@wwwdotorg.org> - 2016-04-19 18:10 +0200
  [PATCH V2 3/3] gpio: tegra: Add support for gpio debounce Laxman Dewangan <ldewangan@nvidia.com> - 2016-04-19 12:00 +0200
    Re: [PATCH V2 3/3] gpio: tegra: Add support for gpio debounce Jon Hunter <jonathanh@nvidia.com> - 2016-04-19 12:50 +0200
      Re: [PATCH V2 3/3] gpio: tegra: Add support for gpio debounce Thierry Reding <thierry.reding@gmail.com> - 2016-04-19 14:40 +0200
    Re: [PATCH V2 3/3] gpio: tegra: Add support for gpio debounce Thierry Reding <thierry.reding@gmail.com> - 2016-04-19 14:40 +0200
      Re: [PATCH V2 3/3] gpio: tegra: Add support for gpio debounce Laxman Dewangan <ldewangan@nvidia.com> - 2016-04-19 15:00 +0200
    Re: [PATCH V2 3/3] gpio: tegra: Add support for gpio debounce Stephen Warren <swarren@wwwdotorg.org> - 2016-04-19 18:20 +0200
      Re: [PATCH V2 3/3] gpio: tegra: Add support for gpio debounce Laxman Dewangan <ldewangan@nvidia.com> - 2016-04-19 18:40 +0200
        Re: [PATCH V2 3/3] gpio: tegra: Add support for gpio debounce Stephen Warren <swarren@wwwdotorg.org> - 2016-04-19 18:40 +0200
  Re: [PATCH V2 1/3] gpio: tegra: Don't open code  of_device_get_match_data() Thierry Reding <thierry.reding@gmail.com> - 2016-04-19 14:10 +0200

csiph-web