Re: [PATCH] reimplement pci proc name

From: Martin Zwickel (martin.zwickel@technotrend.de)
Date: Fri Jun 20 2003 - 09:02:28 EST


Hi Matthew!

Just one question:
If pci_name_bus copies the bus' hex to name and always returns 0,
the "if (!pci_name_bus(name, bus)) return -EEXIST;" would always be true, right?

Or did I miss something?

Regards,
Martin

On Fri, 20 Jun 2003 14:48:11 +0100
Matthew Wilcox <willy@debian.org> bubbled:

>
> Index: drivers/pci/proc.c
> ===================================================================
> RCS file: /var/cvs/linux-2.5/drivers/pci/proc.c,v
> retrieving revision 1.9
> diff -u -p -r1.9 proc.c
> --- drivers/pci/proc.c 14 Jun 2003 22:15:29 -0000 1.9
> +++ drivers/pci/proc.c 17 Jun 2003 19:36:50 -0000
> @@ -383,7 +383,8 @@ int pci_proc_attach_device(struct pci_de
> return -EACCES;
>
> if (!(de = bus->procdir)) {
> - sprintf(name, "%02x", bus->number);
> + if (!pci_name_bus(name, bus))
> + return -EEXIST;
> de = bus->procdir = proc_mkdir(name, proc_bus_pci_dir);
> if (!de)
> return -ENOMEM;

> Index: include/linux/pci.h
> ===================================================================
> RCS file: /var/cvs/linux-2.5/include/linux/pci.h,v
> retrieving revision 1.17
> diff -u -p -r1.17 pci.h
> --- include/linux/pci.h 14 Jun 2003 22:16:01 -0000 1.17
> +++ include/linux/pci.h 19 Jun 2003 00:55:35 -0000
> @@ -808,6 +815,11 @@ extern int pci_pci_problems;
>
> #ifndef CONFIG_PCI_DOMAINS
> static inline int pci_domain_nr(struct pci_bus *bus) { return 0; }
> +static inline int pci_name_bus(char *name, struct pci_bus *bus)
> +{
> + sprintf(name, "%02x", bus->number);
> + return 0;
> +}
> #endif
>
> #endif /* __KERNEL__ */
>

-- 
MyExcuse:
Backbone adjustment

Martin Zwickel <martin.zwickel@technotrend.de> Research & Development

TechnoTrend AG <http://www.technotrend.de>


- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Mon Jun 23 2003 - 22:00:32 EST