From patchwork Tue May 22 12:01:06 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yoshihiro Shimoda X-Patchwork-Id: 10418269 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 29BFC600CC for ; Tue, 22 May 2018 12:02:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 182BD28C49 for ; Tue, 22 May 2018 12:02:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0B48E28C55; Tue, 22 May 2018 12:02:10 +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=unavailable 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 94DEA28C4E for ; Tue, 22 May 2018 12:02:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751461AbeEVMCE (ORCPT ); Tue, 22 May 2018 08:02:04 -0400 Received: from relmlor4.renesas.com ([210.160.252.174]:8871 "EHLO relmlie3.idc.renesas.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751291AbeEVMBy (ORCPT ); Tue, 22 May 2018 08:01:54 -0400 Received: from unknown (HELO relmlir3.idc.renesas.com) ([10.200.68.153]) by relmlie3.idc.renesas.com with ESMTP; 22 May 2018 21:01:50 +0900 Received: from relmlii1.idc.renesas.com (relmlii1.idc.renesas.com [10.200.68.65]) by relmlir3.idc.renesas.com (Postfix) with ESMTP id DED4E79F64; Tue, 22 May 2018 21:01:50 +0900 (JST) X-IronPort-AV: E=Sophos;i="5.49,430,1520866800"; d="scan'208";a="280262386" Received: from mail-ty1jpn01lp0177.outbound.protection.outlook.com (HELO JPN01-TY1-obe.outbound.protection.outlook.com) ([23.103.139.177]) by relmlii1.idc.renesas.com with ESMTP/TLS/AES256-SHA256; 22 May 2018 21:01:50 +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=XfYTM+XI02JlmeTrmFqi7/l9YQZVkFTE06jtXMM7qJM=; b=aRhoo1+sKryo8xNQYpAxb9+ckPVESVYef+MxpVzGHQC81XuAGnslCeFDGLqtItEv1w+Vbe/yAdwYRFdo29oZEcPLb5o/PqpdV1hqB1x5U7c7WaRc1vO+1QXE2QFgmXdgUntW5IYENeGZIIX8POmvZ7Si4zEpaZ2E/tILCv7hQ10= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=<>; Received: from localhost.localdomain (211.11.155.138) by OSBPR01MB2293.jpnprd01.prod.outlook.com (2603:1096:603:26::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.776.11; Tue, 22 May 2018 12:01:48 +0000 From: Yoshihiro Shimoda To: gregkh@linuxfoundation.org, robh+dt@kernel.org, mark.rutland@arm.com Cc: heikki.krogerus@linux.intel.com, hdegoede@redhat.com, andy.shevchenko@gmail.com, linux-usb@vger.kernel.org, linux-renesas-soc@vger.kernel.org, devicetree@vger.kernel.org, Yoshihiro Shimoda Subject: [PATCH/RFC v4 1/4] base: devcon: add graph parse in device_connection_find_match() Date: Tue, 22 May 2018 21:01:06 +0900 Message-Id: <1526990469-20739-2-git-send-email-yoshihiro.shimoda.uh@renesas.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1526990469-20739-1-git-send-email-yoshihiro.shimoda.uh@renesas.com> References: <1526990469-20739-1-git-send-email-yoshihiro.shimoda.uh@renesas.com> MIME-Version: 1.0 X-Originating-IP: [211.11.155.138] X-ClientProxiedBy: TY2PR01CA0016.jpnprd01.prod.outlook.com (2603:1096:404:a::28) To OSBPR01MB2293.jpnprd01.prod.outlook.com (2603:1096:603:26::14) 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:OSBPR01MB2293; X-Microsoft-Exchange-Diagnostics: 1; OSBPR01MB2293; 3:UDFhJ7qGQoI47pr5TCDMCmp4Lm7QFCqGwGUsz65jfHHkQWOVRrfhYDCiCgmHnGV5ymv400o0Dk4566v+gdyr3alG1b8MeRFXZ7LuNcyj0Z7zXJyLj/b52D65At12MjFBdUKRSmWR0gr5T2VNGT9k3Gork6f/383tBm684ByhCpt+lFZ2nWbu5Gr/JRBjs+HODqx7vps8IzME+gIE6OZEVSYqKsSj/qQJ3i+kjtVWbwfVnHA9z4DSb+YY9hzjv5yg; 25:i9K629RgI/wnmLWSe7qD14wQy7Fi2ewuOns/g8nfuaZTDniLin4VxHwb9K5/JSQdZkbHU+y+IMOtv1I2a7Hd63pJMrsI2cfG0sWGlEOlntjf4FA1ZF+zfuxNUS4nZ+NnR36mXjwjJUVFS7NlTA4BpZEc/1abcNN2K+UpcN7DxFY8WG4CuP5CbF9mCZAFoZ+OcEc+Ls8pJMi4aMZgiG9J8iHJmx9y+MwTksQU+uzoF+nrhYhH7zsZSn3LyYyRI9USTjG9l7ORwc7v5AZYaB2dpmMXLLcnofqVSIbhcighn5c0/5mM6ZIQHNPnxd4TOLKnJ61Xjs1Czne+BSSVJkz93Q==; 31:0mHUbCYppp4AEWSojw7ZTPXd76Oy8QeK2fVVlj/iLmkSzZYHV6frMoJtIVXQhNCw0Prw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: UriScan:; X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(10201501046)(3231254)(944501410)(52105095)(93006095)(3002001)(6055026)(149027)(150027)(6041310)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061750153)(20161123562045)(20161123564045)(20161123560045)(6072148)(201708071742011)(7699016); SRVR:OSBPR01MB2293; BCL:0; PCL:0; RULEID:; SRVR:OSBPR01MB2293; X-Forefront-PRVS: 0680FADD48 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(6069001)(39860400002)(346002)(396003)(39380400002)(366004)(376002)(199004)(189003)(16526019)(97736004)(6116002)(3846002)(8936002)(66066001)(7736002)(81166006)(81156014)(36756003)(8676002)(48376002)(78352004)(305945005)(50466002)(316002)(16586007)(50226002)(51416003)(52116002)(498600001)(76176011)(42882007)(5660300001)(59450400001)(6666003)(956004)(11346002)(446003)(2906002)(2616005)(386003)(39060400002)(6506007)(4326008)(476003)(106356001)(68736007)(486006)(25786009)(47776003)(26005)(53936002)(6512007)(107886003)(6486002)(105586002)(3720700003); DIR:OUT; SFP:1102; SCL:1; SRVR:OSBPR01MB2293; 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: =?us-ascii?Q?1; OSBPR01MB2293; 23:VA1FQj1pPSkerF5lt9I9I/9I2HVZm4cK3Xec158v2?= =?us-ascii?Q?NtCBUdAQIYLnX4zRmwne5HTE2+MeIeWD+Y5OzBKCq0yQNOHg//1DdZm1Cw67?= =?us-ascii?Q?0Q7TYSzwO61ZpFaT6qkjMwxe9JacmxgapOMp+GAWYMmQtM4IC02uLsiOZm4I?= =?us-ascii?Q?jByPw+ZXmYk/+gk1QuSVM5lWGfGJzkwYqyTwubw55FFKftu7jqxPYFpU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31m5t4BClDCCy4BVtU7DtXMB21Q49?= =?us-ascii?Q?skv7KP7yWYwQjQY/2fOnk8XB15Uip2XBz4VckqSzWVroXCvohgmB/RHoUgBr?= =?us-ascii?Q?WzCEdlpMYrCRj7x/2C2tGxyrPTuHUSjbLhwXheYCR9IoZ9GAjzWFYKXZek58?= =?us-ascii?Q?+3ZsadUs0KtNC2Vm06SzXdPR7bL9/Z+DcnPydAtsOhN8oU9nGA+BqjVoMI7L?= =?us-ascii?B?QT09?= X-Microsoft-Antispam-Message-Info: GuNQh2/pJFt/Uiqah61xlwnH0FY7OB2KYJhYtiLu3vnISI4uUC7UWzYX5Zaqek67NVm4051kqRvzJNWzFAx6KkcoQyeWHrYnNfBkehmxdcFSqeT22vKzO0Zdj0A8o+SQftCyk+3Xr2WeRVyWH92BXriTu/R31Od9Ohkl7I8QWhsfKpeF9ENyg968b6RBZFri X-Microsoft-Exchange-Diagnostics: 1; OSBPR01MB2293; 6:slaRKJNWceHjbLNr7Cf4Ar1jnYL8OiKgMubrRRwsl3wCn7xHXMumTpjO0W5wONw/eUTAkiHG7c+9kQCmtReexw9x5bGFgLef8fQHAaiW8Lgs1i1XWsTaXUWrnUWWgY4jYhI9HD23IkXJH5J8vCTbQ3S+RntQuMJOD3+NgdFQJUDe/+FJISTmgf+U7zrD2pD9AixU5dQd3b+8puivwZzX6maYZvJnk3x+Esgqd8X/lK1CsCazYdnEOb/ZotWZwl1CLrKw/IxDQ2Yqui0cw5HiOgk1I9dQMSMQXKfHyVTppnK7uM9y2Ps8aF5dzG126t6xmLnvj8k8chYw1ltE0nl3VlptML96qoElylQf6DkvocjQg2msoORBi3vD42P0rbMo6+8CxKPPXc99LzFW4knnJKtPAPJ02wthA/EJOdB5i1QltduDWHPuBLuvI2MtrtOXnBVx8mNEltDrFzOOQkkIPw==; 5:agbipwUY0ceYdqI5DWgalXRycuqeWliP47m8fjlnqVcKiXgitWnXeNJnaGHslNKIa3PtLLzM0dVqhw2x7ZvRDQM86rICLjPB+k1dMV3YyPC02AlcSVGwPNtqR43Z05WfGAFKQvRvi6ykODCXgPRKzUT4ZRcH0MhcgZ/DuOPimwc=; 24:4qJxywlSMDSY4PsN7wOoVx7jVh0E0BmEyYco0uvUuPA3lujS7YhHV3JtiBUuyUjt0k261y8vLQv76KBnfqgdY9rUZCtO7k//EZrPOLXXfLU= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; OSBPR01MB2293; 7:YLzpE0HHsoLthyv/nl6jbwDzzLoJrYGTpWoUGwm/uoeO1ITq38zbYh6fq84m7Wlc1NA4CRs+WRv5LbndNcKE6XzNxaZLHZNeiCNYojjUGJMoWngm8FaZnnfO31B2lC11g3QET1DaJ8kpnNBgxWewu95Da9+t4+rTq6b0cmzO+1tk5McSROYKlooCsZKd+U0eYP9eXHvbrDX/2t9BOtGxQbm+Rr5eNnVzp3vSL1Q3qJxnaa1nXyTzjg46gj/hWjAU; 20:DwIqdkTJe8bHeqfoWBkb5pQUtLVEknHZ1hm8KLGC3BQSYWnx5sh9Ks6t5jmJa1VSKY/qEymbSc6SPyV/Twzo1O3zvuBMIFvItEdohytetTXjC149VTKhZConsDkDV6xNxoHFG7HrrQB1/ZOpPuqUC29MPed4SKPKU2sz/PRZx4I= X-MS-Office365-Filtering-Correlation-Id: 1ffac0fe-6e93-45e0-c18d-08d5bfdbcbed X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 May 2018 12:01:48.0861 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 1ffac0fe-6e93-45e0-c18d-08d5bfdbcbed X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 53d82571-da19-47e4-9cb4-625a166a4a2a X-MS-Exchange-Transport-CrossTenantHeadersStamped: OSBPR01MB2293 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 graph parsing in device_connection_find_match(). The match function will be called with fwnode pointer in struct device_connection. So, a caller can check the matching by using it. Signed-off-by: Yoshihiro Shimoda --- Documentation/driver-api/device_connection.rst | 2 +- drivers/base/devcon.c | 15 +++++++++++++++ include/linux/device.h | 2 ++ 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/Documentation/driver-api/device_connection.rst b/Documentation/driver-api/device_connection.rst index affbc556..cc6b1da 100644 --- a/Documentation/driver-api/device_connection.rst +++ b/Documentation/driver-api/device_connection.rst @@ -19,7 +19,7 @@ Device connections alone do not create a dependency between the two devices. They are only descriptions which are not tied to either of the devices directly. A dependency between the two devices exists only if one of the two endpoint devices requests a reference to the other. The descriptions themselves can be -defined in firmware (not yet supported) or they can be built-in. +defined in firmware or they can be built-in. Usage ----- diff --git a/drivers/base/devcon.c b/drivers/base/devcon.c index d427e80..374bb39 100644 --- a/drivers/base/devcon.c +++ b/drivers/base/devcon.c @@ -7,6 +7,7 @@ */ #include +#include static DEFINE_MUTEX(devcon_lock); static LIST_HEAD(devcon_list); @@ -31,10 +32,24 @@ void *device_connection_find_match(struct device *dev, const char *con_id, struct device_connection *con; void *ret = NULL; int ep; + struct device_connection graph; + struct fwnode_handle *fwnode_ep; + struct fwnode_handle *remote; if (!match) return NULL; + fwnode_graph_for_each_endpoint(dev->fwnode, fwnode_ep) { + remote = fwnode_graph_get_remote_port_parent(fwnode_ep); + if (!remote) + continue; + + graph.fwnode = remote; + ret = match(&graph, 0, data); + if (!IS_ERR(ret)) + return ret; + } + mutex_lock(&devcon_lock); list_for_each_entry(con, &devcon_list, list) { diff --git a/include/linux/device.h b/include/linux/device.h index 0059b99..175907b 100644 --- a/include/linux/device.h +++ b/include/linux/device.h @@ -734,11 +734,13 @@ struct device_dma_parameters { * struct device_connection - Device Connection Descriptor * @endpoint: The names of the two devices connected together * @id: Unique identifier for the connection + * @fwnode: fwnode pointer for finding a connection from graph * @list: List head, private, for internal use only */ struct device_connection { const char *endpoint[2]; const char *id; + struct fwnode_handle *fwnode; struct list_head list; };