[PATCH v2 1/1] ath_hif_usb:Changed 'typedef struct <tag>' to 'struct <structName>'

Ramesh R rshlinux at gmail.com
Tue Nov 10 17:15:07 UTC 2009


Removed :

struct UsbTxQ {
  struct sk_buff *buf;
}

Replaced references to 'struct UsbTxQ' to 'struct sk_buff *'

Addressed jiri's review comments:
 (a) Whitespace added for readability is now replaced with tabs
 (b) buggy assignment to TxQ pointer fixed

Signed-off-by: Ramesh R <rshlinux at gmail.com>
---
 ath/ath9k/ath_hif_usb.c |  144 +++++++++++++++++++++++------------------------
 1 files changed, 71 insertions(+), 73 deletions(-)

diff --git a/ath/ath9k/ath_hif_usb.c b/ath/ath9k/ath_hif_usb.c
index 0a67763..61daad8 100644
--- a/ath/ath9k/ath_hif_usb.c
+++ b/ath/ath9k/ath_hif_usb.c
@@ -85,67 +85,63 @@ struct hif_device_usb;
 static void hif_rx_cb(struct urb *urb);
 
 struct cmd_urb_context {
-	u8 use;
-	struct urb *urb;
-	struct sk_buff *buf;
-	struct hif_device_usb *hif_dev;
+	u8			use;
+	struct			urb *urb;
+	struct			sk_buff *buf;
+	struct hif_device_usb 	*hif_dev;
 };
 
-struct UsbTxQ {
-	struct sk_buff *buf;
+struct UsbTxUrbContext {
+	u8			index;
+	u8			inUse;
+	struct hif_device_usb	*hif_dev;
+	struct sk_buff		*buf;
+	struct urb		*urb;
 };
 
-typedef struct _UsbTxUrbContext {
-	u8 index;
-	u8 inUse;
-	struct hif_device_usb *hif_dev;
-	struct sk_buff *buf;
-	struct urb *urb;
-} UsbTxUrbContext;
-
 struct hif_usb_tx_pipe {
-	u8              usb_pipe;
-	struct UsbTxQ   UsbTxBufQ[ZM_MAX_TX_BUF_NUM];
-	u16             TxBufHead;
-	u16             TxBufTail;
-	u16             TxBufCnt;
-	u16             TxUrbHead;
-	u16             TxUrbTail;
-	u16             TxUrbCnt;
-	UsbTxUrbContext TxUrbCtx[ZM_MAX_TX_URB_NUM];
-	usb_complete_t  complete;
+	u8			usb_pipe;
+	struct sk_buff		*UsbTxBufQ[ZM_MAX_TX_BUF_NUM];
+	u16			TxBufHead;
+	u16			TxBufTail;
+	u16			TxBufCnt;
+	u16			TxUrbHead;
+	u16			TxUrbTail;
+	u16			TxUrbCnt;
+	struct UsbTxUrbContext	TxUrbCtx[ZM_MAX_TX_URB_NUM];
+	usb_complete_t		complete;
 };
 
-typedef struct _UsbRxUrbContext {
-	u8 inUse;
-	struct hif_device_usb *hif_dev;
-	struct sk_buff *skb;
-	struct urb *urb;
-} UsbRxUrbContext;
+struct UsbRxUrbContext {
+	u8			inUse;
+	struct hif_device_usb	*hif_dev;
+	struct sk_buff		*skb;
+	struct urb		*urb;
+};
 
 struct hif_device_usb {
-	void *htc_handle;
-	spinlock_t cs_lock;
-
-	struct usb_device *udev;
-	struct usb_interface *interface;
-	u16 device_id;
-
-	struct sk_buff *regUsbReadBuf;
-	UsbRxUrbContext RxUrbCtx[ZM_MAX_RX_URB_NUM];
-	struct usb_anchor rx_submitted;
-	struct hif_usb_tx_pipe tx_lp;
-	struct hif_usb_tx_pipe tx_mp;
-	struct hif_usb_tx_pipe tx_hp;
-
-	struct cmd_urb_context CmdUrbCtxs[MAX_CMD_URB];
-	spinlock_t CmdUrbLock;
-	u8 surpriseRemoved;
-
-	struct workqueue_struct *workqueue;
-	struct work_struct hif_some_work;
-	const struct firmware *firmware;
-	struct list_head list;
+	void			*htc_handle;
+	spinlock_t		cs_lock;
+
+	struct usb_device	*udev;
+	struct usb_interface	*interface;
+	u16 			device_id;
+
+	struct sk_buff		*regUsbReadBuf;
+	struct UsbRxUrbContext	RxUrbCtx[ZM_MAX_RX_URB_NUM];
+	struct usb_anchor	rx_submitted;
+	struct hif_usb_tx_pipe	tx_lp;
+	struct hif_usb_tx_pipe	tx_mp;
+	struct hif_usb_tx_pipe	tx_hp;
+
+	struct cmd_urb_context	CmdUrbCtxs[MAX_CMD_URB];
+	spinlock_t		CmdUrbLock;
+	u8			surpriseRemoved;
+
+	struct workqueue_struct	*workqueue;
+	struct work_struct	hif_some_work;
+	const struct firmware	*firmware;
+	struct list_head	list;
 };
 
 /* XXX: align against the CPU cache line size, don't just assume 4 */
@@ -262,12 +258,12 @@ out:
 	return r;
 }
 
-static UsbTxUrbContext *zfLnxGetFreeTxUrb(struct hif_device_usb *hif_dev,
+static struct UsbTxUrbContext *zfLnxGetFreeTxUrb(struct hif_device_usb *hif_dev,
 					  struct hif_usb_tx_pipe *pipe)
 {
 	u16 idx;
 	unsigned long irqFlag;
-	UsbTxUrbContext *ctx = NULL;
+	struct UsbTxUrbContext *ctx = NULL;
 
 	spin_lock_irqsave(&(hif_dev->cs_lock), irqFlag);
 
@@ -285,7 +281,8 @@ static UsbTxUrbContext *zfLnxGetFreeTxUrb(struct hif_device_usb *hif_dev,
 }
 
 static void zfLnxPutTxUrb(struct hif_device_usb *hif_dev,
-			  struct hif_usb_tx_pipe *pipe, UsbTxUrbContext * ctx)
+				struct hif_usb_tx_pipe *pipe,
+				struct UsbTxUrbContext *ctx)
 {
 	unsigned long irqFlag;
 
@@ -307,19 +304,19 @@ static u16 zfLnxCheckTxBufferCnt(struct hif_device_usb *hif_dev,
 	return TxBufCnt;
 }
 
-static struct UsbTxQ *zfLnxGetUsbTxBuffer(struct hif_device_usb *hif_dev,
+static struct sk_buff *zfLnxGetUsbTxBuffer(struct hif_device_usb *hif_dev,
 				     struct hif_usb_tx_pipe *pipe)
 {
 	u16 idx;
-	struct UsbTxQ *TxQ;
-	unsigned long flags;
+	struct sk_buff *TxQ;
+	unsigned long  flags;
 
 	spin_lock_irqsave(&hif_dev->cs_lock, flags);
 
 	idx = ((pipe->TxBufHead + 1) & (ZM_MAX_TX_BUF_NUM - 1));
 
 	if (pipe->TxBufCnt > 0) {
-		TxQ = (struct UsbTxQ *) &(pipe->UsbTxBufQ[pipe->TxBufHead]);
+		TxQ = (struct sk_buff *) &(pipe->UsbTxBufQ[pipe->TxBufHead]);
 		pipe->TxBufHead =
 		    ((pipe->TxBufHead + 1) & (ZM_MAX_TX_BUF_NUM - 1));
 		pipe->TxBufCnt--;
@@ -341,8 +338,8 @@ static struct UsbTxQ *zfLnxGetUsbTxBuffer(struct hif_device_usb *hif_dev,
 static u32 zfLnxUsbSubmitTxData(struct hif_device_usb *hif_dev,
 				struct hif_usb_tx_pipe *tx_pipe)
 {
-	UsbTxUrbContext *urb_ctx;
-	struct UsbTxQ   *tx_data;
+	struct UsbTxUrbContext *urb_ctx;
+	struct sk_buff  *tx_data;
 	struct sk_buff  *skb;
 	int             r;
 
@@ -361,7 +358,7 @@ static u32 zfLnxUsbSubmitTxData(struct hif_device_usb *hif_dev,
 		return -ENOBUFS;
 	}
 
-	skb = tx_data->buf;
+	skb = tx_data;
 	urb_ctx->buf = skb;
 
 	/* Submit a tx urb */
@@ -386,7 +383,7 @@ static u32 zfLnxUsbSubmitTxData(struct hif_device_usb *hif_dev,
 
 static void hif_tx_lp_cb(struct urb *urb)
 {
-	UsbTxUrbContext *ctx = (UsbTxUrbContext *) urb->context;
+	struct UsbTxUrbContext *ctx = (struct UsbTxUrbContext *) urb->context;
 	struct hif_device_usb *hif_dev = (struct hif_device_usb *)ctx->hif_dev;
 	struct sk_buff *buf;
 
@@ -616,7 +613,8 @@ static void hif_cmd_cb(struct urb *urb)
 	HTCTxCompletionHandler(hif_dev->htc_handle, buf);
 }
 
-static u32 zfLnxUsbIn(struct hif_device_usb *hif_dev, UsbRxUrbContext *RxUrbCtx)
+static u32 zfLnxUsbIn(struct hif_device_usb *hif_dev,
+			struct UsbRxUrbContext *RxUrbCtx)
 {
 	struct urb *urb = RxUrbCtx->urb;
 	struct sk_buff *skb = RxUrbCtx->skb;
@@ -633,7 +631,8 @@ static u32 zfLnxUsbIn(struct hif_device_usb *hif_dev, UsbRxUrbContext *RxUrbCtx)
 
 static void hif_rx_cb(struct urb *urb)
 {
-	UsbRxUrbContext *RxUrbCtx = (UsbRxUrbContext *) urb->context;
+	struct UsbRxUrbContext *RxUrbCtx =
+			(struct UsbRxUrbContext *) urb->context;
 	struct hif_device_usb *hif_dev = RxUrbCtx->hif_dev;
 	struct sk_buff *buf;
 	struct sk_buff *new_buf;
@@ -683,7 +682,7 @@ static void hif_rx_cb(struct urb *urb)
 
 static void hif_tx_hp_cb(struct urb *urb)
 {
-	UsbTxUrbContext *ctx = (UsbTxUrbContext *) urb->context;
+	struct UsbTxUrbContext *ctx = (struct UsbTxUrbContext *) urb->context;
 	struct hif_device_usb *hif_dev = (struct hif_device_usb *)ctx->hif_dev;
 	struct sk_buff *buf;
 
@@ -706,7 +705,7 @@ static void hif_tx_hp_cb(struct urb *urb)
 
 static void hif_tx_mp_cb(struct urb *urb)
 {
-	UsbTxUrbContext *ctx = (UsbTxUrbContext *) urb->context;
+	struct UsbTxUrbContext *ctx    = (struct UsbTxUrbContext *)urb->context;
 	struct hif_device_usb *hif_dev = (struct hif_device_usb *)ctx->hif_dev;
 	struct sk_buff *buf;
 
@@ -730,10 +729,10 @@ static void hif_tx_mp_cb(struct urb *urb)
 static u16 zfLnxPutUsbTxBuffer(struct hif_device_usb *hif_dev, struct sk_buff *buf,
 			       struct hif_usb_tx_pipe *tx_pipe)
 {
-	unsigned long flags;
-	u16           idx;
-	struct UsbTxQ *TxQ;
-	int           r = 0;
+	unsigned long  flags;
+	u16            idx;
+	struct sk_buff *TxQ;
+	int            r = 0;
 
 	spin_lock_irqsave(&(hif_dev->cs_lock), flags);
 
@@ -744,8 +743,7 @@ static u16 zfLnxPutUsbTxBuffer(struct hif_device_usb *hif_dev, struct sk_buff *b
 		goto out;
 	}
 
-	TxQ = (struct UsbTxQ *) &(tx_pipe->UsbTxBufQ[tx_pipe->TxBufTail]);
-	TxQ->buf = buf;
+	TxQ = (struct sk_buff *) &(tx_pipe->UsbTxBufQ[tx_pipe->TxBufTail]);
 	tx_pipe->TxBufTail = ((tx_pipe->TxBufTail + 1) &
 			       (ZM_MAX_TX_BUF_NUM - 1));
 	tx_pipe->TxBufCnt++;
-- 
1.5.6.5




More information about the devel mailing list