linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Zhenzhong Duan <zhenzhong.duan@gmail.com>
To: linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org
Cc: bhelgaas@google.com, Zhenzhong Duan <zhenzhong.duan@gmail.com>
Subject: [PATCH 2/2] PCI: add support for dynamic ID when checking for duplicate IDs
Date: Wed, 21 Oct 2020 16:10:30 +0800	[thread overview]
Message-ID: <20201021081030.160-2-zhenzhong.duan@gmail.com> (raw)
In-Reply-To: <20201021081030.160-1-zhenzhong.duan@gmail.com>

When a device ID data is writen to /sys/bus/pci/drivers/.../new_id,
only static ID table is checked for duplicate and multiple dynamic id
entries of same kind are allowed to be dynamically linked.

Fix it by calling pci_match_device() which checks both dynamic and static IDs.

Signed-off-by: Zhenzhong Duan <zhenzhong.duan@gmail.com>
---
 drivers/pci/pci-driver.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c
index bd9cfd1..751c605 100644
--- a/drivers/pci/pci-driver.c
+++ b/drivers/pci/pci-driver.c
@@ -125,7 +125,7 @@ static ssize_t new_id_store(struct device_driver *driver, const char *buf,
 		pdev->subsystem_device = subdevice;
 		pdev->class = class;
 
-		if (pci_match_id(pdrv->id_table, pdev))
+		if (pci_match_device(pdrv, pdev))
 			retval = -EEXIST;
 
 		kfree(pdev);
-- 
1.8.3.1


  reply	other threads:[~2020-10-21  8:10 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-21  8:10 [PATCH 1/2] PCI: export pci_match_device() Zhenzhong Duan
2020-10-21  8:10 ` Zhenzhong Duan [this message]
2020-10-22 15:21 ` Christoph Hellwig
2020-10-26  2:52   ` Zhenzhong Duan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201021081030.160-2-zhenzhong.duan@gmail.com \
    --to=zhenzhong.duan@gmail.com \
    --cc=bhelgaas@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).