diff options
465 files changed, 7206 insertions, 2385 deletions
diff --git a/Documentation/acpi/gpio-properties.txt b/Documentation/acpi/gpio-properties.txt new file mode 100644 index 000000000000..ae36fcf86dc7 --- /dev/null +++ b/Documentation/acpi/gpio-properties.txt | |||
@@ -0,0 +1,96 @@ | |||
1 | _DSD Device Properties Related to GPIO | ||
2 | -------------------------------------- | ||
3 | |||
4 | With the release of ACPI 5.1 and the _DSD configuration objecte names | ||
5 | can finally be given to GPIOs (and other things as well) returned by | ||
6 | _CRS. Previously, we were only able to use an integer index to find | ||
7 | the corresponding GPIO, which is pretty error prone (it depends on | ||
8 | the _CRS output ordering, for example). | ||
9 | |||
10 | With _DSD we can now query GPIOs using a name instead of an integer | ||
11 | index, like the ASL example below shows: | ||
12 | |||
13 | // Bluetooth device with reset and shutdown GPIOs | ||
14 | Device (BTH) | ||
15 | { | ||
16 | Name (_HID, ...) | ||
17 | |||
18 | Name (_CRS, ResourceTemplate () | ||
19 | { | ||
20 | GpioIo (Exclusive, PullUp, 0, 0, IoRestrictionInputOnly, | ||
21 | "\\_SB.GPO0", 0, ResourceConsumer) {15} | ||
22 | GpioIo (Exclusive, PullUp, 0, 0, IoRestrictionInputOnly, | ||
23 | "\\_SB.GPO0", 0, ResourceConsumer) {27, 31} | ||
24 | }) | ||
25 | |||
26 | Name (_DSD, Package () | ||
27 | { | ||
28 | ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), | ||
29 | Package () | ||
30 | { | ||
31 | Package () {"reset-gpio", Package() {^BTH, 1, 1, 0 }}, | ||
32 | Package () {"shutdown-gpio", Package() {^BTH, 0, 0, 0 }}, | ||
33 | } | ||
34 | }) | ||
35 | } | ||
36 | |||
37 | The format of the supported GPIO property is: | ||
38 | |||
39 | Package () { "name", Package () { ref, index, pin, active_low }} | ||
40 | |||
41 | ref - The device that has _CRS containing GpioIo()/GpioInt() resources, | ||
42 | typically this is the device itself (BTH in our case). | ||
43 | index - Index of the GpioIo()/GpioInt() resource in _CRS starting from zero. | ||
44 | pin - Pin in the GpioIo()/GpioInt() resource. Typically this is zero. | ||
45 | active_low - If 1 the GPIO is marked as active_low. | ||
46 | |||
47 | Since ACPI GpioIo() resource does not have a field saying whether it is | ||
48 | active low or high, the "active_low" argument can be used here. Setting | ||
49 | it to 1 marks the GPIO as active low. | ||
50 | |||
51 | In our Bluetooth example the "reset-gpio" refers to the second GpioIo() | ||
52 | resource, second pin in that resource with the GPIO number of 31. | ||
53 | |||
54 | ACPI GPIO Mappings Provided by Drivers | ||
55 | -------------------------------------- | ||
56 | |||
57 | There are systems in which the ACPI tables do not contain _DSD but provide _CRS | ||
58 | with GpioIo()/GpioInt() resources and device drivers still need to work with | ||
59 | them. | ||
60 | |||
61 | In those cases ACPI device identification objects, _HID, _CID, _CLS, _SUB, _HRV, | ||
62 | available to the driver can be used to identify the device and that is supposed | ||
63 | to be sufficient to determine the meaning and purpose of all of the GPIO lines | ||
64 | listed by the GpioIo()/GpioInt() resources returned by _CRS. In other words, | ||
65 | the driver is supposed to know what to use the GpioIo()/GpioInt() resources for | ||
66 | once it has identified the device. Having done that, it can simply assign names | ||
67 | to the GPIO lines it is going to use and provide the GPIO subsystem with a | ||
68 | mapping between those names and the ACPI GPIO resources corresponding to them. | ||
69 | |||
70 | To do that, the driver needs to define a mapping table as a NULL-terminated | ||
71 | array of struct acpi_gpio_mapping objects that each contain a name, a pointer | ||
72 | to an array of line data (struct acpi_gpio_params) objects and the size of that | ||
73 | array. Each struct acpi_gpio_params object consists of three fields, | ||
74 | crs_entry_index, line_index, active_low, representing the index of the target | ||
75 | GpioIo()/GpioInt() resource in _CRS starting from zero, the index of the target | ||
76 | line in that resource starting from zero, and the active-low flag for that line, | ||
77 | respectively, in analogy with the _DSD GPIO property format specified above. | ||
78 | |||
79 | For the example Bluetooth device discussed previously the data structures in | ||
80 | question would look like this: | ||
81 | |||
82 | static const struct acpi_gpio_params reset_gpio = { 1, 1, false }; | ||
83 | static const struct acpi_gpio_params shutdown_gpio = { 0, 0, false }; | ||
84 | |||
85 | static const struct acpi_gpio_mapping bluetooth_acpi_gpios[] = { | ||
86 | { "reset-gpio", &reset_gpio, 1 }, | ||
87 | { "shutdown-gpio", &shutdown_gpio, 1 }, | ||
88 | { }, | ||
89 | }; | ||
90 | |||
91 | Next, the mapping table needs to be passed as the second argument to | ||
92 | acpi_dev_add_driver_gpios() that will register it with the ACPI device object | ||
93 | pointed to by its first argument. That should be done in the driver's .probe() | ||
94 | routine. On removal, the driver should unregister its GPIO mapping table by | ||
95 | calling acpi_dev_remove_driver_gpios() on the ACPI device object where that | ||
96 | table was previously registered. | ||
diff --git a/Documentation/devicetree/bindings/interrupt-controller/interrupts.txt b/Documentation/devicetree/bindings/interrupt-controller/interrupts.txt index ce6a1a072028..8a3c40829899 100644 --- a/Documentation/devicetree/bindings/interrupt-controller/interrupts.txt +++ b/Documentation/devicetree/bindings/interrupt-controller/interrupts.txt | |||
@@ -30,10 +30,6 @@ should only be used when a device has multiple interrupt parents. | |||
30 | Example: | 30 | Example: |
31 | interrupts-extended = <&intc1 5 1>, <&intc2 1 0>; | 31 | interrupts-extended = <&intc1 5 1>, <&intc2 1 0>; |
32 | 32 | ||
33 | A device node may contain either "interrupts" or "interrupts-extended", but not | ||
34 | both. If both properties are present, then the operating system should log an | ||
35 | error and use only the data in "interrupts". | ||
36 | |||
37 | 2) Interrupt controller nodes | 33 | 2) Interrupt controller nodes |
38 | ----------------------------- | 34 | ----------------------------- |
39 | 35 | ||
diff --git a/Documentation/devicetree/bindings/pci/pci.txt b/Documentation/devicetree/bindings/pci/pci.txt index 41aeed38926d..f8fbe9af7b2f 100644 --- a/Documentation/devicetree/bindings/pci/pci.txt +++ b/Documentation/devicetree/bindings/pci/pci.txt | |||
@@ -7,3 +7,14 @@ And for the interrupt mapping part: | |||
7 | 7 | ||
8 | Open Firmware Recommended Practice: Interrupt Mapping | 8 | Open Firmware Recommended Practice: Interrupt Mapping |
9 | http://www.openfirmware.org/1275/practice/imap/imap0_9d.pdf | 9 | http://www.openfirmware.org/1275/practice/imap/imap0_9d.pdf |
10 | |||
11 | Additionally to the properties specified in the above standards a host bridge | ||
12 | driver implementation may support the following properties: | ||
13 | |||
14 | - linux,pci-domain: | ||
15 | If present this property assigns a fixed PCI domain number to a host bridge, | ||
16 | otherwise an unstable (across boots) unique number will be assigned. | ||
17 | It is required to either not set this property at all or set it for all | ||
18 | host bridges in the system, otherwise potentially conflicting domain numbers | ||
19 | may be assigned to root buses behind different host bridges. The domain | ||
20 | number for each host bridge in the system must be unique. | ||
diff --git a/Documentation/devicetree/bindings/pinctrl/img,tz1090-pdc-pinctrl.txt b/Documentation/devicetree/bindings/pinctrl/img,tz1090-pdc-pinctrl.txt index a186181c402b..51b943cc9770 100644 --- a/Documentation/devicetree/bindings/pinctrl/img,tz1090-pdc-pinctrl.txt +++ b/Documentation/devicetree/bindings/pinctrl/img,tz1090-pdc-pinctrl.txt | |||
@@ -9,7 +9,7 @@ Please refer to pinctrl-bindings.txt in this directory for details of the | |||
9 | common pinctrl bindings used by client devices, including the meaning of the | 9 | common pinctrl bindings used by client devices, including the meaning of the |
10 | phrase "pin configuration node". | 10 | phrase "pin configuration node". |
11 | 11 | ||
12 | TZ1090-PDC's pin configuration nodes act as a container for an abitrary number | 12 | TZ1090-PDC's pin configuration nodes act as a container for an arbitrary number |
13 | of subnodes. Each of these subnodes represents some desired configuration for a | 13 | of subnodes. Each of these subnodes represents some desired configuration for a |
14 | pin, a group, or a list of pins or groups. This configuration can include the | 14 | pin, a group, or a list of pins or groups. This configuration can include the |
15 | mux function to select on those pin(s)/group(s), and various pin configuration | 15 | mux function to select on those pin(s)/group(s), and various pin configuration |
diff --git a/Documentation/devicetree/bindings/pinctrl/img,tz1090-pinctrl.txt b/Documentation/devicetree/bindings/pinctrl/img,tz1090-pinctrl.txt index 4b27c99f7f9d..49d0e6050940 100644 --- a/Documentation/devicetree/bindings/pinctrl/img,tz1090-pinctrl.txt +++ b/Documentation/devicetree/bindings/pinctrl/img,tz1090-pinctrl.txt | |||
@@ -9,7 +9,7 @@ Please refer to pinctrl-bindings.txt in this directory for details of the | |||
9 | common pinctrl bindings used by client devices, including the meaning of the | 9 | common pinctrl bindings used by client devices, including the meaning of the |
10 | phrase "pin configuration node". | 10 | phrase "pin configuration node". |
11 | 11 | ||
12 | TZ1090's pin configuration nodes act as a container for an abitrary number of | 12 | TZ1090's pin configuration nodes act as a container for an arbitrary number of |
13 | subnodes. Each of these subnodes represents some desired configuration for a | 13 | subnodes. Each of these subnodes represents some desired configuration for a |
14 | pin, a group, or a list of pins or groups. This configuration can include the | 14 | pin, a group, or a list of pins or groups. This configuration can include the |
15 | mux function to select on those pin(s)/group(s), and various pin configuration | 15 | mux function to select on those pin(s)/group(s), and various pin configuration |
diff --git a/Documentation/devicetree/bindings/pinctrl/lantiq,falcon-pinumx.txt b/Documentation/devicetree/bindings/pinctrl/lantiq,falcon-pinumx.txt index daa768956069..ac4da9fe07bd 100644 --- a/Documentation/devicetree/bindings/pinctrl/lantiq,falcon-pinumx.txt +++ b/Documentation/devicetree/bindings/pinctrl/lantiq,falcon-pinumx.txt | |||
@@ -9,7 +9,7 @@ Please refer to pinctrl-bindings.txt in this directory for details of the | |||
9 | common pinctrl bindings used by client devices, including the meaning of the | 9 | common pinctrl bindings used by client devices, including the meaning of the |
10 | phrase "pin configuration node". | 10 | phrase "pin configuration node". |
11 | 11 | ||
12 | Lantiq's pin configuration nodes act as a container for an abitrary number of | 12 | Lantiq's pin configuration nodes act as a container for an arbitrary number of |
13 | subnodes. Each of these subnodes represents some desired configuration for a | 13 | subnodes. Each of these subnodes represents some desired configuration for a |
14 | pin, a group, or a list of pins or groups. This configuration can include the | 14 | pin, a group, or a list of pins or groups. This configuration can include the |
15 | mux function to select on those group(s), and two pin configuration parameters: | 15 | mux function to select on those group(s), and two pin configuration parameters: |
diff --git a/Documentation/devicetree/bindings/pinctrl/lantiq,xway-pinumx.txt b/Documentation/devicetree/bindings/pinctrl/lantiq,xway-pinumx.txt index b5469db1d7ad..e89b4677567d 100644 --- a/Documentation/devicetree/bindings/pinctrl/lantiq,xway-pinumx.txt +++ b/Documentation/devicetree/bindings/pinctrl/lantiq,xway-pinumx.txt | |||
@@ -9,7 +9,7 @@ Please refer to pinctrl-bindings.txt in this directory for details of the | |||
9 | common pinctrl bindings used by client devices, including the meaning of the | 9 | common pinctrl bindings used by client devices, including the meaning of the |
10 | phrase "pin configuration node". | 10 | phrase "pin configuration node". |
11 | 11 | ||
12 | Lantiq's pin configuration nodes act as a container for an abitrary number of | 12 | Lantiq's pin configuration nodes act as a container for an arbitrary number of |
13 | subnodes. Each of these subnodes represents some desired configuration for a | 13 | subnodes. Each of these subnodes represents some desired configuration for a |
14 | pin, a group, or a list of pins or groups. This configuration can include the | 14 | pin, a group, or a list of pins or groups. This configuration can include the |
15 | mux function to select on those group(s), and two pin configuration parameters: | 15 | mux function to select on those group(s), and two pin configuration parameters: |
diff --git a/Documentation/devicetree/bindings/pinctrl/nvidia,tegra20-pinmux.txt b/Documentation/devicetree/bindings/pinctrl/nvidia,tegra20-pinmux.txt index 61e73cde9ae9..3c8ce28baad6 100644 --- a/Documentation/devicetree/bindings/pinctrl/nvidia,tegra20-pinmux.txt +++ b/Documentation/devicetree/bindings/pinctrl/nvidia,tegra20-pinmux.txt | |||
@@ -9,7 +9,7 @@ Please refer to pinctrl-bindings.txt in this directory for details of the | |||
9 | common pinctrl bindings used by client devices, including the meaning of the | 9 | common pinctrl bindings used by client devices, including the meaning of the |
10 | phrase "pin configuration node". | 10 | phrase "pin configuration node". |
11 | 11 | ||
12 | Tegra's pin configuration nodes act as a container for an abitrary number of | 12 | Tegra's pin configuration nodes act as a container for an arbitrary number of |
13 | subnodes. Each of these subnodes represents some desired configuration for a | 13 | subnodes. Each of these subnodes represents some desired configuration for a |
14 | pin, a group, or a list of pins or groups. This configuration can include the | 14 | pin, a group, or a list of pins or groups. This configuration can include the |
15 | mux function to select on those pin(s)/group(s), and various pin configuration | 15 | mux function to select on those pin(s)/group(s), and various pin configuration |
diff --git a/Documentation/devicetree/bindings/pinctrl/pinctrl-sirf.txt b/Documentation/devicetree/bindings/pinctrl/pinctrl-sirf.txt index c596a6ad3285..5f55be59d914 100644 --- a/Documentation/devicetree/bindings/pinctrl/pinctrl-sirf.txt +++ b/Documentation/devicetree/bindings/pinctrl/pinctrl-sirf.txt | |||
@@ -13,7 +13,7 @@ Optional properties: | |||
13 | Please refer to pinctrl-bindings.txt in this directory for details of the common | 13 | Please refer to pinctrl-bindings.txt in this directory for details of the common |
14 | pinctrl bindings used by client devices. | 14 | pinctrl bindings used by client devices. |
15 | 15 | ||
16 | SiRFprimaII's pinmux nodes act as a container for an abitrary number of subnodes. | 16 | SiRFprimaII's pinmux nodes act as a container for an arbitrary number of subnodes. |
17 | Each of these subnodes represents some desired configuration for a group of pins. | 17 | Each of these subnodes represents some desired configuration for a group of pins. |
18 | 18 | ||
19 | Required subnode-properties: | 19 | Required subnode-properties: |
diff --git a/Documentation/devicetree/bindings/pinctrl/pinctrl_spear.txt b/Documentation/devicetree/bindings/pinctrl/pinctrl_spear.txt index b4480d5c3aca..458615596946 100644 --- a/Documentation/devicetree/bindings/pinctrl/pinctrl_spear.txt +++ b/Documentation/devicetree/bindings/pinctrl/pinctrl_spear.txt | |||
@@ -32,7 +32,7 @@ Required properties: | |||
32 | Please refer to pinctrl-bindings.txt in this directory for details of the common | 32 | Please refer to pinctrl-bindings.txt in this directory for details of the common |
33 | pinctrl bindings used by client devices. | 33 | pinctrl bindings used by client devices. |
34 | 34 | ||
35 | SPEAr's pinmux nodes act as a container for an abitrary number of subnodes. Each | 35 | SPEAr's pinmux nodes act as a container for an arbitrary number of subnodes. Each |
36 | of these subnodes represents muxing for a pin, a group, or a list of pins or | 36 | of these subnodes represents muxing for a pin, a group, or a list of pins or |
37 | groups. | 37 | groups. |
38 | 38 | ||
diff --git a/Documentation/devicetree/bindings/pinctrl/qcom,apq8064-pinctrl.txt b/Documentation/devicetree/bindings/pinctrl/qcom,apq8064-pinctrl.txt index 2fb90b37aa09..a7bde64798c7 100644 --- a/Documentation/devicetree/bindings/pinctrl/qcom,apq8064-pinctrl.txt +++ b/Documentation/devicetree/bindings/pinctrl/qcom,apq8064-pinctrl.txt | |||
@@ -18,7 +18,7 @@ Please refer to pinctrl-bindings.txt in this directory for details of the | |||
18 | common pinctrl bindings used by client devices, including the meaning of the | 18 | common pinctrl bindings used by client devices, including the meaning of the |
19 | phrase "pin configuration node". | 19 | phrase "pin configuration node". |
20 | 20 | ||
21 | Qualcomm's pin configuration nodes act as a container for an abitrary number of | 21 | Qualcomm's pin configuration nodes act as a container for an arbitrary number of |
22 | subnodes. Each of these subnodes represents some desired configuration for a | 22 | subnodes. Each of these subnodes represents some desired configuration for a |
23 | pin, a group, or a list of pins or groups. This configuration can include the | 23 | pin, a group, or a list of pins or groups. This configuration can include the |
24 | mux function to select on those pin(s)/group(s), and various pin configuration | 24 | mux function to select on those pin(s)/group(s), and various pin configuration |
diff --git a/Documentation/devicetree/bindings/pinctrl/qcom,apq8084-pinctrl.txt b/Documentation/devicetree/bindings/pinctrl/qcom,apq8084-pinctrl.txt index ffafa1990a30..c4ea61ac56f2 100644 --- a/Documentation/devicetree/bindings/pinctrl/qcom,apq8084-pinctrl.txt +++ b/Documentation/devicetree/bindings/pinctrl/qcom,apq8084-pinctrl.txt | |||
@@ -47,7 +47,7 @@ Please refer to pinctrl-bindings.txt in this directory for details of the | |||
47 | common pinctrl bindings used by client devices, including the meaning of the | 47 | common pinctrl bindings used by client devices, including the meaning of the |
48 | phrase "pin configuration node". | 48 | phrase "pin configuration node". |
49 | 49 | ||
50 | The pin configuration nodes act as a container for an abitrary number of | 50 | The pin configuration nodes act as a container for an arbitrary number of |
51 | subnodes. Each of these subnodes represents some desired configuration for a | 51 | subnodes. Each of these subnodes represents some desired configuration for a |
52 | pin, a group, or a list of pins or groups. This configuration can include the | 52 | pin, a group, or a list of pins or groups. This configuration can include the |
53 | mux function to select on those pin(s)/group(s), and various pin configuration | 53 | mux function to select on those pin(s)/group(s), and various pin configuration |
diff --git a/Documentation/devicetree/bindings/pinctrl/qcom,ipq8064-pinctrl.txt b/Documentation/devicetree/bindings/pinctrl/qcom,ipq8064-pinctrl.txt index e33e4dcdce79..6e88e91feb11 100644 --- a/Documentation/devicetree/bindings/pinctrl/qcom,ipq8064-pinctrl.txt +++ b/Documentation/devicetree/bindings/pinctrl/qcom,ipq8064-pinctrl.txt | |||
@@ -18,7 +18,7 @@ Please refer to pinctrl-bindings.txt in this directory for details of the | |||
18 | common pinctrl bindings used by client devices, including the meaning of the | 18 | common pinctrl bindings used by client devices, including the meaning of the |
19 | phrase "pin configuration node". | 19 | phrase "pin configuration node". |
20 | 20 | ||
21 | Qualcomm's pin configuration nodes act as a container for an abitrary number of | 21 | Qualcomm's pin configuration nodes act as a container for an arbitrary number of |
22 | subnodes. Each of these subnodes represents some desired configuration for a | 22 | subnodes. Each of these subnodes represents some desired configuration for a |
23 | pin, a group, or a list of pins or groups. This configuration can include the | 23 | pin, a group, or a list of pins or groups. This configuration can include the |
24 | mux function to select on those pin(s)/group(s), and various pin configuration | 24 | mux function to select on those pin(s)/group(s), and various pin configuration |
diff --git a/Documentation/devicetree/bindings/pinctrl/qcom,msm8960-pinctrl.txt b/Documentation/devicetree/bindings/pinctrl/qcom,msm8960-pinctrl.txt index 93b7de91b9f6..eb8d8aa41f20 100644 --- a/Documentation/devicetree/bindings/pinctrl/qcom,msm8960-pinctrl.txt +++ b/Documentation/devicetree/bindings/pinctrl/qcom,msm8960-pinctrl.txt | |||
@@ -47,7 +47,7 @@ Please refer to pinctrl-bindings.txt in this directory for details of the | |||
47 | common pinctrl bindings used by client devices, including the meaning of the | 47 | common pinctrl bindings used by client devices, including the meaning of the |
48 | phrase "pin configuration node". | 48 | phrase "pin configuration node". |
49 | 49 | ||
50 | The pin configuration nodes act as a container for an abitrary number of | 50 | The pin configuration nodes act as a container for an arbitrary number of |
51 | subnodes. Each of these subnodes represents some desired configuration for a | 51 | subnodes. Each of these subnodes represents some desired configuration for a |
52 | pin, a group, or a list of pins or groups. This configuration can include the | 52 | pin, a group, or a list of pins or groups. This configuration can include the |
53 | mux function to select on those pin(s)/group(s), and various pin configuration | 53 | mux function to select on those pin(s)/group(s), and various pin configuration |
diff --git a/Documentation/devicetree/bindings/pinctrl/qcom,msm8974-pinctrl.txt b/Documentation/devicetree/bindings/pinctrl/qcom,msm8974-pinctrl.txt index d2ea80dc43eb..e4d6a9d20f7d 100644 --- a/Documentation/devicetree/bindings/pinctrl/qcom,msm8974-pinctrl.txt +++ b/Documentation/devicetree/bindings/pinctrl/qcom,msm8974-pinctrl.txt | |||
@@ -18,7 +18,7 @@ Please refer to pinctrl-bindings.txt in this directory for details of the | |||
18 | common pinctrl bindings used by client devices, including the meaning of the | 18 | common pinctrl bindings used by client devices, including the meaning of the |
19 | phrase "pin configuration node". | 19 | phrase "pin configuration node". |
20 | 20 | ||
21 | Qualcomm's pin configuration nodes act as a container for an abitrary number of | 21 | Qualcomm's pin configuration nodes act as a container for an arbitrary number of |
22 | subnodes. Each of these subnodes represents some desired configuration for a | 22 | subnodes. Each of these subnodes represents some desired configuration for a |
23 | pin, a group, or a list of pins or groups. This configuration can include the | 23 | pin, a group, or a list of pins or groups. This configuration can include the |
24 | mux function to select on those pin(s)/group(s), and various pin configuration | 24 | mux function to select on those pin(s)/group(s), and various pin configuration |
diff --git a/Documentation/devicetree/bindings/vendor-prefixes.txt b/Documentation/devicetree/bindings/vendor-prefixes.txt index 723999d73744..a344ec2713a5 100644 --- a/Documentation/devicetree/bindings/vendor-prefixes.txt +++ b/Documentation/devicetree/bindings/vendor-prefixes.txt | |||
@@ -34,6 +34,7 @@ chipidea Chipidea, Inc | |||
34 | chrp Common Hardware Reference Platform | 34 | chrp Common Hardware Reference Platform |
35 | chunghwa Chunghwa Picture Tubes Ltd. | 35 | chunghwa Chunghwa Picture Tubes Ltd. |
36 | cirrus Cirrus Logic, Inc. | 36 | cirrus Cirrus Logic, Inc. |
37 | cnm Chips&Media, Inc. | ||
37 | cortina Cortina Systems, Inc. | 38 | cortina Cortina Systems, Inc. |
38 | crystalfontz Crystalfontz America, Inc. | 39 | crystalfontz Crystalfontz America, Inc. |
39 | dallas Maxim Integrated Products (formerly Dallas Semiconductor) | 40 | dallas Maxim Integrated Products (formerly Dallas Semiconductor) |
@@ -92,6 +93,7 @@ maxim Maxim Integrated Products | |||
92 | mediatek MediaTek Inc. | 93 | mediatek MediaTek Inc. |
93 | micrel Micrel Inc. | 94 | micrel Micrel Inc. |
94 | microchip Microchip Technology Inc. | 95 | microchip Microchip Technology Inc. |
96 | micron Micron Technology Inc. | ||
95 | mitsubishi Mitsubishi Electric Corporation | 97 | mitsubishi Mitsubishi Electric Corporation |
96 | mosaixtech Mosaix Technologies, Inc. | 98 | mosaixtech Mosaix Technologies, Inc. |
97 | moxa Moxa | 99 | moxa Moxa |
@@ -127,6 +129,7 @@ renesas Renesas Electronics Corporation | |||
127 | ricoh Ricoh Co. Ltd. | 129 | ricoh Ricoh Co. Ltd. |
128 | rockchip Fuzhou Rockchip Electronics Co., Ltd | 130 | rockchip Fuzhou Rockchip Electronics Co., Ltd |
129 | samsung Samsung Semiconductor | 131 | samsung Samsung Semiconductor |
132 | sandisk Sandisk Corporation | ||
130 | sbs Smart Battery System | 133 | sbs Smart Battery System |
131 | schindler Schindler | 134 | schindler Schindler |
132 | seagate Seagate Technology PLC | 135 | seagate Seagate Technology PLC |
@@ -138,7 +141,7 @@ silergy Silergy Corp. | |||
138 | sirf SiRF Technology, Inc. | 141 | sirf SiRF Technology, Inc. |
139 | sitronix Sitronix Technology Corporation | 142 | sitronix Sitronix Technology Corporation |
140 | smsc Standard Microsystems Corporation | 143 | smsc Standard Microsystems Corporation |
141 | snps Synopsys, Inc. | 144 | snps Synopsys, Inc. |
142 | solidrun SolidRun | 145 | solidrun SolidRun |
143 | sony Sony Corporation | 146 | sony Sony Corporation |
144 | spansion Spansion Inc. | 147 | spansion Spansion Inc. |
diff --git a/Documentation/filesystems/overlayfs.txt b/Documentation/filesystems/overlayfs.txt index 530850a72735..a27c950ece61 100644 --- a/Documentation/filesystems/overlayfs.txt +++ b/Documentation/filesystems/overlayfs.txt | |||
@@ -64,7 +64,7 @@ is formed. | |||
64 | At mount time, the two directories given as mount options "lowerdir" and | 64 | At mount time, the two directories given as mount options "lowerdir" and |
65 | "upperdir" are combined into a merged directory: | 65 | "upperdir" are combined into a merged directory: |
66 | 66 | ||
67 | mount -t overlayfs overlayfs -olowerdir=/lower,upperdir=/upper,\ | 67 | mount -t overlay overlay -olowerdir=/lower,upperdir=/upper,\ |
68 | workdir=/work /merged | 68 | workdir=/work /merged |
69 | 69 | ||
70 | The "workdir" needs to be an empty directory on the same filesystem | 70 | The "workdir" needs to be an empty directory on the same filesystem |
diff --git a/Documentation/gpio/consumer.txt b/Documentation/gpio/consumer.txt index 6ce544191ca6..859918db36b8 100644 --- a/Documentation/gpio/consumer.txt +++ b/Documentation/gpio/consumer.txt | |||
@@ -219,6 +219,24 @@ part of the IRQ interface, e.g. IRQF_TRIGGER_FALLING, as are system wakeup | |||
219 | capabilities. | 219 | capabilities. |
220 | 220 | ||
221 | 221 | ||
222 | GPIOs and ACPI | ||
223 | ============== | ||
224 | |||
225 | On ACPI systems, GPIOs are described by GpioIo()/GpioInt() resources listed by | ||
226 | the _CRS configuration objects of devices. Those resources do not provide | ||
227 | connection IDs (names) for GPIOs, so it is necessary to use an additional | ||
228 | mechanism for this purpose. | ||
229 | |||
230 | Systems compliant with ACPI 5.1 or newer may provide a _DSD configuration object | ||
231 | which, among other things, may be used to provide connection IDs for specific | ||
232 | GPIOs described by the GpioIo()/GpioInt() resources in _CRS. If that is the | ||
233 | case, it will be handled by the GPIO subsystem automatically. However, if the | ||
234 | _DSD is not present, the mappings between GpioIo()/GpioInt() resources and GPIO | ||
235 | connection IDs need to be provided by device drivers. | ||
236 | |||
237 | For details refer to Documentation/acpi/gpio-properties.txt | ||
238 | |||
239 | |||
222 | Interacting With the Legacy GPIO Subsystem | 240 | Interacting With the Legacy GPIO Subsystem |
223 | ========================================== | 241 | ========================================== |
224 | Many kernel subsystems still handle GPIOs using the legacy integer-based | 242 | Many kernel subsystems still handle GPIOs using the legacy integer-based |
diff --git a/Documentation/networking/timestamping.txt b/Documentation/networking/timestamping.txt index 412f45ca2d73..1d6d02d6ba52 100644 --- a/Documentation/networking/timestamping.txt +++ b/Documentation/networking/timestamping.txt | |||
@@ -136,7 +136,7 @@ SOF_TIMESTAMPING_OPT_ID: | |||
136 | 136 | ||
137 | This option is implemented only for transmit timestamps. There, the | 137 | This option is implemented only for transmit timestamps. There, the |
138 | timestamp is always looped along with a struct sock_extended_err. | 138 | timestamp is always looped along with a struct sock_extended_err. |
139 | The option modifies field ee_info to pass an id that is unique | 139 | The option modifies field ee_data to pass an id that is unique |
140 | among all possibly concurrently outstanding timestamp requests for | 140 | among all possibly concurrently outstanding timestamp requests for |
141 | that socket. In practice, it is a monotonically increasing u32 | 141 | that socket. In practice, it is a monotonically increasing u32 |
142 | (that wraps). | 142 | (that wraps). |
diff --git a/MAINTAINERS b/MAINTAINERS index c444907ccd69..c721042e7e45 100644 --- a/MAINTAINERS +++ b/MAINTAINERS | |||
@@ -1828,7 +1828,7 @@ F: include/net/ax25.h | |||
1828 | F: net/ax25/ | 1828 | F: net/ax25/ |
1829 | 1829 | ||
1830 | AZ6007 DVB DRIVER | 1830 | AZ6007 DVB DRIVER |
1831 | M: Mauro Carvalho Chehab <m.chehab@samsung.com> | 1831 | M: Mauro Carvalho Chehab <mchehab@osg.samsung.com> |
1832 | L: linux-media@vger.kernel.org | 1832 | L: linux-media@vger.kernel.org |
1833 | W: http://linuxtv.org | 1833 | W: http://linuxtv.org |
1834 | T: git git://linuxtv.org/media_tree.git | 1834 | T: git git://linuxtv.org/media_tree.git |
@@ -2198,7 +2198,7 @@ F: Documentation/filesystems/btrfs.txt | |||
2198 | F: fs/btrfs/ | 2198 | F: fs/btrfs/ |
2199 | 2199 | ||
2200 | BTTV VIDEO4LINUX DRIVER | 2200 | BTTV VIDEO4LINUX DRIVER |
2201 | M: Mauro Carvalho Chehab <m.chehab@samsung.com> | 2201 | M: Mauro Carvalho Chehab <mchehab@osg.samsung.com> |
2202 | L: linux-media@vger.kernel.org | 2202 | L: linux-media@vger.kernel.org |
2203 | W: http://linuxtv.org | 2203 | W: http://linuxtv.org |
2204 | T: git git://linuxtv.org/media_tree.git | 2204 | T: git git://linuxtv.org/media_tree.git |
@@ -2719,7 +2719,7 @@ F: drivers/media/common/cx2341x* | |||
2719 | F: include/media/cx2341x* | 2719 | F: include/media/cx2341x* |
2720 | 2720 | ||
2721 | CX88 VIDEO4LINUX DRIVER | 2721 | CX88 VIDEO4LINUX DRIVER |
2722 | M: Mauro Carvalho Chehab <m.chehab@samsung.com> | 2722 | M: Mauro Carvalho Chehab <mchehab@osg.samsung.com> |
2723 | L: linux-media@vger.kernel.org | 2723 | L: linux-media@vger.kernel.org |
2724 | W: http://linuxtv.org | 2724 | W: http://linuxtv.org |
2725 | T: git git://linuxtv.org/media_tree.git | 2725 | T: git git://linuxtv.org/media_tree.git |
@@ -3402,7 +3402,7 @@ F: fs/ecryptfs/ | |||
3402 | EDAC-CORE | 3402 | EDAC-CORE |
3403 | M: Doug Thompson <dougthompson@xmission.com> | 3403 | M: Doug Thompson <dougthompson@xmission.com> |
3404 | M: Borislav Petkov <bp@alien8.de> | 3404 | M: Borislav Petkov <bp@alien8.de> |
3405 | M: Mauro Carvalho Chehab <m.chehab@samsung.com> | 3405 | M: Mauro Carvalho Chehab <mchehab@osg.samsung.com> |
3406 | L: linux-edac@vger.kernel.org | 3406 | L: linux-edac@vger.kernel.org |
3407 | W: bluesmoke.sourceforge.net | 3407 | W: bluesmoke.sourceforge.net |
3408 | S: Supported | 3408 | S: Supported |
@@ -3451,7 +3451,7 @@ S: Maintained | |||
3451 | F: drivers/edac/e7xxx_edac.c | 3451 | F: drivers/edac/e7xxx_edac.c |
3452 | 3452 | ||
3453 | EDAC-GHES | 3453 | EDAC-GHES |
3454 | M: Mauro Carvalho Chehab <m.chehab@samsung.com> | 3454 | M: Mauro Carvalho Chehab <mchehab@osg.samsung.com> |
3455 | L: linux-edac@vger.kernel.org | 3455 | L: linux-edac@vger.kernel.org |
3456 | W: bluesmoke.sourceforge.net | 3456 | W: bluesmoke.sourceforge.net |
3457 | S: Maintained | 3457 | S: Maintained |
@@ -3479,21 +3479,21 @@ S: Maintained | |||
3479 | F: drivers/edac/i5000_edac.c | 3479 | F: drivers/edac/i5000_edac.c |
3480 | 3480 | ||
3481 | EDAC-I5400 | 3481 | EDAC-I5400 |
3482 | M: Mauro Carvalho Chehab <m.chehab@samsung.com> | 3482 | M: Mauro Carvalho Chehab <mchehab@osg.samsung.com> |
3483 | L: linux-edac@vger.kernel.org | 3483 | L: linux-edac@vger.kernel.org |
3484 | W: bluesmoke.sourceforge.net | 3484 | W: bluesmoke.sourceforge.net |
3485 | S: Maintained | 3485 | S: Maintained |
3486 | F: drivers/edac/i5400_edac.c | 3486 | F: drivers/edac/i5400_edac.c |
3487 | 3487 | ||
3488 | EDAC-I7300 | 3488 | EDAC-I7300 |
3489 | M: Mauro Carvalho Chehab <m.chehab@samsung.com> | 3489 | M: Mauro Carvalho Chehab <mchehab@osg.samsung.com> |
3490 | L: linux-edac@vger.kernel.org | 3490 | L: linux-edac@vger.kernel.org |
3491 | W: bluesmoke.sourceforge.net | 3491 | W: bluesmoke.sourceforge.net |
3492 | S: Maintained | 3492 | S: Maintained |
3493 | F: drivers/edac/i7300_edac.c | 3493 | F: drivers/edac/i7300_edac.c |
3494 | 3494 | ||
3495 | EDAC-I7CORE | 3495 | EDAC-I7CORE |
3496 | M: Mauro Carvalho Chehab <m.chehab@samsung.com> | 3496 | M: Mauro Carvalho Chehab <mchehab@osg.samsung.com> |
3497 | L: linux-edac@vger.kernel.org | 3497 | L: linux-edac@vger.kernel.org |
3498 | W: bluesmoke.sourceforge.net | 3498 | W: bluesmoke.sourceforge.net |
3499 | S: Maintained | 3499 | S: Maintained |
@@ -3536,7 +3536,7 @@ S: Maintained | |||
3536 | F: drivers/edac/r82600_edac.c | 3536 | F: drivers/edac/r82600_edac.c |
3537 | 3537 | ||
3538 | EDAC-SBRIDGE | 3538 | EDAC-SBRIDGE |
3539 | M: Mauro Carvalho Chehab <m.chehab@samsung.com> | 3539 | M: Mauro Carvalho Chehab <mchehab@osg.samsung.com> |
3540 | L: linux-edac@vger.kernel.org | 3540 | L: linux-edac@vger.kernel.org |
3541 | W: bluesmoke.sourceforge.net | 3541 | W: bluesmoke.sourceforge.net |
3542 | S: Maintained | 3542 | S: Maintained |
@@ -3596,7 +3596,7 @@ S: Maintained | |||
3596 | F: drivers/net/ethernet/ibm/ehea/ | 3596 | F: drivers/net/ethernet/ibm/ehea/ |
3597 | 3597 | ||
3598 | EM28XX VIDEO4LINUX DRIVER | 3598 | EM28XX VIDEO4LINUX DRIVER |
3599 | M: Mauro Carvalho Chehab <m.chehab@samsung.com> | 3599 | M: Mauro Carvalho Chehab <mchehab@osg.samsung.com> |
3600 | L: linux-media@vger.kernel.org | 3600 | L: linux-media@vger.kernel.org |
3601 | W: http://linuxtv.org | 3601 | W: http://linuxtv.org |
3602 | T: git git://linuxtv.org/media_tree.git | 3602 | T: git git://linuxtv.org/media_tree.git |
@@ -5962,7 +5962,7 @@ S: Maintained | |||
5962 | F: drivers/media/radio/radio-maxiradio* | 5962 | F: drivers/media/radio/radio-maxiradio* |
5963 | 5963 | ||
5964 | MEDIA INPUT INFRASTRUCTURE (V4L/DVB) | 5964 | MEDIA INPUT INFRASTRUCTURE (V4L/DVB) |
5965 | M: Mauro Carvalho Chehab <m.chehab@samsung.com> | 5965 | M: Mauro Carvalho Chehab <mchehab@osg.samsung.com> |
5966 | P: LinuxTV.org Project | 5966 | P: LinuxTV.org Project |
5967 | L: linux-media@vger.kernel.org | 5967 | L: linux-media@vger.kernel.org |
5968 | W: http://linuxtv.org | 5968 | W: http://linuxtv.org |
@@ -6888,11 +6888,12 @@ F: drivers/scsi/osd/ | |||
6888 | F: include/scsi/osd_* | 6888 | F: include/scsi/osd_* |
6889 | F: fs/exofs/ | 6889 | F: fs/exofs/ |
6890 | 6890 | ||
6891 | OVERLAYFS FILESYSTEM | 6891 | OVERLAY FILESYSTEM |
6892 | M: Miklos Szeredi <miklos@szeredi.hu> | 6892 | M: Miklos Szeredi <miklos@szeredi.hu> |
6893 | L: linux-fsdevel@vger.kernel.org | 6893 | L: linux-unionfs@vger.kernel.org |
6894 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/mszeredi/vfs.git | ||
6894 | S: Supported | 6895 | S: Supported |
6895 | F: fs/overlayfs/* | 6896 | F: fs/overlayfs/ |
6896 | F: Documentation/filesystems/overlayfs.txt | 6897 | F: Documentation/filesystems/overlayfs.txt |
6897 | 6898 | ||
6898 | P54 WIRELESS DRIVER | 6899 | P54 WIRELESS DRIVER |
@@ -8012,7 +8013,7 @@ S: Odd Fixes | |||
8012 | F: drivers/media/i2c/saa6588* | 8013 | F: drivers/media/i2c/saa6588* |
8013 | 8014 | ||
8014 | SAA7134 VIDEO4LINUX DRIVER | 8015 | SAA7134 VIDEO4LINUX DRIVER |
8015 | M: Mauro Carvalho Chehab <m.chehab@samsung.com> | 8016 | M: Mauro Carvalho Chehab <mchehab@osg.samsung.com> |
8016 | L: linux-media@vger.kernel.org | 8017 | L: linux-media@vger.kernel.org |
8017 | W: http://linuxtv.org | 8018 | W: http://linuxtv.org |
8018 | T: git git://linuxtv.org/media_tree.git | 8019 | T: git git://linuxtv.org/media_tree.git |
@@ -8470,7 +8471,7 @@ S: Maintained | |||
8470 | F: drivers/media/radio/si4713/radio-usb-si4713.c | 8471 | F: drivers/media/radio/si4713/radio-usb-si4713.c |
8471 | 8472 | ||
8472 | SIANO DVB DRIVER | 8473 | SIANO DVB DRIVER |
8473 | M: Mauro Carvalho Chehab <m.chehab@samsung.com> | 8474 | M: Mauro Carvalho Chehab <mchehab@osg.samsung.com> |
8474 | L: linux-media@vger.kernel.org | 8475 | L: linux-media@vger.kernel.org |
8475 | W: http://linuxtv.org | 8476 | W: http://linuxtv.org |
8476 | T: git git://linuxtv.org/media_tree.git | 8477 | T: git git://linuxtv.org/media_tree.git |
@@ -8681,7 +8682,9 @@ S: Maintained | |||
8681 | F: drivers/leds/leds-net48xx.c | 8682 | F: drivers/leds/leds-net48xx.c |
8682 | 8683 | ||
8683 | SOFTLOGIC 6x10 MPEG CODEC | 8684 | SOFTLOGIC 6x10 MPEG CODEC |
8684 | M: Ismael Luceno <ismael.luceno@corp.bluecherry.net> | 8685 | M: Bluecherry Maintainers <maintainers@bluecherrydvr.com> |
8686 | M: Andrey Utkin <andrey.utkin@corp.bluecherry.net> | ||
8687 | M: Andrey Utkin <andrey.krieger.utkin@gmail.com> | ||
8685 | L: linux-media@vger.kernel.org | 8688 | L: linux-media@vger.kernel.org |
8686 | S: Supported | 8689 | S: Supported |
8687 | F: drivers/media/pci/solo6x10/ | 8690 | F: drivers/media/pci/solo6x10/ |
@@ -9155,7 +9158,7 @@ S: Maintained | |||
9155 | F: drivers/media/i2c/tda9840* | 9158 | F: drivers/media/i2c/tda9840* |
9156 | 9159 | ||
9157 | TEA5761 TUNER DRIVER | 9160 | TEA5761 TUNER DRIVER |
9158 | M: Mauro Carvalho Chehab <m.chehab@samsung.com> | 9161 | M: Mauro Carvalho Chehab <mchehab@osg.samsung.com> |
9159 | L: linux-media@vger.kernel.org | 9162 | L: linux-media@vger.kernel.org |
9160 | W: http://linuxtv.org | 9163 | W: http://linuxtv.org |
9161 | T: git git://linuxtv.org/media_tree.git | 9164 | T: git git://linuxtv.org/media_tree.git |
@@ -9163,7 +9166,7 @@ S: Odd fixes | |||
9163 | F: drivers/media/tuners/tea5761.* | 9166 | F: drivers/media/tuners/tea5761.* |
9164 | 9167 | ||
9165 | TEA5767 TUNER DRIVER | 9168 | TEA5767 TUNER DRIVER |
9166 | M: Mauro Carvalho Chehab <m.chehab@samsung.com> | 9169 | M: Mauro Carvalho Chehab <mchehab@osg.samsung.com> |
9167 | L: linux-media@vger.kernel.org | 9170 | L: linux-media@vger.kernel.org |
9168 | W: http://linuxtv.org | 9171 | W: http://linuxtv.org |
9169 | T: git git://linuxtv.org/media_tree.git | 9172 | T: git git://linuxtv.org/media_tree.git |
@@ -9475,7 +9478,7 @@ F: include/linux/shmem_fs.h | |||
9475 | F: mm/shmem.c | 9478 | F: mm/shmem.c |
9476 | 9479 | ||
9477 | TM6000 VIDEO4LINUX DRIVER | 9480 | TM6000 VIDEO4LINUX DRIVER |
9478 | M: Mauro Carvalho Chehab <m.chehab@samsung.com> | 9481 | M: Mauro Carvalho Chehab <mchehab@osg.samsung.com> |
9479 | L: linux-media@vger.kernel.org | 9482 | L: linux-media@vger.kernel.org |
9480 | W: http://linuxtv.org | 9483 | W: http://linuxtv.org |
9481 | T: git git://linuxtv.org/media_tree.git | 9484 | T: git git://linuxtv.org/media_tree.git |
@@ -10296,7 +10299,7 @@ S: Maintained | |||
10296 | F: arch/x86/kernel/cpu/mcheck/* | 10299 | F: arch/x86/kernel/cpu/mcheck/* |
10297 | 10300 | ||
10298 | XC2028/3028 TUNER DRIVER | 10301 | XC2028/3028 TUNER DRIVER |
10299 | M: Mauro Carvalho Chehab <m.chehab@samsung.com> | 10302 | M: Mauro Carvalho Chehab <mchehab@osg.samsung.com> |
10300 | L: linux-media@vger.kernel.org | 10303 | L: linux-media@vger.kernel.org |
10301 | W: http://linuxtv.org | 10304 | W: http://linuxtv.org |
10302 | T: git git://linuxtv.org/media_tree.git | 10305 | T: git git://linuxtv.org/media_tree.git |
@@ -1,7 +1,7 @@ | |||
1 | VERSION = 3 | 1 | VERSION = 3 |
2 | PATCHLEVEL = 18 | 2 | PATCHLEVEL = 18 |
3 | SUBLEVEL = 0 | 3 | SUBLEVEL = 0 |
4 | EXTRAVERSION = -rc5 | 4 | EXTRAVERSION = |
5 | NAME = Diseased Newt | 5 | NAME = Diseased Newt |
6 | 6 | ||
7 | # *DOCUMENTATION* | 7 | # *DOCUMENTATION* |
diff --git a/arch/arm/boot/dts/exynos5250-snow.dts b/arch/arm/boot/dts/exynos5250-snow.dts index e51fcef884a4..60429ad1c5d8 100644 --- a/arch/arm/boot/dts/exynos5250-snow.dts +++ b/arch/arm/boot/dts/exynos5250-snow.dts | |||
@@ -624,4 +624,8 @@ | |||
624 | num-cs = <1>; | 624 | num-cs = <1>; |
625 | }; | 625 | }; |
626 | 626 | ||
627 | &usbdrd_dwc3 { | ||
628 | dr_mode = "host"; | ||
629 | }; | ||
630 | |||
627 | #include "cros-ec-keyboard.dtsi" | 631 | #include "cros-ec-keyboard.dtsi" |
diff --git a/arch/arm/boot/dts/exynos5250.dtsi b/arch/arm/boot/dts/exynos5250.dtsi index f21b9aa00fbb..d55c1a2eb798 100644 --- a/arch/arm/boot/dts/exynos5250.dtsi +++ b/arch/arm/boot/dts/exynos5250.dtsi | |||
@@ -555,7 +555,7 @@ | |||
555 | #size-cells = <1>; | 555 | #size-cells = <1>; |
556 | ranges; | 556 | ranges; |
557 | 557 | ||
558 | dwc3 { | 558 | usbdrd_dwc3: dwc3 { |
559 | compatible = "synopsys,dwc3"; | 559 | compatible = "synopsys,dwc3"; |
560 | reg = <0x12000000 0x10000>; | 560 | reg = <0x12000000 0x10000>; |
561 | interrupts = <0 72 0>; | 561 | interrupts = <0 72 0>; |
diff --git a/arch/arm/boot/dts/r8a7740.dtsi b/arch/arm/boot/dts/r8a7740.dtsi index d46c213a17ad..eed697a6bd6b 100644 --- a/arch/arm/boot/dts/r8a7740.dtsi +++ b/arch/arm/boot/dts/r8a7740.dtsi | |||
@@ -433,7 +433,7 @@ | |||
433 | clocks = <&cpg_clocks R8A7740_CLK_S>, | 433 | clocks = <&cpg_clocks R8A7740_CLK_S>, |
434 | <&cpg_clocks R8A7740_CLK_S>, <&sub_clk>, | 434 | <&cpg_clocks R8A7740_CLK_S>, <&sub_clk>, |
435 | <&cpg_clocks R8A7740_CLK_B>, | 435 | <&cpg_clocks R8A7740_CLK_B>, |
436 | <&sub_clk>, <&sub_clk>, | 436 | <&cpg_clocks R8A7740_CLK_HPP>, <&sub_clk>, |
437 | <&cpg_clocks R8A7740_CLK_B>; | 437 | <&cpg_clocks R8A7740_CLK_B>; |
438 | #clock-cells = <1>; | 438 | #clock-cells = <1>; |
439 | renesas,clock-indices = < | 439 | renesas,clock-indices = < |
diff --git a/arch/arm/boot/dts/r8a7790.dtsi b/arch/arm/boot/dts/r8a7790.dtsi index d0e17733dc1a..e20affe156c1 100644 --- a/arch/arm/boot/dts/r8a7790.dtsi +++ b/arch/arm/boot/dts/r8a7790.dtsi | |||
@@ -666,9 +666,9 @@ | |||
666 | #clock-cells = <0>; | 666 | #clock-cells = <0>; |
667 | clock-output-names = "sd2"; | 667 | clock-output-names = "sd2"; |
668 | }; | 668 | }; |
669 | sd3_clk: sd3_clk@e615007c { | 669 | sd3_clk: sd3_clk@e615026c { |
670 | compatible = "renesas,r8a7790-div6-clock", "renesas,cpg-div6-clock"; | 670 | compatible = "renesas,r8a7790-div6-clock", "renesas,cpg-div6-clock"; |
671 | reg = <0 0xe615007c 0 4>; | 671 | reg = <0 0xe615026c 0 4>; |
672 | clocks = <&pll1_div2_clk>; | 672 | clocks = <&pll1_div2_clk>; |
673 | #clock-cells = <0>; | 673 | #clock-cells = <0>; |
674 | clock-output-names = "sd3"; | 674 | clock-output-names = "sd3"; |
diff --git a/arch/arm/boot/dts/sun6i-a31.dtsi b/arch/arm/boot/dts/sun6i-a31.dtsi index 543f895d18d3..2e652e2339e9 100644 --- a/arch/arm/boot/dts/sun6i-a31.dtsi +++ b/arch/arm/boot/dts/sun6i-a31.dtsi | |||
@@ -361,6 +361,10 @@ | |||
361 | clocks = <&ahb1_gates 6>; | 361 | clocks = <&ahb1_gates 6>; |
362 | resets = <&ahb1_rst 6>; | 362 | resets = <&ahb1_rst 6>; |
363 | #dma-cells = <1>; | 363 | #dma-cells = <1>; |
364 | |||
365 | /* DMA controller requires AHB1 clocked from PLL6 */ | ||
366 | assigned-clocks = <&ahb1_mux>; | ||
367 | assigned-clock-parents = <&pll6>; | ||
364 | }; | 368 | }; |
365 | 369 | ||
366 | mmc0: mmc@01c0f000 { | 370 | mmc0: mmc@01c0f000 { |
diff --git a/arch/arm/boot/dts/tegra114-dalmore.dts b/arch/arm/boot/dts/tegra114-dalmore.dts index 5c21d216515a..8b7aa0dcdc6e 100644 --- a/arch/arm/boot/dts/tegra114-dalmore.dts +++ b/arch/arm/boot/dts/tegra114-dalmore.dts | |||
@@ -15,6 +15,7 @@ | |||
15 | aliases { | 15 | aliases { |
16 | rtc0 = "/i2c@7000d000/tps65913@58"; | 16 | rtc0 = "/i2c@7000d000/tps65913@58"; |
17 | rtc1 = "/rtc@7000e000"; | 17 | rtc1 = "/rtc@7000e000"; |
18 | serial0 = &uartd; | ||
18 | }; | 19 | }; |
19 | 20 | ||
20 | memory { | 21 | memory { |
diff --git a/arch/arm/boot/dts/tegra114-roth.dts b/arch/arm/boot/dts/tegra114-roth.dts index c7c6825f11fb..38acf78d7815 100644 --- a/arch/arm/boot/dts/tegra114-roth.dts +++ b/arch/arm/boot/dts/tegra114-roth.dts | |||
@@ -15,6 +15,10 @@ | |||
15 | linux,initrd-end = <0x82800000>; | 15 | linux,initrd-end = <0x82800000>; |
16 | }; | 16 | }; |
17 | 17 | ||
18 | aliases { | ||
19 | serial0 = &uartd; | ||
20 | }; | ||
21 | |||
18 | firmware { | 22 | firmware { |
19 | trusted-foundations { | 23 | trusted-foundations { |
20 | compatible = "tlm,trusted-foundations"; | 24 | compatible = "tlm,trusted-foundations"; |
@@ -916,8 +920,6 @@ | |||
916 | regulator-name = "vddio-sdmmc3"; | 920 | regulator-name = "vddio-sdmmc3"; |
917 | regulator-min-microvolt = <1800000>; | 921 | regulator-min-microvolt = <1800000>; |
918 | regulator-max-microvolt = <3300000>; | 922 | regulator-max-microvolt = <3300000>; |
919 | regulator-always-on; | ||
920 | regulator-boot-on; | ||
921 | }; | 923 | }; |
922 | 924 | ||
923 | ldousb { | 925 | ldousb { |
@@ -962,7 +964,7 @@ | |||
962 | sdhci@78000400 { | 964 | sdhci@78000400 { |
963 | status = "okay"; | 965 | status = "okay"; |
964 | bus-width = <4>; | 966 | bus-width = <4>; |
965 | vmmc-supply = <&vddio_sdmmc3>; | 967 | vqmmc-supply = <&vddio_sdmmc3>; |
966 | cd-gpios = <&gpio TEGRA_GPIO(V, 2) GPIO_ACTIVE_LOW>; | 968 | cd-gpios = <&gpio TEGRA_GPIO(V, 2) GPIO_ACTIVE_LOW>; |
967 | power-gpios = <&gpio TEGRA_GPIO(H, 0) GPIO_ACTIVE_HIGH>; | 969 | power-gpios = <&gpio TEGRA_GPIO(H, 0) GPIO_ACTIVE_HIGH>; |
968 | }; | 970 | }; |
@@ -971,7 +973,6 @@ | |||
971 | sdhci@78000600 { | 973 | sdhci@78000600 { |
972 | status = "okay"; | 974 | status = "okay"; |
973 | bus-width = <8>; | 975 | bus-width = <8>; |
974 | vmmc-supply = <&vdd_1v8>; | ||
975 | non-removable; | 976 | non-removable; |
976 | }; | 977 | }; |
977 | 978 | ||
diff --git a/arch/arm/boot/dts/tegra114-tn7.dts b/arch/arm/boot/dts/tegra114-tn7.dts index 963662145635..f91c2c9b2f94 100644 --- a/arch/arm/boot/dts/tegra114-tn7.dts +++ b/arch/arm/boot/dts/tegra114-tn7.dts | |||
@@ -15,6 +15,10 @@ | |||
15 | linux,initrd-end = <0x82800000>; | 15 | linux,initrd-end = <0x82800000>; |
16 | }; | 16 | }; |
17 | 17 | ||
18 | aliases { | ||
19 | serial0 = &uartd; | ||
20 | }; | ||
21 | |||
18 | firmware { | 22 | firmware { |
19 | trusted-foundations { | 23 | trusted-foundations { |
20 | compatible = "tlm,trusted-foundations"; | 24 | compatible = "tlm,trusted-foundations"; |
@@ -240,7 +244,6 @@ | |||
240 | sdhci@78000600 { | 244 | sdhci@78000600 { |
241 | status = "okay"; | 245 | status = "okay"; |
242 | bus-width = <8>; | 246 | bus-width = <8>; |
243 | vmmc-supply = <&vdd_1v8>; | ||
244 | non-removable; | 247 | non-removable; |
245 | }; | 248 | }; |
246 | 249 | ||
diff --git a/arch/arm/boot/dts/tegra114.dtsi b/arch/arm/boot/dts/tegra114.dtsi index 2ca9c1807f72..222f3b3f4dd5 100644 --- a/arch/arm/boot/dts/tegra114.dtsi +++ b/arch/arm/boot/dts/tegra114.dtsi | |||
@@ -9,13 +9,6 @@ | |||
9 | compatible = "nvidia,tegra114"; | 9 | compatible = "nvidia,tegra114"; |
10 | interrupt-parent = <&gic>; | 10 | interrupt-parent = <&gic>; |
11 | 11 | ||
12 | aliases { | ||
13 | serial0 = &uarta; | ||
14 | serial1 = &uartb; | ||
15 | serial2 = &uartc; | ||
16 | serial3 = &uartd; | ||
17 | }; | ||
18 | |||
19 | host1x@50000000 { | 12 | host1x@50000000 { |
20 | compatible = "nvidia,tegra114-host1x", "simple-bus"; | 13 | compatible = "nvidia,tegra114-host1x", "simple-bus"; |
21 | reg = <0x50000000 0x00028000>; | 14 | reg = <0x50000000 0x00028000>; |
diff --git a/arch/arm/boot/dts/tegra124-jetson-tk1.dts b/arch/arm/boot/dts/tegra124-jetson-tk1.dts index 029c9a021541..51b373ff1065 100644 --- a/arch/arm/boot/dts/tegra124-jetson-tk1.dts +++ b/arch/arm/boot/dts/tegra124-jetson-tk1.dts | |||
@@ -10,6 +10,7 @@ | |||
10 | aliases { | 10 | aliases { |
11 | rtc0 = "/i2c@0,7000d000/pmic@40"; | 11 | rtc0 = "/i2c@0,7000d000/pmic@40"; |
12 | rtc1 = "/rtc@0,7000e000"; | 12 | rtc1 = "/rtc@0,7000e000"; |
13 | serial0 = &uartd; | ||
13 | }; | 14 | }; |
14 | 15 | ||
15 | memory { | 16 | memory { |
diff --git a/arch/arm/boot/dts/tegra124-nyan-big.dts b/arch/arm/boot/dts/tegra124-nyan-big.dts index 7d0784ce4c74..53181d310247 100644 --- a/arch/arm/boot/dts/tegra124-nyan-big.dts +++ b/arch/arm/boot/dts/tegra124-nyan-big.dts | |||
@@ -10,6 +10,7 @@ | |||
10 | aliases { | 10 | aliases { |
11 | rtc0 = "/i2c@0,7000d000/pmic@40"; | 11 | rtc0 = "/i2c@0,7000d000/pmic@40"; |
12 | rtc1 = "/rtc@0,7000e000"; | 12 | rtc1 = "/rtc@0,7000e000"; |
13 | serial0 = &uarta; | ||
13 | }; | 14 | }; |
14 | 15 | ||
15 | memory { | 16 | memory { |
diff --git a/arch/arm/boot/dts/tegra124-venice2.dts b/arch/arm/boot/dts/tegra124-venice2.dts index 13008858e967..5c3f7813360d 100644 --- a/arch/arm/boot/dts/tegra124-venice2.dts +++ b/arch/arm/boot/dts/tegra124-venice2.dts | |||
@@ -10,6 +10,7 @@ | |||
10 | aliases { | 10 | aliases { |
11 | rtc0 = "/i2c@0,7000d000/pmic@40"; | 11 | rtc0 = "/i2c@0,7000d000/pmic@40"; |
12 | rtc1 = "/rtc@0,7000e000"; | 12 | rtc1 = "/rtc@0,7000e000"; |
13 | serial0 = &uarta; | ||
13 | }; | 14 | }; |
14 | 15 | ||
15 | memory { | 16 | memory { |
diff --git a/arch/arm/boot/dts/tegra124.dtsi b/arch/arm/boot/dts/tegra124.dtsi index 478c555ebd96..df2b06b29985 100644 --- a/arch/arm/boot/dts/tegra124.dtsi +++ b/arch/arm/boot/dts/tegra124.dtsi | |||
@@ -286,7 +286,7 @@ | |||
286 | * the APB DMA based serial driver, the comptible is | 286 | * the APB DMA based serial driver, the comptible is |
287 | * "nvidia,tegra124-hsuart", "nvidia,tegra30-hsuart". | 287 | * "nvidia,tegra124-hsuart", "nvidia,tegra30-hsuart". |
288 | */ | 288 | */ |
289 | serial@0,70006000 { | 289 | uarta: serial@0,70006000 { |
290 | compatible = "nvidia,tegra124-uart", "nvidia,tegra20-uart"; | 290 | compatible = "nvidia,tegra124-uart", "nvidia,tegra20-uart"; |
291 | reg = <0x0 0x70006000 0x0 0x40>; | 291 | reg = <0x0 0x70006000 0x0 0x40>; |
292 | reg-shift = <2>; | 292 | reg-shift = <2>; |
@@ -299,7 +299,7 @@ | |||
299 | status = "disabled"; | 299 | status = "disabled"; |
300 | }; | 300 | }; |
301 | 301 | ||
302 | serial@0,70006040 { | 302 | uartb: serial@0,70006040 { |
303 | compatible = "nvidia,tegra124-uart", "nvidia,tegra20-uart"; | 303 | compatible = "nvidia,tegra124-uart", "nvidia,tegra20-uart"; |
304 | reg = <0x0 0x70006040 0x0 0x40>; | 304 | reg = <0x0 0x70006040 0x0 0x40>; |
305 | reg-shift = <2>; | 305 | reg-shift = <2>; |
@@ -312,7 +312,7 @@ | |||
312 | status = "disabled"; | 312 | status = "disabled"; |
313 | }; | 313 | }; |
314 | 314 | ||
315 | serial@0,70006200 { | 315 | uartc: serial@0,70006200 { |
316 | compatible = "nvidia,tegra124-uart", "nvidia,tegra20-uart"; | 316 | compatible = "nvidia,tegra124-uart", "nvidia,tegra20-uart"; |
317 | reg = <0x0 0x70006200 0x0 0x40>; | 317 | reg = <0x0 0x70006200 0x0 0x40>; |
318 | reg-shift = <2>; | 318 | reg-shift = <2>; |
@@ -325,7 +325,7 @@ | |||
325 | status = "disabled"; | 325 | status = "disabled"; |
326 | }; | 326 | }; |
327 | 327 | ||
328 | serial@0,70006300 { | 328 | uartd: serial@0,70006300 { |
329 | compatible = "nvidia,tegra124-uart", "nvidia,tegra20-uart"; | 329 | compatible = "nvidia,tegra124-uart", "nvidia,tegra20-uart"; |
330 | reg = <0x0 0x70006300 0x0 0x40>; | 330 | reg = <0x0 0x70006300 0x0 0x40>; |
331 | reg-shift = <2>; | 331 | reg-shift = <2>; |
diff --git a/arch/arm/boot/dts/tegra20-harmony.dts b/arch/arm/boot/dts/tegra20-harmony.dts index a37279af687c..b926a07b9443 100644 --- a/arch/arm/boot/dts/tegra20-harmony.dts +++ b/arch/arm/boot/dts/tegra20-harmony.dts | |||
@@ -10,6 +10,7 @@ | |||
10 | aliases { | 10 | aliases { |
11 | rtc0 = "/i2c@7000d000/tps6586x@34"; | 11 | rtc0 = "/i2c@7000d000/tps6586x@34"; |
12 | rtc1 = "/rtc@7000e000"; | 12 | rtc1 = "/rtc@7000e000"; |
13 | serial0 = &uartd; | ||
13 | }; | 14 | }; |
14 | 15 | ||
15 | memory { | 16 | memory { |
diff --git a/arch/arm/boot/dts/tegra20-iris-512.dts b/arch/arm/boot/dts/tegra20-iris-512.dts index 8cfb83f42e1f..1dd7d7bfdfcc 100644 --- a/arch/arm/boot/dts/tegra20-iris-512.dts +++ b/arch/arm/boot/dts/tegra20-iris-512.dts | |||
@@ -6,6 +6,11 @@ | |||
6 | model = "Toradex Colibri T20 512MB on Iris"; | 6 | model = "Toradex Colibri T20 512MB on Iris"; |
7 | compatible = "toradex,iris", "toradex,colibri_t20-512", "nvidia,tegra20"; | 7 | compatible = "toradex,iris", "toradex,colibri_t20-512", "nvidia,tegra20"; |
8 | 8 | ||
9 | aliases { | ||
10 | serial0 = &uarta; | ||
11 | serial1 = &uartd; | ||
12 | }; | ||
13 | |||
9 | host1x@50000000 { | 14 | host1x@50000000 { |
10 | hdmi@54280000 { | 15 | hdmi@54280000 { |
11 | status = "okay"; | 16 | status = "okay"; |
diff --git a/arch/arm/boot/dts/tegra20-medcom-wide.dts b/arch/arm/boot/dts/tegra20-medcom-wide.dts index 1b7c56b33aca..9b87526ab0b7 100644 --- a/arch/arm/boot/dts/tegra20-medcom-wide.dts +++ b/arch/arm/boot/dts/tegra20-medcom-wide.dts | |||
@@ -6,6 +6,10 @@ | |||
6 | model = "Avionic Design Medcom-Wide board"; | 6 | model = "Avionic Design Medcom-Wide board"; |
7 | compatible = "ad,medcom-wide", "ad,tamonten", "nvidia,tegra20"; | 7 | compatible = "ad,medcom-wide", "ad,tamonten", "nvidia,tegra20"; |
8 | 8 | ||
9 | aliases { | ||
10 | serial0 = &uartd; | ||
11 | }; | ||
12 | |||
9 | pwm@7000a000 { | 13 | pwm@7000a000 { |
10 | status = "okay"; | 14 | status = "okay"; |
11 | }; | 15 | }; |
diff --git a/arch/arm/boot/dts/tegra20-paz00.dts b/arch/arm/boot/dts/tegra20-paz00.dts index d4438e30de45..ed7e1009326c 100644 --- a/arch/arm/boot/dts/tegra20-paz00.dts +++ b/arch/arm/boot/dts/tegra20-paz00.dts | |||
@@ -10,6 +10,8 @@ | |||
10 | aliases { | 10 | aliases { |
11 | rtc0 = "/i2c@7000d000/tps6586x@34"; | 11 | rtc0 = "/i2c@7000d000/tps6586x@34"; |
12 | rtc1 = "/rtc@7000e000"; | 12 | rtc1 = "/rtc@7000e000"; |
13 | serial0 = &uarta; | ||
14 | serial1 = &uartc; | ||
13 | }; | 15 | }; |
14 | 16 | ||
15 | memory { | 17 | memory { |
diff --git a/arch/arm/boot/dts/tegra20-seaboard.dts b/arch/arm/boot/dts/tegra20-seaboard.dts index a1d4bf9895d7..ea282c7c0ca5 100644 --- a/arch/arm/boot/dts/tegra20-seaboard.dts +++ b/arch/arm/boot/dts/tegra20-seaboard.dts | |||
@@ -10,6 +10,7 @@ | |||
10 | aliases { | 10 | aliases { |
11 | rtc0 = "/i2c@7000d000/tps6586x@34"; | 11 | rtc0 = "/i2c@7000d000/tps6586x@34"; |
12 | rtc1 = "/rtc@7000e000"; | 12 | rtc1 = "/rtc@7000e000"; |
13 | serial0 = &uartd; | ||
13 | }; | 14 | }; |
14 | 15 | ||
15 | memory { | 16 | memory { |
diff --git a/arch/arm/boot/dts/tegra20-tamonten.dtsi b/arch/arm/boot/dts/tegra20-tamonten.dtsi index 80e7d386ce34..13d4e6185275 100644 --- a/arch/arm/boot/dts/tegra20-tamonten.dtsi +++ b/arch/arm/boot/dts/tegra20-tamonten.dtsi | |||
@@ -7,6 +7,7 @@ | |||
7 | aliases { | 7 | aliases { |
8 | rtc0 = "/i2c@7000d000/tps6586x@34"; | 8 | rtc0 = "/i2c@7000d000/tps6586x@34"; |
9 | rtc1 = "/rtc@7000e000"; | 9 | rtc1 = "/rtc@7000e000"; |
10 | serial0 = &uartd; | ||
10 | }; | 11 | }; |
11 | 12 | ||
12 | memory { | 13 | memory { |
diff --git a/arch/arm/boot/dts/tegra20-trimslice.dts b/arch/arm/boot/dts/tegra20-trimslice.dts index 5ad87979ab13..d99af4ef9c64 100644 --- a/arch/arm/boot/dts/tegra20-trimslice.dts +++ b/arch/arm/boot/dts/tegra20-trimslice.dts | |||
@@ -10,6 +10,7 @@ | |||
10 | aliases { | 10 | aliases { |
11 | rtc0 = "/i2c@7000c500/rtc@56"; | 11 | rtc0 = "/i2c@7000c500/rtc@56"; |
12 | rtc1 = "/rtc@7000e000"; | 12 | rtc1 = "/rtc@7000e000"; |
13 | serial0 = &uarta; | ||
13 | }; | 14 | }; |
14 | 15 | ||
15 | memory { | 16 | memory { |
diff --git a/arch/arm/boot/dts/tegra20-ventana.dts b/arch/arm/boot/dts/tegra20-ventana.dts index ca8484cccddc..04c58e9ca490 100644 --- a/arch/arm/boot/dts/tegra20-ventana.dts +++ b/arch/arm/boot/dts/tegra20-ventana.dts | |||
@@ -10,6 +10,7 @@ | |||
10 | aliases { | 10 | aliases { |
11 | rtc0 = "/i2c@7000d000/tps6586x@34"; | 11 | rtc0 = "/i2c@7000d000/tps6586x@34"; |
12 | rtc1 = "/rtc@7000e000"; | 12 | rtc1 = "/rtc@7000e000"; |
13 | serial0 = &uartd; | ||
13 | }; | 14 | }; |
14 | 15 | ||
15 | memory { | 16 | memory { |
diff --git a/arch/arm/boot/dts/tegra20-whistler.dts b/arch/arm/boot/dts/tegra20-whistler.dts index 1843725785c9..340d81108df1 100644 --- a/arch/arm/boot/dts/tegra20-whistler.dts +++ b/arch/arm/boot/dts/tegra20-whistler.dts | |||
@@ -10,6 +10,7 @@ | |||
10 | aliases { | 10 | aliases { |
11 | rtc0 = "/i2c@7000d000/max8907@3c"; | 11 | rtc0 = "/i2c@7000d000/max8907@3c"; |
12 | rtc1 = "/rtc@7000e000"; | 12 | rtc1 = "/rtc@7000e000"; |
13 | serial0 = &uarta; | ||
13 | }; | 14 | }; |
14 | 15 | ||
15 | memory { | 16 | memory { |
diff --git a/arch/arm/boot/dts/tegra20.dtsi b/arch/arm/boot/dts/tegra20.dtsi index 3b374c49d04d..8acf5d85c99d 100644 --- a/arch/arm/boot/dts/tegra20.dtsi +++ b/arch/arm/boot/dts/tegra20.dtsi | |||
@@ -9,14 +9,6 @@ | |||
9 | compatible = "nvidia,tegra20"; | 9 | compatible = "nvidia,tegra20"; |
10 | interrupt-parent = <&intc>; | 10 | interrupt-parent = <&intc>; |
11 | 11 | ||
12 | aliases { | ||
13 | serial0 = &uarta; | ||
14 | serial1 = &uartb; | ||
15 | serial2 = &uartc; | ||
16 | serial3 = &uartd; | ||
17 | serial4 = &uarte; | ||
18 | }; | ||
19 | |||
20 | host1x@50000000 { | 12 | host1x@50000000 { |
21 | compatible = "nvidia,tegra20-host1x", "simple-bus"; | 13 | compatible = "nvidia,tegra20-host1x", "simple-bus"; |
22 | reg = <0x50000000 0x00024000>; | 14 | reg = <0x50000000 0x00024000>; |
diff --git a/arch/arm/boot/dts/tegra30-apalis-eval.dts b/arch/arm/boot/dts/tegra30-apalis-eval.dts index 45d40f024585..6236bdecb48b 100644 --- a/arch/arm/boot/dts/tegra30-apalis-eval.dts +++ b/arch/arm/boot/dts/tegra30-apalis-eval.dts | |||
@@ -11,6 +11,10 @@ | |||
11 | rtc0 = "/i2c@7000c000/rtc@68"; | 11 | rtc0 = "/i2c@7000c000/rtc@68"; |
12 | rtc1 = "/i2c@7000d000/tps65911@2d"; | 12 | rtc1 = "/i2c@7000d000/tps65911@2d"; |
13 | rtc2 = "/rtc@7000e000"; | 13 | rtc2 = "/rtc@7000e000"; |
14 | serial0 = &uarta; | ||
15 | serial1 = &uartb; | ||
16 | serial2 = &uartc; | ||
17 | serial3 = &uartd; | ||
14 | }; | 18 | }; |
15 | 19 | ||
16 | pcie-controller@00003000 { | 20 | pcie-controller@00003000 { |
diff --git a/arch/arm/boot/dts/tegra30-beaver.dts b/arch/arm/boot/dts/tegra30-beaver.dts index cee8f2246fdb..6b157eeabcc5 100644 --- a/arch/arm/boot/dts/tegra30-beaver.dts +++ b/arch/arm/boot/dts/tegra30-beaver.dts | |||
@@ -9,6 +9,7 @@ | |||
9 | aliases { | 9 | aliases { |
10 | rtc0 = "/i2c@7000d000/tps65911@2d"; | 10 | rtc0 = "/i2c@7000d000/tps65911@2d"; |
11 | rtc1 = "/rtc@7000e000"; | 11 | rtc1 = "/rtc@7000e000"; |
12 | serial0 = &uarta; | ||
12 | }; | 13 | }; |
13 | 14 | ||
14 | memory { | 15 | memory { |
diff --git a/arch/arm/boot/dts/tegra30-cardhu.dtsi b/arch/arm/boot/dts/tegra30-cardhu.dtsi index 206379546244..a1b682ea01bd 100644 --- a/arch/arm/boot/dts/tegra30-cardhu.dtsi +++ b/arch/arm/boot/dts/tegra30-cardhu.dtsi | |||
@@ -30,6 +30,8 @@ | |||
30 | aliases { | 30 | aliases { |
31 | rtc0 = "/i2c@7000d000/tps65911@2d"; | 31 | rtc0 = "/i2c@7000d000/tps65911@2d"; |
32 | rtc1 = "/rtc@7000e000"; | 32 | rtc1 = "/rtc@7000e000"; |
33 | serial0 = &uarta; | ||
34 | serial1 = &uartc; | ||
33 | }; | 35 | }; |
34 | 36 | ||
35 | memory { | 37 | memory { |
diff --git a/arch/arm/boot/dts/tegra30-colibri-eval-v3.dts b/arch/arm/boot/dts/tegra30-colibri-eval-v3.dts index 7793abd5bef1..4d3ddc585641 100644 --- a/arch/arm/boot/dts/tegra30-colibri-eval-v3.dts +++ b/arch/arm/boot/dts/tegra30-colibri-eval-v3.dts | |||
@@ -10,6 +10,9 @@ | |||
10 | rtc0 = "/i2c@7000c000/rtc@68"; | 10 | rtc0 = "/i2c@7000c000/rtc@68"; |
11 | rtc1 = "/i2c@7000d000/tps65911@2d"; | 11 | rtc1 = "/i2c@7000d000/tps65911@2d"; |
12 | rtc2 = "/rtc@7000e000"; | 12 | rtc2 = "/rtc@7000e000"; |
13 | serial0 = &uarta; | ||
14 | serial1 = &uartb; | ||
15 | serial2 = &uartd; | ||
13 | }; | 16 | }; |
14 | 17 | ||
15 | host1x@50000000 { | 18 | host1x@50000000 { |
diff --git a/arch/arm/boot/dts/tegra30.dtsi b/arch/arm/boot/dts/tegra30.dtsi index aa6ccea13d30..b270b9e3d455 100644 --- a/arch/arm/boot/dts/tegra30.dtsi +++ b/arch/arm/boot/dts/tegra30.dtsi | |||
@@ -9,14 +9,6 @@ | |||
9 | compatible = "nvidia,tegra30"; | 9 | compatible = "nvidia,tegra30"; |
10 | interrupt-parent = <&intc>; | 10 | interrupt-parent = <&intc>; |
11 | 11 | ||
12 | aliases { | ||
13 | serial0 = &uarta; | ||
14 | serial1 = &uartb; | ||
15 | serial2 = &uartc; | ||
16 | serial3 = &uartd; | ||
17 | serial4 = &uarte; | ||
18 | }; | ||
19 | |||
20 | pcie-controller@00003000 { | 12 | pcie-controller@00003000 { |
21 | compatible = "nvidia,tegra30-pcie"; | 13 | compatible = "nvidia,tegra30-pcie"; |
22 | device_type = "pci"; | 14 | device_type = "pci"; |
diff --git a/arch/arm/configs/exynos_defconfig b/arch/arm/configs/exynos_defconfig index 72058b8a6f4d..e21ef830a483 100644 --- a/arch/arm/configs/exynos_defconfig +++ b/arch/arm/configs/exynos_defconfig | |||
@@ -142,11 +142,13 @@ CONFIG_MMC_DW_IDMAC=y | |||
142 | CONFIG_MMC_DW_EXYNOS=y | 142 | CONFIG_MMC_DW_EXYNOS=y |
143 | CONFIG_RTC_CLASS=y | 143 | CONFIG_RTC_CLASS=y |
144 | CONFIG_RTC_DRV_MAX77686=y | 144 | CONFIG_RTC_DRV_MAX77686=y |
145 | CONFIG_RTC_DRV_MAX77802=y | ||
145 | CONFIG_RTC_DRV_S5M=y | 146 | CONFIG_RTC_DRV_S5M=y |
146 | CONFIG_RTC_DRV_S3C=y | 147 | CONFIG_RTC_DRV_S3C=y |
147 | CONFIG_DMADEVICES=y | 148 | CONFIG_DMADEVICES=y |
148 | CONFIG_PL330_DMA=y | 149 | CONFIG_PL330_DMA=y |
149 | CONFIG_COMMON_CLK_MAX77686=y | 150 | CONFIG_COMMON_CLK_MAX77686=y |
151 | CONFIG_COMMON_CLK_MAX77802=y | ||
150 | CONFIG_COMMON_CLK_S2MPS11=y | 152 | CONFIG_COMMON_CLK_S2MPS11=y |
151 | CONFIG_EXYNOS_IOMMU=y | 153 | CONFIG_EXYNOS_IOMMU=y |
152 | CONFIG_IIO=y | 154 | CONFIG_IIO=y |
diff --git a/arch/arm/configs/multi_v7_defconfig b/arch/arm/configs/multi_v7_defconfig index 3487046d8a78..9d7a32f93fcf 100644 --- a/arch/arm/configs/multi_v7_defconfig +++ b/arch/arm/configs/multi_v7_defconfig | |||
@@ -217,6 +217,7 @@ CONFIG_I2C_CADENCE=y | |||
217 | CONFIG_I2C_DESIGNWARE_PLATFORM=y | 217 | CONFIG_I2C_DESIGNWARE_PLATFORM=y |
218 | CONFIG_I2C_EXYNOS5=y | 218 | CONFIG_I2C_EXYNOS5=y |
219 | CONFIG_I2C_MV64XXX=y | 219 | CONFIG_I2C_MV64XXX=y |
220 | CONFIG_I2C_S3C2410=y | ||
220 | CONFIG_I2C_SIRF=y | 221 | CONFIG_I2C_SIRF=y |
221 | CONFIG_I2C_TEGRA=y | 222 | CONFIG_I2C_TEGRA=y |
222 | CONFIG_I2C_ST=y | 223 | CONFIG_I2C_ST=y |
diff --git a/arch/arm/include/asm/thread_info.h b/arch/arm/include/asm/thread_info.h index fc44d3761f9e..ce73ab635414 100644 --- a/arch/arm/include/asm/thread_info.h +++ b/arch/arm/include/asm/thread_info.h | |||
@@ -44,16 +44,6 @@ struct cpu_context_save { | |||
44 | __u32 extra[2]; /* Xscale 'acc' register, etc */ | 44 | __u32 extra[2]; /* Xscale 'acc' register, etc */ |
45 | }; | 45 | }; |
46 | 46 | ||
47 | struct arm_restart_block { | ||
48 | union { | ||
49 | /* For user cache flushing */ | ||
50 | struct { | ||
51 | unsigned long start; | ||
52 | unsigned long end; | ||
53 | } cache; | ||
54 | }; | ||
55 | }; | ||
56 | |||
57 | /* | 47 | /* |
58 | * low level task data that entry.S needs immediate access to. | 48 | * low level task data that entry.S needs immediate access to. |
59 | * __switch_to() assumes cpu_context follows immediately after cpu_domain. | 49 | * __switch_to() assumes cpu_context follows immediately after cpu_domain. |
@@ -79,7 +69,6 @@ struct thread_info { | |||
79 | unsigned long thumbee_state; /* ThumbEE Handler Base register */ | 69 | unsigned long thumbee_state; /* ThumbEE Handler Base register */ |
80 | #endif | 70 | #endif |
81 | struct restart_block restart_block; | 71 | struct restart_block restart_block; |
82 | struct arm_restart_block arm_restart_block; | ||
83 | }; | 72 | }; |
84 | 73 | ||
85 | #define INIT_THREAD_INFO(tsk) \ | 74 | #define INIT_THREAD_INFO(tsk) \ |
diff --git a/arch/arm/kernel/traps.c b/arch/arm/kernel/traps.c index 0c8b10801d36..9f5d81881eb6 100644 --- a/arch/arm/kernel/traps.c +++ b/arch/arm/kernel/traps.c | |||
@@ -533,8 +533,6 @@ static int bad_syscall(int n, struct pt_regs *regs) | |||
533 | return regs->ARM_r0; | 533 | return regs->ARM_r0; |
534 | } | 534 | } |
535 | 535 | ||
536 | static long do_cache_op_restart(struct restart_block *); | ||
537 | |||
538 | static inline int | 536 | static inline int |
539 | __do_cache_op(unsigned long start, unsigned long end) | 537 | __do_cache_op(unsigned long start, unsigned long end) |
540 | { | 538 | { |
@@ -543,24 +541,8 @@ __do_cache_op(unsigned long start, unsigned long end) | |||
543 | do { | 541 | do { |
544 | unsigned long chunk = min(PAGE_SIZE, end - start); | 542 | unsigned long chunk = min(PAGE_SIZE, end - start); |
545 | 543 | ||
546 | if (signal_pending(current)) { | 544 | if (fatal_signal_pending(current)) |
547 | struct thread_info *ti = current_thread_info(); | 545 | return 0; |
548 | |||
549 | ti->restart_block = (struct restart_block) { | ||
550 | .fn = do_cache_op_restart, | ||
551 | }; | ||
552 | |||
553 | ti->arm_restart_block = (struct arm_restart_block) { | ||
554 | { | ||
555 | .cache = { | ||
556 | .start = start, | ||
557 | .end = end, | ||
558 | }, | ||
559 | }, | ||
560 | }; | ||
561 | |||
562 | return -ERESTART_RESTARTBLOCK; | ||
563 | } | ||
564 | 546 | ||
565 | ret = flush_cache_user_range(start, start + chunk); | 547 | ret = flush_cache_user_range(start, start + chunk); |
566 | if (ret) | 548 | if (ret) |
@@ -573,15 +555,6 @@ __do_cache_op(unsigned long start, unsigned long end) | |||
573 | return 0; | 555 | return 0; |
574 | } | 556 | } |
575 | 557 | ||
576 | static long do_cache_op_restart(struct restart_block *unused) | ||
577 | { | ||
578 | struct arm_restart_block *restart_block; | ||
579 | |||
580 | restart_block = ¤t_thread_info()->arm_restart_block; | ||
581 | return __do_cache_op(restart_block->cache.start, | ||
582 | restart_block->cache.end); | ||
583 | } | ||
584 | |||
585 | static inline int | 558 | static inline int |
586 | do_cache_op(unsigned long start, unsigned long end, int flags) | 559 | do_cache_op(unsigned long start, unsigned long end, int flags) |
587 | { | 560 | { |
diff --git a/arch/arm/kvm/mmu.c b/arch/arm/kvm/mmu.c index 57a403a5c22b..8664ff17cbbe 100644 --- a/arch/arm/kvm/mmu.c +++ b/arch/arm/kvm/mmu.c | |||
@@ -197,7 +197,8 @@ static void unmap_range(struct kvm *kvm, pgd_t *pgdp, | |||
197 | pgd = pgdp + pgd_index(addr); | 197 | pgd = pgdp + pgd_index(addr); |
198 | do { | 198 | do { |
199 | next = kvm_pgd_addr_end(addr, end); | 199 | next = kvm_pgd_addr_end(addr, end); |
200 | unmap_puds(kvm, pgd, addr, next); | 200 | if (!pgd_none(*pgd)) |
201 | unmap_puds(kvm, pgd, addr, next); | ||
201 | } while (pgd++, addr = next, addr != end); | 202 | } while (pgd++, addr = next, addr != end); |
202 | } | 203 | } |
203 | 204 | ||
@@ -834,6 +835,11 @@ static bool kvm_is_write_fault(struct kvm_vcpu *vcpu) | |||
834 | return kvm_vcpu_dabt_iswrite(vcpu); | 835 | return kvm_vcpu_dabt_iswrite(vcpu); |
835 | } | 836 | } |
836 | 837 | ||
838 | static bool kvm_is_device_pfn(unsigned long pfn) | ||
839 | { | ||
840 | return !pfn_valid(pfn); | ||
841 | } | ||
842 | |||
837 | static int user_mem_abort(struct kvm_vcpu *vcpu, phys_addr_t fault_ipa, | 843 | static int user_mem_abort(struct kvm_vcpu *vcpu, phys_addr_t fault_ipa, |
838 | struct kvm_memory_slot *memslot, unsigned long hva, | 844 | struct kvm_memory_slot *memslot, unsigned long hva, |
839 | unsigned long fault_status) | 845 | unsigned long fault_status) |
@@ -904,7 +910,7 @@ static int user_mem_abort(struct kvm_vcpu *vcpu, phys_addr_t fault_ipa, | |||
904 | if (is_error_pfn(pfn)) | 910 | if (is_error_pfn(pfn)) |
905 | return -EFAULT; | 911 | return -EFAULT; |
906 | 912 | ||
907 | if (kvm_is_mmio_pfn(pfn)) | 913 | if (kvm_is_device_pfn(pfn)) |
908 | mem_type = PAGE_S2_DEVICE; | 914 | mem_type = PAGE_S2_DEVICE; |
909 | 915 | ||
910 | spin_lock(&kvm->mmu_lock); | 916 | spin_lock(&kvm->mmu_lock); |
diff --git a/arch/arm/mach-mvebu/coherency.c b/arch/arm/mach-mvebu/coherency.c index 2bdc3233abe2..044b51185fcc 100644 --- a/arch/arm/mach-mvebu/coherency.c +++ b/arch/arm/mach-mvebu/coherency.c | |||
@@ -400,6 +400,8 @@ int __init coherency_init(void) | |||
400 | type == COHERENCY_FABRIC_TYPE_ARMADA_380) | 400 | type == COHERENCY_FABRIC_TYPE_ARMADA_380) |
401 | armada_375_380_coherency_init(np); | 401 | armada_375_380_coherency_init(np); |
402 | 402 | ||
403 | of_node_put(np); | ||
404 | |||
403 | return 0; | 405 | return 0; |
404 | } | 406 | } |
405 | 407 | ||
diff --git a/arch/arm/mach-s3c24xx/h1940-bluetooth.c b/arch/arm/mach-s3c24xx/h1940-bluetooth.c index b4d14b864367..9c8b1279a4ba 100644 --- a/arch/arm/mach-s3c24xx/h1940-bluetooth.c +++ b/arch/arm/mach-s3c24xx/h1940-bluetooth.c | |||
@@ -41,7 +41,7 @@ static void h1940bt_enable(int on) | |||
41 | mdelay(10); | 41 | mdelay(10); |
42 | gpio_set_value(S3C2410_GPH(1), 0); | 42 | gpio_set_value(S3C2410_GPH(1), 0); |
43 | 43 | ||
44 | h1940_led_blink_set(-EINVAL, GPIO_LED_BLINK, NULL, NULL); | 44 | h1940_led_blink_set(NULL, GPIO_LED_BLINK, NULL, NULL); |
45 | } | 45 | } |
46 | else { | 46 | else { |
47 | gpio_set_value(S3C2410_GPH(1), 1); | 47 | gpio_set_value(S3C2410_GPH(1), 1); |
@@ -50,7 +50,7 @@ static void h1940bt_enable(int on) | |||
50 | mdelay(10); | 50 | mdelay(10); |
51 | gpio_set_value(H1940_LATCH_BLUETOOTH_POWER, 0); | 51 | gpio_set_value(H1940_LATCH_BLUETOOTH_POWER, 0); |
52 | 52 | ||
53 | h1940_led_blink_set(-EINVAL, GPIO_LED_NO_BLINK_LOW, NULL, NULL); | 53 | h1940_led_blink_set(NULL, GPIO_LED_NO_BLINK_LOW, NULL, NULL); |
54 | } | 54 | } |
55 | } | 55 | } |
56 | 56 | ||
diff --git a/arch/arm/mach-s3c24xx/h1940.h b/arch/arm/mach-s3c24xx/h1940.h index 2950cc466840..596d9f64c5b6 100644 --- a/arch/arm/mach-s3c24xx/h1940.h +++ b/arch/arm/mach-s3c24xx/h1940.h | |||
@@ -19,8 +19,10 @@ | |||
19 | #define H1940_SUSPEND_RESUMEAT (0x30081000) | 19 | #define H1940_SUSPEND_RESUMEAT (0x30081000) |
20 | #define H1940_SUSPEND_CHECK (0x30080000) | 20 | #define H1940_SUSPEND_CHECK (0x30080000) |
21 | 21 | ||
22 | struct gpio_desc; | ||
23 | |||
22 | extern void h1940_pm_return(void); | 24 | extern void h1940_pm_return(void); |
23 | extern int h1940_led_blink_set(unsigned gpio, int state, | 25 | extern int h1940_led_blink_set(struct gpio_desc *desc, int state, |
24 | unsigned long *delay_on, | 26 | unsigned long *delay_on, |
25 | unsigned long *delay_off); | 27 | unsigned long *delay_off); |
26 | 28 | ||
diff --git a/arch/arm/mach-s3c24xx/mach-h1940.c b/arch/arm/mach-s3c24xx/mach-h1940.c index d35ddc1d9991..d40d4f5244c6 100644 --- a/arch/arm/mach-s3c24xx/mach-h1940.c +++ b/arch/arm/mach-s3c24xx/mach-h1940.c | |||
@@ -359,10 +359,11 @@ static struct platform_device h1940_battery = { | |||
359 | 359 | ||
360 | static DEFINE_SPINLOCK(h1940_blink_spin); | 360 | static DEFINE_SPINLOCK(h1940_blink_spin); |
361 | 361 | ||
362 | int h1940_led_blink_set(unsigned gpio, int state, | 362 | int h1940_led_blink_set(struct gpio_desc *desc, int state, |
363 | unsigned long *delay_on, unsigned long *delay_off) | 363 | unsigned long *delay_on, unsigned long *delay_off) |
364 | { | 364 | { |
365 | int blink_gpio, check_gpio1, check_gpio2; | 365 | int blink_gpio, check_gpio1, check_gpio2; |
366 | int gpio = desc ? desc_to_gpio(desc) : -EINVAL; | ||
366 | 367 | ||
367 | switch (gpio) { | 368 | switch (gpio) { |
368 | case H1940_LATCH_LED_GREEN: | 369 | case H1940_LATCH_LED_GREEN: |
diff --git a/arch/arm/mach-s3c24xx/mach-rx1950.c b/arch/arm/mach-s3c24xx/mach-rx1950.c index c3f2682d0c62..1d35ff375a01 100644 --- a/arch/arm/mach-s3c24xx/mach-rx1950.c +++ b/arch/arm/mach-s3c24xx/mach-rx1950.c | |||
@@ -250,9 +250,10 @@ static void rx1950_disable_charger(void) | |||
250 | 250 | ||
251 | static DEFINE_SPINLOCK(rx1950_blink_spin); | 251 | static DEFINE_SPINLOCK(rx1950_blink_spin); |
252 | 252 | ||
253 | static int rx1950_led_blink_set(unsigned gpio, int state, | 253 | static int rx1950_led_blink_set(struct gpio_desc *desc, int state, |
254 | unsigned long *delay_on, unsigned long *delay_off) | 254 | unsigned long *delay_on, unsigned long *delay_off) |
255 | { | 255 | { |
256 | int gpio = desc_to_gpio(desc); | ||
256 | int blink_gpio, check_gpio; | 257 | int blink_gpio, check_gpio; |
257 | 258 | ||
258 | switch (gpio) { | 259 | switch (gpio) { |
diff --git a/arch/arm/mach-shmobile/clock-r8a7740.c b/arch/arm/mach-shmobile/clock-r8a7740.c index 0794f0426e70..19df9cb30495 100644 --- a/arch/arm/mach-shmobile/clock-r8a7740.c +++ b/arch/arm/mach-shmobile/clock-r8a7740.c | |||
@@ -455,7 +455,7 @@ enum { | |||
455 | MSTP128, MSTP127, MSTP125, | 455 | MSTP128, MSTP127, MSTP125, |
456 | MSTP116, MSTP111, MSTP100, MSTP117, | 456 | MSTP116, MSTP111, MSTP100, MSTP117, |
457 | 457 | ||
458 | MSTP230, | 458 | MSTP230, MSTP229, |
459 | MSTP222, | 459 | MSTP222, |
460 | MSTP218, MSTP217, MSTP216, MSTP214, | 460 | MSTP218, MSTP217, MSTP216, MSTP214, |
461 | MSTP207, MSTP206, MSTP204, MSTP203, MSTP202, MSTP201, MSTP200, | 461 | MSTP207, MSTP206, MSTP204, MSTP203, MSTP202, MSTP201, MSTP200, |
@@ -474,11 +474,12 @@ static struct clk mstp_clks[MSTP_NR] = { | |||
474 | [MSTP127] = SH_CLK_MSTP32(&div4_clks[DIV4_S], SMSTPCR1, 27, 0), /* CEU20 */ | 474 | [MSTP127] = SH_CLK_MSTP32(&div4_clks[DIV4_S], SMSTPCR1, 27, 0), /* CEU20 */ |
475 | [MSTP125] = SH_CLK_MSTP32(&div6_clks[DIV6_SUB], SMSTPCR1, 25, 0), /* TMU0 */ | 475 | [MSTP125] = SH_CLK_MSTP32(&div6_clks[DIV6_SUB], SMSTPCR1, 25, 0), /* TMU0 */ |
476 | [MSTP117] = SH_CLK_MSTP32(&div4_clks[DIV4_B], SMSTPCR1, 17, 0), /* LCDC1 */ | 476 | [MSTP117] = SH_CLK_MSTP32(&div4_clks[DIV4_B], SMSTPCR1, 17, 0), /* LCDC1 */ |
477 | [MSTP116] = SH_CLK_MSTP32(&div6_clks[DIV6_SUB], SMSTPCR1, 16, 0), /* IIC0 */ | 477 | [MSTP116] = SH_CLK_MSTP32(&div4_clks[DIV4_HPP], SMSTPCR1, 16, 0), /* IIC0 */ |
478 | [MSTP111] = SH_CLK_MSTP32(&div6_clks[DIV6_SUB], SMSTPCR1, 11, 0), /* TMU1 */ | 478 | [MSTP111] = SH_CLK_MSTP32(&div6_clks[DIV6_SUB], SMSTPCR1, 11, 0), /* TMU1 */ |
479 | [MSTP100] = SH_CLK_MSTP32(&div4_clks[DIV4_B], SMSTPCR1, 0, 0), /* LCDC0 */ | 479 | [MSTP100] = SH_CLK_MSTP32(&div4_clks[DIV4_B], SMSTPCR1, 0, 0), /* LCDC0 */ |
480 | 480 | ||
481 | [MSTP230] = SH_CLK_MSTP32(&div6_clks[DIV6_SUB], SMSTPCR2, 30, 0), /* SCIFA6 */ | 481 | [MSTP230] = SH_CLK_MSTP32(&div6_clks[DIV6_SUB], SMSTPCR2, 30, 0), /* SCIFA6 */ |
482 | [MSTP229] = SH_CLK_MSTP32(&div4_clks[DIV4_HP], SMSTPCR2, 29, 0), /* INTCA */ | ||
482 | [MSTP222] = SH_CLK_MSTP32(&div6_clks[DIV6_SUB], SMSTPCR2, 22, 0), /* SCIFA7 */ | 483 | [MSTP222] = SH_CLK_MSTP32(&div6_clks[DIV6_SUB], SMSTPCR2, 22, 0), /* SCIFA7 */ |
483 | [MSTP218] = SH_CLK_MSTP32(&div4_clks[DIV4_HP], SMSTPCR2, 18, 0), /* DMAC1 */ | 484 | [MSTP218] = SH_CLK_MSTP32(&div4_clks[DIV4_HP], SMSTPCR2, 18, 0), /* DMAC1 */ |
484 | [MSTP217] = SH_CLK_MSTP32(&div4_clks[DIV4_HP], SMSTPCR2, 17, 0), /* DMAC2 */ | 485 | [MSTP217] = SH_CLK_MSTP32(&div4_clks[DIV4_HP], SMSTPCR2, 17, 0), /* DMAC2 */ |
@@ -575,6 +576,10 @@ static struct clk_lookup lookups[] = { | |||
575 | CLKDEV_DEV_ID("sh-dma-engine.0", &mstp_clks[MSTP218]), | 576 | CLKDEV_DEV_ID("sh-dma-engine.0", &mstp_clks[MSTP218]), |
576 | CLKDEV_DEV_ID("sh-sci.7", &mstp_clks[MSTP222]), | 577 | CLKDEV_DEV_ID("sh-sci.7", &mstp_clks[MSTP222]), |
577 | CLKDEV_DEV_ID("e6cd0000.serial", &mstp_clks[MSTP222]), | 578 | CLKDEV_DEV_ID("e6cd0000.serial", &mstp_clks[MSTP222]), |
579 | CLKDEV_DEV_ID("renesas_intc_irqpin.0", &mstp_clks[MSTP229]), | ||
580 | CLKDEV_DEV_ID("renesas_intc_irqpin.1", &mstp_clks[MSTP229]), | ||
581 | CLKDEV_DEV_ID("renesas_intc_irqpin.2", &mstp_clks[MSTP229]), | ||
582 | CLKDEV_DEV_ID("renesas_intc_irqpin.3", &mstp_clks[MSTP229]), | ||
578 | CLKDEV_DEV_ID("sh-sci.6", &mstp_clks[MSTP230]), | 583 | CLKDEV_DEV_ID("sh-sci.6", &mstp_clks[MSTP230]), |
579 | CLKDEV_DEV_ID("e6cc0000.serial", &mstp_clks[MSTP230]), | 584 | CLKDEV_DEV_ID("e6cc0000.serial", &mstp_clks[MSTP230]), |
580 | 585 | ||
diff --git a/arch/arm/mach-shmobile/clock-r8a7790.c b/arch/arm/mach-shmobile/clock-r8a7790.c index 126ddafad526..f62265200592 100644 --- a/arch/arm/mach-shmobile/clock-r8a7790.c +++ b/arch/arm/mach-shmobile/clock-r8a7790.c | |||
@@ -68,7 +68,7 @@ | |||
68 | 68 | ||
69 | #define SDCKCR 0xE6150074 | 69 | #define SDCKCR 0xE6150074 |
70 | #define SD2CKCR 0xE6150078 | 70 | #define SD2CKCR 0xE6150078 |
71 | #define SD3CKCR 0xE615007C | 71 | #define SD3CKCR 0xE615026C |
72 | #define MMC0CKCR 0xE6150240 | 72 | #define MMC0CKCR 0xE6150240 |
73 | #define MMC1CKCR 0xE6150244 | 73 | #define MMC1CKCR 0xE6150244 |
74 | #define SSPCKCR 0xE6150248 | 74 | #define SSPCKCR 0xE6150248 |
diff --git a/arch/arm/mach-shmobile/setup-sh73a0.c b/arch/arm/mach-shmobile/setup-sh73a0.c index b7bd8e509668..328657d011d5 100644 --- a/arch/arm/mach-shmobile/setup-sh73a0.c +++ b/arch/arm/mach-shmobile/setup-sh73a0.c | |||
@@ -26,6 +26,7 @@ | |||
26 | #include <linux/of_platform.h> | 26 | #include <linux/of_platform.h> |
27 | #include <linux/delay.h> | 27 | #include <linux/delay.h> |
28 | #include <linux/input.h> | 28 | #include <linux/input.h> |
29 | #include <linux/i2c/i2c-sh_mobile.h> | ||
29 | #include <linux/io.h> | 30 | #include <linux/io.h> |
30 | #include <linux/serial_sci.h> | 31 | #include <linux/serial_sci.h> |
31 | #include <linux/sh_dma.h> | 32 | #include <linux/sh_dma.h> |
@@ -192,11 +193,18 @@ static struct resource i2c4_resources[] = { | |||
192 | }, | 193 | }, |
193 | }; | 194 | }; |
194 | 195 | ||
196 | static struct i2c_sh_mobile_platform_data i2c_platform_data = { | ||
197 | .clks_per_count = 2, | ||
198 | }; | ||
199 | |||
195 | static struct platform_device i2c0_device = { | 200 | static struct platform_device i2c0_device = { |
196 | .name = "i2c-sh_mobile", | 201 | .name = "i2c-sh_mobile", |
197 | .id = 0, | 202 | .id = 0, |
198 | .resource = i2c0_resources, | 203 | .resource = i2c0_resources, |
199 | .num_resources = ARRAY_SIZE(i2c0_resources), | 204 | .num_resources = ARRAY_SIZE(i2c0_resources), |
205 | .dev = { | ||
206 | .platform_data = &i2c_platform_data, | ||
207 | }, | ||
200 | }; | 208 | }; |
201 | 209 | ||
202 | static struct platform_device i2c1_device = { | 210 | static struct platform_device i2c1_device = { |
@@ -204,6 +212,9 @@ static struct platform_device i2c1_device = { | |||
204 | .id = 1, | 212 | .id = 1, |
205 | .resource = i2c1_resources, | 213 | .resource = i2c1_resources, |
206 | .num_resources = ARRAY_SIZE(i2c1_resources), | 214 | .num_resources = ARRAY_SIZE(i2c1_resources), |
215 | .dev = { | ||
216 | .platform_data = &i2c_platform_data, | ||
217 | }, | ||
207 | }; | 218 | }; |
208 | 219 | ||
209 | static struct platform_device i2c2_device = { | 220 | static struct platform_device i2c2_device = { |
@@ -211,6 +222,9 @@ static struct platform_device i2c2_device = { | |||
211 | .id = 2, | 222 | .id = 2, |
212 | .resource = i2c2_resources, | 223 | .resource = i2c2_resources, |
213 | .num_resources = ARRAY_SIZE(i2c2_resources), | 224 | .num_resources = ARRAY_SIZE(i2c2_resources), |
225 | .dev = { | ||
226 | .platform_data = &i2c_platform_data, | ||
227 | }, | ||
214 | }; | 228 | }; |
215 | 229 | ||
216 | static struct platform_device i2c3_device = { | 230 | static struct platform_device i2c3_device = { |
@@ -218,6 +232,9 @@ static struct platform_device i2c3_device = { | |||
218 | .id = 3, | 232 | .id = 3, |
219 | .resource = i2c3_resources, | 233 | .resource = i2c3_resources, |
220 | .num_resources = ARRAY_SIZE(i2c3_resources), | 234 | .num_resources = ARRAY_SIZE(i2c3_resources), |
235 | .dev = { | ||
236 | .platform_data = &i2c_platform_data, | ||
237 | }, | ||
221 | }; | 238 | }; |
222 | 239 | ||
223 | static struct platform_device i2c4_device = { | 240 | static struct platform_device i2c4_device = { |
@@ -225,6 +242,9 @@ static struct platform_device i2c4_device = { | |||
225 | .id = 4, | 242 | .id = 4, |
226 | .resource = i2c4_resources, | 243 | .resource = i2c4_resources, |
227 | .num_resources = ARRAY_SIZE(i2c4_resources), | 244 | .num_resources = ARRAY_SIZE(i2c4_resources), |
245 | .dev = { | ||
246 | .platform_data = &i2c_platform_data, | ||
247 | }, | ||
228 | }; | 248 | }; |
229 | 249 | ||
230 | static const struct sh_dmae_slave_config sh73a0_dmae_slaves[] = { | 250 | static const struct sh_dmae_slave_config sh73a0_dmae_slaves[] = { |
diff --git a/arch/arm/mach-tegra/irq.c b/arch/arm/mach-tegra/irq.c index da7be13aecce..ab95f5391a2b 100644 --- a/arch/arm/mach-tegra/irq.c +++ b/arch/arm/mach-tegra/irq.c | |||
@@ -99,42 +99,42 @@ static inline void tegra_irq_write_mask(unsigned int irq, unsigned long reg) | |||
99 | 99 | ||
100 | static void tegra_mask(struct irq_data *d) | 100 | static void tegra_mask(struct irq_data *d) |
101 | { | 101 | { |
102 | if (d->irq < FIRST_LEGACY_IRQ) | 102 | if (d->hwirq < FIRST_LEGACY_IRQ) |
103 | return; | 103 | return; |
104 | 104 | ||
105 | tegra_irq_write_mask(d->irq, ICTLR_CPU_IER_CLR); | 105 | tegra_irq_write_mask(d->hwirq, ICTLR_CPU_IER_CLR); |
106 | } | 106 | } |
107 | 107 | ||
108 | static void tegra_unmask(struct irq_data *d) | 108 | static void tegra_unmask(struct irq_data *d) |
109 | { | 109 | { |
110 | if (d->irq < FIRST_LEGACY_IRQ) | 110 | if (d->hwirq < FIRST_LEGACY_IRQ) |
111 | return; | 111 | return; |
112 | 112 | ||
113 | tegra_irq_write_mask(d->irq, ICTLR_CPU_IER_SET); | 113 | tegra_irq_write_mask(d->hwirq, ICTLR_CPU_IER_SET); |
114 | } | 114 | } |
115 | 115 | ||
116 | static void tegra_ack(struct irq_data *d) | 116 | static void tegra_ack(struct irq_data *d) |
117 | { | 117 | { |
118 | if (d->irq < FIRST_LEGACY_IRQ) | 118 | if (d->hwirq < FIRST_LEGACY_IRQ) |
119 | return; | 119 | return; |
120 | 120 | ||
121 | tegra_irq_write_mask(d->irq, ICTLR_CPU_IEP_FIR_CLR); | 121 | tegra_irq_write_mask(d->hwirq, ICTLR_CPU_IEP_FIR_CLR); |
122 | } | 122 | } |
123 | 123 | ||
124 | static void tegra_eoi(struct irq_data *d) | 124 | static void tegra_eoi(struct irq_data *d) |
125 | { | 125 | { |
126 | if (d->irq < FIRST_LEGACY_IRQ) | 126 | if (d->hwirq < FIRST_LEGACY_IRQ) |
127 | return; | 127 | return; |
128 | 128 | ||
129 | tegra_irq_write_mask(d->irq, ICTLR_CPU_IEP_FIR_CLR); | 129 | tegra_irq_write_mask(d->hwirq, ICTLR_CPU_IEP_FIR_CLR); |
130 | } | 130 | } |
131 | 131 | ||
132 | static int tegra_retrigger(struct irq_data *d) | 132 | static int tegra_retrigger(struct irq_data *d) |
133 | { | 133 | { |
134 | if (d->irq < FIRST_LEGACY_IRQ) | 134 | if (d->hwirq < FIRST_LEGACY_IRQ) |
135 | return 0; | 135 | return 0; |
136 | 136 | ||
137 | tegra_irq_write_mask(d->irq, ICTLR_CPU_IEP_FIR_SET); | 137 | tegra_irq_write_mask(d->hwirq, ICTLR_CPU_IEP_FIR_SET); |
138 | 138 | ||
139 | return 1; | 139 | return 1; |
140 | } | 140 | } |
@@ -142,7 +142,7 @@ static int tegra_retrigger(struct irq_data *d) | |||
142 | #ifdef CONFIG_PM_SLEEP | 142 | #ifdef CONFIG_PM_SLEEP |
143 | static int tegra_set_wake(struct irq_data *d, unsigned int enable) | 143 | static int tegra_set_wake(struct irq_data *d, unsigned int enable) |
144 | { | 144 | { |
145 | u32 irq = d->irq; | 145 | u32 irq = d->hwirq; |
146 | u32 index, mask; | 146 | u32 index, mask; |
147 | 147 | ||
148 | if (irq < FIRST_LEGACY_IRQ || | 148 | if (irq < FIRST_LEGACY_IRQ || |
diff --git a/arch/arm/mm/proc-v7.S b/arch/arm/mm/proc-v7.S index b3a947863ac7..22ac2a6fbfe3 100644 --- a/arch/arm/mm/proc-v7.S +++ b/arch/arm/mm/proc-v7.S | |||
@@ -270,7 +270,6 @@ __v7_pj4b_setup: | |||
270 | /* Auxiliary Debug Modes Control 1 Register */ | 270 | /* Auxiliary Debug Modes Control 1 Register */ |
271 | #define PJ4B_STATIC_BP (1 << 2) /* Enable Static BP */ | 271 | #define PJ4B_STATIC_BP (1 << 2) /* Enable Static BP */ |
272 | #define PJ4B_INTER_PARITY (1 << 8) /* Disable Internal Parity Handling */ | 272 | #define PJ4B_INTER_PARITY (1 << 8) /* Disable Internal Parity Handling */ |
273 | #define PJ4B_BCK_OFF_STREX (1 << 5) /* Enable the back off of STREX instr */ | ||
274 | #define PJ4B_CLEAN_LINE (1 << 16) /* Disable data transfer for clean line */ | 273 | #define PJ4B_CLEAN_LINE (1 << 16) /* Disable data transfer for clean line */ |
275 | 274 | ||
276 | /* Auxiliary Debug Modes Control 2 Register */ | 275 | /* Auxiliary Debug Modes Control 2 Register */ |
@@ -293,7 +292,6 @@ __v7_pj4b_setup: | |||
293 | /* Auxiliary Debug Modes Control 1 Register */ | 292 | /* Auxiliary Debug Modes Control 1 Register */ |
294 | mrc p15, 1, r0, c15, c1, 1 | 293 | mrc p15, 1, r0, c15, c1, 1 |
295 | orr r0, r0, #PJ4B_CLEAN_LINE | 294 | orr r0, r0, #PJ4B_CLEAN_LINE |
296 | orr r0, r0, #PJ4B_BCK_OFF_STREX | ||
297 | orr r0, r0, #PJ4B_INTER_PARITY | 295 | orr r0, r0, #PJ4B_INTER_PARITY |
298 | bic r0, r0, #PJ4B_STATIC_BP | 296 | bic r0, r0, #PJ4B_STATIC_BP |
299 | mcr p15, 1, r0, c15, c1, 1 | 297 | mcr p15, 1, r0, c15, c1, 1 |
diff --git a/arch/arm/mm/proc-xscale.S b/arch/arm/mm/proc-xscale.S index 23259f104c66..afa2b3c4df4a 100644 --- a/arch/arm/mm/proc-xscale.S +++ b/arch/arm/mm/proc-xscale.S | |||
@@ -535,7 +535,7 @@ ENTRY(cpu_xscale_do_suspend) | |||
535 | mrc p15, 0, r5, c15, c1, 0 @ CP access reg | 535 | mrc p15, 0, r5, c15, c1, 0 @ CP access reg |
536 | mrc p15, 0, r6, c13, c0, 0 @ PID | 536 | mrc p15, 0, r6, c13, c0, 0 @ PID |
537 | mrc p15, 0, r7, c3, c0, 0 @ domain ID | 537 | mrc p15, 0, r7, c3, c0, 0 @ domain ID |
538 | mrc p15, 0, r8, c1, c1, 0 @ auxiliary control reg | 538 | mrc p15, 0, r8, c1, c0, 1 @ auxiliary control reg |
539 | mrc p15, 0, r9, c1, c0, 0 @ control reg | 539 | mrc p15, 0, r9, c1, c0, 0 @ control reg |
540 | bic r4, r4, #2 @ clear frequency change bit | 540 | bic r4, r4, #2 @ clear frequency change bit |
541 | stmia r0, {r4 - r9} @ store cp regs | 541 | stmia r0, {r4 - r9} @ store cp regs |
@@ -552,7 +552,7 @@ ENTRY(cpu_xscale_do_resume) | |||
552 | mcr p15, 0, r6, c13, c0, 0 @ PID | 552 | mcr p15, 0, r6, c13, c0, 0 @ PID |
553 | mcr p15, 0, r7, c3, c0, 0 @ domain ID | 553 | mcr p15, 0, r7, c3, c0, 0 @ domain ID |
554 | mcr p15, 0, r1, c2, c0, 0 @ translation table base addr | 554 | mcr p15, 0, r1, c2, c0, 0 @ translation table base addr |
555 | mcr p15, 0, r8, c1, c1, 0 @ auxiliary control reg | 555 | mcr p15, 0, r8, c1, c0, 1 @ auxiliary control reg |
556 | mov r0, r9 @ control register | 556 | mov r0, r9 @ control register |
557 | b cpu_resume_mmu | 557 | b cpu_resume_mmu |
558 | ENDPROC(cpu_xscale_do_resume) | 558 | ENDPROC(cpu_xscale_do_resume) |
diff --git a/arch/arm/plat-orion/gpio.c b/arch/arm/plat-orion/gpio.c index e048f6198d68..e53fc8df7e4e 100644 --- a/arch/arm/plat-orion/gpio.c +++ b/arch/arm/plat-orion/gpio.c | |||
@@ -306,9 +306,10 @@ EXPORT_SYMBOL(orion_gpio_set_blink); | |||
306 | 306 | ||
307 | #define ORION_BLINK_HALF_PERIOD 100 /* ms */ | 307 | #define ORION_BLINK_HALF_PERIOD 100 /* ms */ |
308 | 308 | ||
309 | int orion_gpio_led_blink_set(unsigned gpio, int state, | 309 | int orion_gpio_led_blink_set(struct gpio_desc *desc, int state, |
310 | unsigned long *delay_on, unsigned long *delay_off) | 310 | unsigned long *delay_on, unsigned long *delay_off) |
311 | { | 311 | { |
312 | unsigned gpio = desc_to_gpio(desc); | ||
312 | 313 | ||
313 | if (delay_on && delay_off && !*delay_on && !*delay_off) | 314 | if (delay_on && delay_off && !*delay_on && !*delay_off) |
314 | *delay_on = *delay_off = ORION_BLINK_HALF_PERIOD; | 315 | *delay_on = *delay_off = ORION_BLINK_HALF_PERIOD; |
diff --git a/arch/arm/plat-orion/include/plat/orion-gpio.h b/arch/arm/plat-orion/include/plat/orion-gpio.h index e763988b04b9..e856b073a9c8 100644 --- a/arch/arm/plat-orion/include/plat/orion-gpio.h +++ b/arch/arm/plat-orion/include/plat/orion-gpio.h | |||
@@ -14,12 +14,15 @@ | |||
14 | #include <linux/init.h> | 14 | #include <linux/init.h> |
15 | #include <linux/types.h> | 15 | #include <linux/types.h> |
16 | #include <linux/irqdomain.h> | 16 | #include <linux/irqdomain.h> |
17 | |||
18 | struct gpio_desc; | ||
19 | |||
17 | /* | 20 | /* |
18 | * Orion-specific GPIO API extensions. | 21 | * Orion-specific GPIO API extensions. |
19 | */ | 22 | */ |
20 | void orion_gpio_set_unused(unsigned pin); | 23 | void orion_gpio_set_unused(unsigned pin); |
21 | void orion_gpio_set_blink(unsigned pin, int blink); | 24 | void orion_gpio_set_blink(unsigned pin, int blink); |
22 | int orion_gpio_led_blink_set(unsigned gpio, int state, | 25 | int orion_gpio_led_blink_set(struct gpio_desc *desc, int state, |
23 | unsigned long *delay_on, unsigned long *delay_off); | 26 | unsigned long *delay_on, unsigned long *delay_off); |
24 | 27 | ||
25 | #define GPIO_INPUT_OK (1 << 0) | 28 | #define GPIO_INPUT_OK (1 << 0) |
diff --git a/arch/arm64/kvm/sys_regs.c b/arch/arm64/kvm/sys_regs.c index 4cc3b719208e..3d7c2df89946 100644 --- a/arch/arm64/kvm/sys_regs.c +++ b/arch/arm64/kvm/sys_regs.c | |||
@@ -424,6 +424,11 @@ static const struct sys_reg_desc sys_reg_descs[] = { | |||
424 | /* VBAR_EL1 */ | 424 | /* VBAR_EL1 */ |
425 | { Op0(0b11), Op1(0b000), CRn(0b1100), CRm(0b0000), Op2(0b000), | 425 | { Op0(0b11), Op1(0b000), CRn(0b1100), CRm(0b0000), Op2(0b000), |
426 | NULL, reset_val, VBAR_EL1, 0 }, | 426 | NULL, reset_val, VBAR_EL1, 0 }, |
427 | |||
428 | /* ICC_SRE_EL1 */ | ||
429 | { Op0(0b11), Op1(0b000), CRn(0b1100), CRm(0b1100), Op2(0b101), | ||
430 | trap_raz_wi }, | ||
431 | |||
427 | /* CONTEXTIDR_EL1 */ | 432 | /* CONTEXTIDR_EL1 */ |
428 | { Op0(0b11), Op1(0b000), CRn(0b1101), CRm(0b0000), Op2(0b001), | 433 | { Op0(0b11), Op1(0b000), CRn(0b1101), CRm(0b0000), Op2(0b001), |
429 | access_vm_reg, reset_val, CONTEXTIDR_EL1, 0 }, | 434 | access_vm_reg, reset_val, CONTEXTIDR_EL1, 0 }, |
@@ -690,6 +695,10 @@ static const struct sys_reg_desc cp15_regs[] = { | |||
690 | { Op1( 0), CRn(10), CRm( 2), Op2( 1), access_vm_reg, NULL, c10_NMRR }, | 695 | { Op1( 0), CRn(10), CRm( 2), Op2( 1), access_vm_reg, NULL, c10_NMRR }, |
691 | { Op1( 0), CRn(10), CRm( 3), Op2( 0), access_vm_reg, NULL, c10_AMAIR0 }, | 696 | { Op1( 0), CRn(10), CRm( 3), Op2( 0), access_vm_reg, NULL, c10_AMAIR0 }, |
692 | { Op1( 0), CRn(10), CRm( 3), Op2( 1), access_vm_reg, NULL, c10_AMAIR1 }, | 697 | { Op1( 0), CRn(10), CRm( 3), Op2( 1), access_vm_reg, NULL, c10_AMAIR1 }, |
698 | |||
699 | /* ICC_SRE */ | ||
700 | { Op1( 0), CRn(12), CRm(12), Op2( 5), trap_raz_wi }, | ||
701 | |||
693 | { Op1( 0), CRn(13), CRm( 0), Op2( 1), access_vm_reg, NULL, c13_CID }, | 702 | { Op1( 0), CRn(13), CRm( 0), Op2( 1), access_vm_reg, NULL, c13_CID }, |
694 | }; | 703 | }; |
695 | 704 | ||
diff --git a/arch/ia64/kvm/kvm-ia64.c b/arch/ia64/kvm/kvm-ia64.c index ec6b9acb6bea..dbe46f43884d 100644 --- a/arch/ia64/kvm/kvm-ia64.c +++ b/arch/ia64/kvm/kvm-ia64.c | |||
@@ -1563,7 +1563,7 @@ int kvm_arch_prepare_memory_region(struct kvm *kvm, | |||
1563 | 1563 | ||
1564 | for (i = 0; i < npages; i++) { | 1564 | for (i = 0; i < npages; i++) { |
1565 | pfn = gfn_to_pfn(kvm, base_gfn + i); | 1565 | pfn = gfn_to_pfn(kvm, base_gfn + i); |
1566 | if (!kvm_is_mmio_pfn(pfn)) { | 1566 | if (!kvm_is_reserved_pfn(pfn)) { |
1567 | kvm_set_pmt_entry(kvm, base_gfn + i, | 1567 | kvm_set_pmt_entry(kvm, base_gfn + i, |
1568 | pfn << PAGE_SHIFT, | 1568 | pfn << PAGE_SHIFT, |
1569 | _PAGE_AR_RWX | _PAGE_MA_WB); | 1569 | _PAGE_AR_RWX | _PAGE_MA_WB); |
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig index f43aa536c517..9536ef912f59 100644 --- a/arch/mips/Kconfig +++ b/arch/mips/Kconfig | |||
@@ -2101,9 +2101,17 @@ config 64BIT_PHYS_ADDR | |||
2101 | config ARCH_PHYS_ADDR_T_64BIT | 2101 | config ARCH_PHYS_ADDR_T_64BIT |
2102 | def_bool 64BIT_PHYS_ADDR | 2102 | def_bool 64BIT_PHYS_ADDR |
2103 | 2103 | ||
2104 | choice | ||
2105 | prompt "SmartMIPS or microMIPS ASE support" | ||
2106 | |||
2107 | config CPU_NEEDS_NO_SMARTMIPS_OR_MICROMIPS | ||
2108 | bool "None" | ||
2109 | help | ||
2110 | Select this if you want neither microMIPS nor SmartMIPS support | ||
2111 | |||
2104 | config CPU_HAS_SMARTMIPS | 2112 | config CPU_HAS_SMARTMIPS |
2105 | depends on SYS_SUPPORTS_SMARTMIPS | 2113 | depends on SYS_SUPPORTS_SMARTMIPS |
2106 | bool "Support for the SmartMIPS ASE" | 2114 | bool "SmartMIPS" |
2107 | help | 2115 | help |
2108 | SmartMIPS is a extension of the MIPS32 architecture aimed at | 2116 | SmartMIPS is a extension of the MIPS32 architecture aimed at |
2109 | increased security at both hardware and software level for | 2117 | increased security at both hardware and software level for |
@@ -2115,11 +2123,13 @@ config CPU_HAS_SMARTMIPS | |||
2115 | 2123 | ||
2116 | config CPU_MICROMIPS | 2124 | config CPU_MICROMIPS |
2117 | depends on SYS_SUPPORTS_MICROMIPS | 2125 | depends on SYS_SUPPORTS_MICROMIPS |
2118 | bool "Build kernel using microMIPS ISA" | 2126 | bool "microMIPS" |
2119 | help | 2127 | help |
2120 | When this option is enabled the kernel will be built using the | 2128 | When this option is enabled the kernel will be built using the |
2121 | microMIPS ISA | 2129 | microMIPS ISA |
2122 | 2130 | ||
2131 | endchoice | ||
2132 | |||
2123 | config CPU_HAS_MSA | 2133 | config CPU_HAS_MSA |
2124 | bool "Support for the MIPS SIMD Architecture (EXPERIMENTAL)" | 2134 | bool "Support for the MIPS SIMD Architecture (EXPERIMENTAL)" |
2125 | depends on CPU_SUPPORTS_MSA | 2135 | depends on CPU_SUPPORTS_MSA |
diff --git a/arch/mips/include/asm/jump_label.h b/arch/mips/include/asm/jump_label.h index e194f957ca8c..fdbff44e5482 100644 --- a/arch/mips/include/asm/jump_label.h +++ b/arch/mips/include/asm/jump_label.h | |||
@@ -20,9 +20,15 @@ | |||
20 | #define WORD_INSN ".word" | 20 | #define WORD_INSN ".word" |
21 | #endif | 21 | #endif |
22 | 22 | ||
23 | #ifdef CONFIG_CPU_MICROMIPS | ||
24 | #define NOP_INSN "nop32" | ||
25 | #else | ||
26 | #define NOP_INSN "nop" | ||
27 | #endif | ||
28 | |||
23 | static __always_inline bool arch_static_branch(struct static_key *key) | 29 | static __always_inline bool arch_static_branch(struct static_key *key) |
24 | { | 30 | { |
25 | asm_volatile_goto("1:\tnop\n\t" | 31 | asm_volatile_goto("1:\t" NOP_INSN "\n\t" |
26 | "nop\n\t" | 32 | "nop\n\t" |
27 | ".pushsection __jump_table, \"aw\"\n\t" | 33 | ".pushsection __jump_table, \"aw\"\n\t" |
28 | WORD_INSN " 1b, %l[l_yes], %0\n\t" | 34 | WORD_INSN " 1b, %l[l_yes], %0\n\t" |
diff --git a/arch/mips/include/asm/mach-loongson/cpu-feature-overrides.h b/arch/mips/include/asm/mach-loongson/cpu-feature-overrides.h index 7d28f95b0512..6d69332f21ec 100644 --- a/arch/mips/include/asm/mach-loongson/cpu-feature-overrides.h +++ b/arch/mips/include/asm/mach-loongson/cpu-feature-overrides.h | |||
@@ -41,10 +41,8 @@ | |||
41 | #define cpu_has_mcheck 0 | 41 | #define cpu_has_mcheck 0 |
42 | #define cpu_has_mdmx 0 | 42 | #define cpu_has_mdmx 0 |
43 | #define cpu_has_mips16 0 | 43 | #define cpu_has_mips16 0 |
44 | #define cpu_has_mips32r1 0 | ||
45 | #define cpu_has_mips32r2 0 | 44 | #define cpu_has_mips32r2 0 |
46 | #define cpu_has_mips3d 0 | 45 | #define cpu_has_mips3d 0 |
47 | #define cpu_has_mips64r1 0 | ||
48 | #define cpu_has_mips64r2 0 | 46 | #define cpu_has_mips64r2 0 |
49 | #define cpu_has_mipsmt 0 | 47 | #define cpu_has_mipsmt 0 |
50 | #define cpu_has_prefetch 0 | 48 | #define cpu_has_prefetch 0 |
diff --git a/arch/mips/include/asm/mipsregs.h b/arch/mips/include/asm/mipsregs.h index b46cd220a018..22a135ac91de 100644 --- a/arch/mips/include/asm/mipsregs.h +++ b/arch/mips/include/asm/mipsregs.h | |||
@@ -661,6 +661,8 @@ | |||
661 | #define MIPS_CONF6_SYND (_ULCAST_(1) << 13) | 661 | #define MIPS_CONF6_SYND (_ULCAST_(1) << 13) |
662 | /* proAptiv FTLB on/off bit */ | 662 | /* proAptiv FTLB on/off bit */ |
663 | #define MIPS_CONF6_FTLBEN (_ULCAST_(1) << 15) | 663 | #define MIPS_CONF6_FTLBEN (_ULCAST_(1) << 15) |
664 | /* FTLB probability bits */ | ||
665 | #define MIPS_CONF6_FTLBP_SHIFT (16) | ||
664 | 666 | ||
665 | #define MIPS_CONF7_WII (_ULCAST_(1) << 31) | 667 | #define MIPS_CONF7_WII (_ULCAST_(1) << 31) |
666 | 668 | ||
diff --git a/arch/mips/include/asm/r4kcache.h b/arch/mips/include/asm/r4kcache.h index 4520adc8699b..cd6e0afc6833 100644 --- a/arch/mips/include/asm/r4kcache.h +++ b/arch/mips/include/asm/r4kcache.h | |||
@@ -257,7 +257,11 @@ static inline void protected_flush_icache_line(unsigned long addr) | |||
257 | */ | 257 | */ |
258 | static inline void protected_writeback_dcache_line(unsigned long addr) | 258 | static inline void protected_writeback_dcache_line(unsigned long addr) |
259 | { | 259 | { |
260 | #ifdef CONFIG_EVA | ||
261 | protected_cachee_op(Hit_Writeback_Inv_D, addr); | ||
262 | #else | ||
260 | protected_cache_op(Hit_Writeback_Inv_D, addr); | 263 | protected_cache_op(Hit_Writeback_Inv_D, addr); |
264 | #endif | ||
261 | } | 265 | } |
262 | 266 | ||
263 | static inline void protected_writeback_scache_line(unsigned long addr) | 267 | static inline void protected_writeback_scache_line(unsigned long addr) |
diff --git a/arch/mips/include/asm/uaccess.h b/arch/mips/include/asm/uaccess.h index a10951090234..22a5624e2fd2 100644 --- a/arch/mips/include/asm/uaccess.h +++ b/arch/mips/include/asm/uaccess.h | |||
@@ -301,7 +301,8 @@ do { \ | |||
301 | __get_kernel_common((x), size, __gu_ptr); \ | 301 | __get_kernel_common((x), size, __gu_ptr); \ |
302 | else \ | 302 | else \ |
303 | __get_user_common((x), size, __gu_ptr); \ | 303 | __get_user_common((x), size, __gu_ptr); \ |
304 | } \ | 304 | } else \ |
305 | (x) = 0; \ | ||
305 | \ | 306 | \ |
306 | __gu_err; \ | 307 | __gu_err; \ |
307 | }) | 308 | }) |
@@ -316,6 +317,7 @@ do { \ | |||
316 | " .insn \n" \ | 317 | " .insn \n" \ |
317 | " .section .fixup,\"ax\" \n" \ | 318 | " .section .fixup,\"ax\" \n" \ |
318 | "3: li %0, %4 \n" \ | 319 | "3: li %0, %4 \n" \ |
320 | " move %1, $0 \n" \ | ||
319 | " j 2b \n" \ | 321 | " j 2b \n" \ |
320 | " .previous \n" \ | 322 | " .previous \n" \ |
321 | " .section __ex_table,\"a\" \n" \ | 323 | " .section __ex_table,\"a\" \n" \ |
@@ -630,6 +632,7 @@ do { \ | |||
630 | " .insn \n" \ | 632 | " .insn \n" \ |
631 | " .section .fixup,\"ax\" \n" \ | 633 | " .section .fixup,\"ax\" \n" \ |
632 | "3: li %0, %4 \n" \ | 634 | "3: li %0, %4 \n" \ |
635 | " move %1, $0 \n" \ | ||
633 | " j 2b \n" \ | 636 | " j 2b \n" \ |
634 | " .previous \n" \ | 637 | " .previous \n" \ |
635 | " .section __ex_table,\"a\" \n" \ | 638 | " .section __ex_table,\"a\" \n" \ |
@@ -773,10 +776,11 @@ extern void __put_user_unaligned_unknown(void); | |||
773 | "jal\t" #destination "\n\t" | 776 | "jal\t" #destination "\n\t" |
774 | #endif | 777 | #endif |
775 | 778 | ||
776 | #ifndef CONFIG_CPU_DADDI_WORKAROUNDS | 779 | #if defined(CONFIG_CPU_DADDI_WORKAROUNDS) || (defined(CONFIG_EVA) && \ |
777 | #define DADDI_SCRATCH "$0" | 780 | defined(CONFIG_CPU_HAS_PREFETCH)) |
778 | #else | ||
779 | #define DADDI_SCRATCH "$3" | 781 | #define DADDI_SCRATCH "$3" |
782 | #else | ||
783 | #define DADDI_SCRATCH "$0" | ||
780 | #endif | 784 | #endif |
781 | 785 | ||
782 | extern size_t __copy_user(void *__to, const void *__from, size_t __n); | 786 | extern size_t __copy_user(void *__to, const void *__from, size_t __n); |
@@ -1418,7 +1422,7 @@ static inline long __strnlen_user(const char __user *s, long n) | |||
1418 | } | 1422 | } |
1419 | 1423 | ||
1420 | /* | 1424 | /* |
1421 | * strlen_user: - Get the size of a string in user space. | 1425 | * strnlen_user: - Get the size of a string in user space. |
1422 | * @str: The string to measure. | 1426 | * @str: The string to measure. |
1423 | * | 1427 | * |
1424 | * Context: User context only. This function may sleep. | 1428 | * Context: User context only. This function may sleep. |
@@ -1427,9 +1431,7 @@ static inline long __strnlen_user(const char __user *s, long n) | |||
1427 | * | 1431 | * |
1428 | * Returns the size of the string INCLUDING the terminating NUL. | 1432 | * Returns the size of the string INCLUDING the terminating NUL. |
1429 | * On exception, returns 0. | 1433 | * On exception, returns 0. |
1430 | * | 1434 | * If the string is too long, returns a value greater than @n. |
1431 | * If there is a limit on the length of a valid string, you may wish to | ||
1432 | * consider using strnlen_user() instead. | ||
1433 | */ | 1435 | */ |
1434 | static inline long strnlen_user(const char __user *s, long n) | 1436 | static inline long strnlen_user(const char __user *s, long n) |
1435 | { | 1437 | { |
diff --git a/arch/mips/include/uapi/asm/unistd.h b/arch/mips/include/uapi/asm/unistd.h index 9dc58568f230..d001bb1ad177 100644 --- a/arch/mips/include/uapi/asm/unistd.h +++ b/arch/mips/include/uapi/asm/unistd.h | |||
@@ -1045,7 +1045,7 @@ | |||
1045 | #define __NR_seccomp (__NR_Linux + 316) | 1045 | #define __NR_seccomp (__NR_Linux + 316) |
1046 | #define __NR_getrandom (__NR_Linux + 317) | 1046 | #define __NR_getrandom (__NR_Linux + 317) |
1047 | #define __NR_memfd_create (__NR_Linux + 318) | 1047 | #define __NR_memfd_create (__NR_Linux + 318) |
1048 | #define __NR_memfd_create (__NR_Linux + 319) | 1048 | #define __NR_bpf (__NR_Linux + 319) |
1049 | 1049 | ||
1050 | /* | 1050 | /* |
1051 | * Offset of the last N32 flavoured syscall | 1051 | * Offset of the last N32 flavoured syscall |
diff --git a/arch/mips/kernel/bmips_vec.S b/arch/mips/kernel/bmips_vec.S index 290c23b51678..86495072a922 100644 --- a/arch/mips/kernel/bmips_vec.S +++ b/arch/mips/kernel/bmips_vec.S | |||
@@ -208,7 +208,6 @@ bmips_reset_nmi_vec_end: | |||
208 | END(bmips_reset_nmi_vec) | 208 | END(bmips_reset_nmi_vec) |
209 | 209 | ||
210 | .set pop | 210 | .set pop |
211 | .previous | ||
212 | 211 | ||
213 | /*********************************************************************** | 212 | /*********************************************************************** |
214 | * CPU1 warm restart vector (used for second and subsequent boots). | 213 | * CPU1 warm restart vector (used for second and subsequent boots). |
@@ -281,5 +280,3 @@ LEAF(bmips_enable_xks01) | |||
281 | jr ra | 280 | jr ra |
282 | 281 | ||
283 | END(bmips_enable_xks01) | 282 | END(bmips_enable_xks01) |
284 | |||
285 | .previous | ||
diff --git a/arch/mips/kernel/cps-vec.S b/arch/mips/kernel/cps-vec.S index e6e97d2a5c9e..0384b05ab5a0 100644 --- a/arch/mips/kernel/cps-vec.S +++ b/arch/mips/kernel/cps-vec.S | |||
@@ -229,6 +229,7 @@ LEAF(mips_cps_core_init) | |||
229 | nop | 229 | nop |
230 | 230 | ||
231 | .set push | 231 | .set push |
232 | .set mips32r2 | ||
232 | .set mt | 233 | .set mt |
233 | 234 | ||
234 | /* Only allow 1 TC per VPE to execute... */ | 235 | /* Only allow 1 TC per VPE to execute... */ |
@@ -345,6 +346,7 @@ LEAF(mips_cps_boot_vpes) | |||
345 | nop | 346 | nop |
346 | 347 | ||
347 | .set push | 348 | .set push |
349 | .set mips32r2 | ||
348 | .set mt | 350 | .set mt |
349 | 351 | ||
350 | 1: /* Enter VPE configuration state */ | 352 | 1: /* Enter VPE configuration state */ |
diff --git a/arch/mips/kernel/cpu-probe.c b/arch/mips/kernel/cpu-probe.c index 94c4a0c0a577..dc49cf30c2db 100644 --- a/arch/mips/kernel/cpu-probe.c +++ b/arch/mips/kernel/cpu-probe.c | |||
@@ -193,6 +193,32 @@ static void set_isa(struct cpuinfo_mips *c, unsigned int isa) | |||
193 | static char unknown_isa[] = KERN_ERR \ | 193 | static char unknown_isa[] = KERN_ERR \ |
194 | "Unsupported ISA type, c0.config0: %d."; | 194 | "Unsupported ISA type, c0.config0: %d."; |
195 | 195 | ||
196 | static unsigned int calculate_ftlb_probability(struct cpuinfo_mips *c) | ||
197 | { | ||
198 | |||
199 | unsigned int probability = c->tlbsize / c->tlbsizevtlb; | ||
200 | |||
201 | /* | ||
202 | * 0 = All TLBWR instructions go to FTLB | ||
203 | * 1 = 15:1: For every 16 TBLWR instructions, 15 go to the | ||
204 | * FTLB and 1 goes to the VTLB. | ||
205 | * 2 = 7:1: As above with 7:1 ratio. | ||
206 | * 3 = 3:1: As above with 3:1 ratio. | ||
207 | * | ||
208 | * Use the linear midpoint as the probability threshold. | ||
209 | */ | ||
210 | if (probability >= 12) | ||
211 | return 1; | ||
212 | else if (probability >= 6) | ||
213 | return 2; | ||
214 | else | ||
215 | /* | ||
216 | * So FTLB is less than 4 times bigger than VTLB. | ||
217 | * A 3:1 ratio can still be useful though. | ||
218 | */ | ||
219 | return 3; | ||
220 | } | ||
221 | |||
196 | static void set_ftlb_enable(struct cpuinfo_mips *c, int enable) | 222 | static void set_ftlb_enable(struct cpuinfo_mips *c, int enable) |
197 | { | 223 | { |
198 | unsigned int config6; | 224 | unsigned int config6; |
@@ -203,9 +229,14 @@ static void set_ftlb_enable(struct cpuinfo_mips *c, int enable) | |||
203 | case CPU_P5600: | 229 | case CPU_P5600: |
204 | /* proAptiv & related cores use Config6 to enable the FTLB */ | 230 | /* proAptiv & related cores use Config6 to enable the FTLB */ |
205 | config6 = read_c0_config6(); | 231 | config6 = read_c0_config6(); |
232 | /* Clear the old probability value */ | ||
233 | config6 &= ~(3 << MIPS_CONF6_FTLBP_SHIFT); | ||
206 | if (enable) | 234 | if (enable) |
207 | /* Enable FTLB */ | 235 | /* Enable FTLB */ |
208 | write_c0_config6(config6 | MIPS_CONF6_FTLBEN); | 236 | write_c0_config6(config6 | |
237 | (calculate_ftlb_probability(c) | ||
238 | << MIPS_CONF6_FTLBP_SHIFT) | ||
239 | | MIPS_CONF6_FTLBEN); | ||
209 | else | 240 | else |
210 | /* Disable FTLB */ | 241 | /* Disable FTLB */ |
211 | write_c0_config6(config6 & ~MIPS_CONF6_FTLBEN); | 242 | write_c0_config6(config6 & ~MIPS_CONF6_FTLBEN); |
@@ -757,31 +788,34 @@ static inline void cpu_probe_legacy(struct cpuinfo_mips *c, unsigned int cpu) | |||
757 | c->cputype = CPU_LOONGSON2; | 788 | c->cputype = CPU_LOONGSON2; |
758 | __cpu_name[cpu] = "ICT Loongson-2"; | 789 | __cpu_name[cpu] = "ICT Loongson-2"; |
759 | set_elf_platform(cpu, "loongson2e"); | 790 | set_elf_platform(cpu, "loongson2e"); |
791 | set_isa(c, MIPS_CPU_ISA_III); | ||
760 | break; | 792 | break; |
761 | case PRID_REV_LOONGSON2F: | 793 | case PRID_REV_LOONGSON2F: |
762 | c->cputype = CPU_LOONGSON2; | 794 | c->cputype = CPU_LOONGSON2; |
763 | __cpu_name[cpu] = "ICT Loongson-2"; | 795 | __cpu_name[cpu] = "ICT Loongson-2"; |
764 | set_elf_platform(cpu, "loongson2f"); | 796 | set_elf_platform(cpu, "loongson2f"); |
797 | set_isa(c, MIPS_CPU_ISA_III); | ||
765 | break; | 798 | break; |
766 | case PRID_REV_LOONGSON3A: | 799 | case PRID_REV_LOONGSON3A: |
767 | c->cputype = CPU_LOONGSON3; | 800 | c->cputype = CPU_LOONGSON3; |
768 | c->writecombine = _CACHE_UNCACHED_ACCELERATED; | ||
769 | __cpu_name[cpu] = "ICT Loongson-3"; | 801 | __cpu_name[cpu] = "ICT Loongson-3"; |
770 | set_elf_platform(cpu, "loongson3a"); | 802 | set_elf_platform(cpu, "loongson3a"); |
803 | set_isa(c, MIPS_CPU_ISA_M64R1); | ||
771 | break; | 804 | break; |
772 | case PRID_REV_LOONGSON3B_R1: | 805 | case PRID_REV_LOONGSON3B_R1: |
773 | case PRID_REV_LOONGSON3B_R2: | 806 | case PRID_REV_LOONGSON3B_R2: |
774 | c->cputype = CPU_LOONGSON3; | 807 | c->cputype = CPU_LOONGSON3; |
775 | __cpu_name[cpu] = "ICT Loongson-3"; | 808 | __cpu_name[cpu] = "ICT Loongson-3"; |
776 | set_elf_platform(cpu, "loongson3b"); | 809 | set_elf_platform(cpu, "loongson3b"); |
810 | set_isa(c, MIPS_CPU_ISA_M64R1); | ||
777 | break; | 811 | break; |
778 | } | 812 | } |
779 | 813 | ||
780 | set_isa(c, MIPS_CPU_ISA_III); | ||
781 | c->options = R4K_OPTS | | 814 | c->options = R4K_OPTS | |
782 | MIPS_CPU_FPU | MIPS_CPU_LLSC | | 815 | MIPS_CPU_FPU | MIPS_CPU_LLSC | |
783 | MIPS_CPU_32FPR; | 816 | MIPS_CPU_32FPR; |
784 | c->tlbsize = 64; | 817 | c->tlbsize = 64; |
818 | c->writecombine = _CACHE_UNCACHED_ACCELERATED; | ||
785 | break; | 819 | break; |
786 | case PRID_IMP_LOONGSON_32: /* Loongson-1 */ | 820 | case PRID_IMP_LOONGSON_32: /* Loongson-1 */ |
787 | decode_configs(c); | 821 | decode_configs(c); |
diff --git a/arch/mips/kernel/jump_label.c b/arch/mips/kernel/jump_label.c index 6001610cfe55..dda800e9e731 100644 --- a/arch/mips/kernel/jump_label.c +++ b/arch/mips/kernel/jump_label.c | |||
@@ -18,31 +18,53 @@ | |||
18 | 18 | ||
19 | #ifdef HAVE_JUMP_LABEL | 19 | #ifdef HAVE_JUMP_LABEL |
20 | 20 | ||
21 | #define J_RANGE_MASK ((1ul << 28) - 1) | 21 | /* |
22 | * Define parameters for the standard MIPS and the microMIPS jump | ||
23 | * instruction encoding respectively: | ||
24 | * | ||
25 | * - the ISA bit of the target, either 0 or 1 respectively, | ||
26 | * | ||
27 | * - the amount the jump target address is shifted right to fit in the | ||
28 | * immediate field of the machine instruction, either 2 or 1, | ||
29 | * | ||
30 | * - the mask determining the size of the jump region relative to the | ||
31 | * delay-slot instruction, either 256MB or 128MB, | ||
32 | * | ||
33 | * - the jump target alignment, either 4 or 2 bytes. | ||
34 | */ | ||
35 | #define J_ISA_BIT IS_ENABLED(CONFIG_CPU_MICROMIPS) | ||
36 | #define J_RANGE_SHIFT (2 - J_ISA_BIT) | ||
37 | #define J_RANGE_MASK ((1ul << (26 + J_RANGE_SHIFT)) - 1) | ||
38 | #define J_ALIGN_MASK ((1ul << J_RANGE_SHIFT) - 1) | ||
22 | 39 | ||
23 | void arch_jump_label_transform(struct jump_entry *e, | 40 | void arch_jump_label_transform(struct jump_entry *e, |
24 | enum jump_label_type type) | 41 | enum jump_label_type type) |
25 | { | 42 | { |
43 | union mips_instruction *insn_p; | ||
26 | union mips_instruction insn; | 44 | union mips_instruction insn; |
27 | union mips_instruction *insn_p = | ||
28 | (union mips_instruction *)(unsigned long)e->code; | ||
29 | 45 | ||
30 | /* Jump only works within a 256MB aligned region. */ | 46 | insn_p = (union mips_instruction *)msk_isa16_mode(e->code); |
31 | BUG_ON((e->target & ~J_RANGE_MASK) != (e->code & ~J_RANGE_MASK)); | 47 | |
48 | /* Jump only works within an aligned region its delay slot is in. */ | ||
49 | BUG_ON((e->target & ~J_RANGE_MASK) != ((e->code + 4) & ~J_RANGE_MASK)); | ||
32 | 50 | ||
33 | /* Target must have 4 byte alignment. */ | 51 | /* Target must have the right alignment and ISA must be preserved. */ |
34 | BUG_ON((e->target & 3) != 0); | 52 | BUG_ON((e->target & J_ALIGN_MASK) != J_ISA_BIT); |
35 | 53 | ||
36 | if (type == JUMP_LABEL_ENABLE) { | 54 | if (type == JUMP_LABEL_ENABLE) { |
37 | insn.j_format.opcode = j_op; | 55 | insn.j_format.opcode = J_ISA_BIT ? mm_j32_op : j_op; |
38 | insn.j_format.target = (e->target & J_RANGE_MASK) >> 2; | 56 | insn.j_format.target = e->target >> J_RANGE_SHIFT; |
39 | } else { | 57 | } else { |
40 | insn.word = 0; /* nop */ | 58 | insn.word = 0; /* nop */ |
41 | } | 59 | } |
42 | 60 | ||
43 | get_online_cpus(); | 61 | get_online_cpus(); |
44 | mutex_lock(&text_mutex); | 62 | mutex_lock(&text_mutex); |
45 | *insn_p = insn; | 63 | if (IS_ENABLED(CONFIG_CPU_MICROMIPS)) { |
64 | insn_p->halfword[0] = insn.word >> 16; | ||
65 | insn_p->halfword[1] = insn.word; | ||
66 | } else | ||
67 | *insn_p = insn; | ||
46 | 68 | ||
47 | flush_icache_range((unsigned long)insn_p, | 69 | flush_icache_range((unsigned long)insn_p, |
48 | (unsigned long)insn_p + sizeof(*insn_p)); | 70 | (unsigned long)insn_p + sizeof(*insn_p)); |
diff --git a/arch/mips/kernel/rtlx.c b/arch/mips/kernel/rtlx.c index 31b1b763cb29..c5c4fd54d797 100644 --- a/arch/mips/kernel/rtlx.c +++ b/arch/mips/kernel/rtlx.c | |||
@@ -94,12 +94,12 @@ int rtlx_open(int index, int can_sleep) | |||
94 | int ret = 0; | 94 | int ret = 0; |
95 | 95 | ||
96 | if (index >= RTLX_CHANNELS) { | 96 | if (index >= RTLX_CHANNELS) { |
97 | pr_debug(KERN_DEBUG "rtlx_open index out of range\n"); | 97 | pr_debug("rtlx_open index out of range\n"); |
98 | return -ENOSYS; | 98 | return -ENOSYS; |
99 | } | 99 | } |
100 | 100 | ||
101 | if (atomic_inc_return(&channel_wqs[index].in_open) > 1) { | 101 | if (atomic_inc_return(&channel_wqs[index].in_open) > 1) { |
102 | pr_debug(KERN_DEBUG "rtlx_open channel %d already opened\n", index); | 102 | pr_debug("rtlx_open channel %d already opened\n", index); |
103 | ret = -EBUSY; | 103 | ret = -EBUSY; |
104 | goto out_fail; | 104 | goto out_fail; |
105 | } | 105 | } |
diff --git a/arch/mips/kernel/setup.c b/arch/mips/kernel/setup.c index d21ec57b6e95..f3b635f86c39 100644 --- a/arch/mips/kernel/setup.c +++ b/arch/mips/kernel/setup.c | |||
@@ -485,7 +485,7 @@ static void __init bootmem_init(void) | |||
485 | * NOTE: historically plat_mem_setup did the entire platform initialization. | 485 | * NOTE: historically plat_mem_setup did the entire platform initialization. |
486 | * This was rather impractical because it meant plat_mem_setup had to | 486 | * This was rather impractical because it meant plat_mem_setup had to |
487 | * get away without any kind of memory allocator. To keep old code from | 487 | * get away without any kind of memory allocator. To keep old code from |
488 | * breaking plat_setup was just renamed to plat_setup and a second platform | 488 | * breaking plat_setup was just renamed to plat_mem_setup and a second platform |
489 | * initialization hook for anything else was introduced. | 489 | * initialization hook for anything else was introduced. |
490 | */ | 490 | */ |
491 | 491 | ||
@@ -493,7 +493,7 @@ static int usermem __initdata; | |||
493 | 493 | ||
494 | static int __init early_parse_mem(char *p) | 494 | static int __init early_parse_mem(char *p) |
495 | { | 495 | { |
496 | unsigned long start, size; | 496 | phys_t start, size; |
497 | 497 | ||
498 | /* | 498 | /* |
499 | * If a user specifies memory size, we | 499 | * If a user specifies memory size, we |
diff --git a/arch/mips/kernel/signal.c b/arch/mips/kernel/signal.c index 1d57605e4615..16f1e4f2bf3c 100644 --- a/arch/mips/kernel/signal.c +++ b/arch/mips/kernel/signal.c | |||
@@ -658,13 +658,13 @@ static int signal_setup(void) | |||
658 | save_fp_context = _save_fp_context; | 658 | save_fp_context = _save_fp_context; |
659 | restore_fp_context = _restore_fp_context; | 659 | restore_fp_context = _restore_fp_context; |
660 | } else { | 660 | } else { |
661 | save_fp_context = copy_fp_from_sigcontext; | 661 | save_fp_context = copy_fp_to_sigcontext; |
662 | restore_fp_context = copy_fp_to_sigcontext; | 662 | restore_fp_context = copy_fp_from_sigcontext; |
663 | } | 663 | } |
664 | #endif /* CONFIG_SMP */ | 664 | #endif /* CONFIG_SMP */ |
665 | #else | 665 | #else |
666 | save_fp_context = copy_fp_from_sigcontext;; | 666 | save_fp_context = copy_fp_to_sigcontext; |
667 | restore_fp_context = copy_fp_to_sigcontext; | 667 | restore_fp_context = copy_fp_from_sigcontext; |
668 | #endif | 668 | #endif |
669 | 669 | ||
670 | return 0; | 670 | return 0; |
diff --git a/arch/mips/lib/memcpy.S b/arch/mips/lib/memcpy.S index c17ef80cf65a..5d3238af9b5c 100644 --- a/arch/mips/lib/memcpy.S +++ b/arch/mips/lib/memcpy.S | |||
@@ -503,6 +503,7 @@ | |||
503 | STOREB(t0, NBYTES-2(dst), .Ls_exc_p1\@) | 503 | STOREB(t0, NBYTES-2(dst), .Ls_exc_p1\@) |
504 | .Ldone\@: | 504 | .Ldone\@: |
505 | jr ra | 505 | jr ra |
506 | nop | ||
506 | .if __memcpy == 1 | 507 | .if __memcpy == 1 |
507 | END(memcpy) | 508 | END(memcpy) |
508 | .set __memcpy, 0 | 509 | .set __memcpy, 0 |
diff --git a/arch/mips/loongson/common/Makefile b/arch/mips/loongson/common/Makefile index 0bb9cc9dc621..d87e03330b29 100644 --- a/arch/mips/loongson/common/Makefile +++ b/arch/mips/loongson/common/Makefile | |||
@@ -11,7 +11,8 @@ obj-$(CONFIG_PCI) += pci.o | |||
11 | # Serial port support | 11 | # Serial port support |
12 | # | 12 | # |
13 | obj-$(CONFIG_EARLY_PRINTK) += early_printk.o | 13 | obj-$(CONFIG_EARLY_PRINTK) += early_printk.o |
14 | obj-$(CONFIG_SERIAL_8250) += serial.o | 14 | loongson-serial-$(CONFIG_SERIAL_8250) := serial.o |
15 | obj-y += $(loongson-serial-m) $(loongson-serial-y) | ||
15 | obj-$(CONFIG_LOONGSON_UART_BASE) += uart_base.o | 16 | obj-$(CONFIG_LOONGSON_UART_BASE) += uart_base.o |
16 | obj-$(CONFIG_LOONGSON_MC146818) += rtc.o | 17 | obj-$(CONFIG_LOONGSON_MC146818) += rtc.o |
17 | 18 | ||
diff --git a/arch/mips/loongson/loongson-3/numa.c b/arch/mips/loongson/loongson-3/numa.c index 37ed184398c6..42323bcc5d28 100644 --- a/arch/mips/loongson/loongson-3/numa.c +++ b/arch/mips/loongson/loongson-3/numa.c | |||
@@ -33,6 +33,7 @@ | |||
33 | 33 | ||
34 | static struct node_data prealloc__node_data[MAX_NUMNODES]; | 34 | static struct node_data prealloc__node_data[MAX_NUMNODES]; |
35 | unsigned char __node_distances[MAX_NUMNODES][MAX_NUMNODES]; | 35 | unsigned char __node_distances[MAX_NUMNODES][MAX_NUMNODES]; |
36 | EXPORT_SYMBOL(__node_distances); | ||
36 | struct node_data *__node_data[MAX_NUMNODES]; | 37 | struct node_data *__node_data[MAX_NUMNODES]; |
37 | EXPORT_SYMBOL(__node_data); | 38 | EXPORT_SYMBOL(__node_data); |
38 | 39 | ||
diff --git a/arch/mips/mm/tlb-r4k.c b/arch/mips/mm/tlb-r4k.c index fa6ebd4bc9e9..c3917e251f59 100644 --- a/arch/mips/mm/tlb-r4k.c +++ b/arch/mips/mm/tlb-r4k.c | |||
@@ -299,6 +299,7 @@ void __update_tlb(struct vm_area_struct * vma, unsigned long address, pte_t pte) | |||
299 | 299 | ||
300 | local_irq_save(flags); | 300 | local_irq_save(flags); |
301 | 301 | ||
302 | htw_stop(); | ||
302 | pid = read_c0_entryhi() & ASID_MASK; | 303 | pid = read_c0_entryhi() & ASID_MASK; |
303 | address &= (PAGE_MASK << 1); | 304 | address &= (PAGE_MASK << 1); |
304 | write_c0_entryhi(address | pid); | 305 | write_c0_entryhi(address | pid); |
@@ -346,6 +347,7 @@ void __update_tlb(struct vm_area_struct * vma, unsigned long address, pte_t pte) | |||
346 | tlb_write_indexed(); | 347 | tlb_write_indexed(); |
347 | } | 348 | } |
348 | tlbw_use_hazard(); | 349 | tlbw_use_hazard(); |
350 | htw_start(); | ||
349 | flush_itlb_vm(vma); | 351 | flush_itlb_vm(vma); |
350 | local_irq_restore(flags); | 352 | local_irq_restore(flags); |
351 | } | 353 | } |
@@ -422,6 +424,7 @@ __init int add_temporary_entry(unsigned long entrylo0, unsigned long entrylo1, | |||
422 | 424 | ||
423 | local_irq_save(flags); | 425 | local_irq_save(flags); |
424 | /* Save old context and create impossible VPN2 value */ | 426 | /* Save old context and create impossible VPN2 value */ |
427 | htw_stop(); | ||
425 | old_ctx = read_c0_entryhi(); | 428 | old_ctx = read_c0_entryhi(); |
426 | old_pagemask = read_c0_pagemask(); | 429 | old_pagemask = read_c0_pagemask(); |
427 | wired = read_c0_wired(); | 430 | wired = read_c0_wired(); |
@@ -443,6 +446,7 @@ __init int add_temporary_entry(unsigned long entrylo0, unsigned long entrylo1, | |||
443 | 446 | ||
444 | write_c0_entryhi(old_ctx); | 447 | write_c0_entryhi(old_ctx); |
445 | write_c0_pagemask(old_pagemask); | 448 | write_c0_pagemask(old_pagemask); |
449 | htw_start(); | ||
446 | out: | 450 | out: |
447 | local_irq_restore(flags); | 451 | local_irq_restore(flags); |
448 | return ret; | 452 | return ret; |
diff --git a/arch/mips/mm/tlbex.c b/arch/mips/mm/tlbex.c index b5f228e7eae6..e3328a96e809 100644 --- a/arch/mips/mm/tlbex.c +++ b/arch/mips/mm/tlbex.c | |||
@@ -1872,8 +1872,16 @@ build_r4000_tlbchange_handler_head(u32 **p, struct uasm_label **l, | |||
1872 | uasm_l_smp_pgtable_change(l, *p); | 1872 | uasm_l_smp_pgtable_change(l, *p); |
1873 | #endif | 1873 | #endif |
1874 | iPTE_LW(p, wr.r1, wr.r2); /* get even pte */ | 1874 | iPTE_LW(p, wr.r1, wr.r2); /* get even pte */ |
1875 | if (!m4kc_tlbp_war()) | 1875 | if (!m4kc_tlbp_war()) { |
1876 | build_tlb_probe_entry(p); | 1876 | build_tlb_probe_entry(p); |
1877 | if (cpu_has_htw) { | ||
1878 | /* race condition happens, leaving */ | ||
1879 | uasm_i_ehb(p); | ||
1880 | uasm_i_mfc0(p, wr.r3, C0_INDEX); | ||
1881 | uasm_il_bltz(p, r, wr.r3, label_leave); | ||
1882 | uasm_i_nop(p); | ||
1883 | } | ||
1884 | } | ||
1877 | return wr; | 1885 | return wr; |
1878 | } | 1886 | } |
1879 | 1887 | ||
diff --git a/arch/mips/mti-sead3/sead3-leds.c b/arch/mips/mti-sead3/sead3-leds.c index 20102a6d4141..c427c5778186 100644 --- a/arch/mips/mti-sead3/sead3-leds.c +++ b/arch/mips/mti-sead3/sead3-leds.c | |||
@@ -5,7 +5,7 @@ | |||
5 | * | 5 | * |
6 | * Copyright (C) 2012 MIPS Technologies, Inc. All rights reserved. | 6 | * Copyright (C) 2012 MIPS Technologies, Inc. All rights reserved. |
7 | */ | 7 | */ |
8 | #include <linux/module.h> | 8 | #include <linux/init.h> |
9 | #include <linux/leds.h> | 9 | #include <linux/leds.h> |
10 | #include <linux/platform_device.h> | 10 | #include <linux/platform_device.h> |
11 | 11 | ||
@@ -76,8 +76,4 @@ static int __init led_init(void) | |||
76 | return platform_device_register(&fled_device); | 76 | return platform_device_register(&fled_device); |
77 | } | 77 | } |
78 | 78 | ||
79 | module_init(led_init); | 79 | device_initcall(led_init); |
80 | |||
81 | MODULE_AUTHOR("Chris Dearman <chris@mips.com>"); | ||
82 | MODULE_LICENSE("GPL"); | ||
83 | MODULE_DESCRIPTION("LED probe driver for SEAD-3"); | ||
diff --git a/arch/mips/netlogic/xlp/Makefile b/arch/mips/netlogic/xlp/Makefile index be358a8050c5..6b43af0a34d9 100644 --- a/arch/mips/netlogic/xlp/Makefile +++ b/arch/mips/netlogic/xlp/Makefile | |||
@@ -1,6 +1,10 @@ | |||
1 | obj-y += setup.o nlm_hal.o cop2-ex.o dt.o | 1 | obj-y += setup.o nlm_hal.o cop2-ex.o dt.o |
2 | obj-$(CONFIG_SMP) += wakeup.o | 2 | obj-$(CONFIG_SMP) += wakeup.o |
3 | obj-$(CONFIG_USB) += usb-init.o | 3 | ifdef CONFIG_USB |
4 | obj-$(CONFIG_USB) += usb-init-xlp2.o | 4 | obj-y += usb-init.o |
5 | obj-$(CONFIG_SATA_AHCI) += ahci-init.o | 5 | obj-y += usb-init-xlp2.o |
6 | obj-$(CONFIG_SATA_AHCI) += ahci-init-xlp2.o | 6 | endif |
7 | ifdef CONFIG_SATA_AHCI | ||
8 | obj-y += ahci-init.o | ||
9 | obj-y += ahci-init-xlp2.o | ||
10 | endif | ||
diff --git a/arch/mips/oprofile/backtrace.c b/arch/mips/oprofile/backtrace.c index 6854ed5097d2..83a1dfd8f0e3 100644 --- a/arch/mips/oprofile/backtrace.c +++ b/arch/mips/oprofile/backtrace.c | |||
@@ -92,7 +92,7 @@ static inline int unwind_user_frame(struct stackframe *old_frame, | |||
92 | /* This marks the end of the previous function, | 92 | /* This marks the end of the previous function, |
93 | which means we overran. */ | 93 | which means we overran. */ |
94 | break; | 94 | break; |
95 | stack_size = (unsigned) stack_adjustment; | 95 | stack_size = (unsigned long) stack_adjustment; |
96 | } else if (is_ra_save_ins(&ip)) { | 96 | } else if (is_ra_save_ins(&ip)) { |
97 | int ra_slot = ip.i_format.simmediate; | 97 | int ra_slot = ip.i_format.simmediate; |
98 | if (ra_slot < 0) | 98 | if (ra_slot < 0) |
diff --git a/arch/mips/sgi-ip27/ip27-memory.c b/arch/mips/sgi-ip27/ip27-memory.c index a95c00f5fb96..a304bcc37e4f 100644 --- a/arch/mips/sgi-ip27/ip27-memory.c +++ b/arch/mips/sgi-ip27/ip27-memory.c | |||
@@ -107,6 +107,7 @@ static void router_recurse(klrou_t *router_a, klrou_t *router_b, int depth) | |||
107 | } | 107 | } |
108 | 108 | ||
109 | unsigned char __node_distances[MAX_COMPACT_NODES][MAX_COMPACT_NODES]; | 109 | unsigned char __node_distances[MAX_COMPACT_NODES][MAX_COMPACT_NODES]; |
110 | EXPORT_SYMBOL(__node_distances); | ||
110 | 111 | ||
111 | static int __init compute_node_distance(nasid_t nasid_a, nasid_t nasid_b) | 112 | static int __init compute_node_distance(nasid_t nasid_a, nasid_t nasid_b) |
112 | { | 113 | { |
diff --git a/arch/powerpc/include/asm/pci-bridge.h b/arch/powerpc/include/asm/pci-bridge.h index 4ca90a39d6d0..725247beebec 100644 --- a/arch/powerpc/include/asm/pci-bridge.h +++ b/arch/powerpc/include/asm/pci-bridge.h | |||
@@ -159,8 +159,6 @@ struct pci_dn { | |||
159 | 159 | ||
160 | int pci_ext_config_space; /* for pci devices */ | 160 | int pci_ext_config_space; /* for pci devices */ |
161 | 161 | ||
162 | bool force_32bit_msi; | ||
163 | |||
164 | struct pci_dev *pcidev; /* back-pointer to the pci device */ | 162 | struct pci_dev *pcidev; /* back-pointer to the pci device */ |
165 | #ifdef CONFIG_EEH | 163 | #ifdef CONFIG_EEH |
166 | struct eeh_dev *edev; /* eeh device */ | 164 | struct eeh_dev *edev; /* eeh device */ |
diff --git a/arch/powerpc/kernel/eeh_sysfs.c b/arch/powerpc/kernel/eeh_sysfs.c index f19b1e5cb060..1ceecdda810b 100644 --- a/arch/powerpc/kernel/eeh_sysfs.c +++ b/arch/powerpc/kernel/eeh_sysfs.c | |||
@@ -65,7 +65,7 @@ static ssize_t eeh_pe_state_show(struct device *dev, | |||
65 | return -ENODEV; | 65 | return -ENODEV; |
66 | 66 | ||
67 | state = eeh_ops->get_state(edev->pe, NULL); | 67 | state = eeh_ops->get_state(edev->pe, NULL); |
68 | return sprintf(buf, "%0x08x %0x08x\n", | 68 | return sprintf(buf, "0x%08x 0x%08x\n", |
69 | state, edev->pe->state); | 69 | state, edev->pe->state); |
70 | } | 70 | } |
71 | 71 | ||
diff --git a/arch/powerpc/kernel/pci_64.c b/arch/powerpc/kernel/pci_64.c index 155013da27e0..b15194e2c5fc 100644 --- a/arch/powerpc/kernel/pci_64.c +++ b/arch/powerpc/kernel/pci_64.c | |||
@@ -266,13 +266,3 @@ int pcibus_to_node(struct pci_bus *bus) | |||
266 | } | 266 | } |
267 | EXPORT_SYMBOL(pcibus_to_node); | 267 | EXPORT_SYMBOL(pcibus_to_node); |
268 | #endif | 268 | #endif |
269 | |||
270 | static void quirk_radeon_32bit_msi(struct pci_dev *dev) | ||
271 | { | ||
272 | struct pci_dn *pdn = pci_get_pdn(dev); | ||
273 | |||
274 | if (pdn) | ||
275 | pdn->force_32bit_msi = true; | ||
276 | } | ||
277 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, 0x68f2, quirk_radeon_32bit_msi); | ||
278 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, 0xaa68, quirk_radeon_32bit_msi); | ||
diff --git a/arch/powerpc/kernel/vdso32/getcpu.S b/arch/powerpc/kernel/vdso32/getcpu.S index 23eb9a9441bd..c62be60c7274 100644 --- a/arch/powerpc/kernel/vdso32/getcpu.S +++ b/arch/powerpc/kernel/vdso32/getcpu.S | |||
@@ -30,8 +30,8 @@ | |||
30 | V_FUNCTION_BEGIN(__kernel_getcpu) | 30 | V_FUNCTION_BEGIN(__kernel_getcpu) |
31 | .cfi_startproc | 31 | .cfi_startproc |
32 | mfspr r5,SPRN_SPRG_VDSO_READ | 32 | mfspr r5,SPRN_SPRG_VDSO_READ |
33 | cmpdi cr0,r3,0 | 33 | cmpwi cr0,r3,0 |
34 | cmpdi cr1,r4,0 | 34 | cmpwi cr1,r4,0 |
35 | clrlwi r6,r5,16 | 35 | clrlwi r6,r5,16 |
36 | rlwinm r7,r5,16,31-15,31-0 | 36 | rlwinm r7,r5,16,31-15,31-0 |
37 | beq cr0,1f | 37 | beq cr0,1f |
diff --git a/arch/powerpc/platforms/powernv/opal-hmi.c b/arch/powerpc/platforms/powernv/opal-hmi.c index 5e1ed1575aab..b322bfb51343 100644 --- a/arch/powerpc/platforms/powernv/opal-hmi.c +++ b/arch/powerpc/platforms/powernv/opal-hmi.c | |||
@@ -57,7 +57,7 @@ static void print_hmi_event_info(struct OpalHMIEvent *hmi_evt) | |||
57 | }; | 57 | }; |
58 | 58 | ||
59 | /* Print things out */ | 59 | /* Print things out */ |
60 | if (hmi_evt->version != OpalHMIEvt_V1) { | 60 | if (hmi_evt->version < OpalHMIEvt_V1) { |
61 | pr_err("HMI Interrupt, Unknown event version %d !\n", | 61 | pr_err("HMI Interrupt, Unknown event version %d !\n", |
62 | hmi_evt->version); | 62 | hmi_evt->version); |
63 | return; | 63 | return; |
diff --git a/arch/powerpc/platforms/powernv/pci-ioda.c b/arch/powerpc/platforms/powernv/pci-ioda.c index 468a0f23c7f2..3ba435ec3dcd 100644 --- a/arch/powerpc/platforms/powernv/pci-ioda.c +++ b/arch/powerpc/platforms/powernv/pci-ioda.c | |||
@@ -1509,7 +1509,6 @@ static int pnv_pci_ioda_msi_setup(struct pnv_phb *phb, struct pci_dev *dev, | |||
1509 | unsigned int is_64, struct msi_msg *msg) | 1509 | unsigned int is_64, struct msi_msg *msg) |
1510 | { | 1510 | { |
1511 | struct pnv_ioda_pe *pe = pnv_ioda_get_pe(dev); | 1511 | struct pnv_ioda_pe *pe = pnv_ioda_get_pe(dev); |
1512 | struct pci_dn *pdn = pci_get_pdn(dev); | ||
1513 | unsigned int xive_num = hwirq - phb->msi_base; | 1512 | unsigned int xive_num = hwirq - phb->msi_base; |
1514 | __be32 data; | 1513 | __be32 data; |
1515 | int rc; | 1514 | int rc; |
@@ -1523,7 +1522,7 @@ static int pnv_pci_ioda_msi_setup(struct pnv_phb *phb, struct pci_dev *dev, | |||
1523 | return -ENXIO; | 1522 | return -ENXIO; |
1524 | 1523 | ||
1525 | /* Force 32-bit MSI on some broken devices */ | 1524 | /* Force 32-bit MSI on some broken devices */ |
1526 | if (pdn && pdn->force_32bit_msi) | 1525 | if (dev->no_64bit_msi) |
1527 | is_64 = 0; | 1526 | is_64 = 0; |
1528 | 1527 | ||
1529 | /* Assign XIVE to PE */ | 1528 | /* Assign XIVE to PE */ |
@@ -1997,7 +1996,7 @@ static void __init pnv_pci_init_ioda_phb(struct device_node *np, | |||
1997 | if (is_kdump_kernel()) { | 1996 | if (is_kdump_kernel()) { |
1998 | pr_info(" Issue PHB reset ...\n"); | 1997 | pr_info(" Issue PHB reset ...\n"); |
1999 | ioda_eeh_phb_reset(hose, EEH_RESET_FUNDAMENTAL); | 1998 | ioda_eeh_phb_reset(hose, EEH_RESET_FUNDAMENTAL); |
2000 | ioda_eeh_phb_reset(hose, OPAL_DEASSERT_RESET); | 1999 | ioda_eeh_phb_reset(hose, EEH_RESET_DEACTIVATE); |
2001 | } | 2000 | } |
2002 | 2001 | ||
2003 | /* Configure M64 window */ | 2002 | /* Configure M64 window */ |
diff --git a/arch/powerpc/platforms/powernv/pci.c b/arch/powerpc/platforms/powernv/pci.c index b2187d0068b8..4b20f2c6b3b2 100644 --- a/arch/powerpc/platforms/powernv/pci.c +++ b/arch/powerpc/platforms/powernv/pci.c | |||
@@ -50,7 +50,6 @@ static int pnv_setup_msi_irqs(struct pci_dev *pdev, int nvec, int type) | |||
50 | { | 50 | { |
51 | struct pci_controller *hose = pci_bus_to_host(pdev->bus); | 51 | struct pci_controller *hose = pci_bus_to_host(pdev->bus); |
52 | struct pnv_phb *phb = hose->private_data; | 52 | struct pnv_phb *phb = hose->private_data; |
53 | struct pci_dn *pdn = pci_get_pdn(pdev); | ||
54 | struct msi_desc *entry; | 53 | struct msi_desc *entry; |
55 | struct msi_msg msg; | 54 | struct msi_msg msg; |
56 | int hwirq; | 55 | int hwirq; |
@@ -60,7 +59,7 @@ static int pnv_setup_msi_irqs(struct pci_dev *pdev, int nvec, int type) | |||
60 | if (WARN_ON(!phb) || !phb->msi_bmp.bitmap) | 59 | if (WARN_ON(!phb) || !phb->msi_bmp.bitmap) |
61 | return -ENODEV; | 60 | return -ENODEV; |
62 | 61 | ||
63 | if (pdn && pdn->force_32bit_msi && !phb->msi32_support) | 62 | if (pdev->no_64bit_msi && !phb->msi32_support) |
64 | return -ENODEV; | 63 | return -ENODEV; |
65 | 64 | ||
66 | list_for_each_entry(entry, &pdev->msi_list, list) { | 65 | list_for_each_entry(entry, &pdev->msi_list, list) { |
diff --git a/arch/powerpc/platforms/pseries/msi.c b/arch/powerpc/platforms/pseries/msi.c index 8ab5add4ac82..8b909e94fd9a 100644 --- a/arch/powerpc/platforms/pseries/msi.c +++ b/arch/powerpc/platforms/pseries/msi.c | |||
@@ -420,7 +420,7 @@ static int rtas_setup_msi_irqs(struct pci_dev *pdev, int nvec_in, int type) | |||
420 | */ | 420 | */ |
421 | again: | 421 | again: |
422 | if (type == PCI_CAP_ID_MSI) { | 422 | if (type == PCI_CAP_ID_MSI) { |
423 | if (pdn->force_32bit_msi) { | 423 | if (pdev->no_64bit_msi) { |
424 | rc = rtas_change_msi(pdn, RTAS_CHANGE_32MSI_FN, nvec); | 424 | rc = rtas_change_msi(pdn, RTAS_CHANGE_32MSI_FN, nvec); |
425 | if (rc < 0) { | 425 | if (rc < 0) { |
426 | /* | 426 | /* |
diff --git a/arch/powerpc/sysdev/fsl_msi.c b/arch/powerpc/sysdev/fsl_msi.c index de40b48b460e..da08ed088157 100644 --- a/arch/powerpc/sysdev/fsl_msi.c +++ b/arch/powerpc/sysdev/fsl_msi.c | |||
@@ -361,7 +361,7 @@ static int fsl_msi_setup_hwirq(struct fsl_msi *msi, struct platform_device *dev, | |||
361 | cascade_data->virq = virt_msir; | 361 | cascade_data->virq = virt_msir; |
362 | msi->cascade_array[irq_index] = cascade_data; | 362 | msi->cascade_array[irq_index] = cascade_data; |
363 | 363 | ||
364 | ret = request_irq(virt_msir, fsl_msi_cascade, 0, | 364 | ret = request_irq(virt_msir, fsl_msi_cascade, IRQF_NO_THREAD, |
365 | "fsl-msi-cascade", cascade_data); | 365 | "fsl-msi-cascade", cascade_data); |
366 | if (ret) { | 366 | if (ret) { |
367 | dev_err(&dev->dev, "failed to request_irq(%d), ret = %d\n", | 367 | dev_err(&dev->dev, "failed to request_irq(%d), ret = %d\n", |
diff --git a/arch/powerpc/xmon/xmon.c b/arch/powerpc/xmon/xmon.c index b988b5addf86..c8efbb37d6e0 100644 --- a/arch/powerpc/xmon/xmon.c +++ b/arch/powerpc/xmon/xmon.c | |||
@@ -293,10 +293,10 @@ static inline void disable_surveillance(void) | |||
293 | args.token = rtas_token("set-indicator"); | 293 | args.token = rtas_token("set-indicator"); |
294 | if (args.token == RTAS_UNKNOWN_SERVICE) | 294 | if (args.token == RTAS_UNKNOWN_SERVICE) |
295 | return; | 295 | return; |
296 | args.nargs = 3; | 296 | args.nargs = cpu_to_be32(3); |
297 | args.nret = 1; | 297 | args.nret = cpu_to_be32(1); |
298 | args.rets = &args.args[3]; | 298 | args.rets = &args.args[3]; |
299 | args.args[0] = SURVEILLANCE_TOKEN; | 299 | args.args[0] = cpu_to_be32(SURVEILLANCE_TOKEN); |
300 | args.args[1] = 0; | 300 | args.args[1] = 0; |
301 | args.args[2] = 0; | 301 | args.args[2] = 0; |
302 | enter_rtas(__pa(&args)); | 302 | enter_rtas(__pa(&args)); |
diff --git a/arch/s390/kernel/nmi.c b/arch/s390/kernel/nmi.c index dd1c24ceda50..3f51cf4e8f02 100644 --- a/arch/s390/kernel/nmi.c +++ b/arch/s390/kernel/nmi.c | |||
@@ -54,12 +54,8 @@ void s390_handle_mcck(void) | |||
54 | */ | 54 | */ |
55 | local_irq_save(flags); | 55 | local_irq_save(flags); |
56 | local_mcck_disable(); | 56 | local_mcck_disable(); |
57 | /* | 57 | mcck = *this_cpu_ptr(&cpu_mcck); |
58 | * Ummm... Does this make sense at all? Copying the percpu struct | 58 | memset(this_cpu_ptr(&cpu_mcck), 0, sizeof(mcck)); |
59 | * and then zapping it one statement later? | ||
60 | */ | ||
61 | memcpy(&mcck, this_cpu_ptr(&cpu_mcck), sizeof(mcck)); | ||
62 | memset(&mcck, 0, sizeof(struct mcck_struct)); | ||
63 | clear_cpu_flag(CIF_MCCK_PENDING); | 59 | clear_cpu_flag(CIF_MCCK_PENDING); |
64 | local_mcck_enable(); | 60 | local_mcck_enable(); |
65 | local_irq_restore(flags); | 61 | local_irq_restore(flags); |
diff --git a/arch/sparc/include/asm/dma-mapping.h b/arch/sparc/include/asm/dma-mapping.h index 5b1b52a04ad6..7e064c68c5ec 100644 --- a/arch/sparc/include/asm/dma-mapping.h +++ b/arch/sparc/include/asm/dma-mapping.h | |||
@@ -12,6 +12,14 @@ int dma_supported(struct device *dev, u64 mask); | |||
12 | #define dma_alloc_noncoherent(d, s, h, f) dma_alloc_coherent(d, s, h, f) | 12 | #define dma_alloc_noncoherent(d, s, h, f) dma_alloc_coherent(d, s, h, f) |
13 | #define dma_free_noncoherent(d, s, v, h) dma_free_coherent(d, s, v, h) | 13 | #define dma_free_noncoherent(d, s, v, h) dma_free_coherent(d, s, v, h) |
14 | 14 | ||
15 | static inline void dma_cache_sync(struct device *dev, void *vaddr, size_t size, | ||
16 | enum dma_data_direction dir) | ||
17 | { | ||
18 | /* Since dma_{alloc,free}_noncoherent() allocated coherent memory, this | ||
19 | * routine can be a nop. | ||
20 | */ | ||
21 | } | ||
22 | |||
15 | extern struct dma_map_ops *dma_ops; | 23 | extern struct dma_map_ops *dma_ops; |
16 | extern struct dma_map_ops *leon_dma_ops; | 24 | extern struct dma_map_ops *leon_dma_ops; |
17 | extern struct dma_map_ops pci32_dma_ops; | 25 | extern struct dma_map_ops pci32_dma_ops; |
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index ded8a6774ac9..41a503c15862 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig | |||
@@ -144,7 +144,7 @@ config INSTRUCTION_DECODER | |||
144 | 144 | ||
145 | config PERF_EVENTS_INTEL_UNCORE | 145 | config PERF_EVENTS_INTEL_UNCORE |
146 | def_bool y | 146 | def_bool y |
147 | depends on PERF_EVENTS && SUP_SUP_INTEL && PCI | 147 | depends on PERF_EVENTS && CPU_SUP_INTEL && PCI |
148 | 148 | ||
149 | config OUTPUT_FORMAT | 149 | config OUTPUT_FORMAT |
150 | string | 150 | string |
diff --git a/arch/x86/boot/compressed/Makefile b/arch/x86/boot/compressed/Makefile index be1e07d4b596..45abc363dd3e 100644 --- a/arch/x86/boot/compressed/Makefile +++ b/arch/x86/boot/compressed/Makefile | |||
@@ -76,7 +76,7 @@ suffix-$(CONFIG_KERNEL_XZ) := xz | |||
76 | suffix-$(CONFIG_KERNEL_LZO) := lzo | 76 | suffix-$(CONFIG_KERNEL_LZO) := lzo |
77 | suffix-$(CONFIG_KERNEL_LZ4) := lz4 | 77 | suffix-$(CONFIG_KERNEL_LZ4) := lz4 |
78 | 78 | ||
79 | RUN_SIZE = $(shell objdump -h vmlinux | \ | 79 | RUN_SIZE = $(shell $(OBJDUMP) -h vmlinux | \ |
80 | perl $(srctree)/arch/x86/tools/calc_run_size.pl) | 80 | perl $(srctree)/arch/x86/tools/calc_run_size.pl) |
81 | quiet_cmd_mkpiggy = MKPIGGY $@ | 81 | quiet_cmd_mkpiggy = MKPIGGY $@ |
82 | cmd_mkpiggy = $(obj)/mkpiggy $< $(RUN_SIZE) > $@ || ( rm -f $@ ; false ) | 82 | cmd_mkpiggy = $(obj)/mkpiggy $< $(RUN_SIZE) > $@ || ( rm -f $@ ; false ) |
diff --git a/arch/x86/include/asm/page_32_types.h b/arch/x86/include/asm/page_32_types.h index f48b17df4224..3a52ee0e726d 100644 --- a/arch/x86/include/asm/page_32_types.h +++ b/arch/x86/include/asm/page_32_types.h | |||
@@ -20,7 +20,6 @@ | |||
20 | #define THREAD_SIZE_ORDER 1 | 20 | #define THREAD_SIZE_ORDER 1 |
21 | #define THREAD_SIZE (PAGE_SIZE << THREAD_SIZE_ORDER) | 21 | #define THREAD_SIZE (PAGE_SIZE << THREAD_SIZE_ORDER) |
22 | 22 | ||
23 | #define STACKFAULT_STACK 0 | ||
24 | #define DOUBLEFAULT_STACK 1 | 23 | #define DOUBLEFAULT_STACK 1 |
25 | #define NMI_STACK 0 | 24 | #define NMI_STACK 0 |
26 | #define DEBUG_STACK 0 | 25 | #define DEBUG_STACK 0 |
diff --git a/arch/x86/include/asm/page_64_types.h b/arch/x86/include/asm/page_64_types.h index 678205195ae1..75450b2c7be4 100644 --- a/arch/x86/include/asm/page_64_types.h +++ b/arch/x86/include/asm/page_64_types.h | |||
@@ -14,12 +14,11 @@ | |||
14 | #define IRQ_STACK_ORDER 2 | 14 | #define IRQ_STACK_ORDER 2 |
15 | #define IRQ_STACK_SIZE (PAGE_SIZE << IRQ_STACK_ORDER) | 15 | #define IRQ_STACK_SIZE (PAGE_SIZE << IRQ_STACK_ORDER) |
16 | 16 | ||
17 | #define STACKFAULT_STACK 1 | 17 | #define DOUBLEFAULT_STACK 1 |
18 | #define DOUBLEFAULT_STACK 2 | 18 | #define NMI_STACK 2 |
19 | #define NMI_STACK 3 | 19 | #define DEBUG_STACK 3 |
20 | #define DEBUG_STACK 4 | 20 | #define MCE_STACK 4 |
21 | #define MCE_STACK 5 | 21 | #define N_EXCEPTION_STACKS 4 /* hw limit: 7 */ |
22 | #define N_EXCEPTION_STACKS 5 /* hw limit: 7 */ | ||
23 | 22 | ||
24 | #define PUD_PAGE_SIZE (_AC(1, UL) << PUD_SHIFT) | 23 | #define PUD_PAGE_SIZE (_AC(1, UL) << PUD_SHIFT) |
25 | #define PUD_PAGE_MASK (~(PUD_PAGE_SIZE-1)) | 24 | #define PUD_PAGE_MASK (~(PUD_PAGE_SIZE-1)) |
diff --git a/arch/x86/include/asm/thread_info.h b/arch/x86/include/asm/thread_info.h index 854053889d4d..547e344a6dc6 100644 --- a/arch/x86/include/asm/thread_info.h +++ b/arch/x86/include/asm/thread_info.h | |||
@@ -141,7 +141,7 @@ struct thread_info { | |||
141 | /* Only used for 64 bit */ | 141 | /* Only used for 64 bit */ |
142 | #define _TIF_DO_NOTIFY_MASK \ | 142 | #define _TIF_DO_NOTIFY_MASK \ |
143 | (_TIF_SIGPENDING | _TIF_MCE_NOTIFY | _TIF_NOTIFY_RESUME | \ | 143 | (_TIF_SIGPENDING | _TIF_MCE_NOTIFY | _TIF_NOTIFY_RESUME | \ |
144 | _TIF_USER_RETURN_NOTIFY) | 144 | _TIF_USER_RETURN_NOTIFY | _TIF_UPROBE) |
145 | 145 | ||
146 | /* flags to check in __switch_to() */ | 146 | /* flags to check in __switch_to() */ |
147 | #define _TIF_WORK_CTXSW \ | 147 | #define _TIF_WORK_CTXSW \ |
diff --git a/arch/x86/include/asm/traps.h b/arch/x86/include/asm/traps.h index bc8352e7010a..707adc6549d8 100644 --- a/arch/x86/include/asm/traps.h +++ b/arch/x86/include/asm/traps.h | |||
@@ -39,6 +39,7 @@ asmlinkage void simd_coprocessor_error(void); | |||
39 | 39 | ||
40 | #ifdef CONFIG_TRACING | 40 | #ifdef CONFIG_TRACING |
41 | asmlinkage void trace_page_fault(void); | 41 | asmlinkage void trace_page_fault(void); |
42 | #define trace_stack_segment stack_segment | ||
42 | #define trace_divide_error divide_error | 43 | #define trace_divide_error divide_error |
43 | #define trace_bounds bounds | 44 | #define trace_bounds bounds |
44 | #define trace_invalid_op invalid_op | 45 | #define trace_invalid_op invalid_op |
diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c index 4b4f78c9ba19..cfa9b5b2c27a 100644 --- a/arch/x86/kernel/cpu/common.c +++ b/arch/x86/kernel/cpu/common.c | |||
@@ -146,6 +146,8 @@ EXPORT_PER_CPU_SYMBOL_GPL(gdt_page); | |||
146 | 146 | ||
147 | static int __init x86_xsave_setup(char *s) | 147 | static int __init x86_xsave_setup(char *s) |
148 | { | 148 | { |
149 | if (strlen(s)) | ||
150 | return 0; | ||
149 | setup_clear_cpu_cap(X86_FEATURE_XSAVE); | 151 | setup_clear_cpu_cap(X86_FEATURE_XSAVE); |
150 | setup_clear_cpu_cap(X86_FEATURE_XSAVEOPT); | 152 | setup_clear_cpu_cap(X86_FEATURE_XSAVEOPT); |
151 | setup_clear_cpu_cap(X86_FEATURE_XSAVES); | 153 | setup_clear_cpu_cap(X86_FEATURE_XSAVES); |
diff --git a/arch/x86/kernel/cpu/microcode/core.c b/arch/x86/kernel/cpu/microcode/core.c index dd9d6190b08d..08fe6e8a726e 100644 --- a/arch/x86/kernel/cpu/microcode/core.c +++ b/arch/x86/kernel/cpu/microcode/core.c | |||
@@ -465,6 +465,16 @@ static void mc_bp_resume(void) | |||
465 | 465 | ||
466 | if (uci->valid && uci->mc) | 466 | if (uci->valid && uci->mc) |
467 | microcode_ops->apply_microcode(cpu); | 467 | microcode_ops->apply_microcode(cpu); |
468 | #ifdef CONFIG_X86_64 | ||
469 | else if (!uci->mc) | ||
470 | /* | ||
471 | * We might resume and not have applied late microcode but still | ||
472 | * have a newer patch stashed from the early loader. We don't | ||
473 | * have it in uci->mc so we have to load it the same way we're | ||
474 | * applying patches early on the APs. | ||
475 | */ | ||
476 | load_ucode_ap(); | ||
477 | #endif | ||
468 | } | 478 | } |
469 | 479 | ||
470 | static struct syscore_ops mc_syscore_ops = { | 480 | static struct syscore_ops mc_syscore_ops = { |
diff --git a/arch/x86/kernel/cpu/perf_event_intel_uncore_snbep.c b/arch/x86/kernel/cpu/perf_event_intel_uncore_snbep.c index adf138eac85c..f9ed429d6e4f 100644 --- a/arch/x86/kernel/cpu/perf_event_intel_uncore_snbep.c +++ b/arch/x86/kernel/cpu/perf_event_intel_uncore_snbep.c | |||
@@ -486,14 +486,17 @@ static struct attribute_group snbep_uncore_qpi_format_group = { | |||
486 | .attrs = snbep_uncore_qpi_formats_attr, | 486 | .attrs = snbep_uncore_qpi_formats_attr, |
487 | }; | 487 | }; |
488 | 488 | ||
489 | #define SNBEP_UNCORE_MSR_OPS_COMMON_INIT() \ | 489 | #define __SNBEP_UNCORE_MSR_OPS_COMMON_INIT() \ |
490 | .init_box = snbep_uncore_msr_init_box, \ | ||
491 | .disable_box = snbep_uncore_msr_disable_box, \ | 490 | .disable_box = snbep_uncore_msr_disable_box, \ |
492 | .enable_box = snbep_uncore_msr_enable_box, \ | 491 | .enable_box = snbep_uncore_msr_enable_box, \ |
493 | .disable_event = snbep_uncore_msr_disable_event, \ | 492 | .disable_event = snbep_uncore_msr_disable_event, \ |
494 | .enable_event = snbep_uncore_msr_enable_event, \ | 493 | .enable_event = snbep_uncore_msr_enable_event, \ |
495 | .read_counter = uncore_msr_read_counter | 494 | .read_counter = uncore_msr_read_counter |
496 | 495 | ||
496 | #define SNBEP_UNCORE_MSR_OPS_COMMON_INIT() \ | ||
497 | __SNBEP_UNCORE_MSR_OPS_COMMON_INIT(), \ | ||
498 | .init_box = snbep_uncore_msr_init_box \ | ||
499 | |||
497 | static struct intel_uncore_ops snbep_uncore_msr_ops = { | 500 | static struct intel_uncore_ops snbep_uncore_msr_ops = { |
498 | SNBEP_UNCORE_MSR_OPS_COMMON_INIT(), | 501 | SNBEP_UNCORE_MSR_OPS_COMMON_INIT(), |
499 | }; | 502 | }; |
@@ -1919,6 +1922,30 @@ static struct intel_uncore_type hswep_uncore_cbox = { | |||
1919 | .format_group = &hswep_uncore_cbox_format_group, | 1922 | .format_group = &hswep_uncore_cbox_format_group, |
1920 | }; | 1923 | }; |
1921 | 1924 | ||
1925 | /* | ||
1926 | * Write SBOX Initialization register bit by bit to avoid spurious #GPs | ||
1927 | */ | ||
1928 | static void hswep_uncore_sbox_msr_init_box(struct intel_uncore_box *box) | ||
1929 | { | ||
1930 | unsigned msr = uncore_msr_box_ctl(box); | ||
1931 | |||
1932 | if (msr) { | ||
1933 | u64 init = SNBEP_PMON_BOX_CTL_INT; | ||
1934 | u64 flags = 0; | ||
1935 | int i; | ||
1936 | |||
1937 | for_each_set_bit(i, (unsigned long *)&init, 64) { | ||
1938 | flags |= (1ULL << i); | ||
1939 | wrmsrl(msr, flags); | ||
1940 | } | ||
1941 | } | ||
1942 | } | ||
1943 | |||
1944 | static struct intel_uncore_ops hswep_uncore_sbox_msr_ops = { | ||
1945 | __SNBEP_UNCORE_MSR_OPS_COMMON_INIT(), | ||
1946 | .init_box = hswep_uncore_sbox_msr_init_box | ||
1947 | }; | ||
1948 | |||
1922 | static struct attribute *hswep_uncore_sbox_formats_attr[] = { | 1949 | static struct attribute *hswep_uncore_sbox_formats_attr[] = { |
1923 | &format_attr_event.attr, | 1950 | &format_attr_event.attr, |
1924 | &format_attr_umask.attr, | 1951 | &format_attr_umask.attr, |
@@ -1944,7 +1971,7 @@ static struct intel_uncore_type hswep_uncore_sbox = { | |||
1944 | .event_mask = HSWEP_S_MSR_PMON_RAW_EVENT_MASK, | 1971 | .event_mask = HSWEP_S_MSR_PMON_RAW_EVENT_MASK, |
1945 | .box_ctl = HSWEP_S0_MSR_PMON_BOX_CTL, | 1972 | .box_ctl = HSWEP_S0_MSR_PMON_BOX_CTL, |
1946 | .msr_offset = HSWEP_SBOX_MSR_OFFSET, | 1973 | .msr_offset = HSWEP_SBOX_MSR_OFFSET, |
1947 | .ops = &snbep_uncore_msr_ops, | 1974 | .ops = &hswep_uncore_sbox_msr_ops, |
1948 | .format_group = &hswep_uncore_sbox_format_group, | 1975 | .format_group = &hswep_uncore_sbox_format_group, |
1949 | }; | 1976 | }; |
1950 | 1977 | ||
@@ -2025,13 +2052,27 @@ static struct intel_uncore_type hswep_uncore_imc = { | |||
2025 | SNBEP_UNCORE_PCI_COMMON_INIT(), | 2052 | SNBEP_UNCORE_PCI_COMMON_INIT(), |
2026 | }; | 2053 | }; |
2027 | 2054 | ||
2055 | static unsigned hswep_uncore_irp_ctrs[] = {0xa0, 0xa8, 0xb0, 0xb8}; | ||
2056 | |||
2057 | static u64 hswep_uncore_irp_read_counter(struct intel_uncore_box *box, struct perf_event *event) | ||
2058 | { | ||
2059 | struct pci_dev *pdev = box->pci_dev; | ||
2060 | struct hw_perf_event *hwc = &event->hw; | ||
2061 | u64 count = 0; | ||
2062 | |||
2063 | pci_read_config_dword(pdev, hswep_uncore_irp_ctrs[hwc->idx], (u32 *)&count); | ||
2064 | pci_read_config_dword(pdev, hswep_uncore_irp_ctrs[hwc->idx] + 4, (u32 *)&count + 1); | ||
2065 | |||
2066 | return count; | ||
2067 | } | ||
2068 | |||
2028 | static struct intel_uncore_ops hswep_uncore_irp_ops = { | 2069 | static struct intel_uncore_ops hswep_uncore_irp_ops = { |
2029 | .init_box = snbep_uncore_pci_init_box, | 2070 | .init_box = snbep_uncore_pci_init_box, |
2030 | .disable_box = snbep_uncore_pci_disable_box, | 2071 | .disable_box = snbep_uncore_pci_disable_box, |
2031 | .enable_box = snbep_uncore_pci_enable_box, | 2072 | .enable_box = snbep_uncore_pci_enable_box, |
2032 | .disable_event = ivbep_uncore_irp_disable_event, | 2073 | .disable_event = ivbep_uncore_irp_disable_event, |
2033 | .enable_event = ivbep_uncore_irp_enable_event, | 2074 | .enable_event = ivbep_uncore_irp_enable_event, |
2034 | .read_counter = ivbep_uncore_irp_read_counter, | 2075 | .read_counter = hswep_uncore_irp_read_counter, |
2035 | }; | 2076 | }; |
2036 | 2077 | ||
2037 | static struct intel_uncore_type hswep_uncore_irp = { | 2078 | static struct intel_uncore_type hswep_uncore_irp = { |
diff --git a/arch/x86/kernel/dumpstack_64.c b/arch/x86/kernel/dumpstack_64.c index 1abcb50b48ae..ff86f19b5758 100644 --- a/arch/x86/kernel/dumpstack_64.c +++ b/arch/x86/kernel/dumpstack_64.c | |||
@@ -24,7 +24,6 @@ static char x86_stack_ids[][8] = { | |||
24 | [ DEBUG_STACK-1 ] = "#DB", | 24 | [ DEBUG_STACK-1 ] = "#DB", |
25 | [ NMI_STACK-1 ] = "NMI", | 25 | [ NMI_STACK-1 ] = "NMI", |
26 | [ DOUBLEFAULT_STACK-1 ] = "#DF", | 26 | [ DOUBLEFAULT_STACK-1 ] = "#DF", |
27 | [ STACKFAULT_STACK-1 ] = "#SS", | ||
28 | [ MCE_STACK-1 ] = "#MC", | 27 | [ MCE_STACK-1 ] = "#MC", |
29 | #if DEBUG_STKSZ > EXCEPTION_STKSZ | 28 | #if DEBUG_STKSZ > EXCEPTION_STKSZ |
30 | [ N_EXCEPTION_STACKS ... | 29 | [ N_EXCEPTION_STACKS ... |
diff --git a/arch/x86/kernel/entry_64.S b/arch/x86/kernel/entry_64.S index df088bb03fb3..c0226ab54106 100644 --- a/arch/x86/kernel/entry_64.S +++ b/arch/x86/kernel/entry_64.S | |||
@@ -828,9 +828,15 @@ ENTRY(native_iret) | |||
828 | jnz native_irq_return_ldt | 828 | jnz native_irq_return_ldt |
829 | #endif | 829 | #endif |
830 | 830 | ||
831 | .global native_irq_return_iret | ||
831 | native_irq_return_iret: | 832 | native_irq_return_iret: |
833 | /* | ||
834 | * This may fault. Non-paranoid faults on return to userspace are | ||
835 | * handled by fixup_bad_iret. These include #SS, #GP, and #NP. | ||
836 | * Double-faults due to espfix64 are handled in do_double_fault. | ||
837 | * Other faults here are fatal. | ||
838 | */ | ||
832 | iretq | 839 | iretq |
833 | _ASM_EXTABLE(native_irq_return_iret, bad_iret) | ||
834 | 840 | ||
835 | #ifdef CONFIG_X86_ESPFIX64 | 841 | #ifdef CONFIG_X86_ESPFIX64 |
836 | native_irq_return_ldt: | 842 | native_irq_return_ldt: |
@@ -858,25 +864,6 @@ native_irq_return_ldt: | |||
858 | jmp native_irq_return_iret | 864 | jmp native_irq_return_iret |
859 | #endif | 865 | #endif |
860 | 866 | ||
861 | .section .fixup,"ax" | ||
862 | bad_iret: | ||
863 | /* | ||
864 | * The iret traps when the %cs or %ss being restored is bogus. | ||
865 | * We've lost the original trap vector and error code. | ||
866 | * #GPF is the most likely one to get for an invalid selector. | ||
867 | * So pretend we completed the iret and took the #GPF in user mode. | ||
868 | * | ||
869 | * We are now running with the kernel GS after exception recovery. | ||
870 | * But error_entry expects us to have user GS to match the user %cs, | ||
871 | * so swap back. | ||
872 | */ | ||
873 | pushq $0 | ||
874 | |||
875 | SWAPGS | ||
876 | jmp general_protection | ||
877 | |||
878 | .previous | ||
879 | |||
880 | /* edi: workmask, edx: work */ | 867 | /* edi: workmask, edx: work */ |
881 | retint_careful: | 868 | retint_careful: |
882 | CFI_RESTORE_STATE | 869 | CFI_RESTORE_STATE |
@@ -922,37 +909,6 @@ ENTRY(retint_kernel) | |||
922 | CFI_ENDPROC | 909 | CFI_ENDPROC |
923 | END(common_interrupt) | 910 | END(common_interrupt) |
924 | 911 | ||
925 | /* | ||
926 | * If IRET takes a fault on the espfix stack, then we | ||
927 | * end up promoting it to a doublefault. In that case, | ||
928 | * modify the stack to make it look like we just entered | ||
929 | * the #GP handler from user space, similar to bad_iret. | ||
930 | */ | ||
931 | #ifdef CONFIG_X86_ESPFIX64 | ||
932 | ALIGN | ||
933 | __do_double_fault: | ||
934 | XCPT_FRAME 1 RDI+8 | ||
935 | movq RSP(%rdi),%rax /* Trap on the espfix stack? */ | ||
936 | sarq $PGDIR_SHIFT,%rax | ||
937 | cmpl $ESPFIX_PGD_ENTRY,%eax | ||
938 | jne do_double_fault /* No, just deliver the fault */ | ||
939 | cmpl $__KERNEL_CS,CS(%rdi) | ||
940 | jne do_double_fault | ||
941 | movq RIP(%rdi),%rax | ||
942 | cmpq $native_irq_return_iret,%rax | ||
943 | jne do_double_fault /* This shouldn't happen... */ | ||
944 | movq PER_CPU_VAR(kernel_stack),%rax | ||
945 | subq $(6*8-KERNEL_STACK_OFFSET),%rax /* Reset to original stack */ | ||
946 | movq %rax,RSP(%rdi) | ||
947 | movq $0,(%rax) /* Missing (lost) #GP error code */ | ||
948 | movq $general_protection,RIP(%rdi) | ||
949 | retq | ||
950 | CFI_ENDPROC | ||
951 | END(__do_double_fault) | ||
952 | #else | ||
953 | # define __do_double_fault do_double_fault | ||
954 | #endif | ||
955 | |||
956 | /* | 912 | /* |
957 | * APIC interrupts. | 913 | * APIC interrupts. |
958 | */ | 914 | */ |
@@ -1124,7 +1080,7 @@ idtentry overflow do_overflow has_error_code=0 | |||
1124 | idtentry bounds do_bounds has_error_code=0 | 1080 | idtentry bounds do_bounds has_error_code=0 |
1125 | idtentry invalid_op do_invalid_op has_error_code=0 | 1081 | idtentry invalid_op do_invalid_op has_error_code=0 |
1126 | idtentry device_not_available do_device_not_available has_error_code=0 | 1082 | idtentry device_not_available do_device_not_available has_error_code=0 |
1127 | idtentry double_fault __do_double_fault has_error_code=1 paranoid=1 | 1083 | idtentry double_fault do_double_fault has_error_code=1 paranoid=1 |
1128 | idtentry coprocessor_segment_overrun do_coprocessor_segment_overrun has_error_code=0 | 1084 | idtentry coprocessor_segment_overrun do_coprocessor_segment_overrun has_error_code=0 |
1129 | idtentry invalid_TSS do_invalid_TSS has_error_code=1 | 1085 | idtentry invalid_TSS do_invalid_TSS has_error_code=1 |
1130 | idtentry segment_not_present do_segment_not_present has_error_code=1 | 1086 | idtentry segment_not_present do_segment_not_present has_error_code=1 |
@@ -1289,7 +1245,7 @@ apicinterrupt3 HYPERVISOR_CALLBACK_VECTOR \ | |||
1289 | 1245 | ||
1290 | idtentry debug do_debug has_error_code=0 paranoid=1 shift_ist=DEBUG_STACK | 1246 | idtentry debug do_debug has_error_code=0 paranoid=1 shift_ist=DEBUG_STACK |
1291 | idtentry int3 do_int3 has_error_code=0 paranoid=1 shift_ist=DEBUG_STACK | 1247 | idtentry int3 do_int3 has_error_code=0 paranoid=1 shift_ist=DEBUG_STACK |
1292 | idtentry stack_segment do_stack_segment has_error_code=1 paranoid=1 | 1248 | idtentry stack_segment do_stack_segment has_error_code=1 |
1293 | #ifdef CONFIG_XEN | 1249 | #ifdef CONFIG_XEN |
1294 | idtentry xen_debug do_debug has_error_code=0 | 1250 | idtentry xen_debug do_debug has_error_code=0 |
1295 | idtentry xen_int3 do_int3 has_error_code=0 | 1251 | idtentry xen_int3 do_int3 has_error_code=0 |
@@ -1399,17 +1355,16 @@ error_sti: | |||
1399 | 1355 | ||
1400 | /* | 1356 | /* |
1401 | * There are two places in the kernel that can potentially fault with | 1357 | * There are two places in the kernel that can potentially fault with |
1402 | * usergs. Handle them here. The exception handlers after iret run with | 1358 | * usergs. Handle them here. B stepping K8s sometimes report a |
1403 | * kernel gs again, so don't set the user space flag. B stepping K8s | 1359 | * truncated RIP for IRET exceptions returning to compat mode. Check |
1404 | * sometimes report an truncated RIP for IRET exceptions returning to | 1360 | * for these here too. |
1405 | * compat mode. Check for these here too. | ||
1406 | */ | 1361 | */ |
1407 | error_kernelspace: | 1362 | error_kernelspace: |
1408 | CFI_REL_OFFSET rcx, RCX+8 | 1363 | CFI_REL_OFFSET rcx, RCX+8 |
1409 | incl %ebx | 1364 | incl %ebx |
1410 | leaq native_irq_return_iret(%rip),%rcx | 1365 | leaq native_irq_return_iret(%rip),%rcx |
1411 | cmpq %rcx,RIP+8(%rsp) | 1366 | cmpq %rcx,RIP+8(%rsp) |
1412 | je error_swapgs | 1367 | je error_bad_iret |
1413 | movl %ecx,%eax /* zero extend */ | 1368 | movl %ecx,%eax /* zero extend */ |
1414 | cmpq %rax,RIP+8(%rsp) | 1369 | cmpq %rax,RIP+8(%rsp) |
1415 | je bstep_iret | 1370 | je bstep_iret |
@@ -1420,7 +1375,15 @@ error_kernelspace: | |||
1420 | bstep_iret: | 1375 | bstep_iret: |
1421 | /* Fix truncated RIP */ | 1376 | /* Fix truncated RIP */ |
1422 | movq %rcx,RIP+8(%rsp) | 1377 | movq %rcx,RIP+8(%rsp) |
1423 | jmp error_swapgs | 1378 | /* fall through */ |
1379 | |||
1380 | error_bad_iret: | ||
1381 | SWAPGS | ||
1382 | mov %rsp,%rdi | ||
1383 | call fixup_bad_iret | ||
1384 | mov %rax,%rsp | ||
1385 | decl %ebx /* Return to usergs */ | ||
1386 | jmp error_sti | ||
1424 | CFI_ENDPROC | 1387 | CFI_ENDPROC |
1425 | END(error_entry) | 1388 | END(error_entry) |
1426 | 1389 | ||
diff --git a/arch/x86/kernel/ptrace.c b/arch/x86/kernel/ptrace.c index 749b0e423419..e510618b2e91 100644 --- a/arch/x86/kernel/ptrace.c +++ b/arch/x86/kernel/ptrace.c | |||
@@ -1484,7 +1484,7 @@ unsigned long syscall_trace_enter_phase1(struct pt_regs *regs, u32 arch) | |||
1484 | */ | 1484 | */ |
1485 | if (work & _TIF_NOHZ) { | 1485 | if (work & _TIF_NOHZ) { |
1486 | user_exit(); | 1486 | user_exit(); |
1487 | work &= ~TIF_NOHZ; | 1487 | work &= ~_TIF_NOHZ; |
1488 | } | 1488 | } |
1489 | 1489 | ||
1490 | #ifdef CONFIG_SECCOMP | 1490 | #ifdef CONFIG_SECCOMP |
diff --git a/arch/x86/kernel/traps.c b/arch/x86/kernel/traps.c index 0d0e922fafc1..de801f22128a 100644 --- a/arch/x86/kernel/traps.c +++ b/arch/x86/kernel/traps.c | |||
@@ -233,32 +233,40 @@ DO_ERROR(X86_TRAP_UD, SIGILL, "invalid opcode", invalid_op) | |||
233 | DO_ERROR(X86_TRAP_OLD_MF, SIGFPE, "coprocessor segment overrun",coprocessor_segment_overrun) | 233 | DO_ERROR(X86_TRAP_OLD_MF, SIGFPE, "coprocessor segment overrun",coprocessor_segment_overrun) |
234 | DO_ERROR(X86_TRAP_TS, SIGSEGV, "invalid TSS", invalid_TSS) | 234 | DO_ERROR(X86_TRAP_TS, SIGSEGV, "invalid TSS", invalid_TSS) |
235 | DO_ERROR(X86_TRAP_NP, SIGBUS, "segment not present", segment_not_present) | 235 | DO_ERROR(X86_TRAP_NP, SIGBUS, "segment not present", segment_not_present) |
236 | #ifdef CONFIG_X86_32 | ||
237 | DO_ERROR(X86_TRAP_SS, SIGBUS, "stack segment", stack_segment) | 236 | DO_ERROR(X86_TRAP_SS, SIGBUS, "stack segment", stack_segment) |
238 | #endif | ||
239 | DO_ERROR(X86_TRAP_AC, SIGBUS, "alignment check", alignment_check) | 237 | DO_ERROR(X86_TRAP_AC, SIGBUS, "alignment check", alignment_check) |
240 | 238 | ||
241 | #ifdef CONFIG_X86_64 | 239 | #ifdef CONFIG_X86_64 |
242 | /* Runs on IST stack */ | 240 | /* Runs on IST stack */ |
243 | dotraplinkage void do_stack_segment(struct pt_regs *regs, long error_code) | ||
244 | { | ||
245 | enum ctx_state prev_state; | ||
246 | |||
247 | prev_state = exception_enter(); | ||
248 | if (notify_die(DIE_TRAP, "stack segment", regs, error_code, | ||
249 | X86_TRAP_SS, SIGBUS) != NOTIFY_STOP) { | ||
250 | preempt_conditional_sti(regs); | ||
251 | do_trap(X86_TRAP_SS, SIGBUS, "stack segment", regs, error_code, NULL); | ||
252 | preempt_conditional_cli(regs); | ||
253 | } | ||
254 | exception_exit(prev_state); | ||
255 | } | ||
256 | |||
257 | dotraplinkage void do_double_fault(struct pt_regs *regs, long error_code) | 241 | dotraplinkage void do_double_fault(struct pt_regs *regs, long error_code) |
258 | { | 242 | { |
259 | static const char str[] = "double fault"; | 243 | static const char str[] = "double fault"; |
260 | struct task_struct *tsk = current; | 244 | struct task_struct *tsk = current; |
261 | 245 | ||
246 | #ifdef CONFIG_X86_ESPFIX64 | ||
247 | extern unsigned char native_irq_return_iret[]; | ||
248 | |||
249 | /* | ||
250 | * If IRET takes a non-IST fault on the espfix64 stack, then we | ||
251 | * end up promoting it to a doublefault. In that case, modify | ||
252 | * the stack to make it look like we just entered the #GP | ||
253 | * handler from user space, similar to bad_iret. | ||
254 | */ | ||
255 | if (((long)regs->sp >> PGDIR_SHIFT) == ESPFIX_PGD_ENTRY && | ||
256 | regs->cs == __KERNEL_CS && | ||
257 | regs->ip == (unsigned long)native_irq_return_iret) | ||
258 | { | ||
259 | struct pt_regs *normal_regs = task_pt_regs(current); | ||
260 | |||
261 | /* Fake a #GP(0) from userspace. */ | ||
262 | memmove(&normal_regs->ip, (void *)regs->sp, 5*8); | ||
263 | normal_regs->orig_ax = 0; /* Missing (lost) #GP error code */ | ||
264 | regs->ip = (unsigned long)general_protection; | ||
265 | regs->sp = (unsigned long)&normal_regs->orig_ax; | ||
266 | return; | ||
267 | } | ||
268 | #endif | ||
269 | |||
262 | exception_enter(); | 270 | exception_enter(); |
263 | /* Return not checked because double check cannot be ignored */ | 271 | /* Return not checked because double check cannot be ignored */ |
264 | notify_die(DIE_TRAP, str, regs, error_code, X86_TRAP_DF, SIGSEGV); | 272 | notify_die(DIE_TRAP, str, regs, error_code, X86_TRAP_DF, SIGSEGV); |
@@ -399,6 +407,35 @@ asmlinkage __visible struct pt_regs *sync_regs(struct pt_regs *eregs) | |||
399 | return regs; | 407 | return regs; |
400 | } | 408 | } |
401 | NOKPROBE_SYMBOL(sync_regs); | 409 | NOKPROBE_SYMBOL(sync_regs); |
410 | |||
411 | struct bad_iret_stack { | ||
412 | void *error_entry_ret; | ||
413 | struct pt_regs regs; | ||
414 | }; | ||
415 | |||
416 | asmlinkage __visible | ||
417 | struct bad_iret_stack *fixup_bad_iret(struct bad_iret_stack *s) | ||
418 | { | ||
419 | /* | ||
420 | * This is called from entry_64.S early in handling a fault | ||
421 | * caused by a bad iret to user mode. To handle the fault | ||
422 | * correctly, we want move our stack frame to task_pt_regs | ||
423 | * and we want to pretend that the exception came from the | ||
424 | * iret target. | ||
425 | */ | ||
426 | struct bad_iret_stack *new_stack = | ||
427 | container_of(task_pt_regs(current), | ||
428 | struct bad_iret_stack, regs); | ||
429 | |||
430 | /* Copy the IRET target to the new stack. */ | ||
431 | memmove(&new_stack->regs.ip, (void *)s->regs.sp, 5*8); | ||
432 | |||
433 | /* Copy the remainder of the stack from the current stack. */ | ||
434 | memmove(new_stack, s, offsetof(struct bad_iret_stack, regs.ip)); | ||
435 | |||
436 | BUG_ON(!user_mode_vm(&new_stack->regs)); | ||
437 | return new_stack; | ||
438 | } | ||
402 | #endif | 439 | #endif |
403 | 440 | ||
404 | /* | 441 | /* |
@@ -778,7 +815,7 @@ void __init trap_init(void) | |||
778 | set_intr_gate(X86_TRAP_OLD_MF, coprocessor_segment_overrun); | 815 | set_intr_gate(X86_TRAP_OLD_MF, coprocessor_segment_overrun); |
779 | set_intr_gate(X86_TRAP_TS, invalid_TSS); | 816 | set_intr_gate(X86_TRAP_TS, invalid_TSS); |
780 | set_intr_gate(X86_TRAP_NP, segment_not_present); | 817 | set_intr_gate(X86_TRAP_NP, segment_not_present); |
781 | set_intr_gate_ist(X86_TRAP_SS, &stack_segment, STACKFAULT_STACK); | 818 | set_intr_gate(X86_TRAP_SS, stack_segment); |
782 | set_intr_gate(X86_TRAP_GP, general_protection); | 819 | set_intr_gate(X86_TRAP_GP, general_protection); |
783 | set_intr_gate(X86_TRAP_SPURIOUS, spurious_interrupt_bug); | 820 | set_intr_gate(X86_TRAP_SPURIOUS, spurious_interrupt_bug); |
784 | set_intr_gate(X86_TRAP_MF, coprocessor_error); | 821 | set_intr_gate(X86_TRAP_MF, coprocessor_error); |
diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c index ac1c4de3a484..978f402006ee 100644 --- a/arch/x86/kvm/mmu.c +++ b/arch/x86/kvm/mmu.c | |||
@@ -630,7 +630,7 @@ static int mmu_spte_clear_track_bits(u64 *sptep) | |||
630 | * kvm mmu, before reclaiming the page, we should | 630 | * kvm mmu, before reclaiming the page, we should |
631 | * unmap it from mmu first. | 631 | * unmap it from mmu first. |
632 | */ | 632 | */ |
633 | WARN_ON(!kvm_is_mmio_pfn(pfn) && !page_count(pfn_to_page(pfn))); | 633 | WARN_ON(!kvm_is_reserved_pfn(pfn) && !page_count(pfn_to_page(pfn))); |
634 | 634 | ||
635 | if (!shadow_accessed_mask || old_spte & shadow_accessed_mask) | 635 | if (!shadow_accessed_mask || old_spte & shadow_accessed_mask) |
636 | kvm_set_pfn_accessed(pfn); | 636 | kvm_set_pfn_accessed(pfn); |
@@ -2461,7 +2461,7 @@ static int set_spte(struct kvm_vcpu *vcpu, u64 *sptep, | |||
2461 | spte |= PT_PAGE_SIZE_MASK; | 2461 | spte |= PT_PAGE_SIZE_MASK; |
2462 | if (tdp_enabled) | 2462 | if (tdp_enabled) |
2463 | spte |= kvm_x86_ops->get_mt_mask(vcpu, gfn, | 2463 | spte |= kvm_x86_ops->get_mt_mask(vcpu, gfn, |
2464 | kvm_is_mmio_pfn(pfn)); | 2464 | kvm_is_reserved_pfn(pfn)); |
2465 | 2465 | ||
2466 | if (host_writable) | 2466 | if (host_writable) |
2467 | spte |= SPTE_HOST_WRITEABLE; | 2467 | spte |= SPTE_HOST_WRITEABLE; |
@@ -2737,7 +2737,7 @@ static void transparent_hugepage_adjust(struct kvm_vcpu *vcpu, | |||
2737 | * PT_PAGE_TABLE_LEVEL and there would be no adjustment done | 2737 | * PT_PAGE_TABLE_LEVEL and there would be no adjustment done |
2738 | * here. | 2738 | * here. |
2739 | */ | 2739 | */ |
2740 | if (!is_error_noslot_pfn(pfn) && !kvm_is_mmio_pfn(pfn) && | 2740 | if (!is_error_noslot_pfn(pfn) && !kvm_is_reserved_pfn(pfn) && |
2741 | level == PT_PAGE_TABLE_LEVEL && | 2741 | level == PT_PAGE_TABLE_LEVEL && |
2742 | PageTransCompound(pfn_to_page(pfn)) && | 2742 | PageTransCompound(pfn_to_page(pfn)) && |
2743 | !has_wrprotected_page(vcpu->kvm, gfn, PT_DIRECTORY_LEVEL)) { | 2743 | !has_wrprotected_page(vcpu->kvm, gfn, PT_DIRECTORY_LEVEL)) { |
diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c index 4cb8763868fc..4e5dfec750fc 100644 --- a/arch/x86/mm/init_64.c +++ b/arch/x86/mm/init_64.c | |||
@@ -1123,7 +1123,7 @@ void mark_rodata_ro(void) | |||
1123 | unsigned long end = (unsigned long) &__end_rodata_hpage_align; | 1123 | unsigned long end = (unsigned long) &__end_rodata_hpage_align; |
1124 | unsigned long text_end = PFN_ALIGN(&__stop___ex_table); | 1124 | unsigned long text_end = PFN_ALIGN(&__stop___ex_table); |
1125 | unsigned long rodata_end = PFN_ALIGN(&__end_rodata); | 1125 | unsigned long rodata_end = PFN_ALIGN(&__end_rodata); |
1126 | unsigned long all_end = PFN_ALIGN(&_end); | 1126 | unsigned long all_end; |
1127 | 1127 | ||
1128 | printk(KERN_INFO "Write protecting the kernel read-only data: %luk\n", | 1128 | printk(KERN_INFO "Write protecting the kernel read-only data: %luk\n", |
1129 | (end - start) >> 10); | 1129 | (end - start) >> 10); |
@@ -1134,7 +1134,16 @@ void mark_rodata_ro(void) | |||
1134 | /* | 1134 | /* |
1135 | * The rodata/data/bss/brk section (but not the kernel text!) | 1135 | * The rodata/data/bss/brk section (but not the kernel text!) |
1136 | * should also be not-executable. | 1136 | * should also be not-executable. |
1137 | * | ||
1138 | * We align all_end to PMD_SIZE because the existing mapping | ||
1139 | * is a full PMD. If we would align _brk_end to PAGE_SIZE we | ||
1140 | * split the PMD and the reminder between _brk_end and the end | ||
1141 | * of the PMD will remain mapped executable. | ||
1142 | * | ||
1143 | * Any PMD which was setup after the one which covers _brk_end | ||
1144 | * has been zapped already via cleanup_highmem(). | ||
1137 | */ | 1145 | */ |
1146 | all_end = roundup((unsigned long)_brk_end, PMD_SIZE); | ||
1138 | set_memory_nx(rodata_start, (all_end - rodata_start) >> PAGE_SHIFT); | 1147 | set_memory_nx(rodata_start, (all_end - rodata_start) >> PAGE_SHIFT); |
1139 | 1148 | ||
1140 | rodata_test(); | 1149 | rodata_test(); |
diff --git a/arch/x86/tools/calc_run_size.pl b/arch/x86/tools/calc_run_size.pl index 0b0b124d3ece..23210baade2d 100644 --- a/arch/x86/tools/calc_run_size.pl +++ b/arch/x86/tools/calc_run_size.pl | |||
@@ -19,7 +19,16 @@ while (<>) { | |||
19 | if ($file_offset == 0) { | 19 | if ($file_offset == 0) { |
20 | $file_offset = $offset; | 20 | $file_offset = $offset; |
21 | } elsif ($file_offset != $offset) { | 21 | } elsif ($file_offset != $offset) { |
22 | die ".bss and .brk lack common file offset\n"; | 22 | # BFD linker shows the same file offset in ELF. |
23 | # Gold linker shows them as consecutive. | ||
24 | next if ($file_offset + $mem_size == $offset + $size); | ||
25 | |||
26 | printf STDERR "file_offset: 0x%lx\n", $file_offset; | ||
27 | printf STDERR "mem_size: 0x%lx\n", $mem_size; | ||
28 | printf STDERR "offset: 0x%lx\n", $offset; | ||
29 | printf STDERR "size: 0x%lx\n", $size; | ||
30 | |||
31 | die ".bss and .brk are non-contiguous\n"; | ||
23 | } | 32 | } |
24 | } | 33 | } |
25 | } | 34 | } |
diff --git a/block/bio-integrity.c b/block/bio-integrity.c index 0984232e429f..5cbd5d9ea61d 100644 --- a/block/bio-integrity.c +++ b/block/bio-integrity.c | |||
@@ -216,9 +216,10 @@ static int bio_integrity_process(struct bio *bio, | |||
216 | { | 216 | { |
217 | struct blk_integrity *bi = bdev_get_integrity(bio->bi_bdev); | 217 | struct blk_integrity *bi = bdev_get_integrity(bio->bi_bdev); |
218 | struct blk_integrity_iter iter; | 218 | struct blk_integrity_iter iter; |
219 | struct bio_vec *bv; | 219 | struct bvec_iter bviter; |
220 | struct bio_vec bv; | ||
220 | struct bio_integrity_payload *bip = bio_integrity(bio); | 221 | struct bio_integrity_payload *bip = bio_integrity(bio); |
221 | unsigned int i, ret = 0; | 222 | unsigned int ret = 0; |
222 | void *prot_buf = page_address(bip->bip_vec->bv_page) + | 223 | void *prot_buf = page_address(bip->bip_vec->bv_page) + |
223 | bip->bip_vec->bv_offset; | 224 | bip->bip_vec->bv_offset; |
224 | 225 | ||
@@ -227,11 +228,11 @@ static int bio_integrity_process(struct bio *bio, | |||
227 | iter.seed = bip_get_seed(bip); | 228 | iter.seed = bip_get_seed(bip); |
228 | iter.prot_buf = prot_buf; | 229 | iter.prot_buf = prot_buf; |
229 | 230 | ||
230 | bio_for_each_segment_all(bv, bio, i) { | 231 | bio_for_each_segment(bv, bio, bviter) { |
231 | void *kaddr = kmap_atomic(bv->bv_page); | 232 | void *kaddr = kmap_atomic(bv.bv_page); |
232 | 233 | ||
233 | iter.data_buf = kaddr + bv->bv_offset; | 234 | iter.data_buf = kaddr + bv.bv_offset; |
234 | iter.data_size = bv->bv_len; | 235 | iter.data_size = bv.bv_len; |
235 | 236 | ||
236 | ret = proc_fn(&iter); | 237 | ret = proc_fn(&iter); |
237 | if (ret) { | 238 | if (ret) { |
diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig index b23fe37f67c0..8951cefb0a96 100644 --- a/drivers/acpi/Kconfig +++ b/drivers/acpi/Kconfig | |||
@@ -360,15 +360,14 @@ config ACPI_BGRT | |||
360 | config ACPI_REDUCED_HARDWARE_ONLY | 360 | config ACPI_REDUCED_HARDWARE_ONLY |
361 | bool "Hardware-reduced ACPI support only" if EXPERT | 361 | bool "Hardware-reduced ACPI support only" if EXPERT |
362 | def_bool n | 362 | def_bool n |
363 | depends on ACPI | ||
364 | help | 363 | help |
365 | This config item changes the way the ACPI code is built. When this | 364 | This config item changes the way the ACPI code is built. When this |
366 | option is selected, the kernel will use a specialized version of | 365 | option is selected, the kernel will use a specialized version of |
367 | ACPICA that ONLY supports the ACPI "reduced hardware" mode. The | 366 | ACPICA that ONLY supports the ACPI "reduced hardware" mode. The |
368 | resulting kernel will be smaller but it will also be restricted to | 367 | resulting kernel will be smaller but it will also be restricted to |
369 | running in ACPI reduced hardware mode ONLY. | 368 | running in ACPI reduced hardware mode ONLY. |
370 | 369 | ||
371 | If you are unsure what to do, do not enable this option. | 370 | If you are unsure what to do, do not enable this option. |
372 | 371 | ||
373 | source "drivers/acpi/apei/Kconfig" | 372 | source "drivers/acpi/apei/Kconfig" |
374 | 373 | ||
@@ -394,4 +393,27 @@ config ACPI_EXTLOG | |||
394 | driver adds support for that functionality with corresponding | 393 | driver adds support for that functionality with corresponding |
395 | tracepoint which carries that information to userspace. | 394 | tracepoint which carries that information to userspace. |
396 | 395 | ||
396 | menuconfig PMIC_OPREGION | ||
397 | bool "PMIC (Power Management Integrated Circuit) operation region support" | ||
398 | help | ||
399 | Select this option to enable support for ACPI operation | ||
400 | region of the PMIC chip. The operation region can be used | ||
401 | to control power rails and sensor reading/writing on the | ||
402 | PMIC chip. | ||
403 | |||
404 | if PMIC_OPREGION | ||
405 | config CRC_PMIC_OPREGION | ||
406 | bool "ACPI operation region support for CrystalCove PMIC" | ||
407 | depends on INTEL_SOC_PMIC | ||
408 | help | ||
409 | This config adds ACPI operation region support for CrystalCove PMIC. | ||
410 | |||
411 | config XPOWER_PMIC_OPREGION | ||
412 | bool "ACPI operation region support for XPower AXP288 PMIC" | ||
413 | depends on AXP288_ADC = y | ||
414 | help | ||
415 | This config adds ACPI operation region support for XPower AXP288 PMIC. | ||
416 | |||
417 | endif | ||
418 | |||
397 | endif # ACPI | 419 | endif # ACPI |
diff --git a/drivers/acpi/Makefile b/drivers/acpi/Makefile index c3b2fcb729f3..f74317cc1ca9 100644 --- a/drivers/acpi/Makefile +++ b/drivers/acpi/Makefile | |||
@@ -47,6 +47,7 @@ acpi-y += int340x_thermal.o | |||
47 | acpi-y += power.o | 47 | acpi-y += power.o |
48 | acpi-y += event.o | 48 | acpi-y += event.o |
49 | acpi-y += sysfs.o | 49 | acpi-y += sysfs.o |
50 | acpi-y += property.o | ||
50 | acpi-$(CONFIG_X86) += acpi_cmos_rtc.o | 51 | acpi-$(CONFIG_X86) += acpi_cmos_rtc.o |
51 | acpi-$(CONFIG_DEBUG_FS) += debugfs.o | 52 | acpi-$(CONFIG_DEBUG_FS) += debugfs.o |
52 | acpi-$(CONFIG_ACPI_NUMA) += numa.o | 53 | acpi-$(CONFIG_ACPI_NUMA) += numa.o |
@@ -87,3 +88,7 @@ obj-$(CONFIG_ACPI_PROCESSOR_AGGREGATOR) += acpi_pad.o | |||
87 | obj-$(CONFIG_ACPI_APEI) += apei/ | 88 | obj-$(CONFIG_ACPI_APEI) += apei/ |
88 | 89 | ||
89 | obj-$(CONFIG_ACPI_EXTLOG) += acpi_extlog.o | 90 | obj-$(CONFIG_ACPI_EXTLOG) += acpi_extlog.o |
91 | |||
92 | obj-$(CONFIG_PMIC_OPREGION) += pmic/intel_pmic.o | ||
93 | obj-$(CONFIG_CRC_PMIC_OPREGION) += pmic/intel_pmic_crc.o | ||
94 | obj-$(CONFIG_XPOWER_PMIC_OPREGION) += pmic/intel_pmic_xpower.o | ||
diff --git a/drivers/acpi/acpi_lpss.c b/drivers/acpi/acpi_lpss.c index 93d160661f4c..d1dd0ada14b7 100644 --- a/drivers/acpi/acpi_lpss.c +++ b/drivers/acpi/acpi_lpss.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * ACPI support for Intel Lynxpoint LPSS. | 2 | * ACPI support for Intel Lynxpoint LPSS. |
3 | * | 3 | * |
4 | * Copyright (C) 2013, Intel Corporation | 4 | * Copyright (C) 2013, 2014, Intel Corporation |
5 | * Authors: Mika Westerberg <mika.westerberg@linux.intel.com> | 5 | * Authors: Mika Westerberg <mika.westerberg@linux.intel.com> |
6 | * Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 6 | * Rafael J. Wysocki <rafael.j.wysocki@intel.com> |
7 | * | 7 | * |
@@ -60,6 +60,8 @@ ACPI_MODULE_NAME("acpi_lpss"); | |||
60 | #define LPSS_CLK_DIVIDER BIT(2) | 60 | #define LPSS_CLK_DIVIDER BIT(2) |
61 | #define LPSS_LTR BIT(3) | 61 | #define LPSS_LTR BIT(3) |
62 | #define LPSS_SAVE_CTX BIT(4) | 62 | #define LPSS_SAVE_CTX BIT(4) |
63 | #define LPSS_DEV_PROXY BIT(5) | ||
64 | #define LPSS_PROXY_REQ BIT(6) | ||
63 | 65 | ||
64 | struct lpss_private_data; | 66 | struct lpss_private_data; |
65 | 67 | ||
@@ -70,8 +72,10 @@ struct lpss_device_desc { | |||
70 | void (*setup)(struct lpss_private_data *pdata); | 72 | void (*setup)(struct lpss_private_data *pdata); |
71 | }; | 73 | }; |
72 | 74 | ||
75 | static struct device *proxy_device; | ||
76 | |||
73 | static struct lpss_device_desc lpss_dma_desc = { | 77 | static struct lpss_device_desc lpss_dma_desc = { |
74 | .flags = LPSS_CLK, | 78 | .flags = LPSS_CLK | LPSS_PROXY_REQ, |
75 | }; | 79 | }; |
76 | 80 | ||
77 | struct lpss_private_data { | 81 | struct lpss_private_data { |
@@ -146,22 +150,24 @@ static struct lpss_device_desc byt_pwm_dev_desc = { | |||
146 | }; | 150 | }; |
147 | 151 | ||
148 | static struct lpss_device_desc byt_uart_dev_desc = { | 152 | static struct lpss_device_desc byt_uart_dev_desc = { |
149 | .flags = LPSS_CLK | LPSS_CLK_GATE | LPSS_CLK_DIVIDER | LPSS_SAVE_CTX, | 153 | .flags = LPSS_CLK | LPSS_CLK_GATE | LPSS_CLK_DIVIDER | LPSS_SAVE_CTX | |
154 | LPSS_DEV_PROXY, | ||
150 | .prv_offset = 0x800, | 155 | .prv_offset = 0x800, |
151 | .setup = lpss_uart_setup, | 156 | .setup = lpss_uart_setup, |
152 | }; | 157 | }; |
153 | 158 | ||
154 | static struct lpss_device_desc byt_spi_dev_desc = { | 159 | static struct lpss_device_desc byt_spi_dev_desc = { |
155 | .flags = LPSS_CLK | LPSS_CLK_GATE | LPSS_CLK_DIVIDER | LPSS_SAVE_CTX, | 160 | .flags = LPSS_CLK | LPSS_CLK_GATE | LPSS_CLK_DIVIDER | LPSS_SAVE_CTX | |
161 | LPSS_DEV_PROXY, | ||
156 | .prv_offset = 0x400, | 162 | .prv_offset = 0x400, |
157 | }; | 163 | }; |
158 | 164 | ||
159 | static struct lpss_device_desc byt_sdio_dev_desc = { | 165 | static struct lpss_device_desc byt_sdio_dev_desc = { |
160 | .flags = LPSS_CLK, | 166 | .flags = LPSS_CLK | LPSS_DEV_PROXY, |
161 | }; | 167 | }; |
162 | 168 | ||
163 | static struct lpss_device_desc byt_i2c_dev_desc = { | 169 | static struct lpss_device_desc byt_i2c_dev_desc = { |
164 | .flags = LPSS_CLK | LPSS_SAVE_CTX, | 170 | .flags = LPSS_CLK | LPSS_SAVE_CTX | LPSS_DEV_PROXY, |
165 | .prv_offset = 0x800, | 171 | .prv_offset = 0x800, |
166 | .setup = byt_i2c_setup, | 172 | .setup = byt_i2c_setup, |
167 | }; | 173 | }; |
@@ -368,6 +374,8 @@ static int acpi_lpss_create_device(struct acpi_device *adev, | |||
368 | adev->driver_data = pdata; | 374 | adev->driver_data = pdata; |
369 | pdev = acpi_create_platform_device(adev); | 375 | pdev = acpi_create_platform_device(adev); |
370 | if (!IS_ERR_OR_NULL(pdev)) { | 376 | if (!IS_ERR_OR_NULL(pdev)) { |
377 | if (!proxy_device && dev_desc->flags & LPSS_DEV_PROXY) | ||
378 | proxy_device = &pdev->dev; | ||
371 | return 1; | 379 | return 1; |
372 | } | 380 | } |
373 | 381 | ||
@@ -499,14 +507,15 @@ static void acpi_lpss_set_ltr(struct device *dev, s32 val) | |||
499 | /** | 507 | /** |
500 | * acpi_lpss_save_ctx() - Save the private registers of LPSS device | 508 | * acpi_lpss_save_ctx() - Save the private registers of LPSS device |
501 | * @dev: LPSS device | 509 | * @dev: LPSS device |
510 | * @pdata: pointer to the private data of the LPSS device | ||
502 | * | 511 | * |
503 | * Most LPSS devices have private registers which may loose their context when | 512 | * Most LPSS devices have private registers which may loose their context when |
504 | * the device is powered down. acpi_lpss_save_ctx() saves those registers into | 513 | * the device is powered down. acpi_lpss_save_ctx() saves those registers into |
505 | * prv_reg_ctx array. | 514 | * prv_reg_ctx array. |
506 | */ | 515 | */ |
507 | static void acpi_lpss_save_ctx(struct device *dev) | 516 | static void acpi_lpss_save_ctx(struct device *dev, |
517 | struct lpss_private_data *pdata) | ||
508 | { | 518 | { |
509 | struct lpss_private_data *pdata = acpi_driver_data(ACPI_COMPANION(dev)); | ||
510 | unsigned int i; | 519 | unsigned int i; |
511 | 520 | ||
512 | for (i = 0; i < LPSS_PRV_REG_COUNT; i++) { | 521 | for (i = 0; i < LPSS_PRV_REG_COUNT; i++) { |
@@ -521,12 +530,13 @@ static void acpi_lpss_save_ctx(struct device *dev) | |||
521 | /** | 530 | /** |
522 | * acpi_lpss_restore_ctx() - Restore the private registers of LPSS device | 531 | * acpi_lpss_restore_ctx() - Restore the private registers of LPSS device |
523 | * @dev: LPSS device | 532 | * @dev: LPSS device |
533 | * @pdata: pointer to the private data of the LPSS device | ||
524 | * | 534 | * |
525 | * Restores the registers that were previously stored with acpi_lpss_save_ctx(). | 535 | * Restores the registers that were previously stored with acpi_lpss_save_ctx(). |
526 | */ | 536 | */ |
527 | static void acpi_lpss_restore_ctx(struct device *dev) | 537 | static void acpi_lpss_restore_ctx(struct device *dev, |
538 | struct lpss_private_data *pdata) | ||
528 | { | 539 | { |
529 | struct lpss_private_data *pdata = acpi_driver_data(ACPI_COMPANION(dev)); | ||
530 | unsigned int i; | 540 | unsigned int i; |
531 | 541 | ||
532 | /* | 542 | /* |
@@ -549,23 +559,31 @@ static void acpi_lpss_restore_ctx(struct device *dev) | |||
549 | #ifdef CONFIG_PM_SLEEP | 559 | #ifdef CONFIG_PM_SLEEP |
550 | static int acpi_lpss_suspend_late(struct device *dev) | 560 | static int acpi_lpss_suspend_late(struct device *dev) |
551 | { | 561 | { |
552 | int ret = pm_generic_suspend_late(dev); | 562 | struct lpss_private_data *pdata = acpi_driver_data(ACPI_COMPANION(dev)); |
563 | int ret; | ||
553 | 564 | ||
565 | ret = pm_generic_suspend_late(dev); | ||
554 | if (ret) | 566 | if (ret) |
555 | return ret; | 567 | return ret; |
556 | 568 | ||
557 | acpi_lpss_save_ctx(dev); | 569 | if (pdata->dev_desc->flags & LPSS_SAVE_CTX) |
570 | acpi_lpss_save_ctx(dev, pdata); | ||
571 | |||
558 | return acpi_dev_suspend_late(dev); | 572 | return acpi_dev_suspend_late(dev); |
559 | } | 573 | } |
560 | 574 | ||
561 | static int acpi_lpss_resume_early(struct device *dev) | 575 | static int acpi_lpss_resume_early(struct device *dev) |
562 | { | 576 | { |
563 | int ret = acpi_dev_resume_early(dev); | 577 | struct lpss_private_data *pdata = acpi_driver_data(ACPI_COMPANION(dev)); |
578 | int ret; | ||
564 | 579 | ||
580 | ret = acpi_dev_resume_early(dev); | ||
565 | if (ret) | 581 | if (ret) |
566 | return ret; | 582 | return ret; |
567 | 583 | ||
568 | acpi_lpss_restore_ctx(dev); | 584 | if (pdata->dev_desc->flags & LPSS_SAVE_CTX) |
585 | acpi_lpss_restore_ctx(dev, pdata); | ||
586 | |||
569 | return pm_generic_resume_early(dev); | 587 | return pm_generic_resume_early(dev); |
570 | } | 588 | } |
571 | #endif /* CONFIG_PM_SLEEP */ | 589 | #endif /* CONFIG_PM_SLEEP */ |
@@ -573,23 +591,44 @@ static int acpi_lpss_resume_early(struct device *dev) | |||
573 | #ifdef CONFIG_PM_RUNTIME | 591 | #ifdef CONFIG_PM_RUNTIME |
574 | static int acpi_lpss_runtime_suspend(struct device *dev) | 592 | static int acpi_lpss_runtime_suspend(struct device *dev) |
575 | { | 593 | { |
576 | int ret = pm_generic_runtime_suspend(dev); | 594 | struct lpss_private_data *pdata = acpi_driver_data(ACPI_COMPANION(dev)); |
595 | int ret; | ||
577 | 596 | ||
597 | ret = pm_generic_runtime_suspend(dev); | ||
578 | if (ret) | 598 | if (ret) |
579 | return ret; | 599 | return ret; |
580 | 600 | ||
581 | acpi_lpss_save_ctx(dev); | 601 | if (pdata->dev_desc->flags & LPSS_SAVE_CTX) |
582 | return acpi_dev_runtime_suspend(dev); | 602 | acpi_lpss_save_ctx(dev, pdata); |
603 | |||
604 | ret = acpi_dev_runtime_suspend(dev); | ||
605 | if (ret) | ||
606 | return ret; | ||
607 | |||
608 | if (pdata->dev_desc->flags & LPSS_PROXY_REQ && proxy_device) | ||
609 | return pm_runtime_put_sync_suspend(proxy_device); | ||
610 | |||
611 | return 0; | ||
583 | } | 612 | } |
584 | 613 | ||
585 | static int acpi_lpss_runtime_resume(struct device *dev) | 614 | static int acpi_lpss_runtime_resume(struct device *dev) |
586 | { | 615 | { |
587 | int ret = acpi_dev_runtime_resume(dev); | 616 | struct lpss_private_data *pdata = acpi_driver_data(ACPI_COMPANION(dev)); |
617 | int ret; | ||
618 | |||
619 | if (pdata->dev_desc->flags & LPSS_PROXY_REQ && proxy_device) { | ||
620 | ret = pm_runtime_get_sync(proxy_device); | ||
621 | if (ret) | ||
622 | return ret; | ||
623 | } | ||
588 | 624 | ||
625 | ret = acpi_dev_runtime_resume(dev); | ||
589 | if (ret) | 626 | if (ret) |
590 | return ret; | 627 | return ret; |
591 | 628 | ||
592 | acpi_lpss_restore_ctx(dev); | 629 | if (pdata->dev_desc->flags & LPSS_SAVE_CTX) |
630 | acpi_lpss_restore_ctx(dev, pdata); | ||
631 | |||
593 | return pm_generic_runtime_resume(dev); | 632 | return pm_generic_runtime_resume(dev); |
594 | } | 633 | } |
595 | #endif /* CONFIG_PM_RUNTIME */ | 634 | #endif /* CONFIG_PM_RUNTIME */ |
@@ -631,30 +670,27 @@ static int acpi_lpss_platform_notify(struct notifier_block *nb, | |||
631 | return 0; | 670 | return 0; |
632 | 671 | ||
633 | pdata = acpi_driver_data(adev); | 672 | pdata = acpi_driver_data(adev); |
634 | if (!pdata || !pdata->mmio_base) | 673 | if (!pdata) |
635 | return 0; | 674 | return 0; |
636 | 675 | ||
637 | if (pdata->mmio_size < pdata->dev_desc->prv_offset + LPSS_LTR_SIZE) { | 676 | if (pdata->mmio_base && |
677 | pdata->mmio_size < pdata->dev_desc->prv_offset + LPSS_LTR_SIZE) { | ||
638 | dev_err(&pdev->dev, "MMIO size insufficient to access LTR\n"); | 678 | dev_err(&pdev->dev, "MMIO size insufficient to access LTR\n"); |
639 | return 0; | 679 | return 0; |
640 | } | 680 | } |
641 | 681 | ||
642 | switch (action) { | 682 | switch (action) { |
643 | case BUS_NOTIFY_BOUND_DRIVER: | ||
644 | if (pdata->dev_desc->flags & LPSS_SAVE_CTX) | ||
645 | pdev->dev.pm_domain = &acpi_lpss_pm_domain; | ||
646 | break; | ||
647 | case BUS_NOTIFY_UNBOUND_DRIVER: | ||
648 | if (pdata->dev_desc->flags & LPSS_SAVE_CTX) | ||
649 | pdev->dev.pm_domain = NULL; | ||
650 | break; | ||
651 | case BUS_NOTIFY_ADD_DEVICE: | 683 | case BUS_NOTIFY_ADD_DEVICE: |
684 | pdev->dev.pm_domain = &acpi_lpss_pm_domain; | ||
652 | if (pdata->dev_desc->flags & LPSS_LTR) | 685 | if (pdata->dev_desc->flags & LPSS_LTR) |
653 | return sysfs_create_group(&pdev->dev.kobj, | 686 | return sysfs_create_group(&pdev->dev.kobj, |
654 | &lpss_attr_group); | 687 | &lpss_attr_group); |
688 | break; | ||
655 | case BUS_NOTIFY_DEL_DEVICE: | 689 | case BUS_NOTIFY_DEL_DEVICE: |
656 | if (pdata->dev_desc->flags & LPSS_LTR) | 690 | if (pdata->dev_desc->flags & LPSS_LTR) |
657 | sysfs_remove_group(&pdev->dev.kobj, &lpss_attr_group); | 691 | sysfs_remove_group(&pdev->dev.kobj, &lpss_attr_group); |
692 | pdev->dev.pm_domain = NULL; | ||
693 | break; | ||
658 | default: | 694 | default: |
659 | break; | 695 | break; |
660 | } | 696 | } |
diff --git a/drivers/acpi/acpica/acglobal.h b/drivers/acpi/acpica/acglobal.h index ebf02cc10a43..7f60582d0c8c 100644 --- a/drivers/acpi/acpica/acglobal.h +++ b/drivers/acpi/acpica/acglobal.h | |||
@@ -305,6 +305,7 @@ ACPI_INIT_GLOBAL(u8, acpi_gbl_db_output_flags, ACPI_DB_CONSOLE_OUTPUT); | |||
305 | 305 | ||
306 | ACPI_INIT_GLOBAL(u8, acpi_gbl_no_resource_disassembly, FALSE); | 306 | ACPI_INIT_GLOBAL(u8, acpi_gbl_no_resource_disassembly, FALSE); |
307 | ACPI_INIT_GLOBAL(u8, acpi_gbl_ignore_noop_operator, FALSE); | 307 | ACPI_INIT_GLOBAL(u8, acpi_gbl_ignore_noop_operator, FALSE); |
308 | ACPI_INIT_GLOBAL(u8, acpi_gbl_cstyle_disassembly, TRUE); | ||
308 | 309 | ||
309 | ACPI_GLOBAL(u8, acpi_gbl_db_opt_disasm); | 310 | ACPI_GLOBAL(u8, acpi_gbl_db_opt_disasm); |
310 | ACPI_GLOBAL(u8, acpi_gbl_db_opt_verbose); | 311 | ACPI_GLOBAL(u8, acpi_gbl_db_opt_verbose); |
diff --git a/drivers/acpi/acpica/aclocal.h b/drivers/acpi/acpica/aclocal.h index c00e7e41ad75..680d23bbae7c 100644 --- a/drivers/acpi/acpica/aclocal.h +++ b/drivers/acpi/acpica/aclocal.h | |||
@@ -454,6 +454,7 @@ struct acpi_gpe_register_info { | |||
454 | u16 base_gpe_number; /* Base GPE number for this register */ | 454 | u16 base_gpe_number; /* Base GPE number for this register */ |
455 | u8 enable_for_wake; /* GPEs to keep enabled when sleeping */ | 455 | u8 enable_for_wake; /* GPEs to keep enabled when sleeping */ |
456 | u8 enable_for_run; /* GPEs to keep enabled when running */ | 456 | u8 enable_for_run; /* GPEs to keep enabled when running */ |
457 | u8 enable_mask; /* Current mask of enabled GPEs */ | ||
457 | }; | 458 | }; |
458 | 459 | ||
459 | /* | 460 | /* |
@@ -722,6 +723,7 @@ union acpi_parse_value { | |||
722 | ACPI_DISASM_ONLY_MEMBERS (\ | 723 | ACPI_DISASM_ONLY_MEMBERS (\ |
723 | u8 disasm_flags; /* Used during AML disassembly */\ | 724 | u8 disasm_flags; /* Used during AML disassembly */\ |
724 | u8 disasm_opcode; /* Subtype used for disassembly */\ | 725 | u8 disasm_opcode; /* Subtype used for disassembly */\ |
726 | char *operator_symbol;/* Used for C-style operator name strings */\ | ||
725 | char aml_op_name[16]) /* Op name (debug only) */ | 727 | char aml_op_name[16]) /* Op name (debug only) */ |
726 | 728 | ||
727 | /* Flags for disasm_flags field above */ | 729 | /* Flags for disasm_flags field above */ |
@@ -827,6 +829,8 @@ struct acpi_parse_state { | |||
827 | #define ACPI_PARSEOP_EMPTY_TERMLIST 0x04 | 829 | #define ACPI_PARSEOP_EMPTY_TERMLIST 0x04 |
828 | #define ACPI_PARSEOP_PREDEF_CHECKED 0x08 | 830 | #define ACPI_PARSEOP_PREDEF_CHECKED 0x08 |
829 | #define ACPI_PARSEOP_SPECIAL 0x10 | 831 | #define ACPI_PARSEOP_SPECIAL 0x10 |
832 | #define ACPI_PARSEOP_COMPOUND 0x20 | ||
833 | #define ACPI_PARSEOP_ASSIGNMENT 0x40 | ||
830 | 834 | ||
831 | /***************************************************************************** | 835 | /***************************************************************************** |
832 | * | 836 | * |
diff --git a/drivers/acpi/acpica/evgpe.c b/drivers/acpi/acpica/evgpe.c index 2095dfb72bcb..aa70154cf4fa 100644 --- a/drivers/acpi/acpica/evgpe.c +++ b/drivers/acpi/acpica/evgpe.c | |||
@@ -134,7 +134,7 @@ acpi_status acpi_ev_enable_gpe(struct acpi_gpe_event_info *gpe_event_info) | |||
134 | 134 | ||
135 | /* Enable the requested GPE */ | 135 | /* Enable the requested GPE */ |
136 | 136 | ||
137 | status = acpi_hw_low_set_gpe(gpe_event_info, ACPI_GPE_ENABLE); | 137 | status = acpi_hw_low_set_gpe(gpe_event_info, ACPI_GPE_ENABLE_SAVE); |
138 | return_ACPI_STATUS(status); | 138 | return_ACPI_STATUS(status); |
139 | } | 139 | } |
140 | 140 | ||
@@ -213,7 +213,7 @@ acpi_ev_remove_gpe_reference(struct acpi_gpe_event_info *gpe_event_info) | |||
213 | if (ACPI_SUCCESS(status)) { | 213 | if (ACPI_SUCCESS(status)) { |
214 | status = | 214 | status = |
215 | acpi_hw_low_set_gpe(gpe_event_info, | 215 | acpi_hw_low_set_gpe(gpe_event_info, |
216 | ACPI_GPE_DISABLE); | 216 | ACPI_GPE_DISABLE_SAVE); |
217 | } | 217 | } |
218 | 218 | ||
219 | if (ACPI_FAILURE(status)) { | 219 | if (ACPI_FAILURE(status)) { |
@@ -616,8 +616,11 @@ static void ACPI_SYSTEM_XFACE acpi_ev_asynch_execute_gpe_method(void *context) | |||
616 | static void ACPI_SYSTEM_XFACE acpi_ev_asynch_enable_gpe(void *context) | 616 | static void ACPI_SYSTEM_XFACE acpi_ev_asynch_enable_gpe(void *context) |
617 | { | 617 | { |
618 | struct acpi_gpe_event_info *gpe_event_info = context; | 618 | struct acpi_gpe_event_info *gpe_event_info = context; |
619 | acpi_cpu_flags flags; | ||
619 | 620 | ||
621 | flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock); | ||
620 | (void)acpi_ev_finish_gpe(gpe_event_info); | 622 | (void)acpi_ev_finish_gpe(gpe_event_info); |
623 | acpi_os_release_lock(acpi_gbl_gpe_lock, flags); | ||
621 | 624 | ||
622 | ACPI_FREE(gpe_event_info); | 625 | ACPI_FREE(gpe_event_info); |
623 | return; | 626 | return; |
@@ -655,7 +658,7 @@ acpi_status acpi_ev_finish_gpe(struct acpi_gpe_event_info * gpe_event_info) | |||
655 | 658 | ||
656 | /* | 659 | /* |
657 | * Enable this GPE, conditionally. This means that the GPE will | 660 | * Enable this GPE, conditionally. This means that the GPE will |
658 | * only be physically enabled if the enable_for_run bit is set | 661 | * only be physically enabled if the enable_mask bit is set |
659 | * in the event_info. | 662 | * in the event_info. |
660 | */ | 663 | */ |
661 | (void)acpi_hw_low_set_gpe(gpe_event_info, ACPI_GPE_CONDITIONAL_ENABLE); | 664 | (void)acpi_hw_low_set_gpe(gpe_event_info, ACPI_GPE_CONDITIONAL_ENABLE); |
diff --git a/drivers/acpi/acpica/hwgpe.c b/drivers/acpi/acpica/hwgpe.c index 48ac7b7b59cd..494027f5c067 100644 --- a/drivers/acpi/acpica/hwgpe.c +++ b/drivers/acpi/acpica/hwgpe.c | |||
@@ -115,12 +115,12 @@ acpi_hw_low_set_gpe(struct acpi_gpe_event_info *gpe_event_info, u32 action) | |||
115 | /* Set or clear just the bit that corresponds to this GPE */ | 115 | /* Set or clear just the bit that corresponds to this GPE */ |
116 | 116 | ||
117 | register_bit = acpi_hw_get_gpe_register_bit(gpe_event_info); | 117 | register_bit = acpi_hw_get_gpe_register_bit(gpe_event_info); |
118 | switch (action) { | 118 | switch (action & ~ACPI_GPE_SAVE_MASK) { |
119 | case ACPI_GPE_CONDITIONAL_ENABLE: | 119 | case ACPI_GPE_CONDITIONAL_ENABLE: |
120 | 120 | ||
121 | /* Only enable if the enable_for_run bit is set */ | 121 | /* Only enable if the corresponding enable_mask bit is set */ |
122 | 122 | ||
123 | if (!(register_bit & gpe_register_info->enable_for_run)) { | 123 | if (!(register_bit & gpe_register_info->enable_mask)) { |
124 | return (AE_BAD_PARAMETER); | 124 | return (AE_BAD_PARAMETER); |
125 | } | 125 | } |
126 | 126 | ||
@@ -145,6 +145,9 @@ acpi_hw_low_set_gpe(struct acpi_gpe_event_info *gpe_event_info, u32 action) | |||
145 | /* Write the updated enable mask */ | 145 | /* Write the updated enable mask */ |
146 | 146 | ||
147 | status = acpi_hw_write(enable_mask, &gpe_register_info->enable_address); | 147 | status = acpi_hw_write(enable_mask, &gpe_register_info->enable_address); |
148 | if (ACPI_SUCCESS(status) && (action & ACPI_GPE_SAVE_MASK)) { | ||
149 | gpe_register_info->enable_mask = enable_mask; | ||
150 | } | ||
148 | return (status); | 151 | return (status); |
149 | } | 152 | } |
150 | 153 | ||
@@ -262,6 +265,32 @@ acpi_hw_get_gpe_status(struct acpi_gpe_event_info * gpe_event_info, | |||
262 | 265 | ||
263 | /****************************************************************************** | 266 | /****************************************************************************** |
264 | * | 267 | * |
268 | * FUNCTION: acpi_hw_gpe_enable_write | ||
269 | * | ||
270 | * PARAMETERS: enable_mask - Bit mask to write to the GPE register | ||
271 | * gpe_register_info - Gpe Register info | ||
272 | * | ||
273 | * RETURN: Status | ||
274 | * | ||
275 | * DESCRIPTION: Write the enable mask byte to the given GPE register. | ||
276 | * | ||
277 | ******************************************************************************/ | ||
278 | |||
279 | static acpi_status | ||
280 | acpi_hw_gpe_enable_write(u8 enable_mask, | ||
281 | struct acpi_gpe_register_info *gpe_register_info) | ||
282 | { | ||
283 | acpi_status status; | ||
284 | |||
285 | status = acpi_hw_write(enable_mask, &gpe_register_info->enable_address); | ||
286 | if (ACPI_SUCCESS(status)) { | ||
287 | gpe_register_info->enable_mask = enable_mask; | ||
288 | } | ||
289 | return (status); | ||
290 | } | ||
291 | |||
292 | /****************************************************************************** | ||
293 | * | ||
265 | * FUNCTION: acpi_hw_disable_gpe_block | 294 | * FUNCTION: acpi_hw_disable_gpe_block |
266 | * | 295 | * |
267 | * PARAMETERS: gpe_xrupt_info - GPE Interrupt info | 296 | * PARAMETERS: gpe_xrupt_info - GPE Interrupt info |
@@ -287,8 +316,8 @@ acpi_hw_disable_gpe_block(struct acpi_gpe_xrupt_info *gpe_xrupt_info, | |||
287 | /* Disable all GPEs in this register */ | 316 | /* Disable all GPEs in this register */ |
288 | 317 | ||
289 | status = | 318 | status = |
290 | acpi_hw_write(0x00, | 319 | acpi_hw_gpe_enable_write(0x00, |
291 | &gpe_block->register_info[i].enable_address); | 320 | &gpe_block->register_info[i]); |
292 | if (ACPI_FAILURE(status)) { | 321 | if (ACPI_FAILURE(status)) { |
293 | return (status); | 322 | return (status); |
294 | } | 323 | } |
@@ -355,21 +384,23 @@ acpi_hw_enable_runtime_gpe_block(struct acpi_gpe_xrupt_info *gpe_xrupt_info, | |||
355 | { | 384 | { |
356 | u32 i; | 385 | u32 i; |
357 | acpi_status status; | 386 | acpi_status status; |
387 | struct acpi_gpe_register_info *gpe_register_info; | ||
358 | 388 | ||
359 | /* NOTE: assumes that all GPEs are currently disabled */ | 389 | /* NOTE: assumes that all GPEs are currently disabled */ |
360 | 390 | ||
361 | /* Examine each GPE Register within the block */ | 391 | /* Examine each GPE Register within the block */ |
362 | 392 | ||
363 | for (i = 0; i < gpe_block->register_count; i++) { | 393 | for (i = 0; i < gpe_block->register_count; i++) { |
364 | if (!gpe_block->register_info[i].enable_for_run) { | 394 | gpe_register_info = &gpe_block->register_info[i]; |
395 | if (!gpe_register_info->enable_for_run) { | ||
365 | continue; | 396 | continue; |
366 | } | 397 | } |
367 | 398 | ||
368 | /* Enable all "runtime" GPEs in this register */ | 399 | /* Enable all "runtime" GPEs in this register */ |
369 | 400 | ||
370 | status = | 401 | status = |
371 | acpi_hw_write(gpe_block->register_info[i].enable_for_run, | 402 | acpi_hw_gpe_enable_write(gpe_register_info->enable_for_run, |
372 | &gpe_block->register_info[i].enable_address); | 403 | gpe_register_info); |
373 | if (ACPI_FAILURE(status)) { | 404 | if (ACPI_FAILURE(status)) { |
374 | return (status); | 405 | return (status); |
375 | } | 406 | } |
@@ -399,10 +430,12 @@ acpi_hw_enable_wakeup_gpe_block(struct acpi_gpe_xrupt_info *gpe_xrupt_info, | |||
399 | { | 430 | { |
400 | u32 i; | 431 | u32 i; |
401 | acpi_status status; | 432 | acpi_status status; |
433 | struct acpi_gpe_register_info *gpe_register_info; | ||
402 | 434 | ||
403 | /* Examine each GPE Register within the block */ | 435 | /* Examine each GPE Register within the block */ |
404 | 436 | ||
405 | for (i = 0; i < gpe_block->register_count; i++) { | 437 | for (i = 0; i < gpe_block->register_count; i++) { |
438 | gpe_register_info = &gpe_block->register_info[i]; | ||
406 | 439 | ||
407 | /* | 440 | /* |
408 | * Enable all "wake" GPEs in this register and disable the | 441 | * Enable all "wake" GPEs in this register and disable the |
@@ -410,8 +443,8 @@ acpi_hw_enable_wakeup_gpe_block(struct acpi_gpe_xrupt_info *gpe_xrupt_info, | |||
410 | */ | 443 | */ |
411 | 444 | ||
412 | status = | 445 | status = |
413 | acpi_hw_write(gpe_block->register_info[i].enable_for_wake, | 446 | acpi_hw_gpe_enable_write(gpe_register_info->enable_for_wake, |
414 | &gpe_block->register_info[i].enable_address); | 447 | gpe_register_info); |
415 | if (ACPI_FAILURE(status)) { | 448 | if (ACPI_FAILURE(status)) { |
416 | return (status); | 449 | return (status); |
417 | } | 450 | } |
diff --git a/drivers/acpi/acpica/utresrc.c b/drivers/acpi/acpica/utresrc.c index 5cd017c7ac0e..bc1ff820c7dd 100644 --- a/drivers/acpi/acpica/utresrc.c +++ b/drivers/acpi/acpica/utresrc.c | |||
@@ -263,7 +263,7 @@ const char *acpi_gbl_bpb_decode[] = { | |||
263 | /* UART serial bus stop bits */ | 263 | /* UART serial bus stop bits */ |
264 | 264 | ||
265 | const char *acpi_gbl_sb_decode[] = { | 265 | const char *acpi_gbl_sb_decode[] = { |
266 | "StopBitsNone", | 266 | "StopBitsZero", |
267 | "StopBitsOne", | 267 | "StopBitsOne", |
268 | "StopBitsOnePlusHalf", | 268 | "StopBitsOnePlusHalf", |
269 | "StopBitsTwo" | 269 | "StopBitsTwo" |
diff --git a/drivers/acpi/acpica/utxface.c b/drivers/acpi/acpica/utxface.c index 502a8492dc83..49c873c68756 100644 --- a/drivers/acpi/acpica/utxface.c +++ b/drivers/acpi/acpica/utxface.c | |||
@@ -531,7 +531,9 @@ acpi_decode_pld_buffer(u8 *in_buffer, | |||
531 | ACPI_MOVE_32_TO_32(&dword, &buffer[0]); | 531 | ACPI_MOVE_32_TO_32(&dword, &buffer[0]); |
532 | pld_info->revision = ACPI_PLD_GET_REVISION(&dword); | 532 | pld_info->revision = ACPI_PLD_GET_REVISION(&dword); |
533 | pld_info->ignore_color = ACPI_PLD_GET_IGNORE_COLOR(&dword); | 533 | pld_info->ignore_color = ACPI_PLD_GET_IGNORE_COLOR(&dword); |
534 | pld_info->color = ACPI_PLD_GET_COLOR(&dword); | 534 | pld_info->red = ACPI_PLD_GET_RED(&dword); |
535 | pld_info->green = ACPI_PLD_GET_GREEN(&dword); | ||
536 | pld_info->blue = ACPI_PLD_GET_BLUE(&dword); | ||
535 | 537 | ||
536 | /* Second 32-bit DWord */ | 538 | /* Second 32-bit DWord */ |
537 | 539 | ||
diff --git a/drivers/acpi/acpica/utxfinit.c b/drivers/acpi/acpica/utxfinit.c index 13380d818462..b1fd6886e439 100644 --- a/drivers/acpi/acpica/utxfinit.c +++ b/drivers/acpi/acpica/utxfinit.c | |||
@@ -53,6 +53,9 @@ | |||
53 | #define _COMPONENT ACPI_UTILITIES | 53 | #define _COMPONENT ACPI_UTILITIES |
54 | ACPI_MODULE_NAME("utxfinit") | 54 | ACPI_MODULE_NAME("utxfinit") |
55 | 55 | ||
56 | /* For acpi_exec only */ | ||
57 | void ae_do_object_overrides(void); | ||
58 | |||
56 | /******************************************************************************* | 59 | /******************************************************************************* |
57 | * | 60 | * |
58 | * FUNCTION: acpi_initialize_subsystem | 61 | * FUNCTION: acpi_initialize_subsystem |
@@ -65,6 +68,7 @@ ACPI_MODULE_NAME("utxfinit") | |||
65 | * called, so any early initialization belongs here. | 68 | * called, so any early initialization belongs here. |
66 | * | 69 | * |
67 | ******************************************************************************/ | 70 | ******************************************************************************/ |
71 | |||
68 | acpi_status __init acpi_initialize_subsystem(void) | 72 | acpi_status __init acpi_initialize_subsystem(void) |
69 | { | 73 | { |
70 | acpi_status status; | 74 | acpi_status status; |
@@ -275,6 +279,13 @@ acpi_status __init acpi_initialize_objects(u32 flags) | |||
275 | return_ACPI_STATUS(status); | 279 | return_ACPI_STATUS(status); |
276 | } | 280 | } |
277 | } | 281 | } |
282 | #ifdef ACPI_EXEC_APP | ||
283 | /* | ||
284 | * This call implements the "initialization file" option for acpi_exec. | ||
285 | * This is the precise point that we want to perform the overrides. | ||
286 | */ | ||
287 | ae_do_object_overrides(); | ||
288 | #endif | ||
278 | 289 | ||
279 | /* | 290 | /* |
280 | * Execute any module-level code that was detected during the table load | 291 | * Execute any module-level code that was detected during the table load |
diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c index 8ec8a89a20ab..d98ba4355819 100644 --- a/drivers/acpi/battery.c +++ b/drivers/acpi/battery.c | |||
@@ -1180,6 +1180,10 @@ static int acpi_battery_add(struct acpi_device *device) | |||
1180 | 1180 | ||
1181 | if (!device) | 1181 | if (!device) |
1182 | return -EINVAL; | 1182 | return -EINVAL; |
1183 | |||
1184 | if (device->dep_unmet) | ||
1185 | return -EPROBE_DEFER; | ||
1186 | |||
1183 | battery = kzalloc(sizeof(struct acpi_battery), GFP_KERNEL); | 1187 | battery = kzalloc(sizeof(struct acpi_battery), GFP_KERNEL); |
1184 | if (!battery) | 1188 | if (!battery) |
1185 | return -ENOMEM; | 1189 | return -ENOMEM; |
diff --git a/drivers/acpi/device_pm.c b/drivers/acpi/device_pm.c index 143ec6ea1468..076af8149566 100644 --- a/drivers/acpi/device_pm.c +++ b/drivers/acpi/device_pm.c | |||
@@ -201,7 +201,7 @@ int acpi_device_set_power(struct acpi_device *device, int state) | |||
201 | * Transition Power | 201 | * Transition Power |
202 | * ---------------- | 202 | * ---------------- |
203 | * In accordance with the ACPI specification first apply power (via | 203 | * In accordance with the ACPI specification first apply power (via |
204 | * power resources) and then evalute _PSx. | 204 | * power resources) and then evaluate _PSx. |
205 | */ | 205 | */ |
206 | if (device->power.flags.power_resources) { | 206 | if (device->power.flags.power_resources) { |
207 | result = acpi_power_transition(device, state); | 207 | result = acpi_power_transition(device, state); |
@@ -878,7 +878,7 @@ int acpi_dev_suspend_late(struct device *dev) | |||
878 | return 0; | 878 | return 0; |
879 | 879 | ||
880 | target_state = acpi_target_system_state(); | 880 | target_state = acpi_target_system_state(); |
881 | wakeup = device_may_wakeup(dev); | 881 | wakeup = device_may_wakeup(dev) && acpi_device_can_wakeup(adev); |
882 | error = acpi_device_wakeup(adev, target_state, wakeup); | 882 | error = acpi_device_wakeup(adev, target_state, wakeup); |
883 | if (wakeup && error) | 883 | if (wakeup && error) |
884 | return error; | 884 | return error; |
diff --git a/drivers/acpi/internal.h b/drivers/acpi/internal.h index 447f6d679b29..163e82f536fa 100644 --- a/drivers/acpi/internal.h +++ b/drivers/acpi/internal.h | |||
@@ -173,4 +173,10 @@ static inline void suspend_nvs_restore(void) {} | |||
173 | bool acpi_osi_is_win8(void); | 173 | bool acpi_osi_is_win8(void); |
174 | #endif | 174 | #endif |
175 | 175 | ||
176 | /*-------------------------------------------------------------------------- | ||
177 | Device properties | ||
178 | -------------------------------------------------------------------------- */ | ||
179 | void acpi_init_properties(struct acpi_device *adev); | ||
180 | void acpi_free_properties(struct acpi_device *adev); | ||
181 | |||
176 | #endif /* _ACPI_INTERNAL_H_ */ | 182 | #endif /* _ACPI_INTERNAL_H_ */ |
diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c index 9964f70be98d..f9eeae871593 100644 --- a/drivers/acpi/osl.c +++ b/drivers/acpi/osl.c | |||
@@ -436,7 +436,7 @@ static void acpi_os_drop_map_ref(struct acpi_ioremap *map) | |||
436 | static void acpi_os_map_cleanup(struct acpi_ioremap *map) | 436 | static void acpi_os_map_cleanup(struct acpi_ioremap *map) |
437 | { | 437 | { |
438 | if (!map->refcount) { | 438 | if (!map->refcount) { |
439 | synchronize_rcu(); | 439 | synchronize_rcu_expedited(); |
440 | acpi_unmap(map->phys, map->virt); | 440 | acpi_unmap(map->phys, map->virt); |
441 | kfree(map); | 441 | kfree(map); |
442 | } | 442 | } |
@@ -1188,6 +1188,12 @@ EXPORT_SYMBOL(acpi_os_execute); | |||
1188 | 1188 | ||
1189 | void acpi_os_wait_events_complete(void) | 1189 | void acpi_os_wait_events_complete(void) |
1190 | { | 1190 | { |
1191 | /* | ||
1192 | * Make sure the GPE handler or the fixed event handler is not used | ||
1193 | * on another CPU after removal. | ||
1194 | */ | ||
1195 | if (acpi_irq_handler) | ||
1196 | synchronize_hardirq(acpi_gbl_FADT.sci_interrupt); | ||
1191 | flush_workqueue(kacpid_wq); | 1197 | flush_workqueue(kacpid_wq); |
1192 | flush_workqueue(kacpi_notify_wq); | 1198 | flush_workqueue(kacpi_notify_wq); |
1193 | } | 1199 | } |
diff --git a/drivers/acpi/pmic/intel_pmic.c b/drivers/acpi/pmic/intel_pmic.c new file mode 100644 index 000000000000..a732e5d7e322 --- /dev/null +++ b/drivers/acpi/pmic/intel_pmic.c | |||
@@ -0,0 +1,354 @@ | |||
1 | /* | ||
2 | * intel_pmic.c - Intel PMIC operation region driver | ||
3 | * | ||
4 | * Copyright (C) 2014 Intel Corporation. All rights reserved. | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or | ||
7 | * modify it under the terms of the GNU General Public License version | ||
8 | * 2 as published by the Free Software Foundation. | ||
9 | * | ||
10 | * This program is distributed in the hope that it will be useful, | ||
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | * GNU General Public License for more details. | ||
14 | */ | ||
15 | |||
16 | #include <linux/module.h> | ||
17 | #include <linux/acpi.h> | ||
18 | #include <linux/regmap.h> | ||
19 | #include "intel_pmic.h" | ||
20 | |||
21 | #define PMIC_POWER_OPREGION_ID 0x8d | ||
22 | #define PMIC_THERMAL_OPREGION_ID 0x8c | ||
23 | |||
24 | struct acpi_lpat { | ||
25 | int temp; | ||
26 | int raw; | ||
27 | }; | ||
28 | |||
29 | struct intel_pmic_opregion { | ||
30 | struct mutex lock; | ||
31 | struct acpi_lpat *lpat; | ||
32 | int lpat_count; | ||
33 | struct regmap *regmap; | ||
34 | struct intel_pmic_opregion_data *data; | ||
35 | }; | ||
36 | |||
37 | static int pmic_get_reg_bit(int address, struct pmic_table *table, | ||
38 | int count, int *reg, int *bit) | ||
39 | { | ||
40 | int i; | ||
41 | |||
42 | for (i = 0; i < count; i++) { | ||
43 | if (table[i].address == address) { | ||
44 | *reg = table[i].reg; | ||
45 | if (bit) | ||
46 | *bit = table[i].bit; | ||
47 | return 0; | ||
48 | } | ||
49 | } | ||
50 | return -ENOENT; | ||
51 | } | ||
52 | |||
53 | /** | ||
54 | * raw_to_temp(): Return temperature from raw value through LPAT table | ||
55 | * | ||
56 | * @lpat: the temperature_raw mapping table | ||
57 | * @count: the count of the above mapping table | ||
58 | * @raw: the raw value, used as a key to get the temerature from the | ||
59 | * above mapping table | ||
60 | * | ||
61 | * A positive value will be returned on success, a negative errno will | ||
62 | * be returned in error cases. | ||
63 | */ | ||
64 | static int raw_to_temp(struct acpi_lpat *lpat, int count, int raw) | ||
65 | { | ||
66 | int i, delta_temp, delta_raw, temp; | ||
67 | |||
68 | for (i = 0; i < count - 1; i++) { | ||
69 | if ((raw >= lpat[i].raw && raw <= lpat[i+1].raw) || | ||
70 | (raw <= lpat[i].raw && raw >= lpat[i+1].raw)) | ||
71 | break; | ||
72 | } | ||
73 | |||
74 | if (i == count - 1) | ||
75 | return -ENOENT; | ||
76 | |||
77 | delta_temp = lpat[i+1].temp - lpat[i].temp; | ||
78 | delta_raw = lpat[i+1].raw - lpat[i].raw; | ||
79 | temp = lpat[i].temp + (raw - lpat[i].raw) * delta_temp / delta_raw; | ||
80 | |||
81 | return temp; | ||
82 | } | ||
83 | |||
84 | /** | ||
85 | * temp_to_raw(): Return raw value from temperature through LPAT table | ||
86 | * | ||
87 | * @lpat: the temperature_raw mapping table | ||
88 | * @count: the count of the above mapping table | ||
89 | * @temp: the temperature, used as a key to get the raw value from the | ||
90 | * above mapping table | ||
91 | * | ||
92 | * A positive value will be returned on success, a negative errno will | ||
93 | * be returned in error cases. | ||
94 | */ | ||
95 | static int temp_to_raw(struct acpi_lpat *lpat, int count, int temp) | ||
96 | { | ||
97 | int i, delta_temp, delta_raw, raw; | ||
98 | |||
99 | for (i = 0; i < count - 1; i++) { | ||
100 | if (temp >= lpat[i].temp && temp <= lpat[i+1].temp) | ||
101 | break; | ||
102 | } | ||
103 | |||
104 | if (i == count - 1) | ||
105 | return -ENOENT; | ||
106 | |||
107 | delta_temp = lpat[i+1].temp - lpat[i].temp; | ||
108 | delta_raw = lpat[i+1].raw - lpat[i].raw; | ||
109 | raw = lpat[i].raw + (temp - lpat[i].temp) * delta_raw / delta_temp; | ||
110 | |||
111 | return raw; | ||
112 | } | ||
113 | |||
114 | static void pmic_thermal_lpat(struct intel_pmic_opregion *opregion, | ||
115 | acpi_handle handle, struct device *dev) | ||
116 | { | ||
117 | struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; | ||
118 | union acpi_object *obj_p, *obj_e; | ||
119 | int *lpat, i; | ||
120 | acpi_status status; | ||
121 | |||
122 | status = acpi_evaluate_object(handle, "LPAT", NULL, &buffer); | ||
123 | if (ACPI_FAILURE(status)) | ||
124 | return; | ||
125 | |||
126 | obj_p = (union acpi_object *)buffer.pointer; | ||
127 | if (!obj_p || (obj_p->type != ACPI_TYPE_PACKAGE) || | ||
128 | (obj_p->package.count % 2) || (obj_p->package.count < 4)) | ||
129 | goto out; | ||
130 | |||
131 | lpat = devm_kmalloc(dev, sizeof(int) * obj_p->package.count, | ||
132 | GFP_KERNEL); | ||
133 | if (!lpat) | ||
134 | goto out; | ||
135 | |||
136 | for (i = 0; i < obj_p->package.count; i++) { | ||
137 | obj_e = &obj_p->package.elements[i]; | ||
138 | if (obj_e->type != ACPI_TYPE_INTEGER) { | ||
139 | devm_kfree(dev, lpat); | ||
140 | goto out; | ||
141 | } | ||
142 | lpat[i] = (s64)obj_e->integer.value; | ||
143 | } | ||
144 | |||
145 | opregion->lpat = (struct acpi_lpat *)lpat; | ||
146 | opregion->lpat_count = obj_p->package.count / 2; | ||
147 | |||
148 | out: | ||
149 | kfree(buffer.pointer); | ||
150 | } | ||
151 | |||
152 | static acpi_status intel_pmic_power_handler(u32 function, | ||
153 | acpi_physical_address address, u32 bits, u64 *value64, | ||
154 | void *handler_context, void *region_context) | ||
155 | { | ||
156 | struct intel_pmic_opregion *opregion = region_context; | ||
157 | struct regmap *regmap = opregion->regmap; | ||
158 | struct intel_pmic_opregion_data *d = opregion->data; | ||
159 | int reg, bit, result; | ||
160 | |||
161 | if (bits != 32 || !value64) | ||
162 | return AE_BAD_PARAMETER; | ||
163 | |||
164 | if (function == ACPI_WRITE && !(*value64 == 0 || *value64 == 1)) | ||
165 | return AE_BAD_PARAMETER; | ||
166 | |||
167 | result = pmic_get_reg_bit(address, d->power_table, | ||
168 | d->power_table_count, ®, &bit); | ||
169 | if (result == -ENOENT) | ||
170 | return AE_BAD_PARAMETER; | ||
171 | |||
172 | mutex_lock(&opregion->lock); | ||
173 | |||
174 | result = function == ACPI_READ ? | ||
175 | d->get_power(regmap, reg, bit, value64) : | ||
176 | d->update_power(regmap, reg, bit, *value64 == 1); | ||
177 | |||
178 | mutex_unlock(&opregion->lock); | ||
179 | |||
180 | return result ? AE_ERROR : AE_OK; | ||
181 | } | ||
182 | |||
183 | static int pmic_read_temp(struct intel_pmic_opregion *opregion, | ||
184 | int reg, u64 *value) | ||
185 | { | ||
186 | int raw_temp, temp; | ||
187 | |||
188 | if (!opregion->data->get_raw_temp) | ||
189 | return -ENXIO; | ||
190 | |||
191 | raw_temp = opregion->data->get_raw_temp(opregion->regmap, reg); | ||
192 | if (raw_temp < 0) | ||
193 | return raw_temp; | ||
194 | |||
195 | if (!opregion->lpat) { | ||
196 | *value = raw_temp; | ||
197 | return 0; | ||
198 | } | ||
199 | |||
200 | temp = raw_to_temp(opregion->lpat, opregion->lpat_count, raw_temp); | ||
201 | if (temp < 0) | ||
202 | return temp; | ||
203 | |||
204 | *value = temp; | ||
205 | return 0; | ||
206 | } | ||
207 | |||
208 | static int pmic_thermal_temp(struct intel_pmic_opregion *opregion, int reg, | ||
209 | u32 function, u64 *value) | ||
210 | { | ||
211 | return function == ACPI_READ ? | ||
212 | pmic_read_temp(opregion, reg, value) : -EINVAL; | ||
213 | } | ||
214 | |||
215 | static int pmic_thermal_aux(struct intel_pmic_opregion *opregion, int reg, | ||
216 | u32 function, u64 *value) | ||
217 | { | ||
218 | int raw_temp; | ||
219 | |||
220 | if (function == ACPI_READ) | ||
221 | return pmic_read_temp(opregion, reg, value); | ||
222 | |||
223 | if (!opregion->data->update_aux) | ||
224 | return -ENXIO; | ||
225 | |||
226 | if (opregion->lpat) { | ||
227 | raw_temp = temp_to_raw(opregion->lpat, opregion->lpat_count, | ||
228 | *value); | ||
229 | if (raw_temp < 0) | ||
230 | return raw_temp; | ||
231 | } else { | ||
232 | raw_temp = *value; | ||
233 | } | ||
234 | |||
235 | return opregion->data->update_aux(opregion->regmap, reg, raw_temp); | ||
236 | } | ||
237 | |||
238 | static int pmic_thermal_pen(struct intel_pmic_opregion *opregion, int reg, | ||
239 | u32 function, u64 *value) | ||
240 | { | ||
241 | struct intel_pmic_opregion_data *d = opregion->data; | ||
242 | struct regmap *regmap = opregion->regmap; | ||
243 | |||
244 | if (!d->get_policy || !d->update_policy) | ||
245 | return -ENXIO; | ||
246 | |||
247 | if (function == ACPI_READ) | ||
248 | return d->get_policy(regmap, reg, value); | ||
249 | |||
250 | if (*value != 0 && *value != 1) | ||
251 | return -EINVAL; | ||
252 | |||
253 | return d->update_policy(regmap, reg, *value); | ||
254 | } | ||
255 | |||
256 | static bool pmic_thermal_is_temp(int address) | ||
257 | { | ||
258 | return (address <= 0x3c) && !(address % 12); | ||
259 | } | ||
260 | |||
261 | static bool pmic_thermal_is_aux(int address) | ||
262 | { | ||
263 | return (address >= 4 && address <= 0x40 && !((address - 4) % 12)) || | ||
264 | (address >= 8 && address <= 0x44 && !((address - 8) % 12)); | ||
265 | } | ||
266 | |||
267 | static bool pmic_thermal_is_pen(int address) | ||
268 | { | ||
269 | return address >= 0x48 && address <= 0x5c; | ||
270 | } | ||
271 | |||
272 | static acpi_status intel_pmic_thermal_handler(u32 function, | ||
273 | acpi_physical_address address, u32 bits, u64 *value64, | ||
274 | void *handler_context, void *region_context) | ||
275 | { | ||
276 | struct intel_pmic_opregion *opregion = region_context; | ||
277 | struct intel_pmic_opregion_data *d = opregion->data; | ||
278 | int reg, result; | ||
279 | |||
280 | if (bits != 32 || !value64) | ||
281 | return AE_BAD_PARAMETER; | ||
282 | |||
283 | result = pmic_get_reg_bit(address, d->thermal_table, | ||
284 | d->thermal_table_count, ®, NULL); | ||
285 | if (result == -ENOENT) | ||
286 | return AE_BAD_PARAMETER; | ||
287 | |||
288 | mutex_lock(&opregion->lock); | ||
289 | |||
290 | if (pmic_thermal_is_temp(address)) | ||
291 | result = pmic_thermal_temp(opregion, reg, function, value64); | ||
292 | else if (pmic_thermal_is_aux(address)) | ||
293 | result = pmic_thermal_aux(opregion, reg, function, value64); | ||
294 | else if (pmic_thermal_is_pen(address)) | ||
295 | result = pmic_thermal_pen(opregion, reg, function, value64); | ||
296 | else | ||
297 | result = -EINVAL; | ||
298 | |||
299 | mutex_unlock(&opregion->lock); | ||
300 | |||
301 | if (result < 0) { | ||
302 | if (result == -EINVAL) | ||
303 | return AE_BAD_PARAMETER; | ||
304 | else | ||
305 | return AE_ERROR; | ||
306 | } | ||
307 | |||
308 | return AE_OK; | ||
309 | } | ||
310 | |||
311 | int intel_pmic_install_opregion_handler(struct device *dev, acpi_handle handle, | ||
312 | struct regmap *regmap, | ||
313 | struct intel_pmic_opregion_data *d) | ||
314 | { | ||
315 | acpi_status status; | ||
316 | struct intel_pmic_opregion *opregion; | ||
317 | |||
318 | if (!dev || !regmap || !d) | ||
319 | return -EINVAL; | ||
320 | |||
321 | if (!handle) | ||
322 | return -ENODEV; | ||
323 | |||
324 | opregion = devm_kzalloc(dev, sizeof(*opregion), GFP_KERNEL); | ||
325 | if (!opregion) | ||
326 | return -ENOMEM; | ||
327 | |||
328 | mutex_init(&opregion->lock); | ||
329 | opregion->regmap = regmap; | ||
330 | pmic_thermal_lpat(opregion, handle, dev); | ||
331 | |||
332 | status = acpi_install_address_space_handler(handle, | ||
333 | PMIC_POWER_OPREGION_ID, | ||
334 | intel_pmic_power_handler, | ||
335 | NULL, opregion); | ||
336 | if (ACPI_FAILURE(status)) | ||
337 | return -ENODEV; | ||
338 | |||
339 | status = acpi_install_address_space_handler(handle, | ||
340 | PMIC_THERMAL_OPREGION_ID, | ||
341 | intel_pmic_thermal_handler, | ||
342 | NULL, opregion); | ||
343 | if (ACPI_FAILURE(status)) { | ||
344 | acpi_remove_address_space_handler(handle, PMIC_POWER_OPREGION_ID, | ||
345 | intel_pmic_power_handler); | ||
346 | return -ENODEV; | ||
347 | } | ||
348 | |||
349 | opregion->data = d; | ||
350 | return 0; | ||
351 | } | ||
352 | EXPORT_SYMBOL_GPL(intel_pmic_install_opregion_handler); | ||
353 | |||
354 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/acpi/pmic/intel_pmic.h b/drivers/acpi/pmic/intel_pmic.h new file mode 100644 index 000000000000..d4e90af8f0dd --- /dev/null +++ b/drivers/acpi/pmic/intel_pmic.h | |||
@@ -0,0 +1,25 @@ | |||
1 | #ifndef __INTEL_PMIC_H | ||
2 | #define __INTEL_PMIC_H | ||
3 | |||
4 | struct pmic_table { | ||
5 | int address; /* operation region address */ | ||
6 | int reg; /* corresponding thermal register */ | ||
7 | int bit; /* control bit for power */ | ||
8 | }; | ||
9 | |||
10 | struct intel_pmic_opregion_data { | ||
11 | int (*get_power)(struct regmap *r, int reg, int bit, u64 *value); | ||
12 | int (*update_power)(struct regmap *r, int reg, int bit, bool on); | ||
13 | int (*get_raw_temp)(struct regmap *r, int reg); | ||
14 | int (*update_aux)(struct regmap *r, int reg, int raw_temp); | ||
15 | int (*get_policy)(struct regmap *r, int reg, u64 *value); | ||
16 | int (*update_policy)(struct regmap *r, int reg, int enable); | ||
17 | struct pmic_table *power_table; | ||
18 | int power_table_count; | ||
19 | struct pmic_table *thermal_table; | ||
20 | int thermal_table_count; | ||
21 | }; | ||
22 | |||
23 | int intel_pmic_install_opregion_handler(struct device *dev, acpi_handle handle, struct regmap *regmap, struct intel_pmic_opregion_data *d); | ||
24 | |||
25 | #endif | ||
diff --git a/drivers/acpi/pmic/intel_pmic_crc.c b/drivers/acpi/pmic/intel_pmic_crc.c new file mode 100644 index 000000000000..ef7d8ff95abe --- /dev/null +++ b/drivers/acpi/pmic/intel_pmic_crc.c | |||
@@ -0,0 +1,211 @@ | |||
1 | /* | ||
2 | * intel_pmic_crc.c - Intel CrystalCove PMIC operation region driver | ||
3 | * | ||
4 | * Copyright (C) 2014 Intel Corporation. All rights reserved. | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or | ||
7 | * modify it under the terms of the GNU General Public License version | ||
8 | * 2 as published by the Free Software Foundation. | ||
9 | * | ||
10 | * This program is distributed in the hope that it will be useful, | ||
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | * GNU General Public License for more details. | ||
14 | */ | ||
15 | |||
16 | #include <linux/module.h> | ||
17 | #include <linux/acpi.h> | ||
18 | #include <linux/mfd/intel_soc_pmic.h> | ||
19 | #include <linux/regmap.h> | ||
20 | #include <linux/platform_device.h> | ||
21 | #include "intel_pmic.h" | ||
22 | |||
23 | #define PWR_SOURCE_SELECT BIT(1) | ||
24 | |||
25 | #define PMIC_A0LOCK_REG 0xc5 | ||
26 | |||
27 | static struct pmic_table power_table[] = { | ||
28 | { | ||
29 | .address = 0x24, | ||
30 | .reg = 0x66, | ||
31 | .bit = 0x00, | ||
32 | }, | ||
33 | { | ||
34 | .address = 0x48, | ||
35 | .reg = 0x5d, | ||
36 | .bit = 0x00, | ||
37 | }, | ||
38 | }; | ||
39 | |||
40 | static struct pmic_table thermal_table[] = { | ||
41 | { | ||
42 | .address = 0x00, | ||
43 | .reg = 0x75 | ||
44 | }, | ||
45 | { | ||
46 | .address = 0x04, | ||
47 | .reg = 0x95 | ||
48 | }, | ||
49 | { | ||
50 | .address = 0x08, | ||
51 | .reg = 0x97 | ||
52 | }, | ||
53 | { | ||
54 | .address = 0x0c, | ||
55 | .reg = 0x77 | ||
56 | }, | ||
57 | { | ||
58 | .address = 0x10, | ||
59 | .reg = 0x9a | ||
60 | }, | ||
61 | { | ||
62 | .address = 0x14, | ||
63 | .reg = 0x9c | ||
64 | }, | ||
65 | { | ||
66 | .address = 0x18, | ||
67 | .reg = 0x79 | ||
68 | }, | ||
69 | { | ||
70 | .address = 0x1c, | ||
71 | .reg = 0x9f | ||
72 | }, | ||
73 | { | ||
74 | .address = 0x20, | ||
75 | .reg = 0xa1 | ||
76 | }, | ||
77 | { | ||
78 | .address = 0x48, | ||
79 | .reg = 0x94 | ||
80 | }, | ||
81 | { | ||
82 | .address = 0x4c, | ||
83 | .reg = 0x99 | ||
84 | }, | ||
85 | { | ||
86 | .address = 0x50, | ||
87 | .reg = 0x9e | ||
88 | }, | ||
89 | }; | ||
90 | |||
91 | static int intel_crc_pmic_get_power(struct regmap *regmap, int reg, | ||
92 | int bit, u64 *value) | ||
93 | { | ||
94 | int data; | ||
95 | |||
96 | if (regmap_read(regmap, reg, &data)) | ||
97 | return -EIO; | ||
98 | |||
99 | *value = (data & PWR_SOURCE_SELECT) && (data & BIT(bit)) ? 1 : 0; | ||
100 | return 0; | ||
101 | } | ||
102 | |||
103 | static int intel_crc_pmic_update_power(struct regmap *regmap, int reg, | ||
104 | int bit, bool on) | ||
105 | { | ||
106 | int data; | ||
107 | |||
108 | if (regmap_read(regmap, reg, &data)) | ||
109 | return -EIO; | ||
110 | |||
111 | if (on) { | ||
112 | data |= PWR_SOURCE_SELECT | BIT(bit); | ||
113 | } else { | ||
114 | data &= ~BIT(bit); | ||
115 | data |= PWR_SOURCE_SELECT; | ||
116 | } | ||
117 | |||
118 | if (regmap_write(regmap, reg, data)) | ||
119 | return -EIO; | ||
120 | return 0; | ||
121 | } | ||
122 | |||
123 | static int intel_crc_pmic_get_raw_temp(struct regmap *regmap, int reg) | ||
124 | { | ||
125 | int temp_l, temp_h; | ||
126 | |||
127 | /* | ||
128 | * Raw temperature value is 10bits: 8bits in reg | ||
129 | * and 2bits in reg-1: bit0,1 | ||
130 | */ | ||
131 | if (regmap_read(regmap, reg, &temp_l) || | ||
132 | regmap_read(regmap, reg - 1, &temp_h)) | ||
133 | return -EIO; | ||
134 | |||
135 | return temp_l | (temp_h & 0x3) << 8; | ||
136 | } | ||
137 | |||
138 | static int intel_crc_pmic_update_aux(struct regmap *regmap, int reg, int raw) | ||
139 | { | ||
140 | return regmap_write(regmap, reg, raw) || | ||
141 | regmap_update_bits(regmap, reg - 1, 0x3, raw >> 8) ? -EIO : 0; | ||
142 | } | ||
143 | |||
144 | static int intel_crc_pmic_get_policy(struct regmap *regmap, int reg, u64 *value) | ||
145 | { | ||
146 | int pen; | ||
147 | |||
148 | if (regmap_read(regmap, reg, &pen)) | ||
149 | return -EIO; | ||
150 | *value = pen >> 7; | ||
151 | return 0; | ||
152 | } | ||
153 | |||
154 | static int intel_crc_pmic_update_policy(struct regmap *regmap, | ||
155 | int reg, int enable) | ||
156 | { | ||
157 | int alert0; | ||
158 | |||
159 | /* Update to policy enable bit requires unlocking a0lock */ | ||
160 | if (regmap_read(regmap, PMIC_A0LOCK_REG, &alert0)) | ||
161 | return -EIO; | ||
162 | |||
163 | if (regmap_update_bits(regmap, PMIC_A0LOCK_REG, 0x01, 0)) | ||
164 | return -EIO; | ||
165 | |||
166 | if (regmap_update_bits(regmap, reg, 0x80, enable << 7)) | ||
167 | return -EIO; | ||
168 | |||
169 | /* restore alert0 */ | ||
170 | if (regmap_write(regmap, PMIC_A0LOCK_REG, alert0)) | ||
171 | return -EIO; | ||
172 | |||
173 | return 0; | ||
174 | } | ||
175 | |||
176 | static struct intel_pmic_opregion_data intel_crc_pmic_opregion_data = { | ||
177 | .get_power = intel_crc_pmic_get_power, | ||
178 | .update_power = intel_crc_pmic_update_power, | ||
179 | .get_raw_temp = intel_crc_pmic_get_raw_temp, | ||
180 | .update_aux = intel_crc_pmic_update_aux, | ||
181 | .get_policy = intel_crc_pmic_get_policy, | ||
182 | .update_policy = intel_crc_pmic_update_policy, | ||
183 | .power_table = power_table, | ||
184 | .power_table_count= ARRAY_SIZE(power_table), | ||
185 | .thermal_table = thermal_table, | ||
186 | .thermal_table_count = ARRAY_SIZE(thermal_table), | ||
187 | }; | ||
188 | |||
189 | static int intel_crc_pmic_opregion_probe(struct platform_device *pdev) | ||
190 | { | ||
191 | struct intel_soc_pmic *pmic = dev_get_drvdata(pdev->dev.parent); | ||
192 | return intel_pmic_install_opregion_handler(&pdev->dev, | ||
193 | ACPI_HANDLE(pdev->dev.parent), pmic->regmap, | ||
194 | &intel_crc_pmic_opregion_data); | ||
195 | } | ||
196 | |||
197 | static struct platform_driver intel_crc_pmic_opregion_driver = { | ||
198 | .probe = intel_crc_pmic_opregion_probe, | ||
199 | .driver = { | ||
200 | .name = "crystal_cove_pmic", | ||
201 | }, | ||
202 | }; | ||
203 | |||
204 | static int __init intel_crc_pmic_opregion_driver_init(void) | ||
205 | { | ||
206 | return platform_driver_register(&intel_crc_pmic_opregion_driver); | ||
207 | } | ||
208 | module_init(intel_crc_pmic_opregion_driver_init); | ||
209 | |||
210 | MODULE_DESCRIPTION("CrystalCove ACPI opration region driver"); | ||
211 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/acpi/pmic/intel_pmic_xpower.c b/drivers/acpi/pmic/intel_pmic_xpower.c new file mode 100644 index 000000000000..6a082d4de12c --- /dev/null +++ b/drivers/acpi/pmic/intel_pmic_xpower.c | |||
@@ -0,0 +1,268 @@ | |||
1 | /* | ||
2 | * intel_pmic_xpower.c - XPower AXP288 PMIC operation region driver | ||
3 | * | ||
4 | * Copyright (C) 2014 Intel Corporation. All rights reserved. | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or | ||
7 | * modify it under the terms of the GNU General Public License version | ||
8 | * 2 as published by the Free Software Foundation. | ||
9 | * | ||
10 | * This program is distributed in the hope that it will be useful, | ||
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | * GNU General Public License for more details. | ||
14 | */ | ||
15 | |||
16 | #include <linux/module.h> | ||
17 | #include <linux/acpi.h> | ||
18 | #include <linux/mfd/axp20x.h> | ||
19 | #include <linux/regmap.h> | ||
20 | #include <linux/platform_device.h> | ||
21 | #include <linux/iio/consumer.h> | ||
22 | #include "intel_pmic.h" | ||
23 | |||
24 | #define XPOWER_GPADC_LOW 0x5b | ||
25 | |||
26 | static struct pmic_table power_table[] = { | ||
27 | { | ||
28 | .address = 0x00, | ||
29 | .reg = 0x13, | ||
30 | .bit = 0x05, | ||
31 | }, | ||
32 | { | ||
33 | .address = 0x04, | ||
34 | .reg = 0x13, | ||
35 | .bit = 0x06, | ||
36 | }, | ||
37 | { | ||
38 | .address = 0x08, | ||
39 | .reg = 0x13, | ||
40 | .bit = 0x07, | ||
41 | }, | ||
42 | { | ||
43 | .address = 0x0c, | ||
44 | .reg = 0x12, | ||
45 | .bit = 0x03, | ||
46 | }, | ||
47 | { | ||
48 | .address = 0x10, | ||
49 | .reg = 0x12, | ||
50 | .bit = 0x04, | ||
51 | }, | ||
52 | { | ||
53 | .address = 0x14, | ||
54 | .reg = 0x12, | ||
55 | .bit = 0x05, | ||
56 | }, | ||
57 | { | ||
58 | .address = 0x18, | ||
59 | .reg = 0x12, | ||
60 | .bit = 0x06, | ||
61 | }, | ||
62 | { | ||
63 | .address = 0x1c, | ||
64 | .reg = 0x12, | ||
65 | .bit = 0x00, | ||
66 | }, | ||
67 | { | ||
68 | .address = 0x20, | ||
69 | .reg = 0x12, | ||
70 | .bit = 0x01, | ||
71 | }, | ||
72 | { | ||
73 | .address = 0x24, | ||
74 | .reg = 0x12, | ||
75 | .bit = 0x02, | ||
76 | }, | ||
77 | { | ||
78 | .address = 0x28, | ||
79 | .reg = 0x13, | ||
80 | .bit = 0x02, | ||
81 | }, | ||
82 | { | ||
83 | .address = 0x2c, | ||
84 | .reg = 0x13, | ||
85 | .bit = 0x03, | ||
86 | }, | ||
87 | { | ||
88 | .address = 0x30, | ||
89 | .reg = 0x13, | ||
90 | .bit = 0x04, | ||
91 | }, | ||
92 | { | ||
93 | .address = 0x38, | ||
94 | .reg = 0x10, | ||
95 | .bit = 0x03, | ||
96 | }, | ||
97 | { | ||
98 | .address = 0x3c, | ||
99 | .reg = 0x10, | ||
100 | .bit = 0x06, | ||
101 | }, | ||
102 | { | ||
103 | .address = 0x40, | ||
104 | .reg = 0x10, | ||
105 | .bit = 0x05, | ||
106 | }, | ||
107 | { | ||
108 | .address = 0x44, | ||
109 | .reg = 0x10, | ||
110 | .bit = 0x04, | ||
111 | }, | ||
112 | { | ||
113 | .address = 0x48, | ||
114 | .reg = 0x10, | ||
115 | .bit = 0x01, | ||
116 | }, | ||
117 | { | ||
118 | .address = 0x4c, | ||
119 | .reg = 0x10, | ||
120 | .bit = 0x00 | ||
121 | }, | ||
122 | }; | ||
123 | |||
124 | /* TMP0 - TMP5 are the same, all from GPADC */ | ||
125 | static struct pmic_table thermal_table[] = { | ||
126 | { | ||
127 | .address = 0x00, | ||
128 | .reg = XPOWER_GPADC_LOW | ||
129 | }, | ||
130 | { | ||
131 | .address = 0x0c, | ||
132 | .reg = XPOWER_GPADC_LOW | ||
133 | }, | ||
134 | { | ||
135 | .address = 0x18, | ||
136 | .reg = XPOWER_GPADC_LOW | ||
137 | }, | ||
138 | { | ||
139 | .address = 0x24, | ||
140 | .reg = XPOWER_GPADC_LOW | ||
141 | }, | ||
142 | { | ||
143 | .address = 0x30, | ||
144 | .reg = XPOWER_GPADC_LOW | ||
145 | }, | ||
146 | { | ||
147 | .address = 0x3c, | ||
148 | .reg = XPOWER_GPADC_LOW | ||
149 | }, | ||
150 | }; | ||
151 | |||
152 | static int intel_xpower_pmic_get_power(struct regmap *regmap, int reg, | ||
153 | int bit, u64 *value) | ||
154 | { | ||
155 | int data; | ||
156 | |||
157 | if (regmap_read(regmap, reg, &data)) | ||
158 | return -EIO; | ||
159 | |||
160 | *value = (data & BIT(bit)) ? 1 : 0; | ||
161 | return 0; | ||
162 | } | ||
163 | |||
164 | static int intel_xpower_pmic_update_power(struct regmap *regmap, int reg, | ||
165 | int bit, bool on) | ||
166 | { | ||
167 | int data; | ||
168 | |||
169 | if (regmap_read(regmap, reg, &data)) | ||
170 | return -EIO; | ||
171 | |||
172 | if (on) | ||
173 | data |= BIT(bit); | ||
174 | else | ||
175 | data &= ~BIT(bit); | ||
176 | |||
177 | if (regmap_write(regmap, reg, data)) | ||
178 | return -EIO; | ||
179 | |||
180 | return 0; | ||
181 | } | ||
182 | |||
183 | /** | ||
184 | * intel_xpower_pmic_get_raw_temp(): Get raw temperature reading from the PMIC | ||
185 | * | ||
186 | * @regmap: regmap of the PMIC device | ||
187 | * @reg: register to get the reading | ||
188 | * | ||
189 | * We could get the sensor value by manipulating the HW regs here, but since | ||
190 | * the axp288 IIO driver may also access the same regs at the same time, the | ||
191 | * APIs provided by IIO subsystem are used here instead to avoid problems. As | ||
192 | * a result, the two passed in params are of no actual use. | ||
193 | * | ||
194 | * Return a positive value on success, errno on failure. | ||
195 | */ | ||
196 | static int intel_xpower_pmic_get_raw_temp(struct regmap *regmap, int reg) | ||
197 | { | ||
198 | struct iio_channel *gpadc_chan; | ||
199 | int ret, val; | ||
200 | |||
201 | gpadc_chan = iio_channel_get(NULL, "axp288-system-temp"); | ||
202 | if (IS_ERR_OR_NULL(gpadc_chan)) | ||
203 | return -EACCES; | ||
204 | |||
205 | ret = iio_read_channel_raw(gpadc_chan, &val); | ||
206 | if (ret < 0) | ||
207 | val = ret; | ||
208 | |||
209 | iio_channel_release(gpadc_chan); | ||
210 | return val; | ||
211 | } | ||
212 | |||
213 | static struct intel_pmic_opregion_data intel_xpower_pmic_opregion_data = { | ||
214 | .get_power = intel_xpower_pmic_get_power, | ||
215 | .update_power = intel_xpower_pmic_update_power, | ||
216 | .get_raw_temp = intel_xpower_pmic_get_raw_temp, | ||
217 | .power_table = power_table, | ||
218 | .power_table_count = ARRAY_SIZE(power_table), | ||
219 | .thermal_table = thermal_table, | ||
220 | .thermal_table_count = ARRAY_SIZE(thermal_table), | ||
221 | }; | ||
222 | |||
223 | static acpi_status intel_xpower_pmic_gpio_handler(u32 function, | ||
224 | acpi_physical_address address, u32 bit_width, u64 *value, | ||
225 | void *handler_context, void *region_context) | ||
226 | { | ||
227 | return AE_OK; | ||
228 | } | ||
229 | |||
230 | static int intel_xpower_pmic_opregion_probe(struct platform_device *pdev) | ||
231 | { | ||
232 | struct device *parent = pdev->dev.parent; | ||
233 | struct axp20x_dev *axp20x = dev_get_drvdata(parent); | ||
234 | acpi_status status; | ||
235 | int result; | ||
236 | |||
237 | status = acpi_install_address_space_handler(ACPI_HANDLE(parent), | ||
238 | ACPI_ADR_SPACE_GPIO, intel_xpower_pmic_gpio_handler, | ||
239 | NULL, NULL); | ||
240 | if (ACPI_FAILURE(status)) | ||
241 | return -ENODEV; | ||
242 | |||
243 | result = intel_pmic_install_opregion_handler(&pdev->dev, | ||
244 | ACPI_HANDLE(parent), axp20x->regmap, | ||
245 | &intel_xpower_pmic_opregion_data); | ||
246 | if (result) | ||
247 | acpi_remove_address_space_handler(ACPI_HANDLE(parent), | ||
248 | ACPI_ADR_SPACE_GPIO, | ||
249 | intel_xpower_pmic_gpio_handler); | ||
250 | |||
251 | return result; | ||
252 | } | ||
253 | |||
254 | static struct platform_driver intel_xpower_pmic_opregion_driver = { | ||
255 | .probe = intel_xpower_pmic_opregion_probe, | ||
256 | .driver = { | ||
257 | .name = "axp288_pmic_acpi", | ||
258 | }, | ||
259 | }; | ||
260 | |||
261 | static int __init intel_xpower_pmic_opregion_driver_init(void) | ||
262 | { | ||
263 | return platform_driver_register(&intel_xpower_pmic_opregion_driver); | ||
264 | } | ||
265 | module_init(intel_xpower_pmic_opregion_driver_init); | ||
266 | |||
267 | MODULE_DESCRIPTION("XPower AXP288 ACPI operation region driver"); | ||
268 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c index 17f9ec501972..38472fd5d104 100644 --- a/drivers/acpi/processor_idle.c +++ b/drivers/acpi/processor_idle.c | |||
@@ -334,10 +334,10 @@ static int acpi_processor_get_power_info_default(struct acpi_processor *pr) | |||
334 | 334 | ||
335 | static int acpi_processor_get_power_info_cst(struct acpi_processor *pr) | 335 | static int acpi_processor_get_power_info_cst(struct acpi_processor *pr) |
336 | { | 336 | { |
337 | acpi_status status = 0; | 337 | acpi_status status; |
338 | u64 count; | 338 | u64 count; |
339 | int current_count; | 339 | int current_count; |
340 | int i; | 340 | int i, ret = 0; |
341 | struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; | 341 | struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; |
342 | union acpi_object *cst; | 342 | union acpi_object *cst; |
343 | 343 | ||
@@ -358,7 +358,7 @@ static int acpi_processor_get_power_info_cst(struct acpi_processor *pr) | |||
358 | /* There must be at least 2 elements */ | 358 | /* There must be at least 2 elements */ |
359 | if (!cst || (cst->type != ACPI_TYPE_PACKAGE) || cst->package.count < 2) { | 359 | if (!cst || (cst->type != ACPI_TYPE_PACKAGE) || cst->package.count < 2) { |
360 | printk(KERN_ERR PREFIX "not enough elements in _CST\n"); | 360 | printk(KERN_ERR PREFIX "not enough elements in _CST\n"); |
361 | status = -EFAULT; | 361 | ret = -EFAULT; |
362 | goto end; | 362 | goto end; |
363 | } | 363 | } |
364 | 364 | ||
@@ -367,7 +367,7 @@ static int acpi_processor_get_power_info_cst(struct acpi_processor *pr) | |||
367 | /* Validate number of power states. */ | 367 | /* Validate number of power states. */ |
368 | if (count < 1 || count != cst->package.count - 1) { | 368 | if (count < 1 || count != cst->package.count - 1) { |
369 | printk(KERN_ERR PREFIX "count given by _CST is not valid\n"); | 369 | printk(KERN_ERR PREFIX "count given by _CST is not valid\n"); |
370 | status = -EFAULT; | 370 | ret = -EFAULT; |
371 | goto end; | 371 | goto end; |
372 | } | 372 | } |
373 | 373 | ||
@@ -489,12 +489,12 @@ static int acpi_processor_get_power_info_cst(struct acpi_processor *pr) | |||
489 | 489 | ||
490 | /* Validate number of power states discovered */ | 490 | /* Validate number of power states discovered */ |
491 | if (current_count < 2) | 491 | if (current_count < 2) |
492 | status = -EFAULT; | 492 | ret = -EFAULT; |
493 | 493 | ||
494 | end: | 494 | end: |
495 | kfree(buffer.pointer); | 495 | kfree(buffer.pointer); |
496 | 496 | ||
497 | return status; | 497 | return ret; |
498 | } | 498 | } |
499 | 499 | ||
500 | static void acpi_processor_power_verify_c3(struct acpi_processor *pr, | 500 | static void acpi_processor_power_verify_c3(struct acpi_processor *pr, |
@@ -1111,7 +1111,7 @@ static int acpi_processor_registered; | |||
1111 | 1111 | ||
1112 | int acpi_processor_power_init(struct acpi_processor *pr) | 1112 | int acpi_processor_power_init(struct acpi_processor *pr) |
1113 | { | 1113 | { |
1114 | acpi_status status = 0; | 1114 | acpi_status status; |
1115 | int retval; | 1115 | int retval; |
1116 | struct cpuidle_device *dev; | 1116 | struct cpuidle_device *dev; |
1117 | static int first_run; | 1117 | static int first_run; |
diff --git a/drivers/acpi/property.c b/drivers/acpi/property.c new file mode 100644 index 000000000000..0d083736e25b --- /dev/null +++ b/drivers/acpi/property.c | |||
@@ -0,0 +1,551 @@ | |||
1 | /* | ||
2 | * ACPI device specific properties support. | ||
3 | * | ||
4 | * Copyright (C) 2014, Intel Corporation | ||
5 | * All rights reserved. | ||
6 | * | ||
7 | * Authors: Mika Westerberg <mika.westerberg@linux.intel.com> | ||
8 | * Darren Hart <dvhart@linux.intel.com> | ||
9 | * Rafael J. Wysocki <rafael.j.wysocki@intel.com> | ||
10 | * | ||
11 | * This program is free software; you can redistribute it and/or modify | ||
12 | * it under the terms of the GNU General Public License version 2 as | ||
13 | * published by the Free Software Foundation. | ||
14 | */ | ||
15 | |||
16 | #include <linux/acpi.h> | ||
17 | #include <linux/device.h> | ||
18 | #include <linux/export.h> | ||
19 | |||
20 | #include "internal.h" | ||
21 | |||
22 | /* ACPI _DSD device properties UUID: daffd814-6eba-4d8c-8a91-bc9bbf4aa301 */ | ||
23 | static const u8 prp_uuid[16] = { | ||
24 | 0x14, 0xd8, 0xff, 0xda, 0xba, 0x6e, 0x8c, 0x4d, | ||
25 | 0x8a, 0x91, 0xbc, 0x9b, 0xbf, 0x4a, 0xa3, 0x01 | ||
26 | }; | ||
27 | |||
28 | static bool acpi_property_value_ok(const union acpi_object *value) | ||
29 | { | ||
30 | int j; | ||
31 | |||
32 | /* | ||
33 | * The value must be an integer, a string, a reference, or a package | ||
34 | * whose every element must be an integer, a string, or a reference. | ||
35 | */ | ||
36 | switch (value->type) { | ||
37 | case ACPI_TYPE_INTEGER: | ||
38 | case ACPI_TYPE_STRING: | ||
39 | case ACPI_TYPE_LOCAL_REFERENCE: | ||
40 | return true; | ||
41 | |||
42 | case ACPI_TYPE_PACKAGE: | ||
43 | for (j = 0; j < value->package.count; j++) | ||
44 | switch (value->package.elements[j].type) { | ||
45 | case ACPI_TYPE_INTEGER: | ||
46 | case ACPI_TYPE_STRING: | ||
47 | case ACPI_TYPE_LOCAL_REFERENCE: | ||
48 | continue; | ||
49 | |||
50 | default: | ||
51 | return false; | ||
52 | } | ||
53 | |||
54 | return true; | ||
55 | } | ||
56 | return false; | ||
57 | } | ||
58 | |||
59 | static bool acpi_properties_format_valid(const union acpi_object *properties) | ||
60 | { | ||
61 | int i; | ||
62 | |||
63 | for (i = 0; i < properties->package.count; i++) { | ||
64 | const union acpi_object *property; | ||
65 | |||
66 | property = &properties->package.elements[i]; | ||
67 | /* | ||
68 | * Only two elements allowed, the first one must be a string and | ||
69 | * the second one has to satisfy certain conditions. | ||
70 | */ | ||
71 | if (property->package.count != 2 | ||
72 | || property->package.elements[0].type != ACPI_TYPE_STRING | ||
73 | || !acpi_property_value_ok(&property->package.elements[1])) | ||
74 | return false; | ||
75 | } | ||
76 | return true; | ||
77 | } | ||
78 | |||
79 | static void acpi_init_of_compatible(struct acpi_device *adev) | ||
80 | { | ||
81 | const union acpi_object *of_compatible; | ||
82 | struct acpi_hardware_id *hwid; | ||
83 | bool acpi_of = false; | ||
84 | int ret; | ||
85 | |||
86 | /* | ||
87 | * Check if the special PRP0001 ACPI ID is present and in that | ||
88 | * case we fill in Device Tree compatible properties for this | ||
89 | * device. | ||
90 | */ | ||
91 | list_for_each_entry(hwid, &adev->pnp.ids, list) { | ||
92 | if (!strcmp(hwid->id, "PRP0001")) { | ||
93 | acpi_of = true; | ||
94 | break; | ||
95 | } | ||
96 | } | ||
97 | |||
98 | if (!acpi_of) | ||
99 | return; | ||
100 | |||
101 | ret = acpi_dev_get_property_array(adev, "compatible", ACPI_TYPE_STRING, | ||
102 | &of_compatible); | ||
103 | if (ret) { | ||
104 | ret = acpi_dev_get_property(adev, "compatible", | ||
105 | ACPI_TYPE_STRING, &of_compatible); | ||
106 | if (ret) { | ||
107 | acpi_handle_warn(adev->handle, | ||
108 | "PRP0001 requires compatible property\n"); | ||
109 | return; | ||
110 | } | ||
111 | } | ||
112 | adev->data.of_compatible = of_compatible; | ||
113 | } | ||
114 | |||
115 | void acpi_init_properties(struct acpi_device *adev) | ||
116 | { | ||
117 | struct acpi_buffer buf = { ACPI_ALLOCATE_BUFFER }; | ||
118 | const union acpi_object *desc; | ||
119 | acpi_status status; | ||
120 | int i; | ||
121 | |||
122 | status = acpi_evaluate_object_typed(adev->handle, "_DSD", NULL, &buf, | ||
123 | ACPI_TYPE_PACKAGE); | ||
124 | if (ACPI_FAILURE(status)) | ||
125 | return; | ||
126 | |||
127 | desc = buf.pointer; | ||
128 | if (desc->package.count % 2) | ||
129 | goto fail; | ||
130 | |||
131 | /* Look for the device properties UUID. */ | ||
132 | for (i = 0; i < desc->package.count; i += 2) { | ||
133 | const union acpi_object *uuid, *properties; | ||
134 | |||
135 | uuid = &desc->package.elements[i]; | ||
136 | properties = &desc->package.elements[i + 1]; | ||
137 | |||
138 | /* | ||
139 | * The first element must be a UUID and the second one must be | ||
140 | * a package. | ||
141 | */ | ||
142 | if (uuid->type != ACPI_TYPE_BUFFER || uuid->buffer.length != 16 | ||
143 | || properties->type != ACPI_TYPE_PACKAGE) | ||
144 | break; | ||
145 | |||
146 | if (memcmp(uuid->buffer.pointer, prp_uuid, sizeof(prp_uuid))) | ||
147 | continue; | ||
148 | |||
149 | /* | ||
150 | * We found the matching UUID. Now validate the format of the | ||
151 | * package immediately following it. | ||
152 | */ | ||
153 | if (!acpi_properties_format_valid(properties)) | ||
154 | break; | ||
155 | |||
156 | adev->data.pointer = buf.pointer; | ||
157 | adev->data.properties = properties; | ||
158 | |||
159 | acpi_init_of_compatible(adev); | ||
160 | return; | ||
161 | } | ||
162 | |||
163 | fail: | ||
164 | dev_warn(&adev->dev, "Returned _DSD data is not valid, skipping\n"); | ||
165 | ACPI_FREE(buf.pointer); | ||
166 | } | ||
167 | |||
168 | void acpi_free_properties(struct acpi_device *adev) | ||
169 | { | ||
170 | ACPI_FREE((void *)adev->data.pointer); | ||
171 | adev->data.of_compatible = NULL; | ||
172 | adev->data.pointer = NULL; | ||
173 | adev->data.properties = NULL; | ||
174 | } | ||
175 | |||
176 | /** | ||
177 | * acpi_dev_get_property - return an ACPI property with given name | ||
178 | * @adev: ACPI device to get property | ||
179 | * @name: Name of the property | ||
180 | * @type: Expected property type | ||
181 | * @obj: Location to store the property value (if not %NULL) | ||
182 | * | ||
183 | * Look up a property with @name and store a pointer to the resulting ACPI | ||
184 | * object at the location pointed to by @obj if found. | ||
185 | * | ||
186 | * Callers must not attempt to free the returned objects. These objects will be | ||
187 | * freed by the ACPI core automatically during the removal of @adev. | ||
188 | * | ||
189 | * Return: %0 if property with @name has been found (success), | ||
190 | * %-EINVAL if the arguments are invalid, | ||
191 | * %-ENODATA if the property doesn't exist, | ||
192 | * %-EPROTO if the property value type doesn't match @type. | ||
193 | */ | ||
194 | int acpi_dev_get_property(struct acpi_device *adev, const char *name, | ||
195 | acpi_object_type type, const union acpi_object **obj) | ||
196 | { | ||
197 | const union acpi_object *properties; | ||
198 | int i; | ||
199 | |||
200 | if (!adev || !name) | ||
201 | return -EINVAL; | ||
202 | |||
203 | if (!adev->data.pointer || !adev->data.properties) | ||
204 | return -ENODATA; | ||
205 | |||
206 | properties = adev->data.properties; | ||
207 | for (i = 0; i < properties->package.count; i++) { | ||
208 | const union acpi_object *propname, *propvalue; | ||
209 | const union acpi_object *property; | ||
210 | |||
211 | property = &properties->package.elements[i]; | ||
212 | |||
213 | propname = &property->package.elements[0]; | ||
214 | propvalue = &property->package.elements[1]; | ||
215 | |||
216 | if (!strcmp(name, propname->string.pointer)) { | ||
217 | if (type != ACPI_TYPE_ANY && propvalue->type != type) | ||
218 | return -EPROTO; | ||
219 | else if (obj) | ||
220 | *obj = propvalue; | ||
221 | |||
222 | return 0; | ||
223 | } | ||
224 | } | ||
225 | return -ENODATA; | ||
226 | } | ||
227 | EXPORT_SYMBOL_GPL(acpi_dev_get_property); | ||
228 | |||
229 | /** | ||
230 | * acpi_dev_get_property_array - return an ACPI array property with given name | ||
231 | * @adev: ACPI device to get property | ||
232 | * @name: Name of the property | ||
233 | * @type: Expected type of array elements | ||
234 | * @obj: Location to store a pointer to the property value (if not NULL) | ||
235 | * | ||
236 | * Look up an array property with @name and store a pointer to the resulting | ||
237 | * ACPI object at the location pointed to by @obj if found. | ||
238 | * | ||
239 | * Callers must not attempt to free the returned objects. Those objects will be | ||
240 | * freed by the ACPI core automatically during the removal of @adev. | ||
241 | * | ||
242 | * Return: %0 if array property (package) with @name has been found (success), | ||
243 | * %-EINVAL if the arguments are invalid, | ||
244 | * %-ENODATA if the property doesn't exist, | ||
245 | * %-EPROTO if the property is not a package or the type of its elements | ||
246 | * doesn't match @type. | ||
247 | */ | ||
248 | int acpi_dev_get_property_array(struct acpi_device *adev, const char *name, | ||
249 | acpi_object_type type, | ||
250 | const union acpi_object **obj) | ||
251 | { | ||
252 | const union acpi_object *prop; | ||
253 | int ret, i; | ||
254 | |||
255 | ret = acpi_dev_get_property(adev, name, ACPI_TYPE_PACKAGE, &prop); | ||
256 | if (ret) | ||
257 | return ret; | ||
258 | |||
259 | if (type != ACPI_TYPE_ANY) { | ||
260 | /* Check that all elements are of correct type. */ | ||
261 | for (i = 0; i < prop->package.count; i++) | ||
262 | if (prop->package.elements[i].type != type) | ||
263 | return -EPROTO; | ||
264 | } | ||
265 | if (obj) | ||
266 | *obj = prop; | ||
267 | |||
268 | return 0; | ||
269 | } | ||
270 | EXPORT_SYMBOL_GPL(acpi_dev_get_property_array); | ||
271 | |||
272 | /** | ||
273 | * acpi_dev_get_property_reference - returns handle to the referenced object | ||
274 | * @adev: ACPI device to get property | ||
275 | * @name: Name of the property | ||
276 | * @index: Index of the reference to return | ||
277 | * @args: Location to store the returned reference with optional arguments | ||
278 | * | ||
279 | * Find property with @name, verifify that it is a package containing at least | ||
280 | * one object reference and if so, store the ACPI device object pointer to the | ||
281 | * target object in @args->adev. If the reference includes arguments, store | ||
282 | * them in the @args->args[] array. | ||
283 | * | ||
284 | * If there's more than one reference in the property value package, @index is | ||
285 | * used to select the one to return. | ||
286 | * | ||
287 | * Return: %0 on success, negative error code on failure. | ||
288 | */ | ||
289 | int acpi_dev_get_property_reference(struct acpi_device *adev, | ||
290 | const char *name, size_t index, | ||
291 | struct acpi_reference_args *args) | ||
292 | { | ||
293 | const union acpi_object *element, *end; | ||
294 | const union acpi_object *obj; | ||
295 | struct acpi_device *device; | ||
296 | int ret, idx = 0; | ||
297 | |||
298 | ret = acpi_dev_get_property(adev, name, ACPI_TYPE_ANY, &obj); | ||
299 | if (ret) | ||
300 | return ret; | ||
301 | |||
302 | /* | ||
303 | * The simplest case is when the value is a single reference. Just | ||
304 | * return that reference then. | ||
305 | */ | ||
306 | if (obj->type == ACPI_TYPE_LOCAL_REFERENCE) { | ||
307 | if (index) | ||
308 | return -EINVAL; | ||
309 | |||
310 | ret = acpi_bus_get_device(obj->reference.handle, &device); | ||
311 | if (ret) | ||
312 | return ret; | ||
313 | |||
314 | args->adev = device; | ||
315 | args->nargs = 0; | ||
316 | return 0; | ||
317 | } | ||
318 | |||
319 | /* | ||
320 | * If it is not a single reference, then it is a package of | ||
321 | * references followed by number of ints as follows: | ||
322 | * | ||
323 | * Package () { REF, INT, REF, INT, INT } | ||
324 | * | ||
325 | * The index argument is then used to determine which reference | ||
326 | * the caller wants (along with the arguments). | ||
327 | */ | ||
328 | if (obj->type != ACPI_TYPE_PACKAGE || index >= obj->package.count) | ||
329 | return -EPROTO; | ||
330 | |||
331 | element = obj->package.elements; | ||
332 | end = element + obj->package.count; | ||
333 | |||
334 | while (element < end) { | ||
335 | u32 nargs, i; | ||
336 | |||
337 | if (element->type != ACPI_TYPE_LOCAL_REFERENCE) | ||
338 | return -EPROTO; | ||
339 | |||
340 | ret = acpi_bus_get_device(element->reference.handle, &device); | ||
341 | if (ret) | ||
342 | return -ENODEV; | ||
343 | |||
344 | element++; | ||
345 | nargs = 0; | ||
346 | |||
347 | /* assume following integer elements are all args */ | ||
348 | for (i = 0; element + i < end; i++) { | ||
349 | int type = element[i].type; | ||
350 | |||
351 | if (type == ACPI_TYPE_INTEGER) | ||
352 | nargs++; | ||
353 | else if (type == ACPI_TYPE_LOCAL_REFERENCE) | ||
354 | break; | ||
355 | else | ||
356 | return -EPROTO; | ||
357 | } | ||
358 | |||
359 | if (idx++ == index) { | ||
360 | args->adev = device; | ||
361 | args->nargs = nargs; | ||
362 | for (i = 0; i < nargs; i++) | ||
363 | args->args[i] = element[i].integer.value; | ||
364 | |||
365 | return 0; | ||
366 | } | ||
367 | |||
368 | element += nargs; | ||
369 | } | ||
370 | |||
371 | return -EPROTO; | ||
372 | } | ||
373 | EXPORT_SYMBOL_GPL(acpi_dev_get_property_reference); | ||
374 | |||
375 | int acpi_dev_prop_get(struct acpi_device *adev, const char *propname, | ||
376 | void **valptr) | ||
377 | { | ||
378 | return acpi_dev_get_property(adev, propname, ACPI_TYPE_ANY, | ||
379 | (const union acpi_object **)valptr); | ||
380 | } | ||
381 | |||
382 | int acpi_dev_prop_read_single(struct acpi_device *adev, const char *propname, | ||
383 | enum dev_prop_type proptype, void *val) | ||
384 | { | ||
385 | const union acpi_object *obj; | ||
386 | int ret; | ||
387 | |||
388 | if (!val) | ||
389 | return -EINVAL; | ||
390 | |||
391 | if (proptype >= DEV_PROP_U8 && proptype <= DEV_PROP_U64) { | ||
392 | ret = acpi_dev_get_property(adev, propname, ACPI_TYPE_INTEGER, &obj); | ||
393 | if (ret) | ||
394 | return ret; | ||
395 | |||
396 | switch (proptype) { | ||
397 | case DEV_PROP_U8: | ||
398 | if (obj->integer.value > U8_MAX) | ||
399 | return -EOVERFLOW; | ||
400 | *(u8 *)val = obj->integer.value; | ||
401 | break; | ||
402 | case DEV_PROP_U16: | ||
403 | if (obj->integer.value > U16_MAX) | ||
404 | return -EOVERFLOW; | ||
405 | *(u16 *)val = obj->integer.value; | ||
406 | break; | ||
407 | case DEV_PROP_U32: | ||
408 | if (obj->integer.value > U32_MAX) | ||
409 | return -EOVERFLOW; | ||
410 | *(u32 *)val = obj->integer.value; | ||
411 | break; | ||
412 | default: | ||
413 | *(u64 *)val = obj->integer.value; | ||
414 | break; | ||
415 | } | ||
416 | } else if (proptype == DEV_PROP_STRING) { | ||
417 | ret = acpi_dev_get_property(adev, propname, ACPI_TYPE_STRING, &obj); | ||
418 | if (ret) | ||
419 | return ret; | ||
420 | |||
421 | *(char **)val = obj->string.pointer; | ||
422 | } else { | ||
423 | ret = -EINVAL; | ||
424 | } | ||
425 | return ret; | ||
426 | } | ||
427 | |||
428 | static int acpi_copy_property_array_u8(const union acpi_object *items, u8 *val, | ||
429 | size_t nval) | ||
430 | { | ||
431 | int i; | ||
432 | |||
433 | for (i = 0; i < nval; i++) { | ||
434 | if (items[i].type != ACPI_TYPE_INTEGER) | ||
435 | return -EPROTO; | ||
436 | if (items[i].integer.value > U8_MAX) | ||
437 | return -EOVERFLOW; | ||
438 | |||
439 | val[i] = items[i].integer.value; | ||
440 | } | ||
441 | return 0; | ||
442 | } | ||
443 | |||
444 | static int acpi_copy_property_array_u16(const union acpi_object *items, | ||
445 | u16 *val, size_t nval) | ||
446 | { | ||
447 | int i; | ||
448 | |||
449 | for (i = 0; i < nval; i++) { | ||
450 | if (items[i].type != ACPI_TYPE_INTEGER) | ||
451 | return -EPROTO; | ||
452 | if (items[i].integer.value > U16_MAX) | ||
453 | return -EOVERFLOW; | ||
454 | |||
455 | val[i] = items[i].integer.value; | ||
456 | } | ||
457 | return 0; | ||
458 | } | ||
459 | |||
460 | static int acpi_copy_property_array_u32(const union acpi_object *items, | ||
461 | u32 *val, size_t nval) | ||
462 | { | ||
463 | int i; | ||
464 | |||
465 | for (i = 0; i < nval; i++) { | ||
466 | if (items[i].type != ACPI_TYPE_INTEGER) | ||
467 | return -EPROTO; | ||
468 | if (items[i].integer.value > U32_MAX) | ||
469 | return -EOVERFLOW; | ||
470 | |||
471 | val[i] = items[i].integer.value; | ||
472 | } | ||
473 | return 0; | ||
474 | } | ||
475 | |||
476 | static int acpi_copy_property_array_u64(const union acpi_object *items, | ||
477 | u64 *val, size_t nval) | ||
478 | { | ||
479 | int i; | ||
480 | |||
481 | for (i = 0; i < nval; i++) { | ||
482 | if (items[i].type != ACPI_TYPE_INTEGER) | ||
483 | return -EPROTO; | ||
484 | |||
485 | val[i] = items[i].integer.value; | ||
486 | } | ||
487 | return 0; | ||
488 | } | ||
489 | |||
490 | static int acpi_copy_property_array_string(const union acpi_object *items, | ||
491 | char **val, size_t nval) | ||
492 | { | ||
493 | int i; | ||
494 | |||
495 | for (i = 0; i < nval; i++) { | ||
496 | if (items[i].type != ACPI_TYPE_STRING) | ||
497 | return -EPROTO; | ||
498 | |||
499 | val[i] = items[i].string.pointer; | ||
500 | } | ||
501 | return 0; | ||
502 | } | ||
503 | |||
504 | int acpi_dev_prop_read(struct acpi_device *adev, const char *propname, | ||
505 | enum dev_prop_type proptype, void *val, size_t nval) | ||
506 | { | ||
507 | const union acpi_object *obj; | ||
508 | const union acpi_object *items; | ||
509 | int ret; | ||
510 | |||
511 | if (val && nval == 1) { | ||
512 | ret = acpi_dev_prop_read_single(adev, propname, proptype, val); | ||
513 | if (!ret) | ||
514 | return ret; | ||
515 | } | ||
516 | |||
517 | ret = acpi_dev_get_property_array(adev, propname, ACPI_TYPE_ANY, &obj); | ||
518 | if (ret) | ||
519 | return ret; | ||
520 | |||
521 | if (!val) | ||
522 | return obj->package.count; | ||
523 | else if (nval <= 0) | ||
524 | return -EINVAL; | ||
525 | |||
526 | if (nval > obj->package.count) | ||
527 | return -EOVERFLOW; | ||
528 | |||
529 | items = obj->package.elements; | ||
530 | switch (proptype) { | ||
531 | case DEV_PROP_U8: | ||
532 | ret = acpi_copy_property_array_u8(items, (u8 *)val, nval); | ||
533 | break; | ||
534 | case DEV_PROP_U16: | ||
535 | ret = acpi_copy_property_array_u16(items, (u16 *)val, nval); | ||
536 | break; | ||
537 | case DEV_PROP_U32: | ||
538 | ret = acpi_copy_property_array_u32(items, (u32 *)val, nval); | ||
539 | break; | ||
540 | case DEV_PROP_U64: | ||
541 | ret = acpi_copy_property_array_u64(items, (u64 *)val, nval); | ||
542 | break; | ||
543 | case DEV_PROP_STRING: | ||
544 | ret = acpi_copy_property_array_string(items, (char **)val, nval); | ||
545 | break; | ||
546 | default: | ||
547 | ret = -EINVAL; | ||
548 | break; | ||
549 | } | ||
550 | return ret; | ||
551 | } | ||
diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c index 0476e90b2091..1b1cf558d3d3 100644 --- a/drivers/acpi/scan.c +++ b/drivers/acpi/scan.c | |||
@@ -36,6 +36,8 @@ bool acpi_force_hot_remove; | |||
36 | 36 | ||
37 | static const char *dummy_hid = "device"; | 37 | static const char *dummy_hid = "device"; |
38 | 38 | ||
39 | static LIST_HEAD(acpi_dep_list); | ||
40 | static DEFINE_MUTEX(acpi_dep_list_lock); | ||
39 | static LIST_HEAD(acpi_bus_id_list); | 41 | static LIST_HEAD(acpi_bus_id_list); |
40 | static DEFINE_MUTEX(acpi_scan_lock); | 42 | static DEFINE_MUTEX(acpi_scan_lock); |
41 | static LIST_HEAD(acpi_scan_handlers_list); | 43 | static LIST_HEAD(acpi_scan_handlers_list); |
@@ -43,6 +45,12 @@ DEFINE_MUTEX(acpi_device_lock); | |||
43 | LIST_HEAD(acpi_wakeup_device_list); | 45 | LIST_HEAD(acpi_wakeup_device_list); |
44 | static DEFINE_MUTEX(acpi_hp_context_lock); | 46 | static DEFINE_MUTEX(acpi_hp_context_lock); |
45 | 47 | ||
48 | struct acpi_dep_data { | ||
49 | struct list_head node; | ||
50 | acpi_handle master; | ||
51 | acpi_handle slave; | ||
52 | }; | ||
53 | |||
46 | struct acpi_device_bus_id{ | 54 | struct acpi_device_bus_id{ |
47 | char bus_id[15]; | 55 | char bus_id[15]; |
48 | unsigned int instance_no; | 56 | unsigned int instance_no; |
@@ -124,17 +132,56 @@ static int create_modalias(struct acpi_device *acpi_dev, char *modalias, | |||
124 | if (list_empty(&acpi_dev->pnp.ids)) | 132 | if (list_empty(&acpi_dev->pnp.ids)) |
125 | return 0; | 133 | return 0; |
126 | 134 | ||
127 | len = snprintf(modalias, size, "acpi:"); | 135 | /* |
128 | size -= len; | 136 | * If the device has PRP0001 we expose DT compatible modalias |
129 | 137 | * instead in form of of:NnameTCcompatible. | |
130 | list_for_each_entry(id, &acpi_dev->pnp.ids, list) { | 138 | */ |
131 | count = snprintf(&modalias[len], size, "%s:", id->id); | 139 | if (acpi_dev->data.of_compatible) { |
132 | if (count < 0) | 140 | struct acpi_buffer buf = { ACPI_ALLOCATE_BUFFER }; |
133 | return -EINVAL; | 141 | const union acpi_object *of_compatible, *obj; |
134 | if (count >= size) | 142 | int i, nval; |
135 | return -ENOMEM; | 143 | char *c; |
136 | len += count; | 144 | |
137 | size -= count; | 145 | acpi_get_name(acpi_dev->handle, ACPI_SINGLE_NAME, &buf); |
146 | /* DT strings are all in lower case */ | ||
147 | for (c = buf.pointer; *c != '\0'; c++) | ||
148 | *c = tolower(*c); | ||
149 | |||
150 | len = snprintf(modalias, size, "of:N%sT", (char *)buf.pointer); | ||
151 | ACPI_FREE(buf.pointer); | ||
152 | |||
153 | of_compatible = acpi_dev->data.of_compatible; | ||
154 | if (of_compatible->type == ACPI_TYPE_PACKAGE) { | ||
155 | nval = of_compatible->package.count; | ||
156 | obj = of_compatible->package.elements; | ||
157 | } else { /* Must be ACPI_TYPE_STRING. */ | ||
158 | nval = 1; | ||
159 | obj = of_compatible; | ||
160 | } | ||
161 | for (i = 0; i < nval; i++, obj++) { | ||
162 | count = snprintf(&modalias[len], size, "C%s", | ||
163 | obj->string.pointer); | ||
164 | if (count < 0) | ||
165 | return -EINVAL; | ||
166 | if (count >= size) | ||
167 | return -ENOMEM; | ||
168 | |||
169 | len += count; | ||
170 | size -= count; | ||
171 | } | ||
172 | } else { | ||
173 | len = snprintf(modalias, size, "acpi:"); | ||
174 | size -= len; | ||
175 | |||
176 | list_for_each_entry(id, &acpi_dev->pnp.ids, list) { | ||
177 | count = snprintf(&modalias[len], size, "%s:", id->id); | ||
178 | if (count < 0) | ||
179 | return -EINVAL; | ||
180 | if (count >= size) | ||
181 | return -ENOMEM; | ||
182 | len += count; | ||
183 | size -= count; | ||
184 | } | ||
138 | } | 185 | } |
139 | 186 | ||
140 | modalias[len] = '\0'; | 187 | modalias[len] = '\0'; |
@@ -902,6 +949,51 @@ int acpi_match_device_ids(struct acpi_device *device, | |||
902 | } | 949 | } |
903 | EXPORT_SYMBOL(acpi_match_device_ids); | 950 | EXPORT_SYMBOL(acpi_match_device_ids); |
904 | 951 | ||
952 | /* Performs match against special "PRP0001" shoehorn ACPI ID */ | ||
953 | static bool acpi_of_driver_match_device(struct device *dev, | ||
954 | const struct device_driver *drv) | ||
955 | { | ||
956 | const union acpi_object *of_compatible, *obj; | ||
957 | struct acpi_device *adev; | ||
958 | int i, nval; | ||
959 | |||
960 | adev = ACPI_COMPANION(dev); | ||
961 | if (!adev) | ||
962 | return false; | ||
963 | |||
964 | of_compatible = adev->data.of_compatible; | ||
965 | if (!drv->of_match_table || !of_compatible) | ||
966 | return false; | ||
967 | |||
968 | if (of_compatible->type == ACPI_TYPE_PACKAGE) { | ||
969 | nval = of_compatible->package.count; | ||
970 | obj = of_compatible->package.elements; | ||
971 | } else { /* Must be ACPI_TYPE_STRING. */ | ||
972 | nval = 1; | ||
973 | obj = of_compatible; | ||
974 | } | ||
975 | /* Now we can look for the driver DT compatible strings */ | ||
976 | for (i = 0; i < nval; i++, obj++) { | ||
977 | const struct of_device_id *id; | ||
978 | |||
979 | for (id = drv->of_match_table; id->compatible[0]; id++) | ||
980 | if (!strcasecmp(obj->string.pointer, id->compatible)) | ||
981 | return true; | ||
982 | } | ||
983 | |||
984 | return false; | ||
985 | } | ||
986 | |||
987 | bool acpi_driver_match_device(struct device *dev, | ||
988 | const struct device_driver *drv) | ||
989 | { | ||
990 | if (!drv->acpi_match_table) | ||
991 | return acpi_of_driver_match_device(dev, drv); | ||
992 | |||
993 | return !!acpi_match_device(drv->acpi_match_table, dev); | ||
994 | } | ||
995 | EXPORT_SYMBOL_GPL(acpi_driver_match_device); | ||
996 | |||
905 | static void acpi_free_power_resources_lists(struct acpi_device *device) | 997 | static void acpi_free_power_resources_lists(struct acpi_device *device) |
906 | { | 998 | { |
907 | int i; | 999 | int i; |
@@ -922,6 +1014,7 @@ static void acpi_device_release(struct device *dev) | |||
922 | { | 1014 | { |
923 | struct acpi_device *acpi_dev = to_acpi_device(dev); | 1015 | struct acpi_device *acpi_dev = to_acpi_device(dev); |
924 | 1016 | ||
1017 | acpi_free_properties(acpi_dev); | ||
925 | acpi_free_pnp_ids(&acpi_dev->pnp); | 1018 | acpi_free_pnp_ids(&acpi_dev->pnp); |
926 | acpi_free_power_resources_lists(acpi_dev); | 1019 | acpi_free_power_resources_lists(acpi_dev); |
927 | kfree(acpi_dev); | 1020 | kfree(acpi_dev); |
@@ -1304,6 +1397,26 @@ int acpi_device_add(struct acpi_device *device, | |||
1304 | return result; | 1397 | return result; |
1305 | } | 1398 | } |
1306 | 1399 | ||
1400 | struct acpi_device *acpi_get_next_child(struct device *dev, | ||
1401 | struct acpi_device *child) | ||
1402 | { | ||
1403 | struct acpi_device *adev = ACPI_COMPANION(dev); | ||
1404 | struct list_head *head, *next; | ||
1405 | |||
1406 | if (!adev) | ||
1407 | return NULL; | ||
1408 | |||
1409 | head = &adev->children; | ||
1410 | if (list_empty(head)) | ||
1411 | return NULL; | ||
1412 | |||
1413 | if (!child) | ||
1414 | return list_first_entry(head, struct acpi_device, node); | ||
1415 | |||
1416 | next = child->node.next; | ||
1417 | return next == head ? NULL : list_entry(next, struct acpi_device, node); | ||
1418 | } | ||
1419 | |||
1307 | /* -------------------------------------------------------------------------- | 1420 | /* -------------------------------------------------------------------------- |
1308 | Driver Management | 1421 | Driver Management |
1309 | -------------------------------------------------------------------------- */ | 1422 | -------------------------------------------------------------------------- */ |
@@ -1923,9 +2036,11 @@ void acpi_init_device_object(struct acpi_device *device, acpi_handle handle, | |||
1923 | device->device_type = type; | 2036 | device->device_type = type; |
1924 | device->handle = handle; | 2037 | device->handle = handle; |
1925 | device->parent = acpi_bus_get_parent(handle); | 2038 | device->parent = acpi_bus_get_parent(handle); |
2039 | device->fwnode.type = FWNODE_ACPI; | ||
1926 | acpi_set_device_status(device, sta); | 2040 | acpi_set_device_status(device, sta); |
1927 | acpi_device_get_busid(device); | 2041 | acpi_device_get_busid(device); |
1928 | acpi_set_pnp_ids(handle, &device->pnp, type); | 2042 | acpi_set_pnp_ids(handle, &device->pnp, type); |
2043 | acpi_init_properties(device); | ||
1929 | acpi_bus_get_flags(device); | 2044 | acpi_bus_get_flags(device); |
1930 | device->flags.match_driver = false; | 2045 | device->flags.match_driver = false; |
1931 | device->flags.initialized = true; | 2046 | device->flags.initialized = true; |
@@ -2086,6 +2201,59 @@ static void acpi_scan_init_hotplug(struct acpi_device *adev) | |||
2086 | } | 2201 | } |
2087 | } | 2202 | } |
2088 | 2203 | ||
2204 | static void acpi_device_dep_initialize(struct acpi_device *adev) | ||
2205 | { | ||
2206 | struct acpi_dep_data *dep; | ||
2207 | struct acpi_handle_list dep_devices; | ||
2208 | acpi_status status; | ||
2209 | int i; | ||
2210 | |||
2211 | if (!acpi_has_method(adev->handle, "_DEP")) | ||
2212 | return; | ||
2213 | |||
2214 | status = acpi_evaluate_reference(adev->handle, "_DEP", NULL, | ||
2215 | &dep_devices); | ||
2216 | if (ACPI_FAILURE(status)) { | ||
2217 | dev_err(&adev->dev, "Failed to evaluate _DEP.\n"); | ||
2218 | return; | ||
2219 | } | ||
2220 | |||
2221 | for (i = 0; i < dep_devices.count; i++) { | ||
2222 | struct acpi_device_info *info; | ||
2223 | int skip; | ||
2224 | |||
2225 | status = acpi_get_object_info(dep_devices.handles[i], &info); | ||
2226 | if (ACPI_FAILURE(status)) { | ||
2227 | dev_err(&adev->dev, "Error reading device info\n"); | ||
2228 | continue; | ||
2229 | } | ||
2230 | |||
2231 | /* | ||
2232 | * Skip the dependency of Windows System Power | ||
2233 | * Management Controller | ||
2234 | */ | ||
2235 | skip = info->valid & ACPI_VALID_HID && | ||
2236 | !strcmp(info->hardware_id.string, "INT3396"); | ||
2237 | |||
2238 | kfree(info); | ||
2239 | |||
2240 | if (skip) | ||
2241 | continue; | ||
2242 | |||
2243 | dep = kzalloc(sizeof(struct acpi_dep_data), GFP_KERNEL); | ||
2244 | if (!dep) | ||
2245 | return; | ||
2246 | |||
2247 | dep->master = dep_devices.handles[i]; | ||
2248 | dep->slave = adev->handle; | ||
2249 | adev->dep_unmet++; | ||
2250 | |||
2251 | mutex_lock(&acpi_dep_list_lock); | ||
2252 | list_add_tail(&dep->node , &acpi_dep_list); | ||
2253 | mutex_unlock(&acpi_dep_list_lock); | ||
2254 | } | ||
2255 | } | ||
2256 | |||
2089 | static acpi_status acpi_bus_check_add(acpi_handle handle, u32 lvl_not_used, | 2257 | static acpi_status acpi_bus_check_add(acpi_handle handle, u32 lvl_not_used, |
2090 | void *not_used, void **return_value) | 2258 | void *not_used, void **return_value) |
2091 | { | 2259 | { |
@@ -2112,6 +2280,7 @@ static acpi_status acpi_bus_check_add(acpi_handle handle, u32 lvl_not_used, | |||
2112 | return AE_CTRL_DEPTH; | 2280 | return AE_CTRL_DEPTH; |
2113 | 2281 | ||
2114 | acpi_scan_init_hotplug(device); | 2282 | acpi_scan_init_hotplug(device); |
2283 | acpi_device_dep_initialize(device); | ||
2115 | 2284 | ||
2116 | out: | 2285 | out: |
2117 | if (!*return_value) | 2286 | if (!*return_value) |
@@ -2232,6 +2401,29 @@ static void acpi_bus_attach(struct acpi_device *device) | |||
2232 | device->handler->hotplug.notify_online(device); | 2401 | device->handler->hotplug.notify_online(device); |
2233 | } | 2402 | } |
2234 | 2403 | ||
2404 | void acpi_walk_dep_device_list(acpi_handle handle) | ||
2405 | { | ||
2406 | struct acpi_dep_data *dep, *tmp; | ||
2407 | struct acpi_device *adev; | ||
2408 | |||
2409 | mutex_lock(&acpi_dep_list_lock); | ||
2410 | list_for_each_entry_safe(dep, tmp, &acpi_dep_list, node) { | ||
2411 | if (dep->master == handle) { | ||
2412 | acpi_bus_get_device(dep->slave, &adev); | ||
2413 | if (!adev) | ||
2414 | continue; | ||
2415 | |||
2416 | adev->dep_unmet--; | ||
2417 | if (!adev->dep_unmet) | ||
2418 | acpi_bus_attach(adev); | ||
2419 | list_del(&dep->node); | ||
2420 | kfree(dep); | ||
2421 | } | ||
2422 | } | ||
2423 | mutex_unlock(&acpi_dep_list_lock); | ||
2424 | } | ||
2425 | EXPORT_SYMBOL_GPL(acpi_walk_dep_device_list); | ||
2426 | |||
2235 | /** | 2427 | /** |
2236 | * acpi_bus_scan - Add ACPI device node objects in a given namespace scope. | 2428 | * acpi_bus_scan - Add ACPI device node objects in a given namespace scope. |
2237 | * @handle: Root of the namespace scope to scan. | 2429 | * @handle: Root of the namespace scope to scan. |
diff --git a/drivers/acpi/sleep.c b/drivers/acpi/sleep.c index 05a31b573fc3..8aa9254a387f 100644 --- a/drivers/acpi/sleep.c +++ b/drivers/acpi/sleep.c | |||
@@ -630,6 +630,7 @@ static int acpi_freeze_begin(void) | |||
630 | static int acpi_freeze_prepare(void) | 630 | static int acpi_freeze_prepare(void) |
631 | { | 631 | { |
632 | acpi_enable_all_wakeup_gpes(); | 632 | acpi_enable_all_wakeup_gpes(); |
633 | acpi_os_wait_events_complete(); | ||
633 | enable_irq_wake(acpi_gbl_FADT.sci_interrupt); | 634 | enable_irq_wake(acpi_gbl_FADT.sci_interrupt); |
634 | return 0; | 635 | return 0; |
635 | } | 636 | } |
@@ -825,6 +826,7 @@ static void acpi_power_off_prepare(void) | |||
825 | /* Prepare to power off the system */ | 826 | /* Prepare to power off the system */ |
826 | acpi_sleep_prepare(ACPI_STATE_S5); | 827 | acpi_sleep_prepare(ACPI_STATE_S5); |
827 | acpi_disable_all_gpes(); | 828 | acpi_disable_all_gpes(); |
829 | acpi_os_wait_events_complete(); | ||
828 | } | 830 | } |
829 | 831 | ||
830 | static void acpi_power_off(void) | 832 | static void acpi_power_off(void) |
diff --git a/drivers/acpi/tables.c b/drivers/acpi/tables.c index 6d5a6cda0734..93b81523a2fe 100644 --- a/drivers/acpi/tables.c +++ b/drivers/acpi/tables.c | |||
@@ -190,30 +190,24 @@ void acpi_table_print_madt_entry(struct acpi_subtable_header *header) | |||
190 | } | 190 | } |
191 | } | 191 | } |
192 | 192 | ||
193 | |||
194 | int __init | 193 | int __init |
195 | acpi_table_parse_entries(char *id, | 194 | acpi_parse_entries(char *id, unsigned long table_size, |
196 | unsigned long table_size, | 195 | acpi_tbl_entry_handler handler, |
197 | int entry_id, | 196 | struct acpi_table_header *table_header, |
198 | acpi_tbl_entry_handler handler, | 197 | int entry_id, unsigned int max_entries) |
199 | unsigned int max_entries) | ||
200 | { | 198 | { |
201 | struct acpi_table_header *table_header = NULL; | ||
202 | struct acpi_subtable_header *entry; | 199 | struct acpi_subtable_header *entry; |
203 | unsigned int count = 0; | 200 | int count = 0; |
204 | unsigned long table_end; | 201 | unsigned long table_end; |
205 | acpi_size tbl_size; | ||
206 | 202 | ||
207 | if (acpi_disabled) | 203 | if (acpi_disabled) |
208 | return -ENODEV; | 204 | return -ENODEV; |
209 | 205 | ||
210 | if (!handler) | 206 | if (!id || !handler) |
211 | return -EINVAL; | 207 | return -EINVAL; |
212 | 208 | ||
213 | if (strncmp(id, ACPI_SIG_MADT, 4) == 0) | 209 | if (!table_size) |
214 | acpi_get_table_with_size(id, acpi_apic_instance, &table_header, &tbl_size); | 210 | return -EINVAL; |
215 | else | ||
216 | acpi_get_table_with_size(id, 0, &table_header, &tbl_size); | ||
217 | 211 | ||
218 | if (!table_header) { | 212 | if (!table_header) { |
219 | pr_warn("%4.4s not present\n", id); | 213 | pr_warn("%4.4s not present\n", id); |
@@ -230,9 +224,12 @@ acpi_table_parse_entries(char *id, | |||
230 | while (((unsigned long)entry) + sizeof(struct acpi_subtable_header) < | 224 | while (((unsigned long)entry) + sizeof(struct acpi_subtable_header) < |
231 | table_end) { | 225 | table_end) { |
232 | if (entry->type == entry_id | 226 | if (entry->type == entry_id |
233 | && (!max_entries || count++ < max_entries)) | 227 | && (!max_entries || count < max_entries)) { |
234 | if (handler(entry, table_end)) | 228 | if (handler(entry, table_end)) |
235 | goto err; | 229 | return -EINVAL; |
230 | |||
231 | count++; | ||
232 | } | ||
236 | 233 | ||
237 | /* | 234 | /* |
238 | * If entry->length is 0, break from this loop to avoid | 235 | * If entry->length is 0, break from this loop to avoid |
@@ -240,22 +237,53 @@ acpi_table_parse_entries(char *id, | |||
240 | */ | 237 | */ |
241 | if (entry->length == 0) { | 238 | if (entry->length == 0) { |
242 | pr_err("[%4.4s:0x%02x] Invalid zero length\n", id, entry_id); | 239 | pr_err("[%4.4s:0x%02x] Invalid zero length\n", id, entry_id); |
243 | goto err; | 240 | return -EINVAL; |
244 | } | 241 | } |
245 | 242 | ||
246 | entry = (struct acpi_subtable_header *) | 243 | entry = (struct acpi_subtable_header *) |
247 | ((unsigned long)entry + entry->length); | 244 | ((unsigned long)entry + entry->length); |
248 | } | 245 | } |
246 | |||
249 | if (max_entries && count > max_entries) { | 247 | if (max_entries && count > max_entries) { |
250 | pr_warn("[%4.4s:0x%02x] ignored %i entries of %i found\n", | 248 | pr_warn("[%4.4s:0x%02x] ignored %i entries of %i found\n", |
251 | id, entry_id, count - max_entries, count); | 249 | id, entry_id, count - max_entries, count); |
252 | } | 250 | } |
253 | 251 | ||
254 | early_acpi_os_unmap_memory((char *)table_header, tbl_size); | ||
255 | return count; | 252 | return count; |
256 | err: | 253 | } |
254 | |||
255 | int __init | ||
256 | acpi_table_parse_entries(char *id, | ||
257 | unsigned long table_size, | ||
258 | int entry_id, | ||
259 | acpi_tbl_entry_handler handler, | ||
260 | unsigned int max_entries) | ||
261 | { | ||
262 | struct acpi_table_header *table_header = NULL; | ||
263 | acpi_size tbl_size; | ||
264 | int count; | ||
265 | u32 instance = 0; | ||
266 | |||
267 | if (acpi_disabled) | ||
268 | return -ENODEV; | ||
269 | |||
270 | if (!id || !handler) | ||
271 | return -EINVAL; | ||
272 | |||
273 | if (!strncmp(id, ACPI_SIG_MADT, 4)) | ||
274 | instance = acpi_apic_instance; | ||
275 | |||
276 | acpi_get_table_with_size(id, instance, &table_header, &tbl_size); | ||
277 | if (!table_header) { | ||
278 | pr_warn("%4.4s not present\n", id); | ||
279 | return -ENODEV; | ||
280 | } | ||
281 | |||
282 | count = acpi_parse_entries(id, table_size, handler, table_header, | ||
283 | entry_id, max_entries); | ||
284 | |||
257 | early_acpi_os_unmap_memory((char *)table_header, tbl_size); | 285 | early_acpi_os_unmap_memory((char *)table_header, tbl_size); |
258 | return -EINVAL; | 286 | return count; |
259 | } | 287 | } |
260 | 288 | ||
261 | int __init | 289 | int __init |
diff --git a/drivers/acpi/utils.c b/drivers/acpi/utils.c index 371ac12d25b1..dd8ff63ee2b4 100644 --- a/drivers/acpi/utils.c +++ b/drivers/acpi/utils.c | |||
@@ -136,8 +136,7 @@ acpi_extract_package(union acpi_object *package, | |||
136 | break; | 136 | break; |
137 | case 'B': | 137 | case 'B': |
138 | size_required += | 138 | size_required += |
139 | sizeof(u8 *) + | 139 | sizeof(u8 *) + element->buffer.length; |
140 | (element->buffer.length * sizeof(u8)); | ||
141 | tail_offset += sizeof(u8 *); | 140 | tail_offset += sizeof(u8 *); |
142 | break; | 141 | break; |
143 | default: | 142 | default: |
@@ -255,7 +254,7 @@ acpi_extract_package(union acpi_object *package, | |||
255 | memcpy(tail, element->buffer.pointer, | 254 | memcpy(tail, element->buffer.pointer, |
256 | element->buffer.length); | 255 | element->buffer.length); |
257 | head += sizeof(u8 *); | 256 | head += sizeof(u8 *); |
258 | tail += element->buffer.length * sizeof(u8); | 257 | tail += element->buffer.length; |
259 | break; | 258 | break; |
260 | default: | 259 | default: |
261 | /* Should never get here */ | 260 | /* Should never get here */ |
diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c index 807a88a0f394..185a57d13723 100644 --- a/drivers/acpi/video.c +++ b/drivers/acpi/video.c | |||
@@ -1164,7 +1164,8 @@ static bool acpi_video_device_in_dod(struct acpi_video_device *device) | |||
1164 | return true; | 1164 | return true; |
1165 | 1165 | ||
1166 | for (i = 0; i < video->attached_count; i++) { | 1166 | for (i = 0; i < video->attached_count; i++) { |
1167 | if (video->attached_array[i].bind_info == device) | 1167 | if ((video->attached_array[i].value.int_val & 0xfff) == |
1168 | (device->device_id & 0xfff)) | ||
1168 | return true; | 1169 | return true; |
1169 | } | 1170 | } |
1170 | 1171 | ||
@@ -1680,6 +1681,19 @@ static void acpi_video_dev_register_backlight(struct acpi_video_device *device) | |||
1680 | printk(KERN_ERR PREFIX "Create sysfs link\n"); | 1681 | printk(KERN_ERR PREFIX "Create sysfs link\n"); |
1681 | } | 1682 | } |
1682 | 1683 | ||
1684 | static void acpi_video_run_bcl_for_osi(struct acpi_video_bus *video) | ||
1685 | { | ||
1686 | struct acpi_video_device *dev; | ||
1687 | union acpi_object *levels; | ||
1688 | |||
1689 | mutex_lock(&video->device_list_lock); | ||
1690 | list_for_each_entry(dev, &video->video_device_list, entry) { | ||
1691 | if (!acpi_video_device_lcd_query_levels(dev, &levels)) | ||
1692 | kfree(levels); | ||
1693 | } | ||
1694 | mutex_unlock(&video->device_list_lock); | ||
1695 | } | ||
1696 | |||
1683 | static int acpi_video_bus_register_backlight(struct acpi_video_bus *video) | 1697 | static int acpi_video_bus_register_backlight(struct acpi_video_bus *video) |
1684 | { | 1698 | { |
1685 | struct acpi_video_device *dev; | 1699 | struct acpi_video_device *dev; |
@@ -1687,6 +1701,8 @@ static int acpi_video_bus_register_backlight(struct acpi_video_bus *video) | |||
1687 | if (video->backlight_registered) | 1701 | if (video->backlight_registered) |
1688 | return 0; | 1702 | return 0; |
1689 | 1703 | ||
1704 | acpi_video_run_bcl_for_osi(video); | ||
1705 | |||
1690 | if (!acpi_video_verify_backlight_support()) | 1706 | if (!acpi_video_verify_backlight_support()) |
1691 | return 0; | 1707 | return 0; |
1692 | 1708 | ||
diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c index e45f83789809..49f1e6890587 100644 --- a/drivers/ata/ahci.c +++ b/drivers/ata/ahci.c | |||
@@ -321,6 +321,9 @@ static const struct pci_device_id ahci_pci_tbl[] = { | |||
321 | { PCI_VDEVICE(INTEL, 0x8c87), board_ahci }, /* 9 Series RAID */ | 321 | { PCI_VDEVICE(INTEL, 0x8c87), board_ahci }, /* 9 Series RAID */ |
322 | { PCI_VDEVICE(INTEL, 0x8c8e), board_ahci }, /* 9 Series RAID */ | 322 | { PCI_VDEVICE(INTEL, 0x8c8e), board_ahci }, /* 9 Series RAID */ |
323 | { PCI_VDEVICE(INTEL, 0x8c8f), board_ahci }, /* 9 Series RAID */ | 323 | { PCI_VDEVICE(INTEL, 0x8c8f), board_ahci }, /* 9 Series RAID */ |
324 | { PCI_VDEVICE(INTEL, 0x9d03), board_ahci }, /* Sunrise Point-LP AHCI */ | ||
325 | { PCI_VDEVICE(INTEL, 0x9d05), board_ahci }, /* Sunrise Point-LP RAID */ | ||
326 | { PCI_VDEVICE(INTEL, 0x9d07), board_ahci }, /* Sunrise Point-LP RAID */ | ||
324 | { PCI_VDEVICE(INTEL, 0xa103), board_ahci }, /* Sunrise Point-H AHCI */ | 327 | { PCI_VDEVICE(INTEL, 0xa103), board_ahci }, /* Sunrise Point-H AHCI */ |
325 | { PCI_VDEVICE(INTEL, 0xa103), board_ahci }, /* Sunrise Point-H RAID */ | 328 | { PCI_VDEVICE(INTEL, 0xa103), board_ahci }, /* Sunrise Point-H RAID */ |
326 | { PCI_VDEVICE(INTEL, 0xa105), board_ahci }, /* Sunrise Point-H RAID */ | 329 | { PCI_VDEVICE(INTEL, 0xa105), board_ahci }, /* Sunrise Point-H RAID */ |
@@ -492,6 +495,7 @@ static const struct pci_device_id ahci_pci_tbl[] = { | |||
492 | * enabled. https://bugzilla.kernel.org/show_bug.cgi?id=60731 | 495 | * enabled. https://bugzilla.kernel.org/show_bug.cgi?id=60731 |
493 | */ | 496 | */ |
494 | { PCI_VDEVICE(SAMSUNG, 0x1600), board_ahci_nomsi }, | 497 | { PCI_VDEVICE(SAMSUNG, 0x1600), board_ahci_nomsi }, |
498 | { PCI_VDEVICE(SAMSUNG, 0xa800), board_ahci_nomsi }, | ||
495 | 499 | ||
496 | /* Enmotus */ | 500 | /* Enmotus */ |
497 | { PCI_DEVICE(0x1c44, 0x8000), board_ahci }, | 501 | { PCI_DEVICE(0x1c44, 0x8000), board_ahci }, |
diff --git a/drivers/ata/sata_fsl.c b/drivers/ata/sata_fsl.c index 07bc7e4dbd04..65071591b143 100644 --- a/drivers/ata/sata_fsl.c +++ b/drivers/ata/sata_fsl.c | |||
@@ -1488,7 +1488,7 @@ static int sata_fsl_probe(struct platform_device *ofdev) | |||
1488 | host_priv->csr_base = csr_base; | 1488 | host_priv->csr_base = csr_base; |
1489 | 1489 | ||
1490 | irq = irq_of_parse_and_map(ofdev->dev.of_node, 0); | 1490 | irq = irq_of_parse_and_map(ofdev->dev.of_node, 0); |
1491 | if (irq < 0) { | 1491 | if (!irq) { |
1492 | dev_err(&ofdev->dev, "invalid irq from platform\n"); | 1492 | dev_err(&ofdev->dev, "invalid irq from platform\n"); |
1493 | goto error_exit_with_cleanup; | 1493 | goto error_exit_with_cleanup; |
1494 | } | 1494 | } |
diff --git a/drivers/atm/solos-pci.c b/drivers/atm/solos-pci.c index 7652e8dc188f..21b0bc6a9c96 100644 --- a/drivers/atm/solos-pci.c +++ b/drivers/atm/solos-pci.c | |||
@@ -1225,11 +1225,13 @@ static int fpga_probe(struct pci_dev *dev, const struct pci_device_id *id) | |||
1225 | card->config_regs = pci_iomap(dev, 0, CONFIG_RAM_SIZE); | 1225 | card->config_regs = pci_iomap(dev, 0, CONFIG_RAM_SIZE); |
1226 | if (!card->config_regs) { | 1226 | if (!card->config_regs) { |
1227 | dev_warn(&dev->dev, "Failed to ioremap config registers\n"); | 1227 | dev_warn(&dev->dev, "Failed to ioremap config registers\n"); |
1228 | err = -ENOMEM; | ||
1228 | goto out_release_regions; | 1229 | goto out_release_regions; |
1229 | } | 1230 | } |
1230 | card->buffers = pci_iomap(dev, 1, DATA_RAM_SIZE); | 1231 | card->buffers = pci_iomap(dev, 1, DATA_RAM_SIZE); |
1231 | if (!card->buffers) { | 1232 | if (!card->buffers) { |
1232 | dev_warn(&dev->dev, "Failed to ioremap data buffers\n"); | 1233 | dev_warn(&dev->dev, "Failed to ioremap data buffers\n"); |
1234 | err = -ENOMEM; | ||
1233 | goto out_unmap_config; | 1235 | goto out_unmap_config; |
1234 | } | 1236 | } |
1235 | 1237 | ||
diff --git a/drivers/base/Makefile b/drivers/base/Makefile index 6922cd6850a2..53c3fe1aeb29 100644 --- a/drivers/base/Makefile +++ b/drivers/base/Makefile | |||
@@ -4,7 +4,7 @@ obj-y := component.o core.o bus.o dd.o syscore.o \ | |||
4 | driver.o class.o platform.o \ | 4 | driver.o class.o platform.o \ |
5 | cpu.o firmware.o init.o map.o devres.o \ | 5 | cpu.o firmware.o init.o map.o devres.o \ |
6 | attribute_container.o transport_class.o \ | 6 | attribute_container.o transport_class.o \ |
7 | topology.o container.o | 7 | topology.o container.o property.o |
8 | obj-$(CONFIG_DEVTMPFS) += devtmpfs.o | 8 | obj-$(CONFIG_DEVTMPFS) += devtmpfs.o |
9 | obj-$(CONFIG_DMA_CMA) += dma-contiguous.o | 9 | obj-$(CONFIG_DMA_CMA) += dma-contiguous.o |
10 | obj-y += power/ | 10 | obj-y += power/ |
diff --git a/drivers/base/power/clock_ops.c b/drivers/base/power/clock_ops.c index 78369305e069..b32b5d47b3c5 100644 --- a/drivers/base/power/clock_ops.c +++ b/drivers/base/power/clock_ops.c | |||
@@ -12,6 +12,7 @@ | |||
12 | #include <linux/pm.h> | 12 | #include <linux/pm.h> |
13 | #include <linux/pm_clock.h> | 13 | #include <linux/pm_clock.h> |
14 | #include <linux/clk.h> | 14 | #include <linux/clk.h> |
15 | #include <linux/clkdev.h> | ||
15 | #include <linux/slab.h> | 16 | #include <linux/slab.h> |
16 | #include <linux/err.h> | 17 | #include <linux/err.h> |
17 | 18 | ||
@@ -34,14 +35,20 @@ struct pm_clock_entry { | |||
34 | /** | 35 | /** |
35 | * pm_clk_enable - Enable a clock, reporting any errors | 36 | * pm_clk_enable - Enable a clock, reporting any errors |
36 | * @dev: The device for the given clock | 37 | * @dev: The device for the given clock |
37 | * @clk: The clock being enabled. | 38 | * @ce: PM clock entry corresponding to the clock. |
38 | */ | 39 | */ |
39 | static inline int __pm_clk_enable(struct device *dev, struct clk *clk) | 40 | static inline int __pm_clk_enable(struct device *dev, struct pm_clock_entry *ce) |
40 | { | 41 | { |
41 | int ret = clk_enable(clk); | 42 | int ret; |
42 | if (ret) | 43 | |
43 | dev_err(dev, "%s: failed to enable clk %p, error %d\n", | 44 | if (ce->status < PCE_STATUS_ERROR) { |
44 | __func__, clk, ret); | 45 | ret = clk_enable(ce->clk); |
46 | if (!ret) | ||
47 | ce->status = PCE_STATUS_ENABLED; | ||
48 | else | ||
49 | dev_err(dev, "%s: failed to enable clk %p, error %d\n", | ||
50 | __func__, ce->clk, ret); | ||
51 | } | ||
45 | 52 | ||
46 | return ret; | 53 | return ret; |
47 | } | 54 | } |
@@ -53,7 +60,8 @@ static inline int __pm_clk_enable(struct device *dev, struct clk *clk) | |||
53 | */ | 60 | */ |
54 | static void pm_clk_acquire(struct device *dev, struct pm_clock_entry *ce) | 61 | static void pm_clk_acquire(struct device *dev, struct pm_clock_entry *ce) |
55 | { | 62 | { |
56 | ce->clk = clk_get(dev, ce->con_id); | 63 | if (!ce->clk) |
64 | ce->clk = clk_get(dev, ce->con_id); | ||
57 | if (IS_ERR(ce->clk)) { | 65 | if (IS_ERR(ce->clk)) { |
58 | ce->status = PCE_STATUS_ERROR; | 66 | ce->status = PCE_STATUS_ERROR; |
59 | } else { | 67 | } else { |
@@ -63,15 +71,8 @@ static void pm_clk_acquire(struct device *dev, struct pm_clock_entry *ce) | |||
63 | } | 71 | } |
64 | } | 72 | } |
65 | 73 | ||
66 | /** | 74 | static int __pm_clk_add(struct device *dev, const char *con_id, |
67 | * pm_clk_add - Start using a device clock for power management. | 75 | struct clk *clk) |
68 | * @dev: Device whose clock is going to be used for power management. | ||
69 | * @con_id: Connection ID of the clock. | ||
70 | * | ||
71 | * Add the clock represented by @con_id to the list of clocks used for | ||
72 | * the power management of @dev. | ||
73 | */ | ||
74 | int pm_clk_add(struct device *dev, const char *con_id) | ||
75 | { | 76 | { |
76 | struct pm_subsys_data *psd = dev_to_psd(dev); | 77 | struct pm_subsys_data *psd = dev_to_psd(dev); |
77 | struct pm_clock_entry *ce; | 78 | struct pm_clock_entry *ce; |
@@ -93,6 +94,12 @@ int pm_clk_add(struct device *dev, const char *con_id) | |||
93 | kfree(ce); | 94 | kfree(ce); |
94 | return -ENOMEM; | 95 | return -ENOMEM; |
95 | } | 96 | } |
97 | } else { | ||
98 | if (IS_ERR(ce->clk) || !__clk_get(clk)) { | ||
99 | kfree(ce); | ||
100 | return -ENOENT; | ||
101 | } | ||
102 | ce->clk = clk; | ||
96 | } | 103 | } |
97 | 104 | ||
98 | pm_clk_acquire(dev, ce); | 105 | pm_clk_acquire(dev, ce); |
@@ -104,6 +111,32 @@ int pm_clk_add(struct device *dev, const char *con_id) | |||
104 | } | 111 | } |
105 | 112 | ||
106 | /** | 113 | /** |
114 | * pm_clk_add - Start using a device clock for power management. | ||
115 | * @dev: Device whose clock is going to be used for power management. | ||
116 | * @con_id: Connection ID of the clock. | ||
117 | * | ||
118 | * Add the clock represented by @con_id to the list of clocks used for | ||
119 | * the power management of @dev. | ||
120 | */ | ||
121 | int pm_clk_add(struct device *dev, const char *con_id) | ||
122 | { | ||
123 | return __pm_clk_add(dev, con_id, NULL); | ||
124 | } | ||
125 | |||
126 | /** | ||
127 | * pm_clk_add_clk - Start using a device clock for power management. | ||
128 | * @dev: Device whose clock is going to be used for power management. | ||
129 | * @clk: Clock pointer | ||
130 | * | ||
131 | * Add the clock to the list of clocks used for the power management of @dev. | ||
132 | * It will increment refcount on clock pointer, use clk_put() on it when done. | ||
133 | */ | ||
134 | int pm_clk_add_clk(struct device *dev, struct clk *clk) | ||
135 | { | ||
136 | return __pm_clk_add(dev, NULL, clk); | ||
137 | } | ||
138 | |||
139 | /** | ||
107 | * __pm_clk_remove - Destroy PM clock entry. | 140 | * __pm_clk_remove - Destroy PM clock entry. |
108 | * @ce: PM clock entry to destroy. | 141 | * @ce: PM clock entry to destroy. |
109 | */ | 142 | */ |
@@ -266,7 +299,6 @@ int pm_clk_resume(struct device *dev) | |||
266 | struct pm_subsys_data *psd = dev_to_psd(dev); | 299 | struct pm_subsys_data *psd = dev_to_psd(dev); |
267 | struct pm_clock_entry *ce; | 300 | struct pm_clock_entry *ce; |
268 | unsigned long flags; | 301 | unsigned long flags; |
269 | int ret; | ||
270 | 302 | ||
271 | dev_dbg(dev, "%s()\n", __func__); | 303 | dev_dbg(dev, "%s()\n", __func__); |
272 | 304 | ||
@@ -275,13 +307,8 @@ int pm_clk_resume(struct device *dev) | |||
275 | 307 | ||
276 | spin_lock_irqsave(&psd->lock, flags); | 308 | spin_lock_irqsave(&psd->lock, flags); |
277 | 309 | ||
278 | list_for_each_entry(ce, &psd->clock_list, node) { | 310 | list_for_each_entry(ce, &psd->clock_list, node) |
279 | if (ce->status < PCE_STATUS_ERROR) { | 311 | __pm_clk_enable(dev, ce); |
280 | ret = __pm_clk_enable(dev, ce->clk); | ||
281 | if (!ret) | ||
282 | ce->status = PCE_STATUS_ENABLED; | ||
283 | } | ||
284 | } | ||
285 | 312 | ||
286 | spin_unlock_irqrestore(&psd->lock, flags); | 313 | spin_unlock_irqrestore(&psd->lock, flags); |
287 | 314 | ||
@@ -390,7 +417,6 @@ int pm_clk_resume(struct device *dev) | |||
390 | struct pm_subsys_data *psd = dev_to_psd(dev); | 417 | struct pm_subsys_data *psd = dev_to_psd(dev); |
391 | struct pm_clock_entry *ce; | 418 | struct pm_clock_entry *ce; |
392 | unsigned long flags; | 419 | unsigned long flags; |
393 | int ret; | ||
394 | 420 | ||
395 | dev_dbg(dev, "%s()\n", __func__); | 421 | dev_dbg(dev, "%s()\n", __func__); |
396 | 422 | ||
@@ -400,13 +426,8 @@ int pm_clk_resume(struct device *dev) | |||
400 | 426 | ||
401 | spin_lock_irqsave(&psd->lock, flags); | 427 | spin_lock_irqsave(&psd->lock, flags); |
402 | 428 | ||
403 | list_for_each_entry(ce, &psd->clock_list, node) { | 429 | list_for_each_entry(ce, &psd->clock_list, node) |
404 | if (ce->status < PCE_STATUS_ERROR) { | 430 | __pm_clk_enable(dev, ce); |
405 | ret = __pm_clk_enable(dev, ce->clk); | ||
406 | if (!ret) | ||
407 | ce->status = PCE_STATUS_ENABLED; | ||
408 | } | ||
409 | } | ||
410 | 431 | ||
411 | spin_unlock_irqrestore(&psd->lock, flags); | 432 | spin_unlock_irqrestore(&psd->lock, flags); |
412 | 433 | ||
diff --git a/drivers/base/power/opp.c b/drivers/base/power/opp.c index 89ced955fafa..2d195f3a1998 100644 --- a/drivers/base/power/opp.c +++ b/drivers/base/power/opp.c | |||
@@ -49,11 +49,12 @@ | |||
49 | * are protected by the dev_opp_list_lock for integrity. | 49 | * are protected by the dev_opp_list_lock for integrity. |
50 | * IMPORTANT: the opp nodes should be maintained in increasing | 50 | * IMPORTANT: the opp nodes should be maintained in increasing |
51 | * order. | 51 | * order. |
52 | * @dynamic: not-created from static DT entries. | ||
52 | * @available: true/false - marks if this OPP as available or not | 53 | * @available: true/false - marks if this OPP as available or not |
53 | * @rate: Frequency in hertz | 54 | * @rate: Frequency in hertz |
54 | * @u_volt: Nominal voltage in microvolts corresponding to this OPP | 55 | * @u_volt: Nominal voltage in microvolts corresponding to this OPP |
55 | * @dev_opp: points back to the device_opp struct this opp belongs to | 56 | * @dev_opp: points back to the device_opp struct this opp belongs to |
56 | * @head: RCU callback head used for deferred freeing | 57 | * @rcu_head: RCU callback head used for deferred freeing |
57 | * | 58 | * |
58 | * This structure stores the OPP information for a given device. | 59 | * This structure stores the OPP information for a given device. |
59 | */ | 60 | */ |
@@ -61,11 +62,12 @@ struct dev_pm_opp { | |||
61 | struct list_head node; | 62 | struct list_head node; |
62 | 63 | ||
63 | bool available; | 64 | bool available; |
65 | bool dynamic; | ||
64 | unsigned long rate; | 66 | unsigned long rate; |
65 | unsigned long u_volt; | 67 | unsigned long u_volt; |
66 | 68 | ||
67 | struct device_opp *dev_opp; | 69 | struct device_opp *dev_opp; |
68 | struct rcu_head head; | 70 | struct rcu_head rcu_head; |
69 | }; | 71 | }; |
70 | 72 | ||
71 | /** | 73 | /** |
@@ -76,7 +78,8 @@ struct dev_pm_opp { | |||
76 | * RCU usage: nodes are not modified in the list of device_opp, | 78 | * RCU usage: nodes are not modified in the list of device_opp, |
77 | * however addition is possible and is secured by dev_opp_list_lock | 79 | * however addition is possible and is secured by dev_opp_list_lock |
78 | * @dev: device pointer | 80 | * @dev: device pointer |
79 | * @head: notifier head to notify the OPP availability changes. | 81 | * @srcu_head: notifier head to notify the OPP availability changes. |
82 | * @rcu_head: RCU callback head used for deferred freeing | ||
80 | * @opp_list: list of opps | 83 | * @opp_list: list of opps |
81 | * | 84 | * |
82 | * This is an internal data structure maintaining the link to opps attached to | 85 | * This is an internal data structure maintaining the link to opps attached to |
@@ -87,7 +90,8 @@ struct device_opp { | |||
87 | struct list_head node; | 90 | struct list_head node; |
88 | 91 | ||
89 | struct device *dev; | 92 | struct device *dev; |
90 | struct srcu_notifier_head head; | 93 | struct srcu_notifier_head srcu_head; |
94 | struct rcu_head rcu_head; | ||
91 | struct list_head opp_list; | 95 | struct list_head opp_list; |
92 | }; | 96 | }; |
93 | 97 | ||
@@ -378,30 +382,8 @@ struct dev_pm_opp *dev_pm_opp_find_freq_floor(struct device *dev, | |||
378 | } | 382 | } |
379 | EXPORT_SYMBOL_GPL(dev_pm_opp_find_freq_floor); | 383 | EXPORT_SYMBOL_GPL(dev_pm_opp_find_freq_floor); |
380 | 384 | ||
381 | /** | 385 | static int dev_pm_opp_add_dynamic(struct device *dev, unsigned long freq, |
382 | * dev_pm_opp_add() - Add an OPP table from a table definitions | 386 | unsigned long u_volt, bool dynamic) |
383 | * @dev: device for which we do this operation | ||
384 | * @freq: Frequency in Hz for this OPP | ||
385 | * @u_volt: Voltage in uVolts for this OPP | ||
386 | * | ||
387 | * This function adds an opp definition to the opp list and returns status. | ||
388 | * The opp is made available by default and it can be controlled using | ||
389 | * dev_pm_opp_enable/disable functions. | ||
390 | * | ||
391 | * Locking: The internal device_opp and opp structures are RCU protected. | ||
392 | * Hence this function internally uses RCU updater strategy with mutex locks | ||
393 | * to keep the integrity of the internal data structures. Callers should ensure | ||
394 | * that this function is *NOT* called under RCU protection or in contexts where | ||
395 | * mutex cannot be locked. | ||
396 | * | ||
397 | * Return: | ||
398 | * 0: On success OR | ||
399 | * Duplicate OPPs (both freq and volt are same) and opp->available | ||
400 | * -EEXIST: Freq are same and volt are different OR | ||
401 | * Duplicate OPPs (both freq and volt are same) and !opp->available | ||
402 | * -ENOMEM: Memory allocation failure | ||
403 | */ | ||
404 | int dev_pm_opp_add(struct device *dev, unsigned long freq, unsigned long u_volt) | ||
405 | { | 387 | { |
406 | struct device_opp *dev_opp = NULL; | 388 | struct device_opp *dev_opp = NULL; |
407 | struct dev_pm_opp *opp, *new_opp; | 389 | struct dev_pm_opp *opp, *new_opp; |
@@ -417,6 +399,13 @@ int dev_pm_opp_add(struct device *dev, unsigned long freq, unsigned long u_volt) | |||
417 | /* Hold our list modification lock here */ | 399 | /* Hold our list modification lock here */ |
418 | mutex_lock(&dev_opp_list_lock); | 400 | mutex_lock(&dev_opp_list_lock); |
419 | 401 | ||
402 | /* populate the opp table */ | ||
403 | new_opp->dev_opp = dev_opp; | ||
404 | new_opp->rate = freq; | ||
405 | new_opp->u_volt = u_volt; | ||
406 | new_opp->available = true; | ||
407 | new_opp->dynamic = dynamic; | ||
408 | |||
420 | /* Check for existing list for 'dev' */ | 409 | /* Check for existing list for 'dev' */ |
421 | dev_opp = find_device_opp(dev); | 410 | dev_opp = find_device_opp(dev); |
422 | if (IS_ERR(dev_opp)) { | 411 | if (IS_ERR(dev_opp)) { |
@@ -436,19 +425,15 @@ int dev_pm_opp_add(struct device *dev, unsigned long freq, unsigned long u_volt) | |||
436 | } | 425 | } |
437 | 426 | ||
438 | dev_opp->dev = dev; | 427 | dev_opp->dev = dev; |
439 | srcu_init_notifier_head(&dev_opp->head); | 428 | srcu_init_notifier_head(&dev_opp->srcu_head); |
440 | INIT_LIST_HEAD(&dev_opp->opp_list); | 429 | INIT_LIST_HEAD(&dev_opp->opp_list); |
441 | 430 | ||
442 | /* Secure the device list modification */ | 431 | /* Secure the device list modification */ |
443 | list_add_rcu(&dev_opp->node, &dev_opp_list); | 432 | list_add_rcu(&dev_opp->node, &dev_opp_list); |
433 | head = &dev_opp->opp_list; | ||
434 | goto list_add; | ||
444 | } | 435 | } |
445 | 436 | ||
446 | /* populate the opp table */ | ||
447 | new_opp->dev_opp = dev_opp; | ||
448 | new_opp->rate = freq; | ||
449 | new_opp->u_volt = u_volt; | ||
450 | new_opp->available = true; | ||
451 | |||
452 | /* | 437 | /* |
453 | * Insert new OPP in order of increasing frequency | 438 | * Insert new OPP in order of increasing frequency |
454 | * and discard if already present | 439 | * and discard if already present |
@@ -474,6 +459,7 @@ int dev_pm_opp_add(struct device *dev, unsigned long freq, unsigned long u_volt) | |||
474 | return ret; | 459 | return ret; |
475 | } | 460 | } |
476 | 461 | ||
462 | list_add: | ||
477 | list_add_rcu(&new_opp->node, head); | 463 | list_add_rcu(&new_opp->node, head); |
478 | mutex_unlock(&dev_opp_list_lock); | 464 | mutex_unlock(&dev_opp_list_lock); |
479 | 465 | ||
@@ -481,11 +467,109 @@ int dev_pm_opp_add(struct device *dev, unsigned long freq, unsigned long u_volt) | |||
481 | * Notify the changes in the availability of the operable | 467 | * Notify the changes in the availability of the operable |
482 | * frequency/voltage list. | 468 | * frequency/voltage list. |
483 | */ | 469 | */ |
484 | srcu_notifier_call_chain(&dev_opp->head, OPP_EVENT_ADD, new_opp); | 470 | srcu_notifier_call_chain(&dev_opp->srcu_head, OPP_EVENT_ADD, new_opp); |
485 | return 0; | 471 | return 0; |
486 | } | 472 | } |
473 | |||
474 | /** | ||
475 | * dev_pm_opp_add() - Add an OPP table from a table definitions | ||
476 | * @dev: device for which we do this operation | ||
477 | * @freq: Frequency in Hz for this OPP | ||
478 | * @u_volt: Voltage in uVolts for this OPP | ||
479 | * | ||
480 | * This function adds an opp definition to the opp list and returns status. | ||
481 | * The opp is made available by default and it can be controlled using | ||
482 | * dev_pm_opp_enable/disable functions. | ||
483 | * | ||
484 | * Locking: The internal device_opp and opp structures are RCU protected. | ||
485 | * Hence this function internally uses RCU updater strategy with mutex locks | ||
486 | * to keep the integrity of the internal data structures. Callers should ensure | ||
487 | * that this function is *NOT* called under RCU protection or in contexts where | ||
488 | * mutex cannot be locked. | ||
489 | * | ||
490 | * Return: | ||
491 | * 0: On success OR | ||
492 | * Duplicate OPPs (both freq and volt are same) and opp->available | ||
493 | * -EEXIST: Freq are same and volt are different OR | ||
494 | * Duplicate OPPs (both freq and volt are same) and !opp->available | ||
495 | * -ENOMEM: Memory allocation failure | ||
496 | */ | ||
497 | int dev_pm_opp_add(struct device *dev, unsigned long freq, unsigned long u_volt) | ||
498 | { | ||
499 | return dev_pm_opp_add_dynamic(dev, freq, u_volt, true); | ||
500 | } | ||
487 | EXPORT_SYMBOL_GPL(dev_pm_opp_add); | 501 | EXPORT_SYMBOL_GPL(dev_pm_opp_add); |
488 | 502 | ||
503 | static void kfree_opp_rcu(struct rcu_head *head) | ||
504 | { | ||
505 | struct dev_pm_opp *opp = container_of(head, struct dev_pm_opp, rcu_head); | ||
506 | |||
507 | kfree_rcu(opp, rcu_head); | ||
508 | } | ||
509 | |||
510 | static void kfree_device_rcu(struct rcu_head *head) | ||
511 | { | ||
512 | struct device_opp *device_opp = container_of(head, struct device_opp, rcu_head); | ||
513 | |||
514 | kfree(device_opp); | ||
515 | } | ||
516 | |||
517 | void __dev_pm_opp_remove(struct device_opp *dev_opp, struct dev_pm_opp *opp) | ||
518 | { | ||
519 | /* | ||
520 | * Notify the changes in the availability of the operable | ||
521 | * frequency/voltage list. | ||
522 | */ | ||
523 | srcu_notifier_call_chain(&dev_opp->srcu_head, OPP_EVENT_REMOVE, opp); | ||
524 | list_del_rcu(&opp->node); | ||
525 | call_srcu(&dev_opp->srcu_head.srcu, &opp->rcu_head, kfree_opp_rcu); | ||
526 | |||
527 | if (list_empty(&dev_opp->opp_list)) { | ||
528 | list_del_rcu(&dev_opp->node); | ||
529 | call_srcu(&dev_opp->srcu_head.srcu, &dev_opp->rcu_head, | ||
530 | kfree_device_rcu); | ||
531 | } | ||
532 | } | ||
533 | |||
534 | /** | ||
535 | * dev_pm_opp_remove() - Remove an OPP from OPP list | ||
536 | * @dev: device for which we do this operation | ||
537 | * @freq: OPP to remove with matching 'freq' | ||
538 | * | ||
539 | * This function removes an opp from the opp list. | ||
540 | */ | ||
541 | void dev_pm_opp_remove(struct device *dev, unsigned long freq) | ||
542 | { | ||
543 | struct dev_pm_opp *opp; | ||
544 | struct device_opp *dev_opp; | ||
545 | bool found = false; | ||
546 | |||
547 | /* Hold our list modification lock here */ | ||
548 | mutex_lock(&dev_opp_list_lock); | ||
549 | |||
550 | dev_opp = find_device_opp(dev); | ||
551 | if (IS_ERR(dev_opp)) | ||
552 | goto unlock; | ||
553 | |||
554 | list_for_each_entry(opp, &dev_opp->opp_list, node) { | ||
555 | if (opp->rate == freq) { | ||
556 | found = true; | ||
557 | break; | ||
558 | } | ||
559 | } | ||
560 | |||
561 | if (!found) { | ||
562 | dev_warn(dev, "%s: Couldn't find OPP with freq: %lu\n", | ||
563 | __func__, freq); | ||
564 | goto unlock; | ||
565 | } | ||
566 | |||
567 | __dev_pm_opp_remove(dev_opp, opp); | ||
568 | unlock: | ||
569 | mutex_unlock(&dev_opp_list_lock); | ||
570 | } | ||
571 | EXPORT_SYMBOL_GPL(dev_pm_opp_remove); | ||
572 | |||
489 | /** | 573 | /** |
490 | * opp_set_availability() - helper to set the availability of an opp | 574 | * opp_set_availability() - helper to set the availability of an opp |
491 | * @dev: device for which we do this operation | 575 | * @dev: device for which we do this operation |
@@ -557,14 +641,14 @@ static int opp_set_availability(struct device *dev, unsigned long freq, | |||
557 | 641 | ||
558 | list_replace_rcu(&opp->node, &new_opp->node); | 642 | list_replace_rcu(&opp->node, &new_opp->node); |
559 | mutex_unlock(&dev_opp_list_lock); | 643 | mutex_unlock(&dev_opp_list_lock); |
560 | kfree_rcu(opp, head); | 644 | call_srcu(&dev_opp->srcu_head.srcu, &opp->rcu_head, kfree_opp_rcu); |
561 | 645 | ||
562 | /* Notify the change of the OPP availability */ | 646 | /* Notify the change of the OPP availability */ |
563 | if (availability_req) | 647 | if (availability_req) |
564 | srcu_notifier_call_chain(&dev_opp->head, OPP_EVENT_ENABLE, | 648 | srcu_notifier_call_chain(&dev_opp->srcu_head, OPP_EVENT_ENABLE, |
565 | new_opp); | 649 | new_opp); |
566 | else | 650 | else |
567 | srcu_notifier_call_chain(&dev_opp->head, OPP_EVENT_DISABLE, | 651 | srcu_notifier_call_chain(&dev_opp->srcu_head, OPP_EVENT_DISABLE, |
568 | new_opp); | 652 | new_opp); |
569 | 653 | ||
570 | return 0; | 654 | return 0; |
@@ -629,7 +713,7 @@ struct srcu_notifier_head *dev_pm_opp_get_notifier(struct device *dev) | |||
629 | if (IS_ERR(dev_opp)) | 713 | if (IS_ERR(dev_opp)) |
630 | return ERR_CAST(dev_opp); /* matching type */ | 714 | return ERR_CAST(dev_opp); /* matching type */ |
631 | 715 | ||
632 | return &dev_opp->head; | 716 | return &dev_opp->srcu_head; |
633 | } | 717 | } |
634 | 718 | ||
635 | #ifdef CONFIG_OF | 719 | #ifdef CONFIG_OF |
@@ -666,7 +750,7 @@ int of_init_opp_table(struct device *dev) | |||
666 | unsigned long freq = be32_to_cpup(val++) * 1000; | 750 | unsigned long freq = be32_to_cpup(val++) * 1000; |
667 | unsigned long volt = be32_to_cpup(val++); | 751 | unsigned long volt = be32_to_cpup(val++); |
668 | 752 | ||
669 | if (dev_pm_opp_add(dev, freq, volt)) | 753 | if (dev_pm_opp_add_dynamic(dev, freq, volt, false)) |
670 | dev_warn(dev, "%s: Failed to add OPP %ld\n", | 754 | dev_warn(dev, "%s: Failed to add OPP %ld\n", |
671 | __func__, freq); | 755 | __func__, freq); |
672 | nr -= 2; | 756 | nr -= 2; |
@@ -675,4 +759,34 @@ int of_init_opp_table(struct device *dev) | |||
675 | return 0; | 759 | return 0; |
676 | } | 760 | } |
677 | EXPORT_SYMBOL_GPL(of_init_opp_table); | 761 | EXPORT_SYMBOL_GPL(of_init_opp_table); |
762 | |||
763 | /** | ||
764 | * of_free_opp_table() - Free OPP table entries created from static DT entries | ||
765 | * @dev: device pointer used to lookup device OPPs. | ||
766 | * | ||
767 | * Free OPPs created using static entries present in DT. | ||
768 | */ | ||
769 | void of_free_opp_table(struct device *dev) | ||
770 | { | ||
771 | struct device_opp *dev_opp = find_device_opp(dev); | ||
772 | struct dev_pm_opp *opp, *tmp; | ||
773 | |||
774 | /* Check for existing list for 'dev' */ | ||
775 | dev_opp = find_device_opp(dev); | ||
776 | if (WARN(IS_ERR(dev_opp), "%s: dev_opp: %ld\n", dev_name(dev), | ||
777 | PTR_ERR(dev_opp))) | ||
778 | return; | ||
779 | |||
780 | /* Hold our list modification lock here */ | ||
781 | mutex_lock(&dev_opp_list_lock); | ||
782 | |||
783 | /* Free static OPPs */ | ||
784 | list_for_each_entry_safe(opp, tmp, &dev_opp->opp_list, node) { | ||
785 | if (!opp->dynamic) | ||
786 | __dev_pm_opp_remove(dev_opp, opp); | ||
787 | } | ||
788 | |||
789 | mutex_unlock(&dev_opp_list_lock); | ||
790 | } | ||
791 | EXPORT_SYMBOL_GPL(of_free_opp_table); | ||
678 | #endif | 792 | #endif |
diff --git a/drivers/base/property.c b/drivers/base/property.c new file mode 100644 index 000000000000..c45845874d4f --- /dev/null +++ b/drivers/base/property.c | |||
@@ -0,0 +1,431 @@ | |||
1 | /* | ||
2 | * property.c - Unified device property interface. | ||
3 | * | ||
4 | * Copyright (C) 2014, Intel Corporation | ||
5 | * Authors: Rafael J. Wysocki <rafael.j.wysocki@intel.com> | ||
6 | * Mika Westerberg <mika.westerberg@linux.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 | |||
13 | #include <linux/property.h> | ||
14 | #include <linux/export.h> | ||
15 | #include <linux/acpi.h> | ||
16 | #include <linux/of.h> | ||
17 | |||
18 | /** | ||
19 | * device_property_present - check if a property of a device is present | ||
20 | * @dev: Device whose property is being checked | ||
21 | * @propname: Name of the property | ||
22 | * | ||
23 | * Check if property @propname is present in the device firmware description. | ||
24 | */ | ||
25 | bool device_property_present(struct device *dev, const char *propname) | ||
26 | { | ||
27 | if (IS_ENABLED(CONFIG_OF) && dev->of_node) | ||
28 | return of_property_read_bool(dev->of_node, propname); | ||
29 | |||
30 | return !acpi_dev_prop_get(ACPI_COMPANION(dev), propname, NULL); | ||
31 | } | ||
32 | EXPORT_SYMBOL_GPL(device_property_present); | ||
33 | |||
34 | /** | ||
35 | * fwnode_property_present - check if a property of a firmware node is present | ||
36 | * @fwnode: Firmware node whose property to check | ||
37 | * @propname: Name of the property | ||
38 | */ | ||
39 | bool fwnode_property_present(struct fwnode_handle *fwnode, const char *propname) | ||
40 | { | ||
41 | if (is_of_node(fwnode)) | ||
42 | return of_property_read_bool(of_node(fwnode), propname); | ||
43 | else if (is_acpi_node(fwnode)) | ||
44 | return !acpi_dev_prop_get(acpi_node(fwnode), propname, NULL); | ||
45 | |||
46 | return false; | ||
47 | } | ||
48 | EXPORT_SYMBOL_GPL(fwnode_property_present); | ||
49 | |||
50 | #define OF_DEV_PROP_READ_ARRAY(node, propname, type, val, nval) \ | ||
51 | (val) ? of_property_read_##type##_array((node), (propname), (val), (nval)) \ | ||
52 | : of_property_count_elems_of_size((node), (propname), sizeof(type)) | ||
53 | |||
54 | #define DEV_PROP_READ_ARRAY(_dev_, _propname_, _type_, _proptype_, _val_, _nval_) \ | ||
55 | IS_ENABLED(CONFIG_OF) && _dev_->of_node ? \ | ||
56 | (OF_DEV_PROP_READ_ARRAY(_dev_->of_node, _propname_, _type_, \ | ||
57 | _val_, _nval_)) : \ | ||
58 | acpi_dev_prop_read(ACPI_COMPANION(_dev_), _propname_, \ | ||
59 | _proptype_, _val_, _nval_) | ||
60 | |||
61 | /** | ||
62 | * device_property_read_u8_array - return a u8 array property of a device | ||
63 | * @dev: Device to get the property of | ||
64 | * @propname: Name of the property | ||
65 | * @val: The values are stored here | ||
66 | * @nval: Size of the @val array | ||
67 | * | ||
68 | * Function reads an array of u8 properties with @propname from the device | ||
69 | * firmware description and stores them to @val if found. | ||
70 | * | ||
71 | * Return: %0 if the property was found (success), | ||
72 | * %-EINVAL if given arguments are not valid, | ||
73 | * %-ENODATA if the property does not have a value, | ||
74 | * %-EPROTO if the property is not an array of numbers, | ||
75 | * %-EOVERFLOW if the size of the property is not as expected. | ||
76 | */ | ||
77 | int device_property_read_u8_array(struct device *dev, const char *propname, | ||
78 | u8 *val, size_t nval) | ||
79 | { | ||
80 | return DEV_PROP_READ_ARRAY(dev, propname, u8, DEV_PROP_U8, val, nval); | ||
81 | } | ||
82 | EXPORT_SYMBOL_GPL(device_property_read_u8_array); | ||
83 | |||
84 | /** | ||
85 | * device_property_read_u16_array - return a u16 array property of a device | ||
86 | * @dev: Device to get the property of | ||
87 | * @propname: Name of the property | ||
88 | * @val: The values are stored here | ||
89 | * @nval: Size of the @val array | ||
90 | * | ||
91 | * Function reads an array of u16 properties with @propname from the device | ||
92 | * firmware description and stores them to @val if found. | ||
93 | * | ||
94 | * Return: %0 if the property was found (success), | ||
95 | * %-EINVAL if given arguments are not valid, | ||
96 | * %-ENODATA if the property does not have a value, | ||
97 | * %-EPROTO if the property is not an array of numbers, | ||
98 | * %-EOVERFLOW if the size of the property is not as expected. | ||
99 | */ | ||
100 | int device_property_read_u16_array(struct device *dev, const char *propname, | ||
101 | u16 *val, size_t nval) | ||
102 | { | ||
103 | return DEV_PROP_READ_ARRAY(dev, propname, u16, DEV_PROP_U16, val, nval); | ||
104 | } | ||
105 | EXPORT_SYMBOL_GPL(device_property_read_u16_array); | ||
106 | |||
107 | /** | ||
108 | * device_property_read_u32_array - return a u32 array property of a device | ||
109 | * @dev: Device to get the property of | ||
110 | * @propname: Name of the property | ||
111 | * @val: The values are stored here | ||
112 | * @nval: Size of the @val array | ||
113 | * | ||
114 | * Function reads an array of u32 properties with @propname from the device | ||
115 | * firmware description and stores them to @val if found. | ||
116 | * | ||
117 | * Return: %0 if the property was found (success), | ||
118 | * %-EINVAL if given arguments are not valid, | ||
119 | * %-ENODATA if the property does not have a value, | ||
120 | * %-EPROTO if the property is not an array of numbers, | ||
121 | * %-EOVERFLOW if the size of the property is not as expected. | ||
122 | */ | ||
123 | int device_property_read_u32_array(struct device *dev, const char *propname, | ||
124 | u32 *val, size_t nval) | ||
125 | { | ||
126 | return DEV_PROP_READ_ARRAY(dev, propname, u32, DEV_PROP_U32, val, nval); | ||
127 | } | ||
128 | EXPORT_SYMBOL_GPL(device_property_read_u32_array); | ||
129 | |||
130 | /** | ||
131 | * device_property_read_u64_array - return a u64 array property of a device | ||
132 | * @dev: Device to get the property of | ||
133 | * @propname: Name of the property | ||
134 | * @val: The values are stored here | ||
135 | * @nval: Size of the @val array | ||
136 | * | ||
137 | * Function reads an array of u64 properties with @propname from the device | ||
138 | * firmware description and stores them to @val if found. | ||
139 | * | ||
140 | * Return: %0 if the property was found (success), | ||
141 | * %-EINVAL if given arguments are not valid, | ||
142 | * %-ENODATA if the property does not have a value, | ||
143 | * %-EPROTO if the property is not an array of numbers, | ||
144 | * %-EOVERFLOW if the size of the property is not as expected. | ||
145 | */ | ||
146 | int device_property_read_u64_array(struct device *dev, const char *propname, | ||
147 | u64 *val, size_t nval) | ||
148 | { | ||
149 | return DEV_PROP_READ_ARRAY(dev, propname, u64, DEV_PROP_U64, val, nval); | ||
150 | } | ||
151 | EXPORT_SYMBOL_GPL(device_property_read_u64_array); | ||
152 | |||
153 | /** | ||
154 | * device_property_read_string_array - return a string array property of device | ||
155 | * @dev: Device to get the property of | ||
156 | * @propname: Name of the property | ||
157 | * @val: The values are stored here | ||
158 | * @nval: Size of the @val array | ||
159 | * | ||
160 | * Function reads an array of string properties with @propname from the device | ||
161 | * firmware description and stores them to @val if found. | ||
162 | * | ||
163 | * Return: %0 if the property was found (success), | ||
164 | * %-EINVAL if given arguments are not valid, | ||
165 | * %-ENODATA if the property does not have a value, | ||
166 | * %-EPROTO or %-EILSEQ if the property is not an array of strings, | ||
167 | * %-EOVERFLOW if the size of the property is not as expected. | ||
168 | */ | ||
169 | int device_property_read_string_array(struct device *dev, const char *propname, | ||
170 | const char **val, size_t nval) | ||
171 | { | ||
172 | return IS_ENABLED(CONFIG_OF) && dev->of_node ? | ||
173 | of_property_read_string_array(dev->of_node, propname, val, nval) : | ||
174 | acpi_dev_prop_read(ACPI_COMPANION(dev), propname, | ||
175 | DEV_PROP_STRING, val, nval); | ||
176 | } | ||
177 | EXPORT_SYMBOL_GPL(device_property_read_string_array); | ||
178 | |||
179 | /** | ||
180 | * device_property_read_string - return a string property of a device | ||
181 | * @dev: Device to get the property of | ||
182 | * @propname: Name of the property | ||
183 | * @val: The value is stored here | ||
184 | * | ||
185 | * Function reads property @propname from the device firmware description and | ||
186 | * stores the value into @val if found. The value is checked to be a string. | ||
187 | * | ||
188 | * Return: %0 if the property was found (success), | ||
189 | * %-EINVAL if given arguments are not valid, | ||
190 | * %-ENODATA if the property does not have a value, | ||
191 | * %-EPROTO or %-EILSEQ if the property type is not a string. | ||
192 | */ | ||
193 | int device_property_read_string(struct device *dev, const char *propname, | ||
194 | const char **val) | ||
195 | { | ||
196 | return IS_ENABLED(CONFIG_OF) && dev->of_node ? | ||
197 | of_property_read_string(dev->of_node, propname, val) : | ||
198 | acpi_dev_prop_read(ACPI_COMPANION(dev), propname, | ||
199 | DEV_PROP_STRING, val, 1); | ||
200 | } | ||
201 | EXPORT_SYMBOL_GPL(device_property_read_string); | ||
202 | |||
203 | #define FWNODE_PROP_READ_ARRAY(_fwnode_, _propname_, _type_, _proptype_, _val_, _nval_) \ | ||
204 | ({ \ | ||
205 | int _ret_; \ | ||
206 | if (is_of_node(_fwnode_)) \ | ||
207 | _ret_ = OF_DEV_PROP_READ_ARRAY(of_node(_fwnode_), _propname_, \ | ||
208 | _type_, _val_, _nval_); \ | ||
209 | else if (is_acpi_node(_fwnode_)) \ | ||
210 | _ret_ = acpi_dev_prop_read(acpi_node(_fwnode_), _propname_, \ | ||
211 | _proptype_, _val_, _nval_); \ | ||
212 | else \ | ||
213 | _ret_ = -ENXIO; \ | ||
214 | _ret_; \ | ||
215 | }) | ||
216 | |||
217 | /** | ||
218 | * fwnode_property_read_u8_array - return a u8 array property of firmware node | ||
219 | * @fwnode: Firmware node to get the property of | ||
220 | * @propname: Name of the property | ||
221 | * @val: The values are stored here | ||
222 | * @nval: Size of the @val array | ||
223 | * | ||
224 | * Read an array of u8 properties with @propname from @fwnode and stores them to | ||
225 | * @val if found. | ||
226 | * | ||
227 | * Return: %0 if the property was found (success), | ||
228 | * %-EINVAL if given arguments are not valid, | ||
229 | * %-ENODATA if the property does not have a value, | ||
230 | * %-EPROTO if the property is not an array of numbers, | ||
231 | * %-EOVERFLOW if the size of the property is not as expected, | ||
232 | * %-ENXIO if no suitable firmware interface is present. | ||
233 | */ | ||
234 | int fwnode_property_read_u8_array(struct fwnode_handle *fwnode, | ||
235 | const char *propname, u8 *val, size_t nval) | ||
236 | { | ||
237 | return FWNODE_PROP_READ_ARRAY(fwnode, propname, u8, DEV_PROP_U8, | ||
238 | val, nval); | ||
239 | } | ||
240 | EXPORT_SYMBOL_GPL(fwnode_property_read_u8_array); | ||
241 | |||
242 | /** | ||
243 | * fwnode_property_read_u16_array - return a u16 array property of firmware node | ||
244 | * @fwnode: Firmware node to get the property of | ||
245 | * @propname: Name of the property | ||
246 | * @val: The values are stored here | ||
247 | * @nval: Size of the @val array | ||
248 | * | ||
249 | * Read an array of u16 properties with @propname from @fwnode and store them to | ||
250 | * @val if found. | ||
251 | * | ||
252 | * Return: %0 if the property was found (success), | ||
253 | * %-EINVAL if given arguments are not valid, | ||
254 | * %-ENODATA if the property does not have a value, | ||
255 | * %-EPROTO if the property is not an array of numbers, | ||
256 | * %-EOVERFLOW if the size of the property is not as expected, | ||
257 | * %-ENXIO if no suitable firmware interface is present. | ||
258 | */ | ||
259 | int fwnode_property_read_u16_array(struct fwnode_handle *fwnode, | ||
260 | const char *propname, u16 *val, size_t nval) | ||
261 | { | ||
262 | return FWNODE_PROP_READ_ARRAY(fwnode, propname, u16, DEV_PROP_U16, | ||
263 | val, nval); | ||
264 | } | ||
265 | EXPORT_SYMBOL_GPL(fwnode_property_read_u16_array); | ||
266 | |||
267 | /** | ||
268 | * fwnode_property_read_u32_array - return a u32 array property of firmware node | ||
269 | * @fwnode: Firmware node to get the property of | ||
270 | * @propname: Name of the property | ||
271 | * @val: The values are stored here | ||
272 | * @nval: Size of the @val array | ||
273 | * | ||
274 | * Read an array of u32 properties with @propname from @fwnode store them to | ||
275 | * @val if found. | ||
276 | * | ||
277 | * Return: %0 if the property was found (success), | ||
278 | * %-EINVAL if given arguments are not valid, | ||
279 | * %-ENODATA if the property does not have a value, | ||
280 | * %-EPROTO if the property is not an array of numbers, | ||
281 | * %-EOVERFLOW if the size of the property is not as expected, | ||
282 | * %-ENXIO if no suitable firmware interface is present. | ||
283 | */ | ||
284 | int fwnode_property_read_u32_array(struct fwnode_handle *fwnode, | ||
285 | const char *propname, u32 *val, size_t nval) | ||
286 | { | ||
287 | return FWNODE_PROP_READ_ARRAY(fwnode, propname, u32, DEV_PROP_U32, | ||
288 | val, nval); | ||
289 | } | ||
290 | EXPORT_SYMBOL_GPL(fwnode_property_read_u32_array); | ||
291 | |||
292 | /** | ||
293 | * fwnode_property_read_u64_array - return a u64 array property firmware node | ||
294 | * @fwnode: Firmware node to get the property of | ||
295 | * @propname: Name of the property | ||
296 | * @val: The values are stored here | ||
297 | * @nval: Size of the @val array | ||
298 | * | ||
299 | * Read an array of u64 properties with @propname from @fwnode and store them to | ||
300 | * @val if found. | ||
301 | * | ||
302 | * Return: %0 if the property was found (success), | ||
303 | * %-EINVAL if given arguments are not valid, | ||
304 | * %-ENODATA if the property does not have a value, | ||
305 | * %-EPROTO if the property is not an array of numbers, | ||
306 | * %-EOVERFLOW if the size of the property is not as expected, | ||
307 | * %-ENXIO if no suitable firmware interface is present. | ||
308 | */ | ||
309 | int fwnode_property_read_u64_array(struct fwnode_handle *fwnode, | ||
310 | const char *propname, u64 *val, size_t nval) | ||
311 | { | ||
312 | return FWNODE_PROP_READ_ARRAY(fwnode, propname, u64, DEV_PROP_U64, | ||
313 | val, nval); | ||
314 | } | ||
315 | EXPORT_SYMBOL_GPL(fwnode_property_read_u64_array); | ||
316 | |||
317 | /** | ||
318 | * fwnode_property_read_string_array - return string array property of a node | ||
319 | * @fwnode: Firmware node to get the property of | ||
320 | * @propname: Name of the property | ||
321 | * @val: The values are stored here | ||
322 | * @nval: Size of the @val array | ||
323 | * | ||
324 | * Read an string list property @propname from the given firmware node and store | ||
325 | * them to @val if found. | ||
326 | * | ||
327 | * Return: %0 if the property was found (success), | ||
328 | * %-EINVAL if given arguments are not valid, | ||
329 | * %-ENODATA if the property does not have a value, | ||
330 | * %-EPROTO if the property is not an array of strings, | ||
331 | * %-EOVERFLOW if the size of the property is not as expected, | ||
332 | * %-ENXIO if no suitable firmware interface is present. | ||
333 | */ | ||
334 | int fwnode_property_read_string_array(struct fwnode_handle *fwnode, | ||
335 | const char *propname, const char **val, | ||
336 | size_t nval) | ||
337 | { | ||
338 | if (is_of_node(fwnode)) | ||
339 | return of_property_read_string_array(of_node(fwnode), propname, | ||
340 | val, nval); | ||
341 | else if (is_acpi_node(fwnode)) | ||
342 | return acpi_dev_prop_read(acpi_node(fwnode), propname, | ||
343 | DEV_PROP_STRING, val, nval); | ||
344 | |||
345 | return -ENXIO; | ||
346 | } | ||
347 | EXPORT_SYMBOL_GPL(fwnode_property_read_string_array); | ||
348 | |||
349 | /** | ||
350 | * fwnode_property_read_string - return a string property of a firmware node | ||
351 | * @fwnode: Firmware node to get the property of | ||
352 | * @propname: Name of the property | ||
353 | * @val: The value is stored here | ||
354 | * | ||
355 | * Read property @propname from the given firmware node and store the value into | ||
356 | * @val if found. The value is checked to be a string. | ||
357 | * | ||
358 | * Return: %0 if the property was found (success), | ||
359 | * %-EINVAL if given arguments are not valid, | ||
360 | * %-ENODATA if the property does not have a value, | ||
361 | * %-EPROTO or %-EILSEQ if the property is not a string, | ||
362 | * %-ENXIO if no suitable firmware interface is present. | ||
363 | */ | ||
364 | int fwnode_property_read_string(struct fwnode_handle *fwnode, | ||
365 | const char *propname, const char **val) | ||
366 | { | ||
367 | if (is_of_node(fwnode)) | ||
368 | return of_property_read_string(of_node(fwnode),propname, val); | ||
369 | else if (is_acpi_node(fwnode)) | ||
370 | return acpi_dev_prop_read(acpi_node(fwnode), propname, | ||
371 | DEV_PROP_STRING, val, 1); | ||
372 | |||
373 | return -ENXIO; | ||
374 | } | ||
375 | EXPORT_SYMBOL_GPL(fwnode_property_read_string); | ||
376 | |||
377 | /** | ||
378 | * device_get_next_child_node - Return the next child node handle for a device | ||
379 | * @dev: Device to find the next child node for. | ||
380 | * @child: Handle to one of the device's child nodes or a null handle. | ||
381 | */ | ||
382 | struct fwnode_handle *device_get_next_child_node(struct device *dev, | ||
383 | struct fwnode_handle *child) | ||
384 | { | ||
385 | if (IS_ENABLED(CONFIG_OF) && dev->of_node) { | ||
386 | struct device_node *node; | ||
387 | |||
388 | node = of_get_next_available_child(dev->of_node, of_node(child)); | ||
389 | if (node) | ||
390 | return &node->fwnode; | ||
391 | } else if (IS_ENABLED(CONFIG_ACPI)) { | ||
392 | struct acpi_device *node; | ||
393 | |||
394 | node = acpi_get_next_child(dev, acpi_node(child)); | ||
395 | if (node) | ||
396 | return acpi_fwnode_handle(node); | ||
397 | } | ||
398 | return NULL; | ||
399 | } | ||
400 | EXPORT_SYMBOL_GPL(device_get_next_child_node); | ||
401 | |||
402 | /** | ||
403 | * fwnode_handle_put - Drop reference to a device node | ||
404 | * @fwnode: Pointer to the device node to drop the reference to. | ||
405 | * | ||
406 | * This has to be used when terminating device_for_each_child_node() iteration | ||
407 | * with break or return to prevent stale device node references from being left | ||
408 | * behind. | ||
409 | */ | ||
410 | void fwnode_handle_put(struct fwnode_handle *fwnode) | ||
411 | { | ||
412 | if (is_of_node(fwnode)) | ||
413 | of_node_put(of_node(fwnode)); | ||
414 | } | ||
415 | EXPORT_SYMBOL_GPL(fwnode_handle_put); | ||
416 | |||
417 | /** | ||
418 | * device_get_child_node_count - return the number of child nodes for device | ||
419 | * @dev: Device to cound the child nodes for | ||
420 | */ | ||
421 | unsigned int device_get_child_node_count(struct device *dev) | ||
422 | { | ||
423 | struct fwnode_handle *child; | ||
424 | unsigned int count = 0; | ||
425 | |||
426 | device_for_each_child_node(dev, child) | ||
427 | count++; | ||
428 | |||
429 | return count; | ||
430 | } | ||
431 | EXPORT_SYMBOL_GPL(device_get_child_node_count); | ||
diff --git a/drivers/clk/at91/clk-usb.c b/drivers/clk/at91/clk-usb.c index 24b5b020753a..a23ac0c724f0 100644 --- a/drivers/clk/at91/clk-usb.c +++ b/drivers/clk/at91/clk-usb.c | |||
@@ -52,29 +52,26 @@ static unsigned long at91sam9x5_clk_usb_recalc_rate(struct clk_hw *hw, | |||
52 | 52 | ||
53 | tmp = pmc_read(pmc, AT91_PMC_USB); | 53 | tmp = pmc_read(pmc, AT91_PMC_USB); |
54 | usbdiv = (tmp & AT91_PMC_OHCIUSBDIV) >> SAM9X5_USB_DIV_SHIFT; | 54 | usbdiv = (tmp & AT91_PMC_OHCIUSBDIV) >> SAM9X5_USB_DIV_SHIFT; |
55 | return parent_rate / (usbdiv + 1); | 55 | |
56 | return DIV_ROUND_CLOSEST(parent_rate, (usbdiv + 1)); | ||
56 | } | 57 | } |
57 | 58 | ||
58 | static long at91sam9x5_clk_usb_round_rate(struct clk_hw *hw, unsigned long rate, | 59 | static long at91sam9x5_clk_usb_round_rate(struct clk_hw *hw, unsigned long rate, |
59 | unsigned long *parent_rate) | 60 | unsigned long *parent_rate) |
60 | { | 61 | { |
61 | unsigned long div; | 62 | unsigned long div; |
62 | unsigned long bestrate; | 63 | |
63 | unsigned long tmp; | 64 | if (!rate) |
65 | return -EINVAL; | ||
64 | 66 | ||
65 | if (rate >= *parent_rate) | 67 | if (rate >= *parent_rate) |
66 | return *parent_rate; | 68 | return *parent_rate; |
67 | 69 | ||
68 | div = *parent_rate / rate; | 70 | div = DIV_ROUND_CLOSEST(*parent_rate, rate); |
69 | if (div >= SAM9X5_USB_MAX_DIV) | 71 | if (div > SAM9X5_USB_MAX_DIV + 1) |
70 | return *parent_rate / (SAM9X5_USB_MAX_DIV + 1); | 72 | div = SAM9X5_USB_MAX_DIV + 1; |
71 | |||
72 | bestrate = *parent_rate / div; | ||
73 | tmp = *parent_rate / (div + 1); | ||
74 | if (bestrate - rate > rate - tmp) | ||
75 | bestrate = tmp; | ||
76 | 73 | ||
77 | return bestrate; | 74 | return DIV_ROUND_CLOSEST(*parent_rate, div); |
78 | } | 75 | } |
79 | 76 | ||
80 | static int at91sam9x5_clk_usb_set_parent(struct clk_hw *hw, u8 index) | 77 | static int at91sam9x5_clk_usb_set_parent(struct clk_hw *hw, u8 index) |
@@ -106,9 +103,13 @@ static int at91sam9x5_clk_usb_set_rate(struct clk_hw *hw, unsigned long rate, | |||
106 | u32 tmp; | 103 | u32 tmp; |
107 | struct at91sam9x5_clk_usb *usb = to_at91sam9x5_clk_usb(hw); | 104 | struct at91sam9x5_clk_usb *usb = to_at91sam9x5_clk_usb(hw); |
108 | struct at91_pmc *pmc = usb->pmc; | 105 | struct at91_pmc *pmc = usb->pmc; |
109 | unsigned long div = parent_rate / rate; | 106 | unsigned long div; |
107 | |||
108 | if (!rate) | ||
109 | return -EINVAL; | ||
110 | 110 | ||
111 | if (parent_rate % rate || div < 1 || div >= SAM9X5_USB_MAX_DIV) | 111 | div = DIV_ROUND_CLOSEST(parent_rate, rate); |
112 | if (div > SAM9X5_USB_MAX_DIV + 1 || !div) | ||
112 | return -EINVAL; | 113 | return -EINVAL; |
113 | 114 | ||
114 | tmp = pmc_read(pmc, AT91_PMC_USB) & ~AT91_PMC_OHCIUSBDIV; | 115 | tmp = pmc_read(pmc, AT91_PMC_USB) & ~AT91_PMC_OHCIUSBDIV; |
@@ -253,7 +254,7 @@ static long at91rm9200_clk_usb_round_rate(struct clk_hw *hw, unsigned long rate, | |||
253 | 254 | ||
254 | tmp_parent_rate = rate * usb->divisors[i]; | 255 | tmp_parent_rate = rate * usb->divisors[i]; |
255 | tmp_parent_rate = __clk_round_rate(parent, tmp_parent_rate); | 256 | tmp_parent_rate = __clk_round_rate(parent, tmp_parent_rate); |
256 | tmprate = tmp_parent_rate / usb->divisors[i]; | 257 | tmprate = DIV_ROUND_CLOSEST(tmp_parent_rate, usb->divisors[i]); |
257 | if (tmprate < rate) | 258 | if (tmprate < rate) |
258 | tmpdiff = rate - tmprate; | 259 | tmpdiff = rate - tmprate; |
259 | else | 260 | else |
@@ -281,10 +282,10 @@ static int at91rm9200_clk_usb_set_rate(struct clk_hw *hw, unsigned long rate, | |||
281 | struct at91_pmc *pmc = usb->pmc; | 282 | struct at91_pmc *pmc = usb->pmc; |
282 | unsigned long div; | 283 | unsigned long div; |
283 | 284 | ||
284 | if (!rate || parent_rate % rate) | 285 | if (!rate) |
285 | return -EINVAL; | 286 | return -EINVAL; |
286 | 287 | ||
287 | div = parent_rate / rate; | 288 | div = DIV_ROUND_CLOSEST(parent_rate, rate); |
288 | 289 | ||
289 | for (i = 0; i < RM9200_USB_DIV_TAB_SIZE; i++) { | 290 | for (i = 0; i < RM9200_USB_DIV_TAB_SIZE; i++) { |
290 | if (usb->divisors[i] == div) { | 291 | if (usb->divisors[i] == div) { |
diff --git a/drivers/clk/clk-divider.c b/drivers/clk/clk-divider.c index 18a9de29df0e..c0a842b335c5 100644 --- a/drivers/clk/clk-divider.c +++ b/drivers/clk/clk-divider.c | |||
@@ -263,6 +263,14 @@ static int clk_divider_bestdiv(struct clk_hw *hw, unsigned long rate, | |||
263 | if (!rate) | 263 | if (!rate) |
264 | rate = 1; | 264 | rate = 1; |
265 | 265 | ||
266 | /* if read only, just return current value */ | ||
267 | if (divider->flags & CLK_DIVIDER_READ_ONLY) { | ||
268 | bestdiv = readl(divider->reg) >> divider->shift; | ||
269 | bestdiv &= div_mask(divider); | ||
270 | bestdiv = _get_div(divider, bestdiv); | ||
271 | return bestdiv; | ||
272 | } | ||
273 | |||
266 | maxdiv = _get_maxdiv(divider); | 274 | maxdiv = _get_maxdiv(divider); |
267 | 275 | ||
268 | if (!(__clk_get_flags(hw->clk) & CLK_SET_RATE_PARENT)) { | 276 | if (!(__clk_get_flags(hw->clk) & CLK_SET_RATE_PARENT)) { |
@@ -361,11 +369,6 @@ const struct clk_ops clk_divider_ops = { | |||
361 | }; | 369 | }; |
362 | EXPORT_SYMBOL_GPL(clk_divider_ops); | 370 | EXPORT_SYMBOL_GPL(clk_divider_ops); |
363 | 371 | ||
364 | const struct clk_ops clk_divider_ro_ops = { | ||
365 | .recalc_rate = clk_divider_recalc_rate, | ||
366 | }; | ||
367 | EXPORT_SYMBOL_GPL(clk_divider_ro_ops); | ||
368 | |||
369 | static struct clk *_register_divider(struct device *dev, const char *name, | 372 | static struct clk *_register_divider(struct device *dev, const char *name, |
370 | const char *parent_name, unsigned long flags, | 373 | const char *parent_name, unsigned long flags, |
371 | void __iomem *reg, u8 shift, u8 width, | 374 | void __iomem *reg, u8 shift, u8 width, |
@@ -391,10 +394,7 @@ static struct clk *_register_divider(struct device *dev, const char *name, | |||
391 | } | 394 | } |
392 | 395 | ||
393 | init.name = name; | 396 | init.name = name; |
394 | if (clk_divider_flags & CLK_DIVIDER_READ_ONLY) | 397 | init.ops = &clk_divider_ops; |
395 | init.ops = &clk_divider_ro_ops; | ||
396 | else | ||
397 | init.ops = &clk_divider_ops; | ||
398 | init.flags = flags | CLK_IS_BASIC; | 398 | init.flags = flags | CLK_IS_BASIC; |
399 | init.parent_names = (parent_name ? &parent_name: NULL); | 399 | init.parent_names = (parent_name ? &parent_name: NULL); |
400 | init.num_parents = (parent_name ? 1 : 0); | 400 | init.num_parents = (parent_name ? 1 : 0); |
diff --git a/drivers/clk/pxa/clk-pxa27x.c b/drivers/clk/pxa/clk-pxa27x.c index b345cc791e5d..88b9fe13fa44 100644 --- a/drivers/clk/pxa/clk-pxa27x.c +++ b/drivers/clk/pxa/clk-pxa27x.c | |||
@@ -322,7 +322,7 @@ static unsigned long clk_pxa27x_memory_get_rate(struct clk_hw *hw, | |||
322 | unsigned long ccsr = CCSR; | 322 | unsigned long ccsr = CCSR; |
323 | 323 | ||
324 | osc_forced = ccsr & (1 << CCCR_CPDIS_BIT); | 324 | osc_forced = ccsr & (1 << CCCR_CPDIS_BIT); |
325 | a = cccr & CCCR_A_BIT; | 325 | a = cccr & (1 << CCCR_A_BIT); |
326 | l = ccsr & CCSR_L_MASK; | 326 | l = ccsr & CCSR_L_MASK; |
327 | 327 | ||
328 | if (osc_forced || a) | 328 | if (osc_forced || a) |
@@ -341,7 +341,7 @@ static u8 clk_pxa27x_memory_get_parent(struct clk_hw *hw) | |||
341 | unsigned long ccsr = CCSR; | 341 | unsigned long ccsr = CCSR; |
342 | 342 | ||
343 | osc_forced = ccsr & (1 << CCCR_CPDIS_BIT); | 343 | osc_forced = ccsr & (1 << CCCR_CPDIS_BIT); |
344 | a = cccr & CCCR_A_BIT; | 344 | a = cccr & (1 << CCCR_A_BIT); |
345 | if (osc_forced) | 345 | if (osc_forced) |
346 | return PXA_MEM_13Mhz; | 346 | return PXA_MEM_13Mhz; |
347 | if (a) | 347 | if (a) |
diff --git a/drivers/clk/qcom/mmcc-apq8084.c b/drivers/clk/qcom/mmcc-apq8084.c index dab988ab8cf1..157139a5c1ca 100644 --- a/drivers/clk/qcom/mmcc-apq8084.c +++ b/drivers/clk/qcom/mmcc-apq8084.c | |||
@@ -3122,7 +3122,7 @@ static struct clk_regmap *mmcc_apq8084_clocks[] = { | |||
3122 | [ESC1_CLK_SRC] = &esc1_clk_src.clkr, | 3122 | [ESC1_CLK_SRC] = &esc1_clk_src.clkr, |
3123 | [HDMI_CLK_SRC] = &hdmi_clk_src.clkr, | 3123 | [HDMI_CLK_SRC] = &hdmi_clk_src.clkr, |
3124 | [VSYNC_CLK_SRC] = &vsync_clk_src.clkr, | 3124 | [VSYNC_CLK_SRC] = &vsync_clk_src.clkr, |
3125 | [RBCPR_CLK_SRC] = &rbcpr_clk_src.clkr, | 3125 | [MMSS_RBCPR_CLK_SRC] = &rbcpr_clk_src.clkr, |
3126 | [RBBMTIMER_CLK_SRC] = &rbbmtimer_clk_src.clkr, | 3126 | [RBBMTIMER_CLK_SRC] = &rbbmtimer_clk_src.clkr, |
3127 | [MAPLE_CLK_SRC] = &maple_clk_src.clkr, | 3127 | [MAPLE_CLK_SRC] = &maple_clk_src.clkr, |
3128 | [VDP_CLK_SRC] = &vdp_clk_src.clkr, | 3128 | [VDP_CLK_SRC] = &vdp_clk_src.clkr, |
diff --git a/drivers/clk/rockchip/clk.c b/drivers/clk/rockchip/clk.c index 1e68bff481b8..880a266f0143 100644 --- a/drivers/clk/rockchip/clk.c +++ b/drivers/clk/rockchip/clk.c | |||
@@ -90,9 +90,7 @@ static struct clk *rockchip_clk_register_branch(const char *name, | |||
90 | div->width = div_width; | 90 | div->width = div_width; |
91 | div->lock = lock; | 91 | div->lock = lock; |
92 | div->table = div_table; | 92 | div->table = div_table; |
93 | div_ops = (div_flags & CLK_DIVIDER_READ_ONLY) | 93 | div_ops = &clk_divider_ops; |
94 | ? &clk_divider_ro_ops | ||
95 | : &clk_divider_ops; | ||
96 | } | 94 | } |
97 | 95 | ||
98 | clk = clk_register_composite(NULL, name, parent_names, num_parents, | 96 | clk = clk_register_composite(NULL, name, parent_names, num_parents, |
diff --git a/drivers/clocksource/sun4i_timer.c b/drivers/clocksource/sun4i_timer.c index efb17c3ee120..f4a9c0058b4d 100644 --- a/drivers/clocksource/sun4i_timer.c +++ b/drivers/clocksource/sun4i_timer.c | |||
@@ -182,6 +182,12 @@ static void __init sun4i_timer_init(struct device_node *node) | |||
182 | /* Make sure timer is stopped before playing with interrupts */ | 182 | /* Make sure timer is stopped before playing with interrupts */ |
183 | sun4i_clkevt_time_stop(0); | 183 | sun4i_clkevt_time_stop(0); |
184 | 184 | ||
185 | sun4i_clockevent.cpumask = cpu_possible_mask; | ||
186 | sun4i_clockevent.irq = irq; | ||
187 | |||
188 | clockevents_config_and_register(&sun4i_clockevent, rate, | ||
189 | TIMER_SYNC_TICKS, 0xffffffff); | ||
190 | |||
185 | ret = setup_irq(irq, &sun4i_timer_irq); | 191 | ret = setup_irq(irq, &sun4i_timer_irq); |
186 | if (ret) | 192 | if (ret) |
187 | pr_warn("failed to setup irq %d\n", irq); | 193 | pr_warn("failed to setup irq %d\n", irq); |
@@ -189,12 +195,6 @@ static void __init sun4i_timer_init(struct device_node *node) | |||
189 | /* Enable timer0 interrupt */ | 195 | /* Enable timer0 interrupt */ |
190 | val = readl(timer_base + TIMER_IRQ_EN_REG); | 196 | val = readl(timer_base + TIMER_IRQ_EN_REG); |
191 | writel(val | TIMER_IRQ_EN(0), timer_base + TIMER_IRQ_EN_REG); | 197 | writel(val | TIMER_IRQ_EN(0), timer_base + TIMER_IRQ_EN_REG); |
192 | |||
193 | sun4i_clockevent.cpumask = cpu_possible_mask; | ||
194 | sun4i_clockevent.irq = irq; | ||
195 | |||
196 | clockevents_config_and_register(&sun4i_clockevent, rate, | ||
197 | TIMER_SYNC_TICKS, 0xffffffff); | ||
198 | } | 198 | } |
199 | CLOCKSOURCE_OF_DECLARE(sun4i, "allwinner,sun4i-a10-timer", | 199 | CLOCKSOURCE_OF_DECLARE(sun4i, "allwinner,sun4i-a10-timer", |
200 | sun4i_timer_init); | 200 | sun4i_timer_init); |
diff --git a/drivers/dma/dw/core.c b/drivers/dma/dw/core.c index 244722170410..380478562b7d 100644 --- a/drivers/dma/dw/core.c +++ b/drivers/dma/dw/core.c | |||
@@ -22,6 +22,7 @@ | |||
22 | #include <linux/mm.h> | 22 | #include <linux/mm.h> |
23 | #include <linux/module.h> | 23 | #include <linux/module.h> |
24 | #include <linux/slab.h> | 24 | #include <linux/slab.h> |
25 | #include <linux/pm_runtime.h> | ||
25 | 26 | ||
26 | #include "../dmaengine.h" | 27 | #include "../dmaengine.h" |
27 | #include "internal.h" | 28 | #include "internal.h" |
@@ -1504,6 +1505,9 @@ int dw_dma_probe(struct dw_dma_chip *chip, struct dw_dma_platform_data *pdata) | |||
1504 | dw->regs = chip->regs; | 1505 | dw->regs = chip->regs; |
1505 | chip->dw = dw; | 1506 | chip->dw = dw; |
1506 | 1507 | ||
1508 | pm_runtime_enable(chip->dev); | ||
1509 | pm_runtime_get_sync(chip->dev); | ||
1510 | |||
1507 | dw_params = dma_read_byaddr(chip->regs, DW_PARAMS); | 1511 | dw_params = dma_read_byaddr(chip->regs, DW_PARAMS); |
1508 | autocfg = dw_params >> DW_PARAMS_EN & 0x1; | 1512 | autocfg = dw_params >> DW_PARAMS_EN & 0x1; |
1509 | 1513 | ||
@@ -1667,11 +1671,14 @@ int dw_dma_probe(struct dw_dma_chip *chip, struct dw_dma_platform_data *pdata) | |||
1667 | dev_info(chip->dev, "DesignWare DMA Controller, %d channels\n", | 1671 | dev_info(chip->dev, "DesignWare DMA Controller, %d channels\n", |
1668 | nr_channels); | 1672 | nr_channels); |
1669 | 1673 | ||
1674 | pm_runtime_put_sync_suspend(chip->dev); | ||
1675 | |||
1670 | return 0; | 1676 | return 0; |
1671 | 1677 | ||
1672 | err_dma_register: | 1678 | err_dma_register: |
1673 | free_irq(chip->irq, dw); | 1679 | free_irq(chip->irq, dw); |
1674 | err_pdata: | 1680 | err_pdata: |
1681 | pm_runtime_put_sync_suspend(chip->dev); | ||
1675 | return err; | 1682 | return err; |
1676 | } | 1683 | } |
1677 | EXPORT_SYMBOL_GPL(dw_dma_probe); | 1684 | EXPORT_SYMBOL_GPL(dw_dma_probe); |
@@ -1681,6 +1688,8 @@ int dw_dma_remove(struct dw_dma_chip *chip) | |||
1681 | struct dw_dma *dw = chip->dw; | 1688 | struct dw_dma *dw = chip->dw; |
1682 | struct dw_dma_chan *dwc, *_dwc; | 1689 | struct dw_dma_chan *dwc, *_dwc; |
1683 | 1690 | ||
1691 | pm_runtime_get_sync(chip->dev); | ||
1692 | |||
1684 | dw_dma_off(dw); | 1693 | dw_dma_off(dw); |
1685 | dma_async_device_unregister(&dw->dma); | 1694 | dma_async_device_unregister(&dw->dma); |
1686 | 1695 | ||
@@ -1693,6 +1702,8 @@ int dw_dma_remove(struct dw_dma_chip *chip) | |||
1693 | channel_clear_bit(dw, CH_EN, dwc->mask); | 1702 | channel_clear_bit(dw, CH_EN, dwc->mask); |
1694 | } | 1703 | } |
1695 | 1704 | ||
1705 | pm_runtime_put_sync_suspend(chip->dev); | ||
1706 | pm_runtime_disable(chip->dev); | ||
1696 | return 0; | 1707 | return 0; |
1697 | } | 1708 | } |
1698 | EXPORT_SYMBOL_GPL(dw_dma_remove); | 1709 | EXPORT_SYMBOL_GPL(dw_dma_remove); |
diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c index 4839bfa74a10..19a99743cf52 100644 --- a/drivers/dma/pl330.c +++ b/drivers/dma/pl330.c | |||
@@ -271,7 +271,7 @@ struct pl330_config { | |||
271 | #define DMAC_MODE_NS (1 << 0) | 271 | #define DMAC_MODE_NS (1 << 0) |
272 | unsigned int mode; | 272 | unsigned int mode; |
273 | unsigned int data_bus_width:10; /* In number of bits */ | 273 | unsigned int data_bus_width:10; /* In number of bits */ |
274 | unsigned int data_buf_dep:10; | 274 | unsigned int data_buf_dep:11; |
275 | unsigned int num_chan:4; | 275 | unsigned int num_chan:4; |
276 | unsigned int num_peri:6; | 276 | unsigned int num_peri:6; |
277 | u32 peri_ns; | 277 | u32 peri_ns; |
@@ -2336,7 +2336,7 @@ static inline int get_burst_len(struct dma_pl330_desc *desc, size_t len) | |||
2336 | int burst_len; | 2336 | int burst_len; |
2337 | 2337 | ||
2338 | burst_len = pl330->pcfg.data_bus_width / 8; | 2338 | burst_len = pl330->pcfg.data_bus_width / 8; |
2339 | burst_len *= pl330->pcfg.data_buf_dep; | 2339 | burst_len *= pl330->pcfg.data_buf_dep / pl330->pcfg.num_chan; |
2340 | burst_len >>= desc->rqcfg.brst_size; | 2340 | burst_len >>= desc->rqcfg.brst_size; |
2341 | 2341 | ||
2342 | /* src/dst_burst_len can't be more than 16 */ | 2342 | /* src/dst_burst_len can't be more than 16 */ |
@@ -2459,16 +2459,25 @@ pl330_prep_dma_memcpy(struct dma_chan *chan, dma_addr_t dst, | |||
2459 | /* Select max possible burst size */ | 2459 | /* Select max possible burst size */ |
2460 | burst = pl330->pcfg.data_bus_width / 8; | 2460 | burst = pl330->pcfg.data_bus_width / 8; |
2461 | 2461 | ||
2462 | while (burst > 1) { | 2462 | /* |
2463 | if (!(len % burst)) | 2463 | * Make sure we use a burst size that aligns with all the memcpy |
2464 | break; | 2464 | * parameters because our DMA programming algorithm doesn't cope with |
2465 | * transfers which straddle an entry in the DMA device's MFIFO. | ||
2466 | */ | ||
2467 | while ((src | dst | len) & (burst - 1)) | ||
2465 | burst /= 2; | 2468 | burst /= 2; |
2466 | } | ||
2467 | 2469 | ||
2468 | desc->rqcfg.brst_size = 0; | 2470 | desc->rqcfg.brst_size = 0; |
2469 | while (burst != (1 << desc->rqcfg.brst_size)) | 2471 | while (burst != (1 << desc->rqcfg.brst_size)) |
2470 | desc->rqcfg.brst_size++; | 2472 | desc->rqcfg.brst_size++; |
2471 | 2473 | ||
2474 | /* | ||
2475 | * If burst size is smaller than bus width then make sure we only | ||
2476 | * transfer one at a time to avoid a burst stradling an MFIFO entry. | ||
2477 | */ | ||
2478 | if (desc->rqcfg.brst_size * 8 < pl330->pcfg.data_bus_width) | ||
2479 | desc->rqcfg.brst_len = 1; | ||
2480 | |||
2472 | desc->rqcfg.brst_len = get_burst_len(desc, len); | 2481 | desc->rqcfg.brst_len = get_burst_len(desc, len); |
2473 | 2482 | ||
2474 | desc->txd.flags = flags; | 2483 | desc->txd.flags = flags; |
@@ -2732,7 +2741,7 @@ pl330_probe(struct amba_device *adev, const struct amba_id *id) | |||
2732 | 2741 | ||
2733 | 2742 | ||
2734 | dev_info(&adev->dev, | 2743 | dev_info(&adev->dev, |
2735 | "Loaded driver for PL330 DMAC-%d\n", adev->periphid); | 2744 | "Loaded driver for PL330 DMAC-%x\n", adev->periphid); |
2736 | dev_info(&adev->dev, | 2745 | dev_info(&adev->dev, |
2737 | "\tDBUFF-%ux%ubytes Num_Chans-%u Num_Peri-%u Num_Events-%u\n", | 2746 | "\tDBUFF-%ux%ubytes Num_Chans-%u Num_Peri-%u Num_Events-%u\n", |
2738 | pcfg->data_buf_dep, pcfg->data_bus_width / 8, pcfg->num_chan, | 2747 | pcfg->data_buf_dep, pcfg->data_bus_width / 8, pcfg->num_chan, |
diff --git a/drivers/dma/sun6i-dma.c b/drivers/dma/sun6i-dma.c index 3aa10b328254..91292f5513ff 100644 --- a/drivers/dma/sun6i-dma.c +++ b/drivers/dma/sun6i-dma.c | |||
@@ -230,30 +230,25 @@ static inline void sun6i_dma_dump_chan_regs(struct sun6i_dma_dev *sdev, | |||
230 | readl(pchan->base + DMA_CHAN_CUR_PARA)); | 230 | readl(pchan->base + DMA_CHAN_CUR_PARA)); |
231 | } | 231 | } |
232 | 232 | ||
233 | static inline int convert_burst(u32 maxburst, u8 *burst) | 233 | static inline s8 convert_burst(u32 maxburst) |
234 | { | 234 | { |
235 | switch (maxburst) { | 235 | switch (maxburst) { |
236 | case 1: | 236 | case 1: |
237 | *burst = 0; | 237 | return 0; |
238 | break; | ||
239 | case 8: | 238 | case 8: |
240 | *burst = 2; | 239 | return 2; |
241 | break; | ||
242 | default: | 240 | default: |
243 | return -EINVAL; | 241 | return -EINVAL; |
244 | } | 242 | } |
245 | |||
246 | return 0; | ||
247 | } | 243 | } |
248 | 244 | ||
249 | static inline int convert_buswidth(enum dma_slave_buswidth addr_width, u8 *width) | 245 | static inline s8 convert_buswidth(enum dma_slave_buswidth addr_width) |
250 | { | 246 | { |
251 | if ((addr_width < DMA_SLAVE_BUSWIDTH_1_BYTE) || | 247 | if ((addr_width < DMA_SLAVE_BUSWIDTH_1_BYTE) || |
252 | (addr_width > DMA_SLAVE_BUSWIDTH_4_BYTES)) | 248 | (addr_width > DMA_SLAVE_BUSWIDTH_4_BYTES)) |
253 | return -EINVAL; | 249 | return -EINVAL; |
254 | 250 | ||
255 | *width = addr_width >> 1; | 251 | return addr_width >> 1; |
256 | return 0; | ||
257 | } | 252 | } |
258 | 253 | ||
259 | static void *sun6i_dma_lli_add(struct sun6i_dma_lli *prev, | 254 | static void *sun6i_dma_lli_add(struct sun6i_dma_lli *prev, |
@@ -284,26 +279,25 @@ static inline int sun6i_dma_cfg_lli(struct sun6i_dma_lli *lli, | |||
284 | struct dma_slave_config *config) | 279 | struct dma_slave_config *config) |
285 | { | 280 | { |
286 | u8 src_width, dst_width, src_burst, dst_burst; | 281 | u8 src_width, dst_width, src_burst, dst_burst; |
287 | int ret; | ||
288 | 282 | ||
289 | if (!config) | 283 | if (!config) |
290 | return -EINVAL; | 284 | return -EINVAL; |
291 | 285 | ||
292 | ret = convert_burst(config->src_maxburst, &src_burst); | 286 | src_burst = convert_burst(config->src_maxburst); |
293 | if (ret) | 287 | if (src_burst) |
294 | return ret; | 288 | return src_burst; |
295 | 289 | ||
296 | ret = convert_burst(config->dst_maxburst, &dst_burst); | 290 | dst_burst = convert_burst(config->dst_maxburst); |
297 | if (ret) | 291 | if (dst_burst) |
298 | return ret; | 292 | return dst_burst; |
299 | 293 | ||
300 | ret = convert_buswidth(config->src_addr_width, &src_width); | 294 | src_width = convert_buswidth(config->src_addr_width); |
301 | if (ret) | 295 | if (src_width) |
302 | return ret; | 296 | return src_width; |
303 | 297 | ||
304 | ret = convert_buswidth(config->dst_addr_width, &dst_width); | 298 | dst_width = convert_buswidth(config->dst_addr_width); |
305 | if (ret) | 299 | if (dst_width) |
306 | return ret; | 300 | return dst_width; |
307 | 301 | ||
308 | lli->cfg = DMA_CHAN_CFG_SRC_BURST(src_burst) | | 302 | lli->cfg = DMA_CHAN_CFG_SRC_BURST(src_burst) | |
309 | DMA_CHAN_CFG_SRC_WIDTH(src_width) | | 303 | DMA_CHAN_CFG_SRC_WIDTH(src_width) | |
@@ -542,11 +536,10 @@ static struct dma_async_tx_descriptor *sun6i_dma_prep_dma_memcpy( | |||
542 | { | 536 | { |
543 | struct sun6i_dma_dev *sdev = to_sun6i_dma_dev(chan->device); | 537 | struct sun6i_dma_dev *sdev = to_sun6i_dma_dev(chan->device); |
544 | struct sun6i_vchan *vchan = to_sun6i_vchan(chan); | 538 | struct sun6i_vchan *vchan = to_sun6i_vchan(chan); |
545 | struct dma_slave_config *sconfig = &vchan->cfg; | ||
546 | struct sun6i_dma_lli *v_lli; | 539 | struct sun6i_dma_lli *v_lli; |
547 | struct sun6i_desc *txd; | 540 | struct sun6i_desc *txd; |
548 | dma_addr_t p_lli; | 541 | dma_addr_t p_lli; |
549 | int ret; | 542 | s8 burst, width; |
550 | 543 | ||
551 | dev_dbg(chan2dev(chan), | 544 | dev_dbg(chan2dev(chan), |
552 | "%s; chan: %d, dest: %pad, src: %pad, len: %zu. flags: 0x%08lx\n", | 545 | "%s; chan: %d, dest: %pad, src: %pad, len: %zu. flags: 0x%08lx\n", |
@@ -565,14 +558,21 @@ static struct dma_async_tx_descriptor *sun6i_dma_prep_dma_memcpy( | |||
565 | goto err_txd_free; | 558 | goto err_txd_free; |
566 | } | 559 | } |
567 | 560 | ||
568 | ret = sun6i_dma_cfg_lli(v_lli, src, dest, len, sconfig); | 561 | v_lli->src = src; |
569 | if (ret) | 562 | v_lli->dst = dest; |
570 | goto err_dma_free; | 563 | v_lli->len = len; |
564 | v_lli->para = NORMAL_WAIT; | ||
571 | 565 | ||
566 | burst = convert_burst(8); | ||
567 | width = convert_buswidth(DMA_SLAVE_BUSWIDTH_4_BYTES); | ||
572 | v_lli->cfg |= DMA_CHAN_CFG_SRC_DRQ(DRQ_SDRAM) | | 568 | v_lli->cfg |= DMA_CHAN_CFG_SRC_DRQ(DRQ_SDRAM) | |
573 | DMA_CHAN_CFG_DST_DRQ(DRQ_SDRAM) | | 569 | DMA_CHAN_CFG_DST_DRQ(DRQ_SDRAM) | |
574 | DMA_CHAN_CFG_DST_LINEAR_MODE | | 570 | DMA_CHAN_CFG_DST_LINEAR_MODE | |
575 | DMA_CHAN_CFG_SRC_LINEAR_MODE; | 571 | DMA_CHAN_CFG_SRC_LINEAR_MODE | |
572 | DMA_CHAN_CFG_SRC_BURST(burst) | | ||
573 | DMA_CHAN_CFG_SRC_WIDTH(width) | | ||
574 | DMA_CHAN_CFG_DST_BURST(burst) | | ||
575 | DMA_CHAN_CFG_DST_WIDTH(width); | ||
576 | 576 | ||
577 | sun6i_dma_lli_add(NULL, v_lli, p_lli, txd); | 577 | sun6i_dma_lli_add(NULL, v_lli, p_lli, txd); |
578 | 578 | ||
@@ -580,8 +580,6 @@ static struct dma_async_tx_descriptor *sun6i_dma_prep_dma_memcpy( | |||
580 | 580 | ||
581 | return vchan_tx_prep(&vchan->vc, &txd->vd, flags); | 581 | return vchan_tx_prep(&vchan->vc, &txd->vd, flags); |
582 | 582 | ||
583 | err_dma_free: | ||
584 | dma_pool_free(sdev->pool, v_lli, p_lli); | ||
585 | err_txd_free: | 583 | err_txd_free: |
586 | kfree(txd); | 584 | kfree(txd); |
587 | return NULL; | 585 | return NULL; |
@@ -915,6 +913,7 @@ static int sun6i_dma_probe(struct platform_device *pdev) | |||
915 | sdc->slave.device_prep_dma_memcpy = sun6i_dma_prep_dma_memcpy; | 913 | sdc->slave.device_prep_dma_memcpy = sun6i_dma_prep_dma_memcpy; |
916 | sdc->slave.device_control = sun6i_dma_control; | 914 | sdc->slave.device_control = sun6i_dma_control; |
917 | sdc->slave.chancnt = NR_MAX_VCHANS; | 915 | sdc->slave.chancnt = NR_MAX_VCHANS; |
916 | sdc->slave.copy_align = 4; | ||
918 | 917 | ||
919 | sdc->slave.dev = &pdev->dev; | 918 | sdc->slave.dev = &pdev->dev; |
920 | 919 | ||
diff --git a/drivers/gpio/devres.c b/drivers/gpio/devres.c index 954b9f6b0ef8..13dbd3dfc33a 100644 --- a/drivers/gpio/devres.c +++ b/drivers/gpio/devres.c | |||
@@ -109,6 +109,38 @@ struct gpio_desc *__must_check __devm_gpiod_get_index(struct device *dev, | |||
109 | EXPORT_SYMBOL(__devm_gpiod_get_index); | 109 | EXPORT_SYMBOL(__devm_gpiod_get_index); |
110 | 110 | ||
111 | /** | 111 | /** |
112 | * devm_get_gpiod_from_child - get a GPIO descriptor from a device's child node | ||
113 | * @dev: GPIO consumer | ||
114 | * @child: firmware node (child of @dev) | ||
115 | * | ||
116 | * GPIO descriptors returned from this function are automatically disposed on | ||
117 | * driver detach. | ||
118 | */ | ||
119 | struct gpio_desc *devm_get_gpiod_from_child(struct device *dev, | ||
120 | struct fwnode_handle *child) | ||
121 | { | ||
122 | struct gpio_desc **dr; | ||
123 | struct gpio_desc *desc; | ||
124 | |||
125 | dr = devres_alloc(devm_gpiod_release, sizeof(struct gpio_desc *), | ||
126 | GFP_KERNEL); | ||
127 | if (!dr) | ||
128 | return ERR_PTR(-ENOMEM); | ||
129 | |||
130 | desc = fwnode_get_named_gpiod(child, "gpios"); | ||
131 | if (IS_ERR(desc)) { | ||
132 | devres_free(dr); | ||
133 | return desc; | ||
134 | } | ||
135 | |||
136 | *dr = desc; | ||
137 | devres_add(dev, dr); | ||
138 | |||
139 | return desc; | ||
140 | } | ||
141 | EXPORT_SYMBOL(devm_get_gpiod_from_child); | ||
142 | |||
143 | /** | ||
112 | * devm_gpiod_get_index_optional - Resource-managed gpiod_get_index_optional() | 144 | * devm_gpiod_get_index_optional - Resource-managed gpiod_get_index_optional() |
113 | * @dev: GPIO consumer | 145 | * @dev: GPIO consumer |
114 | * @con_id: function within the GPIO consumer | 146 | * @con_id: function within the GPIO consumer |
diff --git a/drivers/gpio/gpio-sch.c b/drivers/gpio/gpio-sch.c index 41e91d70301e..99720c8bc8ed 100644 --- a/drivers/gpio/gpio-sch.c +++ b/drivers/gpio/gpio-sch.c | |||
@@ -29,290 +29,221 @@ | |||
29 | 29 | ||
30 | #include <linux/gpio.h> | 30 | #include <linux/gpio.h> |
31 | 31 | ||
32 | static DEFINE_SPINLOCK(gpio_lock); | 32 | #define GEN 0x00 |
33 | 33 | #define GIO 0x04 | |
34 | #define CGEN (0x00) | 34 | #define GLV 0x08 |
35 | #define CGIO (0x04) | 35 | |
36 | #define CGLV (0x08) | 36 | struct sch_gpio { |
37 | 37 | struct gpio_chip chip; | |
38 | #define RGEN (0x20) | 38 | spinlock_t lock; |
39 | #define RGIO (0x24) | 39 | unsigned short iobase; |
40 | #define RGLV (0x28) | 40 | unsigned short core_base; |
41 | 41 | unsigned short resume_base; | |
42 | static unsigned short gpio_ba; | 42 | }; |
43 | |||
44 | static int sch_gpio_core_direction_in(struct gpio_chip *gc, unsigned gpio_num) | ||
45 | { | ||
46 | u8 curr_dirs; | ||
47 | unsigned short offset, bit; | ||
48 | |||
49 | spin_lock(&gpio_lock); | ||
50 | |||
51 | offset = CGIO + gpio_num / 8; | ||
52 | bit = gpio_num % 8; | ||
53 | |||
54 | curr_dirs = inb(gpio_ba + offset); | ||
55 | |||
56 | if (!(curr_dirs & (1 << bit))) | ||
57 | outb(curr_dirs | (1 << bit), gpio_ba + offset); | ||
58 | 43 | ||
59 | spin_unlock(&gpio_lock); | 44 | #define to_sch_gpio(c) container_of(c, struct sch_gpio, chip) |
60 | return 0; | ||
61 | } | ||
62 | 45 | ||
63 | static int sch_gpio_core_get(struct gpio_chip *gc, unsigned gpio_num) | 46 | static unsigned sch_gpio_offset(struct sch_gpio *sch, unsigned gpio, |
47 | unsigned reg) | ||
64 | { | 48 | { |
65 | int res; | 49 | unsigned base = 0; |
66 | unsigned short offset, bit; | ||
67 | 50 | ||
68 | offset = CGLV + gpio_num / 8; | 51 | if (gpio >= sch->resume_base) { |
69 | bit = gpio_num % 8; | 52 | gpio -= sch->resume_base; |
53 | base += 0x20; | ||
54 | } | ||
70 | 55 | ||
71 | res = !!(inb(gpio_ba + offset) & (1 << bit)); | 56 | return base + reg + gpio / 8; |
72 | return res; | ||
73 | } | 57 | } |
74 | 58 | ||
75 | static void sch_gpio_core_set(struct gpio_chip *gc, unsigned gpio_num, int val) | 59 | static unsigned sch_gpio_bit(struct sch_gpio *sch, unsigned gpio) |
76 | { | 60 | { |
77 | u8 curr_vals; | 61 | if (gpio >= sch->resume_base) |
78 | unsigned short offset, bit; | 62 | gpio -= sch->resume_base; |
79 | 63 | return gpio % 8; | |
80 | spin_lock(&gpio_lock); | ||
81 | |||
82 | offset = CGLV + gpio_num / 8; | ||
83 | bit = gpio_num % 8; | ||
84 | |||
85 | curr_vals = inb(gpio_ba + offset); | ||
86 | |||
87 | if (val) | ||
88 | outb(curr_vals | (1 << bit), gpio_ba + offset); | ||
89 | else | ||
90 | outb((curr_vals & ~(1 << bit)), gpio_ba + offset); | ||
91 | spin_unlock(&gpio_lock); | ||
92 | } | 64 | } |
93 | 65 | ||
94 | static int sch_gpio_core_direction_out(struct gpio_chip *gc, | 66 | static void sch_gpio_enable(struct sch_gpio *sch, unsigned gpio) |
95 | unsigned gpio_num, int val) | ||
96 | { | 67 | { |
97 | u8 curr_dirs; | ||
98 | unsigned short offset, bit; | 68 | unsigned short offset, bit; |
69 | u8 enable; | ||
99 | 70 | ||
100 | spin_lock(&gpio_lock); | 71 | spin_lock(&sch->lock); |
101 | 72 | ||
102 | offset = CGIO + gpio_num / 8; | 73 | offset = sch_gpio_offset(sch, gpio, GEN); |
103 | bit = gpio_num % 8; | 74 | bit = sch_gpio_bit(sch, gpio); |
104 | |||
105 | curr_dirs = inb(gpio_ba + offset); | ||
106 | if (curr_dirs & (1 << bit)) | ||
107 | outb(curr_dirs & ~(1 << bit), gpio_ba + offset); | ||
108 | 75 | ||
109 | spin_unlock(&gpio_lock); | 76 | enable = inb(sch->iobase + offset); |
77 | if (!(enable & (1 << bit))) | ||
78 | outb(enable | (1 << bit), sch->iobase + offset); | ||
110 | 79 | ||
111 | /* | 80 | spin_unlock(&sch->lock); |
112 | * according to the datasheet, writing to the level register has no | ||
113 | * effect when GPIO is programmed as input. | ||
114 | * Actually the the level register is read-only when configured as input. | ||
115 | * Thus presetting the output level before switching to output is _NOT_ possible. | ||
116 | * Hence we set the level after configuring the GPIO as output. | ||
117 | * But we cannot prevent a short low pulse if direction is set to high | ||
118 | * and an external pull-up is connected. | ||
119 | */ | ||
120 | sch_gpio_core_set(gc, gpio_num, val); | ||
121 | return 0; | ||
122 | } | 81 | } |
123 | 82 | ||
124 | static struct gpio_chip sch_gpio_core = { | 83 | static int sch_gpio_direction_in(struct gpio_chip *gc, unsigned gpio_num) |
125 | .label = "sch_gpio_core", | ||
126 | .owner = THIS_MODULE, | ||
127 | .direction_input = sch_gpio_core_direction_in, | ||
128 | .get = sch_gpio_core_get, | ||
129 | .direction_output = sch_gpio_core_direction_out, | ||
130 | .set = sch_gpio_core_set, | ||
131 | }; | ||
132 | |||
133 | static int sch_gpio_resume_direction_in(struct gpio_chip *gc, | ||
134 | unsigned gpio_num) | ||
135 | { | 84 | { |
85 | struct sch_gpio *sch = to_sch_gpio(gc); | ||
136 | u8 curr_dirs; | 86 | u8 curr_dirs; |
137 | unsigned short offset, bit; | 87 | unsigned short offset, bit; |
138 | 88 | ||
139 | spin_lock(&gpio_lock); | 89 | spin_lock(&sch->lock); |
140 | 90 | ||
141 | offset = RGIO + gpio_num / 8; | 91 | offset = sch_gpio_offset(sch, gpio_num, GIO); |
142 | bit = gpio_num % 8; | 92 | bit = sch_gpio_bit(sch, gpio_num); |
143 | 93 | ||
144 | curr_dirs = inb(gpio_ba + offset); | 94 | curr_dirs = inb(sch->iobase + offset); |
145 | 95 | ||
146 | if (!(curr_dirs & (1 << bit))) | 96 | if (!(curr_dirs & (1 << bit))) |
147 | outb(curr_dirs | (1 << bit), gpio_ba + offset); | 97 | outb(curr_dirs | (1 << bit), sch->iobase + offset); |
148 | 98 | ||
149 | spin_unlock(&gpio_lock); | 99 | spin_unlock(&sch->lock); |
150 | return 0; | 100 | return 0; |
151 | } | 101 | } |
152 | 102 | ||
153 | static int sch_gpio_resume_get(struct gpio_chip *gc, unsigned gpio_num) | 103 | static int sch_gpio_get(struct gpio_chip *gc, unsigned gpio_num) |
154 | { | 104 | { |
105 | struct sch_gpio *sch = to_sch_gpio(gc); | ||
106 | int res; | ||
155 | unsigned short offset, bit; | 107 | unsigned short offset, bit; |
156 | 108 | ||
157 | offset = RGLV + gpio_num / 8; | 109 | offset = sch_gpio_offset(sch, gpio_num, GLV); |
158 | bit = gpio_num % 8; | 110 | bit = sch_gpio_bit(sch, gpio_num); |
111 | |||
112 | res = !!(inb(sch->iobase + offset) & (1 << bit)); | ||
159 | 113 | ||
160 | return !!(inb(gpio_ba + offset) & (1 << bit)); | 114 | return res; |
161 | } | 115 | } |
162 | 116 | ||
163 | static void sch_gpio_resume_set(struct gpio_chip *gc, | 117 | static void sch_gpio_set(struct gpio_chip *gc, unsigned gpio_num, int val) |
164 | unsigned gpio_num, int val) | ||
165 | { | 118 | { |
119 | struct sch_gpio *sch = to_sch_gpio(gc); | ||
166 | u8 curr_vals; | 120 | u8 curr_vals; |
167 | unsigned short offset, bit; | 121 | unsigned short offset, bit; |
168 | 122 | ||
169 | spin_lock(&gpio_lock); | 123 | spin_lock(&sch->lock); |
170 | 124 | ||
171 | offset = RGLV + gpio_num / 8; | 125 | offset = sch_gpio_offset(sch, gpio_num, GLV); |
172 | bit = gpio_num % 8; | 126 | bit = sch_gpio_bit(sch, gpio_num); |
173 | 127 | ||
174 | curr_vals = inb(gpio_ba + offset); | 128 | curr_vals = inb(sch->iobase + offset); |
175 | 129 | ||
176 | if (val) | 130 | if (val) |
177 | outb(curr_vals | (1 << bit), gpio_ba + offset); | 131 | outb(curr_vals | (1 << bit), sch->iobase + offset); |
178 | else | 132 | else |
179 | outb((curr_vals & ~(1 << bit)), gpio_ba + offset); | 133 | outb((curr_vals & ~(1 << bit)), sch->iobase + offset); |
180 | 134 | ||
181 | spin_unlock(&gpio_lock); | 135 | spin_unlock(&sch->lock); |
182 | } | 136 | } |
183 | 137 | ||
184 | static int sch_gpio_resume_direction_out(struct gpio_chip *gc, | 138 | static int sch_gpio_direction_out(struct gpio_chip *gc, unsigned gpio_num, |
185 | unsigned gpio_num, int val) | 139 | int val) |
186 | { | 140 | { |
141 | struct sch_gpio *sch = to_sch_gpio(gc); | ||
187 | u8 curr_dirs; | 142 | u8 curr_dirs; |
188 | unsigned short offset, bit; | 143 | unsigned short offset, bit; |
189 | 144 | ||
190 | offset = RGIO + gpio_num / 8; | 145 | spin_lock(&sch->lock); |
191 | bit = gpio_num % 8; | ||
192 | 146 | ||
193 | spin_lock(&gpio_lock); | 147 | offset = sch_gpio_offset(sch, gpio_num, GIO); |
148 | bit = sch_gpio_bit(sch, gpio_num); | ||
194 | 149 | ||
195 | curr_dirs = inb(gpio_ba + offset); | 150 | curr_dirs = inb(sch->iobase + offset); |
196 | if (curr_dirs & (1 << bit)) | 151 | if (curr_dirs & (1 << bit)) |
197 | outb(curr_dirs & ~(1 << bit), gpio_ba + offset); | 152 | outb(curr_dirs & ~(1 << bit), sch->iobase + offset); |
198 | 153 | ||
199 | spin_unlock(&gpio_lock); | 154 | spin_unlock(&sch->lock); |
200 | 155 | ||
201 | /* | 156 | /* |
202 | * according to the datasheet, writing to the level register has no | 157 | * according to the datasheet, writing to the level register has no |
203 | * effect when GPIO is programmed as input. | 158 | * effect when GPIO is programmed as input. |
204 | * Actually the the level register is read-only when configured as input. | 159 | * Actually the the level register is read-only when configured as input. |
205 | * Thus presetting the output level before switching to output is _NOT_ possible. | 160 | * Thus presetting the output level before switching to output is _NOT_ possible. |
206 | * Hence we set the level after configuring the GPIO as output. | 161 | * Hence we set the level after configuring the GPIO as output. |
207 | * But we cannot prevent a short low pulse if direction is set to high | 162 | * But we cannot prevent a short low pulse if direction is set to high |
208 | * and an external pull-up is connected. | 163 | * and an external pull-up is connected. |
209 | */ | 164 | */ |
210 | sch_gpio_resume_set(gc, gpio_num, val); | 165 | sch_gpio_set(gc, gpio_num, val); |
211 | return 0; | 166 | return 0; |
212 | } | 167 | } |
213 | 168 | ||
214 | static struct gpio_chip sch_gpio_resume = { | 169 | static struct gpio_chip sch_gpio_chip = { |
215 | .label = "sch_gpio_resume", | 170 | .label = "sch_gpio", |
216 | .owner = THIS_MODULE, | 171 | .owner = THIS_MODULE, |
217 | .direction_input = sch_gpio_resume_direction_in, | 172 | .direction_input = sch_gpio_direction_in, |
218 | .get = sch_gpio_resume_get, | 173 | .get = sch_gpio_get, |
219 | .direction_output = sch_gpio_resume_direction_out, | 174 | .direction_output = sch_gpio_direction_out, |
220 | .set = sch_gpio_resume_set, | 175 | .set = sch_gpio_set, |
221 | }; | 176 | }; |
222 | 177 | ||
223 | static int sch_gpio_probe(struct platform_device *pdev) | 178 | static int sch_gpio_probe(struct platform_device *pdev) |
224 | { | 179 | { |
180 | struct sch_gpio *sch; | ||
225 | struct resource *res; | 181 | struct resource *res; |
226 | int err, id; | ||
227 | 182 | ||
228 | id = pdev->id; | 183 | sch = devm_kzalloc(&pdev->dev, sizeof(*sch), GFP_KERNEL); |
229 | if (!id) | 184 | if (!sch) |
230 | return -ENODEV; | 185 | return -ENOMEM; |
231 | 186 | ||
232 | res = platform_get_resource(pdev, IORESOURCE_IO, 0); | 187 | res = platform_get_resource(pdev, IORESOURCE_IO, 0); |
233 | if (!res) | 188 | if (!res) |
234 | return -EBUSY; | 189 | return -EBUSY; |
235 | 190 | ||
236 | if (!request_region(res->start, resource_size(res), pdev->name)) | 191 | if (!devm_request_region(&pdev->dev, res->start, resource_size(res), |
192 | pdev->name)) | ||
237 | return -EBUSY; | 193 | return -EBUSY; |
238 | 194 | ||
239 | gpio_ba = res->start; | 195 | spin_lock_init(&sch->lock); |
196 | sch->iobase = res->start; | ||
197 | sch->chip = sch_gpio_chip; | ||
198 | sch->chip.label = dev_name(&pdev->dev); | ||
199 | sch->chip.dev = &pdev->dev; | ||
240 | 200 | ||
241 | switch (id) { | 201 | switch (pdev->id) { |
242 | case PCI_DEVICE_ID_INTEL_SCH_LPC: | 202 | case PCI_DEVICE_ID_INTEL_SCH_LPC: |
243 | sch_gpio_core.base = 0; | 203 | sch->core_base = 0; |
244 | sch_gpio_core.ngpio = 10; | 204 | sch->resume_base = 10; |
245 | sch_gpio_resume.base = 10; | 205 | sch->chip.ngpio = 14; |
246 | sch_gpio_resume.ngpio = 4; | 206 | |
247 | /* | 207 | /* |
248 | * GPIO[6:0] enabled by default | 208 | * GPIO[6:0] enabled by default |
249 | * GPIO7 is configured by the CMC as SLPIOVR | 209 | * GPIO7 is configured by the CMC as SLPIOVR |
250 | * Enable GPIO[9:8] core powered gpios explicitly | 210 | * Enable GPIO[9:8] core powered gpios explicitly |
251 | */ | 211 | */ |
252 | outb(0x3, gpio_ba + CGEN + 1); | 212 | sch_gpio_enable(sch, 8); |
213 | sch_gpio_enable(sch, 9); | ||
253 | /* | 214 | /* |
254 | * SUS_GPIO[2:0] enabled by default | 215 | * SUS_GPIO[2:0] enabled by default |
255 | * Enable SUS_GPIO3 resume powered gpio explicitly | 216 | * Enable SUS_GPIO3 resume powered gpio explicitly |
256 | */ | 217 | */ |
257 | outb(0x8, gpio_ba + RGEN); | 218 | sch_gpio_enable(sch, 13); |
258 | break; | 219 | break; |
259 | 220 | ||
260 | case PCI_DEVICE_ID_INTEL_ITC_LPC: | 221 | case PCI_DEVICE_ID_INTEL_ITC_LPC: |
261 | sch_gpio_core.base = 0; | 222 | sch->core_base = 0; |
262 | sch_gpio_core.ngpio = 5; | 223 | sch->resume_base = 5; |
263 | sch_gpio_resume.base = 5; | 224 | sch->chip.ngpio = 14; |
264 | sch_gpio_resume.ngpio = 9; | ||
265 | break; | 225 | break; |
266 | 226 | ||
267 | case PCI_DEVICE_ID_INTEL_CENTERTON_ILB: | 227 | case PCI_DEVICE_ID_INTEL_CENTERTON_ILB: |
268 | sch_gpio_core.base = 0; | 228 | sch->core_base = 0; |
269 | sch_gpio_core.ngpio = 21; | 229 | sch->resume_base = 21; |
270 | sch_gpio_resume.base = 21; | 230 | sch->chip.ngpio = 30; |
271 | sch_gpio_resume.ngpio = 9; | ||
272 | break; | 231 | break; |
273 | 232 | ||
274 | default: | 233 | default: |
275 | err = -ENODEV; | 234 | return -ENODEV; |
276 | goto err_sch_gpio_core; | ||
277 | } | 235 | } |
278 | 236 | ||
279 | sch_gpio_core.dev = &pdev->dev; | 237 | platform_set_drvdata(pdev, sch); |
280 | sch_gpio_resume.dev = &pdev->dev; | ||
281 | |||
282 | err = gpiochip_add(&sch_gpio_core); | ||
283 | if (err < 0) | ||
284 | goto err_sch_gpio_core; | ||
285 | 238 | ||
286 | err = gpiochip_add(&sch_gpio_resume); | 239 | return gpiochip_add(&sch->chip); |
287 | if (err < 0) | ||
288 | goto err_sch_gpio_resume; | ||
289 | |||
290 | return 0; | ||
291 | |||
292 | err_sch_gpio_resume: | ||
293 | gpiochip_remove(&sch_gpio_core); | ||
294 | |||
295 | err_sch_gpio_core: | ||
296 | release_region(res->start, resource_size(res)); | ||
297 | gpio_ba = 0; | ||
298 | |||
299 | return err; | ||
300 | } | 240 | } |
301 | 241 | ||
302 | static int sch_gpio_remove(struct platform_device *pdev) | 242 | static int sch_gpio_remove(struct platform_device *pdev) |
303 | { | 243 | { |
304 | struct resource *res; | 244 | struct sch_gpio *sch = platform_get_drvdata(pdev); |
305 | if (gpio_ba) { | ||
306 | |||
307 | gpiochip_remove(&sch_gpio_core); | ||
308 | gpiochip_remove(&sch_gpio_resume); | ||
309 | |||
310 | res = platform_get_resource(pdev, IORESOURCE_IO, 0); | ||
311 | |||
312 | release_region(res->start, resource_size(res)); | ||
313 | gpio_ba = 0; | ||
314 | } | ||
315 | 245 | ||
246 | gpiochip_remove(&sch->chip); | ||
316 | return 0; | 247 | return 0; |
317 | } | 248 | } |
318 | 249 | ||
diff --git a/drivers/gpio/gpiolib-acpi.c b/drivers/gpio/gpiolib-acpi.c index 05c6275da224..ba98bb59a58f 100644 --- a/drivers/gpio/gpiolib-acpi.c +++ b/drivers/gpio/gpiolib-acpi.c | |||
@@ -287,9 +287,45 @@ void acpi_gpiochip_free_interrupts(struct gpio_chip *chip) | |||
287 | } | 287 | } |
288 | } | 288 | } |
289 | 289 | ||
290 | int acpi_dev_add_driver_gpios(struct acpi_device *adev, | ||
291 | const struct acpi_gpio_mapping *gpios) | ||
292 | { | ||
293 | if (adev && gpios) { | ||
294 | adev->driver_gpios = gpios; | ||
295 | return 0; | ||
296 | } | ||
297 | return -EINVAL; | ||
298 | } | ||
299 | EXPORT_SYMBOL_GPL(acpi_dev_add_driver_gpios); | ||
300 | |||
301 | static bool acpi_get_driver_gpio_data(struct acpi_device *adev, | ||
302 | const char *name, int index, | ||
303 | struct acpi_reference_args *args) | ||
304 | { | ||
305 | const struct acpi_gpio_mapping *gm; | ||
306 | |||
307 | if (!adev->driver_gpios) | ||
308 | return false; | ||
309 | |||
310 | for (gm = adev->driver_gpios; gm->name; gm++) | ||
311 | if (!strcmp(name, gm->name) && gm->data && index < gm->size) { | ||
312 | const struct acpi_gpio_params *par = gm->data + index; | ||
313 | |||
314 | args->adev = adev; | ||
315 | args->args[0] = par->crs_entry_index; | ||
316 | args->args[1] = par->line_index; | ||
317 | args->args[2] = par->active_low; | ||
318 | args->nargs = 3; | ||
319 | return true; | ||
320 | } | ||
321 | |||
322 | return false; | ||
323 | } | ||
324 | |||
290 | struct acpi_gpio_lookup { | 325 | struct acpi_gpio_lookup { |
291 | struct acpi_gpio_info info; | 326 | struct acpi_gpio_info info; |
292 | int index; | 327 | int index; |
328 | int pin_index; | ||
293 | struct gpio_desc *desc; | 329 | struct gpio_desc *desc; |
294 | int n; | 330 | int n; |
295 | }; | 331 | }; |
@@ -303,13 +339,24 @@ static int acpi_find_gpio(struct acpi_resource *ares, void *data) | |||
303 | 339 | ||
304 | if (lookup->n++ == lookup->index && !lookup->desc) { | 340 | if (lookup->n++ == lookup->index && !lookup->desc) { |
305 | const struct acpi_resource_gpio *agpio = &ares->data.gpio; | 341 | const struct acpi_resource_gpio *agpio = &ares->data.gpio; |
342 | int pin_index = lookup->pin_index; | ||
343 | |||
344 | if (pin_index >= agpio->pin_table_length) | ||
345 | return 1; | ||
306 | 346 | ||
307 | lookup->desc = acpi_get_gpiod(agpio->resource_source.string_ptr, | 347 | lookup->desc = acpi_get_gpiod(agpio->resource_source.string_ptr, |
308 | agpio->pin_table[0]); | 348 | agpio->pin_table[pin_index]); |
309 | lookup->info.gpioint = | 349 | lookup->info.gpioint = |
310 | agpio->connection_type == ACPI_RESOURCE_GPIO_TYPE_INT; | 350 | agpio->connection_type == ACPI_RESOURCE_GPIO_TYPE_INT; |
311 | lookup->info.active_low = | 351 | |
312 | agpio->polarity == ACPI_ACTIVE_LOW; | 352 | /* |
353 | * ActiveLow is only specified for GpioInt resource. If | ||
354 | * GpioIo is used then the only way to set the flag is | ||
355 | * to use _DSD "gpios" property. | ||
356 | */ | ||
357 | if (lookup->info.gpioint) | ||
358 | lookup->info.active_low = | ||
359 | agpio->polarity == ACPI_ACTIVE_LOW; | ||
313 | } | 360 | } |
314 | 361 | ||
315 | return 1; | 362 | return 1; |
@@ -317,40 +364,79 @@ static int acpi_find_gpio(struct acpi_resource *ares, void *data) | |||
317 | 364 | ||
318 | /** | 365 | /** |
319 | * acpi_get_gpiod_by_index() - get a GPIO descriptor from device resources | 366 | * acpi_get_gpiod_by_index() - get a GPIO descriptor from device resources |
320 | * @dev: pointer to a device to get GPIO from | 367 | * @adev: pointer to a ACPI device to get GPIO from |
368 | * @propname: Property name of the GPIO (optional) | ||
321 | * @index: index of GpioIo/GpioInt resource (starting from %0) | 369 | * @index: index of GpioIo/GpioInt resource (starting from %0) |
322 | * @info: info pointer to fill in (optional) | 370 | * @info: info pointer to fill in (optional) |
323 | * | 371 | * |
324 | * Function goes through ACPI resources for @dev and based on @index looks | 372 | * Function goes through ACPI resources for @adev and based on @index looks |
325 | * up a GpioIo/GpioInt resource, translates it to the Linux GPIO descriptor, | 373 | * up a GpioIo/GpioInt resource, translates it to the Linux GPIO descriptor, |
326 | * and returns it. @index matches GpioIo/GpioInt resources only so if there | 374 | * and returns it. @index matches GpioIo/GpioInt resources only so if there |
327 | * are total %3 GPIO resources, the index goes from %0 to %2. | 375 | * are total %3 GPIO resources, the index goes from %0 to %2. |
328 | * | 376 | * |
377 | * If @propname is specified the GPIO is looked using device property. In | ||
378 | * that case @index is used to select the GPIO entry in the property value | ||
379 | * (in case of multiple). | ||
380 | * | ||
329 | * If the GPIO cannot be translated or there is an error an ERR_PTR is | 381 | * If the GPIO cannot be translated or there is an error an ERR_PTR is |
330 | * returned. | 382 | * returned. |
331 | * | 383 | * |
332 | * Note: if the GPIO resource has multiple entries in the pin list, this | 384 | * Note: if the GPIO resource has multiple entries in the pin list, this |
333 | * function only returns the first. | 385 | * function only returns the first. |
334 | */ | 386 | */ |
335 | struct gpio_desc *acpi_get_gpiod_by_index(struct device *dev, int index, | 387 | struct gpio_desc *acpi_get_gpiod_by_index(struct acpi_device *adev, |
388 | const char *propname, int index, | ||
336 | struct acpi_gpio_info *info) | 389 | struct acpi_gpio_info *info) |
337 | { | 390 | { |
338 | struct acpi_gpio_lookup lookup; | 391 | struct acpi_gpio_lookup lookup; |
339 | struct list_head resource_list; | 392 | struct list_head resource_list; |
340 | struct acpi_device *adev; | 393 | bool active_low = false; |
341 | acpi_handle handle; | ||
342 | int ret; | 394 | int ret; |
343 | 395 | ||
344 | if (!dev) | 396 | if (!adev) |
345 | return ERR_PTR(-EINVAL); | ||
346 | |||
347 | handle = ACPI_HANDLE(dev); | ||
348 | if (!handle || acpi_bus_get_device(handle, &adev)) | ||
349 | return ERR_PTR(-ENODEV); | 397 | return ERR_PTR(-ENODEV); |
350 | 398 | ||
351 | memset(&lookup, 0, sizeof(lookup)); | 399 | memset(&lookup, 0, sizeof(lookup)); |
352 | lookup.index = index; | 400 | lookup.index = index; |
353 | 401 | ||
402 | if (propname) { | ||
403 | struct acpi_reference_args args; | ||
404 | |||
405 | dev_dbg(&adev->dev, "GPIO: looking up %s\n", propname); | ||
406 | |||
407 | memset(&args, 0, sizeof(args)); | ||
408 | ret = acpi_dev_get_property_reference(adev, propname, | ||
409 | index, &args); | ||
410 | if (ret) { | ||
411 | bool found = acpi_get_driver_gpio_data(adev, propname, | ||
412 | index, &args); | ||
413 | if (!found) | ||
414 | return ERR_PTR(ret); | ||
415 | } | ||
416 | |||
417 | /* | ||
418 | * The property was found and resolved so need to | ||
419 | * lookup the GPIO based on returned args instead. | ||
420 | */ | ||
421 | adev = args.adev; | ||
422 | if (args.nargs >= 2) { | ||
423 | lookup.index = args.args[0]; | ||
424 | lookup.pin_index = args.args[1]; | ||
425 | /* | ||
426 | * 3rd argument, if present is used to | ||
427 | * specify active_low. | ||
428 | */ | ||
429 | if (args.nargs >= 3) | ||
430 | active_low = !!args.args[2]; | ||
431 | } | ||
432 | |||
433 | dev_dbg(&adev->dev, "GPIO: _DSD returned %s %zd %llu %llu %llu\n", | ||
434 | dev_name(&adev->dev), args.nargs, | ||
435 | args.args[0], args.args[1], args.args[2]); | ||
436 | } else { | ||
437 | dev_dbg(&adev->dev, "GPIO: looking up %d in _CRS\n", index); | ||
438 | } | ||
439 | |||
354 | INIT_LIST_HEAD(&resource_list); | 440 | INIT_LIST_HEAD(&resource_list); |
355 | ret = acpi_dev_get_resources(adev, &resource_list, acpi_find_gpio, | 441 | ret = acpi_dev_get_resources(adev, &resource_list, acpi_find_gpio, |
356 | &lookup); | 442 | &lookup); |
@@ -359,8 +445,11 @@ struct gpio_desc *acpi_get_gpiod_by_index(struct device *dev, int index, | |||
359 | 445 | ||
360 | acpi_dev_free_resource_list(&resource_list); | 446 | acpi_dev_free_resource_list(&resource_list); |
361 | 447 | ||
362 | if (lookup.desc && info) | 448 | if (lookup.desc && info) { |
363 | *info = lookup.info; | 449 | *info = lookup.info; |
450 | if (active_low) | ||
451 | info->active_low = active_low; | ||
452 | } | ||
364 | 453 | ||
365 | return lookup.desc ? lookup.desc : ERR_PTR(-ENOENT); | 454 | return lookup.desc ? lookup.desc : ERR_PTR(-ENOENT); |
366 | } | 455 | } |
diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c index e8e98ca25ec7..58659dbe702a 100644 --- a/drivers/gpio/gpiolib.c +++ b/drivers/gpio/gpiolib.c | |||
@@ -1505,14 +1505,36 @@ static struct gpio_desc *acpi_find_gpio(struct device *dev, const char *con_id, | |||
1505 | unsigned int idx, | 1505 | unsigned int idx, |
1506 | enum gpio_lookup_flags *flags) | 1506 | enum gpio_lookup_flags *flags) |
1507 | { | 1507 | { |
1508 | static const char * const suffixes[] = { "gpios", "gpio" }; | ||
1509 | struct acpi_device *adev = ACPI_COMPANION(dev); | ||
1508 | struct acpi_gpio_info info; | 1510 | struct acpi_gpio_info info; |
1509 | struct gpio_desc *desc; | 1511 | struct gpio_desc *desc; |
1512 | char propname[32]; | ||
1513 | int i; | ||
1510 | 1514 | ||
1511 | desc = acpi_get_gpiod_by_index(dev, idx, &info); | 1515 | /* Try first from _DSD */ |
1512 | if (IS_ERR(desc)) | 1516 | for (i = 0; i < ARRAY_SIZE(suffixes); i++) { |
1513 | return desc; | 1517 | if (con_id && strcmp(con_id, "gpios")) { |
1518 | snprintf(propname, sizeof(propname), "%s-%s", | ||
1519 | con_id, suffixes[i]); | ||
1520 | } else { | ||
1521 | snprintf(propname, sizeof(propname), "%s", | ||
1522 | suffixes[i]); | ||
1523 | } | ||
1524 | |||
1525 | desc = acpi_get_gpiod_by_index(adev, propname, idx, &info); | ||
1526 | if (!IS_ERR(desc) || (PTR_ERR(desc) == -EPROBE_DEFER)) | ||
1527 | break; | ||
1528 | } | ||
1514 | 1529 | ||
1515 | if (info.gpioint && info.active_low) | 1530 | /* Then from plain _CRS GPIOs */ |
1531 | if (IS_ERR(desc)) { | ||
1532 | desc = acpi_get_gpiod_by_index(adev, NULL, idx, &info); | ||
1533 | if (IS_ERR(desc)) | ||
1534 | return desc; | ||
1535 | } | ||
1536 | |||
1537 | if (info.active_low) | ||
1516 | *flags |= GPIO_ACTIVE_LOW; | 1538 | *flags |= GPIO_ACTIVE_LOW; |
1517 | 1539 | ||
1518 | return desc; | 1540 | return desc; |
@@ -1713,6 +1735,61 @@ struct gpio_desc *__must_check __gpiod_get_index(struct device *dev, | |||
1713 | EXPORT_SYMBOL_GPL(__gpiod_get_index); | 1735 | EXPORT_SYMBOL_GPL(__gpiod_get_index); |
1714 | 1736 | ||
1715 | /** | 1737 | /** |
1738 | * fwnode_get_named_gpiod - obtain a GPIO from firmware node | ||
1739 | * @fwnode: handle of the firmware node | ||
1740 | * @propname: name of the firmware property representing the GPIO | ||
1741 | * | ||
1742 | * This function can be used for drivers that get their configuration | ||
1743 | * from firmware. | ||
1744 | * | ||
1745 | * Function properly finds the corresponding GPIO using whatever is the | ||
1746 | * underlying firmware interface and then makes sure that the GPIO | ||
1747 | * descriptor is requested before it is returned to the caller. | ||
1748 | * | ||
1749 | * In case of error an ERR_PTR() is returned. | ||
1750 | */ | ||
1751 | struct gpio_desc *fwnode_get_named_gpiod(struct fwnode_handle *fwnode, | ||
1752 | const char *propname) | ||
1753 | { | ||
1754 | struct gpio_desc *desc = ERR_PTR(-ENODEV); | ||
1755 | bool active_low = false; | ||
1756 | int ret; | ||
1757 | |||
1758 | if (!fwnode) | ||
1759 | return ERR_PTR(-EINVAL); | ||
1760 | |||
1761 | if (is_of_node(fwnode)) { | ||
1762 | enum of_gpio_flags flags; | ||
1763 | |||
1764 | desc = of_get_named_gpiod_flags(of_node(fwnode), propname, 0, | ||
1765 | &flags); | ||
1766 | if (!IS_ERR(desc)) | ||
1767 | active_low = flags & OF_GPIO_ACTIVE_LOW; | ||
1768 | } else if (is_acpi_node(fwnode)) { | ||
1769 | struct acpi_gpio_info info; | ||
1770 | |||
1771 | desc = acpi_get_gpiod_by_index(acpi_node(fwnode), propname, 0, | ||
1772 | &info); | ||
1773 | if (!IS_ERR(desc)) | ||
1774 | active_low = info.active_low; | ||
1775 | } | ||
1776 | |||
1777 | if (IS_ERR(desc)) | ||
1778 | return desc; | ||
1779 | |||
1780 | ret = gpiod_request(desc, NULL); | ||
1781 | if (ret) | ||
1782 | return ERR_PTR(ret); | ||
1783 | |||
1784 | /* Only value flag can be set from both DT and ACPI is active_low */ | ||
1785 | if (active_low) | ||
1786 | set_bit(FLAG_ACTIVE_LOW, &desc->flags); | ||
1787 | |||
1788 | return desc; | ||
1789 | } | ||
1790 | EXPORT_SYMBOL_GPL(fwnode_get_named_gpiod); | ||
1791 | |||
1792 | /** | ||
1716 | * gpiod_get_index_optional - obtain an optional GPIO from a multi-index GPIO | 1793 | * gpiod_get_index_optional - obtain an optional GPIO from a multi-index GPIO |
1717 | * function | 1794 | * function |
1718 | * @dev: GPIO consumer, can be NULL for system-global GPIOs | 1795 | * @dev: GPIO consumer, can be NULL for system-global GPIOs |
diff --git a/drivers/gpio/gpiolib.h b/drivers/gpio/gpiolib.h index 9db2b6a71c5d..e3a52113a541 100644 --- a/drivers/gpio/gpiolib.h +++ b/drivers/gpio/gpiolib.h | |||
@@ -34,7 +34,8 @@ void acpi_gpiochip_remove(struct gpio_chip *chip); | |||
34 | void acpi_gpiochip_request_interrupts(struct gpio_chip *chip); | 34 | void acpi_gpiochip_request_interrupts(struct gpio_chip *chip); |
35 | void acpi_gpiochip_free_interrupts(struct gpio_chip *chip); | 35 | void acpi_gpiochip_free_interrupts(struct gpio_chip *chip); |
36 | 36 | ||
37 | struct gpio_desc *acpi_get_gpiod_by_index(struct device *dev, int index, | 37 | struct gpio_desc *acpi_get_gpiod_by_index(struct acpi_device *adev, |
38 | const char *propname, int index, | ||
38 | struct acpi_gpio_info *info); | 39 | struct acpi_gpio_info *info); |
39 | #else | 40 | #else |
40 | static inline void acpi_gpiochip_add(struct gpio_chip *chip) { } | 41 | static inline void acpi_gpiochip_add(struct gpio_chip *chip) { } |
@@ -47,8 +48,8 @@ static inline void | |||
47 | acpi_gpiochip_free_interrupts(struct gpio_chip *chip) { } | 48 | acpi_gpiochip_free_interrupts(struct gpio_chip *chip) { } |
48 | 49 | ||
49 | static inline struct gpio_desc * | 50 | static inline struct gpio_desc * |
50 | acpi_get_gpiod_by_index(struct device *dev, int index, | 51 | acpi_get_gpiod_by_index(struct acpi_device *adev, const char *propname, |
51 | struct acpi_gpio_info *info) | 52 | int index, struct acpi_gpio_info *info) |
52 | { | 53 | { |
53 | return ERR_PTR(-ENOSYS); | 54 | return ERR_PTR(-ENOSYS); |
54 | } | 55 | } |
diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c index 1403b01e8216..318ade9bb5af 100644 --- a/drivers/gpu/drm/i915/i915_dma.c +++ b/drivers/gpu/drm/i915/i915_dma.c | |||
@@ -1670,15 +1670,17 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags) | |||
1670 | goto out_regs; | 1670 | goto out_regs; |
1671 | 1671 | ||
1672 | if (drm_core_check_feature(dev, DRIVER_MODESET)) { | 1672 | if (drm_core_check_feature(dev, DRIVER_MODESET)) { |
1673 | ret = i915_kick_out_vgacon(dev_priv); | 1673 | /* WARNING: Apparently we must kick fbdev drivers before vgacon, |
1674 | * otherwise the vga fbdev driver falls over. */ | ||
1675 | ret = i915_kick_out_firmware_fb(dev_priv); | ||
1674 | if (ret) { | 1676 | if (ret) { |
1675 | DRM_ERROR("failed to remove conflicting VGA console\n"); | 1677 | DRM_ERROR("failed to remove conflicting framebuffer drivers\n"); |
1676 | goto out_gtt; | 1678 | goto out_gtt; |
1677 | } | 1679 | } |
1678 | 1680 | ||
1679 | ret = i915_kick_out_firmware_fb(dev_priv); | 1681 | ret = i915_kick_out_vgacon(dev_priv); |
1680 | if (ret) { | 1682 | if (ret) { |
1681 | DRM_ERROR("failed to remove conflicting framebuffer drivers\n"); | 1683 | DRM_ERROR("failed to remove conflicting VGA console\n"); |
1682 | goto out_gtt; | 1684 | goto out_gtt; |
1683 | } | 1685 | } |
1684 | } | 1686 | } |
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index f0a1a56406eb..9cb5c95d5898 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c | |||
@@ -4325,7 +4325,6 @@ static void ironlake_crtc_disable(struct drm_crtc *crtc) | |||
4325 | ironlake_fdi_disable(crtc); | 4325 | ironlake_fdi_disable(crtc); |
4326 | 4326 | ||
4327 | ironlake_disable_pch_transcoder(dev_priv, pipe); | 4327 | ironlake_disable_pch_transcoder(dev_priv, pipe); |
4328 | intel_set_pch_fifo_underrun_reporting(dev, pipe, true); | ||
4329 | 4328 | ||
4330 | if (HAS_PCH_CPT(dev)) { | 4329 | if (HAS_PCH_CPT(dev)) { |
4331 | /* disable TRANS_DP_CTL */ | 4330 | /* disable TRANS_DP_CTL */ |
@@ -4389,7 +4388,6 @@ static void haswell_crtc_disable(struct drm_crtc *crtc) | |||
4389 | 4388 | ||
4390 | if (intel_crtc->config.has_pch_encoder) { | 4389 | if (intel_crtc->config.has_pch_encoder) { |
4391 | lpt_disable_pch_transcoder(dev_priv); | 4390 | lpt_disable_pch_transcoder(dev_priv); |
4392 | intel_set_pch_fifo_underrun_reporting(dev, TRANSCODER_A, true); | ||
4393 | intel_ddi_fdi_disable(crtc); | 4391 | intel_ddi_fdi_disable(crtc); |
4394 | } | 4392 | } |
4395 | 4393 | ||
@@ -9408,6 +9406,10 @@ static bool page_flip_finished(struct intel_crtc *crtc) | |||
9408 | struct drm_device *dev = crtc->base.dev; | 9406 | struct drm_device *dev = crtc->base.dev; |
9409 | struct drm_i915_private *dev_priv = dev->dev_private; | 9407 | struct drm_i915_private *dev_priv = dev->dev_private; |
9410 | 9408 | ||
9409 | if (i915_reset_in_progress(&dev_priv->gpu_error) || | ||
9410 | crtc->reset_counter != atomic_read(&dev_priv->gpu_error.reset_counter)) | ||
9411 | return true; | ||
9412 | |||
9411 | /* | 9413 | /* |
9412 | * The relevant registers doen't exist on pre-ctg. | 9414 | * The relevant registers doen't exist on pre-ctg. |
9413 | * As the flip done interrupt doesn't trigger for mmio | 9415 | * As the flip done interrupt doesn't trigger for mmio |
diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c index 5ad45bfff3fe..4bcd91757321 100644 --- a/drivers/gpu/drm/i915/intel_dp.c +++ b/drivers/gpu/drm/i915/intel_dp.c | |||
@@ -4450,6 +4450,7 @@ static void intel_dp_encoder_suspend(struct intel_encoder *intel_encoder) | |||
4450 | * vdd might still be enabled do to the delayed vdd off. | 4450 | * vdd might still be enabled do to the delayed vdd off. |
4451 | * Make sure vdd is actually turned off here. | 4451 | * Make sure vdd is actually turned off here. |
4452 | */ | 4452 | */ |
4453 | cancel_delayed_work_sync(&intel_dp->panel_vdd_work); | ||
4453 | pps_lock(intel_dp); | 4454 | pps_lock(intel_dp); |
4454 | edp_panel_vdd_off_sync(intel_dp); | 4455 | edp_panel_vdd_off_sync(intel_dp); |
4455 | pps_unlock(intel_dp); | 4456 | pps_unlock(intel_dp); |
diff --git a/drivers/gpu/drm/i915/intel_lvds.c b/drivers/gpu/drm/i915/intel_lvds.c index a6bd1422e38f..c0bbf2172446 100644 --- a/drivers/gpu/drm/i915/intel_lvds.c +++ b/drivers/gpu/drm/i915/intel_lvds.c | |||
@@ -899,6 +899,17 @@ void intel_lvds_init(struct drm_device *dev) | |||
899 | int pipe; | 899 | int pipe; |
900 | u8 pin; | 900 | u8 pin; |
901 | 901 | ||
902 | /* | ||
903 | * Unlock registers and just leave them unlocked. Do this before | ||
904 | * checking quirk lists to avoid bogus WARNINGs. | ||
905 | */ | ||
906 | if (HAS_PCH_SPLIT(dev)) { | ||
907 | I915_WRITE(PCH_PP_CONTROL, | ||
908 | I915_READ(PCH_PP_CONTROL) | PANEL_UNLOCK_REGS); | ||
909 | } else { | ||
910 | I915_WRITE(PP_CONTROL, | ||
911 | I915_READ(PP_CONTROL) | PANEL_UNLOCK_REGS); | ||
912 | } | ||
902 | if (!intel_lvds_supported(dev)) | 913 | if (!intel_lvds_supported(dev)) |
903 | return; | 914 | return; |
904 | 915 | ||
@@ -1097,17 +1108,6 @@ out: | |||
1097 | lvds_encoder->a3_power = I915_READ(lvds_encoder->reg) & | 1108 | lvds_encoder->a3_power = I915_READ(lvds_encoder->reg) & |
1098 | LVDS_A3_POWER_MASK; | 1109 | LVDS_A3_POWER_MASK; |
1099 | 1110 | ||
1100 | /* | ||
1101 | * Unlock registers and just | ||
1102 | * leave them unlocked | ||
1103 | */ | ||
1104 | if (HAS_PCH_SPLIT(dev)) { | ||
1105 | I915_WRITE(PCH_PP_CONTROL, | ||
1106 | I915_READ(PCH_PP_CONTROL) | PANEL_UNLOCK_REGS); | ||
1107 | } else { | ||
1108 | I915_WRITE(PP_CONTROL, | ||
1109 | I915_READ(PP_CONTROL) | PANEL_UNLOCK_REGS); | ||
1110 | } | ||
1111 | lvds_connector->lid_notifier.notifier_call = intel_lid_notify; | 1111 | lvds_connector->lid_notifier.notifier_call = intel_lid_notify; |
1112 | if (acpi_lid_notifier_register(&lvds_connector->lid_notifier)) { | 1112 | if (acpi_lid_notifier_register(&lvds_connector->lid_notifier)) { |
1113 | DRM_DEBUG_KMS("lid notifier registration failed\n"); | 1113 | DRM_DEBUG_KMS("lid notifier registration failed\n"); |
diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c index c27b6140bfd1..ad2fd605f76b 100644 --- a/drivers/gpu/drm/i915/intel_pm.c +++ b/drivers/gpu/drm/i915/intel_pm.c | |||
@@ -5469,11 +5469,6 @@ static void gen6_init_clock_gating(struct drm_device *dev) | |||
5469 | I915_WRITE(_3D_CHICKEN, | 5469 | I915_WRITE(_3D_CHICKEN, |
5470 | _MASKED_BIT_ENABLE(_3D_CHICKEN_HIZ_PLANE_DISABLE_MSAA_4X_SNB)); | 5470 | _MASKED_BIT_ENABLE(_3D_CHICKEN_HIZ_PLANE_DISABLE_MSAA_4X_SNB)); |
5471 | 5471 | ||
5472 | /* WaSetupGtModeTdRowDispatch:snb */ | ||
5473 | if (IS_SNB_GT1(dev)) | ||
5474 | I915_WRITE(GEN6_GT_MODE, | ||
5475 | _MASKED_BIT_ENABLE(GEN6_TD_FOUR_ROW_DISPATCH_DISABLE)); | ||
5476 | |||
5477 | /* WaDisable_RenderCache_OperationalFlush:snb */ | 5472 | /* WaDisable_RenderCache_OperationalFlush:snb */ |
5478 | I915_WRITE(CACHE_MODE_0, _MASKED_BIT_DISABLE(RC_OP_FLUSH_ENABLE)); | 5473 | I915_WRITE(CACHE_MODE_0, _MASKED_BIT_DISABLE(RC_OP_FLUSH_ENABLE)); |
5479 | 5474 | ||
diff --git a/drivers/gpu/drm/nouveau/core/engine/device/nvc0.c b/drivers/gpu/drm/nouveau/core/engine/device/nvc0.c index cd05677ad4b7..72a40f95d048 100644 --- a/drivers/gpu/drm/nouveau/core/engine/device/nvc0.c +++ b/drivers/gpu/drm/nouveau/core/engine/device/nvc0.c | |||
@@ -218,7 +218,6 @@ nvc0_identify(struct nouveau_device *device) | |||
218 | device->oclass[NVDEV_ENGINE_BSP ] = &nvc0_bsp_oclass; | 218 | device->oclass[NVDEV_ENGINE_BSP ] = &nvc0_bsp_oclass; |
219 | device->oclass[NVDEV_ENGINE_PPP ] = &nvc0_ppp_oclass; | 219 | device->oclass[NVDEV_ENGINE_PPP ] = &nvc0_ppp_oclass; |
220 | device->oclass[NVDEV_ENGINE_COPY0 ] = &nvc0_copy0_oclass; | 220 | device->oclass[NVDEV_ENGINE_COPY0 ] = &nvc0_copy0_oclass; |
221 | device->oclass[NVDEV_ENGINE_COPY1 ] = &nvc0_copy1_oclass; | ||
222 | device->oclass[NVDEV_ENGINE_DISP ] = nva3_disp_oclass; | 221 | device->oclass[NVDEV_ENGINE_DISP ] = nva3_disp_oclass; |
223 | device->oclass[NVDEV_ENGINE_PERFMON] = &nvc0_perfmon_oclass; | 222 | device->oclass[NVDEV_ENGINE_PERFMON] = &nvc0_perfmon_oclass; |
224 | break; | 223 | break; |
diff --git a/drivers/gpu/drm/nouveau/core/engine/fifo/nv04.c b/drivers/gpu/drm/nouveau/core/engine/fifo/nv04.c index 5ae6a43893b5..1931057f9962 100644 --- a/drivers/gpu/drm/nouveau/core/engine/fifo/nv04.c +++ b/drivers/gpu/drm/nouveau/core/engine/fifo/nv04.c | |||
@@ -551,8 +551,8 @@ nv04_fifo_intr(struct nouveau_subdev *subdev) | |||
551 | } | 551 | } |
552 | 552 | ||
553 | if (status & 0x40000000) { | 553 | if (status & 0x40000000) { |
554 | nouveau_fifo_uevent(&priv->base); | ||
555 | nv_wr32(priv, 0x002100, 0x40000000); | 554 | nv_wr32(priv, 0x002100, 0x40000000); |
555 | nouveau_fifo_uevent(&priv->base); | ||
556 | status &= ~0x40000000; | 556 | status &= ~0x40000000; |
557 | } | 557 | } |
558 | } | 558 | } |
diff --git a/drivers/gpu/drm/nouveau/core/engine/fifo/nvc0.c b/drivers/gpu/drm/nouveau/core/engine/fifo/nvc0.c index 1fe1f8fbda0c..074d434c3077 100644 --- a/drivers/gpu/drm/nouveau/core/engine/fifo/nvc0.c +++ b/drivers/gpu/drm/nouveau/core/engine/fifo/nvc0.c | |||
@@ -740,6 +740,8 @@ nvc0_fifo_intr_engine_unit(struct nvc0_fifo_priv *priv, int engn) | |||
740 | u32 inte = nv_rd32(priv, 0x002628); | 740 | u32 inte = nv_rd32(priv, 0x002628); |
741 | u32 unkn; | 741 | u32 unkn; |
742 | 742 | ||
743 | nv_wr32(priv, 0x0025a8 + (engn * 0x04), intr); | ||
744 | |||
743 | for (unkn = 0; unkn < 8; unkn++) { | 745 | for (unkn = 0; unkn < 8; unkn++) { |
744 | u32 ints = (intr >> (unkn * 0x04)) & inte; | 746 | u32 ints = (intr >> (unkn * 0x04)) & inte; |
745 | if (ints & 0x1) { | 747 | if (ints & 0x1) { |
@@ -751,8 +753,6 @@ nvc0_fifo_intr_engine_unit(struct nvc0_fifo_priv *priv, int engn) | |||
751 | nv_mask(priv, 0x002628, ints, 0); | 753 | nv_mask(priv, 0x002628, ints, 0); |
752 | } | 754 | } |
753 | } | 755 | } |
754 | |||
755 | nv_wr32(priv, 0x0025a8 + (engn * 0x04), intr); | ||
756 | } | 756 | } |
757 | 757 | ||
758 | static void | 758 | static void |
diff --git a/drivers/gpu/drm/nouveau/core/engine/fifo/nve0.c b/drivers/gpu/drm/nouveau/core/engine/fifo/nve0.c index d2f0fd39c145..f8734eb74eaa 100644 --- a/drivers/gpu/drm/nouveau/core/engine/fifo/nve0.c +++ b/drivers/gpu/drm/nouveau/core/engine/fifo/nve0.c | |||
@@ -952,8 +952,8 @@ nve0_fifo_intr(struct nouveau_subdev *subdev) | |||
952 | } | 952 | } |
953 | 953 | ||
954 | if (stat & 0x80000000) { | 954 | if (stat & 0x80000000) { |
955 | nve0_fifo_intr_engine(priv); | ||
956 | nv_wr32(priv, 0x002100, 0x80000000); | 955 | nv_wr32(priv, 0x002100, 0x80000000); |
956 | nve0_fifo_intr_engine(priv); | ||
957 | stat &= ~0x80000000; | 957 | stat &= ~0x80000000; |
958 | } | 958 | } |
959 | 959 | ||
diff --git a/drivers/gpu/drm/nouveau/nouveau_drm.c b/drivers/gpu/drm/nouveau/nouveau_drm.c index 57238076049f..62b97c4eef8d 100644 --- a/drivers/gpu/drm/nouveau/nouveau_drm.c +++ b/drivers/gpu/drm/nouveau/nouveau_drm.c | |||
@@ -629,7 +629,6 @@ int nouveau_pmops_suspend(struct device *dev) | |||
629 | 629 | ||
630 | pci_save_state(pdev); | 630 | pci_save_state(pdev); |
631 | pci_disable_device(pdev); | 631 | pci_disable_device(pdev); |
632 | pci_ignore_hotplug(pdev); | ||
633 | pci_set_power_state(pdev, PCI_D3hot); | 632 | pci_set_power_state(pdev, PCI_D3hot); |
634 | return 0; | 633 | return 0; |
635 | } | 634 | } |
@@ -933,6 +932,7 @@ static int nouveau_pmops_runtime_suspend(struct device *dev) | |||
933 | ret = nouveau_do_suspend(drm_dev, true); | 932 | ret = nouveau_do_suspend(drm_dev, true); |
934 | pci_save_state(pdev); | 933 | pci_save_state(pdev); |
935 | pci_disable_device(pdev); | 934 | pci_disable_device(pdev); |
935 | pci_ignore_hotplug(pdev); | ||
936 | pci_set_power_state(pdev, PCI_D3cold); | 936 | pci_set_power_state(pdev, PCI_D3cold); |
937 | drm_dev->switch_power_state = DRM_SWITCH_POWER_DYNAMIC_OFF; | 937 | drm_dev->switch_power_state = DRM_SWITCH_POWER_DYNAMIC_OFF; |
938 | return ret; | 938 | return ret; |
diff --git a/drivers/gpu/drm/nouveau/nouveau_fence.c b/drivers/gpu/drm/nouveau/nouveau_fence.c index 515cd9aebb99..f32a434724e3 100644 --- a/drivers/gpu/drm/nouveau/nouveau_fence.c +++ b/drivers/gpu/drm/nouveau/nouveau_fence.c | |||
@@ -52,20 +52,24 @@ nouveau_fctx(struct nouveau_fence *fence) | |||
52 | return container_of(fence->base.lock, struct nouveau_fence_chan, lock); | 52 | return container_of(fence->base.lock, struct nouveau_fence_chan, lock); |
53 | } | 53 | } |
54 | 54 | ||
55 | static void | 55 | static int |
56 | nouveau_fence_signal(struct nouveau_fence *fence) | 56 | nouveau_fence_signal(struct nouveau_fence *fence) |
57 | { | 57 | { |
58 | int drop = 0; | ||
59 | |||
58 | fence_signal_locked(&fence->base); | 60 | fence_signal_locked(&fence->base); |
59 | list_del(&fence->head); | 61 | list_del(&fence->head); |
62 | rcu_assign_pointer(fence->channel, NULL); | ||
60 | 63 | ||
61 | if (test_bit(FENCE_FLAG_USER_BITS, &fence->base.flags)) { | 64 | if (test_bit(FENCE_FLAG_USER_BITS, &fence->base.flags)) { |
62 | struct nouveau_fence_chan *fctx = nouveau_fctx(fence); | 65 | struct nouveau_fence_chan *fctx = nouveau_fctx(fence); |
63 | 66 | ||
64 | if (!--fctx->notify_ref) | 67 | if (!--fctx->notify_ref) |
65 | nvif_notify_put(&fctx->notify); | 68 | drop = 1; |
66 | } | 69 | } |
67 | 70 | ||
68 | fence_put(&fence->base); | 71 | fence_put(&fence->base); |
72 | return drop; | ||
69 | } | 73 | } |
70 | 74 | ||
71 | static struct nouveau_fence * | 75 | static struct nouveau_fence * |
@@ -88,16 +92,23 @@ nouveau_fence_context_del(struct nouveau_fence_chan *fctx) | |||
88 | { | 92 | { |
89 | struct nouveau_fence *fence; | 93 | struct nouveau_fence *fence; |
90 | 94 | ||
91 | nvif_notify_fini(&fctx->notify); | ||
92 | |||
93 | spin_lock_irq(&fctx->lock); | 95 | spin_lock_irq(&fctx->lock); |
94 | while (!list_empty(&fctx->pending)) { | 96 | while (!list_empty(&fctx->pending)) { |
95 | fence = list_entry(fctx->pending.next, typeof(*fence), head); | 97 | fence = list_entry(fctx->pending.next, typeof(*fence), head); |
96 | 98 | ||
97 | nouveau_fence_signal(fence); | 99 | if (nouveau_fence_signal(fence)) |
98 | fence->channel = NULL; | 100 | nvif_notify_put(&fctx->notify); |
99 | } | 101 | } |
100 | spin_unlock_irq(&fctx->lock); | 102 | spin_unlock_irq(&fctx->lock); |
103 | |||
104 | nvif_notify_fini(&fctx->notify); | ||
105 | fctx->dead = 1; | ||
106 | |||
107 | /* | ||
108 | * Ensure that all accesses to fence->channel complete before freeing | ||
109 | * the channel. | ||
110 | */ | ||
111 | synchronize_rcu(); | ||
101 | } | 112 | } |
102 | 113 | ||
103 | static void | 114 | static void |
@@ -112,21 +123,23 @@ nouveau_fence_context_free(struct nouveau_fence_chan *fctx) | |||
112 | kref_put(&fctx->fence_ref, nouveau_fence_context_put); | 123 | kref_put(&fctx->fence_ref, nouveau_fence_context_put); |
113 | } | 124 | } |
114 | 125 | ||
115 | static void | 126 | static int |
116 | nouveau_fence_update(struct nouveau_channel *chan, struct nouveau_fence_chan *fctx) | 127 | nouveau_fence_update(struct nouveau_channel *chan, struct nouveau_fence_chan *fctx) |
117 | { | 128 | { |
118 | struct nouveau_fence *fence; | 129 | struct nouveau_fence *fence; |
119 | 130 | int drop = 0; | |
120 | u32 seq = fctx->read(chan); | 131 | u32 seq = fctx->read(chan); |
121 | 132 | ||
122 | while (!list_empty(&fctx->pending)) { | 133 | while (!list_empty(&fctx->pending)) { |
123 | fence = list_entry(fctx->pending.next, typeof(*fence), head); | 134 | fence = list_entry(fctx->pending.next, typeof(*fence), head); |
124 | 135 | ||
125 | if ((int)(seq - fence->base.seqno) < 0) | 136 | if ((int)(seq - fence->base.seqno) < 0) |
126 | return; | 137 | break; |
127 | 138 | ||
128 | nouveau_fence_signal(fence); | 139 | drop |= nouveau_fence_signal(fence); |
129 | } | 140 | } |
141 | |||
142 | return drop; | ||
130 | } | 143 | } |
131 | 144 | ||
132 | static int | 145 | static int |
@@ -135,18 +148,21 @@ nouveau_fence_wait_uevent_handler(struct nvif_notify *notify) | |||
135 | struct nouveau_fence_chan *fctx = | 148 | struct nouveau_fence_chan *fctx = |
136 | container_of(notify, typeof(*fctx), notify); | 149 | container_of(notify, typeof(*fctx), notify); |
137 | unsigned long flags; | 150 | unsigned long flags; |
151 | int ret = NVIF_NOTIFY_KEEP; | ||
138 | 152 | ||
139 | spin_lock_irqsave(&fctx->lock, flags); | 153 | spin_lock_irqsave(&fctx->lock, flags); |
140 | if (!list_empty(&fctx->pending)) { | 154 | if (!list_empty(&fctx->pending)) { |
141 | struct nouveau_fence *fence; | 155 | struct nouveau_fence *fence; |
156 | struct nouveau_channel *chan; | ||
142 | 157 | ||
143 | fence = list_entry(fctx->pending.next, typeof(*fence), head); | 158 | fence = list_entry(fctx->pending.next, typeof(*fence), head); |
144 | nouveau_fence_update(fence->channel, fctx); | 159 | chan = rcu_dereference_protected(fence->channel, lockdep_is_held(&fctx->lock)); |
160 | if (nouveau_fence_update(fence->channel, fctx)) | ||
161 | ret = NVIF_NOTIFY_DROP; | ||
145 | } | 162 | } |
146 | spin_unlock_irqrestore(&fctx->lock, flags); | 163 | spin_unlock_irqrestore(&fctx->lock, flags); |
147 | 164 | ||
148 | /* Always return keep here. NVIF refcount is handled with nouveau_fence_update */ | 165 | return ret; |
149 | return NVIF_NOTIFY_KEEP; | ||
150 | } | 166 | } |
151 | 167 | ||
152 | void | 168 | void |
@@ -262,7 +278,10 @@ nouveau_fence_emit(struct nouveau_fence *fence, struct nouveau_channel *chan) | |||
262 | if (!ret) { | 278 | if (!ret) { |
263 | fence_get(&fence->base); | 279 | fence_get(&fence->base); |
264 | spin_lock_irq(&fctx->lock); | 280 | spin_lock_irq(&fctx->lock); |
265 | nouveau_fence_update(chan, fctx); | 281 | |
282 | if (nouveau_fence_update(chan, fctx)) | ||
283 | nvif_notify_put(&fctx->notify); | ||
284 | |||
266 | list_add_tail(&fence->head, &fctx->pending); | 285 | list_add_tail(&fence->head, &fctx->pending); |
267 | spin_unlock_irq(&fctx->lock); | 286 | spin_unlock_irq(&fctx->lock); |
268 | } | 287 | } |
@@ -276,13 +295,16 @@ nouveau_fence_done(struct nouveau_fence *fence) | |||
276 | if (fence->base.ops == &nouveau_fence_ops_legacy || | 295 | if (fence->base.ops == &nouveau_fence_ops_legacy || |
277 | fence->base.ops == &nouveau_fence_ops_uevent) { | 296 | fence->base.ops == &nouveau_fence_ops_uevent) { |
278 | struct nouveau_fence_chan *fctx = nouveau_fctx(fence); | 297 | struct nouveau_fence_chan *fctx = nouveau_fctx(fence); |
298 | struct nouveau_channel *chan; | ||
279 | unsigned long flags; | 299 | unsigned long flags; |
280 | 300 | ||
281 | if (test_bit(FENCE_FLAG_SIGNALED_BIT, &fence->base.flags)) | 301 | if (test_bit(FENCE_FLAG_SIGNALED_BIT, &fence->base.flags)) |
282 | return true; | 302 | return true; |
283 | 303 | ||
284 | spin_lock_irqsave(&fctx->lock, flags); | 304 | spin_lock_irqsave(&fctx->lock, flags); |
285 | nouveau_fence_update(fence->channel, fctx); | 305 | chan = rcu_dereference_protected(fence->channel, lockdep_is_held(&fctx->lock)); |
306 | if (chan && nouveau_fence_update(chan, fctx)) | ||
307 | nvif_notify_put(&fctx->notify); | ||
286 | spin_unlock_irqrestore(&fctx->lock, flags); | 308 | spin_unlock_irqrestore(&fctx->lock, flags); |
287 | } | 309 | } |
288 | return fence_is_signaled(&fence->base); | 310 | return fence_is_signaled(&fence->base); |
@@ -387,12 +409,18 @@ nouveau_fence_sync(struct nouveau_bo *nvbo, struct nouveau_channel *chan, bool e | |||
387 | 409 | ||
388 | if (fence && (!exclusive || !fobj || !fobj->shared_count)) { | 410 | if (fence && (!exclusive || !fobj || !fobj->shared_count)) { |
389 | struct nouveau_channel *prev = NULL; | 411 | struct nouveau_channel *prev = NULL; |
412 | bool must_wait = true; | ||
390 | 413 | ||
391 | f = nouveau_local_fence(fence, chan->drm); | 414 | f = nouveau_local_fence(fence, chan->drm); |
392 | if (f) | 415 | if (f) { |
393 | prev = f->channel; | 416 | rcu_read_lock(); |
417 | prev = rcu_dereference(f->channel); | ||
418 | if (prev && (prev == chan || fctx->sync(f, prev, chan) == 0)) | ||
419 | must_wait = false; | ||
420 | rcu_read_unlock(); | ||
421 | } | ||
394 | 422 | ||
395 | if (!prev || (prev != chan && (ret = fctx->sync(f, prev, chan)))) | 423 | if (must_wait) |
396 | ret = fence_wait(fence, intr); | 424 | ret = fence_wait(fence, intr); |
397 | 425 | ||
398 | return ret; | 426 | return ret; |
@@ -403,19 +431,22 @@ nouveau_fence_sync(struct nouveau_bo *nvbo, struct nouveau_channel *chan, bool e | |||
403 | 431 | ||
404 | for (i = 0; i < fobj->shared_count && !ret; ++i) { | 432 | for (i = 0; i < fobj->shared_count && !ret; ++i) { |
405 | struct nouveau_channel *prev = NULL; | 433 | struct nouveau_channel *prev = NULL; |
434 | bool must_wait = true; | ||
406 | 435 | ||
407 | fence = rcu_dereference_protected(fobj->shared[i], | 436 | fence = rcu_dereference_protected(fobj->shared[i], |
408 | reservation_object_held(resv)); | 437 | reservation_object_held(resv)); |
409 | 438 | ||
410 | f = nouveau_local_fence(fence, chan->drm); | 439 | f = nouveau_local_fence(fence, chan->drm); |
411 | if (f) | 440 | if (f) { |
412 | prev = f->channel; | 441 | rcu_read_lock(); |
442 | prev = rcu_dereference(f->channel); | ||
443 | if (prev && (prev == chan || fctx->sync(f, prev, chan) == 0)) | ||
444 | must_wait = false; | ||
445 | rcu_read_unlock(); | ||
446 | } | ||
413 | 447 | ||
414 | if (!prev || (prev != chan && (ret = fctx->sync(f, prev, chan)))) | 448 | if (must_wait) |
415 | ret = fence_wait(fence, intr); | 449 | ret = fence_wait(fence, intr); |
416 | |||
417 | if (ret) | ||
418 | break; | ||
419 | } | 450 | } |
420 | 451 | ||
421 | return ret; | 452 | return ret; |
@@ -463,7 +494,7 @@ static const char *nouveau_fence_get_timeline_name(struct fence *f) | |||
463 | struct nouveau_fence *fence = from_fence(f); | 494 | struct nouveau_fence *fence = from_fence(f); |
464 | struct nouveau_fence_chan *fctx = nouveau_fctx(fence); | 495 | struct nouveau_fence_chan *fctx = nouveau_fctx(fence); |
465 | 496 | ||
466 | return fence->channel ? fctx->name : "dead channel"; | 497 | return !fctx->dead ? fctx->name : "dead channel"; |
467 | } | 498 | } |
468 | 499 | ||
469 | /* | 500 | /* |
@@ -476,9 +507,16 @@ static bool nouveau_fence_is_signaled(struct fence *f) | |||
476 | { | 507 | { |
477 | struct nouveau_fence *fence = from_fence(f); | 508 | struct nouveau_fence *fence = from_fence(f); |
478 | struct nouveau_fence_chan *fctx = nouveau_fctx(fence); | 509 | struct nouveau_fence_chan *fctx = nouveau_fctx(fence); |
479 | struct nouveau_channel *chan = fence->channel; | 510 | struct nouveau_channel *chan; |
511 | bool ret = false; | ||
512 | |||
513 | rcu_read_lock(); | ||
514 | chan = rcu_dereference(fence->channel); | ||
515 | if (chan) | ||
516 | ret = (int)(fctx->read(chan) - fence->base.seqno) >= 0; | ||
517 | rcu_read_unlock(); | ||
480 | 518 | ||
481 | return (int)(fctx->read(chan) - fence->base.seqno) >= 0; | 519 | return ret; |
482 | } | 520 | } |
483 | 521 | ||
484 | static bool nouveau_fence_no_signaling(struct fence *f) | 522 | static bool nouveau_fence_no_signaling(struct fence *f) |
diff --git a/drivers/gpu/drm/nouveau/nouveau_fence.h b/drivers/gpu/drm/nouveau/nouveau_fence.h index 943b0b17b1fc..96e461c6f68f 100644 --- a/drivers/gpu/drm/nouveau/nouveau_fence.h +++ b/drivers/gpu/drm/nouveau/nouveau_fence.h | |||
@@ -14,7 +14,7 @@ struct nouveau_fence { | |||
14 | 14 | ||
15 | bool sysmem; | 15 | bool sysmem; |
16 | 16 | ||
17 | struct nouveau_channel *channel; | 17 | struct nouveau_channel __rcu *channel; |
18 | unsigned long timeout; | 18 | unsigned long timeout; |
19 | }; | 19 | }; |
20 | 20 | ||
@@ -47,7 +47,7 @@ struct nouveau_fence_chan { | |||
47 | char name[32]; | 47 | char name[32]; |
48 | 48 | ||
49 | struct nvif_notify notify; | 49 | struct nvif_notify notify; |
50 | int notify_ref; | 50 | int notify_ref, dead; |
51 | }; | 51 | }; |
52 | 52 | ||
53 | struct nouveau_fence_priv { | 53 | struct nouveau_fence_priv { |
diff --git a/drivers/gpu/drm/radeon/r600_dpm.c b/drivers/gpu/drm/radeon/r600_dpm.c index f6309bd23e01..b5c73df8e202 100644 --- a/drivers/gpu/drm/radeon/r600_dpm.c +++ b/drivers/gpu/drm/radeon/r600_dpm.c | |||
@@ -1256,7 +1256,7 @@ int r600_parse_extended_power_table(struct radeon_device *rdev) | |||
1256 | (mode_info->atom_context->bios + data_offset + | 1256 | (mode_info->atom_context->bios + data_offset + |
1257 | le16_to_cpu(ext_hdr->usPowerTuneTableOffset)); | 1257 | le16_to_cpu(ext_hdr->usPowerTuneTableOffset)); |
1258 | rdev->pm.dpm.dyn_state.cac_tdp_table->maximum_power_delivery_limit = | 1258 | rdev->pm.dpm.dyn_state.cac_tdp_table->maximum_power_delivery_limit = |
1259 | ppt->usMaximumPowerDeliveryLimit; | 1259 | le16_to_cpu(ppt->usMaximumPowerDeliveryLimit); |
1260 | pt = &ppt->power_tune_table; | 1260 | pt = &ppt->power_tune_table; |
1261 | } else { | 1261 | } else { |
1262 | ATOM_PPLIB_POWERTUNE_Table *ppt = (ATOM_PPLIB_POWERTUNE_Table *) | 1262 | ATOM_PPLIB_POWERTUNE_Table *ppt = (ATOM_PPLIB_POWERTUNE_Table *) |
diff --git a/drivers/gpu/drm/radeon/radeon_connectors.c b/drivers/gpu/drm/radeon/radeon_connectors.c index 300c4b3d4669..26baa9c05f6c 100644 --- a/drivers/gpu/drm/radeon/radeon_connectors.c +++ b/drivers/gpu/drm/radeon/radeon_connectors.c | |||
@@ -322,6 +322,12 @@ static void radeon_connector_get_edid(struct drm_connector *connector) | |||
322 | } | 322 | } |
323 | 323 | ||
324 | if (!radeon_connector->edid) { | 324 | if (!radeon_connector->edid) { |
325 | /* don't fetch the edid from the vbios if ddc fails and runpm is | ||
326 | * enabled so we report disconnected. | ||
327 | */ | ||
328 | if ((rdev->flags & RADEON_IS_PX) && (radeon_runtime_pm != 0)) | ||
329 | return; | ||
330 | |||
325 | if (rdev->is_atom_bios) { | 331 | if (rdev->is_atom_bios) { |
326 | /* some laptops provide a hardcoded edid in rom for LCDs */ | 332 | /* some laptops provide a hardcoded edid in rom for LCDs */ |
327 | if (((connector->connector_type == DRM_MODE_CONNECTOR_LVDS) || | 333 | if (((connector->connector_type == DRM_MODE_CONNECTOR_LVDS) || |
@@ -826,6 +832,8 @@ static int radeon_lvds_mode_valid(struct drm_connector *connector, | |||
826 | static enum drm_connector_status | 832 | static enum drm_connector_status |
827 | radeon_lvds_detect(struct drm_connector *connector, bool force) | 833 | radeon_lvds_detect(struct drm_connector *connector, bool force) |
828 | { | 834 | { |
835 | struct drm_device *dev = connector->dev; | ||
836 | struct radeon_device *rdev = dev->dev_private; | ||
829 | struct radeon_connector *radeon_connector = to_radeon_connector(connector); | 837 | struct radeon_connector *radeon_connector = to_radeon_connector(connector); |
830 | struct drm_encoder *encoder = radeon_best_single_encoder(connector); | 838 | struct drm_encoder *encoder = radeon_best_single_encoder(connector); |
831 | enum drm_connector_status ret = connector_status_disconnected; | 839 | enum drm_connector_status ret = connector_status_disconnected; |
@@ -842,7 +850,11 @@ radeon_lvds_detect(struct drm_connector *connector, bool force) | |||
842 | /* check if panel is valid */ | 850 | /* check if panel is valid */ |
843 | if (native_mode->hdisplay >= 320 && native_mode->vdisplay >= 240) | 851 | if (native_mode->hdisplay >= 320 && native_mode->vdisplay >= 240) |
844 | ret = connector_status_connected; | 852 | ret = connector_status_connected; |
845 | 853 | /* don't fetch the edid from the vbios if ddc fails and runpm is | |
854 | * enabled so we report disconnected. | ||
855 | */ | ||
856 | if ((rdev->flags & RADEON_IS_PX) && (radeon_runtime_pm != 0)) | ||
857 | ret = connector_status_disconnected; | ||
846 | } | 858 | } |
847 | 859 | ||
848 | /* check for edid as well */ | 860 | /* check for edid as well */ |
@@ -1589,6 +1601,11 @@ radeon_dp_detect(struct drm_connector *connector, bool force) | |||
1589 | /* check if panel is valid */ | 1601 | /* check if panel is valid */ |
1590 | if (native_mode->hdisplay >= 320 && native_mode->vdisplay >= 240) | 1602 | if (native_mode->hdisplay >= 320 && native_mode->vdisplay >= 240) |
1591 | ret = connector_status_connected; | 1603 | ret = connector_status_connected; |
1604 | /* don't fetch the edid from the vbios if ddc fails and runpm is | ||
1605 | * enabled so we report disconnected. | ||
1606 | */ | ||
1607 | if ((rdev->flags & RADEON_IS_PX) && (radeon_runtime_pm != 0)) | ||
1608 | ret = connector_status_disconnected; | ||
1592 | } | 1609 | } |
1593 | /* eDP is always DP */ | 1610 | /* eDP is always DP */ |
1594 | radeon_dig_connector->dp_sink_type = CONNECTOR_OBJECT_ID_DISPLAYPORT; | 1611 | radeon_dig_connector->dp_sink_type = CONNECTOR_OBJECT_ID_DISPLAYPORT; |
diff --git a/drivers/gpu/drm/radeon/radeon_cs.c b/drivers/gpu/drm/radeon/radeon_cs.c index a3e7aed7e680..6f377de099f9 100644 --- a/drivers/gpu/drm/radeon/radeon_cs.c +++ b/drivers/gpu/drm/radeon/radeon_cs.c | |||
@@ -251,22 +251,19 @@ static int radeon_cs_get_ring(struct radeon_cs_parser *p, u32 ring, s32 priority | |||
251 | 251 | ||
252 | static int radeon_cs_sync_rings(struct radeon_cs_parser *p) | 252 | static int radeon_cs_sync_rings(struct radeon_cs_parser *p) |
253 | { | 253 | { |
254 | int i, r = 0; | 254 | struct radeon_cs_reloc *reloc; |
255 | int r; | ||
255 | 256 | ||
256 | for (i = 0; i < p->nrelocs; i++) { | 257 | list_for_each_entry(reloc, &p->validated, tv.head) { |
257 | struct reservation_object *resv; | 258 | struct reservation_object *resv; |
258 | 259 | ||
259 | if (!p->relocs[i].robj) | 260 | resv = reloc->robj->tbo.resv; |
260 | continue; | ||
261 | |||
262 | resv = p->relocs[i].robj->tbo.resv; | ||
263 | r = radeon_semaphore_sync_resv(p->rdev, p->ib.semaphore, resv, | 261 | r = radeon_semaphore_sync_resv(p->rdev, p->ib.semaphore, resv, |
264 | p->relocs[i].tv.shared); | 262 | reloc->tv.shared); |
265 | |||
266 | if (r) | 263 | if (r) |
267 | break; | 264 | return r; |
268 | } | 265 | } |
269 | return r; | 266 | return 0; |
270 | } | 267 | } |
271 | 268 | ||
272 | /* XXX: note that this is called from the legacy UMS CS ioctl as well */ | 269 | /* XXX: note that this is called from the legacy UMS CS ioctl as well */ |
diff --git a/drivers/gpu/drm/radeon/radeon_encoders.c b/drivers/gpu/drm/radeon/radeon_encoders.c index 9a19e52cc655..6b670b0bc47b 100644 --- a/drivers/gpu/drm/radeon/radeon_encoders.c +++ b/drivers/gpu/drm/radeon/radeon_encoders.c | |||
@@ -179,6 +179,9 @@ static void radeon_encoder_add_backlight(struct radeon_encoder *radeon_encoder, | |||
179 | (rdev->pdev->subsystem_vendor == 0x1734) && | 179 | (rdev->pdev->subsystem_vendor == 0x1734) && |
180 | (rdev->pdev->subsystem_device == 0x1107)) | 180 | (rdev->pdev->subsystem_device == 0x1107)) |
181 | use_bl = false; | 181 | use_bl = false; |
182 | /* disable native backlight control on older asics */ | ||
183 | else if (rdev->family < CHIP_R600) | ||
184 | use_bl = false; | ||
182 | else | 185 | else |
183 | use_bl = true; | 186 | use_bl = true; |
184 | } | 187 | } |
diff --git a/drivers/gpu/drm/radeon/radeon_irq_kms.c b/drivers/gpu/drm/radeon/radeon_irq_kms.c index 7784911d78ef..00fc59762e0d 100644 --- a/drivers/gpu/drm/radeon/radeon_irq_kms.c +++ b/drivers/gpu/drm/radeon/radeon_irq_kms.c | |||
@@ -185,6 +185,16 @@ static bool radeon_msi_ok(struct radeon_device *rdev) | |||
185 | if (rdev->flags & RADEON_IS_AGP) | 185 | if (rdev->flags & RADEON_IS_AGP) |
186 | return false; | 186 | return false; |
187 | 187 | ||
188 | /* | ||
189 | * Older chips have a HW limitation, they can only generate 40 bits | ||
190 | * of address for "64-bit" MSIs which breaks on some platforms, notably | ||
191 | * IBM POWER servers, so we limit them | ||
192 | */ | ||
193 | if (rdev->family < CHIP_BONAIRE) { | ||
194 | dev_info(rdev->dev, "radeon: MSI limited to 32-bit\n"); | ||
195 | rdev->pdev->no_64bit_msi = 1; | ||
196 | } | ||
197 | |||
188 | /* force MSI on */ | 198 | /* force MSI on */ |
189 | if (radeon_msi == 1) | 199 | if (radeon_msi == 1) |
190 | return true; | 200 | return true; |
diff --git a/drivers/gpu/drm/radeon/radeon_kms.c b/drivers/gpu/drm/radeon/radeon_kms.c index 8309b11e674d..03586763ee86 100644 --- a/drivers/gpu/drm/radeon/radeon_kms.c +++ b/drivers/gpu/drm/radeon/radeon_kms.c | |||
@@ -795,6 +795,8 @@ int radeon_get_vblank_timestamp_kms(struct drm_device *dev, int crtc, | |||
795 | 795 | ||
796 | /* Get associated drm_crtc: */ | 796 | /* Get associated drm_crtc: */ |
797 | drmcrtc = &rdev->mode_info.crtcs[crtc]->base; | 797 | drmcrtc = &rdev->mode_info.crtcs[crtc]->base; |
798 | if (!drmcrtc) | ||
799 | return -EINVAL; | ||
798 | 800 | ||
799 | /* Helper routine in DRM core does all the work: */ | 801 | /* Helper routine in DRM core does all the work: */ |
800 | return drm_calc_vbltimestamp_from_scanoutpos(dev, crtc, max_error, | 802 | return drm_calc_vbltimestamp_from_scanoutpos(dev, crtc, max_error, |
diff --git a/drivers/gpu/drm/radeon/radeon_object.c b/drivers/gpu/drm/radeon/radeon_object.c index 99a960a4f302..4c0d786d5c7a 100644 --- a/drivers/gpu/drm/radeon/radeon_object.c +++ b/drivers/gpu/drm/radeon/radeon_object.c | |||
@@ -213,6 +213,13 @@ int radeon_bo_create(struct radeon_device *rdev, | |||
213 | if (!(rdev->flags & RADEON_IS_PCIE)) | 213 | if (!(rdev->flags & RADEON_IS_PCIE)) |
214 | bo->flags &= ~(RADEON_GEM_GTT_WC | RADEON_GEM_GTT_UC); | 214 | bo->flags &= ~(RADEON_GEM_GTT_WC | RADEON_GEM_GTT_UC); |
215 | 215 | ||
216 | #ifdef CONFIG_X86_32 | ||
217 | /* XXX: Write-combined CPU mappings of GTT seem broken on 32-bit | ||
218 | * See https://bugs.freedesktop.org/show_bug.cgi?id=84627 | ||
219 | */ | ||
220 | bo->flags &= ~RADEON_GEM_GTT_WC; | ||
221 | #endif | ||
222 | |||
216 | radeon_ttm_placement_from_domain(bo, domain); | 223 | radeon_ttm_placement_from_domain(bo, domain); |
217 | /* Kernel allocation are uninterruptible */ | 224 | /* Kernel allocation are uninterruptible */ |
218 | down_read(&rdev->pm.mclk_lock); | 225 | down_read(&rdev->pm.mclk_lock); |
diff --git a/drivers/hwmon/g762.c b/drivers/hwmon/g762.c index 6aac695b1688..9b55e673b67c 100644 --- a/drivers/hwmon/g762.c +++ b/drivers/hwmon/g762.c | |||
@@ -1084,10 +1084,8 @@ static int g762_probe(struct i2c_client *client, const struct i2c_device_id *id) | |||
1084 | if (ret) | 1084 | if (ret) |
1085 | goto clock_dis; | 1085 | goto clock_dis; |
1086 | 1086 | ||
1087 | data->hwmon_dev = devm_hwmon_device_register_with_groups(dev, | 1087 | data->hwmon_dev = hwmon_device_register_with_groups(dev, client->name, |
1088 | client->name, | 1088 | data, g762_groups); |
1089 | data, | ||
1090 | g762_groups); | ||
1091 | if (IS_ERR(data->hwmon_dev)) { | 1089 | if (IS_ERR(data->hwmon_dev)) { |
1092 | ret = PTR_ERR(data->hwmon_dev); | 1090 | ret = PTR_ERR(data->hwmon_dev); |
1093 | goto clock_dis; | 1091 | goto clock_dis; |
diff --git a/drivers/i2c/busses/i2c-cadence.c b/drivers/i2c/busses/i2c-cadence.c index 63f3f03ecc9b..c604f4c3ac0d 100644 --- a/drivers/i2c/busses/i2c-cadence.c +++ b/drivers/i2c/busses/i2c-cadence.c | |||
@@ -111,6 +111,8 @@ | |||
111 | #define CDNS_I2C_DIVA_MAX 4 | 111 | #define CDNS_I2C_DIVA_MAX 4 |
112 | #define CDNS_I2C_DIVB_MAX 64 | 112 | #define CDNS_I2C_DIVB_MAX 64 |
113 | 113 | ||
114 | #define CDNS_I2C_TIMEOUT_MAX 0xFF | ||
115 | |||
114 | #define cdns_i2c_readreg(offset) readl_relaxed(id->membase + offset) | 116 | #define cdns_i2c_readreg(offset) readl_relaxed(id->membase + offset) |
115 | #define cdns_i2c_writereg(val, offset) writel_relaxed(val, id->membase + offset) | 117 | #define cdns_i2c_writereg(val, offset) writel_relaxed(val, id->membase + offset) |
116 | 118 | ||
@@ -852,6 +854,15 @@ static int cdns_i2c_probe(struct platform_device *pdev) | |||
852 | goto err_clk_dis; | 854 | goto err_clk_dis; |
853 | } | 855 | } |
854 | 856 | ||
857 | /* | ||
858 | * Cadence I2C controller has a bug wherein it generates | ||
859 | * invalid read transaction after HW timeout in master receiver mode. | ||
860 | * HW timeout is not used by this driver and the interrupt is disabled. | ||
861 | * But the feature itself cannot be disabled. Hence maximum value | ||
862 | * is written to this register to reduce the chances of error. | ||
863 | */ | ||
864 | cdns_i2c_writereg(CDNS_I2C_TIMEOUT_MAX, CDNS_I2C_TIME_OUT_OFFSET); | ||
865 | |||
855 | dev_info(&pdev->dev, "%u kHz mmio %08lx irq %d\n", | 866 | dev_info(&pdev->dev, "%u kHz mmio %08lx irq %d\n", |
856 | id->i2c_clk / 1000, (unsigned long)r_mem->start, id->irq); | 867 | id->i2c_clk / 1000, (unsigned long)r_mem->start, id->irq); |
857 | 868 | ||
diff --git a/drivers/i2c/busses/i2c-davinci.c b/drivers/i2c/busses/i2c-davinci.c index d15b7c9b9219..01f0cd87a4a5 100644 --- a/drivers/i2c/busses/i2c-davinci.c +++ b/drivers/i2c/busses/i2c-davinci.c | |||
@@ -407,11 +407,9 @@ i2c_davinci_xfer_msg(struct i2c_adapter *adap, struct i2c_msg *msg, int stop) | |||
407 | if (dev->cmd_err & DAVINCI_I2C_STR_NACK) { | 407 | if (dev->cmd_err & DAVINCI_I2C_STR_NACK) { |
408 | if (msg->flags & I2C_M_IGNORE_NAK) | 408 | if (msg->flags & I2C_M_IGNORE_NAK) |
409 | return msg->len; | 409 | return msg->len; |
410 | if (stop) { | 410 | w = davinci_i2c_read_reg(dev, DAVINCI_I2C_MDR_REG); |
411 | w = davinci_i2c_read_reg(dev, DAVINCI_I2C_MDR_REG); | 411 | w |= DAVINCI_I2C_MDR_STP; |
412 | w |= DAVINCI_I2C_MDR_STP; | 412 | davinci_i2c_write_reg(dev, DAVINCI_I2C_MDR_REG, w); |
413 | davinci_i2c_write_reg(dev, DAVINCI_I2C_MDR_REG, w); | ||
414 | } | ||
415 | return -EREMOTEIO; | 413 | return -EREMOTEIO; |
416 | } | 414 | } |
417 | return -EIO; | 415 | return -EIO; |
diff --git a/drivers/i2c/busses/i2c-designware-core.c b/drivers/i2c/busses/i2c-designware-core.c index edca99dbba23..23628b7bfb8d 100644 --- a/drivers/i2c/busses/i2c-designware-core.c +++ b/drivers/i2c/busses/i2c-designware-core.c | |||
@@ -359,7 +359,7 @@ int i2c_dw_init(struct dw_i2c_dev *dev) | |||
359 | } | 359 | } |
360 | 360 | ||
361 | /* Configure Tx/Rx FIFO threshold levels */ | 361 | /* Configure Tx/Rx FIFO threshold levels */ |
362 | dw_writel(dev, dev->tx_fifo_depth - 1, DW_IC_TX_TL); | 362 | dw_writel(dev, dev->tx_fifo_depth / 2, DW_IC_TX_TL); |
363 | dw_writel(dev, 0, DW_IC_RX_TL); | 363 | dw_writel(dev, 0, DW_IC_RX_TL); |
364 | 364 | ||
365 | /* configure the i2c master */ | 365 | /* configure the i2c master */ |
diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c index 26942c159de1..277a2288d4a8 100644 --- a/drivers/i2c/busses/i2c-omap.c +++ b/drivers/i2c/busses/i2c-omap.c | |||
@@ -922,14 +922,12 @@ omap_i2c_isr_thread(int this_irq, void *dev_id) | |||
922 | if (stat & OMAP_I2C_STAT_NACK) { | 922 | if (stat & OMAP_I2C_STAT_NACK) { |
923 | err |= OMAP_I2C_STAT_NACK; | 923 | err |= OMAP_I2C_STAT_NACK; |
924 | omap_i2c_ack_stat(dev, OMAP_I2C_STAT_NACK); | 924 | omap_i2c_ack_stat(dev, OMAP_I2C_STAT_NACK); |
925 | break; | ||
926 | } | 925 | } |
927 | 926 | ||
928 | if (stat & OMAP_I2C_STAT_AL) { | 927 | if (stat & OMAP_I2C_STAT_AL) { |
929 | dev_err(dev->dev, "Arbitration lost\n"); | 928 | dev_err(dev->dev, "Arbitration lost\n"); |
930 | err |= OMAP_I2C_STAT_AL; | 929 | err |= OMAP_I2C_STAT_AL; |
931 | omap_i2c_ack_stat(dev, OMAP_I2C_STAT_AL); | 930 | omap_i2c_ack_stat(dev, OMAP_I2C_STAT_AL); |
932 | break; | ||
933 | } | 931 | } |
934 | 932 | ||
935 | /* | 933 | /* |
@@ -954,11 +952,13 @@ omap_i2c_isr_thread(int this_irq, void *dev_id) | |||
954 | if (dev->fifo_size) | 952 | if (dev->fifo_size) |
955 | num_bytes = dev->buf_len; | 953 | num_bytes = dev->buf_len; |
956 | 954 | ||
957 | omap_i2c_receive_data(dev, num_bytes, true); | 955 | if (dev->errata & I2C_OMAP_ERRATA_I207) { |
958 | |||
959 | if (dev->errata & I2C_OMAP_ERRATA_I207) | ||
960 | i2c_omap_errata_i207(dev, stat); | 956 | i2c_omap_errata_i207(dev, stat); |
957 | num_bytes = (omap_i2c_read_reg(dev, | ||
958 | OMAP_I2C_BUFSTAT_REG) >> 8) & 0x3F; | ||
959 | } | ||
961 | 960 | ||
961 | omap_i2c_receive_data(dev, num_bytes, true); | ||
962 | omap_i2c_ack_stat(dev, OMAP_I2C_STAT_RDR); | 962 | omap_i2c_ack_stat(dev, OMAP_I2C_STAT_RDR); |
963 | continue; | 963 | continue; |
964 | } | 964 | } |
diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c index f43b4e11647a..68aeb8eedae0 100644 --- a/drivers/i2c/i2c-core.c +++ b/drivers/i2c/i2c-core.c | |||
@@ -403,6 +403,7 @@ static int acpi_i2c_install_space_handler(struct i2c_adapter *adapter) | |||
403 | return -ENOMEM; | 403 | return -ENOMEM; |
404 | } | 404 | } |
405 | 405 | ||
406 | acpi_walk_dep_device_list(handle); | ||
406 | return 0; | 407 | return 0; |
407 | } | 408 | } |
408 | 409 | ||
diff --git a/drivers/iio/accel/bmc150-accel.c b/drivers/iio/accel/bmc150-accel.c index 22c096ce39ad..513bd6d14293 100644 --- a/drivers/iio/accel/bmc150-accel.c +++ b/drivers/iio/accel/bmc150-accel.c | |||
@@ -44,6 +44,9 @@ | |||
44 | 44 | ||
45 | #define BMC150_ACCEL_REG_INT_STATUS_2 0x0B | 45 | #define BMC150_ACCEL_REG_INT_STATUS_2 0x0B |
46 | #define BMC150_ACCEL_ANY_MOTION_MASK 0x07 | 46 | #define BMC150_ACCEL_ANY_MOTION_MASK 0x07 |
47 | #define BMC150_ACCEL_ANY_MOTION_BIT_X BIT(0) | ||
48 | #define BMC150_ACCEL_ANY_MOTION_BIT_Y BIT(1) | ||
49 | #define BMC150_ACCEL_ANY_MOTION_BIT_Z BIT(2) | ||
47 | #define BMC150_ACCEL_ANY_MOTION_BIT_SIGN BIT(3) | 50 | #define BMC150_ACCEL_ANY_MOTION_BIT_SIGN BIT(3) |
48 | 51 | ||
49 | #define BMC150_ACCEL_REG_PMU_LPW 0x11 | 52 | #define BMC150_ACCEL_REG_PMU_LPW 0x11 |
@@ -92,9 +95,9 @@ | |||
92 | #define BMC150_ACCEL_SLOPE_THRES_MASK 0xFF | 95 | #define BMC150_ACCEL_SLOPE_THRES_MASK 0xFF |
93 | 96 | ||
94 | /* Slope duration in terms of number of samples */ | 97 | /* Slope duration in terms of number of samples */ |
95 | #define BMC150_ACCEL_DEF_SLOPE_DURATION 2 | 98 | #define BMC150_ACCEL_DEF_SLOPE_DURATION 1 |
96 | /* in terms of multiples of g's/LSB, based on range */ | 99 | /* in terms of multiples of g's/LSB, based on range */ |
97 | #define BMC150_ACCEL_DEF_SLOPE_THRESHOLD 5 | 100 | #define BMC150_ACCEL_DEF_SLOPE_THRESHOLD 1 |
98 | 101 | ||
99 | #define BMC150_ACCEL_REG_XOUT_L 0x02 | 102 | #define BMC150_ACCEL_REG_XOUT_L 0x02 |
100 | 103 | ||
@@ -536,6 +539,9 @@ static int bmc150_accel_set_power_state(struct bmc150_accel_data *data, bool on) | |||
536 | if (ret < 0) { | 539 | if (ret < 0) { |
537 | dev_err(&data->client->dev, | 540 | dev_err(&data->client->dev, |
538 | "Failed: bmc150_accel_set_power_state for %d\n", on); | 541 | "Failed: bmc150_accel_set_power_state for %d\n", on); |
542 | if (on) | ||
543 | pm_runtime_put_noidle(&data->client->dev); | ||
544 | |||
539 | return ret; | 545 | return ret; |
540 | } | 546 | } |
541 | 547 | ||
@@ -811,6 +817,7 @@ static int bmc150_accel_write_event_config(struct iio_dev *indio_dev, | |||
811 | 817 | ||
812 | ret = bmc150_accel_setup_any_motion_interrupt(data, state); | 818 | ret = bmc150_accel_setup_any_motion_interrupt(data, state); |
813 | if (ret < 0) { | 819 | if (ret < 0) { |
820 | bmc150_accel_set_power_state(data, false); | ||
814 | mutex_unlock(&data->mutex); | 821 | mutex_unlock(&data->mutex); |
815 | return ret; | 822 | return ret; |
816 | } | 823 | } |
@@ -846,7 +853,7 @@ static const struct attribute_group bmc150_accel_attrs_group = { | |||
846 | 853 | ||
847 | static const struct iio_event_spec bmc150_accel_event = { | 854 | static const struct iio_event_spec bmc150_accel_event = { |
848 | .type = IIO_EV_TYPE_ROC, | 855 | .type = IIO_EV_TYPE_ROC, |
849 | .dir = IIO_EV_DIR_RISING | IIO_EV_DIR_FALLING, | 856 | .dir = IIO_EV_DIR_EITHER, |
850 | .mask_separate = BIT(IIO_EV_INFO_VALUE) | | 857 | .mask_separate = BIT(IIO_EV_INFO_VALUE) | |
851 | BIT(IIO_EV_INFO_ENABLE) | | 858 | BIT(IIO_EV_INFO_ENABLE) | |
852 | BIT(IIO_EV_INFO_PERIOD) | 859 | BIT(IIO_EV_INFO_PERIOD) |
@@ -1054,6 +1061,7 @@ static int bmc150_accel_data_rdy_trigger_set_state(struct iio_trigger *trig, | |||
1054 | else | 1061 | else |
1055 | ret = bmc150_accel_setup_new_data_interrupt(data, state); | 1062 | ret = bmc150_accel_setup_new_data_interrupt(data, state); |
1056 | if (ret < 0) { | 1063 | if (ret < 0) { |
1064 | bmc150_accel_set_power_state(data, false); | ||
1057 | mutex_unlock(&data->mutex); | 1065 | mutex_unlock(&data->mutex); |
1058 | return ret; | 1066 | return ret; |
1059 | } | 1067 | } |
@@ -1092,12 +1100,26 @@ static irqreturn_t bmc150_accel_event_handler(int irq, void *private) | |||
1092 | else | 1100 | else |
1093 | dir = IIO_EV_DIR_RISING; | 1101 | dir = IIO_EV_DIR_RISING; |
1094 | 1102 | ||
1095 | if (ret & BMC150_ACCEL_ANY_MOTION_MASK) | 1103 | if (ret & BMC150_ACCEL_ANY_MOTION_BIT_X) |
1104 | iio_push_event(indio_dev, IIO_MOD_EVENT_CODE(IIO_ACCEL, | ||
1105 | 0, | ||
1106 | IIO_MOD_X, | ||
1107 | IIO_EV_TYPE_ROC, | ||
1108 | dir), | ||
1109 | data->timestamp); | ||
1110 | if (ret & BMC150_ACCEL_ANY_MOTION_BIT_Y) | ||
1096 | iio_push_event(indio_dev, IIO_MOD_EVENT_CODE(IIO_ACCEL, | 1111 | iio_push_event(indio_dev, IIO_MOD_EVENT_CODE(IIO_ACCEL, |
1097 | 0, | 1112 | 0, |
1098 | IIO_MOD_X_OR_Y_OR_Z, | 1113 | IIO_MOD_Y, |
1099 | IIO_EV_TYPE_ROC, | 1114 | IIO_EV_TYPE_ROC, |
1100 | IIO_EV_DIR_EITHER), | 1115 | dir), |
1116 | data->timestamp); | ||
1117 | if (ret & BMC150_ACCEL_ANY_MOTION_BIT_Z) | ||
1118 | iio_push_event(indio_dev, IIO_MOD_EVENT_CODE(IIO_ACCEL, | ||
1119 | 0, | ||
1120 | IIO_MOD_Z, | ||
1121 | IIO_EV_TYPE_ROC, | ||
1122 | dir), | ||
1101 | data->timestamp); | 1123 | data->timestamp); |
1102 | ack_intr_status: | 1124 | ack_intr_status: |
1103 | if (!data->dready_trigger_on) | 1125 | if (!data->dready_trigger_on) |
@@ -1354,10 +1376,14 @@ static int bmc150_accel_runtime_suspend(struct device *dev) | |||
1354 | { | 1376 | { |
1355 | struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev)); | 1377 | struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev)); |
1356 | struct bmc150_accel_data *data = iio_priv(indio_dev); | 1378 | struct bmc150_accel_data *data = iio_priv(indio_dev); |
1379 | int ret; | ||
1357 | 1380 | ||
1358 | dev_dbg(&data->client->dev, __func__); | 1381 | dev_dbg(&data->client->dev, __func__); |
1382 | ret = bmc150_accel_set_mode(data, BMC150_ACCEL_SLEEP_MODE_SUSPEND, 0); | ||
1383 | if (ret < 0) | ||
1384 | return -EAGAIN; | ||
1359 | 1385 | ||
1360 | return bmc150_accel_set_mode(data, BMC150_ACCEL_SLEEP_MODE_SUSPEND, 0); | 1386 | return 0; |
1361 | } | 1387 | } |
1362 | 1388 | ||
1363 | static int bmc150_accel_runtime_resume(struct device *dev) | 1389 | static int bmc150_accel_runtime_resume(struct device *dev) |
diff --git a/drivers/iio/accel/kxcjk-1013.c b/drivers/iio/accel/kxcjk-1013.c index a23e58c4ed99..320aa72c0349 100644 --- a/drivers/iio/accel/kxcjk-1013.c +++ b/drivers/iio/accel/kxcjk-1013.c | |||
@@ -269,6 +269,8 @@ static int kxcjk1013_set_range(struct kxcjk1013_data *data, int range_index) | |||
269 | return ret; | 269 | return ret; |
270 | } | 270 | } |
271 | 271 | ||
272 | ret &= ~(KXCJK1013_REG_CTRL1_BIT_GSEL0 | | ||
273 | KXCJK1013_REG_CTRL1_BIT_GSEL1); | ||
272 | ret |= (KXCJK1013_scale_table[range_index].gsel_0 << 3); | 274 | ret |= (KXCJK1013_scale_table[range_index].gsel_0 << 3); |
273 | ret |= (KXCJK1013_scale_table[range_index].gsel_1 << 4); | 275 | ret |= (KXCJK1013_scale_table[range_index].gsel_1 << 4); |
274 | 276 | ||
diff --git a/drivers/iio/adc/Kconfig b/drivers/iio/adc/Kconfig index 88bdc8f612e2..bc4e787096e8 100644 --- a/drivers/iio/adc/Kconfig +++ b/drivers/iio/adc/Kconfig | |||
@@ -127,6 +127,14 @@ config AT91_ADC | |||
127 | help | 127 | help |
128 | Say yes here to build support for Atmel AT91 ADC. | 128 | Say yes here to build support for Atmel AT91 ADC. |
129 | 129 | ||
130 | config AXP288_ADC | ||
131 | tristate "X-Powers AXP288 ADC driver" | ||
132 | depends on MFD_AXP20X | ||
133 | help | ||
134 | Say yes here to have support for X-Powers power management IC (PMIC) ADC | ||
135 | device. Depending on platform configuration, this general purpose ADC can | ||
136 | be used for sampling sensors such as thermal resistors. | ||
137 | |||
130 | config EXYNOS_ADC | 138 | config EXYNOS_ADC |
131 | tristate "Exynos ADC driver support" | 139 | tristate "Exynos ADC driver support" |
132 | depends on ARCH_EXYNOS || ARCH_S3C24XX || ARCH_S3C64XX || (OF && COMPILE_TEST) | 140 | depends on ARCH_EXYNOS || ARCH_S3C24XX || ARCH_S3C64XX || (OF && COMPILE_TEST) |
diff --git a/drivers/iio/adc/Makefile b/drivers/iio/adc/Makefile index cb88a6a23b8f..f30093f5b67a 100644 --- a/drivers/iio/adc/Makefile +++ b/drivers/iio/adc/Makefile | |||
@@ -14,6 +14,7 @@ obj-$(CONFIG_AD7793) += ad7793.o | |||
14 | obj-$(CONFIG_AD7887) += ad7887.o | 14 | obj-$(CONFIG_AD7887) += ad7887.o |
15 | obj-$(CONFIG_AD799X) += ad799x.o | 15 | obj-$(CONFIG_AD799X) += ad799x.o |
16 | obj-$(CONFIG_AT91_ADC) += at91_adc.o | 16 | obj-$(CONFIG_AT91_ADC) += at91_adc.o |
17 | obj-$(CONFIG_AXP288_ADC) += axp288_adc.o | ||
17 | obj-$(CONFIG_EXYNOS_ADC) += exynos_adc.o | 18 | obj-$(CONFIG_EXYNOS_ADC) += exynos_adc.o |
18 | obj-$(CONFIG_LP8788_ADC) += lp8788_adc.o | 19 | obj-$(CONFIG_LP8788_ADC) += lp8788_adc.o |
19 | obj-$(CONFIG_MAX1027) += max1027.o | 20 | obj-$(CONFIG_MAX1027) += max1027.o |
diff --git a/drivers/iio/adc/axp288_adc.c b/drivers/iio/adc/axp288_adc.c new file mode 100644 index 000000000000..08bcfb061ca5 --- /dev/null +++ b/drivers/iio/adc/axp288_adc.c | |||
@@ -0,0 +1,261 @@ | |||
1 | /* | ||
2 | * axp288_adc.c - X-Powers AXP288 PMIC ADC Driver | ||
3 | * | ||
4 | * Copyright (C) 2014 Intel Corporation | ||
5 | * | ||
6 | * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
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 as published by | ||
10 | * the Free Software Foundation; version 2 of the License. | ||
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 | ||
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
15 | * General Public License for more details. | ||
16 | * | ||
17 | */ | ||
18 | |||
19 | #include <linux/module.h> | ||
20 | #include <linux/kernel.h> | ||
21 | #include <linux/device.h> | ||
22 | #include <linux/regmap.h> | ||
23 | #include <linux/mfd/axp20x.h> | ||
24 | #include <linux/platform_device.h> | ||
25 | |||
26 | #include <linux/iio/iio.h> | ||
27 | #include <linux/iio/machine.h> | ||
28 | #include <linux/iio/driver.h> | ||
29 | |||
30 | #define AXP288_ADC_EN_MASK 0xF1 | ||
31 | #define AXP288_ADC_TS_PIN_GPADC 0xF2 | ||
32 | #define AXP288_ADC_TS_PIN_ON 0xF3 | ||
33 | |||
34 | enum axp288_adc_id { | ||
35 | AXP288_ADC_TS, | ||
36 | AXP288_ADC_PMIC, | ||
37 | AXP288_ADC_GP, | ||
38 | AXP288_ADC_BATT_CHRG_I, | ||
39 | AXP288_ADC_BATT_DISCHRG_I, | ||
40 | AXP288_ADC_BATT_V, | ||
41 | AXP288_ADC_NR_CHAN, | ||
42 | }; | ||
43 | |||
44 | struct axp288_adc_info { | ||
45 | int irq; | ||
46 | struct regmap *regmap; | ||
47 | }; | ||
48 | |||
49 | static const struct iio_chan_spec const axp288_adc_channels[] = { | ||
50 | { | ||
51 | .indexed = 1, | ||
52 | .type = IIO_TEMP, | ||
53 | .channel = 0, | ||
54 | .address = AXP288_TS_ADC_H, | ||
55 | .datasheet_name = "TS_PIN", | ||
56 | }, { | ||
57 | .indexed = 1, | ||
58 | .type = IIO_TEMP, | ||
59 | .channel = 1, | ||
60 | .address = AXP288_PMIC_ADC_H, | ||
61 | .datasheet_name = "PMIC_TEMP", | ||
62 | }, { | ||
63 | .indexed = 1, | ||
64 | .type = IIO_TEMP, | ||
65 | .channel = 2, | ||
66 | .address = AXP288_GP_ADC_H, | ||
67 | .datasheet_name = "GPADC", | ||
68 | }, { | ||
69 | .indexed = 1, | ||
70 | .type = IIO_CURRENT, | ||
71 | .channel = 3, | ||
72 | .address = AXP20X_BATT_CHRG_I_H, | ||
73 | .datasheet_name = "BATT_CHG_I", | ||
74 | .info_mask_separate = BIT(IIO_CHAN_INFO_PROCESSED), | ||
75 | }, { | ||
76 | .indexed = 1, | ||
77 | .type = IIO_CURRENT, | ||
78 | .channel = 4, | ||
79 | .address = AXP20X_BATT_DISCHRG_I_H, | ||
80 | .datasheet_name = "BATT_DISCHRG_I", | ||
81 | .info_mask_separate = BIT(IIO_CHAN_INFO_PROCESSED), | ||
82 | }, { | ||
83 | .indexed = 1, | ||
84 | .type = IIO_VOLTAGE, | ||
85 | .channel = 5, | ||
86 | .address = AXP20X_BATT_V_H, | ||
87 | .datasheet_name = "BATT_V", | ||
88 | .info_mask_separate = BIT(IIO_CHAN_INFO_PROCESSED), | ||
89 | }, | ||
90 | }; | ||
91 | |||
92 | #define AXP288_ADC_MAP(_adc_channel_label, _consumer_dev_name, \ | ||
93 | _consumer_channel) \ | ||
94 | { \ | ||
95 | .adc_channel_label = _adc_channel_label, \ | ||
96 | .consumer_dev_name = _consumer_dev_name, \ | ||
97 | .consumer_channel = _consumer_channel, \ | ||
98 | } | ||
99 | |||
100 | /* for consumer drivers */ | ||
101 | static struct iio_map axp288_adc_default_maps[] = { | ||
102 | AXP288_ADC_MAP("TS_PIN", "axp288-batt", "axp288-batt-temp"), | ||
103 | AXP288_ADC_MAP("PMIC_TEMP", "axp288-pmic", "axp288-pmic-temp"), | ||
104 | AXP288_ADC_MAP("GPADC", "axp288-gpadc", "axp288-system-temp"), | ||
105 | AXP288_ADC_MAP("BATT_CHG_I", "axp288-chrg", "axp288-chrg-curr"), | ||
106 | AXP288_ADC_MAP("BATT_DISCHRG_I", "axp288-chrg", "axp288-chrg-d-curr"), | ||
107 | AXP288_ADC_MAP("BATT_V", "axp288-batt", "axp288-batt-volt"), | ||
108 | {}, | ||
109 | }; | ||
110 | |||
111 | static int axp288_adc_read_channel(int *val, unsigned long address, | ||
112 | struct regmap *regmap) | ||
113 | { | ||
114 | u8 buf[2]; | ||
115 | |||
116 | if (regmap_bulk_read(regmap, address, buf, 2)) | ||
117 | return -EIO; | ||
118 | *val = (buf[0] << 4) + ((buf[1] >> 4) & 0x0F); | ||
119 | |||
120 | return IIO_VAL_INT; | ||
121 | } | ||
122 | |||
123 | static int axp288_adc_set_ts(struct regmap *regmap, unsigned int mode, | ||
124 | unsigned long address) | ||
125 | { | ||
126 | /* channels other than GPADC do not need to switch TS pin */ | ||
127 | if (address != AXP288_GP_ADC_H) | ||
128 | return 0; | ||
129 | |||
130 | return regmap_write(regmap, AXP288_ADC_TS_PIN_CTRL, mode); | ||
131 | } | ||
132 | |||
133 | static int axp288_adc_read_raw(struct iio_dev *indio_dev, | ||
134 | struct iio_chan_spec const *chan, | ||
135 | int *val, int *val2, long mask) | ||
136 | { | ||
137 | int ret; | ||
138 | struct axp288_adc_info *info = iio_priv(indio_dev); | ||
139 | |||
140 | mutex_lock(&indio_dev->mlock); | ||
141 | switch (mask) { | ||
142 | case IIO_CHAN_INFO_RAW: | ||
143 | if (axp288_adc_set_ts(info->regmap, AXP288_ADC_TS_PIN_GPADC, | ||
144 | chan->address)) { | ||
145 | dev_err(&indio_dev->dev, "GPADC mode\n"); | ||
146 | ret = -EINVAL; | ||
147 | break; | ||
148 | } | ||
149 | ret = axp288_adc_read_channel(val, chan->address, info->regmap); | ||
150 | if (axp288_adc_set_ts(info->regmap, AXP288_ADC_TS_PIN_ON, | ||
151 | chan->address)) | ||
152 | dev_err(&indio_dev->dev, "TS pin restore\n"); | ||
153 | break; | ||
154 | case IIO_CHAN_INFO_PROCESSED: | ||
155 | ret = axp288_adc_read_channel(val, chan->address, info->regmap); | ||
156 | break; | ||
157 | default: | ||
158 | ret = -EINVAL; | ||
159 | } | ||
160 | mutex_unlock(&indio_dev->mlock); | ||
161 | |||
162 | return ret; | ||
163 | } | ||
164 | |||
165 | static int axp288_adc_set_state(struct regmap *regmap) | ||
166 | { | ||
167 | /* ADC should be always enabled for internal FG to function */ | ||
168 | if (regmap_write(regmap, AXP288_ADC_TS_PIN_CTRL, AXP288_ADC_TS_PIN_ON)) | ||
169 | return -EIO; | ||
170 | |||
171 | return regmap_write(regmap, AXP20X_ADC_EN1, AXP288_ADC_EN_MASK); | ||
172 | } | ||
173 | |||
174 | static const struct iio_info axp288_adc_iio_info = { | ||
175 | .read_raw = &axp288_adc_read_raw, | ||
176 | .driver_module = THIS_MODULE, | ||
177 | }; | ||
178 | |||
179 | static int axp288_adc_probe(struct platform_device *pdev) | ||
180 | { | ||
181 | int ret; | ||
182 | struct axp288_adc_info *info; | ||
183 | struct iio_dev *indio_dev; | ||
184 | struct axp20x_dev *axp20x = dev_get_drvdata(pdev->dev.parent); | ||
185 | |||
186 | indio_dev = devm_iio_device_alloc(&pdev->dev, sizeof(*info)); | ||
187 | if (!indio_dev) | ||
188 | return -ENOMEM; | ||
189 | |||
190 | info = iio_priv(indio_dev); | ||
191 | info->irq = platform_get_irq(pdev, 0); | ||
192 | if (info->irq < 0) { | ||
193 | dev_err(&pdev->dev, "no irq resource?\n"); | ||
194 | return info->irq; | ||
195 | } | ||
196 | platform_set_drvdata(pdev, indio_dev); | ||
197 | info->regmap = axp20x->regmap; | ||
198 | /* | ||
199 | * Set ADC to enabled state at all time, including system suspend. | ||
200 | * otherwise internal fuel gauge functionality may be affected. | ||
201 | */ | ||
202 | ret = axp288_adc_set_state(axp20x->regmap); | ||
203 | if (ret) { | ||
204 | dev_err(&pdev->dev, "unable to enable ADC device\n"); | ||
205 | return ret; | ||
206 | } | ||
207 | |||
208 | indio_dev->dev.parent = &pdev->dev; | ||
209 | indio_dev->name = pdev->name; | ||
210 | indio_dev->channels = axp288_adc_channels; | ||
211 | indio_dev->num_channels = ARRAY_SIZE(axp288_adc_channels); | ||
212 | indio_dev->info = &axp288_adc_iio_info; | ||
213 | indio_dev->modes = INDIO_DIRECT_MODE; | ||
214 | ret = iio_map_array_register(indio_dev, axp288_adc_default_maps); | ||
215 | if (ret < 0) | ||
216 | return ret; | ||
217 | |||
218 | ret = iio_device_register(indio_dev); | ||
219 | if (ret < 0) { | ||
220 | dev_err(&pdev->dev, "unable to register iio device\n"); | ||
221 | goto err_array_unregister; | ||
222 | } | ||
223 | return 0; | ||
224 | |||
225 | err_array_unregister: | ||
226 | iio_map_array_unregister(indio_dev); | ||
227 | |||
228 | return ret; | ||
229 | } | ||
230 | |||
231 | static int axp288_adc_remove(struct platform_device *pdev) | ||
232 | { | ||
233 | struct iio_dev *indio_dev = platform_get_drvdata(pdev); | ||
234 | |||
235 | iio_device_unregister(indio_dev); | ||
236 | iio_map_array_unregister(indio_dev); | ||
237 | |||
238 | return 0; | ||
239 | } | ||
240 | |||
241 | static struct platform_device_id axp288_adc_id_table[] = { | ||
242 | { .name = "axp288_adc" }, | ||
243 | {}, | ||
244 | }; | ||
245 | |||
246 | static struct platform_driver axp288_adc_driver = { | ||
247 | .probe = axp288_adc_probe, | ||
248 | .remove = axp288_adc_remove, | ||
249 | .id_table = axp288_adc_id_table, | ||
250 | .driver = { | ||
251 | .name = "axp288_adc", | ||
252 | }, | ||
253 | }; | ||
254 | |||
255 | MODULE_DEVICE_TABLE(platform, axp288_adc_id_table); | ||
256 | |||
257 | module_platform_driver(axp288_adc_driver); | ||
258 | |||
259 | MODULE_AUTHOR("Jacob Pan <jacob.jun.pan@linux.intel.com>"); | ||
260 | MODULE_DESCRIPTION("X-Powers AXP288 ADC Driver"); | ||
261 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/iio/adc/men_z188_adc.c b/drivers/iio/adc/men_z188_adc.c index b58d6302521f..d095efe1ba14 100644 --- a/drivers/iio/adc/men_z188_adc.c +++ b/drivers/iio/adc/men_z188_adc.c | |||
@@ -152,6 +152,7 @@ static void men_z188_remove(struct mcb_device *dev) | |||
152 | 152 | ||
153 | static const struct mcb_device_id men_z188_ids[] = { | 153 | static const struct mcb_device_id men_z188_ids[] = { |
154 | { .device = 0xbc }, | 154 | { .device = 0xbc }, |
155 | { } | ||
155 | }; | 156 | }; |
156 | MODULE_DEVICE_TABLE(mcb, men_z188_ids); | 157 | MODULE_DEVICE_TABLE(mcb, men_z188_ids); |
157 | 158 | ||
diff --git a/drivers/iio/gyro/bmg160.c b/drivers/iio/gyro/bmg160.c index 1f967e0d688e..d2fa526740ca 100644 --- a/drivers/iio/gyro/bmg160.c +++ b/drivers/iio/gyro/bmg160.c | |||
@@ -67,6 +67,9 @@ | |||
67 | #define BMG160_REG_INT_EN_0 0x15 | 67 | #define BMG160_REG_INT_EN_0 0x15 |
68 | #define BMG160_DATA_ENABLE_INT BIT(7) | 68 | #define BMG160_DATA_ENABLE_INT BIT(7) |
69 | 69 | ||
70 | #define BMG160_REG_INT_EN_1 0x16 | ||
71 | #define BMG160_INT1_BIT_OD BIT(1) | ||
72 | |||
70 | #define BMG160_REG_XOUT_L 0x02 | 73 | #define BMG160_REG_XOUT_L 0x02 |
71 | #define BMG160_AXIS_TO_REG(axis) (BMG160_REG_XOUT_L + (axis * 2)) | 74 | #define BMG160_AXIS_TO_REG(axis) (BMG160_REG_XOUT_L + (axis * 2)) |
72 | 75 | ||
@@ -82,6 +85,9 @@ | |||
82 | 85 | ||
83 | #define BMG160_REG_INT_STATUS_2 0x0B | 86 | #define BMG160_REG_INT_STATUS_2 0x0B |
84 | #define BMG160_ANY_MOTION_MASK 0x07 | 87 | #define BMG160_ANY_MOTION_MASK 0x07 |
88 | #define BMG160_ANY_MOTION_BIT_X BIT(0) | ||
89 | #define BMG160_ANY_MOTION_BIT_Y BIT(1) | ||
90 | #define BMG160_ANY_MOTION_BIT_Z BIT(2) | ||
85 | 91 | ||
86 | #define BMG160_REG_TEMP 0x08 | 92 | #define BMG160_REG_TEMP 0x08 |
87 | #define BMG160_TEMP_CENTER_VAL 23 | 93 | #define BMG160_TEMP_CENTER_VAL 23 |
@@ -222,6 +228,19 @@ static int bmg160_chip_init(struct bmg160_data *data) | |||
222 | data->slope_thres = ret; | 228 | data->slope_thres = ret; |
223 | 229 | ||
224 | /* Set default interrupt mode */ | 230 | /* Set default interrupt mode */ |
231 | ret = i2c_smbus_read_byte_data(data->client, BMG160_REG_INT_EN_1); | ||
232 | if (ret < 0) { | ||
233 | dev_err(&data->client->dev, "Error reading reg_int_en_1\n"); | ||
234 | return ret; | ||
235 | } | ||
236 | ret &= ~BMG160_INT1_BIT_OD; | ||
237 | ret = i2c_smbus_write_byte_data(data->client, | ||
238 | BMG160_REG_INT_EN_1, ret); | ||
239 | if (ret < 0) { | ||
240 | dev_err(&data->client->dev, "Error writing reg_int_en_1\n"); | ||
241 | return ret; | ||
242 | } | ||
243 | |||
225 | ret = i2c_smbus_write_byte_data(data->client, | 244 | ret = i2c_smbus_write_byte_data(data->client, |
226 | BMG160_REG_INT_RST_LATCH, | 245 | BMG160_REG_INT_RST_LATCH, |
227 | BMG160_INT_MODE_LATCH_INT | | 246 | BMG160_INT_MODE_LATCH_INT | |
@@ -250,6 +269,9 @@ static int bmg160_set_power_state(struct bmg160_data *data, bool on) | |||
250 | if (ret < 0) { | 269 | if (ret < 0) { |
251 | dev_err(&data->client->dev, | 270 | dev_err(&data->client->dev, |
252 | "Failed: bmg160_set_power_state for %d\n", on); | 271 | "Failed: bmg160_set_power_state for %d\n", on); |
272 | if (on) | ||
273 | pm_runtime_put_noidle(&data->client->dev); | ||
274 | |||
253 | return ret; | 275 | return ret; |
254 | } | 276 | } |
255 | #endif | 277 | #endif |
@@ -705,6 +727,7 @@ static int bmg160_write_event_config(struct iio_dev *indio_dev, | |||
705 | 727 | ||
706 | ret = bmg160_setup_any_motion_interrupt(data, state); | 728 | ret = bmg160_setup_any_motion_interrupt(data, state); |
707 | if (ret < 0) { | 729 | if (ret < 0) { |
730 | bmg160_set_power_state(data, false); | ||
708 | mutex_unlock(&data->mutex); | 731 | mutex_unlock(&data->mutex); |
709 | return ret; | 732 | return ret; |
710 | } | 733 | } |
@@ -743,7 +766,7 @@ static const struct attribute_group bmg160_attrs_group = { | |||
743 | 766 | ||
744 | static const struct iio_event_spec bmg160_event = { | 767 | static const struct iio_event_spec bmg160_event = { |
745 | .type = IIO_EV_TYPE_ROC, | 768 | .type = IIO_EV_TYPE_ROC, |
746 | .dir = IIO_EV_DIR_RISING | IIO_EV_DIR_FALLING, | 769 | .dir = IIO_EV_DIR_EITHER, |
747 | .mask_shared_by_type = BIT(IIO_EV_INFO_VALUE) | | 770 | .mask_shared_by_type = BIT(IIO_EV_INFO_VALUE) | |
748 | BIT(IIO_EV_INFO_ENABLE) | 771 | BIT(IIO_EV_INFO_ENABLE) |
749 | }; | 772 | }; |
@@ -871,6 +894,7 @@ static int bmg160_data_rdy_trigger_set_state(struct iio_trigger *trig, | |||
871 | else | 894 | else |
872 | ret = bmg160_setup_new_data_interrupt(data, state); | 895 | ret = bmg160_setup_new_data_interrupt(data, state); |
873 | if (ret < 0) { | 896 | if (ret < 0) { |
897 | bmg160_set_power_state(data, false); | ||
874 | mutex_unlock(&data->mutex); | 898 | mutex_unlock(&data->mutex); |
875 | return ret; | 899 | return ret; |
876 | } | 900 | } |
@@ -908,10 +932,24 @@ static irqreturn_t bmg160_event_handler(int irq, void *private) | |||
908 | else | 932 | else |
909 | dir = IIO_EV_DIR_FALLING; | 933 | dir = IIO_EV_DIR_FALLING; |
910 | 934 | ||
911 | if (ret & BMG160_ANY_MOTION_MASK) | 935 | if (ret & BMG160_ANY_MOTION_BIT_X) |
912 | iio_push_event(indio_dev, IIO_MOD_EVENT_CODE(IIO_ANGL_VEL, | 936 | iio_push_event(indio_dev, IIO_MOD_EVENT_CODE(IIO_ANGL_VEL, |
913 | 0, | 937 | 0, |
914 | IIO_MOD_X_OR_Y_OR_Z, | 938 | IIO_MOD_X, |
939 | IIO_EV_TYPE_ROC, | ||
940 | dir), | ||
941 | data->timestamp); | ||
942 | if (ret & BMG160_ANY_MOTION_BIT_Y) | ||
943 | iio_push_event(indio_dev, IIO_MOD_EVENT_CODE(IIO_ANGL_VEL, | ||
944 | 0, | ||
945 | IIO_MOD_Y, | ||
946 | IIO_EV_TYPE_ROC, | ||
947 | dir), | ||
948 | data->timestamp); | ||
949 | if (ret & BMG160_ANY_MOTION_BIT_Z) | ||
950 | iio_push_event(indio_dev, IIO_MOD_EVENT_CODE(IIO_ANGL_VEL, | ||
951 | 0, | ||
952 | IIO_MOD_Z, | ||
915 | IIO_EV_TYPE_ROC, | 953 | IIO_EV_TYPE_ROC, |
916 | dir), | 954 | dir), |
917 | data->timestamp); | 955 | data->timestamp); |
@@ -1169,8 +1207,15 @@ static int bmg160_runtime_suspend(struct device *dev) | |||
1169 | { | 1207 | { |
1170 | struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev)); | 1208 | struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev)); |
1171 | struct bmg160_data *data = iio_priv(indio_dev); | 1209 | struct bmg160_data *data = iio_priv(indio_dev); |
1210 | int ret; | ||
1211 | |||
1212 | ret = bmg160_set_mode(data, BMG160_MODE_SUSPEND); | ||
1213 | if (ret < 0) { | ||
1214 | dev_err(&data->client->dev, "set mode failed\n"); | ||
1215 | return -EAGAIN; | ||
1216 | } | ||
1172 | 1217 | ||
1173 | return bmg160_set_mode(data, BMG160_MODE_SUSPEND); | 1218 | return 0; |
1174 | } | 1219 | } |
1175 | 1220 | ||
1176 | static int bmg160_runtime_resume(struct device *dev) | 1221 | static int bmg160_runtime_resume(struct device *dev) |
diff --git a/drivers/infiniband/ulp/isert/ib_isert.c b/drivers/infiniband/ulp/isert/ib_isert.c index 3effa931fce2..10641b7816f4 100644 --- a/drivers/infiniband/ulp/isert/ib_isert.c +++ b/drivers/infiniband/ulp/isert/ib_isert.c | |||
@@ -115,9 +115,12 @@ isert_conn_setup_qp(struct isert_conn *isert_conn, struct rdma_cm_id *cma_id, | |||
115 | attr.cap.max_recv_wr = ISERT_QP_MAX_RECV_DTOS; | 115 | attr.cap.max_recv_wr = ISERT_QP_MAX_RECV_DTOS; |
116 | /* | 116 | /* |
117 | * FIXME: Use devattr.max_sge - 2 for max_send_sge as | 117 | * FIXME: Use devattr.max_sge - 2 for max_send_sge as |
118 | * work-around for RDMA_READ.. | 118 | * work-around for RDMA_READs with ConnectX-2. |
119 | * | ||
120 | * Also, still make sure to have at least two SGEs for | ||
121 | * outgoing control PDU responses. | ||
119 | */ | 122 | */ |
120 | attr.cap.max_send_sge = device->dev_attr.max_sge - 2; | 123 | attr.cap.max_send_sge = max(2, device->dev_attr.max_sge - 2); |
121 | isert_conn->max_sge = attr.cap.max_send_sge; | 124 | isert_conn->max_sge = attr.cap.max_send_sge; |
122 | 125 | ||
123 | attr.cap.max_recv_sge = 1; | 126 | attr.cap.max_recv_sge = 1; |
@@ -225,12 +228,16 @@ isert_create_device_ib_res(struct isert_device *device) | |||
225 | struct isert_cq_desc *cq_desc; | 228 | struct isert_cq_desc *cq_desc; |
226 | struct ib_device_attr *dev_attr; | 229 | struct ib_device_attr *dev_attr; |
227 | int ret = 0, i, j; | 230 | int ret = 0, i, j; |
231 | int max_rx_cqe, max_tx_cqe; | ||
228 | 232 | ||
229 | dev_attr = &device->dev_attr; | 233 | dev_attr = &device->dev_attr; |
230 | ret = isert_query_device(ib_dev, dev_attr); | 234 | ret = isert_query_device(ib_dev, dev_attr); |
231 | if (ret) | 235 | if (ret) |
232 | return ret; | 236 | return ret; |
233 | 237 | ||
238 | max_rx_cqe = min(ISER_MAX_RX_CQ_LEN, dev_attr->max_cqe); | ||
239 | max_tx_cqe = min(ISER_MAX_TX_CQ_LEN, dev_attr->max_cqe); | ||
240 | |||
234 | /* asign function handlers */ | 241 | /* asign function handlers */ |
235 | if (dev_attr->device_cap_flags & IB_DEVICE_MEM_MGT_EXTENSIONS && | 242 | if (dev_attr->device_cap_flags & IB_DEVICE_MEM_MGT_EXTENSIONS && |
236 | dev_attr->device_cap_flags & IB_DEVICE_SIGNATURE_HANDOVER) { | 243 | dev_attr->device_cap_flags & IB_DEVICE_SIGNATURE_HANDOVER) { |
@@ -272,7 +279,7 @@ isert_create_device_ib_res(struct isert_device *device) | |||
272 | isert_cq_rx_callback, | 279 | isert_cq_rx_callback, |
273 | isert_cq_event_callback, | 280 | isert_cq_event_callback, |
274 | (void *)&cq_desc[i], | 281 | (void *)&cq_desc[i], |
275 | ISER_MAX_RX_CQ_LEN, i); | 282 | max_rx_cqe, i); |
276 | if (IS_ERR(device->dev_rx_cq[i])) { | 283 | if (IS_ERR(device->dev_rx_cq[i])) { |
277 | ret = PTR_ERR(device->dev_rx_cq[i]); | 284 | ret = PTR_ERR(device->dev_rx_cq[i]); |
278 | device->dev_rx_cq[i] = NULL; | 285 | device->dev_rx_cq[i] = NULL; |
@@ -284,7 +291,7 @@ isert_create_device_ib_res(struct isert_device *device) | |||
284 | isert_cq_tx_callback, | 291 | isert_cq_tx_callback, |
285 | isert_cq_event_callback, | 292 | isert_cq_event_callback, |
286 | (void *)&cq_desc[i], | 293 | (void *)&cq_desc[i], |
287 | ISER_MAX_TX_CQ_LEN, i); | 294 | max_tx_cqe, i); |
288 | if (IS_ERR(device->dev_tx_cq[i])) { | 295 | if (IS_ERR(device->dev_tx_cq[i])) { |
289 | ret = PTR_ERR(device->dev_tx_cq[i]); | 296 | ret = PTR_ERR(device->dev_tx_cq[i]); |
290 | device->dev_tx_cq[i] = NULL; | 297 | device->dev_tx_cq[i] = NULL; |
@@ -803,14 +810,25 @@ wake_up: | |||
803 | complete(&isert_conn->conn_wait); | 810 | complete(&isert_conn->conn_wait); |
804 | } | 811 | } |
805 | 812 | ||
806 | static void | 813 | static int |
807 | isert_disconnected_handler(struct rdma_cm_id *cma_id, bool disconnect) | 814 | isert_disconnected_handler(struct rdma_cm_id *cma_id, bool disconnect) |
808 | { | 815 | { |
809 | struct isert_conn *isert_conn = (struct isert_conn *)cma_id->context; | 816 | struct isert_conn *isert_conn; |
817 | |||
818 | if (!cma_id->qp) { | ||
819 | struct isert_np *isert_np = cma_id->context; | ||
820 | |||
821 | isert_np->np_cm_id = NULL; | ||
822 | return -1; | ||
823 | } | ||
824 | |||
825 | isert_conn = (struct isert_conn *)cma_id->context; | ||
810 | 826 | ||
811 | isert_conn->disconnect = disconnect; | 827 | isert_conn->disconnect = disconnect; |
812 | INIT_WORK(&isert_conn->conn_logout_work, isert_disconnect_work); | 828 | INIT_WORK(&isert_conn->conn_logout_work, isert_disconnect_work); |
813 | schedule_work(&isert_conn->conn_logout_work); | 829 | schedule_work(&isert_conn->conn_logout_work); |
830 | |||
831 | return 0; | ||
814 | } | 832 | } |
815 | 833 | ||
816 | static int | 834 | static int |
@@ -825,6 +843,9 @@ isert_cma_handler(struct rdma_cm_id *cma_id, struct rdma_cm_event *event) | |||
825 | switch (event->event) { | 843 | switch (event->event) { |
826 | case RDMA_CM_EVENT_CONNECT_REQUEST: | 844 | case RDMA_CM_EVENT_CONNECT_REQUEST: |
827 | ret = isert_connect_request(cma_id, event); | 845 | ret = isert_connect_request(cma_id, event); |
846 | if (ret) | ||
847 | pr_err("isert_cma_handler failed RDMA_CM_EVENT: 0x%08x %d\n", | ||
848 | event->event, ret); | ||
828 | break; | 849 | break; |
829 | case RDMA_CM_EVENT_ESTABLISHED: | 850 | case RDMA_CM_EVENT_ESTABLISHED: |
830 | isert_connected_handler(cma_id); | 851 | isert_connected_handler(cma_id); |
@@ -834,7 +855,7 @@ isert_cma_handler(struct rdma_cm_id *cma_id, struct rdma_cm_event *event) | |||
834 | case RDMA_CM_EVENT_DEVICE_REMOVAL: /* FALLTHRU */ | 855 | case RDMA_CM_EVENT_DEVICE_REMOVAL: /* FALLTHRU */ |
835 | disconnect = true; | 856 | disconnect = true; |
836 | case RDMA_CM_EVENT_TIMEWAIT_EXIT: /* FALLTHRU */ | 857 | case RDMA_CM_EVENT_TIMEWAIT_EXIT: /* FALLTHRU */ |
837 | isert_disconnected_handler(cma_id, disconnect); | 858 | ret = isert_disconnected_handler(cma_id, disconnect); |
838 | break; | 859 | break; |
839 | case RDMA_CM_EVENT_CONNECT_ERROR: | 860 | case RDMA_CM_EVENT_CONNECT_ERROR: |
840 | default: | 861 | default: |
@@ -842,12 +863,6 @@ isert_cma_handler(struct rdma_cm_id *cma_id, struct rdma_cm_event *event) | |||
842 | break; | 863 | break; |
843 | } | 864 | } |
844 | 865 | ||
845 | if (ret != 0) { | ||
846 | pr_err("isert_cma_handler failed RDMA_CM_EVENT: 0x%08x %d\n", | ||
847 | event->event, ret); | ||
848 | dump_stack(); | ||
849 | } | ||
850 | |||
851 | return ret; | 866 | return ret; |
852 | } | 867 | } |
853 | 868 | ||
@@ -3190,7 +3205,8 @@ isert_free_np(struct iscsi_np *np) | |||
3190 | { | 3205 | { |
3191 | struct isert_np *isert_np = (struct isert_np *)np->np_context; | 3206 | struct isert_np *isert_np = (struct isert_np *)np->np_context; |
3192 | 3207 | ||
3193 | rdma_destroy_id(isert_np->np_cm_id); | 3208 | if (isert_np->np_cm_id) |
3209 | rdma_destroy_id(isert_np->np_cm_id); | ||
3194 | 3210 | ||
3195 | np->np_context = NULL; | 3211 | np->np_context = NULL; |
3196 | kfree(isert_np); | 3212 | kfree(isert_np); |
diff --git a/drivers/infiniband/ulp/srpt/ib_srpt.c b/drivers/infiniband/ulp/srpt/ib_srpt.c index 7206547c13ce..dc829682701a 100644 --- a/drivers/infiniband/ulp/srpt/ib_srpt.c +++ b/drivers/infiniband/ulp/srpt/ib_srpt.c | |||
@@ -2092,6 +2092,7 @@ static int srpt_create_ch_ib(struct srpt_rdma_ch *ch) | |||
2092 | if (!qp_init) | 2092 | if (!qp_init) |
2093 | goto out; | 2093 | goto out; |
2094 | 2094 | ||
2095 | retry: | ||
2095 | ch->cq = ib_create_cq(sdev->device, srpt_completion, NULL, ch, | 2096 | ch->cq = ib_create_cq(sdev->device, srpt_completion, NULL, ch, |
2096 | ch->rq_size + srp_sq_size, 0); | 2097 | ch->rq_size + srp_sq_size, 0); |
2097 | if (IS_ERR(ch->cq)) { | 2098 | if (IS_ERR(ch->cq)) { |
@@ -2115,6 +2116,13 @@ static int srpt_create_ch_ib(struct srpt_rdma_ch *ch) | |||
2115 | ch->qp = ib_create_qp(sdev->pd, qp_init); | 2116 | ch->qp = ib_create_qp(sdev->pd, qp_init); |
2116 | if (IS_ERR(ch->qp)) { | 2117 | if (IS_ERR(ch->qp)) { |
2117 | ret = PTR_ERR(ch->qp); | 2118 | ret = PTR_ERR(ch->qp); |
2119 | if (ret == -ENOMEM) { | ||
2120 | srp_sq_size /= 2; | ||
2121 | if (srp_sq_size >= MIN_SRPT_SQ_SIZE) { | ||
2122 | ib_destroy_cq(ch->cq); | ||
2123 | goto retry; | ||
2124 | } | ||
2125 | } | ||
2118 | printk(KERN_ERR "failed to create_qp ret= %d\n", ret); | 2126 | printk(KERN_ERR "failed to create_qp ret= %d\n", ret); |
2119 | goto err_destroy_cq; | 2127 | goto err_destroy_cq; |
2120 | } | 2128 | } |
diff --git a/drivers/input/evdev.c b/drivers/input/evdev.c index bc203485716d..8afa28e4570e 100644 --- a/drivers/input/evdev.c +++ b/drivers/input/evdev.c | |||
@@ -421,7 +421,7 @@ static int evdev_open(struct inode *inode, struct file *file) | |||
421 | 421 | ||
422 | err_free_client: | 422 | err_free_client: |
423 | evdev_detach_client(evdev, client); | 423 | evdev_detach_client(evdev, client); |
424 | kfree(client); | 424 | kvfree(client); |
425 | return error; | 425 | return error; |
426 | } | 426 | } |
427 | 427 | ||
diff --git a/drivers/input/joystick/xpad.c b/drivers/input/joystick/xpad.c index 2ed7905a068f..fc55f0d15b70 100644 --- a/drivers/input/joystick/xpad.c +++ b/drivers/input/joystick/xpad.c | |||
@@ -1179,9 +1179,19 @@ static int xpad_probe(struct usb_interface *intf, const struct usb_device_id *id | |||
1179 | } | 1179 | } |
1180 | 1180 | ||
1181 | ep_irq_in = &intf->cur_altsetting->endpoint[1].desc; | 1181 | ep_irq_in = &intf->cur_altsetting->endpoint[1].desc; |
1182 | usb_fill_bulk_urb(xpad->bulk_out, udev, | 1182 | if (usb_endpoint_is_bulk_out(ep_irq_in)) { |
1183 | usb_sndbulkpipe(udev, ep_irq_in->bEndpointAddress), | 1183 | usb_fill_bulk_urb(xpad->bulk_out, udev, |
1184 | xpad->bdata, XPAD_PKT_LEN, xpad_bulk_out, xpad); | 1184 | usb_sndbulkpipe(udev, |
1185 | ep_irq_in->bEndpointAddress), | ||
1186 | xpad->bdata, XPAD_PKT_LEN, | ||
1187 | xpad_bulk_out, xpad); | ||
1188 | } else { | ||
1189 | usb_fill_int_urb(xpad->bulk_out, udev, | ||
1190 | usb_sndintpipe(udev, | ||
1191 | ep_irq_in->bEndpointAddress), | ||
1192 | xpad->bdata, XPAD_PKT_LEN, | ||
1193 | xpad_bulk_out, xpad, 0); | ||
1194 | } | ||
1185 | 1195 | ||
1186 | /* | 1196 | /* |
1187 | * Submit the int URB immediately rather than waiting for open | 1197 | * Submit the int URB immediately rather than waiting for open |
diff --git a/drivers/input/keyboard/gpio_keys_polled.c b/drivers/input/keyboard/gpio_keys_polled.c index 432d36395f35..c9c1c8ca7267 100644 --- a/drivers/input/keyboard/gpio_keys_polled.c +++ b/drivers/input/keyboard/gpio_keys_polled.c | |||
@@ -23,10 +23,9 @@ | |||
23 | #include <linux/ioport.h> | 23 | #include <linux/ioport.h> |
24 | #include <linux/platform_device.h> | 24 | #include <linux/platform_device.h> |
25 | #include <linux/gpio.h> | 25 | #include <linux/gpio.h> |
26 | #include <linux/gpio/consumer.h> | ||
26 | #include <linux/gpio_keys.h> | 27 | #include <linux/gpio_keys.h> |
27 | #include <linux/of.h> | 28 | #include <linux/property.h> |
28 | #include <linux/of_platform.h> | ||
29 | #include <linux/of_gpio.h> | ||
30 | 29 | ||
31 | #define DRV_NAME "gpio-keys-polled" | 30 | #define DRV_NAME "gpio-keys-polled" |
32 | 31 | ||
@@ -51,15 +50,14 @@ static void gpio_keys_polled_check_state(struct input_dev *input, | |||
51 | int state; | 50 | int state; |
52 | 51 | ||
53 | if (bdata->can_sleep) | 52 | if (bdata->can_sleep) |
54 | state = !!gpio_get_value_cansleep(button->gpio); | 53 | state = !!gpiod_get_value_cansleep(button->gpiod); |
55 | else | 54 | else |
56 | state = !!gpio_get_value(button->gpio); | 55 | state = !!gpiod_get_value(button->gpiod); |
57 | 56 | ||
58 | if (state != bdata->last_state) { | 57 | if (state != bdata->last_state) { |
59 | unsigned int type = button->type ?: EV_KEY; | 58 | unsigned int type = button->type ?: EV_KEY; |
60 | 59 | ||
61 | input_event(input, type, button->code, | 60 | input_event(input, type, button->code, state); |
62 | !!(state ^ button->active_low)); | ||
63 | input_sync(input); | 61 | input_sync(input); |
64 | bdata->count = 0; | 62 | bdata->count = 0; |
65 | bdata->last_state = state; | 63 | bdata->last_state = state; |
@@ -102,21 +100,15 @@ static void gpio_keys_polled_close(struct input_polled_dev *dev) | |||
102 | pdata->disable(bdev->dev); | 100 | pdata->disable(bdev->dev); |
103 | } | 101 | } |
104 | 102 | ||
105 | #ifdef CONFIG_OF | ||
106 | static struct gpio_keys_platform_data *gpio_keys_polled_get_devtree_pdata(struct device *dev) | 103 | static struct gpio_keys_platform_data *gpio_keys_polled_get_devtree_pdata(struct device *dev) |
107 | { | 104 | { |
108 | struct device_node *node, *pp; | ||
109 | struct gpio_keys_platform_data *pdata; | 105 | struct gpio_keys_platform_data *pdata; |
110 | struct gpio_keys_button *button; | 106 | struct gpio_keys_button *button; |
107 | struct fwnode_handle *child; | ||
111 | int error; | 108 | int error; |
112 | int nbuttons; | 109 | int nbuttons; |
113 | int i; | ||
114 | |||
115 | node = dev->of_node; | ||
116 | if (!node) | ||
117 | return NULL; | ||
118 | 110 | ||
119 | nbuttons = of_get_child_count(node); | 111 | nbuttons = device_get_child_node_count(dev); |
120 | if (nbuttons == 0) | 112 | if (nbuttons == 0) |
121 | return NULL; | 113 | return NULL; |
122 | 114 | ||
@@ -126,52 +118,44 @@ static struct gpio_keys_platform_data *gpio_keys_polled_get_devtree_pdata(struct | |||
126 | return ERR_PTR(-ENOMEM); | 118 | return ERR_PTR(-ENOMEM); |
127 | 119 | ||
128 | pdata->buttons = (struct gpio_keys_button *)(pdata + 1); | 120 | pdata->buttons = (struct gpio_keys_button *)(pdata + 1); |
129 | pdata->nbuttons = nbuttons; | ||
130 | 121 | ||
131 | pdata->rep = !!of_get_property(node, "autorepeat", NULL); | 122 | pdata->rep = device_property_present(dev, "autorepeat"); |
132 | of_property_read_u32(node, "poll-interval", &pdata->poll_interval); | 123 | device_property_read_u32(dev, "poll-interval", &pdata->poll_interval); |
133 | 124 | ||
134 | i = 0; | 125 | device_for_each_child_node(dev, child) { |
135 | for_each_child_of_node(node, pp) { | 126 | struct gpio_desc *desc; |
136 | int gpio; | ||
137 | enum of_gpio_flags flags; | ||
138 | 127 | ||
139 | if (!of_find_property(pp, "gpios", NULL)) { | 128 | desc = devm_get_gpiod_from_child(dev, child); |
140 | pdata->nbuttons--; | 129 | if (IS_ERR(desc)) { |
141 | dev_warn(dev, "Found button without gpios\n"); | 130 | error = PTR_ERR(desc); |
142 | continue; | ||
143 | } | ||
144 | |||
145 | gpio = of_get_gpio_flags(pp, 0, &flags); | ||
146 | if (gpio < 0) { | ||
147 | error = gpio; | ||
148 | if (error != -EPROBE_DEFER) | 131 | if (error != -EPROBE_DEFER) |
149 | dev_err(dev, | 132 | dev_err(dev, |
150 | "Failed to get gpio flags, error: %d\n", | 133 | "Failed to get gpio flags, error: %d\n", |
151 | error); | 134 | error); |
135 | fwnode_handle_put(child); | ||
152 | return ERR_PTR(error); | 136 | return ERR_PTR(error); |
153 | } | 137 | } |
154 | 138 | ||
155 | button = &pdata->buttons[i++]; | 139 | button = &pdata->buttons[pdata->nbuttons++]; |
156 | 140 | button->gpiod = desc; | |
157 | button->gpio = gpio; | ||
158 | button->active_low = flags & OF_GPIO_ACTIVE_LOW; | ||
159 | 141 | ||
160 | if (of_property_read_u32(pp, "linux,code", &button->code)) { | 142 | if (fwnode_property_read_u32(child, "linux,code", &button->code)) { |
161 | dev_err(dev, "Button without keycode: 0x%x\n", | 143 | dev_err(dev, "Button without keycode: %d\n", |
162 | button->gpio); | 144 | pdata->nbuttons - 1); |
145 | fwnode_handle_put(child); | ||
163 | return ERR_PTR(-EINVAL); | 146 | return ERR_PTR(-EINVAL); |
164 | } | 147 | } |
165 | 148 | ||
166 | button->desc = of_get_property(pp, "label", NULL); | 149 | fwnode_property_read_string(child, "label", &button->desc); |
167 | 150 | ||
168 | if (of_property_read_u32(pp, "linux,input-type", &button->type)) | 151 | if (fwnode_property_read_u32(child, "linux,input-type", |
152 | &button->type)) | ||
169 | button->type = EV_KEY; | 153 | button->type = EV_KEY; |
170 | 154 | ||
171 | button->wakeup = !!of_get_property(pp, "gpio-key,wakeup", NULL); | 155 | button->wakeup = fwnode_property_present(child, "gpio-key,wakeup"); |
172 | 156 | ||
173 | if (of_property_read_u32(pp, "debounce-interval", | 157 | if (fwnode_property_read_u32(child, "debounce-interval", |
174 | &button->debounce_interval)) | 158 | &button->debounce_interval)) |
175 | button->debounce_interval = 5; | 159 | button->debounce_interval = 5; |
176 | } | 160 | } |
177 | 161 | ||
@@ -187,15 +171,6 @@ static const struct of_device_id gpio_keys_polled_of_match[] = { | |||
187 | }; | 171 | }; |
188 | MODULE_DEVICE_TABLE(of, gpio_keys_polled_of_match); | 172 | MODULE_DEVICE_TABLE(of, gpio_keys_polled_of_match); |
189 | 173 | ||
190 | #else | ||
191 | |||
192 | static inline struct gpio_keys_platform_data * | ||
193 | gpio_keys_polled_get_devtree_pdata(struct device *dev) | ||
194 | { | ||
195 | return NULL; | ||
196 | } | ||
197 | #endif | ||
198 | |||
199 | static int gpio_keys_polled_probe(struct platform_device *pdev) | 174 | static int gpio_keys_polled_probe(struct platform_device *pdev) |
200 | { | 175 | { |
201 | struct device *dev = &pdev->dev; | 176 | struct device *dev = &pdev->dev; |
@@ -259,7 +234,6 @@ static int gpio_keys_polled_probe(struct platform_device *pdev) | |||
259 | for (i = 0; i < pdata->nbuttons; i++) { | 234 | for (i = 0; i < pdata->nbuttons; i++) { |
260 | struct gpio_keys_button *button = &pdata->buttons[i]; | 235 | struct gpio_keys_button *button = &pdata->buttons[i]; |
261 | struct gpio_keys_button_data *bdata = &bdev->data[i]; | 236 | struct gpio_keys_button_data *bdata = &bdev->data[i]; |
262 | unsigned int gpio = button->gpio; | ||
263 | unsigned int type = button->type ?: EV_KEY; | 237 | unsigned int type = button->type ?: EV_KEY; |
264 | 238 | ||
265 | if (button->wakeup) { | 239 | if (button->wakeup) { |
@@ -267,15 +241,31 @@ static int gpio_keys_polled_probe(struct platform_device *pdev) | |||
267 | return -EINVAL; | 241 | return -EINVAL; |
268 | } | 242 | } |
269 | 243 | ||
270 | error = devm_gpio_request_one(&pdev->dev, gpio, GPIOF_IN, | 244 | /* |
271 | button->desc ? : DRV_NAME); | 245 | * Legacy GPIO number so request the GPIO here and |
272 | if (error) { | 246 | * convert it to descriptor. |
273 | dev_err(dev, "unable to claim gpio %u, err=%d\n", | 247 | */ |
274 | gpio, error); | 248 | if (!button->gpiod && gpio_is_valid(button->gpio)) { |
275 | return error; | 249 | unsigned flags = 0; |
250 | |||
251 | if (button->active_low) | ||
252 | flags |= GPIOF_ACTIVE_LOW; | ||
253 | |||
254 | error = devm_gpio_request_one(&pdev->dev, button->gpio, | ||
255 | flags, button->desc ? : DRV_NAME); | ||
256 | if (error) { | ||
257 | dev_err(dev, "unable to claim gpio %u, err=%d\n", | ||
258 | button->gpio, error); | ||
259 | return error; | ||
260 | } | ||
261 | |||
262 | button->gpiod = gpio_to_desc(button->gpio); | ||
276 | } | 263 | } |
277 | 264 | ||
278 | bdata->can_sleep = gpio_cansleep(gpio); | 265 | if (IS_ERR(button->gpiod)) |
266 | return PTR_ERR(button->gpiod); | ||
267 | |||
268 | bdata->can_sleep = gpiod_cansleep(button->gpiod); | ||
279 | bdata->last_state = -1; | 269 | bdata->last_state = -1; |
280 | bdata->threshold = DIV_ROUND_UP(button->debounce_interval, | 270 | bdata->threshold = DIV_ROUND_UP(button->debounce_interval, |
281 | pdata->poll_interval); | 271 | pdata->poll_interval); |
@@ -308,7 +298,7 @@ static struct platform_driver gpio_keys_polled_driver = { | |||
308 | .driver = { | 298 | .driver = { |
309 | .name = DRV_NAME, | 299 | .name = DRV_NAME, |
310 | .owner = THIS_MODULE, | 300 | .owner = THIS_MODULE, |
311 | .of_match_table = of_match_ptr(gpio_keys_polled_of_match), | 301 | .of_match_table = gpio_keys_polled_of_match, |
312 | }, | 302 | }, |
313 | }; | 303 | }; |
314 | module_platform_driver(gpio_keys_polled_driver); | 304 | module_platform_driver(gpio_keys_polled_driver); |
diff --git a/drivers/input/mouse/elantech.c b/drivers/input/mouse/elantech.c index 3fcb6b3cb0bd..f2b978026407 100644 --- a/drivers/input/mouse/elantech.c +++ b/drivers/input/mouse/elantech.c | |||
@@ -428,14 +428,6 @@ static void elantech_report_trackpoint(struct psmouse *psmouse, | |||
428 | int x, y; | 428 | int x, y; |
429 | u32 t; | 429 | u32 t; |
430 | 430 | ||
431 | if (dev_WARN_ONCE(&psmouse->ps2dev.serio->dev, | ||
432 | !tp_dev, | ||
433 | psmouse_fmt("Unexpected trackpoint message\n"))) { | ||
434 | if (etd->debug == 1) | ||
435 | elantech_packet_dump(psmouse); | ||
436 | return; | ||
437 | } | ||
438 | |||
439 | t = get_unaligned_le32(&packet[0]); | 431 | t = get_unaligned_le32(&packet[0]); |
440 | 432 | ||
441 | switch (t & ~7U) { | 433 | switch (t & ~7U) { |
@@ -793,7 +785,7 @@ static int elantech_packet_check_v4(struct psmouse *psmouse) | |||
793 | unsigned char packet_type = packet[3] & 0x03; | 785 | unsigned char packet_type = packet[3] & 0x03; |
794 | bool sanity_check; | 786 | bool sanity_check; |
795 | 787 | ||
796 | if ((packet[3] & 0x0f) == 0x06) | 788 | if (etd->tp_dev && (packet[3] & 0x0f) == 0x06) |
797 | return PACKET_TRACKPOINT; | 789 | return PACKET_TRACKPOINT; |
798 | 790 | ||
799 | /* | 791 | /* |
diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c index 2a7a9174c702..f9472920d986 100644 --- a/drivers/input/mouse/synaptics.c +++ b/drivers/input/mouse/synaptics.c | |||
@@ -143,6 +143,10 @@ static const struct min_max_quirk min_max_pnpid_table[] = { | |||
143 | (const char * const []){"LEN2001", NULL}, | 143 | (const char * const []){"LEN2001", NULL}, |
144 | 1024, 5022, 2508, 4832 | 144 | 1024, 5022, 2508, 4832 |
145 | }, | 145 | }, |
146 | { | ||
147 | (const char * const []){"LEN2006", NULL}, | ||
148 | 1264, 5675, 1171, 4688 | ||
149 | }, | ||
146 | { } | 150 | { } |
147 | }; | 151 | }; |
148 | 152 | ||
diff --git a/drivers/irqchip/irq-atmel-aic-common.c b/drivers/irqchip/irq-atmel-aic-common.c index 6ae3cdee0681..cc4f9d80122e 100644 --- a/drivers/irqchip/irq-atmel-aic-common.c +++ b/drivers/irqchip/irq-atmel-aic-common.c | |||
@@ -217,8 +217,9 @@ struct irq_domain *__init aic_common_of_init(struct device_node *node, | |||
217 | } | 217 | } |
218 | 218 | ||
219 | ret = irq_alloc_domain_generic_chips(domain, 32, 1, name, | 219 | ret = irq_alloc_domain_generic_chips(domain, 32, 1, name, |
220 | handle_level_irq, 0, 0, | 220 | handle_fasteoi_irq, |
221 | IRQCHIP_SKIP_SET_WAKE); | 221 | IRQ_NOREQUEST | IRQ_NOPROBE | |
222 | IRQ_NOAUTOEN, 0, 0); | ||
222 | if (ret) | 223 | if (ret) |
223 | goto err_domain_remove; | 224 | goto err_domain_remove; |
224 | 225 | ||
@@ -230,7 +231,6 @@ struct irq_domain *__init aic_common_of_init(struct device_node *node, | |||
230 | gc->unused = 0; | 231 | gc->unused = 0; |
231 | gc->wake_enabled = ~0; | 232 | gc->wake_enabled = ~0; |
232 | gc->chip_types[0].type = IRQ_TYPE_SENSE_MASK; | 233 | gc->chip_types[0].type = IRQ_TYPE_SENSE_MASK; |
233 | gc->chip_types[0].handler = handle_fasteoi_irq; | ||
234 | gc->chip_types[0].chip.irq_eoi = irq_gc_eoi; | 234 | gc->chip_types[0].chip.irq_eoi = irq_gc_eoi; |
235 | gc->chip_types[0].chip.irq_set_wake = irq_gc_set_wake; | 235 | gc->chip_types[0].chip.irq_set_wake = irq_gc_set_wake; |
236 | gc->chip_types[0].chip.irq_shutdown = aic_common_shutdown; | 236 | gc->chip_types[0].chip.irq_shutdown = aic_common_shutdown; |
diff --git a/drivers/irqchip/irq-bcm7120-l2.c b/drivers/irqchip/irq-bcm7120-l2.c index b9f4fb808e49..5fb38a2ac226 100644 --- a/drivers/irqchip/irq-bcm7120-l2.c +++ b/drivers/irqchip/irq-bcm7120-l2.c | |||
@@ -101,9 +101,9 @@ static int bcm7120_l2_intc_init_one(struct device_node *dn, | |||
101 | int parent_irq; | 101 | int parent_irq; |
102 | 102 | ||
103 | parent_irq = irq_of_parse_and_map(dn, irq); | 103 | parent_irq = irq_of_parse_and_map(dn, irq); |
104 | if (parent_irq < 0) { | 104 | if (!parent_irq) { |
105 | pr_err("failed to map interrupt %d\n", irq); | 105 | pr_err("failed to map interrupt %d\n", irq); |
106 | return parent_irq; | 106 | return -EINVAL; |
107 | } | 107 | } |
108 | 108 | ||
109 | data->irq_map_mask |= be32_to_cpup(map_mask + irq); | 109 | data->irq_map_mask |= be32_to_cpup(map_mask + irq); |
diff --git a/drivers/irqchip/irq-brcmstb-l2.c b/drivers/irqchip/irq-brcmstb-l2.c index c15c840987d2..14691a4cb84c 100644 --- a/drivers/irqchip/irq-brcmstb-l2.c +++ b/drivers/irqchip/irq-brcmstb-l2.c | |||
@@ -135,9 +135,9 @@ int __init brcmstb_l2_intc_of_init(struct device_node *np, | |||
135 | __raw_writel(0xffffffff, data->base + CPU_CLEAR); | 135 | __raw_writel(0xffffffff, data->base + CPU_CLEAR); |
136 | 136 | ||
137 | data->parent_irq = irq_of_parse_and_map(np, 0); | 137 | data->parent_irq = irq_of_parse_and_map(np, 0); |
138 | if (data->parent_irq < 0) { | 138 | if (!data->parent_irq) { |
139 | pr_err("failed to find parent interrupt\n"); | 139 | pr_err("failed to find parent interrupt\n"); |
140 | ret = data->parent_irq; | 140 | ret = -EINVAL; |
141 | goto out_unmap; | 141 | goto out_unmap; |
142 | } | 142 | } |
143 | 143 | ||
diff --git a/drivers/leds/leds-gpio.c b/drivers/leds/leds-gpio.c index b4518c8751c8..868e6fc17cba 100644 --- a/drivers/leds/leds-gpio.c +++ b/drivers/leds/leds-gpio.c | |||
@@ -12,25 +12,23 @@ | |||
12 | */ | 12 | */ |
13 | #include <linux/err.h> | 13 | #include <linux/err.h> |
14 | #include <linux/gpio.h> | 14 | #include <linux/gpio.h> |
15 | #include <linux/gpio/consumer.h> | ||
15 | #include <linux/kernel.h> | 16 | #include <linux/kernel.h> |
16 | #include <linux/leds.h> | 17 | #include <linux/leds.h> |
17 | #include <linux/module.h> | 18 | #include <linux/module.h> |
18 | #include <linux/of.h> | ||
19 | #include <linux/of_gpio.h> | ||
20 | #include <linux/of_platform.h> | ||
21 | #include <linux/platform_device.h> | 19 | #include <linux/platform_device.h> |
20 | #include <linux/property.h> | ||
22 | #include <linux/slab.h> | 21 | #include <linux/slab.h> |
23 | #include <linux/workqueue.h> | 22 | #include <linux/workqueue.h> |
24 | 23 | ||
25 | struct gpio_led_data { | 24 | struct gpio_led_data { |
26 | struct led_classdev cdev; | 25 | struct led_classdev cdev; |
27 | unsigned gpio; | 26 | struct gpio_desc *gpiod; |
28 | struct work_struct work; | 27 | struct work_struct work; |
29 | u8 new_level; | 28 | u8 new_level; |
30 | u8 can_sleep; | 29 | u8 can_sleep; |
31 | u8 active_low; | ||
32 | u8 blinking; | 30 | u8 blinking; |
33 | int (*platform_gpio_blink_set)(unsigned gpio, int state, | 31 | int (*platform_gpio_blink_set)(struct gpio_desc *desc, int state, |
34 | unsigned long *delay_on, unsigned long *delay_off); | 32 | unsigned long *delay_on, unsigned long *delay_off); |
35 | }; | 33 | }; |
36 | 34 | ||
@@ -40,12 +38,11 @@ static void gpio_led_work(struct work_struct *work) | |||
40 | container_of(work, struct gpio_led_data, work); | 38 | container_of(work, struct gpio_led_data, work); |
41 | 39 | ||
42 | if (led_dat->blinking) { | 40 | if (led_dat->blinking) { |
43 | led_dat->platform_gpio_blink_set(led_dat->gpio, | 41 | led_dat->platform_gpio_blink_set(led_dat->gpiod, |
44 | led_dat->new_level, | 42 | led_dat->new_level, NULL, NULL); |
45 | NULL, NULL); | ||
46 | led_dat->blinking = 0; | 43 | led_dat->blinking = 0; |
47 | } else | 44 | } else |
48 | gpio_set_value_cansleep(led_dat->gpio, led_dat->new_level); | 45 | gpiod_set_value_cansleep(led_dat->gpiod, led_dat->new_level); |
49 | } | 46 | } |
50 | 47 | ||
51 | static void gpio_led_set(struct led_classdev *led_cdev, | 48 | static void gpio_led_set(struct led_classdev *led_cdev, |
@@ -60,9 +57,6 @@ static void gpio_led_set(struct led_classdev *led_cdev, | |||
60 | else | 57 | else |
61 | level = 1; | 58 | level = 1; |
62 | 59 | ||
63 | if (led_dat->active_low) | ||
64 | level = !level; | ||
65 | |||
66 | /* Setting GPIOs with I2C/etc requires a task context, and we don't | 60 | /* Setting GPIOs with I2C/etc requires a task context, and we don't |
67 | * seem to have a reliable way to know if we're already in one; so | 61 | * seem to have a reliable way to know if we're already in one; so |
68 | * let's just assume the worst. | 62 | * let's just assume the worst. |
@@ -72,11 +66,11 @@ static void gpio_led_set(struct led_classdev *led_cdev, | |||
72 | schedule_work(&led_dat->work); | 66 | schedule_work(&led_dat->work); |
73 | } else { | 67 | } else { |
74 | if (led_dat->blinking) { | 68 | if (led_dat->blinking) { |
75 | led_dat->platform_gpio_blink_set(led_dat->gpio, level, | 69 | led_dat->platform_gpio_blink_set(led_dat->gpiod, level, |
76 | NULL, NULL); | 70 | NULL, NULL); |
77 | led_dat->blinking = 0; | 71 | led_dat->blinking = 0; |
78 | } else | 72 | } else |
79 | gpio_set_value(led_dat->gpio, level); | 73 | gpiod_set_value(led_dat->gpiod, level); |
80 | } | 74 | } |
81 | } | 75 | } |
82 | 76 | ||
@@ -87,34 +81,49 @@ static int gpio_blink_set(struct led_classdev *led_cdev, | |||
87 | container_of(led_cdev, struct gpio_led_data, cdev); | 81 | container_of(led_cdev, struct gpio_led_data, cdev); |
88 | 82 | ||
89 | led_dat->blinking = 1; | 83 | led_dat->blinking = 1; |
90 | return led_dat->platform_gpio_blink_set(led_dat->gpio, GPIO_LED_BLINK, | 84 | return led_dat->platform_gpio_blink_set(led_dat->gpiod, GPIO_LED_BLINK, |
91 | delay_on, delay_off); | 85 | delay_on, delay_off); |
92 | } | 86 | } |
93 | 87 | ||
94 | static int create_gpio_led(const struct gpio_led *template, | 88 | static int create_gpio_led(const struct gpio_led *template, |
95 | struct gpio_led_data *led_dat, struct device *parent, | 89 | struct gpio_led_data *led_dat, struct device *parent, |
96 | int (*blink_set)(unsigned, int, unsigned long *, unsigned long *)) | 90 | int (*blink_set)(struct gpio_desc *, int, unsigned long *, |
91 | unsigned long *)) | ||
97 | { | 92 | { |
98 | int ret, state; | 93 | int ret, state; |
99 | 94 | ||
100 | led_dat->gpio = -1; | 95 | led_dat->gpiod = template->gpiod; |
96 | if (!led_dat->gpiod) { | ||
97 | /* | ||
98 | * This is the legacy code path for platform code that | ||
99 | * still uses GPIO numbers. Ultimately we would like to get | ||
100 | * rid of this block completely. | ||
101 | */ | ||
102 | unsigned long flags = 0; | ||
103 | |||
104 | /* skip leds that aren't available */ | ||
105 | if (!gpio_is_valid(template->gpio)) { | ||
106 | dev_info(parent, "Skipping unavailable LED gpio %d (%s)\n", | ||
107 | template->gpio, template->name); | ||
108 | return 0; | ||
109 | } | ||
101 | 110 | ||
102 | /* skip leds that aren't available */ | 111 | if (template->active_low) |
103 | if (!gpio_is_valid(template->gpio)) { | 112 | flags |= GPIOF_ACTIVE_LOW; |
104 | dev_info(parent, "Skipping unavailable LED gpio %d (%s)\n", | ||
105 | template->gpio, template->name); | ||
106 | return 0; | ||
107 | } | ||
108 | 113 | ||
109 | ret = devm_gpio_request(parent, template->gpio, template->name); | 114 | ret = devm_gpio_request_one(parent, template->gpio, flags, |
110 | if (ret < 0) | 115 | template->name); |
111 | return ret; | 116 | if (ret < 0) |
117 | return ret; | ||
118 | |||
119 | led_dat->gpiod = gpio_to_desc(template->gpio); | ||
120 | if (IS_ERR(led_dat->gpiod)) | ||
121 | return PTR_ERR(led_dat->gpiod); | ||
122 | } | ||
112 | 123 | ||
113 | led_dat->cdev.name = template->name; | 124 | led_dat->cdev.name = template->name; |
114 | led_dat->cdev.default_trigger = template->default_trigger; | 125 | led_dat->cdev.default_trigger = template->default_trigger; |
115 | led_dat->gpio = template->gpio; | 126 | led_dat->can_sleep = gpiod_cansleep(led_dat->gpiod); |
116 | led_dat->can_sleep = gpio_cansleep(template->gpio); | ||
117 | led_dat->active_low = template->active_low; | ||
118 | led_dat->blinking = 0; | 127 | led_dat->blinking = 0; |
119 | if (blink_set) { | 128 | if (blink_set) { |
120 | led_dat->platform_gpio_blink_set = blink_set; | 129 | led_dat->platform_gpio_blink_set = blink_set; |
@@ -122,30 +131,24 @@ static int create_gpio_led(const struct gpio_led *template, | |||
122 | } | 131 | } |
123 | led_dat->cdev.brightness_set = gpio_led_set; | 132 | led_dat->cdev.brightness_set = gpio_led_set; |
124 | if (template->default_state == LEDS_GPIO_DEFSTATE_KEEP) | 133 | if (template->default_state == LEDS_GPIO_DEFSTATE_KEEP) |
125 | state = !!gpio_get_value_cansleep(led_dat->gpio) ^ led_dat->active_low; | 134 | state = !!gpiod_get_value_cansleep(led_dat->gpiod); |
126 | else | 135 | else |
127 | state = (template->default_state == LEDS_GPIO_DEFSTATE_ON); | 136 | state = (template->default_state == LEDS_GPIO_DEFSTATE_ON); |
128 | led_dat->cdev.brightness = state ? LED_FULL : LED_OFF; | 137 | led_dat->cdev.brightness = state ? LED_FULL : LED_OFF; |
129 | if (!template->retain_state_suspended) | 138 | if (!template->retain_state_suspended) |
130 | led_dat->cdev.flags |= LED_CORE_SUSPENDRESUME; | 139 | led_dat->cdev.flags |= LED_CORE_SUSPENDRESUME; |
131 | 140 | ||
132 | ret = gpio_direction_output(led_dat->gpio, led_dat->active_low ^ state); | 141 | ret = gpiod_direction_output(led_dat->gpiod, state); |
133 | if (ret < 0) | 142 | if (ret < 0) |
134 | return ret; | 143 | return ret; |
135 | 144 | ||
136 | INIT_WORK(&led_dat->work, gpio_led_work); | 145 | INIT_WORK(&led_dat->work, gpio_led_work); |
137 | 146 | ||
138 | ret = led_classdev_register(parent, &led_dat->cdev); | 147 | return led_classdev_register(parent, &led_dat->cdev); |
139 | if (ret < 0) | ||
140 | return ret; | ||
141 | |||
142 | return 0; | ||
143 | } | 148 | } |
144 | 149 | ||
145 | static void delete_gpio_led(struct gpio_led_data *led) | 150 | static void delete_gpio_led(struct gpio_led_data *led) |
146 | { | 151 | { |
147 | if (!gpio_is_valid(led->gpio)) | ||
148 | return; | ||
149 | led_classdev_unregister(&led->cdev); | 152 | led_classdev_unregister(&led->cdev); |
150 | cancel_work_sync(&led->work); | 153 | cancel_work_sync(&led->work); |
151 | } | 154 | } |
@@ -161,40 +164,47 @@ static inline int sizeof_gpio_leds_priv(int num_leds) | |||
161 | (sizeof(struct gpio_led_data) * num_leds); | 164 | (sizeof(struct gpio_led_data) * num_leds); |
162 | } | 165 | } |
163 | 166 | ||
164 | /* Code to create from OpenFirmware platform devices */ | 167 | static struct gpio_leds_priv *gpio_leds_create(struct platform_device *pdev) |
165 | #ifdef CONFIG_OF_GPIO | ||
166 | static struct gpio_leds_priv *gpio_leds_create_of(struct platform_device *pdev) | ||
167 | { | 168 | { |
168 | struct device_node *np = pdev->dev.of_node, *child; | 169 | struct device *dev = &pdev->dev; |
170 | struct fwnode_handle *child; | ||
169 | struct gpio_leds_priv *priv; | 171 | struct gpio_leds_priv *priv; |
170 | int count, ret; | 172 | int count, ret; |
173 | struct device_node *np; | ||
171 | 174 | ||
172 | /* count LEDs in this device, so we know how much to allocate */ | 175 | count = device_get_child_node_count(dev); |
173 | count = of_get_available_child_count(np); | ||
174 | if (!count) | 176 | if (!count) |
175 | return ERR_PTR(-ENODEV); | 177 | return ERR_PTR(-ENODEV); |
176 | 178 | ||
177 | for_each_available_child_of_node(np, child) | 179 | priv = devm_kzalloc(dev, sizeof_gpio_leds_priv(count), GFP_KERNEL); |
178 | if (of_get_gpio(child, 0) == -EPROBE_DEFER) | ||
179 | return ERR_PTR(-EPROBE_DEFER); | ||
180 | |||
181 | priv = devm_kzalloc(&pdev->dev, sizeof_gpio_leds_priv(count), | ||
182 | GFP_KERNEL); | ||
183 | if (!priv) | 180 | if (!priv) |
184 | return ERR_PTR(-ENOMEM); | 181 | return ERR_PTR(-ENOMEM); |
185 | 182 | ||
186 | for_each_available_child_of_node(np, child) { | 183 | device_for_each_child_node(dev, child) { |
187 | struct gpio_led led = {}; | 184 | struct gpio_led led = {}; |
188 | enum of_gpio_flags flags; | 185 | const char *state = NULL; |
189 | const char *state; | 186 | |
190 | 187 | led.gpiod = devm_get_gpiod_from_child(dev, child); | |
191 | led.gpio = of_get_gpio_flags(child, 0, &flags); | 188 | if (IS_ERR(led.gpiod)) { |
192 | led.active_low = flags & OF_GPIO_ACTIVE_LOW; | 189 | fwnode_handle_put(child); |
193 | led.name = of_get_property(child, "label", NULL) ? : child->name; | 190 | goto err; |
194 | led.default_trigger = | 191 | } |
195 | of_get_property(child, "linux,default-trigger", NULL); | 192 | |
196 | state = of_get_property(child, "default-state", NULL); | 193 | np = of_node(child); |
197 | if (state) { | 194 | |
195 | if (fwnode_property_present(child, "label")) { | ||
196 | fwnode_property_read_string(child, "label", &led.name); | ||
197 | } else { | ||
198 | if (IS_ENABLED(CONFIG_OF) && !led.name && np) | ||
199 | led.name = np->name; | ||
200 | if (!led.name) | ||
201 | return ERR_PTR(-EINVAL); | ||
202 | } | ||
203 | fwnode_property_read_string(child, "linux,default-trigger", | ||
204 | &led.default_trigger); | ||
205 | |||
206 | if (!fwnode_property_read_string(child, "linux,default_state", | ||
207 | &state)) { | ||
198 | if (!strcmp(state, "keep")) | 208 | if (!strcmp(state, "keep")) |
199 | led.default_state = LEDS_GPIO_DEFSTATE_KEEP; | 209 | led.default_state = LEDS_GPIO_DEFSTATE_KEEP; |
200 | else if (!strcmp(state, "on")) | 210 | else if (!strcmp(state, "on")) |
@@ -203,13 +213,13 @@ static struct gpio_leds_priv *gpio_leds_create_of(struct platform_device *pdev) | |||
203 | led.default_state = LEDS_GPIO_DEFSTATE_OFF; | 213 | led.default_state = LEDS_GPIO_DEFSTATE_OFF; |
204 | } | 214 | } |
205 | 215 | ||
206 | if (of_get_property(child, "retain-state-suspended", NULL)) | 216 | if (fwnode_property_present(child, "retain-state-suspended")) |
207 | led.retain_state_suspended = 1; | 217 | led.retain_state_suspended = 1; |
208 | 218 | ||
209 | ret = create_gpio_led(&led, &priv->leds[priv->num_leds++], | 219 | ret = create_gpio_led(&led, &priv->leds[priv->num_leds++], |
210 | &pdev->dev, NULL); | 220 | dev, NULL); |
211 | if (ret < 0) { | 221 | if (ret < 0) { |
212 | of_node_put(child); | 222 | fwnode_handle_put(child); |
213 | goto err; | 223 | goto err; |
214 | } | 224 | } |
215 | } | 225 | } |
@@ -228,12 +238,6 @@ static const struct of_device_id of_gpio_leds_match[] = { | |||
228 | }; | 238 | }; |
229 | 239 | ||
230 | MODULE_DEVICE_TABLE(of, of_gpio_leds_match); | 240 | MODULE_DEVICE_TABLE(of, of_gpio_leds_match); |
231 | #else /* CONFIG_OF_GPIO */ | ||
232 | static struct gpio_leds_priv *gpio_leds_create_of(struct platform_device *pdev) | ||
233 | { | ||
234 | return ERR_PTR(-ENODEV); | ||
235 | } | ||
236 | #endif /* CONFIG_OF_GPIO */ | ||
237 | 241 | ||
238 | static int gpio_led_probe(struct platform_device *pdev) | 242 | static int gpio_led_probe(struct platform_device *pdev) |
239 | { | 243 | { |
@@ -261,7 +265,7 @@ static int gpio_led_probe(struct platform_device *pdev) | |||
261 | } | 265 | } |
262 | } | 266 | } |
263 | } else { | 267 | } else { |
264 | priv = gpio_leds_create_of(pdev); | 268 | priv = gpio_leds_create(pdev); |
265 | if (IS_ERR(priv)) | 269 | if (IS_ERR(priv)) |
266 | return PTR_ERR(priv); | 270 | return PTR_ERR(priv); |
267 | } | 271 | } |
@@ -288,7 +292,7 @@ static struct platform_driver gpio_led_driver = { | |||
288 | .driver = { | 292 | .driver = { |
289 | .name = "leds-gpio", | 293 | .name = "leds-gpio", |
290 | .owner = THIS_MODULE, | 294 | .owner = THIS_MODULE, |
291 | .of_match_table = of_match_ptr(of_gpio_leds_match), | 295 | .of_match_table = of_gpio_leds_match, |
292 | }, | 296 | }, |
293 | }; | 297 | }; |
294 | 298 | ||
diff --git a/drivers/media/i2c/smiapp/smiapp-core.c b/drivers/media/i2c/smiapp/smiapp-core.c index 932ed9be9ff3..b10aaeda2bb4 100644 --- a/drivers/media/i2c/smiapp/smiapp-core.c +++ b/drivers/media/i2c/smiapp/smiapp-core.c | |||
@@ -2190,7 +2190,7 @@ static int smiapp_set_selection(struct v4l2_subdev *subdev, | |||
2190 | ret = smiapp_set_compose(subdev, fh, sel); | 2190 | ret = smiapp_set_compose(subdev, fh, sel); |
2191 | break; | 2191 | break; |
2192 | default: | 2192 | default: |
2193 | BUG(); | 2193 | ret = -EINVAL; |
2194 | } | 2194 | } |
2195 | 2195 | ||
2196 | mutex_unlock(&sensor->mutex); | 2196 | mutex_unlock(&sensor->mutex); |
diff --git a/drivers/media/pci/cx23885/cx23885-core.c b/drivers/media/pci/cx23885/cx23885-core.c index 331eddac7222..3bd386c371f7 100644 --- a/drivers/media/pci/cx23885/cx23885-core.c +++ b/drivers/media/pci/cx23885/cx23885-core.c | |||
@@ -1078,7 +1078,7 @@ static __le32 *cx23885_risc_field(__le32 *rp, struct scatterlist *sglist, | |||
1078 | for (line = 0; line < lines; line++) { | 1078 | for (line = 0; line < lines; line++) { |
1079 | while (offset && offset >= sg_dma_len(sg)) { | 1079 | while (offset && offset >= sg_dma_len(sg)) { |
1080 | offset -= sg_dma_len(sg); | 1080 | offset -= sg_dma_len(sg); |
1081 | sg++; | 1081 | sg = sg_next(sg); |
1082 | } | 1082 | } |
1083 | 1083 | ||
1084 | if (lpi && line > 0 && !(line % lpi)) | 1084 | if (lpi && line > 0 && !(line % lpi)) |
@@ -1101,14 +1101,14 @@ static __le32 *cx23885_risc_field(__le32 *rp, struct scatterlist *sglist, | |||
1101 | *(rp++) = cpu_to_le32(0); /* bits 63-32 */ | 1101 | *(rp++) = cpu_to_le32(0); /* bits 63-32 */ |
1102 | todo -= (sg_dma_len(sg)-offset); | 1102 | todo -= (sg_dma_len(sg)-offset); |
1103 | offset = 0; | 1103 | offset = 0; |
1104 | sg++; | 1104 | sg = sg_next(sg); |
1105 | while (todo > sg_dma_len(sg)) { | 1105 | while (todo > sg_dma_len(sg)) { |
1106 | *(rp++) = cpu_to_le32(RISC_WRITE| | 1106 | *(rp++) = cpu_to_le32(RISC_WRITE| |
1107 | sg_dma_len(sg)); | 1107 | sg_dma_len(sg)); |
1108 | *(rp++) = cpu_to_le32(sg_dma_address(sg)); | 1108 | *(rp++) = cpu_to_le32(sg_dma_address(sg)); |
1109 | *(rp++) = cpu_to_le32(0); /* bits 63-32 */ | 1109 | *(rp++) = cpu_to_le32(0); /* bits 63-32 */ |
1110 | todo -= sg_dma_len(sg); | 1110 | todo -= sg_dma_len(sg); |
1111 | sg++; | 1111 | sg = sg_next(sg); |
1112 | } | 1112 | } |
1113 | *(rp++) = cpu_to_le32(RISC_WRITE|RISC_EOL|todo); | 1113 | *(rp++) = cpu_to_le32(RISC_WRITE|RISC_EOL|todo); |
1114 | *(rp++) = cpu_to_le32(sg_dma_address(sg)); | 1114 | *(rp++) = cpu_to_le32(sg_dma_address(sg)); |
diff --git a/drivers/media/pci/solo6x10/solo6x10-core.c b/drivers/media/pci/solo6x10/solo6x10-core.c index 172583d736fe..8cbe6b49f4c2 100644 --- a/drivers/media/pci/solo6x10/solo6x10-core.c +++ b/drivers/media/pci/solo6x10/solo6x10-core.c | |||
@@ -105,11 +105,8 @@ static irqreturn_t solo_isr(int irq, void *data) | |||
105 | if (!status) | 105 | if (!status) |
106 | return IRQ_NONE; | 106 | return IRQ_NONE; |
107 | 107 | ||
108 | if (status & ~solo_dev->irq_mask) { | 108 | /* Acknowledge all interrupts immediately */ |
109 | solo_reg_write(solo_dev, SOLO_IRQ_STAT, | 109 | solo_reg_write(solo_dev, SOLO_IRQ_STAT, status); |
110 | status & ~solo_dev->irq_mask); | ||
111 | status &= solo_dev->irq_mask; | ||
112 | } | ||
113 | 110 | ||
114 | if (status & SOLO_IRQ_PCI_ERR) | 111 | if (status & SOLO_IRQ_PCI_ERR) |
115 | solo_p2m_error_isr(solo_dev); | 112 | solo_p2m_error_isr(solo_dev); |
@@ -132,9 +129,6 @@ static irqreturn_t solo_isr(int irq, void *data) | |||
132 | if (status & SOLO_IRQ_G723) | 129 | if (status & SOLO_IRQ_G723) |
133 | solo_g723_isr(solo_dev); | 130 | solo_g723_isr(solo_dev); |
134 | 131 | ||
135 | /* Clear all interrupts handled */ | ||
136 | solo_reg_write(solo_dev, SOLO_IRQ_STAT, status); | ||
137 | |||
138 | return IRQ_HANDLED; | 132 | return IRQ_HANDLED; |
139 | } | 133 | } |
140 | 134 | ||
diff --git a/drivers/media/rc/ir-rc6-decoder.c b/drivers/media/rc/ir-rc6-decoder.c index f1f098e22f7e..d16bc67af732 100644 --- a/drivers/media/rc/ir-rc6-decoder.c +++ b/drivers/media/rc/ir-rc6-decoder.c | |||
@@ -259,8 +259,8 @@ again: | |||
259 | case 32: | 259 | case 32: |
260 | if ((scancode & RC6_6A_LCC_MASK) == RC6_6A_MCE_CC) { | 260 | if ((scancode & RC6_6A_LCC_MASK) == RC6_6A_MCE_CC) { |
261 | protocol = RC_TYPE_RC6_MCE; | 261 | protocol = RC_TYPE_RC6_MCE; |
262 | scancode &= ~RC6_6A_MCE_TOGGLE_MASK; | ||
263 | toggle = !!(scancode & RC6_6A_MCE_TOGGLE_MASK); | 262 | toggle = !!(scancode & RC6_6A_MCE_TOGGLE_MASK); |
263 | scancode &= ~RC6_6A_MCE_TOGGLE_MASK; | ||
264 | } else { | 264 | } else { |
265 | protocol = RC_BIT_RC6_6A_32; | 265 | protocol = RC_BIT_RC6_6A_32; |
266 | toggle = 0; | 266 | toggle = 0; |
diff --git a/drivers/media/usb/s2255/s2255drv.c b/drivers/media/usb/s2255/s2255drv.c index ccc00099b261..1c0dbf428a3a 100644 --- a/drivers/media/usb/s2255/s2255drv.c +++ b/drivers/media/usb/s2255/s2255drv.c | |||
@@ -632,7 +632,7 @@ static void s2255_fillbuff(struct s2255_vc *vc, | |||
632 | break; | 632 | break; |
633 | case V4L2_PIX_FMT_JPEG: | 633 | case V4L2_PIX_FMT_JPEG: |
634 | case V4L2_PIX_FMT_MJPEG: | 634 | case V4L2_PIX_FMT_MJPEG: |
635 | buf->vb.v4l2_buf.length = jpgsize; | 635 | vb2_set_plane_payload(&buf->vb, 0, jpgsize); |
636 | memcpy(vbuf, tmpbuf, jpgsize); | 636 | memcpy(vbuf, tmpbuf, jpgsize); |
637 | break; | 637 | break; |
638 | case V4L2_PIX_FMT_YUV422P: | 638 | case V4L2_PIX_FMT_YUV422P: |
diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig index 1456ea70bbc7..9af299ba711a 100644 --- a/drivers/mfd/Kconfig +++ b/drivers/mfd/Kconfig | |||
@@ -74,7 +74,8 @@ config MFD_AXP20X | |||
74 | select REGMAP_IRQ | 74 | select REGMAP_IRQ |
75 | depends on I2C=y | 75 | depends on I2C=y |
76 | help | 76 | help |
77 | If you say Y here you get support for the X-Powers AXP202 and AXP209. | 77 | If you say Y here you get support for the X-Powers AXP202, AXP209 and |
78 | AXP288 power management IC (PMIC). | ||
78 | This driver include only the core APIs. You have to select individual | 79 | This driver include only the core APIs. You have to select individual |
79 | components like regulators or the PEK (Power Enable Key) under the | 80 | components like regulators or the PEK (Power Enable Key) under the |
80 | corresponding menus. | 81 | corresponding menus. |
diff --git a/drivers/mfd/axp20x.c b/drivers/mfd/axp20x.c index 6231adbb295d..1df18d188342 100644 --- a/drivers/mfd/axp20x.c +++ b/drivers/mfd/axp20x.c | |||
@@ -1,9 +1,9 @@ | |||
1 | /* | 1 | /* |
2 | * axp20x.c - MFD core driver for the X-Powers AXP202 and AXP209 | 2 | * axp20x.c - MFD core driver for the X-Powers' Power Management ICs |
3 | * | 3 | * |
4 | * AXP20x comprises an adaptive USB-Compatible PWM charger, 2 BUCK DC-DC | 4 | * AXP20x typically comprises an adaptive USB-Compatible PWM charger, BUCK DC-DC |
5 | * converters, 5 LDOs, multiple 12-bit ADCs of voltage, current and temperature | 5 | * converters, LDOs, multiple 12-bit ADCs of voltage, current and temperature |
6 | * as well as 4 configurable GPIOs. | 6 | * as well as configurable GPIOs. |
7 | * | 7 | * |
8 | * Author: Carlo Caione <carlo@caione.org> | 8 | * Author: Carlo Caione <carlo@caione.org> |
9 | * | 9 | * |
@@ -25,9 +25,16 @@ | |||
25 | #include <linux/mfd/core.h> | 25 | #include <linux/mfd/core.h> |
26 | #include <linux/of_device.h> | 26 | #include <linux/of_device.h> |
27 | #include <linux/of_irq.h> | 27 | #include <linux/of_irq.h> |
28 | #include <linux/acpi.h> | ||
28 | 29 | ||
29 | #define AXP20X_OFF 0x80 | 30 | #define AXP20X_OFF 0x80 |
30 | 31 | ||
32 | static const char const *axp20x_model_names[] = { | ||
33 | "AXP202", | ||
34 | "AXP209", | ||
35 | "AXP288", | ||
36 | }; | ||
37 | |||
31 | static const struct regmap_range axp20x_writeable_ranges[] = { | 38 | static const struct regmap_range axp20x_writeable_ranges[] = { |
32 | regmap_reg_range(AXP20X_DATACACHE(0), AXP20X_IRQ5_STATE), | 39 | regmap_reg_range(AXP20X_DATACACHE(0), AXP20X_IRQ5_STATE), |
33 | regmap_reg_range(AXP20X_DCDC_MODE, AXP20X_FG_RES), | 40 | regmap_reg_range(AXP20X_DCDC_MODE, AXP20X_FG_RES), |
@@ -47,6 +54,25 @@ static const struct regmap_access_table axp20x_volatile_table = { | |||
47 | .n_yes_ranges = ARRAY_SIZE(axp20x_volatile_ranges), | 54 | .n_yes_ranges = ARRAY_SIZE(axp20x_volatile_ranges), |
48 | }; | 55 | }; |
49 | 56 | ||
57 | static const struct regmap_range axp288_writeable_ranges[] = { | ||
58 | regmap_reg_range(AXP20X_DATACACHE(0), AXP20X_IRQ6_STATE), | ||
59 | regmap_reg_range(AXP20X_DCDC_MODE, AXP288_FG_TUNE5), | ||
60 | }; | ||
61 | |||
62 | static const struct regmap_range axp288_volatile_ranges[] = { | ||
63 | regmap_reg_range(AXP20X_IRQ1_EN, AXP20X_IPSOUT_V_HIGH_L), | ||
64 | }; | ||
65 | |||
66 | static const struct regmap_access_table axp288_writeable_table = { | ||
67 | .yes_ranges = axp288_writeable_ranges, | ||
68 | .n_yes_ranges = ARRAY_SIZE(axp288_writeable_ranges), | ||
69 | }; | ||
70 | |||
71 | static const struct regmap_access_table axp288_volatile_table = { | ||
72 | .yes_ranges = axp288_volatile_ranges, | ||
73 | .n_yes_ranges = ARRAY_SIZE(axp288_volatile_ranges), | ||
74 | }; | ||
75 | |||
50 | static struct resource axp20x_pek_resources[] = { | 76 | static struct resource axp20x_pek_resources[] = { |
51 | { | 77 | { |
52 | .name = "PEK_DBR", | 78 | .name = "PEK_DBR", |
@@ -61,6 +87,39 @@ static struct resource axp20x_pek_resources[] = { | |||
61 | }, | 87 | }, |
62 | }; | 88 | }; |
63 | 89 | ||
90 | static struct resource axp288_battery_resources[] = { | ||
91 | { | ||
92 | .start = AXP288_IRQ_QWBTU, | ||
93 | .end = AXP288_IRQ_QWBTU, | ||
94 | .flags = IORESOURCE_IRQ, | ||
95 | }, | ||
96 | { | ||
97 | .start = AXP288_IRQ_WBTU, | ||
98 | .end = AXP288_IRQ_WBTU, | ||
99 | .flags = IORESOURCE_IRQ, | ||
100 | }, | ||
101 | { | ||
102 | .start = AXP288_IRQ_QWBTO, | ||
103 | .end = AXP288_IRQ_QWBTO, | ||
104 | .flags = IORESOURCE_IRQ, | ||
105 | }, | ||
106 | { | ||
107 | .start = AXP288_IRQ_WBTO, | ||
108 | .end = AXP288_IRQ_WBTO, | ||
109 | .flags = IORESOURCE_IRQ, | ||
110 | }, | ||
111 | { | ||
112 | .start = AXP288_IRQ_WL2, | ||
113 | .end = AXP288_IRQ_WL2, | ||
114 | .flags = IORESOURCE_IRQ, | ||
115 | }, | ||
116 | { | ||
117 | .start = AXP288_IRQ_WL1, | ||
118 | .end = AXP288_IRQ_WL1, | ||
119 | .flags = IORESOURCE_IRQ, | ||
120 | }, | ||
121 | }; | ||
122 | |||
64 | static const struct regmap_config axp20x_regmap_config = { | 123 | static const struct regmap_config axp20x_regmap_config = { |
65 | .reg_bits = 8, | 124 | .reg_bits = 8, |
66 | .val_bits = 8, | 125 | .val_bits = 8, |
@@ -70,47 +129,96 @@ static const struct regmap_config axp20x_regmap_config = { | |||
70 | .cache_type = REGCACHE_RBTREE, | 129 | .cache_type = REGCACHE_RBTREE, |
71 | }; | 130 | }; |
72 | 131 | ||
73 | #define AXP20X_IRQ(_irq, _off, _mask) \ | 132 | static const struct regmap_config axp288_regmap_config = { |
74 | [AXP20X_IRQ_##_irq] = { .reg_offset = (_off), .mask = BIT(_mask) } | 133 | .reg_bits = 8, |
134 | .val_bits = 8, | ||
135 | .wr_table = &axp288_writeable_table, | ||
136 | .volatile_table = &axp288_volatile_table, | ||
137 | .max_register = AXP288_FG_TUNE5, | ||
138 | .cache_type = REGCACHE_RBTREE, | ||
139 | }; | ||
140 | |||
141 | #define INIT_REGMAP_IRQ(_variant, _irq, _off, _mask) \ | ||
142 | [_variant##_IRQ_##_irq] = { .reg_offset = (_off), .mask = BIT(_mask) } | ||
75 | 143 | ||
76 | static const struct regmap_irq axp20x_regmap_irqs[] = { | 144 | static const struct regmap_irq axp20x_regmap_irqs[] = { |
77 | AXP20X_IRQ(ACIN_OVER_V, 0, 7), | 145 | INIT_REGMAP_IRQ(AXP20X, ACIN_OVER_V, 0, 7), |
78 | AXP20X_IRQ(ACIN_PLUGIN, 0, 6), | 146 | INIT_REGMAP_IRQ(AXP20X, ACIN_PLUGIN, 0, 6), |
79 | AXP20X_IRQ(ACIN_REMOVAL, 0, 5), | 147 | INIT_REGMAP_IRQ(AXP20X, ACIN_REMOVAL, 0, 5), |
80 | AXP20X_IRQ(VBUS_OVER_V, 0, 4), | 148 | INIT_REGMAP_IRQ(AXP20X, VBUS_OVER_V, 0, 4), |
81 | AXP20X_IRQ(VBUS_PLUGIN, 0, 3), | 149 | INIT_REGMAP_IRQ(AXP20X, VBUS_PLUGIN, 0, 3), |
82 | AXP20X_IRQ(VBUS_REMOVAL, 0, 2), | 150 | INIT_REGMAP_IRQ(AXP20X, VBUS_REMOVAL, 0, 2), |
83 | AXP20X_IRQ(VBUS_V_LOW, 0, 1), | 151 | INIT_REGMAP_IRQ(AXP20X, VBUS_V_LOW, 0, 1), |
84 | AXP20X_IRQ(BATT_PLUGIN, 1, 7), | 152 | INIT_REGMAP_IRQ(AXP20X, BATT_PLUGIN, 1, 7), |
85 | AXP20X_IRQ(BATT_REMOVAL, 1, 6), | 153 | INIT_REGMAP_IRQ(AXP20X, BATT_REMOVAL, 1, 6), |
86 | AXP20X_IRQ(BATT_ENT_ACT_MODE, 1, 5), | 154 | INIT_REGMAP_IRQ(AXP20X, BATT_ENT_ACT_MODE, 1, 5), |
87 | AXP20X_IRQ(BATT_EXIT_ACT_MODE, 1, 4), | 155 | INIT_REGMAP_IRQ(AXP20X, BATT_EXIT_ACT_MODE, 1, 4), |
88 | AXP20X_IRQ(CHARG, 1, 3), | 156 | INIT_REGMAP_IRQ(AXP20X, CHARG, 1, 3), |
89 | AXP20X_IRQ(CHARG_DONE, 1, 2), | 157 | INIT_REGMAP_IRQ(AXP20X, CHARG_DONE, 1, 2), |
90 | AXP20X_IRQ(BATT_TEMP_HIGH, 1, 1), | 158 | INIT_REGMAP_IRQ(AXP20X, BATT_TEMP_HIGH, 1, 1), |
91 | AXP20X_IRQ(BATT_TEMP_LOW, 1, 0), | 159 | INIT_REGMAP_IRQ(AXP20X, BATT_TEMP_LOW, 1, 0), |
92 | AXP20X_IRQ(DIE_TEMP_HIGH, 2, 7), | 160 | INIT_REGMAP_IRQ(AXP20X, DIE_TEMP_HIGH, 2, 7), |
93 | AXP20X_IRQ(CHARG_I_LOW, 2, 6), | 161 | INIT_REGMAP_IRQ(AXP20X, CHARG_I_LOW, 2, 6), |
94 | AXP20X_IRQ(DCDC1_V_LONG, 2, 5), | 162 | INIT_REGMAP_IRQ(AXP20X, DCDC1_V_LONG, 2, 5), |
95 | AXP20X_IRQ(DCDC2_V_LONG, 2, 4), | 163 | INIT_REGMAP_IRQ(AXP20X, DCDC2_V_LONG, 2, 4), |
96 | AXP20X_IRQ(DCDC3_V_LONG, 2, 3), | 164 | INIT_REGMAP_IRQ(AXP20X, DCDC3_V_LONG, 2, 3), |
97 | AXP20X_IRQ(PEK_SHORT, 2, 1), | 165 | INIT_REGMAP_IRQ(AXP20X, PEK_SHORT, 2, 1), |
98 | AXP20X_IRQ(PEK_LONG, 2, 0), | 166 | INIT_REGMAP_IRQ(AXP20X, PEK_LONG, 2, 0), |
99 | AXP20X_IRQ(N_OE_PWR_ON, 3, 7), | 167 | INIT_REGMAP_IRQ(AXP20X, N_OE_PWR_ON, 3, 7), |
100 | AXP20X_IRQ(N_OE_PWR_OFF, 3, 6), | 168 | INIT_REGMAP_IRQ(AXP20X, N_OE_PWR_OFF, 3, 6), |
101 | AXP20X_IRQ(VBUS_VALID, 3, 5), | 169 | INIT_REGMAP_IRQ(AXP20X, VBUS_VALID, 3, 5), |
102 | AXP20X_IRQ(VBUS_NOT_VALID, 3, 4), | 170 | INIT_REGMAP_IRQ(AXP20X, VBUS_NOT_VALID, 3, 4), |
103 | AXP20X_IRQ(VBUS_SESS_VALID, 3, 3), | 171 | INIT_REGMAP_IRQ(AXP20X, VBUS_SESS_VALID, 3, 3), |
104 | AXP20X_IRQ(VBUS_SESS_END, 3, 2), | 172 | INIT_REGMAP_IRQ(AXP20X, VBUS_SESS_END, 3, 2), |
105 | AXP20X_IRQ(LOW_PWR_LVL1, 3, 1), | 173 | INIT_REGMAP_IRQ(AXP20X, LOW_PWR_LVL1, 3, 1), |
106 | AXP20X_IRQ(LOW_PWR_LVL2, 3, 0), | 174 | INIT_REGMAP_IRQ(AXP20X, LOW_PWR_LVL2, 3, 0), |
107 | AXP20X_IRQ(TIMER, 4, 7), | 175 | INIT_REGMAP_IRQ(AXP20X, TIMER, 4, 7), |
108 | AXP20X_IRQ(PEK_RIS_EDGE, 4, 6), | 176 | INIT_REGMAP_IRQ(AXP20X, PEK_RIS_EDGE, 4, 6), |
109 | AXP20X_IRQ(PEK_FAL_EDGE, 4, 5), | 177 | INIT_REGMAP_IRQ(AXP20X, PEK_FAL_EDGE, 4, 5), |
110 | AXP20X_IRQ(GPIO3_INPUT, 4, 3), | 178 | INIT_REGMAP_IRQ(AXP20X, GPIO3_INPUT, 4, 3), |
111 | AXP20X_IRQ(GPIO2_INPUT, 4, 2), | 179 | INIT_REGMAP_IRQ(AXP20X, GPIO2_INPUT, 4, 2), |
112 | AXP20X_IRQ(GPIO1_INPUT, 4, 1), | 180 | INIT_REGMAP_IRQ(AXP20X, GPIO1_INPUT, 4, 1), |
113 | AXP20X_IRQ(GPIO0_INPUT, 4, 0), | 181 | INIT_REGMAP_IRQ(AXP20X, GPIO0_INPUT, 4, 0), |
182 | }; | ||
183 | |||
184 | /* some IRQs are compatible with axp20x models */ | ||
185 | static const struct regmap_irq axp288_regmap_irqs[] = { | ||
186 | INIT_REGMAP_IRQ(AXP288, VBUS_FALL, 0, 2), | ||
187 | INIT_REGMAP_IRQ(AXP288, VBUS_RISE, 0, 3), | ||
188 | INIT_REGMAP_IRQ(AXP288, OV, 0, 4), | ||
189 | |||
190 | INIT_REGMAP_IRQ(AXP288, DONE, 1, 2), | ||
191 | INIT_REGMAP_IRQ(AXP288, CHARGING, 1, 3), | ||
192 | INIT_REGMAP_IRQ(AXP288, SAFE_QUIT, 1, 4), | ||
193 | INIT_REGMAP_IRQ(AXP288, SAFE_ENTER, 1, 5), | ||
194 | INIT_REGMAP_IRQ(AXP288, ABSENT, 1, 6), | ||
195 | INIT_REGMAP_IRQ(AXP288, APPEND, 1, 7), | ||
196 | |||
197 | INIT_REGMAP_IRQ(AXP288, QWBTU, 2, 0), | ||
198 | INIT_REGMAP_IRQ(AXP288, WBTU, 2, 1), | ||
199 | INIT_REGMAP_IRQ(AXP288, QWBTO, 2, 2), | ||
200 | INIT_REGMAP_IRQ(AXP288, WBTO, 2, 3), | ||
201 | INIT_REGMAP_IRQ(AXP288, QCBTU, 2, 4), | ||
202 | INIT_REGMAP_IRQ(AXP288, CBTU, 2, 5), | ||
203 | INIT_REGMAP_IRQ(AXP288, QCBTO, 2, 6), | ||
204 | INIT_REGMAP_IRQ(AXP288, CBTO, 2, 7), | ||
205 | |||
206 | INIT_REGMAP_IRQ(AXP288, WL2, 3, 0), | ||
207 | INIT_REGMAP_IRQ(AXP288, WL1, 3, 1), | ||
208 | INIT_REGMAP_IRQ(AXP288, GPADC, 3, 2), | ||
209 | INIT_REGMAP_IRQ(AXP288, OT, 3, 7), | ||
210 | |||
211 | INIT_REGMAP_IRQ(AXP288, GPIO0, 4, 0), | ||
212 | INIT_REGMAP_IRQ(AXP288, GPIO1, 4, 1), | ||
213 | INIT_REGMAP_IRQ(AXP288, POKO, 4, 2), | ||
214 | INIT_REGMAP_IRQ(AXP288, POKL, 4, 3), | ||
215 | INIT_REGMAP_IRQ(AXP288, POKS, 4, 4), | ||
216 | INIT_REGMAP_IRQ(AXP288, POKN, 4, 5), | ||
217 | INIT_REGMAP_IRQ(AXP288, POKP, 4, 6), | ||
218 | INIT_REGMAP_IRQ(AXP288, TIMER, 4, 7), | ||
219 | |||
220 | INIT_REGMAP_IRQ(AXP288, MV_CHNG, 5, 0), | ||
221 | INIT_REGMAP_IRQ(AXP288, BC_USB_CHNG, 5, 1), | ||
114 | }; | 222 | }; |
115 | 223 | ||
116 | static const struct of_device_id axp20x_of_match[] = { | 224 | static const struct of_device_id axp20x_of_match[] = { |
@@ -128,16 +236,39 @@ static const struct i2c_device_id axp20x_i2c_id[] = { | |||
128 | }; | 236 | }; |
129 | MODULE_DEVICE_TABLE(i2c, axp20x_i2c_id); | 237 | MODULE_DEVICE_TABLE(i2c, axp20x_i2c_id); |
130 | 238 | ||
239 | static struct acpi_device_id axp20x_acpi_match[] = { | ||
240 | { | ||
241 | .id = "INT33F4", | ||
242 | .driver_data = AXP288_ID, | ||
243 | }, | ||
244 | { }, | ||
245 | }; | ||
246 | MODULE_DEVICE_TABLE(acpi, axp20x_acpi_match); | ||
247 | |||
131 | static const struct regmap_irq_chip axp20x_regmap_irq_chip = { | 248 | static const struct regmap_irq_chip axp20x_regmap_irq_chip = { |
132 | .name = "axp20x_irq_chip", | 249 | .name = "axp20x_irq_chip", |
133 | .status_base = AXP20X_IRQ1_STATE, | 250 | .status_base = AXP20X_IRQ1_STATE, |
134 | .ack_base = AXP20X_IRQ1_STATE, | 251 | .ack_base = AXP20X_IRQ1_STATE, |
135 | .mask_base = AXP20X_IRQ1_EN, | 252 | .mask_base = AXP20X_IRQ1_EN, |
136 | .num_regs = 5, | 253 | .mask_invert = true, |
254 | .init_ack_masked = true, | ||
137 | .irqs = axp20x_regmap_irqs, | 255 | .irqs = axp20x_regmap_irqs, |
138 | .num_irqs = ARRAY_SIZE(axp20x_regmap_irqs), | 256 | .num_irqs = ARRAY_SIZE(axp20x_regmap_irqs), |
257 | .num_regs = 5, | ||
258 | |||
259 | }; | ||
260 | |||
261 | static const struct regmap_irq_chip axp288_regmap_irq_chip = { | ||
262 | .name = "axp288_irq_chip", | ||
263 | .status_base = AXP20X_IRQ1_STATE, | ||
264 | .ack_base = AXP20X_IRQ1_STATE, | ||
265 | .mask_base = AXP20X_IRQ1_EN, | ||
139 | .mask_invert = true, | 266 | .mask_invert = true, |
140 | .init_ack_masked = true, | 267 | .init_ack_masked = true, |
268 | .irqs = axp288_regmap_irqs, | ||
269 | .num_irqs = ARRAY_SIZE(axp288_regmap_irqs), | ||
270 | .num_regs = 6, | ||
271 | |||
141 | }; | 272 | }; |
142 | 273 | ||
143 | static struct mfd_cell axp20x_cells[] = { | 274 | static struct mfd_cell axp20x_cells[] = { |
@@ -150,36 +281,158 @@ static struct mfd_cell axp20x_cells[] = { | |||
150 | }, | 281 | }, |
151 | }; | 282 | }; |
152 | 283 | ||
284 | static struct resource axp288_adc_resources[] = { | ||
285 | { | ||
286 | .name = "GPADC", | ||
287 | .start = AXP288_IRQ_GPADC, | ||
288 | .end = AXP288_IRQ_GPADC, | ||
289 | .flags = IORESOURCE_IRQ, | ||
290 | }, | ||
291 | }; | ||
292 | |||
293 | static struct resource axp288_charger_resources[] = { | ||
294 | { | ||
295 | .start = AXP288_IRQ_OV, | ||
296 | .end = AXP288_IRQ_OV, | ||
297 | .flags = IORESOURCE_IRQ, | ||
298 | }, | ||
299 | { | ||
300 | .start = AXP288_IRQ_DONE, | ||
301 | .end = AXP288_IRQ_DONE, | ||
302 | .flags = IORESOURCE_IRQ, | ||
303 | }, | ||
304 | { | ||
305 | .start = AXP288_IRQ_CHARGING, | ||
306 | .end = AXP288_IRQ_CHARGING, | ||
307 | .flags = IORESOURCE_IRQ, | ||
308 | }, | ||
309 | { | ||
310 | .start = AXP288_IRQ_SAFE_QUIT, | ||
311 | .end = AXP288_IRQ_SAFE_QUIT, | ||
312 | .flags = IORESOURCE_IRQ, | ||
313 | }, | ||
314 | { | ||
315 | .start = AXP288_IRQ_SAFE_ENTER, | ||
316 | .end = AXP288_IRQ_SAFE_ENTER, | ||
317 | .flags = IORESOURCE_IRQ, | ||
318 | }, | ||
319 | { | ||
320 | .start = AXP288_IRQ_QCBTU, | ||
321 | .end = AXP288_IRQ_QCBTU, | ||
322 | .flags = IORESOURCE_IRQ, | ||
323 | }, | ||
324 | { | ||
325 | .start = AXP288_IRQ_CBTU, | ||
326 | .end = AXP288_IRQ_CBTU, | ||
327 | .flags = IORESOURCE_IRQ, | ||
328 | }, | ||
329 | { | ||
330 | .start = AXP288_IRQ_QCBTO, | ||
331 | .end = AXP288_IRQ_QCBTO, | ||
332 | .flags = IORESOURCE_IRQ, | ||
333 | }, | ||
334 | { | ||
335 | .start = AXP288_IRQ_CBTO, | ||
336 | .end = AXP288_IRQ_CBTO, | ||
337 | .flags = IORESOURCE_IRQ, | ||
338 | }, | ||
339 | }; | ||
340 | |||
341 | static struct mfd_cell axp288_cells[] = { | ||
342 | { | ||
343 | .name = "axp288_adc", | ||
344 | .num_resources = ARRAY_SIZE(axp288_adc_resources), | ||
345 | .resources = axp288_adc_resources, | ||
346 | }, | ||
347 | { | ||
348 | .name = "axp288_charger", | ||
349 | .num_resources = ARRAY_SIZE(axp288_charger_resources), | ||
350 | .resources = axp288_charger_resources, | ||
351 | }, | ||
352 | { | ||
353 | .name = "axp288_battery", | ||
354 | .num_resources = ARRAY_SIZE(axp288_battery_resources), | ||
355 | .resources = axp288_battery_resources, | ||
356 | }, | ||
357 | { | ||
358 | .name = "axp288_pmic_acpi", | ||
359 | }, | ||
360 | }; | ||
361 | |||
153 | static struct axp20x_dev *axp20x_pm_power_off; | 362 | static struct axp20x_dev *axp20x_pm_power_off; |
154 | static void axp20x_power_off(void) | 363 | static void axp20x_power_off(void) |
155 | { | 364 | { |
365 | if (axp20x_pm_power_off->variant == AXP288_ID) | ||
366 | return; | ||
367 | |||
156 | regmap_write(axp20x_pm_power_off->regmap, AXP20X_OFF_CTRL, | 368 | regmap_write(axp20x_pm_power_off->regmap, AXP20X_OFF_CTRL, |
157 | AXP20X_OFF); | 369 | AXP20X_OFF); |
158 | } | 370 | } |
159 | 371 | ||
372 | static int axp20x_match_device(struct axp20x_dev *axp20x, struct device *dev) | ||
373 | { | ||
374 | const struct acpi_device_id *acpi_id; | ||
375 | const struct of_device_id *of_id; | ||
376 | |||
377 | if (dev->of_node) { | ||
378 | of_id = of_match_device(axp20x_of_match, dev); | ||
379 | if (!of_id) { | ||
380 | dev_err(dev, "Unable to match OF ID\n"); | ||
381 | return -ENODEV; | ||
382 | } | ||
383 | axp20x->variant = (long) of_id->data; | ||
384 | } else { | ||
385 | acpi_id = acpi_match_device(dev->driver->acpi_match_table, dev); | ||
386 | if (!acpi_id || !acpi_id->driver_data) { | ||
387 | dev_err(dev, "Unable to match ACPI ID and data\n"); | ||
388 | return -ENODEV; | ||
389 | } | ||
390 | axp20x->variant = (long) acpi_id->driver_data; | ||
391 | } | ||
392 | |||
393 | switch (axp20x->variant) { | ||
394 | case AXP202_ID: | ||
395 | case AXP209_ID: | ||
396 | axp20x->nr_cells = ARRAY_SIZE(axp20x_cells); | ||
397 | axp20x->cells = axp20x_cells; | ||
398 | axp20x->regmap_cfg = &axp20x_regmap_config; | ||
399 | axp20x->regmap_irq_chip = &axp20x_regmap_irq_chip; | ||
400 | break; | ||
401 | case AXP288_ID: | ||
402 | axp20x->cells = axp288_cells; | ||
403 | axp20x->nr_cells = ARRAY_SIZE(axp288_cells); | ||
404 | axp20x->regmap_cfg = &axp288_regmap_config; | ||
405 | axp20x->regmap_irq_chip = &axp288_regmap_irq_chip; | ||
406 | break; | ||
407 | default: | ||
408 | dev_err(dev, "unsupported AXP20X ID %lu\n", axp20x->variant); | ||
409 | return -EINVAL; | ||
410 | } | ||
411 | dev_info(dev, "AXP20x variant %s found\n", | ||
412 | axp20x_model_names[axp20x->variant]); | ||
413 | |||
414 | return 0; | ||
415 | } | ||
416 | |||
160 | static int axp20x_i2c_probe(struct i2c_client *i2c, | 417 | static int axp20x_i2c_probe(struct i2c_client *i2c, |
161 | const struct i2c_device_id *id) | 418 | const struct i2c_device_id *id) |
162 | { | 419 | { |
163 | struct axp20x_dev *axp20x; | 420 | struct axp20x_dev *axp20x; |
164 | const struct of_device_id *of_id; | ||
165 | int ret; | 421 | int ret; |
166 | 422 | ||
167 | axp20x = devm_kzalloc(&i2c->dev, sizeof(*axp20x), GFP_KERNEL); | 423 | axp20x = devm_kzalloc(&i2c->dev, sizeof(*axp20x), GFP_KERNEL); |
168 | if (!axp20x) | 424 | if (!axp20x) |
169 | return -ENOMEM; | 425 | return -ENOMEM; |
170 | 426 | ||
171 | of_id = of_match_device(axp20x_of_match, &i2c->dev); | 427 | ret = axp20x_match_device(axp20x, &i2c->dev); |
172 | if (!of_id) { | 428 | if (ret) |
173 | dev_err(&i2c->dev, "Unable to setup AXP20X data\n"); | 429 | return ret; |
174 | return -ENODEV; | ||
175 | } | ||
176 | axp20x->variant = (long) of_id->data; | ||
177 | 430 | ||
178 | axp20x->i2c_client = i2c; | 431 | axp20x->i2c_client = i2c; |
179 | axp20x->dev = &i2c->dev; | 432 | axp20x->dev = &i2c->dev; |
180 | dev_set_drvdata(axp20x->dev, axp20x); | 433 | dev_set_drvdata(axp20x->dev, axp20x); |
181 | 434 | ||
182 | axp20x->regmap = devm_regmap_init_i2c(i2c, &axp20x_regmap_config); | 435 | axp20x->regmap = devm_regmap_init_i2c(i2c, axp20x->regmap_cfg); |
183 | if (IS_ERR(axp20x->regmap)) { | 436 | if (IS_ERR(axp20x->regmap)) { |
184 | ret = PTR_ERR(axp20x->regmap); | 437 | ret = PTR_ERR(axp20x->regmap); |
185 | dev_err(&i2c->dev, "regmap init failed: %d\n", ret); | 438 | dev_err(&i2c->dev, "regmap init failed: %d\n", ret); |
@@ -188,15 +441,15 @@ static int axp20x_i2c_probe(struct i2c_client *i2c, | |||
188 | 441 | ||
189 | ret = regmap_add_irq_chip(axp20x->regmap, i2c->irq, | 442 | ret = regmap_add_irq_chip(axp20x->regmap, i2c->irq, |
190 | IRQF_ONESHOT | IRQF_SHARED, -1, | 443 | IRQF_ONESHOT | IRQF_SHARED, -1, |
191 | &axp20x_regmap_irq_chip, | 444 | axp20x->regmap_irq_chip, |
192 | &axp20x->regmap_irqc); | 445 | &axp20x->regmap_irqc); |
193 | if (ret) { | 446 | if (ret) { |
194 | dev_err(&i2c->dev, "failed to add irq chip: %d\n", ret); | 447 | dev_err(&i2c->dev, "failed to add irq chip: %d\n", ret); |
195 | return ret; | 448 | return ret; |
196 | } | 449 | } |
197 | 450 | ||
198 | ret = mfd_add_devices(axp20x->dev, -1, axp20x_cells, | 451 | ret = mfd_add_devices(axp20x->dev, -1, axp20x->cells, |
199 | ARRAY_SIZE(axp20x_cells), NULL, 0, NULL); | 452 | axp20x->nr_cells, NULL, 0, NULL); |
200 | 453 | ||
201 | if (ret) { | 454 | if (ret) { |
202 | dev_err(&i2c->dev, "failed to add MFD devices: %d\n", ret); | 455 | dev_err(&i2c->dev, "failed to add MFD devices: %d\n", ret); |
@@ -234,6 +487,7 @@ static struct i2c_driver axp20x_i2c_driver = { | |||
234 | .name = "axp20x", | 487 | .name = "axp20x", |
235 | .owner = THIS_MODULE, | 488 | .owner = THIS_MODULE, |
236 | .of_match_table = of_match_ptr(axp20x_of_match), | 489 | .of_match_table = of_match_ptr(axp20x_of_match), |
490 | .acpi_match_table = ACPI_PTR(axp20x_acpi_match), | ||
237 | }, | 491 | }, |
238 | .probe = axp20x_i2c_probe, | 492 | .probe = axp20x_i2c_probe, |
239 | .remove = axp20x_i2c_remove, | 493 | .remove = axp20x_i2c_remove, |
diff --git a/drivers/mfd/intel_soc_pmic_crc.c b/drivers/mfd/intel_soc_pmic_crc.c index 7107cab832e6..c85e2ecb868a 100644 --- a/drivers/mfd/intel_soc_pmic_crc.c +++ b/drivers/mfd/intel_soc_pmic_crc.c | |||
@@ -106,6 +106,9 @@ static struct mfd_cell crystal_cove_dev[] = { | |||
106 | .num_resources = ARRAY_SIZE(gpio_resources), | 106 | .num_resources = ARRAY_SIZE(gpio_resources), |
107 | .resources = gpio_resources, | 107 | .resources = gpio_resources, |
108 | }, | 108 | }, |
109 | { | ||
110 | .name = "crystal_cove_pmic", | ||
111 | }, | ||
109 | }; | 112 | }; |
110 | 113 | ||
111 | static struct regmap_config crystal_cove_regmap_config = { | 114 | static struct regmap_config crystal_cove_regmap_config = { |
diff --git a/drivers/misc/eeprom/at25.c b/drivers/misc/eeprom/at25.c index 634f72929e12..0a1af93ec638 100644 --- a/drivers/misc/eeprom/at25.c +++ b/drivers/misc/eeprom/at25.c | |||
@@ -18,7 +18,7 @@ | |||
18 | 18 | ||
19 | #include <linux/spi/spi.h> | 19 | #include <linux/spi/spi.h> |
20 | #include <linux/spi/eeprom.h> | 20 | #include <linux/spi/eeprom.h> |
21 | #include <linux/of.h> | 21 | #include <linux/property.h> |
22 | 22 | ||
23 | /* | 23 | /* |
24 | * NOTE: this is an *EEPROM* driver. The vagaries of product naming | 24 | * NOTE: this is an *EEPROM* driver. The vagaries of product naming |
@@ -301,35 +301,33 @@ static ssize_t at25_mem_write(struct memory_accessor *mem, const char *buf, | |||
301 | 301 | ||
302 | /*-------------------------------------------------------------------------*/ | 302 | /*-------------------------------------------------------------------------*/ |
303 | 303 | ||
304 | static int at25_np_to_chip(struct device *dev, | 304 | static int at25_fw_to_chip(struct device *dev, struct spi_eeprom *chip) |
305 | struct device_node *np, | ||
306 | struct spi_eeprom *chip) | ||
307 | { | 305 | { |
308 | u32 val; | 306 | u32 val; |
309 | 307 | ||
310 | memset(chip, 0, sizeof(*chip)); | 308 | memset(chip, 0, sizeof(*chip)); |
311 | strncpy(chip->name, np->name, sizeof(chip->name)); | 309 | strncpy(chip->name, "at25", sizeof(chip->name)); |
312 | 310 | ||
313 | if (of_property_read_u32(np, "size", &val) == 0 || | 311 | if (device_property_read_u32(dev, "size", &val) == 0 || |
314 | of_property_read_u32(np, "at25,byte-len", &val) == 0) { | 312 | device_property_read_u32(dev, "at25,byte-len", &val) == 0) { |
315 | chip->byte_len = val; | 313 | chip->byte_len = val; |
316 | } else { | 314 | } else { |
317 | dev_err(dev, "Error: missing \"size\" property\n"); | 315 | dev_err(dev, "Error: missing \"size\" property\n"); |
318 | return -ENODEV; | 316 | return -ENODEV; |
319 | } | 317 | } |
320 | 318 | ||
321 | if (of_property_read_u32(np, "pagesize", &val) == 0 || | 319 | if (device_property_read_u32(dev, "pagesize", &val) == 0 || |
322 | of_property_read_u32(np, "at25,page-size", &val) == 0) { | 320 | device_property_read_u32(dev, "at25,page-size", &val) == 0) { |
323 | chip->page_size = (u16)val; | 321 | chip->page_size = (u16)val; |
324 | } else { | 322 | } else { |
325 | dev_err(dev, "Error: missing \"pagesize\" property\n"); | 323 | dev_err(dev, "Error: missing \"pagesize\" property\n"); |
326 | return -ENODEV; | 324 | return -ENODEV; |
327 | } | 325 | } |
328 | 326 | ||
329 | if (of_property_read_u32(np, "at25,addr-mode", &val) == 0) { | 327 | if (device_property_read_u32(dev, "at25,addr-mode", &val) == 0) { |
330 | chip->flags = (u16)val; | 328 | chip->flags = (u16)val; |
331 | } else { | 329 | } else { |
332 | if (of_property_read_u32(np, "address-width", &val)) { | 330 | if (device_property_read_u32(dev, "address-width", &val)) { |
333 | dev_err(dev, | 331 | dev_err(dev, |
334 | "Error: missing \"address-width\" property\n"); | 332 | "Error: missing \"address-width\" property\n"); |
335 | return -ENODEV; | 333 | return -ENODEV; |
@@ -350,7 +348,7 @@ static int at25_np_to_chip(struct device *dev, | |||
350 | val); | 348 | val); |
351 | return -ENODEV; | 349 | return -ENODEV; |
352 | } | 350 | } |
353 | if (of_find_property(np, "read-only", NULL)) | 351 | if (device_property_present(dev, "read-only")) |
354 | chip->flags |= EE_READONLY; | 352 | chip->flags |= EE_READONLY; |
355 | } | 353 | } |
356 | return 0; | 354 | return 0; |
@@ -360,21 +358,15 @@ static int at25_probe(struct spi_device *spi) | |||
360 | { | 358 | { |
361 | struct at25_data *at25 = NULL; | 359 | struct at25_data *at25 = NULL; |
362 | struct spi_eeprom chip; | 360 | struct spi_eeprom chip; |
363 | struct device_node *np = spi->dev.of_node; | ||
364 | int err; | 361 | int err; |
365 | int sr; | 362 | int sr; |
366 | int addrlen; | 363 | int addrlen; |
367 | 364 | ||
368 | /* Chip description */ | 365 | /* Chip description */ |
369 | if (!spi->dev.platform_data) { | 366 | if (!spi->dev.platform_data) { |
370 | if (np) { | 367 | err = at25_fw_to_chip(&spi->dev, &chip); |
371 | err = at25_np_to_chip(&spi->dev, np, &chip); | 368 | if (err) |
372 | if (err) | 369 | return err; |
373 | return err; | ||
374 | } else { | ||
375 | dev_err(&spi->dev, "Error: no chip description\n"); | ||
376 | return -ENODEV; | ||
377 | } | ||
378 | } else | 370 | } else |
379 | chip = *(struct spi_eeprom *)spi->dev.platform_data; | 371 | chip = *(struct spi_eeprom *)spi->dev.platform_data; |
380 | 372 | ||
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c index c9ac06cfe6b7..a5115fb7cf33 100644 --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c | |||
@@ -2471,7 +2471,8 @@ static void bond_loadbalance_arp_mon(struct work_struct *work) | |||
2471 | bond_slave_state_change(bond); | 2471 | bond_slave_state_change(bond); |
2472 | if (BOND_MODE(bond) == BOND_MODE_XOR) | 2472 | if (BOND_MODE(bond) == BOND_MODE_XOR) |
2473 | bond_update_slave_arr(bond, NULL); | 2473 | bond_update_slave_arr(bond, NULL); |
2474 | } else if (do_failover) { | 2474 | } |
2475 | if (do_failover) { | ||
2475 | block_netpoll_tx(); | 2476 | block_netpoll_tx(); |
2476 | bond_select_active_slave(bond); | 2477 | bond_select_active_slave(bond); |
2477 | unblock_netpoll_tx(); | 2478 | unblock_netpoll_tx(); |
diff --git a/drivers/net/bonding/bond_netlink.c b/drivers/net/bonding/bond_netlink.c index c13d83e15ace..45f09a66e6c9 100644 --- a/drivers/net/bonding/bond_netlink.c +++ b/drivers/net/bonding/bond_netlink.c | |||
@@ -225,7 +225,12 @@ static int bond_changelink(struct net_device *bond_dev, | |||
225 | 225 | ||
226 | bond_option_arp_ip_targets_clear(bond); | 226 | bond_option_arp_ip_targets_clear(bond); |
227 | nla_for_each_nested(attr, data[IFLA_BOND_ARP_IP_TARGET], rem) { | 227 | nla_for_each_nested(attr, data[IFLA_BOND_ARP_IP_TARGET], rem) { |
228 | __be32 target = nla_get_be32(attr); | 228 | __be32 target; |
229 | |||
230 | if (nla_len(attr) < sizeof(target)) | ||
231 | return -EINVAL; | ||
232 | |||
233 | target = nla_get_be32(attr); | ||
229 | 234 | ||
230 | bond_opt_initval(&newval, (__force u64)target); | 235 | bond_opt_initval(&newval, (__force u64)target); |
231 | err = __bond_opt_set(bond, BOND_OPT_ARP_TARGETS, | 236 | err = __bond_opt_set(bond, BOND_OPT_ARP_TARGETS, |
diff --git a/drivers/net/can/dev.c b/drivers/net/can/dev.c index 02492d241e4c..2cfe5012e4e5 100644 --- a/drivers/net/can/dev.c +++ b/drivers/net/can/dev.c | |||
@@ -110,7 +110,7 @@ static int can_calc_bittiming(struct net_device *dev, struct can_bittiming *bt, | |||
110 | long rate; | 110 | long rate; |
111 | u64 v64; | 111 | u64 v64; |
112 | 112 | ||
113 | /* Use CIA recommended sample points */ | 113 | /* Use CiA recommended sample points */ |
114 | if (bt->sample_point) { | 114 | if (bt->sample_point) { |
115 | sampl_pt = bt->sample_point; | 115 | sampl_pt = bt->sample_point; |
116 | } else { | 116 | } else { |
@@ -382,7 +382,7 @@ void can_free_echo_skb(struct net_device *dev, unsigned int idx) | |||
382 | BUG_ON(idx >= priv->echo_skb_max); | 382 | BUG_ON(idx >= priv->echo_skb_max); |
383 | 383 | ||
384 | if (priv->echo_skb[idx]) { | 384 | if (priv->echo_skb[idx]) { |
385 | kfree_skb(priv->echo_skb[idx]); | 385 | dev_kfree_skb_any(priv->echo_skb[idx]); |
386 | priv->echo_skb[idx] = NULL; | 386 | priv->echo_skb[idx] = NULL; |
387 | } | 387 | } |
388 | } | 388 | } |
diff --git a/drivers/net/can/m_can/Kconfig b/drivers/net/can/m_can/Kconfig index fca5482c09ac..04f20dd39007 100644 --- a/drivers/net/can/m_can/Kconfig +++ b/drivers/net/can/m_can/Kconfig | |||
@@ -1,4 +1,5 @@ | |||
1 | config CAN_M_CAN | 1 | config CAN_M_CAN |
2 | depends on HAS_IOMEM | ||
2 | tristate "Bosch M_CAN devices" | 3 | tristate "Bosch M_CAN devices" |
3 | ---help--- | 4 | ---help--- |
4 | Say Y here if you want to support for Bosch M_CAN controller. | 5 | Say Y here if you want to support for Bosch M_CAN controller. |
diff --git a/drivers/net/can/m_can/m_can.c b/drivers/net/can/m_can/m_can.c index 10d571eaed85..d7bc462aafdc 100644 --- a/drivers/net/can/m_can/m_can.c +++ b/drivers/net/can/m_can/m_can.c | |||
@@ -105,14 +105,36 @@ enum m_can_mram_cfg { | |||
105 | MRAM_CFG_NUM, | 105 | MRAM_CFG_NUM, |
106 | }; | 106 | }; |
107 | 107 | ||
108 | /* Fast Bit Timing & Prescaler Register (FBTP) */ | ||
109 | #define FBTR_FBRP_MASK 0x1f | ||
110 | #define FBTR_FBRP_SHIFT 16 | ||
111 | #define FBTR_FTSEG1_SHIFT 8 | ||
112 | #define FBTR_FTSEG1_MASK (0xf << FBTR_FTSEG1_SHIFT) | ||
113 | #define FBTR_FTSEG2_SHIFT 4 | ||
114 | #define FBTR_FTSEG2_MASK (0x7 << FBTR_FTSEG2_SHIFT) | ||
115 | #define FBTR_FSJW_SHIFT 0 | ||
116 | #define FBTR_FSJW_MASK 0x3 | ||
117 | |||
108 | /* Test Register (TEST) */ | 118 | /* Test Register (TEST) */ |
109 | #define TEST_LBCK BIT(4) | 119 | #define TEST_LBCK BIT(4) |
110 | 120 | ||
111 | /* CC Control Register(CCCR) */ | 121 | /* CC Control Register(CCCR) */ |
112 | #define CCCR_TEST BIT(7) | 122 | #define CCCR_TEST BIT(7) |
113 | #define CCCR_MON BIT(5) | 123 | #define CCCR_CMR_MASK 0x3 |
114 | #define CCCR_CCE BIT(1) | 124 | #define CCCR_CMR_SHIFT 10 |
115 | #define CCCR_INIT BIT(0) | 125 | #define CCCR_CMR_CANFD 0x1 |
126 | #define CCCR_CMR_CANFD_BRS 0x2 | ||
127 | #define CCCR_CMR_CAN 0x3 | ||
128 | #define CCCR_CME_MASK 0x3 | ||
129 | #define CCCR_CME_SHIFT 8 | ||
130 | #define CCCR_CME_CAN 0 | ||
131 | #define CCCR_CME_CANFD 0x1 | ||
132 | #define CCCR_CME_CANFD_BRS 0x2 | ||
133 | #define CCCR_TEST BIT(7) | ||
134 | #define CCCR_MON BIT(5) | ||
135 | #define CCCR_CCE BIT(1) | ||
136 | #define CCCR_INIT BIT(0) | ||
137 | #define CCCR_CANFD 0x10 | ||
116 | 138 | ||
117 | /* Bit Timing & Prescaler Register (BTP) */ | 139 | /* Bit Timing & Prescaler Register (BTP) */ |
118 | #define BTR_BRP_MASK 0x3ff | 140 | #define BTR_BRP_MASK 0x3ff |
@@ -204,6 +226,7 @@ enum m_can_mram_cfg { | |||
204 | 226 | ||
205 | /* Rx Buffer / FIFO Element Size Configuration (RXESC) */ | 227 | /* Rx Buffer / FIFO Element Size Configuration (RXESC) */ |
206 | #define M_CAN_RXESC_8BYTES 0x0 | 228 | #define M_CAN_RXESC_8BYTES 0x0 |
229 | #define M_CAN_RXESC_64BYTES 0x777 | ||
207 | 230 | ||
208 | /* Tx Buffer Configuration(TXBC) */ | 231 | /* Tx Buffer Configuration(TXBC) */ |
209 | #define TXBC_NDTB_OFF 16 | 232 | #define TXBC_NDTB_OFF 16 |
@@ -211,6 +234,7 @@ enum m_can_mram_cfg { | |||
211 | 234 | ||
212 | /* Tx Buffer Element Size Configuration(TXESC) */ | 235 | /* Tx Buffer Element Size Configuration(TXESC) */ |
213 | #define TXESC_TBDS_8BYTES 0x0 | 236 | #define TXESC_TBDS_8BYTES 0x0 |
237 | #define TXESC_TBDS_64BYTES 0x7 | ||
214 | 238 | ||
215 | /* Tx Event FIFO Con.guration (TXEFC) */ | 239 | /* Tx Event FIFO Con.guration (TXEFC) */ |
216 | #define TXEFC_EFS_OFF 16 | 240 | #define TXEFC_EFS_OFF 16 |
@@ -219,11 +243,11 @@ enum m_can_mram_cfg { | |||
219 | /* Message RAM Configuration (in bytes) */ | 243 | /* Message RAM Configuration (in bytes) */ |
220 | #define SIDF_ELEMENT_SIZE 4 | 244 | #define SIDF_ELEMENT_SIZE 4 |
221 | #define XIDF_ELEMENT_SIZE 8 | 245 | #define XIDF_ELEMENT_SIZE 8 |
222 | #define RXF0_ELEMENT_SIZE 16 | 246 | #define RXF0_ELEMENT_SIZE 72 |
223 | #define RXF1_ELEMENT_SIZE 16 | 247 | #define RXF1_ELEMENT_SIZE 72 |
224 | #define RXB_ELEMENT_SIZE 16 | 248 | #define RXB_ELEMENT_SIZE 16 |
225 | #define TXE_ELEMENT_SIZE 8 | 249 | #define TXE_ELEMENT_SIZE 8 |
226 | #define TXB_ELEMENT_SIZE 16 | 250 | #define TXB_ELEMENT_SIZE 72 |
227 | 251 | ||
228 | /* Message RAM Elements */ | 252 | /* Message RAM Elements */ |
229 | #define M_CAN_FIFO_ID 0x0 | 253 | #define M_CAN_FIFO_ID 0x0 |
@@ -231,11 +255,17 @@ enum m_can_mram_cfg { | |||
231 | #define M_CAN_FIFO_DATA(n) (0x8 + ((n) << 2)) | 255 | #define M_CAN_FIFO_DATA(n) (0x8 + ((n) << 2)) |
232 | 256 | ||
233 | /* Rx Buffer Element */ | 257 | /* Rx Buffer Element */ |
258 | /* R0 */ | ||
234 | #define RX_BUF_ESI BIT(31) | 259 | #define RX_BUF_ESI BIT(31) |
235 | #define RX_BUF_XTD BIT(30) | 260 | #define RX_BUF_XTD BIT(30) |
236 | #define RX_BUF_RTR BIT(29) | 261 | #define RX_BUF_RTR BIT(29) |
262 | /* R1 */ | ||
263 | #define RX_BUF_ANMF BIT(31) | ||
264 | #define RX_BUF_EDL BIT(21) | ||
265 | #define RX_BUF_BRS BIT(20) | ||
237 | 266 | ||
238 | /* Tx Buffer Element */ | 267 | /* Tx Buffer Element */ |
268 | /* R0 */ | ||
239 | #define TX_BUF_XTD BIT(30) | 269 | #define TX_BUF_XTD BIT(30) |
240 | #define TX_BUF_RTR BIT(29) | 270 | #define TX_BUF_RTR BIT(29) |
241 | 271 | ||
@@ -296,6 +326,7 @@ static inline void m_can_config_endisable(const struct m_can_priv *priv, | |||
296 | if (enable) { | 326 | if (enable) { |
297 | /* enable m_can configuration */ | 327 | /* enable m_can configuration */ |
298 | m_can_write(priv, M_CAN_CCCR, cccr | CCCR_INIT); | 328 | m_can_write(priv, M_CAN_CCCR, cccr | CCCR_INIT); |
329 | udelay(5); | ||
299 | /* CCCR.CCE can only be set/reset while CCCR.INIT = '1' */ | 330 | /* CCCR.CCE can only be set/reset while CCCR.INIT = '1' */ |
300 | m_can_write(priv, M_CAN_CCCR, cccr | CCCR_INIT | CCCR_CCE); | 331 | m_can_write(priv, M_CAN_CCCR, cccr | CCCR_INIT | CCCR_CCE); |
301 | } else { | 332 | } else { |
@@ -326,41 +357,67 @@ static inline void m_can_disable_all_interrupts(const struct m_can_priv *priv) | |||
326 | m_can_write(priv, M_CAN_ILE, 0x0); | 357 | m_can_write(priv, M_CAN_ILE, 0x0); |
327 | } | 358 | } |
328 | 359 | ||
329 | static void m_can_read_fifo(const struct net_device *dev, struct can_frame *cf, | 360 | static void m_can_read_fifo(struct net_device *dev, u32 rxfs) |
330 | u32 rxfs) | ||
331 | { | 361 | { |
362 | struct net_device_stats *stats = &dev->stats; | ||
332 | struct m_can_priv *priv = netdev_priv(dev); | 363 | struct m_can_priv *priv = netdev_priv(dev); |
333 | u32 id, fgi; | 364 | struct canfd_frame *cf; |
365 | struct sk_buff *skb; | ||
366 | u32 id, fgi, dlc; | ||
367 | int i; | ||
334 | 368 | ||
335 | /* calculate the fifo get index for where to read data */ | 369 | /* calculate the fifo get index for where to read data */ |
336 | fgi = (rxfs & RXFS_FGI_MASK) >> RXFS_FGI_OFF; | 370 | fgi = (rxfs & RXFS_FGI_MASK) >> RXFS_FGI_OFF; |
371 | dlc = m_can_fifo_read(priv, fgi, M_CAN_FIFO_DLC); | ||
372 | if (dlc & RX_BUF_EDL) | ||
373 | skb = alloc_canfd_skb(dev, &cf); | ||
374 | else | ||
375 | skb = alloc_can_skb(dev, (struct can_frame **)&cf); | ||
376 | if (!skb) { | ||
377 | stats->rx_dropped++; | ||
378 | return; | ||
379 | } | ||
380 | |||
381 | if (dlc & RX_BUF_EDL) | ||
382 | cf->len = can_dlc2len((dlc >> 16) & 0x0F); | ||
383 | else | ||
384 | cf->len = get_can_dlc((dlc >> 16) & 0x0F); | ||
385 | |||
337 | id = m_can_fifo_read(priv, fgi, M_CAN_FIFO_ID); | 386 | id = m_can_fifo_read(priv, fgi, M_CAN_FIFO_ID); |
338 | if (id & RX_BUF_XTD) | 387 | if (id & RX_BUF_XTD) |
339 | cf->can_id = (id & CAN_EFF_MASK) | CAN_EFF_FLAG; | 388 | cf->can_id = (id & CAN_EFF_MASK) | CAN_EFF_FLAG; |
340 | else | 389 | else |
341 | cf->can_id = (id >> 18) & CAN_SFF_MASK; | 390 | cf->can_id = (id >> 18) & CAN_SFF_MASK; |
342 | 391 | ||
343 | if (id & RX_BUF_RTR) { | 392 | if (id & RX_BUF_ESI) { |
393 | cf->flags |= CANFD_ESI; | ||
394 | netdev_dbg(dev, "ESI Error\n"); | ||
395 | } | ||
396 | |||
397 | if (!(dlc & RX_BUF_EDL) && (id & RX_BUF_RTR)) { | ||
344 | cf->can_id |= CAN_RTR_FLAG; | 398 | cf->can_id |= CAN_RTR_FLAG; |
345 | } else { | 399 | } else { |
346 | id = m_can_fifo_read(priv, fgi, M_CAN_FIFO_DLC); | 400 | if (dlc & RX_BUF_BRS) |
347 | cf->can_dlc = get_can_dlc((id >> 16) & 0x0F); | 401 | cf->flags |= CANFD_BRS; |
348 | *(u32 *)(cf->data + 0) = m_can_fifo_read(priv, fgi, | 402 | |
349 | M_CAN_FIFO_DATA(0)); | 403 | for (i = 0; i < cf->len; i += 4) |
350 | *(u32 *)(cf->data + 4) = m_can_fifo_read(priv, fgi, | 404 | *(u32 *)(cf->data + i) = |
351 | M_CAN_FIFO_DATA(1)); | 405 | m_can_fifo_read(priv, fgi, |
406 | M_CAN_FIFO_DATA(i / 4)); | ||
352 | } | 407 | } |
353 | 408 | ||
354 | /* acknowledge rx fifo 0 */ | 409 | /* acknowledge rx fifo 0 */ |
355 | m_can_write(priv, M_CAN_RXF0A, fgi); | 410 | m_can_write(priv, M_CAN_RXF0A, fgi); |
411 | |||
412 | stats->rx_packets++; | ||
413 | stats->rx_bytes += cf->len; | ||
414 | |||
415 | netif_receive_skb(skb); | ||
356 | } | 416 | } |
357 | 417 | ||
358 | static int m_can_do_rx_poll(struct net_device *dev, int quota) | 418 | static int m_can_do_rx_poll(struct net_device *dev, int quota) |
359 | { | 419 | { |
360 | struct m_can_priv *priv = netdev_priv(dev); | 420 | struct m_can_priv *priv = netdev_priv(dev); |
361 | struct net_device_stats *stats = &dev->stats; | ||
362 | struct sk_buff *skb; | ||
363 | struct can_frame *frame; | ||
364 | u32 pkts = 0; | 421 | u32 pkts = 0; |
365 | u32 rxfs; | 422 | u32 rxfs; |
366 | 423 | ||
@@ -374,18 +431,7 @@ static int m_can_do_rx_poll(struct net_device *dev, int quota) | |||
374 | if (rxfs & RXFS_RFL) | 431 | if (rxfs & RXFS_RFL) |
375 | netdev_warn(dev, "Rx FIFO 0 Message Lost\n"); | 432 | netdev_warn(dev, "Rx FIFO 0 Message Lost\n"); |
376 | 433 | ||
377 | skb = alloc_can_skb(dev, &frame); | 434 | m_can_read_fifo(dev, rxfs); |
378 | if (!skb) { | ||
379 | stats->rx_dropped++; | ||
380 | return pkts; | ||
381 | } | ||
382 | |||
383 | m_can_read_fifo(dev, frame, rxfs); | ||
384 | |||
385 | stats->rx_packets++; | ||
386 | stats->rx_bytes += frame->can_dlc; | ||
387 | |||
388 | netif_receive_skb(skb); | ||
389 | 435 | ||
390 | quota--; | 436 | quota--; |
391 | pkts++; | 437 | pkts++; |
@@ -481,11 +527,23 @@ static int m_can_handle_lec_err(struct net_device *dev, | |||
481 | return 1; | 527 | return 1; |
482 | } | 528 | } |
483 | 529 | ||
530 | static int __m_can_get_berr_counter(const struct net_device *dev, | ||
531 | struct can_berr_counter *bec) | ||
532 | { | ||
533 | struct m_can_priv *priv = netdev_priv(dev); | ||
534 | unsigned int ecr; | ||
535 | |||
536 | ecr = m_can_read(priv, M_CAN_ECR); | ||
537 | bec->rxerr = (ecr & ECR_REC_MASK) >> ECR_REC_SHIFT; | ||
538 | bec->txerr = ecr & ECR_TEC_MASK; | ||
539 | |||
540 | return 0; | ||
541 | } | ||
542 | |||
484 | static int m_can_get_berr_counter(const struct net_device *dev, | 543 | static int m_can_get_berr_counter(const struct net_device *dev, |
485 | struct can_berr_counter *bec) | 544 | struct can_berr_counter *bec) |
486 | { | 545 | { |
487 | struct m_can_priv *priv = netdev_priv(dev); | 546 | struct m_can_priv *priv = netdev_priv(dev); |
488 | unsigned int ecr; | ||
489 | int err; | 547 | int err; |
490 | 548 | ||
491 | err = clk_prepare_enable(priv->hclk); | 549 | err = clk_prepare_enable(priv->hclk); |
@@ -498,9 +556,7 @@ static int m_can_get_berr_counter(const struct net_device *dev, | |||
498 | return err; | 556 | return err; |
499 | } | 557 | } |
500 | 558 | ||
501 | ecr = m_can_read(priv, M_CAN_ECR); | 559 | __m_can_get_berr_counter(dev, bec); |
502 | bec->rxerr = (ecr & ECR_REC_MASK) >> ECR_REC_SHIFT; | ||
503 | bec->txerr = ecr & ECR_TEC_MASK; | ||
504 | 560 | ||
505 | clk_disable_unprepare(priv->cclk); | 561 | clk_disable_unprepare(priv->cclk); |
506 | clk_disable_unprepare(priv->hclk); | 562 | clk_disable_unprepare(priv->hclk); |
@@ -544,7 +600,7 @@ static int m_can_handle_state_change(struct net_device *dev, | |||
544 | if (unlikely(!skb)) | 600 | if (unlikely(!skb)) |
545 | return 0; | 601 | return 0; |
546 | 602 | ||
547 | m_can_get_berr_counter(dev, &bec); | 603 | __m_can_get_berr_counter(dev, &bec); |
548 | 604 | ||
549 | switch (new_state) { | 605 | switch (new_state) { |
550 | case CAN_STATE_ERROR_ACTIVE: | 606 | case CAN_STATE_ERROR_ACTIVE: |
@@ -596,14 +652,14 @@ static int m_can_handle_state_errors(struct net_device *dev, u32 psr) | |||
596 | 652 | ||
597 | if ((psr & PSR_EP) && | 653 | if ((psr & PSR_EP) && |
598 | (priv->can.state != CAN_STATE_ERROR_PASSIVE)) { | 654 | (priv->can.state != CAN_STATE_ERROR_PASSIVE)) { |
599 | netdev_dbg(dev, "entered error warning state\n"); | 655 | netdev_dbg(dev, "entered error passive state\n"); |
600 | work_done += m_can_handle_state_change(dev, | 656 | work_done += m_can_handle_state_change(dev, |
601 | CAN_STATE_ERROR_PASSIVE); | 657 | CAN_STATE_ERROR_PASSIVE); |
602 | } | 658 | } |
603 | 659 | ||
604 | if ((psr & PSR_BO) && | 660 | if ((psr & PSR_BO) && |
605 | (priv->can.state != CAN_STATE_BUS_OFF)) { | 661 | (priv->can.state != CAN_STATE_BUS_OFF)) { |
606 | netdev_dbg(dev, "entered error warning state\n"); | 662 | netdev_dbg(dev, "entered error bus off state\n"); |
607 | work_done += m_can_handle_state_change(dev, | 663 | work_done += m_can_handle_state_change(dev, |
608 | CAN_STATE_BUS_OFF); | 664 | CAN_STATE_BUS_OFF); |
609 | } | 665 | } |
@@ -615,7 +671,7 @@ static void m_can_handle_other_err(struct net_device *dev, u32 irqstatus) | |||
615 | { | 671 | { |
616 | if (irqstatus & IR_WDI) | 672 | if (irqstatus & IR_WDI) |
617 | netdev_err(dev, "Message RAM Watchdog event due to missing READY\n"); | 673 | netdev_err(dev, "Message RAM Watchdog event due to missing READY\n"); |
618 | if (irqstatus & IR_BEU) | 674 | if (irqstatus & IR_ELO) |
619 | netdev_err(dev, "Error Logging Overflow\n"); | 675 | netdev_err(dev, "Error Logging Overflow\n"); |
620 | if (irqstatus & IR_BEU) | 676 | if (irqstatus & IR_BEU) |
621 | netdev_err(dev, "Bit Error Uncorrected\n"); | 677 | netdev_err(dev, "Bit Error Uncorrected\n"); |
@@ -733,10 +789,23 @@ static const struct can_bittiming_const m_can_bittiming_const = { | |||
733 | .brp_inc = 1, | 789 | .brp_inc = 1, |
734 | }; | 790 | }; |
735 | 791 | ||
792 | static const struct can_bittiming_const m_can_data_bittiming_const = { | ||
793 | .name = KBUILD_MODNAME, | ||
794 | .tseg1_min = 2, /* Time segment 1 = prop_seg + phase_seg1 */ | ||
795 | .tseg1_max = 16, | ||
796 | .tseg2_min = 1, /* Time segment 2 = phase_seg2 */ | ||
797 | .tseg2_max = 8, | ||
798 | .sjw_max = 4, | ||
799 | .brp_min = 1, | ||
800 | .brp_max = 32, | ||
801 | .brp_inc = 1, | ||
802 | }; | ||
803 | |||
736 | static int m_can_set_bittiming(struct net_device *dev) | 804 | static int m_can_set_bittiming(struct net_device *dev) |
737 | { | 805 | { |
738 | struct m_can_priv *priv = netdev_priv(dev); | 806 | struct m_can_priv *priv = netdev_priv(dev); |
739 | const struct can_bittiming *bt = &priv->can.bittiming; | 807 | const struct can_bittiming *bt = &priv->can.bittiming; |
808 | const struct can_bittiming *dbt = &priv->can.data_bittiming; | ||
740 | u16 brp, sjw, tseg1, tseg2; | 809 | u16 brp, sjw, tseg1, tseg2; |
741 | u32 reg_btp; | 810 | u32 reg_btp; |
742 | 811 | ||
@@ -747,7 +816,17 @@ static int m_can_set_bittiming(struct net_device *dev) | |||
747 | reg_btp = (brp << BTR_BRP_SHIFT) | (sjw << BTR_SJW_SHIFT) | | 816 | reg_btp = (brp << BTR_BRP_SHIFT) | (sjw << BTR_SJW_SHIFT) | |
748 | (tseg1 << BTR_TSEG1_SHIFT) | (tseg2 << BTR_TSEG2_SHIFT); | 817 | (tseg1 << BTR_TSEG1_SHIFT) | (tseg2 << BTR_TSEG2_SHIFT); |
749 | m_can_write(priv, M_CAN_BTP, reg_btp); | 818 | m_can_write(priv, M_CAN_BTP, reg_btp); |
750 | netdev_dbg(dev, "setting BTP 0x%x\n", reg_btp); | 819 | |
820 | if (priv->can.ctrlmode & CAN_CTRLMODE_FD) { | ||
821 | brp = dbt->brp - 1; | ||
822 | sjw = dbt->sjw - 1; | ||
823 | tseg1 = dbt->prop_seg + dbt->phase_seg1 - 1; | ||
824 | tseg2 = dbt->phase_seg2 - 1; | ||
825 | reg_btp = (brp << FBTR_FBRP_SHIFT) | (sjw << FBTR_FSJW_SHIFT) | | ||
826 | (tseg1 << FBTR_FTSEG1_SHIFT) | | ||
827 | (tseg2 << FBTR_FTSEG2_SHIFT); | ||
828 | m_can_write(priv, M_CAN_FBTP, reg_btp); | ||
829 | } | ||
751 | 830 | ||
752 | return 0; | 831 | return 0; |
753 | } | 832 | } |
@@ -767,8 +846,8 @@ static void m_can_chip_config(struct net_device *dev) | |||
767 | 846 | ||
768 | m_can_config_endisable(priv, true); | 847 | m_can_config_endisable(priv, true); |
769 | 848 | ||
770 | /* RX Buffer/FIFO Element Size 8 bytes data field */ | 849 | /* RX Buffer/FIFO Element Size 64 bytes data field */ |
771 | m_can_write(priv, M_CAN_RXESC, M_CAN_RXESC_8BYTES); | 850 | m_can_write(priv, M_CAN_RXESC, M_CAN_RXESC_64BYTES); |
772 | 851 | ||
773 | /* Accept Non-matching Frames Into FIFO 0 */ | 852 | /* Accept Non-matching Frames Into FIFO 0 */ |
774 | m_can_write(priv, M_CAN_GFC, 0x0); | 853 | m_can_write(priv, M_CAN_GFC, 0x0); |
@@ -777,8 +856,8 @@ static void m_can_chip_config(struct net_device *dev) | |||
777 | m_can_write(priv, M_CAN_TXBC, (1 << TXBC_NDTB_OFF) | | 856 | m_can_write(priv, M_CAN_TXBC, (1 << TXBC_NDTB_OFF) | |
778 | priv->mcfg[MRAM_TXB].off); | 857 | priv->mcfg[MRAM_TXB].off); |
779 | 858 | ||
780 | /* only support 8 bytes firstly */ | 859 | /* support 64 bytes payload */ |
781 | m_can_write(priv, M_CAN_TXESC, TXESC_TBDS_8BYTES); | 860 | m_can_write(priv, M_CAN_TXESC, TXESC_TBDS_64BYTES); |
782 | 861 | ||
783 | m_can_write(priv, M_CAN_TXEFC, (1 << TXEFC_EFS_OFF) | | 862 | m_can_write(priv, M_CAN_TXEFC, (1 << TXEFC_EFS_OFF) | |
784 | priv->mcfg[MRAM_TXE].off); | 863 | priv->mcfg[MRAM_TXE].off); |
@@ -793,7 +872,8 @@ static void m_can_chip_config(struct net_device *dev) | |||
793 | RXFC_FWM_1 | priv->mcfg[MRAM_RXF1].off); | 872 | RXFC_FWM_1 | priv->mcfg[MRAM_RXF1].off); |
794 | 873 | ||
795 | cccr = m_can_read(priv, M_CAN_CCCR); | 874 | cccr = m_can_read(priv, M_CAN_CCCR); |
796 | cccr &= ~(CCCR_TEST | CCCR_MON); | 875 | cccr &= ~(CCCR_TEST | CCCR_MON | (CCCR_CMR_MASK << CCCR_CMR_SHIFT) | |
876 | (CCCR_CME_MASK << CCCR_CME_SHIFT)); | ||
797 | test = m_can_read(priv, M_CAN_TEST); | 877 | test = m_can_read(priv, M_CAN_TEST); |
798 | test &= ~TEST_LBCK; | 878 | test &= ~TEST_LBCK; |
799 | 879 | ||
@@ -805,6 +885,9 @@ static void m_can_chip_config(struct net_device *dev) | |||
805 | test |= TEST_LBCK; | 885 | test |= TEST_LBCK; |
806 | } | 886 | } |
807 | 887 | ||
888 | if (priv->can.ctrlmode & CAN_CTRLMODE_FD) | ||
889 | cccr |= CCCR_CME_CANFD_BRS << CCCR_CME_SHIFT; | ||
890 | |||
808 | m_can_write(priv, M_CAN_CCCR, cccr); | 891 | m_can_write(priv, M_CAN_CCCR, cccr); |
809 | m_can_write(priv, M_CAN_TEST, test); | 892 | m_can_write(priv, M_CAN_TEST, test); |
810 | 893 | ||
@@ -869,11 +952,13 @@ static struct net_device *alloc_m_can_dev(void) | |||
869 | 952 | ||
870 | priv->dev = dev; | 953 | priv->dev = dev; |
871 | priv->can.bittiming_const = &m_can_bittiming_const; | 954 | priv->can.bittiming_const = &m_can_bittiming_const; |
955 | priv->can.data_bittiming_const = &m_can_data_bittiming_const; | ||
872 | priv->can.do_set_mode = m_can_set_mode; | 956 | priv->can.do_set_mode = m_can_set_mode; |
873 | priv->can.do_get_berr_counter = m_can_get_berr_counter; | 957 | priv->can.do_get_berr_counter = m_can_get_berr_counter; |
874 | priv->can.ctrlmode_supported = CAN_CTRLMODE_LOOPBACK | | 958 | priv->can.ctrlmode_supported = CAN_CTRLMODE_LOOPBACK | |
875 | CAN_CTRLMODE_LISTENONLY | | 959 | CAN_CTRLMODE_LISTENONLY | |
876 | CAN_CTRLMODE_BERR_REPORTING; | 960 | CAN_CTRLMODE_BERR_REPORTING | |
961 | CAN_CTRLMODE_FD; | ||
877 | 962 | ||
878 | return dev; | 963 | return dev; |
879 | } | 964 | } |
@@ -956,8 +1041,9 @@ static netdev_tx_t m_can_start_xmit(struct sk_buff *skb, | |||
956 | struct net_device *dev) | 1041 | struct net_device *dev) |
957 | { | 1042 | { |
958 | struct m_can_priv *priv = netdev_priv(dev); | 1043 | struct m_can_priv *priv = netdev_priv(dev); |
959 | struct can_frame *cf = (struct can_frame *)skb->data; | 1044 | struct canfd_frame *cf = (struct canfd_frame *)skb->data; |
960 | u32 id; | 1045 | u32 id, cccr; |
1046 | int i; | ||
961 | 1047 | ||
962 | if (can_dropped_invalid_skb(dev, skb)) | 1048 | if (can_dropped_invalid_skb(dev, skb)) |
963 | return NETDEV_TX_OK; | 1049 | return NETDEV_TX_OK; |
@@ -976,11 +1062,28 @@ static netdev_tx_t m_can_start_xmit(struct sk_buff *skb, | |||
976 | 1062 | ||
977 | /* message ram configuration */ | 1063 | /* message ram configuration */ |
978 | m_can_fifo_write(priv, 0, M_CAN_FIFO_ID, id); | 1064 | m_can_fifo_write(priv, 0, M_CAN_FIFO_ID, id); |
979 | m_can_fifo_write(priv, 0, M_CAN_FIFO_DLC, cf->can_dlc << 16); | 1065 | m_can_fifo_write(priv, 0, M_CAN_FIFO_DLC, can_len2dlc(cf->len) << 16); |
980 | m_can_fifo_write(priv, 0, M_CAN_FIFO_DATA(0), *(u32 *)(cf->data + 0)); | 1066 | |
981 | m_can_fifo_write(priv, 0, M_CAN_FIFO_DATA(1), *(u32 *)(cf->data + 4)); | 1067 | for (i = 0; i < cf->len; i += 4) |
1068 | m_can_fifo_write(priv, 0, M_CAN_FIFO_DATA(i / 4), | ||
1069 | *(u32 *)(cf->data + i)); | ||
1070 | |||
982 | can_put_echo_skb(skb, dev, 0); | 1071 | can_put_echo_skb(skb, dev, 0); |
983 | 1072 | ||
1073 | if (priv->can.ctrlmode & CAN_CTRLMODE_FD) { | ||
1074 | cccr = m_can_read(priv, M_CAN_CCCR); | ||
1075 | cccr &= ~(CCCR_CMR_MASK << CCCR_CMR_SHIFT); | ||
1076 | if (can_is_canfd_skb(skb)) { | ||
1077 | if (cf->flags & CANFD_BRS) | ||
1078 | cccr |= CCCR_CMR_CANFD_BRS << CCCR_CMR_SHIFT; | ||
1079 | else | ||
1080 | cccr |= CCCR_CMR_CANFD << CCCR_CMR_SHIFT; | ||
1081 | } else { | ||
1082 | cccr |= CCCR_CMR_CAN << CCCR_CMR_SHIFT; | ||
1083 | } | ||
1084 | m_can_write(priv, M_CAN_CCCR, cccr); | ||
1085 | } | ||
1086 | |||
984 | /* enable first TX buffer to start transfer */ | 1087 | /* enable first TX buffer to start transfer */ |
985 | m_can_write(priv, M_CAN_TXBTIE, 0x1); | 1088 | m_can_write(priv, M_CAN_TXBTIE, 0x1); |
986 | m_can_write(priv, M_CAN_TXBAR, 0x1); | 1089 | m_can_write(priv, M_CAN_TXBAR, 0x1); |
@@ -992,6 +1095,7 @@ static const struct net_device_ops m_can_netdev_ops = { | |||
992 | .ndo_open = m_can_open, | 1095 | .ndo_open = m_can_open, |
993 | .ndo_stop = m_can_close, | 1096 | .ndo_stop = m_can_close, |
994 | .ndo_start_xmit = m_can_start_xmit, | 1097 | .ndo_start_xmit = m_can_start_xmit, |
1098 | .ndo_change_mtu = can_change_mtu, | ||
995 | }; | 1099 | }; |
996 | 1100 | ||
997 | static int register_m_can_dev(struct net_device *dev) | 1101 | static int register_m_can_dev(struct net_device *dev) |
@@ -1009,7 +1113,7 @@ static int m_can_of_parse_mram(struct platform_device *pdev, | |||
1009 | struct resource *res; | 1113 | struct resource *res; |
1010 | void __iomem *addr; | 1114 | void __iomem *addr; |
1011 | u32 out_val[MRAM_CFG_LEN]; | 1115 | u32 out_val[MRAM_CFG_LEN]; |
1012 | int ret; | 1116 | int i, start, end, ret; |
1013 | 1117 | ||
1014 | /* message ram could be shared */ | 1118 | /* message ram could be shared */ |
1015 | res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "message_ram"); | 1119 | res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "message_ram"); |
@@ -1060,6 +1164,15 @@ static int m_can_of_parse_mram(struct platform_device *pdev, | |||
1060 | priv->mcfg[MRAM_TXE].off, priv->mcfg[MRAM_TXE].num, | 1164 | priv->mcfg[MRAM_TXE].off, priv->mcfg[MRAM_TXE].num, |
1061 | priv->mcfg[MRAM_TXB].off, priv->mcfg[MRAM_TXB].num); | 1165 | priv->mcfg[MRAM_TXB].off, priv->mcfg[MRAM_TXB].num); |
1062 | 1166 | ||
1167 | /* initialize the entire Message RAM in use to avoid possible | ||
1168 | * ECC/parity checksum errors when reading an uninitialized buffer | ||
1169 | */ | ||
1170 | start = priv->mcfg[MRAM_SIDF].off; | ||
1171 | end = priv->mcfg[MRAM_TXB].off + | ||
1172 | priv->mcfg[MRAM_TXB].num * TXB_ELEMENT_SIZE; | ||
1173 | for (i = start; i < end; i += 4) | ||
1174 | writel(0x0, priv->mram_base + i); | ||
1175 | |||
1063 | return 0; | 1176 | return 0; |
1064 | } | 1177 | } |
1065 | 1178 | ||
diff --git a/drivers/net/can/rcar_can.c b/drivers/net/can/rcar_can.c index 1abe133d1594..9718248e55f1 100644 --- a/drivers/net/can/rcar_can.c +++ b/drivers/net/can/rcar_can.c | |||
@@ -628,6 +628,7 @@ static const struct net_device_ops rcar_can_netdev_ops = { | |||
628 | .ndo_open = rcar_can_open, | 628 | .ndo_open = rcar_can_open, |
629 | .ndo_stop = rcar_can_close, | 629 | .ndo_stop = rcar_can_close, |
630 | .ndo_start_xmit = rcar_can_start_xmit, | 630 | .ndo_start_xmit = rcar_can_start_xmit, |
631 | .ndo_change_mtu = can_change_mtu, | ||
631 | }; | 632 | }; |
632 | 633 | ||
633 | static void rcar_can_rx_pkt(struct rcar_can_priv *priv) | 634 | static void rcar_can_rx_pkt(struct rcar_can_priv *priv) |
diff --git a/drivers/net/can/sja1000/kvaser_pci.c b/drivers/net/can/sja1000/kvaser_pci.c index 8ff3424d5147..15c00faeec61 100644 --- a/drivers/net/can/sja1000/kvaser_pci.c +++ b/drivers/net/can/sja1000/kvaser_pci.c | |||
@@ -214,7 +214,7 @@ static int kvaser_pci_add_chan(struct pci_dev *pdev, int channel, | |||
214 | struct net_device *dev; | 214 | struct net_device *dev; |
215 | struct sja1000_priv *priv; | 215 | struct sja1000_priv *priv; |
216 | struct kvaser_pci *board; | 216 | struct kvaser_pci *board; |
217 | int err, init_step; | 217 | int err; |
218 | 218 | ||
219 | dev = alloc_sja1000dev(sizeof(struct kvaser_pci)); | 219 | dev = alloc_sja1000dev(sizeof(struct kvaser_pci)); |
220 | if (dev == NULL) | 220 | if (dev == NULL) |
@@ -235,7 +235,6 @@ static int kvaser_pci_add_chan(struct pci_dev *pdev, int channel, | |||
235 | if (channel == 0) { | 235 | if (channel == 0) { |
236 | board->xilinx_ver = | 236 | board->xilinx_ver = |
237 | ioread8(board->res_addr + XILINX_VERINT) >> 4; | 237 | ioread8(board->res_addr + XILINX_VERINT) >> 4; |
238 | init_step = 2; | ||
239 | 238 | ||
240 | /* Assert PTADR# - we're in passive mode so the other bits are | 239 | /* Assert PTADR# - we're in passive mode so the other bits are |
241 | not important */ | 240 | not important */ |
@@ -264,8 +263,6 @@ static int kvaser_pci_add_chan(struct pci_dev *pdev, int channel, | |||
264 | priv->irq_flags = IRQF_SHARED; | 263 | priv->irq_flags = IRQF_SHARED; |
265 | dev->irq = pdev->irq; | 264 | dev->irq = pdev->irq; |
266 | 265 | ||
267 | init_step = 4; | ||
268 | |||
269 | dev_info(&pdev->dev, "reg_base=%p conf_addr=%p irq=%d\n", | 266 | dev_info(&pdev->dev, "reg_base=%p conf_addr=%p irq=%d\n", |
270 | priv->reg_base, board->conf_addr, dev->irq); | 267 | priv->reg_base, board->conf_addr, dev->irq); |
271 | 268 | ||
diff --git a/drivers/net/can/usb/ems_usb.c b/drivers/net/can/usb/ems_usb.c index 00f2534dde73..29d3f0938eb8 100644 --- a/drivers/net/can/usb/ems_usb.c +++ b/drivers/net/can/usb/ems_usb.c | |||
@@ -434,10 +434,9 @@ static void ems_usb_read_bulk_callback(struct urb *urb) | |||
434 | if (urb->actual_length > CPC_HEADER_SIZE) { | 434 | if (urb->actual_length > CPC_HEADER_SIZE) { |
435 | struct ems_cpc_msg *msg; | 435 | struct ems_cpc_msg *msg; |
436 | u8 *ibuf = urb->transfer_buffer; | 436 | u8 *ibuf = urb->transfer_buffer; |
437 | u8 msg_count, again, start; | 437 | u8 msg_count, start; |
438 | 438 | ||
439 | msg_count = ibuf[0] & ~0x80; | 439 | msg_count = ibuf[0] & ~0x80; |
440 | again = ibuf[0] & 0x80; | ||
441 | 440 | ||
442 | start = CPC_HEADER_SIZE; | 441 | start = CPC_HEADER_SIZE; |
443 | 442 | ||
diff --git a/drivers/net/can/usb/esd_usb2.c b/drivers/net/can/usb/esd_usb2.c index b7c9e8b11460..c063a54ab8dd 100644 --- a/drivers/net/can/usb/esd_usb2.c +++ b/drivers/net/can/usb/esd_usb2.c | |||
@@ -464,7 +464,6 @@ static void esd_usb2_write_bulk_callback(struct urb *urb) | |||
464 | { | 464 | { |
465 | struct esd_tx_urb_context *context = urb->context; | 465 | struct esd_tx_urb_context *context = urb->context; |
466 | struct esd_usb2_net_priv *priv; | 466 | struct esd_usb2_net_priv *priv; |
467 | struct esd_usb2 *dev; | ||
468 | struct net_device *netdev; | 467 | struct net_device *netdev; |
469 | size_t size = sizeof(struct esd_usb2_msg); | 468 | size_t size = sizeof(struct esd_usb2_msg); |
470 | 469 | ||
@@ -472,7 +471,6 @@ static void esd_usb2_write_bulk_callback(struct urb *urb) | |||
472 | 471 | ||
473 | priv = context->priv; | 472 | priv = context->priv; |
474 | netdev = priv->netdev; | 473 | netdev = priv->netdev; |
475 | dev = priv->usb2; | ||
476 | 474 | ||
477 | /* free up our allocated buffer */ | 475 | /* free up our allocated buffer */ |
478 | usb_free_coherent(urb->dev, size, | 476 | usb_free_coherent(urb->dev, size, |
@@ -1143,6 +1141,7 @@ static void esd_usb2_disconnect(struct usb_interface *intf) | |||
1143 | } | 1141 | } |
1144 | } | 1142 | } |
1145 | unlink_all_urbs(dev); | 1143 | unlink_all_urbs(dev); |
1144 | kfree(dev); | ||
1146 | } | 1145 | } |
1147 | } | 1146 | } |
1148 | 1147 | ||
diff --git a/drivers/net/can/usb/gs_usb.c b/drivers/net/can/usb/gs_usb.c index 04b0f84612f0..009acc8641fc 100644 --- a/drivers/net/can/usb/gs_usb.c +++ b/drivers/net/can/usb/gs_usb.c | |||
@@ -718,6 +718,7 @@ static const struct net_device_ops gs_usb_netdev_ops = { | |||
718 | .ndo_open = gs_can_open, | 718 | .ndo_open = gs_can_open, |
719 | .ndo_stop = gs_can_close, | 719 | .ndo_stop = gs_can_close, |
720 | .ndo_start_xmit = gs_can_start_xmit, | 720 | .ndo_start_xmit = gs_can_start_xmit, |
721 | .ndo_change_mtu = can_change_mtu, | ||
721 | }; | 722 | }; |
722 | 723 | ||
723 | static struct gs_can *gs_make_candev(unsigned int channel, struct usb_interface *intf) | 724 | static struct gs_can *gs_make_candev(unsigned int channel, struct usb_interface *intf) |
diff --git a/drivers/net/can/xilinx_can.c b/drivers/net/can/xilinx_can.c index 5e8b5609c067..8a998e3884ce 100644 --- a/drivers/net/can/xilinx_can.c +++ b/drivers/net/can/xilinx_can.c | |||
@@ -300,7 +300,8 @@ static int xcan_set_bittiming(struct net_device *ndev) | |||
300 | static int xcan_chip_start(struct net_device *ndev) | 300 | static int xcan_chip_start(struct net_device *ndev) |
301 | { | 301 | { |
302 | struct xcan_priv *priv = netdev_priv(ndev); | 302 | struct xcan_priv *priv = netdev_priv(ndev); |
303 | u32 err, reg_msr, reg_sr_mask; | 303 | u32 reg_msr, reg_sr_mask; |
304 | int err; | ||
304 | unsigned long timeout; | 305 | unsigned long timeout; |
305 | 306 | ||
306 | /* Check if it is in reset mode */ | 307 | /* Check if it is in reset mode */ |
@@ -961,6 +962,7 @@ static const struct net_device_ops xcan_netdev_ops = { | |||
961 | .ndo_open = xcan_open, | 962 | .ndo_open = xcan_open, |
962 | .ndo_stop = xcan_close, | 963 | .ndo_stop = xcan_close, |
963 | .ndo_start_xmit = xcan_start_xmit, | 964 | .ndo_start_xmit = xcan_start_xmit, |
965 | .ndo_change_mtu = can_change_mtu, | ||
964 | }; | 966 | }; |
965 | 967 | ||
966 | /** | 968 | /** |
diff --git a/drivers/net/dsa/bcm_sf2.c b/drivers/net/dsa/bcm_sf2.c index b9625968daac..4f4c2a7888e5 100644 --- a/drivers/net/dsa/bcm_sf2.c +++ b/drivers/net/dsa/bcm_sf2.c | |||
@@ -377,6 +377,29 @@ static irqreturn_t bcm_sf2_switch_1_isr(int irq, void *dev_id) | |||
377 | return IRQ_HANDLED; | 377 | return IRQ_HANDLED; |
378 | } | 378 | } |
379 | 379 | ||
380 | static int bcm_sf2_sw_rst(struct bcm_sf2_priv *priv) | ||
381 | { | ||
382 | unsigned int timeout = 1000; | ||
383 | u32 reg; | ||
384 | |||
385 | reg = core_readl(priv, CORE_WATCHDOG_CTRL); | ||
386 | reg |= SOFTWARE_RESET | EN_CHIP_RST | EN_SW_RESET; | ||
387 | core_writel(priv, reg, CORE_WATCHDOG_CTRL); | ||
388 | |||
389 | do { | ||
390 | reg = core_readl(priv, CORE_WATCHDOG_CTRL); | ||
391 | if (!(reg & SOFTWARE_RESET)) | ||
392 | break; | ||
393 | |||
394 | usleep_range(1000, 2000); | ||
395 | } while (timeout-- > 0); | ||
396 | |||
397 | if (timeout == 0) | ||
398 | return -ETIMEDOUT; | ||
399 | |||
400 | return 0; | ||
401 | } | ||
402 | |||
380 | static int bcm_sf2_sw_setup(struct dsa_switch *ds) | 403 | static int bcm_sf2_sw_setup(struct dsa_switch *ds) |
381 | { | 404 | { |
382 | const char *reg_names[BCM_SF2_REGS_NUM] = BCM_SF2_REGS_NAME; | 405 | const char *reg_names[BCM_SF2_REGS_NUM] = BCM_SF2_REGS_NAME; |
@@ -404,11 +427,18 @@ static int bcm_sf2_sw_setup(struct dsa_switch *ds) | |||
404 | *base = of_iomap(dn, i); | 427 | *base = of_iomap(dn, i); |
405 | if (*base == NULL) { | 428 | if (*base == NULL) { |
406 | pr_err("unable to find register: %s\n", reg_names[i]); | 429 | pr_err("unable to find register: %s\n", reg_names[i]); |
407 | return -ENODEV; | 430 | ret = -ENOMEM; |
431 | goto out_unmap; | ||
408 | } | 432 | } |
409 | base++; | 433 | base++; |
410 | } | 434 | } |
411 | 435 | ||
436 | ret = bcm_sf2_sw_rst(priv); | ||
437 | if (ret) { | ||
438 | pr_err("unable to software reset switch: %d\n", ret); | ||
439 | goto out_unmap; | ||
440 | } | ||
441 | |||
412 | /* Disable all interrupts and request them */ | 442 | /* Disable all interrupts and request them */ |
413 | intrl2_0_writel(priv, 0xffffffff, INTRL2_CPU_MASK_SET); | 443 | intrl2_0_writel(priv, 0xffffffff, INTRL2_CPU_MASK_SET); |
414 | intrl2_0_writel(priv, 0xffffffff, INTRL2_CPU_CLEAR); | 444 | intrl2_0_writel(priv, 0xffffffff, INTRL2_CPU_CLEAR); |
@@ -484,7 +514,8 @@ out_free_irq0: | |||
484 | out_unmap: | 514 | out_unmap: |
485 | base = &priv->core; | 515 | base = &priv->core; |
486 | for (i = 0; i < BCM_SF2_REGS_NUM; i++) { | 516 | for (i = 0; i < BCM_SF2_REGS_NUM; i++) { |
487 | iounmap(*base); | 517 | if (*base) |
518 | iounmap(*base); | ||
488 | base++; | 519 | base++; |
489 | } | 520 | } |
490 | return ret; | 521 | return ret; |
@@ -733,29 +764,6 @@ static int bcm_sf2_sw_suspend(struct dsa_switch *ds) | |||
733 | return 0; | 764 | return 0; |
734 | } | 765 | } |
735 | 766 | ||
736 | static int bcm_sf2_sw_rst(struct bcm_sf2_priv *priv) | ||
737 | { | ||
738 | unsigned int timeout = 1000; | ||
739 | u32 reg; | ||
740 | |||
741 | reg = core_readl(priv, CORE_WATCHDOG_CTRL); | ||
742 | reg |= SOFTWARE_RESET | EN_CHIP_RST | EN_SW_RESET; | ||
743 | core_writel(priv, reg, CORE_WATCHDOG_CTRL); | ||
744 | |||
745 | do { | ||
746 | reg = core_readl(priv, CORE_WATCHDOG_CTRL); | ||
747 | if (!(reg & SOFTWARE_RESET)) | ||
748 | break; | ||
749 | |||
750 | usleep_range(1000, 2000); | ||
751 | } while (timeout-- > 0); | ||
752 | |||
753 | if (timeout == 0) | ||
754 | return -ETIMEDOUT; | ||
755 | |||
756 | return 0; | ||
757 | } | ||
758 | |||
759 | static int bcm_sf2_sw_resume(struct dsa_switch *ds) | 767 | static int bcm_sf2_sw_resume(struct dsa_switch *ds) |
760 | { | 768 | { |
761 | struct bcm_sf2_priv *priv = ds_to_priv(ds); | 769 | struct bcm_sf2_priv *priv = ds_to_priv(ds); |
diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c index dbb41c1923e6..77f8f836cbbe 100644 --- a/drivers/net/ethernet/broadcom/tg3.c +++ b/drivers/net/ethernet/broadcom/tg3.c | |||
@@ -8563,7 +8563,8 @@ static int tg3_init_rings(struct tg3 *tp) | |||
8563 | if (tnapi->rx_rcb) | 8563 | if (tnapi->rx_rcb) |
8564 | memset(tnapi->rx_rcb, 0, TG3_RX_RCB_RING_BYTES(tp)); | 8564 | memset(tnapi->rx_rcb, 0, TG3_RX_RCB_RING_BYTES(tp)); |
8565 | 8565 | ||
8566 | if (tg3_rx_prodring_alloc(tp, &tnapi->prodring)) { | 8566 | if (tnapi->prodring.rx_std && |
8567 | tg3_rx_prodring_alloc(tp, &tnapi->prodring)) { | ||
8567 | tg3_free_rings(tp); | 8568 | tg3_free_rings(tp); |
8568 | return -ENOMEM; | 8569 | return -ENOMEM; |
8569 | } | 8570 | } |
diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_dcb.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_dcb.c index cca604994003..4fe33606f372 100644 --- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_dcb.c +++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_dcb.c | |||
@@ -1082,7 +1082,7 @@ static int cxgb4_cee_peer_getpg(struct net_device *dev, struct cee_pg *pg) | |||
1082 | pgid = be32_to_cpu(pcmd.u.dcb.pgid.pgid); | 1082 | pgid = be32_to_cpu(pcmd.u.dcb.pgid.pgid); |
1083 | 1083 | ||
1084 | for (i = 0; i < CXGB4_MAX_PRIORITY; i++) | 1084 | for (i = 0; i < CXGB4_MAX_PRIORITY; i++) |
1085 | pg->prio_pg[i] = (pgid >> (i * 4)) & 0xF; | 1085 | pg->prio_pg[7 - i] = (pgid >> (i * 4)) & 0xF; |
1086 | 1086 | ||
1087 | INIT_PORT_DCB_READ_PEER_CMD(pcmd, pi->port_id); | 1087 | INIT_PORT_DCB_READ_PEER_CMD(pcmd, pi->port_id); |
1088 | pcmd.u.dcb.pgrate.type = FW_PORT_DCB_TYPE_PGRATE; | 1088 | pcmd.u.dcb.pgrate.type = FW_PORT_DCB_TYPE_PGRATE; |
diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c index 8520d5529df8..279873cb6e3a 100644 --- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c +++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c | |||
@@ -2442,9 +2442,13 @@ static unsigned int from_fw_linkcaps(unsigned int type, unsigned int caps) | |||
2442 | SUPPORTED_10000baseKR_Full | SUPPORTED_1000baseKX_Full | | 2442 | SUPPORTED_10000baseKR_Full | SUPPORTED_1000baseKX_Full | |
2443 | SUPPORTED_10000baseKX4_Full; | 2443 | SUPPORTED_10000baseKX4_Full; |
2444 | else if (type == FW_PORT_TYPE_FIBER_XFI || | 2444 | else if (type == FW_PORT_TYPE_FIBER_XFI || |
2445 | type == FW_PORT_TYPE_FIBER_XAUI || type == FW_PORT_TYPE_SFP) | 2445 | type == FW_PORT_TYPE_FIBER_XAUI || type == FW_PORT_TYPE_SFP) { |
2446 | v |= SUPPORTED_FIBRE; | 2446 | v |= SUPPORTED_FIBRE; |
2447 | else if (type == FW_PORT_TYPE_BP40_BA) | 2447 | if (caps & FW_PORT_CAP_SPEED_1G) |
2448 | v |= SUPPORTED_1000baseT_Full; | ||
2449 | if (caps & FW_PORT_CAP_SPEED_10G) | ||
2450 | v |= SUPPORTED_10000baseT_Full; | ||
2451 | } else if (type == FW_PORT_TYPE_BP40_BA) | ||
2448 | v |= SUPPORTED_40000baseSR4_Full; | 2452 | v |= SUPPORTED_40000baseSR4_Full; |
2449 | 2453 | ||
2450 | if (caps & FW_PORT_CAP_ANEG) | 2454 | if (caps & FW_PORT_CAP_ANEG) |
diff --git a/drivers/net/ethernet/emulex/benet/be_main.c b/drivers/net/ethernet/emulex/benet/be_main.c index 9a18e7930b31..597c463e384d 100644 --- a/drivers/net/ethernet/emulex/benet/be_main.c +++ b/drivers/net/ethernet/emulex/benet/be_main.c | |||
@@ -4309,11 +4309,16 @@ static int be_ndo_bridge_setlink(struct net_device *dev, struct nlmsghdr *nlh) | |||
4309 | return -EOPNOTSUPP; | 4309 | return -EOPNOTSUPP; |
4310 | 4310 | ||
4311 | br_spec = nlmsg_find_attr(nlh, sizeof(struct ifinfomsg), IFLA_AF_SPEC); | 4311 | br_spec = nlmsg_find_attr(nlh, sizeof(struct ifinfomsg), IFLA_AF_SPEC); |
4312 | if (!br_spec) | ||
4313 | return -EINVAL; | ||
4312 | 4314 | ||
4313 | nla_for_each_nested(attr, br_spec, rem) { | 4315 | nla_for_each_nested(attr, br_spec, rem) { |
4314 | if (nla_type(attr) != IFLA_BRIDGE_MODE) | 4316 | if (nla_type(attr) != IFLA_BRIDGE_MODE) |
4315 | continue; | 4317 | continue; |
4316 | 4318 | ||
4319 | if (nla_len(attr) < sizeof(mode)) | ||
4320 | return -EINVAL; | ||
4321 | |||
4317 | mode = nla_get_u16(attr); | 4322 | mode = nla_get_u16(attr); |
4318 | if (mode != BRIDGE_MODE_VEPA && mode != BRIDGE_MODE_VEB) | 4323 | if (mode != BRIDGE_MODE_VEPA && mode != BRIDGE_MODE_VEB) |
4319 | return -EINVAL; | 4324 | return -EINVAL; |
@@ -4421,6 +4426,11 @@ static void be_del_vxlan_port(struct net_device *netdev, sa_family_t sa_family, | |||
4421 | "Disabled VxLAN offloads for UDP port %d\n", | 4426 | "Disabled VxLAN offloads for UDP port %d\n", |
4422 | be16_to_cpu(port)); | 4427 | be16_to_cpu(port)); |
4423 | } | 4428 | } |
4429 | |||
4430 | static bool be_gso_check(struct sk_buff *skb, struct net_device *dev) | ||
4431 | { | ||
4432 | return vxlan_gso_check(skb); | ||
4433 | } | ||
4424 | #endif | 4434 | #endif |
4425 | 4435 | ||
4426 | static const struct net_device_ops be_netdev_ops = { | 4436 | static const struct net_device_ops be_netdev_ops = { |
@@ -4450,6 +4460,7 @@ static const struct net_device_ops be_netdev_ops = { | |||
4450 | #ifdef CONFIG_BE2NET_VXLAN | 4460 | #ifdef CONFIG_BE2NET_VXLAN |
4451 | .ndo_add_vxlan_port = be_add_vxlan_port, | 4461 | .ndo_add_vxlan_port = be_add_vxlan_port, |
4452 | .ndo_del_vxlan_port = be_del_vxlan_port, | 4462 | .ndo_del_vxlan_port = be_del_vxlan_port, |
4463 | .ndo_gso_check = be_gso_check, | ||
4453 | #endif | 4464 | #endif |
4454 | }; | 4465 | }; |
4455 | 4466 | ||
diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c index a2d72a87cbde..487cd9c4ac0d 100644 --- a/drivers/net/ethernet/intel/igb/igb_main.c +++ b/drivers/net/ethernet/intel/igb/igb_main.c | |||
@@ -1012,7 +1012,8 @@ static void igb_free_q_vector(struct igb_adapter *adapter, int v_idx) | |||
1012 | /* igb_get_stats64() might access the rings on this vector, | 1012 | /* igb_get_stats64() might access the rings on this vector, |
1013 | * we must wait a grace period before freeing it. | 1013 | * we must wait a grace period before freeing it. |
1014 | */ | 1014 | */ |
1015 | kfree_rcu(q_vector, rcu); | 1015 | if (q_vector) |
1016 | kfree_rcu(q_vector, rcu); | ||
1016 | } | 1017 | } |
1017 | 1018 | ||
1018 | /** | 1019 | /** |
@@ -1792,8 +1793,10 @@ void igb_down(struct igb_adapter *adapter) | |||
1792 | adapter->flags &= ~IGB_FLAG_NEED_LINK_UPDATE; | 1793 | adapter->flags &= ~IGB_FLAG_NEED_LINK_UPDATE; |
1793 | 1794 | ||
1794 | for (i = 0; i < adapter->num_q_vectors; i++) { | 1795 | for (i = 0; i < adapter->num_q_vectors; i++) { |
1795 | napi_synchronize(&(adapter->q_vector[i]->napi)); | 1796 | if (adapter->q_vector[i]) { |
1796 | napi_disable(&(adapter->q_vector[i]->napi)); | 1797 | napi_synchronize(&adapter->q_vector[i]->napi); |
1798 | napi_disable(&adapter->q_vector[i]->napi); | ||
1799 | } | ||
1797 | } | 1800 | } |
1798 | 1801 | ||
1799 | 1802 | ||
@@ -3717,7 +3720,8 @@ static void igb_free_all_tx_resources(struct igb_adapter *adapter) | |||
3717 | int i; | 3720 | int i; |
3718 | 3721 | ||
3719 | for (i = 0; i < adapter->num_tx_queues; i++) | 3722 | for (i = 0; i < adapter->num_tx_queues; i++) |
3720 | igb_free_tx_resources(adapter->tx_ring[i]); | 3723 | if (adapter->tx_ring[i]) |
3724 | igb_free_tx_resources(adapter->tx_ring[i]); | ||
3721 | } | 3725 | } |
3722 | 3726 | ||
3723 | void igb_unmap_and_free_tx_resource(struct igb_ring *ring, | 3727 | void igb_unmap_and_free_tx_resource(struct igb_ring *ring, |
@@ -3782,7 +3786,8 @@ static void igb_clean_all_tx_rings(struct igb_adapter *adapter) | |||
3782 | int i; | 3786 | int i; |
3783 | 3787 | ||
3784 | for (i = 0; i < adapter->num_tx_queues; i++) | 3788 | for (i = 0; i < adapter->num_tx_queues; i++) |
3785 | igb_clean_tx_ring(adapter->tx_ring[i]); | 3789 | if (adapter->tx_ring[i]) |
3790 | igb_clean_tx_ring(adapter->tx_ring[i]); | ||
3786 | } | 3791 | } |
3787 | 3792 | ||
3788 | /** | 3793 | /** |
@@ -3819,7 +3824,8 @@ static void igb_free_all_rx_resources(struct igb_adapter *adapter) | |||
3819 | int i; | 3824 | int i; |
3820 | 3825 | ||
3821 | for (i = 0; i < adapter->num_rx_queues; i++) | 3826 | for (i = 0; i < adapter->num_rx_queues; i++) |
3822 | igb_free_rx_resources(adapter->rx_ring[i]); | 3827 | if (adapter->rx_ring[i]) |
3828 | igb_free_rx_resources(adapter->rx_ring[i]); | ||
3823 | } | 3829 | } |
3824 | 3830 | ||
3825 | /** | 3831 | /** |
@@ -3874,7 +3880,8 @@ static void igb_clean_all_rx_rings(struct igb_adapter *adapter) | |||
3874 | int i; | 3880 | int i; |
3875 | 3881 | ||
3876 | for (i = 0; i < adapter->num_rx_queues; i++) | 3882 | for (i = 0; i < adapter->num_rx_queues; i++) |
3877 | igb_clean_rx_ring(adapter->rx_ring[i]); | 3883 | if (adapter->rx_ring[i]) |
3884 | igb_clean_rx_ring(adapter->rx_ring[i]); | ||
3878 | } | 3885 | } |
3879 | 3886 | ||
3880 | /** | 3887 | /** |
@@ -7404,6 +7411,8 @@ static int igb_resume(struct device *dev) | |||
7404 | pci_restore_state(pdev); | 7411 | pci_restore_state(pdev); |
7405 | pci_save_state(pdev); | 7412 | pci_save_state(pdev); |
7406 | 7413 | ||
7414 | if (!pci_device_is_present(pdev)) | ||
7415 | return -ENODEV; | ||
7407 | err = pci_enable_device_mem(pdev); | 7416 | err = pci_enable_device_mem(pdev); |
7408 | if (err) { | 7417 | if (err) { |
7409 | dev_err(&pdev->dev, | 7418 | dev_err(&pdev->dev, |
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c index d2df4e3d1032..cc51554c9e99 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | |||
@@ -3936,8 +3936,8 @@ void ixgbe_set_rx_mode(struct net_device *netdev) | |||
3936 | * if SR-IOV and VMDQ are disabled - otherwise ensure | 3936 | * if SR-IOV and VMDQ are disabled - otherwise ensure |
3937 | * that hardware VLAN filters remain enabled. | 3937 | * that hardware VLAN filters remain enabled. |
3938 | */ | 3938 | */ |
3939 | if (!(adapter->flags & (IXGBE_FLAG_VMDQ_ENABLED | | 3939 | if (adapter->flags & (IXGBE_FLAG_VMDQ_ENABLED | |
3940 | IXGBE_FLAG_SRIOV_ENABLED))) | 3940 | IXGBE_FLAG_SRIOV_ENABLED)) |
3941 | vlnctrl |= (IXGBE_VLNCTRL_VFE | IXGBE_VLNCTRL_CFIEN); | 3941 | vlnctrl |= (IXGBE_VLNCTRL_VFE | IXGBE_VLNCTRL_CFIEN); |
3942 | } else { | 3942 | } else { |
3943 | if (netdev->flags & IFF_ALLMULTI) { | 3943 | if (netdev->flags & IFF_ALLMULTI) { |
@@ -7669,6 +7669,8 @@ static int ixgbe_ndo_bridge_setlink(struct net_device *dev, | |||
7669 | return -EOPNOTSUPP; | 7669 | return -EOPNOTSUPP; |
7670 | 7670 | ||
7671 | br_spec = nlmsg_find_attr(nlh, sizeof(struct ifinfomsg), IFLA_AF_SPEC); | 7671 | br_spec = nlmsg_find_attr(nlh, sizeof(struct ifinfomsg), IFLA_AF_SPEC); |
7672 | if (!br_spec) | ||
7673 | return -EINVAL; | ||
7672 | 7674 | ||
7673 | nla_for_each_nested(attr, br_spec, rem) { | 7675 | nla_for_each_nested(attr, br_spec, rem) { |
7674 | __u16 mode; | 7676 | __u16 mode; |
@@ -7677,6 +7679,9 @@ static int ixgbe_ndo_bridge_setlink(struct net_device *dev, | |||
7677 | if (nla_type(attr) != IFLA_BRIDGE_MODE) | 7679 | if (nla_type(attr) != IFLA_BRIDGE_MODE) |
7678 | continue; | 7680 | continue; |
7679 | 7681 | ||
7682 | if (nla_len(attr) < sizeof(mode)) | ||
7683 | return -EINVAL; | ||
7684 | |||
7680 | mode = nla_get_u16(attr); | 7685 | mode = nla_get_u16(attr); |
7681 | if (mode == BRIDGE_MODE_VEPA) { | 7686 | if (mode == BRIDGE_MODE_VEPA) { |
7682 | reg = 0; | 7687 | reg = 0; |
@@ -7979,6 +7984,7 @@ static int ixgbe_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
7979 | int i, err, pci_using_dac, expected_gts; | 7984 | int i, err, pci_using_dac, expected_gts; |
7980 | unsigned int indices = MAX_TX_QUEUES; | 7985 | unsigned int indices = MAX_TX_QUEUES; |
7981 | u8 part_str[IXGBE_PBANUM_LENGTH]; | 7986 | u8 part_str[IXGBE_PBANUM_LENGTH]; |
7987 | bool disable_dev = false; | ||
7982 | #ifdef IXGBE_FCOE | 7988 | #ifdef IXGBE_FCOE |
7983 | u16 device_caps; | 7989 | u16 device_caps; |
7984 | #endif | 7990 | #endif |
@@ -8369,13 +8375,14 @@ err_sw_init: | |||
8369 | iounmap(adapter->io_addr); | 8375 | iounmap(adapter->io_addr); |
8370 | kfree(adapter->mac_table); | 8376 | kfree(adapter->mac_table); |
8371 | err_ioremap: | 8377 | err_ioremap: |
8378 | disable_dev = !test_and_set_bit(__IXGBE_DISABLED, &adapter->state); | ||
8372 | free_netdev(netdev); | 8379 | free_netdev(netdev); |
8373 | err_alloc_etherdev: | 8380 | err_alloc_etherdev: |
8374 | pci_release_selected_regions(pdev, | 8381 | pci_release_selected_regions(pdev, |
8375 | pci_select_bars(pdev, IORESOURCE_MEM)); | 8382 | pci_select_bars(pdev, IORESOURCE_MEM)); |
8376 | err_pci_reg: | 8383 | err_pci_reg: |
8377 | err_dma: | 8384 | err_dma: |
8378 | if (!adapter || !test_and_set_bit(__IXGBE_DISABLED, &adapter->state)) | 8385 | if (!adapter || disable_dev) |
8379 | pci_disable_device(pdev); | 8386 | pci_disable_device(pdev); |
8380 | return err; | 8387 | return err; |
8381 | } | 8388 | } |
@@ -8393,6 +8400,7 @@ static void ixgbe_remove(struct pci_dev *pdev) | |||
8393 | { | 8400 | { |
8394 | struct ixgbe_adapter *adapter = pci_get_drvdata(pdev); | 8401 | struct ixgbe_adapter *adapter = pci_get_drvdata(pdev); |
8395 | struct net_device *netdev = adapter->netdev; | 8402 | struct net_device *netdev = adapter->netdev; |
8403 | bool disable_dev; | ||
8396 | 8404 | ||
8397 | ixgbe_dbg_adapter_exit(adapter); | 8405 | ixgbe_dbg_adapter_exit(adapter); |
8398 | 8406 | ||
@@ -8442,11 +8450,12 @@ static void ixgbe_remove(struct pci_dev *pdev) | |||
8442 | e_dev_info("complete\n"); | 8450 | e_dev_info("complete\n"); |
8443 | 8451 | ||
8444 | kfree(adapter->mac_table); | 8452 | kfree(adapter->mac_table); |
8453 | disable_dev = !test_and_set_bit(__IXGBE_DISABLED, &adapter->state); | ||
8445 | free_netdev(netdev); | 8454 | free_netdev(netdev); |
8446 | 8455 | ||
8447 | pci_disable_pcie_error_reporting(pdev); | 8456 | pci_disable_pcie_error_reporting(pdev); |
8448 | 8457 | ||
8449 | if (!test_and_set_bit(__IXGBE_DISABLED, &adapter->state)) | 8458 | if (disable_dev) |
8450 | pci_disable_device(pdev); | 8459 | pci_disable_device(pdev); |
8451 | } | 8460 | } |
8452 | 8461 | ||
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c index 02266e3de514..4d69e382b4e5 100644 --- a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c +++ b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c | |||
@@ -1693,7 +1693,7 @@ int mlx4_en_start_port(struct net_device *dev) | |||
1693 | mlx4_set_stats_bitmap(mdev->dev, &priv->stats_bitmap); | 1693 | mlx4_set_stats_bitmap(mdev->dev, &priv->stats_bitmap); |
1694 | 1694 | ||
1695 | #ifdef CONFIG_MLX4_EN_VXLAN | 1695 | #ifdef CONFIG_MLX4_EN_VXLAN |
1696 | if (priv->mdev->dev->caps.flags2 & MLX4_DEV_CAP_FLAG2_VXLAN_OFFLOADS) | 1696 | if (priv->mdev->dev->caps.tunnel_offload_mode == MLX4_TUNNEL_OFFLOAD_MODE_VXLAN) |
1697 | vxlan_get_rx_port(dev); | 1697 | vxlan_get_rx_port(dev); |
1698 | #endif | 1698 | #endif |
1699 | priv->port_up = true; | 1699 | priv->port_up = true; |
@@ -2355,6 +2355,11 @@ static void mlx4_en_del_vxlan_port(struct net_device *dev, | |||
2355 | 2355 | ||
2356 | queue_work(priv->mdev->workqueue, &priv->vxlan_del_task); | 2356 | queue_work(priv->mdev->workqueue, &priv->vxlan_del_task); |
2357 | } | 2357 | } |
2358 | |||
2359 | static bool mlx4_en_gso_check(struct sk_buff *skb, struct net_device *dev) | ||
2360 | { | ||
2361 | return vxlan_gso_check(skb); | ||
2362 | } | ||
2358 | #endif | 2363 | #endif |
2359 | 2364 | ||
2360 | static const struct net_device_ops mlx4_netdev_ops = { | 2365 | static const struct net_device_ops mlx4_netdev_ops = { |
@@ -2386,6 +2391,7 @@ static const struct net_device_ops mlx4_netdev_ops = { | |||
2386 | #ifdef CONFIG_MLX4_EN_VXLAN | 2391 | #ifdef CONFIG_MLX4_EN_VXLAN |
2387 | .ndo_add_vxlan_port = mlx4_en_add_vxlan_port, | 2392 | .ndo_add_vxlan_port = mlx4_en_add_vxlan_port, |
2388 | .ndo_del_vxlan_port = mlx4_en_del_vxlan_port, | 2393 | .ndo_del_vxlan_port = mlx4_en_del_vxlan_port, |
2394 | .ndo_gso_check = mlx4_en_gso_check, | ||
2389 | #endif | 2395 | #endif |
2390 | }; | 2396 | }; |
2391 | 2397 | ||
@@ -2416,6 +2422,11 @@ static const struct net_device_ops mlx4_netdev_ops_master = { | |||
2416 | .ndo_rx_flow_steer = mlx4_en_filter_rfs, | 2422 | .ndo_rx_flow_steer = mlx4_en_filter_rfs, |
2417 | #endif | 2423 | #endif |
2418 | .ndo_get_phys_port_id = mlx4_en_get_phys_port_id, | 2424 | .ndo_get_phys_port_id = mlx4_en_get_phys_port_id, |
2425 | #ifdef CONFIG_MLX4_EN_VXLAN | ||
2426 | .ndo_add_vxlan_port = mlx4_en_add_vxlan_port, | ||
2427 | .ndo_del_vxlan_port = mlx4_en_del_vxlan_port, | ||
2428 | .ndo_gso_check = mlx4_en_gso_check, | ||
2429 | #endif | ||
2419 | }; | 2430 | }; |
2420 | 2431 | ||
2421 | int mlx4_en_init_netdev(struct mlx4_en_dev *mdev, int port, | 2432 | int mlx4_en_init_netdev(struct mlx4_en_dev *mdev, int port, |
diff --git a/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c b/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c index 5d2498dcf536..cd5cf6d957c7 100644 --- a/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c +++ b/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c | |||
@@ -1546,7 +1546,7 @@ static int qp_alloc_res(struct mlx4_dev *dev, int slave, int op, int cmd, | |||
1546 | 1546 | ||
1547 | switch (op) { | 1547 | switch (op) { |
1548 | case RES_OP_RESERVE: | 1548 | case RES_OP_RESERVE: |
1549 | count = get_param_l(&in_param); | 1549 | count = get_param_l(&in_param) & 0xffffff; |
1550 | align = get_param_h(&in_param); | 1550 | align = get_param_h(&in_param); |
1551 | err = mlx4_grant_resource(dev, slave, RES_QP, count, 0); | 1551 | err = mlx4_grant_resource(dev, slave, RES_QP, count, 0); |
1552 | if (err) | 1552 | if (err) |
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c index f5e29f7bdae3..a913b3ad2f89 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c | |||
@@ -503,6 +503,11 @@ static void qlcnic_del_vxlan_port(struct net_device *netdev, | |||
503 | 503 | ||
504 | adapter->flags |= QLCNIC_DEL_VXLAN_PORT; | 504 | adapter->flags |= QLCNIC_DEL_VXLAN_PORT; |
505 | } | 505 | } |
506 | |||
507 | static bool qlcnic_gso_check(struct sk_buff *skb, struct net_device *dev) | ||
508 | { | ||
509 | return vxlan_gso_check(skb); | ||
510 | } | ||
506 | #endif | 511 | #endif |
507 | 512 | ||
508 | static const struct net_device_ops qlcnic_netdev_ops = { | 513 | static const struct net_device_ops qlcnic_netdev_ops = { |
@@ -526,6 +531,7 @@ static const struct net_device_ops qlcnic_netdev_ops = { | |||
526 | #ifdef CONFIG_QLCNIC_VXLAN | 531 | #ifdef CONFIG_QLCNIC_VXLAN |
527 | .ndo_add_vxlan_port = qlcnic_add_vxlan_port, | 532 | .ndo_add_vxlan_port = qlcnic_add_vxlan_port, |
528 | .ndo_del_vxlan_port = qlcnic_del_vxlan_port, | 533 | .ndo_del_vxlan_port = qlcnic_del_vxlan_port, |
534 | .ndo_gso_check = qlcnic_gso_check, | ||
529 | #endif | 535 | #endif |
530 | #ifdef CONFIG_NET_POLL_CONTROLLER | 536 | #ifdef CONFIG_NET_POLL_CONTROLLER |
531 | .ndo_poll_controller = qlcnic_poll_controller, | 537 | .ndo_poll_controller = qlcnic_poll_controller, |
diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c index 60e9c2cd051e..b5db6b3f939f 100644 --- a/drivers/net/ethernet/renesas/sh_eth.c +++ b/drivers/net/ethernet/renesas/sh_eth.c | |||
@@ -917,21 +917,13 @@ static int sh_eth_reset(struct net_device *ndev) | |||
917 | return ret; | 917 | return ret; |
918 | } | 918 | } |
919 | 919 | ||
920 | #if defined(CONFIG_CPU_SH4) || defined(CONFIG_ARCH_SHMOBILE) | ||
921 | static void sh_eth_set_receive_align(struct sk_buff *skb) | 920 | static void sh_eth_set_receive_align(struct sk_buff *skb) |
922 | { | 921 | { |
923 | int reserve; | 922 | uintptr_t reserve = (uintptr_t)skb->data & (SH_ETH_RX_ALIGN - 1); |
924 | 923 | ||
925 | reserve = SH4_SKB_RX_ALIGN - ((u32)skb->data & (SH4_SKB_RX_ALIGN - 1)); | ||
926 | if (reserve) | 924 | if (reserve) |
927 | skb_reserve(skb, reserve); | 925 | skb_reserve(skb, SH_ETH_RX_ALIGN - reserve); |
928 | } | 926 | } |
929 | #else | ||
930 | static void sh_eth_set_receive_align(struct sk_buff *skb) | ||
931 | { | ||
932 | skb_reserve(skb, SH2_SH3_SKB_RX_ALIGN); | ||
933 | } | ||
934 | #endif | ||
935 | 927 | ||
936 | 928 | ||
937 | /* CPU <-> EDMAC endian convert */ | 929 | /* CPU <-> EDMAC endian convert */ |
@@ -1119,6 +1111,7 @@ static void sh_eth_ring_format(struct net_device *ndev) | |||
1119 | struct sh_eth_txdesc *txdesc = NULL; | 1111 | struct sh_eth_txdesc *txdesc = NULL; |
1120 | int rx_ringsize = sizeof(*rxdesc) * mdp->num_rx_ring; | 1112 | int rx_ringsize = sizeof(*rxdesc) * mdp->num_rx_ring; |
1121 | int tx_ringsize = sizeof(*txdesc) * mdp->num_tx_ring; | 1113 | int tx_ringsize = sizeof(*txdesc) * mdp->num_tx_ring; |
1114 | int skbuff_size = mdp->rx_buf_sz + SH_ETH_RX_ALIGN - 1; | ||
1122 | 1115 | ||
1123 | mdp->cur_rx = 0; | 1116 | mdp->cur_rx = 0; |
1124 | mdp->cur_tx = 0; | 1117 | mdp->cur_tx = 0; |
@@ -1131,21 +1124,21 @@ static void sh_eth_ring_format(struct net_device *ndev) | |||
1131 | for (i = 0; i < mdp->num_rx_ring; i++) { | 1124 | for (i = 0; i < mdp->num_rx_ring; i++) { |
1132 | /* skb */ | 1125 | /* skb */ |
1133 | mdp->rx_skbuff[i] = NULL; | 1126 | mdp->rx_skbuff[i] = NULL; |
1134 | skb = netdev_alloc_skb(ndev, mdp->rx_buf_sz); | 1127 | skb = netdev_alloc_skb(ndev, skbuff_size); |
1135 | mdp->rx_skbuff[i] = skb; | 1128 | mdp->rx_skbuff[i] = skb; |
1136 | if (skb == NULL) | 1129 | if (skb == NULL) |
1137 | break; | 1130 | break; |
1138 | dma_map_single(&ndev->dev, skb->data, mdp->rx_buf_sz, | ||
1139 | DMA_FROM_DEVICE); | ||
1140 | sh_eth_set_receive_align(skb); | 1131 | sh_eth_set_receive_align(skb); |
1141 | 1132 | ||
1142 | /* RX descriptor */ | 1133 | /* RX descriptor */ |
1143 | rxdesc = &mdp->rx_ring[i]; | 1134 | rxdesc = &mdp->rx_ring[i]; |
1135 | /* The size of the buffer is a multiple of 16 bytes. */ | ||
1136 | rxdesc->buffer_length = ALIGN(mdp->rx_buf_sz, 16); | ||
1137 | dma_map_single(&ndev->dev, skb->data, rxdesc->buffer_length, | ||
1138 | DMA_FROM_DEVICE); | ||
1144 | rxdesc->addr = virt_to_phys(PTR_ALIGN(skb->data, 4)); | 1139 | rxdesc->addr = virt_to_phys(PTR_ALIGN(skb->data, 4)); |
1145 | rxdesc->status = cpu_to_edmac(mdp, RD_RACT | RD_RFP); | 1140 | rxdesc->status = cpu_to_edmac(mdp, RD_RACT | RD_RFP); |
1146 | 1141 | ||
1147 | /* The size of the buffer is 16 byte boundary. */ | ||
1148 | rxdesc->buffer_length = ALIGN(mdp->rx_buf_sz, 16); | ||
1149 | /* Rx descriptor address set */ | 1142 | /* Rx descriptor address set */ |
1150 | if (i == 0) { | 1143 | if (i == 0) { |
1151 | sh_eth_write(ndev, mdp->rx_desc_dma, RDLAR); | 1144 | sh_eth_write(ndev, mdp->rx_desc_dma, RDLAR); |
@@ -1397,6 +1390,7 @@ static int sh_eth_rx(struct net_device *ndev, u32 intr_status, int *quota) | |||
1397 | struct sk_buff *skb; | 1390 | struct sk_buff *skb; |
1398 | u16 pkt_len = 0; | 1391 | u16 pkt_len = 0; |
1399 | u32 desc_status; | 1392 | u32 desc_status; |
1393 | int skbuff_size = mdp->rx_buf_sz + SH_ETH_RX_ALIGN - 1; | ||
1400 | 1394 | ||
1401 | rxdesc = &mdp->rx_ring[entry]; | 1395 | rxdesc = &mdp->rx_ring[entry]; |
1402 | while (!(rxdesc->status & cpu_to_edmac(mdp, RD_RACT))) { | 1396 | while (!(rxdesc->status & cpu_to_edmac(mdp, RD_RACT))) { |
@@ -1448,7 +1442,7 @@ static int sh_eth_rx(struct net_device *ndev, u32 intr_status, int *quota) | |||
1448 | if (mdp->cd->rpadir) | 1442 | if (mdp->cd->rpadir) |
1449 | skb_reserve(skb, NET_IP_ALIGN); | 1443 | skb_reserve(skb, NET_IP_ALIGN); |
1450 | dma_sync_single_for_cpu(&ndev->dev, rxdesc->addr, | 1444 | dma_sync_single_for_cpu(&ndev->dev, rxdesc->addr, |
1451 | mdp->rx_buf_sz, | 1445 | ALIGN(mdp->rx_buf_sz, 16), |
1452 | DMA_FROM_DEVICE); | 1446 | DMA_FROM_DEVICE); |
1453 | skb_put(skb, pkt_len); | 1447 | skb_put(skb, pkt_len); |
1454 | skb->protocol = eth_type_trans(skb, ndev); | 1448 | skb->protocol = eth_type_trans(skb, ndev); |
@@ -1468,13 +1462,13 @@ static int sh_eth_rx(struct net_device *ndev, u32 intr_status, int *quota) | |||
1468 | rxdesc->buffer_length = ALIGN(mdp->rx_buf_sz, 16); | 1462 | rxdesc->buffer_length = ALIGN(mdp->rx_buf_sz, 16); |
1469 | 1463 | ||
1470 | if (mdp->rx_skbuff[entry] == NULL) { | 1464 | if (mdp->rx_skbuff[entry] == NULL) { |
1471 | skb = netdev_alloc_skb(ndev, mdp->rx_buf_sz); | 1465 | skb = netdev_alloc_skb(ndev, skbuff_size); |
1472 | mdp->rx_skbuff[entry] = skb; | 1466 | mdp->rx_skbuff[entry] = skb; |
1473 | if (skb == NULL) | 1467 | if (skb == NULL) |
1474 | break; /* Better luck next round. */ | 1468 | break; /* Better luck next round. */ |
1475 | dma_map_single(&ndev->dev, skb->data, mdp->rx_buf_sz, | ||
1476 | DMA_FROM_DEVICE); | ||
1477 | sh_eth_set_receive_align(skb); | 1469 | sh_eth_set_receive_align(skb); |
1470 | dma_map_single(&ndev->dev, skb->data, | ||
1471 | rxdesc->buffer_length, DMA_FROM_DEVICE); | ||
1478 | 1472 | ||
1479 | skb_checksum_none_assert(skb); | 1473 | skb_checksum_none_assert(skb); |
1480 | rxdesc->addr = virt_to_phys(PTR_ALIGN(skb->data, 4)); | 1474 | rxdesc->addr = virt_to_phys(PTR_ALIGN(skb->data, 4)); |
@@ -2042,6 +2036,8 @@ static int sh_eth_open(struct net_device *ndev) | |||
2042 | if (ret) | 2036 | if (ret) |
2043 | goto out_free_irq; | 2037 | goto out_free_irq; |
2044 | 2038 | ||
2039 | mdp->is_opened = 1; | ||
2040 | |||
2045 | return ret; | 2041 | return ret; |
2046 | 2042 | ||
2047 | out_free_irq: | 2043 | out_free_irq: |
@@ -2131,6 +2127,36 @@ static int sh_eth_start_xmit(struct sk_buff *skb, struct net_device *ndev) | |||
2131 | return NETDEV_TX_OK; | 2127 | return NETDEV_TX_OK; |
2132 | } | 2128 | } |
2133 | 2129 | ||
2130 | static struct net_device_stats *sh_eth_get_stats(struct net_device *ndev) | ||
2131 | { | ||
2132 | struct sh_eth_private *mdp = netdev_priv(ndev); | ||
2133 | |||
2134 | if (sh_eth_is_rz_fast_ether(mdp)) | ||
2135 | return &ndev->stats; | ||
2136 | |||
2137 | if (!mdp->is_opened) | ||
2138 | return &ndev->stats; | ||
2139 | |||
2140 | ndev->stats.tx_dropped += sh_eth_read(ndev, TROCR); | ||
2141 | sh_eth_write(ndev, 0, TROCR); /* (write clear) */ | ||
2142 | ndev->stats.collisions += sh_eth_read(ndev, CDCR); | ||
2143 | sh_eth_write(ndev, 0, CDCR); /* (write clear) */ | ||
2144 | ndev->stats.tx_carrier_errors += sh_eth_read(ndev, LCCR); | ||
2145 | sh_eth_write(ndev, 0, LCCR); /* (write clear) */ | ||
2146 | |||
2147 | if (sh_eth_is_gether(mdp)) { | ||
2148 | ndev->stats.tx_carrier_errors += sh_eth_read(ndev, CERCR); | ||
2149 | sh_eth_write(ndev, 0, CERCR); /* (write clear) */ | ||
2150 | ndev->stats.tx_carrier_errors += sh_eth_read(ndev, CEECR); | ||
2151 | sh_eth_write(ndev, 0, CEECR); /* (write clear) */ | ||
2152 | } else { | ||
2153 | ndev->stats.tx_carrier_errors += sh_eth_read(ndev, CNDCR); | ||
2154 | sh_eth_write(ndev, 0, CNDCR); /* (write clear) */ | ||
2155 | } | ||
2156 | |||
2157 | return &ndev->stats; | ||
2158 | } | ||
2159 | |||
2134 | /* device close function */ | 2160 | /* device close function */ |
2135 | static int sh_eth_close(struct net_device *ndev) | 2161 | static int sh_eth_close(struct net_device *ndev) |
2136 | { | 2162 | { |
@@ -2145,6 +2171,7 @@ static int sh_eth_close(struct net_device *ndev) | |||
2145 | sh_eth_write(ndev, 0, EDTRR); | 2171 | sh_eth_write(ndev, 0, EDTRR); |
2146 | sh_eth_write(ndev, 0, EDRRR); | 2172 | sh_eth_write(ndev, 0, EDRRR); |
2147 | 2173 | ||
2174 | sh_eth_get_stats(ndev); | ||
2148 | /* PHY Disconnect */ | 2175 | /* PHY Disconnect */ |
2149 | if (mdp->phydev) { | 2176 | if (mdp->phydev) { |
2150 | phy_stop(mdp->phydev); | 2177 | phy_stop(mdp->phydev); |
@@ -2163,36 +2190,9 @@ static int sh_eth_close(struct net_device *ndev) | |||
2163 | 2190 | ||
2164 | pm_runtime_put_sync(&mdp->pdev->dev); | 2191 | pm_runtime_put_sync(&mdp->pdev->dev); |
2165 | 2192 | ||
2166 | return 0; | 2193 | mdp->is_opened = 0; |
2167 | } | ||
2168 | |||
2169 | static struct net_device_stats *sh_eth_get_stats(struct net_device *ndev) | ||
2170 | { | ||
2171 | struct sh_eth_private *mdp = netdev_priv(ndev); | ||
2172 | |||
2173 | if (sh_eth_is_rz_fast_ether(mdp)) | ||
2174 | return &ndev->stats; | ||
2175 | 2194 | ||
2176 | pm_runtime_get_sync(&mdp->pdev->dev); | 2195 | return 0; |
2177 | |||
2178 | ndev->stats.tx_dropped += sh_eth_read(ndev, TROCR); | ||
2179 | sh_eth_write(ndev, 0, TROCR); /* (write clear) */ | ||
2180 | ndev->stats.collisions += sh_eth_read(ndev, CDCR); | ||
2181 | sh_eth_write(ndev, 0, CDCR); /* (write clear) */ | ||
2182 | ndev->stats.tx_carrier_errors += sh_eth_read(ndev, LCCR); | ||
2183 | sh_eth_write(ndev, 0, LCCR); /* (write clear) */ | ||
2184 | if (sh_eth_is_gether(mdp)) { | ||
2185 | ndev->stats.tx_carrier_errors += sh_eth_read(ndev, CERCR); | ||
2186 | sh_eth_write(ndev, 0, CERCR); /* (write clear) */ | ||
2187 | ndev->stats.tx_carrier_errors += sh_eth_read(ndev, CEECR); | ||
2188 | sh_eth_write(ndev, 0, CEECR); /* (write clear) */ | ||
2189 | } else { | ||
2190 | ndev->stats.tx_carrier_errors += sh_eth_read(ndev, CNDCR); | ||
2191 | sh_eth_write(ndev, 0, CNDCR); /* (write clear) */ | ||
2192 | } | ||
2193 | pm_runtime_put_sync(&mdp->pdev->dev); | ||
2194 | |||
2195 | return &ndev->stats; | ||
2196 | } | 2196 | } |
2197 | 2197 | ||
2198 | /* ioctl to device function */ | 2198 | /* ioctl to device function */ |
diff --git a/drivers/net/ethernet/renesas/sh_eth.h b/drivers/net/ethernet/renesas/sh_eth.h index b37c427144ee..22301bf9c21d 100644 --- a/drivers/net/ethernet/renesas/sh_eth.h +++ b/drivers/net/ethernet/renesas/sh_eth.h | |||
@@ -162,9 +162,9 @@ enum { | |||
162 | 162 | ||
163 | /* Driver's parameters */ | 163 | /* Driver's parameters */ |
164 | #if defined(CONFIG_CPU_SH4) || defined(CONFIG_ARCH_SHMOBILE) | 164 | #if defined(CONFIG_CPU_SH4) || defined(CONFIG_ARCH_SHMOBILE) |
165 | #define SH4_SKB_RX_ALIGN 32 | 165 | #define SH_ETH_RX_ALIGN 32 |
166 | #else | 166 | #else |
167 | #define SH2_SH3_SKB_RX_ALIGN 2 | 167 | #define SH_ETH_RX_ALIGN 2 |
168 | #endif | 168 | #endif |
169 | 169 | ||
170 | /* Register's bits | 170 | /* Register's bits |
@@ -522,6 +522,7 @@ struct sh_eth_private { | |||
522 | 522 | ||
523 | unsigned no_ether_link:1; | 523 | unsigned no_ether_link:1; |
524 | unsigned ether_link_active_low:1; | 524 | unsigned ether_link_active_low:1; |
525 | unsigned is_opened:1; | ||
525 | }; | 526 | }; |
526 | 527 | ||
527 | static inline void sh_eth_soft_swap(char *src, int len) | 528 | static inline void sh_eth_soft_swap(char *src, int len) |
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c index db56fa7ce8f9..58a1a0a423d4 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c | |||
@@ -177,12 +177,6 @@ static int stmmac_probe_config_dt(struct platform_device *pdev, | |||
177 | */ | 177 | */ |
178 | plat->maxmtu = JUMBO_LEN; | 178 | plat->maxmtu = JUMBO_LEN; |
179 | 179 | ||
180 | /* Set default value for multicast hash bins */ | ||
181 | plat->multicast_filter_bins = HASH_TABLE_SIZE; | ||
182 | |||
183 | /* Set default value for unicast filter entries */ | ||
184 | plat->unicast_filter_entries = 1; | ||
185 | |||
186 | /* | 180 | /* |
187 | * Currently only the properties needed on SPEAr600 | 181 | * Currently only the properties needed on SPEAr600 |
188 | * are provided. All other properties should be added | 182 | * are provided. All other properties should be added |
@@ -270,16 +264,23 @@ static int stmmac_pltfr_probe(struct platform_device *pdev) | |||
270 | return PTR_ERR(addr); | 264 | return PTR_ERR(addr); |
271 | 265 | ||
272 | plat_dat = dev_get_platdata(&pdev->dev); | 266 | plat_dat = dev_get_platdata(&pdev->dev); |
273 | if (pdev->dev.of_node) { | 267 | |
274 | if (!plat_dat) | 268 | if (!plat_dat) |
275 | plat_dat = devm_kzalloc(&pdev->dev, | 269 | plat_dat = devm_kzalloc(&pdev->dev, |
276 | sizeof(struct plat_stmmacenet_data), | 270 | sizeof(struct plat_stmmacenet_data), |
277 | GFP_KERNEL); | 271 | GFP_KERNEL); |
278 | if (!plat_dat) { | 272 | if (!plat_dat) { |
279 | pr_err("%s: ERROR: no memory", __func__); | 273 | pr_err("%s: ERROR: no memory", __func__); |
280 | return -ENOMEM; | 274 | return -ENOMEM; |
281 | } | 275 | } |
276 | |||
277 | /* Set default value for multicast hash bins */ | ||
278 | plat_dat->multicast_filter_bins = HASH_TABLE_SIZE; | ||
282 | 279 | ||
280 | /* Set default value for unicast filter entries */ | ||
281 | plat_dat->unicast_filter_entries = 1; | ||
282 | |||
283 | if (pdev->dev.of_node) { | ||
283 | ret = stmmac_probe_config_dt(pdev, plat_dat, &mac); | 284 | ret = stmmac_probe_config_dt(pdev, plat_dat, &mac); |
284 | if (ret) { | 285 | if (ret) { |
285 | pr_err("%s: main dt probe failed", __func__); | 286 | pr_err("%s: main dt probe failed", __func__); |
diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c index d8794488f80a..c560f9aeb55d 100644 --- a/drivers/net/ethernet/ti/cpsw.c +++ b/drivers/net/ethernet/ti/cpsw.c | |||
@@ -129,9 +129,9 @@ do { \ | |||
129 | #define CPSW_VLAN_AWARE BIT(1) | 129 | #define CPSW_VLAN_AWARE BIT(1) |
130 | #define CPSW_ALE_VLAN_AWARE 1 | 130 | #define CPSW_ALE_VLAN_AWARE 1 |
131 | 131 | ||
132 | #define CPSW_FIFO_NORMAL_MODE (0 << 15) | 132 | #define CPSW_FIFO_NORMAL_MODE (0 << 16) |
133 | #define CPSW_FIFO_DUAL_MAC_MODE (1 << 15) | 133 | #define CPSW_FIFO_DUAL_MAC_MODE (1 << 16) |
134 | #define CPSW_FIFO_RATE_LIMIT_MODE (2 << 15) | 134 | #define CPSW_FIFO_RATE_LIMIT_MODE (2 << 16) |
135 | 135 | ||
136 | #define CPSW_INTPACEEN (0x3f << 16) | 136 | #define CPSW_INTPACEEN (0x3f << 16) |
137 | #define CPSW_INTPRESCALE_MASK (0x7FF << 0) | 137 | #define CPSW_INTPRESCALE_MASK (0x7FF << 0) |
diff --git a/drivers/net/ieee802154/fakehard.c b/drivers/net/ieee802154/fakehard.c index 9ce854f43917..6cbc56ad9ff4 100644 --- a/drivers/net/ieee802154/fakehard.c +++ b/drivers/net/ieee802154/fakehard.c | |||
@@ -377,17 +377,20 @@ static int ieee802154fake_probe(struct platform_device *pdev) | |||
377 | 377 | ||
378 | err = wpan_phy_register(phy); | 378 | err = wpan_phy_register(phy); |
379 | if (err) | 379 | if (err) |
380 | goto out; | 380 | goto err_phy_reg; |
381 | 381 | ||
382 | err = register_netdev(dev); | 382 | err = register_netdev(dev); |
383 | if (err < 0) | 383 | if (err) |
384 | goto out; | 384 | goto err_netdev_reg; |
385 | 385 | ||
386 | dev_info(&pdev->dev, "Added ieee802154 HardMAC hardware\n"); | 386 | dev_info(&pdev->dev, "Added ieee802154 HardMAC hardware\n"); |
387 | return 0; | 387 | return 0; |
388 | 388 | ||
389 | out: | 389 | err_netdev_reg: |
390 | unregister_netdev(dev); | 390 | wpan_phy_unregister(phy); |
391 | err_phy_reg: | ||
392 | free_netdev(dev); | ||
393 | wpan_phy_free(phy); | ||
391 | return err; | 394 | return err; |
392 | } | 395 | } |
393 | 396 | ||
diff --git a/drivers/net/ppp/pptp.c b/drivers/net/ppp/pptp.c index 1aff970be33e..1dc628ffce2b 100644 --- a/drivers/net/ppp/pptp.c +++ b/drivers/net/ppp/pptp.c | |||
@@ -506,7 +506,9 @@ static int pptp_getname(struct socket *sock, struct sockaddr *uaddr, | |||
506 | int len = sizeof(struct sockaddr_pppox); | 506 | int len = sizeof(struct sockaddr_pppox); |
507 | struct sockaddr_pppox sp; | 507 | struct sockaddr_pppox sp; |
508 | 508 | ||
509 | sp.sa_family = AF_PPPOX; | 509 | memset(&sp.sa_addr, 0, sizeof(sp.sa_addr)); |
510 | |||
511 | sp.sa_family = AF_PPPOX; | ||
510 | sp.sa_protocol = PX_PROTO_PPTP; | 512 | sp.sa_protocol = PX_PROTO_PPTP; |
511 | sp.sa_addr.pptp = pppox_sk(sock->sk)->proto.pptp.src_addr; | 513 | sp.sa_addr.pptp = pppox_sk(sock->sk)->proto.pptp.src_addr; |
512 | 514 | ||
diff --git a/drivers/net/usb/qmi_wwan.c b/drivers/net/usb/qmi_wwan.c index 22756db53dca..b8a82b86f909 100644 --- a/drivers/net/usb/qmi_wwan.c +++ b/drivers/net/usb/qmi_wwan.c | |||
@@ -780,6 +780,7 @@ static const struct usb_device_id products[] = { | |||
780 | {QMI_FIXED_INTF(0x413c, 0x81a4, 8)}, /* Dell Wireless 5570e HSPA+ (42Mbps) Mobile Broadband Card */ | 780 | {QMI_FIXED_INTF(0x413c, 0x81a4, 8)}, /* Dell Wireless 5570e HSPA+ (42Mbps) Mobile Broadband Card */ |
781 | {QMI_FIXED_INTF(0x413c, 0x81a8, 8)}, /* Dell Wireless 5808 Gobi(TM) 4G LTE Mobile Broadband Card */ | 781 | {QMI_FIXED_INTF(0x413c, 0x81a8, 8)}, /* Dell Wireless 5808 Gobi(TM) 4G LTE Mobile Broadband Card */ |
782 | {QMI_FIXED_INTF(0x413c, 0x81a9, 8)}, /* Dell Wireless 5808e Gobi(TM) 4G LTE Mobile Broadband Card */ | 782 | {QMI_FIXED_INTF(0x413c, 0x81a9, 8)}, /* Dell Wireless 5808e Gobi(TM) 4G LTE Mobile Broadband Card */ |
783 | {QMI_FIXED_INTF(0x03f0, 0x581d, 4)}, /* HP lt4112 LTE/HSPA+ Gobi 4G Module (Huawei me906e) */ | ||
783 | 784 | ||
784 | /* 4. Gobi 1000 devices */ | 785 | /* 4. Gobi 1000 devices */ |
785 | {QMI_GOBI1K_DEVICE(0x05c6, 0x9212)}, /* Acer Gobi Modem Device */ | 786 | {QMI_GOBI1K_DEVICE(0x05c6, 0x9212)}, /* Acer Gobi Modem Device */ |
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index ec2a8b41ed41..b0bc8ead47de 100644 --- a/drivers/net/virtio_net.c +++ b/drivers/net/virtio_net.c | |||
@@ -1673,6 +1673,40 @@ static const struct attribute_group virtio_net_mrg_rx_group = { | |||
1673 | }; | 1673 | }; |
1674 | #endif | 1674 | #endif |
1675 | 1675 | ||
1676 | static bool virtnet_fail_on_feature(struct virtio_device *vdev, | ||
1677 | unsigned int fbit, | ||
1678 | const char *fname, const char *dname) | ||
1679 | { | ||
1680 | if (!virtio_has_feature(vdev, fbit)) | ||
1681 | return false; | ||
1682 | |||
1683 | dev_err(&vdev->dev, "device advertises feature %s but not %s", | ||
1684 | fname, dname); | ||
1685 | |||
1686 | return true; | ||
1687 | } | ||
1688 | |||
1689 | #define VIRTNET_FAIL_ON(vdev, fbit, dbit) \ | ||
1690 | virtnet_fail_on_feature(vdev, fbit, #fbit, dbit) | ||
1691 | |||
1692 | static bool virtnet_validate_features(struct virtio_device *vdev) | ||
1693 | { | ||
1694 | if (!virtio_has_feature(vdev, VIRTIO_NET_F_CTRL_VQ) && | ||
1695 | (VIRTNET_FAIL_ON(vdev, VIRTIO_NET_F_CTRL_RX, | ||
1696 | "VIRTIO_NET_F_CTRL_VQ") || | ||
1697 | VIRTNET_FAIL_ON(vdev, VIRTIO_NET_F_CTRL_VLAN, | ||
1698 | "VIRTIO_NET_F_CTRL_VQ") || | ||
1699 | VIRTNET_FAIL_ON(vdev, VIRTIO_NET_F_GUEST_ANNOUNCE, | ||
1700 | "VIRTIO_NET_F_CTRL_VQ") || | ||
1701 | VIRTNET_FAIL_ON(vdev, VIRTIO_NET_F_MQ, "VIRTIO_NET_F_CTRL_VQ") || | ||
1702 | VIRTNET_FAIL_ON(vdev, VIRTIO_NET_F_CTRL_MAC_ADDR, | ||
1703 | "VIRTIO_NET_F_CTRL_VQ"))) { | ||
1704 | return false; | ||
1705 | } | ||
1706 | |||
1707 | return true; | ||
1708 | } | ||
1709 | |||
1676 | static int virtnet_probe(struct virtio_device *vdev) | 1710 | static int virtnet_probe(struct virtio_device *vdev) |
1677 | { | 1711 | { |
1678 | int i, err; | 1712 | int i, err; |
@@ -1680,6 +1714,9 @@ static int virtnet_probe(struct virtio_device *vdev) | |||
1680 | struct virtnet_info *vi; | 1714 | struct virtnet_info *vi; |
1681 | u16 max_queue_pairs; | 1715 | u16 max_queue_pairs; |
1682 | 1716 | ||
1717 | if (!virtnet_validate_features(vdev)) | ||
1718 | return -EINVAL; | ||
1719 | |||
1683 | /* Find if host supports multiqueue virtio_net device */ | 1720 | /* Find if host supports multiqueue virtio_net device */ |
1684 | err = virtio_cread_feature(vdev, VIRTIO_NET_F_MQ, | 1721 | err = virtio_cread_feature(vdev, VIRTIO_NET_F_MQ, |
1685 | struct virtio_net_config, | 1722 | struct virtio_net_config, |
diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c index fa9dc45b75a6..be4649a49c5e 100644 --- a/drivers/net/vxlan.c +++ b/drivers/net/vxlan.c | |||
@@ -67,12 +67,6 @@ | |||
67 | 67 | ||
68 | #define VXLAN_FLAGS 0x08000000 /* struct vxlanhdr.vx_flags required value. */ | 68 | #define VXLAN_FLAGS 0x08000000 /* struct vxlanhdr.vx_flags required value. */ |
69 | 69 | ||
70 | /* VXLAN protocol header */ | ||
71 | struct vxlanhdr { | ||
72 | __be32 vx_flags; | ||
73 | __be32 vx_vni; | ||
74 | }; | ||
75 | |||
76 | /* UDP port for VXLAN traffic. | 70 | /* UDP port for VXLAN traffic. |
77 | * The IANA assigned port is 4789, but the Linux default is 8472 | 71 | * The IANA assigned port is 4789, but the Linux default is 8472 |
78 | * for compatibility with early adopters. | 72 | * for compatibility with early adopters. |
@@ -2312,9 +2306,9 @@ static struct socket *vxlan_create_sock(struct net *net, bool ipv6, | |||
2312 | if (ipv6) { | 2306 | if (ipv6) { |
2313 | udp_conf.family = AF_INET6; | 2307 | udp_conf.family = AF_INET6; |
2314 | udp_conf.use_udp6_tx_checksums = | 2308 | udp_conf.use_udp6_tx_checksums = |
2315 | !!(flags & VXLAN_F_UDP_ZERO_CSUM6_TX); | 2309 | !(flags & VXLAN_F_UDP_ZERO_CSUM6_TX); |
2316 | udp_conf.use_udp6_rx_checksums = | 2310 | udp_conf.use_udp6_rx_checksums = |
2317 | !!(flags & VXLAN_F_UDP_ZERO_CSUM6_RX); | 2311 | !(flags & VXLAN_F_UDP_ZERO_CSUM6_RX); |
2318 | } else { | 2312 | } else { |
2319 | udp_conf.family = AF_INET; | 2313 | udp_conf.family = AF_INET; |
2320 | udp_conf.local_ip.s_addr = INADDR_ANY; | 2314 | udp_conf.local_ip.s_addr = INADDR_ANY; |
diff --git a/drivers/net/wireless/ath/ath9k/ar9003_phy.c b/drivers/net/wireless/ath/ath9k/ar9003_phy.c index 697c4ae90af0..1e8ea5e4d4ca 100644 --- a/drivers/net/wireless/ath/ath9k/ar9003_phy.c +++ b/drivers/net/wireless/ath/ath9k/ar9003_phy.c | |||
@@ -664,6 +664,19 @@ static void ar9003_hw_override_ini(struct ath_hw *ah) | |||
664 | ah->enabled_cals |= TX_CL_CAL; | 664 | ah->enabled_cals |= TX_CL_CAL; |
665 | else | 665 | else |
666 | ah->enabled_cals &= ~TX_CL_CAL; | 666 | ah->enabled_cals &= ~TX_CL_CAL; |
667 | |||
668 | if (AR_SREV_9340(ah) || AR_SREV_9531(ah) || AR_SREV_9550(ah)) { | ||
669 | if (ah->is_clk_25mhz) { | ||
670 | REG_WRITE(ah, AR_RTC_DERIVED_CLK, 0x17c << 1); | ||
671 | REG_WRITE(ah, AR_SLP32_MODE, 0x0010f3d7); | ||
672 | REG_WRITE(ah, AR_SLP32_INC, 0x0001e7ae); | ||
673 | } else { | ||
674 | REG_WRITE(ah, AR_RTC_DERIVED_CLK, 0x261 << 1); | ||
675 | REG_WRITE(ah, AR_SLP32_MODE, 0x0010f400); | ||
676 | REG_WRITE(ah, AR_SLP32_INC, 0x0001e800); | ||
677 | } | ||
678 | udelay(100); | ||
679 | } | ||
667 | } | 680 | } |
668 | 681 | ||
669 | static void ar9003_hw_prog_ini(struct ath_hw *ah, | 682 | static void ar9003_hw_prog_ini(struct ath_hw *ah, |
diff --git a/drivers/net/wireless/ath/ath9k/hw.c b/drivers/net/wireless/ath/ath9k/hw.c index 8be4b1453394..2ad605760e21 100644 --- a/drivers/net/wireless/ath/ath9k/hw.c +++ b/drivers/net/wireless/ath/ath9k/hw.c | |||
@@ -861,19 +861,6 @@ static void ath9k_hw_init_pll(struct ath_hw *ah, | |||
861 | udelay(RTC_PLL_SETTLE_DELAY); | 861 | udelay(RTC_PLL_SETTLE_DELAY); |
862 | 862 | ||
863 | REG_WRITE(ah, AR_RTC_SLEEP_CLK, AR_RTC_FORCE_DERIVED_CLK); | 863 | REG_WRITE(ah, AR_RTC_SLEEP_CLK, AR_RTC_FORCE_DERIVED_CLK); |
864 | |||
865 | if (AR_SREV_9340(ah) || AR_SREV_9550(ah)) { | ||
866 | if (ah->is_clk_25mhz) { | ||
867 | REG_WRITE(ah, AR_RTC_DERIVED_CLK, 0x17c << 1); | ||
868 | REG_WRITE(ah, AR_SLP32_MODE, 0x0010f3d7); | ||
869 | REG_WRITE(ah, AR_SLP32_INC, 0x0001e7ae); | ||
870 | } else { | ||
871 | REG_WRITE(ah, AR_RTC_DERIVED_CLK, 0x261 << 1); | ||
872 | REG_WRITE(ah, AR_SLP32_MODE, 0x0010f400); | ||
873 | REG_WRITE(ah, AR_SLP32_INC, 0x0001e800); | ||
874 | } | ||
875 | udelay(100); | ||
876 | } | ||
877 | } | 864 | } |
878 | 865 | ||
879 | static void ath9k_hw_init_interrupt_masks(struct ath_hw *ah, | 866 | static void ath9k_hw_init_interrupt_masks(struct ath_hw *ah, |
diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c index 30c66dfcd7a0..4f18a6be0c7d 100644 --- a/drivers/net/wireless/ath/ath9k/main.c +++ b/drivers/net/wireless/ath/ath9k/main.c | |||
@@ -974,9 +974,8 @@ void ath9k_calculate_iter_data(struct ath_softc *sc, | |||
974 | struct ath_vif *avp; | 974 | struct ath_vif *avp; |
975 | 975 | ||
976 | /* | 976 | /* |
977 | * Pick the MAC address of the first interface as the new hardware | 977 | * The hardware will use primary station addr together with the |
978 | * MAC address. The hardware will use it together with the BSSID mask | 978 | * BSSID mask when matching addresses. |
979 | * when matching addresses. | ||
980 | */ | 979 | */ |
981 | memset(iter_data, 0, sizeof(*iter_data)); | 980 | memset(iter_data, 0, sizeof(*iter_data)); |
982 | memset(&iter_data->mask, 0xff, ETH_ALEN); | 981 | memset(&iter_data->mask, 0xff, ETH_ALEN); |
@@ -1205,6 +1204,8 @@ static int ath9k_add_interface(struct ieee80211_hw *hw, | |||
1205 | list_add_tail(&avp->list, &avp->chanctx->vifs); | 1204 | list_add_tail(&avp->list, &avp->chanctx->vifs); |
1206 | } | 1205 | } |
1207 | 1206 | ||
1207 | ath9k_calculate_summary_state(sc, avp->chanctx); | ||
1208 | |||
1208 | ath9k_assign_hw_queues(hw, vif); | 1209 | ath9k_assign_hw_queues(hw, vif); |
1209 | 1210 | ||
1210 | an->sc = sc; | 1211 | an->sc = sc; |
@@ -1274,6 +1275,8 @@ static void ath9k_remove_interface(struct ieee80211_hw *hw, | |||
1274 | 1275 | ||
1275 | ath_tx_node_cleanup(sc, &avp->mcast_node); | 1276 | ath_tx_node_cleanup(sc, &avp->mcast_node); |
1276 | 1277 | ||
1278 | ath9k_calculate_summary_state(sc, avp->chanctx); | ||
1279 | |||
1277 | mutex_unlock(&sc->mutex); | 1280 | mutex_unlock(&sc->mutex); |
1278 | } | 1281 | } |
1279 | 1282 | ||
diff --git a/drivers/net/wireless/b43/phy_common.c b/drivers/net/wireless/b43/phy_common.c index 1dfc682a8055..ee27b06074e1 100644 --- a/drivers/net/wireless/b43/phy_common.c +++ b/drivers/net/wireless/b43/phy_common.c | |||
@@ -300,9 +300,7 @@ void b43_phy_write(struct b43_wldev *dev, u16 reg, u16 value) | |||
300 | 300 | ||
301 | void b43_phy_copy(struct b43_wldev *dev, u16 destreg, u16 srcreg) | 301 | void b43_phy_copy(struct b43_wldev *dev, u16 destreg, u16 srcreg) |
302 | { | 302 | { |
303 | assert_mac_suspended(dev); | 303 | b43_phy_write(dev, destreg, b43_phy_read(dev, srcreg)); |
304 | dev->phy.ops->phy_write(dev, destreg, | ||
305 | dev->phy.ops->phy_read(dev, srcreg)); | ||
306 | } | 304 | } |
307 | 305 | ||
308 | void b43_phy_mask(struct b43_wldev *dev, u16 offset, u16 mask) | 306 | void b43_phy_mask(struct b43_wldev *dev, u16 offset, u16 mask) |
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/of.c b/drivers/net/wireless/brcm80211/brcmfmac/of.c index f05f5270fec1..927bffd5be64 100644 --- a/drivers/net/wireless/brcm80211/brcmfmac/of.c +++ b/drivers/net/wireless/brcm80211/brcmfmac/of.c | |||
@@ -40,8 +40,8 @@ void brcmf_of_probe(struct brcmf_sdio_dev *sdiodev) | |||
40 | return; | 40 | return; |
41 | 41 | ||
42 | irq = irq_of_parse_and_map(np, 0); | 42 | irq = irq_of_parse_and_map(np, 0); |
43 | if (irq < 0) { | 43 | if (!irq) { |
44 | brcmf_err("interrupt could not be mapped: err=%d\n", irq); | 44 | brcmf_err("interrupt could not be mapped\n"); |
45 | devm_kfree(dev, sdiodev->pdata); | 45 | devm_kfree(dev, sdiodev->pdata); |
46 | return; | 46 | return; |
47 | } | 47 | } |
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/pcie.c b/drivers/net/wireless/brcm80211/brcmfmac/pcie.c index 8c0632ec9f7a..16fef3382019 100644 --- a/drivers/net/wireless/brcm80211/brcmfmac/pcie.c +++ b/drivers/net/wireless/brcm80211/brcmfmac/pcie.c | |||
@@ -19,10 +19,10 @@ | |||
19 | #include <linux/pci.h> | 19 | #include <linux/pci.h> |
20 | #include <linux/vmalloc.h> | 20 | #include <linux/vmalloc.h> |
21 | #include <linux/delay.h> | 21 | #include <linux/delay.h> |
22 | #include <linux/unaligned/access_ok.h> | ||
23 | #include <linux/interrupt.h> | 22 | #include <linux/interrupt.h> |
24 | #include <linux/bcma/bcma.h> | 23 | #include <linux/bcma/bcma.h> |
25 | #include <linux/sched.h> | 24 | #include <linux/sched.h> |
25 | #include <asm/unaligned.h> | ||
26 | 26 | ||
27 | #include <soc.h> | 27 | #include <soc.h> |
28 | #include <chipcommon.h> | 28 | #include <chipcommon.h> |
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/usb.c b/drivers/net/wireless/brcm80211/brcmfmac/usb.c index dc135915470d..875d1142c8b0 100644 --- a/drivers/net/wireless/brcm80211/brcmfmac/usb.c +++ b/drivers/net/wireless/brcm80211/brcmfmac/usb.c | |||
@@ -669,10 +669,12 @@ static int brcmf_usb_dl_cmd(struct brcmf_usbdev_info *devinfo, u8 cmd, | |||
669 | goto finalize; | 669 | goto finalize; |
670 | } | 670 | } |
671 | 671 | ||
672 | if (!brcmf_usb_ioctl_resp_wait(devinfo)) | 672 | if (!brcmf_usb_ioctl_resp_wait(devinfo)) { |
673 | usb_kill_urb(devinfo->ctl_urb); | ||
673 | ret = -ETIMEDOUT; | 674 | ret = -ETIMEDOUT; |
674 | else | 675 | } else { |
675 | memcpy(buffer, tmpbuf, buflen); | 676 | memcpy(buffer, tmpbuf, buflen); |
677 | } | ||
676 | 678 | ||
677 | finalize: | 679 | finalize: |
678 | kfree(tmpbuf); | 680 | kfree(tmpbuf); |
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c b/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c index 28fa25b509db..39b45c038a93 100644 --- a/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c +++ b/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c | |||
@@ -299,6 +299,7 @@ static u16 chandef_to_chanspec(struct brcmu_d11inf *d11inf, | |||
299 | primary_offset = ch->center_freq1 - ch->chan->center_freq; | 299 | primary_offset = ch->center_freq1 - ch->chan->center_freq; |
300 | switch (ch->width) { | 300 | switch (ch->width) { |
301 | case NL80211_CHAN_WIDTH_20: | 301 | case NL80211_CHAN_WIDTH_20: |
302 | case NL80211_CHAN_WIDTH_20_NOHT: | ||
302 | ch_inf.bw = BRCMU_CHAN_BW_20; | 303 | ch_inf.bw = BRCMU_CHAN_BW_20; |
303 | WARN_ON(primary_offset != 0); | 304 | WARN_ON(primary_offset != 0); |
304 | break; | 305 | break; |
@@ -323,6 +324,10 @@ static u16 chandef_to_chanspec(struct brcmu_d11inf *d11inf, | |||
323 | ch_inf.sb = BRCMU_CHAN_SB_LU; | 324 | ch_inf.sb = BRCMU_CHAN_SB_LU; |
324 | } | 325 | } |
325 | break; | 326 | break; |
327 | case NL80211_CHAN_WIDTH_80P80: | ||
328 | case NL80211_CHAN_WIDTH_160: | ||
329 | case NL80211_CHAN_WIDTH_5: | ||
330 | case NL80211_CHAN_WIDTH_10: | ||
326 | default: | 331 | default: |
327 | WARN_ON_ONCE(1); | 332 | WARN_ON_ONCE(1); |
328 | } | 333 | } |
@@ -333,6 +338,7 @@ static u16 chandef_to_chanspec(struct brcmu_d11inf *d11inf, | |||
333 | case IEEE80211_BAND_5GHZ: | 338 | case IEEE80211_BAND_5GHZ: |
334 | ch_inf.band = BRCMU_CHAN_BAND_5G; | 339 | ch_inf.band = BRCMU_CHAN_BAND_5G; |
335 | break; | 340 | break; |
341 | case IEEE80211_BAND_60GHZ: | ||
336 | default: | 342 | default: |
337 | WARN_ON_ONCE(1); | 343 | WARN_ON_ONCE(1); |
338 | } | 344 | } |
diff --git a/drivers/net/wireless/iwlwifi/iwl-fw.h b/drivers/net/wireless/iwlwifi/iwl-fw.h index 4f6e66892acc..b894a84e8393 100644 --- a/drivers/net/wireless/iwlwifi/iwl-fw.h +++ b/drivers/net/wireless/iwlwifi/iwl-fw.h | |||
@@ -155,6 +155,7 @@ enum iwl_ucode_tlv_api { | |||
155 | * @IWL_UCODE_TLV_CAPA_QUIET_PERIOD_SUPPORT: supports Quiet Period requests | 155 | * @IWL_UCODE_TLV_CAPA_QUIET_PERIOD_SUPPORT: supports Quiet Period requests |
156 | * @IWL_UCODE_TLV_CAPA_DQA_SUPPORT: supports dynamic queue allocation (DQA), | 156 | * @IWL_UCODE_TLV_CAPA_DQA_SUPPORT: supports dynamic queue allocation (DQA), |
157 | * which also implies support for the scheduler configuration command | 157 | * which also implies support for the scheduler configuration command |
158 | * @IWL_UCODE_TLV_CAPA_HOTSPOT_SUPPORT: supports Hot Spot Command | ||
158 | */ | 159 | */ |
159 | enum iwl_ucode_tlv_capa { | 160 | enum iwl_ucode_tlv_capa { |
160 | IWL_UCODE_TLV_CAPA_D0I3_SUPPORT = BIT(0), | 161 | IWL_UCODE_TLV_CAPA_D0I3_SUPPORT = BIT(0), |
@@ -163,6 +164,7 @@ enum iwl_ucode_tlv_capa { | |||
163 | IWL_UCODE_TLV_CAPA_WFA_TPC_REP_IE_SUPPORT = BIT(10), | 164 | IWL_UCODE_TLV_CAPA_WFA_TPC_REP_IE_SUPPORT = BIT(10), |
164 | IWL_UCODE_TLV_CAPA_QUIET_PERIOD_SUPPORT = BIT(11), | 165 | IWL_UCODE_TLV_CAPA_QUIET_PERIOD_SUPPORT = BIT(11), |
165 | IWL_UCODE_TLV_CAPA_DQA_SUPPORT = BIT(12), | 166 | IWL_UCODE_TLV_CAPA_DQA_SUPPORT = BIT(12), |
167 | IWL_UCODE_TLV_CAPA_HOTSPOT_SUPPORT = BIT(18), | ||
166 | }; | 168 | }; |
167 | 169 | ||
168 | /* The default calibrate table size if not specified by firmware file */ | 170 | /* The default calibrate table size if not specified by firmware file */ |
diff --git a/drivers/net/wireless/iwlwifi/mvm/mac80211.c b/drivers/net/wireless/iwlwifi/mvm/mac80211.c index b62405865b25..b6d2683da3a9 100644 --- a/drivers/net/wireless/iwlwifi/mvm/mac80211.c +++ b/drivers/net/wireless/iwlwifi/mvm/mac80211.c | |||
@@ -2448,9 +2448,15 @@ static int iwl_mvm_roc(struct ieee80211_hw *hw, | |||
2448 | 2448 | ||
2449 | switch (vif->type) { | 2449 | switch (vif->type) { |
2450 | case NL80211_IFTYPE_STATION: | 2450 | case NL80211_IFTYPE_STATION: |
2451 | /* Use aux roc framework (HS20) */ | 2451 | if (mvm->fw->ucode_capa.capa[0] & |
2452 | ret = iwl_mvm_send_aux_roc_cmd(mvm, channel, | 2452 | IWL_UCODE_TLV_CAPA_HOTSPOT_SUPPORT) { |
2453 | vif, duration); | 2453 | /* Use aux roc framework (HS20) */ |
2454 | ret = iwl_mvm_send_aux_roc_cmd(mvm, channel, | ||
2455 | vif, duration); | ||
2456 | goto out_unlock; | ||
2457 | } | ||
2458 | IWL_ERR(mvm, "hotspot not supported\n"); | ||
2459 | ret = -EINVAL; | ||
2454 | goto out_unlock; | 2460 | goto out_unlock; |
2455 | case NL80211_IFTYPE_P2P_DEVICE: | 2461 | case NL80211_IFTYPE_P2P_DEVICE: |
2456 | /* handle below */ | 2462 | /* handle below */ |
diff --git a/drivers/net/wireless/iwlwifi/mvm/scan.c b/drivers/net/wireless/iwlwifi/mvm/scan.c index b280d5d87127..7554f7053830 100644 --- a/drivers/net/wireless/iwlwifi/mvm/scan.c +++ b/drivers/net/wireless/iwlwifi/mvm/scan.c | |||
@@ -602,16 +602,6 @@ static int iwl_mvm_cancel_regular_scan(struct iwl_mvm *mvm) | |||
602 | SCAN_COMPLETE_NOTIFICATION }; | 602 | SCAN_COMPLETE_NOTIFICATION }; |
603 | int ret; | 603 | int ret; |
604 | 604 | ||
605 | if (mvm->scan_status == IWL_MVM_SCAN_NONE) | ||
606 | return 0; | ||
607 | |||
608 | if (iwl_mvm_is_radio_killed(mvm)) { | ||
609 | ieee80211_scan_completed(mvm->hw, true); | ||
610 | iwl_mvm_unref(mvm, IWL_MVM_REF_SCAN); | ||
611 | mvm->scan_status = IWL_MVM_SCAN_NONE; | ||
612 | return 0; | ||
613 | } | ||
614 | |||
615 | iwl_init_notification_wait(&mvm->notif_wait, &wait_scan_abort, | 605 | iwl_init_notification_wait(&mvm->notif_wait, &wait_scan_abort, |
616 | scan_abort_notif, | 606 | scan_abort_notif, |
617 | ARRAY_SIZE(scan_abort_notif), | 607 | ARRAY_SIZE(scan_abort_notif), |
@@ -1400,6 +1390,16 @@ int iwl_mvm_unified_sched_scan_lmac(struct iwl_mvm *mvm, | |||
1400 | 1390 | ||
1401 | int iwl_mvm_cancel_scan(struct iwl_mvm *mvm) | 1391 | int iwl_mvm_cancel_scan(struct iwl_mvm *mvm) |
1402 | { | 1392 | { |
1393 | if (mvm->scan_status == IWL_MVM_SCAN_NONE) | ||
1394 | return 0; | ||
1395 | |||
1396 | if (iwl_mvm_is_radio_killed(mvm)) { | ||
1397 | ieee80211_scan_completed(mvm->hw, true); | ||
1398 | iwl_mvm_unref(mvm, IWL_MVM_REF_SCAN); | ||
1399 | mvm->scan_status = IWL_MVM_SCAN_NONE; | ||
1400 | return 0; | ||
1401 | } | ||
1402 | |||
1403 | if (mvm->fw->ucode_capa.api[0] & IWL_UCODE_TLV_API_LMAC_SCAN) | 1403 | if (mvm->fw->ucode_capa.api[0] & IWL_UCODE_TLV_API_LMAC_SCAN) |
1404 | return iwl_mvm_scan_offload_stop(mvm, true); | 1404 | return iwl_mvm_scan_offload_stop(mvm, true); |
1405 | return iwl_mvm_cancel_regular_scan(mvm); | 1405 | return iwl_mvm_cancel_regular_scan(mvm); |
diff --git a/drivers/net/wireless/iwlwifi/pcie/trans.c b/drivers/net/wireless/iwlwifi/pcie/trans.c index 160c3ebc48d0..dd2f3f8baa9d 100644 --- a/drivers/net/wireless/iwlwifi/pcie/trans.c +++ b/drivers/net/wireless/iwlwifi/pcie/trans.c | |||
@@ -1894,8 +1894,7 @@ static u32 iwl_trans_pcie_dump_prph(struct iwl_trans *trans, | |||
1894 | int reg; | 1894 | int reg; |
1895 | __le32 *val; | 1895 | __le32 *val; |
1896 | 1896 | ||
1897 | prph_len += sizeof(*data) + sizeof(*prph) + | 1897 | prph_len += sizeof(**data) + sizeof(*prph) + num_bytes_in_chunk; |
1898 | num_bytes_in_chunk; | ||
1899 | 1898 | ||
1900 | (*data)->type = cpu_to_le32(IWL_FW_ERROR_DUMP_PRPH); | 1899 | (*data)->type = cpu_to_le32(IWL_FW_ERROR_DUMP_PRPH); |
1901 | (*data)->len = cpu_to_le32(sizeof(*prph) + | 1900 | (*data)->len = cpu_to_le32(sizeof(*prph) + |
diff --git a/drivers/net/wireless/rt2x00/rt2x00queue.c b/drivers/net/wireless/rt2x00/rt2x00queue.c index 8e68f87ab13c..66ff36447b94 100644 --- a/drivers/net/wireless/rt2x00/rt2x00queue.c +++ b/drivers/net/wireless/rt2x00/rt2x00queue.c | |||
@@ -158,55 +158,29 @@ void rt2x00queue_align_frame(struct sk_buff *skb) | |||
158 | skb_trim(skb, frame_length); | 158 | skb_trim(skb, frame_length); |
159 | } | 159 | } |
160 | 160 | ||
161 | void rt2x00queue_insert_l2pad(struct sk_buff *skb, unsigned int header_length) | 161 | /* |
162 | * H/W needs L2 padding between the header and the paylod if header size | ||
163 | * is not 4 bytes aligned. | ||
164 | */ | ||
165 | void rt2x00queue_insert_l2pad(struct sk_buff *skb, unsigned int hdr_len) | ||
162 | { | 166 | { |
163 | unsigned int payload_length = skb->len - header_length; | 167 | unsigned int l2pad = (skb->len > hdr_len) ? L2PAD_SIZE(hdr_len) : 0; |
164 | unsigned int header_align = ALIGN_SIZE(skb, 0); | ||
165 | unsigned int payload_align = ALIGN_SIZE(skb, header_length); | ||
166 | unsigned int l2pad = payload_length ? L2PAD_SIZE(header_length) : 0; | ||
167 | 168 | ||
168 | /* | 169 | if (!l2pad) |
169 | * Adjust the header alignment if the payload needs to be moved more | ||
170 | * than the header. | ||
171 | */ | ||
172 | if (payload_align > header_align) | ||
173 | header_align += 4; | ||
174 | |||
175 | /* There is nothing to do if no alignment is needed */ | ||
176 | if (!header_align) | ||
177 | return; | 170 | return; |
178 | 171 | ||
179 | /* Reserve the amount of space needed in front of the frame */ | 172 | skb_push(skb, l2pad); |
180 | skb_push(skb, header_align); | 173 | memmove(skb->data, skb->data + l2pad, hdr_len); |
181 | |||
182 | /* | ||
183 | * Move the header. | ||
184 | */ | ||
185 | memmove(skb->data, skb->data + header_align, header_length); | ||
186 | |||
187 | /* Move the payload, if present and if required */ | ||
188 | if (payload_length && payload_align) | ||
189 | memmove(skb->data + header_length + l2pad, | ||
190 | skb->data + header_length + l2pad + payload_align, | ||
191 | payload_length); | ||
192 | |||
193 | /* Trim the skb to the correct size */ | ||
194 | skb_trim(skb, header_length + l2pad + payload_length); | ||
195 | } | 174 | } |
196 | 175 | ||
197 | void rt2x00queue_remove_l2pad(struct sk_buff *skb, unsigned int header_length) | 176 | void rt2x00queue_remove_l2pad(struct sk_buff *skb, unsigned int hdr_len) |
198 | { | 177 | { |
199 | /* | 178 | unsigned int l2pad = (skb->len > hdr_len) ? L2PAD_SIZE(hdr_len) : 0; |
200 | * L2 padding is only present if the skb contains more than just the | ||
201 | * IEEE 802.11 header. | ||
202 | */ | ||
203 | unsigned int l2pad = (skb->len > header_length) ? | ||
204 | L2PAD_SIZE(header_length) : 0; | ||
205 | 179 | ||
206 | if (!l2pad) | 180 | if (!l2pad) |
207 | return; | 181 | return; |
208 | 182 | ||
209 | memmove(skb->data + l2pad, skb->data, header_length); | 183 | memmove(skb->data + l2pad, skb->data, hdr_len); |
210 | skb_pull(skb, l2pad); | 184 | skb_pull(skb, l2pad); |
211 | } | 185 | } |
212 | 186 | ||
diff --git a/drivers/net/wireless/rtlwifi/pci.c b/drivers/net/wireless/rtlwifi/pci.c index 25daa8715219..846a2e6e34d8 100644 --- a/drivers/net/wireless/rtlwifi/pci.c +++ b/drivers/net/wireless/rtlwifi/pci.c | |||
@@ -842,7 +842,8 @@ static void _rtl_pci_rx_interrupt(struct ieee80211_hw *hw) | |||
842 | break; | 842 | break; |
843 | } | 843 | } |
844 | /* handle command packet here */ | 844 | /* handle command packet here */ |
845 | if (rtlpriv->cfg->ops->rx_command_packet(hw, stats, skb)) { | 845 | if (rtlpriv->cfg->ops->rx_command_packet && |
846 | rtlpriv->cfg->ops->rx_command_packet(hw, stats, skb)) { | ||
846 | dev_kfree_skb_any(skb); | 847 | dev_kfree_skb_any(skb); |
847 | goto end; | 848 | goto end; |
848 | } | 849 | } |
@@ -1127,9 +1128,14 @@ static void _rtl_pci_prepare_bcn_tasklet(struct ieee80211_hw *hw) | |||
1127 | 1128 | ||
1128 | __skb_queue_tail(&ring->queue, pskb); | 1129 | __skb_queue_tail(&ring->queue, pskb); |
1129 | 1130 | ||
1130 | rtlpriv->cfg->ops->set_desc(hw, (u8 *)pdesc, true, HW_DESC_OWN, | 1131 | if (rtlpriv->use_new_trx_flow) { |
1131 | &temp_one); | 1132 | temp_one = 4; |
1132 | 1133 | rtlpriv->cfg->ops->set_desc(hw, (u8 *)pbuffer_desc, true, | |
1134 | HW_DESC_OWN, (u8 *)&temp_one); | ||
1135 | } else { | ||
1136 | rtlpriv->cfg->ops->set_desc(hw, (u8 *)pdesc, true, HW_DESC_OWN, | ||
1137 | &temp_one); | ||
1138 | } | ||
1133 | return; | 1139 | return; |
1134 | } | 1140 | } |
1135 | 1141 | ||
@@ -1370,9 +1376,9 @@ static void _rtl_pci_free_tx_ring(struct ieee80211_hw *hw, | |||
1370 | ring->desc = NULL; | 1376 | ring->desc = NULL; |
1371 | if (rtlpriv->use_new_trx_flow) { | 1377 | if (rtlpriv->use_new_trx_flow) { |
1372 | pci_free_consistent(rtlpci->pdev, | 1378 | pci_free_consistent(rtlpci->pdev, |
1373 | sizeof(*ring->desc) * ring->entries, | 1379 | sizeof(*ring->buffer_desc) * ring->entries, |
1374 | ring->buffer_desc, ring->buffer_desc_dma); | 1380 | ring->buffer_desc, ring->buffer_desc_dma); |
1375 | ring->desc = NULL; | 1381 | ring->buffer_desc = NULL; |
1376 | } | 1382 | } |
1377 | } | 1383 | } |
1378 | 1384 | ||
@@ -1543,7 +1549,6 @@ int rtl_pci_reset_trx_ring(struct ieee80211_hw *hw) | |||
1543 | true, | 1549 | true, |
1544 | HW_DESC_TXBUFF_ADDR), | 1550 | HW_DESC_TXBUFF_ADDR), |
1545 | skb->len, PCI_DMA_TODEVICE); | 1551 | skb->len, PCI_DMA_TODEVICE); |
1546 | ring->idx = (ring->idx + 1) % ring->entries; | ||
1547 | kfree_skb(skb); | 1552 | kfree_skb(skb); |
1548 | ring->idx = (ring->idx + 1) % ring->entries; | 1553 | ring->idx = (ring->idx + 1) % ring->entries; |
1549 | } | 1554 | } |
@@ -2244,6 +2249,16 @@ int rtl_pci_probe(struct pci_dev *pdev, | |||
2244 | /*like read eeprom and so on */ | 2249 | /*like read eeprom and so on */ |
2245 | rtlpriv->cfg->ops->read_eeprom_info(hw); | 2250 | rtlpriv->cfg->ops->read_eeprom_info(hw); |
2246 | 2251 | ||
2252 | if (rtlpriv->cfg->ops->init_sw_vars(hw)) { | ||
2253 | RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, "Can't init_sw_vars\n"); | ||
2254 | err = -ENODEV; | ||
2255 | goto fail3; | ||
2256 | } | ||
2257 | rtlpriv->cfg->ops->init_sw_leds(hw); | ||
2258 | |||
2259 | /*aspm */ | ||
2260 | rtl_pci_init_aspm(hw); | ||
2261 | |||
2247 | /* Init mac80211 sw */ | 2262 | /* Init mac80211 sw */ |
2248 | err = rtl_init_core(hw); | 2263 | err = rtl_init_core(hw); |
2249 | if (err) { | 2264 | if (err) { |
@@ -2259,16 +2274,6 @@ int rtl_pci_probe(struct pci_dev *pdev, | |||
2259 | goto fail3; | 2274 | goto fail3; |
2260 | } | 2275 | } |
2261 | 2276 | ||
2262 | if (rtlpriv->cfg->ops->init_sw_vars(hw)) { | ||
2263 | RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, "Can't init_sw_vars\n"); | ||
2264 | err = -ENODEV; | ||
2265 | goto fail3; | ||
2266 | } | ||
2267 | rtlpriv->cfg->ops->init_sw_leds(hw); | ||
2268 | |||
2269 | /*aspm */ | ||
2270 | rtl_pci_init_aspm(hw); | ||
2271 | |||
2272 | err = ieee80211_register_hw(hw); | 2277 | err = ieee80211_register_hw(hw); |
2273 | if (err) { | 2278 | if (err) { |
2274 | RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, | 2279 | RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, |
diff --git a/drivers/net/wireless/rtlwifi/rtl8192se/hw.c b/drivers/net/wireless/rtlwifi/rtl8192se/hw.c index 00e067044c08..5761d5b49e39 100644 --- a/drivers/net/wireless/rtlwifi/rtl8192se/hw.c +++ b/drivers/net/wireless/rtlwifi/rtl8192se/hw.c | |||
@@ -1201,6 +1201,9 @@ static int _rtl92se_set_media_status(struct ieee80211_hw *hw, | |||
1201 | 1201 | ||
1202 | } | 1202 | } |
1203 | 1203 | ||
1204 | if (type != NL80211_IFTYPE_AP && | ||
1205 | rtlpriv->mac80211.link_state < MAC80211_LINKED) | ||
1206 | bt_msr = rtl_read_byte(rtlpriv, MSR) & ~MSR_LINK_MASK; | ||
1204 | rtl_write_byte(rtlpriv, (MSR), bt_msr); | 1207 | rtl_write_byte(rtlpriv, (MSR), bt_msr); |
1205 | 1208 | ||
1206 | temp = rtl_read_dword(rtlpriv, TCR); | 1209 | temp = rtl_read_dword(rtlpriv, TCR); |
@@ -1262,6 +1265,7 @@ void rtl92se_enable_interrupt(struct ieee80211_hw *hw) | |||
1262 | rtl_write_dword(rtlpriv, INTA_MASK, rtlpci->irq_mask[0]); | 1265 | rtl_write_dword(rtlpriv, INTA_MASK, rtlpci->irq_mask[0]); |
1263 | /* Support Bit 32-37(Assign as Bit 0-5) interrupt setting now */ | 1266 | /* Support Bit 32-37(Assign as Bit 0-5) interrupt setting now */ |
1264 | rtl_write_dword(rtlpriv, INTA_MASK + 4, rtlpci->irq_mask[1] & 0x3F); | 1267 | rtl_write_dword(rtlpriv, INTA_MASK + 4, rtlpci->irq_mask[1] & 0x3F); |
1268 | rtlpci->irq_enabled = true; | ||
1265 | } | 1269 | } |
1266 | 1270 | ||
1267 | void rtl92se_disable_interrupt(struct ieee80211_hw *hw) | 1271 | void rtl92se_disable_interrupt(struct ieee80211_hw *hw) |
@@ -1276,8 +1280,7 @@ void rtl92se_disable_interrupt(struct ieee80211_hw *hw) | |||
1276 | rtlpci = rtl_pcidev(rtl_pcipriv(hw)); | 1280 | rtlpci = rtl_pcidev(rtl_pcipriv(hw)); |
1277 | rtl_write_dword(rtlpriv, INTA_MASK, 0); | 1281 | rtl_write_dword(rtlpriv, INTA_MASK, 0); |
1278 | rtl_write_dword(rtlpriv, INTA_MASK + 4, 0); | 1282 | rtl_write_dword(rtlpriv, INTA_MASK + 4, 0); |
1279 | 1283 | rtlpci->irq_enabled = false; | |
1280 | synchronize_irq(rtlpci->pdev->irq); | ||
1281 | } | 1284 | } |
1282 | 1285 | ||
1283 | static u8 _rtl92s_set_sysclk(struct ieee80211_hw *hw, u8 data) | 1286 | static u8 _rtl92s_set_sysclk(struct ieee80211_hw *hw, u8 data) |
diff --git a/drivers/net/wireless/rtlwifi/rtl8192se/phy.c b/drivers/net/wireless/rtlwifi/rtl8192se/phy.c index 77c5b5f35244..4b4612fe2fdb 100644 --- a/drivers/net/wireless/rtlwifi/rtl8192se/phy.c +++ b/drivers/net/wireless/rtlwifi/rtl8192se/phy.c | |||
@@ -399,6 +399,8 @@ static bool _rtl92s_phy_sw_chnl_step_by_step(struct ieee80211_hw *hw, | |||
399 | case 2: | 399 | case 2: |
400 | currentcmd = &postcommoncmd[*step]; | 400 | currentcmd = &postcommoncmd[*step]; |
401 | break; | 401 | break; |
402 | default: | ||
403 | return true; | ||
402 | } | 404 | } |
403 | 405 | ||
404 | if (currentcmd->cmdid == CMDID_END) { | 406 | if (currentcmd->cmdid == CMDID_END) { |
diff --git a/drivers/net/wireless/rtlwifi/rtl8192se/sw.c b/drivers/net/wireless/rtlwifi/rtl8192se/sw.c index aadba29c167a..fb003868bdef 100644 --- a/drivers/net/wireless/rtlwifi/rtl8192se/sw.c +++ b/drivers/net/wireless/rtlwifi/rtl8192se/sw.c | |||
@@ -236,6 +236,19 @@ static void rtl92s_deinit_sw_vars(struct ieee80211_hw *hw) | |||
236 | } | 236 | } |
237 | } | 237 | } |
238 | 238 | ||
239 | static bool rtl92se_is_tx_desc_closed(struct ieee80211_hw *hw, u8 hw_queue, | ||
240 | u16 index) | ||
241 | { | ||
242 | struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); | ||
243 | struct rtl8192_tx_ring *ring = &rtlpci->tx_ring[hw_queue]; | ||
244 | u8 *entry = (u8 *)(&ring->desc[ring->idx]); | ||
245 | u8 own = (u8)rtl92se_get_desc(entry, true, HW_DESC_OWN); | ||
246 | |||
247 | if (own) | ||
248 | return false; | ||
249 | return true; | ||
250 | } | ||
251 | |||
239 | static struct rtl_hal_ops rtl8192se_hal_ops = { | 252 | static struct rtl_hal_ops rtl8192se_hal_ops = { |
240 | .init_sw_vars = rtl92s_init_sw_vars, | 253 | .init_sw_vars = rtl92s_init_sw_vars, |
241 | .deinit_sw_vars = rtl92s_deinit_sw_vars, | 254 | .deinit_sw_vars = rtl92s_deinit_sw_vars, |
@@ -269,6 +282,7 @@ static struct rtl_hal_ops rtl8192se_hal_ops = { | |||
269 | .led_control = rtl92se_led_control, | 282 | .led_control = rtl92se_led_control, |
270 | .set_desc = rtl92se_set_desc, | 283 | .set_desc = rtl92se_set_desc, |
271 | .get_desc = rtl92se_get_desc, | 284 | .get_desc = rtl92se_get_desc, |
285 | .is_tx_desc_closed = rtl92se_is_tx_desc_closed, | ||
272 | .tx_polling = rtl92se_tx_polling, | 286 | .tx_polling = rtl92se_tx_polling, |
273 | .enable_hw_sec = rtl92se_enable_hw_security_config, | 287 | .enable_hw_sec = rtl92se_enable_hw_security_config, |
274 | .set_key = rtl92se_set_key, | 288 | .set_key = rtl92se_set_key, |
@@ -306,6 +320,8 @@ static struct rtl_hal_cfg rtl92se_hal_cfg = { | |||
306 | .maps[MAC_RCR_ACRC32] = RCR_ACRC32, | 320 | .maps[MAC_RCR_ACRC32] = RCR_ACRC32, |
307 | .maps[MAC_RCR_ACF] = RCR_ACF, | 321 | .maps[MAC_RCR_ACF] = RCR_ACF, |
308 | .maps[MAC_RCR_AAP] = RCR_AAP, | 322 | .maps[MAC_RCR_AAP] = RCR_AAP, |
323 | .maps[MAC_HIMR] = INTA_MASK, | ||
324 | .maps[MAC_HIMRE] = INTA_MASK + 4, | ||
309 | 325 | ||
310 | .maps[EFUSE_TEST] = REG_EFUSE_TEST, | 326 | .maps[EFUSE_TEST] = REG_EFUSE_TEST, |
311 | .maps[EFUSE_CTRL] = REG_EFUSE_CTRL, | 327 | .maps[EFUSE_CTRL] = REG_EFUSE_CTRL, |
diff --git a/drivers/net/wireless/rtlwifi/rtl8821ae/hw.c b/drivers/net/wireless/rtlwifi/rtl8821ae/hw.c index 310d3163dc5b..8ec8200002c7 100644 --- a/drivers/net/wireless/rtlwifi/rtl8821ae/hw.c +++ b/drivers/net/wireless/rtlwifi/rtl8821ae/hw.c | |||
@@ -3672,8 +3672,9 @@ static void rtl8821ae_update_hal_rate_mask(struct ieee80211_hw *hw, | |||
3672 | mac->opmode == NL80211_IFTYPE_ADHOC) | 3672 | mac->opmode == NL80211_IFTYPE_ADHOC) |
3673 | macid = sta->aid + 1; | 3673 | macid = sta->aid + 1; |
3674 | if (wirelessmode == WIRELESS_MODE_N_5G || | 3674 | if (wirelessmode == WIRELESS_MODE_N_5G || |
3675 | wirelessmode == WIRELESS_MODE_AC_5G) | 3675 | wirelessmode == WIRELESS_MODE_AC_5G || |
3676 | ratr_bitmap = sta->supp_rates[NL80211_BAND_5GHZ]; | 3676 | wirelessmode == WIRELESS_MODE_A) |
3677 | ratr_bitmap = sta->supp_rates[NL80211_BAND_5GHZ] << 4; | ||
3677 | else | 3678 | else |
3678 | ratr_bitmap = sta->supp_rates[NL80211_BAND_2GHZ]; | 3679 | ratr_bitmap = sta->supp_rates[NL80211_BAND_2GHZ]; |
3679 | 3680 | ||
diff --git a/drivers/net/xen-netback/xenbus.c b/drivers/net/xen-netback/xenbus.c index 4e56a27f9689..fab0d4b42f58 100644 --- a/drivers/net/xen-netback/xenbus.c +++ b/drivers/net/xen-netback/xenbus.c | |||
@@ -39,7 +39,7 @@ struct backend_info { | |||
39 | static int connect_rings(struct backend_info *be, struct xenvif_queue *queue); | 39 | static int connect_rings(struct backend_info *be, struct xenvif_queue *queue); |
40 | static void connect(struct backend_info *be); | 40 | static void connect(struct backend_info *be); |
41 | static int read_xenbus_vif_flags(struct backend_info *be); | 41 | static int read_xenbus_vif_flags(struct backend_info *be); |
42 | static void backend_create_xenvif(struct backend_info *be); | 42 | static int backend_create_xenvif(struct backend_info *be); |
43 | static void unregister_hotplug_status_watch(struct backend_info *be); | 43 | static void unregister_hotplug_status_watch(struct backend_info *be); |
44 | static void set_backend_state(struct backend_info *be, | 44 | static void set_backend_state(struct backend_info *be, |
45 | enum xenbus_state state); | 45 | enum xenbus_state state); |
@@ -352,7 +352,9 @@ static int netback_probe(struct xenbus_device *dev, | |||
352 | be->state = XenbusStateInitWait; | 352 | be->state = XenbusStateInitWait; |
353 | 353 | ||
354 | /* This kicks hotplug scripts, so do it immediately. */ | 354 | /* This kicks hotplug scripts, so do it immediately. */ |
355 | backend_create_xenvif(be); | 355 | err = backend_create_xenvif(be); |
356 | if (err) | ||
357 | goto fail; | ||
356 | 358 | ||
357 | return 0; | 359 | return 0; |
358 | 360 | ||
@@ -397,19 +399,19 @@ static int netback_uevent(struct xenbus_device *xdev, | |||
397 | } | 399 | } |
398 | 400 | ||
399 | 401 | ||
400 | static void backend_create_xenvif(struct backend_info *be) | 402 | static int backend_create_xenvif(struct backend_info *be) |
401 | { | 403 | { |
402 | int err; | 404 | int err; |
403 | long handle; | 405 | long handle; |
404 | struct xenbus_device *dev = be->dev; | 406 | struct xenbus_device *dev = be->dev; |
405 | 407 | ||
406 | if (be->vif != NULL) | 408 | if (be->vif != NULL) |
407 | return; | 409 | return 0; |
408 | 410 | ||
409 | err = xenbus_scanf(XBT_NIL, dev->nodename, "handle", "%li", &handle); | 411 | err = xenbus_scanf(XBT_NIL, dev->nodename, "handle", "%li", &handle); |
410 | if (err != 1) { | 412 | if (err != 1) { |
411 | xenbus_dev_fatal(dev, err, "reading handle"); | 413 | xenbus_dev_fatal(dev, err, "reading handle"); |
412 | return; | 414 | return (err < 0) ? err : -EINVAL; |
413 | } | 415 | } |
414 | 416 | ||
415 | be->vif = xenvif_alloc(&dev->dev, dev->otherend_id, handle); | 417 | be->vif = xenvif_alloc(&dev->dev, dev->otherend_id, handle); |
@@ -417,10 +419,11 @@ static void backend_create_xenvif(struct backend_info *be) | |||
417 | err = PTR_ERR(be->vif); | 419 | err = PTR_ERR(be->vif); |
418 | be->vif = NULL; | 420 | be->vif = NULL; |
419 | xenbus_dev_fatal(dev, err, "creating interface"); | 421 | xenbus_dev_fatal(dev, err, "creating interface"); |
420 | return; | 422 | return err; |
421 | } | 423 | } |
422 | 424 | ||
423 | kobject_uevent(&dev->dev.kobj, KOBJ_ONLINE); | 425 | kobject_uevent(&dev->dev.kobj, KOBJ_ONLINE); |
426 | return 0; | ||
424 | } | 427 | } |
425 | 428 | ||
426 | static void backend_disconnect(struct backend_info *be) | 429 | static void backend_disconnect(struct backend_info *be) |
diff --git a/drivers/net/xen-netfront.c b/drivers/net/xen-netfront.c index cca871346a0f..ece8d1804d13 100644 --- a/drivers/net/xen-netfront.c +++ b/drivers/net/xen-netfront.c | |||
@@ -496,9 +496,6 @@ static void xennet_make_frags(struct sk_buff *skb, struct netfront_queue *queue, | |||
496 | len = skb_frag_size(frag); | 496 | len = skb_frag_size(frag); |
497 | offset = frag->page_offset; | 497 | offset = frag->page_offset; |
498 | 498 | ||
499 | /* Data must not cross a page boundary. */ | ||
500 | BUG_ON(len + offset > PAGE_SIZE<<compound_order(page)); | ||
501 | |||
502 | /* Skip unused frames from start of page */ | 499 | /* Skip unused frames from start of page */ |
503 | page += offset >> PAGE_SHIFT; | 500 | page += offset >> PAGE_SHIFT; |
504 | offset &= ~PAGE_MASK; | 501 | offset &= ~PAGE_MASK; |
@@ -506,8 +503,6 @@ static void xennet_make_frags(struct sk_buff *skb, struct netfront_queue *queue, | |||
506 | while (len > 0) { | 503 | while (len > 0) { |
507 | unsigned long bytes; | 504 | unsigned long bytes; |
508 | 505 | ||
509 | BUG_ON(offset >= PAGE_SIZE); | ||
510 | |||
511 | bytes = PAGE_SIZE - offset; | 506 | bytes = PAGE_SIZE - offset; |
512 | if (bytes > len) | 507 | if (bytes > len) |
513 | bytes = len; | 508 | bytes = len; |
diff --git a/drivers/of/address.c b/drivers/of/address.c index afdb78299f61..06af494184d6 100644 --- a/drivers/of/address.c +++ b/drivers/of/address.c | |||
@@ -450,6 +450,21 @@ static struct of_bus *of_match_bus(struct device_node *np) | |||
450 | return NULL; | 450 | return NULL; |
451 | } | 451 | } |
452 | 452 | ||
453 | static int of_empty_ranges_quirk(void) | ||
454 | { | ||
455 | if (IS_ENABLED(CONFIG_PPC)) { | ||
456 | /* To save cycles, we cache the result */ | ||
457 | static int quirk_state = -1; | ||
458 | |||
459 | if (quirk_state < 0) | ||
460 | quirk_state = | ||
461 | of_machine_is_compatible("Power Macintosh") || | ||
462 | of_machine_is_compatible("MacRISC"); | ||
463 | return quirk_state; | ||
464 | } | ||
465 | return false; | ||
466 | } | ||
467 | |||
453 | static int of_translate_one(struct device_node *parent, struct of_bus *bus, | 468 | static int of_translate_one(struct device_node *parent, struct of_bus *bus, |
454 | struct of_bus *pbus, __be32 *addr, | 469 | struct of_bus *pbus, __be32 *addr, |
455 | int na, int ns, int pna, const char *rprop) | 470 | int na, int ns, int pna, const char *rprop) |
@@ -475,12 +490,10 @@ static int of_translate_one(struct device_node *parent, struct of_bus *bus, | |||
475 | * This code is only enabled on powerpc. --gcl | 490 | * This code is only enabled on powerpc. --gcl |
476 | */ | 491 | */ |
477 | ranges = of_get_property(parent, rprop, &rlen); | 492 | ranges = of_get_property(parent, rprop, &rlen); |
478 | #if !defined(CONFIG_PPC) | 493 | if (ranges == NULL && !of_empty_ranges_quirk()) { |
479 | if (ranges == NULL) { | ||
480 | pr_err("OF: no ranges; cannot translate\n"); | 494 | pr_err("OF: no ranges; cannot translate\n"); |
481 | return 1; | 495 | return 1; |
482 | } | 496 | } |
483 | #endif /* !defined(CONFIG_PPC) */ | ||
484 | if (ranges == NULL || rlen == 0) { | 497 | if (ranges == NULL || rlen == 0) { |
485 | offset = of_read_number(addr, na); | 498 | offset = of_read_number(addr, na); |
486 | memset(addr, 0, pna * 4); | 499 | memset(addr, 0, pna * 4); |
diff --git a/drivers/of/base.c b/drivers/of/base.c index 3823edf2d012..4c2ccde42427 100644 --- a/drivers/of/base.c +++ b/drivers/of/base.c | |||
@@ -1250,6 +1250,39 @@ int of_property_read_u64(const struct device_node *np, const char *propname, | |||
1250 | EXPORT_SYMBOL_GPL(of_property_read_u64); | 1250 | EXPORT_SYMBOL_GPL(of_property_read_u64); |
1251 | 1251 | ||
1252 | /** | 1252 | /** |
1253 | * of_property_read_u64_array - Find and read an array of 64 bit integers | ||
1254 | * from a property. | ||
1255 | * | ||
1256 | * @np: device node from which the property value is to be read. | ||
1257 | * @propname: name of the property to be searched. | ||
1258 | * @out_values: pointer to return value, modified only if return value is 0. | ||
1259 | * @sz: number of array elements to read | ||
1260 | * | ||
1261 | * Search for a property in a device node and read 64-bit value(s) from | ||
1262 | * it. Returns 0 on success, -EINVAL if the property does not exist, | ||
1263 | * -ENODATA if property does not have a value, and -EOVERFLOW if the | ||
1264 | * property data isn't large enough. | ||
1265 | * | ||
1266 | * The out_values is modified only if a valid u64 value can be decoded. | ||
1267 | */ | ||
1268 | int of_property_read_u64_array(const struct device_node *np, | ||
1269 | const char *propname, u64 *out_values, | ||
1270 | size_t sz) | ||
1271 | { | ||
1272 | const __be32 *val = of_find_property_value_of_size(np, propname, | ||
1273 | (sz * sizeof(*out_values))); | ||
1274 | |||
1275 | if (IS_ERR(val)) | ||
1276 | return PTR_ERR(val); | ||
1277 | |||
1278 | while (sz--) { | ||
1279 | *out_values++ = of_read_number(val, 2); | ||
1280 | val += 2; | ||
1281 | } | ||
1282 | return 0; | ||
1283 | } | ||
1284 | |||
1285 | /** | ||
1253 | * of_property_read_string - Find and read a string from a property | 1286 | * of_property_read_string - Find and read a string from a property |
1254 | * @np: device node from which the property value is to be read. | 1287 | * @np: device node from which the property value is to be read. |
1255 | * @propname: name of the property to be searched. | 1288 | * @propname: name of the property to be searched. |
diff --git a/drivers/of/dynamic.c b/drivers/of/dynamic.c index f297891d8529..d4994177dec2 100644 --- a/drivers/of/dynamic.c +++ b/drivers/of/dynamic.c | |||
@@ -247,7 +247,7 @@ void of_node_release(struct kobject *kobj) | |||
247 | * @allocflags: Allocation flags (typically pass GFP_KERNEL) | 247 | * @allocflags: Allocation flags (typically pass GFP_KERNEL) |
248 | * | 248 | * |
249 | * Copy a property by dynamically allocating the memory of both the | 249 | * Copy a property by dynamically allocating the memory of both the |
250 | * property stucture and the property name & contents. The property's | 250 | * property structure and the property name & contents. The property's |
251 | * flags have the OF_DYNAMIC bit set so that we can differentiate between | 251 | * flags have the OF_DYNAMIC bit set so that we can differentiate between |
252 | * dynamically allocated properties and not. | 252 | * dynamically allocated properties and not. |
253 | * Returns the newly allocated property or NULL on out of memory error. | 253 | * Returns the newly allocated property or NULL on out of memory error. |
diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c index d1ffca8b34ea..d134710de96d 100644 --- a/drivers/of/fdt.c +++ b/drivers/of/fdt.c | |||
@@ -773,7 +773,7 @@ int __init early_init_dt_scan_chosen_serial(void) | |||
773 | if (offset < 0) | 773 | if (offset < 0) |
774 | return -ENODEV; | 774 | return -ENODEV; |
775 | 775 | ||
776 | while (match->compatible) { | 776 | while (match->compatible[0]) { |
777 | unsigned long addr; | 777 | unsigned long addr; |
778 | if (fdt_node_check_compatible(fdt, offset, match->compatible)) { | 778 | if (fdt_node_check_compatible(fdt, offset, match->compatible)) { |
779 | match++; | 779 | match++; |
@@ -964,8 +964,6 @@ void __init __weak early_init_dt_add_memory_arch(u64 base, u64 size) | |||
964 | int __init __weak early_init_dt_reserve_memory_arch(phys_addr_t base, | 964 | int __init __weak early_init_dt_reserve_memory_arch(phys_addr_t base, |
965 | phys_addr_t size, bool nomap) | 965 | phys_addr_t size, bool nomap) |
966 | { | 966 | { |
967 | if (memblock_is_region_reserved(base, size)) | ||
968 | return -EBUSY; | ||
969 | if (nomap) | 967 | if (nomap) |
970 | return memblock_remove(base, size); | 968 | return memblock_remove(base, size); |
971 | return memblock_reserve(base, size); | 969 | return memblock_reserve(base, size); |
diff --git a/drivers/of/selftest.c b/drivers/of/selftest.c index 11b873c54a77..e2d79afa9dc6 100644 --- a/drivers/of/selftest.c +++ b/drivers/of/selftest.c | |||
@@ -896,10 +896,14 @@ static void selftest_data_remove(void) | |||
896 | return; | 896 | return; |
897 | } | 897 | } |
898 | 898 | ||
899 | while (last_node_index >= 0) { | 899 | while (last_node_index-- > 0) { |
900 | if (nodes[last_node_index]) { | 900 | if (nodes[last_node_index]) { |
901 | np = of_find_node_by_path(nodes[last_node_index]->full_name); | 901 | np = of_find_node_by_path(nodes[last_node_index]->full_name); |
902 | if (strcmp(np->full_name, "/aliases") != 0) { | 902 | if (np == nodes[last_node_index]) { |
903 | if (of_aliases == np) { | ||
904 | of_node_put(of_aliases); | ||
905 | of_aliases = NULL; | ||
906 | } | ||
903 | detach_node_and_children(np); | 907 | detach_node_and_children(np); |
904 | } else { | 908 | } else { |
905 | for_each_property_of_node(np, prop) { | 909 | for_each_property_of_node(np, prop) { |
@@ -908,7 +912,6 @@ static void selftest_data_remove(void) | |||
908 | } | 912 | } |
909 | } | 913 | } |
910 | } | 914 | } |
911 | last_node_index--; | ||
912 | } | 915 | } |
913 | } | 916 | } |
914 | 917 | ||
@@ -921,6 +924,8 @@ static int __init of_selftest(void) | |||
921 | res = selftest_data_add(); | 924 | res = selftest_data_add(); |
922 | if (res) | 925 | if (res) |
923 | return res; | 926 | return res; |
927 | if (!of_aliases) | ||
928 | of_aliases = of_find_node_by_path("/aliases"); | ||
924 | 929 | ||
925 | np = of_find_node_by_path("/testcase-data/phandle-tests/consumer-a"); | 930 | np = of_find_node_by_path("/testcase-data/phandle-tests/consumer-a"); |
926 | if (!np) { | 931 | if (!np) { |
diff --git a/drivers/pci/access.c b/drivers/pci/access.c index d292d7cb3417..49dd766852ba 100644 --- a/drivers/pci/access.c +++ b/drivers/pci/access.c | |||
@@ -444,7 +444,7 @@ static inline int pcie_cap_version(const struct pci_dev *dev) | |||
444 | return pcie_caps_reg(dev) & PCI_EXP_FLAGS_VERS; | 444 | return pcie_caps_reg(dev) & PCI_EXP_FLAGS_VERS; |
445 | } | 445 | } |
446 | 446 | ||
447 | static inline bool pcie_cap_has_lnkctl(const struct pci_dev *dev) | 447 | bool pcie_cap_has_lnkctl(const struct pci_dev *dev) |
448 | { | 448 | { |
449 | int type = pci_pcie_type(dev); | 449 | int type = pci_pcie_type(dev); |
450 | 450 | ||
diff --git a/drivers/pci/host/pci-tegra.c b/drivers/pci/host/pci-tegra.c index 3d43874319be..19bb19c7db4a 100644 --- a/drivers/pci/host/pci-tegra.c +++ b/drivers/pci/host/pci-tegra.c | |||
@@ -276,6 +276,7 @@ struct tegra_pcie { | |||
276 | 276 | ||
277 | struct resource all; | 277 | struct resource all; |
278 | struct resource io; | 278 | struct resource io; |
279 | struct resource pio; | ||
279 | struct resource mem; | 280 | struct resource mem; |
280 | struct resource prefetch; | 281 | struct resource prefetch; |
281 | struct resource busn; | 282 | struct resource busn; |
@@ -658,7 +659,6 @@ static int tegra_pcie_setup(int nr, struct pci_sys_data *sys) | |||
658 | { | 659 | { |
659 | struct tegra_pcie *pcie = sys_to_pcie(sys); | 660 | struct tegra_pcie *pcie = sys_to_pcie(sys); |
660 | int err; | 661 | int err; |
661 | phys_addr_t io_start; | ||
662 | 662 | ||
663 | err = devm_request_resource(pcie->dev, &pcie->all, &pcie->mem); | 663 | err = devm_request_resource(pcie->dev, &pcie->all, &pcie->mem); |
664 | if (err < 0) | 664 | if (err < 0) |
@@ -668,14 +668,12 @@ static int tegra_pcie_setup(int nr, struct pci_sys_data *sys) | |||
668 | if (err) | 668 | if (err) |
669 | return err; | 669 | return err; |
670 | 670 | ||
671 | io_start = pci_pio_to_address(pcie->io.start); | ||
672 | |||
673 | pci_add_resource_offset(&sys->resources, &pcie->mem, sys->mem_offset); | 671 | pci_add_resource_offset(&sys->resources, &pcie->mem, sys->mem_offset); |
674 | pci_add_resource_offset(&sys->resources, &pcie->prefetch, | 672 | pci_add_resource_offset(&sys->resources, &pcie->prefetch, |
675 | sys->mem_offset); | 673 | sys->mem_offset); |
676 | pci_add_resource(&sys->resources, &pcie->busn); | 674 | pci_add_resource(&sys->resources, &pcie->busn); |
677 | 675 | ||
678 | pci_ioremap_io(nr * SZ_64K, io_start); | 676 | pci_ioremap_io(pcie->pio.start, pcie->io.start); |
679 | 677 | ||
680 | return 1; | 678 | return 1; |
681 | } | 679 | } |
@@ -786,7 +784,6 @@ static irqreturn_t tegra_pcie_isr(int irq, void *arg) | |||
786 | static void tegra_pcie_setup_translations(struct tegra_pcie *pcie) | 784 | static void tegra_pcie_setup_translations(struct tegra_pcie *pcie) |
787 | { | 785 | { |
788 | u32 fpci_bar, size, axi_address; | 786 | u32 fpci_bar, size, axi_address; |
789 | phys_addr_t io_start = pci_pio_to_address(pcie->io.start); | ||
790 | 787 | ||
791 | /* Bar 0: type 1 extended configuration space */ | 788 | /* Bar 0: type 1 extended configuration space */ |
792 | fpci_bar = 0xfe100000; | 789 | fpci_bar = 0xfe100000; |
@@ -799,7 +796,7 @@ static void tegra_pcie_setup_translations(struct tegra_pcie *pcie) | |||
799 | /* Bar 1: downstream IO bar */ | 796 | /* Bar 1: downstream IO bar */ |
800 | fpci_bar = 0xfdfc0000; | 797 | fpci_bar = 0xfdfc0000; |
801 | size = resource_size(&pcie->io); | 798 | size = resource_size(&pcie->io); |
802 | axi_address = io_start; | 799 | axi_address = pcie->io.start; |
803 | afi_writel(pcie, axi_address, AFI_AXI_BAR1_START); | 800 | afi_writel(pcie, axi_address, AFI_AXI_BAR1_START); |
804 | afi_writel(pcie, size >> 12, AFI_AXI_BAR1_SZ); | 801 | afi_writel(pcie, size >> 12, AFI_AXI_BAR1_SZ); |
805 | afi_writel(pcie, fpci_bar, AFI_FPCI_BAR1); | 802 | afi_writel(pcie, fpci_bar, AFI_FPCI_BAR1); |
@@ -1690,8 +1687,23 @@ static int tegra_pcie_parse_dt(struct tegra_pcie *pcie) | |||
1690 | 1687 | ||
1691 | switch (res.flags & IORESOURCE_TYPE_BITS) { | 1688 | switch (res.flags & IORESOURCE_TYPE_BITS) { |
1692 | case IORESOURCE_IO: | 1689 | case IORESOURCE_IO: |
1693 | memcpy(&pcie->io, &res, sizeof(res)); | 1690 | memcpy(&pcie->pio, &res, sizeof(res)); |
1694 | pcie->io.name = np->full_name; | 1691 | pcie->pio.name = np->full_name; |
1692 | |||
1693 | /* | ||
1694 | * The Tegra PCIe host bridge uses this to program the | ||
1695 | * mapping of the I/O space to the physical address, | ||
1696 | * so we override the .start and .end fields here that | ||
1697 | * of_pci_range_to_resource() converted to I/O space. | ||
1698 | * We also set the IORESOURCE_MEM type to clarify that | ||
1699 | * the resource is in the physical memory space. | ||
1700 | */ | ||
1701 | pcie->io.start = range.cpu_addr; | ||
1702 | pcie->io.end = range.cpu_addr + range.size - 1; | ||
1703 | pcie->io.flags = IORESOURCE_MEM; | ||
1704 | pcie->io.name = "I/O"; | ||
1705 | |||
1706 | memcpy(&res, &pcie->io, sizeof(res)); | ||
1695 | break; | 1707 | break; |
1696 | 1708 | ||
1697 | case IORESOURCE_MEM: | 1709 | case IORESOURCE_MEM: |
diff --git a/drivers/pci/host/pci-xgene.c b/drivers/pci/host/pci-xgene.c index 9ecabfa8c634..2988fe136c1e 100644 --- a/drivers/pci/host/pci-xgene.c +++ b/drivers/pci/host/pci-xgene.c | |||
@@ -631,10 +631,15 @@ static int xgene_pcie_probe_bridge(struct platform_device *pdev) | |||
631 | if (ret) | 631 | if (ret) |
632 | return ret; | 632 | return ret; |
633 | 633 | ||
634 | bus = pci_scan_root_bus(&pdev->dev, 0, &xgene_pcie_ops, port, &res); | 634 | bus = pci_create_root_bus(&pdev->dev, 0, |
635 | &xgene_pcie_ops, port, &res); | ||
635 | if (!bus) | 636 | if (!bus) |
636 | return -ENOMEM; | 637 | return -ENOMEM; |
637 | 638 | ||
639 | pci_scan_child_bus(bus); | ||
640 | pci_assign_unassigned_bus_resources(bus); | ||
641 | pci_bus_add_devices(bus); | ||
642 | |||
638 | platform_set_drvdata(pdev, port); | 643 | platform_set_drvdata(pdev, port); |
639 | return 0; | 644 | return 0; |
640 | } | 645 | } |
diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c index 9fab30af0e75..084587d7cd13 100644 --- a/drivers/pci/msi.c +++ b/drivers/pci/msi.c | |||
@@ -590,6 +590,20 @@ static struct msi_desc *msi_setup_entry(struct pci_dev *dev) | |||
590 | return entry; | 590 | return entry; |
591 | } | 591 | } |
592 | 592 | ||
593 | static int msi_verify_entries(struct pci_dev *dev) | ||
594 | { | ||
595 | struct msi_desc *entry; | ||
596 | |||
597 | list_for_each_entry(entry, &dev->msi_list, list) { | ||
598 | if (!dev->no_64bit_msi || !entry->msg.address_hi) | ||
599 | continue; | ||
600 | dev_err(&dev->dev, "Device has broken 64-bit MSI but arch" | ||
601 | " tried to assign one above 4G\n"); | ||
602 | return -EIO; | ||
603 | } | ||
604 | return 0; | ||
605 | } | ||
606 | |||
593 | /** | 607 | /** |
594 | * msi_capability_init - configure device's MSI capability structure | 608 | * msi_capability_init - configure device's MSI capability structure |
595 | * @dev: pointer to the pci_dev data structure of MSI device function | 609 | * @dev: pointer to the pci_dev data structure of MSI device function |
@@ -627,6 +641,13 @@ static int msi_capability_init(struct pci_dev *dev, int nvec) | |||
627 | return ret; | 641 | return ret; |
628 | } | 642 | } |
629 | 643 | ||
644 | ret = msi_verify_entries(dev); | ||
645 | if (ret) { | ||
646 | msi_mask_irq(entry, mask, ~mask); | ||
647 | free_msi_irqs(dev); | ||
648 | return ret; | ||
649 | } | ||
650 | |||
630 | ret = populate_msi_sysfs(dev); | 651 | ret = populate_msi_sysfs(dev); |
631 | if (ret) { | 652 | if (ret) { |
632 | msi_mask_irq(entry, mask, ~mask); | 653 | msi_mask_irq(entry, mask, ~mask); |
@@ -739,6 +760,11 @@ static int msix_capability_init(struct pci_dev *dev, | |||
739 | if (ret) | 760 | if (ret) |
740 | goto out_avail; | 761 | goto out_avail; |
741 | 762 | ||
763 | /* Check if all MSI entries honor device restrictions */ | ||
764 | ret = msi_verify_entries(dev); | ||
765 | if (ret) | ||
766 | goto out_free; | ||
767 | |||
742 | /* | 768 | /* |
743 | * Some devices require MSI-X to be enabled before we can touch the | 769 | * Some devices require MSI-X to be enabled before we can touch the |
744 | * MSI-X registers. We need to mask all the vectors to prevent | 770 | * MSI-X registers. We need to mask all the vectors to prevent |
diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h index 0601890db22d..4a3902d8e6fe 100644 --- a/drivers/pci/pci.h +++ b/drivers/pci/pci.h | |||
@@ -6,6 +6,8 @@ | |||
6 | 6 | ||
7 | extern const unsigned char pcie_link_speed[]; | 7 | extern const unsigned char pcie_link_speed[]; |
8 | 8 | ||
9 | bool pcie_cap_has_lnkctl(const struct pci_dev *dev); | ||
10 | |||
9 | /* Functions internal to the PCI core code */ | 11 | /* Functions internal to the PCI core code */ |
10 | 12 | ||
11 | int pci_create_sysfs_dev_files(struct pci_dev *pdev); | 13 | int pci_create_sysfs_dev_files(struct pci_dev *pdev); |
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c index 5ed99309c758..c8ca98c2b480 100644 --- a/drivers/pci/probe.c +++ b/drivers/pci/probe.c | |||
@@ -407,15 +407,16 @@ static void pci_read_bridge_mmio_pref(struct pci_bus *child) | |||
407 | { | 407 | { |
408 | struct pci_dev *dev = child->self; | 408 | struct pci_dev *dev = child->self; |
409 | u16 mem_base_lo, mem_limit_lo; | 409 | u16 mem_base_lo, mem_limit_lo; |
410 | unsigned long base, limit; | 410 | u64 base64, limit64; |
411 | dma_addr_t base, limit; | ||
411 | struct pci_bus_region region; | 412 | struct pci_bus_region region; |
412 | struct resource *res; | 413 | struct resource *res; |
413 | 414 | ||
414 | res = child->resource[2]; | 415 | res = child->resource[2]; |
415 | pci_read_config_word(dev, PCI_PREF_MEMORY_BASE, &mem_base_lo); | 416 | pci_read_config_word(dev, PCI_PREF_MEMORY_BASE, &mem_base_lo); |
416 | pci_read_config_word(dev, PCI_PREF_MEMORY_LIMIT, &mem_limit_lo); | 417 | pci_read_config_word(dev, PCI_PREF_MEMORY_LIMIT, &mem_limit_lo); |
417 | base = ((unsigned long) mem_base_lo & PCI_PREF_RANGE_MASK) << 16; | 418 | base64 = (mem_base_lo & PCI_PREF_RANGE_MASK) << 16; |
418 | limit = ((unsigned long) mem_limit_lo & PCI_PREF_RANGE_MASK) << 16; | 419 | limit64 = (mem_limit_lo & PCI_PREF_RANGE_MASK) << 16; |
419 | 420 | ||
420 | if ((mem_base_lo & PCI_PREF_RANGE_TYPE_MASK) == PCI_PREF_RANGE_TYPE_64) { | 421 | if ((mem_base_lo & PCI_PREF_RANGE_TYPE_MASK) == PCI_PREF_RANGE_TYPE_64) { |
421 | u32 mem_base_hi, mem_limit_hi; | 422 | u32 mem_base_hi, mem_limit_hi; |
@@ -429,17 +430,20 @@ static void pci_read_bridge_mmio_pref(struct pci_bus *child) | |||
429 | * this, just assume they are not being used. | 430 | * this, just assume they are not being used. |
430 | */ | 431 | */ |
431 | if (mem_base_hi <= mem_limit_hi) { | 432 | if (mem_base_hi <= mem_limit_hi) { |
432 | #if BITS_PER_LONG == 64 | 433 | base64 |= (u64) mem_base_hi << 32; |
433 | base |= ((unsigned long) mem_base_hi) << 32; | 434 | limit64 |= (u64) mem_limit_hi << 32; |
434 | limit |= ((unsigned long) mem_limit_hi) << 32; | ||
435 | #else | ||
436 | if (mem_base_hi || mem_limit_hi) { | ||
437 | dev_err(&dev->dev, "can't handle 64-bit address space for bridge\n"); | ||
438 | return; | ||
439 | } | ||
440 | #endif | ||
441 | } | 435 | } |
442 | } | 436 | } |
437 | |||
438 | base = (dma_addr_t) base64; | ||
439 | limit = (dma_addr_t) limit64; | ||
440 | |||
441 | if (base != base64) { | ||
442 | dev_err(&dev->dev, "can't handle bridge window above 4GB (bus address %#010llx)\n", | ||
443 | (unsigned long long) base64); | ||
444 | return; | ||
445 | } | ||
446 | |||
443 | if (base <= limit) { | 447 | if (base <= limit) { |
444 | res->flags = (mem_base_lo & PCI_PREF_RANGE_TYPE_MASK) | | 448 | res->flags = (mem_base_lo & PCI_PREF_RANGE_TYPE_MASK) | |
445 | IORESOURCE_MEM | IORESOURCE_PREFETCH; | 449 | IORESOURCE_MEM | IORESOURCE_PREFETCH; |
@@ -1323,7 +1327,7 @@ static void program_hpp_type2(struct pci_dev *dev, struct hpp_type2 *hpp) | |||
1323 | ~hpp->pci_exp_devctl_and, hpp->pci_exp_devctl_or); | 1327 | ~hpp->pci_exp_devctl_and, hpp->pci_exp_devctl_or); |
1324 | 1328 | ||
1325 | /* Initialize Link Control Register */ | 1329 | /* Initialize Link Control Register */ |
1326 | if (dev->subordinate) | 1330 | if (pcie_cap_has_lnkctl(dev)) |
1327 | pcie_capability_clear_and_set_word(dev, PCI_EXP_LNKCTL, | 1331 | pcie_capability_clear_and_set_word(dev, PCI_EXP_LNKCTL, |
1328 | ~hpp->pci_exp_lnkctl_and, hpp->pci_exp_lnkctl_or); | 1332 | ~hpp->pci_exp_lnkctl_and, hpp->pci_exp_lnkctl_or); |
1329 | 1333 | ||
diff --git a/drivers/powercap/Kconfig b/drivers/powercap/Kconfig index a7c81b53d88a..85727ef6ce8e 100644 --- a/drivers/powercap/Kconfig +++ b/drivers/powercap/Kconfig | |||
@@ -17,7 +17,7 @@ if POWERCAP | |||
17 | # Client driver configurations go here. | 17 | # Client driver configurations go here. |
18 | config INTEL_RAPL | 18 | config INTEL_RAPL |
19 | tristate "Intel RAPL Support" | 19 | tristate "Intel RAPL Support" |
20 | depends on X86 | 20 | depends on X86 && IOSF_MBI |
21 | default n | 21 | default n |
22 | ---help--- | 22 | ---help--- |
23 | This enables support for the Intel Running Average Power Limit (RAPL) | 23 | This enables support for the Intel Running Average Power Limit (RAPL) |
diff --git a/drivers/powercap/intel_rapl.c b/drivers/powercap/intel_rapl.c index 45e05b32f9b6..c71443c4f265 100644 --- a/drivers/powercap/intel_rapl.c +++ b/drivers/powercap/intel_rapl.c | |||
@@ -29,6 +29,7 @@ | |||
29 | #include <linux/sysfs.h> | 29 | #include <linux/sysfs.h> |
30 | #include <linux/cpu.h> | 30 | #include <linux/cpu.h> |
31 | #include <linux/powercap.h> | 31 | #include <linux/powercap.h> |
32 | #include <asm/iosf_mbi.h> | ||
32 | 33 | ||
33 | #include <asm/processor.h> | 34 | #include <asm/processor.h> |
34 | #include <asm/cpu_device_id.h> | 35 | #include <asm/cpu_device_id.h> |
@@ -70,11 +71,6 @@ | |||
70 | #define RAPL_PRIMITIVE_DERIVED BIT(1) /* not from raw data */ | 71 | #define RAPL_PRIMITIVE_DERIVED BIT(1) /* not from raw data */ |
71 | #define RAPL_PRIMITIVE_DUMMY BIT(2) | 72 | #define RAPL_PRIMITIVE_DUMMY BIT(2) |
72 | 73 | ||
73 | /* scale RAPL units to avoid floating point math inside kernel */ | ||
74 | #define POWER_UNIT_SCALE (1000000) | ||
75 | #define ENERGY_UNIT_SCALE (1000000) | ||
76 | #define TIME_UNIT_SCALE (1000000) | ||
77 | |||
78 | #define TIME_WINDOW_MAX_MSEC 40000 | 74 | #define TIME_WINDOW_MAX_MSEC 40000 |
79 | #define TIME_WINDOW_MIN_MSEC 250 | 75 | #define TIME_WINDOW_MIN_MSEC 250 |
80 | 76 | ||
@@ -175,9 +171,9 @@ struct rapl_package { | |||
175 | unsigned int id; /* physical package/socket id */ | 171 | unsigned int id; /* physical package/socket id */ |
176 | unsigned int nr_domains; | 172 | unsigned int nr_domains; |
177 | unsigned long domain_map; /* bit map of active domains */ | 173 | unsigned long domain_map; /* bit map of active domains */ |
178 | unsigned int power_unit_divisor; | 174 | unsigned int power_unit; |
179 | unsigned int energy_unit_divisor; | 175 | unsigned int energy_unit; |
180 | unsigned int time_unit_divisor; | 176 | unsigned int time_unit; |
181 | struct rapl_domain *domains; /* array of domains, sized at runtime */ | 177 | struct rapl_domain *domains; /* array of domains, sized at runtime */ |
182 | struct powercap_zone *power_zone; /* keep track of parent zone */ | 178 | struct powercap_zone *power_zone; /* keep track of parent zone */ |
183 | int nr_cpus; /* active cpus on the package, topology info is lost during | 179 | int nr_cpus; /* active cpus on the package, topology info is lost during |
@@ -188,6 +184,18 @@ struct rapl_package { | |||
188 | */ | 184 | */ |
189 | struct list_head plist; | 185 | struct list_head plist; |
190 | }; | 186 | }; |
187 | |||
188 | struct rapl_defaults { | ||
189 | int (*check_unit)(struct rapl_package *rp, int cpu); | ||
190 | void (*set_floor_freq)(struct rapl_domain *rd, bool mode); | ||
191 | u64 (*compute_time_window)(struct rapl_package *rp, u64 val, | ||
192 | bool to_raw); | ||
193 | }; | ||
194 | static struct rapl_defaults *rapl_defaults; | ||
195 | |||
196 | /* Sideband MBI registers */ | ||
197 | #define IOSF_CPU_POWER_BUDGET_CTL (0x2) | ||
198 | |||
191 | #define PACKAGE_PLN_INT_SAVED BIT(0) | 199 | #define PACKAGE_PLN_INT_SAVED BIT(0) |
192 | #define MAX_PRIM_NAME (32) | 200 | #define MAX_PRIM_NAME (32) |
193 | 201 | ||
@@ -339,23 +347,13 @@ static int find_nr_power_limit(struct rapl_domain *rd) | |||
339 | static int set_domain_enable(struct powercap_zone *power_zone, bool mode) | 347 | static int set_domain_enable(struct powercap_zone *power_zone, bool mode) |
340 | { | 348 | { |
341 | struct rapl_domain *rd = power_zone_to_rapl_domain(power_zone); | 349 | struct rapl_domain *rd = power_zone_to_rapl_domain(power_zone); |
342 | int nr_powerlimit; | ||
343 | 350 | ||
344 | if (rd->state & DOMAIN_STATE_BIOS_LOCKED) | 351 | if (rd->state & DOMAIN_STATE_BIOS_LOCKED) |
345 | return -EACCES; | 352 | return -EACCES; |
353 | |||
346 | get_online_cpus(); | 354 | get_online_cpus(); |
347 | nr_powerlimit = find_nr_power_limit(rd); | ||
348 | /* here we activate/deactivate the hardware for power limiting */ | ||
349 | rapl_write_data_raw(rd, PL1_ENABLE, mode); | 355 | rapl_write_data_raw(rd, PL1_ENABLE, mode); |
350 | /* always enable clamp such that p-state can go below OS requested | 356 | rapl_defaults->set_floor_freq(rd, mode); |
351 | * range. power capping priority over guranteed frequency. | ||
352 | */ | ||
353 | rapl_write_data_raw(rd, PL1_CLAMP, mode); | ||
354 | /* some domains have pl2 */ | ||
355 | if (nr_powerlimit > 1) { | ||
356 | rapl_write_data_raw(rd, PL2_ENABLE, mode); | ||
357 | rapl_write_data_raw(rd, PL2_CLAMP, mode); | ||
358 | } | ||
359 | put_online_cpus(); | 357 | put_online_cpus(); |
360 | 358 | ||
361 | return 0; | 359 | return 0; |
@@ -653,9 +651,7 @@ static void rapl_init_domains(struct rapl_package *rp) | |||
653 | static u64 rapl_unit_xlate(int package, enum unit_type type, u64 value, | 651 | static u64 rapl_unit_xlate(int package, enum unit_type type, u64 value, |
654 | int to_raw) | 652 | int to_raw) |
655 | { | 653 | { |
656 | u64 divisor = 1; | 654 | u64 units = 1; |
657 | int scale = 1; /* scale to user friendly data without floating point */ | ||
658 | u64 f, y; /* fraction and exp. used for time unit */ | ||
659 | struct rapl_package *rp; | 655 | struct rapl_package *rp; |
660 | 656 | ||
661 | rp = find_package_by_id(package); | 657 | rp = find_package_by_id(package); |
@@ -664,42 +660,24 @@ static u64 rapl_unit_xlate(int package, enum unit_type type, u64 value, | |||
664 | 660 | ||
665 | switch (type) { | 661 | switch (type) { |
666 | case POWER_UNIT: | 662 | case POWER_UNIT: |
667 | divisor = rp->power_unit_divisor; | 663 | units = rp->power_unit; |
668 | scale = POWER_UNIT_SCALE; | ||
669 | break; | 664 | break; |
670 | case ENERGY_UNIT: | 665 | case ENERGY_UNIT: |
671 | scale = ENERGY_UNIT_SCALE; | 666 | units = rp->energy_unit; |
672 | divisor = rp->energy_unit_divisor; | ||
673 | break; | 667 | break; |
674 | case TIME_UNIT: | 668 | case TIME_UNIT: |
675 | divisor = rp->time_unit_divisor; | 669 | return rapl_defaults->compute_time_window(rp, value, to_raw); |
676 | scale = TIME_UNIT_SCALE; | ||
677 | /* special processing based on 2^Y*(1+F)/4 = val/divisor, refer | ||
678 | * to Intel Software Developer's manual Vol. 3a, CH 14.7.4. | ||
679 | */ | ||
680 | if (!to_raw) { | ||
681 | f = (value & 0x60) >> 5; | ||
682 | y = value & 0x1f; | ||
683 | value = (1 << y) * (4 + f) * scale / 4; | ||
684 | return div64_u64(value, divisor); | ||
685 | } else { | ||
686 | do_div(value, scale); | ||
687 | value *= divisor; | ||
688 | y = ilog2(value); | ||
689 | f = div64_u64(4 * (value - (1 << y)), 1 << y); | ||
690 | value = (y & 0x1f) | ((f & 0x3) << 5); | ||
691 | return value; | ||
692 | } | ||
693 | break; | ||
694 | case ARBITRARY_UNIT: | 670 | case ARBITRARY_UNIT: |
695 | default: | 671 | default: |
696 | return value; | 672 | return value; |
697 | }; | 673 | }; |
698 | 674 | ||
699 | if (to_raw) | 675 | if (to_raw) |
700 | return div64_u64(value * divisor, scale); | 676 | return div64_u64(value, units); |
701 | else | 677 | |
702 | return div64_u64(value * scale, divisor); | 678 | value *= units; |
679 | |||
680 | return value; | ||
703 | } | 681 | } |
704 | 682 | ||
705 | /* in the order of enum rapl_primitives */ | 683 | /* in the order of enum rapl_primitives */ |
@@ -833,12 +811,18 @@ static int rapl_write_data_raw(struct rapl_domain *rd, | |||
833 | return 0; | 811 | return 0; |
834 | } | 812 | } |
835 | 813 | ||
836 | static const struct x86_cpu_id energy_unit_quirk_ids[] = { | 814 | /* |
837 | { X86_VENDOR_INTEL, 6, 0x37},/* Valleyview */ | 815 | * Raw RAPL data stored in MSRs are in certain scales. We need to |
838 | {} | 816 | * convert them into standard units based on the units reported in |
839 | }; | 817 | * the RAPL unit MSRs. This is specific to CPUs as the method to |
840 | 818 | * calculate units differ on different CPUs. | |
841 | static int rapl_check_unit(struct rapl_package *rp, int cpu) | 819 | * We convert the units to below format based on CPUs. |
820 | * i.e. | ||
821 | * energy unit: microJoules : Represented in microJoules by default | ||
822 | * power unit : microWatts : Represented in milliWatts by default | ||
823 | * time unit : microseconds: Represented in seconds by default | ||
824 | */ | ||
825 | static int rapl_check_unit_core(struct rapl_package *rp, int cpu) | ||
842 | { | 826 | { |
843 | u64 msr_val; | 827 | u64 msr_val; |
844 | u32 value; | 828 | u32 value; |
@@ -849,36 +833,47 @@ static int rapl_check_unit(struct rapl_package *rp, int cpu) | |||
849 | return -ENODEV; | 833 | return -ENODEV; |
850 | } | 834 | } |
851 | 835 | ||
852 | /* Raw RAPL data stored in MSRs are in certain scales. We need to | ||
853 | * convert them into standard units based on the divisors reported in | ||
854 | * the RAPL unit MSRs. | ||
855 | * i.e. | ||
856 | * energy unit: 1/enery_unit_divisor Joules | ||
857 | * power unit: 1/power_unit_divisor Watts | ||
858 | * time unit: 1/time_unit_divisor Seconds | ||
859 | */ | ||
860 | value = (msr_val & ENERGY_UNIT_MASK) >> ENERGY_UNIT_OFFSET; | 836 | value = (msr_val & ENERGY_UNIT_MASK) >> ENERGY_UNIT_OFFSET; |
861 | /* some CPUs have different way to calculate energy unit */ | 837 | rp->energy_unit = 1000000 / (1 << value); |
862 | if (x86_match_cpu(energy_unit_quirk_ids)) | ||
863 | rp->energy_unit_divisor = 1000000 / (1 << value); | ||
864 | else | ||
865 | rp->energy_unit_divisor = 1 << value; | ||
866 | 838 | ||
867 | value = (msr_val & POWER_UNIT_MASK) >> POWER_UNIT_OFFSET; | 839 | value = (msr_val & POWER_UNIT_MASK) >> POWER_UNIT_OFFSET; |
868 | rp->power_unit_divisor = 1 << value; | 840 | rp->power_unit = 1000000 / (1 << value); |
869 | 841 | ||
870 | value = (msr_val & TIME_UNIT_MASK) >> TIME_UNIT_OFFSET; | 842 | value = (msr_val & TIME_UNIT_MASK) >> TIME_UNIT_OFFSET; |
871 | rp->time_unit_divisor = 1 << value; | 843 | rp->time_unit = 1000000 / (1 << value); |
872 | 844 | ||
873 | pr_debug("Physical package %d units: energy=%d, time=%d, power=%d\n", | 845 | pr_debug("Core CPU package %d energy=%duJ, time=%dus, power=%duW\n", |
874 | rp->id, | 846 | rp->id, rp->energy_unit, rp->time_unit, rp->power_unit); |
875 | rp->energy_unit_divisor, | ||
876 | rp->time_unit_divisor, | ||
877 | rp->power_unit_divisor); | ||
878 | 847 | ||
879 | return 0; | 848 | return 0; |
880 | } | 849 | } |
881 | 850 | ||
851 | static int rapl_check_unit_atom(struct rapl_package *rp, int cpu) | ||
852 | { | ||
853 | u64 msr_val; | ||
854 | u32 value; | ||
855 | |||
856 | if (rdmsrl_safe_on_cpu(cpu, MSR_RAPL_POWER_UNIT, &msr_val)) { | ||
857 | pr_err("Failed to read power unit MSR 0x%x on CPU %d, exit.\n", | ||
858 | MSR_RAPL_POWER_UNIT, cpu); | ||
859 | return -ENODEV; | ||
860 | } | ||
861 | value = (msr_val & ENERGY_UNIT_MASK) >> ENERGY_UNIT_OFFSET; | ||
862 | rp->energy_unit = 1 << value; | ||
863 | |||
864 | value = (msr_val & POWER_UNIT_MASK) >> POWER_UNIT_OFFSET; | ||
865 | rp->power_unit = (1 << value) * 1000; | ||
866 | |||
867 | value = (msr_val & TIME_UNIT_MASK) >> TIME_UNIT_OFFSET; | ||
868 | rp->time_unit = 1000000 / (1 << value); | ||
869 | |||
870 | pr_debug("Atom package %d energy=%duJ, time=%dus, power=%duW\n", | ||
871 | rp->id, rp->energy_unit, rp->time_unit, rp->power_unit); | ||
872 | |||
873 | return 0; | ||
874 | } | ||
875 | |||
876 | |||
882 | /* REVISIT: | 877 | /* REVISIT: |
883 | * When package power limit is set artificially low by RAPL, LVT | 878 | * When package power limit is set artificially low by RAPL, LVT |
884 | * thermal interrupt for package power limit should be ignored | 879 | * thermal interrupt for package power limit should be ignored |
@@ -946,16 +941,107 @@ static void package_power_limit_irq_restore(int package_id) | |||
946 | wrmsr_on_cpu(cpu, MSR_IA32_PACKAGE_THERM_INTERRUPT, l, h); | 941 | wrmsr_on_cpu(cpu, MSR_IA32_PACKAGE_THERM_INTERRUPT, l, h); |
947 | } | 942 | } |
948 | 943 | ||
944 | static void set_floor_freq_default(struct rapl_domain *rd, bool mode) | ||
945 | { | ||
946 | int nr_powerlimit = find_nr_power_limit(rd); | ||
947 | |||
948 | /* always enable clamp such that p-state can go below OS requested | ||
949 | * range. power capping priority over guranteed frequency. | ||
950 | */ | ||
951 | rapl_write_data_raw(rd, PL1_CLAMP, mode); | ||
952 | |||
953 | /* some domains have pl2 */ | ||
954 | if (nr_powerlimit > 1) { | ||
955 | rapl_write_data_raw(rd, PL2_ENABLE, mode); | ||
956 | rapl_write_data_raw(rd, PL2_CLAMP, mode); | ||
957 | } | ||
958 | } | ||
959 | |||
960 | static void set_floor_freq_atom(struct rapl_domain *rd, bool enable) | ||
961 | { | ||
962 | static u32 power_ctrl_orig_val; | ||
963 | u32 mdata; | ||
964 | |||
965 | if (!power_ctrl_orig_val) | ||
966 | iosf_mbi_read(BT_MBI_UNIT_PMC, BT_MBI_PMC_READ, | ||
967 | IOSF_CPU_POWER_BUDGET_CTL, &power_ctrl_orig_val); | ||
968 | mdata = power_ctrl_orig_val; | ||
969 | if (enable) { | ||
970 | mdata &= ~(0x7f << 8); | ||
971 | mdata |= 1 << 8; | ||
972 | } | ||
973 | iosf_mbi_write(BT_MBI_UNIT_PMC, BT_MBI_PMC_WRITE, | ||
974 | IOSF_CPU_POWER_BUDGET_CTL, mdata); | ||
975 | } | ||
976 | |||
977 | static u64 rapl_compute_time_window_core(struct rapl_package *rp, u64 value, | ||
978 | bool to_raw) | ||
979 | { | ||
980 | u64 f, y; /* fraction and exp. used for time unit */ | ||
981 | |||
982 | /* | ||
983 | * Special processing based on 2^Y*(1+F/4), refer | ||
984 | * to Intel Software Developer's manual Vol.3B: CH 14.9.3. | ||
985 | */ | ||
986 | if (!to_raw) { | ||
987 | f = (value & 0x60) >> 5; | ||
988 | y = value & 0x1f; | ||
989 | value = (1 << y) * (4 + f) * rp->time_unit / 4; | ||
990 | } else { | ||
991 | do_div(value, rp->time_unit); | ||
992 | y = ilog2(value); | ||
993 | f = div64_u64(4 * (value - (1 << y)), 1 << y); | ||
994 | value = (y & 0x1f) | ((f & 0x3) << 5); | ||
995 | } | ||
996 | return value; | ||
997 | } | ||
998 | |||
999 | static u64 rapl_compute_time_window_atom(struct rapl_package *rp, u64 value, | ||
1000 | bool to_raw) | ||
1001 | { | ||
1002 | /* | ||
1003 | * Atom time unit encoding is straight forward val * time_unit, | ||
1004 | * where time_unit is default to 1 sec. Never 0. | ||
1005 | */ | ||
1006 | if (!to_raw) | ||
1007 | return (value) ? value *= rp->time_unit : rp->time_unit; | ||
1008 | else | ||
1009 | value = div64_u64(value, rp->time_unit); | ||
1010 | |||
1011 | return value; | ||
1012 | } | ||
1013 | |||
1014 | static const struct rapl_defaults rapl_defaults_core = { | ||
1015 | .check_unit = rapl_check_unit_core, | ||
1016 | .set_floor_freq = set_floor_freq_default, | ||
1017 | .compute_time_window = rapl_compute_time_window_core, | ||
1018 | }; | ||
1019 | |||
1020 | static const struct rapl_defaults rapl_defaults_atom = { | ||
1021 | .check_unit = rapl_check_unit_atom, | ||
1022 | .set_floor_freq = set_floor_freq_atom, | ||
1023 | .compute_time_window = rapl_compute_time_window_atom, | ||
1024 | }; | ||
1025 | |||
1026 | #define RAPL_CPU(_model, _ops) { \ | ||
1027 | .vendor = X86_VENDOR_INTEL, \ | ||
1028 | .family = 6, \ | ||
1029 | .model = _model, \ | ||
1030 | .driver_data = (kernel_ulong_t)&_ops, \ | ||
1031 | } | ||
1032 | |||
949 | static const struct x86_cpu_id rapl_ids[] = { | 1033 | static const struct x86_cpu_id rapl_ids[] = { |
950 | { X86_VENDOR_INTEL, 6, 0x2a},/* Sandy Bridge */ | 1034 | RAPL_CPU(0x2a, rapl_defaults_core),/* Sandy Bridge */ |
951 | { X86_VENDOR_INTEL, 6, 0x2d},/* Sandy Bridge EP */ | 1035 | RAPL_CPU(0x2d, rapl_defaults_core),/* Sandy Bridge EP */ |
952 | { X86_VENDOR_INTEL, 6, 0x37},/* Valleyview */ | 1036 | RAPL_CPU(0x37, rapl_defaults_atom),/* Valleyview */ |
953 | { X86_VENDOR_INTEL, 6, 0x3a},/* Ivy Bridge */ | 1037 | RAPL_CPU(0x3a, rapl_defaults_core),/* Ivy Bridge */ |
954 | { X86_VENDOR_INTEL, 6, 0x3c},/* Haswell */ | 1038 | RAPL_CPU(0x3c, rapl_defaults_core),/* Haswell */ |
955 | { X86_VENDOR_INTEL, 6, 0x3d},/* Broadwell */ | 1039 | RAPL_CPU(0x3d, rapl_defaults_core),/* Broadwell */ |
956 | { X86_VENDOR_INTEL, 6, 0x3f},/* Haswell */ | 1040 | RAPL_CPU(0x3f, rapl_defaults_core),/* Haswell */ |
957 | { X86_VENDOR_INTEL, 6, 0x45},/* Haswell ULT */ | 1041 | RAPL_CPU(0x45, rapl_defaults_core),/* Haswell ULT */ |
958 | /* TODO: Add more CPU IDs after testing */ | 1042 | RAPL_CPU(0x4C, rapl_defaults_atom),/* Braswell */ |
1043 | RAPL_CPU(0x4A, rapl_defaults_atom),/* Tangier */ | ||
1044 | RAPL_CPU(0x5A, rapl_defaults_atom),/* Annidale */ | ||
959 | {} | 1045 | {} |
960 | }; | 1046 | }; |
961 | MODULE_DEVICE_TABLE(x86cpu, rapl_ids); | 1047 | MODULE_DEVICE_TABLE(x86cpu, rapl_ids); |
@@ -1241,7 +1327,7 @@ static int rapl_detect_topology(void) | |||
1241 | 1327 | ||
1242 | /* check if the package contains valid domains */ | 1328 | /* check if the package contains valid domains */ |
1243 | if (rapl_detect_domains(new_package, i) || | 1329 | if (rapl_detect_domains(new_package, i) || |
1244 | rapl_check_unit(new_package, i)) { | 1330 | rapl_defaults->check_unit(new_package, i)) { |
1245 | kfree(new_package->domains); | 1331 | kfree(new_package->domains); |
1246 | kfree(new_package); | 1332 | kfree(new_package); |
1247 | /* free up the packages already initialized */ | 1333 | /* free up the packages already initialized */ |
@@ -1296,7 +1382,7 @@ static int rapl_add_package(int cpu) | |||
1296 | rp->nr_cpus = 1; | 1382 | rp->nr_cpus = 1; |
1297 | /* check if the package contains valid domains */ | 1383 | /* check if the package contains valid domains */ |
1298 | if (rapl_detect_domains(rp, cpu) || | 1384 | if (rapl_detect_domains(rp, cpu) || |
1299 | rapl_check_unit(rp, cpu)) { | 1385 | rapl_defaults->check_unit(rp, cpu)) { |
1300 | ret = -ENODEV; | 1386 | ret = -ENODEV; |
1301 | goto err_free_package; | 1387 | goto err_free_package; |
1302 | } | 1388 | } |
@@ -1358,14 +1444,18 @@ static struct notifier_block rapl_cpu_notifier = { | |||
1358 | static int __init rapl_init(void) | 1444 | static int __init rapl_init(void) |
1359 | { | 1445 | { |
1360 | int ret = 0; | 1446 | int ret = 0; |
1447 | const struct x86_cpu_id *id; | ||
1361 | 1448 | ||
1362 | if (!x86_match_cpu(rapl_ids)) { | 1449 | id = x86_match_cpu(rapl_ids); |
1450 | if (!id) { | ||
1363 | pr_err("driver does not support CPU family %d model %d\n", | 1451 | pr_err("driver does not support CPU family %d model %d\n", |
1364 | boot_cpu_data.x86, boot_cpu_data.x86_model); | 1452 | boot_cpu_data.x86, boot_cpu_data.x86_model); |
1365 | 1453 | ||
1366 | return -ENODEV; | 1454 | return -ENODEV; |
1367 | } | 1455 | } |
1368 | 1456 | ||
1457 | rapl_defaults = (struct rapl_defaults *)id->driver_data; | ||
1458 | |||
1369 | cpu_notifier_register_begin(); | 1459 | cpu_notifier_register_begin(); |
1370 | 1460 | ||
1371 | /* prevent CPU hotplug during detection */ | 1461 | /* prevent CPU hotplug during detection */ |
diff --git a/drivers/scsi/bnx2fc/bnx2fc_fcoe.c b/drivers/scsi/bnx2fc/bnx2fc_fcoe.c index 79e5c94107a9..72533c58c1f3 100644 --- a/drivers/scsi/bnx2fc/bnx2fc_fcoe.c +++ b/drivers/scsi/bnx2fc/bnx2fc_fcoe.c | |||
@@ -412,6 +412,7 @@ static int bnx2fc_rcv(struct sk_buff *skb, struct net_device *dev, | |||
412 | struct fc_frame_header *fh; | 412 | struct fc_frame_header *fh; |
413 | struct fcoe_rcv_info *fr; | 413 | struct fcoe_rcv_info *fr; |
414 | struct fcoe_percpu_s *bg; | 414 | struct fcoe_percpu_s *bg; |
415 | struct sk_buff *tmp_skb; | ||
415 | unsigned short oxid; | 416 | unsigned short oxid; |
416 | 417 | ||
417 | interface = container_of(ptype, struct bnx2fc_interface, | 418 | interface = container_of(ptype, struct bnx2fc_interface, |
@@ -424,6 +425,12 @@ static int bnx2fc_rcv(struct sk_buff *skb, struct net_device *dev, | |||
424 | goto err; | 425 | goto err; |
425 | } | 426 | } |
426 | 427 | ||
428 | tmp_skb = skb_share_check(skb, GFP_ATOMIC); | ||
429 | if (!tmp_skb) | ||
430 | goto err; | ||
431 | |||
432 | skb = tmp_skb; | ||
433 | |||
427 | if (unlikely(eth_hdr(skb)->h_proto != htons(ETH_P_FCOE))) { | 434 | if (unlikely(eth_hdr(skb)->h_proto != htons(ETH_P_FCOE))) { |
428 | printk(KERN_ERR PFX "bnx2fc_rcv: Wrong FC type frame\n"); | 435 | printk(KERN_ERR PFX "bnx2fc_rcv: Wrong FC type frame\n"); |
429 | goto err; | 436 | goto err; |
diff --git a/drivers/scsi/cxgbi/cxgb4i/cxgb4i.c b/drivers/scsi/cxgbi/cxgb4i/cxgb4i.c index 81bb3bd7909d..15081257cfc8 100644 --- a/drivers/scsi/cxgbi/cxgb4i/cxgb4i.c +++ b/drivers/scsi/cxgbi/cxgb4i/cxgb4i.c | |||
@@ -828,6 +828,8 @@ static void do_act_open_rpl(struct cxgbi_device *cdev, struct sk_buff *skb) | |||
828 | if (status == CPL_ERR_RTX_NEG_ADVICE) | 828 | if (status == CPL_ERR_RTX_NEG_ADVICE) |
829 | goto rel_skb; | 829 | goto rel_skb; |
830 | 830 | ||
831 | module_put(THIS_MODULE); | ||
832 | |||
831 | if (status && status != CPL_ERR_TCAM_FULL && | 833 | if (status && status != CPL_ERR_TCAM_FULL && |
832 | status != CPL_ERR_CONN_EXIST && | 834 | status != CPL_ERR_CONN_EXIST && |
833 | status != CPL_ERR_ARP_MISS) | 835 | status != CPL_ERR_ARP_MISS) |
diff --git a/drivers/scsi/cxgbi/libcxgbi.c b/drivers/scsi/cxgbi/libcxgbi.c index 13d869a92248..7da59c38a69e 100644 --- a/drivers/scsi/cxgbi/libcxgbi.c +++ b/drivers/scsi/cxgbi/libcxgbi.c | |||
@@ -816,7 +816,7 @@ static void cxgbi_inform_iscsi_conn_closing(struct cxgbi_sock *csk) | |||
816 | read_lock_bh(&csk->callback_lock); | 816 | read_lock_bh(&csk->callback_lock); |
817 | if (csk->user_data) | 817 | if (csk->user_data) |
818 | iscsi_conn_failure(csk->user_data, | 818 | iscsi_conn_failure(csk->user_data, |
819 | ISCSI_ERR_CONN_FAILED); | 819 | ISCSI_ERR_TCP_CONN_CLOSE); |
820 | read_unlock_bh(&csk->callback_lock); | 820 | read_unlock_bh(&csk->callback_lock); |
821 | } | 821 | } |
822 | } | 822 | } |
diff --git a/drivers/scsi/scsi_devinfo.c b/drivers/scsi/scsi_devinfo.c index 49014a143c6a..c1d04d4d3c6c 100644 --- a/drivers/scsi/scsi_devinfo.c +++ b/drivers/scsi/scsi_devinfo.c | |||
@@ -202,6 +202,7 @@ static struct { | |||
202 | {"IOMEGA", "Io20S *F", NULL, BLIST_KEY}, | 202 | {"IOMEGA", "Io20S *F", NULL, BLIST_KEY}, |
203 | {"INSITE", "Floptical F*8I", NULL, BLIST_KEY}, | 203 | {"INSITE", "Floptical F*8I", NULL, BLIST_KEY}, |
204 | {"INSITE", "I325VM", NULL, BLIST_KEY}, | 204 | {"INSITE", "I325VM", NULL, BLIST_KEY}, |
205 | {"Intel", "Multi-Flex", NULL, BLIST_NO_RSOC}, | ||
205 | {"iRiver", "iFP Mass Driver", NULL, BLIST_NOT_LOCKABLE | BLIST_INQUIRY_36}, | 206 | {"iRiver", "iFP Mass Driver", NULL, BLIST_NOT_LOCKABLE | BLIST_INQUIRY_36}, |
206 | {"LASOUND", "CDX7405", "3.10", BLIST_MAX5LUN | BLIST_SINGLELUN}, | 207 | {"LASOUND", "CDX7405", "3.10", BLIST_MAX5LUN | BLIST_SINGLELUN}, |
207 | {"MATSHITA", "PD-1", NULL, BLIST_FORCELUN | BLIST_SINGLELUN}, | 208 | {"MATSHITA", "PD-1", NULL, BLIST_FORCELUN | BLIST_SINGLELUN}, |
diff --git a/drivers/scsi/ufs/ufshcd-pltfrm.c b/drivers/scsi/ufs/ufshcd-pltfrm.c index 8adf067ff019..1c3467b82566 100644 --- a/drivers/scsi/ufs/ufshcd-pltfrm.c +++ b/drivers/scsi/ufs/ufshcd-pltfrm.c | |||
@@ -102,7 +102,6 @@ static int ufshcd_parse_clock_info(struct ufs_hba *hba) | |||
102 | clkfreq = devm_kzalloc(dev, sz * sizeof(*clkfreq), | 102 | clkfreq = devm_kzalloc(dev, sz * sizeof(*clkfreq), |
103 | GFP_KERNEL); | 103 | GFP_KERNEL); |
104 | if (!clkfreq) { | 104 | if (!clkfreq) { |
105 | dev_err(dev, "%s: no memory\n", "freq-table-hz"); | ||
106 | ret = -ENOMEM; | 105 | ret = -ENOMEM; |
107 | goto out; | 106 | goto out; |
108 | } | 107 | } |
@@ -112,19 +111,19 @@ static int ufshcd_parse_clock_info(struct ufs_hba *hba) | |||
112 | if (ret && (ret != -EINVAL)) { | 111 | if (ret && (ret != -EINVAL)) { |
113 | dev_err(dev, "%s: error reading array %d\n", | 112 | dev_err(dev, "%s: error reading array %d\n", |
114 | "freq-table-hz", ret); | 113 | "freq-table-hz", ret); |
115 | goto free_clkfreq; | 114 | return ret; |
116 | } | 115 | } |
117 | 116 | ||
118 | for (i = 0; i < sz; i += 2) { | 117 | for (i = 0; i < sz; i += 2) { |
119 | ret = of_property_read_string_index(np, | 118 | ret = of_property_read_string_index(np, |
120 | "clock-names", i/2, (const char **)&name); | 119 | "clock-names", i/2, (const char **)&name); |
121 | if (ret) | 120 | if (ret) |
122 | goto free_clkfreq; | 121 | goto out; |
123 | 122 | ||
124 | clki = devm_kzalloc(dev, sizeof(*clki), GFP_KERNEL); | 123 | clki = devm_kzalloc(dev, sizeof(*clki), GFP_KERNEL); |
125 | if (!clki) { | 124 | if (!clki) { |
126 | ret = -ENOMEM; | 125 | ret = -ENOMEM; |
127 | goto free_clkfreq; | 126 | goto out; |
128 | } | 127 | } |
129 | 128 | ||
130 | clki->min_freq = clkfreq[i]; | 129 | clki->min_freq = clkfreq[i]; |
@@ -134,8 +133,6 @@ static int ufshcd_parse_clock_info(struct ufs_hba *hba) | |||
134 | clki->min_freq, clki->max_freq, clki->name); | 133 | clki->min_freq, clki->max_freq, clki->name); |
135 | list_add_tail(&clki->list, &hba->clk_list_head); | 134 | list_add_tail(&clki->list, &hba->clk_list_head); |
136 | } | 135 | } |
137 | free_clkfreq: | ||
138 | kfree(clkfreq); | ||
139 | out: | 136 | out: |
140 | return ret; | 137 | return ret; |
141 | } | 138 | } |
@@ -162,10 +159,8 @@ static int ufshcd_populate_vreg(struct device *dev, const char *name, | |||
162 | } | 159 | } |
163 | 160 | ||
164 | vreg = devm_kzalloc(dev, sizeof(*vreg), GFP_KERNEL); | 161 | vreg = devm_kzalloc(dev, sizeof(*vreg), GFP_KERNEL); |
165 | if (!vreg) { | 162 | if (!vreg) |
166 | dev_err(dev, "No memory for %s regulator\n", name); | 163 | return -ENOMEM; |
167 | goto out; | ||
168 | } | ||
169 | 164 | ||
170 | vreg->name = kstrdup(name, GFP_KERNEL); | 165 | vreg->name = kstrdup(name, GFP_KERNEL); |
171 | 166 | ||
diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index 497c38a4a866..605ca60e8a10 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c | |||
@@ -744,6 +744,8 @@ static void ufshcd_exit_clk_gating(struct ufs_hba *hba) | |||
744 | if (!ufshcd_is_clkgating_allowed(hba)) | 744 | if (!ufshcd_is_clkgating_allowed(hba)) |
745 | return; | 745 | return; |
746 | device_remove_file(hba->dev, &hba->clk_gating.delay_attr); | 746 | device_remove_file(hba->dev, &hba->clk_gating.delay_attr); |
747 | cancel_work_sync(&hba->clk_gating.ungate_work); | ||
748 | cancel_delayed_work_sync(&hba->clk_gating.gate_work); | ||
747 | } | 749 | } |
748 | 750 | ||
749 | /* Must be called with host lock acquired */ | 751 | /* Must be called with host lock acquired */ |
@@ -2246,6 +2248,22 @@ static int ufshcd_uic_hibern8_exit(struct ufs_hba *hba) | |||
2246 | return ret; | 2248 | return ret; |
2247 | } | 2249 | } |
2248 | 2250 | ||
2251 | /** | ||
2252 | * ufshcd_init_pwr_info - setting the POR (power on reset) | ||
2253 | * values in hba power info | ||
2254 | * @hba: per-adapter instance | ||
2255 | */ | ||
2256 | static void ufshcd_init_pwr_info(struct ufs_hba *hba) | ||
2257 | { | ||
2258 | hba->pwr_info.gear_rx = UFS_PWM_G1; | ||
2259 | hba->pwr_info.gear_tx = UFS_PWM_G1; | ||
2260 | hba->pwr_info.lane_rx = 1; | ||
2261 | hba->pwr_info.lane_tx = 1; | ||
2262 | hba->pwr_info.pwr_rx = SLOWAUTO_MODE; | ||
2263 | hba->pwr_info.pwr_tx = SLOWAUTO_MODE; | ||
2264 | hba->pwr_info.hs_rate = 0; | ||
2265 | } | ||
2266 | |||
2249 | /** | 2267 | /** |
2250 | * ufshcd_get_max_pwr_mode - reads the max power mode negotiated with device | 2268 | * ufshcd_get_max_pwr_mode - reads the max power mode negotiated with device |
2251 | * @hba: per-adapter instance | 2269 | * @hba: per-adapter instance |
@@ -2844,8 +2862,13 @@ static void ufshcd_slave_destroy(struct scsi_device *sdev) | |||
2844 | hba = shost_priv(sdev->host); | 2862 | hba = shost_priv(sdev->host); |
2845 | scsi_deactivate_tcq(sdev, hba->nutrs); | 2863 | scsi_deactivate_tcq(sdev, hba->nutrs); |
2846 | /* Drop the reference as it won't be needed anymore */ | 2864 | /* Drop the reference as it won't be needed anymore */ |
2847 | if (ufshcd_scsi_to_upiu_lun(sdev->lun) == UFS_UPIU_UFS_DEVICE_WLUN) | 2865 | if (ufshcd_scsi_to_upiu_lun(sdev->lun) == UFS_UPIU_UFS_DEVICE_WLUN) { |
2866 | unsigned long flags; | ||
2867 | |||
2868 | spin_lock_irqsave(hba->host->host_lock, flags); | ||
2848 | hba->sdev_ufs_device = NULL; | 2869 | hba->sdev_ufs_device = NULL; |
2870 | spin_unlock_irqrestore(hba->host->host_lock, flags); | ||
2871 | } | ||
2849 | } | 2872 | } |
2850 | 2873 | ||
2851 | /** | 2874 | /** |
@@ -4062,6 +4085,8 @@ static void ufshcd_init_icc_levels(struct ufs_hba *hba) | |||
4062 | static int ufshcd_scsi_add_wlus(struct ufs_hba *hba) | 4085 | static int ufshcd_scsi_add_wlus(struct ufs_hba *hba) |
4063 | { | 4086 | { |
4064 | int ret = 0; | 4087 | int ret = 0; |
4088 | struct scsi_device *sdev_rpmb; | ||
4089 | struct scsi_device *sdev_boot; | ||
4065 | 4090 | ||
4066 | hba->sdev_ufs_device = __scsi_add_device(hba->host, 0, 0, | 4091 | hba->sdev_ufs_device = __scsi_add_device(hba->host, 0, 0, |
4067 | ufshcd_upiu_wlun_to_scsi_wlun(UFS_UPIU_UFS_DEVICE_WLUN), NULL); | 4092 | ufshcd_upiu_wlun_to_scsi_wlun(UFS_UPIU_UFS_DEVICE_WLUN), NULL); |
@@ -4070,26 +4095,27 @@ static int ufshcd_scsi_add_wlus(struct ufs_hba *hba) | |||
4070 | hba->sdev_ufs_device = NULL; | 4095 | hba->sdev_ufs_device = NULL; |
4071 | goto out; | 4096 | goto out; |
4072 | } | 4097 | } |
4098 | scsi_device_put(hba->sdev_ufs_device); | ||
4073 | 4099 | ||
4074 | hba->sdev_boot = __scsi_add_device(hba->host, 0, 0, | 4100 | sdev_boot = __scsi_add_device(hba->host, 0, 0, |
4075 | ufshcd_upiu_wlun_to_scsi_wlun(UFS_UPIU_BOOT_WLUN), NULL); | 4101 | ufshcd_upiu_wlun_to_scsi_wlun(UFS_UPIU_BOOT_WLUN), NULL); |
4076 | if (IS_ERR(hba->sdev_boot)) { | 4102 | if (IS_ERR(sdev_boot)) { |
4077 | ret = PTR_ERR(hba->sdev_boot); | 4103 | ret = PTR_ERR(sdev_boot); |
4078 | hba->sdev_boot = NULL; | ||
4079 | goto remove_sdev_ufs_device; | 4104 | goto remove_sdev_ufs_device; |
4080 | } | 4105 | } |
4106 | scsi_device_put(sdev_boot); | ||
4081 | 4107 | ||
4082 | hba->sdev_rpmb = __scsi_add_device(hba->host, 0, 0, | 4108 | sdev_rpmb = __scsi_add_device(hba->host, 0, 0, |
4083 | ufshcd_upiu_wlun_to_scsi_wlun(UFS_UPIU_RPMB_WLUN), NULL); | 4109 | ufshcd_upiu_wlun_to_scsi_wlun(UFS_UPIU_RPMB_WLUN), NULL); |
4084 | if (IS_ERR(hba->sdev_rpmb)) { | 4110 | if (IS_ERR(sdev_rpmb)) { |
4085 | ret = PTR_ERR(hba->sdev_rpmb); | 4111 | ret = PTR_ERR(sdev_rpmb); |
4086 | hba->sdev_rpmb = NULL; | ||
4087 | goto remove_sdev_boot; | 4112 | goto remove_sdev_boot; |
4088 | } | 4113 | } |
4114 | scsi_device_put(sdev_rpmb); | ||
4089 | goto out; | 4115 | goto out; |
4090 | 4116 | ||
4091 | remove_sdev_boot: | 4117 | remove_sdev_boot: |
4092 | scsi_remove_device(hba->sdev_boot); | 4118 | scsi_remove_device(sdev_boot); |
4093 | remove_sdev_ufs_device: | 4119 | remove_sdev_ufs_device: |
4094 | scsi_remove_device(hba->sdev_ufs_device); | 4120 | scsi_remove_device(hba->sdev_ufs_device); |
4095 | out: | 4121 | out: |
@@ -4097,30 +4123,6 @@ out: | |||
4097 | } | 4123 | } |
4098 | 4124 | ||
4099 | /** | 4125 | /** |
4100 | * ufshcd_scsi_remove_wlus - Removes the W-LUs which were added by | ||
4101 | * ufshcd_scsi_add_wlus() | ||
4102 | * @hba: per-adapter instance | ||
4103 | * | ||
4104 | */ | ||
4105 | static void ufshcd_scsi_remove_wlus(struct ufs_hba *hba) | ||
4106 | { | ||
4107 | if (hba->sdev_ufs_device) { | ||
4108 | scsi_remove_device(hba->sdev_ufs_device); | ||
4109 | hba->sdev_ufs_device = NULL; | ||
4110 | } | ||
4111 | |||
4112 | if (hba->sdev_boot) { | ||
4113 | scsi_remove_device(hba->sdev_boot); | ||
4114 | hba->sdev_boot = NULL; | ||
4115 | } | ||
4116 | |||
4117 | if (hba->sdev_rpmb) { | ||
4118 | scsi_remove_device(hba->sdev_rpmb); | ||
4119 | hba->sdev_rpmb = NULL; | ||
4120 | } | ||
4121 | } | ||
4122 | |||
4123 | /** | ||
4124 | * ufshcd_probe_hba - probe hba to detect device and initialize | 4126 | * ufshcd_probe_hba - probe hba to detect device and initialize |
4125 | * @hba: per-adapter instance | 4127 | * @hba: per-adapter instance |
4126 | * | 4128 | * |
@@ -4134,6 +4136,8 @@ static int ufshcd_probe_hba(struct ufs_hba *hba) | |||
4134 | if (ret) | 4136 | if (ret) |
4135 | goto out; | 4137 | goto out; |
4136 | 4138 | ||
4139 | ufshcd_init_pwr_info(hba); | ||
4140 | |||
4137 | /* UniPro link is active now */ | 4141 | /* UniPro link is active now */ |
4138 | ufshcd_set_link_active(hba); | 4142 | ufshcd_set_link_active(hba); |
4139 | 4143 | ||
@@ -4264,12 +4268,18 @@ static int ufshcd_config_vreg_load(struct device *dev, struct ufs_vreg *vreg, | |||
4264 | static inline int ufshcd_config_vreg_lpm(struct ufs_hba *hba, | 4268 | static inline int ufshcd_config_vreg_lpm(struct ufs_hba *hba, |
4265 | struct ufs_vreg *vreg) | 4269 | struct ufs_vreg *vreg) |
4266 | { | 4270 | { |
4271 | if (!vreg) | ||
4272 | return 0; | ||
4273 | |||
4267 | return ufshcd_config_vreg_load(hba->dev, vreg, UFS_VREG_LPM_LOAD_UA); | 4274 | return ufshcd_config_vreg_load(hba->dev, vreg, UFS_VREG_LPM_LOAD_UA); |
4268 | } | 4275 | } |
4269 | 4276 | ||
4270 | static inline int ufshcd_config_vreg_hpm(struct ufs_hba *hba, | 4277 | static inline int ufshcd_config_vreg_hpm(struct ufs_hba *hba, |
4271 | struct ufs_vreg *vreg) | 4278 | struct ufs_vreg *vreg) |
4272 | { | 4279 | { |
4280 | if (!vreg) | ||
4281 | return 0; | ||
4282 | |||
4273 | return ufshcd_config_vreg_load(hba->dev, vreg, vreg->max_uA); | 4283 | return ufshcd_config_vreg_load(hba->dev, vreg, vreg->max_uA); |
4274 | } | 4284 | } |
4275 | 4285 | ||
@@ -4471,7 +4481,7 @@ out: | |||
4471 | if (!IS_ERR_OR_NULL(clki->clk) && clki->enabled) | 4481 | if (!IS_ERR_OR_NULL(clki->clk) && clki->enabled) |
4472 | clk_disable_unprepare(clki->clk); | 4482 | clk_disable_unprepare(clki->clk); |
4473 | } | 4483 | } |
4474 | } else if (!ret && on) { | 4484 | } else if (on) { |
4475 | spin_lock_irqsave(hba->host->host_lock, flags); | 4485 | spin_lock_irqsave(hba->host->host_lock, flags); |
4476 | hba->clk_gating.state = CLKS_ON; | 4486 | hba->clk_gating.state = CLKS_ON; |
4477 | spin_unlock_irqrestore(hba->host->host_lock, flags); | 4487 | spin_unlock_irqrestore(hba->host->host_lock, flags); |
@@ -4675,11 +4685,25 @@ static int ufshcd_set_dev_pwr_mode(struct ufs_hba *hba, | |||
4675 | { | 4685 | { |
4676 | unsigned char cmd[6] = { START_STOP }; | 4686 | unsigned char cmd[6] = { START_STOP }; |
4677 | struct scsi_sense_hdr sshdr; | 4687 | struct scsi_sense_hdr sshdr; |
4678 | struct scsi_device *sdp = hba->sdev_ufs_device; | 4688 | struct scsi_device *sdp; |
4689 | unsigned long flags; | ||
4679 | int ret; | 4690 | int ret; |
4680 | 4691 | ||
4681 | if (!sdp || !scsi_device_online(sdp)) | 4692 | spin_lock_irqsave(hba->host->host_lock, flags); |
4682 | return -ENODEV; | 4693 | sdp = hba->sdev_ufs_device; |
4694 | if (sdp) { | ||
4695 | ret = scsi_device_get(sdp); | ||
4696 | if (!ret && !scsi_device_online(sdp)) { | ||
4697 | ret = -ENODEV; | ||
4698 | scsi_device_put(sdp); | ||
4699 | } | ||
4700 | } else { | ||
4701 | ret = -ENODEV; | ||
4702 | } | ||
4703 | spin_unlock_irqrestore(hba->host->host_lock, flags); | ||
4704 | |||
4705 | if (ret) | ||
4706 | return ret; | ||
4683 | 4707 | ||
4684 | /* | 4708 | /* |
4685 | * If scsi commands fail, the scsi mid-layer schedules scsi error- | 4709 | * If scsi commands fail, the scsi mid-layer schedules scsi error- |
@@ -4718,6 +4742,7 @@ static int ufshcd_set_dev_pwr_mode(struct ufs_hba *hba, | |||
4718 | if (!ret) | 4742 | if (!ret) |
4719 | hba->curr_dev_pwr_mode = pwr_mode; | 4743 | hba->curr_dev_pwr_mode = pwr_mode; |
4720 | out: | 4744 | out: |
4745 | scsi_device_put(sdp); | ||
4721 | hba->host->eh_noresume = 0; | 4746 | hba->host->eh_noresume = 0; |
4722 | return ret; | 4747 | return ret; |
4723 | } | 4748 | } |
@@ -5087,7 +5112,7 @@ int ufshcd_system_suspend(struct ufs_hba *hba) | |||
5087 | int ret = 0; | 5112 | int ret = 0; |
5088 | 5113 | ||
5089 | if (!hba || !hba->is_powered) | 5114 | if (!hba || !hba->is_powered) |
5090 | goto out; | 5115 | return 0; |
5091 | 5116 | ||
5092 | if (pm_runtime_suspended(hba->dev)) { | 5117 | if (pm_runtime_suspended(hba->dev)) { |
5093 | if (hba->rpm_lvl == hba->spm_lvl) | 5118 | if (hba->rpm_lvl == hba->spm_lvl) |
@@ -5231,7 +5256,6 @@ EXPORT_SYMBOL(ufshcd_shutdown); | |||
5231 | void ufshcd_remove(struct ufs_hba *hba) | 5256 | void ufshcd_remove(struct ufs_hba *hba) |
5232 | { | 5257 | { |
5233 | scsi_remove_host(hba->host); | 5258 | scsi_remove_host(hba->host); |
5234 | ufshcd_scsi_remove_wlus(hba); | ||
5235 | /* disable interrupts */ | 5259 | /* disable interrupts */ |
5236 | ufshcd_disable_intr(hba, hba->intr_mask); | 5260 | ufshcd_disable_intr(hba, hba->intr_mask); |
5237 | ufshcd_hba_stop(hba); | 5261 | ufshcd_hba_stop(hba); |
diff --git a/drivers/scsi/ufs/ufshcd.h b/drivers/scsi/ufs/ufshcd.h index 58ecdff5065c..4a574aa45855 100644 --- a/drivers/scsi/ufs/ufshcd.h +++ b/drivers/scsi/ufs/ufshcd.h | |||
@@ -392,8 +392,6 @@ struct ufs_hba { | |||
392 | * "UFS device" W-LU. | 392 | * "UFS device" W-LU. |
393 | */ | 393 | */ |
394 | struct scsi_device *sdev_ufs_device; | 394 | struct scsi_device *sdev_ufs_device; |
395 | struct scsi_device *sdev_rpmb; | ||
396 | struct scsi_device *sdev_boot; | ||
397 | 395 | ||
398 | enum ufs_dev_pwr_mode curr_dev_pwr_mode; | 396 | enum ufs_dev_pwr_mode curr_dev_pwr_mode; |
399 | enum uic_link_state uic_link_state; | 397 | enum uic_link_state uic_link_state; |
diff --git a/drivers/spi/spi-dw.c b/drivers/spi/spi-dw.c index 72e12bad14b9..d0d5542efc06 100644 --- a/drivers/spi/spi-dw.c +++ b/drivers/spi/spi-dw.c | |||
@@ -376,9 +376,6 @@ static void pump_transfers(unsigned long data) | |||
376 | chip = dws->cur_chip; | 376 | chip = dws->cur_chip; |
377 | spi = message->spi; | 377 | spi = message->spi; |
378 | 378 | ||
379 | if (unlikely(!chip->clk_div)) | ||
380 | chip->clk_div = dws->max_freq / chip->speed_hz; | ||
381 | |||
382 | if (message->state == ERROR_STATE) { | 379 | if (message->state == ERROR_STATE) { |
383 | message->status = -EIO; | 380 | message->status = -EIO; |
384 | goto early_exit; | 381 | goto early_exit; |
@@ -419,7 +416,7 @@ static void pump_transfers(unsigned long data) | |||
419 | if (transfer->speed_hz) { | 416 | if (transfer->speed_hz) { |
420 | speed = chip->speed_hz; | 417 | speed = chip->speed_hz; |
421 | 418 | ||
422 | if (transfer->speed_hz != speed) { | 419 | if ((transfer->speed_hz != speed) || (!chip->clk_div)) { |
423 | speed = transfer->speed_hz; | 420 | speed = transfer->speed_hz; |
424 | 421 | ||
425 | /* clk_div doesn't support odd number */ | 422 | /* clk_div doesn't support odd number */ |
@@ -581,7 +578,6 @@ static int dw_spi_setup(struct spi_device *spi) | |||
581 | dev_err(&spi->dev, "No max speed HZ parameter\n"); | 578 | dev_err(&spi->dev, "No max speed HZ parameter\n"); |
582 | return -EINVAL; | 579 | return -EINVAL; |
583 | } | 580 | } |
584 | chip->speed_hz = spi->max_speed_hz; | ||
585 | 581 | ||
586 | chip->tmode = 0; /* Tx & Rx */ | 582 | chip->tmode = 0; /* Tx & Rx */ |
587 | /* Default SPI mode is SCPOL = 0, SCPH = 0 */ | 583 | /* Default SPI mode is SCPOL = 0, SCPH = 0 */ |
diff --git a/drivers/spi/spi-sirf.c b/drivers/spi/spi-sirf.c index 39e2c0a55a28..f63de781c729 100644 --- a/drivers/spi/spi-sirf.c +++ b/drivers/spi/spi-sirf.c | |||
@@ -562,9 +562,9 @@ spi_sirfsoc_setup_transfer(struct spi_device *spi, struct spi_transfer *t) | |||
562 | 562 | ||
563 | sspi->word_width = DIV_ROUND_UP(bits_per_word, 8); | 563 | sspi->word_width = DIV_ROUND_UP(bits_per_word, 8); |
564 | txfifo_ctrl = SIRFSOC_SPI_FIFO_THD(SIRFSOC_SPI_FIFO_SIZE / 2) | | 564 | txfifo_ctrl = SIRFSOC_SPI_FIFO_THD(SIRFSOC_SPI_FIFO_SIZE / 2) | |
565 | sspi->word_width; | 565 | (sspi->word_width >> 1); |
566 | rxfifo_ctrl = SIRFSOC_SPI_FIFO_THD(SIRFSOC_SPI_FIFO_SIZE / 2) | | 566 | rxfifo_ctrl = SIRFSOC_SPI_FIFO_THD(SIRFSOC_SPI_FIFO_SIZE / 2) | |
567 | sspi->word_width; | 567 | (sspi->word_width >> 1); |
568 | 568 | ||
569 | if (!(spi->mode & SPI_CS_HIGH)) | 569 | if (!(spi->mode & SPI_CS_HIGH)) |
570 | regval |= SIRFSOC_SPI_CS_IDLE_STAT; | 570 | regval |= SIRFSOC_SPI_CS_IDLE_STAT; |
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index ebcb33df2eb2..50f20f243981 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c | |||
@@ -615,13 +615,13 @@ static int spi_map_buf(struct spi_master *master, struct device *dev, | |||
615 | sg_free_table(sgt); | 615 | sg_free_table(sgt); |
616 | return -ENOMEM; | 616 | return -ENOMEM; |
617 | } | 617 | } |
618 | sg_buf = page_address(vm_page) + | 618 | sg_set_page(&sgt->sgl[i], vm_page, |
619 | ((size_t)buf & ~PAGE_MASK); | 619 | min, offset_in_page(buf)); |
620 | } else { | 620 | } else { |
621 | sg_buf = buf; | 621 | sg_buf = buf; |
622 | sg_set_buf(&sgt->sgl[i], sg_buf, min); | ||
622 | } | 623 | } |
623 | 624 | ||
624 | sg_set_buf(&sgt->sgl[i], sg_buf, min); | ||
625 | 625 | ||
626 | buf += min; | 626 | buf += min; |
627 | len -= min; | 627 | len -= min; |
diff --git a/drivers/staging/rtl8188eu/core/rtw_cmd.c b/drivers/staging/rtl8188eu/core/rtw_cmd.c index 9935e66935af..eddef9cd2e16 100644 --- a/drivers/staging/rtl8188eu/core/rtw_cmd.c +++ b/drivers/staging/rtl8188eu/core/rtw_cmd.c | |||
@@ -275,11 +275,11 @@ u8 rtw_sitesurvey_cmd(struct adapter *padapter, struct ndis_802_11_ssid *ssid, | |||
275 | if (check_fwstate(pmlmepriv, _FW_LINKED) == true) | 275 | if (check_fwstate(pmlmepriv, _FW_LINKED) == true) |
276 | rtw_lps_ctrl_wk_cmd(padapter, LPS_CTRL_SCAN, 1); | 276 | rtw_lps_ctrl_wk_cmd(padapter, LPS_CTRL_SCAN, 1); |
277 | 277 | ||
278 | ph2c = kzalloc(sizeof(struct cmd_obj), GFP_KERNEL); | 278 | ph2c = kzalloc(sizeof(struct cmd_obj), GFP_ATOMIC); |
279 | if (ph2c == NULL) | 279 | if (ph2c == NULL) |
280 | return _FAIL; | 280 | return _FAIL; |
281 | 281 | ||
282 | psurveyPara = kzalloc(sizeof(struct sitesurvey_parm), GFP_KERNEL); | 282 | psurveyPara = kzalloc(sizeof(struct sitesurvey_parm), GFP_ATOMIC); |
283 | if (psurveyPara == NULL) { | 283 | if (psurveyPara == NULL) { |
284 | kfree(ph2c); | 284 | kfree(ph2c); |
285 | return _FAIL; | 285 | return _FAIL; |
@@ -405,7 +405,7 @@ u8 rtw_joinbss_cmd(struct adapter *padapter, struct wlan_network *pnetwork) | |||
405 | else | 405 | else |
406 | RT_TRACE(_module_rtl871x_cmd_c_, _drv_notice_, ("+Join cmd: SSid =[%s]\n", pmlmepriv->assoc_ssid.Ssid)); | 406 | RT_TRACE(_module_rtl871x_cmd_c_, _drv_notice_, ("+Join cmd: SSid =[%s]\n", pmlmepriv->assoc_ssid.Ssid)); |
407 | 407 | ||
408 | pcmd = kzalloc(sizeof(struct cmd_obj), GFP_KERNEL); | 408 | pcmd = kzalloc(sizeof(struct cmd_obj), GFP_ATOMIC); |
409 | if (pcmd == NULL) { | 409 | if (pcmd == NULL) { |
410 | res = _FAIL; | 410 | res = _FAIL; |
411 | RT_TRACE(_module_rtl871x_cmd_c_, _drv_err_, ("rtw_joinbss_cmd: memory allocate for cmd_obj fail!!!\n")); | 411 | RT_TRACE(_module_rtl871x_cmd_c_, _drv_err_, ("rtw_joinbss_cmd: memory allocate for cmd_obj fail!!!\n")); |
@@ -755,13 +755,13 @@ u8 rtw_dynamic_chk_wk_cmd(struct adapter *padapter) | |||
755 | u8 res = _SUCCESS; | 755 | u8 res = _SUCCESS; |
756 | 756 | ||
757 | 757 | ||
758 | ph2c = kzalloc(sizeof(struct cmd_obj), GFP_KERNEL); | 758 | ph2c = kzalloc(sizeof(struct cmd_obj), GFP_ATOMIC); |
759 | if (ph2c == NULL) { | 759 | if (ph2c == NULL) { |
760 | res = _FAIL; | 760 | res = _FAIL; |
761 | goto exit; | 761 | goto exit; |
762 | } | 762 | } |
763 | 763 | ||
764 | pdrvextra_cmd_parm = kzalloc(sizeof(struct drvextra_cmd_parm), GFP_KERNEL); | 764 | pdrvextra_cmd_parm = kzalloc(sizeof(struct drvextra_cmd_parm), GFP_ATOMIC); |
765 | if (pdrvextra_cmd_parm == NULL) { | 765 | if (pdrvextra_cmd_parm == NULL) { |
766 | kfree(ph2c); | 766 | kfree(ph2c); |
767 | res = _FAIL; | 767 | res = _FAIL; |
@@ -967,13 +967,13 @@ u8 rtw_lps_ctrl_wk_cmd(struct adapter *padapter, u8 lps_ctrl_type, u8 enqueue) | |||
967 | u8 res = _SUCCESS; | 967 | u8 res = _SUCCESS; |
968 | 968 | ||
969 | if (enqueue) { | 969 | if (enqueue) { |
970 | ph2c = kzalloc(sizeof(struct cmd_obj), GFP_KERNEL); | 970 | ph2c = kzalloc(sizeof(struct cmd_obj), GFP_ATOMIC); |
971 | if (ph2c == NULL) { | 971 | if (ph2c == NULL) { |
972 | res = _FAIL; | 972 | res = _FAIL; |
973 | goto exit; | 973 | goto exit; |
974 | } | 974 | } |
975 | 975 | ||
976 | pdrvextra_cmd_parm = kzalloc(sizeof(struct drvextra_cmd_parm), GFP_KERNEL); | 976 | pdrvextra_cmd_parm = kzalloc(sizeof(struct drvextra_cmd_parm), GFP_ATOMIC); |
977 | if (pdrvextra_cmd_parm == NULL) { | 977 | if (pdrvextra_cmd_parm == NULL) { |
978 | kfree(ph2c); | 978 | kfree(ph2c); |
979 | res = _FAIL; | 979 | res = _FAIL; |
@@ -1010,13 +1010,13 @@ u8 rtw_rpt_timer_cfg_cmd(struct adapter *padapter, u16 min_time) | |||
1010 | 1010 | ||
1011 | u8 res = _SUCCESS; | 1011 | u8 res = _SUCCESS; |
1012 | 1012 | ||
1013 | ph2c = kzalloc(sizeof(struct cmd_obj), GFP_KERNEL); | 1013 | ph2c = kzalloc(sizeof(struct cmd_obj), GFP_ATOMIC); |
1014 | if (ph2c == NULL) { | 1014 | if (ph2c == NULL) { |
1015 | res = _FAIL; | 1015 | res = _FAIL; |
1016 | goto exit; | 1016 | goto exit; |
1017 | } | 1017 | } |
1018 | 1018 | ||
1019 | pdrvextra_cmd_parm = kzalloc(sizeof(struct drvextra_cmd_parm), GFP_KERNEL); | 1019 | pdrvextra_cmd_parm = kzalloc(sizeof(struct drvextra_cmd_parm), GFP_ATOMIC); |
1020 | if (pdrvextra_cmd_parm == NULL) { | 1020 | if (pdrvextra_cmd_parm == NULL) { |
1021 | kfree(ph2c); | 1021 | kfree(ph2c); |
1022 | res = _FAIL; | 1022 | res = _FAIL; |
@@ -1088,13 +1088,13 @@ u8 rtw_ps_cmd(struct adapter *padapter) | |||
1088 | 1088 | ||
1089 | u8 res = _SUCCESS; | 1089 | u8 res = _SUCCESS; |
1090 | 1090 | ||
1091 | ppscmd = kzalloc(sizeof(struct cmd_obj), GFP_KERNEL); | 1091 | ppscmd = kzalloc(sizeof(struct cmd_obj), GFP_ATOMIC); |
1092 | if (ppscmd == NULL) { | 1092 | if (ppscmd == NULL) { |
1093 | res = _FAIL; | 1093 | res = _FAIL; |
1094 | goto exit; | 1094 | goto exit; |
1095 | } | 1095 | } |
1096 | 1096 | ||
1097 | pdrvextra_cmd_parm = kzalloc(sizeof(struct drvextra_cmd_parm), GFP_KERNEL); | 1097 | pdrvextra_cmd_parm = kzalloc(sizeof(struct drvextra_cmd_parm), GFP_ATOMIC); |
1098 | if (pdrvextra_cmd_parm == NULL) { | 1098 | if (pdrvextra_cmd_parm == NULL) { |
1099 | kfree(ppscmd); | 1099 | kfree(ppscmd); |
1100 | res = _FAIL; | 1100 | res = _FAIL; |
diff --git a/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c b/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c index 5ba5099ec20d..70b1bc3e0e63 100644 --- a/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c +++ b/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c | |||
@@ -4241,12 +4241,12 @@ void report_survey_event(struct adapter *padapter, | |||
4241 | pcmdpriv = &padapter->cmdpriv; | 4241 | pcmdpriv = &padapter->cmdpriv; |
4242 | 4242 | ||
4243 | 4243 | ||
4244 | pcmd_obj = kzalloc(sizeof(struct cmd_obj), GFP_KERNEL); | 4244 | pcmd_obj = kzalloc(sizeof(struct cmd_obj), GFP_ATOMIC); |
4245 | if (pcmd_obj == NULL) | 4245 | if (pcmd_obj == NULL) |
4246 | return; | 4246 | return; |
4247 | 4247 | ||
4248 | cmdsz = (sizeof(struct survey_event) + sizeof(struct C2HEvent_Header)); | 4248 | cmdsz = (sizeof(struct survey_event) + sizeof(struct C2HEvent_Header)); |
4249 | pevtcmd = kzalloc(cmdsz, GFP_KERNEL); | 4249 | pevtcmd = kzalloc(cmdsz, GFP_ATOMIC); |
4250 | if (pevtcmd == NULL) { | 4250 | if (pevtcmd == NULL) { |
4251 | kfree(pcmd_obj); | 4251 | kfree(pcmd_obj); |
4252 | return; | 4252 | return; |
@@ -4339,12 +4339,12 @@ void report_join_res(struct adapter *padapter, int res) | |||
4339 | struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); | 4339 | struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); |
4340 | struct cmd_priv *pcmdpriv = &padapter->cmdpriv; | 4340 | struct cmd_priv *pcmdpriv = &padapter->cmdpriv; |
4341 | 4341 | ||
4342 | pcmd_obj = kzalloc(sizeof(struct cmd_obj), GFP_KERNEL); | 4342 | pcmd_obj = kzalloc(sizeof(struct cmd_obj), GFP_ATOMIC); |
4343 | if (pcmd_obj == NULL) | 4343 | if (pcmd_obj == NULL) |
4344 | return; | 4344 | return; |
4345 | 4345 | ||
4346 | cmdsz = (sizeof(struct joinbss_event) + sizeof(struct C2HEvent_Header)); | 4346 | cmdsz = (sizeof(struct joinbss_event) + sizeof(struct C2HEvent_Header)); |
4347 | pevtcmd = kzalloc(cmdsz, GFP_KERNEL); | 4347 | pevtcmd = kzalloc(cmdsz, GFP_ATOMIC); |
4348 | if (pevtcmd == NULL) { | 4348 | if (pevtcmd == NULL) { |
4349 | kfree(pcmd_obj); | 4349 | kfree(pcmd_obj); |
4350 | return; | 4350 | return; |
@@ -4854,11 +4854,11 @@ void survey_timer_hdl(void *function_context) | |||
4854 | pmlmeext->scan_abort = false;/* reset */ | 4854 | pmlmeext->scan_abort = false;/* reset */ |
4855 | } | 4855 | } |
4856 | 4856 | ||
4857 | ph2c = kzalloc(sizeof(struct cmd_obj), GFP_KERNEL); | 4857 | ph2c = kzalloc(sizeof(struct cmd_obj), GFP_ATOMIC); |
4858 | if (ph2c == NULL) | 4858 | if (ph2c == NULL) |
4859 | goto exit_survey_timer_hdl; | 4859 | goto exit_survey_timer_hdl; |
4860 | 4860 | ||
4861 | psurveyPara = kzalloc(sizeof(struct sitesurvey_parm), GFP_KERNEL); | 4861 | psurveyPara = kzalloc(sizeof(struct sitesurvey_parm), GFP_ATOMIC); |
4862 | if (psurveyPara == NULL) { | 4862 | if (psurveyPara == NULL) { |
4863 | kfree(ph2c); | 4863 | kfree(ph2c); |
4864 | goto exit_survey_timer_hdl; | 4864 | goto exit_survey_timer_hdl; |
diff --git a/drivers/staging/rtl8188eu/core/rtw_wlan_util.c b/drivers/staging/rtl8188eu/core/rtw_wlan_util.c index 33ccbbbd8ed6..d300369977fa 100644 --- a/drivers/staging/rtl8188eu/core/rtw_wlan_util.c +++ b/drivers/staging/rtl8188eu/core/rtw_wlan_util.c | |||
@@ -935,7 +935,7 @@ int rtw_check_bcn_info(struct adapter *Adapter, u8 *pframe, u32 packet_len) | |||
935 | return true; | 935 | return true; |
936 | } | 936 | } |
937 | 937 | ||
938 | bssid = kzalloc(sizeof(struct wlan_bssid_ex), GFP_KERNEL); | 938 | bssid = kzalloc(sizeof(struct wlan_bssid_ex), GFP_ATOMIC); |
939 | 939 | ||
940 | subtype = GetFrameSubType(pframe) >> 4; | 940 | subtype = GetFrameSubType(pframe) >> 4; |
941 | 941 | ||
diff --git a/drivers/staging/rtl8188eu/os_dep/usb_intf.c b/drivers/staging/rtl8188eu/os_dep/usb_intf.c index 407a318b09db..2f87150a21b7 100644 --- a/drivers/staging/rtl8188eu/os_dep/usb_intf.c +++ b/drivers/staging/rtl8188eu/os_dep/usb_intf.c | |||
@@ -47,6 +47,7 @@ static struct usb_device_id rtw_usb_id_tbl[] = { | |||
47 | {USB_DEVICE(0x07b8, 0x8179)}, /* Abocom - Abocom */ | 47 | {USB_DEVICE(0x07b8, 0x8179)}, /* Abocom - Abocom */ |
48 | {USB_DEVICE(0x2001, 0x330F)}, /* DLink DWA-125 REV D1 */ | 48 | {USB_DEVICE(0x2001, 0x330F)}, /* DLink DWA-125 REV D1 */ |
49 | {USB_DEVICE(0x2001, 0x3310)}, /* Dlink DWA-123 REV D1 */ | 49 | {USB_DEVICE(0x2001, 0x3310)}, /* Dlink DWA-123 REV D1 */ |
50 | {USB_DEVICE(0x2001, 0x3311)}, /* DLink GO-USB-N150 REV B1 */ | ||
50 | {USB_DEVICE(0x0df6, 0x0076)}, /* Sitecom N150 v2 */ | 51 | {USB_DEVICE(0x0df6, 0x0076)}, /* Sitecom N150 v2 */ |
51 | {} /* Terminating entry */ | 52 | {} /* Terminating entry */ |
52 | }; | 53 | }; |
diff --git a/drivers/target/iscsi/iscsi_target.c b/drivers/target/iscsi/iscsi_target.c index b19e4329ba00..73e58d22e325 100644 --- a/drivers/target/iscsi/iscsi_target.c +++ b/drivers/target/iscsi/iscsi_target.c | |||
@@ -3491,7 +3491,7 @@ iscsit_build_sendtargets_response(struct iscsi_cmd *cmd, | |||
3491 | len = sprintf(buf, "TargetAddress=" | 3491 | len = sprintf(buf, "TargetAddress=" |
3492 | "%s:%hu,%hu", | 3492 | "%s:%hu,%hu", |
3493 | inaddr_any ? conn->local_ip : np->np_ip, | 3493 | inaddr_any ? conn->local_ip : np->np_ip, |
3494 | inaddr_any ? conn->local_port : np->np_port, | 3494 | np->np_port, |
3495 | tpg->tpgt); | 3495 | tpg->tpgt); |
3496 | len += 1; | 3496 | len += 1; |
3497 | 3497 | ||
diff --git a/drivers/target/target_core_pr.c b/drivers/target/target_core_pr.c index 8c60a1a1ae8d..9f93b8234095 100644 --- a/drivers/target/target_core_pr.c +++ b/drivers/target/target_core_pr.c | |||
@@ -2738,7 +2738,8 @@ core_scsi3_pro_preempt(struct se_cmd *cmd, int type, int scope, u64 res_key, | |||
2738 | struct t10_pr_registration *pr_reg, *pr_reg_tmp, *pr_reg_n, *pr_res_holder; | 2738 | struct t10_pr_registration *pr_reg, *pr_reg_tmp, *pr_reg_n, *pr_res_holder; |
2739 | struct t10_reservation *pr_tmpl = &dev->t10_pr; | 2739 | struct t10_reservation *pr_tmpl = &dev->t10_pr; |
2740 | u32 pr_res_mapped_lun = 0; | 2740 | u32 pr_res_mapped_lun = 0; |
2741 | int all_reg = 0, calling_it_nexus = 0, released_regs = 0; | 2741 | int all_reg = 0, calling_it_nexus = 0; |
2742 | bool sa_res_key_unmatched = sa_res_key != 0; | ||
2742 | int prh_type = 0, prh_scope = 0; | 2743 | int prh_type = 0, prh_scope = 0; |
2743 | 2744 | ||
2744 | if (!se_sess) | 2745 | if (!se_sess) |
@@ -2813,6 +2814,7 @@ core_scsi3_pro_preempt(struct se_cmd *cmd, int type, int scope, u64 res_key, | |||
2813 | if (!all_reg) { | 2814 | if (!all_reg) { |
2814 | if (pr_reg->pr_res_key != sa_res_key) | 2815 | if (pr_reg->pr_res_key != sa_res_key) |
2815 | continue; | 2816 | continue; |
2817 | sa_res_key_unmatched = false; | ||
2816 | 2818 | ||
2817 | calling_it_nexus = (pr_reg_n == pr_reg) ? 1 : 0; | 2819 | calling_it_nexus = (pr_reg_n == pr_reg) ? 1 : 0; |
2818 | pr_reg_nacl = pr_reg->pr_reg_nacl; | 2820 | pr_reg_nacl = pr_reg->pr_reg_nacl; |
@@ -2820,7 +2822,6 @@ core_scsi3_pro_preempt(struct se_cmd *cmd, int type, int scope, u64 res_key, | |||
2820 | __core_scsi3_free_registration(dev, pr_reg, | 2822 | __core_scsi3_free_registration(dev, pr_reg, |
2821 | (preempt_type == PREEMPT_AND_ABORT) ? &preempt_and_abort_list : | 2823 | (preempt_type == PREEMPT_AND_ABORT) ? &preempt_and_abort_list : |
2822 | NULL, calling_it_nexus); | 2824 | NULL, calling_it_nexus); |
2823 | released_regs++; | ||
2824 | } else { | 2825 | } else { |
2825 | /* | 2826 | /* |
2826 | * Case for any existing all registrants type | 2827 | * Case for any existing all registrants type |
@@ -2838,6 +2839,7 @@ core_scsi3_pro_preempt(struct se_cmd *cmd, int type, int scope, u64 res_key, | |||
2838 | if ((sa_res_key) && | 2839 | if ((sa_res_key) && |
2839 | (pr_reg->pr_res_key != sa_res_key)) | 2840 | (pr_reg->pr_res_key != sa_res_key)) |
2840 | continue; | 2841 | continue; |
2842 | sa_res_key_unmatched = false; | ||
2841 | 2843 | ||
2842 | calling_it_nexus = (pr_reg_n == pr_reg) ? 1 : 0; | 2844 | calling_it_nexus = (pr_reg_n == pr_reg) ? 1 : 0; |
2843 | if (calling_it_nexus) | 2845 | if (calling_it_nexus) |
@@ -2848,7 +2850,6 @@ core_scsi3_pro_preempt(struct se_cmd *cmd, int type, int scope, u64 res_key, | |||
2848 | __core_scsi3_free_registration(dev, pr_reg, | 2850 | __core_scsi3_free_registration(dev, pr_reg, |
2849 | (preempt_type == PREEMPT_AND_ABORT) ? &preempt_and_abort_list : | 2851 | (preempt_type == PREEMPT_AND_ABORT) ? &preempt_and_abort_list : |
2850 | NULL, 0); | 2852 | NULL, 0); |
2851 | released_regs++; | ||
2852 | } | 2853 | } |
2853 | if (!calling_it_nexus) | 2854 | if (!calling_it_nexus) |
2854 | core_scsi3_ua_allocate(pr_reg_nacl, | 2855 | core_scsi3_ua_allocate(pr_reg_nacl, |
@@ -2863,7 +2864,7 @@ core_scsi3_pro_preempt(struct se_cmd *cmd, int type, int scope, u64 res_key, | |||
2863 | * registered reservation key, then the device server shall | 2864 | * registered reservation key, then the device server shall |
2864 | * complete the command with RESERVATION CONFLICT status. | 2865 | * complete the command with RESERVATION CONFLICT status. |
2865 | */ | 2866 | */ |
2866 | if (!released_regs) { | 2867 | if (sa_res_key_unmatched) { |
2867 | spin_unlock(&dev->dev_reservation_lock); | 2868 | spin_unlock(&dev->dev_reservation_lock); |
2868 | core_scsi3_put_pr_reg(pr_reg_n); | 2869 | core_scsi3_put_pr_reg(pr_reg_n); |
2869 | return TCM_RESERVATION_CONFLICT; | 2870 | return TCM_RESERVATION_CONFLICT; |
diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c index 9ea0d5f03f7a..be877bf6f730 100644 --- a/drivers/target/target_core_transport.c +++ b/drivers/target/target_core_transport.c | |||
@@ -2292,7 +2292,7 @@ transport_generic_new_cmd(struct se_cmd *cmd) | |||
2292 | * and let it call back once the write buffers are ready. | 2292 | * and let it call back once the write buffers are ready. |
2293 | */ | 2293 | */ |
2294 | target_add_to_state_list(cmd); | 2294 | target_add_to_state_list(cmd); |
2295 | if (cmd->data_direction != DMA_TO_DEVICE) { | 2295 | if (cmd->data_direction != DMA_TO_DEVICE || cmd->data_length == 0) { |
2296 | target_execute_cmd(cmd); | 2296 | target_execute_cmd(cmd); |
2297 | return 0; | 2297 | return 0; |
2298 | } | 2298 | } |
diff --git a/drivers/thermal/cpu_cooling.c b/drivers/thermal/cpu_cooling.c index 1ab0018271c5..ad09e51ffae4 100644 --- a/drivers/thermal/cpu_cooling.c +++ b/drivers/thermal/cpu_cooling.c | |||
@@ -50,15 +50,14 @@ struct cpufreq_cooling_device { | |||
50 | unsigned int cpufreq_state; | 50 | unsigned int cpufreq_state; |
51 | unsigned int cpufreq_val; | 51 | unsigned int cpufreq_val; |
52 | struct cpumask allowed_cpus; | 52 | struct cpumask allowed_cpus; |
53 | struct list_head node; | ||
53 | }; | 54 | }; |
54 | static DEFINE_IDR(cpufreq_idr); | 55 | static DEFINE_IDR(cpufreq_idr); |
55 | static DEFINE_MUTEX(cooling_cpufreq_lock); | 56 | static DEFINE_MUTEX(cooling_cpufreq_lock); |
56 | 57 | ||
57 | static unsigned int cpufreq_dev_count; | 58 | static unsigned int cpufreq_dev_count; |
58 | 59 | ||
59 | /* notify_table passes value to the CPUFREQ_ADJUST callback function. */ | 60 | static LIST_HEAD(cpufreq_dev_list); |
60 | #define NOTIFY_INVALID NULL | ||
61 | static struct cpufreq_cooling_device *notify_device; | ||
62 | 61 | ||
63 | /** | 62 | /** |
64 | * get_idr - function to get a unique id. | 63 | * get_idr - function to get a unique id. |
@@ -287,15 +286,12 @@ static int cpufreq_apply_cooling(struct cpufreq_cooling_device *cpufreq_device, | |||
287 | 286 | ||
288 | cpufreq_device->cpufreq_state = cooling_state; | 287 | cpufreq_device->cpufreq_state = cooling_state; |
289 | cpufreq_device->cpufreq_val = clip_freq; | 288 | cpufreq_device->cpufreq_val = clip_freq; |
290 | notify_device = cpufreq_device; | ||
291 | 289 | ||
292 | for_each_cpu(cpuid, mask) { | 290 | for_each_cpu(cpuid, mask) { |
293 | if (is_cpufreq_valid(cpuid)) | 291 | if (is_cpufreq_valid(cpuid)) |
294 | cpufreq_update_policy(cpuid); | 292 | cpufreq_update_policy(cpuid); |
295 | } | 293 | } |
296 | 294 | ||
297 | notify_device = NOTIFY_INVALID; | ||
298 | |||
299 | return 0; | 295 | return 0; |
300 | } | 296 | } |
301 | 297 | ||
@@ -316,21 +312,28 @@ static int cpufreq_thermal_notifier(struct notifier_block *nb, | |||
316 | { | 312 | { |
317 | struct cpufreq_policy *policy = data; | 313 | struct cpufreq_policy *policy = data; |
318 | unsigned long max_freq = 0; | 314 | unsigned long max_freq = 0; |
315 | struct cpufreq_cooling_device *cpufreq_dev; | ||
319 | 316 | ||
320 | if (event != CPUFREQ_ADJUST || notify_device == NOTIFY_INVALID) | 317 | if (event != CPUFREQ_ADJUST) |
321 | return 0; | 318 | return 0; |
322 | 319 | ||
323 | if (cpumask_test_cpu(policy->cpu, ¬ify_device->allowed_cpus)) | 320 | mutex_lock(&cooling_cpufreq_lock); |
324 | max_freq = notify_device->cpufreq_val; | 321 | list_for_each_entry(cpufreq_dev, &cpufreq_dev_list, node) { |
325 | else | 322 | if (!cpumask_test_cpu(policy->cpu, |
326 | return 0; | 323 | &cpufreq_dev->allowed_cpus)) |
324 | continue; | ||
325 | |||
326 | if (!cpufreq_dev->cpufreq_val) | ||
327 | cpufreq_dev->cpufreq_val = get_cpu_frequency( | ||
328 | cpumask_any(&cpufreq_dev->allowed_cpus), | ||
329 | cpufreq_dev->cpufreq_state); | ||
327 | 330 | ||
328 | /* Never exceed user_policy.max */ | 331 | max_freq = cpufreq_dev->cpufreq_val; |
329 | if (max_freq > policy->user_policy.max) | ||
330 | max_freq = policy->user_policy.max; | ||
331 | 332 | ||
332 | if (policy->max != max_freq) | 333 | if (policy->max != max_freq) |
333 | cpufreq_verify_within_limits(policy, 0, max_freq); | 334 | cpufreq_verify_within_limits(policy, 0, max_freq); |
335 | } | ||
336 | mutex_unlock(&cooling_cpufreq_lock); | ||
334 | 337 | ||
335 | return 0; | 338 | return 0; |
336 | } | 339 | } |
@@ -486,6 +489,7 @@ __cpufreq_cooling_register(struct device_node *np, | |||
486 | cpufreq_register_notifier(&thermal_cpufreq_notifier_block, | 489 | cpufreq_register_notifier(&thermal_cpufreq_notifier_block, |
487 | CPUFREQ_POLICY_NOTIFIER); | 490 | CPUFREQ_POLICY_NOTIFIER); |
488 | cpufreq_dev_count++; | 491 | cpufreq_dev_count++; |
492 | list_add(&cpufreq_dev->node, &cpufreq_dev_list); | ||
489 | 493 | ||
490 | mutex_unlock(&cooling_cpufreq_lock); | 494 | mutex_unlock(&cooling_cpufreq_lock); |
491 | 495 | ||
@@ -549,6 +553,7 @@ void cpufreq_cooling_unregister(struct thermal_cooling_device *cdev) | |||
549 | 553 | ||
550 | cpufreq_dev = cdev->devdata; | 554 | cpufreq_dev = cdev->devdata; |
551 | mutex_lock(&cooling_cpufreq_lock); | 555 | mutex_lock(&cooling_cpufreq_lock); |
556 | list_del(&cpufreq_dev->node); | ||
552 | cpufreq_dev_count--; | 557 | cpufreq_dev_count--; |
553 | 558 | ||
554 | /* Unregister the notifier for the last cpufreq cooling device */ | 559 | /* Unregister the notifier for the last cpufreq cooling device */ |
diff --git a/drivers/thermal/samsung/exynos_thermal_common.c b/drivers/thermal/samsung/exynos_thermal_common.c index 3f5ad25ddca8..b6be572704a4 100644 --- a/drivers/thermal/samsung/exynos_thermal_common.c +++ b/drivers/thermal/samsung/exynos_thermal_common.c | |||
@@ -417,13 +417,10 @@ void exynos_unregister_thermal(struct thermal_sensor_conf *sensor_conf) | |||
417 | 417 | ||
418 | th_zone = sensor_conf->pzone_data; | 418 | th_zone = sensor_conf->pzone_data; |
419 | 419 | ||
420 | if (th_zone->therm_dev) | 420 | thermal_zone_device_unregister(th_zone->therm_dev); |
421 | thermal_zone_device_unregister(th_zone->therm_dev); | ||
422 | 421 | ||
423 | for (i = 0; i < th_zone->cool_dev_size; i++) { | 422 | for (i = 0; i < th_zone->cool_dev_size; ++i) |
424 | if (th_zone->cool_dev[i]) | 423 | cpufreq_cooling_unregister(th_zone->cool_dev[i]); |
425 | cpufreq_cooling_unregister(th_zone->cool_dev[i]); | ||
426 | } | ||
427 | 424 | ||
428 | dev_info(sensor_conf->dev, | 425 | dev_info(sensor_conf->dev, |
429 | "Exynos: Kernel Thermal management unregistered\n"); | 426 | "Exynos: Kernel Thermal management unregistered\n"); |
diff --git a/drivers/thermal/st/st_thermal.c b/drivers/thermal/st/st_thermal.c index 90163b384660..d1ec5804c0bb 100644 --- a/drivers/thermal/st/st_thermal.c +++ b/drivers/thermal/st/st_thermal.c | |||
@@ -275,6 +275,7 @@ int st_thermal_unregister(struct platform_device *pdev) | |||
275 | } | 275 | } |
276 | EXPORT_SYMBOL_GPL(st_thermal_unregister); | 276 | EXPORT_SYMBOL_GPL(st_thermal_unregister); |
277 | 277 | ||
278 | #ifdef CONFIG_PM_SLEEP | ||
278 | static int st_thermal_suspend(struct device *dev) | 279 | static int st_thermal_suspend(struct device *dev) |
279 | { | 280 | { |
280 | struct platform_device *pdev = to_platform_device(dev); | 281 | struct platform_device *pdev = to_platform_device(dev); |
@@ -305,6 +306,8 @@ static int st_thermal_resume(struct device *dev) | |||
305 | 306 | ||
306 | return 0; | 307 | return 0; |
307 | } | 308 | } |
309 | #endif | ||
310 | |||
308 | SIMPLE_DEV_PM_OPS(st_thermal_pm_ops, st_thermal_suspend, st_thermal_resume); | 311 | SIMPLE_DEV_PM_OPS(st_thermal_pm_ops, st_thermal_suspend, st_thermal_resume); |
309 | EXPORT_SYMBOL_GPL(st_thermal_pm_ops); | 312 | EXPORT_SYMBOL_GPL(st_thermal_pm_ops); |
310 | 313 | ||
diff --git a/drivers/tty/serial/of_serial.c b/drivers/tty/serial/of_serial.c index 56982da4a9e9..bf355050eab6 100644 --- a/drivers/tty/serial/of_serial.c +++ b/drivers/tty/serial/of_serial.c | |||
@@ -240,32 +240,6 @@ static int of_platform_serial_remove(struct platform_device *ofdev) | |||
240 | return 0; | 240 | return 0; |
241 | } | 241 | } |
242 | 242 | ||
243 | #ifdef CONFIG_PM_SLEEP | ||
244 | static int of_serial_suspend(struct device *dev) | ||
245 | { | ||
246 | struct of_serial_info *info = dev_get_drvdata(dev); | ||
247 | |||
248 | serial8250_suspend_port(info->line); | ||
249 | if (info->clk) | ||
250 | clk_disable_unprepare(info->clk); | ||
251 | |||
252 | return 0; | ||
253 | } | ||
254 | |||
255 | static int of_serial_resume(struct device *dev) | ||
256 | { | ||
257 | struct of_serial_info *info = dev_get_drvdata(dev); | ||
258 | |||
259 | if (info->clk) | ||
260 | clk_prepare_enable(info->clk); | ||
261 | |||
262 | serial8250_resume_port(info->line); | ||
263 | |||
264 | return 0; | ||
265 | } | ||
266 | #endif | ||
267 | static SIMPLE_DEV_PM_OPS(of_serial_pm_ops, of_serial_suspend, of_serial_resume); | ||
268 | |||
269 | /* | 243 | /* |
270 | * A few common types, add more as needed. | 244 | * A few common types, add more as needed. |
271 | */ | 245 | */ |
@@ -297,7 +271,6 @@ static struct platform_driver of_platform_serial_driver = { | |||
297 | .name = "of_serial", | 271 | .name = "of_serial", |
298 | .owner = THIS_MODULE, | 272 | .owner = THIS_MODULE, |
299 | .of_match_table = of_platform_serial_table, | 273 | .of_match_table = of_platform_serial_table, |
300 | .pm = &of_serial_pm_ops, | ||
301 | }, | 274 | }, |
302 | .probe = of_platform_serial_probe, | 275 | .probe = of_platform_serial_probe, |
303 | .remove = of_platform_serial_remove, | 276 | .remove = of_platform_serial_remove, |
diff --git a/drivers/usb/core/quirks.c b/drivers/usb/core/quirks.c index 39b4081b632d..96fafed92b76 100644 --- a/drivers/usb/core/quirks.c +++ b/drivers/usb/core/quirks.c | |||
@@ -44,6 +44,9 @@ static const struct usb_device_id usb_quirk_list[] = { | |||
44 | /* Creative SB Audigy 2 NX */ | 44 | /* Creative SB Audigy 2 NX */ |
45 | { USB_DEVICE(0x041e, 0x3020), .driver_info = USB_QUIRK_RESET_RESUME }, | 45 | { USB_DEVICE(0x041e, 0x3020), .driver_info = USB_QUIRK_RESET_RESUME }, |
46 | 46 | ||
47 | /* Microsoft Wireless Laser Mouse 6000 Receiver */ | ||
48 | { USB_DEVICE(0x045e, 0x00e1), .driver_info = USB_QUIRK_RESET_RESUME }, | ||
49 | |||
47 | /* Microsoft LifeCam-VX700 v2.0 */ | 50 | /* Microsoft LifeCam-VX700 v2.0 */ |
48 | { USB_DEVICE(0x045e, 0x0770), .driver_info = USB_QUIRK_RESET_RESUME }, | 51 | { USB_DEVICE(0x045e, 0x0770), .driver_info = USB_QUIRK_RESET_RESUME }, |
49 | 52 | ||
diff --git a/drivers/usb/dwc3/ep0.c b/drivers/usb/dwc3/ep0.c index 711b23019d54..df38e7ef4976 100644 --- a/drivers/usb/dwc3/ep0.c +++ b/drivers/usb/dwc3/ep0.c | |||
@@ -791,6 +791,10 @@ static void dwc3_ep0_complete_data(struct dwc3 *dwc, | |||
791 | 791 | ||
792 | trb = dwc->ep0_trb; | 792 | trb = dwc->ep0_trb; |
793 | 793 | ||
794 | r = next_request(&ep0->request_list); | ||
795 | if (!r) | ||
796 | return; | ||
797 | |||
794 | status = DWC3_TRB_SIZE_TRBSTS(trb->size); | 798 | status = DWC3_TRB_SIZE_TRBSTS(trb->size); |
795 | if (status == DWC3_TRBSTS_SETUP_PENDING) { | 799 | if (status == DWC3_TRBSTS_SETUP_PENDING) { |
796 | dwc3_trace(trace_dwc3_ep0, "Setup Pending received"); | 800 | dwc3_trace(trace_dwc3_ep0, "Setup Pending received"); |
@@ -801,10 +805,6 @@ static void dwc3_ep0_complete_data(struct dwc3 *dwc, | |||
801 | return; | 805 | return; |
802 | } | 806 | } |
803 | 807 | ||
804 | r = next_request(&ep0->request_list); | ||
805 | if (!r) | ||
806 | return; | ||
807 | |||
808 | ur = &r->request; | 808 | ur = &r->request; |
809 | 809 | ||
810 | length = trb->size & DWC3_TRB_SIZE_MASK; | 810 | length = trb->size & DWC3_TRB_SIZE_MASK; |
diff --git a/drivers/usb/host/xhci-hub.c b/drivers/usb/host/xhci-hub.c index 696160d48ae8..388cfd83b6b6 100644 --- a/drivers/usb/host/xhci-hub.c +++ b/drivers/usb/host/xhci-hub.c | |||
@@ -22,7 +22,6 @@ | |||
22 | 22 | ||
23 | 23 | ||
24 | #include <linux/slab.h> | 24 | #include <linux/slab.h> |
25 | #include <linux/device.h> | ||
26 | #include <asm/unaligned.h> | 25 | #include <asm/unaligned.h> |
27 | 26 | ||
28 | #include "xhci.h" | 27 | #include "xhci.h" |
@@ -1149,9 +1148,7 @@ int xhci_bus_suspend(struct usb_hcd *hcd) | |||
1149 | * including the USB 3.0 roothub, but only if CONFIG_PM_RUNTIME | 1148 | * including the USB 3.0 roothub, but only if CONFIG_PM_RUNTIME |
1150 | * is enabled, so also enable remote wake here. | 1149 | * is enabled, so also enable remote wake here. |
1151 | */ | 1150 | */ |
1152 | if (hcd->self.root_hub->do_remote_wakeup | 1151 | if (hcd->self.root_hub->do_remote_wakeup) { |
1153 | && device_may_wakeup(hcd->self.controller)) { | ||
1154 | |||
1155 | if (t1 & PORT_CONNECT) { | 1152 | if (t1 & PORT_CONNECT) { |
1156 | t2 |= PORT_WKOC_E | PORT_WKDISC_E; | 1153 | t2 |= PORT_WKOC_E | PORT_WKDISC_E; |
1157 | t2 &= ~PORT_WKCONN_E; | 1154 | t2 &= ~PORT_WKCONN_E; |
diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c index 9a69b1f1b300..142b601f9563 100644 --- a/drivers/usb/host/xhci-pci.c +++ b/drivers/usb/host/xhci-pci.c | |||
@@ -281,7 +281,7 @@ static int xhci_pci_suspend(struct usb_hcd *hcd, bool do_wakeup) | |||
281 | if (xhci->quirks & XHCI_COMP_MODE_QUIRK) | 281 | if (xhci->quirks & XHCI_COMP_MODE_QUIRK) |
282 | pdev->no_d3cold = true; | 282 | pdev->no_d3cold = true; |
283 | 283 | ||
284 | return xhci_suspend(xhci); | 284 | return xhci_suspend(xhci, do_wakeup); |
285 | } | 285 | } |
286 | 286 | ||
287 | static int xhci_pci_resume(struct usb_hcd *hcd, bool hibernated) | 287 | static int xhci_pci_resume(struct usb_hcd *hcd, bool hibernated) |
diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c index 3d78b0cd674b..646300cbe5f7 100644 --- a/drivers/usb/host/xhci-plat.c +++ b/drivers/usb/host/xhci-plat.c | |||
@@ -204,7 +204,15 @@ static int xhci_plat_suspend(struct device *dev) | |||
204 | struct usb_hcd *hcd = dev_get_drvdata(dev); | 204 | struct usb_hcd *hcd = dev_get_drvdata(dev); |
205 | struct xhci_hcd *xhci = hcd_to_xhci(hcd); | 205 | struct xhci_hcd *xhci = hcd_to_xhci(hcd); |
206 | 206 | ||
207 | return xhci_suspend(xhci); | 207 | /* |
208 | * xhci_suspend() needs `do_wakeup` to know whether host is allowed | ||
209 | * to do wakeup during suspend. Since xhci_plat_suspend is currently | ||
210 | * only designed for system suspend, device_may_wakeup() is enough | ||
211 | * to dertermine whether host is allowed to do wakeup. Need to | ||
212 | * reconsider this when xhci_plat_suspend enlarges its scope, e.g., | ||
213 | * also applies to runtime suspend. | ||
214 | */ | ||
215 | return xhci_suspend(xhci, device_may_wakeup(dev)); | ||
208 | } | 216 | } |
209 | 217 | ||
210 | static int xhci_plat_resume(struct device *dev) | 218 | static int xhci_plat_resume(struct device *dev) |
diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c index bc6fcbc16f61..06433aec81d7 100644 --- a/drivers/usb/host/xhci-ring.c +++ b/drivers/usb/host/xhci-ring.c | |||
@@ -1067,9 +1067,8 @@ static void xhci_handle_cmd_reset_ep(struct xhci_hcd *xhci, int slot_id, | |||
1067 | false); | 1067 | false); |
1068 | xhci_ring_cmd_db(xhci); | 1068 | xhci_ring_cmd_db(xhci); |
1069 | } else { | 1069 | } else { |
1070 | /* Clear our internal halted state and restart the ring(s) */ | 1070 | /* Clear our internal halted state */ |
1071 | xhci->devs[slot_id]->eps[ep_index].ep_state &= ~EP_HALTED; | 1071 | xhci->devs[slot_id]->eps[ep_index].ep_state &= ~EP_HALTED; |
1072 | ring_doorbell_for_active_rings(xhci, slot_id, ep_index); | ||
1073 | } | 1072 | } |
1074 | } | 1073 | } |
1075 | 1074 | ||
@@ -1823,22 +1822,13 @@ static int finish_td(struct xhci_hcd *xhci, struct xhci_td *td, | |||
1823 | ep->stopped_td = td; | 1822 | ep->stopped_td = td; |
1824 | return 0; | 1823 | return 0; |
1825 | } else { | 1824 | } else { |
1826 | if (trb_comp_code == COMP_STALL) { | 1825 | if (trb_comp_code == COMP_STALL || |
1827 | /* The transfer is completed from the driver's | 1826 | xhci_requires_manual_halt_cleanup(xhci, ep_ctx, |
1828 | * perspective, but we need to issue a set dequeue | 1827 | trb_comp_code)) { |
1829 | * command for this stalled endpoint to move the dequeue | 1828 | /* Issue a reset endpoint command to clear the host side |
1830 | * pointer past the TD. We can't do that here because | 1829 | * halt, followed by a set dequeue command to move the |
1831 | * the halt condition must be cleared first. Let the | 1830 | * dequeue pointer past the TD. |
1832 | * USB class driver clear the stall later. | 1831 | * The class driver clears the device side halt later. |
1833 | */ | ||
1834 | ep->stopped_td = td; | ||
1835 | ep->stopped_stream = ep_ring->stream_id; | ||
1836 | } else if (xhci_requires_manual_halt_cleanup(xhci, | ||
1837 | ep_ctx, trb_comp_code)) { | ||
1838 | /* Other types of errors halt the endpoint, but the | ||
1839 | * class driver doesn't call usb_reset_endpoint() unless | ||
1840 | * the error is -EPIPE. Clear the halted status in the | ||
1841 | * xHCI hardware manually. | ||
1842 | */ | 1832 | */ |
1843 | xhci_cleanup_halted_endpoint(xhci, | 1833 | xhci_cleanup_halted_endpoint(xhci, |
1844 | slot_id, ep_index, ep_ring->stream_id, | 1834 | slot_id, ep_index, ep_ring->stream_id, |
@@ -1958,9 +1948,7 @@ static int process_ctrl_td(struct xhci_hcd *xhci, struct xhci_td *td, | |||
1958 | else | 1948 | else |
1959 | td->urb->actual_length = 0; | 1949 | td->urb->actual_length = 0; |
1960 | 1950 | ||
1961 | xhci_cleanup_halted_endpoint(xhci, | 1951 | return finish_td(xhci, td, event_trb, event, ep, status, false); |
1962 | slot_id, ep_index, 0, td, event_trb); | ||
1963 | return finish_td(xhci, td, event_trb, event, ep, status, true); | ||
1964 | } | 1952 | } |
1965 | /* | 1953 | /* |
1966 | * Did we transfer any data, despite the errors that might have | 1954 | * Did we transfer any data, despite the errors that might have |
@@ -2519,17 +2507,8 @@ cleanup: | |||
2519 | if (ret) { | 2507 | if (ret) { |
2520 | urb = td->urb; | 2508 | urb = td->urb; |
2521 | urb_priv = urb->hcpriv; | 2509 | urb_priv = urb->hcpriv; |
2522 | /* Leave the TD around for the reset endpoint function | 2510 | |
2523 | * to use(but only if it's not a control endpoint, | 2511 | xhci_urb_free_priv(xhci, urb_priv); |
2524 | * since we already queued the Set TR dequeue pointer | ||
2525 | * command for stalled control endpoints). | ||
2526 | */ | ||
2527 | if (usb_endpoint_xfer_control(&urb->ep->desc) || | ||
2528 | (trb_comp_code != COMP_STALL && | ||
2529 | trb_comp_code != COMP_BABBLE)) | ||
2530 | xhci_urb_free_priv(xhci, urb_priv); | ||
2531 | else | ||
2532 | kfree(urb_priv); | ||
2533 | 2512 | ||
2534 | usb_hcd_unlink_urb_from_ep(bus_to_hcd(urb->dev->bus), urb); | 2513 | usb_hcd_unlink_urb_from_ep(bus_to_hcd(urb->dev->bus), urb); |
2535 | if ((urb->actual_length != urb->transfer_buffer_length && | 2514 | if ((urb->actual_length != urb->transfer_buffer_length && |
diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c index 2a5d45b4cb15..033b46c470bd 100644 --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c | |||
@@ -35,6 +35,8 @@ | |||
35 | #define DRIVER_AUTHOR "Sarah Sharp" | 35 | #define DRIVER_AUTHOR "Sarah Sharp" |
36 | #define DRIVER_DESC "'eXtensible' Host Controller (xHC) Driver" | 36 | #define DRIVER_DESC "'eXtensible' Host Controller (xHC) Driver" |
37 | 37 | ||
38 | #define PORT_WAKE_BITS (PORT_WKOC_E | PORT_WKDISC_E | PORT_WKCONN_E) | ||
39 | |||
38 | /* Some 0.95 hardware can't handle the chain bit on a Link TRB being cleared */ | 40 | /* Some 0.95 hardware can't handle the chain bit on a Link TRB being cleared */ |
39 | static int link_quirk; | 41 | static int link_quirk; |
40 | module_param(link_quirk, int, S_IRUGO | S_IWUSR); | 42 | module_param(link_quirk, int, S_IRUGO | S_IWUSR); |
@@ -851,13 +853,47 @@ static void xhci_clear_command_ring(struct xhci_hcd *xhci) | |||
851 | xhci_set_cmd_ring_deq(xhci); | 853 | xhci_set_cmd_ring_deq(xhci); |
852 | } | 854 | } |
853 | 855 | ||
856 | static void xhci_disable_port_wake_on_bits(struct xhci_hcd *xhci) | ||
857 | { | ||
858 | int port_index; | ||
859 | __le32 __iomem **port_array; | ||
860 | unsigned long flags; | ||
861 | u32 t1, t2; | ||
862 | |||
863 | spin_lock_irqsave(&xhci->lock, flags); | ||
864 | |||
865 | /* disble usb3 ports Wake bits*/ | ||
866 | port_index = xhci->num_usb3_ports; | ||
867 | port_array = xhci->usb3_ports; | ||
868 | while (port_index--) { | ||
869 | t1 = readl(port_array[port_index]); | ||
870 | t1 = xhci_port_state_to_neutral(t1); | ||
871 | t2 = t1 & ~PORT_WAKE_BITS; | ||
872 | if (t1 != t2) | ||
873 | writel(t2, port_array[port_index]); | ||
874 | } | ||
875 | |||
876 | /* disble usb2 ports Wake bits*/ | ||
877 | port_index = xhci->num_usb2_ports; | ||
878 | port_array = xhci->usb2_ports; | ||
879 | while (port_index--) { | ||
880 | t1 = readl(port_array[port_index]); | ||
881 | t1 = xhci_port_state_to_neutral(t1); | ||
882 | t2 = t1 & ~PORT_WAKE_BITS; | ||
883 | if (t1 != t2) | ||
884 | writel(t2, port_array[port_index]); | ||
885 | } | ||
886 | |||
887 | spin_unlock_irqrestore(&xhci->lock, flags); | ||
888 | } | ||
889 | |||
854 | /* | 890 | /* |
855 | * Stop HC (not bus-specific) | 891 | * Stop HC (not bus-specific) |
856 | * | 892 | * |
857 | * This is called when the machine transition into S3/S4 mode. | 893 | * This is called when the machine transition into S3/S4 mode. |
858 | * | 894 | * |
859 | */ | 895 | */ |
860 | int xhci_suspend(struct xhci_hcd *xhci) | 896 | int xhci_suspend(struct xhci_hcd *xhci, bool do_wakeup) |
861 | { | 897 | { |
862 | int rc = 0; | 898 | int rc = 0; |
863 | unsigned int delay = XHCI_MAX_HALT_USEC; | 899 | unsigned int delay = XHCI_MAX_HALT_USEC; |
@@ -868,6 +904,10 @@ int xhci_suspend(struct xhci_hcd *xhci) | |||
868 | xhci->shared_hcd->state != HC_STATE_SUSPENDED) | 904 | xhci->shared_hcd->state != HC_STATE_SUSPENDED) |
869 | return -EINVAL; | 905 | return -EINVAL; |
870 | 906 | ||
907 | /* Clear root port wake on bits if wakeup not allowed. */ | ||
908 | if (!do_wakeup) | ||
909 | xhci_disable_port_wake_on_bits(xhci); | ||
910 | |||
871 | /* Don't poll the roothubs on bus suspend. */ | 911 | /* Don't poll the roothubs on bus suspend. */ |
872 | xhci_dbg(xhci, "%s: stopping port polling.\n", __func__); | 912 | xhci_dbg(xhci, "%s: stopping port polling.\n", __func__); |
873 | clear_bit(HCD_FLAG_POLL_RH, &hcd->flags); | 913 | clear_bit(HCD_FLAG_POLL_RH, &hcd->flags); |
@@ -2912,68 +2952,33 @@ void xhci_cleanup_stalled_ring(struct xhci_hcd *xhci, | |||
2912 | } | 2952 | } |
2913 | } | 2953 | } |
2914 | 2954 | ||
2915 | /* Deal with stalled endpoints. The core should have sent the control message | 2955 | /* Called when clearing halted device. The core should have sent the control |
2916 | * to clear the halt condition. However, we need to make the xHCI hardware | 2956 | * message to clear the device halt condition. The host side of the halt should |
2917 | * reset its sequence number, since a device will expect a sequence number of | 2957 | * already be cleared with a reset endpoint command issued when the STALL tx |
2918 | * zero after the halt condition is cleared. | 2958 | * event was received. |
2959 | * | ||
2919 | * Context: in_interrupt | 2960 | * Context: in_interrupt |
2920 | */ | 2961 | */ |
2962 | |||
2921 | void xhci_endpoint_reset(struct usb_hcd *hcd, | 2963 | void xhci_endpoint_reset(struct usb_hcd *hcd, |
2922 | struct usb_host_endpoint *ep) | 2964 | struct usb_host_endpoint *ep) |
2923 | { | 2965 | { |
2924 | struct xhci_hcd *xhci; | 2966 | struct xhci_hcd *xhci; |
2925 | struct usb_device *udev; | ||
2926 | unsigned int ep_index; | ||
2927 | unsigned long flags; | ||
2928 | int ret; | ||
2929 | struct xhci_virt_ep *virt_ep; | ||
2930 | struct xhci_command *command; | ||
2931 | 2967 | ||
2932 | xhci = hcd_to_xhci(hcd); | 2968 | xhci = hcd_to_xhci(hcd); |
2933 | udev = (struct usb_device *) ep->hcpriv; | ||
2934 | /* Called with a root hub endpoint (or an endpoint that wasn't added | ||
2935 | * with xhci_add_endpoint() | ||
2936 | */ | ||
2937 | if (!ep->hcpriv) | ||
2938 | return; | ||
2939 | ep_index = xhci_get_endpoint_index(&ep->desc); | ||
2940 | virt_ep = &xhci->devs[udev->slot_id]->eps[ep_index]; | ||
2941 | if (!virt_ep->stopped_td) { | ||
2942 | xhci_dbg_trace(xhci, trace_xhci_dbg_reset_ep, | ||
2943 | "Endpoint 0x%x not halted, refusing to reset.", | ||
2944 | ep->desc.bEndpointAddress); | ||
2945 | return; | ||
2946 | } | ||
2947 | if (usb_endpoint_xfer_control(&ep->desc)) { | ||
2948 | xhci_dbg_trace(xhci, trace_xhci_dbg_reset_ep, | ||
2949 | "Control endpoint stall already handled."); | ||
2950 | return; | ||
2951 | } | ||
2952 | 2969 | ||
2953 | command = xhci_alloc_command(xhci, false, false, GFP_ATOMIC); | ||
2954 | if (!command) | ||
2955 | return; | ||
2956 | |||
2957 | xhci_dbg_trace(xhci, trace_xhci_dbg_reset_ep, | ||
2958 | "Queueing reset endpoint command"); | ||
2959 | spin_lock_irqsave(&xhci->lock, flags); | ||
2960 | ret = xhci_queue_reset_ep(xhci, command, udev->slot_id, ep_index); | ||
2961 | /* | 2970 | /* |
2962 | * Can't change the ring dequeue pointer until it's transitioned to the | 2971 | * We might need to implement the config ep cmd in xhci 4.8.1 note: |
2963 | * stopped state, which is only upon a successful reset endpoint | 2972 | * The Reset Endpoint Command may only be issued to endpoints in the |
2964 | * command. Better hope that last command worked! | 2973 | * Halted state. If software wishes reset the Data Toggle or Sequence |
2974 | * Number of an endpoint that isn't in the Halted state, then software | ||
2975 | * may issue a Configure Endpoint Command with the Drop and Add bits set | ||
2976 | * for the target endpoint. that is in the Stopped state. | ||
2965 | */ | 2977 | */ |
2966 | if (!ret) { | ||
2967 | xhci_cleanup_stalled_ring(xhci, udev, ep_index); | ||
2968 | kfree(virt_ep->stopped_td); | ||
2969 | xhci_ring_cmd_db(xhci); | ||
2970 | } | ||
2971 | virt_ep->stopped_td = NULL; | ||
2972 | virt_ep->stopped_stream = 0; | ||
2973 | spin_unlock_irqrestore(&xhci->lock, flags); | ||
2974 | 2978 | ||
2975 | if (ret) | 2979 | /* For now just print debug to follow the situation */ |
2976 | xhci_warn(xhci, "FIXME allocate a new ring segment\n"); | 2980 | xhci_dbg(xhci, "Endpoint 0x%x ep reset callback called\n", |
2981 | ep->desc.bEndpointAddress); | ||
2977 | } | 2982 | } |
2978 | 2983 | ||
2979 | static int xhci_check_streams_endpoint(struct xhci_hcd *xhci, | 2984 | static int xhci_check_streams_endpoint(struct xhci_hcd *xhci, |
diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h index df76d642e719..d745715a1e2f 100644 --- a/drivers/usb/host/xhci.h +++ b/drivers/usb/host/xhci.h | |||
@@ -1746,7 +1746,7 @@ int xhci_gen_setup(struct usb_hcd *hcd, xhci_get_quirks_t get_quirks); | |||
1746 | void xhci_init_driver(struct hc_driver *drv, int (*setup_fn)(struct usb_hcd *)); | 1746 | void xhci_init_driver(struct hc_driver *drv, int (*setup_fn)(struct usb_hcd *)); |
1747 | 1747 | ||
1748 | #ifdef CONFIG_PM | 1748 | #ifdef CONFIG_PM |
1749 | int xhci_suspend(struct xhci_hcd *xhci); | 1749 | int xhci_suspend(struct xhci_hcd *xhci, bool do_wakeup); |
1750 | int xhci_resume(struct xhci_hcd *xhci, bool hibernated); | 1750 | int xhci_resume(struct xhci_hcd *xhci, bool hibernated); |
1751 | #else | 1751 | #else |
1752 | #define xhci_suspend NULL | 1752 | #define xhci_suspend NULL |
diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c index cfd009dc4018..6c4eb3cf5efd 100644 --- a/drivers/usb/serial/cp210x.c +++ b/drivers/usb/serial/cp210x.c | |||
@@ -120,6 +120,7 @@ static const struct usb_device_id id_table[] = { | |||
120 | { USB_DEVICE(0x10C4, 0x85F8) }, /* Virtenio Preon32 */ | 120 | { USB_DEVICE(0x10C4, 0x85F8) }, /* Virtenio Preon32 */ |
121 | { USB_DEVICE(0x10C4, 0x8664) }, /* AC-Services CAN-IF */ | 121 | { USB_DEVICE(0x10C4, 0x8664) }, /* AC-Services CAN-IF */ |
122 | { USB_DEVICE(0x10C4, 0x8665) }, /* AC-Services OBD-IF */ | 122 | { USB_DEVICE(0x10C4, 0x8665) }, /* AC-Services OBD-IF */ |
123 | { USB_DEVICE(0x10C4, 0x8875) }, /* CEL MeshConnect USB Stick */ | ||
123 | { USB_DEVICE(0x10C4, 0x88A4) }, /* MMB Networks ZigBee USB Device */ | 124 | { USB_DEVICE(0x10C4, 0x88A4) }, /* MMB Networks ZigBee USB Device */ |
124 | { USB_DEVICE(0x10C4, 0x88A5) }, /* Planet Innovation Ingeni ZigBee USB Device */ | 125 | { USB_DEVICE(0x10C4, 0x88A5) }, /* Planet Innovation Ingeni ZigBee USB Device */ |
125 | { USB_DEVICE(0x10C4, 0x8946) }, /* Ketra N1 Wireless Interface */ | 126 | { USB_DEVICE(0x10C4, 0x8946) }, /* Ketra N1 Wireless Interface */ |
diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c index 0dad8ce5a609..1ebb351b9e9a 100644 --- a/drivers/usb/serial/ftdi_sio.c +++ b/drivers/usb/serial/ftdi_sio.c | |||
@@ -470,6 +470,39 @@ static const struct usb_device_id id_table_combined[] = { | |||
470 | { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01FD_PID) }, | 470 | { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01FD_PID) }, |
471 | { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01FE_PID) }, | 471 | { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01FE_PID) }, |
472 | { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01FF_PID) }, | 472 | { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01FF_PID) }, |
473 | { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_4701_PID) }, | ||
474 | { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_9300_PID) }, | ||
475 | { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_9301_PID) }, | ||
476 | { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_9302_PID) }, | ||
477 | { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_9303_PID) }, | ||
478 | { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_9304_PID) }, | ||
479 | { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_9305_PID) }, | ||
480 | { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_9306_PID) }, | ||
481 | { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_9307_PID) }, | ||
482 | { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_9308_PID) }, | ||
483 | { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_9309_PID) }, | ||
484 | { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_930A_PID) }, | ||
485 | { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_930B_PID) }, | ||
486 | { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_930C_PID) }, | ||
487 | { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_930D_PID) }, | ||
488 | { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_930E_PID) }, | ||
489 | { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_930F_PID) }, | ||
490 | { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_9310_PID) }, | ||
491 | { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_9311_PID) }, | ||
492 | { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_9312_PID) }, | ||
493 | { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_9313_PID) }, | ||
494 | { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_9314_PID) }, | ||
495 | { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_9315_PID) }, | ||
496 | { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_9316_PID) }, | ||
497 | { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_9317_PID) }, | ||
498 | { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_9318_PID) }, | ||
499 | { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_9319_PID) }, | ||
500 | { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_931A_PID) }, | ||
501 | { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_931B_PID) }, | ||
502 | { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_931C_PID) }, | ||
503 | { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_931D_PID) }, | ||
504 | { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_931E_PID) }, | ||
505 | { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_931F_PID) }, | ||
473 | { USB_DEVICE(FTDI_VID, FTDI_PERLE_ULTRAPORT_PID) }, | 506 | { USB_DEVICE(FTDI_VID, FTDI_PERLE_ULTRAPORT_PID) }, |
474 | { USB_DEVICE(FTDI_VID, FTDI_PIEGROUP_PID) }, | 507 | { USB_DEVICE(FTDI_VID, FTDI_PIEGROUP_PID) }, |
475 | { USB_DEVICE(FTDI_VID, FTDI_TNC_X_PID) }, | 508 | { USB_DEVICE(FTDI_VID, FTDI_TNC_X_PID) }, |
diff --git a/drivers/usb/serial/ftdi_sio_ids.h b/drivers/usb/serial/ftdi_sio_ids.h index 6786b705ccf6..e52409c9be99 100644 --- a/drivers/usb/serial/ftdi_sio_ids.h +++ b/drivers/usb/serial/ftdi_sio_ids.h | |||
@@ -926,8 +926,8 @@ | |||
926 | #define BAYER_CONTOUR_CABLE_PID 0x6001 | 926 | #define BAYER_CONTOUR_CABLE_PID 0x6001 |
927 | 927 | ||
928 | /* | 928 | /* |
929 | * The following are the values for the Matrix Orbital FTDI Range | 929 | * Matrix Orbital Intelligent USB displays. |
930 | * Anything in this range will use an FT232RL. | 930 | * http://www.matrixorbital.com |
931 | */ | 931 | */ |
932 | #define MTXORB_VID 0x1B3D | 932 | #define MTXORB_VID 0x1B3D |
933 | #define MTXORB_FTDI_RANGE_0100_PID 0x0100 | 933 | #define MTXORB_FTDI_RANGE_0100_PID 0x0100 |
@@ -1186,8 +1186,39 @@ | |||
1186 | #define MTXORB_FTDI_RANGE_01FD_PID 0x01FD | 1186 | #define MTXORB_FTDI_RANGE_01FD_PID 0x01FD |
1187 | #define MTXORB_FTDI_RANGE_01FE_PID 0x01FE | 1187 | #define MTXORB_FTDI_RANGE_01FE_PID 0x01FE |
1188 | #define MTXORB_FTDI_RANGE_01FF_PID 0x01FF | 1188 | #define MTXORB_FTDI_RANGE_01FF_PID 0x01FF |
1189 | 1189 | #define MTXORB_FTDI_RANGE_4701_PID 0x4701 | |
1190 | 1190 | #define MTXORB_FTDI_RANGE_9300_PID 0x9300 | |
1191 | #define MTXORB_FTDI_RANGE_9301_PID 0x9301 | ||
1192 | #define MTXORB_FTDI_RANGE_9302_PID 0x9302 | ||
1193 | #define MTXORB_FTDI_RANGE_9303_PID 0x9303 | ||
1194 | #define MTXORB_FTDI_RANGE_9304_PID 0x9304 | ||
1195 | #define MTXORB_FTDI_RANGE_9305_PID 0x9305 | ||
1196 | #define MTXORB_FTDI_RANGE_9306_PID 0x9306 | ||
1197 | #define MTXORB_FTDI_RANGE_9307_PID 0x9307 | ||
1198 | #define MTXORB_FTDI_RANGE_9308_PID 0x9308 | ||
1199 | #define MTXORB_FTDI_RANGE_9309_PID 0x9309 | ||
1200 | #define MTXORB_FTDI_RANGE_930A_PID 0x930A | ||
1201 | #define MTXORB_FTDI_RANGE_930B_PID 0x930B | ||
1202 | #define MTXORB_FTDI_RANGE_930C_PID 0x930C | ||
1203 | #define MTXORB_FTDI_RANGE_930D_PID 0x930D | ||
1204 | #define MTXORB_FTDI_RANGE_930E_PID 0x930E | ||
1205 | #define MTXORB_FTDI_RANGE_930F_PID 0x930F | ||
1206 | #define MTXORB_FTDI_RANGE_9310_PID 0x9310 | ||
1207 | #define MTXORB_FTDI_RANGE_9311_PID 0x9311 | ||
1208 | #define MTXORB_FTDI_RANGE_9312_PID 0x9312 | ||
1209 | #define MTXORB_FTDI_RANGE_9313_PID 0x9313 | ||
1210 | #define MTXORB_FTDI_RANGE_9314_PID 0x9314 | ||
1211 | #define MTXORB_FTDI_RANGE_9315_PID 0x9315 | ||
1212 | #define MTXORB_FTDI_RANGE_9316_PID 0x9316 | ||
1213 | #define MTXORB_FTDI_RANGE_9317_PID 0x9317 | ||
1214 | #define MTXORB_FTDI_RANGE_9318_PID 0x9318 | ||
1215 | #define MTXORB_FTDI_RANGE_9319_PID 0x9319 | ||
1216 | #define MTXORB_FTDI_RANGE_931A_PID 0x931A | ||
1217 | #define MTXORB_FTDI_RANGE_931B_PID 0x931B | ||
1218 | #define MTXORB_FTDI_RANGE_931C_PID 0x931C | ||
1219 | #define MTXORB_FTDI_RANGE_931D_PID 0x931D | ||
1220 | #define MTXORB_FTDI_RANGE_931E_PID 0x931E | ||
1221 | #define MTXORB_FTDI_RANGE_931F_PID 0x931F | ||
1191 | 1222 | ||
1192 | /* | 1223 | /* |
1193 | * The Mobility Lab (TML) | 1224 | * The Mobility Lab (TML) |
diff --git a/drivers/usb/serial/keyspan.c b/drivers/usb/serial/keyspan.c index 93cb7cebda62..077c714f1285 100644 --- a/drivers/usb/serial/keyspan.c +++ b/drivers/usb/serial/keyspan.c | |||
@@ -311,24 +311,30 @@ static void usa26_indat_callback(struct urb *urb) | |||
311 | if ((data[0] & 0x80) == 0) { | 311 | if ((data[0] & 0x80) == 0) { |
312 | /* no errors on individual bytes, only | 312 | /* no errors on individual bytes, only |
313 | possible overrun err */ | 313 | possible overrun err */ |
314 | if (data[0] & RXERROR_OVERRUN) | 314 | if (data[0] & RXERROR_OVERRUN) { |
315 | err = TTY_OVERRUN; | 315 | tty_insert_flip_char(&port->port, 0, |
316 | else | 316 | TTY_OVERRUN); |
317 | err = 0; | 317 | } |
318 | for (i = 1; i < urb->actual_length ; ++i) | 318 | for (i = 1; i < urb->actual_length ; ++i) |
319 | tty_insert_flip_char(&port->port, data[i], err); | 319 | tty_insert_flip_char(&port->port, data[i], |
320 | TTY_NORMAL); | ||
320 | } else { | 321 | } else { |
321 | /* some bytes had errors, every byte has status */ | 322 | /* some bytes had errors, every byte has status */ |
322 | dev_dbg(&port->dev, "%s - RX error!!!!\n", __func__); | 323 | dev_dbg(&port->dev, "%s - RX error!!!!\n", __func__); |
323 | for (i = 0; i + 1 < urb->actual_length; i += 2) { | 324 | for (i = 0; i + 1 < urb->actual_length; i += 2) { |
324 | int stat = data[i], flag = 0; | 325 | int stat = data[i]; |
325 | if (stat & RXERROR_OVERRUN) | 326 | int flag = TTY_NORMAL; |
326 | flag |= TTY_OVERRUN; | 327 | |
327 | if (stat & RXERROR_FRAMING) | 328 | if (stat & RXERROR_OVERRUN) { |
328 | flag |= TTY_FRAME; | 329 | tty_insert_flip_char(&port->port, 0, |
329 | if (stat & RXERROR_PARITY) | 330 | TTY_OVERRUN); |
330 | flag |= TTY_PARITY; | 331 | } |
331 | /* XXX should handle break (0x10) */ | 332 | /* XXX should handle break (0x10) */ |
333 | if (stat & RXERROR_PARITY) | ||
334 | flag = TTY_PARITY; | ||
335 | else if (stat & RXERROR_FRAMING) | ||
336 | flag = TTY_FRAME; | ||
337 | |||
332 | tty_insert_flip_char(&port->port, data[i+1], | 338 | tty_insert_flip_char(&port->port, data[i+1], |
333 | flag); | 339 | flag); |
334 | } | 340 | } |
@@ -649,14 +655,19 @@ static void usa49_indat_callback(struct urb *urb) | |||
649 | } else { | 655 | } else { |
650 | /* some bytes had errors, every byte has status */ | 656 | /* some bytes had errors, every byte has status */ |
651 | for (i = 0; i + 1 < urb->actual_length; i += 2) { | 657 | for (i = 0; i + 1 < urb->actual_length; i += 2) { |
652 | int stat = data[i], flag = 0; | 658 | int stat = data[i]; |
653 | if (stat & RXERROR_OVERRUN) | 659 | int flag = TTY_NORMAL; |
654 | flag |= TTY_OVERRUN; | 660 | |
655 | if (stat & RXERROR_FRAMING) | 661 | if (stat & RXERROR_OVERRUN) { |
656 | flag |= TTY_FRAME; | 662 | tty_insert_flip_char(&port->port, 0, |
657 | if (stat & RXERROR_PARITY) | 663 | TTY_OVERRUN); |
658 | flag |= TTY_PARITY; | 664 | } |
659 | /* XXX should handle break (0x10) */ | 665 | /* XXX should handle break (0x10) */ |
666 | if (stat & RXERROR_PARITY) | ||
667 | flag = TTY_PARITY; | ||
668 | else if (stat & RXERROR_FRAMING) | ||
669 | flag = TTY_FRAME; | ||
670 | |||
660 | tty_insert_flip_char(&port->port, data[i+1], | 671 | tty_insert_flip_char(&port->port, data[i+1], |
661 | flag); | 672 | flag); |
662 | } | 673 | } |
@@ -713,15 +724,19 @@ static void usa49wg_indat_callback(struct urb *urb) | |||
713 | */ | 724 | */ |
714 | for (x = 0; x + 1 < len && | 725 | for (x = 0; x + 1 < len && |
715 | i + 1 < urb->actual_length; x += 2) { | 726 | i + 1 < urb->actual_length; x += 2) { |
716 | int stat = data[i], flag = 0; | 727 | int stat = data[i]; |
728 | int flag = TTY_NORMAL; | ||
717 | 729 | ||
718 | if (stat & RXERROR_OVERRUN) | 730 | if (stat & RXERROR_OVERRUN) { |
719 | flag |= TTY_OVERRUN; | 731 | tty_insert_flip_char(&port->port, 0, |
720 | if (stat & RXERROR_FRAMING) | 732 | TTY_OVERRUN); |
721 | flag |= TTY_FRAME; | 733 | } |
722 | if (stat & RXERROR_PARITY) | ||
723 | flag |= TTY_PARITY; | ||
724 | /* XXX should handle break (0x10) */ | 734 | /* XXX should handle break (0x10) */ |
735 | if (stat & RXERROR_PARITY) | ||
736 | flag = TTY_PARITY; | ||
737 | else if (stat & RXERROR_FRAMING) | ||
738 | flag = TTY_FRAME; | ||
739 | |||
725 | tty_insert_flip_char(&port->port, data[i+1], | 740 | tty_insert_flip_char(&port->port, data[i+1], |
726 | flag); | 741 | flag); |
727 | i += 2; | 742 | i += 2; |
@@ -773,25 +788,31 @@ static void usa90_indat_callback(struct urb *urb) | |||
773 | if ((data[0] & 0x80) == 0) { | 788 | if ((data[0] & 0x80) == 0) { |
774 | /* no errors on individual bytes, only | 789 | /* no errors on individual bytes, only |
775 | possible overrun err*/ | 790 | possible overrun err*/ |
776 | if (data[0] & RXERROR_OVERRUN) | 791 | if (data[0] & RXERROR_OVERRUN) { |
777 | err = TTY_OVERRUN; | 792 | tty_insert_flip_char(&port->port, 0, |
778 | else | 793 | TTY_OVERRUN); |
779 | err = 0; | 794 | } |
780 | for (i = 1; i < urb->actual_length ; ++i) | 795 | for (i = 1; i < urb->actual_length ; ++i) |
781 | tty_insert_flip_char(&port->port, | 796 | tty_insert_flip_char(&port->port, |
782 | data[i], err); | 797 | data[i], TTY_NORMAL); |
783 | } else { | 798 | } else { |
784 | /* some bytes had errors, every byte has status */ | 799 | /* some bytes had errors, every byte has status */ |
785 | dev_dbg(&port->dev, "%s - RX error!!!!\n", __func__); | 800 | dev_dbg(&port->dev, "%s - RX error!!!!\n", __func__); |
786 | for (i = 0; i + 1 < urb->actual_length; i += 2) { | 801 | for (i = 0; i + 1 < urb->actual_length; i += 2) { |
787 | int stat = data[i], flag = 0; | 802 | int stat = data[i]; |
788 | if (stat & RXERROR_OVERRUN) | 803 | int flag = TTY_NORMAL; |
789 | flag |= TTY_OVERRUN; | 804 | |
790 | if (stat & RXERROR_FRAMING) | 805 | if (stat & RXERROR_OVERRUN) { |
791 | flag |= TTY_FRAME; | 806 | tty_insert_flip_char( |
792 | if (stat & RXERROR_PARITY) | 807 | &port->port, 0, |
793 | flag |= TTY_PARITY; | 808 | TTY_OVERRUN); |
809 | } | ||
794 | /* XXX should handle break (0x10) */ | 810 | /* XXX should handle break (0x10) */ |
811 | if (stat & RXERROR_PARITY) | ||
812 | flag = TTY_PARITY; | ||
813 | else if (stat & RXERROR_FRAMING) | ||
814 | flag = TTY_FRAME; | ||
815 | |||
795 | tty_insert_flip_char(&port->port, | 816 | tty_insert_flip_char(&port->port, |
796 | data[i+1], flag); | 817 | data[i+1], flag); |
797 | } | 818 | } |
diff --git a/drivers/usb/serial/ssu100.c b/drivers/usb/serial/ssu100.c index a7fe664b6b7d..70a098de429f 100644 --- a/drivers/usb/serial/ssu100.c +++ b/drivers/usb/serial/ssu100.c | |||
@@ -490,10 +490,9 @@ static void ssu100_update_lsr(struct usb_serial_port *port, u8 lsr, | |||
490 | if (*tty_flag == TTY_NORMAL) | 490 | if (*tty_flag == TTY_NORMAL) |
491 | *tty_flag = TTY_FRAME; | 491 | *tty_flag = TTY_FRAME; |
492 | } | 492 | } |
493 | if (lsr & UART_LSR_OE){ | 493 | if (lsr & UART_LSR_OE) { |
494 | port->icount.overrun++; | 494 | port->icount.overrun++; |
495 | if (*tty_flag == TTY_NORMAL) | 495 | tty_insert_flip_char(&port->port, 0, TTY_OVERRUN); |
496 | *tty_flag = TTY_OVERRUN; | ||
497 | } | 496 | } |
498 | } | 497 | } |
499 | 498 | ||
@@ -511,12 +510,8 @@ static void ssu100_process_read_urb(struct urb *urb) | |||
511 | if ((len >= 4) && | 510 | if ((len >= 4) && |
512 | (packet[0] == 0x1b) && (packet[1] == 0x1b) && | 511 | (packet[0] == 0x1b) && (packet[1] == 0x1b) && |
513 | ((packet[2] == 0x00) || (packet[2] == 0x01))) { | 512 | ((packet[2] == 0x00) || (packet[2] == 0x01))) { |
514 | if (packet[2] == 0x00) { | 513 | if (packet[2] == 0x00) |
515 | ssu100_update_lsr(port, packet[3], &flag); | 514 | ssu100_update_lsr(port, packet[3], &flag); |
516 | if (flag == TTY_OVERRUN) | ||
517 | tty_insert_flip_char(&port->port, 0, | ||
518 | TTY_OVERRUN); | ||
519 | } | ||
520 | if (packet[2] == 0x01) | 515 | if (packet[2] == 0x01) |
521 | ssu100_update_msr(port, packet[3]); | 516 | ssu100_update_msr(port, packet[3]); |
522 | 517 | ||
diff --git a/drivers/usb/storage/unusual_uas.h b/drivers/usb/storage/unusual_uas.h index 2fefaf923e4a..18a283d6de1c 100644 --- a/drivers/usb/storage/unusual_uas.h +++ b/drivers/usb/storage/unusual_uas.h | |||
@@ -103,3 +103,10 @@ UNUSUAL_DEV(0x2109, 0x0711, 0x0000, 0x9999, | |||
103 | "VL711", | 103 | "VL711", |
104 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, | 104 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, |
105 | US_FL_NO_ATA_1X), | 105 | US_FL_NO_ATA_1X), |
106 | |||
107 | /* Reported-by: Hans de Goede <hdegoede@redhat.com> */ | ||
108 | UNUSUAL_DEV(0x4971, 0x1012, 0x0000, 0x9999, | ||
109 | "Hitachi", | ||
110 | "External HDD", | ||
111 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, | ||
112 | US_FL_IGNORE_UAS), | ||
diff --git a/drivers/vhost/scsi.c b/drivers/vhost/scsi.c index 69906cacd04f..a17f11850669 100644 --- a/drivers/vhost/scsi.c +++ b/drivers/vhost/scsi.c | |||
@@ -1312,6 +1312,7 @@ static int | |||
1312 | vhost_scsi_set_endpoint(struct vhost_scsi *vs, | 1312 | vhost_scsi_set_endpoint(struct vhost_scsi *vs, |
1313 | struct vhost_scsi_target *t) | 1313 | struct vhost_scsi_target *t) |
1314 | { | 1314 | { |
1315 | struct se_portal_group *se_tpg; | ||
1315 | struct tcm_vhost_tport *tv_tport; | 1316 | struct tcm_vhost_tport *tv_tport; |
1316 | struct tcm_vhost_tpg *tpg; | 1317 | struct tcm_vhost_tpg *tpg; |
1317 | struct tcm_vhost_tpg **vs_tpg; | 1318 | struct tcm_vhost_tpg **vs_tpg; |
@@ -1359,6 +1360,21 @@ vhost_scsi_set_endpoint(struct vhost_scsi *vs, | |||
1359 | ret = -EEXIST; | 1360 | ret = -EEXIST; |
1360 | goto out; | 1361 | goto out; |
1361 | } | 1362 | } |
1363 | /* | ||
1364 | * In order to ensure individual vhost-scsi configfs | ||
1365 | * groups cannot be removed while in use by vhost ioctl, | ||
1366 | * go ahead and take an explicit se_tpg->tpg_group.cg_item | ||
1367 | * dependency now. | ||
1368 | */ | ||
1369 | se_tpg = &tpg->se_tpg; | ||
1370 | ret = configfs_depend_item(se_tpg->se_tpg_tfo->tf_subsys, | ||
1371 | &se_tpg->tpg_group.cg_item); | ||
1372 | if (ret) { | ||
1373 | pr_warn("configfs_depend_item() failed: %d\n", ret); | ||
1374 | kfree(vs_tpg); | ||
1375 | mutex_unlock(&tpg->tv_tpg_mutex); | ||
1376 | goto out; | ||
1377 | } | ||
1362 | tpg->tv_tpg_vhost_count++; | 1378 | tpg->tv_tpg_vhost_count++; |
1363 | tpg->vhost_scsi = vs; | 1379 | tpg->vhost_scsi = vs; |
1364 | vs_tpg[tpg->tport_tpgt] = tpg; | 1380 | vs_tpg[tpg->tport_tpgt] = tpg; |
@@ -1401,6 +1417,7 @@ static int | |||
1401 | vhost_scsi_clear_endpoint(struct vhost_scsi *vs, | 1417 | vhost_scsi_clear_endpoint(struct vhost_scsi *vs, |
1402 | struct vhost_scsi_target *t) | 1418 | struct vhost_scsi_target *t) |
1403 | { | 1419 | { |
1420 | struct se_portal_group *se_tpg; | ||
1404 | struct tcm_vhost_tport *tv_tport; | 1421 | struct tcm_vhost_tport *tv_tport; |
1405 | struct tcm_vhost_tpg *tpg; | 1422 | struct tcm_vhost_tpg *tpg; |
1406 | struct vhost_virtqueue *vq; | 1423 | struct vhost_virtqueue *vq; |
@@ -1449,6 +1466,13 @@ vhost_scsi_clear_endpoint(struct vhost_scsi *vs, | |||
1449 | vs->vs_tpg[target] = NULL; | 1466 | vs->vs_tpg[target] = NULL; |
1450 | match = true; | 1467 | match = true; |
1451 | mutex_unlock(&tpg->tv_tpg_mutex); | 1468 | mutex_unlock(&tpg->tv_tpg_mutex); |
1469 | /* | ||
1470 | * Release se_tpg->tpg_group.cg_item configfs dependency now | ||
1471 | * to allow vhost-scsi WWPN se_tpg->tpg_group shutdown to occur. | ||
1472 | */ | ||
1473 | se_tpg = &tpg->se_tpg; | ||
1474 | configfs_undepend_item(se_tpg->se_tpg_tfo->tf_subsys, | ||
1475 | &se_tpg->tpg_group.cg_item); | ||
1452 | } | 1476 | } |
1453 | if (match) { | 1477 | if (match) { |
1454 | for (i = 0; i < VHOST_SCSI_MAX_VQ; i++) { | 1478 | for (i = 0; i < VHOST_SCSI_MAX_VQ; i++) { |
diff --git a/drivers/watchdog/s3c2410_wdt.c b/drivers/watchdog/s3c2410_wdt.c index 8532c3e2aea7..1626dc66e763 100644 --- a/drivers/watchdog/s3c2410_wdt.c +++ b/drivers/watchdog/s3c2410_wdt.c | |||
@@ -161,7 +161,7 @@ static const struct s3c2410_wdt_variant drv_data_exynos5420 = { | |||
161 | static const struct s3c2410_wdt_variant drv_data_exynos7 = { | 161 | static const struct s3c2410_wdt_variant drv_data_exynos7 = { |
162 | .disable_reg = EXYNOS5_WDT_DISABLE_REG_OFFSET, | 162 | .disable_reg = EXYNOS5_WDT_DISABLE_REG_OFFSET, |
163 | .mask_reset_reg = EXYNOS5_WDT_MASK_RESET_REG_OFFSET, | 163 | .mask_reset_reg = EXYNOS5_WDT_MASK_RESET_REG_OFFSET, |
164 | .mask_bit = 0, | 164 | .mask_bit = 23, |
165 | .rst_stat_reg = EXYNOS5_RST_STAT_REG_OFFSET, | 165 | .rst_stat_reg = EXYNOS5_RST_STAT_REG_OFFSET, |
166 | .rst_stat_bit = 23, /* A57 WDTRESET */ | 166 | .rst_stat_bit = 23, /* A57 WDTRESET */ |
167 | .quirks = QUIRK_HAS_PMU_CONFIG | QUIRK_HAS_RST_STAT, | 167 | .quirks = QUIRK_HAS_PMU_CONFIG | QUIRK_HAS_RST_STAT, |
diff --git a/fs/Makefile b/fs/Makefile index 34a1b9dea6dd..da0bbb456d3f 100644 --- a/fs/Makefile +++ b/fs/Makefile | |||
@@ -104,7 +104,7 @@ obj-$(CONFIG_QNX6FS_FS) += qnx6/ | |||
104 | obj-$(CONFIG_AUTOFS4_FS) += autofs4/ | 104 | obj-$(CONFIG_AUTOFS4_FS) += autofs4/ |
105 | obj-$(CONFIG_ADFS_FS) += adfs/ | 105 | obj-$(CONFIG_ADFS_FS) += adfs/ |
106 | obj-$(CONFIG_FUSE_FS) += fuse/ | 106 | obj-$(CONFIG_FUSE_FS) += fuse/ |
107 | obj-$(CONFIG_OVERLAYFS_FS) += overlayfs/ | 107 | obj-$(CONFIG_OVERLAY_FS) += overlayfs/ |
108 | obj-$(CONFIG_UDF_FS) += udf/ | 108 | obj-$(CONFIG_UDF_FS) += udf/ |
109 | obj-$(CONFIG_SUN_OPENPROMFS) += openpromfs/ | 109 | obj-$(CONFIG_SUN_OPENPROMFS) += openpromfs/ |
110 | obj-$(CONFIG_OMFS_FS) += omfs/ | 110 | obj-$(CONFIG_OMFS_FS) += omfs/ |
@@ -165,6 +165,15 @@ static struct vfsmount *aio_mnt; | |||
165 | static const struct file_operations aio_ring_fops; | 165 | static const struct file_operations aio_ring_fops; |
166 | static const struct address_space_operations aio_ctx_aops; | 166 | static const struct address_space_operations aio_ctx_aops; |
167 | 167 | ||
168 | /* Backing dev info for aio fs. | ||
169 | * -no dirty page accounting or writeback happens | ||
170 | */ | ||
171 | static struct backing_dev_info aio_fs_backing_dev_info = { | ||
172 | .name = "aiofs", | ||
173 | .state = 0, | ||
174 | .capabilities = BDI_CAP_NO_ACCT_AND_WRITEBACK | BDI_CAP_MAP_COPY, | ||
175 | }; | ||
176 | |||
168 | static struct file *aio_private_file(struct kioctx *ctx, loff_t nr_pages) | 177 | static struct file *aio_private_file(struct kioctx *ctx, loff_t nr_pages) |
169 | { | 178 | { |
170 | struct qstr this = QSTR_INIT("[aio]", 5); | 179 | struct qstr this = QSTR_INIT("[aio]", 5); |
@@ -176,6 +185,7 @@ static struct file *aio_private_file(struct kioctx *ctx, loff_t nr_pages) | |||
176 | 185 | ||
177 | inode->i_mapping->a_ops = &aio_ctx_aops; | 186 | inode->i_mapping->a_ops = &aio_ctx_aops; |
178 | inode->i_mapping->private_data = ctx; | 187 | inode->i_mapping->private_data = ctx; |
188 | inode->i_mapping->backing_dev_info = &aio_fs_backing_dev_info; | ||
179 | inode->i_size = PAGE_SIZE * nr_pages; | 189 | inode->i_size = PAGE_SIZE * nr_pages; |
180 | 190 | ||
181 | path.dentry = d_alloc_pseudo(aio_mnt->mnt_sb, &this); | 191 | path.dentry = d_alloc_pseudo(aio_mnt->mnt_sb, &this); |
@@ -220,6 +230,9 @@ static int __init aio_setup(void) | |||
220 | if (IS_ERR(aio_mnt)) | 230 | if (IS_ERR(aio_mnt)) |
221 | panic("Failed to create aio fs mount."); | 231 | panic("Failed to create aio fs mount."); |
222 | 232 | ||
233 | if (bdi_init(&aio_fs_backing_dev_info)) | ||
234 | panic("Failed to init aio fs backing dev info."); | ||
235 | |||
223 | kiocb_cachep = KMEM_CACHE(kiocb, SLAB_HWCACHE_ALIGN|SLAB_PANIC); | 236 | kiocb_cachep = KMEM_CACHE(kiocb, SLAB_HWCACHE_ALIGN|SLAB_PANIC); |
224 | kioctx_cachep = KMEM_CACHE(kioctx,SLAB_HWCACHE_ALIGN|SLAB_PANIC); | 237 | kioctx_cachep = KMEM_CACHE(kioctx,SLAB_HWCACHE_ALIGN|SLAB_PANIC); |
225 | 238 | ||
@@ -281,11 +294,6 @@ static const struct file_operations aio_ring_fops = { | |||
281 | .mmap = aio_ring_mmap, | 294 | .mmap = aio_ring_mmap, |
282 | }; | 295 | }; |
283 | 296 | ||
284 | static int aio_set_page_dirty(struct page *page) | ||
285 | { | ||
286 | return 0; | ||
287 | } | ||
288 | |||
289 | #if IS_ENABLED(CONFIG_MIGRATION) | 297 | #if IS_ENABLED(CONFIG_MIGRATION) |
290 | static int aio_migratepage(struct address_space *mapping, struct page *new, | 298 | static int aio_migratepage(struct address_space *mapping, struct page *new, |
291 | struct page *old, enum migrate_mode mode) | 299 | struct page *old, enum migrate_mode mode) |
@@ -357,7 +365,7 @@ out: | |||
357 | #endif | 365 | #endif |
358 | 366 | ||
359 | static const struct address_space_operations aio_ctx_aops = { | 367 | static const struct address_space_operations aio_ctx_aops = { |
360 | .set_page_dirty = aio_set_page_dirty, | 368 | .set_page_dirty = __set_page_dirty_no_writeback, |
361 | #if IS_ENABLED(CONFIG_MIGRATION) | 369 | #if IS_ENABLED(CONFIG_MIGRATION) |
362 | .migratepage = aio_migratepage, | 370 | .migratepage = aio_migratepage, |
363 | #endif | 371 | #endif |
@@ -412,7 +420,6 @@ static int aio_setup_ring(struct kioctx *ctx) | |||
412 | pr_debug("pid(%d) page[%d]->count=%d\n", | 420 | pr_debug("pid(%d) page[%d]->count=%d\n", |
413 | current->pid, i, page_count(page)); | 421 | current->pid, i, page_count(page)); |
414 | SetPageUptodate(page); | 422 | SetPageUptodate(page); |
415 | SetPageDirty(page); | ||
416 | unlock_page(page); | 423 | unlock_page(page); |
417 | 424 | ||
418 | ctx->ring_pages[i] = page; | 425 | ctx->ring_pages[i] = page; |
diff --git a/fs/btrfs/compression.c b/fs/btrfs/compression.c index d3220d31d3cb..dcd9be32ac57 100644 --- a/fs/btrfs/compression.c +++ b/fs/btrfs/compression.c | |||
@@ -1011,8 +1011,6 @@ int btrfs_decompress_buf2page(char *buf, unsigned long buf_start, | |||
1011 | bytes = min(bytes, working_bytes); | 1011 | bytes = min(bytes, working_bytes); |
1012 | kaddr = kmap_atomic(page_out); | 1012 | kaddr = kmap_atomic(page_out); |
1013 | memcpy(kaddr + *pg_offset, buf + buf_offset, bytes); | 1013 | memcpy(kaddr + *pg_offset, buf + buf_offset, bytes); |
1014 | if (*pg_index == (vcnt - 1) && *pg_offset == 0) | ||
1015 | memset(kaddr + bytes, 0, PAGE_CACHE_SIZE - bytes); | ||
1016 | kunmap_atomic(kaddr); | 1014 | kunmap_atomic(kaddr); |
1017 | flush_dcache_page(page_out); | 1015 | flush_dcache_page(page_out); |
1018 | 1016 | ||
@@ -1054,3 +1052,34 @@ int btrfs_decompress_buf2page(char *buf, unsigned long buf_start, | |||
1054 | 1052 | ||
1055 | return 1; | 1053 | return 1; |
1056 | } | 1054 | } |
1055 | |||
1056 | /* | ||
1057 | * When uncompressing data, we need to make sure and zero any parts of | ||
1058 | * the biovec that were not filled in by the decompression code. pg_index | ||
1059 | * and pg_offset indicate the last page and the last offset of that page | ||
1060 | * that have been filled in. This will zero everything remaining in the | ||
1061 | * biovec. | ||
1062 | */ | ||
1063 | void btrfs_clear_biovec_end(struct bio_vec *bvec, int vcnt, | ||
1064 | unsigned long pg_index, | ||
1065 | unsigned long pg_offset) | ||
1066 | { | ||
1067 | while (pg_index < vcnt) { | ||
1068 | struct page *page = bvec[pg_index].bv_page; | ||
1069 | unsigned long off = bvec[pg_index].bv_offset; | ||
1070 | unsigned long len = bvec[pg_index].bv_len; | ||
1071 | |||
1072 | if (pg_offset < off) | ||
1073 | pg_offset = off; | ||
1074 | if (pg_offset < off + len) { | ||
1075 | unsigned long bytes = off + len - pg_offset; | ||
1076 | char *kaddr; | ||
1077 | |||
1078 | kaddr = kmap_atomic(page); | ||
1079 | memset(kaddr + pg_offset, 0, bytes); | ||
1080 | kunmap_atomic(kaddr); | ||
1081 | } | ||
1082 | pg_index++; | ||
1083 | pg_offset = 0; | ||
1084 | } | ||
1085 | } | ||
diff --git a/fs/btrfs/compression.h b/fs/btrfs/compression.h index 0c803b4fbf93..d181f70caae0 100644 --- a/fs/btrfs/compression.h +++ b/fs/btrfs/compression.h | |||
@@ -45,7 +45,9 @@ int btrfs_submit_compressed_write(struct inode *inode, u64 start, | |||
45 | unsigned long nr_pages); | 45 | unsigned long nr_pages); |
46 | int btrfs_submit_compressed_read(struct inode *inode, struct bio *bio, | 46 | int btrfs_submit_compressed_read(struct inode *inode, struct bio *bio, |
47 | int mirror_num, unsigned long bio_flags); | 47 | int mirror_num, unsigned long bio_flags); |
48 | 48 | void btrfs_clear_biovec_end(struct bio_vec *bvec, int vcnt, | |
49 | unsigned long pg_index, | ||
50 | unsigned long pg_offset); | ||
49 | struct btrfs_compress_op { | 51 | struct btrfs_compress_op { |
50 | struct list_head *(*alloc_workspace)(void); | 52 | struct list_head *(*alloc_workspace)(void); |
51 | 53 | ||
diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c index 19bc6162fb8e..150822ee0a0b 100644 --- a/fs/btrfs/ctree.c +++ b/fs/btrfs/ctree.c | |||
@@ -80,13 +80,6 @@ noinline void btrfs_clear_path_blocking(struct btrfs_path *p, | |||
80 | { | 80 | { |
81 | int i; | 81 | int i; |
82 | 82 | ||
83 | #ifdef CONFIG_DEBUG_LOCK_ALLOC | ||
84 | /* lockdep really cares that we take all of these spinlocks | ||
85 | * in the right order. If any of the locks in the path are not | ||
86 | * currently blocking, it is going to complain. So, make really | ||
87 | * really sure by forcing the path to blocking before we clear | ||
88 | * the path blocking. | ||
89 | */ | ||
90 | if (held) { | 83 | if (held) { |
91 | btrfs_set_lock_blocking_rw(held, held_rw); | 84 | btrfs_set_lock_blocking_rw(held, held_rw); |
92 | if (held_rw == BTRFS_WRITE_LOCK) | 85 | if (held_rw == BTRFS_WRITE_LOCK) |
@@ -95,7 +88,6 @@ noinline void btrfs_clear_path_blocking(struct btrfs_path *p, | |||
95 | held_rw = BTRFS_READ_LOCK_BLOCKING; | 88 | held_rw = BTRFS_READ_LOCK_BLOCKING; |
96 | } | 89 | } |
97 | btrfs_set_path_blocking(p); | 90 | btrfs_set_path_blocking(p); |
98 | #endif | ||
99 | 91 | ||
100 | for (i = BTRFS_MAX_LEVEL - 1; i >= 0; i--) { | 92 | for (i = BTRFS_MAX_LEVEL - 1; i >= 0; i--) { |
101 | if (p->nodes[i] && p->locks[i]) { | 93 | if (p->nodes[i] && p->locks[i]) { |
@@ -107,10 +99,8 @@ noinline void btrfs_clear_path_blocking(struct btrfs_path *p, | |||
107 | } | 99 | } |
108 | } | 100 | } |
109 | 101 | ||
110 | #ifdef CONFIG_DEBUG_LOCK_ALLOC | ||
111 | if (held) | 102 | if (held) |
112 | btrfs_clear_lock_blocking_rw(held, held_rw); | 103 | btrfs_clear_lock_blocking_rw(held, held_rw); |
113 | #endif | ||
114 | } | 104 | } |
115 | 105 | ||
116 | /* this also releases the path */ | 106 | /* this also releases the path */ |
@@ -2893,7 +2883,7 @@ cow_done: | |||
2893 | } | 2883 | } |
2894 | p->locks[level] = BTRFS_WRITE_LOCK; | 2884 | p->locks[level] = BTRFS_WRITE_LOCK; |
2895 | } else { | 2885 | } else { |
2896 | err = btrfs_try_tree_read_lock(b); | 2886 | err = btrfs_tree_read_lock_atomic(b); |
2897 | if (!err) { | 2887 | if (!err) { |
2898 | btrfs_set_path_blocking(p); | 2888 | btrfs_set_path_blocking(p); |
2899 | btrfs_tree_read_lock(b); | 2889 | btrfs_tree_read_lock(b); |
@@ -3025,7 +3015,7 @@ again: | |||
3025 | } | 3015 | } |
3026 | 3016 | ||
3027 | level = btrfs_header_level(b); | 3017 | level = btrfs_header_level(b); |
3028 | err = btrfs_try_tree_read_lock(b); | 3018 | err = btrfs_tree_read_lock_atomic(b); |
3029 | if (!err) { | 3019 | if (!err) { |
3030 | btrfs_set_path_blocking(p); | 3020 | btrfs_set_path_blocking(p); |
3031 | btrfs_tree_read_lock(b); | 3021 | btrfs_tree_read_lock(b); |
diff --git a/fs/btrfs/locking.c b/fs/btrfs/locking.c index 5665d2149249..f8229ef1b46d 100644 --- a/fs/btrfs/locking.c +++ b/fs/btrfs/locking.c | |||
@@ -128,6 +128,26 @@ again: | |||
128 | } | 128 | } |
129 | 129 | ||
130 | /* | 130 | /* |
131 | * take a spinning read lock. | ||
132 | * returns 1 if we get the read lock and 0 if we don't | ||
133 | * this won't wait for blocking writers | ||
134 | */ | ||
135 | int btrfs_tree_read_lock_atomic(struct extent_buffer *eb) | ||
136 | { | ||
137 | if (atomic_read(&eb->blocking_writers)) | ||
138 | return 0; | ||
139 | |||
140 | read_lock(&eb->lock); | ||
141 | if (atomic_read(&eb->blocking_writers)) { | ||
142 | read_unlock(&eb->lock); | ||
143 | return 0; | ||
144 | } | ||
145 | atomic_inc(&eb->read_locks); | ||
146 | atomic_inc(&eb->spinning_readers); | ||
147 | return 1; | ||
148 | } | ||
149 | |||
150 | /* | ||
131 | * returns 1 if we get the read lock and 0 if we don't | 151 | * returns 1 if we get the read lock and 0 if we don't |
132 | * this won't wait for blocking writers | 152 | * this won't wait for blocking writers |
133 | */ | 153 | */ |
@@ -158,9 +178,7 @@ int btrfs_try_tree_write_lock(struct extent_buffer *eb) | |||
158 | atomic_read(&eb->blocking_readers)) | 178 | atomic_read(&eb->blocking_readers)) |
159 | return 0; | 179 | return 0; |
160 | 180 | ||
161 | if (!write_trylock(&eb->lock)) | 181 | write_lock(&eb->lock); |
162 | return 0; | ||
163 | |||
164 | if (atomic_read(&eb->blocking_writers) || | 182 | if (atomic_read(&eb->blocking_writers) || |
165 | atomic_read(&eb->blocking_readers)) { | 183 | atomic_read(&eb->blocking_readers)) { |
166 | write_unlock(&eb->lock); | 184 | write_unlock(&eb->lock); |
diff --git a/fs/btrfs/locking.h b/fs/btrfs/locking.h index b81e0e9a4894..c44a9d5f5362 100644 --- a/fs/btrfs/locking.h +++ b/fs/btrfs/locking.h | |||
@@ -35,6 +35,8 @@ void btrfs_clear_lock_blocking_rw(struct extent_buffer *eb, int rw); | |||
35 | void btrfs_assert_tree_locked(struct extent_buffer *eb); | 35 | void btrfs_assert_tree_locked(struct extent_buffer *eb); |
36 | int btrfs_try_tree_read_lock(struct extent_buffer *eb); | 36 | int btrfs_try_tree_read_lock(struct extent_buffer *eb); |
37 | int btrfs_try_tree_write_lock(struct extent_buffer *eb); | 37 | int btrfs_try_tree_write_lock(struct extent_buffer *eb); |
38 | int btrfs_tree_read_lock_atomic(struct extent_buffer *eb); | ||
39 | |||
38 | 40 | ||
39 | static inline void btrfs_tree_unlock_rw(struct extent_buffer *eb, int rw) | 41 | static inline void btrfs_tree_unlock_rw(struct extent_buffer *eb, int rw) |
40 | { | 42 | { |
diff --git a/fs/btrfs/lzo.c b/fs/btrfs/lzo.c index 78285f30909e..617553cdb7d3 100644 --- a/fs/btrfs/lzo.c +++ b/fs/btrfs/lzo.c | |||
@@ -373,6 +373,8 @@ cont: | |||
373 | } | 373 | } |
374 | done: | 374 | done: |
375 | kunmap(pages_in[page_in_index]); | 375 | kunmap(pages_in[page_in_index]); |
376 | if (!ret) | ||
377 | btrfs_clear_biovec_end(bvec, vcnt, page_out_index, pg_offset); | ||
376 | return ret; | 378 | return ret; |
377 | } | 379 | } |
378 | 380 | ||
@@ -410,10 +412,23 @@ static int lzo_decompress(struct list_head *ws, unsigned char *data_in, | |||
410 | goto out; | 412 | goto out; |
411 | } | 413 | } |
412 | 414 | ||
415 | /* | ||
416 | * the caller is already checking against PAGE_SIZE, but lets | ||
417 | * move this check closer to the memcpy/memset | ||
418 | */ | ||
419 | destlen = min_t(unsigned long, destlen, PAGE_SIZE); | ||
413 | bytes = min_t(unsigned long, destlen, out_len - start_byte); | 420 | bytes = min_t(unsigned long, destlen, out_len - start_byte); |
414 | 421 | ||
415 | kaddr = kmap_atomic(dest_page); | 422 | kaddr = kmap_atomic(dest_page); |
416 | memcpy(kaddr, workspace->buf + start_byte, bytes); | 423 | memcpy(kaddr, workspace->buf + start_byte, bytes); |
424 | |||
425 | /* | ||
426 | * btrfs_getblock is doing a zero on the tail of the page too, | ||
427 | * but this will cover anything missing from the decompressed | ||
428 | * data. | ||
429 | */ | ||
430 | if (bytes < destlen) | ||
431 | memset(kaddr+bytes, 0, destlen-bytes); | ||
417 | kunmap_atomic(kaddr); | 432 | kunmap_atomic(kaddr); |
418 | out: | 433 | out: |
419 | return ret; | 434 | return ret; |
diff --git a/fs/btrfs/zlib.c b/fs/btrfs/zlib.c index 759fa4e2de8f..fb22fd8d8fb8 100644 --- a/fs/btrfs/zlib.c +++ b/fs/btrfs/zlib.c | |||
@@ -299,6 +299,8 @@ done: | |||
299 | zlib_inflateEnd(&workspace->strm); | 299 | zlib_inflateEnd(&workspace->strm); |
300 | if (data_in) | 300 | if (data_in) |
301 | kunmap(pages_in[page_in_index]); | 301 | kunmap(pages_in[page_in_index]); |
302 | if (!ret) | ||
303 | btrfs_clear_biovec_end(bvec, vcnt, page_out_index, pg_offset); | ||
302 | return ret; | 304 | return ret; |
303 | } | 305 | } |
304 | 306 | ||
@@ -310,10 +312,14 @@ static int zlib_decompress(struct list_head *ws, unsigned char *data_in, | |||
310 | struct workspace *workspace = list_entry(ws, struct workspace, list); | 312 | struct workspace *workspace = list_entry(ws, struct workspace, list); |
311 | int ret = 0; | 313 | int ret = 0; |
312 | int wbits = MAX_WBITS; | 314 | int wbits = MAX_WBITS; |
313 | unsigned long bytes_left = destlen; | 315 | unsigned long bytes_left; |
314 | unsigned long total_out = 0; | 316 | unsigned long total_out = 0; |
317 | unsigned long pg_offset = 0; | ||
315 | char *kaddr; | 318 | char *kaddr; |
316 | 319 | ||
320 | destlen = min_t(unsigned long, destlen, PAGE_SIZE); | ||
321 | bytes_left = destlen; | ||
322 | |||
317 | workspace->strm.next_in = data_in; | 323 | workspace->strm.next_in = data_in; |
318 | workspace->strm.avail_in = srclen; | 324 | workspace->strm.avail_in = srclen; |
319 | workspace->strm.total_in = 0; | 325 | workspace->strm.total_in = 0; |
@@ -341,7 +347,6 @@ static int zlib_decompress(struct list_head *ws, unsigned char *data_in, | |||
341 | unsigned long buf_start; | 347 | unsigned long buf_start; |
342 | unsigned long buf_offset; | 348 | unsigned long buf_offset; |
343 | unsigned long bytes; | 349 | unsigned long bytes; |
344 | unsigned long pg_offset = 0; | ||
345 | 350 | ||
346 | ret = zlib_inflate(&workspace->strm, Z_NO_FLUSH); | 351 | ret = zlib_inflate(&workspace->strm, Z_NO_FLUSH); |
347 | if (ret != Z_OK && ret != Z_STREAM_END) | 352 | if (ret != Z_OK && ret != Z_STREAM_END) |
@@ -384,6 +389,17 @@ next: | |||
384 | ret = 0; | 389 | ret = 0; |
385 | 390 | ||
386 | zlib_inflateEnd(&workspace->strm); | 391 | zlib_inflateEnd(&workspace->strm); |
392 | |||
393 | /* | ||
394 | * this should only happen if zlib returned fewer bytes than we | ||
395 | * expected. btrfs_get_block is responsible for zeroing from the | ||
396 | * end of the inline extent (destlen) to the end of the page | ||
397 | */ | ||
398 | if (pg_offset < destlen) { | ||
399 | kaddr = kmap_atomic(dest_page); | ||
400 | memset(kaddr + pg_offset, 0, destlen - pg_offset); | ||
401 | kunmap_atomic(kaddr); | ||
402 | } | ||
387 | return ret; | 403 | return ret; |
388 | } | 404 | } |
389 | 405 | ||
diff --git a/fs/dcache.c b/fs/dcache.c index 3ffef7f4e5cd..5bc72b07fde2 100644 --- a/fs/dcache.c +++ b/fs/dcache.c | |||
@@ -778,6 +778,7 @@ restart: | |||
778 | struct dentry *parent = lock_parent(dentry); | 778 | struct dentry *parent = lock_parent(dentry); |
779 | if (likely(!dentry->d_lockref.count)) { | 779 | if (likely(!dentry->d_lockref.count)) { |
780 | __dentry_kill(dentry); | 780 | __dentry_kill(dentry); |
781 | dput(parent); | ||
781 | goto restart; | 782 | goto restart; |
782 | } | 783 | } |
783 | if (parent) | 784 | if (parent) |
diff --git a/fs/fat/namei_vfat.c b/fs/fat/namei_vfat.c index 6df8d3d885e5..b8b92c2f9683 100644 --- a/fs/fat/namei_vfat.c +++ b/fs/fat/namei_vfat.c | |||
@@ -736,7 +736,12 @@ static struct dentry *vfat_lookup(struct inode *dir, struct dentry *dentry, | |||
736 | } | 736 | } |
737 | 737 | ||
738 | alias = d_find_alias(inode); | 738 | alias = d_find_alias(inode); |
739 | if (alias && !vfat_d_anon_disconn(alias)) { | 739 | /* |
740 | * Checking "alias->d_parent == dentry->d_parent" to make sure | ||
741 | * FS is not corrupted (especially double linked dir). | ||
742 | */ | ||
743 | if (alias && alias->d_parent == dentry->d_parent && | ||
744 | !vfat_d_anon_disconn(alias)) { | ||
740 | /* | 745 | /* |
741 | * This inode has non anonymous-DCACHE_DISCONNECTED | 746 | * This inode has non anonymous-DCACHE_DISCONNECTED |
742 | * dentry. This means, the user did ->lookup() by an | 747 | * dentry. This means, the user did ->lookup() by an |
@@ -755,12 +760,9 @@ static struct dentry *vfat_lookup(struct inode *dir, struct dentry *dentry, | |||
755 | 760 | ||
756 | out: | 761 | out: |
757 | mutex_unlock(&MSDOS_SB(sb)->s_lock); | 762 | mutex_unlock(&MSDOS_SB(sb)->s_lock); |
758 | dentry->d_time = dentry->d_parent->d_inode->i_version; | 763 | if (!inode) |
759 | dentry = d_splice_alias(inode, dentry); | 764 | dentry->d_time = dir->i_version; |
760 | if (dentry) | 765 | return d_splice_alias(inode, dentry); |
761 | dentry->d_time = dentry->d_parent->d_inode->i_version; | ||
762 | return dentry; | ||
763 | |||
764 | error: | 766 | error: |
765 | mutex_unlock(&MSDOS_SB(sb)->s_lock); | 767 | mutex_unlock(&MSDOS_SB(sb)->s_lock); |
766 | return ERR_PTR(err); | 768 | return ERR_PTR(err); |
@@ -793,7 +795,6 @@ static int vfat_create(struct inode *dir, struct dentry *dentry, umode_t mode, | |||
793 | inode->i_mtime = inode->i_atime = inode->i_ctime = ts; | 795 | inode->i_mtime = inode->i_atime = inode->i_ctime = ts; |
794 | /* timestamp is already written, so mark_inode_dirty() is unneeded. */ | 796 | /* timestamp is already written, so mark_inode_dirty() is unneeded. */ |
795 | 797 | ||
796 | dentry->d_time = dentry->d_parent->d_inode->i_version; | ||
797 | d_instantiate(dentry, inode); | 798 | d_instantiate(dentry, inode); |
798 | out: | 799 | out: |
799 | mutex_unlock(&MSDOS_SB(sb)->s_lock); | 800 | mutex_unlock(&MSDOS_SB(sb)->s_lock); |
@@ -824,6 +825,7 @@ static int vfat_rmdir(struct inode *dir, struct dentry *dentry) | |||
824 | clear_nlink(inode); | 825 | clear_nlink(inode); |
825 | inode->i_mtime = inode->i_atime = CURRENT_TIME_SEC; | 826 | inode->i_mtime = inode->i_atime = CURRENT_TIME_SEC; |
826 | fat_detach(inode); | 827 | fat_detach(inode); |
828 | dentry->d_time = dir->i_version; | ||
827 | out: | 829 | out: |
828 | mutex_unlock(&MSDOS_SB(sb)->s_lock); | 830 | mutex_unlock(&MSDOS_SB(sb)->s_lock); |
829 | 831 | ||
@@ -849,6 +851,7 @@ static int vfat_unlink(struct inode *dir, struct dentry *dentry) | |||
849 | clear_nlink(inode); | 851 | clear_nlink(inode); |
850 | inode->i_mtime = inode->i_atime = CURRENT_TIME_SEC; | 852 | inode->i_mtime = inode->i_atime = CURRENT_TIME_SEC; |
851 | fat_detach(inode); | 853 | fat_detach(inode); |
854 | dentry->d_time = dir->i_version; | ||
852 | out: | 855 | out: |
853 | mutex_unlock(&MSDOS_SB(sb)->s_lock); | 856 | mutex_unlock(&MSDOS_SB(sb)->s_lock); |
854 | 857 | ||
@@ -889,7 +892,6 @@ static int vfat_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode) | |||
889 | inode->i_mtime = inode->i_atime = inode->i_ctime = ts; | 892 | inode->i_mtime = inode->i_atime = inode->i_ctime = ts; |
890 | /* timestamp is already written, so mark_inode_dirty() is unneeded. */ | 893 | /* timestamp is already written, so mark_inode_dirty() is unneeded. */ |
891 | 894 | ||
892 | dentry->d_time = dentry->d_parent->d_inode->i_version; | ||
893 | d_instantiate(dentry, inode); | 895 | d_instantiate(dentry, inode); |
894 | 896 | ||
895 | mutex_unlock(&MSDOS_SB(sb)->s_lock); | 897 | mutex_unlock(&MSDOS_SB(sb)->s_lock); |
diff --git a/fs/isofs/inode.c b/fs/isofs/inode.c index fe839b915116..d67a16f2a45d 100644 --- a/fs/isofs/inode.c +++ b/fs/isofs/inode.c | |||
@@ -174,27 +174,6 @@ struct iso9660_options{ | |||
174 | * Compute the hash for the isofs name corresponding to the dentry. | 174 | * Compute the hash for the isofs name corresponding to the dentry. |
175 | */ | 175 | */ |
176 | static int | 176 | static int |
177 | isofs_hash_common(struct qstr *qstr, int ms) | ||
178 | { | ||
179 | const char *name; | ||
180 | int len; | ||
181 | |||
182 | len = qstr->len; | ||
183 | name = qstr->name; | ||
184 | if (ms) { | ||
185 | while (len && name[len-1] == '.') | ||
186 | len--; | ||
187 | } | ||
188 | |||
189 | qstr->hash = full_name_hash(name, len); | ||
190 | |||
191 | return 0; | ||
192 | } | ||
193 | |||
194 | /* | ||
195 | * Compute the hash for the isofs name corresponding to the dentry. | ||
196 | */ | ||
197 | static int | ||
198 | isofs_hashi_common(struct qstr *qstr, int ms) | 177 | isofs_hashi_common(struct qstr *qstr, int ms) |
199 | { | 178 | { |
200 | const char *name; | 179 | const char *name; |
@@ -263,6 +242,27 @@ isofs_dentry_cmpi(const struct dentry *parent, const struct dentry *dentry, | |||
263 | } | 242 | } |
264 | 243 | ||
265 | #ifdef CONFIG_JOLIET | 244 | #ifdef CONFIG_JOLIET |
245 | /* | ||
246 | * Compute the hash for the isofs name corresponding to the dentry. | ||
247 | */ | ||
248 | static int | ||
249 | isofs_hash_common(struct qstr *qstr, int ms) | ||
250 | { | ||
251 | const char *name; | ||
252 | int len; | ||
253 | |||
254 | len = qstr->len; | ||
255 | name = qstr->name; | ||
256 | if (ms) { | ||
257 | while (len && name[len-1] == '.') | ||
258 | len--; | ||
259 | } | ||
260 | |||
261 | qstr->hash = full_name_hash(name, len); | ||
262 | |||
263 | return 0; | ||
264 | } | ||
265 | |||
266 | static int | 266 | static int |
267 | isofs_hash_ms(const struct dentry *dentry, struct qstr *qstr) | 267 | isofs_hash_ms(const struct dentry *dentry, struct qstr *qstr) |
268 | { | 268 | { |
diff --git a/fs/jbd2/journal.c b/fs/jbd2/journal.c index e4dc74713a43..1df94fabe4eb 100644 --- a/fs/jbd2/journal.c +++ b/fs/jbd2/journal.c | |||
@@ -1853,13 +1853,12 @@ int jbd2_journal_set_features (journal_t *journal, unsigned long compat, | |||
1853 | journal->j_chksum_driver = NULL; | 1853 | journal->j_chksum_driver = NULL; |
1854 | return 0; | 1854 | return 0; |
1855 | } | 1855 | } |
1856 | } | ||
1857 | 1856 | ||
1858 | /* Precompute checksum seed for all metadata */ | 1857 | /* Precompute checksum seed for all metadata */ |
1859 | if (jbd2_journal_has_csum_v2or3(journal)) | ||
1860 | journal->j_csum_seed = jbd2_chksum(journal, ~0, | 1858 | journal->j_csum_seed = jbd2_chksum(journal, ~0, |
1861 | sb->s_uuid, | 1859 | sb->s_uuid, |
1862 | sizeof(sb->s_uuid)); | 1860 | sizeof(sb->s_uuid)); |
1861 | } | ||
1863 | } | 1862 | } |
1864 | 1863 | ||
1865 | /* If enabling v1 checksums, downgrade superblock */ | 1864 | /* If enabling v1 checksums, downgrade superblock */ |
diff --git a/fs/nfsd/nfs4callback.c b/fs/nfsd/nfs4callback.c index ed2b1151b171..7cbdf1b2e4ab 100644 --- a/fs/nfsd/nfs4callback.c +++ b/fs/nfsd/nfs4callback.c | |||
@@ -774,8 +774,12 @@ static bool nfsd41_cb_get_slot(struct nfs4_client *clp, struct rpc_task *task) | |||
774 | { | 774 | { |
775 | if (test_and_set_bit(0, &clp->cl_cb_slot_busy) != 0) { | 775 | if (test_and_set_bit(0, &clp->cl_cb_slot_busy) != 0) { |
776 | rpc_sleep_on(&clp->cl_cb_waitq, task, NULL); | 776 | rpc_sleep_on(&clp->cl_cb_waitq, task, NULL); |
777 | dprintk("%s slot is busy\n", __func__); | 777 | /* Race breaker */ |
778 | return false; | 778 | if (test_and_set_bit(0, &clp->cl_cb_slot_busy) != 0) { |
779 | dprintk("%s slot is busy\n", __func__); | ||
780 | return false; | ||
781 | } | ||
782 | rpc_wake_up_queued_task(&clp->cl_cb_waitq, task); | ||
779 | } | 783 | } |
780 | return true; | 784 | return true; |
781 | } | 785 | } |
diff --git a/fs/nfsd/nfsd.h b/fs/nfsd/nfsd.h index 747f3b95bd11..33a46a8dfaf7 100644 --- a/fs/nfsd/nfsd.h +++ b/fs/nfsd/nfsd.h | |||
@@ -335,12 +335,15 @@ void nfsd_lockd_shutdown(void); | |||
335 | (NFSD4_SUPPORTED_ATTRS_WORD2 | FATTR4_WORD2_SUPPATTR_EXCLCREAT) | 335 | (NFSD4_SUPPORTED_ATTRS_WORD2 | FATTR4_WORD2_SUPPATTR_EXCLCREAT) |
336 | 336 | ||
337 | #ifdef CONFIG_NFSD_V4_SECURITY_LABEL | 337 | #ifdef CONFIG_NFSD_V4_SECURITY_LABEL |
338 | #define NFSD4_2_SUPPORTED_ATTRS_WORD2 \ | 338 | #define NFSD4_2_SECURITY_ATTRS FATTR4_WORD2_SECURITY_LABEL |
339 | (NFSD4_1_SUPPORTED_ATTRS_WORD2 | FATTR4_WORD2_SECURITY_LABEL) | ||
340 | #else | 339 | #else |
341 | #define NFSD4_2_SUPPORTED_ATTRS_WORD2 0 | 340 | #define NFSD4_2_SECURITY_ATTRS 0 |
342 | #endif | 341 | #endif |
343 | 342 | ||
343 | #define NFSD4_2_SUPPORTED_ATTRS_WORD2 \ | ||
344 | (NFSD4_1_SUPPORTED_ATTRS_WORD2 | \ | ||
345 | NFSD4_2_SECURITY_ATTRS) | ||
346 | |||
344 | static inline u32 nfsd_suppattrs0(u32 minorversion) | 347 | static inline u32 nfsd_suppattrs0(u32 minorversion) |
345 | { | 348 | { |
346 | return minorversion ? NFSD4_1_SUPPORTED_ATTRS_WORD0 | 349 | return minorversion ? NFSD4_1_SUPPORTED_ATTRS_WORD0 |
diff --git a/fs/overlayfs/Kconfig b/fs/overlayfs/Kconfig index e60125976873..34355818a2e0 100644 --- a/fs/overlayfs/Kconfig +++ b/fs/overlayfs/Kconfig | |||
@@ -1,4 +1,4 @@ | |||
1 | config OVERLAYFS_FS | 1 | config OVERLAY_FS |
2 | tristate "Overlay filesystem support" | 2 | tristate "Overlay filesystem support" |
3 | help | 3 | help |
4 | An overlay filesystem combines two filesystems - an 'upper' filesystem | 4 | An overlay filesystem combines two filesystems - an 'upper' filesystem |
diff --git a/fs/overlayfs/Makefile b/fs/overlayfs/Makefile index 8f91889480d0..900daed3e91d 100644 --- a/fs/overlayfs/Makefile +++ b/fs/overlayfs/Makefile | |||
@@ -2,6 +2,6 @@ | |||
2 | # Makefile for the overlay filesystem. | 2 | # Makefile for the overlay filesystem. |
3 | # | 3 | # |
4 | 4 | ||
5 | obj-$(CONFIG_OVERLAYFS_FS) += overlayfs.o | 5 | obj-$(CONFIG_OVERLAY_FS) += overlay.o |
6 | 6 | ||
7 | overlayfs-objs := super.o inode.o dir.o readdir.o copy_up.o | 7 | overlay-objs := super.o inode.o dir.o readdir.o copy_up.o |
diff --git a/fs/overlayfs/dir.c b/fs/overlayfs/dir.c index 15cd91ad9940..8ffc4b980f1b 100644 --- a/fs/overlayfs/dir.c +++ b/fs/overlayfs/dir.c | |||
@@ -284,8 +284,7 @@ out: | |||
284 | return ERR_PTR(err); | 284 | return ERR_PTR(err); |
285 | } | 285 | } |
286 | 286 | ||
287 | static struct dentry *ovl_check_empty_and_clear(struct dentry *dentry, | 287 | static struct dentry *ovl_check_empty_and_clear(struct dentry *dentry) |
288 | enum ovl_path_type type) | ||
289 | { | 288 | { |
290 | int err; | 289 | int err; |
291 | struct dentry *ret = NULL; | 290 | struct dentry *ret = NULL; |
@@ -294,8 +293,17 @@ static struct dentry *ovl_check_empty_and_clear(struct dentry *dentry, | |||
294 | err = ovl_check_empty_dir(dentry, &list); | 293 | err = ovl_check_empty_dir(dentry, &list); |
295 | if (err) | 294 | if (err) |
296 | ret = ERR_PTR(err); | 295 | ret = ERR_PTR(err); |
297 | else if (type == OVL_PATH_MERGE) | 296 | else { |
298 | ret = ovl_clear_empty(dentry, &list); | 297 | /* |
298 | * If no upperdentry then skip clearing whiteouts. | ||
299 | * | ||
300 | * Can race with copy-up, since we don't hold the upperdir | ||
301 | * mutex. Doesn't matter, since copy-up can't create a | ||
302 | * non-empty directory from an empty one. | ||
303 | */ | ||
304 | if (ovl_dentry_upper(dentry)) | ||
305 | ret = ovl_clear_empty(dentry, &list); | ||
306 | } | ||
299 | 307 | ||
300 | ovl_cache_free(&list); | 308 | ovl_cache_free(&list); |
301 | 309 | ||
@@ -487,8 +495,7 @@ out: | |||
487 | return err; | 495 | return err; |
488 | } | 496 | } |
489 | 497 | ||
490 | static int ovl_remove_and_whiteout(struct dentry *dentry, | 498 | static int ovl_remove_and_whiteout(struct dentry *dentry, bool is_dir) |
491 | enum ovl_path_type type, bool is_dir) | ||
492 | { | 499 | { |
493 | struct dentry *workdir = ovl_workdir(dentry); | 500 | struct dentry *workdir = ovl_workdir(dentry); |
494 | struct inode *wdir = workdir->d_inode; | 501 | struct inode *wdir = workdir->d_inode; |
@@ -500,7 +507,7 @@ static int ovl_remove_and_whiteout(struct dentry *dentry, | |||
500 | int err; | 507 | int err; |
501 | 508 | ||
502 | if (is_dir) { | 509 | if (is_dir) { |
503 | opaquedir = ovl_check_empty_and_clear(dentry, type); | 510 | opaquedir = ovl_check_empty_and_clear(dentry); |
504 | err = PTR_ERR(opaquedir); | 511 | err = PTR_ERR(opaquedir); |
505 | if (IS_ERR(opaquedir)) | 512 | if (IS_ERR(opaquedir)) |
506 | goto out; | 513 | goto out; |
@@ -515,9 +522,10 @@ static int ovl_remove_and_whiteout(struct dentry *dentry, | |||
515 | if (IS_ERR(whiteout)) | 522 | if (IS_ERR(whiteout)) |
516 | goto out_unlock; | 523 | goto out_unlock; |
517 | 524 | ||
518 | if (type == OVL_PATH_LOWER) { | 525 | upper = ovl_dentry_upper(dentry); |
526 | if (!upper) { | ||
519 | upper = lookup_one_len(dentry->d_name.name, upperdir, | 527 | upper = lookup_one_len(dentry->d_name.name, upperdir, |
520 | dentry->d_name.len); | 528 | dentry->d_name.len); |
521 | err = PTR_ERR(upper); | 529 | err = PTR_ERR(upper); |
522 | if (IS_ERR(upper)) | 530 | if (IS_ERR(upper)) |
523 | goto kill_whiteout; | 531 | goto kill_whiteout; |
@@ -529,7 +537,6 @@ static int ovl_remove_and_whiteout(struct dentry *dentry, | |||
529 | } else { | 537 | } else { |
530 | int flags = 0; | 538 | int flags = 0; |
531 | 539 | ||
532 | upper = ovl_dentry_upper(dentry); | ||
533 | if (opaquedir) | 540 | if (opaquedir) |
534 | upper = opaquedir; | 541 | upper = opaquedir; |
535 | err = -ESTALE; | 542 | err = -ESTALE; |
@@ -648,7 +655,7 @@ static int ovl_do_remove(struct dentry *dentry, bool is_dir) | |||
648 | cap_raise(override_cred->cap_effective, CAP_CHOWN); | 655 | cap_raise(override_cred->cap_effective, CAP_CHOWN); |
649 | old_cred = override_creds(override_cred); | 656 | old_cred = override_creds(override_cred); |
650 | 657 | ||
651 | err = ovl_remove_and_whiteout(dentry, type, is_dir); | 658 | err = ovl_remove_and_whiteout(dentry, is_dir); |
652 | 659 | ||
653 | revert_creds(old_cred); | 660 | revert_creds(old_cred); |
654 | put_cred(override_cred); | 661 | put_cred(override_cred); |
@@ -781,7 +788,7 @@ static int ovl_rename2(struct inode *olddir, struct dentry *old, | |||
781 | } | 788 | } |
782 | 789 | ||
783 | if (overwrite && (new_type == OVL_PATH_LOWER || new_type == OVL_PATH_MERGE) && new_is_dir) { | 790 | if (overwrite && (new_type == OVL_PATH_LOWER || new_type == OVL_PATH_MERGE) && new_is_dir) { |
784 | opaquedir = ovl_check_empty_and_clear(new, new_type); | 791 | opaquedir = ovl_check_empty_and_clear(new); |
785 | err = PTR_ERR(opaquedir); | 792 | err = PTR_ERR(opaquedir); |
786 | if (IS_ERR(opaquedir)) { | 793 | if (IS_ERR(opaquedir)) { |
787 | opaquedir = NULL; | 794 | opaquedir = NULL; |
diff --git a/fs/overlayfs/inode.c b/fs/overlayfs/inode.c index af2d18c9fcee..07d74b24913b 100644 --- a/fs/overlayfs/inode.c +++ b/fs/overlayfs/inode.c | |||
@@ -235,26 +235,36 @@ out: | |||
235 | return err; | 235 | return err; |
236 | } | 236 | } |
237 | 237 | ||
238 | static bool ovl_need_xattr_filter(struct dentry *dentry, | ||
239 | enum ovl_path_type type) | ||
240 | { | ||
241 | return type == OVL_PATH_UPPER && S_ISDIR(dentry->d_inode->i_mode); | ||
242 | } | ||
243 | |||
238 | ssize_t ovl_getxattr(struct dentry *dentry, const char *name, | 244 | ssize_t ovl_getxattr(struct dentry *dentry, const char *name, |
239 | void *value, size_t size) | 245 | void *value, size_t size) |
240 | { | 246 | { |
241 | if (ovl_path_type(dentry->d_parent) == OVL_PATH_MERGE && | 247 | struct path realpath; |
242 | ovl_is_private_xattr(name)) | 248 | enum ovl_path_type type = ovl_path_real(dentry, &realpath); |
249 | |||
250 | if (ovl_need_xattr_filter(dentry, type) && ovl_is_private_xattr(name)) | ||
243 | return -ENODATA; | 251 | return -ENODATA; |
244 | 252 | ||
245 | return vfs_getxattr(ovl_dentry_real(dentry), name, value, size); | 253 | return vfs_getxattr(realpath.dentry, name, value, size); |
246 | } | 254 | } |
247 | 255 | ||
248 | ssize_t ovl_listxattr(struct dentry *dentry, char *list, size_t size) | 256 | ssize_t ovl_listxattr(struct dentry *dentry, char *list, size_t size) |
249 | { | 257 | { |
258 | struct path realpath; | ||
259 | enum ovl_path_type type = ovl_path_real(dentry, &realpath); | ||
250 | ssize_t res; | 260 | ssize_t res; |
251 | int off; | 261 | int off; |
252 | 262 | ||
253 | res = vfs_listxattr(ovl_dentry_real(dentry), list, size); | 263 | res = vfs_listxattr(realpath.dentry, list, size); |
254 | if (res <= 0 || size == 0) | 264 | if (res <= 0 || size == 0) |
255 | return res; | 265 | return res; |
256 | 266 | ||
257 | if (ovl_path_type(dentry->d_parent) != OVL_PATH_MERGE) | 267 | if (!ovl_need_xattr_filter(dentry, type)) |
258 | return res; | 268 | return res; |
259 | 269 | ||
260 | /* filter out private xattrs */ | 270 | /* filter out private xattrs */ |
@@ -279,17 +289,16 @@ int ovl_removexattr(struct dentry *dentry, const char *name) | |||
279 | { | 289 | { |
280 | int err; | 290 | int err; |
281 | struct path realpath; | 291 | struct path realpath; |
282 | enum ovl_path_type type; | 292 | enum ovl_path_type type = ovl_path_real(dentry, &realpath); |
283 | 293 | ||
284 | err = ovl_want_write(dentry); | 294 | err = ovl_want_write(dentry); |
285 | if (err) | 295 | if (err) |
286 | goto out; | 296 | goto out; |
287 | 297 | ||
288 | if (ovl_path_type(dentry->d_parent) == OVL_PATH_MERGE && | 298 | err = -ENODATA; |
289 | ovl_is_private_xattr(name)) | 299 | if (ovl_need_xattr_filter(dentry, type) && ovl_is_private_xattr(name)) |
290 | goto out_drop_write; | 300 | goto out_drop_write; |
291 | 301 | ||
292 | type = ovl_path_real(dentry, &realpath); | ||
293 | if (type == OVL_PATH_LOWER) { | 302 | if (type == OVL_PATH_LOWER) { |
294 | err = vfs_getxattr(realpath.dentry, name, NULL, 0); | 303 | err = vfs_getxattr(realpath.dentry, name, NULL, 0); |
295 | if (err < 0) | 304 | if (err < 0) |
diff --git a/fs/overlayfs/readdir.c b/fs/overlayfs/readdir.c index 2a7ef4f8e2a6..ab1e3dcbed95 100644 --- a/fs/overlayfs/readdir.c +++ b/fs/overlayfs/readdir.c | |||
@@ -274,11 +274,11 @@ static int ovl_dir_mark_whiteouts(struct dentry *dir, | |||
274 | return 0; | 274 | return 0; |
275 | } | 275 | } |
276 | 276 | ||
277 | static inline int ovl_dir_read_merged(struct path *upperpath, | 277 | static int ovl_dir_read_merged(struct dentry *dentry, struct list_head *list) |
278 | struct path *lowerpath, | ||
279 | struct list_head *list) | ||
280 | { | 278 | { |
281 | int err; | 279 | int err; |
280 | struct path lowerpath; | ||
281 | struct path upperpath; | ||
282 | struct ovl_readdir_data rdd = { | 282 | struct ovl_readdir_data rdd = { |
283 | .ctx.actor = ovl_fill_merge, | 283 | .ctx.actor = ovl_fill_merge, |
284 | .list = list, | 284 | .list = list, |
@@ -286,25 +286,28 @@ static inline int ovl_dir_read_merged(struct path *upperpath, | |||
286 | .is_merge = false, | 286 | .is_merge = false, |
287 | }; | 287 | }; |
288 | 288 | ||
289 | if (upperpath->dentry) { | 289 | ovl_path_lower(dentry, &lowerpath); |
290 | err = ovl_dir_read(upperpath, &rdd); | 290 | ovl_path_upper(dentry, &upperpath); |
291 | |||
292 | if (upperpath.dentry) { | ||
293 | err = ovl_dir_read(&upperpath, &rdd); | ||
291 | if (err) | 294 | if (err) |
292 | goto out; | 295 | goto out; |
293 | 296 | ||
294 | if (lowerpath->dentry) { | 297 | if (lowerpath.dentry) { |
295 | err = ovl_dir_mark_whiteouts(upperpath->dentry, &rdd); | 298 | err = ovl_dir_mark_whiteouts(upperpath.dentry, &rdd); |
296 | if (err) | 299 | if (err) |
297 | goto out; | 300 | goto out; |
298 | } | 301 | } |
299 | } | 302 | } |
300 | if (lowerpath->dentry) { | 303 | if (lowerpath.dentry) { |
301 | /* | 304 | /* |
302 | * Insert lowerpath entries before upperpath ones, this allows | 305 | * Insert lowerpath entries before upperpath ones, this allows |
303 | * offsets to be reasonably constant | 306 | * offsets to be reasonably constant |
304 | */ | 307 | */ |
305 | list_add(&rdd.middle, rdd.list); | 308 | list_add(&rdd.middle, rdd.list); |
306 | rdd.is_merge = true; | 309 | rdd.is_merge = true; |
307 | err = ovl_dir_read(lowerpath, &rdd); | 310 | err = ovl_dir_read(&lowerpath, &rdd); |
308 | list_del(&rdd.middle); | 311 | list_del(&rdd.middle); |
309 | } | 312 | } |
310 | out: | 313 | out: |
@@ -329,8 +332,6 @@ static void ovl_seek_cursor(struct ovl_dir_file *od, loff_t pos) | |||
329 | static struct ovl_dir_cache *ovl_cache_get(struct dentry *dentry) | 332 | static struct ovl_dir_cache *ovl_cache_get(struct dentry *dentry) |
330 | { | 333 | { |
331 | int res; | 334 | int res; |
332 | struct path lowerpath; | ||
333 | struct path upperpath; | ||
334 | struct ovl_dir_cache *cache; | 335 | struct ovl_dir_cache *cache; |
335 | 336 | ||
336 | cache = ovl_dir_cache(dentry); | 337 | cache = ovl_dir_cache(dentry); |
@@ -347,10 +348,7 @@ static struct ovl_dir_cache *ovl_cache_get(struct dentry *dentry) | |||
347 | cache->refcount = 1; | 348 | cache->refcount = 1; |
348 | INIT_LIST_HEAD(&cache->entries); | 349 | INIT_LIST_HEAD(&cache->entries); |
349 | 350 | ||
350 | ovl_path_lower(dentry, &lowerpath); | 351 | res = ovl_dir_read_merged(dentry, &cache->entries); |
351 | ovl_path_upper(dentry, &upperpath); | ||
352 | |||
353 | res = ovl_dir_read_merged(&upperpath, &lowerpath, &cache->entries); | ||
354 | if (res) { | 352 | if (res) { |
355 | ovl_cache_free(&cache->entries); | 353 | ovl_cache_free(&cache->entries); |
356 | kfree(cache); | 354 | kfree(cache); |
@@ -452,10 +450,10 @@ static int ovl_dir_fsync(struct file *file, loff_t start, loff_t end, | |||
452 | /* | 450 | /* |
453 | * Need to check if we started out being a lower dir, but got copied up | 451 | * Need to check if we started out being a lower dir, but got copied up |
454 | */ | 452 | */ |
455 | if (!od->is_upper && ovl_path_type(dentry) == OVL_PATH_MERGE) { | 453 | if (!od->is_upper && ovl_path_type(dentry) != OVL_PATH_LOWER) { |
456 | struct inode *inode = file_inode(file); | 454 | struct inode *inode = file_inode(file); |
457 | 455 | ||
458 | realfile =lockless_dereference(od->upperfile); | 456 | realfile = lockless_dereference(od->upperfile); |
459 | if (!realfile) { | 457 | if (!realfile) { |
460 | struct path upperpath; | 458 | struct path upperpath; |
461 | 459 | ||
@@ -538,14 +536,9 @@ const struct file_operations ovl_dir_operations = { | |||
538 | int ovl_check_empty_dir(struct dentry *dentry, struct list_head *list) | 536 | int ovl_check_empty_dir(struct dentry *dentry, struct list_head *list) |
539 | { | 537 | { |
540 | int err; | 538 | int err; |
541 | struct path lowerpath; | ||
542 | struct path upperpath; | ||
543 | struct ovl_cache_entry *p; | 539 | struct ovl_cache_entry *p; |
544 | 540 | ||
545 | ovl_path_upper(dentry, &upperpath); | 541 | err = ovl_dir_read_merged(dentry, list); |
546 | ovl_path_lower(dentry, &lowerpath); | ||
547 | |||
548 | err = ovl_dir_read_merged(&upperpath, &lowerpath, list); | ||
549 | if (err) | 542 | if (err) |
550 | return err; | 543 | return err; |
551 | 544 | ||
diff --git a/fs/overlayfs/super.c b/fs/overlayfs/super.c index 08b704cebfc4..f16d318b71f8 100644 --- a/fs/overlayfs/super.c +++ b/fs/overlayfs/super.c | |||
@@ -24,7 +24,7 @@ MODULE_AUTHOR("Miklos Szeredi <miklos@szeredi.hu>"); | |||
24 | MODULE_DESCRIPTION("Overlay filesystem"); | 24 | MODULE_DESCRIPTION("Overlay filesystem"); |
25 | MODULE_LICENSE("GPL"); | 25 | MODULE_LICENSE("GPL"); |
26 | 26 | ||
27 | #define OVERLAYFS_SUPER_MAGIC 0x794c764f | 27 | #define OVERLAYFS_SUPER_MAGIC 0x794c7630 |
28 | 28 | ||
29 | struct ovl_config { | 29 | struct ovl_config { |
30 | char *lowerdir; | 30 | char *lowerdir; |
@@ -84,12 +84,7 @@ enum ovl_path_type ovl_path_type(struct dentry *dentry) | |||
84 | 84 | ||
85 | static struct dentry *ovl_upperdentry_dereference(struct ovl_entry *oe) | 85 | static struct dentry *ovl_upperdentry_dereference(struct ovl_entry *oe) |
86 | { | 86 | { |
87 | struct dentry *upperdentry = ACCESS_ONCE(oe->__upperdentry); | 87 | return lockless_dereference(oe->__upperdentry); |
88 | /* | ||
89 | * Make sure to order reads to upperdentry wrt ovl_dentry_update() | ||
90 | */ | ||
91 | smp_read_barrier_depends(); | ||
92 | return upperdentry; | ||
93 | } | 88 | } |
94 | 89 | ||
95 | void ovl_path_upper(struct dentry *dentry, struct path *path) | 90 | void ovl_path_upper(struct dentry *dentry, struct path *path) |
@@ -462,11 +457,34 @@ static const match_table_t ovl_tokens = { | |||
462 | {OPT_ERR, NULL} | 457 | {OPT_ERR, NULL} |
463 | }; | 458 | }; |
464 | 459 | ||
460 | static char *ovl_next_opt(char **s) | ||
461 | { | ||
462 | char *sbegin = *s; | ||
463 | char *p; | ||
464 | |||
465 | if (sbegin == NULL) | ||
466 | return NULL; | ||
467 | |||
468 | for (p = sbegin; *p; p++) { | ||
469 | if (*p == '\\') { | ||
470 | p++; | ||
471 | if (!*p) | ||
472 | break; | ||
473 | } else if (*p == ',') { | ||
474 | *p = '\0'; | ||
475 | *s = p + 1; | ||
476 | return sbegin; | ||
477 | } | ||
478 | } | ||
479 | *s = NULL; | ||
480 | return sbegin; | ||
481 | } | ||
482 | |||
465 | static int ovl_parse_opt(char *opt, struct ovl_config *config) | 483 | static int ovl_parse_opt(char *opt, struct ovl_config *config) |
466 | { | 484 | { |
467 | char *p; | 485 | char *p; |
468 | 486 | ||
469 | while ((p = strsep(&opt, ",")) != NULL) { | 487 | while ((p = ovl_next_opt(&opt)) != NULL) { |
470 | int token; | 488 | int token; |
471 | substring_t args[MAX_OPT_ARGS]; | 489 | substring_t args[MAX_OPT_ARGS]; |
472 | 490 | ||
@@ -554,15 +572,34 @@ out_dput: | |||
554 | goto out_unlock; | 572 | goto out_unlock; |
555 | } | 573 | } |
556 | 574 | ||
575 | static void ovl_unescape(char *s) | ||
576 | { | ||
577 | char *d = s; | ||
578 | |||
579 | for (;; s++, d++) { | ||
580 | if (*s == '\\') | ||
581 | s++; | ||
582 | *d = *s; | ||
583 | if (!*s) | ||
584 | break; | ||
585 | } | ||
586 | } | ||
587 | |||
557 | static int ovl_mount_dir(const char *name, struct path *path) | 588 | static int ovl_mount_dir(const char *name, struct path *path) |
558 | { | 589 | { |
559 | int err; | 590 | int err; |
591 | char *tmp = kstrdup(name, GFP_KERNEL); | ||
592 | |||
593 | if (!tmp) | ||
594 | return -ENOMEM; | ||
560 | 595 | ||
561 | err = kern_path(name, LOOKUP_FOLLOW, path); | 596 | ovl_unescape(tmp); |
597 | err = kern_path(tmp, LOOKUP_FOLLOW, path); | ||
562 | if (err) { | 598 | if (err) { |
563 | pr_err("overlayfs: failed to resolve '%s': %i\n", name, err); | 599 | pr_err("overlayfs: failed to resolve '%s': %i\n", tmp, err); |
564 | err = -EINVAL; | 600 | err = -EINVAL; |
565 | } | 601 | } |
602 | kfree(tmp); | ||
566 | return err; | 603 | return err; |
567 | } | 604 | } |
568 | 605 | ||
@@ -776,11 +813,11 @@ static struct dentry *ovl_mount(struct file_system_type *fs_type, int flags, | |||
776 | 813 | ||
777 | static struct file_system_type ovl_fs_type = { | 814 | static struct file_system_type ovl_fs_type = { |
778 | .owner = THIS_MODULE, | 815 | .owner = THIS_MODULE, |
779 | .name = "overlayfs", | 816 | .name = "overlay", |
780 | .mount = ovl_mount, | 817 | .mount = ovl_mount, |
781 | .kill_sb = kill_anon_super, | 818 | .kill_sb = kill_anon_super, |
782 | }; | 819 | }; |
783 | MODULE_ALIAS_FS("overlayfs"); | 820 | MODULE_ALIAS_FS("overlay"); |
784 | 821 | ||
785 | static int __init ovl_init(void) | 822 | static int __init ovl_init(void) |
786 | { | 823 | { |
diff --git a/include/acpi/acbuffer.h b/include/acpi/acbuffer.h index 88cb477524a6..d5ec6c87810f 100644 --- a/include/acpi/acbuffer.h +++ b/include/acpi/acbuffer.h | |||
@@ -111,7 +111,9 @@ struct acpi_gtm_info { | |||
111 | struct acpi_pld_info { | 111 | struct acpi_pld_info { |
112 | u8 revision; | 112 | u8 revision; |
113 | u8 ignore_color; | 113 | u8 ignore_color; |
114 | u32 color; | 114 | u8 red; |
115 | u8 green; | ||
116 | u8 blue; | ||
115 | u16 width; | 117 | u16 width; |
116 | u16 height; | 118 | u16 height; |
117 | u8 user_visible; | 119 | u8 user_visible; |
@@ -155,8 +157,14 @@ struct acpi_pld_info { | |||
155 | #define ACPI_PLD_GET_IGNORE_COLOR(dword) ACPI_GET_BITS (dword, 7, ACPI_1BIT_MASK) | 157 | #define ACPI_PLD_GET_IGNORE_COLOR(dword) ACPI_GET_BITS (dword, 7, ACPI_1BIT_MASK) |
156 | #define ACPI_PLD_SET_IGNORE_COLOR(dword,value) ACPI_SET_BITS (dword, 7, ACPI_1BIT_MASK, value) /* Offset 7, Len 1 */ | 158 | #define ACPI_PLD_SET_IGNORE_COLOR(dword,value) ACPI_SET_BITS (dword, 7, ACPI_1BIT_MASK, value) /* Offset 7, Len 1 */ |
157 | 159 | ||
158 | #define ACPI_PLD_GET_COLOR(dword) ACPI_GET_BITS (dword, 8, ACPI_24BIT_MASK) | 160 | #define ACPI_PLD_GET_RED(dword) ACPI_GET_BITS (dword, 8, ACPI_8BIT_MASK) |
159 | #define ACPI_PLD_SET_COLOR(dword,value) ACPI_SET_BITS (dword, 8, ACPI_24BIT_MASK, value) /* Offset 8, Len 24 */ | 161 | #define ACPI_PLD_SET_RED(dword,value) ACPI_SET_BITS (dword, 8, ACPI_8BIT_MASK, value) /* Offset 8, Len 8 */ |
162 | |||
163 | #define ACPI_PLD_GET_GREEN(dword) ACPI_GET_BITS (dword, 16, ACPI_8BIT_MASK) | ||
164 | #define ACPI_PLD_SET_GREEN(dword,value) ACPI_SET_BITS (dword, 16, ACPI_8BIT_MASK, value) /* Offset 16, Len 8 */ | ||
165 | |||
166 | #define ACPI_PLD_GET_BLUE(dword) ACPI_GET_BITS (dword, 24, ACPI_8BIT_MASK) | ||
167 | #define ACPI_PLD_SET_BLUE(dword,value) ACPI_SET_BITS (dword, 24, ACPI_8BIT_MASK, value) /* Offset 24, Len 8 */ | ||
160 | 168 | ||
161 | /* Second 32-bit dword, bits 33:63 */ | 169 | /* Second 32-bit dword, bits 33:63 */ |
162 | 170 | ||
diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h index f34a0835aa4f..d53908438e95 100644 --- a/include/acpi/acpi_bus.h +++ b/include/acpi/acpi_bus.h | |||
@@ -27,6 +27,7 @@ | |||
27 | #define __ACPI_BUS_H__ | 27 | #define __ACPI_BUS_H__ |
28 | 28 | ||
29 | #include <linux/device.h> | 29 | #include <linux/device.h> |
30 | #include <linux/property.h> | ||
30 | 31 | ||
31 | /* TBD: Make dynamic */ | 32 | /* TBD: Make dynamic */ |
32 | #define ACPI_MAX_HANDLES 10 | 33 | #define ACPI_MAX_HANDLES 10 |
@@ -337,10 +338,20 @@ struct acpi_device_physical_node { | |||
337 | bool put_online:1; | 338 | bool put_online:1; |
338 | }; | 339 | }; |
339 | 340 | ||
341 | /* ACPI Device Specific Data (_DSD) */ | ||
342 | struct acpi_device_data { | ||
343 | const union acpi_object *pointer; | ||
344 | const union acpi_object *properties; | ||
345 | const union acpi_object *of_compatible; | ||
346 | }; | ||
347 | |||
348 | struct acpi_gpio_mapping; | ||
349 | |||
340 | /* Device */ | 350 | /* Device */ |
341 | struct acpi_device { | 351 | struct acpi_device { |
342 | int device_type; | 352 | int device_type; |
343 | acpi_handle handle; /* no handle for fixed hardware */ | 353 | acpi_handle handle; /* no handle for fixed hardware */ |
354 | struct fwnode_handle fwnode; | ||
344 | struct acpi_device *parent; | 355 | struct acpi_device *parent; |
345 | struct list_head children; | 356 | struct list_head children; |
346 | struct list_head node; | 357 | struct list_head node; |
@@ -353,17 +364,35 @@ struct acpi_device { | |||
353 | struct acpi_device_wakeup wakeup; | 364 | struct acpi_device_wakeup wakeup; |
354 | struct acpi_device_perf performance; | 365 | struct acpi_device_perf performance; |
355 | struct acpi_device_dir dir; | 366 | struct acpi_device_dir dir; |
367 | struct acpi_device_data data; | ||
356 | struct acpi_scan_handler *handler; | 368 | struct acpi_scan_handler *handler; |
357 | struct acpi_hotplug_context *hp; | 369 | struct acpi_hotplug_context *hp; |
358 | struct acpi_driver *driver; | 370 | struct acpi_driver *driver; |
371 | const struct acpi_gpio_mapping *driver_gpios; | ||
359 | void *driver_data; | 372 | void *driver_data; |
360 | struct device dev; | 373 | struct device dev; |
361 | unsigned int physical_node_count; | 374 | unsigned int physical_node_count; |
375 | unsigned int dep_unmet; | ||
362 | struct list_head physical_node_list; | 376 | struct list_head physical_node_list; |
363 | struct mutex physical_node_lock; | 377 | struct mutex physical_node_lock; |
364 | void (*remove)(struct acpi_device *); | 378 | void (*remove)(struct acpi_device *); |
365 | }; | 379 | }; |
366 | 380 | ||
381 | static inline bool is_acpi_node(struct fwnode_handle *fwnode) | ||
382 | { | ||
383 | return fwnode && fwnode->type == FWNODE_ACPI; | ||
384 | } | ||
385 | |||
386 | static inline struct acpi_device *acpi_node(struct fwnode_handle *fwnode) | ||
387 | { | ||
388 | return fwnode ? container_of(fwnode, struct acpi_device, fwnode) : NULL; | ||
389 | } | ||
390 | |||
391 | static inline struct fwnode_handle *acpi_fwnode_handle(struct acpi_device *adev) | ||
392 | { | ||
393 | return &adev->fwnode; | ||
394 | } | ||
395 | |||
367 | static inline void *acpi_driver_data(struct acpi_device *d) | 396 | static inline void *acpi_driver_data(struct acpi_device *d) |
368 | { | 397 | { |
369 | return d->driver_data; | 398 | return d->driver_data; |
diff --git a/include/acpi/acpixf.h b/include/acpi/acpixf.h index ab2acf629a64..5ba78464c1b1 100644 --- a/include/acpi/acpixf.h +++ b/include/acpi/acpixf.h | |||
@@ -46,7 +46,7 @@ | |||
46 | 46 | ||
47 | /* Current ACPICA subsystem version in YYYYMMDD format */ | 47 | /* Current ACPICA subsystem version in YYYYMMDD format */ |
48 | 48 | ||
49 | #define ACPI_CA_VERSION 0x20140926 | 49 | #define ACPI_CA_VERSION 0x20141107 |
50 | 50 | ||
51 | #include <acpi/acconfig.h> | 51 | #include <acpi/acconfig.h> |
52 | #include <acpi/actypes.h> | 52 | #include <acpi/actypes.h> |
diff --git a/include/acpi/actypes.h b/include/acpi/actypes.h index 7000e66f768e..bbef17368e49 100644 --- a/include/acpi/actypes.h +++ b/include/acpi/actypes.h | |||
@@ -736,6 +736,10 @@ typedef u32 acpi_event_status; | |||
736 | #define ACPI_GPE_ENABLE 0 | 736 | #define ACPI_GPE_ENABLE 0 |
737 | #define ACPI_GPE_DISABLE 1 | 737 | #define ACPI_GPE_DISABLE 1 |
738 | #define ACPI_GPE_CONDITIONAL_ENABLE 2 | 738 | #define ACPI_GPE_CONDITIONAL_ENABLE 2 |
739 | #define ACPI_GPE_SAVE_MASK 4 | ||
740 | |||
741 | #define ACPI_GPE_ENABLE_SAVE (ACPI_GPE_ENABLE | ACPI_GPE_SAVE_MASK) | ||
742 | #define ACPI_GPE_DISABLE_SAVE (ACPI_GPE_DISABLE | ACPI_GPE_SAVE_MASK) | ||
739 | 743 | ||
740 | /* | 744 | /* |
741 | * GPE info flags - Per GPE | 745 | * GPE info flags - Per GPE |
diff --git a/include/acpi/processor.h b/include/acpi/processor.h index 9b9b6f29bbf3..3ca9b751f122 100644 --- a/include/acpi/processor.h +++ b/include/acpi/processor.h | |||
@@ -67,9 +67,6 @@ struct acpi_processor_cx { | |||
67 | }; | 67 | }; |
68 | 68 | ||
69 | struct acpi_processor_power { | 69 | struct acpi_processor_power { |
70 | struct acpi_processor_cx *state; | ||
71 | unsigned long bm_check_timestamp; | ||
72 | u32 default_state; | ||
73 | int count; | 70 | int count; |
74 | struct acpi_processor_cx states[ACPI_PROCESSOR_MAX_POWER]; | 71 | struct acpi_processor_cx states[ACPI_PROCESSOR_MAX_POWER]; |
75 | int timer_broadcast_on_state; | 72 | int timer_broadcast_on_state; |
@@ -313,11 +310,13 @@ static inline int acpi_processor_get_bios_limit(int cpu, unsigned int *limit) | |||
313 | #endif /* CONFIG_CPU_FREQ */ | 310 | #endif /* CONFIG_CPU_FREQ */ |
314 | 311 | ||
315 | /* in processor_core.c */ | 312 | /* in processor_core.c */ |
316 | void acpi_processor_set_pdc(acpi_handle handle); | ||
317 | int acpi_get_apicid(acpi_handle, int type, u32 acpi_id); | 313 | int acpi_get_apicid(acpi_handle, int type, u32 acpi_id); |
318 | int acpi_map_cpuid(int apic_id, u32 acpi_id); | 314 | int acpi_map_cpuid(int apic_id, u32 acpi_id); |
319 | int acpi_get_cpuid(acpi_handle, int type, u32 acpi_id); | 315 | int acpi_get_cpuid(acpi_handle, int type, u32 acpi_id); |
320 | 316 | ||
317 | /* in processor_pdc.c */ | ||
318 | void acpi_processor_set_pdc(acpi_handle handle); | ||
319 | |||
321 | /* in processor_throttling.c */ | 320 | /* in processor_throttling.c */ |
322 | int acpi_processor_tstate_has_changed(struct acpi_processor *pr); | 321 | int acpi_processor_tstate_has_changed(struct acpi_processor *pr); |
323 | int acpi_processor_get_throttling_info(struct acpi_processor *pr); | 322 | int acpi_processor_get_throttling_info(struct acpi_processor *pr); |
diff --git a/include/dt-bindings/clock/qcom,mmcc-apq8084.h b/include/dt-bindings/clock/qcom,mmcc-apq8084.h index a929f86d0ddd..d72b5b35f15e 100644 --- a/include/dt-bindings/clock/qcom,mmcc-apq8084.h +++ b/include/dt-bindings/clock/qcom,mmcc-apq8084.h | |||
@@ -60,7 +60,7 @@ | |||
60 | #define ESC1_CLK_SRC 43 | 60 | #define ESC1_CLK_SRC 43 |
61 | #define HDMI_CLK_SRC 44 | 61 | #define HDMI_CLK_SRC 44 |
62 | #define VSYNC_CLK_SRC 45 | 62 | #define VSYNC_CLK_SRC 45 |
63 | #define RBCPR_CLK_SRC 46 | 63 | #define MMSS_RBCPR_CLK_SRC 46 |
64 | #define RBBMTIMER_CLK_SRC 47 | 64 | #define RBBMTIMER_CLK_SRC 47 |
65 | #define MAPLE_CLK_SRC 48 | 65 | #define MAPLE_CLK_SRC 48 |
66 | #define VDP_CLK_SRC 49 | 66 | #define VDP_CLK_SRC 49 |
diff --git a/include/linux/acpi.h b/include/linux/acpi.h index 407a12f663eb..d7a5fcf9ef0f 100644 --- a/include/linux/acpi.h +++ b/include/linux/acpi.h | |||
@@ -28,6 +28,7 @@ | |||
28 | #include <linux/errno.h> | 28 | #include <linux/errno.h> |
29 | #include <linux/ioport.h> /* for struct resource */ | 29 | #include <linux/ioport.h> /* for struct resource */ |
30 | #include <linux/device.h> | 30 | #include <linux/device.h> |
31 | #include <linux/property.h> | ||
31 | 32 | ||
32 | #ifndef _LINUX | 33 | #ifndef _LINUX |
33 | #define _LINUX | 34 | #define _LINUX |
@@ -123,6 +124,10 @@ int acpi_numa_init (void); | |||
123 | 124 | ||
124 | int acpi_table_init (void); | 125 | int acpi_table_init (void); |
125 | int acpi_table_parse(char *id, acpi_tbl_table_handler handler); | 126 | int acpi_table_parse(char *id, acpi_tbl_table_handler handler); |
127 | int __init acpi_parse_entries(char *id, unsigned long table_size, | ||
128 | acpi_tbl_entry_handler handler, | ||
129 | struct acpi_table_header *table_header, | ||
130 | int entry_id, unsigned int max_entries); | ||
126 | int __init acpi_table_parse_entries(char *id, unsigned long table_size, | 131 | int __init acpi_table_parse_entries(char *id, unsigned long table_size, |
127 | int entry_id, | 132 | int entry_id, |
128 | acpi_tbl_entry_handler handler, | 133 | acpi_tbl_entry_handler handler, |
@@ -423,14 +428,11 @@ extern int acpi_nvs_for_each_region(int (*func)(__u64, __u64, void *), | |||
423 | const struct acpi_device_id *acpi_match_device(const struct acpi_device_id *ids, | 428 | const struct acpi_device_id *acpi_match_device(const struct acpi_device_id *ids, |
424 | const struct device *dev); | 429 | const struct device *dev); |
425 | 430 | ||
426 | static inline bool acpi_driver_match_device(struct device *dev, | 431 | extern bool acpi_driver_match_device(struct device *dev, |
427 | const struct device_driver *drv) | 432 | const struct device_driver *drv); |
428 | { | ||
429 | return !!acpi_match_device(drv->acpi_match_table, dev); | ||
430 | } | ||
431 | |||
432 | int acpi_device_uevent_modalias(struct device *, struct kobj_uevent_env *); | 433 | int acpi_device_uevent_modalias(struct device *, struct kobj_uevent_env *); |
433 | int acpi_device_modalias(struct device *, char *, int); | 434 | int acpi_device_modalias(struct device *, char *, int); |
435 | void acpi_walk_dep_device_list(acpi_handle handle); | ||
434 | 436 | ||
435 | struct platform_device *acpi_create_platform_device(struct acpi_device *); | 437 | struct platform_device *acpi_create_platform_device(struct acpi_device *); |
436 | #define ACPI_PTR(_ptr) (_ptr) | 438 | #define ACPI_PTR(_ptr) (_ptr) |
@@ -443,6 +445,23 @@ struct platform_device *acpi_create_platform_device(struct acpi_device *); | |||
443 | #define ACPI_COMPANION_SET(dev, adev) do { } while (0) | 445 | #define ACPI_COMPANION_SET(dev, adev) do { } while (0) |
444 | #define ACPI_HANDLE(dev) (NULL) | 446 | #define ACPI_HANDLE(dev) (NULL) |
445 | 447 | ||
448 | struct fwnode_handle; | ||
449 | |||
450 | static inline bool is_acpi_node(struct fwnode_handle *fwnode) | ||
451 | { | ||
452 | return false; | ||
453 | } | ||
454 | |||
455 | static inline struct acpi_device *acpi_node(struct fwnode_handle *fwnode) | ||
456 | { | ||
457 | return NULL; | ||
458 | } | ||
459 | |||
460 | static inline struct fwnode_handle *acpi_fwnode_handle(struct acpi_device *adev) | ||
461 | { | ||
462 | return NULL; | ||
463 | } | ||
464 | |||
446 | static inline const char *acpi_dev_name(struct acpi_device *adev) | 465 | static inline const char *acpi_dev_name(struct acpi_device *adev) |
447 | { | 466 | { |
448 | return NULL; | 467 | return NULL; |
@@ -659,4 +678,114 @@ do { \ | |||
659 | #endif | 678 | #endif |
660 | #endif | 679 | #endif |
661 | 680 | ||
681 | struct acpi_gpio_params { | ||
682 | unsigned int crs_entry_index; | ||
683 | unsigned int line_index; | ||
684 | bool active_low; | ||
685 | }; | ||
686 | |||
687 | struct acpi_gpio_mapping { | ||
688 | const char *name; | ||
689 | const struct acpi_gpio_params *data; | ||
690 | unsigned int size; | ||
691 | }; | ||
692 | |||
693 | #if defined(CONFIG_ACPI) && defined(CONFIG_GPIOLIB) | ||
694 | int acpi_dev_add_driver_gpios(struct acpi_device *adev, | ||
695 | const struct acpi_gpio_mapping *gpios); | ||
696 | |||
697 | static inline void acpi_dev_remove_driver_gpios(struct acpi_device *adev) | ||
698 | { | ||
699 | if (adev) | ||
700 | adev->driver_gpios = NULL; | ||
701 | } | ||
702 | #else | ||
703 | static inline int acpi_dev_add_driver_gpios(struct acpi_device *adev, | ||
704 | const struct acpi_gpio_mapping *gpios) | ||
705 | { | ||
706 | return -ENXIO; | ||
707 | } | ||
708 | static inline void acpi_dev_remove_driver_gpios(struct acpi_device *adev) {} | ||
709 | #endif | ||
710 | |||
711 | /* Device properties */ | ||
712 | |||
713 | #define MAX_ACPI_REFERENCE_ARGS 8 | ||
714 | struct acpi_reference_args { | ||
715 | struct acpi_device *adev; | ||
716 | size_t nargs; | ||
717 | u64 args[MAX_ACPI_REFERENCE_ARGS]; | ||
718 | }; | ||
719 | |||
720 | #ifdef CONFIG_ACPI | ||
721 | int acpi_dev_get_property(struct acpi_device *adev, const char *name, | ||
722 | acpi_object_type type, const union acpi_object **obj); | ||
723 | int acpi_dev_get_property_array(struct acpi_device *adev, const char *name, | ||
724 | acpi_object_type type, | ||
725 | const union acpi_object **obj); | ||
726 | int acpi_dev_get_property_reference(struct acpi_device *adev, | ||
727 | const char *name, size_t index, | ||
728 | struct acpi_reference_args *args); | ||
729 | |||
730 | int acpi_dev_prop_get(struct acpi_device *adev, const char *propname, | ||
731 | void **valptr); | ||
732 | int acpi_dev_prop_read_single(struct acpi_device *adev, const char *propname, | ||
733 | enum dev_prop_type proptype, void *val); | ||
734 | int acpi_dev_prop_read(struct acpi_device *adev, const char *propname, | ||
735 | enum dev_prop_type proptype, void *val, size_t nval); | ||
736 | |||
737 | struct acpi_device *acpi_get_next_child(struct device *dev, | ||
738 | struct acpi_device *child); | ||
739 | #else | ||
740 | static inline int acpi_dev_get_property(struct acpi_device *adev, | ||
741 | const char *name, acpi_object_type type, | ||
742 | const union acpi_object **obj) | ||
743 | { | ||
744 | return -ENXIO; | ||
745 | } | ||
746 | static inline int acpi_dev_get_property_array(struct acpi_device *adev, | ||
747 | const char *name, | ||
748 | acpi_object_type type, | ||
749 | const union acpi_object **obj) | ||
750 | { | ||
751 | return -ENXIO; | ||
752 | } | ||
753 | static inline int acpi_dev_get_property_reference(struct acpi_device *adev, | ||
754 | const char *name, const char *cells_name, | ||
755 | size_t index, struct acpi_reference_args *args) | ||
756 | { | ||
757 | return -ENXIO; | ||
758 | } | ||
759 | |||
760 | static inline int acpi_dev_prop_get(struct acpi_device *adev, | ||
761 | const char *propname, | ||
762 | void **valptr) | ||
763 | { | ||
764 | return -ENXIO; | ||
765 | } | ||
766 | |||
767 | static inline int acpi_dev_prop_read_single(struct acpi_device *adev, | ||
768 | const char *propname, | ||
769 | enum dev_prop_type proptype, | ||
770 | void *val) | ||
771 | { | ||
772 | return -ENXIO; | ||
773 | } | ||
774 | |||
775 | static inline int acpi_dev_prop_read(struct acpi_device *adev, | ||
776 | const char *propname, | ||
777 | enum dev_prop_type proptype, | ||
778 | void *val, size_t nval) | ||
779 | { | ||
780 | return -ENXIO; | ||
781 | } | ||
782 | |||
783 | static inline struct acpi_device *acpi_get_next_child(struct device *dev, | ||
784 | struct acpi_device *child) | ||
785 | { | ||
786 | return NULL; | ||
787 | } | ||
788 | |||
789 | #endif | ||
790 | |||
662 | #endif /*_LINUX_ACPI_H*/ | 791 | #endif /*_LINUX_ACPI_H*/ |
diff --git a/include/linux/bitops.h b/include/linux/bitops.h index be5fd38bd5a0..5d858e02997f 100644 --- a/include/linux/bitops.h +++ b/include/linux/bitops.h | |||
@@ -18,8 +18,11 @@ | |||
18 | * position @h. For example | 18 | * position @h. For example |
19 | * GENMASK_ULL(39, 21) gives us the 64bit vector 0x000000ffffe00000. | 19 | * GENMASK_ULL(39, 21) gives us the 64bit vector 0x000000ffffe00000. |
20 | */ | 20 | */ |
21 | #define GENMASK(h, l) (((U32_C(1) << ((h) - (l) + 1)) - 1) << (l)) | 21 | #define GENMASK(h, l) \ |
22 | #define GENMASK_ULL(h, l) (((U64_C(1) << ((h) - (l) + 1)) - 1) << (l)) | 22 | (((~0UL) << (l)) & (~0UL >> (BITS_PER_LONG - 1 - (h)))) |
23 | |||
24 | #define GENMASK_ULL(h, l) \ | ||
25 | (((~0ULL) << (l)) & (~0ULL >> (BITS_PER_LONG_LONG - 1 - (h)))) | ||
23 | 26 | ||
24 | extern unsigned int __sw_hweight8(unsigned int w); | 27 | extern unsigned int __sw_hweight8(unsigned int w); |
25 | extern unsigned int __sw_hweight16(unsigned int w); | 28 | extern unsigned int __sw_hweight16(unsigned int w); |
diff --git a/include/linux/can/dev.h b/include/linux/can/dev.h index 6992afc6ba7f..b37ea95bc348 100644 --- a/include/linux/can/dev.h +++ b/include/linux/can/dev.h | |||
@@ -99,6 +99,12 @@ inval_skb: | |||
99 | return 1; | 99 | return 1; |
100 | } | 100 | } |
101 | 101 | ||
102 | static inline bool can_is_canfd_skb(const struct sk_buff *skb) | ||
103 | { | ||
104 | /* the CAN specific type of skb is identified by its data length */ | ||
105 | return skb->len == CANFD_MTU; | ||
106 | } | ||
107 | |||
102 | /* get data length from can_dlc with sanitized can_dlc */ | 108 | /* get data length from can_dlc with sanitized can_dlc */ |
103 | u8 can_dlc2len(u8 can_dlc); | 109 | u8 can_dlc2len(u8 can_dlc); |
104 | 110 | ||
diff --git a/include/linux/clk-provider.h b/include/linux/clk-provider.h index be21af149f11..2839c639f092 100644 --- a/include/linux/clk-provider.h +++ b/include/linux/clk-provider.h | |||
@@ -352,7 +352,6 @@ struct clk_divider { | |||
352 | #define CLK_DIVIDER_READ_ONLY BIT(5) | 352 | #define CLK_DIVIDER_READ_ONLY BIT(5) |
353 | 353 | ||
354 | extern const struct clk_ops clk_divider_ops; | 354 | extern const struct clk_ops clk_divider_ops; |
355 | extern const struct clk_ops clk_divider_ro_ops; | ||
356 | struct clk *clk_register_divider(struct device *dev, const char *name, | 355 | struct clk *clk_register_divider(struct device *dev, const char *name, |
357 | const char *parent_name, unsigned long flags, | 356 | const char *parent_name, unsigned long flags, |
358 | void __iomem *reg, u8 shift, u8 width, | 357 | void __iomem *reg, u8 shift, u8 width, |
diff --git a/include/linux/gpio/consumer.h b/include/linux/gpio/consumer.h index 12f146fa6604..00b1b70d68ba 100644 --- a/include/linux/gpio/consumer.h +++ b/include/linux/gpio/consumer.h | |||
@@ -94,6 +94,13 @@ int gpiod_to_irq(const struct gpio_desc *desc); | |||
94 | struct gpio_desc *gpio_to_desc(unsigned gpio); | 94 | struct gpio_desc *gpio_to_desc(unsigned gpio); |
95 | int desc_to_gpio(const struct gpio_desc *desc); | 95 | int desc_to_gpio(const struct gpio_desc *desc); |
96 | 96 | ||
97 | /* Child properties interface */ | ||
98 | struct fwnode_handle; | ||
99 | |||
100 | struct gpio_desc *fwnode_get_named_gpiod(struct fwnode_handle *fwnode, | ||
101 | const char *propname); | ||
102 | struct gpio_desc *devm_get_gpiod_from_child(struct device *dev, | ||
103 | struct fwnode_handle *child); | ||
97 | #else /* CONFIG_GPIOLIB */ | 104 | #else /* CONFIG_GPIOLIB */ |
98 | 105 | ||
99 | static inline struct gpio_desc *__must_check __gpiod_get(struct device *dev, | 106 | static inline struct gpio_desc *__must_check __gpiod_get(struct device *dev, |
diff --git a/include/linux/gpio_keys.h b/include/linux/gpio_keys.h index 8b622468952c..ee2d8c6f9130 100644 --- a/include/linux/gpio_keys.h +++ b/include/linux/gpio_keys.h | |||
@@ -2,6 +2,7 @@ | |||
2 | #define _GPIO_KEYS_H | 2 | #define _GPIO_KEYS_H |
3 | 3 | ||
4 | struct device; | 4 | struct device; |
5 | struct gpio_desc; | ||
5 | 6 | ||
6 | /** | 7 | /** |
7 | * struct gpio_keys_button - configuration parameters | 8 | * struct gpio_keys_button - configuration parameters |
@@ -17,6 +18,7 @@ struct device; | |||
17 | * disable button via sysfs | 18 | * disable button via sysfs |
18 | * @value: axis value for %EV_ABS | 19 | * @value: axis value for %EV_ABS |
19 | * @irq: Irq number in case of interrupt keys | 20 | * @irq: Irq number in case of interrupt keys |
21 | * @gpiod: GPIO descriptor | ||
20 | */ | 22 | */ |
21 | struct gpio_keys_button { | 23 | struct gpio_keys_button { |
22 | unsigned int code; | 24 | unsigned int code; |
@@ -29,6 +31,7 @@ struct gpio_keys_button { | |||
29 | bool can_disable; | 31 | bool can_disable; |
30 | int value; | 32 | int value; |
31 | unsigned int irq; | 33 | unsigned int irq; |
34 | struct gpio_desc *gpiod; | ||
32 | }; | 35 | }; |
33 | 36 | ||
34 | /** | 37 | /** |
diff --git a/include/linux/iio/events.h b/include/linux/iio/events.h index 8bbd7bc1043d..03fa332ad2a8 100644 --- a/include/linux/iio/events.h +++ b/include/linux/iio/events.h | |||
@@ -72,7 +72,7 @@ struct iio_event_data { | |||
72 | 72 | ||
73 | #define IIO_EVENT_CODE_EXTRACT_TYPE(mask) ((mask >> 56) & 0xFF) | 73 | #define IIO_EVENT_CODE_EXTRACT_TYPE(mask) ((mask >> 56) & 0xFF) |
74 | 74 | ||
75 | #define IIO_EVENT_CODE_EXTRACT_DIR(mask) ((mask >> 48) & 0xCF) | 75 | #define IIO_EVENT_CODE_EXTRACT_DIR(mask) ((mask >> 48) & 0x7F) |
76 | 76 | ||
77 | #define IIO_EVENT_CODE_EXTRACT_CHAN_TYPE(mask) ((mask >> 32) & 0xFF) | 77 | #define IIO_EVENT_CODE_EXTRACT_CHAN_TYPE(mask) ((mask >> 32) & 0xFF) |
78 | 78 | ||
diff --git a/include/linux/inetdevice.h b/include/linux/inetdevice.h index 0068708161ff..0a21fbefdfbe 100644 --- a/include/linux/inetdevice.h +++ b/include/linux/inetdevice.h | |||
@@ -242,7 +242,7 @@ static inline void in_dev_put(struct in_device *idev) | |||
242 | static __inline__ __be32 inet_make_mask(int logmask) | 242 | static __inline__ __be32 inet_make_mask(int logmask) |
243 | { | 243 | { |
244 | if (logmask) | 244 | if (logmask) |
245 | return htonl(~((1<<(32-logmask))-1)); | 245 | return htonl(~((1U<<(32-logmask))-1)); |
246 | return 0; | 246 | return 0; |
247 | } | 247 | } |
248 | 248 | ||
diff --git a/include/linux/kernel_stat.h b/include/linux/kernel_stat.h index 8422b4ed6882..b9376cd5a187 100644 --- a/include/linux/kernel_stat.h +++ b/include/linux/kernel_stat.h | |||
@@ -77,11 +77,6 @@ static inline unsigned int kstat_cpu_irqs_sum(unsigned int cpu) | |||
77 | return kstat_cpu(cpu).irqs_sum; | 77 | return kstat_cpu(cpu).irqs_sum; |
78 | } | 78 | } |
79 | 79 | ||
80 | /* | ||
81 | * Lock/unlock the current runqueue - to extract task statistics: | ||
82 | */ | ||
83 | extern unsigned long long task_delta_exec(struct task_struct *); | ||
84 | |||
85 | extern void account_user_time(struct task_struct *, cputime_t, cputime_t); | 80 | extern void account_user_time(struct task_struct *, cputime_t, cputime_t); |
86 | extern void account_system_time(struct task_struct *, int, cputime_t, cputime_t); | 81 | extern void account_system_time(struct task_struct *, int, cputime_t, cputime_t); |
87 | extern void account_steal_time(cputime_t); | 82 | extern void account_steal_time(cputime_t); |
diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h index ea53b04993f2..a6059bdf7b03 100644 --- a/include/linux/kvm_host.h +++ b/include/linux/kvm_host.h | |||
@@ -703,7 +703,7 @@ void kvm_arch_sync_events(struct kvm *kvm); | |||
703 | int kvm_cpu_has_pending_timer(struct kvm_vcpu *vcpu); | 703 | int kvm_cpu_has_pending_timer(struct kvm_vcpu *vcpu); |
704 | void kvm_vcpu_kick(struct kvm_vcpu *vcpu); | 704 | void kvm_vcpu_kick(struct kvm_vcpu *vcpu); |
705 | 705 | ||
706 | bool kvm_is_mmio_pfn(pfn_t pfn); | 706 | bool kvm_is_reserved_pfn(pfn_t pfn); |
707 | 707 | ||
708 | struct kvm_irq_ack_notifier { | 708 | struct kvm_irq_ack_notifier { |
709 | struct hlist_node link; | 709 | struct hlist_node link; |
diff --git a/include/linux/leds.h b/include/linux/leds.h index a57611d0c94e..361101fef270 100644 --- a/include/linux/leds.h +++ b/include/linux/leds.h | |||
@@ -261,6 +261,7 @@ struct gpio_led { | |||
261 | unsigned retain_state_suspended : 1; | 261 | unsigned retain_state_suspended : 1; |
262 | unsigned default_state : 2; | 262 | unsigned default_state : 2; |
263 | /* default_state should be one of LEDS_GPIO_DEFSTATE_(ON|OFF|KEEP) */ | 263 | /* default_state should be one of LEDS_GPIO_DEFSTATE_(ON|OFF|KEEP) */ |
264 | struct gpio_desc *gpiod; | ||
264 | }; | 265 | }; |
265 | #define LEDS_GPIO_DEFSTATE_OFF 0 | 266 | #define LEDS_GPIO_DEFSTATE_OFF 0 |
266 | #define LEDS_GPIO_DEFSTATE_ON 1 | 267 | #define LEDS_GPIO_DEFSTATE_ON 1 |
@@ -273,7 +274,7 @@ struct gpio_led_platform_data { | |||
273 | #define GPIO_LED_NO_BLINK_LOW 0 /* No blink GPIO state low */ | 274 | #define GPIO_LED_NO_BLINK_LOW 0 /* No blink GPIO state low */ |
274 | #define GPIO_LED_NO_BLINK_HIGH 1 /* No blink GPIO state high */ | 275 | #define GPIO_LED_NO_BLINK_HIGH 1 /* No blink GPIO state high */ |
275 | #define GPIO_LED_BLINK 2 /* Please, blink */ | 276 | #define GPIO_LED_BLINK 2 /* Please, blink */ |
276 | int (*gpio_blink_set)(unsigned gpio, int state, | 277 | int (*gpio_blink_set)(struct gpio_desc *desc, int state, |
277 | unsigned long *delay_on, | 278 | unsigned long *delay_on, |
278 | unsigned long *delay_off); | 279 | unsigned long *delay_off); |
279 | }; | 280 | }; |
diff --git a/include/linux/mfd/axp20x.h b/include/linux/mfd/axp20x.h index d0e31a2287ac..81589d176ae8 100644 --- a/include/linux/mfd/axp20x.h +++ b/include/linux/mfd/axp20x.h | |||
@@ -14,6 +14,8 @@ | |||
14 | enum { | 14 | enum { |
15 | AXP202_ID = 0, | 15 | AXP202_ID = 0, |
16 | AXP209_ID, | 16 | AXP209_ID, |
17 | AXP288_ID, | ||
18 | NR_AXP20X_VARIANTS, | ||
17 | }; | 19 | }; |
18 | 20 | ||
19 | #define AXP20X_DATACACHE(m) (0x04 + (m)) | 21 | #define AXP20X_DATACACHE(m) (0x04 + (m)) |
@@ -49,11 +51,13 @@ enum { | |||
49 | #define AXP20X_IRQ3_EN 0x42 | 51 | #define AXP20X_IRQ3_EN 0x42 |
50 | #define AXP20X_IRQ4_EN 0x43 | 52 | #define AXP20X_IRQ4_EN 0x43 |
51 | #define AXP20X_IRQ5_EN 0x44 | 53 | #define AXP20X_IRQ5_EN 0x44 |
54 | #define AXP20X_IRQ6_EN 0x45 | ||
52 | #define AXP20X_IRQ1_STATE 0x48 | 55 | #define AXP20X_IRQ1_STATE 0x48 |
53 | #define AXP20X_IRQ2_STATE 0x49 | 56 | #define AXP20X_IRQ2_STATE 0x49 |
54 | #define AXP20X_IRQ3_STATE 0x4a | 57 | #define AXP20X_IRQ3_STATE 0x4a |
55 | #define AXP20X_IRQ4_STATE 0x4b | 58 | #define AXP20X_IRQ4_STATE 0x4b |
56 | #define AXP20X_IRQ5_STATE 0x4c | 59 | #define AXP20X_IRQ5_STATE 0x4c |
60 | #define AXP20X_IRQ6_STATE 0x4d | ||
57 | 61 | ||
58 | /* ADC */ | 62 | /* ADC */ |
59 | #define AXP20X_ACIN_V_ADC_H 0x56 | 63 | #define AXP20X_ACIN_V_ADC_H 0x56 |
@@ -116,6 +120,15 @@ enum { | |||
116 | #define AXP20X_CC_CTRL 0xb8 | 120 | #define AXP20X_CC_CTRL 0xb8 |
117 | #define AXP20X_FG_RES 0xb9 | 121 | #define AXP20X_FG_RES 0xb9 |
118 | 122 | ||
123 | /* AXP288 specific registers */ | ||
124 | #define AXP288_PMIC_ADC_H 0x56 | ||
125 | #define AXP288_PMIC_ADC_L 0x57 | ||
126 | #define AXP288_ADC_TS_PIN_CTRL 0x84 | ||
127 | |||
128 | #define AXP288_PMIC_ADC_EN 0x84 | ||
129 | #define AXP288_FG_TUNE5 0xed | ||
130 | |||
131 | |||
119 | /* Regulators IDs */ | 132 | /* Regulators IDs */ |
120 | enum { | 133 | enum { |
121 | AXP20X_LDO1 = 0, | 134 | AXP20X_LDO1 = 0, |
@@ -169,12 +182,58 @@ enum { | |||
169 | AXP20X_IRQ_GPIO0_INPUT, | 182 | AXP20X_IRQ_GPIO0_INPUT, |
170 | }; | 183 | }; |
171 | 184 | ||
185 | enum axp288_irqs { | ||
186 | AXP288_IRQ_VBUS_FALL = 2, | ||
187 | AXP288_IRQ_VBUS_RISE, | ||
188 | AXP288_IRQ_OV, | ||
189 | AXP288_IRQ_FALLING_ALT, | ||
190 | AXP288_IRQ_RISING_ALT, | ||
191 | AXP288_IRQ_OV_ALT, | ||
192 | AXP288_IRQ_DONE = 10, | ||
193 | AXP288_IRQ_CHARGING, | ||
194 | AXP288_IRQ_SAFE_QUIT, | ||
195 | AXP288_IRQ_SAFE_ENTER, | ||
196 | AXP288_IRQ_ABSENT, | ||
197 | AXP288_IRQ_APPEND, | ||
198 | AXP288_IRQ_QWBTU, | ||
199 | AXP288_IRQ_WBTU, | ||
200 | AXP288_IRQ_QWBTO, | ||
201 | AXP288_IRQ_WBTO, | ||
202 | AXP288_IRQ_QCBTU, | ||
203 | AXP288_IRQ_CBTU, | ||
204 | AXP288_IRQ_QCBTO, | ||
205 | AXP288_IRQ_CBTO, | ||
206 | AXP288_IRQ_WL2, | ||
207 | AXP288_IRQ_WL1, | ||
208 | AXP288_IRQ_GPADC, | ||
209 | AXP288_IRQ_OT = 31, | ||
210 | AXP288_IRQ_GPIO0, | ||
211 | AXP288_IRQ_GPIO1, | ||
212 | AXP288_IRQ_POKO, | ||
213 | AXP288_IRQ_POKL, | ||
214 | AXP288_IRQ_POKS, | ||
215 | AXP288_IRQ_POKN, | ||
216 | AXP288_IRQ_POKP, | ||
217 | AXP288_IRQ_TIMER, | ||
218 | AXP288_IRQ_MV_CHNG, | ||
219 | AXP288_IRQ_BC_USB_CHNG, | ||
220 | }; | ||
221 | |||
222 | #define AXP288_TS_ADC_H 0x58 | ||
223 | #define AXP288_TS_ADC_L 0x59 | ||
224 | #define AXP288_GP_ADC_H 0x5a | ||
225 | #define AXP288_GP_ADC_L 0x5b | ||
226 | |||
172 | struct axp20x_dev { | 227 | struct axp20x_dev { |
173 | struct device *dev; | 228 | struct device *dev; |
174 | struct i2c_client *i2c_client; | 229 | struct i2c_client *i2c_client; |
175 | struct regmap *regmap; | 230 | struct regmap *regmap; |
176 | struct regmap_irq_chip_data *regmap_irqc; | 231 | struct regmap_irq_chip_data *regmap_irqc; |
177 | long variant; | 232 | long variant; |
233 | int nr_cells; | ||
234 | struct mfd_cell *cells; | ||
235 | const struct regmap_config *regmap_cfg; | ||
236 | const struct regmap_irq_chip *regmap_irq_chip; | ||
178 | }; | 237 | }; |
179 | 238 | ||
180 | #endif /* __LINUX_MFD_AXP20X_H */ | 239 | #endif /* __LINUX_MFD_AXP20X_H */ |
diff --git a/include/linux/of.h b/include/linux/of.h index 29f0adc5f3e4..cf79be1441d2 100644 --- a/include/linux/of.h +++ b/include/linux/of.h | |||
@@ -23,6 +23,7 @@ | |||
23 | #include <linux/spinlock.h> | 23 | #include <linux/spinlock.h> |
24 | #include <linux/topology.h> | 24 | #include <linux/topology.h> |
25 | #include <linux/notifier.h> | 25 | #include <linux/notifier.h> |
26 | #include <linux/property.h> | ||
26 | 27 | ||
27 | #include <asm/byteorder.h> | 28 | #include <asm/byteorder.h> |
28 | #include <asm/errno.h> | 29 | #include <asm/errno.h> |
@@ -49,6 +50,7 @@ struct device_node { | |||
49 | const char *type; | 50 | const char *type; |
50 | phandle phandle; | 51 | phandle phandle; |
51 | const char *full_name; | 52 | const char *full_name; |
53 | struct fwnode_handle fwnode; | ||
52 | 54 | ||
53 | struct property *properties; | 55 | struct property *properties; |
54 | struct property *deadprops; /* removed properties */ | 56 | struct property *deadprops; /* removed properties */ |
@@ -79,6 +81,7 @@ extern struct kobj_type of_node_ktype; | |||
79 | static inline void of_node_init(struct device_node *node) | 81 | static inline void of_node_init(struct device_node *node) |
80 | { | 82 | { |
81 | kobject_init(&node->kobj, &of_node_ktype); | 83 | kobject_init(&node->kobj, &of_node_ktype); |
84 | node->fwnode.type = FWNODE_OF; | ||
82 | } | 85 | } |
83 | 86 | ||
84 | /* true when node is initialized */ | 87 | /* true when node is initialized */ |
@@ -114,6 +117,16 @@ extern struct device_node *of_aliases; | |||
114 | extern struct device_node *of_stdout; | 117 | extern struct device_node *of_stdout; |
115 | extern raw_spinlock_t devtree_lock; | 118 | extern raw_spinlock_t devtree_lock; |
116 | 119 | ||
120 | static inline bool is_of_node(struct fwnode_handle *fwnode) | ||
121 | { | ||
122 | return fwnode && fwnode->type == FWNODE_OF; | ||
123 | } | ||
124 | |||
125 | static inline struct device_node *of_node(struct fwnode_handle *fwnode) | ||
126 | { | ||
127 | return fwnode ? container_of(fwnode, struct device_node, fwnode) : NULL; | ||
128 | } | ||
129 | |||
117 | static inline bool of_have_populated_dt(void) | 130 | static inline bool of_have_populated_dt(void) |
118 | { | 131 | { |
119 | return of_allnodes != NULL; | 132 | return of_allnodes != NULL; |
@@ -263,6 +276,10 @@ extern int of_property_read_u32_array(const struct device_node *np, | |||
263 | size_t sz); | 276 | size_t sz); |
264 | extern int of_property_read_u64(const struct device_node *np, | 277 | extern int of_property_read_u64(const struct device_node *np, |
265 | const char *propname, u64 *out_value); | 278 | const char *propname, u64 *out_value); |
279 | extern int of_property_read_u64_array(const struct device_node *np, | ||
280 | const char *propname, | ||
281 | u64 *out_values, | ||
282 | size_t sz); | ||
266 | 283 | ||
267 | extern int of_property_read_string(struct device_node *np, | 284 | extern int of_property_read_string(struct device_node *np, |
268 | const char *propname, | 285 | const char *propname, |
@@ -355,6 +372,16 @@ bool of_console_check(struct device_node *dn, char *name, int index); | |||
355 | 372 | ||
356 | #else /* CONFIG_OF */ | 373 | #else /* CONFIG_OF */ |
357 | 374 | ||
375 | static inline bool is_of_node(struct fwnode_handle *fwnode) | ||
376 | { | ||
377 | return false; | ||
378 | } | ||
379 | |||
380 | static inline struct device_node *of_node(struct fwnode_handle *fwnode) | ||
381 | { | ||
382 | return NULL; | ||
383 | } | ||
384 | |||
358 | static inline const char* of_node_full_name(const struct device_node *np) | 385 | static inline const char* of_node_full_name(const struct device_node *np) |
359 | { | 386 | { |
360 | return "<no-node>"; | 387 | return "<no-node>"; |
@@ -477,6 +504,13 @@ static inline int of_property_read_u32_array(const struct device_node *np, | |||
477 | return -ENOSYS; | 504 | return -ENOSYS; |
478 | } | 505 | } |
479 | 506 | ||
507 | static inline int of_property_read_u64_array(const struct device_node *np, | ||
508 | const char *propname, | ||
509 | u64 *out_values, size_t sz) | ||
510 | { | ||
511 | return -ENOSYS; | ||
512 | } | ||
513 | |||
480 | static inline int of_property_read_string(struct device_node *np, | 514 | static inline int of_property_read_string(struct device_node *np, |
481 | const char *propname, | 515 | const char *propname, |
482 | const char **out_string) | 516 | const char **out_string) |
diff --git a/include/linux/pci.h b/include/linux/pci.h index 5be8db45e368..4c8ac5fcc224 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h | |||
@@ -331,6 +331,7 @@ struct pci_dev { | |||
331 | unsigned int is_added:1; | 331 | unsigned int is_added:1; |
332 | unsigned int is_busmaster:1; /* device is busmaster */ | 332 | unsigned int is_busmaster:1; /* device is busmaster */ |
333 | unsigned int no_msi:1; /* device may not use msi */ | 333 | unsigned int no_msi:1; /* device may not use msi */ |
334 | unsigned int no_64bit_msi:1; /* device may only use 32-bit MSIs */ | ||
334 | unsigned int block_cfg_access:1; /* config space access is blocked */ | 335 | unsigned int block_cfg_access:1; /* config space access is blocked */ |
335 | unsigned int broken_parity_status:1; /* Device generates false positive parity */ | 336 | unsigned int broken_parity_status:1; /* Device generates false positive parity */ |
336 | unsigned int irq_reroute_variant:2; /* device needs IRQ rerouting variant */ | 337 | unsigned int irq_reroute_variant:2; /* device needs IRQ rerouting variant */ |
diff --git a/include/linux/percpu-refcount.h b/include/linux/percpu-refcount.h index d5c89e0dd0e6..51ce60c35f4c 100644 --- a/include/linux/percpu-refcount.h +++ b/include/linux/percpu-refcount.h | |||
@@ -133,7 +133,13 @@ static inline bool __ref_is_percpu(struct percpu_ref *ref, | |||
133 | /* paired with smp_store_release() in percpu_ref_reinit() */ | 133 | /* paired with smp_store_release() in percpu_ref_reinit() */ |
134 | smp_read_barrier_depends(); | 134 | smp_read_barrier_depends(); |
135 | 135 | ||
136 | if (unlikely(percpu_ptr & __PERCPU_REF_ATOMIC)) | 136 | /* |
137 | * Theoretically, the following could test just ATOMIC; however, | ||
138 | * then we'd have to mask off DEAD separately as DEAD may be | ||
139 | * visible without ATOMIC if we race with percpu_ref_kill(). DEAD | ||
140 | * implies ATOMIC anyway. Test them together. | ||
141 | */ | ||
142 | if (unlikely(percpu_ptr & __PERCPU_REF_ATOMIC_DEAD)) | ||
137 | return false; | 143 | return false; |
138 | 144 | ||
139 | *percpu_countp = (unsigned long __percpu *)percpu_ptr; | 145 | *percpu_countp = (unsigned long __percpu *)percpu_ptr; |
diff --git a/include/linux/pm_clock.h b/include/linux/pm_clock.h index 8348866e7b05..0b0039634410 100644 --- a/include/linux/pm_clock.h +++ b/include/linux/pm_clock.h | |||
@@ -18,6 +18,8 @@ struct pm_clk_notifier_block { | |||
18 | char *con_ids[]; | 18 | char *con_ids[]; |
19 | }; | 19 | }; |
20 | 20 | ||
21 | struct clk; | ||
22 | |||
21 | #ifdef CONFIG_PM_CLK | 23 | #ifdef CONFIG_PM_CLK |
22 | static inline bool pm_clk_no_clocks(struct device *dev) | 24 | static inline bool pm_clk_no_clocks(struct device *dev) |
23 | { | 25 | { |
@@ -29,6 +31,7 @@ extern void pm_clk_init(struct device *dev); | |||
29 | extern int pm_clk_create(struct device *dev); | 31 | extern int pm_clk_create(struct device *dev); |
30 | extern void pm_clk_destroy(struct device *dev); | 32 | extern void pm_clk_destroy(struct device *dev); |
31 | extern int pm_clk_add(struct device *dev, const char *con_id); | 33 | extern int pm_clk_add(struct device *dev, const char *con_id); |
34 | extern int pm_clk_add_clk(struct device *dev, struct clk *clk); | ||
32 | extern void pm_clk_remove(struct device *dev, const char *con_id); | 35 | extern void pm_clk_remove(struct device *dev, const char *con_id); |
33 | extern int pm_clk_suspend(struct device *dev); | 36 | extern int pm_clk_suspend(struct device *dev); |
34 | extern int pm_clk_resume(struct device *dev); | 37 | extern int pm_clk_resume(struct device *dev); |
@@ -51,6 +54,11 @@ static inline int pm_clk_add(struct device *dev, const char *con_id) | |||
51 | { | 54 | { |
52 | return -EINVAL; | 55 | return -EINVAL; |
53 | } | 56 | } |
57 | |||
58 | static inline int pm_clk_add_clk(struct device *dev, struct clk *clk) | ||
59 | { | ||
60 | return -EINVAL; | ||
61 | } | ||
54 | static inline void pm_clk_remove(struct device *dev, const char *con_id) | 62 | static inline void pm_clk_remove(struct device *dev, const char *con_id) |
55 | { | 63 | { |
56 | } | 64 | } |
diff --git a/include/linux/pm_opp.h b/include/linux/pm_opp.h index 0330217abfad..cec2d4540914 100644 --- a/include/linux/pm_opp.h +++ b/include/linux/pm_opp.h | |||
@@ -21,7 +21,7 @@ struct dev_pm_opp; | |||
21 | struct device; | 21 | struct device; |
22 | 22 | ||
23 | enum dev_pm_opp_event { | 23 | enum dev_pm_opp_event { |
24 | OPP_EVENT_ADD, OPP_EVENT_ENABLE, OPP_EVENT_DISABLE, | 24 | OPP_EVENT_ADD, OPP_EVENT_REMOVE, OPP_EVENT_ENABLE, OPP_EVENT_DISABLE, |
25 | }; | 25 | }; |
26 | 26 | ||
27 | #if defined(CONFIG_PM_OPP) | 27 | #if defined(CONFIG_PM_OPP) |
@@ -44,6 +44,7 @@ struct dev_pm_opp *dev_pm_opp_find_freq_ceil(struct device *dev, | |||
44 | 44 | ||
45 | int dev_pm_opp_add(struct device *dev, unsigned long freq, | 45 | int dev_pm_opp_add(struct device *dev, unsigned long freq, |
46 | unsigned long u_volt); | 46 | unsigned long u_volt); |
47 | void dev_pm_opp_remove(struct device *dev, unsigned long freq); | ||
47 | 48 | ||
48 | int dev_pm_opp_enable(struct device *dev, unsigned long freq); | 49 | int dev_pm_opp_enable(struct device *dev, unsigned long freq); |
49 | 50 | ||
@@ -90,6 +91,10 @@ static inline int dev_pm_opp_add(struct device *dev, unsigned long freq, | |||
90 | return -EINVAL; | 91 | return -EINVAL; |
91 | } | 92 | } |
92 | 93 | ||
94 | static inline void dev_pm_opp_remove(struct device *dev, unsigned long freq) | ||
95 | { | ||
96 | } | ||
97 | |||
93 | static inline int dev_pm_opp_enable(struct device *dev, unsigned long freq) | 98 | static inline int dev_pm_opp_enable(struct device *dev, unsigned long freq) |
94 | { | 99 | { |
95 | return 0; | 100 | return 0; |
@@ -109,11 +114,16 @@ static inline struct srcu_notifier_head *dev_pm_opp_get_notifier( | |||
109 | 114 | ||
110 | #if defined(CONFIG_PM_OPP) && defined(CONFIG_OF) | 115 | #if defined(CONFIG_PM_OPP) && defined(CONFIG_OF) |
111 | int of_init_opp_table(struct device *dev); | 116 | int of_init_opp_table(struct device *dev); |
117 | void of_free_opp_table(struct device *dev); | ||
112 | #else | 118 | #else |
113 | static inline int of_init_opp_table(struct device *dev) | 119 | static inline int of_init_opp_table(struct device *dev) |
114 | { | 120 | { |
115 | return -EINVAL; | 121 | return -EINVAL; |
116 | } | 122 | } |
123 | |||
124 | static inline void of_free_opp_table(struct device *dev) | ||
125 | { | ||
126 | } | ||
117 | #endif | 127 | #endif |
118 | 128 | ||
119 | #endif /* __LINUX_OPP_H__ */ | 129 | #endif /* __LINUX_OPP_H__ */ |
diff --git a/include/linux/property.h b/include/linux/property.h new file mode 100644 index 000000000000..a6a3d98bd7e9 --- /dev/null +++ b/include/linux/property.h | |||
@@ -0,0 +1,143 @@ | |||
1 | /* | ||
2 | * property.h - Unified device property interface. | ||
3 | * | ||
4 | * Copyright (C) 2014, Intel Corporation | ||
5 | * Authors: Rafael J. Wysocki <rafael.j.wysocki@intel.com> | ||
6 | * Mika Westerberg <mika.westerberg@linux.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 | |||
13 | #ifndef _LINUX_PROPERTY_H_ | ||
14 | #define _LINUX_PROPERTY_H_ | ||
15 | |||
16 | #include <linux/types.h> | ||
17 | |||
18 | struct device; | ||
19 | |||
20 | enum dev_prop_type { | ||
21 | DEV_PROP_U8, | ||
22 | DEV_PROP_U16, | ||
23 | DEV_PROP_U32, | ||
24 | DEV_PROP_U64, | ||
25 | DEV_PROP_STRING, | ||
26 | DEV_PROP_MAX, | ||
27 | }; | ||
28 | |||
29 | bool device_property_present(struct device *dev, const char *propname); | ||
30 | int device_property_read_u8_array(struct device *dev, const char *propname, | ||
31 | u8 *val, size_t nval); | ||
32 | int device_property_read_u16_array(struct device *dev, const char *propname, | ||
33 | u16 *val, size_t nval); | ||
34 | int device_property_read_u32_array(struct device *dev, const char *propname, | ||
35 | u32 *val, size_t nval); | ||
36 | int device_property_read_u64_array(struct device *dev, const char *propname, | ||
37 | u64 *val, size_t nval); | ||
38 | int device_property_read_string_array(struct device *dev, const char *propname, | ||
39 | const char **val, size_t nval); | ||
40 | int device_property_read_string(struct device *dev, const char *propname, | ||
41 | const char **val); | ||
42 | |||
43 | enum fwnode_type { | ||
44 | FWNODE_INVALID = 0, | ||
45 | FWNODE_OF, | ||
46 | FWNODE_ACPI, | ||
47 | }; | ||
48 | |||
49 | struct fwnode_handle { | ||
50 | enum fwnode_type type; | ||
51 | }; | ||
52 | |||
53 | bool fwnode_property_present(struct fwnode_handle *fwnode, const char *propname); | ||
54 | int fwnode_property_read_u8_array(struct fwnode_handle *fwnode, | ||
55 | const char *propname, u8 *val, | ||
56 | size_t nval); | ||
57 | int fwnode_property_read_u16_array(struct fwnode_handle *fwnode, | ||
58 | const char *propname, u16 *val, | ||
59 | size_t nval); | ||
60 | int fwnode_property_read_u32_array(struct fwnode_handle *fwnode, | ||
61 | const char *propname, u32 *val, | ||
62 | size_t nval); | ||
63 | int fwnode_property_read_u64_array(struct fwnode_handle *fwnode, | ||
64 | const char *propname, u64 *val, | ||
65 | size_t nval); | ||
66 | int fwnode_property_read_string_array(struct fwnode_handle *fwnode, | ||
67 | const char *propname, const char **val, | ||
68 | size_t nval); | ||
69 | int fwnode_property_read_string(struct fwnode_handle *fwnode, | ||
70 | const char *propname, const char **val); | ||
71 | |||
72 | struct fwnode_handle *device_get_next_child_node(struct device *dev, | ||
73 | struct fwnode_handle *child); | ||
74 | |||
75 | #define device_for_each_child_node(dev, child) \ | ||
76 | for (child = device_get_next_child_node(dev, NULL); child; \ | ||
77 | child = device_get_next_child_node(dev, child)) | ||
78 | |||
79 | void fwnode_handle_put(struct fwnode_handle *fwnode); | ||
80 | |||
81 | unsigned int device_get_child_node_count(struct device *dev); | ||
82 | |||
83 | static inline bool device_property_read_bool(struct device *dev, | ||
84 | const char *propname) | ||
85 | { | ||
86 | return device_property_present(dev, propname); | ||
87 | } | ||
88 | |||
89 | static inline int device_property_read_u8(struct device *dev, | ||
90 | const char *propname, u8 *val) | ||
91 | { | ||
92 | return device_property_read_u8_array(dev, propname, val, 1); | ||
93 | } | ||
94 | |||
95 | static inline int device_property_read_u16(struct device *dev, | ||
96 | const char *propname, u16 *val) | ||
97 | { | ||
98 | return device_property_read_u16_array(dev, propname, val, 1); | ||
99 | } | ||
100 | |||
101 | static inline int device_property_read_u32(struct device *dev, | ||
102 | const char *propname, u32 *val) | ||
103 | { | ||
104 | return device_property_read_u32_array(dev, propname, val, 1); | ||
105 | } | ||
106 | |||
107 | static inline int device_property_read_u64(struct device *dev, | ||
108 | const char *propname, u64 *val) | ||
109 | { | ||
110 | return device_property_read_u64_array(dev, propname, val, 1); | ||
111 | } | ||
112 | |||
113 | static inline bool fwnode_property_read_bool(struct fwnode_handle *fwnode, | ||
114 | const char *propname) | ||
115 | { | ||
116 | return fwnode_property_present(fwnode, propname); | ||
117 | } | ||
118 | |||
119 | static inline int fwnode_property_read_u8(struct fwnode_handle *fwnode, | ||
120 | const char *propname, u8 *val) | ||
121 | { | ||
122 | return fwnode_property_read_u8_array(fwnode, propname, val, 1); | ||
123 | } | ||
124 | |||
125 | static inline int fwnode_property_read_u16(struct fwnode_handle *fwnode, | ||
126 | const char *propname, u16 *val) | ||
127 | { | ||
128 | return fwnode_property_read_u16_array(fwnode, propname, val, 1); | ||
129 | } | ||
130 | |||
131 | static inline int fwnode_property_read_u32(struct fwnode_handle *fwnode, | ||
132 | const char *propname, u32 *val) | ||
133 | { | ||
134 | return fwnode_property_read_u32_array(fwnode, propname, val, 1); | ||
135 | } | ||
136 | |||
137 | static inline int fwnode_property_read_u64(struct fwnode_handle *fwnode, | ||
138 | const char *propname, u64 *val) | ||
139 | { | ||
140 | return fwnode_property_read_u64_array(fwnode, propname, val, 1); | ||
141 | } | ||
142 | |||
143 | #endif /* _LINUX_PROPERTY_H_ */ | ||
diff --git a/include/net/inet_common.h b/include/net/inet_common.h index fe7994c48b75..b2828a06a5a6 100644 --- a/include/net/inet_common.h +++ b/include/net/inet_common.h | |||
@@ -37,6 +37,8 @@ int inet_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg); | |||
37 | int inet_ctl_sock_create(struct sock **sk, unsigned short family, | 37 | int inet_ctl_sock_create(struct sock **sk, unsigned short family, |
38 | unsigned short type, unsigned char protocol, | 38 | unsigned short type, unsigned char protocol, |
39 | struct net *net); | 39 | struct net *net); |
40 | int inet_recv_error(struct sock *sk, struct msghdr *msg, int len, | ||
41 | int *addr_len); | ||
40 | 42 | ||
41 | static inline void inet_ctl_sock_destroy(struct sock *sk) | 43 | static inline void inet_ctl_sock_destroy(struct sock *sk) |
42 | { | 44 | { |
diff --git a/include/net/netfilter/nf_tables.h b/include/net/netfilter/nf_tables.h index 845c596bf594..3ae969e3acf0 100644 --- a/include/net/netfilter/nf_tables.h +++ b/include/net/netfilter/nf_tables.h | |||
@@ -396,14 +396,12 @@ struct nft_rule { | |||
396 | /** | 396 | /** |
397 | * struct nft_trans - nf_tables object update in transaction | 397 | * struct nft_trans - nf_tables object update in transaction |
398 | * | 398 | * |
399 | * @rcu_head: rcu head to defer release of transaction data | ||
400 | * @list: used internally | 399 | * @list: used internally |
401 | * @msg_type: message type | 400 | * @msg_type: message type |
402 | * @ctx: transaction context | 401 | * @ctx: transaction context |
403 | * @data: internal information related to the transaction | 402 | * @data: internal information related to the transaction |
404 | */ | 403 | */ |
405 | struct nft_trans { | 404 | struct nft_trans { |
406 | struct rcu_head rcu_head; | ||
407 | struct list_head list; | 405 | struct list_head list; |
408 | int msg_type; | 406 | int msg_type; |
409 | struct nft_ctx ctx; | 407 | struct nft_ctx ctx; |
diff --git a/include/net/vxlan.h b/include/net/vxlan.h index d5f59f3fc35d..57cccd0052e5 100644 --- a/include/net/vxlan.h +++ b/include/net/vxlan.h | |||
@@ -8,6 +8,12 @@ | |||
8 | #define VNI_HASH_BITS 10 | 8 | #define VNI_HASH_BITS 10 |
9 | #define VNI_HASH_SIZE (1<<VNI_HASH_BITS) | 9 | #define VNI_HASH_SIZE (1<<VNI_HASH_BITS) |
10 | 10 | ||
11 | /* VXLAN protocol header */ | ||
12 | struct vxlanhdr { | ||
13 | __be32 vx_flags; | ||
14 | __be32 vx_vni; | ||
15 | }; | ||
16 | |||
11 | struct vxlan_sock; | 17 | struct vxlan_sock; |
12 | typedef void (vxlan_rcv_t)(struct vxlan_sock *vh, struct sk_buff *skb, __be32 key); | 18 | typedef void (vxlan_rcv_t)(struct vxlan_sock *vh, struct sk_buff *skb, __be32 key); |
13 | 19 | ||
@@ -45,6 +51,18 @@ int vxlan_xmit_skb(struct vxlan_sock *vs, | |||
45 | __be32 src, __be32 dst, __u8 tos, __u8 ttl, __be16 df, | 51 | __be32 src, __be32 dst, __u8 tos, __u8 ttl, __be16 df, |
46 | __be16 src_port, __be16 dst_port, __be32 vni, bool xnet); | 52 | __be16 src_port, __be16 dst_port, __be32 vni, bool xnet); |
47 | 53 | ||
54 | static inline bool vxlan_gso_check(struct sk_buff *skb) | ||
55 | { | ||
56 | if ((skb_shinfo(skb)->gso_type & SKB_GSO_UDP_TUNNEL) && | ||
57 | (skb->inner_protocol_type != ENCAP_TYPE_ETHER || | ||
58 | skb->inner_protocol != htons(ETH_P_TEB) || | ||
59 | (skb_inner_mac_header(skb) - skb_transport_header(skb) != | ||
60 | sizeof(struct udphdr) + sizeof(struct vxlanhdr)))) | ||
61 | return false; | ||
62 | |||
63 | return true; | ||
64 | } | ||
65 | |||
48 | /* IP header + UDP + VXLAN + Ethernet header */ | 66 | /* IP header + UDP + VXLAN + Ethernet header */ |
49 | #define VXLAN_HEADROOM (20 + 8 + 8 + 14) | 67 | #define VXLAN_HEADROOM (20 + 8 + 8 + 14) |
50 | /* IPv6 header + UDP + VXLAN + Ethernet header */ | 68 | /* IPv6 header + UDP + VXLAN + Ethernet header */ |
diff --git a/include/sound/pcm.h b/include/sound/pcm.h index e862497f7556..8bb00a27e219 100644 --- a/include/sound/pcm.h +++ b/include/sound/pcm.h | |||
@@ -184,6 +184,8 @@ struct snd_pcm_ops { | |||
184 | #define SNDRV_PCM_FMTBIT_DSD_U8 _SNDRV_PCM_FMTBIT(DSD_U8) | 184 | #define SNDRV_PCM_FMTBIT_DSD_U8 _SNDRV_PCM_FMTBIT(DSD_U8) |
185 | #define SNDRV_PCM_FMTBIT_DSD_U16_LE _SNDRV_PCM_FMTBIT(DSD_U16_LE) | 185 | #define SNDRV_PCM_FMTBIT_DSD_U16_LE _SNDRV_PCM_FMTBIT(DSD_U16_LE) |
186 | #define SNDRV_PCM_FMTBIT_DSD_U32_LE _SNDRV_PCM_FMTBIT(DSD_U32_LE) | 186 | #define SNDRV_PCM_FMTBIT_DSD_U32_LE _SNDRV_PCM_FMTBIT(DSD_U32_LE) |
187 | #define SNDRV_PCM_FMTBIT_DSD_U16_BE _SNDRV_PCM_FMTBIT(DSD_U16_BE) | ||
188 | #define SNDRV_PCM_FMTBIT_DSD_U32_BE _SNDRV_PCM_FMTBIT(DSD_U32_BE) | ||
187 | 189 | ||
188 | #ifdef SNDRV_LITTLE_ENDIAN | 190 | #ifdef SNDRV_LITTLE_ENDIAN |
189 | #define SNDRV_PCM_FMTBIT_S16 SNDRV_PCM_FMTBIT_S16_LE | 191 | #define SNDRV_PCM_FMTBIT_S16 SNDRV_PCM_FMTBIT_S16_LE |
diff --git a/include/sound/soc-dpcm.h b/include/sound/soc-dpcm.h index 2883a7a6f9f3..98f2ade0266e 100644 --- a/include/sound/soc-dpcm.h +++ b/include/sound/soc-dpcm.h | |||
@@ -102,6 +102,8 @@ struct snd_soc_dpcm_runtime { | |||
102 | /* state and update */ | 102 | /* state and update */ |
103 | enum snd_soc_dpcm_update runtime_update; | 103 | enum snd_soc_dpcm_update runtime_update; |
104 | enum snd_soc_dpcm_state state; | 104 | enum snd_soc_dpcm_state state; |
105 | |||
106 | int trigger_pending; /* trigger cmd + 1 if pending, 0 if not */ | ||
105 | }; | 107 | }; |
106 | 108 | ||
107 | /* can this BE stop and free */ | 109 | /* can this BE stop and free */ |
diff --git a/include/uapi/linux/Kbuild b/include/uapi/linux/Kbuild index 4c94f31a8c99..8523f9bb72f2 100644 --- a/include/uapi/linux/Kbuild +++ b/include/uapi/linux/Kbuild | |||
@@ -427,7 +427,7 @@ header-y += virtio_net.h | |||
427 | header-y += virtio_pci.h | 427 | header-y += virtio_pci.h |
428 | header-y += virtio_ring.h | 428 | header-y += virtio_ring.h |
429 | header-y += virtio_rng.h | 429 | header-y += virtio_rng.h |
430 | header=y += vm_sockets.h | 430 | header-y += vm_sockets.h |
431 | header-y += vt.h | 431 | header-y += vt.h |
432 | header-y += wait.h | 432 | header-y += wait.h |
433 | header-y += wanrouter.h | 433 | header-y += wanrouter.h |
diff --git a/include/uapi/sound/asound.h b/include/uapi/sound/asound.h index 6ee586728df9..941d32f007dc 100644 --- a/include/uapi/sound/asound.h +++ b/include/uapi/sound/asound.h | |||
@@ -220,7 +220,9 @@ typedef int __bitwise snd_pcm_format_t; | |||
220 | #define SNDRV_PCM_FORMAT_DSD_U8 ((__force snd_pcm_format_t) 48) /* DSD, 1-byte samples DSD (x8) */ | 220 | #define SNDRV_PCM_FORMAT_DSD_U8 ((__force snd_pcm_format_t) 48) /* DSD, 1-byte samples DSD (x8) */ |
221 | #define SNDRV_PCM_FORMAT_DSD_U16_LE ((__force snd_pcm_format_t) 49) /* DSD, 2-byte samples DSD (x16), little endian */ | 221 | #define SNDRV_PCM_FORMAT_DSD_U16_LE ((__force snd_pcm_format_t) 49) /* DSD, 2-byte samples DSD (x16), little endian */ |
222 | #define SNDRV_PCM_FORMAT_DSD_U32_LE ((__force snd_pcm_format_t) 50) /* DSD, 4-byte samples DSD (x32), little endian */ | 222 | #define SNDRV_PCM_FORMAT_DSD_U32_LE ((__force snd_pcm_format_t) 50) /* DSD, 4-byte samples DSD (x32), little endian */ |
223 | #define SNDRV_PCM_FORMAT_LAST SNDRV_PCM_FORMAT_DSD_U32_LE | 223 | #define SNDRV_PCM_FORMAT_DSD_U16_BE ((__force snd_pcm_format_t) 51) /* DSD, 2-byte samples DSD (x16), big endian */ |
224 | #define SNDRV_PCM_FORMAT_DSD_U32_BE ((__force snd_pcm_format_t) 52) /* DSD, 4-byte samples DSD (x32), big endian */ | ||
225 | #define SNDRV_PCM_FORMAT_LAST SNDRV_PCM_FORMAT_DSD_U32_BE | ||
224 | 226 | ||
225 | #ifdef SNDRV_LITTLE_ENDIAN | 227 | #ifdef SNDRV_LITTLE_ENDIAN |
226 | #define SNDRV_PCM_FORMAT_S16 SNDRV_PCM_FORMAT_S16_LE | 228 | #define SNDRV_PCM_FORMAT_S16 SNDRV_PCM_FORMAT_S16_LE |
@@ -507,13 +507,6 @@ static int newary(struct ipc_namespace *ns, struct ipc_params *params) | |||
507 | return retval; | 507 | return retval; |
508 | } | 508 | } |
509 | 509 | ||
510 | id = ipc_addid(&sem_ids(ns), &sma->sem_perm, ns->sc_semmni); | ||
511 | if (id < 0) { | ||
512 | ipc_rcu_putref(sma, sem_rcu_free); | ||
513 | return id; | ||
514 | } | ||
515 | ns->used_sems += nsems; | ||
516 | |||
517 | sma->sem_base = (struct sem *) &sma[1]; | 510 | sma->sem_base = (struct sem *) &sma[1]; |
518 | 511 | ||
519 | for (i = 0; i < nsems; i++) { | 512 | for (i = 0; i < nsems; i++) { |
@@ -528,6 +521,14 @@ static int newary(struct ipc_namespace *ns, struct ipc_params *params) | |||
528 | INIT_LIST_HEAD(&sma->list_id); | 521 | INIT_LIST_HEAD(&sma->list_id); |
529 | sma->sem_nsems = nsems; | 522 | sma->sem_nsems = nsems; |
530 | sma->sem_ctime = get_seconds(); | 523 | sma->sem_ctime = get_seconds(); |
524 | |||
525 | id = ipc_addid(&sem_ids(ns), &sma->sem_perm, ns->sc_semmni); | ||
526 | if (id < 0) { | ||
527 | ipc_rcu_putref(sma, sem_rcu_free); | ||
528 | return id; | ||
529 | } | ||
530 | ns->used_sems += nsems; | ||
531 | |||
531 | sem_unlock(sma, -1); | 532 | sem_unlock(sma, -1); |
532 | rcu_read_unlock(); | 533 | rcu_read_unlock(); |
533 | 534 | ||
diff --git a/kernel/events/core.c b/kernel/events/core.c index 2b02c9fda790..1cd5eef1fcdd 100644 --- a/kernel/events/core.c +++ b/kernel/events/core.c | |||
@@ -1562,8 +1562,10 @@ static void perf_remove_from_context(struct perf_event *event, bool detach_group | |||
1562 | 1562 | ||
1563 | if (!task) { | 1563 | if (!task) { |
1564 | /* | 1564 | /* |
1565 | * Per cpu events are removed via an smp call and | 1565 | * Per cpu events are removed via an smp call. The removal can |
1566 | * the removal is always successful. | 1566 | * fail if the CPU is currently offline, but in that case we |
1567 | * already called __perf_remove_from_context from | ||
1568 | * perf_event_exit_cpu. | ||
1567 | */ | 1569 | */ |
1568 | cpu_function_call(event->cpu, __perf_remove_from_context, &re); | 1570 | cpu_function_call(event->cpu, __perf_remove_from_context, &re); |
1569 | return; | 1571 | return; |
@@ -8117,7 +8119,7 @@ static void perf_pmu_rotate_stop(struct pmu *pmu) | |||
8117 | 8119 | ||
8118 | static void __perf_event_exit_context(void *__info) | 8120 | static void __perf_event_exit_context(void *__info) |
8119 | { | 8121 | { |
8120 | struct remove_event re = { .detach_group = false }; | 8122 | struct remove_event re = { .detach_group = true }; |
8121 | struct perf_event_context *ctx = __info; | 8123 | struct perf_event_context *ctx = __info; |
8122 | 8124 | ||
8123 | perf_pmu_rotate_stop(ctx->pmu); | 8125 | perf_pmu_rotate_stop(ctx->pmu); |
diff --git a/kernel/events/uprobes.c b/kernel/events/uprobes.c index 1d0af8a2c646..ed8f2cde34c5 100644 --- a/kernel/events/uprobes.c +++ b/kernel/events/uprobes.c | |||
@@ -1640,7 +1640,6 @@ bool uprobe_deny_signal(void) | |||
1640 | if (__fatal_signal_pending(t) || arch_uprobe_xol_was_trapped(t)) { | 1640 | if (__fatal_signal_pending(t) || arch_uprobe_xol_was_trapped(t)) { |
1641 | utask->state = UTASK_SSTEP_TRAPPED; | 1641 | utask->state = UTASK_SSTEP_TRAPPED; |
1642 | set_tsk_thread_flag(t, TIF_UPROBE); | 1642 | set_tsk_thread_flag(t, TIF_UPROBE); |
1643 | set_tsk_thread_flag(t, TIF_NOTIFY_RESUME); | ||
1644 | } | 1643 | } |
1645 | } | 1644 | } |
1646 | 1645 | ||
diff --git a/kernel/power/Kconfig b/kernel/power/Kconfig index bbef57f5bdfd..1eb7da7bc8e8 100644 --- a/kernel/power/Kconfig +++ b/kernel/power/Kconfig | |||
@@ -308,4 +308,3 @@ config PM_GENERIC_DOMAINS_OF | |||
308 | 308 | ||
309 | config CPU_PM | 309 | config CPU_PM |
310 | bool | 310 | bool |
311 | depends on SUSPEND || CPU_IDLE | ||
diff --git a/kernel/power/hibernate.c b/kernel/power/hibernate.c index 1f35a3478f3c..2329daae5255 100644 --- a/kernel/power/hibernate.c +++ b/kernel/power/hibernate.c | |||
@@ -28,6 +28,7 @@ | |||
28 | #include <linux/syscore_ops.h> | 28 | #include <linux/syscore_ops.h> |
29 | #include <linux/ctype.h> | 29 | #include <linux/ctype.h> |
30 | #include <linux/genhd.h> | 30 | #include <linux/genhd.h> |
31 | #include <linux/ktime.h> | ||
31 | #include <trace/events/power.h> | 32 | #include <trace/events/power.h> |
32 | 33 | ||
33 | #include "power.h" | 34 | #include "power.h" |
@@ -232,20 +233,17 @@ static void platform_recover(int platform_mode) | |||
232 | * @nr_pages: Number of memory pages processed between @start and @stop. | 233 | * @nr_pages: Number of memory pages processed between @start and @stop. |
233 | * @msg: Additional diagnostic message to print. | 234 | * @msg: Additional diagnostic message to print. |
234 | */ | 235 | */ |
235 | void swsusp_show_speed(struct timeval *start, struct timeval *stop, | 236 | void swsusp_show_speed(ktime_t start, ktime_t stop, |
236 | unsigned nr_pages, char *msg) | 237 | unsigned nr_pages, char *msg) |
237 | { | 238 | { |
239 | ktime_t diff; | ||
238 | u64 elapsed_centisecs64; | 240 | u64 elapsed_centisecs64; |
239 | unsigned int centisecs; | 241 | unsigned int centisecs; |
240 | unsigned int k; | 242 | unsigned int k; |
241 | unsigned int kps; | 243 | unsigned int kps; |
242 | 244 | ||
243 | elapsed_centisecs64 = timeval_to_ns(stop) - timeval_to_ns(start); | 245 | diff = ktime_sub(stop, start); |
244 | /* | 246 | elapsed_centisecs64 = ktime_divns(diff, 10*NSEC_PER_MSEC); |
245 | * If "(s64)elapsed_centisecs64 < 0", it will print long elapsed time, | ||
246 | * it is obvious enough for what went wrong. | ||
247 | */ | ||
248 | do_div(elapsed_centisecs64, NSEC_PER_SEC / 100); | ||
249 | centisecs = elapsed_centisecs64; | 247 | centisecs = elapsed_centisecs64; |
250 | if (centisecs == 0) | 248 | if (centisecs == 0) |
251 | centisecs = 1; /* avoid div-by-zero */ | 249 | centisecs = 1; /* avoid div-by-zero */ |
diff --git a/kernel/power/power.h b/kernel/power/power.h index 2df883a9d3cb..ce9b8328a689 100644 --- a/kernel/power/power.h +++ b/kernel/power/power.h | |||
@@ -174,8 +174,7 @@ extern int hib_wait_on_bio_chain(struct bio **bio_chain); | |||
174 | 174 | ||
175 | struct timeval; | 175 | struct timeval; |
176 | /* kernel/power/swsusp.c */ | 176 | /* kernel/power/swsusp.c */ |
177 | extern void swsusp_show_speed(struct timeval *, struct timeval *, | 177 | extern void swsusp_show_speed(ktime_t, ktime_t, unsigned int, char *); |
178 | unsigned int, char *); | ||
179 | 178 | ||
180 | #ifdef CONFIG_SUSPEND | 179 | #ifdef CONFIG_SUSPEND |
181 | /* kernel/power/suspend.c */ | 180 | /* kernel/power/suspend.c */ |
diff --git a/kernel/power/snapshot.c b/kernel/power/snapshot.c index 791a61892bb5..0c40c16174b4 100644 --- a/kernel/power/snapshot.c +++ b/kernel/power/snapshot.c | |||
@@ -28,6 +28,7 @@ | |||
28 | #include <linux/list.h> | 28 | #include <linux/list.h> |
29 | #include <linux/slab.h> | 29 | #include <linux/slab.h> |
30 | #include <linux/compiler.h> | 30 | #include <linux/compiler.h> |
31 | #include <linux/ktime.h> | ||
31 | 32 | ||
32 | #include <asm/uaccess.h> | 33 | #include <asm/uaccess.h> |
33 | #include <asm/mmu_context.h> | 34 | #include <asm/mmu_context.h> |
@@ -1576,11 +1577,11 @@ int hibernate_preallocate_memory(void) | |||
1576 | struct zone *zone; | 1577 | struct zone *zone; |
1577 | unsigned long saveable, size, max_size, count, highmem, pages = 0; | 1578 | unsigned long saveable, size, max_size, count, highmem, pages = 0; |
1578 | unsigned long alloc, save_highmem, pages_highmem, avail_normal; | 1579 | unsigned long alloc, save_highmem, pages_highmem, avail_normal; |
1579 | struct timeval start, stop; | 1580 | ktime_t start, stop; |
1580 | int error; | 1581 | int error; |
1581 | 1582 | ||
1582 | printk(KERN_INFO "PM: Preallocating image memory... "); | 1583 | printk(KERN_INFO "PM: Preallocating image memory... "); |
1583 | do_gettimeofday(&start); | 1584 | start = ktime_get(); |
1584 | 1585 | ||
1585 | error = memory_bm_create(&orig_bm, GFP_IMAGE, PG_ANY); | 1586 | error = memory_bm_create(&orig_bm, GFP_IMAGE, PG_ANY); |
1586 | if (error) | 1587 | if (error) |
@@ -1709,9 +1710,9 @@ int hibernate_preallocate_memory(void) | |||
1709 | free_unnecessary_pages(); | 1710 | free_unnecessary_pages(); |
1710 | 1711 | ||
1711 | out: | 1712 | out: |
1712 | do_gettimeofday(&stop); | 1713 | stop = ktime_get(); |
1713 | printk(KERN_CONT "done (allocated %lu pages)\n", pages); | 1714 | printk(KERN_CONT "done (allocated %lu pages)\n", pages); |
1714 | swsusp_show_speed(&start, &stop, pages, "Allocated"); | 1715 | swsusp_show_speed(start, stop, pages, "Allocated"); |
1715 | 1716 | ||
1716 | return 0; | 1717 | return 0; |
1717 | 1718 | ||
diff --git a/kernel/power/swap.c b/kernel/power/swap.c index aaa3261dea5d..570aff817543 100644 --- a/kernel/power/swap.c +++ b/kernel/power/swap.c | |||
@@ -30,6 +30,7 @@ | |||
30 | #include <linux/atomic.h> | 30 | #include <linux/atomic.h> |
31 | #include <linux/kthread.h> | 31 | #include <linux/kthread.h> |
32 | #include <linux/crc32.h> | 32 | #include <linux/crc32.h> |
33 | #include <linux/ktime.h> | ||
33 | 34 | ||
34 | #include "power.h" | 35 | #include "power.h" |
35 | 36 | ||
@@ -445,8 +446,8 @@ static int save_image(struct swap_map_handle *handle, | |||
445 | int nr_pages; | 446 | int nr_pages; |
446 | int err2; | 447 | int err2; |
447 | struct bio *bio; | 448 | struct bio *bio; |
448 | struct timeval start; | 449 | ktime_t start; |
449 | struct timeval stop; | 450 | ktime_t stop; |
450 | 451 | ||
451 | printk(KERN_INFO "PM: Saving image data pages (%u pages)...\n", | 452 | printk(KERN_INFO "PM: Saving image data pages (%u pages)...\n", |
452 | nr_to_write); | 453 | nr_to_write); |
@@ -455,7 +456,7 @@ static int save_image(struct swap_map_handle *handle, | |||
455 | m = 1; | 456 | m = 1; |
456 | nr_pages = 0; | 457 | nr_pages = 0; |
457 | bio = NULL; | 458 | bio = NULL; |
458 | do_gettimeofday(&start); | 459 | start = ktime_get(); |
459 | while (1) { | 460 | while (1) { |
460 | ret = snapshot_read_next(snapshot); | 461 | ret = snapshot_read_next(snapshot); |
461 | if (ret <= 0) | 462 | if (ret <= 0) |
@@ -469,12 +470,12 @@ static int save_image(struct swap_map_handle *handle, | |||
469 | nr_pages++; | 470 | nr_pages++; |
470 | } | 471 | } |
471 | err2 = hib_wait_on_bio_chain(&bio); | 472 | err2 = hib_wait_on_bio_chain(&bio); |
472 | do_gettimeofday(&stop); | 473 | stop = ktime_get(); |
473 | if (!ret) | 474 | if (!ret) |
474 | ret = err2; | 475 | ret = err2; |
475 | if (!ret) | 476 | if (!ret) |
476 | printk(KERN_INFO "PM: Image saving done.\n"); | 477 | printk(KERN_INFO "PM: Image saving done.\n"); |
477 | swsusp_show_speed(&start, &stop, nr_to_write, "Wrote"); | 478 | swsusp_show_speed(start, stop, nr_to_write, "Wrote"); |
478 | return ret; | 479 | return ret; |
479 | } | 480 | } |
480 | 481 | ||
@@ -580,8 +581,8 @@ static int save_image_lzo(struct swap_map_handle *handle, | |||
580 | int nr_pages; | 581 | int nr_pages; |
581 | int err2; | 582 | int err2; |
582 | struct bio *bio; | 583 | struct bio *bio; |
583 | struct timeval start; | 584 | ktime_t start; |
584 | struct timeval stop; | 585 | ktime_t stop; |
585 | size_t off; | 586 | size_t off; |
586 | unsigned thr, run_threads, nr_threads; | 587 | unsigned thr, run_threads, nr_threads; |
587 | unsigned char *page = NULL; | 588 | unsigned char *page = NULL; |
@@ -674,7 +675,7 @@ static int save_image_lzo(struct swap_map_handle *handle, | |||
674 | m = 1; | 675 | m = 1; |
675 | nr_pages = 0; | 676 | nr_pages = 0; |
676 | bio = NULL; | 677 | bio = NULL; |
677 | do_gettimeofday(&start); | 678 | start = ktime_get(); |
678 | for (;;) { | 679 | for (;;) { |
679 | for (thr = 0; thr < nr_threads; thr++) { | 680 | for (thr = 0; thr < nr_threads; thr++) { |
680 | for (off = 0; off < LZO_UNC_SIZE; off += PAGE_SIZE) { | 681 | for (off = 0; off < LZO_UNC_SIZE; off += PAGE_SIZE) { |
@@ -759,12 +760,12 @@ static int save_image_lzo(struct swap_map_handle *handle, | |||
759 | 760 | ||
760 | out_finish: | 761 | out_finish: |
761 | err2 = hib_wait_on_bio_chain(&bio); | 762 | err2 = hib_wait_on_bio_chain(&bio); |
762 | do_gettimeofday(&stop); | 763 | stop = ktime_get(); |
763 | if (!ret) | 764 | if (!ret) |
764 | ret = err2; | 765 | ret = err2; |
765 | if (!ret) | 766 | if (!ret) |
766 | printk(KERN_INFO "PM: Image saving done.\n"); | 767 | printk(KERN_INFO "PM: Image saving done.\n"); |
767 | swsusp_show_speed(&start, &stop, nr_to_write, "Wrote"); | 768 | swsusp_show_speed(start, stop, nr_to_write, "Wrote"); |
768 | out_clean: | 769 | out_clean: |
769 | if (crc) { | 770 | if (crc) { |
770 | if (crc->thr) | 771 | if (crc->thr) |
@@ -965,8 +966,8 @@ static int load_image(struct swap_map_handle *handle, | |||
965 | { | 966 | { |
966 | unsigned int m; | 967 | unsigned int m; |
967 | int ret = 0; | 968 | int ret = 0; |
968 | struct timeval start; | 969 | ktime_t start; |
969 | struct timeval stop; | 970 | ktime_t stop; |
970 | struct bio *bio; | 971 | struct bio *bio; |
971 | int err2; | 972 | int err2; |
972 | unsigned nr_pages; | 973 | unsigned nr_pages; |
@@ -978,7 +979,7 @@ static int load_image(struct swap_map_handle *handle, | |||
978 | m = 1; | 979 | m = 1; |
979 | nr_pages = 0; | 980 | nr_pages = 0; |
980 | bio = NULL; | 981 | bio = NULL; |
981 | do_gettimeofday(&start); | 982 | start = ktime_get(); |
982 | for ( ; ; ) { | 983 | for ( ; ; ) { |
983 | ret = snapshot_write_next(snapshot); | 984 | ret = snapshot_write_next(snapshot); |
984 | if (ret <= 0) | 985 | if (ret <= 0) |
@@ -996,7 +997,7 @@ static int load_image(struct swap_map_handle *handle, | |||
996 | nr_pages++; | 997 | nr_pages++; |
997 | } | 998 | } |
998 | err2 = hib_wait_on_bio_chain(&bio); | 999 | err2 = hib_wait_on_bio_chain(&bio); |
999 | do_gettimeofday(&stop); | 1000 | stop = ktime_get(); |
1000 | if (!ret) | 1001 | if (!ret) |
1001 | ret = err2; | 1002 | ret = err2; |
1002 | if (!ret) { | 1003 | if (!ret) { |
@@ -1005,7 +1006,7 @@ static int load_image(struct swap_map_handle *handle, | |||
1005 | if (!snapshot_image_loaded(snapshot)) | 1006 | if (!snapshot_image_loaded(snapshot)) |
1006 | ret = -ENODATA; | 1007 | ret = -ENODATA; |
1007 | } | 1008 | } |
1008 | swsusp_show_speed(&start, &stop, nr_to_read, "Read"); | 1009 | swsusp_show_speed(start, stop, nr_to_read, "Read"); |
1009 | return ret; | 1010 | return ret; |
1010 | } | 1011 | } |
1011 | 1012 | ||
@@ -1067,8 +1068,8 @@ static int load_image_lzo(struct swap_map_handle *handle, | |||
1067 | int ret = 0; | 1068 | int ret = 0; |
1068 | int eof = 0; | 1069 | int eof = 0; |
1069 | struct bio *bio; | 1070 | struct bio *bio; |
1070 | struct timeval start; | 1071 | ktime_t start; |
1071 | struct timeval stop; | 1072 | ktime_t stop; |
1072 | unsigned nr_pages; | 1073 | unsigned nr_pages; |
1073 | size_t off; | 1074 | size_t off; |
1074 | unsigned i, thr, run_threads, nr_threads; | 1075 | unsigned i, thr, run_threads, nr_threads; |
@@ -1190,7 +1191,7 @@ static int load_image_lzo(struct swap_map_handle *handle, | |||
1190 | m = 1; | 1191 | m = 1; |
1191 | nr_pages = 0; | 1192 | nr_pages = 0; |
1192 | bio = NULL; | 1193 | bio = NULL; |
1193 | do_gettimeofday(&start); | 1194 | start = ktime_get(); |
1194 | 1195 | ||
1195 | ret = snapshot_write_next(snapshot); | 1196 | ret = snapshot_write_next(snapshot); |
1196 | if (ret <= 0) | 1197 | if (ret <= 0) |
@@ -1343,7 +1344,7 @@ out_finish: | |||
1343 | wait_event(crc->done, atomic_read(&crc->stop)); | 1344 | wait_event(crc->done, atomic_read(&crc->stop)); |
1344 | atomic_set(&crc->stop, 0); | 1345 | atomic_set(&crc->stop, 0); |
1345 | } | 1346 | } |
1346 | do_gettimeofday(&stop); | 1347 | stop = ktime_get(); |
1347 | if (!ret) { | 1348 | if (!ret) { |
1348 | printk(KERN_INFO "PM: Image loading done.\n"); | 1349 | printk(KERN_INFO "PM: Image loading done.\n"); |
1349 | snapshot_write_finalize(snapshot); | 1350 | snapshot_write_finalize(snapshot); |
@@ -1359,7 +1360,7 @@ out_finish: | |||
1359 | } | 1360 | } |
1360 | } | 1361 | } |
1361 | } | 1362 | } |
1362 | swsusp_show_speed(&start, &stop, nr_to_read, "Read"); | 1363 | swsusp_show_speed(start, stop, nr_to_read, "Read"); |
1363 | out_clean: | 1364 | out_clean: |
1364 | for (i = 0; i < ring_size; i++) | 1365 | for (i = 0; i < ring_size; i++) |
1365 | free_page((unsigned long)page[i]); | 1366 | free_page((unsigned long)page[i]); |
@@ -1374,7 +1375,7 @@ out_clean: | |||
1374 | kthread_stop(data[thr].thr); | 1375 | kthread_stop(data[thr].thr); |
1375 | vfree(data); | 1376 | vfree(data); |
1376 | } | 1377 | } |
1377 | if (page) vfree(page); | 1378 | vfree(page); |
1378 | 1379 | ||
1379 | return ret; | 1380 | return ret; |
1380 | } | 1381 | } |
diff --git a/kernel/sched/core.c b/kernel/sched/core.c index 240157c13ddc..89e7283015a6 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c | |||
@@ -2475,44 +2475,6 @@ EXPORT_PER_CPU_SYMBOL(kstat); | |||
2475 | EXPORT_PER_CPU_SYMBOL(kernel_cpustat); | 2475 | EXPORT_PER_CPU_SYMBOL(kernel_cpustat); |
2476 | 2476 | ||
2477 | /* | 2477 | /* |
2478 | * Return any ns on the sched_clock that have not yet been accounted in | ||
2479 | * @p in case that task is currently running. | ||
2480 | * | ||
2481 | * Called with task_rq_lock() held on @rq. | ||
2482 | */ | ||
2483 | static u64 do_task_delta_exec(struct task_struct *p, struct rq *rq) | ||
2484 | { | ||
2485 | u64 ns = 0; | ||
2486 | |||
2487 | /* | ||
2488 | * Must be ->curr _and_ ->on_rq. If dequeued, we would | ||
2489 | * project cycles that may never be accounted to this | ||
2490 | * thread, breaking clock_gettime(). | ||
2491 | */ | ||
2492 | if (task_current(rq, p) && task_on_rq_queued(p)) { | ||
2493 | update_rq_clock(rq); | ||
2494 | ns = rq_clock_task(rq) - p->se.exec_start; | ||
2495 | if ((s64)ns < 0) | ||
2496 | ns = 0; | ||
2497 | } | ||
2498 | |||
2499 | return ns; | ||
2500 | } | ||
2501 | |||
2502 | unsigned long long task_delta_exec(struct task_struct *p) | ||
2503 | { | ||
2504 | unsigned long flags; | ||
2505 | struct rq *rq; | ||
2506 | u64 ns = 0; | ||
2507 | |||
2508 | rq = task_rq_lock(p, &flags); | ||
2509 | ns = do_task_delta_exec(p, rq); | ||
2510 | task_rq_unlock(rq, p, &flags); | ||
2511 | |||
2512 | return ns; | ||
2513 | } | ||
2514 | |||
2515 | /* | ||
2516 | * Return accounted runtime for the task. | 2478 | * Return accounted runtime for the task. |
2517 | * In case the task is currently running, return the runtime plus current's | 2479 | * In case the task is currently running, return the runtime plus current's |
2518 | * pending runtime that have not been accounted yet. | 2480 | * pending runtime that have not been accounted yet. |
@@ -2521,7 +2483,7 @@ unsigned long long task_sched_runtime(struct task_struct *p) | |||
2521 | { | 2483 | { |
2522 | unsigned long flags; | 2484 | unsigned long flags; |
2523 | struct rq *rq; | 2485 | struct rq *rq; |
2524 | u64 ns = 0; | 2486 | u64 ns; |
2525 | 2487 | ||
2526 | #if defined(CONFIG_64BIT) && defined(CONFIG_SMP) | 2488 | #if defined(CONFIG_64BIT) && defined(CONFIG_SMP) |
2527 | /* | 2489 | /* |
@@ -2540,7 +2502,16 @@ unsigned long long task_sched_runtime(struct task_struct *p) | |||
2540 | #endif | 2502 | #endif |
2541 | 2503 | ||
2542 | rq = task_rq_lock(p, &flags); | 2504 | rq = task_rq_lock(p, &flags); |
2543 | ns = p->se.sum_exec_runtime + do_task_delta_exec(p, rq); | 2505 | /* |
2506 | * Must be ->curr _and_ ->on_rq. If dequeued, we would | ||
2507 | * project cycles that may never be accounted to this | ||
2508 | * thread, breaking clock_gettime(). | ||
2509 | */ | ||
2510 | if (task_current(rq, p) && task_on_rq_queued(p)) { | ||
2511 | update_rq_clock(rq); | ||
2512 | p->sched_class->update_curr(rq); | ||
2513 | } | ||
2514 | ns = p->se.sum_exec_runtime; | ||
2544 | task_rq_unlock(rq, p, &flags); | 2515 | task_rq_unlock(rq, p, &flags); |
2545 | 2516 | ||
2546 | return ns; | 2517 | return ns; |
@@ -2903,10 +2874,14 @@ asmlinkage __visible void __sched schedule_user(void) | |||
2903 | * or we have been woken up remotely but the IPI has not yet arrived, | 2874 | * or we have been woken up remotely but the IPI has not yet arrived, |
2904 | * we haven't yet exited the RCU idle mode. Do it here manually until | 2875 | * we haven't yet exited the RCU idle mode. Do it here manually until |
2905 | * we find a better solution. | 2876 | * we find a better solution. |
2877 | * | ||
2878 | * NB: There are buggy callers of this function. Ideally we | ||
2879 | * should warn if prev_state != IN_USER, but that will trigger | ||
2880 | * too frequently to make sense yet. | ||
2906 | */ | 2881 | */ |
2907 | user_exit(); | 2882 | enum ctx_state prev_state = exception_enter(); |
2908 | schedule(); | 2883 | schedule(); |
2909 | user_enter(); | 2884 | exception_exit(prev_state); |
2910 | } | 2885 | } |
2911 | #endif | 2886 | #endif |
2912 | 2887 | ||
@@ -6368,6 +6343,10 @@ static void sched_init_numa(void) | |||
6368 | if (!sched_debug()) | 6343 | if (!sched_debug()) |
6369 | break; | 6344 | break; |
6370 | } | 6345 | } |
6346 | |||
6347 | if (!level) | ||
6348 | return; | ||
6349 | |||
6371 | /* | 6350 | /* |
6372 | * 'level' contains the number of unique distances, excluding the | 6351 | * 'level' contains the number of unique distances, excluding the |
6373 | * identity distance node_distance(i,i). | 6352 | * identity distance node_distance(i,i). |
@@ -7444,8 +7423,12 @@ void sched_move_task(struct task_struct *tsk) | |||
7444 | if (unlikely(running)) | 7423 | if (unlikely(running)) |
7445 | put_prev_task(rq, tsk); | 7424 | put_prev_task(rq, tsk); |
7446 | 7425 | ||
7447 | tg = container_of(task_css_check(tsk, cpu_cgrp_id, | 7426 | /* |
7448 | lockdep_is_held(&tsk->sighand->siglock)), | 7427 | * All callers are synchronized by task_rq_lock(); we do not use RCU |
7428 | * which is pointless here. Thus, we pass "true" to task_css_check() | ||
7429 | * to prevent lockdep warnings. | ||
7430 | */ | ||
7431 | tg = container_of(task_css_check(tsk, cpu_cgrp_id, true), | ||
7449 | struct task_group, css); | 7432 | struct task_group, css); |
7450 | tg = autogroup_task_group(tsk, tg); | 7433 | tg = autogroup_task_group(tsk, tg); |
7451 | tsk->sched_task_group = tg; | 7434 | tsk->sched_task_group = tg; |
diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c index 5285332392d5..28fa9d9e9201 100644 --- a/kernel/sched/deadline.c +++ b/kernel/sched/deadline.c | |||
@@ -1701,4 +1701,6 @@ const struct sched_class dl_sched_class = { | |||
1701 | .prio_changed = prio_changed_dl, | 1701 | .prio_changed = prio_changed_dl, |
1702 | .switched_from = switched_from_dl, | 1702 | .switched_from = switched_from_dl, |
1703 | .switched_to = switched_to_dl, | 1703 | .switched_to = switched_to_dl, |
1704 | |||
1705 | .update_curr = update_curr_dl, | ||
1704 | }; | 1706 | }; |
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 34baa60f8a7b..ef2b104b254c 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c | |||
@@ -726,6 +726,11 @@ static void update_curr(struct cfs_rq *cfs_rq) | |||
726 | account_cfs_rq_runtime(cfs_rq, delta_exec); | 726 | account_cfs_rq_runtime(cfs_rq, delta_exec); |
727 | } | 727 | } |
728 | 728 | ||
729 | static void update_curr_fair(struct rq *rq) | ||
730 | { | ||
731 | update_curr(cfs_rq_of(&rq->curr->se)); | ||
732 | } | ||
733 | |||
729 | static inline void | 734 | static inline void |
730 | update_stats_wait_start(struct cfs_rq *cfs_rq, struct sched_entity *se) | 735 | update_stats_wait_start(struct cfs_rq *cfs_rq, struct sched_entity *se) |
731 | { | 736 | { |
@@ -1180,6 +1185,13 @@ static void task_numa_compare(struct task_numa_env *env, | |||
1180 | raw_spin_unlock_irq(&dst_rq->lock); | 1185 | raw_spin_unlock_irq(&dst_rq->lock); |
1181 | 1186 | ||
1182 | /* | 1187 | /* |
1188 | * Because we have preemption enabled we can get migrated around and | ||
1189 | * end try selecting ourselves (current == env->p) as a swap candidate. | ||
1190 | */ | ||
1191 | if (cur == env->p) | ||
1192 | goto unlock; | ||
1193 | |||
1194 | /* | ||
1183 | * "imp" is the fault differential for the source task between the | 1195 | * "imp" is the fault differential for the source task between the |
1184 | * source and destination node. Calculate the total differential for | 1196 | * source and destination node. Calculate the total differential for |
1185 | * the source task and potential destination task. The more negative | 1197 | * the source task and potential destination task. The more negative |
@@ -7949,6 +7961,8 @@ const struct sched_class fair_sched_class = { | |||
7949 | 7961 | ||
7950 | .get_rr_interval = get_rr_interval_fair, | 7962 | .get_rr_interval = get_rr_interval_fair, |
7951 | 7963 | ||
7964 | .update_curr = update_curr_fair, | ||
7965 | |||
7952 | #ifdef CONFIG_FAIR_GROUP_SCHED | 7966 | #ifdef CONFIG_FAIR_GROUP_SCHED |
7953 | .task_move_group = task_move_group_fair, | 7967 | .task_move_group = task_move_group_fair, |
7954 | #endif | 7968 | #endif |
diff --git a/kernel/sched/idle_task.c b/kernel/sched/idle_task.c index 67ad4e7f506a..c65dac8c97cd 100644 --- a/kernel/sched/idle_task.c +++ b/kernel/sched/idle_task.c | |||
@@ -75,6 +75,10 @@ static unsigned int get_rr_interval_idle(struct rq *rq, struct task_struct *task | |||
75 | return 0; | 75 | return 0; |
76 | } | 76 | } |
77 | 77 | ||
78 | static void update_curr_idle(struct rq *rq) | ||
79 | { | ||
80 | } | ||
81 | |||
78 | /* | 82 | /* |
79 | * Simple, special scheduling class for the per-CPU idle tasks: | 83 | * Simple, special scheduling class for the per-CPU idle tasks: |
80 | */ | 84 | */ |
@@ -101,4 +105,5 @@ const struct sched_class idle_sched_class = { | |||
101 | 105 | ||
102 | .prio_changed = prio_changed_idle, | 106 | .prio_changed = prio_changed_idle, |
103 | .switched_to = switched_to_idle, | 107 | .switched_to = switched_to_idle, |
108 | .update_curr = update_curr_idle, | ||
104 | }; | 109 | }; |
diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c index d024e6ce30ba..20bca398084a 100644 --- a/kernel/sched/rt.c +++ b/kernel/sched/rt.c | |||
@@ -2128,6 +2128,8 @@ const struct sched_class rt_sched_class = { | |||
2128 | 2128 | ||
2129 | .prio_changed = prio_changed_rt, | 2129 | .prio_changed = prio_changed_rt, |
2130 | .switched_to = switched_to_rt, | 2130 | .switched_to = switched_to_rt, |
2131 | |||
2132 | .update_curr = update_curr_rt, | ||
2131 | }; | 2133 | }; |
2132 | 2134 | ||
2133 | #ifdef CONFIG_SCHED_DEBUG | 2135 | #ifdef CONFIG_SCHED_DEBUG |
diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h index 24156c8434d1..2df8ef067cc5 100644 --- a/kernel/sched/sched.h +++ b/kernel/sched/sched.h | |||
@@ -1135,6 +1135,8 @@ struct sched_class { | |||
1135 | unsigned int (*get_rr_interval) (struct rq *rq, | 1135 | unsigned int (*get_rr_interval) (struct rq *rq, |
1136 | struct task_struct *task); | 1136 | struct task_struct *task); |
1137 | 1137 | ||
1138 | void (*update_curr) (struct rq *rq); | ||
1139 | |||
1138 | #ifdef CONFIG_FAIR_GROUP_SCHED | 1140 | #ifdef CONFIG_FAIR_GROUP_SCHED |
1139 | void (*task_move_group) (struct task_struct *p, int on_rq); | 1141 | void (*task_move_group) (struct task_struct *p, int on_rq); |
1140 | #endif | 1142 | #endif |
diff --git a/kernel/sched/stop_task.c b/kernel/sched/stop_task.c index 67426e529f59..79ffec45a6ac 100644 --- a/kernel/sched/stop_task.c +++ b/kernel/sched/stop_task.c | |||
@@ -102,6 +102,10 @@ get_rr_interval_stop(struct rq *rq, struct task_struct *task) | |||
102 | return 0; | 102 | return 0; |
103 | } | 103 | } |
104 | 104 | ||
105 | static void update_curr_stop(struct rq *rq) | ||
106 | { | ||
107 | } | ||
108 | |||
105 | /* | 109 | /* |
106 | * Simple, special scheduling class for the per-CPU stop tasks: | 110 | * Simple, special scheduling class for the per-CPU stop tasks: |
107 | */ | 111 | */ |
@@ -128,4 +132,5 @@ const struct sched_class stop_sched_class = { | |||
128 | 132 | ||
129 | .prio_changed = prio_changed_stop, | 133 | .prio_changed = prio_changed_stop, |
130 | .switched_to = switched_to_stop, | 134 | .switched_to = switched_to_stop, |
135 | .update_curr = update_curr_stop, | ||
131 | }; | 136 | }; |
diff --git a/kernel/time/posix-cpu-timers.c b/kernel/time/posix-cpu-timers.c index 492b986195d5..a16b67859e2a 100644 --- a/kernel/time/posix-cpu-timers.c +++ b/kernel/time/posix-cpu-timers.c | |||
@@ -553,7 +553,7 @@ static int cpu_timer_sample_group(const clockid_t which_clock, | |||
553 | *sample = cputime_to_expires(cputime.utime); | 553 | *sample = cputime_to_expires(cputime.utime); |
554 | break; | 554 | break; |
555 | case CPUCLOCK_SCHED: | 555 | case CPUCLOCK_SCHED: |
556 | *sample = cputime.sum_exec_runtime + task_delta_exec(p); | 556 | *sample = cputime.sum_exec_runtime; |
557 | break; | 557 | break; |
558 | } | 558 | } |
559 | return 0; | 559 | return 0; |
diff --git a/lib/Makefile b/lib/Makefile index 7512dc978f18..0211d2bd5e17 100644 --- a/lib/Makefile +++ b/lib/Makefile | |||
@@ -10,7 +10,7 @@ endif | |||
10 | lib-y := ctype.o string.o vsprintf.o cmdline.o \ | 10 | lib-y := ctype.o string.o vsprintf.o cmdline.o \ |
11 | rbtree.o radix-tree.o dump_stack.o timerqueue.o\ | 11 | rbtree.o radix-tree.o dump_stack.o timerqueue.o\ |
12 | idr.o int_sqrt.o extable.o \ | 12 | idr.o int_sqrt.o extable.o \ |
13 | sha1.o md5.o irq_regs.o reciprocal_div.o argv_split.o \ | 13 | sha1.o md5.o irq_regs.o argv_split.o \ |
14 | proportions.o flex_proportions.o ratelimit.o show_mem.o \ | 14 | proportions.o flex_proportions.o ratelimit.o show_mem.o \ |
15 | is_single_threaded.o plist.o decompress.o kobject_uevent.o \ | 15 | is_single_threaded.o plist.o decompress.o kobject_uevent.o \ |
16 | earlycpio.o | 16 | earlycpio.o |
@@ -26,7 +26,7 @@ obj-y += bcd.o div64.o sort.o parser.o halfmd4.o debug_locks.o random32.o \ | |||
26 | bust_spinlocks.o hexdump.o kasprintf.o bitmap.o scatterlist.o \ | 26 | bust_spinlocks.o hexdump.o kasprintf.o bitmap.o scatterlist.o \ |
27 | gcd.o lcm.o list_sort.o uuid.o flex_array.o iovec.o clz_ctz.o \ | 27 | gcd.o lcm.o list_sort.o uuid.o flex_array.o iovec.o clz_ctz.o \ |
28 | bsearch.o find_last_bit.o find_next_bit.o llist.o memweight.o kfifo.o \ | 28 | bsearch.o find_last_bit.o find_next_bit.o llist.o memweight.o kfifo.o \ |
29 | percpu-refcount.o percpu_ida.o hash.o rhashtable.o | 29 | percpu-refcount.o percpu_ida.o hash.o rhashtable.o reciprocal_div.o |
30 | obj-y += string_helpers.o | 30 | obj-y += string_helpers.o |
31 | obj-$(CONFIG_TEST_STRING_HELPERS) += test-string_helpers.o | 31 | obj-$(CONFIG_TEST_STRING_HELPERS) += test-string_helpers.o |
32 | obj-y += kstrtox.o | 32 | obj-y += kstrtox.o |
diff --git a/lib/genalloc.c b/lib/genalloc.c index cce4dd68c40d..2e65d206b01c 100644 --- a/lib/genalloc.c +++ b/lib/genalloc.c | |||
@@ -598,6 +598,7 @@ struct gen_pool *devm_gen_pool_create(struct device *dev, int min_alloc_order, | |||
598 | 598 | ||
599 | return pool; | 599 | return pool; |
600 | } | 600 | } |
601 | EXPORT_SYMBOL(devm_gen_pool_create); | ||
601 | 602 | ||
602 | /** | 603 | /** |
603 | * dev_get_gen_pool - Obtain the gen_pool (if any) for a device | 604 | * dev_get_gen_pool - Obtain the gen_pool (if any) for a device |
diff --git a/lib/show_mem.c b/lib/show_mem.c index 09225796991a..5e256271b47b 100644 --- a/lib/show_mem.c +++ b/lib/show_mem.c | |||
@@ -28,7 +28,7 @@ void show_mem(unsigned int filter) | |||
28 | continue; | 28 | continue; |
29 | 29 | ||
30 | total += zone->present_pages; | 30 | total += zone->present_pages; |
31 | reserved = zone->present_pages - zone->managed_pages; | 31 | reserved += zone->present_pages - zone->managed_pages; |
32 | 32 | ||
33 | if (is_highmem_idx(zoneid)) | 33 | if (is_highmem_idx(zoneid)) |
34 | highmem += zone->present_pages; | 34 | highmem += zone->present_pages; |
diff --git a/mm/frontswap.c b/mm/frontswap.c index c30eec536f03..f2a3571c6e22 100644 --- a/mm/frontswap.c +++ b/mm/frontswap.c | |||
@@ -244,8 +244,10 @@ int __frontswap_store(struct page *page) | |||
244 | the (older) page from frontswap | 244 | the (older) page from frontswap |
245 | */ | 245 | */ |
246 | inc_frontswap_failed_stores(); | 246 | inc_frontswap_failed_stores(); |
247 | if (dup) | 247 | if (dup) { |
248 | __frontswap_clear(sis, offset); | 248 | __frontswap_clear(sis, offset); |
249 | frontswap_ops->invalidate_page(type, offset); | ||
250 | } | ||
249 | } | 251 | } |
250 | if (frontswap_writethrough_enabled) | 252 | if (frontswap_writethrough_enabled) |
251 | /* report failure so swap also writes to swap device */ | 253 | /* report failure so swap also writes to swap device */ |
diff --git a/mm/memory.c b/mm/memory.c index 3e503831e042..d5f2ae9c4a23 100644 --- a/mm/memory.c +++ b/mm/memory.c | |||
@@ -815,20 +815,20 @@ copy_one_pte(struct mm_struct *dst_mm, struct mm_struct *src_mm, | |||
815 | if (!pte_file(pte)) { | 815 | if (!pte_file(pte)) { |
816 | swp_entry_t entry = pte_to_swp_entry(pte); | 816 | swp_entry_t entry = pte_to_swp_entry(pte); |
817 | 817 | ||
818 | if (swap_duplicate(entry) < 0) | 818 | if (likely(!non_swap_entry(entry))) { |
819 | return entry.val; | 819 | if (swap_duplicate(entry) < 0) |
820 | 820 | return entry.val; | |
821 | /* make sure dst_mm is on swapoff's mmlist. */ | 821 | |
822 | if (unlikely(list_empty(&dst_mm->mmlist))) { | 822 | /* make sure dst_mm is on swapoff's mmlist. */ |
823 | spin_lock(&mmlist_lock); | 823 | if (unlikely(list_empty(&dst_mm->mmlist))) { |
824 | if (list_empty(&dst_mm->mmlist)) | 824 | spin_lock(&mmlist_lock); |
825 | list_add(&dst_mm->mmlist, | 825 | if (list_empty(&dst_mm->mmlist)) |
826 | &src_mm->mmlist); | 826 | list_add(&dst_mm->mmlist, |
827 | spin_unlock(&mmlist_lock); | 827 | &src_mm->mmlist); |
828 | } | 828 | spin_unlock(&mmlist_lock); |
829 | if (likely(!non_swap_entry(entry))) | 829 | } |
830 | rss[MM_SWAPENTS]++; | 830 | rss[MM_SWAPENTS]++; |
831 | else if (is_migration_entry(entry)) { | 831 | } else if (is_migration_entry(entry)) { |
832 | page = migration_entry_to_page(entry); | 832 | page = migration_entry_to_page(entry); |
833 | 833 | ||
834 | if (PageAnon(page)) | 834 | if (PageAnon(page)) |
@@ -776,8 +776,11 @@ again: remove_next = 1 + (end > next->vm_end); | |||
776 | * shrinking vma had, to cover any anon pages imported. | 776 | * shrinking vma had, to cover any anon pages imported. |
777 | */ | 777 | */ |
778 | if (exporter && exporter->anon_vma && !importer->anon_vma) { | 778 | if (exporter && exporter->anon_vma && !importer->anon_vma) { |
779 | if (anon_vma_clone(importer, exporter)) | 779 | int error; |
780 | return -ENOMEM; | 780 | |
781 | error = anon_vma_clone(importer, exporter); | ||
782 | if (error) | ||
783 | return error; | ||
781 | importer->anon_vma = exporter->anon_vma; | 784 | importer->anon_vma = exporter->anon_vma; |
782 | } | 785 | } |
783 | } | 786 | } |
@@ -2469,7 +2472,8 @@ static int __split_vma(struct mm_struct *mm, struct vm_area_struct *vma, | |||
2469 | if (err) | 2472 | if (err) |
2470 | goto out_free_vma; | 2473 | goto out_free_vma; |
2471 | 2474 | ||
2472 | if (anon_vma_clone(new, vma)) | 2475 | err = anon_vma_clone(new, vma); |
2476 | if (err) | ||
2473 | goto out_free_mpol; | 2477 | goto out_free_mpol; |
2474 | 2478 | ||
2475 | if (new->vm_file) | 2479 | if (new->vm_file) |
@@ -274,6 +274,7 @@ int anon_vma_fork(struct vm_area_struct *vma, struct vm_area_struct *pvma) | |||
274 | { | 274 | { |
275 | struct anon_vma_chain *avc; | 275 | struct anon_vma_chain *avc; |
276 | struct anon_vma *anon_vma; | 276 | struct anon_vma *anon_vma; |
277 | int error; | ||
277 | 278 | ||
278 | /* Don't bother if the parent process has no anon_vma here. */ | 279 | /* Don't bother if the parent process has no anon_vma here. */ |
279 | if (!pvma->anon_vma) | 280 | if (!pvma->anon_vma) |
@@ -283,8 +284,9 @@ int anon_vma_fork(struct vm_area_struct *vma, struct vm_area_struct *pvma) | |||
283 | * First, attach the new VMA to the parent VMA's anon_vmas, | 284 | * First, attach the new VMA to the parent VMA's anon_vmas, |
284 | * so rmap can find non-COWed pages in child processes. | 285 | * so rmap can find non-COWed pages in child processes. |
285 | */ | 286 | */ |
286 | if (anon_vma_clone(vma, pvma)) | 287 | error = anon_vma_clone(vma, pvma); |
287 | return -ENOMEM; | 288 | if (error) |
289 | return error; | ||
288 | 290 | ||
289 | /* Then add our own anon_vma. */ | 291 | /* Then add our own anon_vma. */ |
290 | anon_vma = anon_vma_alloc(); | 292 | anon_vma = anon_vma_alloc(); |
@@ -3076,7 +3076,7 @@ static void *____cache_alloc_node(struct kmem_cache *cachep, gfp_t flags, | |||
3076 | void *obj; | 3076 | void *obj; |
3077 | int x; | 3077 | int x; |
3078 | 3078 | ||
3079 | VM_BUG_ON(nodeid > num_online_nodes()); | 3079 | VM_BUG_ON(nodeid < 0 || nodeid >= MAX_NUMNODES); |
3080 | n = get_node(cachep, nodeid); | 3080 | n = get_node(cachep, nodeid); |
3081 | BUG_ON(!n); | 3081 | BUG_ON(!n); |
3082 | 3082 | ||
diff --git a/mm/vmpressure.c b/mm/vmpressure.c index d4042e75f7c7..c5afd573d7da 100644 --- a/mm/vmpressure.c +++ b/mm/vmpressure.c | |||
@@ -165,6 +165,7 @@ static void vmpressure_work_fn(struct work_struct *work) | |||
165 | unsigned long scanned; | 165 | unsigned long scanned; |
166 | unsigned long reclaimed; | 166 | unsigned long reclaimed; |
167 | 167 | ||
168 | spin_lock(&vmpr->sr_lock); | ||
168 | /* | 169 | /* |
169 | * Several contexts might be calling vmpressure(), so it is | 170 | * Several contexts might be calling vmpressure(), so it is |
170 | * possible that the work was rescheduled again before the old | 171 | * possible that the work was rescheduled again before the old |
@@ -173,11 +174,12 @@ static void vmpressure_work_fn(struct work_struct *work) | |||
173 | * here. No need for any locks here since we don't care if | 174 | * here. No need for any locks here since we don't care if |
174 | * vmpr->reclaimed is in sync. | 175 | * vmpr->reclaimed is in sync. |
175 | */ | 176 | */ |
176 | if (!vmpr->scanned) | 177 | scanned = vmpr->scanned; |
178 | if (!scanned) { | ||
179 | spin_unlock(&vmpr->sr_lock); | ||
177 | return; | 180 | return; |
181 | } | ||
178 | 182 | ||
179 | spin_lock(&vmpr->sr_lock); | ||
180 | scanned = vmpr->scanned; | ||
181 | reclaimed = vmpr->reclaimed; | 183 | reclaimed = vmpr->reclaimed; |
182 | vmpr->scanned = 0; | 184 | vmpr->scanned = 0; |
183 | vmpr->reclaimed = 0; | 185 | vmpr->reclaimed = 0; |
diff --git a/net/bridge/br_multicast.c b/net/bridge/br_multicast.c index 648d79ccf462..c465876c7861 100644 --- a/net/bridge/br_multicast.c +++ b/net/bridge/br_multicast.c | |||
@@ -813,10 +813,9 @@ static void __br_multicast_send_query(struct net_bridge *br, | |||
813 | return; | 813 | return; |
814 | 814 | ||
815 | if (port) { | 815 | if (port) { |
816 | __skb_push(skb, sizeof(struct ethhdr)); | ||
817 | skb->dev = port->dev; | 816 | skb->dev = port->dev; |
818 | NF_HOOK(NFPROTO_BRIDGE, NF_BR_LOCAL_OUT, skb, NULL, skb->dev, | 817 | NF_HOOK(NFPROTO_BRIDGE, NF_BR_LOCAL_OUT, skb, NULL, skb->dev, |
819 | dev_queue_xmit); | 818 | br_dev_queue_push_xmit); |
820 | } else { | 819 | } else { |
821 | br_multicast_select_own_querier(br, ip, skb); | 820 | br_multicast_select_own_querier(br, ip, skb); |
822 | netif_rx(skb); | 821 | netif_rx(skb); |
diff --git a/net/bridge/br_netlink.c b/net/bridge/br_netlink.c index 2ff9706647f2..e5ec470b851f 100644 --- a/net/bridge/br_netlink.c +++ b/net/bridge/br_netlink.c | |||
@@ -280,6 +280,7 @@ static const struct nla_policy br_port_policy[IFLA_BRPORT_MAX + 1] = { | |||
280 | [IFLA_BRPORT_MODE] = { .type = NLA_U8 }, | 280 | [IFLA_BRPORT_MODE] = { .type = NLA_U8 }, |
281 | [IFLA_BRPORT_GUARD] = { .type = NLA_U8 }, | 281 | [IFLA_BRPORT_GUARD] = { .type = NLA_U8 }, |
282 | [IFLA_BRPORT_PROTECT] = { .type = NLA_U8 }, | 282 | [IFLA_BRPORT_PROTECT] = { .type = NLA_U8 }, |
283 | [IFLA_BRPORT_FAST_LEAVE]= { .type = NLA_U8 }, | ||
283 | [IFLA_BRPORT_LEARNING] = { .type = NLA_U8 }, | 284 | [IFLA_BRPORT_LEARNING] = { .type = NLA_U8 }, |
284 | [IFLA_BRPORT_UNICAST_FLOOD] = { .type = NLA_U8 }, | 285 | [IFLA_BRPORT_UNICAST_FLOOD] = { .type = NLA_U8 }, |
285 | }; | 286 | }; |
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c index a6882686ca3a..76321ea442c3 100644 --- a/net/core/rtnetlink.c +++ b/net/core/rtnetlink.c | |||
@@ -1498,6 +1498,7 @@ static int do_setlink(const struct sk_buff *skb, | |||
1498 | goto errout; | 1498 | goto errout; |
1499 | } | 1499 | } |
1500 | if (!netlink_ns_capable(skb, net->user_ns, CAP_NET_ADMIN)) { | 1500 | if (!netlink_ns_capable(skb, net->user_ns, CAP_NET_ADMIN)) { |
1501 | put_net(net); | ||
1501 | err = -EPERM; | 1502 | err = -EPERM; |
1502 | goto errout; | 1503 | goto errout; |
1503 | } | 1504 | } |
@@ -2685,13 +2686,20 @@ static int rtnl_bridge_getlink(struct sk_buff *skb, struct netlink_callback *cb) | |||
2685 | int idx = 0; | 2686 | int idx = 0; |
2686 | u32 portid = NETLINK_CB(cb->skb).portid; | 2687 | u32 portid = NETLINK_CB(cb->skb).portid; |
2687 | u32 seq = cb->nlh->nlmsg_seq; | 2688 | u32 seq = cb->nlh->nlmsg_seq; |
2688 | struct nlattr *extfilt; | ||
2689 | u32 filter_mask = 0; | 2689 | u32 filter_mask = 0; |
2690 | 2690 | ||
2691 | extfilt = nlmsg_find_attr(cb->nlh, sizeof(struct ifinfomsg), | 2691 | if (nlmsg_len(cb->nlh) > sizeof(struct ifinfomsg)) { |
2692 | IFLA_EXT_MASK); | 2692 | struct nlattr *extfilt; |
2693 | if (extfilt) | 2693 | |
2694 | filter_mask = nla_get_u32(extfilt); | 2694 | extfilt = nlmsg_find_attr(cb->nlh, sizeof(struct ifinfomsg), |
2695 | IFLA_EXT_MASK); | ||
2696 | if (extfilt) { | ||
2697 | if (nla_len(extfilt) < sizeof(filter_mask)) | ||
2698 | return -EINVAL; | ||
2699 | |||
2700 | filter_mask = nla_get_u32(extfilt); | ||
2701 | } | ||
2702 | } | ||
2695 | 2703 | ||
2696 | rcu_read_lock(); | 2704 | rcu_read_lock(); |
2697 | for_each_netdev_rcu(net, dev) { | 2705 | for_each_netdev_rcu(net, dev) { |
@@ -2798,6 +2806,9 @@ static int rtnl_bridge_setlink(struct sk_buff *skb, struct nlmsghdr *nlh) | |||
2798 | if (br_spec) { | 2806 | if (br_spec) { |
2799 | nla_for_each_nested(attr, br_spec, rem) { | 2807 | nla_for_each_nested(attr, br_spec, rem) { |
2800 | if (nla_type(attr) == IFLA_BRIDGE_FLAGS) { | 2808 | if (nla_type(attr) == IFLA_BRIDGE_FLAGS) { |
2809 | if (nla_len(attr) < sizeof(flags)) | ||
2810 | return -EINVAL; | ||
2811 | |||
2801 | have_flags = true; | 2812 | have_flags = true; |
2802 | flags = nla_get_u16(attr); | 2813 | flags = nla_get_u16(attr); |
2803 | break; | 2814 | break; |
@@ -2868,6 +2879,9 @@ static int rtnl_bridge_dellink(struct sk_buff *skb, struct nlmsghdr *nlh) | |||
2868 | if (br_spec) { | 2879 | if (br_spec) { |
2869 | nla_for_each_nested(attr, br_spec, rem) { | 2880 | nla_for_each_nested(attr, br_spec, rem) { |
2870 | if (nla_type(attr) == IFLA_BRIDGE_FLAGS) { | 2881 | if (nla_type(attr) == IFLA_BRIDGE_FLAGS) { |
2882 | if (nla_len(attr) < sizeof(flags)) | ||
2883 | return -EINVAL; | ||
2884 | |||
2871 | have_flags = true; | 2885 | have_flags = true; |
2872 | flags = nla_get_u16(attr); | 2886 | flags = nla_get_u16(attr); |
2873 | break; | 2887 | break; |
diff --git a/net/core/skbuff.c b/net/core/skbuff.c index c16615bfb61e..32e31c299631 100644 --- a/net/core/skbuff.c +++ b/net/core/skbuff.c | |||
@@ -552,20 +552,13 @@ static void kfree_skbmem(struct sk_buff *skb) | |||
552 | case SKB_FCLONE_CLONE: | 552 | case SKB_FCLONE_CLONE: |
553 | fclones = container_of(skb, struct sk_buff_fclones, skb2); | 553 | fclones = container_of(skb, struct sk_buff_fclones, skb2); |
554 | 554 | ||
555 | /* Warning : We must perform the atomic_dec_and_test() before | 555 | /* The clone portion is available for |
556 | * setting skb->fclone back to SKB_FCLONE_FREE, otherwise | 556 | * fast-cloning again. |
557 | * skb_clone() could set clone_ref to 2 before our decrement. | ||
558 | * Anyway, if we are going to free the structure, no need to | ||
559 | * rewrite skb->fclone. | ||
560 | */ | 557 | */ |
561 | if (atomic_dec_and_test(&fclones->fclone_ref)) { | 558 | skb->fclone = SKB_FCLONE_FREE; |
559 | |||
560 | if (atomic_dec_and_test(&fclones->fclone_ref)) | ||
562 | kmem_cache_free(skbuff_fclone_cache, fclones); | 561 | kmem_cache_free(skbuff_fclone_cache, fclones); |
563 | } else { | ||
564 | /* The clone portion is available for | ||
565 | * fast-cloning again. | ||
566 | */ | ||
567 | skb->fclone = SKB_FCLONE_FREE; | ||
568 | } | ||
569 | break; | 562 | break; |
570 | } | 563 | } |
571 | } | 564 | } |
@@ -887,11 +880,7 @@ struct sk_buff *skb_clone(struct sk_buff *skb, gfp_t gfp_mask) | |||
887 | if (skb->fclone == SKB_FCLONE_ORIG && | 880 | if (skb->fclone == SKB_FCLONE_ORIG && |
888 | n->fclone == SKB_FCLONE_FREE) { | 881 | n->fclone == SKB_FCLONE_FREE) { |
889 | n->fclone = SKB_FCLONE_CLONE; | 882 | n->fclone = SKB_FCLONE_CLONE; |
890 | /* As our fastclone was free, clone_ref must be 1 at this point. | 883 | atomic_inc(&fclones->fclone_ref); |
891 | * We could use atomic_inc() here, but it is faster | ||
892 | * to set the final value. | ||
893 | */ | ||
894 | atomic_set(&fclones->fclone_ref, 2); | ||
895 | } else { | 884 | } else { |
896 | if (skb_pfmemalloc(skb)) | 885 | if (skb_pfmemalloc(skb)) |
897 | gfp_mask |= __GFP_MEMALLOC; | 886 | gfp_mask |= __GFP_MEMALLOC; |
diff --git a/net/dcb/dcbnl.c b/net/dcb/dcbnl.c index ca11d283bbeb..93ea80196f0e 100644 --- a/net/dcb/dcbnl.c +++ b/net/dcb/dcbnl.c | |||
@@ -1080,13 +1080,13 @@ static int dcbnl_ieee_fill(struct sk_buff *skb, struct net_device *netdev) | |||
1080 | if (!app) | 1080 | if (!app) |
1081 | return -EMSGSIZE; | 1081 | return -EMSGSIZE; |
1082 | 1082 | ||
1083 | spin_lock(&dcb_lock); | 1083 | spin_lock_bh(&dcb_lock); |
1084 | list_for_each_entry(itr, &dcb_app_list, list) { | 1084 | list_for_each_entry(itr, &dcb_app_list, list) { |
1085 | if (itr->ifindex == netdev->ifindex) { | 1085 | if (itr->ifindex == netdev->ifindex) { |
1086 | err = nla_put(skb, DCB_ATTR_IEEE_APP, sizeof(itr->app), | 1086 | err = nla_put(skb, DCB_ATTR_IEEE_APP, sizeof(itr->app), |
1087 | &itr->app); | 1087 | &itr->app); |
1088 | if (err) { | 1088 | if (err) { |
1089 | spin_unlock(&dcb_lock); | 1089 | spin_unlock_bh(&dcb_lock); |
1090 | return -EMSGSIZE; | 1090 | return -EMSGSIZE; |
1091 | } | 1091 | } |
1092 | } | 1092 | } |
@@ -1097,7 +1097,7 @@ static int dcbnl_ieee_fill(struct sk_buff *skb, struct net_device *netdev) | |||
1097 | else | 1097 | else |
1098 | dcbx = -EOPNOTSUPP; | 1098 | dcbx = -EOPNOTSUPP; |
1099 | 1099 | ||
1100 | spin_unlock(&dcb_lock); | 1100 | spin_unlock_bh(&dcb_lock); |
1101 | nla_nest_end(skb, app); | 1101 | nla_nest_end(skb, app); |
1102 | 1102 | ||
1103 | /* get peer info if available */ | 1103 | /* get peer info if available */ |
@@ -1234,7 +1234,7 @@ static int dcbnl_cee_fill(struct sk_buff *skb, struct net_device *netdev) | |||
1234 | } | 1234 | } |
1235 | 1235 | ||
1236 | /* local app */ | 1236 | /* local app */ |
1237 | spin_lock(&dcb_lock); | 1237 | spin_lock_bh(&dcb_lock); |
1238 | app = nla_nest_start(skb, DCB_ATTR_CEE_APP_TABLE); | 1238 | app = nla_nest_start(skb, DCB_ATTR_CEE_APP_TABLE); |
1239 | if (!app) | 1239 | if (!app) |
1240 | goto dcb_unlock; | 1240 | goto dcb_unlock; |
@@ -1271,7 +1271,7 @@ static int dcbnl_cee_fill(struct sk_buff *skb, struct net_device *netdev) | |||
1271 | else | 1271 | else |
1272 | dcbx = -EOPNOTSUPP; | 1272 | dcbx = -EOPNOTSUPP; |
1273 | 1273 | ||
1274 | spin_unlock(&dcb_lock); | 1274 | spin_unlock_bh(&dcb_lock); |
1275 | 1275 | ||
1276 | /* features flags */ | 1276 | /* features flags */ |
1277 | if (ops->getfeatcfg) { | 1277 | if (ops->getfeatcfg) { |
@@ -1326,7 +1326,7 @@ static int dcbnl_cee_fill(struct sk_buff *skb, struct net_device *netdev) | |||
1326 | return 0; | 1326 | return 0; |
1327 | 1327 | ||
1328 | dcb_unlock: | 1328 | dcb_unlock: |
1329 | spin_unlock(&dcb_lock); | 1329 | spin_unlock_bh(&dcb_lock); |
1330 | nla_put_failure: | 1330 | nla_put_failure: |
1331 | return err; | 1331 | return err; |
1332 | } | 1332 | } |
@@ -1762,10 +1762,10 @@ u8 dcb_getapp(struct net_device *dev, struct dcb_app *app) | |||
1762 | struct dcb_app_type *itr; | 1762 | struct dcb_app_type *itr; |
1763 | u8 prio = 0; | 1763 | u8 prio = 0; |
1764 | 1764 | ||
1765 | spin_lock(&dcb_lock); | 1765 | spin_lock_bh(&dcb_lock); |
1766 | if ((itr = dcb_app_lookup(app, dev->ifindex, 0))) | 1766 | if ((itr = dcb_app_lookup(app, dev->ifindex, 0))) |
1767 | prio = itr->app.priority; | 1767 | prio = itr->app.priority; |
1768 | spin_unlock(&dcb_lock); | 1768 | spin_unlock_bh(&dcb_lock); |
1769 | 1769 | ||
1770 | return prio; | 1770 | return prio; |
1771 | } | 1771 | } |
@@ -1789,7 +1789,7 @@ int dcb_setapp(struct net_device *dev, struct dcb_app *new) | |||
1789 | if (dev->dcbnl_ops->getdcbx) | 1789 | if (dev->dcbnl_ops->getdcbx) |
1790 | event.dcbx = dev->dcbnl_ops->getdcbx(dev); | 1790 | event.dcbx = dev->dcbnl_ops->getdcbx(dev); |
1791 | 1791 | ||
1792 | spin_lock(&dcb_lock); | 1792 | spin_lock_bh(&dcb_lock); |
1793 | /* Search for existing match and replace */ | 1793 | /* Search for existing match and replace */ |
1794 | if ((itr = dcb_app_lookup(new, dev->ifindex, 0))) { | 1794 | if ((itr = dcb_app_lookup(new, dev->ifindex, 0))) { |
1795 | if (new->priority) | 1795 | if (new->priority) |
@@ -1804,7 +1804,7 @@ int dcb_setapp(struct net_device *dev, struct dcb_app *new) | |||
1804 | if (new->priority) | 1804 | if (new->priority) |
1805 | err = dcb_app_add(new, dev->ifindex); | 1805 | err = dcb_app_add(new, dev->ifindex); |
1806 | out: | 1806 | out: |
1807 | spin_unlock(&dcb_lock); | 1807 | spin_unlock_bh(&dcb_lock); |
1808 | if (!err) | 1808 | if (!err) |
1809 | call_dcbevent_notifiers(DCB_APP_EVENT, &event); | 1809 | call_dcbevent_notifiers(DCB_APP_EVENT, &event); |
1810 | return err; | 1810 | return err; |
@@ -1823,10 +1823,10 @@ u8 dcb_ieee_getapp_mask(struct net_device *dev, struct dcb_app *app) | |||
1823 | struct dcb_app_type *itr; | 1823 | struct dcb_app_type *itr; |
1824 | u8 prio = 0; | 1824 | u8 prio = 0; |
1825 | 1825 | ||
1826 | spin_lock(&dcb_lock); | 1826 | spin_lock_bh(&dcb_lock); |
1827 | if ((itr = dcb_app_lookup(app, dev->ifindex, 0))) | 1827 | if ((itr = dcb_app_lookup(app, dev->ifindex, 0))) |
1828 | prio |= 1 << itr->app.priority; | 1828 | prio |= 1 << itr->app.priority; |
1829 | spin_unlock(&dcb_lock); | 1829 | spin_unlock_bh(&dcb_lock); |
1830 | 1830 | ||
1831 | return prio; | 1831 | return prio; |
1832 | } | 1832 | } |
@@ -1850,7 +1850,7 @@ int dcb_ieee_setapp(struct net_device *dev, struct dcb_app *new) | |||
1850 | if (dev->dcbnl_ops->getdcbx) | 1850 | if (dev->dcbnl_ops->getdcbx) |
1851 | event.dcbx = dev->dcbnl_ops->getdcbx(dev); | 1851 | event.dcbx = dev->dcbnl_ops->getdcbx(dev); |
1852 | 1852 | ||
1853 | spin_lock(&dcb_lock); | 1853 | spin_lock_bh(&dcb_lock); |
1854 | /* Search for existing match and abort if found */ | 1854 | /* Search for existing match and abort if found */ |
1855 | if (dcb_app_lookup(new, dev->ifindex, new->priority)) { | 1855 | if (dcb_app_lookup(new, dev->ifindex, new->priority)) { |
1856 | err = -EEXIST; | 1856 | err = -EEXIST; |
@@ -1859,7 +1859,7 @@ int dcb_ieee_setapp(struct net_device *dev, struct dcb_app *new) | |||
1859 | 1859 | ||
1860 | err = dcb_app_add(new, dev->ifindex); | 1860 | err = dcb_app_add(new, dev->ifindex); |
1861 | out: | 1861 | out: |
1862 | spin_unlock(&dcb_lock); | 1862 | spin_unlock_bh(&dcb_lock); |
1863 | if (!err) | 1863 | if (!err) |
1864 | call_dcbevent_notifiers(DCB_APP_EVENT, &event); | 1864 | call_dcbevent_notifiers(DCB_APP_EVENT, &event); |
1865 | return err; | 1865 | return err; |
@@ -1882,7 +1882,7 @@ int dcb_ieee_delapp(struct net_device *dev, struct dcb_app *del) | |||
1882 | if (dev->dcbnl_ops->getdcbx) | 1882 | if (dev->dcbnl_ops->getdcbx) |
1883 | event.dcbx = dev->dcbnl_ops->getdcbx(dev); | 1883 | event.dcbx = dev->dcbnl_ops->getdcbx(dev); |
1884 | 1884 | ||
1885 | spin_lock(&dcb_lock); | 1885 | spin_lock_bh(&dcb_lock); |
1886 | /* Search for existing match and remove it. */ | 1886 | /* Search for existing match and remove it. */ |
1887 | if ((itr = dcb_app_lookup(del, dev->ifindex, del->priority))) { | 1887 | if ((itr = dcb_app_lookup(del, dev->ifindex, del->priority))) { |
1888 | list_del(&itr->list); | 1888 | list_del(&itr->list); |
@@ -1890,7 +1890,7 @@ int dcb_ieee_delapp(struct net_device *dev, struct dcb_app *del) | |||
1890 | err = 0; | 1890 | err = 0; |
1891 | } | 1891 | } |
1892 | 1892 | ||
1893 | spin_unlock(&dcb_lock); | 1893 | spin_unlock_bh(&dcb_lock); |
1894 | if (!err) | 1894 | if (!err) |
1895 | call_dcbevent_notifiers(DCB_APP_EVENT, &event); | 1895 | call_dcbevent_notifiers(DCB_APP_EVENT, &event); |
1896 | return err; | 1896 | return err; |
@@ -1902,12 +1902,12 @@ static void dcb_flushapp(void) | |||
1902 | struct dcb_app_type *app; | 1902 | struct dcb_app_type *app; |
1903 | struct dcb_app_type *tmp; | 1903 | struct dcb_app_type *tmp; |
1904 | 1904 | ||
1905 | spin_lock(&dcb_lock); | 1905 | spin_lock_bh(&dcb_lock); |
1906 | list_for_each_entry_safe(app, tmp, &dcb_app_list, list) { | 1906 | list_for_each_entry_safe(app, tmp, &dcb_app_list, list) { |
1907 | list_del(&app->list); | 1907 | list_del(&app->list); |
1908 | kfree(app); | 1908 | kfree(app); |
1909 | } | 1909 | } |
1910 | spin_unlock(&dcb_lock); | 1910 | spin_unlock_bh(&dcb_lock); |
1911 | } | 1911 | } |
1912 | 1912 | ||
1913 | static int __init dcbnl_init(void) | 1913 | static int __init dcbnl_init(void) |
diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c index 8b7fe5b03906..e67da4e6c324 100644 --- a/net/ipv4/af_inet.c +++ b/net/ipv4/af_inet.c | |||
@@ -1386,6 +1386,17 @@ out: | |||
1386 | return pp; | 1386 | return pp; |
1387 | } | 1387 | } |
1388 | 1388 | ||
1389 | int inet_recv_error(struct sock *sk, struct msghdr *msg, int len, int *addr_len) | ||
1390 | { | ||
1391 | if (sk->sk_family == AF_INET) | ||
1392 | return ip_recv_error(sk, msg, len, addr_len); | ||
1393 | #if IS_ENABLED(CONFIG_IPV6) | ||
1394 | if (sk->sk_family == AF_INET6) | ||
1395 | return pingv6_ops.ipv6_recv_error(sk, msg, len, addr_len); | ||
1396 | #endif | ||
1397 | return -EINVAL; | ||
1398 | } | ||
1399 | |||
1389 | static int inet_gro_complete(struct sk_buff *skb, int nhoff) | 1400 | static int inet_gro_complete(struct sk_buff *skb, int nhoff) |
1390 | { | 1401 | { |
1391 | __be16 newlen = htons(skb->len - nhoff); | 1402 | __be16 newlen = htons(skb->len - nhoff); |
diff --git a/net/ipv4/fib_rules.c b/net/ipv4/fib_rules.c index f2e15738534d..8f7bd56955b0 100644 --- a/net/ipv4/fib_rules.c +++ b/net/ipv4/fib_rules.c | |||
@@ -62,6 +62,10 @@ int __fib_lookup(struct net *net, struct flowi4 *flp, struct fib_result *res) | |||
62 | else | 62 | else |
63 | res->tclassid = 0; | 63 | res->tclassid = 0; |
64 | #endif | 64 | #endif |
65 | |||
66 | if (err == -ESRCH) | ||
67 | err = -ENETUNREACH; | ||
68 | |||
65 | return err; | 69 | return err; |
66 | } | 70 | } |
67 | EXPORT_SYMBOL_GPL(__fib_lookup); | 71 | EXPORT_SYMBOL_GPL(__fib_lookup); |
diff --git a/net/ipv4/igmp.c b/net/ipv4/igmp.c index fb70e3ecc3e4..bb15d0e03d4f 100644 --- a/net/ipv4/igmp.c +++ b/net/ipv4/igmp.c | |||
@@ -318,9 +318,7 @@ igmp_scount(struct ip_mc_list *pmc, int type, int gdeleted, int sdeleted) | |||
318 | return scount; | 318 | return scount; |
319 | } | 319 | } |
320 | 320 | ||
321 | #define igmp_skb_size(skb) (*(unsigned int *)((skb)->cb)) | 321 | static struct sk_buff *igmpv3_newpack(struct net_device *dev, unsigned int mtu) |
322 | |||
323 | static struct sk_buff *igmpv3_newpack(struct net_device *dev, int size) | ||
324 | { | 322 | { |
325 | struct sk_buff *skb; | 323 | struct sk_buff *skb; |
326 | struct rtable *rt; | 324 | struct rtable *rt; |
@@ -330,6 +328,7 @@ static struct sk_buff *igmpv3_newpack(struct net_device *dev, int size) | |||
330 | struct flowi4 fl4; | 328 | struct flowi4 fl4; |
331 | int hlen = LL_RESERVED_SPACE(dev); | 329 | int hlen = LL_RESERVED_SPACE(dev); |
332 | int tlen = dev->needed_tailroom; | 330 | int tlen = dev->needed_tailroom; |
331 | unsigned int size = mtu; | ||
333 | 332 | ||
334 | while (1) { | 333 | while (1) { |
335 | skb = alloc_skb(size + hlen + tlen, | 334 | skb = alloc_skb(size + hlen + tlen, |
@@ -341,7 +340,6 @@ static struct sk_buff *igmpv3_newpack(struct net_device *dev, int size) | |||
341 | return NULL; | 340 | return NULL; |
342 | } | 341 | } |
343 | skb->priority = TC_PRIO_CONTROL; | 342 | skb->priority = TC_PRIO_CONTROL; |
344 | igmp_skb_size(skb) = size; | ||
345 | 343 | ||
346 | rt = ip_route_output_ports(net, &fl4, NULL, IGMPV3_ALL_MCR, 0, | 344 | rt = ip_route_output_ports(net, &fl4, NULL, IGMPV3_ALL_MCR, 0, |
347 | 0, 0, | 345 | 0, 0, |
@@ -354,6 +352,8 @@ static struct sk_buff *igmpv3_newpack(struct net_device *dev, int size) | |||
354 | skb_dst_set(skb, &rt->dst); | 352 | skb_dst_set(skb, &rt->dst); |
355 | skb->dev = dev; | 353 | skb->dev = dev; |
356 | 354 | ||
355 | skb->reserved_tailroom = skb_end_offset(skb) - | ||
356 | min(mtu, skb_end_offset(skb)); | ||
357 | skb_reserve(skb, hlen); | 357 | skb_reserve(skb, hlen); |
358 | 358 | ||
359 | skb_reset_network_header(skb); | 359 | skb_reset_network_header(skb); |
@@ -423,8 +423,7 @@ static struct sk_buff *add_grhead(struct sk_buff *skb, struct ip_mc_list *pmc, | |||
423 | return skb; | 423 | return skb; |
424 | } | 424 | } |
425 | 425 | ||
426 | #define AVAILABLE(skb) ((skb) ? ((skb)->dev ? igmp_skb_size(skb) - (skb)->len : \ | 426 | #define AVAILABLE(skb) ((skb) ? skb_availroom(skb) : 0) |
427 | skb_tailroom(skb)) : 0) | ||
428 | 427 | ||
429 | static struct sk_buff *add_grec(struct sk_buff *skb, struct ip_mc_list *pmc, | 428 | static struct sk_buff *add_grec(struct sk_buff *skb, struct ip_mc_list *pmc, |
430 | int type, int gdeleted, int sdeleted) | 429 | int type, int gdeleted, int sdeleted) |
diff --git a/net/ipv4/ip_vti.c b/net/ipv4/ip_vti.c index 3e861011e4a3..1a7e979e80ba 100644 --- a/net/ipv4/ip_vti.c +++ b/net/ipv4/ip_vti.c | |||
@@ -528,6 +528,7 @@ static struct rtnl_link_ops vti_link_ops __read_mostly = { | |||
528 | .validate = vti_tunnel_validate, | 528 | .validate = vti_tunnel_validate, |
529 | .newlink = vti_newlink, | 529 | .newlink = vti_newlink, |
530 | .changelink = vti_changelink, | 530 | .changelink = vti_changelink, |
531 | .dellink = ip_tunnel_dellink, | ||
531 | .get_size = vti_get_size, | 532 | .get_size = vti_get_size, |
532 | .fill_info = vti_fill_info, | 533 | .fill_info = vti_fill_info, |
533 | }; | 534 | }; |
diff --git a/net/ipv4/netfilter/nft_masq_ipv4.c b/net/ipv4/netfilter/nft_masq_ipv4.c index c1023c445920..665de06561cd 100644 --- a/net/ipv4/netfilter/nft_masq_ipv4.c +++ b/net/ipv4/netfilter/nft_masq_ipv4.c | |||
@@ -24,6 +24,7 @@ static void nft_masq_ipv4_eval(const struct nft_expr *expr, | |||
24 | struct nf_nat_range range; | 24 | struct nf_nat_range range; |
25 | unsigned int verdict; | 25 | unsigned int verdict; |
26 | 26 | ||
27 | memset(&range, 0, sizeof(range)); | ||
27 | range.flags = priv->flags; | 28 | range.flags = priv->flags; |
28 | 29 | ||
29 | verdict = nf_nat_masquerade_ipv4(pkt->skb, pkt->ops->hooknum, | 30 | verdict = nf_nat_masquerade_ipv4(pkt->skb, pkt->ops->hooknum, |
diff --git a/net/ipv4/ping.c b/net/ipv4/ping.c index 57f7c9804139..5d740cccf69e 100644 --- a/net/ipv4/ping.c +++ b/net/ipv4/ping.c | |||
@@ -217,6 +217,8 @@ static struct sock *ping_lookup(struct net *net, struct sk_buff *skb, u16 ident) | |||
217 | &ipv6_hdr(skb)->daddr)) | 217 | &ipv6_hdr(skb)->daddr)) |
218 | continue; | 218 | continue; |
219 | #endif | 219 | #endif |
220 | } else { | ||
221 | continue; | ||
220 | } | 222 | } |
221 | 223 | ||
222 | if (sk->sk_bound_dev_if && sk->sk_bound_dev_if != dif) | 224 | if (sk->sk_bound_dev_if && sk->sk_bound_dev_if != dif) |
@@ -853,16 +855,8 @@ int ping_recvmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg, | |||
853 | if (flags & MSG_OOB) | 855 | if (flags & MSG_OOB) |
854 | goto out; | 856 | goto out; |
855 | 857 | ||
856 | if (flags & MSG_ERRQUEUE) { | 858 | if (flags & MSG_ERRQUEUE) |
857 | if (family == AF_INET) { | 859 | return inet_recv_error(sk, msg, len, addr_len); |
858 | return ip_recv_error(sk, msg, len, addr_len); | ||
859 | #if IS_ENABLED(CONFIG_IPV6) | ||
860 | } else if (family == AF_INET6) { | ||
861 | return pingv6_ops.ipv6_recv_error(sk, msg, len, | ||
862 | addr_len); | ||
863 | #endif | ||
864 | } | ||
865 | } | ||
866 | 860 | ||
867 | skb = skb_recv_datagram(sk, flags, noblock, &err); | 861 | skb = skb_recv_datagram(sk, flags, noblock, &err); |
868 | if (!skb) | 862 | if (!skb) |
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c index 39ec0c379545..38c2bcb8dd5d 100644 --- a/net/ipv4/tcp.c +++ b/net/ipv4/tcp.c | |||
@@ -1598,7 +1598,7 @@ int tcp_recvmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg, | |||
1598 | u32 urg_hole = 0; | 1598 | u32 urg_hole = 0; |
1599 | 1599 | ||
1600 | if (unlikely(flags & MSG_ERRQUEUE)) | 1600 | if (unlikely(flags & MSG_ERRQUEUE)) |
1601 | return ip_recv_error(sk, msg, len, addr_len); | 1601 | return inet_recv_error(sk, msg, len, addr_len); |
1602 | 1602 | ||
1603 | if (sk_can_busy_loop(sk) && skb_queue_empty(&sk->sk_receive_queue) && | 1603 | if (sk_can_busy_loop(sk) && skb_queue_empty(&sk->sk_receive_queue) && |
1604 | (sk->sk_state == TCP_ESTABLISHED)) | 1604 | (sk->sk_state == TCP_ESTABLISHED)) |
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c index 88fa2d160685..d107ee246a1d 100644 --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c | |||
@@ -5231,7 +5231,7 @@ slow_path: | |||
5231 | if (len < (th->doff << 2) || tcp_checksum_complete_user(sk, skb)) | 5231 | if (len < (th->doff << 2) || tcp_checksum_complete_user(sk, skb)) |
5232 | goto csum_error; | 5232 | goto csum_error; |
5233 | 5233 | ||
5234 | if (!th->ack && !th->rst) | 5234 | if (!th->ack && !th->rst && !th->syn) |
5235 | goto discard; | 5235 | goto discard; |
5236 | 5236 | ||
5237 | /* | 5237 | /* |
@@ -5650,7 +5650,7 @@ int tcp_rcv_state_process(struct sock *sk, struct sk_buff *skb, | |||
5650 | goto discard; | 5650 | goto discard; |
5651 | } | 5651 | } |
5652 | 5652 | ||
5653 | if (!th->ack && !th->rst) | 5653 | if (!th->ack && !th->rst && !th->syn) |
5654 | goto discard; | 5654 | goto discard; |
5655 | 5655 | ||
5656 | if (!tcp_validate_incoming(sk, skb, th, 0)) | 5656 | if (!tcp_validate_incoming(sk, skb, th, 0)) |
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c index 9c7d7621466b..147be2024290 100644 --- a/net/ipv4/tcp_ipv4.c +++ b/net/ipv4/tcp_ipv4.c | |||
@@ -598,7 +598,10 @@ static void tcp_v4_send_reset(struct sock *sk, struct sk_buff *skb) | |||
598 | if (th->rst) | 598 | if (th->rst) |
599 | return; | 599 | return; |
600 | 600 | ||
601 | if (skb_rtable(skb)->rt_type != RTN_LOCAL) | 601 | /* If sk not NULL, it means we did a successful lookup and incoming |
602 | * route had to be correct. prequeue might have dropped our dst. | ||
603 | */ | ||
604 | if (!sk && skb_rtable(skb)->rt_type != RTN_LOCAL) | ||
602 | return; | 605 | return; |
603 | 606 | ||
604 | /* Swap the send and the receive. */ | 607 | /* Swap the send and the receive. */ |
diff --git a/net/ipv6/ip6_gre.c b/net/ipv6/ip6_gre.c index 4564e1fca3eb..0e32d2e1bdbf 100644 --- a/net/ipv6/ip6_gre.c +++ b/net/ipv6/ip6_gre.c | |||
@@ -502,11 +502,11 @@ static int ip6gre_rcv(struct sk_buff *skb) | |||
502 | 502 | ||
503 | skb->protocol = gre_proto; | 503 | skb->protocol = gre_proto; |
504 | /* WCCP version 1 and 2 protocol decoding. | 504 | /* WCCP version 1 and 2 protocol decoding. |
505 | * - Change protocol to IP | 505 | * - Change protocol to IPv6 |
506 | * - When dealing with WCCPv2, Skip extra 4 bytes in GRE header | 506 | * - When dealing with WCCPv2, Skip extra 4 bytes in GRE header |
507 | */ | 507 | */ |
508 | if (flags == 0 && gre_proto == htons(ETH_P_WCCP)) { | 508 | if (flags == 0 && gre_proto == htons(ETH_P_WCCP)) { |
509 | skb->protocol = htons(ETH_P_IP); | 509 | skb->protocol = htons(ETH_P_IPV6); |
510 | if ((*(h + offset) & 0xF0) != 0x40) | 510 | if ((*(h + offset) & 0xF0) != 0x40) |
511 | offset += 4; | 511 | offset += 4; |
512 | } | 512 | } |
diff --git a/net/ipv6/ip6_offload.c b/net/ipv6/ip6_offload.c index a071563a7e6e..01e12d0d8fcc 100644 --- a/net/ipv6/ip6_offload.c +++ b/net/ipv6/ip6_offload.c | |||
@@ -69,7 +69,8 @@ static struct sk_buff *ipv6_gso_segment(struct sk_buff *skb, | |||
69 | int nhoff; | 69 | int nhoff; |
70 | 70 | ||
71 | if (unlikely(skb_shinfo(skb)->gso_type & | 71 | if (unlikely(skb_shinfo(skb)->gso_type & |
72 | ~(SKB_GSO_UDP | | 72 | ~(SKB_GSO_TCPV4 | |
73 | SKB_GSO_UDP | | ||
73 | SKB_GSO_DODGY | | 74 | SKB_GSO_DODGY | |
74 | SKB_GSO_TCP_ECN | | 75 | SKB_GSO_TCP_ECN | |
75 | SKB_GSO_GRE | | 76 | SKB_GSO_GRE | |
diff --git a/net/ipv6/ip6_udp_tunnel.c b/net/ipv6/ip6_udp_tunnel.c index b04ed72c4542..8db6c98fe218 100644 --- a/net/ipv6/ip6_udp_tunnel.c +++ b/net/ipv6/ip6_udp_tunnel.c | |||
@@ -79,15 +79,13 @@ int udp_tunnel6_xmit_skb(struct socket *sock, struct dst_entry *dst, | |||
79 | uh->source = src_port; | 79 | uh->source = src_port; |
80 | 80 | ||
81 | uh->len = htons(skb->len); | 81 | uh->len = htons(skb->len); |
82 | uh->check = 0; | ||
83 | 82 | ||
84 | memset(&(IPCB(skb)->opt), 0, sizeof(IPCB(skb)->opt)); | 83 | memset(&(IPCB(skb)->opt), 0, sizeof(IPCB(skb)->opt)); |
85 | IPCB(skb)->flags &= ~(IPSKB_XFRM_TUNNEL_SIZE | IPSKB_XFRM_TRANSFORMED | 84 | IPCB(skb)->flags &= ~(IPSKB_XFRM_TUNNEL_SIZE | IPSKB_XFRM_TRANSFORMED |
86 | | IPSKB_REROUTED); | 85 | | IPSKB_REROUTED); |
87 | skb_dst_set(skb, dst); | 86 | skb_dst_set(skb, dst); |
88 | 87 | ||
89 | udp6_set_csum(udp_get_no_check6_tx(sk), skb, &inet6_sk(sk)->saddr, | 88 | udp6_set_csum(udp_get_no_check6_tx(sk), skb, saddr, daddr, skb->len); |
90 | &sk->sk_v6_daddr, skb->len); | ||
91 | 89 | ||
92 | __skb_push(skb, sizeof(*ip6h)); | 90 | __skb_push(skb, sizeof(*ip6h)); |
93 | skb_reset_network_header(skb); | 91 | skb_reset_network_header(skb); |
diff --git a/net/ipv6/ip6_vti.c b/net/ipv6/ip6_vti.c index 31089d153fd3..bcda14de7f84 100644 --- a/net/ipv6/ip6_vti.c +++ b/net/ipv6/ip6_vti.c | |||
@@ -905,6 +905,15 @@ static int vti6_newlink(struct net *src_net, struct net_device *dev, | |||
905 | return vti6_tnl_create2(dev); | 905 | return vti6_tnl_create2(dev); |
906 | } | 906 | } |
907 | 907 | ||
908 | static void vti6_dellink(struct net_device *dev, struct list_head *head) | ||
909 | { | ||
910 | struct net *net = dev_net(dev); | ||
911 | struct vti6_net *ip6n = net_generic(net, vti6_net_id); | ||
912 | |||
913 | if (dev != ip6n->fb_tnl_dev) | ||
914 | unregister_netdevice_queue(dev, head); | ||
915 | } | ||
916 | |||
908 | static int vti6_changelink(struct net_device *dev, struct nlattr *tb[], | 917 | static int vti6_changelink(struct net_device *dev, struct nlattr *tb[], |
909 | struct nlattr *data[]) | 918 | struct nlattr *data[]) |
910 | { | 919 | { |
@@ -980,6 +989,7 @@ static struct rtnl_link_ops vti6_link_ops __read_mostly = { | |||
980 | .setup = vti6_dev_setup, | 989 | .setup = vti6_dev_setup, |
981 | .validate = vti6_validate, | 990 | .validate = vti6_validate, |
982 | .newlink = vti6_newlink, | 991 | .newlink = vti6_newlink, |
992 | .dellink = vti6_dellink, | ||
983 | .changelink = vti6_changelink, | 993 | .changelink = vti6_changelink, |
984 | .get_size = vti6_get_size, | 994 | .get_size = vti6_get_size, |
985 | .fill_info = vti6_fill_info, | 995 | .fill_info = vti6_fill_info, |
@@ -1020,6 +1030,7 @@ static int __net_init vti6_init_net(struct net *net) | |||
1020 | if (!ip6n->fb_tnl_dev) | 1030 | if (!ip6n->fb_tnl_dev) |
1021 | goto err_alloc_dev; | 1031 | goto err_alloc_dev; |
1022 | dev_net_set(ip6n->fb_tnl_dev, net); | 1032 | dev_net_set(ip6n->fb_tnl_dev, net); |
1033 | ip6n->fb_tnl_dev->rtnl_link_ops = &vti6_link_ops; | ||
1023 | 1034 | ||
1024 | err = vti6_fb_tnl_dev_init(ip6n->fb_tnl_dev); | 1035 | err = vti6_fb_tnl_dev_init(ip6n->fb_tnl_dev); |
1025 | if (err < 0) | 1036 | if (err < 0) |
diff --git a/net/ipv6/ip6mr.c b/net/ipv6/ip6mr.c index 0171f08325c3..1a01d79b8698 100644 --- a/net/ipv6/ip6mr.c +++ b/net/ipv6/ip6mr.c | |||
@@ -1439,6 +1439,10 @@ reg_pernet_fail: | |||
1439 | 1439 | ||
1440 | void ip6_mr_cleanup(void) | 1440 | void ip6_mr_cleanup(void) |
1441 | { | 1441 | { |
1442 | rtnl_unregister(RTNL_FAMILY_IP6MR, RTM_GETROUTE); | ||
1443 | #ifdef CONFIG_IPV6_PIMSM_V2 | ||
1444 | inet6_del_protocol(&pim6_protocol, IPPROTO_PIM); | ||
1445 | #endif | ||
1442 | unregister_netdevice_notifier(&ip6_mr_notifier); | 1446 | unregister_netdevice_notifier(&ip6_mr_notifier); |
1443 | unregister_pernet_subsys(&ip6mr_net_ops); | 1447 | unregister_pernet_subsys(&ip6mr_net_ops); |
1444 | kmem_cache_destroy(mrt_cachep); | 1448 | kmem_cache_destroy(mrt_cachep); |
diff --git a/net/ipv6/mcast.c b/net/ipv6/mcast.c index 9648de2b6745..ed2c4e400b46 100644 --- a/net/ipv6/mcast.c +++ b/net/ipv6/mcast.c | |||
@@ -1550,7 +1550,7 @@ static void ip6_mc_hdr(struct sock *sk, struct sk_buff *skb, | |||
1550 | hdr->daddr = *daddr; | 1550 | hdr->daddr = *daddr; |
1551 | } | 1551 | } |
1552 | 1552 | ||
1553 | static struct sk_buff *mld_newpack(struct inet6_dev *idev, int size) | 1553 | static struct sk_buff *mld_newpack(struct inet6_dev *idev, unsigned int mtu) |
1554 | { | 1554 | { |
1555 | struct net_device *dev = idev->dev; | 1555 | struct net_device *dev = idev->dev; |
1556 | struct net *net = dev_net(dev); | 1556 | struct net *net = dev_net(dev); |
@@ -1561,13 +1561,13 @@ static struct sk_buff *mld_newpack(struct inet6_dev *idev, int size) | |||
1561 | const struct in6_addr *saddr; | 1561 | const struct in6_addr *saddr; |
1562 | int hlen = LL_RESERVED_SPACE(dev); | 1562 | int hlen = LL_RESERVED_SPACE(dev); |
1563 | int tlen = dev->needed_tailroom; | 1563 | int tlen = dev->needed_tailroom; |
1564 | unsigned int size = mtu + hlen + tlen; | ||
1564 | int err; | 1565 | int err; |
1565 | u8 ra[8] = { IPPROTO_ICMPV6, 0, | 1566 | u8 ra[8] = { IPPROTO_ICMPV6, 0, |
1566 | IPV6_TLV_ROUTERALERT, 2, 0, 0, | 1567 | IPV6_TLV_ROUTERALERT, 2, 0, 0, |
1567 | IPV6_TLV_PADN, 0 }; | 1568 | IPV6_TLV_PADN, 0 }; |
1568 | 1569 | ||
1569 | /* we assume size > sizeof(ra) here */ | 1570 | /* we assume size > sizeof(ra) here */ |
1570 | size += hlen + tlen; | ||
1571 | /* limit our allocations to order-0 page */ | 1571 | /* limit our allocations to order-0 page */ |
1572 | size = min_t(int, size, SKB_MAX_ORDER(0, 0)); | 1572 | size = min_t(int, size, SKB_MAX_ORDER(0, 0)); |
1573 | skb = sock_alloc_send_skb(sk, size, 1, &err); | 1573 | skb = sock_alloc_send_skb(sk, size, 1, &err); |
@@ -1576,6 +1576,8 @@ static struct sk_buff *mld_newpack(struct inet6_dev *idev, int size) | |||
1576 | return NULL; | 1576 | return NULL; |
1577 | 1577 | ||
1578 | skb->priority = TC_PRIO_CONTROL; | 1578 | skb->priority = TC_PRIO_CONTROL; |
1579 | skb->reserved_tailroom = skb_end_offset(skb) - | ||
1580 | min(mtu, skb_end_offset(skb)); | ||
1579 | skb_reserve(skb, hlen); | 1581 | skb_reserve(skb, hlen); |
1580 | 1582 | ||
1581 | if (__ipv6_get_lladdr(idev, &addr_buf, IFA_F_TENTATIVE)) { | 1583 | if (__ipv6_get_lladdr(idev, &addr_buf, IFA_F_TENTATIVE)) { |
@@ -1690,8 +1692,7 @@ static struct sk_buff *add_grhead(struct sk_buff *skb, struct ifmcaddr6 *pmc, | |||
1690 | return skb; | 1692 | return skb; |
1691 | } | 1693 | } |
1692 | 1694 | ||
1693 | #define AVAILABLE(skb) ((skb) ? ((skb)->dev ? (skb)->dev->mtu - (skb)->len : \ | 1695 | #define AVAILABLE(skb) ((skb) ? skb_availroom(skb) : 0) |
1694 | skb_tailroom(skb)) : 0) | ||
1695 | 1696 | ||
1696 | static struct sk_buff *add_grec(struct sk_buff *skb, struct ifmcaddr6 *pmc, | 1697 | static struct sk_buff *add_grec(struct sk_buff *skb, struct ifmcaddr6 *pmc, |
1697 | int type, int gdeleted, int sdeleted, int crsend) | 1698 | int type, int gdeleted, int sdeleted, int crsend) |
diff --git a/net/ipv6/netfilter/nft_masq_ipv6.c b/net/ipv6/netfilter/nft_masq_ipv6.c index 8a7ac685076d..529c119cbb14 100644 --- a/net/ipv6/netfilter/nft_masq_ipv6.c +++ b/net/ipv6/netfilter/nft_masq_ipv6.c | |||
@@ -25,6 +25,7 @@ static void nft_masq_ipv6_eval(const struct nft_expr *expr, | |||
25 | struct nf_nat_range range; | 25 | struct nf_nat_range range; |
26 | unsigned int verdict; | 26 | unsigned int verdict; |
27 | 27 | ||
28 | memset(&range, 0, sizeof(range)); | ||
28 | range.flags = priv->flags; | 29 | range.flags = priv->flags; |
29 | 30 | ||
30 | verdict = nf_nat_masquerade_ipv6(pkt->skb, &range, pkt->out); | 31 | verdict = nf_nat_masquerade_ipv6(pkt->skb, &range, pkt->out); |
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c index ace29b60813c..dc495ae2ead0 100644 --- a/net/ipv6/tcp_ipv6.c +++ b/net/ipv6/tcp_ipv6.c | |||
@@ -903,7 +903,10 @@ static void tcp_v6_send_reset(struct sock *sk, struct sk_buff *skb) | |||
903 | if (th->rst) | 903 | if (th->rst) |
904 | return; | 904 | return; |
905 | 905 | ||
906 | if (!ipv6_unicast_destination(skb)) | 906 | /* If sk not NULL, it means we did a successful lookup and incoming |
907 | * route had to be correct. prequeue might have dropped our dst. | ||
908 | */ | ||
909 | if (!sk && !ipv6_unicast_destination(skb)) | ||
907 | return; | 910 | return; |
908 | 911 | ||
909 | #ifdef CONFIG_TCP_MD5SIG | 912 | #ifdef CONFIG_TCP_MD5SIG |
diff --git a/net/ipx/af_ipx.c b/net/ipx/af_ipx.c index 91729b807c7d..1b095ca37aa4 100644 --- a/net/ipx/af_ipx.c +++ b/net/ipx/af_ipx.c | |||
@@ -1764,6 +1764,7 @@ static int ipx_recvmsg(struct kiocb *iocb, struct socket *sock, | |||
1764 | struct ipxhdr *ipx = NULL; | 1764 | struct ipxhdr *ipx = NULL; |
1765 | struct sk_buff *skb; | 1765 | struct sk_buff *skb; |
1766 | int copied, rc; | 1766 | int copied, rc; |
1767 | bool locked = true; | ||
1767 | 1768 | ||
1768 | lock_sock(sk); | 1769 | lock_sock(sk); |
1769 | /* put the autobinding in */ | 1770 | /* put the autobinding in */ |
@@ -1790,6 +1791,8 @@ static int ipx_recvmsg(struct kiocb *iocb, struct socket *sock, | |||
1790 | if (sock_flag(sk, SOCK_ZAPPED)) | 1791 | if (sock_flag(sk, SOCK_ZAPPED)) |
1791 | goto out; | 1792 | goto out; |
1792 | 1793 | ||
1794 | release_sock(sk); | ||
1795 | locked = false; | ||
1793 | skb = skb_recv_datagram(sk, flags & ~MSG_DONTWAIT, | 1796 | skb = skb_recv_datagram(sk, flags & ~MSG_DONTWAIT, |
1794 | flags & MSG_DONTWAIT, &rc); | 1797 | flags & MSG_DONTWAIT, &rc); |
1795 | if (!skb) { | 1798 | if (!skb) { |
@@ -1826,7 +1829,8 @@ static int ipx_recvmsg(struct kiocb *iocb, struct socket *sock, | |||
1826 | out_free: | 1829 | out_free: |
1827 | skb_free_datagram(sk, skb); | 1830 | skb_free_datagram(sk, skb); |
1828 | out: | 1831 | out: |
1829 | release_sock(sk); | 1832 | if (locked) |
1833 | release_sock(sk); | ||
1830 | return rc; | 1834 | return rc; |
1831 | } | 1835 | } |
1832 | 1836 | ||
diff --git a/net/mac80211/aes_ccm.c b/net/mac80211/aes_ccm.c index ec24378caaaf..09d9caaec591 100644 --- a/net/mac80211/aes_ccm.c +++ b/net/mac80211/aes_ccm.c | |||
@@ -53,6 +53,9 @@ int ieee80211_aes_ccm_decrypt(struct crypto_aead *tfm, u8 *b_0, u8 *aad, | |||
53 | __aligned(__alignof__(struct aead_request)); | 53 | __aligned(__alignof__(struct aead_request)); |
54 | struct aead_request *aead_req = (void *) aead_req_data; | 54 | struct aead_request *aead_req = (void *) aead_req_data; |
55 | 55 | ||
56 | if (data_len == 0) | ||
57 | return -EINVAL; | ||
58 | |||
56 | memset(aead_req, 0, sizeof(aead_req_data)); | 59 | memset(aead_req, 0, sizeof(aead_req_data)); |
57 | 60 | ||
58 | sg_init_one(&pt, data, data_len); | 61 | sg_init_one(&pt, data, data_len); |
diff --git a/net/mac80211/rc80211_minstrel_ht.c b/net/mac80211/rc80211_minstrel_ht.c index df90ce2db00c..408fd8ab4eef 100644 --- a/net/mac80211/rc80211_minstrel_ht.c +++ b/net/mac80211/rc80211_minstrel_ht.c | |||
@@ -252,19 +252,16 @@ minstrel_ht_sort_best_tp_rates(struct minstrel_ht_sta *mi, u8 index, | |||
252 | cur_thr = mi->groups[cur_group].rates[cur_idx].cur_tp; | 252 | cur_thr = mi->groups[cur_group].rates[cur_idx].cur_tp; |
253 | cur_prob = mi->groups[cur_group].rates[cur_idx].probability; | 253 | cur_prob = mi->groups[cur_group].rates[cur_idx].probability; |
254 | 254 | ||
255 | tmp_group = tp_list[j - 1] / MCS_GROUP_RATES; | 255 | do { |
256 | tmp_idx = tp_list[j - 1] % MCS_GROUP_RATES; | ||
257 | tmp_thr = mi->groups[tmp_group].rates[tmp_idx].cur_tp; | ||
258 | tmp_prob = mi->groups[tmp_group].rates[tmp_idx].probability; | ||
259 | |||
260 | while (j > 0 && (cur_thr > tmp_thr || | ||
261 | (cur_thr == tmp_thr && cur_prob > tmp_prob))) { | ||
262 | j--; | ||
263 | tmp_group = tp_list[j - 1] / MCS_GROUP_RATES; | 256 | tmp_group = tp_list[j - 1] / MCS_GROUP_RATES; |
264 | tmp_idx = tp_list[j - 1] % MCS_GROUP_RATES; | 257 | tmp_idx = tp_list[j - 1] % MCS_GROUP_RATES; |
265 | tmp_thr = mi->groups[tmp_group].rates[tmp_idx].cur_tp; | 258 | tmp_thr = mi->groups[tmp_group].rates[tmp_idx].cur_tp; |
266 | tmp_prob = mi->groups[tmp_group].rates[tmp_idx].probability; | 259 | tmp_prob = mi->groups[tmp_group].rates[tmp_idx].probability; |
267 | } | 260 | if (cur_thr < tmp_thr || |
261 | (cur_thr == tmp_thr && cur_prob <= tmp_prob)) | ||
262 | break; | ||
263 | j--; | ||
264 | } while (j > 0); | ||
268 | 265 | ||
269 | if (j < MAX_THR_RATES - 1) { | 266 | if (j < MAX_THR_RATES - 1) { |
270 | memmove(&tp_list[j + 1], &tp_list[j], (sizeof(*tp_list) * | 267 | memmove(&tp_list[j + 1], &tp_list[j], (sizeof(*tp_list) * |
diff --git a/net/netfilter/ipset/ip_set_core.c b/net/netfilter/ipset/ip_set_core.c index 86f9d76b1464..d259da3ce67a 100644 --- a/net/netfilter/ipset/ip_set_core.c +++ b/net/netfilter/ipset/ip_set_core.c | |||
@@ -1863,6 +1863,12 @@ ip_set_sockfn_get(struct sock *sk, int optval, void __user *user, int *len) | |||
1863 | if (*op < IP_SET_OP_VERSION) { | 1863 | if (*op < IP_SET_OP_VERSION) { |
1864 | /* Check the version at the beginning of operations */ | 1864 | /* Check the version at the beginning of operations */ |
1865 | struct ip_set_req_version *req_version = data; | 1865 | struct ip_set_req_version *req_version = data; |
1866 | |||
1867 | if (*len < sizeof(struct ip_set_req_version)) { | ||
1868 | ret = -EINVAL; | ||
1869 | goto done; | ||
1870 | } | ||
1871 | |||
1866 | if (req_version->version != IPSET_PROTOCOL) { | 1872 | if (req_version->version != IPSET_PROTOCOL) { |
1867 | ret = -EPROTO; | 1873 | ret = -EPROTO; |
1868 | goto done; | 1874 | goto done; |
diff --git a/net/netfilter/ipvs/ip_vs_xmit.c b/net/netfilter/ipvs/ip_vs_xmit.c index 437a3663ad03..bd90bf8107da 100644 --- a/net/netfilter/ipvs/ip_vs_xmit.c +++ b/net/netfilter/ipvs/ip_vs_xmit.c | |||
@@ -846,6 +846,8 @@ ip_vs_prepare_tunneled_skb(struct sk_buff *skb, int skb_af, | |||
846 | new_skb = skb_realloc_headroom(skb, max_headroom); | 846 | new_skb = skb_realloc_headroom(skb, max_headroom); |
847 | if (!new_skb) | 847 | if (!new_skb) |
848 | goto error; | 848 | goto error; |
849 | if (skb->sk) | ||
850 | skb_set_owner_w(new_skb, skb->sk); | ||
849 | consume_skb(skb); | 851 | consume_skb(skb); |
850 | skb = new_skb; | 852 | skb = new_skb; |
851 | } | 853 | } |
diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c index 11ab4b078f3b..66e8425dbfe7 100644 --- a/net/netfilter/nf_tables_api.c +++ b/net/netfilter/nf_tables_api.c | |||
@@ -3484,13 +3484,8 @@ static void nft_chain_commit_update(struct nft_trans *trans) | |||
3484 | } | 3484 | } |
3485 | } | 3485 | } |
3486 | 3486 | ||
3487 | /* Schedule objects for release via rcu to make sure no packets are accesing | 3487 | static void nf_tables_commit_release(struct nft_trans *trans) |
3488 | * removed rules. | ||
3489 | */ | ||
3490 | static void nf_tables_commit_release_rcu(struct rcu_head *rt) | ||
3491 | { | 3488 | { |
3492 | struct nft_trans *trans = container_of(rt, struct nft_trans, rcu_head); | ||
3493 | |||
3494 | switch (trans->msg_type) { | 3489 | switch (trans->msg_type) { |
3495 | case NFT_MSG_DELTABLE: | 3490 | case NFT_MSG_DELTABLE: |
3496 | nf_tables_table_destroy(&trans->ctx); | 3491 | nf_tables_table_destroy(&trans->ctx); |
@@ -3612,10 +3607,11 @@ static int nf_tables_commit(struct sk_buff *skb) | |||
3612 | } | 3607 | } |
3613 | } | 3608 | } |
3614 | 3609 | ||
3610 | synchronize_rcu(); | ||
3611 | |||
3615 | list_for_each_entry_safe(trans, next, &net->nft.commit_list, list) { | 3612 | list_for_each_entry_safe(trans, next, &net->nft.commit_list, list) { |
3616 | list_del(&trans->list); | 3613 | list_del(&trans->list); |
3617 | trans->ctx.nla = NULL; | 3614 | nf_tables_commit_release(trans); |
3618 | call_rcu(&trans->rcu_head, nf_tables_commit_release_rcu); | ||
3619 | } | 3615 | } |
3620 | 3616 | ||
3621 | nf_tables_gen_notify(net, skb, NFT_MSG_NEWGEN); | 3617 | nf_tables_gen_notify(net, skb, NFT_MSG_NEWGEN); |
@@ -3623,13 +3619,8 @@ static int nf_tables_commit(struct sk_buff *skb) | |||
3623 | return 0; | 3619 | return 0; |
3624 | } | 3620 | } |
3625 | 3621 | ||
3626 | /* Schedule objects for release via rcu to make sure no packets are accesing | 3622 | static void nf_tables_abort_release(struct nft_trans *trans) |
3627 | * aborted rules. | ||
3628 | */ | ||
3629 | static void nf_tables_abort_release_rcu(struct rcu_head *rt) | ||
3630 | { | 3623 | { |
3631 | struct nft_trans *trans = container_of(rt, struct nft_trans, rcu_head); | ||
3632 | |||
3633 | switch (trans->msg_type) { | 3624 | switch (trans->msg_type) { |
3634 | case NFT_MSG_NEWTABLE: | 3625 | case NFT_MSG_NEWTABLE: |
3635 | nf_tables_table_destroy(&trans->ctx); | 3626 | nf_tables_table_destroy(&trans->ctx); |
@@ -3725,11 +3716,12 @@ static int nf_tables_abort(struct sk_buff *skb) | |||
3725 | } | 3716 | } |
3726 | } | 3717 | } |
3727 | 3718 | ||
3719 | synchronize_rcu(); | ||
3720 | |||
3728 | list_for_each_entry_safe_reverse(trans, next, | 3721 | list_for_each_entry_safe_reverse(trans, next, |
3729 | &net->nft.commit_list, list) { | 3722 | &net->nft.commit_list, list) { |
3730 | list_del(&trans->list); | 3723 | list_del(&trans->list); |
3731 | trans->ctx.nla = NULL; | 3724 | nf_tables_abort_release(trans); |
3732 | call_rcu(&trans->rcu_head, nf_tables_abort_release_rcu); | ||
3733 | } | 3725 | } |
3734 | 3726 | ||
3735 | return 0; | 3727 | return 0; |
diff --git a/net/netfilter/nfnetlink.c b/net/netfilter/nfnetlink.c index 6c5a915cfa75..13c2e17bbe27 100644 --- a/net/netfilter/nfnetlink.c +++ b/net/netfilter/nfnetlink.c | |||
@@ -47,6 +47,8 @@ static const int nfnl_group2type[NFNLGRP_MAX+1] = { | |||
47 | [NFNLGRP_CONNTRACK_EXP_NEW] = NFNL_SUBSYS_CTNETLINK_EXP, | 47 | [NFNLGRP_CONNTRACK_EXP_NEW] = NFNL_SUBSYS_CTNETLINK_EXP, |
48 | [NFNLGRP_CONNTRACK_EXP_UPDATE] = NFNL_SUBSYS_CTNETLINK_EXP, | 48 | [NFNLGRP_CONNTRACK_EXP_UPDATE] = NFNL_SUBSYS_CTNETLINK_EXP, |
49 | [NFNLGRP_CONNTRACK_EXP_DESTROY] = NFNL_SUBSYS_CTNETLINK_EXP, | 49 | [NFNLGRP_CONNTRACK_EXP_DESTROY] = NFNL_SUBSYS_CTNETLINK_EXP, |
50 | [NFNLGRP_NFTABLES] = NFNL_SUBSYS_NFTABLES, | ||
51 | [NFNLGRP_ACCT_QUOTA] = NFNL_SUBSYS_ACCT, | ||
50 | }; | 52 | }; |
51 | 53 | ||
52 | void nfnl_lock(__u8 subsys_id) | 54 | void nfnl_lock(__u8 subsys_id) |
@@ -464,7 +466,12 @@ static void nfnetlink_rcv(struct sk_buff *skb) | |||
464 | static int nfnetlink_bind(int group) | 466 | static int nfnetlink_bind(int group) |
465 | { | 467 | { |
466 | const struct nfnetlink_subsystem *ss; | 468 | const struct nfnetlink_subsystem *ss; |
467 | int type = nfnl_group2type[group]; | 469 | int type; |
470 | |||
471 | if (group <= NFNLGRP_NONE || group > NFNLGRP_MAX) | ||
472 | return -EINVAL; | ||
473 | |||
474 | type = nfnl_group2type[group]; | ||
468 | 475 | ||
469 | rcu_read_lock(); | 476 | rcu_read_lock(); |
470 | ss = nfnetlink_get_subsys(type); | 477 | ss = nfnetlink_get_subsys(type); |
@@ -514,6 +521,9 @@ static int __init nfnetlink_init(void) | |||
514 | { | 521 | { |
515 | int i; | 522 | int i; |
516 | 523 | ||
524 | for (i = NFNLGRP_NONE + 1; i <= NFNLGRP_MAX; i++) | ||
525 | BUG_ON(nfnl_group2type[i] == NFNL_SUBSYS_NONE); | ||
526 | |||
517 | for (i=0; i<NFNL_SUBSYS_COUNT; i++) | 527 | for (i=0; i<NFNL_SUBSYS_COUNT; i++) |
518 | mutex_init(&table[i].mutex); | 528 | mutex_init(&table[i].mutex); |
519 | 529 | ||
diff --git a/net/netfilter/nft_compat.c b/net/netfilter/nft_compat.c index 9d6d6f60a80f..265e190f2218 100644 --- a/net/netfilter/nft_compat.c +++ b/net/netfilter/nft_compat.c | |||
@@ -21,45 +21,17 @@ | |||
21 | #include <linux/netfilter_ipv6/ip6_tables.h> | 21 | #include <linux/netfilter_ipv6/ip6_tables.h> |
22 | #include <net/netfilter/nf_tables.h> | 22 | #include <net/netfilter/nf_tables.h> |
23 | 23 | ||
24 | static const struct { | ||
25 | const char *name; | ||
26 | u8 type; | ||
27 | } table_to_chaintype[] = { | ||
28 | { "filter", NFT_CHAIN_T_DEFAULT }, | ||
29 | { "raw", NFT_CHAIN_T_DEFAULT }, | ||
30 | { "security", NFT_CHAIN_T_DEFAULT }, | ||
31 | { "mangle", NFT_CHAIN_T_ROUTE }, | ||
32 | { "nat", NFT_CHAIN_T_NAT }, | ||
33 | { }, | ||
34 | }; | ||
35 | |||
36 | static int nft_compat_table_to_chaintype(const char *table) | ||
37 | { | ||
38 | int i; | ||
39 | |||
40 | for (i = 0; table_to_chaintype[i].name != NULL; i++) { | ||
41 | if (strcmp(table_to_chaintype[i].name, table) == 0) | ||
42 | return table_to_chaintype[i].type; | ||
43 | } | ||
44 | |||
45 | return -1; | ||
46 | } | ||
47 | |||
48 | static int nft_compat_chain_validate_dependency(const char *tablename, | 24 | static int nft_compat_chain_validate_dependency(const char *tablename, |
49 | const struct nft_chain *chain) | 25 | const struct nft_chain *chain) |
50 | { | 26 | { |
51 | enum nft_chain_type type; | ||
52 | const struct nft_base_chain *basechain; | 27 | const struct nft_base_chain *basechain; |
53 | 28 | ||
54 | if (!tablename || !(chain->flags & NFT_BASE_CHAIN)) | 29 | if (!tablename || !(chain->flags & NFT_BASE_CHAIN)) |
55 | return 0; | 30 | return 0; |
56 | 31 | ||
57 | type = nft_compat_table_to_chaintype(tablename); | ||
58 | if (type < 0) | ||
59 | return -EINVAL; | ||
60 | |||
61 | basechain = nft_base_chain(chain); | 32 | basechain = nft_base_chain(chain); |
62 | if (basechain->type->type != type) | 33 | if (strcmp(tablename, "nat") == 0 && |
34 | basechain->type->type != NFT_CHAIN_T_NAT) | ||
63 | return -EINVAL; | 35 | return -EINVAL; |
64 | 36 | ||
65 | return 0; | 37 | return 0; |
@@ -117,7 +89,7 @@ nft_target_set_tgchk_param(struct xt_tgchk_param *par, | |||
117 | struct xt_target *target, void *info, | 89 | struct xt_target *target, void *info, |
118 | union nft_entry *entry, u8 proto, bool inv) | 90 | union nft_entry *entry, u8 proto, bool inv) |
119 | { | 91 | { |
120 | par->net = &init_net; | 92 | par->net = ctx->net; |
121 | par->table = ctx->table->name; | 93 | par->table = ctx->table->name; |
122 | switch (ctx->afi->family) { | 94 | switch (ctx->afi->family) { |
123 | case AF_INET: | 95 | case AF_INET: |
@@ -324,7 +296,7 @@ nft_match_set_mtchk_param(struct xt_mtchk_param *par, const struct nft_ctx *ctx, | |||
324 | struct xt_match *match, void *info, | 296 | struct xt_match *match, void *info, |
325 | union nft_entry *entry, u8 proto, bool inv) | 297 | union nft_entry *entry, u8 proto, bool inv) |
326 | { | 298 | { |
327 | par->net = &init_net; | 299 | par->net = ctx->net; |
328 | par->table = ctx->table->name; | 300 | par->table = ctx->table->name; |
329 | switch (ctx->afi->family) { | 301 | switch (ctx->afi->family) { |
330 | case AF_INET: | 302 | case AF_INET: |
@@ -374,7 +346,7 @@ nft_match_init(const struct nft_ctx *ctx, const struct nft_expr *expr, | |||
374 | union nft_entry e = {}; | 346 | union nft_entry e = {}; |
375 | int ret; | 347 | int ret; |
376 | 348 | ||
377 | ret = nft_compat_chain_validate_dependency(match->name, ctx->chain); | 349 | ret = nft_compat_chain_validate_dependency(match->table, ctx->chain); |
378 | if (ret < 0) | 350 | if (ret < 0) |
379 | goto err; | 351 | goto err; |
380 | 352 | ||
@@ -448,7 +420,7 @@ static int nft_match_validate(const struct nft_ctx *ctx, | |||
448 | if (!(hook_mask & match->hooks)) | 420 | if (!(hook_mask & match->hooks)) |
449 | return -EINVAL; | 421 | return -EINVAL; |
450 | 422 | ||
451 | ret = nft_compat_chain_validate_dependency(match->name, | 423 | ret = nft_compat_chain_validate_dependency(match->table, |
452 | ctx->chain); | 424 | ctx->chain); |
453 | if (ret < 0) | 425 | if (ret < 0) |
454 | return ret; | 426 | return ret; |
diff --git a/net/openvswitch/actions.c b/net/openvswitch/actions.c index 006886dbee36..8c4229b11c34 100644 --- a/net/openvswitch/actions.c +++ b/net/openvswitch/actions.c | |||
@@ -246,11 +246,11 @@ static void update_ipv6_checksum(struct sk_buff *skb, u8 l4_proto, | |||
246 | { | 246 | { |
247 | int transport_len = skb->len - skb_transport_offset(skb); | 247 | int transport_len = skb->len - skb_transport_offset(skb); |
248 | 248 | ||
249 | if (l4_proto == IPPROTO_TCP) { | 249 | if (l4_proto == NEXTHDR_TCP) { |
250 | if (likely(transport_len >= sizeof(struct tcphdr))) | 250 | if (likely(transport_len >= sizeof(struct tcphdr))) |
251 | inet_proto_csum_replace16(&tcp_hdr(skb)->check, skb, | 251 | inet_proto_csum_replace16(&tcp_hdr(skb)->check, skb, |
252 | addr, new_addr, 1); | 252 | addr, new_addr, 1); |
253 | } else if (l4_proto == IPPROTO_UDP) { | 253 | } else if (l4_proto == NEXTHDR_UDP) { |
254 | if (likely(transport_len >= sizeof(struct udphdr))) { | 254 | if (likely(transport_len >= sizeof(struct udphdr))) { |
255 | struct udphdr *uh = udp_hdr(skb); | 255 | struct udphdr *uh = udp_hdr(skb); |
256 | 256 | ||
@@ -261,6 +261,10 @@ static void update_ipv6_checksum(struct sk_buff *skb, u8 l4_proto, | |||
261 | uh->check = CSUM_MANGLED_0; | 261 | uh->check = CSUM_MANGLED_0; |
262 | } | 262 | } |
263 | } | 263 | } |
264 | } else if (l4_proto == NEXTHDR_ICMP) { | ||
265 | if (likely(transport_len >= sizeof(struct icmp6hdr))) | ||
266 | inet_proto_csum_replace16(&icmp6_hdr(skb)->icmp6_cksum, | ||
267 | skb, addr, new_addr, 1); | ||
264 | } | 268 | } |
265 | } | 269 | } |
266 | 270 | ||
@@ -722,8 +726,6 @@ static int do_execute_actions(struct datapath *dp, struct sk_buff *skb, | |||
722 | 726 | ||
723 | case OVS_ACTION_ATTR_SAMPLE: | 727 | case OVS_ACTION_ATTR_SAMPLE: |
724 | err = sample(dp, skb, key, a); | 728 | err = sample(dp, skb, key, a); |
725 | if (unlikely(err)) /* skb already freed. */ | ||
726 | return err; | ||
727 | break; | 729 | break; |
728 | } | 730 | } |
729 | 731 | ||
diff --git a/net/openvswitch/datapath.c b/net/openvswitch/datapath.c index e6d7255183eb..f9e556b56086 100644 --- a/net/openvswitch/datapath.c +++ b/net/openvswitch/datapath.c | |||
@@ -1265,7 +1265,7 @@ static size_t ovs_dp_cmd_msg_size(void) | |||
1265 | return msgsize; | 1265 | return msgsize; |
1266 | } | 1266 | } |
1267 | 1267 | ||
1268 | /* Called with ovs_mutex or RCU read lock. */ | 1268 | /* Called with ovs_mutex. */ |
1269 | static int ovs_dp_cmd_fill_info(struct datapath *dp, struct sk_buff *skb, | 1269 | static int ovs_dp_cmd_fill_info(struct datapath *dp, struct sk_buff *skb, |
1270 | u32 portid, u32 seq, u32 flags, u8 cmd) | 1270 | u32 portid, u32 seq, u32 flags, u8 cmd) |
1271 | { | 1271 | { |
@@ -1555,7 +1555,7 @@ static int ovs_dp_cmd_get(struct sk_buff *skb, struct genl_info *info) | |||
1555 | if (!reply) | 1555 | if (!reply) |
1556 | return -ENOMEM; | 1556 | return -ENOMEM; |
1557 | 1557 | ||
1558 | rcu_read_lock(); | 1558 | ovs_lock(); |
1559 | dp = lookup_datapath(sock_net(skb->sk), info->userhdr, info->attrs); | 1559 | dp = lookup_datapath(sock_net(skb->sk), info->userhdr, info->attrs); |
1560 | if (IS_ERR(dp)) { | 1560 | if (IS_ERR(dp)) { |
1561 | err = PTR_ERR(dp); | 1561 | err = PTR_ERR(dp); |
@@ -1564,12 +1564,12 @@ static int ovs_dp_cmd_get(struct sk_buff *skb, struct genl_info *info) | |||
1564 | err = ovs_dp_cmd_fill_info(dp, reply, info->snd_portid, | 1564 | err = ovs_dp_cmd_fill_info(dp, reply, info->snd_portid, |
1565 | info->snd_seq, 0, OVS_DP_CMD_NEW); | 1565 | info->snd_seq, 0, OVS_DP_CMD_NEW); |
1566 | BUG_ON(err < 0); | 1566 | BUG_ON(err < 0); |
1567 | rcu_read_unlock(); | 1567 | ovs_unlock(); |
1568 | 1568 | ||
1569 | return genlmsg_reply(reply, info); | 1569 | return genlmsg_reply(reply, info); |
1570 | 1570 | ||
1571 | err_unlock_free: | 1571 | err_unlock_free: |
1572 | rcu_read_unlock(); | 1572 | ovs_unlock(); |
1573 | kfree_skb(reply); | 1573 | kfree_skb(reply); |
1574 | return err; | 1574 | return err; |
1575 | } | 1575 | } |
@@ -1581,8 +1581,8 @@ static int ovs_dp_cmd_dump(struct sk_buff *skb, struct netlink_callback *cb) | |||
1581 | int skip = cb->args[0]; | 1581 | int skip = cb->args[0]; |
1582 | int i = 0; | 1582 | int i = 0; |
1583 | 1583 | ||
1584 | rcu_read_lock(); | 1584 | ovs_lock(); |
1585 | list_for_each_entry_rcu(dp, &ovs_net->dps, list_node) { | 1585 | list_for_each_entry(dp, &ovs_net->dps, list_node) { |
1586 | if (i >= skip && | 1586 | if (i >= skip && |
1587 | ovs_dp_cmd_fill_info(dp, skb, NETLINK_CB(cb->skb).portid, | 1587 | ovs_dp_cmd_fill_info(dp, skb, NETLINK_CB(cb->skb).portid, |
1588 | cb->nlh->nlmsg_seq, NLM_F_MULTI, | 1588 | cb->nlh->nlmsg_seq, NLM_F_MULTI, |
@@ -1590,7 +1590,7 @@ static int ovs_dp_cmd_dump(struct sk_buff *skb, struct netlink_callback *cb) | |||
1590 | break; | 1590 | break; |
1591 | i++; | 1591 | i++; |
1592 | } | 1592 | } |
1593 | rcu_read_unlock(); | 1593 | ovs_unlock(); |
1594 | 1594 | ||
1595 | cb->args[0] = i; | 1595 | cb->args[0] = i; |
1596 | 1596 | ||
diff --git a/net/openvswitch/flow_netlink.c b/net/openvswitch/flow_netlink.c index 939bcb32100f..089b195c064a 100644 --- a/net/openvswitch/flow_netlink.c +++ b/net/openvswitch/flow_netlink.c | |||
@@ -145,7 +145,7 @@ static bool match_validate(const struct sw_flow_match *match, | |||
145 | if (match->key->eth.type == htons(ETH_P_ARP) | 145 | if (match->key->eth.type == htons(ETH_P_ARP) |
146 | || match->key->eth.type == htons(ETH_P_RARP)) { | 146 | || match->key->eth.type == htons(ETH_P_RARP)) { |
147 | key_expected |= 1 << OVS_KEY_ATTR_ARP; | 147 | key_expected |= 1 << OVS_KEY_ATTR_ARP; |
148 | if (match->mask && (match->mask->key.eth.type == htons(0xffff))) | 148 | if (match->mask && (match->mask->key.tp.src == htons(0xff))) |
149 | mask_allowed |= 1 << OVS_KEY_ATTR_ARP; | 149 | mask_allowed |= 1 << OVS_KEY_ATTR_ARP; |
150 | } | 150 | } |
151 | 151 | ||
@@ -689,6 +689,13 @@ static int ovs_key_from_nlattrs(struct sw_flow_match *match, u64 attrs, | |||
689 | ipv6_key->ipv6_frag, OVS_FRAG_TYPE_MAX); | 689 | ipv6_key->ipv6_frag, OVS_FRAG_TYPE_MAX); |
690 | return -EINVAL; | 690 | return -EINVAL; |
691 | } | 691 | } |
692 | |||
693 | if (!is_mask && ipv6_key->ipv6_label & htonl(0xFFF00000)) { | ||
694 | OVS_NLERR("IPv6 flow label %x is out of range (max=%x).\n", | ||
695 | ntohl(ipv6_key->ipv6_label), (1 << 20) - 1); | ||
696 | return -EINVAL; | ||
697 | } | ||
698 | |||
692 | SW_FLOW_KEY_PUT(match, ipv6.label, | 699 | SW_FLOW_KEY_PUT(match, ipv6.label, |
693 | ipv6_key->ipv6_label, is_mask); | 700 | ipv6_key->ipv6_label, is_mask); |
694 | SW_FLOW_KEY_PUT(match, ip.proto, | 701 | SW_FLOW_KEY_PUT(match, ip.proto, |
diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c index 87d20f48ff06..07c04a841ba0 100644 --- a/net/packet/af_packet.c +++ b/net/packet/af_packet.c | |||
@@ -378,7 +378,7 @@ static void unregister_prot_hook(struct sock *sk, bool sync) | |||
378 | __unregister_prot_hook(sk, sync); | 378 | __unregister_prot_hook(sk, sync); |
379 | } | 379 | } |
380 | 380 | ||
381 | static inline __pure struct page *pgv_to_page(void *addr) | 381 | static inline struct page * __pure pgv_to_page(void *addr) |
382 | { | 382 | { |
383 | if (is_vmalloc_addr(addr)) | 383 | if (is_vmalloc_addr(addr)) |
384 | return vmalloc_to_page(addr); | 384 | return vmalloc_to_page(addr); |
diff --git a/net/rfkill/rfkill-gpio.c b/net/rfkill/rfkill-gpio.c index 0f62326c0f5e..2a4717967502 100644 --- a/net/rfkill/rfkill-gpio.c +++ b/net/rfkill/rfkill-gpio.c | |||
@@ -63,6 +63,15 @@ static const struct rfkill_ops rfkill_gpio_ops = { | |||
63 | .set_block = rfkill_gpio_set_power, | 63 | .set_block = rfkill_gpio_set_power, |
64 | }; | 64 | }; |
65 | 65 | ||
66 | static const struct acpi_gpio_params reset_gpios = { 0, 0, false }; | ||
67 | static const struct acpi_gpio_params shutdown_gpios = { 1, 0, false }; | ||
68 | |||
69 | static const struct acpi_gpio_mapping acpi_rfkill_default_gpios[] = { | ||
70 | { "reset-gpios", &reset_gpios, 1 }, | ||
71 | { "shutdown-gpios", &shutdown_gpios, 1 }, | ||
72 | { }, | ||
73 | }; | ||
74 | |||
66 | static int rfkill_gpio_acpi_probe(struct device *dev, | 75 | static int rfkill_gpio_acpi_probe(struct device *dev, |
67 | struct rfkill_gpio_data *rfkill) | 76 | struct rfkill_gpio_data *rfkill) |
68 | { | 77 | { |
@@ -75,7 +84,8 @@ static int rfkill_gpio_acpi_probe(struct device *dev, | |||
75 | rfkill->name = dev_name(dev); | 84 | rfkill->name = dev_name(dev); |
76 | rfkill->type = (unsigned)id->driver_data; | 85 | rfkill->type = (unsigned)id->driver_data; |
77 | 86 | ||
78 | return 0; | 87 | return acpi_dev_add_driver_gpios(ACPI_COMPANION(dev), |
88 | acpi_rfkill_default_gpios); | ||
79 | } | 89 | } |
80 | 90 | ||
81 | static int rfkill_gpio_probe(struct platform_device *pdev) | 91 | static int rfkill_gpio_probe(struct platform_device *pdev) |
@@ -102,7 +112,7 @@ static int rfkill_gpio_probe(struct platform_device *pdev) | |||
102 | 112 | ||
103 | rfkill->clk = devm_clk_get(&pdev->dev, NULL); | 113 | rfkill->clk = devm_clk_get(&pdev->dev, NULL); |
104 | 114 | ||
105 | gpio = devm_gpiod_get_index(&pdev->dev, "reset", 0); | 115 | gpio = devm_gpiod_get(&pdev->dev, "reset"); |
106 | if (!IS_ERR(gpio)) { | 116 | if (!IS_ERR(gpio)) { |
107 | ret = gpiod_direction_output(gpio, 0); | 117 | ret = gpiod_direction_output(gpio, 0); |
108 | if (ret) | 118 | if (ret) |
@@ -110,7 +120,7 @@ static int rfkill_gpio_probe(struct platform_device *pdev) | |||
110 | rfkill->reset_gpio = gpio; | 120 | rfkill->reset_gpio = gpio; |
111 | } | 121 | } |
112 | 122 | ||
113 | gpio = devm_gpiod_get_index(&pdev->dev, "shutdown", 1); | 123 | gpio = devm_gpiod_get(&pdev->dev, "shutdown"); |
114 | if (!IS_ERR(gpio)) { | 124 | if (!IS_ERR(gpio)) { |
115 | ret = gpiod_direction_output(gpio, 0); | 125 | ret = gpiod_direction_output(gpio, 0); |
116 | if (ret) | 126 | if (ret) |
@@ -150,6 +160,8 @@ static int rfkill_gpio_remove(struct platform_device *pdev) | |||
150 | rfkill_unregister(rfkill->rfkill_dev); | 160 | rfkill_unregister(rfkill->rfkill_dev); |
151 | rfkill_destroy(rfkill->rfkill_dev); | 161 | rfkill_destroy(rfkill->rfkill_dev); |
152 | 162 | ||
163 | acpi_dev_remove_driver_gpios(ACPI_COMPANION(&pdev->dev)); | ||
164 | |||
153 | return 0; | 165 | return 0; |
154 | } | 166 | } |
155 | 167 | ||
diff --git a/net/sunrpc/svcsock.c b/net/sunrpc/svcsock.c index 3f959c681885..f9c052d508f0 100644 --- a/net/sunrpc/svcsock.c +++ b/net/sunrpc/svcsock.c | |||
@@ -1019,17 +1019,12 @@ static int receive_cb_reply(struct svc_sock *svsk, struct svc_rqst *rqstp) | |||
1019 | xid = *p++; | 1019 | xid = *p++; |
1020 | calldir = *p; | 1020 | calldir = *p; |
1021 | 1021 | ||
1022 | if (bc_xprt) | 1022 | if (!bc_xprt) |
1023 | req = xprt_lookup_rqst(bc_xprt, xid); | ||
1024 | |||
1025 | if (!req) { | ||
1026 | printk(KERN_NOTICE | ||
1027 | "%s: Got unrecognized reply: " | ||
1028 | "calldir 0x%x xpt_bc_xprt %p xid %08x\n", | ||
1029 | __func__, ntohl(calldir), | ||
1030 | bc_xprt, ntohl(xid)); | ||
1031 | return -EAGAIN; | 1023 | return -EAGAIN; |
1032 | } | 1024 | spin_lock_bh(&bc_xprt->transport_lock); |
1025 | req = xprt_lookup_rqst(bc_xprt, xid); | ||
1026 | if (!req) | ||
1027 | goto unlock_notfound; | ||
1033 | 1028 | ||
1034 | memcpy(&req->rq_private_buf, &req->rq_rcv_buf, sizeof(struct xdr_buf)); | 1029 | memcpy(&req->rq_private_buf, &req->rq_rcv_buf, sizeof(struct xdr_buf)); |
1035 | /* | 1030 | /* |
@@ -1040,11 +1035,21 @@ static int receive_cb_reply(struct svc_sock *svsk, struct svc_rqst *rqstp) | |||
1040 | dst = &req->rq_private_buf.head[0]; | 1035 | dst = &req->rq_private_buf.head[0]; |
1041 | src = &rqstp->rq_arg.head[0]; | 1036 | src = &rqstp->rq_arg.head[0]; |
1042 | if (dst->iov_len < src->iov_len) | 1037 | if (dst->iov_len < src->iov_len) |
1043 | return -EAGAIN; /* whatever; just giving up. */ | 1038 | goto unlock_eagain; /* whatever; just giving up. */ |
1044 | memcpy(dst->iov_base, src->iov_base, src->iov_len); | 1039 | memcpy(dst->iov_base, src->iov_base, src->iov_len); |
1045 | xprt_complete_rqst(req->rq_task, rqstp->rq_arg.len); | 1040 | xprt_complete_rqst(req->rq_task, rqstp->rq_arg.len); |
1046 | rqstp->rq_arg.len = 0; | 1041 | rqstp->rq_arg.len = 0; |
1042 | spin_unlock_bh(&bc_xprt->transport_lock); | ||
1047 | return 0; | 1043 | return 0; |
1044 | unlock_notfound: | ||
1045 | printk(KERN_NOTICE | ||
1046 | "%s: Got unrecognized reply: " | ||
1047 | "calldir 0x%x xpt_bc_xprt %p xid %08x\n", | ||
1048 | __func__, ntohl(calldir), | ||
1049 | bc_xprt, ntohl(xid)); | ||
1050 | unlock_eagain: | ||
1051 | spin_unlock_bh(&bc_xprt->transport_lock); | ||
1052 | return -EAGAIN; | ||
1048 | } | 1053 | } |
1049 | 1054 | ||
1050 | static int copy_pages_to_kvecs(struct kvec *vec, struct page **pages, int len) | 1055 | static int copy_pages_to_kvecs(struct kvec *vec, struct page **pages, int len) |
diff --git a/security/keys/internal.h b/security/keys/internal.h index b8960c4959a5..200e37867336 100644 --- a/security/keys/internal.h +++ b/security/keys/internal.h | |||
@@ -117,6 +117,7 @@ struct keyring_search_context { | |||
117 | #define KEYRING_SEARCH_NO_UPDATE_TIME 0x0004 /* Don't update times */ | 117 | #define KEYRING_SEARCH_NO_UPDATE_TIME 0x0004 /* Don't update times */ |
118 | #define KEYRING_SEARCH_NO_CHECK_PERM 0x0008 /* Don't check permissions */ | 118 | #define KEYRING_SEARCH_NO_CHECK_PERM 0x0008 /* Don't check permissions */ |
119 | #define KEYRING_SEARCH_DETECT_TOO_DEEP 0x0010 /* Give an error on excessive depth */ | 119 | #define KEYRING_SEARCH_DETECT_TOO_DEEP 0x0010 /* Give an error on excessive depth */ |
120 | #define KEYRING_SEARCH_SKIP_EXPIRED 0x0020 /* Ignore expired keys (intention to replace) */ | ||
120 | 121 | ||
121 | int (*iterator)(const void *object, void *iterator_data); | 122 | int (*iterator)(const void *object, void *iterator_data); |
122 | 123 | ||
diff --git a/security/keys/keyctl.c b/security/keys/keyctl.c index eff88a5f5d40..4743d71e4aa6 100644 --- a/security/keys/keyctl.c +++ b/security/keys/keyctl.c | |||
@@ -26,6 +26,8 @@ | |||
26 | #include <asm/uaccess.h> | 26 | #include <asm/uaccess.h> |
27 | #include "internal.h" | 27 | #include "internal.h" |
28 | 28 | ||
29 | #define KEY_MAX_DESC_SIZE 4096 | ||
30 | |||
29 | static int key_get_type_from_user(char *type, | 31 | static int key_get_type_from_user(char *type, |
30 | const char __user *_type, | 32 | const char __user *_type, |
31 | unsigned len) | 33 | unsigned len) |
@@ -78,7 +80,7 @@ SYSCALL_DEFINE5(add_key, const char __user *, _type, | |||
78 | 80 | ||
79 | description = NULL; | 81 | description = NULL; |
80 | if (_description) { | 82 | if (_description) { |
81 | description = strndup_user(_description, PAGE_SIZE); | 83 | description = strndup_user(_description, KEY_MAX_DESC_SIZE); |
82 | if (IS_ERR(description)) { | 84 | if (IS_ERR(description)) { |
83 | ret = PTR_ERR(description); | 85 | ret = PTR_ERR(description); |
84 | goto error; | 86 | goto error; |
@@ -177,7 +179,7 @@ SYSCALL_DEFINE4(request_key, const char __user *, _type, | |||
177 | goto error; | 179 | goto error; |
178 | 180 | ||
179 | /* pull the description into kernel space */ | 181 | /* pull the description into kernel space */ |
180 | description = strndup_user(_description, PAGE_SIZE); | 182 | description = strndup_user(_description, KEY_MAX_DESC_SIZE); |
181 | if (IS_ERR(description)) { | 183 | if (IS_ERR(description)) { |
182 | ret = PTR_ERR(description); | 184 | ret = PTR_ERR(description); |
183 | goto error; | 185 | goto error; |
@@ -287,7 +289,7 @@ long keyctl_join_session_keyring(const char __user *_name) | |||
287 | /* fetch the name from userspace */ | 289 | /* fetch the name from userspace */ |
288 | name = NULL; | 290 | name = NULL; |
289 | if (_name) { | 291 | if (_name) { |
290 | name = strndup_user(_name, PAGE_SIZE); | 292 | name = strndup_user(_name, KEY_MAX_DESC_SIZE); |
291 | if (IS_ERR(name)) { | 293 | if (IS_ERR(name)) { |
292 | ret = PTR_ERR(name); | 294 | ret = PTR_ERR(name); |
293 | goto error; | 295 | goto error; |
@@ -562,8 +564,9 @@ long keyctl_describe_key(key_serial_t keyid, | |||
562 | { | 564 | { |
563 | struct key *key, *instkey; | 565 | struct key *key, *instkey; |
564 | key_ref_t key_ref; | 566 | key_ref_t key_ref; |
565 | char *tmpbuf; | 567 | char *infobuf; |
566 | long ret; | 568 | long ret; |
569 | int desclen, infolen; | ||
567 | 570 | ||
568 | key_ref = lookup_user_key(keyid, KEY_LOOKUP_PARTIAL, KEY_NEED_VIEW); | 571 | key_ref = lookup_user_key(keyid, KEY_LOOKUP_PARTIAL, KEY_NEED_VIEW); |
569 | if (IS_ERR(key_ref)) { | 572 | if (IS_ERR(key_ref)) { |
@@ -586,38 +589,31 @@ long keyctl_describe_key(key_serial_t keyid, | |||
586 | } | 589 | } |
587 | 590 | ||
588 | okay: | 591 | okay: |
589 | /* calculate how much description we're going to return */ | ||
590 | ret = -ENOMEM; | ||
591 | tmpbuf = kmalloc(PAGE_SIZE, GFP_KERNEL); | ||
592 | if (!tmpbuf) | ||
593 | goto error2; | ||
594 | |||
595 | key = key_ref_to_ptr(key_ref); | 592 | key = key_ref_to_ptr(key_ref); |
593 | desclen = strlen(key->description); | ||
596 | 594 | ||
597 | ret = snprintf(tmpbuf, PAGE_SIZE - 1, | 595 | /* calculate how much information we're going to return */ |
598 | "%s;%d;%d;%08x;%s", | 596 | ret = -ENOMEM; |
599 | key->type->name, | 597 | infobuf = kasprintf(GFP_KERNEL, |
600 | from_kuid_munged(current_user_ns(), key->uid), | 598 | "%s;%d;%d;%08x;", |
601 | from_kgid_munged(current_user_ns(), key->gid), | 599 | key->type->name, |
602 | key->perm, | 600 | from_kuid_munged(current_user_ns(), key->uid), |
603 | key->description ?: ""); | 601 | from_kgid_munged(current_user_ns(), key->gid), |
604 | 602 | key->perm); | |
605 | /* include a NUL char at the end of the data */ | 603 | if (!infobuf) |
606 | if (ret > PAGE_SIZE - 1) | 604 | goto error2; |
607 | ret = PAGE_SIZE - 1; | 605 | infolen = strlen(infobuf); |
608 | tmpbuf[ret] = 0; | 606 | ret = infolen + desclen + 1; |
609 | ret++; | ||
610 | 607 | ||
611 | /* consider returning the data */ | 608 | /* consider returning the data */ |
612 | if (buffer && buflen > 0) { | 609 | if (buffer && buflen >= ret) { |
613 | if (buflen > ret) | 610 | if (copy_to_user(buffer, infobuf, infolen) != 0 || |
614 | buflen = ret; | 611 | copy_to_user(buffer + infolen, key->description, |
615 | 612 | desclen + 1) != 0) | |
616 | if (copy_to_user(buffer, tmpbuf, buflen) != 0) | ||
617 | ret = -EFAULT; | 613 | ret = -EFAULT; |
618 | } | 614 | } |
619 | 615 | ||
620 | kfree(tmpbuf); | 616 | kfree(infobuf); |
621 | error2: | 617 | error2: |
622 | key_ref_put(key_ref); | 618 | key_ref_put(key_ref); |
623 | error: | 619 | error: |
@@ -649,7 +645,7 @@ long keyctl_keyring_search(key_serial_t ringid, | |||
649 | if (ret < 0) | 645 | if (ret < 0) |
650 | goto error; | 646 | goto error; |
651 | 647 | ||
652 | description = strndup_user(_description, PAGE_SIZE); | 648 | description = strndup_user(_description, KEY_MAX_DESC_SIZE); |
653 | if (IS_ERR(description)) { | 649 | if (IS_ERR(description)) { |
654 | ret = PTR_ERR(description); | 650 | ret = PTR_ERR(description); |
655 | goto error; | 651 | goto error; |
diff --git a/security/keys/keyring.c b/security/keys/keyring.c index 8177010174f7..e72548b5897e 100644 --- a/security/keys/keyring.c +++ b/security/keys/keyring.c | |||
@@ -546,7 +546,8 @@ static int keyring_search_iterator(const void *object, void *iterator_data) | |||
546 | } | 546 | } |
547 | 547 | ||
548 | if (key->expiry && ctx->now.tv_sec >= key->expiry) { | 548 | if (key->expiry && ctx->now.tv_sec >= key->expiry) { |
549 | ctx->result = ERR_PTR(-EKEYEXPIRED); | 549 | if (!(ctx->flags & KEYRING_SEARCH_SKIP_EXPIRED)) |
550 | ctx->result = ERR_PTR(-EKEYEXPIRED); | ||
550 | kleave(" = %d [expire]", ctx->skipped_ret); | 551 | kleave(" = %d [expire]", ctx->skipped_ret); |
551 | goto skipped; | 552 | goto skipped; |
552 | } | 553 | } |
@@ -628,6 +629,10 @@ static bool search_nested_keyrings(struct key *keyring, | |||
628 | ctx->index_key.type->name, | 629 | ctx->index_key.type->name, |
629 | ctx->index_key.description); | 630 | ctx->index_key.description); |
630 | 631 | ||
632 | #define STATE_CHECKS (KEYRING_SEARCH_NO_STATE_CHECK | KEYRING_SEARCH_DO_STATE_CHECK) | ||
633 | BUG_ON((ctx->flags & STATE_CHECKS) == 0 || | ||
634 | (ctx->flags & STATE_CHECKS) == STATE_CHECKS); | ||
635 | |||
631 | if (ctx->index_key.description) | 636 | if (ctx->index_key.description) |
632 | ctx->index_key.desc_len = strlen(ctx->index_key.description); | 637 | ctx->index_key.desc_len = strlen(ctx->index_key.description); |
633 | 638 | ||
@@ -637,7 +642,6 @@ static bool search_nested_keyrings(struct key *keyring, | |||
637 | if (ctx->match_data.lookup_type == KEYRING_SEARCH_LOOKUP_ITERATE || | 642 | if (ctx->match_data.lookup_type == KEYRING_SEARCH_LOOKUP_ITERATE || |
638 | keyring_compare_object(keyring, &ctx->index_key)) { | 643 | keyring_compare_object(keyring, &ctx->index_key)) { |
639 | ctx->skipped_ret = 2; | 644 | ctx->skipped_ret = 2; |
640 | ctx->flags |= KEYRING_SEARCH_DO_STATE_CHECK; | ||
641 | switch (ctx->iterator(keyring_key_to_ptr(keyring), ctx)) { | 645 | switch (ctx->iterator(keyring_key_to_ptr(keyring), ctx)) { |
642 | case 1: | 646 | case 1: |
643 | goto found; | 647 | goto found; |
@@ -649,8 +653,6 @@ static bool search_nested_keyrings(struct key *keyring, | |||
649 | } | 653 | } |
650 | 654 | ||
651 | ctx->skipped_ret = 0; | 655 | ctx->skipped_ret = 0; |
652 | if (ctx->flags & KEYRING_SEARCH_NO_STATE_CHECK) | ||
653 | ctx->flags &= ~KEYRING_SEARCH_DO_STATE_CHECK; | ||
654 | 656 | ||
655 | /* Start processing a new keyring */ | 657 | /* Start processing a new keyring */ |
656 | descend_to_keyring: | 658 | descend_to_keyring: |
diff --git a/security/keys/request_key.c b/security/keys/request_key.c index bb4337c7ae1b..0c7aea4dea54 100644 --- a/security/keys/request_key.c +++ b/security/keys/request_key.c | |||
@@ -516,6 +516,8 @@ struct key *request_key_and_link(struct key_type *type, | |||
516 | .match_data.cmp = key_default_cmp, | 516 | .match_data.cmp = key_default_cmp, |
517 | .match_data.raw_data = description, | 517 | .match_data.raw_data = description, |
518 | .match_data.lookup_type = KEYRING_SEARCH_LOOKUP_DIRECT, | 518 | .match_data.lookup_type = KEYRING_SEARCH_LOOKUP_DIRECT, |
519 | .flags = (KEYRING_SEARCH_DO_STATE_CHECK | | ||
520 | KEYRING_SEARCH_SKIP_EXPIRED), | ||
519 | }; | 521 | }; |
520 | struct key *key; | 522 | struct key *key; |
521 | key_ref_t key_ref; | 523 | key_ref_t key_ref; |
diff --git a/security/keys/request_key_auth.c b/security/keys/request_key_auth.c index 6639e2cb8853..5d672f7580dd 100644 --- a/security/keys/request_key_auth.c +++ b/security/keys/request_key_auth.c | |||
@@ -249,6 +249,7 @@ struct key *key_get_instantiation_authkey(key_serial_t target_id) | |||
249 | .match_data.cmp = key_default_cmp, | 249 | .match_data.cmp = key_default_cmp, |
250 | .match_data.raw_data = description, | 250 | .match_data.raw_data = description, |
251 | .match_data.lookup_type = KEYRING_SEARCH_LOOKUP_DIRECT, | 251 | .match_data.lookup_type = KEYRING_SEARCH_LOOKUP_DIRECT, |
252 | .flags = KEYRING_SEARCH_DO_STATE_CHECK, | ||
252 | }; | 253 | }; |
253 | struct key *authkey; | 254 | struct key *authkey; |
254 | key_ref_t authkey_ref; | 255 | key_ref_t authkey_ref; |
diff --git a/sound/core/pcm.c b/sound/core/pcm.c index 42ded997b223..c6ff94ab1ad6 100644 --- a/sound/core/pcm.c +++ b/sound/core/pcm.c | |||
@@ -216,6 +216,8 @@ static char *snd_pcm_format_names[] = { | |||
216 | FORMAT(DSD_U8), | 216 | FORMAT(DSD_U8), |
217 | FORMAT(DSD_U16_LE), | 217 | FORMAT(DSD_U16_LE), |
218 | FORMAT(DSD_U32_LE), | 218 | FORMAT(DSD_U32_LE), |
219 | FORMAT(DSD_U16_BE), | ||
220 | FORMAT(DSD_U32_BE), | ||
219 | }; | 221 | }; |
220 | 222 | ||
221 | const char *snd_pcm_format_name(snd_pcm_format_t format) | 223 | const char *snd_pcm_format_name(snd_pcm_format_t format) |
diff --git a/sound/core/pcm_misc.c b/sound/core/pcm_misc.c index ae7a0feb3b76..ebe8444de6c6 100644 --- a/sound/core/pcm_misc.c +++ b/sound/core/pcm_misc.c | |||
@@ -152,6 +152,14 @@ static struct pcm_format_data pcm_formats[(INT)SNDRV_PCM_FORMAT_LAST+1] = { | |||
152 | .width = 32, .phys = 32, .le = 1, .signd = 0, | 152 | .width = 32, .phys = 32, .le = 1, .signd = 0, |
153 | .silence = { 0x69, 0x69, 0x69, 0x69 }, | 153 | .silence = { 0x69, 0x69, 0x69, 0x69 }, |
154 | }, | 154 | }, |
155 | [SNDRV_PCM_FORMAT_DSD_U16_BE] = { | ||
156 | .width = 16, .phys = 16, .le = 0, .signd = 0, | ||
157 | .silence = { 0x69, 0x69 }, | ||
158 | }, | ||
159 | [SNDRV_PCM_FORMAT_DSD_U32_BE] = { | ||
160 | .width = 32, .phys = 32, .le = 0, .signd = 0, | ||
161 | .silence = { 0x69, 0x69, 0x69, 0x69 }, | ||
162 | }, | ||
155 | /* FIXME: the following three formats are not defined properly yet */ | 163 | /* FIXME: the following three formats are not defined properly yet */ |
156 | [SNDRV_PCM_FORMAT_MPEG] = { | 164 | [SNDRV_PCM_FORMAT_MPEG] = { |
157 | .le = -1, .signd = -1, | 165 | .le = -1, .signd = -1, |
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c index 16660f312043..48b6c5a3884f 100644 --- a/sound/pci/hda/hda_intel.c +++ b/sound/pci/hda/hda_intel.c | |||
@@ -298,7 +298,8 @@ enum { | |||
298 | 298 | ||
299 | /* quirks for ATI/AMD HDMI */ | 299 | /* quirks for ATI/AMD HDMI */ |
300 | #define AZX_DCAPS_PRESET_ATI_HDMI \ | 300 | #define AZX_DCAPS_PRESET_ATI_HDMI \ |
301 | (AZX_DCAPS_NO_TCSEL | AZX_DCAPS_SYNC_WRITE | AZX_DCAPS_POSFIX_LPIB) | 301 | (AZX_DCAPS_NO_TCSEL | AZX_DCAPS_SYNC_WRITE | AZX_DCAPS_POSFIX_LPIB|\ |
302 | AZX_DCAPS_NO_MSI64) | ||
302 | 303 | ||
303 | /* quirks for Nvidia */ | 304 | /* quirks for Nvidia */ |
304 | #define AZX_DCAPS_PRESET_NVIDIA \ | 305 | #define AZX_DCAPS_PRESET_NVIDIA \ |
@@ -1486,6 +1487,7 @@ static int azx_first_init(struct azx *chip) | |||
1486 | struct snd_card *card = chip->card; | 1487 | struct snd_card *card = chip->card; |
1487 | int err; | 1488 | int err; |
1488 | unsigned short gcap; | 1489 | unsigned short gcap; |
1490 | unsigned int dma_bits = 64; | ||
1489 | 1491 | ||
1490 | #if BITS_PER_LONG != 64 | 1492 | #if BITS_PER_LONG != 64 |
1491 | /* Fix up base address on ULI M5461 */ | 1493 | /* Fix up base address on ULI M5461 */ |
@@ -1509,9 +1511,14 @@ static int azx_first_init(struct azx *chip) | |||
1509 | return -ENXIO; | 1511 | return -ENXIO; |
1510 | } | 1512 | } |
1511 | 1513 | ||
1512 | if (chip->msi) | 1514 | if (chip->msi) { |
1515 | if (chip->driver_caps & AZX_DCAPS_NO_MSI64) { | ||
1516 | dev_dbg(card->dev, "Disabling 64bit MSI\n"); | ||
1517 | pci->no_64bit_msi = true; | ||
1518 | } | ||
1513 | if (pci_enable_msi(pci) < 0) | 1519 | if (pci_enable_msi(pci) < 0) |
1514 | chip->msi = 0; | 1520 | chip->msi = 0; |
1521 | } | ||
1515 | 1522 | ||
1516 | if (azx_acquire_irq(chip, 0) < 0) | 1523 | if (azx_acquire_irq(chip, 0) < 0) |
1517 | return -EBUSY; | 1524 | return -EBUSY; |
@@ -1522,9 +1529,14 @@ static int azx_first_init(struct azx *chip) | |||
1522 | gcap = azx_readw(chip, GCAP); | 1529 | gcap = azx_readw(chip, GCAP); |
1523 | dev_dbg(card->dev, "chipset global capabilities = 0x%x\n", gcap); | 1530 | dev_dbg(card->dev, "chipset global capabilities = 0x%x\n", gcap); |
1524 | 1531 | ||
1532 | /* AMD devices support 40 or 48bit DMA, take the safe one */ | ||
1533 | if (chip->pci->vendor == PCI_VENDOR_ID_AMD) | ||
1534 | dma_bits = 40; | ||
1535 | |||
1525 | /* disable SB600 64bit support for safety */ | 1536 | /* disable SB600 64bit support for safety */ |
1526 | if (chip->pci->vendor == PCI_VENDOR_ID_ATI) { | 1537 | if (chip->pci->vendor == PCI_VENDOR_ID_ATI) { |
1527 | struct pci_dev *p_smbus; | 1538 | struct pci_dev *p_smbus; |
1539 | dma_bits = 40; | ||
1528 | p_smbus = pci_get_device(PCI_VENDOR_ID_ATI, | 1540 | p_smbus = pci_get_device(PCI_VENDOR_ID_ATI, |
1529 | PCI_DEVICE_ID_ATI_SBX00_SMBUS, | 1541 | PCI_DEVICE_ID_ATI_SBX00_SMBUS, |
1530 | NULL); | 1542 | NULL); |
@@ -1554,9 +1566,11 @@ static int azx_first_init(struct azx *chip) | |||
1554 | } | 1566 | } |
1555 | 1567 | ||
1556 | /* allow 64bit DMA address if supported by H/W */ | 1568 | /* allow 64bit DMA address if supported by H/W */ |
1557 | if ((gcap & AZX_GCAP_64OK) && !pci_set_dma_mask(pci, DMA_BIT_MASK(64))) | 1569 | if (!(gcap & AZX_GCAP_64OK)) |
1558 | pci_set_consistent_dma_mask(pci, DMA_BIT_MASK(64)); | 1570 | dma_bits = 32; |
1559 | else { | 1571 | if (!pci_set_dma_mask(pci, DMA_BIT_MASK(dma_bits))) { |
1572 | pci_set_consistent_dma_mask(pci, DMA_BIT_MASK(dma_bits)); | ||
1573 | } else { | ||
1560 | pci_set_dma_mask(pci, DMA_BIT_MASK(32)); | 1574 | pci_set_dma_mask(pci, DMA_BIT_MASK(32)); |
1561 | pci_set_consistent_dma_mask(pci, DMA_BIT_MASK(32)); | 1575 | pci_set_consistent_dma_mask(pci, DMA_BIT_MASK(32)); |
1562 | } | 1576 | } |
diff --git a/sound/pci/hda/hda_priv.h b/sound/pci/hda/hda_priv.h index 949cd437eeb2..5016014e57f2 100644 --- a/sound/pci/hda/hda_priv.h +++ b/sound/pci/hda/hda_priv.h | |||
@@ -171,6 +171,7 @@ enum { SDI0, SDI1, SDI2, SDI3, SDO0, SDO1, SDO2, SDO3 }; | |||
171 | #define AZX_DCAPS_PM_RUNTIME (1 << 26) /* runtime PM support */ | 171 | #define AZX_DCAPS_PM_RUNTIME (1 << 26) /* runtime PM support */ |
172 | #define AZX_DCAPS_I915_POWERWELL (1 << 27) /* HSW i915 powerwell support */ | 172 | #define AZX_DCAPS_I915_POWERWELL (1 << 27) /* HSW i915 powerwell support */ |
173 | #define AZX_DCAPS_CORBRP_SELF_CLEAR (1 << 28) /* CORBRP clears itself after reset */ | 173 | #define AZX_DCAPS_CORBRP_SELF_CLEAR (1 << 28) /* CORBRP clears itself after reset */ |
174 | #define AZX_DCAPS_NO_MSI64 (1 << 29) /* Stick to 32-bit MSIs */ | ||
174 | 175 | ||
175 | /* HD Audio class code */ | 176 | /* HD Audio class code */ |
176 | #define PCI_CLASS_MULTIMEDIA_HD_AUDIO 0x0403 | 177 | #define PCI_CLASS_MULTIMEDIA_HD_AUDIO 0x0403 |
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 172395465e8a..b118a5be18df 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c | |||
@@ -4520,6 +4520,8 @@ static const struct hda_fixup alc269_fixups[] = { | |||
4520 | [ALC269_FIXUP_HEADSET_MODE] = { | 4520 | [ALC269_FIXUP_HEADSET_MODE] = { |
4521 | .type = HDA_FIXUP_FUNC, | 4521 | .type = HDA_FIXUP_FUNC, |
4522 | .v.func = alc_fixup_headset_mode, | 4522 | .v.func = alc_fixup_headset_mode, |
4523 | .chained = true, | ||
4524 | .chain_id = ALC255_FIXUP_DELL_WMI_MIC_MUTE_LED | ||
4523 | }, | 4525 | }, |
4524 | [ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC] = { | 4526 | [ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC] = { |
4525 | .type = HDA_FIXUP_FUNC, | 4527 | .type = HDA_FIXUP_FUNC, |
@@ -4709,6 +4711,8 @@ static const struct hda_fixup alc269_fixups[] = { | |||
4709 | [ALC255_FIXUP_HEADSET_MODE] = { | 4711 | [ALC255_FIXUP_HEADSET_MODE] = { |
4710 | .type = HDA_FIXUP_FUNC, | 4712 | .type = HDA_FIXUP_FUNC, |
4711 | .v.func = alc_fixup_headset_mode_alc255, | 4713 | .v.func = alc_fixup_headset_mode_alc255, |
4714 | .chained = true, | ||
4715 | .chain_id = ALC255_FIXUP_DELL_WMI_MIC_MUTE_LED | ||
4712 | }, | 4716 | }, |
4713 | [ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC] = { | 4717 | [ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC] = { |
4714 | .type = HDA_FIXUP_FUNC, | 4718 | .type = HDA_FIXUP_FUNC, |
@@ -4744,8 +4748,6 @@ static const struct hda_fixup alc269_fixups[] = { | |||
4744 | [ALC255_FIXUP_DELL_WMI_MIC_MUTE_LED] = { | 4748 | [ALC255_FIXUP_DELL_WMI_MIC_MUTE_LED] = { |
4745 | .type = HDA_FIXUP_FUNC, | 4749 | .type = HDA_FIXUP_FUNC, |
4746 | .v.func = alc_fixup_dell_wmi, | 4750 | .v.func = alc_fixup_dell_wmi, |
4747 | .chained_before = true, | ||
4748 | .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE | ||
4749 | }, | 4751 | }, |
4750 | [ALC282_FIXUP_ASPIRE_V5_PINS] = { | 4752 | [ALC282_FIXUP_ASPIRE_V5_PINS] = { |
4751 | .type = HDA_FIXUP_PINS, | 4753 | .type = HDA_FIXUP_PINS, |
@@ -4783,13 +4785,13 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { | |||
4783 | SND_PCI_QUIRK(0x1028, 0x05f4, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE), | 4785 | SND_PCI_QUIRK(0x1028, 0x05f4, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE), |
4784 | SND_PCI_QUIRK(0x1028, 0x05f5, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE), | 4786 | SND_PCI_QUIRK(0x1028, 0x05f5, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE), |
4785 | SND_PCI_QUIRK(0x1028, 0x05f6, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE), | 4787 | SND_PCI_QUIRK(0x1028, 0x05f6, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE), |
4786 | SND_PCI_QUIRK(0x1028, 0x0610, "Dell", ALC255_FIXUP_DELL_WMI_MIC_MUTE_LED), | ||
4787 | SND_PCI_QUIRK(0x1028, 0x0615, "Dell Vostro 5470", ALC290_FIXUP_SUBWOOFER_HSJACK), | 4788 | SND_PCI_QUIRK(0x1028, 0x0615, "Dell Vostro 5470", ALC290_FIXUP_SUBWOOFER_HSJACK), |
4788 | SND_PCI_QUIRK(0x1028, 0x0616, "Dell Vostro 5470", ALC290_FIXUP_SUBWOOFER_HSJACK), | 4789 | SND_PCI_QUIRK(0x1028, 0x0616, "Dell Vostro 5470", ALC290_FIXUP_SUBWOOFER_HSJACK), |
4789 | SND_PCI_QUIRK(0x1028, 0x061f, "Dell", ALC255_FIXUP_DELL_WMI_MIC_MUTE_LED), | ||
4790 | SND_PCI_QUIRK(0x1028, 0x0638, "Dell Inspiron 5439", ALC290_FIXUP_MONO_SPEAKERS_HSJACK), | 4790 | SND_PCI_QUIRK(0x1028, 0x0638, "Dell Inspiron 5439", ALC290_FIXUP_MONO_SPEAKERS_HSJACK), |
4791 | SND_PCI_QUIRK(0x1028, 0x064a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE), | 4791 | SND_PCI_QUIRK(0x1028, 0x064a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE), |
4792 | SND_PCI_QUIRK(0x1028, 0x064b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE), | 4792 | SND_PCI_QUIRK(0x1028, 0x064b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE), |
4793 | SND_PCI_QUIRK(0x1028, 0x06d9, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE), | ||
4794 | SND_PCI_QUIRK(0x1028, 0x06da, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE), | ||
4793 | SND_PCI_QUIRK(0x1028, 0x164a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE), | 4795 | SND_PCI_QUIRK(0x1028, 0x164a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE), |
4794 | SND_PCI_QUIRK(0x1028, 0x164b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE), | 4796 | SND_PCI_QUIRK(0x1028, 0x164b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE), |
4795 | SND_PCI_QUIRK(0x103c, 0x1586, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC2), | 4797 | SND_PCI_QUIRK(0x103c, 0x1586, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC2), |
@@ -4818,7 +4820,6 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { | |||
4818 | SND_PCI_QUIRK(0x103c, 0x221b, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED), | 4820 | SND_PCI_QUIRK(0x103c, 0x221b, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED), |
4819 | SND_PCI_QUIRK(0x103c, 0x2221, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED), | 4821 | SND_PCI_QUIRK(0x103c, 0x2221, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED), |
4820 | SND_PCI_QUIRK(0x103c, 0x2225, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED), | 4822 | SND_PCI_QUIRK(0x103c, 0x2225, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED), |
4821 | SND_PCI_QUIRK(0x103c, 0x2246, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED), | ||
4822 | SND_PCI_QUIRK(0x103c, 0x2253, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED), | 4823 | SND_PCI_QUIRK(0x103c, 0x2253, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED), |
4823 | SND_PCI_QUIRK(0x103c, 0x2254, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED), | 4824 | SND_PCI_QUIRK(0x103c, 0x2254, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED), |
4824 | SND_PCI_QUIRK(0x103c, 0x2255, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED), | 4825 | SND_PCI_QUIRK(0x103c, 0x2255, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED), |
diff --git a/sound/soc/codecs/cs42l51-i2c.c b/sound/soc/codecs/cs42l51-i2c.c index cee51ae177c1..c40428f25ba5 100644 --- a/sound/soc/codecs/cs42l51-i2c.c +++ b/sound/soc/codecs/cs42l51-i2c.c | |||
@@ -46,6 +46,7 @@ static struct i2c_driver cs42l51_i2c_driver = { | |||
46 | .driver = { | 46 | .driver = { |
47 | .name = "cs42l51", | 47 | .name = "cs42l51", |
48 | .owner = THIS_MODULE, | 48 | .owner = THIS_MODULE, |
49 | .of_match_table = cs42l51_of_match, | ||
49 | }, | 50 | }, |
50 | .probe = cs42l51_i2c_probe, | 51 | .probe = cs42l51_i2c_probe, |
51 | .remove = cs42l51_i2c_remove, | 52 | .remove = cs42l51_i2c_remove, |
diff --git a/sound/soc/codecs/cs42l51.c b/sound/soc/codecs/cs42l51.c index 09488d97de60..669c38fc3034 100644 --- a/sound/soc/codecs/cs42l51.c +++ b/sound/soc/codecs/cs42l51.c | |||
@@ -558,11 +558,13 @@ error: | |||
558 | } | 558 | } |
559 | EXPORT_SYMBOL_GPL(cs42l51_probe); | 559 | EXPORT_SYMBOL_GPL(cs42l51_probe); |
560 | 560 | ||
561 | static const struct of_device_id cs42l51_of_match[] = { | 561 | const struct of_device_id cs42l51_of_match[] = { |
562 | { .compatible = "cirrus,cs42l51", }, | 562 | { .compatible = "cirrus,cs42l51", }, |
563 | { } | 563 | { } |
564 | }; | 564 | }; |
565 | MODULE_DEVICE_TABLE(of, cs42l51_of_match); | 565 | MODULE_DEVICE_TABLE(of, cs42l51_of_match); |
566 | EXPORT_SYMBOL_GPL(cs42l51_of_match); | ||
567 | |||
566 | MODULE_AUTHOR("Arnaud Patard <arnaud.patard@rtp-net.org>"); | 568 | MODULE_AUTHOR("Arnaud Patard <arnaud.patard@rtp-net.org>"); |
567 | MODULE_DESCRIPTION("Cirrus Logic CS42L51 ALSA SoC Codec Driver"); | 569 | MODULE_DESCRIPTION("Cirrus Logic CS42L51 ALSA SoC Codec Driver"); |
568 | MODULE_LICENSE("GPL"); | 570 | MODULE_LICENSE("GPL"); |
diff --git a/sound/soc/codecs/cs42l51.h b/sound/soc/codecs/cs42l51.h index 8c55bf384bc6..0ca805492ac4 100644 --- a/sound/soc/codecs/cs42l51.h +++ b/sound/soc/codecs/cs42l51.h | |||
@@ -22,6 +22,7 @@ struct device; | |||
22 | 22 | ||
23 | extern const struct regmap_config cs42l51_regmap; | 23 | extern const struct regmap_config cs42l51_regmap; |
24 | int cs42l51_probe(struct device *dev, struct regmap *regmap); | 24 | int cs42l51_probe(struct device *dev, struct regmap *regmap); |
25 | extern const struct of_device_id cs42l51_of_match[]; | ||
25 | 26 | ||
26 | #define CS42L51_CHIP_ID 0x1B | 27 | #define CS42L51_CHIP_ID 0x1B |
27 | #define CS42L51_CHIP_REV_A 0x00 | 28 | #define CS42L51_CHIP_REV_A 0x00 |
diff --git a/sound/soc/codecs/es8328-i2c.c b/sound/soc/codecs/es8328-i2c.c index aae410d122ee..2d05b5d3a6ce 100644 --- a/sound/soc/codecs/es8328-i2c.c +++ b/sound/soc/codecs/es8328-i2c.c | |||
@@ -19,7 +19,7 @@ | |||
19 | #include "es8328.h" | 19 | #include "es8328.h" |
20 | 20 | ||
21 | static const struct i2c_device_id es8328_id[] = { | 21 | static const struct i2c_device_id es8328_id[] = { |
22 | { "everest,es8328", 0 }, | 22 | { "es8328", 0 }, |
23 | { } | 23 | { } |
24 | }; | 24 | }; |
25 | MODULE_DEVICE_TABLE(i2c, es8328_id); | 25 | MODULE_DEVICE_TABLE(i2c, es8328_id); |
diff --git a/sound/soc/codecs/max98090.c b/sound/soc/codecs/max98090.c index d519294f57c7..1229554f1464 100644 --- a/sound/soc/codecs/max98090.c +++ b/sound/soc/codecs/max98090.c | |||
@@ -1941,13 +1941,13 @@ static int max98090_dai_set_sysclk(struct snd_soc_dai *dai, | |||
1941 | * 0x02 (when master clk is 20MHz to 40MHz).. | 1941 | * 0x02 (when master clk is 20MHz to 40MHz).. |
1942 | * 0x03 (when master clk is 40MHz to 60MHz).. | 1942 | * 0x03 (when master clk is 40MHz to 60MHz).. |
1943 | */ | 1943 | */ |
1944 | if ((freq >= 10000000) && (freq < 20000000)) { | 1944 | if ((freq >= 10000000) && (freq <= 20000000)) { |
1945 | snd_soc_write(codec, M98090_REG_SYSTEM_CLOCK, | 1945 | snd_soc_write(codec, M98090_REG_SYSTEM_CLOCK, |
1946 | M98090_PSCLK_DIV1); | 1946 | M98090_PSCLK_DIV1); |
1947 | } else if ((freq >= 20000000) && (freq < 40000000)) { | 1947 | } else if ((freq > 20000000) && (freq <= 40000000)) { |
1948 | snd_soc_write(codec, M98090_REG_SYSTEM_CLOCK, | 1948 | snd_soc_write(codec, M98090_REG_SYSTEM_CLOCK, |
1949 | M98090_PSCLK_DIV2); | 1949 | M98090_PSCLK_DIV2); |
1950 | } else if ((freq >= 40000000) && (freq < 60000000)) { | 1950 | } else if ((freq > 40000000) && (freq <= 60000000)) { |
1951 | snd_soc_write(codec, M98090_REG_SYSTEM_CLOCK, | 1951 | snd_soc_write(codec, M98090_REG_SYSTEM_CLOCK, |
1952 | M98090_PSCLK_DIV4); | 1952 | M98090_PSCLK_DIV4); |
1953 | } else { | 1953 | } else { |
diff --git a/sound/soc/codecs/rt5645.c b/sound/soc/codecs/rt5645.c index 3fb83bf09768..d16331e0b64d 100644 --- a/sound/soc/codecs/rt5645.c +++ b/sound/soc/codecs/rt5645.c | |||
@@ -139,6 +139,7 @@ static const struct reg_default rt5645_reg[] = { | |||
139 | { 0x76, 0x000a }, | 139 | { 0x76, 0x000a }, |
140 | { 0x77, 0x0c00 }, | 140 | { 0x77, 0x0c00 }, |
141 | { 0x78, 0x0000 }, | 141 | { 0x78, 0x0000 }, |
142 | { 0x79, 0x0123 }, | ||
142 | { 0x80, 0x0000 }, | 143 | { 0x80, 0x0000 }, |
143 | { 0x81, 0x0000 }, | 144 | { 0x81, 0x0000 }, |
144 | { 0x82, 0x0000 }, | 145 | { 0x82, 0x0000 }, |
@@ -334,6 +335,7 @@ static bool rt5645_readable_register(struct device *dev, unsigned int reg) | |||
334 | case RT5645_DMIC_CTRL2: | 335 | case RT5645_DMIC_CTRL2: |
335 | case RT5645_TDM_CTRL_1: | 336 | case RT5645_TDM_CTRL_1: |
336 | case RT5645_TDM_CTRL_2: | 337 | case RT5645_TDM_CTRL_2: |
338 | case RT5645_TDM_CTRL_3: | ||
337 | case RT5645_GLB_CLK: | 339 | case RT5645_GLB_CLK: |
338 | case RT5645_PLL_CTRL1: | 340 | case RT5645_PLL_CTRL1: |
339 | case RT5645_PLL_CTRL2: | 341 | case RT5645_PLL_CTRL2: |
diff --git a/sound/soc/codecs/rt5670.c b/sound/soc/codecs/rt5670.c index ba9d9b4d4857..9bd8b4f63303 100644 --- a/sound/soc/codecs/rt5670.c +++ b/sound/soc/codecs/rt5670.c | |||
@@ -100,18 +100,18 @@ static const struct reg_default rt5670_reg[] = { | |||
100 | { 0x4c, 0x5380 }, | 100 | { 0x4c, 0x5380 }, |
101 | { 0x4f, 0x0073 }, | 101 | { 0x4f, 0x0073 }, |
102 | { 0x52, 0x00d3 }, | 102 | { 0x52, 0x00d3 }, |
103 | { 0x53, 0xf0f0 }, | 103 | { 0x53, 0xf000 }, |
104 | { 0x61, 0x0000 }, | 104 | { 0x61, 0x0000 }, |
105 | { 0x62, 0x0001 }, | 105 | { 0x62, 0x0001 }, |
106 | { 0x63, 0x00c3 }, | 106 | { 0x63, 0x00c3 }, |
107 | { 0x64, 0x0000 }, | 107 | { 0x64, 0x0000 }, |
108 | { 0x65, 0x0000 }, | 108 | { 0x65, 0x0001 }, |
109 | { 0x66, 0x0000 }, | 109 | { 0x66, 0x0000 }, |
110 | { 0x6f, 0x8000 }, | 110 | { 0x6f, 0x8000 }, |
111 | { 0x70, 0x8000 }, | 111 | { 0x70, 0x8000 }, |
112 | { 0x71, 0x8000 }, | 112 | { 0x71, 0x8000 }, |
113 | { 0x72, 0x8000 }, | 113 | { 0x72, 0x8000 }, |
114 | { 0x73, 0x1110 }, | 114 | { 0x73, 0x7770 }, |
115 | { 0x74, 0x0e00 }, | 115 | { 0x74, 0x0e00 }, |
116 | { 0x75, 0x1505 }, | 116 | { 0x75, 0x1505 }, |
117 | { 0x76, 0x0015 }, | 117 | { 0x76, 0x0015 }, |
@@ -125,21 +125,21 @@ static const struct reg_default rt5670_reg[] = { | |||
125 | { 0x83, 0x0000 }, | 125 | { 0x83, 0x0000 }, |
126 | { 0x84, 0x0000 }, | 126 | { 0x84, 0x0000 }, |
127 | { 0x85, 0x0000 }, | 127 | { 0x85, 0x0000 }, |
128 | { 0x86, 0x0008 }, | 128 | { 0x86, 0x0004 }, |
129 | { 0x87, 0x0000 }, | 129 | { 0x87, 0x0000 }, |
130 | { 0x88, 0x0000 }, | 130 | { 0x88, 0x0000 }, |
131 | { 0x89, 0x0000 }, | 131 | { 0x89, 0x0000 }, |
132 | { 0x8a, 0x0000 }, | 132 | { 0x8a, 0x0000 }, |
133 | { 0x8b, 0x0000 }, | 133 | { 0x8b, 0x0000 }, |
134 | { 0x8c, 0x0007 }, | 134 | { 0x8c, 0x0003 }, |
135 | { 0x8d, 0x0000 }, | 135 | { 0x8d, 0x0000 }, |
136 | { 0x8e, 0x0004 }, | 136 | { 0x8e, 0x0004 }, |
137 | { 0x8f, 0x1100 }, | 137 | { 0x8f, 0x1100 }, |
138 | { 0x90, 0x0646 }, | 138 | { 0x90, 0x0646 }, |
139 | { 0x91, 0x0c06 }, | 139 | { 0x91, 0x0c06 }, |
140 | { 0x93, 0x0000 }, | 140 | { 0x93, 0x0000 }, |
141 | { 0x94, 0x0000 }, | 141 | { 0x94, 0x1270 }, |
142 | { 0x95, 0x0000 }, | 142 | { 0x95, 0x1000 }, |
143 | { 0x97, 0x0000 }, | 143 | { 0x97, 0x0000 }, |
144 | { 0x98, 0x0000 }, | 144 | { 0x98, 0x0000 }, |
145 | { 0x99, 0x0000 }, | 145 | { 0x99, 0x0000 }, |
@@ -150,11 +150,11 @@ static const struct reg_default rt5670_reg[] = { | |||
150 | { 0x9e, 0x0400 }, | 150 | { 0x9e, 0x0400 }, |
151 | { 0xae, 0x7000 }, | 151 | { 0xae, 0x7000 }, |
152 | { 0xaf, 0x0000 }, | 152 | { 0xaf, 0x0000 }, |
153 | { 0xb0, 0x6000 }, | 153 | { 0xb0, 0x7000 }, |
154 | { 0xb1, 0x0000 }, | 154 | { 0xb1, 0x0000 }, |
155 | { 0xb2, 0x0000 }, | 155 | { 0xb2, 0x0000 }, |
156 | { 0xb3, 0x001f }, | 156 | { 0xb3, 0x001f }, |
157 | { 0xb4, 0x2206 }, | 157 | { 0xb4, 0x220c }, |
158 | { 0xb5, 0x1f00 }, | 158 | { 0xb5, 0x1f00 }, |
159 | { 0xb6, 0x0000 }, | 159 | { 0xb6, 0x0000 }, |
160 | { 0xb7, 0x0000 }, | 160 | { 0xb7, 0x0000 }, |
@@ -171,25 +171,25 @@ static const struct reg_default rt5670_reg[] = { | |||
171 | { 0xcf, 0x1813 }, | 171 | { 0xcf, 0x1813 }, |
172 | { 0xd0, 0x0690 }, | 172 | { 0xd0, 0x0690 }, |
173 | { 0xd1, 0x1c17 }, | 173 | { 0xd1, 0x1c17 }, |
174 | { 0xd3, 0xb320 }, | 174 | { 0xd3, 0xa220 }, |
175 | { 0xd4, 0x0000 }, | 175 | { 0xd4, 0x0000 }, |
176 | { 0xd6, 0x0400 }, | 176 | { 0xd6, 0x0400 }, |
177 | { 0xd9, 0x0809 }, | 177 | { 0xd9, 0x0809 }, |
178 | { 0xda, 0x0000 }, | 178 | { 0xda, 0x0000 }, |
179 | { 0xdb, 0x0001 }, | 179 | { 0xdb, 0x0001 }, |
180 | { 0xdc, 0x0049 }, | 180 | { 0xdc, 0x0049 }, |
181 | { 0xdd, 0x0009 }, | 181 | { 0xdd, 0x0024 }, |
182 | { 0xe6, 0x8000 }, | 182 | { 0xe6, 0x8000 }, |
183 | { 0xe7, 0x0000 }, | 183 | { 0xe7, 0x0000 }, |
184 | { 0xec, 0xb300 }, | 184 | { 0xec, 0xa200 }, |
185 | { 0xed, 0x0000 }, | 185 | { 0xed, 0x0000 }, |
186 | { 0xee, 0xb300 }, | 186 | { 0xee, 0xa200 }, |
187 | { 0xef, 0x0000 }, | 187 | { 0xef, 0x0000 }, |
188 | { 0xf8, 0x0000 }, | 188 | { 0xf8, 0x0000 }, |
189 | { 0xf9, 0x0000 }, | 189 | { 0xf9, 0x0000 }, |
190 | { 0xfa, 0x8010 }, | 190 | { 0xfa, 0x8010 }, |
191 | { 0xfb, 0x0033 }, | 191 | { 0xfb, 0x0033 }, |
192 | { 0xfc, 0x0080 }, | 192 | { 0xfc, 0x0100 }, |
193 | }; | 193 | }; |
194 | 194 | ||
195 | static bool rt5670_volatile_register(struct device *dev, unsigned int reg) | 195 | static bool rt5670_volatile_register(struct device *dev, unsigned int reg) |
@@ -1877,6 +1877,10 @@ static const struct snd_soc_dapm_route rt5670_dapm_routes[] = { | |||
1877 | { "DAC1 MIXR", "DAC1 Switch", "DAC1 R Mux" }, | 1877 | { "DAC1 MIXR", "DAC1 Switch", "DAC1 R Mux" }, |
1878 | { "DAC1 MIXR", NULL, "DAC Stereo1 Filter" }, | 1878 | { "DAC1 MIXR", NULL, "DAC Stereo1 Filter" }, |
1879 | 1879 | ||
1880 | { "DAC Stereo1 Filter", NULL, "PLL1", is_sys_clk_from_pll }, | ||
1881 | { "DAC Mono Left Filter", NULL, "PLL1", is_sys_clk_from_pll }, | ||
1882 | { "DAC Mono Right Filter", NULL, "PLL1", is_sys_clk_from_pll }, | ||
1883 | |||
1880 | { "DAC MIX", NULL, "DAC1 MIXL" }, | 1884 | { "DAC MIX", NULL, "DAC1 MIXL" }, |
1881 | { "DAC MIX", NULL, "DAC1 MIXR" }, | 1885 | { "DAC MIX", NULL, "DAC1 MIXR" }, |
1882 | 1886 | ||
@@ -1926,14 +1930,10 @@ static const struct snd_soc_dapm_route rt5670_dapm_routes[] = { | |||
1926 | 1930 | ||
1927 | { "DAC L1", NULL, "DAC L1 Power" }, | 1931 | { "DAC L1", NULL, "DAC L1 Power" }, |
1928 | { "DAC L1", NULL, "Stereo DAC MIXL" }, | 1932 | { "DAC L1", NULL, "Stereo DAC MIXL" }, |
1929 | { "DAC L1", NULL, "PLL1", is_sys_clk_from_pll }, | ||
1930 | { "DAC R1", NULL, "DAC R1 Power" }, | 1933 | { "DAC R1", NULL, "DAC R1 Power" }, |
1931 | { "DAC R1", NULL, "Stereo DAC MIXR" }, | 1934 | { "DAC R1", NULL, "Stereo DAC MIXR" }, |
1932 | { "DAC R1", NULL, "PLL1", is_sys_clk_from_pll }, | ||
1933 | { "DAC L2", NULL, "Mono DAC MIXL" }, | 1935 | { "DAC L2", NULL, "Mono DAC MIXL" }, |
1934 | { "DAC L2", NULL, "PLL1", is_sys_clk_from_pll }, | ||
1935 | { "DAC R2", NULL, "Mono DAC MIXR" }, | 1936 | { "DAC R2", NULL, "Mono DAC MIXR" }, |
1936 | { "DAC R2", NULL, "PLL1", is_sys_clk_from_pll }, | ||
1937 | 1937 | ||
1938 | { "OUT MIXL", "BST1 Switch", "BST1" }, | 1938 | { "OUT MIXL", "BST1 Switch", "BST1" }, |
1939 | { "OUT MIXL", "INL Switch", "INL VOL" }, | 1939 | { "OUT MIXL", "INL Switch", "INL VOL" }, |
diff --git a/sound/soc/codecs/sgtl5000.c b/sound/soc/codecs/sgtl5000.c index 6bb77d76561b..dab9b15304af 100644 --- a/sound/soc/codecs/sgtl5000.c +++ b/sound/soc/codecs/sgtl5000.c | |||
@@ -1299,8 +1299,7 @@ static int sgtl5000_probe(struct snd_soc_codec *codec) | |||
1299 | 1299 | ||
1300 | /* enable small pop, introduce 400ms delay in turning off */ | 1300 | /* enable small pop, introduce 400ms delay in turning off */ |
1301 | snd_soc_update_bits(codec, SGTL5000_CHIP_REF_CTRL, | 1301 | snd_soc_update_bits(codec, SGTL5000_CHIP_REF_CTRL, |
1302 | SGTL5000_SMALL_POP, | 1302 | SGTL5000_SMALL_POP, 1); |
1303 | SGTL5000_SMALL_POP); | ||
1304 | 1303 | ||
1305 | /* disable short cut detector */ | 1304 | /* disable short cut detector */ |
1306 | snd_soc_write(codec, SGTL5000_CHIP_SHORT_CTRL, 0); | 1305 | snd_soc_write(codec, SGTL5000_CHIP_SHORT_CTRL, 0); |
diff --git a/sound/soc/codecs/sgtl5000.h b/sound/soc/codecs/sgtl5000.h index 2f8c88931f69..bd7a344bf8c5 100644 --- a/sound/soc/codecs/sgtl5000.h +++ b/sound/soc/codecs/sgtl5000.h | |||
@@ -275,7 +275,7 @@ | |||
275 | #define SGTL5000_BIAS_CTRL_MASK 0x000e | 275 | #define SGTL5000_BIAS_CTRL_MASK 0x000e |
276 | #define SGTL5000_BIAS_CTRL_SHIFT 1 | 276 | #define SGTL5000_BIAS_CTRL_SHIFT 1 |
277 | #define SGTL5000_BIAS_CTRL_WIDTH 3 | 277 | #define SGTL5000_BIAS_CTRL_WIDTH 3 |
278 | #define SGTL5000_SMALL_POP 0x0001 | 278 | #define SGTL5000_SMALL_POP 0 |
279 | 279 | ||
280 | /* | 280 | /* |
281 | * SGTL5000_CHIP_MIC_CTRL | 281 | * SGTL5000_CHIP_MIC_CTRL |
diff --git a/sound/soc/codecs/wm_adsp.c b/sound/soc/codecs/wm_adsp.c index f412a9911a75..67124783558a 100644 --- a/sound/soc/codecs/wm_adsp.c +++ b/sound/soc/codecs/wm_adsp.c | |||
@@ -1355,6 +1355,7 @@ static int wm_adsp_load_coeff(struct wm_adsp *dsp) | |||
1355 | file, blocks, pos - firmware->size); | 1355 | file, blocks, pos - firmware->size); |
1356 | 1356 | ||
1357 | out_fw: | 1357 | out_fw: |
1358 | regmap_async_complete(regmap); | ||
1358 | release_firmware(firmware); | 1359 | release_firmware(firmware); |
1359 | wm_adsp_buf_free(&buf_list); | 1360 | wm_adsp_buf_free(&buf_list); |
1360 | out: | 1361 | out: |
diff --git a/sound/soc/fsl/fsl_asrc.c b/sound/soc/fsl/fsl_asrc.c index ed866e9a2928..9deabdd2b1a2 100644 --- a/sound/soc/fsl/fsl_asrc.c +++ b/sound/soc/fsl/fsl_asrc.c | |||
@@ -684,12 +684,38 @@ static bool fsl_asrc_writeable_reg(struct device *dev, unsigned int reg) | |||
684 | } | 684 | } |
685 | } | 685 | } |
686 | 686 | ||
687 | static struct reg_default fsl_asrc_reg[] = { | ||
688 | { REG_ASRCTR, 0x0000 }, { REG_ASRIER, 0x0000 }, | ||
689 | { REG_ASRCNCR, 0x0000 }, { REG_ASRCFG, 0x0000 }, | ||
690 | { REG_ASRCSR, 0x0000 }, { REG_ASRCDR1, 0x0000 }, | ||
691 | { REG_ASRCDR2, 0x0000 }, { REG_ASRSTR, 0x0000 }, | ||
692 | { REG_ASRRA, 0x0000 }, { REG_ASRRB, 0x0000 }, | ||
693 | { REG_ASRRC, 0x0000 }, { REG_ASRPM1, 0x0000 }, | ||
694 | { REG_ASRPM2, 0x0000 }, { REG_ASRPM3, 0x0000 }, | ||
695 | { REG_ASRPM4, 0x0000 }, { REG_ASRPM5, 0x0000 }, | ||
696 | { REG_ASRTFR1, 0x0000 }, { REG_ASRCCR, 0x0000 }, | ||
697 | { REG_ASRDIA, 0x0000 }, { REG_ASRDOA, 0x0000 }, | ||
698 | { REG_ASRDIB, 0x0000 }, { REG_ASRDOB, 0x0000 }, | ||
699 | { REG_ASRDIC, 0x0000 }, { REG_ASRDOC, 0x0000 }, | ||
700 | { REG_ASRIDRHA, 0x0000 }, { REG_ASRIDRLA, 0x0000 }, | ||
701 | { REG_ASRIDRHB, 0x0000 }, { REG_ASRIDRLB, 0x0000 }, | ||
702 | { REG_ASRIDRHC, 0x0000 }, { REG_ASRIDRLC, 0x0000 }, | ||
703 | { REG_ASR76K, 0x0A47 }, { REG_ASR56K, 0x0DF3 }, | ||
704 | { REG_ASRMCRA, 0x0000 }, { REG_ASRFSTA, 0x0000 }, | ||
705 | { REG_ASRMCRB, 0x0000 }, { REG_ASRFSTB, 0x0000 }, | ||
706 | { REG_ASRMCRC, 0x0000 }, { REG_ASRFSTC, 0x0000 }, | ||
707 | { REG_ASRMCR1A, 0x0000 }, { REG_ASRMCR1B, 0x0000 }, | ||
708 | { REG_ASRMCR1C, 0x0000 }, | ||
709 | }; | ||
710 | |||
687 | static const struct regmap_config fsl_asrc_regmap_config = { | 711 | static const struct regmap_config fsl_asrc_regmap_config = { |
688 | .reg_bits = 32, | 712 | .reg_bits = 32, |
689 | .reg_stride = 4, | 713 | .reg_stride = 4, |
690 | .val_bits = 32, | 714 | .val_bits = 32, |
691 | 715 | ||
692 | .max_register = REG_ASRMCR1C, | 716 | .max_register = REG_ASRMCR1C, |
717 | .reg_defaults = fsl_asrc_reg, | ||
718 | .num_reg_defaults = ARRAY_SIZE(fsl_asrc_reg), | ||
693 | .readable_reg = fsl_asrc_readable_reg, | 719 | .readable_reg = fsl_asrc_readable_reg, |
694 | .volatile_reg = fsl_asrc_volatile_reg, | 720 | .volatile_reg = fsl_asrc_volatile_reg, |
695 | .writeable_reg = fsl_asrc_writeable_reg, | 721 | .writeable_reg = fsl_asrc_writeable_reg, |
diff --git a/sound/soc/rockchip/rockchip_i2s.c b/sound/soc/rockchip/rockchip_i2s.c index f373e37f8305..c74ba37f862c 100644 --- a/sound/soc/rockchip/rockchip_i2s.c +++ b/sound/soc/rockchip/rockchip_i2s.c | |||
@@ -154,8 +154,10 @@ static void rockchip_snd_rxctrl(struct rk_i2s_dev *i2s, int on) | |||
154 | while (val) { | 154 | while (val) { |
155 | regmap_read(i2s->regmap, I2S_CLR, &val); | 155 | regmap_read(i2s->regmap, I2S_CLR, &val); |
156 | retry--; | 156 | retry--; |
157 | if (!retry) | 157 | if (!retry) { |
158 | dev_warn(i2s->dev, "fail to clear\n"); | 158 | dev_warn(i2s->dev, "fail to clear\n"); |
159 | break; | ||
160 | } | ||
159 | } | 161 | } |
160 | } | 162 | } |
161 | } | 163 | } |
diff --git a/sound/soc/samsung/snow.c b/sound/soc/samsung/snow.c index 0acf5d0eed53..72118a77dd5b 100644 --- a/sound/soc/samsung/snow.c +++ b/sound/soc/samsung/snow.c | |||
@@ -110,6 +110,7 @@ static const struct of_device_id snow_of_match[] = { | |||
110 | { .compatible = "google,snow-audio-max98095", }, | 110 | { .compatible = "google,snow-audio-max98095", }, |
111 | {}, | 111 | {}, |
112 | }; | 112 | }; |
113 | MODULE_DEVICE_TABLE(of, snow_of_match); | ||
113 | 114 | ||
114 | static struct platform_driver snow_driver = { | 115 | static struct platform_driver snow_driver = { |
115 | .driver = { | 116 | .driver = { |
diff --git a/sound/soc/sh/fsi.c b/sound/soc/sh/fsi.c index 66fddec9543d..88e5df474ccf 100644 --- a/sound/soc/sh/fsi.c +++ b/sound/soc/sh/fsi.c | |||
@@ -1711,8 +1711,7 @@ static const struct snd_soc_dai_ops fsi_dai_ops = { | |||
1711 | static struct snd_pcm_hardware fsi_pcm_hardware = { | 1711 | static struct snd_pcm_hardware fsi_pcm_hardware = { |
1712 | .info = SNDRV_PCM_INFO_INTERLEAVED | | 1712 | .info = SNDRV_PCM_INFO_INTERLEAVED | |
1713 | SNDRV_PCM_INFO_MMAP | | 1713 | SNDRV_PCM_INFO_MMAP | |
1714 | SNDRV_PCM_INFO_MMAP_VALID | | 1714 | SNDRV_PCM_INFO_MMAP_VALID, |
1715 | SNDRV_PCM_INFO_PAUSE, | ||
1716 | .buffer_bytes_max = 64 * 1024, | 1715 | .buffer_bytes_max = 64 * 1024, |
1717 | .period_bytes_min = 32, | 1716 | .period_bytes_min = 32, |
1718 | .period_bytes_max = 8192, | 1717 | .period_bytes_max = 8192, |
diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c index 1922ec57d10a..70042197f9e2 100644 --- a/sound/soc/sh/rcar/core.c +++ b/sound/soc/sh/rcar/core.c | |||
@@ -886,8 +886,7 @@ static int rsnd_dai_probe(struct platform_device *pdev, | |||
886 | static struct snd_pcm_hardware rsnd_pcm_hardware = { | 886 | static struct snd_pcm_hardware rsnd_pcm_hardware = { |
887 | .info = SNDRV_PCM_INFO_INTERLEAVED | | 887 | .info = SNDRV_PCM_INFO_INTERLEAVED | |
888 | SNDRV_PCM_INFO_MMAP | | 888 | SNDRV_PCM_INFO_MMAP | |
889 | SNDRV_PCM_INFO_MMAP_VALID | | 889 | SNDRV_PCM_INFO_MMAP_VALID, |
890 | SNDRV_PCM_INFO_PAUSE, | ||
891 | .buffer_bytes_max = 64 * 1024, | 890 | .buffer_bytes_max = 64 * 1024, |
892 | .period_bytes_min = 32, | 891 | .period_bytes_min = 32, |
893 | .period_bytes_max = 8192, | 892 | .period_bytes_max = 8192, |
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index 4c8f8a23a0e9..b60ff56ebc0f 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c | |||
@@ -884,7 +884,7 @@ static struct snd_soc_dai *snd_soc_find_dai( | |||
884 | list_for_each_entry(component, &component_list, list) { | 884 | list_for_each_entry(component, &component_list, list) { |
885 | if (dlc->of_node && component->dev->of_node != dlc->of_node) | 885 | if (dlc->of_node && component->dev->of_node != dlc->of_node) |
886 | continue; | 886 | continue; |
887 | if (dlc->name && strcmp(dev_name(component->dev), dlc->name)) | 887 | if (dlc->name && strcmp(component->name, dlc->name)) |
888 | continue; | 888 | continue; |
889 | list_for_each_entry(dai, &component->dai_list, list) { | 889 | list_for_each_entry(dai, &component->dai_list, list) { |
890 | if (dlc->dai_name && strcmp(dai->name, dlc->dai_name)) | 890 | if (dlc->dai_name && strcmp(dai->name, dlc->dai_name)) |
diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c index 002311afdeaa..57277dd79e11 100644 --- a/sound/soc/soc-pcm.c +++ b/sound/soc/soc-pcm.c | |||
@@ -1522,13 +1522,36 @@ static void dpcm_set_fe_runtime(struct snd_pcm_substream *substream) | |||
1522 | dpcm_init_runtime_hw(runtime, &cpu_dai_drv->capture); | 1522 | dpcm_init_runtime_hw(runtime, &cpu_dai_drv->capture); |
1523 | } | 1523 | } |
1524 | 1524 | ||
1525 | static int dpcm_fe_dai_do_trigger(struct snd_pcm_substream *substream, int cmd); | ||
1526 | |||
1527 | /* Set FE's runtime_update state; the state is protected via PCM stream lock | ||
1528 | * for avoiding the race with trigger callback. | ||
1529 | * If the state is unset and a trigger is pending while the previous operation, | ||
1530 | * process the pending trigger action here. | ||
1531 | */ | ||
1532 | static void dpcm_set_fe_update_state(struct snd_soc_pcm_runtime *fe, | ||
1533 | int stream, enum snd_soc_dpcm_update state) | ||
1534 | { | ||
1535 | struct snd_pcm_substream *substream = | ||
1536 | snd_soc_dpcm_get_substream(fe, stream); | ||
1537 | |||
1538 | snd_pcm_stream_lock_irq(substream); | ||
1539 | if (state == SND_SOC_DPCM_UPDATE_NO && fe->dpcm[stream].trigger_pending) { | ||
1540 | dpcm_fe_dai_do_trigger(substream, | ||
1541 | fe->dpcm[stream].trigger_pending - 1); | ||
1542 | fe->dpcm[stream].trigger_pending = 0; | ||
1543 | } | ||
1544 | fe->dpcm[stream].runtime_update = state; | ||
1545 | snd_pcm_stream_unlock_irq(substream); | ||
1546 | } | ||
1547 | |||
1525 | static int dpcm_fe_dai_startup(struct snd_pcm_substream *fe_substream) | 1548 | static int dpcm_fe_dai_startup(struct snd_pcm_substream *fe_substream) |
1526 | { | 1549 | { |
1527 | struct snd_soc_pcm_runtime *fe = fe_substream->private_data; | 1550 | struct snd_soc_pcm_runtime *fe = fe_substream->private_data; |
1528 | struct snd_pcm_runtime *runtime = fe_substream->runtime; | 1551 | struct snd_pcm_runtime *runtime = fe_substream->runtime; |
1529 | int stream = fe_substream->stream, ret = 0; | 1552 | int stream = fe_substream->stream, ret = 0; |
1530 | 1553 | ||
1531 | fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_FE; | 1554 | dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_FE); |
1532 | 1555 | ||
1533 | ret = dpcm_be_dai_startup(fe, fe_substream->stream); | 1556 | ret = dpcm_be_dai_startup(fe, fe_substream->stream); |
1534 | if (ret < 0) { | 1557 | if (ret < 0) { |
@@ -1550,13 +1573,13 @@ static int dpcm_fe_dai_startup(struct snd_pcm_substream *fe_substream) | |||
1550 | dpcm_set_fe_runtime(fe_substream); | 1573 | dpcm_set_fe_runtime(fe_substream); |
1551 | snd_pcm_limit_hw_rates(runtime); | 1574 | snd_pcm_limit_hw_rates(runtime); |
1552 | 1575 | ||
1553 | fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_NO; | 1576 | dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_NO); |
1554 | return 0; | 1577 | return 0; |
1555 | 1578 | ||
1556 | unwind: | 1579 | unwind: |
1557 | dpcm_be_dai_startup_unwind(fe, fe_substream->stream); | 1580 | dpcm_be_dai_startup_unwind(fe, fe_substream->stream); |
1558 | be_err: | 1581 | be_err: |
1559 | fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_NO; | 1582 | dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_NO); |
1560 | return ret; | 1583 | return ret; |
1561 | } | 1584 | } |
1562 | 1585 | ||
@@ -1603,7 +1626,7 @@ static int dpcm_fe_dai_shutdown(struct snd_pcm_substream *substream) | |||
1603 | struct snd_soc_pcm_runtime *fe = substream->private_data; | 1626 | struct snd_soc_pcm_runtime *fe = substream->private_data; |
1604 | int stream = substream->stream; | 1627 | int stream = substream->stream; |
1605 | 1628 | ||
1606 | fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_FE; | 1629 | dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_FE); |
1607 | 1630 | ||
1608 | /* shutdown the BEs */ | 1631 | /* shutdown the BEs */ |
1609 | dpcm_be_dai_shutdown(fe, substream->stream); | 1632 | dpcm_be_dai_shutdown(fe, substream->stream); |
@@ -1617,7 +1640,7 @@ static int dpcm_fe_dai_shutdown(struct snd_pcm_substream *substream) | |||
1617 | dpcm_dapm_stream_event(fe, stream, SND_SOC_DAPM_STREAM_STOP); | 1640 | dpcm_dapm_stream_event(fe, stream, SND_SOC_DAPM_STREAM_STOP); |
1618 | 1641 | ||
1619 | fe->dpcm[stream].state = SND_SOC_DPCM_STATE_CLOSE; | 1642 | fe->dpcm[stream].state = SND_SOC_DPCM_STATE_CLOSE; |
1620 | fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_NO; | 1643 | dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_NO); |
1621 | return 0; | 1644 | return 0; |
1622 | } | 1645 | } |
1623 | 1646 | ||
@@ -1665,7 +1688,7 @@ static int dpcm_fe_dai_hw_free(struct snd_pcm_substream *substream) | |||
1665 | int err, stream = substream->stream; | 1688 | int err, stream = substream->stream; |
1666 | 1689 | ||
1667 | mutex_lock_nested(&fe->card->mutex, SND_SOC_CARD_CLASS_RUNTIME); | 1690 | mutex_lock_nested(&fe->card->mutex, SND_SOC_CARD_CLASS_RUNTIME); |
1668 | fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_FE; | 1691 | dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_FE); |
1669 | 1692 | ||
1670 | dev_dbg(fe->dev, "ASoC: hw_free FE %s\n", fe->dai_link->name); | 1693 | dev_dbg(fe->dev, "ASoC: hw_free FE %s\n", fe->dai_link->name); |
1671 | 1694 | ||
@@ -1680,7 +1703,7 @@ static int dpcm_fe_dai_hw_free(struct snd_pcm_substream *substream) | |||
1680 | err = dpcm_be_dai_hw_free(fe, stream); | 1703 | err = dpcm_be_dai_hw_free(fe, stream); |
1681 | 1704 | ||
1682 | fe->dpcm[stream].state = SND_SOC_DPCM_STATE_HW_FREE; | 1705 | fe->dpcm[stream].state = SND_SOC_DPCM_STATE_HW_FREE; |
1683 | fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_NO; | 1706 | dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_NO); |
1684 | 1707 | ||
1685 | mutex_unlock(&fe->card->mutex); | 1708 | mutex_unlock(&fe->card->mutex); |
1686 | return 0; | 1709 | return 0; |
@@ -1773,7 +1796,7 @@ static int dpcm_fe_dai_hw_params(struct snd_pcm_substream *substream, | |||
1773 | int ret, stream = substream->stream; | 1796 | int ret, stream = substream->stream; |
1774 | 1797 | ||
1775 | mutex_lock_nested(&fe->card->mutex, SND_SOC_CARD_CLASS_RUNTIME); | 1798 | mutex_lock_nested(&fe->card->mutex, SND_SOC_CARD_CLASS_RUNTIME); |
1776 | fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_FE; | 1799 | dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_FE); |
1777 | 1800 | ||
1778 | memcpy(&fe->dpcm[substream->stream].hw_params, params, | 1801 | memcpy(&fe->dpcm[substream->stream].hw_params, params, |
1779 | sizeof(struct snd_pcm_hw_params)); | 1802 | sizeof(struct snd_pcm_hw_params)); |
@@ -1796,7 +1819,7 @@ static int dpcm_fe_dai_hw_params(struct snd_pcm_substream *substream, | |||
1796 | fe->dpcm[stream].state = SND_SOC_DPCM_STATE_HW_PARAMS; | 1819 | fe->dpcm[stream].state = SND_SOC_DPCM_STATE_HW_PARAMS; |
1797 | 1820 | ||
1798 | out: | 1821 | out: |
1799 | fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_NO; | 1822 | dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_NO); |
1800 | mutex_unlock(&fe->card->mutex); | 1823 | mutex_unlock(&fe->card->mutex); |
1801 | return ret; | 1824 | return ret; |
1802 | } | 1825 | } |
@@ -1910,7 +1933,7 @@ int dpcm_be_dai_trigger(struct snd_soc_pcm_runtime *fe, int stream, | |||
1910 | } | 1933 | } |
1911 | EXPORT_SYMBOL_GPL(dpcm_be_dai_trigger); | 1934 | EXPORT_SYMBOL_GPL(dpcm_be_dai_trigger); |
1912 | 1935 | ||
1913 | static int dpcm_fe_dai_trigger(struct snd_pcm_substream *substream, int cmd) | 1936 | static int dpcm_fe_dai_do_trigger(struct snd_pcm_substream *substream, int cmd) |
1914 | { | 1937 | { |
1915 | struct snd_soc_pcm_runtime *fe = substream->private_data; | 1938 | struct snd_soc_pcm_runtime *fe = substream->private_data; |
1916 | int stream = substream->stream, ret; | 1939 | int stream = substream->stream, ret; |
@@ -1984,6 +2007,23 @@ out: | |||
1984 | return ret; | 2007 | return ret; |
1985 | } | 2008 | } |
1986 | 2009 | ||
2010 | static int dpcm_fe_dai_trigger(struct snd_pcm_substream *substream, int cmd) | ||
2011 | { | ||
2012 | struct snd_soc_pcm_runtime *fe = substream->private_data; | ||
2013 | int stream = substream->stream; | ||
2014 | |||
2015 | /* if FE's runtime_update is already set, we're in race; | ||
2016 | * process this trigger later at exit | ||
2017 | */ | ||
2018 | if (fe->dpcm[stream].runtime_update != SND_SOC_DPCM_UPDATE_NO) { | ||
2019 | fe->dpcm[stream].trigger_pending = cmd + 1; | ||
2020 | return 0; /* delayed, assuming it's successful */ | ||
2021 | } | ||
2022 | |||
2023 | /* we're alone, let's trigger */ | ||
2024 | return dpcm_fe_dai_do_trigger(substream, cmd); | ||
2025 | } | ||
2026 | |||
1987 | int dpcm_be_dai_prepare(struct snd_soc_pcm_runtime *fe, int stream) | 2027 | int dpcm_be_dai_prepare(struct snd_soc_pcm_runtime *fe, int stream) |
1988 | { | 2028 | { |
1989 | struct snd_soc_dpcm *dpcm; | 2029 | struct snd_soc_dpcm *dpcm; |
@@ -2027,7 +2067,7 @@ static int dpcm_fe_dai_prepare(struct snd_pcm_substream *substream) | |||
2027 | 2067 | ||
2028 | dev_dbg(fe->dev, "ASoC: prepare FE %s\n", fe->dai_link->name); | 2068 | dev_dbg(fe->dev, "ASoC: prepare FE %s\n", fe->dai_link->name); |
2029 | 2069 | ||
2030 | fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_FE; | 2070 | dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_FE); |
2031 | 2071 | ||
2032 | /* there is no point preparing this FE if there are no BEs */ | 2072 | /* there is no point preparing this FE if there are no BEs */ |
2033 | if (list_empty(&fe->dpcm[stream].be_clients)) { | 2073 | if (list_empty(&fe->dpcm[stream].be_clients)) { |
@@ -2054,7 +2094,7 @@ static int dpcm_fe_dai_prepare(struct snd_pcm_substream *substream) | |||
2054 | fe->dpcm[stream].state = SND_SOC_DPCM_STATE_PREPARE; | 2094 | fe->dpcm[stream].state = SND_SOC_DPCM_STATE_PREPARE; |
2055 | 2095 | ||
2056 | out: | 2096 | out: |
2057 | fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_NO; | 2097 | dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_NO); |
2058 | mutex_unlock(&fe->card->mutex); | 2098 | mutex_unlock(&fe->card->mutex); |
2059 | 2099 | ||
2060 | return ret; | 2100 | return ret; |
@@ -2201,11 +2241,11 @@ static int dpcm_run_new_update(struct snd_soc_pcm_runtime *fe, int stream) | |||
2201 | { | 2241 | { |
2202 | int ret; | 2242 | int ret; |
2203 | 2243 | ||
2204 | fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_BE; | 2244 | dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_BE); |
2205 | ret = dpcm_run_update_startup(fe, stream); | 2245 | ret = dpcm_run_update_startup(fe, stream); |
2206 | if (ret < 0) | 2246 | if (ret < 0) |
2207 | dev_err(fe->dev, "ASoC: failed to startup some BEs\n"); | 2247 | dev_err(fe->dev, "ASoC: failed to startup some BEs\n"); |
2208 | fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_NO; | 2248 | dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_NO); |
2209 | 2249 | ||
2210 | return ret; | 2250 | return ret; |
2211 | } | 2251 | } |
@@ -2214,11 +2254,11 @@ static int dpcm_run_old_update(struct snd_soc_pcm_runtime *fe, int stream) | |||
2214 | { | 2254 | { |
2215 | int ret; | 2255 | int ret; |
2216 | 2256 | ||
2217 | fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_BE; | 2257 | dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_BE); |
2218 | ret = dpcm_run_update_shutdown(fe, stream); | 2258 | ret = dpcm_run_update_shutdown(fe, stream); |
2219 | if (ret < 0) | 2259 | if (ret < 0) |
2220 | dev_err(fe->dev, "ASoC: failed to shutdown some BEs\n"); | 2260 | dev_err(fe->dev, "ASoC: failed to shutdown some BEs\n"); |
2221 | fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_NO; | 2261 | dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_NO); |
2222 | 2262 | ||
2223 | return ret; | 2263 | return ret; |
2224 | } | 2264 | } |
diff --git a/sound/usb/mixer.c b/sound/usb/mixer.c index 2e4a9dbc51fa..6e354d326858 100644 --- a/sound/usb/mixer.c +++ b/sound/usb/mixer.c | |||
@@ -2033,10 +2033,11 @@ static int parse_audio_selector_unit(struct mixer_build *state, int unitid, | |||
2033 | cval->res = 1; | 2033 | cval->res = 1; |
2034 | cval->initialized = 1; | 2034 | cval->initialized = 1; |
2035 | 2035 | ||
2036 | if (desc->bDescriptorSubtype == UAC2_CLOCK_SELECTOR) | 2036 | if (state->mixer->protocol == UAC_VERSION_1) |
2037 | cval->control = UAC2_CX_CLOCK_SELECTOR; | ||
2038 | else | ||
2039 | cval->control = 0; | 2037 | cval->control = 0; |
2038 | else /* UAC_VERSION_2 */ | ||
2039 | cval->control = (desc->bDescriptorSubtype == UAC2_CLOCK_SELECTOR) ? | ||
2040 | UAC2_CX_CLOCK_SELECTOR : UAC2_SU_SELECTOR; | ||
2040 | 2041 | ||
2041 | namelist = kmalloc(sizeof(char *) * desc->bNrInPins, GFP_KERNEL); | 2042 | namelist = kmalloc(sizeof(char *) * desc->bNrInPins, GFP_KERNEL); |
2042 | if (!namelist) { | 2043 | if (!namelist) { |
diff --git a/sound/usb/mixer_quirks.c b/sound/usb/mixer_quirks.c index 7c83bab69dee..8c9bf4b7aaf0 100644 --- a/sound/usb/mixer_quirks.c +++ b/sound/usb/mixer_quirks.c | |||
@@ -593,10 +593,10 @@ static int snd_nativeinstruments_control_get(struct snd_kcontrol *kcontrol, | |||
593 | if (mixer->chip->shutdown) | 593 | if (mixer->chip->shutdown) |
594 | ret = -ENODEV; | 594 | ret = -ENODEV; |
595 | else | 595 | else |
596 | ret = usb_control_msg(dev, usb_rcvctrlpipe(dev, 0), bRequest, | 596 | ret = snd_usb_ctl_msg(dev, usb_rcvctrlpipe(dev, 0), bRequest, |
597 | USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN, | 597 | USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN, |
598 | 0, wIndex, | 598 | 0, wIndex, |
599 | &tmp, sizeof(tmp), 1000); | 599 | &tmp, sizeof(tmp)); |
600 | up_read(&mixer->chip->shutdown_rwsem); | 600 | up_read(&mixer->chip->shutdown_rwsem); |
601 | 601 | ||
602 | if (ret < 0) { | 602 | if (ret < 0) { |
diff --git a/sound/usb/quirks.c b/sound/usb/quirks.c index d2aa45a8d895..60dfe0d28771 100644 --- a/sound/usb/quirks.c +++ b/sound/usb/quirks.c | |||
@@ -1146,6 +1146,20 @@ void snd_usb_ctl_msg_quirk(struct usb_device *dev, unsigned int pipe, | |||
1146 | if ((le16_to_cpu(dev->descriptor.idVendor) == 0x23ba) && | 1146 | if ((le16_to_cpu(dev->descriptor.idVendor) == 0x23ba) && |
1147 | (requesttype & USB_TYPE_MASK) == USB_TYPE_CLASS) | 1147 | (requesttype & USB_TYPE_MASK) == USB_TYPE_CLASS) |
1148 | mdelay(20); | 1148 | mdelay(20); |
1149 | |||
1150 | /* Marantz/Denon devices with USB DAC functionality need a delay | ||
1151 | * after each class compliant request | ||
1152 | */ | ||
1153 | if ((le16_to_cpu(dev->descriptor.idVendor) == 0x154e) && | ||
1154 | (requesttype & USB_TYPE_MASK) == USB_TYPE_CLASS) { | ||
1155 | |||
1156 | switch (le16_to_cpu(dev->descriptor.idProduct)) { | ||
1157 | case 0x3005: /* Marantz HD-DAC1 */ | ||
1158 | case 0x3006: /* Marantz SA-14S1 */ | ||
1159 | mdelay(20); | ||
1160 | break; | ||
1161 | } | ||
1162 | } | ||
1149 | } | 1163 | } |
1150 | 1164 | ||
1151 | /* | 1165 | /* |
@@ -1179,12 +1193,12 @@ u64 snd_usb_interface_dsd_format_quirks(struct snd_usb_audio *chip, | |||
1179 | /* iFi Audio micro/nano iDSD */ | 1193 | /* iFi Audio micro/nano iDSD */ |
1180 | case USB_ID(0x20b1, 0x3008): | 1194 | case USB_ID(0x20b1, 0x3008): |
1181 | if (fp->altsetting == 2) | 1195 | if (fp->altsetting == 2) |
1182 | return SNDRV_PCM_FMTBIT_DSD_U32_LE; | 1196 | return SNDRV_PCM_FMTBIT_DSD_U32_BE; |
1183 | break; | 1197 | break; |
1184 | /* DIYINHK DSD DXD 384kHz USB to I2S/DSD */ | 1198 | /* DIYINHK DSD DXD 384kHz USB to I2S/DSD */ |
1185 | case USB_ID(0x20b1, 0x2009): | 1199 | case USB_ID(0x20b1, 0x2009): |
1186 | if (fp->altsetting == 3) | 1200 | if (fp->altsetting == 3) |
1187 | return SNDRV_PCM_FMTBIT_DSD_U32_LE; | 1201 | return SNDRV_PCM_FMTBIT_DSD_U32_BE; |
1188 | break; | 1202 | break; |
1189 | default: | 1203 | default: |
1190 | break; | 1204 | break; |
diff --git a/tools/power/cpupower/utils/cpuidle-info.c b/tools/power/cpupower/utils/cpuidle-info.c index 75e66de7e7a7..458d69b444ad 100644 --- a/tools/power/cpupower/utils/cpuidle-info.c +++ b/tools/power/cpupower/utils/cpuidle-info.c | |||
@@ -22,13 +22,13 @@ | |||
22 | 22 | ||
23 | static void cpuidle_cpu_output(unsigned int cpu, int verbose) | 23 | static void cpuidle_cpu_output(unsigned int cpu, int verbose) |
24 | { | 24 | { |
25 | unsigned int idlestates, idlestate; | 25 | int idlestates, idlestate; |
26 | char *tmp; | 26 | char *tmp; |
27 | 27 | ||
28 | printf(_ ("Analyzing CPU %d:\n"), cpu); | 28 | printf(_ ("Analyzing CPU %d:\n"), cpu); |
29 | 29 | ||
30 | idlestates = sysfs_get_idlestate_count(cpu); | 30 | idlestates = sysfs_get_idlestate_count(cpu); |
31 | if (idlestates == 0) { | 31 | if (idlestates < 1) { |
32 | printf(_("CPU %u: No idle states\n"), cpu); | 32 | printf(_("CPU %u: No idle states\n"), cpu); |
33 | return; | 33 | return; |
34 | } | 34 | } |
@@ -100,10 +100,10 @@ static void cpuidle_general_output(void) | |||
100 | static void proc_cpuidle_cpu_output(unsigned int cpu) | 100 | static void proc_cpuidle_cpu_output(unsigned int cpu) |
101 | { | 101 | { |
102 | long max_allowed_cstate = 2000000000; | 102 | long max_allowed_cstate = 2000000000; |
103 | unsigned int cstate, cstates; | 103 | int cstate, cstates; |
104 | 104 | ||
105 | cstates = sysfs_get_idlestate_count(cpu); | 105 | cstates = sysfs_get_idlestate_count(cpu); |
106 | if (cstates == 0) { | 106 | if (cstates < 1) { |
107 | printf(_("CPU %u: No C-states info\n"), cpu); | 107 | printf(_("CPU %u: No C-states info\n"), cpu); |
108 | return; | 108 | return; |
109 | } | 109 | } |
diff --git a/virt/kvm/arm/vgic.c b/virt/kvm/arm/vgic.c index 3aaca49de325..aacdb59f30de 100644 --- a/virt/kvm/arm/vgic.c +++ b/virt/kvm/arm/vgic.c | |||
@@ -1933,7 +1933,7 @@ out: | |||
1933 | 1933 | ||
1934 | int kvm_vgic_create(struct kvm *kvm) | 1934 | int kvm_vgic_create(struct kvm *kvm) |
1935 | { | 1935 | { |
1936 | int i, vcpu_lock_idx = -1, ret = 0; | 1936 | int i, vcpu_lock_idx = -1, ret; |
1937 | struct kvm_vcpu *vcpu; | 1937 | struct kvm_vcpu *vcpu; |
1938 | 1938 | ||
1939 | mutex_lock(&kvm->lock); | 1939 | mutex_lock(&kvm->lock); |
@@ -1948,6 +1948,7 @@ int kvm_vgic_create(struct kvm *kvm) | |||
1948 | * vcpu->mutex. By grabbing the vcpu->mutex of all VCPUs we ensure | 1948 | * vcpu->mutex. By grabbing the vcpu->mutex of all VCPUs we ensure |
1949 | * that no other VCPUs are run while we create the vgic. | 1949 | * that no other VCPUs are run while we create the vgic. |
1950 | */ | 1950 | */ |
1951 | ret = -EBUSY; | ||
1951 | kvm_for_each_vcpu(i, vcpu, kvm) { | 1952 | kvm_for_each_vcpu(i, vcpu, kvm) { |
1952 | if (!mutex_trylock(&vcpu->mutex)) | 1953 | if (!mutex_trylock(&vcpu->mutex)) |
1953 | goto out_unlock; | 1954 | goto out_unlock; |
@@ -1955,11 +1956,10 @@ int kvm_vgic_create(struct kvm *kvm) | |||
1955 | } | 1956 | } |
1956 | 1957 | ||
1957 | kvm_for_each_vcpu(i, vcpu, kvm) { | 1958 | kvm_for_each_vcpu(i, vcpu, kvm) { |
1958 | if (vcpu->arch.has_run_once) { | 1959 | if (vcpu->arch.has_run_once) |
1959 | ret = -EBUSY; | ||
1960 | goto out_unlock; | 1960 | goto out_unlock; |
1961 | } | ||
1962 | } | 1961 | } |
1962 | ret = 0; | ||
1963 | 1963 | ||
1964 | spin_lock_init(&kvm->arch.vgic.lock); | 1964 | spin_lock_init(&kvm->arch.vgic.lock); |
1965 | kvm->arch.vgic.in_kernel = true; | 1965 | kvm->arch.vgic.in_kernel = true; |
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c index 25ffac9e947d..3cee7b167052 100644 --- a/virt/kvm/kvm_main.c +++ b/virt/kvm/kvm_main.c | |||
@@ -107,10 +107,10 @@ EXPORT_SYMBOL_GPL(kvm_rebooting); | |||
107 | 107 | ||
108 | static bool largepages_enabled = true; | 108 | static bool largepages_enabled = true; |
109 | 109 | ||
110 | bool kvm_is_mmio_pfn(pfn_t pfn) | 110 | bool kvm_is_reserved_pfn(pfn_t pfn) |
111 | { | 111 | { |
112 | if (pfn_valid(pfn)) | 112 | if (pfn_valid(pfn)) |
113 | return !is_zero_pfn(pfn) && PageReserved(pfn_to_page(pfn)); | 113 | return PageReserved(pfn_to_page(pfn)); |
114 | 114 | ||
115 | return true; | 115 | return true; |
116 | } | 116 | } |
@@ -1321,7 +1321,7 @@ static pfn_t hva_to_pfn(unsigned long addr, bool atomic, bool *async, | |||
1321 | else if ((vma->vm_flags & VM_PFNMAP)) { | 1321 | else if ((vma->vm_flags & VM_PFNMAP)) { |
1322 | pfn = ((addr - vma->vm_start) >> PAGE_SHIFT) + | 1322 | pfn = ((addr - vma->vm_start) >> PAGE_SHIFT) + |
1323 | vma->vm_pgoff; | 1323 | vma->vm_pgoff; |
1324 | BUG_ON(!kvm_is_mmio_pfn(pfn)); | 1324 | BUG_ON(!kvm_is_reserved_pfn(pfn)); |
1325 | } else { | 1325 | } else { |
1326 | if (async && vma_is_valid(vma, write_fault)) | 1326 | if (async && vma_is_valid(vma, write_fault)) |
1327 | *async = true; | 1327 | *async = true; |
@@ -1427,7 +1427,7 @@ static struct page *kvm_pfn_to_page(pfn_t pfn) | |||
1427 | if (is_error_noslot_pfn(pfn)) | 1427 | if (is_error_noslot_pfn(pfn)) |
1428 | return KVM_ERR_PTR_BAD_PAGE; | 1428 | return KVM_ERR_PTR_BAD_PAGE; |
1429 | 1429 | ||
1430 | if (kvm_is_mmio_pfn(pfn)) { | 1430 | if (kvm_is_reserved_pfn(pfn)) { |
1431 | WARN_ON(1); | 1431 | WARN_ON(1); |
1432 | return KVM_ERR_PTR_BAD_PAGE; | 1432 | return KVM_ERR_PTR_BAD_PAGE; |
1433 | } | 1433 | } |
@@ -1456,7 +1456,7 @@ EXPORT_SYMBOL_GPL(kvm_release_page_clean); | |||
1456 | 1456 | ||
1457 | void kvm_release_pfn_clean(pfn_t pfn) | 1457 | void kvm_release_pfn_clean(pfn_t pfn) |
1458 | { | 1458 | { |
1459 | if (!is_error_noslot_pfn(pfn) && !kvm_is_mmio_pfn(pfn)) | 1459 | if (!is_error_noslot_pfn(pfn) && !kvm_is_reserved_pfn(pfn)) |
1460 | put_page(pfn_to_page(pfn)); | 1460 | put_page(pfn_to_page(pfn)); |
1461 | } | 1461 | } |
1462 | EXPORT_SYMBOL_GPL(kvm_release_pfn_clean); | 1462 | EXPORT_SYMBOL_GPL(kvm_release_pfn_clean); |
@@ -1477,7 +1477,7 @@ static void kvm_release_pfn_dirty(pfn_t pfn) | |||
1477 | 1477 | ||
1478 | void kvm_set_pfn_dirty(pfn_t pfn) | 1478 | void kvm_set_pfn_dirty(pfn_t pfn) |
1479 | { | 1479 | { |
1480 | if (!kvm_is_mmio_pfn(pfn)) { | 1480 | if (!kvm_is_reserved_pfn(pfn)) { |
1481 | struct page *page = pfn_to_page(pfn); | 1481 | struct page *page = pfn_to_page(pfn); |
1482 | if (!PageReserved(page)) | 1482 | if (!PageReserved(page)) |
1483 | SetPageDirty(page); | 1483 | SetPageDirty(page); |
@@ -1487,14 +1487,14 @@ EXPORT_SYMBOL_GPL(kvm_set_pfn_dirty); | |||
1487 | 1487 | ||
1488 | void kvm_set_pfn_accessed(pfn_t pfn) | 1488 | void kvm_set_pfn_accessed(pfn_t pfn) |
1489 | { | 1489 | { |
1490 | if (!kvm_is_mmio_pfn(pfn)) | 1490 | if (!kvm_is_reserved_pfn(pfn)) |
1491 | mark_page_accessed(pfn_to_page(pfn)); | 1491 | mark_page_accessed(pfn_to_page(pfn)); |
1492 | } | 1492 | } |
1493 | EXPORT_SYMBOL_GPL(kvm_set_pfn_accessed); | 1493 | EXPORT_SYMBOL_GPL(kvm_set_pfn_accessed); |
1494 | 1494 | ||
1495 | void kvm_get_pfn(pfn_t pfn) | 1495 | void kvm_get_pfn(pfn_t pfn) |
1496 | { | 1496 | { |
1497 | if (!kvm_is_mmio_pfn(pfn)) | 1497 | if (!kvm_is_reserved_pfn(pfn)) |
1498 | get_page(pfn_to_page(pfn)); | 1498 | get_page(pfn_to_page(pfn)); |
1499 | } | 1499 | } |
1500 | EXPORT_SYMBOL_GPL(kvm_get_pfn); | 1500 | EXPORT_SYMBOL_GPL(kvm_get_pfn); |