diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2009-06-16 15:57:37 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-06-16 15:57:37 -0400 |
commit | 6fd03301d76bc439382710e449f58efbb233df1b (patch) | |
tree | 3c8a3217aed67319683ffc1debccdb5b3245b16c /drivers/base/firmware_class.c | |
parent | cd5232bd6be2d215a800f3d88c287ca791debfbe (diff) | |
parent | e4792aa30f9d33584d7192685ed149cc5fee737f (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core-2.6: (64 commits)
debugfs: use specified mode to possibly mark files read/write only
debugfs: Fix terminology inconsistency of dir name to mount debugfs filesystem.
xen: remove driver_data direct access of struct device from more drivers
usb: gadget: at91_udc: remove driver_data direct access of struct device
uml: remove driver_data direct access of struct device
block/ps3: remove driver_data direct access of struct device
s390: remove driver_data direct access of struct device
parport: remove driver_data direct access of struct device
parisc: remove driver_data direct access of struct device
of_serial: remove driver_data direct access of struct device
mips: remove driver_data direct access of struct device
ipmi: remove driver_data direct access of struct device
infiniband: ehca: remove driver_data direct access of struct device
ibmvscsi: gadget: at91_udc: remove driver_data direct access of struct device
hvcs: remove driver_data direct access of struct device
xen block: remove driver_data direct access of struct device
thermal: remove driver_data direct access of struct device
scsi: remove driver_data direct access of struct device
pcmcia: remove driver_data direct access of struct device
PCIE: remove driver_data direct access of struct device
...
Manually fix up trivial conflicts due to different direct driver_data
direct access fixups in drivers/block/{ps3disk.c,ps3vram.c}
Diffstat (limited to 'drivers/base/firmware_class.c')
-rw-r--r-- | drivers/base/firmware_class.c | 27 |
1 files changed, 19 insertions, 8 deletions
diff --git a/drivers/base/firmware_class.c b/drivers/base/firmware_class.c index 8a267c427629..ddeb819c8f87 100644 --- a/drivers/base/firmware_class.c +++ b/drivers/base/firmware_class.c | |||
@@ -40,7 +40,7 @@ static int loading_timeout = 60; /* In seconds */ | |||
40 | static DEFINE_MUTEX(fw_lock); | 40 | static DEFINE_MUTEX(fw_lock); |
41 | 41 | ||
42 | struct firmware_priv { | 42 | struct firmware_priv { |
43 | char fw_id[FIRMWARE_NAME_MAX]; | 43 | char *fw_id; |
44 | struct completion completion; | 44 | struct completion completion; |
45 | struct bin_attribute attr_data; | 45 | struct bin_attribute attr_data; |
46 | struct firmware *fw; | 46 | struct firmware *fw; |
@@ -355,8 +355,9 @@ static void fw_dev_release(struct device *dev) | |||
355 | for (i = 0; i < fw_priv->nr_pages; i++) | 355 | for (i = 0; i < fw_priv->nr_pages; i++) |
356 | __free_page(fw_priv->pages[i]); | 356 | __free_page(fw_priv->pages[i]); |
357 | kfree(fw_priv->pages); | 357 | kfree(fw_priv->pages); |
358 | kfree(fw_priv->fw_id); | ||
358 | kfree(fw_priv); | 359 | kfree(fw_priv); |
359 | kfree(dev); | 360 | put_device(dev); |
360 | 361 | ||
361 | module_put(THIS_MODULE); | 362 | module_put(THIS_MODULE); |
362 | } | 363 | } |
@@ -386,13 +387,19 @@ static int fw_register_device(struct device **dev_p, const char *fw_name, | |||
386 | 387 | ||
387 | init_completion(&fw_priv->completion); | 388 | init_completion(&fw_priv->completion); |
388 | fw_priv->attr_data = firmware_attr_data_tmpl; | 389 | fw_priv->attr_data = firmware_attr_data_tmpl; |
389 | strlcpy(fw_priv->fw_id, fw_name, FIRMWARE_NAME_MAX); | 390 | fw_priv->fw_id = kstrdup(fw_name, GFP_KERNEL); |
391 | if (!fw_priv->fw_id) { | ||
392 | dev_err(device, "%s: Firmware name allocation failed\n", | ||
393 | __func__); | ||
394 | retval = -ENOMEM; | ||
395 | goto error_kfree; | ||
396 | } | ||
390 | 397 | ||
391 | fw_priv->timeout.function = firmware_class_timeout; | 398 | fw_priv->timeout.function = firmware_class_timeout; |
392 | fw_priv->timeout.data = (u_long) fw_priv; | 399 | fw_priv->timeout.data = (u_long) fw_priv; |
393 | init_timer(&fw_priv->timeout); | 400 | init_timer(&fw_priv->timeout); |
394 | 401 | ||
395 | dev_set_name(f_dev, dev_name(device)); | 402 | dev_set_name(f_dev, "%s", dev_name(device)); |
396 | f_dev->parent = device; | 403 | f_dev->parent = device; |
397 | f_dev->class = &firmware_class; | 404 | f_dev->class = &firmware_class; |
398 | dev_set_drvdata(f_dev, fw_priv); | 405 | dev_set_drvdata(f_dev, fw_priv); |
@@ -400,14 +407,17 @@ static int fw_register_device(struct device **dev_p, const char *fw_name, | |||
400 | retval = device_register(f_dev); | 407 | retval = device_register(f_dev); |
401 | if (retval) { | 408 | if (retval) { |
402 | dev_err(device, "%s: device_register failed\n", __func__); | 409 | dev_err(device, "%s: device_register failed\n", __func__); |
403 | goto error_kfree; | 410 | put_device(f_dev); |
411 | goto error_kfree_fw_id; | ||
404 | } | 412 | } |
405 | *dev_p = f_dev; | 413 | *dev_p = f_dev; |
406 | return 0; | 414 | return 0; |
407 | 415 | ||
416 | error_kfree_fw_id: | ||
417 | kfree(fw_priv->fw_id); | ||
408 | error_kfree: | 418 | error_kfree: |
409 | kfree(fw_priv); | ||
410 | kfree(f_dev); | 419 | kfree(f_dev); |
420 | kfree(fw_priv); | ||
411 | return retval; | 421 | return retval; |
412 | } | 422 | } |
413 | 423 | ||
@@ -615,8 +625,9 @@ request_firmware_work_func(void *arg) | |||
615 | * @cont: function will be called asynchronously when the firmware | 625 | * @cont: function will be called asynchronously when the firmware |
616 | * request is over. | 626 | * request is over. |
617 | * | 627 | * |
618 | * Asynchronous variant of request_firmware() for contexts where | 628 | * Asynchronous variant of request_firmware() for user contexts where |
619 | * it is not possible to sleep. | 629 | * it is not possible to sleep for long time. It can't be called |
630 | * in atomic contexts. | ||
620 | **/ | 631 | **/ |
621 | int | 632 | int |
622 | request_firmware_nowait( | 633 | request_firmware_nowait( |