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/drivers/amrmo_init.c (-2 / +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-276 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] = {};
273
274
static struct class_simple *amrmo_class;
274
275
275
/*
276
/*
276
 *    debug stuff
277
 *    debug stuff
Lines 613-618 static int __init amrmo_pci_probe(struct Link Here
613
	}
614
	}
614
#endif
615
#endif
615
#else
616
#else
617
	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);
618
	devfs_mk_cdev(MKDEV(AMRMO_MAJOR,i), S_IFCHR|S_IRUSR|S_IWUSR, "slamr%d", i);
617
#endif
619
#endif
618
	return 0;
620
	return 0;
Lines 644-649 static void __exit amrmo_pci_remove(stru Link Here
644
	}
646
	}
645
#endif
647
#endif
646
#else
648
#else
649
	class_simple_device_remove(MKDEV(AMRMO_MAJOR, amrmo->num));
647
	devfs_remove("slamr%d", amrmo->num);
650
	devfs_remove("slamr%d", amrmo->num);
648
#endif
651
#endif
649
	amrmo_table[amrmo->num] = NULL;
652
	amrmo_table[amrmo->num] = NULL;
Lines 720-742 static int __init amrmo_init(void) Link Here
720
			}
723
			}
721
#endif
724
#endif
722
		}
725
		}
726
   }
727
728
	/* must create class_simple before the bus gets probed */
729
#ifndef OLD_KERNEL
730
	amrmo_class = class_simple_create(THIS_MODULE, "slamr");
731
	if (IS_ERR(amrmo_class)) {
732
		int err = PTR_ERR(amrmo_class);
733
		printk(KERN_INFO "slamr: failure creating simple class, error %d\n", err);
734
		return err;
723
	}
735
	}
736
#endif
724
737
725
	if (!pci_register_driver(&amrmo_pci_driver)) {
738
	if (!pci_register_driver(&amrmo_pci_driver)) {
726
		pci_unregister_driver(&amrmo_pci_driver);
739
		pci_unregister_driver(&amrmo_pci_driver);
727
                return -ENODEV;
740
		class_simple_destroy(amrmo_class);
741
		return -ENODEV;
728
	}
742
	}
729
743
730
	if(register_chrdev(AMRMO_MAJOR, "slamr", &amrmo_fops) < 0) {
744
	if(register_chrdev(AMRMO_MAJOR, "slamr", &amrmo_fops) < 0) {
731
		pci_unregister_driver(&amrmo_pci_driver);
745
		pci_unregister_driver(&amrmo_pci_driver);
746
		class_simple_destroy(amrmo_class);
732
		return -ENOMEM;
747
		return -ENOMEM;
733
	}
748
	}
749
734
	return 0;
750
	return 0;
735
}
751
}
736
752
737
static void __exit amrmo_exit(void)
753
static void __exit amrmo_exit(void)
738
{
754
{
739
	AMRMO_DBG("slamr: exit...\n");
755
	AMRMO_DBG("slamr: exit...\n");
756
#ifndef OLD_KERNEL
757
	class_simple_destroy(amrmo_class);
758
#endif
740
	unregister_chrdev(AMRMO_MAJOR,"slamr");
759
	unregister_chrdev(AMRMO_MAJOR,"slamr");
741
	pci_unregister_driver(&amrmo_pci_driver);
760
	pci_unregister_driver(&amrmo_pci_driver);
742
}
761
}
(-)slmodem-2.9.8/drivers/old_st7554.c (+32 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
1302
#ifdef CONFIG_DEVFS_FS
1312
#ifdef CONFIG_DEVFS_FS
1303
	{
1313
	{
1304
		char buf[8];
1314
		char buf[8];
Lines 1333-1338 static void st7554_disconnect(struct usb Link Here
1333
		s->file->private_data = NULL;
1343
		s->file->private_data = NULL;
1334
		s->file = NULL;
1344
		s->file = NULL;
1335
	}
1345
	}
1346
1347
#ifndef OLD_KERNEL
1348
	class_simple_device_remove(MKDEV(MY_MAJOR, s->minor));
1349
#endif
1336
#ifdef CONFIG_DEVFS_FS
1350
#ifdef CONFIG_DEVFS_FS
1337
	{
1351
	{
1338
		char buf[8];
1352
		char buf[8];
Lines 1343-1348 static void st7554_disconnect(struct usb Link Here
1343
		devfs_unregister (handle);
1357
		devfs_unregister (handle);
1344
	}
1358
	}
1345
#endif
1359
#endif
1360
1346
	st7554_stop(s);
1361
	st7554_stop(s);
1347
	st7554_release(s);
1362
	st7554_release(s);
1348
	s->usbdev = NULL;
1363
	s->usbdev = NULL;
Lines 1362-1376 static int __init st7554_modem_init(void Link Here
1362
{
1377
{
1363
	int ret;
1378
	int ret;
1364
	USB_INFO ("ST7554 USB Modem.\n");
1379
	USB_INFO ("ST7554 USB Modem.\n");
1380
1381
	/* must create class_simple before the bus gets probed */
1382
#ifndef OLD_KERNEL
1383
	st7554_class = class_simple_create(THIS_MODULE, "slusb");
1384
	if (IS_ERR(st7554_class)) {
1385
		ret = PTR_ERR(st7554_class);
1386
		USB_ERR("st7554_modem_init: failed to create sysfs class, error %d\n", ret);
1387
		return PTR_ERR(st7554_class);
1388
	}
1389
#endif
1390
1365
	ret = usb_register(&st7554_usb_driver);
1391
	ret = usb_register(&st7554_usb_driver);
1366
	if ( ret ) {
1392
	if ( ret ) {
1367
		USB_ERR ("st7554_modem_init: cannot register usb device.\n");
1393
		USB_ERR ("st7554_modem_init: cannot register usb device.\n");
1394
		class_simple_destroy(st7554_class);
1368
		return ret;
1395
		return ret;
1369
	}
1396
	}
1370
	if(register_chrdev(MY_MAJOR, "slusb", &st7554_fops) < 0) {
1397
	if(register_chrdev(MY_MAJOR, "slusb", &st7554_fops) < 0) {
1398
		class_simple_destroy(st7554_class);
1371
		usb_deregister(&st7554_usb_driver);
1399
		usb_deregister(&st7554_usb_driver);
1372
		return -ENOMEM;
1400
		return -ENOMEM;
1373
	}
1401
	}
1402
1374
	return 0;
1403
	return 0;
1375
}
1404
}
1376
1405
Lines 1378-1383 static int __init st7554_modem_init(void Link Here
1378
static void __exit st7554_modem_exit(void)
1407
static void __exit st7554_modem_exit(void)
1379
{
1408
{
1380
	USB_DBG ("st7554: exit...\n");
1409
	USB_DBG ("st7554: exit...\n");
1410
#ifndef OLD_KERNEL
1411
	class_simple_destroy(st7554_class);
1412
#endif
1381
	unregister_chrdev(MY_MAJOR,"slusb");
1413
	unregister_chrdev(MY_MAJOR,"slusb");
1382
	usb_deregister(&st7554_usb_driver);
1414
	usb_deregister(&st7554_usb_driver);
1383
}
1415
}
(-)slmodem-2.9.8/drivers/st7554.c (-4 / +33 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 1298-1308 static void st7554_disconnect(struct usb Link Here
1298
	struct st7554_state *s = usb_get_intfdata(interface);
1307
	struct st7554_state *s = usb_get_intfdata(interface);
1299
	usb_set_intfdata(interface, NULL );
1308
	usb_set_intfdata(interface, NULL );
1300
	USB_DBG("st7554 disconnect...\n");
1309
	USB_DBG("st7554 disconnect...\n");
1301
        if (!s || !s->usbdev) {
1310
	if (!s || !s->usbdev) {
1302
                USB_DBG("st7554 disconnect: no dev.\n");
1311
		USB_DBG("st7554 disconnect: no dev.\n");
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 1335-1349 static int __init st7554_modem_init(void Link Here
1335
{
1347
{
1336
	int ret;
1348
	int ret;
1337
	USB_INFO ("ST7554 USB Modem.\n");
1349
	USB_INFO ("ST7554 USB Modem.\n");
1350
1351
	/* must create class_simple before the bus gets probed */
1352
#ifndef OLD_KERNEL
1353
	st7554_class = class_simple_create(THIS_MODULE, "slusb");
1354
	if (IS_ERR(st7554_class)) {
1355
		ret = PTR_ERR(st7554_class);
1356
		USB_ERR("st7554_modem_init: failed to create sysfs class, error %d\n", ret);
1357
		return ret;
1358
	}
1359
#endif
1360
1338
	ret = usb_register(&st7554_usb_driver);
1361
	ret = usb_register(&st7554_usb_driver);
1339
	if ( ret ) {
1362
	if ( ret ) {
1340
		USB_ERR ("st7554_modem_init: cannot register usb device.\n");
1363
		USB_ERR ("st7554_modem_init: cannot register usb device.\n");
1364
		class_simple_destroy(st7554_class);
1341
		return ret;
1365
		return ret;
1342
	}
1366
	}
1343
	if(register_chrdev(213, "slusb", &st7554_fops) < 0) {
1367
	if(register_chrdev(213, "slusb", &st7554_fops) < 0) {
1344
		usb_deregister(&st7554_usb_driver);
1368
		usb_deregister(&st7554_usb_driver);
1369
		class_simple_destroy(st7554_class);
1345
		return -ENOMEM;
1370
		return -ENOMEM;
1346
	}
1371
	}
1372
1347
	return 0;
1373
	return 0;
1348
}
1374
}
1349
1375
Lines 1351-1356 static int __init st7554_modem_init(void Link Here
1351
static void __exit st7554_modem_exit(void)
1377
static void __exit st7554_modem_exit(void)
1352
{
1378
{
1353
	USB_DBG ("st7554: exit...\n");
1379
	USB_DBG ("st7554: exit...\n");
1380
#ifndef OLD_KERNEL
1381
	class_simple_destroy(st7554_class);
1382
#endif
1354
	unregister_chrdev(213,"slusb");
1383
	unregister_chrdev(213,"slusb");
1355
	usb_deregister(&st7554_usb_driver);
1384
	usb_deregister(&st7554_usb_driver);
1356
}
1385
}

Return to bug 47947