From 00a4ff1bd81d8f3774792539cb50712231d72bfe Mon Sep 17 00:00:00 2001 From: Tzafrir Cohen Date: Tue, 13 Mar 2012 20:09:12 +0000 Subject: Remove support for kernels < 2.6.18 This patch removes support for kernel versions < 2.6.18, as those are not actively supported in any major Linux distribution (except RHEL4, which is in the "extended" support level of the product life cycle). This removes much of the more #ifdef-rich parts of the code. Signed-off-by: Oron Peled Acked-by: Acked-by: Shaun Ruffell Acked-by: Tzafrir Cohen git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10472 a0bf4364-ded3-4de4-8d8a-66a801d63aff --- drivers/dahdi/dahdi-base.c | 48 ------------- drivers/dahdi/dahdi-sysfs-chan.c | 9 --- drivers/dahdi/dahdi-sysfs.c | 84 ---------------------- drivers/dahdi/dahdi-sysfs.h | 55 +------------- drivers/dahdi/dahdi_dynamic.c | 5 -- drivers/dahdi/dahdi_dynamic_eth.c | 8 --- drivers/dahdi/dahdi_dynamic_ethmf.c | 26 ------- drivers/dahdi/hpec/dahdi_echocan_hpec.c | 9 --- .../vpmadt032_loader/dahdi_vpmadt032_loader.c | 9 --- drivers/dahdi/wcb4xxp/base.c | 8 --- drivers/dahdi/wct4xxp/base.c | 33 --------- drivers/dahdi/wct4xxp/vpm450m.c | 4 -- drivers/dahdi/wctc4xxp/base.c | 11 --- drivers/dahdi/wctdm24xxp/base.c | 4 -- drivers/dahdi/wcte12xp/base.c | 10 --- drivers/dahdi/xpp/card_bri.c | 2 - drivers/dahdi/xpp/card_echo.c | 2 - drivers/dahdi/xpp/card_fxo.c | 2 - drivers/dahdi/xpp/card_fxs.c | 2 - drivers/dahdi/xpp/card_pri.c | 2 - drivers/dahdi/xpp/dahdi_debug.c | 5 -- drivers/dahdi/xpp/parport_debug.c | 5 -- drivers/dahdi/xpp/xbus-core.c | 5 -- drivers/dahdi/xpp/xbus-core.h | 13 ---- drivers/dahdi/xpp/xbus-pcm.c | 5 -- drivers/dahdi/xpp/xbus-sysfs.c | 60 ---------------- drivers/dahdi/xpp/xdefs.h | 10 --- drivers/dahdi/xpp/xpd.h | 19 ----- drivers/dahdi/xpp/xpp_dahdi.c | 9 --- drivers/dahdi/xpp/xpp_usb.c | 73 +------------------ include/dahdi/dahdi_config.h | 5 -- include/dahdi/kernel.h | 74 ------------------- 32 files changed, 4 insertions(+), 612 deletions(-) diff --git a/drivers/dahdi/dahdi-base.c b/drivers/dahdi/dahdi-base.c index 020150e..6db1f3f 100644 --- a/drivers/dahdi/dahdi-base.c +++ b/drivers/dahdi/dahdi-base.c @@ -49,9 +49,7 @@ #include #include #include -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 16) #include -#endif #if defined(HAVE_UNLOCKED_IOCTL) && defined(CONFIG_BKL) #include @@ -342,12 +340,7 @@ static void tone_zone_release(struct kref *kref) */ static inline int tone_zone_put(struct dahdi_zone *z) { -#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 12) - kref_put(&z->refcount, tone_zone_release); - return 1; -#else return kref_put(&z->refcount, tone_zone_release); -#endif } static inline void tone_zone_get(struct dahdi_zone *z) @@ -550,10 +543,6 @@ u_char __dahdi_lin2a[16384]; static u_char defgain[256]; -#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 10) -#define __RW_LOCK_UNLOCKED() RW_LOCK_UNLOCKED -#endif - #define NUM_SIGS 10 static DEFINE_SPINLOCK(ecfactory_list_lock); @@ -1878,10 +1867,6 @@ static int dahdi_register_hdlc_device(struct net_device *dev, const char *dev_na result = register_netdev(dev); if (result != 0) return -EIO; -#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,14) - if (netif_carrier_ok(dev)) - netif_carrier_off(dev); /* no carrier until DCD goes up */ -#endif return 0; } @@ -3162,13 +3147,9 @@ static int dahdi_open(struct inode *inode, struct file *file) return -ENXIO; } } -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) - __MOD_INC_USE_COUNT (dahdi_transcode_fops->owner); -#else if (!try_module_get(dahdi_transcode_fops->owner)) { return -ENXIO; } -#endif if (dahdi_transcode_fops && dahdi_transcode_fops->open) { return dahdi_transcode_fops->open(inode, file); } else { @@ -10107,34 +10088,5 @@ static void __exit dahdi_cleanup(void) flush_find_master_work(); } -#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 12) -char *dahdi_kasprintf(gfp_t gfp, const char *fmt, ...) -{ - va_list ap; - char *p; - char *temp; - unsigned int len; - - temp = kmalloc(PAGE_SIZE, GFP_KERNEL); - if (!temp) - return NULL; - - va_start(ap, fmt); - len = vsnprintf(temp, PAGE_SIZE, fmt, ap); - va_end(ap); - - p = kzalloc(len + 1, gfp); - if (!p) { - kfree(temp); - return NULL; - } - - memcpy(p, temp, len + 1); - kfree(temp); - return p; -} -EXPORT_SYMBOL(dahdi_kasprintf); -#endif - module_init(dahdi_init); module_exit(dahdi_cleanup); diff --git a/drivers/dahdi/dahdi-sysfs-chan.c b/drivers/dahdi/dahdi-sysfs-chan.c index 283895d..7973064 100644 --- a/drivers/dahdi/dahdi-sysfs-chan.c +++ b/drivers/dahdi/dahdi-sysfs-chan.c @@ -1,7 +1,4 @@ #include -#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 0) -# warning "This module is tested only with 2.6 kernels" -#endif #define DAHDI_PRINK_MACROS_USE_debug #include @@ -17,13 +14,7 @@ #define DEL_DAHDI_DEV(num) \ CLASS_DEV_DESTROY(dahdi_class, MKDEV(DAHDI_MAJOR, num)) -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 13) static struct class *dahdi_class; -#else -static struct class_simple *dahdi_class; -#define class_create class_simple_create -#define class_destroy class_simple_destroy -#endif int chan_sysfs_create(struct dahdi_chan *chan) { diff --git a/drivers/dahdi/dahdi-sysfs.c b/drivers/dahdi/dahdi-sysfs.c index f59663a..95f07a7 100644 --- a/drivers/dahdi/dahdi-sysfs.c +++ b/drivers/dahdi/dahdi-sysfs.c @@ -22,23 +22,6 @@ static inline struct dahdi_span *dev_to_span(struct device *dev) return dev_get_drvdata(dev); } -#ifdef OLD_HOTPLUG_SUPPORT -static int span_hotplug(struct device *dev, char **envp, int envnum, - char *buff, int bufsize) -{ - struct dahdi_span *span; - - if (!dev) - return -ENODEV; - span = dev_to_span(dev); - envp[0] = buff; - if (snprintf(buff, bufsize, "SPAN_NAME=%s", span->name) >= bufsize) - return -ENOMEM; - envp[1] = NULL; - return 0; -} -#else - #define SPAN_VAR_BLOCK \ do { \ DAHDI_ADD_UEVENT_VAR("DAHDI_INIT_DIR=%s", initdir); \ @@ -102,8 +85,6 @@ static int span_uevent(struct device *dev, struct kobj_uevent_env *kenv) #endif -#endif /* OLD_HOTPLUG_SUPPORT */ - #define span_attr(field, format_string) \ static BUS_ATTR_READER(field##_show, dev, buf) \ { \ @@ -214,11 +195,7 @@ static struct driver_attribute dahdi_attrs[] = { static struct bus_type spans_bus_type = { .name = "dahdi_spans", .match = span_match, -#ifdef OLD_HOTPLUG_SUPPORT - .hotplug = span_hotplug, -#else .uevent = span_uevent, -#endif .dev_attrs = span_dev_attrs, .drv_attrs = dahdi_attrs, }; @@ -246,9 +223,7 @@ static struct device_driver dahdi_driver = { .bus = &spans_bus_type, .probe = span_probe, .remove = span_remove, -#ifndef OLD_HOTPLUG_SUPPORT .owner = THIS_MODULE -#endif }; static void span_uevent_send(struct dahdi_span *span, enum kobject_action act) @@ -258,26 +233,7 @@ static void span_uevent_send(struct dahdi_span *span, enum kobject_action act) kobj = &span->span_device->kobj; span_dbg(DEVICES, span, "SYFS dev_name=%s action=%d\n", dev_name(span->span_device), act); - -#if defined(OLD_HOTPLUG_SUPPORT_269) - { - /* Copy from new kernels lib/kobject_uevent.c */ - static const char *const str[] = { - [KOBJ_ADD] "add", - [KOBJ_REMOVE] "remove", - [KOBJ_CHANGE] "change", - [KOBJ_MOUNT] "mount", - [KOBJ_UMOUNT] "umount", - [KOBJ_OFFLINE] "offline", - [KOBJ_ONLINE] "online" - }; - kobject_hotplug(str[act], kobj); - } -#elif defined(OLD_HOTPLUG_SUPPORT) - kobject_hotplug(kobj, act); -#else kobject_uevent(kobj, act); -#endif } static void span_release(struct device *dev) @@ -372,37 +328,25 @@ static inline struct dahdi_device *to_ddev(struct device *dev) return container_of(dev, struct dahdi_device, dev); } -#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 13) -static ssize_t dahdi_device_manufacturer_show(struct device *dev, char *buf) -#else static ssize_t dahdi_device_manufacturer_show(struct device *dev, struct device_attribute *attr, char *buf) -#endif { struct dahdi_device *ddev = to_ddev(dev); return sprintf(buf, "%s\n", ddev->manufacturer); } -#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 13) -static ssize_t dahdi_device_type_show(struct device *dev, char *buf) -#else static ssize_t dahdi_device_type_show(struct device *dev, struct device_attribute *attr, char *buf) -#endif { struct dahdi_device *ddev = to_ddev(dev); return sprintf(buf, "%s\n", ddev->devicetype); } -#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 13) -static ssize_t dahdi_device_span_count_show(struct device *dev, char *buf) -#else static ssize_t dahdi_device_span_count_show(struct device *dev, struct device_attribute *attr, char *buf) -#endif { struct dahdi_device *ddev = to_ddev(dev); unsigned int count = 0; @@ -414,13 +358,9 @@ dahdi_device_span_count_show(struct device *dev, return sprintf(buf, "%d\n", count); } -#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 13) -static ssize_t dahdi_device_hardware_id_show(struct device *dev, char *buf) -#else static ssize_t dahdi_device_hardware_id_show(struct device *dev, struct device_attribute *attr, char *buf) -#endif { struct dahdi_device *ddev = to_ddev(dev); @@ -428,28 +368,18 @@ dahdi_device_hardware_id_show(struct device *dev, (ddev->hardware_id) ? ddev->hardware_id : ""); } -#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 13) -static ssize_t -dahdi_device_auto_assign(struct device *dev, const char *buf, size_t count) -#else static ssize_t dahdi_device_auto_assign(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) -#endif { struct dahdi_device *ddev = to_ddev(dev); dahdi_assign_device_spans(ddev); return count; } -#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 13) -static ssize_t -dahdi_device_assign_span(struct device *dev, const char *buf, size_t count) -#else static ssize_t dahdi_device_assign_span(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) -#endif { int ret; struct dahdi_span *span; @@ -482,14 +412,9 @@ dahdi_device_assign_span(struct device *dev, struct device_attribute *attr, return -EINVAL; } -#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 13) -static ssize_t -dahdi_device_unassign_span(struct device *dev, const char *buf, size_t count) -#else static ssize_t dahdi_device_unassign_span(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) -#endif { int ret; unsigned int local_span_number; @@ -515,13 +440,9 @@ dahdi_device_unassign_span(struct device *dev, struct device_attribute *attr, return (ret < 0) ? ret : count; } -#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 13) -static ssize_t dahdi_spantype_show(struct device *dev, char *buf) -#else static ssize_t dahdi_spantype_show(struct device *dev, struct device_attribute *attr, char *buf) -#endif { struct dahdi_device *ddev = to_ddev(dev); int count = 0; @@ -539,14 +460,9 @@ dahdi_spantype_show(struct device *dev, return total; } -#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 13) -static ssize_t -dahdi_spantype_store(struct device *dev, const char *buf, size_t count) -#else static ssize_t dahdi_spantype_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) -#endif { struct dahdi_device *const ddev = to_ddev(dev); int ret; diff --git a/drivers/dahdi/dahdi-sysfs.h b/drivers/dahdi/dahdi-sysfs.h index 41e1786..9cbd9f9 100644 --- a/drivers/dahdi/dahdi-sysfs.h +++ b/drivers/dahdi/dahdi-sysfs.h @@ -1,35 +1,6 @@ #ifndef DAHDI_SYSFS_H #define DAHDI_SYSFS_H -/* - * Very old hotplug support - */ -#if LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 9) -#define OLD_HOTPLUG_SUPPORT /* for older kernels */ -#define OLD_HOTPLUG_SUPPORT_269 -#endif - -#ifdef OLD_HOTPLUG_SUPPORT_269 -/* Copy from new kernels lib/kobject_uevent.c */ -enum kobject_action { - KOBJ_ADD, - KOBJ_REMOVE, - KOBJ_CHANGE, - KOBJ_MOUNT, - KOBJ_UMOUNT, - KOBJ_OFFLINE, - KOBJ_ONLINE, -}; -#endif - -/* - * Hotplug replaced with uevent in 2.6.16 - */ -#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 16) -#define OLD_HOTPLUG_SUPPORT /* for older kernels */ -#endif - -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 14) #define DEVICE_ATTR_READER(name, dev, buf) \ ssize_t name(struct device *dev, \ struct device_attribute *attr, \ @@ -46,16 +17,6 @@ enum kobject_action { ssize_t name(struct device *dev, \ struct device_attribute *attr, \ const char *buf, size_t count) -#else -#define DEVICE_ATTR_READER(name, dev, buf) \ - ssize_t name(struct device *dev, char *buf) -#define DEVICE_ATTR_WRITER(name, dev, buf, count) \ - ssize_t name(struct device *dev, const char *buf, size_t count) -#define BUS_ATTR_READER(name, dev, buf) \ - ssize_t name(struct device *dev, char *buf) -#define BUS_ATTR_WRITER(name, dev, buf, count) \ - ssize_t name(struct device *dev, const char *buf, size_t count) -#endif #define DRIVER_ATTR_READER(name, drv, buf) \ ssize_t name(struct device_driver *drv, char * buf) @@ -68,15 +29,9 @@ enum kobject_action { #elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 26) #define CLASS_DEV_CREATE(class, devt, device, name) \ device_create(class, device, devt, name) -#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 15) -#define CLASS_DEV_CREATE(class, devt, device, name) \ - class_device_create(class, NULL, devt, device, name) -#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 13) -#define CLASS_DEV_CREATE(class, devt, device, name) \ - class_device_create(class, devt, device, name) #else #define CLASS_DEV_CREATE(class, devt, device, name) \ - class_simple_device_add(class, devt, device, name) + class_device_create(class, NULL, devt, device, name) #endif /* Device file destruction macros */ @@ -84,15 +39,9 @@ enum kobject_action { #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 26) #define CLASS_DEV_DESTROY(class, devt) \ device_destroy(class, devt) -#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 13) -#define CLASS_DEV_DESTROY(class, devt) \ - class_device_destroy(class, devt) -#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 9) -#define CLASS_DEV_DESTROY(class, devt) \ - class_simple_device_remove(devt) #else #define CLASS_DEV_DESTROY(class, devt) \ - class_simple_device_remove(class, devt) + class_device_destroy(class, devt) #endif /* Global */ diff --git a/drivers/dahdi/dahdi_dynamic.c b/drivers/dahdi/dahdi_dynamic.c index cbcdce7..d896580 100644 --- a/drivers/dahdi/dahdi_dynamic.c +++ b/drivers/dahdi/dahdi_dynamic.c @@ -406,12 +406,7 @@ static void dahdi_dynamic_release(struct kref *kref) static inline int dynamic_put(struct dahdi_dynamic *d) { -#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 12) - kref_put(&d->kref, dahdi_dynamic_release); - return 1; -#else return kref_put(&d->kref, dahdi_dynamic_release); -#endif } static inline void dynamic_get(struct dahdi_dynamic *d) diff --git a/drivers/dahdi/dahdi_dynamic_eth.c b/drivers/dahdi/dahdi_dynamic_eth.c index 46699f5..28aa7e5 100644 --- a/drivers/dahdi/dahdi_dynamic_eth.c +++ b/drivers/dahdi/dahdi_dynamic_eth.c @@ -74,11 +74,7 @@ static struct dahdi_span *ztdeth_getspan(unsigned char *addr, unsigned short sub return span; } -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,14) static int ztdeth_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt, struct net_device *orig_dev) -#else -static int ztdeth_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt) -#endif { struct dahdi_span *span; struct ztdeth_header *zh; @@ -87,11 +83,7 @@ static int ztdeth_rcv(struct sk_buff *skb, struct net_device *dev, struct packet #else zh = (struct ztdeth_header *)skb->nh.raw; #endif -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,9) span = ztdeth_getspan(eth_hdr(skb)->h_source, zh->subaddr); -#else - span = ztdeth_getspan(skb->mac.ethernet->h_source, zh->subaddr); -#endif if (span) { skb_pull(skb, sizeof(struct ztdeth_header)); #ifdef NEW_SKB_LINEARIZE diff --git a/drivers/dahdi/dahdi_dynamic_ethmf.c b/drivers/dahdi/dahdi_dynamic_ethmf.c index 53845c9..dd1214d 100644 --- a/drivers/dahdi/dahdi_dynamic_ethmf.c +++ b/drivers/dahdi/dahdi_dynamic_ethmf.c @@ -224,13 +224,8 @@ static inline int ethmf_trx_spans_ready(unsigned int addr_hash, struct ztdeth *( /** * Ethernet receiving side processing function. */ -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 14) static int ztdethmf_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt, struct net_device *orig_dev) -#else -static int ztdethmf_rcv(struct sk_buff *skb, struct net_device *dev, - struct packet_type *pt) -#endif { int num_spans = 0, span_index = 0; unsigned char *data; @@ -267,13 +262,8 @@ static int ztdethmf_rcv(struct sk_buff *skb, struct net_device *dev, rcu_read_lock(); do { -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 9) find_ethmf(eth_hdr(skb)->h_source, htons(span_index), &z, &span); -#else - find_ethmf(skb->mac.ethernet->h_source, - htons(span_index), &z, &span); -#endif if (unlikely(!z || !span)) { /* The recv'd span does not belong to us */ /* ethmf_errors_inc(); */ @@ -396,10 +386,6 @@ static void ztdethmf_transmit(struct dahdi_dynamic *dyn, u8 *msg, size_t msglen) struct net_device *dev; unsigned char addr[ETH_ALEN]; int spans_ready = 0, index = 0; -#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 10) - static DEFINE_SPINLOCK(lock); - unsigned long flags; -#endif if (atomic_read(&shutdown)) return; @@ -411,24 +397,12 @@ static void ztdethmf_transmit(struct dahdi_dynamic *dyn, u8 *msg, size_t msglen) return; } -#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 10) - if (!atomic_read(&z->ready)) { - spin_lock_irqsave(&lock, flags); - atomic_inc(&z->ready); - if (1 == atomic_read(&z->ready)) { - memcpy(z->msgbuf, msg, msglen); - z->msgbuf_len = msglen; - } - spin_unlock_irqrestore(&lock, flags); - } -#else if (!atomic_read(&z->ready)) { if (atomic_inc_return(&z->ready) == 1) { memcpy(z->msgbuf, msg, msglen); z->msgbuf_len = msglen; } } -#endif spans_ready = ethmf_trx_spans_ready(z->addr_hash, &ready_spans); if (spans_ready) { diff --git a/drivers/dahdi/hpec/dahdi_echocan_hpec.c b/drivers/dahdi/hpec/dahdi_echocan_hpec.c index 7d898a5..a4972cc 100644 --- a/drivers/dahdi/hpec/dahdi_echocan_hpec.c +++ b/drivers/dahdi/hpec/dahdi_echocan_hpec.c @@ -72,18 +72,9 @@ static int __attribute__((regparm(0), format(printf, 1, 2))) logger(const char * int res; va_list args; -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,9) va_start(args, format); res = vprintk(format, args); va_end(args); -#else - char buf[256]; - - va_start(args, format); - res = vsnprintf(buf, sizeof(buf), format, args); - va_end(args); - printk(KERN_INFO "%s" buf); -#endif return res; } diff --git a/drivers/dahdi/vpmadt032_loader/dahdi_vpmadt032_loader.c b/drivers/dahdi/vpmadt032_loader/dahdi_vpmadt032_loader.c index 6470cb3..c90c4d6 100644 --- a/drivers/dahdi/vpmadt032_loader/dahdi_vpmadt032_loader.c +++ b/drivers/dahdi/vpmadt032_loader/dahdi_vpmadt032_loader.c @@ -38,18 +38,9 @@ logger(const char *format, ...) int res; va_list args; -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 9) va_start(args, format); res = vprintk(format, args); va_end(args); -#else - char buf[256]; - - va_start(args, format); - res = vsnprintf(buf, sizeof(buf), format, args); - va_end(args); - printk(KERN_INFO "%s" buf); -#endif return res; } diff --git a/drivers/dahdi/wcb4xxp/base.c b/drivers/dahdi/wcb4xxp/base.c index 2255add..c3896c5 100644 --- a/drivers/dahdi/wcb4xxp/base.c +++ b/drivers/dahdi/wcb4xxp/base.c @@ -1198,7 +1198,6 @@ static int b4xxp_find_sync(struct b4xxp *b4) return src; } -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 18)) static ssize_t b4_timing_master_show(struct device *dev, struct device_attribute *attr, char *buf) @@ -1226,13 +1225,6 @@ static void remove_sysfs_files(struct b4xxp *b4) &dev_attr_timing_master); } -#else - -static inline void create_sysfs_files(struct b4xxp *b4) { return; } -static inline void remove_sysfs_files(struct b4xxp *b4) { return; } - -#endif /* LINUX_KERNEL > 2.6.18 */ - /* * allocates memory and pretty-prints a given S/T state engine state to it. * calling routine is responsible for freeing the pointer returned! diff --git a/drivers/dahdi/wct4xxp/base.c b/drivers/dahdi/wct4xxp/base.c index 7127561..8a9edc3 100644 --- a/drivers/dahdi/wct4xxp/base.c +++ b/drivers/dahdi/wct4xxp/base.c @@ -119,11 +119,7 @@ struct cpu_workqueue_struct { */ struct workqueue_struct { /* TODO: Find out exactly where the API changed */ -#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,15) struct cpu_workqueue_struct *cpu_wq; -#else - struct cpu_workqueue_struct cpu_wq[NR_CPUS]; -#endif const char *name; struct list_head list; /* Empty if single thread */ }; @@ -2400,7 +2396,6 @@ static void __t4_set_sclk_src(struct t4 *wc, int mode, int master, int slave) __t4_pci_out(wc, WC_DMACTRL, wc->dmactrl); } -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 18)) static ssize_t t4_timing_master_show(struct device *dev, struct device_attribute *attr, char *buf) @@ -2431,13 +2426,6 @@ static void remove_sysfs_files(struct t4 *wc) &dev_attr_timing_master); } -#else - -static inline void create_sysfs_files(struct t4 *wc) { return; } -static inline void remove_sysfs_files(struct t4 *wc) { return; } - -#endif /* LINUX_KERNEL > 2.6.18 */ - static inline void __t4_update_timing(struct t4 *wc) { int i; @@ -4617,12 +4605,6 @@ static int t8_update_firmware(struct t4 *wc, const struct firmware *fw, const u32 BASE_ADDRESS = 0x00080000; const u8 *data, *end; size_t size = 0; -#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 10) - u32 *pci_state; - pci_state = kzalloc(64 * sizeof(u32), GFP_KERNEL); - if (!pci_state) - return -ENOMEM; -#endif /* Erase flash */ erase_half(wc); @@ -4647,11 +4629,7 @@ static int t8_update_firmware(struct t4 *wc, const struct firmware *fw, /* Reset te820 fpga after loading firmware */ dev_info(&wc->dev->dev, "Firmware load complete. Reseting device.\n"); -#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 10) - res = pci_save_state(wc->dev, pci_state); -#else res = pci_save_state(wc->dev); -#endif if (res) goto error_exit; /* Set the fpga reset bits and clobber the remainder of the @@ -4659,11 +4637,7 @@ static int t8_update_firmware(struct t4 *wc, const struct firmware *fw, t4_pci_out(wc, WC_LEDS, 0xe0000000); msleep(1000); -#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 10) - pci_restore_state(wc->dev, pci_state); -#else pci_restore_state(wc->dev); -#endif /* Signal the driver to restart initialization. * This will back out all initialization so far and @@ -4671,9 +4645,6 @@ static int t8_update_firmware(struct t4 *wc, const struct firmware *fw, return -EAGAIN; error_exit: -#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 10) - kfree(pci_state); -#endif return res; } @@ -5383,13 +5354,11 @@ static DEFINE_PCI_DEVICE_TABLE(t4_pci_tbl) = { 0, } }; -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 12) static void _t4_shutdown(struct pci_dev *pdev) { struct t4 *wc = pci_get_drvdata(pdev); t4_hardware_stop(wc); } -#endif static int t4_suspend(struct pci_dev *pdev, pm_message_t state) { @@ -5400,9 +5369,7 @@ static struct pci_driver t4_driver = { .name = "wct4xxp", .probe = t4_init_one_retry, .remove = __devexit_p(t4_remove_one), -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 12) .shutdown = _t4_shutdown, -#endif .suspend = t4_suspend, .id_table = t4_pci_tbl, }; diff --git a/drivers/dahdi/wct4xxp/vpm450m.c b/drivers/dahdi/wct4xxp/vpm450m.c index 867ea1c..87dc7c7 100644 --- a/drivers/dahdi/wct4xxp/vpm450m.c +++ b/drivers/dahdi/wct4xxp/vpm450m.c @@ -28,10 +28,6 @@ #include "vpm450m.h" #include "oct6100api/oct6100_api.h" -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,18) -#include -#endif - /* API for Octasic access */ UINT32 Oct6100UserGetTime(tPOCT6100_GET_TIME f_pTime) { diff --git a/drivers/dahdi/wctc4xxp/base.c b/drivers/dahdi/wctc4xxp/base.c index 29579d3..61d5617 100644 --- a/drivers/dahdi/wctc4xxp/base.c +++ b/drivers/dahdi/wctc4xxp/base.c @@ -42,11 +42,7 @@ #include "dahdi/kernel.h" -#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 18) -#include -#else #include -#endif /* COMPILE TIME OPTIONS =================================================== */ @@ -73,13 +69,6 @@ dev_info(&(wc)->pdev->dev, _fmt, ## _args); \ } \ -#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 14) -/* also added in RHEL kernels with the OpenInfiniband backport: */ -#if LINUX_VERSION_CODE != KERNEL_VERSION(2, 6, 9) || !defined(DEFINE_SPINLOCK) -typedef unsigned gfp_t; /* Added in 2.6.14 */ -#endif -#endif - /* define CONFIG_WCTC4XXP_POLLING to operate in a pure polling mode. This is * was placed in as a debugging tool for a particluar system that wasn't diff --git a/drivers/dahdi/wctdm24xxp/base.c b/drivers/dahdi/wctdm24xxp/base.c index 07813da..10bf9fb 100644 --- a/drivers/dahdi/wctdm24xxp/base.c +++ b/drivers/dahdi/wctdm24xxp/base.c @@ -6051,13 +6051,11 @@ static DEFINE_PCI_DEVICE_TABLE(wctdm_pci_tbl) = { { 0 } }; -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 12) static void wctdm_shutdown(struct pci_dev *pdev) { struct wctdm *wc = pci_get_drvdata(pdev); voicebus_quiesce(&wc->vb); } -#endif MODULE_DEVICE_TABLE(pci, wctdm_pci_tbl); @@ -6070,9 +6068,7 @@ static struct pci_driver wctdm_driver = { .name = "wctdm24xxp", .probe = wctdm_init_one, .remove = __devexit_p(wctdm_remove_one), -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 12) .shutdown = wctdm_shutdown, -#endif .suspend = wctdm_suspend, .id_table = wctdm_pci_tbl, }; diff --git a/drivers/dahdi/wcte12xp/base.c b/drivers/dahdi/wcte12xp/base.c index e7f3dca..a2f341f 100644 --- a/drivers/dahdi/wcte12xp/base.c +++ b/drivers/dahdi/wcte12xp/base.c @@ -2697,13 +2697,7 @@ static int __devinit te12xp_init_one(struct pci_dev *pdev, const struct pci_devi spin_lock_init(&wc->reglock); INIT_LIST_HEAD(&wc->active_cmds); INIT_LIST_HEAD(&wc->pending_cmds); -# if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 18) - wc->timer.function = te12xp_timer; - wc->timer.data = (unsigned long)wc; - init_timer(&wc->timer); -# else setup_timer(&wc->timer, te12xp_timer, (unsigned long)wc); -# endif # if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 20) INIT_WORK(&wc->timer_work, timer_work_func, wc); @@ -2876,13 +2870,11 @@ static DEFINE_PCI_DEVICE_TABLE(te12xp_pci_tbl) = { { 0 } }; -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 12) static void te12xp_shutdown(struct pci_dev *pdev) { struct t1 *wc = pci_get_drvdata(pdev); voicebus_quiesce(&wc->vb); } -#endif static int te12xp_suspend(struct pci_dev *pdev, pm_message_t state) { @@ -2895,9 +2887,7 @@ static struct pci_driver te12xp_driver = { .name = "wcte12xp", .probe = te12xp_init_one, .remove = __devexit_p(te12xp_remove_one), -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 12) .shutdown = te12xp_shutdown, -#endif .suspend = te12xp_suspend, .id_table = te12xp_pci_tbl, }; diff --git a/drivers/dahdi/xpp/card_bri.c b/drivers/dahdi/xpp/card_bri.c index 9dd9135..c7d4ff1 100644 --- a/drivers/dahdi/xpp/card_bri.c +++ b/drivers/dahdi/xpp/card_bri.c @@ -1743,9 +1743,7 @@ static struct xpd_driver bri_driver = { .type = XPD_TYPE_BRI, .driver = { .name = "bri", -#ifndef OLD_HOTPLUG_SUPPORT .owner = THIS_MODULE, -#endif .probe = bri_xpd_probe, .remove = bri_xpd_remove} }; diff --git a/drivers/dahdi/xpp/card_echo.c b/drivers/dahdi/xpp/card_echo.c index 3155656..91cb84e 100644 --- a/drivers/dahdi/xpp/card_echo.c +++ b/drivers/dahdi/xpp/card_echo.c @@ -329,9 +329,7 @@ static struct xpd_driver echo_driver = { .type = XPD_TYPE_ECHO, .driver = { .name = "echo", -#ifndef OLD_HOTPLUG_SUPPORT .owner = THIS_MODULE, -#endif .probe = echo_xpd_probe, .remove = echo_xpd_remove} }; diff --git a/drivers/dahdi/xpp/card_fxo.c b/drivers/dahdi/xpp/card_fxo.c index 9634829..5e83761 100644 --- a/drivers/dahdi/xpp/card_fxo.c +++ b/drivers/dahdi/xpp/card_fxo.c @@ -1481,9 +1481,7 @@ static struct xpd_driver fxo_driver = { .type = XPD_TYPE_FXO, .driver = { .name = "fxo", -#ifndef OLD_HOTPLUG_SUPPORT .owner = THIS_MODULE, -#endif .probe = fxo_xpd_probe, .remove = fxo_xpd_remove} }; diff --git a/drivers/dahdi/xpp/card_fxs.c b/drivers/dahdi/xpp/card_fxs.c index 98b0ec1..c9be904 100644 --- a/drivers/dahdi/xpp/card_fxs.c +++ b/drivers/dahdi/xpp/card_fxs.c @@ -1809,9 +1809,7 @@ static struct xpd_driver fxs_driver = { .type = XPD_TYPE_FXS, .driver = { .name = "fxs", -#ifndef OLD_HOTPLUG_SUPPORT .owner = THIS_MODULE, -#endif .probe = fxs_xpd_probe, .remove = fxs_xpd_remove} }; diff --git a/drivers/dahdi/xpp/card_pri.c b/drivers/dahdi/xpp/card_pri.c index 1aaedd5..8e37da9 100644 --- a/drivers/dahdi/xpp/card_pri.c +++ b/drivers/dahdi/xpp/card_pri.c @@ -2653,9 +2653,7 @@ static struct xpd_driver pri_driver = { .type = XPD_TYPE_PRI, .driver = { .name = "pri", -#ifndef OLD_HOTPLUG_SUPPORT .owner = THIS_MODULE, -#endif .probe = pri_xpd_probe, .remove = pri_xpd_remove} }; diff --git a/drivers/dahdi/xpp/dahdi_debug.c b/drivers/dahdi/xpp/dahdi_debug.c index 1fe4e65..ce93b16 100644 --- a/drivers/dahdi/xpp/dahdi_debug.c +++ b/drivers/dahdi/xpp/dahdi_debug.c @@ -20,11 +20,6 @@ * */ #include - -#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 0) -#warning "This module is tested only with 2.6 kernels" -#endif - #include #include #include diff --git a/drivers/dahdi/xpp/parport_debug.c b/drivers/dahdi/xpp/parport_debug.c index bfb8ef3..6665992 100644 --- a/drivers/dahdi/xpp/parport_debug.c +++ b/drivers/dahdi/xpp/parport_debug.c @@ -20,11 +20,6 @@ * */ #include - -#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 0) -#warning "This module is tested only with 2.6 kernels" -#endif - #include #include #include diff --git a/drivers/dahdi/xpp/xbus-core.c b/drivers/dahdi/xpp/xbus-core.c index cd6effb..bab64e5 100644 --- a/drivers/dahdi/xpp/xbus-core.c +++ b/drivers/dahdi/xpp/xbus-core.c @@ -20,11 +20,6 @@ * */ #include - -#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 0) -#warning "This module is tested only with 2.6 kernels" -#endif - #include #include #include diff --git a/drivers/dahdi/xpp/xbus-core.h b/drivers/dahdi/xpp/xbus-core.h index 9bafb82..fbc0f94 100644 --- a/drivers/dahdi/xpp/xbus-core.h +++ b/drivers/dahdi/xpp/xbus-core.h @@ -354,19 +354,6 @@ void xbus_sysfs_transport_remove(xbus_t *xbus); int xbus_sysfs_create(xbus_t *xbus); void xbus_sysfs_remove(xbus_t *xbus); -#ifdef OLD_HOTPLUG_SUPPORT_269 -/* Copy from new kernels lib/kobject_uevent.c */ -enum kobject_action { - KOBJ_ADD, - KOBJ_REMOVE, - KOBJ_CHANGE, - KOBJ_MOUNT, - KOBJ_UMOUNT, - KOBJ_OFFLINE, - KOBJ_ONLINE, -}; -#endif - void astribank_uevent_send(xbus_t *xbus, enum kobject_action act); #endif /* XBUS_CORE_H */ diff --git a/drivers/dahdi/xpp/xbus-pcm.c b/drivers/dahdi/xpp/xbus-pcm.c index 15ea9d2..32f04fa 100644 --- a/drivers/dahdi/xpp/xbus-pcm.c +++ b/drivers/dahdi/xpp/xbus-pcm.c @@ -20,11 +20,6 @@ * */ #include - -#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 0) -#warning "This module is tested only with 2.6 kernels" -#endif - #include #include #include "xbus-pcm.h" diff --git a/drivers/dahdi/xpp/xbus-sysfs.c b/drivers/dahdi/xpp/xbus-sysfs.c index 936c6f7..ad58e15 100644 --- a/drivers/dahdi/xpp/xbus-sysfs.c +++ b/drivers/dahdi/xpp/xbus-sysfs.c @@ -20,11 +20,6 @@ * */ #include - -#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 0) -#warning "This module is tested only with 2.6 kernels" -#endif - #include #include #include @@ -286,7 +281,6 @@ static DEVICE_ATTR_READER(driftinfo_show, dev, buf) return len; } -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 14) #define xbus_attr(field, format_string) \ static ssize_t \ field##_show(struct device *dev, struct device_attribute *attr, char *buf) \ @@ -295,16 +289,6 @@ field##_show(struct device *dev, struct device_attribute *attr, char *buf) \ xbus = dev_to_xbus(dev); \ return sprintf(buf, format_string, xbus->field); \ } -#else -#define xbus_attr(field, format_string) \ -static ssize_t \ -field##_show(struct device *dev, char *buf) \ -{ \ - xbus_t *xbus; \ - xbus = dev_to_xbus(dev); \ - return sprintf(buf, format_string, xbus->field); \ -} -#endif xbus_attr(connector, "%s\n"); xbus_attr(label, "%s\n"); @@ -333,23 +317,6 @@ static int astribank_match(struct device *dev, struct device_driver *driver) return 1; } -#ifdef OLD_HOTPLUG_SUPPORT -static int astribank_hotplug(struct device *dev, char **envp, int envnum, - char *buff, int bufsize) -{ - xbus_t *xbus; - - if (!dev) - return -ENODEV; - xbus = dev_to_xbus(dev); - envp[0] = buff; - if (snprintf(buff, bufsize, "XBUS_NAME=%s", xbus->busname) >= bufsize) - return -ENOMEM; - envp[1] = NULL; - return 0; -} -#else - #define XBUS_VAR_BLOCK \ do { \ XBUS_ADD_UEVENT_VAR("XPP_INIT_DIR=%s", initdir); \ @@ -407,8 +374,6 @@ static int astribank_uevent(struct device *dev, struct kobj_uevent_env *kenv) #endif -#endif /* OLD_HOTPLUG_SUPPORT */ - void astribank_uevent_send(xbus_t *xbus, enum kobject_action act) { struct kobject *kobj; @@ -416,26 +381,7 @@ void astribank_uevent_send(xbus_t *xbus, enum kobject_action act) kobj = &xbus->astribank.kobj; XBUS_DBG(DEVICES, xbus, "SYFS bus_id=%s action=%d\n", dev_name(&xbus->astribank), act); - -#if defined(OLD_HOTPLUG_SUPPORT_269) - { - /* Copy from new kernels lib/kobject_uevent.c */ - static const char *str[] = { - [KOBJ_ADD] "add", - [KOBJ_REMOVE] "remove", - [KOBJ_CHANGE] "change", - [KOBJ_MOUNT] "mount", - [KOBJ_UMOUNT] "umount", - [KOBJ_OFFLINE] "offline", - [KOBJ_ONLINE] "online" - }; - kobject_hotplug(str[act], kobj); - } -#elif defined(OLD_HOTPLUG_SUPPORT) - kobject_hotplug(kobj, act); -#else kobject_uevent(kobj, act); -#endif } static void astribank_release(struct device *dev) @@ -461,11 +407,7 @@ static void astribank_release(struct device *dev) static struct bus_type toplevel_bus_type = { .name = "astribanks", .match = astribank_match, -#ifdef OLD_HOTPLUG_SUPPORT - .hotplug = astribank_hotplug, -#else .uevent = astribank_uevent, -#endif .dev_attrs = xbus_dev_attrs, .drv_attrs = xpp_attrs, }; @@ -493,9 +435,7 @@ static struct device_driver xpp_driver = { .bus = &toplevel_bus_type, .probe = astribank_probe, .remove = astribank_remove, -#ifndef OLD_HOTPLUG_SUPPORT .owner = THIS_MODULE -#endif }; /*--------- Sysfs XPD handling ----*/ diff --git a/drivers/dahdi/xpp/xdefs.h b/drivers/dahdi/xpp/xdefs.h index 8da10ea..054c30c 100644 --- a/drivers/dahdi/xpp/xdefs.h +++ b/drivers/dahdi/xpp/xdefs.h @@ -118,16 +118,6 @@ typedef char *charp; kfree(p); \ } while (0); -/* - * Hotplug replaced with uevent in 2.6.16 - */ -#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 16) -#define OLD_HOTPLUG_SUPPORT // for older kernels -#endif -#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 10) -#define OLD_HOTPLUG_SUPPORT_269 // for way older kernels -#endif - #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 14) #define DEVICE_ATTR_READER(name, dev, buf) \ ssize_t name(struct device *dev, \ diff --git a/drivers/dahdi/xpp/xpd.h b/drivers/dahdi/xpp/xpd.h index f5e6771..f341e18 100644 --- a/drivers/dahdi/xpp/xpd.h +++ b/drivers/dahdi/xpp/xpd.h @@ -42,13 +42,6 @@ #include #ifdef __KERNEL__ -#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 14) -/* also added in RHEL kernels with the OpenInfiniband backport: */ -#if LINUX_VERSION_CODE != KERNEL_VERSION(2, 6, 9) || !defined(DEFINE_SPINLOCK) -typedef unsigned gfp_t; /* Added in 2.6.14 */ -#endif -#endif - /* * FIXME: Kludge for 2.6.19 * bool is now defined as a proper boolean type (gcc _Bool) @@ -64,23 +57,11 @@ typedef unsigned gfp_t; /* Added in 2.6.14 */ module_param(name, type, perm); \ MODULE_PARM_DESC(name, desc " [default " #init "]") -#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 10) -/* - * Old 2.6 kernels had module_param_array() macro that receive the counter - * by value. - */ -#define DEF_ARRAY(type, name, count, init, desc) \ - unsigned int name ## _num_values; \ - type name[count] = { [0 ... ((count)-1)] = (init) }; \ - module_param_array(name, type, name ## _num_values, 0644); \ - MODULE_PARM_DESC(name, desc " ( 1-" __MODULE_STRING(count) ")") -#else #define DEF_ARRAY(type, name, count, init, desc) \ unsigned int name ## _num_values; \ type name[count] = {[0 ... ((count)-1)] = init}; \ module_param_array(name, type, &name ## _num_values, 0644); \ MODULE_PARM_DESC(name, desc " ( 1-" __MODULE_STRING(count) ")") -#endif #endif // __KERNEL__ #define CARD_DESC_MAGIC 0xca9dde5c diff --git a/drivers/dahdi/xpp/xpp_dahdi.c b/drivers/dahdi/xpp/xpp_dahdi.c index 7a0ab90..d2a5503 100644 --- a/drivers/dahdi/xpp/xpp_dahdi.c +++ b/drivers/dahdi/xpp/xpp_dahdi.c @@ -25,11 +25,6 @@ * */ #include - -#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 0) -#warning "This module is tested only with 2.6 kernels" -#endif - #include #include #include @@ -79,11 +74,7 @@ static void phonedev_cleanup(xpd_t *xpd); static int parport_xbuses[2] = { 0, 1 }; unsigned int parport_xbuses_num_values; -#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 9) module_param_array(parport_xbuses, int, &parport_xbuses_num_values, 0577); -#else -module_param_array(parport_xbuses, int, parport_xbuses_num_values, 0577); -#endif MODULE_PARM_DESC(parport_xbuses, "Id's of xbuses to sample (1-2)"); /* diff --git a/drivers/dahdi/xpp/xpp_usb.c b/drivers/dahdi/xpp/xpp_usb.c index af83b52..8a55963 100644 --- a/drivers/dahdi/xpp/xpp_usb.c +++ b/drivers/dahdi/xpp/xpp_usb.c @@ -68,11 +68,6 @@ static DEF_PARM(uint, drop_pcm_after, 6, 0644, #define XUSB_INFO(xusb, fmt, ...) \ XUSB_PRINTK(INFO, xusb, fmt, ## __VA_ARGS__) -/* FIXME: A flag that was deprecated at some point, and rather useless */ -/* anyway. Only used in the code or-ed to other flags */ -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 14) -#define URB_ASYNC_UNLINK 0 -#endif /* Get a minor range for your devices from the usb maintainer */ #define USB_SKEL_MINOR_BASE 192 @@ -80,10 +75,6 @@ static DEF_PARM(uint, drop_pcm_after, 6, 0644, #define PROC_USBXPP_SUMMARY "xpp_usb" #endif -#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 0) -#warning "This module is tested only with 2.6 kernels" -#endif - #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 34) #define usb_alloc_coherent(dev, size, mem_flags, dma) \ usb_buffer_alloc(dev, size, mem_flags, dma) @@ -91,32 +82,6 @@ static DEF_PARM(uint, drop_pcm_after, 6, 0644, usb_buffer_free(dev, size, addr, dma) #endif -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 12) -#undef USB_FIELDS_MISSING -#else -#define USB_FIELDS_MISSING - -#define USB_MAX_STRING 128 -#define USB_GET_STRING(udev, field, buf) \ - do { \ - if ((udev)->descriptor.field) { \ - char tmp[USB_MAX_STRING]; \ - if (usb_string((udev), (udev)->descriptor.field, \ - tmp, sizeof(tmp)) > 0) \ - snprintf((buf), USB_MAX_STRING, "%s", tmp); \ - } \ - } while (0); -#define USB_GET_IFACE_NAME(udev, iface, buf) \ - do { \ - if ((iface)->desc.iInterface) { \ - char tmp[USB_MAX_STRING]; \ - if (usb_string((udev), (iface)->desc.iInterface, \ - tmp, sizeof(tmp)) > 0) \ - snprintf((buf), USB_MAX_STRING, "%s", tmp); \ - } \ - } while (0); -#endif - #ifdef DEBUG_PCM_TIMING static cycles_t stamp_last_pcm_read; static cycles_t accumulate_diff; @@ -233,18 +198,10 @@ struct xusb { atomic_t pcm_tx_drops; atomic_t usb_sluggish_count; -#ifdef USB_FIELDS_MISSING - /* storage for missing strings in old kernels */ - char manufacturer[USB_MAX_STRING]; - char product[USB_MAX_STRING]; - char serial[USB_MAX_STRING]; - char interface_name[USB_MAX_STRING]; -#else const char *manufacturer; const char *product; const char *serial; const char *interface_name; -#endif }; @@ -299,7 +256,7 @@ static void uframe_recompute(struct uframe *uframe, enum xusb_dir dir) BUG_ON(uframe->uframe_magic != UFRAME_MAGIC); usb_fill_bulk_urb(urb, udev, pipe, uframe->transfer_buffer, uframe->transfer_buffer_length, urb_cb, uframe); - urb->transfer_flags = (URB_NO_TRANSFER_DMA_MAP | URB_ASYNC_UNLINK); + urb->transfer_flags = (URB_NO_TRANSFER_DMA_MAP); } static xframe_t *alloc_xframe(xbus_t *xbus, gfp_t gfp_flags) @@ -537,9 +494,6 @@ MODULE_DEVICE_TABLE(usb, xusb_table); * with the usb subsystem */ static struct usb_driver xusb_driver = { -#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 16) - .owner = THIS_MODULE, -#endif .name = "xpp_usb", .probe = xusb_probe, .disconnect = xusb_disconnect, @@ -575,10 +529,6 @@ static const struct file_operations xusb_fops = { static struct usb_class_driver xusb_class = { .name = "usb/xpp_usb%d", .fops = &xusb_fops, -/* FIXME: The sysfs class interfase seems to have chaged around here */ -#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 15) - .mode = S_IFCHR | S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH, -#endif .minor_base = USB_SKEL_MINOR_BASE, }; @@ -674,18 +624,6 @@ static int set_endpoints(xusb_t *xusb, struct usb_host_interface *iface_desc, return 1; } -/* - * The USB stack before 2.6.10 seems to be a bit shoddy. It seems that when - * being called from the probe we may already have the lock to - * udev (the Usb DEVice). - * Thus we call the internal __usb_reset_device instead. - */ -#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 10) -#define DO_USB_RESET_DEVICE(dev) __usb_reset_device(dev) -#else -#define DO_USB_RESET_DEVICE(dev) usb_reset_device(dev) -#endif - /** * xusb_probe * @@ -715,7 +653,7 @@ static int xusb_probe(struct usb_interface *interface, iface_desc->desc.bInterfaceNumber, model_info->iface_num); return -ENODEV; } - if ((retval = DO_USB_RESET_DEVICE(udev)) < 0) { + if ((retval = usb_reset_device(udev)) < 0) { ERR("usb_reset_device failed: %d\n", retval); goto probe_failed; } @@ -746,17 +684,10 @@ static int xusb_probe(struct usb_interface *interface, retval = -ENODEV; goto probe_failed; } -#ifndef USB_FIELDS_MISSING xusb->serial = udev->serial; xusb->manufacturer = udev->manufacturer; xusb->product = udev->product; xusb->interface_name = iface_desc->string; -#else - USB_GET_STRING(udev, iSerialNumber, xusb->serial); - USB_GET_STRING(udev, iManufacturer, xusb->manufacturer); - USB_GET_STRING(udev, iProduct, xusb->product); - USB_GET_IFACE_NAME(udev, iface_desc, xusb->interface_name); -#endif INFO("XUSB: %s -- %s -- %s\n", xusb->manufacturer, xusb->product, xusb->interface_name); diff --git a/include/dahdi/dahdi_config.h b/include/dahdi/dahdi_config.h index 56902e1..0957689 100644 --- a/include/dahdi/dahdi_config.h +++ b/include/dahdi/dahdi_config.h @@ -21,9 +21,6 @@ #ifdef __KERNEL__ #include -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,18) -#include -#endif #endif /* DAHDI compile time options */ @@ -76,10 +73,8 @@ /* You can still override them below */ #if defined(CONFIG_HDLC) || defined(CONFIG_HDLC_MODULE) #define DAHDI_HDLC_TYPE_TRANS -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,3) #define HDLC_MAINTAINERS_ARE_MORE_STUPID_THAN_I_THOUGHT #endif -#endif /* * Uncomment CONFIG_DAHDI_NET to enable SyncPPP, CiscoHDLC, and Frame Relay diff --git a/include/dahdi/kernel.h b/include/dahdi/kernel.h index 882d31e..ec7f90b 100644 --- a/include/dahdi/kernel.h +++ b/include/dahdi/kernel.h @@ -38,9 +38,6 @@ #include #include -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,18) -#include -#endif #include #include #include @@ -60,11 +57,7 @@ #include -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,10) #define dahdi_pci_module pci_register_driver -#else -#define dahdi_pci_module pci_module_init -#endif #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,19) #define DAHDI_IRQ_HANDLER(a) static irqreturn_t a(int irq, void *dev_id) @@ -76,22 +69,9 @@ #define HAVE_NET_DEVICE_OPS #endif -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,18) #define DAHDI_IRQ_SHARED IRQF_SHARED #define DAHDI_IRQ_DISABLED IRQF_DISABLED #define DAHDI_IRQ_SHARED_DISABLED IRQF_SHARED | IRQF_DISABLED -#else -#define DAHDI_IRQ_SHARED SA_SHIRQ -#define DAHDI_IRQ_DISABLED SA_INTERRUPT -#define DAHDI_IRQ_SHARED_DISABLED SA_SHIRQ | SA_INTERRUPT -#endif - -#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,16) -#ifndef dev_notice -#define dev_notice(dev, format, arg...) \ - dev_printk(KERN_NOTICE , dev , format , ## arg) -#endif -#endif #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,26) # ifdef RHEL_RELEASE_VERSION @@ -1409,60 +1389,6 @@ static inline int strcasecmp(const char *s1, const char *s2) return c1 - c2; } #endif /* clamp_val */ -#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 18) -static inline void list_replace(struct list_head *old, struct list_head *new) -{ - new->next = old->next; - new->next->prev = new; - new->prev = old->prev; - new->prev->next = new; -} - -#ifndef WARN_ON_ONCE -#define WARN_ON_ONCE(__condition) do { \ - static int __once = 1; \ - if (unlikely(__condition)) { \ - if (__once) { \ - __once = 0; \ - WARN_ON(0); \ - } \ - } \ -} while (0) -#endif - -#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 17) -#ifndef POLLRDHUP -#define POLLRDHUP 0 -#endif - -#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 14) -#define kzalloc(a, b) kcalloc(1, a, b) -#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 12) -#define synchronize_rcu() synchronize_kernel() -#define kasprintf dahdi_kasprintf -char *dahdi_kasprintf(gfp_t gfp, const char *fmt, ...); -#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 11) -#if !defined(HAVE_WAIT_FOR_COMPLETION_TIMEOUT) -static inline unsigned long -wait_for_completion_interruptible_timeout(struct completion *x, - unsigned long timeout) -{ - /* There is a race condition here. If x->done is reset to 0 - * before the call to wait_for_completion after this thread wakes. - */ - timeout = wait_event_interruptible_timeout(x->wait, x->done, timeout); - if (timeout) - wait_for_completion(x); - - return timeout; -} -#endif -typedef u32 __bitwise pm_message_t; -#endif /* 2.6.11 */ -#endif /* 2.6.12 */ -#endif /* 2.6.14 */ -#endif /* 2.6.17 */ -#endif /* 2.6.18 */ #endif /* 2.6.22 */ #endif /* 2.6.25 */ #endif /* 2.6.26 */ -- cgit v1.2.3