diff options
Diffstat (limited to 'drivers/base')
-rw-r--r-- | drivers/base/Kconfig | 2 | ||||
-rw-r--r-- | drivers/base/firmware_class.c | 24 | ||||
-rw-r--r-- | drivers/base/platform.c | 31 | ||||
-rw-r--r-- | drivers/base/power/main.c | 7 |
4 files changed, 30 insertions, 34 deletions
diff --git a/drivers/base/Kconfig b/drivers/base/Kconfig index 6318f6b57360..d8e8c49c0cbd 100644 --- a/drivers/base/Kconfig +++ b/drivers/base/Kconfig | |||
@@ -54,7 +54,7 @@ config FIRMWARE_IN_KERNEL | |||
54 | such firmware, and do not wish to use an initrd. | 54 | such firmware, and do not wish to use an initrd. |
55 | 55 | ||
56 | This single option controls the inclusion of firmware for | 56 | This single option controls the inclusion of firmware for |
57 | every driver which usees request_firmare() and ships its | 57 | every driver which uses request_firmare() and ships its |
58 | firmware in the kernel source tree, to avoid a proliferation | 58 | firmware in the kernel source tree, to avoid a proliferation |
59 | of 'Include firmware for xxx device' options. | 59 | of 'Include firmware for xxx device' options. |
60 | 60 | ||
diff --git a/drivers/base/firmware_class.c b/drivers/base/firmware_class.c index c9c92b00fd55..b7e571031ecd 100644 --- a/drivers/base/firmware_class.c +++ b/drivers/base/firmware_class.c | |||
@@ -164,8 +164,7 @@ static ssize_t firmware_loading_store(struct device *dev, | |||
164 | } | 164 | } |
165 | /* fallthrough */ | 165 | /* fallthrough */ |
166 | default: | 166 | default: |
167 | printk(KERN_ERR "%s: unexpected value (%d)\n", __func__, | 167 | dev_err(dev, "%s: unexpected value (%d)\n", __func__, loading); |
168 | loading); | ||
169 | /* fallthrough */ | 168 | /* fallthrough */ |
170 | case -1: | 169 | case -1: |
171 | fw_load_abort(fw_priv); | 170 | fw_load_abort(fw_priv); |
@@ -309,7 +308,7 @@ static int fw_register_device(struct device **dev_p, const char *fw_name, | |||
309 | *dev_p = NULL; | 308 | *dev_p = NULL; |
310 | 309 | ||
311 | if (!fw_priv || !f_dev) { | 310 | if (!fw_priv || !f_dev) { |
312 | printk(KERN_ERR "%s: kmalloc failed\n", __func__); | 311 | dev_err(device, "%s: kmalloc failed\n", __func__); |
313 | retval = -ENOMEM; | 312 | retval = -ENOMEM; |
314 | goto error_kfree; | 313 | goto error_kfree; |
315 | } | 314 | } |
@@ -329,8 +328,7 @@ static int fw_register_device(struct device **dev_p, const char *fw_name, | |||
329 | f_dev->uevent_suppress = 1; | 328 | f_dev->uevent_suppress = 1; |
330 | retval = device_register(f_dev); | 329 | retval = device_register(f_dev); |
331 | if (retval) { | 330 | if (retval) { |
332 | printk(KERN_ERR "%s: device_register failed\n", | 331 | dev_err(device, "%s: device_register failed\n", __func__); |
333 | __func__); | ||
334 | goto error_kfree; | 332 | goto error_kfree; |
335 | } | 333 | } |
336 | *dev_p = f_dev; | 334 | *dev_p = f_dev; |
@@ -363,15 +361,13 @@ static int fw_setup_device(struct firmware *fw, struct device **dev_p, | |||
363 | fw_priv->fw = fw; | 361 | fw_priv->fw = fw; |
364 | retval = sysfs_create_bin_file(&f_dev->kobj, &fw_priv->attr_data); | 362 | retval = sysfs_create_bin_file(&f_dev->kobj, &fw_priv->attr_data); |
365 | if (retval) { | 363 | if (retval) { |
366 | printk(KERN_ERR "%s: sysfs_create_bin_file failed\n", | 364 | dev_err(device, "%s: sysfs_create_bin_file failed\n", __func__); |
367 | __func__); | ||
368 | goto error_unreg; | 365 | goto error_unreg; |
369 | } | 366 | } |
370 | 367 | ||
371 | retval = device_create_file(f_dev, &dev_attr_loading); | 368 | retval = device_create_file(f_dev, &dev_attr_loading); |
372 | if (retval) { | 369 | if (retval) { |
373 | printk(KERN_ERR "%s: device_create_file failed\n", | 370 | dev_err(device, "%s: device_create_file failed\n", __func__); |
374 | __func__); | ||
375 | goto error_unreg; | 371 | goto error_unreg; |
376 | } | 372 | } |
377 | 373 | ||
@@ -401,8 +397,8 @@ _request_firmware(const struct firmware **firmware_p, const char *name, | |||
401 | 397 | ||
402 | *firmware_p = firmware = kzalloc(sizeof(*firmware), GFP_KERNEL); | 398 | *firmware_p = firmware = kzalloc(sizeof(*firmware), GFP_KERNEL); |
403 | if (!firmware) { | 399 | if (!firmware) { |
404 | printk(KERN_ERR "%s: kmalloc(struct firmware) failed\n", | 400 | dev_err(device, "%s: kmalloc(struct firmware) failed\n", |
405 | __func__); | 401 | __func__); |
406 | retval = -ENOMEM; | 402 | retval = -ENOMEM; |
407 | goto out; | 403 | goto out; |
408 | } | 404 | } |
@@ -411,15 +407,15 @@ _request_firmware(const struct firmware **firmware_p, const char *name, | |||
411 | builtin++) { | 407 | builtin++) { |
412 | if (strcmp(name, builtin->name)) | 408 | if (strcmp(name, builtin->name)) |
413 | continue; | 409 | continue; |
414 | printk(KERN_INFO "firmware: using built-in firmware %s\n", | 410 | dev_info(device, "firmware: using built-in firmware %s\n", |
415 | name); | 411 | name); |
416 | firmware->size = builtin->size; | 412 | firmware->size = builtin->size; |
417 | firmware->data = builtin->data; | 413 | firmware->data = builtin->data; |
418 | return 0; | 414 | return 0; |
419 | } | 415 | } |
420 | 416 | ||
421 | if (uevent) | 417 | if (uevent) |
422 | printk(KERN_INFO "firmware: requesting %s\n", name); | 418 | dev_info(device, "firmware: requesting %s\n", name); |
423 | 419 | ||
424 | retval = fw_setup_device(firmware, &f_dev, name, device, uevent); | 420 | retval = fw_setup_device(firmware, &f_dev, name, device, uevent); |
425 | if (retval) | 421 | if (retval) |
diff --git a/drivers/base/platform.c b/drivers/base/platform.c index 9e60f7c739c6..dfcbfe504867 100644 --- a/drivers/base/platform.c +++ b/drivers/base/platform.c | |||
@@ -42,10 +42,8 @@ struct resource *platform_get_resource(struct platform_device *dev, | |||
42 | for (i = 0; i < dev->num_resources; i++) { | 42 | for (i = 0; i < dev->num_resources; i++) { |
43 | struct resource *r = &dev->resource[i]; | 43 | struct resource *r = &dev->resource[i]; |
44 | 44 | ||
45 | if ((r->flags & (IORESOURCE_IO|IORESOURCE_MEM| | 45 | if (type == resource_type(r) && num-- == 0) |
46 | IORESOURCE_IRQ|IORESOURCE_DMA)) == type) | 46 | return r; |
47 | if (num-- == 0) | ||
48 | return r; | ||
49 | } | 47 | } |
50 | return NULL; | 48 | return NULL; |
51 | } | 49 | } |
@@ -78,10 +76,8 @@ struct resource *platform_get_resource_byname(struct platform_device *dev, | |||
78 | for (i = 0; i < dev->num_resources; i++) { | 76 | for (i = 0; i < dev->num_resources; i++) { |
79 | struct resource *r = &dev->resource[i]; | 77 | struct resource *r = &dev->resource[i]; |
80 | 78 | ||
81 | if ((r->flags & (IORESOURCE_IO|IORESOURCE_MEM| | 79 | if (type == resource_type(r) && !strcmp(r->name, name)) |
82 | IORESOURCE_IRQ|IORESOURCE_DMA)) == type) | 80 | return r; |
83 | if (!strcmp(r->name, name)) | ||
84 | return r; | ||
85 | } | 81 | } |
86 | return NULL; | 82 | return NULL; |
87 | } | 83 | } |
@@ -259,9 +255,9 @@ int platform_device_add(struct platform_device *pdev) | |||
259 | 255 | ||
260 | p = r->parent; | 256 | p = r->parent; |
261 | if (!p) { | 257 | if (!p) { |
262 | if (r->flags & IORESOURCE_MEM) | 258 | if (resource_type(r) == IORESOURCE_MEM) |
263 | p = &iomem_resource; | 259 | p = &iomem_resource; |
264 | else if (r->flags & IORESOURCE_IO) | 260 | else if (resource_type(r) == IORESOURCE_IO) |
265 | p = &ioport_resource; | 261 | p = &ioport_resource; |
266 | } | 262 | } |
267 | 263 | ||
@@ -282,9 +278,14 @@ int platform_device_add(struct platform_device *pdev) | |||
282 | return ret; | 278 | return ret; |
283 | 279 | ||
284 | failed: | 280 | failed: |
285 | while (--i >= 0) | 281 | while (--i >= 0) { |
286 | if (pdev->resource[i].flags & (IORESOURCE_MEM|IORESOURCE_IO)) | 282 | struct resource *r = &pdev->resource[i]; |
287 | release_resource(&pdev->resource[i]); | 283 | unsigned long type = resource_type(r); |
284 | |||
285 | if (type == IORESOURCE_MEM || type == IORESOURCE_IO) | ||
286 | release_resource(r); | ||
287 | } | ||
288 | |||
288 | return ret; | 289 | return ret; |
289 | } | 290 | } |
290 | EXPORT_SYMBOL_GPL(platform_device_add); | 291 | EXPORT_SYMBOL_GPL(platform_device_add); |
@@ -306,7 +307,9 @@ void platform_device_del(struct platform_device *pdev) | |||
306 | 307 | ||
307 | for (i = 0; i < pdev->num_resources; i++) { | 308 | for (i = 0; i < pdev->num_resources; i++) { |
308 | struct resource *r = &pdev->resource[i]; | 309 | struct resource *r = &pdev->resource[i]; |
309 | if (r->flags & (IORESOURCE_MEM|IORESOURCE_IO)) | 310 | unsigned long type = resource_type(r); |
311 | |||
312 | if (type == IORESOURCE_MEM || type == IORESOURCE_IO) | ||
310 | release_resource(r); | 313 | release_resource(r); |
311 | } | 314 | } |
312 | } | 315 | } |
diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c index b0eb6afdd861..692c20ba5144 100644 --- a/drivers/base/power/main.c +++ b/drivers/base/power/main.c | |||
@@ -778,10 +778,7 @@ EXPORT_SYMBOL_GPL(device_suspend); | |||
778 | 778 | ||
779 | void __suspend_report_result(const char *function, void *fn, int ret) | 779 | void __suspend_report_result(const char *function, void *fn, int ret) |
780 | { | 780 | { |
781 | if (ret) { | 781 | if (ret) |
782 | printk(KERN_ERR "%s(): ", function); | 782 | printk(KERN_ERR "%s(): %pF returns %d\n", function, fn, ret); |
783 | print_fn_descriptor_symbol("%s returns ", fn); | ||
784 | printk("%d\n", ret); | ||
785 | } | ||
786 | } | 783 | } |
787 | EXPORT_SYMBOL_GPL(__suspend_report_result); | 784 | EXPORT_SYMBOL_GPL(__suspend_report_result); |