Re: [PATCH] add PCI ROMs to sysfs

From: Greg KH
Date: Wed Aug 25 2004 - 13:22:15 EST


On Wed, Aug 25, 2004 at 11:06:06AM -0700, Jon Smirl wrote:
> Final version, I hope, includes short decription and Signed-off-by at
> top of patch.

Hm, one comment. I must have missed something in all of the different
versions of this patch, but why are you changing this code:

> diff -Nru a/drivers/pci/proc.c b/drivers/pci/proc.c
> --- a/drivers/pci/proc.c Wed Aug 25 13:56:18 2004
> +++ b/drivers/pci/proc.c Wed Aug 25 13:56:18 2004
> @@ -16,7 +16,6 @@
> #include <asm/uaccess.h>
> #include <asm/byteorder.h>
>
> -static int proc_initialized; /* = 0 */
>
> static loff_t
> proc_bus_pci_lseek(struct file *file, loff_t off, int whence)
> @@ -387,9 +386,6 @@
> struct proc_dir_entry *de, *e;
> char name[16];
>
> - if (!proc_initialized)
> - return -EACCES;
> -
> if (!(de = bus->procdir)) {
> if (pci_name_bus(name, bus))
> return -EEXIST;
> @@ -425,9 +421,6 @@
> {
> struct proc_dir_entry *de = bus->procdir;
>
> - if (!proc_initialized)
> - return -EACCES;
> -
> if (!de) {
> char name[16];
> sprintf(name, "%02x", bus->number);
> @@ -583,6 +576,7 @@
> {
> return seq_open(file, &proc_bus_pci_devices_op);
> }
> +
> static struct file_operations proc_bus_pci_dev_operations = {
> .open = proc_bus_pci_dev_open,
> .read = seq_read,
> @@ -593,16 +587,20 @@
> static int __init pci_proc_init(void)
> {
> struct proc_dir_entry *entry;
> - struct pci_dev *dev = NULL;
> + struct pci_dev *pdev = NULL;
> +
> proc_bus_pci_dir = proc_mkdir("pci", proc_bus);
> +
> entry = create_proc_entry("devices", 0, proc_bus_pci_dir);
> if (entry)
> entry->proc_fops = &proc_bus_pci_dev_operations;
> - proc_initialized = 1;
> - while ((dev = pci_find_device(PCI_ANY_ID, PCI_ANY_ID, dev)) != NULL) {
> - pci_proc_attach_device(dev);
> +
> + while ((pdev = pci_find_device(PCI_ANY_ID, PCI_ANY_ID, pdev)) != NULL) {
> + pci_proc_attach_device(pdev);
> }
> +
> legacy_proc_init();
> +
> return 0;
> }

I see some gratitous whitespace changes, and the removal of the
proc_initialized flag. Why do we need to get rid of that flag?

thanks,

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