2010-04-23 04:58:38

by Sujith

[permalink] [raw]
Subject: [PATCH 07/11] ath9k_htc: Use USB reboot

So, apparently there is a USB reboot command
that the target accepts. Using this instead of
usb_reset_device() fixes the issue of "descriptor read error"
that pops up on repeated load/unload.

Signed-off-by: Sujith <[email protected]>
---
drivers/net/wireless/ath/ath9k/hif_usb.c | 22 +++++++++++++++++++++-
1 files changed, 21 insertions(+), 1 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/hif_usb.c b/drivers/net/wireless/ath/ath9k/hif_usb.c
index cee5feb..31665c5 100644
--- a/drivers/net/wireless/ath/ath9k/hif_usb.c
+++ b/drivers/net/wireless/ath/ath9k/hif_usb.c
@@ -889,6 +889,26 @@ err_alloc:
return ret;
}

+static void ath9k_hif_usb_reboot(struct usb_device *udev)
+{
+ u32 reboot_cmd = 0xffffffff;
+ void *buf;
+ int ret;
+
+ buf = kmalloc(4, GFP_KERNEL);
+ if (!buf)
+ return;
+
+ memcpy(buf, &reboot_cmd, 4);
+
+ ret = usb_bulk_msg(udev, usb_sndbulkpipe(udev, USB_REG_OUT_PIPE),
+ buf, 4, NULL, HZ);
+ if (ret)
+ dev_err(&udev->dev, "ath9k_htc: USB reboot failed\n");
+
+ kfree(buf);
+}
+
static void ath9k_hif_usb_disconnect(struct usb_interface *interface)
{
struct usb_device *udev = interface_to_usbdev(interface);
@@ -903,7 +923,7 @@ static void ath9k_hif_usb_disconnect(struct usb_interface *interface)
}

if (hif_dev->flags & HIF_USB_START)
- usb_reset_device(udev);
+ ath9k_hif_usb_reboot(udev);

kfree(hif_dev);
dev_info(&udev->dev, "ath9k_htc: USB layer deinitialized\n");
--
1.7.0.5



2010-04-30 20:33:58

by Kalle Valo

[permalink] [raw]
Subject: Re: [PATCH 07/11] ath9k_htc: Use USB reboot

Sujith <[email protected]> writes:

> So, apparently there is a USB reboot command
> that the target accepts. Using this instead of
> usb_reset_device() fixes the issue of "descriptor read error"
> that pops up on repeated load/unload.

[...]

> +static void ath9k_hif_usb_reboot(struct usb_device *udev)
> +{
> + u32 reboot_cmd = 0xffffffff;

A define for the actual command value would be nice here.

--
Kalle Valo

2010-04-23 20:19:04

by Gábor Stefanik

[permalink] [raw]
Subject: Re: [PATCH 07/11] ath9k_htc: Use USB reboot

On Fri, Apr 23, 2010 at 6:58 AM, Sujith <[email protected]> wrote:
> So, apparently there is a USB reboot command
> that the target accepts. Using this instead of
> usb_reset_device() fixes the issue of "descriptor read error"
> that pops up on repeated load/unload.
>
> Signed-off-by: Sujith <[email protected]>
> ---
> ?drivers/net/wireless/ath/ath9k/hif_usb.c | ? 22 +++++++++++++++++++++-
> ?1 files changed, 21 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/net/wireless/ath/ath9k/hif_usb.c b/drivers/net/wireless/ath/ath9k/hif_usb.c
> index cee5feb..31665c5 100644
> --- a/drivers/net/wireless/ath/ath9k/hif_usb.c
> +++ b/drivers/net/wireless/ath/ath9k/hif_usb.c
> @@ -889,6 +889,26 @@ err_alloc:
> ? ? ? ?return ret;
> ?}
>
> +static void ath9k_hif_usb_reboot(struct usb_device *udev)
> +{
> + ? ? ? u32 reboot_cmd = 0xffffffff;
> + ? ? ? void *buf;
> + ? ? ? int ret;
> +
> + ? ? ? buf = kmalloc(4, GFP_KERNEL);
> + ? ? ? if (!buf)
> + ? ? ? ? ? ? ? return;
> +
> + ? ? ? memcpy(buf, &reboot_cmd, 4);
> +
> + ? ? ? ret = usb_bulk_msg(udev, usb_sndbulkpipe(udev, USB_REG_OUT_PIPE),
> + ? ? ? ? ? ? ? ? ? ? ? ? ?buf, 4, NULL, HZ);
> + ? ? ? if (ret)
> + ? ? ? ? ? ? ? dev_err(&udev->dev, "ath9k_htc: USB reboot failed\n");
> +
> + ? ? ? kfree(buf);
> +}
> +
> ?static void ath9k_hif_usb_disconnect(struct usb_interface *interface)
> ?{
> ? ? ? ?struct usb_device *udev = interface_to_usbdev(interface);
> @@ -903,7 +923,7 @@ static void ath9k_hif_usb_disconnect(struct usb_interface *interface)
> ? ? ? ?}
>
> ? ? ? ?if (hif_dev->flags & HIF_USB_START)
> - ? ? ? ? ? ? ? usb_reset_device(udev);
> + ? ? ? ? ? ? ? ath9k_hif_usb_reboot(udev);
>
> ? ? ? ?kfree(hif_dev);
> ? ? ? ?dev_info(&udev->dev, "ath9k_htc: USB layer deinitialized\n");
> --
> 1.7.0.5
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
> the body of a message to [email protected]
> More majordomo info at ?http://vger.kernel.org/majordomo-info.html
>

This patch seems to be the wrong way around... or is it supposed to be
applied using "patch -R"?

--
Vista: [V]iruses, [I]ntruders, [S]pyware, [T]rojans and [A]dware. :-)

2010-04-24 00:47:34

by Sujith

[permalink] [raw]
Subject: Re: [PATCH 07/11] ath9k_htc: Use USB reboot

G bor Stefanik wrote:
> This patch seems to be the wrong way around... or is it supposed to be
> applied using "patch -R"?

What's wrong ?

Sujith

2010-04-24 01:39:00

by Gábor Stefanik

[permalink] [raw]
Subject: Re: [PATCH 07/11] ath9k_htc: Use USB reboot

2010/4/24 Sujith <[email protected]>:
> G bor Stefanik wrote:
>> This patch seems to be the wrong way around... or is it supposed to be
>> applied using "patch -R"?
>
> What's wrong ?
>
> Sujith
>

Sorry... I apparently thought you were trying to *remove* USB reboot
support, rather than add it.
--
Vista: [V]iruses, [I]ntruders, [S]pyware, [T]rojans and [A]dware. :-)

2010-05-06 09:11:58

by Sujith

[permalink] [raw]
Subject: Re: [PATCH 07/11] ath9k_htc: Use USB reboot

Kalle Valo wrote:
> Sujith <[email protected]> writes:
>
> > So, apparently there is a USB reboot command
> > that the target accepts. Using this instead of
> > usb_reset_device() fixes the issue of "descriptor read error"
> > that pops up on repeated load/unload.
>
> [...]
>
> > +static void ath9k_hif_usb_reboot(struct usb_device *udev)
> > +{
> > + u32 reboot_cmd = 0xffffffff;
>
> A define for the actual command value would be nice here.

Sorry, I was out and John has merged this patch.
Will do this later, thanks for the review.

Sujith