Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f4f85ff7 authored by Alexander Beregalov's avatar Alexander Beregalov Committed by Greg Kroah-Hartman
Browse files

Staging: otus: remove dependence on kernel version



Dependence on kernel version is not needed anymore
if we are in mainline now.

Signed-off-by: default avatarAlexander Beregalov <a.beregalov@gmail.com>
Cc: <lrodriguez@atheros.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 707eefb8
Loading
Loading
Loading
Loading
+0 −22
Original line number Diff line number Diff line
@@ -309,9 +309,7 @@ char *usbdrv_translate_scan(struct net_device *dev,
    iwe.u.ap_addr.sa_family = ARPHRD_ETHER;
    memcpy(iwe.u.ap_addr.sa_data, list->bssid, ETH_ALEN);
    current_ev = iwe_stream_add_event(
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27))
	info,
#endif
	current_ev,
	end_buf, &iwe, IW_EV_ADDR_LEN);

@@ -332,9 +330,7 @@ char *usbdrv_translate_scan(struct net_device *dev,
    iwe.cmd = SIOCGIWESSID;
    iwe.u.data.flags = 1;
    current_ev = iwe_stream_add_point(
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27))
	info,
#endif
	current_ev, end_buf, &iwe, &list->ssid[2]);

    /* Ran out of buffer */
@@ -355,9 +351,7 @@ char *usbdrv_translate_scan(struct net_device *dev,
        else
            iwe.u.mode = IW_MODE_ADHOC;
        current_ev = iwe_stream_add_event(
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27))
		info,
#endif
		current_ev, end_buf, &iwe, IW_EV_UINT_LEN);
    }

@@ -389,9 +383,7 @@ char *usbdrv_translate_scan(struct net_device *dev,
    }
    iwe.u.freq.e = 6;
    current_ev = iwe_stream_add_event(
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27))
	info,
#endif
    	current_ev, end_buf, &iwe, IW_EV_FREQ_LEN);

    /* Ran out of buffer */
@@ -412,9 +404,7 @@ char *usbdrv_translate_scan(struct net_device *dev,
    iwe.u.qual.noise = 0;
    iwe.u.qual.qual = list->signalQuality;
    current_ev = iwe_stream_add_event(
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27))
	info,
#endif
	current_ev, end_buf, &iwe, IW_EV_QUAL_LEN);

    /* Ran out of buffer */
@@ -435,9 +425,7 @@ char *usbdrv_translate_scan(struct net_device *dev,

    iwe.u.data.length = 0;
    current_ev = iwe_stream_add_point(
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27))
	info,
#endif
	current_ev, end_buf, &iwe, list->ssid);

    /* Ran out of buffer */
@@ -462,9 +450,7 @@ char *usbdrv_translate_scan(struct net_device *dev,
        iwe.u.bitrate.value = ((list->supportedRates[i+2] & 0x7f) * 500000);
/* Add new value to event */
        current_val = iwe_stream_add_value(
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27))
		info,
#endif
		current_ev, current_val, end_buf, &iwe, IW_EV_PARAM_LEN);

        /* Ran out of buffer */
@@ -482,9 +468,7 @@ char *usbdrv_translate_scan(struct net_device *dev,
        iwe.u.bitrate.value = ((list->extSupportedRates[i+2] & 0x7f) * 500000);
/* Add new value to event */
        current_val = iwe_stream_add_value(
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27))
		info,
#endif
		current_ev, current_val, end_buf, &iwe, IW_EV_PARAM_LEN);

        /* Ran out of buffer */
@@ -506,9 +490,7 @@ char *usbdrv_translate_scan(struct net_device *dev,
    snprintf(buf, sizeof(buf), "bcn_int=%d", (list->beaconInterval[1] << 8) + list->beaconInterval[0]);
    iwe.u.data.length = strlen(buf);
    current_ev = iwe_stream_add_point(
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27))
		info,
#endif
		current_ev, end_buf, &iwe, buf);

    /* Ran out of buffer */
@@ -537,9 +519,7 @@ char *usbdrv_translate_scan(struct net_device *dev,

        if (iwe.u.data.length != 0)
            current_ev = iwe_stream_add_point(
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27))
		info,
#endif
		current_ev, end_buf, &iwe, buf);

        /* Ran out of buffer */
@@ -563,9 +543,7 @@ char *usbdrv_translate_scan(struct net_device *dev,
                rsn_leader, sizeof(rsn_leader)-1);
            if (iwe.u.data.length != 0)
                current_ev = iwe_stream_add_point(
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27))
			info,
#endif
			current_ev, end_buf,  &iwe, buf);

            /* Ran out of buffer */
+0 −61
Original line number Diff line number Diff line
@@ -51,11 +51,7 @@ extern void zfDumpDescriptor(zdev_t* dev, u16_t type);
//extern void zfiWlanQueryMacAddress(zdev_t* dev, u8_t* addr);

// ISR handler
#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0))
irqreturn_t usbdrv_intr(int, void *, struct pt_regs *);
#else
void usbdrv_intr(int, void *, struct pt_regs *);
#endif

// Network Device interface related function
int usbdrv_open(struct net_device *);
@@ -316,11 +312,7 @@ void zfLnxInitVapStruct(void);
 * the RX & TX queues & starts the RU if it has stopped due
 * to no resources.
 */
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0))
irqreturn_t usbdrv_intr(int irq, void *dev_inst, struct pt_regs *regs)
#else
void usbdrv_intr(int irq, void *dev_inst, struct pt_regs *regs)
#endif
{
    struct net_device *dev;
    struct usbdrv_private *macp;
@@ -331,38 +323,22 @@ void usbdrv_intr(int irq, void *dev_inst, struct pt_regs *regs)

    /* Read register error, card may be unpluged */
    if (0)//(intr_status == -1)
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0))
        return IRQ_NONE;
#else
        return;
#endif

    /* the device is closed, don't continue or else bad things may happen. */
    if (!netif_running(dev)) {
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0))
        return IRQ_NONE;
#else
        return;
#endif
    }

    if (macp->driver_isolated) {
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0))
        return IRQ_NONE;
#else
        return;
#endif
    }

#if (WLAN_HOSTIF == WLAN_PCI)
    //zfiIsrPci(dev);
#endif

#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0))
    return IRQ_HANDLED;
#else
    return;
#endif
}

int usbdrv_open(struct net_device *dev)
@@ -477,11 +453,7 @@ int usbdrv_open(struct net_device *dev)
    zfiWlanEnable(dev);

#ifdef ZM_ENABLE_CENC
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,14)
    macp->netlink_sk = netlink_kernel_create(NETLINK_USERSOCK, NULL);
#else
    macp->netlink_sk = netlink_kernel_create(NETLINK_USERSOCK, 1, NULL, THIS_MODULE);
#endif

    if (macp->netlink_sk == NULL)
    {
@@ -884,11 +856,7 @@ int zfLnxRegisterVapDev(struct net_device* parentDev, u16_t vapId)
#else
    vap[vapId].dev->do_ioctl = NULL;
#endif
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0))
    vap[vapId].dev->destructor = free_netdev;
#else
    vap[vapId].dev->features |= NETIF_F_DYNALLOC;
#endif

    vap[vapId].dev->tx_queue_len = 0;

@@ -939,13 +907,8 @@ int zfLnxUnregisterVapDev(struct net_device* parentDev, u16_t vapId)



#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0) /* tune me! */
#  define SUBMIT_URB(u,f)       usb_submit_urb(u,f)
#  define USB_ALLOC_URB(u,f)    usb_alloc_urb(u,f)
#else
#  define SUBMIT_URB(u,f)       usb_submit_urb(u)
#  define USB_ALLOC_URB(u,f)    usb_alloc_urb(u)
#endif

//extern void zfiWlanQueryMacAddress(zdev_t* dev, u8_t* addr);

@@ -963,26 +926,16 @@ extern UsbTxQ_t *zfLnxGetUsbTxBuffer(struct net_device *dev);
int zfLnxAllocAllUrbs(struct usbdrv_private *macp)
{
    struct usb_interface *interface = macp->interface;
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
    struct usb_interface_descriptor *iface_desc = &interface->altsetting[0];
#else
    struct usb_host_interface *iface_desc = &interface->altsetting[0];
#endif

    struct usb_endpoint_descriptor *endpoint;
    int i;

    /* descriptor matches, let's find the endpoints needed */
    /* check out the endpoints */
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
    for (i = 0; i < iface_desc->bNumEndpoints; ++i)
    {
        endpoint = &iface_desc->endpoint[i];
#else
    for (i = 0; i < iface_desc->desc.bNumEndpoints; ++i)
    {
        endpoint = &iface_desc->endpoint[i].desc;
#endif
        if ((endpoint->bEndpointAddress & 0x80) &&
            ((endpoint->bmAttributes & 3) == 0x02))
        {
@@ -1100,9 +1053,6 @@ void zfLnxUnlinkAllUrbs(struct usbdrv_private *macp)
    {
        if (macp->WlanTxDataUrb[i] != NULL)
        {
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,15)
            macp->WlanTxDataUrb[i]->transfer_flags &= ~URB_ASYNC_UNLINK;
#endif
            usb_unlink_urb(macp->WlanTxDataUrb[i]);
        }
    }
@@ -1112,22 +1062,13 @@ void zfLnxUnlinkAllUrbs(struct usbdrv_private *macp)
    {
        if (macp->WlanRxDataUrb[i] != NULL)
        {
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,15)
            macp->WlanRxDataUrb[i]->transfer_flags &= ~URB_ASYNC_UNLINK;
#endif
            usb_unlink_urb(macp->WlanRxDataUrb[i]);
        }
    }

    /* Unlink USB Register Read/Write URB */
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,15)
    macp->RegOutUrb->transfer_flags &= ~URB_ASYNC_UNLINK;
#endif
    usb_unlink_urb(macp->RegOutUrb);

#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,15)
    macp->RegInUrb->transfer_flags &= ~URB_ASYNC_UNLINK;
#endif
    usb_unlink_urb(macp->RegInUrb);
}

@@ -1166,14 +1107,12 @@ u8_t zfLnxInitSetup(struct net_device *dev, struct usbdrv_private *macp)

    dev->flags |= IFF_MULTICAST;

#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24))
    dev->dev_addr[0] = 0x00;
    dev->dev_addr[1] = 0x03;
    dev->dev_addr[2] = 0x7f;
    dev->dev_addr[3] = 0x11;
    dev->dev_addr[4] = 0x22;
    dev->dev_addr[5] = 0x33;
#endif

    /* Initialize Heart Beat timer */
    init_timer(&macp->hbTimer10ms);
+2 −7
Original line number Diff line number Diff line
@@ -35,15 +35,10 @@
#include <linux/netdevice.h>
#include <linux/etherdevice.h>
#include <linux/skbuff.h>
#include <linux/version.h>
#include <asm/uaccess.h>
#include <linux/uaccess.h>
#include <linux/wireless.h>
#include <linux/if_arp.h>
#include <asm/io.h>

#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
    #include <asm/div64.h>
#endif
#include <linux/io.h>

#include "zdcompat.h"

+0 −4
Original line number Diff line number Diff line
@@ -65,11 +65,7 @@ void zfLnxRecv80211(zdev_t* dev, zbuf_t* buf, struct zsAdditionInfo* addInfo)
                if(skb1 != NULL)
                {
                    skb1->dev = dev;
                #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,22))
	            skb1->mac.raw = skb1->data;
                #else
                    skb1->mac_header = skb1->data;
                #endif
	            skb1->ip_summed = CHECKSUM_NONE;
	            skb1->pkt_type = PACKET_OTHERHOST;
	            skb1->protocol = __constant_htons(0x0019);  /* ETH_P_80211_RAW */
+0 −4
Original line number Diff line number Diff line
@@ -144,11 +144,7 @@ void zfwUsbCmd(zdev_t* dev, u8_t endpt, u32_t* cmd, u16_t cmdLen)
    if (ret != 0)
    {
        usb_free_urb(macp->RegOutUrb);
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0) /* tune me! */
        macp->RegOutUrb = usb_alloc_urb(0, GFP_ATOMIC);
#else
        macp->RegOutUrb = usb_alloc_urb(0);
#endif
        ret = zfLnxUsbWriteReg(dev, cmd, cmdLen);
    }
}
Loading