[parisc-linux-cvs] linux tsbogend

Thomas Bogendoerfer tsbogend@alpha.franken.de
Sat, 26 Jan 2002 22:32:41 +0100


On Sat, Jan 26, 2002 at 02:22:15PM -0700, Thomas Bogendoerfer wrote:
> CVSROOT:	/var/cvs
> Module name:	linux
> Changes by:	tsbogend	02/01/26 14:22:15
> 
> Modified files:
> 	.              : Makefile 
> 
> Log message:
> 2.4.17-pa15:
> pci_hwpath() for printing hw path of pci devices moved from sticore.c
> to arch/parisc/kernel/pci.c for common use


Index: arch/parisc/kernel/drivers.c
===================================================================
RCS file: /home/cvs/parisc/linux/arch/parisc/kernel/drivers.c,v
retrieving revision 1.36
diff -u -p -r1.36 drivers.c
--- arch/parisc/kernel/drivers.c	2002/01/07 23:45:58	1.36
+++ arch/parisc/kernel/drivers.c	2002/01/26 20:58:25
@@ -204,7 +204,11 @@ get_node_path(struct parisc_device *dev,
 	}
 }
 
-void print_hwpath(struct parisc_device *dev, char *output)
+/* print_hwpath - Returns hardware path for PA devices
+ * dev: The device to return the path for
+ * output: Pointer to a previously-allocated array to place the path in.
+ */
+char *print_hwpath(struct parisc_device *dev, char *output)
 {
 	int i;
 	struct hardware_path path;
@@ -215,7 +219,8 @@ void print_hwpath(struct parisc_device *
 			continue;
 		output += sprintf(output, "%d/", path.bc[i]);
 	}
-	sprintf(output, "%d", dev->hw_path);
+	output += sprintf(output, "%d", dev->hw_path);
+	return output;
 }
 
 struct parisc_device * create_tree_node(char id, struct parisc_device *parent,
Index: arch/parisc/kernel/pci.c
===================================================================
RCS file: /home/cvs/parisc/linux/arch/parisc/kernel/pci.c,v
retrieving revision 1.32
diff -u -p -r1.32 pci.c
--- arch/parisc/kernel/pci.c	2001/12/26 21:55:00	1.32
+++ arch/parisc/kernel/pci.c	2002/01/26 20:03:45
@@ -510,3 +510,26 @@ void pcibios_register_hba(struct pci_hba
 	parisc_pci_hba[pci_hba_count] = hba;
 	hba->hba_num = pci_hba_count++;
 }
+
+/* pci_hwpath - Returns hardware path for PCI devices
+ *
+ */
+void pci_hwpath(struct pci_dev *dev, char *path)
+{
+	int i = 0;
+	unsigned char pci_path[6];
+	struct pci_bus *root;
+
+	pci_path[i++] = PCI_FUNC(dev->devfn);
+	pci_path[i++] = PCI_SLOT(dev->devfn);
+	for (root = dev->bus; root->parent; root = root->parent) {
+		pci_path[i++] = root->number;
+		if (i == 6)
+			break;
+	}
+
+	path = print_hwpath(HBA_DATA(root->sysdata)->dev, path);
+	while (i > 0) {
+		path += sprintf (path, "/%d", pci_path[--i]);
+	}
+}
Index: drivers/video/sti/sticore.c
===================================================================
RCS file: /home/cvs/parisc/linux/drivers/video/sti/sticore.c,v
retrieving revision 1.31
diff -u -p -r1.31 sticore.c
--- drivers/video/sti/sticore.c	2002/01/07 23:49:10	1.31
+++ drivers/video/sti/sticore.c	2002/01/26 20:03:45
@@ -950,22 +950,8 @@ static int __devinit sticore_pci_init(st
 	default:
 		sti = sti_try_rom_generic(rom_base, fb_base, pd);
 		if (sti) {
-			unsigned char pci_path[4];
-			char pa_path[21];
-			struct pci_bus *root;
-			int i = 0;
-			char *p;
-			
-			pci_path[i++] = PCI_FUNC(pd->devfn);
-			pci_path[i++] = PCI_SLOT(pd->devfn);
-			for (root = pd->bus; root->parent && i < 4; root = root->parent)
-				pci_path[i++] = root->number;
-			if (i >= 4)
-				break; /* too many bridges, shouldn't happen */
-			print_hwpath (HBA_DATA(root->sysdata)->dev, pa_path);
-			p = &pa_path[strlen(pa_path)];
-			while (i > 0)
-				p += sprintf (p, "/%d", pci_path[--i]);
+			char pa_path[30];
+			pci_hwpath(pd, pa_path);
 			sticore_check_for_default_sti(sti, pa_path);
 		}
 		break;
@@ -1062,4 +1048,3 @@ struct sti_struct * __init sti_get_rom(i
 	}
 	return sti_roms[i];
 }
-   
Index: include/asm-parisc/hardware.h
===================================================================
RCS file: /home/cvs/parisc/linux/include/asm-parisc/hardware.h,v
retrieving revision 1.31
diff -u -p -r1.31 hardware.h
--- include/asm-parisc/hardware.h	2001/11/17 02:07:46	1.31
+++ include/asm-parisc/hardware.h	2002/01/26 20:03:45
@@ -144,6 +144,7 @@ extern void fixup_child_irqs(struct pari
 		int (*choose)(struct parisc_device *parent));
 extern void print_subdevices(struct parisc_device *dev);
 extern void print_parisc_devices(void);
+extern char *print_hwpath(struct parisc_device *dev, char *path);
 
 /* inventory.c: */
 extern void do_memory_inventory(void);
Index: include/asm-parisc/pci.h
===================================================================
RCS file: /home/cvs/parisc/linux/include/asm-parisc/pci.h,v
retrieving revision 1.41
diff -u -p -r1.41 pci.h
--- include/asm-parisc/pci.h	2002/01/15 06:02:57	1.41
+++ include/asm-parisc/pci.h	2002/01/26 20:03:45
@@ -243,6 +243,8 @@ extern inline void pcibios_register_hba(
 /* Return the index of the PCI controller for device PDEV. */
 #define pci_controller_num(PDEV)	(0)
 
+void pci_hwpath(struct pci_dev *dev, char *path);
+
 #define GET_IOC(dev) ((struct ioc *)(HBA_DATA(dev->sysdata)->iommu))
 
 #ifdef CONFIG_IOMMU_CCIO

-- 
Crap can work. Given enough thrust pigs will fly, but it's not necessary a
good idea.                                 [ Alexander Viro on linux-kernel ]