source: packages/libs/zaptel-1.4.x/patches/305-class_device_removed.patch @ 13684

Last change on this file since 13684 was 13684, checked in by zandbelt, 7 years ago

make zaptel compile with kernels >2.6.25

File size: 3.2 KB
  • kernel/zaptel-base.c

    diff -Nru zaptel-1.4.9.2.org/kernel/zaptel-base.c zaptel-1.4.9.2/kernel/zaptel-base.c
    old new  
    163163/* udev necessary data structures.  Yeah! */ 
    164164#ifdef CONFIG_ZAP_UDEV 
    165165 
    166 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,15) 
     166#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27) 
     167#define CLASS_DEV_CREATE(class, devt, device, name) \ 
     168      device_create(class, device, devt, NULL, "%s", name) 
     169#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,26) 
     170#define CLASS_DEV_CREATE(class, devt, device, name) \ 
     171        device_create(class, device, devt, name) 
     172#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,15) 
    167173#define CLASS_DEV_CREATE(class, devt, device, name) \ 
    168174        class_device_create(class, NULL, devt, device, name) 
    169 #else 
     175#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,13) 
    170176#define CLASS_DEV_CREATE(class, devt, device, name) \ 
    171177        class_device_create(class, devt, device, name) 
     178#else 
     179#define CLASS_DEV_CREATE(class, devt, device, name) \ 
     180        class_simple_device_add(class, devt, device, name) 
     181#endif 
     182 
     183#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,26) 
     184#define CLASS_DEV_DESTROY(class, devt) \ 
     185        device_destroy(class, devt) 
     186#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,13) 
     187#define CLASS_DEV_DESTROY(class, devt) \ 
     188        class_device_destroy(class, devt) 
     189#else 
     190#define CLASS_DEV_DESTROY(class, devt) \ 
     191        class_simple_device_remove(class, devt) 
    172192#endif 
    173193 
    174194#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,13) 
     
    177197static struct class_simple *zap_class = NULL; 
    178198#define class_create class_simple_create 
    179199#define class_destroy class_simple_destroy 
    180 #define class_device_create class_simple_device_add 
    181 #define class_device_destroy(a, b) class_simple_device_remove(b) 
    182200#endif 
    183201 
    184202#endif /* CONFIG_ZAP_UDEV */ 
     
    49734991#ifdef CONFIG_ZAP_UDEV 
    49744992        for (x = 0; x < span->channels; x++) { 
    49754993                if (span->chans[x].channo < 250) 
    4976                         class_device_destroy(zap_class, MKDEV(ZT_MAJOR, span->chans[x].channo)); 
     4994                        CLASS_DEV_DESTROY(zap_class, MKDEV(ZT_MAJOR, span->chans[x].channo)); 
    49774995        } 
    49784996#endif /* CONFIG_ZAP_UDEV */ 
    49794997 
     
    73557373int zt_unregister_chardev(struct zt_chardev *dev) 
    73567374{ 
    73577375#ifdef CONFIG_ZAP_UDEV 
    7358         class_device_destroy(zap_class, MKDEV(ZT_MAJOR, dev->minor)); 
     7376        CLASS_DEV_DESTROY(zap_class, MKDEV(ZT_MAJOR, dev->minor)); 
    73597377#endif /* CONFIG_ZAP_UDEV */ 
    73607378 
    73617379#ifdef CONFIG_DEVFS_FS 
     
    74347452        devfs_unregister_chrdev(ZT_MAJOR, "zaptel"); 
    74357453#else 
    74367454#ifdef CONFIG_ZAP_UDEV 
    7437         class_device_destroy(zap_class, MKDEV(ZT_MAJOR, 253)); /* timer */ 
    7438         class_device_destroy(zap_class, MKDEV(ZT_MAJOR, 254)); /* channel */ 
    7439         class_device_destroy(zap_class, MKDEV(ZT_MAJOR, 255)); /* pseudo */ 
    7440         class_device_destroy(zap_class, MKDEV(ZT_MAJOR, 0)); /* ctl */ 
     7455        CLASS_DEV_DESTROY(zap_class, MKDEV(ZT_MAJOR, 253)); /* timer */ 
     7456        CLASS_DEV_DESTROY(zap_class, MKDEV(ZT_MAJOR, 254)); /* channel */ 
     7457        CLASS_DEV_DESTROY(zap_class, MKDEV(ZT_MAJOR, 255)); /* pseudo */ 
     7458        CLASS_DEV_DESTROY(zap_class, MKDEV(ZT_MAJOR, 0)); /* ctl */ 
    74417459        class_destroy(zap_class); 
    74427460#endif /* CONFIG_ZAP_UDEV */ 
    74437461        unregister_chrdev(ZT_MAJOR, "zaptel"); 
Note: See TracBrowser for help on using the repository browser.