* [PATCHv4 1/5] devfreq: exynos4: Fix bug of resource leak and code clean on probe()
2014-03-20 2:59 [PATCHv4 0/5] devfreq: exynos: Fix minor issue and code clean to remove legacy method Chanwoo Choi
@ 2014-03-20 2:59 ` Chanwoo Choi
2014-03-20 2:59 ` [PATCHv4 2/5] devfreq: exynos4: Use SIMPLE_DEV_PM_OPS macro Chanwoo Choi
` (4 subsequent siblings)
5 siblings, 0 replies; 8+ messages in thread
From: Chanwoo Choi @ 2014-03-20 2:59 UTC (permalink / raw)
To: myungjoo.ham, kyungmin.park
Cc: rafael.j.wysocki, t.figa, b.zolnierkie, linux-kernel,
linux-samsung-soc, Chanwoo Choi
This patch fix bug about resource leak when happening probe fail and code clean
to add debug message.
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
---
drivers/devfreq/exynos/exynos4_bus.c | 35 +++++++++++++++++++++++------------
1 file changed, 23 insertions(+), 12 deletions(-)
diff --git a/drivers/devfreq/exynos/exynos4_bus.c b/drivers/devfreq/exynos/exynos4_bus.c
index e07b0c6..4c1bbd9 100644
--- a/drivers/devfreq/exynos/exynos4_bus.c
+++ b/drivers/devfreq/exynos/exynos4_bus.c
@@ -763,19 +763,11 @@ static int exynos4_bus_get_dev_status(struct device *dev,
return 0;
}
-static void exynos4_bus_exit(struct device *dev)
-{
- struct busfreq_data *data = dev_get_drvdata(dev);
-
- devfreq_unregister_opp_notifier(dev, data->devfreq);
-}
-
static struct devfreq_dev_profile exynos4_devfreq_profile = {
.initial_freq = 400000,
.polling_ms = 50,
.target = exynos4_bus_target,
.get_dev_status = exynos4_bus_get_dev_status,
- .exit = exynos4_bus_exit,
};
static int exynos4210_init_tables(struct busfreq_data *data)
@@ -1048,8 +1040,11 @@ static int exynos4_busfreq_probe(struct platform_device *pdev)
dev_err(dev, "Cannot determine the device id %d\n", data->type);
err = -EINVAL;
}
- if (err)
+ if (err) {
+ dev_err(dev, "Cannot initialize busfreq table %d\n",
+ data->type);
return err;
+ }
data->vdd_int = devm_regulator_get(dev, "vdd_int");
if (IS_ERR(data->vdd_int)) {
@@ -1086,23 +1081,39 @@ static int exynos4_busfreq_probe(struct platform_device *pdev)
if (IS_ERR(data->devfreq))
return PTR_ERR(data->devfreq);
- devfreq_register_opp_notifier(dev, data->devfreq);
+ /* Register opp_notifier for Exynos4 busfreq */
+ err = devfreq_register_opp_notifier(dev, data->devfreq);
+ if (err < 0) {
+ dev_err(dev, "Failed to register opp notifier\n");
+ goto err_notifier_opp;
+ }
+ /* Register pm_notifier for Exynos4 busfreq */
err = register_pm_notifier(&data->pm_notifier);
if (err) {
dev_err(dev, "Failed to setup pm notifier\n");
- devfreq_remove_device(data->devfreq);
- return err;
+ goto err_notifier_pm;
}
return 0;
+
+err_notifier_pm:
+ devfreq_unregister_opp_notifier(dev, data->devfreq);
+err_notifier_opp:
+ devfreq_remove_device(data->devfreq);
+
+ return err;
}
static int exynos4_busfreq_remove(struct platform_device *pdev)
{
struct busfreq_data *data = platform_get_drvdata(pdev);
+ /* Unregister all of notifier chain */
unregister_pm_notifier(&data->pm_notifier);
+ devfreq_unregister_opp_notifier(data->dev, data->devfreq);
+
+ /* Remove devfreq instance */
devfreq_remove_device(data->devfreq);
return 0;
--
1.8.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCHv4 2/5] devfreq: exynos4: Use SIMPLE_DEV_PM_OPS macro
2014-03-20 2:59 [PATCHv4 0/5] devfreq: exynos: Fix minor issue and code clean to remove legacy method Chanwoo Choi
2014-03-20 2:59 ` [PATCHv4 1/5] devfreq: exynos4: Fix bug of resource leak and code clean on probe() Chanwoo Choi
@ 2014-03-20 2:59 ` Chanwoo Choi
2014-03-20 2:59 ` [PATCHv4 3/5] devfreq: exynos4: Add CONFIG_PM_OPP dependency to fix probe fail Chanwoo Choi
` (3 subsequent siblings)
5 siblings, 0 replies; 8+ messages in thread
From: Chanwoo Choi @ 2014-03-20 2:59 UTC (permalink / raw)
To: myungjoo.ham, kyungmin.park
Cc: rafael.j.wysocki, t.figa, b.zolnierkie, linux-kernel,
linux-samsung-soc, Chanwoo Choi
This patch use SIMPLE_DEV_PM_OPS macro instead of legacy method.
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
---
drivers/devfreq/exynos/exynos4_bus.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/devfreq/exynos/exynos4_bus.c b/drivers/devfreq/exynos/exynos4_bus.c
index 4c1bbd9..5a48d16 100644
--- a/drivers/devfreq/exynos/exynos4_bus.c
+++ b/drivers/devfreq/exynos/exynos4_bus.c
@@ -1119,6 +1119,7 @@ static int exynos4_busfreq_remove(struct platform_device *pdev)
return 0;
}
+#ifdef CONFIG_PM_SLEEP
static int exynos4_busfreq_resume(struct device *dev)
{
struct busfreq_data *data = dev_get_drvdata(dev);
@@ -1126,10 +1127,9 @@ static int exynos4_busfreq_resume(struct device *dev)
busfreq_mon_reset(data);
return 0;
}
+#endif
-static const struct dev_pm_ops exynos4_busfreq_pm = {
- .resume = exynos4_busfreq_resume,
-};
+static SIMPLE_DEV_PM_OPS(exynos4_busfreq_pm_ops, NULL, exynos4_busfreq_resume);
static const struct platform_device_id exynos4_busfreq_id[] = {
{ "exynos4210-busfreq", TYPE_BUSF_EXYNOS4210 },
@@ -1145,7 +1145,7 @@ static struct platform_driver exynos4_busfreq_driver = {
.driver = {
.name = "exynos4-busfreq",
.owner = THIS_MODULE,
- .pm = &exynos4_busfreq_pm,
+ .pm = &exynos4_busfreq_pm_ops,
},
};
--
1.8.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCHv4 3/5] devfreq: exynos4: Add CONFIG_PM_OPP dependency to fix probe fail
2014-03-20 2:59 [PATCHv4 0/5] devfreq: exynos: Fix minor issue and code clean to remove legacy method Chanwoo Choi
2014-03-20 2:59 ` [PATCHv4 1/5] devfreq: exynos4: Fix bug of resource leak and code clean on probe() Chanwoo Choi
2014-03-20 2:59 ` [PATCHv4 2/5] devfreq: exynos4: Use SIMPLE_DEV_PM_OPS macro Chanwoo Choi
@ 2014-03-20 2:59 ` Chanwoo Choi
2014-03-20 2:59 ` [PATCHv4 4/5] devfreq: exynos5: Use SIMPLE_DEV_PM_OPS macro Chanwoo Choi
` (2 subsequent siblings)
5 siblings, 0 replies; 8+ messages in thread
From: Chanwoo Choi @ 2014-03-20 2:59 UTC (permalink / raw)
To: myungjoo.ham, kyungmin.park
Cc: rafael.j.wysocki, t.figa, b.zolnierkie, linux-kernel,
linux-samsung-soc, Chanwoo Choi
This patch add CONFIG_PM_OPP dependecy to exynos4_bus driver
to fix probe fail as following log:
[ 3.721389] exynos4-busfreq busfreq.3: Fail to add opp entries.
[ 3.721697] exynos4-busfreq: probe of busfreq.3 failed with error -22
If CONFIG_PM_OPP is disabled, dev_pm_opp_find_freq_floor() in xxx_probe()
will always return -EINVAL error.
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
---
drivers/devfreq/Kconfig | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/devfreq/Kconfig b/drivers/devfreq/Kconfig
index 7d2f435..b2de2a1 100644
--- a/drivers/devfreq/Kconfig
+++ b/drivers/devfreq/Kconfig
@@ -70,6 +70,7 @@ config ARM_EXYNOS4_BUS_DEVFREQ
depends on (CPU_EXYNOS4210 || SOC_EXYNOS4212 || SOC_EXYNOS4412) && !ARCH_MULTIPLATFORM
select ARCH_HAS_OPP
select DEVFREQ_GOV_SIMPLE_ONDEMAND
+ select PM_OPP
help
This adds the DEVFREQ driver for Exynos4210 memory bus (vdd_int)
and Exynos4212/4412 memory interface and bus (vdd_mif + vdd_int).
--
1.8.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCHv4 4/5] devfreq: exynos5: Use SIMPLE_DEV_PM_OPS macro
2014-03-20 2:59 [PATCHv4 0/5] devfreq: exynos: Fix minor issue and code clean to remove legacy method Chanwoo Choi
` (2 preceding siblings ...)
2014-03-20 2:59 ` [PATCHv4 3/5] devfreq: exynos4: Add CONFIG_PM_OPP dependency to fix probe fail Chanwoo Choi
@ 2014-03-20 2:59 ` Chanwoo Choi
2014-03-20 2:59 ` [PATCHv4 5/5] devfreq: exynos5: Add CONFIG_PM_OPP dependency to fix probe fail Chanwoo Choi
2014-03-22 14:52 ` [PATCHv4 0/5] devfreq: exynos: Fix minor issue and code clean to remove legacy method Tomasz Figa
5 siblings, 0 replies; 8+ messages in thread
From: Chanwoo Choi @ 2014-03-20 2:59 UTC (permalink / raw)
To: myungjoo.ham, kyungmin.park
Cc: rafael.j.wysocki, t.figa, b.zolnierkie, linux-kernel,
linux-samsung-soc, Chanwoo Choi
This patch use SIMPLE_DEV_PM_OPS macro instead of legacy method.
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
---
drivers/devfreq/exynos/exynos5_bus.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/drivers/devfreq/exynos/exynos5_bus.c b/drivers/devfreq/exynos/exynos5_bus.c
index 6eef1f7..af6213f 100644
--- a/drivers/devfreq/exynos/exynos5_bus.c
+++ b/drivers/devfreq/exynos/exynos5_bus.c
@@ -429,6 +429,7 @@ static int exynos5_busfreq_int_remove(struct platform_device *pdev)
return 0;
}
+#ifdef CONFIG_PM_SLEEP
static int exynos5_busfreq_int_resume(struct device *dev)
{
struct platform_device *pdev = container_of(dev, struct platform_device,
@@ -438,10 +439,12 @@ static int exynos5_busfreq_int_resume(struct device *dev)
busfreq_mon_reset(data);
return 0;
}
-
static const struct dev_pm_ops exynos5_busfreq_int_pm = {
.resume = exynos5_busfreq_int_resume,
};
+#endif
+static SIMPLE_DEV_PM_OPS(exynos5_busfreq_int_pm_ops, NULL,
+ exynos5_busfreq_int_resume);
/* platform device pointer for exynos5 devfreq device. */
static struct platform_device *exynos5_devfreq_pdev;
@@ -452,7 +455,7 @@ static struct platform_driver exynos5_busfreq_int_driver = {
.driver = {
.name = "exynos5-bus-int",
.owner = THIS_MODULE,
- .pm = &exynos5_busfreq_int_pm,
+ .pm = &exynos5_busfreq_int_pm_ops,
},
};
--
1.8.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCHv4 5/5] devfreq: exynos5: Add CONFIG_PM_OPP dependency to fix probe fail
2014-03-20 2:59 [PATCHv4 0/5] devfreq: exynos: Fix minor issue and code clean to remove legacy method Chanwoo Choi
` (3 preceding siblings ...)
2014-03-20 2:59 ` [PATCHv4 4/5] devfreq: exynos5: Use SIMPLE_DEV_PM_OPS macro Chanwoo Choi
@ 2014-03-20 2:59 ` Chanwoo Choi
2014-03-22 14:52 ` [PATCHv4 0/5] devfreq: exynos: Fix minor issue and code clean to remove legacy method Tomasz Figa
5 siblings, 0 replies; 8+ messages in thread
From: Chanwoo Choi @ 2014-03-20 2:59 UTC (permalink / raw)
To: myungjoo.ham, kyungmin.park
Cc: rafael.j.wysocki, t.figa, b.zolnierkie, linux-kernel,
linux-samsung-soc, Chanwoo Choi
This patch add CONFIG_PM_OPP dependecy to exynos5_bus driver
to fix probe fail. If CONFIG_PM_OPP is disabled, dev_pm_opp_find_freq_floor()
will always return ERR_PTR(-EINVAL) error.
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
---
drivers/devfreq/Kconfig | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/devfreq/Kconfig b/drivers/devfreq/Kconfig
index b2de2a1..c023c57 100644
--- a/drivers/devfreq/Kconfig
+++ b/drivers/devfreq/Kconfig
@@ -84,6 +84,7 @@ config ARM_EXYNOS5_BUS_DEVFREQ
depends on SOC_EXYNOS5250
select ARCH_HAS_OPP
select DEVFREQ_GOV_SIMPLE_ONDEMAND
+ select PM_OPP
help
This adds the DEVFREQ driver for Exynos5250 bus interface (vdd_int).
It reads PPMU counters of memory controllers and adjusts the
--
1.8.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCHv4 0/5] devfreq: exynos: Fix minor issue and code clean to remove legacy method
2014-03-20 2:59 [PATCHv4 0/5] devfreq: exynos: Fix minor issue and code clean to remove legacy method Chanwoo Choi
` (4 preceding siblings ...)
2014-03-20 2:59 ` [PATCHv4 5/5] devfreq: exynos5: Add CONFIG_PM_OPP dependency to fix probe fail Chanwoo Choi
@ 2014-03-22 14:52 ` Tomasz Figa
2014-03-24 1:36 ` Chanwoo Choi
5 siblings, 1 reply; 8+ messages in thread
From: Tomasz Figa @ 2014-03-22 14:52 UTC (permalink / raw)
To: Chanwoo Choi, myungjoo.ham, kyungmin.park
Cc: rafael.j.wysocki, Tomasz Figa, Bartlomiej Zolnierkiewicz,
linux-kernel, linux-samsung-soc
Hi,
[fixing mistyped addresses of me and Bartlomiej]
On 20.03.2014 03:59, Chanwoo Choi wrote:
> This patchset use SIMPLE_DEV_PM_OPS macro intead of legacy method and fix
> probe fail if CONFIG_PM_OPP is disabled. Also, this patchset fix minor issue.
>
> Changes from v3:
> - Discard patches related to DT support because DT support patch of patchset
> don't satisfy the basic of dt concept. So, I'm going to implement DT support
> patch regardless this patchset separately.
> - Use SIMPLE_DEV_PM_OPS macro instead of SET_SYSTEM_SLEEP_PM_OPS macro
> - Delete devfreq->profile->exit callback to improve readability when failure
> happen in probe().
> - Add exynos5 patch to clean code
>
> Changes from v2:
> - Add detailed description to Documentation/devicetree/bindings/exynos4_bus.txt
> and change patch description of patch#8
> - Change the sequence of patchset in patch #1 ~ #4
> - Fix minor issue
>
> Changes from v1:
> - Add exynos4_bus.txt documentation for devicetree guide
> - Fix probe failure if CONFIG_PM_OPP is disabled
> - Fix typo and resource leak(regulator/clock/memory) when happening probe failure
> - Add additionally comment for PPMU usage instead of previous PPC
> - Split separate patch to remove ambiguous of patch
>
> Chanwoo Choi (5):
> devfreq: exynos4: Fix bug of resource leak and code clean on probe()
> devfreq: exynos4: Use SIMPLE_DEV_PM_OPS macro
> devfreq: exynos4: Add CONFIG_PM_OPP dependency to fix probe fail
> devfreq: exynos5: Use SIMPLE_DEV_PM_OPS macro
> devfreq: exynos5: Add CONFIG_PM_OPP dependency to fix probe fail
>
> drivers/devfreq/Kconfig | 2 ++
> drivers/devfreq/exynos/exynos4_bus.c | 43 ++++++++++++++++++++++--------------
> drivers/devfreq/exynos/exynos5_bus.c | 7 ++++--
> 3 files changed, 34 insertions(+), 18 deletions(-)
>
Reviewed-by: Tomasz Figa <t.figa@samsung.com>
Best regards,
Tomasz
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCHv4 0/5] devfreq: exynos: Fix minor issue and code clean to remove legacy method
2014-03-22 14:52 ` [PATCHv4 0/5] devfreq: exynos: Fix minor issue and code clean to remove legacy method Tomasz Figa
@ 2014-03-24 1:36 ` Chanwoo Choi
0 siblings, 0 replies; 8+ messages in thread
From: Chanwoo Choi @ 2014-03-24 1:36 UTC (permalink / raw)
To: Tomasz Figa
Cc: myungjoo.ham, kyungmin.park, rafael.j.wysocki, Tomasz Figa,
Bartlomiej Zolnierkiewicz, linux-kernel, linux-samsung-soc
Hi Tomasz,
On 03/22/2014 11:52 PM, Tomasz Figa wrote:
> Hi,
>
> [fixing mistyped addresses of me and Bartlomiej]
>
> On 20.03.2014 03:59, Chanwoo Choi wrote:
>> This patchset use SIMPLE_DEV_PM_OPS macro intead of legacy method and fix
>> probe fail if CONFIG_PM_OPP is disabled. Also, this patchset fix minor issue.
>>
>> Changes from v3:
>> - Discard patches related to DT support because DT support patch of patchset
>> don't satisfy the basic of dt concept. So, I'm going to implement DT support
>> patch regardless this patchset separately.
>> - Use SIMPLE_DEV_PM_OPS macro instead of SET_SYSTEM_SLEEP_PM_OPS macro
>> - Delete devfreq->profile->exit callback to improve readability when failure
>> happen in probe().
>> - Add exynos5 patch to clean code
>>
>> Changes from v2:
>> - Add detailed description to Documentation/devicetree/bindings/exynos4_bus.txt
>> and change patch description of patch#8
>> - Change the sequence of patchset in patch #1 ~ #4
>> - Fix minor issue
>>
>> Changes from v1:
>> - Add exynos4_bus.txt documentation for devicetree guide
>> - Fix probe failure if CONFIG_PM_OPP is disabled
>> - Fix typo and resource leak(regulator/clock/memory) when happening probe failure
>> - Add additionally comment for PPMU usage instead of previous PPC
>> - Split separate patch to remove ambiguous of patch
>>
>> Chanwoo Choi (5):
>> devfreq: exynos4: Fix bug of resource leak and code clean on probe()
>> devfreq: exynos4: Use SIMPLE_DEV_PM_OPS macro
>> devfreq: exynos4: Add CONFIG_PM_OPP dependency to fix probe fail
>> devfreq: exynos5: Use SIMPLE_DEV_PM_OPS macro
>> devfreq: exynos5: Add CONFIG_PM_OPP dependency to fix probe fail
>>
>> drivers/devfreq/Kconfig | 2 ++
>> drivers/devfreq/exynos/exynos4_bus.c | 43 ++++++++++++++++++++++--------------
>> drivers/devfreq/exynos/exynos5_bus.c | 7 ++++--
>> 3 files changed, 34 insertions(+), 18 deletions(-)
>>
>
> Reviewed-by: Tomasz Figa <t.figa@samsung.com>
>
Thanks for your review always.
Best Regards,
Chanwoo Choi
^ permalink raw reply [flat|nested] 8+ messages in thread