Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp7443250pxb; Thu, 18 Feb 2021 10:09:19 -0800 (PST) X-Google-Smtp-Source: ABdhPJxusCn3OmnBHrsgzDl5dN43hGVyDptb7C6IGfzHOnNNHB2MN0UcfHFZgoxGkuX0JeCvMrny X-Received: by 2002:a17:906:3885:: with SMTP id q5mr5198937ejd.105.1613671759639; Thu, 18 Feb 2021 10:09:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613671759; cv=none; d=google.com; s=arc-20160816; b=o8w1Gop3zZSLnLVaHVo/x3OsMuTGSQJUXVN3i328TrsLWcBp2fkAa8gALo1ORBUutg nYaJ4Y81PfjMUECWXtZMk1JGO04su7kO99B5Yx8DK5UyNF5FJrCkpas8DrODs/tauxGP lg9iVDV3FOjbi2y+K3auaY1OJfpjq/DQK0nmU5YWXJ9Rg+DuJ4E6lS3IZh13GaLK4HMr ZOAuwEHyR/mKKbgV9yIbkiUed8GPLQiUcIuALaUlQJoJ7za1p9b1HzG2xLwUlW8cuB2j 1iJjLwfC3NmV6dAO4zwmwQYLTIGqrlGHkDtUCMwnltxVYURBRJa1PC2EERjMf4oNpxSQ INfQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:organization:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :ironport-sdr:ironport-sdr; bh=UcTk+HiWIjoTGiybUw3Ynlhzdny0ZskpNz3FHpT270o=; b=Dx6SAc4O4pHUf++ncgf7SocxpHhR/04kbIFrdk/XSRBba/TdYoQ3bFBjDvt90z2Y+3 8nyAGri39cqAiqOXE6B4FX0tMW9kX4sJytSnP410uMIfpxEVFFOlSyCPHZ1KVjapHjIR vBjhXJjuyWeiesGCueS1Hm7hs9NXTSQ0E6+RkEQtCt0yerUpHrNbDZ5bwoCD08GRBPXg q1p3OCoaPC192C9SkPEc/rJ2qfaVq09Z12bPSC1NtF/bXjjp9Qti7wn2sDZ3NR2s/9yq fvo0R7jfbryOjtiXXPggvOKh6+dYAghv7jsCoAy4lLY2VMgl2LdFx9lkL7C8TKBT+dwf WCrQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dn25si2665064edb.503.2021.02.18.10.08.55; Thu, 18 Feb 2021 10:09:19 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232102AbhBRSIP (ORCPT + 99 others); Thu, 18 Feb 2021 13:08:15 -0500 Received: from mga14.intel.com ([192.55.52.115]:5039 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231173AbhBRPjS (ORCPT ); Thu, 18 Feb 2021 10:39:18 -0500 IronPort-SDR: 7/ID0Oep/tvTT7ZFHj3+5fi6r+ksqIYRcdw5CWOqrRfmGt2QV13rXq6Q0cdWO9q9WMdaCAKB6L FAr4YPivEKXA== X-IronPort-AV: E=McAfee;i="6000,8403,9898"; a="182743191" X-IronPort-AV: E=Sophos;i="5.81,187,1610438400"; d="scan'208";a="182743191" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Feb 2021 07:35:26 -0800 IronPort-SDR: Jf9QAV+Q8Uj40xLFxyt+iyEzDFTa+gsXAj7hC4bl3PYJgAqhZ97tw0QErHi6WLmqoGB29Vd+0B R7hoI5aI5ehQ== X-IronPort-AV: E=Sophos;i="5.81,187,1610438400"; d="scan'208";a="378440303" Received: from smile.fi.intel.com (HELO smile) ([10.237.68.40]) by orsmga002-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Feb 2021 07:35:23 -0800 Received: from andy by smile with local (Exim 4.94) (envelope-from ) id 1lClKq-005yoo-6T; Thu, 18 Feb 2021 17:35:20 +0200 Date: Thu, 18 Feb 2021 17:35:20 +0200 From: Andy Shevchenko To: Dejin Zheng Cc: corbet@lwn.net, jarkko.nikula@linux.intel.com, mika.westerberg@linux.intel.com, rric@kernel.org, bhelgaas@google.com, wsa@kernel.org, linux-doc@vger.kernel.org, linux-i2c@vger.kernel.org, linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v4 3/4] i2c: designware: Use the correct name of device-managed function Message-ID: References: <20210218150458.798347-1-zhengdejin5@gmail.com> <20210218150458.798347-4-zhengdejin5@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210218150458.798347-4-zhengdejin5@gmail.com> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Feb 18, 2021 at 11:04:57PM +0800, Dejin Zheng wrote: > Use the new function pcim_alloc_irq_vectors() to allocate IRQ vectors, > the pcim_alloc_irq_vectors() function, an explicit device-managed version > of pci_alloc_irq_vectors(). If pcim_enable_device() has been called > before, then pci_alloc_irq_vectors() is actually a device-managed > function. It is used here as a device-managed function, So replace it > with pcim_alloc_irq_vectors(). At the same time, Remove the > pci_free_irq_vectors() function to simplify the error handling path. > the freeing resources will take automatically when device is gone. Acked-by: Andy Shevchenko One side note below. > Signed-off-by: Dejin Zheng > --- > v3 -> v4: > - add some commit comments. > v2 -> v3: > - simplify the error handling path. > v1 -> v2: > - Modify some commit messages. > drivers/i2c/busses/i2c-designware-pcidrv.c | 15 ++++----------- > 1 file changed, 4 insertions(+), 11 deletions(-) > > diff --git a/drivers/i2c/busses/i2c-designware-pcidrv.c b/drivers/i2c/busses/i2c-designware-pcidrv.c > index 55c83a7a24f3..620b41e373b6 100644 > --- a/drivers/i2c/busses/i2c-designware-pcidrv.c > +++ b/drivers/i2c/busses/i2c-designware-pcidrv.c > @@ -219,7 +219,7 @@ static int i2c_dw_pci_probe(struct pci_dev *pdev, > if (!dev) > return -ENOMEM; > > - r = pci_alloc_irq_vectors(pdev, 1, 1, PCI_IRQ_ALL_TYPES); > + r = pcim_alloc_irq_vectors(pdev, 1, 1, PCI_IRQ_ALL_TYPES); > if (r < 0) > return r; > > @@ -234,10 +234,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); > @@ -246,10 +244,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); > > @@ -269,10 +265,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; > - } > > pm_runtime_set_autosuspend_delay(&pdev->dev, 1000); > pm_runtime_use_autosuspend(&pdev->dev); > @@ -292,7 +286,6 @@ static void i2c_dw_pci_remove(struct pci_dev *pdev) > > i2c_del_adapter(&dev->adapter); > devm_free_irq(&pdev->dev, dev->irq, dev); > - pci_free_irq_vectors(pdev); I'm wondering if we need explicit devm_free_irq() call now. If we don't, it can be cleaned up in the separate change with a motivation that we got to device managed PCI IRQ allocation and thus the ordering will be correct (needs a double check!). > } > > /* work with hotplug and coldplug */ > -- > 2.25.0 > -- With Best Regards, Andy Shevchenko