* [PATCH 0/6] amba: Drop legacy PM support and some other PM improvements
@ 2013-12-03 10:04 Ulf Hansson
2013-12-03 10:04 ` [PATCH 1/6] ALSA: AACI: Convert to modern PM ops Ulf Hansson
` (5 more replies)
0 siblings, 6 replies; 10+ messages in thread
From: Ulf Hansson @ 2013-12-03 10:04 UTC (permalink / raw)
To: linux-arm-kernel
This patch set start by converting a few AMBA drivers to use the modern PM ops.
Once the final driver is converted we are able to remove the legacy PM support
in the AMBA bus in patch 4.
Patch 5 is a cleanup patch related to clocks. Patch 6 improves the runtime PM
support around clock handling.
Ulf Hansson (6):
ALSA: AACI: Convert to modern PM ops
serial: pl010: Convert to modern PM ops
serial: pl011: Convert to modern PM ops
amba: Drop legacy PM support and use the pm_generic functions
amba: Convert to clk_prepare_enable and clk_disable_unprepare
amba: Add clk_prepare|unprepare in runtime PM callbacks
drivers/amba/bus.c | 214 +++------------------------------------
drivers/tty/serial/amba-pl010.c | 15 +--
drivers/tty/serial/amba-pl011.c | 17 ++--
sound/arm/aaci.c | 23 ++---
4 files changed, 43 insertions(+), 226 deletions(-)
--
1.7.9.5
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 1/6] ALSA: AACI: Convert to modern PM ops
2013-12-03 10:04 [PATCH 0/6] amba: Drop legacy PM support and some other PM improvements Ulf Hansson
@ 2013-12-03 10:04 ` Ulf Hansson
2013-12-03 16:45 ` Takashi Iwai
2013-12-03 10:04 ` [PATCH 2/6] serial: pl010: " Ulf Hansson
` (4 subsequent siblings)
5 siblings, 1 reply; 10+ messages in thread
From: Ulf Hansson @ 2013-12-03 10:04 UTC (permalink / raw)
To: linux-arm-kernel
Even if the CONFIG_PM explicity is undefined, let's convert to the
modern PM ops.
Cc: Takashi Iwai <tiwai@suse.de>
Cc: Jaroslav Kysela <perex@perex.cz>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
---
sound/arm/aaci.c | 23 +++++++++++------------
1 file changed, 11 insertions(+), 12 deletions(-)
diff --git a/sound/arm/aaci.c b/sound/arm/aaci.c
index 1ca8dc2..c421fdb 100644
--- a/sound/arm/aaci.c
+++ b/sound/arm/aaci.c
@@ -753,7 +753,7 @@ static struct snd_pcm_ops aaci_capture_ops = {
* Power Management.
*/
#ifdef CONFIG_PM
-static int aaci_do_suspend(struct snd_card *card, unsigned int state)
+static int aaci_do_suspend(struct snd_card *card)
{
struct aaci *aaci = card->private_data;
snd_power_change_state(card, SNDRV_CTL_POWER_D3cold);
@@ -761,28 +761,28 @@ static int aaci_do_suspend(struct snd_card *card, unsigned int state)
return 0;
}
-static int aaci_do_resume(struct snd_card *card, unsigned int state)
+static int aaci_do_resume(struct snd_card *card)
{
snd_power_change_state(card, SNDRV_CTL_POWER_D0);
return 0;
}
-static int aaci_suspend(struct amba_device *dev, pm_message_t state)
+static int aaci_suspend(struct device *dev)
{
- struct snd_card *card = amba_get_drvdata(dev);
+ struct snd_card *card = dev_get_drvdata(dev);
return card ? aaci_do_suspend(card) : 0;
}
-static int aaci_resume(struct amba_device *dev)
+static int aaci_resume(struct device *dev)
{
- struct snd_card *card = amba_get_drvdata(dev);
+ struct snd_card *card = dev_get_drvdata(dev);
return card ? aaci_do_resume(card) : 0;
}
+
+static SIMPLE_DEV_PM_OPS(aaci_dev_pm_ops, aaci_suspend, aaci_resume);
+#define AACI_DEV_PM_OPS (&aaci_dev_pm_ops)
#else
-#define aaci_do_suspend NULL
-#define aaci_do_resume NULL
-#define aaci_suspend NULL
-#define aaci_resume NULL
+#define AACI_DEV_PM_OPS NULL
#endif
@@ -1100,11 +1100,10 @@ MODULE_DEVICE_TABLE(amba, aaci_ids);
static struct amba_driver aaci_driver = {
.drv = {
.name = DRIVER_NAME,
+ .pm = AACI_DEV_PM_OPS,
},
.probe = aaci_probe,
.remove = aaci_remove,
- .suspend = aaci_suspend,
- .resume = aaci_resume,
.id_table = aaci_ids,
};
--
1.7.9.5
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 2/6] serial: pl010: Convert to modern PM ops
2013-12-03 10:04 [PATCH 0/6] amba: Drop legacy PM support and some other PM improvements Ulf Hansson
2013-12-03 10:04 ` [PATCH 1/6] ALSA: AACI: Convert to modern PM ops Ulf Hansson
@ 2013-12-03 10:04 ` Ulf Hansson
2013-12-03 10:04 ` [PATCH 3/6] serial: pl011: " Ulf Hansson
` (3 subsequent siblings)
5 siblings, 0 replies; 10+ messages in thread
From: Ulf Hansson @ 2013-12-03 10:04 UTC (permalink / raw)
To: linux-arm-kernel
Convert to modern PM ops and use the SIMPLE_DEV_PM_OPS macro to set up
the PM callbacks.
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
---
drivers/tty/serial/amba-pl010.c | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/drivers/tty/serial/amba-pl010.c b/drivers/tty/serial/amba-pl010.c
index 33bd860..01c9e72 100644
--- a/drivers/tty/serial/amba-pl010.c
+++ b/drivers/tty/serial/amba-pl010.c
@@ -756,9 +756,10 @@ static int pl010_remove(struct amba_device *dev)
return 0;
}
-static int pl010_suspend(struct amba_device *dev, pm_message_t state)
+#ifdef CONFIG_PM_SLEEP
+static int pl010_suspend(struct device *dev)
{
- struct uart_amba_port *uap = amba_get_drvdata(dev);
+ struct uart_amba_port *uap = dev_get_drvdata(dev);
if (uap)
uart_suspend_port(&amba_reg, &uap->port);
@@ -766,15 +767,18 @@ static int pl010_suspend(struct amba_device *dev, pm_message_t state)
return 0;
}
-static int pl010_resume(struct amba_device *dev)
+static int pl010_resume(struct device *dev)
{
- struct uart_amba_port *uap = amba_get_drvdata(dev);
+ struct uart_amba_port *uap = dev_get_drvdata(dev);
if (uap)
uart_resume_port(&amba_reg, &uap->port);
return 0;
}
+#endif
+
+static SIMPLE_DEV_PM_OPS(pl010_dev_pm_ops, pl010_suspend, pl010_resume);
static struct amba_id pl010_ids[] = {
{
@@ -789,12 +793,11 @@ MODULE_DEVICE_TABLE(amba, pl010_ids);
static struct amba_driver pl010_driver = {
.drv = {
.name = "uart-pl010",
+ .pm = &pl010_dev_pm_ops,
},
.id_table = pl010_ids,
.probe = pl010_probe,
.remove = pl010_remove,
- .suspend = pl010_suspend,
- .resume = pl010_resume,
};
static int __init pl010_init(void)
--
1.7.9.5
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 3/6] serial: pl011: Convert to modern PM ops
2013-12-03 10:04 [PATCH 0/6] amba: Drop legacy PM support and some other PM improvements Ulf Hansson
2013-12-03 10:04 ` [PATCH 1/6] ALSA: AACI: Convert to modern PM ops Ulf Hansson
2013-12-03 10:04 ` [PATCH 2/6] serial: pl010: " Ulf Hansson
@ 2013-12-03 10:04 ` Ulf Hansson
2013-12-03 10:04 ` [PATCH 4/6] amba: Drop legacy PM support and use the pm_generic functions Ulf Hansson
` (2 subsequent siblings)
5 siblings, 0 replies; 10+ messages in thread
From: Ulf Hansson @ 2013-12-03 10:04 UTC (permalink / raw)
To: linux-arm-kernel
Convert to modern PM ops and use the SIMPLE_DEV_PM_OPS macro to set up
the PM callbacks.
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
---
drivers/tty/serial/amba-pl011.c | 17 ++++++++---------
1 file changed, 8 insertions(+), 9 deletions(-)
diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c
index 7203864..1273777 100644
--- a/drivers/tty/serial/amba-pl011.c
+++ b/drivers/tty/serial/amba-pl011.c
@@ -2169,10 +2169,10 @@ static int pl011_remove(struct amba_device *dev)
return 0;
}
-#ifdef CONFIG_PM
-static int pl011_suspend(struct amba_device *dev, pm_message_t state)
+#ifdef CONFIG_PM_SLEEP
+static int pl011_suspend(struct device *dev)
{
- struct uart_amba_port *uap = amba_get_drvdata(dev);
+ struct uart_amba_port *uap = dev_get_drvdata(dev);
if (!uap)
return -EINVAL;
@@ -2180,9 +2180,9 @@ static int pl011_suspend(struct amba_device *dev, pm_message_t state)
return uart_suspend_port(&amba_reg, &uap->port);
}
-static int pl011_resume(struct amba_device *dev)
+static int pl011_resume(struct device *dev)
{
- struct uart_amba_port *uap = amba_get_drvdata(dev);
+ struct uart_amba_port *uap = dev_get_drvdata(dev);
if (!uap)
return -EINVAL;
@@ -2191,6 +2191,8 @@ static int pl011_resume(struct amba_device *dev)
}
#endif
+static SIMPLE_DEV_PM_OPS(pl011_dev_pm_ops, pl011_suspend, pl011_resume);
+
static struct amba_id pl011_ids[] = {
{
.id = 0x00041011,
@@ -2210,14 +2212,11 @@ MODULE_DEVICE_TABLE(amba, pl011_ids);
static struct amba_driver pl011_driver = {
.drv = {
.name = "uart-pl011",
+ .pm = &pl011_dev_pm_ops,
},
.id_table = pl011_ids,
.probe = pl011_probe,
.remove = pl011_remove,
-#ifdef CONFIG_PM
- .suspend = pl011_suspend,
- .resume = pl011_resume,
-#endif
};
static int __init pl011_init(void)
--
1.7.9.5
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 4/6] amba: Drop legacy PM support and use the pm_generic functions
2013-12-03 10:04 [PATCH 0/6] amba: Drop legacy PM support and some other PM improvements Ulf Hansson
` (2 preceding siblings ...)
2013-12-03 10:04 ` [PATCH 3/6] serial: pl011: " Ulf Hansson
@ 2013-12-03 10:04 ` Ulf Hansson
2013-12-03 10:04 ` [PATCH 5/6] amba: Convert to clk_prepare_enable and clk_disable_unprepare Ulf Hansson
2013-12-03 10:04 ` [PATCH 6/6] amba: Add clk_prepare|unprepare in runtime PM callbacks Ulf Hansson
5 siblings, 0 replies; 10+ messages in thread
From: Ulf Hansson @ 2013-12-03 10:04 UTC (permalink / raw)
To: linux-arm-kernel
All AMBA drivers have converted to use the modern PM ops thus we can
safely drop the legacy PM support from the bus.
While using the modern PM ops it also makes sense to convert to use the
pm_generic callback functions.
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
---
drivers/amba/bus.c | 180 ++--------------------------------------------------
1 file changed, 7 insertions(+), 173 deletions(-)
diff --git a/drivers/amba/bus.c b/drivers/amba/bus.c
index c4876ac..b90dc1e 100644
--- a/drivers/amba/bus.c
+++ b/drivers/amba/bus.c
@@ -83,162 +83,6 @@ static struct device_attribute amba_dev_attrs[] = {
__ATTR_NULL,
};
-#ifdef CONFIG_PM_SLEEP
-
-static int amba_legacy_suspend(struct device *dev, pm_message_t mesg)
-{
- struct amba_driver *adrv = to_amba_driver(dev->driver);
- struct amba_device *adev = to_amba_device(dev);
- int ret = 0;
-
- if (dev->driver && adrv->suspend)
- ret = adrv->suspend(adev, mesg);
-
- return ret;
-}
-
-static int amba_legacy_resume(struct device *dev)
-{
- struct amba_driver *adrv = to_amba_driver(dev->driver);
- struct amba_device *adev = to_amba_device(dev);
- int ret = 0;
-
- if (dev->driver && adrv->resume)
- ret = adrv->resume(adev);
-
- return ret;
-}
-
-#endif /* CONFIG_PM_SLEEP */
-
-#ifdef CONFIG_SUSPEND
-
-static int amba_pm_suspend(struct device *dev)
-{
- struct device_driver *drv = dev->driver;
- int ret = 0;
-
- if (!drv)
- return 0;
-
- if (drv->pm) {
- if (drv->pm->suspend)
- ret = drv->pm->suspend(dev);
- } else {
- ret = amba_legacy_suspend(dev, PMSG_SUSPEND);
- }
-
- return ret;
-}
-
-static int amba_pm_resume(struct device *dev)
-{
- struct device_driver *drv = dev->driver;
- int ret = 0;
-
- if (!drv)
- return 0;
-
- if (drv->pm) {
- if (drv->pm->resume)
- ret = drv->pm->resume(dev);
- } else {
- ret = amba_legacy_resume(dev);
- }
-
- return ret;
-}
-
-#else /* !CONFIG_SUSPEND */
-
-#define amba_pm_suspend NULL
-#define amba_pm_resume NULL
-
-#endif /* !CONFIG_SUSPEND */
-
-#ifdef CONFIG_HIBERNATE_CALLBACKS
-
-static int amba_pm_freeze(struct device *dev)
-{
- struct device_driver *drv = dev->driver;
- int ret = 0;
-
- if (!drv)
- return 0;
-
- if (drv->pm) {
- if (drv->pm->freeze)
- ret = drv->pm->freeze(dev);
- } else {
- ret = amba_legacy_suspend(dev, PMSG_FREEZE);
- }
-
- return ret;
-}
-
-static int amba_pm_thaw(struct device *dev)
-{
- struct device_driver *drv = dev->driver;
- int ret = 0;
-
- if (!drv)
- return 0;
-
- if (drv->pm) {
- if (drv->pm->thaw)
- ret = drv->pm->thaw(dev);
- } else {
- ret = amba_legacy_resume(dev);
- }
-
- return ret;
-}
-
-static int amba_pm_poweroff(struct device *dev)
-{
- struct device_driver *drv = dev->driver;
- int ret = 0;
-
- if (!drv)
- return 0;
-
- if (drv->pm) {
- if (drv->pm->poweroff)
- ret = drv->pm->poweroff(dev);
- } else {
- ret = amba_legacy_suspend(dev, PMSG_HIBERNATE);
- }
-
- return ret;
-}
-
-static int amba_pm_restore(struct device *dev)
-{
- struct device_driver *drv = dev->driver;
- int ret = 0;
-
- if (!drv)
- return 0;
-
- if (drv->pm) {
- if (drv->pm->restore)
- ret = drv->pm->restore(dev);
- } else {
- ret = amba_legacy_resume(dev);
- }
-
- return ret;
-}
-
-#else /* !CONFIG_HIBERNATE_CALLBACKS */
-
-#define amba_pm_freeze NULL
-#define amba_pm_thaw NULL
-#define amba_pm_poweroff NULL
-#define amba_pm_restore NULL
-
-#endif /* !CONFIG_HIBERNATE_CALLBACKS */
-
#ifdef CONFIG_PM_RUNTIME
/*
* Hooks to provide runtime PM of the pclk (bus clock). It is safe to
@@ -272,15 +116,13 @@ static int amba_pm_runtime_resume(struct device *dev)
}
#endif
-#ifdef CONFIG_PM
-
static const struct dev_pm_ops amba_pm = {
- .suspend = amba_pm_suspend,
- .resume = amba_pm_resume,
- .freeze = amba_pm_freeze,
- .thaw = amba_pm_thaw,
- .poweroff = amba_pm_poweroff,
- .restore = amba_pm_restore,
+ .suspend = pm_generic_suspend,
+ .resume = pm_generic_resume,
+ .freeze = pm_generic_freeze,
+ .thaw = pm_generic_thaw,
+ .poweroff = pm_generic_poweroff,
+ .restore = pm_generic_restore,
SET_RUNTIME_PM_OPS(
amba_pm_runtime_suspend,
amba_pm_runtime_resume,
@@ -288,14 +130,6 @@ static const struct dev_pm_ops amba_pm = {
)
};
-#define AMBA_PM (&amba_pm)
-
-#else /* !CONFIG_PM */
-
-#define AMBA_PM NULL
-
-#endif /* !CONFIG_PM */
-
/*
* Primecells are part of the Advanced Microcontroller Bus Architecture,
* so we call the bus "amba".
@@ -305,7 +139,7 @@ struct bus_type amba_bustype = {
.dev_attrs = amba_dev_attrs,
.match = amba_match,
.uevent = amba_uevent,
- .pm = AMBA_PM,
+ .pm = &amba_pm,
};
static int __init amba_init(void)
--
1.7.9.5
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 5/6] amba: Convert to clk_prepare_enable and clk_disable_unprepare
2013-12-03 10:04 [PATCH 0/6] amba: Drop legacy PM support and some other PM improvements Ulf Hansson
` (3 preceding siblings ...)
2013-12-03 10:04 ` [PATCH 4/6] amba: Drop legacy PM support and use the pm_generic functions Ulf Hansson
@ 2013-12-03 10:04 ` Ulf Hansson
2013-12-03 10:09 ` Russell King - ARM Linux
2013-12-03 10:04 ` [PATCH 6/6] amba: Add clk_prepare|unprepare in runtime PM callbacks Ulf Hansson
5 siblings, 1 reply; 10+ messages in thread
From: Ulf Hansson @ 2013-12-03 10:04 UTC (permalink / raw)
To: linux-arm-kernel
To simplify code and error handling let's use clk_prepare_enable
and clk_disable_unprepare. No functional change.
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
---
drivers/amba/bus.c | 30 ++++++------------------------
1 file changed, 6 insertions(+), 24 deletions(-)
diff --git a/drivers/amba/bus.c b/drivers/amba/bus.c
index b90dc1e..0477131 100644
--- a/drivers/amba/bus.c
+++ b/drivers/amba/bus.c
@@ -151,36 +151,18 @@ postcore_initcall(amba_init);
static int amba_get_enable_pclk(struct amba_device *pcdev)
{
- struct clk *pclk = clk_get(&pcdev->dev, "apb_pclk");
- int ret;
-
- pcdev->pclk = pclk;
-
- if (IS_ERR(pclk))
- return PTR_ERR(pclk);
+ pcdev->pclk = clk_get(&pcdev->dev, "apb_pclk");
- ret = clk_prepare(pclk);
- if (ret) {
- clk_put(pclk);
- return ret;
- }
+ if (IS_ERR(pcdev->pclk))
+ return PTR_ERR(pcdev->pclk);
- ret = clk_enable(pclk);
- if (ret) {
- clk_unprepare(pclk);
- clk_put(pclk);
- }
-
- return ret;
+ return clk_prepare_enable(pcdev->pclk);
}
static void amba_put_disable_pclk(struct amba_device *pcdev)
{
- struct clk *pclk = pcdev->pclk;
-
- clk_disable(pclk);
- clk_unprepare(pclk);
- clk_put(pclk);
+ clk_disable_unprepare(pcdev->pclk);
+ clk_put(pcdev->pclk);
}
/*
--
1.7.9.5
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 6/6] amba: Add clk_prepare|unprepare in runtime PM callbacks
2013-12-03 10:04 [PATCH 0/6] amba: Drop legacy PM support and some other PM improvements Ulf Hansson
` (4 preceding siblings ...)
2013-12-03 10:04 ` [PATCH 5/6] amba: Convert to clk_prepare_enable and clk_disable_unprepare Ulf Hansson
@ 2013-12-03 10:04 ` Ulf Hansson
5 siblings, 0 replies; 10+ messages in thread
From: Ulf Hansson @ 2013-12-03 10:04 UTC (permalink / raw)
To: linux-arm-kernel
To fully gate the clock and thus potentially also save more power in
runtime suspend state, extend clock handling with clk_prepare|unprepare
in the runtime PM callbacks.
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
---
drivers/amba/bus.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/amba/bus.c b/drivers/amba/bus.c
index 0477131..4cee15a 100644
--- a/drivers/amba/bus.c
+++ b/drivers/amba/bus.c
@@ -95,7 +95,7 @@ static int amba_pm_runtime_suspend(struct device *dev)
int ret = pm_generic_runtime_suspend(dev);
if (ret == 0 && dev->driver)
- clk_disable(pcdev->pclk);
+ clk_disable_unprepare(pcdev->pclk);
return ret;
}
@@ -106,7 +106,7 @@ static int amba_pm_runtime_resume(struct device *dev)
int ret;
if (dev->driver) {
- ret = clk_enable(pcdev->pclk);
+ ret = clk_prepare_enable(pcdev->pclk);
/* Failure is probably fatal to the system, but... */
if (ret)
return ret;
--
1.7.9.5
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 5/6] amba: Convert to clk_prepare_enable and clk_disable_unprepare
2013-12-03 10:04 ` [PATCH 5/6] amba: Convert to clk_prepare_enable and clk_disable_unprepare Ulf Hansson
@ 2013-12-03 10:09 ` Russell King - ARM Linux
2013-12-03 10:35 ` Ulf Hansson
0 siblings, 1 reply; 10+ messages in thread
From: Russell King - ARM Linux @ 2013-12-03 10:09 UTC (permalink / raw)
To: linux-arm-kernel
On Tue, Dec 03, 2013 at 11:04:30AM +0100, Ulf Hansson wrote:
> To simplify code and error handling let's use clk_prepare_enable
> and clk_disable_unprepare. No functional change.
Not true.
> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
> ---
> drivers/amba/bus.c | 30 ++++++------------------------
> 1 file changed, 6 insertions(+), 24 deletions(-)
>
> diff --git a/drivers/amba/bus.c b/drivers/amba/bus.c
> index b90dc1e..0477131 100644
> --- a/drivers/amba/bus.c
> +++ b/drivers/amba/bus.c
> @@ -151,36 +151,18 @@ postcore_initcall(amba_init);
>
> static int amba_get_enable_pclk(struct amba_device *pcdev)
> {
> - struct clk *pclk = clk_get(&pcdev->dev, "apb_pclk");
> - int ret;
> -
> - pcdev->pclk = pclk;
> -
> - if (IS_ERR(pclk))
> - return PTR_ERR(pclk);
> + pcdev->pclk = clk_get(&pcdev->dev, "apb_pclk");
>
> - ret = clk_prepare(pclk);
> - if (ret) {
> - clk_put(pclk);
> - return ret;
> - }
> + if (IS_ERR(pcdev->pclk))
> + return PTR_ERR(pcdev->pclk);
>
> - ret = clk_enable(pclk);
> - if (ret) {
> - clk_unprepare(pclk);
> - clk_put(pclk);
> - }
> -
> - return ret;
> + return clk_prepare_enable(pcdev->pclk);
There is clearly a change here in the error handling.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 5/6] amba: Convert to clk_prepare_enable and clk_disable_unprepare
2013-12-03 10:09 ` Russell King - ARM Linux
@ 2013-12-03 10:35 ` Ulf Hansson
0 siblings, 0 replies; 10+ messages in thread
From: Ulf Hansson @ 2013-12-03 10:35 UTC (permalink / raw)
To: linux-arm-kernel
On 3 December 2013 11:09, Russell King - ARM Linux
<linux@arm.linux.org.uk> wrote:
> On Tue, Dec 03, 2013 at 11:04:30AM +0100, Ulf Hansson wrote:
>> To simplify code and error handling let's use clk_prepare_enable
>> and clk_disable_unprepare. No functional change.
>
> Not true.
>
>> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
>> ---
>> drivers/amba/bus.c | 30 ++++++------------------------
>> 1 file changed, 6 insertions(+), 24 deletions(-)
>>
>> diff --git a/drivers/amba/bus.c b/drivers/amba/bus.c
>> index b90dc1e..0477131 100644
>> --- a/drivers/amba/bus.c
>> +++ b/drivers/amba/bus.c
>> @@ -151,36 +151,18 @@ postcore_initcall(amba_init);
>>
>> static int amba_get_enable_pclk(struct amba_device *pcdev)
>> {
>> - struct clk *pclk = clk_get(&pcdev->dev, "apb_pclk");
>> - int ret;
>> -
>> - pcdev->pclk = pclk;
>> -
>> - if (IS_ERR(pclk))
>> - return PTR_ERR(pclk);
>> + pcdev->pclk = clk_get(&pcdev->dev, "apb_pclk");
>>
>> - ret = clk_prepare(pclk);
>> - if (ret) {
>> - clk_put(pclk);
>> - return ret;
>> - }
>> + if (IS_ERR(pcdev->pclk))
>> + return PTR_ERR(pcdev->pclk);
>>
>> - ret = clk_enable(pclk);
>> - if (ret) {
>> - clk_unprepare(pclk);
>> - clk_put(pclk);
>> - }
>> -
>> - return ret;
>> + return clk_prepare_enable(pcdev->pclk);
>
> There is clearly a change here in the error handling.
Thanks for quick review and sorry for this obvious mistake. V2 on it's way.
Kind regards
Ulf Hansson
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 1/6] ALSA: AACI: Convert to modern PM ops
2013-12-03 10:04 ` [PATCH 1/6] ALSA: AACI: Convert to modern PM ops Ulf Hansson
@ 2013-12-03 16:45 ` Takashi Iwai
0 siblings, 0 replies; 10+ messages in thread
From: Takashi Iwai @ 2013-12-03 16:45 UTC (permalink / raw)
To: linux-arm-kernel
At Tue, 3 Dec 2013 11:04:26 +0100,
Ulf Hansson wrote:
>
> Even if the CONFIG_PM explicity is undefined, let's convert to the
> modern PM ops.
>
> Cc: Takashi Iwai <tiwai@suse.de>
> Cc: Jaroslav Kysela <perex@perex.cz>
> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Thanks, applied.
Takashi
> ---
> sound/arm/aaci.c | 23 +++++++++++------------
> 1 file changed, 11 insertions(+), 12 deletions(-)
>
> diff --git a/sound/arm/aaci.c b/sound/arm/aaci.c
> index 1ca8dc2..c421fdb 100644
> --- a/sound/arm/aaci.c
> +++ b/sound/arm/aaci.c
> @@ -753,7 +753,7 @@ static struct snd_pcm_ops aaci_capture_ops = {
> * Power Management.
> */
> #ifdef CONFIG_PM
> -static int aaci_do_suspend(struct snd_card *card, unsigned int state)
> +static int aaci_do_suspend(struct snd_card *card)
> {
> struct aaci *aaci = card->private_data;
> snd_power_change_state(card, SNDRV_CTL_POWER_D3cold);
> @@ -761,28 +761,28 @@ static int aaci_do_suspend(struct snd_card *card, unsigned int state)
> return 0;
> }
>
> -static int aaci_do_resume(struct snd_card *card, unsigned int state)
> +static int aaci_do_resume(struct snd_card *card)
> {
> snd_power_change_state(card, SNDRV_CTL_POWER_D0);
> return 0;
> }
>
> -static int aaci_suspend(struct amba_device *dev, pm_message_t state)
> +static int aaci_suspend(struct device *dev)
> {
> - struct snd_card *card = amba_get_drvdata(dev);
> + struct snd_card *card = dev_get_drvdata(dev);
> return card ? aaci_do_suspend(card) : 0;
> }
>
> -static int aaci_resume(struct amba_device *dev)
> +static int aaci_resume(struct device *dev)
> {
> - struct snd_card *card = amba_get_drvdata(dev);
> + struct snd_card *card = dev_get_drvdata(dev);
> return card ? aaci_do_resume(card) : 0;
> }
> +
> +static SIMPLE_DEV_PM_OPS(aaci_dev_pm_ops, aaci_suspend, aaci_resume);
> +#define AACI_DEV_PM_OPS (&aaci_dev_pm_ops)
> #else
> -#define aaci_do_suspend NULL
> -#define aaci_do_resume NULL
> -#define aaci_suspend NULL
> -#define aaci_resume NULL
> +#define AACI_DEV_PM_OPS NULL
> #endif
>
>
> @@ -1100,11 +1100,10 @@ MODULE_DEVICE_TABLE(amba, aaci_ids);
> static struct amba_driver aaci_driver = {
> .drv = {
> .name = DRIVER_NAME,
> + .pm = AACI_DEV_PM_OPS,
> },
> .probe = aaci_probe,
> .remove = aaci_remove,
> - .suspend = aaci_suspend,
> - .resume = aaci_resume,
> .id_table = aaci_ids,
> };
>
> --
> 1.7.9.5
>
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2013-12-03 16:45 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-12-03 10:04 [PATCH 0/6] amba: Drop legacy PM support and some other PM improvements Ulf Hansson
2013-12-03 10:04 ` [PATCH 1/6] ALSA: AACI: Convert to modern PM ops Ulf Hansson
2013-12-03 16:45 ` Takashi Iwai
2013-12-03 10:04 ` [PATCH 2/6] serial: pl010: " Ulf Hansson
2013-12-03 10:04 ` [PATCH 3/6] serial: pl011: " Ulf Hansson
2013-12-03 10:04 ` [PATCH 4/6] amba: Drop legacy PM support and use the pm_generic functions Ulf Hansson
2013-12-03 10:04 ` [PATCH 5/6] amba: Convert to clk_prepare_enable and clk_disable_unprepare Ulf Hansson
2013-12-03 10:09 ` Russell King - ARM Linux
2013-12-03 10:35 ` Ulf Hansson
2013-12-03 10:04 ` [PATCH 6/6] amba: Add clk_prepare|unprepare in runtime PM callbacks Ulf Hansson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).