public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andres Salomon <dilinger@queued.net>
To: dcbw@redhat.com
Cc: David Woodhouse <dwmw2@infradead.org>,
	libertas-dev@lists.infradead.org, dsd@laptop.org, cjb@laptop.org,
	linux-kernel@vger.kernel.org
Subject: [PATCH] libertas: prioritize usb8388_v5.bin firmware on OLPC machines
Date: Sun, 31 Jul 2011 00:03:00 -0700	[thread overview]
Message-ID: <20110731000300.5c08e95f@debxo> (raw)

Normally, the v9 firmware will be loaded if it's available.  However, on
OLPC XO-1 machines, the v5 firmware supports extra functionality.  This
makes the libertas driver attempt to load the v5 firmware first if the
machine is an OLPC machine; if that fails (or it's not an OLPC machine),
fall back to attempting to load the other firmwares.

Signed-off-by: Andres Salomon <dilinger@queued.net>
---
 drivers/net/wireless/libertas/if_usb.c |   24 ++++++++++++++++++++++++
 1 files changed, 24 insertions(+), 0 deletions(-)

diff --git a/drivers/net/wireless/libertas/if_usb.c b/drivers/net/wireless/libertas/if_usb.c
index b5acc39..6a2e70e 100644
--- a/drivers/net/wireless/libertas/if_usb.c
+++ b/drivers/net/wireless/libertas/if_usb.c
@@ -973,6 +973,26 @@ static const struct {
 	{ MODEL_8682, "libertas/usb8682.bin" }
 };
 
+#ifdef CONFIG_OLPC
+
+/* default OLPC firmware to try; index into fw_table above */
+#define OLPC_FW 1
+
+static int try_olpc_fw(struct if_usb_card *cardp)
+{
+	int retval = -ENOENT;
+
+	/* try the OLPC firmware first; fall back to any others */
+	if (machine_is_olpc())
+		retval = request_firmware(&cardp->fw,
+				fw_table[OLPC_FW].fwname, &cardp->udev->dev);
+	return retval;
+}
+
+#else
+static int try_olpc_fw(struct if_usb_card *cardp) { return -ENOENT; }
+#endif /* !CONFIG_OLPC */
+
 static int get_fw(struct if_usb_card *cardp, const char *fwname)
 {
 	int i;
@@ -981,6 +1001,10 @@ static int get_fw(struct if_usb_card *cardp, const char *fwname)
 	if (fwname)
 		return request_firmware(&cardp->fw, fwname, &cardp->udev->dev);
 
+	/* Handle OLPC firmware */
+	if (try_olpc_fw(cardp) == 0)
+		return 0;
+
 	/* Otherwise search for firmware to use */
 	for (i = 0; i < ARRAY_SIZE(fw_table); i++) {
 		if (fw_table[i].model != cardp->model)
-- 
1.7.2.5


             reply	other threads:[~2011-07-31  7:03 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-31  7:03 Andres Salomon [this message]
2011-07-31  7:05 ` [PATCH] libertas: prioritize usb8388_v5.bin firmware on OLPC machines Andres Salomon
2011-07-31 12:59   ` Daniel Drake
2011-08-01 17:17     ` Dan Williams
2011-08-01 18:25       ` Andres Salomon
2011-08-01 21:20         ` Dan Williams
2011-08-03  6:37           ` Andres Salomon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110731000300.5c08e95f@debxo \
    --to=dilinger@queued.net \
    --cc=cjb@laptop.org \
    --cc=dcbw@redhat.com \
    --cc=dsd@laptop.org \
    --cc=dwmw2@infradead.org \
    --cc=libertas-dev@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox