All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] orinoco: reload firmware on resume
@ 2008-10-11 14:16 Andrey Borzenkov
  2008-10-11 17:42 ` Dave
  0 siblings, 1 reply; 7+ messages in thread
From: Andrey Borzenkov @ 2008-10-11 14:16 UTC (permalink / raw)
  To: orinoco-devel, linux-wireless

[-- Attachment #1: Type: text/plain, Size: 1305 bytes --]

On resume card state is likely lost so we have to reload firmware
again.

Signed-off-by: Andrey Borzenkov <arvidjaar@mail.ru>

---

This is non-functional without second patch. Currently you simply
have no way to load request firmware from user space in ->resume.

 drivers/net/wireless/orinoco.c |   13 ++++++-------
 1 files changed, 6 insertions(+), 7 deletions(-)


diff --git a/drivers/net/wireless/orinoco.c b/drivers/net/wireless/orinoco.c
index 1f9dcc4..76c480b 100644
--- a/drivers/net/wireless/orinoco.c
+++ b/drivers/net/wireless/orinoco.c
@@ -2298,9 +2298,14 @@ int orinoco_reinit_firmware(struct net_device *dev)
 {
 	struct orinoco_private *priv = netdev_priv(dev);
 	struct hermes *hw = &priv->hw;
-	int err;
+	int err = 0;
 
 	err = hermes_init(hw);
+	if (priv->do_fw_download && !err) {
+		err = orinoco_download(priv);
+		if (err)
+			priv->do_fw_download = 0;
+	}
 	if (!err)
 		err = orinoco_allocate_fid(dev);
 
@@ -2926,12 +2931,6 @@ static void orinoco_reset(struct work_struct *work)
 		}
 	}
 
-	if (priv->do_fw_download) {
-		err = orinoco_download(priv);
-		if (err)
-			priv->do_fw_download = 0;
-	}
-
 	err = orinoco_reinit_firmware(dev);
 	if (err) {
 		printk(KERN_ERR "%s: orinoco_reset: Error %d re-initializing firmware\n",

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/2] orinoco: reload firmware on resume
  2008-10-11 14:16 Andrey Borzenkov
@ 2008-10-11 17:42 ` Dave
  2008-10-11 18:34   ` Andrey Borzenkov
  2008-10-12 12:36   ` Andrey Borzenkov
  0 siblings, 2 replies; 7+ messages in thread
From: Dave @ 2008-10-11 17:42 UTC (permalink / raw)
  To: Andrey Borzenkov; +Cc: orinoco-devel, linux-wireless

Andrey Borzenkov wrote:
> On resume card state is likely lost so we have to reload firmware
> again.
> 
> Signed-off-by: Andrey Borzenkov <arvidjaar@mail.ru>
> 
> ---
> 
> This is non-functional without second patch. Currently you simply
> have no way to load request firmware from user space in ->resume.

Does it work when you compile the firmware into the kernel image
with CONFIG_FIRMWARE_KERNEL, CONFIG_EXTRA_FIRMWARE and
CONFIG_EXTRA_FIRMWARE_DIR?
 
> --- a/drivers/net/wireless/orinoco.c
> +++ b/drivers/net/wireless/orinoco.c
> @@ -2298,9 +2298,14 @@ int orinoco_reinit_firmware(struct net_device *dev)
>  {
>  	struct orinoco_private *priv = netdev_priv(dev);
>  	struct hermes *hw = &priv->hw;
> -	int err;
> +	int err = 0;

The explicit initialisation is unneccesary.

>  	err = hermes_init(hw);
> +	if (priv->do_fw_download && !err) {

Otherwise this looks right.


Regards,

Dave.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/2] orinoco: reload firmware on resume
  2008-10-11 17:42 ` Dave
@ 2008-10-11 18:34   ` Andrey Borzenkov
  2008-10-12 12:36   ` Andrey Borzenkov
  1 sibling, 0 replies; 7+ messages in thread
From: Andrey Borzenkov @ 2008-10-11 18:34 UTC (permalink / raw)
  To: Dave; +Cc: orinoco-devel, linux-wireless

[-- Attachment #1: Type: text/plain, Size: 1866 bytes --]

On Saturday 11 October 2008, Dave wrote:
> Andrey Borzenkov wrote:
> > On resume card state is likely lost so we have to reload firmware
> > again.
> > 
> > Signed-off-by: Andrey Borzenkov <arvidjaar@mail.ru>
> > 
> > ---
> > 
> > This is non-functional without second patch. Currently you simply
> > have no way to load request firmware from user space in ->resume.
> 
> Does it work when you compile the firmware into the kernel image
> with CONFIG_FIRMWARE_KERNEL, CONFIG_EXTRA_FIRMWARE and
> CONFIG_EXTRA_FIRMWARE_DIR?
>  

I assume yes - but the resulting binary cannot be redistributed, so it
of little help; it means, orinoco driver in distributions still won't
work out of the box.

[From another mail]
> Spectrum_cs has had firmware download for a while. It achieves the firmware
> reload on resume by doing schedule_work(&priv->reset_work).
>
> Would the same work for orinoco_cs?

You (currently) have no way to synchronize reset_work with unfreezing
other tasks. It may work most of the time but it may as well fail every
now and then. Also spectrum_cs is obviously broken - it claims hardware
and interface are available *before* they are actiually available. This
again is hard to debug race condition.

It is planned to add pre-freeze notifiers; in this case we could use them
to load firmware before suspend. But right now I do not see how this situation
is different from compiling firmware in module except that it is more clean
from legal point of view.

Personally I prefer to use it right now (ideally in 2.6.28; do not know who
decides) and return to it later when we have better interfaces.

> > +	int err = 0;
> 
> The explicit initialisation is unneccesary.

OK it is leftover; I tried first to load firmware before hermes_init; it
worked for STR and failed for STD. I'll remove it; thank you.

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/2] orinoco: reload firmware on resume
  2008-10-11 17:42 ` Dave
  2008-10-11 18:34   ` Andrey Borzenkov
@ 2008-10-12 12:36   ` Andrey Borzenkov
  2008-10-15 19:31     ` Dave
  1 sibling, 1 reply; 7+ messages in thread
From: Andrey Borzenkov @ 2008-10-12 12:36 UTC (permalink / raw)
  To: Dave; +Cc: orinoco-devel, linux-wireless


[-- Attachment #1.1: Type: text/plain, Size: 109 bytes --]

On Saturday 11 October 2008, Dave wrote:
> > -	int err;
> > +	int err = 0;
> 

Fixed version attached.

[-- Attachment #1.2: 01-orinoco-reload-firmware-on-resume --]
[-- Type: text/x-diff, Size: 1160 bytes --]

Subject: [PATCH] orinoco: reload firmware on resume
From: Andrey Borzenkov <arvidjaar@mail.ru>

On resume card state is likely lost so we have to reload firmware
again.

Signed-off-by: Andrey Borzenkov <arvidjaar@mail.ru>

---

 drivers/net/wireless/orinoco.c |   11 +++++------
 1 files changed, 5 insertions(+), 6 deletions(-)


diff --git a/drivers/net/wireless/orinoco.c b/drivers/net/wireless/orinoco.c
index 3053605..7284ff5 100644
--- a/drivers/net/wireless/orinoco.c
+++ b/drivers/net/wireless/orinoco.c
@@ -2317,6 +2317,11 @@ int orinoco_reinit_firmware(struct net_device *dev)
 	int err;
 
 	err = hermes_init(hw);
+	if (priv->do_fw_download && !err) {
+		err = orinoco_download(priv);
+		if (err)
+			priv->do_fw_download = 0;
+	}
 	if (!err)
 		err = orinoco_allocate_fid(dev);
 
@@ -2942,12 +2947,6 @@ static void orinoco_reset(struct work_struct *work)
 		}
 	}
 
-	if (priv->do_fw_download) {
-		err = orinoco_download(priv);
-		if (err)
-			priv->do_fw_download = 0;
-	}
-
 	err = orinoco_reinit_firmware(dev);
 	if (err) {
 		printk(KERN_ERR "%s: orinoco_reset: Error %d re-initializing firmware\n",

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/2] orinoco: reload firmware on resume
  2008-10-12 12:36   ` Andrey Borzenkov
@ 2008-10-15 19:31     ` Dave
  2008-10-22 18:26       ` John W. Linville
  0 siblings, 1 reply; 7+ messages in thread
From: Dave @ 2008-10-15 19:31 UTC (permalink / raw)
  To: Andrey Borzenkov; +Cc: orinoco-devel, linux-wireless

Andrey Borzenkov wrote:
> On Saturday 11 October 2008, Dave wrote:
>>> -	int err;
>>> +	int err = 0;
> 
> Fixed version attached.

Acked-by: David Kilroy <kilroyd@googlemail.com>


Note that if the firmware download fails the card won't work because we no longer  allocate a fid. However even if we were to allocate a fid the driver flags would be inconsistent with the firmware capabilities, and the driver would just encounter a bunch of errors.

We should probably think about how we can fall back to the inbuilt firmware after a failed firmware download - but this can be done separately.


Regards,

Dave.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/2] orinoco: reload firmware on resume
  2008-10-15 19:31     ` Dave
@ 2008-10-22 18:26       ` John W. Linville
  0 siblings, 0 replies; 7+ messages in thread
From: John W. Linville @ 2008-10-22 18:26 UTC (permalink / raw)
  To: Dave; +Cc: Andrey Borzenkov, orinoco-devel, linux-wireless

On Wed, Oct 15, 2008 at 08:31:26PM +0100, Dave wrote:
> Andrey Borzenkov wrote:
>> On Saturday 11 October 2008, Dave wrote:
>>>> -	int err;
>>>> +	int err = 0;
>>
>> Fixed version attached.
>
> Acked-by: David Kilroy <kilroyd@googlemail.com>

Please repost this series with the finalized patches, rebased on the
current wireless-testing.  Also, please include the patches inline,
as your MIME encoding is confusing my tools.

John
-- 
John W. Linville		Linux should be at the core
linville@tuxdriver.com			of your literate lifestyle.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 1/2] orinoco: reload firmware on resume
@ 2008-10-26  8:21 Andrey Borzenkov
  0 siblings, 0 replies; 7+ messages in thread
From: Andrey Borzenkov @ 2008-10-26  8:21 UTC (permalink / raw)
  To: linux-wireless; +Cc: orinoco-devel

[-- Attachment #1: Type: text/plain, Size: 1307 bytes --]

From: Andrey Borzenkov <arvidjaar@mail.ru>
Date: Sun, 12 Oct 2008 20:15:43 +0400
Subject: [PATCH 1/2] orinoco: reload firmware on resume

On resume card state is likely lost so we have to reload firmware
again.

Signed-off-by: Andrey Borzenkov <arvidjaar@mail.ru>
Acked-by: David Kilroy <kilroyd@googlemail.com>
---

Resend against current wireless-testing

 drivers/net/wireless/orinoco.c |   11 +++++------
 1 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/drivers/net/wireless/orinoco.c b/drivers/net/wireless/orinoco.c
index e0512e4..860803e 100644
--- a/drivers/net/wireless/orinoco.c
+++ b/drivers/net/wireless/orinoco.c
@@ -2301,6 +2301,11 @@ int orinoco_reinit_firmware(struct net_device *dev)
 	int err;
 
 	err = hermes_init(hw);
+	if (priv->do_fw_download && !err) {
+		err = orinoco_download(priv);
+		if (err)
+			priv->do_fw_download = 0;
+	}
 	if (!err)
 		err = orinoco_allocate_fid(dev);
 
@@ -2926,12 +2931,6 @@ static void orinoco_reset(struct work_struct *work)
 		}
 	}
 
-	if (priv->do_fw_download) {
-		err = orinoco_download(priv);
-		if (err)
-			priv->do_fw_download = 0;
-	}
-
 	err = orinoco_reinit_firmware(dev);
 	if (err) {
 		printk(KERN_ERR "%s: orinoco_reset: Error %d re-initializing firmware\n",
-- 
1.6.0.2


[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2008-10-26  8:21 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-10-26  8:21 [PATCH 1/2] orinoco: reload firmware on resume Andrey Borzenkov
  -- strict thread matches above, loose matches on Subject: below --
2008-10-11 14:16 Andrey Borzenkov
2008-10-11 17:42 ` Dave
2008-10-11 18:34   ` Andrey Borzenkov
2008-10-12 12:36   ` Andrey Borzenkov
2008-10-15 19:31     ` Dave
2008-10-22 18:26       ` John W. Linville

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.