diff mbox series

[v7,10/12] mfd: bd9571mwv: Use devm_regmap_add_irq_chip()

Message ID 1608793457-11997-11-git-send-email-yoshihiro.shimoda.uh@renesas.com
State Superseded
Headers show
Series treewide: bd9571mwv: Add support for BD9574MWF | expand

Commit Message

Yoshihiro Shimoda Dec. 24, 2020, 7:04 a.m. UTC
Use dev_regmap_add_irq_chip() to simplify the code.

Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Acked-for-MFD-by: Lee Jones <lee.jones@linaro.org>
Reviewed-by: Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
 drivers/mfd/bd9571mwv.c | 27 ++++++---------------------
 1 file changed, 6 insertions(+), 21 deletions(-)

Comments

Sergei Shtylyov Dec. 24, 2020, 8:50 a.m. UTC | #1
Hello!

On 24.12.2020 10:04, Yoshihiro Shimoda wrote:

> Use dev_regmap_add_irq_chip() to simplify the code.

    devm_?

> Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
> Acked-for-MFD-by: Lee Jones <lee.jones@linaro.org>
> Reviewed-by: Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>
> Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
> ---
>   drivers/mfd/bd9571mwv.c | 27 ++++++---------------------
>   1 file changed, 6 insertions(+), 21 deletions(-)
> 
> diff --git a/drivers/mfd/bd9571mwv.c b/drivers/mfd/bd9571mwv.c
> index e68c3fa..49e968e 100644
> --- a/drivers/mfd/bd9571mwv.c
> +++ b/drivers/mfd/bd9571mwv.c
> @@ -170,31 +170,17 @@ static int bd9571mwv_probe(struct i2c_client *client,
>   	if (ret)
>   		return ret;
>   
> -	ret = regmap_add_irq_chip(bd->regmap, bd->irq, IRQF_ONESHOT, 0,
> -				  &bd9571mwv_irq_chip, &bd->irq_data);
> +	ret = devm_regmap_add_irq_chip(bd->dev, bd->regmap, bd->irq,
> +				       IRQF_ONESHOT, 0, &bd9571mwv_irq_chip,
> +				       &bd->irq_data);
>   	if (ret) {
>   		dev_err(bd->dev, "Failed to register IRQ chip\n");
>   		return ret;
>   	}
>   
[...]

MBR, Sergei
Yoshihiro Shimoda Dec. 25, 2020, 9:22 a.m. UTC | #2
Hello Sergei,

> From: Sergei Shtylyov, Sent: Thursday, December 24, 2020 5:50 PM

> On 24.12.2020 10:04, Yoshihiro Shimoda wrote:

> 

> > Use dev_regmap_add_irq_chip() to simplify the code.

> 

>     devm_?


Thank you for the pointed it out.
I'll fix it.

Best regards,
Yoshihiro Shimoda
diff mbox series

Patch

diff --git a/drivers/mfd/bd9571mwv.c b/drivers/mfd/bd9571mwv.c
index e68c3fa..49e968e 100644
--- a/drivers/mfd/bd9571mwv.c
+++ b/drivers/mfd/bd9571mwv.c
@@ -170,31 +170,17 @@  static int bd9571mwv_probe(struct i2c_client *client,
 	if (ret)
 		return ret;
 
-	ret = regmap_add_irq_chip(bd->regmap, bd->irq, IRQF_ONESHOT, 0,
-				  &bd9571mwv_irq_chip, &bd->irq_data);
+	ret = devm_regmap_add_irq_chip(bd->dev, bd->regmap, bd->irq,
+				       IRQF_ONESHOT, 0, &bd9571mwv_irq_chip,
+				       &bd->irq_data);
 	if (ret) {
 		dev_err(bd->dev, "Failed to register IRQ chip\n");
 		return ret;
 	}
 
-	ret = devm_mfd_add_devices(bd->dev, PLATFORM_DEVID_AUTO,
-				   bd9571mwv_cells, ARRAY_SIZE(bd9571mwv_cells),
-				   NULL, 0, regmap_irq_get_domain(bd->irq_data));
-	if (ret) {
-		regmap_del_irq_chip(bd->irq, bd->irq_data);
-		return ret;
-	}
-
-	return 0;
-}
-
-static int bd9571mwv_remove(struct i2c_client *client)
-{
-	struct bd9571mwv *bd = i2c_get_clientdata(client);
-
-	regmap_del_irq_chip(bd->irq, bd->irq_data);
-
-	return 0;
+	return devm_mfd_add_devices(bd->dev, PLATFORM_DEVID_AUTO,
+				    bd9571mwv_cells, ARRAY_SIZE(bd9571mwv_cells),
+				    NULL, 0, regmap_irq_get_domain(bd->irq_data));
 }
 
 static const struct of_device_id bd9571mwv_of_match_table[] = {
@@ -215,7 +201,6 @@  static struct i2c_driver bd9571mwv_driver = {
 		.of_match_table = bd9571mwv_of_match_table,
 	},
 	.probe		= bd9571mwv_probe,
-	.remove		= bd9571mwv_remove,
 	.id_table       = bd9571mwv_id_table,
 };
 module_i2c_driver(bd9571mwv_driver);