Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1384158 > unrolled thread
| Started by | Laxman Dewangan <ldewangan@nvidia.com> |
|---|---|
| First post | 2016-04-21 14:40 +0200 |
| Last post | 2016-04-25 15:10 +0200 |
| Articles | 13 — 3 participants |
Back to article view | Back to linux.kernel
[PATCH 0/7] mfd: Use devm_mfd_add_devices and devm_regmap_add_irq_chip Laxman Dewangan <ldewangan@nvidia.com> - 2016-04-21 14:40 +0200
[PATCH 1/7] mfd: as3722: Use devm_mfd_add_devices and devm_regmap_add_irq_chip Laxman Dewangan <ldewangan@nvidia.com> - 2016-04-21 14:40 +0200
Re: [PATCH 1/7] mfd: as3722: Use devm_mfd_add_devices and devm_regmap_add_irq_chip Lee Jones <lee.jones@linaro.org> - 2016-04-28 11:10 +0200
[PATCH 4/7] mfd: rc5t583: Use devm_mfd_add_devices and devm_request_threaded_irq Laxman Dewangan <ldewangan@nvidia.com> - 2016-04-21 14:40 +0200
Re: [PATCH 4/7] mfd: rc5t583: Use devm_mfd_add_devices and devm_request_threaded_irq Lee Jones <lee.jones@linaro.org> - 2016-04-28 11:10 +0200
[PATCH 3/7] mfd: max77686: Use devm_mfd_add_devices and devm_regmap_add_irq_chip Laxman Dewangan <ldewangan@nvidia.com> - 2016-04-21 14:40 +0200
Re: [PATCH 3/7] mfd: max77686: Use devm_mfd_add_devices and devm_regmap_add_irq_chip Krzysztof Kozlowski <k.kozlowski@samsung.com> - 2016-04-25 13:00 +0200
Re: [PATCH 3/7] mfd: max77686: Use devm_mfd_add_devices and devm_regmap_add_irq_chip Lee Jones <lee.jones@linaro.org> - 2016-04-28 11:10 +0200
Re: [PATCH 3/7] mfd: max77686: Use devm_mfd_add_devices and devm_regmap_add_irq_chip Laxman Dewangan <ldewangan@nvidia.com> - 2016-04-28 12:20 +0200
[PATCH 5/7] mfd: sec: Use devm_mfd_add_devices and devm_regmap_add_irq_chip Laxman Dewangan <ldewangan@nvidia.com> - 2016-04-21 14:40 +0200
Re: [PATCH 5/7] mfd: sec: Use devm_mfd_add_devices and devm_regmap_add_irq_chip Krzysztof Kozlowski <k.kozlowski@samsung.com> - 2016-04-25 14:50 +0200
Re: [PATCH 0/7] mfd: Use devm_mfd_add_devices and devm_regmap_add_irq_chip Krzysztof Kozlowski <k.kozlowski@samsung.com> - 2016-04-25 13:00 +0200
Re: [PATCH 0/7] mfd: Use devm_mfd_add_devices and devm_regmap_add_irq_chip Laxman Dewangan <ldewangan@nvidia.com> - 2016-04-25 15:10 +0200
| From | Laxman Dewangan <ldewangan@nvidia.com> |
|---|---|
| Date | 2016-04-21 14:40 +0200 |
| Subject | [PATCH 0/7] mfd: Use devm_mfd_add_devices and devm_regmap_add_irq_chip |
| Message-ID | <rqm3L-Ju-7@gated-at.bofh.it> |
This series is an effort to reduce the code in error path and need of
remove callback by using the devm_mfd_add_devices() and
devm_regmap_add_irq_chip() or devm_request_threaded_irq APIs for interrupt
support.
This is tested with build and comiplation only with arm64 defconfig and enabling
the required MFD CONFIGs.
Laxman Dewangan (7):
mfd: as3722: Use devm_mfd_add_devices and devm_regmap_add_irq_chip
mfd: lp8788: Use devm_mfd_add_devices and devm_regmap_add_irq_chip
mfd: max77686: Use devm_mfd_add_devices and devm_regmap_add_irq_chip
mfd: rc5t583: Use devm_mfd_add_devices and devm_request_threaded_irq
mfd: sec: Use devm_mfd_add_devices and devm_regmap_add_irq_chip
mfd: tps65910: Use devm_mfd_add_devices and devm_regmap_add_irq_chip
mfd: wl1273-core: Use devm_mfd_add_devices() for mfd_device
registration
drivers/mfd/as3722.c | 31 +++++++++----------------------
drivers/mfd/lp8788-irq.c | 12 +++---------
drivers/mfd/lp8788.c | 10 ----------
drivers/mfd/max77686.c | 31 ++++++++-----------------------
drivers/mfd/rc5t583-irq.c | 11 ++---------
drivers/mfd/rc5t583.c | 24 +++---------------------
drivers/mfd/sec-core.c | 20 +++-----------------
drivers/mfd/sec-irq.c | 14 +++++---------
drivers/mfd/tps65910.c | 25 ++++---------------------
drivers/mfd/wl1273-core.c | 14 ++------------
10 files changed, 39 insertions(+), 153 deletions(-)
--
2.1.4
[toc] | [next] | [standalone]
| From | Laxman Dewangan <ldewangan@nvidia.com> |
|---|---|
| Date | 2016-04-21 14:40 +0200 |
| Subject | [PATCH 1/7] mfd: as3722: Use devm_mfd_add_devices and devm_regmap_add_irq_chip |
| Message-ID | <rqm3N-Ju-27@gated-at.bofh.it> |
| In reply to | #1384158 |
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>
---
drivers/mfd/as3722.c | 31 +++++++++----------------------
1 file changed, 9 insertions(+), 22 deletions(-)
diff --git a/drivers/mfd/as3722.c b/drivers/mfd/as3722.c
index e1f597f..f87342c 100644
--- a/drivers/mfd/as3722.c
+++ b/drivers/mfd/as3722.c
@@ -385,9 +385,10 @@ static int as3722_i2c_probe(struct i2c_client *i2c,
return ret;
irq_flags = as3722->irq_flags | IRQF_ONESHOT;
- ret = regmap_add_irq_chip(as3722->regmap, as3722->chip_irq,
- irq_flags, -1, &as3722_irq_chip,
- &as3722->irq_data);
+ ret = devm_regmap_add_irq_chip(as3722->dev, as3722->regmap,
+ as3722->chip_irq,
+ irq_flags, -1, &as3722_irq_chip,
+ &as3722->irq_data);
if (ret < 0) {
dev_err(as3722->dev, "Failed to add regmap irq: %d\n", ret);
return ret;
@@ -395,33 +396,20 @@ static int as3722_i2c_probe(struct i2c_client *i2c,
ret = as3722_configure_pullups(as3722);
if (ret < 0)
- goto scrub;
+ return ret;
- ret = mfd_add_devices(&i2c->dev, -1, as3722_devs,
- ARRAY_SIZE(as3722_devs), NULL, 0,
- regmap_irq_get_domain(as3722->irq_data));
+ ret = devm_mfd_add_devices(&i2c->dev, -1, as3722_devs,
+ ARRAY_SIZE(as3722_devs), NULL, 0,
+ regmap_irq_get_domain(as3722->irq_data));
if (ret) {
dev_err(as3722->dev, "Failed to add MFD devices: %d\n", ret);
- goto scrub;
+ return ret;
}
device_init_wakeup(as3722->dev, true);
dev_dbg(as3722->dev, "AS3722 core driver initialized successfully\n");
return 0;
-
-scrub:
- regmap_del_irq_chip(as3722->chip_irq, as3722->irq_data);
- return ret;
-}
-
-static int as3722_i2c_remove(struct i2c_client *i2c)
-{
- struct as3722 *as3722 = i2c_get_clientdata(i2c);
-
- mfd_remove_devices(as3722->dev);
- regmap_del_irq_chip(as3722->chip_irq, as3722->irq_data);
- return 0;
}
static int __maybe_unused as3722_i2c_suspend(struct device *dev)
@@ -470,7 +458,6 @@ static struct i2c_driver as3722_i2c_driver = {
.pm = &as3722_pm_ops,
},
.probe = as3722_i2c_probe,
- .remove = as3722_i2c_remove,
.id_table = as3722_i2c_id,
};
--
2.1.4
[toc] | [prev] | [next] | [standalone]
| From | Lee Jones <lee.jones@linaro.org> |
|---|---|
| Date | 2016-04-28 11:10 +0200 |
| Subject | Re: [PATCH 1/7] mfd: as3722: Use devm_mfd_add_devices and devm_regmap_add_irq_chip |
| Message-ID | <rsQ7n-Ft-7@gated-at.bofh.it> |
| In reply to | #1384159 |
On Thu, 21 Apr 2016, Laxman Dewangan wrote:
> 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>
> ---
> drivers/mfd/as3722.c | 31 +++++++++----------------------
> 1 file changed, 9 insertions(+), 22 deletions(-)
Applied, thanks.
> diff --git a/drivers/mfd/as3722.c b/drivers/mfd/as3722.c
> index e1f597f..f87342c 100644
> --- a/drivers/mfd/as3722.c
> +++ b/drivers/mfd/as3722.c
> @@ -385,9 +385,10 @@ static int as3722_i2c_probe(struct i2c_client *i2c,
> return ret;
>
> irq_flags = as3722->irq_flags | IRQF_ONESHOT;
> - ret = regmap_add_irq_chip(as3722->regmap, as3722->chip_irq,
> - irq_flags, -1, &as3722_irq_chip,
> - &as3722->irq_data);
> + ret = devm_regmap_add_irq_chip(as3722->dev, as3722->regmap,
> + as3722->chip_irq,
> + irq_flags, -1, &as3722_irq_chip,
> + &as3722->irq_data);
> if (ret < 0) {
> dev_err(as3722->dev, "Failed to add regmap irq: %d\n", ret);
> return ret;
> @@ -395,33 +396,20 @@ static int as3722_i2c_probe(struct i2c_client *i2c,
>
> ret = as3722_configure_pullups(as3722);
> if (ret < 0)
> - goto scrub;
> + return ret;
>
> - ret = mfd_add_devices(&i2c->dev, -1, as3722_devs,
> - ARRAY_SIZE(as3722_devs), NULL, 0,
> - regmap_irq_get_domain(as3722->irq_data));
> + ret = devm_mfd_add_devices(&i2c->dev, -1, as3722_devs,
> + ARRAY_SIZE(as3722_devs), NULL, 0,
> + regmap_irq_get_domain(as3722->irq_data));
> if (ret) {
> dev_err(as3722->dev, "Failed to add MFD devices: %d\n", ret);
> - goto scrub;
> + return ret;
> }
>
> device_init_wakeup(as3722->dev, true);
>
> dev_dbg(as3722->dev, "AS3722 core driver initialized successfully\n");
> return 0;
> -
> -scrub:
> - regmap_del_irq_chip(as3722->chip_irq, as3722->irq_data);
> - return ret;
> -}
> -
> -static int as3722_i2c_remove(struct i2c_client *i2c)
> -{
> - struct as3722 *as3722 = i2c_get_clientdata(i2c);
> -
> - mfd_remove_devices(as3722->dev);
> - regmap_del_irq_chip(as3722->chip_irq, as3722->irq_data);
> - return 0;
> }
>
> static int __maybe_unused as3722_i2c_suspend(struct device *dev)
> @@ -470,7 +458,6 @@ static struct i2c_driver as3722_i2c_driver = {
> .pm = &as3722_pm_ops,
> },
> .probe = as3722_i2c_probe,
> - .remove = as3722_i2c_remove,
> .id_table = as3722_i2c_id,
> };
>
--
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
[toc] | [prev] | [next] | [standalone]
| From | Laxman Dewangan <ldewangan@nvidia.com> |
|---|---|
| Date | 2016-04-21 14:40 +0200 |
| Subject | [PATCH 4/7] mfd: rc5t583: Use devm_mfd_add_devices and devm_request_threaded_irq |
| Message-ID | <rqm3N-Ju-33@gated-at.bofh.it> |
| In reply to | #1384158 |
Use devm_mfd_add_devices() for adding MFD child devices and
devm_request_threaded_irq() for IRQ registration.
This reduces the need of remove callback for removing MFD child
devices and unregistering IRQ.
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
---
drivers/mfd/rc5t583-irq.c | 11 ++---------
drivers/mfd/rc5t583.c | 24 +++---------------------
2 files changed, 5 insertions(+), 30 deletions(-)
diff --git a/drivers/mfd/rc5t583-irq.c b/drivers/mfd/rc5t583-irq.c
index 3f8812d..f8dde59 100644
--- a/drivers/mfd/rc5t583-irq.c
+++ b/drivers/mfd/rc5t583-irq.c
@@ -389,17 +389,10 @@ int rc5t583_irq_init(struct rc5t583 *rc5t583, int irq, int irq_base)
irq_clear_status_flags(__irq, IRQ_NOREQUEST);
}
- ret = request_threaded_irq(irq, NULL, rc5t583_irq, IRQF_ONESHOT,
- "rc5t583", rc5t583);
+ ret = devm_request_threaded_irq(rc5t583->dev, irq, NULL, rc5t583_irq,
+ IRQF_ONESHOT, "rc5t583", rc5t583);
if (ret < 0)
dev_err(rc5t583->dev,
"Error in registering interrupt error: %d\n", ret);
return ret;
}
-
-int rc5t583_irq_exit(struct rc5t583 *rc5t583)
-{
- if (rc5t583->chip_irq)
- free_irq(rc5t583->chip_irq, rc5t583);
- return 0;
-}
diff --git a/drivers/mfd/rc5t583.c b/drivers/mfd/rc5t583.c
index fc2b2d9..d12243d 100644
--- a/drivers/mfd/rc5t583.c
+++ b/drivers/mfd/rc5t583.c
@@ -252,7 +252,6 @@ static int rc5t583_i2c_probe(struct i2c_client *i2c,
struct rc5t583 *rc5t583;
struct rc5t583_platform_data *pdata = dev_get_platdata(&i2c->dev);
int ret;
- bool irq_init_success = false;
if (!pdata) {
dev_err(&i2c->dev, "Err: Platform data not found\n");
@@ -284,32 +283,16 @@ static int rc5t583_i2c_probe(struct i2c_client *i2c,
/* Still continue with warning, if irq init fails */
if (ret)
dev_warn(&i2c->dev, "IRQ init failed: %d\n", ret);
- else
- irq_init_success = true;
}
- ret = mfd_add_devices(rc5t583->dev, -1, rc5t583_subdevs,
- ARRAY_SIZE(rc5t583_subdevs), NULL, 0, NULL);
+ ret = devm_mfd_add_devices(rc5t583->dev, -1, rc5t583_subdevs,
+ ARRAY_SIZE(rc5t583_subdevs), NULL, 0, NULL);
if (ret) {
dev_err(&i2c->dev, "add mfd devices failed: %d\n", ret);
- goto err_add_devs;
+ return ret;
}
return 0;
-
-err_add_devs:
- if (irq_init_success)
- rc5t583_irq_exit(rc5t583);
- return ret;
-}
-
-static int rc5t583_i2c_remove(struct i2c_client *i2c)
-{
- struct rc5t583 *rc5t583 = i2c_get_clientdata(i2c);
-
- mfd_remove_devices(rc5t583->dev);
- rc5t583_irq_exit(rc5t583);
- return 0;
}
static const struct i2c_device_id rc5t583_i2c_id[] = {
@@ -324,7 +307,6 @@ static struct i2c_driver rc5t583_i2c_driver = {
.name = "rc5t583",
},
.probe = rc5t583_i2c_probe,
- .remove = rc5t583_i2c_remove,
.id_table = rc5t583_i2c_id,
};
--
2.1.4
[toc] | [prev] | [next] | [standalone]
| From | Lee Jones <lee.jones@linaro.org> |
|---|---|
| Date | 2016-04-28 11:10 +0200 |
| Subject | Re: [PATCH 4/7] mfd: rc5t583: Use devm_mfd_add_devices and devm_request_threaded_irq |
| Message-ID | <rsQ7o-Ft-13@gated-at.bofh.it> |
| In reply to | #1384160 |
On Thu, 21 Apr 2016, Laxman Dewangan wrote:
> Use devm_mfd_add_devices() for adding MFD child devices and
> devm_request_threaded_irq() for IRQ registration.
>
> This reduces the need of remove callback for removing MFD child
> devices and unregistering IRQ.
>
> Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
> ---
> drivers/mfd/rc5t583-irq.c | 11 ++---------
> drivers/mfd/rc5t583.c | 24 +++---------------------
> 2 files changed, 5 insertions(+), 30 deletions(-)
Applied, thanks.
> diff --git a/drivers/mfd/rc5t583-irq.c b/drivers/mfd/rc5t583-irq.c
> index 3f8812d..f8dde59 100644
> --- a/drivers/mfd/rc5t583-irq.c
> +++ b/drivers/mfd/rc5t583-irq.c
> @@ -389,17 +389,10 @@ int rc5t583_irq_init(struct rc5t583 *rc5t583, int irq, int irq_base)
> irq_clear_status_flags(__irq, IRQ_NOREQUEST);
> }
>
> - ret = request_threaded_irq(irq, NULL, rc5t583_irq, IRQF_ONESHOT,
> - "rc5t583", rc5t583);
> + ret = devm_request_threaded_irq(rc5t583->dev, irq, NULL, rc5t583_irq,
> + IRQF_ONESHOT, "rc5t583", rc5t583);
> if (ret < 0)
> dev_err(rc5t583->dev,
> "Error in registering interrupt error: %d\n", ret);
> return ret;
> }
> -
> -int rc5t583_irq_exit(struct rc5t583 *rc5t583)
> -{
> - if (rc5t583->chip_irq)
> - free_irq(rc5t583->chip_irq, rc5t583);
> - return 0;
> -}
> diff --git a/drivers/mfd/rc5t583.c b/drivers/mfd/rc5t583.c
> index fc2b2d9..d12243d 100644
> --- a/drivers/mfd/rc5t583.c
> +++ b/drivers/mfd/rc5t583.c
> @@ -252,7 +252,6 @@ static int rc5t583_i2c_probe(struct i2c_client *i2c,
> struct rc5t583 *rc5t583;
> struct rc5t583_platform_data *pdata = dev_get_platdata(&i2c->dev);
> int ret;
> - bool irq_init_success = false;
>
> if (!pdata) {
> dev_err(&i2c->dev, "Err: Platform data not found\n");
> @@ -284,32 +283,16 @@ static int rc5t583_i2c_probe(struct i2c_client *i2c,
> /* Still continue with warning, if irq init fails */
> if (ret)
> dev_warn(&i2c->dev, "IRQ init failed: %d\n", ret);
> - else
> - irq_init_success = true;
> }
>
> - ret = mfd_add_devices(rc5t583->dev, -1, rc5t583_subdevs,
> - ARRAY_SIZE(rc5t583_subdevs), NULL, 0, NULL);
> + ret = devm_mfd_add_devices(rc5t583->dev, -1, rc5t583_subdevs,
> + ARRAY_SIZE(rc5t583_subdevs), NULL, 0, NULL);
> if (ret) {
> dev_err(&i2c->dev, "add mfd devices failed: %d\n", ret);
> - goto err_add_devs;
> + return ret;
> }
>
> return 0;
> -
> -err_add_devs:
> - if (irq_init_success)
> - rc5t583_irq_exit(rc5t583);
> - return ret;
> -}
> -
> -static int rc5t583_i2c_remove(struct i2c_client *i2c)
> -{
> - struct rc5t583 *rc5t583 = i2c_get_clientdata(i2c);
> -
> - mfd_remove_devices(rc5t583->dev);
> - rc5t583_irq_exit(rc5t583);
> - return 0;
> }
>
> static const struct i2c_device_id rc5t583_i2c_id[] = {
> @@ -324,7 +307,6 @@ static struct i2c_driver rc5t583_i2c_driver = {
> .name = "rc5t583",
> },
> .probe = rc5t583_i2c_probe,
> - .remove = rc5t583_i2c_remove,
> .id_table = rc5t583_i2c_id,
> };
>
--
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
[toc] | [prev] | [next] | [standalone]
| From | Laxman Dewangan <ldewangan@nvidia.com> |
|---|---|
| Date | 2016-04-21 14:40 +0200 |
| Subject | [PATCH 3/7] mfd: max77686: Use devm_mfd_add_devices and devm_regmap_add_irq_chip |
| Message-ID | <rqm3O-Ju-43@gated-at.bofh.it> |
| In reply to | #1384158 |
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: Chanwoo Choi <cw00.choi@samsung.com>
CC: Krzysztof Kozlowski <k.kozlowski@samsung.com>
---
drivers/mfd/max77686.c | 31 ++++++++-----------------------
1 file changed, 8 insertions(+), 23 deletions(-)
diff --git a/drivers/mfd/max77686.c b/drivers/mfd/max77686.c
index 7a0457e..7b68ed7 100644
--- a/drivers/mfd/max77686.c
+++ b/drivers/mfd/max77686.c
@@ -230,38 +230,24 @@ static int max77686_i2c_probe(struct i2c_client *i2c,
return -ENODEV;
}
- ret = regmap_add_irq_chip(max77686->regmap, max77686->irq,
- IRQF_TRIGGER_FALLING | IRQF_ONESHOT |
- IRQF_SHARED, 0, irq_chip,
- &max77686->irq_data);
+ ret = devm_regmap_add_irq_chip(&i2c->dev, max77686->regmap,
+ max77686->irq,
+ IRQF_TRIGGER_FALLING | IRQF_ONESHOT |
+ IRQF_SHARED, 0, irq_chip,
+ &max77686->irq_data);
if (ret < 0) {
dev_err(&i2c->dev, "failed to add PMIC irq chip: %d\n", ret);
return ret;
}
- ret = mfd_add_devices(max77686->dev, -1, cells, n_devs, NULL, 0, NULL);
+ ret = devm_mfd_add_devices(max77686->dev, -1, cells, n_devs, NULL,
+ 0, NULL);
if (ret < 0) {
dev_err(&i2c->dev, "failed to add MFD devices: %d\n", ret);
- goto err_del_irqc;
+ return ret;
}
return 0;
-
-err_del_irqc:
- regmap_del_irq_chip(max77686->irq, max77686->irq_data);
-
- return ret;
-}
-
-static int max77686_i2c_remove(struct i2c_client *i2c)
-{
- struct max77686_dev *max77686 = i2c_get_clientdata(i2c);
-
- mfd_remove_devices(max77686->dev);
-
- regmap_del_irq_chip(max77686->irq, max77686->irq_data);
-
- return 0;
}
static const struct i2c_device_id max77686_i2c_id[] = {
@@ -317,7 +303,6 @@ static struct i2c_driver max77686_i2c_driver = {
.of_match_table = of_match_ptr(max77686_pmic_dt_match),
},
.probe = max77686_i2c_probe,
- .remove = max77686_i2c_remove,
.id_table = max77686_i2c_id,
};
--
2.1.4
[toc] | [prev] | [next] | [standalone]
| From | Krzysztof Kozlowski <k.kozlowski@samsung.com> |
|---|---|
| Date | 2016-04-25 13:00 +0200 |
| Subject | Re: [PATCH 3/7] mfd: max77686: Use devm_mfd_add_devices and devm_regmap_add_irq_chip |
| Message-ID | <rrMpe-4ls-47@gated-at.bofh.it> |
| In reply to | #1384163 |
On 04/21/2016 02: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 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: Chanwoo Choi <cw00.choi@samsung.com> > CC: Krzysztof Kozlowski <k.kozlowski@samsung.com> > --- > drivers/mfd/max77686.c | 31 ++++++++----------------------- > 1 file changed, 8 insertions(+), 23 deletions(-) Switching existing code to devm-like interface doesn't bring huge benefits but looks okay and I'm fine with it: Tested-by: Krzysztof Kozlowski <k.kozlowski@samsung.com> Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com> Best regards, Krzysztof
[toc] | [prev] | [next] | [standalone]
| From | Lee Jones <lee.jones@linaro.org> |
|---|---|
| Date | 2016-04-28 11:10 +0200 |
| Subject | Re: [PATCH 3/7] mfd: max77686: Use devm_mfd_add_devices and devm_regmap_add_irq_chip |
| Message-ID | <rsQ7o-Ft-31@gated-at.bofh.it> |
| In reply to | #1386251 |
On Mon, 25 Apr 2016, Krzysztof Kozlowski wrote: > On 04/21/2016 02: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 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: Chanwoo Choi <cw00.choi@samsung.com> > > CC: Krzysztof Kozlowski <k.kozlowski@samsung.com> > > --- > > drivers/mfd/max77686.c | 31 ++++++++----------------------- > > 1 file changed, 8 insertions(+), 23 deletions(-) > > Switching existing code to devm-like interface doesn't bring huge > benefits but looks okay and I'm fine with it: This is pretty much my view, but it get's Laxman's patch count up. ;) -- Lee Jones Linaro STMicroelectronics Landing Team Lead Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog
[toc] | [prev] | [next] | [standalone]
| From | Laxman Dewangan <ldewangan@nvidia.com> |
|---|---|
| Date | 2016-04-28 12:20 +0200 |
| Subject | Re: [PATCH 3/7] mfd: max77686: Use devm_mfd_add_devices and devm_regmap_add_irq_chip |
| Message-ID | <rsRd8-1qc-17@gated-at.bofh.it> |
| In reply to | #1389914 |
On Thursday 28 April 2016 02:31 PM, Lee Jones wrote: > On Mon, 25 Apr 2016, Krzysztof Kozlowski wrote: > >> On 04/21/2016 02: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 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: Chanwoo Choi <cw00.choi@samsung.com> >>> CC: Krzysztof Kozlowski <k.kozlowski@samsung.com> >>> --- >>> drivers/mfd/max77686.c | 31 ++++++++----------------------- >>> 1 file changed, 8 insertions(+), 23 deletions(-) >> Switching existing code to devm-like interface doesn't bring huge >> benefits but looks okay and I'm fine with it: > This is pretty much my view, but it get's Laxman's patch count up. ;) Yaah. :-) There is some other motivation of doing this: * I got the review comment about the resource leak and sequencing in my max77620. It was silly mistake done by me and it causes recycle of patch. To avoid this in future, devm_ was better option. * Spent lots of time on unbinding test during my RTC patch. Although fix was not related to the devm_ but gave the impression that something we are doing on probe. devm_ looks straight forward. - Some of code quality tools suggest to avoid goto statement. Only possible if we dont have any code in error path i.e. return from any place. - If we have devm_ apis for few resource and some does not support then difficult to use them as this affect the sequence of deallocation. Existing devm_ can be used effectively only if we have all resource allocation using devm_. - Reducing code size always better.
[toc] | [prev] | [next] | [standalone]
| From | Laxman Dewangan <ldewangan@nvidia.com> |
|---|---|
| Date | 2016-04-21 14:40 +0200 |
| Subject | [PATCH 5/7] mfd: sec: Use devm_mfd_add_devices and devm_regmap_add_irq_chip |
| Message-ID | <rqm3N-Ju-41@gated-at.bofh.it> |
| In reply to | #1384158 |
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: Sangbeom Kim <sbkim73@samsung.com>
CC: Krzysztof Kozlowski <k.kozlowski@samsung.com>
CC: linux-samsung-soc@vger.kernel.org
---
drivers/mfd/sec-core.c | 20 +++-----------------
drivers/mfd/sec-irq.c | 14 +++++---------
2 files changed, 8 insertions(+), 26 deletions(-)
diff --git a/drivers/mfd/sec-core.c b/drivers/mfd/sec-core.c
index 400e1d7..ca6b80d 100644
--- a/drivers/mfd/sec-core.c
+++ b/drivers/mfd/sec-core.c
@@ -481,29 +481,16 @@ static int sec_pmic_probe(struct i2c_client *i2c,
/* If this happens the probe function is problem */
BUG();
}
- ret = mfd_add_devices(sec_pmic->dev, -1, sec_devs, num_sec_devs, NULL,
- 0, NULL);
+ ret = devm_mfd_add_devices(sec_pmic->dev, -1, sec_devs, num_sec_devs,
+ NULL, 0, NULL);
if (ret)
- goto err_mfd;
+ return ret;
device_init_wakeup(sec_pmic->dev, sec_pmic->wakeup);
sec_pmic_configure(sec_pmic);
sec_pmic_dump_rev(sec_pmic);
return ret;
-
-err_mfd:
- sec_irq_exit(sec_pmic);
- return ret;
-}
-
-static int sec_pmic_remove(struct i2c_client *i2c)
-{
- struct sec_pmic_dev *sec_pmic = i2c_get_clientdata(i2c);
-
- mfd_remove_devices(sec_pmic->dev);
- sec_irq_exit(sec_pmic);
- return 0;
}
static void sec_pmic_shutdown(struct i2c_client *i2c)
@@ -583,7 +570,6 @@ static struct i2c_driver sec_pmic_driver = {
.of_match_table = of_match_ptr(sec_dt_match),
},
.probe = sec_pmic_probe,
- .remove = sec_pmic_remove,
.shutdown = sec_pmic_shutdown,
.id_table = sec_pmic_id,
};
diff --git a/drivers/mfd/sec-irq.c b/drivers/mfd/sec-irq.c
index d77de43..5eb59c233d5 100644
--- a/drivers/mfd/sec-irq.c
+++ b/drivers/mfd/sec-irq.c
@@ -483,10 +483,11 @@ int sec_irq_init(struct sec_pmic_dev *sec_pmic)
return -EINVAL;
}
- ret = regmap_add_irq_chip(sec_pmic->regmap_pmic, sec_pmic->irq,
- IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
- sec_pmic->irq_base, sec_irq_chip,
- &sec_pmic->irq_data);
+ ret = devm_regmap_add_irq_chip(sec_pmic->dev, sec_pmic->regmap_pmic,
+ sec_pmic->irq,
+ IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
+ sec_pmic->irq_base, sec_irq_chip,
+ &sec_pmic->irq_data);
if (ret != 0) {
dev_err(sec_pmic->dev, "Failed to register IRQ chip: %d\n", ret);
return ret;
@@ -500,8 +501,3 @@ int sec_irq_init(struct sec_pmic_dev *sec_pmic)
return 0;
}
-
-void sec_irq_exit(struct sec_pmic_dev *sec_pmic)
-{
- regmap_del_irq_chip(sec_pmic->irq, sec_pmic->irq_data);
-}
--
2.1.4
[toc] | [prev] | [next] | [standalone]
| From | Krzysztof Kozlowski <k.kozlowski@samsung.com> |
|---|---|
| Date | 2016-04-25 14:50 +0200 |
| Subject | Re: [PATCH 5/7] mfd: sec: Use devm_mfd_add_devices and devm_regmap_add_irq_chip |
| Message-ID | <rrO7E-5ZS-11@gated-at.bofh.it> |
| In reply to | #1384164 |
On 04/21/2016 02: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 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: Sangbeom Kim <sbkim73@samsung.com> > CC: Krzysztof Kozlowski <k.kozlowski@samsung.com> > CC: linux-samsung-soc@vger.kernel.org > --- > drivers/mfd/sec-core.c | 20 +++----------------- > drivers/mfd/sec-irq.c | 14 +++++--------- > 2 files changed, 8 insertions(+), 26 deletions(-) Tested-by: Krzysztof Kozlowski <k.kozlowski@samsung.com> Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com> Best regards, Krzysztof
[toc] | [prev] | [next] | [standalone]
| From | Krzysztof Kozlowski <k.kozlowski@samsung.com> |
|---|---|
| Date | 2016-04-25 13:00 +0200 |
| Subject | Re: [PATCH 0/7] mfd: Use devm_mfd_add_devices and devm_regmap_add_irq_chip |
| Message-ID | <rrMpd-4ls-41@gated-at.bofh.it> |
| In reply to | #1384158 |
On 04/21/2016 02:25 PM, Laxman Dewangan wrote: > This series is an effort to reduce the code in error path and need of > remove callback by using the devm_mfd_add_devices() and > devm_regmap_add_irq_chip() or devm_request_threaded_irq APIs for interrupt > support. > > This is tested with build and comiplation only with arm64 defconfig and enabling > the required MFD CONFIGs. Please compile it also on ARMv7. The changes look trivial but one compilation without testing might not be sufficient. Best regards, Krzysztof
[toc] | [prev] | [next] | [standalone]
| From | Laxman Dewangan <ldewangan@nvidia.com> |
|---|---|
| Date | 2016-04-25 15:10 +0200 |
| Message-ID | <rrOr2-6qu-55@gated-at.bofh.it> |
| In reply to | #1386245 |
On Monday 25 April 2016 04:26 PM, Krzysztof Kozlowski wrote: > On 04/21/2016 02:25 PM, Laxman Dewangan wrote: >> This series is an effort to reduce the code in error path and need of >> remove callback by using the devm_mfd_add_devices() and >> devm_regmap_add_irq_chip() or devm_request_threaded_irq APIs for interrupt >> support. >> >> This is tested with build and comiplation only with arm64 defconfig and enabling >> the required MFD CONFIGs. > Please compile it also on ARMv7. The changes look trivial but one > compilation without testing might not be sufficient. Sure. Thank you very much for testing. I did build test with the ARMv7 for all patches and testing on actual platform with Jetson-TX1 platform + max77620 which have similar change with bind/unbind. This is what I learn from you for testing the remove callback/unbinding without making =m on RTC patches and this really helps me on my lots of testing.
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web