mirror of
https://github.com/FEX-Emu/linux.git
synced 2024-12-27 03:47:43 +00:00
Staging: wlan-ng: Eliminate more <2.6 kernel support.
Signed-off-by: Solomon Peachy <pizza@shaftnet.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
parent
187a769636
commit
68a193e4bb
@ -171,23 +171,7 @@ out:
|
||||
}
|
||||
#endif
|
||||
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,69)
|
||||
static void
|
||||
usb_init_urb(struct urb *urb)
|
||||
{
|
||||
memset(urb, 0, sizeof(*urb));
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0) /* tune me! */
|
||||
urb->count = (atomic_t)ATOMIC_INIT(1);
|
||||
#endif
|
||||
spin_lock_init(&urb->lock);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0) /* tune me! */
|
||||
# define SUBMIT_URB(u,f) usb_submit_urb(u,f)
|
||||
#else
|
||||
# define SUBMIT_URB(u,f) usb_submit_urb(u)
|
||||
#endif
|
||||
#define SUBMIT_URB(u,f) usb_submit_urb(u,f)
|
||||
|
||||
/*================================================================*/
|
||||
/* Project Includes */
|
||||
@ -1594,78 +1578,10 @@ hfa384x_copy_to_aux(
|
||||
----------------------------------------------------------------*/
|
||||
int hfa384x_corereset(hfa384x_t *hw, int holdtime, int settletime, int genesis)
|
||||
{
|
||||
#if 0
|
||||
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
|
||||
struct usb_device *parent = hw->usb->parent;
|
||||
int i;
|
||||
int port = -1;
|
||||
#endif
|
||||
#endif
|
||||
int result = 0;
|
||||
|
||||
|
||||
#define P2_USB_RT_PORT (USB_TYPE_CLASS | USB_RECIP_OTHER)
|
||||
#define P2_USB_FEAT_RESET 4
|
||||
#define P2_USB_FEAT_C_RESET 20
|
||||
|
||||
DBFENTER;
|
||||
|
||||
#if 0
|
||||
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
|
||||
/* Find the hub port */
|
||||
for ( i = 0; i < parent->maxchild; i++) {
|
||||
if (parent->children[i] == hw->usb) {
|
||||
port = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (port < 0) return -ENOENT;
|
||||
|
||||
/* Set and clear the reset */
|
||||
usb_control_msg(parent, usb_sndctrlpipe(parent, 0),
|
||||
USB_REQ_SET_FEATURE, P2_USB_RT_PORT, P2_USB_FEAT_RESET,
|
||||
port+1, NULL, 0, 1*HZ);
|
||||
wait_ms(holdtime);
|
||||
usb_control_msg(parent, usb_sndctrlpipe(parent, 0),
|
||||
USB_REQ_CLEAR_FEATURE, P2_USB_RT_PORT, P2_USB_FEAT_C_RESET,
|
||||
port+1, NULL, 0, 1*HZ);
|
||||
wait_ms(settletime);
|
||||
|
||||
/* Set the device address */
|
||||
result=usb_set_address(hw->usb);
|
||||
if (result < 0) {
|
||||
WLAN_LOG_ERROR("reset_usbdev: Dev not accepting address, "
|
||||
"result=%d\n", result);
|
||||
clear_bit(hw->usb->devnum, &hw->usb->bus->devmap.devicemap);
|
||||
hw->usb->devnum = -1;
|
||||
goto done;
|
||||
}
|
||||
/* Let the address settle */
|
||||
wait_ms(20);
|
||||
|
||||
/* Assume we're reusing the original descriptor data */
|
||||
|
||||
/* Set the configuration. */
|
||||
WLAN_LOG_DEBUG(3, "Setting Configuration %d\n",
|
||||
hw->usb->config[0].bConfigurationValue);
|
||||
result=usb_set_configuration(hw->usb, hw->usb->config[0].bConfigurationValue);
|
||||
if ( result ) {
|
||||
WLAN_LOG_ERROR("usb_set_configuration() failed, result=%d.\n",
|
||||
result);
|
||||
goto done;
|
||||
}
|
||||
/* Let the configuration settle */
|
||||
wait_ms(20);
|
||||
|
||||
done:
|
||||
#else
|
||||
result=usb_reset_device(hw->usb);
|
||||
if(result<0) {
|
||||
WLAN_LOG_ERROR("usb_reset_device() failed, result=%d.\n",result);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
result=usb_reset_device(hw->usb);
|
||||
if(result<0) {
|
||||
WLAN_LOG_ERROR("usb_reset_device() failed, result=%d.\n",result);
|
||||
|
@ -60,9 +60,7 @@
|
||||
#include <linux/version.h>
|
||||
|
||||
#include <linux/module.h>
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,25))
|
||||
#include <linux/moduleparam.h>
|
||||
#endif
|
||||
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/sched.h>
|
||||
@ -154,14 +152,7 @@ int init_module(void)
|
||||
{
|
||||
DBFENTER;
|
||||
|
||||
#if 0
|
||||
printk(KERN_NOTICE "%s (%s) Loaded\n", version, WLAN_BUILD_DATE);
|
||||
#endif
|
||||
|
||||
p80211netdev_startup();
|
||||
#ifdef CONFIG_HOTPLUG
|
||||
p80211_run_sbin_hotplug(NULL, WLAN_HOTPLUG_STARTUP);
|
||||
#endif
|
||||
|
||||
DBFEXIT;
|
||||
return 0;
|
||||
@ -191,11 +182,7 @@ void cleanup_module(void)
|
||||
{
|
||||
DBFENTER;
|
||||
|
||||
#ifdef CONFIG_HOTPLUG
|
||||
p80211_run_sbin_hotplug(NULL, WLAN_HOTPLUG_SHUTDOWN);
|
||||
#endif
|
||||
p80211netdev_shutdown();
|
||||
printk(KERN_NOTICE "%s Unloaded\n", version);
|
||||
|
||||
DBFEXIT;
|
||||
return;
|
||||
|
@ -285,9 +285,6 @@ static int p80211knetdev_open( netdevice_t *netdev )
|
||||
if ( wlandev->open != NULL) {
|
||||
result = wlandev->open(wlandev);
|
||||
if ( result == 0 ) {
|
||||
#if ( LINUX_VERSION_CODE < KERNEL_VERSION(2,3,43) )
|
||||
netdev->interrupt = 0;
|
||||
#endif
|
||||
p80211netdev_start_queue(wlandev);
|
||||
wlandev->state = WLAN_DEVICE_OPEN;
|
||||
}
|
||||
@ -478,15 +475,6 @@ static int p80211knetdev_hard_start_xmit( struct sk_buff *skb, netdevice_t *netd
|
||||
memset(&p80211_hdr, 0, sizeof(p80211_hdr_t));
|
||||
memset(&p80211_wep, 0, sizeof(p80211_metawep_t));
|
||||
|
||||
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,3,38) )
|
||||
if ( test_and_set_bit(0, (void*)&(netdev->tbusy)) != 0 ) {
|
||||
/* We've been called w/ tbusy set, has the tx */
|
||||
/* path stalled? */
|
||||
WLAN_LOG_DEBUG(1, "called when tbusy set\n");
|
||||
result = 1;
|
||||
goto failed;
|
||||
}
|
||||
#else
|
||||
if ( netif_queue_stopped(netdev) ) {
|
||||
WLAN_LOG_DEBUG(1, "called when queue stopped.\n");
|
||||
result = 1;
|
||||
@ -495,12 +483,6 @@ static int p80211knetdev_hard_start_xmit( struct sk_buff *skb, netdevice_t *netd
|
||||
|
||||
netif_stop_queue(netdev);
|
||||
|
||||
/* No timeout handling here, 2.3.38+ kernels call the
|
||||
* timeout function directly.
|
||||
* TODO: Add timeout handling.
|
||||
*/
|
||||
#endif
|
||||
|
||||
/* Check to see that a valid mode is set */
|
||||
switch( wlandev->macmode ) {
|
||||
case WLAN_MACMODE_IBSS_STA:
|
||||
@ -792,15 +774,9 @@ static int p80211knetdev_set_mac_address(netdevice_t *dev, void *addr)
|
||||
|
||||
DBFENTER;
|
||||
/* If we're running, we don't allow MAC address changes */
|
||||
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,3,38) )
|
||||
if ( dev->start) {
|
||||
return -EBUSY;
|
||||
}
|
||||
#else
|
||||
if (netif_running(dev)) {
|
||||
return -EBUSY;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Set up some convenience pointers. */
|
||||
mibattr = &dot11req.mibattribute;
|
||||
@ -939,12 +915,7 @@ int wlan_setup(wlandevice_t *wlandev)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,3,38) )
|
||||
dev->tbusy = 1;
|
||||
dev->start = 0;
|
||||
#else
|
||||
netif_stop_queue(dev);
|
||||
#endif
|
||||
#ifdef HAVE_CHANGE_MTU
|
||||
dev->change_mtu = wlan_change_mtu;
|
||||
#endif
|
||||
@ -1039,11 +1010,7 @@ int register_wlandev(wlandevice_t *wlandev)
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
#if ( LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0) )
|
||||
dev->name = wlandev->name;
|
||||
#else
|
||||
strcpy(wlandev->name, dev->name);
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_PROC_FS
|
||||
if (proc_p80211) {
|
||||
@ -1062,10 +1029,6 @@ int register_wlandev(wlandevice_t *wlandev)
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_HOTPLUG
|
||||
p80211_run_sbin_hotplug(wlandev, WLAN_HOTPLUG_REGISTER);
|
||||
#endif
|
||||
|
||||
DBFEXIT;
|
||||
return 0;
|
||||
}
|
||||
@ -1094,10 +1057,6 @@ int unregister_wlandev(wlandevice_t *wlandev)
|
||||
|
||||
DBFENTER;
|
||||
|
||||
#ifdef CONFIG_HOTPLUG
|
||||
p80211_run_sbin_hotplug(wlandev, WLAN_HOTPLUG_REMOVE);
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_PROC_FS
|
||||
if ( wlandev->procwlandev ) {
|
||||
remove_proc_entry("wlandev", wlandev->procdir);
|
||||
@ -1416,61 +1375,11 @@ static int p80211_rx_typedrop( wlandevice_t *wlandev, UINT16 fc)
|
||||
return drop;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_HOTPLUG
|
||||
/* Notify userspace when a netdevice event occurs,
|
||||
* by running '/sbin/hotplug net' with certain
|
||||
* environment variables set.
|
||||
*/
|
||||
int p80211_run_sbin_hotplug(wlandevice_t *wlandev, char *action)
|
||||
{
|
||||
char *argv[3], *envp[7], ifname[12 + IFNAMSIZ], action_str[32];
|
||||
char nsdname[32], wlan_wext[32];
|
||||
int i;
|
||||
|
||||
if (wlandev) {
|
||||
sprintf(ifname, "INTERFACE=%s", wlandev->name);
|
||||
sprintf(nsdname, "NSDNAME=%s", wlandev->nsdname);
|
||||
} else {
|
||||
sprintf(ifname, "INTERFACE=null");
|
||||
sprintf(nsdname, "NSDNAME=null");
|
||||
}
|
||||
|
||||
sprintf(wlan_wext, "WLAN_WEXT=%s", wlan_wext_write ? "y" : "");
|
||||
sprintf(action_str, "ACTION=%s", action);
|
||||
|
||||
i = 0;
|
||||
argv[i++] = hotplug_path;
|
||||
argv[i++] = "wlan";
|
||||
argv[i] = NULL;
|
||||
|
||||
i = 0;
|
||||
/* minimal command environment */
|
||||
envp [i++] = "HOME=/";
|
||||
envp [i++] = "PATH=/sbin:/bin:/usr/sbin:/usr/bin";
|
||||
envp [i++] = ifname;
|
||||
envp [i++] = action_str;
|
||||
envp [i++] = nsdname;
|
||||
envp [i++] = wlan_wext;
|
||||
envp [i] = NULL;
|
||||
|
||||
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,62))
|
||||
return call_usermodehelper(argv [0], argv, envp);
|
||||
#else
|
||||
return call_usermodehelper(argv [0], argv, envp, 0);
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
void p80211_suspend(wlandevice_t *wlandev)
|
||||
{
|
||||
DBFENTER;
|
||||
|
||||
#ifdef CONFIG_HOTPLUG
|
||||
p80211_run_sbin_hotplug(wlandev, WLAN_HOTPLUG_SUSPEND);
|
||||
#endif
|
||||
|
||||
DBFEXIT;
|
||||
}
|
||||
|
||||
@ -1478,10 +1387,6 @@ void p80211_resume(wlandevice_t *wlandev)
|
||||
{
|
||||
DBFENTER;
|
||||
|
||||
#ifdef CONFIG_HOTPLUG
|
||||
p80211_run_sbin_hotplug(wlandev, WLAN_HOTPLUG_RESUME);
|
||||
#endif
|
||||
|
||||
DBFEXIT;
|
||||
}
|
||||
|
||||
|
@ -289,12 +289,7 @@ p80211netdev_stop_queue(wlandevice_t *wlandev)
|
||||
{
|
||||
if ( !wlandev ) return;
|
||||
if ( !wlandev->netdev ) return;
|
||||
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,3,38) )
|
||||
wlandev->netdev->tbusy = 1;
|
||||
wlandev->netdev->start = 0;
|
||||
#else
|
||||
netif_stop_queue(wlandev->netdev);
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline void
|
||||
@ -302,12 +297,7 @@ p80211netdev_start_queue(wlandevice_t *wlandev)
|
||||
{
|
||||
if ( !wlandev ) return;
|
||||
if ( !wlandev->netdev ) return;
|
||||
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,3,38) )
|
||||
wlandev->netdev->tbusy = 0;
|
||||
wlandev->netdev->start = 1;
|
||||
#else
|
||||
netif_start_queue(wlandev->netdev);
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline void
|
||||
@ -315,22 +305,7 @@ p80211netdev_wake_queue(wlandevice_t *wlandev)
|
||||
{
|
||||
if ( !wlandev ) return;
|
||||
if ( !wlandev->netdev ) return;
|
||||
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,3,38) )
|
||||
wlandev->netdev->tbusy = 0;
|
||||
mark_bh(NET_BH);
|
||||
#else
|
||||
netif_wake_queue(wlandev->netdev);
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef CONFIG_HOTPLUG
|
||||
#define WLAN_HOTPLUG_REGISTER "register"
|
||||
#define WLAN_HOTPLUG_REMOVE "remove"
|
||||
#define WLAN_HOTPLUG_STARTUP "startup"
|
||||
#define WLAN_HOTPLUG_SHUTDOWN "shutdown"
|
||||
#define WLAN_HOTPLUG_SUSPEND "suspend"
|
||||
#define WLAN_HOTPLUG_RESUME "resume"
|
||||
int p80211_run_sbin_hotplug(wlandevice_t *wlandev, char *action);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
@ -56,14 +56,9 @@
|
||||
|
||||
#include "version.h"
|
||||
|
||||
|
||||
#include <linux/version.h>
|
||||
|
||||
#include <linux/module.h>
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,25))
|
||||
#include <linux/moduleparam.h>
|
||||
#endif
|
||||
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/sched.h>
|
||||
#include <linux/types.h>
|
||||
@ -71,12 +66,7 @@
|
||||
#include <linux/slab.h>
|
||||
#include <linux/wireless.h>
|
||||
#include <linux/netdevice.h>
|
||||
|
||||
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
|
||||
#include <linux/tqueue.h>
|
||||
#else
|
||||
#include <linux/workqueue.h>
|
||||
#endif
|
||||
|
||||
#include <asm/io.h>
|
||||
#include <linux/delay.h>
|
||||
|
@ -267,10 +267,6 @@ typedef struct net_device netdevice_t;
|
||||
typedef u32 pm_message_t;
|
||||
#endif
|
||||
|
||||
#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,9))
|
||||
#define hotplug_path "/etc/hotplug/wlan.agent"
|
||||
#endif
|
||||
|
||||
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,9))
|
||||
#define eth_hdr(x) (x)->mac.ethernet
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user