linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [BK PATCH] More PCI fixes for 2.5.70
@ 2003-06-05 21:00 Greg KH
  2003-06-05 21:01 ` [PATCH] " Greg KH
  0 siblings, 1 reply; 9+ messages in thread
From: Greg KH @ 2003-06-05 21:00 UTC (permalink / raw)
  To: torvalds; +Cc: linux-kernel

Hi,

Here's some more PCI changes against the latest 2.5.70 bk tree.  They contain
the following:
	- fix up the fusion driver due to errors from my last round of
	  pci patches.
	- remove last direct accesses of the pci_devices variable.
Now the pci_devices variable is not exported for drivers to touch
directly.  Only the pci core and arch specific pci code should access
this variable.

Please pull from:
	bk://kernel.bkbits.net/gregkh/linux/pci-2.5

thanks,

greg k-h

p.s. I'll send these as patches in response to this email to lkml for
those who want to see them.


 arch/m68k/atari/hades-pci.c           |    4 +--
 drivers/ide/setup-pci.c               |    2 -
 drivers/macintosh/via-pmu68k.c        |   11 +++++----
 drivers/message/fusion/linux_compat.h |    7 +----
 drivers/message/fusion/mptbase.c      |    2 -
 drivers/pci/probe.c                   |    1 
 drivers/pci/search.c                  |   40 ++++++++++++++++++++++++++++++++++
 include/linux/pci.h                   |   20 +++++++----------
 8 files changed, 61 insertions(+), 26 deletions(-)
-----

Greg Kroah-Hartman:
  o PCI: remove EXPORT_SYMBOL(pci_devices)
  o PCI: move pci_present() into drivers/pci/search.c
  o PCI: remove pci_for_each_dev_reverse() now that all users of it are gone
  o PCI: remove usage of pci_for_each_dev_reverse() in
  o PCI: add pci_find_device_reverse() for users of pci_find_each_dev_reverse() to use
  o PCI: fix up previous fusion driver pci changes
  o PCI: remove direct access of pci_devices from drivers/macintosh/via-pmu68k.c
  o PCI: remove direct access of pci_devices from arch/m68k/atari/hades-pci.c


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] More PCI fixes for 2.5.70
  2003-06-05 21:01           ` Greg KH
@ 2003-06-05 21:01             ` Greg KH
  2003-06-05 21:01               ` Greg KH
  0 siblings, 1 reply; 9+ messages in thread
From: Greg KH @ 2003-06-05 21:01 UTC (permalink / raw)
  To: linux-kernel

ChangeSet 1.1317, 2003/06/05 12:04:33-07:00, greg@kroah.com

[PATCH] PCI: move pci_present() into drivers/pci/search.c

This will let not have to export the pci_devices variable.


 drivers/pci/search.c |   11 +++++++++++
 include/linux/pci.h  |    6 +-----
 2 files changed, 12 insertions(+), 5 deletions(-)


diff -Nru a/drivers/pci/search.c b/drivers/pci/search.c
--- a/drivers/pci/search.c	Thu Jun  5 13:52:43 2003
+++ b/drivers/pci/search.c	Thu Jun  5 13:52:43 2003
@@ -171,9 +171,20 @@
 	return NULL;
 }
 
+/**
+ * pci_present - determine if there are any pci devices on this system
+ *
+ * Returns 0 if no pci devices are present, 1 if pci devices are present.
+ */
+int pci_present(void)
+{
+	return !list_empty(&pci_devices);
+}
+
 EXPORT_SYMBOL(pci_find_bus);
 EXPORT_SYMBOL(pci_find_class);
 EXPORT_SYMBOL(pci_find_device);
 EXPORT_SYMBOL(pci_find_device_reverse);
 EXPORT_SYMBOL(pci_find_slot);
 EXPORT_SYMBOL(pci_find_subsys);
+EXPORT_SYMBOL(pci_present);
diff -Nru a/include/linux/pci.h b/include/linux/pci.h
--- a/include/linux/pci.h	Thu Jun  5 13:52:43 2003
+++ b/include/linux/pci.h	Thu Jun  5 13:52:43 2003
@@ -522,14 +522,10 @@
 /* these external functions are only available when PCI support is enabled */
 #ifdef CONFIG_PCI
 
-static inline int pci_present(void)
-{
-	return !list_empty(&pci_devices);
-}
-
 #define pci_for_each_bus(bus) \
 	for(bus = pci_bus_b(pci_root_buses.next); bus != pci_bus_b(&pci_root_buses); bus = pci_bus_b(bus->node.next))
 
+int pci_present(void);
 void pcibios_fixup_bus(struct pci_bus *);
 int pcibios_enable_device(struct pci_dev *, int mask);
 char *pcibios_setup (char *str);


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] More PCI fixes for 2.5.70
  2003-06-05 21:01       ` Greg KH
@ 2003-06-05 21:01         ` Greg KH
  2003-06-05 21:01           ` Greg KH
  0 siblings, 1 reply; 9+ messages in thread
From: Greg KH @ 2003-06-05 21:01 UTC (permalink / raw)
  To: linux-kernel

ChangeSet 1.1315, 2003/06/05 12:04:12-07:00, greg@kroah.com

[PATCH] PCI: remove usage of pci_for_each_dev_reverse() in


 drivers/ide/setup-pci.c |    2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)


diff -Nru a/drivers/ide/setup-pci.c b/drivers/ide/setup-pci.c
--- a/drivers/ide/setup-pci.c	Thu Jun  5 13:52:52 2003
+++ b/drivers/ide/setup-pci.c	Thu Jun  5 13:52:52 2003
@@ -880,7 +880,7 @@
 			ide_scan_pcidev(dev);
 		}
 	} else {
-		pci_for_each_dev_reverse(dev) {
+		while ((dev = pci_find_device_reverse(PCI_ANY_ID, PCI_ANY_ID, dev)) != NULL) {
 			ide_scan_pcidev(dev);
 		}
 	}


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] More PCI fixes for 2.5.70
  2003-06-05 21:01     ` Greg KH
@ 2003-06-05 21:01       ` Greg KH
  2003-06-05 21:01         ` Greg KH
  0 siblings, 1 reply; 9+ messages in thread
From: Greg KH @ 2003-06-05 21:01 UTC (permalink / raw)
  To: linux-kernel

ChangeSet 1.1314, 2003/06/05 12:04:02-07:00, greg@kroah.com

[PATCH] PCI: add pci_find_device_reverse() for users of pci_find_each_dev_reverse() to use


 drivers/pci/search.c |   29 +++++++++++++++++++++++++++++
 include/linux/pci.h  |    1 +
 2 files changed, 30 insertions(+)


diff -Nru a/drivers/pci/search.c b/drivers/pci/search.c
--- a/drivers/pci/search.c	Thu Jun  5 13:52:57 2003
+++ b/drivers/pci/search.c	Thu Jun  5 13:52:57 2003
@@ -118,6 +118,34 @@
 
 
 /**
+ * pci_find_device_reverse - begin or continue searching for a PCI device by vendor/device id
+ * @vendor: PCI vendor id to match, or %PCI_ANY_ID to match all vendor ids
+ * @device: PCI device id to match, or %PCI_ANY_ID to match all device ids
+ * @from: Previous PCI device found in search, or %NULL for new search.
+ *
+ * Iterates through the list of known PCI devices in the reverse order of pci_find_device().
+ * If a PCI device is found with a matching @vendor and @device, a pointer to
+ * its device structure is returned.  Otherwise, %NULL is returned.
+ * A new search is initiated by passing %NULL to the @from argument.
+ * Otherwise if @from is not %NULL, searches continue from previous device on the global list.
+ */
+struct pci_dev *
+pci_find_device_reverse(unsigned int vendor, unsigned int device, const struct pci_dev *from)
+{
+	struct list_head *n = from ? from->global_list.prev : pci_devices.prev;
+
+	while (n != &pci_devices) {
+		struct pci_dev *dev = pci_dev_g(n);
+		if ((vendor == PCI_ANY_ID || dev->vendor == vendor) &&
+		    (device == PCI_ANY_ID || dev->device == device))
+			return dev;
+		n = n->prev;
+	}
+	return NULL;
+}
+
+
+/**
  * pci_find_class - begin or continue searching for a PCI device by class
  * @class: search for a PCI device with this class designation
  * @from: Previous PCI device found in search, or %NULL for new search.
@@ -146,5 +174,6 @@
 EXPORT_SYMBOL(pci_find_bus);
 EXPORT_SYMBOL(pci_find_class);
 EXPORT_SYMBOL(pci_find_device);
+EXPORT_SYMBOL(pci_find_device_reverse);
 EXPORT_SYMBOL(pci_find_slot);
 EXPORT_SYMBOL(pci_find_subsys);
diff -Nru a/include/linux/pci.h b/include/linux/pci.h
--- a/include/linux/pci.h	Thu Jun  5 13:52:57 2003
+++ b/include/linux/pci.h	Thu Jun  5 13:52:57 2003
@@ -564,6 +564,7 @@
 /* Generic PCI functions exported to card drivers */
 
 struct pci_dev *pci_find_device (unsigned int vendor, unsigned int device, const struct pci_dev *from);
+struct pci_dev *pci_find_device_reverse (unsigned int vendor, unsigned int device, const struct pci_dev *from);
 struct pci_dev *pci_find_subsys (unsigned int vendor, unsigned int device,
 				 unsigned int ss_vendor, unsigned int ss_device,
 				 const struct pci_dev *from);


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] More PCI fixes for 2.5.70
  2003-06-05 21:01             ` Greg KH
@ 2003-06-05 21:01               ` Greg KH
  0 siblings, 0 replies; 9+ messages in thread
From: Greg KH @ 2003-06-05 21:01 UTC (permalink / raw)
  To: linux-kernel

ChangeSet 1.1318, 2003/06/05 12:04:44-07:00, greg@kroah.com

[PATCH] PCI: remove EXPORT_SYMBOL(pci_devices)

Now the only users of this directly should be the pci core and arch specific
pci core code.


 drivers/pci/probe.c |    1 -
 include/linux/pci.h |   11 +++++++----
 2 files changed, 7 insertions(+), 5 deletions(-)


diff -Nru a/drivers/pci/probe.c b/drivers/pci/probe.c
--- a/drivers/pci/probe.c	Thu Jun  5 13:52:38 2003
+++ b/drivers/pci/probe.c	Thu Jun  5 13:52:38 2003
@@ -689,7 +689,6 @@
 }
 EXPORT_SYMBOL(pci_scan_bus_parented);
 
-EXPORT_SYMBOL(pci_devices);
 EXPORT_SYMBOL(pci_root_buses);
 
 #ifdef CONFIG_HOTPLUG
diff -Nru a/include/linux/pci.h b/include/linux/pci.h
--- a/include/linux/pci.h	Thu Jun  5 13:52:38 2003
+++ b/include/linux/pci.h	Thu Jun  5 13:52:38 2003
@@ -468,10 +468,6 @@
 
 #define pci_bus_b(n) list_entry(n, struct pci_bus, node)
 
-extern struct list_head pci_root_buses;	/* list of all known PCI buses */
-extern struct list_head pci_devices;	/* list of all devices */
-extern struct bus_type pci_bus_type;
-
 /*
  * Error values that may be returned by PCI functions.
  */
@@ -521,6 +517,13 @@
 
 /* these external functions are only available when PCI support is enabled */
 #ifdef CONFIG_PCI
+
+extern struct bus_type pci_bus_type;
+
+/* Do NOT directly access these two variables, unless you are arch specific pci
+ * code, or pci core code. */
+extern struct list_head pci_root_buses;	/* list of all known PCI buses */
+extern struct list_head pci_devices;	/* list of all devices */
 
 #define pci_for_each_bus(bus) \
 	for(bus = pci_bus_b(pci_root_buses.next); bus != pci_bus_b(&pci_root_buses); bus = pci_bus_b(bus->node.next))


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] More PCI fixes for 2.5.70
  2003-06-05 21:01   ` Greg KH
@ 2003-06-05 21:01     ` Greg KH
  2003-06-05 21:01       ` Greg KH
  0 siblings, 1 reply; 9+ messages in thread
From: Greg KH @ 2003-06-05 21:01 UTC (permalink / raw)
  To: linux-kernel

ChangeSet 1.1313, 2003/06/05 12:03:52-07:00, greg@kroah.com

[PATCH] PCI: fix up previous fusion driver pci changes

This makes the driver build properly now, and removes a direct access
of the pci_devices variable.


 drivers/message/fusion/linux_compat.h |    7 ++-----
 drivers/message/fusion/mptbase.c      |    2 +-
 2 files changed, 3 insertions(+), 6 deletions(-)


diff -Nru a/drivers/message/fusion/linux_compat.h b/drivers/message/fusion/linux_compat.h
--- a/drivers/message/fusion/linux_compat.h	Thu Jun  5 13:53:01 2003
+++ b/drivers/message/fusion/linux_compat.h	Thu Jun  5 13:53:01 2003
@@ -147,9 +147,7 @@
 
 
 /* PCI/driver subsystem { */
-#ifndef pci_for_each_dev
-#define pci_for_each_dev(dev)		for((dev)=pci_devices; (dev)!=NULL; (dev)=(dev)->next)
-#define pci_peek_next_dev(dev)		((dev)->next ? (dev)->next : NULL)
+#if 0	/* FIXME Don't know what to use to check for the proper kernel version */
 #define DEVICE_COUNT_RESOURCE           6
 #define PCI_BASEADDR_FLAGS(idx)         base_address[idx]
 #define PCI_BASEADDR_START(idx)         base_address[idx] & ~0xFUL
@@ -169,11 +167,10 @@
 	(4 - size); \
 })
 #else
-#define pci_peek_next_dev(dev)		((dev) != pci_dev_g(&pci_devices) ? pci_dev_g((dev)->global_list.next) : NULL)
 #define PCI_BASEADDR_FLAGS(idx)         resource[idx].flags
 #define PCI_BASEADDR_START(idx)         resource[idx].start
 #define PCI_BASEADDR_SIZE(dev,idx)      (dev)->resource[idx].end - (dev)->resource[idx].start + 1
-#endif		/* } ifndef pci_for_each_dev */
+#endif		/* } ifndef 0 */
 
 
 /* Compatability for the 2.3.x PCI DMA API. */
diff -Nru a/drivers/message/fusion/mptbase.c b/drivers/message/fusion/mptbase.c
--- a/drivers/message/fusion/mptbase.c	Thu Jun  5 13:53:01 2003
+++ b/drivers/message/fusion/mptbase.c	Thu Jun  5 13:53:01 2003
@@ -1184,7 +1184,7 @@
 		 * Do some kind of look ahead here...
 		 */
 		if (pdev->devfn & 1) {
-			pdev2 = pci_peek_next_dev(pdev);
+			pdev2 = pci_find_device(PCI_ANY_ID, PCI_ANY_ID, pdev);
 			if (pdev2 && (pdev2->vendor == 0x1000) &&
 			    (PCI_SLOT(pdev2->devfn) == PCI_SLOT(pdev->devfn)) &&
 			    (pdev2->device == pdev->device) &&


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] More PCI fixes for 2.5.70
  2003-06-05 21:01 ` [PATCH] " Greg KH
@ 2003-06-05 21:01   ` Greg KH
  2003-06-05 21:01     ` Greg KH
  0 siblings, 1 reply; 9+ messages in thread
From: Greg KH @ 2003-06-05 21:01 UTC (permalink / raw)
  To: linux-kernel

ChangeSet 1.1312, 2003/06/05 12:03:40-07:00, greg@kroah.com

[PATCH] PCI: remove direct access of pci_devices from drivers/macintosh/via-pmu68k.c

Yeah, this is commented out code, but just trying to be complete...


 drivers/macintosh/via-pmu68k.c |   11 ++++++-----
 1 files changed, 6 insertions(+), 5 deletions(-)


diff -Nru a/drivers/macintosh/via-pmu68k.c b/drivers/macintosh/via-pmu68k.c
--- a/drivers/macintosh/via-pmu68k.c	Thu Jun  5 13:53:06 2003
+++ b/drivers/macintosh/via-pmu68k.c	Thu Jun  5 13:53:06 2003
@@ -839,11 +839,11 @@
 pbook_pci_save(void)
 {
 	int npci;
-	struct pci_dev *pd;
+	struct pci_dev *pd = NULL;
 	struct pci_save *ps;
 
 	npci = 0;
-	for (pd = pci_devices; pd != NULL; pd = pd->next)
+	while ((pd = pci_find_device(PCI_ANY_ID, PCI_ANY_ID, pd)) != NULL)
 		++npci;
 	n_pbook_pci_saves = npci;
 	if (npci == 0)
@@ -853,7 +853,8 @@
 	if (ps == NULL)
 		return;
 
-	for (pd = pci_devices; pd != NULL && npci != 0; pd = pd->next) {
+	pd = NULL;
+	while ((pd = pci_find_device(PCI_ANY_ID, PCI_ANY_ID, pd)) != NULL) {
 		pci_read_config_word(pd, PCI_COMMAND, &ps->command);
 		pci_read_config_word(pd, PCI_CACHE_LINE_SIZE, &ps->cache_lat);
 		pci_read_config_word(pd, PCI_INTERRUPT_LINE, &ps->intr);
@@ -867,10 +868,10 @@
 {
 	u16 cmd;
 	struct pci_save *ps = pbook_pci_saves;
-	struct pci_dev *pd;
+	struct pci_dev *pd = NULL;
 	int j;
 
-	for (pd = pci_devices; pd != NULL; pd = pd->next, ++ps) {
+	while ((pd = pci_find_device(PCI_ANY_ID, PCI_ANY_ID, pd)) != NULL) {
 		if (ps->command == 0)
 			continue;
 		pci_read_config_word(pd, PCI_COMMAND, &cmd);


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] More PCI fixes for 2.5.70
  2003-06-05 21:01         ` Greg KH
@ 2003-06-05 21:01           ` Greg KH
  2003-06-05 21:01             ` Greg KH
  0 siblings, 1 reply; 9+ messages in thread
From: Greg KH @ 2003-06-05 21:01 UTC (permalink / raw)
  To: linux-kernel

ChangeSet 1.1316, 2003/06/05 12:04:22-07:00, greg@kroah.com

[PATCH] PCI: remove pci_for_each_dev_reverse() now that all users of it are gone.


 include/linux/pci.h |    2 --
 1 files changed, 2 deletions(-)


diff -Nru a/include/linux/pci.h b/include/linux/pci.h
--- a/include/linux/pci.h	Thu Jun  5 13:52:48 2003
+++ b/include/linux/pci.h	Thu Jun  5 13:52:48 2003
@@ -527,8 +527,6 @@
 	return !list_empty(&pci_devices);
 }
 
-#define pci_for_each_dev_reverse(dev) \
-	for(dev = pci_dev_g(pci_devices.prev); dev != pci_dev_g(&pci_devices); dev = pci_dev_g(dev->global_list.prev))
 #define pci_for_each_bus(bus) \
 	for(bus = pci_bus_b(pci_root_buses.next); bus != pci_bus_b(&pci_root_buses); bus = pci_bus_b(bus->node.next))
 


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH] More PCI fixes for 2.5.70
  2003-06-05 21:00 [BK PATCH] More PCI fixes for 2.5.70 Greg KH
@ 2003-06-05 21:01 ` Greg KH
  2003-06-05 21:01   ` Greg KH
  0 siblings, 1 reply; 9+ messages in thread
From: Greg KH @ 2003-06-05 21:01 UTC (permalink / raw)
  To: linux-kernel

ChangeSet 1.1311, 2003/06/05 12:03:29-07:00, greg@kroah.com

[PATCH] PCI: remove direct access of pci_devices from arch/m68k/atari/hades-pci.c


 arch/m68k/atari/hades-pci.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)


diff -Nru a/arch/m68k/atari/hades-pci.c b/arch/m68k/atari/hades-pci.c
--- a/arch/m68k/atari/hades-pci.c	Thu Jun  5 13:53:11 2003
+++ b/arch/m68k/atari/hades-pci.c	Thu Jun  5 13:53:11 2003
@@ -297,14 +297,14 @@
 			    IRQ_TT_MFP_SCC,	/* Slot 2. */
 			    IRQ_TT_MFP_SCSIDMA	/* Slot 3. */
 			  };
-	struct pci_dev *dev;
+	struct pci_dev *dev = NULL;
 	unsigned char slot;
 
 	/*
 	 * Go through all devices, fixing up irqs as we see fit:
 	 */
 
-	for (dev = pci_devices; dev; dev = dev->next)
+	while ((dev = pci_find_device(PCI_ANY_ID, PCI_ANY_ID, dev)) != NULL)
 	{
 		if (dev->class >> 16 != PCI_BASE_CLASS_BRIDGE)
 		{


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2003-06-05 21:12 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-06-05 21:00 [BK PATCH] More PCI fixes for 2.5.70 Greg KH
2003-06-05 21:01 ` [PATCH] " Greg KH
2003-06-05 21:01   ` Greg KH
2003-06-05 21:01     ` Greg KH
2003-06-05 21:01       ` Greg KH
2003-06-05 21:01         ` Greg KH
2003-06-05 21:01           ` Greg KH
2003-06-05 21:01             ` Greg KH
2003-06-05 21:01               ` Greg KH

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).