diff mbox series

pinctrl: samsung: Use bank name as irqchip name

Message ID 20200609082329.10184-1-m.szyprowski@samsung.com
State New
Headers show
Series pinctrl: samsung: Use bank name as irqchip name | expand

Commit Message

Marek Szyprowski June 9, 2020, 8:23 a.m. UTC
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@samsung.com>

---
 drivers/pinctrl/samsung/pinctrl-exynos.c | 27 +++++++++++++++---------
 1 file changed, 17 insertions(+), 10 deletions(-)

-- 
2.17.1

Comments

kernel test robot June 9, 2020, 12:34 p.m. UTC | #1
Hi Marek,

I love your patch! Perhaps something to improve:

[auto build test WARNING on pinctrl-samsung/for-next]
[also build test WARNING on pinctrl/devel v5.7]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]

url:    https://github.com/0day-ci/linux/commits/Marek-Szyprowski/pinctrl-samsung-Use-bank-name-as-irqchip-name/20200609-162531
base:   https://git.kernel.org/pub/scm/linux/kernel/git/pinctrl/samsung.git for-next
config: arm64-randconfig-r004-20200607 (attached as .config)
compiler: aarch64-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=arm64 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All warnings (new ones prefixed by >>, old ones prefixed by <<):

>> WARNING: modpost: vmlinux.o(.text+0x997f04): Section mismatch in reference from the function exynos_eint_gpio_init() to the variable .init.rodata:exynos_gpio_irq_chip

The function exynos_eint_gpio_init() references
the variable __initconst exynos_gpio_irq_chip.
This is often because exynos_eint_gpio_init lacks a __initconst
annotation or the annotation of exynos_gpio_irq_chip is wrong.

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
Krzysztof Kozlowski June 10, 2020, 6:49 a.m. UTC | #2
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@samsung.com>



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

>
diff mbox series

Patch

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);
+		if (!bank->irq_chip) {
+			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);
+			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;