Message ID | 20231110182304.3894319-2-andriy.shevchenko@linux.intel.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b129:0:b0:403:3b70:6f57 with SMTP id q9csp1320014vqs; Fri, 10 Nov 2023 11:01:45 -0800 (PST) X-Google-Smtp-Source: AGHT+IEcwY86xAtX3/l3qCHpPe4m1nyRVTsZwS6oa/wWc3e6IC78bZBR0uujEG8RrwB3aun/LzSa X-Received: by 2002:a05:6a00:124d:b0:692:af9c:d96f with SMTP id u13-20020a056a00124d00b00692af9cd96fmr9088062pfi.1.1699642905192; Fri, 10 Nov 2023 11:01:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699642905; cv=none; d=google.com; s=arc-20160816; b=jK+VCnIhp3HPPjRsudKpW1DhSB9YpJMuIVe8TzBpNDER3BjsE43qCIJIZuMSGy1gom 8AqagWlsF1JR/JpeKu+a4YKsHImlWci7OXu6OotopploFwMzftk3BYNhuFr1f1HhpUJl s3mKkAF/Hd72A9aNytMjdZRw6cQrx4TIDoNvkRluk5VKtqhrGIBOOZs51Q+G06JMVB+e yXeF4Cnb1XxsbDeJUqYfn1iuFKaNGe9dv7Gmqrb8sO+dq0wwt89jKlSMjnNCPHgcm1b3 tMBYZJwGowyxv4PiILZx5cy4Zl+DW7mJM3SjTvrjTFT//Fs+1+7Sv+iBbstu39l8M/gt N9hg== 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=TbEBGZmK6OQWVs3P1GXX1cKUMsa7Nm80oXELaZ625Rs=; fh=oqZDtrV02dtzkTHSBiwo+TWR13WhTCI6t34Q5J0VV5o=; b=BiG+8fV2Ysc8/OI6YlI6qfNFSWldhzw/MUDYPHm1PnBAL3GarlhFnPuoaFnTHOeJkM PkHalG85+YvDQ5GzasxseZS9EEzQlieY5vKBmUx0TnSyE8zY4ZIdTq+uTGH1/6yqPGtD btrWWg6Bn4csrPAH9TqjrUatoakQXJo4DY1mZta2L8qPiceQVf6D02pagmwRXLDlL0Fq I9+a6EtxR/ZxLbGkHXfajGn1sjTjeJIgzcaxP3uKgLFNTq3C6Awx+eC7A3VbogGsqm3y KDJn3Reshe8/iVgVJKH/BdMr36/bmmQsZu+T5vVj9wyRGhf0onbCq9SDsk8W5u1nm2pq tuhw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="it9/+yVV"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 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 agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id v202-20020a6361d3000000b0055c1760dd8esi11127pgb.380.2023.11.10.11.01.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Nov 2023 11:01:45 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="it9/+yVV"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 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 agentk.vger.email (Postfix) with ESMTP id 34318819E158; Fri, 10 Nov 2023 11:01:40 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236010AbjKJTBN (ORCPT <rfc822;heyuhang3455@gmail.com> + 29 others); Fri, 10 Nov 2023 14:01:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46186 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235960AbjKJTAx (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Fri, 10 Nov 2023 14:00:53 -0500 Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.126]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6028E1DF61; Fri, 10 Nov 2023 10:24:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1699640658; x=1731176658; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=XYkHs7aZvf3egWebqSD+gvG236t4GW5jLlJ3MZImh9A=; b=it9/+yVVYyBy/PrYEI2uQKo5R9TLjBAICtpovst4vTXyT2SEgJsqTqV2 dskota8ZhMFJrzuBTVqoccEQaRrfxe3F01Lf3WjXCjFkTpgf5HiOyiPNN QVwVhMZ1/B/A4R6ryfSCpmZSJ1YyBoQ2tyoYiI4r52klyNdpTcyHVSRGX ciWxyIET6cRb9c5Uikwga2dCCTMC2IU4ar89zPMOnjYmxZ+0lFDKx2c/W qr4YD2iHR7eU8hvLjho/jJOB3eMv1/mTTbpBbF28aXe9ByB8Z1NVLR35Y sl/q3ui/x/8GcMVSJNJOu+L/PeS4hRtVomeAGQSOTBVvA/bjPaKOghinV Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10890"; a="375251887" X-IronPort-AV: E=Sophos;i="6.03,291,1694761200"; d="scan'208";a="375251887" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Nov 2023 10:23:15 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10890"; a="798663739" X-IronPort-AV: E=Sophos;i="6.03,291,1694761200"; d="scan'208";a="798663739" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga001.jf.intel.com with ESMTP; 10 Nov 2023 10:23:08 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id 57E4414F; Fri, 10 Nov 2023 20:23:07 +0200 (EET) From: Andy Shevchenko <andriy.shevchenko@linux.intel.com> To: Jarkko Nikula <jarkko.nikula@linux.intel.com>, Mario Limonciello <mario.limonciello@amd.com>, Herbert Xu <herbert@gondor.apana.org.au>, Andy Shevchenko <andriy.shevchenko@linux.intel.com>, Wolfram Sang <wsa@kernel.org>, linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Mika Westerberg <mika.westerberg@linux.intel.com>, Jan Dabros <jsd@semihalf.com>, Andi Shyti <andi.shyti@kernel.org>, Philipp Zabel <p.zabel@pengutronix.de>, Hans de Goede <hdegoede@redhat.com> Subject: [PATCH v3 01/25] i2c: designware: Delete adapter before disabling in i2c_dw_pci_remove() Date: Fri, 10 Nov 2023 20:11:21 +0200 Message-ID: <20231110182304.3894319-2-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.43.0.rc1.1.gbec44491f096 In-Reply-To: <20231110182304.3894319-1-andriy.shevchenko@linux.intel.com> References: <20231110182304.3894319-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 agentk.vger.email Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Fri, 10 Nov 2023 11:01:40 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1782204759359611770 X-GMAIL-MSGID: 1782204759359611770 |
Series |
i2c: designware: code consolidation & cleanups
|
|
Commit Message
Andy Shevchenko
Nov. 10, 2023, 6:11 p.m. UTC
Make i2c_dw_pci_remove() to be aligned with dw_i2c_plat_remove() on
the sequence of the ceasing I²C operations.
Fixes: 18dbdda89f5c ("i2c-designware: Add runtime power management support")
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
drivers/i2c/busses/i2c-designware-pcidrv.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
Comments
On 11/10/23 20:11, Andy Shevchenko wrote: > Make i2c_dw_pci_remove() to be aligned with dw_i2c_plat_remove() on > the sequence of the ceasing I²C operations. > > Fixes: 18dbdda89f5c ("i2c-designware: Add runtime power management support") I think this is wrong. Commit 18dbdda89f5c is 12 years ago so is this patch really fixing a real bug that was hiding all these years? > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> > --- > drivers/i2c/busses/i2c-designware-pcidrv.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/drivers/i2c/busses/i2c-designware-pcidrv.c b/drivers/i2c/busses/i2c-designware-pcidrv.c > index 61d7a27aa070..35d35d7c8e23 100644 > --- a/drivers/i2c/busses/i2c-designware-pcidrv.c > +++ b/drivers/i2c/busses/i2c-designware-pcidrv.c > @@ -354,11 +354,13 @@ static void i2c_dw_pci_remove(struct pci_dev *pdev) > { > struct dw_i2c_dev *dev = pci_get_drvdata(pdev); > > + i2c_del_adapter(&dev->adapter); > + > dev->disable(dev); > + > pm_runtime_forbid(&pdev->dev); > pm_runtime_get_noresume(&pdev->dev); > > - i2c_del_adapter(&dev->adapter); > devm_free_irq(&pdev->dev, dev->irq, dev); > pci_free_irq_vectors(pdev); > } Then I believe this patch may potentially introduce a bug. As far as I can see nothing wrong regarding adapter deletion after the commit 18dbdda89f5c: i2c_dw_pci_probe() { ... i2c_add_numbered_adapter() pm_runtime_enable_stuff() ... } i2c_dw_pci_remove() { ... pm_runtime_disable_stuff() i2c_del_adapter() ... } Order is still practically the same in current i2c-designware-pcidrv.c code but after this patch disabling/deletion is not done in reverse order.
On Wed, Nov 15, 2023 at 11:45:10AM +0200, Jarkko Nikula wrote: > On 11/10/23 20:11, Andy Shevchenko wrote: > > Make i2c_dw_pci_remove() to be aligned with dw_i2c_plat_remove() on > > the sequence of the ceasing I²C operations. > > > > Fixes: 18dbdda89f5c ("i2c-designware: Add runtime power management support") > > I think this is wrong. Commit 18dbdda89f5c is 12 years ago so is this patch > really fixing a real bug that was hiding all these years? Why not? But let me check more careful the ordering between two and probe.
diff --git a/drivers/i2c/busses/i2c-designware-pcidrv.c b/drivers/i2c/busses/i2c-designware-pcidrv.c index 61d7a27aa070..35d35d7c8e23 100644 --- a/drivers/i2c/busses/i2c-designware-pcidrv.c +++ b/drivers/i2c/busses/i2c-designware-pcidrv.c @@ -354,11 +354,13 @@ static void i2c_dw_pci_remove(struct pci_dev *pdev) { struct dw_i2c_dev *dev = pci_get_drvdata(pdev); + i2c_del_adapter(&dev->adapter); + dev->disable(dev); + pm_runtime_forbid(&pdev->dev); pm_runtime_get_noresume(&pdev->dev); - i2c_del_adapter(&dev->adapter); devm_free_irq(&pdev->dev, dev->irq, dev); pci_free_irq_vectors(pdev); }