linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3 0/2] Drop map from handle_mask_sync() parameters
@ 2023-03-20 14:50 William Breathitt Gray
  2023-03-20 14:50 ` [PATCH v3 1/2] gpio: 104-dio-48e: Implement struct dio48e_gpio William Breathitt Gray
                   ` (3 more replies)
  0 siblings, 4 replies; 13+ messages in thread
From: William Breathitt Gray @ 2023-03-20 14:50 UTC (permalink / raw)
  To: Mark Brown, Linus Walleij, Bartosz Golaszewski
  Cc: linux-kernel, linux-gpio, Andy Shevchenko, William Breathitt Gray

Changes in v3:
 - Inline dio48gpio->map usage in dio48e_handle_mask_sync() to avoid
   redefining map parameter

Remove the map parameter from the struct regmap_irq_chip callback
handle_mask_sync() because it can be passed via the irq_drv_data
parameter instead. The gpio-104-dio-48e driver is the only consumer of
this callback and is thus updated accordingly.

A couple pending patchsets also utilize handle_mask_sync() [0][1], so
it'll be useful to merge the changes in this series first to avoid
subsequent noise adjusting the dependent drivers.

[0] https://lore.kernel.org/r/cover.1677515341.git.william.gray@linaro.org/
[1] https://lore.kernel.org/r/cover.1678106722.git.william.gray@linaro.org/

William Breathitt Gray (2):
  gpio: 104-dio-48e: Implement struct dio48e_gpio
  regmap-irq: Drop map from handle_mask_sync() parameters

 drivers/base/regmap/regmap-irq.c |  5 ++---
 drivers/gpio/gpio-104-dio-48e.c  | 37 +++++++++++++++++++++-----------
 include/linux/regmap.h           |  3 +--
 3 files changed, 28 insertions(+), 17 deletions(-)


base-commit: 03810031c91dfe448cd116ee987d5dc4139006f4
-- 
2.39.2


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH v3 1/2] gpio: 104-dio-48e: Implement struct dio48e_gpio
  2023-03-20 14:50 [PATCH v3 0/2] Drop map from handle_mask_sync() parameters William Breathitt Gray
@ 2023-03-20 14:50 ` William Breathitt Gray
  2023-04-07 11:47   ` [RESEND PATCH " William Breathitt Gray
  2023-04-11 20:23   ` [PATCH " Mark Brown
  2023-03-20 14:50 ` [PATCH v3 2/2] regmap-irq: Drop map from handle_mask_sync() parameters William Breathitt Gray
                   ` (2 subsequent siblings)
  3 siblings, 2 replies; 13+ messages in thread
From: William Breathitt Gray @ 2023-03-20 14:50 UTC (permalink / raw)
  To: Mark Brown, Linus Walleij, Bartosz Golaszewski
  Cc: linux-kernel, linux-gpio, Andy Shevchenko, William Breathitt Gray

A private data structure struct dio48e_gpio is introduced to facilitate
passage of the regmap and IRQ mask state for the device to the callback
dio48e_handle_mask_sync(). This is in preparation for the removal of the
handle_mask_sync() map parameter in a subsequent patch.

Signed-off-by: William Breathitt Gray <william.gray@linaro.org>
---
Changes in v3:
 - Inline dio48gpio->map usage in dio48e_handle_mask_sync() to avoid
   redefining map parameter

 drivers/gpio/gpio-104-dio-48e.c | 35 ++++++++++++++++++++++-----------
 1 file changed, 24 insertions(+), 11 deletions(-)

diff --git a/drivers/gpio/gpio-104-dio-48e.c b/drivers/gpio/gpio-104-dio-48e.c
index 74e2721f2613..3516321c92b0 100644
--- a/drivers/gpio/gpio-104-dio-48e.c
+++ b/drivers/gpio/gpio-104-dio-48e.c
@@ -99,13 +99,23 @@ static const struct regmap_irq dio48e_regmap_irqs[] = {
 	DIO48E_REGMAP_IRQ(0), DIO48E_REGMAP_IRQ(1),
 };
 
+/**
+ * struct dio48e_gpio - GPIO device private data structure
+ * @map:	Regmap for the device
+ * @irq_mask:	Current IRQ mask state on the device
+ */
+struct dio48e_gpio {
+	struct regmap *map;
+	unsigned int irq_mask;
+};
+
 static int dio48e_handle_mask_sync(struct regmap *const map, const int index,
 				   const unsigned int mask_buf_def,
 				   const unsigned int mask_buf,
 				   void *const irq_drv_data)
 {
-	unsigned int *const irq_mask = irq_drv_data;
-	const unsigned int prev_mask = *irq_mask;
+	struct dio48e_gpio *const dio48egpio = irq_drv_data;
+	const unsigned int prev_mask = dio48egpio->irq_mask;
 	int err;
 	unsigned int val;
 
@@ -114,19 +124,19 @@ static int dio48e_handle_mask_sync(struct regmap *const map, const int index,
 		return 0;
 
 	/* remember the current mask for the next mask sync */
-	*irq_mask = mask_buf;
+	dio48egpio->irq_mask = mask_buf;
 
 	/* if all previously masked, enable interrupts when unmasking */
 	if (prev_mask == mask_buf_def) {
-		err = regmap_write(map, DIO48E_CLEAR_INTERRUPT, 0x00);
+		err = regmap_write(dio48egpio->map, DIO48E_CLEAR_INTERRUPT, 0x00);
 		if (err)
 			return err;
-		return regmap_write(map, DIO48E_ENABLE_INTERRUPT, 0x00);
+		return regmap_write(dio48egpio->map, DIO48E_ENABLE_INTERRUPT, 0x00);
 	}
 
 	/* if all are currently masked, disable interrupts */
 	if (mask_buf == mask_buf_def)
-		return regmap_read(map, DIO48E_DISABLE_INTERRUPT, &val);
+		return regmap_read(dio48egpio->map, DIO48E_DISABLE_INTERRUPT, &val);
 
 	return 0;
 }
@@ -167,7 +177,7 @@ static int dio48e_probe(struct device *dev, unsigned int id)
 	struct regmap *map;
 	int err;
 	struct regmap_irq_chip *chip;
-	unsigned int irq_mask;
+	struct dio48e_gpio *dio48egpio;
 	struct regmap_irq_chip_data *chip_data;
 
 	if (!devm_request_region(dev, base[id], DIO48E_EXTENT, name)) {
@@ -185,12 +195,14 @@ static int dio48e_probe(struct device *dev, unsigned int id)
 		return dev_err_probe(dev, PTR_ERR(map),
 				     "Unable to initialize register map\n");
 
-	chip = devm_kzalloc(dev, sizeof(*chip), GFP_KERNEL);
-	if (!chip)
+	dio48egpio = devm_kzalloc(dev, sizeof(*dio48egpio), GFP_KERNEL);
+	if (!dio48egpio)
 		return -ENOMEM;
 
-	chip->irq_drv_data = devm_kzalloc(dev, sizeof(irq_mask), GFP_KERNEL);
-	if (!chip->irq_drv_data)
+	dio48egpio->map = map;
+
+	chip = devm_kzalloc(dev, sizeof(*chip), GFP_KERNEL);
+	if (!chip)
 		return -ENOMEM;
 
 	chip->name = name;
@@ -205,6 +217,7 @@ static int dio48e_probe(struct device *dev, unsigned int id)
 	chip->irqs = dio48e_regmap_irqs;
 	chip->num_irqs = ARRAY_SIZE(dio48e_regmap_irqs);
 	chip->handle_mask_sync = dio48e_handle_mask_sync;
+	chip->irq_drv_data = dio48egpio;
 
 	/* Initialize to prevent spurious interrupts before we're ready */
 	err = dio48e_irq_init_hw(map);
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH v3 2/2] regmap-irq: Drop map from handle_mask_sync() parameters
  2023-03-20 14:50 [PATCH v3 0/2] Drop map from handle_mask_sync() parameters William Breathitt Gray
  2023-03-20 14:50 ` [PATCH v3 1/2] gpio: 104-dio-48e: Implement struct dio48e_gpio William Breathitt Gray
@ 2023-03-20 14:50 ` William Breathitt Gray
  2023-04-07 11:47   ` [RESEND PATCH " William Breathitt Gray
  2023-03-20 15:32 ` [PATCH v3 0/2] " Andy Shevchenko
  2023-04-07 11:47 ` [RESEND PATCH " William Breathitt Gray
  3 siblings, 1 reply; 13+ messages in thread
From: William Breathitt Gray @ 2023-03-20 14:50 UTC (permalink / raw)
  To: Mark Brown, Linus Walleij, Bartosz Golaszewski
  Cc: linux-kernel, linux-gpio, Andy Shevchenko, William Breathitt Gray

Remove the map parameter from the struct regmap_irq_chip callback
handle_mask_sync() because it can be passed via the irq_drv_data
parameter instead. The gpio-104-dio-48e driver is the only consumer of
this callback and is thus updated accordingly.

Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: William Breathitt Gray <william.gray@linaro.org>
---
 drivers/base/regmap/regmap-irq.c | 5 ++---
 drivers/gpio/gpio-104-dio-48e.c  | 2 +-
 include/linux/regmap.h           | 3 +--
 3 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/drivers/base/regmap/regmap-irq.c b/drivers/base/regmap/regmap-irq.c
index 8c903b8c9714..a9337192ddd3 100644
--- a/drivers/base/regmap/regmap-irq.c
+++ b/drivers/base/regmap/regmap-irq.c
@@ -116,8 +116,7 @@ static void regmap_irq_sync_unlock(struct irq_data *data)
 	for (i = 0; i < d->chip->num_regs; i++) {
 		if (d->mask_base) {
 			if (d->chip->handle_mask_sync)
-				d->chip->handle_mask_sync(d->map, i,
-							  d->mask_buf_def[i],
+				d->chip->handle_mask_sync(i, d->mask_buf_def[i],
 							  d->mask_buf[i],
 							  d->chip->irq_drv_data);
 			else {
@@ -915,7 +914,7 @@ int regmap_add_irq_chip_fwnode(struct fwnode_handle *fwnode,
 
 		if (d->mask_base) {
 			if (chip->handle_mask_sync) {
-				ret = chip->handle_mask_sync(d->map, i,
+				ret = chip->handle_mask_sync(i,
 							     d->mask_buf_def[i],
 							     d->mask_buf[i],
 							     chip->irq_drv_data);
diff --git a/drivers/gpio/gpio-104-dio-48e.c b/drivers/gpio/gpio-104-dio-48e.c
index 3516321c92b0..509864d36940 100644
--- a/drivers/gpio/gpio-104-dio-48e.c
+++ b/drivers/gpio/gpio-104-dio-48e.c
@@ -109,7 +109,7 @@ struct dio48e_gpio {
 	unsigned int irq_mask;
 };
 
-static int dio48e_handle_mask_sync(struct regmap *const map, const int index,
+static int dio48e_handle_mask_sync(const int index,
 				   const unsigned int mask_buf_def,
 				   const unsigned int mask_buf,
 				   void *const irq_drv_data)
diff --git a/include/linux/regmap.h b/include/linux/regmap.h
index 4d10790adeb0..6e18d8b405b1 100644
--- a/include/linux/regmap.h
+++ b/include/linux/regmap.h
@@ -1644,8 +1644,7 @@ struct regmap_irq_chip {
 
 	int (*handle_pre_irq)(void *irq_drv_data);
 	int (*handle_post_irq)(void *irq_drv_data);
-	int (*handle_mask_sync)(struct regmap *map, int index,
-				unsigned int mask_buf_def,
+	int (*handle_mask_sync)(int index, unsigned int mask_buf_def,
 				unsigned int mask_buf, void *irq_drv_data);
 	int (*set_type_virt)(unsigned int **buf, unsigned int type,
 			     unsigned long hwirq, int reg);
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: [PATCH v3 0/2] Drop map from handle_mask_sync() parameters
  2023-03-20 14:50 [PATCH v3 0/2] Drop map from handle_mask_sync() parameters William Breathitt Gray
  2023-03-20 14:50 ` [PATCH v3 1/2] gpio: 104-dio-48e: Implement struct dio48e_gpio William Breathitt Gray
  2023-03-20 14:50 ` [PATCH v3 2/2] regmap-irq: Drop map from handle_mask_sync() parameters William Breathitt Gray
@ 2023-03-20 15:32 ` Andy Shevchenko
  2023-03-22 16:55   ` Bartosz Golaszewski
  2023-04-07 11:47 ` [RESEND PATCH " William Breathitt Gray
  3 siblings, 1 reply; 13+ messages in thread
From: Andy Shevchenko @ 2023-03-20 15:32 UTC (permalink / raw)
  To: William Breathitt Gray
  Cc: Mark Brown, Linus Walleij, Bartosz Golaszewski, linux-kernel, linux-gpio

On Mon, Mar 20, 2023 at 10:50:14AM -0400, William Breathitt Gray wrote:
> Changes in v3:
>  - Inline dio48gpio->map usage in dio48e_handle_mask_sync() to avoid
>    redefining map parameter
> 
> Remove the map parameter from the struct regmap_irq_chip callback
> handle_mask_sync() because it can be passed via the irq_drv_data
> parameter instead. The gpio-104-dio-48e driver is the only consumer of
> this callback and is thus updated accordingly.
> 
> A couple pending patchsets also utilize handle_mask_sync() [0][1], so
> it'll be useful to merge the changes in this series first to avoid
> subsequent noise adjusting the dependent drivers.

Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

I believe this should go to the immutable branch somewhere, so GPIO and regmap
subsystems can pull from.

> [0] https://lore.kernel.org/r/cover.1677515341.git.william.gray@linaro.org/
> [1] https://lore.kernel.org/r/cover.1678106722.git.william.gray@linaro.org/
> 
> William Breathitt Gray (2):
>   gpio: 104-dio-48e: Implement struct dio48e_gpio
>   regmap-irq: Drop map from handle_mask_sync() parameters
> 
>  drivers/base/regmap/regmap-irq.c |  5 ++---
>  drivers/gpio/gpio-104-dio-48e.c  | 37 +++++++++++++++++++++-----------
>  include/linux/regmap.h           |  3 +--
>  3 files changed, 28 insertions(+), 17 deletions(-)
> 
> 
> base-commit: 03810031c91dfe448cd116ee987d5dc4139006f4
> -- 
> 2.39.2
> 

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v3 0/2] Drop map from handle_mask_sync() parameters
  2023-03-20 15:32 ` [PATCH v3 0/2] " Andy Shevchenko
@ 2023-03-22 16:55   ` Bartosz Golaszewski
  0 siblings, 0 replies; 13+ messages in thread
From: Bartosz Golaszewski @ 2023-03-22 16:55 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: William Breathitt Gray, Mark Brown, Linus Walleij, linux-kernel,
	linux-gpio

On Mon, Mar 20, 2023 at 4:32 PM Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
>
> On Mon, Mar 20, 2023 at 10:50:14AM -0400, William Breathitt Gray wrote:
> > Changes in v3:
> >  - Inline dio48gpio->map usage in dio48e_handle_mask_sync() to avoid
> >    redefining map parameter
> >
> > Remove the map parameter from the struct regmap_irq_chip callback
> > handle_mask_sync() because it can be passed via the irq_drv_data
> > parameter instead. The gpio-104-dio-48e driver is the only consumer of
> > this callback and is thus updated accordingly.
> >
> > A couple pending patchsets also utilize handle_mask_sync() [0][1], so
> > it'll be useful to merge the changes in this series first to avoid
> > subsequent noise adjusting the dependent drivers.
>
> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
>
> I believe this should go to the immutable branch somewhere, so GPIO and regmap
> subsystems can pull from.
>
> > [0] https://lore.kernel.org/r/cover.1677515341.git.william.gray@linaro.org/
> > [1] https://lore.kernel.org/r/cover.1678106722.git.william.gray@linaro.org/
> >
> > William Breathitt Gray (2):
> >   gpio: 104-dio-48e: Implement struct dio48e_gpio
> >   regmap-irq: Drop map from handle_mask_sync() parameters
> >
> >  drivers/base/regmap/regmap-irq.c |  5 ++---
> >  drivers/gpio/gpio-104-dio-48e.c  | 37 +++++++++++++++++++++-----------
> >  include/linux/regmap.h           |  3 +--
> >  3 files changed, 28 insertions(+), 17 deletions(-)
> >
> >
> > base-commit: 03810031c91dfe448cd116ee987d5dc4139006f4
> > --
> > 2.39.2
> >
>
> --
> With Best Regards,
> Andy Shevchenko
>
>

Since patch 2/2 touches both GPIO and regmap, ideally I would get an
Ack from Mark and take it through GPIO tree and then possibly provide
Mark with a tag.

Bart

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [RESEND PATCH v3 0/2] Drop map from handle_mask_sync() parameters
  2023-03-20 14:50 [PATCH v3 0/2] Drop map from handle_mask_sync() parameters William Breathitt Gray
                   ` (2 preceding siblings ...)
  2023-03-20 15:32 ` [PATCH v3 0/2] " Andy Shevchenko
@ 2023-04-07 11:47 ` William Breathitt Gray
  3 siblings, 0 replies; 13+ messages in thread
From: William Breathitt Gray @ 2023-04-07 11:47 UTC (permalink / raw)
  To: Mark Brown, Linus Walleij, Bartosz Golaszewski
  Cc: linux-kernel, linux-gpio, Andy Shevchenko, William Breathitt Gray

Changes in v3:
 - Inline dio48gpio->map usage in dio48e_handle_mask_sync() to avoid
   redefining map parameter

Remove the map parameter from the struct regmap_irq_chip callback
handle_mask_sync() because it can be passed via the irq_drv_data
parameter instead. The gpio-104-dio-48e driver is the only consumer of
this callback and is thus updated accordingly.

A couple pending patchsets also utilize handle_mask_sync() [0][1], so
it'll be useful to merge the changes in this series first to avoid
subsequent noise adjusting the dependent drivers.

[0] https://lore.kernel.org/r/cover.1677515341.git.william.gray@linaro.org/
[1] https://lore.kernel.org/r/cover.1678106722.git.william.gray@linaro.org/

William Breathitt Gray (2):
  gpio: 104-dio-48e: Implement struct dio48e_gpio
  regmap-irq: Drop map from handle_mask_sync() parameters

 drivers/base/regmap/regmap-irq.c |  5 ++---
 drivers/gpio/gpio-104-dio-48e.c  | 37 +++++++++++++++++++++-----------
 include/linux/regmap.h           |  3 +--
 3 files changed, 28 insertions(+), 17 deletions(-)


base-commit: 03810031c91dfe448cd116ee987d5dc4139006f4
-- 
2.39.2


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [RESEND PATCH v3 1/2] gpio: 104-dio-48e: Implement struct dio48e_gpio
  2023-03-20 14:50 ` [PATCH v3 1/2] gpio: 104-dio-48e: Implement struct dio48e_gpio William Breathitt Gray
@ 2023-04-07 11:47   ` William Breathitt Gray
  2023-04-11 20:23   ` [PATCH " Mark Brown
  1 sibling, 0 replies; 13+ messages in thread
From: William Breathitt Gray @ 2023-04-07 11:47 UTC (permalink / raw)
  To: Mark Brown, Linus Walleij, Bartosz Golaszewski
  Cc: linux-kernel, linux-gpio, Andy Shevchenko, William Breathitt Gray

A private data structure struct dio48e_gpio is introduced to facilitate
passage of the regmap and IRQ mask state for the device to the callback
dio48e_handle_mask_sync(). This is in preparation for the removal of the
handle_mask_sync() map parameter in a subsequent patch.

Signed-off-by: William Breathitt Gray <william.gray@linaro.org>
---
Changes in v3:
 - Inline dio48gpio->map usage in dio48e_handle_mask_sync() to avoid
   redefining map parameter

 drivers/gpio/gpio-104-dio-48e.c | 35 ++++++++++++++++++++++-----------
 1 file changed, 24 insertions(+), 11 deletions(-)

diff --git a/drivers/gpio/gpio-104-dio-48e.c b/drivers/gpio/gpio-104-dio-48e.c
index 74e2721f2613..3516321c92b0 100644
--- a/drivers/gpio/gpio-104-dio-48e.c
+++ b/drivers/gpio/gpio-104-dio-48e.c
@@ -99,13 +99,23 @@ static const struct regmap_irq dio48e_regmap_irqs[] = {
 	DIO48E_REGMAP_IRQ(0), DIO48E_REGMAP_IRQ(1),
 };
 
+/**
+ * struct dio48e_gpio - GPIO device private data structure
+ * @map:	Regmap for the device
+ * @irq_mask:	Current IRQ mask state on the device
+ */
+struct dio48e_gpio {
+	struct regmap *map;
+	unsigned int irq_mask;
+};
+
 static int dio48e_handle_mask_sync(struct regmap *const map, const int index,
 				   const unsigned int mask_buf_def,
 				   const unsigned int mask_buf,
 				   void *const irq_drv_data)
 {
-	unsigned int *const irq_mask = irq_drv_data;
-	const unsigned int prev_mask = *irq_mask;
+	struct dio48e_gpio *const dio48egpio = irq_drv_data;
+	const unsigned int prev_mask = dio48egpio->irq_mask;
 	int err;
 	unsigned int val;
 
@@ -114,19 +124,19 @@ static int dio48e_handle_mask_sync(struct regmap *const map, const int index,
 		return 0;
 
 	/* remember the current mask for the next mask sync */
-	*irq_mask = mask_buf;
+	dio48egpio->irq_mask = mask_buf;
 
 	/* if all previously masked, enable interrupts when unmasking */
 	if (prev_mask == mask_buf_def) {
-		err = regmap_write(map, DIO48E_CLEAR_INTERRUPT, 0x00);
+		err = regmap_write(dio48egpio->map, DIO48E_CLEAR_INTERRUPT, 0x00);
 		if (err)
 			return err;
-		return regmap_write(map, DIO48E_ENABLE_INTERRUPT, 0x00);
+		return regmap_write(dio48egpio->map, DIO48E_ENABLE_INTERRUPT, 0x00);
 	}
 
 	/* if all are currently masked, disable interrupts */
 	if (mask_buf == mask_buf_def)
-		return regmap_read(map, DIO48E_DISABLE_INTERRUPT, &val);
+		return regmap_read(dio48egpio->map, DIO48E_DISABLE_INTERRUPT, &val);
 
 	return 0;
 }
@@ -167,7 +177,7 @@ static int dio48e_probe(struct device *dev, unsigned int id)
 	struct regmap *map;
 	int err;
 	struct regmap_irq_chip *chip;
-	unsigned int irq_mask;
+	struct dio48e_gpio *dio48egpio;
 	struct regmap_irq_chip_data *chip_data;
 
 	if (!devm_request_region(dev, base[id], DIO48E_EXTENT, name)) {
@@ -185,12 +195,14 @@ static int dio48e_probe(struct device *dev, unsigned int id)
 		return dev_err_probe(dev, PTR_ERR(map),
 				     "Unable to initialize register map\n");
 
-	chip = devm_kzalloc(dev, sizeof(*chip), GFP_KERNEL);
-	if (!chip)
+	dio48egpio = devm_kzalloc(dev, sizeof(*dio48egpio), GFP_KERNEL);
+	if (!dio48egpio)
 		return -ENOMEM;
 
-	chip->irq_drv_data = devm_kzalloc(dev, sizeof(irq_mask), GFP_KERNEL);
-	if (!chip->irq_drv_data)
+	dio48egpio->map = map;
+
+	chip = devm_kzalloc(dev, sizeof(*chip), GFP_KERNEL);
+	if (!chip)
 		return -ENOMEM;
 
 	chip->name = name;
@@ -205,6 +217,7 @@ static int dio48e_probe(struct device *dev, unsigned int id)
 	chip->irqs = dio48e_regmap_irqs;
 	chip->num_irqs = ARRAY_SIZE(dio48e_regmap_irqs);
 	chip->handle_mask_sync = dio48e_handle_mask_sync;
+	chip->irq_drv_data = dio48egpio;
 
 	/* Initialize to prevent spurious interrupts before we're ready */
 	err = dio48e_irq_init_hw(map);
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [RESEND PATCH v3 2/2] regmap-irq: Drop map from handle_mask_sync() parameters
  2023-03-20 14:50 ` [PATCH v3 2/2] regmap-irq: Drop map from handle_mask_sync() parameters William Breathitt Gray
@ 2023-04-07 11:47   ` William Breathitt Gray
  0 siblings, 0 replies; 13+ messages in thread
From: William Breathitt Gray @ 2023-04-07 11:47 UTC (permalink / raw)
  To: Mark Brown, Linus Walleij, Bartosz Golaszewski
  Cc: linux-kernel, linux-gpio, Andy Shevchenko, William Breathitt Gray

Remove the map parameter from the struct regmap_irq_chip callback
handle_mask_sync() because it can be passed via the irq_drv_data
parameter instead. The gpio-104-dio-48e driver is the only consumer of
this callback and is thus updated accordingly.

Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: William Breathitt Gray <william.gray@linaro.org>
---
 drivers/base/regmap/regmap-irq.c | 5 ++---
 drivers/gpio/gpio-104-dio-48e.c  | 2 +-
 include/linux/regmap.h           | 3 +--
 3 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/drivers/base/regmap/regmap-irq.c b/drivers/base/regmap/regmap-irq.c
index 8c903b8c9714..a9337192ddd3 100644
--- a/drivers/base/regmap/regmap-irq.c
+++ b/drivers/base/regmap/regmap-irq.c
@@ -116,8 +116,7 @@ static void regmap_irq_sync_unlock(struct irq_data *data)
 	for (i = 0; i < d->chip->num_regs; i++) {
 		if (d->mask_base) {
 			if (d->chip->handle_mask_sync)
-				d->chip->handle_mask_sync(d->map, i,
-							  d->mask_buf_def[i],
+				d->chip->handle_mask_sync(i, d->mask_buf_def[i],
 							  d->mask_buf[i],
 							  d->chip->irq_drv_data);
 			else {
@@ -915,7 +914,7 @@ int regmap_add_irq_chip_fwnode(struct fwnode_handle *fwnode,
 
 		if (d->mask_base) {
 			if (chip->handle_mask_sync) {
-				ret = chip->handle_mask_sync(d->map, i,
+				ret = chip->handle_mask_sync(i,
 							     d->mask_buf_def[i],
 							     d->mask_buf[i],
 							     chip->irq_drv_data);
diff --git a/drivers/gpio/gpio-104-dio-48e.c b/drivers/gpio/gpio-104-dio-48e.c
index 3516321c92b0..509864d36940 100644
--- a/drivers/gpio/gpio-104-dio-48e.c
+++ b/drivers/gpio/gpio-104-dio-48e.c
@@ -109,7 +109,7 @@ struct dio48e_gpio {
 	unsigned int irq_mask;
 };
 
-static int dio48e_handle_mask_sync(struct regmap *const map, const int index,
+static int dio48e_handle_mask_sync(const int index,
 				   const unsigned int mask_buf_def,
 				   const unsigned int mask_buf,
 				   void *const irq_drv_data)
diff --git a/include/linux/regmap.h b/include/linux/regmap.h
index 4d10790adeb0..6e18d8b405b1 100644
--- a/include/linux/regmap.h
+++ b/include/linux/regmap.h
@@ -1644,8 +1644,7 @@ struct regmap_irq_chip {
 
 	int (*handle_pre_irq)(void *irq_drv_data);
 	int (*handle_post_irq)(void *irq_drv_data);
-	int (*handle_mask_sync)(struct regmap *map, int index,
-				unsigned int mask_buf_def,
+	int (*handle_mask_sync)(int index, unsigned int mask_buf_def,
 				unsigned int mask_buf, void *irq_drv_data);
 	int (*set_type_virt)(unsigned int **buf, unsigned int type,
 			     unsigned long hwirq, int reg);
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: [PATCH v3 1/2] gpio: 104-dio-48e: Implement struct dio48e_gpio
  2023-04-11 20:23   ` [PATCH " Mark Brown
@ 2023-04-11 18:36     ` William Breathitt Gray
  2023-04-11 21:15       ` Mark Brown
  0 siblings, 1 reply; 13+ messages in thread
From: William Breathitt Gray @ 2023-04-11 18:36 UTC (permalink / raw)
  To: Mark Brown
  Cc: Linus Walleij, Bartosz Golaszewski, linux-kernel, linux-gpio,
	Andy Shevchenko

[-- Attachment #1: Type: text/plain, Size: 1100 bytes --]

On Tue, Apr 11, 2023 at 09:23:55PM +0100, Mark Brown wrote:
> On Mon, Mar 20, 2023 at 10:50:15AM -0400, William Breathitt Gray wrote:
> > A private data structure struct dio48e_gpio is introduced to facilitate
> > passage of the regmap and IRQ mask state for the device to the callback
> > dio48e_handle_mask_sync(). This is in preparation for the removal of the
> > handle_mask_sync() map parameter in a subsequent patch.
> 
> What's the story with this patch?

Currently dio48e_handle_mask_sync() uses the map argument in its
implementation. Once the map parameter is removed, the current
implementation of dio48e_handle_mask_sync() will no longer build, so we
must adjust the implementation to no longer depend on map.

The reason for this particular patch is to keep the reimplementation of
dio48e_handle_mask_sync() separate so that the handle_mask_sync() map
parameter removal patch is simple. This keeps the git history clear
and allows us to address any possible regressions to 104-dio-48e
separately without affecting the handle_mask_sync() API.

William Breathitt Gray

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v3 1/2] gpio: 104-dio-48e: Implement struct dio48e_gpio
  2023-03-20 14:50 ` [PATCH v3 1/2] gpio: 104-dio-48e: Implement struct dio48e_gpio William Breathitt Gray
  2023-04-07 11:47   ` [RESEND PATCH " William Breathitt Gray
@ 2023-04-11 20:23   ` Mark Brown
  2023-04-11 18:36     ` William Breathitt Gray
  1 sibling, 1 reply; 13+ messages in thread
From: Mark Brown @ 2023-04-11 20:23 UTC (permalink / raw)
  To: William Breathitt Gray
  Cc: Linus Walleij, Bartosz Golaszewski, linux-kernel, linux-gpio,
	Andy Shevchenko

[-- Attachment #1: Type: text/plain, Size: 388 bytes --]

On Mon, Mar 20, 2023 at 10:50:15AM -0400, William Breathitt Gray wrote:
> A private data structure struct dio48e_gpio is introduced to facilitate
> passage of the regmap and IRQ mask state for the device to the callback
> dio48e_handle_mask_sync(). This is in preparation for the removal of the
> handle_mask_sync() map parameter in a subsequent patch.

What's the story with this patch?

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v3 1/2] gpio: 104-dio-48e: Implement struct dio48e_gpio
  2023-04-11 18:36     ` William Breathitt Gray
@ 2023-04-11 21:15       ` Mark Brown
  2023-04-11 21:35         ` William Breathitt Gray
  0 siblings, 1 reply; 13+ messages in thread
From: Mark Brown @ 2023-04-11 21:15 UTC (permalink / raw)
  To: William Breathitt Gray
  Cc: Linus Walleij, Bartosz Golaszewski, linux-kernel, linux-gpio,
	Andy Shevchenko

[-- Attachment #1: Type: text/plain, Size: 914 bytes --]

On Tue, Apr 11, 2023 at 02:36:23PM -0400, William Breathitt Gray wrote:
> On Tue, Apr 11, 2023 at 09:23:55PM +0100, Mark Brown wrote:
> > On Mon, Mar 20, 2023 at 10:50:15AM -0400, William Breathitt Gray wrote:
> > > A private data structure struct dio48e_gpio is introduced to facilitate
> > > passage of the regmap and IRQ mask state for the device to the callback
> > > dio48e_handle_mask_sync(). This is in preparation for the removal of the
> > > handle_mask_sync() map parameter in a subsequent patch.

> > What's the story with this patch?

> Currently dio48e_handle_mask_sync() uses the map argument in its
> implementation. Once the map parameter is removed, the current
> implementation of dio48e_handle_mask_sync() will no longer build, so we
> must adjust the implementation to no longer depend on map.

I mean what's the story with getting this patch applied?  It doesn't
seem to have been reviewed...

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v3 1/2] gpio: 104-dio-48e: Implement struct dio48e_gpio
  2023-04-11 21:15       ` Mark Brown
@ 2023-04-11 21:35         ` William Breathitt Gray
  2023-04-21  8:20           ` Linus Walleij
  0 siblings, 1 reply; 13+ messages in thread
From: William Breathitt Gray @ 2023-04-11 21:35 UTC (permalink / raw)
  To: Linus Walleij, Mark Brown
  Cc: Bartosz Golaszewski, linux-kernel, linux-gpio, Andy Shevchenko

[-- Attachment #1: Type: text/plain, Size: 1270 bytes --]

On Tue, Apr 11, 2023 at 10:15:54PM +0100, Mark Brown wrote:
> On Tue, Apr 11, 2023 at 02:36:23PM -0400, William Breathitt Gray wrote:
> > On Tue, Apr 11, 2023 at 09:23:55PM +0100, Mark Brown wrote:
> > > On Mon, Mar 20, 2023 at 10:50:15AM -0400, William Breathitt Gray wrote:
> > > > A private data structure struct dio48e_gpio is introduced to facilitate
> > > > passage of the regmap and IRQ mask state for the device to the callback
> > > > dio48e_handle_mask_sync(). This is in preparation for the removal of the
> > > > handle_mask_sync() map parameter in a subsequent patch.
> 
> > > What's the story with this patch?
> 
> > Currently dio48e_handle_mask_sync() uses the map argument in its
> > implementation. Once the map parameter is removed, the current
> > implementation of dio48e_handle_mask_sync() will no longer build, so we
> > must adjust the implementation to no longer depend on map.
> 
> I mean what's the story with getting this patch applied?  It doesn't
> seem to have been reviewed...

I'm sorry, I forgot to add Linus' tag from v2 [0]. Linus, would you
confirm you're still okay with this patch?

William Breathitt Gray

[0] https://lore.kernel.org/all/CACRpkdYFSu3DAY4+EeoRk4cTkypgWg1C=UgforDO7mT96f0GDQ@mail.gmail.com/

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v3 1/2] gpio: 104-dio-48e: Implement struct dio48e_gpio
  2023-04-11 21:35         ` William Breathitt Gray
@ 2023-04-21  8:20           ` Linus Walleij
  0 siblings, 0 replies; 13+ messages in thread
From: Linus Walleij @ 2023-04-21  8:20 UTC (permalink / raw)
  To: William Breathitt Gray
  Cc: Mark Brown, Bartosz Golaszewski, linux-kernel, linux-gpio,
	Andy Shevchenko

On Tue, Apr 11, 2023 at 11:35 PM William Breathitt Gray
<william.gray@linaro.org> wrote:
> On Tue, Apr 11, 2023 at 10:15:54PM +0100, Mark Brown wrote:
> > On Tue, Apr 11, 2023 at 02:36:23PM -0400, William Breathitt Gray wrote:
> > > On Tue, Apr 11, 2023 at 09:23:55PM +0100, Mark Brown wrote:
> > > > On Mon, Mar 20, 2023 at 10:50:15AM -0400, William Breathitt Gray wrote:
> > > > > A private data structure struct dio48e_gpio is introduced to facilitate
> > > > > passage of the regmap and IRQ mask state for the device to the callback
> > > > > dio48e_handle_mask_sync(). This is in preparation for the removal of the
> > > > > handle_mask_sync() map parameter in a subsequent patch.
> >
> > > > What's the story with this patch?
> >
> > > Currently dio48e_handle_mask_sync() uses the map argument in its
> > > implementation. Once the map parameter is removed, the current
> > > implementation of dio48e_handle_mask_sync() will no longer build, so we
> > > must adjust the implementation to no longer depend on map.
> >
> > I mean what's the story with getting this patch applied?  It doesn't
> > seem to have been reviewed...
>
> I'm sorry, I forgot to add Linus' tag from v2 [0]. Linus, would you
> confirm you're still okay with this patch?

Oh of course.
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2023-04-21  8:21 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-20 14:50 [PATCH v3 0/2] Drop map from handle_mask_sync() parameters William Breathitt Gray
2023-03-20 14:50 ` [PATCH v3 1/2] gpio: 104-dio-48e: Implement struct dio48e_gpio William Breathitt Gray
2023-04-07 11:47   ` [RESEND PATCH " William Breathitt Gray
2023-04-11 20:23   ` [PATCH " Mark Brown
2023-04-11 18:36     ` William Breathitt Gray
2023-04-11 21:15       ` Mark Brown
2023-04-11 21:35         ` William Breathitt Gray
2023-04-21  8:20           ` Linus Walleij
2023-03-20 14:50 ` [PATCH v3 2/2] regmap-irq: Drop map from handle_mask_sync() parameters William Breathitt Gray
2023-04-07 11:47   ` [RESEND PATCH " William Breathitt Gray
2023-03-20 15:32 ` [PATCH v3 0/2] " Andy Shevchenko
2023-03-22 16:55   ` Bartosz Golaszewski
2023-04-07 11:47 ` [RESEND PATCH " William Breathitt Gray

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).