aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@suse.de>2008-11-18 14:59:49 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2009-01-06 16:52:21 -0500
commit4398ecfac1cfe26ee63d0d4151cf9c3fa89e81d1 (patch)
treef773f24f241e18eea7468e2ab448806e5184f7a1
parentb1853a4f28db5b532542426965198171ef8ab6a0 (diff)
Staging: comedi: usbdux: remove kernel version checks
Now that we are in the kernel tree, these ifdefs are not needed. Cc: Bernd Porr <BerndPorr@f2s.com> Cc: David Schleef <ds@schleef.org> Cc: Frank Mori Hess <fmhess@users.sourceforge.net> Cc: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r--drivers/staging/comedi/drivers/usbdux.c83
1 files changed, 3 insertions, 80 deletions
diff --git a/drivers/staging/comedi/drivers/usbdux.c b/drivers/staging/comedi/drivers/usbdux.c
index 33205530b0d3..331dc59c8ff5 100644
--- a/drivers/staging/comedi/drivers/usbdux.c
+++ b/drivers/staging/comedi/drivers/usbdux.c
@@ -251,10 +251,8 @@ typedef struct {
251 int16_t *outBuffer; 251 int16_t *outBuffer;
252 // interface number 252 // interface number
253 int ifnum; 253 int ifnum;
254#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
255 // interface structure in 2.6 254 // interface structure in 2.6
256 struct usb_interface *interface; 255 struct usb_interface *interface;
257#endif
258 // comedi device for the interrupt context 256 // comedi device for the interrupt context
259 comedi_device *comedidev; 257 comedi_device *comedidev;
260 // is it USB_SPEED_HIGH or not? 258 // is it USB_SPEED_HIGH or not?
@@ -301,24 +299,14 @@ static DECLARE_MUTEX(start_stop_sem);
301static int usbduxsub_unlink_InURBs(usbduxsub_t * usbduxsub_tmp) 299static int usbduxsub_unlink_InURBs(usbduxsub_t * usbduxsub_tmp)
302{ 300{
303 int i = 0; 301 int i = 0;
304#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,8)
305 int j = 0;
306#endif
307 int err = 0; 302 int err = 0;
308 303
309 if (usbduxsub_tmp && usbduxsub_tmp->urbIn) { 304 if (usbduxsub_tmp && usbduxsub_tmp->urbIn) {
310 for (i = 0; i < usbduxsub_tmp->numOfInBuffers; i++) { 305 for (i = 0; i < usbduxsub_tmp->numOfInBuffers; i++) {
311 if (usbduxsub_tmp->urbIn[i]) { 306 if (usbduxsub_tmp->urbIn[i]) {
312#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,8)
313 j = usb_unlink_urb(usbduxsub_tmp->urbIn[i]);
314 if (j < 0) {
315 err = j;
316 }
317#else
318 // We wait here until all transfers 307 // We wait here until all transfers
319 // have been cancelled. 308 // have been cancelled.
320 usb_kill_urb(usbduxsub_tmp->urbIn[i]); 309 usb_kill_urb(usbduxsub_tmp->urbIn[i]);
321#endif
322 } 310 }
323#ifdef NOISY_DUX_DEBUGBUG 311#ifdef NOISY_DUX_DEBUGBUG
324 printk("comedi: usbdux: unlinked InURB %d, err=%d\n", 312 printk("comedi: usbdux: unlinked InURB %d, err=%d\n",
@@ -385,11 +373,7 @@ static int usbdux_ai_cancel(comedi_device * dev, comedi_subdevice * s)
385 373
386// analogue IN 374// analogue IN
387// interrupt service routine 375// interrupt service routine
388#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)
389static void usbduxsub_ai_IsocIrq(struct urb *urb) 376static void usbduxsub_ai_IsocIrq(struct urb *urb)
390#else
391static void usbduxsub_ai_IsocIrq(struct urb *urb PT_REGS_ARG)
392#endif
393{ 377{
394 int i, err, n; 378 int i, err, n;
395 usbduxsub_t *this_usbduxsub; 379 usbduxsub_t *this_usbduxsub;
@@ -537,23 +521,13 @@ static void usbduxsub_ai_IsocIrq(struct urb *urb PT_REGS_ARG)
537static int usbduxsub_unlink_OutURBs(usbduxsub_t * usbduxsub_tmp) 521static int usbduxsub_unlink_OutURBs(usbduxsub_t * usbduxsub_tmp)
538{ 522{
539 int i = 0; 523 int i = 0;
540#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,8)
541 int j = 0;
542#endif
543 524
544 int err = 0; 525 int err = 0;
545 526
546 if (usbduxsub_tmp && usbduxsub_tmp->urbOut) { 527 if (usbduxsub_tmp && usbduxsub_tmp->urbOut) {
547 for (i = 0; i < usbduxsub_tmp->numOfOutBuffers; i++) { 528 for (i = 0; i < usbduxsub_tmp->numOfOutBuffers; i++) {
548 if (usbduxsub_tmp->urbOut[i]) { 529 if (usbduxsub_tmp->urbOut[i]) {
549#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,8)
550 j = usb_unlink_urb(usbduxsub_tmp->urbOut[i]);
551 if (j < err) {
552 err = j;
553 }
554#else
555 usb_kill_urb(usbduxsub_tmp->urbOut[i]); 530 usb_kill_urb(usbduxsub_tmp->urbOut[i]);
556#endif
557 } 531 }
558#ifdef NOISY_DUX_DEBUGBUG 532#ifdef NOISY_DUX_DEBUGBUG
559 printk("comedi: usbdux: unlinked OutURB %d: res=%d\n", 533 printk("comedi: usbdux: unlinked OutURB %d: res=%d\n",
@@ -612,13 +586,8 @@ static int usbdux_ao_cancel(comedi_device * dev, comedi_subdevice * s)
612 return res; 586 return res;
613} 587}
614 588
615#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)
616static void usbduxsub_ao_IsocIrq(struct urb *urb) 589static void usbduxsub_ao_IsocIrq(struct urb *urb)
617{ 590{
618#else
619static void usbduxsub_ao_IsocIrq(struct urb *urb PT_REGS_ARG)
620{
621#endif
622 int i, ret; 591 int i, ret;
623 int8_t *datap; 592 int8_t *datap;
624 usbduxsub_t *this_usbduxsub; 593 usbduxsub_t *this_usbduxsub;
@@ -1851,23 +1820,11 @@ static int usbdux_counter_config(comedi_device * dev, comedi_subdevice * s,
1851 1820
1852static int usbduxsub_unlink_PwmURBs(usbduxsub_t * usbduxsub_tmp) 1821static int usbduxsub_unlink_PwmURBs(usbduxsub_t * usbduxsub_tmp)
1853{ 1822{
1854#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,8)
1855 int j = 0;
1856#endif
1857
1858 int err = 0; 1823 int err = 0;
1859 1824
1860 if (usbduxsub_tmp && usbduxsub_tmp->urbPwm) { 1825 if (usbduxsub_tmp && usbduxsub_tmp->urbPwm) {
1861 if (usbduxsub_tmp->urbPwm) { 1826 if (usbduxsub_tmp->urbPwm)
1862#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,8)
1863 j = usb_unlink_urb(usbduxsub_tmp->urbPwm);
1864 if (j < err) {
1865 err = j;
1866 }
1867#else
1868 usb_kill_urb(usbduxsub_tmp->urbPwm); 1827 usb_kill_urb(usbduxsub_tmp->urbPwm);
1869#endif
1870 }
1871#ifdef NOISY_DUX_DEBUGBUG 1828#ifdef NOISY_DUX_DEBUGBUG
1872 printk("comedi: usbdux: unlinked PwmURB: res=%d\n", err); 1829 printk("comedi: usbdux: unlinked PwmURB: res=%d\n", err);
1873#endif 1830#endif
@@ -1921,13 +1878,8 @@ static int usbdux_pwm_cancel(comedi_device * dev, comedi_subdevice * s)
1921 return res; 1878 return res;
1922} 1879}
1923 1880
1924#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) || LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,19)
1925static void usbduxsub_pwm_irq(struct urb *urb) 1881static void usbduxsub_pwm_irq(struct urb *urb)
1926{ 1882{
1927#else
1928static void usbduxsub_pwm_irq(struct urb *urb, struct pt_regs *regs)
1929{
1930#endif
1931 int ret; 1883 int ret;
1932 usbduxsub_t *this_usbduxsub; 1884 usbduxsub_t *this_usbduxsub;
1933 comedi_device *this_comedidev; 1885 comedi_device *this_comedidev;
@@ -2224,12 +2176,9 @@ static void tidy_up(usbduxsub_t * usbduxsub_tmp)
2224 if (!usbduxsub_tmp) { 2176 if (!usbduxsub_tmp) {
2225 return; 2177 return;
2226 } 2178 }
2227#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
2228 // shows the usb subsystem that the driver is down 2179 // shows the usb subsystem that the driver is down
2229 if (usbduxsub_tmp->interface) { 2180 if (usbduxsub_tmp->interface)
2230 usb_set_intfdata(usbduxsub_tmp->interface, NULL); 2181 usb_set_intfdata(usbduxsub_tmp->interface, NULL);
2231 }
2232#endif
2233 2182
2234 usbduxsub_tmp->probed = 0; 2183 usbduxsub_tmp->probed = 0;
2235 2184
@@ -2244,9 +2193,7 @@ static void tidy_up(usbduxsub_t * usbduxsub_tmp)
2244 usbduxsub_tmp->urbIn[i]->transfer_buffer = NULL; 2193 usbduxsub_tmp->urbIn[i]->transfer_buffer = NULL;
2245 } 2194 }
2246 if (usbduxsub_tmp->urbIn[i]) { 2195 if (usbduxsub_tmp->urbIn[i]) {
2247#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,8)
2248 usb_kill_urb(usbduxsub_tmp->urbIn[i]); 2196 usb_kill_urb(usbduxsub_tmp->urbIn[i]);
2249#endif
2250 usb_free_urb(usbduxsub_tmp->urbIn[i]); 2197 usb_free_urb(usbduxsub_tmp->urbIn[i]);
2251 usbduxsub_tmp->urbIn[i] = NULL; 2198 usbduxsub_tmp->urbIn[i] = NULL;
2252 } 2199 }
@@ -2267,9 +2214,7 @@ static void tidy_up(usbduxsub_t * usbduxsub_tmp)
2267 NULL; 2214 NULL;
2268 } 2215 }
2269 if (usbduxsub_tmp->urbOut[i]) { 2216 if (usbduxsub_tmp->urbOut[i]) {
2270#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,8)
2271 usb_kill_urb(usbduxsub_tmp->urbOut[i]); 2217 usb_kill_urb(usbduxsub_tmp->urbOut[i]);
2272#endif
2273 usb_free_urb(usbduxsub_tmp->urbOut[i]); 2218 usb_free_urb(usbduxsub_tmp->urbOut[i]);
2274 usbduxsub_tmp->urbOut[i] = NULL; 2219 usbduxsub_tmp->urbOut[i] = NULL;
2275 } 2220 }
@@ -2286,9 +2231,7 @@ static void tidy_up(usbduxsub_t * usbduxsub_tmp)
2286 kfree(usbduxsub_tmp->urbPwm->transfer_buffer); 2231 kfree(usbduxsub_tmp->urbPwm->transfer_buffer);
2287 usbduxsub_tmp->urbPwm->transfer_buffer = NULL; 2232 usbduxsub_tmp->urbPwm->transfer_buffer = NULL;
2288 } 2233 }
2289#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,8)
2290 usb_kill_urb(usbduxsub_tmp->urbPwm); 2234 usb_kill_urb(usbduxsub_tmp->urbPwm);
2291#endif
2292 usb_free_urb(usbduxsub_tmp->urbPwm); 2235 usb_free_urb(usbduxsub_tmp->urbPwm);
2293 usbduxsub_tmp->urbPwm = NULL; 2236 usbduxsub_tmp->urbPwm = NULL;
2294 } 2237 }
@@ -2434,16 +2377,10 @@ static int read_firmware(usbduxsub_t * usbduxsub, void *firmwarePtr, long size)
2434} 2377}
2435 2378
2436// allocate memory for the urbs and initialise them 2379// allocate memory for the urbs and initialise them
2437#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)
2438static void *usbduxsub_probe(struct usb_device *udev,
2439 unsigned int interfnum, const struct usb_device_id *id)
2440{
2441#else
2442static int usbduxsub_probe(struct usb_interface *uinterf, 2380static int usbduxsub_probe(struct usb_interface *uinterf,
2443 const struct usb_device_id *id) 2381 const struct usb_device_id *id)
2444{ 2382{
2445 struct usb_device *udev = interface_to_usbdev(uinterf); 2383 struct usb_device *udev = interface_to_usbdev(uinterf);
2446#endif
2447 int i; 2384 int i;
2448 int index; 2385 int index;
2449 2386
@@ -2474,10 +2411,6 @@ static int usbduxsub_probe(struct usb_interface *uinterf,
2474 // save a pointer to the usb device 2411 // save a pointer to the usb device
2475 usbduxsub[index].usbdev = udev; 2412 usbduxsub[index].usbdev = udev;
2476 2413
2477#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)
2478 // save the interface number
2479 usbduxsub[index].ifnum = interfnum;
2480#else
2481 // 2.6: save the interface itself 2414 // 2.6: save the interface itself
2482 usbduxsub[index].interface = uinterf; 2415 usbduxsub[index].interface = uinterf;
2483 // get the interface number from the interface 2416 // get the interface number from the interface
@@ -2485,7 +2418,6 @@ static int usbduxsub_probe(struct usb_interface *uinterf,
2485 // hand the private data over to the usb subsystem 2418 // hand the private data over to the usb subsystem
2486 // will be needed for disconnect 2419 // will be needed for disconnect
2487 usb_set_intfdata(uinterf, &(usbduxsub[index])); 2420 usb_set_intfdata(uinterf, &(usbduxsub[index]));
2488#endif
2489 2421
2490#ifdef CONFIG_COMEDI_DEBUG 2422#ifdef CONFIG_COMEDI_DEBUG
2491 printk("comedi_: usbdux: ifnum=%d\n", usbduxsub[index].ifnum); 2423 printk("comedi_: usbdux: ifnum=%d\n", usbduxsub[index].ifnum);
@@ -2678,24 +2610,15 @@ static int usbduxsub_probe(struct usb_interface *uinterf,
2678 usbduxsub[index].probed = 1; 2610 usbduxsub[index].probed = 1;
2679 up(&start_stop_sem); 2611 up(&start_stop_sem);
2680 printk("comedi_: usbdux%d has been successfully initialised.\n", index); 2612 printk("comedi_: usbdux%d has been successfully initialised.\n", index);
2681#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)
2682 return (void *)(&usbduxsub[index]);
2683#else
2684 // success 2613 // success
2685 return 0; 2614 return 0;
2686#endif
2687} 2615}
2688 2616
2689#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)
2690static void usbduxsub_disconnect(struct usb_device *udev, void *ptr)
2691{
2692 usbduxsub_t *usbduxsub_tmp = (usbduxsub_t *) ptr;
2693#else
2694static void usbduxsub_disconnect(struct usb_interface *intf) 2617static void usbduxsub_disconnect(struct usb_interface *intf)
2695{ 2618{
2696 usbduxsub_t *usbduxsub_tmp = usb_get_intfdata(intf); 2619 usbduxsub_t *usbduxsub_tmp = usb_get_intfdata(intf);
2697 struct usb_device *udev = interface_to_usbdev(intf); 2620 struct usb_device *udev = interface_to_usbdev(intf);
2698#endif 2621
2699 if (!usbduxsub_tmp) { 2622 if (!usbduxsub_tmp) {
2700 printk("comedi_: usbdux: disconnect called with null pointer.\n"); 2623 printk("comedi_: usbdux: disconnect called with null pointer.\n");
2701 return; 2624 return;