Skip to content

Commit ca8eca6

Browse files
committed
[PATCH] class: convert drivers/char/* to use the new class api instead of class_simple
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
1 parent deb3697 commit ca8eca6

14 files changed

Lines changed: 103 additions & 103 deletions

File tree

‎drivers/char/dsp56k.c‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ static struct dsp56k_device {
144144
int tx_wsize, rx_wsize;
145145
} dsp56k;
146146

147-
static struct class_simple *dsp56k_class;
147+
static struct class *dsp56k_class;
148148

149149
static int dsp56k_reset(void)
150150
{
@@ -510,12 +510,12 @@ static int __init dsp56k_init_driver(void)
510510
printk("DSP56k driver: Unable to register driver\n");
511511
return -ENODEV;
512512
}
513-
dsp56k_class = class_simple_create(THIS_MODULE, "dsp56k");
513+
dsp56k_class = class_create(THIS_MODULE, "dsp56k");
514514
if (IS_ERR(dsp56k_class)) {
515515
err = PTR_ERR(dsp56k_class);
516516
goto out_chrdev;
517517
}
518-
class_simple_device_add(dsp56k_class, MKDEV(DSP56K_MAJOR, 0), NULL, "dsp56k");
518+
class_device_create(dsp56k_class, MKDEV(DSP56K_MAJOR, 0), NULL, "dsp56k");
519519

520520
err = devfs_mk_cdev(MKDEV(DSP56K_MAJOR, 0),
521521
S_IFCHR | S_IRUSR | S_IWUSR, "dsp56k");
@@ -526,8 +526,8 @@ static int __init dsp56k_init_driver(void)
526526
goto out;
527527

528528
out_class:
529-
class_simple_device_remove(MKDEV(DSP56K_MAJOR, 0));
530-
class_simple_destroy(dsp56k_class);
529+
class_device_destroy(dsp56k_class, MKDEV(DSP56K_MAJOR, 0));
530+
class_destroy(dsp56k_class);
531531
out_chrdev:
532532
unregister_chrdev(DSP56K_MAJOR, "dsp56k");
533533
out:
@@ -537,8 +537,8 @@ module_init(dsp56k_init_driver);
537537

538538
static void __exit dsp56k_cleanup_driver(void)
539539
{
540-
class_simple_device_remove(MKDEV(DSP56K_MAJOR, 0));
541-
class_simple_destroy(dsp56k_class);
540+
class_device_destroy(dsp56k_class, MKDEV(DSP56K_MAJOR, 0));
541+
class_destroy(dsp56k_class);
542542
unregister_chrdev(DSP56K_MAJOR, "dsp56k");
543543
devfs_remove("dsp56k");
544544
}

‎drivers/char/ftape/zftape/zftape-init.c‎

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ static struct file_operations zft_cdev =
9999
.release = zft_close,
100100
};
101101

102-
static struct class_simple *zft_class;
102+
static struct class *zft_class;
103103

104104
/* Open floppy tape device
105105
*/
@@ -329,29 +329,29 @@ KERN_INFO
329329
"installing zftape VFS interface for ftape driver ...");
330330
TRACE_CATCH(register_chrdev(QIC117_TAPE_MAJOR, "zft", &zft_cdev),);
331331

332-
zft_class = class_simple_create(THIS_MODULE, "zft");
332+
zft_class = class_create(THIS_MODULE, "zft");
333333
for (i = 0; i < 4; i++) {
334-
class_simple_device_add(zft_class, MKDEV(QIC117_TAPE_MAJOR, i), NULL, "qft%i", i);
334+
class_device_create(zft_class, MKDEV(QIC117_TAPE_MAJOR, i), NULL, "qft%i", i);
335335
devfs_mk_cdev(MKDEV(QIC117_TAPE_MAJOR, i),
336336
S_IFCHR | S_IRUSR | S_IWUSR,
337337
"qft%i", i);
338-
class_simple_device_add(zft_class, MKDEV(QIC117_TAPE_MAJOR, i + 4), NULL, "nqft%i", i);
338+
class_device_create(zft_class, MKDEV(QIC117_TAPE_MAJOR, i + 4), NULL, "nqft%i", i);
339339
devfs_mk_cdev(MKDEV(QIC117_TAPE_MAJOR, i + 4),
340340
S_IFCHR | S_IRUSR | S_IWUSR,
341341
"nqft%i", i);
342-
class_simple_device_add(zft_class, MKDEV(QIC117_TAPE_MAJOR, i + 16), NULL, "zqft%i", i);
342+
class_device_create(zft_class, MKDEV(QIC117_TAPE_MAJOR, i + 16), NULL, "zqft%i", i);
343343
devfs_mk_cdev(MKDEV(QIC117_TAPE_MAJOR, i + 16),
344344
S_IFCHR | S_IRUSR | S_IWUSR,
345345
"zqft%i", i);
346-
class_simple_device_add(zft_class, MKDEV(QIC117_TAPE_MAJOR, i + 20), NULL, "nzqft%i", i);
346+
class_device_create(zft_class, MKDEV(QIC117_TAPE_MAJOR, i + 20), NULL, "nzqft%i", i);
347347
devfs_mk_cdev(MKDEV(QIC117_TAPE_MAJOR, i + 20),
348348
S_IFCHR | S_IRUSR | S_IWUSR,
349349
"nzqft%i", i);
350-
class_simple_device_add(zft_class, MKDEV(QIC117_TAPE_MAJOR, i + 32), NULL, "rawqft%i", i);
350+
class_device_create(zft_class, MKDEV(QIC117_TAPE_MAJOR, i + 32), NULL, "rawqft%i", i);
351351
devfs_mk_cdev(MKDEV(QIC117_TAPE_MAJOR, i + 32),
352352
S_IFCHR | S_IRUSR | S_IWUSR,
353353
"rawqft%i", i);
354-
class_simple_device_add(zft_class, MKDEV(QIC117_TAPE_MAJOR, i + 36), NULL, "nrawrawqft%i", i);
354+
class_device_create(zft_class, MKDEV(QIC117_TAPE_MAJOR, i + 36), NULL, "nrawrawqft%i", i);
355355
devfs_mk_cdev(MKDEV(QIC117_TAPE_MAJOR, i + 36),
356356
S_IFCHR | S_IRUSR | S_IWUSR,
357357
"nrawqft%i", i);
@@ -381,19 +381,19 @@ static void zft_exit(void)
381381
}
382382
for (i = 0; i < 4; i++) {
383383
devfs_remove("qft%i", i);
384-
class_simple_device_remove(MKDEV(QIC117_TAPE_MAJOR, i));
384+
class_device_destroy(zft_class, MKDEV(QIC117_TAPE_MAJOR, i));
385385
devfs_remove("nqft%i", i);
386-
class_simple_device_remove(MKDEV(QIC117_TAPE_MAJOR, i + 4));
386+
class_device_destroy(zft_class, MKDEV(QIC117_TAPE_MAJOR, i + 4));
387387
devfs_remove("zqft%i", i);
388-
class_simple_device_remove(MKDEV(QIC117_TAPE_MAJOR, i + 16));
388+
class_device_destroy(zft_class, MKDEV(QIC117_TAPE_MAJOR, i + 16));
389389
devfs_remove("nzqft%i", i);
390-
class_simple_device_remove(MKDEV(QIC117_TAPE_MAJOR, i + 20));
390+
class_device_destroy(zft_class, MKDEV(QIC117_TAPE_MAJOR, i + 20));
391391
devfs_remove("rawqft%i", i);
392-
class_simple_device_remove(MKDEV(QIC117_TAPE_MAJOR, i + 32));
392+
class_device_destroy(zft_class, MKDEV(QIC117_TAPE_MAJOR, i + 32));
393393
devfs_remove("nrawqft%i", i);
394-
class_simple_device_remove(MKDEV(QIC117_TAPE_MAJOR, i + 36));
394+
class_device_destroy(zft_class, MKDEV(QIC117_TAPE_MAJOR, i + 36));
395395
}
396-
class_simple_destroy(zft_class);
396+
class_destroy(zft_class);
397397
zft_uninit_mem(); /* release remaining memory, if any */
398398
printk(KERN_INFO "zftape successfully unloaded.\n");
399399
TRACE_EXIT;

‎drivers/char/ip2main.c‎

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ static char rirqs[IP2_MAX_BOARDS];
302302
static int Valid_Irqs[] = { 3, 4, 5, 7, 10, 11, 12, 15, 0};
303303

304304
/* for sysfs class support */
305-
static struct class_simple *ip2_class;
305+
static struct class *ip2_class;
306306

307307
// Some functions to keep track of what irq's we have
308308

@@ -414,9 +414,9 @@ cleanup_module(void)
414414
iiResetDelay( i2BoardPtrTable[i] );
415415
/* free io addresses and Tibet */
416416
release_region( ip2config.addr[i], 8 );
417-
class_simple_device_remove(MKDEV(IP2_IPL_MAJOR, 4 * i));
417+
class_device_destroy(ip2_class, MKDEV(IP2_IPL_MAJOR, 4 * i));
418418
devfs_remove("ip2/ipl%d", i);
419-
class_simple_device_remove(MKDEV(IP2_IPL_MAJOR, 4 * i + 1));
419+
class_device_destroy(ip2_class, MKDEV(IP2_IPL_MAJOR, 4 * i + 1));
420420
devfs_remove("ip2/stat%d", i);
421421
}
422422
/* Disable and remove interrupt handler. */
@@ -425,7 +425,7 @@ cleanup_module(void)
425425
clear_requested_irq( ip2config.irq[i]);
426426
}
427427
}
428-
class_simple_destroy(ip2_class);
428+
class_destroy(ip2_class);
429429
devfs_remove("ip2");
430430
if ( ( err = tty_unregister_driver ( ip2_tty_driver ) ) ) {
431431
printk(KERN_ERR "IP2: failed to unregister tty driver (%d)\n", err);
@@ -700,7 +700,7 @@ ip2_loadmain(int *iop, int *irqp, unsigned char *firmware, int firmsize)
700700
printk(KERN_ERR "IP2: failed to register IPL device (%d)\n", err );
701701
} else {
702702
/* create the sysfs class */
703-
ip2_class = class_simple_create(THIS_MODULE, "ip2");
703+
ip2_class = class_create(THIS_MODULE, "ip2");
704704
if (IS_ERR(ip2_class)) {
705705
err = PTR_ERR(ip2_class);
706706
goto out_chrdev;
@@ -722,25 +722,25 @@ ip2_loadmain(int *iop, int *irqp, unsigned char *firmware, int firmsize)
722722
}
723723

724724
if ( NULL != ( pB = i2BoardPtrTable[i] ) ) {
725-
class_simple_device_add(ip2_class, MKDEV(IP2_IPL_MAJOR,
725+
class_device_create(ip2_class, MKDEV(IP2_IPL_MAJOR,
726726
4 * i), NULL, "ipl%d", i);
727727
err = devfs_mk_cdev(MKDEV(IP2_IPL_MAJOR, 4 * i),
728728
S_IRUSR | S_IWUSR | S_IRGRP | S_IFCHR,
729729
"ip2/ipl%d", i);
730730
if (err) {
731-
class_simple_device_remove(MKDEV(IP2_IPL_MAJOR,
732-
4 * i));
731+
class_device_destroy(ip2_class,
732+
MKDEV(IP2_IPL_MAJOR, 4 * i));
733733
goto out_class;
734734
}
735735

736-
class_simple_device_add(ip2_class, MKDEV(IP2_IPL_MAJOR,
736+
class_device_create(ip2_class, MKDEV(IP2_IPL_MAJOR,
737737
4 * i + 1), NULL, "stat%d", i);
738738
err = devfs_mk_cdev(MKDEV(IP2_IPL_MAJOR, 4 * i + 1),
739739
S_IRUSR | S_IWUSR | S_IRGRP | S_IFCHR,
740740
"ip2/stat%d", i);
741741
if (err) {
742-
class_simple_device_remove(MKDEV(IP2_IPL_MAJOR,
743-
4 * i + 1));
742+
class_device_destroy(ip2_class,
743+
MKDEV(IP2_IPL_MAJOR, 4 * i + 1));
744744
goto out_class;
745745
}
746746

@@ -798,7 +798,7 @@ ip2_loadmain(int *iop, int *irqp, unsigned char *firmware, int firmsize)
798798
goto out;
799799

800800
out_class:
801-
class_simple_destroy(ip2_class);
801+
class_destroy(ip2_class);
802802
out_chrdev:
803803
unregister_chrdev(IP2_IPL_MAJOR, "ip2");
804804
out:

‎drivers/char/istallion.c‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -792,7 +792,7 @@ static int stli_timeron;
792792

793793
/*****************************************************************************/
794794

795-
static struct class_simple *istallion_class;
795+
static struct class *istallion_class;
796796

797797
#ifdef MODULE
798798

@@ -854,10 +854,10 @@ static void __exit istallion_module_exit(void)
854854
put_tty_driver(stli_serial);
855855
for (i = 0; i < 4; i++) {
856856
devfs_remove("staliomem/%d", i);
857-
class_simple_device_remove(MKDEV(STL_SIOMEMMAJOR, i));
857+
class_device_destroy(istallion_class, MKDEV(STL_SIOMEMMAJOR, i));
858858
}
859859
devfs_remove("staliomem");
860-
class_simple_destroy(istallion_class);
860+
class_destroy(istallion_class);
861861
if ((i = unregister_chrdev(STL_SIOMEMMAJOR, "staliomem")))
862862
printk("STALLION: failed to un-register serial memory device, "
863863
"errno=%d\n", -i);
@@ -5242,12 +5242,12 @@ int __init stli_init(void)
52425242
"device\n");
52435243

52445244
devfs_mk_dir("staliomem");
5245-
istallion_class = class_simple_create(THIS_MODULE, "staliomem");
5245+
istallion_class = class_create(THIS_MODULE, "staliomem");
52465246
for (i = 0; i < 4; i++) {
52475247
devfs_mk_cdev(MKDEV(STL_SIOMEMMAJOR, i),
52485248
S_IFCHR | S_IRUSR | S_IWUSR,
52495249
"staliomem/%d", i);
5250-
class_simple_device_add(istallion_class, MKDEV(STL_SIOMEMMAJOR, i),
5250+
class_device_create(istallion_class, MKDEV(STL_SIOMEMMAJOR, i),
52515251
NULL, "staliomem%d", i);
52525252
}
52535253

‎drivers/char/lp.c‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@
146146
static struct lp_struct lp_table[LP_NO];
147147

148148
static unsigned int lp_count = 0;
149-
static struct class_simple *lp_class;
149+
static struct class *lp_class;
150150

151151
#ifdef CONFIG_LP_CONSOLE
152152
static struct parport *console_registered; // initially NULL
@@ -804,7 +804,7 @@ static int lp_register(int nr, struct parport *port)
804804
if (reset)
805805
lp_reset(nr);
806806

807-
class_simple_device_add(lp_class, MKDEV(LP_MAJOR, nr), NULL,
807+
class_device_create(lp_class, MKDEV(LP_MAJOR, nr), NULL,
808808
"lp%d", nr);
809809
devfs_mk_cdev(MKDEV(LP_MAJOR, nr), S_IFCHR | S_IRUGO | S_IWUGO,
810810
"printers/%d", nr);
@@ -907,7 +907,7 @@ static int __init lp_init (void)
907907
}
908908

909909
devfs_mk_dir("printers");
910-
lp_class = class_simple_create(THIS_MODULE, "printer");
910+
lp_class = class_create(THIS_MODULE, "printer");
911911
if (IS_ERR(lp_class)) {
912912
err = PTR_ERR(lp_class);
913913
goto out_devfs;
@@ -930,7 +930,7 @@ static int __init lp_init (void)
930930
return 0;
931931

932932
out_class:
933-
class_simple_destroy(lp_class);
933+
class_destroy(lp_class);
934934
out_devfs:
935935
devfs_remove("printers");
936936
unregister_chrdev(LP_MAJOR, "lp");
@@ -981,10 +981,10 @@ static void lp_cleanup_module (void)
981981
continue;
982982
parport_unregister_device(lp_table[offset].dev);
983983
devfs_remove("printers/%d", offset);
984-
class_simple_device_remove(MKDEV(LP_MAJOR, offset));
984+
class_device_destroy(lp_class, MKDEV(LP_MAJOR, offset));
985985
}
986986
devfs_remove("printers");
987-
class_simple_destroy(lp_class);
987+
class_destroy(lp_class);
988988
}
989989

990990
__setup("lp=", lp_setup);

‎drivers/char/mem.c‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -856,7 +856,7 @@ static const struct {
856856
{11,"kmsg", S_IRUGO | S_IWUSR, &kmsg_fops},
857857
};
858858

859-
static struct class_simple *mem_class;
859+
static struct class *mem_class;
860860

861861
static int __init chr_dev_init(void)
862862
{
@@ -865,10 +865,9 @@ static int __init chr_dev_init(void)
865865
if (register_chrdev(MEM_MAJOR,"mem",&memory_fops))
866866
printk("unable to get major %d for memory devs\n", MEM_MAJOR);
867867

868-
mem_class = class_simple_create(THIS_MODULE, "mem");
868+
mem_class = class_create(THIS_MODULE, "mem");
869869
for (i = 0; i < ARRAY_SIZE(devlist); i++) {
870-
class_simple_device_add(mem_class,
871-
MKDEV(MEM_MAJOR, devlist[i].minor),
870+
class_device_create(mem_class, MKDEV(MEM_MAJOR, devlist[i].minor),
872871
NULL, devlist[i].name);
873872
devfs_mk_cdev(MKDEV(MEM_MAJOR, devlist[i].minor),
874873
S_IFCHR | devlist[i].mode, devlist[i].name);

‎drivers/char/misc.c‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -177,10 +177,10 @@ static int misc_open(struct inode * inode, struct file * file)
177177

178178
/*
179179
* TODO for 2.7:
180-
* - add a struct class_device to struct miscdevice and make all usages of
180+
* - add a struct kref to struct miscdevice and make all usages of
181181
* them dynamic.
182182
*/
183-
static struct class_simple *misc_class;
183+
static struct class *misc_class;
184184

185185
static struct file_operations misc_fops = {
186186
.owner = THIS_MODULE,
@@ -238,8 +238,8 @@ int misc_register(struct miscdevice * misc)
238238
}
239239
dev = MKDEV(MISC_MAJOR, misc->minor);
240240

241-
misc->class = class_simple_device_add(misc_class, dev,
242-
misc->dev, misc->name);
241+
misc->class = class_device_create(misc_class, dev, misc->dev,
242+
"%s", misc->name);
243243
if (IS_ERR(misc->class)) {
244244
err = PTR_ERR(misc->class);
245245
goto out;
@@ -248,7 +248,7 @@ int misc_register(struct miscdevice * misc)
248248
err = devfs_mk_cdev(dev, S_IFCHR|S_IRUSR|S_IWUSR|S_IRGRP,
249249
misc->devfs_name);
250250
if (err) {
251-
class_simple_device_remove(dev);
251+
class_device_destroy(misc_class, dev);
252252
goto out;
253253
}
254254

@@ -281,7 +281,7 @@ int misc_deregister(struct miscdevice * misc)
281281

282282
down(&misc_sem);
283283
list_del(&misc->list);
284-
class_simple_device_remove(MKDEV(MISC_MAJOR, misc->minor));
284+
class_device_destroy(misc_class, MKDEV(MISC_MAJOR, misc->minor));
285285
devfs_remove(misc->devfs_name);
286286
if (i < DYNAMIC_MINORS && i>0) {
287287
misc_minors[i>>3] &= ~(1 << (misc->minor & 7));
@@ -302,7 +302,7 @@ static int __init misc_init(void)
302302
if (ent)
303303
ent->proc_fops = &misc_proc_fops;
304304
#endif
305-
misc_class = class_simple_create(THIS_MODULE, "misc");
305+
misc_class = class_create(THIS_MODULE, "misc");
306306
if (IS_ERR(misc_class))
307307
return PTR_ERR(misc_class);
308308
#ifdef CONFIG_MVME16x
@@ -323,7 +323,7 @@ static int __init misc_init(void)
323323
if (register_chrdev(MISC_MAJOR,"misc",&misc_fops)) {
324324
printk("unable to get major %d for misc devices\n",
325325
MISC_MAJOR);
326-
class_simple_destroy(misc_class);
326+
class_destroy(misc_class);
327327
return -EIO;
328328
}
329329
return 0;

0 commit comments

Comments
 (0)