From patchwork Sat Feb 22 10:27:09 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Boris Brezillon X-Patchwork-Id: 11398057 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1165E1892 for ; Sat, 22 Feb 2020 10:27:30 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id DCC16208C4 for ; Sat, 22 Feb 2020 10:27:29 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="QnZwW05n" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DCC16208C4 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=collabora.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-i3c-bounces+linux-i3c=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=m+EOGdCfPIuE0Scwi8PpXWy+CaK7H6nggobiA5FP1OQ=; b=QnZwW05n43c0tC zoiZAl5g70TAYGTpU258n33b+TSKUp20em2sNp3oCDAry3bmMwy+zmR/hjAuvVTsEaYtnyKztBW9j /NvJe8L0cy9gs1SVUyN3aIlJHkXUM75zUrGzmkP7RFy41rD4z2N85Jsz8GzG6rKTPK7qIUnvDOKtE 7X1G2CPNjgVz2R9dF3C+cSWq6eKmHAMN4H2OlIfFVVTDcMQIx9eeXlZpn2Pr7f0edKZfUS2bTIqj9 WIkt906F41d1HTXH6TkRVj81+3XqEQPQnZN4hs9CC1Y4nOs/v3XQ3KvMOHl2Ft8HZdVy7hSji+B/B PqTJItaIBACgEhRKNVWQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1j5S0O-00061r-KB; Sat, 22 Feb 2020 10:27:28 +0000 Received: from bhuna.collabora.co.uk ([2a00:1098:0:82:1000:25:2eeb:e3e3]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1j5S0K-000609-Og for linux-i3c@lists.infradead.org; Sat, 22 Feb 2020 10:27:26 +0000 Received: from localhost.localdomain (unknown [IPv6:2a01:e0a:2c:6930:b93f:9fae:b276:a89a]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: bbrezillon) by bhuna.collabora.co.uk (Postfix) with ESMTPSA id 9C0FC2963B4; Sat, 22 Feb 2020 10:27:20 +0000 (GMT) From: Boris Brezillon To: Boris Brezillon , =?utf-8?q?Przemys=C5=82aw_Gaj?= , Vitor Soares , linux-i3c@lists.infradead.org Subject: [PATCH 1/3] i3c: Fix MODALIAS uevents Date: Sat, 22 Feb 2020 11:27:09 +0100 Message-Id: <20200222102711.1352006-2-boris.brezillon@collabora.com> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200222102711.1352006-1-boris.brezillon@collabora.com> References: <20200222102711.1352006-1-boris.brezillon@collabora.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200222_022724_938018_9D50C617 X-CRM114-Status: GOOD ( 10.10 ) X-Spam-Score: -0.0 (/) X-Spam-Report: SpamAssassin version 3.4.3 on bombadil.infradead.org summary: Content analysis details: (-0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.0 SPF_PASS SPF: sender matches SPF record X-BeenThere: linux-i3c@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux I3C List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Boris Brezillon , linux-kernel@vger.kernel.org Sender: "linux-i3c" Errors-To: linux-i3c-bounces+linux-i3c=patchwork.kernel.org@lists.infradead.org file2alias uses %X formatters. Fix typos in the MODALIAS uevent to print the part and ext IDs in uppercase. Signed-off-by: Boris Brezillon --- drivers/i3c/master.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/i3c/master.c b/drivers/i3c/master.c index b56207bbed2b..b6db82862a63 100644 --- a/drivers/i3c/master.c +++ b/drivers/i3c/master.c @@ -267,7 +267,7 @@ static int i3c_device_uevent(struct device *dev, struct kobj_uevent_env *env) devinfo.dcr, manuf); return add_uevent_var(env, - "MODALIAS=i3c:dcr%02Xmanuf%04Xpart%04xext%04x", + "MODALIAS=i3c:dcr%02Xmanuf%04Xpart%04Xext%04X", devinfo.dcr, manuf, part, ext); } From patchwork Sat Feb 22 10:27:10 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Boris Brezillon X-Patchwork-Id: 11398063 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C2E6D17F0 for ; Sat, 22 Feb 2020 10:27:30 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A19B92071E for ; Sat, 22 Feb 2020 10:27:30 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="tILWJpOs" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A19B92071E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=collabora.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-i3c-bounces+linux-i3c=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=3OmGo/tDXSbDWb5MUd+LdYQgL9WbSiv9chuIdB6m+c0=; b=tILWJpOsbIsLgb 9dO7x8zewt8Ofphb6libpKiMfhjlF3xIBYI3TXvbGEsGgkDVEUcOlHnkenwWFuylVybtrzHNSieOg k4tY1Ez6ihfHYjUvD1kLSZgYeZodWq3tS0UGdtZZpGzK2ZC8TBJKZIB6yJiduHp7IxfmlEV1TPyAw yg9gHaStYgz+9W6RB+htzMwCqk2gQ3b/ZRyMcxWmlRxbGjQ6DczuYzeAPcLO6d5gc7onI2vwtIDY8 5yEjHoYikdmtou/DXNni3iV6b6lTEXmPij99e3ccEyQI3s0uypc0zwE8CI90dd2VtbvQCuW8hMg46 YMNXkU24fh2L3QJeP6dg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1j5S0P-00063G-QZ; Sat, 22 Feb 2020 10:27:29 +0000 Received: from bhuna.collabora.co.uk ([46.235.227.227]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1j5S0N-00060A-6I for linux-i3c@lists.infradead.org; Sat, 22 Feb 2020 10:27:28 +0000 Received: from localhost.localdomain (unknown [IPv6:2a01:e0a:2c:6930:b93f:9fae:b276:a89a]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: bbrezillon) by bhuna.collabora.co.uk (Postfix) with ESMTPSA id D05502912E5; Sat, 22 Feb 2020 10:27:20 +0000 (GMT) From: Boris Brezillon To: Boris Brezillon , =?utf-8?q?Przemys=C5=82aw_Gaj?= , Vitor Soares , linux-i3c@lists.infradead.org Subject: [PATCH 2/3] i3c: Generate aliases for i3c modules Date: Sat, 22 Feb 2020 11:27:10 +0100 Message-Id: <20200222102711.1352006-3-boris.brezillon@collabora.com> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200222102711.1352006-1-boris.brezillon@collabora.com> References: <20200222102711.1352006-1-boris.brezillon@collabora.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200222_022727_363693_97E51FF8 X-CRM114-Status: UNSURE ( 8.99 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -0.0 (/) X-Spam-Report: SpamAssassin version 3.4.3 on bombadil.infradead.org summary: Content analysis details: (-0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.0 SPF_PASS SPF: sender matches SPF record -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [46.235.227.227 listed in list.dnswl.org] X-BeenThere: linux-i3c@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux I3C List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Boris Brezillon , linux-kernel@vger.kernel.org Sender: "linux-i3c" Errors-To: linux-i3c-bounces+linux-i3c=patchwork.kernel.org@lists.infradead.org This part was missing, thus preventing user space from loading modules automatically when MODALIAS uevents are received. Signed-off-by: Boris Brezillon --- scripts/mod/devicetable-offsets.c | 7 +++++++ scripts/mod/file2alias.c | 19 +++++++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/scripts/mod/devicetable-offsets.c b/scripts/mod/devicetable-offsets.c index 054405b90ba4..d3c237b9b7c0 100644 --- a/scripts/mod/devicetable-offsets.c +++ b/scripts/mod/devicetable-offsets.c @@ -145,6 +145,13 @@ int main(void) DEVID(i2c_device_id); DEVID_FIELD(i2c_device_id, name); + DEVID(i3c_device_id); + DEVID_FIELD(i3c_device_id, match_flags); + DEVID_FIELD(i3c_device_id, dcr); + DEVID_FIELD(i3c_device_id, manuf_id); + DEVID_FIELD(i3c_device_id, part_id); + DEVID_FIELD(i3c_device_id, extra_info); + DEVID(spi_device_id); DEVID_FIELD(spi_device_id, name); diff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c index c91eba751804..1754de3f119f 100644 --- a/scripts/mod/file2alias.c +++ b/scripts/mod/file2alias.c @@ -919,6 +919,24 @@ static int do_i2c_entry(const char *filename, void *symval, return 1; } +static int do_i3c_entry(const char *filename, void *symval, + char *alias) +{ + DEF_FIELD(symval, i3c_device_id, match_flags); + DEF_FIELD(symval, i3c_device_id, dcr); + DEF_FIELD(symval, i3c_device_id, manuf_id); + DEF_FIELD(symval, i3c_device_id, part_id); + DEF_FIELD(symval, i3c_device_id, extra_info); + + strcpy(alias, "i3c:"); + ADD(alias, "dcr", match_flags & I3C_MATCH_DCR, dcr); + ADD(alias, "manuf", match_flags & I3C_MATCH_MANUF, dcr); + ADD(alias, "part", match_flags & I3C_MATCH_PART, dcr); + ADD(alias, "ext", match_flags & I3C_MATCH_EXTRA_INFO, dcr); + + return 1; +} + /* Looks like: spi:S */ static int do_spi_entry(const char *filename, void *symval, char *alias) @@ -1386,6 +1404,7 @@ static const struct devtable devtable[] = { {"vmbus", SIZE_hv_vmbus_device_id, do_vmbus_entry}, {"rpmsg", SIZE_rpmsg_device_id, do_rpmsg_entry}, {"i2c", SIZE_i2c_device_id, do_i2c_entry}, + {"i3c", SIZE_i3c_device_id, do_i3c_entry}, {"spi", SIZE_spi_device_id, do_spi_entry}, {"dmi", SIZE_dmi_system_id, do_dmi_entry}, {"platform", SIZE_platform_device_id, do_platform_entry}, From patchwork Sat Feb 22 10:27:11 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Boris Brezillon X-Patchwork-Id: 11398061 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1683F92A for ; Sat, 22 Feb 2020 10:27:30 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E979D214DB for ; Sat, 22 Feb 2020 10:27:29 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="tTa3fndv" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E979D214DB Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=collabora.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-i3c-bounces+linux-i3c=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=BraFyJa0PhTG/9YfQtd8N0siWg6y46QRjnqa4NsrXXQ=; b=tTa3fndv6nr7i5 E0vwM4rIgXd1WZsy9TQEQ5rHUO9I50vITWXaPsAIF2+LWau4TGeRgioQvnimdVLoj8/tQ+QO5NI2p K1FG1wp68KgpGwhA9zWvbvmEH5yISivcTDwJLLJ5zkQR+quc0HLjsbd0ZVtbh3+ebdgVcidkBET04 HSyzm+woGY40I5XCRA6txaOANpdSdMXehpEq/pX8NBUJd5399XFy55pjxQoE2l3ts1SudpWy6QURR /uDio2EfRykHXpAATyrMhqPtHXdX+ykKUWCx89xueN4rcm0ONRZHPDlH1ASLCLt37dkpB/unukNvT up7y6f8LvSmmN7oB0WoA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1j5S0O-00062b-NU; Sat, 22 Feb 2020 10:27:28 +0000 Received: from bhuna.collabora.co.uk ([2a00:1098:0:82:1000:25:2eeb:e3e3]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1j5S0K-00060B-Of for linux-i3c@lists.infradead.org; Sat, 22 Feb 2020 10:27:27 +0000 Received: from localhost.localdomain (unknown [IPv6:2a01:e0a:2c:6930:b93f:9fae:b276:a89a]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: bbrezillon) by bhuna.collabora.co.uk (Postfix) with ESMTPSA id 11BC72912ED; Sat, 22 Feb 2020 10:27:21 +0000 (GMT) From: Boris Brezillon To: Boris Brezillon , =?utf-8?q?Przemys=C5=82aw_Gaj?= , Vitor Soares , linux-i3c@lists.infradead.org Subject: [PATCH 3/3] i3c: Simplify i3c_device_match_id() Date: Sat, 22 Feb 2020 11:27:11 +0100 Message-Id: <20200222102711.1352006-4-boris.brezillon@collabora.com> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200222102711.1352006-1-boris.brezillon@collabora.com> References: <20200222102711.1352006-1-boris.brezillon@collabora.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200222_022724_938903_DB2D1FD0 X-CRM114-Status: GOOD ( 10.93 ) X-Spam-Score: -0.0 (/) X-Spam-Report: SpamAssassin version 3.4.3 on bombadil.infradead.org summary: Content analysis details: (-0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.0 SPF_PASS SPF: sender matches SPF record X-BeenThere: linux-i3c@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux I3C List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Boris Brezillon , linux-kernel@vger.kernel.org Sender: "linux-i3c" Errors-To: linux-i3c-bounces+linux-i3c=patchwork.kernel.org@lists.infradead.org Simply match against ->match_flags instead of trying to be smart and fix drivers inconsistent ID tables. Signed-off-by: Boris Brezillon --- drivers/i3c/device.c | 50 +++++++++++++++++++------------------------- 1 file changed, 22 insertions(+), 28 deletions(-) diff --git a/drivers/i3c/device.c b/drivers/i3c/device.c index 9e2e1406f85e..bb8e60dff988 100644 --- a/drivers/i3c/device.c +++ b/drivers/i3c/device.c @@ -213,40 +213,34 @@ i3c_device_match_id(struct i3c_device *i3cdev, { struct i3c_device_info devinfo; const struct i3c_device_id *id; + u16 manuf, part, ext_info; + bool rndpid; i3c_device_get_info(i3cdev, &devinfo); - /* - * The lower 32bits of the provisional ID is just filled with a random - * value, try to match using DCR info. - */ - if (!I3C_PID_RND_LOWER_32BITS(devinfo.pid)) { - u16 manuf = I3C_PID_MANUF_ID(devinfo.pid); - u16 part = I3C_PID_PART_ID(devinfo.pid); - u16 ext_info = I3C_PID_EXTRA_INFO(devinfo.pid); - - /* First try to match by manufacturer/part ID. */ - for (id = id_table; id->match_flags != 0; id++) { - if ((id->match_flags & I3C_MATCH_MANUF_AND_PART) != - I3C_MATCH_MANUF_AND_PART) - continue; - - if (manuf != id->manuf_id || part != id->part_id) - continue; - - if ((id->match_flags & I3C_MATCH_EXTRA_INFO) && - ext_info != id->extra_info) - continue; - - return id; - } - } + manuf = I3C_PID_MANUF_ID(devinfo.pid); + part = I3C_PID_PART_ID(devinfo.pid); + ext_info = I3C_PID_EXTRA_INFO(devinfo.pid); + rndpid = I3C_PID_RND_LOWER_32BITS(devinfo.pid); - /* Fallback to DCR match. */ for (id = id_table; id->match_flags != 0; id++) { if ((id->match_flags & I3C_MATCH_DCR) && - id->dcr == devinfo.dcr) - return id; + id->dcr != devinfo.dcr) + continue; + + if ((id->match_flags & I3C_MATCH_MANUF) && + id->manuf_id != manuf) + continue; + + if ((id->match_flags & I3C_MATCH_PART) && + (rndpid || id->part_id != part)) + continue; + + if ((id->match_flags & I3C_MATCH_EXTRA_INFO) && + (rndpid || id->extra_info != ext_info)) + continue; + + return id; } return NULL;