patch-2.4.21 linux-2.4.21/drivers/net/wireless/orinoco.h

Next file: linux-2.4.21/drivers/net/wireless/orinoco_cs.c
Previous file: linux-2.4.21/drivers/net/wireless/orinoco.c
Back to the patch index
Back to the overall index

diff -urN linux-2.4.20/drivers/net/wireless/orinoco.h linux-2.4.21/drivers/net/wireless/orinoco.h
@@ -7,6 +7,13 @@
 #ifndef _ORINOCO_H
 #define _ORINOCO_H
 
+#include <linux/types.h>
+#include <linux/spinlock.h>
+#include <linux/netdevice.h>
+#include <linux/wireless.h>
+#include <linux/tqueue.h>
+#include "hermes.h"
+
 /* To enable debug messages */
 //#define ORINOCO_DEBUG		3
 
@@ -18,24 +25,29 @@
 #define ORINOCO_MAX_KEY_SIZE	14
 #define ORINOCO_MAX_KEYS	4
 
-typedef struct orinoco_key {
-	u16 len;	/* always store little-endian */
+struct orinoco_key {
+	u16 len;	/* always stored as little-endian */
 	char data[ORINOCO_MAX_KEY_SIZE];
-} __attribute__ ((packed)) orinoco_key_t;
+} __attribute__ ((packed));
 
-typedef orinoco_key_t orinoco_keys_t[ORINOCO_MAX_KEYS];
+#define ORINOCO_INTEN	 	( HERMES_EV_RX | HERMES_EV_ALLOC | HERMES_EV_TX | \
+				HERMES_EV_TXEXC | HERMES_EV_WTERR | HERMES_EV_INFO | \
+				HERMES_EV_INFDROP )
 
-/*====================================================================*/
 
 struct orinoco_private {
 	void *card;	/* Pointer to card dependant structure */
-	/* card dependant extra reset code (i.e. bus/interface specific */
 	int (*hard_reset)(struct orinoco_private *);
 
+	/* Synchronisation stuff */
 	spinlock_t lock;
-	long state;
-#define ORINOCO_STATE_INIRQ 0
-#define ORINOCO_STATE_DOIRQ 1
+	int hw_unavailable;
+	struct tq_struct timeout_task;
+
+	/* driver state */
+	int open;
+	u16 last_linkstatus;
+	int connected;
 
 	/* Net device stuff */
 	struct net_device *ndev;
@@ -46,6 +58,7 @@
 	hermes_t hw;
 	u16 txfid;
 
+
 	/* Capabilities of the hardware/firmware */
 	int firmware_type;
 #define FIRMWARE_TYPE_AGERE 1
@@ -58,14 +71,13 @@
 	int has_preamble;
 	int has_sensitivity;
 	int nicbuf_size;
-	int broken_cor_reset;
 	u16 channel_mask;
 
 	/* Configuration paramaters */
 	u32 iw_mode;
 	int prefer_port3;
 	u16 wep_on, wep_restrict, tx_key;
-	orinoco_keys_t keys;
+	struct orinoco_key keys[ORINOCO_MAX_KEYS];
 	int bitratemode;
  	char nick[IW_ESSID_MAX_SIZE+1];
 	char desired_essid[IW_ESSID_MAX_SIZE+1];
@@ -81,38 +93,53 @@
 #endif
 
 	/* Configuration dependent variables */
-	int port_type, allow_ibss;
+	int port_type, createibss;
 	int promiscuous, mc_count;
-
-
-	/* /proc based debugging stuff */
-	struct proc_dir_entry *dir_dev;
 };
 
-/*====================================================================*/
-
-extern struct list_head orinoco_instances;
-
 #ifdef ORINOCO_DEBUG
 extern int orinoco_debug;
 #define DEBUG(n, args...) do { if (orinoco_debug>(n)) printk(KERN_DEBUG args); } while(0)
-#define DEBUGMORE(n, args...) do { if (orinoco_debug>(n)) printk(args); } while (0)
 #else
 #define DEBUG(n, args...) do { } while (0)
-#define DEBUGMORE(n, args...) do { } while (0)
 #endif	/* ORINOCO_DEBUG */
 
 #define TRACE_ENTER(devname) DEBUG(2, "%s: -> " __FUNCTION__ "()\n", devname);
 #define TRACE_EXIT(devname)  DEBUG(2, "%s: <- " __FUNCTION__ "()\n", devname);
 
-#define RUP_EVEN(a) ( (a) % 2 ? (a) + 1 : (a) )
+extern struct net_device *alloc_orinocodev(int sizeof_card,
+					   int (*hard_reset)(struct orinoco_private *));
+extern int __orinoco_up(struct net_device *dev);
+extern int __orinoco_down(struct net_device *dev);
+int orinoco_reinit_firmware(struct net_device *dev);
 
-/* utility routines */
-struct net_device *alloc_orinocodev(int sizeof_card);
-extern void orinoco_shutdown(struct orinoco_private *dev);
-extern int orinoco_reset(struct orinoco_private *dev);
-extern int orinoco_proc_dev_init(struct orinoco_private *dev);
-extern void orinoco_proc_dev_cleanup(struct orinoco_private *priv);
 extern void orinoco_interrupt(int irq, void * dev_id, struct pt_regs *regs);
 
+/********************************************************************/
+/* Locking and synchronization functions                            */
+/********************************************************************/
+
+/* These functions *must* be inline or they will break horribly on
+ * SPARC, due to its weird semantics for save/restore flags. extern
+ * inline should prevent the kernel from linking or module from
+ * loading if they are not inlined. */
+extern inline int orinoco_lock(struct orinoco_private *priv,
+			       unsigned long *flags)
+{
+	spin_lock_irqsave(&priv->lock, *flags);
+	if (priv->hw_unavailable) {
+		printk(KERN_DEBUG "orinoco_lock() called with hw_unavailable (dev=%p)\n",
+		       priv->ndev);
+		spin_unlock_irqrestore(&priv->lock, *flags);
+		return -EBUSY;
+	}
+	return 0;
+}
+
+extern inline void orinoco_unlock(struct orinoco_private *priv,
+				  unsigned long *flags)
+{
+	spin_unlock_irqrestore(&priv->lock, *flags);
+}
+
 #endif /* _ORINOCO_H */

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)