summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkpfleming <kpfleming@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2005-07-09 00:21:25 +0000
committerkpfleming <kpfleming@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2005-07-09 00:21:25 +0000
commita3d91743a921c5f7f924ecde1ff53e3f8f3ba177 (patch)
tree26c211b1fc6da630a567b397e3f6a9d576c4eb63
parentcf22311add5de3bc1b105d63f2a0a10d73462cbc (diff)
update to 2.6.13 sysfs API (bug #4639)
git-svn-id: http://svn.digium.com/svn/zaptel/branches/v1-0@689 5390a7c7-147a-4af0-8ec9-7488f05a26cb
-rwxr-xr-xzaptel.c32
1 files changed, 20 insertions, 12 deletions
diff --git a/zaptel.c b/zaptel.c
index cc900dd..fcfedc1 100755
--- a/zaptel.c
+++ b/zaptel.c
@@ -157,7 +157,15 @@ static devfs_handle_t timer;
/* udev necessary data structures. Yeah! */
#ifdef CONFIG_ZAP_UDEV
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,13)
+static struct class *zap_class = NULL;
+#else
static struct class_simple *zap_class = NULL;
+#define class_create class_simple_create
+#define class_destroy class_simple_destroy
+#define class_device_create class_simple_device_add
+#define class_device_destroy(a, b) class_simple_device_remove(b)
+#endif
#endif
/* There is a table like this in the PPP driver, too */
@@ -4395,7 +4403,7 @@ int zt_register(struct zt_span *span, int prefmaster)
for (x = 0; x < span->channels; x++) {
char chan_name[50];
sprintf(chan_name, "zap%d", span->chans[x].channo);
- class_simple_device_add(zap_class, MKDEV(ZT_MAJOR, span->chans[x].channo), NULL, chan_name);
+ class_device_create(zap_class, MKDEV(ZT_MAJOR, span->chans[x].channo), NULL, chan_name);
}
#endif /* CONFIG_ZAP_UDEV */
@@ -4445,7 +4453,7 @@ int zt_unregister(struct zt_span *span)
#ifdef CONFIG_ZAP_UDEV
for (x = 0; x < span->channels; x++) {
- class_simple_device_remove(MKDEV(ZT_MAJOR, span->chans[x].channo));
+ class_device_destroy(zap_class, MKDEV(ZT_MAJOR, span->chans[x].channo));
}
#endif /* CONFIG_ZAP_UDEV */
@@ -6420,11 +6428,11 @@ static int __init zt_init(void) {
#endif
#ifdef CONFIG_ZAP_UDEV /* udev support functions */
- zap_class = class_simple_create(THIS_MODULE, "zaptel");
- class_simple_device_add(zap_class, MKDEV(ZT_MAJOR, 253), NULL, "zaptimer");
- class_simple_device_add(zap_class, MKDEV(ZT_MAJOR, 254), NULL, "zapchannel");
- class_simple_device_add(zap_class, MKDEV(ZT_MAJOR, 255), NULL, "zappseudo");
- class_simple_device_add(zap_class, MKDEV(ZT_MAJOR, 0), NULL, "zapctl");
+ zap_class = class_create(THIS_MODULE, "zaptel");
+ class_device_create(zap_class, MKDEV(ZT_MAJOR, 253), NULL, "zaptimer");
+ class_device_create(zap_class, MKDEV(ZT_MAJOR, 254), NULL, "zapchannel");
+ class_device_create(zap_class, MKDEV(ZT_MAJOR, 255), NULL, "zappseudo");
+ class_device_create(zap_class, MKDEV(ZT_MAJOR, 0), NULL, "zapctl");
#endif /* CONFIG_ZAP_UDEV */
#ifdef CONFIG_DEVFS_FS
@@ -6477,11 +6485,11 @@ static void __exit zt_cleanup(void) {
devfs_unregister_chrdev(ZT_MAJOR, "zaptel");
#else
#ifdef CONFIG_ZAP_UDEV
- class_simple_device_remove(MKDEV(ZT_MAJOR, 253)); /* timer */
- class_simple_device_remove(MKDEV(ZT_MAJOR, 254)); /* channel */
- class_simple_device_remove(MKDEV(ZT_MAJOR, 255)); /* pseudo */
- class_simple_device_remove(MKDEV(ZT_MAJOR, 0)); /* ctl */
- class_simple_destroy(zap_class);
+ class_device_destroy(zap_class, MKDEV(ZT_MAJOR, 253)); /* timer */
+ class_device_destroy(zap_class, MKDEV(ZT_MAJOR, 254)); /* channel */
+ class_device_destroy(zap_class, MKDEV(ZT_MAJOR, 255)); /* pseudo */
+ class_device_destroy(zap_class, MKDEV(ZT_MAJOR, 0)); /* ctl */
+ class_destroy(zap_class);
#endif /* CONFIG_ZAP_UDEV */
unregister_chrdev(ZT_MAJOR, "zaptel");
#endif