diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2015-04-13 20:17:32 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2015-04-13 20:17:32 -0400 |
| commit | c4be50eee2bd4d50e0f0ca58776f685c08de69c3 (patch) | |
| tree | 819da448b2916a293e5c600c95d72db83ec77017 /drivers/base | |
| parent | 42e3a58b028e0e51746f596a11abfec01cd1c5c4 (diff) | |
| parent | c9e15f25f514a76d906be01e621f400cdee94558 (diff) | |
Merge tag 'driver-core-4.1-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core
Pull driver core updates from Greg KH:
"Here's the driver-core / kobject / lz4 tree update for 4.1-rc1.
Everything here has been in linux-next for a while with no reported
issues. It's mostly just coding style cleanups, with other minor
changes in here as well, nothing big"
* tag 'driver-core-4.1-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core: (32 commits)
debugfs: allow bad parent pointers to be passed in
stable_kernel_rules: Add clause about specification of kernel versions to patch.
kobject: WARN as tip when call kobject_get() to a kobject not initialized
lib/lz4: Pull out constant tables
drivers: platform: parse IRQ flags from resources
driver core: Make probe deferral more quiet
drivers/core/of: Add symlink to device-tree from devices with an OF node
device: Add dev_of_node() accessor
drivers: base: fw: fix ret value when loading fw
firmware: Avoid manual device_create_file() calls
drivers/base: cacheinfo: validate device node for all the caches
drivers/base: use tabs where possible in code indentation
driver core: add missing blank line after declaration
drivers: base: node: Delete space after pointer declaration
drivers: base: memory: Use tabs instead of spaces
firmware_class: Fix whitespace and indentation
drivers: base: dma-mapping: Erase blank space after pointer
drivers: base: class: Add a blank line after declarations
attribute_container: fix missing blank lines after declarations
drivers: base: memory: Fix switch indent
...
Diffstat (limited to 'drivers/base')
| -rw-r--r-- | drivers/base/attribute_container.c | 2 | ||||
| -rw-r--r-- | drivers/base/bus.c | 4 | ||||
| -rw-r--r-- | drivers/base/cacheinfo.c | 13 | ||||
| -rw-r--r-- | drivers/base/class.c | 2 | ||||
| -rw-r--r-- | drivers/base/core.c | 19 | ||||
| -rw-r--r-- | drivers/base/dd.c | 16 | ||||
| -rw-r--r-- | drivers/base/dma-mapping.c | 2 | ||||
| -rw-r--r-- | drivers/base/driver.c | 1 | ||||
| -rw-r--r-- | drivers/base/firmware_class.c | 49 | ||||
| -rw-r--r-- | drivers/base/map.c | 3 | ||||
| -rw-r--r-- | drivers/base/memory.c | 58 | ||||
| -rw-r--r-- | drivers/base/node.c | 28 | ||||
| -rw-r--r-- | drivers/base/platform.c | 9 | ||||
| -rw-r--r-- | drivers/base/property.c | 2 | ||||
| -rw-r--r-- | drivers/base/soc.c | 10 |
15 files changed, 129 insertions, 89 deletions
diff --git a/drivers/base/attribute_container.c b/drivers/base/attribute_container.c index 3ead3af4be61..2ba4cac080c5 100644 --- a/drivers/base/attribute_container.c +++ b/drivers/base/attribute_container.c | |||
| @@ -94,6 +94,7 @@ int | |||
| 94 | attribute_container_unregister(struct attribute_container *cont) | 94 | attribute_container_unregister(struct attribute_container *cont) |
| 95 | { | 95 | { |
| 96 | int retval = -EBUSY; | 96 | int retval = -EBUSY; |
| 97 | |||
| 97 | mutex_lock(&attribute_container_mutex); | 98 | mutex_lock(&attribute_container_mutex); |
| 98 | spin_lock(&cont->containers.k_lock); | 99 | spin_lock(&cont->containers.k_lock); |
| 99 | if (!list_empty(&cont->containers.k_list)) | 100 | if (!list_empty(&cont->containers.k_list)) |
| @@ -349,6 +350,7 @@ int | |||
| 349 | attribute_container_add_class_device(struct device *classdev) | 350 | attribute_container_add_class_device(struct device *classdev) |
| 350 | { | 351 | { |
| 351 | int error = device_add(classdev); | 352 | int error = device_add(classdev); |
| 353 | |||
| 352 | if (error) | 354 | if (error) |
| 353 | return error; | 355 | return error; |
| 354 | return attribute_container_add_attrs(classdev); | 356 | return attribute_container_add_attrs(classdev); |
diff --git a/drivers/base/bus.c b/drivers/base/bus.c index 876bae5ade33..79bc203f51ef 100644 --- a/drivers/base/bus.c +++ b/drivers/base/bus.c | |||
| @@ -515,11 +515,11 @@ int bus_add_device(struct device *dev) | |||
| 515 | goto out_put; | 515 | goto out_put; |
| 516 | error = device_add_groups(dev, bus->dev_groups); | 516 | error = device_add_groups(dev, bus->dev_groups); |
| 517 | if (error) | 517 | if (error) |
| 518 | goto out_groups; | 518 | goto out_id; |
| 519 | error = sysfs_create_link(&bus->p->devices_kset->kobj, | 519 | error = sysfs_create_link(&bus->p->devices_kset->kobj, |
| 520 | &dev->kobj, dev_name(dev)); | 520 | &dev->kobj, dev_name(dev)); |
| 521 | if (error) | 521 | if (error) |
| 522 | goto out_id; | 522 | goto out_groups; |
| 523 | error = sysfs_create_link(&dev->kobj, | 523 | error = sysfs_create_link(&dev->kobj, |
| 524 | &dev->bus->p->subsys.kobj, "subsystem"); | 524 | &dev->bus->p->subsys.kobj, "subsystem"); |
| 525 | if (error) | 525 | if (error) |
diff --git a/drivers/base/cacheinfo.c b/drivers/base/cacheinfo.c index 6e64563361f0..9c2ba1c97c42 100644 --- a/drivers/base/cacheinfo.c +++ b/drivers/base/cacheinfo.c | |||
| @@ -62,15 +62,21 @@ static int cache_setup_of_node(unsigned int cpu) | |||
| 62 | return -ENOENT; | 62 | return -ENOENT; |
| 63 | } | 63 | } |
| 64 | 64 | ||
| 65 | while (np && index < cache_leaves(cpu)) { | 65 | while (index < cache_leaves(cpu)) { |
| 66 | this_leaf = this_cpu_ci->info_list + index; | 66 | this_leaf = this_cpu_ci->info_list + index; |
| 67 | if (this_leaf->level != 1) | 67 | if (this_leaf->level != 1) |
| 68 | np = of_find_next_cache_node(np); | 68 | np = of_find_next_cache_node(np); |
| 69 | else | 69 | else |
| 70 | np = of_node_get(np);/* cpu node itself */ | 70 | np = of_node_get(np);/* cpu node itself */ |
| 71 | if (!np) | ||
| 72 | break; | ||
| 71 | this_leaf->of_node = np; | 73 | this_leaf->of_node = np; |
| 72 | index++; | 74 | index++; |
| 73 | } | 75 | } |
| 76 | |||
| 77 | if (index != cache_leaves(cpu)) /* not all OF nodes populated */ | ||
| 78 | return -ENOENT; | ||
| 79 | |||
| 74 | return 0; | 80 | return 0; |
| 75 | } | 81 | } |
| 76 | 82 | ||
| @@ -189,8 +195,11 @@ static int detect_cache_attributes(unsigned int cpu) | |||
| 189 | * will be set up here only if they are not populated already | 195 | * will be set up here only if they are not populated already |
| 190 | */ | 196 | */ |
| 191 | ret = cache_shared_cpu_map_setup(cpu); | 197 | ret = cache_shared_cpu_map_setup(cpu); |
| 192 | if (ret) | 198 | if (ret) { |
| 199 | pr_warn("Unable to detect cache hierarcy from DT for CPU %d\n", | ||
| 200 | cpu); | ||
| 193 | goto free_ci; | 201 | goto free_ci; |
| 202 | } | ||
| 194 | return 0; | 203 | return 0; |
| 195 | 204 | ||
| 196 | free_ci: | 205 | free_ci: |
diff --git a/drivers/base/class.c b/drivers/base/class.c index f96f70419a78..6e810881e48b 100644 --- a/drivers/base/class.c +++ b/drivers/base/class.c | |||
| @@ -90,6 +90,7 @@ int class_create_file_ns(struct class *cls, const struct class_attribute *attr, | |||
| 90 | const void *ns) | 90 | const void *ns) |
| 91 | { | 91 | { |
| 92 | int error; | 92 | int error; |
| 93 | |||
| 93 | if (cls) | 94 | if (cls) |
| 94 | error = sysfs_create_file_ns(&cls->p->subsys.kobj, | 95 | error = sysfs_create_file_ns(&cls->p->subsys.kobj, |
| 95 | &attr->attr, ns); | 96 | &attr->attr, ns); |
| @@ -488,6 +489,7 @@ ssize_t show_class_attr_string(struct class *class, | |||
| 488 | struct class_attribute *attr, char *buf) | 489 | struct class_attribute *attr, char *buf) |
| 489 | { | 490 | { |
| 490 | struct class_attribute_string *cs; | 491 | struct class_attribute_string *cs; |
| 492 | |||
| 491 | cs = container_of(attr, struct class_attribute_string, attr); | 493 | cs = container_of(attr, struct class_attribute_string, attr); |
| 492 | return snprintf(buf, PAGE_SIZE, "%s\n", cs->str); | 494 | return snprintf(buf, PAGE_SIZE, "%s\n", cs->str); |
| 493 | } | 495 | } |
diff --git a/drivers/base/core.c b/drivers/base/core.c index 07304a3b9ee2..cadf165651d8 100644 --- a/drivers/base/core.c +++ b/drivers/base/core.c | |||
| @@ -805,8 +805,16 @@ static void cleanup_device_parent(struct device *dev) | |||
| 805 | 805 | ||
| 806 | static int device_add_class_symlinks(struct device *dev) | 806 | static int device_add_class_symlinks(struct device *dev) |
| 807 | { | 807 | { |
| 808 | struct device_node *of_node = dev_of_node(dev); | ||
| 808 | int error; | 809 | int error; |
| 809 | 810 | ||
| 811 | if (of_node) { | ||
| 812 | error = sysfs_create_link(&dev->kobj, &of_node->kobj,"of_node"); | ||
| 813 | if (error) | ||
| 814 | dev_warn(dev, "Error %d creating of_node link\n",error); | ||
| 815 | /* An error here doesn't warrant bringing down the device */ | ||
| 816 | } | ||
| 817 | |||
| 810 | if (!dev->class) | 818 | if (!dev->class) |
| 811 | return 0; | 819 | return 0; |
| 812 | 820 | ||
| @@ -814,7 +822,7 @@ static int device_add_class_symlinks(struct device *dev) | |||
| 814 | &dev->class->p->subsys.kobj, | 822 | &dev->class->p->subsys.kobj, |
| 815 | "subsystem"); | 823 | "subsystem"); |
| 816 | if (error) | 824 | if (error) |
| 817 | goto out; | 825 | goto out_devnode; |
| 818 | 826 | ||
| 819 | if (dev->parent && device_is_not_partition(dev)) { | 827 | if (dev->parent && device_is_not_partition(dev)) { |
| 820 | error = sysfs_create_link(&dev->kobj, &dev->parent->kobj, | 828 | error = sysfs_create_link(&dev->kobj, &dev->parent->kobj, |
| @@ -842,12 +850,16 @@ out_device: | |||
| 842 | 850 | ||
| 843 | out_subsys: | 851 | out_subsys: |
| 844 | sysfs_remove_link(&dev->kobj, "subsystem"); | 852 | sysfs_remove_link(&dev->kobj, "subsystem"); |
| 845 | out: | 853 | out_devnode: |
| 854 | sysfs_remove_link(&dev->kobj, "of_node"); | ||
| 846 | return error; | 855 | return error; |
| 847 | } | 856 | } |
| 848 | 857 | ||
| 849 | static void device_remove_class_symlinks(struct device *dev) | 858 | static void device_remove_class_symlinks(struct device *dev) |
| 850 | { | 859 | { |
| 860 | if (dev_of_node(dev)) | ||
| 861 | sysfs_remove_link(&dev->kobj, "of_node"); | ||
| 862 | |||
| 851 | if (!dev->class) | 863 | if (!dev->class) |
| 852 | return; | 864 | return; |
| 853 | 865 | ||
| @@ -1095,8 +1107,7 @@ done: | |||
| 1095 | kobject_del(&dev->kobj); | 1107 | kobject_del(&dev->kobj); |
| 1096 | Error: | 1108 | Error: |
| 1097 | cleanup_device_parent(dev); | 1109 | cleanup_device_parent(dev); |
| 1098 | if (parent) | 1110 | put_device(parent); |
| 1099 | put_device(parent); | ||
| 1100 | name_error: | 1111 | name_error: |
| 1101 | kfree(dev->p); | 1112 | kfree(dev->p); |
| 1102 | dev->p = NULL; | 1113 | dev->p = NULL; |
diff --git a/drivers/base/dd.c b/drivers/base/dd.c index cdc779cf79a3..49a4a12fafef 100644 --- a/drivers/base/dd.c +++ b/drivers/base/dd.c | |||
| @@ -320,21 +320,25 @@ probe_failed: | |||
| 320 | dev->driver = NULL; | 320 | dev->driver = NULL; |
| 321 | dev_set_drvdata(dev, NULL); | 321 | dev_set_drvdata(dev, NULL); |
| 322 | 322 | ||
| 323 | if (ret == -EPROBE_DEFER) { | 323 | switch (ret) { |
| 324 | case -EPROBE_DEFER: | ||
| 324 | /* Driver requested deferred probing */ | 325 | /* Driver requested deferred probing */ |
| 325 | dev_info(dev, "Driver %s requests probe deferral\n", drv->name); | 326 | dev_dbg(dev, "Driver %s requests probe deferral\n", drv->name); |
| 326 | driver_deferred_probe_add(dev); | 327 | driver_deferred_probe_add(dev); |
| 327 | /* Did a trigger occur while probing? Need to re-trigger if yes */ | 328 | /* Did a trigger occur while probing? Need to re-trigger if yes */ |
| 328 | if (local_trigger_count != atomic_read(&deferred_trigger_count)) | 329 | if (local_trigger_count != atomic_read(&deferred_trigger_count)) |
| 329 | driver_deferred_probe_trigger(); | 330 | driver_deferred_probe_trigger(); |
| 330 | } else if (ret != -ENODEV && ret != -ENXIO) { | 331 | break; |
| 332 | case -ENODEV: | ||
| 333 | case -ENXIO: | ||
| 334 | pr_debug("%s: probe of %s rejects match %d\n", | ||
| 335 | drv->name, dev_name(dev), ret); | ||
| 336 | break; | ||
| 337 | default: | ||
| 331 | /* driver matched but the probe failed */ | 338 | /* driver matched but the probe failed */ |
| 332 | printk(KERN_WARNING | 339 | printk(KERN_WARNING |
| 333 | "%s: probe of %s failed with error %d\n", | 340 | "%s: probe of %s failed with error %d\n", |
| 334 | drv->name, dev_name(dev), ret); | 341 | drv->name, dev_name(dev), ret); |
| 335 | } else { | ||
| 336 | pr_debug("%s: probe of %s rejects match %d\n", | ||
| 337 | drv->name, dev_name(dev), ret); | ||
| 338 | } | 342 | } |
| 339 | /* | 343 | /* |
| 340 | * Ignore errors returned by ->probe so that the next driver can try | 344 | * Ignore errors returned by ->probe so that the next driver can try |
diff --git a/drivers/base/dma-mapping.c b/drivers/base/dma-mapping.c index 9e8bbdd470ca..d95c5971c225 100644 --- a/drivers/base/dma-mapping.c +++ b/drivers/base/dma-mapping.c | |||
| @@ -62,7 +62,7 @@ static int dmam_match(struct device *dev, void *res, void *match_data) | |||
| 62 | * RETURNS: | 62 | * RETURNS: |
| 63 | * Pointer to allocated memory on success, NULL on failure. | 63 | * Pointer to allocated memory on success, NULL on failure. |
| 64 | */ | 64 | */ |
| 65 | void * dmam_alloc_coherent(struct device *dev, size_t size, | 65 | void *dmam_alloc_coherent(struct device *dev, size_t size, |
| 66 | dma_addr_t *dma_handle, gfp_t gfp) | 66 | dma_addr_t *dma_handle, gfp_t gfp) |
| 67 | { | 67 | { |
| 68 | struct dma_devres *dr; | 68 | struct dma_devres *dr; |
diff --git a/drivers/base/driver.c b/drivers/base/driver.c index 9e29943e56ca..4eabfe28d2b3 100644 --- a/drivers/base/driver.c +++ b/drivers/base/driver.c | |||
| @@ -103,6 +103,7 @@ int driver_create_file(struct device_driver *drv, | |||
| 103 | const struct driver_attribute *attr) | 103 | const struct driver_attribute *attr) |
| 104 | { | 104 | { |
| 105 | int error; | 105 | int error; |
| 106 | |||
| 106 | if (drv) | 107 | if (drv) |
| 107 | error = sysfs_create_file(&drv->p->kobj, &attr->attr); | 108 | error = sysfs_create_file(&drv->p->kobj, &attr->attr); |
| 108 | else | 109 | else |
diff --git a/drivers/base/firmware_class.c b/drivers/base/firmware_class.c index 6c5c9edf5ff6..171841ad1008 100644 --- a/drivers/base/firmware_class.c +++ b/drivers/base/firmware_class.c | |||
| @@ -181,7 +181,7 @@ static struct firmware_buf *__allocate_fw_buf(const char *fw_name, | |||
| 181 | { | 181 | { |
| 182 | struct firmware_buf *buf; | 182 | struct firmware_buf *buf; |
| 183 | 183 | ||
| 184 | buf = kzalloc(sizeof(*buf) + strlen(fw_name) + 1 , GFP_ATOMIC); | 184 | buf = kzalloc(sizeof(*buf) + strlen(fw_name) + 1, GFP_ATOMIC); |
| 185 | 185 | ||
| 186 | if (!buf) | 186 | if (!buf) |
| 187 | return buf; | 187 | return buf; |
| @@ -835,6 +835,26 @@ static struct bin_attribute firmware_attr_data = { | |||
| 835 | .write = firmware_data_write, | 835 | .write = firmware_data_write, |
| 836 | }; | 836 | }; |
| 837 | 837 | ||
| 838 | static struct attribute *fw_dev_attrs[] = { | ||
| 839 | &dev_attr_loading.attr, | ||
| 840 | NULL | ||
| 841 | }; | ||
| 842 | |||
| 843 | static struct bin_attribute *fw_dev_bin_attrs[] = { | ||
| 844 | &firmware_attr_data, | ||
| 845 | NULL | ||
| 846 | }; | ||
| 847 | |||
| 848 | static const struct attribute_group fw_dev_attr_group = { | ||
| 849 | .attrs = fw_dev_attrs, | ||
| 850 | .bin_attrs = fw_dev_bin_attrs, | ||
| 851 | }; | ||
| 852 | |||
| 853 | static const struct attribute_group *fw_dev_attr_groups[] = { | ||
| 854 | &fw_dev_attr_group, | ||
| 855 | NULL | ||
| 856 | }; | ||
| 857 | |||
| 838 | static struct firmware_priv * | 858 | static struct firmware_priv * |
| 839 | fw_create_instance(struct firmware *firmware, const char *fw_name, | 859 | fw_create_instance(struct firmware *firmware, const char *fw_name, |
| 840 | struct device *device, unsigned int opt_flags) | 860 | struct device *device, unsigned int opt_flags) |
| @@ -856,6 +876,7 @@ fw_create_instance(struct firmware *firmware, const char *fw_name, | |||
| 856 | dev_set_name(f_dev, "%s", fw_name); | 876 | dev_set_name(f_dev, "%s", fw_name); |
| 857 | f_dev->parent = device; | 877 | f_dev->parent = device; |
| 858 | f_dev->class = &firmware_class; | 878 | f_dev->class = &firmware_class; |
| 879 | f_dev->groups = fw_dev_attr_groups; | ||
| 859 | exit: | 880 | exit: |
| 860 | return fw_priv; | 881 | return fw_priv; |
| 861 | } | 882 | } |
| @@ -879,25 +900,10 @@ static int _request_firmware_load(struct firmware_priv *fw_priv, | |||
| 879 | goto err_put_dev; | 900 | goto err_put_dev; |
| 880 | } | 901 | } |
| 881 | 902 | ||
| 882 | retval = device_create_bin_file(f_dev, &firmware_attr_data); | ||
| 883 | if (retval) { | ||
| 884 | dev_err(f_dev, "%s: sysfs_create_bin_file failed\n", __func__); | ||
| 885 | goto err_del_dev; | ||
| 886 | } | ||
| 887 | |||
| 888 | mutex_lock(&fw_lock); | 903 | mutex_lock(&fw_lock); |
| 889 | list_add(&buf->pending_list, &pending_fw_head); | 904 | list_add(&buf->pending_list, &pending_fw_head); |
| 890 | mutex_unlock(&fw_lock); | 905 | mutex_unlock(&fw_lock); |
| 891 | 906 | ||
| 892 | retval = device_create_file(f_dev, &dev_attr_loading); | ||
| 893 | if (retval) { | ||
| 894 | mutex_lock(&fw_lock); | ||
| 895 | list_del_init(&buf->pending_list); | ||
| 896 | mutex_unlock(&fw_lock); | ||
| 897 | dev_err(f_dev, "%s: device_create_file failed\n", __func__); | ||
| 898 | goto err_del_bin_attr; | ||
| 899 | } | ||
| 900 | |||
| 901 | if (opt_flags & FW_OPT_UEVENT) { | 907 | if (opt_flags & FW_OPT_UEVENT) { |
| 902 | buf->need_uevent = true; | 908 | buf->need_uevent = true; |
| 903 | dev_set_uevent_suppress(f_dev, false); | 909 | dev_set_uevent_suppress(f_dev, false); |
| @@ -913,6 +919,8 @@ static int _request_firmware_load(struct firmware_priv *fw_priv, | |||
| 913 | mutex_lock(&fw_lock); | 919 | mutex_lock(&fw_lock); |
| 914 | fw_load_abort(fw_priv); | 920 | fw_load_abort(fw_priv); |
| 915 | mutex_unlock(&fw_lock); | 921 | mutex_unlock(&fw_lock); |
| 922 | } else if (retval > 0) { | ||
| 923 | retval = 0; | ||
| 916 | } | 924 | } |
| 917 | 925 | ||
| 918 | if (is_fw_load_aborted(buf)) | 926 | if (is_fw_load_aborted(buf)) |
| @@ -920,10 +928,6 @@ static int _request_firmware_load(struct firmware_priv *fw_priv, | |||
| 920 | else if (!buf->data) | 928 | else if (!buf->data) |
| 921 | retval = -ENOMEM; | 929 | retval = -ENOMEM; |
| 922 | 930 | ||
| 923 | device_remove_file(f_dev, &dev_attr_loading); | ||
| 924 | err_del_bin_attr: | ||
| 925 | device_remove_bin_file(f_dev, &firmware_attr_data); | ||
| 926 | err_del_dev: | ||
| 927 | device_del(f_dev); | 931 | device_del(f_dev); |
| 928 | err_put_dev: | 932 | err_put_dev: |
| 929 | put_device(f_dev); | 933 | put_device(f_dev); |
| @@ -1168,7 +1172,7 @@ _request_firmware(const struct firmware **firmware_p, const char *name, | |||
| 1168 | **/ | 1172 | **/ |
| 1169 | int | 1173 | int |
| 1170 | request_firmware(const struct firmware **firmware_p, const char *name, | 1174 | request_firmware(const struct firmware **firmware_p, const char *name, |
| 1171 | struct device *device) | 1175 | struct device *device) |
| 1172 | { | 1176 | { |
| 1173 | int ret; | 1177 | int ret; |
| 1174 | 1178 | ||
| @@ -1196,6 +1200,7 @@ int request_firmware_direct(const struct firmware **firmware_p, | |||
| 1196 | const char *name, struct device *device) | 1200 | const char *name, struct device *device) |
| 1197 | { | 1201 | { |
| 1198 | int ret; | 1202 | int ret; |
| 1203 | |||
| 1199 | __module_get(THIS_MODULE); | 1204 | __module_get(THIS_MODULE); |
| 1200 | ret = _request_firmware(firmware_p, name, device, | 1205 | ret = _request_firmware(firmware_p, name, device, |
| 1201 | FW_OPT_UEVENT | FW_OPT_NO_WARN); | 1206 | FW_OPT_UEVENT | FW_OPT_NO_WARN); |
| @@ -1276,7 +1281,7 @@ request_firmware_nowait( | |||
| 1276 | { | 1281 | { |
| 1277 | struct firmware_work *fw_work; | 1282 | struct firmware_work *fw_work; |
| 1278 | 1283 | ||
| 1279 | fw_work = kzalloc(sizeof (struct firmware_work), gfp); | 1284 | fw_work = kzalloc(sizeof(struct firmware_work), gfp); |
| 1280 | if (!fw_work) | 1285 | if (!fw_work) |
| 1281 | return -ENOMEM; | 1286 | return -ENOMEM; |
| 1282 | 1287 | ||
diff --git a/drivers/base/map.c b/drivers/base/map.c index e87017f36853..c1d38234d725 100644 --- a/drivers/base/map.c +++ b/drivers/base/map.c | |||
| @@ -41,8 +41,7 @@ int kobj_map(struct kobj_map *domain, dev_t dev, unsigned long range, | |||
| 41 | if (n > 255) | 41 | if (n > 255) |
| 42 | n = 255; | 42 | n = 255; |
| 43 | 43 | ||
| 44 | p = kmalloc(sizeof(struct probe) * n, GFP_KERNEL); | 44 | p = kmalloc_array(n, sizeof(struct probe), GFP_KERNEL); |
| 45 | |||
| 46 | if (p == NULL) | 45 | if (p == NULL) |
| 47 | return -ENOMEM; | 46 | return -ENOMEM; |
| 48 | 47 | ||
diff --git a/drivers/base/memory.c b/drivers/base/memory.c index 85be040a21c8..af9c911cd6b5 100644 --- a/drivers/base/memory.c +++ b/drivers/base/memory.c | |||
| @@ -52,13 +52,13 @@ static BLOCKING_NOTIFIER_HEAD(memory_chain); | |||
| 52 | 52 | ||
| 53 | int register_memory_notifier(struct notifier_block *nb) | 53 | int register_memory_notifier(struct notifier_block *nb) |
| 54 | { | 54 | { |
| 55 | return blocking_notifier_chain_register(&memory_chain, nb); | 55 | return blocking_notifier_chain_register(&memory_chain, nb); |
| 56 | } | 56 | } |
| 57 | EXPORT_SYMBOL(register_memory_notifier); | 57 | EXPORT_SYMBOL(register_memory_notifier); |
| 58 | 58 | ||
| 59 | void unregister_memory_notifier(struct notifier_block *nb) | 59 | void unregister_memory_notifier(struct notifier_block *nb) |
| 60 | { | 60 | { |
| 61 | blocking_notifier_chain_unregister(&memory_chain, nb); | 61 | blocking_notifier_chain_unregister(&memory_chain, nb); |
| 62 | } | 62 | } |
| 63 | EXPORT_SYMBOL(unregister_memory_notifier); | 63 | EXPORT_SYMBOL(unregister_memory_notifier); |
| 64 | 64 | ||
| @@ -152,20 +152,20 @@ static ssize_t show_mem_state(struct device *dev, | |||
| 152 | * so that they're not open-coded | 152 | * so that they're not open-coded |
| 153 | */ | 153 | */ |
| 154 | switch (mem->state) { | 154 | switch (mem->state) { |
| 155 | case MEM_ONLINE: | 155 | case MEM_ONLINE: |
| 156 | len = sprintf(buf, "online\n"); | 156 | len = sprintf(buf, "online\n"); |
| 157 | break; | 157 | break; |
| 158 | case MEM_OFFLINE: | 158 | case MEM_OFFLINE: |
| 159 | len = sprintf(buf, "offline\n"); | 159 | len = sprintf(buf, "offline\n"); |
| 160 | break; | 160 | break; |
| 161 | case MEM_GOING_OFFLINE: | 161 | case MEM_GOING_OFFLINE: |
| 162 | len = sprintf(buf, "going-offline\n"); | 162 | len = sprintf(buf, "going-offline\n"); |
| 163 | break; | 163 | break; |
| 164 | default: | 164 | default: |
| 165 | len = sprintf(buf, "ERROR-UNKNOWN-%ld\n", | 165 | len = sprintf(buf, "ERROR-UNKNOWN-%ld\n", |
| 166 | mem->state); | 166 | mem->state); |
| 167 | WARN_ON(1); | 167 | WARN_ON(1); |
| 168 | break; | 168 | break; |
| 169 | } | 169 | } |
| 170 | 170 | ||
| 171 | return len; | 171 | return len; |
| @@ -232,19 +232,19 @@ memory_block_action(unsigned long phys_index, unsigned long action, int online_t | |||
| 232 | first_page = pfn_to_page(start_pfn); | 232 | first_page = pfn_to_page(start_pfn); |
| 233 | 233 | ||
| 234 | switch (action) { | 234 | switch (action) { |
| 235 | case MEM_ONLINE: | 235 | case MEM_ONLINE: |
| 236 | if (!pages_correctly_reserved(start_pfn)) | 236 | if (!pages_correctly_reserved(start_pfn)) |
| 237 | return -EBUSY; | 237 | return -EBUSY; |
| 238 | 238 | ||
| 239 | ret = online_pages(start_pfn, nr_pages, online_type); | 239 | ret = online_pages(start_pfn, nr_pages, online_type); |
| 240 | break; | 240 | break; |
| 241 | case MEM_OFFLINE: | 241 | case MEM_OFFLINE: |
| 242 | ret = offline_pages(start_pfn, nr_pages); | 242 | ret = offline_pages(start_pfn, nr_pages); |
| 243 | break; | 243 | break; |
| 244 | default: | 244 | default: |
| 245 | WARN(1, KERN_WARNING "%s(%ld, %ld) unknown action: " | 245 | WARN(1, KERN_WARNING "%s(%ld, %ld) unknown action: " |
| 246 | "%ld\n", __func__, phys_index, action, action); | 246 | "%ld\n", __func__, phys_index, action, action); |
| 247 | ret = -EINVAL; | 247 | ret = -EINVAL; |
| 248 | } | 248 | } |
| 249 | 249 | ||
| 250 | return ret; | 250 | return ret; |
diff --git a/drivers/base/node.c b/drivers/base/node.c index 36fabe43cd44..a2aa65b4215d 100644 --- a/drivers/base/node.c +++ b/drivers/base/node.c | |||
| @@ -180,7 +180,7 @@ static ssize_t node_read_vmstat(struct device *dev, | |||
| 180 | static DEVICE_ATTR(vmstat, S_IRUGO, node_read_vmstat, NULL); | 180 | static DEVICE_ATTR(vmstat, S_IRUGO, node_read_vmstat, NULL); |
| 181 | 181 | ||
| 182 | static ssize_t node_read_distance(struct device *dev, | 182 | static ssize_t node_read_distance(struct device *dev, |
| 183 | struct device_attribute *attr, char * buf) | 183 | struct device_attribute *attr, char *buf) |
| 184 | { | 184 | { |
| 185 | int nid = dev->id; | 185 | int nid = dev->id; |
| 186 | int len = 0; | 186 | int len = 0; |
| @@ -200,6 +200,17 @@ static ssize_t node_read_distance(struct device *dev, | |||
| 200 | } | 200 | } |
| 201 | static DEVICE_ATTR(distance, S_IRUGO, node_read_distance, NULL); | 201 | static DEVICE_ATTR(distance, S_IRUGO, node_read_distance, NULL); |
| 202 | 202 | ||
| 203 | static struct attribute *node_dev_attrs[] = { | ||
| 204 | &dev_attr_cpumap.attr, | ||
| 205 | &dev_attr_cpulist.attr, | ||
| 206 | &dev_attr_meminfo.attr, | ||
| 207 | &dev_attr_numastat.attr, | ||
| 208 | &dev_attr_distance.attr, | ||
| 209 | &dev_attr_vmstat.attr, | ||
| 210 | NULL | ||
| 211 | }; | ||
| 212 | ATTRIBUTE_GROUPS(node_dev); | ||
| 213 | |||
| 203 | #ifdef CONFIG_HUGETLBFS | 214 | #ifdef CONFIG_HUGETLBFS |
| 204 | /* | 215 | /* |
| 205 | * hugetlbfs per node attributes registration interface: | 216 | * hugetlbfs per node attributes registration interface: |
| @@ -273,16 +284,10 @@ static int register_node(struct node *node, int num, struct node *parent) | |||
| 273 | node->dev.id = num; | 284 | node->dev.id = num; |
| 274 | node->dev.bus = &node_subsys; | 285 | node->dev.bus = &node_subsys; |
| 275 | node->dev.release = node_device_release; | 286 | node->dev.release = node_device_release; |
| 287 | node->dev.groups = node_dev_groups; | ||
| 276 | error = device_register(&node->dev); | 288 | error = device_register(&node->dev); |
| 277 | 289 | ||
| 278 | if (!error){ | 290 | if (!error){ |
| 279 | device_create_file(&node->dev, &dev_attr_cpumap); | ||
| 280 | device_create_file(&node->dev, &dev_attr_cpulist); | ||
| 281 | device_create_file(&node->dev, &dev_attr_meminfo); | ||
| 282 | device_create_file(&node->dev, &dev_attr_numastat); | ||
| 283 | device_create_file(&node->dev, &dev_attr_distance); | ||
| 284 | device_create_file(&node->dev, &dev_attr_vmstat); | ||
| 285 | |||
| 286 | hugetlb_register_node(node); | 291 | hugetlb_register_node(node); |
| 287 | 292 | ||
| 288 | compaction_register_node(node); | 293 | compaction_register_node(node); |
| @@ -299,13 +304,6 @@ static int register_node(struct node *node, int num, struct node *parent) | |||
| 299 | */ | 304 | */ |
| 300 | void unregister_node(struct node *node) | 305 | void unregister_node(struct node *node) |
| 301 | { | 306 | { |
| 302 | device_remove_file(&node->dev, &dev_attr_cpumap); | ||
| 303 | device_remove_file(&node->dev, &dev_attr_cpulist); | ||
| 304 | device_remove_file(&node->dev, &dev_attr_meminfo); | ||
| 305 | device_remove_file(&node->dev, &dev_attr_numastat); | ||
| 306 | device_remove_file(&node->dev, &dev_attr_distance); | ||
| 307 | device_remove_file(&node->dev, &dev_attr_vmstat); | ||
| 308 | |||
| 309 | hugetlb_unregister_node(node); /* no-op, if memoryless node */ | 307 | hugetlb_unregister_node(node); /* no-op, if memoryless node */ |
| 310 | 308 | ||
| 311 | device_unregister(&node->dev); | 309 | device_unregister(&node->dev); |
diff --git a/drivers/base/platform.c b/drivers/base/platform.c index 9421fed40905..e68ab79df28b 100644 --- a/drivers/base/platform.c +++ b/drivers/base/platform.c | |||
| @@ -101,6 +101,15 @@ int platform_get_irq(struct platform_device *dev, unsigned int num) | |||
| 101 | } | 101 | } |
| 102 | 102 | ||
| 103 | r = platform_get_resource(dev, IORESOURCE_IRQ, num); | 103 | r = platform_get_resource(dev, IORESOURCE_IRQ, num); |
| 104 | /* | ||
| 105 | * The resources may pass trigger flags to the irqs that need | ||
| 106 | * to be set up. It so happens that the trigger flags for | ||
| 107 | * IORESOURCE_BITS correspond 1-to-1 to the IRQF_TRIGGER* | ||
| 108 | * settings. | ||
| 109 | */ | ||
| 110 | if (r && r->flags & IORESOURCE_BITS) | ||
| 111 | irqd_set_trigger_type(irq_get_irq_data(r->start), | ||
| 112 | r->flags & IORESOURCE_BITS); | ||
| 104 | 113 | ||
| 105 | return r ? r->start : -ENXIO; | 114 | return r ? r->start : -ENXIO; |
| 106 | #endif | 115 | #endif |
diff --git a/drivers/base/property.c b/drivers/base/property.c index c45845874d4f..423df593f262 100644 --- a/drivers/base/property.c +++ b/drivers/base/property.c | |||
| @@ -365,7 +365,7 @@ int fwnode_property_read_string(struct fwnode_handle *fwnode, | |||
| 365 | const char *propname, const char **val) | 365 | const char *propname, const char **val) |
| 366 | { | 366 | { |
| 367 | if (is_of_node(fwnode)) | 367 | if (is_of_node(fwnode)) |
| 368 | return of_property_read_string(of_node(fwnode),propname, val); | 368 | return of_property_read_string(of_node(fwnode), propname, val); |
| 369 | else if (is_acpi_node(fwnode)) | 369 | else if (is_acpi_node(fwnode)) |
| 370 | return acpi_dev_prop_read(acpi_node(fwnode), propname, | 370 | return acpi_dev_prop_read(acpi_node(fwnode), propname, |
| 371 | DEV_PROP_STRING, val, 1); | 371 | DEV_PROP_STRING, val, 1); |
diff --git a/drivers/base/soc.c b/drivers/base/soc.c index 72b5e7280d14..39fca01c8fa1 100644 --- a/drivers/base/soc.c +++ b/drivers/base/soc.c | |||
| @@ -43,8 +43,8 @@ struct device *soc_device_to_device(struct soc_device *soc_dev) | |||
| 43 | } | 43 | } |
| 44 | 44 | ||
| 45 | static umode_t soc_attribute_mode(struct kobject *kobj, | 45 | static umode_t soc_attribute_mode(struct kobject *kobj, |
| 46 | struct attribute *attr, | 46 | struct attribute *attr, |
| 47 | int index) | 47 | int index) |
| 48 | { | 48 | { |
| 49 | struct device *dev = container_of(kobj, struct device, kobj); | 49 | struct device *dev = container_of(kobj, struct device, kobj); |
| 50 | struct soc_device *soc_dev = container_of(dev, struct soc_device, dev); | 50 | struct soc_device *soc_dev = container_of(dev, struct soc_device, dev); |
| @@ -60,7 +60,7 @@ static umode_t soc_attribute_mode(struct kobject *kobj, | |||
| 60 | return attr->mode; | 60 | return attr->mode; |
| 61 | if ((attr == &dev_attr_soc_id.attr) | 61 | if ((attr == &dev_attr_soc_id.attr) |
| 62 | && (soc_dev->attr->soc_id != NULL)) | 62 | && (soc_dev->attr->soc_id != NULL)) |
| 63 | return attr->mode; | 63 | return attr->mode; |
| 64 | 64 | ||
| 65 | /* Unknown or unfilled attribute. */ | 65 | /* Unknown or unfilled attribute. */ |
| 66 | return 0; | 66 | return 0; |
| @@ -117,7 +117,7 @@ struct soc_device *soc_device_register(struct soc_device_attribute *soc_dev_attr | |||
| 117 | 117 | ||
| 118 | soc_dev = kzalloc(sizeof(*soc_dev), GFP_KERNEL); | 118 | soc_dev = kzalloc(sizeof(*soc_dev), GFP_KERNEL); |
| 119 | if (!soc_dev) { | 119 | if (!soc_dev) { |
| 120 | ret = -ENOMEM; | 120 | ret = -ENOMEM; |
| 121 | goto out1; | 121 | goto out1; |
| 122 | } | 122 | } |
| 123 | 123 | ||
| @@ -135,7 +135,7 @@ struct soc_device *soc_device_register(struct soc_device_attribute *soc_dev_attr | |||
| 135 | } while (ret == -EAGAIN); | 135 | } while (ret == -EAGAIN); |
| 136 | 136 | ||
| 137 | if (ret) | 137 | if (ret) |
| 138 | goto out2; | 138 | goto out2; |
| 139 | 139 | ||
| 140 | soc_dev->attr = soc_dev_attr; | 140 | soc_dev->attr = soc_dev_attr; |
| 141 | soc_dev->dev.bus = &soc_bus_type; | 141 | soc_dev->dev.bus = &soc_bus_type; |
