|
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 |
} |