[PATCH] pinctrl: qcom-pmic-gpio: Make irqchip immutable

Manivannan Sadhasivam posted 1 patch 3 years, 9 months ago
drivers/pinctrl/qcom/pinctrl-spmi-gpio.c | 21 ++++++++++++---------
1 file changed, 12 insertions(+), 9 deletions(-)
[PATCH] pinctrl: qcom-pmic-gpio: Make irqchip immutable
Posted by Manivannan Sadhasivam 3 years, 9 months ago
Make the irqchip immutable by defining it as a const and flag it as
IRQCHIP_IMMUTABLE. This also fixes the below warning,

[    0.688749] gpio gpiochip1: (c440000.spmi:pmic@1:gpio@8800): not an
immutable chip, please consider fixing it!

Since this is a hierarchial irqchip, there is no need to explicitly tell
GPIOLIB which line has triggered the IRQ (as per the documentation).

Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
---
 drivers/pinctrl/qcom/pinctrl-spmi-gpio.c | 21 ++++++++++++---------
 1 file changed, 12 insertions(+), 9 deletions(-)

diff --git a/drivers/pinctrl/qcom/pinctrl-spmi-gpio.c b/drivers/pinctrl/qcom/pinctrl-spmi-gpio.c
index fd5fff9adff0..9b7ff649e4e0 100644
--- a/drivers/pinctrl/qcom/pinctrl-spmi-gpio.c
+++ b/drivers/pinctrl/qcom/pinctrl-spmi-gpio.c
@@ -988,6 +988,17 @@ static void *pmic_gpio_populate_parent_fwspec(struct gpio_chip *chip,
 	return fwspec;
 }
 
+static const struct irq_chip pmic_gpio_irqchip = {
+	.name = "spmi-gpio",
+	.irq_ack = irq_chip_ack_parent,
+	.irq_mask = irq_chip_mask_parent,
+	.irq_unmask = irq_chip_unmask_parent,
+	.irq_set_type = irq_chip_set_type_parent,
+	.irq_set_wake = irq_chip_set_wake_parent,
+	.flags = IRQCHIP_IMMUTABLE, IRQCHIP_MASK_ON_SUSPEND,
+	GPIOCHIP_IRQ_RESOURCE_HELPERS,
+};
+
 static int pmic_gpio_probe(struct platform_device *pdev)
 {
 	struct irq_domain *parent_domain;
@@ -1081,16 +1092,8 @@ static int pmic_gpio_probe(struct platform_device *pdev)
 	if (!parent_domain)
 		return -ENXIO;
 
-	state->irq.name = "spmi-gpio",
-	state->irq.irq_ack = irq_chip_ack_parent,
-	state->irq.irq_mask = irq_chip_mask_parent,
-	state->irq.irq_unmask = irq_chip_unmask_parent,
-	state->irq.irq_set_type = irq_chip_set_type_parent,
-	state->irq.irq_set_wake = irq_chip_set_wake_parent,
-	state->irq.flags = IRQCHIP_MASK_ON_SUSPEND,
-
 	girq = &state->chip.irq;
-	girq->chip = &state->irq;
+	gpio_irq_chip_set_chip(girq, &pmic_gpio_irqchip);
 	girq->default_type = IRQ_TYPE_NONE;
 	girq->handler = handle_level_irq;
 	girq->fwnode = of_node_to_fwnode(state->dev->of_node);
-- 
2.25.1
Re: [PATCH] pinctrl: qcom-pmic-gpio: Make irqchip immutable
Posted by kernel test robot 3 years, 9 months ago
Hi Manivannan,

I love your patch! Perhaps something to improve:

[auto build test WARNING on linusw-pinctrl/devel]
[also build test WARNING on linus/master v5.19-rc5 next-20220704]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/intel-lab-lkp/linux/commits/Manivannan-Sadhasivam/pinctrl-qcom-pmic-gpio-Make-irqchip-immutable/20220704-230712
base:   https://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl.git devel
config: arm-defconfig (https://download.01.org/0day-ci/archive/20220705/202207050342.WcNFJKKy-lkp@intel.com/config)
compiler: arm-linux-gnueabi-gcc (GCC) 11.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
        # https://github.com/intel-lab-lkp/linux/commit/4de81cf5dd3098fa10c3e384d497e024675cf068
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review Manivannan-Sadhasivam/pinctrl-qcom-pmic-gpio-Make-irqchip-immutable/20220704-230712
        git checkout 4de81cf5dd3098fa10c3e384d497e024675cf068
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.3.0 make.cross W=1 O=build_dir ARCH=arm SHELL=/bin/bash drivers/pinctrl/qcom/

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

All warnings (new ones prefixed by >>):

>> drivers/pinctrl/qcom/pinctrl-spmi-gpio.c:998:37: warning: excess elements in struct initializer
     998 |         .flags = IRQCHIP_IMMUTABLE, IRQCHIP_MASK_ON_SUSPEND,
         |                                     ^~~~~~~~~~~~~~~~~~~~~~~
   drivers/pinctrl/qcom/pinctrl-spmi-gpio.c:998:37: note: (near initialization for 'pmic_gpio_irqchip')


vim +998 drivers/pinctrl/qcom/pinctrl-spmi-gpio.c

   990	
   991	static const struct irq_chip pmic_gpio_irqchip = {
   992		.name = "spmi-gpio",
   993		.irq_ack = irq_chip_ack_parent,
   994		.irq_mask = irq_chip_mask_parent,
   995		.irq_unmask = irq_chip_unmask_parent,
   996		.irq_set_type = irq_chip_set_type_parent,
   997		.irq_set_wake = irq_chip_set_wake_parent,
 > 998		.flags = IRQCHIP_IMMUTABLE, IRQCHIP_MASK_ON_SUSPEND,
   999		GPIOCHIP_IRQ_RESOURCE_HELPERS,
  1000	};
  1001	

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp