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 | |
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
...
-rw-r--r-- | Documentation/ABI/stable/sysfs-devices | 10 | ||||
-rw-r--r-- | Documentation/stable_kernel_rules.txt | 10 | ||||
-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 | ||||
-rw-r--r-- | fs/debugfs/inode.c | 3 | ||||
-rw-r--r-- | fs/sysfs/group.c | 11 | ||||
-rw-r--r-- | include/linux/device.h | 7 | ||||
-rw-r--r-- | include/linux/sysfs.h | 15 | ||||
-rw-r--r-- | lib/kobject.c | 7 | ||||
-rw-r--r-- | lib/lz4/lz4_decompress.c | 18 | ||||
-rw-r--r-- | samples/kobject/kobject-example.c | 16 | ||||
-rw-r--r-- | samples/kobject/kset-example.c | 16 |
25 files changed, 219 insertions, 112 deletions
diff --git a/Documentation/ABI/stable/sysfs-devices b/Documentation/ABI/stable/sysfs-devices new file mode 100644 index 000000000000..43f78b88da28 --- /dev/null +++ b/Documentation/ABI/stable/sysfs-devices | |||
@@ -0,0 +1,10 @@ | |||
1 | # Note: This documents additional properties of any device beyond what | ||
2 | # is documented in Documentation/sysfs-rules.txt | ||
3 | |||
4 | What: /sys/devices/*/of_path | ||
5 | Date: February 2015 | ||
6 | Contact: Device Tree mailing list <devicetree@vger.kernel.org> | ||
7 | Description: | ||
8 | Any device associated with a device-tree node will have | ||
9 | an of_path symlink pointing to the corresponding device | ||
10 | node in /sys/firmware/devicetree/ | ||
diff --git a/Documentation/stable_kernel_rules.txt b/Documentation/stable_kernel_rules.txt index 02f8331edb8b..58d0ac4df946 100644 --- a/Documentation/stable_kernel_rules.txt +++ b/Documentation/stable_kernel_rules.txt | |||
@@ -81,6 +81,16 @@ format in the sign-off area: | |||
81 | git cherry-pick fd21073 | 81 | git cherry-pick fd21073 |
82 | git cherry-pick <this commit> | 82 | git cherry-pick <this commit> |
83 | 83 | ||
84 | Also, some patches may have kernel version prerequisites. This can be | ||
85 | specified in the following format in the sign-off area: | ||
86 | |||
87 | Cc: <stable@vger.kernel.org> # 3.3.x- | ||
88 | |||
89 | The tag has the meaning of: | ||
90 | git cherry-pick <this commit> | ||
91 | |||
92 | For each "-stable" tree starting with the specified version. | ||
93 | |||
84 | Following the submission: | 94 | Following the submission: |
85 | 95 | ||
86 | - The sender will receive an ACK when the patch has been accepted into the | 96 | - The sender will receive an ACK when the patch has been accepted into the |
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; |
diff --git a/fs/debugfs/inode.c b/fs/debugfs/inode.c index 96400ab42d13..61e72d44cf94 100644 --- a/fs/debugfs/inode.c +++ b/fs/debugfs/inode.c | |||
@@ -254,6 +254,9 @@ static struct dentry *start_creating(const char *name, struct dentry *parent) | |||
254 | 254 | ||
255 | pr_debug("debugfs: creating file '%s'\n",name); | 255 | pr_debug("debugfs: creating file '%s'\n",name); |
256 | 256 | ||
257 | if (IS_ERR(parent)) | ||
258 | return parent; | ||
259 | |||
257 | error = simple_pin_fs(&debug_fs_type, &debugfs_mount, | 260 | error = simple_pin_fs(&debug_fs_type, &debugfs_mount, |
258 | &debugfs_mount_count); | 261 | &debugfs_mount_count); |
259 | if (error) | 262 | if (error) |
diff --git a/fs/sysfs/group.c b/fs/sysfs/group.c index 2554d8835b48..b400c04371f0 100644 --- a/fs/sysfs/group.c +++ b/fs/sysfs/group.c | |||
@@ -41,7 +41,7 @@ static int create_files(struct kernfs_node *parent, struct kobject *kobj, | |||
41 | 41 | ||
42 | if (grp->attrs) { | 42 | if (grp->attrs) { |
43 | for (i = 0, attr = grp->attrs; *attr && !error; i++, attr++) { | 43 | for (i = 0, attr = grp->attrs; *attr && !error; i++, attr++) { |
44 | umode_t mode = 0; | 44 | umode_t mode = (*attr)->mode; |
45 | 45 | ||
46 | /* | 46 | /* |
47 | * In update mode, we're changing the permissions or | 47 | * In update mode, we're changing the permissions or |
@@ -55,9 +55,14 @@ static int create_files(struct kernfs_node *parent, struct kobject *kobj, | |||
55 | if (!mode) | 55 | if (!mode) |
56 | continue; | 56 | continue; |
57 | } | 57 | } |
58 | |||
59 | WARN(mode & ~(SYSFS_PREALLOC | 0664), | ||
60 | "Attribute %s: Invalid permissions 0%o\n", | ||
61 | (*attr)->name, mode); | ||
62 | |||
63 | mode &= SYSFS_PREALLOC | 0664; | ||
58 | error = sysfs_add_file_mode_ns(parent, *attr, false, | 64 | error = sysfs_add_file_mode_ns(parent, *attr, false, |
59 | (*attr)->mode | mode, | 65 | mode, NULL); |
60 | NULL); | ||
61 | if (unlikely(error)) | 66 | if (unlikely(error)) |
62 | break; | 67 | break; |
63 | } | 68 | } |
diff --git a/include/linux/device.h b/include/linux/device.h index 0eb8ee2dc6d1..f3f2c7e38060 100644 --- a/include/linux/device.h +++ b/include/linux/device.h | |||
@@ -916,6 +916,13 @@ static inline void device_lock_assert(struct device *dev) | |||
916 | lockdep_assert_held(&dev->mutex); | 916 | lockdep_assert_held(&dev->mutex); |
917 | } | 917 | } |
918 | 918 | ||
919 | static inline struct device_node *dev_of_node(struct device *dev) | ||
920 | { | ||
921 | if (!IS_ENABLED(CONFIG_OF)) | ||
922 | return NULL; | ||
923 | return dev->of_node; | ||
924 | } | ||
925 | |||
919 | void driver_init(void); | 926 | void driver_init(void); |
920 | 927 | ||
921 | /* | 928 | /* |
diff --git a/include/linux/sysfs.h b/include/linux/sysfs.h index ddad16148bd6..99382c0df17e 100644 --- a/include/linux/sysfs.h +++ b/include/linux/sysfs.h | |||
@@ -57,6 +57,21 @@ do { \ | |||
57 | #define sysfs_attr_init(attr) do {} while (0) | 57 | #define sysfs_attr_init(attr) do {} while (0) |
58 | #endif | 58 | #endif |
59 | 59 | ||
60 | /** | ||
61 | * struct attribute_group - data structure used to declare an attribute group. | ||
62 | * @name: Optional: Attribute group name | ||
63 | * If specified, the attribute group will be created in | ||
64 | * a new subdirectory with this name. | ||
65 | * @is_visible: Optional: Function to return permissions associated with an | ||
66 | * attribute of the group. Will be called repeatedly for each | ||
67 | * attribute in the group. Only read/write permissions as well as | ||
68 | * SYSFS_PREALLOC are accepted. Must return 0 if an attribute is | ||
69 | * not visible. The returned value will replace static permissions | ||
70 | * defined in struct attribute or struct bin_attribute. | ||
71 | * @attrs: Pointer to NULL terminated list of attributes. | ||
72 | * @bin_attrs: Pointer to NULL terminated list of binary attributes. | ||
73 | * Either attrs or bin_attrs or both must be provided. | ||
74 | */ | ||
60 | struct attribute_group { | 75 | struct attribute_group { |
61 | const char *name; | 76 | const char *name; |
62 | umode_t (*is_visible)(struct kobject *, | 77 | umode_t (*is_visible)(struct kobject *, |
diff --git a/lib/kobject.c b/lib/kobject.c index 03d4ab349fa7..3b841b97fccd 100644 --- a/lib/kobject.c +++ b/lib/kobject.c | |||
@@ -576,8 +576,13 @@ void kobject_del(struct kobject *kobj) | |||
576 | */ | 576 | */ |
577 | struct kobject *kobject_get(struct kobject *kobj) | 577 | struct kobject *kobject_get(struct kobject *kobj) |
578 | { | 578 | { |
579 | if (kobj) | 579 | if (kobj) { |
580 | if (!kobj->state_initialized) | ||
581 | WARN(1, KERN_WARNING "kobject: '%s' (%p): is not " | ||
582 | "initialized, yet kobject_get() is being " | ||
583 | "called.\n", kobject_name(kobj), kobj); | ||
580 | kref_get(&kobj->kref); | 584 | kref_get(&kobj->kref); |
585 | } | ||
581 | return kobj; | 586 | return kobj; |
582 | } | 587 | } |
583 | 588 | ||
diff --git a/lib/lz4/lz4_decompress.c b/lib/lz4/lz4_decompress.c index f0f5c5c3de12..26cc6029b280 100644 --- a/lib/lz4/lz4_decompress.c +++ b/lib/lz4/lz4_decompress.c | |||
@@ -47,6 +47,11 @@ | |||
47 | 47 | ||
48 | #include "lz4defs.h" | 48 | #include "lz4defs.h" |
49 | 49 | ||
50 | static const int dec32table[] = {0, 3, 2, 3, 0, 0, 0, 0}; | ||
51 | #if LZ4_ARCH64 | ||
52 | static const int dec64table[] = {0, 0, 0, -1, 0, 1, 2, 3}; | ||
53 | #endif | ||
54 | |||
50 | static int lz4_uncompress(const char *source, char *dest, int osize) | 55 | static int lz4_uncompress(const char *source, char *dest, int osize) |
51 | { | 56 | { |
52 | const BYTE *ip = (const BYTE *) source; | 57 | const BYTE *ip = (const BYTE *) source; |
@@ -56,10 +61,6 @@ static int lz4_uncompress(const char *source, char *dest, int osize) | |||
56 | BYTE *cpy; | 61 | BYTE *cpy; |
57 | unsigned token; | 62 | unsigned token; |
58 | size_t length; | 63 | size_t length; |
59 | size_t dec32table[] = {0, 3, 2, 3, 0, 0, 0, 0}; | ||
60 | #if LZ4_ARCH64 | ||
61 | size_t dec64table[] = {0, 0, 0, -1, 0, 1, 2, 3}; | ||
62 | #endif | ||
63 | 64 | ||
64 | while (1) { | 65 | while (1) { |
65 | 66 | ||
@@ -116,7 +117,7 @@ static int lz4_uncompress(const char *source, char *dest, int osize) | |||
116 | /* copy repeated sequence */ | 117 | /* copy repeated sequence */ |
117 | if (unlikely((op - ref) < STEPSIZE)) { | 118 | if (unlikely((op - ref) < STEPSIZE)) { |
118 | #if LZ4_ARCH64 | 119 | #if LZ4_ARCH64 |
119 | size_t dec64 = dec64table[op - ref]; | 120 | int dec64 = dec64table[op - ref]; |
120 | #else | 121 | #else |
121 | const int dec64 = 0; | 122 | const int dec64 = 0; |
122 | #endif | 123 | #endif |
@@ -177,11 +178,6 @@ static int lz4_uncompress_unknownoutputsize(const char *source, char *dest, | |||
177 | BYTE * const oend = op + maxoutputsize; | 178 | BYTE * const oend = op + maxoutputsize; |
178 | BYTE *cpy; | 179 | BYTE *cpy; |
179 | 180 | ||
180 | size_t dec32table[] = {0, 3, 2, 3, 0, 0, 0, 0}; | ||
181 | #if LZ4_ARCH64 | ||
182 | size_t dec64table[] = {0, 0, 0, -1, 0, 1, 2, 3}; | ||
183 | #endif | ||
184 | |||
185 | /* Main Loop */ | 181 | /* Main Loop */ |
186 | while (ip < iend) { | 182 | while (ip < iend) { |
187 | 183 | ||
@@ -249,7 +245,7 @@ static int lz4_uncompress_unknownoutputsize(const char *source, char *dest, | |||
249 | /* copy repeated sequence */ | 245 | /* copy repeated sequence */ |
250 | if (unlikely((op - ref) < STEPSIZE)) { | 246 | if (unlikely((op - ref) < STEPSIZE)) { |
251 | #if LZ4_ARCH64 | 247 | #if LZ4_ARCH64 |
252 | size_t dec64 = dec64table[op - ref]; | 248 | int dec64 = dec64table[op - ref]; |
253 | #else | 249 | #else |
254 | const int dec64 = 0; | 250 | const int dec64 = 0; |
255 | #endif | 251 | #endif |
diff --git a/samples/kobject/kobject-example.c b/samples/kobject/kobject-example.c index 01562e0d4992..2e0740f06cd7 100644 --- a/samples/kobject/kobject-example.c +++ b/samples/kobject/kobject-example.c | |||
@@ -36,7 +36,12 @@ static ssize_t foo_show(struct kobject *kobj, struct kobj_attribute *attr, | |||
36 | static ssize_t foo_store(struct kobject *kobj, struct kobj_attribute *attr, | 36 | static ssize_t foo_store(struct kobject *kobj, struct kobj_attribute *attr, |
37 | const char *buf, size_t count) | 37 | const char *buf, size_t count) |
38 | { | 38 | { |
39 | sscanf(buf, "%du", &foo); | 39 | int ret; |
40 | |||
41 | ret = kstrtoint(buf, 10, &foo); | ||
42 | if (ret < 0) | ||
43 | return ret; | ||
44 | |||
40 | return count; | 45 | return count; |
41 | } | 46 | } |
42 | 47 | ||
@@ -63,9 +68,12 @@ static ssize_t b_show(struct kobject *kobj, struct kobj_attribute *attr, | |||
63 | static ssize_t b_store(struct kobject *kobj, struct kobj_attribute *attr, | 68 | static ssize_t b_store(struct kobject *kobj, struct kobj_attribute *attr, |
64 | const char *buf, size_t count) | 69 | const char *buf, size_t count) |
65 | { | 70 | { |
66 | int var; | 71 | int var, ret; |
72 | |||
73 | ret = kstrtoint(buf, 10, &var); | ||
74 | if (ret < 0) | ||
75 | return ret; | ||
67 | 76 | ||
68 | sscanf(buf, "%du", &var); | ||
69 | if (strcmp(attr->attr.name, "baz") == 0) | 77 | if (strcmp(attr->attr.name, "baz") == 0) |
70 | baz = var; | 78 | baz = var; |
71 | else | 79 | else |
@@ -134,5 +142,5 @@ static void __exit example_exit(void) | |||
134 | 142 | ||
135 | module_init(example_init); | 143 | module_init(example_init); |
136 | module_exit(example_exit); | 144 | module_exit(example_exit); |
137 | MODULE_LICENSE("GPL"); | 145 | MODULE_LICENSE("GPL v2"); |
138 | MODULE_AUTHOR("Greg Kroah-Hartman <greg@kroah.com>"); | 146 | MODULE_AUTHOR("Greg Kroah-Hartman <greg@kroah.com>"); |
diff --git a/samples/kobject/kset-example.c b/samples/kobject/kset-example.c index ab5e447ec238..a55bff52bde3 100644 --- a/samples/kobject/kset-example.c +++ b/samples/kobject/kset-example.c | |||
@@ -120,7 +120,12 @@ static ssize_t foo_show(struct foo_obj *foo_obj, struct foo_attribute *attr, | |||
120 | static ssize_t foo_store(struct foo_obj *foo_obj, struct foo_attribute *attr, | 120 | static ssize_t foo_store(struct foo_obj *foo_obj, struct foo_attribute *attr, |
121 | const char *buf, size_t count) | 121 | const char *buf, size_t count) |
122 | { | 122 | { |
123 | sscanf(buf, "%du", &foo_obj->foo); | 123 | int ret; |
124 | |||
125 | ret = kstrtoint(buf, 10, &foo_obj->foo); | ||
126 | if (ret < 0) | ||
127 | return ret; | ||
128 | |||
124 | return count; | 129 | return count; |
125 | } | 130 | } |
126 | 131 | ||
@@ -147,9 +152,12 @@ static ssize_t b_show(struct foo_obj *foo_obj, struct foo_attribute *attr, | |||
147 | static ssize_t b_store(struct foo_obj *foo_obj, struct foo_attribute *attr, | 152 | static ssize_t b_store(struct foo_obj *foo_obj, struct foo_attribute *attr, |
148 | const char *buf, size_t count) | 153 | const char *buf, size_t count) |
149 | { | 154 | { |
150 | int var; | 155 | int var, ret; |
156 | |||
157 | ret = kstrtoint(buf, 10, &var); | ||
158 | if (ret < 0) | ||
159 | return ret; | ||
151 | 160 | ||
152 | sscanf(buf, "%du", &var); | ||
153 | if (strcmp(attr->attr.name, "baz") == 0) | 161 | if (strcmp(attr->attr.name, "baz") == 0) |
154 | foo_obj->baz = var; | 162 | foo_obj->baz = var; |
155 | else | 163 | else |
@@ -277,5 +285,5 @@ static void __exit example_exit(void) | |||
277 | 285 | ||
278 | module_init(example_init); | 286 | module_init(example_init); |
279 | module_exit(example_exit); | 287 | module_exit(example_exit); |
280 | MODULE_LICENSE("GPL"); | 288 | MODULE_LICENSE("GPL v2"); |
281 | MODULE_AUTHOR("Greg Kroah-Hartman <greg@kroah.com>"); | 289 | MODULE_AUTHOR("Greg Kroah-Hartman <greg@kroah.com>"); |