|
@@ -31,10 +31,6 @@
|
|
|
#include <net/iw_handler.h>
|
|
|
#endif
|
|
|
|
|
|
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
|
|
|
-#define URB_ZERO_PACKET USB_ZERO_PACKET
|
|
|
-#endif
|
|
|
-
|
|
|
extern void zfiRecv80211(zdev_t* dev, zbuf_t* buf, struct zsAdditionInfo* addInfo);
|
|
|
extern void zfCoreRecv(zdev_t* dev, zbuf_t* buf, struct zsAdditionInfo* addInfo);
|
|
|
extern void zfIdlChkRsp(zdev_t* dev, u32_t* rsp, u16_t rspLen);
|
|
@@ -310,10 +306,6 @@ void zfLnxUsbDataIn_callback(urb_t *urb)
|
|
|
if ((urb->status != -ENOENT) && (urb->status != -ECONNRESET)
|
|
|
&& (urb->status != -ESHUTDOWN))
|
|
|
{
|
|
|
- #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
|
|
|
- if (urb->status == USB_ST_INTERNALERROR)
|
|
|
- status = -1;
|
|
|
- #else
|
|
|
if (urb->status == -EPIPE){
|
|
|
//printk(KERN_ERR "nonzero read bulk status received: -EPIPE");
|
|
|
status = -1;
|
|
@@ -323,7 +315,6 @@ void zfLnxUsbDataIn_callback(urb_t *urb)
|
|
|
//printk(KERN_ERR "nonzero read bulk status received: -EPROTO");
|
|
|
status = -1;
|
|
|
}
|
|
|
- #endif
|
|
|
}
|
|
|
|
|
|
//printk(KERN_ERR "urb->status: 0x%08x\n", urb->status);
|
|
@@ -538,10 +529,6 @@ void zfLnxUsbRegIn_callback(urb_t *urb)
|
|
|
if ((urb->status != -ENOENT) && (urb->status != -ECONNRESET)
|
|
|
&& (urb->status != -ESHUTDOWN))
|
|
|
{
|
|
|
- #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
|
|
|
- if (urb->status == USB_ST_INTERNALERROR)
|
|
|
- status = -1;
|
|
|
- #else
|
|
|
if (urb->status == -EPIPE){
|
|
|
//printk(KERN_ERR "nonzero read bulk status received: -EPIPE");
|
|
|
status = -1;
|
|
@@ -551,7 +538,6 @@ void zfLnxUsbRegIn_callback(urb_t *urb)
|
|
|
//printk(KERN_ERR "nonzero read bulk status received: -EPROTO");
|
|
|
status = -1;
|
|
|
}
|
|
|
- #endif
|
|
|
}
|
|
|
|
|
|
//printk(KERN_ERR "urb->status: 0x%08x\n", urb->status);
|
|
@@ -810,15 +796,9 @@ u32_t zfLnxUsbWriteReg(zdev_t* dev, u32_t* cmd, u16_t cmdLen)
|
|
|
|
|
|
/* Issue an USB Out transfer */
|
|
|
/* Submit a tx urb */
|
|
|
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24)
|
|
|
- ret = zfLnxUsbSubmitBulkUrb(macp->RegOutUrb, macp->udev,
|
|
|
- USB_REG_OUT_PIPE, USB_DIR_OUT, macp->regUsbWriteBuf,
|
|
|
- cmdLen, zfLnxUsbRegOut_callback, dev);
|
|
|
-#else
|
|
|
ret = zfLnxUsbSubmitIntUrb(macp->RegOutUrb, macp->udev,
|
|
|
USB_REG_OUT_PIPE, USB_DIR_OUT, macp->regUsbWriteBuf,
|
|
|
cmdLen, zfLnxUsbRegOut_callback, dev, 1);
|
|
|
-#endif
|
|
|
|
|
|
return ret;
|
|
|
}
|
|
@@ -914,10 +894,6 @@ u32_t zfLnxUsbSubmitBulkUrb(urb_t *urb, struct usb_device *usb, u16_t epnum, u16
|
|
|
transfer_buffer, buffer_length, complete, context);
|
|
|
}
|
|
|
|
|
|
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,15)
|
|
|
- urb->transfer_flags |= URB_ASYNC_UNLINK;
|
|
|
-#endif
|
|
|
-
|
|
|
if (epnum == 4)
|
|
|
{
|
|
|
if (urb->hcpriv)
|
|
@@ -927,11 +903,7 @@ u32_t zfLnxUsbSubmitBulkUrb(urb_t *urb, struct usb_device *usb, u16_t epnum, u16
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
|
|
|
ret = usb_submit_urb(urb, GFP_ATOMIC);
|
|
|
-#else
|
|
|
- ret = usb_submit_urb(urb);
|
|
|
-#endif
|
|
|
if ((epnum == 4) & (ret != 0))
|
|
|
{
|
|
|
//printk("CWY - ret = %x\n", ret);
|
|
@@ -956,15 +928,7 @@ u32_t zfLnxUsbSubmitIntUrb(urb_t *urb, struct usb_device *usb, u16_t epnum, u16_
|
|
|
transfer_buffer, buffer_length, complete, context, interval);
|
|
|
}
|
|
|
|
|
|
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,15)
|
|
|
- urb->transfer_flags |= URB_ASYNC_UNLINK;
|
|
|
-#endif
|
|
|
-
|
|
|
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
|
|
|
ret = usb_submit_urb(urb, GFP_ATOMIC);
|
|
|
-#else
|
|
|
- ret = usb_submit_urb(urb);
|
|
|
-#endif
|
|
|
|
|
|
return ret;
|
|
|
}
|
|
@@ -1001,11 +965,7 @@ int zfLnxCencSendMsg(struct sock *netlink_sk, u_int8_t *msg, int len)
|
|
|
memcpy(pos, msg, len);
|
|
|
/*计算经过字节对其后的数据实际长度*/
|
|
|
nlh->nlmsg_len = skb->tail - old_tail;
|
|
|
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,14)
|
|
|
- NETLINK_CB(skb).dst_groups = COMMTYPE_GROUP;
|
|
|
-#else
|
|
|
NETLINK_CB(skb).dst_group = COMMTYPE_GROUP;
|
|
|
-#endif
|
|
|
netlink_broadcast(netlink_sk, skb, 0, COMMTYPE_GROUP, GFP_ATOMIC);
|
|
|
ret = 0;
|
|
|
out:
|
|
@@ -1043,11 +1003,7 @@ u32_t zfwReadReg(zdev_t* dev, u32_t offset)
|
|
|
#ifndef INIT_WORK
|
|
|
#define work_struct tq_struct
|
|
|
|
|
|
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0))
|
|
|
-#define schedule_work(a) queue_task(a, &tq_scheduler)
|
|
|
-#else
|
|
|
#define schedule_work(a) schedule_task(a)
|
|
|
-#endif
|
|
|
|
|
|
#define flush_scheduled_work flush_scheduled_tasks
|
|
|
#define INIT_WORK(_wq, _routine, _data) INIT_TQUEUE(_wq, _routine, _data)
|
|
@@ -1058,20 +1014,11 @@ u32_t zfwReadReg(zdev_t* dev, u32_t offset)
|
|
|
|
|
|
u32_t smp_kevent_Lock = 0;
|
|
|
|
|
|
-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,20))
|
|
|
void kevent(struct work_struct *work)
|
|
|
-#else
|
|
|
-void kevent(void *data)
|
|
|
-#endif
|
|
|
{
|
|
|
-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,20))
|
|
|
struct usbdrv_private *macp =
|
|
|
container_of(work, struct usbdrv_private, kevent);
|
|
|
zdev_t *dev = macp->device;
|
|
|
-#else
|
|
|
- zdev_t *dev = (zdev_t *) data;
|
|
|
- struct usbdrv_private *macp = dev->ml_priv;
|
|
|
-#endif
|
|
|
|
|
|
if (macp == NULL)
|
|
|
{
|
|
@@ -1120,11 +1067,7 @@ u8_t zfLnxCreateThread(zdev_t *dev)
|
|
|
struct usbdrv_private *macp = dev->ml_priv;
|
|
|
|
|
|
/* Create Mutex and keventd */
|
|
|
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20))
|
|
|
- INIT_WORK(&macp->kevent, kevent, dev);
|
|
|
-#else
|
|
|
INIT_WORK(&macp->kevent, kevent);
|
|
|
-#endif
|
|
|
init_MUTEX(&macp->ioctl_sem);
|
|
|
|
|
|
return 0;
|