Re: [PATCH] Current CVS builds not with Kernel 2.6.16-18 and ad-hoc mode fix

[email protected] Thu, 08 Jun 2006 16:52:43 +0200
Newsgroups gmane.linux.drivers.at76c503a.user
Message-ID <[email protected]>
Zitat von [email protected]:

> Combined these two Patches:
> https://lists.berlios.de/pipermail/at76c503a-user/2006-March/001660.html
> and
>
http://iprserv.jura.uni-leipzig.de/pipermail/atmel-wlan-usb/2005-August/002474.html
>
> HTH,
>
>  Christoph
>

Same patch as non-binary for copy%paste


Greets,

 Christoph

Index: at76_usbdfu.c
===================================================================
RCS file: /cvsroot/at76c503a/at76c503a/at76_usbdfu.c,v
retrieving revision 1.2
diff -u -p -r1.2 at76_usbdfu.c
--- at76_usbdfu.c	5 Sep 2004 14:07:09 -0000	1.2
+++ at76_usbdfu.c	8 Jun 2006 14:02:47 -0000
@@ -57,8 +57,8 @@ static int debug = 0;
 #define DRIVER_DESC "USB Device Firmware Upgrade (DFU) handler"

 /* Module paramaters */
-MODULE_PARM(debug, "i");
-MODULE_PARM_DESC(debug, "debug enabled (=1)");
+module_param(debug, bool, 0400);
+MODULE_PARM_DESC(debug, "debug on/off");

 /* DFU states */

Index: at76c503-fw_skel.c
===================================================================
RCS file: /cvsroot/at76c503a/at76c503a/at76c503-fw_skel.c,v
retrieving revision 1.8
diff -u -p -r1.8 at76c503-fw_skel.c
--- at76c503-fw_skel.c	8 Mar 2005 00:07:55 -0000	1.8
+++ at76c503-fw_skel.c	8 Jun 2006 14:02:47 -0000
@@ -31,6 +31,7 @@
 #include <asm/arch/ipaq.h>
 #include <asm/arch-pxa/h5400-asic.h>
 #endif
+#include <linux/module.h>

 #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 5, 0)
 extern inline char *fw_dev_param(struct usb_device *udev, char *buf)
@@ -55,14 +56,12 @@ const struct firmware *fw;

 /* Module paramaters */

-static char netdev_name[IFNAMSIZ+1] = "wlan%d";
-MODULE_PARM(netdev_name, "c" __MODULE_STRING(IFNAMSIZ));
-MODULE_PARM_DESC(netdev_name,
-                 "network device name (default is wlan%d)");
-static int debug = 1;
-MODULE_PARM(debug, "i");
-MODULE_PARM_DESC(debug,
-                 "debug output (default: 1)");
+static char* netdev_name = "wlan%d";
+module_param(netdev_name, charp,0400);
+MODULE_PARM_DESC(netdev_name, "network device name (default is wlan%d)");
+static int debug=0;
+module_param(debug, bool, 0400);
+MODULE_PARM_DESC(debug, "debug on/off");

 /* Use our own dbg macro */
 #undef dbg
@@ -89,9 +88,6 @@ static void at76c50x_disconnect(struct u
 /* structure for registering this driver with the usb subsystem */

 static struct usb_driver module_usb = {
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,20)
-	owner:      THIS_MODULE,
-#endif
 	name:	    DRIVER_NAME,
 	probe:	    at76c50x_probe,
 	disconnect: at76c50x_disconnect,
@@ -221,8 +217,8 @@ static void __exit mod_exit(void)
 #endif
 }

-module_init (mod_init);
-module_exit (mod_exit);
+module_init(mod_init);
+module_exit(mod_exit);

 MODULE_AUTHOR(DRIVER_AUTHOR);
 MODULE_DESCRIPTION(DRIVER_DESC);
Index: at76c503.c
===================================================================
RCS file: /cvsroot/at76c503a/at76c503a/at76c503.c,v
retrieving revision 1.75
diff -u -p -r1.75 at76c503.c
--- at76c503.c	11 Feb 2006 19:18:44 -0000	1.75
+++ at76c503.c	8 Jun 2006 14:02:47 -0000
@@ -309,69 +309,70 @@ static const u8 zeros[32];
 /* Version Information */
 #define DRIVER_DESC "Generic Atmel at76c503/at76c505 routines"

-/* Module paramaters */
-MODULE_PARM(debug, "i");
 #define DRIVER_AUTHOR \
 "Oliver Kurth, Joerg Albert <[email protected]>, Alex, Nick Jones, "\
 "Balint Seeber <[email protected]>"
+
+/* Module paramaters */
+module_param(debug, int, 0400);
 MODULE_PARM_DESC(debug, "Debugging level");

 static int rx_copybreak = 200;
-MODULE_PARM(rx_copybreak, "i");
+module_param(rx_copybreak, int, 0400);
 MODULE_PARM_DESC(rx_copybreak, "rx packet copy threshold");

 static int scan_min_time = 10;
-MODULE_PARM(scan_min_time, "i");
+module_param(scan_min_time, int, 0400);
 MODULE_PARM_DESC(scan_min_time, "scan min channel time (default: 10)");

 static int scan_max_time = 120;
-MODULE_PARM(scan_max_time, "i");
+module_param(scan_max_time, int, 0400);
 MODULE_PARM_DESC(scan_max_time, "scan max channel time (default: 120)");

 static int scan_mode = SCAN_TYPE_ACTIVE;
-MODULE_PARM(scan_mode, "i");
+module_param(scan_mode, int, 0400);
 MODULE_PARM_DESC(scan_mode, "scan mode: 0 active (with ProbeReq, default), 1
passive");

 static int preamble_type = PREAMBLE_TYPE_LONG;
-MODULE_PARM(preamble_type, "i");
+module_param(preamble_type, int, 0400);
 MODULE_PARM_DESC(preamble_type, "preamble type: 0 long (default), 1 short");

 static int auth_mode = 0;
-MODULE_PARM(auth_mode, "i");
+module_param(auth_mode, int, 0400);
 MODULE_PARM_DESC(auth_mode, "authentication mode: 0 open system (default), "
 		 "1 shared secret");

 static int pm_mode = PM_ACTIVE;
-MODULE_PARM(pm_mode, "i");
+module_param(pm_mode, int, 0400);
 MODULE_PARM_DESC(pm_mode, "power management mode: 1 active (def.), 2 powersave,
3 smart save");

 static int pm_period = 0;
-MODULE_PARM(pm_period, "i");
+module_param(pm_period, int, 0400);
 MODULE_PARM_DESC(pm_period, "period of waking up the device in usec");

 static int international_roaming = IR_OFF;
-MODULE_PARM(international_roaming, "i");
+module_param(international_roaming, int, 0400);
 MODULE_PARM_DESC(international_roaming, "enable international roaming: 0 (no,
default), 1 (yes)");

 static int default_iw_mode = IW_MODE_INFRA;
-MODULE_PARM(default_iw_mode, "i");
+module_param(default_iw_mode, int, 0400);
 MODULE_PARM_DESC(default_iw_mode, "default IW mode for a new device: "
 		 "1 (ad-hoc), 2 (infrastructure, def.), 6 (monitor mode)");

 static int monitor_scan_min_time = 50;
-MODULE_PARM(monitor_scan_min_time, "i");
+module_param(monitor_scan_min_time, int, 0400);
 MODULE_PARM_DESC(monitor_scan_min_time, "scan min channel time in MONITOR MODE
(default: 50)");

 static int monitor_scan_max_time = 600;
-MODULE_PARM(monitor_scan_max_time, "i");
+module_param(monitor_scan_max_time, int, 0400);
 MODULE_PARM_DESC(monitor_scan_max_time, "scan max channel time in MONITOR MODE
(default: 600)");

 #define DEF_RTS_THRESHOLD 1536
 #define DEF_FRAG_THRESHOLD 1536
 #define DEF_SHORT_RETRY_LIMIT 8
 //#define DEF_LONG_RETRY_LIMIT 4
-#define DEF_ESSID "okuwlan"
-#define DEF_ESSID_LEN 7
+#define DEF_ESSID ""
+#define DEF_ESSID_LEN 0
 #define DEF_CHANNEL 10

 #define MAX_RTS_THRESHOLD 2347
@@ -2836,8 +2837,10 @@ kevent(void *data)
 			err("%s: set_mib (ibss change ok) failed: %d", dev->netdev->name, ret);
 			goto end_startibss;
 		}
-
+ /* changed due ad-hoc error */
+		netif_carrier_on(dev->netdev);
 		netif_start_queue(dev->netdev);
+
 	}
 end_startibss:

@@ -2888,6 +2891,8 @@ end_startibss:
 				memcpy(dev->bssid, bptr->bssid, ETH_ALEN);
 				dev->channel = bptr->channel;
 				iwevent_bss_connect(dev->netdev,bptr->bssid);
+				/* changed due ad-hoc error */
+				netif_carrier_on(dev->netdev);
 				netif_start_queue(dev->netdev);
 				/* just to be sure */
 				del_timer_sync(&dev->mgmt_timer);
@@ -7144,7 +7149,6 @@ set_debug_end:
 void at76c503_delete_device(struct at76c503 *dev)
 {
 	int i;
-	int sem_taken;

 	if (!dev)
 		return;
@@ -7155,14 +7159,17 @@ void at76c503_delete_device(struct at76c
 	dbg(DBG_PROC_ENTRY, "%s: ENTER",__FUNCTION__);

 	if (dev->flags & AT76C503A_NETDEV_REGISTERED) {
-		if ((sem_taken=down_trylock(&rtnl_sem)) != 0)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 17)
+	    	if (down_trylock(&rtnl_sem) != 0) {
+#else
+		if (rtnl_trylock() == 0) {
+#endif
 			info("%s: rtnl_sem already down'ed", __FUNCTION__);
-
-		/* synchronously calls at76c503_stop() */
-		unregister_netdevice(dev->netdev);
-
-		if (!sem_taken)
+		} else {
+			/* synchronously calls at76c503_stop() */
+			unregister_netdevice(dev->netdev);
 			rtnl_unlock();
+		}
 	}

 	PUT_DEV(dev->udev);