From: Ben Hutchings <bhutchings@solarflare.com>
To: Debashis Dutt <ddutt@brocade.com>
Cc: netdev@vger.kernel.org, adapter_linux_open_src_team@brocade.com
Subject: Re: Subject: [PATCH 2/6] bna: Brocade 10Gb Ethernet device driver
Date: Sat, 19 Dec 2009 02:19:09 +0000 [thread overview]
Message-ID: <1261189149.2418.82.camel@localhost> (raw)
In-Reply-To: <200912190128.nBJ1SZBw015434@blc-10-2.brocade.com>
On Fri, 2009-12-18 at 17:28 -0800, Debashis Dutt wrote:
[...]
> diff -ruP net-next-2.6-orig/drivers/net/bna/bfad_fwimg.c net-next-2.6-mod/drivers/net/bna/bfad_fwimg.c
> --- net-next-2.6-orig/drivers/net/bna/bfad_fwimg.c 1969-12-31 16:00:00.000000000 -0800
> +++ net-next-2.6-mod/drivers/net/bna/bfad_fwimg.c 2009-12-18 16:53:40.000000000 -0800
[...]
> +u32 bfi_image_ct_size;
> +u32 bfi_image_cb_size;
> +u32 *bfi_image_ct;
> +u32 *bfi_image_cb;
> +
> +#define BFAD_FW_FILE_CT "ctfw.bin"
> +#define BFAD_FW_FILE_CB "cbfw.bin"
You should also use the MODULE_FIRMWARE() macro to add references to
these files in the module. That enables distribution scripts to tell
which firmware files need to be installed on the system or included in
an initramfs.
> +u32 *
> +bfad_read_firmware(struct pci_dev *pdev, u32 **bfi_image,
> + u32 *bfi_image_size, char *fw_name)
> +{
> + const struct firmware *fw;
> +
> + if (request_firmware(&fw, fw_name, &pdev->dev)) {
> + printk(KERN_ALERT "Can't locate firmware %s\n", fw_name);
> + goto error;
> + }
> +
> + *bfi_image = vmalloc(fw->size);
> + if (NULL == *bfi_image) {
> + printk(KERN_ALERT "Fail to allocate buffer for fw image "
> + "size=%x!\n", (u32) fw->size);
> + goto error;
> + }
> +
> + memcpy(*bfi_image, fw->data, fw->size);
What is the point of making a copy?
> + *bfi_image_size = fw->size/sizeof(u32);
> +
> + return *bfi_image;
> +
> +error:
> + return NULL;
> +}
Are you ever going to free any of these firmware images?
> +u32 *
> +bfad_get_firmware_buf(struct pci_dev *pdev)
> +{
> + if (pdev->device == BFA_PCI_DEVICE_ID_CT) {
> + if (bfi_image_ct_size == 0)
> + bfad_read_firmware(pdev, &bfi_image_ct,
> + &bfi_image_ct_size, BFAD_FW_FILE_CT);
> + return bfi_image_ct;
> + } else {
> + if (bfi_image_cb_size == 0)
> + bfad_read_firmware(pdev, &bfi_image_cb,
> + &bfi_image_cb_size, BFAD_FW_FILE_CB);
> + return bfi_image_cb;
> + }
> +}
[...]
PCI devices can be probed in parallel, so this must use a mutex.
Ben.
--
Ben Hutchings, Senior Software Engineer, Solarflare Communications
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.
next prev parent reply other threads:[~2009-12-19 2:19 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-12-19 1:28 Subject: [PATCH 2/6] bna: Brocade 10Gb Ethernet device driver Debashis Dutt
2009-12-19 2:19 ` Ben Hutchings [this message]
-- strict thread matches above, loose matches on Subject: below --
2010-02-19 21:52 Rasesh Mody
2010-02-22 12:36 ` Stanislaw Gruszka
2010-02-12 14:00 Rasesh Mody
2010-02-10 6:29 Rasesh Mody
2009-11-26 9:28 Debashis Dutt
2009-11-24 3:51 Rasesh Mody
2009-11-24 4:21 ` Stephen Hemminger
2009-11-24 4:22 ` Stephen Hemminger
2009-11-24 4:23 ` Stephen Hemminger
2009-11-24 4:24 ` Stephen Hemminger
2009-11-26 9:01 ` Debashis Dutt
2009-11-24 4:26 ` Stephen Hemminger
2009-11-24 4:27 ` Stephen Hemminger
2009-11-24 4:28 ` Stephen Hemminger
2009-11-26 8:58 ` Debashis Dutt
2009-11-17 8:30 Rasesh Mody
2009-11-17 9:00 ` David Miller
2009-11-13 3:46 Rasesh Mody
2009-11-13 5:08 ` Stephen Hemminger
2009-11-01 5:03 Rasesh Mody
2009-11-01 19:23 ` Stephen Hemminger
2009-11-01 19:25 ` Stephen Hemminger
2009-10-16 18:24 Rasesh Mody
2009-10-16 20:31 ` Ben Hutchings
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=1261189149.2418.82.camel@localhost \
--to=bhutchings@solarflare.com \
--cc=adapter_linux_open_src_team@brocade.com \
--cc=ddutt@brocade.com \
--cc=netdev@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;
as well as URLs for NNTP newsgroup(s).