2013-04-11 04:04:25

by Axel Lin

[permalink] [raw]
Subject: [PATCH 1/2] regulator: ab8500-ext: Make the return type of ab8500_ext_regulator_exit() void

ab8500_ext_regulator_exit() never fails.

Signed-off-by: Axel Lin <[email protected]>
---
drivers/regulator/ab8500-ext.c | 4 +---
drivers/regulator/ab8500.c | 9 +++------
include/linux/regulator/ab8500.h | 2 +-
3 files changed, 5 insertions(+), 10 deletions(-)

diff --git a/drivers/regulator/ab8500-ext.c b/drivers/regulator/ab8500-ext.c
index dd582be..861ab04 100644
--- a/drivers/regulator/ab8500-ext.c
+++ b/drivers/regulator/ab8500-ext.c
@@ -385,7 +385,7 @@ int ab8500_ext_regulator_init(struct platform_device *pdev)
return 0;
}

-int ab8500_ext_regulator_exit(struct platform_device *pdev)
+void ab8500_ext_regulator_exit(struct platform_device *pdev)
{
int i;

@@ -398,8 +398,6 @@ int ab8500_ext_regulator_exit(struct platform_device *pdev)

regulator_unregister(info->rdev);
}
-
- return 0;
}

MODULE_LICENSE("GPL v2");
diff --git a/drivers/regulator/ab8500.c b/drivers/regulator/ab8500.c
index 9ebd131..c200f8b 100644
--- a/drivers/regulator/ab8500.c
+++ b/drivers/regulator/ab8500.c
@@ -3194,12 +3194,9 @@ static int ab8500_regulator_remove(struct platform_device *pdev)
regulator_unregister(info->regulator);
}

- if (!is_ab8505(ab8500)) {
- /* remove external regulators (after Vaux1, 2 and 3) */
- err = ab8500_ext_regulator_exit(pdev);
- if (err)
- return err;
- }
+ /* remove external regulators (after Vaux1, 2 and 3) */
+ if (!is_ab8505(ab8500))
+ ab8500_ext_regulator_exit(pdev);

/* remove regulator debug */
err = ab8500_regulator_debug_exit(pdev);
diff --git a/include/linux/regulator/ab8500.h b/include/linux/regulator/ab8500.h
index 90b8b5a..7c5ff0c 100644
--- a/include/linux/regulator/ab8500.h
+++ b/include/linux/regulator/ab8500.h
@@ -338,6 +338,6 @@ static inline int ab8500_regulator_debug_exit(struct platform_device *pdev)

/* AB8500 external regulator functions. */
int ab8500_ext_regulator_init(struct platform_device *pdev);
-int ab8500_ext_regulator_exit(struct platform_device *pdev);
+void ab8500_ext_regulator_exit(struct platform_device *pdev);

#endif
--
1.7.10.4



2013-04-11 04:05:49

by Axel Lin

[permalink] [raw]
Subject: [PATCH 2/2] regulator: ab8500: Unregister ab8500-ext regulators in probe() failure path

Signed-off-by: Axel Lin <[email protected]>
---
drivers/regulator/ab8500.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/regulator/ab8500.c b/drivers/regulator/ab8500.c
index c200f8b..ea182d3 100644
--- a/drivers/regulator/ab8500.c
+++ b/drivers/regulator/ab8500.c
@@ -3172,8 +3172,11 @@ static int ab8500_regulator_probe(struct platform_device *pdev)
for (i = 0; i < abx500_regulator.info_size; i++) {
err = ab8500_regulator_register(pdev, &pdata->regulator[i],
i, NULL);
- if (err < 0)
+ if (err < 0) {
+ if (!is_ab8505(ab8500))
+ ab8500_ext_regulator_exit(pdev);
return err;
+ }
}

return 0;
--
1.7.10.4


2013-04-11 06:41:13

by Bengt Jönsson

[permalink] [raw]
Subject: Re: [PATCH 1/2] regulator: ab8500-ext: Make the return type of ab8500_ext_regulator_exit() void

On 04/11/2013 06:04 AM, Axel Lin wrote:
> ab8500_ext_regulator_exit() never fails.
>
> Signed-off-by: Axel Lin <[email protected]>
Looks good to me.

Acked-by: Bengt Jonsson <[email protected]>
> ---
> drivers/regulator/ab8500-ext.c | 4 +---
> drivers/regulator/ab8500.c | 9 +++------
> include/linux/regulator/ab8500.h | 2 +-
> 3 files changed, 5 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/regulator/ab8500-ext.c b/drivers/regulator/ab8500-ext.c
> index dd582be..861ab04 100644
> --- a/drivers/regulator/ab8500-ext.c
> +++ b/drivers/regulator/ab8500-ext.c
> @@ -385,7 +385,7 @@ int ab8500_ext_regulator_init(struct platform_device *pdev)
> return 0;
> }
>
> -int ab8500_ext_regulator_exit(struct platform_device *pdev)
> +void ab8500_ext_regulator_exit(struct platform_device *pdev)
> {
> int i;
>
> @@ -398,8 +398,6 @@ int ab8500_ext_regulator_exit(struct platform_device *pdev)
>
> regulator_unregister(info->rdev);
> }
> -
> - return 0;
> }
>
> MODULE_LICENSE("GPL v2");
> diff --git a/drivers/regulator/ab8500.c b/drivers/regulator/ab8500.c
> index 9ebd131..c200f8b 100644
> --- a/drivers/regulator/ab8500.c
> +++ b/drivers/regulator/ab8500.c
> @@ -3194,12 +3194,9 @@ static int ab8500_regulator_remove(struct platform_device *pdev)
> regulator_unregister(info->regulator);
> }
>
> - if (!is_ab8505(ab8500)) {
> - /* remove external regulators (after Vaux1, 2 and 3) */
> - err = ab8500_ext_regulator_exit(pdev);
> - if (err)
> - return err;
> - }
> + /* remove external regulators (after Vaux1, 2 and 3) */
> + if (!is_ab8505(ab8500))
> + ab8500_ext_regulator_exit(pdev);
>
> /* remove regulator debug */
> err = ab8500_regulator_debug_exit(pdev);
> diff --git a/include/linux/regulator/ab8500.h b/include/linux/regulator/ab8500.h
> index 90b8b5a..7c5ff0c 100644
> --- a/include/linux/regulator/ab8500.h
> +++ b/include/linux/regulator/ab8500.h
> @@ -338,6 +338,6 @@ static inline int ab8500_regulator_debug_exit(struct platform_device *pdev)
>
> /* AB8500 external regulator functions. */
> int ab8500_ext_regulator_init(struct platform_device *pdev);
> -int ab8500_ext_regulator_exit(struct platform_device *pdev);
> +void ab8500_ext_regulator_exit(struct platform_device *pdev);
>
> #endif

2013-04-11 06:44:23

by Bengt Jönsson

[permalink] [raw]
Subject: Re: [PATCH 2/2] regulator: ab8500: Unregister ab8500-ext regulators in probe() failure path

On 04/11/2013 06:05 AM, Axel Lin wrote:
> Signed-off-by: Axel Lin <[email protected]>
Looks good to me.

Acked-by: Bengt Jonsson <[email protected]>
> ---
> drivers/regulator/ab8500.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/regulator/ab8500.c b/drivers/regulator/ab8500.c
> index c200f8b..ea182d3 100644
> --- a/drivers/regulator/ab8500.c
> +++ b/drivers/regulator/ab8500.c
> @@ -3172,8 +3172,11 @@ static int ab8500_regulator_probe(struct platform_device *pdev)
> for (i = 0; i < abx500_regulator.info_size; i++) {
> err = ab8500_regulator_register(pdev, &pdata->regulator[i],
> i, NULL);
> - if (err < 0)
> + if (err < 0) {
> + if (!is_ab8505(ab8500))
> + ab8500_ext_regulator_exit(pdev);
> return err;
> + }
> }
>
> return 0;

2013-04-11 16:44:25

by Mark Brown

[permalink] [raw]
Subject: Re: [PATCH 1/2] regulator: ab8500-ext: Make the return type of ab8500_ext_regulator_exit() void

On Thu, Apr 11, 2013 at 12:04:18PM +0800, Axel Lin wrote:

> ab8500_ext_regulator_exit() never fails.

Applied both, thanks.


Attachments:
(No filename) (125.00 B)
signature.asc (836.00 B)
Digital signature
Download all attachments