Commit 66d00813 authored by Christian Lamparter's avatar Christian Lamparter Committed by John W. Linville

ar9170usb: more minor fixes

This patch contains a few more mostly random fixes for the USB front-end.

1. handle irq command response, instead of printing it to the console.

2. remove fixed FIXME.
    (real fix: "ar9170usb: reset device on resume". )

3. some more one-liner.
	- get rid of a useless "return;"
	- add a few branch prediction hints in hot-paths
	etc.
Signed-off-by: default avatarChristian Lamparter <chunkeey@web.de>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent b55d6bcf
...@@ -207,6 +207,7 @@ void ar9170_rx(struct ar9170 *ar, struct sk_buff *skb); ...@@ -207,6 +207,7 @@ void ar9170_rx(struct ar9170 *ar, struct sk_buff *skb);
void ar9170_unregister(struct ar9170 *ar); void ar9170_unregister(struct ar9170 *ar);
void ar9170_handle_tx_status(struct ar9170 *ar, struct sk_buff *skb, void ar9170_handle_tx_status(struct ar9170 *ar, struct sk_buff *skb,
bool update_statistics, u16 tx_status); bool update_statistics, u16 tx_status);
void ar9170_handle_command_response(struct ar9170 *ar, void *buf, u32 len);
/* MAC */ /* MAC */
int ar9170_op_tx(struct ieee80211_hw *hw, struct sk_buff *skb); int ar9170_op_tx(struct ieee80211_hw *hw, struct sk_buff *skb);
......
...@@ -370,8 +370,7 @@ static void ar9170_tx_status_janitor(struct work_struct *work) ...@@ -370,8 +370,7 @@ static void ar9170_tx_status_janitor(struct work_struct *work)
msecs_to_jiffies(100)); msecs_to_jiffies(100));
} }
static void ar9170_handle_command_response(struct ar9170 *ar, void ar9170_handle_command_response(struct ar9170 *ar, void *buf, u32 len)
void *buf, u32 len)
{ {
struct ar9170_cmd_response *cmd = (void *) buf; struct ar9170_cmd_response *cmd = (void *) buf;
......
...@@ -102,7 +102,7 @@ static void ar9170_usb_tx_urb_complete_free(struct urb *urb) ...@@ -102,7 +102,7 @@ static void ar9170_usb_tx_urb_complete_free(struct urb *urb)
struct ar9170_usb *aru = (struct ar9170_usb *) struct ar9170_usb *aru = (struct ar9170_usb *)
usb_get_intfdata(usb_ifnum_to_if(urb->dev, 0)); usb_get_intfdata(usb_ifnum_to_if(urb->dev, 0));
if (!aru) { if (unlikely(!aru)) {
dev_kfree_skb_irq(skb); dev_kfree_skb_irq(skb);
return ; return ;
} }
...@@ -135,8 +135,8 @@ static void ar9170_usb_irq_completed(struct urb *urb) ...@@ -135,8 +135,8 @@ static void ar9170_usb_irq_completed(struct urb *urb)
goto resubmit; goto resubmit;
} }
print_hex_dump_bytes("ar9170 irq: ", DUMP_PREFIX_OFFSET, ar9170_handle_command_response(&aru->common, urb->transfer_buffer,
urb->transfer_buffer, urb->actual_length); urb->actual_length);
resubmit: resubmit:
usb_anchor_urb(urb, &aru->rx_submitted); usb_anchor_urb(urb, &aru->rx_submitted);
...@@ -186,16 +186,15 @@ static void ar9170_usb_rx_completed(struct urb *urb) ...@@ -186,16 +186,15 @@ static void ar9170_usb_rx_completed(struct urb *urb)
usb_anchor_urb(urb, &aru->rx_submitted); usb_anchor_urb(urb, &aru->rx_submitted);
err = usb_submit_urb(urb, GFP_ATOMIC); err = usb_submit_urb(urb, GFP_ATOMIC);
if (err) { if (unlikely(err)) {
usb_unanchor_urb(urb); usb_unanchor_urb(urb);
dev_kfree_skb_irq(skb); goto free;
} }
return ; return ;
free: free:
dev_kfree_skb_irq(skb); dev_kfree_skb_irq(skb);
return;
} }
static int ar9170_usb_prep_rx_urb(struct ar9170_usb *aru, static int ar9170_usb_prep_rx_urb(struct ar9170_usb *aru,
...@@ -346,7 +345,7 @@ static int ar9170_usb_exec_cmd(struct ar9170 *ar, enum ar9170_cmd cmd, ...@@ -346,7 +345,7 @@ static int ar9170_usb_exec_cmd(struct ar9170 *ar, enum ar9170_cmd cmd,
usb_anchor_urb(urb, &aru->tx_submitted); usb_anchor_urb(urb, &aru->tx_submitted);
err = usb_submit_urb(urb, GFP_ATOMIC); err = usb_submit_urb(urb, GFP_ATOMIC);
if (err) { if (unlikely(err)) {
usb_unanchor_urb(urb); usb_unanchor_urb(urb);
usb_free_urb(urb); usb_free_urb(urb);
goto err_unbuf; goto err_unbuf;
...@@ -427,7 +426,7 @@ static void ar9170_usb_callback_cmd(struct ar9170 *ar, u32 len , void *buffer) ...@@ -427,7 +426,7 @@ static void ar9170_usb_callback_cmd(struct ar9170 *ar, u32 len , void *buffer)
unsigned long flags; unsigned long flags;
u32 in, out; u32 in, out;
if (!buffer) if (unlikely(!buffer))
return ; return ;
in = le32_to_cpup((__le32 *)buffer); in = le32_to_cpup((__le32 *)buffer);
...@@ -728,7 +727,7 @@ static int ar9170_usb_probe(struct usb_interface *intf, ...@@ -728,7 +727,7 @@ static int ar9170_usb_probe(struct usb_interface *intf,
#ifdef CONFIG_PM #ifdef CONFIG_PM
udev->reset_resume = 1; udev->reset_resume = 1;
#endif #endif /* CONFIG_PM */
err = ar9170_usb_reset(aru); err = ar9170_usb_reset(aru);
if (err) if (err)
goto err_freehw; goto err_freehw;
...@@ -813,11 +812,6 @@ static int ar9170_resume(struct usb_interface *intf) ...@@ -813,11 +812,6 @@ static int ar9170_resume(struct usb_interface *intf)
usb_unpoison_anchored_urbs(&aru->rx_submitted); usb_unpoison_anchored_urbs(&aru->rx_submitted);
usb_unpoison_anchored_urbs(&aru->tx_submitted); usb_unpoison_anchored_urbs(&aru->tx_submitted);
/*
* FIXME: firmware upload will fail on resume.
* but this is better than a hang!
*/
err = ar9170_usb_init_device(aru); err = ar9170_usb_init_device(aru);
if (err) if (err)
goto err_unrx; goto err_unrx;
......
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