From patchwork Thu Nov 9 18:19:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 163539 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b129:0:b0:403:3b70:6f57 with SMTP id q9csp625447vqs; Thu, 9 Nov 2023 10:29:18 -0800 (PST) X-Google-Smtp-Source: AGHT+IGAEJ4zC8Ayton7tmLcq1QIvcFRPmmM89Y6WEIAZgm/o+HDZLx3hYJog7b5mnIvUoZ3wioe X-Received: by 2002:a17:90b:4d09:b0:282:ec92:3751 with SMTP id mw9-20020a17090b4d0900b00282ec923751mr2145944pjb.0.1699554558040; Thu, 09 Nov 2023 10:29:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699554558; cv=none; d=google.com; s=arc-20160816; b=06tTI9Tbk1k51xdUDg/WOUjZ59LNOx7EippARWJXouAPEVrkds4TGLLsJ4wQYLuEpU +HkWzQkZpYWXpoH1F/hCInC6ZpTr+9wZEAiFNsR6h8jepjBCdwtDon1vlSdp9PkeONyb uEEMR/9jerdoVcRgoFgWqwkwYu5vlFxq6z/klTgEOwRLQqqGru+lHsKUZmxErXTd5bsf Nw06DK5vGuYE4ljMSYvOujg+Gtvpe2lB+FkgSQDeNQiI+xvwYVDTxYpmdEjYIkN11NLI omFJp0Fir1mhvNKvOpvO5T0Ae4QDhLiTaEuZ0jJdWVPIZZ59icreQHHTD1K96uRa4ZcY qmVg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=zZcymYmLxn17iCsNMYV92HWMTzBrJynkeGjv/oDXeiI=; fh=mq6/FMGJdqTI0UuZRoAMccy9L/KbJAT6TPJFW+BrH4Y=; b=TSi3/j93e+Ar8wScPE+jEw2WR2K/UtHDWfS63VizYqxLMuWbdlmMxPZgDrsVICMsNb tf8YUk3r/gzp4CxPdmGoLe9L5+KsIs6Z/Jmvu+VNuozwOKSOKXQoU/FPDLlZ59sW5BRI uU4TrIbeQ1gXmGpVXRGHsTHmp+6GWO0QIgk5+9xC8U8JrINIRvRkHV3QVxaBz90jxIOZ p5HA3nftZw976AIvD1/doC2ZrN7tZlQ1Y+P/zKlBxypaCro/8AYb5jW4K+eHoJrTFOK1 z7JMyBGk2wqgz5xk7Rm9el4Flu3QtjqJX6pb7Hlx2ZgLFsrHlywU/S6UXdb2phypfC9m WKJw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=kZLgWGs9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id 15-20020a17090a030f00b0027d61342674si2223918pje.70.2023.11.09.10.29.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Nov 2023 10:29:18 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=kZLgWGs9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 120B783C38F1; Thu, 9 Nov 2023 10:29:03 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345001AbjKIS2k (ORCPT + 31 others); Thu, 9 Nov 2023 13:28:40 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33332 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344938AbjKIS2j (ORCPT ); Thu, 9 Nov 2023 13:28:39 -0500 Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.126]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BAEE53C04; Thu, 9 Nov 2023 10:28:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1699554516; x=1731090516; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=ch0lC4UnRy1QhfAy373rOTcUXFIZuCfpMxMzn+asH0A=; b=kZLgWGs9KES7mVnD70pmd8EGvOOLRjSTMfhz0w6gl04JPZeBS5LZxKKE L2Y2Ei0SW31C4RcDUt21qAjl8S9Z/llVNR+iM9WailHoXhafpV8MqHbgL HubSNnlsIbB+5nUYn4ddLRg/G1USVXSf1x46Mg3IPTOwUiQmY0BP7ecb6 SI2ex5bH7yOsXP+9qfORFdpgRuS56xTWz94NhLEg0C3ULh8oIfQXQ13rz JVsRoMPy3k5fSSCwG1W2C/LipOWi9t8YE/puAOzD3bnkbV4WpSVCHKNgk KBRhi7R6TtUYex7T0mYh8SycI1uTWXNUsicfJSsjp5siqj1yOxyBBFCd4 g==; X-IronPort-AV: E=McAfee;i="6600,9927,10889"; a="375088660" X-IronPort-AV: E=Sophos;i="6.03,290,1694761200"; d="scan'208";a="375088660" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Nov 2023 10:28:36 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10889"; a="767086813" X-IronPort-AV: E=Sophos;i="6.03,290,1694761200"; d="scan'208";a="767086813" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga007.fm.intel.com with ESMTP; 09 Nov 2023 10:28:33 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id 51A3E35A; Thu, 9 Nov 2023 20:28:32 +0200 (EET) From: Andy Shevchenko To: Jarkko Nikula , Herbert Xu , Mario Limonciello , Andy Shevchenko , Wolfram Sang , linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Mika Westerberg , Jan Dabros , Andi Shyti , Hans de Goede Subject: [PATCH v2 01/12] i2c: designware: Replace MODULE_ALIAS() with MODULE_DEVICE_TABLE() Date: Thu, 9 Nov 2023 20:19:11 +0200 Message-ID: <20231109182823.3531846-2-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.40.0.1996.gbec44491f096 In-Reply-To: <20231109182823.3531846-1-andriy.shevchenko@linux.intel.com> References: <20231109182823.3531846-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Thu, 09 Nov 2023 10:29:03 -0800 (PST) X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1782112120577973682 X-GMAIL-MSGID: 1782112120577973682 As Krzysztof Kozlowski pointed out the better is to use MODULE_DEVICE_TABLE() as it will be consistent with the content of the real ID table of the platform devices. While at it, drop unneeded and unused module alias in PCI glue driver as PCI already has its own ID table and automatic loading should just work. Signed-off-by: Andy Shevchenko Reviewed-by: Andi Shyti --- drivers/i2c/busses/i2c-designware-pcidrv.c | 2 -- drivers/i2c/busses/i2c-designware-platdrv.c | 8 ++++++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/i2c/busses/i2c-designware-pcidrv.c b/drivers/i2c/busses/i2c-designware-pcidrv.c index 61d7a27aa070..bfafebecf680 100644 --- a/drivers/i2c/busses/i2c-designware-pcidrv.c +++ b/drivers/i2c/busses/i2c-designware-pcidrv.c @@ -424,8 +424,6 @@ static struct pci_driver dw_i2c_driver = { }; module_pci_driver(dw_i2c_driver); -/* Work with hotplug and coldplug */ -MODULE_ALIAS("i2c_designware-pci"); MODULE_AUTHOR("Baruch Siach "); MODULE_DESCRIPTION("Synopsys DesignWare PCI I2C bus adapter"); MODULE_LICENSE("GPL"); diff --git a/drivers/i2c/busses/i2c-designware-platdrv.c b/drivers/i2c/busses/i2c-designware-platdrv.c index 855b698e99c0..cb7796b57085 100644 --- a/drivers/i2c/busses/i2c-designware-platdrv.c +++ b/drivers/i2c/busses/i2c-designware-platdrv.c @@ -479,8 +479,11 @@ static const struct dev_pm_ops dw_i2c_dev_pm_ops = { RUNTIME_PM_OPS(dw_i2c_plat_runtime_suspend, dw_i2c_plat_runtime_resume, NULL) }; -/* Work with hotplug and coldplug */ -MODULE_ALIAS("platform:i2c_designware"); +static const struct platform_device_id dw_i2c_platform_ids[] = { + { "i2c_designware" }, + {} +}; +MODULE_DEVICE_TABLE(platform, dw_i2c_platform_ids); static struct platform_driver dw_i2c_driver = { .probe = dw_i2c_plat_probe, @@ -491,6 +494,7 @@ static struct platform_driver dw_i2c_driver = { .acpi_match_table = ACPI_PTR(dw_i2c_acpi_match), .pm = pm_ptr(&dw_i2c_dev_pm_ops), }, + .id_table = dw_i2c_platform_ids, }; static int __init dw_i2c_init_driver(void) From patchwork Thu Nov 9 18:19:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 163538 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b129:0:b0:403:3b70:6f57 with SMTP id q9csp625314vqs; Thu, 9 Nov 2023 10:29:04 -0800 (PST) X-Google-Smtp-Source: AGHT+IF8HapCKR6+y2EQFzRV8507P3gmq5v72WehIPGOZxtczXg3i8Q3ZoH9z2msvdE7IMtaLkQn X-Received: by 2002:a9d:61d0:0:b0:6b8:807b:b50 with SMTP id h16-20020a9d61d0000000b006b8807b0b50mr5615399otk.22.1699554544464; Thu, 09 Nov 2023 10:29:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699554544; cv=none; d=google.com; s=arc-20160816; b=rLYICq67UzUjJup3wao7RBQIiRiDD6ewHmz8yNWc+ELu748DN06YmPanAvZeJPhPg4 l/6DMgArBqmBWyuIVnAEOGu4YUmUgWOv9zCmJlrJ/M7bwN8SXRiWfTMqrk8QuJmIekN/ D+tw1PqCXuUm/i+1r/1Ah/5M/NvHvIeyUXm4H+qb8bczIjcml30gfPCwMGIFC2V6Wl2c 8KqYPElWpVtXc3enYdSNJWVX6aKbd+f+sheasGGLtFGMyvFQPKj0OVR5/ve7COjjsfXs jSSgswjUn5vjQL9uXm99s9mGBzP4a6cQnB1ldD74uIldLuddQn0fcvkiFEawYfMjSFkS hixw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=yHD7unkrISW1gYAHduLeqmzsQ/KrBYrbNAU9MX6ul4g=; fh=mq6/FMGJdqTI0UuZRoAMccy9L/KbJAT6TPJFW+BrH4Y=; b=jse5DgMUDfSWfh3A7ZR1jnbsnQIXCmN8lmG4QrRsE7B4lxbpeqeKx1oiyYNz92+F7M /vPEdcmT/P3FPq45fXIBpchZcFzn68KlcjvxMHxHrKqbRd1c6pjzh2pW4gN2+yH8uwl3 5nmeJkfyFQ6CgYqqu+s2C+nMNDAYDHkq3Iu94YKthSFhI7yBA7sZtVAjT63HuIRZPDos 25ZassQACQ/d2BNperl3SfAK2rFiSiY9h0QewtUsiSVYbt1VLCA6ry45/JCSZrDSZ2IR h5B5enirk2b+7d5mA53wzrZOPz4cAPYDBD9quR+RnZYbeH2FVOGtF+16qKTO9Jy8MUC+ daxw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="PHPWAC/5"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id k190-20020a636fc7000000b005ac61b76914si7826648pgc.93.2023.11.09.10.29.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Nov 2023 10:29:04 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="PHPWAC/5"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 5A0C581C77A4; Thu, 9 Nov 2023 10:28:55 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345010AbjKIS2l (ORCPT + 31 others); Thu, 9 Nov 2023 13:28:41 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33338 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344978AbjKIS2j (ORCPT ); Thu, 9 Nov 2023 13:28:39 -0500 Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.115]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CF6F93C05; Thu, 9 Nov 2023 10:28:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1699554516; x=1731090516; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=nsu6XeaiAM+ewQpg64HUre5R+9unzyXbgg5xDRI4JQ0=; b=PHPWAC/5sCmwZPCR7rCnQwpoIp514Ww0k91EDALNpNg/0P+rJtpKhzaL ak32pBUMzE6RnHk9qOLXJSfQc3qyJO3LHJPx8ffFzBKCWq7fz0u0Ebl7q STouDRR1zf7Bx1V6CUFvPud4tPhyoirEo3a7wMUPLYpb1Pd2JnDL+NbPJ WYJj4VLPpErKdgSDtqH+0Ui+pe8VJpZxA2MElgYh5y1wiJNjX5h6Gfqrx +4yRhgaXnIP2Fuff3u9gU5uBi0NfUJZJd//KL5VKxx+d4LV4CB7x0A5jB rjHwTC8ItfmevzhAiBZi9m2JYkIQKbqMN8ZQ9bl02G/6qsvz0gDB320Lu Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10889"; a="389853901" X-IronPort-AV: E=Sophos;i="6.03,290,1694761200"; d="scan'208";a="389853901" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Nov 2023 10:28:36 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10889"; a="936938973" X-IronPort-AV: E=Sophos;i="6.03,290,1694761200"; d="scan'208";a="936938973" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga005.jf.intel.com with ESMTP; 09 Nov 2023 10:28:33 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id 5CE3972F; Thu, 9 Nov 2023 20:28:32 +0200 (EET) From: Andy Shevchenko To: Jarkko Nikula , Herbert Xu , Mario Limonciello , Andy Shevchenko , Wolfram Sang , linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Mika Westerberg , Jan Dabros , Andi Shyti , Hans de Goede Subject: [PATCH v2 02/12] i2c: designware: Always provide device ID tables Date: Thu, 9 Nov 2023 20:19:12 +0200 Message-ID: <20231109182823.3531846-3-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.40.0.1996.gbec44491f096 In-Reply-To: <20231109182823.3531846-1-andriy.shevchenko@linux.intel.com> References: <20231109182823.3531846-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Thu, 09 Nov 2023 10:28:55 -0800 (PST) X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1782112105798846732 X-GMAIL-MSGID: 1782112105798846732 There is no need to have ugly ifdeffery and additional macros for the device ID tables. Always provide them. Since we touch the ACPI table, make it sorted by ID. Unify termination as well. Reviewed-by: Andi Shyti Reviewed-by: Mario Limonciello Acked-by: Jarkko Nikula Signed-off-by: Andy Shevchenko --- drivers/i2c/busses/i2c-designware-platdrv.c | 62 ++++++++++----------- 1 file changed, 30 insertions(+), 32 deletions(-) diff --git a/drivers/i2c/busses/i2c-designware-platdrv.c b/drivers/i2c/busses/i2c-designware-platdrv.c index cb7796b57085..7d960d3161c0 100644 --- a/drivers/i2c/busses/i2c-designware-platdrv.c +++ b/drivers/i2c/busses/i2c-designware-platdrv.c @@ -40,28 +40,6 @@ static u32 i2c_dw_get_clk_rate_khz(struct dw_i2c_dev *dev) return clk_get_rate(dev->clk) / KILO; } -#ifdef CONFIG_ACPI -static const struct acpi_device_id dw_i2c_acpi_match[] = { - { "INT33C2", 0 }, - { "INT33C3", 0 }, - { "INT3432", 0 }, - { "INT3433", 0 }, - { "80860F41", ACCESS_NO_IRQ_SUSPEND }, - { "808622C1", ACCESS_NO_IRQ_SUSPEND }, - { "AMD0010", ACCESS_INTR_MASK }, - { "AMDI0010", ACCESS_INTR_MASK }, - { "AMDI0019", ACCESS_INTR_MASK | ARBITRATION_SEMAPHORE }, - { "AMDI0510", 0 }, - { "APMC0D0F", 0 }, - { "HISI02A1", 0 }, - { "HISI02A2", 0 }, - { "HISI02A3", 0 }, - { "HYGO0010", ACCESS_INTR_MASK }, - { } -}; -MODULE_DEVICE_TABLE(acpi, dw_i2c_acpi_match); -#endif - #ifdef CONFIG_OF #define BT1_I2C_CTL 0x100 #define BT1_I2C_CTL_ADDR_MASK GENMASK(7, 0) @@ -148,14 +126,6 @@ static int dw_i2c_of_configure(struct platform_device *pdev) return 0; } - -static const struct of_device_id dw_i2c_of_match[] = { - { .compatible = "snps,designware-i2c", }, - { .compatible = "mscc,ocelot-i2c", .data = (void *)MODEL_MSCC_OCELOT }, - { .compatible = "baikal,bt1-sys-i2c", .data = (void *)MODEL_BAIKAL_BT1 }, - {}, -}; -MODULE_DEVICE_TABLE(of, dw_i2c_of_match); #else static int bt1_i2c_request_regs(struct dw_i2c_dev *dev) { @@ -479,6 +449,34 @@ static const struct dev_pm_ops dw_i2c_dev_pm_ops = { RUNTIME_PM_OPS(dw_i2c_plat_runtime_suspend, dw_i2c_plat_runtime_resume, NULL) }; +static const struct of_device_id dw_i2c_of_match[] = { + { .compatible = "snps,designware-i2c", }, + { .compatible = "mscc,ocelot-i2c", .data = (void *)MODEL_MSCC_OCELOT }, + { .compatible = "baikal,bt1-sys-i2c", .data = (void *)MODEL_BAIKAL_BT1 }, + {} +}; +MODULE_DEVICE_TABLE(of, dw_i2c_of_match); + +static const struct acpi_device_id dw_i2c_acpi_match[] = { + { "INT33C2", 0 }, + { "INT33C3", 0 }, + { "INT3432", 0 }, + { "INT3433", 0 }, + { "80860F41", ACCESS_NO_IRQ_SUSPEND }, + { "808622C1", ACCESS_NO_IRQ_SUSPEND }, + { "AMD0010", ACCESS_INTR_MASK }, + { "AMDI0010", ACCESS_INTR_MASK }, + { "AMDI0019", ACCESS_INTR_MASK | ARBITRATION_SEMAPHORE }, + { "AMDI0510", 0 }, + { "APMC0D0F", 0 }, + { "HISI02A1", 0 }, + { "HISI02A2", 0 }, + { "HISI02A3", 0 }, + { "HYGO0010", ACCESS_INTR_MASK }, + {} +}; +MODULE_DEVICE_TABLE(acpi, dw_i2c_acpi_match); + static const struct platform_device_id dw_i2c_platform_ids[] = { { "i2c_designware" }, {} @@ -490,8 +488,8 @@ static struct platform_driver dw_i2c_driver = { .remove_new = dw_i2c_plat_remove, .driver = { .name = "i2c_designware", - .of_match_table = of_match_ptr(dw_i2c_of_match), - .acpi_match_table = ACPI_PTR(dw_i2c_acpi_match), + .of_match_table = dw_i2c_of_match, + .acpi_match_table = dw_i2c_acpi_match, .pm = pm_ptr(&dw_i2c_dev_pm_ops), }, .id_table = dw_i2c_platform_ids, From patchwork Thu Nov 9 18:19:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 163545 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b129:0:b0:403:3b70:6f57 with SMTP id q9csp625631vqs; Thu, 9 Nov 2023 10:29:40 -0800 (PST) X-Google-Smtp-Source: AGHT+IEjfiev/25VkRJ75/UNlJXouX2lUAOETTjqUFefjew82cKCI1nGq3VXwwLDfIyvanFKUTIN X-Received: by 2002:a17:90b:350b:b0:27d:20ca:1156 with SMTP id ls11-20020a17090b350b00b0027d20ca1156mr2487759pjb.34.1699554579749; Thu, 09 Nov 2023 10:29:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699554579; cv=none; d=google.com; s=arc-20160816; b=OMdmS7Qd2VFQyvTQqwmnE7O0GEQa+wMj1Mrl+/rXpwDAyEVzmarhUs2/p0Og4yQiXy 1YAffV/xCxQnuGE9JKnAiu+HhE46sRvyNazGxi1H1Vcvsw2cRq92XYybDH1suJODFcSt JYQ+BA5umqXmTph1ygqtY+64/o3DXbnIG6WFwbCJZWyg6HxtcZutrgJrCxxntQmkgTwm c8PgqNRfHFHONz4bdVy3PlMkqu7rmI2i5WWWK1bZjXzug3Ycaz/tfgY6ZwH0ro1OyjMH rHnIb5+ZwCANN96uKWSYFHnOrIwb0pxEQj5OtUcGmeN7x6mQfMGo/DM2bHHMNIvC80Xb BQ9A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=BDtUIFYHtmTf5FeB16kQ+SpPx5UyjdUJCE3RpzWou68=; fh=mq6/FMGJdqTI0UuZRoAMccy9L/KbJAT6TPJFW+BrH4Y=; b=pI2/rXVDMB+uuY5pnEluQGO8/hipWq2iXkZunOswPu4um0I+ZrQ6ekkdSqvAA3k7wI xjr8YxNINDoqKcR84QY8dKllYTqPbEjwaDaC4td3f8tI8rJC1fHuvMbR8ExLFtYn3et8 +gKlQFxDFt4h+hyDIiKMW37HIbNxCs2DmtzV1e/ODp6pwap6OFllt54YwldWFYcowwrI G8zaBb4WC62vD6ZCnmqXfmJtS/vv2zpbAtJU7nGy60m9FhwlJ8XHCUTSvxHoRSgzW90R n7uzzQI/25OQlQW2ld/jGMS0c447fTUiNZFJSiCXOoUdmBnGJNshz8DkfRJwssCQtZRw fbEg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=UR0fdGAr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id x21-20020a17090a8a9500b00280979dbb7asi2208601pjn.103.2023.11.09.10.29.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Nov 2023 10:29:39 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=UR0fdGAr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id B783E81C778D; Thu, 9 Nov 2023 10:29:25 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345036AbjKIS2q (ORCPT + 31 others); Thu, 9 Nov 2023 13:28:46 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33360 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344987AbjKIS2j (ORCPT ); Thu, 9 Nov 2023 13:28:39 -0500 Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.126]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8D0533C04; Thu, 9 Nov 2023 10:28:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1699554517; x=1731090517; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=FNPib3amku2OveJFmG0UkpnYVRBDCdjSLX+9Rx4QUOQ=; b=UR0fdGArXXzlJXCCo2QGoWTMyMmbs5lH/eN9zPduIxFLylEq6wwG2KxY AO27OR5ExEsWORt1afx317bmEKSqFZ1CjkfCpvXKqy969jaShrAXm3jqu LuQocEQvJ1bw7il9IBMz+w0Br6+Lc991N8Pec/ItOBvIPhwt+ImakTHda TYpaIwLj8KxzUlwM1k9Qd7Vk/WJUNP2IcSCVd34amiUg7DOWR8FX0PnIe apajsKUciZByFiO+myunKMASGp4cIS9/21zvaTX/cLMe6Jl+18i7hWonI NXfi8e9nvrykBPyq5vinTsq1oc+ufCnLagwfpoBhN+aZzNeAH1BEb05pJ Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10889"; a="375088668" X-IronPort-AV: E=Sophos;i="6.03,290,1694761200"; d="scan'208";a="375088668" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Nov 2023 10:28:36 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10889"; a="767086814" X-IronPort-AV: E=Sophos;i="6.03,290,1694761200"; d="scan'208";a="767086814" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga007.fm.intel.com with ESMTP; 09 Nov 2023 10:28:33 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id 6B07876D; Thu, 9 Nov 2023 20:28:32 +0200 (EET) From: Andy Shevchenko To: Jarkko Nikula , Herbert Xu , Mario Limonciello , Andy Shevchenko , Wolfram Sang , linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Mika Westerberg , Jan Dabros , Andi Shyti , Hans de Goede Subject: [PATCH v2 03/12] i2c: designware: Drop return value from i2c_dw_acpi_configure() Date: Thu, 9 Nov 2023 20:19:13 +0200 Message-ID: <20231109182823.3531846-4-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.40.0.1996.gbec44491f096 In-Reply-To: <20231109182823.3531846-1-andriy.shevchenko@linux.intel.com> References: <20231109182823.3531846-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Thu, 09 Nov 2023 10:29:25 -0800 (PST) X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1782112143034640507 X-GMAIL-MSGID: 1782112143034640507 i2c_dw_acpi_configure() is called without checking of the returned value, hence just drop it by converting to void. Signed-off-by: Andy Shevchenko Reviewed-by: Andi Shyti --- drivers/i2c/busses/i2c-designware-common.c | 4 +--- drivers/i2c/busses/i2c-designware-core.h | 4 ++-- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/i2c/busses/i2c-designware-common.c b/drivers/i2c/busses/i2c-designware-common.c index affcfb243f0f..8d2223d164e3 100644 --- a/drivers/i2c/busses/i2c-designware-common.c +++ b/drivers/i2c/busses/i2c-designware-common.c @@ -255,7 +255,7 @@ static void i2c_dw_acpi_params(struct device *device, char method[], kfree(buf.pointer); } -int i2c_dw_acpi_configure(struct device *device) +void i2c_dw_acpi_configure(struct device *device) { struct dw_i2c_dev *dev = dev_get_drvdata(device); struct i2c_timings *t = &dev->timings; @@ -285,8 +285,6 @@ int i2c_dw_acpi_configure(struct device *device) dev->sda_hold_time = fs_ht; break; } - - return 0; } EXPORT_SYMBOL_GPL(i2c_dw_acpi_configure); diff --git a/drivers/i2c/busses/i2c-designware-core.h b/drivers/i2c/busses/i2c-designware-core.h index a7f6f3eafad7..f4dc08139624 100644 --- a/drivers/i2c/busses/i2c-designware-core.h +++ b/drivers/i2c/busses/i2c-designware-core.h @@ -397,7 +397,7 @@ int i2c_dw_validate_speed(struct dw_i2c_dev *dev); void i2c_dw_adjust_bus_speed(struct dw_i2c_dev *dev); #if IS_ENABLED(CONFIG_ACPI) -int i2c_dw_acpi_configure(struct device *device); +void i2c_dw_acpi_configure(struct device *device); #else -static inline int i2c_dw_acpi_configure(struct device *device) { return -ENODEV; } +static inline void i2c_dw_acpi_configure(struct device *device) { } #endif From patchwork Thu Nov 9 18:19:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 163540 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b129:0:b0:403:3b70:6f57 with SMTP id q9csp625506vqs; Thu, 9 Nov 2023 10:29:25 -0800 (PST) X-Google-Smtp-Source: AGHT+IHqgjLX/QUIzdk07COdv+o+sWJSFDoEVlQGis88CaUuc/BsTVWNE9aYpwt5YZRnuw4xE6Ql X-Received: by 2002:a05:6a21:a5a6:b0:181:2526:93b5 with SMTP id gd38-20020a056a21a5a600b00181252693b5mr119545pzc.13.1699554564739; Thu, 09 Nov 2023 10:29:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699554564; cv=none; d=google.com; s=arc-20160816; b=vA72SRkn1c4f5afJtTL+NdUhB4B2FGuy3bcQq1O3w4e3qK7nczWYRJpGDxGnrSuWrN JQyUxAmi8JrFjSCidV/Fcaud1+lvRVz+YfWAvHWvOsaID9nEPvQbHMbPK7NPwi9HhAP2 nO9+7UEppRSXVeOPjQtxlMU2K32MTyv2uOQZlE84PmIILlTXtGqlwLIo5p8ofdkfr42X Cn5gFphp0qAzHPovEDDvlgK9hCVjfGu6cSXrUSlY00+Ngwdo1DETG4taT/T4+OmVeGqT pkyKH00Lv71aXYIujKw6SQHl7ctUsePXSqywiT3lEZKIVY4bURG6wyO1ZN5kgAMjvdbK BqXQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Ygdq+EmzEAin9Ym+wbd1Wty+ZlPviEmWtkRBk/oJ64I=; fh=mq6/FMGJdqTI0UuZRoAMccy9L/KbJAT6TPJFW+BrH4Y=; b=ykMuUQND3GabcGjFaPSkuRO7HN2BVtoU6sHE2YjbsHR/h/OQENHBEnw2gEJmKlV1nn eeG1VYrh9dHxl6D5QvsknqRyBGvP47Z0PGgtqMOgW3b+N2DywWqMNQLwIHIZjhDEUMNZ SrZWpOGzkKkefs9H4GOyYhqlz5gER3L8mH6xllOioGfuHP0jymZ1wJvEoH6MYJFdyJZD KHGlT9TaAfeQFT4MOz1y+5DhRzzWKRD/kCiyU4G9U1Zto2wmeh++8snPhKCLGbJwJXAu KEYvBg2XO/j+sy/aASCRLrI7OlL6bTCL/fLZIcvN4CgxYrKC9O8LkeYHPO5F05H2jlso qFjA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=XkGcdTDC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id bo11-20020a056a02038b00b005aa0e024d63si8961852pgb.791.2023.11.09.10.29.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Nov 2023 10:29:24 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=XkGcdTDC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 6D2E4838C9EF; Thu, 9 Nov 2023 10:28:59 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345041AbjKIS2r (ORCPT + 31 others); Thu, 9 Nov 2023 13:28:47 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33366 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344998AbjKIS2j (ORCPT ); Thu, 9 Nov 2023 13:28:39 -0500 Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.126]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BB2823C05; Thu, 9 Nov 2023 10:28:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1699554517; x=1731090517; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=OtQFIcT4MOPN+YEE4ZFbYn7qh+ufwlBR8GM3OdUaV5I=; b=XkGcdTDCnuGXYFgDl/W69ZN7eJlniJBPaJlPUZUEkOnZxbLiJrsQzt+h 5efBXg6JvPYlv4D/uPqv4THs2mb5EqB1KvNLPRXZuipHoHtOMb8Mm0Myt YyVbd5W4D9Ue+Cla34r+JV96JuYNsPE2ltYW0Aqivia1N+MgcX9TolMHK HwNNYVX9j7mUbltXgscDERKx7Zys0kysrSrXLpBhsb7vmMQ2jRyvtX0yn RElFD3kOZP0JZA6to5iiisY410db5v03gXtRU3OxP9qKE2A5226nJJWP4 eISnGvxsKy5acWgaJqJpI/l1KIQf21HQcO43jYGWRvUl5H5f+qXYQZPxW w==; X-IronPort-AV: E=McAfee;i="6600,9927,10889"; a="375088674" X-IronPort-AV: E=Sophos;i="6.03,290,1694761200"; d="scan'208";a="375088674" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Nov 2023 10:28:36 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10889"; a="767086815" X-IronPort-AV: E=Sophos;i="6.03,290,1694761200"; d="scan'208";a="767086815" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga007.fm.intel.com with ESMTP; 09 Nov 2023 10:28:33 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id 81C2679F; Thu, 9 Nov 2023 20:28:32 +0200 (EET) From: Andy Shevchenko To: Jarkko Nikula , Herbert Xu , Mario Limonciello , Andy Shevchenko , Wolfram Sang , linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Mika Westerberg , Jan Dabros , Andi Shyti , Hans de Goede Subject: [PATCH v2 04/12] i2c: designware: Drop return value from dw_i2c_of_configure() Date: Thu, 9 Nov 2023 20:19:14 +0200 Message-ID: <20231109182823.3531846-5-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.40.0.1996.gbec44491f096 In-Reply-To: <20231109182823.3531846-1-andriy.shevchenko@linux.intel.com> References: <20231109182823.3531846-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Thu, 09 Nov 2023 10:28:59 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1782112127424496250 X-GMAIL-MSGID: 1782112127424496250 dw_i2c_of_configure() is called without checking of the returned value, hence just drop it by converting to void. Signed-off-by: Andy Shevchenko Reviewed-by: Andi Shyti --- drivers/i2c/busses/i2c-designware-platdrv.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/i2c/busses/i2c-designware-platdrv.c b/drivers/i2c/busses/i2c-designware-platdrv.c index 7d960d3161c0..af772a2c7fb6 100644 --- a/drivers/i2c/busses/i2c-designware-platdrv.c +++ b/drivers/i2c/busses/i2c-designware-platdrv.c @@ -110,7 +110,7 @@ static int mscc_twi_set_sda_hold_time(struct dw_i2c_dev *dev) return 0; } -static int dw_i2c_of_configure(struct platform_device *pdev) +static void dw_i2c_of_configure(struct platform_device *pdev) { struct dw_i2c_dev *dev = platform_get_drvdata(pdev); @@ -123,8 +123,6 @@ static int dw_i2c_of_configure(struct platform_device *pdev) default: break; } - - return 0; } #else static int bt1_i2c_request_regs(struct dw_i2c_dev *dev) @@ -132,9 +130,8 @@ static int bt1_i2c_request_regs(struct dw_i2c_dev *dev) return -ENODEV; } -static inline int dw_i2c_of_configure(struct platform_device *pdev) +static inline void dw_i2c_of_configure(struct platform_device *pdev) { - return -ENODEV; } #endif From patchwork Thu Nov 9 18:19:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 163546 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b129:0:b0:403:3b70:6f57 with SMTP id q9csp625686vqs; Thu, 9 Nov 2023 10:29:46 -0800 (PST) X-Google-Smtp-Source: AGHT+IHZbn1zEzfqByma+nW7voqO6DqHq3WzEyRpNuRj342VQZ1zS8OspksBgU10N6A6k1Dbsi0C X-Received: by 2002:a17:903:1cc:b0:1bb:6875:5a73 with SMTP id e12-20020a17090301cc00b001bb68755a73mr6245428plh.2.1699554586413; Thu, 09 Nov 2023 10:29:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699554586; cv=none; d=google.com; s=arc-20160816; b=JqE5AwgOZWZkuSQqKYc/RfpdqWvilsb43VqcG6YPGDxKEBrBW+zCG6TClpFMevdEYH Qo0ynvEHGOwArERYIzXt8aQffpzkCLN0oM3P67/tmgeO0/D+xv0TJu0XOPOlHLrafp5e Y19TKcuCn7aJa8JoSa+uJNS55Vq4oHKfXk3NPk/Lw4nnBl2AIyqxlrlOJxSUpK/6IQCE 3D+z+KBwqqdz32JVsRB85dUlES/1YbUQFCoD0PAhiwHR0Pj3nIQSzgI/EdOjT75qz/ui 1z5ONOiW3dZl4DPoK7XtlTtPm7uxcgeOJZuWHIYTQZ8tRQZWoZAITE5rCDTm9GG2SyBF tpag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=cEwnbO4q9lY80a9VzP807DCeLjela0KounsJGN7e6Zg=; fh=mq6/FMGJdqTI0UuZRoAMccy9L/KbJAT6TPJFW+BrH4Y=; b=Yr8O68RWkTIdji3yqG16ThEss7UgIIDK1zED73P9WISL+XGs40grN0yxrkXbH8xkPx wuZWtewqUg4X7im2+J6UPB+N6UUbp9Sduw+vVziRayrhhri/rW6nu/9NhPVFrPrMAGXO SC3W1PJJ7RCfmgqW+AVB5zRsBbovPg5r9JuneBzQIoEKB6+GuTkR+Lh7jco3HVfERQsW bsMXrnZipNSfWDtfkOfd4Zo8Jz8ICuLUrGscSRi680pWtKn0Emh06S1V5yWUrhudc/O3 efQffEz/bXoqJa74GkOaytC/j2q58FeYuDt0wflMxXYUppCklS3QHqR8LLXWdIuTmYuk GeIA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=JRTsvz5m; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id p12-20020a170902eacc00b001cc43368c9bsi5054924pld.630.2023.11.09.10.29.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Nov 2023 10:29:46 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=JRTsvz5m; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id C519A83C38E4; Thu, 9 Nov 2023 10:29:24 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345046AbjKIS2s (ORCPT + 31 others); Thu, 9 Nov 2023 13:28:48 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33402 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345014AbjKIS2m (ORCPT ); Thu, 9 Nov 2023 13:28:42 -0500 Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.126]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7ED3A3C05; Thu, 9 Nov 2023 10:28:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1699554520; x=1731090520; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=7CmFR+naMyItEiHSLEGMk+csTHhFMkqMImr3uUC48S8=; b=JRTsvz5mTphTz4QiyFz3xkRpAC7SZoSWTjvZV5FG6l7CVQqIB6aoP/cM LhFtiZYjKBY0uJzYqWaaOSv8nAcAhON04uy++FsFWUsZzu4ZUm2dUb6H3 /49qhfJXeOz1KEQ0KjOLvPZqUVAacxIMgmLnEIBBCri0qgTaemkso4uBp 4I7IHkWppEYmIl8P7SDfZDArcsryb0zjMbQFMFN57QzVkO21UepK+2oo/ GgWKU6xeBvYh0cHAqCca/S3mi7x4fELGWPgTVUsh6OkpK5dFPh0+WRO4E hXwxvqDf4DiBZVy/1iKWiC2wriB2LV1oqaRdU26kGKp44h4TYmVldo9YW g==; X-IronPort-AV: E=McAfee;i="6600,9927,10889"; a="375088690" X-IronPort-AV: E=Sophos;i="6.03,290,1694761200"; d="scan'208";a="375088690" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Nov 2023 10:28:39 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10889"; a="767086845" X-IronPort-AV: E=Sophos;i="6.03,290,1694761200"; d="scan'208";a="767086845" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga007.fm.intel.com with ESMTP; 09 Nov 2023 10:28:37 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id 8821E76F; Thu, 9 Nov 2023 20:28:32 +0200 (EET) From: Andy Shevchenko To: Jarkko Nikula , Herbert Xu , Mario Limonciello , Andy Shevchenko , Wolfram Sang , linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Mika Westerberg , Jan Dabros , Andi Shyti , Hans de Goede Subject: [PATCH v2 05/12] i2c: designware: Rename dw_i2c_of_configure() -> i2c_dw_of_configure() Date: Thu, 9 Nov 2023 20:19:15 +0200 Message-ID: <20231109182823.3531846-6-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.40.0.1996.gbec44491f096 In-Reply-To: <20231109182823.3531846-1-andriy.shevchenko@linux.intel.com> References: <20231109182823.3531846-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Thu, 09 Nov 2023 10:29:24 -0800 (PST) X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1782112149750954199 X-GMAIL-MSGID: 1782112149750954199 For the sake of consistency, rename dw_i2c_of_configure() and change its parameter to be aligned with the i2c_dw_acpi_configure(). Signed-off-by: Andy Shevchenko Reviewed-by: Andi Shyti --- drivers/i2c/busses/i2c-designware-platdrv.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/i2c/busses/i2c-designware-platdrv.c b/drivers/i2c/busses/i2c-designware-platdrv.c index af772a2c7fb6..c55fff3df8ca 100644 --- a/drivers/i2c/busses/i2c-designware-platdrv.c +++ b/drivers/i2c/busses/i2c-designware-platdrv.c @@ -110,9 +110,10 @@ static int mscc_twi_set_sda_hold_time(struct dw_i2c_dev *dev) return 0; } -static void dw_i2c_of_configure(struct platform_device *pdev) +static void i2c_dw_of_configure(struct device *device) { - struct dw_i2c_dev *dev = platform_get_drvdata(pdev); + struct platform_device *pdev = to_platform_device(device); + struct dw_i2c_dev *dev = dev_get_drvdata(device); switch (dev->flags & MODEL_MASK) { case MODEL_MSCC_OCELOT: @@ -130,7 +131,7 @@ static int bt1_i2c_request_regs(struct dw_i2c_dev *dev) return -ENODEV; } -static inline void dw_i2c_of_configure(struct platform_device *pdev) +static inline void i2c_dw_of_configure(struct device *device) { } #endif @@ -279,7 +280,7 @@ static int dw_i2c_plat_probe(struct platform_device *pdev) i2c_dw_adjust_bus_speed(dev); if (pdev->dev.of_node) - dw_i2c_of_configure(pdev); + i2c_dw_of_configure(&pdev->dev); if (has_acpi_companion(&pdev->dev)) i2c_dw_acpi_configure(&pdev->dev); From patchwork Thu Nov 9 18:19:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 163548 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b129:0:b0:403:3b70:6f57 with SMTP id q9csp626634vqs; Thu, 9 Nov 2023 10:31:15 -0800 (PST) X-Google-Smtp-Source: AGHT+IGUMe9ZqD4pCwkZd7z5VfLVvm1OYp8kuAm9juA3gzF5iWmD2ZpcMdACwtb9uo4/USdV498b X-Received: by 2002:a05:6a00:84c:b0:6c3:44e2:3e96 with SMTP id q12-20020a056a00084c00b006c344e23e96mr6429893pfk.27.1699554674881; Thu, 09 Nov 2023 10:31:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699554674; cv=none; d=google.com; s=arc-20160816; b=ZBSVGFtt2H/umphG5qgpJob65Lc6Oq4W9nizq+hI0n+BB1iyO3jLGBxfm10EBhXmVn 8V39/aCsjTXv7BXM76ptJbj7+rAfB+jIOsGUuo7FmydMdV3FTuPWAiWC3AoIeBjvLDZk grBA2WzXSxQM80Mjx5g4b6oIyx5BfKSeIfAgEsqqS4cR6qygV2kubYct0v2oqjZA9gT9 xK4S47Xye+33CqX+Y5GlvZ9Kmk6Wnfj9+tRHwqHOD8shapmCEw1A2gIZK2zZ35fjsD81 /ouuzTwsRbfxcT6VZh07yNvusuiQiGxaQFiXWxNWVKNGaNv35WXvyzQWIk8wtSVz3cS0 ubzg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=1UuetYN0GrRaM3nduVYJte+tzMdoSv53RCyCEO2/qMc=; fh=mq6/FMGJdqTI0UuZRoAMccy9L/KbJAT6TPJFW+BrH4Y=; b=i2GbBTDmKs3JDJs9Mey/HZMIe4VgS290hpp+5tryYGA8kZ5BfZw7Fc1gREho8mhZWG FCGOF24vq8ZXjkMwXat/kV+vvAuV7Bs3JCOlbKNYu73MX29C6GDG69ck0P0xFkIJ3Htd oA0RGAxaAALzkK1OAuK7REKr5qBPemNkdHDh1Pl9ExjqmbbxgXwG75+nYA4z42CsZjb/ 5OPy3SHPZMjV8r1MQrDop+eY8GPc4Ntjmu+EOy8tyVBfihxPOxGi09U0KxvuJS5Qltlj ik4V8nKUJLtxc3Xs1pU0A1EEal8oKpYKf1qYCI0HXJJeYrqJIUImg4/SazZI6pnjml2/ QPbw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=RTxAEsi+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id m17-20020a656a11000000b005b970288ac1si7966026pgu.190.2023.11.09.10.31.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Nov 2023 10:31:14 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=RTxAEsi+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 68901832FDBF; Thu, 9 Nov 2023 10:30:58 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345067AbjKIS27 (ORCPT + 31 others); Thu, 9 Nov 2023 13:28:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33432 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345019AbjKIS2n (ORCPT ); Thu, 9 Nov 2023 13:28:43 -0500 Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.115]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2730C3C0C; Thu, 9 Nov 2023 10:28:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1699554521; x=1731090521; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=YYYRkxf0rpg1oR/toNL6iopQD8fmDjHNAbcYLrc1aE8=; b=RTxAEsi+u3255dQKGuHqhE6Ydfeegzp4JhAH1pkkEnWzVHgOJKXqFEku MvIv04GQn+8XQHMSQOwkUMOcamxPyl5+DlycKg7ZHp41hWXceiiY6Zudo 95LEw95QWy26teU8r+wKlPeLg+nEwDNAzDc0XYUAYTnUh3aoyw66xC8sk touWQL0mlN3JUTcE/S3+Vpe76aZwfVbUjdTxg4WiUw6TfVvk2mTK9+rd5 chNKLGI3NspYuX/U1c2zX6q2OBFvEqm1usnV/s+w8inui74ApCLSR960L eMPaYBWWJZP0zCg30LkznQZ4gHq8Siu5AOMGaB/Lek561JO+oxpTSXs5B A==; X-IronPort-AV: E=McAfee;i="6600,9927,10889"; a="389853925" X-IronPort-AV: E=Sophos;i="6.03,290,1694761200"; d="scan'208";a="389853925" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Nov 2023 10:28:40 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10889"; a="936938988" X-IronPort-AV: E=Sophos;i="6.03,290,1694761200"; d="scan'208";a="936938988" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga005.jf.intel.com with ESMTP; 09 Nov 2023 10:28:37 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id 9AF9B7E7; Thu, 9 Nov 2023 20:28:32 +0200 (EET) From: Andy Shevchenko To: Jarkko Nikula , Herbert Xu , Mario Limonciello , Andy Shevchenko , Wolfram Sang , linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Mika Westerberg , Jan Dabros , Andi Shyti , Hans de Goede Subject: [PATCH v2 06/12] i2c: designware: Consolidate firmware parsing and configuring code Date: Thu, 9 Nov 2023 20:19:16 +0200 Message-ID: <20231109182823.3531846-7-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.40.0.1996.gbec44491f096 In-Reply-To: <20231109182823.3531846-1-andriy.shevchenko@linux.intel.com> References: <20231109182823.3531846-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Thu, 09 Nov 2023 10:30:58 -0800 (PST) X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1782112242654650973 X-GMAIL-MSGID: 1782112242654650973 We have the same code flows in the PCI and plaform drivers. Moreover, the flow requires the common code to export a few functions. Instead, consolidate that flow under new function called i2c_dw_fw_parse_and_configure() and drop unneeded exports. Reviewed-by: Andi Shyti Reviewed-by: Mario Limonciello Signed-off-by: Andy Shevchenko --- drivers/i2c/busses/i2c-designware-common.c | 68 +++++++++++++++++++-- drivers/i2c/busses/i2c-designware-core.h | 9 +-- drivers/i2c/busses/i2c-designware-pcidrv.c | 11 +--- drivers/i2c/busses/i2c-designware-platdrv.c | 48 +-------------- 4 files changed, 66 insertions(+), 70 deletions(-) diff --git a/drivers/i2c/busses/i2c-designware-common.c b/drivers/i2c/busses/i2c-designware-common.c index 8d2223d164e3..a5cae814a9c2 100644 --- a/drivers/i2c/busses/i2c-designware-common.c +++ b/drivers/i2c/busses/i2c-designware-common.c @@ -20,6 +20,7 @@ #include #include #include +#include #include #include #include @@ -188,7 +189,7 @@ static const u32 supported_speeds[] = { I2C_MAX_STANDARD_MODE_FREQ, }; -int i2c_dw_validate_speed(struct dw_i2c_dev *dev) +static int i2c_dw_validate_speed(struct dw_i2c_dev *dev) { struct i2c_timings *t = &dev->timings; unsigned int i; @@ -208,7 +209,44 @@ int i2c_dw_validate_speed(struct dw_i2c_dev *dev) return -EINVAL; } -EXPORT_SYMBOL_GPL(i2c_dw_validate_speed); + +#ifdef CONFIG_OF + +#include + +#define MSCC_ICPU_CFG_TWI_DELAY 0x0 +#define MSCC_ICPU_CFG_TWI_DELAY_ENABLE BIT(0) +#define MSCC_ICPU_CFG_TWI_SPIKE_FILTER 0x4 + +static int mscc_twi_set_sda_hold_time(struct dw_i2c_dev *dev) +{ + writel((dev->sda_hold_time << 1) | MSCC_ICPU_CFG_TWI_DELAY_ENABLE, + dev->ext + MSCC_ICPU_CFG_TWI_DELAY); + + return 0; +} + +static void i2c_dw_of_configure(struct device *device) +{ + struct platform_device *pdev = to_platform_device(device); + struct dw_i2c_dev *dev = dev_get_drvdata(device); + + switch (dev->flags & MODEL_MASK) { + case MODEL_MSCC_OCELOT: + dev->ext = devm_platform_ioremap_resource(pdev, 1); + if (!IS_ERR(dev->ext)) + dev->set_sda_hold_time = mscc_twi_set_sda_hold_time; + break; + default: + break; + } +} + +#else /* CONFIG_OF */ + +static inline void i2c_dw_of_configure(struct device *device) { } + +#endif /* CONFIG_OF */ #ifdef CONFIG_ACPI @@ -255,7 +293,7 @@ static void i2c_dw_acpi_params(struct device *device, char method[], kfree(buf.pointer); } -void i2c_dw_acpi_configure(struct device *device) +static void i2c_dw_acpi_configure(struct device *device) { struct dw_i2c_dev *dev = dev_get_drvdata(device); struct i2c_timings *t = &dev->timings; @@ -286,7 +324,6 @@ void i2c_dw_acpi_configure(struct device *device) break; } } -EXPORT_SYMBOL_GPL(i2c_dw_acpi_configure); static u32 i2c_dw_acpi_round_bus_speed(struct device *device) { @@ -308,11 +345,13 @@ static u32 i2c_dw_acpi_round_bus_speed(struct device *device) #else /* CONFIG_ACPI */ +static inline void i2c_dw_acpi_configure(struct device *device) { } + static inline u32 i2c_dw_acpi_round_bus_speed(struct device *device) { return 0; } #endif /* CONFIG_ACPI */ -void i2c_dw_adjust_bus_speed(struct dw_i2c_dev *dev) +static void i2c_dw_adjust_bus_speed(struct dw_i2c_dev *dev) { u32 acpi_speed = i2c_dw_acpi_round_bus_speed(dev->dev); struct i2c_timings *t = &dev->timings; @@ -328,7 +367,24 @@ void i2c_dw_adjust_bus_speed(struct dw_i2c_dev *dev) else t->bus_freq_hz = I2C_MAX_FAST_MODE_FREQ; } -EXPORT_SYMBOL_GPL(i2c_dw_adjust_bus_speed); + +int i2c_dw_fw_parse_and_configure(struct dw_i2c_dev *dev) +{ + struct i2c_timings *t = &dev->timings; + struct device *device = dev->dev; + + i2c_parse_fw_timings(device, t, false); + + i2c_dw_adjust_bus_speed(dev); + + if (device->of_node) + i2c_dw_of_configure(device); + if (has_acpi_companion(device)) + i2c_dw_acpi_configure(device); + + return i2c_dw_validate_speed(dev); +} +EXPORT_SYMBOL_GPL(i2c_dw_fw_parse_and_configure); u32 i2c_dw_scl_hcnt(u32 ic_clk, u32 tSYMBOL, u32 tf, int cond, int offset) { diff --git a/drivers/i2c/busses/i2c-designware-core.h b/drivers/i2c/busses/i2c-designware-core.h index f4dc08139624..a2731179a42b 100644 --- a/drivers/i2c/busses/i2c-designware-core.h +++ b/drivers/i2c/busses/i2c-designware-core.h @@ -393,11 +393,4 @@ int i2c_dw_baytrail_probe_lock_support(struct dw_i2c_dev *dev); int i2c_dw_amdpsp_probe_lock_support(struct dw_i2c_dev *dev); #endif -int i2c_dw_validate_speed(struct dw_i2c_dev *dev); -void i2c_dw_adjust_bus_speed(struct dw_i2c_dev *dev); - -#if IS_ENABLED(CONFIG_ACPI) -void i2c_dw_acpi_configure(struct device *device); -#else -static inline void i2c_dw_acpi_configure(struct device *device) { } -#endif +int i2c_dw_fw_parse_and_configure(struct dw_i2c_dev *dev); diff --git a/drivers/i2c/busses/i2c-designware-pcidrv.c b/drivers/i2c/busses/i2c-designware-pcidrv.c index bfafebecf680..2e6c7bfb5bf7 100644 --- a/drivers/i2c/busses/i2c-designware-pcidrv.c +++ b/drivers/i2c/busses/i2c-designware-pcidrv.c @@ -253,7 +253,6 @@ static int i2c_dw_pci_probe(struct pci_dev *pdev, int r; struct dw_pci_controller *controller; struct dw_scl_sda_cfg *cfg; - struct i2c_timings *t; if (id->driver_data >= ARRAY_SIZE(dw_pci_controllers)) return dev_err_probe(&pdev->dev, -EINVAL, @@ -288,9 +287,6 @@ static int i2c_dw_pci_probe(struct pci_dev *pdev, dev->irq = pci_irq_vector(pdev, 0); dev->flags |= controller->flags; - t = &dev->timings; - i2c_parse_fw_timings(&pdev->dev, t, false); - pci_set_drvdata(pdev, dev); if (controller->setup) { @@ -301,12 +297,7 @@ static int i2c_dw_pci_probe(struct pci_dev *pdev, } } - i2c_dw_adjust_bus_speed(dev); - - if (has_acpi_companion(&pdev->dev)) - i2c_dw_acpi_configure(&pdev->dev); - - r = i2c_dw_validate_speed(dev); + r = i2c_dw_fw_parse_and_configure(dev); if (r) { pci_free_irq_vectors(pdev); return r; diff --git a/drivers/i2c/busses/i2c-designware-platdrv.c b/drivers/i2c/busses/i2c-designware-platdrv.c index c55fff3df8ca..0b6d6f2b6198 100644 --- a/drivers/i2c/busses/i2c-designware-platdrv.c +++ b/drivers/i2c/busses/i2c-designware-platdrv.c @@ -21,7 +21,6 @@ #include #include #include -#include #include #include #include @@ -97,43 +96,11 @@ static int bt1_i2c_request_regs(struct dw_i2c_dev *dev) dev->map = devm_regmap_init(dev->dev, NULL, dev, &bt1_i2c_cfg); return PTR_ERR_OR_ZERO(dev->map); } - -#define MSCC_ICPU_CFG_TWI_DELAY 0x0 -#define MSCC_ICPU_CFG_TWI_DELAY_ENABLE BIT(0) -#define MSCC_ICPU_CFG_TWI_SPIKE_FILTER 0x4 - -static int mscc_twi_set_sda_hold_time(struct dw_i2c_dev *dev) -{ - writel((dev->sda_hold_time << 1) | MSCC_ICPU_CFG_TWI_DELAY_ENABLE, - dev->ext + MSCC_ICPU_CFG_TWI_DELAY); - - return 0; -} - -static void i2c_dw_of_configure(struct device *device) -{ - struct platform_device *pdev = to_platform_device(device); - struct dw_i2c_dev *dev = dev_get_drvdata(device); - - switch (dev->flags & MODEL_MASK) { - case MODEL_MSCC_OCELOT: - dev->ext = devm_platform_ioremap_resource(pdev, 1); - if (!IS_ERR(dev->ext)) - dev->set_sda_hold_time = mscc_twi_set_sda_hold_time; - break; - default: - break; - } -} #else static int bt1_i2c_request_regs(struct dw_i2c_dev *dev) { return -ENODEV; } - -static inline void i2c_dw_of_configure(struct device *device) -{ -} #endif static int txgbe_i2c_request_regs(struct dw_i2c_dev *dev) @@ -245,7 +212,6 @@ static int dw_i2c_plat_probe(struct platform_device *pdev) { struct i2c_adapter *adap; struct dw_i2c_dev *dev; - struct i2c_timings *t; int irq, ret; irq = platform_get_irq(pdev, 0); @@ -274,18 +240,7 @@ static int dw_i2c_plat_probe(struct platform_device *pdev) reset_control_deassert(dev->rst); - t = &dev->timings; - i2c_parse_fw_timings(&pdev->dev, t, false); - - i2c_dw_adjust_bus_speed(dev); - - if (pdev->dev.of_node) - i2c_dw_of_configure(&pdev->dev); - - if (has_acpi_companion(&pdev->dev)) - i2c_dw_acpi_configure(&pdev->dev); - - ret = i2c_dw_validate_speed(dev); + ret = i2c_dw_fw_parse_and_configure(dev); if (ret) goto exit_reset; @@ -313,6 +268,7 @@ static int dw_i2c_plat_probe(struct platform_device *pdev) goto exit_reset; if (dev->clk) { + struct i2c_timings *t = &dev->timings; u64 clk_khz; dev->get_clk_rate_khz = i2c_dw_get_clk_rate_khz; From patchwork Thu Nov 9 18:19:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 163541 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b129:0:b0:403:3b70:6f57 with SMTP id q9csp625531vqs; Thu, 9 Nov 2023 10:29:27 -0800 (PST) X-Google-Smtp-Source: AGHT+IEKgYLoz4QapDr82EbLhPjdAxnQd9RovsUZQaVMj1LltzeGp/C1e5bgr8QSeIDXVJlzk6QV X-Received: by 2002:a05:6871:5225:b0:1e9:f4e4:2882 with SMTP id ht37-20020a056871522500b001e9f4e42882mr6580928oac.38.1699554567674; Thu, 09 Nov 2023 10:29:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699554567; cv=none; d=google.com; s=arc-20160816; b=t13ZpVyNehoKV/zxvxDQd4bIVpmLfS48JLdBUoeD9yPNSSXbOGBkBpHqMz+18gj4DO v6iWsf9c56B3BVt56PyaVaBcg533MV/999UpgCYnRuDVrDmRzAZ/9swwlupiEkBUbLcX TlwJ/OJdcjhUHXrsudpXh0g7SlhtfQI0D1BOYcLcnr9Q7UlgIC3Ao+nqfjc9q8lP7Xg3 j+9rOAxVNyyziUe9GpxhB33gWwVsbYyu+o4ey7HHPozT/beAY16Zd03wxfr32l7XegcJ +HkpE8OGeb3oeUE7KLwNEA/tiwcFRTL6itp9sD2p1hhzM+Or4rjAc+8igK3iXCFsJWIF OkvQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=SOZqZF3HZp/UuF7jH6tU2cbgMmcfovYNJMBj/6NA9vg=; fh=mq6/FMGJdqTI0UuZRoAMccy9L/KbJAT6TPJFW+BrH4Y=; b=m85TMt3tSAnIreNlxworxCuFVciZvAKF3P3vehABdDmX5kKUWyfVpelCkFVLfsxR5v SprfVJNpvFEKV5l5sisGnPYZ00l7Tp64Wxhl2qIIoIHYvEPXkiYhy4cD1mlGx0L6yHvS OYoj5ICN/qgBwH4qK8rHxJesxAaz76XnG2C1pjedFOFlyks8icooUdL7qTyAWBmCQjIT 2KJa2P6jIoKVJM5JPXiU95Q8ta87doIMR6nwLMd+7+j8YeSRg85ajJwyP1b8AR9Umw4i irPh1RWNx5gbTlLlBmUgzri9fu1ePMQXMYMRdnQCG/5qwP2w2/89G92a3nS9Q4sRcri4 YEVQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="jR8e/s9o"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id r16-20020a6560d0000000b0057828b85afdsi7332556pgv.795.2023.11.09.10.29.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Nov 2023 10:29:27 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="jR8e/s9o"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id B24A181C77A4; Thu, 9 Nov 2023 10:29:15 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345054AbjKIS2u (ORCPT + 31 others); Thu, 9 Nov 2023 13:28:50 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33416 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345015AbjKIS2m (ORCPT ); Thu, 9 Nov 2023 13:28:42 -0500 Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.115]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A99993C06; Thu, 9 Nov 2023 10:28:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1699554520; x=1731090520; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=yDPVqcRH6sP/SphP24kcue0BYm7loFUON/tJY9ZWFSk=; b=jR8e/s9osj+sDSKswsajw9gLFMkQOt/sWTaLOyw29SDujBMDuSJwKgfm Pdv7meNl3yVf9IV0sYjviZwUli4FtUZ4A9IVfp3MT8C0sMhcuFZJXwYb9 WDRabSEYAkYh7r3bwOUF1PT7eF6WwyuFK2DF56+CdcAzCDHSB/KTntB/n w1kiUPYGvSNNqAZs7O85BdFyVt+zFaoAbDlTRP7AazPqTJ5TCg5YVLsPE nSUbs+d3GoY1A1vn/KSpaVYYOiTYash4GkAV0X7u3JAuW14wXu5HQQw93 hVux8ZttLB+L51g5i4xsaT6B/A/VWzXZ/YygDRcgNZqxcXZYbiqeJkBBV w==; X-IronPort-AV: E=McAfee;i="6600,9927,10889"; a="389853919" X-IronPort-AV: E=Sophos;i="6.03,290,1694761200"; d="scan'208";a="389853919" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Nov 2023 10:28:40 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10889"; a="936938985" X-IronPort-AV: E=Sophos;i="6.03,290,1694761200"; d="scan'208";a="936938985" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga005.jf.intel.com with ESMTP; 09 Nov 2023 10:28:37 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id AD46B7F1; Thu, 9 Nov 2023 20:28:32 +0200 (EET) From: Andy Shevchenko To: Jarkko Nikula , Herbert Xu , Mario Limonciello , Andy Shevchenko , Wolfram Sang , linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Mika Westerberg , Jan Dabros , Andi Shyti , Hans de Goede Subject: [PATCH v2 07/12] i2c: desingware: Unify the firmware type checks Date: Thu, 9 Nov 2023 20:19:17 +0200 Message-ID: <20231109182823.3531846-8-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.40.0.1996.gbec44491f096 In-Reply-To: <20231109182823.3531846-1-andriy.shevchenko@linux.intel.com> References: <20231109182823.3531846-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Thu, 09 Nov 2023 10:29:15 -0800 (PST) X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1782112129940487745 X-GMAIL-MSGID: 1782112129940487745 Instead of asymmetrical checks for the firmware type use the is_*_node() calls. Reviewed-by: Andi Shyti Reviewed-by: Mario Limonciello Signed-off-by: Andy Shevchenko --- drivers/i2c/busses/i2c-designware-common.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/i2c/busses/i2c-designware-common.c b/drivers/i2c/busses/i2c-designware-common.c index a5cae814a9c2..49d9d5f83071 100644 --- a/drivers/i2c/busses/i2c-designware-common.c +++ b/drivers/i2c/busses/i2c-designware-common.c @@ -22,6 +22,7 @@ #include #include #include +#include #include #include #include @@ -372,14 +373,15 @@ int i2c_dw_fw_parse_and_configure(struct dw_i2c_dev *dev) { struct i2c_timings *t = &dev->timings; struct device *device = dev->dev; + struct fwnode_handle *fwnode = dev_fwnode(device); i2c_parse_fw_timings(device, t, false); i2c_dw_adjust_bus_speed(dev); - if (device->of_node) + if (is_of_node(fwnode)) i2c_dw_of_configure(device); - if (has_acpi_companion(device)) + else if (is_acpi_node(fwnode)) i2c_dw_acpi_configure(device); return i2c_dw_validate_speed(dev); From patchwork Thu Nov 9 18:19:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 163549 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b129:0:b0:403:3b70:6f57 with SMTP id q9csp626877vqs; Thu, 9 Nov 2023 10:31:37 -0800 (PST) X-Google-Smtp-Source: AGHT+IGhyuFJ4dlpYw/s+f4EFeYapkEjZU9kuvPFyPf8HQ/mfGk2MJ/KDF+9pIB64E3JI1Zz0feV X-Received: by 2002:a05:6a00:2d81:b0:6c3:6cdc:a297 with SMTP id fb1-20020a056a002d8100b006c36cdca297mr5626509pfb.14.1699554697581; Thu, 09 Nov 2023 10:31:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699554697; cv=none; d=google.com; s=arc-20160816; b=arZuqXB2iYJVG7V3n/rdlmwApEBhTd+xnKPeORZdSBM6+7C30Kt1YUZ29hF3VNiK40 jIPkRhckhwh4TBGhHJ+ppcPUSvbSi69+W7Skprb+RBWvJ+U/cdiG77jFTjDKYHSN7vnE sIs2Ih7LS7+6XuEBhZi427wVnpj7yPtMnEOpJLfSfDotp1WZAO6JXqbz/G/x9f/xgYEB XaP5klxRqo7bpS7X9OvAJUat2RC+2ZIn+G311yS4TCWGLwdKK6GSrsCKdYPB8OlStIJK F6DEOKMK1RWYIk/HxF8sPi+rwvNAe7WJ+SL5GoCvVPcUooxV/C63x6dMzT8LPiDE87EX lxNA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=wsRmNHMGsTSGhcnBLhkNpMoAqb8oQExN2OvhsvtYAhI=; fh=mq6/FMGJdqTI0UuZRoAMccy9L/KbJAT6TPJFW+BrH4Y=; b=wlHZ64BsO4/5YFTsko1ViicYP0t1yRxx1JJsElcQv9pOgEgUUDfUcHdUgXdxnHq2Qs 84j1LkVhO+YfJePnukn5DxLevXijExJO9G+pCLt8XFsQpjNfSRorS7sx8MlqTALgZ+3v A9C77ER3HpHi/ZVuzYWLH57PdIdigYPnSIO+r6Gh+mTrg1/G5vmoF7EOnNC7oi9gQt8q 3k6wqHLyozntjd9cua52LcF0o1sVElLMWNfXH/W7AOMXEzSrKV7MtiBlS0m4UnJfJFC8 glxnLlrmKhvNDcyHYg8ECJVGTmcc84OxnCPqeJnD2xiEZtF3Nz3qjYXW+VxPfMsbbBJF PzqA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="P6/L9jaj"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id fn22-20020a056a002fd600b006c3077cee72si15277654pfb.387.2023.11.09.10.31.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Nov 2023 10:31:37 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="P6/L9jaj"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 6882D8024622; Thu, 9 Nov 2023 10:30:31 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345065AbjKIS2x (ORCPT + 31 others); Thu, 9 Nov 2023 13:28:53 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33422 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345017AbjKIS2n (ORCPT ); Thu, 9 Nov 2023 13:28:43 -0500 Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.126]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BBC0D3C07; Thu, 9 Nov 2023 10:28:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1699554520; x=1731090520; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=8APH4P4NEIbrdj9fSHnpfr/pQLSK5n0sPVRfXsOmxK4=; b=P6/L9jaj4Nj9MdAXNoXvK+x/jPgOsk13d0UMjOCImgcAP1xS+t9KSRPR 6kPxmODKmmEhofZ8CZUQ13q4/9pZGLYnPdIwZgpEugRWIiX7sMJNKhrzm +OX8LRPyeeJ8IhBa9qVXw0Wg/GhmyYqIiJ3Wp+elZ7aOrNDFuwdTbKlhI r/sF2P5146jkrIEiEtNkcX2Cl2pfpy1+qR4glE4qE3NcmvDT+qszqw8L7 Dlc1qV+vFgD0U2RfwmaMnpfdDSTqaYY9PdGE9TLmSVDjlxVrIkU8s7dAY RajJu9WefVJLvca0TTCWY0uYZ3bUxCX+Np4Ht0kUytknmEWk4vqJqoOxl Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10889"; a="375088697" X-IronPort-AV: E=Sophos;i="6.03,290,1694761200"; d="scan'208";a="375088697" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Nov 2023 10:28:40 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10889"; a="767086846" X-IronPort-AV: E=Sophos;i="6.03,290,1694761200"; d="scan'208";a="767086846" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga007.fm.intel.com with ESMTP; 09 Nov 2023 10:28:37 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id B51D97C4; Thu, 9 Nov 2023 20:28:32 +0200 (EET) From: Andy Shevchenko To: Jarkko Nikula , Herbert Xu , Mario Limonciello , Andy Shevchenko , Wolfram Sang , linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Mika Westerberg , Jan Dabros , Andi Shyti , Hans de Goede Subject: [PATCH v2 08/12] i2c: designware: Move exports to I2C_DW namespaces Date: Thu, 9 Nov 2023 20:19:18 +0200 Message-ID: <20231109182823.3531846-9-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.40.0.1996.gbec44491f096 In-Reply-To: <20231109182823.3531846-1-andriy.shevchenko@linux.intel.com> References: <20231109182823.3531846-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Thu, 09 Nov 2023 10:30:31 -0800 (PST) X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1782112266188435748 X-GMAIL-MSGID: 1782112266188435748 Reduce scope of the I²C DesignWare driver exports to I2C_DW namespaces. This will prevent abuse of the symbols and clean up global namespace. Signed-off-by: Andy Shevchenko --- drivers/i2c/busses/i2c-designware-common.c | 2 ++ drivers/i2c/busses/i2c-designware-master.c | 3 +++ drivers/i2c/busses/i2c-designware-pcidrv.c | 2 ++ drivers/i2c/busses/i2c-designware-platdrv.c | 2 ++ drivers/i2c/busses/i2c-designware-slave.c | 3 +++ 5 files changed, 12 insertions(+) diff --git a/drivers/i2c/busses/i2c-designware-common.c b/drivers/i2c/busses/i2c-designware-common.c index 49d9d5f83071..50cf4cbfeff3 100644 --- a/drivers/i2c/busses/i2c-designware-common.c +++ b/drivers/i2c/busses/i2c-designware-common.c @@ -28,6 +28,8 @@ #include #include +#define DEFAULT_SYMBOL_NAMESPACE I2C_DW_COMMON + #include "i2c-designware-core.h" static char *abort_sources[] = { diff --git a/drivers/i2c/busses/i2c-designware-master.c b/drivers/i2c/busses/i2c-designware-master.c index 85dbd0eb5392..0b6576d7f811 100644 --- a/drivers/i2c/busses/i2c-designware-master.c +++ b/drivers/i2c/busses/i2c-designware-master.c @@ -22,6 +22,8 @@ #include #include +#define DEFAULT_SYMBOL_NAMESPACE I2C_DW + #include "i2c-designware-core.h" #define AMD_TIMEOUT_MIN_US 25 @@ -1079,3 +1081,4 @@ EXPORT_SYMBOL_GPL(i2c_dw_probe_master); MODULE_DESCRIPTION("Synopsys DesignWare I2C bus master adapter"); MODULE_LICENSE("GPL"); +MODULE_IMPORT_NS(I2C_DW_COMMON); diff --git a/drivers/i2c/busses/i2c-designware-pcidrv.c b/drivers/i2c/busses/i2c-designware-pcidrv.c index 2e6c7bfb5bf7..68c2e1a3a035 100644 --- a/drivers/i2c/busses/i2c-designware-pcidrv.c +++ b/drivers/i2c/busses/i2c-designware-pcidrv.c @@ -418,3 +418,5 @@ module_pci_driver(dw_i2c_driver); MODULE_AUTHOR("Baruch Siach "); MODULE_DESCRIPTION("Synopsys DesignWare PCI I2C bus adapter"); MODULE_LICENSE("GPL"); +MODULE_IMPORT_NS(I2C_DW); +MODULE_IMPORT_NS(I2C_DW_COMMON); diff --git a/drivers/i2c/busses/i2c-designware-platdrv.c b/drivers/i2c/busses/i2c-designware-platdrv.c index 0b6d6f2b6198..92e9199a5fdb 100644 --- a/drivers/i2c/busses/i2c-designware-platdrv.c +++ b/drivers/i2c/busses/i2c-designware-platdrv.c @@ -464,3 +464,5 @@ module_exit(dw_i2c_exit_driver); MODULE_AUTHOR("Baruch Siach "); MODULE_DESCRIPTION("Synopsys DesignWare I2C bus adapter"); MODULE_LICENSE("GPL"); +MODULE_IMPORT_NS(I2C_DW); +MODULE_IMPORT_NS(I2C_DW_COMMON); diff --git a/drivers/i2c/busses/i2c-designware-slave.c b/drivers/i2c/busses/i2c-designware-slave.c index 2e079cf20bb5..70d183fa3bff 100644 --- a/drivers/i2c/busses/i2c-designware-slave.c +++ b/drivers/i2c/busses/i2c-designware-slave.c @@ -16,6 +16,8 @@ #include #include +#define DEFAULT_SYMBOL_NAMESPACE I2C_DW + #include "i2c-designware-core.h" static void i2c_dw_configure_fifo_slave(struct dw_i2c_dev *dev) @@ -279,3 +281,4 @@ EXPORT_SYMBOL_GPL(i2c_dw_probe_slave); MODULE_AUTHOR("Luis Oliveira "); MODULE_DESCRIPTION("Synopsys DesignWare I2C bus slave adapter"); MODULE_LICENSE("GPL v2"); +MODULE_IMPORT_NS(I2C_DW_COMMON); From patchwork Thu Nov 9 18:19:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 163544 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b129:0:b0:403:3b70:6f57 with SMTP id q9csp625577vqs; Thu, 9 Nov 2023 10:29:32 -0800 (PST) X-Google-Smtp-Source: AGHT+IG8/dRx0ORK2keaz7E0e5lcYMMRBC5Af70b9Ih6IVLU306ye6QfMrEJTKLg8JESyD8MN6tk X-Received: by 2002:a05:6a00:311e:b0:68f:dcc1:4bef with SMTP id bi30-20020a056a00311e00b0068fdcc14befmr4216639pfb.7.1699554572376; Thu, 09 Nov 2023 10:29:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699554572; cv=none; d=google.com; s=arc-20160816; b=EGQGs946txttAuay4pEfOMaVtbCsLNcbT4YDrWLbPbdseVztS10v+/MgLFOuTPjOAG RHbN9mG5H2/761+EFZaphl0CzIRw6/C2oSMKaWzYUQ66WbzWElqKZzlww1EUr8/y3bV7 mSl2cWg8mJw5Gy50d9H64EShcXfqkhsDwUrsUtRFJA1oDpDaB3mcWYPRfJuBSGHGhECR Xp3K6WhBtiovwsGhepCkmeNKyK/ivhhV1W5Pgw9tf5PSoO6Bjqdyv36R4osmamGGb4fq gsCIGqwL4EfdD3vC63xuFnNgLEMdVSe9dmc1VJ3YPqeT+cPrK9z9Z4FqXOk2ezvsR6X4 xDQw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=9OkbwBDrZ4bSEVpJYTfFrjxGYkj35NxRlvyu6gv9oL4=; fh=mq6/FMGJdqTI0UuZRoAMccy9L/KbJAT6TPJFW+BrH4Y=; b=MsUuw59G2o/WS14Zk9ZhZGVDOydOnPiecvn3nP5+YAtXVxIxV9FBu/OhkdMfXRbf61 Yukpz4FUZFTBi9yoIntK7BQWGmHhtCrq0JhBoLGePsRIlNtnz/fgicC9UvszlCM0ziZf oY03HPKKAfoU7O6qPjLgqP8M3aGdjpsK0R7dAHQ8u1txycwRv2xSLwSFR6GZgTJPoUb/ IsIYA/nKsl6Qz1rKys6nVfuJ1VPCo+RY5jAUDklgcfgDEeH176Hh9w0Xp43d8cEdccN/ 94mmKXEUKbFkMhA3f6sNz0Lkti2ExK/aDCgo6ZecWSSXFzp1vexbEF/qm4H7aFFGtyWu KHrQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=A5nk8Q5D; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id y184-20020a638ac1000000b005bd052042f4si7989431pgd.69.2023.11.09.10.29.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Nov 2023 10:29:32 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=A5nk8Q5D; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id C6AAE83C1E21; Thu, 9 Nov 2023 10:29:14 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345091AbjKIS3E (ORCPT + 31 others); Thu, 9 Nov 2023 13:29:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33452 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345021AbjKIS2n (ORCPT ); Thu, 9 Nov 2023 13:28:43 -0500 Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.115]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 41D2E3C0E; Thu, 9 Nov 2023 10:28:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1699554521; x=1731090521; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=0y0h7BkktYSsLfLGZrjiG6Eoa1Wm0LmcKR98LPxa7Tg=; b=A5nk8Q5DqC9i3hMzuE8S6Lk2i9DbqOO9CIFDZfAkVSNWnyrAgdYcttOW GDB3VlnK6EuSiK1cxVZz3jW0HNvfuORYybO+6KpZbbS8temtFZGCXXS+4 Slo2f2BBfeyyxdzKYXOrF3M6v97bqo5RYHA5HT9gV14gyXW3XTHls6y26 S4htxSrFTrq3PwIo3LPPy9FC9FbtDoeOzQkdnq+L1qrXY5X1SaIubiEpQ I8viSmVq+AND7L17yzOGq/HwUmiqOZj+k9eUEQFH5ZiFp2Z0TQvZDgKL6 cYxBeukRxoeNzuIXtX6E59eDL1pz57RKvikb2mrEFjm4IXFiF46Qgo6u8 Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10889"; a="389853931" X-IronPort-AV: E=Sophos;i="6.03,290,1694761200"; d="scan'208";a="389853931" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Nov 2023 10:28:40 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10889"; a="936938989" X-IronPort-AV: E=Sophos;i="6.03,290,1694761200"; d="scan'208";a="936938989" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga005.jf.intel.com with ESMTP; 09 Nov 2023 10:28:37 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id C9F2B81E; Thu, 9 Nov 2023 20:28:32 +0200 (EET) From: Andy Shevchenko To: Jarkko Nikula , Herbert Xu , Mario Limonciello , Andy Shevchenko , Wolfram Sang , linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Mika Westerberg , Jan Dabros , Andi Shyti , Hans de Goede Subject: [PATCH v2 09/12] i2c: designware: Get rid of redundant 'else' Date: Thu, 9 Nov 2023 20:19:19 +0200 Message-ID: <20231109182823.3531846-10-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.40.0.1996.gbec44491f096 In-Reply-To: <20231109182823.3531846-1-andriy.shevchenko@linux.intel.com> References: <20231109182823.3531846-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Thu, 09 Nov 2023 10:29:14 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1782112135463114544 X-GMAIL-MSGID: 1782112135463114544 In the snippets like the following if (...) return / goto / break / continue ...; else ... the 'else' is redundant. Get rid of it. Reviewed-by: Andi Shyti Reviewed-by: Mario Limonciello Signed-off-by: Andy Shevchenko --- drivers/i2c/busses/i2c-designware-common.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/i2c/busses/i2c-designware-common.c b/drivers/i2c/busses/i2c-designware-common.c index 50cf4cbfeff3..4d7dc346e619 100644 --- a/drivers/i2c/busses/i2c-designware-common.c +++ b/drivers/i2c/busses/i2c-designware-common.c @@ -638,10 +638,10 @@ int i2c_dw_handle_tx_abort(struct dw_i2c_dev *dev) if (abort_source & DW_IC_TX_ARB_LOST) return -EAGAIN; - else if (abort_source & DW_IC_TX_ABRT_GCALL_READ) + if (abort_source & DW_IC_TX_ABRT_GCALL_READ) return -EINVAL; /* wrong msgs[] data */ - else - return -EIO; + + return -EIO; } int i2c_dw_set_fifo_size(struct dw_i2c_dev *dev) From patchwork Thu Nov 9 18:19:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 163547 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b129:0:b0:403:3b70:6f57 with SMTP id q9csp625905vqs; Thu, 9 Nov 2023 10:30:12 -0800 (PST) X-Google-Smtp-Source: AGHT+IHhk7IFBs3Jf13FPPZnYVu6L3rXj4SmZ5vVUfze1619EXaREyNW6z34axkc83Ohckz3NrVs X-Received: by 2002:a05:6a21:a594:b0:180:eab5:a66 with SMTP id gd20-20020a056a21a59400b00180eab50a66mr6541302pzc.27.1699554611676; Thu, 09 Nov 2023 10:30:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699554611; cv=none; d=google.com; s=arc-20160816; b=XModdznUus6XV8iQPHNdLZrHw7KzFwPPxXWvxxEAy3LYckyVL7ARCAby7FQXOhOCtw DSCO8iLOyHF1hG7I8LyIhmjCYwc0Y/ZgWvmMslHK/EPmwTrtFqxtEFAx8DtUnbzWF4KQ i5dFrrDU9uPISQ/cxrm9s2duptzKN5sCPmy4NrL34YHmA7RRx/kRWg/RrOFJkVInhXSq zfPsWclH2cK/Y9lPAJfdDZgupk1LF7rZTL3mLAu/Nneya62WLtUZCIaClEAONyICpl29 bq61pjobWjHORlNh/brtCCw/FUmdCGfdyDpg1UEp2lovhOVV9c01QLGhWO+Z8fQCqM0y +oLw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=ogYBZ++oDm3B22DpS/3TosrVSyPvCSNJiH++n0uI1jU=; fh=mq6/FMGJdqTI0UuZRoAMccy9L/KbJAT6TPJFW+BrH4Y=; b=FBEbHHFmbI2s+7lqKgTVGsLflVwp/DBABPogqX0FGZjucfU94YveWfign/RiJpGkYd C1fkwiSka6kI/TlL3ajfr5Sw4x2EwpSqCXeRZDa9dHOcPF8SzCv32K5RIWSoHbYKWitX PfgIwFR5kP6CMn6E6Dkq7R5MHQx2LTq3ThBd7reJHjUk4K04pLYipj6yHBCYoRDBFH6S L+gAwbVhwrg0IQ5O4xeMjJghoit1dz4WvgnUbJEPRtVUR+bsquM8Je3/tU1YkHMsEDWY VReWVZ3luLwGoBnWNb9E5TvMhQCbm/Qyif6EMy/nHGID5+Bgz0hCS9WP+EVAAGvjM4fH ycJA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=lSOL3Ne7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id s35-20020a056a0017a300b006c347df967dsi16055363pfg.155.2023.11.09.10.30.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Nov 2023 10:30:11 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=lSOL3Ne7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 35F5681C77B9; Thu, 9 Nov 2023 10:29:52 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345101AbjKIS3J (ORCPT + 31 others); Thu, 9 Nov 2023 13:29:09 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33468 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345022AbjKIS2o (ORCPT ); Thu, 9 Nov 2023 13:28:44 -0500 Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.115]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 67BF43C11; Thu, 9 Nov 2023 10:28:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1699554521; x=1731090521; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=J/3rNKPhtPGSbMQv1qpIa/vW5WBgEmTeFjTETFKBSGQ=; b=lSOL3Ne7pxeJa4NLTmbgqlXUbWwtssrtt00yXOSdmg0TFwm1Awi1NTyR wxZP4lHkRrq+A7+1AMtSoN/0TF3XNjd1FDOgcT8yIr9Bed/A7BGFE4eID 28jmUPHLdn+STYsS7mRcBSqshjomqY/L7OnN5Jj1pgUDJ2DyNNnpk/awY e6BB8UtW2Ij+n4/iPOq8Rpqn3dtxosoSCyi2EnJ73laT7+DzLkoZKuK13 rsWOMTL2rHFXjWAihW+Q/H426fmOgnWBBFhM7yZG7nn+V9NDfQ9Ur9DtX nYFRrPtfri6B0+nhAvFvg37RHYh8ktsqM/JX1cbyjbIYVZtkJFNiLq6U9 w==; X-IronPort-AV: E=McAfee;i="6600,9927,10889"; a="389853942" X-IronPort-AV: E=Sophos;i="6.03,290,1694761200"; d="scan'208";a="389853942" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Nov 2023 10:28:41 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10889"; a="936938990" X-IronPort-AV: E=Sophos;i="6.03,290,1694761200"; d="scan'208";a="936938990" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga005.jf.intel.com with ESMTP; 09 Nov 2023 10:28:37 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id D0A25812; Thu, 9 Nov 2023 20:28:32 +0200 (EET) From: Andy Shevchenko To: Jarkko Nikula , Herbert Xu , Mario Limonciello , Andy Shevchenko , Wolfram Sang , linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Mika Westerberg , Jan Dabros , Andi Shyti , Hans de Goede Subject: [PATCH v2 10/12] i2c: designware: Fix spelling and other issues in the comments Date: Thu, 9 Nov 2023 20:19:20 +0200 Message-ID: <20231109182823.3531846-11-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.40.0.1996.gbec44491f096 In-Reply-To: <20231109182823.3531846-1-andriy.shevchenko@linux.intel.com> References: <20231109182823.3531846-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Thu, 09 Nov 2023 10:29:52 -0800 (PST) X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1782112176253615566 X-GMAIL-MSGID: 1782112176253615566 Fix spelling and other issues, such as kernel-doc reported about, in the comments. Signed-off-by: Andy Shevchenko --- drivers/i2c/busses/i2c-designware-amdpsp.c | 10 +++++----- drivers/i2c/busses/i2c-designware-common.c | 8 +++++--- drivers/i2c/busses/i2c-designware-core.h | 10 +++++----- drivers/i2c/busses/i2c-designware-master.c | 15 +++++++++------ drivers/i2c/busses/i2c-designware-slave.c | 6 ++++-- 5 files changed, 28 insertions(+), 21 deletions(-) diff --git a/drivers/i2c/busses/i2c-designware-amdpsp.c b/drivers/i2c/busses/i2c-designware-amdpsp.c index 63454b06e5da..8fbd2a10c31a 100644 --- a/drivers/i2c/busses/i2c-designware-amdpsp.c +++ b/drivers/i2c/busses/i2c-designware-amdpsp.c @@ -155,7 +155,7 @@ static void psp_release_i2c_bus_deferred(struct work_struct *work) /* * If there is any pending transaction, cannot release the bus here. - * psp_release_i2c_bus will take care of this later. + * psp_release_i2c_bus() will take care of this later. */ if (psp_i2c_access_count) goto cleanup; @@ -210,12 +210,12 @@ static void psp_release_i2c_bus(void) { mutex_lock(&psp_i2c_access_mutex); - /* Return early if mailbox was malfunctional */ + /* Return early if mailbox was malfunctioned */ if (psp_i2c_mbox_fail) goto cleanup; /* - * If we are last owner of PSP semaphore, need to release aribtration + * If we are last owner of PSP semaphore, need to release arbitration * via mailbox. */ psp_i2c_access_count--; @@ -235,9 +235,9 @@ static void psp_release_i2c_bus(void) /* * Locking methods are based on the default implementation from - * drivers/i2c/i2c-core-base.c, but with psp acquire and release operations + * drivers/i2c/i2c-core-base.c, but with PSP acquire and release operations * added. With this in place we can ensure that i2c clients on the bus shared - * with psp are able to lock HW access to the bus for arbitrary number of + * with PSP are able to lock HW access to the bus for arbitrary number of * operations - that is e.g. write-wait-read. */ static void i2c_adapter_dw_psp_lock_bus(struct i2c_adapter *adapter, diff --git a/drivers/i2c/busses/i2c-designware-common.c b/drivers/i2c/busses/i2c-designware-common.c index 4d7dc346e619..5d4e39663438 100644 --- a/drivers/i2c/busses/i2c-designware-common.c +++ b/drivers/i2c/busses/i2c-designware-common.c @@ -126,6 +126,8 @@ static int dw_reg_write_word(void *context, unsigned int reg, unsigned int val) * Autodetects needed register access mode and creates the regmap with * corresponding read/write callbacks. This must be called before doing any * other register access. + * + * Return: 0 on success, or negative errno otherwise. */ int i2c_dw_init_regmap(struct dw_i2c_dev *dev) { @@ -173,7 +175,7 @@ int i2c_dw_init_regmap(struct dw_i2c_dev *dev) /* * Note we'll check the return value of the regmap IO accessors only * at the probe stage. The rest of the code won't do this because - * basically we have MMIO-based regmap so non of the read/write methods + * basically we have MMIO-based regmap, so none of the read/write methods * can fail. */ dev->map = devm_regmap_init(dev->dev, NULL, dev, &map_cfg); @@ -335,7 +337,7 @@ static u32 i2c_dw_acpi_round_bus_speed(struct device *device) acpi_speed = i2c_acpi_find_bus_speed(device); /* - * Some DSTDs use a non standard speed, round down to the lowest + * Some DSDTs use a non standard speed, round down to the lowest * standard speed. */ for (i = 0; i < ARRAY_SIZE(supported_speeds); i++) { @@ -531,7 +533,7 @@ void __i2c_dw_disable(struct dw_i2c_dev *dev) /* * Wait 10 times the signaling period of the highest I2C - * transfer supported by the driver (for 400KHz this is + * transfer supported by the driver (for 400kHz this is * 25us) as described in the DesignWare I2C databook. */ usleep_range(25, 250); diff --git a/drivers/i2c/busses/i2c-designware-core.h b/drivers/i2c/busses/i2c-designware-core.h index a2731179a42b..9f8e5bf61ec0 100644 --- a/drivers/i2c/busses/i2c-designware-core.h +++ b/drivers/i2c/busses/i2c-designware-core.h @@ -142,10 +142,10 @@ #define DW_IC_SLAVE 1 /* - * Hardware abort codes from the DW_IC_TX_ABRT_SOURCE register + * Hardware abort codes from the DW_IC_TX_ABRT_SOURCE register. * - * Only expected abort codes are listed here - * refer to the datasheet for the full list + * Only expected abort codes are listed here, + * refer to the datasheet for the full list. */ #define ABRT_7B_ADDR_NOACK 0 #define ABRT_10ADDR1_NOACK 1 @@ -200,7 +200,7 @@ struct reset_control; * @rst: optional reset for the controller * @slave: represent an I2C slave device * @get_clk_rate_khz: callback to retrieve IP specific bus speed - * @cmd_err: run time hadware error code + * @cmd_err: run time hardware error code * @msgs: points to an array of messages currently being transferred * @msgs_num: the number of elements in msgs * @msg_write_idx: the element index of the current tx message in the msgs array @@ -235,7 +235,7 @@ struct reset_control; * @release_lock: function to release a hardware lock on the bus * @semaphore_idx: Index of table with semaphore type attached to the bus. It's * -1 if there is no semaphore. - * @shared_with_punit: true if this bus is shared with the SoCs PUNIT + * @shared_with_punit: true if this bus is shared with the SoC's PUNIT * @disable: function to disable the controller * @init: function to initialize the I2C hardware * @set_sda_hold_time: callback to retrieve IP specific SDA hold timing diff --git a/drivers/i2c/busses/i2c-designware-master.c b/drivers/i2c/busses/i2c-designware-master.c index 0b6576d7f811..9d06dd7ffe37 100644 --- a/drivers/i2c/busses/i2c-designware-master.c +++ b/drivers/i2c/busses/i2c-designware-master.c @@ -168,12 +168,14 @@ static int i2c_dw_set_timings_master(struct dw_i2c_dev *dev) } /** - * i2c_dw_init_master() - Initialize the designware I2C master hardware + * i2c_dw_init_master() - Initialize the DesignWare I2C master hardware * @dev: device private data * * This functions configures and enables the I2C master. * This function is called during I2C init function, and in case of timeout at * run time. + * + * Return: 0 on success, or negative errno otherwise. */ static int i2c_dw_init_master(struct dw_i2c_dev *dev) { @@ -314,7 +316,7 @@ static int amd_i2c_dw_xfer_quirk(struct i2c_adapter *adap, struct i2c_msg *msgs, /* * Initiate the i2c read/write transaction of buffer length, * and poll for bus busy status. For the last message transfer, - * update the command with stopbit enable. + * update the command with stop bit enable. */ for (msg_itr_lmt = buf_len; msg_itr_lmt > 0; msg_itr_lmt--) { if (msg_wrt_idx == num_msgs - 1 && msg_itr_lmt == 1) @@ -421,7 +423,7 @@ static int txgbe_i2c_dw_xfer_quirk(struct i2c_adapter *adap, struct i2c_msg *msg /* * Initiate (and continue) low level master read/write transaction. - * This function is only called from i2c_dw_isr, and pumping i2c_msg + * This function is only called from i2c_dw_isr(), and pumping i2c_msg * messages into the tx buffer. Even if the size of i2c_msg data is * longer than the size of the tx buffer, it handles everything. */ @@ -459,7 +461,8 @@ i2c_dw_xfer_msg(struct dw_i2c_dev *dev) buf = msgs[dev->msg_write_idx].buf; buf_len = msgs[dev->msg_write_idx].len; - /* If both IC_EMPTYFIFO_HOLD_MASTER_EN and + /* + * If both IC_EMPTYFIFO_HOLD_MASTER_EN and * IC_RESTART_EN are set, we must manually * set restart bit between messages. */ @@ -949,7 +952,7 @@ static int i2c_dw_init_recovery_info(struct dw_i2c_dev *dev) rinfo->unprepare_recovery = i2c_dw_unprepare_recovery; adap->bus_recovery_info = rinfo; - dev_info(dev->dev, "running with gpio recovery mode! scl%s", + dev_info(dev->dev, "running with GPIO recovery mode! scl%s", rinfo->sda_gpiod ? ",sda" : ""); return 0; @@ -1054,7 +1057,7 @@ int i2c_dw_probe_master(struct dw_i2c_dev *dev) ret = devm_request_irq(dev->dev, dev->irq, i2c_dw_isr, irq_flags, dev_name(dev->dev), dev); if (ret) { - dev_err(dev->dev, "failure requesting irq %i: %d\n", + dev_err(dev->dev, "failure requesting IRQ %i: %d\n", dev->irq, ret); return ret; } diff --git a/drivers/i2c/busses/i2c-designware-slave.c b/drivers/i2c/busses/i2c-designware-slave.c index 70d183fa3bff..0fa3a3d7a724 100644 --- a/drivers/i2c/busses/i2c-designware-slave.c +++ b/drivers/i2c/busses/i2c-designware-slave.c @@ -32,12 +32,14 @@ static void i2c_dw_configure_fifo_slave(struct dw_i2c_dev *dev) } /** - * i2c_dw_init_slave() - Initialize the designware i2c slave hardware + * i2c_dw_init_slave() - Initialize the DesignWare i2c slave hardware * @dev: device private data * * This function configures and enables the I2C in slave mode. * This function is called during I2C init function, and in case of timeout at * run time. + * + * Return: 0 on success, or negative errno otherwise. */ static int i2c_dw_init_slave(struct dw_i2c_dev *dev) { @@ -265,7 +267,7 @@ int i2c_dw_probe_slave(struct dw_i2c_dev *dev) ret = devm_request_irq(dev->dev, dev->irq, i2c_dw_isr_slave, IRQF_SHARED, dev_name(dev->dev), dev); if (ret) { - dev_err(dev->dev, "failure requesting irq %i: %d\n", + dev_err(dev->dev, "failure requesting IRQ %i: %d\n", dev->irq, ret); return ret; } From patchwork Thu Nov 9 18:19:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 163542 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b129:0:b0:403:3b70:6f57 with SMTP id q9csp625571vqs; Thu, 9 Nov 2023 10:29:31 -0800 (PST) X-Google-Smtp-Source: AGHT+IFyhAQ/CaCW929PU8lyZoNE34wgjx2dnp/jobamsn/u4I+rFiDme5Ofyihmbzsgx0GxNSLB X-Received: by 2002:a17:90b:17ce:b0:280:145d:510d with SMTP id me14-20020a17090b17ce00b00280145d510dmr2490854pjb.31.1699554571599; Thu, 09 Nov 2023 10:29:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699554571; cv=none; d=google.com; s=arc-20160816; b=lzJGo4LmoE0LOvdz0tiCGzEVRvSx6JPmehKDB/ikq8o2b9vA/si8ycQRH+bcakz9dE PcprspxhjE5L+SB1N2inH02tRK7CY+F6JvpHM5duxa8qhHHCvLgyjUyKmmFKv6CVOBwH ngGxMNYiMjIhSxYLfu2M8onZtkNW3G98x7LOxkxTpmygHe0CdaqxcKCPHj1PhbK48EjG ikZTdivDWiaKdsqYAcANEg7h5AQFGpfHKmfClajtvVIlT3JHgdTLoP4ECp0f9rEkwM45 qO2qXTnKLbxdeZ3fjtVazakpiaBbTOh1iy3Tp1CsUN8CXnz5YSuVjFhmwvCHh7NB0ui6 xSpA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=a3JmKnu6LSzY03FtaJazvbz6HY7IEezGoNrB0BSqW2E=; fh=mq6/FMGJdqTI0UuZRoAMccy9L/KbJAT6TPJFW+BrH4Y=; b=By119JL2UvyNlJPwQ9oty5YGyqFDK5Ue2/fWSDJvgOPsrTmF3CH2zNbqqBek9tyEJn VOIqAofouLpAZCwOl2wWLu6f2e/X64fNj7A5gUDNfzao4yXRW7+KL4O9q8UCh2z3Mzho c9e3udnsMfGmva6jTBxqdL+eTojvY0xnYSxYIUuW3ihqURUGNLah2aAUlYtgelVd8qV7 PAGXr82/ri0mvEFeTSR2FYurr6qoRwy38v4pkZTVYACiGj/hax41vxBZrf3lWqHSKCJz iqJwKqhf+pmGp7PW80P3eyIXnqyI2qSTCxzBlZ2I3KOiGWgtqe/2l4fVXpFPS45DvXH/ 3v7w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=PI3ARvF1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id mw16-20020a17090b4d1000b00274e5b20e65si2326238pjb.50.2023.11.09.10.29.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Nov 2023 10:29:31 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=PI3ARvF1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 1C81A838F87A; Thu, 9 Nov 2023 10:29:13 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345020AbjKIS3G (ORCPT + 31 others); Thu, 9 Nov 2023 13:29:06 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33466 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345023AbjKIS2o (ORCPT ); Thu, 9 Nov 2023 13:28:44 -0500 Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.126]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5F5A83C10; Thu, 9 Nov 2023 10:28:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1699554521; x=1731090521; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Op42QzcX29hTZKyxHgP0Z66kpzENonKgZWt0vi7oOwE=; b=PI3ARvF1I8CIboEmFgiga+3aH6RIxT6IYpDIzkOHPFk4g+2Zh9PlxMnT y7FNTlQJb+7Qy+rhoexP/I1QjQpfFQONQhdL77JQ4rSzsKPxg3nK2MjMO mTOzfZOxuFeKah6n0Hcb5ZOL3mu+TD0Qno38sSJ8r/w1+DDP8gFoya7HJ rO7NkPReVkWqFjk7R3+VHaBgTkFTWjuhzKWqngpwEJOHM5kDf+AiQtDVk I39Hhp1f08tqVawe0iE2FHApCg5evjutApXj4A1CLrJbtWwbbUW8aENiw miwKUotQHZ5W5OuuZr4kJHle9UAoFsiRK2FQyJfO+T1R1l4PyVVOC5vk+ A==; X-IronPort-AV: E=McAfee;i="6600,9927,10889"; a="375088706" X-IronPort-AV: E=Sophos;i="6.03,290,1694761200"; d="scan'208";a="375088706" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Nov 2023 10:28:40 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10889"; a="767086850" X-IronPort-AV: E=Sophos;i="6.03,290,1694761200"; d="scan'208";a="767086850" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga007.fm.intel.com with ESMTP; 09 Nov 2023 10:28:37 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id DE3E9823; Thu, 9 Nov 2023 20:28:32 +0200 (EET) From: Andy Shevchenko To: Jarkko Nikula , Herbert Xu , Mario Limonciello , Andy Shevchenko , Wolfram Sang , linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Mika Westerberg , Jan Dabros , Andi Shyti , Hans de Goede Subject: [PATCH v2 11/12] i2c: designware: Remove ->disable() callback Date: Thu, 9 Nov 2023 20:19:21 +0200 Message-ID: <20231109182823.3531846-12-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.40.0.1996.gbec44491f096 In-Reply-To: <20231109182823.3531846-1-andriy.shevchenko@linux.intel.com> References: <20231109182823.3531846-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Thu, 09 Nov 2023 10:29:13 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1782112134473448592 X-GMAIL-MSGID: 1782112134473448592 Commit 90312351fd1e ("i2c: designware: MASTER mode as separated driver") introduced ->disable() callback but there is no real use for it. Both i2c-designware-master.c and i2c-designware-slave.c set it to the same i2c_dw_disable() and scope is inside the same kernel module. That said, replace the callback by explicitly calling the i2c_dw_disable(). Signed-off-by: Andy Shevchenko --- drivers/i2c/busses/i2c-designware-core.h | 2 -- drivers/i2c/busses/i2c-designware-master.c | 1 - drivers/i2c/busses/i2c-designware-pcidrv.c | 5 +++-- drivers/i2c/busses/i2c-designware-platdrv.c | 4 ++-- drivers/i2c/busses/i2c-designware-slave.c | 1 - 5 files changed, 5 insertions(+), 8 deletions(-) diff --git a/drivers/i2c/busses/i2c-designware-core.h b/drivers/i2c/busses/i2c-designware-core.h index 9f8e5bf61ec0..a22f2cd5faf8 100644 --- a/drivers/i2c/busses/i2c-designware-core.h +++ b/drivers/i2c/busses/i2c-designware-core.h @@ -236,7 +236,6 @@ struct reset_control; * @semaphore_idx: Index of table with semaphore type attached to the bus. It's * -1 if there is no semaphore. * @shared_with_punit: true if this bus is shared with the SoC's PUNIT - * @disable: function to disable the controller * @init: function to initialize the I2C hardware * @set_sda_hold_time: callback to retrieve IP specific SDA hold timing * @mode: operation mode - DW_IC_MASTER or DW_IC_SLAVE @@ -293,7 +292,6 @@ struct dw_i2c_dev { void (*release_lock)(void); int semaphore_idx; bool shared_with_punit; - void (*disable)(struct dw_i2c_dev *dev); int (*init)(struct dw_i2c_dev *dev); int (*set_sda_hold_time)(struct dw_i2c_dev *dev); int mode; diff --git a/drivers/i2c/busses/i2c-designware-master.c b/drivers/i2c/busses/i2c-designware-master.c index 9d06dd7ffe37..4ef4160db01f 100644 --- a/drivers/i2c/busses/i2c-designware-master.c +++ b/drivers/i2c/busses/i2c-designware-master.c @@ -993,7 +993,6 @@ int i2c_dw_probe_master(struct dw_i2c_dev *dev) init_completion(&dev->cmd_complete); dev->init = i2c_dw_init_master; - dev->disable = i2c_dw_disable; ret = i2c_dw_init_regmap(dev); if (ret) diff --git a/drivers/i2c/busses/i2c-designware-pcidrv.c b/drivers/i2c/busses/i2c-designware-pcidrv.c index 68c2e1a3a035..b8bf4ae4fab1 100644 --- a/drivers/i2c/busses/i2c-designware-pcidrv.c +++ b/drivers/i2c/busses/i2c-designware-pcidrv.c @@ -198,7 +198,7 @@ static int __maybe_unused i2c_dw_pci_runtime_suspend(struct device *dev) { struct dw_i2c_dev *i_dev = dev_get_drvdata(dev); - i_dev->disable(i_dev); + i2c_dw_disable(i_dev); return 0; } @@ -345,7 +345,8 @@ static void i2c_dw_pci_remove(struct pci_dev *pdev) { struct dw_i2c_dev *dev = pci_get_drvdata(pdev); - dev->disable(dev); + i2c_dw_disable(dev); + pm_runtime_forbid(&pdev->dev); pm_runtime_get_noresume(&pdev->dev); diff --git a/drivers/i2c/busses/i2c-designware-platdrv.c b/drivers/i2c/busses/i2c-designware-platdrv.c index 92e9199a5fdb..d7c39ef16a32 100644 --- a/drivers/i2c/busses/i2c-designware-platdrv.c +++ b/drivers/i2c/busses/i2c-designware-platdrv.c @@ -331,7 +331,7 @@ static void dw_i2c_plat_remove(struct platform_device *pdev) i2c_del_adapter(&dev->adapter); - dev->disable(dev); + i2c_dw_disable(dev); pm_runtime_dont_use_autosuspend(&pdev->dev); pm_runtime_put_sync(&pdev->dev); @@ -360,7 +360,7 @@ static int dw_i2c_plat_runtime_suspend(struct device *dev) if (i_dev->shared_with_punit) return 0; - i_dev->disable(i_dev); + i2c_dw_disable(i_dev); i2c_dw_prepare_clk(i_dev, false); return 0; diff --git a/drivers/i2c/busses/i2c-designware-slave.c b/drivers/i2c/busses/i2c-designware-slave.c index 0fa3a3d7a724..8921f6d49129 100644 --- a/drivers/i2c/busses/i2c-designware-slave.c +++ b/drivers/i2c/busses/i2c-designware-slave.c @@ -239,7 +239,6 @@ int i2c_dw_probe_slave(struct dw_i2c_dev *dev) int ret; dev->init = i2c_dw_init_slave; - dev->disable = i2c_dw_disable; ret = i2c_dw_init_regmap(dev); if (ret) From patchwork Thu Nov 9 18:19:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 163543 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b129:0:b0:403:3b70:6f57 with SMTP id q9csp625569vqs; Thu, 9 Nov 2023 10:29:31 -0800 (PST) X-Google-Smtp-Source: AGHT+IEJpmgoH5u2zzl7uAS+h6fBNCMyGN5Dh1jXId7+8T17iOTt6nD+stsfLt5/GBTmyxQsPO+8 X-Received: by 2002:a05:6a21:7746:b0:147:fd40:2482 with SMTP id bc6-20020a056a21774600b00147fd402482mr5503492pzc.44.1699554571588; Thu, 09 Nov 2023 10:29:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699554571; cv=none; d=google.com; s=arc-20160816; b=AO28quCJLRaxqWxOChkUnEca58Pup65t9uO23+d0lxlRzKrrajpfYXz2i0GTTmsKrR Mfy6Hy2AGW+91Ui8qQnU2ePRxNcjzrKpQ69CiqOJxWfrStZk+YzrIK08m5HV3+bcXxEp 9NGnBWC9Zp449HHiC37UNpyE98v8ggphimzHsrrU96tAqh4ps+4oZ0+qBtu/gtkjx7ac ksRP25nQK7vBdwgLajZ9szi4zl0uuf+Am5YJEjhvgXSaXHaBGfP8i7Hnb9Povbu2Ojoc Fx938BkGoNU0mGGHQglB5CANp2gDZJPlxFf2pcqt3W2qBfBgPML4M9UxL+aYoTZ8ZmB+ MvWg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=ijYWhMZNe1FE6gCtsDUZbB7c9UBQcLbQ+ha5FXDOEik=; fh=mq6/FMGJdqTI0UuZRoAMccy9L/KbJAT6TPJFW+BrH4Y=; b=XfSttiggrbNNkIr/tyFIP7zWM5mmpcF1EihRDP9m0YJuuppArH+DT4E3lzDRZz72hN JdpArkSUJWxY64n86GGuzNMPNw4+fPVa9eqS/lfaymO4fYDK0hChq6E3LPU0bEU6yi0o OeA7q/VxMf0blsGdmOYE4bGCt3Qa969SG6DpmzYe2rxP+QddL/Dtea2ZpZN8jbRT6RPj ofaCbAMI7l7nF3bYRW7pVUjGFD+DBCjbJg2WPaIj4faOjA5mKAwOxxV8HdnZpbmd+MFo 0nCmp4gkkcWtmHBYlsjgBG6MWWOavXDfoJ6iLfqFlmQlzWU77GLyWtb30EALetY68Rgv 07gA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=RGmsllt1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id kw12-20020a170902f90c00b001c5db1e47c3si4842344plb.553.2023.11.09.10.29.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Nov 2023 10:29:31 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=RGmsllt1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 21AAB838F87D; Thu, 9 Nov 2023 10:29:13 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345075AbjKIS3C (ORCPT + 31 others); Thu, 9 Nov 2023 13:29:02 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33440 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345005AbjKIS2n (ORCPT ); Thu, 9 Nov 2023 13:28:43 -0500 Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.126]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 31B753C0D; Thu, 9 Nov 2023 10:28:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1699554521; x=1731090521; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=oNm2DTRGW/g8DUNG7uMus55v6HP+IhXbZeTsiinxui0=; b=RGmsllt1d4omf3yV2sQHzyS2quA55sPfVgnP3VkHB5V0gX0TXxt/mrVc eVG+rYd2taNOhIZpSTlgkRdkdsvj0E6NMSCy4Z1Y9iuVPN7hUTvCGlfLG MBv5I7z1cgRFyvwR2ZgmKVyH0AyGFjyY5L5vfq4E/NCyrB6jnsJ7dEt46 honAZQ+VfxArFBMWxI8xNz6fNcVDhkUIVg2I0cL+HeP43yeFffXOO5g41 Abgan43eEeitUF48uOUl32GxAiD7UKLd5cV/uJvqiXoDpUFWAdHNOvySs 8UweHi0EHxptkJV4GsG7Gr3NH4UyQ1Qc0DR4zeICbrkLX+UyBFeThEZ5U w==; X-IronPort-AV: E=McAfee;i="6600,9927,10889"; a="375088709" X-IronPort-AV: E=Sophos;i="6.03,290,1694761200"; d="scan'208";a="375088709" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Nov 2023 10:28:40 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10889"; a="767086855" X-IronPort-AV: E=Sophos;i="6.03,290,1694761200"; d="scan'208";a="767086855" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga007.fm.intel.com with ESMTP; 09 Nov 2023 10:28:37 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id F1AA7845; Thu, 9 Nov 2023 20:28:32 +0200 (EET) From: Andy Shevchenko To: Jarkko Nikula , Herbert Xu , Mario Limonciello , Andy Shevchenko , Wolfram Sang , linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Mika Westerberg , Jan Dabros , Andi Shyti , Hans de Goede Subject: [PATCH v2 12/12] i2c: designware: Consolidate PM ops Date: Thu, 9 Nov 2023 20:19:22 +0200 Message-ID: <20231109182823.3531846-13-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.40.0.1996.gbec44491f096 In-Reply-To: <20231109182823.3531846-1-andriy.shevchenko@linux.intel.com> References: <20231109182823.3531846-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Thu, 09 Nov 2023 10:29:13 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1782112134378946160 X-GMAIL-MSGID: 1782112134378946160 We have the same (*) PM ops in the PCI and plaform drivers. Instead, consolidate that PM ops under exported variable and deduplicate them. *) With the subtle ACPI and P-Unit behaviour differences in PCI case. But this is not a problem as for ACPI we need to take care of the P-Unit semaphore anyway and calling PM ops for ACPI makes sense as it might provide specific operation regions in (however there are no known devices on market that are using it with PCI enabled I2C). Note, the clocks are not in use in the PCI case. Signed-off-by: Andy Shevchenko --- drivers/i2c/busses/i2c-designware-common.c | 62 ++++++++++++++++++++ drivers/i2c/busses/i2c-designware-core.h | 4 +- drivers/i2c/busses/i2c-designware-pcidrv.c | 44 +------------- drivers/i2c/busses/i2c-designware-platdrv.c | 63 +-------------------- 4 files changed, 68 insertions(+), 105 deletions(-) diff --git a/drivers/i2c/busses/i2c-designware-common.c b/drivers/i2c/busses/i2c-designware-common.c index 5d4e39663438..c211693d760f 100644 --- a/drivers/i2c/busses/i2c-designware-common.c +++ b/drivers/i2c/busses/i2c-designware-common.c @@ -21,6 +21,7 @@ #include #include #include +#include #include #include #include @@ -714,5 +715,66 @@ void i2c_dw_disable(struct dw_i2c_dev *dev) i2c_dw_release_lock(dev); } +static int i2c_dw_prepare(struct device *device) +{ + /* + * If the ACPI companion device object is present for this device, + * it may be accessed during suspend and resume of other devices via + * I2C operation regions, so tell the PM core and middle layers to + * avoid skipping system suspend/resume callbacks for it in that case. + */ + return !has_acpi_companion(device); +} + +static int i2c_dw_runtime_suspend(struct device *device) +{ + struct dw_i2c_dev *dev = dev_get_drvdata(device); + + if (dev->shared_with_punit) + return 0; + + i2c_dw_disable(dev); + i2c_dw_prepare_clk(dev, false); + + return 0; +} + +static int i2c_dw_suspend(struct device *device) +{ + struct dw_i2c_dev *dev = dev_get_drvdata(device); + + i2c_mark_adapter_suspended(&dev->adapter); + + return i2c_dw_runtime_suspend(device); +} + +static int i2c_dw_runtime_resume(struct device *device) +{ + struct dw_i2c_dev *dev = dev_get_drvdata(device); + + if (!dev->shared_with_punit) + i2c_dw_prepare_clk(dev, true); + + dev->init(dev); + + return 0; +} + +static int i2c_dw_resume(struct device *device) +{ + struct dw_i2c_dev *dev = dev_get_drvdata(device); + + i2c_dw_runtime_resume(device); + i2c_mark_adapter_resumed(&dev->adapter); + + return 0; +} + +EXPORT_GPL_DEV_PM_OPS(i2c_dw_dev_pm_ops) = { + .prepare = pm_sleep_ptr(i2c_dw_prepare), + LATE_SYSTEM_SLEEP_PM_OPS(i2c_dw_suspend, i2c_dw_resume) + RUNTIME_PM_OPS(i2c_dw_runtime_suspend, i2c_dw_runtime_resume, NULL) +}; + MODULE_DESCRIPTION("Synopsys DesignWare I2C bus adapter core"); MODULE_LICENSE("GPL"); diff --git a/drivers/i2c/busses/i2c-designware-core.h b/drivers/i2c/busses/i2c-designware-core.h index a22f2cd5faf8..399b4304e215 100644 --- a/drivers/i2c/busses/i2c-designware-core.h +++ b/drivers/i2c/busses/i2c-designware-core.h @@ -335,7 +335,8 @@ int i2c_dw_wait_bus_not_busy(struct dw_i2c_dev *dev); int i2c_dw_handle_tx_abort(struct dw_i2c_dev *dev); int i2c_dw_set_fifo_size(struct dw_i2c_dev *dev); u32 i2c_dw_func(struct i2c_adapter *adap); -void i2c_dw_disable(struct dw_i2c_dev *dev); + +extern const struct dev_pm_ops i2c_dw_dev_pm_ops; static inline void __i2c_dw_enable(struct dw_i2c_dev *dev) { @@ -350,6 +351,7 @@ static inline void __i2c_dw_disable_nowait(struct dw_i2c_dev *dev) } void __i2c_dw_disable(struct dw_i2c_dev *dev); +void i2c_dw_disable(struct dw_i2c_dev *dev); extern void i2c_dw_configure_master(struct dw_i2c_dev *dev); extern int i2c_dw_probe_master(struct dw_i2c_dev *dev); diff --git a/drivers/i2c/busses/i2c-designware-pcidrv.c b/drivers/i2c/busses/i2c-designware-pcidrv.c index b8bf4ae4fab1..afe85599ed1a 100644 --- a/drivers/i2c/busses/i2c-designware-pcidrv.c +++ b/drivers/i2c/busses/i2c-designware-pcidrv.c @@ -19,6 +19,7 @@ #include #include #include +#include #include #include #include @@ -194,47 +195,6 @@ static struct dw_pci_controller dw_pci_controllers[] = { }, }; -static int __maybe_unused i2c_dw_pci_runtime_suspend(struct device *dev) -{ - struct dw_i2c_dev *i_dev = dev_get_drvdata(dev); - - i2c_dw_disable(i_dev); - return 0; -} - -static int __maybe_unused i2c_dw_pci_suspend(struct device *dev) -{ - struct dw_i2c_dev *i_dev = dev_get_drvdata(dev); - - i2c_mark_adapter_suspended(&i_dev->adapter); - - return i2c_dw_pci_runtime_suspend(dev); -} - -static int __maybe_unused i2c_dw_pci_runtime_resume(struct device *dev) -{ - struct dw_i2c_dev *i_dev = dev_get_drvdata(dev); - - return i_dev->init(i_dev); -} - -static int __maybe_unused i2c_dw_pci_resume(struct device *dev) -{ - struct dw_i2c_dev *i_dev = dev_get_drvdata(dev); - int ret; - - ret = i2c_dw_pci_runtime_resume(dev); - - i2c_mark_adapter_resumed(&i_dev->adapter); - - return ret; -} - -static const struct dev_pm_ops i2c_dw_pm_ops = { - SET_SYSTEM_SLEEP_PM_OPS(i2c_dw_pci_suspend, i2c_dw_pci_resume) - SET_RUNTIME_PM_OPS(i2c_dw_pci_runtime_suspend, i2c_dw_pci_runtime_resume, NULL) -}; - static const struct property_entry dgpu_properties[] = { /* USB-C doesn't power the system */ PROPERTY_ENTRY_U8("scope", POWER_SUPPLY_SCOPE_DEVICE), @@ -411,7 +371,7 @@ static struct pci_driver dw_i2c_driver = { .probe = i2c_dw_pci_probe, .remove = i2c_dw_pci_remove, .driver = { - .pm = &i2c_dw_pm_ops, + .pm = pm_ptr(&i2c_dw_dev_pm_ops), }, }; module_pci_driver(dw_i2c_driver); diff --git a/drivers/i2c/busses/i2c-designware-platdrv.c b/drivers/i2c/busses/i2c-designware-platdrv.c index d7c39ef16a32..99498823563f 100644 --- a/drivers/i2c/busses/i2c-designware-platdrv.c +++ b/drivers/i2c/busses/i2c-designware-platdrv.c @@ -342,67 +342,6 @@ static void dw_i2c_plat_remove(struct platform_device *pdev) reset_control_assert(dev->rst); } -static int dw_i2c_plat_prepare(struct device *dev) -{ - /* - * If the ACPI companion device object is present for this device, it - * may be accessed during suspend and resume of other devices via I2C - * operation regions, so tell the PM core and middle layers to avoid - * skipping system suspend/resume callbacks for it in that case. - */ - return !has_acpi_companion(dev); -} - -static int dw_i2c_plat_runtime_suspend(struct device *dev) -{ - struct dw_i2c_dev *i_dev = dev_get_drvdata(dev); - - if (i_dev->shared_with_punit) - return 0; - - i2c_dw_disable(i_dev); - i2c_dw_prepare_clk(i_dev, false); - - return 0; -} - -static int dw_i2c_plat_suspend(struct device *dev) -{ - struct dw_i2c_dev *i_dev = dev_get_drvdata(dev); - - i2c_mark_adapter_suspended(&i_dev->adapter); - - return dw_i2c_plat_runtime_suspend(dev); -} - -static int dw_i2c_plat_runtime_resume(struct device *dev) -{ - struct dw_i2c_dev *i_dev = dev_get_drvdata(dev); - - if (!i_dev->shared_with_punit) - i2c_dw_prepare_clk(i_dev, true); - - i_dev->init(i_dev); - - return 0; -} - -static int dw_i2c_plat_resume(struct device *dev) -{ - struct dw_i2c_dev *i_dev = dev_get_drvdata(dev); - - dw_i2c_plat_runtime_resume(dev); - i2c_mark_adapter_resumed(&i_dev->adapter); - - return 0; -} - -static const struct dev_pm_ops dw_i2c_dev_pm_ops = { - .prepare = pm_sleep_ptr(dw_i2c_plat_prepare), - LATE_SYSTEM_SLEEP_PM_OPS(dw_i2c_plat_suspend, dw_i2c_plat_resume) - RUNTIME_PM_OPS(dw_i2c_plat_runtime_suspend, dw_i2c_plat_runtime_resume, NULL) -}; - static const struct of_device_id dw_i2c_of_match[] = { { .compatible = "snps,designware-i2c", }, { .compatible = "mscc,ocelot-i2c", .data = (void *)MODEL_MSCC_OCELOT }, @@ -444,7 +383,7 @@ static struct platform_driver dw_i2c_driver = { .name = "i2c_designware", .of_match_table = dw_i2c_of_match, .acpi_match_table = dw_i2c_acpi_match, - .pm = pm_ptr(&dw_i2c_dev_pm_ops), + .pm = pm_ptr(&i2c_dw_dev_pm_ops), }, .id_table = dw_i2c_platform_ids, };