Make irq_chip immutable for ISA drivers
Subsystems (5)
cover Make irq_chip immutable for ISA drivers
Kernel warns about mutable irq_chips in ISA drivers:
"not an immutable chip, please consider fixing!"
Make the struct irq_chip const, flag it as IRQCHIP_IMMUTABLE, add the new helper functions, and call the appropriate gpiolib functions.
William Breathitt Gray (4):
gpio: 104-dio-48e: Make irq_chip immutable
gpio: 104-idi-48: Make irq_chip immutable
gpio: 104-idio-16: Make irq_chip immutable
gpio: ws16c48: Make irq_chip immutable
drivers/gpio/gpio-104-dio-48e.c | 10 +++++++--- drivers/gpio/gpio-104-idi-48.c | 10 +++++++--- drivers/gpio/gpio-104-idio-16.c | 18 +++++++++++------- drivers/gpio/gpio-ws16c48.c | 10 +++++++--- 4 files changed, 32 insertions(+), 16 deletions(-)
base-commit: 6ae8e1d0d5e5de922315830aea975c63e8c70b2f
Signature · 1 line
2.37.2
PATCH 1/4 gpio: 104-dio-48e: Make irq_chip immutable
Kernel warns about mutable irq_chips:
"not an immutable chip, please consider fixing!"
Make the struct irq_chip const, flag it as IRQCHIP_IMMUTABLE, add the new helper functions, and call the appropriate gpiolib functions.
--- drivers/gpio/gpio-104-dio-48e.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
drivers/gpio/gpio-104-dio-48e.c +7 -3
@@ -164,6 +164,7 @@ static void dio48e_irq_mask(struct irq_data *data) dio48egpio->irq_mask &= ~BIT (0 ); else dio48egpio->irq_mask &= ~BIT(1); +gpiochip_disable_irq (chip, offset);if (!dio48egpio->irq_mask)/* disable interrupts */
@@ -191,6 +192,7 @@ static void dio48e_irq_unmask(struct irq_data *data)iowrite8 (0x00 , &dio48egpio->reg->enable_interrupt); } +gpiochip_enable_irq (chip, offset);if (offset ==19 ) dio48egpio->irq_mask |=BIT (0 );else
@@ -213,12 +215,14 @@ static int dio48e_irq_set_type(struct irq_data *data, unsigned int flow_type)return 0 ; } -static struct irq_chip dio48e_irqchip = { +static const struct irq_chip dio48e_irqchip = { .name ="104-dio-48e" , .irq_ack = dio48e_irq_ack, .irq_mask = dio48e_irq_mask, .irq_unmask = dio48e_irq_unmask, - .irq_set_type = dio48e_irq_set_type + .irq_set_type = dio48e_irq_set_type, + .flags =IRQCHIP_IMMUTABLE , +GPIOCHIP_IRQ_RESOURCE_HELPERS , };static irqreturn_t dio48e_irq_handler (int irq,void *dev_id)
@@ -322,7 +326,7 @@ static int dio48e_probe(struct device *dev, unsigned int id) dio48egpio->chip.set_multiple = dio48e_gpio_set_multiple; girq = &dio48egpio->chip.irq; - girq->chip = &dio48e_irqchip; +gpio_irq_chip_set_chip (girq, &dio48e_irqchip);/* This will let us handle the parent IRQ in the driver */ girq->parent_handler =NULL ; girq->num_parents =0 ;
Signature · 1 line
2.37.2
PATCH 2/4 gpio: 104-idi-48: Make irq_chip immutable
In reply to William Breathitt GrayKernel warns about mutable irq_chips:
"not an immutable chip, please consider fixing!"
Make the struct irq_chip const, flag it as IRQCHIP_IMMUTABLE, add the new helper functions, and call the appropriate gpiolib functions.
--- drivers/gpio/gpio-104-idi-48.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
drivers/gpio/gpio-104-idi-48.c +7 -3
@@ -113,6 +113,7 @@ static void idi_48_irq_mask(struct irq_data *data)spin_lock_irqsave (&idi48gpio->lock, flags); idi48gpio->irq_mask[boundary] &= ~mask; +gpiochip_disable_irq (chip, offset);/* Exit early if there are still input lines with IRQ unmasked */ if (idi48gpio->irq_mask[boundary])
@@ -140,6 +141,7 @@ static void idi_48_irq_unmask(struct irq_data *data) prev_irq_mask = idi48gpio->irq_mask[boundary]; +gpiochip_enable_irq (chip, offset); idi48gpio->irq_mask[boundary] |= mask;/* Exit early if IRQ was already unmasked for this boundary */
@@ -164,12 +166,14 @@ static int idi_48_irq_set_type(struct irq_data *data, unsigned int flow_type)return 0 ; } -static struct irq_chip idi_48_irqchip = { +static const struct irq_chip idi_48_irqchip = { .name ="104-idi-48" , .irq_ack = idi_48_irq_ack, .irq_mask = idi_48_irq_mask, .irq_unmask = idi_48_irq_unmask, - .irq_set_type = idi_48_irq_set_type + .irq_set_type = idi_48_irq_set_type, + .flags =IRQCHIP_IMMUTABLE , +GPIOCHIP_IRQ_RESOURCE_HELPERS , };static irqreturn_t idi_48_irq_handler (int irq,void *dev_id)
@@ -267,7 +271,7 @@ static int idi_48_probe(struct device *dev, unsigned int id) idi48gpio->chip.get_multiple = idi_48_gpio_get_multiple; girq = &idi48gpio->chip.irq; - girq->chip = &idi_48_irqchip; +gpio_irq_chip_set_chip (girq, &idi_48_irqchip);/* This will let us handle the parent IRQ in the driver */ girq->parent_handler =NULL ; girq->num_parents =0 ;
Signature · 1 line
2.37.2
PATCH 3/4 gpio: 104-idio-16: Make irq_chip immutable
In reply to William Breathitt GrayKernel warns about mutable irq_chips:
"not an immutable chip, please consider fixing!"
Make the struct irq_chip const, flag it as IRQCHIP_IMMUTABLE, add the new helper functions, and call the appropriate gpiolib functions.
--- drivers/gpio/gpio-104-idio-16.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-)
drivers/gpio/gpio-104-idio-16.c +11 -7
@@ -174,10 +174,11 @@ static void idio_16_irq_mask(struct irq_data *data) {struct gpio_chip *chip =irq_data_get_irq_chip_data (data);struct idio_16_gpio *const idio16gpio =gpiochip_get_data (chip); -const unsigned long mask =BIT (irqd_to_hwirq (data)); +const unsigned long offset =irqd_to_hwirq (data);unsigned long flags; - idio16gpio->irq_mask &= ~mask; + idio16gpio->irq_mask &= ~BIT (offset); +gpiochip_disable_irq (chip, offset);if (!idio16gpio->irq_mask) {raw_spin_lock_irqsave (&idio16gpio->lock, flags);
@@ -192,11 +193,12 @@ static void idio_16_irq_unmask(struct irq_data *data) {struct gpio_chip *chip =irq_data_get_irq_chip_data (data);struct idio_16_gpio *const idio16gpio =gpiochip_get_data (chip); -const unsigned long mask =BIT (irqd_to_hwirq (data)); +const unsigned long offset =irqd_to_hwirq (data);const unsigned long prev_irq_mask = idio16gpio->irq_mask;unsigned long flags; - idio16gpio->irq_mask |= mask; +gpiochip_enable_irq (chip, offset); + idio16gpio->irq_mask |=BIT (offset);if (!prev_irq_mask) {raw_spin_lock_irqsave (&idio16gpio->lock, flags);
@@ -217,12 +219,14 @@ static int idio_16_irq_set_type(struct irq_data *data, unsigned int flow_type)return 0 ; } -static struct irq_chip idio_16_irqchip = { +static const struct irq_chip idio_16_irqchip = { .name ="104-idio-16" , .irq_ack = idio_16_irq_ack, .irq_mask = idio_16_irq_mask, .irq_unmask = idio_16_irq_unmask, - .irq_set_type = idio_16_irq_set_type + .irq_set_type = idio_16_irq_set_type, + .flags =IRQCHIP_IMMUTABLE , +GPIOCHIP_IRQ_RESOURCE_HELPERS , };static irqreturn_t idio_16_irq_handler (int irq,void *dev_id)
@@ -299,7 +303,7 @@ static int idio_16_probe(struct device *dev, unsigned int id) idio16gpio->out_state =0xFFFF ; girq = &idio16gpio->chip.irq; - girq->chip = &idio_16_irqchip; +gpio_irq_chip_set_chip (girq, &idio_16_irqchip);/* This will let us handle the parent IRQ in the driver */ girq->parent_handler =NULL ; girq->num_parents =0 ;
Signature · 1 line
2.37.2
PATCH 4/4 gpio: ws16c48: Make irq_chip immutable
In reply to William Breathitt GrayKernel warns about mutable irq_chips:
"not an immutable chip, please consider fixing!"
Make the struct irq_chip const, flag it as IRQCHIP_IMMUTABLE, add the new helper functions, and call the appropriate gpiolib functions.
--- drivers/gpio/gpio-ws16c48.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
drivers/gpio/gpio-ws16c48.c +7 -3
@@ -265,6 +265,7 @@ static void ws16c48_irq_mask(struct irq_data *data)raw_spin_lock_irqsave (&ws16c48gpio->lock, flags); ws16c48gpio->irq_mask &= ~mask; +gpiochip_disable_irq (chip, offset); port_state = ws16c48gpio->irq_mask >> (8 * port);/* Select Register Page 2; Unlock all I/O ports */
@@ -295,6 +296,7 @@ static void ws16c48_irq_unmask(struct irq_data *data)raw_spin_lock_irqsave (&ws16c48gpio->lock, flags); +gpiochip_enable_irq (chip, offset); ws16c48gpio->irq_mask |= mask; port_state = ws16c48gpio->irq_mask >> (8 * port);
@@ -356,12 +358,14 @@ static int ws16c48_irq_set_type(struct irq_data *data, unsigned flow_type)return 0 ; } -static struct irq_chip ws16c48_irqchip = { +static const struct irq_chip ws16c48_irqchip = { .name ="ws16c48" , .irq_ack = ws16c48_irq_ack, .irq_mask = ws16c48_irq_mask, .irq_unmask = ws16c48_irq_unmask, - .irq_set_type = ws16c48_irq_set_type + .irq_set_type = ws16c48_irq_set_type, + .flags =IRQCHIP_IMMUTABLE , +GPIOCHIP_IRQ_RESOURCE_HELPERS , };static irqreturn_t ws16c48_irq_handler (int irq,void *dev_id)
@@ -463,7 +467,7 @@ static int ws16c48_probe(struct device *dev, unsigned int id) ws16c48gpio->chip.set_multiple = ws16c48_gpio_set_multiple; girq = &ws16c48gpio->chip.irq; - girq->chip = &ws16c48_irqchip; +gpio_irq_chip_set_chip (girq, &ws16c48_irqchip);/* This will let us handle the parent IRQ in the driver */ girq->parent_handler =NULL ; girq->num_parents =0 ;
Signature · 1 line
2.37.2
Bartosz Golaszewski
AppliedQuoted 21 lines · William Breathitt Gray
Kernel warns about mutable
irq_chipsin ISA drivers:"not an immutable chip, please consider fixing!"
Make the struct
irq_chipconst, flag it asIRQCHIP_IMMUTABLE, add the new helper functions, and call the appropriate gpiolib functions.William Breathitt Gray (4):
gpio: 104-dio-48e: Makeirq_chipimmutable
gpio: 104-idi-48: Makeirq_chipimmutable
gpio: 104-idio-16: Makeirq_chipimmutable
gpio: ws16c48: Makeirq_chipimmutabledrivers/gpio/gpio-104-dio-48e.c | 10 +++++++--- drivers/gpio/gpio-104-idi-48.c | 10 +++++++--- drivers/gpio/gpio-104-idio-16.c | 18 +++++++++++------- drivers/gpio/gpio-ws16c48.c | 10 +++++++--- 4 files changed, 32 insertions(+), 16 deletions(-)
Quoted 4 lines
base-commit:
6ae8e1d0d5e5de922315830aea975c63e8c70b2f--
2.37.2
Queued for fixes, thanks!
Bart