diff mbox

[1/3] rt2x00usb: initialize the read value in case of failure

Message ID 20150318131124.GA11724@redhat.com (mailing list archive)
State Not Applicable
Delegated to: Kalle Valo
Headers show

Commit Message

Stanislaw Gruszka March 18, 2015, 1:11 p.m. UTC
On Tue, Mar 17, 2015 at 09:34:14AM +0100, Sebastian Andrzej Siewior wrote:
> I have no idea what AutoRun mode is (it seems that the stick already
> has a firmware and is happy with it) and I have no clue why the firmware
> decides to lie about it. I looked at the vendor driver I found at github
> (which seems to be from 2012-10-22, DPO_RT5572_LinuxSTA_2.6.1.3) and
> well, I look again if someone says it is worth looking… They seem to do
> some kind "firmware is comming" magic which might be already done in the
> current driver at a different spot but I think the main question is why
> request is answered wrong. I *think* the vendor driver sends the
> USB_MODE_AUTORUN request only once but it is hard to tell…

Does the below patch solve the issue ?


--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Sebastian Andrzej Siewior March 19, 2015, 1:24 p.m. UTC | #1
On 03/18/2015 02:11 PM, Stanislaw Gruszka wrote:
> On Tue, Mar 17, 2015 at 09:34:14AM +0100, Sebastian Andrzej Siewior wrote:
>> I have no idea what AutoRun mode is (it seems that the stick already
>> has a firmware and is happy with it) and I have no clue why the firmware
>> decides to lie about it. I looked at the vendor driver I found at github
>> (which seems to be from 2012-10-22, DPO_RT5572_LinuxSTA_2.6.1.3) and
>> well, I look again if someone says it is worth looking… They seem to do
>> some kind "firmware is comming" magic which might be already done in the
>> current driver at a different spot but I think the main question is why
>> request is answered wrong. I *think* the vendor driver sends the
>> USB_MODE_AUTORUN request only once but it is hard to tell…
> 
> Does the below patch solve the issue ?

So you kill the please-load-the-firware bit and avoid further questions
regarding its state. Yes, it helps as in my test-case is now running
for ~15h. I see the "NIC in AutoRun mode" just once. Thanks.

I am still curious why it answers wrong but lets hope the first answer
is correct :)

> 
> diff --git a/drivers/net/wireless/rt2x00/rt2800usb.c b/drivers/net/wireless/rt2x00/rt2800usb.c
> index 9a2f44a..3a6cae8 100644
> --- a/drivers/net/wireless/rt2x00/rt2800usb.c
> +++ b/drivers/net/wireless/rt2x00/rt2800usb.c
> @@ -293,6 +293,7 @@ static int rt2800usb_write_firmware(struct rt2x00_dev *rt2x00dev,
>  	if (retval) {
>  		rt2x00_info(rt2x00dev,
>  			    "Firmware loading not required - NIC in AutoRun mode\n");
> +		__clear_bit(REQUIRE_FIRMWARE, &rt2x00dev->cap_flags);
>  	} else {
>  		rt2x00usb_register_multiwrite(rt2x00dev, FIRMWARE_IMAGE_BASE,
>  					      data + offset, length);
> 
Sebastian
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Stanislaw Gruszka March 19, 2015, 2:30 p.m. UTC | #2
On Thu, Mar 19, 2015 at 02:24:02PM +0100, Sebastian Andrzej Siewior wrote:
> On 03/18/2015 02:11 PM, Stanislaw Gruszka wrote:
> > On Tue, Mar 17, 2015 at 09:34:14AM +0100, Sebastian Andrzej Siewior wrote:
> >> I have no idea what AutoRun mode is (it seems that the stick already
> >> has a firmware and is happy with it) and I have no clue why the firmware
> >> decides to lie about it. I looked at the vendor driver I found at github
> >> (which seems to be from 2012-10-22, DPO_RT5572_LinuxSTA_2.6.1.3) and
> >> well, I look again if someone says it is worth looking… They seem to do
> >> some kind "firmware is comming" magic which might be already done in the
> >> current driver at a different spot but I think the main question is why
> >> request is answered wrong. I *think* the vendor driver sends the
> >> USB_MODE_AUTORUN request only once but it is hard to tell…
> > 
> > Does the below patch solve the issue ?
> 
> So you kill the please-load-the-firware bit and avoid further questions
> regarding its state. Yes, it helps as in my test-case is now running
> for ~15h. I see the "NIC in AutoRun mode" just once. Thanks.
> 
> I am still curious why it answers wrong but lets hope the first answer
> is correct :)

I don't know, perhaps this value is only valid at initialization stage.
Looks that vendor driver reads it only once and saves it as flag in the
memory.

Stanislaw
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/net/wireless/rt2x00/rt2800usb.c b/drivers/net/wireless/rt2x00/rt2800usb.c
index 9a2f44a..3a6cae8 100644
--- a/drivers/net/wireless/rt2x00/rt2800usb.c
+++ b/drivers/net/wireless/rt2x00/rt2800usb.c
@@ -293,6 +293,7 @@  static int rt2800usb_write_firmware(struct rt2x00_dev *rt2x00dev,
 	if (retval) {
 		rt2x00_info(rt2x00dev,
 			    "Firmware loading not required - NIC in AutoRun mode\n");
+		__clear_bit(REQUIRE_FIRMWARE, &rt2x00dev->cap_flags);
 	} else {
 		rt2x00usb_register_multiwrite(rt2x00dev, FIRMWARE_IMAGE_BASE,
 					      data + offset, length);