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.7/drivers/amrmo_init.c (-1 / +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
	printk(KERN_INFO "slamr: creating sysfs device with major %d minor %d\n", AMRMO_MAJOR, i);
618
	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);
619
	devfs_mk_cdev(MKDEV(AMRMO_MAJOR,i), S_IFCHR|S_IRUSR|S_IWUSR, "slamr%d", i);
617
#endif
620
#endif
618
	return 0;
621
	return 0;
Lines 644-649 static void __exit amrmo_pci_remove(stru Link Here
644
	}
647
	}
645
#endif
648
#endif
646
#else
649
#else
650
	printk(KERN_INFO "slamr: removing sysfs node with major %d and minor %d\n", AMRMO_MAJOR, amrmo->num);
651
	class_simple_device_remove(MKDEV(AMRMO_MAJOR, amrmo->num));
647
	devfs_remove("slamr%d", amrmo->num);
652
	devfs_remove("slamr%d", amrmo->num);
648
#endif
653
#endif
649
	amrmo_table[amrmo->num] = NULL;
654
	amrmo_table[amrmo->num] = NULL;
Lines 720-726 static int __init amrmo_init(void) Link Here
720
			}
725
			}
721
#endif
726
#endif
722
		}
727
		}
728
   }
729
730
	/* must create class_simple before the bus gets probed */
731
#ifndef OLD_KERNEL
732
	printk(KERN_INFO "slamr: creating simple class\n");
733
	amrmo_class = class_simple_create(THIS_MODULE, "slamr");
734
	if (IS_ERR(amrmo_class)) {
735
		printk(KERN_INFO "slamr: failure creating simple class, error %d\n", err);
736
		return PTR_ERR(amrmo_class);
723
	}
737
	}
738
#endif
724
739
725
	if (!pci_register_driver(&amrmo_pci_driver)) {
740
	if (!pci_register_driver(&amrmo_pci_driver)) {
726
		pci_unregister_driver(&amrmo_pci_driver);
741
		pci_unregister_driver(&amrmo_pci_driver);
Lines 731-742 static int __init amrmo_init(void) Link Here
731
		pci_unregister_driver(&amrmo_pci_driver);
746
		pci_unregister_driver(&amrmo_pci_driver);
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
	printk(KERN_INFO "slamr: destroying simple class\n");
758
	class_simple_destroy(amrmo_class);
759
#endif
740
	unregister_chrdev(AMRMO_MAJOR,"slamr");
760
	unregister_chrdev(AMRMO_MAJOR,"slamr");
741
	pci_unregister_driver(&amrmo_pci_driver);
761
	pci_unregister_driver(&amrmo_pci_driver);
742
}
762
}
(-)slmodem-2.9.7/drivers/old_st7554.c (+29 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 1294-1299 static void *st7554_probe(struct usb_dev Link Here
1294
		mo_free(s); mi_free(s);
1300
		mo_free(s); mi_free(s);
1295
		goto error1;
1301
		goto error1;
1296
	}
1302
	}
1303
1304
#ifndef OLD_KERNEL
1305
	class_simple_device_add(st7554_class, MKDEV(MY_MAJOR, s->minor), NULL, "slusb%d", i);
1306
#endif
1297
#ifdef CONFIG_DEVFS_FS
1307
#ifdef CONFIG_DEVFS_FS
1298
	{
1308
	{
1299
		char buf[8];
1309
		char buf[8];
Lines 1328-1333 static void st7554_disconnect(struct usb Link Here
1328
		s->file->private_data = NULL;
1338
		s->file->private_data = NULL;
1329
		s->file = NULL;
1339
		s->file = NULL;
1330
	}
1340
	}
1341
1342
#ifndef OLD_KERNEL
1343
	class_simple_device_remove(MKDEV(MY_MAJOR, s->minor));
1344
#endif
1331
#ifdef CONFIG_DEVFS_FS
1345
#ifdef CONFIG_DEVFS_FS
1332
	{
1346
	{
1333
		char buf[8];
1347
		char buf[8];
Lines 1338-1343 static void st7554_disconnect(struct usb Link Here
1338
		devfs_unregister (handle);
1352
		devfs_unregister (handle);
1339
	}
1353
	}
1340
#endif
1354
#endif
1355
1341
	st7554_stop(s);
1356
	st7554_stop(s);
1342
	st7554_release(s);
1357
	st7554_release(s);
1343
	s->usbdev = NULL;
1358
	s->usbdev = NULL;
Lines 1366-1371 static int __init st7554_modem_init(void Link Here
1366
		usb_deregister(&st7554_usb_driver);
1381
		usb_deregister(&st7554_usb_driver);
1367
		return -ENOMEM;
1382
		return -ENOMEM;
1368
	}
1383
	}
1384
1385
#ifndef OLD_KERNEL
1386
	st7554_class = class_simple_create(THIS_MODULE, "slusb");
1387
	if (IS_ERR(st7554_class)) {
1388
		USB_ERR("failed to create sysfs class\n");
1389
		usb_deregister(&st7554_usb_driver);
1390
		unregister_chrdev(MY_MAJOR, "slusb");
1391
		return PTR_ERR(st7554_class);
1392
	}
1393
#endif
1394
1369
	return 0;
1395
	return 0;
1370
}
1396
}
1371
1397
Lines 1373-1378 static int __init st7554_modem_init(void Link Here
1373
static void __exit st7554_modem_exit(void)
1399
static void __exit st7554_modem_exit(void)
1374
{
1400
{
1375
	USB_DBG ("st7554: exit...\n");
1401
	USB_DBG ("st7554: exit...\n");
1402
#ifndef OLD_KERNEL
1403
	class_simple_destroy(st7554_class);
1404
#endif
1376
	unregister_chrdev(MY_MAJOR,"slusb");
1405
	unregister_chrdev(MY_MAJOR,"slusb");
1377
	usb_deregister(&st7554_usb_driver);
1406
	usb_deregister(&st7554_usb_driver);
1378
}
1407
}
(-)slmodem-2.9.7/drivers/st7554.c (-4 / +29 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 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