Commit 5faf3300 authored by Matthias Beyer's avatar Matthias Beyer Committed by Greg Kroah-Hartman

Staging: bcm: InterfaceTx.c: Shortened lines + Whitespace cleanup

Signed-off-by: default avatarMatthias Beyer <mail@beyermatthias.de>
Acked-by: default avatarKevin McKinney <klmckinney1@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 8139b8d5
...@@ -5,37 +5,47 @@ static void write_bulk_callback(struct urb *urb/*, struct pt_regs *regs*/) ...@@ -5,37 +5,47 @@ static void write_bulk_callback(struct urb *urb/*, struct pt_regs *regs*/)
{ {
struct bcm_usb_tcb *pTcb = (struct bcm_usb_tcb *)urb->context; struct bcm_usb_tcb *pTcb = (struct bcm_usb_tcb *)urb->context;
struct bcm_interface_adapter *psIntfAdapter = pTcb->psIntfAdapter; struct bcm_interface_adapter *psIntfAdapter = pTcb->psIntfAdapter;
struct bcm_link_request *pControlMsg = (struct bcm_link_request *)urb->transfer_buffer; struct bcm_link_request *pControlMsg =
(struct bcm_link_request *)urb->transfer_buffer;
struct bcm_mini_adapter *psAdapter = psIntfAdapter->psAdapter; struct bcm_mini_adapter *psAdapter = psIntfAdapter->psAdapter;
bool bpowerDownMsg = false; bool bpowerDownMsg = false;
struct bcm_mini_adapter *Adapter = GET_BCM_ADAPTER(gblpnetdev); struct bcm_mini_adapter *Adapter = GET_BCM_ADAPTER(gblpnetdev);
if (unlikely(netif_msg_tx_done(Adapter))) if (unlikely(netif_msg_tx_done(Adapter)))
pr_info(PFX "%s: transmit status %d\n", Adapter->dev->name, urb->status); pr_info(PFX "%s: transmit status %d\n", Adapter->dev->name,
urb->status);
if (urb->status != STATUS_SUCCESS) { if (urb->status != STATUS_SUCCESS) {
if (urb->status == -EPIPE) { if (urb->status == -EPIPE) {
psIntfAdapter->psAdapter->bEndPointHalted = TRUE; psIntfAdapter->psAdapter->bEndPointHalted = TRUE;
wake_up(&psIntfAdapter->psAdapter->tx_packet_wait_queue); wake_up(&psIntfAdapter->psAdapter->tx_packet_wait_queue);
} else { } else {
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, NEXT_SEND, DBG_LVL_ALL, "Tx URB has got cancelled. status :%d", urb->status); BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, NEXT_SEND,
DBG_LVL_ALL,
"Tx URB has got cancelled. status :%d",
urb->status);
} }
} }
pTcb->bUsed = false; pTcb->bUsed = false;
atomic_dec(&psIntfAdapter->uNumTcbUsed); atomic_dec(&psIntfAdapter->uNumTcbUsed);
if (TRUE == psAdapter->bPreparingForLowPowerMode) { if (TRUE == psAdapter->bPreparingForLowPowerMode) {
if (((pControlMsg->szData[0] == GO_TO_IDLE_MODE_PAYLOAD) && if (((pControlMsg->szData[0] == GO_TO_IDLE_MODE_PAYLOAD) &&
(pControlMsg->szData[1] == TARGET_CAN_GO_TO_IDLE_MODE))) { (pControlMsg->szData[1] ==
TARGET_CAN_GO_TO_IDLE_MODE))) {
bpowerDownMsg = TRUE; bpowerDownMsg = TRUE;
/* This covers the bus err while Idle Request msg sent down. */ /*
* This covers the bus err while Idle Request msg
* sent down.
*/
if (urb->status != STATUS_SUCCESS) { if (urb->status != STATUS_SUCCESS) {
psAdapter->bPreparingForLowPowerMode = false; psAdapter->bPreparingForLowPowerMode = false;
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, NEXT_SEND, DBG_LVL_ALL, "Idle Mode Request msg failed to reach to Modem"); BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, NEXT_SEND,
DBG_LVL_ALL,
"Idle Mode Request msg failed to reach to Modem");
/* Signalling the cntrl pkt path in Ioctl */ /* Signalling the cntrl pkt path in Ioctl */
wake_up(&psAdapter->lowpower_mode_wait_queue); wake_up(&psAdapter->lowpower_mode_wait_queue);
StartInterruptUrb(psIntfAdapter); StartInterruptUrb(psIntfAdapter);
...@@ -47,19 +57,28 @@ static void write_bulk_callback(struct urb *urb/*, struct pt_regs *regs*/) ...@@ -47,19 +57,28 @@ static void write_bulk_callback(struct urb *urb/*, struct pt_regs *regs*/)
/* since going in Idle mode completed hence making this var false */ /* since going in Idle mode completed hence making this var false */
psAdapter->bPreparingForLowPowerMode = false; psAdapter->bPreparingForLowPowerMode = false;
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, NEXT_SEND, DBG_LVL_ALL, "Host Entered in Idle Mode State..."); BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, NEXT_SEND,
DBG_LVL_ALL,
"Host Entered in Idle Mode State...");
/* Signalling the cntrl pkt path in Ioctl*/ /* Signalling the cntrl pkt path in Ioctl*/
wake_up(&psAdapter->lowpower_mode_wait_queue); wake_up(&psAdapter->lowpower_mode_wait_queue);
} }
} else if ((pControlMsg->Leader.Status == LINK_UP_CONTROL_REQ) && } else if ((pControlMsg->Leader.Status ==
LINK_UP_CONTROL_REQ) &&
(pControlMsg->szData[0] == LINK_UP_ACK) && (pControlMsg->szData[0] == LINK_UP_ACK) &&
(pControlMsg->szData[1] == LINK_SHUTDOWN_REQ_FROM_FIRMWARE) && (pControlMsg->szData[1] ==
LINK_SHUTDOWN_REQ_FROM_FIRMWARE) &&
(pControlMsg->szData[2] == SHUTDOWN_ACK_FROM_DRIVER)) { (pControlMsg->szData[2] == SHUTDOWN_ACK_FROM_DRIVER)) {
/* This covers the bus err while shutdown Request msg sent down. */ /*
* This covers the bus err while shutdown Request
* msg sent down.
*/
if (urb->status != STATUS_SUCCESS) { if (urb->status != STATUS_SUCCESS) {
psAdapter->bPreparingForLowPowerMode = false; psAdapter->bPreparingForLowPowerMode = false;
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, NEXT_SEND, DBG_LVL_ALL, "Shutdown Request Msg failed to reach to Modem"); BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, NEXT_SEND,
DBG_LVL_ALL,
"Shutdown Request Msg failed to reach to Modem");
/* Signalling the cntrl pkt path in Ioctl */ /* Signalling the cntrl pkt path in Ioctl */
wake_up(&psAdapter->lowpower_mode_wait_queue); wake_up(&psAdapter->lowpower_mode_wait_queue);
StartInterruptUrb(psIntfAdapter); StartInterruptUrb(psIntfAdapter);
...@@ -69,9 +88,14 @@ static void write_bulk_callback(struct urb *urb/*, struct pt_regs *regs*/) ...@@ -69,9 +88,14 @@ static void write_bulk_callback(struct urb *urb/*, struct pt_regs *regs*/)
bpowerDownMsg = TRUE; bpowerDownMsg = TRUE;
if (psAdapter->bDoSuspend == false) { if (psAdapter->bDoSuspend == false) {
psAdapter->bShutStatus = TRUE; psAdapter->bShutStatus = TRUE;
/* since going in shutdown mode completed hence making this var false */ /*
* since going in shutdown mode completed hence
* making this var false
*/
psAdapter->bPreparingForLowPowerMode = false; psAdapter->bPreparingForLowPowerMode = false;
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, NEXT_SEND, DBG_LVL_ALL, "Host Entered in shutdown Mode State..."); BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, NEXT_SEND,
DBG_LVL_ALL,
"Host Entered in shutdown Mode State...");
/* Signalling the cntrl pkt path in Ioctl */ /* Signalling the cntrl pkt path in Ioctl */
wake_up(&psAdapter->lowpower_mode_wait_queue); wake_up(&psAdapter->lowpower_mode_wait_queue);
} }
...@@ -79,7 +103,9 @@ static void write_bulk_callback(struct urb *urb/*, struct pt_regs *regs*/) ...@@ -79,7 +103,9 @@ static void write_bulk_callback(struct urb *urb/*, struct pt_regs *regs*/)
if (psAdapter->bDoSuspend && bpowerDownMsg) { if (psAdapter->bDoSuspend && bpowerDownMsg) {
/* issuing bus suspend request */ /* issuing bus suspend request */
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, NEXT_SEND, DBG_LVL_ALL, "Issuing the Bus suspend request to USB stack"); BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, NEXT_SEND,
DBG_LVL_ALL,
"Issuing the Bus suspend request to USB stack");
psIntfAdapter->bPreparingForBusSuspend = TRUE; psIntfAdapter->bPreparingForBusSuspend = TRUE;
schedule_work(&psIntfAdapter->usbSuspendWork); schedule_work(&psIntfAdapter->usbSuspendWork);
...@@ -104,8 +130,11 @@ static struct bcm_usb_tcb *GetBulkOutTcb(struct bcm_interface_adapter *psIntfAda ...@@ -104,8 +130,11 @@ static struct bcm_usb_tcb *GetBulkOutTcb(struct bcm_interface_adapter *psIntfAda
pTcb = &psIntfAdapter->asUsbTcb[index]; pTcb = &psIntfAdapter->asUsbTcb[index];
pTcb->bUsed = TRUE; pTcb->bUsed = TRUE;
pTcb->psIntfAdapter = psIntfAdapter; pTcb->psIntfAdapter = psIntfAdapter;
BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_TX, NEXT_SEND, DBG_LVL_ALL, "Got Tx desc %d used %d", BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_TX,
index, atomic_read(&psIntfAdapter->uNumTcbUsed)); NEXT_SEND, DBG_LVL_ALL,
"Got Tx desc %d used %d",
index,
atomic_read(&psIntfAdapter->uNumTcbUsed));
index = (index + 1) % MAXIMUM_USB_TCB; index = (index + 1) % MAXIMUM_USB_TCB;
atomic_set(&psIntfAdapter->uCurrTcb, index); atomic_set(&psIntfAdapter->uCurrTcb, index);
atomic_inc(&psIntfAdapter->uNumTcbUsed); atomic_inc(&psIntfAdapter->uNumTcbUsed);
...@@ -113,7 +142,8 @@ static struct bcm_usb_tcb *GetBulkOutTcb(struct bcm_interface_adapter *psIntfAda ...@@ -113,7 +142,8 @@ static struct bcm_usb_tcb *GetBulkOutTcb(struct bcm_interface_adapter *psIntfAda
return pTcb; return pTcb;
} }
static int TransmitTcb(struct bcm_interface_adapter *psIntfAdapter, struct bcm_usb_tcb *pTcb, PVOID data, int len) static int TransmitTcb(struct bcm_interface_adapter *psIntfAdapter,
struct bcm_usb_tcb *pTcb, PVOID data, int len)
{ {
struct urb *urb = pTcb->urb; struct urb *urb = pTcb->urb;
...@@ -122,15 +152,18 @@ static int TransmitTcb(struct bcm_interface_adapter *psIntfAdapter, struct bcm_u ...@@ -122,15 +152,18 @@ static int TransmitTcb(struct bcm_interface_adapter *psIntfAdapter, struct bcm_u
urb->transfer_buffer = usb_alloc_coherent(psIntfAdapter->udev, len, urb->transfer_buffer = usb_alloc_coherent(psIntfAdapter->udev, len,
GFP_ATOMIC, &urb->transfer_dma); GFP_ATOMIC, &urb->transfer_dma);
if (!urb->transfer_buffer) { if (!urb->transfer_buffer) {
BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_PRINTK, 0, 0, "Error allocating memory\n"); BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_PRINTK, 0, 0,
"Error allocating memory\n");
return -ENOMEM; return -ENOMEM;
} }
memcpy(urb->transfer_buffer, data, len); memcpy(urb->transfer_buffer, data, len);
urb->transfer_buffer_length = len; urb->transfer_buffer_length = len;
BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_TX, NEXT_SEND, DBG_LVL_ALL, "Sending Bulk out packet\n"); BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_TX, NEXT_SEND,
DBG_LVL_ALL, "Sending Bulk out packet\n");
/* For T3B,INT OUT end point will be used as bulk out end point */ /* For T3B,INT OUT end point will be used as bulk out end point */
if ((psIntfAdapter->psAdapter->chip_id == T3B) && (psIntfAdapter->bHighSpeedDevice == TRUE)) { if ((psIntfAdapter->psAdapter->chip_id == T3B) &&
(psIntfAdapter->bHighSpeedDevice == TRUE)) {
usb_fill_int_urb(urb, psIntfAdapter->udev, usb_fill_int_urb(urb, psIntfAdapter->udev,
psIntfAdapter->sBulkOut.bulk_out_pipe, psIntfAdapter->sBulkOut.bulk_out_pipe,
urb->transfer_buffer, len, write_bulk_callback, pTcb, urb->transfer_buffer, len, write_bulk_callback, pTcb,
...@@ -148,7 +181,10 @@ static int TransmitTcb(struct bcm_interface_adapter *psIntfAdapter, struct bcm_u ...@@ -148,7 +181,10 @@ static int TransmitTcb(struct bcm_interface_adapter *psIntfAdapter, struct bcm_u
false == psIntfAdapter->bPreparingForBusSuspend) { false == psIntfAdapter->bPreparingForBusSuspend) {
retval = usb_submit_urb(urb, GFP_ATOMIC); retval = usb_submit_urb(urb, GFP_ATOMIC);
if (retval) { if (retval) {
BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_TX, NEXT_SEND, DBG_LVL_ALL, "failed submitting write urb, error %d", retval); BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_TX,
NEXT_SEND, DBG_LVL_ALL,
"failed submitting write urb, error %d",
retval);
if (retval == -EPIPE) { if (retval == -EPIPE) {
psIntfAdapter->psAdapter->bEndPointHalted = TRUE; psIntfAdapter->psAdapter->bEndPointHalted = TRUE;
wake_up(&psIntfAdapter->psAdapter->tx_packet_wait_queue); wake_up(&psIntfAdapter->psAdapter->tx_packet_wait_queue);
...@@ -165,10 +201,10 @@ int InterfaceTransmitPacket(PVOID arg, PVOID data, UINT len) ...@@ -165,10 +201,10 @@ int InterfaceTransmitPacket(PVOID arg, PVOID data, UINT len)
struct bcm_interface_adapter *psIntfAdapter = arg; struct bcm_interface_adapter *psIntfAdapter = arg;
pTcb = GetBulkOutTcb(psIntfAdapter); pTcb = GetBulkOutTcb(psIntfAdapter);
if (pTcb == NULL) { if (pTcb == NULL) {
BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_PRINTK, 0, 0, "No URB to transmit packet, dropping packet"); BCM_DEBUG_PRINT(psIntfAdapter->psAdapter, DBG_TYPE_PRINTK, 0, 0,
"No URB to transmit packet, dropping packet");
return -EFAULT; return -EFAULT;
} }
return TransmitTcb(psIntfAdapter, pTcb, data, len); return TransmitTcb(psIntfAdapter, pTcb, data, len);
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment