Skip to contentSkip to conversation

PCI: remove usage of pci_for_each_dev() in sound/oss/via82cxxx_audio.c

PATCH Jeff Garzik 2 participants 2 messages Jun 5, 2003 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw
Quoted 21 lines · Linux Kernel Mailing List

ChangeSet 1.1254.4.15, 2003/06/04 12:30:25-07:00, [email protected]

[PATCH] PCI: remove usage of pci_for_each_dev() in sound/oss/via82cxxx_audio.c

# This patch includes the following deltas:
# ChangeSet 1.1254.4.14 -> 1.1254.4.15
# sound/oss/via82cxxx_audio.c 1.27 -> 1.28 #

 via82cxxx_audio.c |   11 +++++------
 1 files changed, 5 insertions(+), 6 deletions(-)

diff -Nru a/sound/oss/via82cxxx_audio.c b/sound/oss/via82cxxx_audio.c

sound/oss/via82cxxx_audio.c +0 -1
@@ -1357,12 +1357,12 @@
 {
 	int minor = minor(inode->i_rdev);
 	struct via_info *card;
-	struct pci_dev *pdev;

sound/oss/via82cxxx_audio.c line 1368

Quoted 10 lines
sound/oss/via82cxxx_audio.c +2 -1
+	struct pci_dev *pdev = NULL;
 	struct pci_driver *drvr;
 
 	DPRINTK ("ENTER\n");
 
-	pci_for_each_dev(pdev) {
+	while ((pdev = pci_find_device(PCI_ANY_ID, PCI_ANY_ID, pdev)) != NULL) {
 		drvr = pci_dev_driver (pdev);
 		if (drvr == &via_driver) {
 			assert (pci_get_drvdata (pdev) != NULL);

Looking at your various commits in this vein, it really looks like there needs to be a function that returns the PCI device, given the struct pci_driver pointer. pci_find_driver() perhaps?

Jeff

#2 lore raw
Quoted 29 lines · Jeff Garzik
Quoted 28 lines · Linux Kernel Mailing List

ChangeSet 1.1254.4.15, 2003/06/04 12:30:25-07:00, [email protected]

[PATCH] PCI: remove usage of pci_for_each_dev() in sound/oss/via82cxxx_audio.c

# This patch includes the following deltas:
# ChangeSet 1.1254.4.14 -> 1.1254.4.15
# sound/oss/via82cxxx_audio.c 1.27 -> 1.28
#

via82cxxx_audio.c | 11 +++++------

1 files changed, 5 insertions(+), 6 deletions(-)

diff -Nru a/sound/oss/via82cxxx_audio.c b/sound/oss/via82cxxx_audio.c

sound/oss/via82cxxx_audio.c +1 -1
@@ -1357,12 +1357,12 @@
 {
 	int minor = minor(inode->i_rdev);
 	struct via_info *card;
-	struct pci_dev *pdev;
+	struct pci_dev *pdev = NULL;
 	struct pci_driver *drvr;
 
 	DPRINTK ("ENTER\n");
 
Quoted 11 lines
Quoted 6 lines
sound/oss/via82cxxx_audio.c +1 -1
-	pci_for_each_dev(pdev) {
+	while ((pdev = pci_find_device(PCI_ANY_ID, PCI_ANY_ID, pdev)) != 
 NULL) {
 		drvr = pci_dev_driver (pdev);
 		if (drvr == &via_driver) {
			assert (pci_get_drvdata (pdev) != NULL);

Looking at your various commits in this vein, it really looks like there needs to be a function that returns the PCI device, given the struct pci_driver pointer. pci_find_driver() perhaps?

Hm, only about 3 places really use that, and they would want something that would iterate over all pci devices that were bound to that driver. As the three places are in OSS drivers, I don't know if it's really worth adding a pci core function for them :)

thanks,

greg k-h