diff options
129 files changed, 1540 insertions, 951 deletions
diff --git a/Documentation/cgroups/cpusets.txt b/Documentation/cgroups/cpusets.txt index 7740038d82bc..3c94ff3f9693 100644 --- a/Documentation/cgroups/cpusets.txt +++ b/Documentation/cgroups/cpusets.txt | |||
@@ -345,14 +345,14 @@ the named feature on. | |||
345 | The implementation is simple. | 345 | The implementation is simple. |
346 | 346 | ||
347 | Setting the flag 'cpuset.memory_spread_page' turns on a per-process flag | 347 | Setting the flag 'cpuset.memory_spread_page' turns on a per-process flag |
348 | PF_SPREAD_PAGE for each task that is in that cpuset or subsequently | 348 | PFA_SPREAD_PAGE for each task that is in that cpuset or subsequently |
349 | joins that cpuset. The page allocation calls for the page cache | 349 | joins that cpuset. The page allocation calls for the page cache |
350 | is modified to perform an inline check for this PF_SPREAD_PAGE task | 350 | is modified to perform an inline check for this PFA_SPREAD_PAGE task |
351 | flag, and if set, a call to a new routine cpuset_mem_spread_node() | 351 | flag, and if set, a call to a new routine cpuset_mem_spread_node() |
352 | returns the node to prefer for the allocation. | 352 | returns the node to prefer for the allocation. |
353 | 353 | ||
354 | Similarly, setting 'cpuset.memory_spread_slab' turns on the flag | 354 | Similarly, setting 'cpuset.memory_spread_slab' turns on the flag |
355 | PF_SPREAD_SLAB, and appropriately marked slab caches will allocate | 355 | PFA_SPREAD_SLAB, and appropriately marked slab caches will allocate |
356 | pages from the node returned by cpuset_mem_spread_node(). | 356 | pages from the node returned by cpuset_mem_spread_node(). |
357 | 357 | ||
358 | The cpuset_mem_spread_node() routine is also simple. It uses the | 358 | The cpuset_mem_spread_node() routine is also simple. It uses the |
diff --git a/Documentation/devicetree/bindings/staging/imx-drm/ldb.txt b/Documentation/devicetree/bindings/staging/imx-drm/ldb.txt index 578a1fca366e..443bcb6134d5 100644 --- a/Documentation/devicetree/bindings/staging/imx-drm/ldb.txt +++ b/Documentation/devicetree/bindings/staging/imx-drm/ldb.txt | |||
@@ -56,6 +56,9 @@ Required properties: | |||
56 | - fsl,data-width : should be <18> or <24> | 56 | - fsl,data-width : should be <18> or <24> |
57 | - port: A port node with endpoint definitions as defined in | 57 | - port: A port node with endpoint definitions as defined in |
58 | Documentation/devicetree/bindings/media/video-interfaces.txt. | 58 | Documentation/devicetree/bindings/media/video-interfaces.txt. |
59 | On i.MX5, the internal two-input-multiplexer is used. | ||
60 | Due to hardware limitations, only one port (port@[0,1]) | ||
61 | can be used for each channel (lvds-channel@[0,1], respectively) | ||
59 | On i.MX6, there should be four ports (port@[0-3]) that correspond | 62 | On i.MX6, there should be four ports (port@[0-3]) that correspond |
60 | to the four LVDS multiplexer inputs. | 63 | to the four LVDS multiplexer inputs. |
61 | 64 | ||
@@ -78,6 +81,8 @@ ldb: ldb@53fa8008 { | |||
78 | "di0", "di1"; | 81 | "di0", "di1"; |
79 | 82 | ||
80 | lvds-channel@0 { | 83 | lvds-channel@0 { |
84 | #address-cells = <1>; | ||
85 | #size-cells = <0>; | ||
81 | reg = <0>; | 86 | reg = <0>; |
82 | fsl,data-mapping = "spwg"; | 87 | fsl,data-mapping = "spwg"; |
83 | fsl,data-width = <24>; | 88 | fsl,data-width = <24>; |
@@ -86,7 +91,9 @@ ldb: ldb@53fa8008 { | |||
86 | /* ... */ | 91 | /* ... */ |
87 | }; | 92 | }; |
88 | 93 | ||
89 | port { | 94 | port@0 { |
95 | reg = <0>; | ||
96 | |||
90 | lvds0_in: endpoint { | 97 | lvds0_in: endpoint { |
91 | remote-endpoint = <&ipu_di0_lvds0>; | 98 | remote-endpoint = <&ipu_di0_lvds0>; |
92 | }; | 99 | }; |
@@ -94,6 +101,8 @@ ldb: ldb@53fa8008 { | |||
94 | }; | 101 | }; |
95 | 102 | ||
96 | lvds-channel@1 { | 103 | lvds-channel@1 { |
104 | #address-cells = <1>; | ||
105 | #size-cells = <0>; | ||
97 | reg = <1>; | 106 | reg = <1>; |
98 | fsl,data-mapping = "spwg"; | 107 | fsl,data-mapping = "spwg"; |
99 | fsl,data-width = <24>; | 108 | fsl,data-width = <24>; |
@@ -102,7 +111,9 @@ ldb: ldb@53fa8008 { | |||
102 | /* ... */ | 111 | /* ... */ |
103 | }; | 112 | }; |
104 | 113 | ||
105 | port { | 114 | port@1 { |
115 | reg = <1>; | ||
116 | |||
106 | lvds1_in: endpoint { | 117 | lvds1_in: endpoint { |
107 | remote-endpoint = <&ipu_di1_lvds1>; | 118 | remote-endpoint = <&ipu_di1_lvds1>; |
108 | }; | 119 | }; |
diff --git a/Documentation/devicetree/of_selftest.txt b/Documentation/devicetree/of_selftest.txt new file mode 100644 index 000000000000..3a2f54d07fc5 --- /dev/null +++ b/Documentation/devicetree/of_selftest.txt | |||
@@ -0,0 +1,211 @@ | |||
1 | Open Firmware Device Tree Selftest | ||
2 | ---------------------------------- | ||
3 | |||
4 | Author: Gaurav Minocha <gaurav.minocha.os@gmail.com> | ||
5 | |||
6 | 1. Introduction | ||
7 | |||
8 | This document explains how the test data required for executing OF selftest | ||
9 | is attached to the live tree dynamically, independent of the machine's | ||
10 | architecture. | ||
11 | |||
12 | It is recommended to read the following documents before moving ahead. | ||
13 | |||
14 | [1] Documentation/devicetree/usage-model.txt | ||
15 | [2] http://www.devicetree.org/Device_Tree_Usage | ||
16 | |||
17 | OF Selftest has been designed to test the interface (include/linux/of.h) | ||
18 | provided to device driver developers to fetch the device information..etc. | ||
19 | from the unflattened device tree data structure. This interface is used by | ||
20 | most of the device drivers in various use cases. | ||
21 | |||
22 | |||
23 | 2. Test-data | ||
24 | |||
25 | The Device Tree Source file (drivers/of/testcase-data/testcases.dts) contains | ||
26 | the test data required for executing the unit tests automated in | ||
27 | drivers/of/selftests.c. Currently, following Device Tree Source Include files | ||
28 | (.dtsi) are included in testcase.dts: | ||
29 | |||
30 | drivers/of/testcase-data/tests-interrupts.dtsi | ||
31 | drivers/of/testcase-data/tests-platform.dtsi | ||
32 | drivers/of/testcase-data/tests-phandle.dtsi | ||
33 | drivers/of/testcase-data/tests-match.dtsi | ||
34 | |||
35 | When the kernel is build with OF_SELFTEST enabled, then the following make rule | ||
36 | |||
37 | $(obj)/%.dtb: $(src)/%.dts FORCE | ||
38 | $(call if_changed_dep, dtc) | ||
39 | |||
40 | is used to compile the DT source file (testcase.dts) into a binary blob | ||
41 | (testcase.dtb), also referred as flattened DT. | ||
42 | |||
43 | After that, using the following rule the binary blob above is wrapped as an | ||
44 | assembly file (testcase.dtb.S). | ||
45 | |||
46 | $(obj)/%.dtb.S: $(obj)/%.dtb | ||
47 | $(call cmd, dt_S_dtb) | ||
48 | |||
49 | The assembly file is compiled into an object file (testcase.dtb.o), and is | ||
50 | linked into the kernel image. | ||
51 | |||
52 | |||
53 | 2.1. Adding the test data | ||
54 | |||
55 | Un-flattened device tree structure: | ||
56 | |||
57 | Un-flattened device tree consists of connected device_node(s) in form of a tree | ||
58 | structure described below. | ||
59 | |||
60 | // following struct members are used to construct the tree | ||
61 | struct device_node { | ||
62 | ... | ||
63 | struct device_node *parent; | ||
64 | struct device_node *child; | ||
65 | struct device_node *sibling; | ||
66 | struct device_node *allnext; /* next in list of all nodes */ | ||
67 | ... | ||
68 | }; | ||
69 | |||
70 | Figure 1, describes a generic structure of machine’s un-flattened device tree | ||
71 | considering only child and sibling pointers. There exists another pointer, | ||
72 | *parent, that is used to traverse the tree in the reverse direction. So, at | ||
73 | a particular level the child node and all the sibling nodes will have a parent | ||
74 | pointer pointing to a common node (e.g. child1, sibling2, sibling3, sibling4’s | ||
75 | parent points to root node) | ||
76 | |||
77 | root (‘/’) | ||
78 | | | ||
79 | child1 -> sibling2 -> sibling3 -> sibling4 -> null | ||
80 | | | | | | ||
81 | | | | null | ||
82 | | | | | ||
83 | | | child31 -> sibling32 -> null | ||
84 | | | | | | ||
85 | | | null null | ||
86 | | | | ||
87 | | child21 -> sibling22 -> sibling23 -> null | ||
88 | | | | | | ||
89 | | null null null | ||
90 | | | ||
91 | child11 -> sibling12 -> sibling13 -> sibling14 -> null | ||
92 | | | | | | ||
93 | | | | null | ||
94 | | | | | ||
95 | null null child131 -> null | ||
96 | | | ||
97 | null | ||
98 | |||
99 | Figure 1: Generic structure of un-flattened device tree | ||
100 | |||
101 | |||
102 | *allnext: it is used to link all the nodes of DT into a list. So, for the | ||
103 | above tree the list would be as follows: | ||
104 | |||
105 | root->child1->child11->sibling12->sibling13->child131->sibling14->sibling2-> | ||
106 | child21->sibling22->sibling23->sibling3->child31->sibling32->sibling4->null | ||
107 | |||
108 | Before executing OF selftest, it is required to attach the test data to | ||
109 | machine's device tree (if present). So, when selftest_data_add() is called, | ||
110 | at first it reads the flattened device tree data linked into the kernel image | ||
111 | via the following kernel symbols: | ||
112 | |||
113 | __dtb_testcases_begin - address marking the start of test data blob | ||
114 | __dtb_testcases_end - address marking the end of test data blob | ||
115 | |||
116 | Secondly, it calls of_fdt_unflatten_device_tree() to unflatten the flattened | ||
117 | blob. And finally, if the machine’s device tree (i.e live tree) is present, | ||
118 | then it attaches the unflattened test data tree to the live tree, else it | ||
119 | attaches itself as a live device tree. | ||
120 | |||
121 | attach_node_and_children() uses of_attach_node() to attach the nodes into the | ||
122 | live tree as explained below. To explain the same, the test data tree described | ||
123 | in Figure 2 is attached to the live tree described in Figure 1. | ||
124 | |||
125 | root (‘/’) | ||
126 | | | ||
127 | testcase-data | ||
128 | | | ||
129 | test-child0 -> test-sibling1 -> test-sibling2 -> test-sibling3 -> null | ||
130 | | | | | | ||
131 | test-child01 null null null | ||
132 | |||
133 | |||
134 | allnext list: | ||
135 | |||
136 | root->testcase-data->test-child0->test-child01->test-sibling1->test-sibling2 | ||
137 | ->test-sibling3->null | ||
138 | |||
139 | Figure 2: Example test data tree to be attached to live tree. | ||
140 | |||
141 | According to the scenario above, the live tree is already present so it isn’t | ||
142 | required to attach the root(‘/’) node. All other nodes are attached by calling | ||
143 | of_attach_node() on each node. | ||
144 | |||
145 | In the function of_attach_node(), the new node is attached as the child of the | ||
146 | given parent in live tree. But, if parent already has a child then the new node | ||
147 | replaces the current child and turns it into its sibling. So, when the testcase | ||
148 | data node is attached to the live tree above (Figure 1), the final structure is | ||
149 | as shown in Figure 3. | ||
150 | |||
151 | root (‘/’) | ||
152 | | | ||
153 | testcase-data -> child1 -> sibling2 -> sibling3 -> sibling4 -> null | ||
154 | | | | | | | ||
155 | (...) | | | null | ||
156 | | | child31 -> sibling32 -> null | ||
157 | | | | | | ||
158 | | | null null | ||
159 | | | | ||
160 | | child21 -> sibling22 -> sibling23 -> null | ||
161 | | | | | | ||
162 | | null null null | ||
163 | | | ||
164 | child11 -> sibling12 -> sibling13 -> sibling14 -> null | ||
165 | | | | | | ||
166 | null null | null | ||
167 | | | ||
168 | child131 -> null | ||
169 | | | ||
170 | null | ||
171 | ----------------------------------------------------------------------- | ||
172 | |||
173 | root (‘/’) | ||
174 | | | ||
175 | testcase-data -> child1 -> sibling2 -> sibling3 -> sibling4 -> null | ||
176 | | | | | | | ||
177 | | (...) (...) (...) null | ||
178 | | | ||
179 | test-sibling3 -> test-sibling2 -> test-sibling1 -> test-child0 -> null | ||
180 | | | | | | ||
181 | null null null test-child01 | ||
182 | |||
183 | |||
184 | Figure 3: Live device tree structure after attaching the testcase-data. | ||
185 | |||
186 | |||
187 | Astute readers would have noticed that test-child0 node becomes the last | ||
188 | sibling compared to the earlier structure (Figure 2). After attaching first | ||
189 | test-child0 the test-sibling1 is attached that pushes the child node | ||
190 | (i.e. test-child0) to become a sibling and makes itself a child node, | ||
191 | as mentioned above. | ||
192 | |||
193 | If a duplicate node is found (i.e. if a node with same full_name property is | ||
194 | already present in the live tree), then the node isn’t attached rather its | ||
195 | properties are updated to the live tree’s node by calling the function | ||
196 | update_node_properties(). | ||
197 | |||
198 | |||
199 | 2.2. Removing the test data | ||
200 | |||
201 | Once the test case execution is complete, selftest_data_remove is called in | ||
202 | order to remove the device nodes attached initially (first the leaf nodes are | ||
203 | detached and then moving up the parent nodes are removed, and eventually the | ||
204 | whole tree). selftest_data_remove() calls detach_node_and_children() that uses | ||
205 | of_detach_node() to detach the nodes from the live device tree. | ||
206 | |||
207 | To detach a node, of_detach_node() first updates all_next linked list, by | ||
208 | attaching the previous node’s allnext to current node’s allnext pointer. And | ||
209 | then, it either updates the child pointer of given node’s parent to its | ||
210 | sibling or attaches the previous sibling to the given node’s sibling, as | ||
211 | appropriate. That is it :) | ||
diff --git a/MAINTAINERS b/MAINTAINERS index f8db3c3acc67..c2e7a06c585b 100644 --- a/MAINTAINERS +++ b/MAINTAINERS | |||
@@ -2098,7 +2098,7 @@ S: Supported | |||
2098 | F: drivers/scsi/bfa/ | 2098 | F: drivers/scsi/bfa/ |
2099 | 2099 | ||
2100 | BROCADE BNA 10 GIGABIT ETHERNET DRIVER | 2100 | BROCADE BNA 10 GIGABIT ETHERNET DRIVER |
2101 | M: Rasesh Mody <rmody@brocade.com> | 2101 | M: Rasesh Mody <rasesh.mody@qlogic.com> |
2102 | L: netdev@vger.kernel.org | 2102 | L: netdev@vger.kernel.org |
2103 | S: Supported | 2103 | S: Supported |
2104 | F: drivers/net/ethernet/brocade/bna/ | 2104 | F: drivers/net/ethernet/brocade/bna/ |
@@ -3012,9 +3012,8 @@ S: Supported | |||
3012 | F: drivers/acpi/dock.c | 3012 | F: drivers/acpi/dock.c |
3013 | 3013 | ||
3014 | DOCUMENTATION | 3014 | DOCUMENTATION |
3015 | M: Randy Dunlap <rdunlap@infradead.org> | 3015 | M: Jiri Kosina <jkosina@suse.cz> |
3016 | L: linux-doc@vger.kernel.org | 3016 | L: linux-doc@vger.kernel.org |
3017 | T: quilt http://www.infradead.org/~rdunlap/Doc/patches/ | ||
3018 | S: Maintained | 3017 | S: Maintained |
3019 | F: Documentation/ | 3018 | F: Documentation/ |
3020 | X: Documentation/ABI/ | 3019 | X: Documentation/ABI/ |
@@ -4477,7 +4476,6 @@ M: Mika Westerberg <mika.westerberg@linux.intel.com> | |||
4477 | L: linux-i2c@vger.kernel.org | 4476 | L: linux-i2c@vger.kernel.org |
4478 | L: linux-acpi@vger.kernel.org | 4477 | L: linux-acpi@vger.kernel.org |
4479 | S: Maintained | 4478 | S: Maintained |
4480 | F: drivers/i2c/i2c-acpi.c | ||
4481 | 4479 | ||
4482 | I2C-TAOS-EVM DRIVER | 4480 | I2C-TAOS-EVM DRIVER |
4483 | M: Jean Delvare <jdelvare@suse.de> | 4481 | M: Jean Delvare <jdelvare@suse.de> |
@@ -1,7 +1,7 @@ | |||
1 | VERSION = 3 | 1 | VERSION = 3 |
2 | PATCHLEVEL = 17 | 2 | PATCHLEVEL = 17 |
3 | SUBLEVEL = 0 | 3 | SUBLEVEL = 0 |
4 | EXTRAVERSION = -rc6 | 4 | EXTRAVERSION = -rc7 |
5 | NAME = Shuffling Zombie Juror | 5 | NAME = Shuffling Zombie Juror |
6 | 6 | ||
7 | # *DOCUMENTATION* | 7 | # *DOCUMENTATION* |
diff --git a/arch/arm/boot/dts/dra7-evm.dts b/arch/arm/boot/dts/dra7-evm.dts index e03fbf3c6889..b40cdadb1f87 100644 --- a/arch/arm/boot/dts/dra7-evm.dts +++ b/arch/arm/boot/dts/dra7-evm.dts | |||
@@ -447,22 +447,19 @@ | |||
447 | gpmc,device-width = <2>; | 447 | gpmc,device-width = <2>; |
448 | gpmc,sync-clk-ps = <0>; | 448 | gpmc,sync-clk-ps = <0>; |
449 | gpmc,cs-on-ns = <0>; | 449 | gpmc,cs-on-ns = <0>; |
450 | gpmc,cs-rd-off-ns = <40>; | 450 | gpmc,cs-rd-off-ns = <80>; |
451 | gpmc,cs-wr-off-ns = <40>; | 451 | gpmc,cs-wr-off-ns = <80>; |
452 | gpmc,adv-on-ns = <0>; | 452 | gpmc,adv-on-ns = <0>; |
453 | gpmc,adv-rd-off-ns = <30>; | 453 | gpmc,adv-rd-off-ns = <60>; |
454 | gpmc,adv-wr-off-ns = <30>; | 454 | gpmc,adv-wr-off-ns = <60>; |
455 | gpmc,we-on-ns = <5>; | 455 | gpmc,we-on-ns = <10>; |
456 | gpmc,we-off-ns = <25>; | 456 | gpmc,we-off-ns = <50>; |
457 | gpmc,oe-on-ns = <2>; | 457 | gpmc,oe-on-ns = <4>; |
458 | gpmc,oe-off-ns = <20>; | 458 | gpmc,oe-off-ns = <40>; |
459 | gpmc,access-ns = <20>; | 459 | gpmc,access-ns = <40>; |
460 | gpmc,wr-access-ns = <40>; | 460 | gpmc,wr-access-ns = <80>; |
461 | gpmc,rd-cycle-ns = <40>; | 461 | gpmc,rd-cycle-ns = <80>; |
462 | gpmc,wr-cycle-ns = <40>; | 462 | gpmc,wr-cycle-ns = <80>; |
463 | gpmc,wait-pin = <0>; | ||
464 | gpmc,wait-on-read; | ||
465 | gpmc,wait-on-write; | ||
466 | gpmc,bus-turnaround-ns = <0>; | 463 | gpmc,bus-turnaround-ns = <0>; |
467 | gpmc,cycle2cycle-delay-ns = <0>; | 464 | gpmc,cycle2cycle-delay-ns = <0>; |
468 | gpmc,clk-activation-ns = <0>; | 465 | gpmc,clk-activation-ns = <0>; |
diff --git a/arch/arm/boot/dts/imx53.dtsi b/arch/arm/boot/dts/imx53.dtsi index c6c58c1c00e3..6b675a02066f 100644 --- a/arch/arm/boot/dts/imx53.dtsi +++ b/arch/arm/boot/dts/imx53.dtsi | |||
@@ -423,10 +423,14 @@ | |||
423 | status = "disabled"; | 423 | status = "disabled"; |
424 | 424 | ||
425 | lvds-channel@0 { | 425 | lvds-channel@0 { |
426 | #address-cells = <1>; | ||
427 | #size-cells = <0>; | ||
426 | reg = <0>; | 428 | reg = <0>; |
427 | status = "disabled"; | 429 | status = "disabled"; |
428 | 430 | ||
429 | port { | 431 | port@0 { |
432 | reg = <0>; | ||
433 | |||
430 | lvds0_in: endpoint { | 434 | lvds0_in: endpoint { |
431 | remote-endpoint = <&ipu_di0_lvds0>; | 435 | remote-endpoint = <&ipu_di0_lvds0>; |
432 | }; | 436 | }; |
@@ -434,10 +438,14 @@ | |||
434 | }; | 438 | }; |
435 | 439 | ||
436 | lvds-channel@1 { | 440 | lvds-channel@1 { |
441 | #address-cells = <1>; | ||
442 | #size-cells = <0>; | ||
437 | reg = <1>; | 443 | reg = <1>; |
438 | status = "disabled"; | 444 | status = "disabled"; |
439 | 445 | ||
440 | port { | 446 | port@1 { |
447 | reg = <1>; | ||
448 | |||
441 | lvds1_in: endpoint { | 449 | lvds1_in: endpoint { |
442 | remote-endpoint = <&ipu_di1_lvds1>; | 450 | remote-endpoint = <&ipu_di1_lvds1>; |
443 | }; | 451 | }; |
diff --git a/arch/arm/boot/dts/k2e-clocks.dtsi b/arch/arm/boot/dts/k2e-clocks.dtsi index 598afe91c676..4773d6af66a0 100644 --- a/arch/arm/boot/dts/k2e-clocks.dtsi +++ b/arch/arm/boot/dts/k2e-clocks.dtsi | |||
@@ -40,7 +40,7 @@ clocks { | |||
40 | #clock-cells = <0>; | 40 | #clock-cells = <0>; |
41 | compatible = "ti,keystone,psc-clock"; | 41 | compatible = "ti,keystone,psc-clock"; |
42 | clocks = <&chipclk16>; | 42 | clocks = <&chipclk16>; |
43 | clock-output-names = "usb"; | 43 | clock-output-names = "usb1"; |
44 | reg = <0x02350004 0xb00>, <0x02350000 0x400>; | 44 | reg = <0x02350004 0xb00>, <0x02350000 0x400>; |
45 | reg-names = "control", "domain"; | 45 | reg-names = "control", "domain"; |
46 | domain-id = <0>; | 46 | domain-id = <0>; |
@@ -60,8 +60,8 @@ clocks { | |||
60 | #clock-cells = <0>; | 60 | #clock-cells = <0>; |
61 | compatible = "ti,keystone,psc-clock"; | 61 | compatible = "ti,keystone,psc-clock"; |
62 | clocks = <&chipclk12>; | 62 | clocks = <&chipclk12>; |
63 | clock-output-names = "pcie"; | 63 | clock-output-names = "pcie1"; |
64 | reg = <0x0235006c 0xb00>, <0x02350000 0x400>; | 64 | reg = <0x0235006c 0xb00>, <0x02350048 0x400>; |
65 | reg-names = "control", "domain"; | 65 | reg-names = "control", "domain"; |
66 | domain-id = <18>; | 66 | domain-id = <18>; |
67 | }; | 67 | }; |
diff --git a/arch/arm/boot/dts/omap5-cm-t54.dts b/arch/arm/boot/dts/omap5-cm-t54.dts index b8698ca68647..429471aa7a1f 100644 --- a/arch/arm/boot/dts/omap5-cm-t54.dts +++ b/arch/arm/boot/dts/omap5-cm-t54.dts | |||
@@ -353,13 +353,12 @@ | |||
353 | }; | 353 | }; |
354 | 354 | ||
355 | ldo8_reg: ldo8 { | 355 | ldo8_reg: ldo8 { |
356 | /* VDD_3v0: Does not go anywhere */ | 356 | /* VDD_3V_GP: act led/serial console */ |
357 | regulator-name = "ldo8"; | 357 | regulator-name = "ldo8"; |
358 | regulator-min-microvolt = <3000000>; | 358 | regulator-min-microvolt = <3000000>; |
359 | regulator-max-microvolt = <3000000>; | 359 | regulator-max-microvolt = <3000000>; |
360 | regulator-always-on; | ||
360 | regulator-boot-on; | 361 | regulator-boot-on; |
361 | /* Unused */ | ||
362 | status = "disabled"; | ||
363 | }; | 362 | }; |
364 | 363 | ||
365 | ldo9_reg: ldo9 { | 364 | ldo9_reg: ldo9 { |
diff --git a/arch/arm/include/asm/cacheflush.h b/arch/arm/include/asm/cacheflush.h index 79ecb4f34ffb..10e78d00a0bb 100644 --- a/arch/arm/include/asm/cacheflush.h +++ b/arch/arm/include/asm/cacheflush.h | |||
@@ -466,6 +466,7 @@ static inline void __sync_cache_range_r(volatile void *p, size_t size) | |||
466 | */ | 466 | */ |
467 | #define v7_exit_coherency_flush(level) \ | 467 | #define v7_exit_coherency_flush(level) \ |
468 | asm volatile( \ | 468 | asm volatile( \ |
469 | ".arch armv7-a \n\t" \ | ||
469 | "stmfd sp!, {fp, ip} \n\t" \ | 470 | "stmfd sp!, {fp, ip} \n\t" \ |
470 | "mrc p15, 0, r0, c1, c0, 0 @ get SCTLR \n\t" \ | 471 | "mrc p15, 0, r0, c1, c0, 0 @ get SCTLR \n\t" \ |
471 | "bic r0, r0, #"__stringify(CR_C)" \n\t" \ | 472 | "bic r0, r0, #"__stringify(CR_C)" \n\t" \ |
diff --git a/arch/arm/include/asm/tls.h b/arch/arm/include/asm/tls.h index 36172adda9d0..5f833f7adba1 100644 --- a/arch/arm/include/asm/tls.h +++ b/arch/arm/include/asm/tls.h | |||
@@ -81,6 +81,7 @@ static inline void set_tls(unsigned long val) | |||
81 | asm("mcr p15, 0, %0, c13, c0, 3" | 81 | asm("mcr p15, 0, %0, c13, c0, 3" |
82 | : : "r" (val)); | 82 | : : "r" (val)); |
83 | } else { | 83 | } else { |
84 | #ifdef CONFIG_KUSER_HELPERS | ||
84 | /* | 85 | /* |
85 | * User space must never try to access this | 86 | * User space must never try to access this |
86 | * directly. Expect your app to break | 87 | * directly. Expect your app to break |
@@ -89,6 +90,7 @@ static inline void set_tls(unsigned long val) | |||
89 | * entry-armv.S for details) | 90 | * entry-armv.S for details) |
90 | */ | 91 | */ |
91 | *((unsigned int *)0xffff0ff0) = val; | 92 | *((unsigned int *)0xffff0ff0) = val; |
93 | #endif | ||
92 | } | 94 | } |
93 | 95 | ||
94 | } | 96 | } |
diff --git a/arch/arm/kernel/kprobes-test.c b/arch/arm/kernel/kprobes-test.c index 08d731294bcd..b206d7790c77 100644 --- a/arch/arm/kernel/kprobes-test.c +++ b/arch/arm/kernel/kprobes-test.c | |||
@@ -110,10 +110,13 @@ | |||
110 | * | 110 | * |
111 | * @ TESTCASE_START | 111 | * @ TESTCASE_START |
112 | * bl __kprobes_test_case_start | 112 | * bl __kprobes_test_case_start |
113 | * @ start of inline data... | 113 | * .pushsection .rodata |
114 | * "10: | ||
114 | * .ascii "mov r0, r7" @ text title for test case | 115 | * .ascii "mov r0, r7" @ text title for test case |
115 | * .byte 0 | 116 | * .byte 0 |
116 | * .align 2, 0 | 117 | * .popsection |
118 | * @ start of inline data... | ||
119 | * .word 10b @ pointer to title in .rodata section | ||
117 | * | 120 | * |
118 | * @ TEST_ARG_REG | 121 | * @ TEST_ARG_REG |
119 | * .byte ARG_TYPE_REG | 122 | * .byte ARG_TYPE_REG |
@@ -971,7 +974,7 @@ void __naked __kprobes_test_case_start(void) | |||
971 | __asm__ __volatile__ ( | 974 | __asm__ __volatile__ ( |
972 | "stmdb sp!, {r4-r11} \n\t" | 975 | "stmdb sp!, {r4-r11} \n\t" |
973 | "sub sp, sp, #"__stringify(TEST_MEMORY_SIZE)"\n\t" | 976 | "sub sp, sp, #"__stringify(TEST_MEMORY_SIZE)"\n\t" |
974 | "bic r0, lr, #1 @ r0 = inline title string \n\t" | 977 | "bic r0, lr, #1 @ r0 = inline data \n\t" |
975 | "mov r1, sp \n\t" | 978 | "mov r1, sp \n\t" |
976 | "bl kprobes_test_case_start \n\t" | 979 | "bl kprobes_test_case_start \n\t" |
977 | "bx r0 \n\t" | 980 | "bx r0 \n\t" |
@@ -1349,15 +1352,14 @@ static unsigned long next_instruction(unsigned long pc) | |||
1349 | return pc + 4; | 1352 | return pc + 4; |
1350 | } | 1353 | } |
1351 | 1354 | ||
1352 | static uintptr_t __used kprobes_test_case_start(const char *title, void *stack) | 1355 | static uintptr_t __used kprobes_test_case_start(const char **title, void *stack) |
1353 | { | 1356 | { |
1354 | struct test_arg *args; | 1357 | struct test_arg *args; |
1355 | struct test_arg_end *end_arg; | 1358 | struct test_arg_end *end_arg; |
1356 | unsigned long test_code; | 1359 | unsigned long test_code; |
1357 | 1360 | ||
1358 | args = (struct test_arg *)PTR_ALIGN(title + strlen(title) + 1, 4); | 1361 | current_title = *title++; |
1359 | 1362 | args = (struct test_arg *)title; | |
1360 | current_title = title; | ||
1361 | current_args = args; | 1363 | current_args = args; |
1362 | current_stack = stack; | 1364 | current_stack = stack; |
1363 | 1365 | ||
diff --git a/arch/arm/kernel/kprobes-test.h b/arch/arm/kernel/kprobes-test.h index eecc90a0fd91..4430990e90e7 100644 --- a/arch/arm/kernel/kprobes-test.h +++ b/arch/arm/kernel/kprobes-test.h | |||
@@ -111,11 +111,14 @@ struct test_arg_end { | |||
111 | #define TESTCASE_START(title) \ | 111 | #define TESTCASE_START(title) \ |
112 | __asm__ __volatile__ ( \ | 112 | __asm__ __volatile__ ( \ |
113 | "bl __kprobes_test_case_start \n\t" \ | 113 | "bl __kprobes_test_case_start \n\t" \ |
114 | ".pushsection .rodata \n\t" \ | ||
115 | "10: \n\t" \ | ||
114 | /* don't use .asciz here as 'title' may be */ \ | 116 | /* don't use .asciz here as 'title' may be */ \ |
115 | /* multiple strings to be concatenated. */ \ | 117 | /* multiple strings to be concatenated. */ \ |
116 | ".ascii "#title" \n\t" \ | 118 | ".ascii "#title" \n\t" \ |
117 | ".byte 0 \n\t" \ | 119 | ".byte 0 \n\t" \ |
118 | ".align 2, 0 \n\t" | 120 | ".popsection \n\t" \ |
121 | ".word 10b \n\t" | ||
119 | 122 | ||
120 | #define TEST_ARG_REG(reg, val) \ | 123 | #define TEST_ARG_REG(reg, val) \ |
121 | ".byte "__stringify(ARG_TYPE_REG)" \n\t" \ | 124 | ".byte "__stringify(ARG_TYPE_REG)" \n\t" \ |
diff --git a/arch/arm/mach-imx/clk-gate2.c b/arch/arm/mach-imx/clk-gate2.c index 84acdfd1d715..5a75cdc81891 100644 --- a/arch/arm/mach-imx/clk-gate2.c +++ b/arch/arm/mach-imx/clk-gate2.c | |||
@@ -97,7 +97,7 @@ static int clk_gate2_is_enabled(struct clk_hw *hw) | |||
97 | struct clk_gate2 *gate = to_clk_gate2(hw); | 97 | struct clk_gate2 *gate = to_clk_gate2(hw); |
98 | 98 | ||
99 | if (gate->share_count) | 99 | if (gate->share_count) |
100 | return !!(*gate->share_count); | 100 | return !!__clk_get_enable_count(hw->clk); |
101 | else | 101 | else |
102 | return clk_gate2_reg_is_enabled(gate->reg, gate->bit_idx); | 102 | return clk_gate2_reg_is_enabled(gate->reg, gate->bit_idx); |
103 | } | 103 | } |
@@ -127,10 +127,6 @@ struct clk *clk_register_gate2(struct device *dev, const char *name, | |||
127 | gate->bit_idx = bit_idx; | 127 | gate->bit_idx = bit_idx; |
128 | gate->flags = clk_gate2_flags; | 128 | gate->flags = clk_gate2_flags; |
129 | gate->lock = lock; | 129 | gate->lock = lock; |
130 | |||
131 | /* Initialize share_count per hardware state */ | ||
132 | if (share_count) | ||
133 | *share_count = clk_gate2_reg_is_enabled(reg, bit_idx) ? 1 : 0; | ||
134 | gate->share_count = share_count; | 130 | gate->share_count = share_count; |
135 | 131 | ||
136 | init.name = name; | 132 | init.name = name; |
diff --git a/arch/arm/mach-omap2/Kconfig b/arch/arm/mach-omap2/Kconfig index e7189dcc9309..08d4167cc7c5 100644 --- a/arch/arm/mach-omap2/Kconfig +++ b/arch/arm/mach-omap2/Kconfig | |||
@@ -1,9 +1,6 @@ | |||
1 | menu "TI OMAP/AM/DM/DRA Family" | 1 | menu "TI OMAP/AM/DM/DRA Family" |
2 | depends on ARCH_MULTI_V6 || ARCH_MULTI_V7 | 2 | depends on ARCH_MULTI_V6 || ARCH_MULTI_V7 |
3 | 3 | ||
4 | config ARCH_OMAP | ||
5 | bool | ||
6 | |||
7 | config ARCH_OMAP2 | 4 | config ARCH_OMAP2 |
8 | bool "TI OMAP2" | 5 | bool "TI OMAP2" |
9 | depends on ARCH_MULTI_V6 | 6 | depends on ARCH_MULTI_V6 |
diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c index 8fd87a3055bf..9e91a4e7519a 100644 --- a/arch/arm/mach-omap2/omap_hwmod.c +++ b/arch/arm/mach-omap2/omap_hwmod.c | |||
@@ -2065,7 +2065,7 @@ static void _reconfigure_io_chain(void) | |||
2065 | 2065 | ||
2066 | spin_lock_irqsave(&io_chain_lock, flags); | 2066 | spin_lock_irqsave(&io_chain_lock, flags); |
2067 | 2067 | ||
2068 | if (cpu_is_omap34xx() && omap3_has_io_chain_ctrl()) | 2068 | if (cpu_is_omap34xx()) |
2069 | omap3xxx_prm_reconfigure_io_chain(); | 2069 | omap3xxx_prm_reconfigure_io_chain(); |
2070 | else if (cpu_is_omap44xx()) | 2070 | else if (cpu_is_omap44xx()) |
2071 | omap44xx_prm_reconfigure_io_chain(); | 2071 | omap44xx_prm_reconfigure_io_chain(); |
diff --git a/arch/arm/mach-omap2/prm3xxx.c b/arch/arm/mach-omap2/prm3xxx.c index 2458be6fc67b..372de3edf4a5 100644 --- a/arch/arm/mach-omap2/prm3xxx.c +++ b/arch/arm/mach-omap2/prm3xxx.c | |||
@@ -45,7 +45,7 @@ static struct omap_prcm_irq_setup omap3_prcm_irq_setup = { | |||
45 | .ocp_barrier = &omap3xxx_prm_ocp_barrier, | 45 | .ocp_barrier = &omap3xxx_prm_ocp_barrier, |
46 | .save_and_clear_irqen = &omap3xxx_prm_save_and_clear_irqen, | 46 | .save_and_clear_irqen = &omap3xxx_prm_save_and_clear_irqen, |
47 | .restore_irqen = &omap3xxx_prm_restore_irqen, | 47 | .restore_irqen = &omap3xxx_prm_restore_irqen, |
48 | .reconfigure_io_chain = &omap3xxx_prm_reconfigure_io_chain, | 48 | .reconfigure_io_chain = NULL, |
49 | }; | 49 | }; |
50 | 50 | ||
51 | /* | 51 | /* |
@@ -369,15 +369,30 @@ void __init omap3_prm_init_pm(bool has_uart4, bool has_iva) | |||
369 | } | 369 | } |
370 | 370 | ||
371 | /** | 371 | /** |
372 | * omap3xxx_prm_reconfigure_io_chain - clear latches and reconfigure I/O chain | 372 | * omap3430_pre_es3_1_reconfigure_io_chain - restart wake-up daisy chain |
373 | * | ||
374 | * The ST_IO_CHAIN bit does not exist in 3430 before es3.1. The only | ||
375 | * thing we can do is toggle EN_IO bit for earlier omaps. | ||
376 | */ | ||
377 | void omap3430_pre_es3_1_reconfigure_io_chain(void) | ||
378 | { | ||
379 | omap2_prm_clear_mod_reg_bits(OMAP3430_EN_IO_MASK, WKUP_MOD, | ||
380 | PM_WKEN); | ||
381 | omap2_prm_set_mod_reg_bits(OMAP3430_EN_IO_MASK, WKUP_MOD, | ||
382 | PM_WKEN); | ||
383 | omap2_prm_read_mod_reg(WKUP_MOD, PM_WKEN); | ||
384 | } | ||
385 | |||
386 | /** | ||
387 | * omap3_prm_reconfigure_io_chain - clear latches and reconfigure I/O chain | ||
373 | * | 388 | * |
374 | * Clear any previously-latched I/O wakeup events and ensure that the | 389 | * Clear any previously-latched I/O wakeup events and ensure that the |
375 | * I/O wakeup gates are aligned with the current mux settings. Works | 390 | * I/O wakeup gates are aligned with the current mux settings. Works |
376 | * by asserting WUCLKIN, waiting for WUCLKOUT to be asserted, and then | 391 | * by asserting WUCLKIN, waiting for WUCLKOUT to be asserted, and then |
377 | * deasserting WUCLKIN and clearing the ST_IO_CHAIN WKST bit. No | 392 | * deasserting WUCLKIN and clearing the ST_IO_CHAIN WKST bit. No |
378 | * return value. | 393 | * return value. These registers are only available in 3430 es3.1 and later. |
379 | */ | 394 | */ |
380 | void omap3xxx_prm_reconfigure_io_chain(void) | 395 | void omap3_prm_reconfigure_io_chain(void) |
381 | { | 396 | { |
382 | int i = 0; | 397 | int i = 0; |
383 | 398 | ||
@@ -400,6 +415,15 @@ void omap3xxx_prm_reconfigure_io_chain(void) | |||
400 | } | 415 | } |
401 | 416 | ||
402 | /** | 417 | /** |
418 | * omap3xxx_prm_reconfigure_io_chain - reconfigure I/O chain | ||
419 | */ | ||
420 | void omap3xxx_prm_reconfigure_io_chain(void) | ||
421 | { | ||
422 | if (omap3_prcm_irq_setup.reconfigure_io_chain) | ||
423 | omap3_prcm_irq_setup.reconfigure_io_chain(); | ||
424 | } | ||
425 | |||
426 | /** | ||
403 | * omap3xxx_prm_enable_io_wakeup - enable wakeup events from I/O wakeup latches | 427 | * omap3xxx_prm_enable_io_wakeup - enable wakeup events from I/O wakeup latches |
404 | * | 428 | * |
405 | * Activates the I/O wakeup event latches and allows events logged by | 429 | * Activates the I/O wakeup event latches and allows events logged by |
@@ -656,6 +680,13 @@ static int omap3xxx_prm_late_init(void) | |||
656 | if (!(prm_features & PRM_HAS_IO_WAKEUP)) | 680 | if (!(prm_features & PRM_HAS_IO_WAKEUP)) |
657 | return 0; | 681 | return 0; |
658 | 682 | ||
683 | if (omap3_has_io_chain_ctrl()) | ||
684 | omap3_prcm_irq_setup.reconfigure_io_chain = | ||
685 | omap3_prm_reconfigure_io_chain; | ||
686 | else | ||
687 | omap3_prcm_irq_setup.reconfigure_io_chain = | ||
688 | omap3430_pre_es3_1_reconfigure_io_chain; | ||
689 | |||
659 | omap3xxx_prm_enable_io_wakeup(); | 690 | omap3xxx_prm_enable_io_wakeup(); |
660 | ret = omap_prcm_register_chain_handler(&omap3_prcm_irq_setup); | 691 | ret = omap_prcm_register_chain_handler(&omap3_prcm_irq_setup); |
661 | if (!ret) | 692 | if (!ret) |
diff --git a/arch/arm/mach-pxa/generic.c b/arch/arm/mach-pxa/generic.c index 630fa916bbc6..04b013fbc98f 100644 --- a/arch/arm/mach-pxa/generic.c +++ b/arch/arm/mach-pxa/generic.c | |||
@@ -61,7 +61,7 @@ EXPORT_SYMBOL(get_clock_tick_rate); | |||
61 | /* | 61 | /* |
62 | * For non device-tree builds, keep legacy timer init | 62 | * For non device-tree builds, keep legacy timer init |
63 | */ | 63 | */ |
64 | void pxa_timer_init(void) | 64 | void __init pxa_timer_init(void) |
65 | { | 65 | { |
66 | pxa_timer_nodt_init(IRQ_OST0, io_p2v(0x40a00000), | 66 | pxa_timer_nodt_init(IRQ_OST0, io_p2v(0x40a00000), |
67 | get_clock_tick_rate()); | 67 | get_clock_tick_rate()); |
diff --git a/arch/arm/mm/alignment.c b/arch/arm/mm/alignment.c index 0c1ab49e5f7b..83792f4324ea 100644 --- a/arch/arm/mm/alignment.c +++ b/arch/arm/mm/alignment.c | |||
@@ -41,6 +41,7 @@ | |||
41 | * This code is not portable to processors with late data abort handling. | 41 | * This code is not portable to processors with late data abort handling. |
42 | */ | 42 | */ |
43 | #define CODING_BITS(i) (i & 0x0e000000) | 43 | #define CODING_BITS(i) (i & 0x0e000000) |
44 | #define COND_BITS(i) (i & 0xf0000000) | ||
44 | 45 | ||
45 | #define LDST_I_BIT(i) (i & (1 << 26)) /* Immediate constant */ | 46 | #define LDST_I_BIT(i) (i & (1 << 26)) /* Immediate constant */ |
46 | #define LDST_P_BIT(i) (i & (1 << 24)) /* Preindex */ | 47 | #define LDST_P_BIT(i) (i & (1 << 24)) /* Preindex */ |
@@ -821,6 +822,8 @@ do_alignment(unsigned long addr, unsigned int fsr, struct pt_regs *regs) | |||
821 | break; | 822 | break; |
822 | 823 | ||
823 | case 0x04000000: /* ldr or str immediate */ | 824 | case 0x04000000: /* ldr or str immediate */ |
825 | if (COND_BITS(instr) == 0xf0000000) /* NEON VLDn, VSTn */ | ||
826 | goto bad; | ||
824 | offset.un = OFFSET_BITS(instr); | 827 | offset.un = OFFSET_BITS(instr); |
825 | handler = do_alignment_ldrstr; | 828 | handler = do_alignment_ldrstr; |
826 | break; | 829 | break; |
diff --git a/arch/arm/mm/proc-v7-3level.S b/arch/arm/mm/proc-v7-3level.S index b64e67c7f176..d3daed0ae0ad 100644 --- a/arch/arm/mm/proc-v7-3level.S +++ b/arch/arm/mm/proc-v7-3level.S | |||
@@ -157,9 +157,9 @@ ENDPROC(cpu_v7_set_pte_ext) | |||
157 | * TFR EV X F IHD LR S | 157 | * TFR EV X F IHD LR S |
158 | * .EEE ..EE PUI. .TAT 4RVI ZWRS BLDP WCAM | 158 | * .EEE ..EE PUI. .TAT 4RVI ZWRS BLDP WCAM |
159 | * rxxx rrxx xxx0 0101 xxxx xxxx x111 xxxx < forced | 159 | * rxxx rrxx xxx0 0101 xxxx xxxx x111 xxxx < forced |
160 | * 11 0 110 1 0011 1100 .111 1101 < we want | 160 | * 11 0 110 0 0011 1100 .111 1101 < we want |
161 | */ | 161 | */ |
162 | .align 2 | 162 | .align 2 |
163 | .type v7_crval, #object | 163 | .type v7_crval, #object |
164 | v7_crval: | 164 | v7_crval: |
165 | crval clear=0x0120c302, mmuset=0x30c23c7d, ucset=0x00c01c7c | 165 | crval clear=0x0122c302, mmuset=0x30c03c7d, ucset=0x00c01c7c |
diff --git a/arch/arm/plat-omap/Kconfig b/arch/arm/plat-omap/Kconfig index 02fc10d2d63b..d055db32ffcb 100644 --- a/arch/arm/plat-omap/Kconfig +++ b/arch/arm/plat-omap/Kconfig | |||
@@ -1,3 +1,6 @@ | |||
1 | config ARCH_OMAP | ||
2 | bool | ||
3 | |||
1 | if ARCH_OMAP | 4 | if ARCH_OMAP |
2 | 5 | ||
3 | menu "TI OMAP Common Features" | 6 | menu "TI OMAP Common Features" |
diff --git a/arch/mips/kernel/mcount.S b/arch/mips/kernel/mcount.S index 5d25462de8a6..2f7c734771f4 100644 --- a/arch/mips/kernel/mcount.S +++ b/arch/mips/kernel/mcount.S | |||
@@ -129,7 +129,11 @@ NESTED(_mcount, PT_SIZE, ra) | |||
129 | nop | 129 | nop |
130 | #endif | 130 | #endif |
131 | b ftrace_stub | 131 | b ftrace_stub |
132 | #ifdef CONFIG_32BIT | ||
133 | addiu sp, sp, 8 | ||
134 | #else | ||
132 | nop | 135 | nop |
136 | #endif | ||
133 | 137 | ||
134 | static_trace: | 138 | static_trace: |
135 | MCOUNT_SAVE_REGS | 139 | MCOUNT_SAVE_REGS |
@@ -139,6 +143,9 @@ static_trace: | |||
139 | move a1, AT /* arg2: parent's return address */ | 143 | move a1, AT /* arg2: parent's return address */ |
140 | 144 | ||
141 | MCOUNT_RESTORE_REGS | 145 | MCOUNT_RESTORE_REGS |
146 | #ifdef CONFIG_32BIT | ||
147 | addiu sp, sp, 8 | ||
148 | #endif | ||
142 | .globl ftrace_stub | 149 | .globl ftrace_stub |
143 | ftrace_stub: | 150 | ftrace_stub: |
144 | RETURN_BACK | 151 | RETURN_BACK |
@@ -183,6 +190,11 @@ NESTED(ftrace_graph_caller, PT_SIZE, ra) | |||
183 | jal prepare_ftrace_return | 190 | jal prepare_ftrace_return |
184 | nop | 191 | nop |
185 | MCOUNT_RESTORE_REGS | 192 | MCOUNT_RESTORE_REGS |
193 | #ifndef CONFIG_DYNAMIC_FTRACE | ||
194 | #ifdef CONFIG_32BIT | ||
195 | addiu sp, sp, 8 | ||
196 | #endif | ||
197 | #endif | ||
186 | RETURN_BACK | 198 | RETURN_BACK |
187 | END(ftrace_graph_caller) | 199 | END(ftrace_graph_caller) |
188 | 200 | ||
diff --git a/arch/mips/math-emu/cp1emu.c b/arch/mips/math-emu/cp1emu.c index bf0fc6b16ad9..7a4727795a70 100644 --- a/arch/mips/math-emu/cp1emu.c +++ b/arch/mips/math-emu/cp1emu.c | |||
@@ -650,9 +650,9 @@ static inline int cop1_64bit(struct pt_regs *xcp) | |||
650 | #define SIFROMREG(si, x) \ | 650 | #define SIFROMREG(si, x) \ |
651 | do { \ | 651 | do { \ |
652 | if (cop1_64bit(xcp)) \ | 652 | if (cop1_64bit(xcp)) \ |
653 | (si) = get_fpr32(&ctx->fpr[x], 0); \ | 653 | (si) = (int)get_fpr32(&ctx->fpr[x], 0); \ |
654 | else \ | 654 | else \ |
655 | (si) = get_fpr32(&ctx->fpr[(x) & ~1], (x) & 1); \ | 655 | (si) = (int)get_fpr32(&ctx->fpr[(x) & ~1], (x) & 1); \ |
656 | } while (0) | 656 | } while (0) |
657 | 657 | ||
658 | #define SITOREG(si, x) \ | 658 | #define SITOREG(si, x) \ |
@@ -667,7 +667,7 @@ do { \ | |||
667 | } \ | 667 | } \ |
668 | } while (0) | 668 | } while (0) |
669 | 669 | ||
670 | #define SIFROMHREG(si, x) ((si) = get_fpr32(&ctx->fpr[x], 1)) | 670 | #define SIFROMHREG(si, x) ((si) = (int)get_fpr32(&ctx->fpr[x], 1)) |
671 | 671 | ||
672 | #define SITOHREG(si, x) \ | 672 | #define SITOHREG(si, x) \ |
673 | do { \ | 673 | do { \ |
diff --git a/arch/x86/boot/compressed/Makefile b/arch/x86/boot/compressed/Makefile index 7a801a310e37..0fcd9133790c 100644 --- a/arch/x86/boot/compressed/Makefile +++ b/arch/x86/boot/compressed/Makefile | |||
@@ -33,8 +33,7 @@ VMLINUX_OBJS = $(obj)/vmlinux.lds $(obj)/head_$(BITS).o $(obj)/misc.o \ | |||
33 | $(obj)/eboot.o: KBUILD_CFLAGS += -fshort-wchar -mno-red-zone | 33 | $(obj)/eboot.o: KBUILD_CFLAGS += -fshort-wchar -mno-red-zone |
34 | 34 | ||
35 | ifeq ($(CONFIG_EFI_STUB), y) | 35 | ifeq ($(CONFIG_EFI_STUB), y) |
36 | VMLINUX_OBJS += $(obj)/eboot.o $(obj)/efi_stub_$(BITS).o \ | 36 | VMLINUX_OBJS += $(obj)/eboot.o $(obj)/efi_stub_$(BITS).o |
37 | $(objtree)/drivers/firmware/efi/libstub/lib.a | ||
38 | endif | 37 | endif |
39 | 38 | ||
40 | $(obj)/vmlinux: $(VMLINUX_OBJS) FORCE | 39 | $(obj)/vmlinux: $(VMLINUX_OBJS) FORCE |
diff --git a/arch/x86/boot/compressed/aslr.c b/arch/x86/boot/compressed/aslr.c index fc6091abedb7..d39189ba7f8e 100644 --- a/arch/x86/boot/compressed/aslr.c +++ b/arch/x86/boot/compressed/aslr.c | |||
@@ -183,12 +183,27 @@ static void mem_avoid_init(unsigned long input, unsigned long input_size, | |||
183 | static bool mem_avoid_overlap(struct mem_vector *img) | 183 | static bool mem_avoid_overlap(struct mem_vector *img) |
184 | { | 184 | { |
185 | int i; | 185 | int i; |
186 | struct setup_data *ptr; | ||
186 | 187 | ||
187 | for (i = 0; i < MEM_AVOID_MAX; i++) { | 188 | for (i = 0; i < MEM_AVOID_MAX; i++) { |
188 | if (mem_overlaps(img, &mem_avoid[i])) | 189 | if (mem_overlaps(img, &mem_avoid[i])) |
189 | return true; | 190 | return true; |
190 | } | 191 | } |
191 | 192 | ||
193 | /* Avoid all entries in the setup_data linked list. */ | ||
194 | ptr = (struct setup_data *)(unsigned long)real_mode->hdr.setup_data; | ||
195 | while (ptr) { | ||
196 | struct mem_vector avoid; | ||
197 | |||
198 | avoid.start = (u64)ptr; | ||
199 | avoid.size = sizeof(*ptr) + ptr->len; | ||
200 | |||
201 | if (mem_overlaps(img, &avoid)) | ||
202 | return true; | ||
203 | |||
204 | ptr = (struct setup_data *)(unsigned long)ptr->next; | ||
205 | } | ||
206 | |||
192 | return false; | 207 | return false; |
193 | } | 208 | } |
194 | 209 | ||
diff --git a/arch/x86/boot/compressed/eboot.c b/arch/x86/boot/compressed/eboot.c index dca9842d8f91..de8eebd6f67c 100644 --- a/arch/x86/boot/compressed/eboot.c +++ b/arch/x86/boot/compressed/eboot.c | |||
@@ -19,7 +19,10 @@ | |||
19 | 19 | ||
20 | static efi_system_table_t *sys_table; | 20 | static efi_system_table_t *sys_table; |
21 | 21 | ||
22 | struct efi_config *efi_early; | 22 | static struct efi_config *efi_early; |
23 | |||
24 | #define efi_call_early(f, ...) \ | ||
25 | efi_early->call(efi_early->f, __VA_ARGS__); | ||
23 | 26 | ||
24 | #define BOOT_SERVICES(bits) \ | 27 | #define BOOT_SERVICES(bits) \ |
25 | static void setup_boot_services##bits(struct efi_config *c) \ | 28 | static void setup_boot_services##bits(struct efi_config *c) \ |
@@ -265,21 +268,25 @@ void efi_char16_printk(efi_system_table_t *table, efi_char16_t *str) | |||
265 | 268 | ||
266 | offset = offsetof(typeof(*out), output_string); | 269 | offset = offsetof(typeof(*out), output_string); |
267 | output_string = efi_early->text_output + offset; | 270 | output_string = efi_early->text_output + offset; |
271 | out = (typeof(out))(unsigned long)efi_early->text_output; | ||
268 | func = (u64 *)output_string; | 272 | func = (u64 *)output_string; |
269 | 273 | ||
270 | efi_early->call(*func, efi_early->text_output, str); | 274 | efi_early->call(*func, out, str); |
271 | } else { | 275 | } else { |
272 | struct efi_simple_text_output_protocol_32 *out; | 276 | struct efi_simple_text_output_protocol_32 *out; |
273 | u32 *func; | 277 | u32 *func; |
274 | 278 | ||
275 | offset = offsetof(typeof(*out), output_string); | 279 | offset = offsetof(typeof(*out), output_string); |
276 | output_string = efi_early->text_output + offset; | 280 | output_string = efi_early->text_output + offset; |
281 | out = (typeof(out))(unsigned long)efi_early->text_output; | ||
277 | func = (u32 *)output_string; | 282 | func = (u32 *)output_string; |
278 | 283 | ||
279 | efi_early->call(*func, efi_early->text_output, str); | 284 | efi_early->call(*func, out, str); |
280 | } | 285 | } |
281 | } | 286 | } |
282 | 287 | ||
288 | #include "../../../../drivers/firmware/efi/libstub/efi-stub-helper.c" | ||
289 | |||
283 | static void find_bits(unsigned long mask, u8 *pos, u8 *size) | 290 | static void find_bits(unsigned long mask, u8 *pos, u8 *size) |
284 | { | 291 | { |
285 | u8 first, len; | 292 | u8 first, len; |
@@ -360,7 +367,7 @@ free_struct: | |||
360 | return status; | 367 | return status; |
361 | } | 368 | } |
362 | 369 | ||
363 | static efi_status_t | 370 | static void |
364 | setup_efi_pci32(struct boot_params *params, void **pci_handle, | 371 | setup_efi_pci32(struct boot_params *params, void **pci_handle, |
365 | unsigned long size) | 372 | unsigned long size) |
366 | { | 373 | { |
@@ -403,8 +410,6 @@ setup_efi_pci32(struct boot_params *params, void **pci_handle, | |||
403 | data = (struct setup_data *)rom; | 410 | data = (struct setup_data *)rom; |
404 | 411 | ||
405 | } | 412 | } |
406 | |||
407 | return status; | ||
408 | } | 413 | } |
409 | 414 | ||
410 | static efi_status_t | 415 | static efi_status_t |
@@ -463,7 +468,7 @@ free_struct: | |||
463 | 468 | ||
464 | } | 469 | } |
465 | 470 | ||
466 | static efi_status_t | 471 | static void |
467 | setup_efi_pci64(struct boot_params *params, void **pci_handle, | 472 | setup_efi_pci64(struct boot_params *params, void **pci_handle, |
468 | unsigned long size) | 473 | unsigned long size) |
469 | { | 474 | { |
@@ -506,11 +511,18 @@ setup_efi_pci64(struct boot_params *params, void **pci_handle, | |||
506 | data = (struct setup_data *)rom; | 511 | data = (struct setup_data *)rom; |
507 | 512 | ||
508 | } | 513 | } |
509 | |||
510 | return status; | ||
511 | } | 514 | } |
512 | 515 | ||
513 | static efi_status_t setup_efi_pci(struct boot_params *params) | 516 | /* |
517 | * There's no way to return an informative status from this function, | ||
518 | * because any analysis (and printing of error messages) needs to be | ||
519 | * done directly at the EFI function call-site. | ||
520 | * | ||
521 | * For example, EFI_INVALID_PARAMETER could indicate a bug or maybe we | ||
522 | * just didn't find any PCI devices, but there's no way to tell outside | ||
523 | * the context of the call. | ||
524 | */ | ||
525 | static void setup_efi_pci(struct boot_params *params) | ||
514 | { | 526 | { |
515 | efi_status_t status; | 527 | efi_status_t status; |
516 | void **pci_handle = NULL; | 528 | void **pci_handle = NULL; |
@@ -527,7 +539,7 @@ static efi_status_t setup_efi_pci(struct boot_params *params) | |||
527 | size, (void **)&pci_handle); | 539 | size, (void **)&pci_handle); |
528 | 540 | ||
529 | if (status != EFI_SUCCESS) | 541 | if (status != EFI_SUCCESS) |
530 | return status; | 542 | return; |
531 | 543 | ||
532 | status = efi_call_early(locate_handle, | 544 | status = efi_call_early(locate_handle, |
533 | EFI_LOCATE_BY_PROTOCOL, &pci_proto, | 545 | EFI_LOCATE_BY_PROTOCOL, &pci_proto, |
@@ -538,13 +550,12 @@ static efi_status_t setup_efi_pci(struct boot_params *params) | |||
538 | goto free_handle; | 550 | goto free_handle; |
539 | 551 | ||
540 | if (efi_early->is64) | 552 | if (efi_early->is64) |
541 | status = setup_efi_pci64(params, pci_handle, size); | 553 | setup_efi_pci64(params, pci_handle, size); |
542 | else | 554 | else |
543 | status = setup_efi_pci32(params, pci_handle, size); | 555 | setup_efi_pci32(params, pci_handle, size); |
544 | 556 | ||
545 | free_handle: | 557 | free_handle: |
546 | efi_call_early(free_pool, pci_handle); | 558 | efi_call_early(free_pool, pci_handle); |
547 | return status; | ||
548 | } | 559 | } |
549 | 560 | ||
550 | static void | 561 | static void |
@@ -1380,10 +1391,7 @@ struct boot_params *efi_main(struct efi_config *c, | |||
1380 | 1391 | ||
1381 | setup_graphics(boot_params); | 1392 | setup_graphics(boot_params); |
1382 | 1393 | ||
1383 | status = setup_efi_pci(boot_params); | 1394 | setup_efi_pci(boot_params); |
1384 | if (status != EFI_SUCCESS) { | ||
1385 | efi_printk(sys_table, "setup_efi_pci() failed!\n"); | ||
1386 | } | ||
1387 | 1395 | ||
1388 | status = efi_call_early(allocate_pool, EFI_LOADER_DATA, | 1396 | status = efi_call_early(allocate_pool, EFI_LOADER_DATA, |
1389 | sizeof(*gdt), (void **)&gdt); | 1397 | sizeof(*gdt), (void **)&gdt); |
diff --git a/arch/x86/boot/compressed/eboot.h b/arch/x86/boot/compressed/eboot.h index d487e727f1ec..c88c31ecad12 100644 --- a/arch/x86/boot/compressed/eboot.h +++ b/arch/x86/boot/compressed/eboot.h | |||
@@ -103,4 +103,20 @@ struct efi_uga_draw_protocol { | |||
103 | void *blt; | 103 | void *blt; |
104 | }; | 104 | }; |
105 | 105 | ||
106 | struct efi_config { | ||
107 | u64 image_handle; | ||
108 | u64 table; | ||
109 | u64 allocate_pool; | ||
110 | u64 allocate_pages; | ||
111 | u64 get_memory_map; | ||
112 | u64 free_pool; | ||
113 | u64 free_pages; | ||
114 | u64 locate_handle; | ||
115 | u64 handle_protocol; | ||
116 | u64 exit_boot_services; | ||
117 | u64 text_output; | ||
118 | efi_status_t (*call)(unsigned long, ...); | ||
119 | bool is64; | ||
120 | } __packed; | ||
121 | |||
106 | #endif /* BOOT_COMPRESSED_EBOOT_H */ | 122 | #endif /* BOOT_COMPRESSED_EBOOT_H */ |
diff --git a/arch/x86/include/asm/efi.h b/arch/x86/include/asm/efi.h index 044a2fd3c5fe..0ec241ede5a2 100644 --- a/arch/x86/include/asm/efi.h +++ b/arch/x86/include/asm/efi.h | |||
@@ -159,30 +159,6 @@ static inline efi_status_t efi_thunk_set_virtual_address_map( | |||
159 | } | 159 | } |
160 | #endif /* CONFIG_EFI_MIXED */ | 160 | #endif /* CONFIG_EFI_MIXED */ |
161 | 161 | ||
162 | |||
163 | /* arch specific definitions used by the stub code */ | ||
164 | |||
165 | struct efi_config { | ||
166 | u64 image_handle; | ||
167 | u64 table; | ||
168 | u64 allocate_pool; | ||
169 | u64 allocate_pages; | ||
170 | u64 get_memory_map; | ||
171 | u64 free_pool; | ||
172 | u64 free_pages; | ||
173 | u64 locate_handle; | ||
174 | u64 handle_protocol; | ||
175 | u64 exit_boot_services; | ||
176 | u64 text_output; | ||
177 | efi_status_t (*call)(unsigned long, ...); | ||
178 | bool is64; | ||
179 | } __packed; | ||
180 | |||
181 | extern struct efi_config *efi_early; | ||
182 | |||
183 | #define efi_call_early(f, ...) \ | ||
184 | efi_early->call(efi_early->f, __VA_ARGS__); | ||
185 | |||
186 | extern bool efi_reboot_required(void); | 162 | extern bool efi_reboot_required(void); |
187 | 163 | ||
188 | #else | 164 | #else |
diff --git a/arch/x86/include/asm/fixmap.h b/arch/x86/include/asm/fixmap.h index b0910f97a3ea..ffb1733ac91f 100644 --- a/arch/x86/include/asm/fixmap.h +++ b/arch/x86/include/asm/fixmap.h | |||
@@ -106,14 +106,14 @@ enum fixed_addresses { | |||
106 | __end_of_permanent_fixed_addresses, | 106 | __end_of_permanent_fixed_addresses, |
107 | 107 | ||
108 | /* | 108 | /* |
109 | * 256 temporary boot-time mappings, used by early_ioremap(), | 109 | * 512 temporary boot-time mappings, used by early_ioremap(), |
110 | * before ioremap() is functional. | 110 | * before ioremap() is functional. |
111 | * | 111 | * |
112 | * If necessary we round it up to the next 256 pages boundary so | 112 | * If necessary we round it up to the next 512 pages boundary so |
113 | * that we can have a single pgd entry and a single pte table: | 113 | * that we can have a single pgd entry and a single pte table: |
114 | */ | 114 | */ |
115 | #define NR_FIX_BTMAPS 64 | 115 | #define NR_FIX_BTMAPS 64 |
116 | #define FIX_BTMAPS_SLOTS 4 | 116 | #define FIX_BTMAPS_SLOTS 8 |
117 | #define TOTAL_FIX_BTMAPS (NR_FIX_BTMAPS * FIX_BTMAPS_SLOTS) | 117 | #define TOTAL_FIX_BTMAPS (NR_FIX_BTMAPS * FIX_BTMAPS_SLOTS) |
118 | FIX_BTMAP_END = | 118 | FIX_BTMAP_END = |
119 | (__end_of_permanent_fixed_addresses ^ | 119 | (__end_of_permanent_fixed_addresses ^ |
diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c index 2d872e08fab9..42a2dca984b3 100644 --- a/arch/x86/kernel/smpboot.c +++ b/arch/x86/kernel/smpboot.c | |||
@@ -1284,6 +1284,9 @@ static void remove_siblinginfo(int cpu) | |||
1284 | 1284 | ||
1285 | for_each_cpu(sibling, cpu_sibling_mask(cpu)) | 1285 | for_each_cpu(sibling, cpu_sibling_mask(cpu)) |
1286 | cpumask_clear_cpu(cpu, cpu_sibling_mask(sibling)); | 1286 | cpumask_clear_cpu(cpu, cpu_sibling_mask(sibling)); |
1287 | for_each_cpu(sibling, cpu_llc_shared_mask(cpu)) | ||
1288 | cpumask_clear_cpu(cpu, cpu_llc_shared_mask(sibling)); | ||
1289 | cpumask_clear(cpu_llc_shared_mask(cpu)); | ||
1287 | cpumask_clear(cpu_sibling_mask(cpu)); | 1290 | cpumask_clear(cpu_sibling_mask(cpu)); |
1288 | cpumask_clear(cpu_core_mask(cpu)); | 1291 | cpumask_clear(cpu_core_mask(cpu)); |
1289 | c->phys_proc_id = 0; | 1292 | c->phys_proc_id = 0; |
diff --git a/drivers/acpi/acpi_lpss.c b/drivers/acpi/acpi_lpss.c index fddc1e86f9d0..b0ea767c8696 100644 --- a/drivers/acpi/acpi_lpss.c +++ b/drivers/acpi/acpi_lpss.c | |||
@@ -419,7 +419,6 @@ static int acpi_lpss_create_device(struct acpi_device *adev, | |||
419 | adev->driver_data = pdata; | 419 | adev->driver_data = pdata; |
420 | pdev = acpi_create_platform_device(adev); | 420 | pdev = acpi_create_platform_device(adev); |
421 | if (!IS_ERR_OR_NULL(pdev)) { | 421 | if (!IS_ERR_OR_NULL(pdev)) { |
422 | device_enable_async_suspend(&pdev->dev); | ||
423 | return 1; | 422 | return 1; |
424 | } | 423 | } |
425 | 424 | ||
diff --git a/drivers/acpi/acpica/aclocal.h b/drivers/acpi/acpica/aclocal.h index 1f9aba5fb81f..2747279fbe3c 100644 --- a/drivers/acpi/acpica/aclocal.h +++ b/drivers/acpi/acpica/aclocal.h | |||
@@ -254,6 +254,7 @@ struct acpi_create_field_info { | |||
254 | u32 field_bit_position; | 254 | u32 field_bit_position; |
255 | u32 field_bit_length; | 255 | u32 field_bit_length; |
256 | u16 resource_length; | 256 | u16 resource_length; |
257 | u16 pin_number_index; | ||
257 | u8 field_flags; | 258 | u8 field_flags; |
258 | u8 attribute; | 259 | u8 attribute; |
259 | u8 field_type; | 260 | u8 field_type; |
diff --git a/drivers/acpi/acpica/acobject.h b/drivers/acpi/acpica/acobject.h index 22fb6449d3d6..8abb393dafab 100644 --- a/drivers/acpi/acpica/acobject.h +++ b/drivers/acpi/acpica/acobject.h | |||
@@ -264,6 +264,7 @@ struct acpi_object_region_field { | |||
264 | ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_FIELD_INFO u16 resource_length; | 264 | ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_FIELD_INFO u16 resource_length; |
265 | union acpi_operand_object *region_obj; /* Containing op_region object */ | 265 | union acpi_operand_object *region_obj; /* Containing op_region object */ |
266 | u8 *resource_buffer; /* resource_template for serial regions/fields */ | 266 | u8 *resource_buffer; /* resource_template for serial regions/fields */ |
267 | u16 pin_number_index; /* Index relative to previous Connection/Template */ | ||
267 | }; | 268 | }; |
268 | 269 | ||
269 | struct acpi_object_bank_field { | 270 | struct acpi_object_bank_field { |
diff --git a/drivers/acpi/acpica/dsfield.c b/drivers/acpi/acpica/dsfield.c index 3661c8e90540..c57666196672 100644 --- a/drivers/acpi/acpica/dsfield.c +++ b/drivers/acpi/acpica/dsfield.c | |||
@@ -360,6 +360,7 @@ acpi_ds_get_field_names(struct acpi_create_field_info *info, | |||
360 | */ | 360 | */ |
361 | info->resource_buffer = NULL; | 361 | info->resource_buffer = NULL; |
362 | info->connection_node = NULL; | 362 | info->connection_node = NULL; |
363 | info->pin_number_index = 0; | ||
363 | 364 | ||
364 | /* | 365 | /* |
365 | * A Connection() is either an actual resource descriptor (buffer) | 366 | * A Connection() is either an actual resource descriptor (buffer) |
@@ -437,6 +438,7 @@ acpi_ds_get_field_names(struct acpi_create_field_info *info, | |||
437 | } | 438 | } |
438 | 439 | ||
439 | info->field_bit_position += info->field_bit_length; | 440 | info->field_bit_position += info->field_bit_length; |
441 | info->pin_number_index++; /* Index relative to previous Connection() */ | ||
440 | break; | 442 | break; |
441 | 443 | ||
442 | default: | 444 | default: |
diff --git a/drivers/acpi/acpica/evregion.c b/drivers/acpi/acpica/evregion.c index 9957297d1580..8eb8575e8c16 100644 --- a/drivers/acpi/acpica/evregion.c +++ b/drivers/acpi/acpica/evregion.c | |||
@@ -142,6 +142,7 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj, | |||
142 | union acpi_operand_object *region_obj2; | 142 | union acpi_operand_object *region_obj2; |
143 | void *region_context = NULL; | 143 | void *region_context = NULL; |
144 | struct acpi_connection_info *context; | 144 | struct acpi_connection_info *context; |
145 | acpi_physical_address address; | ||
145 | 146 | ||
146 | ACPI_FUNCTION_TRACE(ev_address_space_dispatch); | 147 | ACPI_FUNCTION_TRACE(ev_address_space_dispatch); |
147 | 148 | ||
@@ -231,25 +232,23 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj, | |||
231 | /* We have everything we need, we can invoke the address space handler */ | 232 | /* We have everything we need, we can invoke the address space handler */ |
232 | 233 | ||
233 | handler = handler_desc->address_space.handler; | 234 | handler = handler_desc->address_space.handler; |
234 | 235 | address = (region_obj->region.address + region_offset); | |
235 | ACPI_DEBUG_PRINT((ACPI_DB_OPREGION, | ||
236 | "Handler %p (@%p) Address %8.8X%8.8X [%s]\n", | ||
237 | ®ion_obj->region.handler->address_space, handler, | ||
238 | ACPI_FORMAT_NATIVE_UINT(region_obj->region.address + | ||
239 | region_offset), | ||
240 | acpi_ut_get_region_name(region_obj->region. | ||
241 | space_id))); | ||
242 | 236 | ||
243 | /* | 237 | /* |
244 | * Special handling for generic_serial_bus and general_purpose_io: | 238 | * Special handling for generic_serial_bus and general_purpose_io: |
245 | * There are three extra parameters that must be passed to the | 239 | * There are three extra parameters that must be passed to the |
246 | * handler via the context: | 240 | * handler via the context: |
247 | * 1) Connection buffer, a resource template from Connection() op. | 241 | * 1) Connection buffer, a resource template from Connection() op |
248 | * 2) Length of the above buffer. | 242 | * 2) Length of the above buffer |
249 | * 3) Actual access length from the access_as() op. | 243 | * 3) Actual access length from the access_as() op |
244 | * | ||
245 | * In addition, for general_purpose_io, the Address and bit_width fields | ||
246 | * are defined as follows: | ||
247 | * 1) Address is the pin number index of the field (bit offset from | ||
248 | * the previous Connection) | ||
249 | * 2) bit_width is the actual bit length of the field (number of pins) | ||
250 | */ | 250 | */ |
251 | if (((region_obj->region.space_id == ACPI_ADR_SPACE_GSBUS) || | 251 | if ((region_obj->region.space_id == ACPI_ADR_SPACE_GSBUS) && |
252 | (region_obj->region.space_id == ACPI_ADR_SPACE_GPIO)) && | ||
253 | context && field_obj) { | 252 | context && field_obj) { |
254 | 253 | ||
255 | /* Get the Connection (resource_template) buffer */ | 254 | /* Get the Connection (resource_template) buffer */ |
@@ -258,6 +257,24 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj, | |||
258 | context->length = field_obj->field.resource_length; | 257 | context->length = field_obj->field.resource_length; |
259 | context->access_length = field_obj->field.access_length; | 258 | context->access_length = field_obj->field.access_length; |
260 | } | 259 | } |
260 | if ((region_obj->region.space_id == ACPI_ADR_SPACE_GPIO) && | ||
261 | context && field_obj) { | ||
262 | |||
263 | /* Get the Connection (resource_template) buffer */ | ||
264 | |||
265 | context->connection = field_obj->field.resource_buffer; | ||
266 | context->length = field_obj->field.resource_length; | ||
267 | context->access_length = field_obj->field.access_length; | ||
268 | address = field_obj->field.pin_number_index; | ||
269 | bit_width = field_obj->field.bit_length; | ||
270 | } | ||
271 | |||
272 | ACPI_DEBUG_PRINT((ACPI_DB_OPREGION, | ||
273 | "Handler %p (@%p) Address %8.8X%8.8X [%s]\n", | ||
274 | ®ion_obj->region.handler->address_space, handler, | ||
275 | ACPI_FORMAT_NATIVE_UINT(address), | ||
276 | acpi_ut_get_region_name(region_obj->region. | ||
277 | space_id))); | ||
261 | 278 | ||
262 | if (!(handler_desc->address_space.handler_flags & | 279 | if (!(handler_desc->address_space.handler_flags & |
263 | ACPI_ADDR_HANDLER_DEFAULT_INSTALLED)) { | 280 | ACPI_ADDR_HANDLER_DEFAULT_INSTALLED)) { |
@@ -271,9 +288,7 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj, | |||
271 | 288 | ||
272 | /* Call the handler */ | 289 | /* Call the handler */ |
273 | 290 | ||
274 | status = handler(function, | 291 | status = handler(function, address, bit_width, value, context, |
275 | (region_obj->region.address + region_offset), | ||
276 | bit_width, value, context, | ||
277 | region_obj2->extra.region_context); | 292 | region_obj2->extra.region_context); |
278 | 293 | ||
279 | if (ACPI_FAILURE(status)) { | 294 | if (ACPI_FAILURE(status)) { |
diff --git a/drivers/acpi/acpica/exfield.c b/drivers/acpi/acpica/exfield.c index 6907ce0c704c..b994845ed359 100644 --- a/drivers/acpi/acpica/exfield.c +++ b/drivers/acpi/acpica/exfield.c | |||
@@ -253,6 +253,37 @@ acpi_ex_read_data_from_field(struct acpi_walk_state * walk_state, | |||
253 | buffer = &buffer_desc->integer.value; | 253 | buffer = &buffer_desc->integer.value; |
254 | } | 254 | } |
255 | 255 | ||
256 | if ((obj_desc->common.type == ACPI_TYPE_LOCAL_REGION_FIELD) && | ||
257 | (obj_desc->field.region_obj->region.space_id == | ||
258 | ACPI_ADR_SPACE_GPIO)) { | ||
259 | /* | ||
260 | * For GPIO (general_purpose_io), the Address will be the bit offset | ||
261 | * from the previous Connection() operator, making it effectively a | ||
262 | * pin number index. The bit_length is the length of the field, which | ||
263 | * is thus the number of pins. | ||
264 | */ | ||
265 | ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, | ||
266 | "GPIO FieldRead [FROM]: Pin %u Bits %u\n", | ||
267 | obj_desc->field.pin_number_index, | ||
268 | obj_desc->field.bit_length)); | ||
269 | |||
270 | /* Lock entire transaction if requested */ | ||
271 | |||
272 | acpi_ex_acquire_global_lock(obj_desc->common_field.field_flags); | ||
273 | |||
274 | /* Perform the write */ | ||
275 | |||
276 | status = acpi_ex_access_region(obj_desc, 0, | ||
277 | (u64 *)buffer, ACPI_READ); | ||
278 | acpi_ex_release_global_lock(obj_desc->common_field.field_flags); | ||
279 | if (ACPI_FAILURE(status)) { | ||
280 | acpi_ut_remove_reference(buffer_desc); | ||
281 | } else { | ||
282 | *ret_buffer_desc = buffer_desc; | ||
283 | } | ||
284 | return_ACPI_STATUS(status); | ||
285 | } | ||
286 | |||
256 | ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, | 287 | ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, |
257 | "FieldRead [TO]: Obj %p, Type %X, Buf %p, ByteLen %X\n", | 288 | "FieldRead [TO]: Obj %p, Type %X, Buf %p, ByteLen %X\n", |
258 | obj_desc, obj_desc->common.type, buffer, | 289 | obj_desc, obj_desc->common.type, buffer, |
@@ -413,6 +444,42 @@ acpi_ex_write_data_to_field(union acpi_operand_object *source_desc, | |||
413 | 444 | ||
414 | *result_desc = buffer_desc; | 445 | *result_desc = buffer_desc; |
415 | return_ACPI_STATUS(status); | 446 | return_ACPI_STATUS(status); |
447 | } else if ((obj_desc->common.type == ACPI_TYPE_LOCAL_REGION_FIELD) && | ||
448 | (obj_desc->field.region_obj->region.space_id == | ||
449 | ACPI_ADR_SPACE_GPIO)) { | ||
450 | /* | ||
451 | * For GPIO (general_purpose_io), we will bypass the entire field | ||
452 | * mechanism and handoff the bit address and bit width directly to | ||
453 | * the handler. The Address will be the bit offset | ||
454 | * from the previous Connection() operator, making it effectively a | ||
455 | * pin number index. The bit_length is the length of the field, which | ||
456 | * is thus the number of pins. | ||
457 | */ | ||
458 | if (source_desc->common.type != ACPI_TYPE_INTEGER) { | ||
459 | return_ACPI_STATUS(AE_AML_OPERAND_TYPE); | ||
460 | } | ||
461 | |||
462 | ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, | ||
463 | "GPIO FieldWrite [FROM]: (%s:%X), Val %.8X [TO]: Pin %u Bits %u\n", | ||
464 | acpi_ut_get_type_name(source_desc->common. | ||
465 | type), | ||
466 | source_desc->common.type, | ||
467 | (u32)source_desc->integer.value, | ||
468 | obj_desc->field.pin_number_index, | ||
469 | obj_desc->field.bit_length)); | ||
470 | |||
471 | buffer = &source_desc->integer.value; | ||
472 | |||
473 | /* Lock entire transaction if requested */ | ||
474 | |||
475 | acpi_ex_acquire_global_lock(obj_desc->common_field.field_flags); | ||
476 | |||
477 | /* Perform the write */ | ||
478 | |||
479 | status = acpi_ex_access_region(obj_desc, 0, | ||
480 | (u64 *)buffer, ACPI_WRITE); | ||
481 | acpi_ex_release_global_lock(obj_desc->common_field.field_flags); | ||
482 | return_ACPI_STATUS(status); | ||
416 | } | 483 | } |
417 | 484 | ||
418 | /* Get a pointer to the data to be written */ | 485 | /* Get a pointer to the data to be written */ |
diff --git a/drivers/acpi/acpica/exprep.c b/drivers/acpi/acpica/exprep.c index ee3f872870bc..118e942005e5 100644 --- a/drivers/acpi/acpica/exprep.c +++ b/drivers/acpi/acpica/exprep.c | |||
@@ -484,6 +484,8 @@ acpi_status acpi_ex_prep_field_value(struct acpi_create_field_info *info) | |||
484 | obj_desc->field.resource_length = info->resource_length; | 484 | obj_desc->field.resource_length = info->resource_length; |
485 | } | 485 | } |
486 | 486 | ||
487 | obj_desc->field.pin_number_index = info->pin_number_index; | ||
488 | |||
487 | /* Allow full data read from EC address space */ | 489 | /* Allow full data read from EC address space */ |
488 | 490 | ||
489 | if ((obj_desc->field.region_obj->region.space_id == | 491 | if ((obj_desc->field.region_obj->region.space_id == |
diff --git a/drivers/acpi/container.c b/drivers/acpi/container.c index 76f7cff64594..c8ead9f97375 100644 --- a/drivers/acpi/container.c +++ b/drivers/acpi/container.c | |||
@@ -99,6 +99,13 @@ static void container_device_detach(struct acpi_device *adev) | |||
99 | device_unregister(dev); | 99 | device_unregister(dev); |
100 | } | 100 | } |
101 | 101 | ||
102 | static void container_device_online(struct acpi_device *adev) | ||
103 | { | ||
104 | struct device *dev = acpi_driver_data(adev); | ||
105 | |||
106 | kobject_uevent(&dev->kobj, KOBJ_ONLINE); | ||
107 | } | ||
108 | |||
102 | static struct acpi_scan_handler container_handler = { | 109 | static struct acpi_scan_handler container_handler = { |
103 | .ids = container_device_ids, | 110 | .ids = container_device_ids, |
104 | .attach = container_device_attach, | 111 | .attach = container_device_attach, |
@@ -106,6 +113,7 @@ static struct acpi_scan_handler container_handler = { | |||
106 | .hotplug = { | 113 | .hotplug = { |
107 | .enabled = true, | 114 | .enabled = true, |
108 | .demand_offline = true, | 115 | .demand_offline = true, |
116 | .notify_online = container_device_online, | ||
109 | }, | 117 | }, |
110 | }; | 118 | }; |
111 | 119 | ||
diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c index 3bf7764659a4..ae44d8654c82 100644 --- a/drivers/acpi/scan.c +++ b/drivers/acpi/scan.c | |||
@@ -130,7 +130,7 @@ static int create_modalias(struct acpi_device *acpi_dev, char *modalias, | |||
130 | list_for_each_entry(id, &acpi_dev->pnp.ids, list) { | 130 | list_for_each_entry(id, &acpi_dev->pnp.ids, list) { |
131 | count = snprintf(&modalias[len], size, "%s:", id->id); | 131 | count = snprintf(&modalias[len], size, "%s:", id->id); |
132 | if (count < 0) | 132 | if (count < 0) |
133 | return EINVAL; | 133 | return -EINVAL; |
134 | if (count >= size) | 134 | if (count >= size) |
135 | return -ENOMEM; | 135 | return -ENOMEM; |
136 | len += count; | 136 | len += count; |
@@ -2189,6 +2189,9 @@ static void acpi_bus_attach(struct acpi_device *device) | |||
2189 | ok: | 2189 | ok: |
2190 | list_for_each_entry(child, &device->children, node) | 2190 | list_for_each_entry(child, &device->children, node) |
2191 | acpi_bus_attach(child); | 2191 | acpi_bus_attach(child); |
2192 | |||
2193 | if (device->handler && device->handler->hotplug.notify_online) | ||
2194 | device->handler->hotplug.notify_online(device); | ||
2192 | } | 2195 | } |
2193 | 2196 | ||
2194 | /** | 2197 | /** |
diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c index fcbda105616e..8e7e18567ae6 100644 --- a/drivers/acpi/video.c +++ b/drivers/acpi/video.c | |||
@@ -750,6 +750,14 @@ static struct dmi_system_id video_dmi_table[] __initdata = { | |||
750 | DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad T520"), | 750 | DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad T520"), |
751 | }, | 751 | }, |
752 | }, | 752 | }, |
753 | { | ||
754 | .callback = video_disable_native_backlight, | ||
755 | .ident = "ThinkPad X201s", | ||
756 | .matches = { | ||
757 | DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), | ||
758 | DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad X201s"), | ||
759 | }, | ||
760 | }, | ||
753 | 761 | ||
754 | /* The native backlight controls do not work on some older machines */ | 762 | /* The native backlight controls do not work on some older machines */ |
755 | { | 763 | { |
diff --git a/drivers/bus/omap_l3_noc.h b/drivers/bus/omap_l3_noc.h index 551e01061434..95254585db86 100644 --- a/drivers/bus/omap_l3_noc.h +++ b/drivers/bus/omap_l3_noc.h | |||
@@ -188,31 +188,31 @@ static struct l3_flagmux_data omap_l3_flagmux_clk3 = { | |||
188 | }; | 188 | }; |
189 | 189 | ||
190 | static struct l3_masters_data omap_l3_masters[] = { | 190 | static struct l3_masters_data omap_l3_masters[] = { |
191 | { 0x0 , "MPU"}, | 191 | { 0x00, "MPU"}, |
192 | { 0x10, "CS_ADP"}, | 192 | { 0x04, "CS_ADP"}, |
193 | { 0x14, "xxx"}, | 193 | { 0x05, "xxx"}, |
194 | { 0x20, "DSP"}, | 194 | { 0x08, "DSP"}, |
195 | { 0x30, "IVAHD"}, | 195 | { 0x0C, "IVAHD"}, |
196 | { 0x40, "ISS"}, | 196 | { 0x10, "ISS"}, |
197 | { 0x44, "DucatiM3"}, | 197 | { 0x11, "DucatiM3"}, |
198 | { 0x48, "FaceDetect"}, | 198 | { 0x12, "FaceDetect"}, |
199 | { 0x50, "SDMA_Rd"}, | 199 | { 0x14, "SDMA_Rd"}, |
200 | { 0x54, "SDMA_Wr"}, | 200 | { 0x15, "SDMA_Wr"}, |
201 | { 0x58, "xxx"}, | 201 | { 0x16, "xxx"}, |
202 | { 0x5C, "xxx"}, | 202 | { 0x17, "xxx"}, |
203 | { 0x60, "SGX"}, | 203 | { 0x18, "SGX"}, |
204 | { 0x70, "DSS"}, | 204 | { 0x1C, "DSS"}, |
205 | { 0x80, "C2C"}, | 205 | { 0x20, "C2C"}, |
206 | { 0x88, "xxx"}, | 206 | { 0x22, "xxx"}, |
207 | { 0x8C, "xxx"}, | 207 | { 0x23, "xxx"}, |
208 | { 0x90, "HSI"}, | 208 | { 0x24, "HSI"}, |
209 | { 0xA0, "MMC1"}, | 209 | { 0x28, "MMC1"}, |
210 | { 0xA4, "MMC2"}, | 210 | { 0x29, "MMC2"}, |
211 | { 0xA8, "MMC6"}, | 211 | { 0x2A, "MMC6"}, |
212 | { 0xB0, "UNIPRO1"}, | 212 | { 0x2C, "UNIPRO1"}, |
213 | { 0xC0, "USBHOSTHS"}, | 213 | { 0x30, "USBHOSTHS"}, |
214 | { 0xC4, "USBOTGHS"}, | 214 | { 0x31, "USBOTGHS"}, |
215 | { 0xC8, "USBHOSTFS"} | 215 | { 0x32, "USBHOSTFS"} |
216 | }; | 216 | }; |
217 | 217 | ||
218 | static struct l3_flagmux_data *omap_l3_flagmux[] = { | 218 | static struct l3_flagmux_data *omap_l3_flagmux[] = { |
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index d9fdeddcef96..6e93e7f98358 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c | |||
@@ -1289,6 +1289,8 @@ err_get_freq: | |||
1289 | per_cpu(cpufreq_cpu_data, j) = NULL; | 1289 | per_cpu(cpufreq_cpu_data, j) = NULL; |
1290 | write_unlock_irqrestore(&cpufreq_driver_lock, flags); | 1290 | write_unlock_irqrestore(&cpufreq_driver_lock, flags); |
1291 | 1291 | ||
1292 | up_write(&policy->rwsem); | ||
1293 | |||
1292 | if (cpufreq_driver->exit) | 1294 | if (cpufreq_driver->exit) |
1293 | cpufreq_driver->exit(policy); | 1295 | cpufreq_driver->exit(policy); |
1294 | err_set_policy_cpu: | 1296 | err_set_policy_cpu: |
@@ -1656,6 +1658,8 @@ void cpufreq_suspend(void) | |||
1656 | if (!cpufreq_driver) | 1658 | if (!cpufreq_driver) |
1657 | return; | 1659 | return; |
1658 | 1660 | ||
1661 | cpufreq_suspended = true; | ||
1662 | |||
1659 | if (!has_target()) | 1663 | if (!has_target()) |
1660 | return; | 1664 | return; |
1661 | 1665 | ||
@@ -1670,8 +1674,6 @@ void cpufreq_suspend(void) | |||
1670 | pr_err("%s: Failed to suspend driver: %p\n", __func__, | 1674 | pr_err("%s: Failed to suspend driver: %p\n", __func__, |
1671 | policy); | 1675 | policy); |
1672 | } | 1676 | } |
1673 | |||
1674 | cpufreq_suspended = true; | ||
1675 | } | 1677 | } |
1676 | 1678 | ||
1677 | /** | 1679 | /** |
@@ -1687,13 +1689,13 @@ void cpufreq_resume(void) | |||
1687 | if (!cpufreq_driver) | 1689 | if (!cpufreq_driver) |
1688 | return; | 1690 | return; |
1689 | 1691 | ||
1692 | cpufreq_suspended = false; | ||
1693 | |||
1690 | if (!has_target()) | 1694 | if (!has_target()) |
1691 | return; | 1695 | return; |
1692 | 1696 | ||
1693 | pr_debug("%s: Resuming Governors\n", __func__); | 1697 | pr_debug("%s: Resuming Governors\n", __func__); |
1694 | 1698 | ||
1695 | cpufreq_suspended = false; | ||
1696 | |||
1697 | list_for_each_entry(policy, &cpufreq_policy_list, policy_list) { | 1699 | list_for_each_entry(policy, &cpufreq_policy_list, policy_list) { |
1698 | if (cpufreq_driver->resume && cpufreq_driver->resume(policy)) | 1700 | if (cpufreq_driver->resume && cpufreq_driver->resume(policy)) |
1699 | pr_err("%s: Failed to resume driver: %p\n", __func__, | 1701 | pr_err("%s: Failed to resume driver: %p\n", __func__, |
diff --git a/drivers/dma/omap-dma.c b/drivers/dma/omap-dma.c index 4cf7d9a950d7..bbea8243f9e8 100644 --- a/drivers/dma/omap-dma.c +++ b/drivers/dma/omap-dma.c | |||
@@ -1017,6 +1017,11 @@ static int omap_dma_resume(struct omap_chan *c) | |||
1017 | return -EINVAL; | 1017 | return -EINVAL; |
1018 | 1018 | ||
1019 | if (c->paused) { | 1019 | if (c->paused) { |
1020 | mb(); | ||
1021 | |||
1022 | /* Restore channel link register */ | ||
1023 | omap_dma_chan_write(c, CLNK_CTRL, c->desc->clnk_ctrl); | ||
1024 | |||
1020 | omap_dma_start(c, c->desc); | 1025 | omap_dma_start(c, c->desc); |
1021 | c->paused = false; | 1026 | c->paused = false; |
1022 | } | 1027 | } |
diff --git a/drivers/firmware/efi/Makefile b/drivers/firmware/efi/Makefile index d8be608a9f3b..aef6a95adef5 100644 --- a/drivers/firmware/efi/Makefile +++ b/drivers/firmware/efi/Makefile | |||
@@ -7,4 +7,4 @@ obj-$(CONFIG_EFI_VARS_PSTORE) += efi-pstore.o | |||
7 | obj-$(CONFIG_UEFI_CPER) += cper.o | 7 | obj-$(CONFIG_UEFI_CPER) += cper.o |
8 | obj-$(CONFIG_EFI_RUNTIME_MAP) += runtime-map.o | 8 | obj-$(CONFIG_EFI_RUNTIME_MAP) += runtime-map.o |
9 | obj-$(CONFIG_EFI_RUNTIME_WRAPPERS) += runtime-wrappers.o | 9 | obj-$(CONFIG_EFI_RUNTIME_WRAPPERS) += runtime-wrappers.o |
10 | obj-$(CONFIG_EFI_STUB) += libstub/ | 10 | obj-$(CONFIG_EFI_ARM_STUB) += libstub/ |
diff --git a/drivers/gpio/gpiolib-acpi.c b/drivers/gpio/gpiolib-acpi.c index d62eaaa75397..687476fb39e3 100644 --- a/drivers/gpio/gpiolib-acpi.c +++ b/drivers/gpio/gpiolib-acpi.c | |||
@@ -377,8 +377,10 @@ acpi_gpio_adr_space_handler(u32 function, acpi_physical_address address, | |||
377 | struct gpio_chip *chip = achip->chip; | 377 | struct gpio_chip *chip = achip->chip; |
378 | struct acpi_resource_gpio *agpio; | 378 | struct acpi_resource_gpio *agpio; |
379 | struct acpi_resource *ares; | 379 | struct acpi_resource *ares; |
380 | int pin_index = (int)address; | ||
380 | acpi_status status; | 381 | acpi_status status; |
381 | bool pull_up; | 382 | bool pull_up; |
383 | int length; | ||
382 | int i; | 384 | int i; |
383 | 385 | ||
384 | status = acpi_buffer_to_resource(achip->conn_info.connection, | 386 | status = acpi_buffer_to_resource(achip->conn_info.connection, |
@@ -400,7 +402,8 @@ acpi_gpio_adr_space_handler(u32 function, acpi_physical_address address, | |||
400 | return AE_BAD_PARAMETER; | 402 | return AE_BAD_PARAMETER; |
401 | } | 403 | } |
402 | 404 | ||
403 | for (i = 0; i < agpio->pin_table_length; i++) { | 405 | length = min(agpio->pin_table_length, (u16)(pin_index + bits)); |
406 | for (i = pin_index; i < length; ++i) { | ||
404 | unsigned pin = agpio->pin_table[i]; | 407 | unsigned pin = agpio->pin_table[i]; |
405 | struct acpi_gpio_connection *conn; | 408 | struct acpi_gpio_connection *conn; |
406 | struct gpio_desc *desc; | 409 | struct gpio_desc *desc; |
diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c index 15cc0bb65dda..c68d037de656 100644 --- a/drivers/gpio/gpiolib.c +++ b/drivers/gpio/gpiolib.c | |||
@@ -413,12 +413,12 @@ void gpiochip_set_chained_irqchip(struct gpio_chip *gpiochip, | |||
413 | return; | 413 | return; |
414 | } | 414 | } |
415 | 415 | ||
416 | irq_set_chained_handler(parent_irq, parent_handler); | ||
417 | /* | 416 | /* |
418 | * The parent irqchip is already using the chip_data for this | 417 | * The parent irqchip is already using the chip_data for this |
419 | * irqchip, so our callbacks simply use the handler_data. | 418 | * irqchip, so our callbacks simply use the handler_data. |
420 | */ | 419 | */ |
421 | irq_set_handler_data(parent_irq, gpiochip); | 420 | irq_set_handler_data(parent_irq, gpiochip); |
421 | irq_set_chained_handler(parent_irq, parent_handler); | ||
422 | } | 422 | } |
423 | EXPORT_SYMBOL_GPL(gpiochip_set_chained_irqchip); | 423 | EXPORT_SYMBOL_GPL(gpiochip_set_chained_irqchip); |
424 | 424 | ||
@@ -1674,7 +1674,7 @@ struct gpio_desc *__must_check __gpiod_get_index(struct device *dev, | |||
1674 | set_bit(FLAG_OPEN_SOURCE, &desc->flags); | 1674 | set_bit(FLAG_OPEN_SOURCE, &desc->flags); |
1675 | 1675 | ||
1676 | /* No particular flag request, return here... */ | 1676 | /* No particular flag request, return here... */ |
1677 | if (flags & GPIOD_FLAGS_BIT_DIR_SET) | 1677 | if (!(flags & GPIOD_FLAGS_BIT_DIR_SET)) |
1678 | return desc; | 1678 | return desc; |
1679 | 1679 | ||
1680 | /* Process flags */ | 1680 | /* Process flags */ |
diff --git a/drivers/gpu/drm/i915/i915_cmd_parser.c b/drivers/gpu/drm/i915/i915_cmd_parser.c index dea99d92fb4a..4b7ed5289217 100644 --- a/drivers/gpu/drm/i915/i915_cmd_parser.c +++ b/drivers/gpu/drm/i915/i915_cmd_parser.c | |||
@@ -709,11 +709,13 @@ int i915_cmd_parser_init_ring(struct intel_engine_cs *ring) | |||
709 | BUG_ON(!validate_cmds_sorted(ring, cmd_tables, cmd_table_count)); | 709 | BUG_ON(!validate_cmds_sorted(ring, cmd_tables, cmd_table_count)); |
710 | BUG_ON(!validate_regs_sorted(ring)); | 710 | BUG_ON(!validate_regs_sorted(ring)); |
711 | 711 | ||
712 | ret = init_hash_table(ring, cmd_tables, cmd_table_count); | 712 | if (hash_empty(ring->cmd_hash)) { |
713 | if (ret) { | 713 | ret = init_hash_table(ring, cmd_tables, cmd_table_count); |
714 | DRM_ERROR("CMD: cmd_parser_init failed!\n"); | 714 | if (ret) { |
715 | fini_hash_table(ring); | 715 | DRM_ERROR("CMD: cmd_parser_init failed!\n"); |
716 | return ret; | 716 | fini_hash_table(ring); |
717 | return ret; | ||
718 | } | ||
717 | } | 719 | } |
718 | 720 | ||
719 | ring->needs_cmd_parser = true; | 721 | ring->needs_cmd_parser = true; |
diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c index ca34de7f6a7b..5a9de21637b7 100644 --- a/drivers/gpu/drm/i915/intel_hdmi.c +++ b/drivers/gpu/drm/i915/intel_hdmi.c | |||
@@ -732,7 +732,7 @@ static void intel_hdmi_get_config(struct intel_encoder *encoder, | |||
732 | if (tmp & HDMI_MODE_SELECT_HDMI) | 732 | if (tmp & HDMI_MODE_SELECT_HDMI) |
733 | pipe_config->has_hdmi_sink = true; | 733 | pipe_config->has_hdmi_sink = true; |
734 | 734 | ||
735 | if (tmp & HDMI_MODE_SELECT_HDMI) | 735 | if (tmp & SDVO_AUDIO_ENABLE) |
736 | pipe_config->has_audio = true; | 736 | pipe_config->has_audio = true; |
737 | 737 | ||
738 | if (!HAS_PCH_SPLIT(dev) && | 738 | if (!HAS_PCH_SPLIT(dev) && |
diff --git a/drivers/gpu/drm/radeon/cik.c b/drivers/gpu/drm/radeon/cik.c index fa9565957f9d..3d546c606b43 100644 --- a/drivers/gpu/drm/radeon/cik.c +++ b/drivers/gpu/drm/radeon/cik.c | |||
@@ -4803,7 +4803,7 @@ struct bonaire_mqd | |||
4803 | */ | 4803 | */ |
4804 | static int cik_cp_compute_resume(struct radeon_device *rdev) | 4804 | static int cik_cp_compute_resume(struct radeon_device *rdev) |
4805 | { | 4805 | { |
4806 | int r, i, idx; | 4806 | int r, i, j, idx; |
4807 | u32 tmp; | 4807 | u32 tmp; |
4808 | bool use_doorbell = true; | 4808 | bool use_doorbell = true; |
4809 | u64 hqd_gpu_addr; | 4809 | u64 hqd_gpu_addr; |
@@ -4922,7 +4922,7 @@ static int cik_cp_compute_resume(struct radeon_device *rdev) | |||
4922 | mqd->queue_state.cp_hqd_pq_wptr= 0; | 4922 | mqd->queue_state.cp_hqd_pq_wptr= 0; |
4923 | if (RREG32(CP_HQD_ACTIVE) & 1) { | 4923 | if (RREG32(CP_HQD_ACTIVE) & 1) { |
4924 | WREG32(CP_HQD_DEQUEUE_REQUEST, 1); | 4924 | WREG32(CP_HQD_DEQUEUE_REQUEST, 1); |
4925 | for (i = 0; i < rdev->usec_timeout; i++) { | 4925 | for (j = 0; j < rdev->usec_timeout; j++) { |
4926 | if (!(RREG32(CP_HQD_ACTIVE) & 1)) | 4926 | if (!(RREG32(CP_HQD_ACTIVE) & 1)) |
4927 | break; | 4927 | break; |
4928 | udelay(1); | 4928 | udelay(1); |
@@ -7751,17 +7751,17 @@ static inline u32 cik_get_ih_wptr(struct radeon_device *rdev) | |||
7751 | wptr = RREG32(IH_RB_WPTR); | 7751 | wptr = RREG32(IH_RB_WPTR); |
7752 | 7752 | ||
7753 | if (wptr & RB_OVERFLOW) { | 7753 | if (wptr & RB_OVERFLOW) { |
7754 | wptr &= ~RB_OVERFLOW; | ||
7754 | /* When a ring buffer overflow happen start parsing interrupt | 7755 | /* When a ring buffer overflow happen start parsing interrupt |
7755 | * from the last not overwritten vector (wptr + 16). Hopefully | 7756 | * from the last not overwritten vector (wptr + 16). Hopefully |
7756 | * this should allow us to catchup. | 7757 | * this should allow us to catchup. |
7757 | */ | 7758 | */ |
7758 | dev_warn(rdev->dev, "IH ring buffer overflow (0x%08X, %d, %d)\n", | 7759 | dev_warn(rdev->dev, "IH ring buffer overflow (0x%08X, 0x%08X, 0x%08X)\n", |
7759 | wptr, rdev->ih.rptr, (wptr + 16) + rdev->ih.ptr_mask); | 7760 | wptr, rdev->ih.rptr, (wptr + 16) & rdev->ih.ptr_mask); |
7760 | rdev->ih.rptr = (wptr + 16) & rdev->ih.ptr_mask; | 7761 | rdev->ih.rptr = (wptr + 16) & rdev->ih.ptr_mask; |
7761 | tmp = RREG32(IH_RB_CNTL); | 7762 | tmp = RREG32(IH_RB_CNTL); |
7762 | tmp |= IH_WPTR_OVERFLOW_CLEAR; | 7763 | tmp |= IH_WPTR_OVERFLOW_CLEAR; |
7763 | WREG32(IH_RB_CNTL, tmp); | 7764 | WREG32(IH_RB_CNTL, tmp); |
7764 | wptr &= ~RB_OVERFLOW; | ||
7765 | } | 7765 | } |
7766 | return (wptr & rdev->ih.ptr_mask); | 7766 | return (wptr & rdev->ih.ptr_mask); |
7767 | } | 7767 | } |
@@ -8251,6 +8251,7 @@ restart_ih: | |||
8251 | /* wptr/rptr are in bytes! */ | 8251 | /* wptr/rptr are in bytes! */ |
8252 | rptr += 16; | 8252 | rptr += 16; |
8253 | rptr &= rdev->ih.ptr_mask; | 8253 | rptr &= rdev->ih.ptr_mask; |
8254 | WREG32(IH_RB_RPTR, rptr); | ||
8254 | } | 8255 | } |
8255 | if (queue_hotplug) | 8256 | if (queue_hotplug) |
8256 | schedule_work(&rdev->hotplug_work); | 8257 | schedule_work(&rdev->hotplug_work); |
@@ -8259,7 +8260,6 @@ restart_ih: | |||
8259 | if (queue_thermal) | 8260 | if (queue_thermal) |
8260 | schedule_work(&rdev->pm.dpm.thermal.work); | 8261 | schedule_work(&rdev->pm.dpm.thermal.work); |
8261 | rdev->ih.rptr = rptr; | 8262 | rdev->ih.rptr = rptr; |
8262 | WREG32(IH_RB_RPTR, rdev->ih.rptr); | ||
8263 | atomic_set(&rdev->ih.lock, 0); | 8263 | atomic_set(&rdev->ih.lock, 0); |
8264 | 8264 | ||
8265 | /* make sure wptr hasn't changed while processing */ | 8265 | /* make sure wptr hasn't changed while processing */ |
diff --git a/drivers/gpu/drm/radeon/evergreen.c b/drivers/gpu/drm/radeon/evergreen.c index dbca60c7d097..e50807c29f69 100644 --- a/drivers/gpu/drm/radeon/evergreen.c +++ b/drivers/gpu/drm/radeon/evergreen.c | |||
@@ -4749,17 +4749,17 @@ static u32 evergreen_get_ih_wptr(struct radeon_device *rdev) | |||
4749 | wptr = RREG32(IH_RB_WPTR); | 4749 | wptr = RREG32(IH_RB_WPTR); |
4750 | 4750 | ||
4751 | if (wptr & RB_OVERFLOW) { | 4751 | if (wptr & RB_OVERFLOW) { |
4752 | wptr &= ~RB_OVERFLOW; | ||
4752 | /* When a ring buffer overflow happen start parsing interrupt | 4753 | /* When a ring buffer overflow happen start parsing interrupt |
4753 | * from the last not overwritten vector (wptr + 16). Hopefully | 4754 | * from the last not overwritten vector (wptr + 16). Hopefully |
4754 | * this should allow us to catchup. | 4755 | * this should allow us to catchup. |
4755 | */ | 4756 | */ |
4756 | dev_warn(rdev->dev, "IH ring buffer overflow (0x%08X, %d, %d)\n", | 4757 | dev_warn(rdev->dev, "IH ring buffer overflow (0x%08X, 0x%08X, 0x%08X)\n", |
4757 | wptr, rdev->ih.rptr, (wptr + 16) + rdev->ih.ptr_mask); | 4758 | wptr, rdev->ih.rptr, (wptr + 16) & rdev->ih.ptr_mask); |
4758 | rdev->ih.rptr = (wptr + 16) & rdev->ih.ptr_mask; | 4759 | rdev->ih.rptr = (wptr + 16) & rdev->ih.ptr_mask; |
4759 | tmp = RREG32(IH_RB_CNTL); | 4760 | tmp = RREG32(IH_RB_CNTL); |
4760 | tmp |= IH_WPTR_OVERFLOW_CLEAR; | 4761 | tmp |= IH_WPTR_OVERFLOW_CLEAR; |
4761 | WREG32(IH_RB_CNTL, tmp); | 4762 | WREG32(IH_RB_CNTL, tmp); |
4762 | wptr &= ~RB_OVERFLOW; | ||
4763 | } | 4763 | } |
4764 | return (wptr & rdev->ih.ptr_mask); | 4764 | return (wptr & rdev->ih.ptr_mask); |
4765 | } | 4765 | } |
@@ -5137,6 +5137,7 @@ restart_ih: | |||
5137 | /* wptr/rptr are in bytes! */ | 5137 | /* wptr/rptr are in bytes! */ |
5138 | rptr += 16; | 5138 | rptr += 16; |
5139 | rptr &= rdev->ih.ptr_mask; | 5139 | rptr &= rdev->ih.ptr_mask; |
5140 | WREG32(IH_RB_RPTR, rptr); | ||
5140 | } | 5141 | } |
5141 | if (queue_hotplug) | 5142 | if (queue_hotplug) |
5142 | schedule_work(&rdev->hotplug_work); | 5143 | schedule_work(&rdev->hotplug_work); |
@@ -5145,7 +5146,6 @@ restart_ih: | |||
5145 | if (queue_thermal && rdev->pm.dpm_enabled) | 5146 | if (queue_thermal && rdev->pm.dpm_enabled) |
5146 | schedule_work(&rdev->pm.dpm.thermal.work); | 5147 | schedule_work(&rdev->pm.dpm.thermal.work); |
5147 | rdev->ih.rptr = rptr; | 5148 | rdev->ih.rptr = rptr; |
5148 | WREG32(IH_RB_RPTR, rdev->ih.rptr); | ||
5149 | atomic_set(&rdev->ih.lock, 0); | 5149 | atomic_set(&rdev->ih.lock, 0); |
5150 | 5150 | ||
5151 | /* make sure wptr hasn't changed while processing */ | 5151 | /* make sure wptr hasn't changed while processing */ |
diff --git a/drivers/gpu/drm/radeon/r600.c b/drivers/gpu/drm/radeon/r600.c index 3cfb50056f7a..ea5c9af722ef 100644 --- a/drivers/gpu/drm/radeon/r600.c +++ b/drivers/gpu/drm/radeon/r600.c | |||
@@ -3792,17 +3792,17 @@ static u32 r600_get_ih_wptr(struct radeon_device *rdev) | |||
3792 | wptr = RREG32(IH_RB_WPTR); | 3792 | wptr = RREG32(IH_RB_WPTR); |
3793 | 3793 | ||
3794 | if (wptr & RB_OVERFLOW) { | 3794 | if (wptr & RB_OVERFLOW) { |
3795 | wptr &= ~RB_OVERFLOW; | ||
3795 | /* When a ring buffer overflow happen start parsing interrupt | 3796 | /* When a ring buffer overflow happen start parsing interrupt |
3796 | * from the last not overwritten vector (wptr + 16). Hopefully | 3797 | * from the last not overwritten vector (wptr + 16). Hopefully |
3797 | * this should allow us to catchup. | 3798 | * this should allow us to catchup. |
3798 | */ | 3799 | */ |
3799 | dev_warn(rdev->dev, "IH ring buffer overflow (0x%08X, %d, %d)\n", | 3800 | dev_warn(rdev->dev, "IH ring buffer overflow (0x%08X, 0x%08X, 0x%08X)\n", |
3800 | wptr, rdev->ih.rptr, (wptr + 16) + rdev->ih.ptr_mask); | 3801 | wptr, rdev->ih.rptr, (wptr + 16) & rdev->ih.ptr_mask); |
3801 | rdev->ih.rptr = (wptr + 16) & rdev->ih.ptr_mask; | 3802 | rdev->ih.rptr = (wptr + 16) & rdev->ih.ptr_mask; |
3802 | tmp = RREG32(IH_RB_CNTL); | 3803 | tmp = RREG32(IH_RB_CNTL); |
3803 | tmp |= IH_WPTR_OVERFLOW_CLEAR; | 3804 | tmp |= IH_WPTR_OVERFLOW_CLEAR; |
3804 | WREG32(IH_RB_CNTL, tmp); | 3805 | WREG32(IH_RB_CNTL, tmp); |
3805 | wptr &= ~RB_OVERFLOW; | ||
3806 | } | 3806 | } |
3807 | return (wptr & rdev->ih.ptr_mask); | 3807 | return (wptr & rdev->ih.ptr_mask); |
3808 | } | 3808 | } |
@@ -4048,6 +4048,7 @@ restart_ih: | |||
4048 | /* wptr/rptr are in bytes! */ | 4048 | /* wptr/rptr are in bytes! */ |
4049 | rptr += 16; | 4049 | rptr += 16; |
4050 | rptr &= rdev->ih.ptr_mask; | 4050 | rptr &= rdev->ih.ptr_mask; |
4051 | WREG32(IH_RB_RPTR, rptr); | ||
4051 | } | 4052 | } |
4052 | if (queue_hotplug) | 4053 | if (queue_hotplug) |
4053 | schedule_work(&rdev->hotplug_work); | 4054 | schedule_work(&rdev->hotplug_work); |
@@ -4056,7 +4057,6 @@ restart_ih: | |||
4056 | if (queue_thermal && rdev->pm.dpm_enabled) | 4057 | if (queue_thermal && rdev->pm.dpm_enabled) |
4057 | schedule_work(&rdev->pm.dpm.thermal.work); | 4058 | schedule_work(&rdev->pm.dpm.thermal.work); |
4058 | rdev->ih.rptr = rptr; | 4059 | rdev->ih.rptr = rptr; |
4059 | WREG32(IH_RB_RPTR, rdev->ih.rptr); | ||
4060 | atomic_set(&rdev->ih.lock, 0); | 4060 | atomic_set(&rdev->ih.lock, 0); |
4061 | 4061 | ||
4062 | /* make sure wptr hasn't changed while processing */ | 4062 | /* make sure wptr hasn't changed while processing */ |
diff --git a/drivers/gpu/drm/radeon/radeon.h b/drivers/gpu/drm/radeon/radeon.h index 5f05b4c84338..3247bfd14410 100644 --- a/drivers/gpu/drm/radeon/radeon.h +++ b/drivers/gpu/drm/radeon/radeon.h | |||
@@ -106,6 +106,7 @@ extern int radeon_vm_block_size; | |||
106 | extern int radeon_deep_color; | 106 | extern int radeon_deep_color; |
107 | extern int radeon_use_pflipirq; | 107 | extern int radeon_use_pflipirq; |
108 | extern int radeon_bapm; | 108 | extern int radeon_bapm; |
109 | extern int radeon_backlight; | ||
109 | 110 | ||
110 | /* | 111 | /* |
111 | * Copy from radeon_drv.h so we don't have to include both and have conflicting | 112 | * Copy from radeon_drv.h so we don't have to include both and have conflicting |
diff --git a/drivers/gpu/drm/radeon/radeon_device.c b/drivers/gpu/drm/radeon/radeon_device.c index 75223dd3a8a3..12c8329644c4 100644 --- a/drivers/gpu/drm/radeon/radeon_device.c +++ b/drivers/gpu/drm/radeon/radeon_device.c | |||
@@ -123,6 +123,10 @@ static struct radeon_px_quirk radeon_px_quirk_list[] = { | |||
123 | * https://bugzilla.kernel.org/show_bug.cgi?id=51381 | 123 | * https://bugzilla.kernel.org/show_bug.cgi?id=51381 |
124 | */ | 124 | */ |
125 | { PCI_VENDOR_ID_ATI, 0x6741, 0x1043, 0x108c, RADEON_PX_QUIRK_DISABLE_PX }, | 125 | { PCI_VENDOR_ID_ATI, 0x6741, 0x1043, 0x108c, RADEON_PX_QUIRK_DISABLE_PX }, |
126 | /* Asus K53TK laptop with AMD A6-3420M APU and Radeon 7670m GPU | ||
127 | * https://bugzilla.kernel.org/show_bug.cgi?id=51381 | ||
128 | */ | ||
129 | { PCI_VENDOR_ID_ATI, 0x6840, 0x1043, 0x2122, RADEON_PX_QUIRK_DISABLE_PX }, | ||
126 | /* macbook pro 8.2 */ | 130 | /* macbook pro 8.2 */ |
127 | { PCI_VENDOR_ID_ATI, 0x6741, PCI_VENDOR_ID_APPLE, 0x00e2, RADEON_PX_QUIRK_LONG_WAKEUP }, | 131 | { PCI_VENDOR_ID_ATI, 0x6741, PCI_VENDOR_ID_APPLE, 0x00e2, RADEON_PX_QUIRK_LONG_WAKEUP }, |
128 | { 0, 0, 0, 0, 0 }, | 132 | { 0, 0, 0, 0, 0 }, |
diff --git a/drivers/gpu/drm/radeon/radeon_drv.c b/drivers/gpu/drm/radeon/radeon_drv.c index 4126fd0937a2..f9d17b29b343 100644 --- a/drivers/gpu/drm/radeon/radeon_drv.c +++ b/drivers/gpu/drm/radeon/radeon_drv.c | |||
@@ -181,6 +181,7 @@ int radeon_vm_block_size = -1; | |||
181 | int radeon_deep_color = 0; | 181 | int radeon_deep_color = 0; |
182 | int radeon_use_pflipirq = 2; | 182 | int radeon_use_pflipirq = 2; |
183 | int radeon_bapm = -1; | 183 | int radeon_bapm = -1; |
184 | int radeon_backlight = -1; | ||
184 | 185 | ||
185 | MODULE_PARM_DESC(no_wb, "Disable AGP writeback for scratch registers"); | 186 | MODULE_PARM_DESC(no_wb, "Disable AGP writeback for scratch registers"); |
186 | module_param_named(no_wb, radeon_no_wb, int, 0444); | 187 | module_param_named(no_wb, radeon_no_wb, int, 0444); |
@@ -263,6 +264,9 @@ module_param_named(use_pflipirq, radeon_use_pflipirq, int, 0444); | |||
263 | MODULE_PARM_DESC(bapm, "BAPM support (1 = enable, 0 = disable, -1 = auto)"); | 264 | MODULE_PARM_DESC(bapm, "BAPM support (1 = enable, 0 = disable, -1 = auto)"); |
264 | module_param_named(bapm, radeon_bapm, int, 0444); | 265 | module_param_named(bapm, radeon_bapm, int, 0444); |
265 | 266 | ||
267 | MODULE_PARM_DESC(backlight, "backlight support (1 = enable, 0 = disable, -1 = auto)"); | ||
268 | module_param_named(backlight, radeon_backlight, int, 0444); | ||
269 | |||
266 | static struct pci_device_id pciidlist[] = { | 270 | static struct pci_device_id pciidlist[] = { |
267 | radeon_PCI_IDS | 271 | radeon_PCI_IDS |
268 | }; | 272 | }; |
diff --git a/drivers/gpu/drm/radeon/radeon_encoders.c b/drivers/gpu/drm/radeon/radeon_encoders.c index 3c2094c25b53..15edf23b465c 100644 --- a/drivers/gpu/drm/radeon/radeon_encoders.c +++ b/drivers/gpu/drm/radeon/radeon_encoders.c | |||
@@ -158,10 +158,43 @@ radeon_get_encoder_enum(struct drm_device *dev, uint32_t supported_device, uint8 | |||
158 | return ret; | 158 | return ret; |
159 | } | 159 | } |
160 | 160 | ||
161 | static void radeon_encoder_add_backlight(struct radeon_encoder *radeon_encoder, | ||
162 | struct drm_connector *connector) | ||
163 | { | ||
164 | struct drm_device *dev = radeon_encoder->base.dev; | ||
165 | struct radeon_device *rdev = dev->dev_private; | ||
166 | bool use_bl = false; | ||
167 | |||
168 | if (!(radeon_encoder->devices & (ATOM_DEVICE_LCD_SUPPORT))) | ||
169 | return; | ||
170 | |||
171 | if (radeon_backlight == 0) { | ||
172 | return; | ||
173 | } else if (radeon_backlight == 1) { | ||
174 | use_bl = true; | ||
175 | } else if (radeon_backlight == -1) { | ||
176 | /* Quirks */ | ||
177 | /* Amilo Xi 2550 only works with acpi bl */ | ||
178 | if ((rdev->pdev->device == 0x9583) && | ||
179 | (rdev->pdev->subsystem_vendor == 0x1734) && | ||
180 | (rdev->pdev->subsystem_device == 0x1107)) | ||
181 | use_bl = false; | ||
182 | else | ||
183 | use_bl = true; | ||
184 | } | ||
185 | |||
186 | if (use_bl) { | ||
187 | if (rdev->is_atom_bios) | ||
188 | radeon_atom_backlight_init(radeon_encoder, connector); | ||
189 | else | ||
190 | radeon_legacy_backlight_init(radeon_encoder, connector); | ||
191 | rdev->mode_info.bl_encoder = radeon_encoder; | ||
192 | } | ||
193 | } | ||
194 | |||
161 | void | 195 | void |
162 | radeon_link_encoder_connector(struct drm_device *dev) | 196 | radeon_link_encoder_connector(struct drm_device *dev) |
163 | { | 197 | { |
164 | struct radeon_device *rdev = dev->dev_private; | ||
165 | struct drm_connector *connector; | 198 | struct drm_connector *connector; |
166 | struct radeon_connector *radeon_connector; | 199 | struct radeon_connector *radeon_connector; |
167 | struct drm_encoder *encoder; | 200 | struct drm_encoder *encoder; |
@@ -174,13 +207,8 @@ radeon_link_encoder_connector(struct drm_device *dev) | |||
174 | radeon_encoder = to_radeon_encoder(encoder); | 207 | radeon_encoder = to_radeon_encoder(encoder); |
175 | if (radeon_encoder->devices & radeon_connector->devices) { | 208 | if (radeon_encoder->devices & radeon_connector->devices) { |
176 | drm_mode_connector_attach_encoder(connector, encoder); | 209 | drm_mode_connector_attach_encoder(connector, encoder); |
177 | if (radeon_encoder->devices & (ATOM_DEVICE_LCD_SUPPORT)) { | 210 | if (radeon_encoder->devices & (ATOM_DEVICE_LCD_SUPPORT)) |
178 | if (rdev->is_atom_bios) | 211 | radeon_encoder_add_backlight(radeon_encoder, connector); |
179 | radeon_atom_backlight_init(radeon_encoder, connector); | ||
180 | else | ||
181 | radeon_legacy_backlight_init(radeon_encoder, connector); | ||
182 | rdev->mode_info.bl_encoder = radeon_encoder; | ||
183 | } | ||
184 | } | 212 | } |
185 | } | 213 | } |
186 | } | 214 | } |
diff --git a/drivers/gpu/drm/radeon/si.c b/drivers/gpu/drm/radeon/si.c index 6bce40847753..3a0b973e8a96 100644 --- a/drivers/gpu/drm/radeon/si.c +++ b/drivers/gpu/drm/radeon/si.c | |||
@@ -6316,17 +6316,17 @@ static inline u32 si_get_ih_wptr(struct radeon_device *rdev) | |||
6316 | wptr = RREG32(IH_RB_WPTR); | 6316 | wptr = RREG32(IH_RB_WPTR); |
6317 | 6317 | ||
6318 | if (wptr & RB_OVERFLOW) { | 6318 | if (wptr & RB_OVERFLOW) { |
6319 | wptr &= ~RB_OVERFLOW; | ||
6319 | /* When a ring buffer overflow happen start parsing interrupt | 6320 | /* When a ring buffer overflow happen start parsing interrupt |
6320 | * from the last not overwritten vector (wptr + 16). Hopefully | 6321 | * from the last not overwritten vector (wptr + 16). Hopefully |
6321 | * this should allow us to catchup. | 6322 | * this should allow us to catchup. |
6322 | */ | 6323 | */ |
6323 | dev_warn(rdev->dev, "IH ring buffer overflow (0x%08X, %d, %d)\n", | 6324 | dev_warn(rdev->dev, "IH ring buffer overflow (0x%08X, 0x%08X, 0x%08X)\n", |
6324 | wptr, rdev->ih.rptr, (wptr + 16) + rdev->ih.ptr_mask); | 6325 | wptr, rdev->ih.rptr, (wptr + 16) & rdev->ih.ptr_mask); |
6325 | rdev->ih.rptr = (wptr + 16) & rdev->ih.ptr_mask; | 6326 | rdev->ih.rptr = (wptr + 16) & rdev->ih.ptr_mask; |
6326 | tmp = RREG32(IH_RB_CNTL); | 6327 | tmp = RREG32(IH_RB_CNTL); |
6327 | tmp |= IH_WPTR_OVERFLOW_CLEAR; | 6328 | tmp |= IH_WPTR_OVERFLOW_CLEAR; |
6328 | WREG32(IH_RB_CNTL, tmp); | 6329 | WREG32(IH_RB_CNTL, tmp); |
6329 | wptr &= ~RB_OVERFLOW; | ||
6330 | } | 6330 | } |
6331 | return (wptr & rdev->ih.ptr_mask); | 6331 | return (wptr & rdev->ih.ptr_mask); |
6332 | } | 6332 | } |
@@ -6664,13 +6664,13 @@ restart_ih: | |||
6664 | /* wptr/rptr are in bytes! */ | 6664 | /* wptr/rptr are in bytes! */ |
6665 | rptr += 16; | 6665 | rptr += 16; |
6666 | rptr &= rdev->ih.ptr_mask; | 6666 | rptr &= rdev->ih.ptr_mask; |
6667 | WREG32(IH_RB_RPTR, rptr); | ||
6667 | } | 6668 | } |
6668 | if (queue_hotplug) | 6669 | if (queue_hotplug) |
6669 | schedule_work(&rdev->hotplug_work); | 6670 | schedule_work(&rdev->hotplug_work); |
6670 | if (queue_thermal && rdev->pm.dpm_enabled) | 6671 | if (queue_thermal && rdev->pm.dpm_enabled) |
6671 | schedule_work(&rdev->pm.dpm.thermal.work); | 6672 | schedule_work(&rdev->pm.dpm.thermal.work); |
6672 | rdev->ih.rptr = rptr; | 6673 | rdev->ih.rptr = rptr; |
6673 | WREG32(IH_RB_RPTR, rdev->ih.rptr); | ||
6674 | atomic_set(&rdev->ih.lock, 0); | 6674 | atomic_set(&rdev->ih.lock, 0); |
6675 | 6675 | ||
6676 | /* make sure wptr hasn't changed while processing */ | 6676 | /* make sure wptr hasn't changed while processing */ |
diff --git a/drivers/i2c/Makefile b/drivers/i2c/Makefile index e0228b228256..1722f50f2473 100644 --- a/drivers/i2c/Makefile +++ b/drivers/i2c/Makefile | |||
@@ -2,11 +2,8 @@ | |||
2 | # Makefile for the i2c core. | 2 | # Makefile for the i2c core. |
3 | # | 3 | # |
4 | 4 | ||
5 | i2ccore-y := i2c-core.o | ||
6 | i2ccore-$(CONFIG_ACPI) += i2c-acpi.o | ||
7 | |||
8 | obj-$(CONFIG_I2C_BOARDINFO) += i2c-boardinfo.o | 5 | obj-$(CONFIG_I2C_BOARDINFO) += i2c-boardinfo.o |
9 | obj-$(CONFIG_I2C) += i2ccore.o | 6 | obj-$(CONFIG_I2C) += i2c-core.o |
10 | obj-$(CONFIG_I2C_SMBUS) += i2c-smbus.o | 7 | obj-$(CONFIG_I2C_SMBUS) += i2c-smbus.o |
11 | obj-$(CONFIG_I2C_CHARDEV) += i2c-dev.o | 8 | obj-$(CONFIG_I2C_CHARDEV) += i2c-dev.o |
12 | obj-$(CONFIG_I2C_MUX) += i2c-mux.o | 9 | obj-$(CONFIG_I2C_MUX) += i2c-mux.o |
diff --git a/drivers/i2c/busses/i2c-ismt.c b/drivers/i2c/busses/i2c-ismt.c index 984492553e95..d9ee43c80cde 100644 --- a/drivers/i2c/busses/i2c-ismt.c +++ b/drivers/i2c/busses/i2c-ismt.c | |||
@@ -497,7 +497,7 @@ static int ismt_access(struct i2c_adapter *adap, u16 addr, | |||
497 | desc->wr_len_cmd = dma_size; | 497 | desc->wr_len_cmd = dma_size; |
498 | desc->control |= ISMT_DESC_BLK; | 498 | desc->control |= ISMT_DESC_BLK; |
499 | priv->dma_buffer[0] = command; | 499 | priv->dma_buffer[0] = command; |
500 | memcpy(&priv->dma_buffer[1], &data->block[1], dma_size); | 500 | memcpy(&priv->dma_buffer[1], &data->block[1], dma_size - 1); |
501 | } else { | 501 | } else { |
502 | /* Block Read */ | 502 | /* Block Read */ |
503 | dev_dbg(dev, "I2C_SMBUS_BLOCK_DATA: READ\n"); | 503 | dev_dbg(dev, "I2C_SMBUS_BLOCK_DATA: READ\n"); |
@@ -525,7 +525,7 @@ static int ismt_access(struct i2c_adapter *adap, u16 addr, | |||
525 | desc->wr_len_cmd = dma_size; | 525 | desc->wr_len_cmd = dma_size; |
526 | desc->control |= ISMT_DESC_I2C; | 526 | desc->control |= ISMT_DESC_I2C; |
527 | priv->dma_buffer[0] = command; | 527 | priv->dma_buffer[0] = command; |
528 | memcpy(&priv->dma_buffer[1], &data->block[1], dma_size); | 528 | memcpy(&priv->dma_buffer[1], &data->block[1], dma_size - 1); |
529 | } else { | 529 | } else { |
530 | /* i2c Block Read */ | 530 | /* i2c Block Read */ |
531 | dev_dbg(dev, "I2C_SMBUS_I2C_BLOCK_DATA: READ\n"); | 531 | dev_dbg(dev, "I2C_SMBUS_I2C_BLOCK_DATA: READ\n"); |
diff --git a/drivers/i2c/busses/i2c-mxs.c b/drivers/i2c/busses/i2c-mxs.c index 7170fc892829..65a21fed08b5 100644 --- a/drivers/i2c/busses/i2c-mxs.c +++ b/drivers/i2c/busses/i2c-mxs.c | |||
@@ -429,7 +429,7 @@ static int mxs_i2c_pio_setup_xfer(struct i2c_adapter *adap, | |||
429 | ret = mxs_i2c_pio_wait_xfer_end(i2c); | 429 | ret = mxs_i2c_pio_wait_xfer_end(i2c); |
430 | if (ret) { | 430 | if (ret) { |
431 | dev_err(i2c->dev, | 431 | dev_err(i2c->dev, |
432 | "PIO: Failed to send SELECT command!\n"); | 432 | "PIO: Failed to send READ command!\n"); |
433 | goto cleanup; | 433 | goto cleanup; |
434 | } | 434 | } |
435 | 435 | ||
diff --git a/drivers/i2c/busses/i2c-rcar.c b/drivers/i2c/busses/i2c-rcar.c index 1cc146cfc1f3..e506fcd3ca04 100644 --- a/drivers/i2c/busses/i2c-rcar.c +++ b/drivers/i2c/busses/i2c-rcar.c | |||
@@ -76,8 +76,8 @@ | |||
76 | #define RCAR_IRQ_RECV (MNR | MAL | MST | MAT | MDR) | 76 | #define RCAR_IRQ_RECV (MNR | MAL | MST | MAT | MDR) |
77 | #define RCAR_IRQ_STOP (MST) | 77 | #define RCAR_IRQ_STOP (MST) |
78 | 78 | ||
79 | #define RCAR_IRQ_ACK_SEND (~(MAT | MDE)) | 79 | #define RCAR_IRQ_ACK_SEND (~(MAT | MDE) & 0xFF) |
80 | #define RCAR_IRQ_ACK_RECV (~(MAT | MDR)) | 80 | #define RCAR_IRQ_ACK_RECV (~(MAT | MDR) & 0xFF) |
81 | 81 | ||
82 | #define ID_LAST_MSG (1 << 0) | 82 | #define ID_LAST_MSG (1 << 0) |
83 | #define ID_IOERROR (1 << 1) | 83 | #define ID_IOERROR (1 << 1) |
diff --git a/drivers/i2c/busses/i2c-rk3x.c b/drivers/i2c/busses/i2c-rk3x.c index e637c32ae517..93cfc837200b 100644 --- a/drivers/i2c/busses/i2c-rk3x.c +++ b/drivers/i2c/busses/i2c-rk3x.c | |||
@@ -433,12 +433,11 @@ static void rk3x_i2c_set_scl_rate(struct rk3x_i2c *i2c, unsigned long scl_rate) | |||
433 | unsigned long i2c_rate = clk_get_rate(i2c->clk); | 433 | unsigned long i2c_rate = clk_get_rate(i2c->clk); |
434 | unsigned int div; | 434 | unsigned int div; |
435 | 435 | ||
436 | /* SCL rate = (clk rate) / (8 * DIV) */ | 436 | /* set DIV = DIVH = DIVL |
437 | div = DIV_ROUND_UP(i2c_rate, scl_rate * 8); | 437 | * SCL rate = (clk rate) / (8 * (DIVH + 1 + DIVL + 1)) |
438 | 438 | * = (clk rate) / (16 * (DIV + 1)) | |
439 | /* The lower and upper half of the CLKDIV reg describe the length of | 439 | */ |
440 | * SCL low & high periods. */ | 440 | div = DIV_ROUND_UP(i2c_rate, scl_rate * 16) - 1; |
441 | div = DIV_ROUND_UP(div, 2); | ||
442 | 441 | ||
443 | i2c_writel(i2c, (div << 16) | (div & 0xffff), REG_CLKDIV); | 442 | i2c_writel(i2c, (div << 16) | (div & 0xffff), REG_CLKDIV); |
444 | } | 443 | } |
diff --git a/drivers/i2c/busses/i2c-tegra.c b/drivers/i2c/busses/i2c-tegra.c index 87d0371cebb7..efba1ebe16ba 100644 --- a/drivers/i2c/busses/i2c-tegra.c +++ b/drivers/i2c/busses/i2c-tegra.c | |||
@@ -380,34 +380,33 @@ static inline int tegra_i2c_clock_enable(struct tegra_i2c_dev *i2c_dev) | |||
380 | { | 380 | { |
381 | int ret; | 381 | int ret; |
382 | if (!i2c_dev->hw->has_single_clk_source) { | 382 | if (!i2c_dev->hw->has_single_clk_source) { |
383 | ret = clk_prepare_enable(i2c_dev->fast_clk); | 383 | ret = clk_enable(i2c_dev->fast_clk); |
384 | if (ret < 0) { | 384 | if (ret < 0) { |
385 | dev_err(i2c_dev->dev, | 385 | dev_err(i2c_dev->dev, |
386 | "Enabling fast clk failed, err %d\n", ret); | 386 | "Enabling fast clk failed, err %d\n", ret); |
387 | return ret; | 387 | return ret; |
388 | } | 388 | } |
389 | } | 389 | } |
390 | ret = clk_prepare_enable(i2c_dev->div_clk); | 390 | ret = clk_enable(i2c_dev->div_clk); |
391 | if (ret < 0) { | 391 | if (ret < 0) { |
392 | dev_err(i2c_dev->dev, | 392 | dev_err(i2c_dev->dev, |
393 | "Enabling div clk failed, err %d\n", ret); | 393 | "Enabling div clk failed, err %d\n", ret); |
394 | clk_disable_unprepare(i2c_dev->fast_clk); | 394 | clk_disable(i2c_dev->fast_clk); |
395 | } | 395 | } |
396 | return ret; | 396 | return ret; |
397 | } | 397 | } |
398 | 398 | ||
399 | static inline void tegra_i2c_clock_disable(struct tegra_i2c_dev *i2c_dev) | 399 | static inline void tegra_i2c_clock_disable(struct tegra_i2c_dev *i2c_dev) |
400 | { | 400 | { |
401 | clk_disable_unprepare(i2c_dev->div_clk); | 401 | clk_disable(i2c_dev->div_clk); |
402 | if (!i2c_dev->hw->has_single_clk_source) | 402 | if (!i2c_dev->hw->has_single_clk_source) |
403 | clk_disable_unprepare(i2c_dev->fast_clk); | 403 | clk_disable(i2c_dev->fast_clk); |
404 | } | 404 | } |
405 | 405 | ||
406 | static int tegra_i2c_init(struct tegra_i2c_dev *i2c_dev) | 406 | static int tegra_i2c_init(struct tegra_i2c_dev *i2c_dev) |
407 | { | 407 | { |
408 | u32 val; | 408 | u32 val; |
409 | int err = 0; | 409 | int err = 0; |
410 | int clk_multiplier = I2C_CLK_MULTIPLIER_STD_FAST_MODE; | ||
411 | u32 clk_divisor; | 410 | u32 clk_divisor; |
412 | 411 | ||
413 | err = tegra_i2c_clock_enable(i2c_dev); | 412 | err = tegra_i2c_clock_enable(i2c_dev); |
@@ -428,9 +427,6 @@ static int tegra_i2c_init(struct tegra_i2c_dev *i2c_dev) | |||
428 | i2c_writel(i2c_dev, val, I2C_CNFG); | 427 | i2c_writel(i2c_dev, val, I2C_CNFG); |
429 | i2c_writel(i2c_dev, 0, I2C_INT_MASK); | 428 | i2c_writel(i2c_dev, 0, I2C_INT_MASK); |
430 | 429 | ||
431 | clk_multiplier *= (i2c_dev->hw->clk_divisor_std_fast_mode + 1); | ||
432 | clk_set_rate(i2c_dev->div_clk, i2c_dev->bus_clk_rate * clk_multiplier); | ||
433 | |||
434 | /* Make sure clock divisor programmed correctly */ | 430 | /* Make sure clock divisor programmed correctly */ |
435 | clk_divisor = i2c_dev->hw->clk_divisor_hs_mode; | 431 | clk_divisor = i2c_dev->hw->clk_divisor_hs_mode; |
436 | clk_divisor |= i2c_dev->hw->clk_divisor_std_fast_mode << | 432 | clk_divisor |= i2c_dev->hw->clk_divisor_std_fast_mode << |
@@ -712,6 +708,7 @@ static int tegra_i2c_probe(struct platform_device *pdev) | |||
712 | void __iomem *base; | 708 | void __iomem *base; |
713 | int irq; | 709 | int irq; |
714 | int ret = 0; | 710 | int ret = 0; |
711 | int clk_multiplier = I2C_CLK_MULTIPLIER_STD_FAST_MODE; | ||
715 | 712 | ||
716 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 713 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
717 | base = devm_ioremap_resource(&pdev->dev, res); | 714 | base = devm_ioremap_resource(&pdev->dev, res); |
@@ -777,17 +774,39 @@ static int tegra_i2c_probe(struct platform_device *pdev) | |||
777 | 774 | ||
778 | platform_set_drvdata(pdev, i2c_dev); | 775 | platform_set_drvdata(pdev, i2c_dev); |
779 | 776 | ||
777 | if (!i2c_dev->hw->has_single_clk_source) { | ||
778 | ret = clk_prepare(i2c_dev->fast_clk); | ||
779 | if (ret < 0) { | ||
780 | dev_err(i2c_dev->dev, "Clock prepare failed %d\n", ret); | ||
781 | return ret; | ||
782 | } | ||
783 | } | ||
784 | |||
785 | clk_multiplier *= (i2c_dev->hw->clk_divisor_std_fast_mode + 1); | ||
786 | ret = clk_set_rate(i2c_dev->div_clk, | ||
787 | i2c_dev->bus_clk_rate * clk_multiplier); | ||
788 | if (ret) { | ||
789 | dev_err(i2c_dev->dev, "Clock rate change failed %d\n", ret); | ||
790 | goto unprepare_fast_clk; | ||
791 | } | ||
792 | |||
793 | ret = clk_prepare(i2c_dev->div_clk); | ||
794 | if (ret < 0) { | ||
795 | dev_err(i2c_dev->dev, "Clock prepare failed %d\n", ret); | ||
796 | goto unprepare_fast_clk; | ||
797 | } | ||
798 | |||
780 | ret = tegra_i2c_init(i2c_dev); | 799 | ret = tegra_i2c_init(i2c_dev); |
781 | if (ret) { | 800 | if (ret) { |
782 | dev_err(&pdev->dev, "Failed to initialize i2c controller"); | 801 | dev_err(&pdev->dev, "Failed to initialize i2c controller"); |
783 | return ret; | 802 | goto unprepare_div_clk; |
784 | } | 803 | } |
785 | 804 | ||
786 | ret = devm_request_irq(&pdev->dev, i2c_dev->irq, | 805 | ret = devm_request_irq(&pdev->dev, i2c_dev->irq, |
787 | tegra_i2c_isr, 0, dev_name(&pdev->dev), i2c_dev); | 806 | tegra_i2c_isr, 0, dev_name(&pdev->dev), i2c_dev); |
788 | if (ret) { | 807 | if (ret) { |
789 | dev_err(&pdev->dev, "Failed to request irq %i\n", i2c_dev->irq); | 808 | dev_err(&pdev->dev, "Failed to request irq %i\n", i2c_dev->irq); |
790 | return ret; | 809 | goto unprepare_div_clk; |
791 | } | 810 | } |
792 | 811 | ||
793 | i2c_set_adapdata(&i2c_dev->adapter, i2c_dev); | 812 | i2c_set_adapdata(&i2c_dev->adapter, i2c_dev); |
@@ -803,16 +822,30 @@ static int tegra_i2c_probe(struct platform_device *pdev) | |||
803 | ret = i2c_add_numbered_adapter(&i2c_dev->adapter); | 822 | ret = i2c_add_numbered_adapter(&i2c_dev->adapter); |
804 | if (ret) { | 823 | if (ret) { |
805 | dev_err(&pdev->dev, "Failed to add I2C adapter\n"); | 824 | dev_err(&pdev->dev, "Failed to add I2C adapter\n"); |
806 | return ret; | 825 | goto unprepare_div_clk; |
807 | } | 826 | } |
808 | 827 | ||
809 | return 0; | 828 | return 0; |
829 | |||
830 | unprepare_div_clk: | ||
831 | clk_unprepare(i2c_dev->div_clk); | ||
832 | |||
833 | unprepare_fast_clk: | ||
834 | if (!i2c_dev->hw->has_single_clk_source) | ||
835 | clk_unprepare(i2c_dev->fast_clk); | ||
836 | |||
837 | return ret; | ||
810 | } | 838 | } |
811 | 839 | ||
812 | static int tegra_i2c_remove(struct platform_device *pdev) | 840 | static int tegra_i2c_remove(struct platform_device *pdev) |
813 | { | 841 | { |
814 | struct tegra_i2c_dev *i2c_dev = platform_get_drvdata(pdev); | 842 | struct tegra_i2c_dev *i2c_dev = platform_get_drvdata(pdev); |
815 | i2c_del_adapter(&i2c_dev->adapter); | 843 | i2c_del_adapter(&i2c_dev->adapter); |
844 | |||
845 | clk_unprepare(i2c_dev->div_clk); | ||
846 | if (!i2c_dev->hw->has_single_clk_source) | ||
847 | clk_unprepare(i2c_dev->fast_clk); | ||
848 | |||
816 | return 0; | 849 | return 0; |
817 | } | 850 | } |
818 | 851 | ||
diff --git a/drivers/i2c/i2c-acpi.c b/drivers/i2c/i2c-acpi.c deleted file mode 100644 index 0dbc18c15c43..000000000000 --- a/drivers/i2c/i2c-acpi.c +++ /dev/null | |||
@@ -1,364 +0,0 @@ | |||
1 | /* | ||
2 | * I2C ACPI code | ||
3 | * | ||
4 | * Copyright (C) 2014 Intel Corp | ||
5 | * | ||
6 | * Author: Lan Tianyu <tianyu.lan@intel.com> | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License version 2 as | ||
10 | * published by the Free Software Foundation. | ||
11 | * | ||
12 | * This program is distributed in the hope that it will be useful, but | ||
13 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY | ||
14 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | ||
15 | * for more details. | ||
16 | */ | ||
17 | #define pr_fmt(fmt) "I2C/ACPI : " fmt | ||
18 | |||
19 | #include <linux/kernel.h> | ||
20 | #include <linux/errno.h> | ||
21 | #include <linux/err.h> | ||
22 | #include <linux/i2c.h> | ||
23 | #include <linux/acpi.h> | ||
24 | |||
25 | struct acpi_i2c_handler_data { | ||
26 | struct acpi_connection_info info; | ||
27 | struct i2c_adapter *adapter; | ||
28 | }; | ||
29 | |||
30 | struct gsb_buffer { | ||
31 | u8 status; | ||
32 | u8 len; | ||
33 | union { | ||
34 | u16 wdata; | ||
35 | u8 bdata; | ||
36 | u8 data[0]; | ||
37 | }; | ||
38 | } __packed; | ||
39 | |||
40 | static int acpi_i2c_add_resource(struct acpi_resource *ares, void *data) | ||
41 | { | ||
42 | struct i2c_board_info *info = data; | ||
43 | |||
44 | if (ares->type == ACPI_RESOURCE_TYPE_SERIAL_BUS) { | ||
45 | struct acpi_resource_i2c_serialbus *sb; | ||
46 | |||
47 | sb = &ares->data.i2c_serial_bus; | ||
48 | if (sb->type == ACPI_RESOURCE_SERIAL_TYPE_I2C) { | ||
49 | info->addr = sb->slave_address; | ||
50 | if (sb->access_mode == ACPI_I2C_10BIT_MODE) | ||
51 | info->flags |= I2C_CLIENT_TEN; | ||
52 | } | ||
53 | } else if (info->irq < 0) { | ||
54 | struct resource r; | ||
55 | |||
56 | if (acpi_dev_resource_interrupt(ares, 0, &r)) | ||
57 | info->irq = r.start; | ||
58 | } | ||
59 | |||
60 | /* Tell the ACPI core to skip this resource */ | ||
61 | return 1; | ||
62 | } | ||
63 | |||
64 | static acpi_status acpi_i2c_add_device(acpi_handle handle, u32 level, | ||
65 | void *data, void **return_value) | ||
66 | { | ||
67 | struct i2c_adapter *adapter = data; | ||
68 | struct list_head resource_list; | ||
69 | struct i2c_board_info info; | ||
70 | struct acpi_device *adev; | ||
71 | int ret; | ||
72 | |||
73 | if (acpi_bus_get_device(handle, &adev)) | ||
74 | return AE_OK; | ||
75 | if (acpi_bus_get_status(adev) || !adev->status.present) | ||
76 | return AE_OK; | ||
77 | |||
78 | memset(&info, 0, sizeof(info)); | ||
79 | info.acpi_node.companion = adev; | ||
80 | info.irq = -1; | ||
81 | |||
82 | INIT_LIST_HEAD(&resource_list); | ||
83 | ret = acpi_dev_get_resources(adev, &resource_list, | ||
84 | acpi_i2c_add_resource, &info); | ||
85 | acpi_dev_free_resource_list(&resource_list); | ||
86 | |||
87 | if (ret < 0 || !info.addr) | ||
88 | return AE_OK; | ||
89 | |||
90 | adev->power.flags.ignore_parent = true; | ||
91 | strlcpy(info.type, dev_name(&adev->dev), sizeof(info.type)); | ||
92 | if (!i2c_new_device(adapter, &info)) { | ||
93 | adev->power.flags.ignore_parent = false; | ||
94 | dev_err(&adapter->dev, | ||
95 | "failed to add I2C device %s from ACPI\n", | ||
96 | dev_name(&adev->dev)); | ||
97 | } | ||
98 | |||
99 | return AE_OK; | ||
100 | } | ||
101 | |||
102 | /** | ||
103 | * acpi_i2c_register_devices - enumerate I2C slave devices behind adapter | ||
104 | * @adap: pointer to adapter | ||
105 | * | ||
106 | * Enumerate all I2C slave devices behind this adapter by walking the ACPI | ||
107 | * namespace. When a device is found it will be added to the Linux device | ||
108 | * model and bound to the corresponding ACPI handle. | ||
109 | */ | ||
110 | void acpi_i2c_register_devices(struct i2c_adapter *adap) | ||
111 | { | ||
112 | acpi_handle handle; | ||
113 | acpi_status status; | ||
114 | |||
115 | if (!adap->dev.parent) | ||
116 | return; | ||
117 | |||
118 | handle = ACPI_HANDLE(adap->dev.parent); | ||
119 | if (!handle) | ||
120 | return; | ||
121 | |||
122 | status = acpi_walk_namespace(ACPI_TYPE_DEVICE, handle, 1, | ||
123 | acpi_i2c_add_device, NULL, | ||
124 | adap, NULL); | ||
125 | if (ACPI_FAILURE(status)) | ||
126 | dev_warn(&adap->dev, "failed to enumerate I2C slaves\n"); | ||
127 | } | ||
128 | |||
129 | #ifdef CONFIG_ACPI_I2C_OPREGION | ||
130 | static int acpi_gsb_i2c_read_bytes(struct i2c_client *client, | ||
131 | u8 cmd, u8 *data, u8 data_len) | ||
132 | { | ||
133 | |||
134 | struct i2c_msg msgs[2]; | ||
135 | int ret; | ||
136 | u8 *buffer; | ||
137 | |||
138 | buffer = kzalloc(data_len, GFP_KERNEL); | ||
139 | if (!buffer) | ||
140 | return AE_NO_MEMORY; | ||
141 | |||
142 | msgs[0].addr = client->addr; | ||
143 | msgs[0].flags = client->flags; | ||
144 | msgs[0].len = 1; | ||
145 | msgs[0].buf = &cmd; | ||
146 | |||
147 | msgs[1].addr = client->addr; | ||
148 | msgs[1].flags = client->flags | I2C_M_RD; | ||
149 | msgs[1].len = data_len; | ||
150 | msgs[1].buf = buffer; | ||
151 | |||
152 | ret = i2c_transfer(client->adapter, msgs, ARRAY_SIZE(msgs)); | ||
153 | if (ret < 0) | ||
154 | dev_err(&client->adapter->dev, "i2c read failed\n"); | ||
155 | else | ||
156 | memcpy(data, buffer, data_len); | ||
157 | |||
158 | kfree(buffer); | ||
159 | return ret; | ||
160 | } | ||
161 | |||
162 | static int acpi_gsb_i2c_write_bytes(struct i2c_client *client, | ||
163 | u8 cmd, u8 *data, u8 data_len) | ||
164 | { | ||
165 | |||
166 | struct i2c_msg msgs[1]; | ||
167 | u8 *buffer; | ||
168 | int ret = AE_OK; | ||
169 | |||
170 | buffer = kzalloc(data_len + 1, GFP_KERNEL); | ||
171 | if (!buffer) | ||
172 | return AE_NO_MEMORY; | ||
173 | |||
174 | buffer[0] = cmd; | ||
175 | memcpy(buffer + 1, data, data_len); | ||
176 | |||
177 | msgs[0].addr = client->addr; | ||
178 | msgs[0].flags = client->flags; | ||
179 | msgs[0].len = data_len + 1; | ||
180 | msgs[0].buf = buffer; | ||
181 | |||
182 | ret = i2c_transfer(client->adapter, msgs, ARRAY_SIZE(msgs)); | ||
183 | if (ret < 0) | ||
184 | dev_err(&client->adapter->dev, "i2c write failed\n"); | ||
185 | |||
186 | kfree(buffer); | ||
187 | return ret; | ||
188 | } | ||
189 | |||
190 | static acpi_status | ||
191 | acpi_i2c_space_handler(u32 function, acpi_physical_address command, | ||
192 | u32 bits, u64 *value64, | ||
193 | void *handler_context, void *region_context) | ||
194 | { | ||
195 | struct gsb_buffer *gsb = (struct gsb_buffer *)value64; | ||
196 | struct acpi_i2c_handler_data *data = handler_context; | ||
197 | struct acpi_connection_info *info = &data->info; | ||
198 | struct acpi_resource_i2c_serialbus *sb; | ||
199 | struct i2c_adapter *adapter = data->adapter; | ||
200 | struct i2c_client client; | ||
201 | struct acpi_resource *ares; | ||
202 | u32 accessor_type = function >> 16; | ||
203 | u8 action = function & ACPI_IO_MASK; | ||
204 | acpi_status ret = AE_OK; | ||
205 | int status; | ||
206 | |||
207 | ret = acpi_buffer_to_resource(info->connection, info->length, &ares); | ||
208 | if (ACPI_FAILURE(ret)) | ||
209 | return ret; | ||
210 | |||
211 | if (!value64 || ares->type != ACPI_RESOURCE_TYPE_SERIAL_BUS) { | ||
212 | ret = AE_BAD_PARAMETER; | ||
213 | goto err; | ||
214 | } | ||
215 | |||
216 | sb = &ares->data.i2c_serial_bus; | ||
217 | if (sb->type != ACPI_RESOURCE_SERIAL_TYPE_I2C) { | ||
218 | ret = AE_BAD_PARAMETER; | ||
219 | goto err; | ||
220 | } | ||
221 | |||
222 | memset(&client, 0, sizeof(client)); | ||
223 | client.adapter = adapter; | ||
224 | client.addr = sb->slave_address; | ||
225 | client.flags = 0; | ||
226 | |||
227 | if (sb->access_mode == ACPI_I2C_10BIT_MODE) | ||
228 | client.flags |= I2C_CLIENT_TEN; | ||
229 | |||
230 | switch (accessor_type) { | ||
231 | case ACPI_GSB_ACCESS_ATTRIB_SEND_RCV: | ||
232 | if (action == ACPI_READ) { | ||
233 | status = i2c_smbus_read_byte(&client); | ||
234 | if (status >= 0) { | ||
235 | gsb->bdata = status; | ||
236 | status = 0; | ||
237 | } | ||
238 | } else { | ||
239 | status = i2c_smbus_write_byte(&client, gsb->bdata); | ||
240 | } | ||
241 | break; | ||
242 | |||
243 | case ACPI_GSB_ACCESS_ATTRIB_BYTE: | ||
244 | if (action == ACPI_READ) { | ||
245 | status = i2c_smbus_read_byte_data(&client, command); | ||
246 | if (status >= 0) { | ||
247 | gsb->bdata = status; | ||
248 | status = 0; | ||
249 | } | ||
250 | } else { | ||
251 | status = i2c_smbus_write_byte_data(&client, command, | ||
252 | gsb->bdata); | ||
253 | } | ||
254 | break; | ||
255 | |||
256 | case ACPI_GSB_ACCESS_ATTRIB_WORD: | ||
257 | if (action == ACPI_READ) { | ||
258 | status = i2c_smbus_read_word_data(&client, command); | ||
259 | if (status >= 0) { | ||
260 | gsb->wdata = status; | ||
261 | status = 0; | ||
262 | } | ||
263 | } else { | ||
264 | status = i2c_smbus_write_word_data(&client, command, | ||
265 | gsb->wdata); | ||
266 | } | ||
267 | break; | ||
268 | |||
269 | case ACPI_GSB_ACCESS_ATTRIB_BLOCK: | ||
270 | if (action == ACPI_READ) { | ||
271 | status = i2c_smbus_read_block_data(&client, command, | ||
272 | gsb->data); | ||
273 | if (status >= 0) { | ||
274 | gsb->len = status; | ||
275 | status = 0; | ||
276 | } | ||
277 | } else { | ||
278 | status = i2c_smbus_write_block_data(&client, command, | ||
279 | gsb->len, gsb->data); | ||
280 | } | ||
281 | break; | ||
282 | |||
283 | case ACPI_GSB_ACCESS_ATTRIB_MULTIBYTE: | ||
284 | if (action == ACPI_READ) { | ||
285 | status = acpi_gsb_i2c_read_bytes(&client, command, | ||
286 | gsb->data, info->access_length); | ||
287 | if (status > 0) | ||
288 | status = 0; | ||
289 | } else { | ||
290 | status = acpi_gsb_i2c_write_bytes(&client, command, | ||
291 | gsb->data, info->access_length); | ||
292 | } | ||
293 | break; | ||
294 | |||
295 | default: | ||
296 | pr_info("protocol(0x%02x) is not supported.\n", accessor_type); | ||
297 | ret = AE_BAD_PARAMETER; | ||
298 | goto err; | ||
299 | } | ||
300 | |||
301 | gsb->status = status; | ||
302 | |||
303 | err: | ||
304 | ACPI_FREE(ares); | ||
305 | return ret; | ||
306 | } | ||
307 | |||
308 | |||
309 | int acpi_i2c_install_space_handler(struct i2c_adapter *adapter) | ||
310 | { | ||
311 | acpi_handle handle = ACPI_HANDLE(adapter->dev.parent); | ||
312 | struct acpi_i2c_handler_data *data; | ||
313 | acpi_status status; | ||
314 | |||
315 | if (!handle) | ||
316 | return -ENODEV; | ||
317 | |||
318 | data = kzalloc(sizeof(struct acpi_i2c_handler_data), | ||
319 | GFP_KERNEL); | ||
320 | if (!data) | ||
321 | return -ENOMEM; | ||
322 | |||
323 | data->adapter = adapter; | ||
324 | status = acpi_bus_attach_private_data(handle, (void *)data); | ||
325 | if (ACPI_FAILURE(status)) { | ||
326 | kfree(data); | ||
327 | return -ENOMEM; | ||
328 | } | ||
329 | |||
330 | status = acpi_install_address_space_handler(handle, | ||
331 | ACPI_ADR_SPACE_GSBUS, | ||
332 | &acpi_i2c_space_handler, | ||
333 | NULL, | ||
334 | data); | ||
335 | if (ACPI_FAILURE(status)) { | ||
336 | dev_err(&adapter->dev, "Error installing i2c space handler\n"); | ||
337 | acpi_bus_detach_private_data(handle); | ||
338 | kfree(data); | ||
339 | return -ENOMEM; | ||
340 | } | ||
341 | |||
342 | return 0; | ||
343 | } | ||
344 | |||
345 | void acpi_i2c_remove_space_handler(struct i2c_adapter *adapter) | ||
346 | { | ||
347 | acpi_handle handle = ACPI_HANDLE(adapter->dev.parent); | ||
348 | struct acpi_i2c_handler_data *data; | ||
349 | acpi_status status; | ||
350 | |||
351 | if (!handle) | ||
352 | return; | ||
353 | |||
354 | acpi_remove_address_space_handler(handle, | ||
355 | ACPI_ADR_SPACE_GSBUS, | ||
356 | &acpi_i2c_space_handler); | ||
357 | |||
358 | status = acpi_bus_get_private_data(handle, (void **)&data); | ||
359 | if (ACPI_SUCCESS(status)) | ||
360 | kfree(data); | ||
361 | |||
362 | acpi_bus_detach_private_data(handle); | ||
363 | } | ||
364 | #endif | ||
diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c index 632057a44615..ccfbbab82a15 100644 --- a/drivers/i2c/i2c-core.c +++ b/drivers/i2c/i2c-core.c | |||
@@ -27,6 +27,8 @@ | |||
27 | OF support is copyright (c) 2008 Jochen Friedrich <jochen@scram.de> | 27 | OF support is copyright (c) 2008 Jochen Friedrich <jochen@scram.de> |
28 | (based on a previous patch from Jon Smirl <jonsmirl@gmail.com>) and | 28 | (based on a previous patch from Jon Smirl <jonsmirl@gmail.com>) and |
29 | (c) 2013 Wolfram Sang <wsa@the-dreams.de> | 29 | (c) 2013 Wolfram Sang <wsa@the-dreams.de> |
30 | I2C ACPI code Copyright (C) 2014 Intel Corp | ||
31 | Author: Lan Tianyu <tianyu.lan@intel.com> | ||
30 | */ | 32 | */ |
31 | 33 | ||
32 | #include <linux/module.h> | 34 | #include <linux/module.h> |
@@ -78,6 +80,368 @@ void i2c_transfer_trace_unreg(void) | |||
78 | static_key_slow_dec(&i2c_trace_msg); | 80 | static_key_slow_dec(&i2c_trace_msg); |
79 | } | 81 | } |
80 | 82 | ||
83 | #if defined(CONFIG_ACPI) | ||
84 | struct acpi_i2c_handler_data { | ||
85 | struct acpi_connection_info info; | ||
86 | struct i2c_adapter *adapter; | ||
87 | }; | ||
88 | |||
89 | struct gsb_buffer { | ||
90 | u8 status; | ||
91 | u8 len; | ||
92 | union { | ||
93 | u16 wdata; | ||
94 | u8 bdata; | ||
95 | u8 data[0]; | ||
96 | }; | ||
97 | } __packed; | ||
98 | |||
99 | static int acpi_i2c_add_resource(struct acpi_resource *ares, void *data) | ||
100 | { | ||
101 | struct i2c_board_info *info = data; | ||
102 | |||
103 | if (ares->type == ACPI_RESOURCE_TYPE_SERIAL_BUS) { | ||
104 | struct acpi_resource_i2c_serialbus *sb; | ||
105 | |||
106 | sb = &ares->data.i2c_serial_bus; | ||
107 | if (sb->type == ACPI_RESOURCE_SERIAL_TYPE_I2C) { | ||
108 | info->addr = sb->slave_address; | ||
109 | if (sb->access_mode == ACPI_I2C_10BIT_MODE) | ||
110 | info->flags |= I2C_CLIENT_TEN; | ||
111 | } | ||
112 | } else if (info->irq < 0) { | ||
113 | struct resource r; | ||
114 | |||
115 | if (acpi_dev_resource_interrupt(ares, 0, &r)) | ||
116 | info->irq = r.start; | ||
117 | } | ||
118 | |||
119 | /* Tell the ACPI core to skip this resource */ | ||
120 | return 1; | ||
121 | } | ||
122 | |||
123 | static acpi_status acpi_i2c_add_device(acpi_handle handle, u32 level, | ||
124 | void *data, void **return_value) | ||
125 | { | ||
126 | struct i2c_adapter *adapter = data; | ||
127 | struct list_head resource_list; | ||
128 | struct i2c_board_info info; | ||
129 | struct acpi_device *adev; | ||
130 | int ret; | ||
131 | |||
132 | if (acpi_bus_get_device(handle, &adev)) | ||
133 | return AE_OK; | ||
134 | if (acpi_bus_get_status(adev) || !adev->status.present) | ||
135 | return AE_OK; | ||
136 | |||
137 | memset(&info, 0, sizeof(info)); | ||
138 | info.acpi_node.companion = adev; | ||
139 | info.irq = -1; | ||
140 | |||
141 | INIT_LIST_HEAD(&resource_list); | ||
142 | ret = acpi_dev_get_resources(adev, &resource_list, | ||
143 | acpi_i2c_add_resource, &info); | ||
144 | acpi_dev_free_resource_list(&resource_list); | ||
145 | |||
146 | if (ret < 0 || !info.addr) | ||
147 | return AE_OK; | ||
148 | |||
149 | adev->power.flags.ignore_parent = true; | ||
150 | strlcpy(info.type, dev_name(&adev->dev), sizeof(info.type)); | ||
151 | if (!i2c_new_device(adapter, &info)) { | ||
152 | adev->power.flags.ignore_parent = false; | ||
153 | dev_err(&adapter->dev, | ||
154 | "failed to add I2C device %s from ACPI\n", | ||
155 | dev_name(&adev->dev)); | ||
156 | } | ||
157 | |||
158 | return AE_OK; | ||
159 | } | ||
160 | |||
161 | /** | ||
162 | * acpi_i2c_register_devices - enumerate I2C slave devices behind adapter | ||
163 | * @adap: pointer to adapter | ||
164 | * | ||
165 | * Enumerate all I2C slave devices behind this adapter by walking the ACPI | ||
166 | * namespace. When a device is found it will be added to the Linux device | ||
167 | * model and bound to the corresponding ACPI handle. | ||
168 | */ | ||
169 | static void acpi_i2c_register_devices(struct i2c_adapter *adap) | ||
170 | { | ||
171 | acpi_handle handle; | ||
172 | acpi_status status; | ||
173 | |||
174 | if (!adap->dev.parent) | ||
175 | return; | ||
176 | |||
177 | handle = ACPI_HANDLE(adap->dev.parent); | ||
178 | if (!handle) | ||
179 | return; | ||
180 | |||
181 | status = acpi_walk_namespace(ACPI_TYPE_DEVICE, handle, 1, | ||
182 | acpi_i2c_add_device, NULL, | ||
183 | adap, NULL); | ||
184 | if (ACPI_FAILURE(status)) | ||
185 | dev_warn(&adap->dev, "failed to enumerate I2C slaves\n"); | ||
186 | } | ||
187 | |||
188 | #else /* CONFIG_ACPI */ | ||
189 | static inline void acpi_i2c_register_devices(struct i2c_adapter *adap) { } | ||
190 | #endif /* CONFIG_ACPI */ | ||
191 | |||
192 | #ifdef CONFIG_ACPI_I2C_OPREGION | ||
193 | static int acpi_gsb_i2c_read_bytes(struct i2c_client *client, | ||
194 | u8 cmd, u8 *data, u8 data_len) | ||
195 | { | ||
196 | |||
197 | struct i2c_msg msgs[2]; | ||
198 | int ret; | ||
199 | u8 *buffer; | ||
200 | |||
201 | buffer = kzalloc(data_len, GFP_KERNEL); | ||
202 | if (!buffer) | ||
203 | return AE_NO_MEMORY; | ||
204 | |||
205 | msgs[0].addr = client->addr; | ||
206 | msgs[0].flags = client->flags; | ||
207 | msgs[0].len = 1; | ||
208 | msgs[0].buf = &cmd; | ||
209 | |||
210 | msgs[1].addr = client->addr; | ||
211 | msgs[1].flags = client->flags | I2C_M_RD; | ||
212 | msgs[1].len = data_len; | ||
213 | msgs[1].buf = buffer; | ||
214 | |||
215 | ret = i2c_transfer(client->adapter, msgs, ARRAY_SIZE(msgs)); | ||
216 | if (ret < 0) | ||
217 | dev_err(&client->adapter->dev, "i2c read failed\n"); | ||
218 | else | ||
219 | memcpy(data, buffer, data_len); | ||
220 | |||
221 | kfree(buffer); | ||
222 | return ret; | ||
223 | } | ||
224 | |||
225 | static int acpi_gsb_i2c_write_bytes(struct i2c_client *client, | ||
226 | u8 cmd, u8 *data, u8 data_len) | ||
227 | { | ||
228 | |||
229 | struct i2c_msg msgs[1]; | ||
230 | u8 *buffer; | ||
231 | int ret = AE_OK; | ||
232 | |||
233 | buffer = kzalloc(data_len + 1, GFP_KERNEL); | ||
234 | if (!buffer) | ||
235 | return AE_NO_MEMORY; | ||
236 | |||
237 | buffer[0] = cmd; | ||
238 | memcpy(buffer + 1, data, data_len); | ||
239 | |||
240 | msgs[0].addr = client->addr; | ||
241 | msgs[0].flags = client->flags; | ||
242 | msgs[0].len = data_len + 1; | ||
243 | msgs[0].buf = buffer; | ||
244 | |||
245 | ret = i2c_transfer(client->adapter, msgs, ARRAY_SIZE(msgs)); | ||
246 | if (ret < 0) | ||
247 | dev_err(&client->adapter->dev, "i2c write failed\n"); | ||
248 | |||
249 | kfree(buffer); | ||
250 | return ret; | ||
251 | } | ||
252 | |||
253 | static acpi_status | ||
254 | acpi_i2c_space_handler(u32 function, acpi_physical_address command, | ||
255 | u32 bits, u64 *value64, | ||
256 | void *handler_context, void *region_context) | ||
257 | { | ||
258 | struct gsb_buffer *gsb = (struct gsb_buffer *)value64; | ||
259 | struct acpi_i2c_handler_data *data = handler_context; | ||
260 | struct acpi_connection_info *info = &data->info; | ||
261 | struct acpi_resource_i2c_serialbus *sb; | ||
262 | struct i2c_adapter *adapter = data->adapter; | ||
263 | struct i2c_client client; | ||
264 | struct acpi_resource *ares; | ||
265 | u32 accessor_type = function >> 16; | ||
266 | u8 action = function & ACPI_IO_MASK; | ||
267 | acpi_status ret = AE_OK; | ||
268 | int status; | ||
269 | |||
270 | ret = acpi_buffer_to_resource(info->connection, info->length, &ares); | ||
271 | if (ACPI_FAILURE(ret)) | ||
272 | return ret; | ||
273 | |||
274 | if (!value64 || ares->type != ACPI_RESOURCE_TYPE_SERIAL_BUS) { | ||
275 | ret = AE_BAD_PARAMETER; | ||
276 | goto err; | ||
277 | } | ||
278 | |||
279 | sb = &ares->data.i2c_serial_bus; | ||
280 | if (sb->type != ACPI_RESOURCE_SERIAL_TYPE_I2C) { | ||
281 | ret = AE_BAD_PARAMETER; | ||
282 | goto err; | ||
283 | } | ||
284 | |||
285 | memset(&client, 0, sizeof(client)); | ||
286 | client.adapter = adapter; | ||
287 | client.addr = sb->slave_address; | ||
288 | client.flags = 0; | ||
289 | |||
290 | if (sb->access_mode == ACPI_I2C_10BIT_MODE) | ||
291 | client.flags |= I2C_CLIENT_TEN; | ||
292 | |||
293 | switch (accessor_type) { | ||
294 | case ACPI_GSB_ACCESS_ATTRIB_SEND_RCV: | ||
295 | if (action == ACPI_READ) { | ||
296 | status = i2c_smbus_read_byte(&client); | ||
297 | if (status >= 0) { | ||
298 | gsb->bdata = status; | ||
299 | status = 0; | ||
300 | } | ||
301 | } else { | ||
302 | status = i2c_smbus_write_byte(&client, gsb->bdata); | ||
303 | } | ||
304 | break; | ||
305 | |||
306 | case ACPI_GSB_ACCESS_ATTRIB_BYTE: | ||
307 | if (action == ACPI_READ) { | ||
308 | status = i2c_smbus_read_byte_data(&client, command); | ||
309 | if (status >= 0) { | ||
310 | gsb->bdata = status; | ||
311 | status = 0; | ||
312 | } | ||
313 | } else { | ||
314 | status = i2c_smbus_write_byte_data(&client, command, | ||
315 | gsb->bdata); | ||
316 | } | ||
317 | break; | ||
318 | |||
319 | case ACPI_GSB_ACCESS_ATTRIB_WORD: | ||
320 | if (action == ACPI_READ) { | ||
321 | status = i2c_smbus_read_word_data(&client, command); | ||
322 | if (status >= 0) { | ||
323 | gsb->wdata = status; | ||
324 | status = 0; | ||
325 | } | ||
326 | } else { | ||
327 | status = i2c_smbus_write_word_data(&client, command, | ||
328 | gsb->wdata); | ||
329 | } | ||
330 | break; | ||
331 | |||
332 | case ACPI_GSB_ACCESS_ATTRIB_BLOCK: | ||
333 | if (action == ACPI_READ) { | ||
334 | status = i2c_smbus_read_block_data(&client, command, | ||
335 | gsb->data); | ||
336 | if (status >= 0) { | ||
337 | gsb->len = status; | ||
338 | status = 0; | ||
339 | } | ||
340 | } else { | ||
341 | status = i2c_smbus_write_block_data(&client, command, | ||
342 | gsb->len, gsb->data); | ||
343 | } | ||
344 | break; | ||
345 | |||
346 | case ACPI_GSB_ACCESS_ATTRIB_MULTIBYTE: | ||
347 | if (action == ACPI_READ) { | ||
348 | status = acpi_gsb_i2c_read_bytes(&client, command, | ||
349 | gsb->data, info->access_length); | ||
350 | if (status > 0) | ||
351 | status = 0; | ||
352 | } else { | ||
353 | status = acpi_gsb_i2c_write_bytes(&client, command, | ||
354 | gsb->data, info->access_length); | ||
355 | } | ||
356 | break; | ||
357 | |||
358 | default: | ||
359 | pr_info("protocol(0x%02x) is not supported.\n", accessor_type); | ||
360 | ret = AE_BAD_PARAMETER; | ||
361 | goto err; | ||
362 | } | ||
363 | |||
364 | gsb->status = status; | ||
365 | |||
366 | err: | ||
367 | ACPI_FREE(ares); | ||
368 | return ret; | ||
369 | } | ||
370 | |||
371 | |||
372 | static int acpi_i2c_install_space_handler(struct i2c_adapter *adapter) | ||
373 | { | ||
374 | acpi_handle handle; | ||
375 | struct acpi_i2c_handler_data *data; | ||
376 | acpi_status status; | ||
377 | |||
378 | if (!adapter->dev.parent) | ||
379 | return -ENODEV; | ||
380 | |||
381 | handle = ACPI_HANDLE(adapter->dev.parent); | ||
382 | |||
383 | if (!handle) | ||
384 | return -ENODEV; | ||
385 | |||
386 | data = kzalloc(sizeof(struct acpi_i2c_handler_data), | ||
387 | GFP_KERNEL); | ||
388 | if (!data) | ||
389 | return -ENOMEM; | ||
390 | |||
391 | data->adapter = adapter; | ||
392 | status = acpi_bus_attach_private_data(handle, (void *)data); | ||
393 | if (ACPI_FAILURE(status)) { | ||
394 | kfree(data); | ||
395 | return -ENOMEM; | ||
396 | } | ||
397 | |||
398 | status = acpi_install_address_space_handler(handle, | ||
399 | ACPI_ADR_SPACE_GSBUS, | ||
400 | &acpi_i2c_space_handler, | ||
401 | NULL, | ||
402 | data); | ||
403 | if (ACPI_FAILURE(status)) { | ||
404 | dev_err(&adapter->dev, "Error installing i2c space handler\n"); | ||
405 | acpi_bus_detach_private_data(handle); | ||
406 | kfree(data); | ||
407 | return -ENOMEM; | ||
408 | } | ||
409 | |||
410 | return 0; | ||
411 | } | ||
412 | |||
413 | static void acpi_i2c_remove_space_handler(struct i2c_adapter *adapter) | ||
414 | { | ||
415 | acpi_handle handle; | ||
416 | struct acpi_i2c_handler_data *data; | ||
417 | acpi_status status; | ||
418 | |||
419 | if (!adapter->dev.parent) | ||
420 | return; | ||
421 | |||
422 | handle = ACPI_HANDLE(adapter->dev.parent); | ||
423 | |||
424 | if (!handle) | ||
425 | return; | ||
426 | |||
427 | acpi_remove_address_space_handler(handle, | ||
428 | ACPI_ADR_SPACE_GSBUS, | ||
429 | &acpi_i2c_space_handler); | ||
430 | |||
431 | status = acpi_bus_get_private_data(handle, (void **)&data); | ||
432 | if (ACPI_SUCCESS(status)) | ||
433 | kfree(data); | ||
434 | |||
435 | acpi_bus_detach_private_data(handle); | ||
436 | } | ||
437 | #else /* CONFIG_ACPI_I2C_OPREGION */ | ||
438 | static inline void acpi_i2c_remove_space_handler(struct i2c_adapter *adapter) | ||
439 | { } | ||
440 | |||
441 | static inline int acpi_i2c_install_space_handler(struct i2c_adapter *adapter) | ||
442 | { return 0; } | ||
443 | #endif /* CONFIG_ACPI_I2C_OPREGION */ | ||
444 | |||
81 | /* ------------------------------------------------------------------------- */ | 445 | /* ------------------------------------------------------------------------- */ |
82 | 446 | ||
83 | static const struct i2c_device_id *i2c_match_id(const struct i2c_device_id *id, | 447 | static const struct i2c_device_id *i2c_match_id(const struct i2c_device_id *id, |
diff --git a/drivers/input/serio/i8042-x86ia64io.h b/drivers/input/serio/i8042-x86ia64io.h index 713e3ddb43bd..40b7d6c0ff17 100644 --- a/drivers/input/serio/i8042-x86ia64io.h +++ b/drivers/input/serio/i8042-x86ia64io.h | |||
@@ -466,6 +466,13 @@ static const struct dmi_system_id __initconst i8042_dmi_nomux_table[] = { | |||
466 | }, | 466 | }, |
467 | }, | 467 | }, |
468 | { | 468 | { |
469 | /* Asus X450LCP */ | ||
470 | .matches = { | ||
471 | DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."), | ||
472 | DMI_MATCH(DMI_PRODUCT_NAME, "X450LCP"), | ||
473 | }, | ||
474 | }, | ||
475 | { | ||
469 | /* Avatar AVIU-145A6 */ | 476 | /* Avatar AVIU-145A6 */ |
470 | .matches = { | 477 | .matches = { |
471 | DMI_MATCH(DMI_SYS_VENDOR, "Intel"), | 478 | DMI_MATCH(DMI_SYS_VENDOR, "Intel"), |
diff --git a/drivers/net/ethernet/broadcom/bnx2.c b/drivers/net/ethernet/broadcom/bnx2.c index 2fee73b878c2..823d01c5684c 100644 --- a/drivers/net/ethernet/broadcom/bnx2.c +++ b/drivers/net/ethernet/broadcom/bnx2.c | |||
@@ -3236,8 +3236,9 @@ bnx2_rx_int(struct bnx2 *bp, struct bnx2_napi *bnapi, int budget) | |||
3236 | 3236 | ||
3237 | skb->protocol = eth_type_trans(skb, bp->dev); | 3237 | skb->protocol = eth_type_trans(skb, bp->dev); |
3238 | 3238 | ||
3239 | if ((len > (bp->dev->mtu + ETH_HLEN)) && | 3239 | if (len > (bp->dev->mtu + ETH_HLEN) && |
3240 | (ntohs(skb->protocol) != 0x8100)) { | 3240 | skb->protocol != htons(0x8100) && |
3241 | skb->protocol != htons(ETH_P_8021AD)) { | ||
3241 | 3242 | ||
3242 | dev_kfree_skb(skb); | 3243 | dev_kfree_skb(skb); |
3243 | goto next_rx; | 3244 | goto next_rx; |
diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c index e7d3a620d96a..ba499489969a 100644 --- a/drivers/net/ethernet/broadcom/tg3.c +++ b/drivers/net/ethernet/broadcom/tg3.c | |||
@@ -6918,7 +6918,8 @@ static int tg3_rx(struct tg3_napi *tnapi, int budget) | |||
6918 | skb->protocol = eth_type_trans(skb, tp->dev); | 6918 | skb->protocol = eth_type_trans(skb, tp->dev); |
6919 | 6919 | ||
6920 | if (len > (tp->dev->mtu + ETH_HLEN) && | 6920 | if (len > (tp->dev->mtu + ETH_HLEN) && |
6921 | skb->protocol != htons(ETH_P_8021Q)) { | 6921 | skb->protocol != htons(ETH_P_8021Q) && |
6922 | skb->protocol != htons(ETH_P_8021AD)) { | ||
6922 | dev_kfree_skb_any(skb); | 6923 | dev_kfree_skb_any(skb); |
6923 | goto drop_it_no_recycle; | 6924 | goto drop_it_no_recycle; |
6924 | } | 6925 | } |
diff --git a/drivers/net/ethernet/cadence/macb.c b/drivers/net/ethernet/cadence/macb.c index d9b8e94b805f..4d9fc0509af6 100644 --- a/drivers/net/ethernet/cadence/macb.c +++ b/drivers/net/ethernet/cadence/macb.c | |||
@@ -30,7 +30,6 @@ | |||
30 | #include <linux/of_device.h> | 30 | #include <linux/of_device.h> |
31 | #include <linux/of_mdio.h> | 31 | #include <linux/of_mdio.h> |
32 | #include <linux/of_net.h> | 32 | #include <linux/of_net.h> |
33 | #include <linux/pinctrl/consumer.h> | ||
34 | 33 | ||
35 | #include "macb.h" | 34 | #include "macb.h" |
36 | 35 | ||
@@ -2071,7 +2070,6 @@ static int __init macb_probe(struct platform_device *pdev) | |||
2071 | struct phy_device *phydev; | 2070 | struct phy_device *phydev; |
2072 | u32 config; | 2071 | u32 config; |
2073 | int err = -ENXIO; | 2072 | int err = -ENXIO; |
2074 | struct pinctrl *pinctrl; | ||
2075 | const char *mac; | 2073 | const char *mac; |
2076 | 2074 | ||
2077 | regs = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 2075 | regs = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
@@ -2080,15 +2078,6 @@ static int __init macb_probe(struct platform_device *pdev) | |||
2080 | goto err_out; | 2078 | goto err_out; |
2081 | } | 2079 | } |
2082 | 2080 | ||
2083 | pinctrl = devm_pinctrl_get_select_default(&pdev->dev); | ||
2084 | if (IS_ERR(pinctrl)) { | ||
2085 | err = PTR_ERR(pinctrl); | ||
2086 | if (err == -EPROBE_DEFER) | ||
2087 | goto err_out; | ||
2088 | |||
2089 | dev_warn(&pdev->dev, "No pinctrl provided\n"); | ||
2090 | } | ||
2091 | |||
2092 | err = -ENOMEM; | 2081 | err = -ENOMEM; |
2093 | dev = alloc_etherdev(sizeof(*bp)); | 2082 | dev = alloc_etherdev(sizeof(*bp)); |
2094 | if (!dev) | 2083 | if (!dev) |
diff --git a/drivers/net/ethernet/mellanox/mlx4/main.c b/drivers/net/ethernet/mellanox/mlx4/main.c index f6c32a947185..90de6e1ad06e 100644 --- a/drivers/net/ethernet/mellanox/mlx4/main.c +++ b/drivers/net/ethernet/mellanox/mlx4/main.c | |||
@@ -78,13 +78,13 @@ MODULE_PARM_DESC(msi_x, "attempt to use MSI-X if nonzero"); | |||
78 | #endif /* CONFIG_PCI_MSI */ | 78 | #endif /* CONFIG_PCI_MSI */ |
79 | 79 | ||
80 | static uint8_t num_vfs[3] = {0, 0, 0}; | 80 | static uint8_t num_vfs[3] = {0, 0, 0}; |
81 | static int num_vfs_argc = 3; | 81 | static int num_vfs_argc; |
82 | module_param_array(num_vfs, byte , &num_vfs_argc, 0444); | 82 | module_param_array(num_vfs, byte , &num_vfs_argc, 0444); |
83 | MODULE_PARM_DESC(num_vfs, "enable #num_vfs functions if num_vfs > 0\n" | 83 | MODULE_PARM_DESC(num_vfs, "enable #num_vfs functions if num_vfs > 0\n" |
84 | "num_vfs=port1,port2,port1+2"); | 84 | "num_vfs=port1,port2,port1+2"); |
85 | 85 | ||
86 | static uint8_t probe_vf[3] = {0, 0, 0}; | 86 | static uint8_t probe_vf[3] = {0, 0, 0}; |
87 | static int probe_vfs_argc = 3; | 87 | static int probe_vfs_argc; |
88 | module_param_array(probe_vf, byte, &probe_vfs_argc, 0444); | 88 | module_param_array(probe_vf, byte, &probe_vfs_argc, 0444); |
89 | MODULE_PARM_DESC(probe_vf, "number of vfs to probe by pf driver (num_vfs > 0)\n" | 89 | MODULE_PARM_DESC(probe_vf, "number of vfs to probe by pf driver (num_vfs > 0)\n" |
90 | "probe_vf=port1,port2,port1+2"); | 90 | "probe_vf=port1,port2,port1+2"); |
diff --git a/drivers/net/ethernet/qlogic/netxen/netxen_nic_init.c b/drivers/net/ethernet/qlogic/netxen/netxen_nic_init.c index 32058614151a..5c4068353f66 100644 --- a/drivers/net/ethernet/qlogic/netxen/netxen_nic_init.c +++ b/drivers/net/ethernet/qlogic/netxen/netxen_nic_init.c | |||
@@ -135,6 +135,7 @@ void netxen_release_tx_buffers(struct netxen_adapter *adapter) | |||
135 | int i, j; | 135 | int i, j; |
136 | struct nx_host_tx_ring *tx_ring = adapter->tx_ring; | 136 | struct nx_host_tx_ring *tx_ring = adapter->tx_ring; |
137 | 137 | ||
138 | spin_lock(&adapter->tx_clean_lock); | ||
138 | cmd_buf = tx_ring->cmd_buf_arr; | 139 | cmd_buf = tx_ring->cmd_buf_arr; |
139 | for (i = 0; i < tx_ring->num_desc; i++) { | 140 | for (i = 0; i < tx_ring->num_desc; i++) { |
140 | buffrag = cmd_buf->frag_array; | 141 | buffrag = cmd_buf->frag_array; |
@@ -158,6 +159,7 @@ void netxen_release_tx_buffers(struct netxen_adapter *adapter) | |||
158 | } | 159 | } |
159 | cmd_buf++; | 160 | cmd_buf++; |
160 | } | 161 | } |
162 | spin_unlock(&adapter->tx_clean_lock); | ||
161 | } | 163 | } |
162 | 164 | ||
163 | void netxen_free_sw_resources(struct netxen_adapter *adapter) | 165 | void netxen_free_sw_resources(struct netxen_adapter *adapter) |
@@ -1792,9 +1794,9 @@ int netxen_process_cmd_ring(struct netxen_adapter *adapter) | |||
1792 | break; | 1794 | break; |
1793 | } | 1795 | } |
1794 | 1796 | ||
1795 | if (count && netif_running(netdev)) { | 1797 | tx_ring->sw_consumer = sw_consumer; |
1796 | tx_ring->sw_consumer = sw_consumer; | ||
1797 | 1798 | ||
1799 | if (count && netif_running(netdev)) { | ||
1798 | smp_mb(); | 1800 | smp_mb(); |
1799 | 1801 | ||
1800 | if (netif_queue_stopped(netdev) && netif_carrier_ok(netdev)) | 1802 | if (netif_queue_stopped(netdev) && netif_carrier_ok(netdev)) |
diff --git a/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c b/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c index 32456c79cc73..0b2a1ccd276d 100644 --- a/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c +++ b/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c | |||
@@ -1186,7 +1186,6 @@ __netxen_nic_down(struct netxen_adapter *adapter, struct net_device *netdev) | |||
1186 | return; | 1186 | return; |
1187 | 1187 | ||
1188 | smp_mb(); | 1188 | smp_mb(); |
1189 | spin_lock(&adapter->tx_clean_lock); | ||
1190 | netif_carrier_off(netdev); | 1189 | netif_carrier_off(netdev); |
1191 | netif_tx_disable(netdev); | 1190 | netif_tx_disable(netdev); |
1192 | 1191 | ||
@@ -1204,7 +1203,6 @@ __netxen_nic_down(struct netxen_adapter *adapter, struct net_device *netdev) | |||
1204 | netxen_napi_disable(adapter); | 1203 | netxen_napi_disable(adapter); |
1205 | 1204 | ||
1206 | netxen_release_tx_buffers(adapter); | 1205 | netxen_release_tx_buffers(adapter); |
1207 | spin_unlock(&adapter->tx_clean_lock); | ||
1208 | } | 1206 | } |
1209 | 1207 | ||
1210 | /* Usage: During suspend and firmware recovery module */ | 1208 | /* Usage: During suspend and firmware recovery module */ |
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_init.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_init.c index 9a2cfe4efac6..2bb48d57e7a5 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_init.c +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_init.c | |||
@@ -1177,9 +1177,8 @@ static void qlcnic_83xx_setup_idc_parameters(struct qlcnic_adapter *adapter) | |||
1177 | { | 1177 | { |
1178 | u32 idc_params, val; | 1178 | u32 idc_params, val; |
1179 | 1179 | ||
1180 | if (qlcnic_83xx_lockless_flash_read32(adapter, | 1180 | if (qlcnic_83xx_flash_read32(adapter, QLC_83XX_IDC_FLASH_PARAM_ADDR, |
1181 | QLC_83XX_IDC_FLASH_PARAM_ADDR, | 1181 | (u8 *)&idc_params, 1)) { |
1182 | (u8 *)&idc_params, 1)) { | ||
1183 | dev_info(&adapter->pdev->dev, | 1182 | dev_info(&adapter->pdev->dev, |
1184 | "%s:failed to get IDC params from flash\n", __func__); | 1183 | "%s:failed to get IDC params from flash\n", __func__); |
1185 | adapter->dev_init_timeo = QLC_83XX_IDC_INIT_TIMEOUT_SECS; | 1184 | adapter->dev_init_timeo = QLC_83XX_IDC_INIT_TIMEOUT_SECS; |
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c index 141f116eb868..494e8105adee 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c | |||
@@ -1333,21 +1333,21 @@ static void qlcnic_get_ethtool_stats(struct net_device *dev, | |||
1333 | struct qlcnic_host_tx_ring *tx_ring; | 1333 | struct qlcnic_host_tx_ring *tx_ring; |
1334 | struct qlcnic_esw_statistics port_stats; | 1334 | struct qlcnic_esw_statistics port_stats; |
1335 | struct qlcnic_mac_statistics mac_stats; | 1335 | struct qlcnic_mac_statistics mac_stats; |
1336 | int index, ret, length, size, tx_size, ring; | 1336 | int index, ret, length, size, ring; |
1337 | char *p; | 1337 | char *p; |
1338 | 1338 | ||
1339 | tx_size = adapter->drv_tx_rings * QLCNIC_TX_STATS_LEN; | 1339 | memset(data, 0, stats->n_stats * sizeof(u64)); |
1340 | 1340 | ||
1341 | memset(data, 0, tx_size * sizeof(u64)); | ||
1342 | for (ring = 0, index = 0; ring < adapter->drv_tx_rings; ring++) { | 1341 | for (ring = 0, index = 0; ring < adapter->drv_tx_rings; ring++) { |
1343 | if (test_bit(__QLCNIC_DEV_UP, &adapter->state)) { | 1342 | if (adapter->is_up == QLCNIC_ADAPTER_UP_MAGIC) { |
1344 | tx_ring = &adapter->tx_ring[ring]; | 1343 | tx_ring = &adapter->tx_ring[ring]; |
1345 | data = qlcnic_fill_tx_queue_stats(data, tx_ring); | 1344 | data = qlcnic_fill_tx_queue_stats(data, tx_ring); |
1346 | qlcnic_update_stats(adapter); | 1345 | qlcnic_update_stats(adapter); |
1346 | } else { | ||
1347 | data += QLCNIC_TX_STATS_LEN; | ||
1347 | } | 1348 | } |
1348 | } | 1349 | } |
1349 | 1350 | ||
1350 | memset(data, 0, stats->n_stats * sizeof(u64)); | ||
1351 | length = QLCNIC_STATS_LEN; | 1351 | length = QLCNIC_STATS_LEN; |
1352 | for (index = 0; index < length; index++) { | 1352 | for (index = 0; index < length; index++) { |
1353 | p = (char *)adapter + qlcnic_gstrings_stats[index].stat_offset; | 1353 | p = (char *)adapter + qlcnic_gstrings_stats[index].stat_offset; |
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index 9dbb02d9d9c2..9979f67de3aa 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | |||
@@ -2786,8 +2786,15 @@ struct stmmac_priv *stmmac_dvr_probe(struct device *device, | |||
2786 | if (IS_ERR(priv->stmmac_clk)) { | 2786 | if (IS_ERR(priv->stmmac_clk)) { |
2787 | dev_warn(priv->device, "%s: warning: cannot get CSR clock\n", | 2787 | dev_warn(priv->device, "%s: warning: cannot get CSR clock\n", |
2788 | __func__); | 2788 | __func__); |
2789 | ret = PTR_ERR(priv->stmmac_clk); | 2789 | /* If failed to obtain stmmac_clk and specific clk_csr value |
2790 | goto error_clk_get; | 2790 | * is NOT passed from the platform, probe fail. |
2791 | */ | ||
2792 | if (!priv->plat->clk_csr) { | ||
2793 | ret = PTR_ERR(priv->stmmac_clk); | ||
2794 | goto error_clk_get; | ||
2795 | } else { | ||
2796 | priv->stmmac_clk = NULL; | ||
2797 | } | ||
2791 | } | 2798 | } |
2792 | clk_prepare_enable(priv->stmmac_clk); | 2799 | clk_prepare_enable(priv->stmmac_clk); |
2793 | 2800 | ||
diff --git a/drivers/net/hyperv/netvsc_drv.c b/drivers/net/hyperv/netvsc_drv.c index a9c5eaadc426..0fcb5e7eb073 100644 --- a/drivers/net/hyperv/netvsc_drv.c +++ b/drivers/net/hyperv/netvsc_drv.c | |||
@@ -387,6 +387,7 @@ static int netvsc_start_xmit(struct sk_buff *skb, struct net_device *net) | |||
387 | int hdr_offset; | 387 | int hdr_offset; |
388 | u32 net_trans_info; | 388 | u32 net_trans_info; |
389 | u32 hash; | 389 | u32 hash; |
390 | u32 skb_length = skb->len; | ||
390 | 391 | ||
391 | 392 | ||
392 | /* We will atmost need two pages to describe the rndis | 393 | /* We will atmost need two pages to describe the rndis |
@@ -562,7 +563,7 @@ do_send: | |||
562 | 563 | ||
563 | drop: | 564 | drop: |
564 | if (ret == 0) { | 565 | if (ret == 0) { |
565 | net->stats.tx_bytes += skb->len; | 566 | net->stats.tx_bytes += skb_length; |
566 | net->stats.tx_packets++; | 567 | net->stats.tx_packets++; |
567 | } else { | 568 | } else { |
568 | kfree(packet); | 569 | kfree(packet); |
diff --git a/drivers/net/macvtap.c b/drivers/net/macvtap.c index 3381c4f91a8c..0c6adaaf898c 100644 --- a/drivers/net/macvtap.c +++ b/drivers/net/macvtap.c | |||
@@ -112,17 +112,15 @@ out: | |||
112 | return err; | 112 | return err; |
113 | } | 113 | } |
114 | 114 | ||
115 | /* Requires RTNL */ | ||
115 | static int macvtap_set_queue(struct net_device *dev, struct file *file, | 116 | static int macvtap_set_queue(struct net_device *dev, struct file *file, |
116 | struct macvtap_queue *q) | 117 | struct macvtap_queue *q) |
117 | { | 118 | { |
118 | struct macvlan_dev *vlan = netdev_priv(dev); | 119 | struct macvlan_dev *vlan = netdev_priv(dev); |
119 | int err = -EBUSY; | ||
120 | 120 | ||
121 | rtnl_lock(); | ||
122 | if (vlan->numqueues == MAX_MACVTAP_QUEUES) | 121 | if (vlan->numqueues == MAX_MACVTAP_QUEUES) |
123 | goto out; | 122 | return -EBUSY; |
124 | 123 | ||
125 | err = 0; | ||
126 | rcu_assign_pointer(q->vlan, vlan); | 124 | rcu_assign_pointer(q->vlan, vlan); |
127 | rcu_assign_pointer(vlan->taps[vlan->numvtaps], q); | 125 | rcu_assign_pointer(vlan->taps[vlan->numvtaps], q); |
128 | sock_hold(&q->sk); | 126 | sock_hold(&q->sk); |
@@ -136,9 +134,7 @@ static int macvtap_set_queue(struct net_device *dev, struct file *file, | |||
136 | vlan->numvtaps++; | 134 | vlan->numvtaps++; |
137 | vlan->numqueues++; | 135 | vlan->numqueues++; |
138 | 136 | ||
139 | out: | 137 | return 0; |
140 | rtnl_unlock(); | ||
141 | return err; | ||
142 | } | 138 | } |
143 | 139 | ||
144 | static int macvtap_disable_queue(struct macvtap_queue *q) | 140 | static int macvtap_disable_queue(struct macvtap_queue *q) |
@@ -454,11 +450,12 @@ static void macvtap_sock_destruct(struct sock *sk) | |||
454 | static int macvtap_open(struct inode *inode, struct file *file) | 450 | static int macvtap_open(struct inode *inode, struct file *file) |
455 | { | 451 | { |
456 | struct net *net = current->nsproxy->net_ns; | 452 | struct net *net = current->nsproxy->net_ns; |
457 | struct net_device *dev = dev_get_by_macvtap_minor(iminor(inode)); | 453 | struct net_device *dev; |
458 | struct macvtap_queue *q; | 454 | struct macvtap_queue *q; |
459 | int err; | 455 | int err = -ENODEV; |
460 | 456 | ||
461 | err = -ENODEV; | 457 | rtnl_lock(); |
458 | dev = dev_get_by_macvtap_minor(iminor(inode)); | ||
462 | if (!dev) | 459 | if (!dev) |
463 | goto out; | 460 | goto out; |
464 | 461 | ||
@@ -498,6 +495,7 @@ out: | |||
498 | if (dev) | 495 | if (dev) |
499 | dev_put(dev); | 496 | dev_put(dev); |
500 | 497 | ||
498 | rtnl_unlock(); | ||
501 | return err; | 499 | return err; |
502 | } | 500 | } |
503 | 501 | ||
diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c index a4d4c4a1354f..b9a98152815b 100644 --- a/drivers/net/usb/r8152.c +++ b/drivers/net/usb/r8152.c | |||
@@ -26,7 +26,7 @@ | |||
26 | #include <linux/mdio.h> | 26 | #include <linux/mdio.h> |
27 | 27 | ||
28 | /* Version Information */ | 28 | /* Version Information */ |
29 | #define DRIVER_VERSION "v1.06.0 (2014/03/03)" | 29 | #define DRIVER_VERSION "v1.06.1 (2014/10/01)" |
30 | #define DRIVER_AUTHOR "Realtek linux nic maintainers <nic_swsd@realtek.com>" | 30 | #define DRIVER_AUTHOR "Realtek linux nic maintainers <nic_swsd@realtek.com>" |
31 | #define DRIVER_DESC "Realtek RTL8152/RTL8153 Based USB Ethernet Adapters" | 31 | #define DRIVER_DESC "Realtek RTL8152/RTL8153 Based USB Ethernet Adapters" |
32 | #define MODULENAME "r8152" | 32 | #define MODULENAME "r8152" |
@@ -1979,10 +1979,34 @@ static void rxdy_gated_en(struct r8152 *tp, bool enable) | |||
1979 | ocp_write_word(tp, MCU_TYPE_PLA, PLA_MISC_1, ocp_data); | 1979 | ocp_write_word(tp, MCU_TYPE_PLA, PLA_MISC_1, ocp_data); |
1980 | } | 1980 | } |
1981 | 1981 | ||
1982 | static int rtl_start_rx(struct r8152 *tp) | ||
1983 | { | ||
1984 | int i, ret = 0; | ||
1985 | |||
1986 | INIT_LIST_HEAD(&tp->rx_done); | ||
1987 | for (i = 0; i < RTL8152_MAX_RX; i++) { | ||
1988 | INIT_LIST_HEAD(&tp->rx_info[i].list); | ||
1989 | ret = r8152_submit_rx(tp, &tp->rx_info[i], GFP_KERNEL); | ||
1990 | if (ret) | ||
1991 | break; | ||
1992 | } | ||
1993 | |||
1994 | return ret; | ||
1995 | } | ||
1996 | |||
1997 | static int rtl_stop_rx(struct r8152 *tp) | ||
1998 | { | ||
1999 | int i; | ||
2000 | |||
2001 | for (i = 0; i < RTL8152_MAX_RX; i++) | ||
2002 | usb_kill_urb(tp->rx_info[i].urb); | ||
2003 | |||
2004 | return 0; | ||
2005 | } | ||
2006 | |||
1982 | static int rtl_enable(struct r8152 *tp) | 2007 | static int rtl_enable(struct r8152 *tp) |
1983 | { | 2008 | { |
1984 | u32 ocp_data; | 2009 | u32 ocp_data; |
1985 | int i, ret; | ||
1986 | 2010 | ||
1987 | r8152b_reset_packet_filter(tp); | 2011 | r8152b_reset_packet_filter(tp); |
1988 | 2012 | ||
@@ -1992,14 +2016,7 @@ static int rtl_enable(struct r8152 *tp) | |||
1992 | 2016 | ||
1993 | rxdy_gated_en(tp, false); | 2017 | rxdy_gated_en(tp, false); |
1994 | 2018 | ||
1995 | INIT_LIST_HEAD(&tp->rx_done); | 2019 | return rtl_start_rx(tp); |
1996 | ret = 0; | ||
1997 | for (i = 0; i < RTL8152_MAX_RX; i++) { | ||
1998 | INIT_LIST_HEAD(&tp->rx_info[i].list); | ||
1999 | ret |= r8152_submit_rx(tp, &tp->rx_info[i], GFP_KERNEL); | ||
2000 | } | ||
2001 | |||
2002 | return ret; | ||
2003 | } | 2020 | } |
2004 | 2021 | ||
2005 | static int rtl8152_enable(struct r8152 *tp) | 2022 | static int rtl8152_enable(struct r8152 *tp) |
@@ -2083,8 +2100,7 @@ static void rtl_disable(struct r8152 *tp) | |||
2083 | usleep_range(1000, 2000); | 2100 | usleep_range(1000, 2000); |
2084 | } | 2101 | } |
2085 | 2102 | ||
2086 | for (i = 0; i < RTL8152_MAX_RX; i++) | 2103 | rtl_stop_rx(tp); |
2087 | usb_kill_urb(tp->rx_info[i].urb); | ||
2088 | 2104 | ||
2089 | rtl8152_nic_reset(tp); | 2105 | rtl8152_nic_reset(tp); |
2090 | } | 2106 | } |
@@ -2243,28 +2259,6 @@ static void rtl_phy_reset(struct r8152 *tp) | |||
2243 | } | 2259 | } |
2244 | } | 2260 | } |
2245 | 2261 | ||
2246 | static void rtl_clear_bp(struct r8152 *tp) | ||
2247 | { | ||
2248 | ocp_write_dword(tp, MCU_TYPE_PLA, PLA_BP_0, 0); | ||
2249 | ocp_write_dword(tp, MCU_TYPE_PLA, PLA_BP_2, 0); | ||
2250 | ocp_write_dword(tp, MCU_TYPE_PLA, PLA_BP_4, 0); | ||
2251 | ocp_write_dword(tp, MCU_TYPE_PLA, PLA_BP_6, 0); | ||
2252 | ocp_write_dword(tp, MCU_TYPE_USB, USB_BP_0, 0); | ||
2253 | ocp_write_dword(tp, MCU_TYPE_USB, USB_BP_2, 0); | ||
2254 | ocp_write_dword(tp, MCU_TYPE_USB, USB_BP_4, 0); | ||
2255 | ocp_write_dword(tp, MCU_TYPE_USB, USB_BP_6, 0); | ||
2256 | usleep_range(3000, 6000); | ||
2257 | ocp_write_word(tp, MCU_TYPE_PLA, PLA_BP_BA, 0); | ||
2258 | ocp_write_word(tp, MCU_TYPE_USB, USB_BP_BA, 0); | ||
2259 | } | ||
2260 | |||
2261 | static void r8153_clear_bp(struct r8152 *tp) | ||
2262 | { | ||
2263 | ocp_write_byte(tp, MCU_TYPE_PLA, PLA_BP_EN, 0); | ||
2264 | ocp_write_byte(tp, MCU_TYPE_USB, USB_BP_EN, 0); | ||
2265 | rtl_clear_bp(tp); | ||
2266 | } | ||
2267 | |||
2268 | static void r8153_teredo_off(struct r8152 *tp) | 2262 | static void r8153_teredo_off(struct r8152 *tp) |
2269 | { | 2263 | { |
2270 | u32 ocp_data; | 2264 | u32 ocp_data; |
@@ -2307,8 +2301,6 @@ static void r8152b_hw_phy_cfg(struct r8152 *tp) | |||
2307 | r8152_mdio_write(tp, MII_BMCR, data); | 2301 | r8152_mdio_write(tp, MII_BMCR, data); |
2308 | } | 2302 | } |
2309 | 2303 | ||
2310 | rtl_clear_bp(tp); | ||
2311 | |||
2312 | set_bit(PHY_RESET, &tp->flags); | 2304 | set_bit(PHY_RESET, &tp->flags); |
2313 | } | 2305 | } |
2314 | 2306 | ||
@@ -2455,8 +2447,6 @@ static void r8153_hw_phy_cfg(struct r8152 *tp) | |||
2455 | r8152_mdio_write(tp, MII_BMCR, data); | 2447 | r8152_mdio_write(tp, MII_BMCR, data); |
2456 | } | 2448 | } |
2457 | 2449 | ||
2458 | r8153_clear_bp(tp); | ||
2459 | |||
2460 | if (tp->version == RTL_VER_03) { | 2450 | if (tp->version == RTL_VER_03) { |
2461 | data = ocp_reg_read(tp, OCP_EEE_CFG); | 2451 | data = ocp_reg_read(tp, OCP_EEE_CFG); |
2462 | data &= ~CTAP_SHORT_EN; | 2452 | data &= ~CTAP_SHORT_EN; |
@@ -3181,13 +3171,14 @@ static int rtl8152_suspend(struct usb_interface *intf, pm_message_t message) | |||
3181 | clear_bit(WORK_ENABLE, &tp->flags); | 3171 | clear_bit(WORK_ENABLE, &tp->flags); |
3182 | usb_kill_urb(tp->intr_urb); | 3172 | usb_kill_urb(tp->intr_urb); |
3183 | cancel_delayed_work_sync(&tp->schedule); | 3173 | cancel_delayed_work_sync(&tp->schedule); |
3174 | tasklet_disable(&tp->tl); | ||
3184 | if (test_bit(SELECTIVE_SUSPEND, &tp->flags)) { | 3175 | if (test_bit(SELECTIVE_SUSPEND, &tp->flags)) { |
3176 | rtl_stop_rx(tp); | ||
3185 | rtl_runtime_suspend_enable(tp, true); | 3177 | rtl_runtime_suspend_enable(tp, true); |
3186 | } else { | 3178 | } else { |
3187 | tasklet_disable(&tp->tl); | ||
3188 | tp->rtl_ops.down(tp); | 3179 | tp->rtl_ops.down(tp); |
3189 | tasklet_enable(&tp->tl); | ||
3190 | } | 3180 | } |
3181 | tasklet_enable(&tp->tl); | ||
3191 | } | 3182 | } |
3192 | 3183 | ||
3193 | return 0; | 3184 | return 0; |
@@ -3206,18 +3197,19 @@ static int rtl8152_resume(struct usb_interface *intf) | |||
3206 | if (test_bit(SELECTIVE_SUSPEND, &tp->flags)) { | 3197 | if (test_bit(SELECTIVE_SUSPEND, &tp->flags)) { |
3207 | rtl_runtime_suspend_enable(tp, false); | 3198 | rtl_runtime_suspend_enable(tp, false); |
3208 | clear_bit(SELECTIVE_SUSPEND, &tp->flags); | 3199 | clear_bit(SELECTIVE_SUSPEND, &tp->flags); |
3200 | set_bit(WORK_ENABLE, &tp->flags); | ||
3209 | if (tp->speed & LINK_STATUS) | 3201 | if (tp->speed & LINK_STATUS) |
3210 | tp->rtl_ops.disable(tp); | 3202 | rtl_start_rx(tp); |
3211 | } else { | 3203 | } else { |
3212 | tp->rtl_ops.up(tp); | 3204 | tp->rtl_ops.up(tp); |
3213 | rtl8152_set_speed(tp, AUTONEG_ENABLE, | 3205 | rtl8152_set_speed(tp, AUTONEG_ENABLE, |
3214 | tp->mii.supports_gmii ? | 3206 | tp->mii.supports_gmii ? |
3215 | SPEED_1000 : SPEED_100, | 3207 | SPEED_1000 : SPEED_100, |
3216 | DUPLEX_FULL); | 3208 | DUPLEX_FULL); |
3209 | tp->speed = 0; | ||
3210 | netif_carrier_off(tp->netdev); | ||
3211 | set_bit(WORK_ENABLE, &tp->flags); | ||
3217 | } | 3212 | } |
3218 | tp->speed = 0; | ||
3219 | netif_carrier_off(tp->netdev); | ||
3220 | set_bit(WORK_ENABLE, &tp->flags); | ||
3221 | usb_submit_urb(tp->intr_urb, GFP_KERNEL); | 3213 | usb_submit_urb(tp->intr_urb, GFP_KERNEL); |
3222 | } | 3214 | } |
3223 | 3215 | ||
@@ -3623,7 +3615,7 @@ static void rtl8153_unload(struct r8152 *tp) | |||
3623 | if (test_bit(RTL8152_UNPLUG, &tp->flags)) | 3615 | if (test_bit(RTL8152_UNPLUG, &tp->flags)) |
3624 | return; | 3616 | return; |
3625 | 3617 | ||
3626 | r8153_power_cut_en(tp, true); | 3618 | r8153_power_cut_en(tp, false); |
3627 | } | 3619 | } |
3628 | 3620 | ||
3629 | static int rtl_ops_init(struct r8152 *tp, const struct usb_device_id *id) | 3621 | static int rtl_ops_init(struct r8152 *tp, const struct usb_device_id *id) |
@@ -3788,7 +3780,11 @@ static void rtl8152_disconnect(struct usb_interface *intf) | |||
3788 | 3780 | ||
3789 | usb_set_intfdata(intf, NULL); | 3781 | usb_set_intfdata(intf, NULL); |
3790 | if (tp) { | 3782 | if (tp) { |
3791 | set_bit(RTL8152_UNPLUG, &tp->flags); | 3783 | struct usb_device *udev = tp->udev; |
3784 | |||
3785 | if (udev->state == USB_STATE_NOTATTACHED) | ||
3786 | set_bit(RTL8152_UNPLUG, &tp->flags); | ||
3787 | |||
3792 | tasklet_kill(&tp->tl); | 3788 | tasklet_kill(&tp->tl); |
3793 | unregister_netdev(tp->netdev); | 3789 | unregister_netdev(tp->netdev); |
3794 | tp->rtl_ops.unload(tp); | 3790 | tp->rtl_ops.unload(tp); |
diff --git a/drivers/of/base.c b/drivers/of/base.c index d8574adf0d62..293ed4b687ba 100644 --- a/drivers/of/base.c +++ b/drivers/of/base.c | |||
@@ -138,6 +138,9 @@ int __of_add_property_sysfs(struct device_node *np, struct property *pp) | |||
138 | /* Important: Don't leak passwords */ | 138 | /* Important: Don't leak passwords */ |
139 | bool secure = strncmp(pp->name, "security-", 9) == 0; | 139 | bool secure = strncmp(pp->name, "security-", 9) == 0; |
140 | 140 | ||
141 | if (!IS_ENABLED(CONFIG_SYSFS)) | ||
142 | return 0; | ||
143 | |||
141 | if (!of_kset || !of_node_is_attached(np)) | 144 | if (!of_kset || !of_node_is_attached(np)) |
142 | return 0; | 145 | return 0; |
143 | 146 | ||
@@ -158,6 +161,9 @@ int __of_attach_node_sysfs(struct device_node *np) | |||
158 | struct property *pp; | 161 | struct property *pp; |
159 | int rc; | 162 | int rc; |
160 | 163 | ||
164 | if (!IS_ENABLED(CONFIG_SYSFS)) | ||
165 | return 0; | ||
166 | |||
161 | if (!of_kset) | 167 | if (!of_kset) |
162 | return 0; | 168 | return 0; |
163 | 169 | ||
@@ -1713,6 +1719,9 @@ int __of_remove_property(struct device_node *np, struct property *prop) | |||
1713 | 1719 | ||
1714 | void __of_remove_property_sysfs(struct device_node *np, struct property *prop) | 1720 | void __of_remove_property_sysfs(struct device_node *np, struct property *prop) |
1715 | { | 1721 | { |
1722 | if (!IS_ENABLED(CONFIG_SYSFS)) | ||
1723 | return; | ||
1724 | |||
1716 | /* at early boot, bail here and defer setup to of_init() */ | 1725 | /* at early boot, bail here and defer setup to of_init() */ |
1717 | if (of_kset && of_node_is_attached(np)) | 1726 | if (of_kset && of_node_is_attached(np)) |
1718 | sysfs_remove_bin_file(&np->kobj, &prop->attr); | 1727 | sysfs_remove_bin_file(&np->kobj, &prop->attr); |
@@ -1777,6 +1786,9 @@ int __of_update_property(struct device_node *np, struct property *newprop, | |||
1777 | void __of_update_property_sysfs(struct device_node *np, struct property *newprop, | 1786 | void __of_update_property_sysfs(struct device_node *np, struct property *newprop, |
1778 | struct property *oldprop) | 1787 | struct property *oldprop) |
1779 | { | 1788 | { |
1789 | if (!IS_ENABLED(CONFIG_SYSFS)) | ||
1790 | return; | ||
1791 | |||
1780 | /* At early boot, bail out and defer setup to of_init() */ | 1792 | /* At early boot, bail out and defer setup to of_init() */ |
1781 | if (!of_kset) | 1793 | if (!of_kset) |
1782 | return; | 1794 | return; |
@@ -1847,6 +1859,7 @@ void of_alias_scan(void * (*dt_alloc)(u64 size, u64 align)) | |||
1847 | { | 1859 | { |
1848 | struct property *pp; | 1860 | struct property *pp; |
1849 | 1861 | ||
1862 | of_aliases = of_find_node_by_path("/aliases"); | ||
1850 | of_chosen = of_find_node_by_path("/chosen"); | 1863 | of_chosen = of_find_node_by_path("/chosen"); |
1851 | if (of_chosen == NULL) | 1864 | if (of_chosen == NULL) |
1852 | of_chosen = of_find_node_by_path("/chosen@0"); | 1865 | of_chosen = of_find_node_by_path("/chosen@0"); |
@@ -1862,7 +1875,6 @@ void of_alias_scan(void * (*dt_alloc)(u64 size, u64 align)) | |||
1862 | of_stdout = of_find_node_by_path(name); | 1875 | of_stdout = of_find_node_by_path(name); |
1863 | } | 1876 | } |
1864 | 1877 | ||
1865 | of_aliases = of_find_node_by_path("/aliases"); | ||
1866 | if (!of_aliases) | 1878 | if (!of_aliases) |
1867 | return; | 1879 | return; |
1868 | 1880 | ||
@@ -1986,7 +1998,7 @@ bool of_console_check(struct device_node *dn, char *name, int index) | |||
1986 | { | 1998 | { |
1987 | if (!dn || dn != of_stdout || console_set_on_cmdline) | 1999 | if (!dn || dn != of_stdout || console_set_on_cmdline) |
1988 | return false; | 2000 | return false; |
1989 | return add_preferred_console(name, index, NULL); | 2001 | return !add_preferred_console(name, index, NULL); |
1990 | } | 2002 | } |
1991 | EXPORT_SYMBOL_GPL(of_console_check); | 2003 | EXPORT_SYMBOL_GPL(of_console_check); |
1992 | 2004 | ||
diff --git a/drivers/of/dynamic.c b/drivers/of/dynamic.c index 54fecc49a1fe..f297891d8529 100644 --- a/drivers/of/dynamic.c +++ b/drivers/of/dynamic.c | |||
@@ -45,6 +45,9 @@ void __of_detach_node_sysfs(struct device_node *np) | |||
45 | { | 45 | { |
46 | struct property *pp; | 46 | struct property *pp; |
47 | 47 | ||
48 | if (!IS_ENABLED(CONFIG_SYSFS)) | ||
49 | return; | ||
50 | |||
48 | BUG_ON(!of_node_is_initialized(np)); | 51 | BUG_ON(!of_node_is_initialized(np)); |
49 | if (!of_kset) | 52 | if (!of_kset) |
50 | return; | 53 | return; |
diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c index 79cb8313c7d8..d1ffca8b34ea 100644 --- a/drivers/of/fdt.c +++ b/drivers/of/fdt.c | |||
@@ -928,7 +928,11 @@ int __init early_init_dt_scan_chosen(unsigned long node, const char *uname, | |||
928 | void __init __weak early_init_dt_add_memory_arch(u64 base, u64 size) | 928 | void __init __weak early_init_dt_add_memory_arch(u64 base, u64 size) |
929 | { | 929 | { |
930 | const u64 phys_offset = __pa(PAGE_OFFSET); | 930 | const u64 phys_offset = __pa(PAGE_OFFSET); |
931 | base &= PAGE_MASK; | 931 | |
932 | if (!PAGE_ALIGNED(base)) { | ||
933 | size -= PAGE_SIZE - (base & ~PAGE_MASK); | ||
934 | base = PAGE_ALIGN(base); | ||
935 | } | ||
932 | size &= PAGE_MASK; | 936 | size &= PAGE_MASK; |
933 | 937 | ||
934 | if (base > MAX_PHYS_ADDR) { | 938 | if (base > MAX_PHYS_ADDR) { |
@@ -937,10 +941,10 @@ void __init __weak early_init_dt_add_memory_arch(u64 base, u64 size) | |||
937 | return; | 941 | return; |
938 | } | 942 | } |
939 | 943 | ||
940 | if (base + size > MAX_PHYS_ADDR) { | 944 | if (base + size - 1 > MAX_PHYS_ADDR) { |
941 | pr_warning("Ignoring memory range 0x%lx - 0x%llx\n", | 945 | pr_warning("Ignoring memory range 0x%llx - 0x%llx\n", |
942 | ULONG_MAX, base + size); | 946 | ((u64)MAX_PHYS_ADDR) + 1, base + size); |
943 | size = MAX_PHYS_ADDR - base; | 947 | size = MAX_PHYS_ADDR - base + 1; |
944 | } | 948 | } |
945 | 949 | ||
946 | if (base + size < phys_offset) { | 950 | if (base + size < phys_offset) { |
diff --git a/drivers/rtc/rtc-efi.c b/drivers/rtc/rtc-efi.c index 8225b89de810..c384fec6d173 100644 --- a/drivers/rtc/rtc-efi.c +++ b/drivers/rtc/rtc-efi.c | |||
@@ -232,6 +232,7 @@ static struct platform_driver efi_rtc_driver = { | |||
232 | 232 | ||
233 | module_platform_driver_probe(efi_rtc_driver, efi_rtc_probe); | 233 | module_platform_driver_probe(efi_rtc_driver, efi_rtc_probe); |
234 | 234 | ||
235 | MODULE_ALIAS("platform:rtc-efi"); | ||
235 | MODULE_AUTHOR("dann frazier <dannf@hp.com>"); | 236 | MODULE_AUTHOR("dann frazier <dannf@hp.com>"); |
236 | MODULE_LICENSE("GPL"); | 237 | MODULE_LICENSE("GPL"); |
237 | MODULE_DESCRIPTION("EFI RTC driver"); | 238 | MODULE_DESCRIPTION("EFI RTC driver"); |
diff --git a/drivers/soc/qcom/qcom_gsbi.c b/drivers/soc/qcom/qcom_gsbi.c index 447458e696a9..7e1f120f2b32 100644 --- a/drivers/soc/qcom/qcom_gsbi.c +++ b/drivers/soc/qcom/qcom_gsbi.c | |||
@@ -22,44 +22,63 @@ | |||
22 | #define GSBI_CTRL_REG 0x0000 | 22 | #define GSBI_CTRL_REG 0x0000 |
23 | #define GSBI_PROTOCOL_SHIFT 4 | 23 | #define GSBI_PROTOCOL_SHIFT 4 |
24 | 24 | ||
25 | struct gsbi_info { | ||
26 | struct clk *hclk; | ||
27 | u32 mode; | ||
28 | u32 crci; | ||
29 | }; | ||
30 | |||
25 | static int gsbi_probe(struct platform_device *pdev) | 31 | static int gsbi_probe(struct platform_device *pdev) |
26 | { | 32 | { |
27 | struct device_node *node = pdev->dev.of_node; | 33 | struct device_node *node = pdev->dev.of_node; |
28 | struct resource *res; | 34 | struct resource *res; |
29 | void __iomem *base; | 35 | void __iomem *base; |
30 | struct clk *hclk; | 36 | struct gsbi_info *gsbi; |
31 | u32 mode, crci = 0; | 37 | |
38 | gsbi = devm_kzalloc(&pdev->dev, sizeof(*gsbi), GFP_KERNEL); | ||
39 | |||
40 | if (!gsbi) | ||
41 | return -ENOMEM; | ||
32 | 42 | ||
33 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 43 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
34 | base = devm_ioremap_resource(&pdev->dev, res); | 44 | base = devm_ioremap_resource(&pdev->dev, res); |
35 | if (IS_ERR(base)) | 45 | if (IS_ERR(base)) |
36 | return PTR_ERR(base); | 46 | return PTR_ERR(base); |
37 | 47 | ||
38 | if (of_property_read_u32(node, "qcom,mode", &mode)) { | 48 | if (of_property_read_u32(node, "qcom,mode", &gsbi->mode)) { |
39 | dev_err(&pdev->dev, "missing mode configuration\n"); | 49 | dev_err(&pdev->dev, "missing mode configuration\n"); |
40 | return -EINVAL; | 50 | return -EINVAL; |
41 | } | 51 | } |
42 | 52 | ||
43 | /* not required, so default to 0 if not present */ | 53 | /* not required, so default to 0 if not present */ |
44 | of_property_read_u32(node, "qcom,crci", &crci); | 54 | of_property_read_u32(node, "qcom,crci", &gsbi->crci); |
45 | 55 | ||
46 | dev_info(&pdev->dev, "GSBI port protocol: %d crci: %d\n", mode, crci); | 56 | dev_info(&pdev->dev, "GSBI port protocol: %d crci: %d\n", |
57 | gsbi->mode, gsbi->crci); | ||
58 | gsbi->hclk = devm_clk_get(&pdev->dev, "iface"); | ||
59 | if (IS_ERR(gsbi->hclk)) | ||
60 | return PTR_ERR(gsbi->hclk); | ||
47 | 61 | ||
48 | hclk = devm_clk_get(&pdev->dev, "iface"); | 62 | clk_prepare_enable(gsbi->hclk); |
49 | if (IS_ERR(hclk)) | ||
50 | return PTR_ERR(hclk); | ||
51 | 63 | ||
52 | clk_prepare_enable(hclk); | 64 | writel_relaxed((gsbi->mode << GSBI_PROTOCOL_SHIFT) | gsbi->crci, |
53 | |||
54 | writel_relaxed((mode << GSBI_PROTOCOL_SHIFT) | crci, | ||
55 | base + GSBI_CTRL_REG); | 65 | base + GSBI_CTRL_REG); |
56 | 66 | ||
57 | /* make sure the gsbi control write is not reordered */ | 67 | /* make sure the gsbi control write is not reordered */ |
58 | wmb(); | 68 | wmb(); |
59 | 69 | ||
60 | clk_disable_unprepare(hclk); | 70 | platform_set_drvdata(pdev, gsbi); |
71 | |||
72 | return of_platform_populate(node, NULL, NULL, &pdev->dev); | ||
73 | } | ||
74 | |||
75 | static int gsbi_remove(struct platform_device *pdev) | ||
76 | { | ||
77 | struct gsbi_info *gsbi = platform_get_drvdata(pdev); | ||
78 | |||
79 | clk_disable_unprepare(gsbi->hclk); | ||
61 | 80 | ||
62 | return of_platform_populate(pdev->dev.of_node, NULL, NULL, &pdev->dev); | 81 | return 0; |
63 | } | 82 | } |
64 | 83 | ||
65 | static const struct of_device_id gsbi_dt_match[] = { | 84 | static const struct of_device_id gsbi_dt_match[] = { |
@@ -76,6 +95,7 @@ static struct platform_driver gsbi_driver = { | |||
76 | .of_match_table = gsbi_dt_match, | 95 | .of_match_table = gsbi_dt_match, |
77 | }, | 96 | }, |
78 | .probe = gsbi_probe, | 97 | .probe = gsbi_probe, |
98 | .remove = gsbi_remove, | ||
79 | }; | 99 | }; |
80 | 100 | ||
81 | module_platform_driver(gsbi_driver); | 101 | module_platform_driver(gsbi_driver); |
diff --git a/fs/cachefiles/bind.c b/fs/cachefiles/bind.c index d749731dc0ee..fbb08e97438d 100644 --- a/fs/cachefiles/bind.c +++ b/fs/cachefiles/bind.c | |||
@@ -50,18 +50,18 @@ int cachefiles_daemon_bind(struct cachefiles_cache *cache, char *args) | |||
50 | cache->brun_percent < 100); | 50 | cache->brun_percent < 100); |
51 | 51 | ||
52 | if (*args) { | 52 | if (*args) { |
53 | pr_err("'bind' command doesn't take an argument"); | 53 | pr_err("'bind' command doesn't take an argument\n"); |
54 | return -EINVAL; | 54 | return -EINVAL; |
55 | } | 55 | } |
56 | 56 | ||
57 | if (!cache->rootdirname) { | 57 | if (!cache->rootdirname) { |
58 | pr_err("No cache directory specified"); | 58 | pr_err("No cache directory specified\n"); |
59 | return -EINVAL; | 59 | return -EINVAL; |
60 | } | 60 | } |
61 | 61 | ||
62 | /* don't permit already bound caches to be re-bound */ | 62 | /* don't permit already bound caches to be re-bound */ |
63 | if (test_bit(CACHEFILES_READY, &cache->flags)) { | 63 | if (test_bit(CACHEFILES_READY, &cache->flags)) { |
64 | pr_err("Cache already bound"); | 64 | pr_err("Cache already bound\n"); |
65 | return -EBUSY; | 65 | return -EBUSY; |
66 | } | 66 | } |
67 | 67 | ||
@@ -248,7 +248,7 @@ error_open_root: | |||
248 | kmem_cache_free(cachefiles_object_jar, fsdef); | 248 | kmem_cache_free(cachefiles_object_jar, fsdef); |
249 | error_root_object: | 249 | error_root_object: |
250 | cachefiles_end_secure(cache, saved_cred); | 250 | cachefiles_end_secure(cache, saved_cred); |
251 | pr_err("Failed to register: %d", ret); | 251 | pr_err("Failed to register: %d\n", ret); |
252 | return ret; | 252 | return ret; |
253 | } | 253 | } |
254 | 254 | ||
diff --git a/fs/cachefiles/daemon.c b/fs/cachefiles/daemon.c index b078d3081d6c..ce1b115dcc28 100644 --- a/fs/cachefiles/daemon.c +++ b/fs/cachefiles/daemon.c | |||
@@ -315,7 +315,7 @@ static unsigned int cachefiles_daemon_poll(struct file *file, | |||
315 | static int cachefiles_daemon_range_error(struct cachefiles_cache *cache, | 315 | static int cachefiles_daemon_range_error(struct cachefiles_cache *cache, |
316 | char *args) | 316 | char *args) |
317 | { | 317 | { |
318 | pr_err("Free space limits must be in range 0%%<=stop<cull<run<100%%"); | 318 | pr_err("Free space limits must be in range 0%%<=stop<cull<run<100%%\n"); |
319 | 319 | ||
320 | return -EINVAL; | 320 | return -EINVAL; |
321 | } | 321 | } |
@@ -475,12 +475,12 @@ static int cachefiles_daemon_dir(struct cachefiles_cache *cache, char *args) | |||
475 | _enter(",%s", args); | 475 | _enter(",%s", args); |
476 | 476 | ||
477 | if (!*args) { | 477 | if (!*args) { |
478 | pr_err("Empty directory specified"); | 478 | pr_err("Empty directory specified\n"); |
479 | return -EINVAL; | 479 | return -EINVAL; |
480 | } | 480 | } |
481 | 481 | ||
482 | if (cache->rootdirname) { | 482 | if (cache->rootdirname) { |
483 | pr_err("Second cache directory specified"); | 483 | pr_err("Second cache directory specified\n"); |
484 | return -EEXIST; | 484 | return -EEXIST; |
485 | } | 485 | } |
486 | 486 | ||
@@ -503,12 +503,12 @@ static int cachefiles_daemon_secctx(struct cachefiles_cache *cache, char *args) | |||
503 | _enter(",%s", args); | 503 | _enter(",%s", args); |
504 | 504 | ||
505 | if (!*args) { | 505 | if (!*args) { |
506 | pr_err("Empty security context specified"); | 506 | pr_err("Empty security context specified\n"); |
507 | return -EINVAL; | 507 | return -EINVAL; |
508 | } | 508 | } |
509 | 509 | ||
510 | if (cache->secctx) { | 510 | if (cache->secctx) { |
511 | pr_err("Second security context specified"); | 511 | pr_err("Second security context specified\n"); |
512 | return -EINVAL; | 512 | return -EINVAL; |
513 | } | 513 | } |
514 | 514 | ||
@@ -531,7 +531,7 @@ static int cachefiles_daemon_tag(struct cachefiles_cache *cache, char *args) | |||
531 | _enter(",%s", args); | 531 | _enter(",%s", args); |
532 | 532 | ||
533 | if (!*args) { | 533 | if (!*args) { |
534 | pr_err("Empty tag specified"); | 534 | pr_err("Empty tag specified\n"); |
535 | return -EINVAL; | 535 | return -EINVAL; |
536 | } | 536 | } |
537 | 537 | ||
@@ -562,12 +562,12 @@ static int cachefiles_daemon_cull(struct cachefiles_cache *cache, char *args) | |||
562 | goto inval; | 562 | goto inval; |
563 | 563 | ||
564 | if (!test_bit(CACHEFILES_READY, &cache->flags)) { | 564 | if (!test_bit(CACHEFILES_READY, &cache->flags)) { |
565 | pr_err("cull applied to unready cache"); | 565 | pr_err("cull applied to unready cache\n"); |
566 | return -EIO; | 566 | return -EIO; |
567 | } | 567 | } |
568 | 568 | ||
569 | if (test_bit(CACHEFILES_DEAD, &cache->flags)) { | 569 | if (test_bit(CACHEFILES_DEAD, &cache->flags)) { |
570 | pr_err("cull applied to dead cache"); | 570 | pr_err("cull applied to dead cache\n"); |
571 | return -EIO; | 571 | return -EIO; |
572 | } | 572 | } |
573 | 573 | ||
@@ -587,11 +587,11 @@ static int cachefiles_daemon_cull(struct cachefiles_cache *cache, char *args) | |||
587 | 587 | ||
588 | notdir: | 588 | notdir: |
589 | path_put(&path); | 589 | path_put(&path); |
590 | pr_err("cull command requires dirfd to be a directory"); | 590 | pr_err("cull command requires dirfd to be a directory\n"); |
591 | return -ENOTDIR; | 591 | return -ENOTDIR; |
592 | 592 | ||
593 | inval: | 593 | inval: |
594 | pr_err("cull command requires dirfd and filename"); | 594 | pr_err("cull command requires dirfd and filename\n"); |
595 | return -EINVAL; | 595 | return -EINVAL; |
596 | } | 596 | } |
597 | 597 | ||
@@ -614,7 +614,7 @@ static int cachefiles_daemon_debug(struct cachefiles_cache *cache, char *args) | |||
614 | return 0; | 614 | return 0; |
615 | 615 | ||
616 | inval: | 616 | inval: |
617 | pr_err("debug command requires mask"); | 617 | pr_err("debug command requires mask\n"); |
618 | return -EINVAL; | 618 | return -EINVAL; |
619 | } | 619 | } |
620 | 620 | ||
@@ -634,12 +634,12 @@ static int cachefiles_daemon_inuse(struct cachefiles_cache *cache, char *args) | |||
634 | goto inval; | 634 | goto inval; |
635 | 635 | ||
636 | if (!test_bit(CACHEFILES_READY, &cache->flags)) { | 636 | if (!test_bit(CACHEFILES_READY, &cache->flags)) { |
637 | pr_err("inuse applied to unready cache"); | 637 | pr_err("inuse applied to unready cache\n"); |
638 | return -EIO; | 638 | return -EIO; |
639 | } | 639 | } |
640 | 640 | ||
641 | if (test_bit(CACHEFILES_DEAD, &cache->flags)) { | 641 | if (test_bit(CACHEFILES_DEAD, &cache->flags)) { |
642 | pr_err("inuse applied to dead cache"); | 642 | pr_err("inuse applied to dead cache\n"); |
643 | return -EIO; | 643 | return -EIO; |
644 | } | 644 | } |
645 | 645 | ||
@@ -659,11 +659,11 @@ static int cachefiles_daemon_inuse(struct cachefiles_cache *cache, char *args) | |||
659 | 659 | ||
660 | notdir: | 660 | notdir: |
661 | path_put(&path); | 661 | path_put(&path); |
662 | pr_err("inuse command requires dirfd to be a directory"); | 662 | pr_err("inuse command requires dirfd to be a directory\n"); |
663 | return -ENOTDIR; | 663 | return -ENOTDIR; |
664 | 664 | ||
665 | inval: | 665 | inval: |
666 | pr_err("inuse command requires dirfd and filename"); | 666 | pr_err("inuse command requires dirfd and filename\n"); |
667 | return -EINVAL; | 667 | return -EINVAL; |
668 | } | 668 | } |
669 | 669 | ||
diff --git a/fs/cachefiles/internal.h b/fs/cachefiles/internal.h index 3d50998abf57..8c52472d2efa 100644 --- a/fs/cachefiles/internal.h +++ b/fs/cachefiles/internal.h | |||
@@ -255,7 +255,7 @@ extern int cachefiles_remove_object_xattr(struct cachefiles_cache *cache, | |||
255 | 255 | ||
256 | #define cachefiles_io_error(___cache, FMT, ...) \ | 256 | #define cachefiles_io_error(___cache, FMT, ...) \ |
257 | do { \ | 257 | do { \ |
258 | pr_err("I/O Error: " FMT, ##__VA_ARGS__); \ | 258 | pr_err("I/O Error: " FMT"\n", ##__VA_ARGS__); \ |
259 | fscache_io_error(&(___cache)->cache); \ | 259 | fscache_io_error(&(___cache)->cache); \ |
260 | set_bit(CACHEFILES_DEAD, &(___cache)->flags); \ | 260 | set_bit(CACHEFILES_DEAD, &(___cache)->flags); \ |
261 | } while (0) | 261 | } while (0) |
diff --git a/fs/cachefiles/main.c b/fs/cachefiles/main.c index 180edfb45f66..711f13d8c2de 100644 --- a/fs/cachefiles/main.c +++ b/fs/cachefiles/main.c | |||
@@ -84,7 +84,7 @@ error_proc: | |||
84 | error_object_jar: | 84 | error_object_jar: |
85 | misc_deregister(&cachefiles_dev); | 85 | misc_deregister(&cachefiles_dev); |
86 | error_dev: | 86 | error_dev: |
87 | pr_err("failed to register: %d", ret); | 87 | pr_err("failed to register: %d\n", ret); |
88 | return ret; | 88 | return ret; |
89 | } | 89 | } |
90 | 90 | ||
diff --git a/fs/cachefiles/namei.c b/fs/cachefiles/namei.c index 83e9c94ca2cf..dad7d9542a24 100644 --- a/fs/cachefiles/namei.c +++ b/fs/cachefiles/namei.c | |||
@@ -543,7 +543,7 @@ lookup_again: | |||
543 | next, next->d_inode, next->d_inode->i_ino); | 543 | next, next->d_inode, next->d_inode->i_ino); |
544 | 544 | ||
545 | } else if (!S_ISDIR(next->d_inode->i_mode)) { | 545 | } else if (!S_ISDIR(next->d_inode->i_mode)) { |
546 | pr_err("inode %lu is not a directory", | 546 | pr_err("inode %lu is not a directory\n", |
547 | next->d_inode->i_ino); | 547 | next->d_inode->i_ino); |
548 | ret = -ENOBUFS; | 548 | ret = -ENOBUFS; |
549 | goto error; | 549 | goto error; |
@@ -574,7 +574,7 @@ lookup_again: | |||
574 | } else if (!S_ISDIR(next->d_inode->i_mode) && | 574 | } else if (!S_ISDIR(next->d_inode->i_mode) && |
575 | !S_ISREG(next->d_inode->i_mode) | 575 | !S_ISREG(next->d_inode->i_mode) |
576 | ) { | 576 | ) { |
577 | pr_err("inode %lu is not a file or directory", | 577 | pr_err("inode %lu is not a file or directory\n", |
578 | next->d_inode->i_ino); | 578 | next->d_inode->i_ino); |
579 | ret = -ENOBUFS; | 579 | ret = -ENOBUFS; |
580 | goto error; | 580 | goto error; |
@@ -768,7 +768,7 @@ struct dentry *cachefiles_get_directory(struct cachefiles_cache *cache, | |||
768 | ASSERT(subdir->d_inode); | 768 | ASSERT(subdir->d_inode); |
769 | 769 | ||
770 | if (!S_ISDIR(subdir->d_inode->i_mode)) { | 770 | if (!S_ISDIR(subdir->d_inode->i_mode)) { |
771 | pr_err("%s is not a directory", dirname); | 771 | pr_err("%s is not a directory\n", dirname); |
772 | ret = -EIO; | 772 | ret = -EIO; |
773 | goto check_error; | 773 | goto check_error; |
774 | } | 774 | } |
@@ -796,13 +796,13 @@ check_error: | |||
796 | mkdir_error: | 796 | mkdir_error: |
797 | mutex_unlock(&dir->d_inode->i_mutex); | 797 | mutex_unlock(&dir->d_inode->i_mutex); |
798 | dput(subdir); | 798 | dput(subdir); |
799 | pr_err("mkdir %s failed with error %d", dirname, ret); | 799 | pr_err("mkdir %s failed with error %d\n", dirname, ret); |
800 | return ERR_PTR(ret); | 800 | return ERR_PTR(ret); |
801 | 801 | ||
802 | lookup_error: | 802 | lookup_error: |
803 | mutex_unlock(&dir->d_inode->i_mutex); | 803 | mutex_unlock(&dir->d_inode->i_mutex); |
804 | ret = PTR_ERR(subdir); | 804 | ret = PTR_ERR(subdir); |
805 | pr_err("Lookup %s failed with error %d", dirname, ret); | 805 | pr_err("Lookup %s failed with error %d\n", dirname, ret); |
806 | return ERR_PTR(ret); | 806 | return ERR_PTR(ret); |
807 | 807 | ||
808 | nomem_d_alloc: | 808 | nomem_d_alloc: |
@@ -892,7 +892,7 @@ lookup_error: | |||
892 | if (ret == -EIO) { | 892 | if (ret == -EIO) { |
893 | cachefiles_io_error(cache, "Lookup failed"); | 893 | cachefiles_io_error(cache, "Lookup failed"); |
894 | } else if (ret != -ENOMEM) { | 894 | } else if (ret != -ENOMEM) { |
895 | pr_err("Internal error: %d", ret); | 895 | pr_err("Internal error: %d\n", ret); |
896 | ret = -EIO; | 896 | ret = -EIO; |
897 | } | 897 | } |
898 | 898 | ||
@@ -951,7 +951,7 @@ error: | |||
951 | } | 951 | } |
952 | 952 | ||
953 | if (ret != -ENOMEM) { | 953 | if (ret != -ENOMEM) { |
954 | pr_err("Internal error: %d", ret); | 954 | pr_err("Internal error: %d\n", ret); |
955 | ret = -EIO; | 955 | ret = -EIO; |
956 | } | 956 | } |
957 | 957 | ||
diff --git a/fs/cachefiles/xattr.c b/fs/cachefiles/xattr.c index 1ad51ffbb275..acbc1f094fb1 100644 --- a/fs/cachefiles/xattr.c +++ b/fs/cachefiles/xattr.c | |||
@@ -51,7 +51,7 @@ int cachefiles_check_object_type(struct cachefiles_object *object) | |||
51 | } | 51 | } |
52 | 52 | ||
53 | if (ret != -EEXIST) { | 53 | if (ret != -EEXIST) { |
54 | pr_err("Can't set xattr on %*.*s [%lu] (err %d)", | 54 | pr_err("Can't set xattr on %*.*s [%lu] (err %d)\n", |
55 | dentry->d_name.len, dentry->d_name.len, | 55 | dentry->d_name.len, dentry->d_name.len, |
56 | dentry->d_name.name, dentry->d_inode->i_ino, | 56 | dentry->d_name.name, dentry->d_inode->i_ino, |
57 | -ret); | 57 | -ret); |
@@ -64,7 +64,7 @@ int cachefiles_check_object_type(struct cachefiles_object *object) | |||
64 | if (ret == -ERANGE) | 64 | if (ret == -ERANGE) |
65 | goto bad_type_length; | 65 | goto bad_type_length; |
66 | 66 | ||
67 | pr_err("Can't read xattr on %*.*s [%lu] (err %d)", | 67 | pr_err("Can't read xattr on %*.*s [%lu] (err %d)\n", |
68 | dentry->d_name.len, dentry->d_name.len, | 68 | dentry->d_name.len, dentry->d_name.len, |
69 | dentry->d_name.name, dentry->d_inode->i_ino, | 69 | dentry->d_name.name, dentry->d_inode->i_ino, |
70 | -ret); | 70 | -ret); |
@@ -85,14 +85,14 @@ error: | |||
85 | return ret; | 85 | return ret; |
86 | 86 | ||
87 | bad_type_length: | 87 | bad_type_length: |
88 | pr_err("Cache object %lu type xattr length incorrect", | 88 | pr_err("Cache object %lu type xattr length incorrect\n", |
89 | dentry->d_inode->i_ino); | 89 | dentry->d_inode->i_ino); |
90 | ret = -EIO; | 90 | ret = -EIO; |
91 | goto error; | 91 | goto error; |
92 | 92 | ||
93 | bad_type: | 93 | bad_type: |
94 | xtype[2] = 0; | 94 | xtype[2] = 0; |
95 | pr_err("Cache object %*.*s [%lu] type %s not %s", | 95 | pr_err("Cache object %*.*s [%lu] type %s not %s\n", |
96 | dentry->d_name.len, dentry->d_name.len, | 96 | dentry->d_name.len, dentry->d_name.len, |
97 | dentry->d_name.name, dentry->d_inode->i_ino, | 97 | dentry->d_name.name, dentry->d_inode->i_ino, |
98 | xtype, type); | 98 | xtype, type); |
@@ -293,7 +293,7 @@ error: | |||
293 | return ret; | 293 | return ret; |
294 | 294 | ||
295 | bad_type_length: | 295 | bad_type_length: |
296 | pr_err("Cache object %lu xattr length incorrect", | 296 | pr_err("Cache object %lu xattr length incorrect\n", |
297 | dentry->d_inode->i_ino); | 297 | dentry->d_inode->i_ino); |
298 | ret = -EIO; | 298 | ret = -EIO; |
299 | goto error; | 299 | goto error; |
diff --git a/fs/dcache.c b/fs/dcache.c index 7a5b51440afa..cb25a1a5e307 100644 --- a/fs/dcache.c +++ b/fs/dcache.c | |||
@@ -2372,7 +2372,8 @@ void dentry_update_name_case(struct dentry *dentry, struct qstr *name) | |||
2372 | } | 2372 | } |
2373 | EXPORT_SYMBOL(dentry_update_name_case); | 2373 | EXPORT_SYMBOL(dentry_update_name_case); |
2374 | 2374 | ||
2375 | static void switch_names(struct dentry *dentry, struct dentry *target) | 2375 | static void switch_names(struct dentry *dentry, struct dentry *target, |
2376 | bool exchange) | ||
2376 | { | 2377 | { |
2377 | if (dname_external(target)) { | 2378 | if (dname_external(target)) { |
2378 | if (dname_external(dentry)) { | 2379 | if (dname_external(dentry)) { |
@@ -2406,13 +2407,19 @@ static void switch_names(struct dentry *dentry, struct dentry *target) | |||
2406 | */ | 2407 | */ |
2407 | unsigned int i; | 2408 | unsigned int i; |
2408 | BUILD_BUG_ON(!IS_ALIGNED(DNAME_INLINE_LEN, sizeof(long))); | 2409 | BUILD_BUG_ON(!IS_ALIGNED(DNAME_INLINE_LEN, sizeof(long))); |
2410 | if (!exchange) { | ||
2411 | memcpy(dentry->d_iname, target->d_name.name, | ||
2412 | target->d_name.len + 1); | ||
2413 | dentry->d_name.hash_len = target->d_name.hash_len; | ||
2414 | return; | ||
2415 | } | ||
2409 | for (i = 0; i < DNAME_INLINE_LEN / sizeof(long); i++) { | 2416 | for (i = 0; i < DNAME_INLINE_LEN / sizeof(long); i++) { |
2410 | swap(((long *) &dentry->d_iname)[i], | 2417 | swap(((long *) &dentry->d_iname)[i], |
2411 | ((long *) &target->d_iname)[i]); | 2418 | ((long *) &target->d_iname)[i]); |
2412 | } | 2419 | } |
2413 | } | 2420 | } |
2414 | } | 2421 | } |
2415 | swap(dentry->d_name.len, target->d_name.len); | 2422 | swap(dentry->d_name.hash_len, target->d_name.hash_len); |
2416 | } | 2423 | } |
2417 | 2424 | ||
2418 | static void dentry_lock_for_move(struct dentry *dentry, struct dentry *target) | 2425 | static void dentry_lock_for_move(struct dentry *dentry, struct dentry *target) |
@@ -2442,25 +2449,29 @@ static void dentry_lock_for_move(struct dentry *dentry, struct dentry *target) | |||
2442 | } | 2449 | } |
2443 | } | 2450 | } |
2444 | 2451 | ||
2445 | static void dentry_unlock_parents_for_move(struct dentry *dentry, | 2452 | static void dentry_unlock_for_move(struct dentry *dentry, struct dentry *target) |
2446 | struct dentry *target) | ||
2447 | { | 2453 | { |
2448 | if (target->d_parent != dentry->d_parent) | 2454 | if (target->d_parent != dentry->d_parent) |
2449 | spin_unlock(&dentry->d_parent->d_lock); | 2455 | spin_unlock(&dentry->d_parent->d_lock); |
2450 | if (target->d_parent != target) | 2456 | if (target->d_parent != target) |
2451 | spin_unlock(&target->d_parent->d_lock); | 2457 | spin_unlock(&target->d_parent->d_lock); |
2458 | spin_unlock(&target->d_lock); | ||
2459 | spin_unlock(&dentry->d_lock); | ||
2452 | } | 2460 | } |
2453 | 2461 | ||
2454 | /* | 2462 | /* |
2455 | * When switching names, the actual string doesn't strictly have to | 2463 | * When switching names, the actual string doesn't strictly have to |
2456 | * be preserved in the target - because we're dropping the target | 2464 | * be preserved in the target - because we're dropping the target |
2457 | * anyway. As such, we can just do a simple memcpy() to copy over | 2465 | * anyway. As such, we can just do a simple memcpy() to copy over |
2458 | * the new name before we switch. | 2466 | * the new name before we switch, unless we are going to rehash |
2459 | * | 2467 | * it. Note that if we *do* unhash the target, we are not allowed |
2460 | * Note that we have to be a lot more careful about getting the hash | 2468 | * to rehash it without giving it a new name/hash key - whether |
2461 | * switched - we have to switch the hash value properly even if it | 2469 | * we swap or overwrite the names here, resulting name won't match |
2462 | * then no longer matches the actual (corrupted) string of the target. | 2470 | * the reality in filesystem; it's only there for d_path() purposes. |
2463 | * The hash value has to match the hash queue that the dentry is on.. | 2471 | * Note that all of this is happening under rename_lock, so the |
2472 | * any hash lookup seeing it in the middle of manipulations will | ||
2473 | * be discarded anyway. So we do not care what happens to the hash | ||
2474 | * key in that case. | ||
2464 | */ | 2475 | */ |
2465 | /* | 2476 | /* |
2466 | * __d_move - move a dentry | 2477 | * __d_move - move a dentry |
@@ -2506,36 +2517,30 @@ static void __d_move(struct dentry *dentry, struct dentry *target, | |||
2506 | d_hash(dentry->d_parent, dentry->d_name.hash)); | 2517 | d_hash(dentry->d_parent, dentry->d_name.hash)); |
2507 | } | 2518 | } |
2508 | 2519 | ||
2509 | list_del(&dentry->d_u.d_child); | ||
2510 | list_del(&target->d_u.d_child); | ||
2511 | |||
2512 | /* Switch the names.. */ | 2520 | /* Switch the names.. */ |
2513 | switch_names(dentry, target); | 2521 | switch_names(dentry, target, exchange); |
2514 | swap(dentry->d_name.hash, target->d_name.hash); | ||
2515 | 2522 | ||
2516 | /* ... and switch the parents */ | 2523 | /* ... and switch them in the tree */ |
2517 | if (IS_ROOT(dentry)) { | 2524 | if (IS_ROOT(dentry)) { |
2525 | /* splicing a tree */ | ||
2518 | dentry->d_parent = target->d_parent; | 2526 | dentry->d_parent = target->d_parent; |
2519 | target->d_parent = target; | 2527 | target->d_parent = target; |
2520 | INIT_LIST_HEAD(&target->d_u.d_child); | 2528 | list_del_init(&target->d_u.d_child); |
2529 | list_move(&dentry->d_u.d_child, &dentry->d_parent->d_subdirs); | ||
2521 | } else { | 2530 | } else { |
2531 | /* swapping two dentries */ | ||
2522 | swap(dentry->d_parent, target->d_parent); | 2532 | swap(dentry->d_parent, target->d_parent); |
2523 | 2533 | list_move(&target->d_u.d_child, &target->d_parent->d_subdirs); | |
2524 | /* And add them back to the (new) parent lists */ | 2534 | list_move(&dentry->d_u.d_child, &dentry->d_parent->d_subdirs); |
2525 | list_add(&target->d_u.d_child, &target->d_parent->d_subdirs); | 2535 | if (exchange) |
2536 | fsnotify_d_move(target); | ||
2537 | fsnotify_d_move(dentry); | ||
2526 | } | 2538 | } |
2527 | 2539 | ||
2528 | list_add(&dentry->d_u.d_child, &dentry->d_parent->d_subdirs); | ||
2529 | |||
2530 | write_seqcount_end(&target->d_seq); | 2540 | write_seqcount_end(&target->d_seq); |
2531 | write_seqcount_end(&dentry->d_seq); | 2541 | write_seqcount_end(&dentry->d_seq); |
2532 | 2542 | ||
2533 | dentry_unlock_parents_for_move(dentry, target); | 2543 | dentry_unlock_for_move(dentry, target); |
2534 | if (exchange) | ||
2535 | fsnotify_d_move(target); | ||
2536 | spin_unlock(&target->d_lock); | ||
2537 | fsnotify_d_move(dentry); | ||
2538 | spin_unlock(&dentry->d_lock); | ||
2539 | } | 2544 | } |
2540 | 2545 | ||
2541 | /* | 2546 | /* |
@@ -2633,45 +2638,6 @@ out_err: | |||
2633 | return ret; | 2638 | return ret; |
2634 | } | 2639 | } |
2635 | 2640 | ||
2636 | /* | ||
2637 | * Prepare an anonymous dentry for life in the superblock's dentry tree as a | ||
2638 | * named dentry in place of the dentry to be replaced. | ||
2639 | * returns with anon->d_lock held! | ||
2640 | */ | ||
2641 | static void __d_materialise_dentry(struct dentry *dentry, struct dentry *anon) | ||
2642 | { | ||
2643 | struct dentry *dparent; | ||
2644 | |||
2645 | dentry_lock_for_move(anon, dentry); | ||
2646 | |||
2647 | write_seqcount_begin(&dentry->d_seq); | ||
2648 | write_seqcount_begin_nested(&anon->d_seq, DENTRY_D_LOCK_NESTED); | ||
2649 | |||
2650 | dparent = dentry->d_parent; | ||
2651 | |||
2652 | switch_names(dentry, anon); | ||
2653 | swap(dentry->d_name.hash, anon->d_name.hash); | ||
2654 | |||
2655 | dentry->d_parent = dentry; | ||
2656 | list_del_init(&dentry->d_u.d_child); | ||
2657 | anon->d_parent = dparent; | ||
2658 | if (likely(!d_unhashed(anon))) { | ||
2659 | hlist_bl_lock(&anon->d_sb->s_anon); | ||
2660 | __hlist_bl_del(&anon->d_hash); | ||
2661 | anon->d_hash.pprev = NULL; | ||
2662 | hlist_bl_unlock(&anon->d_sb->s_anon); | ||
2663 | } | ||
2664 | list_move(&anon->d_u.d_child, &dparent->d_subdirs); | ||
2665 | |||
2666 | write_seqcount_end(&dentry->d_seq); | ||
2667 | write_seqcount_end(&anon->d_seq); | ||
2668 | |||
2669 | dentry_unlock_parents_for_move(anon, dentry); | ||
2670 | spin_unlock(&dentry->d_lock); | ||
2671 | |||
2672 | /* anon->d_lock still locked, returns locked */ | ||
2673 | } | ||
2674 | |||
2675 | /** | 2641 | /** |
2676 | * d_splice_alias - splice a disconnected dentry into the tree if one exists | 2642 | * d_splice_alias - splice a disconnected dentry into the tree if one exists |
2677 | * @inode: the inode which may have a disconnected dentry | 2643 | * @inode: the inode which may have a disconnected dentry |
@@ -2717,10 +2683,8 @@ struct dentry *d_splice_alias(struct inode *inode, struct dentry *dentry) | |||
2717 | return ERR_PTR(-EIO); | 2683 | return ERR_PTR(-EIO); |
2718 | } | 2684 | } |
2719 | write_seqlock(&rename_lock); | 2685 | write_seqlock(&rename_lock); |
2720 | __d_materialise_dentry(dentry, new); | 2686 | __d_move(new, dentry, false); |
2721 | write_sequnlock(&rename_lock); | 2687 | write_sequnlock(&rename_lock); |
2722 | _d_rehash(new); | ||
2723 | spin_unlock(&new->d_lock); | ||
2724 | spin_unlock(&inode->i_lock); | 2688 | spin_unlock(&inode->i_lock); |
2725 | security_d_instantiate(new, inode); | 2689 | security_d_instantiate(new, inode); |
2726 | iput(inode); | 2690 | iput(inode); |
@@ -2780,7 +2744,7 @@ struct dentry *d_materialise_unique(struct dentry *dentry, struct inode *inode) | |||
2780 | } else if (IS_ROOT(alias)) { | 2744 | } else if (IS_ROOT(alias)) { |
2781 | /* Is this an anonymous mountpoint that we | 2745 | /* Is this an anonymous mountpoint that we |
2782 | * could splice into our tree? */ | 2746 | * could splice into our tree? */ |
2783 | __d_materialise_dentry(dentry, alias); | 2747 | __d_move(alias, dentry, false); |
2784 | write_sequnlock(&rename_lock); | 2748 | write_sequnlock(&rename_lock); |
2785 | goto found; | 2749 | goto found; |
2786 | } else { | 2750 | } else { |
@@ -2807,13 +2771,9 @@ struct dentry *d_materialise_unique(struct dentry *dentry, struct inode *inode) | |||
2807 | actual = __d_instantiate_unique(dentry, inode); | 2771 | actual = __d_instantiate_unique(dentry, inode); |
2808 | if (!actual) | 2772 | if (!actual) |
2809 | actual = dentry; | 2773 | actual = dentry; |
2810 | else | ||
2811 | BUG_ON(!d_unhashed(actual)); | ||
2812 | 2774 | ||
2813 | spin_lock(&actual->d_lock); | 2775 | d_rehash(actual); |
2814 | found: | 2776 | found: |
2815 | _d_rehash(actual); | ||
2816 | spin_unlock(&actual->d_lock); | ||
2817 | spin_unlock(&inode->i_lock); | 2777 | spin_unlock(&inode->i_lock); |
2818 | out_nolock: | 2778 | out_nolock: |
2819 | if (actual == dentry) { | 2779 | if (actual == dentry) { |
diff --git a/fs/direct-io.c b/fs/direct-io.c index c3116404ab49..e181b6b2e297 100644 --- a/fs/direct-io.c +++ b/fs/direct-io.c | |||
@@ -158,7 +158,7 @@ static inline int dio_refill_pages(struct dio *dio, struct dio_submit *sdio) | |||
158 | { | 158 | { |
159 | ssize_t ret; | 159 | ssize_t ret; |
160 | 160 | ||
161 | ret = iov_iter_get_pages(sdio->iter, dio->pages, DIO_PAGES, | 161 | ret = iov_iter_get_pages(sdio->iter, dio->pages, LONG_MAX, DIO_PAGES, |
162 | &sdio->from); | 162 | &sdio->from); |
163 | 163 | ||
164 | if (ret < 0 && sdio->blocks_available && (dio->rw & WRITE)) { | 164 | if (ret < 0 && sdio->blocks_available && (dio->rw & WRITE)) { |
diff --git a/fs/fuse/file.c b/fs/fuse/file.c index 912061ac4baf..caa8d95b24e8 100644 --- a/fs/fuse/file.c +++ b/fs/fuse/file.c | |||
@@ -1305,6 +1305,7 @@ static int fuse_get_user_pages(struct fuse_req *req, struct iov_iter *ii, | |||
1305 | size_t start; | 1305 | size_t start; |
1306 | ssize_t ret = iov_iter_get_pages(ii, | 1306 | ssize_t ret = iov_iter_get_pages(ii, |
1307 | &req->pages[req->num_pages], | 1307 | &req->pages[req->num_pages], |
1308 | *nbytesp - nbytes, | ||
1308 | req->max_pages - req->num_pages, | 1309 | req->max_pages - req->num_pages, |
1309 | &start); | 1310 | &start); |
1310 | if (ret < 0) | 1311 | if (ret < 0) |
diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c index e94457c33ad6..b01f6e100ee8 100644 --- a/fs/nfsd/nfs4xdr.c +++ b/fs/nfsd/nfs4xdr.c | |||
@@ -3104,7 +3104,8 @@ static __be32 nfsd4_encode_splice_read( | |||
3104 | 3104 | ||
3105 | buf->page_len = maxcount; | 3105 | buf->page_len = maxcount; |
3106 | buf->len += maxcount; | 3106 | buf->len += maxcount; |
3107 | xdr->page_ptr += (maxcount + PAGE_SIZE - 1) / PAGE_SIZE; | 3107 | xdr->page_ptr += (buf->page_base + maxcount + PAGE_SIZE - 1) |
3108 | / PAGE_SIZE; | ||
3108 | 3109 | ||
3109 | /* Use rest of head for padding and remaining ops: */ | 3110 | /* Use rest of head for padding and remaining ops: */ |
3110 | buf->tail[0].iov_base = xdr->p; | 3111 | buf->tail[0].iov_base = xdr->p; |
diff --git a/fs/nilfs2/inode.c b/fs/nilfs2/inode.c index 6252b173a465..d071e7f23de2 100644 --- a/fs/nilfs2/inode.c +++ b/fs/nilfs2/inode.c | |||
@@ -24,6 +24,7 @@ | |||
24 | #include <linux/buffer_head.h> | 24 | #include <linux/buffer_head.h> |
25 | #include <linux/gfp.h> | 25 | #include <linux/gfp.h> |
26 | #include <linux/mpage.h> | 26 | #include <linux/mpage.h> |
27 | #include <linux/pagemap.h> | ||
27 | #include <linux/writeback.h> | 28 | #include <linux/writeback.h> |
28 | #include <linux/aio.h> | 29 | #include <linux/aio.h> |
29 | #include "nilfs.h" | 30 | #include "nilfs.h" |
@@ -219,10 +220,10 @@ static int nilfs_writepage(struct page *page, struct writeback_control *wbc) | |||
219 | 220 | ||
220 | static int nilfs_set_page_dirty(struct page *page) | 221 | static int nilfs_set_page_dirty(struct page *page) |
221 | { | 222 | { |
223 | struct inode *inode = page->mapping->host; | ||
222 | int ret = __set_page_dirty_nobuffers(page); | 224 | int ret = __set_page_dirty_nobuffers(page); |
223 | 225 | ||
224 | if (page_has_buffers(page)) { | 226 | if (page_has_buffers(page)) { |
225 | struct inode *inode = page->mapping->host; | ||
226 | unsigned nr_dirty = 0; | 227 | unsigned nr_dirty = 0; |
227 | struct buffer_head *bh, *head; | 228 | struct buffer_head *bh, *head; |
228 | 229 | ||
@@ -245,6 +246,10 @@ static int nilfs_set_page_dirty(struct page *page) | |||
245 | 246 | ||
246 | if (nr_dirty) | 247 | if (nr_dirty) |
247 | nilfs_set_file_dirty(inode, nr_dirty); | 248 | nilfs_set_file_dirty(inode, nr_dirty); |
249 | } else if (ret) { | ||
250 | unsigned nr_dirty = 1 << (PAGE_CACHE_SHIFT - inode->i_blkbits); | ||
251 | |||
252 | nilfs_set_file_dirty(inode, nr_dirty); | ||
248 | } | 253 | } |
249 | return ret; | 254 | return ret; |
250 | } | 255 | } |
diff --git a/fs/ocfs2/dlm/dlmmaster.c b/fs/ocfs2/dlm/dlmmaster.c index 3ec906ef5d9a..e3cfa0227026 100644 --- a/fs/ocfs2/dlm/dlmmaster.c +++ b/fs/ocfs2/dlm/dlmmaster.c | |||
@@ -655,12 +655,9 @@ void dlm_lockres_clear_refmap_bit(struct dlm_ctxt *dlm, | |||
655 | clear_bit(bit, res->refmap); | 655 | clear_bit(bit, res->refmap); |
656 | } | 656 | } |
657 | 657 | ||
658 | 658 | static void __dlm_lockres_grab_inflight_ref(struct dlm_ctxt *dlm, | |
659 | void dlm_lockres_grab_inflight_ref(struct dlm_ctxt *dlm, | ||
660 | struct dlm_lock_resource *res) | 659 | struct dlm_lock_resource *res) |
661 | { | 660 | { |
662 | assert_spin_locked(&res->spinlock); | ||
663 | |||
664 | res->inflight_locks++; | 661 | res->inflight_locks++; |
665 | 662 | ||
666 | mlog(0, "%s: res %.*s, inflight++: now %u, %ps()\n", dlm->name, | 663 | mlog(0, "%s: res %.*s, inflight++: now %u, %ps()\n", dlm->name, |
@@ -668,6 +665,13 @@ void dlm_lockres_grab_inflight_ref(struct dlm_ctxt *dlm, | |||
668 | __builtin_return_address(0)); | 665 | __builtin_return_address(0)); |
669 | } | 666 | } |
670 | 667 | ||
668 | void dlm_lockres_grab_inflight_ref(struct dlm_ctxt *dlm, | ||
669 | struct dlm_lock_resource *res) | ||
670 | { | ||
671 | assert_spin_locked(&res->spinlock); | ||
672 | __dlm_lockres_grab_inflight_ref(dlm, res); | ||
673 | } | ||
674 | |||
671 | void dlm_lockres_drop_inflight_ref(struct dlm_ctxt *dlm, | 675 | void dlm_lockres_drop_inflight_ref(struct dlm_ctxt *dlm, |
672 | struct dlm_lock_resource *res) | 676 | struct dlm_lock_resource *res) |
673 | { | 677 | { |
@@ -894,10 +898,8 @@ lookup: | |||
894 | /* finally add the lockres to its hash bucket */ | 898 | /* finally add the lockres to its hash bucket */ |
895 | __dlm_insert_lockres(dlm, res); | 899 | __dlm_insert_lockres(dlm, res); |
896 | 900 | ||
897 | /* Grab inflight ref to pin the resource */ | 901 | /* since this lockres is new it doesn't not require the spinlock */ |
898 | spin_lock(&res->spinlock); | 902 | __dlm_lockres_grab_inflight_ref(dlm, res); |
899 | dlm_lockres_grab_inflight_ref(dlm, res); | ||
900 | spin_unlock(&res->spinlock); | ||
901 | 903 | ||
902 | /* get an extra ref on the mle in case this is a BLOCK | 904 | /* get an extra ref on the mle in case this is a BLOCK |
903 | * if so, the creator of the BLOCK may try to put the last | 905 | * if so, the creator of the BLOCK may try to put the last |
diff --git a/fs/ocfs2/super.c b/fs/ocfs2/super.c index ddb662b32447..4142546aedae 100644 --- a/fs/ocfs2/super.c +++ b/fs/ocfs2/super.c | |||
@@ -2532,6 +2532,7 @@ static void ocfs2_delete_osb(struct ocfs2_super *osb) | |||
2532 | kfree(osb->journal); | 2532 | kfree(osb->journal); |
2533 | kfree(osb->local_alloc_copy); | 2533 | kfree(osb->local_alloc_copy); |
2534 | kfree(osb->uuid_str); | 2534 | kfree(osb->uuid_str); |
2535 | kfree(osb->vol_label); | ||
2535 | ocfs2_put_dlm_debug(osb->osb_dlm_debug); | 2536 | ocfs2_put_dlm_debug(osb->osb_dlm_debug); |
2536 | memset(osb, 0, sizeof(struct ocfs2_super)); | 2537 | memset(osb, 0, sizeof(struct ocfs2_super)); |
2537 | } | 2538 | } |
diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c index dfc791c42d64..c34156888d70 100644 --- a/fs/proc/task_mmu.c +++ b/fs/proc/task_mmu.c | |||
@@ -931,23 +931,32 @@ static int pagemap_pte_hole(unsigned long start, unsigned long end, | |||
931 | while (addr < end) { | 931 | while (addr < end) { |
932 | struct vm_area_struct *vma = find_vma(walk->mm, addr); | 932 | struct vm_area_struct *vma = find_vma(walk->mm, addr); |
933 | pagemap_entry_t pme = make_pme(PM_NOT_PRESENT(pm->v2)); | 933 | pagemap_entry_t pme = make_pme(PM_NOT_PRESENT(pm->v2)); |
934 | unsigned long vm_end; | 934 | /* End of address space hole, which we mark as non-present. */ |
935 | unsigned long hole_end; | ||
935 | 936 | ||
936 | if (!vma) { | 937 | if (vma) |
937 | vm_end = end; | 938 | hole_end = min(end, vma->vm_start); |
938 | } else { | 939 | else |
939 | vm_end = min(end, vma->vm_end); | 940 | hole_end = end; |
940 | if (vma->vm_flags & VM_SOFTDIRTY) | 941 | |
941 | pme.pme |= PM_STATUS2(pm->v2, __PM_SOFT_DIRTY); | 942 | for (; addr < hole_end; addr += PAGE_SIZE) { |
943 | err = add_to_pagemap(addr, &pme, pm); | ||
944 | if (err) | ||
945 | goto out; | ||
942 | } | 946 | } |
943 | 947 | ||
944 | for (; addr < vm_end; addr += PAGE_SIZE) { | 948 | if (!vma) |
949 | break; | ||
950 | |||
951 | /* Addresses in the VMA. */ | ||
952 | if (vma->vm_flags & VM_SOFTDIRTY) | ||
953 | pme.pme |= PM_STATUS2(pm->v2, __PM_SOFT_DIRTY); | ||
954 | for (; addr < min(end, vma->vm_end); addr += PAGE_SIZE) { | ||
945 | err = add_to_pagemap(addr, &pme, pm); | 955 | err = add_to_pagemap(addr, &pme, pm); |
946 | if (err) | 956 | if (err) |
947 | goto out; | 957 | goto out; |
948 | } | 958 | } |
949 | } | 959 | } |
950 | |||
951 | out: | 960 | out: |
952 | return err; | 961 | return err; |
953 | } | 962 | } |
diff --git a/fs/ufs/ialloc.c b/fs/ufs/ialloc.c index a9cc75ffa925..7caa01652888 100644 --- a/fs/ufs/ialloc.c +++ b/fs/ufs/ialloc.c | |||
@@ -298,7 +298,10 @@ cg_found: | |||
298 | ufsi->i_oeftflag = 0; | 298 | ufsi->i_oeftflag = 0; |
299 | ufsi->i_dir_start_lookup = 0; | 299 | ufsi->i_dir_start_lookup = 0; |
300 | memset(&ufsi->i_u1, 0, sizeof(ufsi->i_u1)); | 300 | memset(&ufsi->i_u1, 0, sizeof(ufsi->i_u1)); |
301 | insert_inode_hash(inode); | 301 | if (insert_inode_locked(inode) < 0) { |
302 | err = -EIO; | ||
303 | goto failed; | ||
304 | } | ||
302 | mark_inode_dirty(inode); | 305 | mark_inode_dirty(inode); |
303 | 306 | ||
304 | if (uspi->fs_magic == UFS2_MAGIC) { | 307 | if (uspi->fs_magic == UFS2_MAGIC) { |
@@ -337,6 +340,7 @@ cg_found: | |||
337 | fail_remove_inode: | 340 | fail_remove_inode: |
338 | unlock_ufs(sb); | 341 | unlock_ufs(sb); |
339 | clear_nlink(inode); | 342 | clear_nlink(inode); |
343 | unlock_new_inode(inode); | ||
340 | iput(inode); | 344 | iput(inode); |
341 | UFSD("EXIT (FAILED): err %d\n", err); | 345 | UFSD("EXIT (FAILED): err %d\n", err); |
342 | return ERR_PTR(err); | 346 | return ERR_PTR(err); |
diff --git a/fs/ufs/namei.c b/fs/ufs/namei.c index 2df62a73f20c..fd65deb4b5f0 100644 --- a/fs/ufs/namei.c +++ b/fs/ufs/namei.c | |||
@@ -38,10 +38,12 @@ static inline int ufs_add_nondir(struct dentry *dentry, struct inode *inode) | |||
38 | { | 38 | { |
39 | int err = ufs_add_link(dentry, inode); | 39 | int err = ufs_add_link(dentry, inode); |
40 | if (!err) { | 40 | if (!err) { |
41 | unlock_new_inode(inode); | ||
41 | d_instantiate(dentry, inode); | 42 | d_instantiate(dentry, inode); |
42 | return 0; | 43 | return 0; |
43 | } | 44 | } |
44 | inode_dec_link_count(inode); | 45 | inode_dec_link_count(inode); |
46 | unlock_new_inode(inode); | ||
45 | iput(inode); | 47 | iput(inode); |
46 | return err; | 48 | return err; |
47 | } | 49 | } |
@@ -155,6 +157,7 @@ out_notlocked: | |||
155 | 157 | ||
156 | out_fail: | 158 | out_fail: |
157 | inode_dec_link_count(inode); | 159 | inode_dec_link_count(inode); |
160 | unlock_new_inode(inode); | ||
158 | iput(inode); | 161 | iput(inode); |
159 | goto out; | 162 | goto out; |
160 | } | 163 | } |
@@ -210,6 +213,7 @@ out: | |||
210 | out_fail: | 213 | out_fail: |
211 | inode_dec_link_count(inode); | 214 | inode_dec_link_count(inode); |
212 | inode_dec_link_count(inode); | 215 | inode_dec_link_count(inode); |
216 | unlock_new_inode(inode); | ||
213 | iput (inode); | 217 | iput (inode); |
214 | inode_dec_link_count(dir); | 218 | inode_dec_link_count(dir); |
215 | unlock_ufs(dir->i_sb); | 219 | unlock_ufs(dir->i_sb); |
diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h index d91e59b79f0d..57ee0528aacb 100644 --- a/include/acpi/acpi_bus.h +++ b/include/acpi/acpi_bus.h | |||
@@ -118,6 +118,7 @@ struct acpi_device; | |||
118 | struct acpi_hotplug_profile { | 118 | struct acpi_hotplug_profile { |
119 | struct kobject kobj; | 119 | struct kobject kobj; |
120 | int (*scan_dependent)(struct acpi_device *adev); | 120 | int (*scan_dependent)(struct acpi_device *adev); |
121 | void (*notify_online)(struct acpi_device *adev); | ||
121 | bool enabled:1; | 122 | bool enabled:1; |
122 | bool demand_offline:1; | 123 | bool demand_offline:1; |
123 | }; | 124 | }; |
diff --git a/include/linux/cpuset.h b/include/linux/cpuset.h index ade2390ffe92..6e39c9bb0dae 100644 --- a/include/linux/cpuset.h +++ b/include/linux/cpuset.h | |||
@@ -93,12 +93,12 @@ extern int cpuset_slab_spread_node(void); | |||
93 | 93 | ||
94 | static inline int cpuset_do_page_mem_spread(void) | 94 | static inline int cpuset_do_page_mem_spread(void) |
95 | { | 95 | { |
96 | return current->flags & PF_SPREAD_PAGE; | 96 | return task_spread_page(current); |
97 | } | 97 | } |
98 | 98 | ||
99 | static inline int cpuset_do_slab_mem_spread(void) | 99 | static inline int cpuset_do_slab_mem_spread(void) |
100 | { | 100 | { |
101 | return current->flags & PF_SPREAD_SLAB; | 101 | return task_spread_slab(current); |
102 | } | 102 | } |
103 | 103 | ||
104 | extern int current_cpuset_is_being_rebound(void); | 104 | extern int current_cpuset_is_being_rebound(void); |
diff --git a/include/linux/i2c.h b/include/linux/i2c.h index a95efeb53a8b..b556e0ab946f 100644 --- a/include/linux/i2c.h +++ b/include/linux/i2c.h | |||
@@ -577,20 +577,4 @@ static inline struct i2c_adapter *of_find_i2c_adapter_by_node(struct device_node | |||
577 | } | 577 | } |
578 | #endif /* CONFIG_OF */ | 578 | #endif /* CONFIG_OF */ |
579 | 579 | ||
580 | #ifdef CONFIG_ACPI | ||
581 | void acpi_i2c_register_devices(struct i2c_adapter *adap); | ||
582 | #else | ||
583 | static inline void acpi_i2c_register_devices(struct i2c_adapter *adap) { } | ||
584 | #endif /* CONFIG_ACPI */ | ||
585 | |||
586 | #ifdef CONFIG_ACPI_I2C_OPREGION | ||
587 | int acpi_i2c_install_space_handler(struct i2c_adapter *adapter); | ||
588 | void acpi_i2c_remove_space_handler(struct i2c_adapter *adapter); | ||
589 | #else | ||
590 | static inline void acpi_i2c_remove_space_handler(struct i2c_adapter *adapter) | ||
591 | { } | ||
592 | static inline int acpi_i2c_install_space_handler(struct i2c_adapter *adapter) | ||
593 | { return 0; } | ||
594 | #endif /* CONFIG_ACPI_I2C_OPREGION */ | ||
595 | |||
596 | #endif /* _LINUX_I2C_H */ | 580 | #endif /* _LINUX_I2C_H */ |
diff --git a/include/linux/sched.h b/include/linux/sched.h index 5c2c885ee52b..b867a4dab38a 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h | |||
@@ -1903,8 +1903,6 @@ extern void thread_group_cputime_adjusted(struct task_struct *p, cputime_t *ut, | |||
1903 | #define PF_KTHREAD 0x00200000 /* I am a kernel thread */ | 1903 | #define PF_KTHREAD 0x00200000 /* I am a kernel thread */ |
1904 | #define PF_RANDOMIZE 0x00400000 /* randomize virtual address space */ | 1904 | #define PF_RANDOMIZE 0x00400000 /* randomize virtual address space */ |
1905 | #define PF_SWAPWRITE 0x00800000 /* Allowed to write to swap */ | 1905 | #define PF_SWAPWRITE 0x00800000 /* Allowed to write to swap */ |
1906 | #define PF_SPREAD_PAGE 0x01000000 /* Spread page cache over cpuset */ | ||
1907 | #define PF_SPREAD_SLAB 0x02000000 /* Spread some slab caches over cpuset */ | ||
1908 | #define PF_NO_SETAFFINITY 0x04000000 /* Userland is not allowed to meddle with cpus_allowed */ | 1906 | #define PF_NO_SETAFFINITY 0x04000000 /* Userland is not allowed to meddle with cpus_allowed */ |
1909 | #define PF_MCE_EARLY 0x08000000 /* Early kill for mce process policy */ | 1907 | #define PF_MCE_EARLY 0x08000000 /* Early kill for mce process policy */ |
1910 | #define PF_MUTEX_TESTER 0x20000000 /* Thread belongs to the rt mutex tester */ | 1908 | #define PF_MUTEX_TESTER 0x20000000 /* Thread belongs to the rt mutex tester */ |
@@ -1957,17 +1955,31 @@ static inline void memalloc_noio_restore(unsigned int flags) | |||
1957 | } | 1955 | } |
1958 | 1956 | ||
1959 | /* Per-process atomic flags. */ | 1957 | /* Per-process atomic flags. */ |
1960 | #define PFA_NO_NEW_PRIVS 0x00000001 /* May not gain new privileges. */ | 1958 | #define PFA_NO_NEW_PRIVS 0 /* May not gain new privileges. */ |
1959 | #define PFA_SPREAD_PAGE 1 /* Spread page cache over cpuset */ | ||
1960 | #define PFA_SPREAD_SLAB 2 /* Spread some slab caches over cpuset */ | ||
1961 | 1961 | ||
1962 | static inline bool task_no_new_privs(struct task_struct *p) | ||
1963 | { | ||
1964 | return test_bit(PFA_NO_NEW_PRIVS, &p->atomic_flags); | ||
1965 | } | ||
1966 | 1962 | ||
1967 | static inline void task_set_no_new_privs(struct task_struct *p) | 1963 | #define TASK_PFA_TEST(name, func) \ |
1968 | { | 1964 | static inline bool task_##func(struct task_struct *p) \ |
1969 | set_bit(PFA_NO_NEW_PRIVS, &p->atomic_flags); | 1965 | { return test_bit(PFA_##name, &p->atomic_flags); } |
1970 | } | 1966 | #define TASK_PFA_SET(name, func) \ |
1967 | static inline void task_set_##func(struct task_struct *p) \ | ||
1968 | { set_bit(PFA_##name, &p->atomic_flags); } | ||
1969 | #define TASK_PFA_CLEAR(name, func) \ | ||
1970 | static inline void task_clear_##func(struct task_struct *p) \ | ||
1971 | { clear_bit(PFA_##name, &p->atomic_flags); } | ||
1972 | |||
1973 | TASK_PFA_TEST(NO_NEW_PRIVS, no_new_privs) | ||
1974 | TASK_PFA_SET(NO_NEW_PRIVS, no_new_privs) | ||
1975 | |||
1976 | TASK_PFA_TEST(SPREAD_PAGE, spread_page) | ||
1977 | TASK_PFA_SET(SPREAD_PAGE, spread_page) | ||
1978 | TASK_PFA_CLEAR(SPREAD_PAGE, spread_page) | ||
1979 | |||
1980 | TASK_PFA_TEST(SPREAD_SLAB, spread_slab) | ||
1981 | TASK_PFA_SET(SPREAD_SLAB, spread_slab) | ||
1982 | TASK_PFA_CLEAR(SPREAD_SLAB, spread_slab) | ||
1971 | 1983 | ||
1972 | /* | 1984 | /* |
1973 | * task->jobctl flags | 1985 | * task->jobctl flags |
@@ -2608,9 +2620,22 @@ static inline void setup_thread_stack(struct task_struct *p, struct task_struct | |||
2608 | task_thread_info(p)->task = p; | 2620 | task_thread_info(p)->task = p; |
2609 | } | 2621 | } |
2610 | 2622 | ||
2623 | /* | ||
2624 | * Return the address of the last usable long on the stack. | ||
2625 | * | ||
2626 | * When the stack grows down, this is just above the thread | ||
2627 | * info struct. Going any lower will corrupt the threadinfo. | ||
2628 | * | ||
2629 | * When the stack grows up, this is the highest address. | ||
2630 | * Beyond that position, we corrupt data on the next page. | ||
2631 | */ | ||
2611 | static inline unsigned long *end_of_stack(struct task_struct *p) | 2632 | static inline unsigned long *end_of_stack(struct task_struct *p) |
2612 | { | 2633 | { |
2634 | #ifdef CONFIG_STACK_GROWSUP | ||
2635 | return (unsigned long *)((unsigned long)task_thread_info(p) + THREAD_SIZE) - 1; | ||
2636 | #else | ||
2613 | return (unsigned long *)(task_thread_info(p) + 1); | 2637 | return (unsigned long *)(task_thread_info(p) + 1); |
2638 | #endif | ||
2614 | } | 2639 | } |
2615 | 2640 | ||
2616 | #endif | 2641 | #endif |
diff --git a/include/linux/uio.h b/include/linux/uio.h index 48d64e6ab292..290fbf0b6b8a 100644 --- a/include/linux/uio.h +++ b/include/linux/uio.h | |||
@@ -84,7 +84,7 @@ unsigned long iov_iter_alignment(const struct iov_iter *i); | |||
84 | void iov_iter_init(struct iov_iter *i, int direction, const struct iovec *iov, | 84 | void iov_iter_init(struct iov_iter *i, int direction, const struct iovec *iov, |
85 | unsigned long nr_segs, size_t count); | 85 | unsigned long nr_segs, size_t count); |
86 | ssize_t iov_iter_get_pages(struct iov_iter *i, struct page **pages, | 86 | ssize_t iov_iter_get_pages(struct iov_iter *i, struct page **pages, |
87 | unsigned maxpages, size_t *start); | 87 | size_t maxsize, unsigned maxpages, size_t *start); |
88 | ssize_t iov_iter_get_pages_alloc(struct iov_iter *i, struct page ***pages, | 88 | ssize_t iov_iter_get_pages_alloc(struct iov_iter *i, struct page ***pages, |
89 | size_t maxsize, size_t *start); | 89 | size_t maxsize, size_t *start); |
90 | int iov_iter_npages(const struct iov_iter *i, int maxpages); | 90 | int iov_iter_npages(const struct iov_iter *i, int maxpages); |
diff --git a/include/net/ip6_fib.h b/include/net/ip6_fib.h index 9bcb220bd4ad..cf485f9aa563 100644 --- a/include/net/ip6_fib.h +++ b/include/net/ip6_fib.h | |||
@@ -114,16 +114,13 @@ struct rt6_info { | |||
114 | u32 rt6i_flags; | 114 | u32 rt6i_flags; |
115 | struct rt6key rt6i_src; | 115 | struct rt6key rt6i_src; |
116 | struct rt6key rt6i_prefsrc; | 116 | struct rt6key rt6i_prefsrc; |
117 | u32 rt6i_metric; | ||
118 | 117 | ||
119 | struct inet6_dev *rt6i_idev; | 118 | struct inet6_dev *rt6i_idev; |
120 | unsigned long _rt6i_peer; | 119 | unsigned long _rt6i_peer; |
121 | 120 | ||
122 | u32 rt6i_genid; | 121 | u32 rt6i_metric; |
123 | |||
124 | /* more non-fragment space at head required */ | 122 | /* more non-fragment space at head required */ |
125 | unsigned short rt6i_nfheader_len; | 123 | unsigned short rt6i_nfheader_len; |
126 | |||
127 | u8 rt6i_protocol; | 124 | u8 rt6i_protocol; |
128 | }; | 125 | }; |
129 | 126 | ||
diff --git a/include/net/net_namespace.h b/include/net/net_namespace.h index 361d26077196..e0d64667a4b3 100644 --- a/include/net/net_namespace.h +++ b/include/net/net_namespace.h | |||
@@ -352,26 +352,12 @@ static inline void rt_genid_bump_ipv4(struct net *net) | |||
352 | atomic_inc(&net->ipv4.rt_genid); | 352 | atomic_inc(&net->ipv4.rt_genid); |
353 | } | 353 | } |
354 | 354 | ||
355 | #if IS_ENABLED(CONFIG_IPV6) | 355 | extern void (*__fib6_flush_trees)(struct net *net); |
356 | static inline int rt_genid_ipv6(struct net *net) | ||
357 | { | ||
358 | return atomic_read(&net->ipv6.rt_genid); | ||
359 | } | ||
360 | |||
361 | static inline void rt_genid_bump_ipv6(struct net *net) | ||
362 | { | ||
363 | atomic_inc(&net->ipv6.rt_genid); | ||
364 | } | ||
365 | #else | ||
366 | static inline int rt_genid_ipv6(struct net *net) | ||
367 | { | ||
368 | return 0; | ||
369 | } | ||
370 | |||
371 | static inline void rt_genid_bump_ipv6(struct net *net) | 356 | static inline void rt_genid_bump_ipv6(struct net *net) |
372 | { | 357 | { |
358 | if (__fib6_flush_trees) | ||
359 | __fib6_flush_trees(net); | ||
373 | } | 360 | } |
374 | #endif | ||
375 | 361 | ||
376 | #if IS_ENABLED(CONFIG_IEEE802154_6LOWPAN) | 362 | #if IS_ENABLED(CONFIG_IEEE802154_6LOWPAN) |
377 | static inline struct netns_ieee802154_lowpan * | 363 | static inline struct netns_ieee802154_lowpan * |
diff --git a/kernel/cpuset.c b/kernel/cpuset.c index 22874d7cf2c0..52cb04c993b7 100644 --- a/kernel/cpuset.c +++ b/kernel/cpuset.c | |||
@@ -365,13 +365,14 @@ static void cpuset_update_task_spread_flag(struct cpuset *cs, | |||
365 | struct task_struct *tsk) | 365 | struct task_struct *tsk) |
366 | { | 366 | { |
367 | if (is_spread_page(cs)) | 367 | if (is_spread_page(cs)) |
368 | tsk->flags |= PF_SPREAD_PAGE; | 368 | task_set_spread_page(tsk); |
369 | else | 369 | else |
370 | tsk->flags &= ~PF_SPREAD_PAGE; | 370 | task_clear_spread_page(tsk); |
371 | |||
371 | if (is_spread_slab(cs)) | 372 | if (is_spread_slab(cs)) |
372 | tsk->flags |= PF_SPREAD_SLAB; | 373 | task_set_spread_slab(tsk); |
373 | else | 374 | else |
374 | tsk->flags &= ~PF_SPREAD_SLAB; | 375 | task_clear_spread_slab(tsk); |
375 | } | 376 | } |
376 | 377 | ||
377 | /* | 378 | /* |
diff --git a/kernel/power/snapshot.c b/kernel/power/snapshot.c index c4b8093c80b3..f1604d8cf489 100644 --- a/kernel/power/snapshot.c +++ b/kernel/power/snapshot.c | |||
@@ -725,14 +725,6 @@ static void memory_bm_clear_bit(struct memory_bitmap *bm, unsigned long pfn) | |||
725 | clear_bit(bit, addr); | 725 | clear_bit(bit, addr); |
726 | } | 726 | } |
727 | 727 | ||
728 | static void memory_bm_clear_current(struct memory_bitmap *bm) | ||
729 | { | ||
730 | int bit; | ||
731 | |||
732 | bit = max(bm->cur.node_bit - 1, 0); | ||
733 | clear_bit(bit, bm->cur.node->data); | ||
734 | } | ||
735 | |||
736 | static int memory_bm_test_bit(struct memory_bitmap *bm, unsigned long pfn) | 728 | static int memory_bm_test_bit(struct memory_bitmap *bm, unsigned long pfn) |
737 | { | 729 | { |
738 | void *addr; | 730 | void *addr; |
@@ -1341,35 +1333,23 @@ static struct memory_bitmap copy_bm; | |||
1341 | 1333 | ||
1342 | void swsusp_free(void) | 1334 | void swsusp_free(void) |
1343 | { | 1335 | { |
1344 | unsigned long fb_pfn, fr_pfn; | 1336 | struct zone *zone; |
1345 | 1337 | unsigned long pfn, max_zone_pfn; | |
1346 | memory_bm_position_reset(forbidden_pages_map); | ||
1347 | memory_bm_position_reset(free_pages_map); | ||
1348 | |||
1349 | loop: | ||
1350 | fr_pfn = memory_bm_next_pfn(free_pages_map); | ||
1351 | fb_pfn = memory_bm_next_pfn(forbidden_pages_map); | ||
1352 | |||
1353 | /* | ||
1354 | * Find the next bit set in both bitmaps. This is guaranteed to | ||
1355 | * terminate when fb_pfn == fr_pfn == BM_END_OF_MAP. | ||
1356 | */ | ||
1357 | do { | ||
1358 | if (fb_pfn < fr_pfn) | ||
1359 | fb_pfn = memory_bm_next_pfn(forbidden_pages_map); | ||
1360 | if (fr_pfn < fb_pfn) | ||
1361 | fr_pfn = memory_bm_next_pfn(free_pages_map); | ||
1362 | } while (fb_pfn != fr_pfn); | ||
1363 | |||
1364 | if (fr_pfn != BM_END_OF_MAP && pfn_valid(fr_pfn)) { | ||
1365 | struct page *page = pfn_to_page(fr_pfn); | ||
1366 | 1338 | ||
1367 | memory_bm_clear_current(forbidden_pages_map); | 1339 | for_each_populated_zone(zone) { |
1368 | memory_bm_clear_current(free_pages_map); | 1340 | max_zone_pfn = zone_end_pfn(zone); |
1369 | __free_page(page); | 1341 | for (pfn = zone->zone_start_pfn; pfn < max_zone_pfn; pfn++) |
1370 | goto loop; | 1342 | if (pfn_valid(pfn)) { |
1343 | struct page *page = pfn_to_page(pfn); | ||
1344 | |||
1345 | if (swsusp_page_is_forbidden(page) && | ||
1346 | swsusp_page_is_free(page)) { | ||
1347 | swsusp_unset_page_forbidden(page); | ||
1348 | swsusp_unset_page_free(page); | ||
1349 | __free_page(page); | ||
1350 | } | ||
1351 | } | ||
1371 | } | 1352 | } |
1372 | |||
1373 | nr_copy_pages = 0; | 1353 | nr_copy_pages = 0; |
1374 | nr_meta_pages = 0; | 1354 | nr_meta_pages = 0; |
1375 | restore_pblist = NULL; | 1355 | restore_pblist = NULL; |
diff --git a/lib/genalloc.c b/lib/genalloc.c index bdb9a456bcbb..38d2db82228c 100644 --- a/lib/genalloc.c +++ b/lib/genalloc.c | |||
@@ -588,6 +588,7 @@ struct gen_pool *of_get_named_gen_pool(struct device_node *np, | |||
588 | if (!np_pool) | 588 | if (!np_pool) |
589 | return NULL; | 589 | return NULL; |
590 | pdev = of_find_device_by_node(np_pool); | 590 | pdev = of_find_device_by_node(np_pool); |
591 | of_node_put(np_pool); | ||
591 | if (!pdev) | 592 | if (!pdev) |
592 | return NULL; | 593 | return NULL; |
593 | return dev_get_gen_pool(&pdev->dev); | 594 | return dev_get_gen_pool(&pdev->dev); |
diff --git a/lib/rhashtable.c b/lib/rhashtable.c index 25f14c586ad7..3943e14da628 100644 --- a/lib/rhashtable.c +++ b/lib/rhashtable.c | |||
@@ -592,13 +592,13 @@ EXPORT_SYMBOL_GPL(rhashtable_init); | |||
592 | * rhashtable_destroy - destroy hash table | 592 | * rhashtable_destroy - destroy hash table |
593 | * @ht: the hash table to destroy | 593 | * @ht: the hash table to destroy |
594 | * | 594 | * |
595 | * Frees the bucket array. | 595 | * Frees the bucket array. This function is not rcu safe, therefore the caller |
596 | * has to make sure that no resizing may happen by unpublishing the hashtable | ||
597 | * and waiting for the quiescent cycle before releasing the bucket array. | ||
596 | */ | 598 | */ |
597 | void rhashtable_destroy(const struct rhashtable *ht) | 599 | void rhashtable_destroy(const struct rhashtable *ht) |
598 | { | 600 | { |
599 | const struct bucket_table *tbl = rht_dereference(ht->tbl, ht); | 601 | bucket_table_free(ht->tbl); |
600 | |||
601 | bucket_table_free(tbl); | ||
602 | } | 602 | } |
603 | EXPORT_SYMBOL_GPL(rhashtable_destroy); | 603 | EXPORT_SYMBOL_GPL(rhashtable_destroy); |
604 | 604 | ||
diff --git a/mm/iov_iter.c b/mm/iov_iter.c index ab88dc0ea1d3..9a09f2034fcc 100644 --- a/mm/iov_iter.c +++ b/mm/iov_iter.c | |||
@@ -310,7 +310,7 @@ void iov_iter_init(struct iov_iter *i, int direction, | |||
310 | EXPORT_SYMBOL(iov_iter_init); | 310 | EXPORT_SYMBOL(iov_iter_init); |
311 | 311 | ||
312 | static ssize_t get_pages_iovec(struct iov_iter *i, | 312 | static ssize_t get_pages_iovec(struct iov_iter *i, |
313 | struct page **pages, unsigned maxpages, | 313 | struct page **pages, size_t maxsize, unsigned maxpages, |
314 | size_t *start) | 314 | size_t *start) |
315 | { | 315 | { |
316 | size_t offset = i->iov_offset; | 316 | size_t offset = i->iov_offset; |
@@ -323,6 +323,8 @@ static ssize_t get_pages_iovec(struct iov_iter *i, | |||
323 | len = iov->iov_len - offset; | 323 | len = iov->iov_len - offset; |
324 | if (len > i->count) | 324 | if (len > i->count) |
325 | len = i->count; | 325 | len = i->count; |
326 | if (len > maxsize) | ||
327 | len = maxsize; | ||
326 | addr = (unsigned long)iov->iov_base + offset; | 328 | addr = (unsigned long)iov->iov_base + offset; |
327 | len += *start = addr & (PAGE_SIZE - 1); | 329 | len += *start = addr & (PAGE_SIZE - 1); |
328 | if (len > maxpages * PAGE_SIZE) | 330 | if (len > maxpages * PAGE_SIZE) |
@@ -588,13 +590,15 @@ static unsigned long alignment_bvec(const struct iov_iter *i) | |||
588 | } | 590 | } |
589 | 591 | ||
590 | static ssize_t get_pages_bvec(struct iov_iter *i, | 592 | static ssize_t get_pages_bvec(struct iov_iter *i, |
591 | struct page **pages, unsigned maxpages, | 593 | struct page **pages, size_t maxsize, unsigned maxpages, |
592 | size_t *start) | 594 | size_t *start) |
593 | { | 595 | { |
594 | const struct bio_vec *bvec = i->bvec; | 596 | const struct bio_vec *bvec = i->bvec; |
595 | size_t len = bvec->bv_len - i->iov_offset; | 597 | size_t len = bvec->bv_len - i->iov_offset; |
596 | if (len > i->count) | 598 | if (len > i->count) |
597 | len = i->count; | 599 | len = i->count; |
600 | if (len > maxsize) | ||
601 | len = maxsize; | ||
598 | /* can't be more than PAGE_SIZE */ | 602 | /* can't be more than PAGE_SIZE */ |
599 | *start = bvec->bv_offset + i->iov_offset; | 603 | *start = bvec->bv_offset + i->iov_offset; |
600 | 604 | ||
@@ -711,13 +715,13 @@ unsigned long iov_iter_alignment(const struct iov_iter *i) | |||
711 | EXPORT_SYMBOL(iov_iter_alignment); | 715 | EXPORT_SYMBOL(iov_iter_alignment); |
712 | 716 | ||
713 | ssize_t iov_iter_get_pages(struct iov_iter *i, | 717 | ssize_t iov_iter_get_pages(struct iov_iter *i, |
714 | struct page **pages, unsigned maxpages, | 718 | struct page **pages, size_t maxsize, unsigned maxpages, |
715 | size_t *start) | 719 | size_t *start) |
716 | { | 720 | { |
717 | if (i->type & ITER_BVEC) | 721 | if (i->type & ITER_BVEC) |
718 | return get_pages_bvec(i, pages, maxpages, start); | 722 | return get_pages_bvec(i, pages, maxsize, maxpages, start); |
719 | else | 723 | else |
720 | return get_pages_iovec(i, pages, maxpages, start); | 724 | return get_pages_iovec(i, pages, maxsize, maxpages, start); |
721 | } | 725 | } |
722 | EXPORT_SYMBOL(iov_iter_get_pages); | 726 | EXPORT_SYMBOL(iov_iter_get_pages); |
723 | 727 | ||
diff --git a/mm/memory.c b/mm/memory.c index d17f1bcd2a91..e229970e4223 100644 --- a/mm/memory.c +++ b/mm/memory.c | |||
@@ -1127,7 +1127,7 @@ again: | |||
1127 | addr) != page->index) { | 1127 | addr) != page->index) { |
1128 | pte_t ptfile = pgoff_to_pte(page->index); | 1128 | pte_t ptfile = pgoff_to_pte(page->index); |
1129 | if (pte_soft_dirty(ptent)) | 1129 | if (pte_soft_dirty(ptent)) |
1130 | pte_file_mksoft_dirty(ptfile); | 1130 | ptfile = pte_file_mksoft_dirty(ptfile); |
1131 | set_pte_at(mm, addr, pte, ptfile); | 1131 | set_pte_at(mm, addr, pte, ptfile); |
1132 | } | 1132 | } |
1133 | if (PageAnon(page)) | 1133 | if (PageAnon(page)) |
diff --git a/mm/shmem.c b/mm/shmem.c index 0e5fb225007c..469f90d56051 100644 --- a/mm/shmem.c +++ b/mm/shmem.c | |||
@@ -2367,8 +2367,10 @@ static int shmem_rename2(struct inode *old_dir, struct dentry *old_dentry, struc | |||
2367 | 2367 | ||
2368 | if (new_dentry->d_inode) { | 2368 | if (new_dentry->d_inode) { |
2369 | (void) shmem_unlink(new_dir, new_dentry); | 2369 | (void) shmem_unlink(new_dir, new_dentry); |
2370 | if (they_are_dirs) | 2370 | if (they_are_dirs) { |
2371 | drop_nlink(new_dentry->d_inode); | ||
2371 | drop_nlink(old_dir); | 2372 | drop_nlink(old_dir); |
2373 | } | ||
2372 | } else if (they_are_dirs) { | 2374 | } else if (they_are_dirs) { |
2373 | drop_nlink(old_dir); | 2375 | drop_nlink(old_dir); |
2374 | inc_nlink(new_dir); | 2376 | inc_nlink(new_dir); |
@@ -2124,7 +2124,8 @@ static int __init_refok setup_cpu_cache(struct kmem_cache *cachep, gfp_t gfp) | |||
2124 | int | 2124 | int |
2125 | __kmem_cache_create (struct kmem_cache *cachep, unsigned long flags) | 2125 | __kmem_cache_create (struct kmem_cache *cachep, unsigned long flags) |
2126 | { | 2126 | { |
2127 | size_t left_over, freelist_size, ralign; | 2127 | size_t left_over, freelist_size; |
2128 | size_t ralign = BYTES_PER_WORD; | ||
2128 | gfp_t gfp; | 2129 | gfp_t gfp; |
2129 | int err; | 2130 | int err; |
2130 | size_t size = cachep->size; | 2131 | size_t size = cachep->size; |
@@ -2157,14 +2158,6 @@ __kmem_cache_create (struct kmem_cache *cachep, unsigned long flags) | |||
2157 | size &= ~(BYTES_PER_WORD - 1); | 2158 | size &= ~(BYTES_PER_WORD - 1); |
2158 | } | 2159 | } |
2159 | 2160 | ||
2160 | /* | ||
2161 | * Redzoning and user store require word alignment or possibly larger. | ||
2162 | * Note this will be overridden by architecture or caller mandated | ||
2163 | * alignment if either is greater than BYTES_PER_WORD. | ||
2164 | */ | ||
2165 | if (flags & SLAB_STORE_USER) | ||
2166 | ralign = BYTES_PER_WORD; | ||
2167 | |||
2168 | if (flags & SLAB_RED_ZONE) { | 2161 | if (flags & SLAB_RED_ZONE) { |
2169 | ralign = REDZONE_ALIGN; | 2162 | ralign = REDZONE_ALIGN; |
2170 | /* If redzoning, ensure that the second redzone is suitably | 2163 | /* If redzoning, ensure that the second redzone is suitably |
@@ -2994,7 +2987,7 @@ out: | |||
2994 | 2987 | ||
2995 | #ifdef CONFIG_NUMA | 2988 | #ifdef CONFIG_NUMA |
2996 | /* | 2989 | /* |
2997 | * Try allocating on another node if PF_SPREAD_SLAB is a mempolicy is set. | 2990 | * Try allocating on another node if PFA_SPREAD_SLAB is a mempolicy is set. |
2998 | * | 2991 | * |
2999 | * If we are in_interrupt, then process context, including cpusets and | 2992 | * If we are in_interrupt, then process context, including cpusets and |
3000 | * mempolicy, may not apply and should not be used for allocation policy. | 2993 | * mempolicy, may not apply and should not be used for allocation policy. |
@@ -3226,7 +3219,7 @@ __do_cache_alloc(struct kmem_cache *cache, gfp_t flags) | |||
3226 | { | 3219 | { |
3227 | void *objp; | 3220 | void *objp; |
3228 | 3221 | ||
3229 | if (current->mempolicy || unlikely(current->flags & PF_SPREAD_SLAB)) { | 3222 | if (current->mempolicy || cpuset_do_slab_mem_spread()) { |
3230 | objp = alternate_node_alloc(cache, flags); | 3223 | objp = alternate_node_alloc(cache, flags); |
3231 | if (objp) | 3224 | if (objp) |
3232 | goto out; | 3225 | goto out; |
diff --git a/net/core/skbuff.c b/net/core/skbuff.c index f77e64873caf..fe37309b6667 100644 --- a/net/core/skbuff.c +++ b/net/core/skbuff.c | |||
@@ -3166,6 +3166,9 @@ int skb_gro_receive(struct sk_buff **head, struct sk_buff *skb) | |||
3166 | NAPI_GRO_CB(skb)->free = NAPI_GRO_FREE_STOLEN_HEAD; | 3166 | NAPI_GRO_CB(skb)->free = NAPI_GRO_FREE_STOLEN_HEAD; |
3167 | goto done; | 3167 | goto done; |
3168 | } | 3168 | } |
3169 | /* switch back to head shinfo */ | ||
3170 | pinfo = skb_shinfo(p); | ||
3171 | |||
3169 | if (pinfo->frag_list) | 3172 | if (pinfo->frag_list) |
3170 | goto merge; | 3173 | goto merge; |
3171 | if (skb_gro_len(p) != pinfo->gso_size) | 3174 | if (skb_gro_len(p) != pinfo->gso_size) |
diff --git a/net/ipv4/ip_tunnel.c b/net/ipv4/ip_tunnel.c index b75b47b0a223..2272de90c2d4 100644 --- a/net/ipv4/ip_tunnel.c +++ b/net/ipv4/ip_tunnel.c | |||
@@ -853,9 +853,14 @@ int ip_tunnel_ioctl(struct net_device *dev, struct ip_tunnel_parm *p, int cmd) | |||
853 | 853 | ||
854 | t = ip_tunnel_find(itn, p, itn->fb_tunnel_dev->type); | 854 | t = ip_tunnel_find(itn, p, itn->fb_tunnel_dev->type); |
855 | 855 | ||
856 | if (!t && (cmd == SIOCADDTUNNEL)) { | 856 | if (cmd == SIOCADDTUNNEL) { |
857 | t = ip_tunnel_create(net, itn, p); | 857 | if (!t) { |
858 | err = PTR_ERR_OR_ZERO(t); | 858 | t = ip_tunnel_create(net, itn, p); |
859 | err = PTR_ERR_OR_ZERO(t); | ||
860 | break; | ||
861 | } | ||
862 | |||
863 | err = -EEXIST; | ||
859 | break; | 864 | break; |
860 | } | 865 | } |
861 | if (dev != itn->fb_tunnel_dev && cmd == SIOCCHGTUNNEL) { | 866 | if (dev != itn->fb_tunnel_dev && cmd == SIOCCHGTUNNEL) { |
diff --git a/net/ipv4/route.c b/net/ipv4/route.c index d4bd68dcdc39..793c0bb8c4fd 100644 --- a/net/ipv4/route.c +++ b/net/ipv4/route.c | |||
@@ -746,7 +746,7 @@ static void __ip_do_redirect(struct rtable *rt, struct sk_buff *skb, struct flow | |||
746 | } | 746 | } |
747 | 747 | ||
748 | n = ipv4_neigh_lookup(&rt->dst, NULL, &new_gw); | 748 | n = ipv4_neigh_lookup(&rt->dst, NULL, &new_gw); |
749 | if (n) { | 749 | if (!IS_ERR(n)) { |
750 | if (!(n->nud_state & NUD_VALID)) { | 750 | if (!(n->nud_state & NUD_VALID)) { |
751 | neigh_event_send(n, NULL); | 751 | neigh_event_send(n, NULL); |
752 | } else { | 752 | } else { |
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c index e189480f8fd6..725c763270a0 100644 --- a/net/ipv6/addrconf.c +++ b/net/ipv6/addrconf.c | |||
@@ -4783,10 +4783,11 @@ static void __ipv6_ifa_notify(int event, struct inet6_ifaddr *ifp) | |||
4783 | 4783 | ||
4784 | if (ip6_del_rt(ifp->rt)) | 4784 | if (ip6_del_rt(ifp->rt)) |
4785 | dst_free(&ifp->rt->dst); | 4785 | dst_free(&ifp->rt->dst); |
4786 | |||
4787 | rt_genid_bump_ipv6(net); | ||
4786 | break; | 4788 | break; |
4787 | } | 4789 | } |
4788 | atomic_inc(&net->ipv6.dev_addr_genid); | 4790 | atomic_inc(&net->ipv6.dev_addr_genid); |
4789 | rt_genid_bump_ipv6(net); | ||
4790 | } | 4791 | } |
4791 | 4792 | ||
4792 | static void ipv6_ifa_notify(int event, struct inet6_ifaddr *ifp) | 4793 | static void ipv6_ifa_notify(int event, struct inet6_ifaddr *ifp) |
diff --git a/net/ipv6/addrconf_core.c b/net/ipv6/addrconf_core.c index e6960457f625..98cc4cd570e2 100644 --- a/net/ipv6/addrconf_core.c +++ b/net/ipv6/addrconf_core.c | |||
@@ -8,6 +8,13 @@ | |||
8 | #include <net/addrconf.h> | 8 | #include <net/addrconf.h> |
9 | #include <net/ip.h> | 9 | #include <net/ip.h> |
10 | 10 | ||
11 | /* if ipv6 module registers this function is used by xfrm to force all | ||
12 | * sockets to relookup their nodes - this is fairly expensive, be | ||
13 | * careful | ||
14 | */ | ||
15 | void (*__fib6_flush_trees)(struct net *); | ||
16 | EXPORT_SYMBOL(__fib6_flush_trees); | ||
17 | |||
11 | #define IPV6_ADDR_SCOPE_TYPE(scope) ((scope) << 16) | 18 | #define IPV6_ADDR_SCOPE_TYPE(scope) ((scope) << 16) |
12 | 19 | ||
13 | static inline unsigned int ipv6_addr_scope2type(unsigned int scope) | 20 | static inline unsigned int ipv6_addr_scope2type(unsigned int scope) |
diff --git a/net/ipv6/ip6_fib.c b/net/ipv6/ip6_fib.c index 76b7f5ee8f4c..97b9fa8de377 100644 --- a/net/ipv6/ip6_fib.c +++ b/net/ipv6/ip6_fib.c | |||
@@ -1605,6 +1605,24 @@ static void fib6_prune_clones(struct net *net, struct fib6_node *fn) | |||
1605 | fib6_clean_tree(net, fn, fib6_prune_clone, 1, NULL); | 1605 | fib6_clean_tree(net, fn, fib6_prune_clone, 1, NULL); |
1606 | } | 1606 | } |
1607 | 1607 | ||
1608 | static int fib6_update_sernum(struct rt6_info *rt, void *arg) | ||
1609 | { | ||
1610 | __u32 sernum = *(__u32 *)arg; | ||
1611 | |||
1612 | if (rt->rt6i_node && | ||
1613 | rt->rt6i_node->fn_sernum != sernum) | ||
1614 | rt->rt6i_node->fn_sernum = sernum; | ||
1615 | |||
1616 | return 0; | ||
1617 | } | ||
1618 | |||
1619 | static void fib6_flush_trees(struct net *net) | ||
1620 | { | ||
1621 | __u32 new_sernum = fib6_new_sernum(); | ||
1622 | |||
1623 | fib6_clean_all(net, fib6_update_sernum, &new_sernum); | ||
1624 | } | ||
1625 | |||
1608 | /* | 1626 | /* |
1609 | * Garbage collection | 1627 | * Garbage collection |
1610 | */ | 1628 | */ |
@@ -1788,6 +1806,8 @@ int __init fib6_init(void) | |||
1788 | NULL); | 1806 | NULL); |
1789 | if (ret) | 1807 | if (ret) |
1790 | goto out_unregister_subsys; | 1808 | goto out_unregister_subsys; |
1809 | |||
1810 | __fib6_flush_trees = fib6_flush_trees; | ||
1791 | out: | 1811 | out: |
1792 | return ret; | 1812 | return ret; |
1793 | 1813 | ||
diff --git a/net/ipv6/ip6_gre.c b/net/ipv6/ip6_gre.c index 9a0a1aafe727..74b677916a70 100644 --- a/net/ipv6/ip6_gre.c +++ b/net/ipv6/ip6_gre.c | |||
@@ -314,6 +314,8 @@ static struct ip6_tnl *ip6gre_tunnel_locate(struct net *net, | |||
314 | struct ip6gre_net *ign = net_generic(net, ip6gre_net_id); | 314 | struct ip6gre_net *ign = net_generic(net, ip6gre_net_id); |
315 | 315 | ||
316 | t = ip6gre_tunnel_find(net, parms, ARPHRD_IP6GRE); | 316 | t = ip6gre_tunnel_find(net, parms, ARPHRD_IP6GRE); |
317 | if (t && create) | ||
318 | return NULL; | ||
317 | if (t || !create) | 319 | if (t || !create) |
318 | return t; | 320 | return t; |
319 | 321 | ||
@@ -1728,4 +1730,5 @@ MODULE_LICENSE("GPL"); | |||
1728 | MODULE_AUTHOR("D. Kozlov (xeb@mail.ru)"); | 1730 | MODULE_AUTHOR("D. Kozlov (xeb@mail.ru)"); |
1729 | MODULE_DESCRIPTION("GRE over IPv6 tunneling device"); | 1731 | MODULE_DESCRIPTION("GRE over IPv6 tunneling device"); |
1730 | MODULE_ALIAS_RTNL_LINK("ip6gre"); | 1732 | MODULE_ALIAS_RTNL_LINK("ip6gre"); |
1733 | MODULE_ALIAS_RTNL_LINK("ip6gretap"); | ||
1731 | MODULE_ALIAS_NETDEV("ip6gre0"); | 1734 | MODULE_ALIAS_NETDEV("ip6gre0"); |
diff --git a/net/ipv6/ip6_tunnel.c b/net/ipv6/ip6_tunnel.c index e01bd0399297..d3e8888ad611 100644 --- a/net/ipv6/ip6_tunnel.c +++ b/net/ipv6/ip6_tunnel.c | |||
@@ -364,8 +364,12 @@ static struct ip6_tnl *ip6_tnl_locate(struct net *net, | |||
364 | (t = rtnl_dereference(*tp)) != NULL; | 364 | (t = rtnl_dereference(*tp)) != NULL; |
365 | tp = &t->next) { | 365 | tp = &t->next) { |
366 | if (ipv6_addr_equal(local, &t->parms.laddr) && | 366 | if (ipv6_addr_equal(local, &t->parms.laddr) && |
367 | ipv6_addr_equal(remote, &t->parms.raddr)) | 367 | ipv6_addr_equal(remote, &t->parms.raddr)) { |
368 | if (create) | ||
369 | return NULL; | ||
370 | |||
368 | return t; | 371 | return t; |
372 | } | ||
369 | } | 373 | } |
370 | if (!create) | 374 | if (!create) |
371 | return NULL; | 375 | return NULL; |
diff --git a/net/ipv6/ip6_vti.c b/net/ipv6/ip6_vti.c index 7f52fd9fa7b0..5833a2244467 100644 --- a/net/ipv6/ip6_vti.c +++ b/net/ipv6/ip6_vti.c | |||
@@ -253,8 +253,12 @@ static struct ip6_tnl *vti6_locate(struct net *net, struct __ip6_tnl_parm *p, | |||
253 | (t = rtnl_dereference(*tp)) != NULL; | 253 | (t = rtnl_dereference(*tp)) != NULL; |
254 | tp = &t->next) { | 254 | tp = &t->next) { |
255 | if (ipv6_addr_equal(local, &t->parms.laddr) && | 255 | if (ipv6_addr_equal(local, &t->parms.laddr) && |
256 | ipv6_addr_equal(remote, &t->parms.raddr)) | 256 | ipv6_addr_equal(remote, &t->parms.raddr)) { |
257 | if (create) | ||
258 | return NULL; | ||
259 | |||
257 | return t; | 260 | return t; |
261 | } | ||
258 | } | 262 | } |
259 | if (!create) | 263 | if (!create) |
260 | return NULL; | 264 | return NULL; |
diff --git a/net/ipv6/route.c b/net/ipv6/route.c index f74b0417bd60..a318dd89b6d9 100644 --- a/net/ipv6/route.c +++ b/net/ipv6/route.c | |||
@@ -314,7 +314,6 @@ static inline struct rt6_info *ip6_dst_alloc(struct net *net, | |||
314 | 314 | ||
315 | memset(dst + 1, 0, sizeof(*rt) - sizeof(*dst)); | 315 | memset(dst + 1, 0, sizeof(*rt) - sizeof(*dst)); |
316 | rt6_init_peer(rt, table ? &table->tb6_peers : net->ipv6.peers); | 316 | rt6_init_peer(rt, table ? &table->tb6_peers : net->ipv6.peers); |
317 | rt->rt6i_genid = rt_genid_ipv6(net); | ||
318 | INIT_LIST_HEAD(&rt->rt6i_siblings); | 317 | INIT_LIST_HEAD(&rt->rt6i_siblings); |
319 | } | 318 | } |
320 | return rt; | 319 | return rt; |
@@ -1096,9 +1095,6 @@ static struct dst_entry *ip6_dst_check(struct dst_entry *dst, u32 cookie) | |||
1096 | * DST_OBSOLETE_FORCE_CHK which forces validation calls down | 1095 | * DST_OBSOLETE_FORCE_CHK which forces validation calls down |
1097 | * into this function always. | 1096 | * into this function always. |
1098 | */ | 1097 | */ |
1099 | if (rt->rt6i_genid != rt_genid_ipv6(dev_net(rt->dst.dev))) | ||
1100 | return NULL; | ||
1101 | |||
1102 | if (!rt->rt6i_node || (rt->rt6i_node->fn_sernum != cookie)) | 1098 | if (!rt->rt6i_node || (rt->rt6i_node->fn_sernum != cookie)) |
1103 | return NULL; | 1099 | return NULL; |
1104 | 1100 | ||
diff --git a/net/netfilter/Kconfig b/net/netfilter/Kconfig index 608d18986923..ae5096ab65eb 100644 --- a/net/netfilter/Kconfig +++ b/net/netfilter/Kconfig | |||
@@ -856,6 +856,7 @@ config NETFILTER_XT_TARGET_TPROXY | |||
856 | tristate '"TPROXY" target transparent proxying support' | 856 | tristate '"TPROXY" target transparent proxying support' |
857 | depends on NETFILTER_XTABLES | 857 | depends on NETFILTER_XTABLES |
858 | depends on NETFILTER_ADVANCED | 858 | depends on NETFILTER_ADVANCED |
859 | depends on (IPV6 || IPV6=n) | ||
859 | depends on IP_NF_MANGLE | 860 | depends on IP_NF_MANGLE |
860 | select NF_DEFRAG_IPV4 | 861 | select NF_DEFRAG_IPV4 |
861 | select NF_DEFRAG_IPV6 if IP6_NF_IPTABLES | 862 | select NF_DEFRAG_IPV6 if IP6_NF_IPTABLES |
diff --git a/net/netfilter/nfnetlink.c b/net/netfilter/nfnetlink.c index f77d3f7f22b5..6c5a915cfa75 100644 --- a/net/netfilter/nfnetlink.c +++ b/net/netfilter/nfnetlink.c | |||
@@ -222,6 +222,51 @@ replay: | |||
222 | } | 222 | } |
223 | } | 223 | } |
224 | 224 | ||
225 | struct nfnl_err { | ||
226 | struct list_head head; | ||
227 | struct nlmsghdr *nlh; | ||
228 | int err; | ||
229 | }; | ||
230 | |||
231 | static int nfnl_err_add(struct list_head *list, struct nlmsghdr *nlh, int err) | ||
232 | { | ||
233 | struct nfnl_err *nfnl_err; | ||
234 | |||
235 | nfnl_err = kmalloc(sizeof(struct nfnl_err), GFP_KERNEL); | ||
236 | if (nfnl_err == NULL) | ||
237 | return -ENOMEM; | ||
238 | |||
239 | nfnl_err->nlh = nlh; | ||
240 | nfnl_err->err = err; | ||
241 | list_add_tail(&nfnl_err->head, list); | ||
242 | |||
243 | return 0; | ||
244 | } | ||
245 | |||
246 | static void nfnl_err_del(struct nfnl_err *nfnl_err) | ||
247 | { | ||
248 | list_del(&nfnl_err->head); | ||
249 | kfree(nfnl_err); | ||
250 | } | ||
251 | |||
252 | static void nfnl_err_reset(struct list_head *err_list) | ||
253 | { | ||
254 | struct nfnl_err *nfnl_err, *next; | ||
255 | |||
256 | list_for_each_entry_safe(nfnl_err, next, err_list, head) | ||
257 | nfnl_err_del(nfnl_err); | ||
258 | } | ||
259 | |||
260 | static void nfnl_err_deliver(struct list_head *err_list, struct sk_buff *skb) | ||
261 | { | ||
262 | struct nfnl_err *nfnl_err, *next; | ||
263 | |||
264 | list_for_each_entry_safe(nfnl_err, next, err_list, head) { | ||
265 | netlink_ack(skb, nfnl_err->nlh, nfnl_err->err); | ||
266 | nfnl_err_del(nfnl_err); | ||
267 | } | ||
268 | } | ||
269 | |||
225 | static void nfnetlink_rcv_batch(struct sk_buff *skb, struct nlmsghdr *nlh, | 270 | static void nfnetlink_rcv_batch(struct sk_buff *skb, struct nlmsghdr *nlh, |
226 | u_int16_t subsys_id) | 271 | u_int16_t subsys_id) |
227 | { | 272 | { |
@@ -230,6 +275,7 @@ static void nfnetlink_rcv_batch(struct sk_buff *skb, struct nlmsghdr *nlh, | |||
230 | const struct nfnetlink_subsystem *ss; | 275 | const struct nfnetlink_subsystem *ss; |
231 | const struct nfnl_callback *nc; | 276 | const struct nfnl_callback *nc; |
232 | bool success = true, done = false; | 277 | bool success = true, done = false; |
278 | static LIST_HEAD(err_list); | ||
233 | int err; | 279 | int err; |
234 | 280 | ||
235 | if (subsys_id >= NFNL_SUBSYS_COUNT) | 281 | if (subsys_id >= NFNL_SUBSYS_COUNT) |
@@ -287,6 +333,7 @@ replay: | |||
287 | type = nlh->nlmsg_type; | 333 | type = nlh->nlmsg_type; |
288 | if (type == NFNL_MSG_BATCH_BEGIN) { | 334 | if (type == NFNL_MSG_BATCH_BEGIN) { |
289 | /* Malformed: Batch begin twice */ | 335 | /* Malformed: Batch begin twice */ |
336 | nfnl_err_reset(&err_list); | ||
290 | success = false; | 337 | success = false; |
291 | goto done; | 338 | goto done; |
292 | } else if (type == NFNL_MSG_BATCH_END) { | 339 | } else if (type == NFNL_MSG_BATCH_END) { |
@@ -333,6 +380,7 @@ replay: | |||
333 | * original skb. | 380 | * original skb. |
334 | */ | 381 | */ |
335 | if (err == -EAGAIN) { | 382 | if (err == -EAGAIN) { |
383 | nfnl_err_reset(&err_list); | ||
336 | ss->abort(oskb); | 384 | ss->abort(oskb); |
337 | nfnl_unlock(subsys_id); | 385 | nfnl_unlock(subsys_id); |
338 | kfree_skb(nskb); | 386 | kfree_skb(nskb); |
@@ -341,11 +389,24 @@ replay: | |||
341 | } | 389 | } |
342 | ack: | 390 | ack: |
343 | if (nlh->nlmsg_flags & NLM_F_ACK || err) { | 391 | if (nlh->nlmsg_flags & NLM_F_ACK || err) { |
392 | /* Errors are delivered once the full batch has been | ||
393 | * processed, this avoids that the same error is | ||
394 | * reported several times when replaying the batch. | ||
395 | */ | ||
396 | if (nfnl_err_add(&err_list, nlh, err) < 0) { | ||
397 | /* We failed to enqueue an error, reset the | ||
398 | * list of errors and send OOM to userspace | ||
399 | * pointing to the batch header. | ||
400 | */ | ||
401 | nfnl_err_reset(&err_list); | ||
402 | netlink_ack(skb, nlmsg_hdr(oskb), -ENOMEM); | ||
403 | success = false; | ||
404 | goto done; | ||
405 | } | ||
344 | /* We don't stop processing the batch on errors, thus, | 406 | /* We don't stop processing the batch on errors, thus, |
345 | * userspace gets all the errors that the batch | 407 | * userspace gets all the errors that the batch |
346 | * triggers. | 408 | * triggers. |
347 | */ | 409 | */ |
348 | netlink_ack(skb, nlh, err); | ||
349 | if (err) | 410 | if (err) |
350 | success = false; | 411 | success = false; |
351 | } | 412 | } |
@@ -361,6 +422,7 @@ done: | |||
361 | else | 422 | else |
362 | ss->abort(oskb); | 423 | ss->abort(oskb); |
363 | 424 | ||
425 | nfnl_err_deliver(&err_list, oskb); | ||
364 | nfnl_unlock(subsys_id); | 426 | nfnl_unlock(subsys_id); |
365 | kfree_skb(nskb); | 427 | kfree_skb(nskb); |
366 | } | 428 | } |
diff --git a/net/netfilter/nft_hash.c b/net/netfilter/nft_hash.c index 28fb8f38e6ba..8892b7b6184a 100644 --- a/net/netfilter/nft_hash.c +++ b/net/netfilter/nft_hash.c | |||
@@ -180,15 +180,17 @@ static int nft_hash_init(const struct nft_set *set, | |||
180 | static void nft_hash_destroy(const struct nft_set *set) | 180 | static void nft_hash_destroy(const struct nft_set *set) |
181 | { | 181 | { |
182 | const struct rhashtable *priv = nft_set_priv(set); | 182 | const struct rhashtable *priv = nft_set_priv(set); |
183 | const struct bucket_table *tbl; | 183 | const struct bucket_table *tbl = priv->tbl; |
184 | struct nft_hash_elem *he, *next; | 184 | struct nft_hash_elem *he, *next; |
185 | unsigned int i; | 185 | unsigned int i; |
186 | 186 | ||
187 | tbl = rht_dereference(priv->tbl, priv); | 187 | for (i = 0; i < tbl->size; i++) { |
188 | for (i = 0; i < tbl->size; i++) | 188 | for (he = rht_entry(tbl->buckets[i], struct nft_hash_elem, node); |
189 | rht_for_each_entry_safe(he, next, tbl->buckets[i], priv, node) | 189 | he != NULL; he = next) { |
190 | next = rht_entry(he->node.next, struct nft_hash_elem, node); | ||
190 | nft_hash_elem_destroy(set, he); | 191 | nft_hash_elem_destroy(set, he); |
191 | 192 | } | |
193 | } | ||
192 | rhashtable_destroy(priv); | 194 | rhashtable_destroy(priv); |
193 | } | 195 | } |
194 | 196 | ||
diff --git a/net/netfilter/nft_rbtree.c b/net/netfilter/nft_rbtree.c index e1836ff88199..46214f245665 100644 --- a/net/netfilter/nft_rbtree.c +++ b/net/netfilter/nft_rbtree.c | |||
@@ -234,13 +234,11 @@ static void nft_rbtree_destroy(const struct nft_set *set) | |||
234 | struct nft_rbtree_elem *rbe; | 234 | struct nft_rbtree_elem *rbe; |
235 | struct rb_node *node; | 235 | struct rb_node *node; |
236 | 236 | ||
237 | spin_lock_bh(&nft_rbtree_lock); | ||
238 | while ((node = priv->root.rb_node) != NULL) { | 237 | while ((node = priv->root.rb_node) != NULL) { |
239 | rb_erase(node, &priv->root); | 238 | rb_erase(node, &priv->root); |
240 | rbe = rb_entry(node, struct nft_rbtree_elem, node); | 239 | rbe = rb_entry(node, struct nft_rbtree_elem, node); |
241 | nft_rbtree_elem_destroy(set, rbe); | 240 | nft_rbtree_elem_destroy(set, rbe); |
242 | } | 241 | } |
243 | spin_unlock_bh(&nft_rbtree_lock); | ||
244 | } | 242 | } |
245 | 243 | ||
246 | static bool nft_rbtree_estimate(const struct nft_set_desc *desc, u32 features, | 244 | static bool nft_rbtree_estimate(const struct nft_set_desc *desc, u32 features, |
diff --git a/net/sched/ematch.c b/net/sched/ematch.c index 3a633debb6df..ad57f4444b9c 100644 --- a/net/sched/ematch.c +++ b/net/sched/ematch.c | |||
@@ -526,9 +526,11 @@ pop_stack: | |||
526 | match_idx = stack[--stackp]; | 526 | match_idx = stack[--stackp]; |
527 | cur_match = tcf_em_get_match(tree, match_idx); | 527 | cur_match = tcf_em_get_match(tree, match_idx); |
528 | 528 | ||
529 | if (tcf_em_early_end(cur_match, res)) | 529 | if (tcf_em_early_end(cur_match, res)) { |
530 | if (tcf_em_is_inverted(cur_match)) | ||
531 | res = !res; | ||
530 | goto pop_stack; | 532 | goto pop_stack; |
531 | else { | 533 | } else { |
532 | match_idx++; | 534 | match_idx++; |
533 | goto proceed; | 535 | goto proceed; |
534 | } | 536 | } |
diff --git a/scripts/tags.sh b/scripts/tags.sh index cbfd269a6011..293828bfd4ac 100755 --- a/scripts/tags.sh +++ b/scripts/tags.sh | |||
@@ -197,6 +197,9 @@ exuberant() | |||
197 | --regex-c++='/SETPCGFLAG\(([^,)]*).*/SetPageCgroup\1/' \ | 197 | --regex-c++='/SETPCGFLAG\(([^,)]*).*/SetPageCgroup\1/' \ |
198 | --regex-c++='/CLEARPCGFLAG\(([^,)]*).*/ClearPageCgroup\1/' \ | 198 | --regex-c++='/CLEARPCGFLAG\(([^,)]*).*/ClearPageCgroup\1/' \ |
199 | --regex-c++='/TESTCLEARPCGFLAG\(([^,)]*).*/TestClearPageCgroup\1/' \ | 199 | --regex-c++='/TESTCLEARPCGFLAG\(([^,)]*).*/TestClearPageCgroup\1/' \ |
200 | --regex-c++='/TASK_PFA_TEST\([^,]*,\s*([^)]*)\)/task_\1/' \ | ||
201 | --regex-c++='/TASK_PFA_SET\([^,]*,\s*([^)]*)\)/task_set_\1/' \ | ||
202 | --regex-c++='/TASK_PFA_CLEAR\([^,]*,\s*([^)]*)\)/task_clear_\1/'\ | ||
200 | --regex-c='/PCI_OP_READ\((\w*).*[1-4]\)/pci_bus_read_config_\1/' \ | 203 | --regex-c='/PCI_OP_READ\((\w*).*[1-4]\)/pci_bus_read_config_\1/' \ |
201 | --regex-c='/PCI_OP_WRITE\((\w*).*[1-4]\)/pci_bus_write_config_\1/' \ | 204 | --regex-c='/PCI_OP_WRITE\((\w*).*[1-4]\)/pci_bus_write_config_\1/' \ |
202 | --regex-c='/DEFINE_(MUTEX|SEMAPHORE|SPINLOCK)\((\w*)/\2/v/' \ | 205 | --regex-c='/DEFINE_(MUTEX|SEMAPHORE|SPINLOCK)\((\w*)/\2/v/' \ |
@@ -260,6 +263,9 @@ emacs() | |||
260 | --regex='/SETPCGFLAG\(([^,)]*).*/SetPageCgroup\1/' \ | 263 | --regex='/SETPCGFLAG\(([^,)]*).*/SetPageCgroup\1/' \ |
261 | --regex='/CLEARPCGFLAG\(([^,)]*).*/ClearPageCgroup\1/' \ | 264 | --regex='/CLEARPCGFLAG\(([^,)]*).*/ClearPageCgroup\1/' \ |
262 | --regex='/TESTCLEARPCGFLAG\(([^,)]*).*/TestClearPageCgroup\1/' \ | 265 | --regex='/TESTCLEARPCGFLAG\(([^,)]*).*/TestClearPageCgroup\1/' \ |
266 | --regex='/TASK_PFA_TEST\([^,]*,\s*([^)]*)\)/task_\1/' \ | ||
267 | --regex='/TASK_PFA_SET\([^,]*,\s*([^)]*)\)/task_set_\1/' \ | ||
268 | --regex='/TASK_PFA_CLEAR\([^,]*,\s*([^)]*)\)/task_clear_\1/' \ | ||
263 | --regex='/_PE(\([^,)]*\).*/PEVENT_ERRNO__\1/' \ | 269 | --regex='/_PE(\([^,)]*\).*/PEVENT_ERRNO__\1/' \ |
264 | --regex='/PCI_OP_READ(\([a-z]*[a-z]\).*[1-4])/pci_bus_read_config_\1/' \ | 270 | --regex='/PCI_OP_READ(\([a-z]*[a-z]\).*[1-4])/pci_bus_read_config_\1/' \ |
265 | --regex='/PCI_OP_WRITE(\([a-z]*[a-z]\).*[1-4])/pci_bus_write_config_\1/'\ | 271 | --regex='/PCI_OP_WRITE(\([a-z]*[a-z]\).*[1-4])/pci_bus_write_config_\1/'\ |