X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=drivers%2Fblock%2Fparide%2Fpg.c;h=79b868254032a68505abb3140b8918f8395ee4e2;hb=9464c7cf61b9433057924c36e6e02f303a00e768;hp=13f998aa1cd3ffc19ccf402fd901b91e8b0dbf2d;hpb=41689045f6a3cbe0550e1d34e9cc20d2e8c432ba;p=linux-2.6.git diff --git a/drivers/block/paride/pg.c b/drivers/block/paride/pg.c index 13f998aa1..79b868254 100644 --- a/drivers/block/paride/pg.c +++ b/drivers/block/paride/pg.c @@ -156,6 +156,7 @@ enum {D_PRT, D_PRO, D_UNI, D_MOD, D_SLV, D_DLY}; #include #include #include +#include #include #include #include @@ -673,15 +674,25 @@ static int __init pg_init(void) err = PTR_ERR(pg_class); goto out_chrdev; } + devfs_mk_dir("pg"); for (unit = 0; unit < PG_UNITS; unit++) { struct pg *dev = &devices[unit]; - if (dev->present) + if (dev->present) { class_device_create(pg_class, NULL, MKDEV(major, unit), NULL, "pg%u", unit); + err = devfs_mk_cdev(MKDEV(major, unit), + S_IFCHR | S_IRUSR | S_IWUSR, "pg/%u", + unit); + if (err) + goto out_class; + } } err = 0; goto out; +out_class: + class_device_destroy(pg_class, MKDEV(major, unit)); + class_destroy(pg_class); out_chrdev: unregister_chrdev(major, "pg"); out: @@ -694,10 +705,13 @@ static void __exit pg_exit(void) for (unit = 0; unit < PG_UNITS; unit++) { struct pg *dev = &devices[unit]; - if (dev->present) + if (dev->present) { class_device_destroy(pg_class, MKDEV(major, unit)); + devfs_remove("pg/%u", unit); + } } class_destroy(pg_class); + devfs_remove("pg"); unregister_chrdev(major, name); for (unit = 0; unit < PG_UNITS; unit++) {