firmware: Sigma: Fix endianess issues
[linux-2.6.git] / drivers / firmware / dell_rbu.c
index b4704e1..2f452f1 100644 (file)
@@ -36,6 +36,7 @@
  */
 #include <linux/init.h>
 #include <linux/module.h>
+#include <linux/slab.h>
 #include <linux/string.h>
 #include <linux/errno.h>
 #include <linux/blkdev.h>
@@ -521,7 +522,7 @@ static ssize_t read_rbu_mono_data(char *buffer, loff_t pos, size_t count)
                        rbu_data.image_update_buffer, rbu_data.bios_image_size);
 }
 
-static ssize_t read_rbu_data(struct kobject *kobj,
+static ssize_t read_rbu_data(struct file *filp, struct kobject *kobj,
                             struct bin_attribute *bin_attr,
                             char *buffer, loff_t pos, size_t count)
 {
@@ -544,9 +545,12 @@ static void callbackfn_rbu(const struct firmware *fw, void *context)
 {
        rbu_data.entry_created = 0;
 
-       if (!fw || !fw->size)
+       if (!fw)
                return;
 
+       if (!fw->size)
+               goto out;
+
        spin_lock(&rbu_data.lock);
        if (!strcmp(image_type, "mono")) {
                if (!img_update_realloc(fw->size))
@@ -568,9 +572,11 @@ static void callbackfn_rbu(const struct firmware *fw, void *context)
        } else
                pr_debug("invalid image type specified.\n");
        spin_unlock(&rbu_data.lock);
+ out:
+       release_firmware(fw);
 }
 
-static ssize_t read_rbu_image_type(struct kobject *kobj,
+static ssize_t read_rbu_image_type(struct file *filp, struct kobject *kobj,
                                   struct bin_attribute *bin_attr,
                                   char *buffer, loff_t pos, size_t count)
 {
@@ -580,7 +586,7 @@ static ssize_t read_rbu_image_type(struct kobject *kobj,
        return size;
 }
 
-static ssize_t write_rbu_image_type(struct kobject *kobj,
+static ssize_t write_rbu_image_type(struct file *filp, struct kobject *kobj,
                                    struct bin_attribute *bin_attr,
                                    char *buffer, loff_t pos, size_t count)
 {
@@ -615,7 +621,7 @@ static ssize_t write_rbu_image_type(struct kobject *kobj,
                        spin_unlock(&rbu_data.lock);
                        req_firm_rc = request_firmware_nowait(THIS_MODULE,
                                FW_ACTION_NOHOTPLUG, "dell_rbu",
-                               &rbu_device->dev, &context,
+                               &rbu_device->dev, GFP_KERNEL, &context,
                                callbackfn_rbu);
                        if (req_firm_rc) {
                                printk(KERN_ERR
@@ -641,7 +647,7 @@ static ssize_t write_rbu_image_type(struct kobject *kobj,
        return rc;
 }
 
-static ssize_t read_rbu_packet_size(struct kobject *kobj,
+static ssize_t read_rbu_packet_size(struct file *filp, struct kobject *kobj,
                                    struct bin_attribute *bin_attr,
                                    char *buffer, loff_t pos, size_t count)
 {
@@ -654,7 +660,7 @@ static ssize_t read_rbu_packet_size(struct kobject *kobj,
        return size;
 }
 
-static ssize_t write_rbu_packet_size(struct kobject *kobj,
+static ssize_t write_rbu_packet_size(struct file *filp, struct kobject *kobj,
                                     struct bin_attribute *bin_attr,
                                     char *buffer, loff_t pos, size_t count)
 {