X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;f=drivers%2Fblock%2Fparide%2Fpg.c;h=9970aedbb5d9a05f049b33d7cce2b7079a5436a4;hb=4522d58275f124105819723e24e912c8e5bf3cdd;hp=b3982395f22b4d56fcc0de0f1f555ee699b2447f;hpb=4e0c1159d83a658d1ffba5bc3442f4ec4cadb436;p=powerpc.git diff --git a/drivers/block/paride/pg.c b/drivers/block/paride/pg.c index b3982395f2..9970aedbb5 100644 --- a/drivers/block/paride/pg.c +++ b/drivers/block/paride/pg.c @@ -156,12 +156,13 @@ enum {D_PRT, D_PRO, D_UNI, D_MOD, D_SLV, D_DLY}; #include #include #include -#include #include #include #include #include #include +#include /* current, TASK_* */ +#include #include @@ -641,54 +642,46 @@ static ssize_t pg_read(struct file *filp, char __user *buf, size_t count, loff_t static int __init pg_init(void) { - int unit, err = 0; + int unit; + int err; if (disable){ - err = -1; + err = -EINVAL; goto out; } pg_init_units(); if (pg_detect()) { - err = -1; + err = -ENODEV; goto out; } - if (register_chrdev(major, name, &pg_fops)) { + err = register_chrdev(major, name, &pg_fops); + if (err < 0) { printk("pg_init: unable to get major number %d\n", major); for (unit = 0; unit < PG_UNITS; unit++) { struct pg *dev = &devices[unit]; if (dev->present) pi_release(dev->pi); } - err = -1; goto out; } + major = err; /* In case the user specified `major=0' (dynamic) */ pg_class = class_create(THIS_MODULE, "pg"); if (IS_ERR(pg_class)) { 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) { - class_device_create(pg_class, MKDEV(major, unit), + 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: @@ -701,13 +694,10 @@ 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++) {