Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp5883575pxb; Tue, 16 Feb 2021 09:50:23 -0800 (PST) X-Google-Smtp-Source: ABdhPJzeGNNcKHnuO6RNMi2GFNm3Dau4FeEv9Y23GNQ/656bMrZULf4xk14iTq5L82ZdrSgeHJoD X-Received: by 2002:a05:6402:10c8:: with SMTP id p8mr21443225edu.144.1613497823528; Tue, 16 Feb 2021 09:50:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613497823; cv=none; d=google.com; s=arc-20160816; b=B+bd47iX5BsZmE6f/EcNJbxiurzbZk/hmaQ4OZD9BTcNb9EDUfpo137tk2dyp1EXEr iLUKpQtXJDvQoJhrbP9+SjESY918sTrAyDTe49NP7WFdGrVUX3/AhWPzsunqdS7Pwaxb kmQ8hGoyHE1fvJKQjKOTHH8r9+wKLzBt6H53uHmeY9zzka1/NK5sRxtnk3p69HqB8PlV MrIWIBBvqU6QOtz5G0nsDWtX13FmMN/d6porXcb77RUaTs5cwlQ3RUOk2XXJtL2gmc11 znc+YyErseub6GGNx3I5DfdnlrzOk64Siom7Dj/nulqda5gMcOW64ryyFETNftyhuBOj GjkQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=7KMcXCD/b8icwHFarNkS1sFwXOCJDzvsOL0/W59FEY0=; b=i/guSBzjNwnm/AGUXkxnzoVl34FdM+qXRn5d0U4BVgPPKCtuCJbXPQUHhmDlA/xzzM m1R7dqpbuTsrCSbvfKU5Rj7AFlwJL0HRuxG6OcunQrUeaLYs6gQeXSxRW3A7xd4lGekD qJucqlzrWv7BrFxYgtncLyOUrg56+RPZiXswtCQIMFP6two7yr1buVbNq2I3vPaXvARC cDz3+QXLTN0y96DkYdfBzXl94++X4LF/C4VuNhtwJ3KvsHIOIbQ0w/aeDTCmKbnWwDMZ PL5/+hQYh1dmRWMm4KDKsJG67J0KlpwsS0/jm/ptPj/BLgXCQ+6WBKxGUE7U5g7fzTIc VmdA== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m19si5750518edr.540.2021.02.16.09.50.00; Tue, 16 Feb 2021 09:50:23 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231396AbhBPRrz (ORCPT + 99 others); Tue, 16 Feb 2021 12:47:55 -0500 Received: from mail-lf1-f47.google.com ([209.85.167.47]:38634 "EHLO mail-lf1-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230234AbhBPRqq (ORCPT ); Tue, 16 Feb 2021 12:46:46 -0500 Received: by mail-lf1-f47.google.com with SMTP id m22so17250915lfg.5; Tue, 16 Feb 2021 09:46:29 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=7KMcXCD/b8icwHFarNkS1sFwXOCJDzvsOL0/W59FEY0=; b=osvsS3whHDVdPV6kkd2W6Fqvy1GZCiO7trQhO2N8yaqPdBObE4p4YgAoTasO8AVBk5 oAhuAc2UGcu0nmIiBKwUvXyTdyS6msD37tcyUAjn2MIg2ZtKIV86SEGVV8UQTS+wgcQL zZcIl/N3OU0neIWtNc+bhroMzD04YGUZ3xVQmMiZaJWwQHw5+QIaP1Ov1Pds6kblbipZ SR79tkge90BUOMgnUEWDmIiRPJaywxValBln8ZyyoTh6xlAHYr1zFl5bPTqxhqVtlQuK nBsM7DCcA5dj3DlKOGAHHPCsB6qz3uFuZFIgosvgxu2iuflz2UglQNBzDHqKnuh8BZGQ VEdw== X-Gm-Message-State: AOAM530r7+8TUiwXy/LTLoMEs2xm5c6I9s3fqfiUkwdyMTUPpQS3RhgN K4X6FZvTLadgxg4sOmq25gdga9VbCcYytX35 X-Received: by 2002:ac2:4c41:: with SMTP id o1mr13309969lfk.537.1613497563337; Tue, 16 Feb 2021 09:46:03 -0800 (PST) Received: from rocinante ([95.155.85.46]) by smtp.gmail.com with ESMTPSA id x1sm3935751ljh.62.2021.02.16.09.46.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Feb 2021 09:46:02 -0800 (PST) Date: Tue, 16 Feb 2021 18:46:01 +0100 From: Krzysztof =?utf-8?Q?Wilczy=C5=84ski?= To: Dejin Zheng Cc: corbet@lwn.net, jarkko.nikula@linux.intel.com, andriy.shevchenko@linux.intel.com, mika.westerberg@linux.intel.com, rric@kernel.org, helgaas@kernel.org, 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 v3 3/4] i2c: designware: Use the correct name of device-managed function Message-ID: References: <20210216160249.749799-1-zhengdejin5@gmail.com> <20210216160249.749799-4-zhengdejin5@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20210216160249.749799-4-zhengdejin5@gmail.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Dejin, Thank you for all the changes, looks good! You could improve the subject line, as it is very vague - what is the new function name more correct? Was the other and/or the previous one not correct? Seems like you are correcting a typo of sorts, rather than introducing a new function in this file. > 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(). The commit is good, but it could use some polish, so to speak. A few suggestions to think about: - What are we adding and/or changing, and why - Why is using pcim_alloc_irq_vectors(), which is part of the managed devices framework, a better alternative to the pci_alloc_irq_vectors() - And finally why this change allowed us to remove the pci_free_irq_vectors() > At the same time, simplify the error handling path. The change simplifies the error handling path, how? A line of two which explains how it has been achieved might help should someone reads the commit message in the future. [...] > 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); If pcim_release() is called should the pci_driver's probe callback fail, and I assume that this is precisely the case, then all of the above make sense in the view of using pcim_alloc_irq_vectors(). Reviewed-by: Krzysztof WilczyƄski Krzysztof