diff mbox

[2/7] mfd: lp8788: Use devm_mfd_add_devices and devm_regmap_add_irq_chip

Message ID 1461241558-26983-3-git-send-email-ldewangan@nvidia.com (mailing list archive)
State Not Applicable, archived
Headers show

Commit Message

Laxman Dewangan April 21, 2016, 12:25 p.m. UTC
Use devm_mfd_add_devices() for adding MFD child devices and
devm_regmap_add_irq_chip() for IRQ chip registration.

This reduces the error code path and .remove callback for removing
MFD child devices and deleting IRQ chip data.

Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
CC: Milo Kim <milo.kim@ti.com>
---
 drivers/mfd/lp8788-irq.c | 12 +++---------
 drivers/mfd/lp8788.c     | 10 ----------
 2 files changed, 3 insertions(+), 19 deletions(-)

Comments

Kim, Milo April 21, 2016, 11:15 p.m. UTC | #1
Hi Laxman,

On 4/21/2016 9:25 PM, Laxman Dewangan wrote:
> Use devm_mfd_add_devices() for adding MFD child devices and
> devm_regmap_add_irq_chip() for IRQ chip registration.

This patch doesn't include the code regarding devm_mfd_add_devices(). 
Could you check it again? Or am I missing any previous patches?

>
> This reduces the error code path and .remove callback for removing
> MFD child devices and deleting IRQ chip data.
>
> Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
> CC: Milo Kim <milo.kim@ti.com>
> ---
>   drivers/mfd/lp8788-irq.c | 12 +++---------
>   drivers/mfd/lp8788.c     | 10 ----------
>   2 files changed, 3 insertions(+), 19 deletions(-)
>
> diff --git a/drivers/mfd/lp8788-irq.c b/drivers/mfd/lp8788-irq.c
> index 792d51b..aacd39f 100644
> --- a/drivers/mfd/lp8788-irq.c
> +++ b/drivers/mfd/lp8788-irq.c
> @@ -175,9 +175,9 @@ int lp8788_irq_init(struct lp8788 *lp, int irq)
>   	lp->irqdm = irqd->domain;
>   	mutex_init(&irqd->irq_lock);
>
> -	ret = request_threaded_irq(irq, NULL, lp8788_irq_handler,
> -				IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
> -				"lp8788-irq", irqd);
> +	ret = devm_request_threaded_irq(lp->dev, irq, NULL, lp8788_irq_handler,
> +					IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
> +					"lp8788-irq", irqd);
>   	if (ret) {
>   		dev_err(lp->dev, "failed to create a thread for IRQ_N\n");
>   		return ret;
> @@ -187,9 +187,3 @@ int lp8788_irq_init(struct lp8788 *lp, int irq)
>
>   	return 0;
>   }
> -
> -void lp8788_irq_exit(struct lp8788 *lp)
> -{
> -	if (lp->irq)
> -		free_irq(lp->irq, lp->irqdm);
> -}
> diff --git a/drivers/mfd/lp8788.c b/drivers/mfd/lp8788.c
> index acf6165..37fea46 100644
> --- a/drivers/mfd/lp8788.c
> +++ b/drivers/mfd/lp8788.c
> @@ -203,15 +203,6 @@ static int lp8788_probe(struct i2c_client *cl, const struct i2c_device_id *id)
>   			       ARRAY_SIZE(lp8788_devs), NULL, 0, NULL);
>   }
>
> -static int lp8788_remove(struct i2c_client *cl)
> -{
> -	struct lp8788 *lp = i2c_get_clientdata(cl);
> -
> -	mfd_remove_devices(lp->dev);
> -	lp8788_irq_exit(lp);
> -	return 0;
> -}
> -
>   static const struct i2c_device_id lp8788_ids[] = {
>   	{"lp8788", 0},
>   	{ }
> @@ -223,7 +214,6 @@ static struct i2c_driver lp8788_driver = {
>   		.name = "lp8788",
>   	},
>   	.probe = lp8788_probe,
> -	.remove = lp8788_remove,
>   	.id_table = lp8788_ids,
>   };
>
>

Best regards,
Milo
--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Laxman Dewangan April 22, 2016, 8:50 a.m. UTC | #2
On Friday 22 April 2016 04:45 AM, Kim, Milo wrote:
> Hi Laxman,
>
> On 4/21/2016 9:25 PM, Laxman Dewangan wrote:
>> Use devm_mfd_add_devices() for adding MFD child devices and
>> devm_regmap_add_irq_chip() for IRQ chip registration.
>
> This patch doesn't include the code regarding devm_mfd_add_devices(). 
> Could you check it again? Or am I missing any previous patches?


Sigh.. yaah, it is missed. Dont know how I missed it in my grep result.
I will recycle the patch. But I like to get review other patches also 
for V2. External code review is more stronger then self code review.


--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/mfd/lp8788-irq.c b/drivers/mfd/lp8788-irq.c
index 792d51b..aacd39f 100644
--- a/drivers/mfd/lp8788-irq.c
+++ b/drivers/mfd/lp8788-irq.c
@@ -175,9 +175,9 @@  int lp8788_irq_init(struct lp8788 *lp, int irq)
 	lp->irqdm = irqd->domain;
 	mutex_init(&irqd->irq_lock);
 
-	ret = request_threaded_irq(irq, NULL, lp8788_irq_handler,
-				IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
-				"lp8788-irq", irqd);
+	ret = devm_request_threaded_irq(lp->dev, irq, NULL, lp8788_irq_handler,
+					IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
+					"lp8788-irq", irqd);
 	if (ret) {
 		dev_err(lp->dev, "failed to create a thread for IRQ_N\n");
 		return ret;
@@ -187,9 +187,3 @@  int lp8788_irq_init(struct lp8788 *lp, int irq)
 
 	return 0;
 }
-
-void lp8788_irq_exit(struct lp8788 *lp)
-{
-	if (lp->irq)
-		free_irq(lp->irq, lp->irqdm);
-}
diff --git a/drivers/mfd/lp8788.c b/drivers/mfd/lp8788.c
index acf6165..37fea46 100644
--- a/drivers/mfd/lp8788.c
+++ b/drivers/mfd/lp8788.c
@@ -203,15 +203,6 @@  static int lp8788_probe(struct i2c_client *cl, const struct i2c_device_id *id)
 			       ARRAY_SIZE(lp8788_devs), NULL, 0, NULL);
 }
 
-static int lp8788_remove(struct i2c_client *cl)
-{
-	struct lp8788 *lp = i2c_get_clientdata(cl);
-
-	mfd_remove_devices(lp->dev);
-	lp8788_irq_exit(lp);
-	return 0;
-}
-
 static const struct i2c_device_id lp8788_ids[] = {
 	{"lp8788", 0},
 	{ }
@@ -223,7 +214,6 @@  static struct i2c_driver lp8788_driver = {
 		.name = "lp8788",
 	},
 	.probe = lp8788_probe,
-	.remove = lp8788_remove,
 	.id_table = lp8788_ids,
 };