[18/18] mfd: wcd934x: Convert irq chip to config regs

Message ID 20221112151835.39059-19-aidanmacdonald.0x0@gmail.com
State New
Headers
Series mfd: Clean up deprecated regmap-irq functionality |

Commit Message

Aidan MacDonald Nov. 12, 2022, 3:18 p.m. UTC
  Type registers are deprecated and will eventually be removed from
regmap-irq. The same functionality can be replicated with config
registers.

Signed-off-by: Aidan MacDonald <aidanmacdonald.0x0@gmail.com>
---
 drivers/mfd/wcd934x.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)
  

Comments

Aidan MacDonald Nov. 12, 2022, 3:31 p.m. UTC | #1
> Type registers are deprecated and will eventually be removed from
> regmap-irq. The same functionality can be replicated with config
> registers.
>
> Signed-off-by: Aidan MacDonald <aidanmacdonald.0x0@gmail.com>
> ---
>  drivers/mfd/wcd934x.c | 11 ++++++++---
>  1 file changed, 8 insertions(+), 3 deletions(-)

Forgot to include this here:--

One issue with WCD934x - after applying the patch, a bug in regmap-irq
will cause a null pointer deref when setting the IRQ type, but a fix is
already in the regmap tree.

Link: https://git.kernel.org/pub/scm/linux/kernel/git/broonie/regmap.git/commit/?id=84498d1fb35de6ab71bdfdb6270a464fb4a0951b

> diff --git a/drivers/mfd/wcd934x.c b/drivers/mfd/wcd934x.c
> index 68e2fa2fda99..07e884087f2c 100644
> --- a/drivers/mfd/wcd934x.c
> +++ b/drivers/mfd/wcd934x.c
> @@ -55,17 +55,22 @@ static const struct regmap_irq wcd934x_irqs[] = {
>  	WCD934X_REGMAP_IRQ_REG(WCD934X_IRQ_SOUNDWIRE, 2, BIT(4)),
>  };
>
> +static const unsigned int wcd934x_config_regs[] = {
> +	WCD934X_INTR_LEVEL0,
> +};
> +
>  static const struct regmap_irq_chip wcd934x_regmap_irq_chip = {
>  	.name = "wcd934x_irq",
>  	.status_base = WCD934X_INTR_PIN1_STATUS0,
>  	.mask_base = WCD934X_INTR_PIN1_MASK0,
>  	.ack_base = WCD934X_INTR_PIN1_CLEAR0,
> -	.type_base = WCD934X_INTR_LEVEL0,
> -	.num_type_reg = 4,
> -	.type_in_mask = false,
>  	.num_regs = 4,
>  	.irqs = wcd934x_irqs,
>  	.num_irqs = ARRAY_SIZE(wcd934x_irqs),
> +	.config_base = wcd934x_config_regs,
> +	.num_config_bases = ARRAY_SIZE(wcd934x_config_regs),
> +	.num_config_regs = 4,
> +	.set_type_config = regmap_irq_set_type_config_simple,
>  };
>
>  static bool wcd934x_is_volatile_register(struct device *dev, unsigned int reg)
  
Lee Jones Nov. 16, 2022, 6 p.m. UTC | #2
On Sat, 12 Nov 2022, Aidan MacDonald wrote:

> Type registers are deprecated and will eventually be removed from
> regmap-irq. The same functionality can be replicated with config
> registers.
> 
> Signed-off-by: Aidan MacDonald <aidanmacdonald.0x0@gmail.com>
> ---
>  drivers/mfd/wcd934x.c | 11 ++++++++---
>  1 file changed, 8 insertions(+), 3 deletions(-)

Applied, thanks.
  

Patch

diff --git a/drivers/mfd/wcd934x.c b/drivers/mfd/wcd934x.c
index 68e2fa2fda99..07e884087f2c 100644
--- a/drivers/mfd/wcd934x.c
+++ b/drivers/mfd/wcd934x.c
@@ -55,17 +55,22 @@  static const struct regmap_irq wcd934x_irqs[] = {
 	WCD934X_REGMAP_IRQ_REG(WCD934X_IRQ_SOUNDWIRE, 2, BIT(4)),
 };
 
+static const unsigned int wcd934x_config_regs[] = {
+	WCD934X_INTR_LEVEL0,
+};
+
 static const struct regmap_irq_chip wcd934x_regmap_irq_chip = {
 	.name = "wcd934x_irq",
 	.status_base = WCD934X_INTR_PIN1_STATUS0,
 	.mask_base = WCD934X_INTR_PIN1_MASK0,
 	.ack_base = WCD934X_INTR_PIN1_CLEAR0,
-	.type_base = WCD934X_INTR_LEVEL0,
-	.num_type_reg = 4,
-	.type_in_mask = false,
 	.num_regs = 4,
 	.irqs = wcd934x_irqs,
 	.num_irqs = ARRAY_SIZE(wcd934x_irqs),
+	.config_base = wcd934x_config_regs,
+	.num_config_bases = ARRAY_SIZE(wcd934x_config_regs),
+	.num_config_regs = 4,
+	.set_type_config = regmap_irq_set_type_config_simple,
 };
 
 static bool wcd934x_is_volatile_register(struct device *dev, unsigned int reg)