Re: [PATCH] driverfs support for USB - take 2

From: Pavel Machek (pavel@suse.cz)
Date: Thu Jan 31 2002 - 07:49:43 EST


Hi!

> static int __init device_init_root(void)
> {
> - /* initialize parent bus lists */
> - return iobus_register(&device_root);
> + device_root = kmalloc(sizeof(*device_root),GFP_KERNEL);
> + if (!device_root)
> + return -ENOMEM;
> + memset(device_root,0,sizeof(*device_root));
> + strcpy(device_root->bus_id,"root");
> + strcpy(device_root->name,"System Root");
> + return device_register(device_root);
> }

Why don't you leave device_root allocated statically?

> @@ -1430,9 +1419,11 @@
> return NULL;
> list_add_tail(&b->node, &pci_root_buses);
>
> - sprintf(b->iobus.bus_id,"pci%d",bus);
> - strcpy(b->iobus.name,"Host/PCI Bridge");
> - iobus_register(&b->iobus);
> + b->dev = kmalloc(sizeof(*(b->dev)),GFP_KERNEL);
Uff... ~~~~~~~~~ would not "struct device" (or
what should it be) look better?

> + memset(b->dev,0,sizeof(*(b->dev)));

                                                                Pavel

-- 
Philips Velo 1: 1"x4"x8", 300gram, 60, 12MB, 40bogomips, linux, mutt,
details at http://atrey.karlin.mff.cuni.cz/~pavel/velo/index.html.

- 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 : Thu Jan 31 2002 - 21:01:38 EST