* [PATCH 3/4] staging: r8712u: Switch driver to use external firmware from linux-firmware
@ 2011-01-14 20:54 Larry Finger
2011-01-14 23:05 ` Stefan Lippers-Hollmann
0 siblings, 1 reply; 4+ messages in thread
From: Larry Finger @ 2011-01-14 20:54 UTC (permalink / raw)
To: Greg Kroah-Hartman; +Cc: florian.c.schilhabel, linux-kernel
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
---
drivers/staging/rtl8712/TODO | 2 --
drivers/staging/rtl8712/hal_init.c | 22 +++++++++++++++++-----
2 files changed, 17 insertions(+), 7 deletions(-)
diff --git a/drivers/staging/rtl8712/TODO b/drivers/staging/rtl8712/TODO
index 2aa5deb..d8dfe5b 100644
--- a/drivers/staging/rtl8712/TODO
+++ b/drivers/staging/rtl8712/TODO
@@ -3,8 +3,6 @@ TODO:
- switch to use LIB80211
- switch to use MAC80211
- checkpatch.pl fixes - only a few remain
-- switch from large inline firmware file to use the firmware interface
- and add the file to the linux-firmware package.
Please send any patches to Greg Kroah-Hartman <greg@kroah.com>,
Larry Finger <Larry.Finger@lwfinger.net> and
diff --git a/drivers/staging/rtl8712/hal_init.c b/drivers/staging/rtl8712/hal_init.c
index 84be383..52ab2d5 100644
--- a/drivers/staging/rtl8712/hal_init.c
+++ b/drivers/staging/rtl8712/hal_init.c
@@ -31,7 +31,6 @@
#include "osdep_service.h"
#include "drv_types.h"
#include "rtl871x_byteorder.h"
-#include "farray.h"
#include "usb_osintf.h"
#define FWBUFF_ALIGN_SZ 512
@@ -40,11 +39,24 @@
static u32 rtl871x_open_fw(struct _adapter *padapter, void **pphfwfile_hdl,
const u8 **ppmappedfw)
{
- u32 len;
+ int rc;
+ const char firmware_file[] = "rtl8712u/rtl8712u.bin";
+ const struct firmware **praw = (const struct firmware **)
+ (pphfwfile_hdl);
+ struct dvobj_priv *pdvobjpriv = (struct dvobj_priv *)
+ (&padapter->dvobjpriv);
+ struct usb_device *pusbdev = pdvobjpriv->pusbdev;
- *ppmappedfw = f_array;
- len = sizeof(f_array);
- return len;
+ printk(KERN_INFO "r8712u: Loading firmware from \"%s\"\n",
+ firmware_file);
+ rc = request_firmware(praw, firmware_file, &pusbdev->dev);
+ if (rc < 0) {
+ printk(KERN_ERR "r8712u: Unable to load firmware\n");
+ printk(KERN_ERR "r8712u: Install latest linux-firmware\n");
+ return 0;
+ }
+ *ppmappedfw = (u8 *)((*praw)->data);
+ return (*praw)->size;
}
static void fill_fwpriv(struct _adapter *padapter, struct fw_priv *pfwpriv)
--
1.7.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 3/4] staging: r8712u: Switch driver to use external firmware from linux-firmware
2011-01-14 20:54 [PATCH 3/4] staging: r8712u: Switch driver to use external firmware from linux-firmware Larry Finger
@ 2011-01-14 23:05 ` Stefan Lippers-Hollmann
2011-01-14 23:08 ` [PATCH] staging: r8712u: Fix external firmware loading Stefan Lippers-Hollmann
0 siblings, 1 reply; 4+ messages in thread
From: Stefan Lippers-Hollmann @ 2011-01-14 23:05 UTC (permalink / raw)
To: Larry Finger
Cc: Greg Kroah-Hartman, florian.c.schilhabel, linux-kernel, devel
Hi
[ Sorry if you already handled these comments in the fourth patch of
your series, but as patch 4/4 doesn't appear to have reached lkml
yet, I'll respond here. ]
On Friday 14 January 2011, Larry Finger wrote:
> Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
> ---
> drivers/staging/rtl8712/TODO | 2 --
> drivers/staging/rtl8712/hal_init.c | 22 +++++++++++++++++-----
> 2 files changed, 17 insertions(+), 7 deletions(-)
[...]
> @@ -40,11 +39,24 @@
> static u32 rtl871x_open_fw(struct _adapter *padapter, void **pphfwfile_hdl,
> const u8 **ppmappedfw)
> {
> - u32 len;
> + int rc;
> + const char firmware_file[] = "rtl8712u/rtl8712u.bin";
rtl8712u.bin has been merged into linux-firmware.git as
rtlwifi/rtl8712u.bin, wouldn't it be better to use that location
instead?
const char firmware_file[] = "rtlwifi/rtl8712u.bin";
> + const struct firmware **praw = (const struct firmware **)
> + (pphfwfile_hdl);
> + struct dvobj_priv *pdvobjpriv = (struct dvobj_priv *)
> + (&padapter->dvobjpriv);
> + struct usb_device *pusbdev = pdvobjpriv->pusbdev;
>
> - *ppmappedfw = f_array;
> - len = sizeof(f_array);
> - return len;
> + printk(KERN_INFO "r8712u: Loading firmware from \"%s\"\n",
> + firmware_file);
> + rc = request_firmware(praw, firmware_file, &pusbdev->dev);
> + if (rc < 0) {
> + printk(KERN_ERR "r8712u: Unable to load firmware\n");
> + printk(KERN_ERR "r8712u: Install latest linux-firmware\n");
> + return 0;
> + }
> + *ppmappedfw = (u8 *)((*praw)->data);
> + return (*praw)->size;
> }
Additionally I'd suggest to declare the firmware as well, so that
userspace knows about it, just like selecting FW_LOADER.
MODULE_FIRMWARE("rtlwifi/rtl8712u.bin");
>
> static void fill_fwpriv(struct _adapter *padapter, struct fw_priv *pfwpriv)
>
--- a/drivers/staging/rtl8712/Kconfig
+++ b/drivers/staging/rtl8712/Kconfig
@@ -3,6 +3,7 @@ config R8712U
depends on WLAN && USB
select WIRELESS_EXT
select WEXT_PRIV
+ select FW_LOADER
default N
---help---
This option adds the Realtek RTL8712 USB device such as the D-Link DWA-130.
I'll post an according patch as follow up to this mail, diff'ed against
next-20110114 plus your 3/4 patches that reached lkml:
+ [PATCH 1/4] staging: r8712u: Fix memory leak in firmware loading
+ [PATCH 2/4] staging: r8712u: Fix sparse message
+ [PATCH 3/4] staging: r8712u: Switch driver to use external firmware from linux-firmware
Feel free to merge those changes into your "r8712u: Switch driver to
use external firmware from linux-firmware", if you like.
Regards
Stefan Lippers-Hollmann
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH] staging: r8712u: Fix external firmware loading
2011-01-14 23:05 ` Stefan Lippers-Hollmann
@ 2011-01-14 23:08 ` Stefan Lippers-Hollmann
2011-01-14 23:24 ` Larry Finger
0 siblings, 1 reply; 4+ messages in thread
From: Stefan Lippers-Hollmann @ 2011-01-14 23:08 UTC (permalink / raw)
To: Larry Finger
Cc: Greg Kroah-Hartman, florian.c.schilhabel, linux-kernel, devel
* select FW_LOADER
* change firmware location to represent published linux-fimware.git
* declare MODULE_FIRMWARE for r8712u
Signed-off-by: Stefan Lippers-Hollmann <s.l-h@gmx.de>
---
drivers/staging/rtl8712/Kconfig | 1 +
drivers/staging/rtl8712/hal_init.c | 3 ++-
2 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/drivers/staging/rtl8712/Kconfig b/drivers/staging/rtl8712/Kconfig
index 1e9a230..041e1e8 100644
--- a/drivers/staging/rtl8712/Kconfig
+++ b/drivers/staging/rtl8712/Kconfig
@@ -3,6 +3,7 @@ config R8712U
depends on WLAN && USB
select WIRELESS_EXT
select WEXT_PRIV
+ select FW_LOADER
default N
---help---
This option adds the Realtek RTL8712 USB device such as the D-Link DWA-130.
diff --git a/drivers/staging/rtl8712/hal_init.c b/drivers/staging/rtl8712/hal_init.c
index 52ab2d5..1411c7bf 100644
--- a/drivers/staging/rtl8712/hal_init.c
+++ b/drivers/staging/rtl8712/hal_init.c
@@ -40,7 +40,7 @@ static u32 rtl871x_open_fw(struct _adapter *padapter, void **pphfwfile_hdl,
const u8 **ppmappedfw)
{
int rc;
- const char firmware_file[] = "rtl8712u/rtl8712u.bin";
+ const char firmware_file[] = "rtlwifi/rtl8712u.bin";
const struct firmware **praw = (const struct firmware **)
(pphfwfile_hdl);
struct dvobj_priv *pdvobjpriv = (struct dvobj_priv *)
@@ -58,6 +58,7 @@ static u32 rtl871x_open_fw(struct _adapter *padapter, void **pphfwfile_hdl,
*ppmappedfw = (u8 *)((*praw)->data);
return (*praw)->size;
}
+MODULE_FIRMWARE("rtlwifi/rtl8712u.bin");
static void fill_fwpriv(struct _adapter *padapter, struct fw_priv *pfwpriv)
{
--
1.7.2.3
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] staging: r8712u: Fix external firmware loading
2011-01-14 23:08 ` [PATCH] staging: r8712u: Fix external firmware loading Stefan Lippers-Hollmann
@ 2011-01-14 23:24 ` Larry Finger
0 siblings, 0 replies; 4+ messages in thread
From: Larry Finger @ 2011-01-14 23:24 UTC (permalink / raw)
To: Stefan Lippers-Hollmann
Cc: Greg Kroah-Hartman, florian.c.schilhabel, linux-kernel, devel
On 01/14/2011 05:08 PM, Stefan Lippers-Hollmann wrote:
> * select FW_LOADER
> * change firmware location to represent published linux-fimware.git
> * declare MODULE_FIRMWARE for r8712u
>
> Signed-off-by: Stefan Lippers-Hollmann <s.l-h@gmx.de>
> ---
> drivers/staging/rtl8712/Kconfig | 1 +
> drivers/staging/rtl8712/hal_init.c | 3 ++-
> 2 files changed, 3 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/staging/rtl8712/Kconfig b/drivers/staging/rtl8712/Kconfig
> index 1e9a230..041e1e8 100644
> --- a/drivers/staging/rtl8712/Kconfig
> +++ b/drivers/staging/rtl8712/Kconfig
> @@ -3,6 +3,7 @@ config R8712U
> depends on WLAN && USB
> select WIRELESS_EXT
> select WEXT_PRIV
> + select FW_LOADER
> default N
> ---help---
> This option adds the Realtek RTL8712 USB device such as the D-Link DWA-130.
> diff --git a/drivers/staging/rtl8712/hal_init.c b/drivers/staging/rtl8712/hal_init.c
> index 52ab2d5..1411c7bf 100644
> --- a/drivers/staging/rtl8712/hal_init.c
> +++ b/drivers/staging/rtl8712/hal_init.c
> @@ -40,7 +40,7 @@ static u32 rtl871x_open_fw(struct _adapter *padapter, void **pphfwfile_hdl,
> const u8 **ppmappedfw)
> {
> int rc;
> - const char firmware_file[] = "rtl8712u/rtl8712u.bin";
> + const char firmware_file[] = "rtlwifi/rtl8712u.bin";
> const struct firmware **praw = (const struct firmware **)
> (pphfwfile_hdl);
> struct dvobj_priv *pdvobjpriv = (struct dvobj_priv *)
> @@ -58,6 +58,7 @@ static u32 rtl871x_open_fw(struct _adapter *padapter, void **pphfwfile_hdl,
> *ppmappedfw = (u8 *)((*praw)->data);
> return (*praw)->size;
> }
> +MODULE_FIRMWARE("rtlwifi/rtl8712u.bin");
>
> static void fill_fwpriv(struct _adapter *padapter, struct fw_priv *pfwpriv)
> {
Thanks for the review. These changes are all in PATCH 4/4. Apparently, my ISP is
having some difficulties with that one, or perhaps LKML will not post it. In it,
I delete the 10K+ lines of internal firmware in a header file, and all of them
are in the patch.
Larry
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2011-01-14 23:24 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-01-14 20:54 [PATCH 3/4] staging: r8712u: Switch driver to use external firmware from linux-firmware Larry Finger
2011-01-14 23:05 ` Stefan Lippers-Hollmann
2011-01-14 23:08 ` [PATCH] staging: r8712u: Fix external firmware loading Stefan Lippers-Hollmann
2011-01-14 23:24 ` Larry Finger
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).