Commit deb36970 authored by gregkh@suse.de's avatar gregkh@suse.de Committed by Greg Kroah-Hartman

[PATCH] class: convert drivers/block/* to use the new class api instead of class_simple

Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 619e666b
...@@ -36,7 +36,7 @@ static int emsgs_head_idx, emsgs_tail_idx; ...@@ -36,7 +36,7 @@ static int emsgs_head_idx, emsgs_tail_idx;
static struct semaphore emsgs_sema; static struct semaphore emsgs_sema;
static spinlock_t emsgs_lock; static spinlock_t emsgs_lock;
static int nblocked_emsgs_readers; static int nblocked_emsgs_readers;
static struct class_simple *aoe_class; static struct class *aoe_class;
static struct aoe_chardev chardevs[] = { static struct aoe_chardev chardevs[] = {
{ MINOR_ERR, "err" }, { MINOR_ERR, "err" },
{ MINOR_DISCOVER, "discover" }, { MINOR_DISCOVER, "discover" },
...@@ -218,13 +218,13 @@ aoechr_init(void) ...@@ -218,13 +218,13 @@ aoechr_init(void)
} }
sema_init(&emsgs_sema, 0); sema_init(&emsgs_sema, 0);
spin_lock_init(&emsgs_lock); spin_lock_init(&emsgs_lock);
aoe_class = class_simple_create(THIS_MODULE, "aoe"); aoe_class = class_create(THIS_MODULE, "aoe");
if (IS_ERR(aoe_class)) { if (IS_ERR(aoe_class)) {
unregister_chrdev(AOE_MAJOR, "aoechr"); unregister_chrdev(AOE_MAJOR, "aoechr");
return PTR_ERR(aoe_class); return PTR_ERR(aoe_class);
} }
for (i = 0; i < ARRAY_SIZE(chardevs); ++i) for (i = 0; i < ARRAY_SIZE(chardevs); ++i)
class_simple_device_add(aoe_class, class_device_create(aoe_class,
MKDEV(AOE_MAJOR, chardevs[i].minor), MKDEV(AOE_MAJOR, chardevs[i].minor),
NULL, chardevs[i].name); NULL, chardevs[i].name);
...@@ -237,8 +237,8 @@ aoechr_exit(void) ...@@ -237,8 +237,8 @@ aoechr_exit(void)
int i; int i;
for (i = 0; i < ARRAY_SIZE(chardevs); ++i) for (i = 0; i < ARRAY_SIZE(chardevs); ++i)
class_simple_device_remove(MKDEV(AOE_MAJOR, chardevs[i].minor)); class_device_destroy(aoe_class, MKDEV(AOE_MAJOR, chardevs[i].minor));
class_simple_destroy(aoe_class); class_destroy(aoe_class);
unregister_chrdev(AOE_MAJOR, "aoechr"); unregister_chrdev(AOE_MAJOR, "aoechr");
} }
...@@ -222,7 +222,7 @@ static int pg_identify(struct pg *dev, int log); ...@@ -222,7 +222,7 @@ static int pg_identify(struct pg *dev, int log);
static char pg_scratch[512]; /* scratch block buffer */ static char pg_scratch[512]; /* scratch block buffer */
static struct class_simple *pg_class; static struct class *pg_class;
/* kernel glue structures */ /* kernel glue structures */
...@@ -666,7 +666,7 @@ static int __init pg_init(void) ...@@ -666,7 +666,7 @@ static int __init pg_init(void)
err = -1; err = -1;
goto out; goto out;
} }
pg_class = class_simple_create(THIS_MODULE, "pg"); pg_class = class_create(THIS_MODULE, "pg");
if (IS_ERR(pg_class)) { if (IS_ERR(pg_class)) {
err = PTR_ERR(pg_class); err = PTR_ERR(pg_class);
goto out_chrdev; goto out_chrdev;
...@@ -675,7 +675,7 @@ static int __init pg_init(void) ...@@ -675,7 +675,7 @@ static int __init pg_init(void)
for (unit = 0; unit < PG_UNITS; unit++) { for (unit = 0; unit < PG_UNITS; unit++) {
struct pg *dev = &devices[unit]; struct pg *dev = &devices[unit];
if (dev->present) { if (dev->present) {
class_simple_device_add(pg_class, MKDEV(major, unit), class_device_create(pg_class, MKDEV(major, unit),
NULL, "pg%u", unit); NULL, "pg%u", unit);
err = devfs_mk_cdev(MKDEV(major, unit), err = devfs_mk_cdev(MKDEV(major, unit),
S_IFCHR | S_IRUSR | S_IWUSR, "pg/%u", S_IFCHR | S_IRUSR | S_IWUSR, "pg/%u",
...@@ -688,8 +688,8 @@ static int __init pg_init(void) ...@@ -688,8 +688,8 @@ static int __init pg_init(void)
goto out; goto out;
out_class: out_class:
class_simple_device_remove(MKDEV(major, unit)); class_device_destroy(pg_class, MKDEV(major, unit));
class_simple_destroy(pg_class); class_destroy(pg_class);
out_chrdev: out_chrdev:
unregister_chrdev(major, "pg"); unregister_chrdev(major, "pg");
out: out:
...@@ -703,11 +703,11 @@ static void __exit pg_exit(void) ...@@ -703,11 +703,11 @@ static void __exit pg_exit(void)
for (unit = 0; unit < PG_UNITS; unit++) { for (unit = 0; unit < PG_UNITS; unit++) {
struct pg *dev = &devices[unit]; struct pg *dev = &devices[unit];
if (dev->present) { if (dev->present) {
class_simple_device_remove(MKDEV(major, unit)); class_device_destroy(pg_class, MKDEV(major, unit));
devfs_remove("pg/%u", unit); devfs_remove("pg/%u", unit);
} }
} }
class_simple_destroy(pg_class); class_destroy(pg_class);
devfs_remove("pg"); devfs_remove("pg");
unregister_chrdev(major, name); unregister_chrdev(major, name);
......
...@@ -242,7 +242,7 @@ static struct file_operations pt_fops = { ...@@ -242,7 +242,7 @@ static struct file_operations pt_fops = {
}; };
/* sysfs class support */ /* sysfs class support */
static struct class_simple *pt_class; static struct class *pt_class;
static inline int status_reg(struct pi_adapter *pi) static inline int status_reg(struct pi_adapter *pi)
{ {
...@@ -963,7 +963,7 @@ static int __init pt_init(void) ...@@ -963,7 +963,7 @@ static int __init pt_init(void)
err = -1; err = -1;
goto out; goto out;
} }
pt_class = class_simple_create(THIS_MODULE, "pt"); pt_class = class_create(THIS_MODULE, "pt");
if (IS_ERR(pt_class)) { if (IS_ERR(pt_class)) {
err = PTR_ERR(pt_class); err = PTR_ERR(pt_class);
goto out_chrdev; goto out_chrdev;
...@@ -972,29 +972,29 @@ static int __init pt_init(void) ...@@ -972,29 +972,29 @@ static int __init pt_init(void)
devfs_mk_dir("pt"); devfs_mk_dir("pt");
for (unit = 0; unit < PT_UNITS; unit++) for (unit = 0; unit < PT_UNITS; unit++)
if (pt[unit].present) { if (pt[unit].present) {
class_simple_device_add(pt_class, MKDEV(major, unit), class_device_create(pt_class, MKDEV(major, unit),
NULL, "pt%d", unit); NULL, "pt%d", unit);
err = devfs_mk_cdev(MKDEV(major, unit), err = devfs_mk_cdev(MKDEV(major, unit),
S_IFCHR | S_IRUSR | S_IWUSR, S_IFCHR | S_IRUSR | S_IWUSR,
"pt/%d", unit); "pt/%d", unit);
if (err) { if (err) {
class_simple_device_remove(MKDEV(major, unit)); class_device_destroy(pt_class, MKDEV(major, unit));
goto out_class; goto out_class;
} }
class_simple_device_add(pt_class, MKDEV(major, unit + 128), class_device_create(pt_class, MKDEV(major, unit + 128),
NULL, "pt%dn", unit); NULL, "pt%dn", unit);
err = devfs_mk_cdev(MKDEV(major, unit + 128), err = devfs_mk_cdev(MKDEV(major, unit + 128),
S_IFCHR | S_IRUSR | S_IWUSR, S_IFCHR | S_IRUSR | S_IWUSR,
"pt/%dn", unit); "pt/%dn", unit);
if (err) { if (err) {
class_simple_device_remove(MKDEV(major, unit + 128)); class_device_destroy(pt_class, MKDEV(major, unit + 128));
goto out_class; goto out_class;
} }
} }
goto out; goto out;
out_class: out_class:
class_simple_destroy(pt_class); class_destroy(pt_class);
out_chrdev: out_chrdev:
unregister_chrdev(major, "pt"); unregister_chrdev(major, "pt");
out: out:
...@@ -1006,12 +1006,12 @@ static void __exit pt_exit(void) ...@@ -1006,12 +1006,12 @@ static void __exit pt_exit(void)
int unit; int unit;
for (unit = 0; unit < PT_UNITS; unit++) for (unit = 0; unit < PT_UNITS; unit++)
if (pt[unit].present) { if (pt[unit].present) {
class_simple_device_remove(MKDEV(major, unit)); class_device_destroy(pt_class, MKDEV(major, unit));
devfs_remove("pt/%d", unit); devfs_remove("pt/%d", unit);
class_simple_device_remove(MKDEV(major, unit + 128)); class_device_destroy(pt_class, MKDEV(major, unit + 128));
devfs_remove("pt/%dn", unit); devfs_remove("pt/%dn", unit);
} }
class_simple_destroy(pt_class); class_destroy(pt_class);
devfs_remove("pt"); devfs_remove("pt");
unregister_chrdev(major, name); unregister_chrdev(major, name);
for (unit = 0; unit < PT_UNITS; unit++) for (unit = 0; unit < PT_UNITS; unit++)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment