Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 33516 Details for
Bug 47947
slmodem-2.9.9 (was slmodem-2.9.6 half-ebuild)
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
sysfs-for-slmodem-v5.patch
sysfs-for-slmodem-v5.patch (text/plain), 7.37 KB, created by
Daniel Drake (RETIRED)
on 2004-06-18 12:38:44 UTC
(
hide
)
Description:
sysfs-for-slmodem-v5.patch
Filename:
MIME Type:
Creator:
Daniel Drake (RETIRED)
Created:
2004-06-18 12:38:44 UTC
Size:
7.37 KB
patch
obsolete
>Add sysfs support to slmodem drivers. >- Daniel Drake <dsd@gentoo.org> > >diff -urNp slmodem-2.9.8/drivers/amrmo_init.c slmodem-dsd/drivers/amrmo_init.c >--- slmodem-2.9.8/drivers/amrmo_init.c 2004-04-22 16:55:35.000000000 +0100 >+++ slmodem-dsd/drivers/amrmo_init.c 2004-06-18 20:48:12.604672976 +0100 >@@ -54,6 +54,7 @@ > #include <linux/fs.h> > #include <asm/uaccess.h> > #include <linux/devfs_fs_kernel.h> >+#include <linux/device.h> > > #if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) > #define OLD_KERNEL 1 >@@ -270,7 +271,7 @@ MODULE_DEVICE_TABLE (pci, amrmo_pci_tbl) > > > static struct amrmo_struct *amrmo_table[MAXNUM] = {}; >- >+static struct class_simple *amrmo_class; > > /* > * debug stuff >@@ -613,6 +614,7 @@ static int __init amrmo_pci_probe(struct > } > #endif > #else >+ class_simple_device_add(amrmo_class, MKDEV(AMRMO_MAJOR, i), NULL, "slamr%d", i); > devfs_mk_cdev(MKDEV(AMRMO_MAJOR,i), S_IFCHR|S_IRUSR|S_IWUSR, "slamr%d", i); > #endif > return 0; >@@ -644,6 +646,7 @@ static void __exit amrmo_pci_remove(stru > } > #endif > #else >+ class_simple_device_remove(MKDEV(AMRMO_MAJOR, amrmo->num)); > devfs_remove("slamr%d", amrmo->num); > #endif > amrmo_table[amrmo->num] = NULL; >@@ -720,23 +723,39 @@ static int __init amrmo_init(void) > } > #endif > } >+ } >+ >+ /* must create class_simple before the bus gets probed */ >+#ifndef OLD_KERNEL >+ amrmo_class = class_simple_create(THIS_MODULE, "slamr"); >+ if (IS_ERR(amrmo_class)) { >+ int err = PTR_ERR(amrmo_class); >+ printk(KERN_INFO "slamr: failure creating simple class, error %d\n", err); >+ return err; > } >+#endif > > if (!pci_register_driver(&amrmo_pci_driver)) { > pci_unregister_driver(&amrmo_pci_driver); >- return -ENODEV; >+ class_simple_destroy(amrmo_class); >+ return -ENODEV; > } > > if(register_chrdev(AMRMO_MAJOR, "slamr", &amrmo_fops) < 0) { > pci_unregister_driver(&amrmo_pci_driver); >+ class_simple_destroy(amrmo_class); > return -ENOMEM; > } >+ > return 0; > } > > static void __exit amrmo_exit(void) > { > AMRMO_DBG("slamr: exit...\n"); >+#ifndef OLD_KERNEL >+ class_simple_destroy(amrmo_class); >+#endif > unregister_chrdev(AMRMO_MAJOR,"slamr"); > pci_unregister_driver(&amrmo_pci_driver); > } >diff -urNp slmodem-2.9.8/drivers/old_st7554.c slmodem-dsd/drivers/old_st7554.c >--- slmodem-2.9.8/drivers/old_st7554.c 2004-06-14 15:19:26.000000000 +0100 >+++ slmodem-dsd/drivers/old_st7554.c 2004-06-18 20:47:02.738294280 +0100 >@@ -55,6 +55,7 @@ > #include <linux/poll.h> > #include <linux/usb.h> > #include <linux/devfs_fs_kernel.h> >+#include <linux/device.h> > > #include <modem_defs.h> > >@@ -73,6 +74,10 @@ > > #define MY_MAJOR 213 > >+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) >+#define OLD_KERNEL 1 >+#endif >+ > static int debug = 0; > MODULE_PARM(debug,"i"); > MODULE_PARM_DESC(debug,"Debug level: 0-3 (default=0)"); >@@ -201,6 +206,7 @@ struct st7554_state { > > > static struct st7554_state *st7554_table[MAX_MODEMS]; >+static struct class_simple *st7554_class; > > static DECLARE_MUTEX(open_sem); > >@@ -1299,6 +1305,10 @@ static void *st7554_probe(struct usb_dev > mo_free(s); mi_free(s); > goto error1; > } >+ >+#ifndef OLD_KERNEL >+ class_simple_device_add(st7554_class, MKDEV(MY_MAJOR, s->minor), NULL, "slusb%d", i); >+#endif > #ifdef CONFIG_DEVFS_FS > { > char buf[8]; >@@ -1333,6 +1343,10 @@ static void st7554_disconnect(struct usb > s->file->private_data = NULL; > s->file = NULL; > } >+ >+#ifndef OLD_KERNEL >+ class_simple_device_remove(MKDEV(MY_MAJOR, s->minor)); >+#endif > #ifdef CONFIG_DEVFS_FS > { > char buf[8]; >@@ -1343,6 +1357,7 @@ static void st7554_disconnect(struct usb > devfs_unregister (handle); > } > #endif >+ > st7554_stop(s); > st7554_release(s); > s->usbdev = NULL; >@@ -1362,15 +1377,29 @@ static int __init st7554_modem_init(void > { > int ret; > USB_INFO ("ST7554 USB Modem.\n"); >+ >+ /* must create class_simple before the bus gets probed */ >+#ifndef OLD_KERNEL >+ st7554_class = class_simple_create(THIS_MODULE, "slusb"); >+ if (IS_ERR(st7554_class)) { >+ ret = PTR_ERR(st7554_class); >+ USB_ERR("st7554_modem_init: failed to create sysfs class, error %d\n", ret); >+ return PTR_ERR(st7554_class); >+ } >+#endif >+ > ret = usb_register(&st7554_usb_driver); > if ( ret ) { > USB_ERR ("st7554_modem_init: cannot register usb device.\n"); >+ class_simple_destroy(st7554_class); > return ret; > } > if(register_chrdev(MY_MAJOR, "slusb", &st7554_fops) < 0) { >+ class_simple_destroy(st7554_class); > usb_deregister(&st7554_usb_driver); > return -ENOMEM; > } >+ > return 0; > } > >@@ -1378,6 +1407,9 @@ static int __init st7554_modem_init(void > static void __exit st7554_modem_exit(void) > { > USB_DBG ("st7554: exit...\n"); >+#ifndef OLD_KERNEL >+ class_simple_destroy(st7554_class); >+#endif > unregister_chrdev(MY_MAJOR,"slusb"); > usb_deregister(&st7554_usb_driver); > } >diff -urNp slmodem-2.9.8/drivers/st7554.c slmodem-dsd/drivers/st7554.c >--- slmodem-2.9.8/drivers/st7554.c 2004-06-01 19:28:00.000000000 +0100 >+++ slmodem-dsd/drivers/st7554.c 2004-06-18 20:46:41.255560152 +0100 >@@ -55,6 +55,7 @@ > #include <linux/poll.h> > #include <linux/usb.h> > #include <linux/devfs_fs_kernel.h> >+#include <linux/device.h> > > #include <modem_defs.h> > >@@ -67,6 +68,10 @@ > #define DEBUG_URB_PRINT 0 > #define USB_DBG_URB(fmt...) // USB_DBG(fmt) > >+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) >+#define OLD_KERNEL 1 >+#endif >+ > static int debug = 0; > MODULE_PARM(debug,"i"); > MODULE_PARM_DESC(debug,"Debug level: 0-3 (default=0)"); >@@ -205,6 +210,7 @@ struct st7554_state { > > > static struct st7554_state *st7554_table[MAX_MODEMS] = {}; >+static struct class_simple *st7554_class; > > static DECLARE_MUTEX(open_sem); > >@@ -1275,6 +1281,9 @@ static int st7554_probe(struct usb_inter > } > > usb_set_intfdata(interface, s ); >+#ifndef OLD_KERNEL >+ class_simple_device_add(st7554_class, MKDEV(213, i), NULL, "slusb%d", i); >+#endif > devfs_mk_cdev(MKDEV(213,i),S_IFCHR|S_IRUSR|S_IWUSR,"slusb%d",i); > > USB_INFO(KERN_INFO "slusb: slusb%d is found.\n", s->minor); >@@ -1298,11 +1307,14 @@ static void st7554_disconnect(struct usb > struct st7554_state *s = usb_get_intfdata(interface); > usb_set_intfdata(interface, NULL ); > USB_DBG("st7554 disconnect...\n"); >- if (!s || !s->usbdev) { >- USB_DBG("st7554 disconnect: no dev.\n"); >- return; >- } >+ if (!s || !s->usbdev) { >+ USB_DBG("st7554 disconnect: no dev.\n"); >+ return; >+ } > >+#ifndef OLD_KERNEL >+ class_simple_device_remove(MKDEV(213, s->minor)); >+#endif > devfs_remove("slusb%d",s->minor); > > st7554_stop(s); >@@ -1335,15 +1347,29 @@ static int __init st7554_modem_init(void > { > int ret; > USB_INFO ("ST7554 USB Modem.\n"); >+ >+ /* must create class_simple before the bus gets probed */ >+#ifndef OLD_KERNEL >+ st7554_class = class_simple_create(THIS_MODULE, "slusb"); >+ if (IS_ERR(st7554_class)) { >+ ret = PTR_ERR(st7554_class); >+ USB_ERR("st7554_modem_init: failed to create sysfs class, error %d\n", ret); >+ return ret; >+ } >+#endif >+ > ret = usb_register(&st7554_usb_driver); > if ( ret ) { > USB_ERR ("st7554_modem_init: cannot register usb device.\n"); >+ class_simple_destroy(st7554_class); > return ret; > } > if(register_chrdev(213, "slusb", &st7554_fops) < 0) { > usb_deregister(&st7554_usb_driver); >+ class_simple_destroy(st7554_class); > return -ENOMEM; > } >+ > return 0; > } > >@@ -1351,6 +1377,9 @@ static int __init st7554_modem_init(void > static void __exit st7554_modem_exit(void) > { > USB_DBG ("st7554: exit...\n"); >+#ifndef OLD_KERNEL >+ class_simple_destroy(st7554_class); >+#endif > unregister_chrdev(213,"slusb"); > usb_deregister(&st7554_usb_driver); > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 47947
:
29356
|
29623
|
29625
|
29738
|
29739
|
29740
|
29741
|
29742
|
29743
|
32292
|
32293
|
32775
|
32916
|
32917
|
33400
|
33431
|
33432
|
33468
|
33470
| 33516