From patchwork Sun Jun 6 07:05:08 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dejin Zheng X-Patchwork-Id: 455145 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 55F38C4743E for ; Sun, 6 Jun 2021 07:06:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 339586141E for ; Sun, 6 Jun 2021 07:06:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230075AbhFFHIT (ORCPT ); Sun, 6 Jun 2021 03:08:19 -0400 Received: from mail-pj1-f41.google.com ([209.85.216.41]:43524 "EHLO mail-pj1-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229478AbhFFHIT (ORCPT ); Sun, 6 Jun 2021 03:08:19 -0400 Received: by mail-pj1-f41.google.com with SMTP id l10-20020a17090a150ab0290162974722f2so8452113pja.2; Sun, 06 Jun 2021 00:06:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ameoA/1J9JC1e+hvEKFvbOF1rkxU/AqC4eK5zMBiLI8=; b=I4SEo+19gR7uX9BiDaAf3R15E3yDqb+EV6ziZYDIJXRO07fB9OD6xDdqpFPin5sVEL tIHCOyHpLzWuwGTxtlnPH+c8Vln56msa0lcNYx1XVIUbUQTKxVDN9yNGQGOWJyRl9oWo c/YJ3OlSHtio7SxHwij4mojXn4NZQ1ckrP4TvhQbrv5+VjDLE+p0jt3q2FmY0XTB82/M NAlr8bvLOdlkwxGr+/EXaRiEytlwOzqbrF3jYJTHq5liAKUdMQZkle23XkOtPIh24gaA mJLML7Ja8HCNywIBONrFEQFsOQYNUPNz0v9sSjOWhowyz29KIGfxxuZVkvDHNTSjctD0 oTgw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ameoA/1J9JC1e+hvEKFvbOF1rkxU/AqC4eK5zMBiLI8=; b=UHu4QxpFQb0QBHYvrWscIysbAqsQEkwdxaSivgc+DoLP5MaLgRXN8zBCXhWWDsQuHi kCUv8nNwmmOPstH1gU4CNevHgcQq6H2qN6FwK2FC6LDbv/LWUIr92y9R2fV11Oh7To2j a8vgaPjjDnmuvWYBXC79AxkC/x8XZNE69OGI0UPW95YHnGUrcaRJQeDzNHNUL6je6gpV N4VqahZOeo0YzSmr1qVqUBj3R5/WQeP+6NuH4W88krudOgOHlR8YSFZaC7TKRmdEso41 2ZDBZ8mS5Poi5/nKPfVz5Qf/IiaWerWH5RCj0HVCLf1VrhM0CXXH/PLpnecyJUTG7JK4 qSoQ== X-Gm-Message-State: AOAM533JnUWkYt42co784n6eDSKFhQVDyyJc80YVi4B7IzjPqPRDGiyN xOR8oP1zuGweDyXS8fDR12Y= X-Google-Smtp-Source: ABdhPJwHe+fu6+k3PJUxr4V+xmq/fCR4yxqhySIErvOeE6x3nKsV0UU04/QFYOxirG7MAqOrgzdInA== X-Received: by 2002:a17:90a:17ad:: with SMTP id q42mr26334023pja.181.1622963120512; Sun, 06 Jun 2021 00:05:20 -0700 (PDT) Received: from localhost (185.212.56.112.16clouds.com. [185.212.56.112]) by smtp.gmail.com with ESMTPSA id 21sm5081227pfh.103.2021.06.06.00.05.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 06 Jun 2021 00:05:20 -0700 (PDT) From: Dejin Zheng To: helgaas@kernel.org, corbet@lwn.net, jarkko.nikula@linux.intel.com, andriy.shevchenko@linux.intel.com, mika.westerberg@linux.intel.com, rric@kernel.org, bhelgaas@google.com, linux-doc@vger.kernel.org, linux-i2c@vger.kernel.org, linux-pci@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Dejin Zheng Subject: [PATCH v6 1/4] PCI: Introduce pcim_alloc_irq_vectors() Date: Sun, 6 Jun 2021 15:05:08 +0800 Message-Id: <20210606070511.778487-2-zhengdejin5@gmail.com> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210606070511.778487-1-zhengdejin5@gmail.com> References: <20210606070511.778487-1-zhengdejin5@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-i2c@vger.kernel.org Introduce pcim_alloc_irq_vectors(), a device-managed version of pci_alloc_irq_vectors(). Introducing this function can simplify the error handling path in many drivers. And use pci_free_irq_vectors() to replace some code in pcim_release(), they are equivalent, and no functional change. It is more explicit that pcim_alloc_irq_vectors() is a device-managed function. Suggested-by: Andy Shevchenko Reviewed-by: Robert Richter Reviewed-by: Andy Shevchenko Acked-by: Bjorn Helgaas Signed-off-by: Dejin Zheng Reported-by: kernel test robot --- v5 -> v6: - rebase to 5.13-rc4 v4 -> v5: - Remove the check of enable device in pcim_alloc_irq_vectors() and make it as a static line function. v3 -> v4: - No change v2 -> v3: - Add some commit comments for replace some codes in pcim_release() by pci_free_irq_vectors(). v1 -> v2: - Use pci_free_irq_vectors() to replace some code in pcim_release(). - Modify some commit messages. drivers/pci/pci.c | 5 +---- include/linux/pci.h | 24 ++++++++++++++++++++++++ 2 files changed, 25 insertions(+), 4 deletions(-) diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index b717680377a9..6319e5889688 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c @@ -1989,10 +1989,7 @@ static void pcim_release(struct device *gendev, void *res) struct pci_devres *this = res; int i; - if (dev->msi_enabled) - pci_disable_msi(dev); - if (dev->msix_enabled) - pci_disable_msix(dev); + pci_free_irq_vectors(dev); for (i = 0; i < DEVICE_COUNT_RESOURCE; i++) if (this->region_mask & (1 << i)) diff --git a/include/linux/pci.h b/include/linux/pci.h index c20211e59a57..e9c95cab2540 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h @@ -1825,6 +1825,30 @@ pci_alloc_irq_vectors(struct pci_dev *dev, unsigned int min_vecs, NULL); } +/** + * pcim_alloc_irq_vectors - a device-managed pci_alloc_irq_vectors() + * @dev: PCI device to operate on + * @min_vecs: minimum number of vectors required (must be >= 1) + * @max_vecs: maximum (desired) number of vectors + * @flags: flags or quirks for the allocation + * + * Return the number of vectors allocated, (which might be smaller than + * @max_vecs) if successful, or a negative error code on error. If less + * than @min_vecs interrupt vectors are available for @dev the function + * will fail with -ENOSPC. + * + * It depends on calling pcim_enable_device() to make IRQ resources + * manageable. + */ +static inline int +pcim_alloc_irq_vectors(struct pci_dev *dev, unsigned int min_vecs, + unsigned int max_vecs, unsigned int flags) +{ + if (!pci_is_managed(dev)) + return -EINVAL; + return pci_alloc_irq_vectors(dev, min_vecs, max_vecs, flags); +} + /* Include architecture-dependent settings and functions */ #include From patchwork Sun Jun 6 07:05:09 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dejin Zheng X-Patchwork-Id: 455146 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 64D69C4743F for ; Sun, 6 Jun 2021 07:05:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4B6D161408 for ; Sun, 6 Jun 2021 07:05:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230132AbhFFHHN (ORCPT ); Sun, 6 Jun 2021 03:07:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39376 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229478AbhFFHHN (ORCPT ); Sun, 6 Jun 2021 03:07:13 -0400 Received: from mail-pg1-x52b.google.com (mail-pg1-x52b.google.com [IPv6:2607:f8b0:4864:20::52b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8AB35C061766; Sun, 6 Jun 2021 00:05:24 -0700 (PDT) Received: by mail-pg1-x52b.google.com with SMTP id q15so11346634pgg.12; Sun, 06 Jun 2021 00:05:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=5+ypx9Rj8P3lUr4MhiNDQWc6dLd11JIlQkIpaR01+QE=; b=KLf6SbUADB+x9z3VxprjCJD8KLPIuGQ58gp9lkDcQap5DqMRANgjoRm8EjvzyzM+PT dGQF3IZSSKZSnRTWmubz8hic85nLkmr4/8ti9o2Fth/DktZX2P134jWCPQcwEJ6fTxL8 cwK6nhQ7LHmI1q5dbnBdwmO9SWMdA9obZxySLH3ZPzf6Pk3+jNuRHX335w3zraY09yNJ zsHuq3/n5wzi9NOKonP6cuEe7sJ+HRmxJa8+id8p0od/r0Ca/XeaSSKfy8neLhKz/l/i vaR8BV5c4M2/iqW7AZMfYuMdhSmHBujOG7y2PfiQKPBelVhwBkTRmJzkr7pXN7q26Mnm 7UBw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=5+ypx9Rj8P3lUr4MhiNDQWc6dLd11JIlQkIpaR01+QE=; b=kflqNfRvBy6KdhRoQ/4GkkGD3ngX/PtjlfU05Mflln2utUFriGpUk00dmG7znX1Xm9 J9GxaRKgOjg9+yduNSbBu7Zz7vbpGKej2y2r93uzbT0s5AmFyG+X3pPSMVpqjsTQwsyk 1kbHSjb5EN5WngE5vYZ70R7gvDkJyZqFCVCs14fm4ywXUp7tQikq8bIDFQ235sAc8gju EVvx9gtX/vdzxqyTrgu7LG8eUEechahUSoaPxMTk2yAwxKBOQHsZH/WOc+rIwPu+WqLO 4xUH0HJ78r/LlB/a+OPGMAxy/2tOxAYcXtG8y+Ma/pc5eIEHXxbvROyXMbiBsGAtZypy vUjA== X-Gm-Message-State: AOAM532mLHF55OsiRhyVIXvkwiI1TdA3XEykWS14coLYnVgVgPS5PuZC eIgxHk9YMyFZDEFqyHlm4JY= X-Google-Smtp-Source: ABdhPJy+qdrOE/LjLgy/vqnJhEjg3s4IbWRnIvryIz+JBNVLpJZeeafjufZihW+dhDx96gZYpiEvXw== X-Received: by 2002:a63:1a49:: with SMTP id a9mr12628609pgm.63.1622963124130; Sun, 06 Jun 2021 00:05:24 -0700 (PDT) Received: from localhost (185.212.56.112.16clouds.com. [185.212.56.112]) by smtp.gmail.com with ESMTPSA id o17sm8629945pjp.33.2021.06.06.00.05.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 06 Jun 2021 00:05:23 -0700 (PDT) From: Dejin Zheng To: helgaas@kernel.org, corbet@lwn.net, jarkko.nikula@linux.intel.com, andriy.shevchenko@linux.intel.com, mika.westerberg@linux.intel.com, rric@kernel.org, bhelgaas@google.com, linux-doc@vger.kernel.org, linux-i2c@vger.kernel.org, linux-pci@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Dejin Zheng Subject: [PATCH v6 2/4] Documentation: devres: Add pcim_alloc_irq_vectors() Date: Sun, 6 Jun 2021 15:05:09 +0800 Message-Id: <20210606070511.778487-3-zhengdejin5@gmail.com> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210606070511.778487-1-zhengdejin5@gmail.com> References: <20210606070511.778487-1-zhengdejin5@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-i2c@vger.kernel.org Add pcim_alloc_irq_vectors(), a device-managed version of pci_alloc_irq_vectors(). introducing this function can simplify the error handling path in many drivers. Reviewed-by: Robert Richter Signed-off-by: Dejin Zheng --- v5 -> v6: - rebase to 5.13-rc4 v4 -> v5: - No change v3 -> v4: - No change v2 -> v3: - No change v1 -> v2: - Modify some commit messages. Documentation/driver-api/driver-model/devres.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/Documentation/driver-api/driver-model/devres.rst b/Documentation/driver-api/driver-model/devres.rst index e0814d214048..fad7d26ccf35 100644 --- a/Documentation/driver-api/driver-model/devres.rst +++ b/Documentation/driver-api/driver-model/devres.rst @@ -382,6 +382,7 @@ PCI devm_pci_alloc_host_bridge() : managed PCI host bridge allocation devm_pci_remap_cfgspace() : ioremap PCI configuration space devm_pci_remap_cfg_resource() : ioremap PCI configuration space resource + pcim_alloc_irq_vectors() : managed IRQ vectors allocation pcim_enable_device() : after success, all PCI ops become managed pcim_pin_device() : keep PCI device enabled after release From patchwork Sun Jun 6 07:05:10 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dejin Zheng X-Patchwork-Id: 455592 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 78E11C48BC2 for ; Sun, 6 Jun 2021 07:05:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 60304613AD for ; Sun, 6 Jun 2021 07:05:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230136AbhFFHHT (ORCPT ); Sun, 6 Jun 2021 03:07:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39406 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229478AbhFFHHT (ORCPT ); Sun, 6 Jun 2021 03:07:19 -0400 Received: from mail-pg1-x536.google.com (mail-pg1-x536.google.com [IPv6:2607:f8b0:4864:20::536]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 34A13C061766; Sun, 6 Jun 2021 00:05:30 -0700 (PDT) Received: by mail-pg1-x536.google.com with SMTP id n12so11321785pgs.13; Sun, 06 Jun 2021 00:05:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Wu9gAwlAOwgKiPmTDPbi3wWguWilh1MHvLSLhPDONu4=; b=Oef098bUXUmCFjfJdLdw3CRK0xzTkHa7Xwq8DgY7PtmZYyaDguYw22UNe/f7dJmmVd XtF/lMEmL1M3tB+XFuctn/HFVfirB5JS94/45WzcvUrouktg6lGp8yz0ryeKs/z50cwY W6r5MHozgBDCYYzCDb55tQk6UIuqU5imqjA21yCSVwEYydlQFXdtYGC4GULATkFloCxo kgx8Atfzl0GPHAWcPOoeEJoPU+6j3XWqWx7eIHid4nAgyw6/Tb3UWoz4/k0QbBVCEbq2 fcSZL053MlwOO7L+EFqNbfOfAyja7WfhAjrc3j19m59sBhG+C1Z8ofHIT8S/ijDY8131 hV4g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Wu9gAwlAOwgKiPmTDPbi3wWguWilh1MHvLSLhPDONu4=; b=VtN9yi7HBZqlKBuWlekcYc07FTZAH6cNhB0tX4l7dhdLAzNcmiD8CXT8VZYlmB62h4 m04BWZbtokwRP/ztEfak+VtmL5DS1RdxOyKprEM9C6LCqD0w/ky4s2T9XIzjxRcrHyiP nYMKxxHGOe8SeeKtWUZ+Yk/4QxMUBPMJVP5kxDHCxgasPntAqpToblK6xXng74a9vrVP ZMwIYx/I1BqoipH08VOyWuc1tS8RR9ravCtfG5mG8v9bqonK/uwb3zIISAZRZiOZ+rNB BwN/mb7TL2F6kBLTqmfXLgdENgRiTPAWAYMLmsPbWkxs3d3n5hSkqhJLcy9Qp1GhxmdA EhMQ== X-Gm-Message-State: AOAM532SEJLi3eWLcQseqitl8ZGkNobIhDi6luDJAJVhDxFAIb1Vknec Z1JyOO8uSZTLFPH9znIV4zw= X-Google-Smtp-Source: ABdhPJx8MzSJB7AjQGaenY8cmsSrTjG4AD6oVrcO5Gg4F+DIdVlxhFKTTN0ZeCD4WSIMHimnZFayhw== X-Received: by 2002:a62:5288:0:b029:2e3:fd7d:267a with SMTP id g130-20020a6252880000b02902e3fd7d267amr12260409pfb.21.1622963128174; Sun, 06 Jun 2021 00:05:28 -0700 (PDT) Received: from localhost (185.212.56.112.16clouds.com. [185.212.56.112]) by smtp.gmail.com with ESMTPSA id s13sm207808pgi.36.2021.06.06.00.05.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 06 Jun 2021 00:05:27 -0700 (PDT) From: Dejin Zheng To: helgaas@kernel.org, corbet@lwn.net, jarkko.nikula@linux.intel.com, andriy.shevchenko@linux.intel.com, mika.westerberg@linux.intel.com, rric@kernel.org, bhelgaas@google.com, linux-doc@vger.kernel.org, linux-i2c@vger.kernel.org, linux-pci@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Dejin Zheng Subject: [PATCH v6 3/4] i2c: designware: Use pcim_alloc_irq_vectors() to allocate IRQ vectors Date: Sun, 6 Jun 2021 15:05:10 +0800 Message-Id: <20210606070511.778487-4-zhengdejin5@gmail.com> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210606070511.778487-1-zhengdejin5@gmail.com> References: <20210606070511.778487-1-zhengdejin5@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-i2c@vger.kernel.org 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. Reviewed-by: Robert Richter Acked-by: Andy Shevchenko Acked-by: Jarkko Nikula Signed-off-by: Dejin Zheng --- v5 -> v6: - rebase to 5.13-rc4 v4 -> v5: - Modify the subject name. 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 0f409a4c2da0..2b1ef0934445 100644 --- a/drivers/i2c/busses/i2c-designware-pcidrv.c +++ b/drivers/i2c/busses/i2c-designware-pcidrv.c @@ -268,7 +268,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; @@ -283,10 +283,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); @@ -295,10 +293,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); @@ -318,10 +314,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) { r = navi_amd_register_client(dev); @@ -349,7 +343,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); } /* work with hotplug and coldplug */ From patchwork Sun Jun 6 07:05:11 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dejin Zheng X-Patchwork-Id: 455591 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 224D9C4743E for ; Sun, 6 Jun 2021 07:06:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 109396141E for ; Sun, 6 Jun 2021 07:06:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230208AbhFFHIj (ORCPT ); Sun, 6 Jun 2021 03:08:39 -0400 Received: from mail-pf1-f170.google.com ([209.85.210.170]:34539 "EHLO mail-pf1-f170.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229478AbhFFHIi (ORCPT ); Sun, 6 Jun 2021 03:08:38 -0400 Received: by mail-pf1-f170.google.com with SMTP id g6so10732378pfq.1; Sun, 06 Jun 2021 00:06:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=J66R96VtW8mDJcT/ONY8la0SES4Mp5OfgngGRV1e+uk=; b=ltrbs7IsuU4rxW0IuBq8ZcSDmgXcvj6QkaagoafdrzFvzuunQ546pBuc4JU1gJGyOZ /bbDkmXHzMlZhE8neVmq0/T5o27L9UkrvZCagQEtrJyGtpJ3tPZOqTYQ90pFxgrQ42iU 4ibBiG3yumJmfZbBSTUooG0seI1RIVLo5Ci7Klpm0IxlIbengCS7ZrTvlcNQqd+gKNNO inOWm6zANk+GJ8zwgFziPS/eh7HTHFBBS4iIctNnbQMqviPgFnUNKluD4r9oxGPZqjuc aVDTYjoGtgB3+6IIuyllodJtjRrQp+4UaznGaqmQSgbT2wgKFWhsNg2GJ5h/ZB9TCE4C sQSQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=J66R96VtW8mDJcT/ONY8la0SES4Mp5OfgngGRV1e+uk=; b=QTkNLVQ/de+VvsVMloUevdxnivMxVKpLp+DINOpEwffP0hSECsWvUV/BcAHqzTQYP1 Oxksxm+UTq/AjN6bnXtQvXoPZxG1T96FUEtPMCs/p0dxNXYnUbJCfmAzyXuY+/dxyqzr GKtBdl+4F17V0AShP7mDR6xr7U1nIgozBbfrcMd+JBBO5Ni/Lazgt8PRPTJtdY3/8nX9 PM+Cy0+Xg7sSQKOTpkdW+xtDTkK2APhKsLIw230zAsMHjxS/j2fbvuasXC0BgGSeYfHj B9i4xdu4KcQAADZY1zezHrPgf5HAEvpDo+kxfuHGOciXVZA57IzGUaW6y9fvOVwm0S3G kZpw== X-Gm-Message-State: AOAM530GWK/4k5/XQkwb6U/S7/4FJnJeixxcArR+8VwHXFzwfESn8vBA gmDMuXZ+4SnzeWzgBk1KcPA= X-Google-Smtp-Source: ABdhPJx7OClakPR3VGNnt9/EOTYx/4ErJNqw79iJSYkGFxZ20rHXgLaRwkw1G7FKE/PNubW2gD18pQ== X-Received: by 2002:a62:1743:0:b029:2ef:6014:62d5 with SMTP id 64-20020a6217430000b02902ef601462d5mr1375817pfx.63.1622963133427; Sun, 06 Jun 2021 00:05:33 -0700 (PDT) Received: from localhost (185.212.56.112.16clouds.com. [185.212.56.112]) by smtp.gmail.com with ESMTPSA id k9sm5735976pgq.27.2021.06.06.00.05.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 06 Jun 2021 00:05:33 -0700 (PDT) From: Dejin Zheng To: helgaas@kernel.org, corbet@lwn.net, jarkko.nikula@linux.intel.com, andriy.shevchenko@linux.intel.com, mika.westerberg@linux.intel.com, rric@kernel.org, bhelgaas@google.com, linux-doc@vger.kernel.org, linux-i2c@vger.kernel.org, linux-pci@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Dejin Zheng Subject: [PATCH v6 4/4] i2c: thunderx: Use pcim_alloc_irq_vectors() to allocate IRQ vectors Date: Sun, 6 Jun 2021 15:05:11 +0800 Message-Id: <20210606070511.778487-5-zhengdejin5@gmail.com> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210606070511.778487-1-zhengdejin5@gmail.com> References: <20210606070511.778487-1-zhengdejin5@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-i2c@vger.kernel.org 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(). Acked-by: Robert Richter Signed-off-by: Dejin Zheng --- v5 -> v6: - rebase to 5.13-rc4 v4 -> v5: - Modify the subject name. v3 -> v4: - No change. v2 -> v3: - No change. v1 -> v2: - Modify some commit messages. drivers/i2c/busses/i2c-thunderx-pcidrv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/i2c/busses/i2c-thunderx-pcidrv.c b/drivers/i2c/busses/i2c-thunderx-pcidrv.c index 12c90aa0900e..63354e9fb726 100644 --- a/drivers/i2c/busses/i2c-thunderx-pcidrv.c +++ b/drivers/i2c/busses/i2c-thunderx-pcidrv.c @@ -192,7 +192,7 @@ static int thunder_i2c_probe_pci(struct pci_dev *pdev, i2c->hlc_int_enable = thunder_i2c_hlc_int_enable; i2c->hlc_int_disable = thunder_i2c_hlc_int_disable; - ret = pci_alloc_irq_vectors(pdev, 1, 1, PCI_IRQ_MSIX); + ret = pcim_alloc_irq_vectors(pdev, 1, 1, PCI_IRQ_MSIX); if (ret < 0) goto error;