From patchwork Wed Apr 18 08:10:00 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yoshihiro Shimoda X-Patchwork-Id: 10347515 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id B2E1960365 for ; Wed, 18 Apr 2018 08:10:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A950028590 for ; Wed, 18 Apr 2018 08:10:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9DB5328599; Wed, 18 Apr 2018 08:10:58 +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.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI, T_DKIM_INVALID 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 0DE0828590 for ; Wed, 18 Apr 2018 08:10:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753766AbeDRIKz (ORCPT ); Wed, 18 Apr 2018 04:10:55 -0400 Received: from relmlor2.renesas.com ([210.160.252.172]:39097 "EHLO relmlie1.idc.renesas.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753685AbeDRIKq (ORCPT ); Wed, 18 Apr 2018 04:10:46 -0400 Received: from unknown (HELO relmlir4.idc.renesas.com) ([10.200.68.154]) by relmlie1.idc.renesas.com with ESMTP; 18 Apr 2018 17:10:45 +0900 Received: from relmlii2.idc.renesas.com (relmlii2.idc.renesas.com [10.200.68.66]) by relmlir4.idc.renesas.com (Postfix) with ESMTP id 14F4C8A1CF; Wed, 18 Apr 2018 17:10:45 +0900 (JST) X-IronPort-AV: E=Sophos;i="5.48,464,1517842800"; d="scan'208";a="278555608" Received: from mail-pu1apc01lp0019.outbound.protection.outlook.com (HELO APC01-PU1-obe.outbound.protection.outlook.com) ([65.55.88.19]) by relmlii2.idc.renesas.com with ESMTP/TLS/AES256-GCM-SHA384; 18 Apr 2018 17:10:43 +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; bh=YSt/g7j/Ak68Yi1pKNjDICEPJhhG0+ccdKF1/+TDoME=; b=dZDstCJGT9kSdZHtaIMP3t24zDItCtvsZJKPqEuG0xqZS10tkLUq051KMfuFVOYMJyQpvul1EKVWuT/8WeWIiTtwbCB2cdILTDHd5BAeF6cZqEwpsJ/yEPe8S0UGSCKY0Jg5pKF/Mn+2yN8JTboNfe2hhcjA0SnBKlni6M+CRKE= Authentication-Results: linuxfoundation.org; dkim=none (message not signed) header.d=none; linuxfoundation.org; dmarc=none action=none header.from=renesas.com; Received: from localhost.localdomain (211.11.155.138) by SG2PR06MB0982.apcprd06.prod.outlook.com (2a01:111:e400:5213::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.675.14; Wed, 18 Apr 2018 08:10:37 +0000 From: Yoshihiro Shimoda To: gregkh@linuxfoundation.org, robh+dt@kernel.org, mark.rutland@arm.com, frowand.list@gmail.com Cc: heikki.krogerus@linux.intel.com, hdegoede@redhat.com, andy.shevchenko@gmail.com, p.zabel@pengutronix.de, linux-usb@vger.kernel.org, linux-renesas-soc@vger.kernel.org, devicetree@vger.kernel.org, Yoshihiro Shimoda Subject: [PATCH/RFC 06/11] usb: common: roles: Allow if the parent dev_name matches Date: Wed, 18 Apr 2018 17:10:00 +0900 Message-Id: <1524039005-30618-7-git-send-email-yoshihiro.shimoda.uh@renesas.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1524039005-30618-1-git-send-email-yoshihiro.shimoda.uh@renesas.com> References: <1524039005-30618-1-git-send-email-yoshihiro.shimoda.uh@renesas.com> MIME-Version: 1.0 X-Originating-IP: [211.11.155.138] X-ClientProxiedBy: OSAPR01CA0023.jpnprd01.prod.outlook.com (2603:1096:603:2a::35) To SG2PR06MB0982.apcprd06.prod.outlook.com (2a01:111:e400:5213::24) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(5600026)(4534165)(4627221)(201703031133081)(48565401081)(2017052603328)(7153060)(7193020); SRVR:SG2PR06MB0982; X-Microsoft-Exchange-Diagnostics: 1; SG2PR06MB0982; 3:3INVO36NR11gfChq7K6kUaVZ8v6KGCPymkOj26GChbxIqKi9X4CmVMqHVzh/hMT3EnyaPA54Kgh+6cWwtf7O1/WqRz+MEuvbdOoYJtaykh1qpdI1sodFHFQSLD7bFF3rb6nSW8jMsn4UDfAEN7P9zQkFBktJ7yo0fSE9kDfSy14lU9bHFnFGvsdfuzrbUzMAgHQHMMyFsztGcK+Bm8/0su2djFzGxUn8flARu2bmkmwKStqmOhv+edEXcWYLuVi0; 25:4f+pcbEZJVsKXWkmR1RxqfcciEaG0wmJdfigXJ45NcM1gCEVX3U5InmdnBaaDVaCeOvH/Vw1bSDGJXnbZUjHHzunwS5v54yJlRgjY+khlAX+6KnHf79hAZrQAmVfqUeC4GhqJ+KJtwTs3/p9JaNf+rcUOZ1etHEEJXUrD5OuCIT7X0MZaKhdf4ikwEehULKMwVHpHQ4IedhJF/tn2ykNcEmM7k+ZaoLcy5nJsClflwQVq5y3Tohrb066K3YQvZMzNHTm19HLSL9OWqvuuRf5M7CoYRHoj/2AD1hkR81leQss3UsSulwknWkwA9YRGu81AlRWcIc5ke4ne2QiiuQzpA==; 31:T2+Zzh7uwdY51Ec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zWQb7p60Ieeyj/a6w== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(10201501046)(3002001)(3231232)(944501327)(52105095)(93006095)(6055026)(6041310)(20161123562045)(20161123558120)(20161123560045)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061750153)(6072148)(201708071742011); SRVR:SG2PR06MB0982; BCL:0; PCL:0; RULEID:; SRVR:SG2PR06MB0982; X-Forefront-PRVS: 06469BCC91 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(6069001)(39860400002)(346002)(376002)(396003)(366004)(39380400002)(7416002)(956004)(2616005)(6116002)(446003)(3846002)(47776003)(8936002)(97736004)(66066001)(50466002)(4326008)(2906002)(76176011)(42882007)(53936002)(52116002)(6512007)(476003)(107886003)(386003)(11346002)(6506007)(51416003)(59450400001)(36756003)(25786009)(316002)(6666003)(305945005)(16586007)(5660300001)(7736002)(48376002)(78352004)(8676002)(6486002)(50226002)(16526019)(81166006)(39060400002)(498600001)(26005)(3720700003); DIR:OUT; SFP:1102; SCL:1; SRVR:SG2PR06MB0982; H:localhost.localdomain; FPR:; SPF:None; LANG:en; MLV:ovr; PTR:InfoNoRecords; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; SG2PR06MB0982; 23:+r9IWKP+hGbUyWLvOoVnJ1RtE//j0yr7+Z3Zu73ax?= =?us-ascii?Q?c1SVEHz5reWVgqomjRz/8ZCMzxAOoAYN0ADw916yNN1bXrdcTboY763bxJxf?= =?us-ascii?Q?d3+awKRUH1eAwCGSCsWpH5Ya7AxAbSTJh/4jLvx98Dku+LCegopTy8yjbnHW?= =?us-ascii?Q?2pCQY8RcKwOy34f4m5IxtPPXFhC8J+r5FOhtbpxGDb913AbiB0uM/O8HVP/3?= =?us-ascii?Q?m1nvgeWiOb4SAEvW22YsJ6B5stOiZYo2mb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X2qmntqUWj36r8= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; SG2PR06MB0982; 7:Tp99WQ2i/4m0isvUK5jReCGfG654xElZREOVeMAGfl+kXt44vzdS24mzW4s7sSZerKDpjTTtt2b5pSLDvE4Cr0sGBNBxG3c5ICOdClZEW23gFljv9/FiS6fIzAZkMFpK5XCUgKB/Xi188xr29aJr070XYBqD+Hjt9IXKtdltUuHCmQ81IvI4RPsA3bK/vD63ajTO7MGSIguYQhIoP5TM8B9+sAncgdBeKtOI6sai4ouc+CojHYtR/MemX0+feG43; 20:r0+40DU+tkW+CWvLdbrENmo9tonCYLOyS836fH+AmPTbPtJNrimrEWRBrTxuu0S0vfOToAvjj+Qbu48VGY1t7pWgmbmkMnxJEcsOH5NGdP1mozuLqMLH3wnqtBllUo6bS3kkKx2rslvDRMlG/5I1ya2UdldYqgzyz++yUAOw42Y= X-MS-Office365-Filtering-Correlation-Id: b613361c-588e-4f08-5838-08d5a503dec4 X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Apr 2018 08:10:37.1031 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b613361c-588e-4f08-5838-08d5a503dec4 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 53d82571-da19-47e4-9cb4-625a166a4a2a X-MS-Exchange-Transport-CrossTenantHeadersStamped: SG2PR06MB0982 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 THis patch adds a condition in __switch_match() to allow if the parent dev_name matches. Otherwise, OF environment cannot match the usb role switch devices because the usb role switch framework adds the names of a new child device as the parent dev_name with "-role-switch". Signed-off-by: Yoshihiro Shimoda --- drivers/usb/common/roles.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/usb/common/roles.c b/drivers/usb/common/roles.c index cc1c55a..381259c 100644 --- a/drivers/usb/common/roles.c +++ b/drivers/usb/common/roles.c @@ -88,7 +88,13 @@ enum usb_role usb_role_switch_get_role(struct usb_role_switch *sw) static int __switch_match(struct device *dev, const void *name) { - return !strcmp((const char *)name, dev_name(dev)); + int ret = !strcmp((const char *)name, dev_name(dev)); + + /* If doesn't match, this also checks the parent dev_name */ + if (!ret && dev->parent) + ret = !strcmp((const char *)name, dev_name(dev->parent)); + + return ret; } static void *usb_role_switch_match(struct device_connection *con, int ep,