From: Ben Hutchings <ben@decadent.org.uk>
To: Darren Salt <linux@youmustbejoking.demon.co.uk>
Cc: Greg Kroah-Hartman <gregkh@suse.de>,
linux-kernel@vger.kernel.org,
David Woodhouse <dwmw2@infradead.org>
Subject: Re: [PATCH 4/3] rt2860sta: call release_firmware on module exit, else resume is broken
Date: Sat, 18 Apr 2009 17:54:48 +0100 [thread overview]
Message-ID: <1240073688.3384.4.camel@deadeye.i.decadent.org.uk> (raw)
In-Reply-To: <505368DED8%linux@youmustbejoking.demon.co.uk>
[-- Attachment #1: Type: text/plain, Size: 2865 bytes --]
On Sat, 2009-04-18 at 16:15 +0100, Darren Salt wrote:
> Resume breakage is as follows: it takes somewhat longer (firmware request
> timeout), as a result of which the firmware isn't reloaded; and any
> subsequent attempt to trying to bring down the interface results in a panic &
> lockup (SysRq failure on my 901).
>
> Consequently, it's better to request the firmware once and hang onto it until
> the module is unloaded.
Greg hasn't accepted the previous patch, so there's not much point
submitting patches on top of it yet. I suggest you post a combined
patch once David has done a release of linux-firmware including
rt2860.bin.
> Signed-off-by: Darren Salt <linux@youmustbejoking.demon.co.uk>
>
> diff -pur a/drivers/staging/rt2860/2860_main_dev.c b/drivers/staging/rt2860/2860_main_dev.c
> --- a/drivers/staging/rt2860/2860_main_dev.c
> +++ b/drivers/staging/rt2860/2860_main_dev.c
> @@ -289,6 +289,7 @@ static INT __init rt2860_init_module(VOI
> static VOID __exit rt2860_cleanup_module(VOID)
> {
> pci_unregister_driver(&rt2860_driver);
> + NICForgetFirmware();
> }
>
> module_init(rt2860_init_module);
> diff -pur a/drivers/staging/rt2860/common/rtmp_init.c b/drivers/staging/rt2860/common/rtmp_init.c
> --- a/drivers/staging/rt2860/common/rtmp_init.c
> +++ b/drivers/staging/rt2860/common/rtmp_init.c
> @@ -144,6 +144,8 @@ RTMP_REG_PAIR STAMACRegTable[] = {
> #define FW_FILENAME "rt2860.bin"
> MODULE_FIRMWARE(FW_FILENAME);
>
> +const struct firmware *fw = NULL;
> +
Must be static.
> #define FIRMWAREIMAGE_MAX_LENGTH 0x2000
> #define FIRMWARE_MAJOR_VERSION 0
> #define FIRMWARE_MINOR_VERSION 2
> @@ -2583,6 +2585,12 @@ VOID NICEraseFirmware(
>
> }/* End of NICEraseFirmware */
>
> +VOID NICForgetFirmware(void)
> +{
> + release_firmware(fw);
> + fw = NULL;
> +}
> +
> /*
> ========================================================================
>
> @@ -2603,11 +2611,11 @@ VOID NICEraseFirmware(
> NDIS_STATUS NICLoadFirmware(
> IN PRTMP_ADAPTER pAd)
> {
> - const struct firmware *fw;
> int ret, i;
> NDIS_STATUS Status = NDIS_STATUS_SUCCESS;
>
> - ret = request_firmware(&fw, FW_FILENAME,
> + ret = fw ? 0 :
> + request_firmware(&fw, FW_FILENAME,
> &((POS_COOKIE)pAd->OS_Cookie)->pci_dev->dev);
This is not thread-safe unless NICLoadFirmware is guarded by a global
lock. Is it always called under RTNL? If so, we can add ASSERT_RTNL()
to ensure that this doesn't change.
> if (ret) {
> printk(KERN_ERR "rt2860sta: firmware file %s request failed (%d)\n",
> @@ -2659,7 +2667,7 @@ NDIS_STATUS NICLoadFirmware(
> RTMP_IO_WRITE32(pAd, H2M_BBP_AGENT, 0);
> RTMP_IO_WRITE32(pAd, H2M_MAILBOX_CSR, 0);
>
> - release_firmware(fw);
> + /*release_firmware(fw);*/
[...]
Just remove it.
Ben.
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
prev parent reply other threads:[~2009-04-18 16:55 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-04-13 2:33 [PATCH 2/3] rt2860sta: use the firmware loader interface and library CRC code Ben Hutchings
2009-04-18 15:15 ` [PATCH 4/3] rt2860sta: call release_firmware on module exit, else resume is broken Darren Salt
2009-04-18 16:54 ` Ben Hutchings [this message]
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=1240073688.3384.4.camel@deadeye.i.decadent.org.uk \
--to=ben@decadent.org.uk \
--cc=dwmw2@infradead.org \
--cc=gregkh@suse.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@youmustbejoking.demon.co.uk \
/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
all inboxes | Powered by JetHome®