From patchwork Mon Aug 20 03:10:26 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yoshihiro Shimoda X-Patchwork-Id: 10569845 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4BC9E139B for ; Mon, 20 Aug 2018 03:12:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3475F2918A for ; Mon, 20 Aug 2018 03:12:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 28CAB291B8; Mon, 20 Aug 2018 03:12:03 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 30CAA2918A for ; Mon, 20 Aug 2018 03:12:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726030AbeHTGZt (ORCPT ); Mon, 20 Aug 2018 02:25:49 -0400 Received: from relmlor4.renesas.com ([210.160.252.174]:38165 "EHLO relmlie3.idc.renesas.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725926AbeHTGZt (ORCPT ); Mon, 20 Aug 2018 02:25:49 -0400 Received: from unknown (HELO relmlir1.idc.renesas.com) ([10.200.68.151]) by relmlie3.idc.renesas.com with ESMTP; 20 Aug 2018 12:11:56 +0900 Received: from relmlii1.idc.renesas.com (relmlii1.idc.renesas.com [10.200.68.65]) by relmlir1.idc.renesas.com (Postfix) with ESMTP id D0B4A7489C; Mon, 20 Aug 2018 12:11:56 +0900 (JST) X-IronPort-AV: E=Sophos;i="5.53,263,1531753200"; d="scan'208";a="288504330" Received: from mail-os2jpn01lp0152.outbound.protection.outlook.com (HELO JPN01-OS2-obe.outbound.protection.outlook.com) ([23.103.139.152]) by relmlii1.idc.renesas.com with ESMTP/TLS/AES256-SHA256; 20 Aug 2018 12:11:56 +0900 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=renesasgroup.onmicrosoft.com; s=selector1-renesas-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=/H3FGRw+61RZdczQHOlueR43uVYpVWJHcEMLUGQysbE=; b=eDs3W2O24o9dFO4dJA2TuwVXIooA6rT22F4pqtta+q7hI7aJskEvET1xWpS1tn8Xv7Dcakvl1Spx/+vJWZ36mY9qBVPv8x5oFmSwrhdTzVyz7ycU14jhkdylzMDdgKIxkAlHc6a8+o3DCCwLkMAg/+H458rDcWAUNBoHVmSUvJ0= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=<>; Received: from localhost.localdomain (211.11.155.144) by OSAPR01MB2292.jpnprd01.prod.outlook.com (2603:1096:603:1c::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1059.20; Mon, 20 Aug 2018 03:11:55 +0000 From: Yoshihiro Shimoda To: balbi@kernel.org Cc: gregkh@linuxfoundation.org, linux-usb@vger.kernel.org, linux-renesas-soc@vger.kernel.org, Yoshihiro Shimoda Subject: [PATCH] usb: Change usb_of_get_companion_dev() place to usb/common Date: Mon, 20 Aug 2018 12:10:26 +0900 Message-Id: <1534734626-16767-1-git-send-email-yoshihiro.shimoda.uh@renesas.com> X-Mailer: git-send-email 1.9.1 MIME-Version: 1.0 X-Originating-IP: [211.11.155.144] X-ClientProxiedBy: TYAPR01CA0007.jpnprd01.prod.outlook.com (2603:1096:404::19) To OSAPR01MB2292.jpnprd01.prod.outlook.com (2603:1096:603:1c::15) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 0c979fb9-7e51-444d-2d08-08d6064aaf71 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(7020095)(4652040)(8989137)(4534165)(4627221)(201703031133081)(8559020)(8990107)(5600074)(711020)(4618075)(2017052603328)(7153060)(7193020);SRVR:OSAPR01MB2292; X-Microsoft-Exchange-Diagnostics: 1;OSAPR01MB2292;3:5mnGMOCacmslu5bsjoKAxE4WTTQ2fs7n2CJwSiWcIoH3B2Uqz2L7iSkvICE0UmfSN1ykodPUgsHnuLd967ozxnOXFPPKJ8fWOxOlQQ1VPjYk2Qrb1g83fU8IX6aHtXDPis/3k6Ah5OCW4Ae6NJUvWHdpAbiwK8UZo0BdO96Qky7Bpy6fZZhPk9xpxFekPxUlo/Z0dY8qhCqtk3c/CcT8Vl5+ylGXioPuaJbnJeZRUIspRgCyo3xomFF8+dUefyuN;25:xC7yFNXKqDHt4iml235aLRZDJW28X8/XUjLbESPujWnWQoz4ozRqwWgnppuKEkActF0GgAeIKLXE1PHuQ/VYv0lnRB1wkykmGY6UN88hzaPXEWoCkvX4SzmS30wTi3hcBlu7vvJBw3VgoclSTW24RTfYfPKEYtWYwZdlTjeN28J75qMGAkbAws3moi3tqys1VEDsltKvnjjVLajs/5K6swwGGRmZ74/ExlVBOX+VXumdIqzXXWs50EBQ3GesTO9r+3ZdoMwRaulg6xPfsDc/Ax7F7LNgOftGyLUO8z+778KwMDpY0hoMS8Nfy1qVqMUlg43CFVaFx7MBN09RxW2VAA==;31:cYcuoF4MP45EMsg6806JAul7G4QWQFyapMXDcukEtbJmjQDUdZuDB2Ljqul7IFhWkp3P3hcc/zW6S25A029fLbMoyVM3K/LBZfs6egohBDL05vTCRno5/BImVjRK6/Xd2FOcbeT+VSi/1JGapx50McpvwlynSbe7Zkre4cWVoJ+6gViAkLYVZntDKGyj8+oG/1F71R/JVPEMFTbOLMSmKBeW8SpCkVfnK+TtLN6xaCk= X-MS-TrafficTypeDiagnostic: OSAPR01MB2292: X-Microsoft-Exchange-Diagnostics: 1;OSAPR01MB2292;20://5f6ahPbrWUZwbptqd0uYTZNcCMWRJMkNa0rga80IEuivHRxS8rfMrhfj79UJe5b9xKhj3+d4Vcdo/lNbFlr/lx0KtYXHWq/Sy6d4KD/4xWfXF+N5K6N/WoTc7CA3VNa7v9r6RpMBpBoGw35NxA0+gNuXd7yH8hMbKM/chyh9SAm9Fk8bRPqaxn7OG1qRUDyuBFjLK2evcZQH06K1fCTlHwUIhndMi0aWWLNMVTOJ1L/Q8OGF3g4T+wWYSplAlDdyraTZG/WqvDi6JDkwOKTvsOejfLRqLVA+FWBHHnhZfxAeEaV1jVq/eXzdVn9S+KX8Or3LFjMSVBW+XijARxtHWSx0ZYnL+/y7aonVsufw3fJ9OIqYMBkqGDjmYE8JD9AO/j4iweyjK1ek2hy7DIeObRuRsGyLm90mqrV58QZ+UXRfkrGj9+wVsalZ/Tb648YKFv64fUOhqoKL6svn+0dJXEVRdhG0jXpwRUHfd1MqdU7JCkyv6V/bkaYvbQAsCP;4:JRy06N0EOke5acH/7svy3bNOJ9L1yD0HcK6ZcrAHtrWwoCnsX26SSl6nomCXEqVIbBf27SllpTxYZnCpU0CSF52FLbtseXPKwujFZNvMNRxBZYJZ1B14Ce0Dqc2yilhfClXeffQbJwOO3tMuk4VKOYLG2jXatk7l8U1C3sj+/C+FjC9tyuJc8cmFFz1hU4jUaGgnQhN18mQziIgK8qt10B/ejc/hPG0bUbDJ642CEvkTDUaxJ/828xvZ1U/qSBA+N3uYCpTZ42i+OoTr5t9E7+4JyH+kT5+QA3jeVewUDxV3btZbEkSvufcfuZeyr3vl X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(50582790962513); X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(823301075)(93006095)(3231311)(944501410)(52105095)(10201501046)(3002001)(6055026)(149027)(150027)(6041310)(20161123560045)(20161123564045)(20161123562045)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061750153)(201708071742011)(7699016);SRVR:OSAPR01MB2292;BCL:0;PCL:0;RULEID:;SRVR:OSAPR01MB2292; X-Forefront-PRVS: 0770F75EA9 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(6069001)(346002)(39860400002)(396003)(366004)(376002)(136003)(199004)(189003)(1857600001)(2361001)(26005)(50466002)(386003)(6506007)(14444005)(105586002)(52116002)(51416003)(107886003)(498600001)(78352004)(106356001)(6512007)(8936002)(50226002)(2906002)(42882007)(6486002)(53936002)(48376002)(5660300001)(36756003)(4326008)(16586007)(956004)(81156014)(316002)(68736007)(81166006)(486006)(8676002)(97736004)(6916009)(6666003)(25786009)(66066001)(6116002)(3846002)(16526019)(305945005)(7736002)(2616005)(47776003)(476003)(2351001)(3720700003);DIR:OUT;SFP:1102;SCL:1;SRVR:OSAPR01MB2292;H:localhost.localdomain;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:0;MX:0; Received-SPF: None (protection.outlook.com: localhost.localdomain does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: 1;OSAPR01MB2292;23:bS9pHW+kOXJHU/LSLqdBEwO4kDaHPNYqG9IbWILA2sVDR4ynbODYTHgUAZfmkFf1xQh8q/hgrwk3MRzHv4QLliK96nhUcBGCh5eSCRAIoHBlfxjlnXPW1itPy/S0iruX8jbY14OcS/0ffaDacg4pwffQPz19VsmcLd91jTg9fDwTlSNkA7rObQGc7HfvsXJda+fDd8JTIH0MvA1ywUkE/YNIJqG58u+WvhBuLjPYIgEWoM21/B6Wh481dSKk3uTw9MmClr5Ew8RJviGqMcHGrBHharZjaGWLX3GF+yO9k4GSHYR6iwZa4hAmHSlcD7APdUth6tSM5ALUlA7GWe2imvUWKGmITkmK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Oz2inaNsluD/pJ209m6LyLcUdLQNbkAQi5nYb3Ay2vgGLUxVF+Zyfr6rZXw/lH/QuxME49WCxt7IGAnJhMKntl0k3XrwNO2r1Rzr SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;OSAPR01MB2292;20:0MojxCV5CvYTqKb8AMrrNPFwy1IfwfSz0TXipNkpvwD+AhQPGiTj3lOBCOUQBMszPSsHDXQqqrtCuTO6uwPFVOuASjoU1ueHqNKX7tfdQv42Xb/tnj36e0RWp3+wdqq3hj/EAiCwQKew/iFt9xzAG9v+Q/szQJyMTWkevJ2MLCQ= X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Aug 2018 03:11:55.8929 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 0c979fb9-7e51-444d-2d08-08d6064aaf71 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 53d82571-da19-47e4-9cb4-625a166a4a2a X-MS-Exchange-Transport-CrossTenantHeadersStamped: OSAPR01MB2292 Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Since renesas_usb3 udc driver calls usb_of_get_companion_dev() which is on usb/core/of.c, build error like below happens if we disable CONFIG_USB because the usb/core/ needs CONFIG_USB: ERROR: "usb_of_get_companion_dev" [drivers/usb/gadget/udc/renesas_usb3.ko] undefined! According to the usb/gadget/Kconfig, "NOTE: Gadget support ** DOES NOT ** depend on host-side CONFIG_USB !!". So, to fix the issue, this patch changes the usb_of_get_companion_dev() place from usb/core/of.c to usb/common/common.c to be called by both host and gadget. Reported-by: John Garry Fixes: 39facfa01c9f ("usb: gadget: udc: renesas_usb3: Add register of usb role switch") Signed-off-by: Yoshihiro Shimoda Acked-by: Arnd Bergmann --- drivers/usb/common/common.c | 25 +++++++++++++++++++++++++ drivers/usb/core/of.c | 26 -------------------------- 2 files changed, 25 insertions(+), 26 deletions(-) diff --git a/drivers/usb/common/common.c b/drivers/usb/common/common.c index 50a2362ed..48277bb 100644 --- a/drivers/usb/common/common.c +++ b/drivers/usb/common/common.c @@ -246,6 +246,31 @@ int of_usb_update_otg_caps(struct device_node *np, } EXPORT_SYMBOL_GPL(of_usb_update_otg_caps); +/** + * usb_of_get_companion_dev - Find the companion device + * @dev: the device pointer to find a companion + * + * Find the companion device from platform bus. + * + * Takes a reference to the returned struct device which needs to be dropped + * after use. + * + * Return: On success, a pointer to the companion device, %NULL on failure. + */ +struct device *usb_of_get_companion_dev(struct device *dev) +{ + struct device_node *node; + struct platform_device *pdev = NULL; + + node = of_parse_phandle(dev->of_node, "companion", 0); + if (node) + pdev = of_find_device_by_node(node); + + of_node_put(node); + + return pdev ? &pdev->dev : NULL; +} +EXPORT_SYMBOL_GPL(usb_of_get_companion_dev); #endif MODULE_LICENSE("GPL"); diff --git a/drivers/usb/core/of.c b/drivers/usb/core/of.c index fd77442..651708d 100644 --- a/drivers/usb/core/of.c +++ b/drivers/usb/core/of.c @@ -105,29 +105,3 @@ struct device_node * return NULL; } EXPORT_SYMBOL_GPL(usb_of_get_interface_node); - -/** - * usb_of_get_companion_dev - Find the companion device - * @dev: the device pointer to find a companion - * - * Find the companion device from platform bus. - * - * Takes a reference to the returned struct device which needs to be dropped - * after use. - * - * Return: On success, a pointer to the companion device, %NULL on failure. - */ -struct device *usb_of_get_companion_dev(struct device *dev) -{ - struct device_node *node; - struct platform_device *pdev = NULL; - - node = of_parse_phandle(dev->of_node, "companion", 0); - if (node) - pdev = of_find_device_by_node(node); - - of_node_put(node); - - return pdev ? &pdev->dev : NULL; -} -EXPORT_SYMBOL_GPL(usb_of_get_companion_dev);