Message ID | 20231110182304.3894319-5-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 q9csp1319602vqs; Fri, 10 Nov 2023 11:01:14 -0800 (PST) X-Google-Smtp-Source: AGHT+IGeOtEPqhPRX909tmt6CHyz0A1JudAZvjt+I0v+LIYeTMLncwGSxHg5Lzy3WX1ns28oTZfN X-Received: by 2002:aca:2417:0:b0:3b2:e5c6:23bc with SMTP id n23-20020aca2417000000b003b2e5c623bcmr191671oic.52.1699642873666; Fri, 10 Nov 2023 11:01:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699642873; cv=none; d=google.com; s=arc-20160816; b=UspfF/TY7cTIJkHfcXxdUGduDaok7aQJhAVEIkyhD+ugVAK7A7xDeOxBFrWHM7eFQI F9dYeatmPVGI2UDV625njgtoizPpNsQ7BExsePaS1M2IU2kMa3Hgpo/JjpJWuDOzg6SH izH5jEXsxhSZUZqYtjer/w7E9U5o2EIZdTIF2aoxLOSYJF1I4lTW2KcREJRmPVPeR2JQ 5fcPl0Wg3SPi5FKD4F3RCtTG4e1DxBztQk/RWU5DJsucqcwW4l6EeEDYStY8GEGxHYEH jqyb4dSI7LNevwrNaAxySUXiTfjLgG32HqA7L3RVaVE5asW3QxbWGBfwOL51v9wvgKxg dudw== 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=gCCEuL5tKp0L/n/dKfTEJogYeLdtSxr5vBZhU0xevZI=; fh=oqZDtrV02dtzkTHSBiwo+TWR13WhTCI6t34Q5J0VV5o=; b=qo27X3GBC13kvmtzJ3AfNpv3z0XxUjQqfYZFvutMUaarjni9wC0/THkEfwTWhdoztZ V/ASDId6PpXdrprYkDbyuc1nLusNZ7AnIWYQDDOSH0UU8SImqP1NYsikWL5w6IaLzl13 vucz0iGxTbfYTI1OKkPvolukQSLIRtLKHEVkRtyH3lbLeH1gjGav3gyohJpeCwJIj4NH P4wcKtFxsjRFufMV1KkWH/pwHSI6OOwQT3fVJkPRKzhfh/Xm94Ab02wMbUN87HrmOcHS TxyFNZf8ML/1sw4XFjwHq1nO7GC5STw28wez0G3aBksr/+fqaPpZ1HDIDaZWcrgYlbk+ carg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=QC30o9Uf; 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 w16-20020a0568080d5000b003af5a2920a4si30434oik.58.2023.11.10.11.01.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Nov 2023 11:01:13 -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=QC30o9Uf; 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 18D3E80F8217; Fri, 10 Nov 2023 11:01:11 -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 S235879AbjKJTA7 (ORCPT <rfc822;heyuhang3455@gmail.com> + 29 others); Fri, 10 Nov 2023 14:00:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38938 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235882AbjKJTAn (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Fri, 10 Nov 2023 14:00:43 -0500 Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.126]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AA3962FEEA; Fri, 10 Nov 2023 10:24:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1699640650; x=1731176650; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=kVG773duH+EOCyTkARxisz1cA6Q+EAf5xrvsYKuVvPk=; b=QC30o9UfJC/ujHRQjt4eeus/F1M0jy2PixrxDrEETiaLY7dJqyfn0+Gv 6U93WjSkznr8N4EshzzhgnzY1WisSWXK+3h2aTUHe1/Aubs/tC7bjIfKV MH+5L7Istx1PJxjDzpCr9C9yOqWsg4Ow9rruAbge/Cs9E1ejQ3Ta6EM3A KwkV9kUFt7HX2RhdBDXYBCI4JS0Ol3wBjx3RGddbWghpC5gmeBCw1wguR lZVNhOzZTH3DWY2VsPHftRvBDuq3PuLkzPI9qSAvs84gJw7wQbjOtxU2K N7KM78y5jbXoJJUaYz438wI4FFGQHG4ocup9ec2o+lLvFz0M5eTcXoUjf A==; X-IronPort-AV: E=McAfee;i="6600,9927,10890"; a="375251895" X-IronPort-AV: E=Sophos;i="6.03,291,1694761200"; d="scan'208";a="375251895" 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="798663738" X-IronPort-AV: E=Sophos;i="6.03,291,1694761200"; d="scan'208";a="798663738" 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 844637C4; 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 04/25] i2c: designware: Let PCI core to take care about interrupt vectors Date: Fri, 10 Nov 2023 20:11:24 +0200 Message-ID: <20231110182304.3894319-5-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-Transfer-Encoding: 8bit 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 (lipwig.vger.email [0.0.0.0]); Fri, 10 Nov 2023 11:01:11 -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: 1782204725996813579 X-GMAIL-MSGID: 1782204725996813579 |
Series |
i2c: designware: code consolidation & cleanups
|
|
Commit Message
Andy Shevchenko
Nov. 10, 2023, 6:11 p.m. UTC
PCI core, after pcim_enable_device(), takes care about the allocated
IRQ vectors, no need to do it explicitly and break the cleaning up
order.
Fixes: 21aa3983d619 ("i2c: designware-pci: Switch over to MSI interrupts")
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
drivers/i2c/busses/i2c-designware-pcidrv.c | 15 +++------------
1 file changed, 3 insertions(+), 12 deletions(-)
Comments
On 11/10/23 20:11, Andy Shevchenko wrote: > PCI core, after pcim_enable_device(), takes care about the allocated > IRQ vectors, no need to do it explicitly and break the cleaning up > order. > > Fixes: 21aa3983d619 ("i2c: designware-pci: Switch over to MSI interrupts") > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> > --- > drivers/i2c/busses/i2c-designware-pcidrv.c | 15 +++------------ > 1 file changed, 3 insertions(+), 12 deletions(-) ... > @@ -360,9 +354,6 @@ static void i2c_dw_pci_remove(struct pci_dev *pdev) > > pm_runtime_forbid(&pdev->dev); > pm_runtime_get_noresume(&pdev->dev); > - > - devm_free_irq(&pdev->dev, dev->irq, dev); > - pci_free_irq_vectors(pdev); Instead of commit 21aa3983d619 I guess this patch is more around my commit 9be8bc4dd617 ("i2c: designware-pci: Fix BUG_ON during device removal")? But still I don't think it qualifies Fixes tag? I was curious to see would this patch bring back above BUG_ON and fortunately not (rmmod/modprobe i2c_designware_pci on MSI enabled instance):-) Jarkko Nikula <jarkko.nikula@linux.intel.com>
On Wed, Nov 15, 2023 at 02:08:10PM +0200, Jarkko Nikula wrote: > On 11/10/23 20:11, Andy Shevchenko wrote: ... > > @@ -360,9 +354,6 @@ static void i2c_dw_pci_remove(struct pci_dev *pdev) > > pm_runtime_forbid(&pdev->dev); > > pm_runtime_get_noresume(&pdev->dev); > > - > > - devm_free_irq(&pdev->dev, dev->irq, dev); > > - pci_free_irq_vectors(pdev); > > Instead of commit 21aa3983d619 I guess this patch is more around my commit > 9be8bc4dd617 ("i2c: designware-pci: Fix BUG_ON during device removal")? No, this one exactly what it says. Your patch is the side effect of the above mentioned change. > But > still I don't think it qualifies Fixes tag? Up to you, I can remove the fixes tag altogether, but it has the correct commit ID there. > I was curious to see would this patch bring back above BUG_ON and > fortunately not (rmmod/modprobe i2c_designware_pci on MSI enabled > instance):-) How? PCI clean up will happen on the level of pcim_enable_device(), i.e. quite after the IRQ will be freed.
diff --git a/drivers/i2c/busses/i2c-designware-pcidrv.c b/drivers/i2c/busses/i2c-designware-pcidrv.c index 35d35d7c8e23..175aa18f1a04 100644 --- a/drivers/i2c/busses/i2c-designware-pcidrv.c +++ b/drivers/i2c/busses/i2c-designware-pcidrv.c @@ -295,10 +295,8 @@ static int i2c_dw_pci_probe(struct pci_dev *pdev, if (controller->setup) { r = controller->setup(pdev, controller); - if (r) { - pci_free_irq_vectors(pdev); + if (r) return r; - } } i2c_dw_adjust_bus_speed(dev); @@ -307,10 +305,8 @@ static int i2c_dw_pci_probe(struct pci_dev *pdev, i2c_dw_acpi_configure(&pdev->dev); r = i2c_dw_validate_speed(dev); - if (r) { - pci_free_irq_vectors(pdev); + if (r) return r; - } i2c_dw_configure(dev); @@ -330,10 +326,8 @@ static int i2c_dw_pci_probe(struct pci_dev *pdev, adap->nr = controller->bus_num; r = i2c_dw_probe(dev); - if (r) { - pci_free_irq_vectors(pdev); + if (r) return r; - } if ((dev->flags & MODEL_MASK) == MODEL_AMD_NAVI_GPU) { dev->slave = i2c_new_ccgx_ucsi(&dev->adapter, dev->irq, &dgpu_node); @@ -360,9 +354,6 @@ static void i2c_dw_pci_remove(struct pci_dev *pdev) pm_runtime_forbid(&pdev->dev); pm_runtime_get_noresume(&pdev->dev); - - devm_free_irq(&pdev->dev, dev->irq, dev); - pci_free_irq_vectors(pdev); } static const struct pci_device_id i2_designware_pci_ids[] = {