Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp5807987pxb; Tue, 16 Feb 2021 08:06:01 -0800 (PST) X-Google-Smtp-Source: ABdhPJzHISBSFKU9XAPwOGnVURadKhZdRPuBI24ddDn1WbhXAwN+gbvqdqXFAT5ttrCq4o7+2o0f X-Received: by 2002:a17:906:bc8f:: with SMTP id lv15mr1482963ejb.87.1613491561286; Tue, 16 Feb 2021 08:06:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613491561; cv=none; d=google.com; s=arc-20160816; b=OwxUsaxosvsVL5RQQw9iiLX2z4hIvnqaW01tLstDk4CT4tZGYiVjFxgTb+g8YbP1qX RBwBNjsyq1lULwweGni0MJZwkxKm40Lkkg+UaJJByTci2fMRquKV9aQPgBs/uVAD/4jG Kwy3idRuNGCECAggFCfLUcfjpI1xzz/SOAS/4e0yDOWQ9fs8RtaM56Qzb+OpGq8aka22 lRJlv8tbIE2fTK0MUTVCHom2LazrkWyBmMR50duHlm5KLqvtEhmGkAtxs8nAi2qsO6Y0 lQKoQ3FyzEn9vxNwSwmlQkpHkDqGsfuPmQqaDzql9fvanGZNolQ0t0HNOpE/QFOuOz9l UBrQ== 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=VG6dKCG2ODrov9EapJ5ufxyScu+BNsG2De21xAJ5VII=; b=KnzGdqykGJdwdF1VSv7mHRSVzQLALLCMK7nFu0K/1bTGjW4guTZsO0sUirQgdAXKjO XlCbhrdPDEb/LSCv0JD0FcZq7r7i377IZZI55Rb9I2zwg1y6pNPWs1QDMmxbAr9BP90A FytyU5mVdpm5RaRZSaLfvlpILCxlW64mv0g+Oi0X/cL6aQ1xUoPWH+uVetzhU9bxbLzo 1IbHqNld/bJ6OeB2yCI1h0XFzt9EvU2Wa00PJ/iBThRwsftHWQU06Be0w3+fO9BOTERS Bxkpth/D6VhCxDyzYE5kc4i1+Xe8Ht61Z2jz1e0mbGweyhQlRqMf1aMK2gtyK/uCouXs oPmw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=pYmnxO75; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 88si738346edr.198.2021.02.16.08.05.38; Tue, 16 Feb 2021 08:06:01 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=pYmnxO75; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230365AbhBPQE0 (ORCPT + 99 others); Tue, 16 Feb 2021 11:04:26 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43614 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230397AbhBPQDs (ORCPT ); Tue, 16 Feb 2021 11:03:48 -0500 Received: from mail-pl1-x629.google.com (mail-pl1-x629.google.com [IPv6:2607:f8b0:4864:20::629]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7F79AC0613D6; Tue, 16 Feb 2021 08:03:08 -0800 (PST) Received: by mail-pl1-x629.google.com with SMTP id s16so1806623plr.9; Tue, 16 Feb 2021 08:03:08 -0800 (PST) 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=VG6dKCG2ODrov9EapJ5ufxyScu+BNsG2De21xAJ5VII=; b=pYmnxO75ygukI3bZfYQlhKS4QVfSjfAFSgKoEEKv3Cz0rCb+CG3gp/Z8Wi2NDUd7lU icWFzdJnJc7tpkPk0vN16bCJtYwB4jSAztRO+iMm4XVawgAnHJ6eue+4C4d5g1GryRNV 6GvxDDImKiOpqgqjlMDpc97OUj8exidRyPDVMp6gCOP1xfDVTFWOWCfz29ZbHiko59mt BC8EUOJTcm0xxfTnxFGt/4xdFZEMBT5pu8xuZ992LSXpX/My+0a6zh2h8IUzHW59UhTE Im6oBmR4par5vYFdfb1T2i91GtFA0QBudyJ4dHxm4r04hdqM+pHHG5y2bl6fFEbtht+1 azcw== 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=VG6dKCG2ODrov9EapJ5ufxyScu+BNsG2De21xAJ5VII=; b=YY7kD1a6BoPiS3o+mrGFoi4GV9rP6YAVx26BMnPpdMpP4rIZxJzes2x/dx05mmEsDB l5DrSoOUTXrCGwMTFc2WeZumknLK1cEObfUlVUKdlfYvEc+QfOYwOapUUZg+a7hx0UgS YdZogdECDdaya4WCwOmKu14dtzZ9sC7+uhLemFnqZFUYLDuhHRC+/3g6e5RAfLiYelIn cPwgVb7Lca3UF+LTxNX5b3fRvU0PTZHY0yBItw/kU83nrrVHOPyRmhHKlFr7KnDD/1Qz wWaQ2pWtZtrkrd62rFj1OFO50wB0j2kuQlv2Yqjsnunga53J/m1aWYzjJZ+j6NuZMCJb cfNQ== X-Gm-Message-State: AOAM533RZ8Sy4Cr3lb/X920Hy8028lTl8LaSQyjrOkbfFqzkPc/x07l5 fE41/a6T/sXwNjNoq0OZ3FM= X-Received: by 2002:a17:90a:a585:: with SMTP id b5mr4876912pjq.110.1613491388153; Tue, 16 Feb 2021 08:03:08 -0800 (PST) Received: from localhost (185.212.56.4.16clouds.com. [185.212.56.4]) by smtp.gmail.com with ESMTPSA id u15sm5446404pfm.130.2021.02.16.08.03.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Feb 2021 08:03:07 -0800 (PST) From: Dejin Zheng To: corbet@lwn.net, jarkko.nikula@linux.intel.com, andriy.shevchenko@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, kw@linux.com Cc: linux-kernel@vger.kernel.org, Dejin Zheng Subject: [PATCH v3 3/4] i2c: designware: Use the correct name of device-managed function Date: Wed, 17 Feb 2021 00:02:48 +0800 Message-Id: <20210216160249.749799-4-zhengdejin5@gmail.com> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20210216160249.749799-1-zhengdejin5@gmail.com> References: <20210216160249.749799-1-zhengdejin5@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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, simplify the error handling path. Signed-off-by: Dejin Zheng --- 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); } /* work with hotplug and coldplug */ -- 2.25.0