* [PATCH 1/1] libata: Blackfin Pata Driver: Add proper PM operation into ATAPI driver.
@ 2008-08-27 3:51 Bryan Wu
2008-08-28 3:51 ` Andrew Morton
0 siblings, 1 reply; 3+ messages in thread
From: Bryan Wu @ 2008-08-27 3:51 UTC (permalink / raw)
To: jgarzik; +Cc: linux-ide, linux-kernel, Sonic Zhang, Bryan Wu
From: Sonic Zhang <sonic.zhang@analog.com>
Signed-off-by: Sonic Zhang <sonic.zhang@analog.com>
Signed-off-by: Bryan Wu <cooloney@kernel.org>
---
drivers/ata/pata_bf54x.c | 29 ++++++++++++++++++++++++-----
1 files changed, 24 insertions(+), 5 deletions(-)
diff --git a/drivers/ata/pata_bf54x.c b/drivers/ata/pata_bf54x.c
index d393290..60f4872 100644
--- a/drivers/ata/pata_bf54x.c
+++ b/drivers/ata/pata_bf54x.c
@@ -1632,6 +1632,8 @@ static int __devinit bfin_atapi_probe(struct platform_device *pdev)
return -ENODEV;
}
+ dev_set_drvdata(&pdev->dev, host);
+
return 0;
}
@@ -1648,6 +1650,7 @@ static int __devexit bfin_atapi_remove(struct platform_device *pdev)
struct ata_host *host = dev_get_drvdata(dev);
ata_host_detach(host);
+ dev_set_drvdata(&pdev->dev, NULL);
peripheral_free_list(atapi_io_port);
@@ -1657,11 +1660,27 @@ static int __devexit bfin_atapi_remove(struct platform_device *pdev)
#ifdef CONFIG_PM
int bfin_atapi_suspend(struct platform_device *pdev, pm_message_t state)
{
- return 0;
+ struct ata_host *host = dev_get_drvdata(&pdev->dev);
+ if (host)
+ return ata_host_suspend(host, state);
+ else
+ return 0;
}
int bfin_atapi_resume(struct platform_device *pdev)
{
+ struct ata_host *host = dev_get_drvdata(&pdev->dev);
+ int ret;
+
+ if (host) {
+ ret = bfin_reset_controller(host);
+ if (ret) {
+ printk(KERN_ERR DRV_NAME ": Error during HW init\n");
+ return ret;
+ }
+ ata_host_resume(host);
+ }
+
return 0;
}
#endif
@@ -1669,13 +1688,13 @@ int bfin_atapi_resume(struct platform_device *pdev)
static struct platform_driver bfin_atapi_driver = {
.probe = bfin_atapi_probe,
.remove = __devexit_p(bfin_atapi_remove),
+#ifdef CONFIG_PM
+ .suspend = bfin_atapi_suspend,
+ .resume = bfin_atapi_resume,
+#endif
.driver = {
.name = DRV_NAME,
.owner = THIS_MODULE,
-#ifdef CONFIG_PM
- .suspend = bfin_atapi_suspend,
- .resume = bfin_atapi_resume,
-#endif
},
};
--
1.5.6
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 1/1] libata: Blackfin Pata Driver: Add proper PM operation into ATAPI driver.
2008-08-27 3:51 [PATCH 1/1] libata: Blackfin Pata Driver: Add proper PM operation into ATAPI driver Bryan Wu
@ 2008-08-28 3:51 ` Andrew Morton
2008-08-28 8:20 ` Bryan Wu
0 siblings, 1 reply; 3+ messages in thread
From: Andrew Morton @ 2008-08-28 3:51 UTC (permalink / raw)
To: Bryan Wu; +Cc: jgarzik, linux-ide, linux-kernel, Sonic Zhang
On Wed, 27 Aug 2008 11:51:18 +0800 Bryan Wu <cooloney@kernel.org> wrote:
> From: Sonic Zhang <sonic.zhang@analog.com>
>
> Signed-off-by: Sonic Zhang <sonic.zhang@analog.com>
> Signed-off-by: Bryan Wu <cooloney@kernel.org>
> ---
> drivers/ata/pata_bf54x.c | 29 ++++++++++++++++++++++++-----
> 1 files changed, 24 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/ata/pata_bf54x.c b/drivers/ata/pata_bf54x.c
> index d393290..60f4872 100644
> --- a/drivers/ata/pata_bf54x.c
> +++ b/drivers/ata/pata_bf54x.c
> @@ -1632,6 +1632,8 @@ static int __devinit bfin_atapi_probe(struct platform_device *pdev)
> return -ENODEV;
> }
>
> + dev_set_drvdata(&pdev->dev, host);
> +
> return 0;
> }
>
> @@ -1648,6 +1650,7 @@ static int __devexit bfin_atapi_remove(struct platform_device *pdev)
> struct ata_host *host = dev_get_drvdata(dev);
>
> ata_host_detach(host);
> + dev_set_drvdata(&pdev->dev, NULL);
>
> peripheral_free_list(atapi_io_port);
>
> @@ -1657,11 +1660,27 @@ static int __devexit bfin_atapi_remove(struct platform_device *pdev)
> #ifdef CONFIG_PM
> int bfin_atapi_suspend(struct platform_device *pdev, pm_message_t state)
> {
> - return 0;
> + struct ata_host *host = dev_get_drvdata(&pdev->dev);
> + if (host)
> + return ata_host_suspend(host, state);
> + else
> + return 0;
> }
>
> int bfin_atapi_resume(struct platform_device *pdev)
> {
> + struct ata_host *host = dev_get_drvdata(&pdev->dev);
> + int ret;
> +
> + if (host) {
> + ret = bfin_reset_controller(host);
> + if (ret) {
> + printk(KERN_ERR DRV_NAME ": Error during HW init\n");
> + return ret;
> + }
> + ata_host_resume(host);
> + }
> +
> return 0;
> }
> #endif
> @@ -1669,13 +1688,13 @@ int bfin_atapi_resume(struct platform_device *pdev)
> static struct platform_driver bfin_atapi_driver = {
> .probe = bfin_atapi_probe,
> .remove = __devexit_p(bfin_atapi_remove),
> +#ifdef CONFIG_PM
> + .suspend = bfin_atapi_suspend,
> + .resume = bfin_atapi_resume,
> +#endif
> .driver = {
> .name = DRV_NAME,
> .owner = THIS_MODULE,
> -#ifdef CONFIG_PM
> - .suspend = bfin_atapi_suspend,
> - .resume = bfin_atapi_resume,
> -#endif
> },
> };
I think we can make these fixes while we're there?
From: Andrew Morton <akpm@linux-foundation.org>
- remove the ifdefs using the usual pattern
- make things static
Cc: Bryan Wu <cooloney@kernel.org>
Cc: Jeff Garzik <jeff@garzik.org>
Cc: Sonic Zhang <sonic.zhang@analog.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
drivers/ata/pata_bf54x.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff -puN drivers/ata/pata_bf54x.c~libata-blackfin-pata-driver-add-proper-pm-operation-into-atapi-driver-fix drivers/ata/pata_bf54x.c
--- a/drivers/ata/pata_bf54x.c~libata-blackfin-pata-driver-add-proper-pm-operation-into-atapi-driver-fix
+++ a/drivers/ata/pata_bf54x.c
@@ -1658,7 +1658,7 @@ static int __devexit bfin_atapi_remove(s
}
#ifdef CONFIG_PM
-int bfin_atapi_suspend(struct platform_device *pdev, pm_message_t state)
+static int bfin_atapi_suspend(struct platform_device *pdev, pm_message_t state)
{
struct ata_host *host = dev_get_drvdata(&pdev->dev);
if (host)
@@ -1667,7 +1667,7 @@ int bfin_atapi_suspend(struct platform_d
return 0;
}
-int bfin_atapi_resume(struct platform_device *pdev)
+static int bfin_atapi_resume(struct platform_device *pdev)
{
struct ata_host *host = dev_get_drvdata(&pdev->dev);
int ret;
@@ -1683,15 +1683,16 @@ int bfin_atapi_resume(struct platform_de
return 0;
}
+#else
+#define bfin_atapi_suspend NULL
+#define bfin_atapi_resume NULL
#endif
static struct platform_driver bfin_atapi_driver = {
.probe = bfin_atapi_probe,
.remove = __devexit_p(bfin_atapi_remove),
-#ifdef CONFIG_PM
.suspend = bfin_atapi_suspend,
.resume = bfin_atapi_resume,
-#endif
.driver = {
.name = DRV_NAME,
.owner = THIS_MODULE,
_
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 1/1] libata: Blackfin Pata Driver: Add proper PM operation into ATAPI driver.
2008-08-28 3:51 ` Andrew Morton
@ 2008-08-28 8:20 ` Bryan Wu
0 siblings, 0 replies; 3+ messages in thread
From: Bryan Wu @ 2008-08-28 8:20 UTC (permalink / raw)
To: Andrew Morton; +Cc: jgarzik, linux-ide, linux-kernel, Sonic Zhang
On Thu, Aug 28, 2008 at 11:51 AM, Andrew Morton
<akpm@linux-foundation.org> wrote:
> On Wed, 27 Aug 2008 11:51:18 +0800 Bryan Wu <cooloney@kernel.org> wrote:
>
>> From: Sonic Zhang <sonic.zhang@analog.com>
>>
>> Signed-off-by: Sonic Zhang <sonic.zhang@analog.com>
>> Signed-off-by: Bryan Wu <cooloney@kernel.org>
>> ---
>> drivers/ata/pata_bf54x.c | 29 ++++++++++++++++++++++++-----
>> 1 files changed, 24 insertions(+), 5 deletions(-)
>>
>> diff --git a/drivers/ata/pata_bf54x.c b/drivers/ata/pata_bf54x.c
>> index d393290..60f4872 100644
>> --- a/drivers/ata/pata_bf54x.c
>> +++ b/drivers/ata/pata_bf54x.c
>> @@ -1632,6 +1632,8 @@ static int __devinit bfin_atapi_probe(struct platform_device *pdev)
>> return -ENODEV;
>> }
>>
>> + dev_set_drvdata(&pdev->dev, host);
>> +
>> return 0;
>> }
>>
>> @@ -1648,6 +1650,7 @@ static int __devexit bfin_atapi_remove(struct platform_device *pdev)
>> struct ata_host *host = dev_get_drvdata(dev);
>>
>> ata_host_detach(host);
>> + dev_set_drvdata(&pdev->dev, NULL);
>>
>> peripheral_free_list(atapi_io_port);
>>
>> @@ -1657,11 +1660,27 @@ static int __devexit bfin_atapi_remove(struct platform_device *pdev)
>> #ifdef CONFIG_PM
>> int bfin_atapi_suspend(struct platform_device *pdev, pm_message_t state)
>> {
>> - return 0;
>> + struct ata_host *host = dev_get_drvdata(&pdev->dev);
>> + if (host)
>> + return ata_host_suspend(host, state);
>> + else
>> + return 0;
>> }
>>
>> int bfin_atapi_resume(struct platform_device *pdev)
>> {
>> + struct ata_host *host = dev_get_drvdata(&pdev->dev);
>> + int ret;
>> +
>> + if (host) {
>> + ret = bfin_reset_controller(host);
>> + if (ret) {
>> + printk(KERN_ERR DRV_NAME ": Error during HW init\n");
>> + return ret;
>> + }
>> + ata_host_resume(host);
>> + }
>> +
>> return 0;
>> }
>> #endif
>> @@ -1669,13 +1688,13 @@ int bfin_atapi_resume(struct platform_device *pdev)
>> static struct platform_driver bfin_atapi_driver = {
>> .probe = bfin_atapi_probe,
>> .remove = __devexit_p(bfin_atapi_remove),
>> +#ifdef CONFIG_PM
>> + .suspend = bfin_atapi_suspend,
>> + .resume = bfin_atapi_resume,
>> +#endif
>> .driver = {
>> .name = DRV_NAME,
>> .owner = THIS_MODULE,
>> -#ifdef CONFIG_PM
>> - .suspend = bfin_atapi_suspend,
>> - .resume = bfin_atapi_resume,
>> -#endif
>> },
>> };
>
> I think we can make these fixes while we're there?
>
> From: Andrew Morton <akpm@linux-foundation.org>
>
> - remove the ifdefs using the usual pattern
>
> - make things static
>
Right, I agree here.
-Bryan
> Cc: Bryan Wu <cooloney@kernel.org>
> Cc: Jeff Garzik <jeff@garzik.org>
> Cc: Sonic Zhang <sonic.zhang@analog.com>
> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
> ---
>
> drivers/ata/pata_bf54x.c | 9 +++++----
> 1 file changed, 5 insertions(+), 4 deletions(-)
>
> diff -puN drivers/ata/pata_bf54x.c~libata-blackfin-pata-driver-add-proper-pm-operation-into-atapi-driver-fix drivers/ata/pata_bf54x.c
> --- a/drivers/ata/pata_bf54x.c~libata-blackfin-pata-driver-add-proper-pm-operation-into-atapi-driver-fix
> +++ a/drivers/ata/pata_bf54x.c
> @@ -1658,7 +1658,7 @@ static int __devexit bfin_atapi_remove(s
> }
>
> #ifdef CONFIG_PM
> -int bfin_atapi_suspend(struct platform_device *pdev, pm_message_t state)
> +static int bfin_atapi_suspend(struct platform_device *pdev, pm_message_t state)
> {
> struct ata_host *host = dev_get_drvdata(&pdev->dev);
> if (host)
> @@ -1667,7 +1667,7 @@ int bfin_atapi_suspend(struct platform_d
> return 0;
> }
>
> -int bfin_atapi_resume(struct platform_device *pdev)
> +static int bfin_atapi_resume(struct platform_device *pdev)
> {
> struct ata_host *host = dev_get_drvdata(&pdev->dev);
> int ret;
> @@ -1683,15 +1683,16 @@ int bfin_atapi_resume(struct platform_de
>
> return 0;
> }
> +#else
> +#define bfin_atapi_suspend NULL
> +#define bfin_atapi_resume NULL
> #endif
>
> static struct platform_driver bfin_atapi_driver = {
> .probe = bfin_atapi_probe,
> .remove = __devexit_p(bfin_atapi_remove),
> -#ifdef CONFIG_PM
> .suspend = bfin_atapi_suspend,
> .resume = bfin_atapi_resume,
> -#endif
> .driver = {
> .name = DRV_NAME,
> .owner = THIS_MODULE,
> _
>
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2008-08-28 8:21 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-08-27 3:51 [PATCH 1/1] libata: Blackfin Pata Driver: Add proper PM operation into ATAPI driver Bryan Wu
2008-08-28 3:51 ` Andrew Morton
2008-08-28 8:20 ` Bryan Wu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox