X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;f=drivers%2Fblock%2Fparide%2Fpt.c;h=d2013d362403819c49c2e21ffe54f64f311796cd;hb=3b71797eff4352b4295919efc52de84f84d33d94;hp=d8d35233cf495df4fd84fbdecd9cb65710137993;hpb=5833f1420b96c4f9b193b7f2fcbc0003dc032fe8;p=powerpc.git diff --git a/drivers/block/paride/pt.c b/drivers/block/paride/pt.c index d8d35233cf..d2013d3624 100644 --- a/drivers/block/paride/pt.c +++ b/drivers/block/paride/pt.c @@ -146,6 +146,7 @@ static int (*drives[4])[6] = {&drive0, &drive1, &drive2, &drive3}; #include #include #include +#include /* current, TASK_*, schedule_timeout() */ #include @@ -942,7 +943,8 @@ static ssize_t pt_write(struct file *filp, const char __user *buf, size_t count, static int __init pt_init(void) { - int unit, err = 0; + int unit; + int err; if (disable) { err = -1; @@ -954,14 +956,15 @@ static int __init pt_init(void) goto out; } - if (register_chrdev(major, name, &pt_fops)) { + err = register_chrdev(major, name, &pt_fops); + if (err < 0) { printk("pt_init: unable to get major number %d\n", major); for (unit = 0; unit < PT_UNITS; unit++) if (pt[unit].present) pi_release(pt[unit].pi); - err = -1; goto out; } + major = err; pt_class = class_create(THIS_MODULE, "pt"); if (IS_ERR(pt_class)) { err = PTR_ERR(pt_class); @@ -971,7 +974,7 @@ static int __init pt_init(void) devfs_mk_dir("pt"); for (unit = 0; unit < PT_UNITS; unit++) if (pt[unit].present) { - class_device_create(pt_class, MKDEV(major, unit), + class_device_create(pt_class, NULL, MKDEV(major, unit), NULL, "pt%d", unit); err = devfs_mk_cdev(MKDEV(major, unit), S_IFCHR | S_IRUSR | S_IWUSR, @@ -980,7 +983,7 @@ static int __init pt_init(void) class_device_destroy(pt_class, MKDEV(major, unit)); goto out_class; } - class_device_create(pt_class, MKDEV(major, unit + 128), + class_device_create(pt_class, NULL, MKDEV(major, unit + 128), NULL, "pt%dn", unit); err = devfs_mk_cdev(MKDEV(major, unit + 128), S_IFCHR | S_IRUSR | S_IWUSR,