2016-11-08 09:13:38

by Chanwoo Choi

[permalink] [raw]
Subject: [PATCH v2 0/2] PM / devfreq: Use the resource-managed function for devfreq device

This patch just uses the resource-managed function when adding the new devfreq
deivce. This function handles the memory and delete of devfreq instance
automatically.

Changes from v1:
- Rebased these patches on linux-next (20161108)

Chanwoo Choi (2):
PM / devfreq: rk3399_dmc: Use the resource-managed function to add devfreq dev
scsi: ufs: Use the resource-managed function to add devfreq device

drivers/devfreq/rk3399_dmc.c | 2 +-
drivers/scsi/ufs/ufshcd.c | 4 +---
2 files changed, 2 insertions(+), 4 deletions(-)

--
1.9.1


2016-11-08 09:13:45

by Chanwoo Choi

[permalink] [raw]
Subject: [PATCH v2 2/2] scsi: ufs: Use the resource-managed function to add devfreq device

This patch uses the resource-managed to add the devfreq device.
This function will make it easy to handle the devfreq device.

- struct devfreq *devm_devfreq_add_device(struct device *dev,
struct devfreq_dev_profile *profile,
const char *governor_name,
void *data);
Cc: Vinayak Holikatti <[email protected]>
Cc: James E.J. Bottomley <[email protected]>
Cc: Martin K. Petersen <[email protected]>
Cc: [email protected]
Signed-off-by: Chanwoo Choi <[email protected]>
---
drivers/scsi/ufs/ufshcd.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
index e491c4bda32f..e8c5ba274830 100644
--- a/drivers/scsi/ufs/ufshcd.c
+++ b/drivers/scsi/ufs/ufshcd.c
@@ -6250,8 +6250,6 @@ void ufshcd_remove(struct ufs_hba *hba)
ufshcd_hba_stop(hba, true);

ufshcd_exit_clk_gating(hba);
- if (ufshcd_is_clkscaling_enabled(hba))
- devfreq_remove_device(hba->devfreq);
ufshcd_hba_exit(hba);
}
EXPORT_SYMBOL_GPL(ufshcd_remove);
@@ -6579,7 +6577,7 @@ int ufshcd_init(struct ufs_hba *hba, void __iomem *mmio_base, unsigned int irq)
}

if (ufshcd_is_clkscaling_enabled(hba)) {
- hba->devfreq = devfreq_add_device(dev, &ufs_devfreq_profile,
+ hba->devfreq = devm_devfreq_add_device(dev, &ufs_devfreq_profile,
"simple_ondemand", NULL);
if (IS_ERR(hba->devfreq)) {
dev_err(hba->dev, "Unable to register with devfreq %ld\n",
--
1.9.1

2016-11-08 09:14:07

by Chanwoo Choi

[permalink] [raw]
Subject: [PATCH v2 1/2] PM / devfreq: rk3399_dmc: Use the resource-managed function to add devfreq dev

This patch uses the resource-managed to add the devfreq device.
This function will make it easy to handle the devfreq device.

- struct devfreq *devm_devfreq_add_device(struct device *dev,
struct devfreq_dev_profile *profile,
const char *governor_name,
void *data);

Signed-off-by: Chanwoo Choi <[email protected]>
---
drivers/devfreq/rk3399_dmc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/devfreq/rk3399_dmc.c b/drivers/devfreq/rk3399_dmc.c
index e24b73d66659..3f8f4381cd4a 100644
--- a/drivers/devfreq/rk3399_dmc.c
+++ b/drivers/devfreq/rk3399_dmc.c
@@ -436,7 +436,7 @@ static int rk3399_dmcfreq_probe(struct platform_device *pdev)

rk3399_devfreq_dmc_profile.initial_freq = data->rate;

- data->devfreq = devfreq_add_device(dev,
+ data->devfreq = devm_devfreq_add_device(dev,
&rk3399_devfreq_dmc_profile,
"simple_ondemand",
&data->ondemand_data);
--
1.9.1

2016-11-08 09:17:07

by Chanwoo Choi

[permalink] [raw]
Subject: [PATCH v2 2/2] scsi: ufs: Use the resource-managed function to add devfreq device

This patch uses the resource-managed to add the devfreq device.
This function will make it easy to handle the devfreq device.

- struct devfreq *devm_devfreq_add_device(struct device *dev,
struct devfreq_dev_profile *profile,
const char *governor_name,
void *data);
Cc: Vinayak Holikatti <[email protected]>
Cc: James E.J. Bottomley <[email protected]>
Cc: Martin K. Petersen <[email protected]>
Cc: [email protected]
Signed-off-by: Chanwoo Choi <[email protected]>
---
drivers/scsi/ufs/ufshcd.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
index e491c4bda32f..e8c5ba274830 100644
--- a/drivers/scsi/ufs/ufshcd.c
+++ b/drivers/scsi/ufs/ufshcd.c
@@ -6250,8 +6250,6 @@ void ufshcd_remove(struct ufs_hba *hba)
ufshcd_hba_stop(hba, true);

ufshcd_exit_clk_gating(hba);
- if (ufshcd_is_clkscaling_enabled(hba))
- devfreq_remove_device(hba->devfreq);
ufshcd_hba_exit(hba);
}
EXPORT_SYMBOL_GPL(ufshcd_remove);
@@ -6579,7 +6577,7 @@ int ufshcd_init(struct ufs_hba *hba, void __iomem *mmio_base, unsigned int irq)
}

if (ufshcd_is_clkscaling_enabled(hba)) {
- hba->devfreq = devfreq_add_device(dev, &ufs_devfreq_profile,
+ hba->devfreq = devm_devfreq_add_device(dev, &ufs_devfreq_profile,
"simple_ondemand", NULL);
if (IS_ERR(hba->devfreq)) {
dev_err(hba->dev, "Unable to register with devfreq %ld\n",
--
1.9.1

2016-11-08 20:41:01

by Subhash Jadavani

[permalink] [raw]
Subject: Re: [PATCH v2 2/2] scsi: ufs: Use the resource-managed function to add devfreq device

On 2016-11-08 01:16, Chanwoo Choi wrote:
> This patch uses the resource-managed to add the devfreq device.
> This function will make it easy to handle the devfreq device.
>
> - struct devfreq *devm_devfreq_add_device(struct device *dev,
> struct devfreq_dev_profile *profile,
> const char *governor_name,
> void *data);
> Cc: Vinayak Holikatti <[email protected]>
> Cc: James E.J. Bottomley <[email protected]>
> Cc: Martin K. Petersen <[email protected]>
> Cc: [email protected]
> Signed-off-by: Chanwoo Choi <[email protected]>
> ---
> drivers/scsi/ufs/ufshcd.c | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
> index e491c4bda32f..e8c5ba274830 100644
> --- a/drivers/scsi/ufs/ufshcd.c
> +++ b/drivers/scsi/ufs/ufshcd.c
> @@ -6250,8 +6250,6 @@ void ufshcd_remove(struct ufs_hba *hba)
> ufshcd_hba_stop(hba, true);
>
> ufshcd_exit_clk_gating(hba);
> - if (ufshcd_is_clkscaling_enabled(hba))
> - devfreq_remove_device(hba->devfreq);
> ufshcd_hba_exit(hba);
> }
> EXPORT_SYMBOL_GPL(ufshcd_remove);
> @@ -6579,7 +6577,7 @@ int ufshcd_init(struct ufs_hba *hba, void
> __iomem *mmio_base, unsigned int irq)
> }
>
> if (ufshcd_is_clkscaling_enabled(hba)) {
> - hba->devfreq = devfreq_add_device(dev, &ufs_devfreq_profile,
> + hba->devfreq = devm_devfreq_add_device(dev, &ufs_devfreq_profile,
> "simple_ondemand", NULL);
> if (IS_ERR(hba->devfreq)) {
> dev_err(hba->dev, "Unable to register with devfreq %ld\n",

LGTM.
Reviewed-by: Subhash Jadavani <[email protected]>

--
The Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project

2016-11-09 00:17:38

by Martin K. Petersen

[permalink] [raw]
Subject: Re: [PATCH v2 2/2] scsi: ufs: Use the resource-managed function to add devfreq device

>>>>> "Chanwoo" == Chanwoo Choi <[email protected]> writes:

Chanwoo> This patch uses the resource-managed to add the devfreq device.
Chanwoo> This function will make it easy to handle the devfreq device.

Applied to 4.10/scsi-queue.

--
Martin K. Petersen Oracle Linux Engineering

2016-11-09 01:20:17

by MyungJoo Ham

[permalink] [raw]
Subject: RE: [PATCH v2 1/2] PM / devfreq: rk3399_dmc: Use the resource-managed function to add devfreq dev

> This patch uses the resource-managed to add the devfreq device.
> This function will make it easy to handle the devfreq device.
>
> - struct devfreq *devm_devfreq_add_device(struct device *dev,
> struct devfreq_dev_profile *profile,
> const char *governor_name,
> void *data);
>
> Signed-off-by: Chanwoo Choi <[email protected]>

Acked-by: MyungJoo Ham <[email protected]>


> ---
> drivers/devfreq/rk3399_dmc.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/devfreq/rk3399_dmc.c b/drivers/devfreq/rk3399_dmc.c
> index e24b73d66659..3f8f4381cd4a 100644
> --- a/drivers/devfreq/rk3399_dmc.c
> +++ b/drivers/devfreq/rk3399_dmc.c
> @@ -436,7 +436,7 @@ static int rk3399_dmcfreq_probe(struct platform_device *pdev)
>
> rk3399_devfreq_dmc_profile.initial_freq = data->rate;
>
> - data->devfreq = devfreq_add_device(dev,
> + data->devfreq = devm_devfreq_add_device(dev,
> &rk3399_devfreq_dmc_profile,
> "simple_ondemand",
> &data->ondemand_data);
> --
> 1.9.1
>

2016-11-09 01:27:01

by MyungJoo Ham

[permalink] [raw]
Subject: RE: [PATCH v2 2/2] scsi: ufs: Use the resource-managed function to add devfreq device

> This patch uses the resource-managed to add the devfreq device.
> This function will make it easy to handle the devfreq device.
>
> - struct devfreq *devm_devfreq_add_device(struct device *dev,
> struct devfreq_dev_profile *profile,
> const char *governor_name,
> void *data);
> Cc: Vinayak Holikatti <[email protected]>
> Cc: James E.J. Bottomley <[email protected]>
> Cc: Martin K. Petersen <[email protected]>
> Cc: [email protected]
> Signed-off-by: Chanwoo Choi <[email protected]>

Acked-by: MyungJoo Ham <[email protected]>

> ---
> drivers/scsi/ufs/ufshcd.c | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
>