Re: [PATCH] pinctrl: samsung: Use bank name as irqchip name

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Jun 09, 2020 at 10:23:29AM +0200, Marek Szyprowski wrote:
> Use the bank name as the irqchip name. This name is later visible in
> /proc/interrupts, what makes it possible to easily identify each
> GPIO interrupt.
> 
> /proc/interrupts before this patch:
> 143:    0     exynos4210_wkup_irq_chip   7 Edge      hdmi
> 144:    0     exynos4210_wkup_irq_chip   6 Level     wm8994
> 145:    1     exynos4210_wkup_irq_chip   7 Edge      max77686-pmic, max77686-rtc
> 146:    1     exynos_gpio_irq_chip   3 Edge      3-0048
> 
> /proc/interrupts after this patch:
> 143:    0     gpx3   7 Edge      hdmi
> 144:    0     gpx3   6 Level     wm8994
> 145:    1     gpx0   7 Edge      max77686-pmic, max77686-rtc
> 146:    1     gpm2   3 Edge      3-0048
> 
> Signed-off-by: Marek Szyprowski <m.szyprowski@xxxxxxxxxxx>


Hi Marek,

Nice idea!

> ---
>  drivers/pinctrl/samsung/pinctrl-exynos.c | 27 +++++++++++++++---------
>  1 file changed, 17 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/pinctrl/samsung/pinctrl-exynos.c b/drivers/pinctrl/samsung/pinctrl-exynos.c
> index 84501c785473..1c87cf41602a 100644
> --- a/drivers/pinctrl/samsung/pinctrl-exynos.c
> +++ b/drivers/pinctrl/samsung/pinctrl-exynos.c
> @@ -207,7 +207,7 @@ static void exynos_irq_release_resources(struct irq_data *irqd)
>  /*
>   * irq_chip for gpio interrupts.
>   */
> -static struct exynos_irq_chip exynos_gpio_irq_chip = {
> +static const struct exynos_irq_chip exynos_gpio_irq_chip __initconst = {
>  	.chip = {
>  		.name = "exynos_gpio_irq_chip",
>  		.irq_unmask = exynos_irq_unmask,
> @@ -313,7 +313,13 @@ int exynos_eint_gpio_init(struct samsung_pinctrl_drv_data *d)
>  			goto err_domains;
>  		}
>  
> -		bank->irq_chip = &exynos_gpio_irq_chip;
> +		bank->irq_chip = kmemdup(&exynos_gpio_irq_chip,
> +					 sizeof(*bank->irq_chip), GFP_KERNEL);

You cannot reference initconst memory from non-init function. Build with
SECTION_MISMATCH to see the warnings.

> +		if (!bank->irq_chip) {

irq_domain_remove()

> +			ret = -ENOMEM;
> +			goto err_domains;
> +		}
> +		bank->irq_chip->chip.name = bank->name;
>  	}
>  
>  	return 0;
> @@ -521,7 +527,7 @@ int exynos_eint_wkup_init(struct samsung_pinctrl_drv_data *d)
>  	struct samsung_pin_bank *bank;
>  	struct exynos_weint_data *weint_data;
>  	struct exynos_muxed_weint_data *muxed_data;
> -	struct exynos_irq_chip *irq_chip;
> +	const struct exynos_irq_chip *irq_chip;
>  	unsigned int muxed_banks = 0;
>  	unsigned int i;
>  	int idx, irq;
> @@ -531,12 +537,7 @@ int exynos_eint_wkup_init(struct samsung_pinctrl_drv_data *d)
>  
>  		match = of_match_node(exynos_wkup_irq_ids, np);
>  		if (match) {
> -			irq_chip = kmemdup(match->data,
> -				sizeof(*irq_chip), GFP_KERNEL);
> -			if (!irq_chip) {
> -				of_node_put(np);
> -				return -ENOMEM;
> -			}
> +			irq_chip = match->data;
>  			wkup_np = np;
>  			break;
>  		}
> @@ -557,7 +558,13 @@ int exynos_eint_wkup_init(struct samsung_pinctrl_drv_data *d)
>  			return -ENXIO;
>  		}
>  
> -		bank->irq_chip = irq_chip;
> +		bank->irq_chip = kmemdup(irq_chip, sizeof(*irq_chip),
> +					 GFP_KERNEL);
> +		if (!bank->irq_chip) {
> +			of_node_put(wkup_np);

irq_domain_remove()

Best regards,
Krzysztof


> +			return -ENOMEM;
> +		}
> +		bank->irq_chip->chip.name = bank->name;
>  
>  		if (!of_find_property(bank->of_node, "interrupts", NULL)) {
>  			bank->eint_type = EINT_TYPE_WKUP_MUX;
> -- 
> 2.17.1
> 



[Index of Archives]     [Linux SPI]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux