diff options
author | Johannes Berg <johannes@sipsolutions.net> | 2009-10-29 07:36:02 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2009-12-11 14:24:52 -0500 |
commit | 9ebfbd45f9d4ee9cd72529cf99e5f300eb398e67 (patch) | |
tree | 6ad661c4b38d0fad8a88c4a0d28997e9303632f2 /drivers/firmware | |
parent | 03d673e6af6490371aaf64dfe1f84c658c48b71d (diff) |
firmware_class: make request_firmware_nowait more useful
Unfortunately, one cannot hold on to the struct firmware
that request_firmware_nowait() hands off, which is needed
in some cases. Allow this by requiring the callback to
free it (via release_firmware).
Additionally, give it a gfp_t parameter -- all the current
users call it from a GFP_KERNEL context so the GFP_ATOMIC
isn't necessary. This also marks an API break which is
useful in a sense, although that is obviously not the
primary purpose of this change.
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Cc: Ming Lei <tom.leiming@gmail.com>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: David Woodhouse <David.Woodhouse@intel.com>
Cc: Pavel Roskin <proski@gnu.org>
Cc: Abhay Salunke <abhay_salunke@dell.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/firmware')
-rw-r--r-- | drivers/firmware/dell_rbu.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/drivers/firmware/dell_rbu.c b/drivers/firmware/dell_rbu.c index b4704e150b28..b3a0cf57442e 100644 --- a/drivers/firmware/dell_rbu.c +++ b/drivers/firmware/dell_rbu.c | |||
@@ -544,9 +544,12 @@ static void callbackfn_rbu(const struct firmware *fw, void *context) | |||
544 | { | 544 | { |
545 | rbu_data.entry_created = 0; | 545 | rbu_data.entry_created = 0; |
546 | 546 | ||
547 | if (!fw || !fw->size) | 547 | if (!fw) |
548 | return; | 548 | return; |
549 | 549 | ||
550 | if (!fw->size) | ||
551 | goto out; | ||
552 | |||
550 | spin_lock(&rbu_data.lock); | 553 | spin_lock(&rbu_data.lock); |
551 | if (!strcmp(image_type, "mono")) { | 554 | if (!strcmp(image_type, "mono")) { |
552 | if (!img_update_realloc(fw->size)) | 555 | if (!img_update_realloc(fw->size)) |
@@ -568,6 +571,8 @@ static void callbackfn_rbu(const struct firmware *fw, void *context) | |||
568 | } else | 571 | } else |
569 | pr_debug("invalid image type specified.\n"); | 572 | pr_debug("invalid image type specified.\n"); |
570 | spin_unlock(&rbu_data.lock); | 573 | spin_unlock(&rbu_data.lock); |
574 | out: | ||
575 | release_firmware(fw); | ||
571 | } | 576 | } |
572 | 577 | ||
573 | static ssize_t read_rbu_image_type(struct kobject *kobj, | 578 | static ssize_t read_rbu_image_type(struct kobject *kobj, |
@@ -615,7 +620,7 @@ static ssize_t write_rbu_image_type(struct kobject *kobj, | |||
615 | spin_unlock(&rbu_data.lock); | 620 | spin_unlock(&rbu_data.lock); |
616 | req_firm_rc = request_firmware_nowait(THIS_MODULE, | 621 | req_firm_rc = request_firmware_nowait(THIS_MODULE, |
617 | FW_ACTION_NOHOTPLUG, "dell_rbu", | 622 | FW_ACTION_NOHOTPLUG, "dell_rbu", |
618 | &rbu_device->dev, &context, | 623 | &rbu_device->dev, GFP_KERNEL, &context, |
619 | callbackfn_rbu); | 624 | callbackfn_rbu); |
620 | if (req_firm_rc) { | 625 | if (req_firm_rc) { |
621 | printk(KERN_ERR | 626 | printk(KERN_ERR |