diff mbox series

[v5,1/3] regmap: Pass irq_drv_data as a parameter for set_type_config()

Message ID 5ba9d4c58a4cef138201334ea48e8bc8297a9a1c.1679845842.git.william.gray@linaro.org
State New
Headers show
Series Migrate the PCIe-IDIO-24 and WS16C48 GPIO drivers to the regmap API | expand

Commit Message

William Breathitt Gray March 26, 2023, 4:25 p.m. UTC
Allow the struct regmap_irq_chip set_type_config() callback to access
irq_drv_data by passing it as a parameter.

Signed-off-by: William Breathitt Gray <william.gray@linaro.org>
---
Changes in v5:
 - Wrap lines to 100 characters rather than 80
Changes in v4: none
Changes in v3:
 - Drop map from set_type_config() parameter list; regmap can be passed
   by irq_drv_data instead
Changes in v2: none

 drivers/base/regmap/regmap-irq.c | 6 ++++--
 include/linux/regmap.h           | 5 +++--
 2 files changed, 7 insertions(+), 4 deletions(-)

Comments

Mark Brown April 3, 2023, 9:07 p.m. UTC | #1
On Sun, Mar 26, 2023 at 12:25:57PM -0400, William Breathitt Gray wrote:

> Changes in v5:
>  - Wrap lines to 100 characters rather than 80

It's good to keep things under 80 where we can.

>  	int (*set_type_config)(unsigned int **buf, unsigned int type,
> -			       const struct regmap_irq *irq_data, int idx);
> +			       const struct regmap_irq *irq_data, int idx, void *irq_drv_data);
>  	unsigned int (*get_irq_reg)(struct regmap_irq_chip_data *data,
>  				    unsigned int base, int index);
>  	void *irq_drv_data;

There's no benefit from overflowing here and...

> @@ -1660,7 +1660,8 @@ struct regmap_irq_chip {
>  unsigned int regmap_irq_get_irq_reg_linear(struct regmap_irq_chip_data *data,
>  					   unsigned int base, int index);
>  int regmap_irq_set_type_config_simple(unsigned int **buf, unsigned int type,
> -				      const struct regmap_irq *irq_data, int idx);
> +				      const struct regmap_irq *irq_data, int idx,
> +				      void *irq_drv_data);

...it's not even consistent.
diff mbox series

Patch

diff --git a/drivers/base/regmap/regmap-irq.c b/drivers/base/regmap/regmap-irq.c
index ff6b585b9049..6994e59c3e30 100644
--- a/drivers/base/regmap/regmap-irq.c
+++ b/drivers/base/regmap/regmap-irq.c
@@ -329,7 +329,7 @@  static int regmap_irq_set_type(struct irq_data *data, unsigned int type)
 
 	if (d->chip->set_type_config) {
 		ret = d->chip->set_type_config(d->config_buf, type,
-					       irq_data, reg);
+					       irq_data, reg, d->chip->irq_drv_data);
 		if (ret)
 			return ret;
 	}
@@ -653,13 +653,15 @@  EXPORT_SYMBOL_GPL(regmap_irq_get_irq_reg_linear);
  * @type: The requested IRQ type.
  * @irq_data: The IRQ being configured.
  * @idx: Index of the irq's config registers within each array `buf[i]`
+ * @irq_drv_data: Driver specific IRQ data
  *
  * This is a &struct regmap_irq_chip->set_type_config callback suitable for
  * chips with one config register. Register values are updated according to
  * the &struct regmap_irq_type data associated with an IRQ.
  */
 int regmap_irq_set_type_config_simple(unsigned int **buf, unsigned int type,
-				      const struct regmap_irq *irq_data, int idx)
+				      const struct regmap_irq *irq_data, int idx,
+				      void *irq_drv_data)
 {
 	const struct regmap_irq_type *t = &irq_data->type;
 
diff --git a/include/linux/regmap.h b/include/linux/regmap.h
index 8d9d601da782..9b456e841bec 100644
--- a/include/linux/regmap.h
+++ b/include/linux/regmap.h
@@ -1651,7 +1651,7 @@  struct regmap_irq_chip {
 	int (*set_type_virt)(unsigned int **buf, unsigned int type,
 			     unsigned long hwirq, int reg);
 	int (*set_type_config)(unsigned int **buf, unsigned int type,
-			       const struct regmap_irq *irq_data, int idx);
+			       const struct regmap_irq *irq_data, int idx, void *irq_drv_data);
 	unsigned int (*get_irq_reg)(struct regmap_irq_chip_data *data,
 				    unsigned int base, int index);
 	void *irq_drv_data;
@@ -1660,7 +1660,8 @@  struct regmap_irq_chip {
 unsigned int regmap_irq_get_irq_reg_linear(struct regmap_irq_chip_data *data,
 					   unsigned int base, int index);
 int regmap_irq_set_type_config_simple(unsigned int **buf, unsigned int type,
-				      const struct regmap_irq *irq_data, int idx);
+				      const struct regmap_irq *irq_data, int idx,
+				      void *irq_drv_data);
 
 int regmap_add_irq_chip(struct regmap *map, int irq, int irq_flags,
 			int irq_base, const struct regmap_irq_chip *chip,