From patchwork Wed Jul 29 09:24:41 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yoshihiro Shimoda X-Patchwork-Id: 38088 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n6T9P2sk015420 for ; Wed, 29 Jul 2009 09:25:02 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752590AbZG2JZA (ORCPT ); Wed, 29 Jul 2009 05:25:00 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752477AbZG2JZA (ORCPT ); Wed, 29 Jul 2009 05:25:00 -0400 Received: from mail.renesas.com ([202.234.163.13]:37586 "EHLO mail02.idc.renesas.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752590AbZG2JY7 (ORCPT ); Wed, 29 Jul 2009 05:24:59 -0400 X-AuditID: ac140385-0000000b000002de-6d-4a70155a3248 Received: from guardian03.idc.renesas.com ([172.20.8.202]) by mail02.idc.renesas.com (sendmail) with ESMTP id n6T9Ogj1008141; Wed, 29 Jul 2009 18:24:42 +0900 (JST) Received: (from root@localhost) by guardian03.idc.renesas.com with id n6T9OgMR013882; Wed, 29 Jul 2009 18:24:42 +0900 (JST) Received: from mta03.idc.renesas.com (localhost [127.0.0.1]) by mta03.idc.renesas.com with ESMTP id n6T9OiOd006721; Wed, 29 Jul 2009 18:24:44 +0900 (JST) Received: from [172.30.8.157] by ims05.idc.renesas.com (Sendmail) with ESMTPA id <0KNJ00CR4E568T@ims05.idc.renesas.com>; Wed, 29 Jul 2009 18:24:42 +0900 (JST) Date: Wed, 29 Jul 2009 18:24:41 +0900 From: Yoshihiro Shimoda Subject: Re: [PATCH] usb: convert r8a66597-hcd to dev_pm_ops In-reply-to: <20090717145205.17771.85105.sendpatchset@rx1.opensource.se> To: Magnus Damm Cc: linux-sh@vger.kernel.org, lethal@linux-sh.org, linux-usb@vger.kernel.org, gregkh@suse.de Message-id: <4A701559.5080605@renesas.com> MIME-version: 1.0 Content-type: text/plain; charset=ISO-8859-1 Content-transfer-encoding: 7bit User-Agent: Thunderbird 2.0.0.14 (Windows/20080421) References: <20090717145205.17771.85105.sendpatchset@rx1.opensource.se> X-Brightmail-Tracker: AAAAAA== Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org Magnus Damm wrote: > From: Magnus Damm > > Convert the r8a66597-hcd driver to dev_pm_ops. This makes > the driver a good PM citizen and removes a warning printout. > > Signed-off-by: Magnus Damm > --- > > Tested on a ap325 board with sh7723 cpu using on-chip r8a66597. When I checked this patch on sh7785lcr board, I looked a little problem. The problem is that usb device cannot re-enumerate when resume from hibernation. I made the new patch. Thanks, Yoshihiro Shimoda --- Convert the r8a66597-hcd driver to dev_pm_ops. This makes the driver a good PM citizen and removes warning printout. Singed-off-by: Magnus Damm Signed-off-by: Yoshihiro Shimoda --- drivers/usb/host/r8a66597-hcd.c | 23 +++++++++++++++-------- 1 files changed, 15 insertions(+), 8 deletions(-) -- 1.5.5 -- To unsubscribe from this list: send the line "unsubscribe linux-sh" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/usb/host/r8a66597-hcd.c b/drivers/usb/host/r8a66597-hcd.c index e18f749..dc61f5d 100644 --- a/drivers/usb/host/r8a66597-hcd.c +++ b/drivers/usb/host/r8a66597-hcd.c @@ -2305,9 +2305,9 @@ static struct hc_driver r8a66597_hc_driver = { }; #if defined(CONFIG_PM) -static int r8a66597_suspend(struct platform_device *pdev, pm_message_t state) +static int r8a66597_suspend(struct device *dev) { - struct r8a66597 *r8a66597 = dev_get_drvdata(&pdev->dev); + struct r8a66597 *r8a66597 = dev_get_drvdata(dev); int port; dbg("%s", __func__); @@ -2323,9 +2323,9 @@ static int r8a66597_suspend(struct platform_device *pdev, pm_message_t state) return 0; } -static int r8a66597_resume(struct platform_device *pdev) +static int r8a66597_resume(struct device *dev) { - struct r8a66597 *r8a66597 = dev_get_drvdata(&pdev->dev); + struct r8a66597 *r8a66597 = dev_get_drvdata(dev); struct usb_hcd *hcd = r8a66597_to_hcd(r8a66597); dbg("%s", __func__); @@ -2335,9 +2335,17 @@ static int r8a66597_resume(struct platform_device *pdev) return 0; } + +static struct dev_pm_ops r8a66597_dev_pm_ops = { + .suspend = r8a66597_suspend, + .resume = r8a66597_resume, + .poweroff = r8a66597_suspend, + .restore = r8a66597_resume, +}; + +#define R8A66597_DEV_PM_OPS (&r8a66597_dev_pm_ops) #else /* if defined(CONFIG_PM) */ -#define r8a66597_suspend NULL -#define r8a66597_resume NULL +#define R8A66597_DEV_PM_OPS NULL #endif static int __init_or_module r8a66597_remove(struct platform_device *pdev) @@ -2473,11 +2481,10 @@ clean_up: static struct platform_driver r8a66597_driver = { .probe = r8a66597_probe, .remove = r8a66597_remove, - .suspend = r8a66597_suspend, - .resume = r8a66597_resume, .driver = { .name = (char *) hcd_name, .owner = THIS_MODULE, + .pm = R8A66597_DEV_PM_OPS, }, };