Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 47947 | Differences between
and this patch

Collapse All | Expand All

(-)slmodem-2.9.8.old/drivers/amrmo_init.c (+21 lines)
Lines 54-59 Link Here
54
#include <linux/fs.h>
54
#include <linux/fs.h>
55
#include <asm/uaccess.h>
55
#include <asm/uaccess.h>
56
#include <linux/devfs_fs_kernel.h>
56
#include <linux/devfs_fs_kernel.h>
57
#include <linux/device.h>
57
58
58
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
59
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
59
#define OLD_KERNEL 1
60
#define OLD_KERNEL 1
Lines 270-275 MODULE_DEVICE_TABLE (pci, amrmo_pci_tbl) Link Here
270
271
271
272
272
static struct amrmo_struct *amrmo_table[MAXNUM] = {};
273
static struct amrmo_struct *amrmo_table[MAXNUM] = {};
274
static struct class_simple *amrmo_class;
273
275
274
276
275
/*
277
/*
Lines 613-618 static int __init amrmo_pci_probe(struct Link Here
613
	}
615
	}
614
#endif
616
#endif
615
#else
617
#else
618
	printk(KERN_INFO "clamr: creating sysfs device with major %d minor %d/n", AMRMO_MAJOR, i);
619
	class_simple_device_add(amrmo_class, MKDEV(AMRMO_MAJOR, i), NULL, "slamr%d", i);
616
	devfs_mk_cdev(MKDEV(AMRMO_MAJOR,i), S_IFCHR|S_IRUSR|S_IWUSR, "slamr%d", i);
620
	devfs_mk_cdev(MKDEV(AMRMO_MAJOR,i), S_IFCHR|S_IRUSR|S_IWUSR, "slamr%d", i);
617
#endif
621
#endif
618
	return 0;
622
	return 0;
Lines 644-649 static void __exit amrmo_pci_remove(stru Link Here
644
	}
648
	}
645
#endif
649
#endif
646
#else
650
#else
651
	printk(KERN_INFO "slamr: removing sysfs node with major %d and minor %d\n", AMRMO_MAJOR, amrmo->num);
652
	class_simple_device_remove(MKDEV(AMRMO_MAJOR, amrmo->num));
647
	devfs_remove("slamr%d", amrmo->num);
653
	devfs_remove("slamr%d", amrmo->num);
648
#endif
654
#endif
649
	amrmo_table[amrmo->num] = NULL;
655
	amrmo_table[amrmo->num] = NULL;
Lines 722-727 static int __init amrmo_init(void) Link Here
722
		}
728
		}
723
	}
729
	}
724
730
731
	/* must create class_simple before the bus gets probed */
732
#ifndef OLD_KERNEL
733
	printk(KERN_INFO "slamr: creating simple class\n");
734
	amrmo_class = class_simple_create(THIS_MODULE, "slamr");
735
	if (IS_ERR(amrmo_class)) {
736
		int err = PTR_ERR(amrmo_class);
737
		 printk(KERN_INFO "slamr: failure creating simple class, error %d\n", err);
738
		return err;
739
	}
740
#endif
741
	
725
	if (!pci_register_driver(&amrmo_pci_driver)) {
742
	if (!pci_register_driver(&amrmo_pci_driver)) {
726
		pci_unregister_driver(&amrmo_pci_driver);
743
		pci_unregister_driver(&amrmo_pci_driver);
727
                return -ENODEV;
744
                return -ENODEV;
Lines 737-742 static int __init amrmo_init(void) Link Here
737
static void __exit amrmo_exit(void)
754
static void __exit amrmo_exit(void)
738
{
755
{
739
	AMRMO_DBG("slamr: exit...\n");
756
	AMRMO_DBG("slamr: exit...\n");
757
#ifndef OLD_KERNEL
758
	printk(KERN_INFO "slamr: destroying simple class\n");
759
	class_simple_destroy(amrmo_class);
760
#endif
740
	unregister_chrdev(AMRMO_MAJOR,"slamr");
761
	unregister_chrdev(AMRMO_MAJOR,"slamr");
741
	pci_unregister_driver(&amrmo_pci_driver);
762
	pci_unregister_driver(&amrmo_pci_driver);
742
}
763
}
(-)slmodem-2.9.8.old/drivers/old_st7554.c (+30 lines)
Lines 55-60 Link Here
55
#include <linux/poll.h>
55
#include <linux/poll.h>
56
#include <linux/usb.h>
56
#include <linux/usb.h>
57
#include <linux/devfs_fs_kernel.h>
57
#include <linux/devfs_fs_kernel.h>
58
#include <linux/device.h>
58
59
59
#include <modem_defs.h>
60
#include <modem_defs.h>
60
61
Lines 73-78 Link Here
73
74
74
#define MY_MAJOR 213
75
#define MY_MAJOR 213
75
76
77
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
78
#define OLD_KERNEL 1
79
#endif
80
76
static int debug = 0;
81
static int debug = 0;
77
MODULE_PARM(debug,"i");
82
MODULE_PARM(debug,"i");
78
MODULE_PARM_DESC(debug,"Debug level: 0-3 (default=0)");
83
MODULE_PARM_DESC(debug,"Debug level: 0-3 (default=0)");
Lines 201-206 struct st7554_state { Link Here
201
206
202
207
203
static struct st7554_state *st7554_table[MAX_MODEMS];
208
static struct st7554_state *st7554_table[MAX_MODEMS];
209
static struct class_simple *st7554_class;
204
210
205
static DECLARE_MUTEX(open_sem);
211
static DECLARE_MUTEX(open_sem);
206
212
Lines 1299-1304 static void *st7554_probe(struct usb_dev Link Here
1299
		mo_free(s); mi_free(s);
1305
		mo_free(s); mi_free(s);
1300
		goto error1;
1306
		goto error1;
1301
	}
1307
	}
1308
1309
#ifndef OLD_KERNEL
1310
	 class_simple_device_add(st7554_class, MKDEV(MY_MAJOR, s->minor), NULL, "slusb%d", i);
1311
#endif
1312
1302
#ifdef CONFIG_DEVFS_FS
1313
#ifdef CONFIG_DEVFS_FS
1303
	{
1314
	{
1304
		char buf[8];
1315
		char buf[8];
Lines 1333-1338 static void st7554_disconnect(struct usb Link Here
1333
		s->file->private_data = NULL;
1344
		s->file->private_data = NULL;
1334
		s->file = NULL;
1345
		s->file = NULL;
1335
	}
1346
	}
1347
1348
#ifndef OLD_KERNEL
1349
	class_simple_device_remove(MKDEV(MY_MAJOR, s->minor));
1350
#endif
1351
1336
#ifdef CONFIG_DEVFS_FS
1352
#ifdef CONFIG_DEVFS_FS
1337
	{
1353
	{
1338
		char buf[8];
1354
		char buf[8];
Lines 1371-1376 static int __init st7554_modem_init(void Link Here
1371
		usb_deregister(&st7554_usb_driver);
1387
		usb_deregister(&st7554_usb_driver);
1372
		return -ENOMEM;
1388
		return -ENOMEM;
1373
	}
1389
	}
1390
	
1391
#ifndef OLD_KERNEL
1392
	st7554_class = class_simple_create(THIS_MODULE, "slusb");
1393
	if (IS_ERR(st7554_class)) {
1394
		USB_ERR("failed to create sysfs class\n");
1395
		usb_deregister(&st7554_usb_driver);
1396
		unregister_chrdev(MY_MAJOR, "slusb");
1397
		return PTR_ERR(st7554_class);
1398
	}
1399
#endif
1400
1374
	return 0;
1401
	return 0;
1375
}
1402
}
1376
1403
Lines 1378-1383 static int __init st7554_modem_init(void Link Here
1378
static void __exit st7554_modem_exit(void)
1405
static void __exit st7554_modem_exit(void)
1379
{
1406
{
1380
	USB_DBG ("st7554: exit...\n");
1407
	USB_DBG ("st7554: exit...\n");
1408
#ifndef OLD_KERNEL
1409
	class_simple_destroy(st7554_class);
1410
#endif
1381
	unregister_chrdev(MY_MAJOR,"slusb");
1411
	unregister_chrdev(MY_MAJOR,"slusb");
1382
	usb_deregister(&st7554_usb_driver);
1412
	usb_deregister(&st7554_usb_driver);
1383
}
1413
}
(-)slmodem-2.9.8.old/drivers/st7554.c (+25 lines)
Lines 55-60 Link Here
55
#include <linux/poll.h>
55
#include <linux/poll.h>
56
#include <linux/usb.h>
56
#include <linux/usb.h>
57
#include <linux/devfs_fs_kernel.h>
57
#include <linux/devfs_fs_kernel.h>
58
#include <linux/device.h>
58
59
59
#include <modem_defs.h>
60
#include <modem_defs.h>
60
61
Lines 67-72 Link Here
67
#define DEBUG_URB_PRINT 0
68
#define DEBUG_URB_PRINT 0
68
#define USB_DBG_URB(fmt...) // USB_DBG(fmt)
69
#define USB_DBG_URB(fmt...) // USB_DBG(fmt)
69
70
71
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
72
#define OLD_KERNEL 1
73
#endif
74
70
static int debug = 0;
75
static int debug = 0;
71
MODULE_PARM(debug,"i");
76
MODULE_PARM(debug,"i");
72
MODULE_PARM_DESC(debug,"Debug level: 0-3 (default=0)");
77
MODULE_PARM_DESC(debug,"Debug level: 0-3 (default=0)");
Lines 205-210 struct st7554_state { Link Here
205
210
206
211
207
static struct st7554_state *st7554_table[MAX_MODEMS] = {};
212
static struct st7554_state *st7554_table[MAX_MODEMS] = {};
213
static struct class_simple *st7554_class;
208
214
209
static DECLARE_MUTEX(open_sem);
215
static DECLARE_MUTEX(open_sem);
210
216
Lines 1275-1280 static int st7554_probe(struct usb_inter Link Here
1275
	}
1281
	}
1276
1282
1277
	usb_set_intfdata(interface, s );
1283
	usb_set_intfdata(interface, s );
1284
#ifndef OLD_KERNEL
1285
	class_simple_device_add(st7554_class, MKDEV(213, i), NULL, "slusb%d", i);
1286
#endif
1278
	devfs_mk_cdev(MKDEV(213,i),S_IFCHR|S_IRUSR|S_IWUSR,"slusb%d",i);
1287
	devfs_mk_cdev(MKDEV(213,i),S_IFCHR|S_IRUSR|S_IWUSR,"slusb%d",i);
1279
1288
1280
	USB_INFO(KERN_INFO "slusb: slusb%d is found.\n", s->minor);
1289
	USB_INFO(KERN_INFO "slusb: slusb%d is found.\n", s->minor);
Lines 1303-1308 static void st7554_disconnect(struct usb Link Here
1303
                return;
1312
                return;
1304
        }
1313
        }
1305
1314
1315
#ifndef OLD_KERNEL
1316
	class_simple_device_remove(MKDEV(213, s->minor));
1317
#endif
1306
 	devfs_remove("slusb%d",s->minor);
1318
 	devfs_remove("slusb%d",s->minor);
1307
1319
1308
	st7554_stop(s);
1320
	st7554_stop(s);
Lines 1344-1349 static int __init st7554_modem_init(void Link Here
1344
		usb_deregister(&st7554_usb_driver);
1356
		usb_deregister(&st7554_usb_driver);
1345
		return -ENOMEM;
1357
		return -ENOMEM;
1346
	}
1358
	}
1359
#ifndef OLD_KERNEL
1360
	st7554_class = class_simple_create(THIS_MODULE, "slusb");
1361
	if (IS_ERR(st7554_class)) {
1362
		USB_ERR("failed to create sysfs class\n");
1363
		usb_deregister(&st7554_usb_driver);
1364
		unregister_chrdev(213, "slusb");
1365
		return PTR_ERR(st7554_class);
1366
	}
1367
#endif
1368
1347
	return 0;
1369
	return 0;
1348
}
1370
}
1349
1371
Lines 1351-1356 static int __init st7554_modem_init(void Link Here
1351
static void __exit st7554_modem_exit(void)
1373
static void __exit st7554_modem_exit(void)
1352
{
1374
{
1353
	USB_DBG ("st7554: exit...\n");
1375
	USB_DBG ("st7554: exit...\n");
1376
#ifndef OLD_KERNEL
1377
	class_simple_destroy(st7554_class);
1378
#endif
1354
	unregister_chrdev(213,"slusb");
1379
	unregister_chrdev(213,"slusb");
1355
	usb_deregister(&st7554_usb_driver);
1380
	usb_deregister(&st7554_usb_driver);
1356
}
1381
}

Return to bug 47947