From patchwork Thu Oct 2 08:02:32 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yoshihiro Shimoda X-Patchwork-Id: 5016761 Return-Path: X-Original-To: patchwork-linux-sh@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 576AA9F327 for ; Thu, 2 Oct 2014 08:02:52 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 728A1201FA for ; Thu, 2 Oct 2014 08:02:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5C6D42026F for ; Thu, 2 Oct 2014 08:02:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751995AbaJBICt (ORCPT ); Thu, 2 Oct 2014 04:02:49 -0400 Received: from relmlor4.renesas.com ([210.160.252.174]:46554 "EHLO relmlie3.idc.renesas.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751447AbaJBICr (ORCPT ); Thu, 2 Oct 2014 04:02:47 -0400 Received: from unknown (HELO relmlir4.idc.renesas.com) ([10.200.68.154]) by relmlie3.idc.renesas.com with ESMTP; 02 Oct 2014 17:02:45 +0900 Received: from relmlac1.idc.renesas.com (relmlac1.idc.renesas.com [10.200.69.21]) by relmlir4.idc.renesas.com (Postfix) with ESMTP id 0BC564198C; Thu, 2 Oct 2014 17:02:46 +0900 (JST) Received: by relmlac1.idc.renesas.com (Postfix, from userid 0) id 025878002D; Thu, 2 Oct 2014 17:02:45 +0900 (JST) Received: from relmlac1.idc.renesas.com (localhost [127.0.0.1]) by relmlac1.idc.renesas.com (Postfix) with ESMTP id EC0D58002E; Thu, 2 Oct 2014 17:02:45 +0900 (JST) Received: from relmlii2.idc.renesas.com [10.200.68.66] by relmlac1.idc.renesas.com with ESMTP id TAA28025; Thu, 2 Oct 2014 17:02:45 +0900 X-IronPort-AV: E=Sophos;i="5.04,637,1406559600"; d="scan'208";a="171548529" Received: from mail-hk1lp0117.outbound.protection.outlook.com (HELO APAC01-HK1-obe.outbound.protection.outlook.com) ([207.46.51.117]) by relmlii2.idc.renesas.com with ESMTP/TLS/AES256-SHA; 02 Oct 2014 17:02:45 +0900 Received: from localhost (211.11.155.147) by SIXPR06MB335.apcprd06.prod.outlook.com (10.141.120.17) with Microsoft SMTP Server (TLS) id 15.0.1039.15; Thu, 2 Oct 2014 08:02:42 +0000 From: Yoshihiro Shimoda To: , CC: , , , Yoshihiro Shimoda Subject: [PATCH 1/2] usb: renesas_usbhs: rename phy to usb_phy in usbhs_priv Date: Thu, 2 Oct 2014 17:02:32 +0900 Message-ID: <1412236953-1084-2-git-send-email-yoshihiro.shimoda.uh@renesas.com> X-Mailer: git-send-email 1.9.4.msysgit.1 In-Reply-To: <1412236953-1084-1-git-send-email-yoshihiro.shimoda.uh@renesas.com> References: <1412236953-1084-1-git-send-email-yoshihiro.shimoda.uh@renesas.com> MIME-Version: 1.0 X-Originating-IP: [211.11.155.147] X-ClientProxiedBy: HK2PR01CA0032.apcprd01.prod.exchangelabs.com (25.160.175.42) To SIXPR06MB335.apcprd06.prod.outlook.com (10.141.120.17) X-Microsoft-Antispam: UriScan:; X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:;SRVR:SIXPR06MB335; X-Forefront-PRVS: 03524FBD26 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(6009001)(6069001)(199003)(189002)(97736003)(105586002)(575784001)(106356001)(36756003)(77096002)(92566001)(93916002)(20776003)(19580405001)(33646002)(31966008)(62966002)(10300001)(88136002)(42186005)(48376002)(76506005)(76482002)(87286001)(92726001)(85852003)(50226001)(87976001)(85306004)(64706001)(19580395003)(42382002)(107046002)(104166001)(102836001)(80022003)(99396003)(46102003)(4396001)(78352002)(89996001)(120916001)(66066001)(50466002)(95666004)(21056001)(77156001)(47776003)(229853001)(50986999)(76176999)(101416001)(88662002); DIR:OUT; SFP:1102; SCL:1; SRVR:SIXPR06MB335; H:localhost; FPR:; MLV:sfv; PTR:InfoNoRecords; A:0; MX:0; LANG:; X-OriginatorOrg: renesas.com Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org X-Spam-Status: No, score=-7.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP To support a generic phy driver in this driver later, this patch renames "struct usb_phy *phy" to "struct usb_phy *usb_phy". This patch also cleans up this code. Signed-off-by: Yoshihiro Shimoda --- drivers/usb/renesas_usbhs/common.h | 2 +- drivers/usb/renesas_usbhs/rcar2.c | 48 +++++++++++++++++++----------------- 2 files changed, 27 insertions(+), 23 deletions(-) diff --git a/drivers/usb/renesas_usbhs/common.h b/drivers/usb/renesas_usbhs/common.h index a7996da..e0d53c5 100644 --- a/drivers/usb/renesas_usbhs/common.h +++ b/drivers/usb/renesas_usbhs/common.h @@ -269,7 +269,7 @@ struct usbhs_priv { */ struct usbhs_fifo_info fifo_info; - struct usb_phy *phy; + struct usb_phy *usb_phy; }; /* diff --git a/drivers/usb/renesas_usbhs/rcar2.c b/drivers/usb/renesas_usbhs/rcar2.c index e6b9dcc..485b889 100644 --- a/drivers/usb/renesas_usbhs/rcar2.c +++ b/drivers/usb/renesas_usbhs/rcar2.c @@ -20,25 +20,28 @@ static int usbhs_rcar2_hardware_init(struct platform_device *pdev) { struct usbhs_priv *priv = usbhs_pdev_to_priv(pdev); - struct usb_phy *phy; - phy = usb_get_phy_dev(&pdev->dev, 0); - if (IS_ERR(phy)) - return PTR_ERR(phy); + if (IS_ENABLED(CONFIG_USB_PHY)) { + struct usb_phy *usb_phy = usb_get_phy_dev(&pdev->dev, 0); - priv->phy = phy; - return 0; + if (IS_ERR(usb_phy)) + return PTR_ERR(usb_phy); + + priv->usb_phy = usb_phy; + return 0; + } + + return -ENXIO; } static int usbhs_rcar2_hardware_exit(struct platform_device *pdev) { struct usbhs_priv *priv = usbhs_pdev_to_priv(pdev); - if (!priv->phy) - return 0; - - usb_put_phy(priv->phy); - priv->phy = NULL; + if (priv->usb_phy) { + usb_put_phy(priv->usb_phy); + priv->usb_phy = NULL; + } return 0; } @@ -47,21 +50,22 @@ static int usbhs_rcar2_power_ctrl(struct platform_device *pdev, void __iomem *base, int enable) { struct usbhs_priv *priv = usbhs_pdev_to_priv(pdev); + int retval = -ENODEV; - if (!priv->phy) - return -ENODEV; + if (priv->usb_phy) { + if (enable) { + retval = usb_phy_init(priv->usb_phy); - if (enable) { - int retval = usb_phy_init(priv->phy); - - if (!retval) - retval = usb_phy_set_suspend(priv->phy, 0); - return retval; + if (!retval) + retval = usb_phy_set_suspend(priv->usb_phy, 0); + } else { + usb_phy_set_suspend(priv->usb_phy, 1); + usb_phy_shutdown(priv->usb_phy); + retval = 0; + } } - usb_phy_set_suspend(priv->phy, 1); - usb_phy_shutdown(priv->phy); - return 0; + return retval; } static int usbhs_rcar2_get_id(struct platform_device *pdev)