diff options
816 files changed, 7769 insertions, 4046 deletions
@@ -655,6 +655,11 @@ S: Stanford University | |||
655 | S: Stanford, California 94305 | 655 | S: Stanford, California 94305 |
656 | S: USA | 656 | S: USA |
657 | 657 | ||
658 | N: Carlos Chinea | ||
659 | E: carlos.chinea@nokia.com | ||
660 | E: cch.devel@gmail.com | ||
661 | D: Author of HSI Subsystem | ||
662 | |||
658 | N: Randolph Chung | 663 | N: Randolph Chung |
659 | E: tausq@debian.org | 664 | E: tausq@debian.org |
660 | D: Linux/PA-RISC hacker | 665 | D: Linux/PA-RISC hacker |
diff --git a/Documentation/DocBook/media/v4l/vidioc-expbuf.xml b/Documentation/DocBook/media/v4l/vidioc-expbuf.xml index e287c8fc803b..4165e7bfa4ff 100644 --- a/Documentation/DocBook/media/v4l/vidioc-expbuf.xml +++ b/Documentation/DocBook/media/v4l/vidioc-expbuf.xml | |||
@@ -73,7 +73,8 @@ range from zero to the maximal number of valid planes for the currently active | |||
73 | format. For the single-planar API, applications must set <structfield> plane | 73 | format. For the single-planar API, applications must set <structfield> plane |
74 | </structfield> to zero. Additional flags may be posted in the <structfield> | 74 | </structfield> to zero. Additional flags may be posted in the <structfield> |
75 | flags </structfield> field. Refer to a manual for open() for details. | 75 | flags </structfield> field. Refer to a manual for open() for details. |
76 | Currently only O_CLOEXEC is supported. All other fields must be set to zero. | 76 | Currently only O_CLOEXEC, O_RDONLY, O_WRONLY, and O_RDWR are supported. All |
77 | other fields must be set to zero. | ||
77 | In the case of multi-planar API, every plane is exported separately using | 78 | In the case of multi-planar API, every plane is exported separately using |
78 | multiple <constant> VIDIOC_EXPBUF </constant> calls. </para> | 79 | multiple <constant> VIDIOC_EXPBUF </constant> calls. </para> |
79 | 80 | ||
@@ -170,8 +171,9 @@ multi-planar API. Otherwise this value must be set to zero. </entry> | |||
170 | <entry>__u32</entry> | 171 | <entry>__u32</entry> |
171 | <entry><structfield>flags</structfield></entry> | 172 | <entry><structfield>flags</structfield></entry> |
172 | <entry>Flags for the newly created file, currently only <constant> | 173 | <entry>Flags for the newly created file, currently only <constant> |
173 | O_CLOEXEC </constant> is supported, refer to the manual of open() for more | 174 | O_CLOEXEC </constant>, <constant>O_RDONLY</constant>, <constant>O_WRONLY |
174 | details.</entry> | 175 | </constant>, and <constant>O_RDWR</constant> are supported, refer to the manual |
176 | of open() for more details.</entry> | ||
175 | </row> | 177 | </row> |
176 | <row> | 178 | <row> |
177 | <entry>__s32</entry> | 179 | <entry>__s32</entry> |
diff --git a/Documentation/assoc_array.txt b/Documentation/assoc_array.txt index f4faec0f66e4..2f2c6cdd73c0 100644 --- a/Documentation/assoc_array.txt +++ b/Documentation/assoc_array.txt | |||
@@ -164,10 +164,10 @@ This points to a number of methods, all of which need to be provided: | |||
164 | 164 | ||
165 | (4) Diff the index keys of two objects. | 165 | (4) Diff the index keys of two objects. |
166 | 166 | ||
167 | int (*diff_objects)(const void *a, const void *b); | 167 | int (*diff_objects)(const void *object, const void *index_key); |
168 | 168 | ||
169 | Return the bit position at which the index keys of two objects differ or | 169 | Return the bit position at which the index key of the specified object |
170 | -1 if they are the same. | 170 | differs from the given index key or -1 if they are the same. |
171 | 171 | ||
172 | 172 | ||
173 | (5) Free an object. | 173 | (5) Free an object. |
diff --git a/Documentation/device-mapper/cache.txt b/Documentation/device-mapper/cache.txt index 274752f8bdf9..719320b5ed3f 100644 --- a/Documentation/device-mapper/cache.txt +++ b/Documentation/device-mapper/cache.txt | |||
@@ -266,10 +266,12 @@ E.g. | |||
266 | Invalidation is removing an entry from the cache without writing it | 266 | Invalidation is removing an entry from the cache without writing it |
267 | back. Cache blocks can be invalidated via the invalidate_cblocks | 267 | back. Cache blocks can be invalidated via the invalidate_cblocks |
268 | message, which takes an arbitrary number of cblock ranges. Each cblock | 268 | message, which takes an arbitrary number of cblock ranges. Each cblock |
269 | must be expressed as a decimal value, in the future a variant message | 269 | range's end value is "one past the end", meaning 5-10 expresses a range |
270 | that takes cblock ranges expressed in hexidecimal may be needed to | 270 | of values from 5 to 9. Each cblock must be expressed as a decimal |
271 | better support efficient invalidation of larger caches. The cache must | 271 | value, in the future a variant message that takes cblock ranges |
272 | be in passthrough mode when invalidate_cblocks is used. | 272 | expressed in hexidecimal may be needed to better support efficient |
273 | invalidation of larger caches. The cache must be in passthrough mode | ||
274 | when invalidate_cblocks is used. | ||
273 | 275 | ||
274 | invalidate_cblocks [<cblock>|<cblock begin>-<cblock end>]* | 276 | invalidate_cblocks [<cblock>|<cblock begin>-<cblock end>]* |
275 | 277 | ||
diff --git a/Documentation/devicetree/bindings/arm/omap/mpu.txt b/Documentation/devicetree/bindings/arm/omap/mpu.txt index 1a5a42ce21bb..83f405bde138 100644 --- a/Documentation/devicetree/bindings/arm/omap/mpu.txt +++ b/Documentation/devicetree/bindings/arm/omap/mpu.txt | |||
@@ -7,10 +7,18 @@ The MPU contain CPUs, GIC, L2 cache and a local PRCM. | |||
7 | Required properties: | 7 | Required properties: |
8 | - compatible : Should be "ti,omap3-mpu" for OMAP3 | 8 | - compatible : Should be "ti,omap3-mpu" for OMAP3 |
9 | Should be "ti,omap4-mpu" for OMAP4 | 9 | Should be "ti,omap4-mpu" for OMAP4 |
10 | Should be "ti,omap5-mpu" for OMAP5 | ||
10 | - ti,hwmods: "mpu" | 11 | - ti,hwmods: "mpu" |
11 | 12 | ||
12 | Examples: | 13 | Examples: |
13 | 14 | ||
15 | - For an OMAP5 SMP system: | ||
16 | |||
17 | mpu { | ||
18 | compatible = "ti,omap5-mpu"; | ||
19 | ti,hwmods = "mpu" | ||
20 | }; | ||
21 | |||
14 | - For an OMAP4 SMP system: | 22 | - For an OMAP4 SMP system: |
15 | 23 | ||
16 | mpu { | 24 | mpu { |
diff --git a/Documentation/devicetree/bindings/arm/pmu.txt b/Documentation/devicetree/bindings/arm/pmu.txt index 343781b9f246..3e1e498fea96 100644 --- a/Documentation/devicetree/bindings/arm/pmu.txt +++ b/Documentation/devicetree/bindings/arm/pmu.txt | |||
@@ -7,6 +7,7 @@ representation in the device tree should be done as under:- | |||
7 | Required properties: | 7 | Required properties: |
8 | 8 | ||
9 | - compatible : should be one of | 9 | - compatible : should be one of |
10 | "arm,armv8-pmuv3" | ||
10 | "arm,cortex-a15-pmu" | 11 | "arm,cortex-a15-pmu" |
11 | "arm,cortex-a9-pmu" | 12 | "arm,cortex-a9-pmu" |
12 | "arm,cortex-a8-pmu" | 13 | "arm,cortex-a8-pmu" |
diff --git a/Documentation/devicetree/bindings/arm/samsung/exynos-adc.txt b/Documentation/devicetree/bindings/arm/samsung/exynos-adc.txt index 47ada1dff216..5d49f2b37f68 100644 --- a/Documentation/devicetree/bindings/arm/samsung/exynos-adc.txt +++ b/Documentation/devicetree/bindings/arm/samsung/exynos-adc.txt | |||
@@ -49,7 +49,7 @@ adc@12D10000 { | |||
49 | /* NTC thermistor is a hwmon device */ | 49 | /* NTC thermistor is a hwmon device */ |
50 | ncp15wb473@0 { | 50 | ncp15wb473@0 { |
51 | compatible = "ntc,ncp15wb473"; | 51 | compatible = "ntc,ncp15wb473"; |
52 | pullup-uV = <1800000>; | 52 | pullup-uv = <1800000>; |
53 | pullup-ohm = <47000>; | 53 | pullup-ohm = <47000>; |
54 | pulldown-ohm = <0>; | 54 | pulldown-ohm = <0>; |
55 | io-channels = <&adc 4>; | 55 | io-channels = <&adc 4>; |
diff --git a/Documentation/devicetree/bindings/clock/exynos4-clock.txt b/Documentation/devicetree/bindings/clock/exynos4-clock.txt index c6bf8a6c8f52..a2ac2d9ac71a 100644 --- a/Documentation/devicetree/bindings/clock/exynos4-clock.txt +++ b/Documentation/devicetree/bindings/clock/exynos4-clock.txt | |||
@@ -6,7 +6,7 @@ SoC's in the Exynos4 family. | |||
6 | 6 | ||
7 | Required Properties: | 7 | Required Properties: |
8 | 8 | ||
9 | - comptible: should be one of the following. | 9 | - compatible: should be one of the following. |
10 | - "samsung,exynos4210-clock" - controller compatible with Exynos4210 SoC. | 10 | - "samsung,exynos4210-clock" - controller compatible with Exynos4210 SoC. |
11 | - "samsung,exynos4412-clock" - controller compatible with Exynos4412 SoC. | 11 | - "samsung,exynos4412-clock" - controller compatible with Exynos4412 SoC. |
12 | 12 | ||
diff --git a/Documentation/devicetree/bindings/clock/exynos5250-clock.txt b/Documentation/devicetree/bindings/clock/exynos5250-clock.txt index 24765c146e31..46f5c791ea0d 100644 --- a/Documentation/devicetree/bindings/clock/exynos5250-clock.txt +++ b/Documentation/devicetree/bindings/clock/exynos5250-clock.txt | |||
@@ -5,7 +5,7 @@ controllers within the Exynos5250 SoC. | |||
5 | 5 | ||
6 | Required Properties: | 6 | Required Properties: |
7 | 7 | ||
8 | - comptible: should be one of the following. | 8 | - compatible: should be one of the following. |
9 | - "samsung,exynos5250-clock" - controller compatible with Exynos5250 SoC. | 9 | - "samsung,exynos5250-clock" - controller compatible with Exynos5250 SoC. |
10 | 10 | ||
11 | - reg: physical base address of the controller and length of memory mapped | 11 | - reg: physical base address of the controller and length of memory mapped |
diff --git a/Documentation/devicetree/bindings/clock/exynos5420-clock.txt b/Documentation/devicetree/bindings/clock/exynos5420-clock.txt index 32aa34ecad36..458f34789e5d 100644 --- a/Documentation/devicetree/bindings/clock/exynos5420-clock.txt +++ b/Documentation/devicetree/bindings/clock/exynos5420-clock.txt | |||
@@ -5,7 +5,7 @@ controllers within the Exynos5420 SoC. | |||
5 | 5 | ||
6 | Required Properties: | 6 | Required Properties: |
7 | 7 | ||
8 | - comptible: should be one of the following. | 8 | - compatible: should be one of the following. |
9 | - "samsung,exynos5420-clock" - controller compatible with Exynos5420 SoC. | 9 | - "samsung,exynos5420-clock" - controller compatible with Exynos5420 SoC. |
10 | 10 | ||
11 | - reg: physical base address of the controller and length of memory mapped | 11 | - reg: physical base address of the controller and length of memory mapped |
diff --git a/Documentation/devicetree/bindings/clock/exynos5440-clock.txt b/Documentation/devicetree/bindings/clock/exynos5440-clock.txt index 4499e9966bc9..9955dc9c7d96 100644 --- a/Documentation/devicetree/bindings/clock/exynos5440-clock.txt +++ b/Documentation/devicetree/bindings/clock/exynos5440-clock.txt | |||
@@ -5,7 +5,7 @@ controllers within the Exynos5440 SoC. | |||
5 | 5 | ||
6 | Required Properties: | 6 | Required Properties: |
7 | 7 | ||
8 | - comptible: should be "samsung,exynos5440-clock". | 8 | - compatible: should be "samsung,exynos5440-clock". |
9 | 9 | ||
10 | - reg: physical base address of the controller and length of memory mapped | 10 | - reg: physical base address of the controller and length of memory mapped |
11 | region. | 11 | region. |
diff --git a/Documentation/devicetree/bindings/gpio/8xxx_gpio.txt b/Documentation/devicetree/bindings/gpio/8xxx_gpio.txt index b0019eb5330e..798cfc9d3839 100644 --- a/Documentation/devicetree/bindings/gpio/8xxx_gpio.txt +++ b/Documentation/devicetree/bindings/gpio/8xxx_gpio.txt | |||
@@ -5,16 +5,42 @@ This is for the non-QE/CPM/GUTs GPIO controllers as found on | |||
5 | 5 | ||
6 | Every GPIO controller node must have #gpio-cells property defined, | 6 | Every GPIO controller node must have #gpio-cells property defined, |
7 | this information will be used to translate gpio-specifiers. | 7 | this information will be used to translate gpio-specifiers. |
8 | See bindings/gpio/gpio.txt for details of how to specify GPIO | ||
9 | information for devices. | ||
10 | |||
11 | The GPIO module usually is connected to the SoC's internal interrupt | ||
12 | controller, see bindings/interrupt-controller/interrupts.txt (the | ||
13 | interrupt client nodes section) for details how to specify this GPIO | ||
14 | module's interrupt. | ||
15 | |||
16 | The GPIO module may serve as another interrupt controller (cascaded to | ||
17 | the SoC's internal interrupt controller). See the interrupt controller | ||
18 | nodes section in bindings/interrupt-controller/interrupts.txt for | ||
19 | details. | ||
8 | 20 | ||
9 | Required properties: | 21 | Required properties: |
10 | - compatible : "fsl,<CHIP>-gpio" followed by "fsl,mpc8349-gpio" for | 22 | - compatible: "fsl,<chip>-gpio" followed by "fsl,mpc8349-gpio" |
11 | 83xx, "fsl,mpc8572-gpio" for 85xx and "fsl,mpc8610-gpio" for 86xx. | 23 | for 83xx, "fsl,mpc8572-gpio" for 85xx, or |
12 | - #gpio-cells : Should be two. The first cell is the pin number and the | 24 | "fsl,mpc8610-gpio" for 86xx. |
13 | second cell is used to specify optional parameters (currently unused). | 25 | - #gpio-cells: Should be two. The first cell is the pin number |
14 | - interrupts : Interrupt mapping for GPIO IRQ. | 26 | and the second cell is used to specify optional |
15 | - interrupt-parent : Phandle for the interrupt controller that | 27 | parameters (currently unused). |
16 | services interrupts for this device. | 28 | - interrupt-parent: Phandle for the interrupt controller that |
17 | - gpio-controller : Marks the port as GPIO controller. | 29 | services interrupts for this device. |
30 | - interrupts: Interrupt mapping for GPIO IRQ. | ||
31 | - gpio-controller: Marks the port as GPIO controller. | ||
32 | |||
33 | Optional properties: | ||
34 | - interrupt-controller: Empty boolean property which marks the GPIO | ||
35 | module as an IRQ controller. | ||
36 | - #interrupt-cells: Should be two. Defines the number of integer | ||
37 | cells required to specify an interrupt within | ||
38 | this interrupt controller. The first cell | ||
39 | defines the pin number, the second cell | ||
40 | defines additional flags (trigger type, | ||
41 | trigger polarity). Note that the available | ||
42 | set of trigger conditions supported by the | ||
43 | GPIO module depends on the actual SoC. | ||
18 | 44 | ||
19 | Example of gpio-controller nodes for a MPC8347 SoC: | 45 | Example of gpio-controller nodes for a MPC8347 SoC: |
20 | 46 | ||
@@ -22,39 +48,27 @@ Example of gpio-controller nodes for a MPC8347 SoC: | |||
22 | #gpio-cells = <2>; | 48 | #gpio-cells = <2>; |
23 | compatible = "fsl,mpc8347-gpio", "fsl,mpc8349-gpio"; | 49 | compatible = "fsl,mpc8347-gpio", "fsl,mpc8349-gpio"; |
24 | reg = <0xc00 0x100>; | 50 | reg = <0xc00 0x100>; |
25 | interrupts = <74 0x8>; | ||
26 | interrupt-parent = <&ipic>; | 51 | interrupt-parent = <&ipic>; |
52 | interrupts = <74 0x8>; | ||
27 | gpio-controller; | 53 | gpio-controller; |
54 | interrupt-controller; | ||
55 | #interrupt-cells = <2>; | ||
28 | }; | 56 | }; |
29 | 57 | ||
30 | gpio2: gpio-controller@d00 { | 58 | gpio2: gpio-controller@d00 { |
31 | #gpio-cells = <2>; | 59 | #gpio-cells = <2>; |
32 | compatible = "fsl,mpc8347-gpio", "fsl,mpc8349-gpio"; | 60 | compatible = "fsl,mpc8347-gpio", "fsl,mpc8349-gpio"; |
33 | reg = <0xd00 0x100>; | 61 | reg = <0xd00 0x100>; |
34 | interrupts = <75 0x8>; | ||
35 | interrupt-parent = <&ipic>; | 62 | interrupt-parent = <&ipic>; |
63 | interrupts = <75 0x8>; | ||
36 | gpio-controller; | 64 | gpio-controller; |
37 | }; | 65 | }; |
38 | 66 | ||
39 | See booting-without-of.txt for details of how to specify GPIO | 67 | Example of a peripheral using the GPIO module as an IRQ controller: |
40 | information for devices. | ||
41 | |||
42 | To use GPIO pins as interrupt sources for peripherals, specify the | ||
43 | GPIO controller as the interrupt parent and define GPIO number + | ||
44 | trigger mode using the interrupts property, which is defined like | ||
45 | this: | ||
46 | |||
47 | interrupts = <number trigger>, where: | ||
48 | - number: GPIO pin (0..31) | ||
49 | - trigger: trigger mode: | ||
50 | 2 = trigger on falling edge | ||
51 | 3 = trigger on both edges | ||
52 | |||
53 | Example of device using this is: | ||
54 | 68 | ||
55 | funkyfpga@0 { | 69 | funkyfpga@0 { |
56 | compatible = "funky-fpga"; | 70 | compatible = "funky-fpga"; |
57 | ... | 71 | ... |
58 | interrupts = <4 3>; | ||
59 | interrupt-parent = <&gpio1>; | 72 | interrupt-parent = <&gpio1>; |
73 | interrupts = <4 3>; | ||
60 | }; | 74 | }; |
diff --git a/Documentation/devicetree/bindings/gpio/gpio-davinci.txt b/Documentation/devicetree/bindings/gpio/gpio-davinci.txt new file mode 100644 index 000000000000..a2e839d6e338 --- /dev/null +++ b/Documentation/devicetree/bindings/gpio/gpio-davinci.txt | |||
@@ -0,0 +1,41 @@ | |||
1 | Davinci GPIO controller bindings | ||
2 | |||
3 | Required Properties: | ||
4 | - compatible: should be "ti,dm6441-gpio" | ||
5 | |||
6 | - reg: Physical base address of the controller and the size of memory mapped | ||
7 | registers. | ||
8 | |||
9 | - gpio-controller : Marks the device node as a gpio controller. | ||
10 | |||
11 | - interrupt-parent: phandle of the parent interrupt controller. | ||
12 | |||
13 | - interrupts: Array of GPIO interrupt number. Only banked or unbanked IRQs are | ||
14 | supported at a time. | ||
15 | |||
16 | - ti,ngpio: The number of GPIO pins supported. | ||
17 | |||
18 | - ti,davinci-gpio-unbanked: The number of GPIOs that have an individual interrupt | ||
19 | line to processor. | ||
20 | |||
21 | The GPIO controller also acts as an interrupt controller. It uses the default | ||
22 | two cells specifier as described in Documentation/devicetree/bindings/ | ||
23 | interrupt-controller/interrupts.txt. | ||
24 | |||
25 | Example: | ||
26 | |||
27 | gpio: gpio@1e26000 { | ||
28 | compatible = "ti,dm6441-gpio"; | ||
29 | gpio-controller; | ||
30 | reg = <0x226000 0x1000>; | ||
31 | interrupt-parent = <&intc>; | ||
32 | interrupts = <42 IRQ_TYPE_EDGE_BOTH 43 IRQ_TYPE_EDGE_BOTH | ||
33 | 44 IRQ_TYPE_EDGE_BOTH 45 IRQ_TYPE_EDGE_BOTH | ||
34 | 46 IRQ_TYPE_EDGE_BOTH 47 IRQ_TYPE_EDGE_BOTH | ||
35 | 48 IRQ_TYPE_EDGE_BOTH 49 IRQ_TYPE_EDGE_BOTH | ||
36 | 50 IRQ_TYPE_EDGE_BOTH>; | ||
37 | ti,ngpio = <144>; | ||
38 | ti,davinci-gpio-unbanked = <0>; | ||
39 | interrupt-controller; | ||
40 | #interrupt-cells = <2>; | ||
41 | }; | ||
diff --git a/Documentation/devicetree/bindings/mmc/ti-omap.txt b/Documentation/devicetree/bindings/mmc/ti-omap.txt new file mode 100644 index 000000000000..8de579969763 --- /dev/null +++ b/Documentation/devicetree/bindings/mmc/ti-omap.txt | |||
@@ -0,0 +1,54 @@ | |||
1 | * TI MMC host controller for OMAP1 and 2420 | ||
2 | |||
3 | The MMC Host Controller on TI OMAP1 and 2420 family provides | ||
4 | an interface for MMC, SD, and SDIO types of memory cards. | ||
5 | |||
6 | This file documents differences between the core properties described | ||
7 | by mmc.txt and the properties used by the omap mmc driver. | ||
8 | |||
9 | Note that this driver will not work with omap2430 or later omaps, | ||
10 | please see the omap hsmmc driver for the current omaps. | ||
11 | |||
12 | Required properties: | ||
13 | - compatible: Must be "ti,omap2420-mmc", for OMAP2420 controllers | ||
14 | - ti,hwmods: For 2420, must be "msdi<n>", where n is controller | ||
15 | instance starting 1 | ||
16 | |||
17 | Examples: | ||
18 | |||
19 | msdi1: mmc@4809c000 { | ||
20 | compatible = "ti,omap2420-mmc"; | ||
21 | ti,hwmods = "msdi1"; | ||
22 | reg = <0x4809c000 0x80>; | ||
23 | interrupts = <83>; | ||
24 | dmas = <&sdma 61 &sdma 62>; | ||
25 | dma-names = "tx", "rx"; | ||
26 | }; | ||
27 | |||
28 | * TI MMC host controller for OMAP1 and 2420 | ||
29 | |||
30 | The MMC Host Controller on TI OMAP1 and 2420 family provides | ||
31 | an interface for MMC, SD, and SDIO types of memory cards. | ||
32 | |||
33 | This file documents differences between the core properties described | ||
34 | by mmc.txt and the properties used by the omap mmc driver. | ||
35 | |||
36 | Note that this driver will not work with omap2430 or later omaps, | ||
37 | please see the omap hsmmc driver for the current omaps. | ||
38 | |||
39 | Required properties: | ||
40 | - compatible: Must be "ti,omap2420-mmc", for OMAP2420 controllers | ||
41 | - ti,hwmods: For 2420, must be "msdi<n>", where n is controller | ||
42 | instance starting 1 | ||
43 | |||
44 | Examples: | ||
45 | |||
46 | msdi1: mmc@4809c000 { | ||
47 | compatible = "ti,omap2420-mmc"; | ||
48 | ti,hwmods = "msdi1"; | ||
49 | reg = <0x4809c000 0x80>; | ||
50 | interrupts = <83>; | ||
51 | dmas = <&sdma 61 &sdma 62>; | ||
52 | dma-names = "tx", "rx"; | ||
53 | }; | ||
54 | |||
diff --git a/Documentation/devicetree/bindings/net/davinci_emac.txt b/Documentation/devicetree/bindings/net/davinci_emac.txt index 48b259e29e87..bad381faf036 100644 --- a/Documentation/devicetree/bindings/net/davinci_emac.txt +++ b/Documentation/devicetree/bindings/net/davinci_emac.txt | |||
@@ -4,7 +4,7 @@ This file provides information, what the device node | |||
4 | for the davinci_emac interface contains. | 4 | for the davinci_emac interface contains. |
5 | 5 | ||
6 | Required properties: | 6 | Required properties: |
7 | - compatible: "ti,davinci-dm6467-emac"; | 7 | - compatible: "ti,davinci-dm6467-emac" or "ti,am3517-emac" |
8 | - reg: Offset and length of the register set for the device | 8 | - reg: Offset and length of the register set for the device |
9 | - ti,davinci-ctrl-reg-offset: offset to control register | 9 | - ti,davinci-ctrl-reg-offset: offset to control register |
10 | - ti,davinci-ctrl-mod-reg-offset: offset to control module register | 10 | - ti,davinci-ctrl-mod-reg-offset: offset to control module register |
diff --git a/Documentation/devicetree/bindings/net/fsl-fec.txt b/Documentation/devicetree/bindings/net/fsl-fec.txt index d53639221403..845ff848d895 100644 --- a/Documentation/devicetree/bindings/net/fsl-fec.txt +++ b/Documentation/devicetree/bindings/net/fsl-fec.txt | |||
@@ -15,6 +15,7 @@ Optional properties: | |||
15 | only if property "phy-reset-gpios" is available. Missing the property | 15 | only if property "phy-reset-gpios" is available. Missing the property |
16 | will have the duration be 1 millisecond. Numbers greater than 1000 are | 16 | will have the duration be 1 millisecond. Numbers greater than 1000 are |
17 | invalid and 1 millisecond will be used instead. | 17 | invalid and 1 millisecond will be used instead. |
18 | - phy-supply: regulator that powers the Ethernet PHY. | ||
18 | 19 | ||
19 | Example: | 20 | Example: |
20 | 21 | ||
@@ -25,4 +26,5 @@ ethernet@83fec000 { | |||
25 | phy-mode = "mii"; | 26 | phy-mode = "mii"; |
26 | phy-reset-gpios = <&gpio2 14 0>; /* GPIO2_14 */ | 27 | phy-reset-gpios = <&gpio2 14 0>; /* GPIO2_14 */ |
27 | local-mac-address = [00 04 9F 01 1B B9]; | 28 | local-mac-address = [00 04 9F 01 1B B9]; |
29 | phy-supply = <®_fec_supply>; | ||
28 | }; | 30 | }; |
diff --git a/Documentation/devicetree/bindings/net/smsc-lan91c111.txt b/Documentation/devicetree/bindings/net/smsc-lan91c111.txt index 953049b4248a..5a41a8658daa 100644 --- a/Documentation/devicetree/bindings/net/smsc-lan91c111.txt +++ b/Documentation/devicetree/bindings/net/smsc-lan91c111.txt | |||
@@ -8,3 +8,7 @@ Required properties: | |||
8 | Optional properties: | 8 | Optional properties: |
9 | - phy-device : phandle to Ethernet phy | 9 | - phy-device : phandle to Ethernet phy |
10 | - local-mac-address : Ethernet mac address to use | 10 | - local-mac-address : Ethernet mac address to use |
11 | - reg-io-width : Mask of sizes (in bytes) of the IO accesses that | ||
12 | are supported on the device. Valid value for SMSC LAN91c111 are | ||
13 | 1, 2 or 4. If it's omitted or invalid, the size would be 2 meaning | ||
14 | 16-bit access only. | ||
diff --git a/Documentation/devicetree/bindings/spi/nvidia,tegra20-spi.txt b/Documentation/devicetree/bindings/spi/nvidia,tegra20-spi.txt deleted file mode 100644 index 6b9e51896693..000000000000 --- a/Documentation/devicetree/bindings/spi/nvidia,tegra20-spi.txt +++ /dev/null | |||
@@ -1,5 +0,0 @@ | |||
1 | NVIDIA Tegra 2 SPI device | ||
2 | |||
3 | Required properties: | ||
4 | - compatible : should be "nvidia,tegra20-spi". | ||
5 | - gpios : should specify GPIOs used for chipselect. | ||
diff --git a/Documentation/devicetree/bindings/vendor-prefixes.txt b/Documentation/devicetree/bindings/vendor-prefixes.txt index 4da33c407de1..2652b9e1ccc7 100644 --- a/Documentation/devicetree/bindings/vendor-prefixes.txt +++ b/Documentation/devicetree/bindings/vendor-prefixes.txt | |||
@@ -32,6 +32,7 @@ est ESTeem Wireless Modems | |||
32 | fsl Freescale Semiconductor | 32 | fsl Freescale Semiconductor |
33 | GEFanuc GE Fanuc Intelligent Platforms Embedded Systems, Inc. | 33 | GEFanuc GE Fanuc Intelligent Platforms Embedded Systems, Inc. |
34 | gef GE Fanuc Intelligent Platforms Embedded Systems, Inc. | 34 | gef GE Fanuc Intelligent Platforms Embedded Systems, Inc. |
35 | gmt Global Mixed-mode Technology, Inc. | ||
35 | hisilicon Hisilicon Limited. | 36 | hisilicon Hisilicon Limited. |
36 | hp Hewlett Packard | 37 | hp Hewlett Packard |
37 | ibm International Business Machines (IBM) | 38 | ibm International Business Machines (IBM) |
@@ -39,6 +40,7 @@ idt Integrated Device Technologies, Inc. | |||
39 | img Imagination Technologies Ltd. | 40 | img Imagination Technologies Ltd. |
40 | intercontrol Inter Control Group | 41 | intercontrol Inter Control Group |
41 | isl Intersil | 42 | isl Intersil |
43 | lg LG Corporation | ||
42 | linux Linux-specific binding | 44 | linux Linux-specific binding |
43 | lsi LSI Corp. (LSI Logic) | 45 | lsi LSI Corp. (LSI Logic) |
44 | marvell Marvell Technology Group Ltd. | 46 | marvell Marvell Technology Group Ltd. |
diff --git a/Documentation/gpio/00-INDEX b/Documentation/gpio/00-INDEX new file mode 100644 index 000000000000..1de43ae46ae6 --- /dev/null +++ b/Documentation/gpio/00-INDEX | |||
@@ -0,0 +1,14 @@ | |||
1 | 00-INDEX | ||
2 | - This file | ||
3 | gpio.txt | ||
4 | - Introduction to GPIOs and their kernel interfaces | ||
5 | consumer.txt | ||
6 | - How to obtain and use GPIOs in a driver | ||
7 | driver.txt | ||
8 | - How to write a GPIO driver | ||
9 | board.txt | ||
10 | - How to assign GPIOs to a consumer device and a function | ||
11 | sysfs.txt | ||
12 | - Information about the GPIO sysfs interface | ||
13 | gpio-legacy.txt | ||
14 | - Historical documentation of the deprecated GPIO integer interface | ||
diff --git a/Documentation/mic/mpssd/mpssd.c b/Documentation/mic/mpssd/mpssd.c index 0c980ad40b17..4d17487d5ad9 100644 --- a/Documentation/mic/mpssd/mpssd.c +++ b/Documentation/mic/mpssd/mpssd.c | |||
@@ -313,7 +313,7 @@ static struct mic_device_desc *get_device_desc(struct mic_info *mic, int type) | |||
313 | int i; | 313 | int i; |
314 | void *dp = get_dp(mic, type); | 314 | void *dp = get_dp(mic, type); |
315 | 315 | ||
316 | for (i = mic_aligned_size(struct mic_bootparam); i < PAGE_SIZE; | 316 | for (i = sizeof(struct mic_bootparam); i < PAGE_SIZE; |
317 | i += mic_total_desc_size(d)) { | 317 | i += mic_total_desc_size(d)) { |
318 | d = dp + i; | 318 | d = dp + i; |
319 | 319 | ||
@@ -445,8 +445,8 @@ init_vr(struct mic_info *mic, int fd, int type, | |||
445 | __func__, mic->name, vr0->va, vr0->info, vr_size, | 445 | __func__, mic->name, vr0->va, vr0->info, vr_size, |
446 | vring_size(MIC_VRING_ENTRIES, MIC_VIRTIO_RING_ALIGN)); | 446 | vring_size(MIC_VRING_ENTRIES, MIC_VIRTIO_RING_ALIGN)); |
447 | mpsslog("magic 0x%x expected 0x%x\n", | 447 | mpsslog("magic 0x%x expected 0x%x\n", |
448 | vr0->info->magic, MIC_MAGIC + type); | 448 | le32toh(vr0->info->magic), MIC_MAGIC + type); |
449 | assert(vr0->info->magic == MIC_MAGIC + type); | 449 | assert(le32toh(vr0->info->magic) == MIC_MAGIC + type); |
450 | if (vr1) { | 450 | if (vr1) { |
451 | vr1->va = (struct mic_vring *) | 451 | vr1->va = (struct mic_vring *) |
452 | &va[MIC_DEVICE_PAGE_END + vr_size]; | 452 | &va[MIC_DEVICE_PAGE_END + vr_size]; |
@@ -458,8 +458,8 @@ init_vr(struct mic_info *mic, int fd, int type, | |||
458 | __func__, mic->name, vr1->va, vr1->info, vr_size, | 458 | __func__, mic->name, vr1->va, vr1->info, vr_size, |
459 | vring_size(MIC_VRING_ENTRIES, MIC_VIRTIO_RING_ALIGN)); | 459 | vring_size(MIC_VRING_ENTRIES, MIC_VIRTIO_RING_ALIGN)); |
460 | mpsslog("magic 0x%x expected 0x%x\n", | 460 | mpsslog("magic 0x%x expected 0x%x\n", |
461 | vr1->info->magic, MIC_MAGIC + type + 1); | 461 | le32toh(vr1->info->magic), MIC_MAGIC + type + 1); |
462 | assert(vr1->info->magic == MIC_MAGIC + type + 1); | 462 | assert(le32toh(vr1->info->magic) == MIC_MAGIC + type + 1); |
463 | } | 463 | } |
464 | done: | 464 | done: |
465 | return va; | 465 | return va; |
@@ -520,7 +520,7 @@ static void * | |||
520 | virtio_net(void *arg) | 520 | virtio_net(void *arg) |
521 | { | 521 | { |
522 | static __u8 vnet_hdr[2][sizeof(struct virtio_net_hdr)]; | 522 | static __u8 vnet_hdr[2][sizeof(struct virtio_net_hdr)]; |
523 | static __u8 vnet_buf[2][MAX_NET_PKT_SIZE] __aligned(64); | 523 | static __u8 vnet_buf[2][MAX_NET_PKT_SIZE] __attribute__ ((aligned(64))); |
524 | struct iovec vnet_iov[2][2] = { | 524 | struct iovec vnet_iov[2][2] = { |
525 | { { .iov_base = vnet_hdr[0], .iov_len = sizeof(vnet_hdr[0]) }, | 525 | { { .iov_base = vnet_hdr[0], .iov_len = sizeof(vnet_hdr[0]) }, |
526 | { .iov_base = vnet_buf[0], .iov_len = sizeof(vnet_buf[0]) } }, | 526 | { .iov_base = vnet_buf[0], .iov_len = sizeof(vnet_buf[0]) } }, |
@@ -1412,6 +1412,12 @@ mic_config(void *arg) | |||
1412 | } | 1412 | } |
1413 | 1413 | ||
1414 | do { | 1414 | do { |
1415 | ret = lseek(fd, 0, SEEK_SET); | ||
1416 | if (ret < 0) { | ||
1417 | mpsslog("%s: Failed to seek to file start '%s': %s\n", | ||
1418 | mic->name, pathname, strerror(errno)); | ||
1419 | goto close_error1; | ||
1420 | } | ||
1415 | ret = read(fd, value, sizeof(value)); | 1421 | ret = read(fd, value, sizeof(value)); |
1416 | if (ret < 0) { | 1422 | if (ret < 0) { |
1417 | mpsslog("%s: Failed to read sysfs entry '%s': %s\n", | 1423 | mpsslog("%s: Failed to read sysfs entry '%s': %s\n", |
diff --git a/Documentation/networking/packet_mmap.txt b/Documentation/networking/packet_mmap.txt index c01223628a87..8e48e3b14227 100644 --- a/Documentation/networking/packet_mmap.txt +++ b/Documentation/networking/packet_mmap.txt | |||
@@ -123,6 +123,16 @@ Transmission process is similar to capture as shown below. | |||
123 | [shutdown] close() --------> destruction of the transmission socket and | 123 | [shutdown] close() --------> destruction of the transmission socket and |
124 | deallocation of all associated resources. | 124 | deallocation of all associated resources. |
125 | 125 | ||
126 | Socket creation and destruction is also straight forward, and is done | ||
127 | the same way as in capturing described in the previous paragraph: | ||
128 | |||
129 | int fd = socket(PF_PACKET, mode, 0); | ||
130 | |||
131 | The protocol can optionally be 0 in case we only want to transmit | ||
132 | via this socket, which avoids an expensive call to packet_rcv(). | ||
133 | In this case, you also need to bind(2) the TX_RING with sll_protocol = 0 | ||
134 | set. Otherwise, htons(ETH_P_ALL) or any other protocol, for example. | ||
135 | |||
126 | Binding the socket to your network interface is mandatory (with zero copy) to | 136 | Binding the socket to your network interface is mandatory (with zero copy) to |
127 | know the header size of frames used in the circular buffer. | 137 | know the header size of frames used in the circular buffer. |
128 | 138 | ||
diff --git a/MAINTAINERS b/MAINTAINERS index f216db847022..1344816c4c06 100644 --- a/MAINTAINERS +++ b/MAINTAINERS | |||
@@ -893,20 +893,15 @@ F: arch/arm/include/asm/hardware/dec21285.h | |||
893 | F: arch/arm/mach-footbridge/ | 893 | F: arch/arm/mach-footbridge/ |
894 | 894 | ||
895 | ARM/FREESCALE IMX / MXC ARM ARCHITECTURE | 895 | ARM/FREESCALE IMX / MXC ARM ARCHITECTURE |
896 | M: Shawn Guo <shawn.guo@linaro.org> | ||
896 | M: Sascha Hauer <kernel@pengutronix.de> | 897 | M: Sascha Hauer <kernel@pengutronix.de> |
897 | L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) | 898 | L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) |
898 | S: Maintained | 899 | S: Maintained |
899 | T: git git://git.pengutronix.de/git/imx/linux-2.6.git | 900 | T: git git://git.linaro.org/people/shawnguo/linux-2.6.git |
900 | F: arch/arm/mach-imx/ | 901 | F: arch/arm/mach-imx/ |
902 | F: arch/arm/boot/dts/imx* | ||
901 | F: arch/arm/configs/imx*_defconfig | 903 | F: arch/arm/configs/imx*_defconfig |
902 | 904 | ||
903 | ARM/FREESCALE IMX6 | ||
904 | M: Shawn Guo <shawn.guo@linaro.org> | ||
905 | L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) | ||
906 | S: Maintained | ||
907 | T: git git://git.linaro.org/people/shawnguo/linux-2.6.git | ||
908 | F: arch/arm/mach-imx/*imx6* | ||
909 | |||
910 | ARM/FREESCALE MXS ARM ARCHITECTURE | 905 | ARM/FREESCALE MXS ARM ARCHITECTURE |
911 | M: Shawn Guo <shawn.guo@linaro.org> | 906 | M: Shawn Guo <shawn.guo@linaro.org> |
912 | L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) | 907 | L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) |
@@ -1934,7 +1929,8 @@ S: Maintained | |||
1934 | F: drivers/gpio/gpio-bt8xx.c | 1929 | F: drivers/gpio/gpio-bt8xx.c |
1935 | 1930 | ||
1936 | BTRFS FILE SYSTEM | 1931 | BTRFS FILE SYSTEM |
1937 | M: Chris Mason <chris.mason@fusionio.com> | 1932 | M: Chris Mason <clm@fb.com> |
1933 | M: Josef Bacik <jbacik@fb.com> | ||
1938 | L: linux-btrfs@vger.kernel.org | 1934 | L: linux-btrfs@vger.kernel.org |
1939 | W: http://btrfs.wiki.kernel.org/ | 1935 | W: http://btrfs.wiki.kernel.org/ |
1940 | Q: http://patchwork.kernel.org/project/linux-btrfs/list/ | 1936 | Q: http://patchwork.kernel.org/project/linux-btrfs/list/ |
@@ -2137,7 +2133,8 @@ S: Maintained | |||
2137 | F: Documentation/zh_CN/ | 2133 | F: Documentation/zh_CN/ |
2138 | 2134 | ||
2139 | CHIPIDEA USB HIGH SPEED DUAL ROLE CONTROLLER | 2135 | CHIPIDEA USB HIGH SPEED DUAL ROLE CONTROLLER |
2140 | M: Alexander Shishkin <alexander.shishkin@linux.intel.com> | 2136 | M: Peter Chen <Peter.Chen@freescale.com> |
2137 | T: git://github.com/hzpeterchen/linux-usb.git | ||
2141 | L: linux-usb@vger.kernel.org | 2138 | L: linux-usb@vger.kernel.org |
2142 | S: Maintained | 2139 | S: Maintained |
2143 | F: drivers/usb/chipidea/ | 2140 | F: drivers/usb/chipidea/ |
@@ -4043,12 +4040,26 @@ W: http://artax.karlin.mff.cuni.cz/~mikulas/vyplody/hpfs/index-e.cgi | |||
4043 | S: Maintained | 4040 | S: Maintained |
4044 | F: fs/hpfs/ | 4041 | F: fs/hpfs/ |
4045 | 4042 | ||
4043 | HSI SUBSYSTEM | ||
4044 | M: Sebastian Reichel <sre@debian.org> | ||
4045 | S: Maintained | ||
4046 | F: Documentation/ABI/testing/sysfs-bus-hsi | ||
4047 | F: drivers/hsi/ | ||
4048 | F: include/linux/hsi/ | ||
4049 | F: include/uapi/linux/hsi/ | ||
4050 | |||
4046 | HSO 3G MODEM DRIVER | 4051 | HSO 3G MODEM DRIVER |
4047 | M: Jan Dumon <j.dumon@option.com> | 4052 | M: Jan Dumon <j.dumon@option.com> |
4048 | W: http://www.pharscape.org | 4053 | W: http://www.pharscape.org |
4049 | S: Maintained | 4054 | S: Maintained |
4050 | F: drivers/net/usb/hso.c | 4055 | F: drivers/net/usb/hso.c |
4051 | 4056 | ||
4057 | HSR NETWORK PROTOCOL | ||
4058 | M: Arvid Brodin <arvid.brodin@alten.se> | ||
4059 | L: netdev@vger.kernel.org | ||
4060 | S: Maintained | ||
4061 | F: net/hsr/ | ||
4062 | |||
4052 | HTCPEN TOUCHSCREEN DRIVER | 4063 | HTCPEN TOUCHSCREEN DRIVER |
4053 | M: Pau Oliva Fora <pof@eslack.org> | 4064 | M: Pau Oliva Fora <pof@eslack.org> |
4054 | L: linux-input@vger.kernel.org | 4065 | L: linux-input@vger.kernel.org |
@@ -4455,10 +4466,8 @@ M: Bruce Allan <bruce.w.allan@intel.com> | |||
4455 | M: Carolyn Wyborny <carolyn.wyborny@intel.com> | 4466 | M: Carolyn Wyborny <carolyn.wyborny@intel.com> |
4456 | M: Don Skidmore <donald.c.skidmore@intel.com> | 4467 | M: Don Skidmore <donald.c.skidmore@intel.com> |
4457 | M: Greg Rose <gregory.v.rose@intel.com> | 4468 | M: Greg Rose <gregory.v.rose@intel.com> |
4458 | M: Peter P Waskiewicz Jr <peter.p.waskiewicz.jr@intel.com> | ||
4459 | M: Alex Duyck <alexander.h.duyck@intel.com> | 4469 | M: Alex Duyck <alexander.h.duyck@intel.com> |
4460 | M: John Ronciak <john.ronciak@intel.com> | 4470 | M: John Ronciak <john.ronciak@intel.com> |
4461 | M: Tushar Dave <tushar.n.dave@intel.com> | ||
4462 | L: e1000-devel@lists.sourceforge.net | 4471 | L: e1000-devel@lists.sourceforge.net |
4463 | W: http://www.intel.com/support/feedback.htm | 4472 | W: http://www.intel.com/support/feedback.htm |
4464 | W: http://e1000.sourceforge.net/ | 4473 | W: http://e1000.sourceforge.net/ |
@@ -5261,7 +5270,7 @@ S: Maintained | |||
5261 | F: Documentation/lockdep*.txt | 5270 | F: Documentation/lockdep*.txt |
5262 | F: Documentation/lockstat.txt | 5271 | F: Documentation/lockstat.txt |
5263 | F: include/linux/lockdep.h | 5272 | F: include/linux/lockdep.h |
5264 | F: kernel/lockdep* | 5273 | F: kernel/locking/ |
5265 | 5274 | ||
5266 | LOGICAL DISK MANAGER SUPPORT (LDM, Windows 2000/XP/Vista Dynamic Disks) | 5275 | LOGICAL DISK MANAGER SUPPORT (LDM, Windows 2000/XP/Vista Dynamic Disks) |
5267 | M: "Richard Russon (FlatCap)" <ldm@flatcap.org> | 5276 | M: "Richard Russon (FlatCap)" <ldm@flatcap.org> |
@@ -5973,10 +5982,10 @@ F: drivers/nfc/ | |||
5973 | F: include/linux/platform_data/pn544.h | 5982 | F: include/linux/platform_data/pn544.h |
5974 | 5983 | ||
5975 | NFS, SUNRPC, AND LOCKD CLIENTS | 5984 | NFS, SUNRPC, AND LOCKD CLIENTS |
5976 | M: Trond Myklebust <Trond.Myklebust@netapp.com> | 5985 | M: Trond Myklebust <trond.myklebust@primarydata.com> |
5977 | L: linux-nfs@vger.kernel.org | 5986 | L: linux-nfs@vger.kernel.org |
5978 | W: http://client.linux-nfs.org | 5987 | W: http://client.linux-nfs.org |
5979 | T: git git://git.linux-nfs.org/pub/linux/nfs-2.6.git | 5988 | T: git git://git.linux-nfs.org/projects/trondmy/linux-nfs.git |
5980 | S: Maintained | 5989 | S: Maintained |
5981 | F: fs/lockd/ | 5990 | F: fs/lockd/ |
5982 | F: fs/nfs/ | 5991 | F: fs/nfs/ |
@@ -6243,8 +6252,8 @@ OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS | |||
6243 | M: Rob Herring <rob.herring@calxeda.com> | 6252 | M: Rob Herring <rob.herring@calxeda.com> |
6244 | M: Pawel Moll <pawel.moll@arm.com> | 6253 | M: Pawel Moll <pawel.moll@arm.com> |
6245 | M: Mark Rutland <mark.rutland@arm.com> | 6254 | M: Mark Rutland <mark.rutland@arm.com> |
6246 | M: Stephen Warren <swarren@wwwdotorg.org> | ||
6247 | M: Ian Campbell <ijc+devicetree@hellion.org.uk> | 6255 | M: Ian Campbell <ijc+devicetree@hellion.org.uk> |
6256 | M: Kumar Gala <galak@codeaurora.org> | ||
6248 | L: devicetree@vger.kernel.org | 6257 | L: devicetree@vger.kernel.org |
6249 | S: Maintained | 6258 | S: Maintained |
6250 | F: Documentation/devicetree/ | 6259 | F: Documentation/devicetree/ |
@@ -6454,19 +6463,52 @@ F: drivers/pci/ | |||
6454 | F: include/linux/pci* | 6463 | F: include/linux/pci* |
6455 | F: arch/x86/pci/ | 6464 | F: arch/x86/pci/ |
6456 | 6465 | ||
6466 | PCI DRIVER FOR IMX6 | ||
6467 | M: Richard Zhu <r65037@freescale.com> | ||
6468 | M: Shawn Guo <shawn.guo@linaro.org> | ||
6469 | L: linux-pci@vger.kernel.org | ||
6470 | L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) | ||
6471 | S: Maintained | ||
6472 | F: drivers/pci/host/*imx6* | ||
6473 | |||
6474 | PCI DRIVER FOR MVEBU (Marvell Armada 370 and Armada XP SOC support) | ||
6475 | M: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> | ||
6476 | M: Jason Cooper <jason@lakedaemon.net> | ||
6477 | L: linux-pci@vger.kernel.org | ||
6478 | L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) | ||
6479 | S: Maintained | ||
6480 | F: drivers/pci/host/*mvebu* | ||
6481 | |||
6457 | PCI DRIVER FOR NVIDIA TEGRA | 6482 | PCI DRIVER FOR NVIDIA TEGRA |
6458 | M: Thierry Reding <thierry.reding@gmail.com> | 6483 | M: Thierry Reding <thierry.reding@gmail.com> |
6459 | L: linux-tegra@vger.kernel.org | 6484 | L: linux-tegra@vger.kernel.org |
6485 | L: linux-pci@vger.kernel.org | ||
6460 | S: Supported | 6486 | S: Supported |
6461 | F: Documentation/devicetree/bindings/pci/nvidia,tegra20-pcie.txt | 6487 | F: Documentation/devicetree/bindings/pci/nvidia,tegra20-pcie.txt |
6462 | F: drivers/pci/host/pci-tegra.c | 6488 | F: drivers/pci/host/pci-tegra.c |
6463 | 6489 | ||
6490 | PCI DRIVER FOR RENESAS R-CAR | ||
6491 | M: Simon Horman <horms@verge.net.au> | ||
6492 | L: linux-pci@vger.kernel.org | ||
6493 | L: linux-sh@vger.kernel.org | ||
6494 | S: Maintained | ||
6495 | F: drivers/pci/host/*rcar* | ||
6496 | |||
6464 | PCI DRIVER FOR SAMSUNG EXYNOS | 6497 | PCI DRIVER FOR SAMSUNG EXYNOS |
6465 | M: Jingoo Han <jg1.han@samsung.com> | 6498 | M: Jingoo Han <jg1.han@samsung.com> |
6466 | L: linux-pci@vger.kernel.org | 6499 | L: linux-pci@vger.kernel.org |
6500 | L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) | ||
6501 | L: linux-samsung-soc@vger.kernel.org (moderated for non-subscribers) | ||
6467 | S: Maintained | 6502 | S: Maintained |
6468 | F: drivers/pci/host/pci-exynos.c | 6503 | F: drivers/pci/host/pci-exynos.c |
6469 | 6504 | ||
6505 | PCI DRIVER FOR SYNOPSIS DESIGNWARE | ||
6506 | M: Mohit Kumar <mohit.kumar@st.com> | ||
6507 | M: Jingoo Han <jg1.han@samsung.com> | ||
6508 | L: linux-pci@vger.kernel.org | ||
6509 | S: Maintained | ||
6510 | F: drivers/pci/host/*designware* | ||
6511 | |||
6470 | PCMCIA SUBSYSTEM | 6512 | PCMCIA SUBSYSTEM |
6471 | P: Linux PCMCIA Team | 6513 | P: Linux PCMCIA Team |
6472 | L: linux-pcmcia@lists.infradead.org | 6514 | L: linux-pcmcia@lists.infradead.org |
@@ -7385,7 +7427,6 @@ S: Maintained | |||
7385 | F: kernel/sched/ | 7427 | F: kernel/sched/ |
7386 | F: include/linux/sched.h | 7428 | F: include/linux/sched.h |
7387 | F: include/uapi/linux/sched.h | 7429 | F: include/uapi/linux/sched.h |
7388 | F: kernel/wait.c | ||
7389 | F: include/linux/wait.h | 7430 | F: include/linux/wait.h |
7390 | 7431 | ||
7391 | SCORE ARCHITECTURE | 7432 | SCORE ARCHITECTURE |
@@ -1,7 +1,7 @@ | |||
1 | VERSION = 3 | 1 | VERSION = 3 |
2 | PATCHLEVEL = 13 | 2 | PATCHLEVEL = 13 |
3 | SUBLEVEL = 0 | 3 | SUBLEVEL = 0 |
4 | EXTRAVERSION = -rc2 | 4 | EXTRAVERSION = -rc4 |
5 | NAME = One Giant Leap for Frogkind | 5 | NAME = One Giant Leap for Frogkind |
6 | 6 | ||
7 | # *DOCUMENTATION* | 7 | # *DOCUMENTATION* |
diff --git a/arch/arc/Kconfig b/arch/arc/Kconfig index 2ee0c9bfd032..9063ae6553cc 100644 --- a/arch/arc/Kconfig +++ b/arch/arc/Kconfig | |||
@@ -8,6 +8,7 @@ | |||
8 | 8 | ||
9 | config ARC | 9 | config ARC |
10 | def_bool y | 10 | def_bool y |
11 | select BUILDTIME_EXTABLE_SORT | ||
11 | select CLONE_BACKWARDS | 12 | select CLONE_BACKWARDS |
12 | # ARC Busybox based initramfs absolutely relies on DEVTMPFS for /dev | 13 | # ARC Busybox based initramfs absolutely relies on DEVTMPFS for /dev |
13 | select DEVTMPFS if !INITRAMFS_SOURCE="" | 14 | select DEVTMPFS if !INITRAMFS_SOURCE="" |
diff --git a/arch/arc/include/uapi/asm/unistd.h b/arch/arc/include/uapi/asm/unistd.h index 6f30484f34b7..68125dd766c6 100644 --- a/arch/arc/include/uapi/asm/unistd.h +++ b/arch/arc/include/uapi/asm/unistd.h | |||
@@ -8,6 +8,9 @@ | |||
8 | 8 | ||
9 | /******** no-legacy-syscalls-ABI *******/ | 9 | /******** no-legacy-syscalls-ABI *******/ |
10 | 10 | ||
11 | #ifndef _UAPI_ASM_ARC_UNISTD_H | ||
12 | #define _UAPI_ASM_ARC_UNISTD_H | ||
13 | |||
11 | #define __ARCH_WANT_SYS_EXECVE | 14 | #define __ARCH_WANT_SYS_EXECVE |
12 | #define __ARCH_WANT_SYS_CLONE | 15 | #define __ARCH_WANT_SYS_CLONE |
13 | #define __ARCH_WANT_SYS_VFORK | 16 | #define __ARCH_WANT_SYS_VFORK |
@@ -32,3 +35,5 @@ __SYSCALL(__NR_arc_gettls, sys_arc_gettls) | |||
32 | /* Generic syscall (fs/filesystems.c - lost in asm-generic/unistd.h */ | 35 | /* Generic syscall (fs/filesystems.c - lost in asm-generic/unistd.h */ |
33 | #define __NR_sysfs (__NR_arch_specific_syscall + 3) | 36 | #define __NR_sysfs (__NR_arch_specific_syscall + 3) |
34 | __SYSCALL(__NR_sysfs, sys_sysfs) | 37 | __SYSCALL(__NR_sysfs, sys_sysfs) |
38 | |||
39 | #endif | ||
diff --git a/arch/arc/kernel/perf_event.c b/arch/arc/kernel/perf_event.c index e46d81f70979..63177e4cb66d 100644 --- a/arch/arc/kernel/perf_event.c +++ b/arch/arc/kernel/perf_event.c | |||
@@ -79,9 +79,9 @@ static int arc_pmu_cache_event(u64 config) | |||
79 | cache_result = (config >> 16) & 0xff; | 79 | cache_result = (config >> 16) & 0xff; |
80 | if (cache_type >= PERF_COUNT_HW_CACHE_MAX) | 80 | if (cache_type >= PERF_COUNT_HW_CACHE_MAX) |
81 | return -EINVAL; | 81 | return -EINVAL; |
82 | if (cache_type >= PERF_COUNT_HW_CACHE_OP_MAX) | 82 | if (cache_op >= PERF_COUNT_HW_CACHE_OP_MAX) |
83 | return -EINVAL; | 83 | return -EINVAL; |
84 | if (cache_type >= PERF_COUNT_HW_CACHE_RESULT_MAX) | 84 | if (cache_result >= PERF_COUNT_HW_CACHE_RESULT_MAX) |
85 | return -EINVAL; | 85 | return -EINVAL; |
86 | 86 | ||
87 | ret = arc_pmu_cache_map[cache_type][cache_op][cache_result]; | 87 | ret = arc_pmu_cache_map[cache_type][cache_op][cache_result]; |
diff --git a/arch/arm/boot/dts/am335x-base0033.dts b/arch/arm/boot/dts/am335x-base0033.dts index b4f95c2bbf74..72a9b3fc4251 100644 --- a/arch/arm/boot/dts/am335x-base0033.dts +++ b/arch/arm/boot/dts/am335x-base0033.dts | |||
@@ -13,4 +13,83 @@ | |||
13 | / { | 13 | / { |
14 | model = "IGEP COM AM335x on AQUILA Expansion"; | 14 | model = "IGEP COM AM335x on AQUILA Expansion"; |
15 | compatible = "isee,am335x-base0033", "isee,am335x-igep0033", "ti,am33xx"; | 15 | compatible = "isee,am335x-base0033", "isee,am335x-igep0033", "ti,am33xx"; |
16 | |||
17 | hdmi { | ||
18 | compatible = "ti,tilcdc,slave"; | ||
19 | i2c = <&i2c0>; | ||
20 | pinctrl-names = "default", "off"; | ||
21 | pinctrl-0 = <&nxp_hdmi_pins>; | ||
22 | pinctrl-1 = <&nxp_hdmi_off_pins>; | ||
23 | status = "okay"; | ||
24 | }; | ||
25 | |||
26 | leds_base { | ||
27 | pinctrl-names = "default"; | ||
28 | pinctrl-0 = <&leds_base_pins>; | ||
29 | |||
30 | compatible = "gpio-leds"; | ||
31 | |||
32 | led@0 { | ||
33 | label = "base:red:user"; | ||
34 | gpios = <&gpio1 21 GPIO_ACTIVE_HIGH>; /* gpio1_21 */ | ||
35 | default-state = "off"; | ||
36 | }; | ||
37 | |||
38 | led@1 { | ||
39 | label = "base:green:user"; | ||
40 | gpios = <&gpio2 0 GPIO_ACTIVE_HIGH>; /* gpio2_0 */ | ||
41 | default-state = "off"; | ||
42 | }; | ||
43 | }; | ||
44 | }; | ||
45 | |||
46 | &am33xx_pinmux { | ||
47 | nxp_hdmi_pins: pinmux_nxp_hdmi_pins { | ||
48 | pinctrl-single,pins = < | ||
49 | 0x1b0 (PIN_OUTPUT | MUX_MODE3) /* xdma_event_intr0.clkout1 */ | ||
50 | 0xa0 (PIN_OUTPUT | MUX_MODE0) /* lcd_data0 */ | ||
51 | 0xa4 (PIN_OUTPUT | MUX_MODE0) /* lcd_data1 */ | ||
52 | 0xa8 (PIN_OUTPUT | MUX_MODE0) /* lcd_data2 */ | ||
53 | 0xac (PIN_OUTPUT | MUX_MODE0) /* lcd_data3 */ | ||
54 | 0xb0 (PIN_OUTPUT | MUX_MODE0) /* lcd_data4 */ | ||
55 | 0xb4 (PIN_OUTPUT | MUX_MODE0) /* lcd_data5 */ | ||
56 | 0xb8 (PIN_OUTPUT | MUX_MODE0) /* lcd_data6 */ | ||
57 | 0xbc (PIN_OUTPUT | MUX_MODE0) /* lcd_data7 */ | ||
58 | 0xc0 (PIN_OUTPUT | MUX_MODE0) /* lcd_data8 */ | ||
59 | 0xc4 (PIN_OUTPUT | MUX_MODE0) /* lcd_data9 */ | ||
60 | 0xc8 (PIN_OUTPUT | MUX_MODE0) /* lcd_data10 */ | ||
61 | 0xcc (PIN_OUTPUT | MUX_MODE0) /* lcd_data11 */ | ||
62 | 0xd0 (PIN_OUTPUT | MUX_MODE0) /* lcd_data12 */ | ||
63 | 0xd4 (PIN_OUTPUT | MUX_MODE0) /* lcd_data13 */ | ||
64 | 0xd8 (PIN_OUTPUT | MUX_MODE0) /* lcd_data14 */ | ||
65 | 0xdc (PIN_OUTPUT | MUX_MODE0) /* lcd_data15 */ | ||
66 | 0xe0 (PIN_OUTPUT | MUX_MODE0) /* lcd_vsync */ | ||
67 | 0xe4 (PIN_OUTPUT | MUX_MODE0) /* lcd_hsync */ | ||
68 | 0xe8 (PIN_OUTPUT | MUX_MODE0) /* lcd_pclk */ | ||
69 | 0xec (PIN_OUTPUT | MUX_MODE0) /* lcd_ac_bias_en */ | ||
70 | >; | ||
71 | }; | ||
72 | nxp_hdmi_off_pins: pinmux_nxp_hdmi_off_pins { | ||
73 | pinctrl-single,pins = < | ||
74 | 0x1b0 (PIN_OUTPUT | MUX_MODE3) /* xdma_event_intr0.clkout1 */ | ||
75 | >; | ||
76 | }; | ||
77 | |||
78 | leds_base_pins: pinmux_leds_base_pins { | ||
79 | pinctrl-single,pins = < | ||
80 | 0x54 (PIN_OUTPUT_PULLDOWN | MUX_MODE7) /* gpmc_a5.gpio1_21 */ | ||
81 | 0x88 (PIN_OUTPUT_PULLDOWN | MUX_MODE7) /* gpmc_csn3.gpio2_0 */ | ||
82 | >; | ||
83 | }; | ||
84 | }; | ||
85 | |||
86 | &lcdc { | ||
87 | status = "okay"; | ||
88 | }; | ||
89 | |||
90 | &i2c0 { | ||
91 | eeprom: eeprom@50 { | ||
92 | compatible = "at,24c256"; | ||
93 | reg = <0x50>; | ||
94 | }; | ||
16 | }; | 95 | }; |
diff --git a/arch/arm/boot/dts/am335x-igep0033.dtsi b/arch/arm/boot/dts/am335x-igep0033.dtsi index 619624479311..7063311a58d9 100644 --- a/arch/arm/boot/dts/am335x-igep0033.dtsi +++ b/arch/arm/boot/dts/am335x-igep0033.dtsi | |||
@@ -199,6 +199,35 @@ | |||
199 | pinctrl-0 = <&uart0_pins>; | 199 | pinctrl-0 = <&uart0_pins>; |
200 | }; | 200 | }; |
201 | 201 | ||
202 | &usb { | ||
203 | status = "okay"; | ||
204 | |||
205 | control@44e10000 { | ||
206 | status = "okay"; | ||
207 | }; | ||
208 | |||
209 | usb-phy@47401300 { | ||
210 | status = "okay"; | ||
211 | }; | ||
212 | |||
213 | usb-phy@47401b00 { | ||
214 | status = "okay"; | ||
215 | }; | ||
216 | |||
217 | usb@47401000 { | ||
218 | status = "okay"; | ||
219 | }; | ||
220 | |||
221 | usb@47401800 { | ||
222 | status = "okay"; | ||
223 | dr_mode = "host"; | ||
224 | }; | ||
225 | |||
226 | dma-controller@07402000 { | ||
227 | status = "okay"; | ||
228 | }; | ||
229 | }; | ||
230 | |||
202 | #include "tps65910.dtsi" | 231 | #include "tps65910.dtsi" |
203 | 232 | ||
204 | &tps { | 233 | &tps { |
diff --git a/arch/arm/boot/dts/am3517-evm.dts b/arch/arm/boot/dts/am3517-evm.dts index e99dfaf70052..03fcbf0a88a8 100644 --- a/arch/arm/boot/dts/am3517-evm.dts +++ b/arch/arm/boot/dts/am3517-evm.dts | |||
@@ -7,11 +7,11 @@ | |||
7 | */ | 7 | */ |
8 | /dts-v1/; | 8 | /dts-v1/; |
9 | 9 | ||
10 | #include "omap34xx.dtsi" | 10 | #include "am3517.dtsi" |
11 | 11 | ||
12 | / { | 12 | / { |
13 | model = "TI AM3517 EVM (AM3517/05)"; | 13 | model = "TI AM3517 EVM (AM3517/05 TMDSEVM3517)"; |
14 | compatible = "ti,am3517-evm", "ti,omap3"; | 14 | compatible = "ti,am3517-evm", "ti,am3517", "ti,omap3"; |
15 | 15 | ||
16 | memory { | 16 | memory { |
17 | device_type = "memory"; | 17 | device_type = "memory"; |
diff --git a/arch/arm/boot/dts/am3517.dtsi b/arch/arm/boot/dts/am3517.dtsi new file mode 100644 index 000000000000..2fbe02faa8b1 --- /dev/null +++ b/arch/arm/boot/dts/am3517.dtsi | |||
@@ -0,0 +1,63 @@ | |||
1 | /* | ||
2 | * Device Tree Source for am3517 SoC | ||
3 | * | ||
4 | * Copyright (C) 2013 Texas Instruments Incorporated - http://www.ti.com/ | ||
5 | * | ||
6 | * This file is licensed under the terms of the GNU General Public License | ||
7 | * version 2. This program is licensed "as is" without any warranty of any | ||
8 | * kind, whether express or implied. | ||
9 | */ | ||
10 | |||
11 | #include "omap3.dtsi" | ||
12 | |||
13 | / { | ||
14 | aliases { | ||
15 | serial3 = &uart4; | ||
16 | }; | ||
17 | |||
18 | ocp { | ||
19 | am35x_otg_hs: am35x_otg_hs@5c040000 { | ||
20 | compatible = "ti,omap3-musb"; | ||
21 | ti,hwmods = "am35x_otg_hs"; | ||
22 | status = "disabled"; | ||
23 | reg = <0x5c040000 0x1000>; | ||
24 | interrupts = <71>; | ||
25 | interrupt-names = "mc"; | ||
26 | }; | ||
27 | |||
28 | davinci_emac: ethernet@0x5c000000 { | ||
29 | compatible = "ti,am3517-emac"; | ||
30 | ti,hwmods = "davinci_emac"; | ||
31 | status = "disabled"; | ||
32 | reg = <0x5c000000 0x30000>; | ||
33 | interrupts = <67 68 69 70>; | ||
34 | ti,davinci-ctrl-reg-offset = <0x10000>; | ||
35 | ti,davinci-ctrl-mod-reg-offset = <0>; | ||
36 | ti,davinci-ctrl-ram-offset = <0x20000>; | ||
37 | ti,davinci-ctrl-ram-size = <0x2000>; | ||
38 | ti,davinci-rmii-en = /bits/ 8 <1>; | ||
39 | local-mac-address = [ 00 00 00 00 00 00 ]; | ||
40 | }; | ||
41 | |||
42 | davinci_mdio: ethernet@0x5c030000 { | ||
43 | compatible = "ti,davinci_mdio"; | ||
44 | ti,hwmods = "davinci_mdio"; | ||
45 | status = "disabled"; | ||
46 | reg = <0x5c030000 0x1000>; | ||
47 | bus_freq = <1000000>; | ||
48 | #address-cells = <1>; | ||
49 | #size-cells = <0>; | ||
50 | }; | ||
51 | |||
52 | uart4: serial@4809e000 { | ||
53 | compatible = "ti,omap3-uart"; | ||
54 | ti,hwmods = "uart4"; | ||
55 | status = "disabled"; | ||
56 | reg = <0x4809e000 0x400>; | ||
57 | interrupts = <84>; | ||
58 | dmas = <&sdma 55 &sdma 54>; | ||
59 | dma-names = "tx", "rx"; | ||
60 | clock-frequency = <48000000>; | ||
61 | }; | ||
62 | }; | ||
63 | }; | ||
diff --git a/arch/arm/boot/dts/armada-370-db.dts b/arch/arm/boot/dts/armada-370-db.dts index 90ce29dbe119..08a56bcfc724 100644 --- a/arch/arm/boot/dts/armada-370-db.dts +++ b/arch/arm/boot/dts/armada-370-db.dts | |||
@@ -99,22 +99,22 @@ | |||
99 | spi-max-frequency = <50000000>; | 99 | spi-max-frequency = <50000000>; |
100 | }; | 100 | }; |
101 | }; | 101 | }; |
102 | }; | ||
102 | 103 | ||
103 | pcie-controller { | 104 | pcie-controller { |
105 | status = "okay"; | ||
106 | /* | ||
107 | * The two PCIe units are accessible through | ||
108 | * both standard PCIe slots and mini-PCIe | ||
109 | * slots on the board. | ||
110 | */ | ||
111 | pcie@1,0 { | ||
112 | /* Port 0, Lane 0 */ | ||
113 | status = "okay"; | ||
114 | }; | ||
115 | pcie@2,0 { | ||
116 | /* Port 1, Lane 0 */ | ||
104 | status = "okay"; | 117 | status = "okay"; |
105 | /* | ||
106 | * The two PCIe units are accessible through | ||
107 | * both standard PCIe slots and mini-PCIe | ||
108 | * slots on the board. | ||
109 | */ | ||
110 | pcie@1,0 { | ||
111 | /* Port 0, Lane 0 */ | ||
112 | status = "okay"; | ||
113 | }; | ||
114 | pcie@2,0 { | ||
115 | /* Port 1, Lane 0 */ | ||
116 | status = "okay"; | ||
117 | }; | ||
118 | }; | 118 | }; |
119 | }; | 119 | }; |
120 | }; | 120 | }; |
diff --git a/arch/arm/boot/dts/armada-370-xp.dtsi b/arch/arm/boot/dts/armada-370-xp.dtsi index 00d6a798c705..7f10f627ae5b 100644 --- a/arch/arm/boot/dts/armada-370-xp.dtsi +++ b/arch/arm/boot/dts/armada-370-xp.dtsi | |||
@@ -118,7 +118,7 @@ | |||
118 | 118 | ||
119 | coherency-fabric@20200 { | 119 | coherency-fabric@20200 { |
120 | compatible = "marvell,coherency-fabric"; | 120 | compatible = "marvell,coherency-fabric"; |
121 | reg = <0x20200 0xb0>, <0x21810 0x1c>; | 121 | reg = <0x20200 0xb0>, <0x21010 0x1c>; |
122 | }; | 122 | }; |
123 | 123 | ||
124 | serial@12000 { | 124 | serial@12000 { |
diff --git a/arch/arm/boot/dts/armada-xp-mv78230.dtsi b/arch/arm/boot/dts/armada-xp-mv78230.dtsi index 3f5e6121c730..98335fb34b7a 100644 --- a/arch/arm/boot/dts/armada-xp-mv78230.dtsi +++ b/arch/arm/boot/dts/armada-xp-mv78230.dtsi | |||
@@ -47,7 +47,7 @@ | |||
47 | /* | 47 | /* |
48 | * MV78230 has 2 PCIe units Gen2.0: One unit can be | 48 | * MV78230 has 2 PCIe units Gen2.0: One unit can be |
49 | * configured as x4 or quad x1 lanes. One unit is | 49 | * configured as x4 or quad x1 lanes. One unit is |
50 | * x4/x1. | 50 | * x1 only. |
51 | */ | 51 | */ |
52 | pcie-controller { | 52 | pcie-controller { |
53 | compatible = "marvell,armada-xp-pcie"; | 53 | compatible = "marvell,armada-xp-pcie"; |
@@ -62,10 +62,10 @@ | |||
62 | 62 | ||
63 | ranges = | 63 | ranges = |
64 | <0x82000000 0 0x40000 MBUS_ID(0xf0, 0x01) 0x40000 0 0x00002000 /* Port 0.0 registers */ | 64 | <0x82000000 0 0x40000 MBUS_ID(0xf0, 0x01) 0x40000 0 0x00002000 /* Port 0.0 registers */ |
65 | 0x82000000 0 0x42000 MBUS_ID(0xf0, 0x01) 0x42000 0 0x00002000 /* Port 2.0 registers */ | ||
66 | 0x82000000 0 0x44000 MBUS_ID(0xf0, 0x01) 0x44000 0 0x00002000 /* Port 0.1 registers */ | 65 | 0x82000000 0 0x44000 MBUS_ID(0xf0, 0x01) 0x44000 0 0x00002000 /* Port 0.1 registers */ |
67 | 0x82000000 0 0x48000 MBUS_ID(0xf0, 0x01) 0x48000 0 0x00002000 /* Port 0.2 registers */ | 66 | 0x82000000 0 0x48000 MBUS_ID(0xf0, 0x01) 0x48000 0 0x00002000 /* Port 0.2 registers */ |
68 | 0x82000000 0 0x4c000 MBUS_ID(0xf0, 0x01) 0x4c000 0 0x00002000 /* Port 0.3 registers */ | 67 | 0x82000000 0 0x4c000 MBUS_ID(0xf0, 0x01) 0x4c000 0 0x00002000 /* Port 0.3 registers */ |
68 | 0x82000000 0 0x80000 MBUS_ID(0xf0, 0x01) 0x80000 0 0x00002000 /* Port 1.0 registers */ | ||
69 | 0x82000000 0x1 0 MBUS_ID(0x04, 0xe8) 0 1 0 /* Port 0.0 MEM */ | 69 | 0x82000000 0x1 0 MBUS_ID(0x04, 0xe8) 0 1 0 /* Port 0.0 MEM */ |
70 | 0x81000000 0x1 0 MBUS_ID(0x04, 0xe0) 0 1 0 /* Port 0.0 IO */ | 70 | 0x81000000 0x1 0 MBUS_ID(0x04, 0xe0) 0 1 0 /* Port 0.0 IO */ |
71 | 0x82000000 0x2 0 MBUS_ID(0x04, 0xd8) 0 1 0 /* Port 0.1 MEM */ | 71 | 0x82000000 0x2 0 MBUS_ID(0x04, 0xd8) 0 1 0 /* Port 0.1 MEM */ |
@@ -74,8 +74,8 @@ | |||
74 | 0x81000000 0x3 0 MBUS_ID(0x04, 0xb0) 0 1 0 /* Port 0.2 IO */ | 74 | 0x81000000 0x3 0 MBUS_ID(0x04, 0xb0) 0 1 0 /* Port 0.2 IO */ |
75 | 0x82000000 0x4 0 MBUS_ID(0x04, 0x78) 0 1 0 /* Port 0.3 MEM */ | 75 | 0x82000000 0x4 0 MBUS_ID(0x04, 0x78) 0 1 0 /* Port 0.3 MEM */ |
76 | 0x81000000 0x4 0 MBUS_ID(0x04, 0x70) 0 1 0 /* Port 0.3 IO */ | 76 | 0x81000000 0x4 0 MBUS_ID(0x04, 0x70) 0 1 0 /* Port 0.3 IO */ |
77 | 0x82000000 0x9 0 MBUS_ID(0x04, 0xf8) 0 1 0 /* Port 2.0 MEM */ | 77 | 0x82000000 0x5 0 MBUS_ID(0x08, 0xe8) 0 1 0 /* Port 1.0 MEM */ |
78 | 0x81000000 0x9 0 MBUS_ID(0x04, 0xf0) 0 1 0 /* Port 2.0 IO */>; | 78 | 0x81000000 0x5 0 MBUS_ID(0x08, 0xe0) 0 1 0 /* Port 1.0 IO */>; |
79 | 79 | ||
80 | pcie@1,0 { | 80 | pcie@1,0 { |
81 | device_type = "pci"; | 81 | device_type = "pci"; |
@@ -145,20 +145,20 @@ | |||
145 | status = "disabled"; | 145 | status = "disabled"; |
146 | }; | 146 | }; |
147 | 147 | ||
148 | pcie@9,0 { | 148 | pcie@5,0 { |
149 | device_type = "pci"; | 149 | device_type = "pci"; |
150 | assigned-addresses = <0x82000800 0 0x42000 0 0x2000>; | 150 | assigned-addresses = <0x82000800 0 0x80000 0 0x2000>; |
151 | reg = <0x4800 0 0 0 0>; | 151 | reg = <0x2800 0 0 0 0>; |
152 | #address-cells = <3>; | 152 | #address-cells = <3>; |
153 | #size-cells = <2>; | 153 | #size-cells = <2>; |
154 | #interrupt-cells = <1>; | 154 | #interrupt-cells = <1>; |
155 | ranges = <0x82000000 0 0 0x82000000 0x9 0 1 0 | 155 | ranges = <0x82000000 0 0 0x82000000 0x5 0 1 0 |
156 | 0x81000000 0 0 0x81000000 0x9 0 1 0>; | 156 | 0x81000000 0 0 0x81000000 0x5 0 1 0>; |
157 | interrupt-map-mask = <0 0 0 0>; | 157 | interrupt-map-mask = <0 0 0 0>; |
158 | interrupt-map = <0 0 0 0 &mpic 99>; | 158 | interrupt-map = <0 0 0 0 &mpic 62>; |
159 | marvell,pcie-port = <2>; | 159 | marvell,pcie-port = <1>; |
160 | marvell,pcie-lane = <0>; | 160 | marvell,pcie-lane = <0>; |
161 | clocks = <&gateclk 26>; | 161 | clocks = <&gateclk 9>; |
162 | status = "disabled"; | 162 | status = "disabled"; |
163 | }; | 163 | }; |
164 | }; | 164 | }; |
diff --git a/arch/arm/boot/dts/armada-xp-mv78260.dtsi b/arch/arm/boot/dts/armada-xp-mv78260.dtsi index 3e9fd1353f89..66609684d41b 100644 --- a/arch/arm/boot/dts/armada-xp-mv78260.dtsi +++ b/arch/arm/boot/dts/armada-xp-mv78260.dtsi | |||
@@ -48,7 +48,7 @@ | |||
48 | /* | 48 | /* |
49 | * MV78260 has 3 PCIe units Gen2.0: Two units can be | 49 | * MV78260 has 3 PCIe units Gen2.0: Two units can be |
50 | * configured as x4 or quad x1 lanes. One unit is | 50 | * configured as x4 or quad x1 lanes. One unit is |
51 | * x4/x1. | 51 | * x4 only. |
52 | */ | 52 | */ |
53 | pcie-controller { | 53 | pcie-controller { |
54 | compatible = "marvell,armada-xp-pcie"; | 54 | compatible = "marvell,armada-xp-pcie"; |
@@ -68,7 +68,9 @@ | |||
68 | 0x82000000 0 0x48000 MBUS_ID(0xf0, 0x01) 0x48000 0 0x00002000 /* Port 0.2 registers */ | 68 | 0x82000000 0 0x48000 MBUS_ID(0xf0, 0x01) 0x48000 0 0x00002000 /* Port 0.2 registers */ |
69 | 0x82000000 0 0x4c000 MBUS_ID(0xf0, 0x01) 0x4c000 0 0x00002000 /* Port 0.3 registers */ | 69 | 0x82000000 0 0x4c000 MBUS_ID(0xf0, 0x01) 0x4c000 0 0x00002000 /* Port 0.3 registers */ |
70 | 0x82000000 0 0x80000 MBUS_ID(0xf0, 0x01) 0x80000 0 0x00002000 /* Port 1.0 registers */ | 70 | 0x82000000 0 0x80000 MBUS_ID(0xf0, 0x01) 0x80000 0 0x00002000 /* Port 1.0 registers */ |
71 | 0x82000000 0 0x82000 MBUS_ID(0xf0, 0x01) 0x82000 0 0x00002000 /* Port 3.0 registers */ | 71 | 0x82000000 0 0x84000 MBUS_ID(0xf0, 0x01) 0x84000 0 0x00002000 /* Port 1.1 registers */ |
72 | 0x82000000 0 0x88000 MBUS_ID(0xf0, 0x01) 0x88000 0 0x00002000 /* Port 1.2 registers */ | ||
73 | 0x82000000 0 0x8c000 MBUS_ID(0xf0, 0x01) 0x8c000 0 0x00002000 /* Port 1.3 registers */ | ||
72 | 0x82000000 0x1 0 MBUS_ID(0x04, 0xe8) 0 1 0 /* Port 0.0 MEM */ | 74 | 0x82000000 0x1 0 MBUS_ID(0x04, 0xe8) 0 1 0 /* Port 0.0 MEM */ |
73 | 0x81000000 0x1 0 MBUS_ID(0x04, 0xe0) 0 1 0 /* Port 0.0 IO */ | 75 | 0x81000000 0x1 0 MBUS_ID(0x04, 0xe0) 0 1 0 /* Port 0.0 IO */ |
74 | 0x82000000 0x2 0 MBUS_ID(0x04, 0xd8) 0 1 0 /* Port 0.1 MEM */ | 76 | 0x82000000 0x2 0 MBUS_ID(0x04, 0xd8) 0 1 0 /* Port 0.1 MEM */ |
@@ -77,10 +79,18 @@ | |||
77 | 0x81000000 0x3 0 MBUS_ID(0x04, 0xb0) 0 1 0 /* Port 0.2 IO */ | 79 | 0x81000000 0x3 0 MBUS_ID(0x04, 0xb0) 0 1 0 /* Port 0.2 IO */ |
78 | 0x82000000 0x4 0 MBUS_ID(0x04, 0x78) 0 1 0 /* Port 0.3 MEM */ | 80 | 0x82000000 0x4 0 MBUS_ID(0x04, 0x78) 0 1 0 /* Port 0.3 MEM */ |
79 | 0x81000000 0x4 0 MBUS_ID(0x04, 0x70) 0 1 0 /* Port 0.3 IO */ | 81 | 0x81000000 0x4 0 MBUS_ID(0x04, 0x70) 0 1 0 /* Port 0.3 IO */ |
80 | 0x82000000 0x9 0 MBUS_ID(0x08, 0xe8) 0 1 0 /* Port 1.0 MEM */ | 82 | |
81 | 0x81000000 0x9 0 MBUS_ID(0x08, 0xe0) 0 1 0 /* Port 1.0 IO */ | 83 | 0x82000000 0x5 0 MBUS_ID(0x08, 0xe8) 0 1 0 /* Port 1.0 MEM */ |
82 | 0x82000000 0xa 0 MBUS_ID(0x08, 0xf8) 0 1 0 /* Port 3.0 MEM */ | 84 | 0x81000000 0x5 0 MBUS_ID(0x08, 0xe0) 0 1 0 /* Port 1.0 IO */ |
83 | 0x81000000 0xa 0 MBUS_ID(0x08, 0xf0) 0 1 0 /* Port 3.0 IO */>; | 85 | 0x82000000 0x6 0 MBUS_ID(0x08, 0xd8) 0 1 0 /* Port 1.1 MEM */ |
86 | 0x81000000 0x6 0 MBUS_ID(0x08, 0xd0) 0 1 0 /* Port 1.1 IO */ | ||
87 | 0x82000000 0x7 0 MBUS_ID(0x08, 0xb8) 0 1 0 /* Port 1.2 MEM */ | ||
88 | 0x81000000 0x7 0 MBUS_ID(0x08, 0xb0) 0 1 0 /* Port 1.2 IO */ | ||
89 | 0x82000000 0x8 0 MBUS_ID(0x08, 0x78) 0 1 0 /* Port 1.3 MEM */ | ||
90 | 0x81000000 0x8 0 MBUS_ID(0x08, 0x70) 0 1 0 /* Port 1.3 IO */ | ||
91 | |||
92 | 0x82000000 0x9 0 MBUS_ID(0x04, 0xf8) 0 1 0 /* Port 2.0 MEM */ | ||
93 | 0x81000000 0x9 0 MBUS_ID(0x04, 0xf0) 0 1 0 /* Port 2.0 IO */>; | ||
84 | 94 | ||
85 | pcie@1,0 { | 95 | pcie@1,0 { |
86 | device_type = "pci"; | 96 | device_type = "pci"; |
@@ -106,8 +116,8 @@ | |||
106 | #address-cells = <3>; | 116 | #address-cells = <3>; |
107 | #size-cells = <2>; | 117 | #size-cells = <2>; |
108 | #interrupt-cells = <1>; | 118 | #interrupt-cells = <1>; |
109 | ranges = <0x82000000 0 0 0x82000000 0x2 0 1 0 | 119 | ranges = <0x82000000 0 0 0x82000000 0x2 0 1 0 |
110 | 0x81000000 0 0 0x81000000 0x2 0 1 0>; | 120 | 0x81000000 0 0 0x81000000 0x2 0 1 0>; |
111 | interrupt-map-mask = <0 0 0 0>; | 121 | interrupt-map-mask = <0 0 0 0>; |
112 | interrupt-map = <0 0 0 0 &mpic 59>; | 122 | interrupt-map = <0 0 0 0 &mpic 59>; |
113 | marvell,pcie-port = <0>; | 123 | marvell,pcie-port = <0>; |
@@ -150,37 +160,88 @@ | |||
150 | status = "disabled"; | 160 | status = "disabled"; |
151 | }; | 161 | }; |
152 | 162 | ||
153 | pcie@9,0 { | 163 | pcie@5,0 { |
154 | device_type = "pci"; | 164 | device_type = "pci"; |
155 | assigned-addresses = <0x82000800 0 0x42000 0 0x2000>; | 165 | assigned-addresses = <0x82000800 0 0x80000 0 0x2000>; |
156 | reg = <0x4800 0 0 0 0>; | 166 | reg = <0x2800 0 0 0 0>; |
157 | #address-cells = <3>; | 167 | #address-cells = <3>; |
158 | #size-cells = <2>; | 168 | #size-cells = <2>; |
159 | #interrupt-cells = <1>; | 169 | #interrupt-cells = <1>; |
160 | ranges = <0x82000000 0 0 0x82000000 0x9 0 1 0 | 170 | ranges = <0x82000000 0 0 0x82000000 0x5 0 1 0 |
161 | 0x81000000 0 0 0x81000000 0x9 0 1 0>; | 171 | 0x81000000 0 0 0x81000000 0x5 0 1 0>; |
162 | interrupt-map-mask = <0 0 0 0>; | 172 | interrupt-map-mask = <0 0 0 0>; |
163 | interrupt-map = <0 0 0 0 &mpic 99>; | 173 | interrupt-map = <0 0 0 0 &mpic 62>; |
164 | marvell,pcie-port = <2>; | 174 | marvell,pcie-port = <1>; |
165 | marvell,pcie-lane = <0>; | 175 | marvell,pcie-lane = <0>; |
166 | clocks = <&gateclk 26>; | 176 | clocks = <&gateclk 9>; |
167 | status = "disabled"; | 177 | status = "disabled"; |
168 | }; | 178 | }; |
169 | 179 | ||
170 | pcie@10,0 { | 180 | pcie@6,0 { |
171 | device_type = "pci"; | 181 | device_type = "pci"; |
172 | assigned-addresses = <0x82000800 0 0x82000 0 0x2000>; | 182 | assigned-addresses = <0x82000800 0 0x84000 0 0x2000>; |
173 | reg = <0x5000 0 0 0 0>; | 183 | reg = <0x3000 0 0 0 0>; |
174 | #address-cells = <3>; | 184 | #address-cells = <3>; |
175 | #size-cells = <2>; | 185 | #size-cells = <2>; |
176 | #interrupt-cells = <1>; | 186 | #interrupt-cells = <1>; |
177 | ranges = <0x82000000 0 0 0x82000000 0xa 0 1 0 | 187 | ranges = <0x82000000 0 0 0x82000000 0x6 0 1 0 |
178 | 0x81000000 0 0 0x81000000 0xa 0 1 0>; | 188 | 0x81000000 0 0 0x81000000 0x6 0 1 0>; |
179 | interrupt-map-mask = <0 0 0 0>; | 189 | interrupt-map-mask = <0 0 0 0>; |
180 | interrupt-map = <0 0 0 0 &mpic 103>; | 190 | interrupt-map = <0 0 0 0 &mpic 63>; |
181 | marvell,pcie-port = <3>; | 191 | marvell,pcie-port = <1>; |
192 | marvell,pcie-lane = <1>; | ||
193 | clocks = <&gateclk 10>; | ||
194 | status = "disabled"; | ||
195 | }; | ||
196 | |||
197 | pcie@7,0 { | ||
198 | device_type = "pci"; | ||
199 | assigned-addresses = <0x82000800 0 0x88000 0 0x2000>; | ||
200 | reg = <0x3800 0 0 0 0>; | ||
201 | #address-cells = <3>; | ||
202 | #size-cells = <2>; | ||
203 | #interrupt-cells = <1>; | ||
204 | ranges = <0x82000000 0 0 0x82000000 0x7 0 1 0 | ||
205 | 0x81000000 0 0 0x81000000 0x7 0 1 0>; | ||
206 | interrupt-map-mask = <0 0 0 0>; | ||
207 | interrupt-map = <0 0 0 0 &mpic 64>; | ||
208 | marvell,pcie-port = <1>; | ||
209 | marvell,pcie-lane = <2>; | ||
210 | clocks = <&gateclk 11>; | ||
211 | status = "disabled"; | ||
212 | }; | ||
213 | |||
214 | pcie@8,0 { | ||
215 | device_type = "pci"; | ||
216 | assigned-addresses = <0x82000800 0 0x8c000 0 0x2000>; | ||
217 | reg = <0x4000 0 0 0 0>; | ||
218 | #address-cells = <3>; | ||
219 | #size-cells = <2>; | ||
220 | #interrupt-cells = <1>; | ||
221 | ranges = <0x82000000 0 0 0x82000000 0x8 0 1 0 | ||
222 | 0x81000000 0 0 0x81000000 0x8 0 1 0>; | ||
223 | interrupt-map-mask = <0 0 0 0>; | ||
224 | interrupt-map = <0 0 0 0 &mpic 65>; | ||
225 | marvell,pcie-port = <1>; | ||
226 | marvell,pcie-lane = <3>; | ||
227 | clocks = <&gateclk 12>; | ||
228 | status = "disabled"; | ||
229 | }; | ||
230 | |||
231 | pcie@9,0 { | ||
232 | device_type = "pci"; | ||
233 | assigned-addresses = <0x82000800 0 0x42000 0 0x2000>; | ||
234 | reg = <0x4800 0 0 0 0>; | ||
235 | #address-cells = <3>; | ||
236 | #size-cells = <2>; | ||
237 | #interrupt-cells = <1>; | ||
238 | ranges = <0x82000000 0 0 0x82000000 0x9 0 1 0 | ||
239 | 0x81000000 0 0 0x81000000 0x9 0 1 0>; | ||
240 | interrupt-map-mask = <0 0 0 0>; | ||
241 | interrupt-map = <0 0 0 0 &mpic 99>; | ||
242 | marvell,pcie-port = <2>; | ||
182 | marvell,pcie-lane = <0>; | 243 | marvell,pcie-lane = <0>; |
183 | clocks = <&gateclk 27>; | 244 | clocks = <&gateclk 26>; |
184 | status = "disabled"; | 245 | status = "disabled"; |
185 | }; | 246 | }; |
186 | }; | 247 | }; |
diff --git a/arch/arm/boot/dts/at91sam9x5_usart3.dtsi b/arch/arm/boot/dts/at91sam9x5_usart3.dtsi index 2347e9563cef..6801106fa1f8 100644 --- a/arch/arm/boot/dts/at91sam9x5_usart3.dtsi +++ b/arch/arm/boot/dts/at91sam9x5_usart3.dtsi | |||
@@ -11,6 +11,10 @@ | |||
11 | #include <dt-bindings/interrupt-controller/irq.h> | 11 | #include <dt-bindings/interrupt-controller/irq.h> |
12 | 12 | ||
13 | / { | 13 | / { |
14 | aliases { | ||
15 | serial4 = &usart3; | ||
16 | }; | ||
17 | |||
14 | ahb { | 18 | ahb { |
15 | apb { | 19 | apb { |
16 | pinctrl@fffff400 { | 20 | pinctrl@fffff400 { |
diff --git a/arch/arm/boot/dts/omap-gpmc-smsc911x.dtsi b/arch/arm/boot/dts/omap-gpmc-smsc911x.dtsi index 9c18adf788f7..f577b7df9a29 100644 --- a/arch/arm/boot/dts/omap-gpmc-smsc911x.dtsi +++ b/arch/arm/boot/dts/omap-gpmc-smsc911x.dtsi | |||
@@ -44,8 +44,8 @@ | |||
44 | gpmc,wr-access-ns = <186>; | 44 | gpmc,wr-access-ns = <186>; |
45 | gpmc,cycle2cycle-samecsen; | 45 | gpmc,cycle2cycle-samecsen; |
46 | gpmc,cycle2cycle-diffcsen; | 46 | gpmc,cycle2cycle-diffcsen; |
47 | vmmc-supply = <&vddvario>; | 47 | vddvario-supply = <&vddvario>; |
48 | vmmc_aux-supply = <&vdd33a>; | 48 | vdd33a-supply = <&vdd33a>; |
49 | reg-io-width = <4>; | 49 | reg-io-width = <4>; |
50 | smsc,save-mac-address; | 50 | smsc,save-mac-address; |
51 | }; | 51 | }; |
diff --git a/arch/arm/boot/dts/omap3-beagle-xm.dts b/arch/arm/boot/dts/omap3-beagle-xm.dts index 31a632f7effb..df33a50bc070 100644 --- a/arch/arm/boot/dts/omap3-beagle-xm.dts +++ b/arch/arm/boot/dts/omap3-beagle-xm.dts | |||
@@ -215,3 +215,10 @@ | |||
215 | &usbhsehci { | 215 | &usbhsehci { |
216 | phys = <0 &hsusb2_phy>; | 216 | phys = <0 &hsusb2_phy>; |
217 | }; | 217 | }; |
218 | |||
219 | &vaux2 { | ||
220 | regulator-name = "usb_1v8"; | ||
221 | regulator-min-microvolt = <1800000>; | ||
222 | regulator-max-microvolt = <1800000>; | ||
223 | regulator-always-on; | ||
224 | }; | ||
diff --git a/arch/arm/boot/dts/omap3-beagle.dts b/arch/arm/boot/dts/omap3-beagle.dts index fa532aaacc68..3ba4a625ea5b 100644 --- a/arch/arm/boot/dts/omap3-beagle.dts +++ b/arch/arm/boot/dts/omap3-beagle.dts | |||
@@ -61,6 +61,14 @@ | |||
61 | vcc-supply = <&hsusb2_power>; | 61 | vcc-supply = <&hsusb2_power>; |
62 | }; | 62 | }; |
63 | 63 | ||
64 | sound { | ||
65 | compatible = "ti,omap-twl4030"; | ||
66 | ti,model = "omap3beagle"; | ||
67 | |||
68 | ti,mcbsp = <&mcbsp2>; | ||
69 | ti,codec = <&twl_audio>; | ||
70 | }; | ||
71 | |||
64 | gpio_keys { | 72 | gpio_keys { |
65 | compatible = "gpio-keys"; | 73 | compatible = "gpio-keys"; |
66 | 74 | ||
@@ -120,6 +128,12 @@ | |||
120 | reg = <0x48>; | 128 | reg = <0x48>; |
121 | interrupts = <7>; /* SYS_NIRQ cascaded to intc */ | 129 | interrupts = <7>; /* SYS_NIRQ cascaded to intc */ |
122 | interrupt-parent = <&intc>; | 130 | interrupt-parent = <&intc>; |
131 | |||
132 | twl_audio: audio { | ||
133 | compatible = "ti,twl4030-audio"; | ||
134 | codec { | ||
135 | }; | ||
136 | }; | ||
123 | }; | 137 | }; |
124 | }; | 138 | }; |
125 | 139 | ||
@@ -178,3 +192,10 @@ | |||
178 | mode = <3>; | 192 | mode = <3>; |
179 | power = <50>; | 193 | power = <50>; |
180 | }; | 194 | }; |
195 | |||
196 | &vaux2 { | ||
197 | regulator-name = "vdd_ehci"; | ||
198 | regulator-min-microvolt = <1800000>; | ||
199 | regulator-max-microvolt = <1800000>; | ||
200 | regulator-always-on; | ||
201 | }; | ||
diff --git a/arch/arm/boot/dts/omap3-igep.dtsi b/arch/arm/boot/dts/omap3-igep.dtsi index ba1e58b7b7e3..165aaf7591ba 100644 --- a/arch/arm/boot/dts/omap3-igep.dtsi +++ b/arch/arm/boot/dts/omap3-igep.dtsi | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Device Tree Source for IGEP Technology devices | 2 | * Common device tree for IGEP boards based on AM/DM37x |
3 | * | 3 | * |
4 | * Copyright (C) 2012 Javier Martinez Canillas <javier@collabora.co.uk> | 4 | * Copyright (C) 2012 Javier Martinez Canillas <javier@collabora.co.uk> |
5 | * Copyright (C) 2012 Enric Balletbo i Serra <eballetbo@gmail.com> | 5 | * Copyright (C) 2012 Enric Balletbo i Serra <eballetbo@gmail.com> |
@@ -10,7 +10,7 @@ | |||
10 | */ | 10 | */ |
11 | /dts-v1/; | 11 | /dts-v1/; |
12 | 12 | ||
13 | #include "omap34xx.dtsi" | 13 | #include "omap36xx.dtsi" |
14 | 14 | ||
15 | / { | 15 | / { |
16 | memory { | 16 | memory { |
@@ -24,6 +24,25 @@ | |||
24 | ti,mcbsp = <&mcbsp2>; | 24 | ti,mcbsp = <&mcbsp2>; |
25 | ti,codec = <&twl_audio>; | 25 | ti,codec = <&twl_audio>; |
26 | }; | 26 | }; |
27 | |||
28 | vdd33: regulator-vdd33 { | ||
29 | compatible = "regulator-fixed"; | ||
30 | regulator-name = "vdd33"; | ||
31 | regulator-always-on; | ||
32 | }; | ||
33 | |||
34 | lbee1usjyc_vmmc: lbee1usjyc_vmmc { | ||
35 | pinctrl-names = "default"; | ||
36 | pinctrl-0 = <&lbee1usjyc_pins>; | ||
37 | compatible = "regulator-fixed"; | ||
38 | regulator-name = "regulator-lbee1usjyc"; | ||
39 | regulator-min-microvolt = <3300000>; | ||
40 | regulator-max-microvolt = <3300000>; | ||
41 | gpio = <&gpio5 10 GPIO_ACTIVE_HIGH>; /* gpio_138 WIFI_PDN */ | ||
42 | startup-delay-us = <10000>; | ||
43 | enable-active-high; | ||
44 | vin-supply = <&vdd33>; | ||
45 | }; | ||
27 | }; | 46 | }; |
28 | 47 | ||
29 | &omap3_pmx_core { | 48 | &omap3_pmx_core { |
@@ -48,6 +67,15 @@ | |||
48 | >; | 67 | >; |
49 | }; | 68 | }; |
50 | 69 | ||
70 | /* WiFi/BT combo */ | ||
71 | lbee1usjyc_pins: pinmux_lbee1usjyc_pins { | ||
72 | pinctrl-single,pins = < | ||
73 | 0x136 (PIN_OUTPUT | MUX_MODE4) /* sdmmc2_dat5.gpio_137 */ | ||
74 | 0x138 (PIN_OUTPUT | MUX_MODE4) /* sdmmc2_dat6.gpio_138 */ | ||
75 | 0x13a (PIN_OUTPUT | MUX_MODE4) /* sdmmc2_dat7.gpio_139 */ | ||
76 | >; | ||
77 | }; | ||
78 | |||
51 | mcbsp2_pins: pinmux_mcbsp2_pins { | 79 | mcbsp2_pins: pinmux_mcbsp2_pins { |
52 | pinctrl-single,pins = < | 80 | pinctrl-single,pins = < |
53 | 0x10c (PIN_INPUT | MUX_MODE0) /* mcbsp2_fsx.mcbsp2_fsx */ | 81 | 0x10c (PIN_INPUT | MUX_MODE0) /* mcbsp2_fsx.mcbsp2_fsx */ |
@@ -65,10 +93,17 @@ | |||
65 | 0x11a (PIN_INPUT_PULLUP | MUX_MODE0) /* sdmmc1_dat1.sdmmc1_dat1 */ | 93 | 0x11a (PIN_INPUT_PULLUP | MUX_MODE0) /* sdmmc1_dat1.sdmmc1_dat1 */ |
66 | 0x11c (PIN_INPUT_PULLUP | MUX_MODE0) /* sdmmc1_dat2.sdmmc1_dat2 */ | 94 | 0x11c (PIN_INPUT_PULLUP | MUX_MODE0) /* sdmmc1_dat2.sdmmc1_dat2 */ |
67 | 0x11e (PIN_INPUT_PULLUP | MUX_MODE0) /* sdmmc1_dat3.sdmmc1_dat3 */ | 95 | 0x11e (PIN_INPUT_PULLUP | MUX_MODE0) /* sdmmc1_dat3.sdmmc1_dat3 */ |
68 | 0x120 (PIN_INPUT | MUX_MODE0) /* sdmmc1_dat4.sdmmc1_dat4 */ | 96 | >; |
69 | 0x122 (PIN_INPUT | MUX_MODE0) /* sdmmc1_dat5.sdmmc1_dat5 */ | 97 | }; |
70 | 0x124 (PIN_INPUT | MUX_MODE0) /* sdmmc1_dat6.sdmmc1_dat6 */ | 98 | |
71 | 0x126 (PIN_INPUT | MUX_MODE0) /* sdmmc1_dat7.sdmmc1_dat7 */ | 99 | mmc2_pins: pinmux_mmc2_pins { |
100 | pinctrl-single,pins = < | ||
101 | 0x128 (PIN_INPUT_PULLUP | MUX_MODE0) /* sdmmc2_clk.sdmmc2_clk */ | ||
102 | 0x12a (PIN_INPUT_PULLUP | MUX_MODE0) /* sdmmc2_cmd.sdmmc2_cmd */ | ||
103 | 0x12c (PIN_INPUT_PULLUP | MUX_MODE0) /* sdmmc2_dat0.sdmmc2_dat0 */ | ||
104 | 0x12e (PIN_INPUT_PULLUP | MUX_MODE0) /* sdmmc2_dat1.sdmmc2_dat1 */ | ||
105 | 0x130 (PIN_INPUT_PULLUP | MUX_MODE0) /* sdmmc2_dat2.sdmmc2_dat2 */ | ||
106 | 0x132 (PIN_INPUT_PULLUP | MUX_MODE0) /* sdmmc2_dat3.sdmmc2_dat3 */ | ||
72 | >; | 107 | >; |
73 | }; | 108 | }; |
74 | 109 | ||
@@ -78,10 +113,33 @@ | |||
78 | >; | 113 | >; |
79 | }; | 114 | }; |
80 | 115 | ||
116 | i2c1_pins: pinmux_i2c1_pins { | ||
117 | pinctrl-single,pins = < | ||
118 | 0x18a (PIN_INPUT | MUX_MODE0) /* i2c1_scl.i2c1_scl */ | ||
119 | 0x18c (PIN_INPUT | MUX_MODE0) /* i2c1_sda.i2c1_sda */ | ||
120 | >; | ||
121 | }; | ||
122 | |||
123 | i2c2_pins: pinmux_i2c2_pins { | ||
124 | pinctrl-single,pins = < | ||
125 | 0x18e (PIN_INPUT | MUX_MODE0) /* i2c2_scl.i2c2_scl */ | ||
126 | 0x190 (PIN_INPUT | MUX_MODE0) /* i2c2_sda.i2c2_sda */ | ||
127 | >; | ||
128 | }; | ||
129 | |||
130 | i2c3_pins: pinmux_i2c3_pins { | ||
131 | pinctrl-single,pins = < | ||
132 | 0x192 (PIN_INPUT | MUX_MODE0) /* i2c3_scl.i2c3_scl */ | ||
133 | 0x194 (PIN_INPUT | MUX_MODE0) /* i2c3_sda.i2c3_sda */ | ||
134 | >; | ||
135 | }; | ||
136 | |||
81 | leds_pins: pinmux_leds_pins { }; | 137 | leds_pins: pinmux_leds_pins { }; |
82 | }; | 138 | }; |
83 | 139 | ||
84 | &i2c1 { | 140 | &i2c1 { |
141 | pinctrl-names = "default"; | ||
142 | pinctrl-0 = <&i2c1_pins>; | ||
85 | clock-frequency = <2600000>; | 143 | clock-frequency = <2600000>; |
86 | 144 | ||
87 | twl: twl@48 { | 145 | twl: twl@48 { |
@@ -101,9 +159,16 @@ | |||
101 | #include "twl4030_omap3.dtsi" | 159 | #include "twl4030_omap3.dtsi" |
102 | 160 | ||
103 | &i2c2 { | 161 | &i2c2 { |
162 | pinctrl-names = "default"; | ||
163 | pinctrl-0 = <&i2c2_pins>; | ||
104 | clock-frequency = <400000>; | 164 | clock-frequency = <400000>; |
105 | }; | 165 | }; |
106 | 166 | ||
167 | &i2c3 { | ||
168 | pinctrl-names = "default"; | ||
169 | pinctrl-0 = <&i2c3_pins>; | ||
170 | }; | ||
171 | |||
107 | &mcbsp2 { | 172 | &mcbsp2 { |
108 | pinctrl-names = "default"; | 173 | pinctrl-names = "default"; |
109 | pinctrl-0 = <&mcbsp2_pins>; | 174 | pinctrl-0 = <&mcbsp2_pins>; |
@@ -114,11 +179,15 @@ | |||
114 | pinctrl-0 = <&mmc1_pins>; | 179 | pinctrl-0 = <&mmc1_pins>; |
115 | vmmc-supply = <&vmmc1>; | 180 | vmmc-supply = <&vmmc1>; |
116 | vmmc_aux-supply = <&vsim>; | 181 | vmmc_aux-supply = <&vsim>; |
117 | bus-width = <8>; | 182 | bus-width = <4>; |
118 | }; | 183 | }; |
119 | 184 | ||
120 | &mmc2 { | 185 | &mmc2 { |
121 | status = "disabled"; | 186 | pinctrl-names = "default"; |
187 | pinctrl-0 = <&mmc2_pins>; | ||
188 | vmmc-supply = <&lbee1usjyc_vmmc>; | ||
189 | bus-width = <4>; | ||
190 | non-removable; | ||
122 | }; | 191 | }; |
123 | 192 | ||
124 | &mmc3 { | 193 | &mmc3 { |
diff --git a/arch/arm/boot/dts/omap3-igep0020.dts b/arch/arm/boot/dts/omap3-igep0020.dts index d5cc79267250..1c7e74d2d2bc 100644 --- a/arch/arm/boot/dts/omap3-igep0020.dts +++ b/arch/arm/boot/dts/omap3-igep0020.dts | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Device Tree Source for IGEPv2 board | 2 | * Device Tree Source for IGEPv2 Rev. (TI OMAP AM/DM37x) |
3 | * | 3 | * |
4 | * Copyright (C) 2012 Javier Martinez Canillas <javier@collabora.co.uk> | 4 | * Copyright (C) 2012 Javier Martinez Canillas <javier@collabora.co.uk> |
5 | * Copyright (C) 2012 Enric Balletbo i Serra <eballetbo@gmail.com> | 5 | * Copyright (C) 2012 Enric Balletbo i Serra <eballetbo@gmail.com> |
@@ -13,7 +13,7 @@ | |||
13 | #include "omap-gpmc-smsc911x.dtsi" | 13 | #include "omap-gpmc-smsc911x.dtsi" |
14 | 14 | ||
15 | / { | 15 | / { |
16 | model = "IGEPv2"; | 16 | model = "IGEPv2 (TI OMAP AM/DM37x)"; |
17 | compatible = "isee,omap3-igep0020", "ti,omap3"; | 17 | compatible = "isee,omap3-igep0020", "ti,omap3"; |
18 | 18 | ||
19 | leds { | 19 | leds { |
@@ -67,6 +67,8 @@ | |||
67 | pinctrl-names = "default"; | 67 | pinctrl-names = "default"; |
68 | pinctrl-0 = < | 68 | pinctrl-0 = < |
69 | &hsusbb1_pins | 69 | &hsusbb1_pins |
70 | &tfp410_pins | ||
71 | &dss_pins | ||
70 | >; | 72 | >; |
71 | 73 | ||
72 | hsusbb1_pins: pinmux_hsusbb1_pins { | 74 | hsusbb1_pins: pinmux_hsusbb1_pins { |
@@ -85,6 +87,45 @@ | |||
85 | 0x5ba (PIN_INPUT_PULLDOWN | MUX_MODE3) /* etk_d7.hsusb1_data3 */ | 87 | 0x5ba (PIN_INPUT_PULLDOWN | MUX_MODE3) /* etk_d7.hsusb1_data3 */ |
86 | >; | 88 | >; |
87 | }; | 89 | }; |
90 | |||
91 | tfp410_pins: tfp410_dvi_pins { | ||
92 | pinctrl-single,pins = < | ||
93 | 0x196 (PIN_OUTPUT | MUX_MODE4) /* hdq_sio.gpio_170 */ | ||
94 | >; | ||
95 | }; | ||
96 | |||
97 | dss_pins: pinmux_dss_dvi_pins { | ||
98 | pinctrl-single,pins = < | ||
99 | 0x0a4 (PIN_OUTPUT | MUX_MODE0) /* dss_pclk.dss_pclk */ | ||
100 | 0x0a6 (PIN_OUTPUT | MUX_MODE0) /* dss_hsync.dss_hsync */ | ||
101 | 0x0a8 (PIN_OUTPUT | MUX_MODE0) /* dss_vsync.dss_vsync */ | ||
102 | 0x0aa (PIN_OUTPUT | MUX_MODE0) /* dss_acbias.dss_acbias */ | ||
103 | 0x0ac (PIN_OUTPUT | MUX_MODE0) /* dss_data0.dss_data0 */ | ||
104 | 0x0ae (PIN_OUTPUT | MUX_MODE0) /* dss_data1.dss_data1 */ | ||
105 | 0x0b0 (PIN_OUTPUT | MUX_MODE0) /* dss_data2.dss_data2 */ | ||
106 | 0x0b2 (PIN_OUTPUT | MUX_MODE0) /* dss_data3.dss_data3 */ | ||
107 | 0x0b4 (PIN_OUTPUT | MUX_MODE0) /* dss_data4.dss_data4 */ | ||
108 | 0x0b6 (PIN_OUTPUT | MUX_MODE0) /* dss_data5.dss_data5 */ | ||
109 | 0x0b8 (PIN_OUTPUT | MUX_MODE0) /* dss_data6.dss_data6 */ | ||
110 | 0x0ba (PIN_OUTPUT | MUX_MODE0) /* dss_data7.dss_data7 */ | ||
111 | 0x0bc (PIN_OUTPUT | MUX_MODE0) /* dss_data8.dss_data8 */ | ||
112 | 0x0be (PIN_OUTPUT | MUX_MODE0) /* dss_data9.dss_data9 */ | ||
113 | 0x0c0 (PIN_OUTPUT | MUX_MODE0) /* dss_data10.dss_data10 */ | ||
114 | 0x0c2 (PIN_OUTPUT | MUX_MODE0) /* dss_data11.dss_data11 */ | ||
115 | 0x0c4 (PIN_OUTPUT | MUX_MODE0) /* dss_data12.dss_data12 */ | ||
116 | 0x0c6 (PIN_OUTPUT | MUX_MODE0) /* dss_data13.dss_data13 */ | ||
117 | 0x0c8 (PIN_OUTPUT | MUX_MODE0) /* dss_data14.dss_data14 */ | ||
118 | 0x0ca (PIN_OUTPUT | MUX_MODE0) /* dss_data15.dss_data15 */ | ||
119 | 0x0cc (PIN_OUTPUT | MUX_MODE0) /* dss_data16.dss_data16 */ | ||
120 | 0x0ce (PIN_OUTPUT | MUX_MODE0) /* dss_data17.dss_data17 */ | ||
121 | 0x0d0 (PIN_OUTPUT | MUX_MODE0) /* dss_data18.dss_data18 */ | ||
122 | 0x0d2 (PIN_OUTPUT | MUX_MODE0) /* dss_data19.dss_data19 */ | ||
123 | 0x0d4 (PIN_OUTPUT | MUX_MODE0) /* dss_data20.dss_data20 */ | ||
124 | 0x0d6 (PIN_OUTPUT | MUX_MODE0) /* dss_data21.dss_data21 */ | ||
125 | 0x0d8 (PIN_OUTPUT | MUX_MODE0) /* dss_data22.dss_data22 */ | ||
126 | 0x0da (PIN_OUTPUT | MUX_MODE0) /* dss_data23.dss_data23 */ | ||
127 | >; | ||
128 | }; | ||
88 | }; | 129 | }; |
89 | 130 | ||
90 | &leds_pins { | 131 | &leds_pins { |
@@ -174,3 +215,8 @@ | |||
174 | &usbhsehci { | 215 | &usbhsehci { |
175 | phys = <&hsusb1_phy>; | 216 | phys = <&hsusb1_phy>; |
176 | }; | 217 | }; |
218 | |||
219 | &vpll2 { | ||
220 | /* Needed for DSS */ | ||
221 | regulator-name = "vdds_dsi"; | ||
222 | }; | ||
diff --git a/arch/arm/boot/dts/omap3-igep0030.dts b/arch/arm/boot/dts/omap3-igep0030.dts index 525e6d9b0978..02a23f8a3384 100644 --- a/arch/arm/boot/dts/omap3-igep0030.dts +++ b/arch/arm/boot/dts/omap3-igep0030.dts | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Device Tree Source for IGEP COM Module | 2 | * Device Tree Source for IGEP COM MODULE (TI OMAP AM/DM37x) |
3 | * | 3 | * |
4 | * Copyright (C) 2012 Javier Martinez Canillas <javier@collabora.co.uk> | 4 | * Copyright (C) 2012 Javier Martinez Canillas <javier@collabora.co.uk> |
5 | * Copyright (C) 2012 Enric Balletbo i Serra <eballetbo@gmail.com> | 5 | * Copyright (C) 2012 Enric Balletbo i Serra <eballetbo@gmail.com> |
@@ -12,7 +12,7 @@ | |||
12 | #include "omap3-igep.dtsi" | 12 | #include "omap3-igep.dtsi" |
13 | 13 | ||
14 | / { | 14 | / { |
15 | model = "IGEP COM Module"; | 15 | model = "IGEP COM MODULE (TI OMAP AM/DM37x)"; |
16 | compatible = "isee,omap3-igep0030", "ti,omap3"; | 16 | compatible = "isee,omap3-igep0030", "ti,omap3"; |
17 | 17 | ||
18 | leds { | 18 | leds { |
diff --git a/arch/arm/boot/dts/omap3-n900.dts b/arch/arm/boot/dts/omap3-n900.dts index c4f20bfe4cce..6fc85f963530 100644 --- a/arch/arm/boot/dts/omap3-n900.dts +++ b/arch/arm/boot/dts/omap3-n900.dts | |||
@@ -9,7 +9,7 @@ | |||
9 | 9 | ||
10 | /dts-v1/; | 10 | /dts-v1/; |
11 | 11 | ||
12 | #include "omap34xx.dtsi" | 12 | #include "omap34xx-hs.dtsi" |
13 | 13 | ||
14 | / { | 14 | / { |
15 | model = "Nokia N900"; | 15 | model = "Nokia N900"; |
@@ -125,6 +125,21 @@ | |||
125 | >; | 125 | >; |
126 | }; | 126 | }; |
127 | 127 | ||
128 | mmc2_pins: pinmux_mmc2_pins { | ||
129 | pinctrl-single,pins = < | ||
130 | 0x128 (PIN_INPUT_PULLUP | MUX_MODE0) /* sdmmc2_clk */ | ||
131 | 0x12a (PIN_INPUT_PULLUP | MUX_MODE0) /* sdmmc2_cmd */ | ||
132 | 0x12c (PIN_INPUT_PULLUP | MUX_MODE0) /* sdmmc2_dat0 */ | ||
133 | 0x12e (PIN_INPUT_PULLUP | MUX_MODE0) /* sdmmc2_dat1 */ | ||
134 | 0x130 (PIN_INPUT_PULLUP | MUX_MODE0) /* sdmmc2_dat2 */ | ||
135 | 0x132 (PIN_INPUT_PULLUP | MUX_MODE0) /* sdmmc2_dat3 */ | ||
136 | 0x134 (PIN_INPUT_PULLUP | MUX_MODE0) /* sdmmc2_dat4 */ | ||
137 | 0x136 (PIN_INPUT_PULLUP | MUX_MODE0) /* sdmmc2_dat5 */ | ||
138 | 0x138 (PIN_INPUT_PULLUP | MUX_MODE0) /* sdmmc2_dat6 */ | ||
139 | 0x13a (PIN_INPUT_PULLUP | MUX_MODE0) /* sdmmc2_dat7 */ | ||
140 | >; | ||
141 | }; | ||
142 | |||
128 | display_pins: pinmux_display_pins { | 143 | display_pins: pinmux_display_pins { |
129 | pinctrl-single,pins = < | 144 | pinctrl-single,pins = < |
130 | 0x0d4 (PIN_OUTPUT | MUX_MODE4) /* RX51_LCD_RESET_GPIO */ | 145 | 0x0d4 (PIN_OUTPUT | MUX_MODE4) /* RX51_LCD_RESET_GPIO */ |
@@ -358,8 +373,14 @@ | |||
358 | cd-gpios = <&gpio6 0 GPIO_ACTIVE_HIGH>; /* 160 */ | 373 | cd-gpios = <&gpio6 0 GPIO_ACTIVE_HIGH>; /* 160 */ |
359 | }; | 374 | }; |
360 | 375 | ||
376 | /* most boards use vaux3, only some old versions use vmmc2 instead */ | ||
361 | &mmc2 { | 377 | &mmc2 { |
362 | status = "disabled"; | 378 | pinctrl-names = "default"; |
379 | pinctrl-0 = <&mmc2_pins>; | ||
380 | vmmc-supply = <&vaux3>; | ||
381 | vmmc_aux-supply = <&vsim>; | ||
382 | bus-width = <8>; | ||
383 | non-removable; | ||
363 | }; | 384 | }; |
364 | 385 | ||
365 | &mmc3 { | 386 | &mmc3 { |
diff --git a/arch/arm/boot/dts/omap3-n950-n9.dtsi b/arch/arm/boot/dts/omap3-n950-n9.dtsi index 94eb77d3b9dd..5c26c184f2c1 100644 --- a/arch/arm/boot/dts/omap3-n950-n9.dtsi +++ b/arch/arm/boot/dts/omap3-n950-n9.dtsi | |||
@@ -8,7 +8,7 @@ | |||
8 | * published by the Free Software Foundation. | 8 | * published by the Free Software Foundation. |
9 | */ | 9 | */ |
10 | 10 | ||
11 | #include "omap36xx.dtsi" | 11 | #include "omap36xx-hs.dtsi" |
12 | 12 | ||
13 | / { | 13 | / { |
14 | cpus { | 14 | cpus { |
diff --git a/arch/arm/boot/dts/omap3.dtsi b/arch/arm/boot/dts/omap3.dtsi index f3a0c26ed0c2..daabf99d402a 100644 --- a/arch/arm/boot/dts/omap3.dtsi +++ b/arch/arm/boot/dts/omap3.dtsi | |||
@@ -82,6 +82,13 @@ | |||
82 | ranges; | 82 | ranges; |
83 | ti,hwmods = "l3_main"; | 83 | ti,hwmods = "l3_main"; |
84 | 84 | ||
85 | aes: aes@480c5000 { | ||
86 | compatible = "ti,omap3-aes"; | ||
87 | ti,hwmods = "aes"; | ||
88 | reg = <0x480c5000 0x50>; | ||
89 | interrupts = <0>; | ||
90 | }; | ||
91 | |||
85 | counter32k: counter@48320000 { | 92 | counter32k: counter@48320000 { |
86 | compatible = "ti,omap-counter32k"; | 93 | compatible = "ti,omap-counter32k"; |
87 | reg = <0x48320000 0x20>; | 94 | reg = <0x48320000 0x20>; |
@@ -260,6 +267,13 @@ | |||
260 | ti,hwmods = "i2c3"; | 267 | ti,hwmods = "i2c3"; |
261 | }; | 268 | }; |
262 | 269 | ||
270 | mailbox: mailbox@48094000 { | ||
271 | compatible = "ti,omap3-mailbox"; | ||
272 | ti,hwmods = "mailbox"; | ||
273 | reg = <0x48094000 0x200>; | ||
274 | interrupts = <26>; | ||
275 | }; | ||
276 | |||
263 | mcspi1: spi@48098000 { | 277 | mcspi1: spi@48098000 { |
264 | compatible = "ti,omap2-mcspi"; | 278 | compatible = "ti,omap2-mcspi"; |
265 | reg = <0x48098000 0x100>; | 279 | reg = <0x48098000 0x100>; |
@@ -357,6 +371,13 @@ | |||
357 | dma-names = "tx", "rx"; | 371 | dma-names = "tx", "rx"; |
358 | }; | 372 | }; |
359 | 373 | ||
374 | mmu_isp: mmu@480bd400 { | ||
375 | compatible = "ti,omap3-mmu-isp"; | ||
376 | ti,hwmods = "mmu_isp"; | ||
377 | reg = <0x480bd400 0x80>; | ||
378 | interrupts = <8>; | ||
379 | }; | ||
380 | |||
360 | wdt2: wdt@48314000 { | 381 | wdt2: wdt@48314000 { |
361 | compatible = "ti,omap3-wdt"; | 382 | compatible = "ti,omap3-wdt"; |
362 | reg = <0x48314000 0x80>; | 383 | reg = <0x48314000 0x80>; |
@@ -442,6 +463,27 @@ | |||
442 | dma-names = "tx", "rx"; | 463 | dma-names = "tx", "rx"; |
443 | }; | 464 | }; |
444 | 465 | ||
466 | sham: sham@480c3000 { | ||
467 | compatible = "ti,omap3-sham"; | ||
468 | ti,hwmods = "sham"; | ||
469 | reg = <0x480c3000 0x64>; | ||
470 | interrupts = <49>; | ||
471 | }; | ||
472 | |||
473 | smartreflex_core: smartreflex@480cb000 { | ||
474 | compatible = "ti,omap3-smartreflex-core"; | ||
475 | ti,hwmods = "smartreflex_core"; | ||
476 | reg = <0x480cb000 0x400>; | ||
477 | interrupts = <19>; | ||
478 | }; | ||
479 | |||
480 | smartreflex_mpu_iva: smartreflex@480c9000 { | ||
481 | compatible = "ti,omap3-smartreflex-iva"; | ||
482 | ti,hwmods = "smartreflex_mpu_iva"; | ||
483 | reg = <0x480c9000 0x400>; | ||
484 | interrupts = <18>; | ||
485 | }; | ||
486 | |||
445 | timer1: timer@48318000 { | 487 | timer1: timer@48318000 { |
446 | compatible = "ti,omap3430-timer"; | 488 | compatible = "ti,omap3430-timer"; |
447 | reg = <0x48318000 0x400>; | 489 | reg = <0x48318000 0x400>; |
diff --git a/arch/arm/boot/dts/omap34xx-hs.dtsi b/arch/arm/boot/dts/omap34xx-hs.dtsi new file mode 100644 index 000000000000..1ff626489546 --- /dev/null +++ b/arch/arm/boot/dts/omap34xx-hs.dtsi | |||
@@ -0,0 +1,16 @@ | |||
1 | /* Disabled modules for secure omaps */ | ||
2 | |||
3 | #include "omap34xx.dtsi" | ||
4 | |||
5 | /* Secure omaps have some devices inaccessible depending on the firmware */ | ||
6 | &aes { | ||
7 | status = "disabled"; | ||
8 | }; | ||
9 | |||
10 | &sham { | ||
11 | status = "disabled"; | ||
12 | }; | ||
13 | |||
14 | &timer12 { | ||
15 | status = "disabled"; | ||
16 | }; | ||
diff --git a/arch/arm/boot/dts/omap36xx-hs.dtsi b/arch/arm/boot/dts/omap36xx-hs.dtsi new file mode 100644 index 000000000000..2c7febb0e016 --- /dev/null +++ b/arch/arm/boot/dts/omap36xx-hs.dtsi | |||
@@ -0,0 +1,16 @@ | |||
1 | /* Disabled modules for secure omaps */ | ||
2 | |||
3 | #include "omap36xx.dtsi" | ||
4 | |||
5 | /* Secure omaps have some devices inaccessible depending on the firmware */ | ||
6 | &aes { | ||
7 | status = "disabled"; | ||
8 | }; | ||
9 | |||
10 | &sham { | ||
11 | status = "disabled"; | ||
12 | }; | ||
13 | |||
14 | &timer12 { | ||
15 | status = "disabled"; | ||
16 | }; | ||
diff --git a/arch/arm/boot/dts/omap4-panda-common.dtsi b/arch/arm/boot/dts/omap4-panda-common.dtsi index 298e85020e1b..88c6a05cab41 100644 --- a/arch/arm/boot/dts/omap4-panda-common.dtsi +++ b/arch/arm/boot/dts/omap4-panda-common.dtsi | |||
@@ -246,15 +246,6 @@ | |||
246 | 0xf0 (PIN_INPUT_PULLUP | MUX_MODE0) /* i2c4_sda */ | 246 | 0xf0 (PIN_INPUT_PULLUP | MUX_MODE0) /* i2c4_sda */ |
247 | >; | 247 | >; |
248 | }; | 248 | }; |
249 | }; | ||
250 | |||
251 | &omap4_pmx_wkup { | ||
252 | led_wkgpio_pins: pinmux_leds_wkpins { | ||
253 | pinctrl-single,pins = < | ||
254 | 0x1a (PIN_OUTPUT | MUX_MODE3) /* gpio_wk7 */ | ||
255 | 0x1c (PIN_OUTPUT | MUX_MODE3) /* gpio_wk8 */ | ||
256 | >; | ||
257 | }; | ||
258 | 249 | ||
259 | /* | 250 | /* |
260 | * wl12xx GPIO outputs for WLAN_EN, BT_EN, FM_EN, BT_WAKEUP | 251 | * wl12xx GPIO outputs for WLAN_EN, BT_EN, FM_EN, BT_WAKEUP |
@@ -274,7 +265,7 @@ | |||
274 | pinctrl-single,pins = < | 265 | pinctrl-single,pins = < |
275 | 0x38 (PIN_INPUT | MUX_MODE3) /* gpmc_ncs2.gpio_52 */ | 266 | 0x38 (PIN_INPUT | MUX_MODE3) /* gpmc_ncs2.gpio_52 */ |
276 | 0x3a (PIN_INPUT | MUX_MODE3) /* gpmc_ncs3.gpio_53 */ | 267 | 0x3a (PIN_INPUT | MUX_MODE3) /* gpmc_ncs3.gpio_53 */ |
277 | 0x108 (PIN_OUTPUT | MUX_MODE0) /* sdmmc5_clk.sdmmc5_clk */ | 268 | 0x108 (PIN_INPUT_PULLUP | MUX_MODE0) /* sdmmc5_clk.sdmmc5_clk */ |
278 | 0x10a (PIN_INPUT_PULLUP | MUX_MODE0) /* sdmmc5_cmd.sdmmc5_cmd */ | 269 | 0x10a (PIN_INPUT_PULLUP | MUX_MODE0) /* sdmmc5_cmd.sdmmc5_cmd */ |
279 | 0x10c (PIN_INPUT_PULLUP | MUX_MODE0) /* sdmmc5_dat0.sdmmc5_dat0 */ | 270 | 0x10c (PIN_INPUT_PULLUP | MUX_MODE0) /* sdmmc5_dat0.sdmmc5_dat0 */ |
280 | 0x10e (PIN_INPUT_PULLUP | MUX_MODE0) /* sdmmc5_dat1.sdmmc5_dat1 */ | 271 | 0x10e (PIN_INPUT_PULLUP | MUX_MODE0) /* sdmmc5_dat1.sdmmc5_dat1 */ |
@@ -284,6 +275,15 @@ | |||
284 | }; | 275 | }; |
285 | }; | 276 | }; |
286 | 277 | ||
278 | &omap4_pmx_wkup { | ||
279 | led_wkgpio_pins: pinmux_leds_wkpins { | ||
280 | pinctrl-single,pins = < | ||
281 | 0x1a (PIN_OUTPUT | MUX_MODE3) /* gpio_wk7 */ | ||
282 | 0x1c (PIN_OUTPUT | MUX_MODE3) /* gpio_wk8 */ | ||
283 | >; | ||
284 | }; | ||
285 | }; | ||
286 | |||
287 | &i2c1 { | 287 | &i2c1 { |
288 | pinctrl-names = "default"; | 288 | pinctrl-names = "default"; |
289 | pinctrl-0 = <&i2c1_pins>; | 289 | pinctrl-0 = <&i2c1_pins>; |
diff --git a/arch/arm/boot/dts/omap4-sdp.dts b/arch/arm/boot/dts/omap4-sdp.dts index 5fc3f43c5a81..dbc81fb6ef03 100644 --- a/arch/arm/boot/dts/omap4-sdp.dts +++ b/arch/arm/boot/dts/omap4-sdp.dts | |||
@@ -300,12 +300,12 @@ | |||
300 | wl12xx_pins: pinmux_wl12xx_pins { | 300 | wl12xx_pins: pinmux_wl12xx_pins { |
301 | pinctrl-single,pins = < | 301 | pinctrl-single,pins = < |
302 | 0x3a (PIN_INPUT | MUX_MODE3) /* gpmc_ncs3.gpio_53 */ | 302 | 0x3a (PIN_INPUT | MUX_MODE3) /* gpmc_ncs3.gpio_53 */ |
303 | 0x108 (PIN_OUTPUT | MUX_MODE3) /* sdmmc5_clk.sdmmc5_clk */ | 303 | 0x108 (PIN_INPUT_PULLUP | MUX_MODE0) /* sdmmc5_clk.sdmmc5_clk */ |
304 | 0x10a (PIN_INPUT_PULLUP | MUX_MODE3) /* sdmmc5_cmd.sdmmc5_cmd */ | 304 | 0x10a (PIN_INPUT_PULLUP | MUX_MODE0) /* sdmmc5_cmd.sdmmc5_cmd */ |
305 | 0x10c (PIN_INPUT_PULLUP | MUX_MODE3) /* sdmmc5_dat0.sdmmc5_dat0 */ | 305 | 0x10c (PIN_INPUT_PULLUP | MUX_MODE0) /* sdmmc5_dat0.sdmmc5_dat0 */ |
306 | 0x10e (PIN_INPUT_PULLUP | MUX_MODE3) /* sdmmc5_dat1.sdmmc5_dat1 */ | 306 | 0x10e (PIN_INPUT_PULLUP | MUX_MODE0) /* sdmmc5_dat1.sdmmc5_dat1 */ |
307 | 0x110 (PIN_INPUT_PULLUP | MUX_MODE3) /* sdmmc5_dat2.sdmmc5_dat2 */ | 307 | 0x110 (PIN_INPUT_PULLUP | MUX_MODE0) /* sdmmc5_dat2.sdmmc5_dat2 */ |
308 | 0x112 (PIN_INPUT_PULLUP | MUX_MODE3) /* sdmmc5_dat3.sdmmc5_dat3 */ | 308 | 0x112 (PIN_INPUT_PULLUP | MUX_MODE0) /* sdmmc5_dat3.sdmmc5_dat3 */ |
309 | >; | 309 | >; |
310 | }; | 310 | }; |
311 | }; | 311 | }; |
diff --git a/arch/arm/boot/dts/socfpga.dtsi b/arch/arm/boot/dts/socfpga.dtsi index 6d09b8d42fdd..f936476c2753 100644 --- a/arch/arm/boot/dts/socfpga.dtsi +++ b/arch/arm/boot/dts/socfpga.dtsi | |||
@@ -245,14 +245,14 @@ | |||
245 | 245 | ||
246 | mpu_periph_clk: mpu_periph_clk { | 246 | mpu_periph_clk: mpu_periph_clk { |
247 | #clock-cells = <0>; | 247 | #clock-cells = <0>; |
248 | compatible = "altr,socfpga-gate-clk"; | 248 | compatible = "altr,socfpga-perip-clk"; |
249 | clocks = <&mpuclk>; | 249 | clocks = <&mpuclk>; |
250 | fixed-divider = <4>; | 250 | fixed-divider = <4>; |
251 | }; | 251 | }; |
252 | 252 | ||
253 | mpu_l2_ram_clk: mpu_l2_ram_clk { | 253 | mpu_l2_ram_clk: mpu_l2_ram_clk { |
254 | #clock-cells = <0>; | 254 | #clock-cells = <0>; |
255 | compatible = "altr,socfpga-gate-clk"; | 255 | compatible = "altr,socfpga-perip-clk"; |
256 | clocks = <&mpuclk>; | 256 | clocks = <&mpuclk>; |
257 | fixed-divider = <2>; | 257 | fixed-divider = <2>; |
258 | }; | 258 | }; |
@@ -266,8 +266,9 @@ | |||
266 | 266 | ||
267 | l3_main_clk: l3_main_clk { | 267 | l3_main_clk: l3_main_clk { |
268 | #clock-cells = <0>; | 268 | #clock-cells = <0>; |
269 | compatible = "altr,socfpga-gate-clk"; | 269 | compatible = "altr,socfpga-perip-clk"; |
270 | clocks = <&mainclk>; | 270 | clocks = <&mainclk>; |
271 | fixed-divider = <1>; | ||
271 | }; | 272 | }; |
272 | 273 | ||
273 | l3_mp_clk: l3_mp_clk { | 274 | l3_mp_clk: l3_mp_clk { |
diff --git a/arch/arm/boot/dts/sun6i-a31.dtsi b/arch/arm/boot/dts/sun6i-a31.dtsi index c1751a64889a..7f5878c2784a 100644 --- a/arch/arm/boot/dts/sun6i-a31.dtsi +++ b/arch/arm/boot/dts/sun6i-a31.dtsi | |||
@@ -193,7 +193,10 @@ | |||
193 | pio: pinctrl@01c20800 { | 193 | pio: pinctrl@01c20800 { |
194 | compatible = "allwinner,sun6i-a31-pinctrl"; | 194 | compatible = "allwinner,sun6i-a31-pinctrl"; |
195 | reg = <0x01c20800 0x400>; | 195 | reg = <0x01c20800 0x400>; |
196 | interrupts = <0 11 1>, <0 15 1>, <0 16 1>, <0 17 1>; | 196 | interrupts = <0 11 4>, |
197 | <0 15 4>, | ||
198 | <0 16 4>, | ||
199 | <0 17 4>; | ||
197 | clocks = <&apb1_gates 5>; | 200 | clocks = <&apb1_gates 5>; |
198 | gpio-controller; | 201 | gpio-controller; |
199 | interrupt-controller; | 202 | interrupt-controller; |
@@ -212,11 +215,11 @@ | |||
212 | timer@01c20c00 { | 215 | timer@01c20c00 { |
213 | compatible = "allwinner,sun4i-timer"; | 216 | compatible = "allwinner,sun4i-timer"; |
214 | reg = <0x01c20c00 0xa0>; | 217 | reg = <0x01c20c00 0xa0>; |
215 | interrupts = <0 18 1>, | 218 | interrupts = <0 18 4>, |
216 | <0 19 1>, | 219 | <0 19 4>, |
217 | <0 20 1>, | 220 | <0 20 4>, |
218 | <0 21 1>, | 221 | <0 21 4>, |
219 | <0 22 1>; | 222 | <0 22 4>; |
220 | clocks = <&osc24M>; | 223 | clocks = <&osc24M>; |
221 | }; | 224 | }; |
222 | 225 | ||
@@ -228,7 +231,7 @@ | |||
228 | uart0: serial@01c28000 { | 231 | uart0: serial@01c28000 { |
229 | compatible = "snps,dw-apb-uart"; | 232 | compatible = "snps,dw-apb-uart"; |
230 | reg = <0x01c28000 0x400>; | 233 | reg = <0x01c28000 0x400>; |
231 | interrupts = <0 0 1>; | 234 | interrupts = <0 0 4>; |
232 | reg-shift = <2>; | 235 | reg-shift = <2>; |
233 | reg-io-width = <4>; | 236 | reg-io-width = <4>; |
234 | clocks = <&apb2_gates 16>; | 237 | clocks = <&apb2_gates 16>; |
@@ -238,7 +241,7 @@ | |||
238 | uart1: serial@01c28400 { | 241 | uart1: serial@01c28400 { |
239 | compatible = "snps,dw-apb-uart"; | 242 | compatible = "snps,dw-apb-uart"; |
240 | reg = <0x01c28400 0x400>; | 243 | reg = <0x01c28400 0x400>; |
241 | interrupts = <0 1 1>; | 244 | interrupts = <0 1 4>; |
242 | reg-shift = <2>; | 245 | reg-shift = <2>; |
243 | reg-io-width = <4>; | 246 | reg-io-width = <4>; |
244 | clocks = <&apb2_gates 17>; | 247 | clocks = <&apb2_gates 17>; |
@@ -248,7 +251,7 @@ | |||
248 | uart2: serial@01c28800 { | 251 | uart2: serial@01c28800 { |
249 | compatible = "snps,dw-apb-uart"; | 252 | compatible = "snps,dw-apb-uart"; |
250 | reg = <0x01c28800 0x400>; | 253 | reg = <0x01c28800 0x400>; |
251 | interrupts = <0 2 1>; | 254 | interrupts = <0 2 4>; |
252 | reg-shift = <2>; | 255 | reg-shift = <2>; |
253 | reg-io-width = <4>; | 256 | reg-io-width = <4>; |
254 | clocks = <&apb2_gates 18>; | 257 | clocks = <&apb2_gates 18>; |
@@ -258,7 +261,7 @@ | |||
258 | uart3: serial@01c28c00 { | 261 | uart3: serial@01c28c00 { |
259 | compatible = "snps,dw-apb-uart"; | 262 | compatible = "snps,dw-apb-uart"; |
260 | reg = <0x01c28c00 0x400>; | 263 | reg = <0x01c28c00 0x400>; |
261 | interrupts = <0 3 1>; | 264 | interrupts = <0 3 4>; |
262 | reg-shift = <2>; | 265 | reg-shift = <2>; |
263 | reg-io-width = <4>; | 266 | reg-io-width = <4>; |
264 | clocks = <&apb2_gates 19>; | 267 | clocks = <&apb2_gates 19>; |
@@ -268,7 +271,7 @@ | |||
268 | uart4: serial@01c29000 { | 271 | uart4: serial@01c29000 { |
269 | compatible = "snps,dw-apb-uart"; | 272 | compatible = "snps,dw-apb-uart"; |
270 | reg = <0x01c29000 0x400>; | 273 | reg = <0x01c29000 0x400>; |
271 | interrupts = <0 4 1>; | 274 | interrupts = <0 4 4>; |
272 | reg-shift = <2>; | 275 | reg-shift = <2>; |
273 | reg-io-width = <4>; | 276 | reg-io-width = <4>; |
274 | clocks = <&apb2_gates 20>; | 277 | clocks = <&apb2_gates 20>; |
@@ -278,7 +281,7 @@ | |||
278 | uart5: serial@01c29400 { | 281 | uart5: serial@01c29400 { |
279 | compatible = "snps,dw-apb-uart"; | 282 | compatible = "snps,dw-apb-uart"; |
280 | reg = <0x01c29400 0x400>; | 283 | reg = <0x01c29400 0x400>; |
281 | interrupts = <0 5 1>; | 284 | interrupts = <0 5 4>; |
282 | reg-shift = <2>; | 285 | reg-shift = <2>; |
283 | reg-io-width = <4>; | 286 | reg-io-width = <4>; |
284 | clocks = <&apb2_gates 21>; | 287 | clocks = <&apb2_gates 21>; |
diff --git a/arch/arm/boot/dts/sun7i-a20.dtsi b/arch/arm/boot/dts/sun7i-a20.dtsi index e46cfedde74c..367611a0730b 100644 --- a/arch/arm/boot/dts/sun7i-a20.dtsi +++ b/arch/arm/boot/dts/sun7i-a20.dtsi | |||
@@ -170,7 +170,7 @@ | |||
170 | emac: ethernet@01c0b000 { | 170 | emac: ethernet@01c0b000 { |
171 | compatible = "allwinner,sun4i-emac"; | 171 | compatible = "allwinner,sun4i-emac"; |
172 | reg = <0x01c0b000 0x1000>; | 172 | reg = <0x01c0b000 0x1000>; |
173 | interrupts = <0 55 1>; | 173 | interrupts = <0 55 4>; |
174 | clocks = <&ahb_gates 17>; | 174 | clocks = <&ahb_gates 17>; |
175 | status = "disabled"; | 175 | status = "disabled"; |
176 | }; | 176 | }; |
@@ -186,7 +186,7 @@ | |||
186 | pio: pinctrl@01c20800 { | 186 | pio: pinctrl@01c20800 { |
187 | compatible = "allwinner,sun7i-a20-pinctrl"; | 187 | compatible = "allwinner,sun7i-a20-pinctrl"; |
188 | reg = <0x01c20800 0x400>; | 188 | reg = <0x01c20800 0x400>; |
189 | interrupts = <0 28 1>; | 189 | interrupts = <0 28 4>; |
190 | clocks = <&apb0_gates 5>; | 190 | clocks = <&apb0_gates 5>; |
191 | gpio-controller; | 191 | gpio-controller; |
192 | interrupt-controller; | 192 | interrupt-controller; |
@@ -251,12 +251,12 @@ | |||
251 | timer@01c20c00 { | 251 | timer@01c20c00 { |
252 | compatible = "allwinner,sun4i-timer"; | 252 | compatible = "allwinner,sun4i-timer"; |
253 | reg = <0x01c20c00 0x90>; | 253 | reg = <0x01c20c00 0x90>; |
254 | interrupts = <0 22 1>, | 254 | interrupts = <0 22 4>, |
255 | <0 23 1>, | 255 | <0 23 4>, |
256 | <0 24 1>, | 256 | <0 24 4>, |
257 | <0 25 1>, | 257 | <0 25 4>, |
258 | <0 67 1>, | 258 | <0 67 4>, |
259 | <0 68 1>; | 259 | <0 68 4>; |
260 | clocks = <&osc24M>; | 260 | clocks = <&osc24M>; |
261 | }; | 261 | }; |
262 | 262 | ||
@@ -273,7 +273,7 @@ | |||
273 | uart0: serial@01c28000 { | 273 | uart0: serial@01c28000 { |
274 | compatible = "snps,dw-apb-uart"; | 274 | compatible = "snps,dw-apb-uart"; |
275 | reg = <0x01c28000 0x400>; | 275 | reg = <0x01c28000 0x400>; |
276 | interrupts = <0 1 1>; | 276 | interrupts = <0 1 4>; |
277 | reg-shift = <2>; | 277 | reg-shift = <2>; |
278 | reg-io-width = <4>; | 278 | reg-io-width = <4>; |
279 | clocks = <&apb1_gates 16>; | 279 | clocks = <&apb1_gates 16>; |
@@ -283,7 +283,7 @@ | |||
283 | uart1: serial@01c28400 { | 283 | uart1: serial@01c28400 { |
284 | compatible = "snps,dw-apb-uart"; | 284 | compatible = "snps,dw-apb-uart"; |
285 | reg = <0x01c28400 0x400>; | 285 | reg = <0x01c28400 0x400>; |
286 | interrupts = <0 2 1>; | 286 | interrupts = <0 2 4>; |
287 | reg-shift = <2>; | 287 | reg-shift = <2>; |
288 | reg-io-width = <4>; | 288 | reg-io-width = <4>; |
289 | clocks = <&apb1_gates 17>; | 289 | clocks = <&apb1_gates 17>; |
@@ -293,7 +293,7 @@ | |||
293 | uart2: serial@01c28800 { | 293 | uart2: serial@01c28800 { |
294 | compatible = "snps,dw-apb-uart"; | 294 | compatible = "snps,dw-apb-uart"; |
295 | reg = <0x01c28800 0x400>; | 295 | reg = <0x01c28800 0x400>; |
296 | interrupts = <0 3 1>; | 296 | interrupts = <0 3 4>; |
297 | reg-shift = <2>; | 297 | reg-shift = <2>; |
298 | reg-io-width = <4>; | 298 | reg-io-width = <4>; |
299 | clocks = <&apb1_gates 18>; | 299 | clocks = <&apb1_gates 18>; |
@@ -303,7 +303,7 @@ | |||
303 | uart3: serial@01c28c00 { | 303 | uart3: serial@01c28c00 { |
304 | compatible = "snps,dw-apb-uart"; | 304 | compatible = "snps,dw-apb-uart"; |
305 | reg = <0x01c28c00 0x400>; | 305 | reg = <0x01c28c00 0x400>; |
306 | interrupts = <0 4 1>; | 306 | interrupts = <0 4 4>; |
307 | reg-shift = <2>; | 307 | reg-shift = <2>; |
308 | reg-io-width = <4>; | 308 | reg-io-width = <4>; |
309 | clocks = <&apb1_gates 19>; | 309 | clocks = <&apb1_gates 19>; |
@@ -313,7 +313,7 @@ | |||
313 | uart4: serial@01c29000 { | 313 | uart4: serial@01c29000 { |
314 | compatible = "snps,dw-apb-uart"; | 314 | compatible = "snps,dw-apb-uart"; |
315 | reg = <0x01c29000 0x400>; | 315 | reg = <0x01c29000 0x400>; |
316 | interrupts = <0 17 1>; | 316 | interrupts = <0 17 4>; |
317 | reg-shift = <2>; | 317 | reg-shift = <2>; |
318 | reg-io-width = <4>; | 318 | reg-io-width = <4>; |
319 | clocks = <&apb1_gates 20>; | 319 | clocks = <&apb1_gates 20>; |
@@ -323,7 +323,7 @@ | |||
323 | uart5: serial@01c29400 { | 323 | uart5: serial@01c29400 { |
324 | compatible = "snps,dw-apb-uart"; | 324 | compatible = "snps,dw-apb-uart"; |
325 | reg = <0x01c29400 0x400>; | 325 | reg = <0x01c29400 0x400>; |
326 | interrupts = <0 18 1>; | 326 | interrupts = <0 18 4>; |
327 | reg-shift = <2>; | 327 | reg-shift = <2>; |
328 | reg-io-width = <4>; | 328 | reg-io-width = <4>; |
329 | clocks = <&apb1_gates 21>; | 329 | clocks = <&apb1_gates 21>; |
@@ -333,7 +333,7 @@ | |||
333 | uart6: serial@01c29800 { | 333 | uart6: serial@01c29800 { |
334 | compatible = "snps,dw-apb-uart"; | 334 | compatible = "snps,dw-apb-uart"; |
335 | reg = <0x01c29800 0x400>; | 335 | reg = <0x01c29800 0x400>; |
336 | interrupts = <0 19 1>; | 336 | interrupts = <0 19 4>; |
337 | reg-shift = <2>; | 337 | reg-shift = <2>; |
338 | reg-io-width = <4>; | 338 | reg-io-width = <4>; |
339 | clocks = <&apb1_gates 22>; | 339 | clocks = <&apb1_gates 22>; |
@@ -343,7 +343,7 @@ | |||
343 | uart7: serial@01c29c00 { | 343 | uart7: serial@01c29c00 { |
344 | compatible = "snps,dw-apb-uart"; | 344 | compatible = "snps,dw-apb-uart"; |
345 | reg = <0x01c29c00 0x400>; | 345 | reg = <0x01c29c00 0x400>; |
346 | interrupts = <0 20 1>; | 346 | interrupts = <0 20 4>; |
347 | reg-shift = <2>; | 347 | reg-shift = <2>; |
348 | reg-io-width = <4>; | 348 | reg-io-width = <4>; |
349 | clocks = <&apb1_gates 23>; | 349 | clocks = <&apb1_gates 23>; |
@@ -353,7 +353,7 @@ | |||
353 | i2c0: i2c@01c2ac00 { | 353 | i2c0: i2c@01c2ac00 { |
354 | compatible = "allwinner,sun4i-i2c"; | 354 | compatible = "allwinner,sun4i-i2c"; |
355 | reg = <0x01c2ac00 0x400>; | 355 | reg = <0x01c2ac00 0x400>; |
356 | interrupts = <0 7 1>; | 356 | interrupts = <0 7 4>; |
357 | clocks = <&apb1_gates 0>; | 357 | clocks = <&apb1_gates 0>; |
358 | clock-frequency = <100000>; | 358 | clock-frequency = <100000>; |
359 | status = "disabled"; | 359 | status = "disabled"; |
@@ -362,7 +362,7 @@ | |||
362 | i2c1: i2c@01c2b000 { | 362 | i2c1: i2c@01c2b000 { |
363 | compatible = "allwinner,sun4i-i2c"; | 363 | compatible = "allwinner,sun4i-i2c"; |
364 | reg = <0x01c2b000 0x400>; | 364 | reg = <0x01c2b000 0x400>; |
365 | interrupts = <0 8 1>; | 365 | interrupts = <0 8 4>; |
366 | clocks = <&apb1_gates 1>; | 366 | clocks = <&apb1_gates 1>; |
367 | clock-frequency = <100000>; | 367 | clock-frequency = <100000>; |
368 | status = "disabled"; | 368 | status = "disabled"; |
@@ -371,7 +371,7 @@ | |||
371 | i2c2: i2c@01c2b400 { | 371 | i2c2: i2c@01c2b400 { |
372 | compatible = "allwinner,sun4i-i2c"; | 372 | compatible = "allwinner,sun4i-i2c"; |
373 | reg = <0x01c2b400 0x400>; | 373 | reg = <0x01c2b400 0x400>; |
374 | interrupts = <0 9 1>; | 374 | interrupts = <0 9 4>; |
375 | clocks = <&apb1_gates 2>; | 375 | clocks = <&apb1_gates 2>; |
376 | clock-frequency = <100000>; | 376 | clock-frequency = <100000>; |
377 | status = "disabled"; | 377 | status = "disabled"; |
@@ -380,7 +380,7 @@ | |||
380 | i2c3: i2c@01c2b800 { | 380 | i2c3: i2c@01c2b800 { |
381 | compatible = "allwinner,sun4i-i2c"; | 381 | compatible = "allwinner,sun4i-i2c"; |
382 | reg = <0x01c2b800 0x400>; | 382 | reg = <0x01c2b800 0x400>; |
383 | interrupts = <0 88 1>; | 383 | interrupts = <0 88 4>; |
384 | clocks = <&apb1_gates 3>; | 384 | clocks = <&apb1_gates 3>; |
385 | clock-frequency = <100000>; | 385 | clock-frequency = <100000>; |
386 | status = "disabled"; | 386 | status = "disabled"; |
@@ -389,7 +389,7 @@ | |||
389 | i2c4: i2c@01c2bc00 { | 389 | i2c4: i2c@01c2bc00 { |
390 | compatible = "allwinner,sun4i-i2c"; | 390 | compatible = "allwinner,sun4i-i2c"; |
391 | reg = <0x01c2bc00 0x400>; | 391 | reg = <0x01c2bc00 0x400>; |
392 | interrupts = <0 89 1>; | 392 | interrupts = <0 89 4>; |
393 | clocks = <&apb1_gates 15>; | 393 | clocks = <&apb1_gates 15>; |
394 | clock-frequency = <100000>; | 394 | clock-frequency = <100000>; |
395 | status = "disabled"; | 395 | status = "disabled"; |
diff --git a/arch/arm/configs/multi_v7_defconfig b/arch/arm/configs/multi_v7_defconfig index 4a5903e04827..c1df4e9db140 100644 --- a/arch/arm/configs/multi_v7_defconfig +++ b/arch/arm/configs/multi_v7_defconfig | |||
@@ -69,6 +69,7 @@ CONFIG_KS8851=y | |||
69 | CONFIG_SMSC911X=y | 69 | CONFIG_SMSC911X=y |
70 | CONFIG_STMMAC_ETH=y | 70 | CONFIG_STMMAC_ETH=y |
71 | CONFIG_MDIO_SUN4I=y | 71 | CONFIG_MDIO_SUN4I=y |
72 | CONFIG_TI_CPSW=y | ||
72 | CONFIG_KEYBOARD_SPEAR=y | 73 | CONFIG_KEYBOARD_SPEAR=y |
73 | CONFIG_SERIO_AMBAKMI=y | 74 | CONFIG_SERIO_AMBAKMI=y |
74 | CONFIG_SERIAL_8250=y | 75 | CONFIG_SERIAL_8250=y |
@@ -133,12 +134,14 @@ CONFIG_USB_GPIO_VBUS=y | |||
133 | CONFIG_USB_ISP1301=y | 134 | CONFIG_USB_ISP1301=y |
134 | CONFIG_USB_MXS_PHY=y | 135 | CONFIG_USB_MXS_PHY=y |
135 | CONFIG_MMC=y | 136 | CONFIG_MMC=y |
137 | CONFIG_MMC_BLOCK_MINORS=16 | ||
136 | CONFIG_MMC_ARMMMCI=y | 138 | CONFIG_MMC_ARMMMCI=y |
137 | CONFIG_MMC_SDHCI=y | 139 | CONFIG_MMC_SDHCI=y |
138 | CONFIG_MMC_SDHCI_PLTFM=y | 140 | CONFIG_MMC_SDHCI_PLTFM=y |
139 | CONFIG_MMC_SDHCI_ESDHC_IMX=y | 141 | CONFIG_MMC_SDHCI_ESDHC_IMX=y |
140 | CONFIG_MMC_SDHCI_TEGRA=y | 142 | CONFIG_MMC_SDHCI_TEGRA=y |
141 | CONFIG_MMC_SDHCI_SPEAR=y | 143 | CONFIG_MMC_SDHCI_SPEAR=y |
144 | CONFIG_MMC_SDHCI_BCM_KONA=y | ||
142 | CONFIG_MMC_OMAP=y | 145 | CONFIG_MMC_OMAP=y |
143 | CONFIG_MMC_OMAP_HS=y | 146 | CONFIG_MMC_OMAP_HS=y |
144 | CONFIG_EDAC=y | 147 | CONFIG_EDAC=y |
diff --git a/arch/arm/configs/omap2plus_defconfig b/arch/arm/configs/omap2plus_defconfig index 98a50c309b90..bfa80a11e8c7 100644 --- a/arch/arm/configs/omap2plus_defconfig +++ b/arch/arm/configs/omap2plus_defconfig | |||
@@ -173,6 +173,7 @@ CONFIG_MFD_PALMAS=y | |||
173 | CONFIG_MFD_TPS65217=y | 173 | CONFIG_MFD_TPS65217=y |
174 | CONFIG_MFD_TPS65910=y | 174 | CONFIG_MFD_TPS65910=y |
175 | CONFIG_TWL6040_CORE=y | 175 | CONFIG_TWL6040_CORE=y |
176 | CONFIG_REGULATOR_FIXED_VOLTAGE=y | ||
176 | CONFIG_REGULATOR_PALMAS=y | 177 | CONFIG_REGULATOR_PALMAS=y |
177 | CONFIG_REGULATOR_TPS65023=y | 178 | CONFIG_REGULATOR_TPS65023=y |
178 | CONFIG_REGULATOR_TPS6507X=y | 179 | CONFIG_REGULATOR_TPS6507X=y |
diff --git a/arch/arm/configs/sunxi_defconfig b/arch/arm/configs/sunxi_defconfig index d57a85badb5e..3e2259b60236 100644 --- a/arch/arm/configs/sunxi_defconfig +++ b/arch/arm/configs/sunxi_defconfig | |||
@@ -12,6 +12,9 @@ CONFIG_NET=y | |||
12 | CONFIG_PACKET=y | 12 | CONFIG_PACKET=y |
13 | CONFIG_UNIX=y | 13 | CONFIG_UNIX=y |
14 | CONFIG_INET=y | 14 | CONFIG_INET=y |
15 | CONFIG_IP_PNP=y | ||
16 | CONFIG_IP_PNP_DHCP=y | ||
17 | CONFIG_IP_PNP_BOOTP=y | ||
15 | # CONFIG_INET_XFRM_MODE_TRANSPORT is not set | 18 | # CONFIG_INET_XFRM_MODE_TRANSPORT is not set |
16 | # CONFIG_INET_XFRM_MODE_TUNNEL is not set | 19 | # CONFIG_INET_XFRM_MODE_TUNNEL is not set |
17 | # CONFIG_INET_XFRM_MODE_BEET is not set | 20 | # CONFIG_INET_XFRM_MODE_BEET is not set |
@@ -58,4 +61,8 @@ CONFIG_LEDS_TRIGGER_HEARTBEAT=y | |||
58 | CONFIG_LEDS_TRIGGER_DEFAULT_ON=y | 61 | CONFIG_LEDS_TRIGGER_DEFAULT_ON=y |
59 | CONFIG_COMMON_CLK_DEBUG=y | 62 | CONFIG_COMMON_CLK_DEBUG=y |
60 | # CONFIG_IOMMU_SUPPORT is not set | 63 | # CONFIG_IOMMU_SUPPORT is not set |
64 | CONFIG_TMPFS=y | ||
65 | CONFIG_NFS_FS=y | ||
66 | CONFIG_ROOT_NFS=y | ||
61 | CONFIG_NLS=y | 67 | CONFIG_NLS=y |
68 | CONFIG_PRINTK_TIME=y | ||
diff --git a/arch/arm/configs/u8500_defconfig b/arch/arm/configs/u8500_defconfig index ac632cc38f24..c6ebc184bf68 100644 --- a/arch/arm/configs/u8500_defconfig +++ b/arch/arm/configs/u8500_defconfig | |||
@@ -22,6 +22,7 @@ CONFIG_CMDLINE="root=/dev/ram0 console=ttyAMA2,115200n8" | |||
22 | CONFIG_CPU_FREQ=y | 22 | CONFIG_CPU_FREQ=y |
23 | CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND=y | 23 | CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND=y |
24 | CONFIG_CPU_IDLE=y | 24 | CONFIG_CPU_IDLE=y |
25 | CONFIG_ARM_U8500_CPUIDLE=y | ||
25 | CONFIG_VFP=y | 26 | CONFIG_VFP=y |
26 | CONFIG_NEON=y | 27 | CONFIG_NEON=y |
27 | CONFIG_PM_RUNTIME=y | 28 | CONFIG_PM_RUNTIME=y |
@@ -109,6 +110,8 @@ CONFIG_EXT2_FS_SECURITY=y | |||
109 | CONFIG_EXT3_FS=y | 110 | CONFIG_EXT3_FS=y |
110 | CONFIG_EXT4_FS=y | 111 | CONFIG_EXT4_FS=y |
111 | CONFIG_VFAT_FS=y | 112 | CONFIG_VFAT_FS=y |
113 | CONFIG_DEVTMPFS=y | ||
114 | CONFIG_DEVTMPFS_MOUNT=y | ||
112 | CONFIG_TMPFS=y | 115 | CONFIG_TMPFS=y |
113 | CONFIG_TMPFS_POSIX_ACL=y | 116 | CONFIG_TMPFS_POSIX_ACL=y |
114 | # CONFIG_MISC_FILESYSTEMS is not set | 117 | # CONFIG_MISC_FILESYSTEMS is not set |
diff --git a/arch/arm/include/asm/memory.h b/arch/arm/include/asm/memory.h index 9ecccc865046..6976b03e5213 100644 --- a/arch/arm/include/asm/memory.h +++ b/arch/arm/include/asm/memory.h | |||
@@ -100,23 +100,19 @@ | |||
100 | #define TASK_UNMAPPED_BASE UL(0x00000000) | 100 | #define TASK_UNMAPPED_BASE UL(0x00000000) |
101 | #endif | 101 | #endif |
102 | 102 | ||
103 | #ifndef PHYS_OFFSET | ||
104 | #define PHYS_OFFSET UL(CONFIG_DRAM_BASE) | ||
105 | #endif | ||
106 | |||
107 | #ifndef END_MEM | 103 | #ifndef END_MEM |
108 | #define END_MEM (UL(CONFIG_DRAM_BASE) + CONFIG_DRAM_SIZE) | 104 | #define END_MEM (UL(CONFIG_DRAM_BASE) + CONFIG_DRAM_SIZE) |
109 | #endif | 105 | #endif |
110 | 106 | ||
111 | #ifndef PAGE_OFFSET | 107 | #ifndef PAGE_OFFSET |
112 | #define PAGE_OFFSET (PHYS_OFFSET) | 108 | #define PAGE_OFFSET PLAT_PHYS_OFFSET |
113 | #endif | 109 | #endif |
114 | 110 | ||
115 | /* | 111 | /* |
116 | * The module can be at any place in ram in nommu mode. | 112 | * The module can be at any place in ram in nommu mode. |
117 | */ | 113 | */ |
118 | #define MODULES_END (END_MEM) | 114 | #define MODULES_END (END_MEM) |
119 | #define MODULES_VADDR (PHYS_OFFSET) | 115 | #define MODULES_VADDR PAGE_OFFSET |
120 | 116 | ||
121 | #define XIP_VIRT_ADDR(physaddr) (physaddr) | 117 | #define XIP_VIRT_ADDR(physaddr) (physaddr) |
122 | 118 | ||
@@ -157,6 +153,16 @@ | |||
157 | #endif | 153 | #endif |
158 | #define ARCH_PGD_MASK ((1 << ARCH_PGD_SHIFT) - 1) | 154 | #define ARCH_PGD_MASK ((1 << ARCH_PGD_SHIFT) - 1) |
159 | 155 | ||
156 | /* | ||
157 | * PLAT_PHYS_OFFSET is the offset (from zero) of the start of physical | ||
158 | * memory. This is used for XIP and NoMMU kernels, or by kernels which | ||
159 | * have their own mach/memory.h. Assembly code must always use | ||
160 | * PLAT_PHYS_OFFSET and not PHYS_OFFSET. | ||
161 | */ | ||
162 | #ifndef PLAT_PHYS_OFFSET | ||
163 | #define PLAT_PHYS_OFFSET UL(CONFIG_PHYS_OFFSET) | ||
164 | #endif | ||
165 | |||
160 | #ifndef __ASSEMBLY__ | 166 | #ifndef __ASSEMBLY__ |
161 | 167 | ||
162 | /* | 168 | /* |
@@ -239,6 +245,8 @@ static inline unsigned long __phys_to_virt(phys_addr_t x) | |||
239 | 245 | ||
240 | #else | 246 | #else |
241 | 247 | ||
248 | #define PHYS_OFFSET PLAT_PHYS_OFFSET | ||
249 | |||
242 | static inline phys_addr_t __virt_to_phys(unsigned long x) | 250 | static inline phys_addr_t __virt_to_phys(unsigned long x) |
243 | { | 251 | { |
244 | return (phys_addr_t)x - PAGE_OFFSET + PHYS_OFFSET; | 252 | return (phys_addr_t)x - PAGE_OFFSET + PHYS_OFFSET; |
@@ -251,17 +259,6 @@ static inline unsigned long __phys_to_virt(phys_addr_t x) | |||
251 | 259 | ||
252 | #endif | 260 | #endif |
253 | #endif | 261 | #endif |
254 | #endif /* __ASSEMBLY__ */ | ||
255 | |||
256 | #ifndef PHYS_OFFSET | ||
257 | #ifdef PLAT_PHYS_OFFSET | ||
258 | #define PHYS_OFFSET PLAT_PHYS_OFFSET | ||
259 | #else | ||
260 | #define PHYS_OFFSET UL(CONFIG_PHYS_OFFSET) | ||
261 | #endif | ||
262 | #endif | ||
263 | |||
264 | #ifndef __ASSEMBLY__ | ||
265 | 262 | ||
266 | /* | 263 | /* |
267 | * PFNs are used to describe any physical page; this means | 264 | * PFNs are used to describe any physical page; this means |
diff --git a/arch/arm/include/asm/pgtable.h b/arch/arm/include/asm/pgtable.h index be956dbf6bae..1571d126e9dd 100644 --- a/arch/arm/include/asm/pgtable.h +++ b/arch/arm/include/asm/pgtable.h | |||
@@ -61,7 +61,7 @@ extern void __pgd_error(const char *file, int line, pgd_t); | |||
61 | * mapping to be mapped at. This is particularly important for | 61 | * mapping to be mapped at. This is particularly important for |
62 | * non-high vector CPUs. | 62 | * non-high vector CPUs. |
63 | */ | 63 | */ |
64 | #define FIRST_USER_ADDRESS PAGE_SIZE | 64 | #define FIRST_USER_ADDRESS (PAGE_SIZE * 2) |
65 | 65 | ||
66 | /* | 66 | /* |
67 | * Use TASK_SIZE as the ceiling argument for free_pgtables() and | 67 | * Use TASK_SIZE as the ceiling argument for free_pgtables() and |
diff --git a/arch/arm/kernel/head-nommu.S b/arch/arm/kernel/head-nommu.S index 14235ba64a90..716249cc2ee1 100644 --- a/arch/arm/kernel/head-nommu.S +++ b/arch/arm/kernel/head-nommu.S | |||
@@ -68,7 +68,7 @@ ENTRY(stext) | |||
68 | 68 | ||
69 | #ifdef CONFIG_ARM_MPU | 69 | #ifdef CONFIG_ARM_MPU |
70 | /* Calculate the size of a region covering just the kernel */ | 70 | /* Calculate the size of a region covering just the kernel */ |
71 | ldr r5, =PHYS_OFFSET @ Region start: PHYS_OFFSET | 71 | ldr r5, =PLAT_PHYS_OFFSET @ Region start: PHYS_OFFSET |
72 | ldr r6, =(_end) @ Cover whole kernel | 72 | ldr r6, =(_end) @ Cover whole kernel |
73 | sub r6, r6, r5 @ Minimum size of region to map | 73 | sub r6, r6, r5 @ Minimum size of region to map |
74 | clz r6, r6 @ Region size must be 2^N... | 74 | clz r6, r6 @ Region size must be 2^N... |
@@ -213,7 +213,7 @@ ENTRY(__setup_mpu) | |||
213 | set_region_nr r0, #MPU_RAM_REGION | 213 | set_region_nr r0, #MPU_RAM_REGION |
214 | isb | 214 | isb |
215 | /* Full access from PL0, PL1, shared for CONFIG_SMP, cacheable */ | 215 | /* Full access from PL0, PL1, shared for CONFIG_SMP, cacheable */ |
216 | ldr r0, =PHYS_OFFSET @ RAM starts at PHYS_OFFSET | 216 | ldr r0, =PLAT_PHYS_OFFSET @ RAM starts at PHYS_OFFSET |
217 | ldr r5,=(MPU_AP_PL1RW_PL0RW | MPU_RGN_NORMAL) | 217 | ldr r5,=(MPU_AP_PL1RW_PL0RW | MPU_RGN_NORMAL) |
218 | 218 | ||
219 | setup_region r0, r5, r6, MPU_DATA_SIDE @ PHYS_OFFSET, shared, enabled | 219 | setup_region r0, r5, r6, MPU_DATA_SIDE @ PHYS_OFFSET, shared, enabled |
diff --git a/arch/arm/kernel/head.S b/arch/arm/kernel/head.S index 11d59b32fb8d..32f317e5828a 100644 --- a/arch/arm/kernel/head.S +++ b/arch/arm/kernel/head.S | |||
@@ -110,7 +110,7 @@ ENTRY(stext) | |||
110 | sub r4, r3, r4 @ (PHYS_OFFSET - PAGE_OFFSET) | 110 | sub r4, r3, r4 @ (PHYS_OFFSET - PAGE_OFFSET) |
111 | add r8, r8, r4 @ PHYS_OFFSET | 111 | add r8, r8, r4 @ PHYS_OFFSET |
112 | #else | 112 | #else |
113 | ldr r8, =PHYS_OFFSET @ always constant in this case | 113 | ldr r8, =PLAT_PHYS_OFFSET @ always constant in this case |
114 | #endif | 114 | #endif |
115 | 115 | ||
116 | /* | 116 | /* |
diff --git a/arch/arm/kernel/machine_kexec.c b/arch/arm/kernel/machine_kexec.c index 57221e349a7c..f0d180d8b29f 100644 --- a/arch/arm/kernel/machine_kexec.c +++ b/arch/arm/kernel/machine_kexec.c | |||
@@ -14,11 +14,12 @@ | |||
14 | #include <asm/pgalloc.h> | 14 | #include <asm/pgalloc.h> |
15 | #include <asm/mmu_context.h> | 15 | #include <asm/mmu_context.h> |
16 | #include <asm/cacheflush.h> | 16 | #include <asm/cacheflush.h> |
17 | #include <asm/fncpy.h> | ||
17 | #include <asm/mach-types.h> | 18 | #include <asm/mach-types.h> |
18 | #include <asm/smp_plat.h> | 19 | #include <asm/smp_plat.h> |
19 | #include <asm/system_misc.h> | 20 | #include <asm/system_misc.h> |
20 | 21 | ||
21 | extern const unsigned char relocate_new_kernel[]; | 22 | extern void relocate_new_kernel(void); |
22 | extern const unsigned int relocate_new_kernel_size; | 23 | extern const unsigned int relocate_new_kernel_size; |
23 | 24 | ||
24 | extern unsigned long kexec_start_address; | 25 | extern unsigned long kexec_start_address; |
@@ -142,6 +143,8 @@ void machine_kexec(struct kimage *image) | |||
142 | { | 143 | { |
143 | unsigned long page_list; | 144 | unsigned long page_list; |
144 | unsigned long reboot_code_buffer_phys; | 145 | unsigned long reboot_code_buffer_phys; |
146 | unsigned long reboot_entry = (unsigned long)relocate_new_kernel; | ||
147 | unsigned long reboot_entry_phys; | ||
145 | void *reboot_code_buffer; | 148 | void *reboot_code_buffer; |
146 | 149 | ||
147 | /* | 150 | /* |
@@ -168,16 +171,16 @@ void machine_kexec(struct kimage *image) | |||
168 | 171 | ||
169 | 172 | ||
170 | /* copy our kernel relocation code to the control code page */ | 173 | /* copy our kernel relocation code to the control code page */ |
171 | memcpy(reboot_code_buffer, | 174 | reboot_entry = fncpy(reboot_code_buffer, |
172 | relocate_new_kernel, relocate_new_kernel_size); | 175 | reboot_entry, |
176 | relocate_new_kernel_size); | ||
177 | reboot_entry_phys = (unsigned long)reboot_entry + | ||
178 | (reboot_code_buffer_phys - (unsigned long)reboot_code_buffer); | ||
173 | 179 | ||
174 | |||
175 | flush_icache_range((unsigned long) reboot_code_buffer, | ||
176 | (unsigned long) reboot_code_buffer + KEXEC_CONTROL_PAGE_SIZE); | ||
177 | printk(KERN_INFO "Bye!\n"); | 180 | printk(KERN_INFO "Bye!\n"); |
178 | 181 | ||
179 | if (kexec_reinit) | 182 | if (kexec_reinit) |
180 | kexec_reinit(); | 183 | kexec_reinit(); |
181 | 184 | ||
182 | soft_restart(reboot_code_buffer_phys); | 185 | soft_restart(reboot_entry_phys); |
183 | } | 186 | } |
diff --git a/arch/arm/kernel/process.c b/arch/arm/kernel/process.c index 94f6b05f9e24..92f7b15dd221 100644 --- a/arch/arm/kernel/process.c +++ b/arch/arm/kernel/process.c | |||
@@ -404,6 +404,7 @@ EXPORT_SYMBOL(dump_fpu); | |||
404 | unsigned long get_wchan(struct task_struct *p) | 404 | unsigned long get_wchan(struct task_struct *p) |
405 | { | 405 | { |
406 | struct stackframe frame; | 406 | struct stackframe frame; |
407 | unsigned long stack_page; | ||
407 | int count = 0; | 408 | int count = 0; |
408 | if (!p || p == current || p->state == TASK_RUNNING) | 409 | if (!p || p == current || p->state == TASK_RUNNING) |
409 | return 0; | 410 | return 0; |
@@ -412,9 +413,11 @@ unsigned long get_wchan(struct task_struct *p) | |||
412 | frame.sp = thread_saved_sp(p); | 413 | frame.sp = thread_saved_sp(p); |
413 | frame.lr = 0; /* recovered from the stack */ | 414 | frame.lr = 0; /* recovered from the stack */ |
414 | frame.pc = thread_saved_pc(p); | 415 | frame.pc = thread_saved_pc(p); |
416 | stack_page = (unsigned long)task_stack_page(p); | ||
415 | do { | 417 | do { |
416 | int ret = unwind_frame(&frame); | 418 | if (frame.sp < stack_page || |
417 | if (ret < 0) | 419 | frame.sp >= stack_page + THREAD_SIZE || |
420 | unwind_frame(&frame) < 0) | ||
418 | return 0; | 421 | return 0; |
419 | if (!in_sched_functions(frame.pc)) | 422 | if (!in_sched_functions(frame.pc)) |
420 | return frame.pc; | 423 | return frame.pc; |
diff --git a/arch/arm/kernel/relocate_kernel.S b/arch/arm/kernel/relocate_kernel.S index d0cdedf4864d..95858966d84e 100644 --- a/arch/arm/kernel/relocate_kernel.S +++ b/arch/arm/kernel/relocate_kernel.S | |||
@@ -2,10 +2,12 @@ | |||
2 | * relocate_kernel.S - put the kernel image in place to boot | 2 | * relocate_kernel.S - put the kernel image in place to boot |
3 | */ | 3 | */ |
4 | 4 | ||
5 | #include <linux/linkage.h> | ||
5 | #include <asm/kexec.h> | 6 | #include <asm/kexec.h> |
6 | 7 | ||
7 | .globl relocate_new_kernel | 8 | .align 3 /* not needed for this code, but keeps fncpy() happy */ |
8 | relocate_new_kernel: | 9 | |
10 | ENTRY(relocate_new_kernel) | ||
9 | 11 | ||
10 | ldr r0,kexec_indirection_page | 12 | ldr r0,kexec_indirection_page |
11 | ldr r1,kexec_start_address | 13 | ldr r1,kexec_start_address |
@@ -79,6 +81,8 @@ kexec_mach_type: | |||
79 | kexec_boot_atags: | 81 | kexec_boot_atags: |
80 | .long 0x0 | 82 | .long 0x0 |
81 | 83 | ||
84 | ENDPROC(relocate_new_kernel) | ||
85 | |||
82 | relocate_new_kernel_end: | 86 | relocate_new_kernel_end: |
83 | 87 | ||
84 | .globl relocate_new_kernel_size | 88 | .globl relocate_new_kernel_size |
diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c index 6a1b8a81b1ae..987a7f5bce5f 100644 --- a/arch/arm/kernel/setup.c +++ b/arch/arm/kernel/setup.c | |||
@@ -873,8 +873,6 @@ void __init setup_arch(char **cmdline_p) | |||
873 | machine_desc = mdesc; | 873 | machine_desc = mdesc; |
874 | machine_name = mdesc->name; | 874 | machine_name = mdesc->name; |
875 | 875 | ||
876 | setup_dma_zone(mdesc); | ||
877 | |||
878 | if (mdesc->reboot_mode != REBOOT_HARD) | 876 | if (mdesc->reboot_mode != REBOOT_HARD) |
879 | reboot_mode = mdesc->reboot_mode; | 877 | reboot_mode = mdesc->reboot_mode; |
880 | 878 | ||
@@ -892,6 +890,7 @@ void __init setup_arch(char **cmdline_p) | |||
892 | sort(&meminfo.bank, meminfo.nr_banks, sizeof(meminfo.bank[0]), meminfo_cmp, NULL); | 890 | sort(&meminfo.bank, meminfo.nr_banks, sizeof(meminfo.bank[0]), meminfo_cmp, NULL); |
893 | 891 | ||
894 | early_paging_init(mdesc, lookup_processor_type(read_cpuid_id())); | 892 | early_paging_init(mdesc, lookup_processor_type(read_cpuid_id())); |
893 | setup_dma_zone(mdesc); | ||
895 | sanity_check_meminfo(); | 894 | sanity_check_meminfo(); |
896 | arm_memblock_init(&meminfo, mdesc); | 895 | arm_memblock_init(&meminfo, mdesc); |
897 | 896 | ||
diff --git a/arch/arm/kernel/sigreturn_codes.S b/arch/arm/kernel/sigreturn_codes.S index 3c5d0f2170fd..b84d0cb13682 100644 --- a/arch/arm/kernel/sigreturn_codes.S +++ b/arch/arm/kernel/sigreturn_codes.S | |||
@@ -30,6 +30,27 @@ | |||
30 | * snippets. | 30 | * snippets. |
31 | */ | 31 | */ |
32 | 32 | ||
33 | /* | ||
34 | * In CPU_THUMBONLY case kernel arm opcodes are not allowed. | ||
35 | * Note in this case codes skips those instructions but it uses .org | ||
36 | * directive to keep correct layout of sigreturn_codes array. | ||
37 | */ | ||
38 | #ifndef CONFIG_CPU_THUMBONLY | ||
39 | #define ARM_OK(code...) code | ||
40 | #else | ||
41 | #define ARM_OK(code...) | ||
42 | #endif | ||
43 | |||
44 | .macro arm_slot n | ||
45 | .org sigreturn_codes + 12 * (\n) | ||
46 | ARM_OK( .arm ) | ||
47 | .endm | ||
48 | |||
49 | .macro thumb_slot n | ||
50 | .org sigreturn_codes + 12 * (\n) + 8 | ||
51 | .thumb | ||
52 | .endm | ||
53 | |||
33 | #if __LINUX_ARM_ARCH__ <= 4 | 54 | #if __LINUX_ARM_ARCH__ <= 4 |
34 | /* | 55 | /* |
35 | * Note we manually set minimally required arch that supports | 56 | * Note we manually set minimally required arch that supports |
@@ -45,26 +66,27 @@ | |||
45 | .global sigreturn_codes | 66 | .global sigreturn_codes |
46 | .type sigreturn_codes, #object | 67 | .type sigreturn_codes, #object |
47 | 68 | ||
48 | .arm | 69 | .align |
49 | 70 | ||
50 | sigreturn_codes: | 71 | sigreturn_codes: |
51 | 72 | ||
52 | /* ARM sigreturn syscall code snippet */ | 73 | /* ARM sigreturn syscall code snippet */ |
53 | mov r7, #(__NR_sigreturn - __NR_SYSCALL_BASE) | 74 | arm_slot 0 |
54 | swi #(__NR_sigreturn)|(__NR_OABI_SYSCALL_BASE) | 75 | ARM_OK( mov r7, #(__NR_sigreturn - __NR_SYSCALL_BASE) ) |
76 | ARM_OK( swi #(__NR_sigreturn)|(__NR_OABI_SYSCALL_BASE) ) | ||
55 | 77 | ||
56 | /* Thumb sigreturn syscall code snippet */ | 78 | /* Thumb sigreturn syscall code snippet */ |
57 | .thumb | 79 | thumb_slot 0 |
58 | movs r7, #(__NR_sigreturn - __NR_SYSCALL_BASE) | 80 | movs r7, #(__NR_sigreturn - __NR_SYSCALL_BASE) |
59 | swi #0 | 81 | swi #0 |
60 | 82 | ||
61 | /* ARM sigreturn_rt syscall code snippet */ | 83 | /* ARM sigreturn_rt syscall code snippet */ |
62 | .arm | 84 | arm_slot 1 |
63 | mov r7, #(__NR_rt_sigreturn - __NR_SYSCALL_BASE) | 85 | ARM_OK( mov r7, #(__NR_rt_sigreturn - __NR_SYSCALL_BASE) ) |
64 | swi #(__NR_rt_sigreturn)|(__NR_OABI_SYSCALL_BASE) | 86 | ARM_OK( swi #(__NR_rt_sigreturn)|(__NR_OABI_SYSCALL_BASE) ) |
65 | 87 | ||
66 | /* Thumb sigreturn_rt syscall code snippet */ | 88 | /* Thumb sigreturn_rt syscall code snippet */ |
67 | .thumb | 89 | thumb_slot 1 |
68 | movs r7, #(__NR_rt_sigreturn - __NR_SYSCALL_BASE) | 90 | movs r7, #(__NR_rt_sigreturn - __NR_SYSCALL_BASE) |
69 | swi #0 | 91 | swi #0 |
70 | 92 | ||
@@ -74,7 +96,7 @@ sigreturn_codes: | |||
74 | * it is thumb case or not, so we need additional | 96 | * it is thumb case or not, so we need additional |
75 | * word after real last entry. | 97 | * word after real last entry. |
76 | */ | 98 | */ |
77 | .arm | 99 | arm_slot 2 |
78 | .space 4 | 100 | .space 4 |
79 | 101 | ||
80 | .size sigreturn_codes, . - sigreturn_codes | 102 | .size sigreturn_codes, . - sigreturn_codes |
diff --git a/arch/arm/kernel/stacktrace.c b/arch/arm/kernel/stacktrace.c index 00f79e59985b..af4e8c8a5422 100644 --- a/arch/arm/kernel/stacktrace.c +++ b/arch/arm/kernel/stacktrace.c | |||
@@ -31,7 +31,7 @@ int notrace unwind_frame(struct stackframe *frame) | |||
31 | high = ALIGN(low, THREAD_SIZE); | 31 | high = ALIGN(low, THREAD_SIZE); |
32 | 32 | ||
33 | /* check current frame pointer is within bounds */ | 33 | /* check current frame pointer is within bounds */ |
34 | if (fp < (low + 12) || fp + 4 >= high) | 34 | if (fp < low + 12 || fp > high - 4) |
35 | return -EINVAL; | 35 | return -EINVAL; |
36 | 36 | ||
37 | /* restore the registers from the stack frame */ | 37 | /* restore the registers from the stack frame */ |
diff --git a/arch/arm/kernel/traps.c b/arch/arm/kernel/traps.c index dbf0923e8d76..7940241f0576 100644 --- a/arch/arm/kernel/traps.c +++ b/arch/arm/kernel/traps.c | |||
@@ -509,9 +509,10 @@ static inline int | |||
509 | __do_cache_op(unsigned long start, unsigned long end) | 509 | __do_cache_op(unsigned long start, unsigned long end) |
510 | { | 510 | { |
511 | int ret; | 511 | int ret; |
512 | unsigned long chunk = PAGE_SIZE; | ||
513 | 512 | ||
514 | do { | 513 | do { |
514 | unsigned long chunk = min(PAGE_SIZE, end - start); | ||
515 | |||
515 | if (signal_pending(current)) { | 516 | if (signal_pending(current)) { |
516 | struct thread_info *ti = current_thread_info(); | 517 | struct thread_info *ti = current_thread_info(); |
517 | 518 | ||
diff --git a/arch/arm/lib/delay-loop.S b/arch/arm/lib/delay-loop.S index 36b668d8e121..bc1033b897b4 100644 --- a/arch/arm/lib/delay-loop.S +++ b/arch/arm/lib/delay-loop.S | |||
@@ -40,6 +40,7 @@ ENTRY(__loop_const_udelay) @ 0 <= r0 <= 0x7fffff06 | |||
40 | /* | 40 | /* |
41 | * loops = r0 * HZ * loops_per_jiffy / 1000000 | 41 | * loops = r0 * HZ * loops_per_jiffy / 1000000 |
42 | */ | 42 | */ |
43 | .align 3 | ||
43 | 44 | ||
44 | @ Delay routine | 45 | @ Delay routine |
45 | ENTRY(__loop_delay) | 46 | ENTRY(__loop_delay) |
diff --git a/arch/arm/mach-at91/at91rm9200_time.c b/arch/arm/mach-at91/at91rm9200_time.c index f607deb40f4d..bc7b363a3083 100644 --- a/arch/arm/mach-at91/at91rm9200_time.c +++ b/arch/arm/mach-at91/at91rm9200_time.c | |||
@@ -174,7 +174,6 @@ clkevt32k_next_event(unsigned long delta, struct clock_event_device *dev) | |||
174 | static struct clock_event_device clkevt = { | 174 | static struct clock_event_device clkevt = { |
175 | .name = "at91_tick", | 175 | .name = "at91_tick", |
176 | .features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT, | 176 | .features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT, |
177 | .shift = 32, | ||
178 | .rating = 150, | 177 | .rating = 150, |
179 | .set_next_event = clkevt32k_next_event, | 178 | .set_next_event = clkevt32k_next_event, |
180 | .set_mode = clkevt32k_mode, | 179 | .set_mode = clkevt32k_mode, |
@@ -265,11 +264,9 @@ void __init at91rm9200_timer_init(void) | |||
265 | at91_st_write(AT91_ST_RTMR, 1); | 264 | at91_st_write(AT91_ST_RTMR, 1); |
266 | 265 | ||
267 | /* Setup timer clockevent, with minimum of two ticks (important!!) */ | 266 | /* Setup timer clockevent, with minimum of two ticks (important!!) */ |
268 | clkevt.mult = div_sc(AT91_SLOW_CLOCK, NSEC_PER_SEC, clkevt.shift); | ||
269 | clkevt.max_delta_ns = clockevent_delta2ns(AT91_ST_ALMV, &clkevt); | ||
270 | clkevt.min_delta_ns = clockevent_delta2ns(2, &clkevt) + 1; | ||
271 | clkevt.cpumask = cpumask_of(0); | 267 | clkevt.cpumask = cpumask_of(0); |
272 | clockevents_register_device(&clkevt); | 268 | clockevents_config_and_register(&clkevt, AT91_SLOW_CLOCK, |
269 | 2, AT91_ST_ALMV); | ||
273 | 270 | ||
274 | /* register clocksource */ | 271 | /* register clocksource */ |
275 | clocksource_register_hz(&clk32k, AT91_SLOW_CLOCK); | 272 | clocksource_register_hz(&clk32k, AT91_SLOW_CLOCK); |
diff --git a/arch/arm/mach-at91/pm.h b/arch/arm/mach-at91/pm.h index 3ed190ce062b..c5101dcb4fb0 100644 --- a/arch/arm/mach-at91/pm.h +++ b/arch/arm/mach-at91/pm.h | |||
@@ -16,7 +16,11 @@ | |||
16 | #include <mach/at91_ramc.h> | 16 | #include <mach/at91_ramc.h> |
17 | #include <mach/at91rm9200_sdramc.h> | 17 | #include <mach/at91rm9200_sdramc.h> |
18 | 18 | ||
19 | #ifdef CONFIG_PM | ||
19 | extern void at91_pm_set_standby(void (*at91_standby)(void)); | 20 | extern void at91_pm_set_standby(void (*at91_standby)(void)); |
21 | #else | ||
22 | static inline void at91_pm_set_standby(void (*at91_standby)(void)) { } | ||
23 | #endif | ||
20 | 24 | ||
21 | /* | 25 | /* |
22 | * The AT91RM9200 goes into self-refresh mode with this command, and will | 26 | * The AT91RM9200 goes into self-refresh mode with this command, and will |
diff --git a/arch/arm/mach-davinci/da830.c b/arch/arm/mach-davinci/da830.c index 0813b5167e05..fb720356d047 100644 --- a/arch/arm/mach-davinci/da830.c +++ b/arch/arm/mach-davinci/da830.c | |||
@@ -1153,7 +1153,6 @@ static struct davinci_id da830_ids[] = { | |||
1153 | 1153 | ||
1154 | static struct davinci_gpio_platform_data da830_gpio_platform_data = { | 1154 | static struct davinci_gpio_platform_data da830_gpio_platform_data = { |
1155 | .ngpio = 128, | 1155 | .ngpio = 128, |
1156 | .intc_irq_num = DA830_N_CP_INTC_IRQ, | ||
1157 | }; | 1156 | }; |
1158 | 1157 | ||
1159 | int __init da830_register_gpio(void) | 1158 | int __init da830_register_gpio(void) |
diff --git a/arch/arm/mach-davinci/da850.c b/arch/arm/mach-davinci/da850.c index 352984e1528a..437931746689 100644 --- a/arch/arm/mach-davinci/da850.c +++ b/arch/arm/mach-davinci/da850.c | |||
@@ -1283,7 +1283,6 @@ int __init da850_register_vpif_capture(struct vpif_capture_config | |||
1283 | 1283 | ||
1284 | static struct davinci_gpio_platform_data da850_gpio_platform_data = { | 1284 | static struct davinci_gpio_platform_data da850_gpio_platform_data = { |
1285 | .ngpio = 144, | 1285 | .ngpio = 144, |
1286 | .intc_irq_num = DA850_N_CP_INTC_IRQ, | ||
1287 | }; | 1286 | }; |
1288 | 1287 | ||
1289 | int __init da850_register_gpio(void) | 1288 | int __init da850_register_gpio(void) |
diff --git a/arch/arm/mach-davinci/devices-da8xx.c b/arch/arm/mach-davinci/devices-da8xx.c index c46eccbbd512..78829c513fdc 100644 --- a/arch/arm/mach-davinci/devices-da8xx.c +++ b/arch/arm/mach-davinci/devices-da8xx.c | |||
@@ -487,7 +487,7 @@ int __init da8xx_register_emac(void) | |||
487 | 487 | ||
488 | static struct resource da830_mcasp1_resources[] = { | 488 | static struct resource da830_mcasp1_resources[] = { |
489 | { | 489 | { |
490 | .name = "mcasp1", | 490 | .name = "mpu", |
491 | .start = DAVINCI_DA830_MCASP1_REG_BASE, | 491 | .start = DAVINCI_DA830_MCASP1_REG_BASE, |
492 | .end = DAVINCI_DA830_MCASP1_REG_BASE + (SZ_1K * 12) - 1, | 492 | .end = DAVINCI_DA830_MCASP1_REG_BASE + (SZ_1K * 12) - 1, |
493 | .flags = IORESOURCE_MEM, | 493 | .flags = IORESOURCE_MEM, |
@@ -515,7 +515,7 @@ static struct platform_device da830_mcasp1_device = { | |||
515 | 515 | ||
516 | static struct resource da850_mcasp_resources[] = { | 516 | static struct resource da850_mcasp_resources[] = { |
517 | { | 517 | { |
518 | .name = "mcasp", | 518 | .name = "mpu", |
519 | .start = DAVINCI_DA8XX_MCASP0_REG_BASE, | 519 | .start = DAVINCI_DA8XX_MCASP0_REG_BASE, |
520 | .end = DAVINCI_DA8XX_MCASP0_REG_BASE + (SZ_1K * 12) - 1, | 520 | .end = DAVINCI_DA8XX_MCASP0_REG_BASE + (SZ_1K * 12) - 1, |
521 | .flags = IORESOURCE_MEM, | 521 | .flags = IORESOURCE_MEM, |
diff --git a/arch/arm/mach-davinci/dm355.c b/arch/arm/mach-davinci/dm355.c index ef9ff1fb6f52..4d2c72fb40c4 100644 --- a/arch/arm/mach-davinci/dm355.c +++ b/arch/arm/mach-davinci/dm355.c | |||
@@ -641,6 +641,7 @@ static struct platform_device dm355_edma_device = { | |||
641 | 641 | ||
642 | static struct resource dm355_asp1_resources[] = { | 642 | static struct resource dm355_asp1_resources[] = { |
643 | { | 643 | { |
644 | .name = "mpu", | ||
644 | .start = DAVINCI_ASP1_BASE, | 645 | .start = DAVINCI_ASP1_BASE, |
645 | .end = DAVINCI_ASP1_BASE + SZ_8K - 1, | 646 | .end = DAVINCI_ASP1_BASE + SZ_8K - 1, |
646 | .flags = IORESOURCE_MEM, | 647 | .flags = IORESOURCE_MEM, |
@@ -900,13 +901,12 @@ static struct resource dm355_gpio_resources[] = { | |||
900 | 901 | ||
901 | static struct davinci_gpio_platform_data dm355_gpio_platform_data = { | 902 | static struct davinci_gpio_platform_data dm355_gpio_platform_data = { |
902 | .ngpio = 104, | 903 | .ngpio = 104, |
903 | .intc_irq_num = DAVINCI_N_AINTC_IRQ, | ||
904 | }; | 904 | }; |
905 | 905 | ||
906 | int __init dm355_gpio_register(void) | 906 | int __init dm355_gpio_register(void) |
907 | { | 907 | { |
908 | return davinci_gpio_register(dm355_gpio_resources, | 908 | return davinci_gpio_register(dm355_gpio_resources, |
909 | sizeof(dm355_gpio_resources), | 909 | ARRAY_SIZE(dm355_gpio_resources), |
910 | &dm355_gpio_platform_data); | 910 | &dm355_gpio_platform_data); |
911 | } | 911 | } |
912 | /*----------------------------------------------------------------------*/ | 912 | /*----------------------------------------------------------------------*/ |
diff --git a/arch/arm/mach-davinci/dm365.c b/arch/arm/mach-davinci/dm365.c index 1511a0680f9a..4117748f290b 100644 --- a/arch/arm/mach-davinci/dm365.c +++ b/arch/arm/mach-davinci/dm365.c | |||
@@ -713,14 +713,13 @@ static struct resource dm365_gpio_resources[] = { | |||
713 | 713 | ||
714 | static struct davinci_gpio_platform_data dm365_gpio_platform_data = { | 714 | static struct davinci_gpio_platform_data dm365_gpio_platform_data = { |
715 | .ngpio = 104, | 715 | .ngpio = 104, |
716 | .intc_irq_num = DAVINCI_N_AINTC_IRQ, | ||
717 | .gpio_unbanked = 8, | 716 | .gpio_unbanked = 8, |
718 | }; | 717 | }; |
719 | 718 | ||
720 | int __init dm365_gpio_register(void) | 719 | int __init dm365_gpio_register(void) |
721 | { | 720 | { |
722 | return davinci_gpio_register(dm365_gpio_resources, | 721 | return davinci_gpio_register(dm365_gpio_resources, |
723 | sizeof(dm365_gpio_resources), | 722 | ARRAY_SIZE(dm365_gpio_resources), |
724 | &dm365_gpio_platform_data); | 723 | &dm365_gpio_platform_data); |
725 | } | 724 | } |
726 | 725 | ||
@@ -942,6 +941,7 @@ static struct platform_device dm365_edma_device = { | |||
942 | 941 | ||
943 | static struct resource dm365_asp_resources[] = { | 942 | static struct resource dm365_asp_resources[] = { |
944 | { | 943 | { |
944 | .name = "mpu", | ||
945 | .start = DAVINCI_DM365_ASP0_BASE, | 945 | .start = DAVINCI_DM365_ASP0_BASE, |
946 | .end = DAVINCI_DM365_ASP0_BASE + SZ_8K - 1, | 946 | .end = DAVINCI_DM365_ASP0_BASE + SZ_8K - 1, |
947 | .flags = IORESOURCE_MEM, | 947 | .flags = IORESOURCE_MEM, |
diff --git a/arch/arm/mach-davinci/dm644x.c b/arch/arm/mach-davinci/dm644x.c index 143a3217e8ef..7ee73fc588f0 100644 --- a/arch/arm/mach-davinci/dm644x.c +++ b/arch/arm/mach-davinci/dm644x.c | |||
@@ -572,6 +572,7 @@ static struct platform_device dm644x_edma_device = { | |||
572 | /* DM6446 EVM uses ASP0; line-out is a pair of RCA jacks */ | 572 | /* DM6446 EVM uses ASP0; line-out is a pair of RCA jacks */ |
573 | static struct resource dm644x_asp_resources[] = { | 573 | static struct resource dm644x_asp_resources[] = { |
574 | { | 574 | { |
575 | .name = "mpu", | ||
575 | .start = DAVINCI_ASP0_BASE, | 576 | .start = DAVINCI_ASP0_BASE, |
576 | .end = DAVINCI_ASP0_BASE + SZ_8K - 1, | 577 | .end = DAVINCI_ASP0_BASE + SZ_8K - 1, |
577 | .flags = IORESOURCE_MEM, | 578 | .flags = IORESOURCE_MEM, |
@@ -786,13 +787,12 @@ static struct resource dm644_gpio_resources[] = { | |||
786 | 787 | ||
787 | static struct davinci_gpio_platform_data dm644_gpio_platform_data = { | 788 | static struct davinci_gpio_platform_data dm644_gpio_platform_data = { |
788 | .ngpio = 71, | 789 | .ngpio = 71, |
789 | .intc_irq_num = DAVINCI_N_AINTC_IRQ, | ||
790 | }; | 790 | }; |
791 | 791 | ||
792 | int __init dm644x_gpio_register(void) | 792 | int __init dm644x_gpio_register(void) |
793 | { | 793 | { |
794 | return davinci_gpio_register(dm644_gpio_resources, | 794 | return davinci_gpio_register(dm644_gpio_resources, |
795 | sizeof(dm644_gpio_resources), | 795 | ARRAY_SIZE(dm644_gpio_resources), |
796 | &dm644_gpio_platform_data); | 796 | &dm644_gpio_platform_data); |
797 | } | 797 | } |
798 | /*----------------------------------------------------------------------*/ | 798 | /*----------------------------------------------------------------------*/ |
diff --git a/arch/arm/mach-davinci/dm646x.c b/arch/arm/mach-davinci/dm646x.c index 2a73f299c1d0..a6f0536fc209 100644 --- a/arch/arm/mach-davinci/dm646x.c +++ b/arch/arm/mach-davinci/dm646x.c | |||
@@ -621,7 +621,7 @@ static struct platform_device dm646x_edma_device = { | |||
621 | 621 | ||
622 | static struct resource dm646x_mcasp0_resources[] = { | 622 | static struct resource dm646x_mcasp0_resources[] = { |
623 | { | 623 | { |
624 | .name = "mcasp0", | 624 | .name = "mpu", |
625 | .start = DAVINCI_DM646X_MCASP0_REG_BASE, | 625 | .start = DAVINCI_DM646X_MCASP0_REG_BASE, |
626 | .end = DAVINCI_DM646X_MCASP0_REG_BASE + (SZ_1K << 1) - 1, | 626 | .end = DAVINCI_DM646X_MCASP0_REG_BASE + (SZ_1K << 1) - 1, |
627 | .flags = IORESOURCE_MEM, | 627 | .flags = IORESOURCE_MEM, |
@@ -641,7 +641,7 @@ static struct resource dm646x_mcasp0_resources[] = { | |||
641 | 641 | ||
642 | static struct resource dm646x_mcasp1_resources[] = { | 642 | static struct resource dm646x_mcasp1_resources[] = { |
643 | { | 643 | { |
644 | .name = "mcasp1", | 644 | .name = "mpu", |
645 | .start = DAVINCI_DM646X_MCASP1_REG_BASE, | 645 | .start = DAVINCI_DM646X_MCASP1_REG_BASE, |
646 | .end = DAVINCI_DM646X_MCASP1_REG_BASE + (SZ_1K << 1) - 1, | 646 | .end = DAVINCI_DM646X_MCASP1_REG_BASE + (SZ_1K << 1) - 1, |
647 | .flags = IORESOURCE_MEM, | 647 | .flags = IORESOURCE_MEM, |
@@ -763,13 +763,12 @@ static struct resource dm646x_gpio_resources[] = { | |||
763 | 763 | ||
764 | static struct davinci_gpio_platform_data dm646x_gpio_platform_data = { | 764 | static struct davinci_gpio_platform_data dm646x_gpio_platform_data = { |
765 | .ngpio = 43, | 765 | .ngpio = 43, |
766 | .intc_irq_num = DAVINCI_N_AINTC_IRQ, | ||
767 | }; | 766 | }; |
768 | 767 | ||
769 | int __init dm646x_gpio_register(void) | 768 | int __init dm646x_gpio_register(void) |
770 | { | 769 | { |
771 | return davinci_gpio_register(dm646x_gpio_resources, | 770 | return davinci_gpio_register(dm646x_gpio_resources, |
772 | sizeof(dm646x_gpio_resources), | 771 | ARRAY_SIZE(dm646x_gpio_resources), |
773 | &dm646x_gpio_platform_data); | 772 | &dm646x_gpio_platform_data); |
774 | } | 773 | } |
775 | /*----------------------------------------------------------------------*/ | 774 | /*----------------------------------------------------------------------*/ |
diff --git a/arch/arm/mach-footbridge/common.c b/arch/arm/mach-footbridge/common.c index 2739ca2c1334..e0091685fd48 100644 --- a/arch/arm/mach-footbridge/common.c +++ b/arch/arm/mach-footbridge/common.c | |||
@@ -15,6 +15,7 @@ | |||
15 | #include <linux/init.h> | 15 | #include <linux/init.h> |
16 | #include <linux/io.h> | 16 | #include <linux/io.h> |
17 | #include <linux/spinlock.h> | 17 | #include <linux/spinlock.h> |
18 | #include <video/vga.h> | ||
18 | 19 | ||
19 | #include <asm/pgtable.h> | 20 | #include <asm/pgtable.h> |
20 | #include <asm/page.h> | 21 | #include <asm/page.h> |
@@ -196,6 +197,8 @@ void __init footbridge_map_io(void) | |||
196 | iotable_init(ebsa285_host_io_desc, ARRAY_SIZE(ebsa285_host_io_desc)); | 197 | iotable_init(ebsa285_host_io_desc, ARRAY_SIZE(ebsa285_host_io_desc)); |
197 | pci_map_io_early(__phys_to_pfn(DC21285_PCI_IO)); | 198 | pci_map_io_early(__phys_to_pfn(DC21285_PCI_IO)); |
198 | } | 199 | } |
200 | |||
201 | vga_base = PCIMEM_BASE; | ||
199 | } | 202 | } |
200 | 203 | ||
201 | void footbridge_restart(enum reboot_mode mode, const char *cmd) | 204 | void footbridge_restart(enum reboot_mode mode, const char *cmd) |
diff --git a/arch/arm/mach-footbridge/dc21285.c b/arch/arm/mach-footbridge/dc21285.c index 3490a24f969e..7c2fdae9a38b 100644 --- a/arch/arm/mach-footbridge/dc21285.c +++ b/arch/arm/mach-footbridge/dc21285.c | |||
@@ -18,7 +18,6 @@ | |||
18 | #include <linux/irq.h> | 18 | #include <linux/irq.h> |
19 | #include <linux/io.h> | 19 | #include <linux/io.h> |
20 | #include <linux/spinlock.h> | 20 | #include <linux/spinlock.h> |
21 | #include <video/vga.h> | ||
22 | 21 | ||
23 | #include <asm/irq.h> | 22 | #include <asm/irq.h> |
24 | #include <asm/mach/pci.h> | 23 | #include <asm/mach/pci.h> |
@@ -291,7 +290,6 @@ void __init dc21285_preinit(void) | |||
291 | int cfn_mode; | 290 | int cfn_mode; |
292 | 291 | ||
293 | pcibios_min_mem = 0x81000000; | 292 | pcibios_min_mem = 0x81000000; |
294 | vga_base = PCIMEM_BASE; | ||
295 | 293 | ||
296 | mem_size = (unsigned int)high_memory - PAGE_OFFSET; | 294 | mem_size = (unsigned int)high_memory - PAGE_OFFSET; |
297 | for (mem_mask = 0x00100000; mem_mask < 0x10000000; mem_mask <<= 1) | 295 | for (mem_mask = 0x00100000; mem_mask < 0x10000000; mem_mask <<= 1) |
diff --git a/arch/arm/mach-footbridge/ebsa285.c b/arch/arm/mach-footbridge/ebsa285.c index b08243500e2e..1a7235fb52ac 100644 --- a/arch/arm/mach-footbridge/ebsa285.c +++ b/arch/arm/mach-footbridge/ebsa285.c | |||
@@ -30,21 +30,24 @@ static const struct { | |||
30 | const char *name; | 30 | const char *name; |
31 | const char *trigger; | 31 | const char *trigger; |
32 | } ebsa285_leds[] = { | 32 | } ebsa285_leds[] = { |
33 | { "ebsa285:amber", "heartbeat", }, | 33 | { "ebsa285:amber", "cpu0", }, |
34 | { "ebsa285:green", "cpu0", }, | 34 | { "ebsa285:green", "heartbeat", }, |
35 | { "ebsa285:red",}, | 35 | { "ebsa285:red",}, |
36 | }; | 36 | }; |
37 | 37 | ||
38 | static unsigned char hw_led_state; | ||
39 | |||
38 | static void ebsa285_led_set(struct led_classdev *cdev, | 40 | static void ebsa285_led_set(struct led_classdev *cdev, |
39 | enum led_brightness b) | 41 | enum led_brightness b) |
40 | { | 42 | { |
41 | struct ebsa285_led *led = container_of(cdev, | 43 | struct ebsa285_led *led = container_of(cdev, |
42 | struct ebsa285_led, cdev); | 44 | struct ebsa285_led, cdev); |
43 | 45 | ||
44 | if (b != LED_OFF) | 46 | if (b == LED_OFF) |
45 | *XBUS_LEDS |= led->mask; | 47 | hw_led_state |= led->mask; |
46 | else | 48 | else |
47 | *XBUS_LEDS &= ~led->mask; | 49 | hw_led_state &= ~led->mask; |
50 | *XBUS_LEDS = hw_led_state; | ||
48 | } | 51 | } |
49 | 52 | ||
50 | static enum led_brightness ebsa285_led_get(struct led_classdev *cdev) | 53 | static enum led_brightness ebsa285_led_get(struct led_classdev *cdev) |
@@ -52,18 +55,19 @@ static enum led_brightness ebsa285_led_get(struct led_classdev *cdev) | |||
52 | struct ebsa285_led *led = container_of(cdev, | 55 | struct ebsa285_led *led = container_of(cdev, |
53 | struct ebsa285_led, cdev); | 56 | struct ebsa285_led, cdev); |
54 | 57 | ||
55 | return (*XBUS_LEDS & led->mask) ? LED_FULL : LED_OFF; | 58 | return hw_led_state & led->mask ? LED_OFF : LED_FULL; |
56 | } | 59 | } |
57 | 60 | ||
58 | static int __init ebsa285_leds_init(void) | 61 | static int __init ebsa285_leds_init(void) |
59 | { | 62 | { |
60 | int i; | 63 | int i; |
61 | 64 | ||
62 | if (machine_is_ebsa285()) | 65 | if (!machine_is_ebsa285()) |
63 | return -ENODEV; | 66 | return -ENODEV; |
64 | 67 | ||
65 | /* 3 LEDS All ON */ | 68 | /* 3 LEDS all off */ |
66 | *XBUS_LEDS |= XBUS_LED_AMBER | XBUS_LED_GREEN | XBUS_LED_RED; | 69 | hw_led_state = XBUS_LED_AMBER | XBUS_LED_GREEN | XBUS_LED_RED; |
70 | *XBUS_LEDS = hw_led_state; | ||
67 | 71 | ||
68 | for (i = 0; i < ARRAY_SIZE(ebsa285_leds); i++) { | 72 | for (i = 0; i < ARRAY_SIZE(ebsa285_leds); i++) { |
69 | struct ebsa285_led *led; | 73 | struct ebsa285_led *led; |
diff --git a/arch/arm/mach-highbank/highbank.c b/arch/arm/mach-highbank/highbank.c index b3d7e5634b83..bd3bf66ce344 100644 --- a/arch/arm/mach-highbank/highbank.c +++ b/arch/arm/mach-highbank/highbank.c | |||
@@ -17,12 +17,15 @@ | |||
17 | #include <linux/clkdev.h> | 17 | #include <linux/clkdev.h> |
18 | #include <linux/clocksource.h> | 18 | #include <linux/clocksource.h> |
19 | #include <linux/dma-mapping.h> | 19 | #include <linux/dma-mapping.h> |
20 | #include <linux/input.h> | ||
20 | #include <linux/io.h> | 21 | #include <linux/io.h> |
21 | #include <linux/irqchip.h> | 22 | #include <linux/irqchip.h> |
23 | #include <linux/mailbox.h> | ||
22 | #include <linux/of.h> | 24 | #include <linux/of.h> |
23 | #include <linux/of_irq.h> | 25 | #include <linux/of_irq.h> |
24 | #include <linux/of_platform.h> | 26 | #include <linux/of_platform.h> |
25 | #include <linux/of_address.h> | 27 | #include <linux/of_address.h> |
28 | #include <linux/reboot.h> | ||
26 | #include <linux/amba/bus.h> | 29 | #include <linux/amba/bus.h> |
27 | #include <linux/platform_device.h> | 30 | #include <linux/platform_device.h> |
28 | 31 | ||
@@ -130,6 +133,24 @@ static struct platform_device highbank_cpuidle_device = { | |||
130 | .name = "cpuidle-calxeda", | 133 | .name = "cpuidle-calxeda", |
131 | }; | 134 | }; |
132 | 135 | ||
136 | static int hb_keys_notifier(struct notifier_block *nb, unsigned long event, void *data) | ||
137 | { | ||
138 | u32 key = *(u32 *)data; | ||
139 | |||
140 | if (event != 0x1000) | ||
141 | return 0; | ||
142 | |||
143 | if (key == KEY_POWER) | ||
144 | orderly_poweroff(false); | ||
145 | else if (key == 0xffff) | ||
146 | ctrl_alt_del(); | ||
147 | |||
148 | return 0; | ||
149 | } | ||
150 | static struct notifier_block hb_keys_nb = { | ||
151 | .notifier_call = hb_keys_notifier, | ||
152 | }; | ||
153 | |||
133 | static void __init highbank_init(void) | 154 | static void __init highbank_init(void) |
134 | { | 155 | { |
135 | struct device_node *np; | 156 | struct device_node *np; |
@@ -145,6 +166,8 @@ static void __init highbank_init(void) | |||
145 | bus_register_notifier(&platform_bus_type, &highbank_platform_nb); | 166 | bus_register_notifier(&platform_bus_type, &highbank_platform_nb); |
146 | bus_register_notifier(&amba_bustype, &highbank_amba_nb); | 167 | bus_register_notifier(&amba_bustype, &highbank_amba_nb); |
147 | 168 | ||
169 | pl320_ipc_register_notifier(&hb_keys_nb); | ||
170 | |||
148 | of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); | 171 | of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); |
149 | 172 | ||
150 | if (psci_ops.cpu_suspend) | 173 | if (psci_ops.cpu_suspend) |
diff --git a/arch/arm/mach-omap2/board-generic.c b/arch/arm/mach-omap2/board-generic.c index 19f1652e94cf..8d972ff18c56 100644 --- a/arch/arm/mach-omap2/board-generic.c +++ b/arch/arm/mach-omap2/board-generic.c | |||
@@ -131,6 +131,24 @@ DT_MACHINE_START(OMAP3_GP_DT, "Generic OMAP3-GP (Flattened Device Tree)") | |||
131 | .dt_compat = omap3_gp_boards_compat, | 131 | .dt_compat = omap3_gp_boards_compat, |
132 | .restart = omap3xxx_restart, | 132 | .restart = omap3xxx_restart, |
133 | MACHINE_END | 133 | MACHINE_END |
134 | |||
135 | static const char *am3517_boards_compat[] __initdata = { | ||
136 | "ti,am3517", | ||
137 | NULL, | ||
138 | }; | ||
139 | |||
140 | DT_MACHINE_START(AM3517_DT, "Generic AM3517 (Flattened Device Tree)") | ||
141 | .reserve = omap_reserve, | ||
142 | .map_io = omap3_map_io, | ||
143 | .init_early = am35xx_init_early, | ||
144 | .init_irq = omap_intc_of_init, | ||
145 | .handle_irq = omap3_intc_handle_irq, | ||
146 | .init_machine = omap_generic_init, | ||
147 | .init_late = omap3_init_late, | ||
148 | .init_time = omap3_gptimer_timer_init, | ||
149 | .dt_compat = am3517_boards_compat, | ||
150 | .restart = omap3xxx_restart, | ||
151 | MACHINE_END | ||
134 | #endif | 152 | #endif |
135 | 153 | ||
136 | #ifdef CONFIG_SOC_AM33XX | 154 | #ifdef CONFIG_SOC_AM33XX |
diff --git a/arch/arm/mach-omap2/dss-common.c b/arch/arm/mach-omap2/dss-common.c index 365bfd3d9c68..dadccc91488c 100644 --- a/arch/arm/mach-omap2/dss-common.c +++ b/arch/arm/mach-omap2/dss-common.c | |||
@@ -223,7 +223,7 @@ void __init omap_4430sdp_display_init_of(void) | |||
223 | static struct connector_dvi_platform_data omap3_igep2_dvi_connector_pdata = { | 223 | static struct connector_dvi_platform_data omap3_igep2_dvi_connector_pdata = { |
224 | .name = "dvi", | 224 | .name = "dvi", |
225 | .source = "tfp410.0", | 225 | .source = "tfp410.0", |
226 | .i2c_bus_num = 3, | 226 | .i2c_bus_num = 2, |
227 | }; | 227 | }; |
228 | 228 | ||
229 | static struct platform_device omap3_igep2_dvi_connector_device = { | 229 | static struct platform_device omap3_igep2_dvi_connector_device = { |
diff --git a/arch/arm/mach-omap2/omap_device.c b/arch/arm/mach-omap2/omap_device.c index 53f0735817bb..e0a398cf28d8 100644 --- a/arch/arm/mach-omap2/omap_device.c +++ b/arch/arm/mach-omap2/omap_device.c | |||
@@ -183,6 +183,10 @@ static int omap_device_build_from_dt(struct platform_device *pdev) | |||
183 | odbfd_exit1: | 183 | odbfd_exit1: |
184 | kfree(hwmods); | 184 | kfree(hwmods); |
185 | odbfd_exit: | 185 | odbfd_exit: |
186 | /* if data/we are at fault.. load up a fail handler */ | ||
187 | if (ret) | ||
188 | pdev->dev.pm_domain = &omap_device_fail_pm_domain; | ||
189 | |||
186 | return ret; | 190 | return ret; |
187 | } | 191 | } |
188 | 192 | ||
@@ -604,6 +608,19 @@ static int _od_runtime_resume(struct device *dev) | |||
604 | 608 | ||
605 | return pm_generic_runtime_resume(dev); | 609 | return pm_generic_runtime_resume(dev); |
606 | } | 610 | } |
611 | |||
612 | static int _od_fail_runtime_suspend(struct device *dev) | ||
613 | { | ||
614 | dev_warn(dev, "%s: FIXME: missing hwmod/omap_dev info\n", __func__); | ||
615 | return -ENODEV; | ||
616 | } | ||
617 | |||
618 | static int _od_fail_runtime_resume(struct device *dev) | ||
619 | { | ||
620 | dev_warn(dev, "%s: FIXME: missing hwmod/omap_dev info\n", __func__); | ||
621 | return -ENODEV; | ||
622 | } | ||
623 | |||
607 | #endif | 624 | #endif |
608 | 625 | ||
609 | #ifdef CONFIG_SUSPEND | 626 | #ifdef CONFIG_SUSPEND |
@@ -657,6 +674,13 @@ static int _od_resume_noirq(struct device *dev) | |||
657 | #define _od_resume_noirq NULL | 674 | #define _od_resume_noirq NULL |
658 | #endif | 675 | #endif |
659 | 676 | ||
677 | struct dev_pm_domain omap_device_fail_pm_domain = { | ||
678 | .ops = { | ||
679 | SET_RUNTIME_PM_OPS(_od_fail_runtime_suspend, | ||
680 | _od_fail_runtime_resume, NULL) | ||
681 | } | ||
682 | }; | ||
683 | |||
660 | struct dev_pm_domain omap_device_pm_domain = { | 684 | struct dev_pm_domain omap_device_pm_domain = { |
661 | .ops = { | 685 | .ops = { |
662 | SET_RUNTIME_PM_OPS(_od_runtime_suspend, _od_runtime_resume, | 686 | SET_RUNTIME_PM_OPS(_od_runtime_suspend, _od_runtime_resume, |
diff --git a/arch/arm/mach-omap2/omap_device.h b/arch/arm/mach-omap2/omap_device.h index 17ca1aec2710..78c02b355179 100644 --- a/arch/arm/mach-omap2/omap_device.h +++ b/arch/arm/mach-omap2/omap_device.h | |||
@@ -29,6 +29,7 @@ | |||
29 | #include "omap_hwmod.h" | 29 | #include "omap_hwmod.h" |
30 | 30 | ||
31 | extern struct dev_pm_domain omap_device_pm_domain; | 31 | extern struct dev_pm_domain omap_device_pm_domain; |
32 | extern struct dev_pm_domain omap_device_fail_pm_domain; | ||
32 | 33 | ||
33 | /* omap_device._state values */ | 34 | /* omap_device._state values */ |
34 | #define OMAP_DEVICE_STATE_UNKNOWN 0 | 35 | #define OMAP_DEVICE_STATE_UNKNOWN 0 |
diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c index e3f0ecaf87dd..8a1b5e0bad40 100644 --- a/arch/arm/mach-omap2/omap_hwmod.c +++ b/arch/arm/mach-omap2/omap_hwmod.c | |||
@@ -399,7 +399,7 @@ static int _set_clockactivity(struct omap_hwmod *oh, u8 clockact, u32 *v) | |||
399 | } | 399 | } |
400 | 400 | ||
401 | /** | 401 | /** |
402 | * _set_softreset: set OCP_SYSCONFIG.CLOCKACTIVITY bits in @v | 402 | * _set_softreset: set OCP_SYSCONFIG.SOFTRESET bit in @v |
403 | * @oh: struct omap_hwmod * | 403 | * @oh: struct omap_hwmod * |
404 | * @v: pointer to register contents to modify | 404 | * @v: pointer to register contents to modify |
405 | * | 405 | * |
@@ -427,6 +427,36 @@ static int _set_softreset(struct omap_hwmod *oh, u32 *v) | |||
427 | } | 427 | } |
428 | 428 | ||
429 | /** | 429 | /** |
430 | * _clear_softreset: clear OCP_SYSCONFIG.SOFTRESET bit in @v | ||
431 | * @oh: struct omap_hwmod * | ||
432 | * @v: pointer to register contents to modify | ||
433 | * | ||
434 | * Clear the SOFTRESET bit in @v for hwmod @oh. Returns -EINVAL upon | ||
435 | * error or 0 upon success. | ||
436 | */ | ||
437 | static int _clear_softreset(struct omap_hwmod *oh, u32 *v) | ||
438 | { | ||
439 | u32 softrst_mask; | ||
440 | |||
441 | if (!oh->class->sysc || | ||
442 | !(oh->class->sysc->sysc_flags & SYSC_HAS_SOFTRESET)) | ||
443 | return -EINVAL; | ||
444 | |||
445 | if (!oh->class->sysc->sysc_fields) { | ||
446 | WARN(1, | ||
447 | "omap_hwmod: %s: sysc_fields absent for sysconfig class\n", | ||
448 | oh->name); | ||
449 | return -EINVAL; | ||
450 | } | ||
451 | |||
452 | softrst_mask = (0x1 << oh->class->sysc->sysc_fields->srst_shift); | ||
453 | |||
454 | *v &= ~softrst_mask; | ||
455 | |||
456 | return 0; | ||
457 | } | ||
458 | |||
459 | /** | ||
430 | * _wait_softreset_complete - wait for an OCP softreset to complete | 460 | * _wait_softreset_complete - wait for an OCP softreset to complete |
431 | * @oh: struct omap_hwmod * to wait on | 461 | * @oh: struct omap_hwmod * to wait on |
432 | * | 462 | * |
@@ -785,6 +815,7 @@ static int _init_interface_clks(struct omap_hwmod *oh) | |||
785 | pr_warning("omap_hwmod: %s: cannot clk_get interface_clk %s\n", | 815 | pr_warning("omap_hwmod: %s: cannot clk_get interface_clk %s\n", |
786 | oh->name, os->clk); | 816 | oh->name, os->clk); |
787 | ret = -EINVAL; | 817 | ret = -EINVAL; |
818 | continue; | ||
788 | } | 819 | } |
789 | os->_clk = c; | 820 | os->_clk = c; |
790 | /* | 821 | /* |
@@ -821,6 +852,7 @@ static int _init_opt_clks(struct omap_hwmod *oh) | |||
821 | pr_warning("omap_hwmod: %s: cannot clk_get opt_clk %s\n", | 852 | pr_warning("omap_hwmod: %s: cannot clk_get opt_clk %s\n", |
822 | oh->name, oc->clk); | 853 | oh->name, oc->clk); |
823 | ret = -EINVAL; | 854 | ret = -EINVAL; |
855 | continue; | ||
824 | } | 856 | } |
825 | oc->_clk = c; | 857 | oc->_clk = c; |
826 | /* | 858 | /* |
@@ -1911,6 +1943,12 @@ static int _ocp_softreset(struct omap_hwmod *oh) | |||
1911 | ret = _set_softreset(oh, &v); | 1943 | ret = _set_softreset(oh, &v); |
1912 | if (ret) | 1944 | if (ret) |
1913 | goto dis_opt_clks; | 1945 | goto dis_opt_clks; |
1946 | |||
1947 | _write_sysconfig(v, oh); | ||
1948 | ret = _clear_softreset(oh, &v); | ||
1949 | if (ret) | ||
1950 | goto dis_opt_clks; | ||
1951 | |||
1914 | _write_sysconfig(v, oh); | 1952 | _write_sysconfig(v, oh); |
1915 | 1953 | ||
1916 | if (oh->class->sysc->srst_udelay) | 1954 | if (oh->class->sysc->srst_udelay) |
@@ -2326,38 +2364,80 @@ static int _shutdown(struct omap_hwmod *oh) | |||
2326 | return 0; | 2364 | return 0; |
2327 | } | 2365 | } |
2328 | 2366 | ||
2367 | static int of_dev_find_hwmod(struct device_node *np, | ||
2368 | struct omap_hwmod *oh) | ||
2369 | { | ||
2370 | int count, i, res; | ||
2371 | const char *p; | ||
2372 | |||
2373 | count = of_property_count_strings(np, "ti,hwmods"); | ||
2374 | if (count < 1) | ||
2375 | return -ENODEV; | ||
2376 | |||
2377 | for (i = 0; i < count; i++) { | ||
2378 | res = of_property_read_string_index(np, "ti,hwmods", | ||
2379 | i, &p); | ||
2380 | if (res) | ||
2381 | continue; | ||
2382 | if (!strcmp(p, oh->name)) { | ||
2383 | pr_debug("omap_hwmod: dt %s[%i] uses hwmod %s\n", | ||
2384 | np->name, i, oh->name); | ||
2385 | return i; | ||
2386 | } | ||
2387 | } | ||
2388 | |||
2389 | return -ENODEV; | ||
2390 | } | ||
2391 | |||
2329 | /** | 2392 | /** |
2330 | * of_dev_hwmod_lookup - look up needed hwmod from dt blob | 2393 | * of_dev_hwmod_lookup - look up needed hwmod from dt blob |
2331 | * @np: struct device_node * | 2394 | * @np: struct device_node * |
2332 | * @oh: struct omap_hwmod * | 2395 | * @oh: struct omap_hwmod * |
2396 | * @index: index of the entry found | ||
2397 | * @found: struct device_node * found or NULL | ||
2333 | * | 2398 | * |
2334 | * Parse the dt blob and find out needed hwmod. Recursive function is | 2399 | * Parse the dt blob and find out needed hwmod. Recursive function is |
2335 | * implemented to take care hierarchical dt blob parsing. | 2400 | * implemented to take care hierarchical dt blob parsing. |
2336 | * Return: The device node on success or NULL on failure. | 2401 | * Return: Returns 0 on success, -ENODEV when not found. |
2337 | */ | 2402 | */ |
2338 | static struct device_node *of_dev_hwmod_lookup(struct device_node *np, | 2403 | static int of_dev_hwmod_lookup(struct device_node *np, |
2339 | struct omap_hwmod *oh) | 2404 | struct omap_hwmod *oh, |
2405 | int *index, | ||
2406 | struct device_node **found) | ||
2340 | { | 2407 | { |
2341 | struct device_node *np0 = NULL, *np1 = NULL; | 2408 | struct device_node *np0 = NULL; |
2342 | const char *p; | 2409 | int res; |
2410 | |||
2411 | res = of_dev_find_hwmod(np, oh); | ||
2412 | if (res >= 0) { | ||
2413 | *found = np; | ||
2414 | *index = res; | ||
2415 | return 0; | ||
2416 | } | ||
2343 | 2417 | ||
2344 | for_each_child_of_node(np, np0) { | 2418 | for_each_child_of_node(np, np0) { |
2345 | if (of_find_property(np0, "ti,hwmods", NULL)) { | 2419 | struct device_node *fc; |
2346 | p = of_get_property(np0, "ti,hwmods", NULL); | 2420 | int i; |
2347 | if (!strcmp(p, oh->name)) | 2421 | |
2348 | return np0; | 2422 | res = of_dev_hwmod_lookup(np0, oh, &i, &fc); |
2349 | np1 = of_dev_hwmod_lookup(np0, oh); | 2423 | if (res == 0) { |
2350 | if (np1) | 2424 | *found = fc; |
2351 | return np1; | 2425 | *index = i; |
2426 | return 0; | ||
2352 | } | 2427 | } |
2353 | } | 2428 | } |
2354 | return NULL; | 2429 | |
2430 | *found = NULL; | ||
2431 | *index = 0; | ||
2432 | |||
2433 | return -ENODEV; | ||
2355 | } | 2434 | } |
2356 | 2435 | ||
2357 | /** | 2436 | /** |
2358 | * _init_mpu_rt_base - populate the virtual address for a hwmod | 2437 | * _init_mpu_rt_base - populate the virtual address for a hwmod |
2359 | * @oh: struct omap_hwmod * to locate the virtual address | 2438 | * @oh: struct omap_hwmod * to locate the virtual address |
2360 | * @data: (unused, caller should pass NULL) | 2439 | * @data: (unused, caller should pass NULL) |
2440 | * @index: index of the reg entry iospace in device tree | ||
2361 | * @np: struct device_node * of the IP block's device node in the DT data | 2441 | * @np: struct device_node * of the IP block's device node in the DT data |
2362 | * | 2442 | * |
2363 | * Cache the virtual address used by the MPU to access this IP block's | 2443 | * Cache the virtual address used by the MPU to access this IP block's |
@@ -2368,7 +2448,7 @@ static struct device_node *of_dev_hwmod_lookup(struct device_node *np, | |||
2368 | * -ENXIO on absent or invalid register target address space. | 2448 | * -ENXIO on absent or invalid register target address space. |
2369 | */ | 2449 | */ |
2370 | static int __init _init_mpu_rt_base(struct omap_hwmod *oh, void *data, | 2450 | static int __init _init_mpu_rt_base(struct omap_hwmod *oh, void *data, |
2371 | struct device_node *np) | 2451 | int index, struct device_node *np) |
2372 | { | 2452 | { |
2373 | struct omap_hwmod_addr_space *mem; | 2453 | struct omap_hwmod_addr_space *mem; |
2374 | void __iomem *va_start = NULL; | 2454 | void __iomem *va_start = NULL; |
@@ -2390,13 +2470,17 @@ static int __init _init_mpu_rt_base(struct omap_hwmod *oh, void *data, | |||
2390 | if (!np) | 2470 | if (!np) |
2391 | return -ENXIO; | 2471 | return -ENXIO; |
2392 | 2472 | ||
2393 | va_start = of_iomap(np, oh->mpu_rt_idx); | 2473 | va_start = of_iomap(np, index + oh->mpu_rt_idx); |
2394 | } else { | 2474 | } else { |
2395 | va_start = ioremap(mem->pa_start, mem->pa_end - mem->pa_start); | 2475 | va_start = ioremap(mem->pa_start, mem->pa_end - mem->pa_start); |
2396 | } | 2476 | } |
2397 | 2477 | ||
2398 | if (!va_start) { | 2478 | if (!va_start) { |
2399 | pr_err("omap_hwmod: %s: Could not ioremap\n", oh->name); | 2479 | if (mem) |
2480 | pr_err("omap_hwmod: %s: Could not ioremap\n", oh->name); | ||
2481 | else | ||
2482 | pr_err("omap_hwmod: %s: Missing dt reg%i for %s\n", | ||
2483 | oh->name, index, np->full_name); | ||
2400 | return -ENXIO; | 2484 | return -ENXIO; |
2401 | } | 2485 | } |
2402 | 2486 | ||
@@ -2422,17 +2506,29 @@ static int __init _init_mpu_rt_base(struct omap_hwmod *oh, void *data, | |||
2422 | */ | 2506 | */ |
2423 | static int __init _init(struct omap_hwmod *oh, void *data) | 2507 | static int __init _init(struct omap_hwmod *oh, void *data) |
2424 | { | 2508 | { |
2425 | int r; | 2509 | int r, index; |
2426 | struct device_node *np = NULL; | 2510 | struct device_node *np = NULL; |
2427 | 2511 | ||
2428 | if (oh->_state != _HWMOD_STATE_REGISTERED) | 2512 | if (oh->_state != _HWMOD_STATE_REGISTERED) |
2429 | return 0; | 2513 | return 0; |
2430 | 2514 | ||
2431 | if (of_have_populated_dt()) | 2515 | if (of_have_populated_dt()) { |
2432 | np = of_dev_hwmod_lookup(of_find_node_by_name(NULL, "ocp"), oh); | 2516 | struct device_node *bus; |
2517 | |||
2518 | bus = of_find_node_by_name(NULL, "ocp"); | ||
2519 | if (!bus) | ||
2520 | return -ENODEV; | ||
2521 | |||
2522 | r = of_dev_hwmod_lookup(bus, oh, &index, &np); | ||
2523 | if (r) | ||
2524 | pr_debug("omap_hwmod: %s missing dt data\n", oh->name); | ||
2525 | else if (np && index) | ||
2526 | pr_warn("omap_hwmod: %s using broken dt data from %s\n", | ||
2527 | oh->name, np->name); | ||
2528 | } | ||
2433 | 2529 | ||
2434 | if (oh->class->sysc) { | 2530 | if (oh->class->sysc) { |
2435 | r = _init_mpu_rt_base(oh, NULL, np); | 2531 | r = _init_mpu_rt_base(oh, NULL, index, np); |
2436 | if (r < 0) { | 2532 | if (r < 0) { |
2437 | WARN(1, "omap_hwmod: %s: doesn't have mpu register target base\n", | 2533 | WARN(1, "omap_hwmod: %s: doesn't have mpu register target base\n", |
2438 | oh->name); | 2534 | oh->name); |
@@ -3169,6 +3265,11 @@ int omap_hwmod_softreset(struct omap_hwmod *oh) | |||
3169 | goto error; | 3265 | goto error; |
3170 | _write_sysconfig(v, oh); | 3266 | _write_sysconfig(v, oh); |
3171 | 3267 | ||
3268 | ret = _clear_softreset(oh, &v); | ||
3269 | if (ret) | ||
3270 | goto error; | ||
3271 | _write_sysconfig(v, oh); | ||
3272 | |||
3172 | error: | 3273 | error: |
3173 | return ret; | 3274 | return ret; |
3174 | } | 3275 | } |
diff --git a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c index 9e56fabd7fa3..d33742908f97 100644 --- a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c +++ b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c | |||
@@ -1943,7 +1943,8 @@ static struct omap_hwmod_class_sysconfig omap3xxx_usb_host_hs_sysc = { | |||
1943 | .syss_offs = 0x0014, | 1943 | .syss_offs = 0x0014, |
1944 | .sysc_flags = (SYSC_HAS_MIDLEMODE | SYSC_HAS_CLOCKACTIVITY | | 1944 | .sysc_flags = (SYSC_HAS_MIDLEMODE | SYSC_HAS_CLOCKACTIVITY | |
1945 | SYSC_HAS_SIDLEMODE | SYSC_HAS_ENAWAKEUP | | 1945 | SYSC_HAS_SIDLEMODE | SYSC_HAS_ENAWAKEUP | |
1946 | SYSC_HAS_SOFTRESET | SYSC_HAS_AUTOIDLE), | 1946 | SYSC_HAS_SOFTRESET | SYSC_HAS_AUTOIDLE | |
1947 | SYSS_HAS_RESET_STATUS), | ||
1947 | .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART | | 1948 | .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART | |
1948 | MSTANDBY_FORCE | MSTANDBY_NO | MSTANDBY_SMART), | 1949 | MSTANDBY_FORCE | MSTANDBY_NO | MSTANDBY_SMART), |
1949 | .sysc_fields = &omap_hwmod_sysc_type1, | 1950 | .sysc_fields = &omap_hwmod_sysc_type1, |
@@ -2021,15 +2022,7 @@ static struct omap_hwmod omap3xxx_usb_host_hs_hwmod = { | |||
2021 | * hence HWMOD_SWSUP_MSTANDBY | 2022 | * hence HWMOD_SWSUP_MSTANDBY |
2022 | */ | 2023 | */ |
2023 | 2024 | ||
2024 | /* | 2025 | .flags = HWMOD_SWSUP_SIDLE | HWMOD_SWSUP_MSTANDBY, |
2025 | * During system boot; If the hwmod framework resets the module | ||
2026 | * the module will have smart idle settings; which can lead to deadlock | ||
2027 | * (above Errata Id:i660); so, dont reset the module during boot; | ||
2028 | * Use HWMOD_INIT_NO_RESET. | ||
2029 | */ | ||
2030 | |||
2031 | .flags = HWMOD_SWSUP_SIDLE | HWMOD_SWSUP_MSTANDBY | | ||
2032 | HWMOD_INIT_NO_RESET, | ||
2033 | }; | 2026 | }; |
2034 | 2027 | ||
2035 | /* | 2028 | /* |
diff --git a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c index 1e5b12cb8246..3318cae96e7d 100644 --- a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c +++ b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c | |||
@@ -2937,7 +2937,7 @@ static struct omap_hwmod_class_sysconfig omap44xx_usb_host_hs_sysc = { | |||
2937 | .sysc_offs = 0x0010, | 2937 | .sysc_offs = 0x0010, |
2938 | .syss_offs = 0x0014, | 2938 | .syss_offs = 0x0014, |
2939 | .sysc_flags = (SYSC_HAS_MIDLEMODE | SYSC_HAS_SIDLEMODE | | 2939 | .sysc_flags = (SYSC_HAS_MIDLEMODE | SYSC_HAS_SIDLEMODE | |
2940 | SYSC_HAS_SOFTRESET), | 2940 | SYSC_HAS_SOFTRESET | SYSC_HAS_RESET_STATUS), |
2941 | .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART | | 2941 | .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART | |
2942 | SIDLE_SMART_WKUP | MSTANDBY_FORCE | MSTANDBY_NO | | 2942 | SIDLE_SMART_WKUP | MSTANDBY_FORCE | MSTANDBY_NO | |
2943 | MSTANDBY_SMART | MSTANDBY_SMART_WKUP), | 2943 | MSTANDBY_SMART | MSTANDBY_SMART_WKUP), |
@@ -3001,15 +3001,7 @@ static struct omap_hwmod omap44xx_usb_host_hs_hwmod = { | |||
3001 | * hence HWMOD_SWSUP_MSTANDBY | 3001 | * hence HWMOD_SWSUP_MSTANDBY |
3002 | */ | 3002 | */ |
3003 | 3003 | ||
3004 | /* | 3004 | .flags = HWMOD_SWSUP_SIDLE | HWMOD_SWSUP_MSTANDBY, |
3005 | * During system boot; If the hwmod framework resets the module | ||
3006 | * the module will have smart idle settings; which can lead to deadlock | ||
3007 | * (above Errata Id:i660); so, dont reset the module during boot; | ||
3008 | * Use HWMOD_INIT_NO_RESET. | ||
3009 | */ | ||
3010 | |||
3011 | .flags = HWMOD_SWSUP_SIDLE | HWMOD_SWSUP_MSTANDBY | | ||
3012 | HWMOD_INIT_NO_RESET, | ||
3013 | }; | 3005 | }; |
3014 | 3006 | ||
3015 | /* | 3007 | /* |
diff --git a/arch/arm/mach-omap2/omap_hwmod_54xx_data.c b/arch/arm/mach-omap2/omap_hwmod_54xx_data.c index 9e08d6994a0b..e297d6231c3a 100644 --- a/arch/arm/mach-omap2/omap_hwmod_54xx_data.c +++ b/arch/arm/mach-omap2/omap_hwmod_54xx_data.c | |||
@@ -1544,7 +1544,8 @@ static struct omap_hwmod_class_sysconfig omap54xx_usb_host_hs_sysc = { | |||
1544 | .rev_offs = 0x0000, | 1544 | .rev_offs = 0x0000, |
1545 | .sysc_offs = 0x0010, | 1545 | .sysc_offs = 0x0010, |
1546 | .sysc_flags = (SYSC_HAS_MIDLEMODE | SYSC_HAS_RESET_STATUS | | 1546 | .sysc_flags = (SYSC_HAS_MIDLEMODE | SYSC_HAS_RESET_STATUS | |
1547 | SYSC_HAS_SIDLEMODE | SYSC_HAS_SOFTRESET), | 1547 | SYSC_HAS_SIDLEMODE | SYSC_HAS_SOFTRESET | |
1548 | SYSC_HAS_RESET_STATUS), | ||
1548 | .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART | | 1549 | .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART | |
1549 | SIDLE_SMART_WKUP | MSTANDBY_FORCE | MSTANDBY_NO | | 1550 | SIDLE_SMART_WKUP | MSTANDBY_FORCE | MSTANDBY_NO | |
1550 | MSTANDBY_SMART | MSTANDBY_SMART_WKUP), | 1551 | MSTANDBY_SMART | MSTANDBY_SMART_WKUP), |
@@ -1598,15 +1599,7 @@ static struct omap_hwmod omap54xx_usb_host_hs_hwmod = { | |||
1598 | * hence HWMOD_SWSUP_MSTANDBY | 1599 | * hence HWMOD_SWSUP_MSTANDBY |
1599 | */ | 1600 | */ |
1600 | 1601 | ||
1601 | /* | 1602 | .flags = HWMOD_SWSUP_SIDLE | HWMOD_SWSUP_MSTANDBY, |
1602 | * During system boot; If the hwmod framework resets the module | ||
1603 | * the module will have smart idle settings; which can lead to deadlock | ||
1604 | * (above Errata Id:i660); so, dont reset the module during boot; | ||
1605 | * Use HWMOD_INIT_NO_RESET. | ||
1606 | */ | ||
1607 | |||
1608 | .flags = HWMOD_SWSUP_SIDLE | HWMOD_SWSUP_MSTANDBY | | ||
1609 | HWMOD_INIT_NO_RESET, | ||
1610 | .main_clk = "l3init_60m_fclk", | 1603 | .main_clk = "l3init_60m_fclk", |
1611 | .prcm = { | 1604 | .prcm = { |
1612 | .omap4 = { | 1605 | .omap4 = { |
diff --git a/arch/arm/mach-omap2/pdata-quirks.c b/arch/arm/mach-omap2/pdata-quirks.c index 10c71450cf63..39f020c982e8 100644 --- a/arch/arm/mach-omap2/pdata-quirks.c +++ b/arch/arm/mach-omap2/pdata-quirks.c | |||
@@ -139,6 +139,7 @@ struct of_dev_auxdata omap_auxdata_lookup[] __initdata = { | |||
139 | 139 | ||
140 | static struct pdata_init pdata_quirks[] __initdata = { | 140 | static struct pdata_init pdata_quirks[] __initdata = { |
141 | #ifdef CONFIG_ARCH_OMAP3 | 141 | #ifdef CONFIG_ARCH_OMAP3 |
142 | { "nokia,omap3-n900", hsmmc2_internal_input_clk, }, | ||
142 | { "nokia,omap3-n9", hsmmc2_internal_input_clk, }, | 143 | { "nokia,omap3-n9", hsmmc2_internal_input_clk, }, |
143 | { "nokia,omap3-n950", hsmmc2_internal_input_clk, }, | 144 | { "nokia,omap3-n950", hsmmc2_internal_input_clk, }, |
144 | { "isee,omap3-igep0020", omap3_igep0020_legacy_init, }, | 145 | { "isee,omap3-igep0020", omap3_igep0020_legacy_init, }, |
diff --git a/arch/arm/mach-omap2/powerdomain.c b/arch/arm/mach-omap2/powerdomain.c index e233dfcbc186..93a2a6e4260f 100644 --- a/arch/arm/mach-omap2/powerdomain.c +++ b/arch/arm/mach-omap2/powerdomain.c | |||
@@ -128,7 +128,8 @@ skip_voltdm: | |||
128 | for (i = 0; i < pwrdm->banks; i++) | 128 | for (i = 0; i < pwrdm->banks; i++) |
129 | pwrdm->ret_mem_off_counter[i] = 0; | 129 | pwrdm->ret_mem_off_counter[i] = 0; |
130 | 130 | ||
131 | arch_pwrdm->pwrdm_wait_transition(pwrdm); | 131 | if (arch_pwrdm && arch_pwrdm->pwrdm_wait_transition) |
132 | arch_pwrdm->pwrdm_wait_transition(pwrdm); | ||
132 | pwrdm->state = pwrdm_read_pwrst(pwrdm); | 133 | pwrdm->state = pwrdm_read_pwrst(pwrdm); |
133 | pwrdm->state_counter[pwrdm->state] = 1; | 134 | pwrdm->state_counter[pwrdm->state] = 1; |
134 | 135 | ||
diff --git a/arch/arm/mach-pxa/reset.c b/arch/arm/mach-pxa/reset.c index 0d5dd646f61f..263b15249b5b 100644 --- a/arch/arm/mach-pxa/reset.c +++ b/arch/arm/mach-pxa/reset.c | |||
@@ -13,6 +13,7 @@ | |||
13 | 13 | ||
14 | #include <mach/regs-ost.h> | 14 | #include <mach/regs-ost.h> |
15 | #include <mach/reset.h> | 15 | #include <mach/reset.h> |
16 | #include <mach/smemc.h> | ||
16 | 17 | ||
17 | unsigned int reset_status; | 18 | unsigned int reset_status; |
18 | EXPORT_SYMBOL(reset_status); | 19 | EXPORT_SYMBOL(reset_status); |
@@ -81,6 +82,12 @@ static void do_hw_reset(void) | |||
81 | writel_relaxed(OSSR_M3, OSSR); | 82 | writel_relaxed(OSSR_M3, OSSR); |
82 | /* ... in 100 ms */ | 83 | /* ... in 100 ms */ |
83 | writel_relaxed(readl_relaxed(OSCR) + 368640, OSMR3); | 84 | writel_relaxed(readl_relaxed(OSCR) + 368640, OSMR3); |
85 | /* | ||
86 | * SDRAM hangs on watchdog reset on Marvell PXA270 (erratum 71) | ||
87 | * we put SDRAM into self-refresh to prevent that | ||
88 | */ | ||
89 | while (1) | ||
90 | writel_relaxed(MDREFR_SLFRSH, MDREFR); | ||
84 | } | 91 | } |
85 | 92 | ||
86 | void pxa_restart(enum reboot_mode mode, const char *cmd) | 93 | void pxa_restart(enum reboot_mode mode, const char *cmd) |
@@ -104,4 +111,3 @@ void pxa_restart(enum reboot_mode mode, const char *cmd) | |||
104 | break; | 111 | break; |
105 | } | 112 | } |
106 | } | 113 | } |
107 | |||
diff --git a/arch/arm/mach-pxa/tosa.c b/arch/arm/mach-pxa/tosa.c index 0206b915a6f6..ef5557b807ed 100644 --- a/arch/arm/mach-pxa/tosa.c +++ b/arch/arm/mach-pxa/tosa.c | |||
@@ -425,57 +425,57 @@ static struct platform_device tosa_power_device = { | |||
425 | * Tosa Keyboard | 425 | * Tosa Keyboard |
426 | */ | 426 | */ |
427 | static const uint32_t tosakbd_keymap[] = { | 427 | static const uint32_t tosakbd_keymap[] = { |
428 | KEY(0, 2, KEY_W), | 428 | KEY(0, 1, KEY_W), |
429 | KEY(0, 6, KEY_K), | 429 | KEY(0, 5, KEY_K), |
430 | KEY(0, 7, KEY_BACKSPACE), | 430 | KEY(0, 6, KEY_BACKSPACE), |
431 | KEY(0, 8, KEY_P), | 431 | KEY(0, 7, KEY_P), |
432 | KEY(1, 1, KEY_Q), | 432 | KEY(1, 0, KEY_Q), |
433 | KEY(1, 2, KEY_E), | 433 | KEY(1, 1, KEY_E), |
434 | KEY(1, 3, KEY_T), | 434 | KEY(1, 2, KEY_T), |
435 | KEY(1, 4, KEY_Y), | 435 | KEY(1, 3, KEY_Y), |
436 | KEY(1, 6, KEY_O), | 436 | KEY(1, 5, KEY_O), |
437 | KEY(1, 7, KEY_I), | 437 | KEY(1, 6, KEY_I), |
438 | KEY(1, 8, KEY_COMMA), | 438 | KEY(1, 7, KEY_COMMA), |
439 | KEY(2, 1, KEY_A), | 439 | KEY(2, 0, KEY_A), |
440 | KEY(2, 2, KEY_D), | 440 | KEY(2, 1, KEY_D), |
441 | KEY(2, 3, KEY_G), | 441 | KEY(2, 2, KEY_G), |
442 | KEY(2, 4, KEY_U), | 442 | KEY(2, 3, KEY_U), |
443 | KEY(2, 6, KEY_L), | 443 | KEY(2, 5, KEY_L), |
444 | KEY(2, 7, KEY_ENTER), | 444 | KEY(2, 6, KEY_ENTER), |
445 | KEY(2, 8, KEY_DOT), | 445 | KEY(2, 7, KEY_DOT), |
446 | KEY(3, 1, KEY_Z), | 446 | KEY(3, 0, KEY_Z), |
447 | KEY(3, 2, KEY_C), | 447 | KEY(3, 1, KEY_C), |
448 | KEY(3, 3, KEY_V), | 448 | KEY(3, 2, KEY_V), |
449 | KEY(3, 4, KEY_J), | 449 | KEY(3, 3, KEY_J), |
450 | KEY(3, 5, TOSA_KEY_ADDRESSBOOK), | 450 | KEY(3, 4, TOSA_KEY_ADDRESSBOOK), |
451 | KEY(3, 6, TOSA_KEY_CANCEL), | 451 | KEY(3, 5, TOSA_KEY_CANCEL), |
452 | KEY(3, 7, TOSA_KEY_CENTER), | 452 | KEY(3, 6, TOSA_KEY_CENTER), |
453 | KEY(3, 8, TOSA_KEY_OK), | 453 | KEY(3, 7, TOSA_KEY_OK), |
454 | KEY(3, 9, KEY_LEFTSHIFT), | 454 | KEY(3, 8, KEY_LEFTSHIFT), |
455 | KEY(4, 1, KEY_S), | 455 | KEY(4, 0, KEY_S), |
456 | KEY(4, 2, KEY_R), | 456 | KEY(4, 1, KEY_R), |
457 | KEY(4, 3, KEY_B), | 457 | KEY(4, 2, KEY_B), |
458 | KEY(4, 4, KEY_N), | 458 | KEY(4, 3, KEY_N), |
459 | KEY(4, 5, TOSA_KEY_CALENDAR), | 459 | KEY(4, 4, TOSA_KEY_CALENDAR), |
460 | KEY(4, 6, TOSA_KEY_HOMEPAGE), | 460 | KEY(4, 5, TOSA_KEY_HOMEPAGE), |
461 | KEY(4, 7, KEY_LEFTCTRL), | 461 | KEY(4, 6, KEY_LEFTCTRL), |
462 | KEY(4, 8, TOSA_KEY_LIGHT), | 462 | KEY(4, 7, TOSA_KEY_LIGHT), |
463 | KEY(4, 10, KEY_RIGHTSHIFT), | 463 | KEY(4, 9, KEY_RIGHTSHIFT), |
464 | KEY(5, 1, KEY_TAB), | 464 | KEY(5, 0, KEY_TAB), |
465 | KEY(5, 2, KEY_SLASH), | 465 | KEY(5, 1, KEY_SLASH), |
466 | KEY(5, 3, KEY_H), | 466 | KEY(5, 2, KEY_H), |
467 | KEY(5, 4, KEY_M), | 467 | KEY(5, 3, KEY_M), |
468 | KEY(5, 5, TOSA_KEY_MENU), | 468 | KEY(5, 4, TOSA_KEY_MENU), |
469 | KEY(5, 7, KEY_UP), | 469 | KEY(5, 6, KEY_UP), |
470 | KEY(5, 11, TOSA_KEY_FN), | 470 | KEY(5, 10, TOSA_KEY_FN), |
471 | KEY(6, 1, KEY_X), | 471 | KEY(6, 0, KEY_X), |
472 | KEY(6, 2, KEY_F), | 472 | KEY(6, 1, KEY_F), |
473 | KEY(6, 3, KEY_SPACE), | 473 | KEY(6, 2, KEY_SPACE), |
474 | KEY(6, 4, KEY_APOSTROPHE), | 474 | KEY(6, 3, KEY_APOSTROPHE), |
475 | KEY(6, 5, TOSA_KEY_MAIL), | 475 | KEY(6, 4, TOSA_KEY_MAIL), |
476 | KEY(6, 6, KEY_LEFT), | 476 | KEY(6, 5, KEY_LEFT), |
477 | KEY(6, 7, KEY_DOWN), | 477 | KEY(6, 6, KEY_DOWN), |
478 | KEY(6, 8, KEY_RIGHT), | 478 | KEY(6, 7, KEY_RIGHT), |
479 | }; | 479 | }; |
480 | 480 | ||
481 | static struct matrix_keymap_data tosakbd_keymap_data = { | 481 | static struct matrix_keymap_data tosakbd_keymap_data = { |
diff --git a/arch/arm/mach-socfpga/Kconfig b/arch/arm/mach-socfpga/Kconfig index 037100a1563a..aee77f06f887 100644 --- a/arch/arm/mach-socfpga/Kconfig +++ b/arch/arm/mach-socfpga/Kconfig | |||
@@ -10,6 +10,7 @@ config ARCH_SOCFPGA | |||
10 | select GENERIC_CLOCKEVENTS | 10 | select GENERIC_CLOCKEVENTS |
11 | select GPIO_PL061 if GPIOLIB | 11 | select GPIO_PL061 if GPIOLIB |
12 | select HAVE_ARM_SCU | 12 | select HAVE_ARM_SCU |
13 | select HAVE_ARM_TWD if SMP | ||
13 | select HAVE_SMP | 14 | select HAVE_SMP |
14 | select MFD_SYSCON | 15 | select MFD_SYSCON |
15 | select SPARSE_IRQ | 16 | select SPARSE_IRQ |
diff --git a/arch/arm/mach-tegra/fuse.c b/arch/arm/mach-tegra/fuse.c index 9a4e910c3796..3a9c1f1c219d 100644 --- a/arch/arm/mach-tegra/fuse.c +++ b/arch/arm/mach-tegra/fuse.c | |||
@@ -198,10 +198,12 @@ void __init tegra_init_fuse(void) | |||
198 | switch (tegra_chip_id) { | 198 | switch (tegra_chip_id) { |
199 | case TEGRA20: | 199 | case TEGRA20: |
200 | tegra20_fuse_init_randomness(); | 200 | tegra20_fuse_init_randomness(); |
201 | break; | ||
201 | case TEGRA30: | 202 | case TEGRA30: |
202 | case TEGRA114: | 203 | case TEGRA114: |
203 | default: | 204 | default: |
204 | tegra30_fuse_init_randomness(); | 205 | tegra30_fuse_init_randomness(); |
206 | break; | ||
205 | } | 207 | } |
206 | 208 | ||
207 | pr_info("Tegra Revision: %s SKU: %d CPU Process: %d Core Process: %d\n", | 209 | pr_info("Tegra Revision: %s SKU: %d CPU Process: %d Core Process: %d\n", |
diff --git a/arch/arm/mach-ux500/cpu-db8500.c b/arch/arm/mach-ux500/cpu-db8500.c index 2e85c1e72535..12c7e5c03ea4 100644 --- a/arch/arm/mach-ux500/cpu-db8500.c +++ b/arch/arm/mach-ux500/cpu-db8500.c | |||
@@ -140,6 +140,10 @@ static struct of_dev_auxdata u8500_auxdata_lookup[] __initdata = { | |||
140 | /* Requires call-back bindings. */ | 140 | /* Requires call-back bindings. */ |
141 | OF_DEV_AUXDATA("arm,cortex-a9-pmu", 0, "arm-pmu", &db8500_pmu_platdata), | 141 | OF_DEV_AUXDATA("arm,cortex-a9-pmu", 0, "arm-pmu", &db8500_pmu_platdata), |
142 | /* Requires DMA bindings. */ | 142 | /* Requires DMA bindings. */ |
143 | OF_DEV_AUXDATA("arm,pl18x", 0x80126000, "sdi0", &mop500_sdi0_data), | ||
144 | OF_DEV_AUXDATA("arm,pl18x", 0x80118000, "sdi1", &mop500_sdi1_data), | ||
145 | OF_DEV_AUXDATA("arm,pl18x", 0x80005000, "sdi2", &mop500_sdi2_data), | ||
146 | OF_DEV_AUXDATA("arm,pl18x", 0x80114000, "sdi4", &mop500_sdi4_data), | ||
143 | OF_DEV_AUXDATA("stericsson,ux500-msp-i2s", 0x80123000, | 147 | OF_DEV_AUXDATA("stericsson,ux500-msp-i2s", 0x80123000, |
144 | "ux500-msp-i2s.0", &msp0_platform_data), | 148 | "ux500-msp-i2s.0", &msp0_platform_data), |
145 | OF_DEV_AUXDATA("stericsson,ux500-msp-i2s", 0x80124000, | 149 | OF_DEV_AUXDATA("stericsson,ux500-msp-i2s", 0x80124000, |
diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c index 79f8b39801a8..f61a5707823a 100644 --- a/arch/arm/mm/dma-mapping.c +++ b/arch/arm/mm/dma-mapping.c | |||
@@ -9,6 +9,7 @@ | |||
9 | * | 9 | * |
10 | * DMA uncached mapping support. | 10 | * DMA uncached mapping support. |
11 | */ | 11 | */ |
12 | #include <linux/bootmem.h> | ||
12 | #include <linux/module.h> | 13 | #include <linux/module.h> |
13 | #include <linux/mm.h> | 14 | #include <linux/mm.h> |
14 | #include <linux/gfp.h> | 15 | #include <linux/gfp.h> |
@@ -157,6 +158,44 @@ struct dma_map_ops arm_coherent_dma_ops = { | |||
157 | }; | 158 | }; |
158 | EXPORT_SYMBOL(arm_coherent_dma_ops); | 159 | EXPORT_SYMBOL(arm_coherent_dma_ops); |
159 | 160 | ||
161 | static int __dma_supported(struct device *dev, u64 mask, bool warn) | ||
162 | { | ||
163 | unsigned long max_dma_pfn; | ||
164 | |||
165 | /* | ||
166 | * If the mask allows for more memory than we can address, | ||
167 | * and we actually have that much memory, then we must | ||
168 | * indicate that DMA to this device is not supported. | ||
169 | */ | ||
170 | if (sizeof(mask) != sizeof(dma_addr_t) && | ||
171 | mask > (dma_addr_t)~0 && | ||
172 | dma_to_pfn(dev, ~0) < max_pfn) { | ||
173 | if (warn) { | ||
174 | dev_warn(dev, "Coherent DMA mask %#llx is larger than dma_addr_t allows\n", | ||
175 | mask); | ||
176 | dev_warn(dev, "Driver did not use or check the return value from dma_set_coherent_mask()?\n"); | ||
177 | } | ||
178 | return 0; | ||
179 | } | ||
180 | |||
181 | max_dma_pfn = min(max_pfn, arm_dma_pfn_limit); | ||
182 | |||
183 | /* | ||
184 | * Translate the device's DMA mask to a PFN limit. This | ||
185 | * PFN number includes the page which we can DMA to. | ||
186 | */ | ||
187 | if (dma_to_pfn(dev, mask) < max_dma_pfn) { | ||
188 | if (warn) | ||
189 | dev_warn(dev, "Coherent DMA mask %#llx (pfn %#lx-%#lx) covers a smaller range of system memory than the DMA zone pfn 0x0-%#lx\n", | ||
190 | mask, | ||
191 | dma_to_pfn(dev, 0), dma_to_pfn(dev, mask) + 1, | ||
192 | max_dma_pfn + 1); | ||
193 | return 0; | ||
194 | } | ||
195 | |||
196 | return 1; | ||
197 | } | ||
198 | |||
160 | static u64 get_coherent_dma_mask(struct device *dev) | 199 | static u64 get_coherent_dma_mask(struct device *dev) |
161 | { | 200 | { |
162 | u64 mask = (u64)DMA_BIT_MASK(32); | 201 | u64 mask = (u64)DMA_BIT_MASK(32); |
@@ -173,32 +212,8 @@ static u64 get_coherent_dma_mask(struct device *dev) | |||
173 | return 0; | 212 | return 0; |
174 | } | 213 | } |
175 | 214 | ||
176 | /* | 215 | if (!__dma_supported(dev, mask, true)) |
177 | * If the mask allows for more memory than we can address, | ||
178 | * and we actually have that much memory, then fail the | ||
179 | * allocation. | ||
180 | */ | ||
181 | if (sizeof(mask) != sizeof(dma_addr_t) && | ||
182 | mask > (dma_addr_t)~0 && | ||
183 | dma_to_pfn(dev, ~0) > arm_dma_pfn_limit) { | ||
184 | dev_warn(dev, "Coherent DMA mask %#llx is larger than dma_addr_t allows\n", | ||
185 | mask); | ||
186 | dev_warn(dev, "Driver did not use or check the return value from dma_set_coherent_mask()?\n"); | ||
187 | return 0; | ||
188 | } | ||
189 | |||
190 | /* | ||
191 | * Now check that the mask, when translated to a PFN, | ||
192 | * fits within the allowable addresses which we can | ||
193 | * allocate. | ||
194 | */ | ||
195 | if (dma_to_pfn(dev, mask) < arm_dma_pfn_limit) { | ||
196 | dev_warn(dev, "Coherent DMA mask %#llx (pfn %#lx-%#lx) covers a smaller range of system memory than the DMA zone pfn 0x0-%#lx\n", | ||
197 | mask, | ||
198 | dma_to_pfn(dev, 0), dma_to_pfn(dev, mask) + 1, | ||
199 | arm_dma_pfn_limit + 1); | ||
200 | return 0; | 216 | return 0; |
201 | } | ||
202 | } | 217 | } |
203 | 218 | ||
204 | return mask; | 219 | return mask; |
@@ -1027,28 +1042,7 @@ void arm_dma_sync_sg_for_device(struct device *dev, struct scatterlist *sg, | |||
1027 | */ | 1042 | */ |
1028 | int dma_supported(struct device *dev, u64 mask) | 1043 | int dma_supported(struct device *dev, u64 mask) |
1029 | { | 1044 | { |
1030 | unsigned long limit; | 1045 | return __dma_supported(dev, mask, false); |
1031 | |||
1032 | /* | ||
1033 | * If the mask allows for more memory than we can address, | ||
1034 | * and we actually have that much memory, then we must | ||
1035 | * indicate that DMA to this device is not supported. | ||
1036 | */ | ||
1037 | if (sizeof(mask) != sizeof(dma_addr_t) && | ||
1038 | mask > (dma_addr_t)~0 && | ||
1039 | dma_to_pfn(dev, ~0) > arm_dma_pfn_limit) | ||
1040 | return 0; | ||
1041 | |||
1042 | /* | ||
1043 | * Translate the device's DMA mask to a PFN limit. This | ||
1044 | * PFN number includes the page which we can DMA to. | ||
1045 | */ | ||
1046 | limit = dma_to_pfn(dev, mask); | ||
1047 | |||
1048 | if (limit < arm_dma_pfn_limit) | ||
1049 | return 0; | ||
1050 | |||
1051 | return 1; | ||
1052 | } | 1046 | } |
1053 | EXPORT_SYMBOL(dma_supported); | 1047 | EXPORT_SYMBOL(dma_supported); |
1054 | 1048 | ||
diff --git a/arch/arm/mm/init.c b/arch/arm/mm/init.c index 3e8f106ee5fe..1f7b19a47060 100644 --- a/arch/arm/mm/init.c +++ b/arch/arm/mm/init.c | |||
@@ -229,7 +229,7 @@ void __init setup_dma_zone(const struct machine_desc *mdesc) | |||
229 | #ifdef CONFIG_ZONE_DMA | 229 | #ifdef CONFIG_ZONE_DMA |
230 | if (mdesc->dma_zone_size) { | 230 | if (mdesc->dma_zone_size) { |
231 | arm_dma_zone_size = mdesc->dma_zone_size; | 231 | arm_dma_zone_size = mdesc->dma_zone_size; |
232 | arm_dma_limit = PHYS_OFFSET + arm_dma_zone_size - 1; | 232 | arm_dma_limit = __pv_phys_offset + arm_dma_zone_size - 1; |
233 | } else | 233 | } else |
234 | arm_dma_limit = 0xffffffff; | 234 | arm_dma_limit = 0xffffffff; |
235 | arm_dma_pfn_limit = arm_dma_limit >> PAGE_SHIFT; | 235 | arm_dma_pfn_limit = arm_dma_limit >> PAGE_SHIFT; |
diff --git a/arch/arm/mm/mmap.c b/arch/arm/mm/mmap.c index d27158c38eb0..5e85ed371364 100644 --- a/arch/arm/mm/mmap.c +++ b/arch/arm/mm/mmap.c | |||
@@ -146,7 +146,7 @@ arch_get_unmapped_area_topdown(struct file *filp, const unsigned long addr0, | |||
146 | 146 | ||
147 | info.flags = VM_UNMAPPED_AREA_TOPDOWN; | 147 | info.flags = VM_UNMAPPED_AREA_TOPDOWN; |
148 | info.length = len; | 148 | info.length = len; |
149 | info.low_limit = PAGE_SIZE; | 149 | info.low_limit = FIRST_USER_ADDRESS; |
150 | info.high_limit = mm->mmap_base; | 150 | info.high_limit = mm->mmap_base; |
151 | info.align_mask = do_align ? (PAGE_MASK & (SHMLBA - 1)) : 0; | 151 | info.align_mask = do_align ? (PAGE_MASK & (SHMLBA - 1)) : 0; |
152 | info.align_offset = pgoff << PAGE_SHIFT; | 152 | info.align_offset = pgoff << PAGE_SHIFT; |
diff --git a/arch/arm/mm/pgd.c b/arch/arm/mm/pgd.c index 0acb089d0f70..1046b373d1ae 100644 --- a/arch/arm/mm/pgd.c +++ b/arch/arm/mm/pgd.c | |||
@@ -87,7 +87,8 @@ pgd_t *pgd_alloc(struct mm_struct *mm) | |||
87 | init_pud = pud_offset(init_pgd, 0); | 87 | init_pud = pud_offset(init_pgd, 0); |
88 | init_pmd = pmd_offset(init_pud, 0); | 88 | init_pmd = pmd_offset(init_pud, 0); |
89 | init_pte = pte_offset_map(init_pmd, 0); | 89 | init_pte = pte_offset_map(init_pmd, 0); |
90 | set_pte_ext(new_pte, *init_pte, 0); | 90 | set_pte_ext(new_pte + 0, init_pte[0], 0); |
91 | set_pte_ext(new_pte + 1, init_pte[1], 0); | ||
91 | pte_unmap(init_pte); | 92 | pte_unmap(init_pte); |
92 | pte_unmap(new_pte); | 93 | pte_unmap(new_pte); |
93 | } | 94 | } |
diff --git a/arch/arm/plat-omap/include/plat/dmtimer.h b/arch/arm/plat-omap/include/plat/dmtimer.h index fb92abb91628..2861b155485a 100644 --- a/arch/arm/plat-omap/include/plat/dmtimer.h +++ b/arch/arm/plat-omap/include/plat/dmtimer.h | |||
@@ -336,8 +336,11 @@ static inline void __omap_dm_timer_enable_posted(struct omap_dm_timer *timer) | |||
336 | if (timer->posted) | 336 | if (timer->posted) |
337 | return; | 337 | return; |
338 | 338 | ||
339 | if (timer->errata & OMAP_TIMER_ERRATA_I103_I767) | 339 | if (timer->errata & OMAP_TIMER_ERRATA_I103_I767) { |
340 | timer->posted = OMAP_TIMER_NONPOSTED; | ||
341 | __omap_dm_timer_write(timer, OMAP_TIMER_IF_CTRL_REG, 0, 0); | ||
340 | return; | 342 | return; |
343 | } | ||
341 | 344 | ||
342 | __omap_dm_timer_write(timer, OMAP_TIMER_IF_CTRL_REG, | 345 | __omap_dm_timer_write(timer, OMAP_TIMER_IF_CTRL_REG, |
343 | OMAP_TIMER_CTRL_POSTED, 0); | 346 | OMAP_TIMER_CTRL_POSTED, 0); |
diff --git a/arch/arm/xen/p2m.c b/arch/arm/xen/p2m.c index 23732cdff551..b31ee1b275b0 100644 --- a/arch/arm/xen/p2m.c +++ b/arch/arm/xen/p2m.c | |||
@@ -25,8 +25,9 @@ struct xen_p2m_entry { | |||
25 | struct rb_node rbnode_phys; | 25 | struct rb_node rbnode_phys; |
26 | }; | 26 | }; |
27 | 27 | ||
28 | rwlock_t p2m_lock; | 28 | static rwlock_t p2m_lock; |
29 | struct rb_root phys_to_mach = RB_ROOT; | 29 | struct rb_root phys_to_mach = RB_ROOT; |
30 | EXPORT_SYMBOL_GPL(phys_to_mach); | ||
30 | static struct rb_root mach_to_phys = RB_ROOT; | 31 | static struct rb_root mach_to_phys = RB_ROOT; |
31 | 32 | ||
32 | static int xen_add_phys_to_mach_entry(struct xen_p2m_entry *new) | 33 | static int xen_add_phys_to_mach_entry(struct xen_p2m_entry *new) |
@@ -200,7 +201,7 @@ bool __set_phys_to_machine(unsigned long pfn, unsigned long mfn) | |||
200 | } | 201 | } |
201 | EXPORT_SYMBOL_GPL(__set_phys_to_machine); | 202 | EXPORT_SYMBOL_GPL(__set_phys_to_machine); |
202 | 203 | ||
203 | int p2m_init(void) | 204 | static int p2m_init(void) |
204 | { | 205 | { |
205 | rwlock_init(&p2m_lock); | 206 | rwlock_init(&p2m_lock); |
206 | return 0; | 207 | return 0; |
diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig index 88c8b6c1341a..6d4dd22ee4b7 100644 --- a/arch/arm64/Kconfig +++ b/arch/arm64/Kconfig | |||
@@ -159,8 +159,7 @@ config NR_CPUS | |||
159 | range 2 32 | 159 | range 2 32 |
160 | depends on SMP | 160 | depends on SMP |
161 | # These have to remain sorted largest to smallest | 161 | # These have to remain sorted largest to smallest |
162 | default "8" if ARCH_XGENE | 162 | default "8" |
163 | default "4" | ||
164 | 163 | ||
165 | config HOTPLUG_CPU | 164 | config HOTPLUG_CPU |
166 | bool "Support for hot-pluggable CPUs" | 165 | bool "Support for hot-pluggable CPUs" |
diff --git a/arch/arm64/include/asm/io.h b/arch/arm64/include/asm/io.h index 4cc813eddacb..572769727227 100644 --- a/arch/arm64/include/asm/io.h +++ b/arch/arm64/include/asm/io.h | |||
@@ -229,7 +229,7 @@ extern void __iomem *__ioremap(phys_addr_t phys_addr, size_t size, pgprot_t prot | |||
229 | extern void __iounmap(volatile void __iomem *addr); | 229 | extern void __iounmap(volatile void __iomem *addr); |
230 | extern void __iomem *ioremap_cache(phys_addr_t phys_addr, size_t size); | 230 | extern void __iomem *ioremap_cache(phys_addr_t phys_addr, size_t size); |
231 | 231 | ||
232 | #define PROT_DEFAULT (PTE_TYPE_PAGE | PTE_AF | PTE_DIRTY) | 232 | #define PROT_DEFAULT (pgprot_default | PTE_DIRTY) |
233 | #define PROT_DEVICE_nGnRE (PROT_DEFAULT | PTE_PXN | PTE_UXN | PTE_ATTRINDX(MT_DEVICE_nGnRE)) | 233 | #define PROT_DEVICE_nGnRE (PROT_DEFAULT | PTE_PXN | PTE_UXN | PTE_ATTRINDX(MT_DEVICE_nGnRE)) |
234 | #define PROT_NORMAL_NC (PROT_DEFAULT | PTE_ATTRINDX(MT_NORMAL_NC)) | 234 | #define PROT_NORMAL_NC (PROT_DEFAULT | PTE_ATTRINDX(MT_NORMAL_NC)) |
235 | #define PROT_NORMAL (PROT_DEFAULT | PTE_ATTRINDX(MT_NORMAL)) | 235 | #define PROT_NORMAL (PROT_DEFAULT | PTE_ATTRINDX(MT_NORMAL)) |
diff --git a/arch/arm64/include/asm/pgtable-hwdef.h b/arch/arm64/include/asm/pgtable-hwdef.h index 755f86143320..b1d2e26c3c88 100644 --- a/arch/arm64/include/asm/pgtable-hwdef.h +++ b/arch/arm64/include/asm/pgtable-hwdef.h | |||
@@ -43,7 +43,7 @@ | |||
43 | * Section | 43 | * Section |
44 | */ | 44 | */ |
45 | #define PMD_SECT_VALID (_AT(pmdval_t, 1) << 0) | 45 | #define PMD_SECT_VALID (_AT(pmdval_t, 1) << 0) |
46 | #define PMD_SECT_PROT_NONE (_AT(pmdval_t, 1) << 2) | 46 | #define PMD_SECT_PROT_NONE (_AT(pmdval_t, 1) << 58) |
47 | #define PMD_SECT_USER (_AT(pmdval_t, 1) << 6) /* AP[1] */ | 47 | #define PMD_SECT_USER (_AT(pmdval_t, 1) << 6) /* AP[1] */ |
48 | #define PMD_SECT_RDONLY (_AT(pmdval_t, 1) << 7) /* AP[2] */ | 48 | #define PMD_SECT_RDONLY (_AT(pmdval_t, 1) << 7) /* AP[2] */ |
49 | #define PMD_SECT_S (_AT(pmdval_t, 3) << 8) | 49 | #define PMD_SECT_S (_AT(pmdval_t, 3) << 8) |
diff --git a/arch/arm64/kernel/head.S b/arch/arm64/kernel/head.S index 7009387348b7..c68cca5c3523 100644 --- a/arch/arm64/kernel/head.S +++ b/arch/arm64/kernel/head.S | |||
@@ -282,8 +282,9 @@ ENDPROC(secondary_holding_pen) | |||
282 | * be used where CPUs are brought online dynamically by the kernel. | 282 | * be used where CPUs are brought online dynamically by the kernel. |
283 | */ | 283 | */ |
284 | ENTRY(secondary_entry) | 284 | ENTRY(secondary_entry) |
285 | bl __calc_phys_offset // x2=phys offset | ||
286 | bl el2_setup // Drop to EL1 | 285 | bl el2_setup // Drop to EL1 |
286 | bl __calc_phys_offset // x24=PHYS_OFFSET, x28=PHYS_OFFSET-PAGE_OFFSET | ||
287 | bl set_cpu_boot_mode_flag | ||
287 | b secondary_startup | 288 | b secondary_startup |
288 | ENDPROC(secondary_entry) | 289 | ENDPROC(secondary_entry) |
289 | 290 | ||
diff --git a/arch/arm64/mm/proc.S b/arch/arm64/mm/proc.S index 421b99fd635d..0f7fec52c7f8 100644 --- a/arch/arm64/mm/proc.S +++ b/arch/arm64/mm/proc.S | |||
@@ -111,12 +111,12 @@ ENTRY(__cpu_setup) | |||
111 | bl __flush_dcache_all | 111 | bl __flush_dcache_all |
112 | mov lr, x28 | 112 | mov lr, x28 |
113 | ic iallu // I+BTB cache invalidate | 113 | ic iallu // I+BTB cache invalidate |
114 | tlbi vmalle1is // invalidate I + D TLBs | ||
114 | dsb sy | 115 | dsb sy |
115 | 116 | ||
116 | mov x0, #3 << 20 | 117 | mov x0, #3 << 20 |
117 | msr cpacr_el1, x0 // Enable FP/ASIMD | 118 | msr cpacr_el1, x0 // Enable FP/ASIMD |
118 | msr mdscr_el1, xzr // Reset mdscr_el1 | 119 | msr mdscr_el1, xzr // Reset mdscr_el1 |
119 | tlbi vmalle1is // invalidate I + D TLBs | ||
120 | /* | 120 | /* |
121 | * Memory region attributes for LPAE: | 121 | * Memory region attributes for LPAE: |
122 | * | 122 | * |
diff --git a/arch/avr32/boards/favr-32/setup.c b/arch/avr32/boards/favr-32/setup.c index 7b1f2cd85400..1f121497b517 100644 --- a/arch/avr32/boards/favr-32/setup.c +++ b/arch/avr32/boards/favr-32/setup.c | |||
@@ -298,8 +298,10 @@ static int __init set_abdac_rate(struct platform_device *pdev) | |||
298 | */ | 298 | */ |
299 | retval = clk_round_rate(pll1, | 299 | retval = clk_round_rate(pll1, |
300 | CONFIG_BOARD_FAVR32_ABDAC_RATE * 256 * 16); | 300 | CONFIG_BOARD_FAVR32_ABDAC_RATE * 256 * 16); |
301 | if (retval < 0) | 301 | if (retval <= 0) { |
302 | retval = -EINVAL; | ||
302 | goto out_abdac; | 303 | goto out_abdac; |
304 | } | ||
303 | 305 | ||
304 | retval = clk_set_rate(pll1, retval); | 306 | retval = clk_set_rate(pll1, retval); |
305 | if (retval != 0) | 307 | if (retval != 0) |
diff --git a/arch/avr32/configs/atngw100_defconfig b/arch/avr32/configs/atngw100_defconfig index d5aff36ade92..4733e38e7ae6 100644 --- a/arch/avr32/configs/atngw100_defconfig +++ b/arch/avr32/configs/atngw100_defconfig | |||
@@ -59,7 +59,6 @@ CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" | |||
59 | # CONFIG_PREVENT_FIRMWARE_BUILD is not set | 59 | # CONFIG_PREVENT_FIRMWARE_BUILD is not set |
60 | # CONFIG_FW_LOADER is not set | 60 | # CONFIG_FW_LOADER is not set |
61 | CONFIG_MTD=y | 61 | CONFIG_MTD=y |
62 | CONFIG_MTD_PARTITIONS=y | ||
63 | CONFIG_MTD_CMDLINE_PARTS=y | 62 | CONFIG_MTD_CMDLINE_PARTS=y |
64 | CONFIG_MTD_CHAR=y | 63 | CONFIG_MTD_CHAR=y |
65 | CONFIG_MTD_BLOCK=y | 64 | CONFIG_MTD_BLOCK=y |
diff --git a/arch/avr32/configs/atngw100_evklcd100_defconfig b/arch/avr32/configs/atngw100_evklcd100_defconfig index 4abcf435d599..1be0ee31bd91 100644 --- a/arch/avr32/configs/atngw100_evklcd100_defconfig +++ b/arch/avr32/configs/atngw100_evklcd100_defconfig | |||
@@ -61,7 +61,6 @@ CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" | |||
61 | # CONFIG_PREVENT_FIRMWARE_BUILD is not set | 61 | # CONFIG_PREVENT_FIRMWARE_BUILD is not set |
62 | # CONFIG_FW_LOADER is not set | 62 | # CONFIG_FW_LOADER is not set |
63 | CONFIG_MTD=y | 63 | CONFIG_MTD=y |
64 | CONFIG_MTD_PARTITIONS=y | ||
65 | CONFIG_MTD_CMDLINE_PARTS=y | 64 | CONFIG_MTD_CMDLINE_PARTS=y |
66 | CONFIG_MTD_CHAR=y | 65 | CONFIG_MTD_CHAR=y |
67 | CONFIG_MTD_BLOCK=y | 66 | CONFIG_MTD_BLOCK=y |
diff --git a/arch/avr32/configs/atngw100_evklcd101_defconfig b/arch/avr32/configs/atngw100_evklcd101_defconfig index 18f3fa0470ff..796e536f7bc4 100644 --- a/arch/avr32/configs/atngw100_evklcd101_defconfig +++ b/arch/avr32/configs/atngw100_evklcd101_defconfig | |||
@@ -60,7 +60,6 @@ CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" | |||
60 | # CONFIG_PREVENT_FIRMWARE_BUILD is not set | 60 | # CONFIG_PREVENT_FIRMWARE_BUILD is not set |
61 | # CONFIG_FW_LOADER is not set | 61 | # CONFIG_FW_LOADER is not set |
62 | CONFIG_MTD=y | 62 | CONFIG_MTD=y |
63 | CONFIG_MTD_PARTITIONS=y | ||
64 | CONFIG_MTD_CMDLINE_PARTS=y | 63 | CONFIG_MTD_CMDLINE_PARTS=y |
65 | CONFIG_MTD_CHAR=y | 64 | CONFIG_MTD_CHAR=y |
66 | CONFIG_MTD_BLOCK=y | 65 | CONFIG_MTD_BLOCK=y |
diff --git a/arch/avr32/configs/atngw100_mrmt_defconfig b/arch/avr32/configs/atngw100_mrmt_defconfig index 06e389cfcd12..9a57da44eb6f 100644 --- a/arch/avr32/configs/atngw100_mrmt_defconfig +++ b/arch/avr32/configs/atngw100_mrmt_defconfig | |||
@@ -48,7 +48,6 @@ CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" | |||
48 | # CONFIG_PREVENT_FIRMWARE_BUILD is not set | 48 | # CONFIG_PREVENT_FIRMWARE_BUILD is not set |
49 | # CONFIG_FW_LOADER is not set | 49 | # CONFIG_FW_LOADER is not set |
50 | CONFIG_MTD=y | 50 | CONFIG_MTD=y |
51 | CONFIG_MTD_PARTITIONS=y | ||
52 | CONFIG_MTD_CMDLINE_PARTS=y | 51 | CONFIG_MTD_CMDLINE_PARTS=y |
53 | CONFIG_MTD_CHAR=y | 52 | CONFIG_MTD_CHAR=y |
54 | CONFIG_MTD_BLOCK=y | 53 | CONFIG_MTD_BLOCK=y |
diff --git a/arch/avr32/configs/atngw100mkii_defconfig b/arch/avr32/configs/atngw100mkii_defconfig index 2518a1368d7c..97fe1b399b06 100644 --- a/arch/avr32/configs/atngw100mkii_defconfig +++ b/arch/avr32/configs/atngw100mkii_defconfig | |||
@@ -59,7 +59,6 @@ CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" | |||
59 | # CONFIG_PREVENT_FIRMWARE_BUILD is not set | 59 | # CONFIG_PREVENT_FIRMWARE_BUILD is not set |
60 | # CONFIG_FW_LOADER is not set | 60 | # CONFIG_FW_LOADER is not set |
61 | CONFIG_MTD=y | 61 | CONFIG_MTD=y |
62 | CONFIG_MTD_PARTITIONS=y | ||
63 | CONFIG_MTD_CMDLINE_PARTS=y | 62 | CONFIG_MTD_CMDLINE_PARTS=y |
64 | CONFIG_MTD_CHAR=y | 63 | CONFIG_MTD_CHAR=y |
65 | CONFIG_MTD_BLOCK=y | 64 | CONFIG_MTD_BLOCK=y |
diff --git a/arch/avr32/configs/atngw100mkii_evklcd100_defconfig b/arch/avr32/configs/atngw100mkii_evklcd100_defconfig index 245ef6bd0fa6..a176d24467e9 100644 --- a/arch/avr32/configs/atngw100mkii_evklcd100_defconfig +++ b/arch/avr32/configs/atngw100mkii_evklcd100_defconfig | |||
@@ -62,7 +62,6 @@ CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" | |||
62 | # CONFIG_PREVENT_FIRMWARE_BUILD is not set | 62 | # CONFIG_PREVENT_FIRMWARE_BUILD is not set |
63 | # CONFIG_FW_LOADER is not set | 63 | # CONFIG_FW_LOADER is not set |
64 | CONFIG_MTD=y | 64 | CONFIG_MTD=y |
65 | CONFIG_MTD_PARTITIONS=y | ||
66 | CONFIG_MTD_CMDLINE_PARTS=y | 65 | CONFIG_MTD_CMDLINE_PARTS=y |
67 | CONFIG_MTD_CHAR=y | 66 | CONFIG_MTD_CHAR=y |
68 | CONFIG_MTD_BLOCK=y | 67 | CONFIG_MTD_BLOCK=y |
diff --git a/arch/avr32/configs/atngw100mkii_evklcd101_defconfig b/arch/avr32/configs/atngw100mkii_evklcd101_defconfig index fa6cbac6e418..d1bf6dcfc47d 100644 --- a/arch/avr32/configs/atngw100mkii_evklcd101_defconfig +++ b/arch/avr32/configs/atngw100mkii_evklcd101_defconfig | |||
@@ -61,7 +61,6 @@ CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" | |||
61 | # CONFIG_PREVENT_FIRMWARE_BUILD is not set | 61 | # CONFIG_PREVENT_FIRMWARE_BUILD is not set |
62 | # CONFIG_FW_LOADER is not set | 62 | # CONFIG_FW_LOADER is not set |
63 | CONFIG_MTD=y | 63 | CONFIG_MTD=y |
64 | CONFIG_MTD_PARTITIONS=y | ||
65 | CONFIG_MTD_CMDLINE_PARTS=y | 64 | CONFIG_MTD_CMDLINE_PARTS=y |
66 | CONFIG_MTD_CHAR=y | 65 | CONFIG_MTD_CHAR=y |
67 | CONFIG_MTD_BLOCK=y | 66 | CONFIG_MTD_BLOCK=y |
diff --git a/arch/avr32/configs/atstk1002_defconfig b/arch/avr32/configs/atstk1002_defconfig index bbd5131021a5..2813dd2b9138 100644 --- a/arch/avr32/configs/atstk1002_defconfig +++ b/arch/avr32/configs/atstk1002_defconfig | |||
@@ -53,7 +53,6 @@ CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" | |||
53 | # CONFIG_PREVENT_FIRMWARE_BUILD is not set | 53 | # CONFIG_PREVENT_FIRMWARE_BUILD is not set |
54 | # CONFIG_FW_LOADER is not set | 54 | # CONFIG_FW_LOADER is not set |
55 | CONFIG_MTD=y | 55 | CONFIG_MTD=y |
56 | CONFIG_MTD_PARTITIONS=y | ||
57 | CONFIG_MTD_CMDLINE_PARTS=y | 56 | CONFIG_MTD_CMDLINE_PARTS=y |
58 | CONFIG_MTD_CHAR=y | 57 | CONFIG_MTD_CHAR=y |
59 | CONFIG_MTD_BLOCK=y | 58 | CONFIG_MTD_BLOCK=y |
diff --git a/arch/avr32/configs/atstk1003_defconfig b/arch/avr32/configs/atstk1003_defconfig index c1cd726f9012..f8ff3a3baad4 100644 --- a/arch/avr32/configs/atstk1003_defconfig +++ b/arch/avr32/configs/atstk1003_defconfig | |||
@@ -42,7 +42,6 @@ CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" | |||
42 | # CONFIG_PREVENT_FIRMWARE_BUILD is not set | 42 | # CONFIG_PREVENT_FIRMWARE_BUILD is not set |
43 | # CONFIG_FW_LOADER is not set | 43 | # CONFIG_FW_LOADER is not set |
44 | CONFIG_MTD=y | 44 | CONFIG_MTD=y |
45 | CONFIG_MTD_PARTITIONS=y | ||
46 | CONFIG_MTD_CMDLINE_PARTS=y | 45 | CONFIG_MTD_CMDLINE_PARTS=y |
47 | CONFIG_MTD_CHAR=y | 46 | CONFIG_MTD_CHAR=y |
48 | CONFIG_MTD_BLOCK=y | 47 | CONFIG_MTD_BLOCK=y |
diff --git a/arch/avr32/configs/atstk1004_defconfig b/arch/avr32/configs/atstk1004_defconfig index 754ae56b2767..992228e54e38 100644 --- a/arch/avr32/configs/atstk1004_defconfig +++ b/arch/avr32/configs/atstk1004_defconfig | |||
@@ -42,7 +42,6 @@ CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" | |||
42 | # CONFIG_PREVENT_FIRMWARE_BUILD is not set | 42 | # CONFIG_PREVENT_FIRMWARE_BUILD is not set |
43 | # CONFIG_FW_LOADER is not set | 43 | # CONFIG_FW_LOADER is not set |
44 | CONFIG_MTD=y | 44 | CONFIG_MTD=y |
45 | CONFIG_MTD_PARTITIONS=y | ||
46 | CONFIG_MTD_CMDLINE_PARTS=y | 45 | CONFIG_MTD_CMDLINE_PARTS=y |
47 | CONFIG_MTD_CHAR=y | 46 | CONFIG_MTD_CHAR=y |
48 | CONFIG_MTD_BLOCK=y | 47 | CONFIG_MTD_BLOCK=y |
diff --git a/arch/avr32/configs/atstk1006_defconfig b/arch/avr32/configs/atstk1006_defconfig index 58589d8cc0ac..b8e698b0d1fa 100644 --- a/arch/avr32/configs/atstk1006_defconfig +++ b/arch/avr32/configs/atstk1006_defconfig | |||
@@ -54,7 +54,6 @@ CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" | |||
54 | # CONFIG_PREVENT_FIRMWARE_BUILD is not set | 54 | # CONFIG_PREVENT_FIRMWARE_BUILD is not set |
55 | # CONFIG_FW_LOADER is not set | 55 | # CONFIG_FW_LOADER is not set |
56 | CONFIG_MTD=y | 56 | CONFIG_MTD=y |
57 | CONFIG_MTD_PARTITIONS=y | ||
58 | CONFIG_MTD_CMDLINE_PARTS=y | 57 | CONFIG_MTD_CMDLINE_PARTS=y |
59 | CONFIG_MTD_CHAR=y | 58 | CONFIG_MTD_CHAR=y |
60 | CONFIG_MTD_BLOCK=y | 59 | CONFIG_MTD_BLOCK=y |
diff --git a/arch/avr32/configs/favr-32_defconfig b/arch/avr32/configs/favr-32_defconfig index c90fbf6d35bc..07bed3f7eb5e 100644 --- a/arch/avr32/configs/favr-32_defconfig +++ b/arch/avr32/configs/favr-32_defconfig | |||
@@ -58,7 +58,6 @@ CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" | |||
58 | # CONFIG_PREVENT_FIRMWARE_BUILD is not set | 58 | # CONFIG_PREVENT_FIRMWARE_BUILD is not set |
59 | # CONFIG_FW_LOADER is not set | 59 | # CONFIG_FW_LOADER is not set |
60 | CONFIG_MTD=y | 60 | CONFIG_MTD=y |
61 | CONFIG_MTD_PARTITIONS=y | ||
62 | CONFIG_MTD_CMDLINE_PARTS=y | 61 | CONFIG_MTD_CMDLINE_PARTS=y |
63 | CONFIG_MTD_CHAR=y | 62 | CONFIG_MTD_CHAR=y |
64 | CONFIG_MTD_BLOCK=y | 63 | CONFIG_MTD_BLOCK=y |
diff --git a/arch/avr32/configs/hammerhead_defconfig b/arch/avr32/configs/hammerhead_defconfig index ba7c31e269cb..18db853386c8 100644 --- a/arch/avr32/configs/hammerhead_defconfig +++ b/arch/avr32/configs/hammerhead_defconfig | |||
@@ -58,7 +58,6 @@ CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" | |||
58 | # CONFIG_PREVENT_FIRMWARE_BUILD is not set | 58 | # CONFIG_PREVENT_FIRMWARE_BUILD is not set |
59 | # CONFIG_FW_LOADER is not set | 59 | # CONFIG_FW_LOADER is not set |
60 | CONFIG_MTD=y | 60 | CONFIG_MTD=y |
61 | CONFIG_MTD_PARTITIONS=y | ||
62 | CONFIG_MTD_CMDLINE_PARTS=y | 61 | CONFIG_MTD_CMDLINE_PARTS=y |
63 | CONFIG_MTD_CHAR=y | 62 | CONFIG_MTD_CHAR=y |
64 | CONFIG_MTD_BLOCK=y | 63 | CONFIG_MTD_BLOCK=y |
diff --git a/arch/avr32/configs/merisc_defconfig b/arch/avr32/configs/merisc_defconfig index 65de4431108c..91df6b2986be 100644 --- a/arch/avr32/configs/merisc_defconfig +++ b/arch/avr32/configs/merisc_defconfig | |||
@@ -46,7 +46,6 @@ CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" | |||
46 | # CONFIG_FW_LOADER is not set | 46 | # CONFIG_FW_LOADER is not set |
47 | CONFIG_MTD=y | 47 | CONFIG_MTD=y |
48 | CONFIG_MTD_CONCAT=y | 48 | CONFIG_MTD_CONCAT=y |
49 | CONFIG_MTD_PARTITIONS=y | ||
50 | CONFIG_MTD_CHAR=y | 49 | CONFIG_MTD_CHAR=y |
51 | CONFIG_MTD_BLOCK=y | 50 | CONFIG_MTD_BLOCK=y |
52 | CONFIG_MTD_CFI=y | 51 | CONFIG_MTD_CFI=y |
diff --git a/arch/avr32/configs/mimc200_defconfig b/arch/avr32/configs/mimc200_defconfig index 0a8bfdc420e0..d630e089dd32 100644 --- a/arch/avr32/configs/mimc200_defconfig +++ b/arch/avr32/configs/mimc200_defconfig | |||
@@ -49,7 +49,6 @@ CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" | |||
49 | # CONFIG_PREVENT_FIRMWARE_BUILD is not set | 49 | # CONFIG_PREVENT_FIRMWARE_BUILD is not set |
50 | # CONFIG_FW_LOADER is not set | 50 | # CONFIG_FW_LOADER is not set |
51 | CONFIG_MTD=y | 51 | CONFIG_MTD=y |
52 | CONFIG_MTD_PARTITIONS=y | ||
53 | CONFIG_MTD_CMDLINE_PARTS=y | 52 | CONFIG_MTD_CMDLINE_PARTS=y |
54 | CONFIG_MTD_CHAR=y | 53 | CONFIG_MTD_CHAR=y |
55 | CONFIG_MTD_BLOCK=y | 54 | CONFIG_MTD_BLOCK=y |
diff --git a/arch/avr32/kernel/time.c b/arch/avr32/kernel/time.c index 12f828ad5058..d0f771be9e96 100644 --- a/arch/avr32/kernel/time.c +++ b/arch/avr32/kernel/time.c | |||
@@ -59,7 +59,7 @@ static irqreturn_t timer_interrupt(int irq, void *dev_id) | |||
59 | static struct irqaction timer_irqaction = { | 59 | static struct irqaction timer_irqaction = { |
60 | .handler = timer_interrupt, | 60 | .handler = timer_interrupt, |
61 | /* Oprofile uses the same irq as the timer, so allow it to be shared */ | 61 | /* Oprofile uses the same irq as the timer, so allow it to be shared */ |
62 | .flags = IRQF_TIMER | IRQF_DISABLED | IRQF_SHARED, | 62 | .flags = IRQF_TIMER | IRQF_SHARED, |
63 | .name = "avr32_comparator", | 63 | .name = "avr32_comparator", |
64 | }; | 64 | }; |
65 | 65 | ||
diff --git a/arch/avr32/mach-at32ap/pm.c b/arch/avr32/mach-at32ap/pm.c index 32d680eb6f48..db190842b80c 100644 --- a/arch/avr32/mach-at32ap/pm.c +++ b/arch/avr32/mach-at32ap/pm.c | |||
@@ -181,7 +181,7 @@ static const struct platform_suspend_ops avr32_pm_ops = { | |||
181 | .enter = avr32_pm_enter, | 181 | .enter = avr32_pm_enter, |
182 | }; | 182 | }; |
183 | 183 | ||
184 | static unsigned long avr32_pm_offset(void *symbol) | 184 | static unsigned long __init avr32_pm_offset(void *symbol) |
185 | { | 185 | { |
186 | extern u8 pm_exception[]; | 186 | extern u8 pm_exception[]; |
187 | 187 | ||
diff --git a/arch/parisc/configs/c3000_defconfig b/arch/parisc/configs/c3000_defconfig index ec1b014952b6..acacd348df89 100644 --- a/arch/parisc/configs/c3000_defconfig +++ b/arch/parisc/configs/c3000_defconfig | |||
@@ -50,7 +50,7 @@ CONFIG_BLK_DEV_CRYPTOLOOP=m | |||
50 | CONFIG_IDE=y | 50 | CONFIG_IDE=y |
51 | CONFIG_BLK_DEV_IDECD=y | 51 | CONFIG_BLK_DEV_IDECD=y |
52 | CONFIG_BLK_DEV_NS87415=y | 52 | CONFIG_BLK_DEV_NS87415=y |
53 | CONFIG_BLK_DEV_SIIMAGE=m | 53 | CONFIG_PATA_SIL680=m |
54 | CONFIG_SCSI=y | 54 | CONFIG_SCSI=y |
55 | CONFIG_BLK_DEV_SD=y | 55 | CONFIG_BLK_DEV_SD=y |
56 | CONFIG_CHR_DEV_ST=y | 56 | CONFIG_CHR_DEV_ST=y |
diff --git a/arch/parisc/configs/c8000_defconfig b/arch/parisc/configs/c8000_defconfig index e1c8d2015c89..8249ac9d9cfc 100644 --- a/arch/parisc/configs/c8000_defconfig +++ b/arch/parisc/configs/c8000_defconfig | |||
@@ -20,7 +20,6 @@ CONFIG_MODULE_FORCE_UNLOAD=y | |||
20 | CONFIG_MODVERSIONS=y | 20 | CONFIG_MODVERSIONS=y |
21 | CONFIG_BLK_DEV_INTEGRITY=y | 21 | CONFIG_BLK_DEV_INTEGRITY=y |
22 | CONFIG_PA8X00=y | 22 | CONFIG_PA8X00=y |
23 | CONFIG_MLONGCALLS=y | ||
24 | CONFIG_64BIT=y | 23 | CONFIG_64BIT=y |
25 | CONFIG_SMP=y | 24 | CONFIG_SMP=y |
26 | CONFIG_PREEMPT=y | 25 | CONFIG_PREEMPT=y |
@@ -81,8 +80,6 @@ CONFIG_IDE=y | |||
81 | CONFIG_BLK_DEV_IDECD=y | 80 | CONFIG_BLK_DEV_IDECD=y |
82 | CONFIG_BLK_DEV_PLATFORM=y | 81 | CONFIG_BLK_DEV_PLATFORM=y |
83 | CONFIG_BLK_DEV_GENERIC=y | 82 | CONFIG_BLK_DEV_GENERIC=y |
84 | CONFIG_BLK_DEV_SIIMAGE=y | ||
85 | CONFIG_SCSI=y | ||
86 | CONFIG_BLK_DEV_SD=y | 83 | CONFIG_BLK_DEV_SD=y |
87 | CONFIG_CHR_DEV_ST=m | 84 | CONFIG_CHR_DEV_ST=m |
88 | CONFIG_BLK_DEV_SR=m | 85 | CONFIG_BLK_DEV_SR=m |
@@ -94,6 +91,8 @@ CONFIG_SCSI_FC_ATTRS=y | |||
94 | CONFIG_SCSI_SAS_LIBSAS=m | 91 | CONFIG_SCSI_SAS_LIBSAS=m |
95 | CONFIG_ISCSI_TCP=m | 92 | CONFIG_ISCSI_TCP=m |
96 | CONFIG_ISCSI_BOOT_SYSFS=m | 93 | CONFIG_ISCSI_BOOT_SYSFS=m |
94 | CONFIG_ATA=y | ||
95 | CONFIG_PATA_SIL680=y | ||
97 | CONFIG_FUSION=y | 96 | CONFIG_FUSION=y |
98 | CONFIG_FUSION_SPI=y | 97 | CONFIG_FUSION_SPI=y |
99 | CONFIG_FUSION_SAS=y | 98 | CONFIG_FUSION_SAS=y |
@@ -114,9 +113,8 @@ CONFIG_INPUT_FF_MEMLESS=m | |||
114 | # CONFIG_KEYBOARD_ATKBD is not set | 113 | # CONFIG_KEYBOARD_ATKBD is not set |
115 | # CONFIG_KEYBOARD_HIL_OLD is not set | 114 | # CONFIG_KEYBOARD_HIL_OLD is not set |
116 | # CONFIG_KEYBOARD_HIL is not set | 115 | # CONFIG_KEYBOARD_HIL is not set |
117 | CONFIG_MOUSE_PS2=m | 116 | # CONFIG_MOUSE_PS2 is not set |
118 | CONFIG_INPUT_MISC=y | 117 | CONFIG_INPUT_MISC=y |
119 | CONFIG_INPUT_CM109=m | ||
120 | CONFIG_SERIO_SERPORT=m | 118 | CONFIG_SERIO_SERPORT=m |
121 | CONFIG_SERIO_PARKBD=m | 119 | CONFIG_SERIO_PARKBD=m |
122 | CONFIG_SERIO_GSCPS2=m | 120 | CONFIG_SERIO_GSCPS2=m |
@@ -167,34 +165,6 @@ CONFIG_SND_VERBOSE_PRINTK=y | |||
167 | CONFIG_SND_AD1889=m | 165 | CONFIG_SND_AD1889=m |
168 | # CONFIG_SND_USB is not set | 166 | # CONFIG_SND_USB is not set |
169 | # CONFIG_SND_GSC is not set | 167 | # CONFIG_SND_GSC is not set |
170 | CONFIG_HID_A4TECH=m | ||
171 | CONFIG_HID_APPLE=m | ||
172 | CONFIG_HID_BELKIN=m | ||
173 | CONFIG_HID_CHERRY=m | ||
174 | CONFIG_HID_CHICONY=m | ||
175 | CONFIG_HID_CYPRESS=m | ||
176 | CONFIG_HID_DRAGONRISE=m | ||
177 | CONFIG_HID_EZKEY=m | ||
178 | CONFIG_HID_KYE=m | ||
179 | CONFIG_HID_GYRATION=m | ||
180 | CONFIG_HID_TWINHAN=m | ||
181 | CONFIG_HID_KENSINGTON=m | ||
182 | CONFIG_HID_LOGITECH=m | ||
183 | CONFIG_HID_LOGITECH_DJ=m | ||
184 | CONFIG_HID_MICROSOFT=m | ||
185 | CONFIG_HID_MONTEREY=m | ||
186 | CONFIG_HID_NTRIG=m | ||
187 | CONFIG_HID_ORTEK=m | ||
188 | CONFIG_HID_PANTHERLORD=m | ||
189 | CONFIG_HID_PETALYNX=m | ||
190 | CONFIG_HID_SAMSUNG=m | ||
191 | CONFIG_HID_SUNPLUS=m | ||
192 | CONFIG_HID_GREENASIA=m | ||
193 | CONFIG_HID_SMARTJOYPLUS=m | ||
194 | CONFIG_HID_TOPSEED=m | ||
195 | CONFIG_HID_THRUSTMASTER=m | ||
196 | CONFIG_HID_ZEROPLUS=m | ||
197 | CONFIG_USB_HID=m | ||
198 | CONFIG_USB=y | 168 | CONFIG_USB=y |
199 | CONFIG_USB_OHCI_HCD=y | 169 | CONFIG_USB_OHCI_HCD=y |
200 | CONFIG_USB_STORAGE=y | 170 | CONFIG_USB_STORAGE=y |
diff --git a/arch/parisc/configs/generic-64bit_defconfig b/arch/parisc/configs/generic-64bit_defconfig index 5874cebee077..28c1b5de044e 100644 --- a/arch/parisc/configs/generic-64bit_defconfig +++ b/arch/parisc/configs/generic-64bit_defconfig | |||
@@ -24,7 +24,6 @@ CONFIG_MODVERSIONS=y | |||
24 | CONFIG_BLK_DEV_INTEGRITY=y | 24 | CONFIG_BLK_DEV_INTEGRITY=y |
25 | # CONFIG_IOSCHED_DEADLINE is not set | 25 | # CONFIG_IOSCHED_DEADLINE is not set |
26 | CONFIG_PA8X00=y | 26 | CONFIG_PA8X00=y |
27 | CONFIG_MLONGCALLS=y | ||
28 | CONFIG_64BIT=y | 27 | CONFIG_64BIT=y |
29 | CONFIG_SMP=y | 28 | CONFIG_SMP=y |
30 | # CONFIG_COMPACTION is not set | 29 | # CONFIG_COMPACTION is not set |
@@ -68,7 +67,6 @@ CONFIG_IDE_GD=m | |||
68 | CONFIG_IDE_GD_ATAPI=y | 67 | CONFIG_IDE_GD_ATAPI=y |
69 | CONFIG_BLK_DEV_IDECD=m | 68 | CONFIG_BLK_DEV_IDECD=m |
70 | CONFIG_BLK_DEV_NS87415=y | 69 | CONFIG_BLK_DEV_NS87415=y |
71 | CONFIG_BLK_DEV_SIIMAGE=y | ||
72 | # CONFIG_SCSI_PROC_FS is not set | 70 | # CONFIG_SCSI_PROC_FS is not set |
73 | CONFIG_BLK_DEV_SD=y | 71 | CONFIG_BLK_DEV_SD=y |
74 | CONFIG_BLK_DEV_SR=y | 72 | CONFIG_BLK_DEV_SR=y |
@@ -82,6 +80,7 @@ CONFIG_SCSI_ZALON=y | |||
82 | CONFIG_SCSI_QLA_ISCSI=m | 80 | CONFIG_SCSI_QLA_ISCSI=m |
83 | CONFIG_SCSI_DH=y | 81 | CONFIG_SCSI_DH=y |
84 | CONFIG_ATA=y | 82 | CONFIG_ATA=y |
83 | CONFIG_PATA_SIL680=y | ||
85 | CONFIG_ATA_GENERIC=y | 84 | CONFIG_ATA_GENERIC=y |
86 | CONFIG_MD=y | 85 | CONFIG_MD=y |
87 | CONFIG_MD_LINEAR=m | 86 | CONFIG_MD_LINEAR=m |
@@ -162,7 +161,7 @@ CONFIG_SLIP_MODE_SLIP6=y | |||
162 | CONFIG_INPUT_EVDEV=y | 161 | CONFIG_INPUT_EVDEV=y |
163 | # CONFIG_KEYBOARD_HIL_OLD is not set | 162 | # CONFIG_KEYBOARD_HIL_OLD is not set |
164 | # CONFIG_KEYBOARD_HIL is not set | 163 | # CONFIG_KEYBOARD_HIL is not set |
165 | # CONFIG_INPUT_MOUSE is not set | 164 | # CONFIG_MOUSE_PS2 is not set |
166 | CONFIG_INPUT_MISC=y | 165 | CONFIG_INPUT_MISC=y |
167 | CONFIG_SERIO_SERPORT=m | 166 | CONFIG_SERIO_SERPORT=m |
168 | # CONFIG_HP_SDC is not set | 167 | # CONFIG_HP_SDC is not set |
@@ -216,32 +215,7 @@ CONFIG_BACKLIGHT_LCD_SUPPORT=y | |||
216 | CONFIG_FRAMEBUFFER_CONSOLE_ROTATION=y | 215 | CONFIG_FRAMEBUFFER_CONSOLE_ROTATION=y |
217 | CONFIG_LOGO=y | 216 | CONFIG_LOGO=y |
218 | # CONFIG_LOGO_LINUX_MONO is not set | 217 | # CONFIG_LOGO_LINUX_MONO is not set |
219 | CONFIG_HID=m | ||
220 | CONFIG_HIDRAW=y | 218 | CONFIG_HIDRAW=y |
221 | CONFIG_HID_DRAGONRISE=m | ||
222 | CONFIG_DRAGONRISE_FF=y | ||
223 | CONFIG_HID_KYE=m | ||
224 | CONFIG_HID_GYRATION=m | ||
225 | CONFIG_HID_TWINHAN=m | ||
226 | CONFIG_LOGITECH_FF=y | ||
227 | CONFIG_LOGIRUMBLEPAD2_FF=y | ||
228 | CONFIG_HID_NTRIG=m | ||
229 | CONFIG_HID_PANTHERLORD=m | ||
230 | CONFIG_PANTHERLORD_FF=y | ||
231 | CONFIG_HID_PETALYNX=m | ||
232 | CONFIG_HID_SAMSUNG=m | ||
233 | CONFIG_HID_SONY=m | ||
234 | CONFIG_HID_SUNPLUS=m | ||
235 | CONFIG_HID_GREENASIA=m | ||
236 | CONFIG_GREENASIA_FF=y | ||
237 | CONFIG_HID_SMARTJOYPLUS=m | ||
238 | CONFIG_SMARTJOYPLUS_FF=y | ||
239 | CONFIG_HID_TOPSEED=m | ||
240 | CONFIG_HID_THRUSTMASTER=m | ||
241 | CONFIG_THRUSTMASTER_FF=y | ||
242 | CONFIG_HID_ZEROPLUS=m | ||
243 | CONFIG_ZEROPLUS_FF=y | ||
244 | CONFIG_USB_HID=m | ||
245 | CONFIG_HID_PID=y | 219 | CONFIG_HID_PID=y |
246 | CONFIG_USB_HIDDEV=y | 220 | CONFIG_USB_HIDDEV=y |
247 | CONFIG_USB=y | 221 | CONFIG_USB=y |
@@ -251,13 +225,8 @@ CONFIG_USB_DYNAMIC_MINORS=y | |||
251 | CONFIG_USB_MON=m | 225 | CONFIG_USB_MON=m |
252 | CONFIG_USB_WUSB_CBAF=m | 226 | CONFIG_USB_WUSB_CBAF=m |
253 | CONFIG_USB_XHCI_HCD=m | 227 | CONFIG_USB_XHCI_HCD=m |
254 | CONFIG_USB_EHCI_HCD=m | 228 | CONFIG_USB_EHCI_HCD=y |
255 | CONFIG_USB_OHCI_HCD=m | 229 | CONFIG_USB_OHCI_HCD=y |
256 | CONFIG_USB_R8A66597_HCD=m | ||
257 | CONFIG_USB_ACM=m | ||
258 | CONFIG_USB_PRINTER=m | ||
259 | CONFIG_USB_WDM=m | ||
260 | CONFIG_USB_TMC=m | ||
261 | CONFIG_NEW_LEDS=y | 230 | CONFIG_NEW_LEDS=y |
262 | CONFIG_LEDS_CLASS=y | 231 | CONFIG_LEDS_CLASS=y |
263 | CONFIG_LEDS_TRIGGERS=y | 232 | CONFIG_LEDS_TRIGGERS=y |
diff --git a/arch/parisc/include/asm/serial.h b/arch/parisc/include/asm/serial.h index d7e3cc60dbc3..77e9b67c87ee 100644 --- a/arch/parisc/include/asm/serial.h +++ b/arch/parisc/include/asm/serial.h | |||
@@ -6,5 +6,3 @@ | |||
6 | * This is used for 16550-compatible UARTs | 6 | * This is used for 16550-compatible UARTs |
7 | */ | 7 | */ |
8 | #define BASE_BAUD ( 1843200 / 16 ) | 8 | #define BASE_BAUD ( 1843200 / 16 ) |
9 | |||
10 | #define SERIAL_PORT_DFNS | ||
diff --git a/arch/parisc/kernel/hardware.c b/arch/parisc/kernel/hardware.c index 06cb3992907e..608716f8496b 100644 --- a/arch/parisc/kernel/hardware.c +++ b/arch/parisc/kernel/hardware.c | |||
@@ -36,6 +36,9 @@ | |||
36 | * HP PARISC Hardware Database | 36 | * HP PARISC Hardware Database |
37 | * Access to this database is only possible during bootup | 37 | * Access to this database is only possible during bootup |
38 | * so don't reference this table after starting the init process | 38 | * so don't reference this table after starting the init process |
39 | * | ||
40 | * NOTE: Product names which are listed here and ends with a '?' | ||
41 | * are guessed. If you know the correct name, please let us know. | ||
39 | */ | 42 | */ |
40 | 43 | ||
41 | static struct hp_hardware hp_hardware_list[] = { | 44 | static struct hp_hardware hp_hardware_list[] = { |
@@ -222,7 +225,7 @@ static struct hp_hardware hp_hardware_list[] = { | |||
222 | {HPHW_NPROC,0x5DD,0x4,0x81,"Duet W2"}, | 225 | {HPHW_NPROC,0x5DD,0x4,0x81,"Duet W2"}, |
223 | {HPHW_NPROC,0x5DE,0x4,0x81,"Piccolo W+"}, | 226 | {HPHW_NPROC,0x5DE,0x4,0x81,"Piccolo W+"}, |
224 | {HPHW_NPROC,0x5DF,0x4,0x81,"Cantata W2"}, | 227 | {HPHW_NPROC,0x5DF,0x4,0x81,"Cantata W2"}, |
225 | {HPHW_NPROC,0x5DF,0x0,0x00,"Marcato W+? (rp5470)"}, | 228 | {HPHW_NPROC,0x5DF,0x0,0x00,"Marcato W+ (rp5470)?"}, |
226 | {HPHW_NPROC,0x5E0,0x4,0x91,"Cantata DC- W2"}, | 229 | {HPHW_NPROC,0x5E0,0x4,0x91,"Cantata DC- W2"}, |
227 | {HPHW_NPROC,0x5E1,0x4,0x91,"Crescendo DC- W2"}, | 230 | {HPHW_NPROC,0x5E1,0x4,0x91,"Crescendo DC- W2"}, |
228 | {HPHW_NPROC,0x5E2,0x4,0x91,"Crescendo 650 W2"}, | 231 | {HPHW_NPROC,0x5E2,0x4,0x91,"Crescendo 650 W2"}, |
@@ -276,9 +279,11 @@ static struct hp_hardware hp_hardware_list[] = { | |||
276 | {HPHW_NPROC,0x888,0x4,0x91,"Storm Peak Fast DC-"}, | 279 | {HPHW_NPROC,0x888,0x4,0x91,"Storm Peak Fast DC-"}, |
277 | {HPHW_NPROC,0x889,0x4,0x91,"Storm Peak Fast"}, | 280 | {HPHW_NPROC,0x889,0x4,0x91,"Storm Peak Fast"}, |
278 | {HPHW_NPROC,0x88A,0x4,0x91,"Crestone Peak Slow"}, | 281 | {HPHW_NPROC,0x88A,0x4,0x91,"Crestone Peak Slow"}, |
282 | {HPHW_NPROC,0x88B,0x4,0x91,"Crestone Peak Fast?"}, | ||
279 | {HPHW_NPROC,0x88C,0x4,0x91,"Orca Mako+"}, | 283 | {HPHW_NPROC,0x88C,0x4,0x91,"Orca Mako+"}, |
280 | {HPHW_NPROC,0x88D,0x4,0x91,"Rainier/Medel Mako+ Slow"}, | 284 | {HPHW_NPROC,0x88D,0x4,0x91,"Rainier/Medel Mako+ Slow"}, |
281 | {HPHW_NPROC,0x88E,0x4,0x91,"Rainier/Medel Mako+ Fast"}, | 285 | {HPHW_NPROC,0x88E,0x4,0x91,"Rainier/Medel Mako+ Fast"}, |
286 | {HPHW_NPROC,0x892,0x4,0x91,"Mt. Hamilton Slow Mako+?"}, | ||
282 | {HPHW_NPROC,0x894,0x4,0x91,"Mt. Hamilton Fast Mako+"}, | 287 | {HPHW_NPROC,0x894,0x4,0x91,"Mt. Hamilton Fast Mako+"}, |
283 | {HPHW_NPROC,0x895,0x4,0x91,"Storm Peak Slow Mako+"}, | 288 | {HPHW_NPROC,0x895,0x4,0x91,"Storm Peak Slow Mako+"}, |
284 | {HPHW_NPROC,0x896,0x4,0x91,"Storm Peak Fast Mako+"}, | 289 | {HPHW_NPROC,0x896,0x4,0x91,"Storm Peak Fast Mako+"}, |
diff --git a/arch/parisc/kernel/head.S b/arch/parisc/kernel/head.S index d2d58258aea6..d4dc588c0dc1 100644 --- a/arch/parisc/kernel/head.S +++ b/arch/parisc/kernel/head.S | |||
@@ -41,9 +41,7 @@ END(boot_args) | |||
41 | .import fault_vector_11,code /* IVA parisc 1.1 32 bit */ | 41 | .import fault_vector_11,code /* IVA parisc 1.1 32 bit */ |
42 | .import $global$ /* forward declaration */ | 42 | .import $global$ /* forward declaration */ |
43 | #endif /*!CONFIG_64BIT*/ | 43 | #endif /*!CONFIG_64BIT*/ |
44 | .export _stext,data /* Kernel want it this way! */ | 44 | ENTRY(parisc_kernel_start) |
45 | _stext: | ||
46 | ENTRY(stext) | ||
47 | .proc | 45 | .proc |
48 | .callinfo | 46 | .callinfo |
49 | 47 | ||
@@ -347,7 +345,7 @@ smp_slave_stext: | |||
347 | .procend | 345 | .procend |
348 | #endif /* CONFIG_SMP */ | 346 | #endif /* CONFIG_SMP */ |
349 | 347 | ||
350 | ENDPROC(stext) | 348 | ENDPROC(parisc_kernel_start) |
351 | 349 | ||
352 | #ifndef CONFIG_64BIT | 350 | #ifndef CONFIG_64BIT |
353 | .section .data..read_mostly | 351 | .section .data..read_mostly |
diff --git a/arch/parisc/kernel/sys_parisc.c b/arch/parisc/kernel/sys_parisc.c index 5dfd248e3f1a..0d3a9d4927b5 100644 --- a/arch/parisc/kernel/sys_parisc.c +++ b/arch/parisc/kernel/sys_parisc.c | |||
@@ -61,8 +61,15 @@ static int get_offset(struct address_space *mapping) | |||
61 | return (unsigned long) mapping >> 8; | 61 | return (unsigned long) mapping >> 8; |
62 | } | 62 | } |
63 | 63 | ||
64 | static unsigned long get_shared_area(struct address_space *mapping, | 64 | static unsigned long shared_align_offset(struct file *filp, unsigned long pgoff) |
65 | unsigned long addr, unsigned long len, unsigned long pgoff) | 65 | { |
66 | struct address_space *mapping = filp ? filp->f_mapping : NULL; | ||
67 | |||
68 | return (get_offset(mapping) + pgoff) << PAGE_SHIFT; | ||
69 | } | ||
70 | |||
71 | static unsigned long get_shared_area(struct file *filp, unsigned long addr, | ||
72 | unsigned long len, unsigned long pgoff) | ||
66 | { | 73 | { |
67 | struct vm_unmapped_area_info info; | 74 | struct vm_unmapped_area_info info; |
68 | 75 | ||
@@ -71,7 +78,7 @@ static unsigned long get_shared_area(struct address_space *mapping, | |||
71 | info.low_limit = PAGE_ALIGN(addr); | 78 | info.low_limit = PAGE_ALIGN(addr); |
72 | info.high_limit = TASK_SIZE; | 79 | info.high_limit = TASK_SIZE; |
73 | info.align_mask = PAGE_MASK & (SHMLBA - 1); | 80 | info.align_mask = PAGE_MASK & (SHMLBA - 1); |
74 | info.align_offset = (get_offset(mapping) + pgoff) << PAGE_SHIFT; | 81 | info.align_offset = shared_align_offset(filp, pgoff); |
75 | return vm_unmapped_area(&info); | 82 | return vm_unmapped_area(&info); |
76 | } | 83 | } |
77 | 84 | ||
@@ -82,20 +89,18 @@ unsigned long arch_get_unmapped_area(struct file *filp, unsigned long addr, | |||
82 | return -ENOMEM; | 89 | return -ENOMEM; |
83 | if (flags & MAP_FIXED) { | 90 | if (flags & MAP_FIXED) { |
84 | if ((flags & MAP_SHARED) && | 91 | if ((flags & MAP_SHARED) && |
85 | (addr - (pgoff << PAGE_SHIFT)) & (SHMLBA - 1)) | 92 | (addr - shared_align_offset(filp, pgoff)) & (SHMLBA - 1)) |
86 | return -EINVAL; | 93 | return -EINVAL; |
87 | return addr; | 94 | return addr; |
88 | } | 95 | } |
89 | if (!addr) | 96 | if (!addr) |
90 | addr = TASK_UNMAPPED_BASE; | 97 | addr = TASK_UNMAPPED_BASE; |
91 | 98 | ||
92 | if (filp) { | 99 | if (filp || (flags & MAP_SHARED)) |
93 | addr = get_shared_area(filp->f_mapping, addr, len, pgoff); | 100 | addr = get_shared_area(filp, addr, len, pgoff); |
94 | } else if(flags & MAP_SHARED) { | 101 | else |
95 | addr = get_shared_area(NULL, addr, len, pgoff); | ||
96 | } else { | ||
97 | addr = get_unshared_area(addr, len); | 102 | addr = get_unshared_area(addr, len); |
98 | } | 103 | |
99 | return addr; | 104 | return addr; |
100 | } | 105 | } |
101 | 106 | ||
diff --git a/arch/parisc/kernel/unwind.c b/arch/parisc/kernel/unwind.c index 76ed62ed785b..ddd988b267a9 100644 --- a/arch/parisc/kernel/unwind.c +++ b/arch/parisc/kernel/unwind.c | |||
@@ -168,7 +168,7 @@ void unwind_table_remove(struct unwind_table *table) | |||
168 | } | 168 | } |
169 | 169 | ||
170 | /* Called from setup_arch to import the kernel unwind info */ | 170 | /* Called from setup_arch to import the kernel unwind info */ |
171 | int unwind_init(void) | 171 | int __init unwind_init(void) |
172 | { | 172 | { |
173 | long start, stop; | 173 | long start, stop; |
174 | register unsigned long gp __asm__ ("r27"); | 174 | register unsigned long gp __asm__ ("r27"); |
@@ -233,7 +233,6 @@ static void unwind_frame_regs(struct unwind_frame_info *info) | |||
233 | e = find_unwind_entry(info->ip); | 233 | e = find_unwind_entry(info->ip); |
234 | if (e == NULL) { | 234 | if (e == NULL) { |
235 | unsigned long sp; | 235 | unsigned long sp; |
236 | extern char _stext[], _etext[]; | ||
237 | 236 | ||
238 | dbg("Cannot find unwind entry for 0x%lx; forced unwinding\n", info->ip); | 237 | dbg("Cannot find unwind entry for 0x%lx; forced unwinding\n", info->ip); |
239 | 238 | ||
@@ -281,8 +280,7 @@ static void unwind_frame_regs(struct unwind_frame_info *info) | |||
281 | break; | 280 | break; |
282 | info->prev_ip = tmp; | 281 | info->prev_ip = tmp; |
283 | sp = info->prev_sp; | 282 | sp = info->prev_sp; |
284 | } while (info->prev_ip < (unsigned long)_stext || | 283 | } while (!kernel_text_address(info->prev_ip)); |
285 | info->prev_ip > (unsigned long)_etext); | ||
286 | 284 | ||
287 | info->rp = 0; | 285 | info->rp = 0; |
288 | 286 | ||
@@ -435,9 +433,8 @@ unsigned long return_address(unsigned int level) | |||
435 | do { | 433 | do { |
436 | if (unwind_once(&info) < 0 || info.ip == 0) | 434 | if (unwind_once(&info) < 0 || info.ip == 0) |
437 | return 0; | 435 | return 0; |
438 | if (!__kernel_text_address(info.ip)) { | 436 | if (!kernel_text_address(info.ip)) |
439 | return 0; | 437 | return 0; |
440 | } | ||
441 | } while (info.ip && level--); | 438 | } while (info.ip && level--); |
442 | 439 | ||
443 | return info.ip; | 440 | return info.ip; |
diff --git a/arch/parisc/kernel/vmlinux.lds.S b/arch/parisc/kernel/vmlinux.lds.S index 4bb095a2f6fc..0dacc5ca555a 100644 --- a/arch/parisc/kernel/vmlinux.lds.S +++ b/arch/parisc/kernel/vmlinux.lds.S | |||
@@ -6,24 +6,19 @@ | |||
6 | * Copyright (C) 2000 Michael Ang <mang with subcarrier.org> | 6 | * Copyright (C) 2000 Michael Ang <mang with subcarrier.org> |
7 | * Copyright (C) 2002 Randolph Chung <tausq with parisc-linux.org> | 7 | * Copyright (C) 2002 Randolph Chung <tausq with parisc-linux.org> |
8 | * Copyright (C) 2003 James Bottomley <jejb with parisc-linux.org> | 8 | * Copyright (C) 2003 James Bottomley <jejb with parisc-linux.org> |
9 | * Copyright (C) 2006 Helge Deller <deller@gmx.de> | 9 | * Copyright (C) 2006-2013 Helge Deller <deller@gmx.de> |
10 | * | 10 | */ |
11 | * | 11 | |
12 | * This program is free software; you can redistribute it and/or modify | 12 | /* |
13 | * it under the terms of the GNU General Public License as published by | 13 | * Put page table entries (swapper_pg_dir) as the first thing in .bss. This |
14 | * the Free Software Foundation; either version 2 of the License, or | 14 | * will ensure that it has .bss alignment (PAGE_SIZE). |
15 | * (at your option) any later version. | ||
16 | * | ||
17 | * This program is distributed in the hope that it will be useful, | ||
18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
20 | * GNU General Public License for more details. | ||
21 | * | ||
22 | * You should have received a copy of the GNU General Public License | ||
23 | * along with this program; if not, write to the Free Software | ||
24 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
25 | */ | 15 | */ |
16 | #define BSS_FIRST_SECTIONS *(.data..vm0.pmd) \ | ||
17 | *(.data..vm0.pgd) \ | ||
18 | *(.data..vm0.pte) | ||
19 | |||
26 | #include <asm-generic/vmlinux.lds.h> | 20 | #include <asm-generic/vmlinux.lds.h> |
21 | |||
27 | /* needed for the processor specific cache alignment size */ | 22 | /* needed for the processor specific cache alignment size */ |
28 | #include <asm/cache.h> | 23 | #include <asm/cache.h> |
29 | #include <asm/page.h> | 24 | #include <asm/page.h> |
@@ -39,7 +34,7 @@ OUTPUT_FORMAT("elf64-hppa-linux") | |||
39 | OUTPUT_ARCH(hppa:hppa2.0w) | 34 | OUTPUT_ARCH(hppa:hppa2.0w) |
40 | #endif | 35 | #endif |
41 | 36 | ||
42 | ENTRY(_stext) | 37 | ENTRY(parisc_kernel_start) |
43 | #ifndef CONFIG_64BIT | 38 | #ifndef CONFIG_64BIT |
44 | jiffies = jiffies_64 + 4; | 39 | jiffies = jiffies_64 + 4; |
45 | #else | 40 | #else |
@@ -49,11 +44,29 @@ SECTIONS | |||
49 | { | 44 | { |
50 | . = KERNEL_BINARY_TEXT_START; | 45 | . = KERNEL_BINARY_TEXT_START; |
51 | 46 | ||
47 | __init_begin = .; | ||
48 | HEAD_TEXT_SECTION | ||
49 | INIT_TEXT_SECTION(8) | ||
50 | |||
51 | . = ALIGN(PAGE_SIZE); | ||
52 | INIT_DATA_SECTION(PAGE_SIZE) | ||
53 | /* we have to discard exit text and such at runtime, not link time */ | ||
54 | .exit.text : | ||
55 | { | ||
56 | EXIT_TEXT | ||
57 | } | ||
58 | .exit.data : | ||
59 | { | ||
60 | EXIT_DATA | ||
61 | } | ||
62 | PERCPU_SECTION(8) | ||
63 | . = ALIGN(PAGE_SIZE); | ||
64 | __init_end = .; | ||
65 | /* freed after init ends here */ | ||
66 | |||
52 | _text = .; /* Text and read-only data */ | 67 | _text = .; /* Text and read-only data */ |
53 | .head ALIGN(16) : { | 68 | _stext = .; |
54 | HEAD_TEXT | 69 | .text ALIGN(PAGE_SIZE) : { |
55 | } = 0 | ||
56 | .text ALIGN(16) : { | ||
57 | TEXT_TEXT | 70 | TEXT_TEXT |
58 | SCHED_TEXT | 71 | SCHED_TEXT |
59 | LOCK_TEXT | 72 | LOCK_TEXT |
@@ -68,21 +81,28 @@ SECTIONS | |||
68 | *(.lock.text) /* out-of-line lock text */ | 81 | *(.lock.text) /* out-of-line lock text */ |
69 | *(.gnu.warning) | 82 | *(.gnu.warning) |
70 | } | 83 | } |
71 | /* End of text section */ | 84 | . = ALIGN(PAGE_SIZE); |
72 | _etext = .; | 85 | _etext = .; |
86 | /* End of text section */ | ||
73 | 87 | ||
74 | /* Start of data section */ | 88 | /* Start of data section */ |
75 | _sdata = .; | 89 | _sdata = .; |
76 | 90 | ||
77 | RODATA | 91 | RO_DATA_SECTION(8) |
78 | 92 | ||
79 | /* writeable */ | 93 | #ifdef CONFIG_64BIT |
80 | /* Make sure this is page aligned so | 94 | . = ALIGN(16); |
81 | * that we can properly leave these | 95 | /* Linkage tables */ |
82 | * as writable | 96 | .opd : { |
83 | */ | 97 | *(.opd) |
84 | . = ALIGN(PAGE_SIZE); | 98 | } PROVIDE (__gp = .); |
85 | data_start = .; | 99 | .plt : { |
100 | *(.plt) | ||
101 | } | ||
102 | .dlt : { | ||
103 | *(.dlt) | ||
104 | } | ||
105 | #endif | ||
86 | 106 | ||
87 | /* unwind info */ | 107 | /* unwind info */ |
88 | .PARISC.unwind : { | 108 | .PARISC.unwind : { |
@@ -91,7 +111,15 @@ SECTIONS | |||
91 | __stop___unwind = .; | 111 | __stop___unwind = .; |
92 | } | 112 | } |
93 | 113 | ||
94 | EXCEPTION_TABLE(16) | 114 | /* writeable */ |
115 | /* Make sure this is page aligned so | ||
116 | * that we can properly leave these | ||
117 | * as writable | ||
118 | */ | ||
119 | . = ALIGN(PAGE_SIZE); | ||
120 | data_start = .; | ||
121 | |||
122 | EXCEPTION_TABLE(8) | ||
95 | NOTES | 123 | NOTES |
96 | 124 | ||
97 | /* Data */ | 125 | /* Data */ |
@@ -107,54 +135,8 @@ SECTIONS | |||
107 | _edata = .; | 135 | _edata = .; |
108 | 136 | ||
109 | /* BSS */ | 137 | /* BSS */ |
110 | __bss_start = .; | 138 | BSS_SECTION(PAGE_SIZE, PAGE_SIZE, 8) |
111 | /* page table entries need to be PAGE_SIZE aligned */ | ||
112 | . = ALIGN(PAGE_SIZE); | ||
113 | .data..vmpages : { | ||
114 | *(.data..vm0.pmd) | ||
115 | *(.data..vm0.pgd) | ||
116 | *(.data..vm0.pte) | ||
117 | } | ||
118 | .bss : { | ||
119 | *(.bss) | ||
120 | *(COMMON) | ||
121 | } | ||
122 | __bss_stop = .; | ||
123 | |||
124 | #ifdef CONFIG_64BIT | ||
125 | . = ALIGN(16); | ||
126 | /* Linkage tables */ | ||
127 | .opd : { | ||
128 | *(.opd) | ||
129 | } PROVIDE (__gp = .); | ||
130 | .plt : { | ||
131 | *(.plt) | ||
132 | } | ||
133 | .dlt : { | ||
134 | *(.dlt) | ||
135 | } | ||
136 | #endif | ||
137 | 139 | ||
138 | /* reserve space for interrupt stack by aligning __init* to 16k */ | ||
139 | . = ALIGN(16384); | ||
140 | __init_begin = .; | ||
141 | INIT_TEXT_SECTION(16384) | ||
142 | . = ALIGN(PAGE_SIZE); | ||
143 | INIT_DATA_SECTION(16) | ||
144 | /* we have to discard exit text and such at runtime, not link time */ | ||
145 | .exit.text : | ||
146 | { | ||
147 | EXIT_TEXT | ||
148 | } | ||
149 | .exit.data : | ||
150 | { | ||
151 | EXIT_DATA | ||
152 | } | ||
153 | |||
154 | PERCPU_SECTION(L1_CACHE_BYTES) | ||
155 | . = ALIGN(PAGE_SIZE); | ||
156 | __init_end = .; | ||
157 | /* freed after init ends here */ | ||
158 | _end = . ; | 140 | _end = . ; |
159 | 141 | ||
160 | STABS_DEBUG | 142 | STABS_DEBUG |
diff --git a/arch/parisc/mm/init.c b/arch/parisc/mm/init.c index b0f96c0e6316..96f8168cf4ec 100644 --- a/arch/parisc/mm/init.c +++ b/arch/parisc/mm/init.c | |||
@@ -32,6 +32,7 @@ | |||
32 | #include <asm/sections.h> | 32 | #include <asm/sections.h> |
33 | 33 | ||
34 | extern int data_start; | 34 | extern int data_start; |
35 | extern void parisc_kernel_start(void); /* Kernel entry point in head.S */ | ||
35 | 36 | ||
36 | #if PT_NLEVELS == 3 | 37 | #if PT_NLEVELS == 3 |
37 | /* NOTE: This layout exactly conforms to the hybrid L2/L3 page table layout | 38 | /* NOTE: This layout exactly conforms to the hybrid L2/L3 page table layout |
@@ -324,8 +325,9 @@ static void __init setup_bootmem(void) | |||
324 | reserve_bootmem_node(NODE_DATA(0), 0UL, | 325 | reserve_bootmem_node(NODE_DATA(0), 0UL, |
325 | (unsigned long)(PAGE0->mem_free + | 326 | (unsigned long)(PAGE0->mem_free + |
326 | PDC_CONSOLE_IO_IODC_SIZE), BOOTMEM_DEFAULT); | 327 | PDC_CONSOLE_IO_IODC_SIZE), BOOTMEM_DEFAULT); |
327 | reserve_bootmem_node(NODE_DATA(0), __pa((unsigned long)_text), | 328 | reserve_bootmem_node(NODE_DATA(0), __pa(KERNEL_BINARY_TEXT_START), |
328 | (unsigned long)(_end - _text), BOOTMEM_DEFAULT); | 329 | (unsigned long)(_end - KERNEL_BINARY_TEXT_START), |
330 | BOOTMEM_DEFAULT); | ||
329 | reserve_bootmem_node(NODE_DATA(0), (bootmap_start_pfn << PAGE_SHIFT), | 331 | reserve_bootmem_node(NODE_DATA(0), (bootmap_start_pfn << PAGE_SHIFT), |
330 | ((bootmap_pfn - bootmap_start_pfn) << PAGE_SHIFT), | 332 | ((bootmap_pfn - bootmap_start_pfn) << PAGE_SHIFT), |
331 | BOOTMEM_DEFAULT); | 333 | BOOTMEM_DEFAULT); |
@@ -378,6 +380,17 @@ static void __init setup_bootmem(void) | |||
378 | request_resource(&sysram_resources[0], &pdcdata_resource); | 380 | request_resource(&sysram_resources[0], &pdcdata_resource); |
379 | } | 381 | } |
380 | 382 | ||
383 | static int __init parisc_text_address(unsigned long vaddr) | ||
384 | { | ||
385 | static unsigned long head_ptr __initdata; | ||
386 | |||
387 | if (!head_ptr) | ||
388 | head_ptr = PAGE_MASK & (unsigned long) | ||
389 | dereference_function_descriptor(&parisc_kernel_start); | ||
390 | |||
391 | return core_kernel_text(vaddr) || vaddr == head_ptr; | ||
392 | } | ||
393 | |||
381 | static void __init map_pages(unsigned long start_vaddr, | 394 | static void __init map_pages(unsigned long start_vaddr, |
382 | unsigned long start_paddr, unsigned long size, | 395 | unsigned long start_paddr, unsigned long size, |
383 | pgprot_t pgprot, int force) | 396 | pgprot_t pgprot, int force) |
@@ -466,7 +479,7 @@ static void __init map_pages(unsigned long start_vaddr, | |||
466 | */ | 479 | */ |
467 | if (force) | 480 | if (force) |
468 | pte = __mk_pte(address, pgprot); | 481 | pte = __mk_pte(address, pgprot); |
469 | else if (core_kernel_text(vaddr) && | 482 | else if (parisc_text_address(vaddr) && |
470 | address != fv_addr) | 483 | address != fv_addr) |
471 | pte = __mk_pte(address, PAGE_KERNEL_EXEC); | 484 | pte = __mk_pte(address, PAGE_KERNEL_EXEC); |
472 | else | 485 | else |
diff --git a/arch/powerpc/boot/dts/mpc5121.dtsi b/arch/powerpc/boot/dts/mpc5121.dtsi index bd14c00e5146..2d7cb04ac962 100644 --- a/arch/powerpc/boot/dts/mpc5121.dtsi +++ b/arch/powerpc/boot/dts/mpc5121.dtsi | |||
@@ -77,7 +77,6 @@ | |||
77 | compatible = "fsl,mpc5121-immr"; | 77 | compatible = "fsl,mpc5121-immr"; |
78 | #address-cells = <1>; | 78 | #address-cells = <1>; |
79 | #size-cells = <1>; | 79 | #size-cells = <1>; |
80 | #interrupt-cells = <2>; | ||
81 | ranges = <0x0 0x80000000 0x400000>; | 80 | ranges = <0x0 0x80000000 0x400000>; |
82 | reg = <0x80000000 0x400000>; | 81 | reg = <0x80000000 0x400000>; |
83 | bus-frequency = <66000000>; /* 66 MHz ips bus */ | 82 | bus-frequency = <66000000>; /* 66 MHz ips bus */ |
diff --git a/arch/powerpc/configs/52xx/cm5200_defconfig b/arch/powerpc/configs/52xx/cm5200_defconfig index 69b57daf402e..0b88c7b30bb9 100644 --- a/arch/powerpc/configs/52xx/cm5200_defconfig +++ b/arch/powerpc/configs/52xx/cm5200_defconfig | |||
@@ -12,7 +12,6 @@ CONFIG_EXPERT=y | |||
12 | CONFIG_PPC_MPC52xx=y | 12 | CONFIG_PPC_MPC52xx=y |
13 | CONFIG_PPC_MPC5200_SIMPLE=y | 13 | CONFIG_PPC_MPC5200_SIMPLE=y |
14 | # CONFIG_PPC_PMAC is not set | 14 | # CONFIG_PPC_PMAC is not set |
15 | CONFIG_PPC_BESTCOMM=y | ||
16 | CONFIG_SPARSE_IRQ=y | 15 | CONFIG_SPARSE_IRQ=y |
17 | CONFIG_PM=y | 16 | CONFIG_PM=y |
18 | # CONFIG_PCI is not set | 17 | # CONFIG_PCI is not set |
@@ -71,6 +70,8 @@ CONFIG_USB_DEVICEFS=y | |||
71 | CONFIG_USB_OHCI_HCD=y | 70 | CONFIG_USB_OHCI_HCD=y |
72 | CONFIG_USB_OHCI_HCD_PPC_OF_BE=y | 71 | CONFIG_USB_OHCI_HCD_PPC_OF_BE=y |
73 | CONFIG_USB_STORAGE=y | 72 | CONFIG_USB_STORAGE=y |
73 | CONFIG_DMADEVICES=y | ||
74 | CONFIG_PPC_BESTCOMM=y | ||
74 | CONFIG_EXT2_FS=y | 75 | CONFIG_EXT2_FS=y |
75 | CONFIG_EXT3_FS=y | 76 | CONFIG_EXT3_FS=y |
76 | # CONFIG_EXT3_DEFAULTS_TO_ORDERED is not set | 77 | # CONFIG_EXT3_DEFAULTS_TO_ORDERED is not set |
diff --git a/arch/powerpc/configs/52xx/lite5200b_defconfig b/arch/powerpc/configs/52xx/lite5200b_defconfig index f3638ae0a627..104a332e79ab 100644 --- a/arch/powerpc/configs/52xx/lite5200b_defconfig +++ b/arch/powerpc/configs/52xx/lite5200b_defconfig | |||
@@ -15,7 +15,6 @@ CONFIG_PPC_MPC52xx=y | |||
15 | CONFIG_PPC_MPC5200_SIMPLE=y | 15 | CONFIG_PPC_MPC5200_SIMPLE=y |
16 | CONFIG_PPC_LITE5200=y | 16 | CONFIG_PPC_LITE5200=y |
17 | # CONFIG_PPC_PMAC is not set | 17 | # CONFIG_PPC_PMAC is not set |
18 | CONFIG_PPC_BESTCOMM=y | ||
19 | CONFIG_NO_HZ=y | 18 | CONFIG_NO_HZ=y |
20 | CONFIG_HIGH_RES_TIMERS=y | 19 | CONFIG_HIGH_RES_TIMERS=y |
21 | CONFIG_SPARSE_IRQ=y | 20 | CONFIG_SPARSE_IRQ=y |
@@ -59,6 +58,8 @@ CONFIG_I2C_CHARDEV=y | |||
59 | CONFIG_I2C_MPC=y | 58 | CONFIG_I2C_MPC=y |
60 | # CONFIG_HWMON is not set | 59 | # CONFIG_HWMON is not set |
61 | CONFIG_VIDEO_OUTPUT_CONTROL=m | 60 | CONFIG_VIDEO_OUTPUT_CONTROL=m |
61 | CONFIG_DMADEVICES=y | ||
62 | CONFIG_PPC_BESTCOMM=y | ||
62 | CONFIG_EXT2_FS=y | 63 | CONFIG_EXT2_FS=y |
63 | CONFIG_EXT3_FS=y | 64 | CONFIG_EXT3_FS=y |
64 | # CONFIG_EXT3_DEFAULTS_TO_ORDERED is not set | 65 | # CONFIG_EXT3_DEFAULTS_TO_ORDERED is not set |
diff --git a/arch/powerpc/configs/52xx/motionpro_defconfig b/arch/powerpc/configs/52xx/motionpro_defconfig index 0c7de9620ea6..0d13ad7e4478 100644 --- a/arch/powerpc/configs/52xx/motionpro_defconfig +++ b/arch/powerpc/configs/52xx/motionpro_defconfig | |||
@@ -12,7 +12,6 @@ CONFIG_EXPERT=y | |||
12 | CONFIG_PPC_MPC52xx=y | 12 | CONFIG_PPC_MPC52xx=y |
13 | CONFIG_PPC_MPC5200_SIMPLE=y | 13 | CONFIG_PPC_MPC5200_SIMPLE=y |
14 | # CONFIG_PPC_PMAC is not set | 14 | # CONFIG_PPC_PMAC is not set |
15 | CONFIG_PPC_BESTCOMM=y | ||
16 | CONFIG_SPARSE_IRQ=y | 15 | CONFIG_SPARSE_IRQ=y |
17 | CONFIG_PM=y | 16 | CONFIG_PM=y |
18 | # CONFIG_PCI is not set | 17 | # CONFIG_PCI is not set |
@@ -84,6 +83,8 @@ CONFIG_LEDS_TRIGGERS=y | |||
84 | CONFIG_LEDS_TRIGGER_TIMER=y | 83 | CONFIG_LEDS_TRIGGER_TIMER=y |
85 | CONFIG_RTC_CLASS=y | 84 | CONFIG_RTC_CLASS=y |
86 | CONFIG_RTC_DRV_DS1307=y | 85 | CONFIG_RTC_DRV_DS1307=y |
86 | CONFIG_DMADEVICES=y | ||
87 | CONFIG_PPC_BESTCOMM=y | ||
87 | CONFIG_EXT2_FS=y | 88 | CONFIG_EXT2_FS=y |
88 | CONFIG_EXT3_FS=y | 89 | CONFIG_EXT3_FS=y |
89 | # CONFIG_EXT3_DEFAULTS_TO_ORDERED is not set | 90 | # CONFIG_EXT3_DEFAULTS_TO_ORDERED is not set |
diff --git a/arch/powerpc/configs/52xx/pcm030_defconfig b/arch/powerpc/configs/52xx/pcm030_defconfig index 22e719575c60..430aa182fa1c 100644 --- a/arch/powerpc/configs/52xx/pcm030_defconfig +++ b/arch/powerpc/configs/52xx/pcm030_defconfig | |||
@@ -21,7 +21,6 @@ CONFIG_MODULE_UNLOAD=y | |||
21 | CONFIG_PPC_MPC52xx=y | 21 | CONFIG_PPC_MPC52xx=y |
22 | CONFIG_PPC_MPC5200_SIMPLE=y | 22 | CONFIG_PPC_MPC5200_SIMPLE=y |
23 | # CONFIG_PPC_PMAC is not set | 23 | # CONFIG_PPC_PMAC is not set |
24 | CONFIG_PPC_BESTCOMM=y | ||
25 | CONFIG_NO_HZ=y | 24 | CONFIG_NO_HZ=y |
26 | CONFIG_HIGH_RES_TIMERS=y | 25 | CONFIG_HIGH_RES_TIMERS=y |
27 | CONFIG_HZ_100=y | 26 | CONFIG_HZ_100=y |
@@ -87,6 +86,8 @@ CONFIG_USB_OHCI_HCD_PPC_OF_BE=y | |||
87 | CONFIG_USB_STORAGE=m | 86 | CONFIG_USB_STORAGE=m |
88 | CONFIG_RTC_CLASS=y | 87 | CONFIG_RTC_CLASS=y |
89 | CONFIG_RTC_DRV_PCF8563=m | 88 | CONFIG_RTC_DRV_PCF8563=m |
89 | CONFIG_DMADEVICES=y | ||
90 | CONFIG_PPC_BESTCOMM=y | ||
90 | CONFIG_EXT2_FS=m | 91 | CONFIG_EXT2_FS=m |
91 | CONFIG_EXT3_FS=m | 92 | CONFIG_EXT3_FS=m |
92 | # CONFIG_EXT3_DEFAULTS_TO_ORDERED is not set | 93 | # CONFIG_EXT3_DEFAULTS_TO_ORDERED is not set |
diff --git a/arch/powerpc/configs/52xx/tqm5200_defconfig b/arch/powerpc/configs/52xx/tqm5200_defconfig index 716a37be16e3..7af4c5bb7c63 100644 --- a/arch/powerpc/configs/52xx/tqm5200_defconfig +++ b/arch/powerpc/configs/52xx/tqm5200_defconfig | |||
@@ -17,7 +17,6 @@ CONFIG_PPC_MPC52xx=y | |||
17 | CONFIG_PPC_MPC5200_SIMPLE=y | 17 | CONFIG_PPC_MPC5200_SIMPLE=y |
18 | CONFIG_PPC_MPC5200_BUGFIX=y | 18 | CONFIG_PPC_MPC5200_BUGFIX=y |
19 | # CONFIG_PPC_PMAC is not set | 19 | # CONFIG_PPC_PMAC is not set |
20 | CONFIG_PPC_BESTCOMM=y | ||
21 | CONFIG_PM=y | 20 | CONFIG_PM=y |
22 | # CONFIG_PCI is not set | 21 | # CONFIG_PCI is not set |
23 | CONFIG_NET=y | 22 | CONFIG_NET=y |
@@ -86,6 +85,8 @@ CONFIG_USB_STORAGE=y | |||
86 | CONFIG_RTC_CLASS=y | 85 | CONFIG_RTC_CLASS=y |
87 | CONFIG_RTC_DRV_DS1307=y | 86 | CONFIG_RTC_DRV_DS1307=y |
88 | CONFIG_RTC_DRV_DS1374=y | 87 | CONFIG_RTC_DRV_DS1374=y |
88 | CONFIG_DMADEVICES=y | ||
89 | CONFIG_PPC_BESTCOMM=y | ||
89 | CONFIG_EXT2_FS=y | 90 | CONFIG_EXT2_FS=y |
90 | CONFIG_EXT3_FS=y | 91 | CONFIG_EXT3_FS=y |
91 | # CONFIG_EXT3_DEFAULTS_TO_ORDERED is not set | 92 | # CONFIG_EXT3_DEFAULTS_TO_ORDERED is not set |
diff --git a/arch/powerpc/configs/mpc5200_defconfig b/arch/powerpc/configs/mpc5200_defconfig index 6640a35bebb7..8b682d1cf4d6 100644 --- a/arch/powerpc/configs/mpc5200_defconfig +++ b/arch/powerpc/configs/mpc5200_defconfig | |||
@@ -15,7 +15,6 @@ CONFIG_PPC_MEDIA5200=y | |||
15 | CONFIG_PPC_MPC5200_BUGFIX=y | 15 | CONFIG_PPC_MPC5200_BUGFIX=y |
16 | CONFIG_PPC_MPC5200_LPBFIFO=m | 16 | CONFIG_PPC_MPC5200_LPBFIFO=m |
17 | # CONFIG_PPC_PMAC is not set | 17 | # CONFIG_PPC_PMAC is not set |
18 | CONFIG_PPC_BESTCOMM=y | ||
19 | CONFIG_SIMPLE_GPIO=y | 18 | CONFIG_SIMPLE_GPIO=y |
20 | CONFIG_NO_HZ=y | 19 | CONFIG_NO_HZ=y |
21 | CONFIG_HIGH_RES_TIMERS=y | 20 | CONFIG_HIGH_RES_TIMERS=y |
@@ -125,6 +124,8 @@ CONFIG_RTC_CLASS=y | |||
125 | CONFIG_RTC_DRV_DS1307=y | 124 | CONFIG_RTC_DRV_DS1307=y |
126 | CONFIG_RTC_DRV_DS1374=y | 125 | CONFIG_RTC_DRV_DS1374=y |
127 | CONFIG_RTC_DRV_PCF8563=m | 126 | CONFIG_RTC_DRV_PCF8563=m |
127 | CONFIG_DMADEVICES=y | ||
128 | CONFIG_PPC_BESTCOMM=y | ||
128 | CONFIG_EXT2_FS=y | 129 | CONFIG_EXT2_FS=y |
129 | CONFIG_EXT3_FS=y | 130 | CONFIG_EXT3_FS=y |
130 | # CONFIG_EXT3_DEFAULTS_TO_ORDERED is not set | 131 | # CONFIG_EXT3_DEFAULTS_TO_ORDERED is not set |
diff --git a/arch/powerpc/configs/pasemi_defconfig b/arch/powerpc/configs/pasemi_defconfig index bd8a6f71944f..cec044a3ff69 100644 --- a/arch/powerpc/configs/pasemi_defconfig +++ b/arch/powerpc/configs/pasemi_defconfig | |||
@@ -2,7 +2,6 @@ CONFIG_PPC64=y | |||
2 | CONFIG_ALTIVEC=y | 2 | CONFIG_ALTIVEC=y |
3 | CONFIG_SMP=y | 3 | CONFIG_SMP=y |
4 | CONFIG_NR_CPUS=2 | 4 | CONFIG_NR_CPUS=2 |
5 | CONFIG_EXPERIMENTAL=y | ||
6 | CONFIG_SYSVIPC=y | 5 | CONFIG_SYSVIPC=y |
7 | CONFIG_NO_HZ=y | 6 | CONFIG_NO_HZ=y |
8 | CONFIG_HIGH_RES_TIMERS=y | 7 | CONFIG_HIGH_RES_TIMERS=y |
@@ -45,8 +44,9 @@ CONFIG_INET_AH=y | |||
45 | CONFIG_INET_ESP=y | 44 | CONFIG_INET_ESP=y |
46 | # CONFIG_IPV6 is not set | 45 | # CONFIG_IPV6 is not set |
47 | CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" | 46 | CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" |
47 | CONFIG_DEVTMPFS=y | ||
48 | CONFIG_DEVTMPFS_MOUNT=y | ||
48 | CONFIG_MTD=y | 49 | CONFIG_MTD=y |
49 | CONFIG_MTD_CHAR=y | ||
50 | CONFIG_MTD_BLOCK=y | 50 | CONFIG_MTD_BLOCK=y |
51 | CONFIG_MTD_SLRAM=y | 51 | CONFIG_MTD_SLRAM=y |
52 | CONFIG_MTD_PHRAM=y | 52 | CONFIG_MTD_PHRAM=y |
@@ -88,7 +88,6 @@ CONFIG_BLK_DEV_DM=y | |||
88 | CONFIG_DM_CRYPT=y | 88 | CONFIG_DM_CRYPT=y |
89 | CONFIG_NETDEVICES=y | 89 | CONFIG_NETDEVICES=y |
90 | CONFIG_DUMMY=y | 90 | CONFIG_DUMMY=y |
91 | CONFIG_MII=y | ||
92 | CONFIG_TIGON3=y | 91 | CONFIG_TIGON3=y |
93 | CONFIG_E1000=y | 92 | CONFIG_E1000=y |
94 | CONFIG_PASEMI_MAC=y | 93 | CONFIG_PASEMI_MAC=y |
@@ -174,8 +173,8 @@ CONFIG_NLS_CODEPAGE_437=y | |||
174 | CONFIG_NLS_ISO8859_1=y | 173 | CONFIG_NLS_ISO8859_1=y |
175 | CONFIG_CRC_CCITT=y | 174 | CONFIG_CRC_CCITT=y |
176 | CONFIG_PRINTK_TIME=y | 175 | CONFIG_PRINTK_TIME=y |
177 | CONFIG_MAGIC_SYSRQ=y | ||
178 | CONFIG_DEBUG_FS=y | 176 | CONFIG_DEBUG_FS=y |
177 | CONFIG_MAGIC_SYSRQ=y | ||
179 | CONFIG_DEBUG_KERNEL=y | 178 | CONFIG_DEBUG_KERNEL=y |
180 | CONFIG_DETECT_HUNG_TASK=y | 179 | CONFIG_DETECT_HUNG_TASK=y |
181 | # CONFIG_SCHED_DEBUG is not set | 180 | # CONFIG_SCHED_DEBUG is not set |
diff --git a/arch/powerpc/include/asm/pgalloc-32.h b/arch/powerpc/include/asm/pgalloc-32.h index 27b2386f738a..842846c1b711 100644 --- a/arch/powerpc/include/asm/pgalloc-32.h +++ b/arch/powerpc/include/asm/pgalloc-32.h | |||
@@ -84,10 +84,8 @@ static inline void pgtable_free_tlb(struct mmu_gather *tlb, | |||
84 | static inline void __pte_free_tlb(struct mmu_gather *tlb, pgtable_t table, | 84 | static inline void __pte_free_tlb(struct mmu_gather *tlb, pgtable_t table, |
85 | unsigned long address) | 85 | unsigned long address) |
86 | { | 86 | { |
87 | struct page *page = page_address(table); | ||
88 | |||
89 | tlb_flush_pgtable(tlb, address); | 87 | tlb_flush_pgtable(tlb, address); |
90 | pgtable_page_dtor(page); | 88 | pgtable_page_dtor(table); |
91 | pgtable_free_tlb(tlb, page, 0); | 89 | pgtable_free_tlb(tlb, page_address(table), 0); |
92 | } | 90 | } |
93 | #endif /* _ASM_POWERPC_PGALLOC_32_H */ | 91 | #endif /* _ASM_POWERPC_PGALLOC_32_H */ |
diff --git a/arch/powerpc/include/asm/pgalloc-64.h b/arch/powerpc/include/asm/pgalloc-64.h index 694012877bf7..4b0be20fcbfd 100644 --- a/arch/powerpc/include/asm/pgalloc-64.h +++ b/arch/powerpc/include/asm/pgalloc-64.h | |||
@@ -148,11 +148,9 @@ static inline void pgtable_free_tlb(struct mmu_gather *tlb, | |||
148 | static inline void __pte_free_tlb(struct mmu_gather *tlb, pgtable_t table, | 148 | static inline void __pte_free_tlb(struct mmu_gather *tlb, pgtable_t table, |
149 | unsigned long address) | 149 | unsigned long address) |
150 | { | 150 | { |
151 | struct page *page = page_address(table); | ||
152 | |||
153 | tlb_flush_pgtable(tlb, address); | 151 | tlb_flush_pgtable(tlb, address); |
154 | pgtable_page_dtor(page); | 152 | pgtable_page_dtor(table); |
155 | pgtable_free_tlb(tlb, page, 0); | 153 | pgtable_free_tlb(tlb, page_address(table), 0); |
156 | } | 154 | } |
157 | 155 | ||
158 | #else /* if CONFIG_PPC_64K_PAGES */ | 156 | #else /* if CONFIG_PPC_64K_PAGES */ |
diff --git a/arch/powerpc/kernel/machine_kexec.c b/arch/powerpc/kernel/machine_kexec.c index 88a7fb458dfd..75d4f7340da8 100644 --- a/arch/powerpc/kernel/machine_kexec.c +++ b/arch/powerpc/kernel/machine_kexec.c | |||
@@ -148,7 +148,7 @@ void __init reserve_crashkernel(void) | |||
148 | * a small SLB (128MB) since the crash kernel needs to place | 148 | * a small SLB (128MB) since the crash kernel needs to place |
149 | * itself and some stacks to be in the first segment. | 149 | * itself and some stacks to be in the first segment. |
150 | */ | 150 | */ |
151 | crashk_res.start = min(0x80000000ULL, (ppc64_rma_size / 2)); | 151 | crashk_res.start = min(0x8000000ULL, (ppc64_rma_size / 2)); |
152 | #else | 152 | #else |
153 | crashk_res.start = KDUMP_KERNELBASE; | 153 | crashk_res.start = KDUMP_KERNELBASE; |
154 | #endif | 154 | #endif |
diff --git a/arch/powerpc/kernel/misc_64.S b/arch/powerpc/kernel/misc_64.S index e59caf874d05..64bf8db12b15 100644 --- a/arch/powerpc/kernel/misc_64.S +++ b/arch/powerpc/kernel/misc_64.S | |||
@@ -246,8 +246,8 @@ _GLOBAL(__bswapdi2) | |||
246 | or r3,r7,r9 | 246 | or r3,r7,r9 |
247 | blr | 247 | blr |
248 | 248 | ||
249 | #if defined(CONFIG_PPC_PMAC) || defined(CONFIG_PPC_MAPLE) | ||
250 | 249 | ||
250 | #ifdef CONFIG_PPC_EARLY_DEBUG_BOOTX | ||
251 | _GLOBAL(rmci_on) | 251 | _GLOBAL(rmci_on) |
252 | sync | 252 | sync |
253 | isync | 253 | isync |
@@ -277,6 +277,9 @@ _GLOBAL(rmci_off) | |||
277 | isync | 277 | isync |
278 | sync | 278 | sync |
279 | blr | 279 | blr |
280 | #endif /* CONFIG_PPC_EARLY_DEBUG_BOOTX */ | ||
281 | |||
282 | #if defined(CONFIG_PPC_PMAC) || defined(CONFIG_PPC_MAPLE) | ||
280 | 283 | ||
281 | /* | 284 | /* |
282 | * Do an IO access in real mode | 285 | * Do an IO access in real mode |
diff --git a/arch/powerpc/platforms/powernv/pci-ioda.c b/arch/powerpc/platforms/powernv/pci-ioda.c index 084cdfa40682..2c6d173842b2 100644 --- a/arch/powerpc/platforms/powernv/pci-ioda.c +++ b/arch/powerpc/platforms/powernv/pci-ioda.c | |||
@@ -720,6 +720,7 @@ static void pnv_pci_ioda2_setup_dma_pe(struct pnv_phb *phb, | |||
720 | tbl->it_type = TCE_PCI_SWINV_CREATE | TCE_PCI_SWINV_FREE; | 720 | tbl->it_type = TCE_PCI_SWINV_CREATE | TCE_PCI_SWINV_FREE; |
721 | } | 721 | } |
722 | iommu_init_table(tbl, phb->hose->node); | 722 | iommu_init_table(tbl, phb->hose->node); |
723 | iommu_register_group(tbl, pci_domain_nr(pe->pbus), pe->pe_number); | ||
723 | 724 | ||
724 | if (pe->pdev) | 725 | if (pe->pdev) |
725 | set_iommu_table_base(&pe->pdev->dev, tbl); | 726 | set_iommu_table_base(&pe->pdev->dev, tbl); |
diff --git a/arch/powerpc/sysdev/ppc4xx_ocm.c b/arch/powerpc/sysdev/ppc4xx_ocm.c index b7c43453236d..85d9e37f5ccb 100644 --- a/arch/powerpc/sysdev/ppc4xx_ocm.c +++ b/arch/powerpc/sysdev/ppc4xx_ocm.c | |||
@@ -339,7 +339,7 @@ void *ppc4xx_ocm_alloc(phys_addr_t *phys, int size, int align, | |||
339 | if (IS_ERR_VALUE(offset)) | 339 | if (IS_ERR_VALUE(offset)) |
340 | continue; | 340 | continue; |
341 | 341 | ||
342 | ocm_blk = kzalloc(sizeof(struct ocm_block *), GFP_KERNEL); | 342 | ocm_blk = kzalloc(sizeof(struct ocm_block), GFP_KERNEL); |
343 | if (!ocm_blk) { | 343 | if (!ocm_blk) { |
344 | printk(KERN_ERR "PPC4XX OCM: could not allocate ocm block"); | 344 | printk(KERN_ERR "PPC4XX OCM: could not allocate ocm block"); |
345 | rh_free(ocm_reg->rh, offset); | 345 | rh_free(ocm_reg->rh, offset); |
diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig index 5877e71901b3..1e1a03d2d19f 100644 --- a/arch/s390/Kconfig +++ b/arch/s390/Kconfig | |||
@@ -347,14 +347,14 @@ config SMP | |||
347 | Even if you don't know what to do here, say Y. | 347 | Even if you don't know what to do here, say Y. |
348 | 348 | ||
349 | config NR_CPUS | 349 | config NR_CPUS |
350 | int "Maximum number of CPUs (2-64)" | 350 | int "Maximum number of CPUs (2-256)" |
351 | range 2 64 | 351 | range 2 256 |
352 | depends on SMP | 352 | depends on SMP |
353 | default "32" if !64BIT | 353 | default "32" if !64BIT |
354 | default "64" if 64BIT | 354 | default "64" if 64BIT |
355 | help | 355 | help |
356 | This allows you to specify the maximum number of CPUs which this | 356 | This allows you to specify the maximum number of CPUs which this |
357 | kernel will support. The maximum supported value is 64 and the | 357 | kernel will support. The maximum supported value is 256 and the |
358 | minimum value which makes sense is 2. | 358 | minimum value which makes sense is 2. |
359 | 359 | ||
360 | This is purely to save memory - each supported CPU adds | 360 | This is purely to save memory - each supported CPU adds |
diff --git a/arch/s390/crypto/aes_s390.c b/arch/s390/crypto/aes_s390.c index 4363528dc8fd..b3feabd39f31 100644 --- a/arch/s390/crypto/aes_s390.c +++ b/arch/s390/crypto/aes_s390.c | |||
@@ -55,8 +55,7 @@ struct pcc_param { | |||
55 | 55 | ||
56 | struct s390_xts_ctx { | 56 | struct s390_xts_ctx { |
57 | u8 key[32]; | 57 | u8 key[32]; |
58 | u8 xts_param[16]; | 58 | u8 pcc_key[32]; |
59 | struct pcc_param pcc; | ||
60 | long enc; | 59 | long enc; |
61 | long dec; | 60 | long dec; |
62 | int key_len; | 61 | int key_len; |
@@ -591,7 +590,7 @@ static int xts_aes_set_key(struct crypto_tfm *tfm, const u8 *in_key, | |||
591 | xts_ctx->enc = KM_XTS_128_ENCRYPT; | 590 | xts_ctx->enc = KM_XTS_128_ENCRYPT; |
592 | xts_ctx->dec = KM_XTS_128_DECRYPT; | 591 | xts_ctx->dec = KM_XTS_128_DECRYPT; |
593 | memcpy(xts_ctx->key + 16, in_key, 16); | 592 | memcpy(xts_ctx->key + 16, in_key, 16); |
594 | memcpy(xts_ctx->pcc.key + 16, in_key + 16, 16); | 593 | memcpy(xts_ctx->pcc_key + 16, in_key + 16, 16); |
595 | break; | 594 | break; |
596 | case 48: | 595 | case 48: |
597 | xts_ctx->enc = 0; | 596 | xts_ctx->enc = 0; |
@@ -602,7 +601,7 @@ static int xts_aes_set_key(struct crypto_tfm *tfm, const u8 *in_key, | |||
602 | xts_ctx->enc = KM_XTS_256_ENCRYPT; | 601 | xts_ctx->enc = KM_XTS_256_ENCRYPT; |
603 | xts_ctx->dec = KM_XTS_256_DECRYPT; | 602 | xts_ctx->dec = KM_XTS_256_DECRYPT; |
604 | memcpy(xts_ctx->key, in_key, 32); | 603 | memcpy(xts_ctx->key, in_key, 32); |
605 | memcpy(xts_ctx->pcc.key, in_key + 32, 32); | 604 | memcpy(xts_ctx->pcc_key, in_key + 32, 32); |
606 | break; | 605 | break; |
607 | default: | 606 | default: |
608 | *flags |= CRYPTO_TFM_RES_BAD_KEY_LEN; | 607 | *flags |= CRYPTO_TFM_RES_BAD_KEY_LEN; |
@@ -621,29 +620,33 @@ static int xts_aes_crypt(struct blkcipher_desc *desc, long func, | |||
621 | unsigned int nbytes = walk->nbytes; | 620 | unsigned int nbytes = walk->nbytes; |
622 | unsigned int n; | 621 | unsigned int n; |
623 | u8 *in, *out; | 622 | u8 *in, *out; |
624 | void *param; | 623 | struct pcc_param pcc_param; |
624 | struct { | ||
625 | u8 key[32]; | ||
626 | u8 init[16]; | ||
627 | } xts_param; | ||
625 | 628 | ||
626 | if (!nbytes) | 629 | if (!nbytes) |
627 | goto out; | 630 | goto out; |
628 | 631 | ||
629 | memset(xts_ctx->pcc.block, 0, sizeof(xts_ctx->pcc.block)); | 632 | memset(pcc_param.block, 0, sizeof(pcc_param.block)); |
630 | memset(xts_ctx->pcc.bit, 0, sizeof(xts_ctx->pcc.bit)); | 633 | memset(pcc_param.bit, 0, sizeof(pcc_param.bit)); |
631 | memset(xts_ctx->pcc.xts, 0, sizeof(xts_ctx->pcc.xts)); | 634 | memset(pcc_param.xts, 0, sizeof(pcc_param.xts)); |
632 | memcpy(xts_ctx->pcc.tweak, walk->iv, sizeof(xts_ctx->pcc.tweak)); | 635 | memcpy(pcc_param.tweak, walk->iv, sizeof(pcc_param.tweak)); |
633 | param = xts_ctx->pcc.key + offset; | 636 | memcpy(pcc_param.key, xts_ctx->pcc_key, 32); |
634 | ret = crypt_s390_pcc(func, param); | 637 | ret = crypt_s390_pcc(func, &pcc_param.key[offset]); |
635 | if (ret < 0) | 638 | if (ret < 0) |
636 | return -EIO; | 639 | return -EIO; |
637 | 640 | ||
638 | memcpy(xts_ctx->xts_param, xts_ctx->pcc.xts, 16); | 641 | memcpy(xts_param.key, xts_ctx->key, 32); |
639 | param = xts_ctx->key + offset; | 642 | memcpy(xts_param.init, pcc_param.xts, 16); |
640 | do { | 643 | do { |
641 | /* only use complete blocks */ | 644 | /* only use complete blocks */ |
642 | n = nbytes & ~(AES_BLOCK_SIZE - 1); | 645 | n = nbytes & ~(AES_BLOCK_SIZE - 1); |
643 | out = walk->dst.virt.addr; | 646 | out = walk->dst.virt.addr; |
644 | in = walk->src.virt.addr; | 647 | in = walk->src.virt.addr; |
645 | 648 | ||
646 | ret = crypt_s390_km(func, param, out, in, n); | 649 | ret = crypt_s390_km(func, &xts_param.key[offset], out, in, n); |
647 | if (ret < 0 || ret != n) | 650 | if (ret < 0 || ret != n) |
648 | return -EIO; | 651 | return -EIO; |
649 | 652 | ||
diff --git a/arch/s390/include/asm/sclp.h b/arch/s390/include/asm/sclp.h index 30ef748bc161..2f390956c7c1 100644 --- a/arch/s390/include/asm/sclp.h +++ b/arch/s390/include/asm/sclp.h | |||
@@ -8,6 +8,7 @@ | |||
8 | 8 | ||
9 | #include <linux/types.h> | 9 | #include <linux/types.h> |
10 | #include <asm/chpid.h> | 10 | #include <asm/chpid.h> |
11 | #include <asm/cpu.h> | ||
11 | 12 | ||
12 | #define SCLP_CHP_INFO_MASK_SIZE 32 | 13 | #define SCLP_CHP_INFO_MASK_SIZE 32 |
13 | 14 | ||
@@ -37,7 +38,7 @@ struct sclp_cpu_info { | |||
37 | unsigned int standby; | 38 | unsigned int standby; |
38 | unsigned int combined; | 39 | unsigned int combined; |
39 | int has_cpu_type; | 40 | int has_cpu_type; |
40 | struct sclp_cpu_entry cpu[255]; | 41 | struct sclp_cpu_entry cpu[MAX_CPU_ADDRESS + 1]; |
41 | }; | 42 | }; |
42 | 43 | ||
43 | int sclp_get_cpu_info(struct sclp_cpu_info *info); | 44 | int sclp_get_cpu_info(struct sclp_cpu_info *info); |
diff --git a/arch/s390/kernel/asm-offsets.c b/arch/s390/kernel/asm-offsets.c index 496116cd65ec..e4c99a183651 100644 --- a/arch/s390/kernel/asm-offsets.c +++ b/arch/s390/kernel/asm-offsets.c | |||
@@ -72,6 +72,7 @@ int main(void) | |||
72 | /* constants used by the vdso */ | 72 | /* constants used by the vdso */ |
73 | DEFINE(__CLOCK_REALTIME, CLOCK_REALTIME); | 73 | DEFINE(__CLOCK_REALTIME, CLOCK_REALTIME); |
74 | DEFINE(__CLOCK_MONOTONIC, CLOCK_MONOTONIC); | 74 | DEFINE(__CLOCK_MONOTONIC, CLOCK_MONOTONIC); |
75 | DEFINE(__CLOCK_THREAD_CPUTIME_ID, CLOCK_THREAD_CPUTIME_ID); | ||
75 | DEFINE(__CLOCK_REALTIME_RES, MONOTONIC_RES_NSEC); | 76 | DEFINE(__CLOCK_REALTIME_RES, MONOTONIC_RES_NSEC); |
76 | BLANK(); | 77 | BLANK(); |
77 | /* idle data offsets */ | 78 | /* idle data offsets */ |
diff --git a/arch/s390/kernel/vdso.c b/arch/s390/kernel/vdso.c index a84476f2a9bb..613649096783 100644 --- a/arch/s390/kernel/vdso.c +++ b/arch/s390/kernel/vdso.c | |||
@@ -125,7 +125,7 @@ int vdso_alloc_per_cpu(struct _lowcore *lowcore) | |||
125 | psal[i] = 0x80000000; | 125 | psal[i] = 0x80000000; |
126 | 126 | ||
127 | lowcore->paste[4] = (u32)(addr_t) psal; | 127 | lowcore->paste[4] = (u32)(addr_t) psal; |
128 | psal[0] = 0x20000000; | 128 | psal[0] = 0x02000000; |
129 | psal[2] = (u32)(addr_t) aste; | 129 | psal[2] = (u32)(addr_t) aste; |
130 | *(unsigned long *) (aste + 2) = segment_table + | 130 | *(unsigned long *) (aste + 2) = segment_table + |
131 | _ASCE_TABLE_LENGTH + _ASCE_USER_BITS + _ASCE_TYPE_SEGMENT; | 131 | _ASCE_TABLE_LENGTH + _ASCE_USER_BITS + _ASCE_TYPE_SEGMENT; |
diff --git a/arch/s390/kernel/vdso32/clock_gettime.S b/arch/s390/kernel/vdso32/clock_gettime.S index 5be8e472f57d..65fc3979c2f1 100644 --- a/arch/s390/kernel/vdso32/clock_gettime.S +++ b/arch/s390/kernel/vdso32/clock_gettime.S | |||
@@ -46,18 +46,13 @@ __kernel_clock_gettime: | |||
46 | jnm 3f | 46 | jnm 3f |
47 | a %r0,__VDSO_TK_MULT(%r5) | 47 | a %r0,__VDSO_TK_MULT(%r5) |
48 | 3: alr %r0,%r2 | 48 | 3: alr %r0,%r2 |
49 | al %r0,__VDSO_XTIME_NSEC(%r5) /* + tk->xtime_nsec */ | 49 | al %r0,__VDSO_WTOM_NSEC(%r5) |
50 | al %r1,__VDSO_XTIME_NSEC+4(%r5) | ||
51 | brc 12,4f | ||
52 | ahi %r0,1 | ||
53 | 4: al %r0,__VDSO_WTOM_NSEC(%r5) /* + wall_to_monotonic.nsec */ | ||
54 | al %r1,__VDSO_WTOM_NSEC+4(%r5) | 50 | al %r1,__VDSO_WTOM_NSEC+4(%r5) |
55 | brc 12,5f | 51 | brc 12,5f |
56 | ahi %r0,1 | 52 | ahi %r0,1 |
57 | 5: l %r2,__VDSO_TK_SHIFT(%r5) /* Timekeeper shift */ | 53 | 5: l %r2,__VDSO_TK_SHIFT(%r5) /* Timekeeper shift */ |
58 | srdl %r0,0(%r2) /* >> tk->shift */ | 54 | srdl %r0,0(%r2) /* >> tk->shift */ |
59 | l %r2,__VDSO_XTIME_SEC+4(%r5) | 55 | l %r2,__VDSO_WTOM_SEC+4(%r5) |
60 | al %r2,__VDSO_WTOM_SEC+4(%r5) | ||
61 | cl %r4,__VDSO_UPD_COUNT+4(%r5) /* check update counter */ | 56 | cl %r4,__VDSO_UPD_COUNT+4(%r5) /* check update counter */ |
62 | jne 1b | 57 | jne 1b |
63 | basr %r5,0 | 58 | basr %r5,0 |
diff --git a/arch/s390/kernel/vdso64/clock_getres.S b/arch/s390/kernel/vdso64/clock_getres.S index 176e1f75f9aa..34deba7c7ed1 100644 --- a/arch/s390/kernel/vdso64/clock_getres.S +++ b/arch/s390/kernel/vdso64/clock_getres.S | |||
@@ -23,7 +23,9 @@ __kernel_clock_getres: | |||
23 | je 0f | 23 | je 0f |
24 | cghi %r2,__CLOCK_MONOTONIC | 24 | cghi %r2,__CLOCK_MONOTONIC |
25 | je 0f | 25 | je 0f |
26 | cghi %r2,-2 /* CLOCK_THREAD_CPUTIME_ID for this thread */ | 26 | cghi %r2,__CLOCK_THREAD_CPUTIME_ID |
27 | je 0f | ||
28 | cghi %r2,-2 /* Per-thread CPUCLOCK with PID=0, VIRT=1 */ | ||
27 | jne 2f | 29 | jne 2f |
28 | larl %r5,_vdso_data | 30 | larl %r5,_vdso_data |
29 | icm %r0,15,__LC_ECTG_OK(%r5) | 31 | icm %r0,15,__LC_ECTG_OK(%r5) |
diff --git a/arch/s390/kernel/vdso64/clock_gettime.S b/arch/s390/kernel/vdso64/clock_gettime.S index 0add1072ba30..91940ed33a4a 100644 --- a/arch/s390/kernel/vdso64/clock_gettime.S +++ b/arch/s390/kernel/vdso64/clock_gettime.S | |||
@@ -22,7 +22,9 @@ __kernel_clock_gettime: | |||
22 | larl %r5,_vdso_data | 22 | larl %r5,_vdso_data |
23 | cghi %r2,__CLOCK_REALTIME | 23 | cghi %r2,__CLOCK_REALTIME |
24 | je 4f | 24 | je 4f |
25 | cghi %r2,-2 /* CLOCK_THREAD_CPUTIME_ID for this thread */ | 25 | cghi %r2,__CLOCK_THREAD_CPUTIME_ID |
26 | je 9f | ||
27 | cghi %r2,-2 /* Per-thread CPUCLOCK with PID=0, VIRT=1 */ | ||
26 | je 9f | 28 | je 9f |
27 | cghi %r2,__CLOCK_MONOTONIC | 29 | cghi %r2,__CLOCK_MONOTONIC |
28 | jne 12f | 30 | jne 12f |
@@ -35,13 +37,11 @@ __kernel_clock_gettime: | |||
35 | jnz 0b | 37 | jnz 0b |
36 | stck 48(%r15) /* Store TOD clock */ | 38 | stck 48(%r15) /* Store TOD clock */ |
37 | lgf %r2,__VDSO_TK_SHIFT(%r5) /* Timekeeper shift */ | 39 | lgf %r2,__VDSO_TK_SHIFT(%r5) /* Timekeeper shift */ |
38 | lg %r0,__VDSO_XTIME_SEC(%r5) /* tk->xtime_sec */ | 40 | lg %r0,__VDSO_WTOM_SEC(%r5) |
39 | alg %r0,__VDSO_WTOM_SEC(%r5) /* + wall_to_monotonic.sec */ | ||
40 | lg %r1,48(%r15) | 41 | lg %r1,48(%r15) |
41 | sg %r1,__VDSO_XTIME_STAMP(%r5) /* TOD - cycle_last */ | 42 | sg %r1,__VDSO_XTIME_STAMP(%r5) /* TOD - cycle_last */ |
42 | msgf %r1,__VDSO_TK_MULT(%r5) /* * tk->mult */ | 43 | msgf %r1,__VDSO_TK_MULT(%r5) /* * tk->mult */ |
43 | alg %r1,__VDSO_XTIME_NSEC(%r5) /* + tk->xtime_nsec */ | 44 | alg %r1,__VDSO_WTOM_NSEC(%r5) |
44 | alg %r1,__VDSO_WTOM_NSEC(%r5) /* + wall_to_monotonic.nsec */ | ||
45 | srlg %r1,%r1,0(%r2) /* >> tk->shift */ | 45 | srlg %r1,%r1,0(%r2) /* >> tk->shift */ |
46 | clg %r4,__VDSO_UPD_COUNT(%r5) /* check update counter */ | 46 | clg %r4,__VDSO_UPD_COUNT(%r5) /* check update counter */ |
47 | jne 0b | 47 | jne 0b |
diff --git a/arch/um/Makefile b/arch/um/Makefile index 48d92bbe62e9..36e658a4291c 100644 --- a/arch/um/Makefile +++ b/arch/um/Makefile | |||
@@ -33,12 +33,11 @@ MODE_INCLUDE += -I$(srctree)/$(ARCH_DIR)/include/shared/skas | |||
33 | 33 | ||
34 | HEADER_ARCH := $(SUBARCH) | 34 | HEADER_ARCH := $(SUBARCH) |
35 | 35 | ||
36 | # Additional ARCH settings for x86 | 36 | ifneq ($(filter $(SUBARCH),x86 x86_64 i386),) |
37 | ifeq ($(SUBARCH),i386) | 37 | HEADER_ARCH := x86 |
38 | HEADER_ARCH := x86 | ||
39 | endif | 38 | endif |
40 | ifeq ($(SUBARCH),x86_64) | 39 | |
41 | HEADER_ARCH := x86 | 40 | ifdef CONFIG_64BIT |
42 | KBUILD_CFLAGS += -mcmodel=large | 41 | KBUILD_CFLAGS += -mcmodel=large |
43 | endif | 42 | endif |
44 | 43 | ||
diff --git a/arch/um/kernel/sysrq.c b/arch/um/kernel/sysrq.c index 4d6fdf68edf3..799d7e413bf5 100644 --- a/arch/um/kernel/sysrq.c +++ b/arch/um/kernel/sysrq.c | |||
@@ -19,7 +19,7 @@ struct stack_frame { | |||
19 | unsigned long return_address; | 19 | unsigned long return_address; |
20 | }; | 20 | }; |
21 | 21 | ||
22 | static void print_stack_trace(unsigned long *sp, unsigned long bp) | 22 | static void do_stack_trace(unsigned long *sp, unsigned long bp) |
23 | { | 23 | { |
24 | int reliable; | 24 | int reliable; |
25 | unsigned long addr; | 25 | unsigned long addr; |
@@ -94,5 +94,5 @@ void show_stack(struct task_struct *task, unsigned long *stack) | |||
94 | } | 94 | } |
95 | printk(KERN_CONT "\n"); | 95 | printk(KERN_CONT "\n"); |
96 | 96 | ||
97 | print_stack_trace(sp, bp); | 97 | do_stack_trace(sp, bp); |
98 | } | 98 | } |
diff --git a/arch/x86/Makefile b/arch/x86/Makefile index 41250fb33985..57d021507120 100644 --- a/arch/x86/Makefile +++ b/arch/x86/Makefile | |||
@@ -31,6 +31,9 @@ ifeq ($(CONFIG_X86_32),y) | |||
31 | 31 | ||
32 | KBUILD_CFLAGS += -msoft-float -mregparm=3 -freg-struct-return | 32 | KBUILD_CFLAGS += -msoft-float -mregparm=3 -freg-struct-return |
33 | 33 | ||
34 | # Don't autogenerate MMX or SSE instructions | ||
35 | KBUILD_CFLAGS += -mno-mmx -mno-sse | ||
36 | |||
34 | # Never want PIC in a 32-bit kernel, prevent breakage with GCC built | 37 | # Never want PIC in a 32-bit kernel, prevent breakage with GCC built |
35 | # with nonstandard options | 38 | # with nonstandard options |
36 | KBUILD_CFLAGS += -fno-pic | 39 | KBUILD_CFLAGS += -fno-pic |
@@ -57,8 +60,11 @@ else | |||
57 | KBUILD_AFLAGS += -m64 | 60 | KBUILD_AFLAGS += -m64 |
58 | KBUILD_CFLAGS += -m64 | 61 | KBUILD_CFLAGS += -m64 |
59 | 62 | ||
63 | # Don't autogenerate MMX or SSE instructions | ||
64 | KBUILD_CFLAGS += -mno-mmx -mno-sse | ||
65 | |||
60 | # Use -mpreferred-stack-boundary=3 if supported. | 66 | # Use -mpreferred-stack-boundary=3 if supported. |
61 | KBUILD_CFLAGS += $(call cc-option,-mno-sse -mpreferred-stack-boundary=3) | 67 | KBUILD_CFLAGS += $(call cc-option,-mpreferred-stack-boundary=3) |
62 | 68 | ||
63 | # FIXME - should be integrated in Makefile.cpu (Makefile_32.cpu) | 69 | # FIXME - should be integrated in Makefile.cpu (Makefile_32.cpu) |
64 | cflags-$(CONFIG_MK8) += $(call cc-option,-march=k8) | 70 | cflags-$(CONFIG_MK8) += $(call cc-option,-march=k8) |
diff --git a/arch/x86/boot/Makefile b/arch/x86/boot/Makefile index dce69a256896..d9c11956fce0 100644 --- a/arch/x86/boot/Makefile +++ b/arch/x86/boot/Makefile | |||
@@ -53,18 +53,18 @@ $(obj)/cpustr.h: $(obj)/mkcpustr FORCE | |||
53 | 53 | ||
54 | # How to compile the 16-bit code. Note we always compile for -march=i386, | 54 | # How to compile the 16-bit code. Note we always compile for -march=i386, |
55 | # that way we can complain to the user if the CPU is insufficient. | 55 | # that way we can complain to the user if the CPU is insufficient. |
56 | KBUILD_CFLAGS := $(USERINCLUDE) -g -Os -D_SETUP -D__KERNEL__ \ | 56 | KBUILD_CFLAGS := $(USERINCLUDE) -m32 -g -Os -D_SETUP -D__KERNEL__ \ |
57 | -DDISABLE_BRANCH_PROFILING \ | 57 | -DDISABLE_BRANCH_PROFILING \ |
58 | -Wall -Wstrict-prototypes \ | 58 | -Wall -Wstrict-prototypes \ |
59 | -march=i386 -mregparm=3 \ | 59 | -march=i386 -mregparm=3 \ |
60 | -include $(srctree)/$(src)/code16gcc.h \ | 60 | -include $(srctree)/$(src)/code16gcc.h \ |
61 | -fno-strict-aliasing -fomit-frame-pointer -fno-pic \ | 61 | -fno-strict-aliasing -fomit-frame-pointer -fno-pic \ |
62 | -mno-mmx -mno-sse \ | ||
62 | $(call cc-option, -ffreestanding) \ | 63 | $(call cc-option, -ffreestanding) \ |
63 | $(call cc-option, -fno-toplevel-reorder,\ | 64 | $(call cc-option, -fno-toplevel-reorder,\ |
64 | $(call cc-option, -fno-unit-at-a-time)) \ | 65 | $(call cc-option, -fno-unit-at-a-time)) \ |
65 | $(call cc-option, -fno-stack-protector) \ | 66 | $(call cc-option, -fno-stack-protector) \ |
66 | $(call cc-option, -mpreferred-stack-boundary=2) | 67 | $(call cc-option, -mpreferred-stack-boundary=2) |
67 | KBUILD_CFLAGS += $(call cc-option, -m32) | ||
68 | KBUILD_AFLAGS := $(KBUILD_CFLAGS) -D__ASSEMBLY__ | 68 | KBUILD_AFLAGS := $(KBUILD_CFLAGS) -D__ASSEMBLY__ |
69 | GCOV_PROFILE := n | 69 | GCOV_PROFILE := n |
70 | 70 | ||
diff --git a/arch/x86/boot/compressed/Makefile b/arch/x86/boot/compressed/Makefile index dcd90df10ab4..c8a6792e7842 100644 --- a/arch/x86/boot/compressed/Makefile +++ b/arch/x86/boot/compressed/Makefile | |||
@@ -13,6 +13,7 @@ KBUILD_CFLAGS += -DDISABLE_BRANCH_PROFILING | |||
13 | cflags-$(CONFIG_X86_32) := -march=i386 | 13 | cflags-$(CONFIG_X86_32) := -march=i386 |
14 | cflags-$(CONFIG_X86_64) := -mcmodel=small | 14 | cflags-$(CONFIG_X86_64) := -mcmodel=small |
15 | KBUILD_CFLAGS += $(cflags-y) | 15 | KBUILD_CFLAGS += $(cflags-y) |
16 | KBUILD_CFLAGS += -mno-mmx -mno-sse | ||
16 | KBUILD_CFLAGS += $(call cc-option,-ffreestanding) | 17 | KBUILD_CFLAGS += $(call cc-option,-ffreestanding) |
17 | KBUILD_CFLAGS += $(call cc-option,-fno-stack-protector) | 18 | KBUILD_CFLAGS += $(call cc-option,-fno-stack-protector) |
18 | 19 | ||
diff --git a/arch/x86/include/asm/atomic.h b/arch/x86/include/asm/atomic.h index da31c8b8a92d..b17f4f48ecd7 100644 --- a/arch/x86/include/asm/atomic.h +++ b/arch/x86/include/asm/atomic.h | |||
@@ -77,7 +77,7 @@ static inline void atomic_sub(int i, atomic_t *v) | |||
77 | */ | 77 | */ |
78 | static inline int atomic_sub_and_test(int i, atomic_t *v) | 78 | static inline int atomic_sub_and_test(int i, atomic_t *v) |
79 | { | 79 | { |
80 | GEN_BINARY_RMWcc(LOCK_PREFIX "subl", v->counter, i, "%0", "e"); | 80 | GEN_BINARY_RMWcc(LOCK_PREFIX "subl", v->counter, "er", i, "%0", "e"); |
81 | } | 81 | } |
82 | 82 | ||
83 | /** | 83 | /** |
@@ -141,7 +141,7 @@ static inline int atomic_inc_and_test(atomic_t *v) | |||
141 | */ | 141 | */ |
142 | static inline int atomic_add_negative(int i, atomic_t *v) | 142 | static inline int atomic_add_negative(int i, atomic_t *v) |
143 | { | 143 | { |
144 | GEN_BINARY_RMWcc(LOCK_PREFIX "addl", v->counter, i, "%0", "s"); | 144 | GEN_BINARY_RMWcc(LOCK_PREFIX "addl", v->counter, "er", i, "%0", "s"); |
145 | } | 145 | } |
146 | 146 | ||
147 | /** | 147 | /** |
diff --git a/arch/x86/include/asm/atomic64_64.h b/arch/x86/include/asm/atomic64_64.h index 3f065c985aee..46e9052bbd28 100644 --- a/arch/x86/include/asm/atomic64_64.h +++ b/arch/x86/include/asm/atomic64_64.h | |||
@@ -72,7 +72,7 @@ static inline void atomic64_sub(long i, atomic64_t *v) | |||
72 | */ | 72 | */ |
73 | static inline int atomic64_sub_and_test(long i, atomic64_t *v) | 73 | static inline int atomic64_sub_and_test(long i, atomic64_t *v) |
74 | { | 74 | { |
75 | GEN_BINARY_RMWcc(LOCK_PREFIX "subq", v->counter, i, "%0", "e"); | 75 | GEN_BINARY_RMWcc(LOCK_PREFIX "subq", v->counter, "er", i, "%0", "e"); |
76 | } | 76 | } |
77 | 77 | ||
78 | /** | 78 | /** |
@@ -138,7 +138,7 @@ static inline int atomic64_inc_and_test(atomic64_t *v) | |||
138 | */ | 138 | */ |
139 | static inline int atomic64_add_negative(long i, atomic64_t *v) | 139 | static inline int atomic64_add_negative(long i, atomic64_t *v) |
140 | { | 140 | { |
141 | GEN_BINARY_RMWcc(LOCK_PREFIX "addq", v->counter, i, "%0", "s"); | 141 | GEN_BINARY_RMWcc(LOCK_PREFIX "addq", v->counter, "er", i, "%0", "s"); |
142 | } | 142 | } |
143 | 143 | ||
144 | /** | 144 | /** |
diff --git a/arch/x86/include/asm/bitops.h b/arch/x86/include/asm/bitops.h index 6d76d0935989..9fc1af74dc83 100644 --- a/arch/x86/include/asm/bitops.h +++ b/arch/x86/include/asm/bitops.h | |||
@@ -205,7 +205,7 @@ static inline void change_bit(long nr, volatile unsigned long *addr) | |||
205 | */ | 205 | */ |
206 | static inline int test_and_set_bit(long nr, volatile unsigned long *addr) | 206 | static inline int test_and_set_bit(long nr, volatile unsigned long *addr) |
207 | { | 207 | { |
208 | GEN_BINARY_RMWcc(LOCK_PREFIX "bts", *addr, nr, "%0", "c"); | 208 | GEN_BINARY_RMWcc(LOCK_PREFIX "bts", *addr, "Ir", nr, "%0", "c"); |
209 | } | 209 | } |
210 | 210 | ||
211 | /** | 211 | /** |
@@ -251,7 +251,7 @@ static inline int __test_and_set_bit(long nr, volatile unsigned long *addr) | |||
251 | */ | 251 | */ |
252 | static inline int test_and_clear_bit(long nr, volatile unsigned long *addr) | 252 | static inline int test_and_clear_bit(long nr, volatile unsigned long *addr) |
253 | { | 253 | { |
254 | GEN_BINARY_RMWcc(LOCK_PREFIX "btr", *addr, nr, "%0", "c"); | 254 | GEN_BINARY_RMWcc(LOCK_PREFIX "btr", *addr, "Ir", nr, "%0", "c"); |
255 | } | 255 | } |
256 | 256 | ||
257 | /** | 257 | /** |
@@ -304,7 +304,7 @@ static inline int __test_and_change_bit(long nr, volatile unsigned long *addr) | |||
304 | */ | 304 | */ |
305 | static inline int test_and_change_bit(long nr, volatile unsigned long *addr) | 305 | static inline int test_and_change_bit(long nr, volatile unsigned long *addr) |
306 | { | 306 | { |
307 | GEN_BINARY_RMWcc(LOCK_PREFIX "btc", *addr, nr, "%0", "c"); | 307 | GEN_BINARY_RMWcc(LOCK_PREFIX "btc", *addr, "Ir", nr, "%0", "c"); |
308 | } | 308 | } |
309 | 309 | ||
310 | static __always_inline int constant_test_bit(long nr, const volatile unsigned long *addr) | 310 | static __always_inline int constant_test_bit(long nr, const volatile unsigned long *addr) |
diff --git a/arch/x86/include/asm/local.h b/arch/x86/include/asm/local.h index 5b23e605e707..4ad6560847b1 100644 --- a/arch/x86/include/asm/local.h +++ b/arch/x86/include/asm/local.h | |||
@@ -52,7 +52,7 @@ static inline void local_sub(long i, local_t *l) | |||
52 | */ | 52 | */ |
53 | static inline int local_sub_and_test(long i, local_t *l) | 53 | static inline int local_sub_and_test(long i, local_t *l) |
54 | { | 54 | { |
55 | GEN_BINARY_RMWcc(_ASM_SUB, l->a.counter, i, "%0", "e"); | 55 | GEN_BINARY_RMWcc(_ASM_SUB, l->a.counter, "er", i, "%0", "e"); |
56 | } | 56 | } |
57 | 57 | ||
58 | /** | 58 | /** |
@@ -92,7 +92,7 @@ static inline int local_inc_and_test(local_t *l) | |||
92 | */ | 92 | */ |
93 | static inline int local_add_negative(long i, local_t *l) | 93 | static inline int local_add_negative(long i, local_t *l) |
94 | { | 94 | { |
95 | GEN_BINARY_RMWcc(_ASM_ADD, l->a.counter, i, "%0", "s"); | 95 | GEN_BINARY_RMWcc(_ASM_ADD, l->a.counter, "er", i, "%0", "s"); |
96 | } | 96 | } |
97 | 97 | ||
98 | /** | 98 | /** |
diff --git a/arch/x86/include/asm/rmwcc.h b/arch/x86/include/asm/rmwcc.h index 1ff990f1de8e..8f7866a5b9a4 100644 --- a/arch/x86/include/asm/rmwcc.h +++ b/arch/x86/include/asm/rmwcc.h | |||
@@ -16,8 +16,8 @@ cc_label: \ | |||
16 | #define GEN_UNARY_RMWcc(op, var, arg0, cc) \ | 16 | #define GEN_UNARY_RMWcc(op, var, arg0, cc) \ |
17 | __GEN_RMWcc(op " " arg0, var, cc) | 17 | __GEN_RMWcc(op " " arg0, var, cc) |
18 | 18 | ||
19 | #define GEN_BINARY_RMWcc(op, var, val, arg0, cc) \ | 19 | #define GEN_BINARY_RMWcc(op, var, vcon, val, arg0, cc) \ |
20 | __GEN_RMWcc(op " %1, " arg0, var, cc, "er" (val)) | 20 | __GEN_RMWcc(op " %1, " arg0, var, cc, vcon (val)) |
21 | 21 | ||
22 | #else /* !CC_HAVE_ASM_GOTO */ | 22 | #else /* !CC_HAVE_ASM_GOTO */ |
23 | 23 | ||
@@ -33,8 +33,8 @@ do { \ | |||
33 | #define GEN_UNARY_RMWcc(op, var, arg0, cc) \ | 33 | #define GEN_UNARY_RMWcc(op, var, arg0, cc) \ |
34 | __GEN_RMWcc(op " " arg0, var, cc) | 34 | __GEN_RMWcc(op " " arg0, var, cc) |
35 | 35 | ||
36 | #define GEN_BINARY_RMWcc(op, var, val, arg0, cc) \ | 36 | #define GEN_BINARY_RMWcc(op, var, vcon, val, arg0, cc) \ |
37 | __GEN_RMWcc(op " %2, " arg0, var, cc, "er" (val)) | 37 | __GEN_RMWcc(op " %2, " arg0, var, cc, vcon (val)) |
38 | 38 | ||
39 | #endif /* CC_HAVE_ASM_GOTO */ | 39 | #endif /* CC_HAVE_ASM_GOTO */ |
40 | 40 | ||
diff --git a/arch/x86/include/asm/trace/irq_vectors.h b/arch/x86/include/asm/trace/irq_vectors.h index 2874df24e7a4..4cab890007a7 100644 --- a/arch/x86/include/asm/trace/irq_vectors.h +++ b/arch/x86/include/asm/trace/irq_vectors.h | |||
@@ -72,6 +72,17 @@ DEFINE_IRQ_VECTOR_EVENT(x86_platform_ipi); | |||
72 | DEFINE_IRQ_VECTOR_EVENT(irq_work); | 72 | DEFINE_IRQ_VECTOR_EVENT(irq_work); |
73 | 73 | ||
74 | /* | 74 | /* |
75 | * We must dis-allow sampling irq_work_exit() because perf event sampling | ||
76 | * itself can cause irq_work, which would lead to an infinite loop; | ||
77 | * | ||
78 | * 1) irq_work_exit happens | ||
79 | * 2) generates perf sample | ||
80 | * 3) generates irq_work | ||
81 | * 4) goto 1 | ||
82 | */ | ||
83 | TRACE_EVENT_PERF_PERM(irq_work_exit, is_sampling_event(p_event) ? -EPERM : 0); | ||
84 | |||
85 | /* | ||
75 | * call_function - called when entering/exiting a call function interrupt | 86 | * call_function - called when entering/exiting a call function interrupt |
76 | * vector handler | 87 | * vector handler |
77 | */ | 88 | */ |
diff --git a/arch/x86/kernel/reboot.c b/arch/x86/kernel/reboot.c index da3c599584a3..c752cb43e52f 100644 --- a/arch/x86/kernel/reboot.c +++ b/arch/x86/kernel/reboot.c | |||
@@ -558,6 +558,17 @@ void native_machine_shutdown(void) | |||
558 | { | 558 | { |
559 | /* Stop the cpus and apics */ | 559 | /* Stop the cpus and apics */ |
560 | #ifdef CONFIG_X86_IO_APIC | 560 | #ifdef CONFIG_X86_IO_APIC |
561 | /* | ||
562 | * Disabling IO APIC before local APIC is a workaround for | ||
563 | * erratum AVR31 in "Intel Atom Processor C2000 Product Family | ||
564 | * Specification Update". In this situation, interrupts that target | ||
565 | * a Logical Processor whose Local APIC is either in the process of | ||
566 | * being hardware disabled or software disabled are neither delivered | ||
567 | * nor discarded. When this erratum occurs, the processor may hang. | ||
568 | * | ||
569 | * Even without the erratum, it still makes sense to quiet IO APIC | ||
570 | * before disabling Local APIC. | ||
571 | */ | ||
561 | disable_IO_APIC(); | 572 | disable_IO_APIC(); |
562 | #endif | 573 | #endif |
563 | 574 | ||
diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c index 5439117d5c4c..dec48bfaddb8 100644 --- a/arch/x86/kvm/lapic.c +++ b/arch/x86/kvm/lapic.c | |||
@@ -143,6 +143,8 @@ static inline int kvm_apic_id(struct kvm_lapic *apic) | |||
143 | return (kvm_apic_get_reg(apic, APIC_ID) >> 24) & 0xff; | 143 | return (kvm_apic_get_reg(apic, APIC_ID) >> 24) & 0xff; |
144 | } | 144 | } |
145 | 145 | ||
146 | #define KVM_X2APIC_CID_BITS 0 | ||
147 | |||
146 | static void recalculate_apic_map(struct kvm *kvm) | 148 | static void recalculate_apic_map(struct kvm *kvm) |
147 | { | 149 | { |
148 | struct kvm_apic_map *new, *old = NULL; | 150 | struct kvm_apic_map *new, *old = NULL; |
@@ -180,7 +182,8 @@ static void recalculate_apic_map(struct kvm *kvm) | |||
180 | if (apic_x2apic_mode(apic)) { | 182 | if (apic_x2apic_mode(apic)) { |
181 | new->ldr_bits = 32; | 183 | new->ldr_bits = 32; |
182 | new->cid_shift = 16; | 184 | new->cid_shift = 16; |
183 | new->cid_mask = new->lid_mask = 0xffff; | 185 | new->cid_mask = (1 << KVM_X2APIC_CID_BITS) - 1; |
186 | new->lid_mask = 0xffff; | ||
184 | } else if (kvm_apic_sw_enabled(apic) && | 187 | } else if (kvm_apic_sw_enabled(apic) && |
185 | !new->cid_mask /* flat mode */ && | 188 | !new->cid_mask /* flat mode */ && |
186 | kvm_apic_get_reg(apic, APIC_DFR) == APIC_DFR_CLUSTER) { | 189 | kvm_apic_get_reg(apic, APIC_DFR) == APIC_DFR_CLUSTER) { |
@@ -841,7 +844,8 @@ static u32 apic_get_tmcct(struct kvm_lapic *apic) | |||
841 | ASSERT(apic != NULL); | 844 | ASSERT(apic != NULL); |
842 | 845 | ||
843 | /* if initial count is 0, current count should also be 0 */ | 846 | /* if initial count is 0, current count should also be 0 */ |
844 | if (kvm_apic_get_reg(apic, APIC_TMICT) == 0) | 847 | if (kvm_apic_get_reg(apic, APIC_TMICT) == 0 || |
848 | apic->lapic_timer.period == 0) | ||
845 | return 0; | 849 | return 0; |
846 | 850 | ||
847 | remaining = hrtimer_get_remaining(&apic->lapic_timer.timer); | 851 | remaining = hrtimer_get_remaining(&apic->lapic_timer.timer); |
@@ -1691,7 +1695,6 @@ static void apic_sync_pv_eoi_from_guest(struct kvm_vcpu *vcpu, | |||
1691 | void kvm_lapic_sync_from_vapic(struct kvm_vcpu *vcpu) | 1695 | void kvm_lapic_sync_from_vapic(struct kvm_vcpu *vcpu) |
1692 | { | 1696 | { |
1693 | u32 data; | 1697 | u32 data; |
1694 | void *vapic; | ||
1695 | 1698 | ||
1696 | if (test_bit(KVM_APIC_PV_EOI_PENDING, &vcpu->arch.apic_attention)) | 1699 | if (test_bit(KVM_APIC_PV_EOI_PENDING, &vcpu->arch.apic_attention)) |
1697 | apic_sync_pv_eoi_from_guest(vcpu, vcpu->arch.apic); | 1700 | apic_sync_pv_eoi_from_guest(vcpu, vcpu->arch.apic); |
@@ -1699,9 +1702,8 @@ void kvm_lapic_sync_from_vapic(struct kvm_vcpu *vcpu) | |||
1699 | if (!test_bit(KVM_APIC_CHECK_VAPIC, &vcpu->arch.apic_attention)) | 1702 | if (!test_bit(KVM_APIC_CHECK_VAPIC, &vcpu->arch.apic_attention)) |
1700 | return; | 1703 | return; |
1701 | 1704 | ||
1702 | vapic = kmap_atomic(vcpu->arch.apic->vapic_page); | 1705 | kvm_read_guest_cached(vcpu->kvm, &vcpu->arch.apic->vapic_cache, &data, |
1703 | data = *(u32 *)(vapic + offset_in_page(vcpu->arch.apic->vapic_addr)); | 1706 | sizeof(u32)); |
1704 | kunmap_atomic(vapic); | ||
1705 | 1707 | ||
1706 | apic_set_tpr(vcpu->arch.apic, data & 0xff); | 1708 | apic_set_tpr(vcpu->arch.apic, data & 0xff); |
1707 | } | 1709 | } |
@@ -1737,7 +1739,6 @@ void kvm_lapic_sync_to_vapic(struct kvm_vcpu *vcpu) | |||
1737 | u32 data, tpr; | 1739 | u32 data, tpr; |
1738 | int max_irr, max_isr; | 1740 | int max_irr, max_isr; |
1739 | struct kvm_lapic *apic = vcpu->arch.apic; | 1741 | struct kvm_lapic *apic = vcpu->arch.apic; |
1740 | void *vapic; | ||
1741 | 1742 | ||
1742 | apic_sync_pv_eoi_to_guest(vcpu, apic); | 1743 | apic_sync_pv_eoi_to_guest(vcpu, apic); |
1743 | 1744 | ||
@@ -1753,18 +1754,24 @@ void kvm_lapic_sync_to_vapic(struct kvm_vcpu *vcpu) | |||
1753 | max_isr = 0; | 1754 | max_isr = 0; |
1754 | data = (tpr & 0xff) | ((max_isr & 0xf0) << 8) | (max_irr << 24); | 1755 | data = (tpr & 0xff) | ((max_isr & 0xf0) << 8) | (max_irr << 24); |
1755 | 1756 | ||
1756 | vapic = kmap_atomic(vcpu->arch.apic->vapic_page); | 1757 | kvm_write_guest_cached(vcpu->kvm, &vcpu->arch.apic->vapic_cache, &data, |
1757 | *(u32 *)(vapic + offset_in_page(vcpu->arch.apic->vapic_addr)) = data; | 1758 | sizeof(u32)); |
1758 | kunmap_atomic(vapic); | ||
1759 | } | 1759 | } |
1760 | 1760 | ||
1761 | void kvm_lapic_set_vapic_addr(struct kvm_vcpu *vcpu, gpa_t vapic_addr) | 1761 | int kvm_lapic_set_vapic_addr(struct kvm_vcpu *vcpu, gpa_t vapic_addr) |
1762 | { | 1762 | { |
1763 | vcpu->arch.apic->vapic_addr = vapic_addr; | 1763 | if (vapic_addr) { |
1764 | if (vapic_addr) | 1764 | if (kvm_gfn_to_hva_cache_init(vcpu->kvm, |
1765 | &vcpu->arch.apic->vapic_cache, | ||
1766 | vapic_addr, sizeof(u32))) | ||
1767 | return -EINVAL; | ||
1765 | __set_bit(KVM_APIC_CHECK_VAPIC, &vcpu->arch.apic_attention); | 1768 | __set_bit(KVM_APIC_CHECK_VAPIC, &vcpu->arch.apic_attention); |
1766 | else | 1769 | } else { |
1767 | __clear_bit(KVM_APIC_CHECK_VAPIC, &vcpu->arch.apic_attention); | 1770 | __clear_bit(KVM_APIC_CHECK_VAPIC, &vcpu->arch.apic_attention); |
1771 | } | ||
1772 | |||
1773 | vcpu->arch.apic->vapic_addr = vapic_addr; | ||
1774 | return 0; | ||
1768 | } | 1775 | } |
1769 | 1776 | ||
1770 | int kvm_x2apic_msr_write(struct kvm_vcpu *vcpu, u32 msr, u64 data) | 1777 | int kvm_x2apic_msr_write(struct kvm_vcpu *vcpu, u32 msr, u64 data) |
diff --git a/arch/x86/kvm/lapic.h b/arch/x86/kvm/lapic.h index c730ac9fe801..c8b0d0d2da5c 100644 --- a/arch/x86/kvm/lapic.h +++ b/arch/x86/kvm/lapic.h | |||
@@ -34,7 +34,7 @@ struct kvm_lapic { | |||
34 | */ | 34 | */ |
35 | void *regs; | 35 | void *regs; |
36 | gpa_t vapic_addr; | 36 | gpa_t vapic_addr; |
37 | struct page *vapic_page; | 37 | struct gfn_to_hva_cache vapic_cache; |
38 | unsigned long pending_events; | 38 | unsigned long pending_events; |
39 | unsigned int sipi_vector; | 39 | unsigned int sipi_vector; |
40 | }; | 40 | }; |
@@ -76,7 +76,7 @@ void kvm_set_lapic_tscdeadline_msr(struct kvm_vcpu *vcpu, u64 data); | |||
76 | void kvm_apic_write_nodecode(struct kvm_vcpu *vcpu, u32 offset); | 76 | void kvm_apic_write_nodecode(struct kvm_vcpu *vcpu, u32 offset); |
77 | void kvm_apic_set_eoi_accelerated(struct kvm_vcpu *vcpu, int vector); | 77 | void kvm_apic_set_eoi_accelerated(struct kvm_vcpu *vcpu, int vector); |
78 | 78 | ||
79 | void kvm_lapic_set_vapic_addr(struct kvm_vcpu *vcpu, gpa_t vapic_addr); | 79 | int kvm_lapic_set_vapic_addr(struct kvm_vcpu *vcpu, gpa_t vapic_addr); |
80 | void kvm_lapic_sync_from_vapic(struct kvm_vcpu *vcpu); | 80 | void kvm_lapic_sync_from_vapic(struct kvm_vcpu *vcpu); |
81 | void kvm_lapic_sync_to_vapic(struct kvm_vcpu *vcpu); | 81 | void kvm_lapic_sync_to_vapic(struct kvm_vcpu *vcpu); |
82 | 82 | ||
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 21ef1ba184ae..5d004da1e35d 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c | |||
@@ -3214,8 +3214,7 @@ long kvm_arch_vcpu_ioctl(struct file *filp, | |||
3214 | r = -EFAULT; | 3214 | r = -EFAULT; |
3215 | if (copy_from_user(&va, argp, sizeof va)) | 3215 | if (copy_from_user(&va, argp, sizeof va)) |
3216 | goto out; | 3216 | goto out; |
3217 | r = 0; | 3217 | r = kvm_lapic_set_vapic_addr(vcpu, va.vapic_addr); |
3218 | kvm_lapic_set_vapic_addr(vcpu, va.vapic_addr); | ||
3219 | break; | 3218 | break; |
3220 | } | 3219 | } |
3221 | case KVM_X86_SETUP_MCE: { | 3220 | case KVM_X86_SETUP_MCE: { |
@@ -5739,36 +5738,6 @@ static void post_kvm_run_save(struct kvm_vcpu *vcpu) | |||
5739 | !kvm_event_needs_reinjection(vcpu); | 5738 | !kvm_event_needs_reinjection(vcpu); |
5740 | } | 5739 | } |
5741 | 5740 | ||
5742 | static int vapic_enter(struct kvm_vcpu *vcpu) | ||
5743 | { | ||
5744 | struct kvm_lapic *apic = vcpu->arch.apic; | ||
5745 | struct page *page; | ||
5746 | |||
5747 | if (!apic || !apic->vapic_addr) | ||
5748 | return 0; | ||
5749 | |||
5750 | page = gfn_to_page(vcpu->kvm, apic->vapic_addr >> PAGE_SHIFT); | ||
5751 | if (is_error_page(page)) | ||
5752 | return -EFAULT; | ||
5753 | |||
5754 | vcpu->arch.apic->vapic_page = page; | ||
5755 | return 0; | ||
5756 | } | ||
5757 | |||
5758 | static void vapic_exit(struct kvm_vcpu *vcpu) | ||
5759 | { | ||
5760 | struct kvm_lapic *apic = vcpu->arch.apic; | ||
5761 | int idx; | ||
5762 | |||
5763 | if (!apic || !apic->vapic_addr) | ||
5764 | return; | ||
5765 | |||
5766 | idx = srcu_read_lock(&vcpu->kvm->srcu); | ||
5767 | kvm_release_page_dirty(apic->vapic_page); | ||
5768 | mark_page_dirty(vcpu->kvm, apic->vapic_addr >> PAGE_SHIFT); | ||
5769 | srcu_read_unlock(&vcpu->kvm->srcu, idx); | ||
5770 | } | ||
5771 | |||
5772 | static void update_cr8_intercept(struct kvm_vcpu *vcpu) | 5741 | static void update_cr8_intercept(struct kvm_vcpu *vcpu) |
5773 | { | 5742 | { |
5774 | int max_irr, tpr; | 5743 | int max_irr, tpr; |
@@ -6069,11 +6038,6 @@ static int __vcpu_run(struct kvm_vcpu *vcpu) | |||
6069 | struct kvm *kvm = vcpu->kvm; | 6038 | struct kvm *kvm = vcpu->kvm; |
6070 | 6039 | ||
6071 | vcpu->srcu_idx = srcu_read_lock(&kvm->srcu); | 6040 | vcpu->srcu_idx = srcu_read_lock(&kvm->srcu); |
6072 | r = vapic_enter(vcpu); | ||
6073 | if (r) { | ||
6074 | srcu_read_unlock(&kvm->srcu, vcpu->srcu_idx); | ||
6075 | return r; | ||
6076 | } | ||
6077 | 6041 | ||
6078 | r = 1; | 6042 | r = 1; |
6079 | while (r > 0) { | 6043 | while (r > 0) { |
@@ -6132,8 +6096,6 @@ static int __vcpu_run(struct kvm_vcpu *vcpu) | |||
6132 | 6096 | ||
6133 | srcu_read_unlock(&kvm->srcu, vcpu->srcu_idx); | 6097 | srcu_read_unlock(&kvm->srcu, vcpu->srcu_idx); |
6134 | 6098 | ||
6135 | vapic_exit(vcpu); | ||
6136 | |||
6137 | return r; | 6099 | return r; |
6138 | } | 6100 | } |
6139 | 6101 | ||
diff --git a/arch/x86/platform/efi/early_printk.c b/arch/x86/platform/efi/early_printk.c index 6599a0027b76..81b506d5befd 100644 --- a/arch/x86/platform/efi/early_printk.c +++ b/arch/x86/platform/efi/early_printk.c | |||
@@ -142,7 +142,7 @@ early_efi_write(struct console *con, const char *str, unsigned int num) | |||
142 | efi_y += font->height; | 142 | efi_y += font->height; |
143 | } | 143 | } |
144 | 144 | ||
145 | if (efi_y + font->height >= si->lfb_height) { | 145 | if (efi_y + font->height > si->lfb_height) { |
146 | u32 i; | 146 | u32 i; |
147 | 147 | ||
148 | efi_y -= font->height; | 148 | efi_y -= font->height; |
diff --git a/arch/x86/platform/efi/efi.c b/arch/x86/platform/efi/efi.c index 92c02344a060..cceb813044ef 100644 --- a/arch/x86/platform/efi/efi.c +++ b/arch/x86/platform/efi/efi.c | |||
@@ -690,13 +690,6 @@ void __init efi_init(void) | |||
690 | 690 | ||
691 | set_bit(EFI_MEMMAP, &x86_efi_facility); | 691 | set_bit(EFI_MEMMAP, &x86_efi_facility); |
692 | 692 | ||
693 | #ifdef CONFIG_X86_32 | ||
694 | if (efi_is_native()) { | ||
695 | x86_platform.get_wallclock = efi_get_time; | ||
696 | x86_platform.set_wallclock = efi_set_rtc_mmss; | ||
697 | } | ||
698 | #endif | ||
699 | |||
700 | #if EFI_DEBUG | 693 | #if EFI_DEBUG |
701 | print_efi_memmap(); | 694 | print_efi_memmap(); |
702 | #endif | 695 | #endif |
diff --git a/arch/x86/platform/uv/tlb_uv.c b/arch/x86/platform/uv/tlb_uv.c index 0f92173a12b6..efe4d7220397 100644 --- a/arch/x86/platform/uv/tlb_uv.c +++ b/arch/x86/platform/uv/tlb_uv.c | |||
@@ -1070,12 +1070,13 @@ const struct cpumask *uv_flush_tlb_others(const struct cpumask *cpumask, | |||
1070 | unsigned long status; | 1070 | unsigned long status; |
1071 | 1071 | ||
1072 | bcp = &per_cpu(bau_control, cpu); | 1072 | bcp = &per_cpu(bau_control, cpu); |
1073 | stat = bcp->statp; | ||
1074 | stat->s_enters++; | ||
1075 | 1073 | ||
1076 | if (bcp->nobau) | 1074 | if (bcp->nobau) |
1077 | return cpumask; | 1075 | return cpumask; |
1078 | 1076 | ||
1077 | stat = bcp->statp; | ||
1078 | stat->s_enters++; | ||
1079 | |||
1079 | if (bcp->busy) { | 1080 | if (bcp->busy) { |
1080 | descriptor_status = | 1081 | descriptor_status = |
1081 | read_lmmr(UVH_LB_BAU_SB_ACTIVATION_STATUS_0); | 1082 | read_lmmr(UVH_LB_BAU_SB_ACTIVATION_STATUS_0); |
diff --git a/arch/x86/realmode/rm/Makefile b/arch/x86/realmode/rm/Makefile index 88692871823f..9cac82588cbc 100644 --- a/arch/x86/realmode/rm/Makefile +++ b/arch/x86/realmode/rm/Makefile | |||
@@ -73,9 +73,10 @@ KBUILD_CFLAGS := $(LINUXINCLUDE) -m32 -g -Os -D_SETUP -D__KERNEL__ -D_WAKEUP \ | |||
73 | -march=i386 -mregparm=3 \ | 73 | -march=i386 -mregparm=3 \ |
74 | -include $(srctree)/$(src)/../../boot/code16gcc.h \ | 74 | -include $(srctree)/$(src)/../../boot/code16gcc.h \ |
75 | -fno-strict-aliasing -fomit-frame-pointer -fno-pic \ | 75 | -fno-strict-aliasing -fomit-frame-pointer -fno-pic \ |
76 | -mno-mmx -mno-sse \ | ||
76 | $(call cc-option, -ffreestanding) \ | 77 | $(call cc-option, -ffreestanding) \ |
77 | $(call cc-option, -fno-toplevel-reorder,\ | 78 | $(call cc-option, -fno-toplevel-reorder,\ |
78 | $(call cc-option, -fno-unit-at-a-time)) \ | 79 | $(call cc-option, -fno-unit-at-a-time)) \ |
79 | $(call cc-option, -fno-stack-protector) \ | 80 | $(call cc-option, -fno-stack-protector) \ |
80 | $(call cc-option, -mpreferred-stack-boundary=2) | 81 | $(call cc-option, -mpreferred-stack-boundary=2) |
81 | KBUILD_AFLAGS := $(KBUILD_CFLAGS) -D__ASSEMBLY__ | 82 | KBUILD_AFLAGS := $(KBUILD_CFLAGS) -D__ASSEMBLY__ |
diff --git a/block/blk-cgroup.h b/block/blk-cgroup.h index 1610b22edf09..86154eab9523 100644 --- a/block/blk-cgroup.h +++ b/block/blk-cgroup.h | |||
@@ -435,9 +435,9 @@ static inline uint64_t blkg_stat_read(struct blkg_stat *stat) | |||
435 | uint64_t v; | 435 | uint64_t v; |
436 | 436 | ||
437 | do { | 437 | do { |
438 | start = u64_stats_fetch_begin(&stat->syncp); | 438 | start = u64_stats_fetch_begin_bh(&stat->syncp); |
439 | v = stat->cnt; | 439 | v = stat->cnt; |
440 | } while (u64_stats_fetch_retry(&stat->syncp, start)); | 440 | } while (u64_stats_fetch_retry_bh(&stat->syncp, start)); |
441 | 441 | ||
442 | return v; | 442 | return v; |
443 | } | 443 | } |
@@ -508,9 +508,9 @@ static inline struct blkg_rwstat blkg_rwstat_read(struct blkg_rwstat *rwstat) | |||
508 | struct blkg_rwstat tmp; | 508 | struct blkg_rwstat tmp; |
509 | 509 | ||
510 | do { | 510 | do { |
511 | start = u64_stats_fetch_begin(&rwstat->syncp); | 511 | start = u64_stats_fetch_begin_bh(&rwstat->syncp); |
512 | tmp = *rwstat; | 512 | tmp = *rwstat; |
513 | } while (u64_stats_fetch_retry(&rwstat->syncp, start)); | 513 | } while (u64_stats_fetch_retry_bh(&rwstat->syncp, start)); |
514 | 514 | ||
515 | return tmp; | 515 | return tmp; |
516 | } | 516 | } |
diff --git a/block/blk-flush.c b/block/blk-flush.c index 331e627301ea..fb6f3c0ffa49 100644 --- a/block/blk-flush.c +++ b/block/blk-flush.c | |||
@@ -502,15 +502,6 @@ void blk_abort_flushes(struct request_queue *q) | |||
502 | } | 502 | } |
503 | } | 503 | } |
504 | 504 | ||
505 | static void bio_end_flush(struct bio *bio, int err) | ||
506 | { | ||
507 | if (err) | ||
508 | clear_bit(BIO_UPTODATE, &bio->bi_flags); | ||
509 | if (bio->bi_private) | ||
510 | complete(bio->bi_private); | ||
511 | bio_put(bio); | ||
512 | } | ||
513 | |||
514 | /** | 505 | /** |
515 | * blkdev_issue_flush - queue a flush | 506 | * blkdev_issue_flush - queue a flush |
516 | * @bdev: blockdev to issue flush for | 507 | * @bdev: blockdev to issue flush for |
@@ -526,7 +517,6 @@ static void bio_end_flush(struct bio *bio, int err) | |||
526 | int blkdev_issue_flush(struct block_device *bdev, gfp_t gfp_mask, | 517 | int blkdev_issue_flush(struct block_device *bdev, gfp_t gfp_mask, |
527 | sector_t *error_sector) | 518 | sector_t *error_sector) |
528 | { | 519 | { |
529 | DECLARE_COMPLETION_ONSTACK(wait); | ||
530 | struct request_queue *q; | 520 | struct request_queue *q; |
531 | struct bio *bio; | 521 | struct bio *bio; |
532 | int ret = 0; | 522 | int ret = 0; |
@@ -548,13 +538,9 @@ int blkdev_issue_flush(struct block_device *bdev, gfp_t gfp_mask, | |||
548 | return -ENXIO; | 538 | return -ENXIO; |
549 | 539 | ||
550 | bio = bio_alloc(gfp_mask, 0); | 540 | bio = bio_alloc(gfp_mask, 0); |
551 | bio->bi_end_io = bio_end_flush; | ||
552 | bio->bi_bdev = bdev; | 541 | bio->bi_bdev = bdev; |
553 | bio->bi_private = &wait; | ||
554 | 542 | ||
555 | bio_get(bio); | 543 | ret = submit_bio_wait(WRITE_FLUSH, bio); |
556 | submit_bio(WRITE_FLUSH, bio); | ||
557 | wait_for_completion_io(&wait); | ||
558 | 544 | ||
559 | /* | 545 | /* |
560 | * The driver must store the error location in ->bi_sector, if | 546 | * The driver must store the error location in ->bi_sector, if |
@@ -564,9 +550,6 @@ int blkdev_issue_flush(struct block_device *bdev, gfp_t gfp_mask, | |||
564 | if (error_sector) | 550 | if (error_sector) |
565 | *error_sector = bio->bi_sector; | 551 | *error_sector = bio->bi_sector; |
566 | 552 | ||
567 | if (!bio_flagged(bio, BIO_UPTODATE)) | ||
568 | ret = -EIO; | ||
569 | |||
570 | bio_put(bio); | 553 | bio_put(bio); |
571 | return ret; | 554 | return ret; |
572 | } | 555 | } |
diff --git a/block/blk-mq.c b/block/blk-mq.c index cdc629cf075b..c79126e11030 100644 --- a/block/blk-mq.c +++ b/block/blk-mq.c | |||
@@ -202,10 +202,12 @@ static struct request *blk_mq_alloc_request_pinned(struct request_queue *q, | |||
202 | if (rq) { | 202 | if (rq) { |
203 | blk_mq_rq_ctx_init(q, ctx, rq, rw); | 203 | blk_mq_rq_ctx_init(q, ctx, rq, rw); |
204 | break; | 204 | break; |
205 | } else if (!(gfp & __GFP_WAIT)) | 205 | } |
206 | break; | ||
207 | 206 | ||
208 | blk_mq_put_ctx(ctx); | 207 | blk_mq_put_ctx(ctx); |
208 | if (!(gfp & __GFP_WAIT)) | ||
209 | break; | ||
210 | |||
209 | __blk_mq_run_hw_queue(hctx); | 211 | __blk_mq_run_hw_queue(hctx); |
210 | blk_mq_wait_for_tags(hctx->tags); | 212 | blk_mq_wait_for_tags(hctx->tags); |
211 | } while (1); | 213 | } while (1); |
@@ -222,7 +224,8 @@ struct request *blk_mq_alloc_request(struct request_queue *q, int rw, | |||
222 | return NULL; | 224 | return NULL; |
223 | 225 | ||
224 | rq = blk_mq_alloc_request_pinned(q, rw, gfp, reserved); | 226 | rq = blk_mq_alloc_request_pinned(q, rw, gfp, reserved); |
225 | blk_mq_put_ctx(rq->mq_ctx); | 227 | if (rq) |
228 | blk_mq_put_ctx(rq->mq_ctx); | ||
226 | return rq; | 229 | return rq; |
227 | } | 230 | } |
228 | 231 | ||
@@ -235,7 +238,8 @@ struct request *blk_mq_alloc_reserved_request(struct request_queue *q, int rw, | |||
235 | return NULL; | 238 | return NULL; |
236 | 239 | ||
237 | rq = blk_mq_alloc_request_pinned(q, rw, gfp, true); | 240 | rq = blk_mq_alloc_request_pinned(q, rw, gfp, true); |
238 | blk_mq_put_ctx(rq->mq_ctx); | 241 | if (rq) |
242 | blk_mq_put_ctx(rq->mq_ctx); | ||
239 | return rq; | 243 | return rq; |
240 | } | 244 | } |
241 | EXPORT_SYMBOL(blk_mq_alloc_reserved_request); | 245 | EXPORT_SYMBOL(blk_mq_alloc_reserved_request); |
@@ -308,12 +312,12 @@ void blk_mq_complete_request(struct request *rq, int error) | |||
308 | 312 | ||
309 | blk_account_io_completion(rq, bytes); | 313 | blk_account_io_completion(rq, bytes); |
310 | 314 | ||
315 | blk_account_io_done(rq); | ||
316 | |||
311 | if (rq->end_io) | 317 | if (rq->end_io) |
312 | rq->end_io(rq, error); | 318 | rq->end_io(rq, error); |
313 | else | 319 | else |
314 | blk_mq_free_request(rq); | 320 | blk_mq_free_request(rq); |
315 | |||
316 | blk_account_io_done(rq); | ||
317 | } | 321 | } |
318 | 322 | ||
319 | void __blk_mq_end_io(struct request *rq, int error) | 323 | void __blk_mq_end_io(struct request *rq, int error) |
diff --git a/crypto/algif_hash.c b/crypto/algif_hash.c index ef5356cd280a..850246206b12 100644 --- a/crypto/algif_hash.c +++ b/crypto/algif_hash.c | |||
@@ -114,6 +114,9 @@ static ssize_t hash_sendpage(struct socket *sock, struct page *page, | |||
114 | struct hash_ctx *ctx = ask->private; | 114 | struct hash_ctx *ctx = ask->private; |
115 | int err; | 115 | int err; |
116 | 116 | ||
117 | if (flags & MSG_SENDPAGE_NOTLAST) | ||
118 | flags |= MSG_MORE; | ||
119 | |||
117 | lock_sock(sk); | 120 | lock_sock(sk); |
118 | sg_init_table(ctx->sgl.sg, 1); | 121 | sg_init_table(ctx->sgl.sg, 1); |
119 | sg_set_page(ctx->sgl.sg, page, size, offset); | 122 | sg_set_page(ctx->sgl.sg, page, size, offset); |
diff --git a/crypto/algif_skcipher.c b/crypto/algif_skcipher.c index 6a6dfc062d2a..a19c027b29bd 100644 --- a/crypto/algif_skcipher.c +++ b/crypto/algif_skcipher.c | |||
@@ -378,6 +378,9 @@ static ssize_t skcipher_sendpage(struct socket *sock, struct page *page, | |||
378 | struct skcipher_sg_list *sgl; | 378 | struct skcipher_sg_list *sgl; |
379 | int err = -EINVAL; | 379 | int err = -EINVAL; |
380 | 380 | ||
381 | if (flags & MSG_SENDPAGE_NOTLAST) | ||
382 | flags |= MSG_MORE; | ||
383 | |||
381 | lock_sock(sk); | 384 | lock_sock(sk); |
382 | if (!ctx->more && ctx->used) | 385 | if (!ctx->more && ctx->used) |
383 | goto unlock; | 386 | goto unlock; |
diff --git a/crypto/authenc.c b/crypto/authenc.c index 1875e7026e8f..e1223559d5df 100644 --- a/crypto/authenc.c +++ b/crypto/authenc.c | |||
@@ -380,9 +380,10 @@ static void crypto_authenc_encrypt_done(struct crypto_async_request *req, | |||
380 | if (!err) { | 380 | if (!err) { |
381 | struct crypto_aead *authenc = crypto_aead_reqtfm(areq); | 381 | struct crypto_aead *authenc = crypto_aead_reqtfm(areq); |
382 | struct crypto_authenc_ctx *ctx = crypto_aead_ctx(authenc); | 382 | struct crypto_authenc_ctx *ctx = crypto_aead_ctx(authenc); |
383 | struct ablkcipher_request *abreq = aead_request_ctx(areq); | 383 | struct authenc_request_ctx *areq_ctx = aead_request_ctx(areq); |
384 | u8 *iv = (u8 *)(abreq + 1) + | 384 | struct ablkcipher_request *abreq = (void *)(areq_ctx->tail |
385 | crypto_ablkcipher_reqsize(ctx->enc); | 385 | + ctx->reqoff); |
386 | u8 *iv = (u8 *)abreq - crypto_ablkcipher_ivsize(ctx->enc); | ||
386 | 387 | ||
387 | err = crypto_authenc_genicv(areq, iv, 0); | 388 | err = crypto_authenc_genicv(areq, iv, 0); |
388 | } | 389 | } |
diff --git a/crypto/ccm.c b/crypto/ccm.c index 3e05499d183a..1df84217f7c9 100644 --- a/crypto/ccm.c +++ b/crypto/ccm.c | |||
@@ -271,7 +271,8 @@ static int crypto_ccm_auth(struct aead_request *req, struct scatterlist *plain, | |||
271 | } | 271 | } |
272 | 272 | ||
273 | /* compute plaintext into mac */ | 273 | /* compute plaintext into mac */ |
274 | get_data_to_compute(cipher, pctx, plain, cryptlen); | 274 | if (cryptlen) |
275 | get_data_to_compute(cipher, pctx, plain, cryptlen); | ||
275 | 276 | ||
276 | out: | 277 | out: |
277 | return err; | 278 | return err; |
diff --git a/crypto/tcrypt.c b/crypto/tcrypt.c index 1ab8258fcf56..001f07cdb828 100644 --- a/crypto/tcrypt.c +++ b/crypto/tcrypt.c | |||
@@ -1242,6 +1242,10 @@ static int do_test(int m) | |||
1242 | ret += tcrypt_test("cmac(des3_ede)"); | 1242 | ret += tcrypt_test("cmac(des3_ede)"); |
1243 | break; | 1243 | break; |
1244 | 1244 | ||
1245 | case 155: | ||
1246 | ret += tcrypt_test("authenc(hmac(sha1),cbc(aes))"); | ||
1247 | break; | ||
1248 | |||
1245 | case 200: | 1249 | case 200: |
1246 | test_cipher_speed("ecb(aes)", ENCRYPT, sec, NULL, 0, | 1250 | test_cipher_speed("ecb(aes)", ENCRYPT, sec, NULL, 0, |
1247 | speed_template_16_24_32); | 1251 | speed_template_16_24_32); |
diff --git a/crypto/testmgr.c b/crypto/testmgr.c index 432afc03e7c3..77955507f6f1 100644 --- a/crypto/testmgr.c +++ b/crypto/testmgr.c | |||
@@ -503,16 +503,16 @@ static int __test_aead(struct crypto_aead *tfm, int enc, | |||
503 | goto out; | 503 | goto out; |
504 | } | 504 | } |
505 | 505 | ||
506 | sg_init_one(&sg[0], input, | ||
507 | template[i].ilen + (enc ? authsize : 0)); | ||
508 | |||
509 | if (diff_dst) { | 506 | if (diff_dst) { |
510 | output = xoutbuf[0]; | 507 | output = xoutbuf[0]; |
511 | output += align_offset; | 508 | output += align_offset; |
509 | sg_init_one(&sg[0], input, template[i].ilen); | ||
512 | sg_init_one(&sgout[0], output, | 510 | sg_init_one(&sgout[0], output, |
511 | template[i].rlen); | ||
512 | } else { | ||
513 | sg_init_one(&sg[0], input, | ||
513 | template[i].ilen + | 514 | template[i].ilen + |
514 | (enc ? authsize : 0)); | 515 | (enc ? authsize : 0)); |
515 | } else { | ||
516 | output = input; | 516 | output = input; |
517 | } | 517 | } |
518 | 518 | ||
@@ -612,12 +612,6 @@ static int __test_aead(struct crypto_aead *tfm, int enc, | |||
612 | memcpy(q, template[i].input + temp, | 612 | memcpy(q, template[i].input + temp, |
613 | template[i].tap[k]); | 613 | template[i].tap[k]); |
614 | 614 | ||
615 | n = template[i].tap[k]; | ||
616 | if (k == template[i].np - 1 && enc) | ||
617 | n += authsize; | ||
618 | if (offset_in_page(q) + n < PAGE_SIZE) | ||
619 | q[n] = 0; | ||
620 | |||
621 | sg_set_buf(&sg[k], q, template[i].tap[k]); | 615 | sg_set_buf(&sg[k], q, template[i].tap[k]); |
622 | 616 | ||
623 | if (diff_dst) { | 617 | if (diff_dst) { |
@@ -625,13 +619,17 @@ static int __test_aead(struct crypto_aead *tfm, int enc, | |||
625 | offset_in_page(IDX[k]); | 619 | offset_in_page(IDX[k]); |
626 | 620 | ||
627 | memset(q, 0, template[i].tap[k]); | 621 | memset(q, 0, template[i].tap[k]); |
628 | if (offset_in_page(q) + n < PAGE_SIZE) | ||
629 | q[n] = 0; | ||
630 | 622 | ||
631 | sg_set_buf(&sgout[k], q, | 623 | sg_set_buf(&sgout[k], q, |
632 | template[i].tap[k]); | 624 | template[i].tap[k]); |
633 | } | 625 | } |
634 | 626 | ||
627 | n = template[i].tap[k]; | ||
628 | if (k == template[i].np - 1 && enc) | ||
629 | n += authsize; | ||
630 | if (offset_in_page(q) + n < PAGE_SIZE) | ||
631 | q[n] = 0; | ||
632 | |||
635 | temp += template[i].tap[k]; | 633 | temp += template[i].tap[k]; |
636 | } | 634 | } |
637 | 635 | ||
@@ -650,10 +648,10 @@ static int __test_aead(struct crypto_aead *tfm, int enc, | |||
650 | goto out; | 648 | goto out; |
651 | } | 649 | } |
652 | 650 | ||
653 | sg[k - 1].length += authsize; | ||
654 | |||
655 | if (diff_dst) | 651 | if (diff_dst) |
656 | sgout[k - 1].length += authsize; | 652 | sgout[k - 1].length += authsize; |
653 | else | ||
654 | sg[k - 1].length += authsize; | ||
657 | } | 655 | } |
658 | 656 | ||
659 | sg_init_table(asg, template[i].anp); | 657 | sg_init_table(asg, template[i].anp); |
diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c index db6dfcfa3e2e..ab58556d347c 100644 --- a/drivers/ata/libata-scsi.c +++ b/drivers/ata/libata-scsi.c | |||
@@ -3625,6 +3625,7 @@ int ata_scsi_add_hosts(struct ata_host *host, struct scsi_host_template *sht) | |||
3625 | shost->max_lun = 1; | 3625 | shost->max_lun = 1; |
3626 | shost->max_channel = 1; | 3626 | shost->max_channel = 1; |
3627 | shost->max_cmd_len = 16; | 3627 | shost->max_cmd_len = 16; |
3628 | shost->no_write_same = 1; | ||
3628 | 3629 | ||
3629 | /* Schedule policy is determined by ->qc_defer() | 3630 | /* Schedule policy is determined by ->qc_defer() |
3630 | * callback and it needs to see every deferred qc. | 3631 | * callback and it needs to see every deferred qc. |
diff --git a/drivers/base/regmap/regmap-mmio.c b/drivers/base/regmap/regmap-mmio.c index 98745dd77e8c..81f977510775 100644 --- a/drivers/base/regmap/regmap-mmio.c +++ b/drivers/base/regmap/regmap-mmio.c | |||
@@ -40,7 +40,7 @@ static int regmap_mmio_gather_write(void *context, | |||
40 | 40 | ||
41 | BUG_ON(reg_size != 4); | 41 | BUG_ON(reg_size != 4); |
42 | 42 | ||
43 | if (ctx->clk) { | 43 | if (!IS_ERR(ctx->clk)) { |
44 | ret = clk_enable(ctx->clk); | 44 | ret = clk_enable(ctx->clk); |
45 | if (ret < 0) | 45 | if (ret < 0) |
46 | return ret; | 46 | return ret; |
@@ -73,7 +73,7 @@ static int regmap_mmio_gather_write(void *context, | |||
73 | offset += ctx->val_bytes; | 73 | offset += ctx->val_bytes; |
74 | } | 74 | } |
75 | 75 | ||
76 | if (ctx->clk) | 76 | if (!IS_ERR(ctx->clk)) |
77 | clk_disable(ctx->clk); | 77 | clk_disable(ctx->clk); |
78 | 78 | ||
79 | return 0; | 79 | return 0; |
@@ -96,7 +96,7 @@ static int regmap_mmio_read(void *context, | |||
96 | 96 | ||
97 | BUG_ON(reg_size != 4); | 97 | BUG_ON(reg_size != 4); |
98 | 98 | ||
99 | if (ctx->clk) { | 99 | if (!IS_ERR(ctx->clk)) { |
100 | ret = clk_enable(ctx->clk); | 100 | ret = clk_enable(ctx->clk); |
101 | if (ret < 0) | 101 | if (ret < 0) |
102 | return ret; | 102 | return ret; |
@@ -129,7 +129,7 @@ static int regmap_mmio_read(void *context, | |||
129 | offset += ctx->val_bytes; | 129 | offset += ctx->val_bytes; |
130 | } | 130 | } |
131 | 131 | ||
132 | if (ctx->clk) | 132 | if (!IS_ERR(ctx->clk)) |
133 | clk_disable(ctx->clk); | 133 | clk_disable(ctx->clk); |
134 | 134 | ||
135 | return 0; | 135 | return 0; |
@@ -139,7 +139,7 @@ static void regmap_mmio_free_context(void *context) | |||
139 | { | 139 | { |
140 | struct regmap_mmio_context *ctx = context; | 140 | struct regmap_mmio_context *ctx = context; |
141 | 141 | ||
142 | if (ctx->clk) { | 142 | if (!IS_ERR(ctx->clk)) { |
143 | clk_unprepare(ctx->clk); | 143 | clk_unprepare(ctx->clk); |
144 | clk_put(ctx->clk); | 144 | clk_put(ctx->clk); |
145 | } | 145 | } |
@@ -209,6 +209,7 @@ static struct regmap_mmio_context *regmap_mmio_gen_context(struct device *dev, | |||
209 | 209 | ||
210 | ctx->regs = regs; | 210 | ctx->regs = regs; |
211 | ctx->val_bytes = config->val_bits / 8; | 211 | ctx->val_bytes = config->val_bits / 8; |
212 | ctx->clk = ERR_PTR(-ENODEV); | ||
212 | 213 | ||
213 | if (clk_id == NULL) | 214 | if (clk_id == NULL) |
214 | return ctx; | 215 | return ctx; |
diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c index 9c021d9cace0..c2e002100949 100644 --- a/drivers/base/regmap/regmap.c +++ b/drivers/base/regmap/regmap.c | |||
@@ -1549,7 +1549,7 @@ int regmap_bulk_write(struct regmap *map, unsigned int reg, const void *val, | |||
1549 | val + (i * val_bytes), | 1549 | val + (i * val_bytes), |
1550 | val_bytes); | 1550 | val_bytes); |
1551 | if (ret != 0) | 1551 | if (ret != 0) |
1552 | return ret; | 1552 | goto out; |
1553 | } | 1553 | } |
1554 | } else { | 1554 | } else { |
1555 | ret = _regmap_raw_write(map, reg, wval, val_bytes * val_count); | 1555 | ret = _regmap_raw_write(map, reg, wval, val_bytes * val_count); |
@@ -1743,7 +1743,7 @@ static int _regmap_read(struct regmap *map, unsigned int reg, | |||
1743 | /** | 1743 | /** |
1744 | * regmap_read(): Read a value from a single register | 1744 | * regmap_read(): Read a value from a single register |
1745 | * | 1745 | * |
1746 | * @map: Register map to write to | 1746 | * @map: Register map to read from |
1747 | * @reg: Register to be read from | 1747 | * @reg: Register to be read from |
1748 | * @val: Pointer to store read value | 1748 | * @val: Pointer to store read value |
1749 | * | 1749 | * |
@@ -1770,7 +1770,7 @@ EXPORT_SYMBOL_GPL(regmap_read); | |||
1770 | /** | 1770 | /** |
1771 | * regmap_raw_read(): Read raw data from the device | 1771 | * regmap_raw_read(): Read raw data from the device |
1772 | * | 1772 | * |
1773 | * @map: Register map to write to | 1773 | * @map: Register map to read from |
1774 | * @reg: First register to be read from | 1774 | * @reg: First register to be read from |
1775 | * @val: Pointer to store read value | 1775 | * @val: Pointer to store read value |
1776 | * @val_len: Size of data to read | 1776 | * @val_len: Size of data to read |
@@ -1882,7 +1882,7 @@ EXPORT_SYMBOL_GPL(regmap_fields_read); | |||
1882 | /** | 1882 | /** |
1883 | * regmap_bulk_read(): Read multiple registers from the device | 1883 | * regmap_bulk_read(): Read multiple registers from the device |
1884 | * | 1884 | * |
1885 | * @map: Register map to write to | 1885 | * @map: Register map to read from |
1886 | * @reg: First register to be read from | 1886 | * @reg: First register to be read from |
1887 | * @val: Pointer to store read value, in native register size for device | 1887 | * @val: Pointer to store read value, in native register size for device |
1888 | * @val_count: Number of registers to read | 1888 | * @val_count: Number of registers to read |
diff --git a/drivers/block/null_blk.c b/drivers/block/null_blk.c index ea192ec029c4..f370fc13aea5 100644 --- a/drivers/block/null_blk.c +++ b/drivers/block/null_blk.c | |||
@@ -495,23 +495,23 @@ static int null_add_dev(void) | |||
495 | 495 | ||
496 | spin_lock_init(&nullb->lock); | 496 | spin_lock_init(&nullb->lock); |
497 | 497 | ||
498 | if (queue_mode == NULL_Q_MQ && use_per_node_hctx) | ||
499 | submit_queues = nr_online_nodes; | ||
500 | |||
498 | if (setup_queues(nullb)) | 501 | if (setup_queues(nullb)) |
499 | goto err; | 502 | goto err; |
500 | 503 | ||
501 | if (queue_mode == NULL_Q_MQ) { | 504 | if (queue_mode == NULL_Q_MQ) { |
502 | null_mq_reg.numa_node = home_node; | 505 | null_mq_reg.numa_node = home_node; |
503 | null_mq_reg.queue_depth = hw_queue_depth; | 506 | null_mq_reg.queue_depth = hw_queue_depth; |
507 | null_mq_reg.nr_hw_queues = submit_queues; | ||
504 | 508 | ||
505 | if (use_per_node_hctx) { | 509 | if (use_per_node_hctx) { |
506 | null_mq_reg.ops->alloc_hctx = null_alloc_hctx; | 510 | null_mq_reg.ops->alloc_hctx = null_alloc_hctx; |
507 | null_mq_reg.ops->free_hctx = null_free_hctx; | 511 | null_mq_reg.ops->free_hctx = null_free_hctx; |
508 | |||
509 | null_mq_reg.nr_hw_queues = nr_online_nodes; | ||
510 | } else { | 512 | } else { |
511 | null_mq_reg.ops->alloc_hctx = blk_mq_alloc_single_hw_queue; | 513 | null_mq_reg.ops->alloc_hctx = blk_mq_alloc_single_hw_queue; |
512 | null_mq_reg.ops->free_hctx = blk_mq_free_single_hw_queue; | 514 | null_mq_reg.ops->free_hctx = blk_mq_free_single_hw_queue; |
513 | |||
514 | null_mq_reg.nr_hw_queues = submit_queues; | ||
515 | } | 515 | } |
516 | 516 | ||
517 | nullb->q = blk_mq_init_queue(&null_mq_reg, nullb); | 517 | nullb->q = blk_mq_init_queue(&null_mq_reg, nullb); |
diff --git a/drivers/block/xen-blkfront.c b/drivers/block/xen-blkfront.c index 432db1b59b00..c4a4c9006288 100644 --- a/drivers/block/xen-blkfront.c +++ b/drivers/block/xen-blkfront.c | |||
@@ -489,7 +489,7 @@ static int blkif_queue_request(struct request *req) | |||
489 | 489 | ||
490 | if ((ring_req->operation == BLKIF_OP_INDIRECT) && | 490 | if ((ring_req->operation == BLKIF_OP_INDIRECT) && |
491 | (i % SEGS_PER_INDIRECT_FRAME == 0)) { | 491 | (i % SEGS_PER_INDIRECT_FRAME == 0)) { |
492 | unsigned long pfn; | 492 | unsigned long uninitialized_var(pfn); |
493 | 493 | ||
494 | if (segments) | 494 | if (segments) |
495 | kunmap_atomic(segments); | 495 | kunmap_atomic(segments); |
@@ -2011,6 +2011,10 @@ static void blkif_release(struct gendisk *disk, fmode_t mode) | |||
2011 | 2011 | ||
2012 | bdev = bdget_disk(disk, 0); | 2012 | bdev = bdget_disk(disk, 0); |
2013 | 2013 | ||
2014 | if (!bdev) { | ||
2015 | WARN(1, "Block device %s yanked out from us!\n", disk->disk_name); | ||
2016 | goto out_mutex; | ||
2017 | } | ||
2014 | if (bdev->bd_openers) | 2018 | if (bdev->bd_openers) |
2015 | goto out; | 2019 | goto out; |
2016 | 2020 | ||
@@ -2041,6 +2045,7 @@ static void blkif_release(struct gendisk *disk, fmode_t mode) | |||
2041 | 2045 | ||
2042 | out: | 2046 | out: |
2043 | bdput(bdev); | 2047 | bdput(bdev); |
2048 | out_mutex: | ||
2044 | mutex_unlock(&blkfront_mutex); | 2049 | mutex_unlock(&blkfront_mutex); |
2045 | } | 2050 | } |
2046 | 2051 | ||
diff --git a/drivers/char/i8k.c b/drivers/char/i8k.c index 40cc0cf2ded6..e6939e13e338 100644 --- a/drivers/char/i8k.c +++ b/drivers/char/i8k.c | |||
@@ -664,6 +664,13 @@ static struct dmi_system_id __initdata i8k_dmi_table[] = { | |||
664 | DMI_MATCH(DMI_PRODUCT_NAME, "Vostro"), | 664 | DMI_MATCH(DMI_PRODUCT_NAME, "Vostro"), |
665 | }, | 665 | }, |
666 | }, | 666 | }, |
667 | { | ||
668 | .ident = "Dell XPS421", | ||
669 | .matches = { | ||
670 | DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), | ||
671 | DMI_MATCH(DMI_PRODUCT_NAME, "XPS L421X"), | ||
672 | }, | ||
673 | }, | ||
667 | { } | 674 | { } |
668 | }; | 675 | }; |
669 | 676 | ||
diff --git a/drivers/clocksource/Kconfig b/drivers/clocksource/Kconfig index bdb953e15d2a..5c07a56962db 100644 --- a/drivers/clocksource/Kconfig +++ b/drivers/clocksource/Kconfig | |||
@@ -87,6 +87,7 @@ config ARM_ARCH_TIMER | |||
87 | config ARM_ARCH_TIMER_EVTSTREAM | 87 | config ARM_ARCH_TIMER_EVTSTREAM |
88 | bool "Support for ARM architected timer event stream generation" | 88 | bool "Support for ARM architected timer event stream generation" |
89 | default y if ARM_ARCH_TIMER | 89 | default y if ARM_ARCH_TIMER |
90 | depends on ARM_ARCH_TIMER | ||
90 | help | 91 | help |
91 | This option enables support for event stream generation based on | 92 | This option enables support for event stream generation based on |
92 | the ARM architected timer. It is used for waking up CPUs executing | 93 | the ARM architected timer. It is used for waking up CPUs executing |
diff --git a/drivers/clocksource/sh_mtu2.c b/drivers/clocksource/sh_mtu2.c index 4aac9ee0d0c0..3cf12834681e 100644 --- a/drivers/clocksource/sh_mtu2.c +++ b/drivers/clocksource/sh_mtu2.c | |||
@@ -313,8 +313,20 @@ static int sh_mtu2_setup(struct sh_mtu2_priv *p, struct platform_device *pdev) | |||
313 | goto err1; | 313 | goto err1; |
314 | } | 314 | } |
315 | 315 | ||
316 | return sh_mtu2_register(p, (char *)dev_name(&p->pdev->dev), | 316 | ret = clk_prepare(p->clk); |
317 | cfg->clockevent_rating); | 317 | if (ret < 0) |
318 | goto err2; | ||
319 | |||
320 | ret = sh_mtu2_register(p, (char *)dev_name(&p->pdev->dev), | ||
321 | cfg->clockevent_rating); | ||
322 | if (ret < 0) | ||
323 | goto err3; | ||
324 | |||
325 | return 0; | ||
326 | err3: | ||
327 | clk_unprepare(p->clk); | ||
328 | err2: | ||
329 | clk_put(p->clk); | ||
318 | err1: | 330 | err1: |
319 | iounmap(p->mapbase); | 331 | iounmap(p->mapbase); |
320 | err0: | 332 | err0: |
diff --git a/drivers/clocksource/sh_tmu.c b/drivers/clocksource/sh_tmu.c index 78b8dae49628..63557cda0a7d 100644 --- a/drivers/clocksource/sh_tmu.c +++ b/drivers/clocksource/sh_tmu.c | |||
@@ -472,12 +472,26 @@ static int sh_tmu_setup(struct sh_tmu_priv *p, struct platform_device *pdev) | |||
472 | ret = PTR_ERR(p->clk); | 472 | ret = PTR_ERR(p->clk); |
473 | goto err1; | 473 | goto err1; |
474 | } | 474 | } |
475 | |||
476 | ret = clk_prepare(p->clk); | ||
477 | if (ret < 0) | ||
478 | goto err2; | ||
479 | |||
475 | p->cs_enabled = false; | 480 | p->cs_enabled = false; |
476 | p->enable_count = 0; | 481 | p->enable_count = 0; |
477 | 482 | ||
478 | return sh_tmu_register(p, (char *)dev_name(&p->pdev->dev), | 483 | ret = sh_tmu_register(p, (char *)dev_name(&p->pdev->dev), |
479 | cfg->clockevent_rating, | 484 | cfg->clockevent_rating, |
480 | cfg->clocksource_rating); | 485 | cfg->clocksource_rating); |
486 | if (ret < 0) | ||
487 | goto err3; | ||
488 | |||
489 | return 0; | ||
490 | |||
491 | err3: | ||
492 | clk_unprepare(p->clk); | ||
493 | err2: | ||
494 | clk_put(p->clk); | ||
481 | err1: | 495 | err1: |
482 | iounmap(p->mapbase); | 496 | iounmap(p->mapbase); |
483 | err0: | 497 | err0: |
diff --git a/drivers/cpufreq/at32ap-cpufreq.c b/drivers/cpufreq/at32ap-cpufreq.c index 856ad80418ae..7c03dd84f66a 100644 --- a/drivers/cpufreq/at32ap-cpufreq.c +++ b/drivers/cpufreq/at32ap-cpufreq.c | |||
@@ -58,7 +58,7 @@ static int at32_set_target(struct cpufreq_policy *policy, unsigned int index) | |||
58 | return 0; | 58 | return 0; |
59 | } | 59 | } |
60 | 60 | ||
61 | static int __init at32_cpufreq_driver_init(struct cpufreq_policy *policy) | 61 | static int at32_cpufreq_driver_init(struct cpufreq_policy *policy) |
62 | { | 62 | { |
63 | unsigned int frequency, rate, min_freq; | 63 | unsigned int frequency, rate, min_freq; |
64 | int retval, steps, i; | 64 | int retval, steps, i; |
diff --git a/drivers/cpuidle/cpuidle.c b/drivers/cpuidle/cpuidle.c index 2a991e468f78..a55e68f2cfc8 100644 --- a/drivers/cpuidle/cpuidle.c +++ b/drivers/cpuidle/cpuidle.c | |||
@@ -400,7 +400,7 @@ EXPORT_SYMBOL_GPL(cpuidle_register_device); | |||
400 | */ | 400 | */ |
401 | void cpuidle_unregister_device(struct cpuidle_device *dev) | 401 | void cpuidle_unregister_device(struct cpuidle_device *dev) |
402 | { | 402 | { |
403 | if (dev->registered == 0) | 403 | if (!dev || dev->registered == 0) |
404 | return; | 404 | return; |
405 | 405 | ||
406 | cpuidle_pause_and_lock(); | 406 | cpuidle_pause_and_lock(); |
diff --git a/drivers/crypto/caam/caamalg.c b/drivers/crypto/caam/caamalg.c index 4f44b71b9e24..4cf5dec826e1 100644 --- a/drivers/crypto/caam/caamalg.c +++ b/drivers/crypto/caam/caamalg.c | |||
@@ -818,7 +818,7 @@ static void aead_decrypt_done(struct device *jrdev, u32 *desc, u32 err, | |||
818 | ivsize, 1); | 818 | ivsize, 1); |
819 | print_hex_dump(KERN_ERR, "dst @"__stringify(__LINE__)": ", | 819 | print_hex_dump(KERN_ERR, "dst @"__stringify(__LINE__)": ", |
820 | DUMP_PREFIX_ADDRESS, 16, 4, sg_virt(req->dst), | 820 | DUMP_PREFIX_ADDRESS, 16, 4, sg_virt(req->dst), |
821 | req->cryptlen, 1); | 821 | req->cryptlen - ctx->authsize, 1); |
822 | #endif | 822 | #endif |
823 | 823 | ||
824 | if (err) { | 824 | if (err) { |
@@ -972,12 +972,9 @@ static void init_aead_job(u32 *sh_desc, dma_addr_t ptr, | |||
972 | (edesc->src_nents ? : 1); | 972 | (edesc->src_nents ? : 1); |
973 | in_options = LDST_SGF; | 973 | in_options = LDST_SGF; |
974 | } | 974 | } |
975 | if (encrypt) | 975 | |
976 | append_seq_in_ptr(desc, src_dma, req->assoclen + ivsize + | 976 | append_seq_in_ptr(desc, src_dma, req->assoclen + ivsize + req->cryptlen, |
977 | req->cryptlen - authsize, in_options); | 977 | in_options); |
978 | else | ||
979 | append_seq_in_ptr(desc, src_dma, req->assoclen + ivsize + | ||
980 | req->cryptlen, in_options); | ||
981 | 978 | ||
982 | if (likely(req->src == req->dst)) { | 979 | if (likely(req->src == req->dst)) { |
983 | if (all_contig) { | 980 | if (all_contig) { |
@@ -998,7 +995,8 @@ static void init_aead_job(u32 *sh_desc, dma_addr_t ptr, | |||
998 | } | 995 | } |
999 | } | 996 | } |
1000 | if (encrypt) | 997 | if (encrypt) |
1001 | append_seq_out_ptr(desc, dst_dma, req->cryptlen, out_options); | 998 | append_seq_out_ptr(desc, dst_dma, req->cryptlen + authsize, |
999 | out_options); | ||
1002 | else | 1000 | else |
1003 | append_seq_out_ptr(desc, dst_dma, req->cryptlen - authsize, | 1001 | append_seq_out_ptr(desc, dst_dma, req->cryptlen - authsize, |
1004 | out_options); | 1002 | out_options); |
@@ -1048,8 +1046,8 @@ static void init_aead_giv_job(u32 *sh_desc, dma_addr_t ptr, | |||
1048 | sec4_sg_index += edesc->assoc_nents + 1 + edesc->src_nents; | 1046 | sec4_sg_index += edesc->assoc_nents + 1 + edesc->src_nents; |
1049 | in_options = LDST_SGF; | 1047 | in_options = LDST_SGF; |
1050 | } | 1048 | } |
1051 | append_seq_in_ptr(desc, src_dma, req->assoclen + ivsize + | 1049 | append_seq_in_ptr(desc, src_dma, req->assoclen + ivsize + req->cryptlen, |
1052 | req->cryptlen - authsize, in_options); | 1050 | in_options); |
1053 | 1051 | ||
1054 | if (contig & GIV_DST_CONTIG) { | 1052 | if (contig & GIV_DST_CONTIG) { |
1055 | dst_dma = edesc->iv_dma; | 1053 | dst_dma = edesc->iv_dma; |
@@ -1066,7 +1064,8 @@ static void init_aead_giv_job(u32 *sh_desc, dma_addr_t ptr, | |||
1066 | } | 1064 | } |
1067 | } | 1065 | } |
1068 | 1066 | ||
1069 | append_seq_out_ptr(desc, dst_dma, ivsize + req->cryptlen, out_options); | 1067 | append_seq_out_ptr(desc, dst_dma, ivsize + req->cryptlen + authsize, |
1068 | out_options); | ||
1070 | } | 1069 | } |
1071 | 1070 | ||
1072 | /* | 1071 | /* |
@@ -1130,7 +1129,8 @@ static void init_ablkcipher_job(u32 *sh_desc, dma_addr_t ptr, | |||
1130 | * allocate and map the aead extended descriptor | 1129 | * allocate and map the aead extended descriptor |
1131 | */ | 1130 | */ |
1132 | static struct aead_edesc *aead_edesc_alloc(struct aead_request *req, | 1131 | static struct aead_edesc *aead_edesc_alloc(struct aead_request *req, |
1133 | int desc_bytes, bool *all_contig_ptr) | 1132 | int desc_bytes, bool *all_contig_ptr, |
1133 | bool encrypt) | ||
1134 | { | 1134 | { |
1135 | struct crypto_aead *aead = crypto_aead_reqtfm(req); | 1135 | struct crypto_aead *aead = crypto_aead_reqtfm(req); |
1136 | struct caam_ctx *ctx = crypto_aead_ctx(aead); | 1136 | struct caam_ctx *ctx = crypto_aead_ctx(aead); |
@@ -1145,12 +1145,22 @@ static struct aead_edesc *aead_edesc_alloc(struct aead_request *req, | |||
1145 | bool assoc_chained = false, src_chained = false, dst_chained = false; | 1145 | bool assoc_chained = false, src_chained = false, dst_chained = false; |
1146 | int ivsize = crypto_aead_ivsize(aead); | 1146 | int ivsize = crypto_aead_ivsize(aead); |
1147 | int sec4_sg_index, sec4_sg_len = 0, sec4_sg_bytes; | 1147 | int sec4_sg_index, sec4_sg_len = 0, sec4_sg_bytes; |
1148 | unsigned int authsize = ctx->authsize; | ||
1148 | 1149 | ||
1149 | assoc_nents = sg_count(req->assoc, req->assoclen, &assoc_chained); | 1150 | assoc_nents = sg_count(req->assoc, req->assoclen, &assoc_chained); |
1150 | src_nents = sg_count(req->src, req->cryptlen, &src_chained); | ||
1151 | 1151 | ||
1152 | if (unlikely(req->dst != req->src)) | 1152 | if (unlikely(req->dst != req->src)) { |
1153 | dst_nents = sg_count(req->dst, req->cryptlen, &dst_chained); | 1153 | src_nents = sg_count(req->src, req->cryptlen, &src_chained); |
1154 | dst_nents = sg_count(req->dst, | ||
1155 | req->cryptlen + | ||
1156 | (encrypt ? authsize : (-authsize)), | ||
1157 | &dst_chained); | ||
1158 | } else { | ||
1159 | src_nents = sg_count(req->src, | ||
1160 | req->cryptlen + | ||
1161 | (encrypt ? authsize : 0), | ||
1162 | &src_chained); | ||
1163 | } | ||
1154 | 1164 | ||
1155 | sgc = dma_map_sg_chained(jrdev, req->assoc, assoc_nents ? : 1, | 1165 | sgc = dma_map_sg_chained(jrdev, req->assoc, assoc_nents ? : 1, |
1156 | DMA_TO_DEVICE, assoc_chained); | 1166 | DMA_TO_DEVICE, assoc_chained); |
@@ -1234,11 +1244,9 @@ static int aead_encrypt(struct aead_request *req) | |||
1234 | u32 *desc; | 1244 | u32 *desc; |
1235 | int ret = 0; | 1245 | int ret = 0; |
1236 | 1246 | ||
1237 | req->cryptlen += ctx->authsize; | ||
1238 | |||
1239 | /* allocate extended descriptor */ | 1247 | /* allocate extended descriptor */ |
1240 | edesc = aead_edesc_alloc(req, DESC_JOB_IO_LEN * | 1248 | edesc = aead_edesc_alloc(req, DESC_JOB_IO_LEN * |
1241 | CAAM_CMD_SZ, &all_contig); | 1249 | CAAM_CMD_SZ, &all_contig, true); |
1242 | if (IS_ERR(edesc)) | 1250 | if (IS_ERR(edesc)) |
1243 | return PTR_ERR(edesc); | 1251 | return PTR_ERR(edesc); |
1244 | 1252 | ||
@@ -1275,7 +1283,7 @@ static int aead_decrypt(struct aead_request *req) | |||
1275 | 1283 | ||
1276 | /* allocate extended descriptor */ | 1284 | /* allocate extended descriptor */ |
1277 | edesc = aead_edesc_alloc(req, DESC_JOB_IO_LEN * | 1285 | edesc = aead_edesc_alloc(req, DESC_JOB_IO_LEN * |
1278 | CAAM_CMD_SZ, &all_contig); | 1286 | CAAM_CMD_SZ, &all_contig, false); |
1279 | if (IS_ERR(edesc)) | 1287 | if (IS_ERR(edesc)) |
1280 | return PTR_ERR(edesc); | 1288 | return PTR_ERR(edesc); |
1281 | 1289 | ||
@@ -1332,7 +1340,8 @@ static struct aead_edesc *aead_giv_edesc_alloc(struct aead_givcrypt_request | |||
1332 | src_nents = sg_count(req->src, req->cryptlen, &src_chained); | 1340 | src_nents = sg_count(req->src, req->cryptlen, &src_chained); |
1333 | 1341 | ||
1334 | if (unlikely(req->dst != req->src)) | 1342 | if (unlikely(req->dst != req->src)) |
1335 | dst_nents = sg_count(req->dst, req->cryptlen, &dst_chained); | 1343 | dst_nents = sg_count(req->dst, req->cryptlen + ctx->authsize, |
1344 | &dst_chained); | ||
1336 | 1345 | ||
1337 | sgc = dma_map_sg_chained(jrdev, req->assoc, assoc_nents ? : 1, | 1346 | sgc = dma_map_sg_chained(jrdev, req->assoc, assoc_nents ? : 1, |
1338 | DMA_TO_DEVICE, assoc_chained); | 1347 | DMA_TO_DEVICE, assoc_chained); |
@@ -1426,8 +1435,6 @@ static int aead_givencrypt(struct aead_givcrypt_request *areq) | |||
1426 | u32 *desc; | 1435 | u32 *desc; |
1427 | int ret = 0; | 1436 | int ret = 0; |
1428 | 1437 | ||
1429 | req->cryptlen += ctx->authsize; | ||
1430 | |||
1431 | /* allocate extended descriptor */ | 1438 | /* allocate extended descriptor */ |
1432 | edesc = aead_giv_edesc_alloc(areq, DESC_JOB_IO_LEN * | 1439 | edesc = aead_giv_edesc_alloc(areq, DESC_JOB_IO_LEN * |
1433 | CAAM_CMD_SZ, &contig); | 1440 | CAAM_CMD_SZ, &contig); |
diff --git a/drivers/crypto/caam/jr.c b/drivers/crypto/caam/jr.c index d23356d20e1c..1d80bd3636c5 100644 --- a/drivers/crypto/caam/jr.c +++ b/drivers/crypto/caam/jr.c | |||
@@ -6,6 +6,7 @@ | |||
6 | */ | 6 | */ |
7 | 7 | ||
8 | #include <linux/of_irq.h> | 8 | #include <linux/of_irq.h> |
9 | #include <linux/of_address.h> | ||
9 | 10 | ||
10 | #include "compat.h" | 11 | #include "compat.h" |
11 | #include "regs.h" | 12 | #include "regs.h" |
diff --git a/drivers/crypto/talitos.c b/drivers/crypto/talitos.c index 905de4427e7c..b44f4ddc565c 100644 --- a/drivers/crypto/talitos.c +++ b/drivers/crypto/talitos.c | |||
@@ -790,7 +790,7 @@ static void ipsec_esp_unmap(struct device *dev, | |||
790 | 790 | ||
791 | if (edesc->assoc_chained) | 791 | if (edesc->assoc_chained) |
792 | talitos_unmap_sg_chain(dev, areq->assoc, DMA_TO_DEVICE); | 792 | talitos_unmap_sg_chain(dev, areq->assoc, DMA_TO_DEVICE); |
793 | else | 793 | else if (areq->assoclen) |
794 | /* assoc_nents counts also for IV in non-contiguous cases */ | 794 | /* assoc_nents counts also for IV in non-contiguous cases */ |
795 | dma_unmap_sg(dev, areq->assoc, | 795 | dma_unmap_sg(dev, areq->assoc, |
796 | edesc->assoc_nents ? edesc->assoc_nents - 1 : 1, | 796 | edesc->assoc_nents ? edesc->assoc_nents - 1 : 1, |
@@ -973,7 +973,11 @@ static int ipsec_esp(struct talitos_edesc *edesc, struct aead_request *areq, | |||
973 | dma_sync_single_for_device(dev, edesc->dma_link_tbl, | 973 | dma_sync_single_for_device(dev, edesc->dma_link_tbl, |
974 | edesc->dma_len, DMA_BIDIRECTIONAL); | 974 | edesc->dma_len, DMA_BIDIRECTIONAL); |
975 | } else { | 975 | } else { |
976 | to_talitos_ptr(&desc->ptr[1], sg_dma_address(areq->assoc)); | 976 | if (areq->assoclen) |
977 | to_talitos_ptr(&desc->ptr[1], | ||
978 | sg_dma_address(areq->assoc)); | ||
979 | else | ||
980 | to_talitos_ptr(&desc->ptr[1], edesc->iv_dma); | ||
977 | desc->ptr[1].j_extent = 0; | 981 | desc->ptr[1].j_extent = 0; |
978 | } | 982 | } |
979 | 983 | ||
@@ -1108,7 +1112,8 @@ static struct talitos_edesc *talitos_edesc_alloc(struct device *dev, | |||
1108 | unsigned int authsize, | 1112 | unsigned int authsize, |
1109 | unsigned int ivsize, | 1113 | unsigned int ivsize, |
1110 | int icv_stashing, | 1114 | int icv_stashing, |
1111 | u32 cryptoflags) | 1115 | u32 cryptoflags, |
1116 | bool encrypt) | ||
1112 | { | 1117 | { |
1113 | struct talitos_edesc *edesc; | 1118 | struct talitos_edesc *edesc; |
1114 | int assoc_nents = 0, src_nents, dst_nents, alloc_len, dma_len; | 1119 | int assoc_nents = 0, src_nents, dst_nents, alloc_len, dma_len; |
@@ -1122,10 +1127,10 @@ static struct talitos_edesc *talitos_edesc_alloc(struct device *dev, | |||
1122 | return ERR_PTR(-EINVAL); | 1127 | return ERR_PTR(-EINVAL); |
1123 | } | 1128 | } |
1124 | 1129 | ||
1125 | if (iv) | 1130 | if (ivsize) |
1126 | iv_dma = dma_map_single(dev, iv, ivsize, DMA_TO_DEVICE); | 1131 | iv_dma = dma_map_single(dev, iv, ivsize, DMA_TO_DEVICE); |
1127 | 1132 | ||
1128 | if (assoc) { | 1133 | if (assoclen) { |
1129 | /* | 1134 | /* |
1130 | * Currently it is assumed that iv is provided whenever assoc | 1135 | * Currently it is assumed that iv is provided whenever assoc |
1131 | * is. | 1136 | * is. |
@@ -1141,19 +1146,17 @@ static struct talitos_edesc *talitos_edesc_alloc(struct device *dev, | |||
1141 | assoc_nents = assoc_nents ? assoc_nents + 1 : 2; | 1146 | assoc_nents = assoc_nents ? assoc_nents + 1 : 2; |
1142 | } | 1147 | } |
1143 | 1148 | ||
1144 | src_nents = sg_count(src, cryptlen + authsize, &src_chained); | 1149 | if (!dst || dst == src) { |
1145 | src_nents = (src_nents == 1) ? 0 : src_nents; | 1150 | src_nents = sg_count(src, cryptlen + authsize, &src_chained); |
1146 | 1151 | src_nents = (src_nents == 1) ? 0 : src_nents; | |
1147 | if (!dst) { | 1152 | dst_nents = dst ? src_nents : 0; |
1148 | dst_nents = 0; | 1153 | } else { /* dst && dst != src*/ |
1149 | } else { | 1154 | src_nents = sg_count(src, cryptlen + (encrypt ? 0 : authsize), |
1150 | if (dst == src) { | 1155 | &src_chained); |
1151 | dst_nents = src_nents; | 1156 | src_nents = (src_nents == 1) ? 0 : src_nents; |
1152 | } else { | 1157 | dst_nents = sg_count(dst, cryptlen + (encrypt ? authsize : 0), |
1153 | dst_nents = sg_count(dst, cryptlen + authsize, | 1158 | &dst_chained); |
1154 | &dst_chained); | 1159 | dst_nents = (dst_nents == 1) ? 0 : dst_nents; |
1155 | dst_nents = (dst_nents == 1) ? 0 : dst_nents; | ||
1156 | } | ||
1157 | } | 1160 | } |
1158 | 1161 | ||
1159 | /* | 1162 | /* |
@@ -1173,9 +1176,16 @@ static struct talitos_edesc *talitos_edesc_alloc(struct device *dev, | |||
1173 | 1176 | ||
1174 | edesc = kmalloc(alloc_len, GFP_DMA | flags); | 1177 | edesc = kmalloc(alloc_len, GFP_DMA | flags); |
1175 | if (!edesc) { | 1178 | if (!edesc) { |
1176 | talitos_unmap_sg_chain(dev, assoc, DMA_TO_DEVICE); | 1179 | if (assoc_chained) |
1180 | talitos_unmap_sg_chain(dev, assoc, DMA_TO_DEVICE); | ||
1181 | else if (assoclen) | ||
1182 | dma_unmap_sg(dev, assoc, | ||
1183 | assoc_nents ? assoc_nents - 1 : 1, | ||
1184 | DMA_TO_DEVICE); | ||
1185 | |||
1177 | if (iv_dma) | 1186 | if (iv_dma) |
1178 | dma_unmap_single(dev, iv_dma, ivsize, DMA_TO_DEVICE); | 1187 | dma_unmap_single(dev, iv_dma, ivsize, DMA_TO_DEVICE); |
1188 | |||
1179 | dev_err(dev, "could not allocate edescriptor\n"); | 1189 | dev_err(dev, "could not allocate edescriptor\n"); |
1180 | return ERR_PTR(-ENOMEM); | 1190 | return ERR_PTR(-ENOMEM); |
1181 | } | 1191 | } |
@@ -1197,7 +1207,7 @@ static struct talitos_edesc *talitos_edesc_alloc(struct device *dev, | |||
1197 | } | 1207 | } |
1198 | 1208 | ||
1199 | static struct talitos_edesc *aead_edesc_alloc(struct aead_request *areq, u8 *iv, | 1209 | static struct talitos_edesc *aead_edesc_alloc(struct aead_request *areq, u8 *iv, |
1200 | int icv_stashing) | 1210 | int icv_stashing, bool encrypt) |
1201 | { | 1211 | { |
1202 | struct crypto_aead *authenc = crypto_aead_reqtfm(areq); | 1212 | struct crypto_aead *authenc = crypto_aead_reqtfm(areq); |
1203 | struct talitos_ctx *ctx = crypto_aead_ctx(authenc); | 1213 | struct talitos_ctx *ctx = crypto_aead_ctx(authenc); |
@@ -1206,7 +1216,7 @@ static struct talitos_edesc *aead_edesc_alloc(struct aead_request *areq, u8 *iv, | |||
1206 | return talitos_edesc_alloc(ctx->dev, areq->assoc, areq->src, areq->dst, | 1216 | return talitos_edesc_alloc(ctx->dev, areq->assoc, areq->src, areq->dst, |
1207 | iv, areq->assoclen, areq->cryptlen, | 1217 | iv, areq->assoclen, areq->cryptlen, |
1208 | ctx->authsize, ivsize, icv_stashing, | 1218 | ctx->authsize, ivsize, icv_stashing, |
1209 | areq->base.flags); | 1219 | areq->base.flags, encrypt); |
1210 | } | 1220 | } |
1211 | 1221 | ||
1212 | static int aead_encrypt(struct aead_request *req) | 1222 | static int aead_encrypt(struct aead_request *req) |
@@ -1216,7 +1226,7 @@ static int aead_encrypt(struct aead_request *req) | |||
1216 | struct talitos_edesc *edesc; | 1226 | struct talitos_edesc *edesc; |
1217 | 1227 | ||
1218 | /* allocate extended descriptor */ | 1228 | /* allocate extended descriptor */ |
1219 | edesc = aead_edesc_alloc(req, req->iv, 0); | 1229 | edesc = aead_edesc_alloc(req, req->iv, 0, true); |
1220 | if (IS_ERR(edesc)) | 1230 | if (IS_ERR(edesc)) |
1221 | return PTR_ERR(edesc); | 1231 | return PTR_ERR(edesc); |
1222 | 1232 | ||
@@ -1239,7 +1249,7 @@ static int aead_decrypt(struct aead_request *req) | |||
1239 | req->cryptlen -= authsize; | 1249 | req->cryptlen -= authsize; |
1240 | 1250 | ||
1241 | /* allocate extended descriptor */ | 1251 | /* allocate extended descriptor */ |
1242 | edesc = aead_edesc_alloc(req, req->iv, 1); | 1252 | edesc = aead_edesc_alloc(req, req->iv, 1, false); |
1243 | if (IS_ERR(edesc)) | 1253 | if (IS_ERR(edesc)) |
1244 | return PTR_ERR(edesc); | 1254 | return PTR_ERR(edesc); |
1245 | 1255 | ||
@@ -1285,7 +1295,7 @@ static int aead_givencrypt(struct aead_givcrypt_request *req) | |||
1285 | struct talitos_edesc *edesc; | 1295 | struct talitos_edesc *edesc; |
1286 | 1296 | ||
1287 | /* allocate extended descriptor */ | 1297 | /* allocate extended descriptor */ |
1288 | edesc = aead_edesc_alloc(areq, req->giv, 0); | 1298 | edesc = aead_edesc_alloc(areq, req->giv, 0, true); |
1289 | if (IS_ERR(edesc)) | 1299 | if (IS_ERR(edesc)) |
1290 | return PTR_ERR(edesc); | 1300 | return PTR_ERR(edesc); |
1291 | 1301 | ||
@@ -1441,7 +1451,7 @@ static int common_nonsnoop(struct talitos_edesc *edesc, | |||
1441 | } | 1451 | } |
1442 | 1452 | ||
1443 | static struct talitos_edesc *ablkcipher_edesc_alloc(struct ablkcipher_request * | 1453 | static struct talitos_edesc *ablkcipher_edesc_alloc(struct ablkcipher_request * |
1444 | areq) | 1454 | areq, bool encrypt) |
1445 | { | 1455 | { |
1446 | struct crypto_ablkcipher *cipher = crypto_ablkcipher_reqtfm(areq); | 1456 | struct crypto_ablkcipher *cipher = crypto_ablkcipher_reqtfm(areq); |
1447 | struct talitos_ctx *ctx = crypto_ablkcipher_ctx(cipher); | 1457 | struct talitos_ctx *ctx = crypto_ablkcipher_ctx(cipher); |
@@ -1449,7 +1459,7 @@ static struct talitos_edesc *ablkcipher_edesc_alloc(struct ablkcipher_request * | |||
1449 | 1459 | ||
1450 | return talitos_edesc_alloc(ctx->dev, NULL, areq->src, areq->dst, | 1460 | return talitos_edesc_alloc(ctx->dev, NULL, areq->src, areq->dst, |
1451 | areq->info, 0, areq->nbytes, 0, ivsize, 0, | 1461 | areq->info, 0, areq->nbytes, 0, ivsize, 0, |
1452 | areq->base.flags); | 1462 | areq->base.flags, encrypt); |
1453 | } | 1463 | } |
1454 | 1464 | ||
1455 | static int ablkcipher_encrypt(struct ablkcipher_request *areq) | 1465 | static int ablkcipher_encrypt(struct ablkcipher_request *areq) |
@@ -1459,7 +1469,7 @@ static int ablkcipher_encrypt(struct ablkcipher_request *areq) | |||
1459 | struct talitos_edesc *edesc; | 1469 | struct talitos_edesc *edesc; |
1460 | 1470 | ||
1461 | /* allocate extended descriptor */ | 1471 | /* allocate extended descriptor */ |
1462 | edesc = ablkcipher_edesc_alloc(areq); | 1472 | edesc = ablkcipher_edesc_alloc(areq, true); |
1463 | if (IS_ERR(edesc)) | 1473 | if (IS_ERR(edesc)) |
1464 | return PTR_ERR(edesc); | 1474 | return PTR_ERR(edesc); |
1465 | 1475 | ||
@@ -1476,7 +1486,7 @@ static int ablkcipher_decrypt(struct ablkcipher_request *areq) | |||
1476 | struct talitos_edesc *edesc; | 1486 | struct talitos_edesc *edesc; |
1477 | 1487 | ||
1478 | /* allocate extended descriptor */ | 1488 | /* allocate extended descriptor */ |
1479 | edesc = ablkcipher_edesc_alloc(areq); | 1489 | edesc = ablkcipher_edesc_alloc(areq, false); |
1480 | if (IS_ERR(edesc)) | 1490 | if (IS_ERR(edesc)) |
1481 | return PTR_ERR(edesc); | 1491 | return PTR_ERR(edesc); |
1482 | 1492 | ||
@@ -1628,7 +1638,7 @@ static struct talitos_edesc *ahash_edesc_alloc(struct ahash_request *areq, | |||
1628 | struct talitos_ahash_req_ctx *req_ctx = ahash_request_ctx(areq); | 1638 | struct talitos_ahash_req_ctx *req_ctx = ahash_request_ctx(areq); |
1629 | 1639 | ||
1630 | return talitos_edesc_alloc(ctx->dev, NULL, req_ctx->psrc, NULL, NULL, 0, | 1640 | return talitos_edesc_alloc(ctx->dev, NULL, req_ctx->psrc, NULL, NULL, 0, |
1631 | nbytes, 0, 0, 0, areq->base.flags); | 1641 | nbytes, 0, 0, 0, areq->base.flags, false); |
1632 | } | 1642 | } |
1633 | 1643 | ||
1634 | static int ahash_init(struct ahash_request *areq) | 1644 | static int ahash_init(struct ahash_request *areq) |
diff --git a/drivers/dma/amba-pl08x.c b/drivers/dma/amba-pl08x.c index 16a2aa28f856..ec4ee5c1fe9d 100644 --- a/drivers/dma/amba-pl08x.c +++ b/drivers/dma/amba-pl08x.c | |||
@@ -1169,7 +1169,7 @@ static void pl08x_desc_free(struct virt_dma_desc *vd) | |||
1169 | struct pl08x_txd *txd = to_pl08x_txd(&vd->tx); | 1169 | struct pl08x_txd *txd = to_pl08x_txd(&vd->tx); |
1170 | struct pl08x_dma_chan *plchan = to_pl08x_chan(vd->tx.chan); | 1170 | struct pl08x_dma_chan *plchan = to_pl08x_chan(vd->tx.chan); |
1171 | 1171 | ||
1172 | dma_descriptor_unmap(txd); | 1172 | dma_descriptor_unmap(&vd->tx); |
1173 | if (!txd->done) | 1173 | if (!txd->done) |
1174 | pl08x_release_mux(plchan); | 1174 | pl08x_release_mux(plchan); |
1175 | 1175 | ||
diff --git a/drivers/dma/mmp_pdma.c b/drivers/dma/mmp_pdma.c index dcb1e05149a7..8869500ab92b 100644 --- a/drivers/dma/mmp_pdma.c +++ b/drivers/dma/mmp_pdma.c | |||
@@ -1017,6 +1017,7 @@ static int mmp_pdma_probe(struct platform_device *op) | |||
1017 | } | 1017 | } |
1018 | } | 1018 | } |
1019 | 1019 | ||
1020 | platform_set_drvdata(op, pdev); | ||
1020 | dev_info(pdev->device.dev, "initialized %d channels\n", dma_channels); | 1021 | dev_info(pdev->device.dev, "initialized %d channels\n", dma_channels); |
1021 | return 0; | 1022 | return 0; |
1022 | } | 1023 | } |
diff --git a/drivers/dma/s3c24xx-dma.c b/drivers/dma/s3c24xx-dma.c index 4cb127978636..4eddedb6eb7d 100644 --- a/drivers/dma/s3c24xx-dma.c +++ b/drivers/dma/s3c24xx-dma.c | |||
@@ -628,42 +628,13 @@ retry: | |||
628 | s3cchan->state = S3C24XX_DMA_CHAN_IDLE; | 628 | s3cchan->state = S3C24XX_DMA_CHAN_IDLE; |
629 | } | 629 | } |
630 | 630 | ||
631 | static void s3c24xx_dma_unmap_buffers(struct s3c24xx_txd *txd) | ||
632 | { | ||
633 | struct device *dev = txd->vd.tx.chan->device->dev; | ||
634 | struct s3c24xx_sg *dsg; | ||
635 | |||
636 | if (!(txd->vd.tx.flags & DMA_COMPL_SKIP_SRC_UNMAP)) { | ||
637 | if (txd->vd.tx.flags & DMA_COMPL_SRC_UNMAP_SINGLE) | ||
638 | list_for_each_entry(dsg, &txd->dsg_list, node) | ||
639 | dma_unmap_single(dev, dsg->src_addr, dsg->len, | ||
640 | DMA_TO_DEVICE); | ||
641 | else { | ||
642 | list_for_each_entry(dsg, &txd->dsg_list, node) | ||
643 | dma_unmap_page(dev, dsg->src_addr, dsg->len, | ||
644 | DMA_TO_DEVICE); | ||
645 | } | ||
646 | } | ||
647 | |||
648 | if (!(txd->vd.tx.flags & DMA_COMPL_SKIP_DEST_UNMAP)) { | ||
649 | if (txd->vd.tx.flags & DMA_COMPL_DEST_UNMAP_SINGLE) | ||
650 | list_for_each_entry(dsg, &txd->dsg_list, node) | ||
651 | dma_unmap_single(dev, dsg->dst_addr, dsg->len, | ||
652 | DMA_FROM_DEVICE); | ||
653 | else | ||
654 | list_for_each_entry(dsg, &txd->dsg_list, node) | ||
655 | dma_unmap_page(dev, dsg->dst_addr, dsg->len, | ||
656 | DMA_FROM_DEVICE); | ||
657 | } | ||
658 | } | ||
659 | |||
660 | static void s3c24xx_dma_desc_free(struct virt_dma_desc *vd) | 631 | static void s3c24xx_dma_desc_free(struct virt_dma_desc *vd) |
661 | { | 632 | { |
662 | struct s3c24xx_txd *txd = to_s3c24xx_txd(&vd->tx); | 633 | struct s3c24xx_txd *txd = to_s3c24xx_txd(&vd->tx); |
663 | struct s3c24xx_dma_chan *s3cchan = to_s3c24xx_dma_chan(vd->tx.chan); | 634 | struct s3c24xx_dma_chan *s3cchan = to_s3c24xx_dma_chan(vd->tx.chan); |
664 | 635 | ||
665 | if (!s3cchan->slave) | 636 | if (!s3cchan->slave) |
666 | s3c24xx_dma_unmap_buffers(txd); | 637 | dma_descriptor_unmap(&vd->tx); |
667 | 638 | ||
668 | s3c24xx_dma_free_txd(txd); | 639 | s3c24xx_dma_free_txd(txd); |
669 | } | 640 | } |
@@ -795,7 +766,7 @@ static enum dma_status s3c24xx_dma_tx_status(struct dma_chan *chan, | |||
795 | 766 | ||
796 | spin_lock_irqsave(&s3cchan->vc.lock, flags); | 767 | spin_lock_irqsave(&s3cchan->vc.lock, flags); |
797 | ret = dma_cookie_status(chan, cookie, txstate); | 768 | ret = dma_cookie_status(chan, cookie, txstate); |
798 | if (ret == DMA_SUCCESS) { | 769 | if (ret == DMA_COMPLETE) { |
799 | spin_unlock_irqrestore(&s3cchan->vc.lock, flags); | 770 | spin_unlock_irqrestore(&s3cchan->vc.lock, flags); |
800 | return ret; | 771 | return ret; |
801 | } | 772 | } |
diff --git a/drivers/dma/sh/rcar-hpbdma.c b/drivers/dma/sh/rcar-hpbdma.c index ebad84591a6e..3083d901a414 100644 --- a/drivers/dma/sh/rcar-hpbdma.c +++ b/drivers/dma/sh/rcar-hpbdma.c | |||
@@ -60,6 +60,7 @@ | |||
60 | #define HPB_DMAE_DSTPR_DMSTP BIT(0) | 60 | #define HPB_DMAE_DSTPR_DMSTP BIT(0) |
61 | 61 | ||
62 | /* DMA status register (DSTSR) bits */ | 62 | /* DMA status register (DSTSR) bits */ |
63 | #define HPB_DMAE_DSTSR_DQSTS BIT(2) | ||
63 | #define HPB_DMAE_DSTSR_DMSTS BIT(0) | 64 | #define HPB_DMAE_DSTSR_DMSTS BIT(0) |
64 | 65 | ||
65 | /* DMA common registers */ | 66 | /* DMA common registers */ |
@@ -286,6 +287,9 @@ static void hpb_dmae_halt(struct shdma_chan *schan) | |||
286 | 287 | ||
287 | ch_reg_write(chan, HPB_DMAE_DCMDR_DQEND, HPB_DMAE_DCMDR); | 288 | ch_reg_write(chan, HPB_DMAE_DCMDR_DQEND, HPB_DMAE_DCMDR); |
288 | ch_reg_write(chan, HPB_DMAE_DSTPR_DMSTP, HPB_DMAE_DSTPR); | 289 | ch_reg_write(chan, HPB_DMAE_DSTPR_DMSTP, HPB_DMAE_DSTPR); |
290 | |||
291 | chan->plane_idx = 0; | ||
292 | chan->first_desc = true; | ||
289 | } | 293 | } |
290 | 294 | ||
291 | static const struct hpb_dmae_slave_config * | 295 | static const struct hpb_dmae_slave_config * |
@@ -385,7 +389,10 @@ static bool hpb_dmae_channel_busy(struct shdma_chan *schan) | |||
385 | struct hpb_dmae_chan *chan = to_chan(schan); | 389 | struct hpb_dmae_chan *chan = to_chan(schan); |
386 | u32 dstsr = ch_reg_read(chan, HPB_DMAE_DSTSR); | 390 | u32 dstsr = ch_reg_read(chan, HPB_DMAE_DSTSR); |
387 | 391 | ||
388 | return (dstsr & HPB_DMAE_DSTSR_DMSTS) == HPB_DMAE_DSTSR_DMSTS; | 392 | if (chan->xfer_mode == XFER_DOUBLE) |
393 | return dstsr & HPB_DMAE_DSTSR_DQSTS; | ||
394 | else | ||
395 | return dstsr & HPB_DMAE_DSTSR_DMSTS; | ||
389 | } | 396 | } |
390 | 397 | ||
391 | static int | 398 | static int |
@@ -510,6 +517,8 @@ static int hpb_dmae_chan_probe(struct hpb_dmae_device *hpbdev, int id) | |||
510 | } | 517 | } |
511 | 518 | ||
512 | schan = &new_hpb_chan->shdma_chan; | 519 | schan = &new_hpb_chan->shdma_chan; |
520 | schan->max_xfer_len = HPB_DMA_TCR_MAX; | ||
521 | |||
513 | shdma_chan_probe(sdev, schan, id); | 522 | shdma_chan_probe(sdev, schan, id); |
514 | 523 | ||
515 | if (pdev->id >= 0) | 524 | if (pdev->id >= 0) |
diff --git a/drivers/edac/sb_edac.c b/drivers/edac/sb_edac.c index 8472405c5586..d7f1b57bd3be 100644 --- a/drivers/edac/sb_edac.c +++ b/drivers/edac/sb_edac.c | |||
@@ -945,7 +945,7 @@ static int get_memory_error_data(struct mem_ctl_info *mci, | |||
945 | u32 tad_offset; | 945 | u32 tad_offset; |
946 | u32 rir_way; | 946 | u32 rir_way; |
947 | u32 mb, kb; | 947 | u32 mb, kb; |
948 | u64 ch_addr, offset, limit, prv = 0; | 948 | u64 ch_addr, offset, limit = 0, prv = 0; |
949 | 949 | ||
950 | 950 | ||
951 | /* | 951 | /* |
diff --git a/drivers/extcon/extcon-arizona.c b/drivers/extcon/extcon-arizona.c index 3c55ec856e39..a287cece0593 100644 --- a/drivers/extcon/extcon-arizona.c +++ b/drivers/extcon/extcon-arizona.c | |||
@@ -1082,7 +1082,7 @@ static void arizona_micd_set_level(struct arizona *arizona, int index, | |||
1082 | static int arizona_extcon_probe(struct platform_device *pdev) | 1082 | static int arizona_extcon_probe(struct platform_device *pdev) |
1083 | { | 1083 | { |
1084 | struct arizona *arizona = dev_get_drvdata(pdev->dev.parent); | 1084 | struct arizona *arizona = dev_get_drvdata(pdev->dev.parent); |
1085 | struct arizona_pdata *pdata; | 1085 | struct arizona_pdata *pdata = &arizona->pdata; |
1086 | struct arizona_extcon_info *info; | 1086 | struct arizona_extcon_info *info; |
1087 | unsigned int val; | 1087 | unsigned int val; |
1088 | int jack_irq_fall, jack_irq_rise; | 1088 | int jack_irq_fall, jack_irq_rise; |
@@ -1091,8 +1091,6 @@ static int arizona_extcon_probe(struct platform_device *pdev) | |||
1091 | if (!arizona->dapm || !arizona->dapm->card) | 1091 | if (!arizona->dapm || !arizona->dapm->card) |
1092 | return -EPROBE_DEFER; | 1092 | return -EPROBE_DEFER; |
1093 | 1093 | ||
1094 | pdata = dev_get_platdata(arizona->dev); | ||
1095 | |||
1096 | info = devm_kzalloc(&pdev->dev, sizeof(*info), GFP_KERNEL); | 1094 | info = devm_kzalloc(&pdev->dev, sizeof(*info), GFP_KERNEL); |
1097 | if (!info) { | 1095 | if (!info) { |
1098 | dev_err(&pdev->dev, "Failed to allocate memory\n"); | 1096 | dev_err(&pdev->dev, "Failed to allocate memory\n"); |
diff --git a/drivers/extcon/extcon-class.c b/drivers/extcon/extcon-class.c index 15443d3b6be1..76322330cbd7 100644 --- a/drivers/extcon/extcon-class.c +++ b/drivers/extcon/extcon-class.c | |||
@@ -792,6 +792,8 @@ void extcon_dev_unregister(struct extcon_dev *edev) | |||
792 | return; | 792 | return; |
793 | } | 793 | } |
794 | 794 | ||
795 | device_unregister(&edev->dev); | ||
796 | |||
795 | if (edev->mutually_exclusive && edev->max_supported) { | 797 | if (edev->mutually_exclusive && edev->max_supported) { |
796 | for (index = 0; edev->mutually_exclusive[index]; | 798 | for (index = 0; edev->mutually_exclusive[index]; |
797 | index++) | 799 | index++) |
@@ -812,7 +814,6 @@ void extcon_dev_unregister(struct extcon_dev *edev) | |||
812 | if (switch_class) | 814 | if (switch_class) |
813 | class_compat_remove_link(switch_class, &edev->dev, NULL); | 815 | class_compat_remove_link(switch_class, &edev->dev, NULL); |
814 | #endif | 816 | #endif |
815 | device_unregister(&edev->dev); | ||
816 | put_device(&edev->dev); | 817 | put_device(&edev->dev); |
817 | } | 818 | } |
818 | EXPORT_SYMBOL_GPL(extcon_dev_unregister); | 819 | EXPORT_SYMBOL_GPL(extcon_dev_unregister); |
diff --git a/drivers/firewire/sbp2.c b/drivers/firewire/sbp2.c index 281029daf98c..b0bb056458a3 100644 --- a/drivers/firewire/sbp2.c +++ b/drivers/firewire/sbp2.c | |||
@@ -1623,6 +1623,7 @@ static struct scsi_host_template scsi_driver_template = { | |||
1623 | .cmd_per_lun = 1, | 1623 | .cmd_per_lun = 1, |
1624 | .can_queue = 1, | 1624 | .can_queue = 1, |
1625 | .sdev_attrs = sbp2_scsi_sysfs_attrs, | 1625 | .sdev_attrs = sbp2_scsi_sysfs_attrs, |
1626 | .no_write_same = 1, | ||
1626 | }; | 1627 | }; |
1627 | 1628 | ||
1628 | MODULE_AUTHOR("Kristian Hoegsberg <krh@bitplanet.net>"); | 1629 | MODULE_AUTHOR("Kristian Hoegsberg <krh@bitplanet.net>"); |
diff --git a/drivers/firmware/efi/efi-pstore.c b/drivers/firmware/efi/efi-pstore.c index 5002d50e3781..743fd426f21b 100644 --- a/drivers/firmware/efi/efi-pstore.c +++ b/drivers/firmware/efi/efi-pstore.c | |||
@@ -18,14 +18,12 @@ module_param_named(pstore_disable, efivars_pstore_disable, bool, 0644); | |||
18 | 18 | ||
19 | static int efi_pstore_open(struct pstore_info *psi) | 19 | static int efi_pstore_open(struct pstore_info *psi) |
20 | { | 20 | { |
21 | efivar_entry_iter_begin(); | ||
22 | psi->data = NULL; | 21 | psi->data = NULL; |
23 | return 0; | 22 | return 0; |
24 | } | 23 | } |
25 | 24 | ||
26 | static int efi_pstore_close(struct pstore_info *psi) | 25 | static int efi_pstore_close(struct pstore_info *psi) |
27 | { | 26 | { |
28 | efivar_entry_iter_end(); | ||
29 | psi->data = NULL; | 27 | psi->data = NULL; |
30 | return 0; | 28 | return 0; |
31 | } | 29 | } |
@@ -39,6 +37,12 @@ struct pstore_read_data { | |||
39 | char **buf; | 37 | char **buf; |
40 | }; | 38 | }; |
41 | 39 | ||
40 | static inline u64 generic_id(unsigned long timestamp, | ||
41 | unsigned int part, int count) | ||
42 | { | ||
43 | return (timestamp * 100 + part) * 1000 + count; | ||
44 | } | ||
45 | |||
42 | static int efi_pstore_read_func(struct efivar_entry *entry, void *data) | 46 | static int efi_pstore_read_func(struct efivar_entry *entry, void *data) |
43 | { | 47 | { |
44 | efi_guid_t vendor = LINUX_EFI_CRASH_GUID; | 48 | efi_guid_t vendor = LINUX_EFI_CRASH_GUID; |
@@ -57,7 +61,7 @@ static int efi_pstore_read_func(struct efivar_entry *entry, void *data) | |||
57 | 61 | ||
58 | if (sscanf(name, "dump-type%u-%u-%d-%lu-%c", | 62 | if (sscanf(name, "dump-type%u-%u-%d-%lu-%c", |
59 | cb_data->type, &part, &cnt, &time, &data_type) == 5) { | 63 | cb_data->type, &part, &cnt, &time, &data_type) == 5) { |
60 | *cb_data->id = part; | 64 | *cb_data->id = generic_id(time, part, cnt); |
61 | *cb_data->count = cnt; | 65 | *cb_data->count = cnt; |
62 | cb_data->timespec->tv_sec = time; | 66 | cb_data->timespec->tv_sec = time; |
63 | cb_data->timespec->tv_nsec = 0; | 67 | cb_data->timespec->tv_nsec = 0; |
@@ -67,7 +71,7 @@ static int efi_pstore_read_func(struct efivar_entry *entry, void *data) | |||
67 | *cb_data->compressed = false; | 71 | *cb_data->compressed = false; |
68 | } else if (sscanf(name, "dump-type%u-%u-%d-%lu", | 72 | } else if (sscanf(name, "dump-type%u-%u-%d-%lu", |
69 | cb_data->type, &part, &cnt, &time) == 4) { | 73 | cb_data->type, &part, &cnt, &time) == 4) { |
70 | *cb_data->id = part; | 74 | *cb_data->id = generic_id(time, part, cnt); |
71 | *cb_data->count = cnt; | 75 | *cb_data->count = cnt; |
72 | cb_data->timespec->tv_sec = time; | 76 | cb_data->timespec->tv_sec = time; |
73 | cb_data->timespec->tv_nsec = 0; | 77 | cb_data->timespec->tv_nsec = 0; |
@@ -79,7 +83,7 @@ static int efi_pstore_read_func(struct efivar_entry *entry, void *data) | |||
79 | * which doesn't support holding | 83 | * which doesn't support holding |
80 | * multiple logs, remains. | 84 | * multiple logs, remains. |
81 | */ | 85 | */ |
82 | *cb_data->id = part; | 86 | *cb_data->id = generic_id(time, part, 0); |
83 | *cb_data->count = 0; | 87 | *cb_data->count = 0; |
84 | cb_data->timespec->tv_sec = time; | 88 | cb_data->timespec->tv_sec = time; |
85 | cb_data->timespec->tv_nsec = 0; | 89 | cb_data->timespec->tv_nsec = 0; |
@@ -91,19 +95,125 @@ static int efi_pstore_read_func(struct efivar_entry *entry, void *data) | |||
91 | __efivar_entry_get(entry, &entry->var.Attributes, | 95 | __efivar_entry_get(entry, &entry->var.Attributes, |
92 | &entry->var.DataSize, entry->var.Data); | 96 | &entry->var.DataSize, entry->var.Data); |
93 | size = entry->var.DataSize; | 97 | size = entry->var.DataSize; |
98 | memcpy(*cb_data->buf, entry->var.Data, | ||
99 | (size_t)min_t(unsigned long, EFIVARS_DATA_SIZE_MAX, size)); | ||
94 | 100 | ||
95 | *cb_data->buf = kmemdup(entry->var.Data, size, GFP_KERNEL); | ||
96 | if (*cb_data->buf == NULL) | ||
97 | return -ENOMEM; | ||
98 | return size; | 101 | return size; |
99 | } | 102 | } |
100 | 103 | ||
104 | /** | ||
105 | * efi_pstore_scan_sysfs_enter | ||
106 | * @entry: scanning entry | ||
107 | * @next: next entry | ||
108 | * @head: list head | ||
109 | */ | ||
110 | static void efi_pstore_scan_sysfs_enter(struct efivar_entry *pos, | ||
111 | struct efivar_entry *next, | ||
112 | struct list_head *head) | ||
113 | { | ||
114 | pos->scanning = true; | ||
115 | if (&next->list != head) | ||
116 | next->scanning = true; | ||
117 | } | ||
118 | |||
119 | /** | ||
120 | * __efi_pstore_scan_sysfs_exit | ||
121 | * @entry: deleting entry | ||
122 | * @turn_off_scanning: Check if a scanning flag should be turned off | ||
123 | */ | ||
124 | static inline void __efi_pstore_scan_sysfs_exit(struct efivar_entry *entry, | ||
125 | bool turn_off_scanning) | ||
126 | { | ||
127 | if (entry->deleting) { | ||
128 | list_del(&entry->list); | ||
129 | efivar_entry_iter_end(); | ||
130 | efivar_unregister(entry); | ||
131 | efivar_entry_iter_begin(); | ||
132 | } else if (turn_off_scanning) | ||
133 | entry->scanning = false; | ||
134 | } | ||
135 | |||
136 | /** | ||
137 | * efi_pstore_scan_sysfs_exit | ||
138 | * @pos: scanning entry | ||
139 | * @next: next entry | ||
140 | * @head: list head | ||
141 | * @stop: a flag checking if scanning will stop | ||
142 | */ | ||
143 | static void efi_pstore_scan_sysfs_exit(struct efivar_entry *pos, | ||
144 | struct efivar_entry *next, | ||
145 | struct list_head *head, bool stop) | ||
146 | { | ||
147 | __efi_pstore_scan_sysfs_exit(pos, true); | ||
148 | if (stop) | ||
149 | __efi_pstore_scan_sysfs_exit(next, &next->list != head); | ||
150 | } | ||
151 | |||
152 | /** | ||
153 | * efi_pstore_sysfs_entry_iter | ||
154 | * | ||
155 | * @data: function-specific data to pass to callback | ||
156 | * @pos: entry to begin iterating from | ||
157 | * | ||
158 | * You MUST call efivar_enter_iter_begin() before this function, and | ||
159 | * efivar_entry_iter_end() afterwards. | ||
160 | * | ||
161 | * It is possible to begin iteration from an arbitrary entry within | ||
162 | * the list by passing @pos. @pos is updated on return to point to | ||
163 | * the next entry of the last one passed to efi_pstore_read_func(). | ||
164 | * To begin iterating from the beginning of the list @pos must be %NULL. | ||
165 | */ | ||
166 | static int efi_pstore_sysfs_entry_iter(void *data, struct efivar_entry **pos) | ||
167 | { | ||
168 | struct efivar_entry *entry, *n; | ||
169 | struct list_head *head = &efivar_sysfs_list; | ||
170 | int size = 0; | ||
171 | |||
172 | if (!*pos) { | ||
173 | list_for_each_entry_safe(entry, n, head, list) { | ||
174 | efi_pstore_scan_sysfs_enter(entry, n, head); | ||
175 | |||
176 | size = efi_pstore_read_func(entry, data); | ||
177 | efi_pstore_scan_sysfs_exit(entry, n, head, size < 0); | ||
178 | if (size) | ||
179 | break; | ||
180 | } | ||
181 | *pos = n; | ||
182 | return size; | ||
183 | } | ||
184 | |||
185 | list_for_each_entry_safe_from((*pos), n, head, list) { | ||
186 | efi_pstore_scan_sysfs_enter((*pos), n, head); | ||
187 | |||
188 | size = efi_pstore_read_func((*pos), data); | ||
189 | efi_pstore_scan_sysfs_exit((*pos), n, head, size < 0); | ||
190 | if (size) | ||
191 | break; | ||
192 | } | ||
193 | *pos = n; | ||
194 | return size; | ||
195 | } | ||
196 | |||
197 | /** | ||
198 | * efi_pstore_read | ||
199 | * | ||
200 | * This function returns a size of NVRAM entry logged via efi_pstore_write(). | ||
201 | * The meaning and behavior of efi_pstore/pstore are as below. | ||
202 | * | ||
203 | * size > 0: Got data of an entry logged via efi_pstore_write() successfully, | ||
204 | * and pstore filesystem will continue reading subsequent entries. | ||
205 | * size == 0: Entry was not logged via efi_pstore_write(), | ||
206 | * and efi_pstore driver will continue reading subsequent entries. | ||
207 | * size < 0: Failed to get data of entry logging via efi_pstore_write(), | ||
208 | * and pstore will stop reading entry. | ||
209 | */ | ||
101 | static ssize_t efi_pstore_read(u64 *id, enum pstore_type_id *type, | 210 | static ssize_t efi_pstore_read(u64 *id, enum pstore_type_id *type, |
102 | int *count, struct timespec *timespec, | 211 | int *count, struct timespec *timespec, |
103 | char **buf, bool *compressed, | 212 | char **buf, bool *compressed, |
104 | struct pstore_info *psi) | 213 | struct pstore_info *psi) |
105 | { | 214 | { |
106 | struct pstore_read_data data; | 215 | struct pstore_read_data data; |
216 | ssize_t size; | ||
107 | 217 | ||
108 | data.id = id; | 218 | data.id = id; |
109 | data.type = type; | 219 | data.type = type; |
@@ -112,8 +222,17 @@ static ssize_t efi_pstore_read(u64 *id, enum pstore_type_id *type, | |||
112 | data.compressed = compressed; | 222 | data.compressed = compressed; |
113 | data.buf = buf; | 223 | data.buf = buf; |
114 | 224 | ||
115 | return __efivar_entry_iter(efi_pstore_read_func, &efivar_sysfs_list, &data, | 225 | *data.buf = kzalloc(EFIVARS_DATA_SIZE_MAX, GFP_KERNEL); |
116 | (struct efivar_entry **)&psi->data); | 226 | if (!*data.buf) |
227 | return -ENOMEM; | ||
228 | |||
229 | efivar_entry_iter_begin(); | ||
230 | size = efi_pstore_sysfs_entry_iter(&data, | ||
231 | (struct efivar_entry **)&psi->data); | ||
232 | efivar_entry_iter_end(); | ||
233 | if (size <= 0) | ||
234 | kfree(*data.buf); | ||
235 | return size; | ||
117 | } | 236 | } |
118 | 237 | ||
119 | static int efi_pstore_write(enum pstore_type_id type, | 238 | static int efi_pstore_write(enum pstore_type_id type, |
@@ -184,9 +303,17 @@ static int efi_pstore_erase_func(struct efivar_entry *entry, void *data) | |||
184 | return 0; | 303 | return 0; |
185 | } | 304 | } |
186 | 305 | ||
306 | if (entry->scanning) { | ||
307 | /* | ||
308 | * Skip deletion because this entry will be deleted | ||
309 | * after scanning is completed. | ||
310 | */ | ||
311 | entry->deleting = true; | ||
312 | } else | ||
313 | list_del(&entry->list); | ||
314 | |||
187 | /* found */ | 315 | /* found */ |
188 | __efivar_entry_delete(entry); | 316 | __efivar_entry_delete(entry); |
189 | list_del(&entry->list); | ||
190 | 317 | ||
191 | return 1; | 318 | return 1; |
192 | } | 319 | } |
@@ -199,14 +326,16 @@ static int efi_pstore_erase(enum pstore_type_id type, u64 id, int count, | |||
199 | char name[DUMP_NAME_LEN]; | 326 | char name[DUMP_NAME_LEN]; |
200 | efi_char16_t efi_name[DUMP_NAME_LEN]; | 327 | efi_char16_t efi_name[DUMP_NAME_LEN]; |
201 | int found, i; | 328 | int found, i; |
329 | unsigned int part; | ||
202 | 330 | ||
203 | sprintf(name, "dump-type%u-%u-%d-%lu", type, (unsigned int)id, count, | 331 | do_div(id, 1000); |
204 | time.tv_sec); | 332 | part = do_div(id, 100); |
333 | sprintf(name, "dump-type%u-%u-%d-%lu", type, part, count, time.tv_sec); | ||
205 | 334 | ||
206 | for (i = 0; i < DUMP_NAME_LEN; i++) | 335 | for (i = 0; i < DUMP_NAME_LEN; i++) |
207 | efi_name[i] = name[i]; | 336 | efi_name[i] = name[i]; |
208 | 337 | ||
209 | edata.id = id; | 338 | edata.id = part; |
210 | edata.type = type; | 339 | edata.type = type; |
211 | edata.count = count; | 340 | edata.count = count; |
212 | edata.time = time; | 341 | edata.time = time; |
@@ -214,10 +343,12 @@ static int efi_pstore_erase(enum pstore_type_id type, u64 id, int count, | |||
214 | 343 | ||
215 | efivar_entry_iter_begin(); | 344 | efivar_entry_iter_begin(); |
216 | found = __efivar_entry_iter(efi_pstore_erase_func, &efivar_sysfs_list, &edata, &entry); | 345 | found = __efivar_entry_iter(efi_pstore_erase_func, &efivar_sysfs_list, &edata, &entry); |
217 | efivar_entry_iter_end(); | ||
218 | 346 | ||
219 | if (found) | 347 | if (found && !entry->scanning) { |
348 | efivar_entry_iter_end(); | ||
220 | efivar_unregister(entry); | 349 | efivar_unregister(entry); |
350 | } else | ||
351 | efivar_entry_iter_end(); | ||
221 | 352 | ||
222 | return 0; | 353 | return 0; |
223 | } | 354 | } |
diff --git a/drivers/firmware/efi/efivars.c b/drivers/firmware/efi/efivars.c index 933eb027d527..3dc248239197 100644 --- a/drivers/firmware/efi/efivars.c +++ b/drivers/firmware/efi/efivars.c | |||
@@ -383,12 +383,16 @@ static ssize_t efivar_delete(struct file *filp, struct kobject *kobj, | |||
383 | else if (__efivar_entry_delete(entry)) | 383 | else if (__efivar_entry_delete(entry)) |
384 | err = -EIO; | 384 | err = -EIO; |
385 | 385 | ||
386 | efivar_entry_iter_end(); | 386 | if (err) { |
387 | 387 | efivar_entry_iter_end(); | |
388 | if (err) | ||
389 | return err; | 388 | return err; |
389 | } | ||
390 | 390 | ||
391 | efivar_unregister(entry); | 391 | if (!entry->scanning) { |
392 | efivar_entry_iter_end(); | ||
393 | efivar_unregister(entry); | ||
394 | } else | ||
395 | efivar_entry_iter_end(); | ||
392 | 396 | ||
393 | /* It's dead Jim.... */ | 397 | /* It's dead Jim.... */ |
394 | return count; | 398 | return count; |
diff --git a/drivers/firmware/efi/vars.c b/drivers/firmware/efi/vars.c index 391c67b182d9..b22659cccca4 100644 --- a/drivers/firmware/efi/vars.c +++ b/drivers/firmware/efi/vars.c | |||
@@ -683,8 +683,16 @@ struct efivar_entry *efivar_entry_find(efi_char16_t *name, efi_guid_t guid, | |||
683 | if (!found) | 683 | if (!found) |
684 | return NULL; | 684 | return NULL; |
685 | 685 | ||
686 | if (remove) | 686 | if (remove) { |
687 | list_del(&entry->list); | 687 | if (entry->scanning) { |
688 | /* | ||
689 | * The entry will be deleted | ||
690 | * after scanning is completed. | ||
691 | */ | ||
692 | entry->deleting = true; | ||
693 | } else | ||
694 | list_del(&entry->list); | ||
695 | } | ||
688 | 696 | ||
689 | return entry; | 697 | return entry; |
690 | } | 698 | } |
diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig index 0f0444475bf0..7c75f5a442b0 100644 --- a/drivers/gpio/Kconfig +++ b/drivers/gpio/Kconfig | |||
@@ -115,6 +115,13 @@ config GPIO_CLPS711X | |||
115 | help | 115 | help |
116 | Say yes here to support GPIO on CLPS711X SoCs. | 116 | Say yes here to support GPIO on CLPS711X SoCs. |
117 | 117 | ||
118 | config GPIO_DAVINCI | ||
119 | bool "TI Davinci/Keystone GPIO support" | ||
120 | default y if ARCH_DAVINCI | ||
121 | depends on ARM && (ARCH_DAVINCI || ARCH_KEYSTONE) | ||
122 | help | ||
123 | Say yes here to enable GPIO support for TI Davinci/Keystone SoCs. | ||
124 | |||
118 | config GPIO_GENERIC_PLATFORM | 125 | config GPIO_GENERIC_PLATFORM |
119 | tristate "Generic memory-mapped GPIO controller support (MMIO platform device)" | 126 | tristate "Generic memory-mapped GPIO controller support (MMIO platform device)" |
120 | select GPIO_GENERIC | 127 | select GPIO_GENERIC |
diff --git a/drivers/gpio/Makefile b/drivers/gpio/Makefile index 7971e36b8b12..28a0ffc12c87 100644 --- a/drivers/gpio/Makefile +++ b/drivers/gpio/Makefile | |||
@@ -22,7 +22,7 @@ obj-$(CONFIG_GPIO_CLPS711X) += gpio-clps711x.o | |||
22 | obj-$(CONFIG_GPIO_CS5535) += gpio-cs5535.o | 22 | obj-$(CONFIG_GPIO_CS5535) += gpio-cs5535.o |
23 | obj-$(CONFIG_GPIO_DA9052) += gpio-da9052.o | 23 | obj-$(CONFIG_GPIO_DA9052) += gpio-da9052.o |
24 | obj-$(CONFIG_GPIO_DA9055) += gpio-da9055.o | 24 | obj-$(CONFIG_GPIO_DA9055) += gpio-da9055.o |
25 | obj-$(CONFIG_ARCH_DAVINCI) += gpio-davinci.o | 25 | obj-$(CONFIG_GPIO_DAVINCI) += gpio-davinci.o |
26 | obj-$(CONFIG_GPIO_EM) += gpio-em.o | 26 | obj-$(CONFIG_GPIO_EM) += gpio-em.o |
27 | obj-$(CONFIG_GPIO_EP93XX) += gpio-ep93xx.o | 27 | obj-$(CONFIG_GPIO_EP93XX) += gpio-ep93xx.o |
28 | obj-$(CONFIG_GPIO_F7188X) += gpio-f7188x.o | 28 | obj-$(CONFIG_GPIO_F7188X) += gpio-f7188x.o |
diff --git a/drivers/gpio/gpio-davinci.c b/drivers/gpio/gpio-davinci.c index 8847adf392b7..7629b4f12b7f 100644 --- a/drivers/gpio/gpio-davinci.c +++ b/drivers/gpio/gpio-davinci.c | |||
@@ -16,8 +16,13 @@ | |||
16 | #include <linux/err.h> | 16 | #include <linux/err.h> |
17 | #include <linux/io.h> | 17 | #include <linux/io.h> |
18 | #include <linux/irq.h> | 18 | #include <linux/irq.h> |
19 | #include <linux/irqdomain.h> | ||
20 | #include <linux/module.h> | ||
21 | #include <linux/of.h> | ||
22 | #include <linux/of_device.h> | ||
19 | #include <linux/platform_device.h> | 23 | #include <linux/platform_device.h> |
20 | #include <linux/platform_data/gpio-davinci.h> | 24 | #include <linux/platform_data/gpio-davinci.h> |
25 | #include <linux/irqchip/chained_irq.h> | ||
21 | 26 | ||
22 | struct davinci_gpio_regs { | 27 | struct davinci_gpio_regs { |
23 | u32 dir; | 28 | u32 dir; |
@@ -82,14 +87,14 @@ static inline int __davinci_direction(struct gpio_chip *chip, | |||
82 | u32 mask = 1 << offset; | 87 | u32 mask = 1 << offset; |
83 | 88 | ||
84 | spin_lock_irqsave(&d->lock, flags); | 89 | spin_lock_irqsave(&d->lock, flags); |
85 | temp = __raw_readl(&g->dir); | 90 | temp = readl_relaxed(&g->dir); |
86 | if (out) { | 91 | if (out) { |
87 | temp &= ~mask; | 92 | temp &= ~mask; |
88 | __raw_writel(mask, value ? &g->set_data : &g->clr_data); | 93 | writel_relaxed(mask, value ? &g->set_data : &g->clr_data); |
89 | } else { | 94 | } else { |
90 | temp |= mask; | 95 | temp |= mask; |
91 | } | 96 | } |
92 | __raw_writel(temp, &g->dir); | 97 | writel_relaxed(temp, &g->dir); |
93 | spin_unlock_irqrestore(&d->lock, flags); | 98 | spin_unlock_irqrestore(&d->lock, flags); |
94 | 99 | ||
95 | return 0; | 100 | return 0; |
@@ -118,7 +123,7 @@ static int davinci_gpio_get(struct gpio_chip *chip, unsigned offset) | |||
118 | struct davinci_gpio_controller *d = chip2controller(chip); | 123 | struct davinci_gpio_controller *d = chip2controller(chip); |
119 | struct davinci_gpio_regs __iomem *g = d->regs; | 124 | struct davinci_gpio_regs __iomem *g = d->regs; |
120 | 125 | ||
121 | return (1 << offset) & __raw_readl(&g->in_data); | 126 | return (1 << offset) & readl_relaxed(&g->in_data); |
122 | } | 127 | } |
123 | 128 | ||
124 | /* | 129 | /* |
@@ -130,7 +135,41 @@ davinci_gpio_set(struct gpio_chip *chip, unsigned offset, int value) | |||
130 | struct davinci_gpio_controller *d = chip2controller(chip); | 135 | struct davinci_gpio_controller *d = chip2controller(chip); |
131 | struct davinci_gpio_regs __iomem *g = d->regs; | 136 | struct davinci_gpio_regs __iomem *g = d->regs; |
132 | 137 | ||
133 | __raw_writel((1 << offset), value ? &g->set_data : &g->clr_data); | 138 | writel_relaxed((1 << offset), value ? &g->set_data : &g->clr_data); |
139 | } | ||
140 | |||
141 | static struct davinci_gpio_platform_data * | ||
142 | davinci_gpio_get_pdata(struct platform_device *pdev) | ||
143 | { | ||
144 | struct device_node *dn = pdev->dev.of_node; | ||
145 | struct davinci_gpio_platform_data *pdata; | ||
146 | int ret; | ||
147 | u32 val; | ||
148 | |||
149 | if (!IS_ENABLED(CONFIG_OF) || !pdev->dev.of_node) | ||
150 | return pdev->dev.platform_data; | ||
151 | |||
152 | pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL); | ||
153 | if (!pdata) | ||
154 | return NULL; | ||
155 | |||
156 | ret = of_property_read_u32(dn, "ti,ngpio", &val); | ||
157 | if (ret) | ||
158 | goto of_err; | ||
159 | |||
160 | pdata->ngpio = val; | ||
161 | |||
162 | ret = of_property_read_u32(dn, "ti,davinci-gpio-unbanked", &val); | ||
163 | if (ret) | ||
164 | goto of_err; | ||
165 | |||
166 | pdata->gpio_unbanked = val; | ||
167 | |||
168 | return pdata; | ||
169 | |||
170 | of_err: | ||
171 | dev_err(&pdev->dev, "Populating pdata from DT failed: err %d\n", ret); | ||
172 | return NULL; | ||
134 | } | 173 | } |
135 | 174 | ||
136 | static int davinci_gpio_probe(struct platform_device *pdev) | 175 | static int davinci_gpio_probe(struct platform_device *pdev) |
@@ -143,12 +182,14 @@ static int davinci_gpio_probe(struct platform_device *pdev) | |||
143 | struct device *dev = &pdev->dev; | 182 | struct device *dev = &pdev->dev; |
144 | struct resource *res; | 183 | struct resource *res; |
145 | 184 | ||
146 | pdata = dev->platform_data; | 185 | pdata = davinci_gpio_get_pdata(pdev); |
147 | if (!pdata) { | 186 | if (!pdata) { |
148 | dev_err(dev, "No platform data found\n"); | 187 | dev_err(dev, "No platform data found\n"); |
149 | return -EINVAL; | 188 | return -EINVAL; |
150 | } | 189 | } |
151 | 190 | ||
191 | dev->platform_data = pdata; | ||
192 | |||
152 | /* | 193 | /* |
153 | * The gpio banks conceptually expose a segmented bitmap, | 194 | * The gpio banks conceptually expose a segmented bitmap, |
154 | * and "ngpio" is one more than the largest zero-based | 195 | * and "ngpio" is one more than the largest zero-based |
@@ -160,8 +201,8 @@ static int davinci_gpio_probe(struct platform_device *pdev) | |||
160 | return -EINVAL; | 201 | return -EINVAL; |
161 | } | 202 | } |
162 | 203 | ||
163 | if (WARN_ON(DAVINCI_N_GPIO < ngpio)) | 204 | if (WARN_ON(ARCH_NR_GPIOS < ngpio)) |
164 | ngpio = DAVINCI_N_GPIO; | 205 | ngpio = ARCH_NR_GPIOS; |
165 | 206 | ||
166 | chips = devm_kzalloc(dev, | 207 | chips = devm_kzalloc(dev, |
167 | ngpio * sizeof(struct davinci_gpio_controller), | 208 | ngpio * sizeof(struct davinci_gpio_controller), |
@@ -194,6 +235,9 @@ static int davinci_gpio_probe(struct platform_device *pdev) | |||
194 | if (chips[i].chip.ngpio > 32) | 235 | if (chips[i].chip.ngpio > 32) |
195 | chips[i].chip.ngpio = 32; | 236 | chips[i].chip.ngpio = 32; |
196 | 237 | ||
238 | #ifdef CONFIG_OF_GPIO | ||
239 | chips[i].chip.of_node = dev->of_node; | ||
240 | #endif | ||
197 | spin_lock_init(&chips[i].lock); | 241 | spin_lock_init(&chips[i].lock); |
198 | 242 | ||
199 | regs = gpio2regs(base); | 243 | regs = gpio2regs(base); |
@@ -227,8 +271,8 @@ static void gpio_irq_disable(struct irq_data *d) | |||
227 | struct davinci_gpio_regs __iomem *g = irq2regs(d->irq); | 271 | struct davinci_gpio_regs __iomem *g = irq2regs(d->irq); |
228 | u32 mask = (u32) irq_data_get_irq_handler_data(d); | 272 | u32 mask = (u32) irq_data_get_irq_handler_data(d); |
229 | 273 | ||
230 | __raw_writel(mask, &g->clr_falling); | 274 | writel_relaxed(mask, &g->clr_falling); |
231 | __raw_writel(mask, &g->clr_rising); | 275 | writel_relaxed(mask, &g->clr_rising); |
232 | } | 276 | } |
233 | 277 | ||
234 | static void gpio_irq_enable(struct irq_data *d) | 278 | static void gpio_irq_enable(struct irq_data *d) |
@@ -242,9 +286,9 @@ static void gpio_irq_enable(struct irq_data *d) | |||
242 | status = IRQ_TYPE_EDGE_FALLING | IRQ_TYPE_EDGE_RISING; | 286 | status = IRQ_TYPE_EDGE_FALLING | IRQ_TYPE_EDGE_RISING; |
243 | 287 | ||
244 | if (status & IRQ_TYPE_EDGE_FALLING) | 288 | if (status & IRQ_TYPE_EDGE_FALLING) |
245 | __raw_writel(mask, &g->set_falling); | 289 | writel_relaxed(mask, &g->set_falling); |
246 | if (status & IRQ_TYPE_EDGE_RISING) | 290 | if (status & IRQ_TYPE_EDGE_RISING) |
247 | __raw_writel(mask, &g->set_rising); | 291 | writel_relaxed(mask, &g->set_rising); |
248 | } | 292 | } |
249 | 293 | ||
250 | static int gpio_irq_type(struct irq_data *d, unsigned trigger) | 294 | static int gpio_irq_type(struct irq_data *d, unsigned trigger) |
@@ -278,34 +322,28 @@ gpio_irq_handler(unsigned irq, struct irq_desc *desc) | |||
278 | mask <<= 16; | 322 | mask <<= 16; |
279 | 323 | ||
280 | /* temporarily mask (level sensitive) parent IRQ */ | 324 | /* temporarily mask (level sensitive) parent IRQ */ |
281 | desc->irq_data.chip->irq_mask(&desc->irq_data); | 325 | chained_irq_enter(irq_desc_get_chip(desc), desc); |
282 | desc->irq_data.chip->irq_ack(&desc->irq_data); | ||
283 | while (1) { | 326 | while (1) { |
284 | u32 status; | 327 | u32 status; |
285 | int n; | 328 | int bit; |
286 | int res; | ||
287 | 329 | ||
288 | /* ack any irqs */ | 330 | /* ack any irqs */ |
289 | status = __raw_readl(&g->intstat) & mask; | 331 | status = readl_relaxed(&g->intstat) & mask; |
290 | if (!status) | 332 | if (!status) |
291 | break; | 333 | break; |
292 | __raw_writel(status, &g->intstat); | 334 | writel_relaxed(status, &g->intstat); |
293 | 335 | ||
294 | /* now demux them to the right lowlevel handler */ | 336 | /* now demux them to the right lowlevel handler */ |
295 | n = d->irq_base; | ||
296 | if (irq & 1) { | ||
297 | n += 16; | ||
298 | status >>= 16; | ||
299 | } | ||
300 | 337 | ||
301 | while (status) { | 338 | while (status) { |
302 | res = ffs(status); | 339 | bit = __ffs(status); |
303 | n += res; | 340 | status &= ~BIT(bit); |
304 | generic_handle_irq(n - 1); | 341 | generic_handle_irq( |
305 | status >>= res; | 342 | irq_find_mapping(d->irq_domain, |
343 | d->chip.base + bit)); | ||
306 | } | 344 | } |
307 | } | 345 | } |
308 | desc->irq_data.chip->irq_unmask(&desc->irq_data); | 346 | chained_irq_exit(irq_desc_get_chip(desc), desc); |
309 | /* now it may re-trigger */ | 347 | /* now it may re-trigger */ |
310 | } | 348 | } |
311 | 349 | ||
@@ -313,10 +351,10 @@ static int gpio_to_irq_banked(struct gpio_chip *chip, unsigned offset) | |||
313 | { | 351 | { |
314 | struct davinci_gpio_controller *d = chip2controller(chip); | 352 | struct davinci_gpio_controller *d = chip2controller(chip); |
315 | 353 | ||
316 | if (d->irq_base >= 0) | 354 | if (d->irq_domain) |
317 | return d->irq_base + offset; | 355 | return irq_create_mapping(d->irq_domain, d->chip.base + offset); |
318 | else | 356 | else |
319 | return -ENODEV; | 357 | return -ENXIO; |
320 | } | 358 | } |
321 | 359 | ||
322 | static int gpio_to_irq_unbanked(struct gpio_chip *chip, unsigned offset) | 360 | static int gpio_to_irq_unbanked(struct gpio_chip *chip, unsigned offset) |
@@ -327,7 +365,7 @@ static int gpio_to_irq_unbanked(struct gpio_chip *chip, unsigned offset) | |||
327 | * NOTE: we assume for now that only irqs in the first gpio_chip | 365 | * NOTE: we assume for now that only irqs in the first gpio_chip |
328 | * can provide direct-mapped IRQs to AINTC (up to 32 GPIOs). | 366 | * can provide direct-mapped IRQs to AINTC (up to 32 GPIOs). |
329 | */ | 367 | */ |
330 | if (offset < d->irq_base) | 368 | if (offset < d->gpio_unbanked) |
331 | return d->gpio_irq + offset; | 369 | return d->gpio_irq + offset; |
332 | else | 370 | else |
333 | return -ENODEV; | 371 | return -ENODEV; |
@@ -346,14 +384,35 @@ static int gpio_irq_type_unbanked(struct irq_data *data, unsigned trigger) | |||
346 | if (trigger & ~(IRQ_TYPE_EDGE_FALLING | IRQ_TYPE_EDGE_RISING)) | 384 | if (trigger & ~(IRQ_TYPE_EDGE_FALLING | IRQ_TYPE_EDGE_RISING)) |
347 | return -EINVAL; | 385 | return -EINVAL; |
348 | 386 | ||
349 | __raw_writel(mask, (trigger & IRQ_TYPE_EDGE_FALLING) | 387 | writel_relaxed(mask, (trigger & IRQ_TYPE_EDGE_FALLING) |
350 | ? &g->set_falling : &g->clr_falling); | 388 | ? &g->set_falling : &g->clr_falling); |
351 | __raw_writel(mask, (trigger & IRQ_TYPE_EDGE_RISING) | 389 | writel_relaxed(mask, (trigger & IRQ_TYPE_EDGE_RISING) |
352 | ? &g->set_rising : &g->clr_rising); | 390 | ? &g->set_rising : &g->clr_rising); |
353 | 391 | ||
354 | return 0; | 392 | return 0; |
355 | } | 393 | } |
356 | 394 | ||
395 | static int | ||
396 | davinci_gpio_irq_map(struct irq_domain *d, unsigned int irq, | ||
397 | irq_hw_number_t hw) | ||
398 | { | ||
399 | struct davinci_gpio_regs __iomem *g = gpio2regs(hw); | ||
400 | |||
401 | irq_set_chip_and_handler_name(irq, &gpio_irqchip, handle_simple_irq, | ||
402 | "davinci_gpio"); | ||
403 | irq_set_irq_type(irq, IRQ_TYPE_NONE); | ||
404 | irq_set_chip_data(irq, (__force void *)g); | ||
405 | irq_set_handler_data(irq, (void *)__gpio_mask(hw)); | ||
406 | set_irq_flags(irq, IRQF_VALID); | ||
407 | |||
408 | return 0; | ||
409 | } | ||
410 | |||
411 | static const struct irq_domain_ops davinci_gpio_irq_ops = { | ||
412 | .map = davinci_gpio_irq_map, | ||
413 | .xlate = irq_domain_xlate_onetwocell, | ||
414 | }; | ||
415 | |||
357 | /* | 416 | /* |
358 | * NOTE: for suspend/resume, probably best to make a platform_device with | 417 | * NOTE: for suspend/resume, probably best to make a platform_device with |
359 | * suspend_late/resume_resume calls hooking into results of the set_wake() | 418 | * suspend_late/resume_resume calls hooking into results of the set_wake() |
@@ -373,6 +432,7 @@ static int davinci_gpio_irq_setup(struct platform_device *pdev) | |||
373 | struct davinci_gpio_controller *chips = platform_get_drvdata(pdev); | 432 | struct davinci_gpio_controller *chips = platform_get_drvdata(pdev); |
374 | struct davinci_gpio_platform_data *pdata = dev->platform_data; | 433 | struct davinci_gpio_platform_data *pdata = dev->platform_data; |
375 | struct davinci_gpio_regs __iomem *g; | 434 | struct davinci_gpio_regs __iomem *g; |
435 | struct irq_domain *irq_domain = NULL; | ||
376 | 436 | ||
377 | ngpio = pdata->ngpio; | 437 | ngpio = pdata->ngpio; |
378 | res = platform_get_resource(pdev, IORESOURCE_IRQ, 0); | 438 | res = platform_get_resource(pdev, IORESOURCE_IRQ, 0); |
@@ -396,6 +456,22 @@ static int davinci_gpio_irq_setup(struct platform_device *pdev) | |||
396 | } | 456 | } |
397 | clk_prepare_enable(clk); | 457 | clk_prepare_enable(clk); |
398 | 458 | ||
459 | if (!pdata->gpio_unbanked) { | ||
460 | irq = irq_alloc_descs(-1, 0, ngpio, 0); | ||
461 | if (irq < 0) { | ||
462 | dev_err(dev, "Couldn't allocate IRQ numbers\n"); | ||
463 | return irq; | ||
464 | } | ||
465 | |||
466 | irq_domain = irq_domain_add_legacy(NULL, ngpio, irq, 0, | ||
467 | &davinci_gpio_irq_ops, | ||
468 | chips); | ||
469 | if (!irq_domain) { | ||
470 | dev_err(dev, "Couldn't register an IRQ domain\n"); | ||
471 | return -ENODEV; | ||
472 | } | ||
473 | } | ||
474 | |||
399 | /* | 475 | /* |
400 | * Arrange gpio_to_irq() support, handling either direct IRQs or | 476 | * Arrange gpio_to_irq() support, handling either direct IRQs or |
401 | * banked IRQs. Having GPIOs in the first GPIO bank use direct | 477 | * banked IRQs. Having GPIOs in the first GPIO bank use direct |
@@ -404,9 +480,7 @@ static int davinci_gpio_irq_setup(struct platform_device *pdev) | |||
404 | */ | 480 | */ |
405 | for (gpio = 0, bank = 0; gpio < ngpio; bank++, gpio += 32) { | 481 | for (gpio = 0, bank = 0; gpio < ngpio; bank++, gpio += 32) { |
406 | chips[bank].chip.to_irq = gpio_to_irq_banked; | 482 | chips[bank].chip.to_irq = gpio_to_irq_banked; |
407 | chips[bank].irq_base = pdata->gpio_unbanked | 483 | chips[bank].irq_domain = irq_domain; |
408 | ? -EINVAL | ||
409 | : (pdata->intc_irq_num + gpio); | ||
410 | } | 484 | } |
411 | 485 | ||
412 | /* | 486 | /* |
@@ -419,6 +493,8 @@ static int davinci_gpio_irq_setup(struct platform_device *pdev) | |||
419 | 493 | ||
420 | /* pass "bank 0" GPIO IRQs to AINTC */ | 494 | /* pass "bank 0" GPIO IRQs to AINTC */ |
421 | chips[0].chip.to_irq = gpio_to_irq_unbanked; | 495 | chips[0].chip.to_irq = gpio_to_irq_unbanked; |
496 | chips[0].gpio_irq = bank_irq; | ||
497 | chips[0].gpio_unbanked = pdata->gpio_unbanked; | ||
422 | binten = BIT(0); | 498 | binten = BIT(0); |
423 | 499 | ||
424 | /* AINTC handles mask/unmask; GPIO handles triggering */ | 500 | /* AINTC handles mask/unmask; GPIO handles triggering */ |
@@ -430,8 +506,8 @@ static int davinci_gpio_irq_setup(struct platform_device *pdev) | |||
430 | 506 | ||
431 | /* default trigger: both edges */ | 507 | /* default trigger: both edges */ |
432 | g = gpio2regs(0); | 508 | g = gpio2regs(0); |
433 | __raw_writel(~0, &g->set_falling); | 509 | writel_relaxed(~0, &g->set_falling); |
434 | __raw_writel(~0, &g->set_rising); | 510 | writel_relaxed(~0, &g->set_rising); |
435 | 511 | ||
436 | /* set the direct IRQs up to use that irqchip */ | 512 | /* set the direct IRQs up to use that irqchip */ |
437 | for (gpio = 0; gpio < pdata->gpio_unbanked; gpio++, irq++) { | 513 | for (gpio = 0; gpio < pdata->gpio_unbanked; gpio++, irq++) { |
@@ -447,15 +523,11 @@ static int davinci_gpio_irq_setup(struct platform_device *pdev) | |||
447 | * Or, AINTC can handle IRQs for banks of 16 GPIO IRQs, which we | 523 | * Or, AINTC can handle IRQs for banks of 16 GPIO IRQs, which we |
448 | * then chain through our own handler. | 524 | * then chain through our own handler. |
449 | */ | 525 | */ |
450 | for (gpio = 0, irq = gpio_to_irq(0), bank = 0; | 526 | for (gpio = 0, bank = 0; gpio < ngpio; bank++, bank_irq++, gpio += 16) { |
451 | gpio < ngpio; | ||
452 | bank++, bank_irq++) { | ||
453 | unsigned i; | ||
454 | |||
455 | /* disabled by default, enabled only as needed */ | 527 | /* disabled by default, enabled only as needed */ |
456 | g = gpio2regs(gpio); | 528 | g = gpio2regs(gpio); |
457 | __raw_writel(~0, &g->clr_falling); | 529 | writel_relaxed(~0, &g->clr_falling); |
458 | __raw_writel(~0, &g->clr_rising); | 530 | writel_relaxed(~0, &g->clr_rising); |
459 | 531 | ||
460 | /* set up all irqs in this bank */ | 532 | /* set up all irqs in this bank */ |
461 | irq_set_chained_handler(bank_irq, gpio_irq_handler); | 533 | irq_set_chained_handler(bank_irq, gpio_irq_handler); |
@@ -467,14 +539,6 @@ static int davinci_gpio_irq_setup(struct platform_device *pdev) | |||
467 | */ | 539 | */ |
468 | irq_set_handler_data(bank_irq, &chips[gpio / 32]); | 540 | irq_set_handler_data(bank_irq, &chips[gpio / 32]); |
469 | 541 | ||
470 | for (i = 0; i < 16 && gpio < ngpio; i++, irq++, gpio++) { | ||
471 | irq_set_chip(irq, &gpio_irqchip); | ||
472 | irq_set_chip_data(irq, (__force void *)g); | ||
473 | irq_set_handler_data(irq, (void *)__gpio_mask(gpio)); | ||
474 | irq_set_handler(irq, handle_simple_irq); | ||
475 | set_irq_flags(irq, IRQF_VALID); | ||
476 | } | ||
477 | |||
478 | binten |= BIT(bank); | 542 | binten |= BIT(bank); |
479 | } | 543 | } |
480 | 544 | ||
@@ -483,18 +547,25 @@ done: | |||
483 | * BINTEN -- per-bank interrupt enable. genirq would also let these | 547 | * BINTEN -- per-bank interrupt enable. genirq would also let these |
484 | * bits be set/cleared dynamically. | 548 | * bits be set/cleared dynamically. |
485 | */ | 549 | */ |
486 | __raw_writel(binten, gpio_base + BINTEN); | 550 | writel_relaxed(binten, gpio_base + BINTEN); |
487 | |||
488 | printk(KERN_INFO "DaVinci: %d gpio irqs\n", irq - gpio_to_irq(0)); | ||
489 | 551 | ||
490 | return 0; | 552 | return 0; |
491 | } | 553 | } |
492 | 554 | ||
555 | #if IS_ENABLED(CONFIG_OF) | ||
556 | static const struct of_device_id davinci_gpio_ids[] = { | ||
557 | { .compatible = "ti,dm6441-gpio", }, | ||
558 | { /* sentinel */ }, | ||
559 | }; | ||
560 | MODULE_DEVICE_TABLE(of, davinci_gpio_ids); | ||
561 | #endif | ||
562 | |||
493 | static struct platform_driver davinci_gpio_driver = { | 563 | static struct platform_driver davinci_gpio_driver = { |
494 | .probe = davinci_gpio_probe, | 564 | .probe = davinci_gpio_probe, |
495 | .driver = { | 565 | .driver = { |
496 | .name = "davinci_gpio", | 566 | .name = "davinci_gpio", |
497 | .owner = THIS_MODULE, | 567 | .owner = THIS_MODULE, |
568 | .of_match_table = of_match_ptr(davinci_gpio_ids), | ||
498 | }, | 569 | }, |
499 | }; | 570 | }; |
500 | 571 | ||
diff --git a/drivers/gpio/gpio-mpc8xxx.c b/drivers/gpio/gpio-mpc8xxx.c index 914e859e3eda..d7d6d72eba33 100644 --- a/drivers/gpio/gpio-mpc8xxx.c +++ b/drivers/gpio/gpio-mpc8xxx.c | |||
@@ -70,10 +70,14 @@ static int mpc8572_gpio_get(struct gpio_chip *gc, unsigned int gpio) | |||
70 | u32 val; | 70 | u32 val; |
71 | struct of_mm_gpio_chip *mm = to_of_mm_gpio_chip(gc); | 71 | struct of_mm_gpio_chip *mm = to_of_mm_gpio_chip(gc); |
72 | struct mpc8xxx_gpio_chip *mpc8xxx_gc = to_mpc8xxx_gpio_chip(mm); | 72 | struct mpc8xxx_gpio_chip *mpc8xxx_gc = to_mpc8xxx_gpio_chip(mm); |
73 | u32 out_mask, out_shadow; | ||
73 | 74 | ||
74 | val = in_be32(mm->regs + GPIO_DAT) & ~in_be32(mm->regs + GPIO_DIR); | 75 | out_mask = in_be32(mm->regs + GPIO_DIR); |
75 | 76 | ||
76 | return (val | mpc8xxx_gc->data) & mpc8xxx_gpio2mask(gpio); | 77 | val = in_be32(mm->regs + GPIO_DAT) & ~out_mask; |
78 | out_shadow = mpc8xxx_gc->data & out_mask; | ||
79 | |||
80 | return (val | out_shadow) & mpc8xxx_gpio2mask(gpio); | ||
77 | } | 81 | } |
78 | 82 | ||
79 | static int mpc8xxx_gpio_get(struct gpio_chip *gc, unsigned int gpio) | 83 | static int mpc8xxx_gpio_get(struct gpio_chip *gc, unsigned int gpio) |
diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c index ac53a9593662..85f772c0b26a 100644 --- a/drivers/gpio/gpiolib.c +++ b/drivers/gpio/gpiolib.c | |||
@@ -2368,7 +2368,7 @@ static struct gpio_desc *gpiod_find(struct device *dev, const char *con_id, | |||
2368 | continue; | 2368 | continue; |
2369 | } | 2369 | } |
2370 | 2370 | ||
2371 | if (chip->ngpio >= p->chip_hwnum) { | 2371 | if (chip->ngpio <= p->chip_hwnum) { |
2372 | dev_warn(dev, "GPIO chip %s has %d GPIOs\n", | 2372 | dev_warn(dev, "GPIO chip %s has %d GPIOs\n", |
2373 | chip->label, chip->ngpio); | 2373 | chip->label, chip->ngpio); |
2374 | continue; | 2374 | continue; |
@@ -2418,7 +2418,7 @@ struct gpio_desc *__must_check gpiod_get_index(struct device *dev, | |||
2418 | const char *con_id, | 2418 | const char *con_id, |
2419 | unsigned int idx) | 2419 | unsigned int idx) |
2420 | { | 2420 | { |
2421 | struct gpio_desc *desc; | 2421 | struct gpio_desc *desc = NULL; |
2422 | int status; | 2422 | int status; |
2423 | enum gpio_lookup_flags flags = 0; | 2423 | enum gpio_lookup_flags flags = 0; |
2424 | 2424 | ||
@@ -2431,13 +2431,23 @@ struct gpio_desc *__must_check gpiod_get_index(struct device *dev, | |||
2431 | } else if (IS_ENABLED(CONFIG_ACPI) && dev && ACPI_HANDLE(dev)) { | 2431 | } else if (IS_ENABLED(CONFIG_ACPI) && dev && ACPI_HANDLE(dev)) { |
2432 | dev_dbg(dev, "using ACPI for GPIO lookup\n"); | 2432 | dev_dbg(dev, "using ACPI for GPIO lookup\n"); |
2433 | desc = acpi_find_gpio(dev, con_id, idx, &flags); | 2433 | desc = acpi_find_gpio(dev, con_id, idx, &flags); |
2434 | } else { | 2434 | } |
2435 | |||
2436 | /* | ||
2437 | * Either we are not using DT or ACPI, or their lookup did not return | ||
2438 | * a result. In that case, use platform lookup as a fallback. | ||
2439 | */ | ||
2440 | if (!desc || IS_ERR(desc)) { | ||
2441 | struct gpio_desc *pdesc; | ||
2435 | dev_dbg(dev, "using lookup tables for GPIO lookup"); | 2442 | dev_dbg(dev, "using lookup tables for GPIO lookup"); |
2436 | desc = gpiod_find(dev, con_id, idx, &flags); | 2443 | pdesc = gpiod_find(dev, con_id, idx, &flags); |
2444 | /* If used as fallback, do not replace the previous error */ | ||
2445 | if (!IS_ERR(pdesc) || !desc) | ||
2446 | desc = pdesc; | ||
2437 | } | 2447 | } |
2438 | 2448 | ||
2439 | if (IS_ERR(desc)) { | 2449 | if (IS_ERR(desc)) { |
2440 | dev_warn(dev, "lookup for GPIO %s failed\n", con_id); | 2450 | dev_dbg(dev, "lookup for GPIO %s failed\n", con_id); |
2441 | return desc; | 2451 | return desc; |
2442 | } | 2452 | } |
2443 | 2453 | ||
diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c index fb7cf0e796f6..0a1e4a5f4234 100644 --- a/drivers/gpu/drm/drm_edid.c +++ b/drivers/gpu/drm/drm_edid.c | |||
@@ -2674,7 +2674,7 @@ static int add_3d_struct_modes(struct drm_connector *connector, u16 structure, | |||
2674 | int modes = 0; | 2674 | int modes = 0; |
2675 | u8 cea_mode; | 2675 | u8 cea_mode; |
2676 | 2676 | ||
2677 | if (video_db == NULL || video_index > video_len) | 2677 | if (video_db == NULL || video_index >= video_len) |
2678 | return 0; | 2678 | return 0; |
2679 | 2679 | ||
2680 | /* CEA modes are numbered 1..127 */ | 2680 | /* CEA modes are numbered 1..127 */ |
@@ -2701,7 +2701,7 @@ static int add_3d_struct_modes(struct drm_connector *connector, u16 structure, | |||
2701 | if (structure & (1 << 8)) { | 2701 | if (structure & (1 << 8)) { |
2702 | newmode = drm_mode_duplicate(dev, &edid_cea_modes[cea_mode]); | 2702 | newmode = drm_mode_duplicate(dev, &edid_cea_modes[cea_mode]); |
2703 | if (newmode) { | 2703 | if (newmode) { |
2704 | newmode->flags = DRM_MODE_FLAG_3D_SIDE_BY_SIDE_HALF; | 2704 | newmode->flags |= DRM_MODE_FLAG_3D_SIDE_BY_SIDE_HALF; |
2705 | drm_mode_probed_add(connector, newmode); | 2705 | drm_mode_probed_add(connector, newmode); |
2706 | modes++; | 2706 | modes++; |
2707 | } | 2707 | } |
diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.c b/drivers/gpu/drm/exynos/exynos_drm_drv.c index b676006a95a0..22b8f5eced80 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_drv.c +++ b/drivers/gpu/drm/exynos/exynos_drm_drv.c | |||
@@ -173,28 +173,37 @@ static int exynos_drm_open(struct drm_device *dev, struct drm_file *file) | |||
173 | static void exynos_drm_preclose(struct drm_device *dev, | 173 | static void exynos_drm_preclose(struct drm_device *dev, |
174 | struct drm_file *file) | 174 | struct drm_file *file) |
175 | { | 175 | { |
176 | exynos_drm_subdrv_close(dev, file); | ||
177 | } | ||
178 | |||
179 | static void exynos_drm_postclose(struct drm_device *dev, struct drm_file *file) | ||
180 | { | ||
176 | struct exynos_drm_private *private = dev->dev_private; | 181 | struct exynos_drm_private *private = dev->dev_private; |
177 | struct drm_pending_vblank_event *e, *t; | 182 | struct drm_pending_vblank_event *v, *vt; |
183 | struct drm_pending_event *e, *et; | ||
178 | unsigned long flags; | 184 | unsigned long flags; |
179 | 185 | ||
180 | /* release events of current file */ | 186 | if (!file->driver_priv) |
187 | return; | ||
188 | |||
189 | /* Release all events not unhandled by page flip handler. */ | ||
181 | spin_lock_irqsave(&dev->event_lock, flags); | 190 | spin_lock_irqsave(&dev->event_lock, flags); |
182 | list_for_each_entry_safe(e, t, &private->pageflip_event_list, | 191 | list_for_each_entry_safe(v, vt, &private->pageflip_event_list, |
183 | base.link) { | 192 | base.link) { |
184 | if (e->base.file_priv == file) { | 193 | if (v->base.file_priv == file) { |
185 | list_del(&e->base.link); | 194 | list_del(&v->base.link); |
186 | e->base.destroy(&e->base); | 195 | drm_vblank_put(dev, v->pipe); |
196 | v->base.destroy(&v->base); | ||
187 | } | 197 | } |
188 | } | 198 | } |
189 | spin_unlock_irqrestore(&dev->event_lock, flags); | ||
190 | 199 | ||
191 | exynos_drm_subdrv_close(dev, file); | 200 | /* Release all events handled by page flip handler but not freed. */ |
192 | } | 201 | list_for_each_entry_safe(e, et, &file->event_list, link) { |
202 | list_del(&e->link); | ||
203 | e->destroy(e); | ||
204 | } | ||
205 | spin_unlock_irqrestore(&dev->event_lock, flags); | ||
193 | 206 | ||
194 | static void exynos_drm_postclose(struct drm_device *dev, struct drm_file *file) | ||
195 | { | ||
196 | if (!file->driver_priv) | ||
197 | return; | ||
198 | 207 | ||
199 | kfree(file->driver_priv); | 208 | kfree(file->driver_priv); |
200 | file->driver_priv = NULL; | 209 | file->driver_priv = NULL; |
diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c b/drivers/gpu/drm/exynos/exynos_drm_fimd.c index 23da72b5eae9..a61878bf5dcd 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c +++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c | |||
@@ -31,7 +31,7 @@ | |||
31 | #include "exynos_drm_iommu.h" | 31 | #include "exynos_drm_iommu.h" |
32 | 32 | ||
33 | /* | 33 | /* |
34 | * FIMD is stand for Fully Interactive Mobile Display and | 34 | * FIMD stands for Fully Interactive Mobile Display and |
35 | * as a display controller, it transfers contents drawn on memory | 35 | * as a display controller, it transfers contents drawn on memory |
36 | * to a LCD Panel through Display Interfaces such as RGB or | 36 | * to a LCD Panel through Display Interfaces such as RGB or |
37 | * CPU Interface. | 37 | * CPU Interface. |
diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c index 989be12cdd6e..2e367a1c6a64 100644 --- a/drivers/gpu/drm/i915/i915_drv.c +++ b/drivers/gpu/drm/i915/i915_drv.c | |||
@@ -534,8 +534,10 @@ static int i915_drm_freeze(struct drm_device *dev) | |||
534 | * Disable CRTCs directly since we want to preserve sw state | 534 | * Disable CRTCs directly since we want to preserve sw state |
535 | * for _thaw. | 535 | * for _thaw. |
536 | */ | 536 | */ |
537 | mutex_lock(&dev->mode_config.mutex); | ||
537 | list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) | 538 | list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) |
538 | dev_priv->display.crtc_disable(crtc); | 539 | dev_priv->display.crtc_disable(crtc); |
540 | mutex_unlock(&dev->mode_config.mutex); | ||
539 | 541 | ||
540 | intel_modeset_suspend_hw(dev); | 542 | intel_modeset_suspend_hw(dev); |
541 | } | 543 | } |
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c index 12bbd5eac70d..621c7c67a643 100644 --- a/drivers/gpu/drm/i915/i915_gem.c +++ b/drivers/gpu/drm/i915/i915_gem.c | |||
@@ -4442,10 +4442,9 @@ i915_gem_init_hw(struct drm_device *dev) | |||
4442 | if (dev_priv->ellc_size) | 4442 | if (dev_priv->ellc_size) |
4443 | I915_WRITE(HSW_IDICR, I915_READ(HSW_IDICR) | IDIHASHMSK(0xf)); | 4443 | I915_WRITE(HSW_IDICR, I915_READ(HSW_IDICR) | IDIHASHMSK(0xf)); |
4444 | 4444 | ||
4445 | if (IS_HSW_GT3(dev)) | 4445 | if (IS_HASWELL(dev)) |
4446 | I915_WRITE(MI_PREDICATE_RESULT_2, LOWER_SLICE_ENABLED); | 4446 | I915_WRITE(MI_PREDICATE_RESULT_2, IS_HSW_GT3(dev) ? |
4447 | else | 4447 | LOWER_SLICE_ENABLED : LOWER_SLICE_DISABLED); |
4448 | I915_WRITE(MI_PREDICATE_RESULT_2, LOWER_SLICE_DISABLED); | ||
4449 | 4448 | ||
4450 | if (HAS_PCH_NOP(dev)) { | 4449 | if (HAS_PCH_NOP(dev)) { |
4451 | u32 temp = I915_READ(GEN7_MSG_CTL); | 4450 | u32 temp = I915_READ(GEN7_MSG_CTL); |
diff --git a/drivers/gpu/drm/i915/i915_gem_dmabuf.c b/drivers/gpu/drm/i915/i915_gem_dmabuf.c index 7d5752fda5f1..9bb533e0d762 100644 --- a/drivers/gpu/drm/i915/i915_gem_dmabuf.c +++ b/drivers/gpu/drm/i915/i915_gem_dmabuf.c | |||
@@ -125,13 +125,15 @@ static void *i915_gem_dmabuf_vmap(struct dma_buf *dma_buf) | |||
125 | 125 | ||
126 | ret = i915_gem_object_get_pages(obj); | 126 | ret = i915_gem_object_get_pages(obj); |
127 | if (ret) | 127 | if (ret) |
128 | goto error; | 128 | goto err; |
129 | |||
130 | i915_gem_object_pin_pages(obj); | ||
129 | 131 | ||
130 | ret = -ENOMEM; | 132 | ret = -ENOMEM; |
131 | 133 | ||
132 | pages = drm_malloc_ab(obj->base.size >> PAGE_SHIFT, sizeof(*pages)); | 134 | pages = drm_malloc_ab(obj->base.size >> PAGE_SHIFT, sizeof(*pages)); |
133 | if (pages == NULL) | 135 | if (pages == NULL) |
134 | goto error; | 136 | goto err_unpin; |
135 | 137 | ||
136 | i = 0; | 138 | i = 0; |
137 | for_each_sg_page(obj->pages->sgl, &sg_iter, obj->pages->nents, 0) | 139 | for_each_sg_page(obj->pages->sgl, &sg_iter, obj->pages->nents, 0) |
@@ -141,15 +143,16 @@ static void *i915_gem_dmabuf_vmap(struct dma_buf *dma_buf) | |||
141 | drm_free_large(pages); | 143 | drm_free_large(pages); |
142 | 144 | ||
143 | if (!obj->dma_buf_vmapping) | 145 | if (!obj->dma_buf_vmapping) |
144 | goto error; | 146 | goto err_unpin; |
145 | 147 | ||
146 | obj->vmapping_count = 1; | 148 | obj->vmapping_count = 1; |
147 | i915_gem_object_pin_pages(obj); | ||
148 | out_unlock: | 149 | out_unlock: |
149 | mutex_unlock(&dev->struct_mutex); | 150 | mutex_unlock(&dev->struct_mutex); |
150 | return obj->dma_buf_vmapping; | 151 | return obj->dma_buf_vmapping; |
151 | 152 | ||
152 | error: | 153 | err_unpin: |
154 | i915_gem_object_unpin_pages(obj); | ||
155 | err: | ||
153 | mutex_unlock(&dev->struct_mutex); | 156 | mutex_unlock(&dev->struct_mutex); |
154 | return ERR_PTR(ret); | 157 | return ERR_PTR(ret); |
155 | } | 158 | } |
diff --git a/drivers/gpu/drm/i915/i915_gem_execbuffer.c b/drivers/gpu/drm/i915/i915_gem_execbuffer.c index 885d595e0e02..b7e787fb4649 100644 --- a/drivers/gpu/drm/i915/i915_gem_execbuffer.c +++ b/drivers/gpu/drm/i915/i915_gem_execbuffer.c | |||
@@ -33,6 +33,9 @@ | |||
33 | #include "intel_drv.h" | 33 | #include "intel_drv.h" |
34 | #include <linux/dma_remapping.h> | 34 | #include <linux/dma_remapping.h> |
35 | 35 | ||
36 | #define __EXEC_OBJECT_HAS_PIN (1<<31) | ||
37 | #define __EXEC_OBJECT_HAS_FENCE (1<<30) | ||
38 | |||
36 | struct eb_vmas { | 39 | struct eb_vmas { |
37 | struct list_head vmas; | 40 | struct list_head vmas; |
38 | int and; | 41 | int and; |
@@ -187,7 +190,28 @@ static struct i915_vma *eb_get_vma(struct eb_vmas *eb, unsigned long handle) | |||
187 | } | 190 | } |
188 | } | 191 | } |
189 | 192 | ||
190 | static void eb_destroy(struct eb_vmas *eb) { | 193 | static void |
194 | i915_gem_execbuffer_unreserve_vma(struct i915_vma *vma) | ||
195 | { | ||
196 | struct drm_i915_gem_exec_object2 *entry; | ||
197 | struct drm_i915_gem_object *obj = vma->obj; | ||
198 | |||
199 | if (!drm_mm_node_allocated(&vma->node)) | ||
200 | return; | ||
201 | |||
202 | entry = vma->exec_entry; | ||
203 | |||
204 | if (entry->flags & __EXEC_OBJECT_HAS_FENCE) | ||
205 | i915_gem_object_unpin_fence(obj); | ||
206 | |||
207 | if (entry->flags & __EXEC_OBJECT_HAS_PIN) | ||
208 | i915_gem_object_unpin(obj); | ||
209 | |||
210 | entry->flags &= ~(__EXEC_OBJECT_HAS_FENCE | __EXEC_OBJECT_HAS_PIN); | ||
211 | } | ||
212 | |||
213 | static void eb_destroy(struct eb_vmas *eb) | ||
214 | { | ||
191 | while (!list_empty(&eb->vmas)) { | 215 | while (!list_empty(&eb->vmas)) { |
192 | struct i915_vma *vma; | 216 | struct i915_vma *vma; |
193 | 217 | ||
@@ -195,6 +219,7 @@ static void eb_destroy(struct eb_vmas *eb) { | |||
195 | struct i915_vma, | 219 | struct i915_vma, |
196 | exec_list); | 220 | exec_list); |
197 | list_del_init(&vma->exec_list); | 221 | list_del_init(&vma->exec_list); |
222 | i915_gem_execbuffer_unreserve_vma(vma); | ||
198 | drm_gem_object_unreference(&vma->obj->base); | 223 | drm_gem_object_unreference(&vma->obj->base); |
199 | } | 224 | } |
200 | kfree(eb); | 225 | kfree(eb); |
@@ -478,9 +503,6 @@ i915_gem_execbuffer_relocate(struct eb_vmas *eb, | |||
478 | return ret; | 503 | return ret; |
479 | } | 504 | } |
480 | 505 | ||
481 | #define __EXEC_OBJECT_HAS_PIN (1<<31) | ||
482 | #define __EXEC_OBJECT_HAS_FENCE (1<<30) | ||
483 | |||
484 | static int | 506 | static int |
485 | need_reloc_mappable(struct i915_vma *vma) | 507 | need_reloc_mappable(struct i915_vma *vma) |
486 | { | 508 | { |
@@ -552,26 +574,6 @@ i915_gem_execbuffer_reserve_vma(struct i915_vma *vma, | |||
552 | return 0; | 574 | return 0; |
553 | } | 575 | } |
554 | 576 | ||
555 | static void | ||
556 | i915_gem_execbuffer_unreserve_vma(struct i915_vma *vma) | ||
557 | { | ||
558 | struct drm_i915_gem_exec_object2 *entry; | ||
559 | struct drm_i915_gem_object *obj = vma->obj; | ||
560 | |||
561 | if (!drm_mm_node_allocated(&vma->node)) | ||
562 | return; | ||
563 | |||
564 | entry = vma->exec_entry; | ||
565 | |||
566 | if (entry->flags & __EXEC_OBJECT_HAS_FENCE) | ||
567 | i915_gem_object_unpin_fence(obj); | ||
568 | |||
569 | if (entry->flags & __EXEC_OBJECT_HAS_PIN) | ||
570 | i915_gem_object_unpin(obj); | ||
571 | |||
572 | entry->flags &= ~(__EXEC_OBJECT_HAS_FENCE | __EXEC_OBJECT_HAS_PIN); | ||
573 | } | ||
574 | |||
575 | static int | 577 | static int |
576 | i915_gem_execbuffer_reserve(struct intel_ring_buffer *ring, | 578 | i915_gem_execbuffer_reserve(struct intel_ring_buffer *ring, |
577 | struct list_head *vmas, | 579 | struct list_head *vmas, |
@@ -670,13 +672,14 @@ i915_gem_execbuffer_reserve(struct intel_ring_buffer *ring, | |||
670 | goto err; | 672 | goto err; |
671 | } | 673 | } |
672 | 674 | ||
673 | err: /* Decrement pin count for bound objects */ | 675 | err: |
674 | list_for_each_entry(vma, vmas, exec_list) | ||
675 | i915_gem_execbuffer_unreserve_vma(vma); | ||
676 | |||
677 | if (ret != -ENOSPC || retry++) | 676 | if (ret != -ENOSPC || retry++) |
678 | return ret; | 677 | return ret; |
679 | 678 | ||
679 | /* Decrement pin count for bound objects */ | ||
680 | list_for_each_entry(vma, vmas, exec_list) | ||
681 | i915_gem_execbuffer_unreserve_vma(vma); | ||
682 | |||
680 | ret = i915_gem_evict_vm(vm, true); | 683 | ret = i915_gem_evict_vm(vm, true); |
681 | if (ret) | 684 | if (ret) |
682 | return ret; | 685 | return ret; |
@@ -708,6 +711,7 @@ i915_gem_execbuffer_relocate_slow(struct drm_device *dev, | |||
708 | while (!list_empty(&eb->vmas)) { | 711 | while (!list_empty(&eb->vmas)) { |
709 | vma = list_first_entry(&eb->vmas, struct i915_vma, exec_list); | 712 | vma = list_first_entry(&eb->vmas, struct i915_vma, exec_list); |
710 | list_del_init(&vma->exec_list); | 713 | list_del_init(&vma->exec_list); |
714 | i915_gem_execbuffer_unreserve_vma(vma); | ||
711 | drm_gem_object_unreference(&vma->obj->base); | 715 | drm_gem_object_unreference(&vma->obj->base); |
712 | } | 716 | } |
713 | 717 | ||
diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c b/drivers/gpu/drm/i915/i915_gem_gtt.c index 3620a1b0a73c..38cb8d44a013 100644 --- a/drivers/gpu/drm/i915/i915_gem_gtt.c +++ b/drivers/gpu/drm/i915/i915_gem_gtt.c | |||
@@ -57,7 +57,9 @@ typedef gen8_gtt_pte_t gen8_ppgtt_pde_t; | |||
57 | #define HSW_WB_LLC_AGE3 HSW_CACHEABILITY_CONTROL(0x2) | 57 | #define HSW_WB_LLC_AGE3 HSW_CACHEABILITY_CONTROL(0x2) |
58 | #define HSW_WB_LLC_AGE0 HSW_CACHEABILITY_CONTROL(0x3) | 58 | #define HSW_WB_LLC_AGE0 HSW_CACHEABILITY_CONTROL(0x3) |
59 | #define HSW_WB_ELLC_LLC_AGE0 HSW_CACHEABILITY_CONTROL(0xb) | 59 | #define HSW_WB_ELLC_LLC_AGE0 HSW_CACHEABILITY_CONTROL(0xb) |
60 | #define HSW_WB_ELLC_LLC_AGE3 HSW_CACHEABILITY_CONTROL(0x8) | ||
60 | #define HSW_WT_ELLC_LLC_AGE0 HSW_CACHEABILITY_CONTROL(0x6) | 61 | #define HSW_WT_ELLC_LLC_AGE0 HSW_CACHEABILITY_CONTROL(0x6) |
62 | #define HSW_WT_ELLC_LLC_AGE3 HSW_CACHEABILITY_CONTROL(0x7) | ||
61 | 63 | ||
62 | #define GEN8_PTES_PER_PAGE (PAGE_SIZE / sizeof(gen8_gtt_pte_t)) | 64 | #define GEN8_PTES_PER_PAGE (PAGE_SIZE / sizeof(gen8_gtt_pte_t)) |
63 | #define GEN8_PDES_PER_PAGE (PAGE_SIZE / sizeof(gen8_ppgtt_pde_t)) | 65 | #define GEN8_PDES_PER_PAGE (PAGE_SIZE / sizeof(gen8_ppgtt_pde_t)) |
@@ -185,10 +187,10 @@ static gen6_gtt_pte_t iris_pte_encode(dma_addr_t addr, | |||
185 | case I915_CACHE_NONE: | 187 | case I915_CACHE_NONE: |
186 | break; | 188 | break; |
187 | case I915_CACHE_WT: | 189 | case I915_CACHE_WT: |
188 | pte |= HSW_WT_ELLC_LLC_AGE0; | 190 | pte |= HSW_WT_ELLC_LLC_AGE3; |
189 | break; | 191 | break; |
190 | default: | 192 | default: |
191 | pte |= HSW_WB_ELLC_LLC_AGE0; | 193 | pte |= HSW_WB_ELLC_LLC_AGE3; |
192 | break; | 194 | break; |
193 | } | 195 | } |
194 | 196 | ||
diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h index f9eafb6ed523..ee2742122a02 100644 --- a/drivers/gpu/drm/i915/i915_reg.h +++ b/drivers/gpu/drm/i915/i915_reg.h | |||
@@ -235,6 +235,7 @@ | |||
235 | */ | 235 | */ |
236 | #define MI_LOAD_REGISTER_IMM(x) MI_INSTR(0x22, 2*x-1) | 236 | #define MI_LOAD_REGISTER_IMM(x) MI_INSTR(0x22, 2*x-1) |
237 | #define MI_STORE_REGISTER_MEM(x) MI_INSTR(0x24, 2*x-1) | 237 | #define MI_STORE_REGISTER_MEM(x) MI_INSTR(0x24, 2*x-1) |
238 | #define MI_SRM_LRM_GLOBAL_GTT (1<<22) | ||
238 | #define MI_FLUSH_DW MI_INSTR(0x26, 1) /* for GEN6 */ | 239 | #define MI_FLUSH_DW MI_INSTR(0x26, 1) /* for GEN6 */ |
239 | #define MI_FLUSH_DW_STORE_INDEX (1<<21) | 240 | #define MI_FLUSH_DW_STORE_INDEX (1<<21) |
240 | #define MI_INVALIDATE_TLB (1<<18) | 241 | #define MI_INVALIDATE_TLB (1<<18) |
diff --git a/drivers/gpu/drm/i915/intel_ddi.c b/drivers/gpu/drm/i915/intel_ddi.c index 330077bcd0bd..526c8ded16b0 100644 --- a/drivers/gpu/drm/i915/intel_ddi.c +++ b/drivers/gpu/drm/i915/intel_ddi.c | |||
@@ -173,7 +173,7 @@ static void intel_prepare_ddi_buffers(struct drm_device *dev, enum port port) | |||
173 | ddi_translations = ddi_translations_dp; | 173 | ddi_translations = ddi_translations_dp; |
174 | break; | 174 | break; |
175 | case PORT_D: | 175 | case PORT_D: |
176 | if (intel_dpd_is_edp(dev)) | 176 | if (intel_dp_is_edp(dev, PORT_D)) |
177 | ddi_translations = ddi_translations_edp; | 177 | ddi_translations = ddi_translations_edp; |
178 | else | 178 | else |
179 | ddi_translations = ddi_translations_dp; | 179 | ddi_translations = ddi_translations_dp; |
@@ -1158,9 +1158,10 @@ static void intel_ddi_post_disable(struct intel_encoder *intel_encoder) | |||
1158 | if (wait) | 1158 | if (wait) |
1159 | intel_wait_ddi_buf_idle(dev_priv, port); | 1159 | intel_wait_ddi_buf_idle(dev_priv, port); |
1160 | 1160 | ||
1161 | if (type == INTEL_OUTPUT_EDP) { | 1161 | if (type == INTEL_OUTPUT_DISPLAYPORT || type == INTEL_OUTPUT_EDP) { |
1162 | struct intel_dp *intel_dp = enc_to_intel_dp(encoder); | 1162 | struct intel_dp *intel_dp = enc_to_intel_dp(encoder); |
1163 | ironlake_edp_panel_vdd_on(intel_dp); | 1163 | ironlake_edp_panel_vdd_on(intel_dp); |
1164 | intel_dp_sink_dpms(intel_dp, DRM_MODE_DPMS_OFF); | ||
1164 | ironlake_edp_panel_off(intel_dp); | 1165 | ironlake_edp_panel_off(intel_dp); |
1165 | } | 1166 | } |
1166 | 1167 | ||
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index 7ec8b488bb1d..080f6fd4e839 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c | |||
@@ -5815,7 +5815,7 @@ static void intel_set_pipe_csc(struct drm_crtc *crtc) | |||
5815 | uint16_t postoff = 0; | 5815 | uint16_t postoff = 0; |
5816 | 5816 | ||
5817 | if (intel_crtc->config.limited_color_range) | 5817 | if (intel_crtc->config.limited_color_range) |
5818 | postoff = (16 * (1 << 13) / 255) & 0x1fff; | 5818 | postoff = (16 * (1 << 12) / 255) & 0x1fff; |
5819 | 5819 | ||
5820 | I915_WRITE(PIPE_CSC_POSTOFF_HI(pipe), postoff); | 5820 | I915_WRITE(PIPE_CSC_POSTOFF_HI(pipe), postoff); |
5821 | I915_WRITE(PIPE_CSC_POSTOFF_ME(pipe), postoff); | 5821 | I915_WRITE(PIPE_CSC_POSTOFF_ME(pipe), postoff); |
@@ -6402,7 +6402,7 @@ static void hsw_restore_lcpll(struct drm_i915_private *dev_priv) | |||
6402 | 6402 | ||
6403 | /* Make sure we're not on PC8 state before disabling PC8, otherwise | 6403 | /* Make sure we're not on PC8 state before disabling PC8, otherwise |
6404 | * we'll hang the machine! */ | 6404 | * we'll hang the machine! */ |
6405 | dev_priv->uncore.funcs.force_wake_get(dev_priv); | 6405 | gen6_gt_force_wake_get(dev_priv); |
6406 | 6406 | ||
6407 | if (val & LCPLL_POWER_DOWN_ALLOW) { | 6407 | if (val & LCPLL_POWER_DOWN_ALLOW) { |
6408 | val &= ~LCPLL_POWER_DOWN_ALLOW; | 6408 | val &= ~LCPLL_POWER_DOWN_ALLOW; |
@@ -6436,7 +6436,7 @@ static void hsw_restore_lcpll(struct drm_i915_private *dev_priv) | |||
6436 | DRM_ERROR("Switching back to LCPLL failed\n"); | 6436 | DRM_ERROR("Switching back to LCPLL failed\n"); |
6437 | } | 6437 | } |
6438 | 6438 | ||
6439 | dev_priv->uncore.funcs.force_wake_put(dev_priv); | 6439 | gen6_gt_force_wake_put(dev_priv); |
6440 | } | 6440 | } |
6441 | 6441 | ||
6442 | void hsw_enable_pc8_work(struct work_struct *__work) | 6442 | void hsw_enable_pc8_work(struct work_struct *__work) |
@@ -8354,7 +8354,8 @@ static int intel_gen7_queue_flip(struct drm_device *dev, | |||
8354 | intel_ring_emit(ring, ~(DERRMR_PIPEA_PRI_FLIP_DONE | | 8354 | intel_ring_emit(ring, ~(DERRMR_PIPEA_PRI_FLIP_DONE | |
8355 | DERRMR_PIPEB_PRI_FLIP_DONE | | 8355 | DERRMR_PIPEB_PRI_FLIP_DONE | |
8356 | DERRMR_PIPEC_PRI_FLIP_DONE)); | 8356 | DERRMR_PIPEC_PRI_FLIP_DONE)); |
8357 | intel_ring_emit(ring, MI_STORE_REGISTER_MEM(1)); | 8357 | intel_ring_emit(ring, MI_STORE_REGISTER_MEM(1) | |
8358 | MI_SRM_LRM_GLOBAL_GTT); | ||
8358 | intel_ring_emit(ring, DERRMR); | 8359 | intel_ring_emit(ring, DERRMR); |
8359 | intel_ring_emit(ring, ring->scratch.gtt_offset + 256); | 8360 | intel_ring_emit(ring, ring->scratch.gtt_offset + 256); |
8360 | } | 8361 | } |
@@ -10049,7 +10050,7 @@ static void intel_setup_outputs(struct drm_device *dev) | |||
10049 | intel_ddi_init(dev, PORT_D); | 10050 | intel_ddi_init(dev, PORT_D); |
10050 | } else if (HAS_PCH_SPLIT(dev)) { | 10051 | } else if (HAS_PCH_SPLIT(dev)) { |
10051 | int found; | 10052 | int found; |
10052 | dpd_is_edp = intel_dpd_is_edp(dev); | 10053 | dpd_is_edp = intel_dp_is_edp(dev, PORT_D); |
10053 | 10054 | ||
10054 | if (has_edp_a(dev)) | 10055 | if (has_edp_a(dev)) |
10055 | intel_dp_init(dev, DP_A, PORT_A); | 10056 | intel_dp_init(dev, DP_A, PORT_A); |
@@ -10086,8 +10087,7 @@ static void intel_setup_outputs(struct drm_device *dev) | |||
10086 | intel_hdmi_init(dev, VLV_DISPLAY_BASE + GEN4_HDMIC, | 10087 | intel_hdmi_init(dev, VLV_DISPLAY_BASE + GEN4_HDMIC, |
10087 | PORT_C); | 10088 | PORT_C); |
10088 | if (I915_READ(VLV_DISPLAY_BASE + DP_C) & DP_DETECTED) | 10089 | if (I915_READ(VLV_DISPLAY_BASE + DP_C) & DP_DETECTED) |
10089 | intel_dp_init(dev, VLV_DISPLAY_BASE + DP_C, | 10090 | intel_dp_init(dev, VLV_DISPLAY_BASE + DP_C, PORT_C); |
10090 | PORT_C); | ||
10091 | } | 10091 | } |
10092 | 10092 | ||
10093 | intel_dsi_init(dev); | 10093 | intel_dsi_init(dev); |
diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c index 0b2e842fef01..30c627c7b7ba 100644 --- a/drivers/gpu/drm/i915/intel_dp.c +++ b/drivers/gpu/drm/i915/intel_dp.c | |||
@@ -3326,11 +3326,19 @@ intel_trans_dp_port_sel(struct drm_crtc *crtc) | |||
3326 | } | 3326 | } |
3327 | 3327 | ||
3328 | /* check the VBT to see whether the eDP is on DP-D port */ | 3328 | /* check the VBT to see whether the eDP is on DP-D port */ |
3329 | bool intel_dpd_is_edp(struct drm_device *dev) | 3329 | bool intel_dp_is_edp(struct drm_device *dev, enum port port) |
3330 | { | 3330 | { |
3331 | struct drm_i915_private *dev_priv = dev->dev_private; | 3331 | struct drm_i915_private *dev_priv = dev->dev_private; |
3332 | union child_device_config *p_child; | 3332 | union child_device_config *p_child; |
3333 | int i; | 3333 | int i; |
3334 | static const short port_mapping[] = { | ||
3335 | [PORT_B] = PORT_IDPB, | ||
3336 | [PORT_C] = PORT_IDPC, | ||
3337 | [PORT_D] = PORT_IDPD, | ||
3338 | }; | ||
3339 | |||
3340 | if (port == PORT_A) | ||
3341 | return true; | ||
3334 | 3342 | ||
3335 | if (!dev_priv->vbt.child_dev_num) | 3343 | if (!dev_priv->vbt.child_dev_num) |
3336 | return false; | 3344 | return false; |
@@ -3338,7 +3346,7 @@ bool intel_dpd_is_edp(struct drm_device *dev) | |||
3338 | for (i = 0; i < dev_priv->vbt.child_dev_num; i++) { | 3346 | for (i = 0; i < dev_priv->vbt.child_dev_num; i++) { |
3339 | p_child = dev_priv->vbt.child_dev + i; | 3347 | p_child = dev_priv->vbt.child_dev + i; |
3340 | 3348 | ||
3341 | if (p_child->common.dvo_port == PORT_IDPD && | 3349 | if (p_child->common.dvo_port == port_mapping[port] && |
3342 | (p_child->common.device_type & DEVICE_TYPE_eDP_BITS) == | 3350 | (p_child->common.device_type & DEVICE_TYPE_eDP_BITS) == |
3343 | (DEVICE_TYPE_eDP & DEVICE_TYPE_eDP_BITS)) | 3351 | (DEVICE_TYPE_eDP & DEVICE_TYPE_eDP_BITS)) |
3344 | return true; | 3352 | return true; |
@@ -3616,26 +3624,10 @@ intel_dp_init_connector(struct intel_digital_port *intel_dig_port, | |||
3616 | intel_dp->DP = I915_READ(intel_dp->output_reg); | 3624 | intel_dp->DP = I915_READ(intel_dp->output_reg); |
3617 | intel_dp->attached_connector = intel_connector; | 3625 | intel_dp->attached_connector = intel_connector; |
3618 | 3626 | ||
3619 | type = DRM_MODE_CONNECTOR_DisplayPort; | 3627 | if (intel_dp_is_edp(dev, port)) |
3620 | /* | ||
3621 | * FIXME : We need to initialize built-in panels before external panels. | ||
3622 | * For X0, DP_C is fixed as eDP. Revisit this as part of VLV eDP cleanup | ||
3623 | */ | ||
3624 | switch (port) { | ||
3625 | case PORT_A: | ||
3626 | type = DRM_MODE_CONNECTOR_eDP; | 3628 | type = DRM_MODE_CONNECTOR_eDP; |
3627 | break; | 3629 | else |
3628 | case PORT_C: | 3630 | type = DRM_MODE_CONNECTOR_DisplayPort; |
3629 | if (IS_VALLEYVIEW(dev)) | ||
3630 | type = DRM_MODE_CONNECTOR_eDP; | ||
3631 | break; | ||
3632 | case PORT_D: | ||
3633 | if (HAS_PCH_SPLIT(dev) && intel_dpd_is_edp(dev)) | ||
3634 | type = DRM_MODE_CONNECTOR_eDP; | ||
3635 | break; | ||
3636 | default: /* silence GCC warning */ | ||
3637 | break; | ||
3638 | } | ||
3639 | 3631 | ||
3640 | /* | 3632 | /* |
3641 | * For eDP we always set the encoder type to INTEL_OUTPUT_EDP, but | 3633 | * For eDP we always set the encoder type to INTEL_OUTPUT_EDP, but |
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h index 1e49aa8f5377..a18e88b3e425 100644 --- a/drivers/gpu/drm/i915/intel_drv.h +++ b/drivers/gpu/drm/i915/intel_drv.h | |||
@@ -708,7 +708,7 @@ void intel_dp_encoder_destroy(struct drm_encoder *encoder); | |||
708 | void intel_dp_check_link_status(struct intel_dp *intel_dp); | 708 | void intel_dp_check_link_status(struct intel_dp *intel_dp); |
709 | bool intel_dp_compute_config(struct intel_encoder *encoder, | 709 | bool intel_dp_compute_config(struct intel_encoder *encoder, |
710 | struct intel_crtc_config *pipe_config); | 710 | struct intel_crtc_config *pipe_config); |
711 | bool intel_dpd_is_edp(struct drm_device *dev); | 711 | bool intel_dp_is_edp(struct drm_device *dev, enum port port); |
712 | void ironlake_edp_backlight_on(struct intel_dp *intel_dp); | 712 | void ironlake_edp_backlight_on(struct intel_dp *intel_dp); |
713 | void ironlake_edp_backlight_off(struct intel_dp *intel_dp); | 713 | void ironlake_edp_backlight_off(struct intel_dp *intel_dp); |
714 | void ironlake_edp_panel_on(struct intel_dp *intel_dp); | 714 | void ironlake_edp_panel_on(struct intel_dp *intel_dp); |
diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c index caf2ee4e5441..6e0d5e075b15 100644 --- a/drivers/gpu/drm/i915/intel_pm.c +++ b/drivers/gpu/drm/i915/intel_pm.c | |||
@@ -1180,7 +1180,7 @@ static bool g4x_compute_wm0(struct drm_device *dev, | |||
1180 | 1180 | ||
1181 | adjusted_mode = &to_intel_crtc(crtc)->config.adjusted_mode; | 1181 | adjusted_mode = &to_intel_crtc(crtc)->config.adjusted_mode; |
1182 | clock = adjusted_mode->crtc_clock; | 1182 | clock = adjusted_mode->crtc_clock; |
1183 | htotal = adjusted_mode->htotal; | 1183 | htotal = adjusted_mode->crtc_htotal; |
1184 | hdisplay = to_intel_crtc(crtc)->config.pipe_src_w; | 1184 | hdisplay = to_intel_crtc(crtc)->config.pipe_src_w; |
1185 | pixel_size = crtc->fb->bits_per_pixel / 8; | 1185 | pixel_size = crtc->fb->bits_per_pixel / 8; |
1186 | 1186 | ||
@@ -1267,7 +1267,7 @@ static bool g4x_compute_srwm(struct drm_device *dev, | |||
1267 | crtc = intel_get_crtc_for_plane(dev, plane); | 1267 | crtc = intel_get_crtc_for_plane(dev, plane); |
1268 | adjusted_mode = &to_intel_crtc(crtc)->config.adjusted_mode; | 1268 | adjusted_mode = &to_intel_crtc(crtc)->config.adjusted_mode; |
1269 | clock = adjusted_mode->crtc_clock; | 1269 | clock = adjusted_mode->crtc_clock; |
1270 | htotal = adjusted_mode->htotal; | 1270 | htotal = adjusted_mode->crtc_htotal; |
1271 | hdisplay = to_intel_crtc(crtc)->config.pipe_src_w; | 1271 | hdisplay = to_intel_crtc(crtc)->config.pipe_src_w; |
1272 | pixel_size = crtc->fb->bits_per_pixel / 8; | 1272 | pixel_size = crtc->fb->bits_per_pixel / 8; |
1273 | 1273 | ||
@@ -1498,7 +1498,7 @@ static void i965_update_wm(struct drm_crtc *unused_crtc) | |||
1498 | const struct drm_display_mode *adjusted_mode = | 1498 | const struct drm_display_mode *adjusted_mode = |
1499 | &to_intel_crtc(crtc)->config.adjusted_mode; | 1499 | &to_intel_crtc(crtc)->config.adjusted_mode; |
1500 | int clock = adjusted_mode->crtc_clock; | 1500 | int clock = adjusted_mode->crtc_clock; |
1501 | int htotal = adjusted_mode->htotal; | 1501 | int htotal = adjusted_mode->crtc_htotal; |
1502 | int hdisplay = to_intel_crtc(crtc)->config.pipe_src_w; | 1502 | int hdisplay = to_intel_crtc(crtc)->config.pipe_src_w; |
1503 | int pixel_size = crtc->fb->bits_per_pixel / 8; | 1503 | int pixel_size = crtc->fb->bits_per_pixel / 8; |
1504 | unsigned long line_time_us; | 1504 | unsigned long line_time_us; |
@@ -1624,7 +1624,7 @@ static void i9xx_update_wm(struct drm_crtc *unused_crtc) | |||
1624 | const struct drm_display_mode *adjusted_mode = | 1624 | const struct drm_display_mode *adjusted_mode = |
1625 | &to_intel_crtc(enabled)->config.adjusted_mode; | 1625 | &to_intel_crtc(enabled)->config.adjusted_mode; |
1626 | int clock = adjusted_mode->crtc_clock; | 1626 | int clock = adjusted_mode->crtc_clock; |
1627 | int htotal = adjusted_mode->htotal; | 1627 | int htotal = adjusted_mode->crtc_htotal; |
1628 | int hdisplay = to_intel_crtc(enabled)->config.pipe_src_w; | 1628 | int hdisplay = to_intel_crtc(enabled)->config.pipe_src_w; |
1629 | int pixel_size = enabled->fb->bits_per_pixel / 8; | 1629 | int pixel_size = enabled->fb->bits_per_pixel / 8; |
1630 | unsigned long line_time_us; | 1630 | unsigned long line_time_us; |
@@ -1776,7 +1776,7 @@ static bool ironlake_compute_srwm(struct drm_device *dev, int level, int plane, | |||
1776 | crtc = intel_get_crtc_for_plane(dev, plane); | 1776 | crtc = intel_get_crtc_for_plane(dev, plane); |
1777 | adjusted_mode = &to_intel_crtc(crtc)->config.adjusted_mode; | 1777 | adjusted_mode = &to_intel_crtc(crtc)->config.adjusted_mode; |
1778 | clock = adjusted_mode->crtc_clock; | 1778 | clock = adjusted_mode->crtc_clock; |
1779 | htotal = adjusted_mode->htotal; | 1779 | htotal = adjusted_mode->crtc_htotal; |
1780 | hdisplay = to_intel_crtc(crtc)->config.pipe_src_w; | 1780 | hdisplay = to_intel_crtc(crtc)->config.pipe_src_w; |
1781 | pixel_size = crtc->fb->bits_per_pixel / 8; | 1781 | pixel_size = crtc->fb->bits_per_pixel / 8; |
1782 | 1782 | ||
@@ -2469,8 +2469,9 @@ hsw_compute_linetime_wm(struct drm_device *dev, struct drm_crtc *crtc) | |||
2469 | /* The WM are computed with base on how long it takes to fill a single | 2469 | /* The WM are computed with base on how long it takes to fill a single |
2470 | * row at the given clock rate, multiplied by 8. | 2470 | * row at the given clock rate, multiplied by 8. |
2471 | * */ | 2471 | * */ |
2472 | linetime = DIV_ROUND_CLOSEST(mode->htotal * 1000 * 8, mode->clock); | 2472 | linetime = DIV_ROUND_CLOSEST(mode->crtc_htotal * 1000 * 8, |
2473 | ips_linetime = DIV_ROUND_CLOSEST(mode->htotal * 1000 * 8, | 2473 | mode->crtc_clock); |
2474 | ips_linetime = DIV_ROUND_CLOSEST(mode->crtc_htotal * 1000 * 8, | ||
2474 | intel_ddi_get_cdclk_freq(dev_priv)); | 2475 | intel_ddi_get_cdclk_freq(dev_priv)); |
2475 | 2476 | ||
2476 | return PIPE_WM_LINETIME_IPS_LINETIME(ips_linetime) | | 2477 | return PIPE_WM_LINETIME_IPS_LINETIME(ips_linetime) | |
diff --git a/drivers/gpu/drm/nouveau/Makefile b/drivers/gpu/drm/nouveau/Makefile index edcf801613e6..b3fa1ba191b7 100644 --- a/drivers/gpu/drm/nouveau/Makefile +++ b/drivers/gpu/drm/nouveau/Makefile | |||
@@ -59,6 +59,7 @@ nouveau-y += core/subdev/clock/nv40.o | |||
59 | nouveau-y += core/subdev/clock/nv50.o | 59 | nouveau-y += core/subdev/clock/nv50.o |
60 | nouveau-y += core/subdev/clock/nv84.o | 60 | nouveau-y += core/subdev/clock/nv84.o |
61 | nouveau-y += core/subdev/clock/nva3.o | 61 | nouveau-y += core/subdev/clock/nva3.o |
62 | nouveau-y += core/subdev/clock/nvaa.o | ||
62 | nouveau-y += core/subdev/clock/nvc0.o | 63 | nouveau-y += core/subdev/clock/nvc0.o |
63 | nouveau-y += core/subdev/clock/nve0.o | 64 | nouveau-y += core/subdev/clock/nve0.o |
64 | nouveau-y += core/subdev/clock/pllnv04.o | 65 | nouveau-y += core/subdev/clock/pllnv04.o |
diff --git a/drivers/gpu/drm/nouveau/core/engine/device/nv50.c b/drivers/gpu/drm/nouveau/core/engine/device/nv50.c index db139827047c..db3fc7be856a 100644 --- a/drivers/gpu/drm/nouveau/core/engine/device/nv50.c +++ b/drivers/gpu/drm/nouveau/core/engine/device/nv50.c | |||
@@ -283,7 +283,7 @@ nv50_identify(struct nouveau_device *device) | |||
283 | device->oclass[NVDEV_SUBDEV_VBIOS ] = &nouveau_bios_oclass; | 283 | device->oclass[NVDEV_SUBDEV_VBIOS ] = &nouveau_bios_oclass; |
284 | device->oclass[NVDEV_SUBDEV_GPIO ] = &nv50_gpio_oclass; | 284 | device->oclass[NVDEV_SUBDEV_GPIO ] = &nv50_gpio_oclass; |
285 | device->oclass[NVDEV_SUBDEV_I2C ] = &nv94_i2c_oclass; | 285 | device->oclass[NVDEV_SUBDEV_I2C ] = &nv94_i2c_oclass; |
286 | device->oclass[NVDEV_SUBDEV_CLOCK ] = nv84_clock_oclass; | 286 | device->oclass[NVDEV_SUBDEV_CLOCK ] = nvaa_clock_oclass; |
287 | device->oclass[NVDEV_SUBDEV_THERM ] = &nv84_therm_oclass; | 287 | device->oclass[NVDEV_SUBDEV_THERM ] = &nv84_therm_oclass; |
288 | device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass; | 288 | device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass; |
289 | device->oclass[NVDEV_SUBDEV_DEVINIT] = &nv50_devinit_oclass; | 289 | device->oclass[NVDEV_SUBDEV_DEVINIT] = &nv50_devinit_oclass; |
@@ -311,7 +311,7 @@ nv50_identify(struct nouveau_device *device) | |||
311 | device->oclass[NVDEV_SUBDEV_VBIOS ] = &nouveau_bios_oclass; | 311 | device->oclass[NVDEV_SUBDEV_VBIOS ] = &nouveau_bios_oclass; |
312 | device->oclass[NVDEV_SUBDEV_GPIO ] = &nv50_gpio_oclass; | 312 | device->oclass[NVDEV_SUBDEV_GPIO ] = &nv50_gpio_oclass; |
313 | device->oclass[NVDEV_SUBDEV_I2C ] = &nv94_i2c_oclass; | 313 | device->oclass[NVDEV_SUBDEV_I2C ] = &nv94_i2c_oclass; |
314 | device->oclass[NVDEV_SUBDEV_CLOCK ] = nv84_clock_oclass; | 314 | device->oclass[NVDEV_SUBDEV_CLOCK ] = nvaa_clock_oclass; |
315 | device->oclass[NVDEV_SUBDEV_THERM ] = &nv84_therm_oclass; | 315 | device->oclass[NVDEV_SUBDEV_THERM ] = &nv84_therm_oclass; |
316 | device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass; | 316 | device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass; |
317 | device->oclass[NVDEV_SUBDEV_DEVINIT] = &nv50_devinit_oclass; | 317 | device->oclass[NVDEV_SUBDEV_DEVINIT] = &nv50_devinit_oclass; |
diff --git a/drivers/gpu/drm/nouveau/core/engine/fifo/nv50.c b/drivers/gpu/drm/nouveau/core/engine/fifo/nv50.c index 5f555788121c..e6352bd5b4ff 100644 --- a/drivers/gpu/drm/nouveau/core/engine/fifo/nv50.c +++ b/drivers/gpu/drm/nouveau/core/engine/fifo/nv50.c | |||
@@ -33,6 +33,7 @@ | |||
33 | #include <engine/dmaobj.h> | 33 | #include <engine/dmaobj.h> |
34 | #include <engine/fifo.h> | 34 | #include <engine/fifo.h> |
35 | 35 | ||
36 | #include "nv04.h" | ||
36 | #include "nv50.h" | 37 | #include "nv50.h" |
37 | 38 | ||
38 | /******************************************************************************* | 39 | /******************************************************************************* |
@@ -460,6 +461,8 @@ nv50_fifo_ctor(struct nouveau_object *parent, struct nouveau_object *engine, | |||
460 | nv_subdev(priv)->intr = nv04_fifo_intr; | 461 | nv_subdev(priv)->intr = nv04_fifo_intr; |
461 | nv_engine(priv)->cclass = &nv50_fifo_cclass; | 462 | nv_engine(priv)->cclass = &nv50_fifo_cclass; |
462 | nv_engine(priv)->sclass = nv50_fifo_sclass; | 463 | nv_engine(priv)->sclass = nv50_fifo_sclass; |
464 | priv->base.pause = nv04_fifo_pause; | ||
465 | priv->base.start = nv04_fifo_start; | ||
463 | return 0; | 466 | return 0; |
464 | } | 467 | } |
465 | 468 | ||
diff --git a/drivers/gpu/drm/nouveau/core/engine/fifo/nv84.c b/drivers/gpu/drm/nouveau/core/engine/fifo/nv84.c index 0908dc834c84..fe0f41e65d9b 100644 --- a/drivers/gpu/drm/nouveau/core/engine/fifo/nv84.c +++ b/drivers/gpu/drm/nouveau/core/engine/fifo/nv84.c | |||
@@ -35,6 +35,7 @@ | |||
35 | #include <engine/dmaobj.h> | 35 | #include <engine/dmaobj.h> |
36 | #include <engine/fifo.h> | 36 | #include <engine/fifo.h> |
37 | 37 | ||
38 | #include "nv04.h" | ||
38 | #include "nv50.h" | 39 | #include "nv50.h" |
39 | 40 | ||
40 | /******************************************************************************* | 41 | /******************************************************************************* |
@@ -432,6 +433,8 @@ nv84_fifo_ctor(struct nouveau_object *parent, struct nouveau_object *engine, | |||
432 | nv_subdev(priv)->intr = nv04_fifo_intr; | 433 | nv_subdev(priv)->intr = nv04_fifo_intr; |
433 | nv_engine(priv)->cclass = &nv84_fifo_cclass; | 434 | nv_engine(priv)->cclass = &nv84_fifo_cclass; |
434 | nv_engine(priv)->sclass = nv84_fifo_sclass; | 435 | nv_engine(priv)->sclass = nv84_fifo_sclass; |
436 | priv->base.pause = nv04_fifo_pause; | ||
437 | priv->base.start = nv04_fifo_start; | ||
435 | return 0; | 438 | return 0; |
436 | } | 439 | } |
437 | 440 | ||
diff --git a/drivers/gpu/drm/nouveau/core/engine/software/nv50.c b/drivers/gpu/drm/nouveau/core/engine/software/nv50.c index b574dd4bb828..5ce686ee729e 100644 --- a/drivers/gpu/drm/nouveau/core/engine/software/nv50.c +++ b/drivers/gpu/drm/nouveau/core/engine/software/nv50.c | |||
@@ -176,7 +176,7 @@ nv50_software_context_ctor(struct nouveau_object *parent, | |||
176 | if (ret) | 176 | if (ret) |
177 | return ret; | 177 | return ret; |
178 | 178 | ||
179 | chan->vblank.nr_event = pdisp->vblank->index_nr; | 179 | chan->vblank.nr_event = pdisp ? pdisp->vblank->index_nr : 0; |
180 | chan->vblank.event = kzalloc(chan->vblank.nr_event * | 180 | chan->vblank.event = kzalloc(chan->vblank.nr_event * |
181 | sizeof(*chan->vblank.event), GFP_KERNEL); | 181 | sizeof(*chan->vblank.event), GFP_KERNEL); |
182 | if (!chan->vblank.event) | 182 | if (!chan->vblank.event) |
diff --git a/drivers/gpu/drm/nouveau/core/include/subdev/clock.h b/drivers/gpu/drm/nouveau/core/include/subdev/clock.h index e2675bc0edba..8f4ced75444a 100644 --- a/drivers/gpu/drm/nouveau/core/include/subdev/clock.h +++ b/drivers/gpu/drm/nouveau/core/include/subdev/clock.h | |||
@@ -14,6 +14,9 @@ enum nv_clk_src { | |||
14 | nv_clk_src_hclk, | 14 | nv_clk_src_hclk, |
15 | nv_clk_src_hclkm3, | 15 | nv_clk_src_hclkm3, |
16 | nv_clk_src_hclkm3d2, | 16 | nv_clk_src_hclkm3d2, |
17 | nv_clk_src_hclkm2d3, /* NVAA */ | ||
18 | nv_clk_src_hclkm4, /* NVAA */ | ||
19 | nv_clk_src_cclk, /* NVAA */ | ||
17 | 20 | ||
18 | nv_clk_src_host, | 21 | nv_clk_src_host, |
19 | 22 | ||
@@ -127,6 +130,7 @@ extern struct nouveau_oclass nv04_clock_oclass; | |||
127 | extern struct nouveau_oclass nv40_clock_oclass; | 130 | extern struct nouveau_oclass nv40_clock_oclass; |
128 | extern struct nouveau_oclass *nv50_clock_oclass; | 131 | extern struct nouveau_oclass *nv50_clock_oclass; |
129 | extern struct nouveau_oclass *nv84_clock_oclass; | 132 | extern struct nouveau_oclass *nv84_clock_oclass; |
133 | extern struct nouveau_oclass *nvaa_clock_oclass; | ||
130 | extern struct nouveau_oclass nva3_clock_oclass; | 134 | extern struct nouveau_oclass nva3_clock_oclass; |
131 | extern struct nouveau_oclass nvc0_clock_oclass; | 135 | extern struct nouveau_oclass nvc0_clock_oclass; |
132 | extern struct nouveau_oclass nve0_clock_oclass; | 136 | extern struct nouveau_oclass nve0_clock_oclass; |
diff --git a/drivers/gpu/drm/nouveau/core/subdev/clock/nv04.c b/drivers/gpu/drm/nouveau/core/subdev/clock/nv04.c index da50c1b12928..30c1f3a4158e 100644 --- a/drivers/gpu/drm/nouveau/core/subdev/clock/nv04.c +++ b/drivers/gpu/drm/nouveau/core/subdev/clock/nv04.c | |||
@@ -69,6 +69,11 @@ nv04_clock_pll_prog(struct nouveau_clock *clk, u32 reg1, | |||
69 | return 0; | 69 | return 0; |
70 | } | 70 | } |
71 | 71 | ||
72 | static struct nouveau_clocks | ||
73 | nv04_domain[] = { | ||
74 | { nv_clk_src_max } | ||
75 | }; | ||
76 | |||
72 | static int | 77 | static int |
73 | nv04_clock_ctor(struct nouveau_object *parent, struct nouveau_object *engine, | 78 | nv04_clock_ctor(struct nouveau_object *parent, struct nouveau_object *engine, |
74 | struct nouveau_oclass *oclass, void *data, u32 size, | 79 | struct nouveau_oclass *oclass, void *data, u32 size, |
@@ -77,7 +82,7 @@ nv04_clock_ctor(struct nouveau_object *parent, struct nouveau_object *engine, | |||
77 | struct nv04_clock_priv *priv; | 82 | struct nv04_clock_priv *priv; |
78 | int ret; | 83 | int ret; |
79 | 84 | ||
80 | ret = nouveau_clock_create(parent, engine, oclass, NULL, &priv); | 85 | ret = nouveau_clock_create(parent, engine, oclass, nv04_domain, &priv); |
81 | *pobject = nv_object(priv); | 86 | *pobject = nv_object(priv); |
82 | if (ret) | 87 | if (ret) |
83 | return ret; | 88 | return ret; |
diff --git a/drivers/gpu/drm/nouveau/core/subdev/clock/nvaa.c b/drivers/gpu/drm/nouveau/core/subdev/clock/nvaa.c new file mode 100644 index 000000000000..7a723b4f564d --- /dev/null +++ b/drivers/gpu/drm/nouveau/core/subdev/clock/nvaa.c | |||
@@ -0,0 +1,445 @@ | |||
1 | /* | ||
2 | * Copyright 2012 Red Hat Inc. | ||
3 | * | ||
4 | * Permission is hereby granted, free of charge, to any person obtaining a | ||
5 | * copy of this software and associated documentation files (the "Software"), | ||
6 | * to deal in the Software without restriction, including without limitation | ||
7 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||
8 | * and/or sell copies of the Software, and to permit persons to whom the | ||
9 | * Software is furnished to do so, subject to the following conditions: | ||
10 | * | ||
11 | * The above copyright notice and this permission notice shall be included in | ||
12 | * all copies or substantial portions of the Software. | ||
13 | * | ||
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | ||
17 | * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR | ||
18 | * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, | ||
19 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR | ||
20 | * OTHER DEALINGS IN THE SOFTWARE. | ||
21 | * | ||
22 | * Authors: Ben Skeggs | ||
23 | */ | ||
24 | |||
25 | #include <engine/fifo.h> | ||
26 | #include <subdev/bios.h> | ||
27 | #include <subdev/bios/pll.h> | ||
28 | #include <subdev/timer.h> | ||
29 | #include <subdev/clock.h> | ||
30 | |||
31 | #include "pll.h" | ||
32 | |||
33 | struct nvaa_clock_priv { | ||
34 | struct nouveau_clock base; | ||
35 | enum nv_clk_src csrc, ssrc, vsrc; | ||
36 | u32 cctrl, sctrl; | ||
37 | u32 ccoef, scoef; | ||
38 | u32 cpost, spost; | ||
39 | u32 vdiv; | ||
40 | }; | ||
41 | |||
42 | static u32 | ||
43 | read_div(struct nouveau_clock *clk) | ||
44 | { | ||
45 | return nv_rd32(clk, 0x004600); | ||
46 | } | ||
47 | |||
48 | static u32 | ||
49 | read_pll(struct nouveau_clock *clk, u32 base) | ||
50 | { | ||
51 | u32 ctrl = nv_rd32(clk, base + 0); | ||
52 | u32 coef = nv_rd32(clk, base + 4); | ||
53 | u32 ref = clk->read(clk, nv_clk_src_href); | ||
54 | u32 post_div = 0; | ||
55 | u32 clock = 0; | ||
56 | int N1, M1; | ||
57 | |||
58 | switch (base){ | ||
59 | case 0x4020: | ||
60 | post_div = 1 << ((nv_rd32(clk, 0x4070) & 0x000f0000) >> 16); | ||
61 | break; | ||
62 | case 0x4028: | ||
63 | post_div = (nv_rd32(clk, 0x4040) & 0x000f0000) >> 16; | ||
64 | break; | ||
65 | default: | ||
66 | break; | ||
67 | } | ||
68 | |||
69 | N1 = (coef & 0x0000ff00) >> 8; | ||
70 | M1 = (coef & 0x000000ff); | ||
71 | if ((ctrl & 0x80000000) && M1) { | ||
72 | clock = ref * N1 / M1; | ||
73 | clock = clock / post_div; | ||
74 | } | ||
75 | |||
76 | return clock; | ||
77 | } | ||
78 | |||
79 | static int | ||
80 | nvaa_clock_read(struct nouveau_clock *clk, enum nv_clk_src src) | ||
81 | { | ||
82 | struct nvaa_clock_priv *priv = (void *)clk; | ||
83 | u32 mast = nv_rd32(clk, 0x00c054); | ||
84 | u32 P = 0; | ||
85 | |||
86 | switch (src) { | ||
87 | case nv_clk_src_crystal: | ||
88 | return nv_device(priv)->crystal; | ||
89 | case nv_clk_src_href: | ||
90 | return 100000; /* PCIE reference clock */ | ||
91 | case nv_clk_src_hclkm4: | ||
92 | return clk->read(clk, nv_clk_src_href) * 4; | ||
93 | case nv_clk_src_hclkm2d3: | ||
94 | return clk->read(clk, nv_clk_src_href) * 2 / 3; | ||
95 | case nv_clk_src_host: | ||
96 | switch (mast & 0x000c0000) { | ||
97 | case 0x00000000: return clk->read(clk, nv_clk_src_hclkm2d3); | ||
98 | case 0x00040000: break; | ||
99 | case 0x00080000: return clk->read(clk, nv_clk_src_hclkm4); | ||
100 | case 0x000c0000: return clk->read(clk, nv_clk_src_cclk); | ||
101 | } | ||
102 | break; | ||
103 | case nv_clk_src_core: | ||
104 | P = (nv_rd32(clk, 0x004028) & 0x00070000) >> 16; | ||
105 | |||
106 | switch (mast & 0x00000003) { | ||
107 | case 0x00000000: return clk->read(clk, nv_clk_src_crystal) >> P; | ||
108 | case 0x00000001: return 0; | ||
109 | case 0x00000002: return clk->read(clk, nv_clk_src_hclkm4) >> P; | ||
110 | case 0x00000003: return read_pll(clk, 0x004028) >> P; | ||
111 | } | ||
112 | break; | ||
113 | case nv_clk_src_cclk: | ||
114 | if ((mast & 0x03000000) != 0x03000000) | ||
115 | return clk->read(clk, nv_clk_src_core); | ||
116 | |||
117 | if ((mast & 0x00000200) == 0x00000000) | ||
118 | return clk->read(clk, nv_clk_src_core); | ||
119 | |||
120 | switch (mast & 0x00000c00) { | ||
121 | case 0x00000000: return clk->read(clk, nv_clk_src_href); | ||
122 | case 0x00000400: return clk->read(clk, nv_clk_src_hclkm4); | ||
123 | case 0x00000800: return clk->read(clk, nv_clk_src_hclkm2d3); | ||
124 | default: return 0; | ||
125 | } | ||
126 | case nv_clk_src_shader: | ||
127 | P = (nv_rd32(clk, 0x004020) & 0x00070000) >> 16; | ||
128 | switch (mast & 0x00000030) { | ||
129 | case 0x00000000: | ||
130 | if (mast & 0x00000040) | ||
131 | return clk->read(clk, nv_clk_src_href) >> P; | ||
132 | return clk->read(clk, nv_clk_src_crystal) >> P; | ||
133 | case 0x00000010: break; | ||
134 | case 0x00000020: return read_pll(clk, 0x004028) >> P; | ||
135 | case 0x00000030: return read_pll(clk, 0x004020) >> P; | ||
136 | } | ||
137 | break; | ||
138 | case nv_clk_src_mem: | ||
139 | return 0; | ||
140 | break; | ||
141 | case nv_clk_src_vdec: | ||
142 | P = (read_div(clk) & 0x00000700) >> 8; | ||
143 | |||
144 | switch (mast & 0x00400000) { | ||
145 | case 0x00400000: | ||
146 | return clk->read(clk, nv_clk_src_core) >> P; | ||
147 | break; | ||
148 | default: | ||
149 | return 500000 >> P; | ||
150 | break; | ||
151 | } | ||
152 | break; | ||
153 | default: | ||
154 | break; | ||
155 | } | ||
156 | |||
157 | nv_debug(priv, "unknown clock source %d 0x%08x\n", src, mast); | ||
158 | return 0; | ||
159 | } | ||
160 | |||
161 | static u32 | ||
162 | calc_pll(struct nvaa_clock_priv *priv, u32 reg, | ||
163 | u32 clock, int *N, int *M, int *P) | ||
164 | { | ||
165 | struct nouveau_bios *bios = nouveau_bios(priv); | ||
166 | struct nvbios_pll pll; | ||
167 | struct nouveau_clock *clk = &priv->base; | ||
168 | int ret; | ||
169 | |||
170 | ret = nvbios_pll_parse(bios, reg, &pll); | ||
171 | if (ret) | ||
172 | return 0; | ||
173 | |||
174 | pll.vco2.max_freq = 0; | ||
175 | pll.refclk = clk->read(clk, nv_clk_src_href); | ||
176 | if (!pll.refclk) | ||
177 | return 0; | ||
178 | |||
179 | return nv04_pll_calc(nv_subdev(priv), &pll, clock, N, M, NULL, NULL, P); | ||
180 | } | ||
181 | |||
182 | static inline u32 | ||
183 | calc_P(u32 src, u32 target, int *div) | ||
184 | { | ||
185 | u32 clk0 = src, clk1 = src; | ||
186 | for (*div = 0; *div <= 7; (*div)++) { | ||
187 | if (clk0 <= target) { | ||
188 | clk1 = clk0 << (*div ? 1 : 0); | ||
189 | break; | ||
190 | } | ||
191 | clk0 >>= 1; | ||
192 | } | ||
193 | |||
194 | if (target - clk0 <= clk1 - target) | ||
195 | return clk0; | ||
196 | (*div)--; | ||
197 | return clk1; | ||
198 | } | ||
199 | |||
200 | static int | ||
201 | nvaa_clock_calc(struct nouveau_clock *clk, struct nouveau_cstate *cstate) | ||
202 | { | ||
203 | struct nvaa_clock_priv *priv = (void *)clk; | ||
204 | const int shader = cstate->domain[nv_clk_src_shader]; | ||
205 | const int core = cstate->domain[nv_clk_src_core]; | ||
206 | const int vdec = cstate->domain[nv_clk_src_vdec]; | ||
207 | u32 out = 0, clock = 0; | ||
208 | int N, M, P1, P2 = 0; | ||
209 | int divs = 0; | ||
210 | |||
211 | /* cclk: find suitable source, disable PLL if we can */ | ||
212 | if (core < clk->read(clk, nv_clk_src_hclkm4)) | ||
213 | out = calc_P(clk->read(clk, nv_clk_src_hclkm4), core, &divs); | ||
214 | |||
215 | /* Calculate clock * 2, so shader clock can use it too */ | ||
216 | clock = calc_pll(priv, 0x4028, (core << 1), &N, &M, &P1); | ||
217 | |||
218 | if (abs(core - out) <= | ||
219 | abs(core - (clock >> 1))) { | ||
220 | priv->csrc = nv_clk_src_hclkm4; | ||
221 | priv->cctrl = divs << 16; | ||
222 | } else { | ||
223 | /* NVCTRL is actually used _after_ NVPOST, and after what we | ||
224 | * call NVPLL. To make matters worse, NVPOST is an integer | ||
225 | * divider instead of a right-shift number. */ | ||
226 | if(P1 > 2) { | ||
227 | P2 = P1 - 2; | ||
228 | P1 = 2; | ||
229 | } | ||
230 | |||
231 | priv->csrc = nv_clk_src_core; | ||
232 | priv->ccoef = (N << 8) | M; | ||
233 | |||
234 | priv->cctrl = (P2 + 1) << 16; | ||
235 | priv->cpost = (1 << P1) << 16; | ||
236 | } | ||
237 | |||
238 | /* sclk: nvpll + divisor, href or spll */ | ||
239 | out = 0; | ||
240 | if (shader == clk->read(clk, nv_clk_src_href)) { | ||
241 | priv->ssrc = nv_clk_src_href; | ||
242 | } else { | ||
243 | clock = calc_pll(priv, 0x4020, shader, &N, &M, &P1); | ||
244 | if (priv->csrc == nv_clk_src_core) { | ||
245 | out = calc_P((core << 1), shader, &divs); | ||
246 | } | ||
247 | |||
248 | if (abs(shader - out) <= | ||
249 | abs(shader - clock) && | ||
250 | (divs + P2) <= 7) { | ||
251 | priv->ssrc = nv_clk_src_core; | ||
252 | priv->sctrl = (divs + P2) << 16; | ||
253 | } else { | ||
254 | priv->ssrc = nv_clk_src_shader; | ||
255 | priv->scoef = (N << 8) | M; | ||
256 | priv->sctrl = P1 << 16; | ||
257 | } | ||
258 | } | ||
259 | |||
260 | /* vclk */ | ||
261 | out = calc_P(core, vdec, &divs); | ||
262 | clock = calc_P(500000, vdec, &P1); | ||
263 | if(abs(vdec - out) <= | ||
264 | abs(vdec - clock)) { | ||
265 | priv->vsrc = nv_clk_src_cclk; | ||
266 | priv->vdiv = divs << 16; | ||
267 | } else { | ||
268 | priv->vsrc = nv_clk_src_vdec; | ||
269 | priv->vdiv = P1 << 16; | ||
270 | } | ||
271 | |||
272 | /* Print strategy! */ | ||
273 | nv_debug(priv, "nvpll: %08x %08x %08x\n", | ||
274 | priv->ccoef, priv->cpost, priv->cctrl); | ||
275 | nv_debug(priv, " spll: %08x %08x %08x\n", | ||
276 | priv->scoef, priv->spost, priv->sctrl); | ||
277 | nv_debug(priv, " vdiv: %08x\n", priv->vdiv); | ||
278 | if (priv->csrc == nv_clk_src_hclkm4) | ||
279 | nv_debug(priv, "core: hrefm4\n"); | ||
280 | else | ||
281 | nv_debug(priv, "core: nvpll\n"); | ||
282 | |||
283 | if (priv->ssrc == nv_clk_src_hclkm4) | ||
284 | nv_debug(priv, "shader: hrefm4\n"); | ||
285 | else if (priv->ssrc == nv_clk_src_core) | ||
286 | nv_debug(priv, "shader: nvpll\n"); | ||
287 | else | ||
288 | nv_debug(priv, "shader: spll\n"); | ||
289 | |||
290 | if (priv->vsrc == nv_clk_src_hclkm4) | ||
291 | nv_debug(priv, "vdec: 500MHz\n"); | ||
292 | else | ||
293 | nv_debug(priv, "vdec: core\n"); | ||
294 | |||
295 | return 0; | ||
296 | } | ||
297 | |||
298 | static int | ||
299 | nvaa_clock_prog(struct nouveau_clock *clk) | ||
300 | { | ||
301 | struct nvaa_clock_priv *priv = (void *)clk; | ||
302 | struct nouveau_fifo *pfifo = nouveau_fifo(clk); | ||
303 | unsigned long flags; | ||
304 | u32 pllmask = 0, mast, ptherm_gate; | ||
305 | int ret = -EBUSY; | ||
306 | |||
307 | /* halt and idle execution engines */ | ||
308 | ptherm_gate = nv_mask(clk, 0x020060, 0x00070000, 0x00000000); | ||
309 | nv_mask(clk, 0x002504, 0x00000001, 0x00000001); | ||
310 | /* Wait until the interrupt handler is finished */ | ||
311 | if (!nv_wait(clk, 0x000100, 0xffffffff, 0x00000000)) | ||
312 | goto resume; | ||
313 | |||
314 | if (pfifo) | ||
315 | pfifo->pause(pfifo, &flags); | ||
316 | |||
317 | if (!nv_wait(clk, 0x002504, 0x00000010, 0x00000010)) | ||
318 | goto resume; | ||
319 | if (!nv_wait(clk, 0x00251c, 0x0000003f, 0x0000003f)) | ||
320 | goto resume; | ||
321 | |||
322 | /* First switch to safe clocks: href */ | ||
323 | mast = nv_mask(clk, 0xc054, 0x03400e70, 0x03400640); | ||
324 | mast &= ~0x00400e73; | ||
325 | mast |= 0x03000000; | ||
326 | |||
327 | switch (priv->csrc) { | ||
328 | case nv_clk_src_hclkm4: | ||
329 | nv_mask(clk, 0x4028, 0x00070000, priv->cctrl); | ||
330 | mast |= 0x00000002; | ||
331 | break; | ||
332 | case nv_clk_src_core: | ||
333 | nv_wr32(clk, 0x402c, priv->ccoef); | ||
334 | nv_wr32(clk, 0x4028, 0x80000000 | priv->cctrl); | ||
335 | nv_wr32(clk, 0x4040, priv->cpost); | ||
336 | pllmask |= (0x3 << 8); | ||
337 | mast |= 0x00000003; | ||
338 | break; | ||
339 | default: | ||
340 | nv_warn(priv,"Reclocking failed: unknown core clock\n"); | ||
341 | goto resume; | ||
342 | } | ||
343 | |||
344 | switch (priv->ssrc) { | ||
345 | case nv_clk_src_href: | ||
346 | nv_mask(clk, 0x4020, 0x00070000, 0x00000000); | ||
347 | /* mast |= 0x00000000; */ | ||
348 | break; | ||
349 | case nv_clk_src_core: | ||
350 | nv_mask(clk, 0x4020, 0x00070000, priv->sctrl); | ||
351 | mast |= 0x00000020; | ||
352 | break; | ||
353 | case nv_clk_src_shader: | ||
354 | nv_wr32(clk, 0x4024, priv->scoef); | ||
355 | nv_wr32(clk, 0x4020, 0x80000000 | priv->sctrl); | ||
356 | nv_wr32(clk, 0x4070, priv->spost); | ||
357 | pllmask |= (0x3 << 12); | ||
358 | mast |= 0x00000030; | ||
359 | break; | ||
360 | default: | ||
361 | nv_warn(priv,"Reclocking failed: unknown sclk clock\n"); | ||
362 | goto resume; | ||
363 | } | ||
364 | |||
365 | if (!nv_wait(clk, 0x004080, pllmask, pllmask)) { | ||
366 | nv_warn(priv,"Reclocking failed: unstable PLLs\n"); | ||
367 | goto resume; | ||
368 | } | ||
369 | |||
370 | switch (priv->vsrc) { | ||
371 | case nv_clk_src_cclk: | ||
372 | mast |= 0x00400000; | ||
373 | default: | ||
374 | nv_wr32(clk, 0x4600, priv->vdiv); | ||
375 | } | ||
376 | |||
377 | nv_wr32(clk, 0xc054, mast); | ||
378 | ret = 0; | ||
379 | |||
380 | resume: | ||
381 | if (pfifo) | ||
382 | pfifo->start(pfifo, &flags); | ||
383 | |||
384 | nv_mask(clk, 0x002504, 0x00000001, 0x00000000); | ||
385 | nv_wr32(clk, 0x020060, ptherm_gate); | ||
386 | |||
387 | /* Disable some PLLs and dividers when unused */ | ||
388 | if (priv->csrc != nv_clk_src_core) { | ||
389 | nv_wr32(clk, 0x4040, 0x00000000); | ||
390 | nv_mask(clk, 0x4028, 0x80000000, 0x00000000); | ||
391 | } | ||
392 | |||
393 | if (priv->ssrc != nv_clk_src_shader) { | ||
394 | nv_wr32(clk, 0x4070, 0x00000000); | ||
395 | nv_mask(clk, 0x4020, 0x80000000, 0x00000000); | ||
396 | } | ||
397 | |||
398 | return ret; | ||
399 | } | ||
400 | |||
401 | static void | ||
402 | nvaa_clock_tidy(struct nouveau_clock *clk) | ||
403 | { | ||
404 | } | ||
405 | |||
406 | static struct nouveau_clocks | ||
407 | nvaa_domains[] = { | ||
408 | { nv_clk_src_crystal, 0xff }, | ||
409 | { nv_clk_src_href , 0xff }, | ||
410 | { nv_clk_src_core , 0xff, 0, "core", 1000 }, | ||
411 | { nv_clk_src_shader , 0xff, 0, "shader", 1000 }, | ||
412 | { nv_clk_src_vdec , 0xff, 0, "vdec", 1000 }, | ||
413 | { nv_clk_src_max } | ||
414 | }; | ||
415 | |||
416 | static int | ||
417 | nvaa_clock_ctor(struct nouveau_object *parent, struct nouveau_object *engine, | ||
418 | struct nouveau_oclass *oclass, void *data, u32 size, | ||
419 | struct nouveau_object **pobject) | ||
420 | { | ||
421 | struct nvaa_clock_priv *priv; | ||
422 | int ret; | ||
423 | |||
424 | ret = nouveau_clock_create(parent, engine, oclass, nvaa_domains, &priv); | ||
425 | *pobject = nv_object(priv); | ||
426 | if (ret) | ||
427 | return ret; | ||
428 | |||
429 | priv->base.read = nvaa_clock_read; | ||
430 | priv->base.calc = nvaa_clock_calc; | ||
431 | priv->base.prog = nvaa_clock_prog; | ||
432 | priv->base.tidy = nvaa_clock_tidy; | ||
433 | return 0; | ||
434 | } | ||
435 | |||
436 | struct nouveau_oclass * | ||
437 | nvaa_clock_oclass = &(struct nouveau_oclass) { | ||
438 | .handle = NV_SUBDEV(CLOCK, 0xaa), | ||
439 | .ofuncs = &(struct nouveau_ofuncs) { | ||
440 | .ctor = nvaa_clock_ctor, | ||
441 | .dtor = _nouveau_clock_dtor, | ||
442 | .init = _nouveau_clock_init, | ||
443 | .fini = _nouveau_clock_fini, | ||
444 | }, | ||
445 | }; | ||
diff --git a/drivers/gpu/drm/nouveau/dispnv04/overlay.c b/drivers/gpu/drm/nouveau/dispnv04/overlay.c index 3618ac6b6316..32e7064b819b 100644 --- a/drivers/gpu/drm/nouveau/dispnv04/overlay.c +++ b/drivers/gpu/drm/nouveau/dispnv04/overlay.c | |||
@@ -58,8 +58,8 @@ struct nouveau_plane { | |||
58 | }; | 58 | }; |
59 | 59 | ||
60 | static uint32_t formats[] = { | 60 | static uint32_t formats[] = { |
61 | DRM_FORMAT_NV12, | ||
62 | DRM_FORMAT_UYVY, | 61 | DRM_FORMAT_UYVY, |
62 | DRM_FORMAT_NV12, | ||
63 | }; | 63 | }; |
64 | 64 | ||
65 | /* Sine can be approximated with | 65 | /* Sine can be approximated with |
@@ -99,13 +99,28 @@ nv10_update_plane(struct drm_plane *plane, struct drm_crtc *crtc, | |||
99 | struct nouveau_crtc *nv_crtc = nouveau_crtc(crtc); | 99 | struct nouveau_crtc *nv_crtc = nouveau_crtc(crtc); |
100 | struct nouveau_bo *cur = nv_plane->cur; | 100 | struct nouveau_bo *cur = nv_plane->cur; |
101 | bool flip = nv_plane->flip; | 101 | bool flip = nv_plane->flip; |
102 | int format = ALIGN(src_w * 4, 0x100); | ||
103 | int soff = NV_PCRTC0_SIZE * nv_crtc->index; | 102 | int soff = NV_PCRTC0_SIZE * nv_crtc->index; |
104 | int soff2 = NV_PCRTC0_SIZE * !nv_crtc->index; | 103 | int soff2 = NV_PCRTC0_SIZE * !nv_crtc->index; |
105 | int ret; | 104 | int format, ret; |
105 | |||
106 | /* Source parameters given in 16.16 fixed point, ignore fractional. */ | ||
107 | src_x >>= 16; | ||
108 | src_y >>= 16; | ||
109 | src_w >>= 16; | ||
110 | src_h >>= 16; | ||
111 | |||
112 | format = ALIGN(src_w * 4, 0x100); | ||
106 | 113 | ||
107 | if (format > 0xffff) | 114 | if (format > 0xffff) |
108 | return -EINVAL; | 115 | return -ERANGE; |
116 | |||
117 | if (dev->chipset >= 0x30) { | ||
118 | if (crtc_w < (src_w >> 1) || crtc_h < (src_h >> 1)) | ||
119 | return -ERANGE; | ||
120 | } else { | ||
121 | if (crtc_w < (src_w >> 3) || crtc_h < (src_h >> 3)) | ||
122 | return -ERANGE; | ||
123 | } | ||
109 | 124 | ||
110 | ret = nouveau_bo_pin(nv_fb->nvbo, TTM_PL_FLAG_VRAM); | 125 | ret = nouveau_bo_pin(nv_fb->nvbo, TTM_PL_FLAG_VRAM); |
111 | if (ret) | 126 | if (ret) |
@@ -113,12 +128,6 @@ nv10_update_plane(struct drm_plane *plane, struct drm_crtc *crtc, | |||
113 | 128 | ||
114 | nv_plane->cur = nv_fb->nvbo; | 129 | nv_plane->cur = nv_fb->nvbo; |
115 | 130 | ||
116 | /* Source parameters given in 16.16 fixed point, ignore fractional. */ | ||
117 | src_x = src_x >> 16; | ||
118 | src_y = src_y >> 16; | ||
119 | src_w = src_w >> 16; | ||
120 | src_h = src_h >> 16; | ||
121 | |||
122 | nv_mask(dev, NV_PCRTC_ENGINE_CTRL + soff, NV_CRTC_FSEL_OVERLAY, NV_CRTC_FSEL_OVERLAY); | 131 | nv_mask(dev, NV_PCRTC_ENGINE_CTRL + soff, NV_CRTC_FSEL_OVERLAY, NV_CRTC_FSEL_OVERLAY); |
123 | nv_mask(dev, NV_PCRTC_ENGINE_CTRL + soff2, NV_CRTC_FSEL_OVERLAY, 0); | 132 | nv_mask(dev, NV_PCRTC_ENGINE_CTRL + soff2, NV_CRTC_FSEL_OVERLAY, 0); |
124 | 133 | ||
@@ -245,14 +254,25 @@ nv10_overlay_init(struct drm_device *device) | |||
245 | { | 254 | { |
246 | struct nouveau_device *dev = nouveau_dev(device); | 255 | struct nouveau_device *dev = nouveau_dev(device); |
247 | struct nouveau_plane *plane = kzalloc(sizeof(struct nouveau_plane), GFP_KERNEL); | 256 | struct nouveau_plane *plane = kzalloc(sizeof(struct nouveau_plane), GFP_KERNEL); |
257 | int num_formats = ARRAY_SIZE(formats); | ||
248 | int ret; | 258 | int ret; |
249 | 259 | ||
250 | if (!plane) | 260 | if (!plane) |
251 | return; | 261 | return; |
252 | 262 | ||
263 | switch (dev->chipset) { | ||
264 | case 0x10: | ||
265 | case 0x11: | ||
266 | case 0x15: | ||
267 | case 0x1a: | ||
268 | case 0x20: | ||
269 | num_formats = 1; | ||
270 | break; | ||
271 | } | ||
272 | |||
253 | ret = drm_plane_init(device, &plane->base, 3 /* both crtc's */, | 273 | ret = drm_plane_init(device, &plane->base, 3 /* both crtc's */, |
254 | &nv10_plane_funcs, | 274 | &nv10_plane_funcs, |
255 | formats, ARRAY_SIZE(formats), false); | 275 | formats, num_formats, false); |
256 | if (ret) | 276 | if (ret) |
257 | goto err; | 277 | goto err; |
258 | 278 | ||
diff --git a/drivers/gpu/drm/nouveau/nouveau_display.c b/drivers/gpu/drm/nouveau/nouveau_display.c index 7809d92183c4..29c3efdfc7dd 100644 --- a/drivers/gpu/drm/nouveau/nouveau_display.c +++ b/drivers/gpu/drm/nouveau/nouveau_display.c | |||
@@ -608,6 +608,7 @@ nouveau_crtc_page_flip(struct drm_crtc *crtc, struct drm_framebuffer *fb, | |||
608 | fence = nouveau_fence_ref(new_bo->bo.sync_obj); | 608 | fence = nouveau_fence_ref(new_bo->bo.sync_obj); |
609 | spin_unlock(&new_bo->bo.bdev->fence_lock); | 609 | spin_unlock(&new_bo->bo.bdev->fence_lock); |
610 | ret = nouveau_fence_sync(fence, chan); | 610 | ret = nouveau_fence_sync(fence, chan); |
611 | nouveau_fence_unref(&fence); | ||
611 | if (ret) | 612 | if (ret) |
612 | return ret; | 613 | return ret; |
613 | 614 | ||
@@ -701,7 +702,7 @@ nouveau_finish_page_flip(struct nouveau_channel *chan, | |||
701 | 702 | ||
702 | s = list_first_entry(&fctx->flip, struct nouveau_page_flip_state, head); | 703 | s = list_first_entry(&fctx->flip, struct nouveau_page_flip_state, head); |
703 | if (s->event) | 704 | if (s->event) |
704 | drm_send_vblank_event(dev, -1, s->event); | 705 | drm_send_vblank_event(dev, s->crtc, s->event); |
705 | 706 | ||
706 | list_del(&s->head); | 707 | list_del(&s->head); |
707 | if (ps) | 708 | if (ps) |
diff --git a/drivers/gpu/drm/nouveau/nv50_display.c b/drivers/gpu/drm/nouveau/nv50_display.c index f8e66c08b11a..4e384a2f99c3 100644 --- a/drivers/gpu/drm/nouveau/nv50_display.c +++ b/drivers/gpu/drm/nouveau/nv50_display.c | |||
@@ -1265,7 +1265,7 @@ nv50_crtc_gamma_set(struct drm_crtc *crtc, u16 *r, u16 *g, u16 *b, | |||
1265 | uint32_t start, uint32_t size) | 1265 | uint32_t start, uint32_t size) |
1266 | { | 1266 | { |
1267 | struct nouveau_crtc *nv_crtc = nouveau_crtc(crtc); | 1267 | struct nouveau_crtc *nv_crtc = nouveau_crtc(crtc); |
1268 | u32 end = max(start + size, (u32)256); | 1268 | u32 end = min_t(u32, start + size, 256); |
1269 | u32 i; | 1269 | u32 i; |
1270 | 1270 | ||
1271 | for (i = start; i < end; i++) { | 1271 | for (i = start; i < end; i++) { |
diff --git a/drivers/gpu/drm/radeon/atombios_i2c.c b/drivers/gpu/drm/radeon/atombios_i2c.c index 0652ee0a2098..f685035dbe39 100644 --- a/drivers/gpu/drm/radeon/atombios_i2c.c +++ b/drivers/gpu/drm/radeon/atombios_i2c.c | |||
@@ -44,7 +44,7 @@ static int radeon_process_i2c_ch(struct radeon_i2c_chan *chan, | |||
44 | PROCESS_I2C_CHANNEL_TRANSACTION_PS_ALLOCATION args; | 44 | PROCESS_I2C_CHANNEL_TRANSACTION_PS_ALLOCATION args; |
45 | int index = GetIndexIntoMasterTable(COMMAND, ProcessI2cChannelTransaction); | 45 | int index = GetIndexIntoMasterTable(COMMAND, ProcessI2cChannelTransaction); |
46 | unsigned char *base; | 46 | unsigned char *base; |
47 | u16 out; | 47 | u16 out = cpu_to_le16(0); |
48 | 48 | ||
49 | memset(&args, 0, sizeof(args)); | 49 | memset(&args, 0, sizeof(args)); |
50 | 50 | ||
@@ -55,11 +55,14 @@ static int radeon_process_i2c_ch(struct radeon_i2c_chan *chan, | |||
55 | DRM_ERROR("hw i2c: tried to write too many bytes (%d vs 3)\n", num); | 55 | DRM_ERROR("hw i2c: tried to write too many bytes (%d vs 3)\n", num); |
56 | return -EINVAL; | 56 | return -EINVAL; |
57 | } | 57 | } |
58 | args.ucRegIndex = buf[0]; | 58 | if (buf == NULL) |
59 | if (num > 1) { | 59 | args.ucRegIndex = 0; |
60 | else | ||
61 | args.ucRegIndex = buf[0]; | ||
62 | if (num) | ||
60 | num--; | 63 | num--; |
64 | if (num) | ||
61 | memcpy(&out, &buf[1], num); | 65 | memcpy(&out, &buf[1], num); |
62 | } | ||
63 | args.lpI2CDataOut = cpu_to_le16(out); | 66 | args.lpI2CDataOut = cpu_to_le16(out); |
64 | } else { | 67 | } else { |
65 | if (num > ATOM_MAX_HW_I2C_READ) { | 68 | if (num > ATOM_MAX_HW_I2C_READ) { |
@@ -96,14 +99,14 @@ int radeon_atom_hw_i2c_xfer(struct i2c_adapter *i2c_adap, | |||
96 | struct radeon_i2c_chan *i2c = i2c_get_adapdata(i2c_adap); | 99 | struct radeon_i2c_chan *i2c = i2c_get_adapdata(i2c_adap); |
97 | struct i2c_msg *p; | 100 | struct i2c_msg *p; |
98 | int i, remaining, current_count, buffer_offset, max_bytes, ret; | 101 | int i, remaining, current_count, buffer_offset, max_bytes, ret; |
99 | u8 buf = 0, flags; | 102 | u8 flags; |
100 | 103 | ||
101 | /* check for bus probe */ | 104 | /* check for bus probe */ |
102 | p = &msgs[0]; | 105 | p = &msgs[0]; |
103 | if ((num == 1) && (p->len == 0)) { | 106 | if ((num == 1) && (p->len == 0)) { |
104 | ret = radeon_process_i2c_ch(i2c, | 107 | ret = radeon_process_i2c_ch(i2c, |
105 | p->addr, HW_I2C_WRITE, | 108 | p->addr, HW_I2C_WRITE, |
106 | &buf, 1); | 109 | NULL, 0); |
107 | if (ret) | 110 | if (ret) |
108 | return ret; | 111 | return ret; |
109 | else | 112 | else |
diff --git a/drivers/gpu/drm/radeon/dce6_afmt.c b/drivers/gpu/drm/radeon/dce6_afmt.c index 009f46e0ce72..de86493cbc44 100644 --- a/drivers/gpu/drm/radeon/dce6_afmt.c +++ b/drivers/gpu/drm/radeon/dce6_afmt.c | |||
@@ -93,11 +93,13 @@ void dce6_afmt_select_pin(struct drm_encoder *encoder) | |||
93 | struct radeon_device *rdev = encoder->dev->dev_private; | 93 | struct radeon_device *rdev = encoder->dev->dev_private; |
94 | struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder); | 94 | struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder); |
95 | struct radeon_encoder_atom_dig *dig = radeon_encoder->enc_priv; | 95 | struct radeon_encoder_atom_dig *dig = radeon_encoder->enc_priv; |
96 | u32 offset = dig->afmt->offset; | 96 | u32 offset; |
97 | 97 | ||
98 | if (!dig->afmt->pin) | 98 | if (!dig || !dig->afmt || !dig->afmt->pin) |
99 | return; | 99 | return; |
100 | 100 | ||
101 | offset = dig->afmt->offset; | ||
102 | |||
101 | WREG32(AFMT_AUDIO_SRC_CONTROL + offset, | 103 | WREG32(AFMT_AUDIO_SRC_CONTROL + offset, |
102 | AFMT_AUDIO_SRC_SELECT(dig->afmt->pin->id)); | 104 | AFMT_AUDIO_SRC_SELECT(dig->afmt->pin->id)); |
103 | } | 105 | } |
@@ -112,7 +114,7 @@ void dce6_afmt_write_latency_fields(struct drm_encoder *encoder, | |||
112 | struct radeon_connector *radeon_connector = NULL; | 114 | struct radeon_connector *radeon_connector = NULL; |
113 | u32 tmp = 0, offset; | 115 | u32 tmp = 0, offset; |
114 | 116 | ||
115 | if (!dig->afmt->pin) | 117 | if (!dig || !dig->afmt || !dig->afmt->pin) |
116 | return; | 118 | return; |
117 | 119 | ||
118 | offset = dig->afmt->pin->offset; | 120 | offset = dig->afmt->pin->offset; |
@@ -156,7 +158,7 @@ void dce6_afmt_write_speaker_allocation(struct drm_encoder *encoder) | |||
156 | u8 *sadb; | 158 | u8 *sadb; |
157 | int sad_count; | 159 | int sad_count; |
158 | 160 | ||
159 | if (!dig->afmt->pin) | 161 | if (!dig || !dig->afmt || !dig->afmt->pin) |
160 | return; | 162 | return; |
161 | 163 | ||
162 | offset = dig->afmt->pin->offset; | 164 | offset = dig->afmt->pin->offset; |
@@ -217,7 +219,7 @@ void dce6_afmt_write_sad_regs(struct drm_encoder *encoder) | |||
217 | { AZ_F0_CODEC_PIN_CONTROL_AUDIO_DESCRIPTOR13, HDMI_AUDIO_CODING_TYPE_WMA_PRO }, | 219 | { AZ_F0_CODEC_PIN_CONTROL_AUDIO_DESCRIPTOR13, HDMI_AUDIO_CODING_TYPE_WMA_PRO }, |
218 | }; | 220 | }; |
219 | 221 | ||
220 | if (!dig->afmt->pin) | 222 | if (!dig || !dig->afmt || !dig->afmt->pin) |
221 | return; | 223 | return; |
222 | 224 | ||
223 | offset = dig->afmt->pin->offset; | 225 | offset = dig->afmt->pin->offset; |
diff --git a/drivers/gpu/drm/radeon/ni_dpm.c b/drivers/gpu/drm/radeon/ni_dpm.c index cdc003085a76..49c4d48f54d6 100644 --- a/drivers/gpu/drm/radeon/ni_dpm.c +++ b/drivers/gpu/drm/radeon/ni_dpm.c | |||
@@ -785,8 +785,8 @@ static void ni_apply_state_adjust_rules(struct radeon_device *rdev, | |||
785 | struct ni_ps *ps = ni_get_ps(rps); | 785 | struct ni_ps *ps = ni_get_ps(rps); |
786 | struct radeon_clock_and_voltage_limits *max_limits; | 786 | struct radeon_clock_and_voltage_limits *max_limits; |
787 | bool disable_mclk_switching; | 787 | bool disable_mclk_switching; |
788 | u32 mclk, sclk; | 788 | u32 mclk; |
789 | u16 vddc, vddci; | 789 | u16 vddci; |
790 | u32 max_sclk_vddc, max_mclk_vddci, max_mclk_vddc; | 790 | u32 max_sclk_vddc, max_mclk_vddci, max_mclk_vddc; |
791 | int i; | 791 | int i; |
792 | 792 | ||
@@ -839,24 +839,14 @@ static void ni_apply_state_adjust_rules(struct radeon_device *rdev, | |||
839 | 839 | ||
840 | /* XXX validate the min clocks required for display */ | 840 | /* XXX validate the min clocks required for display */ |
841 | 841 | ||
842 | /* adjust low state */ | ||
842 | if (disable_mclk_switching) { | 843 | if (disable_mclk_switching) { |
843 | mclk = ps->performance_levels[ps->performance_level_count - 1].mclk; | 844 | ps->performance_levels[0].mclk = |
844 | sclk = ps->performance_levels[0].sclk; | 845 | ps->performance_levels[ps->performance_level_count - 1].mclk; |
845 | vddc = ps->performance_levels[0].vddc; | 846 | ps->performance_levels[0].vddci = |
846 | vddci = ps->performance_levels[ps->performance_level_count - 1].vddci; | 847 | ps->performance_levels[ps->performance_level_count - 1].vddci; |
847 | } else { | ||
848 | sclk = ps->performance_levels[0].sclk; | ||
849 | mclk = ps->performance_levels[0].mclk; | ||
850 | vddc = ps->performance_levels[0].vddc; | ||
851 | vddci = ps->performance_levels[0].vddci; | ||
852 | } | 848 | } |
853 | 849 | ||
854 | /* adjusted low state */ | ||
855 | ps->performance_levels[0].sclk = sclk; | ||
856 | ps->performance_levels[0].mclk = mclk; | ||
857 | ps->performance_levels[0].vddc = vddc; | ||
858 | ps->performance_levels[0].vddci = vddci; | ||
859 | |||
860 | btc_skip_blacklist_clocks(rdev, max_limits->sclk, max_limits->mclk, | 850 | btc_skip_blacklist_clocks(rdev, max_limits->sclk, max_limits->mclk, |
861 | &ps->performance_levels[0].sclk, | 851 | &ps->performance_levels[0].sclk, |
862 | &ps->performance_levels[0].mclk); | 852 | &ps->performance_levels[0].mclk); |
@@ -868,11 +858,15 @@ static void ni_apply_state_adjust_rules(struct radeon_device *rdev, | |||
868 | ps->performance_levels[i].vddc = ps->performance_levels[i - 1].vddc; | 858 | ps->performance_levels[i].vddc = ps->performance_levels[i - 1].vddc; |
869 | } | 859 | } |
870 | 860 | ||
861 | /* adjust remaining states */ | ||
871 | if (disable_mclk_switching) { | 862 | if (disable_mclk_switching) { |
872 | mclk = ps->performance_levels[0].mclk; | 863 | mclk = ps->performance_levels[0].mclk; |
864 | vddci = ps->performance_levels[0].vddci; | ||
873 | for (i = 1; i < ps->performance_level_count; i++) { | 865 | for (i = 1; i < ps->performance_level_count; i++) { |
874 | if (mclk < ps->performance_levels[i].mclk) | 866 | if (mclk < ps->performance_levels[i].mclk) |
875 | mclk = ps->performance_levels[i].mclk; | 867 | mclk = ps->performance_levels[i].mclk; |
868 | if (vddci < ps->performance_levels[i].vddci) | ||
869 | vddci = ps->performance_levels[i].vddci; | ||
876 | } | 870 | } |
877 | for (i = 0; i < ps->performance_level_count; i++) { | 871 | for (i = 0; i < ps->performance_level_count; i++) { |
878 | ps->performance_levels[i].mclk = mclk; | 872 | ps->performance_levels[i].mclk = mclk; |
diff --git a/drivers/gpu/drm/radeon/r600_hdmi.c b/drivers/gpu/drm/radeon/r600_hdmi.c index 4b89262f3f0e..b7d3ecba43e3 100644 --- a/drivers/gpu/drm/radeon/r600_hdmi.c +++ b/drivers/gpu/drm/radeon/r600_hdmi.c | |||
@@ -304,9 +304,9 @@ void r600_audio_set_dto(struct drm_encoder *encoder, u32 clock) | |||
304 | WREG32(DCCG_AUDIO_DTO1_MODULE, dto_modulo); | 304 | WREG32(DCCG_AUDIO_DTO1_MODULE, dto_modulo); |
305 | WREG32(DCCG_AUDIO_DTO_SELECT, 1); /* select DTO1 */ | 305 | WREG32(DCCG_AUDIO_DTO_SELECT, 1); /* select DTO1 */ |
306 | } | 306 | } |
307 | } else if (ASIC_IS_DCE3(rdev)) { | 307 | } else { |
308 | /* according to the reg specs, this should DCE3.2 only, but in | 308 | /* according to the reg specs, this should DCE3.2 only, but in |
309 | * practice it seems to cover DCE3.0/3.1 as well. | 309 | * practice it seems to cover DCE2.0/3.0/3.1 as well. |
310 | */ | 310 | */ |
311 | if (dig->dig_encoder == 0) { | 311 | if (dig->dig_encoder == 0) { |
312 | WREG32(DCCG_AUDIO_DTO0_PHASE, base_rate * 100); | 312 | WREG32(DCCG_AUDIO_DTO0_PHASE, base_rate * 100); |
@@ -317,10 +317,6 @@ void r600_audio_set_dto(struct drm_encoder *encoder, u32 clock) | |||
317 | WREG32(DCCG_AUDIO_DTO1_MODULE, clock * 100); | 317 | WREG32(DCCG_AUDIO_DTO1_MODULE, clock * 100); |
318 | WREG32(DCCG_AUDIO_DTO_SELECT, 1); /* select DTO1 */ | 318 | WREG32(DCCG_AUDIO_DTO_SELECT, 1); /* select DTO1 */ |
319 | } | 319 | } |
320 | } else { | ||
321 | /* according to the reg specs, this should be DCE2.0 and DCE3.0/3.1 */ | ||
322 | WREG32(AUDIO_DTO, AUDIO_DTO_PHASE(base_rate / 10) | | ||
323 | AUDIO_DTO_MODULE(clock / 10)); | ||
324 | } | 320 | } |
325 | } | 321 | } |
326 | 322 | ||
diff --git a/drivers/gpu/drm/radeon/radeon.h b/drivers/gpu/drm/radeon/radeon.h index ecf2a3960c07..b1f990d0eaa1 100644 --- a/drivers/gpu/drm/radeon/radeon.h +++ b/drivers/gpu/drm/radeon/radeon.h | |||
@@ -2710,10 +2710,10 @@ void radeon_vm_fence(struct radeon_device *rdev, | |||
2710 | struct radeon_vm *vm, | 2710 | struct radeon_vm *vm, |
2711 | struct radeon_fence *fence); | 2711 | struct radeon_fence *fence); |
2712 | uint64_t radeon_vm_map_gart(struct radeon_device *rdev, uint64_t addr); | 2712 | uint64_t radeon_vm_map_gart(struct radeon_device *rdev, uint64_t addr); |
2713 | int radeon_vm_bo_update_pte(struct radeon_device *rdev, | 2713 | int radeon_vm_bo_update(struct radeon_device *rdev, |
2714 | struct radeon_vm *vm, | 2714 | struct radeon_vm *vm, |
2715 | struct radeon_bo *bo, | 2715 | struct radeon_bo *bo, |
2716 | struct ttm_mem_reg *mem); | 2716 | struct ttm_mem_reg *mem); |
2717 | void radeon_vm_bo_invalidate(struct radeon_device *rdev, | 2717 | void radeon_vm_bo_invalidate(struct radeon_device *rdev, |
2718 | struct radeon_bo *bo); | 2718 | struct radeon_bo *bo); |
2719 | struct radeon_bo_va *radeon_vm_bo_find(struct radeon_vm *vm, | 2719 | struct radeon_bo_va *radeon_vm_bo_find(struct radeon_vm *vm, |
diff --git a/drivers/gpu/drm/radeon/radeon_atombios.c b/drivers/gpu/drm/radeon/radeon_atombios.c index f79ee184ffd5..5c39bf7c3d88 100644 --- a/drivers/gpu/drm/radeon/radeon_atombios.c +++ b/drivers/gpu/drm/radeon/radeon_atombios.c | |||
@@ -2918,7 +2918,7 @@ int radeon_atom_get_memory_pll_dividers(struct radeon_device *rdev, | |||
2918 | mpll_param->dll_speed = args.ucDllSpeed; | 2918 | mpll_param->dll_speed = args.ucDllSpeed; |
2919 | mpll_param->bwcntl = args.ucBWCntl; | 2919 | mpll_param->bwcntl = args.ucBWCntl; |
2920 | mpll_param->vco_mode = | 2920 | mpll_param->vco_mode = |
2921 | (args.ucPllCntlFlag & MPLL_CNTL_FLAG_VCO_MODE_MASK) ? 1 : 0; | 2921 | (args.ucPllCntlFlag & MPLL_CNTL_FLAG_VCO_MODE_MASK); |
2922 | mpll_param->yclk_sel = | 2922 | mpll_param->yclk_sel = |
2923 | (args.ucPllCntlFlag & MPLL_CNTL_FLAG_BYPASS_DQ_PLL) ? 1 : 0; | 2923 | (args.ucPllCntlFlag & MPLL_CNTL_FLAG_BYPASS_DQ_PLL) ? 1 : 0; |
2924 | mpll_param->qdr = | 2924 | mpll_param->qdr = |
diff --git a/drivers/gpu/drm/radeon/radeon_cs.c b/drivers/gpu/drm/radeon/radeon_cs.c index f41594b2eeac..0b366169d64d 100644 --- a/drivers/gpu/drm/radeon/radeon_cs.c +++ b/drivers/gpu/drm/radeon/radeon_cs.c | |||
@@ -360,13 +360,13 @@ static int radeon_bo_vm_update_pte(struct radeon_cs_parser *parser, | |||
360 | struct radeon_bo *bo; | 360 | struct radeon_bo *bo; |
361 | int r; | 361 | int r; |
362 | 362 | ||
363 | r = radeon_vm_bo_update_pte(rdev, vm, rdev->ring_tmp_bo.bo, &rdev->ring_tmp_bo.bo->tbo.mem); | 363 | r = radeon_vm_bo_update(rdev, vm, rdev->ring_tmp_bo.bo, &rdev->ring_tmp_bo.bo->tbo.mem); |
364 | if (r) { | 364 | if (r) { |
365 | return r; | 365 | return r; |
366 | } | 366 | } |
367 | list_for_each_entry(lobj, &parser->validated, tv.head) { | 367 | list_for_each_entry(lobj, &parser->validated, tv.head) { |
368 | bo = lobj->bo; | 368 | bo = lobj->bo; |
369 | r = radeon_vm_bo_update_pte(parser->rdev, vm, bo, &bo->tbo.mem); | 369 | r = radeon_vm_bo_update(parser->rdev, vm, bo, &bo->tbo.mem); |
370 | if (r) { | 370 | if (r) { |
371 | return r; | 371 | return r; |
372 | } | 372 | } |
diff --git a/drivers/gpu/drm/radeon/radeon_drv.h b/drivers/gpu/drm/radeon/radeon_drv.h index 543dcfae7e6f..00e0d449021c 100644 --- a/drivers/gpu/drm/radeon/radeon_drv.h +++ b/drivers/gpu/drm/radeon/radeon_drv.h | |||
@@ -108,9 +108,10 @@ | |||
108 | * 1.31- Add support for num Z pipes from GET_PARAM | 108 | * 1.31- Add support for num Z pipes from GET_PARAM |
109 | * 1.32- fixes for rv740 setup | 109 | * 1.32- fixes for rv740 setup |
110 | * 1.33- Add r6xx/r7xx const buffer support | 110 | * 1.33- Add r6xx/r7xx const buffer support |
111 | * 1.34- fix evergreen/cayman GS register | ||
111 | */ | 112 | */ |
112 | #define DRIVER_MAJOR 1 | 113 | #define DRIVER_MAJOR 1 |
113 | #define DRIVER_MINOR 33 | 114 | #define DRIVER_MINOR 34 |
114 | #define DRIVER_PATCHLEVEL 0 | 115 | #define DRIVER_PATCHLEVEL 0 |
115 | 116 | ||
116 | long radeon_drm_ioctl(struct file *filp, | 117 | long radeon_drm_ioctl(struct file *filp, |
diff --git a/drivers/gpu/drm/radeon/radeon_gart.c b/drivers/gpu/drm/radeon/radeon_gart.c index 3044e504f4ec..96e440061bdb 100644 --- a/drivers/gpu/drm/radeon/radeon_gart.c +++ b/drivers/gpu/drm/radeon/radeon_gart.c | |||
@@ -29,6 +29,7 @@ | |||
29 | #include <drm/radeon_drm.h> | 29 | #include <drm/radeon_drm.h> |
30 | #include "radeon.h" | 30 | #include "radeon.h" |
31 | #include "radeon_reg.h" | 31 | #include "radeon_reg.h" |
32 | #include "radeon_trace.h" | ||
32 | 33 | ||
33 | /* | 34 | /* |
34 | * GART | 35 | * GART |
@@ -737,6 +738,7 @@ struct radeon_fence *radeon_vm_grab_id(struct radeon_device *rdev, | |||
737 | for (i = 0; i < 2; ++i) { | 738 | for (i = 0; i < 2; ++i) { |
738 | if (choices[i]) { | 739 | if (choices[i]) { |
739 | vm->id = choices[i]; | 740 | vm->id = choices[i]; |
741 | trace_radeon_vm_grab_id(vm->id, ring); | ||
740 | return rdev->vm_manager.active[choices[i]]; | 742 | return rdev->vm_manager.active[choices[i]]; |
741 | } | 743 | } |
742 | } | 744 | } |
@@ -1116,7 +1118,7 @@ static void radeon_vm_update_ptes(struct radeon_device *rdev, | |||
1116 | } | 1118 | } |
1117 | 1119 | ||
1118 | /** | 1120 | /** |
1119 | * radeon_vm_bo_update_pte - map a bo into the vm page table | 1121 | * radeon_vm_bo_update - map a bo into the vm page table |
1120 | * | 1122 | * |
1121 | * @rdev: radeon_device pointer | 1123 | * @rdev: radeon_device pointer |
1122 | * @vm: requested vm | 1124 | * @vm: requested vm |
@@ -1128,10 +1130,10 @@ static void radeon_vm_update_ptes(struct radeon_device *rdev, | |||
1128 | * | 1130 | * |
1129 | * Object have to be reserved & global and local mutex must be locked! | 1131 | * Object have to be reserved & global and local mutex must be locked! |
1130 | */ | 1132 | */ |
1131 | int radeon_vm_bo_update_pte(struct radeon_device *rdev, | 1133 | int radeon_vm_bo_update(struct radeon_device *rdev, |
1132 | struct radeon_vm *vm, | 1134 | struct radeon_vm *vm, |
1133 | struct radeon_bo *bo, | 1135 | struct radeon_bo *bo, |
1134 | struct ttm_mem_reg *mem) | 1136 | struct ttm_mem_reg *mem) |
1135 | { | 1137 | { |
1136 | struct radeon_ib ib; | 1138 | struct radeon_ib ib; |
1137 | struct radeon_bo_va *bo_va; | 1139 | struct radeon_bo_va *bo_va; |
@@ -1176,6 +1178,8 @@ int radeon_vm_bo_update_pte(struct radeon_device *rdev, | |||
1176 | bo_va->valid = false; | 1178 | bo_va->valid = false; |
1177 | } | 1179 | } |
1178 | 1180 | ||
1181 | trace_radeon_vm_bo_update(bo_va); | ||
1182 | |||
1179 | nptes = radeon_bo_ngpu_pages(bo); | 1183 | nptes = radeon_bo_ngpu_pages(bo); |
1180 | 1184 | ||
1181 | /* assume two extra pdes in case the mapping overlaps the borders */ | 1185 | /* assume two extra pdes in case the mapping overlaps the borders */ |
@@ -1257,7 +1261,7 @@ int radeon_vm_bo_rmv(struct radeon_device *rdev, | |||
1257 | mutex_lock(&rdev->vm_manager.lock); | 1261 | mutex_lock(&rdev->vm_manager.lock); |
1258 | mutex_lock(&bo_va->vm->mutex); | 1262 | mutex_lock(&bo_va->vm->mutex); |
1259 | if (bo_va->soffset) { | 1263 | if (bo_va->soffset) { |
1260 | r = radeon_vm_bo_update_pte(rdev, bo_va->vm, bo_va->bo, NULL); | 1264 | r = radeon_vm_bo_update(rdev, bo_va->vm, bo_va->bo, NULL); |
1261 | } | 1265 | } |
1262 | mutex_unlock(&rdev->vm_manager.lock); | 1266 | mutex_unlock(&rdev->vm_manager.lock); |
1263 | list_del(&bo_va->vm_list); | 1267 | list_del(&bo_va->vm_list); |
diff --git a/drivers/gpu/drm/radeon/radeon_pm.c b/drivers/gpu/drm/radeon/radeon_pm.c index d1385ccc672c..984097b907ef 100644 --- a/drivers/gpu/drm/radeon/radeon_pm.c +++ b/drivers/gpu/drm/radeon/radeon_pm.c | |||
@@ -537,8 +537,7 @@ static ssize_t radeon_hwmon_show_temp(struct device *dev, | |||
537 | struct device_attribute *attr, | 537 | struct device_attribute *attr, |
538 | char *buf) | 538 | char *buf) |
539 | { | 539 | { |
540 | struct drm_device *ddev = dev_get_drvdata(dev); | 540 | struct radeon_device *rdev = dev_get_drvdata(dev); |
541 | struct radeon_device *rdev = ddev->dev_private; | ||
542 | int temp; | 541 | int temp; |
543 | 542 | ||
544 | if (rdev->asic->pm.get_temperature) | 543 | if (rdev->asic->pm.get_temperature) |
@@ -553,8 +552,7 @@ static ssize_t radeon_hwmon_show_temp_thresh(struct device *dev, | |||
553 | struct device_attribute *attr, | 552 | struct device_attribute *attr, |
554 | char *buf) | 553 | char *buf) |
555 | { | 554 | { |
556 | struct drm_device *ddev = dev_get_drvdata(dev); | 555 | struct radeon_device *rdev = dev_get_drvdata(dev); |
557 | struct radeon_device *rdev = ddev->dev_private; | ||
558 | int hyst = to_sensor_dev_attr(attr)->index; | 556 | int hyst = to_sensor_dev_attr(attr)->index; |
559 | int temp; | 557 | int temp; |
560 | 558 | ||
@@ -566,23 +564,14 @@ static ssize_t radeon_hwmon_show_temp_thresh(struct device *dev, | |||
566 | return snprintf(buf, PAGE_SIZE, "%d\n", temp); | 564 | return snprintf(buf, PAGE_SIZE, "%d\n", temp); |
567 | } | 565 | } |
568 | 566 | ||
569 | static ssize_t radeon_hwmon_show_name(struct device *dev, | ||
570 | struct device_attribute *attr, | ||
571 | char *buf) | ||
572 | { | ||
573 | return sprintf(buf, "radeon\n"); | ||
574 | } | ||
575 | |||
576 | static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, radeon_hwmon_show_temp, NULL, 0); | 567 | static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, radeon_hwmon_show_temp, NULL, 0); |
577 | static SENSOR_DEVICE_ATTR(temp1_crit, S_IRUGO, radeon_hwmon_show_temp_thresh, NULL, 0); | 568 | static SENSOR_DEVICE_ATTR(temp1_crit, S_IRUGO, radeon_hwmon_show_temp_thresh, NULL, 0); |
578 | static SENSOR_DEVICE_ATTR(temp1_crit_hyst, S_IRUGO, radeon_hwmon_show_temp_thresh, NULL, 1); | 569 | static SENSOR_DEVICE_ATTR(temp1_crit_hyst, S_IRUGO, radeon_hwmon_show_temp_thresh, NULL, 1); |
579 | static SENSOR_DEVICE_ATTR(name, S_IRUGO, radeon_hwmon_show_name, NULL, 0); | ||
580 | 570 | ||
581 | static struct attribute *hwmon_attributes[] = { | 571 | static struct attribute *hwmon_attributes[] = { |
582 | &sensor_dev_attr_temp1_input.dev_attr.attr, | 572 | &sensor_dev_attr_temp1_input.dev_attr.attr, |
583 | &sensor_dev_attr_temp1_crit.dev_attr.attr, | 573 | &sensor_dev_attr_temp1_crit.dev_attr.attr, |
584 | &sensor_dev_attr_temp1_crit_hyst.dev_attr.attr, | 574 | &sensor_dev_attr_temp1_crit_hyst.dev_attr.attr, |
585 | &sensor_dev_attr_name.dev_attr.attr, | ||
586 | NULL | 575 | NULL |
587 | }; | 576 | }; |
588 | 577 | ||
@@ -590,8 +579,7 @@ static umode_t hwmon_attributes_visible(struct kobject *kobj, | |||
590 | struct attribute *attr, int index) | 579 | struct attribute *attr, int index) |
591 | { | 580 | { |
592 | struct device *dev = container_of(kobj, struct device, kobj); | 581 | struct device *dev = container_of(kobj, struct device, kobj); |
593 | struct drm_device *ddev = dev_get_drvdata(dev); | 582 | struct radeon_device *rdev = dev_get_drvdata(dev); |
594 | struct radeon_device *rdev = ddev->dev_private; | ||
595 | 583 | ||
596 | /* Skip limit attributes if DPM is not enabled */ | 584 | /* Skip limit attributes if DPM is not enabled */ |
597 | if (rdev->pm.pm_method != PM_METHOD_DPM && | 585 | if (rdev->pm.pm_method != PM_METHOD_DPM && |
@@ -607,11 +595,15 @@ static const struct attribute_group hwmon_attrgroup = { | |||
607 | .is_visible = hwmon_attributes_visible, | 595 | .is_visible = hwmon_attributes_visible, |
608 | }; | 596 | }; |
609 | 597 | ||
598 | static const struct attribute_group *hwmon_groups[] = { | ||
599 | &hwmon_attrgroup, | ||
600 | NULL | ||
601 | }; | ||
602 | |||
610 | static int radeon_hwmon_init(struct radeon_device *rdev) | 603 | static int radeon_hwmon_init(struct radeon_device *rdev) |
611 | { | 604 | { |
612 | int err = 0; | 605 | int err = 0; |
613 | 606 | struct device *hwmon_dev; | |
614 | rdev->pm.int_hwmon_dev = NULL; | ||
615 | 607 | ||
616 | switch (rdev->pm.int_thermal_type) { | 608 | switch (rdev->pm.int_thermal_type) { |
617 | case THERMAL_TYPE_RV6XX: | 609 | case THERMAL_TYPE_RV6XX: |
@@ -624,20 +616,13 @@ static int radeon_hwmon_init(struct radeon_device *rdev) | |||
624 | case THERMAL_TYPE_KV: | 616 | case THERMAL_TYPE_KV: |
625 | if (rdev->asic->pm.get_temperature == NULL) | 617 | if (rdev->asic->pm.get_temperature == NULL) |
626 | return err; | 618 | return err; |
627 | rdev->pm.int_hwmon_dev = hwmon_device_register(rdev->dev); | 619 | hwmon_dev = hwmon_device_register_with_groups(rdev->dev, |
628 | if (IS_ERR(rdev->pm.int_hwmon_dev)) { | 620 | "radeon", rdev, |
629 | err = PTR_ERR(rdev->pm.int_hwmon_dev); | 621 | hwmon_groups); |
622 | if (IS_ERR(hwmon_dev)) { | ||
623 | err = PTR_ERR(hwmon_dev); | ||
630 | dev_err(rdev->dev, | 624 | dev_err(rdev->dev, |
631 | "Unable to register hwmon device: %d\n", err); | 625 | "Unable to register hwmon device: %d\n", err); |
632 | break; | ||
633 | } | ||
634 | dev_set_drvdata(rdev->pm.int_hwmon_dev, rdev->ddev); | ||
635 | err = sysfs_create_group(&rdev->pm.int_hwmon_dev->kobj, | ||
636 | &hwmon_attrgroup); | ||
637 | if (err) { | ||
638 | dev_err(rdev->dev, | ||
639 | "Unable to create hwmon sysfs file: %d\n", err); | ||
640 | hwmon_device_unregister(rdev->dev); | ||
641 | } | 626 | } |
642 | break; | 627 | break; |
643 | default: | 628 | default: |
@@ -647,14 +632,6 @@ static int radeon_hwmon_init(struct radeon_device *rdev) | |||
647 | return err; | 632 | return err; |
648 | } | 633 | } |
649 | 634 | ||
650 | static void radeon_hwmon_fini(struct radeon_device *rdev) | ||
651 | { | ||
652 | if (rdev->pm.int_hwmon_dev) { | ||
653 | sysfs_remove_group(&rdev->pm.int_hwmon_dev->kobj, &hwmon_attrgroup); | ||
654 | hwmon_device_unregister(rdev->pm.int_hwmon_dev); | ||
655 | } | ||
656 | } | ||
657 | |||
658 | static void radeon_dpm_thermal_work_handler(struct work_struct *work) | 635 | static void radeon_dpm_thermal_work_handler(struct work_struct *work) |
659 | { | 636 | { |
660 | struct radeon_device *rdev = | 637 | struct radeon_device *rdev = |
@@ -1337,8 +1314,6 @@ static void radeon_pm_fini_old(struct radeon_device *rdev) | |||
1337 | 1314 | ||
1338 | if (rdev->pm.power_state) | 1315 | if (rdev->pm.power_state) |
1339 | kfree(rdev->pm.power_state); | 1316 | kfree(rdev->pm.power_state); |
1340 | |||
1341 | radeon_hwmon_fini(rdev); | ||
1342 | } | 1317 | } |
1343 | 1318 | ||
1344 | static void radeon_pm_fini_dpm(struct radeon_device *rdev) | 1319 | static void radeon_pm_fini_dpm(struct radeon_device *rdev) |
@@ -1358,8 +1333,6 @@ static void radeon_pm_fini_dpm(struct radeon_device *rdev) | |||
1358 | 1333 | ||
1359 | if (rdev->pm.power_state) | 1334 | if (rdev->pm.power_state) |
1360 | kfree(rdev->pm.power_state); | 1335 | kfree(rdev->pm.power_state); |
1361 | |||
1362 | radeon_hwmon_fini(rdev); | ||
1363 | } | 1336 | } |
1364 | 1337 | ||
1365 | void radeon_pm_fini(struct radeon_device *rdev) | 1338 | void radeon_pm_fini(struct radeon_device *rdev) |
diff --git a/drivers/gpu/drm/radeon/radeon_trace.h b/drivers/gpu/drm/radeon/radeon_trace.h index 9f0e18172b6e..0473257d4078 100644 --- a/drivers/gpu/drm/radeon/radeon_trace.h +++ b/drivers/gpu/drm/radeon/radeon_trace.h | |||
@@ -47,6 +47,39 @@ TRACE_EVENT(radeon_cs, | |||
47 | __entry->fences) | 47 | __entry->fences) |
48 | ); | 48 | ); |
49 | 49 | ||
50 | TRACE_EVENT(radeon_vm_grab_id, | ||
51 | TP_PROTO(unsigned vmid, int ring), | ||
52 | TP_ARGS(vmid, ring), | ||
53 | TP_STRUCT__entry( | ||
54 | __field(u32, vmid) | ||
55 | __field(u32, ring) | ||
56 | ), | ||
57 | |||
58 | TP_fast_assign( | ||
59 | __entry->vmid = vmid; | ||
60 | __entry->ring = ring; | ||
61 | ), | ||
62 | TP_printk("vmid=%u, ring=%u", __entry->vmid, __entry->ring) | ||
63 | ); | ||
64 | |||
65 | TRACE_EVENT(radeon_vm_bo_update, | ||
66 | TP_PROTO(struct radeon_bo_va *bo_va), | ||
67 | TP_ARGS(bo_va), | ||
68 | TP_STRUCT__entry( | ||
69 | __field(u64, soffset) | ||
70 | __field(u64, eoffset) | ||
71 | __field(u32, flags) | ||
72 | ), | ||
73 | |||
74 | TP_fast_assign( | ||
75 | __entry->soffset = bo_va->soffset; | ||
76 | __entry->eoffset = bo_va->eoffset; | ||
77 | __entry->flags = bo_va->flags; | ||
78 | ), | ||
79 | TP_printk("soffs=%010llx, eoffs=%010llx, flags=%08x", | ||
80 | __entry->soffset, __entry->eoffset, __entry->flags) | ||
81 | ); | ||
82 | |||
50 | TRACE_EVENT(radeon_vm_set_page, | 83 | TRACE_EVENT(radeon_vm_set_page, |
51 | TP_PROTO(uint64_t pe, uint64_t addr, unsigned count, | 84 | TP_PROTO(uint64_t pe, uint64_t addr, unsigned count, |
52 | uint32_t incr, uint32_t flags), | 85 | uint32_t incr, uint32_t flags), |
diff --git a/drivers/gpu/drm/radeon/reg_srcs/cayman b/drivers/gpu/drm/radeon/reg_srcs/cayman index a072fa8c46b0..d46b58d078aa 100644 --- a/drivers/gpu/drm/radeon/reg_srcs/cayman +++ b/drivers/gpu/drm/radeon/reg_srcs/cayman | |||
@@ -21,7 +21,7 @@ cayman 0x9400 | |||
21 | 0x000089AC VGT_COMPUTE_THREAD_GOURP_SIZE | 21 | 0x000089AC VGT_COMPUTE_THREAD_GOURP_SIZE |
22 | 0x000089B0 VGT_HS_OFFCHIP_PARAM | 22 | 0x000089B0 VGT_HS_OFFCHIP_PARAM |
23 | 0x00008A14 PA_CL_ENHANCE | 23 | 0x00008A14 PA_CL_ENHANCE |
24 | 0x00008A60 PA_SC_LINE_STIPPLE_VALUE | 24 | 0x00008A60 PA_SU_LINE_STIPPLE_VALUE |
25 | 0x00008B10 PA_SC_LINE_STIPPLE_STATE | 25 | 0x00008B10 PA_SC_LINE_STIPPLE_STATE |
26 | 0x00008BF0 PA_SC_ENHANCE | 26 | 0x00008BF0 PA_SC_ENHANCE |
27 | 0x00008D8C SQ_DYN_GPR_CNTL_PS_FLUSH_REQ | 27 | 0x00008D8C SQ_DYN_GPR_CNTL_PS_FLUSH_REQ |
@@ -532,7 +532,7 @@ cayman 0x9400 | |||
532 | 0x00028B84 PA_SU_POLY_OFFSET_FRONT_OFFSET | 532 | 0x00028B84 PA_SU_POLY_OFFSET_FRONT_OFFSET |
533 | 0x00028B88 PA_SU_POLY_OFFSET_BACK_SCALE | 533 | 0x00028B88 PA_SU_POLY_OFFSET_BACK_SCALE |
534 | 0x00028B8C PA_SU_POLY_OFFSET_BACK_OFFSET | 534 | 0x00028B8C PA_SU_POLY_OFFSET_BACK_OFFSET |
535 | 0x00028B74 VGT_GS_INSTANCE_CNT | 535 | 0x00028B90 VGT_GS_INSTANCE_CNT |
536 | 0x00028BD4 PA_SC_CENTROID_PRIORITY_0 | 536 | 0x00028BD4 PA_SC_CENTROID_PRIORITY_0 |
537 | 0x00028BD8 PA_SC_CENTROID_PRIORITY_1 | 537 | 0x00028BD8 PA_SC_CENTROID_PRIORITY_1 |
538 | 0x00028BDC PA_SC_LINE_CNTL | 538 | 0x00028BDC PA_SC_LINE_CNTL |
diff --git a/drivers/gpu/drm/radeon/reg_srcs/evergreen b/drivers/gpu/drm/radeon/reg_srcs/evergreen index b912a37689bf..57745c8761c8 100644 --- a/drivers/gpu/drm/radeon/reg_srcs/evergreen +++ b/drivers/gpu/drm/radeon/reg_srcs/evergreen | |||
@@ -22,7 +22,7 @@ evergreen 0x9400 | |||
22 | 0x000089A4 VGT_COMPUTE_START_Z | 22 | 0x000089A4 VGT_COMPUTE_START_Z |
23 | 0x000089AC VGT_COMPUTE_THREAD_GOURP_SIZE | 23 | 0x000089AC VGT_COMPUTE_THREAD_GOURP_SIZE |
24 | 0x00008A14 PA_CL_ENHANCE | 24 | 0x00008A14 PA_CL_ENHANCE |
25 | 0x00008A60 PA_SC_LINE_STIPPLE_VALUE | 25 | 0x00008A60 PA_SU_LINE_STIPPLE_VALUE |
26 | 0x00008B10 PA_SC_LINE_STIPPLE_STATE | 26 | 0x00008B10 PA_SC_LINE_STIPPLE_STATE |
27 | 0x00008BF0 PA_SC_ENHANCE | 27 | 0x00008BF0 PA_SC_ENHANCE |
28 | 0x00008D8C SQ_DYN_GPR_CNTL_PS_FLUSH_REQ | 28 | 0x00008D8C SQ_DYN_GPR_CNTL_PS_FLUSH_REQ |
@@ -545,7 +545,7 @@ evergreen 0x9400 | |||
545 | 0x00028B84 PA_SU_POLY_OFFSET_FRONT_OFFSET | 545 | 0x00028B84 PA_SU_POLY_OFFSET_FRONT_OFFSET |
546 | 0x00028B88 PA_SU_POLY_OFFSET_BACK_SCALE | 546 | 0x00028B88 PA_SU_POLY_OFFSET_BACK_SCALE |
547 | 0x00028B8C PA_SU_POLY_OFFSET_BACK_OFFSET | 547 | 0x00028B8C PA_SU_POLY_OFFSET_BACK_OFFSET |
548 | 0x00028B74 VGT_GS_INSTANCE_CNT | 548 | 0x00028B90 VGT_GS_INSTANCE_CNT |
549 | 0x00028C00 PA_SC_LINE_CNTL | 549 | 0x00028C00 PA_SC_LINE_CNTL |
550 | 0x00028C08 PA_SU_VTX_CNTL | 550 | 0x00028C08 PA_SU_VTX_CNTL |
551 | 0x00028C0C PA_CL_GB_VERT_CLIP_ADJ | 551 | 0x00028C0C PA_CL_GB_VERT_CLIP_ADJ |
diff --git a/drivers/gpu/drm/radeon/si.c b/drivers/gpu/drm/radeon/si.c index 6a64ccaa0695..a36736dab5e0 100644 --- a/drivers/gpu/drm/radeon/si.c +++ b/drivers/gpu/drm/radeon/si.c | |||
@@ -3882,8 +3882,15 @@ static int si_mc_init(struct radeon_device *rdev) | |||
3882 | rdev->mc.aper_base = pci_resource_start(rdev->pdev, 0); | 3882 | rdev->mc.aper_base = pci_resource_start(rdev->pdev, 0); |
3883 | rdev->mc.aper_size = pci_resource_len(rdev->pdev, 0); | 3883 | rdev->mc.aper_size = pci_resource_len(rdev->pdev, 0); |
3884 | /* size in MB on si */ | 3884 | /* size in MB on si */ |
3885 | rdev->mc.mc_vram_size = RREG32(CONFIG_MEMSIZE) * 1024ULL * 1024ULL; | 3885 | tmp = RREG32(CONFIG_MEMSIZE); |
3886 | rdev->mc.real_vram_size = RREG32(CONFIG_MEMSIZE) * 1024ULL * 1024ULL; | 3886 | /* some boards may have garbage in the upper 16 bits */ |
3887 | if (tmp & 0xffff0000) { | ||
3888 | DRM_INFO("Probable bad vram size: 0x%08x\n", tmp); | ||
3889 | if (tmp & 0xffff) | ||
3890 | tmp &= 0xffff; | ||
3891 | } | ||
3892 | rdev->mc.mc_vram_size = tmp * 1024ULL * 1024ULL; | ||
3893 | rdev->mc.real_vram_size = rdev->mc.mc_vram_size; | ||
3887 | rdev->mc.visible_vram_size = rdev->mc.aper_size; | 3894 | rdev->mc.visible_vram_size = rdev->mc.aper_size; |
3888 | si_vram_gtt_location(rdev, &rdev->mc); | 3895 | si_vram_gtt_location(rdev, &rdev->mc); |
3889 | radeon_update_bandwidth_info(rdev); | 3896 | radeon_update_bandwidth_info(rdev); |
diff --git a/drivers/gpu/drm/tegra/drm.c b/drivers/gpu/drm/tegra/drm.c index 28e178137718..07eba596d458 100644 --- a/drivers/gpu/drm/tegra/drm.c +++ b/drivers/gpu/drm/tegra/drm.c | |||
@@ -135,11 +135,11 @@ int tegra_drm_submit(struct tegra_drm_context *context, | |||
135 | unsigned int num_relocs = args->num_relocs; | 135 | unsigned int num_relocs = args->num_relocs; |
136 | unsigned int num_waitchks = args->num_waitchks; | 136 | unsigned int num_waitchks = args->num_waitchks; |
137 | struct drm_tegra_cmdbuf __user *cmdbufs = | 137 | struct drm_tegra_cmdbuf __user *cmdbufs = |
138 | (void * __user)(uintptr_t)args->cmdbufs; | 138 | (void __user *)(uintptr_t)args->cmdbufs; |
139 | struct drm_tegra_reloc __user *relocs = | 139 | struct drm_tegra_reloc __user *relocs = |
140 | (void * __user)(uintptr_t)args->relocs; | 140 | (void __user *)(uintptr_t)args->relocs; |
141 | struct drm_tegra_waitchk __user *waitchks = | 141 | struct drm_tegra_waitchk __user *waitchks = |
142 | (void * __user)(uintptr_t)args->waitchks; | 142 | (void __user *)(uintptr_t)args->waitchks; |
143 | struct drm_tegra_syncpt syncpt; | 143 | struct drm_tegra_syncpt syncpt; |
144 | struct host1x_job *job; | 144 | struct host1x_job *job; |
145 | int err; | 145 | int err; |
@@ -163,9 +163,10 @@ int tegra_drm_submit(struct tegra_drm_context *context, | |||
163 | struct drm_tegra_cmdbuf cmdbuf; | 163 | struct drm_tegra_cmdbuf cmdbuf; |
164 | struct host1x_bo *bo; | 164 | struct host1x_bo *bo; |
165 | 165 | ||
166 | err = copy_from_user(&cmdbuf, cmdbufs, sizeof(cmdbuf)); | 166 | if (copy_from_user(&cmdbuf, cmdbufs, sizeof(cmdbuf))) { |
167 | if (err) | 167 | err = -EFAULT; |
168 | goto fail; | 168 | goto fail; |
169 | } | ||
169 | 170 | ||
170 | bo = host1x_bo_lookup(drm, file, cmdbuf.handle); | 171 | bo = host1x_bo_lookup(drm, file, cmdbuf.handle); |
171 | if (!bo) { | 172 | if (!bo) { |
@@ -178,10 +179,11 @@ int tegra_drm_submit(struct tegra_drm_context *context, | |||
178 | cmdbufs++; | 179 | cmdbufs++; |
179 | } | 180 | } |
180 | 181 | ||
181 | err = copy_from_user(job->relocarray, relocs, | 182 | if (copy_from_user(job->relocarray, relocs, |
182 | sizeof(*relocs) * num_relocs); | 183 | sizeof(*relocs) * num_relocs)) { |
183 | if (err) | 184 | err = -EFAULT; |
184 | goto fail; | 185 | goto fail; |
186 | } | ||
185 | 187 | ||
186 | while (num_relocs--) { | 188 | while (num_relocs--) { |
187 | struct host1x_reloc *reloc = &job->relocarray[num_relocs]; | 189 | struct host1x_reloc *reloc = &job->relocarray[num_relocs]; |
@@ -199,15 +201,17 @@ int tegra_drm_submit(struct tegra_drm_context *context, | |||
199 | } | 201 | } |
200 | } | 202 | } |
201 | 203 | ||
202 | err = copy_from_user(job->waitchk, waitchks, | 204 | if (copy_from_user(job->waitchk, waitchks, |
203 | sizeof(*waitchks) * num_waitchks); | 205 | sizeof(*waitchks) * num_waitchks)) { |
204 | if (err) | 206 | err = -EFAULT; |
205 | goto fail; | 207 | goto fail; |
208 | } | ||
206 | 209 | ||
207 | err = copy_from_user(&syncpt, (void * __user)(uintptr_t)args->syncpts, | 210 | if (copy_from_user(&syncpt, (void __user *)(uintptr_t)args->syncpts, |
208 | sizeof(syncpt)); | 211 | sizeof(syncpt))) { |
209 | if (err) | 212 | err = -EFAULT; |
210 | goto fail; | 213 | goto fail; |
214 | } | ||
211 | 215 | ||
212 | job->is_addr_reg = context->client->ops->is_addr_reg; | 216 | job->is_addr_reg = context->client->ops->is_addr_reg; |
213 | job->syncpt_incrs = syncpt.incrs; | 217 | job->syncpt_incrs = syncpt.incrs; |
@@ -573,7 +577,7 @@ static void tegra_debugfs_cleanup(struct drm_minor *minor) | |||
573 | } | 577 | } |
574 | #endif | 578 | #endif |
575 | 579 | ||
576 | struct drm_driver tegra_drm_driver = { | 580 | static struct drm_driver tegra_drm_driver = { |
577 | .driver_features = DRIVER_MODESET | DRIVER_GEM, | 581 | .driver_features = DRIVER_MODESET | DRIVER_GEM, |
578 | .load = tegra_drm_load, | 582 | .load = tegra_drm_load, |
579 | .unload = tegra_drm_unload, | 583 | .unload = tegra_drm_unload, |
diff --git a/drivers/gpu/drm/tegra/drm.h b/drivers/gpu/drm/tegra/drm.h index fdfe259ed7f8..7da0b923131f 100644 --- a/drivers/gpu/drm/tegra/drm.h +++ b/drivers/gpu/drm/tegra/drm.h | |||
@@ -116,7 +116,7 @@ host1x_client_to_dc(struct host1x_client *client) | |||
116 | 116 | ||
117 | static inline struct tegra_dc *to_tegra_dc(struct drm_crtc *crtc) | 117 | static inline struct tegra_dc *to_tegra_dc(struct drm_crtc *crtc) |
118 | { | 118 | { |
119 | return container_of(crtc, struct tegra_dc, base); | 119 | return crtc ? container_of(crtc, struct tegra_dc, base) : NULL; |
120 | } | 120 | } |
121 | 121 | ||
122 | static inline void tegra_dc_writel(struct tegra_dc *dc, unsigned long value, | 122 | static inline void tegra_dc_writel(struct tegra_dc *dc, unsigned long value, |
diff --git a/drivers/gpu/drm/tegra/fb.c b/drivers/gpu/drm/tegra/fb.c index 490f7719e317..a3835e7de184 100644 --- a/drivers/gpu/drm/tegra/fb.c +++ b/drivers/gpu/drm/tegra/fb.c | |||
@@ -247,7 +247,7 @@ static int tegra_fbdev_probe(struct drm_fb_helper *helper, | |||
247 | info->var.yoffset * fb->pitches[0]; | 247 | info->var.yoffset * fb->pitches[0]; |
248 | 248 | ||
249 | drm->mode_config.fb_base = (resource_size_t)bo->paddr; | 249 | drm->mode_config.fb_base = (resource_size_t)bo->paddr; |
250 | info->screen_base = bo->vaddr + offset; | 250 | info->screen_base = (void __iomem *)bo->vaddr + offset; |
251 | info->screen_size = size; | 251 | info->screen_size = size; |
252 | info->fix.smem_start = (unsigned long)(bo->paddr + offset); | 252 | info->fix.smem_start = (unsigned long)(bo->paddr + offset); |
253 | info->fix.smem_len = size; | 253 | info->fix.smem_len = size; |
diff --git a/drivers/gpu/drm/tegra/rgb.c b/drivers/gpu/drm/tegra/rgb.c index ba47ca4fb880..3b29018913a5 100644 --- a/drivers/gpu/drm/tegra/rgb.c +++ b/drivers/gpu/drm/tegra/rgb.c | |||
@@ -14,6 +14,8 @@ | |||
14 | 14 | ||
15 | struct tegra_rgb { | 15 | struct tegra_rgb { |
16 | struct tegra_output output; | 16 | struct tegra_output output; |
17 | struct tegra_dc *dc; | ||
18 | |||
17 | struct clk *clk_parent; | 19 | struct clk *clk_parent; |
18 | struct clk *clk; | 20 | struct clk *clk; |
19 | }; | 21 | }; |
@@ -84,18 +86,18 @@ static void tegra_dc_write_regs(struct tegra_dc *dc, | |||
84 | 86 | ||
85 | static int tegra_output_rgb_enable(struct tegra_output *output) | 87 | static int tegra_output_rgb_enable(struct tegra_output *output) |
86 | { | 88 | { |
87 | struct tegra_dc *dc = to_tegra_dc(output->encoder.crtc); | 89 | struct tegra_rgb *rgb = to_rgb(output); |
88 | 90 | ||
89 | tegra_dc_write_regs(dc, rgb_enable, ARRAY_SIZE(rgb_enable)); | 91 | tegra_dc_write_regs(rgb->dc, rgb_enable, ARRAY_SIZE(rgb_enable)); |
90 | 92 | ||
91 | return 0; | 93 | return 0; |
92 | } | 94 | } |
93 | 95 | ||
94 | static int tegra_output_rgb_disable(struct tegra_output *output) | 96 | static int tegra_output_rgb_disable(struct tegra_output *output) |
95 | { | 97 | { |
96 | struct tegra_dc *dc = to_tegra_dc(output->encoder.crtc); | 98 | struct tegra_rgb *rgb = to_rgb(output); |
97 | 99 | ||
98 | tegra_dc_write_regs(dc, rgb_disable, ARRAY_SIZE(rgb_disable)); | 100 | tegra_dc_write_regs(rgb->dc, rgb_disable, ARRAY_SIZE(rgb_disable)); |
99 | 101 | ||
100 | return 0; | 102 | return 0; |
101 | } | 103 | } |
@@ -146,6 +148,7 @@ int tegra_dc_rgb_probe(struct tegra_dc *dc) | |||
146 | 148 | ||
147 | rgb->output.dev = dc->dev; | 149 | rgb->output.dev = dc->dev; |
148 | rgb->output.of_node = np; | 150 | rgb->output.of_node = np; |
151 | rgb->dc = dc; | ||
149 | 152 | ||
150 | err = tegra_output_probe(&rgb->output); | 153 | err = tegra_output_probe(&rgb->output); |
151 | if (err < 0) | 154 | if (err < 0) |
diff --git a/drivers/gpu/drm/udl/udl_gem.c b/drivers/gpu/drm/udl/udl_gem.c index 24ffbe990736..8d67b943ac05 100644 --- a/drivers/gpu/drm/udl/udl_gem.c +++ b/drivers/gpu/drm/udl/udl_gem.c | |||
@@ -125,6 +125,12 @@ static int udl_gem_get_pages(struct udl_gem_object *obj, gfp_t gfpmask) | |||
125 | 125 | ||
126 | static void udl_gem_put_pages(struct udl_gem_object *obj) | 126 | static void udl_gem_put_pages(struct udl_gem_object *obj) |
127 | { | 127 | { |
128 | if (obj->base.import_attach) { | ||
129 | drm_free_large(obj->pages); | ||
130 | obj->pages = NULL; | ||
131 | return; | ||
132 | } | ||
133 | |||
128 | drm_gem_put_pages(&obj->base, obj->pages, false, false); | 134 | drm_gem_put_pages(&obj->base, obj->pages, false, false); |
129 | obj->pages = NULL; | 135 | obj->pages = NULL; |
130 | } | 136 | } |
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_buffer.c b/drivers/gpu/drm/vmwgfx/vmwgfx_buffer.c index 7776e6f0aef6..0489c6152482 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_buffer.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_buffer.c | |||
@@ -150,6 +150,8 @@ struct vmw_ttm_tt { | |||
150 | bool mapped; | 150 | bool mapped; |
151 | }; | 151 | }; |
152 | 152 | ||
153 | const size_t vmw_tt_size = sizeof(struct vmw_ttm_tt); | ||
154 | |||
153 | /** | 155 | /** |
154 | * Helper functions to advance a struct vmw_piter iterator. | 156 | * Helper functions to advance a struct vmw_piter iterator. |
155 | * | 157 | * |
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h index db85985c7086..20890ad8408b 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h | |||
@@ -615,6 +615,7 @@ extern int vmw_mmap(struct file *filp, struct vm_area_struct *vma); | |||
615 | * TTM buffer object driver - vmwgfx_buffer.c | 615 | * TTM buffer object driver - vmwgfx_buffer.c |
616 | */ | 616 | */ |
617 | 617 | ||
618 | extern const size_t vmw_tt_size; | ||
618 | extern struct ttm_placement vmw_vram_placement; | 619 | extern struct ttm_placement vmw_vram_placement; |
619 | extern struct ttm_placement vmw_vram_ne_placement; | 620 | extern struct ttm_placement vmw_vram_ne_placement; |
620 | extern struct ttm_placement vmw_vram_sys_placement; | 621 | extern struct ttm_placement vmw_vram_sys_placement; |
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c index ecb3d867b426..03f1c2038631 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c | |||
@@ -75,6 +75,7 @@ void vmw_display_unit_cleanup(struct vmw_display_unit *du) | |||
75 | vmw_surface_unreference(&du->cursor_surface); | 75 | vmw_surface_unreference(&du->cursor_surface); |
76 | if (du->cursor_dmabuf) | 76 | if (du->cursor_dmabuf) |
77 | vmw_dmabuf_unreference(&du->cursor_dmabuf); | 77 | vmw_dmabuf_unreference(&du->cursor_dmabuf); |
78 | drm_sysfs_connector_remove(&du->connector); | ||
78 | drm_crtc_cleanup(&du->crtc); | 79 | drm_crtc_cleanup(&du->crtc); |
79 | drm_encoder_cleanup(&du->encoder); | 80 | drm_encoder_cleanup(&du->encoder); |
80 | drm_connector_cleanup(&du->connector); | 81 | drm_connector_cleanup(&du->connector); |
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c b/drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c index 79f7e8e60529..a055a26819c2 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c | |||
@@ -260,6 +260,7 @@ static int vmw_ldu_crtc_set_config(struct drm_mode_set *set) | |||
260 | connector->encoder = NULL; | 260 | connector->encoder = NULL; |
261 | encoder->crtc = NULL; | 261 | encoder->crtc = NULL; |
262 | crtc->fb = NULL; | 262 | crtc->fb = NULL; |
263 | crtc->enabled = false; | ||
263 | 264 | ||
264 | vmw_ldu_del_active(dev_priv, ldu); | 265 | vmw_ldu_del_active(dev_priv, ldu); |
265 | 266 | ||
@@ -285,6 +286,7 @@ static int vmw_ldu_crtc_set_config(struct drm_mode_set *set) | |||
285 | crtc->x = set->x; | 286 | crtc->x = set->x; |
286 | crtc->y = set->y; | 287 | crtc->y = set->y; |
287 | crtc->mode = *mode; | 288 | crtc->mode = *mode; |
289 | crtc->enabled = true; | ||
288 | 290 | ||
289 | vmw_ldu_add_active(dev_priv, ldu, vfb); | 291 | vmw_ldu_add_active(dev_priv, ldu, vfb); |
290 | 292 | ||
@@ -369,6 +371,8 @@ static int vmw_ldu_init(struct vmw_private *dev_priv, unsigned unit) | |||
369 | encoder->possible_crtcs = (1 << unit); | 371 | encoder->possible_crtcs = (1 << unit); |
370 | encoder->possible_clones = 0; | 372 | encoder->possible_clones = 0; |
371 | 373 | ||
374 | (void) drm_sysfs_connector_add(connector); | ||
375 | |||
372 | drm_crtc_init(dev, crtc, &vmw_legacy_crtc_funcs); | 376 | drm_crtc_init(dev, crtc, &vmw_legacy_crtc_funcs); |
373 | 377 | ||
374 | drm_mode_crtc_set_gamma_size(crtc, 256); | 378 | drm_mode_crtc_set_gamma_size(crtc, 256); |
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_resource.c b/drivers/gpu/drm/vmwgfx/vmwgfx_resource.c index efe2b74c5eb1..9b5ea2ac7ddf 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_resource.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_resource.c | |||
@@ -352,6 +352,38 @@ int vmw_user_lookup_handle(struct vmw_private *dev_priv, | |||
352 | /** | 352 | /** |
353 | * Buffer management. | 353 | * Buffer management. |
354 | */ | 354 | */ |
355 | |||
356 | /** | ||
357 | * vmw_dmabuf_acc_size - Calculate the pinned memory usage of buffers | ||
358 | * | ||
359 | * @dev_priv: Pointer to a struct vmw_private identifying the device. | ||
360 | * @size: The requested buffer size. | ||
361 | * @user: Whether this is an ordinary dma buffer or a user dma buffer. | ||
362 | */ | ||
363 | static size_t vmw_dmabuf_acc_size(struct vmw_private *dev_priv, size_t size, | ||
364 | bool user) | ||
365 | { | ||
366 | static size_t struct_size, user_struct_size; | ||
367 | size_t num_pages = PAGE_ALIGN(size) >> PAGE_SHIFT; | ||
368 | size_t page_array_size = ttm_round_pot(num_pages * sizeof(void *)); | ||
369 | |||
370 | if (unlikely(struct_size == 0)) { | ||
371 | size_t backend_size = ttm_round_pot(vmw_tt_size); | ||
372 | |||
373 | struct_size = backend_size + | ||
374 | ttm_round_pot(sizeof(struct vmw_dma_buffer)); | ||
375 | user_struct_size = backend_size + | ||
376 | ttm_round_pot(sizeof(struct vmw_user_dma_buffer)); | ||
377 | } | ||
378 | |||
379 | if (dev_priv->map_mode == vmw_dma_alloc_coherent) | ||
380 | page_array_size += | ||
381 | ttm_round_pot(num_pages * sizeof(dma_addr_t)); | ||
382 | |||
383 | return ((user) ? user_struct_size : struct_size) + | ||
384 | page_array_size; | ||
385 | } | ||
386 | |||
355 | void vmw_dmabuf_bo_free(struct ttm_buffer_object *bo) | 387 | void vmw_dmabuf_bo_free(struct ttm_buffer_object *bo) |
356 | { | 388 | { |
357 | struct vmw_dma_buffer *vmw_bo = vmw_dma_buffer(bo); | 389 | struct vmw_dma_buffer *vmw_bo = vmw_dma_buffer(bo); |
@@ -359,6 +391,13 @@ void vmw_dmabuf_bo_free(struct ttm_buffer_object *bo) | |||
359 | kfree(vmw_bo); | 391 | kfree(vmw_bo); |
360 | } | 392 | } |
361 | 393 | ||
394 | static void vmw_user_dmabuf_destroy(struct ttm_buffer_object *bo) | ||
395 | { | ||
396 | struct vmw_user_dma_buffer *vmw_user_bo = vmw_user_dma_buffer(bo); | ||
397 | |||
398 | ttm_prime_object_kfree(vmw_user_bo, prime); | ||
399 | } | ||
400 | |||
362 | int vmw_dmabuf_init(struct vmw_private *dev_priv, | 401 | int vmw_dmabuf_init(struct vmw_private *dev_priv, |
363 | struct vmw_dma_buffer *vmw_bo, | 402 | struct vmw_dma_buffer *vmw_bo, |
364 | size_t size, struct ttm_placement *placement, | 403 | size_t size, struct ttm_placement *placement, |
@@ -368,28 +407,23 @@ int vmw_dmabuf_init(struct vmw_private *dev_priv, | |||
368 | struct ttm_bo_device *bdev = &dev_priv->bdev; | 407 | struct ttm_bo_device *bdev = &dev_priv->bdev; |
369 | size_t acc_size; | 408 | size_t acc_size; |
370 | int ret; | 409 | int ret; |
410 | bool user = (bo_free == &vmw_user_dmabuf_destroy); | ||
371 | 411 | ||
372 | BUG_ON(!bo_free); | 412 | BUG_ON(!bo_free && (!user && (bo_free != vmw_dmabuf_bo_free))); |
373 | 413 | ||
374 | acc_size = ttm_bo_acc_size(bdev, size, sizeof(struct vmw_dma_buffer)); | 414 | acc_size = vmw_dmabuf_acc_size(dev_priv, size, user); |
375 | memset(vmw_bo, 0, sizeof(*vmw_bo)); | 415 | memset(vmw_bo, 0, sizeof(*vmw_bo)); |
376 | 416 | ||
377 | INIT_LIST_HEAD(&vmw_bo->res_list); | 417 | INIT_LIST_HEAD(&vmw_bo->res_list); |
378 | 418 | ||
379 | ret = ttm_bo_init(bdev, &vmw_bo->base, size, | 419 | ret = ttm_bo_init(bdev, &vmw_bo->base, size, |
380 | ttm_bo_type_device, placement, | 420 | (user) ? ttm_bo_type_device : |
421 | ttm_bo_type_kernel, placement, | ||
381 | 0, interruptible, | 422 | 0, interruptible, |
382 | NULL, acc_size, NULL, bo_free); | 423 | NULL, acc_size, NULL, bo_free); |
383 | return ret; | 424 | return ret; |
384 | } | 425 | } |
385 | 426 | ||
386 | static void vmw_user_dmabuf_destroy(struct ttm_buffer_object *bo) | ||
387 | { | ||
388 | struct vmw_user_dma_buffer *vmw_user_bo = vmw_user_dma_buffer(bo); | ||
389 | |||
390 | ttm_prime_object_kfree(vmw_user_bo, prime); | ||
391 | } | ||
392 | |||
393 | static void vmw_user_dmabuf_release(struct ttm_base_object **p_base) | 427 | static void vmw_user_dmabuf_release(struct ttm_base_object **p_base) |
394 | { | 428 | { |
395 | struct vmw_user_dma_buffer *vmw_user_bo; | 429 | struct vmw_user_dma_buffer *vmw_user_bo; |
@@ -781,54 +815,55 @@ err_ref: | |||
781 | } | 815 | } |
782 | 816 | ||
783 | 817 | ||
818 | /** | ||
819 | * vmw_dumb_create - Create a dumb kms buffer | ||
820 | * | ||
821 | * @file_priv: Pointer to a struct drm_file identifying the caller. | ||
822 | * @dev: Pointer to the drm device. | ||
823 | * @args: Pointer to a struct drm_mode_create_dumb structure | ||
824 | * | ||
825 | * This is a driver callback for the core drm create_dumb functionality. | ||
826 | * Note that this is very similar to the vmw_dmabuf_alloc ioctl, except | ||
827 | * that the arguments have a different format. | ||
828 | */ | ||
784 | int vmw_dumb_create(struct drm_file *file_priv, | 829 | int vmw_dumb_create(struct drm_file *file_priv, |
785 | struct drm_device *dev, | 830 | struct drm_device *dev, |
786 | struct drm_mode_create_dumb *args) | 831 | struct drm_mode_create_dumb *args) |
787 | { | 832 | { |
788 | struct vmw_private *dev_priv = vmw_priv(dev); | 833 | struct vmw_private *dev_priv = vmw_priv(dev); |
789 | struct vmw_master *vmaster = vmw_master(file_priv->master); | 834 | struct vmw_master *vmaster = vmw_master(file_priv->master); |
790 | struct vmw_user_dma_buffer *vmw_user_bo; | 835 | struct vmw_dma_buffer *dma_buf; |
791 | struct ttm_buffer_object *tmp; | ||
792 | int ret; | 836 | int ret; |
793 | 837 | ||
794 | args->pitch = args->width * ((args->bpp + 7) / 8); | 838 | args->pitch = args->width * ((args->bpp + 7) / 8); |
795 | args->size = args->pitch * args->height; | 839 | args->size = args->pitch * args->height; |
796 | 840 | ||
797 | vmw_user_bo = kzalloc(sizeof(*vmw_user_bo), GFP_KERNEL); | ||
798 | if (vmw_user_bo == NULL) | ||
799 | return -ENOMEM; | ||
800 | |||
801 | ret = ttm_read_lock(&vmaster->lock, true); | 841 | ret = ttm_read_lock(&vmaster->lock, true); |
802 | if (ret != 0) { | 842 | if (unlikely(ret != 0)) |
803 | kfree(vmw_user_bo); | ||
804 | return ret; | 843 | return ret; |
805 | } | ||
806 | 844 | ||
807 | ret = vmw_dmabuf_init(dev_priv, &vmw_user_bo->dma, args->size, | 845 | ret = vmw_user_dmabuf_alloc(dev_priv, vmw_fpriv(file_priv)->tfile, |
808 | &vmw_vram_sys_placement, true, | 846 | args->size, false, &args->handle, |
809 | &vmw_user_dmabuf_destroy); | 847 | &dma_buf); |
810 | if (ret != 0) | ||
811 | goto out_no_dmabuf; | ||
812 | |||
813 | tmp = ttm_bo_reference(&vmw_user_bo->dma.base); | ||
814 | ret = ttm_prime_object_init(vmw_fpriv(file_priv)->tfile, | ||
815 | args->size, | ||
816 | &vmw_user_bo->prime, | ||
817 | false, | ||
818 | ttm_buffer_type, | ||
819 | &vmw_user_dmabuf_release, NULL); | ||
820 | if (unlikely(ret != 0)) | 848 | if (unlikely(ret != 0)) |
821 | goto out_no_base_object; | 849 | goto out_no_dmabuf; |
822 | |||
823 | args->handle = vmw_user_bo->prime.base.hash.key; | ||
824 | 850 | ||
825 | out_no_base_object: | 851 | vmw_dmabuf_unreference(&dma_buf); |
826 | ttm_bo_unref(&tmp); | ||
827 | out_no_dmabuf: | 852 | out_no_dmabuf: |
828 | ttm_read_unlock(&vmaster->lock); | 853 | ttm_read_unlock(&vmaster->lock); |
829 | return ret; | 854 | return ret; |
830 | } | 855 | } |
831 | 856 | ||
857 | /** | ||
858 | * vmw_dumb_map_offset - Return the address space offset of a dumb buffer | ||
859 | * | ||
860 | * @file_priv: Pointer to a struct drm_file identifying the caller. | ||
861 | * @dev: Pointer to the drm device. | ||
862 | * @handle: Handle identifying the dumb buffer. | ||
863 | * @offset: The address space offset returned. | ||
864 | * | ||
865 | * This is a driver callback for the core drm dumb_map_offset functionality. | ||
866 | */ | ||
832 | int vmw_dumb_map_offset(struct drm_file *file_priv, | 867 | int vmw_dumb_map_offset(struct drm_file *file_priv, |
833 | struct drm_device *dev, uint32_t handle, | 868 | struct drm_device *dev, uint32_t handle, |
834 | uint64_t *offset) | 869 | uint64_t *offset) |
@@ -846,6 +881,15 @@ int vmw_dumb_map_offset(struct drm_file *file_priv, | |||
846 | return 0; | 881 | return 0; |
847 | } | 882 | } |
848 | 883 | ||
884 | /** | ||
885 | * vmw_dumb_destroy - Destroy a dumb boffer | ||
886 | * | ||
887 | * @file_priv: Pointer to a struct drm_file identifying the caller. | ||
888 | * @dev: Pointer to the drm device. | ||
889 | * @handle: Handle identifying the dumb buffer. | ||
890 | * | ||
891 | * This is a driver callback for the core drm dumb_destroy functionality. | ||
892 | */ | ||
849 | int vmw_dumb_destroy(struct drm_file *file_priv, | 893 | int vmw_dumb_destroy(struct drm_file *file_priv, |
850 | struct drm_device *dev, | 894 | struct drm_device *dev, |
851 | uint32_t handle) | 895 | uint32_t handle) |
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c b/drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c index 26387c3d5a21..22406c8651ea 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c | |||
@@ -310,6 +310,7 @@ static int vmw_sou_crtc_set_config(struct drm_mode_set *set) | |||
310 | crtc->fb = NULL; | 310 | crtc->fb = NULL; |
311 | crtc->x = 0; | 311 | crtc->x = 0; |
312 | crtc->y = 0; | 312 | crtc->y = 0; |
313 | crtc->enabled = false; | ||
313 | 314 | ||
314 | vmw_sou_del_active(dev_priv, sou); | 315 | vmw_sou_del_active(dev_priv, sou); |
315 | 316 | ||
@@ -370,6 +371,7 @@ static int vmw_sou_crtc_set_config(struct drm_mode_set *set) | |||
370 | crtc->fb = NULL; | 371 | crtc->fb = NULL; |
371 | crtc->x = 0; | 372 | crtc->x = 0; |
372 | crtc->y = 0; | 373 | crtc->y = 0; |
374 | crtc->enabled = false; | ||
373 | 375 | ||
374 | return ret; | 376 | return ret; |
375 | } | 377 | } |
@@ -382,6 +384,7 @@ static int vmw_sou_crtc_set_config(struct drm_mode_set *set) | |||
382 | crtc->fb = fb; | 384 | crtc->fb = fb; |
383 | crtc->x = set->x; | 385 | crtc->x = set->x; |
384 | crtc->y = set->y; | 386 | crtc->y = set->y; |
387 | crtc->enabled = true; | ||
385 | 388 | ||
386 | return 0; | 389 | return 0; |
387 | } | 390 | } |
@@ -464,6 +467,8 @@ static int vmw_sou_init(struct vmw_private *dev_priv, unsigned unit) | |||
464 | encoder->possible_crtcs = (1 << unit); | 467 | encoder->possible_crtcs = (1 << unit); |
465 | encoder->possible_clones = 0; | 468 | encoder->possible_clones = 0; |
466 | 469 | ||
470 | (void) drm_sysfs_connector_add(connector); | ||
471 | |||
467 | drm_crtc_init(dev, crtc, &vmw_screen_object_crtc_funcs); | 472 | drm_crtc_init(dev, crtc, &vmw_screen_object_crtc_funcs); |
468 | 473 | ||
469 | drm_mode_crtc_set_gamma_size(crtc, 256); | 474 | drm_mode_crtc_set_gamma_size(crtc, 256); |
diff --git a/drivers/gpu/host1x/bus.c b/drivers/gpu/host1x/bus.c index 509383f8be03..6a929591aa73 100644 --- a/drivers/gpu/host1x/bus.c +++ b/drivers/gpu/host1x/bus.c | |||
@@ -19,6 +19,7 @@ | |||
19 | #include <linux/of.h> | 19 | #include <linux/of.h> |
20 | #include <linux/slab.h> | 20 | #include <linux/slab.h> |
21 | 21 | ||
22 | #include "bus.h" | ||
22 | #include "dev.h" | 23 | #include "dev.h" |
23 | 24 | ||
24 | static DEFINE_MUTEX(clients_lock); | 25 | static DEFINE_MUTEX(clients_lock); |
@@ -257,7 +258,7 @@ static int host1x_unregister_client(struct host1x *host1x, | |||
257 | return -ENODEV; | 258 | return -ENODEV; |
258 | } | 259 | } |
259 | 260 | ||
260 | struct bus_type host1x_bus_type = { | 261 | static struct bus_type host1x_bus_type = { |
261 | .name = "host1x", | 262 | .name = "host1x", |
262 | }; | 263 | }; |
263 | 264 | ||
@@ -301,7 +302,7 @@ static int host1x_device_add(struct host1x *host1x, | |||
301 | device->dev.coherent_dma_mask = host1x->dev->coherent_dma_mask; | 302 | device->dev.coherent_dma_mask = host1x->dev->coherent_dma_mask; |
302 | device->dev.dma_mask = &device->dev.coherent_dma_mask; | 303 | device->dev.dma_mask = &device->dev.coherent_dma_mask; |
303 | device->dev.release = host1x_device_release; | 304 | device->dev.release = host1x_device_release; |
304 | dev_set_name(&device->dev, driver->name); | 305 | dev_set_name(&device->dev, "%s", driver->name); |
305 | device->dev.bus = &host1x_bus_type; | 306 | device->dev.bus = &host1x_bus_type; |
306 | device->dev.parent = host1x->dev; | 307 | device->dev.parent = host1x->dev; |
307 | 308 | ||
diff --git a/drivers/gpu/host1x/hw/cdma_hw.c b/drivers/gpu/host1x/hw/cdma_hw.c index 37e2a63241a9..6b09b71940c2 100644 --- a/drivers/gpu/host1x/hw/cdma_hw.c +++ b/drivers/gpu/host1x/hw/cdma_hw.c | |||
@@ -54,8 +54,8 @@ static void cdma_timeout_cpu_incr(struct host1x_cdma *cdma, u32 getptr, | |||
54 | u32 *p = (u32 *)((u32)pb->mapped + getptr); | 54 | u32 *p = (u32 *)((u32)pb->mapped + getptr); |
55 | *(p++) = HOST1X_OPCODE_NOP; | 55 | *(p++) = HOST1X_OPCODE_NOP; |
56 | *(p++) = HOST1X_OPCODE_NOP; | 56 | *(p++) = HOST1X_OPCODE_NOP; |
57 | dev_dbg(host1x->dev, "%s: NOP at 0x%x\n", __func__, | 57 | dev_dbg(host1x->dev, "%s: NOP at %#llx\n", __func__, |
58 | pb->phys + getptr); | 58 | (u64)pb->phys + getptr); |
59 | getptr = (getptr + 8) & (pb->size_bytes - 1); | 59 | getptr = (getptr + 8) & (pb->size_bytes - 1); |
60 | } | 60 | } |
61 | wmb(); | 61 | wmb(); |
diff --git a/drivers/gpu/host1x/hw/debug_hw.c b/drivers/gpu/host1x/hw/debug_hw.c index 640c75ca5a8b..f72c873eff81 100644 --- a/drivers/gpu/host1x/hw/debug_hw.c +++ b/drivers/gpu/host1x/hw/debug_hw.c | |||
@@ -163,8 +163,8 @@ static void show_channel_gathers(struct output *o, struct host1x_cdma *cdma) | |||
163 | continue; | 163 | continue; |
164 | } | 164 | } |
165 | 165 | ||
166 | host1x_debug_output(o, " GATHER at %08x+%04x, %d words\n", | 166 | host1x_debug_output(o, " GATHER at %#llx+%04x, %d words\n", |
167 | g->base, g->offset, g->words); | 167 | (u64)g->base, g->offset, g->words); |
168 | 168 | ||
169 | show_gather(o, g->base + g->offset, g->words, cdma, | 169 | show_gather(o, g->base + g->offset, g->words, cdma, |
170 | g->base, mapped); | 170 | g->base, mapped); |
diff --git a/drivers/hid/hid-kye.c b/drivers/hid/hid-kye.c index ecb5ca669e97..e77696367591 100644 --- a/drivers/hid/hid-kye.c +++ b/drivers/hid/hid-kye.c | |||
@@ -341,6 +341,7 @@ static __u8 *kye_report_fixup(struct hid_device *hdev, __u8 *rdesc, | |||
341 | case USB_DEVICE_ID_GENIUS_GX_IMPERATOR: | 341 | case USB_DEVICE_ID_GENIUS_GX_IMPERATOR: |
342 | rdesc = kye_consumer_control_fixup(hdev, rdesc, rsize, 83, | 342 | rdesc = kye_consumer_control_fixup(hdev, rdesc, rsize, 83, |
343 | "Genius Gx Imperator Keyboard"); | 343 | "Genius Gx Imperator Keyboard"); |
344 | break; | ||
344 | case USB_DEVICE_ID_GENIUS_MANTICORE: | 345 | case USB_DEVICE_ID_GENIUS_MANTICORE: |
345 | rdesc = kye_consumer_control_fixup(hdev, rdesc, rsize, 104, | 346 | rdesc = kye_consumer_control_fixup(hdev, rdesc, rsize, 104, |
346 | "Genius Manticore Keyboard"); | 347 | "Genius Manticore Keyboard"); |
diff --git a/drivers/hid/hid-sensor-hub.c b/drivers/hid/hid-sensor-hub.c index a184e1921c11..8fab82829f8b 100644 --- a/drivers/hid/hid-sensor-hub.c +++ b/drivers/hid/hid-sensor-hub.c | |||
@@ -112,13 +112,15 @@ static int sensor_hub_get_physical_device_count( | |||
112 | 112 | ||
113 | static void sensor_hub_fill_attr_info( | 113 | static void sensor_hub_fill_attr_info( |
114 | struct hid_sensor_hub_attribute_info *info, | 114 | struct hid_sensor_hub_attribute_info *info, |
115 | s32 index, s32 report_id, s32 units, s32 unit_expo, s32 size) | 115 | s32 index, s32 report_id, struct hid_field *field) |
116 | { | 116 | { |
117 | info->index = index; | 117 | info->index = index; |
118 | info->report_id = report_id; | 118 | info->report_id = report_id; |
119 | info->units = units; | 119 | info->units = field->unit; |
120 | info->unit_expo = unit_expo; | 120 | info->unit_expo = field->unit_exponent; |
121 | info->size = size/8; | 121 | info->size = (field->report_size * field->report_count)/8; |
122 | info->logical_minimum = field->logical_minimum; | ||
123 | info->logical_maximum = field->logical_maximum; | ||
122 | } | 124 | } |
123 | 125 | ||
124 | static struct hid_sensor_hub_callbacks *sensor_hub_get_callback( | 126 | static struct hid_sensor_hub_callbacks *sensor_hub_get_callback( |
@@ -325,9 +327,7 @@ int sensor_hub_input_get_attribute_info(struct hid_sensor_hub_device *hsdev, | |||
325 | if (field->physical == usage_id && | 327 | if (field->physical == usage_id && |
326 | field->logical == attr_usage_id) { | 328 | field->logical == attr_usage_id) { |
327 | sensor_hub_fill_attr_info(info, i, report->id, | 329 | sensor_hub_fill_attr_info(info, i, report->id, |
328 | field->unit, field->unit_exponent, | 330 | field); |
329 | field->report_size * | ||
330 | field->report_count); | ||
331 | ret = 0; | 331 | ret = 0; |
332 | } else { | 332 | } else { |
333 | for (j = 0; j < field->maxusage; ++j) { | 333 | for (j = 0; j < field->maxusage; ++j) { |
@@ -336,11 +336,7 @@ int sensor_hub_input_get_attribute_info(struct hid_sensor_hub_device *hsdev, | |||
336 | field->usage[j].collection_index == | 336 | field->usage[j].collection_index == |
337 | collection_index) { | 337 | collection_index) { |
338 | sensor_hub_fill_attr_info(info, | 338 | sensor_hub_fill_attr_info(info, |
339 | i, report->id, | 339 | i, report->id, field); |
340 | field->unit, | ||
341 | field->unit_exponent, | ||
342 | field->report_size * | ||
343 | field->report_count); | ||
344 | ret = 0; | 340 | ret = 0; |
345 | break; | 341 | break; |
346 | } | 342 | } |
@@ -573,6 +569,8 @@ static int sensor_hub_probe(struct hid_device *hdev, | |||
573 | goto err_free_names; | 569 | goto err_free_names; |
574 | } | 570 | } |
575 | sd->hid_sensor_hub_client_devs[ | 571 | sd->hid_sensor_hub_client_devs[ |
572 | sd->hid_sensor_client_cnt].id = PLATFORM_DEVID_AUTO; | ||
573 | sd->hid_sensor_hub_client_devs[ | ||
576 | sd->hid_sensor_client_cnt].name = name; | 574 | sd->hid_sensor_client_cnt].name = name; |
577 | sd->hid_sensor_hub_client_devs[ | 575 | sd->hid_sensor_hub_client_devs[ |
578 | sd->hid_sensor_client_cnt].platform_data = | 576 | sd->hid_sensor_client_cnt].platform_data = |
diff --git a/drivers/hwmon/hih6130.c b/drivers/hwmon/hih6130.c index 2dc37c7c6947..7d68a08baaa8 100644 --- a/drivers/hwmon/hih6130.c +++ b/drivers/hwmon/hih6130.c | |||
@@ -43,6 +43,7 @@ | |||
43 | * @last_update: time of last update (jiffies) | 43 | * @last_update: time of last update (jiffies) |
44 | * @temperature: cached temperature measurement value | 44 | * @temperature: cached temperature measurement value |
45 | * @humidity: cached humidity measurement value | 45 | * @humidity: cached humidity measurement value |
46 | * @write_length: length for I2C measurement request | ||
46 | */ | 47 | */ |
47 | struct hih6130 { | 48 | struct hih6130 { |
48 | struct device *hwmon_dev; | 49 | struct device *hwmon_dev; |
@@ -51,6 +52,7 @@ struct hih6130 { | |||
51 | unsigned long last_update; | 52 | unsigned long last_update; |
52 | int temperature; | 53 | int temperature; |
53 | int humidity; | 54 | int humidity; |
55 | size_t write_length; | ||
54 | }; | 56 | }; |
55 | 57 | ||
56 | /** | 58 | /** |
@@ -121,8 +123,15 @@ static int hih6130_update_measurements(struct i2c_client *client) | |||
121 | */ | 123 | */ |
122 | if (time_after(jiffies, hih6130->last_update + HZ) || !hih6130->valid) { | 124 | if (time_after(jiffies, hih6130->last_update + HZ) || !hih6130->valid) { |
123 | 125 | ||
124 | /* write to slave address, no data, to request a measurement */ | 126 | /* |
125 | ret = i2c_master_send(client, tmp, 0); | 127 | * Write to slave address to request a measurement. |
128 | * According with the datasheet it should be with no data, but | ||
129 | * for systems with I2C bus drivers that do not allow zero | ||
130 | * length packets we write one dummy byte to allow sensor | ||
131 | * measurements on them. | ||
132 | */ | ||
133 | tmp[0] = 0; | ||
134 | ret = i2c_master_send(client, tmp, hih6130->write_length); | ||
126 | if (ret < 0) | 135 | if (ret < 0) |
127 | goto out; | 136 | goto out; |
128 | 137 | ||
@@ -252,6 +261,9 @@ static int hih6130_probe(struct i2c_client *client, | |||
252 | goto fail_remove_sysfs; | 261 | goto fail_remove_sysfs; |
253 | } | 262 | } |
254 | 263 | ||
264 | if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_QUICK)) | ||
265 | hih6130->write_length = 1; | ||
266 | |||
255 | return 0; | 267 | return 0; |
256 | 268 | ||
257 | fail_remove_sysfs: | 269 | fail_remove_sysfs: |
diff --git a/drivers/hwmon/lm78.c b/drivers/hwmon/lm78.c index 6cf6bff79003..a2f3b4a365e4 100644 --- a/drivers/hwmon/lm78.c +++ b/drivers/hwmon/lm78.c | |||
@@ -94,6 +94,8 @@ static inline u8 FAN_TO_REG(long rpm, int div) | |||
94 | { | 94 | { |
95 | if (rpm <= 0) | 95 | if (rpm <= 0) |
96 | return 255; | 96 | return 255; |
97 | if (rpm > 1350000) | ||
98 | return 1; | ||
97 | return clamp_val((1350000 + rpm * div / 2) / (rpm * div), 1, 254); | 99 | return clamp_val((1350000 + rpm * div / 2) / (rpm * div), 1, 254); |
98 | } | 100 | } |
99 | 101 | ||
diff --git a/drivers/hwmon/lm90.c b/drivers/hwmon/lm90.c index 4c4c1421bf28..8b8f3aa49726 100644 --- a/drivers/hwmon/lm90.c +++ b/drivers/hwmon/lm90.c | |||
@@ -1610,12 +1610,14 @@ static int lm90_probe(struct i2c_client *client, | |||
1610 | "lm90", client); | 1610 | "lm90", client); |
1611 | if (err < 0) { | 1611 | if (err < 0) { |
1612 | dev_err(dev, "cannot request IRQ %d\n", client->irq); | 1612 | dev_err(dev, "cannot request IRQ %d\n", client->irq); |
1613 | goto exit_remove_files; | 1613 | goto exit_unregister; |
1614 | } | 1614 | } |
1615 | } | 1615 | } |
1616 | 1616 | ||
1617 | return 0; | 1617 | return 0; |
1618 | 1618 | ||
1619 | exit_unregister: | ||
1620 | hwmon_device_unregister(data->hwmon_dev); | ||
1619 | exit_remove_files: | 1621 | exit_remove_files: |
1620 | lm90_remove_files(client, data); | 1622 | lm90_remove_files(client, data); |
1621 | exit_restore: | 1623 | exit_restore: |
diff --git a/drivers/hwmon/sis5595.c b/drivers/hwmon/sis5595.c index 1404e6319deb..72a889702f0d 100644 --- a/drivers/hwmon/sis5595.c +++ b/drivers/hwmon/sis5595.c | |||
@@ -141,6 +141,8 @@ static inline u8 FAN_TO_REG(long rpm, int div) | |||
141 | { | 141 | { |
142 | if (rpm <= 0) | 142 | if (rpm <= 0) |
143 | return 255; | 143 | return 255; |
144 | if (rpm > 1350000) | ||
145 | return 1; | ||
144 | return clamp_val((1350000 + rpm * div / 2) / (rpm * div), 1, 254); | 146 | return clamp_val((1350000 + rpm * div / 2) / (rpm * div), 1, 254); |
145 | } | 147 | } |
146 | 148 | ||
diff --git a/drivers/hwmon/vt8231.c b/drivers/hwmon/vt8231.c index 0e7017841f7d..aee14e2192f8 100644 --- a/drivers/hwmon/vt8231.c +++ b/drivers/hwmon/vt8231.c | |||
@@ -145,7 +145,7 @@ static const u8 regtempmin[] = { 0x3a, 0x3e, 0x2c, 0x2e, 0x30, 0x32 }; | |||
145 | */ | 145 | */ |
146 | static inline u8 FAN_TO_REG(long rpm, int div) | 146 | static inline u8 FAN_TO_REG(long rpm, int div) |
147 | { | 147 | { |
148 | if (rpm == 0) | 148 | if (rpm <= 0 || rpm > 1310720) |
149 | return 0; | 149 | return 0; |
150 | return clamp_val(1310720 / (rpm * div), 1, 255); | 150 | return clamp_val(1310720 / (rpm * div), 1, 255); |
151 | } | 151 | } |
diff --git a/drivers/hwmon/w83l786ng.c b/drivers/hwmon/w83l786ng.c index edb06cda5a68..6ed76ceb9270 100644 --- a/drivers/hwmon/w83l786ng.c +++ b/drivers/hwmon/w83l786ng.c | |||
@@ -481,9 +481,11 @@ store_pwm(struct device *dev, struct device_attribute *attr, | |||
481 | if (err) | 481 | if (err) |
482 | return err; | 482 | return err; |
483 | val = clamp_val(val, 0, 255); | 483 | val = clamp_val(val, 0, 255); |
484 | val = DIV_ROUND_CLOSEST(val, 0x11); | ||
484 | 485 | ||
485 | mutex_lock(&data->update_lock); | 486 | mutex_lock(&data->update_lock); |
486 | data->pwm[nr] = val; | 487 | data->pwm[nr] = val * 0x11; |
488 | val |= w83l786ng_read_value(client, W83L786NG_REG_PWM[nr]) & 0xf0; | ||
487 | w83l786ng_write_value(client, W83L786NG_REG_PWM[nr], val); | 489 | w83l786ng_write_value(client, W83L786NG_REG_PWM[nr], val); |
488 | mutex_unlock(&data->update_lock); | 490 | mutex_unlock(&data->update_lock); |
489 | return count; | 491 | return count; |
@@ -510,7 +512,7 @@ store_pwm_enable(struct device *dev, struct device_attribute *attr, | |||
510 | mutex_lock(&data->update_lock); | 512 | mutex_lock(&data->update_lock); |
511 | reg = w83l786ng_read_value(client, W83L786NG_REG_FAN_CFG); | 513 | reg = w83l786ng_read_value(client, W83L786NG_REG_FAN_CFG); |
512 | data->pwm_enable[nr] = val; | 514 | data->pwm_enable[nr] = val; |
513 | reg &= ~(0x02 << W83L786NG_PWM_ENABLE_SHIFT[nr]); | 515 | reg &= ~(0x03 << W83L786NG_PWM_ENABLE_SHIFT[nr]); |
514 | reg |= (val - 1) << W83L786NG_PWM_ENABLE_SHIFT[nr]; | 516 | reg |= (val - 1) << W83L786NG_PWM_ENABLE_SHIFT[nr]; |
515 | w83l786ng_write_value(client, W83L786NG_REG_FAN_CFG, reg); | 517 | w83l786ng_write_value(client, W83L786NG_REG_FAN_CFG, reg); |
516 | mutex_unlock(&data->update_lock); | 518 | mutex_unlock(&data->update_lock); |
@@ -776,9 +778,10 @@ static struct w83l786ng_data *w83l786ng_update_device(struct device *dev) | |||
776 | ((pwmcfg >> W83L786NG_PWM_MODE_SHIFT[i]) & 1) | 778 | ((pwmcfg >> W83L786NG_PWM_MODE_SHIFT[i]) & 1) |
777 | ? 0 : 1; | 779 | ? 0 : 1; |
778 | data->pwm_enable[i] = | 780 | data->pwm_enable[i] = |
779 | ((pwmcfg >> W83L786NG_PWM_ENABLE_SHIFT[i]) & 2) + 1; | 781 | ((pwmcfg >> W83L786NG_PWM_ENABLE_SHIFT[i]) & 3) + 1; |
780 | data->pwm[i] = w83l786ng_read_value(client, | 782 | data->pwm[i] = |
781 | W83L786NG_REG_PWM[i]); | 783 | (w83l786ng_read_value(client, W83L786NG_REG_PWM[i]) |
784 | & 0x0f) * 0x11; | ||
782 | } | 785 | } |
783 | 786 | ||
784 | 787 | ||
diff --git a/drivers/i2c/busses/i2c-imx.c b/drivers/i2c/busses/i2c-imx.c index 1d7efa3169cd..d0cfbb4cb964 100644 --- a/drivers/i2c/busses/i2c-imx.c +++ b/drivers/i2c/busses/i2c-imx.c | |||
@@ -312,7 +312,9 @@ static int i2c_imx_start(struct imx_i2c_struct *i2c_imx) | |||
312 | 312 | ||
313 | dev_dbg(&i2c_imx->adapter.dev, "<%s>\n", __func__); | 313 | dev_dbg(&i2c_imx->adapter.dev, "<%s>\n", __func__); |
314 | 314 | ||
315 | clk_prepare_enable(i2c_imx->clk); | 315 | result = clk_prepare_enable(i2c_imx->clk); |
316 | if (result) | ||
317 | return result; | ||
316 | imx_i2c_write_reg(i2c_imx->ifdr, i2c_imx, IMX_I2C_IFDR); | 318 | imx_i2c_write_reg(i2c_imx->ifdr, i2c_imx, IMX_I2C_IFDR); |
317 | /* Enable I2C controller */ | 319 | /* Enable I2C controller */ |
318 | imx_i2c_write_reg(i2c_imx->hwdata->i2sr_clr_opcode, i2c_imx, IMX_I2C_I2SR); | 320 | imx_i2c_write_reg(i2c_imx->hwdata->i2sr_clr_opcode, i2c_imx, IMX_I2C_I2SR); |
diff --git a/drivers/i2c/i2c-mux.c b/drivers/i2c/i2c-mux.c index 797e3117bef7..2d0847b6be62 100644 --- a/drivers/i2c/i2c-mux.c +++ b/drivers/i2c/i2c-mux.c | |||
@@ -139,6 +139,8 @@ struct i2c_adapter *i2c_add_mux_adapter(struct i2c_adapter *parent, | |||
139 | priv->adap.algo = &priv->algo; | 139 | priv->adap.algo = &priv->algo; |
140 | priv->adap.algo_data = priv; | 140 | priv->adap.algo_data = priv; |
141 | priv->adap.dev.parent = &parent->dev; | 141 | priv->adap.dev.parent = &parent->dev; |
142 | priv->adap.retries = parent->retries; | ||
143 | priv->adap.timeout = parent->timeout; | ||
142 | 144 | ||
143 | /* Sanity check on class */ | 145 | /* Sanity check on class */ |
144 | if (i2c_mux_parent_classes(parent) & class) | 146 | if (i2c_mux_parent_classes(parent) & class) |
diff --git a/drivers/idle/intel_idle.c b/drivers/idle/intel_idle.c index cbd4e9abc47e..92d1206482a6 100644 --- a/drivers/idle/intel_idle.c +++ b/drivers/idle/intel_idle.c | |||
@@ -329,7 +329,7 @@ static struct cpuidle_state atom_cstates[] __initdata = { | |||
329 | { | 329 | { |
330 | .enter = NULL } | 330 | .enter = NULL } |
331 | }; | 331 | }; |
332 | static struct cpuidle_state avn_cstates[CPUIDLE_STATE_MAX] = { | 332 | static struct cpuidle_state avn_cstates[] __initdata = { |
333 | { | 333 | { |
334 | .name = "C1-AVN", | 334 | .name = "C1-AVN", |
335 | .desc = "MWAIT 0x00", | 335 | .desc = "MWAIT 0x00", |
@@ -340,7 +340,7 @@ static struct cpuidle_state avn_cstates[CPUIDLE_STATE_MAX] = { | |||
340 | { | 340 | { |
341 | .name = "C6-AVN", | 341 | .name = "C6-AVN", |
342 | .desc = "MWAIT 0x51", | 342 | .desc = "MWAIT 0x51", |
343 | .flags = MWAIT2flg(0x58) | CPUIDLE_FLAG_TIME_VALID | CPUIDLE_FLAG_TLB_FLUSHED, | 343 | .flags = MWAIT2flg(0x51) | CPUIDLE_FLAG_TIME_VALID | CPUIDLE_FLAG_TLB_FLUSHED, |
344 | .exit_latency = 15, | 344 | .exit_latency = 15, |
345 | .target_residency = 45, | 345 | .target_residency = 45, |
346 | .enter = &intel_idle }, | 346 | .enter = &intel_idle }, |
diff --git a/drivers/iio/common/hid-sensors/Kconfig b/drivers/iio/common/hid-sensors/Kconfig index 1178121b55b0..39188b72cd3b 100644 --- a/drivers/iio/common/hid-sensors/Kconfig +++ b/drivers/iio/common/hid-sensors/Kconfig | |||
@@ -25,13 +25,4 @@ config HID_SENSOR_IIO_TRIGGER | |||
25 | If this driver is compiled as a module, it will be named | 25 | If this driver is compiled as a module, it will be named |
26 | hid-sensor-trigger. | 26 | hid-sensor-trigger. |
27 | 27 | ||
28 | config HID_SENSOR_ENUM_BASE_QUIRKS | ||
29 | bool "ENUM base quirks for HID Sensor IIO drivers" | ||
30 | depends on HID_SENSOR_IIO_COMMON | ||
31 | help | ||
32 | Say yes here to build support for sensor hub FW using | ||
33 | enumeration, which is using 1 as base instead of 0. | ||
34 | Since logical minimum is still set 0 instead of 1, | ||
35 | there is no easy way to differentiate. | ||
36 | |||
37 | endmenu | 28 | endmenu |
diff --git a/drivers/iio/common/hid-sensors/hid-sensor-trigger.c b/drivers/iio/common/hid-sensors/hid-sensor-trigger.c index bbd6426c9726..7dcf83998e6f 100644 --- a/drivers/iio/common/hid-sensors/hid-sensor-trigger.c +++ b/drivers/iio/common/hid-sensors/hid-sensor-trigger.c | |||
@@ -33,24 +33,34 @@ static int hid_sensor_data_rdy_trigger_set_state(struct iio_trigger *trig, | |||
33 | { | 33 | { |
34 | struct hid_sensor_common *st = iio_trigger_get_drvdata(trig); | 34 | struct hid_sensor_common *st = iio_trigger_get_drvdata(trig); |
35 | int state_val; | 35 | int state_val; |
36 | int report_val; | ||
36 | 37 | ||
37 | if (state) { | 38 | if (state) { |
38 | if (sensor_hub_device_open(st->hsdev)) | 39 | if (sensor_hub_device_open(st->hsdev)) |
39 | return -EIO; | 40 | return -EIO; |
40 | } else | 41 | state_val = |
42 | HID_USAGE_SENSOR_PROP_POWER_STATE_D0_FULL_POWER_ENUM; | ||
43 | report_val = | ||
44 | HID_USAGE_SENSOR_PROP_REPORTING_STATE_ALL_EVENTS_ENUM; | ||
45 | |||
46 | } else { | ||
41 | sensor_hub_device_close(st->hsdev); | 47 | sensor_hub_device_close(st->hsdev); |
48 | state_val = | ||
49 | HID_USAGE_SENSOR_PROP_POWER_STATE_D4_POWER_OFF_ENUM; | ||
50 | report_val = | ||
51 | HID_USAGE_SENSOR_PROP_REPORTING_STATE_NO_EVENTS_ENUM; | ||
52 | } | ||
42 | 53 | ||
43 | state_val = state ? 1 : 0; | ||
44 | if (IS_ENABLED(CONFIG_HID_SENSOR_ENUM_BASE_QUIRKS)) | ||
45 | ++state_val; | ||
46 | st->data_ready = state; | 54 | st->data_ready = state; |
55 | state_val += st->power_state.logical_minimum; | ||
56 | report_val += st->report_state.logical_minimum; | ||
47 | sensor_hub_set_feature(st->hsdev, st->power_state.report_id, | 57 | sensor_hub_set_feature(st->hsdev, st->power_state.report_id, |
48 | st->power_state.index, | 58 | st->power_state.index, |
49 | (s32)state_val); | 59 | (s32)state_val); |
50 | 60 | ||
51 | sensor_hub_set_feature(st->hsdev, st->report_state.report_id, | 61 | sensor_hub_set_feature(st->hsdev, st->report_state.report_id, |
52 | st->report_state.index, | 62 | st->report_state.index, |
53 | (s32)state_val); | 63 | (s32)report_val); |
54 | 64 | ||
55 | return 0; | 65 | return 0; |
56 | } | 66 | } |
diff --git a/drivers/iio/light/Kconfig b/drivers/iio/light/Kconfig index b0d65df3ede2..a022f27c6690 100644 --- a/drivers/iio/light/Kconfig +++ b/drivers/iio/light/Kconfig | |||
@@ -43,6 +43,7 @@ config GP2AP020A00F | |||
43 | depends on I2C | 43 | depends on I2C |
44 | select IIO_BUFFER | 44 | select IIO_BUFFER |
45 | select IIO_TRIGGERED_BUFFER | 45 | select IIO_TRIGGERED_BUFFER |
46 | select IRQ_WORK | ||
46 | help | 47 | help |
47 | Say Y here if you have a Sharp GP2AP020A00F proximity/ALS combo-chip | 48 | Say Y here if you have a Sharp GP2AP020A00F proximity/ALS combo-chip |
48 | hooked to an I2C bus. | 49 | hooked to an I2C bus. |
diff --git a/drivers/input/keyboard/adp5588-keys.c b/drivers/input/keyboard/adp5588-keys.c index dbd2047f1641..3ed23513d881 100644 --- a/drivers/input/keyboard/adp5588-keys.c +++ b/drivers/input/keyboard/adp5588-keys.c | |||
@@ -536,7 +536,8 @@ static int adp5588_probe(struct i2c_client *client, | |||
536 | __set_bit(EV_REP, input->evbit); | 536 | __set_bit(EV_REP, input->evbit); |
537 | 537 | ||
538 | for (i = 0; i < input->keycodemax; i++) | 538 | for (i = 0; i < input->keycodemax; i++) |
539 | __set_bit(kpad->keycode[i] & KEY_MAX, input->keybit); | 539 | if (kpad->keycode[i] <= KEY_MAX) |
540 | __set_bit(kpad->keycode[i], input->keybit); | ||
540 | __clear_bit(KEY_RESERVED, input->keybit); | 541 | __clear_bit(KEY_RESERVED, input->keybit); |
541 | 542 | ||
542 | if (kpad->gpimapsize) | 543 | if (kpad->gpimapsize) |
diff --git a/drivers/input/keyboard/adp5589-keys.c b/drivers/input/keyboard/adp5589-keys.c index 67d12b3427c9..60dafd4fa692 100644 --- a/drivers/input/keyboard/adp5589-keys.c +++ b/drivers/input/keyboard/adp5589-keys.c | |||
@@ -992,7 +992,8 @@ static int adp5589_probe(struct i2c_client *client, | |||
992 | __set_bit(EV_REP, input->evbit); | 992 | __set_bit(EV_REP, input->evbit); |
993 | 993 | ||
994 | for (i = 0; i < input->keycodemax; i++) | 994 | for (i = 0; i < input->keycodemax; i++) |
995 | __set_bit(kpad->keycode[i] & KEY_MAX, input->keybit); | 995 | if (kpad->keycode[i] <= KEY_MAX) |
996 | __set_bit(kpad->keycode[i], input->keybit); | ||
996 | __clear_bit(KEY_RESERVED, input->keybit); | 997 | __clear_bit(KEY_RESERVED, input->keybit); |
997 | 998 | ||
998 | if (kpad->gpimapsize) | 999 | if (kpad->gpimapsize) |
diff --git a/drivers/input/keyboard/bf54x-keys.c b/drivers/input/keyboard/bf54x-keys.c index fc88fb48d70d..09b91d093087 100644 --- a/drivers/input/keyboard/bf54x-keys.c +++ b/drivers/input/keyboard/bf54x-keys.c | |||
@@ -289,7 +289,8 @@ static int bfin_kpad_probe(struct platform_device *pdev) | |||
289 | __set_bit(EV_REP, input->evbit); | 289 | __set_bit(EV_REP, input->evbit); |
290 | 290 | ||
291 | for (i = 0; i < input->keycodemax; i++) | 291 | for (i = 0; i < input->keycodemax; i++) |
292 | __set_bit(bf54x_kpad->keycode[i] & KEY_MAX, input->keybit); | 292 | if (bf54x_kpad->keycode[i] <= KEY_MAX) |
293 | __set_bit(bf54x_kpad->keycode[i], input->keybit); | ||
293 | __clear_bit(KEY_RESERVED, input->keybit); | 294 | __clear_bit(KEY_RESERVED, input->keybit); |
294 | 295 | ||
295 | error = input_register_device(input); | 296 | error = input_register_device(input); |
diff --git a/drivers/input/misc/adxl34x.c b/drivers/input/misc/adxl34x.c index 0735de3a6468..1cb1da294419 100644 --- a/drivers/input/misc/adxl34x.c +++ b/drivers/input/misc/adxl34x.c | |||
@@ -158,7 +158,7 @@ | |||
158 | 158 | ||
159 | /* ORIENT ADXL346 only */ | 159 | /* ORIENT ADXL346 only */ |
160 | #define ADXL346_2D_VALID (1 << 6) | 160 | #define ADXL346_2D_VALID (1 << 6) |
161 | #define ADXL346_2D_ORIENT(x) (((x) & 0x3) >> 4) | 161 | #define ADXL346_2D_ORIENT(x) (((x) & 0x30) >> 4) |
162 | #define ADXL346_3D_VALID (1 << 3) | 162 | #define ADXL346_3D_VALID (1 << 3) |
163 | #define ADXL346_3D_ORIENT(x) ((x) & 0x7) | 163 | #define ADXL346_3D_ORIENT(x) ((x) & 0x7) |
164 | #define ADXL346_2D_PORTRAIT_POS 0 /* +X */ | 164 | #define ADXL346_2D_PORTRAIT_POS 0 /* +X */ |
diff --git a/drivers/input/misc/pcf8574_keypad.c b/drivers/input/misc/pcf8574_keypad.c index e37392976fdd..0deca5a3c87f 100644 --- a/drivers/input/misc/pcf8574_keypad.c +++ b/drivers/input/misc/pcf8574_keypad.c | |||
@@ -113,9 +113,12 @@ static int pcf8574_kp_probe(struct i2c_client *client, const struct i2c_device_i | |||
113 | idev->keycodemax = ARRAY_SIZE(lp->btncode); | 113 | idev->keycodemax = ARRAY_SIZE(lp->btncode); |
114 | 114 | ||
115 | for (i = 0; i < ARRAY_SIZE(pcf8574_kp_btncode); i++) { | 115 | for (i = 0; i < ARRAY_SIZE(pcf8574_kp_btncode); i++) { |
116 | lp->btncode[i] = pcf8574_kp_btncode[i]; | 116 | if (lp->btncode[i] <= KEY_MAX) { |
117 | __set_bit(lp->btncode[i] & KEY_MAX, idev->keybit); | 117 | lp->btncode[i] = pcf8574_kp_btncode[i]; |
118 | __set_bit(lp->btncode[i], idev->keybit); | ||
119 | } | ||
118 | } | 120 | } |
121 | __clear_bit(KEY_RESERVED, idev->keybit); | ||
119 | 122 | ||
120 | sprintf(lp->name, DRV_NAME); | 123 | sprintf(lp->name, DRV_NAME); |
121 | sprintf(lp->phys, "kp_data/input0"); | 124 | sprintf(lp->phys, "kp_data/input0"); |
diff --git a/drivers/input/mouse/alps.c b/drivers/input/mouse/alps.c index ca7a26f1dce8..5cf62e315218 100644 --- a/drivers/input/mouse/alps.c +++ b/drivers/input/mouse/alps.c | |||
@@ -70,6 +70,25 @@ static const struct alps_nibble_commands alps_v4_nibble_commands[] = { | |||
70 | { PSMOUSE_CMD_SETSCALE11, 0x00 }, /* f */ | 70 | { PSMOUSE_CMD_SETSCALE11, 0x00 }, /* f */ |
71 | }; | 71 | }; |
72 | 72 | ||
73 | static const struct alps_nibble_commands alps_v6_nibble_commands[] = { | ||
74 | { PSMOUSE_CMD_ENABLE, 0x00 }, /* 0 */ | ||
75 | { PSMOUSE_CMD_SETRATE, 0x0a }, /* 1 */ | ||
76 | { PSMOUSE_CMD_SETRATE, 0x14 }, /* 2 */ | ||
77 | { PSMOUSE_CMD_SETRATE, 0x28 }, /* 3 */ | ||
78 | { PSMOUSE_CMD_SETRATE, 0x3c }, /* 4 */ | ||
79 | { PSMOUSE_CMD_SETRATE, 0x50 }, /* 5 */ | ||
80 | { PSMOUSE_CMD_SETRATE, 0x64 }, /* 6 */ | ||
81 | { PSMOUSE_CMD_SETRATE, 0xc8 }, /* 7 */ | ||
82 | { PSMOUSE_CMD_GETID, 0x00 }, /* 8 */ | ||
83 | { PSMOUSE_CMD_GETINFO, 0x00 }, /* 9 */ | ||
84 | { PSMOUSE_CMD_SETRES, 0x00 }, /* a */ | ||
85 | { PSMOUSE_CMD_SETRES, 0x01 }, /* b */ | ||
86 | { PSMOUSE_CMD_SETRES, 0x02 }, /* c */ | ||
87 | { PSMOUSE_CMD_SETRES, 0x03 }, /* d */ | ||
88 | { PSMOUSE_CMD_SETSCALE21, 0x00 }, /* e */ | ||
89 | { PSMOUSE_CMD_SETSCALE11, 0x00 }, /* f */ | ||
90 | }; | ||
91 | |||
73 | 92 | ||
74 | #define ALPS_DUALPOINT 0x02 /* touchpad has trackstick */ | 93 | #define ALPS_DUALPOINT 0x02 /* touchpad has trackstick */ |
75 | #define ALPS_PASS 0x04 /* device has a pass-through port */ | 94 | #define ALPS_PASS 0x04 /* device has a pass-through port */ |
@@ -103,6 +122,7 @@ static const struct alps_model_info alps_model_data[] = { | |||
103 | /* Dell Latitude E5500, E6400, E6500, Precision M4400 */ | 122 | /* Dell Latitude E5500, E6400, E6500, Precision M4400 */ |
104 | { { 0x62, 0x02, 0x14 }, 0x00, ALPS_PROTO_V2, 0xcf, 0xcf, | 123 | { { 0x62, 0x02, 0x14 }, 0x00, ALPS_PROTO_V2, 0xcf, 0xcf, |
105 | ALPS_PASS | ALPS_DUALPOINT | ALPS_PS2_INTERLEAVED }, | 124 | ALPS_PASS | ALPS_DUALPOINT | ALPS_PS2_INTERLEAVED }, |
125 | { { 0x73, 0x00, 0x14 }, 0x00, ALPS_PROTO_V6, 0xff, 0xff, ALPS_DUALPOINT }, /* Dell XT2 */ | ||
106 | { { 0x73, 0x02, 0x50 }, 0x00, ALPS_PROTO_V2, 0xcf, 0xcf, ALPS_FOUR_BUTTONS }, /* Dell Vostro 1400 */ | 126 | { { 0x73, 0x02, 0x50 }, 0x00, ALPS_PROTO_V2, 0xcf, 0xcf, ALPS_FOUR_BUTTONS }, /* Dell Vostro 1400 */ |
107 | { { 0x52, 0x01, 0x14 }, 0x00, ALPS_PROTO_V2, 0xff, 0xff, | 127 | { { 0x52, 0x01, 0x14 }, 0x00, ALPS_PROTO_V2, 0xff, 0xff, |
108 | ALPS_PASS | ALPS_DUALPOINT | ALPS_PS2_INTERLEAVED }, /* Toshiba Tecra A11-11L */ | 128 | ALPS_PASS | ALPS_DUALPOINT | ALPS_PS2_INTERLEAVED }, /* Toshiba Tecra A11-11L */ |
@@ -645,6 +665,76 @@ static void alps_process_packet_v3(struct psmouse *psmouse) | |||
645 | alps_process_touchpad_packet_v3(psmouse); | 665 | alps_process_touchpad_packet_v3(psmouse); |
646 | } | 666 | } |
647 | 667 | ||
668 | static void alps_process_packet_v6(struct psmouse *psmouse) | ||
669 | { | ||
670 | struct alps_data *priv = psmouse->private; | ||
671 | unsigned char *packet = psmouse->packet; | ||
672 | struct input_dev *dev = psmouse->dev; | ||
673 | struct input_dev *dev2 = priv->dev2; | ||
674 | int x, y, z, left, right, middle; | ||
675 | |||
676 | /* | ||
677 | * We can use Byte5 to distinguish if the packet is from Touchpad | ||
678 | * or Trackpoint. | ||
679 | * Touchpad: 0 - 0x7E | ||
680 | * Trackpoint: 0x7F | ||
681 | */ | ||
682 | if (packet[5] == 0x7F) { | ||
683 | /* It should be a DualPoint when received Trackpoint packet */ | ||
684 | if (!(priv->flags & ALPS_DUALPOINT)) | ||
685 | return; | ||
686 | |||
687 | /* Trackpoint packet */ | ||
688 | x = packet[1] | ((packet[3] & 0x20) << 2); | ||
689 | y = packet[2] | ((packet[3] & 0x40) << 1); | ||
690 | z = packet[4]; | ||
691 | left = packet[3] & 0x01; | ||
692 | right = packet[3] & 0x02; | ||
693 | middle = packet[3] & 0x04; | ||
694 | |||
695 | /* To prevent the cursor jump when finger lifted */ | ||
696 | if (x == 0x7F && y == 0x7F && z == 0x7F) | ||
697 | x = y = z = 0; | ||
698 | |||
699 | /* Divide 4 since trackpoint's speed is too fast */ | ||
700 | input_report_rel(dev2, REL_X, (char)x / 4); | ||
701 | input_report_rel(dev2, REL_Y, -((char)y / 4)); | ||
702 | |||
703 | input_report_key(dev2, BTN_LEFT, left); | ||
704 | input_report_key(dev2, BTN_RIGHT, right); | ||
705 | input_report_key(dev2, BTN_MIDDLE, middle); | ||
706 | |||
707 | input_sync(dev2); | ||
708 | return; | ||
709 | } | ||
710 | |||
711 | /* Touchpad packet */ | ||
712 | x = packet[1] | ((packet[3] & 0x78) << 4); | ||
713 | y = packet[2] | ((packet[4] & 0x78) << 4); | ||
714 | z = packet[5]; | ||
715 | left = packet[3] & 0x01; | ||
716 | right = packet[3] & 0x02; | ||
717 | |||
718 | if (z > 30) | ||
719 | input_report_key(dev, BTN_TOUCH, 1); | ||
720 | if (z < 25) | ||
721 | input_report_key(dev, BTN_TOUCH, 0); | ||
722 | |||
723 | if (z > 0) { | ||
724 | input_report_abs(dev, ABS_X, x); | ||
725 | input_report_abs(dev, ABS_Y, y); | ||
726 | } | ||
727 | |||
728 | input_report_abs(dev, ABS_PRESSURE, z); | ||
729 | input_report_key(dev, BTN_TOOL_FINGER, z > 0); | ||
730 | |||
731 | /* v6 touchpad does not have middle button */ | ||
732 | input_report_key(dev, BTN_LEFT, left); | ||
733 | input_report_key(dev, BTN_RIGHT, right); | ||
734 | |||
735 | input_sync(dev); | ||
736 | } | ||
737 | |||
648 | static void alps_process_packet_v4(struct psmouse *psmouse) | 738 | static void alps_process_packet_v4(struct psmouse *psmouse) |
649 | { | 739 | { |
650 | struct alps_data *priv = psmouse->private; | 740 | struct alps_data *priv = psmouse->private; |
@@ -897,7 +987,7 @@ static psmouse_ret_t alps_process_byte(struct psmouse *psmouse) | |||
897 | } | 987 | } |
898 | 988 | ||
899 | /* Bytes 2 - pktsize should have 0 in the highest bit */ | 989 | /* Bytes 2 - pktsize should have 0 in the highest bit */ |
900 | if (priv->proto_version != ALPS_PROTO_V5 && | 990 | if ((priv->proto_version < ALPS_PROTO_V5) && |
901 | psmouse->pktcnt >= 2 && psmouse->pktcnt <= psmouse->pktsize && | 991 | psmouse->pktcnt >= 2 && psmouse->pktcnt <= psmouse->pktsize && |
902 | (psmouse->packet[psmouse->pktcnt - 1] & 0x80)) { | 992 | (psmouse->packet[psmouse->pktcnt - 1] & 0x80)) { |
903 | psmouse_dbg(psmouse, "refusing packet[%i] = %x\n", | 993 | psmouse_dbg(psmouse, "refusing packet[%i] = %x\n", |
@@ -1085,6 +1175,80 @@ static int alps_absolute_mode_v1_v2(struct psmouse *psmouse) | |||
1085 | return ps2_command(&psmouse->ps2dev, NULL, PSMOUSE_CMD_SETPOLL); | 1175 | return ps2_command(&psmouse->ps2dev, NULL, PSMOUSE_CMD_SETPOLL); |
1086 | } | 1176 | } |
1087 | 1177 | ||
1178 | static int alps_monitor_mode_send_word(struct psmouse *psmouse, u16 word) | ||
1179 | { | ||
1180 | int i, nibble; | ||
1181 | |||
1182 | /* | ||
1183 | * b0-b11 are valid bits, send sequence is inverse. | ||
1184 | * e.g. when word = 0x0123, nibble send sequence is 3, 2, 1 | ||
1185 | */ | ||
1186 | for (i = 0; i <= 8; i += 4) { | ||
1187 | nibble = (word >> i) & 0xf; | ||
1188 | if (alps_command_mode_send_nibble(psmouse, nibble)) | ||
1189 | return -1; | ||
1190 | } | ||
1191 | |||
1192 | return 0; | ||
1193 | } | ||
1194 | |||
1195 | static int alps_monitor_mode_write_reg(struct psmouse *psmouse, | ||
1196 | u16 addr, u16 value) | ||
1197 | { | ||
1198 | struct ps2dev *ps2dev = &psmouse->ps2dev; | ||
1199 | |||
1200 | /* 0x0A0 is the command to write the word */ | ||
1201 | if (ps2_command(ps2dev, NULL, PSMOUSE_CMD_ENABLE) || | ||
1202 | alps_monitor_mode_send_word(psmouse, 0x0A0) || | ||
1203 | alps_monitor_mode_send_word(psmouse, addr) || | ||
1204 | alps_monitor_mode_send_word(psmouse, value) || | ||
1205 | ps2_command(ps2dev, NULL, PSMOUSE_CMD_DISABLE)) | ||
1206 | return -1; | ||
1207 | |||
1208 | return 0; | ||
1209 | } | ||
1210 | |||
1211 | static int alps_monitor_mode(struct psmouse *psmouse, bool enable) | ||
1212 | { | ||
1213 | struct ps2dev *ps2dev = &psmouse->ps2dev; | ||
1214 | |||
1215 | if (enable) { | ||
1216 | /* EC E9 F5 F5 E7 E6 E7 E9 to enter monitor mode */ | ||
1217 | if (ps2_command(ps2dev, NULL, PSMOUSE_CMD_RESET_WRAP) || | ||
1218 | ps2_command(ps2dev, NULL, PSMOUSE_CMD_GETINFO) || | ||
1219 | ps2_command(ps2dev, NULL, PSMOUSE_CMD_DISABLE) || | ||
1220 | ps2_command(ps2dev, NULL, PSMOUSE_CMD_DISABLE) || | ||
1221 | ps2_command(ps2dev, NULL, PSMOUSE_CMD_SETSCALE21) || | ||
1222 | ps2_command(ps2dev, NULL, PSMOUSE_CMD_SETSCALE11) || | ||
1223 | ps2_command(ps2dev, NULL, PSMOUSE_CMD_SETSCALE21) || | ||
1224 | ps2_command(ps2dev, NULL, PSMOUSE_CMD_GETINFO)) | ||
1225 | return -1; | ||
1226 | } else { | ||
1227 | /* EC to exit monitor mode */ | ||
1228 | if (ps2_command(ps2dev, NULL, PSMOUSE_CMD_RESET_WRAP)) | ||
1229 | return -1; | ||
1230 | } | ||
1231 | |||
1232 | return 0; | ||
1233 | } | ||
1234 | |||
1235 | static int alps_absolute_mode_v6(struct psmouse *psmouse) | ||
1236 | { | ||
1237 | u16 reg_val = 0x181; | ||
1238 | int ret = -1; | ||
1239 | |||
1240 | /* enter monitor mode, to write the register */ | ||
1241 | if (alps_monitor_mode(psmouse, true)) | ||
1242 | return -1; | ||
1243 | |||
1244 | ret = alps_monitor_mode_write_reg(psmouse, 0x000, reg_val); | ||
1245 | |||
1246 | if (alps_monitor_mode(psmouse, false)) | ||
1247 | ret = -1; | ||
1248 | |||
1249 | return ret; | ||
1250 | } | ||
1251 | |||
1088 | static int alps_get_status(struct psmouse *psmouse, char *param) | 1252 | static int alps_get_status(struct psmouse *psmouse, char *param) |
1089 | { | 1253 | { |
1090 | /* Get status: 0xF5 0xF5 0xF5 0xE9 */ | 1254 | /* Get status: 0xF5 0xF5 0xF5 0xE9 */ |
@@ -1189,6 +1353,32 @@ static int alps_hw_init_v1_v2(struct psmouse *psmouse) | |||
1189 | return 0; | 1353 | return 0; |
1190 | } | 1354 | } |
1191 | 1355 | ||
1356 | static int alps_hw_init_v6(struct psmouse *psmouse) | ||
1357 | { | ||
1358 | unsigned char param[2] = {0xC8, 0x14}; | ||
1359 | |||
1360 | /* Enter passthrough mode to let trackpoint enter 6byte raw mode */ | ||
1361 | if (alps_passthrough_mode_v2(psmouse, true)) | ||
1362 | return -1; | ||
1363 | |||
1364 | if (ps2_command(&psmouse->ps2dev, NULL, PSMOUSE_CMD_SETSCALE11) || | ||
1365 | ps2_command(&psmouse->ps2dev, NULL, PSMOUSE_CMD_SETSCALE11) || | ||
1366 | ps2_command(&psmouse->ps2dev, NULL, PSMOUSE_CMD_SETSCALE11) || | ||
1367 | ps2_command(&psmouse->ps2dev, ¶m[0], PSMOUSE_CMD_SETRATE) || | ||
1368 | ps2_command(&psmouse->ps2dev, ¶m[1], PSMOUSE_CMD_SETRATE)) | ||
1369 | return -1; | ||
1370 | |||
1371 | if (alps_passthrough_mode_v2(psmouse, false)) | ||
1372 | return -1; | ||
1373 | |||
1374 | if (alps_absolute_mode_v6(psmouse)) { | ||
1375 | psmouse_err(psmouse, "Failed to enable absolute mode\n"); | ||
1376 | return -1; | ||
1377 | } | ||
1378 | |||
1379 | return 0; | ||
1380 | } | ||
1381 | |||
1192 | /* | 1382 | /* |
1193 | * Enable or disable passthrough mode to the trackstick. | 1383 | * Enable or disable passthrough mode to the trackstick. |
1194 | */ | 1384 | */ |
@@ -1553,6 +1743,8 @@ static void alps_set_defaults(struct alps_data *priv) | |||
1553 | priv->hw_init = alps_hw_init_v1_v2; | 1743 | priv->hw_init = alps_hw_init_v1_v2; |
1554 | priv->process_packet = alps_process_packet_v1_v2; | 1744 | priv->process_packet = alps_process_packet_v1_v2; |
1555 | priv->set_abs_params = alps_set_abs_params_st; | 1745 | priv->set_abs_params = alps_set_abs_params_st; |
1746 | priv->x_max = 1023; | ||
1747 | priv->y_max = 767; | ||
1556 | break; | 1748 | break; |
1557 | case ALPS_PROTO_V3: | 1749 | case ALPS_PROTO_V3: |
1558 | priv->hw_init = alps_hw_init_v3; | 1750 | priv->hw_init = alps_hw_init_v3; |
@@ -1584,6 +1776,14 @@ static void alps_set_defaults(struct alps_data *priv) | |||
1584 | priv->x_bits = 23; | 1776 | priv->x_bits = 23; |
1585 | priv->y_bits = 12; | 1777 | priv->y_bits = 12; |
1586 | break; | 1778 | break; |
1779 | case ALPS_PROTO_V6: | ||
1780 | priv->hw_init = alps_hw_init_v6; | ||
1781 | priv->process_packet = alps_process_packet_v6; | ||
1782 | priv->set_abs_params = alps_set_abs_params_st; | ||
1783 | priv->nibble_commands = alps_v6_nibble_commands; | ||
1784 | priv->x_max = 2047; | ||
1785 | priv->y_max = 1535; | ||
1786 | break; | ||
1587 | } | 1787 | } |
1588 | } | 1788 | } |
1589 | 1789 | ||
@@ -1705,8 +1905,8 @@ static void alps_disconnect(struct psmouse *psmouse) | |||
1705 | static void alps_set_abs_params_st(struct alps_data *priv, | 1905 | static void alps_set_abs_params_st(struct alps_data *priv, |
1706 | struct input_dev *dev1) | 1906 | struct input_dev *dev1) |
1707 | { | 1907 | { |
1708 | input_set_abs_params(dev1, ABS_X, 0, 1023, 0, 0); | 1908 | input_set_abs_params(dev1, ABS_X, 0, priv->x_max, 0, 0); |
1709 | input_set_abs_params(dev1, ABS_Y, 0, 767, 0, 0); | 1909 | input_set_abs_params(dev1, ABS_Y, 0, priv->y_max, 0, 0); |
1710 | } | 1910 | } |
1711 | 1911 | ||
1712 | static void alps_set_abs_params_mt(struct alps_data *priv, | 1912 | static void alps_set_abs_params_mt(struct alps_data *priv, |
diff --git a/drivers/input/mouse/alps.h b/drivers/input/mouse/alps.h index eee59853b9ce..704f0f924307 100644 --- a/drivers/input/mouse/alps.h +++ b/drivers/input/mouse/alps.h | |||
@@ -17,6 +17,7 @@ | |||
17 | #define ALPS_PROTO_V3 3 | 17 | #define ALPS_PROTO_V3 3 |
18 | #define ALPS_PROTO_V4 4 | 18 | #define ALPS_PROTO_V4 4 |
19 | #define ALPS_PROTO_V5 5 | 19 | #define ALPS_PROTO_V5 5 |
20 | #define ALPS_PROTO_V6 6 | ||
20 | 21 | ||
21 | /** | 22 | /** |
22 | * struct alps_model_info - touchpad ID table | 23 | * struct alps_model_info - touchpad ID table |
diff --git a/drivers/input/mouse/elantech.c b/drivers/input/mouse/elantech.c index 8551dcaf24db..597e9b8fc18d 100644 --- a/drivers/input/mouse/elantech.c +++ b/drivers/input/mouse/elantech.c | |||
@@ -1313,6 +1313,7 @@ static int elantech_set_properties(struct elantech_data *etd) | |||
1313 | break; | 1313 | break; |
1314 | case 6: | 1314 | case 6: |
1315 | case 7: | 1315 | case 7: |
1316 | case 8: | ||
1316 | etd->hw_version = 4; | 1317 | etd->hw_version = 4; |
1317 | break; | 1318 | break; |
1318 | default: | 1319 | default: |
diff --git a/drivers/input/serio/serio.c b/drivers/input/serio/serio.c index 98707fb2cb5d..8f4c4ab04bc2 100644 --- a/drivers/input/serio/serio.c +++ b/drivers/input/serio/serio.c | |||
@@ -455,16 +455,26 @@ static DEVICE_ATTR_RO(type); | |||
455 | static DEVICE_ATTR_RO(proto); | 455 | static DEVICE_ATTR_RO(proto); |
456 | static DEVICE_ATTR_RO(id); | 456 | static DEVICE_ATTR_RO(id); |
457 | static DEVICE_ATTR_RO(extra); | 457 | static DEVICE_ATTR_RO(extra); |
458 | static DEVICE_ATTR_RO(modalias); | ||
459 | static DEVICE_ATTR_WO(drvctl); | ||
460 | static DEVICE_ATTR(description, S_IRUGO, serio_show_description, NULL); | ||
461 | static DEVICE_ATTR(bind_mode, S_IWUSR | S_IRUGO, serio_show_bind_mode, serio_set_bind_mode); | ||
462 | 458 | ||
463 | static struct attribute *serio_device_id_attrs[] = { | 459 | static struct attribute *serio_device_id_attrs[] = { |
464 | &dev_attr_type.attr, | 460 | &dev_attr_type.attr, |
465 | &dev_attr_proto.attr, | 461 | &dev_attr_proto.attr, |
466 | &dev_attr_id.attr, | 462 | &dev_attr_id.attr, |
467 | &dev_attr_extra.attr, | 463 | &dev_attr_extra.attr, |
464 | NULL | ||
465 | }; | ||
466 | |||
467 | static struct attribute_group serio_id_attr_group = { | ||
468 | .name = "id", | ||
469 | .attrs = serio_device_id_attrs, | ||
470 | }; | ||
471 | |||
472 | static DEVICE_ATTR_RO(modalias); | ||
473 | static DEVICE_ATTR_WO(drvctl); | ||
474 | static DEVICE_ATTR(description, S_IRUGO, serio_show_description, NULL); | ||
475 | static DEVICE_ATTR(bind_mode, S_IWUSR | S_IRUGO, serio_show_bind_mode, serio_set_bind_mode); | ||
476 | |||
477 | static struct attribute *serio_device_attrs[] = { | ||
468 | &dev_attr_modalias.attr, | 478 | &dev_attr_modalias.attr, |
469 | &dev_attr_description.attr, | 479 | &dev_attr_description.attr, |
470 | &dev_attr_drvctl.attr, | 480 | &dev_attr_drvctl.attr, |
@@ -472,13 +482,13 @@ static struct attribute *serio_device_id_attrs[] = { | |||
472 | NULL | 482 | NULL |
473 | }; | 483 | }; |
474 | 484 | ||
475 | static struct attribute_group serio_id_attr_group = { | 485 | static struct attribute_group serio_device_attr_group = { |
476 | .name = "id", | 486 | .attrs = serio_device_attrs, |
477 | .attrs = serio_device_id_attrs, | ||
478 | }; | 487 | }; |
479 | 488 | ||
480 | static const struct attribute_group *serio_device_attr_groups[] = { | 489 | static const struct attribute_group *serio_device_attr_groups[] = { |
481 | &serio_id_attr_group, | 490 | &serio_id_attr_group, |
491 | &serio_device_attr_group, | ||
482 | NULL | 492 | NULL |
483 | }; | 493 | }; |
484 | 494 | ||
diff --git a/drivers/input/touchscreen/sur40.c b/drivers/input/touchscreen/sur40.c index cfd1b7e8c001..f1cb05148b46 100644 --- a/drivers/input/touchscreen/sur40.c +++ b/drivers/input/touchscreen/sur40.c | |||
@@ -251,7 +251,7 @@ static void sur40_poll(struct input_polled_dev *polldev) | |||
251 | struct sur40_state *sur40 = polldev->private; | 251 | struct sur40_state *sur40 = polldev->private; |
252 | struct input_dev *input = polldev->input; | 252 | struct input_dev *input = polldev->input; |
253 | int result, bulk_read, need_blobs, packet_blobs, i; | 253 | int result, bulk_read, need_blobs, packet_blobs, i; |
254 | u32 packet_id; | 254 | u32 uninitialized_var(packet_id); |
255 | 255 | ||
256 | struct sur40_header *header = &sur40->bulk_in_buffer->header; | 256 | struct sur40_header *header = &sur40->bulk_in_buffer->header; |
257 | struct sur40_blob *inblob = &sur40->bulk_in_buffer->blobs[0]; | 257 | struct sur40_blob *inblob = &sur40->bulk_in_buffer->blobs[0]; |
@@ -286,7 +286,7 @@ static void sur40_poll(struct input_polled_dev *polldev) | |||
286 | if (need_blobs == -1) { | 286 | if (need_blobs == -1) { |
287 | need_blobs = le16_to_cpu(header->count); | 287 | need_blobs = le16_to_cpu(header->count); |
288 | dev_dbg(sur40->dev, "need %d blobs\n", need_blobs); | 288 | dev_dbg(sur40->dev, "need %d blobs\n", need_blobs); |
289 | packet_id = header->packet_id; | 289 | packet_id = le32_to_cpu(header->packet_id); |
290 | } | 290 | } |
291 | 291 | ||
292 | /* | 292 | /* |
diff --git a/drivers/input/touchscreen/usbtouchscreen.c b/drivers/input/touchscreen/usbtouchscreen.c index ae4b6b903629..5f87bed05467 100644 --- a/drivers/input/touchscreen/usbtouchscreen.c +++ b/drivers/input/touchscreen/usbtouchscreen.c | |||
@@ -106,6 +106,7 @@ struct usbtouch_device_info { | |||
106 | struct usbtouch_usb { | 106 | struct usbtouch_usb { |
107 | unsigned char *data; | 107 | unsigned char *data; |
108 | dma_addr_t data_dma; | 108 | dma_addr_t data_dma; |
109 | int data_size; | ||
109 | unsigned char *buffer; | 110 | unsigned char *buffer; |
110 | int buf_len; | 111 | int buf_len; |
111 | struct urb *irq; | 112 | struct urb *irq; |
@@ -1521,7 +1522,7 @@ static int usbtouch_reset_resume(struct usb_interface *intf) | |||
1521 | static void usbtouch_free_buffers(struct usb_device *udev, | 1522 | static void usbtouch_free_buffers(struct usb_device *udev, |
1522 | struct usbtouch_usb *usbtouch) | 1523 | struct usbtouch_usb *usbtouch) |
1523 | { | 1524 | { |
1524 | usb_free_coherent(udev, usbtouch->type->rept_size, | 1525 | usb_free_coherent(udev, usbtouch->data_size, |
1525 | usbtouch->data, usbtouch->data_dma); | 1526 | usbtouch->data, usbtouch->data_dma); |
1526 | kfree(usbtouch->buffer); | 1527 | kfree(usbtouch->buffer); |
1527 | } | 1528 | } |
@@ -1566,7 +1567,20 @@ static int usbtouch_probe(struct usb_interface *intf, | |||
1566 | if (!type->process_pkt) | 1567 | if (!type->process_pkt) |
1567 | type->process_pkt = usbtouch_process_pkt; | 1568 | type->process_pkt = usbtouch_process_pkt; |
1568 | 1569 | ||
1569 | usbtouch->data = usb_alloc_coherent(udev, type->rept_size, | 1570 | usbtouch->data_size = type->rept_size; |
1571 | if (type->get_pkt_len) { | ||
1572 | /* | ||
1573 | * When dealing with variable-length packets we should | ||
1574 | * not request more than wMaxPacketSize bytes at once | ||
1575 | * as we do not know if there is more data coming or | ||
1576 | * we filled exactly wMaxPacketSize bytes and there is | ||
1577 | * nothing else. | ||
1578 | */ | ||
1579 | usbtouch->data_size = min(usbtouch->data_size, | ||
1580 | usb_endpoint_maxp(endpoint)); | ||
1581 | } | ||
1582 | |||
1583 | usbtouch->data = usb_alloc_coherent(udev, usbtouch->data_size, | ||
1570 | GFP_KERNEL, &usbtouch->data_dma); | 1584 | GFP_KERNEL, &usbtouch->data_dma); |
1571 | if (!usbtouch->data) | 1585 | if (!usbtouch->data) |
1572 | goto out_free; | 1586 | goto out_free; |
@@ -1626,12 +1640,12 @@ static int usbtouch_probe(struct usb_interface *intf, | |||
1626 | if (usb_endpoint_type(endpoint) == USB_ENDPOINT_XFER_INT) | 1640 | if (usb_endpoint_type(endpoint) == USB_ENDPOINT_XFER_INT) |
1627 | usb_fill_int_urb(usbtouch->irq, udev, | 1641 | usb_fill_int_urb(usbtouch->irq, udev, |
1628 | usb_rcvintpipe(udev, endpoint->bEndpointAddress), | 1642 | usb_rcvintpipe(udev, endpoint->bEndpointAddress), |
1629 | usbtouch->data, type->rept_size, | 1643 | usbtouch->data, usbtouch->data_size, |
1630 | usbtouch_irq, usbtouch, endpoint->bInterval); | 1644 | usbtouch_irq, usbtouch, endpoint->bInterval); |
1631 | else | 1645 | else |
1632 | usb_fill_bulk_urb(usbtouch->irq, udev, | 1646 | usb_fill_bulk_urb(usbtouch->irq, udev, |
1633 | usb_rcvbulkpipe(udev, endpoint->bEndpointAddress), | 1647 | usb_rcvbulkpipe(udev, endpoint->bEndpointAddress), |
1634 | usbtouch->data, type->rept_size, | 1648 | usbtouch->data, usbtouch->data_size, |
1635 | usbtouch_irq, usbtouch); | 1649 | usbtouch_irq, usbtouch); |
1636 | 1650 | ||
1637 | usbtouch->irq->dev = udev; | 1651 | usbtouch->irq->dev = udev; |
diff --git a/drivers/iommu/arm-smmu.c b/drivers/iommu/arm-smmu.c index 1abfb5684ab7..e46a88700b68 100644 --- a/drivers/iommu/arm-smmu.c +++ b/drivers/iommu/arm-smmu.c | |||
@@ -392,7 +392,7 @@ struct arm_smmu_domain { | |||
392 | struct arm_smmu_cfg root_cfg; | 392 | struct arm_smmu_cfg root_cfg; |
393 | phys_addr_t output_mask; | 393 | phys_addr_t output_mask; |
394 | 394 | ||
395 | spinlock_t lock; | 395 | struct mutex lock; |
396 | }; | 396 | }; |
397 | 397 | ||
398 | static DEFINE_SPINLOCK(arm_smmu_devices_lock); | 398 | static DEFINE_SPINLOCK(arm_smmu_devices_lock); |
@@ -900,7 +900,7 @@ static int arm_smmu_domain_init(struct iommu_domain *domain) | |||
900 | goto out_free_domain; | 900 | goto out_free_domain; |
901 | smmu_domain->root_cfg.pgd = pgd; | 901 | smmu_domain->root_cfg.pgd = pgd; |
902 | 902 | ||
903 | spin_lock_init(&smmu_domain->lock); | 903 | mutex_init(&smmu_domain->lock); |
904 | domain->priv = smmu_domain; | 904 | domain->priv = smmu_domain; |
905 | return 0; | 905 | return 0; |
906 | 906 | ||
@@ -1137,7 +1137,7 @@ static int arm_smmu_attach_dev(struct iommu_domain *domain, struct device *dev) | |||
1137 | * Sanity check the domain. We don't currently support domains | 1137 | * Sanity check the domain. We don't currently support domains |
1138 | * that cross between different SMMU chains. | 1138 | * that cross between different SMMU chains. |
1139 | */ | 1139 | */ |
1140 | spin_lock(&smmu_domain->lock); | 1140 | mutex_lock(&smmu_domain->lock); |
1141 | if (!smmu_domain->leaf_smmu) { | 1141 | if (!smmu_domain->leaf_smmu) { |
1142 | /* Now that we have a master, we can finalise the domain */ | 1142 | /* Now that we have a master, we can finalise the domain */ |
1143 | ret = arm_smmu_init_domain_context(domain, dev); | 1143 | ret = arm_smmu_init_domain_context(domain, dev); |
@@ -1152,7 +1152,7 @@ static int arm_smmu_attach_dev(struct iommu_domain *domain, struct device *dev) | |||
1152 | dev_name(device_smmu->dev)); | 1152 | dev_name(device_smmu->dev)); |
1153 | goto err_unlock; | 1153 | goto err_unlock; |
1154 | } | 1154 | } |
1155 | spin_unlock(&smmu_domain->lock); | 1155 | mutex_unlock(&smmu_domain->lock); |
1156 | 1156 | ||
1157 | /* Looks ok, so add the device to the domain */ | 1157 | /* Looks ok, so add the device to the domain */ |
1158 | master = find_smmu_master(smmu_domain->leaf_smmu, dev->of_node); | 1158 | master = find_smmu_master(smmu_domain->leaf_smmu, dev->of_node); |
@@ -1162,7 +1162,7 @@ static int arm_smmu_attach_dev(struct iommu_domain *domain, struct device *dev) | |||
1162 | return arm_smmu_domain_add_master(smmu_domain, master); | 1162 | return arm_smmu_domain_add_master(smmu_domain, master); |
1163 | 1163 | ||
1164 | err_unlock: | 1164 | err_unlock: |
1165 | spin_unlock(&smmu_domain->lock); | 1165 | mutex_unlock(&smmu_domain->lock); |
1166 | return ret; | 1166 | return ret; |
1167 | } | 1167 | } |
1168 | 1168 | ||
@@ -1394,7 +1394,7 @@ static int arm_smmu_handle_mapping(struct arm_smmu_domain *smmu_domain, | |||
1394 | if (paddr & ~output_mask) | 1394 | if (paddr & ~output_mask) |
1395 | return -ERANGE; | 1395 | return -ERANGE; |
1396 | 1396 | ||
1397 | spin_lock(&smmu_domain->lock); | 1397 | mutex_lock(&smmu_domain->lock); |
1398 | pgd += pgd_index(iova); | 1398 | pgd += pgd_index(iova); |
1399 | end = iova + size; | 1399 | end = iova + size; |
1400 | do { | 1400 | do { |
@@ -1410,7 +1410,7 @@ static int arm_smmu_handle_mapping(struct arm_smmu_domain *smmu_domain, | |||
1410 | } while (pgd++, iova != end); | 1410 | } while (pgd++, iova != end); |
1411 | 1411 | ||
1412 | out_unlock: | 1412 | out_unlock: |
1413 | spin_unlock(&smmu_domain->lock); | 1413 | mutex_unlock(&smmu_domain->lock); |
1414 | 1414 | ||
1415 | /* Ensure new page tables are visible to the hardware walker */ | 1415 | /* Ensure new page tables are visible to the hardware walker */ |
1416 | if (smmu->features & ARM_SMMU_FEAT_COHERENT_WALK) | 1416 | if (smmu->features & ARM_SMMU_FEAT_COHERENT_WALK) |
@@ -1423,9 +1423,8 @@ static int arm_smmu_map(struct iommu_domain *domain, unsigned long iova, | |||
1423 | phys_addr_t paddr, size_t size, int flags) | 1423 | phys_addr_t paddr, size_t size, int flags) |
1424 | { | 1424 | { |
1425 | struct arm_smmu_domain *smmu_domain = domain->priv; | 1425 | struct arm_smmu_domain *smmu_domain = domain->priv; |
1426 | struct arm_smmu_device *smmu = smmu_domain->leaf_smmu; | ||
1427 | 1426 | ||
1428 | if (!smmu_domain || !smmu) | 1427 | if (!smmu_domain) |
1429 | return -ENODEV; | 1428 | return -ENODEV; |
1430 | 1429 | ||
1431 | /* Check for silent address truncation up the SMMU chain. */ | 1430 | /* Check for silent address truncation up the SMMU chain. */ |
@@ -1449,44 +1448,34 @@ static size_t arm_smmu_unmap(struct iommu_domain *domain, unsigned long iova, | |||
1449 | static phys_addr_t arm_smmu_iova_to_phys(struct iommu_domain *domain, | 1448 | static phys_addr_t arm_smmu_iova_to_phys(struct iommu_domain *domain, |
1450 | dma_addr_t iova) | 1449 | dma_addr_t iova) |
1451 | { | 1450 | { |
1452 | pgd_t *pgd; | 1451 | pgd_t *pgdp, pgd; |
1453 | pud_t *pud; | 1452 | pud_t pud; |
1454 | pmd_t *pmd; | 1453 | pmd_t pmd; |
1455 | pte_t *pte; | 1454 | pte_t pte; |
1456 | struct arm_smmu_domain *smmu_domain = domain->priv; | 1455 | struct arm_smmu_domain *smmu_domain = domain->priv; |
1457 | struct arm_smmu_cfg *root_cfg = &smmu_domain->root_cfg; | 1456 | struct arm_smmu_cfg *root_cfg = &smmu_domain->root_cfg; |
1458 | struct arm_smmu_device *smmu = root_cfg->smmu; | ||
1459 | 1457 | ||
1460 | spin_lock(&smmu_domain->lock); | 1458 | pgdp = root_cfg->pgd; |
1461 | pgd = root_cfg->pgd; | 1459 | if (!pgdp) |
1462 | if (!pgd) | 1460 | return 0; |
1463 | goto err_unlock; | ||
1464 | 1461 | ||
1465 | pgd += pgd_index(iova); | 1462 | pgd = *(pgdp + pgd_index(iova)); |
1466 | if (pgd_none_or_clear_bad(pgd)) | 1463 | if (pgd_none(pgd)) |
1467 | goto err_unlock; | 1464 | return 0; |
1468 | 1465 | ||
1469 | pud = pud_offset(pgd, iova); | 1466 | pud = *pud_offset(&pgd, iova); |
1470 | if (pud_none_or_clear_bad(pud)) | 1467 | if (pud_none(pud)) |
1471 | goto err_unlock; | 1468 | return 0; |
1472 | 1469 | ||
1473 | pmd = pmd_offset(pud, iova); | 1470 | pmd = *pmd_offset(&pud, iova); |
1474 | if (pmd_none_or_clear_bad(pmd)) | 1471 | if (pmd_none(pmd)) |
1475 | goto err_unlock; | 1472 | return 0; |
1476 | 1473 | ||
1477 | pte = pmd_page_vaddr(*pmd) + pte_index(iova); | 1474 | pte = *(pmd_page_vaddr(pmd) + pte_index(iova)); |
1478 | if (pte_none(pte)) | 1475 | if (pte_none(pte)) |
1479 | goto err_unlock; | 1476 | return 0; |
1480 | |||
1481 | spin_unlock(&smmu_domain->lock); | ||
1482 | return __pfn_to_phys(pte_pfn(*pte)) | (iova & ~PAGE_MASK); | ||
1483 | 1477 | ||
1484 | err_unlock: | 1478 | return __pfn_to_phys(pte_pfn(pte)) | (iova & ~PAGE_MASK); |
1485 | spin_unlock(&smmu_domain->lock); | ||
1486 | dev_warn(smmu->dev, | ||
1487 | "invalid (corrupt?) page tables detected for iova 0x%llx\n", | ||
1488 | (unsigned long long)iova); | ||
1489 | return -EINVAL; | ||
1490 | } | 1479 | } |
1491 | 1480 | ||
1492 | static int arm_smmu_domain_has_cap(struct iommu_domain *domain, | 1481 | static int arm_smmu_domain_has_cap(struct iommu_domain *domain, |
@@ -1863,6 +1852,7 @@ static int arm_smmu_device_dt_probe(struct platform_device *pdev) | |||
1863 | dev_err(dev, | 1852 | dev_err(dev, |
1864 | "found only %d context interrupt(s) but %d required\n", | 1853 | "found only %d context interrupt(s) but %d required\n", |
1865 | smmu->num_context_irqs, smmu->num_context_banks); | 1854 | smmu->num_context_irqs, smmu->num_context_banks); |
1855 | err = -ENODEV; | ||
1866 | goto out_put_parent; | 1856 | goto out_put_parent; |
1867 | } | 1857 | } |
1868 | 1858 | ||
diff --git a/drivers/irqchip/irq-gic.c b/drivers/irqchip/irq-gic.c index 9031171c141b..341c6016812d 100644 --- a/drivers/irqchip/irq-gic.c +++ b/drivers/irqchip/irq-gic.c | |||
@@ -957,12 +957,13 @@ void __init gic_init_bases(unsigned int gic_nr, int irq_start, | |||
957 | if (WARN_ON(!gic->domain)) | 957 | if (WARN_ON(!gic->domain)) |
958 | return; | 958 | return; |
959 | 959 | ||
960 | if (gic_nr == 0) { | ||
960 | #ifdef CONFIG_SMP | 961 | #ifdef CONFIG_SMP |
961 | set_smp_cross_call(gic_raise_softirq); | 962 | set_smp_cross_call(gic_raise_softirq); |
962 | register_cpu_notifier(&gic_cpu_notifier); | 963 | register_cpu_notifier(&gic_cpu_notifier); |
963 | #endif | 964 | #endif |
964 | 965 | set_handle_irq(gic_handle_irq); | |
965 | set_handle_irq(gic_handle_irq); | 966 | } |
966 | 967 | ||
967 | gic_chip.flags |= gic_arch_extn.flags; | 968 | gic_chip.flags |= gic_arch_extn.flags; |
968 | gic_dist_init(gic); | 969 | gic_dist_init(gic); |
diff --git a/drivers/leds/leds-pwm.c b/drivers/leds/leds-pwm.c index 2848171b8576..b31d8e99c419 100644 --- a/drivers/leds/leds-pwm.c +++ b/drivers/leds/leds-pwm.c | |||
@@ -82,22 +82,12 @@ static inline size_t sizeof_pwm_leds_priv(int num_leds) | |||
82 | (sizeof(struct led_pwm_data) * num_leds); | 82 | (sizeof(struct led_pwm_data) * num_leds); |
83 | } | 83 | } |
84 | 84 | ||
85 | static struct led_pwm_priv *led_pwm_create_of(struct platform_device *pdev) | 85 | static int led_pwm_create_of(struct platform_device *pdev, |
86 | struct led_pwm_priv *priv) | ||
86 | { | 87 | { |
87 | struct device_node *node = pdev->dev.of_node; | 88 | struct device_node *node = pdev->dev.of_node; |
88 | struct device_node *child; | 89 | struct device_node *child; |
89 | struct led_pwm_priv *priv; | 90 | int ret; |
90 | int count, ret; | ||
91 | |||
92 | /* count LEDs in this device, so we know how much to allocate */ | ||
93 | count = of_get_child_count(node); | ||
94 | if (!count) | ||
95 | return NULL; | ||
96 | |||
97 | priv = devm_kzalloc(&pdev->dev, sizeof_pwm_leds_priv(count), | ||
98 | GFP_KERNEL); | ||
99 | if (!priv) | ||
100 | return NULL; | ||
101 | 91 | ||
102 | for_each_child_of_node(node, child) { | 92 | for_each_child_of_node(node, child) { |
103 | struct led_pwm_data *led_dat = &priv->leds[priv->num_leds]; | 93 | struct led_pwm_data *led_dat = &priv->leds[priv->num_leds]; |
@@ -109,6 +99,7 @@ static struct led_pwm_priv *led_pwm_create_of(struct platform_device *pdev) | |||
109 | if (IS_ERR(led_dat->pwm)) { | 99 | if (IS_ERR(led_dat->pwm)) { |
110 | dev_err(&pdev->dev, "unable to request PWM for %s\n", | 100 | dev_err(&pdev->dev, "unable to request PWM for %s\n", |
111 | led_dat->cdev.name); | 101 | led_dat->cdev.name); |
102 | ret = PTR_ERR(led_dat->pwm); | ||
112 | goto err; | 103 | goto err; |
113 | } | 104 | } |
114 | /* Get the period from PWM core when n*/ | 105 | /* Get the period from PWM core when n*/ |
@@ -137,28 +128,36 @@ static struct led_pwm_priv *led_pwm_create_of(struct platform_device *pdev) | |||
137 | priv->num_leds++; | 128 | priv->num_leds++; |
138 | } | 129 | } |
139 | 130 | ||
140 | return priv; | 131 | return 0; |
141 | err: | 132 | err: |
142 | while (priv->num_leds--) | 133 | while (priv->num_leds--) |
143 | led_classdev_unregister(&priv->leds[priv->num_leds].cdev); | 134 | led_classdev_unregister(&priv->leds[priv->num_leds].cdev); |
144 | 135 | ||
145 | return NULL; | 136 | return ret; |
146 | } | 137 | } |
147 | 138 | ||
148 | static int led_pwm_probe(struct platform_device *pdev) | 139 | static int led_pwm_probe(struct platform_device *pdev) |
149 | { | 140 | { |
150 | struct led_pwm_platform_data *pdata = dev_get_platdata(&pdev->dev); | 141 | struct led_pwm_platform_data *pdata = dev_get_platdata(&pdev->dev); |
151 | struct led_pwm_priv *priv; | 142 | struct led_pwm_priv *priv; |
152 | int i, ret = 0; | 143 | int count, i; |
144 | int ret = 0; | ||
145 | |||
146 | if (pdata) | ||
147 | count = pdata->num_leds; | ||
148 | else | ||
149 | count = of_get_child_count(pdev->dev.of_node); | ||
150 | |||
151 | if (!count) | ||
152 | return -EINVAL; | ||
153 | 153 | ||
154 | if (pdata && pdata->num_leds) { | 154 | priv = devm_kzalloc(&pdev->dev, sizeof_pwm_leds_priv(count), |
155 | priv = devm_kzalloc(&pdev->dev, | 155 | GFP_KERNEL); |
156 | sizeof_pwm_leds_priv(pdata->num_leds), | 156 | if (!priv) |
157 | GFP_KERNEL); | 157 | return -ENOMEM; |
158 | if (!priv) | ||
159 | return -ENOMEM; | ||
160 | 158 | ||
161 | for (i = 0; i < pdata->num_leds; i++) { | 159 | if (pdata) { |
160 | for (i = 0; i < count; i++) { | ||
162 | struct led_pwm *cur_led = &pdata->leds[i]; | 161 | struct led_pwm *cur_led = &pdata->leds[i]; |
163 | struct led_pwm_data *led_dat = &priv->leds[i]; | 162 | struct led_pwm_data *led_dat = &priv->leds[i]; |
164 | 163 | ||
@@ -188,11 +187,11 @@ static int led_pwm_probe(struct platform_device *pdev) | |||
188 | if (ret < 0) | 187 | if (ret < 0) |
189 | goto err; | 188 | goto err; |
190 | } | 189 | } |
191 | priv->num_leds = pdata->num_leds; | 190 | priv->num_leds = count; |
192 | } else { | 191 | } else { |
193 | priv = led_pwm_create_of(pdev); | 192 | ret = led_pwm_create_of(pdev, priv); |
194 | if (!priv) | 193 | if (ret) |
195 | return -ENODEV; | 194 | return ret; |
196 | } | 195 | } |
197 | 196 | ||
198 | platform_set_drvdata(pdev, priv); | 197 | platform_set_drvdata(pdev, priv); |
diff --git a/drivers/md/dm-bufio.c b/drivers/md/dm-bufio.c index 173cbb20d104..54bdd923316f 100644 --- a/drivers/md/dm-bufio.c +++ b/drivers/md/dm-bufio.c | |||
@@ -1717,6 +1717,11 @@ static int __init dm_bufio_init(void) | |||
1717 | { | 1717 | { |
1718 | __u64 mem; | 1718 | __u64 mem; |
1719 | 1719 | ||
1720 | dm_bufio_allocated_kmem_cache = 0; | ||
1721 | dm_bufio_allocated_get_free_pages = 0; | ||
1722 | dm_bufio_allocated_vmalloc = 0; | ||
1723 | dm_bufio_current_allocated = 0; | ||
1724 | |||
1720 | memset(&dm_bufio_caches, 0, sizeof dm_bufio_caches); | 1725 | memset(&dm_bufio_caches, 0, sizeof dm_bufio_caches); |
1721 | memset(&dm_bufio_cache_names, 0, sizeof dm_bufio_cache_names); | 1726 | memset(&dm_bufio_cache_names, 0, sizeof dm_bufio_cache_names); |
1722 | 1727 | ||
diff --git a/drivers/md/dm-cache-policy-mq.c b/drivers/md/dm-cache-policy-mq.c index 416b7b752a6e..64780ad73bb0 100644 --- a/drivers/md/dm-cache-policy-mq.c +++ b/drivers/md/dm-cache-policy-mq.c | |||
@@ -730,15 +730,18 @@ static int pre_cache_entry_found(struct mq_policy *mq, struct entry *e, | |||
730 | int r = 0; | 730 | int r = 0; |
731 | bool updated = updated_this_tick(mq, e); | 731 | bool updated = updated_this_tick(mq, e); |
732 | 732 | ||
733 | requeue_and_update_tick(mq, e); | ||
734 | |||
735 | if ((!discarded_oblock && updated) || | 733 | if ((!discarded_oblock && updated) || |
736 | !should_promote(mq, e, discarded_oblock, data_dir)) | 734 | !should_promote(mq, e, discarded_oblock, data_dir)) { |
735 | requeue_and_update_tick(mq, e); | ||
737 | result->op = POLICY_MISS; | 736 | result->op = POLICY_MISS; |
738 | else if (!can_migrate) | 737 | |
738 | } else if (!can_migrate) | ||
739 | r = -EWOULDBLOCK; | 739 | r = -EWOULDBLOCK; |
740 | else | 740 | |
741 | else { | ||
742 | requeue_and_update_tick(mq, e); | ||
741 | r = pre_cache_to_cache(mq, e, result); | 743 | r = pre_cache_to_cache(mq, e, result); |
744 | } | ||
742 | 745 | ||
743 | return r; | 746 | return r; |
744 | } | 747 | } |
diff --git a/drivers/md/dm-cache-target.c b/drivers/md/dm-cache-target.c index 9efcf1059b99..1b1469ebe5cb 100644 --- a/drivers/md/dm-cache-target.c +++ b/drivers/md/dm-cache-target.c | |||
@@ -2755,7 +2755,7 @@ static int resize_cache_dev(struct cache *cache, dm_cblock_t new_size) | |||
2755 | { | 2755 | { |
2756 | int r; | 2756 | int r; |
2757 | 2757 | ||
2758 | r = dm_cache_resize(cache->cmd, cache->cache_size); | 2758 | r = dm_cache_resize(cache->cmd, new_size); |
2759 | if (r) { | 2759 | if (r) { |
2760 | DMERR("could not resize cache metadata"); | 2760 | DMERR("could not resize cache metadata"); |
2761 | return r; | 2761 | return r; |
diff --git a/drivers/md/dm-delay.c b/drivers/md/dm-delay.c index 496d5f3646a5..2f91d6d4a2cc 100644 --- a/drivers/md/dm-delay.c +++ b/drivers/md/dm-delay.c | |||
@@ -20,6 +20,7 @@ | |||
20 | struct delay_c { | 20 | struct delay_c { |
21 | struct timer_list delay_timer; | 21 | struct timer_list delay_timer; |
22 | struct mutex timer_lock; | 22 | struct mutex timer_lock; |
23 | struct workqueue_struct *kdelayd_wq; | ||
23 | struct work_struct flush_expired_bios; | 24 | struct work_struct flush_expired_bios; |
24 | struct list_head delayed_bios; | 25 | struct list_head delayed_bios; |
25 | atomic_t may_delay; | 26 | atomic_t may_delay; |
@@ -45,14 +46,13 @@ struct dm_delay_info { | |||
45 | 46 | ||
46 | static DEFINE_MUTEX(delayed_bios_lock); | 47 | static DEFINE_MUTEX(delayed_bios_lock); |
47 | 48 | ||
48 | static struct workqueue_struct *kdelayd_wq; | ||
49 | static struct kmem_cache *delayed_cache; | 49 | static struct kmem_cache *delayed_cache; |
50 | 50 | ||
51 | static void handle_delayed_timer(unsigned long data) | 51 | static void handle_delayed_timer(unsigned long data) |
52 | { | 52 | { |
53 | struct delay_c *dc = (struct delay_c *)data; | 53 | struct delay_c *dc = (struct delay_c *)data; |
54 | 54 | ||
55 | queue_work(kdelayd_wq, &dc->flush_expired_bios); | 55 | queue_work(dc->kdelayd_wq, &dc->flush_expired_bios); |
56 | } | 56 | } |
57 | 57 | ||
58 | static void queue_timeout(struct delay_c *dc, unsigned long expires) | 58 | static void queue_timeout(struct delay_c *dc, unsigned long expires) |
@@ -191,6 +191,12 @@ out: | |||
191 | goto bad_dev_write; | 191 | goto bad_dev_write; |
192 | } | 192 | } |
193 | 193 | ||
194 | dc->kdelayd_wq = alloc_workqueue("kdelayd", WQ_MEM_RECLAIM, 0); | ||
195 | if (!dc->kdelayd_wq) { | ||
196 | DMERR("Couldn't start kdelayd"); | ||
197 | goto bad_queue; | ||
198 | } | ||
199 | |||
194 | setup_timer(&dc->delay_timer, handle_delayed_timer, (unsigned long)dc); | 200 | setup_timer(&dc->delay_timer, handle_delayed_timer, (unsigned long)dc); |
195 | 201 | ||
196 | INIT_WORK(&dc->flush_expired_bios, flush_expired_bios); | 202 | INIT_WORK(&dc->flush_expired_bios, flush_expired_bios); |
@@ -203,6 +209,8 @@ out: | |||
203 | ti->private = dc; | 209 | ti->private = dc; |
204 | return 0; | 210 | return 0; |
205 | 211 | ||
212 | bad_queue: | ||
213 | mempool_destroy(dc->delayed_pool); | ||
206 | bad_dev_write: | 214 | bad_dev_write: |
207 | if (dc->dev_write) | 215 | if (dc->dev_write) |
208 | dm_put_device(ti, dc->dev_write); | 216 | dm_put_device(ti, dc->dev_write); |
@@ -217,7 +225,7 @@ static void delay_dtr(struct dm_target *ti) | |||
217 | { | 225 | { |
218 | struct delay_c *dc = ti->private; | 226 | struct delay_c *dc = ti->private; |
219 | 227 | ||
220 | flush_workqueue(kdelayd_wq); | 228 | destroy_workqueue(dc->kdelayd_wq); |
221 | 229 | ||
222 | dm_put_device(ti, dc->dev_read); | 230 | dm_put_device(ti, dc->dev_read); |
223 | 231 | ||
@@ -350,12 +358,6 @@ static int __init dm_delay_init(void) | |||
350 | { | 358 | { |
351 | int r = -ENOMEM; | 359 | int r = -ENOMEM; |
352 | 360 | ||
353 | kdelayd_wq = alloc_workqueue("kdelayd", WQ_MEM_RECLAIM, 0); | ||
354 | if (!kdelayd_wq) { | ||
355 | DMERR("Couldn't start kdelayd"); | ||
356 | goto bad_queue; | ||
357 | } | ||
358 | |||
359 | delayed_cache = KMEM_CACHE(dm_delay_info, 0); | 361 | delayed_cache = KMEM_CACHE(dm_delay_info, 0); |
360 | if (!delayed_cache) { | 362 | if (!delayed_cache) { |
361 | DMERR("Couldn't create delayed bio cache."); | 363 | DMERR("Couldn't create delayed bio cache."); |
@@ -373,8 +375,6 @@ static int __init dm_delay_init(void) | |||
373 | bad_register: | 375 | bad_register: |
374 | kmem_cache_destroy(delayed_cache); | 376 | kmem_cache_destroy(delayed_cache); |
375 | bad_memcache: | 377 | bad_memcache: |
376 | destroy_workqueue(kdelayd_wq); | ||
377 | bad_queue: | ||
378 | return r; | 378 | return r; |
379 | } | 379 | } |
380 | 380 | ||
@@ -382,7 +382,6 @@ static void __exit dm_delay_exit(void) | |||
382 | { | 382 | { |
383 | dm_unregister_target(&delay_target); | 383 | dm_unregister_target(&delay_target); |
384 | kmem_cache_destroy(delayed_cache); | 384 | kmem_cache_destroy(delayed_cache); |
385 | destroy_workqueue(kdelayd_wq); | ||
386 | } | 385 | } |
387 | 386 | ||
388 | /* Module hooks */ | 387 | /* Module hooks */ |
diff --git a/drivers/md/dm-snap.c b/drivers/md/dm-snap.c index aec57d76db5d..944690bafd93 100644 --- a/drivers/md/dm-snap.c +++ b/drivers/md/dm-snap.c | |||
@@ -66,6 +66,18 @@ struct dm_snapshot { | |||
66 | 66 | ||
67 | atomic_t pending_exceptions_count; | 67 | atomic_t pending_exceptions_count; |
68 | 68 | ||
69 | /* Protected by "lock" */ | ||
70 | sector_t exception_start_sequence; | ||
71 | |||
72 | /* Protected by kcopyd single-threaded callback */ | ||
73 | sector_t exception_complete_sequence; | ||
74 | |||
75 | /* | ||
76 | * A list of pending exceptions that completed out of order. | ||
77 | * Protected by kcopyd single-threaded callback. | ||
78 | */ | ||
79 | struct list_head out_of_order_list; | ||
80 | |||
69 | mempool_t *pending_pool; | 81 | mempool_t *pending_pool; |
70 | 82 | ||
71 | struct dm_exception_table pending; | 83 | struct dm_exception_table pending; |
@@ -173,6 +185,14 @@ struct dm_snap_pending_exception { | |||
173 | */ | 185 | */ |
174 | int started; | 186 | int started; |
175 | 187 | ||
188 | /* There was copying error. */ | ||
189 | int copy_error; | ||
190 | |||
191 | /* A sequence number, it is used for in-order completion. */ | ||
192 | sector_t exception_sequence; | ||
193 | |||
194 | struct list_head out_of_order_entry; | ||
195 | |||
176 | /* | 196 | /* |
177 | * For writing a complete chunk, bypassing the copy. | 197 | * For writing a complete chunk, bypassing the copy. |
178 | */ | 198 | */ |
@@ -1094,6 +1114,9 @@ static int snapshot_ctr(struct dm_target *ti, unsigned int argc, char **argv) | |||
1094 | s->valid = 1; | 1114 | s->valid = 1; |
1095 | s->active = 0; | 1115 | s->active = 0; |
1096 | atomic_set(&s->pending_exceptions_count, 0); | 1116 | atomic_set(&s->pending_exceptions_count, 0); |
1117 | s->exception_start_sequence = 0; | ||
1118 | s->exception_complete_sequence = 0; | ||
1119 | INIT_LIST_HEAD(&s->out_of_order_list); | ||
1097 | init_rwsem(&s->lock); | 1120 | init_rwsem(&s->lock); |
1098 | INIT_LIST_HEAD(&s->list); | 1121 | INIT_LIST_HEAD(&s->list); |
1099 | spin_lock_init(&s->pe_lock); | 1122 | spin_lock_init(&s->pe_lock); |
@@ -1443,6 +1466,19 @@ static void commit_callback(void *context, int success) | |||
1443 | pending_complete(pe, success); | 1466 | pending_complete(pe, success); |
1444 | } | 1467 | } |
1445 | 1468 | ||
1469 | static void complete_exception(struct dm_snap_pending_exception *pe) | ||
1470 | { | ||
1471 | struct dm_snapshot *s = pe->snap; | ||
1472 | |||
1473 | if (unlikely(pe->copy_error)) | ||
1474 | pending_complete(pe, 0); | ||
1475 | |||
1476 | else | ||
1477 | /* Update the metadata if we are persistent */ | ||
1478 | s->store->type->commit_exception(s->store, &pe->e, | ||
1479 | commit_callback, pe); | ||
1480 | } | ||
1481 | |||
1446 | /* | 1482 | /* |
1447 | * Called when the copy I/O has finished. kcopyd actually runs | 1483 | * Called when the copy I/O has finished. kcopyd actually runs |
1448 | * this code so don't block. | 1484 | * this code so don't block. |
@@ -1452,13 +1488,32 @@ static void copy_callback(int read_err, unsigned long write_err, void *context) | |||
1452 | struct dm_snap_pending_exception *pe = context; | 1488 | struct dm_snap_pending_exception *pe = context; |
1453 | struct dm_snapshot *s = pe->snap; | 1489 | struct dm_snapshot *s = pe->snap; |
1454 | 1490 | ||
1455 | if (read_err || write_err) | 1491 | pe->copy_error = read_err || write_err; |
1456 | pending_complete(pe, 0); | ||
1457 | 1492 | ||
1458 | else | 1493 | if (pe->exception_sequence == s->exception_complete_sequence) { |
1459 | /* Update the metadata if we are persistent */ | 1494 | s->exception_complete_sequence++; |
1460 | s->store->type->commit_exception(s->store, &pe->e, | 1495 | complete_exception(pe); |
1461 | commit_callback, pe); | 1496 | |
1497 | while (!list_empty(&s->out_of_order_list)) { | ||
1498 | pe = list_entry(s->out_of_order_list.next, | ||
1499 | struct dm_snap_pending_exception, out_of_order_entry); | ||
1500 | if (pe->exception_sequence != s->exception_complete_sequence) | ||
1501 | break; | ||
1502 | s->exception_complete_sequence++; | ||
1503 | list_del(&pe->out_of_order_entry); | ||
1504 | complete_exception(pe); | ||
1505 | } | ||
1506 | } else { | ||
1507 | struct list_head *lh; | ||
1508 | struct dm_snap_pending_exception *pe2; | ||
1509 | |||
1510 | list_for_each_prev(lh, &s->out_of_order_list) { | ||
1511 | pe2 = list_entry(lh, struct dm_snap_pending_exception, out_of_order_entry); | ||
1512 | if (pe2->exception_sequence < pe->exception_sequence) | ||
1513 | break; | ||
1514 | } | ||
1515 | list_add(&pe->out_of_order_entry, lh); | ||
1516 | } | ||
1462 | } | 1517 | } |
1463 | 1518 | ||
1464 | /* | 1519 | /* |
@@ -1553,6 +1608,8 @@ __find_pending_exception(struct dm_snapshot *s, | |||
1553 | return NULL; | 1608 | return NULL; |
1554 | } | 1609 | } |
1555 | 1610 | ||
1611 | pe->exception_sequence = s->exception_start_sequence++; | ||
1612 | |||
1556 | dm_insert_exception(&s->pending, &pe->e); | 1613 | dm_insert_exception(&s->pending, &pe->e); |
1557 | 1614 | ||
1558 | return pe; | 1615 | return pe; |
@@ -2192,7 +2249,7 @@ static struct target_type origin_target = { | |||
2192 | 2249 | ||
2193 | static struct target_type snapshot_target = { | 2250 | static struct target_type snapshot_target = { |
2194 | .name = "snapshot", | 2251 | .name = "snapshot", |
2195 | .version = {1, 11, 1}, | 2252 | .version = {1, 12, 0}, |
2196 | .module = THIS_MODULE, | 2253 | .module = THIS_MODULE, |
2197 | .ctr = snapshot_ctr, | 2254 | .ctr = snapshot_ctr, |
2198 | .dtr = snapshot_dtr, | 2255 | .dtr = snapshot_dtr, |
diff --git a/drivers/md/dm-stats.c b/drivers/md/dm-stats.c index 3d404c1371ed..28a90122a5a8 100644 --- a/drivers/md/dm-stats.c +++ b/drivers/md/dm-stats.c | |||
@@ -964,6 +964,7 @@ int dm_stats_message(struct mapped_device *md, unsigned argc, char **argv, | |||
964 | 964 | ||
965 | int __init dm_statistics_init(void) | 965 | int __init dm_statistics_init(void) |
966 | { | 966 | { |
967 | shared_memory_amount = 0; | ||
967 | dm_stat_need_rcu_barrier = 0; | 968 | dm_stat_need_rcu_barrier = 0; |
968 | return 0; | 969 | return 0; |
969 | } | 970 | } |
diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c index 465f08ca62b1..3ba6a3859ce3 100644 --- a/drivers/md/dm-table.c +++ b/drivers/md/dm-table.c | |||
@@ -200,6 +200,11 @@ int dm_table_create(struct dm_table **result, fmode_t mode, | |||
200 | 200 | ||
201 | num_targets = dm_round_up(num_targets, KEYS_PER_NODE); | 201 | num_targets = dm_round_up(num_targets, KEYS_PER_NODE); |
202 | 202 | ||
203 | if (!num_targets) { | ||
204 | kfree(t); | ||
205 | return -ENOMEM; | ||
206 | } | ||
207 | |||
203 | if (alloc_targets(t, num_targets)) { | 208 | if (alloc_targets(t, num_targets)) { |
204 | kfree(t); | 209 | kfree(t); |
205 | return -ENOMEM; | 210 | return -ENOMEM; |
diff --git a/drivers/md/dm-thin-metadata.c b/drivers/md/dm-thin-metadata.c index 60bce435f4fa..8a30ad54bd46 100644 --- a/drivers/md/dm-thin-metadata.c +++ b/drivers/md/dm-thin-metadata.c | |||
@@ -1697,6 +1697,14 @@ void dm_pool_metadata_read_only(struct dm_pool_metadata *pmd) | |||
1697 | up_write(&pmd->root_lock); | 1697 | up_write(&pmd->root_lock); |
1698 | } | 1698 | } |
1699 | 1699 | ||
1700 | void dm_pool_metadata_read_write(struct dm_pool_metadata *pmd) | ||
1701 | { | ||
1702 | down_write(&pmd->root_lock); | ||
1703 | pmd->read_only = false; | ||
1704 | dm_bm_set_read_write(pmd->bm); | ||
1705 | up_write(&pmd->root_lock); | ||
1706 | } | ||
1707 | |||
1700 | int dm_pool_register_metadata_threshold(struct dm_pool_metadata *pmd, | 1708 | int dm_pool_register_metadata_threshold(struct dm_pool_metadata *pmd, |
1701 | dm_block_t threshold, | 1709 | dm_block_t threshold, |
1702 | dm_sm_threshold_fn fn, | 1710 | dm_sm_threshold_fn fn, |
diff --git a/drivers/md/dm-thin-metadata.h b/drivers/md/dm-thin-metadata.h index 845ebbe589a9..7bcc0e1d6238 100644 --- a/drivers/md/dm-thin-metadata.h +++ b/drivers/md/dm-thin-metadata.h | |||
@@ -193,6 +193,7 @@ int dm_pool_resize_metadata_dev(struct dm_pool_metadata *pmd, dm_block_t new_siz | |||
193 | * that nothing is changing. | 193 | * that nothing is changing. |
194 | */ | 194 | */ |
195 | void dm_pool_metadata_read_only(struct dm_pool_metadata *pmd); | 195 | void dm_pool_metadata_read_only(struct dm_pool_metadata *pmd); |
196 | void dm_pool_metadata_read_write(struct dm_pool_metadata *pmd); | ||
196 | 197 | ||
197 | int dm_pool_register_metadata_threshold(struct dm_pool_metadata *pmd, | 198 | int dm_pool_register_metadata_threshold(struct dm_pool_metadata *pmd, |
198 | dm_block_t threshold, | 199 | dm_block_t threshold, |
diff --git a/drivers/md/dm-thin.c b/drivers/md/dm-thin.c index 2c0cf511ec23..ee29037ffc2e 100644 --- a/drivers/md/dm-thin.c +++ b/drivers/md/dm-thin.c | |||
@@ -640,7 +640,9 @@ static void process_prepared_mapping(struct dm_thin_new_mapping *m) | |||
640 | */ | 640 | */ |
641 | r = dm_thin_insert_block(tc->td, m->virt_block, m->data_block); | 641 | r = dm_thin_insert_block(tc->td, m->virt_block, m->data_block); |
642 | if (r) { | 642 | if (r) { |
643 | DMERR_LIMIT("dm_thin_insert_block() failed"); | 643 | DMERR_LIMIT("%s: dm_thin_insert_block() failed: error = %d", |
644 | dm_device_name(pool->pool_md), r); | ||
645 | set_pool_mode(pool, PM_READ_ONLY); | ||
644 | cell_error(pool, m->cell); | 646 | cell_error(pool, m->cell); |
645 | goto out; | 647 | goto out; |
646 | } | 648 | } |
@@ -881,32 +883,23 @@ static void schedule_zero(struct thin_c *tc, dm_block_t virt_block, | |||
881 | } | 883 | } |
882 | } | 884 | } |
883 | 885 | ||
884 | static int commit(struct pool *pool) | ||
885 | { | ||
886 | int r; | ||
887 | |||
888 | r = dm_pool_commit_metadata(pool->pmd); | ||
889 | if (r) | ||
890 | DMERR_LIMIT("%s: commit failed: error = %d", | ||
891 | dm_device_name(pool->pool_md), r); | ||
892 | |||
893 | return r; | ||
894 | } | ||
895 | |||
896 | /* | 886 | /* |
897 | * A non-zero return indicates read_only or fail_io mode. | 887 | * A non-zero return indicates read_only or fail_io mode. |
898 | * Many callers don't care about the return value. | 888 | * Many callers don't care about the return value. |
899 | */ | 889 | */ |
900 | static int commit_or_fallback(struct pool *pool) | 890 | static int commit(struct pool *pool) |
901 | { | 891 | { |
902 | int r; | 892 | int r; |
903 | 893 | ||
904 | if (get_pool_mode(pool) != PM_WRITE) | 894 | if (get_pool_mode(pool) != PM_WRITE) |
905 | return -EINVAL; | 895 | return -EINVAL; |
906 | 896 | ||
907 | r = commit(pool); | 897 | r = dm_pool_commit_metadata(pool->pmd); |
908 | if (r) | 898 | if (r) { |
899 | DMERR_LIMIT("%s: dm_pool_commit_metadata failed: error = %d", | ||
900 | dm_device_name(pool->pool_md), r); | ||
909 | set_pool_mode(pool, PM_READ_ONLY); | 901 | set_pool_mode(pool, PM_READ_ONLY); |
902 | } | ||
910 | 903 | ||
911 | return r; | 904 | return r; |
912 | } | 905 | } |
@@ -943,7 +936,9 @@ static int alloc_data_block(struct thin_c *tc, dm_block_t *result) | |||
943 | * Try to commit to see if that will free up some | 936 | * Try to commit to see if that will free up some |
944 | * more space. | 937 | * more space. |
945 | */ | 938 | */ |
946 | (void) commit_or_fallback(pool); | 939 | r = commit(pool); |
940 | if (r) | ||
941 | return r; | ||
947 | 942 | ||
948 | r = dm_pool_get_free_block_count(pool->pmd, &free_blocks); | 943 | r = dm_pool_get_free_block_count(pool->pmd, &free_blocks); |
949 | if (r) | 944 | if (r) |
@@ -957,7 +952,7 @@ static int alloc_data_block(struct thin_c *tc, dm_block_t *result) | |||
957 | * table reload). | 952 | * table reload). |
958 | */ | 953 | */ |
959 | if (!free_blocks) { | 954 | if (!free_blocks) { |
960 | DMWARN("%s: no free space available.", | 955 | DMWARN("%s: no free data space available.", |
961 | dm_device_name(pool->pool_md)); | 956 | dm_device_name(pool->pool_md)); |
962 | spin_lock_irqsave(&pool->lock, flags); | 957 | spin_lock_irqsave(&pool->lock, flags); |
963 | pool->no_free_space = 1; | 958 | pool->no_free_space = 1; |
@@ -967,8 +962,16 @@ static int alloc_data_block(struct thin_c *tc, dm_block_t *result) | |||
967 | } | 962 | } |
968 | 963 | ||
969 | r = dm_pool_alloc_data_block(pool->pmd, result); | 964 | r = dm_pool_alloc_data_block(pool->pmd, result); |
970 | if (r) | 965 | if (r) { |
966 | if (r == -ENOSPC && | ||
967 | !dm_pool_get_free_metadata_block_count(pool->pmd, &free_blocks) && | ||
968 | !free_blocks) { | ||
969 | DMWARN("%s: no free metadata space available.", | ||
970 | dm_device_name(pool->pool_md)); | ||
971 | set_pool_mode(pool, PM_READ_ONLY); | ||
972 | } | ||
971 | return r; | 973 | return r; |
974 | } | ||
972 | 975 | ||
973 | return 0; | 976 | return 0; |
974 | } | 977 | } |
@@ -1349,7 +1352,7 @@ static void process_deferred_bios(struct pool *pool) | |||
1349 | if (bio_list_empty(&bios) && !need_commit_due_to_time(pool)) | 1352 | if (bio_list_empty(&bios) && !need_commit_due_to_time(pool)) |
1350 | return; | 1353 | return; |
1351 | 1354 | ||
1352 | if (commit_or_fallback(pool)) { | 1355 | if (commit(pool)) { |
1353 | while ((bio = bio_list_pop(&bios))) | 1356 | while ((bio = bio_list_pop(&bios))) |
1354 | bio_io_error(bio); | 1357 | bio_io_error(bio); |
1355 | return; | 1358 | return; |
@@ -1397,6 +1400,7 @@ static void set_pool_mode(struct pool *pool, enum pool_mode mode) | |||
1397 | case PM_FAIL: | 1400 | case PM_FAIL: |
1398 | DMERR("%s: switching pool to failure mode", | 1401 | DMERR("%s: switching pool to failure mode", |
1399 | dm_device_name(pool->pool_md)); | 1402 | dm_device_name(pool->pool_md)); |
1403 | dm_pool_metadata_read_only(pool->pmd); | ||
1400 | pool->process_bio = process_bio_fail; | 1404 | pool->process_bio = process_bio_fail; |
1401 | pool->process_discard = process_bio_fail; | 1405 | pool->process_discard = process_bio_fail; |
1402 | pool->process_prepared_mapping = process_prepared_mapping_fail; | 1406 | pool->process_prepared_mapping = process_prepared_mapping_fail; |
@@ -1421,6 +1425,7 @@ static void set_pool_mode(struct pool *pool, enum pool_mode mode) | |||
1421 | break; | 1425 | break; |
1422 | 1426 | ||
1423 | case PM_WRITE: | 1427 | case PM_WRITE: |
1428 | dm_pool_metadata_read_write(pool->pmd); | ||
1424 | pool->process_bio = process_bio; | 1429 | pool->process_bio = process_bio; |
1425 | pool->process_discard = process_discard; | 1430 | pool->process_discard = process_discard; |
1426 | pool->process_prepared_mapping = process_prepared_mapping; | 1431 | pool->process_prepared_mapping = process_prepared_mapping; |
@@ -1637,12 +1642,19 @@ static int bind_control_target(struct pool *pool, struct dm_target *ti) | |||
1637 | struct pool_c *pt = ti->private; | 1642 | struct pool_c *pt = ti->private; |
1638 | 1643 | ||
1639 | /* | 1644 | /* |
1640 | * We want to make sure that degraded pools are never upgraded. | 1645 | * We want to make sure that a pool in PM_FAIL mode is never upgraded. |
1641 | */ | 1646 | */ |
1642 | enum pool_mode old_mode = pool->pf.mode; | 1647 | enum pool_mode old_mode = pool->pf.mode; |
1643 | enum pool_mode new_mode = pt->adjusted_pf.mode; | 1648 | enum pool_mode new_mode = pt->adjusted_pf.mode; |
1644 | 1649 | ||
1645 | if (old_mode > new_mode) | 1650 | /* |
1651 | * If we were in PM_FAIL mode, rollback of metadata failed. We're | ||
1652 | * not going to recover without a thin_repair. So we never let the | ||
1653 | * pool move out of the old mode. On the other hand a PM_READ_ONLY | ||
1654 | * may have been due to a lack of metadata or data space, and may | ||
1655 | * now work (ie. if the underlying devices have been resized). | ||
1656 | */ | ||
1657 | if (old_mode == PM_FAIL) | ||
1646 | new_mode = old_mode; | 1658 | new_mode = old_mode; |
1647 | 1659 | ||
1648 | pool->ti = ti; | 1660 | pool->ti = ti; |
@@ -2266,7 +2278,7 @@ static int pool_preresume(struct dm_target *ti) | |||
2266 | return r; | 2278 | return r; |
2267 | 2279 | ||
2268 | if (need_commit1 || need_commit2) | 2280 | if (need_commit1 || need_commit2) |
2269 | (void) commit_or_fallback(pool); | 2281 | (void) commit(pool); |
2270 | 2282 | ||
2271 | return 0; | 2283 | return 0; |
2272 | } | 2284 | } |
@@ -2293,7 +2305,7 @@ static void pool_postsuspend(struct dm_target *ti) | |||
2293 | 2305 | ||
2294 | cancel_delayed_work(&pool->waker); | 2306 | cancel_delayed_work(&pool->waker); |
2295 | flush_workqueue(pool->wq); | 2307 | flush_workqueue(pool->wq); |
2296 | (void) commit_or_fallback(pool); | 2308 | (void) commit(pool); |
2297 | } | 2309 | } |
2298 | 2310 | ||
2299 | static int check_arg_count(unsigned argc, unsigned args_required) | 2311 | static int check_arg_count(unsigned argc, unsigned args_required) |
@@ -2427,7 +2439,7 @@ static int process_reserve_metadata_snap_mesg(unsigned argc, char **argv, struct | |||
2427 | if (r) | 2439 | if (r) |
2428 | return r; | 2440 | return r; |
2429 | 2441 | ||
2430 | (void) commit_or_fallback(pool); | 2442 | (void) commit(pool); |
2431 | 2443 | ||
2432 | r = dm_pool_reserve_metadata_snap(pool->pmd); | 2444 | r = dm_pool_reserve_metadata_snap(pool->pmd); |
2433 | if (r) | 2445 | if (r) |
@@ -2489,7 +2501,7 @@ static int pool_message(struct dm_target *ti, unsigned argc, char **argv) | |||
2489 | DMWARN("Unrecognised thin pool target message received: %s", argv[0]); | 2501 | DMWARN("Unrecognised thin pool target message received: %s", argv[0]); |
2490 | 2502 | ||
2491 | if (!r) | 2503 | if (!r) |
2492 | (void) commit_or_fallback(pool); | 2504 | (void) commit(pool); |
2493 | 2505 | ||
2494 | return r; | 2506 | return r; |
2495 | } | 2507 | } |
@@ -2544,7 +2556,7 @@ static void pool_status(struct dm_target *ti, status_type_t type, | |||
2544 | 2556 | ||
2545 | /* Commit to ensure statistics aren't out-of-date */ | 2557 | /* Commit to ensure statistics aren't out-of-date */ |
2546 | if (!(status_flags & DM_STATUS_NOFLUSH_FLAG) && !dm_suspended(ti)) | 2558 | if (!(status_flags & DM_STATUS_NOFLUSH_FLAG) && !dm_suspended(ti)) |
2547 | (void) commit_or_fallback(pool); | 2559 | (void) commit(pool); |
2548 | 2560 | ||
2549 | r = dm_pool_get_metadata_transaction_id(pool->pmd, &transaction_id); | 2561 | r = dm_pool_get_metadata_transaction_id(pool->pmd, &transaction_id); |
2550 | if (r) { | 2562 | if (r) { |
diff --git a/drivers/md/md.c b/drivers/md/md.c index e60cebf3f519..21f4d7ff0da2 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c | |||
@@ -776,16 +776,10 @@ void md_super_wait(struct mddev *mddev) | |||
776 | finish_wait(&mddev->sb_wait, &wq); | 776 | finish_wait(&mddev->sb_wait, &wq); |
777 | } | 777 | } |
778 | 778 | ||
779 | static void bi_complete(struct bio *bio, int error) | ||
780 | { | ||
781 | complete((struct completion*)bio->bi_private); | ||
782 | } | ||
783 | |||
784 | int sync_page_io(struct md_rdev *rdev, sector_t sector, int size, | 779 | int sync_page_io(struct md_rdev *rdev, sector_t sector, int size, |
785 | struct page *page, int rw, bool metadata_op) | 780 | struct page *page, int rw, bool metadata_op) |
786 | { | 781 | { |
787 | struct bio *bio = bio_alloc_mddev(GFP_NOIO, 1, rdev->mddev); | 782 | struct bio *bio = bio_alloc_mddev(GFP_NOIO, 1, rdev->mddev); |
788 | struct completion event; | ||
789 | int ret; | 783 | int ret; |
790 | 784 | ||
791 | rw |= REQ_SYNC; | 785 | rw |= REQ_SYNC; |
@@ -801,11 +795,7 @@ int sync_page_io(struct md_rdev *rdev, sector_t sector, int size, | |||
801 | else | 795 | else |
802 | bio->bi_sector = sector + rdev->data_offset; | 796 | bio->bi_sector = sector + rdev->data_offset; |
803 | bio_add_page(bio, page, size, 0); | 797 | bio_add_page(bio, page, size, 0); |
804 | init_completion(&event); | 798 | submit_bio_wait(rw, bio); |
805 | bio->bi_private = &event; | ||
806 | bio->bi_end_io = bi_complete; | ||
807 | submit_bio(rw, bio); | ||
808 | wait_for_completion(&event); | ||
809 | 799 | ||
810 | ret = test_bit(BIO_UPTODATE, &bio->bi_flags); | 800 | ret = test_bit(BIO_UPTODATE, &bio->bi_flags); |
811 | bio_put(bio); | 801 | bio_put(bio); |
diff --git a/drivers/md/persistent-data/dm-array.c b/drivers/md/persistent-data/dm-array.c index af96e24ec328..1d75b1dc1e2e 100644 --- a/drivers/md/persistent-data/dm-array.c +++ b/drivers/md/persistent-data/dm-array.c | |||
@@ -317,8 +317,16 @@ static int shadow_ablock(struct dm_array_info *info, dm_block_t *root, | |||
317 | * The shadow op will often be a noop. Only insert if it really | 317 | * The shadow op will often be a noop. Only insert if it really |
318 | * copied data. | 318 | * copied data. |
319 | */ | 319 | */ |
320 | if (dm_block_location(*block) != b) | 320 | if (dm_block_location(*block) != b) { |
321 | /* | ||
322 | * dm_tm_shadow_block will have already decremented the old | ||
323 | * block, but it is still referenced by the btree. We | ||
324 | * increment to stop the insert decrementing it below zero | ||
325 | * when overwriting the old value. | ||
326 | */ | ||
327 | dm_tm_inc(info->btree_info.tm, b); | ||
321 | r = insert_ablock(info, index, *block, root); | 328 | r = insert_ablock(info, index, *block, root); |
329 | } | ||
322 | 330 | ||
323 | return r; | 331 | return r; |
324 | } | 332 | } |
diff --git a/drivers/md/persistent-data/dm-block-manager.c b/drivers/md/persistent-data/dm-block-manager.c index a7e8bf296388..064a3c271baa 100644 --- a/drivers/md/persistent-data/dm-block-manager.c +++ b/drivers/md/persistent-data/dm-block-manager.c | |||
@@ -626,6 +626,12 @@ void dm_bm_set_read_only(struct dm_block_manager *bm) | |||
626 | } | 626 | } |
627 | EXPORT_SYMBOL_GPL(dm_bm_set_read_only); | 627 | EXPORT_SYMBOL_GPL(dm_bm_set_read_only); |
628 | 628 | ||
629 | void dm_bm_set_read_write(struct dm_block_manager *bm) | ||
630 | { | ||
631 | bm->read_only = false; | ||
632 | } | ||
633 | EXPORT_SYMBOL_GPL(dm_bm_set_read_write); | ||
634 | |||
629 | u32 dm_bm_checksum(const void *data, size_t len, u32 init_xor) | 635 | u32 dm_bm_checksum(const void *data, size_t len, u32 init_xor) |
630 | { | 636 | { |
631 | return crc32c(~(u32) 0, data, len) ^ init_xor; | 637 | return crc32c(~(u32) 0, data, len) ^ init_xor; |
diff --git a/drivers/md/persistent-data/dm-block-manager.h b/drivers/md/persistent-data/dm-block-manager.h index 9a82083a66b6..13cd58e1fe69 100644 --- a/drivers/md/persistent-data/dm-block-manager.h +++ b/drivers/md/persistent-data/dm-block-manager.h | |||
@@ -108,9 +108,9 @@ int dm_bm_unlock(struct dm_block *b); | |||
108 | int dm_bm_flush_and_unlock(struct dm_block_manager *bm, | 108 | int dm_bm_flush_and_unlock(struct dm_block_manager *bm, |
109 | struct dm_block *superblock); | 109 | struct dm_block *superblock); |
110 | 110 | ||
111 | /* | 111 | /* |
112 | * Request data be prefetched into the cache. | 112 | * Request data is prefetched into the cache. |
113 | */ | 113 | */ |
114 | void dm_bm_prefetch(struct dm_block_manager *bm, dm_block_t b); | 114 | void dm_bm_prefetch(struct dm_block_manager *bm, dm_block_t b); |
115 | 115 | ||
116 | /* | 116 | /* |
@@ -125,6 +125,7 @@ void dm_bm_prefetch(struct dm_block_manager *bm, dm_block_t b); | |||
125 | * be returned if you do. | 125 | * be returned if you do. |
126 | */ | 126 | */ |
127 | void dm_bm_set_read_only(struct dm_block_manager *bm); | 127 | void dm_bm_set_read_only(struct dm_block_manager *bm); |
128 | void dm_bm_set_read_write(struct dm_block_manager *bm); | ||
128 | 129 | ||
129 | u32 dm_bm_checksum(const void *data, size_t len, u32 init_xor); | 130 | u32 dm_bm_checksum(const void *data, size_t len, u32 init_xor); |
130 | 131 | ||
diff --git a/drivers/md/persistent-data/dm-space-map-common.c b/drivers/md/persistent-data/dm-space-map-common.c index 6058569fe86c..466a60bbd716 100644 --- a/drivers/md/persistent-data/dm-space-map-common.c +++ b/drivers/md/persistent-data/dm-space-map-common.c | |||
@@ -381,7 +381,7 @@ int sm_ll_find_free_block(struct ll_disk *ll, dm_block_t begin, | |||
381 | } | 381 | } |
382 | 382 | ||
383 | static int sm_ll_mutate(struct ll_disk *ll, dm_block_t b, | 383 | static int sm_ll_mutate(struct ll_disk *ll, dm_block_t b, |
384 | uint32_t (*mutator)(void *context, uint32_t old), | 384 | int (*mutator)(void *context, uint32_t old, uint32_t *new), |
385 | void *context, enum allocation_event *ev) | 385 | void *context, enum allocation_event *ev) |
386 | { | 386 | { |
387 | int r; | 387 | int r; |
@@ -410,11 +410,17 @@ static int sm_ll_mutate(struct ll_disk *ll, dm_block_t b, | |||
410 | 410 | ||
411 | if (old > 2) { | 411 | if (old > 2) { |
412 | r = sm_ll_lookup_big_ref_count(ll, b, &old); | 412 | r = sm_ll_lookup_big_ref_count(ll, b, &old); |
413 | if (r < 0) | 413 | if (r < 0) { |
414 | dm_tm_unlock(ll->tm, nb); | ||
414 | return r; | 415 | return r; |
416 | } | ||
415 | } | 417 | } |
416 | 418 | ||
417 | ref_count = mutator(context, old); | 419 | r = mutator(context, old, &ref_count); |
420 | if (r) { | ||
421 | dm_tm_unlock(ll->tm, nb); | ||
422 | return r; | ||
423 | } | ||
418 | 424 | ||
419 | if (ref_count <= 2) { | 425 | if (ref_count <= 2) { |
420 | sm_set_bitmap(bm_le, bit, ref_count); | 426 | sm_set_bitmap(bm_le, bit, ref_count); |
@@ -465,9 +471,10 @@ static int sm_ll_mutate(struct ll_disk *ll, dm_block_t b, | |||
465 | return ll->save_ie(ll, index, &ie_disk); | 471 | return ll->save_ie(ll, index, &ie_disk); |
466 | } | 472 | } |
467 | 473 | ||
468 | static uint32_t set_ref_count(void *context, uint32_t old) | 474 | static int set_ref_count(void *context, uint32_t old, uint32_t *new) |
469 | { | 475 | { |
470 | return *((uint32_t *) context); | 476 | *new = *((uint32_t *) context); |
477 | return 0; | ||
471 | } | 478 | } |
472 | 479 | ||
473 | int sm_ll_insert(struct ll_disk *ll, dm_block_t b, | 480 | int sm_ll_insert(struct ll_disk *ll, dm_block_t b, |
@@ -476,9 +483,10 @@ int sm_ll_insert(struct ll_disk *ll, dm_block_t b, | |||
476 | return sm_ll_mutate(ll, b, set_ref_count, &ref_count, ev); | 483 | return sm_ll_mutate(ll, b, set_ref_count, &ref_count, ev); |
477 | } | 484 | } |
478 | 485 | ||
479 | static uint32_t inc_ref_count(void *context, uint32_t old) | 486 | static int inc_ref_count(void *context, uint32_t old, uint32_t *new) |
480 | { | 487 | { |
481 | return old + 1; | 488 | *new = old + 1; |
489 | return 0; | ||
482 | } | 490 | } |
483 | 491 | ||
484 | int sm_ll_inc(struct ll_disk *ll, dm_block_t b, enum allocation_event *ev) | 492 | int sm_ll_inc(struct ll_disk *ll, dm_block_t b, enum allocation_event *ev) |
@@ -486,9 +494,15 @@ int sm_ll_inc(struct ll_disk *ll, dm_block_t b, enum allocation_event *ev) | |||
486 | return sm_ll_mutate(ll, b, inc_ref_count, NULL, ev); | 494 | return sm_ll_mutate(ll, b, inc_ref_count, NULL, ev); |
487 | } | 495 | } |
488 | 496 | ||
489 | static uint32_t dec_ref_count(void *context, uint32_t old) | 497 | static int dec_ref_count(void *context, uint32_t old, uint32_t *new) |
490 | { | 498 | { |
491 | return old - 1; | 499 | if (!old) { |
500 | DMERR_LIMIT("unable to decrement a reference count below 0"); | ||
501 | return -EINVAL; | ||
502 | } | ||
503 | |||
504 | *new = old - 1; | ||
505 | return 0; | ||
492 | } | 506 | } |
493 | 507 | ||
494 | int sm_ll_dec(struct ll_disk *ll, dm_block_t b, enum allocation_event *ev) | 508 | int sm_ll_dec(struct ll_disk *ll, dm_block_t b, enum allocation_event *ev) |
diff --git a/drivers/md/persistent-data/dm-space-map-metadata.c b/drivers/md/persistent-data/dm-space-map-metadata.c index 1c959684caef..58fc1eef7499 100644 --- a/drivers/md/persistent-data/dm-space-map-metadata.c +++ b/drivers/md/persistent-data/dm-space-map-metadata.c | |||
@@ -384,12 +384,16 @@ static int sm_metadata_new_block(struct dm_space_map *sm, dm_block_t *b) | |||
384 | struct sm_metadata *smm = container_of(sm, struct sm_metadata, sm); | 384 | struct sm_metadata *smm = container_of(sm, struct sm_metadata, sm); |
385 | 385 | ||
386 | int r = sm_metadata_new_block_(sm, b); | 386 | int r = sm_metadata_new_block_(sm, b); |
387 | if (r) | 387 | if (r) { |
388 | DMERR("unable to allocate new metadata block"); | 388 | DMERR("unable to allocate new metadata block"); |
389 | return r; | ||
390 | } | ||
389 | 391 | ||
390 | r = sm_metadata_get_nr_free(sm, &count); | 392 | r = sm_metadata_get_nr_free(sm, &count); |
391 | if (r) | 393 | if (r) { |
392 | DMERR("couldn't get free block count"); | 394 | DMERR("couldn't get free block count"); |
395 | return r; | ||
396 | } | ||
393 | 397 | ||
394 | check_threshold(&smm->threshold, count); | 398 | check_threshold(&smm->threshold, count); |
395 | 399 | ||
diff --git a/drivers/media/common/siano/smscoreapi.h b/drivers/media/common/siano/smscoreapi.h index d0799e323364..9c9063cd3208 100644 --- a/drivers/media/common/siano/smscoreapi.h +++ b/drivers/media/common/siano/smscoreapi.h | |||
@@ -955,7 +955,7 @@ struct sms_rx_stats { | |||
955 | u32 modem_state; /* from SMSHOSTLIB_DVB_MODEM_STATE_ET */ | 955 | u32 modem_state; /* from SMSHOSTLIB_DVB_MODEM_STATE_ET */ |
956 | s32 SNR; /* dB */ | 956 | s32 SNR; /* dB */ |
957 | u32 ber; /* Post Viterbi ber [1E-5] */ | 957 | u32 ber; /* Post Viterbi ber [1E-5] */ |
958 | u32 ber_error_count; /* Number of erronous SYNC bits. */ | 958 | u32 ber_error_count; /* Number of erroneous SYNC bits. */ |
959 | u32 ber_bit_count; /* Total number of SYNC bits. */ | 959 | u32 ber_bit_count; /* Total number of SYNC bits. */ |
960 | u32 ts_per; /* Transport stream PER, | 960 | u32 ts_per; /* Transport stream PER, |
961 | 0xFFFFFFFF indicate N/A */ | 961 | 0xFFFFFFFF indicate N/A */ |
@@ -981,7 +981,7 @@ struct sms_rx_stats_ex { | |||
981 | u32 modem_state; /* from SMSHOSTLIB_DVB_MODEM_STATE_ET */ | 981 | u32 modem_state; /* from SMSHOSTLIB_DVB_MODEM_STATE_ET */ |
982 | s32 SNR; /* dB */ | 982 | s32 SNR; /* dB */ |
983 | u32 ber; /* Post Viterbi ber [1E-5] */ | 983 | u32 ber; /* Post Viterbi ber [1E-5] */ |
984 | u32 ber_error_count; /* Number of erronous SYNC bits. */ | 984 | u32 ber_error_count; /* Number of erroneous SYNC bits. */ |
985 | u32 ber_bit_count; /* Total number of SYNC bits. */ | 985 | u32 ber_bit_count; /* Total number of SYNC bits. */ |
986 | u32 ts_per; /* Transport stream PER, | 986 | u32 ts_per; /* Transport stream PER, |
987 | 0xFFFFFFFF indicate N/A */ | 987 | 0xFFFFFFFF indicate N/A */ |
diff --git a/drivers/media/common/siano/smsdvb.h b/drivers/media/common/siano/smsdvb.h index 92c413ba0c79..ae36d0ae0fb1 100644 --- a/drivers/media/common/siano/smsdvb.h +++ b/drivers/media/common/siano/smsdvb.h | |||
@@ -95,7 +95,7 @@ struct RECEPTION_STATISTICS_PER_SLICES_S { | |||
95 | u32 is_demod_locked; /* 0 - not locked, 1 - locked */ | 95 | u32 is_demod_locked; /* 0 - not locked, 1 - locked */ |
96 | 96 | ||
97 | u32 ber_bit_count; /* Total number of SYNC bits. */ | 97 | u32 ber_bit_count; /* Total number of SYNC bits. */ |
98 | u32 ber_error_count; /* Number of erronous SYNC bits. */ | 98 | u32 ber_error_count; /* Number of erroneous SYNC bits. */ |
99 | 99 | ||
100 | s32 MRC_SNR; /* dB */ | 100 | s32 MRC_SNR; /* dB */ |
101 | s32 mrc_in_band_pwr; /* In band power in dBM */ | 101 | s32 mrc_in_band_pwr; /* In band power in dBM */ |
diff --git a/drivers/media/dvb-core/dvb_demux.c b/drivers/media/dvb-core/dvb_demux.c index 58de4410c525..6c7ff0cdcd32 100644 --- a/drivers/media/dvb-core/dvb_demux.c +++ b/drivers/media/dvb-core/dvb_demux.c | |||
@@ -435,7 +435,7 @@ static void dvb_dmx_swfilter_packet(struct dvb_demux *demux, const u8 *buf) | |||
435 | dprintk_tscheck("TEI detected. " | 435 | dprintk_tscheck("TEI detected. " |
436 | "PID=0x%x data1=0x%x\n", | 436 | "PID=0x%x data1=0x%x\n", |
437 | pid, buf[1]); | 437 | pid, buf[1]); |
438 | /* data in this packet cant be trusted - drop it unless | 438 | /* data in this packet can't be trusted - drop it unless |
439 | * module option dvb_demux_feed_err_pkts is set */ | 439 | * module option dvb_demux_feed_err_pkts is set */ |
440 | if (!dvb_demux_feed_err_pkts) | 440 | if (!dvb_demux_feed_err_pkts) |
441 | return; | 441 | return; |
@@ -1032,8 +1032,13 @@ static int dmx_section_feed_release_filter(struct dmx_section_feed *feed, | |||
1032 | return -EINVAL; | 1032 | return -EINVAL; |
1033 | } | 1033 | } |
1034 | 1034 | ||
1035 | if (feed->is_filtering) | 1035 | if (feed->is_filtering) { |
1036 | /* release dvbdmx->mutex as far as it is | ||
1037 | acquired by stop_filtering() itself */ | ||
1038 | mutex_unlock(&dvbdmx->mutex); | ||
1036 | feed->stop_filtering(feed); | 1039 | feed->stop_filtering(feed); |
1040 | mutex_lock(&dvbdmx->mutex); | ||
1041 | } | ||
1037 | 1042 | ||
1038 | spin_lock_irq(&dvbdmx->lock); | 1043 | spin_lock_irq(&dvbdmx->lock); |
1039 | f = dvbdmxfeed->filter; | 1044 | f = dvbdmxfeed->filter; |
diff --git a/drivers/media/dvb-frontends/af9033.c b/drivers/media/dvb-frontends/af9033.c index 30ee59052157..65728c25ea05 100644 --- a/drivers/media/dvb-frontends/af9033.c +++ b/drivers/media/dvb-frontends/af9033.c | |||
@@ -170,18 +170,18 @@ static int af9033_rd_reg_mask(struct af9033_state *state, u32 reg, u8 *val, | |||
170 | static int af9033_wr_reg_val_tab(struct af9033_state *state, | 170 | static int af9033_wr_reg_val_tab(struct af9033_state *state, |
171 | const struct reg_val *tab, int tab_len) | 171 | const struct reg_val *tab, int tab_len) |
172 | { | 172 | { |
173 | #define MAX_TAB_LEN 212 | ||
173 | int ret, i, j; | 174 | int ret, i, j; |
174 | u8 buf[MAX_XFER_SIZE]; | 175 | u8 buf[1 + MAX_TAB_LEN]; |
176 | |||
177 | dev_dbg(&state->i2c->dev, "%s: tab_len=%d\n", __func__, tab_len); | ||
175 | 178 | ||
176 | if (tab_len > sizeof(buf)) { | 179 | if (tab_len > sizeof(buf)) { |
177 | dev_warn(&state->i2c->dev, | 180 | dev_warn(&state->i2c->dev, "%s: tab len %d is too big\n", |
178 | "%s: i2c wr len=%d is too big!\n", | 181 | KBUILD_MODNAME, tab_len); |
179 | KBUILD_MODNAME, tab_len); | ||
180 | return -EINVAL; | 182 | return -EINVAL; |
181 | } | 183 | } |
182 | 184 | ||
183 | dev_dbg(&state->i2c->dev, "%s: tab_len=%d\n", __func__, tab_len); | ||
184 | |||
185 | for (i = 0, j = 0; i < tab_len; i++) { | 185 | for (i = 0, j = 0; i < tab_len; i++) { |
186 | buf[j] = tab[i].val; | 186 | buf[j] = tab[i].val; |
187 | 187 | ||
diff --git a/drivers/media/dvb-frontends/cxd2820r_c.c b/drivers/media/dvb-frontends/cxd2820r_c.c index 125a44041011..5c6ab4921bf1 100644 --- a/drivers/media/dvb-frontends/cxd2820r_c.c +++ b/drivers/media/dvb-frontends/cxd2820r_c.c | |||
@@ -78,7 +78,7 @@ int cxd2820r_set_frontend_c(struct dvb_frontend *fe) | |||
78 | 78 | ||
79 | num = if_freq / 1000; /* Hz => kHz */ | 79 | num = if_freq / 1000; /* Hz => kHz */ |
80 | num *= 0x4000; | 80 | num *= 0x4000; |
81 | if_ctl = cxd2820r_div_u64_round_closest(num, 41000); | 81 | if_ctl = 0x4000 - cxd2820r_div_u64_round_closest(num, 41000); |
82 | buf[0] = (if_ctl >> 8) & 0x3f; | 82 | buf[0] = (if_ctl >> 8) & 0x3f; |
83 | buf[1] = (if_ctl >> 0) & 0xff; | 83 | buf[1] = (if_ctl >> 0) & 0xff; |
84 | 84 | ||
diff --git a/drivers/media/dvb-frontends/dib8000.c b/drivers/media/dvb-frontends/dib8000.c index 90536147bf04..6dbbee453ee1 100644 --- a/drivers/media/dvb-frontends/dib8000.c +++ b/drivers/media/dvb-frontends/dib8000.c | |||
@@ -3048,7 +3048,7 @@ static int dib8000_tune(struct dvb_frontend *fe) | |||
3048 | dib8000_set_diversity_in(state->fe[0], state->diversity_onoff); | 3048 | dib8000_set_diversity_in(state->fe[0], state->diversity_onoff); |
3049 | 3049 | ||
3050 | locks = (dib8000_read_word(state, 180) >> 6) & 0x3f; /* P_coff_winlen ? */ | 3050 | locks = (dib8000_read_word(state, 180) >> 6) & 0x3f; /* P_coff_winlen ? */ |
3051 | /* coff should lock over P_coff_winlen ofdm symbols : give 3 times this lenght to lock */ | 3051 | /* coff should lock over P_coff_winlen ofdm symbols : give 3 times this length to lock */ |
3052 | *timeout = dib8000_get_timeout(state, 2 * locks, SYMBOL_DEPENDENT_ON); | 3052 | *timeout = dib8000_get_timeout(state, 2 * locks, SYMBOL_DEPENDENT_ON); |
3053 | *tune_state = CT_DEMOD_STEP_5; | 3053 | *tune_state = CT_DEMOD_STEP_5; |
3054 | break; | 3054 | break; |
@@ -3115,7 +3115,7 @@ static int dib8000_tune(struct dvb_frontend *fe) | |||
3115 | 3115 | ||
3116 | case CT_DEMOD_STEP_9: /* 39 */ | 3116 | case CT_DEMOD_STEP_9: /* 39 */ |
3117 | if ((state->revision == 0x8090) || ((dib8000_read_word(state, 1291) >> 9) & 0x1)) { /* fe capable of deinterleaving : esram */ | 3117 | if ((state->revision == 0x8090) || ((dib8000_read_word(state, 1291) >> 9) & 0x1)) { /* fe capable of deinterleaving : esram */ |
3118 | /* defines timeout for mpeg lock depending on interleaver lenght of longest layer */ | 3118 | /* defines timeout for mpeg lock depending on interleaver length of longest layer */ |
3119 | for (i = 0; i < 3; i++) { | 3119 | for (i = 0; i < 3; i++) { |
3120 | if (c->layer[i].interleaving >= deeper_interleaver) { | 3120 | if (c->layer[i].interleaving >= deeper_interleaver) { |
3121 | dprintk("layer%i: time interleaver = %d ", i, c->layer[i].interleaving); | 3121 | dprintk("layer%i: time interleaver = %d ", i, c->layer[i].interleaving); |
diff --git a/drivers/media/dvb-frontends/drxk_hard.c b/drivers/media/dvb-frontends/drxk_hard.c index d416c15691da..bf29a3f0e6f0 100644 --- a/drivers/media/dvb-frontends/drxk_hard.c +++ b/drivers/media/dvb-frontends/drxk_hard.c | |||
@@ -1191,7 +1191,7 @@ static int mpegts_configure_pins(struct drxk_state *state, bool mpeg_enable) | |||
1191 | goto error; | 1191 | goto error; |
1192 | 1192 | ||
1193 | if (state->m_enable_parallel == true) { | 1193 | if (state->m_enable_parallel == true) { |
1194 | /* paralel -> enable MD1 to MD7 */ | 1194 | /* parallel -> enable MD1 to MD7 */ |
1195 | status = write16(state, SIO_PDR_MD1_CFG__A, | 1195 | status = write16(state, SIO_PDR_MD1_CFG__A, |
1196 | sio_pdr_mdx_cfg); | 1196 | sio_pdr_mdx_cfg); |
1197 | if (status < 0) | 1197 | if (status < 0) |
@@ -1428,7 +1428,7 @@ static int mpegts_stop(struct drxk_state *state) | |||
1428 | 1428 | ||
1429 | dprintk(1, "\n"); | 1429 | dprintk(1, "\n"); |
1430 | 1430 | ||
1431 | /* Gracefull shutdown (byte boundaries) */ | 1431 | /* Graceful shutdown (byte boundaries) */ |
1432 | status = read16(state, FEC_OC_SNC_MODE__A, &fec_oc_snc_mode); | 1432 | status = read16(state, FEC_OC_SNC_MODE__A, &fec_oc_snc_mode); |
1433 | if (status < 0) | 1433 | if (status < 0) |
1434 | goto error; | 1434 | goto error; |
@@ -2021,7 +2021,7 @@ static int mpegts_dto_setup(struct drxk_state *state, | |||
2021 | fec_oc_dto_burst_len = 204; | 2021 | fec_oc_dto_burst_len = 204; |
2022 | } | 2022 | } |
2023 | 2023 | ||
2024 | /* Check serial or parrallel output */ | 2024 | /* Check serial or parallel output */ |
2025 | fec_oc_reg_ipr_mode &= (~(FEC_OC_IPR_MODE_SERIAL__M)); | 2025 | fec_oc_reg_ipr_mode &= (~(FEC_OC_IPR_MODE_SERIAL__M)); |
2026 | if (state->m_enable_parallel == false) { | 2026 | if (state->m_enable_parallel == false) { |
2027 | /* MPEG data output is serial -> set ipr_mode[0] */ | 2027 | /* MPEG data output is serial -> set ipr_mode[0] */ |
@@ -2908,7 +2908,7 @@ static int adc_synchronization(struct drxk_state *state) | |||
2908 | goto error; | 2908 | goto error; |
2909 | 2909 | ||
2910 | if (count == 1) { | 2910 | if (count == 1) { |
2911 | /* Try sampling on a diffrent edge */ | 2911 | /* Try sampling on a different edge */ |
2912 | u16 clk_neg = 0; | 2912 | u16 clk_neg = 0; |
2913 | 2913 | ||
2914 | status = read16(state, IQM_AF_CLKNEG__A, &clk_neg); | 2914 | status = read16(state, IQM_AF_CLKNEG__A, &clk_neg); |
@@ -3306,7 +3306,7 @@ static int dvbt_sc_command(struct drxk_state *state, | |||
3306 | if (status < 0) | 3306 | if (status < 0) |
3307 | goto error; | 3307 | goto error; |
3308 | 3308 | ||
3309 | /* Retreive results parameters from SC */ | 3309 | /* Retrieve results parameters from SC */ |
3310 | switch (cmd) { | 3310 | switch (cmd) { |
3311 | /* All commands yielding 5 results */ | 3311 | /* All commands yielding 5 results */ |
3312 | /* All commands yielding 4 results */ | 3312 | /* All commands yielding 4 results */ |
@@ -3849,7 +3849,7 @@ static int set_dvbt(struct drxk_state *state, u16 intermediate_freqk_hz, | |||
3849 | break; | 3849 | break; |
3850 | } | 3850 | } |
3851 | #if 0 | 3851 | #if 0 |
3852 | /* No hierachical channels support in BDA */ | 3852 | /* No hierarchical channels support in BDA */ |
3853 | /* Priority (only for hierarchical channels) */ | 3853 | /* Priority (only for hierarchical channels) */ |
3854 | switch (channel->priority) { | 3854 | switch (channel->priority) { |
3855 | case DRX_PRIORITY_LOW: | 3855 | case DRX_PRIORITY_LOW: |
@@ -4081,7 +4081,7 @@ error: | |||
4081 | /*============================================================================*/ | 4081 | /*============================================================================*/ |
4082 | 4082 | ||
4083 | /** | 4083 | /** |
4084 | * \brief Retreive lock status . | 4084 | * \brief Retrieve lock status . |
4085 | * \param demod Pointer to demodulator instance. | 4085 | * \param demod Pointer to demodulator instance. |
4086 | * \param lockStat Pointer to lock status structure. | 4086 | * \param lockStat Pointer to lock status structure. |
4087 | * \return DRXStatus_t. | 4087 | * \return DRXStatus_t. |
@@ -6174,7 +6174,7 @@ static int init_drxk(struct drxk_state *state) | |||
6174 | goto error; | 6174 | goto error; |
6175 | 6175 | ||
6176 | /* Stamp driver version number in SCU data RAM in BCD code | 6176 | /* Stamp driver version number in SCU data RAM in BCD code |
6177 | Done to enable field application engineers to retreive drxdriver version | 6177 | Done to enable field application engineers to retrieve drxdriver version |
6178 | via I2C from SCU RAM. | 6178 | via I2C from SCU RAM. |
6179 | Not using SCU command interface for SCU register access since no | 6179 | Not using SCU command interface for SCU register access since no |
6180 | microcode may be present. | 6180 | microcode may be present. |
@@ -6399,7 +6399,7 @@ static int drxk_set_parameters(struct dvb_frontend *fe) | |||
6399 | fe->ops.tuner_ops.get_if_frequency(fe, &IF); | 6399 | fe->ops.tuner_ops.get_if_frequency(fe, &IF); |
6400 | start(state, 0, IF); | 6400 | start(state, 0, IF); |
6401 | 6401 | ||
6402 | /* After set_frontend, stats aren't avaliable */ | 6402 | /* After set_frontend, stats aren't available */ |
6403 | p->strength.stat[0].scale = FE_SCALE_RELATIVE; | 6403 | p->strength.stat[0].scale = FE_SCALE_RELATIVE; |
6404 | p->cnr.stat[0].scale = FE_SCALE_NOT_AVAILABLE; | 6404 | p->cnr.stat[0].scale = FE_SCALE_NOT_AVAILABLE; |
6405 | p->block_error.stat[0].scale = FE_SCALE_NOT_AVAILABLE; | 6405 | p->block_error.stat[0].scale = FE_SCALE_NOT_AVAILABLE; |
diff --git a/drivers/media/dvb-frontends/rtl2830.c b/drivers/media/dvb-frontends/rtl2830.c index 7efb796c472c..50e8b63e5169 100644 --- a/drivers/media/dvb-frontends/rtl2830.c +++ b/drivers/media/dvb-frontends/rtl2830.c | |||
@@ -710,6 +710,7 @@ struct dvb_frontend *rtl2830_attach(const struct rtl2830_config *cfg, | |||
710 | sizeof(priv->tuner_i2c_adapter.name)); | 710 | sizeof(priv->tuner_i2c_adapter.name)); |
711 | priv->tuner_i2c_adapter.algo = &rtl2830_tuner_i2c_algo; | 711 | priv->tuner_i2c_adapter.algo = &rtl2830_tuner_i2c_algo; |
712 | priv->tuner_i2c_adapter.algo_data = NULL; | 712 | priv->tuner_i2c_adapter.algo_data = NULL; |
713 | priv->tuner_i2c_adapter.dev.parent = &i2c->dev; | ||
713 | i2c_set_adapdata(&priv->tuner_i2c_adapter, priv); | 714 | i2c_set_adapdata(&priv->tuner_i2c_adapter, priv); |
714 | if (i2c_add_adapter(&priv->tuner_i2c_adapter) < 0) { | 715 | if (i2c_add_adapter(&priv->tuner_i2c_adapter) < 0) { |
715 | dev_err(&i2c->dev, | 716 | dev_err(&i2c->dev, |
diff --git a/drivers/media/i2c/adv7183_regs.h b/drivers/media/i2c/adv7183_regs.h index 4a5b7d211d2f..b253d400e817 100644 --- a/drivers/media/i2c/adv7183_regs.h +++ b/drivers/media/i2c/adv7183_regs.h | |||
@@ -52,9 +52,9 @@ | |||
52 | #define ADV7183_VS_FIELD_CTRL_1 0x31 /* Vsync field control 1 */ | 52 | #define ADV7183_VS_FIELD_CTRL_1 0x31 /* Vsync field control 1 */ |
53 | #define ADV7183_VS_FIELD_CTRL_2 0x32 /* Vsync field control 2 */ | 53 | #define ADV7183_VS_FIELD_CTRL_2 0x32 /* Vsync field control 2 */ |
54 | #define ADV7183_VS_FIELD_CTRL_3 0x33 /* Vsync field control 3 */ | 54 | #define ADV7183_VS_FIELD_CTRL_3 0x33 /* Vsync field control 3 */ |
55 | #define ADV7183_HS_POS_CTRL_1 0x34 /* Hsync positon control 1 */ | 55 | #define ADV7183_HS_POS_CTRL_1 0x34 /* Hsync position control 1 */ |
56 | #define ADV7183_HS_POS_CTRL_2 0x35 /* Hsync positon control 2 */ | 56 | #define ADV7183_HS_POS_CTRL_2 0x35 /* Hsync position control 2 */ |
57 | #define ADV7183_HS_POS_CTRL_3 0x36 /* Hsync positon control 3 */ | 57 | #define ADV7183_HS_POS_CTRL_3 0x36 /* Hsync position control 3 */ |
58 | #define ADV7183_POLARITY 0x37 /* Polarity */ | 58 | #define ADV7183_POLARITY 0x37 /* Polarity */ |
59 | #define ADV7183_NTSC_COMB_CTRL 0x38 /* NTSC comb control */ | 59 | #define ADV7183_NTSC_COMB_CTRL 0x38 /* NTSC comb control */ |
60 | #define ADV7183_PAL_COMB_CTRL 0x39 /* PAL comb control */ | 60 | #define ADV7183_PAL_COMB_CTRL 0x39 /* PAL comb control */ |
diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c index fbfdd2fc2a36..a324106b9f11 100644 --- a/drivers/media/i2c/adv7604.c +++ b/drivers/media/i2c/adv7604.c | |||
@@ -877,7 +877,7 @@ static void configure_custom_video_timings(struct v4l2_subdev *sd, | |||
877 | break; | 877 | break; |
878 | case ADV7604_MODE_HDMI: | 878 | case ADV7604_MODE_HDMI: |
879 | /* set default prim_mode/vid_std for HDMI | 879 | /* set default prim_mode/vid_std for HDMI |
880 | accoring to [REF_03, c. 4.2] */ | 880 | according to [REF_03, c. 4.2] */ |
881 | io_write(sd, 0x00, 0x02); /* video std */ | 881 | io_write(sd, 0x00, 0x02); /* video std */ |
882 | io_write(sd, 0x01, 0x06); /* prim mode */ | 882 | io_write(sd, 0x01, 0x06); /* prim mode */ |
883 | break; | 883 | break; |
diff --git a/drivers/media/i2c/adv7842.c b/drivers/media/i2c/adv7842.c index 22f729d66a96..b154f36740b4 100644 --- a/drivers/media/i2c/adv7842.c +++ b/drivers/media/i2c/adv7842.c | |||
@@ -1013,7 +1013,7 @@ static void configure_custom_video_timings(struct v4l2_subdev *sd, | |||
1013 | break; | 1013 | break; |
1014 | case ADV7842_MODE_HDMI: | 1014 | case ADV7842_MODE_HDMI: |
1015 | /* set default prim_mode/vid_std for HDMI | 1015 | /* set default prim_mode/vid_std for HDMI |
1016 | accoring to [REF_03, c. 4.2] */ | 1016 | according to [REF_03, c. 4.2] */ |
1017 | io_write(sd, 0x00, 0x02); /* video std */ | 1017 | io_write(sd, 0x00, 0x02); /* video std */ |
1018 | io_write(sd, 0x01, 0x06); /* prim mode */ | 1018 | io_write(sd, 0x01, 0x06); /* prim mode */ |
1019 | break; | 1019 | break; |
diff --git a/drivers/media/i2c/ir-kbd-i2c.c b/drivers/media/i2c/ir-kbd-i2c.c index 82bf5679da30..99ee456700f4 100644 --- a/drivers/media/i2c/ir-kbd-i2c.c +++ b/drivers/media/i2c/ir-kbd-i2c.c | |||
@@ -394,7 +394,7 @@ static int ir_probe(struct i2c_client *client, const struct i2c_device_id *id) | |||
394 | 394 | ||
395 | if (!rc) { | 395 | if (!rc) { |
396 | /* | 396 | /* |
397 | * If platform_data doesn't specify rc_dev, initilize it | 397 | * If platform_data doesn't specify rc_dev, initialize it |
398 | * internally | 398 | * internally |
399 | */ | 399 | */ |
400 | rc = rc_allocate_device(); | 400 | rc = rc_allocate_device(); |
diff --git a/drivers/media/i2c/m5mols/m5mols_controls.c b/drivers/media/i2c/m5mols/m5mols_controls.c index f34429e452ab..a60931e66312 100644 --- a/drivers/media/i2c/m5mols/m5mols_controls.c +++ b/drivers/media/i2c/m5mols/m5mols_controls.c | |||
@@ -544,7 +544,7 @@ int m5mols_init_controls(struct v4l2_subdev *sd) | |||
544 | u16 zoom_step; | 544 | u16 zoom_step; |
545 | int ret; | 545 | int ret; |
546 | 546 | ||
547 | /* Determine the firmware dependant control range and step values */ | 547 | /* Determine the firmware dependent control range and step values */ |
548 | ret = m5mols_read_u16(sd, AE_MAX_GAIN_MON, &exposure_max); | 548 | ret = m5mols_read_u16(sd, AE_MAX_GAIN_MON, &exposure_max); |
549 | if (ret < 0) | 549 | if (ret < 0) |
550 | return ret; | 550 | return ret; |
diff --git a/drivers/media/i2c/mt9p031.c b/drivers/media/i2c/mt9p031.c index 4734836fe5a4..1c2303d18bf4 100644 --- a/drivers/media/i2c/mt9p031.c +++ b/drivers/media/i2c/mt9p031.c | |||
@@ -19,6 +19,7 @@ | |||
19 | #include <linux/i2c.h> | 19 | #include <linux/i2c.h> |
20 | #include <linux/log2.h> | 20 | #include <linux/log2.h> |
21 | #include <linux/module.h> | 21 | #include <linux/module.h> |
22 | #include <linux/of.h> | ||
22 | #include <linux/of_gpio.h> | 23 | #include <linux/of_gpio.h> |
23 | #include <linux/pm.h> | 24 | #include <linux/pm.h> |
24 | #include <linux/regulator/consumer.h> | 25 | #include <linux/regulator/consumer.h> |
diff --git a/drivers/media/i2c/s5c73m3/s5c73m3-core.c b/drivers/media/i2c/s5c73m3/s5c73m3-core.c index 6fec9384d86e..e7f555cc827a 100644 --- a/drivers/media/i2c/s5c73m3/s5c73m3-core.c +++ b/drivers/media/i2c/s5c73m3/s5c73m3-core.c | |||
@@ -1460,7 +1460,7 @@ static int s5c73m3_oif_registered(struct v4l2_subdev *sd) | |||
1460 | mutex_unlock(&state->lock); | 1460 | mutex_unlock(&state->lock); |
1461 | 1461 | ||
1462 | v4l2_dbg(1, s5c73m3_dbg, sd, "%s: Booting %s (%d)\n", | 1462 | v4l2_dbg(1, s5c73m3_dbg, sd, "%s: Booting %s (%d)\n", |
1463 | __func__, ret ? "failed" : "succeded", ret); | 1463 | __func__, ret ? "failed" : "succeeded", ret); |
1464 | 1464 | ||
1465 | return ret; | 1465 | return ret; |
1466 | } | 1466 | } |
diff --git a/drivers/media/i2c/s5c73m3/s5c73m3.h b/drivers/media/i2c/s5c73m3/s5c73m3.h index 9d2c08652246..9dfa516f6944 100644 --- a/drivers/media/i2c/s5c73m3/s5c73m3.h +++ b/drivers/media/i2c/s5c73m3/s5c73m3.h | |||
@@ -393,7 +393,7 @@ struct s5c73m3 { | |||
393 | 393 | ||
394 | /* External master clock frequency */ | 394 | /* External master clock frequency */ |
395 | u32 mclk_frequency; | 395 | u32 mclk_frequency; |
396 | /* Video bus type - MIPI-CSI2/paralell */ | 396 | /* Video bus type - MIPI-CSI2/parallel */ |
397 | enum v4l2_mbus_type bus_type; | 397 | enum v4l2_mbus_type bus_type; |
398 | 398 | ||
399 | const struct s5c73m3_frame_size *sensor_pix_size[2]; | 399 | const struct s5c73m3_frame_size *sensor_pix_size[2]; |
diff --git a/drivers/media/i2c/saa7115.c b/drivers/media/i2c/saa7115.c index 637d02634527..afdbcb045cee 100644 --- a/drivers/media/i2c/saa7115.c +++ b/drivers/media/i2c/saa7115.c | |||
@@ -1699,7 +1699,7 @@ static void saa711x_write_platform_data(struct saa711x_state *state, | |||
1699 | * the analog demod. | 1699 | * the analog demod. |
1700 | * If the tuner is not found, it returns -ENODEV. | 1700 | * If the tuner is not found, it returns -ENODEV. |
1701 | * If auto-detection is disabled and the tuner doesn't match what it was | 1701 | * If auto-detection is disabled and the tuner doesn't match what it was |
1702 | * requred, it returns -EINVAL and fills 'name'. | 1702 | * required, it returns -EINVAL and fills 'name'. |
1703 | * If the chip is found, it returns the chip ID and fills 'name'. | 1703 | * If the chip is found, it returns the chip ID and fills 'name'. |
1704 | */ | 1704 | */ |
1705 | static int saa711x_detect_chip(struct i2c_client *client, | 1705 | static int saa711x_detect_chip(struct i2c_client *client, |
diff --git a/drivers/media/i2c/soc_camera/ov5642.c b/drivers/media/i2c/soc_camera/ov5642.c index 0a5c5d4fedd6..d2daa6a8f272 100644 --- a/drivers/media/i2c/soc_camera/ov5642.c +++ b/drivers/media/i2c/soc_camera/ov5642.c | |||
@@ -642,7 +642,7 @@ static const struct ov5642_datafmt | |||
642 | static int reg_read(struct i2c_client *client, u16 reg, u8 *val) | 642 | static int reg_read(struct i2c_client *client, u16 reg, u8 *val) |
643 | { | 643 | { |
644 | int ret; | 644 | int ret; |
645 | /* We have 16-bit i2c addresses - care for endianess */ | 645 | /* We have 16-bit i2c addresses - care for endianness */ |
646 | unsigned char data[2] = { reg >> 8, reg & 0xff }; | 646 | unsigned char data[2] = { reg >> 8, reg & 0xff }; |
647 | 647 | ||
648 | ret = i2c_master_send(client, data, 2); | 648 | ret = i2c_master_send(client, data, 2); |
diff --git a/drivers/media/i2c/ths7303.c b/drivers/media/i2c/ths7303.c index 42276d93624c..ed9ae8875348 100644 --- a/drivers/media/i2c/ths7303.c +++ b/drivers/media/i2c/ths7303.c | |||
@@ -83,7 +83,8 @@ static int ths7303_write(struct v4l2_subdev *sd, u8 reg, u8 val) | |||
83 | } | 83 | } |
84 | 84 | ||
85 | /* following function is used to set ths7303 */ | 85 | /* following function is used to set ths7303 */ |
86 | int ths7303_setval(struct v4l2_subdev *sd, enum ths7303_filter_mode mode) | 86 | static int ths7303_setval(struct v4l2_subdev *sd, |
87 | enum ths7303_filter_mode mode) | ||
87 | { | 88 | { |
88 | struct i2c_client *client = v4l2_get_subdevdata(sd); | 89 | struct i2c_client *client = v4l2_get_subdevdata(sd); |
89 | struct ths7303_state *state = to_state(sd); | 90 | struct ths7303_state *state = to_state(sd); |
diff --git a/drivers/media/i2c/wm8775.c b/drivers/media/i2c/wm8775.c index 3f584a7d0781..bee7946faa7c 100644 --- a/drivers/media/i2c/wm8775.c +++ b/drivers/media/i2c/wm8775.c | |||
@@ -130,12 +130,10 @@ static int wm8775_s_routing(struct v4l2_subdev *sd, | |||
130 | return -EINVAL; | 130 | return -EINVAL; |
131 | } | 131 | } |
132 | state->input = input; | 132 | state->input = input; |
133 | if (!v4l2_ctrl_g_ctrl(state->mute)) | 133 | if (v4l2_ctrl_g_ctrl(state->mute)) |
134 | return 0; | 134 | return 0; |
135 | if (!v4l2_ctrl_g_ctrl(state->vol)) | 135 | if (!v4l2_ctrl_g_ctrl(state->vol)) |
136 | return 0; | 136 | return 0; |
137 | if (!v4l2_ctrl_g_ctrl(state->bal)) | ||
138 | return 0; | ||
139 | wm8775_set_audio(sd, 1); | 137 | wm8775_set_audio(sd, 1); |
140 | return 0; | 138 | return 0; |
141 | } | 139 | } |
diff --git a/drivers/media/pci/bt8xx/bttv-driver.c b/drivers/media/pci/bt8xx/bttv-driver.c index a3b1ee9c00d7..92a06fd85865 100644 --- a/drivers/media/pci/bt8xx/bttv-driver.c +++ b/drivers/media/pci/bt8xx/bttv-driver.c | |||
@@ -4182,7 +4182,8 @@ static int bttv_probe(struct pci_dev *dev, const struct pci_device_id *pci_id) | |||
4182 | } | 4182 | } |
4183 | btv->std = V4L2_STD_PAL; | 4183 | btv->std = V4L2_STD_PAL; |
4184 | init_irqreg(btv); | 4184 | init_irqreg(btv); |
4185 | v4l2_ctrl_handler_setup(hdl); | 4185 | if (!bttv_tvcards[btv->c.type].no_video) |
4186 | v4l2_ctrl_handler_setup(hdl); | ||
4186 | if (hdl->error) { | 4187 | if (hdl->error) { |
4187 | result = hdl->error; | 4188 | result = hdl->error; |
4188 | goto fail2; | 4189 | goto fail2; |
diff --git a/drivers/media/pci/cx18/cx18-driver.h b/drivers/media/pci/cx18/cx18-driver.h index 2767c64df0c8..57f4688ea55b 100644 --- a/drivers/media/pci/cx18/cx18-driver.h +++ b/drivers/media/pci/cx18/cx18-driver.h | |||
@@ -262,7 +262,7 @@ struct cx18_options { | |||
262 | }; | 262 | }; |
263 | 263 | ||
264 | /* per-mdl bit flags */ | 264 | /* per-mdl bit flags */ |
265 | #define CX18_F_M_NEED_SWAP 0 /* mdl buffer data must be endianess swapped */ | 265 | #define CX18_F_M_NEED_SWAP 0 /* mdl buffer data must be endianness swapped */ |
266 | 266 | ||
267 | /* per-stream, s_flags */ | 267 | /* per-stream, s_flags */ |
268 | #define CX18_F_S_CLAIMED 3 /* this stream is claimed */ | 268 | #define CX18_F_S_CLAIMED 3 /* this stream is claimed */ |
diff --git a/drivers/media/pci/cx23885/cx23885-417.c b/drivers/media/pci/cx23885/cx23885-417.c index e3fc2c71808a..95666eee7b27 100644 --- a/drivers/media/pci/cx23885/cx23885-417.c +++ b/drivers/media/pci/cx23885/cx23885-417.c | |||
@@ -427,7 +427,7 @@ int mc417_register_read(struct cx23885_dev *dev, u16 address, u32 *value) | |||
427 | cx_write(MC417_RWD, regval); | 427 | cx_write(MC417_RWD, regval); |
428 | 428 | ||
429 | /* Transition RD to effect read transaction across bus. | 429 | /* Transition RD to effect read transaction across bus. |
430 | * Transtion 0x5000 -> 0x9000 correct (RD/RDY -> WR/RDY)? | 430 | * Transition 0x5000 -> 0x9000 correct (RD/RDY -> WR/RDY)? |
431 | * Should it be 0x9000 -> 0xF000 (also why is RDY being set, its | 431 | * Should it be 0x9000 -> 0xF000 (also why is RDY being set, its |
432 | * input only...) | 432 | * input only...) |
433 | */ | 433 | */ |
diff --git a/drivers/media/pci/pluto2/pluto2.c b/drivers/media/pci/pluto2/pluto2.c index 8164d74b46a4..655d6854a8d7 100644 --- a/drivers/media/pci/pluto2/pluto2.c +++ b/drivers/media/pci/pluto2/pluto2.c | |||
@@ -401,7 +401,7 @@ static int pluto_hw_init(struct pluto *pluto) | |||
401 | /* set automatic LED control by FPGA */ | 401 | /* set automatic LED control by FPGA */ |
402 | pluto_rw(pluto, REG_MISC, MISC_ALED, MISC_ALED); | 402 | pluto_rw(pluto, REG_MISC, MISC_ALED, MISC_ALED); |
403 | 403 | ||
404 | /* set data endianess */ | 404 | /* set data endianness */ |
405 | #ifdef __LITTLE_ENDIAN | 405 | #ifdef __LITTLE_ENDIAN |
406 | pluto_rw(pluto, REG_PIDn(0), PID0_END, PID0_END); | 406 | pluto_rw(pluto, REG_PIDn(0), PID0_END, PID0_END); |
407 | #else | 407 | #else |
diff --git a/drivers/media/pci/saa7164/saa7164-core.c b/drivers/media/pci/saa7164/saa7164-core.c index 57ef5456f1e8..1bf06970ca3e 100644 --- a/drivers/media/pci/saa7164/saa7164-core.c +++ b/drivers/media/pci/saa7164/saa7164-core.c | |||
@@ -1354,9 +1354,11 @@ static int saa7164_initdev(struct pci_dev *pci_dev, | |||
1354 | if (fw_debug) { | 1354 | if (fw_debug) { |
1355 | dev->kthread = kthread_run(saa7164_thread_function, dev, | 1355 | dev->kthread = kthread_run(saa7164_thread_function, dev, |
1356 | "saa7164 debug"); | 1356 | "saa7164 debug"); |
1357 | if (!dev->kthread) | 1357 | if (IS_ERR(dev->kthread)) { |
1358 | dev->kthread = NULL; | ||
1358 | printk(KERN_ERR "%s() Failed to create " | 1359 | printk(KERN_ERR "%s() Failed to create " |
1359 | "debug kernel thread\n", __func__); | 1360 | "debug kernel thread\n", __func__); |
1361 | } | ||
1360 | } | 1362 | } |
1361 | 1363 | ||
1362 | } /* != BOARD_UNKNOWN */ | 1364 | } /* != BOARD_UNKNOWN */ |
diff --git a/drivers/media/platform/coda.c b/drivers/media/platform/coda.c index bd72fb97fea5..61f3dbcc259f 100644 --- a/drivers/media/platform/coda.c +++ b/drivers/media/platform/coda.c | |||
@@ -1434,7 +1434,7 @@ static void coda_buf_queue(struct vb2_buffer *vb) | |||
1434 | if (q_data->fourcc == V4L2_PIX_FMT_H264 && | 1434 | if (q_data->fourcc == V4L2_PIX_FMT_H264 && |
1435 | vb->vb2_queue->type == V4L2_BUF_TYPE_VIDEO_OUTPUT) { | 1435 | vb->vb2_queue->type == V4L2_BUF_TYPE_VIDEO_OUTPUT) { |
1436 | /* | 1436 | /* |
1437 | * For backwards compatiblity, queuing an empty buffer marks | 1437 | * For backwards compatibility, queuing an empty buffer marks |
1438 | * the stream end | 1438 | * the stream end |
1439 | */ | 1439 | */ |
1440 | if (vb2_get_plane_payload(vb, 0) == 0) | 1440 | if (vb2_get_plane_payload(vb, 0) == 0) |
diff --git a/drivers/media/platform/exynos4-is/fimc-core.c b/drivers/media/platform/exynos4-is/fimc-core.c index 3d66d88ea3a1..f7915695c907 100644 --- a/drivers/media/platform/exynos4-is/fimc-core.c +++ b/drivers/media/platform/exynos4-is/fimc-core.c | |||
@@ -1039,7 +1039,7 @@ static int fimc_runtime_resume(struct device *dev) | |||
1039 | 1039 | ||
1040 | dbg("fimc%d: state: 0x%lx", fimc->id, fimc->state); | 1040 | dbg("fimc%d: state: 0x%lx", fimc->id, fimc->state); |
1041 | 1041 | ||
1042 | /* Enable clocks and perform basic initalization */ | 1042 | /* Enable clocks and perform basic initialization */ |
1043 | clk_enable(fimc->clock[CLK_GATE]); | 1043 | clk_enable(fimc->clock[CLK_GATE]); |
1044 | fimc_hw_reset(fimc); | 1044 | fimc_hw_reset(fimc); |
1045 | 1045 | ||
diff --git a/drivers/media/platform/exynos4-is/media-dev.c b/drivers/media/platform/exynos4-is/media-dev.c index 7a4ee4c0449d..c1bce170df6f 100644 --- a/drivers/media/platform/exynos4-is/media-dev.c +++ b/drivers/media/platform/exynos4-is/media-dev.c | |||
@@ -759,7 +759,7 @@ static int fimc_md_register_platform_entity(struct fimc_md *fmd, | |||
759 | goto dev_unlock; | 759 | goto dev_unlock; |
760 | 760 | ||
761 | drvdata = dev_get_drvdata(dev); | 761 | drvdata = dev_get_drvdata(dev); |
762 | /* Some subdev didn't probe succesfully id drvdata is NULL */ | 762 | /* Some subdev didn't probe successfully id drvdata is NULL */ |
763 | if (drvdata) { | 763 | if (drvdata) { |
764 | switch (plat_entity) { | 764 | switch (plat_entity) { |
765 | case IDX_FIMC: | 765 | case IDX_FIMC: |
diff --git a/drivers/media/platform/marvell-ccic/mmp-driver.c b/drivers/media/platform/marvell-ccic/mmp-driver.c index 3458fa0e2fd5..054507f16734 100644 --- a/drivers/media/platform/marvell-ccic/mmp-driver.c +++ b/drivers/media/platform/marvell-ccic/mmp-driver.c | |||
@@ -142,12 +142,6 @@ static int mmpcam_power_up(struct mcam_camera *mcam) | |||
142 | struct mmp_camera *cam = mcam_to_cam(mcam); | 142 | struct mmp_camera *cam = mcam_to_cam(mcam); |
143 | struct mmp_camera_platform_data *pdata; | 143 | struct mmp_camera_platform_data *pdata; |
144 | 144 | ||
145 | if (mcam->bus_type == V4L2_MBUS_CSI2) { | ||
146 | cam->mipi_clk = devm_clk_get(mcam->dev, "mipi"); | ||
147 | if ((IS_ERR(cam->mipi_clk) && mcam->dphy[2] == 0)) | ||
148 | return PTR_ERR(cam->mipi_clk); | ||
149 | } | ||
150 | |||
151 | /* | 145 | /* |
152 | * Turn on power and clocks to the controller. | 146 | * Turn on power and clocks to the controller. |
153 | */ | 147 | */ |
@@ -186,12 +180,6 @@ static void mmpcam_power_down(struct mcam_camera *mcam) | |||
186 | gpio_set_value(pdata->sensor_power_gpio, 0); | 180 | gpio_set_value(pdata->sensor_power_gpio, 0); |
187 | gpio_set_value(pdata->sensor_reset_gpio, 0); | 181 | gpio_set_value(pdata->sensor_reset_gpio, 0); |
188 | 182 | ||
189 | if (mcam->bus_type == V4L2_MBUS_CSI2 && !IS_ERR(cam->mipi_clk)) { | ||
190 | if (cam->mipi_clk) | ||
191 | devm_clk_put(mcam->dev, cam->mipi_clk); | ||
192 | cam->mipi_clk = NULL; | ||
193 | } | ||
194 | |||
195 | mcam_clk_disable(mcam); | 183 | mcam_clk_disable(mcam); |
196 | } | 184 | } |
197 | 185 | ||
@@ -292,8 +280,9 @@ void mmpcam_calc_dphy(struct mcam_camera *mcam) | |||
292 | return; | 280 | return; |
293 | 281 | ||
294 | /* get the escape clk, this is hard coded */ | 282 | /* get the escape clk, this is hard coded */ |
283 | clk_prepare_enable(cam->mipi_clk); | ||
295 | tx_clk_esc = (clk_get_rate(cam->mipi_clk) / 1000000) / 12; | 284 | tx_clk_esc = (clk_get_rate(cam->mipi_clk) / 1000000) / 12; |
296 | 285 | clk_disable_unprepare(cam->mipi_clk); | |
297 | /* | 286 | /* |
298 | * dphy[2] - CSI2_DPHY6: | 287 | * dphy[2] - CSI2_DPHY6: |
299 | * bit 0 ~ bit 7: CK Term Enable | 288 | * bit 0 ~ bit 7: CK Term Enable |
@@ -325,19 +314,6 @@ static irqreturn_t mmpcam_irq(int irq, void *data) | |||
325 | return IRQ_RETVAL(handled); | 314 | return IRQ_RETVAL(handled); |
326 | } | 315 | } |
327 | 316 | ||
328 | static void mcam_deinit_clk(struct mcam_camera *mcam) | ||
329 | { | ||
330 | unsigned int i; | ||
331 | |||
332 | for (i = 0; i < NR_MCAM_CLK; i++) { | ||
333 | if (!IS_ERR(mcam->clk[i])) { | ||
334 | if (mcam->clk[i]) | ||
335 | devm_clk_put(mcam->dev, mcam->clk[i]); | ||
336 | } | ||
337 | mcam->clk[i] = NULL; | ||
338 | } | ||
339 | } | ||
340 | |||
341 | static void mcam_init_clk(struct mcam_camera *mcam) | 317 | static void mcam_init_clk(struct mcam_camera *mcam) |
342 | { | 318 | { |
343 | unsigned int i; | 319 | unsigned int i; |
@@ -371,7 +347,6 @@ static int mmpcam_probe(struct platform_device *pdev) | |||
371 | if (cam == NULL) | 347 | if (cam == NULL) |
372 | return -ENOMEM; | 348 | return -ENOMEM; |
373 | cam->pdev = pdev; | 349 | cam->pdev = pdev; |
374 | cam->mipi_clk = NULL; | ||
375 | INIT_LIST_HEAD(&cam->devlist); | 350 | INIT_LIST_HEAD(&cam->devlist); |
376 | 351 | ||
377 | mcam = &cam->mcam; | 352 | mcam = &cam->mcam; |
@@ -387,6 +362,11 @@ static int mmpcam_probe(struct platform_device *pdev) | |||
387 | mcam->mclk_div = pdata->mclk_div; | 362 | mcam->mclk_div = pdata->mclk_div; |
388 | mcam->bus_type = pdata->bus_type; | 363 | mcam->bus_type = pdata->bus_type; |
389 | mcam->dphy = pdata->dphy; | 364 | mcam->dphy = pdata->dphy; |
365 | if (mcam->bus_type == V4L2_MBUS_CSI2) { | ||
366 | cam->mipi_clk = devm_clk_get(mcam->dev, "mipi"); | ||
367 | if ((IS_ERR(cam->mipi_clk) && mcam->dphy[2] == 0)) | ||
368 | return PTR_ERR(cam->mipi_clk); | ||
369 | } | ||
390 | mcam->mipi_enabled = false; | 370 | mcam->mipi_enabled = false; |
391 | mcam->lane = pdata->lane; | 371 | mcam->lane = pdata->lane; |
392 | mcam->chip_id = MCAM_ARMADA610; | 372 | mcam->chip_id = MCAM_ARMADA610; |
@@ -444,7 +424,7 @@ static int mmpcam_probe(struct platform_device *pdev) | |||
444 | */ | 424 | */ |
445 | ret = mmpcam_power_up(mcam); | 425 | ret = mmpcam_power_up(mcam); |
446 | if (ret) | 426 | if (ret) |
447 | goto out_deinit_clk; | 427 | return ret; |
448 | ret = mccic_register(mcam); | 428 | ret = mccic_register(mcam); |
449 | if (ret) | 429 | if (ret) |
450 | goto out_power_down; | 430 | goto out_power_down; |
@@ -469,8 +449,6 @@ out_unregister: | |||
469 | mccic_shutdown(mcam); | 449 | mccic_shutdown(mcam); |
470 | out_power_down: | 450 | out_power_down: |
471 | mmpcam_power_down(mcam); | 451 | mmpcam_power_down(mcam); |
472 | out_deinit_clk: | ||
473 | mcam_deinit_clk(mcam); | ||
474 | return ret; | 452 | return ret; |
475 | } | 453 | } |
476 | 454 | ||
@@ -478,18 +456,10 @@ out_deinit_clk: | |||
478 | static int mmpcam_remove(struct mmp_camera *cam) | 456 | static int mmpcam_remove(struct mmp_camera *cam) |
479 | { | 457 | { |
480 | struct mcam_camera *mcam = &cam->mcam; | 458 | struct mcam_camera *mcam = &cam->mcam; |
481 | struct mmp_camera_platform_data *pdata; | ||
482 | 459 | ||
483 | mmpcam_remove_device(cam); | 460 | mmpcam_remove_device(cam); |
484 | mccic_shutdown(mcam); | 461 | mccic_shutdown(mcam); |
485 | mmpcam_power_down(mcam); | 462 | mmpcam_power_down(mcam); |
486 | pdata = cam->pdev->dev.platform_data; | ||
487 | gpio_free(pdata->sensor_reset_gpio); | ||
488 | gpio_free(pdata->sensor_power_gpio); | ||
489 | mcam_deinit_clk(mcam); | ||
490 | iounmap(cam->power_regs); | ||
491 | iounmap(mcam->regs); | ||
492 | kfree(cam); | ||
493 | return 0; | 463 | return 0; |
494 | } | 464 | } |
495 | 465 | ||
diff --git a/drivers/media/platform/omap3isp/isp.c b/drivers/media/platform/omap3isp/isp.c index 1c3608039663..561bce8ffb1b 100644 --- a/drivers/media/platform/omap3isp/isp.c +++ b/drivers/media/platform/omap3isp/isp.c | |||
@@ -1673,7 +1673,7 @@ void omap3isp_print_status(struct isp_device *isp) | |||
1673 | * ISP clocks get disabled in suspend(). Similarly, the clocks are reenabled in | 1673 | * ISP clocks get disabled in suspend(). Similarly, the clocks are reenabled in |
1674 | * resume(), and the the pipelines are restarted in complete(). | 1674 | * resume(), and the the pipelines are restarted in complete(). |
1675 | * | 1675 | * |
1676 | * TODO: PM dependencies between the ISP and sensors are not modeled explicitly | 1676 | * TODO: PM dependencies between the ISP and sensors are not modelled explicitly |
1677 | * yet. | 1677 | * yet. |
1678 | */ | 1678 | */ |
1679 | static int isp_pm_prepare(struct device *dev) | 1679 | static int isp_pm_prepare(struct device *dev) |
diff --git a/drivers/media/platform/omap3isp/ispvideo.c b/drivers/media/platform/omap3isp/ispvideo.c index a908d006f527..f6304bb074f5 100644 --- a/drivers/media/platform/omap3isp/ispvideo.c +++ b/drivers/media/platform/omap3isp/ispvideo.c | |||
@@ -339,14 +339,11 @@ __isp_video_get_format(struct isp_video *video, struct v4l2_format *format) | |||
339 | if (subdev == NULL) | 339 | if (subdev == NULL) |
340 | return -EINVAL; | 340 | return -EINVAL; |
341 | 341 | ||
342 | mutex_lock(&video->mutex); | ||
343 | |||
344 | fmt.pad = pad; | 342 | fmt.pad = pad; |
345 | fmt.which = V4L2_SUBDEV_FORMAT_ACTIVE; | 343 | fmt.which = V4L2_SUBDEV_FORMAT_ACTIVE; |
346 | ret = v4l2_subdev_call(subdev, pad, get_fmt, NULL, &fmt); | ||
347 | if (ret == -ENOIOCTLCMD) | ||
348 | ret = -EINVAL; | ||
349 | 344 | ||
345 | mutex_lock(&video->mutex); | ||
346 | ret = v4l2_subdev_call(subdev, pad, get_fmt, NULL, &fmt); | ||
350 | mutex_unlock(&video->mutex); | 347 | mutex_unlock(&video->mutex); |
351 | 348 | ||
352 | if (ret) | 349 | if (ret) |
diff --git a/drivers/media/platform/s5p-mfc/regs-mfc.h b/drivers/media/platform/s5p-mfc/regs-mfc.h index 9319e93599ae..6ccc3f8c122a 100644 --- a/drivers/media/platform/s5p-mfc/regs-mfc.h +++ b/drivers/media/platform/s5p-mfc/regs-mfc.h | |||
@@ -382,7 +382,7 @@ | |||
382 | #define S5P_FIMV_R2H_CMD_EDFU_INIT_RET 16 | 382 | #define S5P_FIMV_R2H_CMD_EDFU_INIT_RET 16 |
383 | #define S5P_FIMV_R2H_CMD_ERR_RET 32 | 383 | #define S5P_FIMV_R2H_CMD_ERR_RET 32 |
384 | 384 | ||
385 | /* Dummy definition for MFCv6 compatibilty */ | 385 | /* Dummy definition for MFCv6 compatibility */ |
386 | #define S5P_FIMV_CODEC_H264_MVC_DEC -1 | 386 | #define S5P_FIMV_CODEC_H264_MVC_DEC -1 |
387 | #define S5P_FIMV_R2H_CMD_FIELD_DONE_RET -1 | 387 | #define S5P_FIMV_R2H_CMD_FIELD_DONE_RET -1 |
388 | #define S5P_FIMV_MFC_RESET -1 | 388 | #define S5P_FIMV_MFC_RESET -1 |
diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc.c b/drivers/media/platform/s5p-mfc/s5p_mfc.c index 5f2c4ad6c2cb..e46067a57853 100644 --- a/drivers/media/platform/s5p-mfc/s5p_mfc.c +++ b/drivers/media/platform/s5p-mfc/s5p_mfc.c | |||
@@ -239,7 +239,7 @@ static void s5p_mfc_handle_frame_copy_time(struct s5p_mfc_ctx *ctx) | |||
239 | frame_type = s5p_mfc_hw_call(dev->mfc_ops, get_dec_frame_type, dev); | 239 | frame_type = s5p_mfc_hw_call(dev->mfc_ops, get_dec_frame_type, dev); |
240 | 240 | ||
241 | /* Copy timestamp / timecode from decoded src to dst and set | 241 | /* Copy timestamp / timecode from decoded src to dst and set |
242 | appropraite flags */ | 242 | appropriate flags */ |
243 | src_buf = list_entry(ctx->src_queue.next, struct s5p_mfc_buf, list); | 243 | src_buf = list_entry(ctx->src_queue.next, struct s5p_mfc_buf, list); |
244 | list_for_each_entry(dst_buf, &ctx->dst_queue, list) { | 244 | list_for_each_entry(dst_buf, &ctx->dst_queue, list) { |
245 | if (vb2_dma_contig_plane_dma_addr(dst_buf->b, 0) == dec_y_addr) { | 245 | if (vb2_dma_contig_plane_dma_addr(dst_buf->b, 0) == dec_y_addr) { |
@@ -428,7 +428,7 @@ static void s5p_mfc_handle_error(struct s5p_mfc_dev *dev, | |||
428 | case MFCINST_FINISHING: | 428 | case MFCINST_FINISHING: |
429 | case MFCINST_FINISHED: | 429 | case MFCINST_FINISHED: |
430 | case MFCINST_RUNNING: | 430 | case MFCINST_RUNNING: |
431 | /* It is higly probable that an error occured | 431 | /* It is highly probable that an error occurred |
432 | * while decoding a frame */ | 432 | * while decoding a frame */ |
433 | clear_work_bit(ctx); | 433 | clear_work_bit(ctx); |
434 | ctx->state = MFCINST_ERROR; | 434 | ctx->state = MFCINST_ERROR; |
@@ -611,7 +611,7 @@ static irqreturn_t s5p_mfc_irq(int irq, void *priv) | |||
611 | mfc_debug(1, "Int reason: %d (err: %08x)\n", reason, err); | 611 | mfc_debug(1, "Int reason: %d (err: %08x)\n", reason, err); |
612 | switch (reason) { | 612 | switch (reason) { |
613 | case S5P_MFC_R2H_CMD_ERR_RET: | 613 | case S5P_MFC_R2H_CMD_ERR_RET: |
614 | /* An error has occured */ | 614 | /* An error has occurred */ |
615 | if (ctx->state == MFCINST_RUNNING && | 615 | if (ctx->state == MFCINST_RUNNING && |
616 | s5p_mfc_hw_call(dev->mfc_ops, err_dec, err) >= | 616 | s5p_mfc_hw_call(dev->mfc_ops, err_dec, err) >= |
617 | dev->warn_start) | 617 | dev->warn_start) |
@@ -840,7 +840,7 @@ static int s5p_mfc_open(struct file *file) | |||
840 | mutex_unlock(&dev->mfc_mutex); | 840 | mutex_unlock(&dev->mfc_mutex); |
841 | mfc_debug_leave(); | 841 | mfc_debug_leave(); |
842 | return ret; | 842 | return ret; |
843 | /* Deinit when failure occured */ | 843 | /* Deinit when failure occurred */ |
844 | err_queue_init: | 844 | err_queue_init: |
845 | if (dev->num_inst == 1) | 845 | if (dev->num_inst == 1) |
846 | s5p_mfc_deinit_hw(dev); | 846 | s5p_mfc_deinit_hw(dev); |
@@ -881,14 +881,14 @@ static int s5p_mfc_release(struct file *file) | |||
881 | /* Mark context as idle */ | 881 | /* Mark context as idle */ |
882 | clear_work_bit_irqsave(ctx); | 882 | clear_work_bit_irqsave(ctx); |
883 | /* If instance was initialised then | 883 | /* If instance was initialised then |
884 | * return instance and free reosurces */ | 884 | * return instance and free resources */ |
885 | if (ctx->inst_no != MFC_NO_INSTANCE_SET) { | 885 | if (ctx->inst_no != MFC_NO_INSTANCE_SET) { |
886 | mfc_debug(2, "Has to free instance\n"); | 886 | mfc_debug(2, "Has to free instance\n"); |
887 | ctx->state = MFCINST_RETURN_INST; | 887 | ctx->state = MFCINST_RETURN_INST; |
888 | set_work_bit_irqsave(ctx); | 888 | set_work_bit_irqsave(ctx); |
889 | s5p_mfc_clean_ctx_int_flags(ctx); | 889 | s5p_mfc_clean_ctx_int_flags(ctx); |
890 | s5p_mfc_hw_call(dev->mfc_ops, try_run, dev); | 890 | s5p_mfc_hw_call(dev->mfc_ops, try_run, dev); |
891 | /* Wait until instance is returned or timeout occured */ | 891 | /* Wait until instance is returned or timeout occurred */ |
892 | if (s5p_mfc_wait_for_done_ctx | 892 | if (s5p_mfc_wait_for_done_ctx |
893 | (ctx, S5P_MFC_R2H_CMD_CLOSE_INSTANCE_RET, 0)) { | 893 | (ctx, S5P_MFC_R2H_CMD_CLOSE_INSTANCE_RET, 0)) { |
894 | s5p_mfc_clock_off(); | 894 | s5p_mfc_clock_off(); |
diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_ctrl.c b/drivers/media/platform/s5p-mfc/s5p_mfc_ctrl.c index 7cab6849fb5b..2475a3c9a0a6 100644 --- a/drivers/media/platform/s5p-mfc/s5p_mfc_ctrl.c +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_ctrl.c | |||
@@ -69,7 +69,7 @@ int s5p_mfc_alloc_firmware(struct s5p_mfc_dev *dev) | |||
69 | 69 | ||
70 | } else { | 70 | } else { |
71 | /* In this case bank2 can point to the same address as bank1. | 71 | /* In this case bank2 can point to the same address as bank1. |
72 | * Firmware will always occupy the beggining of this area so it is | 72 | * Firmware will always occupy the beginning of this area so it is |
73 | * impossible having a video frame buffer with zero address. */ | 73 | * impossible having a video frame buffer with zero address. */ |
74 | dev->bank2 = dev->bank1; | 74 | dev->bank2 = dev->bank1; |
75 | } | 75 | } |
diff --git a/drivers/media/platform/s5p-tv/mixer.h b/drivers/media/platform/s5p-tv/mixer.h index 04e6490a45be..fb2acc53112a 100644 --- a/drivers/media/platform/s5p-tv/mixer.h +++ b/drivers/media/platform/s5p-tv/mixer.h | |||
@@ -65,7 +65,7 @@ struct mxr_format { | |||
65 | int num_subframes; | 65 | int num_subframes; |
66 | /** specifies to which subframe belong given plane */ | 66 | /** specifies to which subframe belong given plane */ |
67 | int plane2subframe[MXR_MAX_PLANES]; | 67 | int plane2subframe[MXR_MAX_PLANES]; |
68 | /** internal code, driver dependant */ | 68 | /** internal code, driver dependent */ |
69 | unsigned long cookie; | 69 | unsigned long cookie; |
70 | }; | 70 | }; |
71 | 71 | ||
diff --git a/drivers/media/platform/s5p-tv/mixer_video.c b/drivers/media/platform/s5p-tv/mixer_video.c index 641b1f071e06..81b97db111d8 100644 --- a/drivers/media/platform/s5p-tv/mixer_video.c +++ b/drivers/media/platform/s5p-tv/mixer_video.c | |||
@@ -528,7 +528,7 @@ static int mxr_s_dv_timings(struct file *file, void *fh, | |||
528 | mutex_lock(&mdev->mutex); | 528 | mutex_lock(&mdev->mutex); |
529 | 529 | ||
530 | /* timings change cannot be done while there is an entity | 530 | /* timings change cannot be done while there is an entity |
531 | * dependant on output configuration | 531 | * dependent on output configuration |
532 | */ | 532 | */ |
533 | if (mdev->n_output > 0) { | 533 | if (mdev->n_output > 0) { |
534 | mutex_unlock(&mdev->mutex); | 534 | mutex_unlock(&mdev->mutex); |
@@ -585,7 +585,7 @@ static int mxr_s_std(struct file *file, void *fh, v4l2_std_id norm) | |||
585 | mutex_lock(&mdev->mutex); | 585 | mutex_lock(&mdev->mutex); |
586 | 586 | ||
587 | /* standard change cannot be done while there is an entity | 587 | /* standard change cannot be done while there is an entity |
588 | * dependant on output configuration | 588 | * dependent on output configuration |
589 | */ | 589 | */ |
590 | if (mdev->n_output > 0) { | 590 | if (mdev->n_output > 0) { |
591 | mutex_unlock(&mdev->mutex); | 591 | mutex_unlock(&mdev->mutex); |
diff --git a/drivers/media/platform/soc_camera/omap1_camera.c b/drivers/media/platform/soc_camera/omap1_camera.c index 6769193c7c7b..74ce8b6b79fa 100644 --- a/drivers/media/platform/soc_camera/omap1_camera.c +++ b/drivers/media/platform/soc_camera/omap1_camera.c | |||
@@ -1495,7 +1495,7 @@ static int omap1_cam_set_bus_param(struct soc_camera_device *icd) | |||
1495 | if (ctrlclock & LCLK_EN) | 1495 | if (ctrlclock & LCLK_EN) |
1496 | CAM_WRITE(pcdev, CTRLCLOCK, ctrlclock); | 1496 | CAM_WRITE(pcdev, CTRLCLOCK, ctrlclock); |
1497 | 1497 | ||
1498 | /* select bus endianess */ | 1498 | /* select bus endianness */ |
1499 | xlate = soc_camera_xlate_by_fourcc(icd, pixfmt); | 1499 | xlate = soc_camera_xlate_by_fourcc(icd, pixfmt); |
1500 | fmt = xlate->host_fmt; | 1500 | fmt = xlate->host_fmt; |
1501 | 1501 | ||
diff --git a/drivers/media/platform/vivi.c b/drivers/media/platform/vivi.c index 1d3f11965196..2d4e73b45c5e 100644 --- a/drivers/media/platform/vivi.c +++ b/drivers/media/platform/vivi.c | |||
@@ -1108,7 +1108,7 @@ static int vidioc_s_input(struct file *file, void *priv, unsigned int i) | |||
1108 | return 0; | 1108 | return 0; |
1109 | } | 1109 | } |
1110 | 1110 | ||
1111 | /* timeperframe is arbitrary and continous */ | 1111 | /* timeperframe is arbitrary and continuous */ |
1112 | static int vidioc_enum_frameintervals(struct file *file, void *priv, | 1112 | static int vidioc_enum_frameintervals(struct file *file, void *priv, |
1113 | struct v4l2_frmivalenum *fival) | 1113 | struct v4l2_frmivalenum *fival) |
1114 | { | 1114 | { |
@@ -1125,7 +1125,7 @@ static int vidioc_enum_frameintervals(struct file *file, void *priv, | |||
1125 | 1125 | ||
1126 | fival->type = V4L2_FRMIVAL_TYPE_CONTINUOUS; | 1126 | fival->type = V4L2_FRMIVAL_TYPE_CONTINUOUS; |
1127 | 1127 | ||
1128 | /* fill in stepwise (step=1.0 is requred by V4L2 spec) */ | 1128 | /* fill in stepwise (step=1.0 is required by V4L2 spec) */ |
1129 | fival->stepwise.min = tpf_min; | 1129 | fival->stepwise.min = tpf_min; |
1130 | fival->stepwise.max = tpf_max; | 1130 | fival->stepwise.max = tpf_max; |
1131 | fival->stepwise.step = (struct v4l2_fract) {1, 1}; | 1131 | fival->stepwise.step = (struct v4l2_fract) {1, 1}; |
diff --git a/drivers/media/platform/vsp1/vsp1_drv.c b/drivers/media/platform/vsp1/vsp1_drv.c index 1c9e771aa15c..d16bf0f41e24 100644 --- a/drivers/media/platform/vsp1/vsp1_drv.c +++ b/drivers/media/platform/vsp1/vsp1_drv.c | |||
@@ -323,7 +323,7 @@ static void vsp1_clocks_disable(struct vsp1_device *vsp1) | |||
323 | * Increment the VSP1 reference count and initialize the device if the first | 323 | * Increment the VSP1 reference count and initialize the device if the first |
324 | * reference is taken. | 324 | * reference is taken. |
325 | * | 325 | * |
326 | * Return a pointer to the VSP1 device or NULL if an error occured. | 326 | * Return a pointer to the VSP1 device or NULL if an error occurred. |
327 | */ | 327 | */ |
328 | struct vsp1_device *vsp1_device_get(struct vsp1_device *vsp1) | 328 | struct vsp1_device *vsp1_device_get(struct vsp1_device *vsp1) |
329 | { | 329 | { |
diff --git a/drivers/media/platform/vsp1/vsp1_video.c b/drivers/media/platform/vsp1/vsp1_video.c index 714c53ef6c11..4b0ac07af662 100644 --- a/drivers/media/platform/vsp1/vsp1_video.c +++ b/drivers/media/platform/vsp1/vsp1_video.c | |||
@@ -1026,8 +1026,10 @@ int vsp1_video_init(struct vsp1_video *video, struct vsp1_entity *rwpf) | |||
1026 | 1026 | ||
1027 | /* ... and the buffers queue... */ | 1027 | /* ... and the buffers queue... */ |
1028 | video->alloc_ctx = vb2_dma_contig_init_ctx(video->vsp1->dev); | 1028 | video->alloc_ctx = vb2_dma_contig_init_ctx(video->vsp1->dev); |
1029 | if (IS_ERR(video->alloc_ctx)) | 1029 | if (IS_ERR(video->alloc_ctx)) { |
1030 | ret = PTR_ERR(video->alloc_ctx); | ||
1030 | goto error; | 1031 | goto error; |
1032 | } | ||
1031 | 1033 | ||
1032 | video->queue.type = video->type; | 1034 | video->queue.type = video->type; |
1033 | video->queue.io_modes = VB2_MMAP | VB2_USERPTR | VB2_DMABUF; | 1035 | video->queue.io_modes = VB2_MMAP | VB2_USERPTR | VB2_DMABUF; |
diff --git a/drivers/media/radio/radio-shark.c b/drivers/media/radio/radio-shark.c index 3db8a8cfe1a8..050b3bb96fec 100644 --- a/drivers/media/radio/radio-shark.c +++ b/drivers/media/radio/radio-shark.c | |||
@@ -271,8 +271,7 @@ static void shark_unregister_leds(struct shark_device *shark) | |||
271 | cancel_work_sync(&shark->led_work); | 271 | cancel_work_sync(&shark->led_work); |
272 | } | 272 | } |
273 | 273 | ||
274 | #ifdef CONFIG_PM | 274 | static inline void shark_resume_leds(struct shark_device *shark) |
275 | static void shark_resume_leds(struct shark_device *shark) | ||
276 | { | 275 | { |
277 | if (test_bit(BLUE_IS_PULSE, &shark->brightness_new)) | 276 | if (test_bit(BLUE_IS_PULSE, &shark->brightness_new)) |
278 | set_bit(BLUE_PULSE_LED, &shark->brightness_new); | 277 | set_bit(BLUE_PULSE_LED, &shark->brightness_new); |
@@ -281,7 +280,6 @@ static void shark_resume_leds(struct shark_device *shark) | |||
281 | set_bit(RED_LED, &shark->brightness_new); | 280 | set_bit(RED_LED, &shark->brightness_new); |
282 | schedule_work(&shark->led_work); | 281 | schedule_work(&shark->led_work); |
283 | } | 282 | } |
284 | #endif | ||
285 | #else | 283 | #else |
286 | static int shark_register_leds(struct shark_device *shark, struct device *dev) | 284 | static int shark_register_leds(struct shark_device *shark, struct device *dev) |
287 | { | 285 | { |
diff --git a/drivers/media/radio/radio-shark2.c b/drivers/media/radio/radio-shark2.c index d86d90dab8bf..8654e0dc5c95 100644 --- a/drivers/media/radio/radio-shark2.c +++ b/drivers/media/radio/radio-shark2.c | |||
@@ -237,8 +237,7 @@ static void shark_unregister_leds(struct shark_device *shark) | |||
237 | cancel_work_sync(&shark->led_work); | 237 | cancel_work_sync(&shark->led_work); |
238 | } | 238 | } |
239 | 239 | ||
240 | #ifdef CONFIG_PM | 240 | static inline void shark_resume_leds(struct shark_device *shark) |
241 | static void shark_resume_leds(struct shark_device *shark) | ||
242 | { | 241 | { |
243 | int i; | 242 | int i; |
244 | 243 | ||
@@ -247,7 +246,6 @@ static void shark_resume_leds(struct shark_device *shark) | |||
247 | 246 | ||
248 | schedule_work(&shark->led_work); | 247 | schedule_work(&shark->led_work); |
249 | } | 248 | } |
250 | #endif | ||
251 | #else | 249 | #else |
252 | static int shark_register_leds(struct shark_device *shark, struct device *dev) | 250 | static int shark_register_leds(struct shark_device *shark, struct device *dev) |
253 | { | 251 | { |
diff --git a/drivers/media/radio/radio-si476x.c b/drivers/media/radio/radio-si476x.c index 9c9084cb99f7..2fd9009f8663 100644 --- a/drivers/media/radio/radio-si476x.c +++ b/drivers/media/radio/radio-si476x.c | |||
@@ -268,8 +268,8 @@ struct si476x_radio; | |||
268 | * | 268 | * |
269 | * @tune_freq: Tune chip to a specific frequency | 269 | * @tune_freq: Tune chip to a specific frequency |
270 | * @seek_start: Star station seeking | 270 | * @seek_start: Star station seeking |
271 | * @rsq_status: Get Recieved Signal Quality(RSQ) status | 271 | * @rsq_status: Get Received Signal Quality(RSQ) status |
272 | * @rds_blckcnt: Get recived RDS blocks count | 272 | * @rds_blckcnt: Get received RDS blocks count |
273 | * @phase_diversity: Change phase diversity mode of the tuner | 273 | * @phase_diversity: Change phase diversity mode of the tuner |
274 | * @phase_div_status: Get phase diversity mode status | 274 | * @phase_div_status: Get phase diversity mode status |
275 | * @acf_status: Get the status of Automatically Controlled | 275 | * @acf_status: Get the status of Automatically Controlled |
diff --git a/drivers/media/radio/radio-tea5764.c b/drivers/media/radio/radio-tea5764.c index 036e2f54f4db..3ed1f5669f79 100644 --- a/drivers/media/radio/radio-tea5764.c +++ b/drivers/media/radio/radio-tea5764.c | |||
@@ -356,7 +356,7 @@ static int vidioc_s_frequency(struct file *file, void *priv, | |||
356 | So we keep it as-is. */ | 356 | So we keep it as-is. */ |
357 | return -EINVAL; | 357 | return -EINVAL; |
358 | } | 358 | } |
359 | clamp(freq, FREQ_MIN * FREQ_MUL, FREQ_MAX * FREQ_MUL); | 359 | freq = clamp(freq, FREQ_MIN * FREQ_MUL, FREQ_MAX * FREQ_MUL); |
360 | tea5764_power_up(radio); | 360 | tea5764_power_up(radio); |
361 | tea5764_tune(radio, (freq * 125) / 2); | 361 | tea5764_tune(radio, (freq * 125) / 2); |
362 | return 0; | 362 | return 0; |
diff --git a/drivers/media/radio/tef6862.c b/drivers/media/radio/tef6862.c index 69e3245a58a0..a9319a24c7ef 100644 --- a/drivers/media/radio/tef6862.c +++ b/drivers/media/radio/tef6862.c | |||
@@ -112,7 +112,7 @@ static int tef6862_s_frequency(struct v4l2_subdev *sd, const struct v4l2_frequen | |||
112 | if (f->tuner != 0) | 112 | if (f->tuner != 0) |
113 | return -EINVAL; | 113 | return -EINVAL; |
114 | 114 | ||
115 | clamp(freq, TEF6862_LO_FREQ, TEF6862_HI_FREQ); | 115 | freq = clamp(freq, TEF6862_LO_FREQ, TEF6862_HI_FREQ); |
116 | pll = 1964 + ((freq - TEF6862_LO_FREQ) * 20) / FREQ_MUL; | 116 | pll = 1964 + ((freq - TEF6862_LO_FREQ) * 20) / FREQ_MUL; |
117 | i2cmsg[0] = (MSA_MODE_PRESET << MSA_MODE_SHIFT) | WM_SUB_PLLM; | 117 | i2cmsg[0] = (MSA_MODE_PRESET << MSA_MODE_SHIFT) | WM_SUB_PLLM; |
118 | i2cmsg[1] = (pll >> 8) & 0xff; | 118 | i2cmsg[1] = (pll >> 8) & 0xff; |
diff --git a/drivers/media/rc/imon.c b/drivers/media/rc/imon.c index 72e3fa652481..f329485c6629 100644 --- a/drivers/media/rc/imon.c +++ b/drivers/media/rc/imon.c | |||
@@ -1370,7 +1370,7 @@ static void imon_pad_to_keys(struct imon_context *ictx, unsigned char *buf) | |||
1370 | * 0x68nnnnB7 to 0x6AnnnnB7, the left mouse button generates | 1370 | * 0x68nnnnB7 to 0x6AnnnnB7, the left mouse button generates |
1371 | * 0x688301b7 and the right one 0x688481b7. All other keys generate | 1371 | * 0x688301b7 and the right one 0x688481b7. All other keys generate |
1372 | * 0x2nnnnnnn. Position coordinate is encoded in buf[1] and buf[2] with | 1372 | * 0x2nnnnnnn. Position coordinate is encoded in buf[1] and buf[2] with |
1373 | * reversed endianess. Extract direction from buffer, rotate endianess, | 1373 | * reversed endianness. Extract direction from buffer, rotate endianness, |
1374 | * adjust sign and feed the values into stabilize(). The resulting codes | 1374 | * adjust sign and feed the values into stabilize(). The resulting codes |
1375 | * will be 0x01008000, 0x01007F00, which match the newer devices. | 1375 | * will be 0x01008000, 0x01007F00, which match the newer devices. |
1376 | */ | 1376 | */ |
diff --git a/drivers/media/rc/redrat3.c b/drivers/media/rc/redrat3.c index 094484fac94c..a5d4f883d053 100644 --- a/drivers/media/rc/redrat3.c +++ b/drivers/media/rc/redrat3.c | |||
@@ -118,7 +118,7 @@ static int debug; | |||
118 | #define RR3_IR_IO_LENGTH_FUZZ 0x04 | 118 | #define RR3_IR_IO_LENGTH_FUZZ 0x04 |
119 | /* Timeout for end of signal detection */ | 119 | /* Timeout for end of signal detection */ |
120 | #define RR3_IR_IO_SIG_TIMEOUT 0x05 | 120 | #define RR3_IR_IO_SIG_TIMEOUT 0x05 |
121 | /* Minumum value for pause recognition. */ | 121 | /* Minimum value for pause recognition. */ |
122 | #define RR3_IR_IO_MIN_PAUSE 0x06 | 122 | #define RR3_IR_IO_MIN_PAUSE 0x06 |
123 | 123 | ||
124 | /* Clock freq. of EZ-USB chip */ | 124 | /* Clock freq. of EZ-USB chip */ |
diff --git a/drivers/media/tuners/mt2063.c b/drivers/media/tuners/mt2063.c index 2e1a02e360ff..20cca405bf45 100644 --- a/drivers/media/tuners/mt2063.c +++ b/drivers/media/tuners/mt2063.c | |||
@@ -1195,7 +1195,7 @@ static u32 mt2063_set_dnc_output_enable(struct mt2063_state *state, | |||
1195 | * DNC Output is selected, the other is always off) | 1195 | * DNC Output is selected, the other is always off) |
1196 | * | 1196 | * |
1197 | * @state: ptr to mt2063_state structure | 1197 | * @state: ptr to mt2063_state structure |
1198 | * @Mode: desired reciever delivery system | 1198 | * @Mode: desired receiver delivery system |
1199 | * | 1199 | * |
1200 | * Note: Register cache must be valid for it to work | 1200 | * Note: Register cache must be valid for it to work |
1201 | */ | 1201 | */ |
@@ -2119,7 +2119,7 @@ static int mt2063_set_analog_params(struct dvb_frontend *fe, | |||
2119 | 2119 | ||
2120 | /* | 2120 | /* |
2121 | * As defined on EN 300 429, the DVB-C roll-off factor is 0.15. | 2121 | * As defined on EN 300 429, the DVB-C roll-off factor is 0.15. |
2122 | * So, the amount of the needed bandwith is given by: | 2122 | * So, the amount of the needed bandwidth is given by: |
2123 | * Bw = Symbol_rate * (1 + 0.15) | 2123 | * Bw = Symbol_rate * (1 + 0.15) |
2124 | * As such, the maximum symbol rate supported by 6 MHz is given by: | 2124 | * As such, the maximum symbol rate supported by 6 MHz is given by: |
2125 | * max_symbol_rate = 6 MHz / 1.15 = 5217391 Bauds | 2125 | * max_symbol_rate = 6 MHz / 1.15 = 5217391 Bauds |
diff --git a/drivers/media/tuners/tuner-xc2028-types.h b/drivers/media/tuners/tuner-xc2028-types.h index 74dc46a71f64..7e4798783db7 100644 --- a/drivers/media/tuners/tuner-xc2028-types.h +++ b/drivers/media/tuners/tuner-xc2028-types.h | |||
@@ -119,7 +119,7 @@ | |||
119 | #define V4L2_STD_A2 (V4L2_STD_A2_A | V4L2_STD_A2_B) | 119 | #define V4L2_STD_A2 (V4L2_STD_A2_A | V4L2_STD_A2_B) |
120 | #define V4L2_STD_NICAM (V4L2_STD_NICAM_A | V4L2_STD_NICAM_B) | 120 | #define V4L2_STD_NICAM (V4L2_STD_NICAM_A | V4L2_STD_NICAM_B) |
121 | 121 | ||
122 | /* To preserve backward compatibilty, | 122 | /* To preserve backward compatibility, |
123 | (std & V4L2_STD_AUDIO) = 0 means that ALL audio stds are supported | 123 | (std & V4L2_STD_AUDIO) = 0 means that ALL audio stds are supported |
124 | */ | 124 | */ |
125 | 125 | ||
diff --git a/drivers/media/usb/cx231xx/cx231xx-cards.c b/drivers/media/usb/cx231xx/cx231xx-cards.c index e9d017bea377..528cce958a82 100644 --- a/drivers/media/usb/cx231xx/cx231xx-cards.c +++ b/drivers/media/usb/cx231xx/cx231xx-cards.c | |||
@@ -1412,8 +1412,8 @@ err_v4l2: | |||
1412 | usb_set_intfdata(interface, NULL); | 1412 | usb_set_intfdata(interface, NULL); |
1413 | err_if: | 1413 | err_if: |
1414 | usb_put_dev(udev); | 1414 | usb_put_dev(udev); |
1415 | kfree(dev); | ||
1416 | clear_bit(dev->devno, &cx231xx_devused); | 1415 | clear_bit(dev->devno, &cx231xx_devused); |
1416 | kfree(dev); | ||
1417 | return retval; | 1417 | return retval; |
1418 | } | 1418 | } |
1419 | 1419 | ||
diff --git a/drivers/media/usb/dvb-usb-v2/af9035.c b/drivers/media/usb/dvb-usb-v2/af9035.c index c8fcd78425bd..8f9b2cea88f0 100644 --- a/drivers/media/usb/dvb-usb-v2/af9035.c +++ b/drivers/media/usb/dvb-usb-v2/af9035.c | |||
@@ -131,7 +131,7 @@ static int af9035_wr_regs(struct dvb_usb_device *d, u32 reg, u8 *val, int len) | |||
131 | { | 131 | { |
132 | u8 wbuf[MAX_XFER_SIZE]; | 132 | u8 wbuf[MAX_XFER_SIZE]; |
133 | u8 mbox = (reg >> 16) & 0xff; | 133 | u8 mbox = (reg >> 16) & 0xff; |
134 | struct usb_req req = { CMD_MEM_WR, mbox, sizeof(wbuf), wbuf, 0, NULL }; | 134 | struct usb_req req = { CMD_MEM_WR, mbox, 6 + len, wbuf, 0, NULL }; |
135 | 135 | ||
136 | if (6 + len > sizeof(wbuf)) { | 136 | if (6 + len > sizeof(wbuf)) { |
137 | dev_warn(&d->udev->dev, "%s: i2c wr: len=%d is too big!\n", | 137 | dev_warn(&d->udev->dev, "%s: i2c wr: len=%d is too big!\n", |
@@ -238,14 +238,15 @@ static int af9035_i2c_master_xfer(struct i2c_adapter *adap, | |||
238 | } else { | 238 | } else { |
239 | /* I2C */ | 239 | /* I2C */ |
240 | u8 buf[MAX_XFER_SIZE]; | 240 | u8 buf[MAX_XFER_SIZE]; |
241 | struct usb_req req = { CMD_I2C_RD, 0, sizeof(buf), | 241 | struct usb_req req = { CMD_I2C_RD, 0, 5 + msg[0].len, |
242 | buf, msg[1].len, msg[1].buf }; | 242 | buf, msg[1].len, msg[1].buf }; |
243 | 243 | ||
244 | if (5 + msg[0].len > sizeof(buf)) { | 244 | if (5 + msg[0].len > sizeof(buf)) { |
245 | dev_warn(&d->udev->dev, | 245 | dev_warn(&d->udev->dev, |
246 | "%s: i2c xfer: len=%d is too big!\n", | 246 | "%s: i2c xfer: len=%d is too big!\n", |
247 | KBUILD_MODNAME, msg[0].len); | 247 | KBUILD_MODNAME, msg[0].len); |
248 | return -EOPNOTSUPP; | 248 | ret = -EOPNOTSUPP; |
249 | goto unlock; | ||
249 | } | 250 | } |
250 | req.mbox |= ((msg[0].addr & 0x80) >> 3); | 251 | req.mbox |= ((msg[0].addr & 0x80) >> 3); |
251 | buf[0] = msg[1].len; | 252 | buf[0] = msg[1].len; |
@@ -274,14 +275,15 @@ static int af9035_i2c_master_xfer(struct i2c_adapter *adap, | |||
274 | } else { | 275 | } else { |
275 | /* I2C */ | 276 | /* I2C */ |
276 | u8 buf[MAX_XFER_SIZE]; | 277 | u8 buf[MAX_XFER_SIZE]; |
277 | struct usb_req req = { CMD_I2C_WR, 0, sizeof(buf), buf, | 278 | struct usb_req req = { CMD_I2C_WR, 0, 5 + msg[0].len, |
278 | 0, NULL }; | 279 | buf, 0, NULL }; |
279 | 280 | ||
280 | if (5 + msg[0].len > sizeof(buf)) { | 281 | if (5 + msg[0].len > sizeof(buf)) { |
281 | dev_warn(&d->udev->dev, | 282 | dev_warn(&d->udev->dev, |
282 | "%s: i2c xfer: len=%d is too big!\n", | 283 | "%s: i2c xfer: len=%d is too big!\n", |
283 | KBUILD_MODNAME, msg[0].len); | 284 | KBUILD_MODNAME, msg[0].len); |
284 | return -EOPNOTSUPP; | 285 | ret = -EOPNOTSUPP; |
286 | goto unlock; | ||
285 | } | 287 | } |
286 | req.mbox |= ((msg[0].addr & 0x80) >> 3); | 288 | req.mbox |= ((msg[0].addr & 0x80) >> 3); |
287 | buf[0] = msg[0].len; | 289 | buf[0] = msg[0].len; |
@@ -319,6 +321,7 @@ static int af9035_i2c_master_xfer(struct i2c_adapter *adap, | |||
319 | ret = -EOPNOTSUPP; | 321 | ret = -EOPNOTSUPP; |
320 | } | 322 | } |
321 | 323 | ||
324 | unlock: | ||
322 | mutex_unlock(&d->i2c_mutex); | 325 | mutex_unlock(&d->i2c_mutex); |
323 | 326 | ||
324 | if (ret < 0) | 327 | if (ret < 0) |
@@ -1534,6 +1537,8 @@ static const struct usb_device_id af9035_id_table[] = { | |||
1534 | /* XXX: that same ID [0ccd:0099] is used by af9015 driver too */ | 1537 | /* XXX: that same ID [0ccd:0099] is used by af9015 driver too */ |
1535 | { DVB_USB_DEVICE(USB_VID_TERRATEC, 0x0099, | 1538 | { DVB_USB_DEVICE(USB_VID_TERRATEC, 0x0099, |
1536 | &af9035_props, "TerraTec Cinergy T Stick Dual RC (rev. 2)", NULL) }, | 1539 | &af9035_props, "TerraTec Cinergy T Stick Dual RC (rev. 2)", NULL) }, |
1540 | { DVB_USB_DEVICE(USB_VID_LEADTEK, 0x6a05, | ||
1541 | &af9035_props, "Leadtek WinFast DTV Dongle Dual", NULL) }, | ||
1537 | { } | 1542 | { } |
1538 | }; | 1543 | }; |
1539 | MODULE_DEVICE_TABLE(usb, af9035_id_table); | 1544 | MODULE_DEVICE_TABLE(usb, af9035_id_table); |
diff --git a/drivers/media/usb/dvb-usb-v2/mxl111sf.c b/drivers/media/usb/dvb-usb-v2/mxl111sf.c index 2627553f7de1..08240e498451 100644 --- a/drivers/media/usb/dvb-usb-v2/mxl111sf.c +++ b/drivers/media/usb/dvb-usb-v2/mxl111sf.c | |||
@@ -266,7 +266,7 @@ static int mxl111sf_adap_fe_init(struct dvb_frontend *fe) | |||
266 | struct mxl111sf_adap_state *adap_state = &state->adap_state[fe->id]; | 266 | struct mxl111sf_adap_state *adap_state = &state->adap_state[fe->id]; |
267 | int err; | 267 | int err; |
268 | 268 | ||
269 | /* exit if we didnt initialize the driver yet */ | 269 | /* exit if we didn't initialize the driver yet */ |
270 | if (!state->chip_id) { | 270 | if (!state->chip_id) { |
271 | mxl_debug("driver not yet initialized, exit."); | 271 | mxl_debug("driver not yet initialized, exit."); |
272 | goto fail; | 272 | goto fail; |
@@ -322,7 +322,7 @@ static int mxl111sf_adap_fe_sleep(struct dvb_frontend *fe) | |||
322 | struct mxl111sf_adap_state *adap_state = &state->adap_state[fe->id]; | 322 | struct mxl111sf_adap_state *adap_state = &state->adap_state[fe->id]; |
323 | int err; | 323 | int err; |
324 | 324 | ||
325 | /* exit if we didnt initialize the driver yet */ | 325 | /* exit if we didn't initialize the driver yet */ |
326 | if (!state->chip_id) { | 326 | if (!state->chip_id) { |
327 | mxl_debug("driver not yet initialized, exit."); | 327 | mxl_debug("driver not yet initialized, exit."); |
328 | goto fail; | 328 | goto fail; |
diff --git a/drivers/media/usb/dvb-usb/technisat-usb2.c b/drivers/media/usb/dvb-usb/technisat-usb2.c index 40832a1aef6c..98d24aefb640 100644 --- a/drivers/media/usb/dvb-usb/technisat-usb2.c +++ b/drivers/media/usb/dvb-usb/technisat-usb2.c | |||
@@ -102,7 +102,7 @@ static int technisat_usb2_i2c_access(struct usb_device *udev, | |||
102 | if (rxlen > 62) { | 102 | if (rxlen > 62) { |
103 | err("i2c RX buffer can't exceed 62 bytes (dev 0x%02x)", | 103 | err("i2c RX buffer can't exceed 62 bytes (dev 0x%02x)", |
104 | device_addr); | 104 | device_addr); |
105 | txlen = 62; | 105 | rxlen = 62; |
106 | } | 106 | } |
107 | 107 | ||
108 | b[0] = I2C_SPEED_100KHZ_BIT; | 108 | b[0] = I2C_SPEED_100KHZ_BIT; |
diff --git a/drivers/media/usb/em28xx/em28xx-video.c b/drivers/media/usb/em28xx/em28xx-video.c index fc5d60efd4ab..dd19c9ff76e0 100644 --- a/drivers/media/usb/em28xx/em28xx-video.c +++ b/drivers/media/usb/em28xx/em28xx-video.c | |||
@@ -1664,8 +1664,8 @@ static int em28xx_v4l2_close(struct file *filp) | |||
1664 | 1664 | ||
1665 | em28xx_videodbg("users=%d\n", dev->users); | 1665 | em28xx_videodbg("users=%d\n", dev->users); |
1666 | 1666 | ||
1667 | mutex_lock(&dev->lock); | ||
1668 | vb2_fop_release(filp); | 1667 | vb2_fop_release(filp); |
1668 | mutex_lock(&dev->lock); | ||
1669 | 1669 | ||
1670 | if (dev->users == 1) { | 1670 | if (dev->users == 1) { |
1671 | /* the device is already disconnect, | 1671 | /* the device is already disconnect, |
diff --git a/drivers/media/usb/gspca/gl860/gl860.c b/drivers/media/usb/gspca/gl860/gl860.c index cb1e64ca59c9..cea8d7f51c3c 100644 --- a/drivers/media/usb/gspca/gl860/gl860.c +++ b/drivers/media/usb/gspca/gl860/gl860.c | |||
@@ -438,7 +438,7 @@ static void sd_pkt_scan(struct gspca_dev *gspca_dev, | |||
438 | s32 nToSkip = | 438 | s32 nToSkip = |
439 | sd->swapRB * (gspca_dev->cam.cam_mode[mode].bytesperline + 1); | 439 | sd->swapRB * (gspca_dev->cam.cam_mode[mode].bytesperline + 1); |
440 | 440 | ||
441 | /* Test only against 0202h, so endianess does not matter */ | 441 | /* Test only against 0202h, so endianness does not matter */ |
442 | switch (*(s16 *) data) { | 442 | switch (*(s16 *) data) { |
443 | case 0x0202: /* End of frame, start a new one */ | 443 | case 0x0202: /* End of frame, start a new one */ |
444 | gspca_frame_add(gspca_dev, LAST_PACKET, NULL, 0); | 444 | gspca_frame_add(gspca_dev, LAST_PACKET, NULL, 0); |
diff --git a/drivers/media/usb/gspca/pac207.c b/drivers/media/usb/gspca/pac207.c index cd79c180f67b..07529e5a0c56 100644 --- a/drivers/media/usb/gspca/pac207.c +++ b/drivers/media/usb/gspca/pac207.c | |||
@@ -416,7 +416,7 @@ static void sd_pkt_scan(struct gspca_dev *gspca_dev, | |||
416 | #if IS_ENABLED(CONFIG_INPUT) | 416 | #if IS_ENABLED(CONFIG_INPUT) |
417 | static int sd_int_pkt_scan(struct gspca_dev *gspca_dev, | 417 | static int sd_int_pkt_scan(struct gspca_dev *gspca_dev, |
418 | u8 *data, /* interrupt packet data */ | 418 | u8 *data, /* interrupt packet data */ |
419 | int len) /* interrput packet length */ | 419 | int len) /* interrupt packet length */ |
420 | { | 420 | { |
421 | int ret = -EINVAL; | 421 | int ret = -EINVAL; |
422 | 422 | ||
diff --git a/drivers/media/usb/gspca/pac7302.c b/drivers/media/usb/gspca/pac7302.c index a91509643563..2fd1c5e31a0f 100644 --- a/drivers/media/usb/gspca/pac7302.c +++ b/drivers/media/usb/gspca/pac7302.c | |||
@@ -874,7 +874,7 @@ static int sd_dbg_s_register(struct gspca_dev *gspca_dev, | |||
874 | #if IS_ENABLED(CONFIG_INPUT) | 874 | #if IS_ENABLED(CONFIG_INPUT) |
875 | static int sd_int_pkt_scan(struct gspca_dev *gspca_dev, | 875 | static int sd_int_pkt_scan(struct gspca_dev *gspca_dev, |
876 | u8 *data, /* interrupt packet data */ | 876 | u8 *data, /* interrupt packet data */ |
877 | int len) /* interrput packet length */ | 877 | int len) /* interrupt packet length */ |
878 | { | 878 | { |
879 | int ret = -EINVAL; | 879 | int ret = -EINVAL; |
880 | u8 data0, data1; | 880 | u8 data0, data1; |
diff --git a/drivers/media/usb/gspca/stk1135.c b/drivers/media/usb/gspca/stk1135.c index 1fc80af2a189..48234c9a8b6c 100644 --- a/drivers/media/usb/gspca/stk1135.c +++ b/drivers/media/usb/gspca/stk1135.c | |||
@@ -361,6 +361,9 @@ static void stk1135_configure_clock(struct gspca_dev *gspca_dev) | |||
361 | 361 | ||
362 | /* set serial interface clock divider (30MHz/0x1f*16+2) = 60240 kHz) */ | 362 | /* set serial interface clock divider (30MHz/0x1f*16+2) = 60240 kHz) */ |
363 | reg_w(gspca_dev, STK1135_REG_SICTL + 2, 0x1f); | 363 | reg_w(gspca_dev, STK1135_REG_SICTL + 2, 0x1f); |
364 | |||
365 | /* wait a while for sensor to catch up */ | ||
366 | udelay(1000); | ||
364 | } | 367 | } |
365 | 368 | ||
366 | static void stk1135_camera_disable(struct gspca_dev *gspca_dev) | 369 | static void stk1135_camera_disable(struct gspca_dev *gspca_dev) |
diff --git a/drivers/media/usb/gspca/stv0680.c b/drivers/media/usb/gspca/stv0680.c index 9c0827631b9c..7f94ec74282e 100644 --- a/drivers/media/usb/gspca/stv0680.c +++ b/drivers/media/usb/gspca/stv0680.c | |||
@@ -139,7 +139,7 @@ static int sd_config(struct gspca_dev *gspca_dev, | |||
139 | struct sd *sd = (struct sd *) gspca_dev; | 139 | struct sd *sd = (struct sd *) gspca_dev; |
140 | struct cam *cam = &gspca_dev->cam; | 140 | struct cam *cam = &gspca_dev->cam; |
141 | 141 | ||
142 | /* Give the camera some time to settle, otherwise initalization will | 142 | /* Give the camera some time to settle, otherwise initialization will |
143 | fail on hotplug, and yes it really needs a full second. */ | 143 | fail on hotplug, and yes it really needs a full second. */ |
144 | msleep(1000); | 144 | msleep(1000); |
145 | 145 | ||
diff --git a/drivers/media/usb/gspca/sunplus.c b/drivers/media/usb/gspca/sunplus.c index a517d185febe..46c9f2229a18 100644 --- a/drivers/media/usb/gspca/sunplus.c +++ b/drivers/media/usb/gspca/sunplus.c | |||
@@ -1027,6 +1027,7 @@ static const struct usb_device_id device_table[] = { | |||
1027 | {USB_DEVICE(0x055f, 0xc650), BS(SPCA533, 0)}, | 1027 | {USB_DEVICE(0x055f, 0xc650), BS(SPCA533, 0)}, |
1028 | {USB_DEVICE(0x05da, 0x1018), BS(SPCA504B, 0)}, | 1028 | {USB_DEVICE(0x05da, 0x1018), BS(SPCA504B, 0)}, |
1029 | {USB_DEVICE(0x06d6, 0x0031), BS(SPCA533, 0)}, | 1029 | {USB_DEVICE(0x06d6, 0x0031), BS(SPCA533, 0)}, |
1030 | {USB_DEVICE(0x06d6, 0x0041), BS(SPCA504B, 0)}, | ||
1030 | {USB_DEVICE(0x0733, 0x1311), BS(SPCA533, 0)}, | 1031 | {USB_DEVICE(0x0733, 0x1311), BS(SPCA533, 0)}, |
1031 | {USB_DEVICE(0x0733, 0x1314), BS(SPCA533, 0)}, | 1032 | {USB_DEVICE(0x0733, 0x1314), BS(SPCA533, 0)}, |
1032 | {USB_DEVICE(0x0733, 0x2211), BS(SPCA533, 0)}, | 1033 | {USB_DEVICE(0x0733, 0x2211), BS(SPCA533, 0)}, |
diff --git a/drivers/media/usb/gspca/zc3xx.c b/drivers/media/usb/gspca/zc3xx.c index 7b95d8e88a20..d3e1b6d8bf49 100644 --- a/drivers/media/usb/gspca/zc3xx.c +++ b/drivers/media/usb/gspca/zc3xx.c | |||
@@ -6905,7 +6905,7 @@ static int sd_get_jcomp(struct gspca_dev *gspca_dev, | |||
6905 | #if IS_ENABLED(CONFIG_INPUT) | 6905 | #if IS_ENABLED(CONFIG_INPUT) |
6906 | static int sd_int_pkt_scan(struct gspca_dev *gspca_dev, | 6906 | static int sd_int_pkt_scan(struct gspca_dev *gspca_dev, |
6907 | u8 *data, /* interrupt packet data */ | 6907 | u8 *data, /* interrupt packet data */ |
6908 | int len) /* interrput packet length */ | 6908 | int len) /* interrupt packet length */ |
6909 | { | 6909 | { |
6910 | if (len == 8 && data[4] == 1) { | 6910 | if (len == 8 && data[4] == 1) { |
6911 | input_report_key(gspca_dev->input_dev, KEY_CAMERA, 1); | 6911 | input_report_key(gspca_dev->input_dev, KEY_CAMERA, 1); |
diff --git a/drivers/media/usb/pwc/pwc-if.c b/drivers/media/usb/pwc/pwc-if.c index 77bbf7889659..78c9bc8e7f56 100644 --- a/drivers/media/usb/pwc/pwc-if.c +++ b/drivers/media/usb/pwc/pwc-if.c | |||
@@ -1039,7 +1039,7 @@ static int usb_pwc_probe(struct usb_interface *intf, const struct usb_device_id | |||
1039 | /* Set the leds off */ | 1039 | /* Set the leds off */ |
1040 | pwc_set_leds(pdev, 0, 0); | 1040 | pwc_set_leds(pdev, 0, 0); |
1041 | 1041 | ||
1042 | /* Setup intial videomode */ | 1042 | /* Setup initial videomode */ |
1043 | rc = pwc_set_video_mode(pdev, MAX_WIDTH, MAX_HEIGHT, | 1043 | rc = pwc_set_video_mode(pdev, MAX_WIDTH, MAX_HEIGHT, |
1044 | V4L2_PIX_FMT_YUV420, 30, &compression, 1); | 1044 | V4L2_PIX_FMT_YUV420, 30, &compression, 1); |
1045 | if (rc) | 1045 | if (rc) |
diff --git a/drivers/media/usb/usbtv/usbtv.c b/drivers/media/usb/usbtv/usbtv.c index 8a505a90d318..6222a4ab1e00 100644 --- a/drivers/media/usb/usbtv/usbtv.c +++ b/drivers/media/usb/usbtv/usbtv.c | |||
@@ -50,13 +50,8 @@ | |||
50 | #define USBTV_ISOC_TRANSFERS 16 | 50 | #define USBTV_ISOC_TRANSFERS 16 |
51 | #define USBTV_ISOC_PACKETS 8 | 51 | #define USBTV_ISOC_PACKETS 8 |
52 | 52 | ||
53 | #define USBTV_WIDTH 720 | ||
54 | #define USBTV_HEIGHT 480 | ||
55 | |||
56 | #define USBTV_CHUNK_SIZE 256 | 53 | #define USBTV_CHUNK_SIZE 256 |
57 | #define USBTV_CHUNK 240 | 54 | #define USBTV_CHUNK 240 |
58 | #define USBTV_CHUNKS (USBTV_WIDTH * USBTV_HEIGHT \ | ||
59 | / 4 / USBTV_CHUNK) | ||
60 | 55 | ||
61 | /* Chunk header. */ | 56 | /* Chunk header. */ |
62 | #define USBTV_MAGIC_OK(chunk) ((be32_to_cpu(chunk[0]) & 0xff000000) \ | 57 | #define USBTV_MAGIC_OK(chunk) ((be32_to_cpu(chunk[0]) & 0xff000000) \ |
@@ -65,6 +60,27 @@ | |||
65 | #define USBTV_ODD(chunk) ((be32_to_cpu(chunk[0]) & 0x0000f000) >> 15) | 60 | #define USBTV_ODD(chunk) ((be32_to_cpu(chunk[0]) & 0x0000f000) >> 15) |
66 | #define USBTV_CHUNK_NO(chunk) (be32_to_cpu(chunk[0]) & 0x00000fff) | 61 | #define USBTV_CHUNK_NO(chunk) (be32_to_cpu(chunk[0]) & 0x00000fff) |
67 | 62 | ||
63 | #define USBTV_TV_STD (V4L2_STD_525_60 | V4L2_STD_PAL) | ||
64 | |||
65 | /* parameters for supported TV norms */ | ||
66 | struct usbtv_norm_params { | ||
67 | v4l2_std_id norm; | ||
68 | int cap_width, cap_height; | ||
69 | }; | ||
70 | |||
71 | static struct usbtv_norm_params norm_params[] = { | ||
72 | { | ||
73 | .norm = V4L2_STD_525_60, | ||
74 | .cap_width = 720, | ||
75 | .cap_height = 480, | ||
76 | }, | ||
77 | { | ||
78 | .norm = V4L2_STD_PAL, | ||
79 | .cap_width = 720, | ||
80 | .cap_height = 576, | ||
81 | } | ||
82 | }; | ||
83 | |||
68 | /* A single videobuf2 frame buffer. */ | 84 | /* A single videobuf2 frame buffer. */ |
69 | struct usbtv_buf { | 85 | struct usbtv_buf { |
70 | struct vb2_buffer vb; | 86 | struct vb2_buffer vb; |
@@ -94,11 +110,38 @@ struct usbtv { | |||
94 | USBTV_COMPOSITE_INPUT, | 110 | USBTV_COMPOSITE_INPUT, |
95 | USBTV_SVIDEO_INPUT, | 111 | USBTV_SVIDEO_INPUT, |
96 | } input; | 112 | } input; |
113 | v4l2_std_id norm; | ||
114 | int width, height; | ||
115 | int n_chunks; | ||
97 | int iso_size; | 116 | int iso_size; |
98 | unsigned int sequence; | 117 | unsigned int sequence; |
99 | struct urb *isoc_urbs[USBTV_ISOC_TRANSFERS]; | 118 | struct urb *isoc_urbs[USBTV_ISOC_TRANSFERS]; |
100 | }; | 119 | }; |
101 | 120 | ||
121 | static int usbtv_configure_for_norm(struct usbtv *usbtv, v4l2_std_id norm) | ||
122 | { | ||
123 | int i, ret = 0; | ||
124 | struct usbtv_norm_params *params = NULL; | ||
125 | |||
126 | for (i = 0; i < ARRAY_SIZE(norm_params); i++) { | ||
127 | if (norm_params[i].norm & norm) { | ||
128 | params = &norm_params[i]; | ||
129 | break; | ||
130 | } | ||
131 | } | ||
132 | |||
133 | if (params) { | ||
134 | usbtv->width = params->cap_width; | ||
135 | usbtv->height = params->cap_height; | ||
136 | usbtv->n_chunks = usbtv->width * usbtv->height | ||
137 | / 4 / USBTV_CHUNK; | ||
138 | usbtv->norm = params->norm; | ||
139 | } else | ||
140 | ret = -EINVAL; | ||
141 | |||
142 | return ret; | ||
143 | } | ||
144 | |||
102 | static int usbtv_set_regs(struct usbtv *usbtv, const u16 regs[][2], int size) | 145 | static int usbtv_set_regs(struct usbtv *usbtv, const u16 regs[][2], int size) |
103 | { | 146 | { |
104 | int ret; | 147 | int ret; |
@@ -158,6 +201,57 @@ static int usbtv_select_input(struct usbtv *usbtv, int input) | |||
158 | return ret; | 201 | return ret; |
159 | } | 202 | } |
160 | 203 | ||
204 | static int usbtv_select_norm(struct usbtv *usbtv, v4l2_std_id norm) | ||
205 | { | ||
206 | int ret; | ||
207 | static const u16 pal[][2] = { | ||
208 | { USBTV_BASE + 0x001a, 0x0068 }, | ||
209 | { USBTV_BASE + 0x010e, 0x0072 }, | ||
210 | { USBTV_BASE + 0x010f, 0x00a2 }, | ||
211 | { USBTV_BASE + 0x0112, 0x00b0 }, | ||
212 | { USBTV_BASE + 0x0117, 0x0001 }, | ||
213 | { USBTV_BASE + 0x0118, 0x002c }, | ||
214 | { USBTV_BASE + 0x012d, 0x0010 }, | ||
215 | { USBTV_BASE + 0x012f, 0x0020 }, | ||
216 | { USBTV_BASE + 0x024f, 0x0002 }, | ||
217 | { USBTV_BASE + 0x0254, 0x0059 }, | ||
218 | { USBTV_BASE + 0x025a, 0x0016 }, | ||
219 | { USBTV_BASE + 0x025b, 0x0035 }, | ||
220 | { USBTV_BASE + 0x0263, 0x0017 }, | ||
221 | { USBTV_BASE + 0x0266, 0x0016 }, | ||
222 | { USBTV_BASE + 0x0267, 0x0036 } | ||
223 | }; | ||
224 | |||
225 | static const u16 ntsc[][2] = { | ||
226 | { USBTV_BASE + 0x001a, 0x0079 }, | ||
227 | { USBTV_BASE + 0x010e, 0x0068 }, | ||
228 | { USBTV_BASE + 0x010f, 0x009c }, | ||
229 | { USBTV_BASE + 0x0112, 0x00f0 }, | ||
230 | { USBTV_BASE + 0x0117, 0x0000 }, | ||
231 | { USBTV_BASE + 0x0118, 0x00fc }, | ||
232 | { USBTV_BASE + 0x012d, 0x0004 }, | ||
233 | { USBTV_BASE + 0x012f, 0x0008 }, | ||
234 | { USBTV_BASE + 0x024f, 0x0001 }, | ||
235 | { USBTV_BASE + 0x0254, 0x005f }, | ||
236 | { USBTV_BASE + 0x025a, 0x0012 }, | ||
237 | { USBTV_BASE + 0x025b, 0x0001 }, | ||
238 | { USBTV_BASE + 0x0263, 0x001c }, | ||
239 | { USBTV_BASE + 0x0266, 0x0011 }, | ||
240 | { USBTV_BASE + 0x0267, 0x0005 } | ||
241 | }; | ||
242 | |||
243 | ret = usbtv_configure_for_norm(usbtv, norm); | ||
244 | |||
245 | if (!ret) { | ||
246 | if (norm & V4L2_STD_525_60) | ||
247 | ret = usbtv_set_regs(usbtv, ntsc, ARRAY_SIZE(ntsc)); | ||
248 | else if (norm & V4L2_STD_PAL) | ||
249 | ret = usbtv_set_regs(usbtv, pal, ARRAY_SIZE(pal)); | ||
250 | } | ||
251 | |||
252 | return ret; | ||
253 | } | ||
254 | |||
161 | static int usbtv_setup_capture(struct usbtv *usbtv) | 255 | static int usbtv_setup_capture(struct usbtv *usbtv) |
162 | { | 256 | { |
163 | int ret; | 257 | int ret; |
@@ -225,26 +319,11 @@ static int usbtv_setup_capture(struct usbtv *usbtv) | |||
225 | 319 | ||
226 | { USBTV_BASE + 0x0284, 0x0088 }, | 320 | { USBTV_BASE + 0x0284, 0x0088 }, |
227 | { USBTV_BASE + 0x0003, 0x0004 }, | 321 | { USBTV_BASE + 0x0003, 0x0004 }, |
228 | { USBTV_BASE + 0x001a, 0x0079 }, | ||
229 | { USBTV_BASE + 0x0100, 0x00d3 }, | 322 | { USBTV_BASE + 0x0100, 0x00d3 }, |
230 | { USBTV_BASE + 0x010e, 0x0068 }, | ||
231 | { USBTV_BASE + 0x010f, 0x009c }, | ||
232 | { USBTV_BASE + 0x0112, 0x00f0 }, | ||
233 | { USBTV_BASE + 0x0115, 0x0015 }, | 323 | { USBTV_BASE + 0x0115, 0x0015 }, |
234 | { USBTV_BASE + 0x0117, 0x0000 }, | ||
235 | { USBTV_BASE + 0x0118, 0x00fc }, | ||
236 | { USBTV_BASE + 0x012d, 0x0004 }, | ||
237 | { USBTV_BASE + 0x012f, 0x0008 }, | ||
238 | { USBTV_BASE + 0x0220, 0x002e }, | 324 | { USBTV_BASE + 0x0220, 0x002e }, |
239 | { USBTV_BASE + 0x0225, 0x0008 }, | 325 | { USBTV_BASE + 0x0225, 0x0008 }, |
240 | { USBTV_BASE + 0x024e, 0x0002 }, | 326 | { USBTV_BASE + 0x024e, 0x0002 }, |
241 | { USBTV_BASE + 0x024f, 0x0001 }, | ||
242 | { USBTV_BASE + 0x0254, 0x005f }, | ||
243 | { USBTV_BASE + 0x025a, 0x0012 }, | ||
244 | { USBTV_BASE + 0x025b, 0x0001 }, | ||
245 | { USBTV_BASE + 0x0263, 0x001c }, | ||
246 | { USBTV_BASE + 0x0266, 0x0011 }, | ||
247 | { USBTV_BASE + 0x0267, 0x0005 }, | ||
248 | { USBTV_BASE + 0x024e, 0x0002 }, | 327 | { USBTV_BASE + 0x024e, 0x0002 }, |
249 | { USBTV_BASE + 0x024f, 0x0002 }, | 328 | { USBTV_BASE + 0x024f, 0x0002 }, |
250 | }; | 329 | }; |
@@ -253,6 +332,10 @@ static int usbtv_setup_capture(struct usbtv *usbtv) | |||
253 | if (ret) | 332 | if (ret) |
254 | return ret; | 333 | return ret; |
255 | 334 | ||
335 | ret = usbtv_select_norm(usbtv, usbtv->norm); | ||
336 | if (ret) | ||
337 | return ret; | ||
338 | |||
256 | ret = usbtv_select_input(usbtv, usbtv->input); | 339 | ret = usbtv_select_input(usbtv, usbtv->input); |
257 | if (ret) | 340 | if (ret) |
258 | return ret; | 341 | return ret; |
@@ -296,7 +379,7 @@ static void usbtv_image_chunk(struct usbtv *usbtv, u32 *chunk) | |||
296 | frame_id = USBTV_FRAME_ID(chunk); | 379 | frame_id = USBTV_FRAME_ID(chunk); |
297 | odd = USBTV_ODD(chunk); | 380 | odd = USBTV_ODD(chunk); |
298 | chunk_no = USBTV_CHUNK_NO(chunk); | 381 | chunk_no = USBTV_CHUNK_NO(chunk); |
299 | if (chunk_no >= USBTV_CHUNKS) | 382 | if (chunk_no >= usbtv->n_chunks) |
300 | return; | 383 | return; |
301 | 384 | ||
302 | /* Beginning of a frame. */ | 385 | /* Beginning of a frame. */ |
@@ -324,10 +407,10 @@ static void usbtv_image_chunk(struct usbtv *usbtv, u32 *chunk) | |||
324 | usbtv->chunks_done++; | 407 | usbtv->chunks_done++; |
325 | 408 | ||
326 | /* Last chunk in a frame, signalling an end */ | 409 | /* Last chunk in a frame, signalling an end */ |
327 | if (odd && chunk_no == USBTV_CHUNKS-1) { | 410 | if (odd && chunk_no == usbtv->n_chunks-1) { |
328 | int size = vb2_plane_size(&buf->vb, 0); | 411 | int size = vb2_plane_size(&buf->vb, 0); |
329 | enum vb2_buffer_state state = usbtv->chunks_done == | 412 | enum vb2_buffer_state state = usbtv->chunks_done == |
330 | USBTV_CHUNKS ? | 413 | usbtv->n_chunks ? |
331 | VB2_BUF_STATE_DONE : | 414 | VB2_BUF_STATE_DONE : |
332 | VB2_BUF_STATE_ERROR; | 415 | VB2_BUF_STATE_ERROR; |
333 | 416 | ||
@@ -500,6 +583,8 @@ static int usbtv_querycap(struct file *file, void *priv, | |||
500 | static int usbtv_enum_input(struct file *file, void *priv, | 583 | static int usbtv_enum_input(struct file *file, void *priv, |
501 | struct v4l2_input *i) | 584 | struct v4l2_input *i) |
502 | { | 585 | { |
586 | struct usbtv *dev = video_drvdata(file); | ||
587 | |||
503 | switch (i->index) { | 588 | switch (i->index) { |
504 | case USBTV_COMPOSITE_INPUT: | 589 | case USBTV_COMPOSITE_INPUT: |
505 | strlcpy(i->name, "Composite", sizeof(i->name)); | 590 | strlcpy(i->name, "Composite", sizeof(i->name)); |
@@ -512,7 +597,7 @@ static int usbtv_enum_input(struct file *file, void *priv, | |||
512 | } | 597 | } |
513 | 598 | ||
514 | i->type = V4L2_INPUT_TYPE_CAMERA; | 599 | i->type = V4L2_INPUT_TYPE_CAMERA; |
515 | i->std = V4L2_STD_525_60; | 600 | i->std = dev->vdev.tvnorms; |
516 | return 0; | 601 | return 0; |
517 | } | 602 | } |
518 | 603 | ||
@@ -531,23 +616,37 @@ static int usbtv_enum_fmt_vid_cap(struct file *file, void *priv, | |||
531 | static int usbtv_fmt_vid_cap(struct file *file, void *priv, | 616 | static int usbtv_fmt_vid_cap(struct file *file, void *priv, |
532 | struct v4l2_format *f) | 617 | struct v4l2_format *f) |
533 | { | 618 | { |
534 | f->fmt.pix.width = USBTV_WIDTH; | 619 | struct usbtv *usbtv = video_drvdata(file); |
535 | f->fmt.pix.height = USBTV_HEIGHT; | 620 | |
621 | f->fmt.pix.width = usbtv->width; | ||
622 | f->fmt.pix.height = usbtv->height; | ||
536 | f->fmt.pix.pixelformat = V4L2_PIX_FMT_YUYV; | 623 | f->fmt.pix.pixelformat = V4L2_PIX_FMT_YUYV; |
537 | f->fmt.pix.field = V4L2_FIELD_INTERLACED; | 624 | f->fmt.pix.field = V4L2_FIELD_INTERLACED; |
538 | f->fmt.pix.bytesperline = USBTV_WIDTH * 2; | 625 | f->fmt.pix.bytesperline = usbtv->width * 2; |
539 | f->fmt.pix.sizeimage = (f->fmt.pix.bytesperline * f->fmt.pix.height); | 626 | f->fmt.pix.sizeimage = (f->fmt.pix.bytesperline * f->fmt.pix.height); |
540 | f->fmt.pix.colorspace = V4L2_COLORSPACE_SMPTE170M; | 627 | f->fmt.pix.colorspace = V4L2_COLORSPACE_SMPTE170M; |
541 | f->fmt.pix.priv = 0; | 628 | |
542 | return 0; | 629 | return 0; |
543 | } | 630 | } |
544 | 631 | ||
545 | static int usbtv_g_std(struct file *file, void *priv, v4l2_std_id *norm) | 632 | static int usbtv_g_std(struct file *file, void *priv, v4l2_std_id *norm) |
546 | { | 633 | { |
547 | *norm = V4L2_STD_525_60; | 634 | struct usbtv *usbtv = video_drvdata(file); |
635 | *norm = usbtv->norm; | ||
548 | return 0; | 636 | return 0; |
549 | } | 637 | } |
550 | 638 | ||
639 | static int usbtv_s_std(struct file *file, void *priv, v4l2_std_id norm) | ||
640 | { | ||
641 | int ret = -EINVAL; | ||
642 | struct usbtv *usbtv = video_drvdata(file); | ||
643 | |||
644 | if ((norm & V4L2_STD_525_60) || (norm & V4L2_STD_PAL)) | ||
645 | ret = usbtv_select_norm(usbtv, norm); | ||
646 | |||
647 | return ret; | ||
648 | } | ||
649 | |||
551 | static int usbtv_g_input(struct file *file, void *priv, unsigned int *i) | 650 | static int usbtv_g_input(struct file *file, void *priv, unsigned int *i) |
552 | { | 651 | { |
553 | struct usbtv *usbtv = video_drvdata(file); | 652 | struct usbtv *usbtv = video_drvdata(file); |
@@ -561,13 +660,6 @@ static int usbtv_s_input(struct file *file, void *priv, unsigned int i) | |||
561 | return usbtv_select_input(usbtv, i); | 660 | return usbtv_select_input(usbtv, i); |
562 | } | 661 | } |
563 | 662 | ||
564 | static int usbtv_s_std(struct file *file, void *priv, v4l2_std_id norm) | ||
565 | { | ||
566 | if (norm & V4L2_STD_525_60) | ||
567 | return 0; | ||
568 | return -EINVAL; | ||
569 | } | ||
570 | |||
571 | struct v4l2_ioctl_ops usbtv_ioctl_ops = { | 663 | struct v4l2_ioctl_ops usbtv_ioctl_ops = { |
572 | .vidioc_querycap = usbtv_querycap, | 664 | .vidioc_querycap = usbtv_querycap, |
573 | .vidioc_enum_input = usbtv_enum_input, | 665 | .vidioc_enum_input = usbtv_enum_input, |
@@ -604,10 +696,12 @@ static int usbtv_queue_setup(struct vb2_queue *vq, | |||
604 | const struct v4l2_format *v4l_fmt, unsigned int *nbuffers, | 696 | const struct v4l2_format *v4l_fmt, unsigned int *nbuffers, |
605 | unsigned int *nplanes, unsigned int sizes[], void *alloc_ctxs[]) | 697 | unsigned int *nplanes, unsigned int sizes[], void *alloc_ctxs[]) |
606 | { | 698 | { |
699 | struct usbtv *usbtv = vb2_get_drv_priv(vq); | ||
700 | |||
607 | if (*nbuffers < 2) | 701 | if (*nbuffers < 2) |
608 | *nbuffers = 2; | 702 | *nbuffers = 2; |
609 | *nplanes = 1; | 703 | *nplanes = 1; |
610 | sizes[0] = USBTV_WIDTH * USBTV_HEIGHT / 2 * sizeof(u32); | 704 | sizes[0] = USBTV_CHUNK * usbtv->n_chunks * 2 * sizeof(u32); |
611 | 705 | ||
612 | return 0; | 706 | return 0; |
613 | } | 707 | } |
@@ -690,7 +784,11 @@ static int usbtv_probe(struct usb_interface *intf, | |||
690 | return -ENOMEM; | 784 | return -ENOMEM; |
691 | usbtv->dev = dev; | 785 | usbtv->dev = dev; |
692 | usbtv->udev = usb_get_dev(interface_to_usbdev(intf)); | 786 | usbtv->udev = usb_get_dev(interface_to_usbdev(intf)); |
787 | |||
693 | usbtv->iso_size = size; | 788 | usbtv->iso_size = size; |
789 | |||
790 | (void)usbtv_configure_for_norm(usbtv, V4L2_STD_525_60); | ||
791 | |||
694 | spin_lock_init(&usbtv->buflock); | 792 | spin_lock_init(&usbtv->buflock); |
695 | mutex_init(&usbtv->v4l2_lock); | 793 | mutex_init(&usbtv->v4l2_lock); |
696 | mutex_init(&usbtv->vb2q_lock); | 794 | mutex_init(&usbtv->vb2q_lock); |
@@ -727,7 +825,7 @@ static int usbtv_probe(struct usb_interface *intf, | |||
727 | usbtv->vdev.release = video_device_release_empty; | 825 | usbtv->vdev.release = video_device_release_empty; |
728 | usbtv->vdev.fops = &usbtv_fops; | 826 | usbtv->vdev.fops = &usbtv_fops; |
729 | usbtv->vdev.ioctl_ops = &usbtv_ioctl_ops; | 827 | usbtv->vdev.ioctl_ops = &usbtv_ioctl_ops; |
730 | usbtv->vdev.tvnorms = V4L2_STD_525_60; | 828 | usbtv->vdev.tvnorms = USBTV_TV_STD; |
731 | usbtv->vdev.queue = &usbtv->vb2q; | 829 | usbtv->vdev.queue = &usbtv->vb2q; |
732 | usbtv->vdev.lock = &usbtv->v4l2_lock; | 830 | usbtv->vdev.lock = &usbtv->v4l2_lock; |
733 | set_bit(V4L2_FL_USE_FH_PRIO, &usbtv->vdev.flags); | 831 | set_bit(V4L2_FL_USE_FH_PRIO, &usbtv->vdev.flags); |
diff --git a/drivers/media/usb/uvc/uvc_video.c b/drivers/media/usb/uvc/uvc_video.c index 899cb6d1c4a4..898c208889cd 100644 --- a/drivers/media/usb/uvc/uvc_video.c +++ b/drivers/media/usb/uvc/uvc_video.c | |||
@@ -556,7 +556,7 @@ static u16 uvc_video_clock_host_sof(const struct uvc_clock_sample *sample) | |||
556 | * | 556 | * |
557 | * SOF = ((SOF2 - SOF1) * PTS + SOF1 * STC2 - SOF2 * STC1) / (STC2 - STC1) (1) | 557 | * SOF = ((SOF2 - SOF1) * PTS + SOF1 * STC2 - SOF2 * STC1) / (STC2 - STC1) (1) |
558 | * | 558 | * |
559 | * to avoid loosing precision in the division. Similarly, the host timestamp is | 559 | * to avoid losing precision in the division. Similarly, the host timestamp is |
560 | * computed with | 560 | * computed with |
561 | * | 561 | * |
562 | * TS = ((TS2 - TS1) * PTS + TS1 * SOF2 - TS2 * SOF1) / (SOF2 - SOF1) (2) | 562 | * TS = ((TS2 - TS1) * PTS + TS1 * SOF2 - TS2 * SOF1) / (SOF2 - SOF1) (2) |
diff --git a/drivers/media/v4l2-core/v4l2-ctrls.c b/drivers/media/v4l2-core/v4l2-ctrls.c index 60dcc0f3b32e..fb46790d0eca 100644 --- a/drivers/media/v4l2-core/v4l2-ctrls.c +++ b/drivers/media/v4l2-core/v4l2-ctrls.c | |||
@@ -420,7 +420,7 @@ const char * const *v4l2_ctrl_get_menu(u32 id) | |||
420 | "Advanced Simple", | 420 | "Advanced Simple", |
421 | "Core", | 421 | "Core", |
422 | "Simple Scalable", | 422 | "Simple Scalable", |
423 | "Advanced Coding Efficency", | 423 | "Advanced Coding Efficiency", |
424 | NULL, | 424 | NULL, |
425 | }; | 425 | }; |
426 | 426 | ||
diff --git a/drivers/media/v4l2-core/videobuf2-core.c b/drivers/media/v4l2-core/videobuf2-core.c index b19b306c8f7f..0edc165f418d 100644 --- a/drivers/media/v4l2-core/videobuf2-core.c +++ b/drivers/media/v4l2-core/videobuf2-core.c | |||
@@ -145,6 +145,25 @@ static void __vb2_buf_dmabuf_put(struct vb2_buffer *vb) | |||
145 | } | 145 | } |
146 | 146 | ||
147 | /** | 147 | /** |
148 | * __setup_lengths() - setup initial lengths for every plane in | ||
149 | * every buffer on the queue | ||
150 | */ | ||
151 | static void __setup_lengths(struct vb2_queue *q, unsigned int n) | ||
152 | { | ||
153 | unsigned int buffer, plane; | ||
154 | struct vb2_buffer *vb; | ||
155 | |||
156 | for (buffer = q->num_buffers; buffer < q->num_buffers + n; ++buffer) { | ||
157 | vb = q->bufs[buffer]; | ||
158 | if (!vb) | ||
159 | continue; | ||
160 | |||
161 | for (plane = 0; plane < vb->num_planes; ++plane) | ||
162 | vb->v4l2_planes[plane].length = q->plane_sizes[plane]; | ||
163 | } | ||
164 | } | ||
165 | |||
166 | /** | ||
148 | * __setup_offsets() - setup unique offsets ("cookies") for every plane in | 167 | * __setup_offsets() - setup unique offsets ("cookies") for every plane in |
149 | * every buffer on the queue | 168 | * every buffer on the queue |
150 | */ | 169 | */ |
@@ -169,7 +188,6 @@ static void __setup_offsets(struct vb2_queue *q, unsigned int n) | |||
169 | continue; | 188 | continue; |
170 | 189 | ||
171 | for (plane = 0; plane < vb->num_planes; ++plane) { | 190 | for (plane = 0; plane < vb->num_planes; ++plane) { |
172 | vb->v4l2_planes[plane].length = q->plane_sizes[plane]; | ||
173 | vb->v4l2_planes[plane].m.mem_offset = off; | 191 | vb->v4l2_planes[plane].m.mem_offset = off; |
174 | 192 | ||
175 | dprintk(3, "Buffer %d, plane %d offset 0x%08lx\n", | 193 | dprintk(3, "Buffer %d, plane %d offset 0x%08lx\n", |
@@ -241,6 +259,7 @@ static int __vb2_queue_alloc(struct vb2_queue *q, enum v4l2_memory memory, | |||
241 | q->bufs[q->num_buffers + buffer] = vb; | 259 | q->bufs[q->num_buffers + buffer] = vb; |
242 | } | 260 | } |
243 | 261 | ||
262 | __setup_lengths(q, buffer); | ||
244 | if (memory == V4L2_MEMORY_MMAP) | 263 | if (memory == V4L2_MEMORY_MMAP) |
245 | __setup_offsets(q, buffer); | 264 | __setup_offsets(q, buffer); |
246 | 265 | ||
@@ -1824,8 +1843,8 @@ int vb2_expbuf(struct vb2_queue *q, struct v4l2_exportbuffer *eb) | |||
1824 | return -EINVAL; | 1843 | return -EINVAL; |
1825 | } | 1844 | } |
1826 | 1845 | ||
1827 | if (eb->flags & ~O_CLOEXEC) { | 1846 | if (eb->flags & ~(O_CLOEXEC | O_ACCMODE)) { |
1828 | dprintk(1, "Queue does support only O_CLOEXEC flag\n"); | 1847 | dprintk(1, "Queue does support only O_CLOEXEC and access mode flags\n"); |
1829 | return -EINVAL; | 1848 | return -EINVAL; |
1830 | } | 1849 | } |
1831 | 1850 | ||
@@ -1848,14 +1867,14 @@ int vb2_expbuf(struct vb2_queue *q, struct v4l2_exportbuffer *eb) | |||
1848 | 1867 | ||
1849 | vb_plane = &vb->planes[eb->plane]; | 1868 | vb_plane = &vb->planes[eb->plane]; |
1850 | 1869 | ||
1851 | dbuf = call_memop(q, get_dmabuf, vb_plane->mem_priv); | 1870 | dbuf = call_memop(q, get_dmabuf, vb_plane->mem_priv, eb->flags & O_ACCMODE); |
1852 | if (IS_ERR_OR_NULL(dbuf)) { | 1871 | if (IS_ERR_OR_NULL(dbuf)) { |
1853 | dprintk(1, "Failed to export buffer %d, plane %d\n", | 1872 | dprintk(1, "Failed to export buffer %d, plane %d\n", |
1854 | eb->index, eb->plane); | 1873 | eb->index, eb->plane); |
1855 | return -EINVAL; | 1874 | return -EINVAL; |
1856 | } | 1875 | } |
1857 | 1876 | ||
1858 | ret = dma_buf_fd(dbuf, eb->flags); | 1877 | ret = dma_buf_fd(dbuf, eb->flags & ~O_ACCMODE); |
1859 | if (ret < 0) { | 1878 | if (ret < 0) { |
1860 | dprintk(3, "buffer %d, plane %d failed to export (%d)\n", | 1879 | dprintk(3, "buffer %d, plane %d failed to export (%d)\n", |
1861 | eb->index, eb->plane, ret); | 1880 | eb->index, eb->plane, ret); |
diff --git a/drivers/media/v4l2-core/videobuf2-dma-contig.c b/drivers/media/v4l2-core/videobuf2-dma-contig.c index 646f08f4f504..33d3871d1e13 100644 --- a/drivers/media/v4l2-core/videobuf2-dma-contig.c +++ b/drivers/media/v4l2-core/videobuf2-dma-contig.c | |||
@@ -393,7 +393,7 @@ static struct sg_table *vb2_dc_get_base_sgt(struct vb2_dc_buf *buf) | |||
393 | return sgt; | 393 | return sgt; |
394 | } | 394 | } |
395 | 395 | ||
396 | static struct dma_buf *vb2_dc_get_dmabuf(void *buf_priv) | 396 | static struct dma_buf *vb2_dc_get_dmabuf(void *buf_priv, unsigned long flags) |
397 | { | 397 | { |
398 | struct vb2_dc_buf *buf = buf_priv; | 398 | struct vb2_dc_buf *buf = buf_priv; |
399 | struct dma_buf *dbuf; | 399 | struct dma_buf *dbuf; |
@@ -404,7 +404,7 @@ static struct dma_buf *vb2_dc_get_dmabuf(void *buf_priv) | |||
404 | if (WARN_ON(!buf->sgt_base)) | 404 | if (WARN_ON(!buf->sgt_base)) |
405 | return NULL; | 405 | return NULL; |
406 | 406 | ||
407 | dbuf = dma_buf_export(buf, &vb2_dc_dmabuf_ops, buf->size, 0); | 407 | dbuf = dma_buf_export(buf, &vb2_dc_dmabuf_ops, buf->size, flags); |
408 | if (IS_ERR(dbuf)) | 408 | if (IS_ERR(dbuf)) |
409 | return NULL; | 409 | return NULL; |
410 | 410 | ||
diff --git a/drivers/media/v4l2-core/videobuf2-dma-sg.c b/drivers/media/v4l2-core/videobuf2-dma-sg.c index 2f860543912c..0d3a8ffe47a3 100644 --- a/drivers/media/v4l2-core/videobuf2-dma-sg.c +++ b/drivers/media/v4l2-core/videobuf2-dma-sg.c | |||
@@ -178,7 +178,7 @@ static void *vb2_dma_sg_get_userptr(void *alloc_ctx, unsigned long vaddr, | |||
178 | buf->pages = kzalloc(buf->num_pages * sizeof(struct page *), | 178 | buf->pages = kzalloc(buf->num_pages * sizeof(struct page *), |
179 | GFP_KERNEL); | 179 | GFP_KERNEL); |
180 | if (!buf->pages) | 180 | if (!buf->pages) |
181 | return NULL; | 181 | goto userptr_fail_alloc_pages; |
182 | 182 | ||
183 | num_pages_from_user = get_user_pages(current, current->mm, | 183 | num_pages_from_user = get_user_pages(current, current->mm, |
184 | vaddr & PAGE_MASK, | 184 | vaddr & PAGE_MASK, |
@@ -204,6 +204,7 @@ userptr_fail_get_user_pages: | |||
204 | while (--num_pages_from_user >= 0) | 204 | while (--num_pages_from_user >= 0) |
205 | put_page(buf->pages[num_pages_from_user]); | 205 | put_page(buf->pages[num_pages_from_user]); |
206 | kfree(buf->pages); | 206 | kfree(buf->pages); |
207 | userptr_fail_alloc_pages: | ||
207 | kfree(buf); | 208 | kfree(buf); |
208 | return NULL; | 209 | return NULL; |
209 | } | 210 | } |
diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig index 62a60caa5d1f..dd671582c9a1 100644 --- a/drivers/mfd/Kconfig +++ b/drivers/mfd/Kconfig | |||
@@ -32,7 +32,7 @@ config MFD_AS3722 | |||
32 | select MFD_CORE | 32 | select MFD_CORE |
33 | select REGMAP_I2C | 33 | select REGMAP_I2C |
34 | select REGMAP_IRQ | 34 | select REGMAP_IRQ |
35 | depends on I2C && OF | 35 | depends on I2C=y && OF |
36 | help | 36 | help |
37 | The ams AS3722 is a compact system PMU suitable for mobile phones, | 37 | The ams AS3722 is a compact system PMU suitable for mobile phones, |
38 | tablets etc. It has 4 DC/DC step-down regulators, 3 DC/DC step-down | 38 | tablets etc. It has 4 DC/DC step-down regulators, 3 DC/DC step-down |
diff --git a/drivers/mfd/lpc_ich.c b/drivers/mfd/lpc_ich.c index da1c6566d93d..37edf9e989b0 100644 --- a/drivers/mfd/lpc_ich.c +++ b/drivers/mfd/lpc_ich.c | |||
@@ -506,7 +506,7 @@ static struct lpc_ich_info lpc_chipset_info[] = { | |||
506 | .iTCO_version = 2, | 506 | .iTCO_version = 2, |
507 | }, | 507 | }, |
508 | [LPC_WPT_LP] = { | 508 | [LPC_WPT_LP] = { |
509 | .name = "Lynx Point_LP", | 509 | .name = "Wildcat Point_LP", |
510 | .iTCO_version = 2, | 510 | .iTCO_version = 2, |
511 | }, | 511 | }, |
512 | }; | 512 | }; |
diff --git a/drivers/mfd/sec-core.c b/drivers/mfd/sec-core.c index 34c18fb8c089..54cc25546592 100644 --- a/drivers/mfd/sec-core.c +++ b/drivers/mfd/sec-core.c | |||
@@ -81,31 +81,31 @@ static struct of_device_id sec_dt_match[] = { | |||
81 | 81 | ||
82 | int sec_reg_read(struct sec_pmic_dev *sec_pmic, u8 reg, void *dest) | 82 | int sec_reg_read(struct sec_pmic_dev *sec_pmic, u8 reg, void *dest) |
83 | { | 83 | { |
84 | return regmap_read(sec_pmic->regmap, reg, dest); | 84 | return regmap_read(sec_pmic->regmap_pmic, reg, dest); |
85 | } | 85 | } |
86 | EXPORT_SYMBOL_GPL(sec_reg_read); | 86 | EXPORT_SYMBOL_GPL(sec_reg_read); |
87 | 87 | ||
88 | int sec_bulk_read(struct sec_pmic_dev *sec_pmic, u8 reg, int count, u8 *buf) | 88 | int sec_bulk_read(struct sec_pmic_dev *sec_pmic, u8 reg, int count, u8 *buf) |
89 | { | 89 | { |
90 | return regmap_bulk_read(sec_pmic->regmap, reg, buf, count); | 90 | return regmap_bulk_read(sec_pmic->regmap_pmic, reg, buf, count); |
91 | } | 91 | } |
92 | EXPORT_SYMBOL_GPL(sec_bulk_read); | 92 | EXPORT_SYMBOL_GPL(sec_bulk_read); |
93 | 93 | ||
94 | int sec_reg_write(struct sec_pmic_dev *sec_pmic, u8 reg, u8 value) | 94 | int sec_reg_write(struct sec_pmic_dev *sec_pmic, u8 reg, u8 value) |
95 | { | 95 | { |
96 | return regmap_write(sec_pmic->regmap, reg, value); | 96 | return regmap_write(sec_pmic->regmap_pmic, reg, value); |
97 | } | 97 | } |
98 | EXPORT_SYMBOL_GPL(sec_reg_write); | 98 | EXPORT_SYMBOL_GPL(sec_reg_write); |
99 | 99 | ||
100 | int sec_bulk_write(struct sec_pmic_dev *sec_pmic, u8 reg, int count, u8 *buf) | 100 | int sec_bulk_write(struct sec_pmic_dev *sec_pmic, u8 reg, int count, u8 *buf) |
101 | { | 101 | { |
102 | return regmap_raw_write(sec_pmic->regmap, reg, buf, count); | 102 | return regmap_raw_write(sec_pmic->regmap_pmic, reg, buf, count); |
103 | } | 103 | } |
104 | EXPORT_SYMBOL_GPL(sec_bulk_write); | 104 | EXPORT_SYMBOL_GPL(sec_bulk_write); |
105 | 105 | ||
106 | int sec_reg_update(struct sec_pmic_dev *sec_pmic, u8 reg, u8 val, u8 mask) | 106 | int sec_reg_update(struct sec_pmic_dev *sec_pmic, u8 reg, u8 val, u8 mask) |
107 | { | 107 | { |
108 | return regmap_update_bits(sec_pmic->regmap, reg, mask, val); | 108 | return regmap_update_bits(sec_pmic->regmap_pmic, reg, mask, val); |
109 | } | 109 | } |
110 | EXPORT_SYMBOL_GPL(sec_reg_update); | 110 | EXPORT_SYMBOL_GPL(sec_reg_update); |
111 | 111 | ||
@@ -166,6 +166,11 @@ static struct regmap_config s5m8767_regmap_config = { | |||
166 | .cache_type = REGCACHE_FLAT, | 166 | .cache_type = REGCACHE_FLAT, |
167 | }; | 167 | }; |
168 | 168 | ||
169 | static const struct regmap_config sec_rtc_regmap_config = { | ||
170 | .reg_bits = 8, | ||
171 | .val_bits = 8, | ||
172 | }; | ||
173 | |||
169 | #ifdef CONFIG_OF | 174 | #ifdef CONFIG_OF |
170 | /* | 175 | /* |
171 | * Only the common platform data elements for s5m8767 are parsed here from the | 176 | * Only the common platform data elements for s5m8767 are parsed here from the |
@@ -266,9 +271,9 @@ static int sec_pmic_probe(struct i2c_client *i2c, | |||
266 | break; | 271 | break; |
267 | } | 272 | } |
268 | 273 | ||
269 | sec_pmic->regmap = devm_regmap_init_i2c(i2c, regmap); | 274 | sec_pmic->regmap_pmic = devm_regmap_init_i2c(i2c, regmap); |
270 | if (IS_ERR(sec_pmic->regmap)) { | 275 | if (IS_ERR(sec_pmic->regmap_pmic)) { |
271 | ret = PTR_ERR(sec_pmic->regmap); | 276 | ret = PTR_ERR(sec_pmic->regmap_pmic); |
272 | dev_err(&i2c->dev, "Failed to allocate register map: %d\n", | 277 | dev_err(&i2c->dev, "Failed to allocate register map: %d\n", |
273 | ret); | 278 | ret); |
274 | return ret; | 279 | return ret; |
@@ -277,6 +282,15 @@ static int sec_pmic_probe(struct i2c_client *i2c, | |||
277 | sec_pmic->rtc = i2c_new_dummy(i2c->adapter, RTC_I2C_ADDR); | 282 | sec_pmic->rtc = i2c_new_dummy(i2c->adapter, RTC_I2C_ADDR); |
278 | i2c_set_clientdata(sec_pmic->rtc, sec_pmic); | 283 | i2c_set_clientdata(sec_pmic->rtc, sec_pmic); |
279 | 284 | ||
285 | sec_pmic->regmap_rtc = devm_regmap_init_i2c(sec_pmic->rtc, | ||
286 | &sec_rtc_regmap_config); | ||
287 | if (IS_ERR(sec_pmic->regmap_rtc)) { | ||
288 | ret = PTR_ERR(sec_pmic->regmap_rtc); | ||
289 | dev_err(&i2c->dev, "Failed to allocate RTC register map: %d\n", | ||
290 | ret); | ||
291 | return ret; | ||
292 | } | ||
293 | |||
280 | if (pdata && pdata->cfg_pmic_irq) | 294 | if (pdata && pdata->cfg_pmic_irq) |
281 | pdata->cfg_pmic_irq(); | 295 | pdata->cfg_pmic_irq(); |
282 | 296 | ||
diff --git a/drivers/mfd/sec-irq.c b/drivers/mfd/sec-irq.c index 0dd84e99081e..b441b1be27cb 100644 --- a/drivers/mfd/sec-irq.c +++ b/drivers/mfd/sec-irq.c | |||
@@ -280,19 +280,19 @@ int sec_irq_init(struct sec_pmic_dev *sec_pmic) | |||
280 | 280 | ||
281 | switch (type) { | 281 | switch (type) { |
282 | case S5M8763X: | 282 | case S5M8763X: |
283 | ret = regmap_add_irq_chip(sec_pmic->regmap, sec_pmic->irq, | 283 | ret = regmap_add_irq_chip(sec_pmic->regmap_pmic, sec_pmic->irq, |
284 | IRQF_TRIGGER_FALLING | IRQF_ONESHOT, | 284 | IRQF_TRIGGER_FALLING | IRQF_ONESHOT, |
285 | sec_pmic->irq_base, &s5m8763_irq_chip, | 285 | sec_pmic->irq_base, &s5m8763_irq_chip, |
286 | &sec_pmic->irq_data); | 286 | &sec_pmic->irq_data); |
287 | break; | 287 | break; |
288 | case S5M8767X: | 288 | case S5M8767X: |
289 | ret = regmap_add_irq_chip(sec_pmic->regmap, sec_pmic->irq, | 289 | ret = regmap_add_irq_chip(sec_pmic->regmap_pmic, sec_pmic->irq, |
290 | IRQF_TRIGGER_FALLING | IRQF_ONESHOT, | 290 | IRQF_TRIGGER_FALLING | IRQF_ONESHOT, |
291 | sec_pmic->irq_base, &s5m8767_irq_chip, | 291 | sec_pmic->irq_base, &s5m8767_irq_chip, |
292 | &sec_pmic->irq_data); | 292 | &sec_pmic->irq_data); |
293 | break; | 293 | break; |
294 | case S2MPS11X: | 294 | case S2MPS11X: |
295 | ret = regmap_add_irq_chip(sec_pmic->regmap, sec_pmic->irq, | 295 | ret = regmap_add_irq_chip(sec_pmic->regmap_pmic, sec_pmic->irq, |
296 | IRQF_TRIGGER_FALLING | IRQF_ONESHOT, | 296 | IRQF_TRIGGER_FALLING | IRQF_ONESHOT, |
297 | sec_pmic->irq_base, &s2mps11_irq_chip, | 297 | sec_pmic->irq_base, &s2mps11_irq_chip, |
298 | &sec_pmic->irq_data); | 298 | &sec_pmic->irq_data); |
diff --git a/drivers/mfd/ti-ssp.c b/drivers/mfd/ti-ssp.c index 71e3e0c5bf73..a5424579679c 100644 --- a/drivers/mfd/ti-ssp.c +++ b/drivers/mfd/ti-ssp.c | |||
@@ -32,6 +32,7 @@ | |||
32 | #include <linux/platform_device.h> | 32 | #include <linux/platform_device.h> |
33 | #include <linux/delay.h> | 33 | #include <linux/delay.h> |
34 | #include <linux/io.h> | 34 | #include <linux/io.h> |
35 | #include <linux/sched.h> | ||
35 | #include <linux/mfd/core.h> | 36 | #include <linux/mfd/core.h> |
36 | #include <linux/mfd/ti_ssp.h> | 37 | #include <linux/mfd/ti_ssp.h> |
37 | 38 | ||
@@ -409,7 +410,6 @@ static int ti_ssp_probe(struct platform_device *pdev) | |||
409 | cells[id].id = id; | 410 | cells[id].id = id; |
410 | cells[id].name = data->dev_name; | 411 | cells[id].name = data->dev_name; |
411 | cells[id].platform_data = data->pdata; | 412 | cells[id].platform_data = data->pdata; |
412 | cells[id].data_size = data->pdata_size; | ||
413 | } | 413 | } |
414 | 414 | ||
415 | error = mfd_add_devices(dev, 0, cells, 2, NULL, 0, NULL); | 415 | error = mfd_add_devices(dev, 0, cells, 2, NULL, 0, NULL); |
diff --git a/drivers/misc/enclosure.c b/drivers/misc/enclosure.c index 0e8df41aaf14..2cf2bbc0b927 100644 --- a/drivers/misc/enclosure.c +++ b/drivers/misc/enclosure.c | |||
@@ -198,6 +198,13 @@ static void enclosure_remove_links(struct enclosure_component *cdev) | |||
198 | { | 198 | { |
199 | char name[ENCLOSURE_NAME_SIZE]; | 199 | char name[ENCLOSURE_NAME_SIZE]; |
200 | 200 | ||
201 | /* | ||
202 | * In odd circumstances, like multipath devices, something else may | ||
203 | * already have removed the links, so check for this condition first. | ||
204 | */ | ||
205 | if (!cdev->dev->kobj.sd) | ||
206 | return; | ||
207 | |||
201 | enclosure_link_name(cdev, name); | 208 | enclosure_link_name(cdev, name); |
202 | sysfs_remove_link(&cdev->dev->kobj, name); | 209 | sysfs_remove_link(&cdev->dev->kobj, name); |
203 | sysfs_remove_link(&cdev->cdev.kobj, "device"); | 210 | sysfs_remove_link(&cdev->cdev.kobj, "device"); |
diff --git a/drivers/misc/mei/hw-me-regs.h b/drivers/misc/mei/hw-me-regs.h index 6c0fde55270d..66f411a6e8ea 100644 --- a/drivers/misc/mei/hw-me-regs.h +++ b/drivers/misc/mei/hw-me-regs.h | |||
@@ -109,9 +109,12 @@ | |||
109 | #define MEI_DEV_ID_PPT_2 0x1CBA /* Panther Point */ | 109 | #define MEI_DEV_ID_PPT_2 0x1CBA /* Panther Point */ |
110 | #define MEI_DEV_ID_PPT_3 0x1DBA /* Panther Point */ | 110 | #define MEI_DEV_ID_PPT_3 0x1DBA /* Panther Point */ |
111 | 111 | ||
112 | #define MEI_DEV_ID_LPT 0x8C3A /* Lynx Point */ | 112 | #define MEI_DEV_ID_LPT_H 0x8C3A /* Lynx Point H */ |
113 | #define MEI_DEV_ID_LPT_W 0x8D3A /* Lynx Point - Wellsburg */ | 113 | #define MEI_DEV_ID_LPT_W 0x8D3A /* Lynx Point - Wellsburg */ |
114 | #define MEI_DEV_ID_LPT_LP 0x9C3A /* Lynx Point LP */ | 114 | #define MEI_DEV_ID_LPT_LP 0x9C3A /* Lynx Point LP */ |
115 | #define MEI_DEV_ID_LPT_HR 0x8CBA /* Lynx Point H Refresh */ | ||
116 | |||
117 | #define MEI_DEV_ID_WPT_LP 0x9CBA /* Wildcat Point LP */ | ||
115 | /* | 118 | /* |
116 | * MEI HW Section | 119 | * MEI HW Section |
117 | */ | 120 | */ |
diff --git a/drivers/misc/mei/pci-me.c b/drivers/misc/mei/pci-me.c index b96205aece0c..2cab3c0a6805 100644 --- a/drivers/misc/mei/pci-me.c +++ b/drivers/misc/mei/pci-me.c | |||
@@ -76,9 +76,11 @@ static DEFINE_PCI_DEVICE_TABLE(mei_me_pci_tbl) = { | |||
76 | {PCI_DEVICE(PCI_VENDOR_ID_INTEL, MEI_DEV_ID_PPT_1)}, | 76 | {PCI_DEVICE(PCI_VENDOR_ID_INTEL, MEI_DEV_ID_PPT_1)}, |
77 | {PCI_DEVICE(PCI_VENDOR_ID_INTEL, MEI_DEV_ID_PPT_2)}, | 77 | {PCI_DEVICE(PCI_VENDOR_ID_INTEL, MEI_DEV_ID_PPT_2)}, |
78 | {PCI_DEVICE(PCI_VENDOR_ID_INTEL, MEI_DEV_ID_PPT_3)}, | 78 | {PCI_DEVICE(PCI_VENDOR_ID_INTEL, MEI_DEV_ID_PPT_3)}, |
79 | {PCI_DEVICE(PCI_VENDOR_ID_INTEL, MEI_DEV_ID_LPT)}, | 79 | {PCI_DEVICE(PCI_VENDOR_ID_INTEL, MEI_DEV_ID_LPT_H)}, |
80 | {PCI_DEVICE(PCI_VENDOR_ID_INTEL, MEI_DEV_ID_LPT_W)}, | 80 | {PCI_DEVICE(PCI_VENDOR_ID_INTEL, MEI_DEV_ID_LPT_W)}, |
81 | {PCI_DEVICE(PCI_VENDOR_ID_INTEL, MEI_DEV_ID_LPT_LP)}, | 81 | {PCI_DEVICE(PCI_VENDOR_ID_INTEL, MEI_DEV_ID_LPT_LP)}, |
82 | {PCI_DEVICE(PCI_VENDOR_ID_INTEL, MEI_DEV_ID_LPT_HR)}, | ||
83 | {PCI_DEVICE(PCI_VENDOR_ID_INTEL, MEI_DEV_ID_WPT_LP)}, | ||
82 | 84 | ||
83 | /* required last entry */ | 85 | /* required last entry */ |
84 | {0, } | 86 | {0, } |
diff --git a/drivers/misc/mic/card/mic_virtio.c b/drivers/misc/mic/card/mic_virtio.c index 8aa42e738acc..653799b96bfa 100644 --- a/drivers/misc/mic/card/mic_virtio.c +++ b/drivers/misc/mic/card/mic_virtio.c | |||
@@ -154,14 +154,14 @@ static void mic_reset_inform_host(struct virtio_device *vdev) | |||
154 | { | 154 | { |
155 | struct mic_vdev *mvdev = to_micvdev(vdev); | 155 | struct mic_vdev *mvdev = to_micvdev(vdev); |
156 | struct mic_device_ctrl __iomem *dc = mvdev->dc; | 156 | struct mic_device_ctrl __iomem *dc = mvdev->dc; |
157 | int retry = 100, i; | 157 | int retry; |
158 | 158 | ||
159 | iowrite8(0, &dc->host_ack); | 159 | iowrite8(0, &dc->host_ack); |
160 | iowrite8(1, &dc->vdev_reset); | 160 | iowrite8(1, &dc->vdev_reset); |
161 | mic_send_intr(mvdev->mdev, mvdev->c2h_vdev_db); | 161 | mic_send_intr(mvdev->mdev, mvdev->c2h_vdev_db); |
162 | 162 | ||
163 | /* Wait till host completes all card accesses and acks the reset */ | 163 | /* Wait till host completes all card accesses and acks the reset */ |
164 | for (i = retry; i--;) { | 164 | for (retry = 100; retry--;) { |
165 | if (ioread8(&dc->host_ack)) | 165 | if (ioread8(&dc->host_ack)) |
166 | break; | 166 | break; |
167 | msleep(100); | 167 | msleep(100); |
@@ -187,11 +187,12 @@ static void mic_reset(struct virtio_device *vdev) | |||
187 | /* | 187 | /* |
188 | * The virtio_ring code calls this API when it wants to notify the Host. | 188 | * The virtio_ring code calls this API when it wants to notify the Host. |
189 | */ | 189 | */ |
190 | static void mic_notify(struct virtqueue *vq) | 190 | static bool mic_notify(struct virtqueue *vq) |
191 | { | 191 | { |
192 | struct mic_vdev *mvdev = vq->priv; | 192 | struct mic_vdev *mvdev = vq->priv; |
193 | 193 | ||
194 | mic_send_intr(mvdev->mdev, mvdev->c2h_vdev_db); | 194 | mic_send_intr(mvdev->mdev, mvdev->c2h_vdev_db); |
195 | return true; | ||
195 | } | 196 | } |
196 | 197 | ||
197 | static void mic_del_vq(struct virtqueue *vq, int n) | 198 | static void mic_del_vq(struct virtqueue *vq, int n) |
@@ -247,17 +248,17 @@ static struct virtqueue *mic_find_vq(struct virtio_device *vdev, | |||
247 | /* First assign the vring's allocated in host memory */ | 248 | /* First assign the vring's allocated in host memory */ |
248 | vqconfig = mic_vq_config(mvdev->desc) + index; | 249 | vqconfig = mic_vq_config(mvdev->desc) + index; |
249 | memcpy_fromio(&config, vqconfig, sizeof(config)); | 250 | memcpy_fromio(&config, vqconfig, sizeof(config)); |
250 | _vr_size = vring_size(config.num, MIC_VIRTIO_RING_ALIGN); | 251 | _vr_size = vring_size(le16_to_cpu(config.num), MIC_VIRTIO_RING_ALIGN); |
251 | vr_size = PAGE_ALIGN(_vr_size + sizeof(struct _mic_vring_info)); | 252 | vr_size = PAGE_ALIGN(_vr_size + sizeof(struct _mic_vring_info)); |
252 | va = mic_card_map(mvdev->mdev, config.address, vr_size); | 253 | va = mic_card_map(mvdev->mdev, le64_to_cpu(config.address), vr_size); |
253 | if (!va) | 254 | if (!va) |
254 | return ERR_PTR(-ENOMEM); | 255 | return ERR_PTR(-ENOMEM); |
255 | mvdev->vr[index] = va; | 256 | mvdev->vr[index] = va; |
256 | memset_io(va, 0x0, _vr_size); | 257 | memset_io(va, 0x0, _vr_size); |
257 | vq = vring_new_virtqueue(index, | 258 | vq = vring_new_virtqueue(index, le16_to_cpu(config.num), |
258 | config.num, MIC_VIRTIO_RING_ALIGN, vdev, | 259 | MIC_VIRTIO_RING_ALIGN, vdev, false, |
259 | false, | 260 | (void __force *)va, mic_notify, callback, |
260 | va, mic_notify, callback, name); | 261 | name); |
261 | if (!vq) { | 262 | if (!vq) { |
262 | err = -ENOMEM; | 263 | err = -ENOMEM; |
263 | goto unmap; | 264 | goto unmap; |
@@ -272,7 +273,8 @@ static struct virtqueue *mic_find_vq(struct virtio_device *vdev, | |||
272 | 273 | ||
273 | /* Allocate and reassign used ring now */ | 274 | /* Allocate and reassign used ring now */ |
274 | mvdev->used_size[index] = PAGE_ALIGN(sizeof(__u16) * 3 + | 275 | mvdev->used_size[index] = PAGE_ALIGN(sizeof(__u16) * 3 + |
275 | sizeof(struct vring_used_elem) * config.num); | 276 | sizeof(struct vring_used_elem) * |
277 | le16_to_cpu(config.num)); | ||
276 | used = (void *)__get_free_pages(GFP_KERNEL | __GFP_ZERO, | 278 | used = (void *)__get_free_pages(GFP_KERNEL | __GFP_ZERO, |
277 | get_order(mvdev->used_size[index])); | 279 | get_order(mvdev->used_size[index])); |
278 | if (!used) { | 280 | if (!used) { |
@@ -309,7 +311,7 @@ static int mic_find_vqs(struct virtio_device *vdev, unsigned nvqs, | |||
309 | { | 311 | { |
310 | struct mic_vdev *mvdev = to_micvdev(vdev); | 312 | struct mic_vdev *mvdev = to_micvdev(vdev); |
311 | struct mic_device_ctrl __iomem *dc = mvdev->dc; | 313 | struct mic_device_ctrl __iomem *dc = mvdev->dc; |
312 | int i, err, retry = 100; | 314 | int i, err, retry; |
313 | 315 | ||
314 | /* We must have this many virtqueues. */ | 316 | /* We must have this many virtqueues. */ |
315 | if (nvqs > ioread8(&mvdev->desc->num_vq)) | 317 | if (nvqs > ioread8(&mvdev->desc->num_vq)) |
@@ -331,7 +333,7 @@ static int mic_find_vqs(struct virtio_device *vdev, unsigned nvqs, | |||
331 | * rings have been re-assigned. | 333 | * rings have been re-assigned. |
332 | */ | 334 | */ |
333 | mic_send_intr(mvdev->mdev, mvdev->c2h_vdev_db); | 335 | mic_send_intr(mvdev->mdev, mvdev->c2h_vdev_db); |
334 | for (i = retry; i--;) { | 336 | for (retry = 100; retry--;) { |
335 | if (!ioread8(&dc->used_address_updated)) | 337 | if (!ioread8(&dc->used_address_updated)) |
336 | break; | 338 | break; |
337 | msleep(100); | 339 | msleep(100); |
@@ -519,8 +521,8 @@ static void mic_scan_devices(struct mic_driver *mdrv, bool remove) | |||
519 | struct device *dev; | 521 | struct device *dev; |
520 | int ret; | 522 | int ret; |
521 | 523 | ||
522 | for (i = mic_aligned_size(struct mic_bootparam); | 524 | for (i = sizeof(struct mic_bootparam); i < MIC_DP_SIZE; |
523 | i < MIC_DP_SIZE; i += mic_total_desc_size(d)) { | 525 | i += mic_total_desc_size(d)) { |
524 | d = mdrv->dp + i; | 526 | d = mdrv->dp + i; |
525 | dc = (void __iomem *)d + mic_aligned_desc_size(d); | 527 | dc = (void __iomem *)d + mic_aligned_desc_size(d); |
526 | /* | 528 | /* |
@@ -539,7 +541,8 @@ static void mic_scan_devices(struct mic_driver *mdrv, bool remove) | |||
539 | continue; | 541 | continue; |
540 | 542 | ||
541 | /* device already exists */ | 543 | /* device already exists */ |
542 | dev = device_find_child(mdrv->dev, d, mic_match_desc); | 544 | dev = device_find_child(mdrv->dev, (void __force *)d, |
545 | mic_match_desc); | ||
543 | if (dev) { | 546 | if (dev) { |
544 | if (remove) | 547 | if (remove) |
545 | iowrite8(MIC_VIRTIO_PARAM_DEV_REMOVE, | 548 | iowrite8(MIC_VIRTIO_PARAM_DEV_REMOVE, |
diff --git a/drivers/misc/mic/card/mic_virtio.h b/drivers/misc/mic/card/mic_virtio.h index 2c5c22c93ba8..d0407ba53bb7 100644 --- a/drivers/misc/mic/card/mic_virtio.h +++ b/drivers/misc/mic/card/mic_virtio.h | |||
@@ -42,8 +42,8 @@ | |||
42 | 42 | ||
43 | static inline unsigned mic_desc_size(struct mic_device_desc __iomem *desc) | 43 | static inline unsigned mic_desc_size(struct mic_device_desc __iomem *desc) |
44 | { | 44 | { |
45 | return mic_aligned_size(*desc) | 45 | return sizeof(*desc) |
46 | + ioread8(&desc->num_vq) * mic_aligned_size(struct mic_vqconfig) | 46 | + ioread8(&desc->num_vq) * sizeof(struct mic_vqconfig) |
47 | + ioread8(&desc->feature_len) * 2 | 47 | + ioread8(&desc->feature_len) * 2 |
48 | + ioread8(&desc->config_len); | 48 | + ioread8(&desc->config_len); |
49 | } | 49 | } |
@@ -67,8 +67,7 @@ mic_vq_configspace(struct mic_device_desc __iomem *desc) | |||
67 | } | 67 | } |
68 | static inline unsigned mic_total_desc_size(struct mic_device_desc __iomem *desc) | 68 | static inline unsigned mic_total_desc_size(struct mic_device_desc __iomem *desc) |
69 | { | 69 | { |
70 | return mic_aligned_desc_size(desc) + | 70 | return mic_aligned_desc_size(desc) + sizeof(struct mic_device_ctrl); |
71 | mic_aligned_size(struct mic_device_ctrl); | ||
72 | } | 71 | } |
73 | 72 | ||
74 | int mic_devices_init(struct mic_driver *mdrv); | 73 | int mic_devices_init(struct mic_driver *mdrv); |
diff --git a/drivers/misc/mic/host/mic_boot.c b/drivers/misc/mic/host/mic_boot.c index 7558d9186438..b75c6b5cc20f 100644 --- a/drivers/misc/mic/host/mic_boot.c +++ b/drivers/misc/mic/host/mic_boot.c | |||
@@ -62,7 +62,7 @@ void mic_bootparam_init(struct mic_device *mdev) | |||
62 | { | 62 | { |
63 | struct mic_bootparam *bootparam = mdev->dp; | 63 | struct mic_bootparam *bootparam = mdev->dp; |
64 | 64 | ||
65 | bootparam->magic = MIC_MAGIC; | 65 | bootparam->magic = cpu_to_le32(MIC_MAGIC); |
66 | bootparam->c2h_shutdown_db = mdev->shutdown_db; | 66 | bootparam->c2h_shutdown_db = mdev->shutdown_db; |
67 | bootparam->h2c_shutdown_db = -1; | 67 | bootparam->h2c_shutdown_db = -1; |
68 | bootparam->h2c_config_db = -1; | 68 | bootparam->h2c_config_db = -1; |
diff --git a/drivers/misc/mic/host/mic_virtio.c b/drivers/misc/mic/host/mic_virtio.c index 5b8494bd1e00..e04bb4fe6823 100644 --- a/drivers/misc/mic/host/mic_virtio.c +++ b/drivers/misc/mic/host/mic_virtio.c | |||
@@ -41,7 +41,7 @@ static int mic_virtio_copy_to_user(struct mic_vdev *mvdev, | |||
41 | * We are copying from IO below an should ideally use something | 41 | * We are copying from IO below an should ideally use something |
42 | * like copy_to_user_fromio(..) if it existed. | 42 | * like copy_to_user_fromio(..) if it existed. |
43 | */ | 43 | */ |
44 | if (copy_to_user(ubuf, dbuf, len)) { | 44 | if (copy_to_user(ubuf, (void __force *)dbuf, len)) { |
45 | err = -EFAULT; | 45 | err = -EFAULT; |
46 | dev_err(mic_dev(mvdev), "%s %d err %d\n", | 46 | dev_err(mic_dev(mvdev), "%s %d err %d\n", |
47 | __func__, __LINE__, err); | 47 | __func__, __LINE__, err); |
@@ -66,7 +66,7 @@ static int mic_virtio_copy_from_user(struct mic_vdev *mvdev, | |||
66 | * We are copying to IO below and should ideally use something | 66 | * We are copying to IO below and should ideally use something |
67 | * like copy_from_user_toio(..) if it existed. | 67 | * like copy_from_user_toio(..) if it existed. |
68 | */ | 68 | */ |
69 | if (copy_from_user(dbuf, ubuf, len)) { | 69 | if (copy_from_user((void __force *)dbuf, ubuf, len)) { |
70 | err = -EFAULT; | 70 | err = -EFAULT; |
71 | dev_err(mic_dev(mvdev), "%s %d err %d\n", | 71 | dev_err(mic_dev(mvdev), "%s %d err %d\n", |
72 | __func__, __LINE__, err); | 72 | __func__, __LINE__, err); |
@@ -293,7 +293,7 @@ static void mic_virtio_init_post(struct mic_vdev *mvdev) | |||
293 | continue; | 293 | continue; |
294 | } | 294 | } |
295 | mvdev->mvr[i].vrh.vring.used = | 295 | mvdev->mvr[i].vrh.vring.used = |
296 | mvdev->mdev->aper.va + | 296 | (void __force *)mvdev->mdev->aper.va + |
297 | le64_to_cpu(vqconfig[i].used_address); | 297 | le64_to_cpu(vqconfig[i].used_address); |
298 | } | 298 | } |
299 | 299 | ||
@@ -378,7 +378,7 @@ int mic_virtio_config_change(struct mic_vdev *mvdev, | |||
378 | void __user *argp) | 378 | void __user *argp) |
379 | { | 379 | { |
380 | DECLARE_WAIT_QUEUE_HEAD_ONSTACK(wake); | 380 | DECLARE_WAIT_QUEUE_HEAD_ONSTACK(wake); |
381 | int ret = 0, retry = 100, i; | 381 | int ret = 0, retry, i; |
382 | struct mic_bootparam *bootparam = mvdev->mdev->dp; | 382 | struct mic_bootparam *bootparam = mvdev->mdev->dp; |
383 | s8 db = bootparam->h2c_config_db; | 383 | s8 db = bootparam->h2c_config_db; |
384 | 384 | ||
@@ -401,7 +401,7 @@ int mic_virtio_config_change(struct mic_vdev *mvdev, | |||
401 | mvdev->dc->config_change = MIC_VIRTIO_PARAM_CONFIG_CHANGED; | 401 | mvdev->dc->config_change = MIC_VIRTIO_PARAM_CONFIG_CHANGED; |
402 | mvdev->mdev->ops->send_intr(mvdev->mdev, db); | 402 | mvdev->mdev->ops->send_intr(mvdev->mdev, db); |
403 | 403 | ||
404 | for (i = retry; i--;) { | 404 | for (retry = 100; retry--;) { |
405 | ret = wait_event_timeout(wake, | 405 | ret = wait_event_timeout(wake, |
406 | mvdev->dc->guest_ack, msecs_to_jiffies(100)); | 406 | mvdev->dc->guest_ack, msecs_to_jiffies(100)); |
407 | if (ret) | 407 | if (ret) |
@@ -467,7 +467,7 @@ static int mic_copy_dp_entry(struct mic_vdev *mvdev, | |||
467 | } | 467 | } |
468 | 468 | ||
469 | /* Find the first free device page entry */ | 469 | /* Find the first free device page entry */ |
470 | for (i = mic_aligned_size(struct mic_bootparam); | 470 | for (i = sizeof(struct mic_bootparam); |
471 | i < MIC_DP_SIZE - mic_total_desc_size(dd_config); | 471 | i < MIC_DP_SIZE - mic_total_desc_size(dd_config); |
472 | i += mic_total_desc_size(devp)) { | 472 | i += mic_total_desc_size(devp)) { |
473 | devp = mdev->dp + i; | 473 | devp = mdev->dp + i; |
@@ -525,6 +525,7 @@ int mic_virtio_add_device(struct mic_vdev *mvdev, | |||
525 | char irqname[10]; | 525 | char irqname[10]; |
526 | struct mic_bootparam *bootparam = mdev->dp; | 526 | struct mic_bootparam *bootparam = mdev->dp; |
527 | u16 num; | 527 | u16 num; |
528 | dma_addr_t vr_addr; | ||
528 | 529 | ||
529 | mutex_lock(&mdev->mic_mutex); | 530 | mutex_lock(&mdev->mic_mutex); |
530 | 531 | ||
@@ -559,17 +560,16 @@ int mic_virtio_add_device(struct mic_vdev *mvdev, | |||
559 | } | 560 | } |
560 | vr->len = vr_size; | 561 | vr->len = vr_size; |
561 | vr->info = vr->va + vring_size(num, MIC_VIRTIO_RING_ALIGN); | 562 | vr->info = vr->va + vring_size(num, MIC_VIRTIO_RING_ALIGN); |
562 | vr->info->magic = MIC_MAGIC + mvdev->virtio_id + i; | 563 | vr->info->magic = cpu_to_le32(MIC_MAGIC + mvdev->virtio_id + i); |
563 | vqconfig[i].address = mic_map_single(mdev, | 564 | vr_addr = mic_map_single(mdev, vr->va, vr_size); |
564 | vr->va, vr_size); | 565 | if (mic_map_error(vr_addr)) { |
565 | if (mic_map_error(vqconfig[i].address)) { | ||
566 | free_pages((unsigned long)vr->va, get_order(vr_size)); | 566 | free_pages((unsigned long)vr->va, get_order(vr_size)); |
567 | ret = -ENOMEM; | 567 | ret = -ENOMEM; |
568 | dev_err(mic_dev(mvdev), "%s %d err %d\n", | 568 | dev_err(mic_dev(mvdev), "%s %d err %d\n", |
569 | __func__, __LINE__, ret); | 569 | __func__, __LINE__, ret); |
570 | goto err; | 570 | goto err; |
571 | } | 571 | } |
572 | vqconfig[i].address = cpu_to_le64(vqconfig[i].address); | 572 | vqconfig[i].address = cpu_to_le64(vr_addr); |
573 | 573 | ||
574 | vring_init(&vr->vr, num, vr->va, MIC_VIRTIO_RING_ALIGN); | 574 | vring_init(&vr->vr, num, vr->va, MIC_VIRTIO_RING_ALIGN); |
575 | ret = vringh_init_kern(&mvr->vrh, | 575 | ret = vringh_init_kern(&mvr->vrh, |
@@ -639,7 +639,7 @@ void mic_virtio_del_device(struct mic_vdev *mvdev) | |||
639 | struct mic_vdev *tmp_mvdev; | 639 | struct mic_vdev *tmp_mvdev; |
640 | struct mic_device *mdev = mvdev->mdev; | 640 | struct mic_device *mdev = mvdev->mdev; |
641 | DECLARE_WAIT_QUEUE_HEAD_ONSTACK(wake); | 641 | DECLARE_WAIT_QUEUE_HEAD_ONSTACK(wake); |
642 | int i, ret, retry = 100; | 642 | int i, ret, retry; |
643 | struct mic_vqconfig *vqconfig; | 643 | struct mic_vqconfig *vqconfig; |
644 | struct mic_bootparam *bootparam = mdev->dp; | 644 | struct mic_bootparam *bootparam = mdev->dp; |
645 | s8 db; | 645 | s8 db; |
@@ -652,16 +652,16 @@ void mic_virtio_del_device(struct mic_vdev *mvdev) | |||
652 | "Requesting hot remove id %d\n", mvdev->virtio_id); | 652 | "Requesting hot remove id %d\n", mvdev->virtio_id); |
653 | mvdev->dc->config_change = MIC_VIRTIO_PARAM_DEV_REMOVE; | 653 | mvdev->dc->config_change = MIC_VIRTIO_PARAM_DEV_REMOVE; |
654 | mdev->ops->send_intr(mdev, db); | 654 | mdev->ops->send_intr(mdev, db); |
655 | for (i = retry; i--;) { | 655 | for (retry = 100; retry--;) { |
656 | ret = wait_event_timeout(wake, | 656 | ret = wait_event_timeout(wake, |
657 | mvdev->dc->guest_ack, msecs_to_jiffies(100)); | 657 | mvdev->dc->guest_ack, msecs_to_jiffies(100)); |
658 | if (ret) | 658 | if (ret) |
659 | break; | 659 | break; |
660 | } | 660 | } |
661 | dev_dbg(mdev->sdev->parent, | 661 | dev_dbg(mdev->sdev->parent, |
662 | "Device id %d config_change %d guest_ack %d\n", | 662 | "Device id %d config_change %d guest_ack %d retry %d\n", |
663 | mvdev->virtio_id, mvdev->dc->config_change, | 663 | mvdev->virtio_id, mvdev->dc->config_change, |
664 | mvdev->dc->guest_ack); | 664 | mvdev->dc->guest_ack, retry); |
665 | mvdev->dc->config_change = 0; | 665 | mvdev->dc->config_change = 0; |
666 | mvdev->dc->guest_ack = 0; | 666 | mvdev->dc->guest_ack = 0; |
667 | skip_hot_remove: | 667 | skip_hot_remove: |
diff --git a/drivers/misc/mic/host/mic_x100.c b/drivers/misc/mic/host/mic_x100.c index 81e9541b784c..0dfa8a81436e 100644 --- a/drivers/misc/mic/host/mic_x100.c +++ b/drivers/misc/mic/host/mic_x100.c | |||
@@ -397,8 +397,8 @@ mic_x100_load_ramdisk(struct mic_device *mdev) | |||
397 | * so copy over the ramdisk @ 128M. | 397 | * so copy over the ramdisk @ 128M. |
398 | */ | 398 | */ |
399 | memcpy_toio(mdev->aper.va + (mdev->bootaddr << 1), fw->data, fw->size); | 399 | memcpy_toio(mdev->aper.va + (mdev->bootaddr << 1), fw->data, fw->size); |
400 | iowrite32(cpu_to_le32(mdev->bootaddr << 1), &bp->hdr.ramdisk_image); | 400 | iowrite32(mdev->bootaddr << 1, &bp->hdr.ramdisk_image); |
401 | iowrite32(cpu_to_le32(fw->size), &bp->hdr.ramdisk_size); | 401 | iowrite32(fw->size, &bp->hdr.ramdisk_size); |
402 | release_firmware(fw); | 402 | release_firmware(fw); |
403 | error: | 403 | error: |
404 | return rc; | 404 | return rc; |
diff --git a/drivers/mmc/host/omap.c b/drivers/mmc/host/omap.c index 0b10a9030f4e..98b6b6ef7e5c 100644 --- a/drivers/mmc/host/omap.c +++ b/drivers/mmc/host/omap.c | |||
@@ -22,6 +22,7 @@ | |||
22 | #include <linux/delay.h> | 22 | #include <linux/delay.h> |
23 | #include <linux/spinlock.h> | 23 | #include <linux/spinlock.h> |
24 | #include <linux/timer.h> | 24 | #include <linux/timer.h> |
25 | #include <linux/of.h> | ||
25 | #include <linux/omap-dma.h> | 26 | #include <linux/omap-dma.h> |
26 | #include <linux/mmc/host.h> | 27 | #include <linux/mmc/host.h> |
27 | #include <linux/mmc/card.h> | 28 | #include <linux/mmc/card.h> |
@@ -90,17 +91,6 @@ | |||
90 | #define OMAP_MMC_CMDTYPE_AC 2 | 91 | #define OMAP_MMC_CMDTYPE_AC 2 |
91 | #define OMAP_MMC_CMDTYPE_ADTC 3 | 92 | #define OMAP_MMC_CMDTYPE_ADTC 3 |
92 | 93 | ||
93 | #define OMAP_DMA_MMC_TX 21 | ||
94 | #define OMAP_DMA_MMC_RX 22 | ||
95 | #define OMAP_DMA_MMC2_TX 54 | ||
96 | #define OMAP_DMA_MMC2_RX 55 | ||
97 | |||
98 | #define OMAP24XX_DMA_MMC2_TX 47 | ||
99 | #define OMAP24XX_DMA_MMC2_RX 48 | ||
100 | #define OMAP24XX_DMA_MMC1_TX 61 | ||
101 | #define OMAP24XX_DMA_MMC1_RX 62 | ||
102 | |||
103 | |||
104 | #define DRIVER_NAME "mmci-omap" | 94 | #define DRIVER_NAME "mmci-omap" |
105 | 95 | ||
106 | /* Specifies how often in millisecs to poll for card status changes | 96 | /* Specifies how often in millisecs to poll for card status changes |
@@ -1330,7 +1320,7 @@ static int mmc_omap_probe(struct platform_device *pdev) | |||
1330 | struct mmc_omap_host *host = NULL; | 1320 | struct mmc_omap_host *host = NULL; |
1331 | struct resource *res; | 1321 | struct resource *res; |
1332 | dma_cap_mask_t mask; | 1322 | dma_cap_mask_t mask; |
1333 | unsigned sig; | 1323 | unsigned sig = 0; |
1334 | int i, ret = 0; | 1324 | int i, ret = 0; |
1335 | int irq; | 1325 | int irq; |
1336 | 1326 | ||
@@ -1340,7 +1330,7 @@ static int mmc_omap_probe(struct platform_device *pdev) | |||
1340 | } | 1330 | } |
1341 | if (pdata->nr_slots == 0) { | 1331 | if (pdata->nr_slots == 0) { |
1342 | dev_err(&pdev->dev, "no slots\n"); | 1332 | dev_err(&pdev->dev, "no slots\n"); |
1343 | return -ENXIO; | 1333 | return -EPROBE_DEFER; |
1344 | } | 1334 | } |
1345 | 1335 | ||
1346 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 1336 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
@@ -1407,19 +1397,20 @@ static int mmc_omap_probe(struct platform_device *pdev) | |||
1407 | host->dma_tx_burst = -1; | 1397 | host->dma_tx_burst = -1; |
1408 | host->dma_rx_burst = -1; | 1398 | host->dma_rx_burst = -1; |
1409 | 1399 | ||
1410 | if (mmc_omap2()) | 1400 | res = platform_get_resource_byname(pdev, IORESOURCE_DMA, "tx"); |
1411 | sig = host->id == 0 ? OMAP24XX_DMA_MMC1_TX : OMAP24XX_DMA_MMC2_TX; | 1401 | if (res) |
1412 | else | 1402 | sig = res->start; |
1413 | sig = host->id == 0 ? OMAP_DMA_MMC_TX : OMAP_DMA_MMC2_TX; | 1403 | host->dma_tx = dma_request_slave_channel_compat(mask, |
1414 | host->dma_tx = dma_request_channel(mask, omap_dma_filter_fn, &sig); | 1404 | omap_dma_filter_fn, &sig, &pdev->dev, "tx"); |
1415 | if (!host->dma_tx) | 1405 | if (!host->dma_tx) |
1416 | dev_warn(host->dev, "unable to obtain TX DMA engine channel %u\n", | 1406 | dev_warn(host->dev, "unable to obtain TX DMA engine channel %u\n", |
1417 | sig); | 1407 | sig); |
1418 | if (mmc_omap2()) | 1408 | |
1419 | sig = host->id == 0 ? OMAP24XX_DMA_MMC1_RX : OMAP24XX_DMA_MMC2_RX; | 1409 | res = platform_get_resource_byname(pdev, IORESOURCE_DMA, "rx"); |
1420 | else | 1410 | if (res) |
1421 | sig = host->id == 0 ? OMAP_DMA_MMC_RX : OMAP_DMA_MMC2_RX; | 1411 | sig = res->start; |
1422 | host->dma_rx = dma_request_channel(mask, omap_dma_filter_fn, &sig); | 1412 | host->dma_rx = dma_request_slave_channel_compat(mask, |
1413 | omap_dma_filter_fn, &sig, &pdev->dev, "rx"); | ||
1423 | if (!host->dma_rx) | 1414 | if (!host->dma_rx) |
1424 | dev_warn(host->dev, "unable to obtain RX DMA engine channel %u\n", | 1415 | dev_warn(host->dev, "unable to obtain RX DMA engine channel %u\n", |
1425 | sig); | 1416 | sig); |
@@ -1512,12 +1503,20 @@ static int mmc_omap_remove(struct platform_device *pdev) | |||
1512 | return 0; | 1503 | return 0; |
1513 | } | 1504 | } |
1514 | 1505 | ||
1506 | #if IS_BUILTIN(CONFIG_OF) | ||
1507 | static const struct of_device_id mmc_omap_match[] = { | ||
1508 | { .compatible = "ti,omap2420-mmc", }, | ||
1509 | { }, | ||
1510 | }; | ||
1511 | #endif | ||
1512 | |||
1515 | static struct platform_driver mmc_omap_driver = { | 1513 | static struct platform_driver mmc_omap_driver = { |
1516 | .probe = mmc_omap_probe, | 1514 | .probe = mmc_omap_probe, |
1517 | .remove = mmc_omap_remove, | 1515 | .remove = mmc_omap_remove, |
1518 | .driver = { | 1516 | .driver = { |
1519 | .name = DRIVER_NAME, | 1517 | .name = DRIVER_NAME, |
1520 | .owner = THIS_MODULE, | 1518 | .owner = THIS_MODULE, |
1519 | .of_match_table = of_match_ptr(mmc_omap_match), | ||
1521 | }, | 1520 | }, |
1522 | }; | 1521 | }; |
1523 | 1522 | ||
diff --git a/drivers/mtd/nand/pxa3xx_nand.c b/drivers/mtd/nand/pxa3xx_nand.c index 4cabdc9fda90..4b3aaa898a8b 100644 --- a/drivers/mtd/nand/pxa3xx_nand.c +++ b/drivers/mtd/nand/pxa3xx_nand.c | |||
@@ -962,7 +962,7 @@ static int pxa3xx_nand_init_buff(struct pxa3xx_nand_info *info) | |||
962 | static void pxa3xx_nand_free_buff(struct pxa3xx_nand_info *info) | 962 | static void pxa3xx_nand_free_buff(struct pxa3xx_nand_info *info) |
963 | { | 963 | { |
964 | struct platform_device *pdev = info->pdev; | 964 | struct platform_device *pdev = info->pdev; |
965 | if (use_dma) { | 965 | if (info->use_dma) { |
966 | pxa_free_dma(info->data_dma_ch); | 966 | pxa_free_dma(info->data_dma_ch); |
967 | dma_free_coherent(&pdev->dev, info->buf_size, | 967 | dma_free_coherent(&pdev->dev, info->buf_size, |
968 | info->data_buff, info->data_buff_phys); | 968 | info->data_buff, info->data_buff_phys); |
@@ -1259,10 +1259,6 @@ static struct of_device_id pxa3xx_nand_dt_ids[] = { | |||
1259 | .compatible = "marvell,pxa3xx-nand", | 1259 | .compatible = "marvell,pxa3xx-nand", |
1260 | .data = (void *)PXA3XX_NAND_VARIANT_PXA, | 1260 | .data = (void *)PXA3XX_NAND_VARIANT_PXA, |
1261 | }, | 1261 | }, |
1262 | { | ||
1263 | .compatible = "marvell,armada370-nand", | ||
1264 | .data = (void *)PXA3XX_NAND_VARIANT_ARMADA370, | ||
1265 | }, | ||
1266 | {} | 1262 | {} |
1267 | }; | 1263 | }; |
1268 | MODULE_DEVICE_TABLE(of, pxa3xx_nand_dt_ids); | 1264 | MODULE_DEVICE_TABLE(of, pxa3xx_nand_dt_ids); |
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c index 4dd5ee2a34cc..398e299ee1bd 100644 --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c | |||
@@ -4110,7 +4110,7 @@ static int bond_check_params(struct bond_params *params) | |||
4110 | if (!miimon) { | 4110 | if (!miimon) { |
4111 | pr_warning("Warning: miimon must be specified, otherwise bonding will not detect link failure, speed and duplex which are essential for 802.3ad operation\n"); | 4111 | pr_warning("Warning: miimon must be specified, otherwise bonding will not detect link failure, speed and duplex which are essential for 802.3ad operation\n"); |
4112 | pr_warning("Forcing miimon to 100msec\n"); | 4112 | pr_warning("Forcing miimon to 100msec\n"); |
4113 | miimon = 100; | 4113 | miimon = BOND_DEFAULT_MIIMON; |
4114 | } | 4114 | } |
4115 | } | 4115 | } |
4116 | 4116 | ||
@@ -4147,7 +4147,7 @@ static int bond_check_params(struct bond_params *params) | |||
4147 | if (!miimon) { | 4147 | if (!miimon) { |
4148 | pr_warning("Warning: miimon must be specified, otherwise bonding will not detect link failure and link speed which are essential for TLB/ALB load balancing\n"); | 4148 | pr_warning("Warning: miimon must be specified, otherwise bonding will not detect link failure and link speed which are essential for TLB/ALB load balancing\n"); |
4149 | pr_warning("Forcing miimon to 100msec\n"); | 4149 | pr_warning("Forcing miimon to 100msec\n"); |
4150 | miimon = 100; | 4150 | miimon = BOND_DEFAULT_MIIMON; |
4151 | } | 4151 | } |
4152 | } | 4152 | } |
4153 | 4153 | ||
@@ -4199,9 +4199,9 @@ static int bond_check_params(struct bond_params *params) | |||
4199 | (arp_ip_count < BOND_MAX_ARP_TARGETS) && arp_ip_target[i]; i++) { | 4199 | (arp_ip_count < BOND_MAX_ARP_TARGETS) && arp_ip_target[i]; i++) { |
4200 | /* not complete check, but should be good enough to | 4200 | /* not complete check, but should be good enough to |
4201 | catch mistakes */ | 4201 | catch mistakes */ |
4202 | __be32 ip = in_aton(arp_ip_target[i]); | 4202 | __be32 ip; |
4203 | if (!isdigit(arp_ip_target[i][0]) || ip == 0 || | 4203 | if (!in4_pton(arp_ip_target[i], -1, (u8 *)&ip, -1, NULL) || |
4204 | ip == htonl(INADDR_BROADCAST)) { | 4204 | IS_IP_TARGET_UNUSABLE_ADDRESS(ip)) { |
4205 | pr_warning("Warning: bad arp_ip_target module parameter (%s), ARP monitoring will not be performed\n", | 4205 | pr_warning("Warning: bad arp_ip_target module parameter (%s), ARP monitoring will not be performed\n", |
4206 | arp_ip_target[i]); | 4206 | arp_ip_target[i]); |
4207 | arp_interval = 0; | 4207 | arp_interval = 0; |
diff --git a/drivers/net/bonding/bond_options.c b/drivers/net/bonding/bond_options.c index 9a5223c7b4d1..ea6f640782b7 100644 --- a/drivers/net/bonding/bond_options.c +++ b/drivers/net/bonding/bond_options.c | |||
@@ -45,10 +45,15 @@ int bond_option_mode_set(struct bonding *bond, int mode) | |||
45 | return -EPERM; | 45 | return -EPERM; |
46 | } | 46 | } |
47 | 47 | ||
48 | if (BOND_MODE_IS_LB(mode) && bond->params.arp_interval) { | 48 | if (BOND_NO_USES_ARP(mode) && bond->params.arp_interval) { |
49 | pr_err("%s: %s mode is incompatible with arp monitoring.\n", | 49 | pr_info("%s: %s mode is incompatible with arp monitoring, start mii monitoring\n", |
50 | bond->dev->name, bond_mode_tbl[mode].modename); | 50 | bond->dev->name, bond_mode_tbl[mode].modename); |
51 | return -EINVAL; | 51 | /* disable arp monitoring */ |
52 | bond->params.arp_interval = 0; | ||
53 | /* set miimon to default value */ | ||
54 | bond->params.miimon = BOND_DEFAULT_MIIMON; | ||
55 | pr_info("%s: Setting MII monitoring interval to %d.\n", | ||
56 | bond->dev->name, bond->params.miimon); | ||
52 | } | 57 | } |
53 | 58 | ||
54 | /* don't cache arp_validate between modes */ | 59 | /* don't cache arp_validate between modes */ |
diff --git a/drivers/net/bonding/bond_sysfs.c b/drivers/net/bonding/bond_sysfs.c index 0ec2a7e8c8a9..0ae580bbc5db 100644 --- a/drivers/net/bonding/bond_sysfs.c +++ b/drivers/net/bonding/bond_sysfs.c | |||
@@ -523,9 +523,7 @@ static ssize_t bonding_store_arp_interval(struct device *d, | |||
523 | ret = -EINVAL; | 523 | ret = -EINVAL; |
524 | goto out; | 524 | goto out; |
525 | } | 525 | } |
526 | if (bond->params.mode == BOND_MODE_ALB || | 526 | if (BOND_NO_USES_ARP(bond->params.mode)) { |
527 | bond->params.mode == BOND_MODE_TLB || | ||
528 | bond->params.mode == BOND_MODE_8023AD) { | ||
529 | pr_info("%s: ARP monitoring cannot be used with ALB/TLB/802.3ad. Only MII monitoring is supported on %s.\n", | 527 | pr_info("%s: ARP monitoring cannot be used with ALB/TLB/802.3ad. Only MII monitoring is supported on %s.\n", |
530 | bond->dev->name, bond->dev->name); | 528 | bond->dev->name, bond->dev->name); |
531 | ret = -EINVAL; | 529 | ret = -EINVAL; |
@@ -1637,12 +1635,12 @@ static ssize_t bonding_show_packets_per_slave(struct device *d, | |||
1637 | char *buf) | 1635 | char *buf) |
1638 | { | 1636 | { |
1639 | struct bonding *bond = to_bond(d); | 1637 | struct bonding *bond = to_bond(d); |
1640 | int packets_per_slave = bond->params.packets_per_slave; | 1638 | unsigned int packets_per_slave = bond->params.packets_per_slave; |
1641 | 1639 | ||
1642 | if (packets_per_slave > 1) | 1640 | if (packets_per_slave > 1) |
1643 | packets_per_slave = reciprocal_value(packets_per_slave); | 1641 | packets_per_slave = reciprocal_value(packets_per_slave); |
1644 | 1642 | ||
1645 | return sprintf(buf, "%d\n", packets_per_slave); | 1643 | return sprintf(buf, "%u\n", packets_per_slave); |
1646 | } | 1644 | } |
1647 | 1645 | ||
1648 | static ssize_t bonding_store_packets_per_slave(struct device *d, | 1646 | static ssize_t bonding_store_packets_per_slave(struct device *d, |
diff --git a/drivers/net/bonding/bonding.h b/drivers/net/bonding/bonding.h index ca31286aa028..a9f4f9f4d8ce 100644 --- a/drivers/net/bonding/bonding.h +++ b/drivers/net/bonding/bonding.h | |||
@@ -35,6 +35,8 @@ | |||
35 | 35 | ||
36 | #define BOND_MAX_ARP_TARGETS 16 | 36 | #define BOND_MAX_ARP_TARGETS 16 |
37 | 37 | ||
38 | #define BOND_DEFAULT_MIIMON 100 | ||
39 | |||
38 | #define IS_UP(dev) \ | 40 | #define IS_UP(dev) \ |
39 | ((((dev)->flags & IFF_UP) == IFF_UP) && \ | 41 | ((((dev)->flags & IFF_UP) == IFF_UP) && \ |
40 | netif_running(dev) && \ | 42 | netif_running(dev) && \ |
@@ -55,6 +57,11 @@ | |||
55 | ((mode) == BOND_MODE_TLB) || \ | 57 | ((mode) == BOND_MODE_TLB) || \ |
56 | ((mode) == BOND_MODE_ALB)) | 58 | ((mode) == BOND_MODE_ALB)) |
57 | 59 | ||
60 | #define BOND_NO_USES_ARP(mode) \ | ||
61 | (((mode) == BOND_MODE_8023AD) || \ | ||
62 | ((mode) == BOND_MODE_TLB) || \ | ||
63 | ((mode) == BOND_MODE_ALB)) | ||
64 | |||
58 | #define TX_QUEUE_OVERRIDE(mode) \ | 65 | #define TX_QUEUE_OVERRIDE(mode) \ |
59 | (((mode) == BOND_MODE_ACTIVEBACKUP) || \ | 66 | (((mode) == BOND_MODE_ACTIVEBACKUP) || \ |
60 | ((mode) == BOND_MODE_ROUNDROBIN)) | 67 | ((mode) == BOND_MODE_ROUNDROBIN)) |
diff --git a/drivers/net/can/c_can/c_can.c b/drivers/net/can/c_can/c_can.c index e3fc07cf2f62..77061eebb034 100644 --- a/drivers/net/can/c_can/c_can.c +++ b/drivers/net/can/c_can/c_can.c | |||
@@ -712,22 +712,31 @@ static int c_can_set_mode(struct net_device *dev, enum can_mode mode) | |||
712 | return 0; | 712 | return 0; |
713 | } | 713 | } |
714 | 714 | ||
715 | static int c_can_get_berr_counter(const struct net_device *dev, | 715 | static int __c_can_get_berr_counter(const struct net_device *dev, |
716 | struct can_berr_counter *bec) | 716 | struct can_berr_counter *bec) |
717 | { | 717 | { |
718 | unsigned int reg_err_counter; | 718 | unsigned int reg_err_counter; |
719 | struct c_can_priv *priv = netdev_priv(dev); | 719 | struct c_can_priv *priv = netdev_priv(dev); |
720 | 720 | ||
721 | c_can_pm_runtime_get_sync(priv); | ||
722 | |||
723 | reg_err_counter = priv->read_reg(priv, C_CAN_ERR_CNT_REG); | 721 | reg_err_counter = priv->read_reg(priv, C_CAN_ERR_CNT_REG); |
724 | bec->rxerr = (reg_err_counter & ERR_CNT_REC_MASK) >> | 722 | bec->rxerr = (reg_err_counter & ERR_CNT_REC_MASK) >> |
725 | ERR_CNT_REC_SHIFT; | 723 | ERR_CNT_REC_SHIFT; |
726 | bec->txerr = reg_err_counter & ERR_CNT_TEC_MASK; | 724 | bec->txerr = reg_err_counter & ERR_CNT_TEC_MASK; |
727 | 725 | ||
726 | return 0; | ||
727 | } | ||
728 | |||
729 | static int c_can_get_berr_counter(const struct net_device *dev, | ||
730 | struct can_berr_counter *bec) | ||
731 | { | ||
732 | struct c_can_priv *priv = netdev_priv(dev); | ||
733 | int err; | ||
734 | |||
735 | c_can_pm_runtime_get_sync(priv); | ||
736 | err = __c_can_get_berr_counter(dev, bec); | ||
728 | c_can_pm_runtime_put_sync(priv); | 737 | c_can_pm_runtime_put_sync(priv); |
729 | 738 | ||
730 | return 0; | 739 | return err; |
731 | } | 740 | } |
732 | 741 | ||
733 | /* | 742 | /* |
@@ -754,6 +763,7 @@ static void c_can_do_tx(struct net_device *dev) | |||
754 | if (!(val & (1 << (msg_obj_no - 1)))) { | 763 | if (!(val & (1 << (msg_obj_no - 1)))) { |
755 | can_get_echo_skb(dev, | 764 | can_get_echo_skb(dev, |
756 | msg_obj_no - C_CAN_MSG_OBJ_TX_FIRST); | 765 | msg_obj_no - C_CAN_MSG_OBJ_TX_FIRST); |
766 | c_can_object_get(dev, 0, msg_obj_no, IF_COMM_ALL); | ||
757 | stats->tx_bytes += priv->read_reg(priv, | 767 | stats->tx_bytes += priv->read_reg(priv, |
758 | C_CAN_IFACE(MSGCTRL_REG, 0)) | 768 | C_CAN_IFACE(MSGCTRL_REG, 0)) |
759 | & IF_MCONT_DLC_MASK; | 769 | & IF_MCONT_DLC_MASK; |
@@ -872,7 +882,7 @@ static int c_can_handle_state_change(struct net_device *dev, | |||
872 | if (unlikely(!skb)) | 882 | if (unlikely(!skb)) |
873 | return 0; | 883 | return 0; |
874 | 884 | ||
875 | c_can_get_berr_counter(dev, &bec); | 885 | __c_can_get_berr_counter(dev, &bec); |
876 | reg_err_counter = priv->read_reg(priv, C_CAN_ERR_CNT_REG); | 886 | reg_err_counter = priv->read_reg(priv, C_CAN_ERR_CNT_REG); |
877 | rx_err_passive = (reg_err_counter & ERR_CNT_RP_MASK) >> | 887 | rx_err_passive = (reg_err_counter & ERR_CNT_RP_MASK) >> |
878 | ERR_CNT_RP_SHIFT; | 888 | ERR_CNT_RP_SHIFT; |
diff --git a/drivers/net/can/flexcan.c b/drivers/net/can/flexcan.c index ae08cf129ebb..aaed97bee471 100644 --- a/drivers/net/can/flexcan.c +++ b/drivers/net/can/flexcan.c | |||
@@ -1020,13 +1020,13 @@ static int flexcan_probe(struct platform_device *pdev) | |||
1020 | dev_err(&pdev->dev, "no ipg clock defined\n"); | 1020 | dev_err(&pdev->dev, "no ipg clock defined\n"); |
1021 | return PTR_ERR(clk_ipg); | 1021 | return PTR_ERR(clk_ipg); |
1022 | } | 1022 | } |
1023 | clock_freq = clk_get_rate(clk_ipg); | ||
1024 | 1023 | ||
1025 | clk_per = devm_clk_get(&pdev->dev, "per"); | 1024 | clk_per = devm_clk_get(&pdev->dev, "per"); |
1026 | if (IS_ERR(clk_per)) { | 1025 | if (IS_ERR(clk_per)) { |
1027 | dev_err(&pdev->dev, "no per clock defined\n"); | 1026 | dev_err(&pdev->dev, "no per clock defined\n"); |
1028 | return PTR_ERR(clk_per); | 1027 | return PTR_ERR(clk_per); |
1029 | } | 1028 | } |
1029 | clock_freq = clk_get_rate(clk_per); | ||
1030 | } | 1030 | } |
1031 | 1031 | ||
1032 | mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 1032 | mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
diff --git a/drivers/net/can/sja1000/sja1000.c b/drivers/net/can/sja1000/sja1000.c index 7164a999f50f..f17c3018b7c7 100644 --- a/drivers/net/can/sja1000/sja1000.c +++ b/drivers/net/can/sja1000/sja1000.c | |||
@@ -494,20 +494,20 @@ irqreturn_t sja1000_interrupt(int irq, void *dev_id) | |||
494 | uint8_t isrc, status; | 494 | uint8_t isrc, status; |
495 | int n = 0; | 495 | int n = 0; |
496 | 496 | ||
497 | /* Shared interrupts and IRQ off? */ | ||
498 | if (priv->read_reg(priv, SJA1000_IER) == IRQ_OFF) | ||
499 | return IRQ_NONE; | ||
500 | |||
501 | if (priv->pre_irq) | 497 | if (priv->pre_irq) |
502 | priv->pre_irq(priv); | 498 | priv->pre_irq(priv); |
503 | 499 | ||
500 | /* Shared interrupts and IRQ off? */ | ||
501 | if (priv->read_reg(priv, SJA1000_IER) == IRQ_OFF) | ||
502 | goto out; | ||
503 | |||
504 | while ((isrc = priv->read_reg(priv, SJA1000_IR)) && | 504 | while ((isrc = priv->read_reg(priv, SJA1000_IR)) && |
505 | (n < SJA1000_MAX_IRQ)) { | 505 | (n < SJA1000_MAX_IRQ)) { |
506 | n++; | 506 | |
507 | status = priv->read_reg(priv, SJA1000_SR); | 507 | status = priv->read_reg(priv, SJA1000_SR); |
508 | /* check for absent controller due to hw unplug */ | 508 | /* check for absent controller due to hw unplug */ |
509 | if (status == 0xFF && sja1000_is_absent(priv)) | 509 | if (status == 0xFF && sja1000_is_absent(priv)) |
510 | return IRQ_NONE; | 510 | goto out; |
511 | 511 | ||
512 | if (isrc & IRQ_WUI) | 512 | if (isrc & IRQ_WUI) |
513 | netdev_warn(dev, "wakeup interrupt\n"); | 513 | netdev_warn(dev, "wakeup interrupt\n"); |
@@ -535,7 +535,7 @@ irqreturn_t sja1000_interrupt(int irq, void *dev_id) | |||
535 | status = priv->read_reg(priv, SJA1000_SR); | 535 | status = priv->read_reg(priv, SJA1000_SR); |
536 | /* check for absent controller */ | 536 | /* check for absent controller */ |
537 | if (status == 0xFF && sja1000_is_absent(priv)) | 537 | if (status == 0xFF && sja1000_is_absent(priv)) |
538 | return IRQ_NONE; | 538 | goto out; |
539 | } | 539 | } |
540 | } | 540 | } |
541 | if (isrc & (IRQ_DOI | IRQ_EI | IRQ_BEI | IRQ_EPI | IRQ_ALI)) { | 541 | if (isrc & (IRQ_DOI | IRQ_EI | IRQ_BEI | IRQ_EPI | IRQ_ALI)) { |
@@ -543,8 +543,9 @@ irqreturn_t sja1000_interrupt(int irq, void *dev_id) | |||
543 | if (sja1000_err(dev, isrc, status)) | 543 | if (sja1000_err(dev, isrc, status)) |
544 | break; | 544 | break; |
545 | } | 545 | } |
546 | n++; | ||
546 | } | 547 | } |
547 | 548 | out: | |
548 | if (priv->post_irq) | 549 | if (priv->post_irq) |
549 | priv->post_irq(priv); | 550 | priv->post_irq(priv); |
550 | 551 | ||
diff --git a/drivers/net/ethernet/allwinner/sun4i-emac.c b/drivers/net/ethernet/allwinner/sun4i-emac.c index 50b853a79d77..46dfb1378c17 100644 --- a/drivers/net/ethernet/allwinner/sun4i-emac.c +++ b/drivers/net/ethernet/allwinner/sun4i-emac.c | |||
@@ -717,8 +717,7 @@ static int emac_open(struct net_device *dev) | |||
717 | if (netif_msg_ifup(db)) | 717 | if (netif_msg_ifup(db)) |
718 | dev_dbg(db->dev, "enabling %s\n", dev->name); | 718 | dev_dbg(db->dev, "enabling %s\n", dev->name); |
719 | 719 | ||
720 | if (devm_request_irq(db->dev, dev->irq, &emac_interrupt, | 720 | if (request_irq(dev->irq, &emac_interrupt, 0, dev->name, dev)) |
721 | 0, dev->name, dev)) | ||
722 | return -EAGAIN; | 721 | return -EAGAIN; |
723 | 722 | ||
724 | /* Initialize EMAC board */ | 723 | /* Initialize EMAC board */ |
@@ -774,6 +773,8 @@ static int emac_stop(struct net_device *ndev) | |||
774 | 773 | ||
775 | emac_shutdown(ndev); | 774 | emac_shutdown(ndev); |
776 | 775 | ||
776 | free_irq(ndev->irq, ndev); | ||
777 | |||
777 | return 0; | 778 | return 0; |
778 | } | 779 | } |
779 | 780 | ||
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c index 0216d592d0ce..2e46c28fc601 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c | |||
@@ -3114,6 +3114,11 @@ int bnx2x_sriov_configure(struct pci_dev *dev, int num_vfs_param) | |||
3114 | { | 3114 | { |
3115 | struct bnx2x *bp = netdev_priv(pci_get_drvdata(dev)); | 3115 | struct bnx2x *bp = netdev_priv(pci_get_drvdata(dev)); |
3116 | 3116 | ||
3117 | if (!IS_SRIOV(bp)) { | ||
3118 | BNX2X_ERR("failed to configure SR-IOV since vfdb was not allocated. Check dmesg for errors in probe stage\n"); | ||
3119 | return -EINVAL; | ||
3120 | } | ||
3121 | |||
3117 | DP(BNX2X_MSG_IOV, "bnx2x_sriov_configure called with %d, BNX2X_NR_VIRTFN(bp) was %d\n", | 3122 | DP(BNX2X_MSG_IOV, "bnx2x_sriov_configure called with %d, BNX2X_NR_VIRTFN(bp) was %d\n", |
3118 | num_vfs_param, BNX2X_NR_VIRTFN(bp)); | 3123 | num_vfs_param, BNX2X_NR_VIRTFN(bp)); |
3119 | 3124 | ||
diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c index a9e068423ba0..f3dd93b4aeaa 100644 --- a/drivers/net/ethernet/broadcom/tg3.c +++ b/drivers/net/ethernet/broadcom/tg3.c | |||
@@ -8932,6 +8932,9 @@ static int tg3_chip_reset(struct tg3 *tp) | |||
8932 | void (*write_op)(struct tg3 *, u32, u32); | 8932 | void (*write_op)(struct tg3 *, u32, u32); |
8933 | int i, err; | 8933 | int i, err; |
8934 | 8934 | ||
8935 | if (!pci_device_is_present(tp->pdev)) | ||
8936 | return -ENODEV; | ||
8937 | |||
8935 | tg3_nvram_lock(tp); | 8938 | tg3_nvram_lock(tp); |
8936 | 8939 | ||
8937 | tg3_ape_lock(tp, TG3_APE_LOCK_GRC); | 8940 | tg3_ape_lock(tp, TG3_APE_LOCK_GRC); |
@@ -10629,10 +10632,8 @@ static void tg3_sd_scan_scratchpad(struct tg3 *tp, struct tg3_ocir *ocir) | |||
10629 | static ssize_t tg3_show_temp(struct device *dev, | 10632 | static ssize_t tg3_show_temp(struct device *dev, |
10630 | struct device_attribute *devattr, char *buf) | 10633 | struct device_attribute *devattr, char *buf) |
10631 | { | 10634 | { |
10632 | struct pci_dev *pdev = to_pci_dev(dev); | ||
10633 | struct net_device *netdev = pci_get_drvdata(pdev); | ||
10634 | struct tg3 *tp = netdev_priv(netdev); | ||
10635 | struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); | 10635 | struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); |
10636 | struct tg3 *tp = dev_get_drvdata(dev); | ||
10636 | u32 temperature; | 10637 | u32 temperature; |
10637 | 10638 | ||
10638 | spin_lock_bh(&tp->lock); | 10639 | spin_lock_bh(&tp->lock); |
@@ -10650,29 +10651,25 @@ static SENSOR_DEVICE_ATTR(temp1_crit, S_IRUGO, tg3_show_temp, NULL, | |||
10650 | static SENSOR_DEVICE_ATTR(temp1_max, S_IRUGO, tg3_show_temp, NULL, | 10651 | static SENSOR_DEVICE_ATTR(temp1_max, S_IRUGO, tg3_show_temp, NULL, |
10651 | TG3_TEMP_MAX_OFFSET); | 10652 | TG3_TEMP_MAX_OFFSET); |
10652 | 10653 | ||
10653 | static struct attribute *tg3_attributes[] = { | 10654 | static struct attribute *tg3_attrs[] = { |
10654 | &sensor_dev_attr_temp1_input.dev_attr.attr, | 10655 | &sensor_dev_attr_temp1_input.dev_attr.attr, |
10655 | &sensor_dev_attr_temp1_crit.dev_attr.attr, | 10656 | &sensor_dev_attr_temp1_crit.dev_attr.attr, |
10656 | &sensor_dev_attr_temp1_max.dev_attr.attr, | 10657 | &sensor_dev_attr_temp1_max.dev_attr.attr, |
10657 | NULL | 10658 | NULL |
10658 | }; | 10659 | }; |
10659 | 10660 | ATTRIBUTE_GROUPS(tg3); | |
10660 | static const struct attribute_group tg3_group = { | ||
10661 | .attrs = tg3_attributes, | ||
10662 | }; | ||
10663 | 10661 | ||
10664 | static void tg3_hwmon_close(struct tg3 *tp) | 10662 | static void tg3_hwmon_close(struct tg3 *tp) |
10665 | { | 10663 | { |
10666 | if (tp->hwmon_dev) { | 10664 | if (tp->hwmon_dev) { |
10667 | hwmon_device_unregister(tp->hwmon_dev); | 10665 | hwmon_device_unregister(tp->hwmon_dev); |
10668 | tp->hwmon_dev = NULL; | 10666 | tp->hwmon_dev = NULL; |
10669 | sysfs_remove_group(&tp->pdev->dev.kobj, &tg3_group); | ||
10670 | } | 10667 | } |
10671 | } | 10668 | } |
10672 | 10669 | ||
10673 | static void tg3_hwmon_open(struct tg3 *tp) | 10670 | static void tg3_hwmon_open(struct tg3 *tp) |
10674 | { | 10671 | { |
10675 | int i, err; | 10672 | int i; |
10676 | u32 size = 0; | 10673 | u32 size = 0; |
10677 | struct pci_dev *pdev = tp->pdev; | 10674 | struct pci_dev *pdev = tp->pdev; |
10678 | struct tg3_ocir ocirs[TG3_SD_NUM_RECS]; | 10675 | struct tg3_ocir ocirs[TG3_SD_NUM_RECS]; |
@@ -10690,18 +10687,11 @@ static void tg3_hwmon_open(struct tg3 *tp) | |||
10690 | if (!size) | 10687 | if (!size) |
10691 | return; | 10688 | return; |
10692 | 10689 | ||
10693 | /* Register hwmon sysfs hooks */ | 10690 | tp->hwmon_dev = hwmon_device_register_with_groups(&pdev->dev, "tg3", |
10694 | err = sysfs_create_group(&pdev->dev.kobj, &tg3_group); | 10691 | tp, tg3_groups); |
10695 | if (err) { | ||
10696 | dev_err(&pdev->dev, "Cannot create sysfs group, aborting\n"); | ||
10697 | return; | ||
10698 | } | ||
10699 | |||
10700 | tp->hwmon_dev = hwmon_device_register(&pdev->dev); | ||
10701 | if (IS_ERR(tp->hwmon_dev)) { | 10692 | if (IS_ERR(tp->hwmon_dev)) { |
10702 | tp->hwmon_dev = NULL; | 10693 | tp->hwmon_dev = NULL; |
10703 | dev_err(&pdev->dev, "Cannot register hwmon device, aborting\n"); | 10694 | dev_err(&pdev->dev, "Cannot register hwmon device, aborting\n"); |
10704 | sysfs_remove_group(&pdev->dev.kobj, &tg3_group); | ||
10705 | } | 10695 | } |
10706 | } | 10696 | } |
10707 | 10697 | ||
@@ -11594,10 +11584,11 @@ static int tg3_close(struct net_device *dev) | |||
11594 | memset(&tp->net_stats_prev, 0, sizeof(tp->net_stats_prev)); | 11584 | memset(&tp->net_stats_prev, 0, sizeof(tp->net_stats_prev)); |
11595 | memset(&tp->estats_prev, 0, sizeof(tp->estats_prev)); | 11585 | memset(&tp->estats_prev, 0, sizeof(tp->estats_prev)); |
11596 | 11586 | ||
11597 | tg3_power_down_prepare(tp); | 11587 | if (pci_device_is_present(tp->pdev)) { |
11598 | 11588 | tg3_power_down_prepare(tp); | |
11599 | tg3_carrier_off(tp); | ||
11600 | 11589 | ||
11590 | tg3_carrier_off(tp); | ||
11591 | } | ||
11601 | return 0; | 11592 | return 0; |
11602 | } | 11593 | } |
11603 | 11594 | ||
@@ -16512,6 +16503,9 @@ static int tg3_get_invariants(struct tg3 *tp, const struct pci_device_id *ent) | |||
16512 | /* Clear this out for sanity. */ | 16503 | /* Clear this out for sanity. */ |
16513 | tw32(TG3PCI_MEM_WIN_BASE_ADDR, 0); | 16504 | tw32(TG3PCI_MEM_WIN_BASE_ADDR, 0); |
16514 | 16505 | ||
16506 | /* Clear TG3PCI_REG_BASE_ADDR to prevent hangs. */ | ||
16507 | tw32(TG3PCI_REG_BASE_ADDR, 0); | ||
16508 | |||
16515 | pci_read_config_dword(tp->pdev, TG3PCI_PCISTATE, | 16509 | pci_read_config_dword(tp->pdev, TG3PCI_PCISTATE, |
16516 | &pci_state_reg); | 16510 | &pci_state_reg); |
16517 | if ((pci_state_reg & PCISTATE_CONV_PCI_MODE) == 0 && | 16511 | if ((pci_state_reg & PCISTATE_CONV_PCI_MODE) == 0 && |
@@ -17739,10 +17733,12 @@ static int tg3_suspend(struct device *device) | |||
17739 | struct pci_dev *pdev = to_pci_dev(device); | 17733 | struct pci_dev *pdev = to_pci_dev(device); |
17740 | struct net_device *dev = pci_get_drvdata(pdev); | 17734 | struct net_device *dev = pci_get_drvdata(pdev); |
17741 | struct tg3 *tp = netdev_priv(dev); | 17735 | struct tg3 *tp = netdev_priv(dev); |
17742 | int err; | 17736 | int err = 0; |
17737 | |||
17738 | rtnl_lock(); | ||
17743 | 17739 | ||
17744 | if (!netif_running(dev)) | 17740 | if (!netif_running(dev)) |
17745 | return 0; | 17741 | goto unlock; |
17746 | 17742 | ||
17747 | tg3_reset_task_cancel(tp); | 17743 | tg3_reset_task_cancel(tp); |
17748 | tg3_phy_stop(tp); | 17744 | tg3_phy_stop(tp); |
@@ -17784,6 +17780,8 @@ out: | |||
17784 | tg3_phy_start(tp); | 17780 | tg3_phy_start(tp); |
17785 | } | 17781 | } |
17786 | 17782 | ||
17783 | unlock: | ||
17784 | rtnl_unlock(); | ||
17787 | return err; | 17785 | return err; |
17788 | } | 17786 | } |
17789 | 17787 | ||
@@ -17792,10 +17790,12 @@ static int tg3_resume(struct device *device) | |||
17792 | struct pci_dev *pdev = to_pci_dev(device); | 17790 | struct pci_dev *pdev = to_pci_dev(device); |
17793 | struct net_device *dev = pci_get_drvdata(pdev); | 17791 | struct net_device *dev = pci_get_drvdata(pdev); |
17794 | struct tg3 *tp = netdev_priv(dev); | 17792 | struct tg3 *tp = netdev_priv(dev); |
17795 | int err; | 17793 | int err = 0; |
17794 | |||
17795 | rtnl_lock(); | ||
17796 | 17796 | ||
17797 | if (!netif_running(dev)) | 17797 | if (!netif_running(dev)) |
17798 | return 0; | 17798 | goto unlock; |
17799 | 17799 | ||
17800 | netif_device_attach(dev); | 17800 | netif_device_attach(dev); |
17801 | 17801 | ||
@@ -17819,6 +17819,8 @@ out: | |||
17819 | if (!err) | 17819 | if (!err) |
17820 | tg3_phy_start(tp); | 17820 | tg3_phy_start(tp); |
17821 | 17821 | ||
17822 | unlock: | ||
17823 | rtnl_unlock(); | ||
17822 | return err; | 17824 | return err; |
17823 | } | 17825 | } |
17824 | #endif /* CONFIG_PM_SLEEP */ | 17826 | #endif /* CONFIG_PM_SLEEP */ |
diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4.h b/drivers/net/ethernet/chelsio/cxgb4/cxgb4.h index ecd2fb3ef695..6c9308850453 100644 --- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4.h +++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4.h | |||
@@ -49,13 +49,15 @@ | |||
49 | #include <asm/io.h> | 49 | #include <asm/io.h> |
50 | #include "cxgb4_uld.h" | 50 | #include "cxgb4_uld.h" |
51 | 51 | ||
52 | #define FW_VERSION_MAJOR 1 | 52 | #define T4FW_VERSION_MAJOR 0x01 |
53 | #define FW_VERSION_MINOR 4 | 53 | #define T4FW_VERSION_MINOR 0x06 |
54 | #define FW_VERSION_MICRO 0 | 54 | #define T4FW_VERSION_MICRO 0x18 |
55 | #define T4FW_VERSION_BUILD 0x00 | ||
55 | 56 | ||
56 | #define FW_VERSION_MAJOR_T5 0 | 57 | #define T5FW_VERSION_MAJOR 0x01 |
57 | #define FW_VERSION_MINOR_T5 0 | 58 | #define T5FW_VERSION_MINOR 0x08 |
58 | #define FW_VERSION_MICRO_T5 0 | 59 | #define T5FW_VERSION_MICRO 0x1C |
60 | #define T5FW_VERSION_BUILD 0x00 | ||
59 | 61 | ||
60 | #define CH_WARN(adap, fmt, ...) dev_warn(adap->pdev_dev, fmt, ## __VA_ARGS__) | 62 | #define CH_WARN(adap, fmt, ...) dev_warn(adap->pdev_dev, fmt, ## __VA_ARGS__) |
61 | 63 | ||
@@ -240,6 +242,26 @@ struct pci_params { | |||
240 | unsigned char width; | 242 | unsigned char width; |
241 | }; | 243 | }; |
242 | 244 | ||
245 | #define CHELSIO_CHIP_CODE(version, revision) (((version) << 4) | (revision)) | ||
246 | #define CHELSIO_CHIP_FPGA 0x100 | ||
247 | #define CHELSIO_CHIP_VERSION(code) (((code) >> 4) & 0xf) | ||
248 | #define CHELSIO_CHIP_RELEASE(code) ((code) & 0xf) | ||
249 | |||
250 | #define CHELSIO_T4 0x4 | ||
251 | #define CHELSIO_T5 0x5 | ||
252 | |||
253 | enum chip_type { | ||
254 | T4_A1 = CHELSIO_CHIP_CODE(CHELSIO_T4, 1), | ||
255 | T4_A2 = CHELSIO_CHIP_CODE(CHELSIO_T4, 2), | ||
256 | T4_FIRST_REV = T4_A1, | ||
257 | T4_LAST_REV = T4_A2, | ||
258 | |||
259 | T5_A0 = CHELSIO_CHIP_CODE(CHELSIO_T5, 0), | ||
260 | T5_A1 = CHELSIO_CHIP_CODE(CHELSIO_T5, 1), | ||
261 | T5_FIRST_REV = T5_A0, | ||
262 | T5_LAST_REV = T5_A1, | ||
263 | }; | ||
264 | |||
243 | struct adapter_params { | 265 | struct adapter_params { |
244 | struct tp_params tp; | 266 | struct tp_params tp; |
245 | struct vpd_params vpd; | 267 | struct vpd_params vpd; |
@@ -259,7 +281,7 @@ struct adapter_params { | |||
259 | 281 | ||
260 | unsigned char nports; /* # of ethernet ports */ | 282 | unsigned char nports; /* # of ethernet ports */ |
261 | unsigned char portvec; | 283 | unsigned char portvec; |
262 | unsigned char rev; /* chip revision */ | 284 | enum chip_type chip; /* chip code */ |
263 | unsigned char offload; | 285 | unsigned char offload; |
264 | 286 | ||
265 | unsigned char bypass; | 287 | unsigned char bypass; |
@@ -267,6 +289,23 @@ struct adapter_params { | |||
267 | unsigned int ofldq_wr_cred; | 289 | unsigned int ofldq_wr_cred; |
268 | }; | 290 | }; |
269 | 291 | ||
292 | #include "t4fw_api.h" | ||
293 | |||
294 | #define FW_VERSION(chip) ( \ | ||
295 | FW_HDR_FW_VER_MAJOR_GET(chip##FW_VERSION_MAJOR) | \ | ||
296 | FW_HDR_FW_VER_MINOR_GET(chip##FW_VERSION_MINOR) | \ | ||
297 | FW_HDR_FW_VER_MICRO_GET(chip##FW_VERSION_MICRO) | \ | ||
298 | FW_HDR_FW_VER_BUILD_GET(chip##FW_VERSION_BUILD)) | ||
299 | #define FW_INTFVER(chip, intf) (FW_HDR_INTFVER_##intf) | ||
300 | |||
301 | struct fw_info { | ||
302 | u8 chip; | ||
303 | char *fs_name; | ||
304 | char *fw_mod_name; | ||
305 | struct fw_hdr fw_hdr; | ||
306 | }; | ||
307 | |||
308 | |||
270 | struct trace_params { | 309 | struct trace_params { |
271 | u32 data[TRACE_LEN / 4]; | 310 | u32 data[TRACE_LEN / 4]; |
272 | u32 mask[TRACE_LEN / 4]; | 311 | u32 mask[TRACE_LEN / 4]; |
@@ -512,25 +551,6 @@ struct sge { | |||
512 | 551 | ||
513 | struct l2t_data; | 552 | struct l2t_data; |
514 | 553 | ||
515 | #define CHELSIO_CHIP_CODE(version, revision) (((version) << 4) | (revision)) | ||
516 | #define CHELSIO_CHIP_VERSION(code) ((code) >> 4) | ||
517 | #define CHELSIO_CHIP_RELEASE(code) ((code) & 0xf) | ||
518 | |||
519 | #define CHELSIO_T4 0x4 | ||
520 | #define CHELSIO_T5 0x5 | ||
521 | |||
522 | enum chip_type { | ||
523 | T4_A1 = CHELSIO_CHIP_CODE(CHELSIO_T4, 0), | ||
524 | T4_A2 = CHELSIO_CHIP_CODE(CHELSIO_T4, 1), | ||
525 | T4_A3 = CHELSIO_CHIP_CODE(CHELSIO_T4, 2), | ||
526 | T4_FIRST_REV = T4_A1, | ||
527 | T4_LAST_REV = T4_A3, | ||
528 | |||
529 | T5_A1 = CHELSIO_CHIP_CODE(CHELSIO_T5, 0), | ||
530 | T5_FIRST_REV = T5_A1, | ||
531 | T5_LAST_REV = T5_A1, | ||
532 | }; | ||
533 | |||
534 | #ifdef CONFIG_PCI_IOV | 554 | #ifdef CONFIG_PCI_IOV |
535 | 555 | ||
536 | /* T4 supports SRIOV on PF0-3 and T5 on PF0-7. However, the Serial | 556 | /* T4 supports SRIOV on PF0-3 and T5 on PF0-7. However, the Serial |
@@ -715,12 +735,12 @@ enum { | |||
715 | 735 | ||
716 | static inline int is_t5(enum chip_type chip) | 736 | static inline int is_t5(enum chip_type chip) |
717 | { | 737 | { |
718 | return (chip >= T5_FIRST_REV && chip <= T5_LAST_REV); | 738 | return CHELSIO_CHIP_VERSION(chip) == CHELSIO_T5; |
719 | } | 739 | } |
720 | 740 | ||
721 | static inline int is_t4(enum chip_type chip) | 741 | static inline int is_t4(enum chip_type chip) |
722 | { | 742 | { |
723 | return (chip >= T4_FIRST_REV && chip <= T4_LAST_REV); | 743 | return CHELSIO_CHIP_VERSION(chip) == CHELSIO_T4; |
724 | } | 744 | } |
725 | 745 | ||
726 | static inline u32 t4_read_reg(struct adapter *adap, u32 reg_addr) | 746 | static inline u32 t4_read_reg(struct adapter *adap, u32 reg_addr) |
@@ -900,7 +920,11 @@ int get_vpd_params(struct adapter *adapter, struct vpd_params *p); | |||
900 | int t4_load_fw(struct adapter *adapter, const u8 *fw_data, unsigned int size); | 920 | int t4_load_fw(struct adapter *adapter, const u8 *fw_data, unsigned int size); |
901 | unsigned int t4_flash_cfg_addr(struct adapter *adapter); | 921 | unsigned int t4_flash_cfg_addr(struct adapter *adapter); |
902 | int t4_load_cfg(struct adapter *adapter, const u8 *cfg_data, unsigned int size); | 922 | int t4_load_cfg(struct adapter *adapter, const u8 *cfg_data, unsigned int size); |
903 | int t4_check_fw_version(struct adapter *adapter); | 923 | int t4_get_fw_version(struct adapter *adapter, u32 *vers); |
924 | int t4_get_tp_version(struct adapter *adapter, u32 *vers); | ||
925 | int t4_prep_fw(struct adapter *adap, struct fw_info *fw_info, | ||
926 | const u8 *fw_data, unsigned int fw_size, | ||
927 | struct fw_hdr *card_fw, enum dev_state state, int *reset); | ||
904 | int t4_prep_adapter(struct adapter *adapter); | 928 | int t4_prep_adapter(struct adapter *adapter); |
905 | int t4_port_init(struct adapter *adap, int mbox, int pf, int vf); | 929 | int t4_port_init(struct adapter *adap, int mbox, int pf, int vf); |
906 | void t4_fatal_err(struct adapter *adapter); | 930 | void t4_fatal_err(struct adapter *adapter); |
diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c index 8b929eeecd2d..d6b12e035a7d 100644 --- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c +++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c | |||
@@ -276,9 +276,9 @@ static DEFINE_PCI_DEVICE_TABLE(cxgb4_pci_tbl) = { | |||
276 | { 0, } | 276 | { 0, } |
277 | }; | 277 | }; |
278 | 278 | ||
279 | #define FW_FNAME "cxgb4/t4fw.bin" | 279 | #define FW4_FNAME "cxgb4/t4fw.bin" |
280 | #define FW5_FNAME "cxgb4/t5fw.bin" | 280 | #define FW5_FNAME "cxgb4/t5fw.bin" |
281 | #define FW_CFNAME "cxgb4/t4-config.txt" | 281 | #define FW4_CFNAME "cxgb4/t4-config.txt" |
282 | #define FW5_CFNAME "cxgb4/t5-config.txt" | 282 | #define FW5_CFNAME "cxgb4/t5-config.txt" |
283 | 283 | ||
284 | MODULE_DESCRIPTION(DRV_DESC); | 284 | MODULE_DESCRIPTION(DRV_DESC); |
@@ -286,7 +286,7 @@ MODULE_AUTHOR("Chelsio Communications"); | |||
286 | MODULE_LICENSE("Dual BSD/GPL"); | 286 | MODULE_LICENSE("Dual BSD/GPL"); |
287 | MODULE_VERSION(DRV_VERSION); | 287 | MODULE_VERSION(DRV_VERSION); |
288 | MODULE_DEVICE_TABLE(pci, cxgb4_pci_tbl); | 288 | MODULE_DEVICE_TABLE(pci, cxgb4_pci_tbl); |
289 | MODULE_FIRMWARE(FW_FNAME); | 289 | MODULE_FIRMWARE(FW4_FNAME); |
290 | MODULE_FIRMWARE(FW5_FNAME); | 290 | MODULE_FIRMWARE(FW5_FNAME); |
291 | 291 | ||
292 | /* | 292 | /* |
@@ -1071,72 +1071,6 @@ freeout: t4_free_sge_resources(adap); | |||
1071 | } | 1071 | } |
1072 | 1072 | ||
1073 | /* | 1073 | /* |
1074 | * Returns 0 if new FW was successfully loaded, a positive errno if a load was | ||
1075 | * started but failed, and a negative errno if flash load couldn't start. | ||
1076 | */ | ||
1077 | static int upgrade_fw(struct adapter *adap) | ||
1078 | { | ||
1079 | int ret; | ||
1080 | u32 vers, exp_major; | ||
1081 | const struct fw_hdr *hdr; | ||
1082 | const struct firmware *fw; | ||
1083 | struct device *dev = adap->pdev_dev; | ||
1084 | char *fw_file_name; | ||
1085 | |||
1086 | switch (CHELSIO_CHIP_VERSION(adap->chip)) { | ||
1087 | case CHELSIO_T4: | ||
1088 | fw_file_name = FW_FNAME; | ||
1089 | exp_major = FW_VERSION_MAJOR; | ||
1090 | break; | ||
1091 | case CHELSIO_T5: | ||
1092 | fw_file_name = FW5_FNAME; | ||
1093 | exp_major = FW_VERSION_MAJOR_T5; | ||
1094 | break; | ||
1095 | default: | ||
1096 | dev_err(dev, "Unsupported chip type, %x\n", adap->chip); | ||
1097 | return -EINVAL; | ||
1098 | } | ||
1099 | |||
1100 | ret = request_firmware(&fw, fw_file_name, dev); | ||
1101 | if (ret < 0) { | ||
1102 | dev_err(dev, "unable to load firmware image %s, error %d\n", | ||
1103 | fw_file_name, ret); | ||
1104 | return ret; | ||
1105 | } | ||
1106 | |||
1107 | hdr = (const struct fw_hdr *)fw->data; | ||
1108 | vers = ntohl(hdr->fw_ver); | ||
1109 | if (FW_HDR_FW_VER_MAJOR_GET(vers) != exp_major) { | ||
1110 | ret = -EINVAL; /* wrong major version, won't do */ | ||
1111 | goto out; | ||
1112 | } | ||
1113 | |||
1114 | /* | ||
1115 | * If the flash FW is unusable or we found something newer, load it. | ||
1116 | */ | ||
1117 | if (FW_HDR_FW_VER_MAJOR_GET(adap->params.fw_vers) != exp_major || | ||
1118 | vers > adap->params.fw_vers) { | ||
1119 | dev_info(dev, "upgrading firmware ...\n"); | ||
1120 | ret = t4_fw_upgrade(adap, adap->mbox, fw->data, fw->size, | ||
1121 | /*force=*/false); | ||
1122 | if (!ret) | ||
1123 | dev_info(dev, | ||
1124 | "firmware upgraded to version %pI4 from %s\n", | ||
1125 | &hdr->fw_ver, fw_file_name); | ||
1126 | else | ||
1127 | dev_err(dev, "firmware upgrade failed! err=%d\n", -ret); | ||
1128 | } else { | ||
1129 | /* | ||
1130 | * Tell our caller that we didn't upgrade the firmware. | ||
1131 | */ | ||
1132 | ret = -EINVAL; | ||
1133 | } | ||
1134 | |||
1135 | out: release_firmware(fw); | ||
1136 | return ret; | ||
1137 | } | ||
1138 | |||
1139 | /* | ||
1140 | * Allocate a chunk of memory using kmalloc or, if that fails, vmalloc. | 1074 | * Allocate a chunk of memory using kmalloc or, if that fails, vmalloc. |
1141 | * The allocated memory is cleared. | 1075 | * The allocated memory is cleared. |
1142 | */ | 1076 | */ |
@@ -1415,7 +1349,7 @@ static int get_sset_count(struct net_device *dev, int sset) | |||
1415 | static int get_regs_len(struct net_device *dev) | 1349 | static int get_regs_len(struct net_device *dev) |
1416 | { | 1350 | { |
1417 | struct adapter *adap = netdev2adap(dev); | 1351 | struct adapter *adap = netdev2adap(dev); |
1418 | if (is_t4(adap->chip)) | 1352 | if (is_t4(adap->params.chip)) |
1419 | return T4_REGMAP_SIZE; | 1353 | return T4_REGMAP_SIZE; |
1420 | else | 1354 | else |
1421 | return T5_REGMAP_SIZE; | 1355 | return T5_REGMAP_SIZE; |
@@ -1499,7 +1433,7 @@ static void get_stats(struct net_device *dev, struct ethtool_stats *stats, | |||
1499 | data += sizeof(struct port_stats) / sizeof(u64); | 1433 | data += sizeof(struct port_stats) / sizeof(u64); |
1500 | collect_sge_port_stats(adapter, pi, (struct queue_port_stats *)data); | 1434 | collect_sge_port_stats(adapter, pi, (struct queue_port_stats *)data); |
1501 | data += sizeof(struct queue_port_stats) / sizeof(u64); | 1435 | data += sizeof(struct queue_port_stats) / sizeof(u64); |
1502 | if (!is_t4(adapter->chip)) { | 1436 | if (!is_t4(adapter->params.chip)) { |
1503 | t4_write_reg(adapter, SGE_STAT_CFG, STATSOURCE_T5(7)); | 1437 | t4_write_reg(adapter, SGE_STAT_CFG, STATSOURCE_T5(7)); |
1504 | val1 = t4_read_reg(adapter, SGE_STAT_TOTAL); | 1438 | val1 = t4_read_reg(adapter, SGE_STAT_TOTAL); |
1505 | val2 = t4_read_reg(adapter, SGE_STAT_MATCH); | 1439 | val2 = t4_read_reg(adapter, SGE_STAT_MATCH); |
@@ -1521,8 +1455,8 @@ static void get_stats(struct net_device *dev, struct ethtool_stats *stats, | |||
1521 | */ | 1455 | */ |
1522 | static inline unsigned int mk_adap_vers(const struct adapter *ap) | 1456 | static inline unsigned int mk_adap_vers(const struct adapter *ap) |
1523 | { | 1457 | { |
1524 | return CHELSIO_CHIP_VERSION(ap->chip) | | 1458 | return CHELSIO_CHIP_VERSION(ap->params.chip) | |
1525 | (CHELSIO_CHIP_RELEASE(ap->chip) << 10) | (1 << 16); | 1459 | (CHELSIO_CHIP_RELEASE(ap->params.chip) << 10) | (1 << 16); |
1526 | } | 1460 | } |
1527 | 1461 | ||
1528 | static void reg_block_dump(struct adapter *ap, void *buf, unsigned int start, | 1462 | static void reg_block_dump(struct adapter *ap, void *buf, unsigned int start, |
@@ -2189,7 +2123,7 @@ static void get_regs(struct net_device *dev, struct ethtool_regs *regs, | |||
2189 | static const unsigned int *reg_ranges; | 2123 | static const unsigned int *reg_ranges; |
2190 | int arr_size = 0, buf_size = 0; | 2124 | int arr_size = 0, buf_size = 0; |
2191 | 2125 | ||
2192 | if (is_t4(ap->chip)) { | 2126 | if (is_t4(ap->params.chip)) { |
2193 | reg_ranges = &t4_reg_ranges[0]; | 2127 | reg_ranges = &t4_reg_ranges[0]; |
2194 | arr_size = ARRAY_SIZE(t4_reg_ranges); | 2128 | arr_size = ARRAY_SIZE(t4_reg_ranges); |
2195 | buf_size = T4_REGMAP_SIZE; | 2129 | buf_size = T4_REGMAP_SIZE; |
@@ -2967,7 +2901,7 @@ static int setup_debugfs(struct adapter *adap) | |||
2967 | size = t4_read_reg(adap, MA_EDRAM1_BAR); | 2901 | size = t4_read_reg(adap, MA_EDRAM1_BAR); |
2968 | add_debugfs_mem(adap, "edc1", MEM_EDC1, EDRAM_SIZE_GET(size)); | 2902 | add_debugfs_mem(adap, "edc1", MEM_EDC1, EDRAM_SIZE_GET(size)); |
2969 | } | 2903 | } |
2970 | if (is_t4(adap->chip)) { | 2904 | if (is_t4(adap->params.chip)) { |
2971 | size = t4_read_reg(adap, MA_EXT_MEMORY_BAR); | 2905 | size = t4_read_reg(adap, MA_EXT_MEMORY_BAR); |
2972 | if (i & EXT_MEM_ENABLE) | 2906 | if (i & EXT_MEM_ENABLE) |
2973 | add_debugfs_mem(adap, "mc", MEM_MC, | 2907 | add_debugfs_mem(adap, "mc", MEM_MC, |
@@ -3419,7 +3353,7 @@ unsigned int cxgb4_dbfifo_count(const struct net_device *dev, int lpfifo) | |||
3419 | 3353 | ||
3420 | v1 = t4_read_reg(adap, A_SGE_DBFIFO_STATUS); | 3354 | v1 = t4_read_reg(adap, A_SGE_DBFIFO_STATUS); |
3421 | v2 = t4_read_reg(adap, SGE_DBFIFO_STATUS2); | 3355 | v2 = t4_read_reg(adap, SGE_DBFIFO_STATUS2); |
3422 | if (is_t4(adap->chip)) { | 3356 | if (is_t4(adap->params.chip)) { |
3423 | lp_count = G_LP_COUNT(v1); | 3357 | lp_count = G_LP_COUNT(v1); |
3424 | hp_count = G_HP_COUNT(v1); | 3358 | hp_count = G_HP_COUNT(v1); |
3425 | } else { | 3359 | } else { |
@@ -3588,7 +3522,7 @@ static void drain_db_fifo(struct adapter *adap, int usecs) | |||
3588 | do { | 3522 | do { |
3589 | v1 = t4_read_reg(adap, A_SGE_DBFIFO_STATUS); | 3523 | v1 = t4_read_reg(adap, A_SGE_DBFIFO_STATUS); |
3590 | v2 = t4_read_reg(adap, SGE_DBFIFO_STATUS2); | 3524 | v2 = t4_read_reg(adap, SGE_DBFIFO_STATUS2); |
3591 | if (is_t4(adap->chip)) { | 3525 | if (is_t4(adap->params.chip)) { |
3592 | lp_count = G_LP_COUNT(v1); | 3526 | lp_count = G_LP_COUNT(v1); |
3593 | hp_count = G_HP_COUNT(v1); | 3527 | hp_count = G_HP_COUNT(v1); |
3594 | } else { | 3528 | } else { |
@@ -3708,7 +3642,7 @@ static void process_db_drop(struct work_struct *work) | |||
3708 | 3642 | ||
3709 | adap = container_of(work, struct adapter, db_drop_task); | 3643 | adap = container_of(work, struct adapter, db_drop_task); |
3710 | 3644 | ||
3711 | if (is_t4(adap->chip)) { | 3645 | if (is_t4(adap->params.chip)) { |
3712 | disable_dbs(adap); | 3646 | disable_dbs(adap); |
3713 | notify_rdma_uld(adap, CXGB4_CONTROL_DB_DROP); | 3647 | notify_rdma_uld(adap, CXGB4_CONTROL_DB_DROP); |
3714 | drain_db_fifo(adap, 1); | 3648 | drain_db_fifo(adap, 1); |
@@ -3753,7 +3687,7 @@ static void process_db_drop(struct work_struct *work) | |||
3753 | 3687 | ||
3754 | void t4_db_full(struct adapter *adap) | 3688 | void t4_db_full(struct adapter *adap) |
3755 | { | 3689 | { |
3756 | if (is_t4(adap->chip)) { | 3690 | if (is_t4(adap->params.chip)) { |
3757 | t4_set_reg_field(adap, SGE_INT_ENABLE3, | 3691 | t4_set_reg_field(adap, SGE_INT_ENABLE3, |
3758 | DBFIFO_HP_INT | DBFIFO_LP_INT, 0); | 3692 | DBFIFO_HP_INT | DBFIFO_LP_INT, 0); |
3759 | queue_work(workq, &adap->db_full_task); | 3693 | queue_work(workq, &adap->db_full_task); |
@@ -3762,7 +3696,7 @@ void t4_db_full(struct adapter *adap) | |||
3762 | 3696 | ||
3763 | void t4_db_dropped(struct adapter *adap) | 3697 | void t4_db_dropped(struct adapter *adap) |
3764 | { | 3698 | { |
3765 | if (is_t4(adap->chip)) | 3699 | if (is_t4(adap->params.chip)) |
3766 | queue_work(workq, &adap->db_drop_task); | 3700 | queue_work(workq, &adap->db_drop_task); |
3767 | } | 3701 | } |
3768 | 3702 | ||
@@ -3789,7 +3723,7 @@ static void uld_attach(struct adapter *adap, unsigned int uld) | |||
3789 | lli.nchan = adap->params.nports; | 3723 | lli.nchan = adap->params.nports; |
3790 | lli.nports = adap->params.nports; | 3724 | lli.nports = adap->params.nports; |
3791 | lli.wr_cred = adap->params.ofldq_wr_cred; | 3725 | lli.wr_cred = adap->params.ofldq_wr_cred; |
3792 | lli.adapter_type = adap->params.rev; | 3726 | lli.adapter_type = adap->params.chip; |
3793 | lli.iscsi_iolen = MAXRXDATA_GET(t4_read_reg(adap, TP_PARA_REG2)); | 3727 | lli.iscsi_iolen = MAXRXDATA_GET(t4_read_reg(adap, TP_PARA_REG2)); |
3794 | lli.udb_density = 1 << QUEUESPERPAGEPF0_GET( | 3728 | lli.udb_density = 1 << QUEUESPERPAGEPF0_GET( |
3795 | t4_read_reg(adap, SGE_EGRESS_QUEUES_PER_PAGE_PF) >> | 3729 | t4_read_reg(adap, SGE_EGRESS_QUEUES_PER_PAGE_PF) >> |
@@ -4483,7 +4417,7 @@ static void setup_memwin(struct adapter *adap) | |||
4483 | u32 bar0, mem_win0_base, mem_win1_base, mem_win2_base; | 4417 | u32 bar0, mem_win0_base, mem_win1_base, mem_win2_base; |
4484 | 4418 | ||
4485 | bar0 = pci_resource_start(adap->pdev, 0); /* truncation intentional */ | 4419 | bar0 = pci_resource_start(adap->pdev, 0); /* truncation intentional */ |
4486 | if (is_t4(adap->chip)) { | 4420 | if (is_t4(adap->params.chip)) { |
4487 | mem_win0_base = bar0 + MEMWIN0_BASE; | 4421 | mem_win0_base = bar0 + MEMWIN0_BASE; |
4488 | mem_win1_base = bar0 + MEMWIN1_BASE; | 4422 | mem_win1_base = bar0 + MEMWIN1_BASE; |
4489 | mem_win2_base = bar0 + MEMWIN2_BASE; | 4423 | mem_win2_base = bar0 + MEMWIN2_BASE; |
@@ -4668,8 +4602,10 @@ static int adap_init0_config(struct adapter *adapter, int reset) | |||
4668 | const struct firmware *cf; | 4602 | const struct firmware *cf; |
4669 | unsigned long mtype = 0, maddr = 0; | 4603 | unsigned long mtype = 0, maddr = 0; |
4670 | u32 finiver, finicsum, cfcsum; | 4604 | u32 finiver, finicsum, cfcsum; |
4671 | int ret, using_flash; | 4605 | int ret; |
4606 | int config_issued = 0; | ||
4672 | char *fw_config_file, fw_config_file_path[256]; | 4607 | char *fw_config_file, fw_config_file_path[256]; |
4608 | char *config_name = NULL; | ||
4673 | 4609 | ||
4674 | /* | 4610 | /* |
4675 | * Reset device if necessary. | 4611 | * Reset device if necessary. |
@@ -4686,9 +4622,9 @@ static int adap_init0_config(struct adapter *adapter, int reset) | |||
4686 | * then use that. Otherwise, use the configuration file stored | 4622 | * then use that. Otherwise, use the configuration file stored |
4687 | * in the adapter flash ... | 4623 | * in the adapter flash ... |
4688 | */ | 4624 | */ |
4689 | switch (CHELSIO_CHIP_VERSION(adapter->chip)) { | 4625 | switch (CHELSIO_CHIP_VERSION(adapter->params.chip)) { |
4690 | case CHELSIO_T4: | 4626 | case CHELSIO_T4: |
4691 | fw_config_file = FW_CFNAME; | 4627 | fw_config_file = FW4_CFNAME; |
4692 | break; | 4628 | break; |
4693 | case CHELSIO_T5: | 4629 | case CHELSIO_T5: |
4694 | fw_config_file = FW5_CFNAME; | 4630 | fw_config_file = FW5_CFNAME; |
@@ -4702,13 +4638,16 @@ static int adap_init0_config(struct adapter *adapter, int reset) | |||
4702 | 4638 | ||
4703 | ret = request_firmware(&cf, fw_config_file, adapter->pdev_dev); | 4639 | ret = request_firmware(&cf, fw_config_file, adapter->pdev_dev); |
4704 | if (ret < 0) { | 4640 | if (ret < 0) { |
4705 | using_flash = 1; | 4641 | config_name = "On FLASH"; |
4706 | mtype = FW_MEMTYPE_CF_FLASH; | 4642 | mtype = FW_MEMTYPE_CF_FLASH; |
4707 | maddr = t4_flash_cfg_addr(adapter); | 4643 | maddr = t4_flash_cfg_addr(adapter); |
4708 | } else { | 4644 | } else { |
4709 | u32 params[7], val[7]; | 4645 | u32 params[7], val[7]; |
4710 | 4646 | ||
4711 | using_flash = 0; | 4647 | sprintf(fw_config_file_path, |
4648 | "/lib/firmware/%s", fw_config_file); | ||
4649 | config_name = fw_config_file_path; | ||
4650 | |||
4712 | if (cf->size >= FLASH_CFG_MAX_SIZE) | 4651 | if (cf->size >= FLASH_CFG_MAX_SIZE) |
4713 | ret = -ENOMEM; | 4652 | ret = -ENOMEM; |
4714 | else { | 4653 | else { |
@@ -4776,6 +4715,26 @@ static int adap_init0_config(struct adapter *adapter, int reset) | |||
4776 | FW_LEN16(caps_cmd)); | 4715 | FW_LEN16(caps_cmd)); |
4777 | ret = t4_wr_mbox(adapter, adapter->mbox, &caps_cmd, sizeof(caps_cmd), | 4716 | ret = t4_wr_mbox(adapter, adapter->mbox, &caps_cmd, sizeof(caps_cmd), |
4778 | &caps_cmd); | 4717 | &caps_cmd); |
4718 | |||
4719 | /* If the CAPS_CONFIG failed with an ENOENT (for a Firmware | ||
4720 | * Configuration File in FLASH), our last gasp effort is to use the | ||
4721 | * Firmware Configuration File which is embedded in the firmware. A | ||
4722 | * very few early versions of the firmware didn't have one embedded | ||
4723 | * but we can ignore those. | ||
4724 | */ | ||
4725 | if (ret == -ENOENT) { | ||
4726 | memset(&caps_cmd, 0, sizeof(caps_cmd)); | ||
4727 | caps_cmd.op_to_write = | ||
4728 | htonl(FW_CMD_OP(FW_CAPS_CONFIG_CMD) | | ||
4729 | FW_CMD_REQUEST | | ||
4730 | FW_CMD_READ); | ||
4731 | caps_cmd.cfvalid_to_len16 = htonl(FW_LEN16(caps_cmd)); | ||
4732 | ret = t4_wr_mbox(adapter, adapter->mbox, &caps_cmd, | ||
4733 | sizeof(caps_cmd), &caps_cmd); | ||
4734 | config_name = "Firmware Default"; | ||
4735 | } | ||
4736 | |||
4737 | config_issued = 1; | ||
4779 | if (ret < 0) | 4738 | if (ret < 0) |
4780 | goto bye; | 4739 | goto bye; |
4781 | 4740 | ||
@@ -4816,7 +4775,6 @@ static int adap_init0_config(struct adapter *adapter, int reset) | |||
4816 | if (ret < 0) | 4775 | if (ret < 0) |
4817 | goto bye; | 4776 | goto bye; |
4818 | 4777 | ||
4819 | sprintf(fw_config_file_path, "/lib/firmware/%s", fw_config_file); | ||
4820 | /* | 4778 | /* |
4821 | * Return successfully and note that we're operating with parameters | 4779 | * Return successfully and note that we're operating with parameters |
4822 | * not supplied by the driver, rather than from hard-wired | 4780 | * not supplied by the driver, rather than from hard-wired |
@@ -4824,11 +4782,8 @@ static int adap_init0_config(struct adapter *adapter, int reset) | |||
4824 | */ | 4782 | */ |
4825 | adapter->flags |= USING_SOFT_PARAMS; | 4783 | adapter->flags |= USING_SOFT_PARAMS; |
4826 | dev_info(adapter->pdev_dev, "Successfully configured using Firmware "\ | 4784 | dev_info(adapter->pdev_dev, "Successfully configured using Firmware "\ |
4827 | "Configuration File %s, version %#x, computed checksum %#x\n", | 4785 | "Configuration File \"%s\", version %#x, computed checksum %#x\n", |
4828 | (using_flash | 4786 | config_name, finiver, cfcsum); |
4829 | ? "in device FLASH" | ||
4830 | : fw_config_file_path), | ||
4831 | finiver, cfcsum); | ||
4832 | return 0; | 4787 | return 0; |
4833 | 4788 | ||
4834 | /* | 4789 | /* |
@@ -4837,9 +4792,9 @@ static int adap_init0_config(struct adapter *adapter, int reset) | |||
4837 | * want to issue a warning since this is fairly common.) | 4792 | * want to issue a warning since this is fairly common.) |
4838 | */ | 4793 | */ |
4839 | bye: | 4794 | bye: |
4840 | if (ret != -ENOENT) | 4795 | if (config_issued && ret != -ENOENT) |
4841 | dev_warn(adapter->pdev_dev, "Configuration file error %d\n", | 4796 | dev_warn(adapter->pdev_dev, "\"%s\" configuration file error %d\n", |
4842 | -ret); | 4797 | config_name, -ret); |
4843 | return ret; | 4798 | return ret; |
4844 | } | 4799 | } |
4845 | 4800 | ||
@@ -5086,6 +5041,47 @@ bye: | |||
5086 | return ret; | 5041 | return ret; |
5087 | } | 5042 | } |
5088 | 5043 | ||
5044 | static struct fw_info fw_info_array[] = { | ||
5045 | { | ||
5046 | .chip = CHELSIO_T4, | ||
5047 | .fs_name = FW4_CFNAME, | ||
5048 | .fw_mod_name = FW4_FNAME, | ||
5049 | .fw_hdr = { | ||
5050 | .chip = FW_HDR_CHIP_T4, | ||
5051 | .fw_ver = __cpu_to_be32(FW_VERSION(T4)), | ||
5052 | .intfver_nic = FW_INTFVER(T4, NIC), | ||
5053 | .intfver_vnic = FW_INTFVER(T4, VNIC), | ||
5054 | .intfver_ri = FW_INTFVER(T4, RI), | ||
5055 | .intfver_iscsi = FW_INTFVER(T4, ISCSI), | ||
5056 | .intfver_fcoe = FW_INTFVER(T4, FCOE), | ||
5057 | }, | ||
5058 | }, { | ||
5059 | .chip = CHELSIO_T5, | ||
5060 | .fs_name = FW5_CFNAME, | ||
5061 | .fw_mod_name = FW5_FNAME, | ||
5062 | .fw_hdr = { | ||
5063 | .chip = FW_HDR_CHIP_T5, | ||
5064 | .fw_ver = __cpu_to_be32(FW_VERSION(T5)), | ||
5065 | .intfver_nic = FW_INTFVER(T5, NIC), | ||
5066 | .intfver_vnic = FW_INTFVER(T5, VNIC), | ||
5067 | .intfver_ri = FW_INTFVER(T5, RI), | ||
5068 | .intfver_iscsi = FW_INTFVER(T5, ISCSI), | ||
5069 | .intfver_fcoe = FW_INTFVER(T5, FCOE), | ||
5070 | }, | ||
5071 | } | ||
5072 | }; | ||
5073 | |||
5074 | static struct fw_info *find_fw_info(int chip) | ||
5075 | { | ||
5076 | int i; | ||
5077 | |||
5078 | for (i = 0; i < ARRAY_SIZE(fw_info_array); i++) { | ||
5079 | if (fw_info_array[i].chip == chip) | ||
5080 | return &fw_info_array[i]; | ||
5081 | } | ||
5082 | return NULL; | ||
5083 | } | ||
5084 | |||
5089 | /* | 5085 | /* |
5090 | * Phase 0 of initialization: contact FW, obtain config, perform basic init. | 5086 | * Phase 0 of initialization: contact FW, obtain config, perform basic init. |
5091 | */ | 5087 | */ |
@@ -5123,44 +5119,54 @@ static int adap_init0(struct adapter *adap) | |||
5123 | * later reporting and B. to warn if the currently loaded firmware | 5119 | * later reporting and B. to warn if the currently loaded firmware |
5124 | * is excessively mismatched relative to the driver.) | 5120 | * is excessively mismatched relative to the driver.) |
5125 | */ | 5121 | */ |
5126 | ret = t4_check_fw_version(adap); | 5122 | t4_get_fw_version(adap, &adap->params.fw_vers); |
5127 | 5123 | t4_get_tp_version(adap, &adap->params.tp_vers); | |
5128 | /* The error code -EFAULT is returned by t4_check_fw_version() if | ||
5129 | * firmware on adapter < supported firmware. If firmware on adapter | ||
5130 | * is too old (not supported by driver) and we're the MASTER_PF set | ||
5131 | * adapter state to DEV_STATE_UNINIT to force firmware upgrade | ||
5132 | * and reinitialization. | ||
5133 | */ | ||
5134 | if ((adap->flags & MASTER_PF) && ret == -EFAULT) | ||
5135 | state = DEV_STATE_UNINIT; | ||
5136 | if ((adap->flags & MASTER_PF) && state != DEV_STATE_INIT) { | 5124 | if ((adap->flags & MASTER_PF) && state != DEV_STATE_INIT) { |
5137 | if (ret == -EINVAL || ret == -EFAULT || ret > 0) { | 5125 | struct fw_info *fw_info; |
5138 | if (upgrade_fw(adap) >= 0) { | 5126 | struct fw_hdr *card_fw; |
5139 | /* | 5127 | const struct firmware *fw; |
5140 | * Note that the chip was reset as part of the | 5128 | const u8 *fw_data = NULL; |
5141 | * firmware upgrade so we don't reset it again | 5129 | unsigned int fw_size = 0; |
5142 | * below and grab the new firmware version. | 5130 | |
5143 | */ | 5131 | /* This is the firmware whose headers the driver was compiled |
5144 | reset = 0; | 5132 | * against |
5145 | ret = t4_check_fw_version(adap); | 5133 | */ |
5146 | } else | 5134 | fw_info = find_fw_info(CHELSIO_CHIP_VERSION(adap->params.chip)); |
5147 | if (ret == -EFAULT) { | 5135 | if (fw_info == NULL) { |
5148 | /* | 5136 | dev_err(adap->pdev_dev, |
5149 | * Firmware is old but still might | 5137 | "unable to get firmware info for chip %d.\n", |
5150 | * work if we force reinitialization | 5138 | CHELSIO_CHIP_VERSION(adap->params.chip)); |
5151 | * of the adapter. Ignoring FW upgrade | 5139 | return -EINVAL; |
5152 | * failure. | ||
5153 | */ | ||
5154 | dev_warn(adap->pdev_dev, | ||
5155 | "Ignoring firmware upgrade " | ||
5156 | "failure, and forcing driver " | ||
5157 | "to reinitialize the " | ||
5158 | "adapter.\n"); | ||
5159 | ret = 0; | ||
5160 | } | ||
5161 | } | 5140 | } |
5141 | |||
5142 | /* allocate memory to read the header of the firmware on the | ||
5143 | * card | ||
5144 | */ | ||
5145 | card_fw = t4_alloc_mem(sizeof(*card_fw)); | ||
5146 | |||
5147 | /* Get FW from from /lib/firmware/ */ | ||
5148 | ret = request_firmware(&fw, fw_info->fw_mod_name, | ||
5149 | adap->pdev_dev); | ||
5150 | if (ret < 0) { | ||
5151 | dev_err(adap->pdev_dev, | ||
5152 | "unable to load firmware image %s, error %d\n", | ||
5153 | fw_info->fw_mod_name, ret); | ||
5154 | } else { | ||
5155 | fw_data = fw->data; | ||
5156 | fw_size = fw->size; | ||
5157 | } | ||
5158 | |||
5159 | /* upgrade FW logic */ | ||
5160 | ret = t4_prep_fw(adap, fw_info, fw_data, fw_size, card_fw, | ||
5161 | state, &reset); | ||
5162 | |||
5163 | /* Cleaning up */ | ||
5164 | if (fw != NULL) | ||
5165 | release_firmware(fw); | ||
5166 | t4_free_mem(card_fw); | ||
5167 | |||
5162 | if (ret < 0) | 5168 | if (ret < 0) |
5163 | return ret; | 5169 | goto bye; |
5164 | } | 5170 | } |
5165 | 5171 | ||
5166 | /* | 5172 | /* |
@@ -5245,7 +5251,7 @@ static int adap_init0(struct adapter *adap) | |||
5245 | if (ret == -ENOENT) { | 5251 | if (ret == -ENOENT) { |
5246 | dev_info(adap->pdev_dev, | 5252 | dev_info(adap->pdev_dev, |
5247 | "No Configuration File present " | 5253 | "No Configuration File present " |
5248 | "on adapter. Using hard-wired " | 5254 | "on adapter. Using hard-wired " |
5249 | "configuration parameters.\n"); | 5255 | "configuration parameters.\n"); |
5250 | ret = adap_init0_no_config(adap, reset); | 5256 | ret = adap_init0_no_config(adap, reset); |
5251 | } | 5257 | } |
@@ -5787,7 +5793,7 @@ static void print_port_info(const struct net_device *dev) | |||
5787 | 5793 | ||
5788 | netdev_info(dev, "Chelsio %s rev %d %s %sNIC PCIe x%d%s%s\n", | 5794 | netdev_info(dev, "Chelsio %s rev %d %s %sNIC PCIe x%d%s%s\n", |
5789 | adap->params.vpd.id, | 5795 | adap->params.vpd.id, |
5790 | CHELSIO_CHIP_RELEASE(adap->params.rev), buf, | 5796 | CHELSIO_CHIP_RELEASE(adap->params.chip), buf, |
5791 | is_offload(adap) ? "R" : "", adap->params.pci.width, spd, | 5797 | is_offload(adap) ? "R" : "", adap->params.pci.width, spd, |
5792 | (adap->flags & USING_MSIX) ? " MSI-X" : | 5798 | (adap->flags & USING_MSIX) ? " MSI-X" : |
5793 | (adap->flags & USING_MSI) ? " MSI" : ""); | 5799 | (adap->flags & USING_MSI) ? " MSI" : ""); |
@@ -5910,7 +5916,7 @@ static int init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
5910 | if (err) | 5916 | if (err) |
5911 | goto out_unmap_bar0; | 5917 | goto out_unmap_bar0; |
5912 | 5918 | ||
5913 | if (!is_t4(adapter->chip)) { | 5919 | if (!is_t4(adapter->params.chip)) { |
5914 | s_qpp = QUEUESPERPAGEPF1 * adapter->fn; | 5920 | s_qpp = QUEUESPERPAGEPF1 * adapter->fn; |
5915 | qpp = 1 << QUEUESPERPAGEPF0_GET(t4_read_reg(adapter, | 5921 | qpp = 1 << QUEUESPERPAGEPF0_GET(t4_read_reg(adapter, |
5916 | SGE_EGRESS_QUEUES_PER_PAGE_PF) >> s_qpp); | 5922 | SGE_EGRESS_QUEUES_PER_PAGE_PF) >> s_qpp); |
@@ -6064,7 +6070,7 @@ sriov: | |||
6064 | out_free_dev: | 6070 | out_free_dev: |
6065 | free_some_resources(adapter); | 6071 | free_some_resources(adapter); |
6066 | out_unmap_bar: | 6072 | out_unmap_bar: |
6067 | if (!is_t4(adapter->chip)) | 6073 | if (!is_t4(adapter->params.chip)) |
6068 | iounmap(adapter->bar2); | 6074 | iounmap(adapter->bar2); |
6069 | out_unmap_bar0: | 6075 | out_unmap_bar0: |
6070 | iounmap(adapter->regs); | 6076 | iounmap(adapter->regs); |
@@ -6116,7 +6122,7 @@ static void remove_one(struct pci_dev *pdev) | |||
6116 | 6122 | ||
6117 | free_some_resources(adapter); | 6123 | free_some_resources(adapter); |
6118 | iounmap(adapter->regs); | 6124 | iounmap(adapter->regs); |
6119 | if (!is_t4(adapter->chip)) | 6125 | if (!is_t4(adapter->params.chip)) |
6120 | iounmap(adapter->bar2); | 6126 | iounmap(adapter->bar2); |
6121 | kfree(adapter); | 6127 | kfree(adapter); |
6122 | pci_disable_pcie_error_reporting(pdev); | 6128 | pci_disable_pcie_error_reporting(pdev); |
diff --git a/drivers/net/ethernet/chelsio/cxgb4/sge.c b/drivers/net/ethernet/chelsio/cxgb4/sge.c index ac311f5f3eb9..cc380c36e1a8 100644 --- a/drivers/net/ethernet/chelsio/cxgb4/sge.c +++ b/drivers/net/ethernet/chelsio/cxgb4/sge.c | |||
@@ -509,7 +509,7 @@ static inline void ring_fl_db(struct adapter *adap, struct sge_fl *q) | |||
509 | u32 val; | 509 | u32 val; |
510 | if (q->pend_cred >= 8) { | 510 | if (q->pend_cred >= 8) { |
511 | val = PIDX(q->pend_cred / 8); | 511 | val = PIDX(q->pend_cred / 8); |
512 | if (!is_t4(adap->chip)) | 512 | if (!is_t4(adap->params.chip)) |
513 | val |= DBTYPE(1); | 513 | val |= DBTYPE(1); |
514 | wmb(); | 514 | wmb(); |
515 | t4_write_reg(adap, MYPF_REG(SGE_PF_KDOORBELL), DBPRIO(1) | | 515 | t4_write_reg(adap, MYPF_REG(SGE_PF_KDOORBELL), DBPRIO(1) | |
@@ -847,7 +847,7 @@ static inline void ring_tx_db(struct adapter *adap, struct sge_txq *q, int n) | |||
847 | wmb(); /* write descriptors before telling HW */ | 847 | wmb(); /* write descriptors before telling HW */ |
848 | spin_lock(&q->db_lock); | 848 | spin_lock(&q->db_lock); |
849 | if (!q->db_disabled) { | 849 | if (!q->db_disabled) { |
850 | if (is_t4(adap->chip)) { | 850 | if (is_t4(adap->params.chip)) { |
851 | t4_write_reg(adap, MYPF_REG(SGE_PF_KDOORBELL), | 851 | t4_write_reg(adap, MYPF_REG(SGE_PF_KDOORBELL), |
852 | QID(q->cntxt_id) | PIDX(n)); | 852 | QID(q->cntxt_id) | PIDX(n)); |
853 | } else { | 853 | } else { |
@@ -1596,7 +1596,7 @@ static noinline int handle_trace_pkt(struct adapter *adap, | |||
1596 | return 0; | 1596 | return 0; |
1597 | } | 1597 | } |
1598 | 1598 | ||
1599 | if (is_t4(adap->chip)) | 1599 | if (is_t4(adap->params.chip)) |
1600 | __skb_pull(skb, sizeof(struct cpl_trace_pkt)); | 1600 | __skb_pull(skb, sizeof(struct cpl_trace_pkt)); |
1601 | else | 1601 | else |
1602 | __skb_pull(skb, sizeof(struct cpl_t5_trace_pkt)); | 1602 | __skb_pull(skb, sizeof(struct cpl_t5_trace_pkt)); |
@@ -1661,7 +1661,7 @@ int t4_ethrx_handler(struct sge_rspq *q, const __be64 *rsp, | |||
1661 | const struct cpl_rx_pkt *pkt; | 1661 | const struct cpl_rx_pkt *pkt; |
1662 | struct sge_eth_rxq *rxq = container_of(q, struct sge_eth_rxq, rspq); | 1662 | struct sge_eth_rxq *rxq = container_of(q, struct sge_eth_rxq, rspq); |
1663 | struct sge *s = &q->adap->sge; | 1663 | struct sge *s = &q->adap->sge; |
1664 | int cpl_trace_pkt = is_t4(q->adap->chip) ? | 1664 | int cpl_trace_pkt = is_t4(q->adap->params.chip) ? |
1665 | CPL_TRACE_PKT : CPL_TRACE_PKT_T5; | 1665 | CPL_TRACE_PKT : CPL_TRACE_PKT_T5; |
1666 | 1666 | ||
1667 | if (unlikely(*(u8 *)rsp == cpl_trace_pkt)) | 1667 | if (unlikely(*(u8 *)rsp == cpl_trace_pkt)) |
@@ -2182,7 +2182,7 @@ err: | |||
2182 | static void init_txq(struct adapter *adap, struct sge_txq *q, unsigned int id) | 2182 | static void init_txq(struct adapter *adap, struct sge_txq *q, unsigned int id) |
2183 | { | 2183 | { |
2184 | q->cntxt_id = id; | 2184 | q->cntxt_id = id; |
2185 | if (!is_t4(adap->chip)) { | 2185 | if (!is_t4(adap->params.chip)) { |
2186 | unsigned int s_qpp; | 2186 | unsigned int s_qpp; |
2187 | unsigned short udb_density; | 2187 | unsigned short udb_density; |
2188 | unsigned long qpshift; | 2188 | unsigned long qpshift; |
@@ -2641,7 +2641,7 @@ static int t4_sge_init_hard(struct adapter *adap) | |||
2641 | * Set up to drop DOORBELL writes when the DOORBELL FIFO overflows | 2641 | * Set up to drop DOORBELL writes when the DOORBELL FIFO overflows |
2642 | * and generate an interrupt when this occurs so we can recover. | 2642 | * and generate an interrupt when this occurs so we can recover. |
2643 | */ | 2643 | */ |
2644 | if (is_t4(adap->chip)) { | 2644 | if (is_t4(adap->params.chip)) { |
2645 | t4_set_reg_field(adap, A_SGE_DBFIFO_STATUS, | 2645 | t4_set_reg_field(adap, A_SGE_DBFIFO_STATUS, |
2646 | V_HP_INT_THRESH(M_HP_INT_THRESH) | | 2646 | V_HP_INT_THRESH(M_HP_INT_THRESH) | |
2647 | V_LP_INT_THRESH(M_LP_INT_THRESH), | 2647 | V_LP_INT_THRESH(M_LP_INT_THRESH), |
diff --git a/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c b/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c index 4cbb2f9850be..74a6fce5a15a 100644 --- a/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c +++ b/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c | |||
@@ -296,7 +296,7 @@ int t4_mc_read(struct adapter *adap, int idx, u32 addr, __be32 *data, u64 *ecc) | |||
296 | u32 mc_bist_cmd, mc_bist_cmd_addr, mc_bist_cmd_len; | 296 | u32 mc_bist_cmd, mc_bist_cmd_addr, mc_bist_cmd_len; |
297 | u32 mc_bist_status_rdata, mc_bist_data_pattern; | 297 | u32 mc_bist_status_rdata, mc_bist_data_pattern; |
298 | 298 | ||
299 | if (is_t4(adap->chip)) { | 299 | if (is_t4(adap->params.chip)) { |
300 | mc_bist_cmd = MC_BIST_CMD; | 300 | mc_bist_cmd = MC_BIST_CMD; |
301 | mc_bist_cmd_addr = MC_BIST_CMD_ADDR; | 301 | mc_bist_cmd_addr = MC_BIST_CMD_ADDR; |
302 | mc_bist_cmd_len = MC_BIST_CMD_LEN; | 302 | mc_bist_cmd_len = MC_BIST_CMD_LEN; |
@@ -349,7 +349,7 @@ int t4_edc_read(struct adapter *adap, int idx, u32 addr, __be32 *data, u64 *ecc) | |||
349 | u32 edc_bist_cmd, edc_bist_cmd_addr, edc_bist_cmd_len; | 349 | u32 edc_bist_cmd, edc_bist_cmd_addr, edc_bist_cmd_len; |
350 | u32 edc_bist_cmd_data_pattern, edc_bist_status_rdata; | 350 | u32 edc_bist_cmd_data_pattern, edc_bist_status_rdata; |
351 | 351 | ||
352 | if (is_t4(adap->chip)) { | 352 | if (is_t4(adap->params.chip)) { |
353 | edc_bist_cmd = EDC_REG(EDC_BIST_CMD, idx); | 353 | edc_bist_cmd = EDC_REG(EDC_BIST_CMD, idx); |
354 | edc_bist_cmd_addr = EDC_REG(EDC_BIST_CMD_ADDR, idx); | 354 | edc_bist_cmd_addr = EDC_REG(EDC_BIST_CMD_ADDR, idx); |
355 | edc_bist_cmd_len = EDC_REG(EDC_BIST_CMD_LEN, idx); | 355 | edc_bist_cmd_len = EDC_REG(EDC_BIST_CMD_LEN, idx); |
@@ -402,7 +402,7 @@ int t4_edc_read(struct adapter *adap, int idx, u32 addr, __be32 *data, u64 *ecc) | |||
402 | static int t4_mem_win_rw(struct adapter *adap, u32 addr, __be32 *data, int dir) | 402 | static int t4_mem_win_rw(struct adapter *adap, u32 addr, __be32 *data, int dir) |
403 | { | 403 | { |
404 | int i; | 404 | int i; |
405 | u32 win_pf = is_t4(adap->chip) ? 0 : V_PFNUM(adap->fn); | 405 | u32 win_pf = is_t4(adap->params.chip) ? 0 : V_PFNUM(adap->fn); |
406 | 406 | ||
407 | /* | 407 | /* |
408 | * Setup offset into PCIE memory window. Address must be a | 408 | * Setup offset into PCIE memory window. Address must be a |
@@ -863,104 +863,169 @@ unlock: | |||
863 | } | 863 | } |
864 | 864 | ||
865 | /** | 865 | /** |
866 | * get_fw_version - read the firmware version | 866 | * t4_get_fw_version - read the firmware version |
867 | * @adapter: the adapter | 867 | * @adapter: the adapter |
868 | * @vers: where to place the version | 868 | * @vers: where to place the version |
869 | * | 869 | * |
870 | * Reads the FW version from flash. | 870 | * Reads the FW version from flash. |
871 | */ | 871 | */ |
872 | static int get_fw_version(struct adapter *adapter, u32 *vers) | 872 | int t4_get_fw_version(struct adapter *adapter, u32 *vers) |
873 | { | 873 | { |
874 | return t4_read_flash(adapter, adapter->params.sf_fw_start + | 874 | return t4_read_flash(adapter, FLASH_FW_START + |
875 | offsetof(struct fw_hdr, fw_ver), 1, vers, 0); | 875 | offsetof(struct fw_hdr, fw_ver), 1, |
876 | vers, 0); | ||
876 | } | 877 | } |
877 | 878 | ||
878 | /** | 879 | /** |
879 | * get_tp_version - read the TP microcode version | 880 | * t4_get_tp_version - read the TP microcode version |
880 | * @adapter: the adapter | 881 | * @adapter: the adapter |
881 | * @vers: where to place the version | 882 | * @vers: where to place the version |
882 | * | 883 | * |
883 | * Reads the TP microcode version from flash. | 884 | * Reads the TP microcode version from flash. |
884 | */ | 885 | */ |
885 | static int get_tp_version(struct adapter *adapter, u32 *vers) | 886 | int t4_get_tp_version(struct adapter *adapter, u32 *vers) |
886 | { | 887 | { |
887 | return t4_read_flash(adapter, adapter->params.sf_fw_start + | 888 | return t4_read_flash(adapter, FLASH_FW_START + |
888 | offsetof(struct fw_hdr, tp_microcode_ver), | 889 | offsetof(struct fw_hdr, tp_microcode_ver), |
889 | 1, vers, 0); | 890 | 1, vers, 0); |
890 | } | 891 | } |
891 | 892 | ||
892 | /** | 893 | /* Is the given firmware API compatible with the one the driver was compiled |
893 | * t4_check_fw_version - check if the FW is compatible with this driver | 894 | * with? |
894 | * @adapter: the adapter | ||
895 | * | ||
896 | * Checks if an adapter's FW is compatible with the driver. Returns 0 | ||
897 | * if there's exact match, a negative error if the version could not be | ||
898 | * read or there's a major version mismatch, and a positive value if the | ||
899 | * expected major version is found but there's a minor version mismatch. | ||
900 | */ | 895 | */ |
901 | int t4_check_fw_version(struct adapter *adapter) | 896 | static int fw_compatible(const struct fw_hdr *hdr1, const struct fw_hdr *hdr2) |
902 | { | 897 | { |
903 | u32 api_vers[2]; | ||
904 | int ret, major, minor, micro; | ||
905 | int exp_major, exp_minor, exp_micro; | ||
906 | 898 | ||
907 | ret = get_fw_version(adapter, &adapter->params.fw_vers); | 899 | /* short circuit if it's the exact same firmware version */ |
908 | if (!ret) | 900 | if (hdr1->chip == hdr2->chip && hdr1->fw_ver == hdr2->fw_ver) |
909 | ret = get_tp_version(adapter, &adapter->params.tp_vers); | 901 | return 1; |
910 | if (!ret) | ||
911 | ret = t4_read_flash(adapter, adapter->params.sf_fw_start + | ||
912 | offsetof(struct fw_hdr, intfver_nic), | ||
913 | 2, api_vers, 1); | ||
914 | if (ret) | ||
915 | return ret; | ||
916 | 902 | ||
917 | major = FW_HDR_FW_VER_MAJOR_GET(adapter->params.fw_vers); | 903 | #define SAME_INTF(x) (hdr1->intfver_##x == hdr2->intfver_##x) |
918 | minor = FW_HDR_FW_VER_MINOR_GET(adapter->params.fw_vers); | 904 | if (hdr1->chip == hdr2->chip && SAME_INTF(nic) && SAME_INTF(vnic) && |
919 | micro = FW_HDR_FW_VER_MICRO_GET(adapter->params.fw_vers); | 905 | SAME_INTF(ri) && SAME_INTF(iscsi) && SAME_INTF(fcoe)) |
906 | return 1; | ||
907 | #undef SAME_INTF | ||
920 | 908 | ||
921 | switch (CHELSIO_CHIP_VERSION(adapter->chip)) { | 909 | return 0; |
922 | case CHELSIO_T4: | 910 | } |
923 | exp_major = FW_VERSION_MAJOR; | ||
924 | exp_minor = FW_VERSION_MINOR; | ||
925 | exp_micro = FW_VERSION_MICRO; | ||
926 | break; | ||
927 | case CHELSIO_T5: | ||
928 | exp_major = FW_VERSION_MAJOR_T5; | ||
929 | exp_minor = FW_VERSION_MINOR_T5; | ||
930 | exp_micro = FW_VERSION_MICRO_T5; | ||
931 | break; | ||
932 | default: | ||
933 | dev_err(adapter->pdev_dev, "Unsupported chip type, %x\n", | ||
934 | adapter->chip); | ||
935 | return -EINVAL; | ||
936 | } | ||
937 | 911 | ||
938 | memcpy(adapter->params.api_vers, api_vers, | 912 | /* The firmware in the filesystem is usable, but should it be installed? |
939 | sizeof(adapter->params.api_vers)); | 913 | * This routine explains itself in detail if it indicates the filesystem |
914 | * firmware should be installed. | ||
915 | */ | ||
916 | static int should_install_fs_fw(struct adapter *adap, int card_fw_usable, | ||
917 | int k, int c) | ||
918 | { | ||
919 | const char *reason; | ||
940 | 920 | ||
941 | if (major < exp_major || (major == exp_major && minor < exp_minor) || | 921 | if (!card_fw_usable) { |
942 | (major == exp_major && minor == exp_minor && micro < exp_micro)) { | 922 | reason = "incompatible or unusable"; |
943 | dev_err(adapter->pdev_dev, | 923 | goto install; |
944 | "Card has firmware version %u.%u.%u, minimum " | ||
945 | "supported firmware is %u.%u.%u.\n", major, minor, | ||
946 | micro, exp_major, exp_minor, exp_micro); | ||
947 | return -EFAULT; | ||
948 | } | 924 | } |
949 | 925 | ||
950 | if (major != exp_major) { /* major mismatch - fail */ | 926 | if (k > c) { |
951 | dev_err(adapter->pdev_dev, | 927 | reason = "older than the version supported with this driver"; |
952 | "card FW has major version %u, driver wants %u\n", | 928 | goto install; |
953 | major, exp_major); | ||
954 | return -EINVAL; | ||
955 | } | 929 | } |
956 | 930 | ||
957 | if (minor == exp_minor && micro == exp_micro) | 931 | return 0; |
958 | return 0; /* perfect match */ | 932 | |
933 | install: | ||
934 | dev_err(adap->pdev_dev, "firmware on card (%u.%u.%u.%u) is %s, " | ||
935 | "installing firmware %u.%u.%u.%u on card.\n", | ||
936 | FW_HDR_FW_VER_MAJOR_GET(c), FW_HDR_FW_VER_MINOR_GET(c), | ||
937 | FW_HDR_FW_VER_MICRO_GET(c), FW_HDR_FW_VER_BUILD_GET(c), reason, | ||
938 | FW_HDR_FW_VER_MAJOR_GET(k), FW_HDR_FW_VER_MINOR_GET(k), | ||
939 | FW_HDR_FW_VER_MICRO_GET(k), FW_HDR_FW_VER_BUILD_GET(k)); | ||
959 | 940 | ||
960 | /* Minor/micro version mismatch. Report it but often it's OK. */ | ||
961 | return 1; | 941 | return 1; |
962 | } | 942 | } |
963 | 943 | ||
944 | int t4_prep_fw(struct adapter *adap, struct fw_info *fw_info, | ||
945 | const u8 *fw_data, unsigned int fw_size, | ||
946 | struct fw_hdr *card_fw, enum dev_state state, | ||
947 | int *reset) | ||
948 | { | ||
949 | int ret, card_fw_usable, fs_fw_usable; | ||
950 | const struct fw_hdr *fs_fw; | ||
951 | const struct fw_hdr *drv_fw; | ||
952 | |||
953 | drv_fw = &fw_info->fw_hdr; | ||
954 | |||
955 | /* Read the header of the firmware on the card */ | ||
956 | ret = -t4_read_flash(adap, FLASH_FW_START, | ||
957 | sizeof(*card_fw) / sizeof(uint32_t), | ||
958 | (uint32_t *)card_fw, 1); | ||
959 | if (ret == 0) { | ||
960 | card_fw_usable = fw_compatible(drv_fw, (const void *)card_fw); | ||
961 | } else { | ||
962 | dev_err(adap->pdev_dev, | ||
963 | "Unable to read card's firmware header: %d\n", ret); | ||
964 | card_fw_usable = 0; | ||
965 | } | ||
966 | |||
967 | if (fw_data != NULL) { | ||
968 | fs_fw = (const void *)fw_data; | ||
969 | fs_fw_usable = fw_compatible(drv_fw, fs_fw); | ||
970 | } else { | ||
971 | fs_fw = NULL; | ||
972 | fs_fw_usable = 0; | ||
973 | } | ||
974 | |||
975 | if (card_fw_usable && card_fw->fw_ver == drv_fw->fw_ver && | ||
976 | (!fs_fw_usable || fs_fw->fw_ver == drv_fw->fw_ver)) { | ||
977 | /* Common case: the firmware on the card is an exact match and | ||
978 | * the filesystem one is an exact match too, or the filesystem | ||
979 | * one is absent/incompatible. | ||
980 | */ | ||
981 | } else if (fs_fw_usable && state == DEV_STATE_UNINIT && | ||
982 | should_install_fs_fw(adap, card_fw_usable, | ||
983 | be32_to_cpu(fs_fw->fw_ver), | ||
984 | be32_to_cpu(card_fw->fw_ver))) { | ||
985 | ret = -t4_fw_upgrade(adap, adap->mbox, fw_data, | ||
986 | fw_size, 0); | ||
987 | if (ret != 0) { | ||
988 | dev_err(adap->pdev_dev, | ||
989 | "failed to install firmware: %d\n", ret); | ||
990 | goto bye; | ||
991 | } | ||
992 | |||
993 | /* Installed successfully, update the cached header too. */ | ||
994 | memcpy(card_fw, fs_fw, sizeof(*card_fw)); | ||
995 | card_fw_usable = 1; | ||
996 | *reset = 0; /* already reset as part of load_fw */ | ||
997 | } | ||
998 | |||
999 | if (!card_fw_usable) { | ||
1000 | uint32_t d, c, k; | ||
1001 | |||
1002 | d = be32_to_cpu(drv_fw->fw_ver); | ||
1003 | c = be32_to_cpu(card_fw->fw_ver); | ||
1004 | k = fs_fw ? be32_to_cpu(fs_fw->fw_ver) : 0; | ||
1005 | |||
1006 | dev_err(adap->pdev_dev, "Cannot find a usable firmware: " | ||
1007 | "chip state %d, " | ||
1008 | "driver compiled with %d.%d.%d.%d, " | ||
1009 | "card has %d.%d.%d.%d, filesystem has %d.%d.%d.%d\n", | ||
1010 | state, | ||
1011 | FW_HDR_FW_VER_MAJOR_GET(d), FW_HDR_FW_VER_MINOR_GET(d), | ||
1012 | FW_HDR_FW_VER_MICRO_GET(d), FW_HDR_FW_VER_BUILD_GET(d), | ||
1013 | FW_HDR_FW_VER_MAJOR_GET(c), FW_HDR_FW_VER_MINOR_GET(c), | ||
1014 | FW_HDR_FW_VER_MICRO_GET(c), FW_HDR_FW_VER_BUILD_GET(c), | ||
1015 | FW_HDR_FW_VER_MAJOR_GET(k), FW_HDR_FW_VER_MINOR_GET(k), | ||
1016 | FW_HDR_FW_VER_MICRO_GET(k), FW_HDR_FW_VER_BUILD_GET(k)); | ||
1017 | ret = EINVAL; | ||
1018 | goto bye; | ||
1019 | } | ||
1020 | |||
1021 | /* We're using whatever's on the card and it's known to be good. */ | ||
1022 | adap->params.fw_vers = be32_to_cpu(card_fw->fw_ver); | ||
1023 | adap->params.tp_vers = be32_to_cpu(card_fw->tp_microcode_ver); | ||
1024 | |||
1025 | bye: | ||
1026 | return ret; | ||
1027 | } | ||
1028 | |||
964 | /** | 1029 | /** |
965 | * t4_flash_erase_sectors - erase a range of flash sectors | 1030 | * t4_flash_erase_sectors - erase a range of flash sectors |
966 | * @adapter: the adapter | 1031 | * @adapter: the adapter |
@@ -1368,7 +1433,7 @@ static void pcie_intr_handler(struct adapter *adapter) | |||
1368 | PCIE_CORE_UTL_PCI_EXPRESS_PORT_STATUS, | 1433 | PCIE_CORE_UTL_PCI_EXPRESS_PORT_STATUS, |
1369 | pcie_port_intr_info) + | 1434 | pcie_port_intr_info) + |
1370 | t4_handle_intr_status(adapter, PCIE_INT_CAUSE, | 1435 | t4_handle_intr_status(adapter, PCIE_INT_CAUSE, |
1371 | is_t4(adapter->chip) ? | 1436 | is_t4(adapter->params.chip) ? |
1372 | pcie_intr_info : t5_pcie_intr_info); | 1437 | pcie_intr_info : t5_pcie_intr_info); |
1373 | 1438 | ||
1374 | if (fat) | 1439 | if (fat) |
@@ -1782,7 +1847,7 @@ static void xgmac_intr_handler(struct adapter *adap, int port) | |||
1782 | { | 1847 | { |
1783 | u32 v, int_cause_reg; | 1848 | u32 v, int_cause_reg; |
1784 | 1849 | ||
1785 | if (is_t4(adap->chip)) | 1850 | if (is_t4(adap->params.chip)) |
1786 | int_cause_reg = PORT_REG(port, XGMAC_PORT_INT_CAUSE); | 1851 | int_cause_reg = PORT_REG(port, XGMAC_PORT_INT_CAUSE); |
1787 | else | 1852 | else |
1788 | int_cause_reg = T5_PORT_REG(port, MAC_PORT_INT_CAUSE); | 1853 | int_cause_reg = T5_PORT_REG(port, MAC_PORT_INT_CAUSE); |
@@ -2250,7 +2315,7 @@ void t4_get_port_stats(struct adapter *adap, int idx, struct port_stats *p) | |||
2250 | 2315 | ||
2251 | #define GET_STAT(name) \ | 2316 | #define GET_STAT(name) \ |
2252 | t4_read_reg64(adap, \ | 2317 | t4_read_reg64(adap, \ |
2253 | (is_t4(adap->chip) ? PORT_REG(idx, MPS_PORT_STAT_##name##_L) : \ | 2318 | (is_t4(adap->params.chip) ? PORT_REG(idx, MPS_PORT_STAT_##name##_L) : \ |
2254 | T5_PORT_REG(idx, MPS_PORT_STAT_##name##_L))) | 2319 | T5_PORT_REG(idx, MPS_PORT_STAT_##name##_L))) |
2255 | #define GET_STAT_COM(name) t4_read_reg64(adap, MPS_STAT_##name##_L) | 2320 | #define GET_STAT_COM(name) t4_read_reg64(adap, MPS_STAT_##name##_L) |
2256 | 2321 | ||
@@ -2332,7 +2397,7 @@ void t4_wol_magic_enable(struct adapter *adap, unsigned int port, | |||
2332 | { | 2397 | { |
2333 | u32 mag_id_reg_l, mag_id_reg_h, port_cfg_reg; | 2398 | u32 mag_id_reg_l, mag_id_reg_h, port_cfg_reg; |
2334 | 2399 | ||
2335 | if (is_t4(adap->chip)) { | 2400 | if (is_t4(adap->params.chip)) { |
2336 | mag_id_reg_l = PORT_REG(port, XGMAC_PORT_MAGIC_MACID_LO); | 2401 | mag_id_reg_l = PORT_REG(port, XGMAC_PORT_MAGIC_MACID_LO); |
2337 | mag_id_reg_h = PORT_REG(port, XGMAC_PORT_MAGIC_MACID_HI); | 2402 | mag_id_reg_h = PORT_REG(port, XGMAC_PORT_MAGIC_MACID_HI); |
2338 | port_cfg_reg = PORT_REG(port, XGMAC_PORT_CFG2); | 2403 | port_cfg_reg = PORT_REG(port, XGMAC_PORT_CFG2); |
@@ -2374,7 +2439,7 @@ int t4_wol_pat_enable(struct adapter *adap, unsigned int port, unsigned int map, | |||
2374 | int i; | 2439 | int i; |
2375 | u32 port_cfg_reg; | 2440 | u32 port_cfg_reg; |
2376 | 2441 | ||
2377 | if (is_t4(adap->chip)) | 2442 | if (is_t4(adap->params.chip)) |
2378 | port_cfg_reg = PORT_REG(port, XGMAC_PORT_CFG2); | 2443 | port_cfg_reg = PORT_REG(port, XGMAC_PORT_CFG2); |
2379 | else | 2444 | else |
2380 | port_cfg_reg = T5_PORT_REG(port, MAC_PORT_CFG2); | 2445 | port_cfg_reg = T5_PORT_REG(port, MAC_PORT_CFG2); |
@@ -2387,7 +2452,7 @@ int t4_wol_pat_enable(struct adapter *adap, unsigned int port, unsigned int map, | |||
2387 | return -EINVAL; | 2452 | return -EINVAL; |
2388 | 2453 | ||
2389 | #define EPIO_REG(name) \ | 2454 | #define EPIO_REG(name) \ |
2390 | (is_t4(adap->chip) ? PORT_REG(port, XGMAC_PORT_EPIO_##name) : \ | 2455 | (is_t4(adap->params.chip) ? PORT_REG(port, XGMAC_PORT_EPIO_##name) : \ |
2391 | T5_PORT_REG(port, MAC_PORT_EPIO_##name)) | 2456 | T5_PORT_REG(port, MAC_PORT_EPIO_##name)) |
2392 | 2457 | ||
2393 | t4_write_reg(adap, EPIO_REG(DATA1), mask0 >> 32); | 2458 | t4_write_reg(adap, EPIO_REG(DATA1), mask0 >> 32); |
@@ -2474,7 +2539,7 @@ int t4_fwaddrspace_write(struct adapter *adap, unsigned int mbox, | |||
2474 | int t4_mem_win_read_len(struct adapter *adap, u32 addr, __be32 *data, int len) | 2539 | int t4_mem_win_read_len(struct adapter *adap, u32 addr, __be32 *data, int len) |
2475 | { | 2540 | { |
2476 | int i, off; | 2541 | int i, off; |
2477 | u32 win_pf = is_t4(adap->chip) ? 0 : V_PFNUM(adap->fn); | 2542 | u32 win_pf = is_t4(adap->params.chip) ? 0 : V_PFNUM(adap->fn); |
2478 | 2543 | ||
2479 | /* Align on a 2KB boundary. | 2544 | /* Align on a 2KB boundary. |
2480 | */ | 2545 | */ |
@@ -3306,7 +3371,7 @@ int t4_alloc_mac_filt(struct adapter *adap, unsigned int mbox, | |||
3306 | int i, ret; | 3371 | int i, ret; |
3307 | struct fw_vi_mac_cmd c; | 3372 | struct fw_vi_mac_cmd c; |
3308 | struct fw_vi_mac_exact *p; | 3373 | struct fw_vi_mac_exact *p; |
3309 | unsigned int max_naddr = is_t4(adap->chip) ? | 3374 | unsigned int max_naddr = is_t4(adap->params.chip) ? |
3310 | NUM_MPS_CLS_SRAM_L_INSTANCES : | 3375 | NUM_MPS_CLS_SRAM_L_INSTANCES : |
3311 | NUM_MPS_T5_CLS_SRAM_L_INSTANCES; | 3376 | NUM_MPS_T5_CLS_SRAM_L_INSTANCES; |
3312 | 3377 | ||
@@ -3368,7 +3433,7 @@ int t4_change_mac(struct adapter *adap, unsigned int mbox, unsigned int viid, | |||
3368 | int ret, mode; | 3433 | int ret, mode; |
3369 | struct fw_vi_mac_cmd c; | 3434 | struct fw_vi_mac_cmd c; |
3370 | struct fw_vi_mac_exact *p = c.u.exact; | 3435 | struct fw_vi_mac_exact *p = c.u.exact; |
3371 | unsigned int max_mac_addr = is_t4(adap->chip) ? | 3436 | unsigned int max_mac_addr = is_t4(adap->params.chip) ? |
3372 | NUM_MPS_CLS_SRAM_L_INSTANCES : | 3437 | NUM_MPS_CLS_SRAM_L_INSTANCES : |
3373 | NUM_MPS_T5_CLS_SRAM_L_INSTANCES; | 3438 | NUM_MPS_T5_CLS_SRAM_L_INSTANCES; |
3374 | 3439 | ||
@@ -3699,13 +3764,14 @@ int t4_prep_adapter(struct adapter *adapter) | |||
3699 | { | 3764 | { |
3700 | int ret, ver; | 3765 | int ret, ver; |
3701 | uint16_t device_id; | 3766 | uint16_t device_id; |
3767 | u32 pl_rev; | ||
3702 | 3768 | ||
3703 | ret = t4_wait_dev_ready(adapter); | 3769 | ret = t4_wait_dev_ready(adapter); |
3704 | if (ret < 0) | 3770 | if (ret < 0) |
3705 | return ret; | 3771 | return ret; |
3706 | 3772 | ||
3707 | get_pci_mode(adapter, &adapter->params.pci); | 3773 | get_pci_mode(adapter, &adapter->params.pci); |
3708 | adapter->params.rev = t4_read_reg(adapter, PL_REV); | 3774 | pl_rev = G_REV(t4_read_reg(adapter, PL_REV)); |
3709 | 3775 | ||
3710 | ret = get_flash_params(adapter); | 3776 | ret = get_flash_params(adapter); |
3711 | if (ret < 0) { | 3777 | if (ret < 0) { |
@@ -3717,14 +3783,13 @@ int t4_prep_adapter(struct adapter *adapter) | |||
3717 | */ | 3783 | */ |
3718 | pci_read_config_word(adapter->pdev, PCI_DEVICE_ID, &device_id); | 3784 | pci_read_config_word(adapter->pdev, PCI_DEVICE_ID, &device_id); |
3719 | ver = device_id >> 12; | 3785 | ver = device_id >> 12; |
3786 | adapter->params.chip = 0; | ||
3720 | switch (ver) { | 3787 | switch (ver) { |
3721 | case CHELSIO_T4: | 3788 | case CHELSIO_T4: |
3722 | adapter->chip = CHELSIO_CHIP_CODE(CHELSIO_T4, | 3789 | adapter->params.chip |= CHELSIO_CHIP_CODE(CHELSIO_T4, pl_rev); |
3723 | adapter->params.rev); | ||
3724 | break; | 3790 | break; |
3725 | case CHELSIO_T5: | 3791 | case CHELSIO_T5: |
3726 | adapter->chip = CHELSIO_CHIP_CODE(CHELSIO_T5, | 3792 | adapter->params.chip |= CHELSIO_CHIP_CODE(CHELSIO_T5, pl_rev); |
3727 | adapter->params.rev); | ||
3728 | break; | 3793 | break; |
3729 | default: | 3794 | default: |
3730 | dev_err(adapter->pdev_dev, "Device %d is not supported\n", | 3795 | dev_err(adapter->pdev_dev, "Device %d is not supported\n", |
@@ -3732,9 +3797,6 @@ int t4_prep_adapter(struct adapter *adapter) | |||
3732 | return -EINVAL; | 3797 | return -EINVAL; |
3733 | } | 3798 | } |
3734 | 3799 | ||
3735 | /* Reassign the updated revision field */ | ||
3736 | adapter->params.rev = adapter->chip; | ||
3737 | |||
3738 | init_cong_ctrl(adapter->params.a_wnd, adapter->params.b_wnd); | 3800 | init_cong_ctrl(adapter->params.a_wnd, adapter->params.b_wnd); |
3739 | 3801 | ||
3740 | /* | 3802 | /* |
diff --git a/drivers/net/ethernet/chelsio/cxgb4/t4_regs.h b/drivers/net/ethernet/chelsio/cxgb4/t4_regs.h index ef146c0ba481..0a8205d69d2c 100644 --- a/drivers/net/ethernet/chelsio/cxgb4/t4_regs.h +++ b/drivers/net/ethernet/chelsio/cxgb4/t4_regs.h | |||
@@ -1092,6 +1092,11 @@ | |||
1092 | 1092 | ||
1093 | #define PL_REV 0x1943c | 1093 | #define PL_REV 0x1943c |
1094 | 1094 | ||
1095 | #define S_REV 0 | ||
1096 | #define M_REV 0xfU | ||
1097 | #define V_REV(x) ((x) << S_REV) | ||
1098 | #define G_REV(x) (((x) >> S_REV) & M_REV) | ||
1099 | |||
1095 | #define LE_DB_CONFIG 0x19c04 | 1100 | #define LE_DB_CONFIG 0x19c04 |
1096 | #define HASHEN 0x00100000U | 1101 | #define HASHEN 0x00100000U |
1097 | 1102 | ||
@@ -1199,4 +1204,13 @@ | |||
1199 | #define EDC_STRIDE_T5 (EDC_T51_BASE_ADDR - EDC_T50_BASE_ADDR) | 1204 | #define EDC_STRIDE_T5 (EDC_T51_BASE_ADDR - EDC_T50_BASE_ADDR) |
1200 | #define EDC_REG_T5(reg, idx) (reg + EDC_STRIDE_T5 * idx) | 1205 | #define EDC_REG_T5(reg, idx) (reg + EDC_STRIDE_T5 * idx) |
1201 | 1206 | ||
1207 | #define A_PL_VF_REV 0x4 | ||
1208 | #define A_PL_VF_WHOAMI 0x0 | ||
1209 | #define A_PL_VF_REVISION 0x8 | ||
1210 | |||
1211 | #define S_CHIPID 4 | ||
1212 | #define M_CHIPID 0xfU | ||
1213 | #define V_CHIPID(x) ((x) << S_CHIPID) | ||
1214 | #define G_CHIPID(x) (((x) >> S_CHIPID) & M_CHIPID) | ||
1215 | |||
1202 | #endif /* __T4_REGS_H */ | 1216 | #endif /* __T4_REGS_H */ |
diff --git a/drivers/net/ethernet/chelsio/cxgb4/t4fw_api.h b/drivers/net/ethernet/chelsio/cxgb4/t4fw_api.h index 6f77ac487743..74fea74ce0aa 100644 --- a/drivers/net/ethernet/chelsio/cxgb4/t4fw_api.h +++ b/drivers/net/ethernet/chelsio/cxgb4/t4fw_api.h | |||
@@ -2157,7 +2157,7 @@ struct fw_debug_cmd { | |||
2157 | 2157 | ||
2158 | struct fw_hdr { | 2158 | struct fw_hdr { |
2159 | u8 ver; | 2159 | u8 ver; |
2160 | u8 reserved1; | 2160 | u8 chip; /* terminator chip type */ |
2161 | __be16 len512; /* bin length in units of 512-bytes */ | 2161 | __be16 len512; /* bin length in units of 512-bytes */ |
2162 | __be32 fw_ver; /* firmware version */ | 2162 | __be32 fw_ver; /* firmware version */ |
2163 | __be32 tp_microcode_ver; | 2163 | __be32 tp_microcode_ver; |
@@ -2176,6 +2176,11 @@ struct fw_hdr { | |||
2176 | __be32 reserved6[23]; | 2176 | __be32 reserved6[23]; |
2177 | }; | 2177 | }; |
2178 | 2178 | ||
2179 | enum fw_hdr_chip { | ||
2180 | FW_HDR_CHIP_T4, | ||
2181 | FW_HDR_CHIP_T5 | ||
2182 | }; | ||
2183 | |||
2179 | #define FW_HDR_FW_VER_MAJOR_GET(x) (((x) >> 24) & 0xff) | 2184 | #define FW_HDR_FW_VER_MAJOR_GET(x) (((x) >> 24) & 0xff) |
2180 | #define FW_HDR_FW_VER_MINOR_GET(x) (((x) >> 16) & 0xff) | 2185 | #define FW_HDR_FW_VER_MINOR_GET(x) (((x) >> 16) & 0xff) |
2181 | #define FW_HDR_FW_VER_MICRO_GET(x) (((x) >> 8) & 0xff) | 2186 | #define FW_HDR_FW_VER_MICRO_GET(x) (((x) >> 8) & 0xff) |
diff --git a/drivers/net/ethernet/chelsio/cxgb4vf/adapter.h b/drivers/net/ethernet/chelsio/cxgb4vf/adapter.h index be5c7ef6ca93..68eaa9c88c7d 100644 --- a/drivers/net/ethernet/chelsio/cxgb4vf/adapter.h +++ b/drivers/net/ethernet/chelsio/cxgb4vf/adapter.h | |||
@@ -344,7 +344,6 @@ struct adapter { | |||
344 | unsigned long registered_device_map; | 344 | unsigned long registered_device_map; |
345 | unsigned long open_device_map; | 345 | unsigned long open_device_map; |
346 | unsigned long flags; | 346 | unsigned long flags; |
347 | enum chip_type chip; | ||
348 | struct adapter_params params; | 347 | struct adapter_params params; |
349 | 348 | ||
350 | /* queue and interrupt resources */ | 349 | /* queue and interrupt resources */ |
diff --git a/drivers/net/ethernet/chelsio/cxgb4vf/cxgb4vf_main.c b/drivers/net/ethernet/chelsio/cxgb4vf/cxgb4vf_main.c index 5f90ec5f7519..0899c0983594 100644 --- a/drivers/net/ethernet/chelsio/cxgb4vf/cxgb4vf_main.c +++ b/drivers/net/ethernet/chelsio/cxgb4vf/cxgb4vf_main.c | |||
@@ -1064,7 +1064,7 @@ static inline unsigned int mk_adap_vers(const struct adapter *adapter) | |||
1064 | /* | 1064 | /* |
1065 | * Chip version 4, revision 0x3f (cxgb4vf). | 1065 | * Chip version 4, revision 0x3f (cxgb4vf). |
1066 | */ | 1066 | */ |
1067 | return CHELSIO_CHIP_VERSION(adapter->chip) | (0x3f << 10); | 1067 | return CHELSIO_CHIP_VERSION(adapter->params.chip) | (0x3f << 10); |
1068 | } | 1068 | } |
1069 | 1069 | ||
1070 | /* | 1070 | /* |
@@ -1551,9 +1551,13 @@ static void cxgb4vf_get_regs(struct net_device *dev, | |||
1551 | reg_block_dump(adapter, regbuf, | 1551 | reg_block_dump(adapter, regbuf, |
1552 | T4VF_MPS_BASE_ADDR + T4VF_MOD_MAP_MPS_FIRST, | 1552 | T4VF_MPS_BASE_ADDR + T4VF_MOD_MAP_MPS_FIRST, |
1553 | T4VF_MPS_BASE_ADDR + T4VF_MOD_MAP_MPS_LAST); | 1553 | T4VF_MPS_BASE_ADDR + T4VF_MOD_MAP_MPS_LAST); |
1554 | |||
1555 | /* T5 adds new registers in the PL Register map. | ||
1556 | */ | ||
1554 | reg_block_dump(adapter, regbuf, | 1557 | reg_block_dump(adapter, regbuf, |
1555 | T4VF_PL_BASE_ADDR + T4VF_MOD_MAP_PL_FIRST, | 1558 | T4VF_PL_BASE_ADDR + T4VF_MOD_MAP_PL_FIRST, |
1556 | T4VF_PL_BASE_ADDR + T4VF_MOD_MAP_PL_LAST); | 1559 | T4VF_PL_BASE_ADDR + (is_t4(adapter->params.chip) |
1560 | ? A_PL_VF_WHOAMI : A_PL_VF_REVISION)); | ||
1557 | reg_block_dump(adapter, regbuf, | 1561 | reg_block_dump(adapter, regbuf, |
1558 | T4VF_CIM_BASE_ADDR + T4VF_MOD_MAP_CIM_FIRST, | 1562 | T4VF_CIM_BASE_ADDR + T4VF_MOD_MAP_CIM_FIRST, |
1559 | T4VF_CIM_BASE_ADDR + T4VF_MOD_MAP_CIM_LAST); | 1563 | T4VF_CIM_BASE_ADDR + T4VF_MOD_MAP_CIM_LAST); |
@@ -2087,6 +2091,7 @@ static int adap_init0(struct adapter *adapter) | |||
2087 | unsigned int ethqsets; | 2091 | unsigned int ethqsets; |
2088 | int err; | 2092 | int err; |
2089 | u32 param, val = 0; | 2093 | u32 param, val = 0; |
2094 | unsigned int chipid; | ||
2090 | 2095 | ||
2091 | /* | 2096 | /* |
2092 | * Wait for the device to become ready before proceeding ... | 2097 | * Wait for the device to become ready before proceeding ... |
@@ -2114,12 +2119,14 @@ static int adap_init0(struct adapter *adapter) | |||
2114 | return err; | 2119 | return err; |
2115 | } | 2120 | } |
2116 | 2121 | ||
2122 | adapter->params.chip = 0; | ||
2117 | switch (adapter->pdev->device >> 12) { | 2123 | switch (adapter->pdev->device >> 12) { |
2118 | case CHELSIO_T4: | 2124 | case CHELSIO_T4: |
2119 | adapter->chip = CHELSIO_CHIP_CODE(CHELSIO_T4, 0); | 2125 | adapter->params.chip = CHELSIO_CHIP_CODE(CHELSIO_T4, 0); |
2120 | break; | 2126 | break; |
2121 | case CHELSIO_T5: | 2127 | case CHELSIO_T5: |
2122 | adapter->chip = CHELSIO_CHIP_CODE(CHELSIO_T5, 0); | 2128 | chipid = G_REV(t4_read_reg(adapter, A_PL_VF_REV)); |
2129 | adapter->params.chip |= CHELSIO_CHIP_CODE(CHELSIO_T5, chipid); | ||
2123 | break; | 2130 | break; |
2124 | } | 2131 | } |
2125 | 2132 | ||
diff --git a/drivers/net/ethernet/chelsio/cxgb4vf/sge.c b/drivers/net/ethernet/chelsio/cxgb4vf/sge.c index 8475c4cda9e4..0a89963c48ce 100644 --- a/drivers/net/ethernet/chelsio/cxgb4vf/sge.c +++ b/drivers/net/ethernet/chelsio/cxgb4vf/sge.c | |||
@@ -537,7 +537,7 @@ static inline void ring_fl_db(struct adapter *adapter, struct sge_fl *fl) | |||
537 | */ | 537 | */ |
538 | if (fl->pend_cred >= FL_PER_EQ_UNIT) { | 538 | if (fl->pend_cred >= FL_PER_EQ_UNIT) { |
539 | val = PIDX(fl->pend_cred / FL_PER_EQ_UNIT); | 539 | val = PIDX(fl->pend_cred / FL_PER_EQ_UNIT); |
540 | if (!is_t4(adapter->chip)) | 540 | if (!is_t4(adapter->params.chip)) |
541 | val |= DBTYPE(1); | 541 | val |= DBTYPE(1); |
542 | wmb(); | 542 | wmb(); |
543 | t4_write_reg(adapter, T4VF_SGE_BASE_ADDR + SGE_VF_KDOORBELL, | 543 | t4_write_reg(adapter, T4VF_SGE_BASE_ADDR + SGE_VF_KDOORBELL, |
diff --git a/drivers/net/ethernet/chelsio/cxgb4vf/t4vf_common.h b/drivers/net/ethernet/chelsio/cxgb4vf/t4vf_common.h index 53cbfed21d0b..61362450d05b 100644 --- a/drivers/net/ethernet/chelsio/cxgb4vf/t4vf_common.h +++ b/drivers/net/ethernet/chelsio/cxgb4vf/t4vf_common.h | |||
@@ -39,21 +39,28 @@ | |||
39 | #include "../cxgb4/t4fw_api.h" | 39 | #include "../cxgb4/t4fw_api.h" |
40 | 40 | ||
41 | #define CHELSIO_CHIP_CODE(version, revision) (((version) << 4) | (revision)) | 41 | #define CHELSIO_CHIP_CODE(version, revision) (((version) << 4) | (revision)) |
42 | #define CHELSIO_CHIP_VERSION(code) ((code) >> 4) | 42 | #define CHELSIO_CHIP_VERSION(code) (((code) >> 4) & 0xf) |
43 | #define CHELSIO_CHIP_RELEASE(code) ((code) & 0xf) | 43 | #define CHELSIO_CHIP_RELEASE(code) ((code) & 0xf) |
44 | 44 | ||
45 | /* All T4 and later chips have their PCI-E Device IDs encoded as 0xVFPP where: | ||
46 | * | ||
47 | * V = "4" for T4; "5" for T5, etc. or | ||
48 | * = "a" for T4 FPGA; "b" for T4 FPGA, etc. | ||
49 | * F = "0" for PF 0..3; "4".."7" for PF4..7; and "8" for VFs | ||
50 | * PP = adapter product designation | ||
51 | */ | ||
45 | #define CHELSIO_T4 0x4 | 52 | #define CHELSIO_T4 0x4 |
46 | #define CHELSIO_T5 0x5 | 53 | #define CHELSIO_T5 0x5 |
47 | 54 | ||
48 | enum chip_type { | 55 | enum chip_type { |
49 | T4_A1 = CHELSIO_CHIP_CODE(CHELSIO_T4, 0), | 56 | T4_A1 = CHELSIO_CHIP_CODE(CHELSIO_T4, 1), |
50 | T4_A2 = CHELSIO_CHIP_CODE(CHELSIO_T4, 1), | 57 | T4_A2 = CHELSIO_CHIP_CODE(CHELSIO_T4, 2), |
51 | T4_A3 = CHELSIO_CHIP_CODE(CHELSIO_T4, 2), | ||
52 | T4_FIRST_REV = T4_A1, | 58 | T4_FIRST_REV = T4_A1, |
53 | T4_LAST_REV = T4_A3, | 59 | T4_LAST_REV = T4_A2, |
54 | 60 | ||
55 | T5_A1 = CHELSIO_CHIP_CODE(CHELSIO_T5, 0), | 61 | T5_A0 = CHELSIO_CHIP_CODE(CHELSIO_T5, 0), |
56 | T5_FIRST_REV = T5_A1, | 62 | T5_A1 = CHELSIO_CHIP_CODE(CHELSIO_T5, 1), |
63 | T5_FIRST_REV = T5_A0, | ||
57 | T5_LAST_REV = T5_A1, | 64 | T5_LAST_REV = T5_A1, |
58 | }; | 65 | }; |
59 | 66 | ||
@@ -203,6 +210,7 @@ struct adapter_params { | |||
203 | struct vpd_params vpd; /* Vital Product Data */ | 210 | struct vpd_params vpd; /* Vital Product Data */ |
204 | struct rss_params rss; /* Receive Side Scaling */ | 211 | struct rss_params rss; /* Receive Side Scaling */ |
205 | struct vf_resources vfres; /* Virtual Function Resource limits */ | 212 | struct vf_resources vfres; /* Virtual Function Resource limits */ |
213 | enum chip_type chip; /* chip code */ | ||
206 | u8 nports; /* # of Ethernet "ports" */ | 214 | u8 nports; /* # of Ethernet "ports" */ |
207 | }; | 215 | }; |
208 | 216 | ||
@@ -253,7 +261,7 @@ static inline int t4vf_wr_mbox_ns(struct adapter *adapter, const void *cmd, | |||
253 | 261 | ||
254 | static inline int is_t4(enum chip_type chip) | 262 | static inline int is_t4(enum chip_type chip) |
255 | { | 263 | { |
256 | return (chip >= T4_FIRST_REV && chip <= T4_LAST_REV); | 264 | return CHELSIO_CHIP_VERSION(chip) == CHELSIO_T4; |
257 | } | 265 | } |
258 | 266 | ||
259 | int t4vf_wait_dev_ready(struct adapter *); | 267 | int t4vf_wait_dev_ready(struct adapter *); |
diff --git a/drivers/net/ethernet/chelsio/cxgb4vf/t4vf_hw.c b/drivers/net/ethernet/chelsio/cxgb4vf/t4vf_hw.c index 9f96dc3bb112..d958c44341b5 100644 --- a/drivers/net/ethernet/chelsio/cxgb4vf/t4vf_hw.c +++ b/drivers/net/ethernet/chelsio/cxgb4vf/t4vf_hw.c | |||
@@ -1027,7 +1027,7 @@ int t4vf_alloc_mac_filt(struct adapter *adapter, unsigned int viid, bool free, | |||
1027 | unsigned nfilters = 0; | 1027 | unsigned nfilters = 0; |
1028 | unsigned int rem = naddr; | 1028 | unsigned int rem = naddr; |
1029 | struct fw_vi_mac_cmd cmd, rpl; | 1029 | struct fw_vi_mac_cmd cmd, rpl; |
1030 | unsigned int max_naddr = is_t4(adapter->chip) ? | 1030 | unsigned int max_naddr = is_t4(adapter->params.chip) ? |
1031 | NUM_MPS_CLS_SRAM_L_INSTANCES : | 1031 | NUM_MPS_CLS_SRAM_L_INSTANCES : |
1032 | NUM_MPS_T5_CLS_SRAM_L_INSTANCES; | 1032 | NUM_MPS_T5_CLS_SRAM_L_INSTANCES; |
1033 | 1033 | ||
@@ -1121,7 +1121,7 @@ int t4vf_change_mac(struct adapter *adapter, unsigned int viid, | |||
1121 | struct fw_vi_mac_exact *p = &cmd.u.exact[0]; | 1121 | struct fw_vi_mac_exact *p = &cmd.u.exact[0]; |
1122 | size_t len16 = DIV_ROUND_UP(offsetof(struct fw_vi_mac_cmd, | 1122 | size_t len16 = DIV_ROUND_UP(offsetof(struct fw_vi_mac_cmd, |
1123 | u.exact[1]), 16); | 1123 | u.exact[1]), 16); |
1124 | unsigned int max_naddr = is_t4(adapter->chip) ? | 1124 | unsigned int max_naddr = is_t4(adapter->params.chip) ? |
1125 | NUM_MPS_CLS_SRAM_L_INSTANCES : | 1125 | NUM_MPS_CLS_SRAM_L_INSTANCES : |
1126 | NUM_MPS_T5_CLS_SRAM_L_INSTANCES; | 1126 | NUM_MPS_T5_CLS_SRAM_L_INSTANCES; |
1127 | 1127 | ||
diff --git a/drivers/net/ethernet/emulex/benet/be.h b/drivers/net/ethernet/emulex/benet/be.h index f4825db5d179..5878df619b53 100644 --- a/drivers/net/ethernet/emulex/benet/be.h +++ b/drivers/net/ethernet/emulex/benet/be.h | |||
@@ -503,6 +503,7 @@ struct be_adapter { | |||
503 | }; | 503 | }; |
504 | 504 | ||
505 | #define be_physfn(adapter) (!adapter->virtfn) | 505 | #define be_physfn(adapter) (!adapter->virtfn) |
506 | #define be_virtfn(adapter) (adapter->virtfn) | ||
506 | #define sriov_enabled(adapter) (adapter->num_vfs > 0) | 507 | #define sriov_enabled(adapter) (adapter->num_vfs > 0) |
507 | #define sriov_want(adapter) (be_physfn(adapter) && \ | 508 | #define sriov_want(adapter) (be_physfn(adapter) && \ |
508 | (num_vfs || pci_num_vf(adapter->pdev))) | 509 | (num_vfs || pci_num_vf(adapter->pdev))) |
diff --git a/drivers/net/ethernet/emulex/benet/be_cmds.c b/drivers/net/ethernet/emulex/benet/be_cmds.c index dbcd5262c016..e0e8bc1ef14c 100644 --- a/drivers/net/ethernet/emulex/benet/be_cmds.c +++ b/drivers/net/ethernet/emulex/benet/be_cmds.c | |||
@@ -1032,6 +1032,13 @@ int be_cmd_cq_create(struct be_adapter *adapter, struct be_queue_info *cq, | |||
1032 | } else { | 1032 | } else { |
1033 | req->hdr.version = 2; | 1033 | req->hdr.version = 2; |
1034 | req->page_size = 1; /* 1 for 4K */ | 1034 | req->page_size = 1; /* 1 for 4K */ |
1035 | |||
1036 | /* coalesce-wm field in this cmd is not relevant to Lancer. | ||
1037 | * Lancer uses COMMON_MODIFY_CQ to set this field | ||
1038 | */ | ||
1039 | if (!lancer_chip(adapter)) | ||
1040 | AMAP_SET_BITS(struct amap_cq_context_v2, coalescwm, | ||
1041 | ctxt, coalesce_wm); | ||
1035 | AMAP_SET_BITS(struct amap_cq_context_v2, nodelay, ctxt, | 1042 | AMAP_SET_BITS(struct amap_cq_context_v2, nodelay, ctxt, |
1036 | no_delay); | 1043 | no_delay); |
1037 | AMAP_SET_BITS(struct amap_cq_context_v2, count, ctxt, | 1044 | AMAP_SET_BITS(struct amap_cq_context_v2, count, ctxt, |
diff --git a/drivers/net/ethernet/emulex/benet/be_hw.h b/drivers/net/ethernet/emulex/benet/be_hw.h index 3e2162121601..dc88782185f2 100644 --- a/drivers/net/ethernet/emulex/benet/be_hw.h +++ b/drivers/net/ethernet/emulex/benet/be_hw.h | |||
@@ -64,6 +64,9 @@ | |||
64 | #define SLIPORT_ERROR_NO_RESOURCE1 0x2 | 64 | #define SLIPORT_ERROR_NO_RESOURCE1 0x2 |
65 | #define SLIPORT_ERROR_NO_RESOURCE2 0x9 | 65 | #define SLIPORT_ERROR_NO_RESOURCE2 0x9 |
66 | 66 | ||
67 | #define SLIPORT_ERROR_FW_RESET1 0x2 | ||
68 | #define SLIPORT_ERROR_FW_RESET2 0x0 | ||
69 | |||
67 | /********* Memory BAR register ************/ | 70 | /********* Memory BAR register ************/ |
68 | #define PCICFG_MEMBAR_CTRL_INT_CTRL_OFFSET 0xfc | 71 | #define PCICFG_MEMBAR_CTRL_INT_CTRL_OFFSET 0xfc |
69 | /* Host Interrupt Enable, if set interrupts are enabled although "PCI Interrupt | 72 | /* Host Interrupt Enable, if set interrupts are enabled although "PCI Interrupt |
diff --git a/drivers/net/ethernet/emulex/benet/be_main.c b/drivers/net/ethernet/emulex/benet/be_main.c index abde97471636..0fde69d5cb6a 100644 --- a/drivers/net/ethernet/emulex/benet/be_main.c +++ b/drivers/net/ethernet/emulex/benet/be_main.c | |||
@@ -2464,8 +2464,16 @@ void be_detect_error(struct be_adapter *adapter) | |||
2464 | */ | 2464 | */ |
2465 | if (sliport_status & SLIPORT_STATUS_ERR_MASK) { | 2465 | if (sliport_status & SLIPORT_STATUS_ERR_MASK) { |
2466 | adapter->hw_error = true; | 2466 | adapter->hw_error = true; |
2467 | dev_err(&adapter->pdev->dev, | 2467 | /* Do not log error messages if its a FW reset */ |
2468 | "Error detected in the card\n"); | 2468 | if (sliport_err1 == SLIPORT_ERROR_FW_RESET1 && |
2469 | sliport_err2 == SLIPORT_ERROR_FW_RESET2) { | ||
2470 | dev_info(&adapter->pdev->dev, | ||
2471 | "Firmware update in progress\n"); | ||
2472 | return; | ||
2473 | } else { | ||
2474 | dev_err(&adapter->pdev->dev, | ||
2475 | "Error detected in the card\n"); | ||
2476 | } | ||
2469 | } | 2477 | } |
2470 | 2478 | ||
2471 | if (sliport_status & SLIPORT_STATUS_ERR_MASK) { | 2479 | if (sliport_status & SLIPORT_STATUS_ERR_MASK) { |
@@ -2658,8 +2666,8 @@ static int be_close(struct net_device *netdev) | |||
2658 | 2666 | ||
2659 | be_roce_dev_close(adapter); | 2667 | be_roce_dev_close(adapter); |
2660 | 2668 | ||
2661 | for_all_evt_queues(adapter, eqo, i) { | 2669 | if (adapter->flags & BE_FLAGS_NAPI_ENABLED) { |
2662 | if (adapter->flags & BE_FLAGS_NAPI_ENABLED) { | 2670 | for_all_evt_queues(adapter, eqo, i) { |
2663 | napi_disable(&eqo->napi); | 2671 | napi_disable(&eqo->napi); |
2664 | be_disable_busy_poll(eqo); | 2672 | be_disable_busy_poll(eqo); |
2665 | } | 2673 | } |
@@ -2932,28 +2940,35 @@ static void be_cancel_worker(struct be_adapter *adapter) | |||
2932 | } | 2940 | } |
2933 | } | 2941 | } |
2934 | 2942 | ||
2935 | static int be_clear(struct be_adapter *adapter) | 2943 | static void be_mac_clear(struct be_adapter *adapter) |
2936 | { | 2944 | { |
2937 | int i; | 2945 | int i; |
2938 | 2946 | ||
2947 | if (adapter->pmac_id) { | ||
2948 | for (i = 0; i < (adapter->uc_macs + 1); i++) | ||
2949 | be_cmd_pmac_del(adapter, adapter->if_handle, | ||
2950 | adapter->pmac_id[i], 0); | ||
2951 | adapter->uc_macs = 0; | ||
2952 | |||
2953 | kfree(adapter->pmac_id); | ||
2954 | adapter->pmac_id = NULL; | ||
2955 | } | ||
2956 | } | ||
2957 | |||
2958 | static int be_clear(struct be_adapter *adapter) | ||
2959 | { | ||
2939 | be_cancel_worker(adapter); | 2960 | be_cancel_worker(adapter); |
2940 | 2961 | ||
2941 | if (sriov_enabled(adapter)) | 2962 | if (sriov_enabled(adapter)) |
2942 | be_vf_clear(adapter); | 2963 | be_vf_clear(adapter); |
2943 | 2964 | ||
2944 | /* delete the primary mac along with the uc-mac list */ | 2965 | /* delete the primary mac along with the uc-mac list */ |
2945 | for (i = 0; i < (adapter->uc_macs + 1); i++) | 2966 | be_mac_clear(adapter); |
2946 | be_cmd_pmac_del(adapter, adapter->if_handle, | ||
2947 | adapter->pmac_id[i], 0); | ||
2948 | adapter->uc_macs = 0; | ||
2949 | 2967 | ||
2950 | be_cmd_if_destroy(adapter, adapter->if_handle, 0); | 2968 | be_cmd_if_destroy(adapter, adapter->if_handle, 0); |
2951 | 2969 | ||
2952 | be_clear_queues(adapter); | 2970 | be_clear_queues(adapter); |
2953 | 2971 | ||
2954 | kfree(adapter->pmac_id); | ||
2955 | adapter->pmac_id = NULL; | ||
2956 | |||
2957 | be_msix_disable(adapter); | 2972 | be_msix_disable(adapter); |
2958 | return 0; | 2973 | return 0; |
2959 | } | 2974 | } |
@@ -3253,12 +3268,10 @@ static int be_mac_setup(struct be_adapter *adapter) | |||
3253 | memcpy(mac, adapter->netdev->dev_addr, ETH_ALEN); | 3268 | memcpy(mac, adapter->netdev->dev_addr, ETH_ALEN); |
3254 | } | 3269 | } |
3255 | 3270 | ||
3256 | /* On BE3 VFs this cmd may fail due to lack of privilege. | 3271 | /* For BE3-R VFs, the PF programs the initial MAC address */ |
3257 | * Ignore the failure as in this case pmac_id is fetched | 3272 | if (!(BEx_chip(adapter) && be_virtfn(adapter))) |
3258 | * in the IFACE_CREATE cmd. | 3273 | be_cmd_pmac_add(adapter, mac, adapter->if_handle, |
3259 | */ | 3274 | &adapter->pmac_id[0], 0); |
3260 | be_cmd_pmac_add(adapter, mac, adapter->if_handle, | ||
3261 | &adapter->pmac_id[0], 0); | ||
3262 | return 0; | 3275 | return 0; |
3263 | } | 3276 | } |
3264 | 3277 | ||
@@ -3814,6 +3827,8 @@ static int lancer_fw_download(struct be_adapter *adapter, | |||
3814 | } | 3827 | } |
3815 | 3828 | ||
3816 | if (change_status == LANCER_FW_RESET_NEEDED) { | 3829 | if (change_status == LANCER_FW_RESET_NEEDED) { |
3830 | dev_info(&adapter->pdev->dev, | ||
3831 | "Resetting adapter to activate new FW\n"); | ||
3817 | status = lancer_physdev_ctrl(adapter, | 3832 | status = lancer_physdev_ctrl(adapter, |
3818 | PHYSDEV_CONTROL_FW_RESET_MASK); | 3833 | PHYSDEV_CONTROL_FW_RESET_MASK); |
3819 | if (status) { | 3834 | if (status) { |
@@ -4365,13 +4380,13 @@ static int lancer_recover_func(struct be_adapter *adapter) | |||
4365 | goto err; | 4380 | goto err; |
4366 | } | 4381 | } |
4367 | 4382 | ||
4368 | dev_err(dev, "Error recovery successful\n"); | 4383 | dev_err(dev, "Adapter recovery successful\n"); |
4369 | return 0; | 4384 | return 0; |
4370 | err: | 4385 | err: |
4371 | if (status == -EAGAIN) | 4386 | if (status == -EAGAIN) |
4372 | dev_err(dev, "Waiting for resource provisioning\n"); | 4387 | dev_err(dev, "Waiting for resource provisioning\n"); |
4373 | else | 4388 | else |
4374 | dev_err(dev, "Error recovery failed\n"); | 4389 | dev_err(dev, "Adapter recovery failed\n"); |
4375 | 4390 | ||
4376 | return status; | 4391 | return status; |
4377 | } | 4392 | } |
@@ -4599,6 +4614,7 @@ static int be_suspend(struct pci_dev *pdev, pm_message_t state) | |||
4599 | if (adapter->wol) | 4614 | if (adapter->wol) |
4600 | be_setup_wol(adapter, true); | 4615 | be_setup_wol(adapter, true); |
4601 | 4616 | ||
4617 | be_intr_set(adapter, false); | ||
4602 | cancel_delayed_work_sync(&adapter->func_recovery_work); | 4618 | cancel_delayed_work_sync(&adapter->func_recovery_work); |
4603 | 4619 | ||
4604 | netif_device_detach(netdev); | 4620 | netif_device_detach(netdev); |
@@ -4634,6 +4650,7 @@ static int be_resume(struct pci_dev *pdev) | |||
4634 | if (status) | 4650 | if (status) |
4635 | return status; | 4651 | return status; |
4636 | 4652 | ||
4653 | be_intr_set(adapter, true); | ||
4637 | /* tell fw we're ready to fire cmds */ | 4654 | /* tell fw we're ready to fire cmds */ |
4638 | status = be_cmd_fw_init(adapter); | 4655 | status = be_cmd_fw_init(adapter); |
4639 | if (status) | 4656 | if (status) |
diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c index 4cbebf3d80eb..e7c8b749c5a5 100644 --- a/drivers/net/ethernet/freescale/fec_main.c +++ b/drivers/net/ethernet/freescale/fec_main.c | |||
@@ -98,10 +98,6 @@ static void set_multicast_list(struct net_device *ndev); | |||
98 | * detected as not set during a prior frame transmission, then the | 98 | * detected as not set during a prior frame transmission, then the |
99 | * ENET_TDAR[TDAR] bit is cleared at a later time, even if additional TxBDs | 99 | * ENET_TDAR[TDAR] bit is cleared at a later time, even if additional TxBDs |
100 | * were added to the ring and the ENET_TDAR[TDAR] bit is set. This results in | 100 | * were added to the ring and the ENET_TDAR[TDAR] bit is set. This results in |
101 | * If the ready bit in the transmit buffer descriptor (TxBD[R]) is previously | ||
102 | * detected as not set during a prior frame transmission, then the | ||
103 | * ENET_TDAR[TDAR] bit is cleared at a later time, even if additional TxBDs | ||
104 | * were added to the ring and the ENET_TDAR[TDAR] bit is set. This results in | ||
105 | * frames not being transmitted until there is a 0-to-1 transition on | 101 | * frames not being transmitted until there is a 0-to-1 transition on |
106 | * ENET_TDAR[TDAR]. | 102 | * ENET_TDAR[TDAR]. |
107 | */ | 103 | */ |
@@ -385,7 +381,7 @@ fec_enet_start_xmit(struct sk_buff *skb, struct net_device *ndev) | |||
385 | * data. | 381 | * data. |
386 | */ | 382 | */ |
387 | bdp->cbd_bufaddr = dma_map_single(&fep->pdev->dev, bufaddr, | 383 | bdp->cbd_bufaddr = dma_map_single(&fep->pdev->dev, bufaddr, |
388 | FEC_ENET_TX_FRSIZE, DMA_TO_DEVICE); | 384 | skb->len, DMA_TO_DEVICE); |
389 | if (dma_mapping_error(&fep->pdev->dev, bdp->cbd_bufaddr)) { | 385 | if (dma_mapping_error(&fep->pdev->dev, bdp->cbd_bufaddr)) { |
390 | bdp->cbd_bufaddr = 0; | 386 | bdp->cbd_bufaddr = 0; |
391 | fep->tx_skbuff[index] = NULL; | 387 | fep->tx_skbuff[index] = NULL; |
@@ -779,11 +775,10 @@ fec_enet_tx(struct net_device *ndev) | |||
779 | else | 775 | else |
780 | index = bdp - fep->tx_bd_base; | 776 | index = bdp - fep->tx_bd_base; |
781 | 777 | ||
782 | dma_unmap_single(&fep->pdev->dev, bdp->cbd_bufaddr, | ||
783 | FEC_ENET_TX_FRSIZE, DMA_TO_DEVICE); | ||
784 | bdp->cbd_bufaddr = 0; | ||
785 | |||
786 | skb = fep->tx_skbuff[index]; | 778 | skb = fep->tx_skbuff[index]; |
779 | dma_unmap_single(&fep->pdev->dev, bdp->cbd_bufaddr, skb->len, | ||
780 | DMA_TO_DEVICE); | ||
781 | bdp->cbd_bufaddr = 0; | ||
787 | 782 | ||
788 | /* Check for errors. */ | 783 | /* Check for errors. */ |
789 | if (status & (BD_ENET_TX_HB | BD_ENET_TX_LC | | 784 | if (status & (BD_ENET_TX_HB | BD_ENET_TX_LC | |
diff --git a/drivers/net/ethernet/ibm/ehea/ehea_main.c b/drivers/net/ethernet/ibm/ehea/ehea_main.c index 2d1c6bdd3618..7628e0fd8455 100644 --- a/drivers/net/ethernet/ibm/ehea/ehea_main.c +++ b/drivers/net/ethernet/ibm/ehea/ehea_main.c | |||
@@ -3033,7 +3033,7 @@ static struct ehea_port *ehea_setup_single_port(struct ehea_adapter *adapter, | |||
3033 | 3033 | ||
3034 | dev->hw_features = NETIF_F_SG | NETIF_F_TSO | | 3034 | dev->hw_features = NETIF_F_SG | NETIF_F_TSO | |
3035 | NETIF_F_IP_CSUM | NETIF_F_HW_VLAN_CTAG_TX; | 3035 | NETIF_F_IP_CSUM | NETIF_F_HW_VLAN_CTAG_TX; |
3036 | dev->features = NETIF_F_SG | NETIF_F_FRAGLIST | NETIF_F_TSO | | 3036 | dev->features = NETIF_F_SG | NETIF_F_TSO | |
3037 | NETIF_F_HIGHDMA | NETIF_F_IP_CSUM | | 3037 | NETIF_F_HIGHDMA | NETIF_F_IP_CSUM | |
3038 | NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_CTAG_RX | | 3038 | NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_CTAG_RX | |
3039 | NETIF_F_HW_VLAN_CTAG_FILTER | NETIF_F_RXCSUM; | 3039 | NETIF_F_HW_VLAN_CTAG_FILTER | NETIF_F_RXCSUM; |
diff --git a/drivers/net/ethernet/intel/e1000/e1000.h b/drivers/net/ethernet/intel/e1000/e1000.h index 58c147271a36..f9313b36c887 100644 --- a/drivers/net/ethernet/intel/e1000/e1000.h +++ b/drivers/net/ethernet/intel/e1000/e1000.h | |||
@@ -83,6 +83,11 @@ struct e1000_adapter; | |||
83 | 83 | ||
84 | #define E1000_MAX_INTR 10 | 84 | #define E1000_MAX_INTR 10 |
85 | 85 | ||
86 | /* | ||
87 | * Count for polling __E1000_RESET condition every 10-20msec. | ||
88 | */ | ||
89 | #define E1000_CHECK_RESET_COUNT 50 | ||
90 | |||
86 | /* TX/RX descriptor defines */ | 91 | /* TX/RX descriptor defines */ |
87 | #define E1000_DEFAULT_TXD 256 | 92 | #define E1000_DEFAULT_TXD 256 |
88 | #define E1000_MAX_TXD 256 | 93 | #define E1000_MAX_TXD 256 |
@@ -312,8 +317,6 @@ struct e1000_adapter { | |||
312 | struct delayed_work watchdog_task; | 317 | struct delayed_work watchdog_task; |
313 | struct delayed_work fifo_stall_task; | 318 | struct delayed_work fifo_stall_task; |
314 | struct delayed_work phy_info_task; | 319 | struct delayed_work phy_info_task; |
315 | |||
316 | struct mutex mutex; | ||
317 | }; | 320 | }; |
318 | 321 | ||
319 | enum e1000_state_t { | 322 | enum e1000_state_t { |
diff --git a/drivers/net/ethernet/intel/e1000/e1000_main.c b/drivers/net/ethernet/intel/e1000/e1000_main.c index e38622825fa7..46e6544ed1b7 100644 --- a/drivers/net/ethernet/intel/e1000/e1000_main.c +++ b/drivers/net/ethernet/intel/e1000/e1000_main.c | |||
@@ -494,13 +494,20 @@ static void e1000_down_and_stop(struct e1000_adapter *adapter) | |||
494 | { | 494 | { |
495 | set_bit(__E1000_DOWN, &adapter->flags); | 495 | set_bit(__E1000_DOWN, &adapter->flags); |
496 | 496 | ||
497 | /* Only kill reset task if adapter is not resetting */ | ||
498 | if (!test_bit(__E1000_RESETTING, &adapter->flags)) | ||
499 | cancel_work_sync(&adapter->reset_task); | ||
500 | |||
501 | cancel_delayed_work_sync(&adapter->watchdog_task); | 497 | cancel_delayed_work_sync(&adapter->watchdog_task); |
498 | |||
499 | /* | ||
500 | * Since the watchdog task can reschedule other tasks, we should cancel | ||
501 | * it first, otherwise we can run into the situation when a work is | ||
502 | * still running after the adapter has been turned down. | ||
503 | */ | ||
504 | |||
502 | cancel_delayed_work_sync(&adapter->phy_info_task); | 505 | cancel_delayed_work_sync(&adapter->phy_info_task); |
503 | cancel_delayed_work_sync(&adapter->fifo_stall_task); | 506 | cancel_delayed_work_sync(&adapter->fifo_stall_task); |
507 | |||
508 | /* Only kill reset task if adapter is not resetting */ | ||
509 | if (!test_bit(__E1000_RESETTING, &adapter->flags)) | ||
510 | cancel_work_sync(&adapter->reset_task); | ||
504 | } | 511 | } |
505 | 512 | ||
506 | void e1000_down(struct e1000_adapter *adapter) | 513 | void e1000_down(struct e1000_adapter *adapter) |
@@ -544,21 +551,8 @@ void e1000_down(struct e1000_adapter *adapter) | |||
544 | e1000_clean_all_rx_rings(adapter); | 551 | e1000_clean_all_rx_rings(adapter); |
545 | } | 552 | } |
546 | 553 | ||
547 | static void e1000_reinit_safe(struct e1000_adapter *adapter) | ||
548 | { | ||
549 | while (test_and_set_bit(__E1000_RESETTING, &adapter->flags)) | ||
550 | msleep(1); | ||
551 | mutex_lock(&adapter->mutex); | ||
552 | e1000_down(adapter); | ||
553 | e1000_up(adapter); | ||
554 | mutex_unlock(&adapter->mutex); | ||
555 | clear_bit(__E1000_RESETTING, &adapter->flags); | ||
556 | } | ||
557 | |||
558 | void e1000_reinit_locked(struct e1000_adapter *adapter) | 554 | void e1000_reinit_locked(struct e1000_adapter *adapter) |
559 | { | 555 | { |
560 | /* if rtnl_lock is not held the call path is bogus */ | ||
561 | ASSERT_RTNL(); | ||
562 | WARN_ON(in_interrupt()); | 556 | WARN_ON(in_interrupt()); |
563 | while (test_and_set_bit(__E1000_RESETTING, &adapter->flags)) | 557 | while (test_and_set_bit(__E1000_RESETTING, &adapter->flags)) |
564 | msleep(1); | 558 | msleep(1); |
@@ -1316,7 +1310,6 @@ static int e1000_sw_init(struct e1000_adapter *adapter) | |||
1316 | e1000_irq_disable(adapter); | 1310 | e1000_irq_disable(adapter); |
1317 | 1311 | ||
1318 | spin_lock_init(&adapter->stats_lock); | 1312 | spin_lock_init(&adapter->stats_lock); |
1319 | mutex_init(&adapter->mutex); | ||
1320 | 1313 | ||
1321 | set_bit(__E1000_DOWN, &adapter->flags); | 1314 | set_bit(__E1000_DOWN, &adapter->flags); |
1322 | 1315 | ||
@@ -1440,6 +1433,10 @@ static int e1000_close(struct net_device *netdev) | |||
1440 | { | 1433 | { |
1441 | struct e1000_adapter *adapter = netdev_priv(netdev); | 1434 | struct e1000_adapter *adapter = netdev_priv(netdev); |
1442 | struct e1000_hw *hw = &adapter->hw; | 1435 | struct e1000_hw *hw = &adapter->hw; |
1436 | int count = E1000_CHECK_RESET_COUNT; | ||
1437 | |||
1438 | while (test_bit(__E1000_RESETTING, &adapter->flags) && count--) | ||
1439 | usleep_range(10000, 20000); | ||
1443 | 1440 | ||
1444 | WARN_ON(test_bit(__E1000_RESETTING, &adapter->flags)); | 1441 | WARN_ON(test_bit(__E1000_RESETTING, &adapter->flags)); |
1445 | e1000_down(adapter); | 1442 | e1000_down(adapter); |
@@ -2325,11 +2322,8 @@ static void e1000_update_phy_info_task(struct work_struct *work) | |||
2325 | struct e1000_adapter *adapter = container_of(work, | 2322 | struct e1000_adapter *adapter = container_of(work, |
2326 | struct e1000_adapter, | 2323 | struct e1000_adapter, |
2327 | phy_info_task.work); | 2324 | phy_info_task.work); |
2328 | if (test_bit(__E1000_DOWN, &adapter->flags)) | 2325 | |
2329 | return; | ||
2330 | mutex_lock(&adapter->mutex); | ||
2331 | e1000_phy_get_info(&adapter->hw, &adapter->phy_info); | 2326 | e1000_phy_get_info(&adapter->hw, &adapter->phy_info); |
2332 | mutex_unlock(&adapter->mutex); | ||
2333 | } | 2327 | } |
2334 | 2328 | ||
2335 | /** | 2329 | /** |
@@ -2345,9 +2339,6 @@ static void e1000_82547_tx_fifo_stall_task(struct work_struct *work) | |||
2345 | struct net_device *netdev = adapter->netdev; | 2339 | struct net_device *netdev = adapter->netdev; |
2346 | u32 tctl; | 2340 | u32 tctl; |
2347 | 2341 | ||
2348 | if (test_bit(__E1000_DOWN, &adapter->flags)) | ||
2349 | return; | ||
2350 | mutex_lock(&adapter->mutex); | ||
2351 | if (atomic_read(&adapter->tx_fifo_stall)) { | 2342 | if (atomic_read(&adapter->tx_fifo_stall)) { |
2352 | if ((er32(TDT) == er32(TDH)) && | 2343 | if ((er32(TDT) == er32(TDH)) && |
2353 | (er32(TDFT) == er32(TDFH)) && | 2344 | (er32(TDFT) == er32(TDFH)) && |
@@ -2368,7 +2359,6 @@ static void e1000_82547_tx_fifo_stall_task(struct work_struct *work) | |||
2368 | schedule_delayed_work(&adapter->fifo_stall_task, 1); | 2359 | schedule_delayed_work(&adapter->fifo_stall_task, 1); |
2369 | } | 2360 | } |
2370 | } | 2361 | } |
2371 | mutex_unlock(&adapter->mutex); | ||
2372 | } | 2362 | } |
2373 | 2363 | ||
2374 | bool e1000_has_link(struct e1000_adapter *adapter) | 2364 | bool e1000_has_link(struct e1000_adapter *adapter) |
@@ -2422,10 +2412,6 @@ static void e1000_watchdog(struct work_struct *work) | |||
2422 | struct e1000_tx_ring *txdr = adapter->tx_ring; | 2412 | struct e1000_tx_ring *txdr = adapter->tx_ring; |
2423 | u32 link, tctl; | 2413 | u32 link, tctl; |
2424 | 2414 | ||
2425 | if (test_bit(__E1000_DOWN, &adapter->flags)) | ||
2426 | return; | ||
2427 | |||
2428 | mutex_lock(&adapter->mutex); | ||
2429 | link = e1000_has_link(adapter); | 2415 | link = e1000_has_link(adapter); |
2430 | if ((netif_carrier_ok(netdev)) && link) | 2416 | if ((netif_carrier_ok(netdev)) && link) |
2431 | goto link_up; | 2417 | goto link_up; |
@@ -2516,7 +2502,7 @@ link_up: | |||
2516 | adapter->tx_timeout_count++; | 2502 | adapter->tx_timeout_count++; |
2517 | schedule_work(&adapter->reset_task); | 2503 | schedule_work(&adapter->reset_task); |
2518 | /* exit immediately since reset is imminent */ | 2504 | /* exit immediately since reset is imminent */ |
2519 | goto unlock; | 2505 | return; |
2520 | } | 2506 | } |
2521 | } | 2507 | } |
2522 | 2508 | ||
@@ -2544,9 +2530,6 @@ link_up: | |||
2544 | /* Reschedule the task */ | 2530 | /* Reschedule the task */ |
2545 | if (!test_bit(__E1000_DOWN, &adapter->flags)) | 2531 | if (!test_bit(__E1000_DOWN, &adapter->flags)) |
2546 | schedule_delayed_work(&adapter->watchdog_task, 2 * HZ); | 2532 | schedule_delayed_work(&adapter->watchdog_task, 2 * HZ); |
2547 | |||
2548 | unlock: | ||
2549 | mutex_unlock(&adapter->mutex); | ||
2550 | } | 2533 | } |
2551 | 2534 | ||
2552 | enum latency_range { | 2535 | enum latency_range { |
@@ -3495,10 +3478,8 @@ static void e1000_reset_task(struct work_struct *work) | |||
3495 | struct e1000_adapter *adapter = | 3478 | struct e1000_adapter *adapter = |
3496 | container_of(work, struct e1000_adapter, reset_task); | 3479 | container_of(work, struct e1000_adapter, reset_task); |
3497 | 3480 | ||
3498 | if (test_bit(__E1000_DOWN, &adapter->flags)) | ||
3499 | return; | ||
3500 | e_err(drv, "Reset adapter\n"); | 3481 | e_err(drv, "Reset adapter\n"); |
3501 | e1000_reinit_safe(adapter); | 3482 | e1000_reinit_locked(adapter); |
3502 | } | 3483 | } |
3503 | 3484 | ||
3504 | /** | 3485 | /** |
@@ -4963,6 +4944,11 @@ static int __e1000_shutdown(struct pci_dev *pdev, bool *enable_wake) | |||
4963 | netif_device_detach(netdev); | 4944 | netif_device_detach(netdev); |
4964 | 4945 | ||
4965 | if (netif_running(netdev)) { | 4946 | if (netif_running(netdev)) { |
4947 | int count = E1000_CHECK_RESET_COUNT; | ||
4948 | |||
4949 | while (test_bit(__E1000_RESETTING, &adapter->flags) && count--) | ||
4950 | usleep_range(10000, 20000); | ||
4951 | |||
4966 | WARN_ON(test_bit(__E1000_RESETTING, &adapter->flags)); | 4952 | WARN_ON(test_bit(__E1000_RESETTING, &adapter->flags)); |
4967 | e1000_down(adapter); | 4953 | e1000_down(adapter); |
4968 | } | 4954 | } |
diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c index be15938ba213..12b0932204ba 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_main.c +++ b/drivers/net/ethernet/intel/i40e/i40e_main.c | |||
@@ -354,6 +354,9 @@ static struct rtnl_link_stats64 *i40e_get_netdev_stats_struct( | |||
354 | struct rtnl_link_stats64 *vsi_stats = i40e_get_vsi_stats_struct(vsi); | 354 | struct rtnl_link_stats64 *vsi_stats = i40e_get_vsi_stats_struct(vsi); |
355 | int i; | 355 | int i; |
356 | 356 | ||
357 | if (!vsi->tx_rings) | ||
358 | return stats; | ||
359 | |||
357 | rcu_read_lock(); | 360 | rcu_read_lock(); |
358 | for (i = 0; i < vsi->num_queue_pairs; i++) { | 361 | for (i = 0; i < vsi->num_queue_pairs; i++) { |
359 | struct i40e_ring *tx_ring, *rx_ring; | 362 | struct i40e_ring *tx_ring, *rx_ring; |
diff --git a/drivers/net/ethernet/intel/igb/e1000_phy.c b/drivers/net/ethernet/intel/igb/e1000_phy.c index c4c4fe332c7e..ad2b74d95138 100644 --- a/drivers/net/ethernet/intel/igb/e1000_phy.c +++ b/drivers/net/ethernet/intel/igb/e1000_phy.c | |||
@@ -1728,7 +1728,10 @@ s32 igb_phy_has_link(struct e1000_hw *hw, u32 iterations, | |||
1728 | * ownership of the resources, wait and try again to | 1728 | * ownership of the resources, wait and try again to |
1729 | * see if they have relinquished the resources yet. | 1729 | * see if they have relinquished the resources yet. |
1730 | */ | 1730 | */ |
1731 | udelay(usec_interval); | 1731 | if (usec_interval >= 1000) |
1732 | mdelay(usec_interval/1000); | ||
1733 | else | ||
1734 | udelay(usec_interval); | ||
1732 | } | 1735 | } |
1733 | ret_val = hw->phy.ops.read_reg(hw, PHY_STATUS, &phy_status); | 1736 | ret_val = hw->phy.ops.read_reg(hw, PHY_STATUS, &phy_status); |
1734 | if (ret_val) | 1737 | if (ret_val) |
diff --git a/drivers/net/ethernet/intel/igb/igb_ethtool.c b/drivers/net/ethernet/intel/igb/igb_ethtool.c index b0f3666b1d7f..c3143da497c8 100644 --- a/drivers/net/ethernet/intel/igb/igb_ethtool.c +++ b/drivers/net/ethernet/intel/igb/igb_ethtool.c | |||
@@ -2062,14 +2062,15 @@ static void igb_get_wol(struct net_device *netdev, struct ethtool_wolinfo *wol) | |||
2062 | { | 2062 | { |
2063 | struct igb_adapter *adapter = netdev_priv(netdev); | 2063 | struct igb_adapter *adapter = netdev_priv(netdev); |
2064 | 2064 | ||
2065 | wol->supported = WAKE_UCAST | WAKE_MCAST | | ||
2066 | WAKE_BCAST | WAKE_MAGIC | | ||
2067 | WAKE_PHY; | ||
2068 | wol->wolopts = 0; | 2065 | wol->wolopts = 0; |
2069 | 2066 | ||
2070 | if (!(adapter->flags & IGB_FLAG_WOL_SUPPORTED)) | 2067 | if (!(adapter->flags & IGB_FLAG_WOL_SUPPORTED)) |
2071 | return; | 2068 | return; |
2072 | 2069 | ||
2070 | wol->supported = WAKE_UCAST | WAKE_MCAST | | ||
2071 | WAKE_BCAST | WAKE_MAGIC | | ||
2072 | WAKE_PHY; | ||
2073 | |||
2073 | /* apply any specific unsupported masks here */ | 2074 | /* apply any specific unsupported masks here */ |
2074 | switch (adapter->hw.device_id) { | 2075 | switch (adapter->hw.device_id) { |
2075 | default: | 2076 | default: |
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c index 0c55079ebee3..cc06854296a3 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | |||
@@ -4251,8 +4251,8 @@ static void ixgbe_disable_fwd_ring(struct ixgbe_fwd_adapter *vadapter, | |||
4251 | rx_ring->l2_accel_priv = NULL; | 4251 | rx_ring->l2_accel_priv = NULL; |
4252 | } | 4252 | } |
4253 | 4253 | ||
4254 | int ixgbe_fwd_ring_down(struct net_device *vdev, | 4254 | static int ixgbe_fwd_ring_down(struct net_device *vdev, |
4255 | struct ixgbe_fwd_adapter *accel) | 4255 | struct ixgbe_fwd_adapter *accel) |
4256 | { | 4256 | { |
4257 | struct ixgbe_adapter *adapter = accel->real_adapter; | 4257 | struct ixgbe_adapter *adapter = accel->real_adapter; |
4258 | unsigned int rxbase = accel->rx_base_queue; | 4258 | unsigned int rxbase = accel->rx_base_queue; |
@@ -7986,10 +7986,9 @@ skip_sriov: | |||
7986 | NETIF_F_TSO | | 7986 | NETIF_F_TSO | |
7987 | NETIF_F_TSO6 | | 7987 | NETIF_F_TSO6 | |
7988 | NETIF_F_RXHASH | | 7988 | NETIF_F_RXHASH | |
7989 | NETIF_F_RXCSUM | | 7989 | NETIF_F_RXCSUM; |
7990 | NETIF_F_HW_L2FW_DOFFLOAD; | ||
7991 | 7990 | ||
7992 | netdev->hw_features = netdev->features; | 7991 | netdev->hw_features = netdev->features | NETIF_F_HW_L2FW_DOFFLOAD; |
7993 | 7992 | ||
7994 | switch (adapter->hw.mac.type) { | 7993 | switch (adapter->hw.mac.type) { |
7995 | case ixgbe_mac_82599EB: | 7994 | case ixgbe_mac_82599EB: |
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_phy.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_phy.c index e4c676006be9..39217e5ff7dc 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_phy.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_phy.c | |||
@@ -46,6 +46,7 @@ static bool ixgbe_get_i2c_data(u32 *i2cctl); | |||
46 | static void ixgbe_i2c_bus_clear(struct ixgbe_hw *hw); | 46 | static void ixgbe_i2c_bus_clear(struct ixgbe_hw *hw); |
47 | static enum ixgbe_phy_type ixgbe_get_phy_type_from_id(u32 phy_id); | 47 | static enum ixgbe_phy_type ixgbe_get_phy_type_from_id(u32 phy_id); |
48 | static s32 ixgbe_get_phy_id(struct ixgbe_hw *hw); | 48 | static s32 ixgbe_get_phy_id(struct ixgbe_hw *hw); |
49 | static s32 ixgbe_identify_qsfp_module_generic(struct ixgbe_hw *hw); | ||
49 | 50 | ||
50 | /** | 51 | /** |
51 | * ixgbe_identify_phy_generic - Get physical layer module | 52 | * ixgbe_identify_phy_generic - Get physical layer module |
@@ -1164,7 +1165,7 @@ err_read_i2c_eeprom: | |||
1164 | * | 1165 | * |
1165 | * Searches for and identifies the QSFP module and assigns appropriate PHY type | 1166 | * Searches for and identifies the QSFP module and assigns appropriate PHY type |
1166 | **/ | 1167 | **/ |
1167 | s32 ixgbe_identify_qsfp_module_generic(struct ixgbe_hw *hw) | 1168 | static s32 ixgbe_identify_qsfp_module_generic(struct ixgbe_hw *hw) |
1168 | { | 1169 | { |
1169 | struct ixgbe_adapter *adapter = hw->back; | 1170 | struct ixgbe_adapter *adapter = hw->back; |
1170 | s32 status = IXGBE_ERR_PHY_ADDR_INVALID; | 1171 | s32 status = IXGBE_ERR_PHY_ADDR_INVALID; |
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_phy.h b/drivers/net/ethernet/intel/ixgbe/ixgbe_phy.h index aae900a256da..fffcbdd2bf0e 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_phy.h +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_phy.h | |||
@@ -145,7 +145,6 @@ s32 ixgbe_get_phy_firmware_version_generic(struct ixgbe_hw *hw, | |||
145 | s32 ixgbe_reset_phy_nl(struct ixgbe_hw *hw); | 145 | s32 ixgbe_reset_phy_nl(struct ixgbe_hw *hw); |
146 | s32 ixgbe_identify_module_generic(struct ixgbe_hw *hw); | 146 | s32 ixgbe_identify_module_generic(struct ixgbe_hw *hw); |
147 | s32 ixgbe_identify_sfp_module_generic(struct ixgbe_hw *hw); | 147 | s32 ixgbe_identify_sfp_module_generic(struct ixgbe_hw *hw); |
148 | s32 ixgbe_identify_qsfp_module_generic(struct ixgbe_hw *hw); | ||
149 | s32 ixgbe_get_sfp_init_sequence_offsets(struct ixgbe_hw *hw, | 148 | s32 ixgbe_get_sfp_init_sequence_offsets(struct ixgbe_hw *hw, |
150 | u16 *list_offset, | 149 | u16 *list_offset, |
151 | u16 *data_offset); | 150 | u16 *data_offset); |
diff --git a/drivers/net/ethernet/marvell/mvneta.c b/drivers/net/ethernet/marvell/mvneta.c index b8e232b4ea2d..d5f0d72e5e33 100644 --- a/drivers/net/ethernet/marvell/mvneta.c +++ b/drivers/net/ethernet/marvell/mvneta.c | |||
@@ -1378,7 +1378,7 @@ static void mvneta_rxq_drop_pkts(struct mvneta_port *pp, | |||
1378 | 1378 | ||
1379 | dev_kfree_skb_any(skb); | 1379 | dev_kfree_skb_any(skb); |
1380 | dma_unmap_single(pp->dev->dev.parent, rx_desc->buf_phys_addr, | 1380 | dma_unmap_single(pp->dev->dev.parent, rx_desc->buf_phys_addr, |
1381 | rx_desc->data_size, DMA_FROM_DEVICE); | 1381 | MVNETA_RX_BUF_SIZE(pp->pkt_size), DMA_FROM_DEVICE); |
1382 | } | 1382 | } |
1383 | 1383 | ||
1384 | if (rx_done) | 1384 | if (rx_done) |
@@ -1424,7 +1424,7 @@ static int mvneta_rx(struct mvneta_port *pp, int rx_todo, | |||
1424 | } | 1424 | } |
1425 | 1425 | ||
1426 | dma_unmap_single(pp->dev->dev.parent, rx_desc->buf_phys_addr, | 1426 | dma_unmap_single(pp->dev->dev.parent, rx_desc->buf_phys_addr, |
1427 | rx_desc->data_size, DMA_FROM_DEVICE); | 1427 | MVNETA_RX_BUF_SIZE(pp->pkt_size), DMA_FROM_DEVICE); |
1428 | 1428 | ||
1429 | rx_bytes = rx_desc->data_size - | 1429 | rx_bytes = rx_desc->data_size - |
1430 | (ETH_FCS_LEN + MVNETA_MH_SIZE); | 1430 | (ETH_FCS_LEN + MVNETA_MH_SIZE); |
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_selftest.c b/drivers/net/ethernet/mellanox/mlx4/en_selftest.c index 40626690e8a8..c11d063473e5 100644 --- a/drivers/net/ethernet/mellanox/mlx4/en_selftest.c +++ b/drivers/net/ethernet/mellanox/mlx4/en_selftest.c | |||
@@ -140,7 +140,6 @@ void mlx4_en_ex_selftest(struct net_device *dev, u32 *flags, u64 *buf) | |||
140 | { | 140 | { |
141 | struct mlx4_en_priv *priv = netdev_priv(dev); | 141 | struct mlx4_en_priv *priv = netdev_priv(dev); |
142 | struct mlx4_en_dev *mdev = priv->mdev; | 142 | struct mlx4_en_dev *mdev = priv->mdev; |
143 | struct mlx4_en_tx_ring *tx_ring; | ||
144 | int i, carrier_ok; | 143 | int i, carrier_ok; |
145 | 144 | ||
146 | memset(buf, 0, sizeof(u64) * MLX4_EN_NUM_SELF_TEST); | 145 | memset(buf, 0, sizeof(u64) * MLX4_EN_NUM_SELF_TEST); |
@@ -150,16 +149,10 @@ void mlx4_en_ex_selftest(struct net_device *dev, u32 *flags, u64 *buf) | |||
150 | carrier_ok = netif_carrier_ok(dev); | 149 | carrier_ok = netif_carrier_ok(dev); |
151 | 150 | ||
152 | netif_carrier_off(dev); | 151 | netif_carrier_off(dev); |
153 | retry_tx: | ||
154 | /* Wait until all tx queues are empty. | 152 | /* Wait until all tx queues are empty. |
155 | * there should not be any additional incoming traffic | 153 | * there should not be any additional incoming traffic |
156 | * since we turned the carrier off */ | 154 | * since we turned the carrier off */ |
157 | msleep(200); | 155 | msleep(200); |
158 | for (i = 0; i < priv->tx_ring_num && carrier_ok; i++) { | ||
159 | tx_ring = priv->tx_ring[i]; | ||
160 | if (tx_ring->prod != (tx_ring->cons + tx_ring->last_nr_txbb)) | ||
161 | goto retry_tx; | ||
162 | } | ||
163 | 156 | ||
164 | if (priv->mdev->dev->caps.flags & | 157 | if (priv->mdev->dev->caps.flags & |
165 | MLX4_DEV_CAP_FLAG_UC_LOOPBACK) { | 158 | MLX4_DEV_CAP_FLAG_UC_LOOPBACK) { |
diff --git a/drivers/net/ethernet/mellanox/mlx4/main.c b/drivers/net/ethernet/mellanox/mlx4/main.c index 5789ea2c934d..01fc6515384d 100644 --- a/drivers/net/ethernet/mellanox/mlx4/main.c +++ b/drivers/net/ethernet/mellanox/mlx4/main.c | |||
@@ -2635,6 +2635,8 @@ static int __init mlx4_init(void) | |||
2635 | return -ENOMEM; | 2635 | return -ENOMEM; |
2636 | 2636 | ||
2637 | ret = pci_register_driver(&mlx4_driver); | 2637 | ret = pci_register_driver(&mlx4_driver); |
2638 | if (ret < 0) | ||
2639 | destroy_workqueue(mlx4_wq); | ||
2638 | return ret < 0 ? ret : 0; | 2640 | return ret < 0 ? ret : 0; |
2639 | } | 2641 | } |
2640 | 2642 | ||
diff --git a/drivers/net/ethernet/nvidia/forcedeth.c b/drivers/net/ethernet/nvidia/forcedeth.c index 2d045be4b5cf..1e8b9514718b 100644 --- a/drivers/net/ethernet/nvidia/forcedeth.c +++ b/drivers/net/ethernet/nvidia/forcedeth.c | |||
@@ -5150,8 +5150,10 @@ static void nv_self_test(struct net_device *dev, struct ethtool_test *test, u64 | |||
5150 | { | 5150 | { |
5151 | struct fe_priv *np = netdev_priv(dev); | 5151 | struct fe_priv *np = netdev_priv(dev); |
5152 | u8 __iomem *base = get_hwbase(dev); | 5152 | u8 __iomem *base = get_hwbase(dev); |
5153 | int result; | 5153 | int result, count; |
5154 | memset(buffer, 0, nv_get_sset_count(dev, ETH_SS_TEST)*sizeof(u64)); | 5154 | |
5155 | count = nv_get_sset_count(dev, ETH_SS_TEST); | ||
5156 | memset(buffer, 0, count * sizeof(u64)); | ||
5155 | 5157 | ||
5156 | if (!nv_link_test(dev)) { | 5158 | if (!nv_link_test(dev)) { |
5157 | test->flags |= ETH_TEST_FL_FAILED; | 5159 | test->flags |= ETH_TEST_FL_FAILED; |
@@ -5195,7 +5197,7 @@ static void nv_self_test(struct net_device *dev, struct ethtool_test *test, u64 | |||
5195 | return; | 5197 | return; |
5196 | } | 5198 | } |
5197 | 5199 | ||
5198 | if (!nv_loopback_test(dev)) { | 5200 | if (count > NV_TEST_COUNT_BASE && !nv_loopback_test(dev)) { |
5199 | test->flags |= ETH_TEST_FL_FAILED; | 5201 | test->flags |= ETH_TEST_FL_FAILED; |
5200 | buffer[3] = 1; | 5202 | buffer[3] = 1; |
5201 | } | 5203 | } |
diff --git a/drivers/net/ethernet/qlogic/qlge/qlge.h b/drivers/net/ethernet/qlogic/qlge/qlge.h index 0c9c4e895595..03517478e589 100644 --- a/drivers/net/ethernet/qlogic/qlge/qlge.h +++ b/drivers/net/ethernet/qlogic/qlge/qlge.h | |||
@@ -18,7 +18,7 @@ | |||
18 | */ | 18 | */ |
19 | #define DRV_NAME "qlge" | 19 | #define DRV_NAME "qlge" |
20 | #define DRV_STRING "QLogic 10 Gigabit PCI-E Ethernet Driver " | 20 | #define DRV_STRING "QLogic 10 Gigabit PCI-E Ethernet Driver " |
21 | #define DRV_VERSION "1.00.00.33" | 21 | #define DRV_VERSION "1.00.00.34" |
22 | 22 | ||
23 | #define WQ_ADDR_ALIGN 0x3 /* 4 byte alignment */ | 23 | #define WQ_ADDR_ALIGN 0x3 /* 4 byte alignment */ |
24 | 24 | ||
diff --git a/drivers/net/ethernet/qlogic/qlge/qlge_ethtool.c b/drivers/net/ethernet/qlogic/qlge/qlge_ethtool.c index 0780e039b271..8dee1beb9854 100644 --- a/drivers/net/ethernet/qlogic/qlge/qlge_ethtool.c +++ b/drivers/net/ethernet/qlogic/qlge/qlge_ethtool.c | |||
@@ -181,6 +181,7 @@ static const char ql_gstrings_test[][ETH_GSTRING_LEN] = { | |||
181 | }; | 181 | }; |
182 | #define QLGE_TEST_LEN (sizeof(ql_gstrings_test) / ETH_GSTRING_LEN) | 182 | #define QLGE_TEST_LEN (sizeof(ql_gstrings_test) / ETH_GSTRING_LEN) |
183 | #define QLGE_STATS_LEN ARRAY_SIZE(ql_gstrings_stats) | 183 | #define QLGE_STATS_LEN ARRAY_SIZE(ql_gstrings_stats) |
184 | #define QLGE_RCV_MAC_ERR_STATS 7 | ||
184 | 185 | ||
185 | static int ql_update_ring_coalescing(struct ql_adapter *qdev) | 186 | static int ql_update_ring_coalescing(struct ql_adapter *qdev) |
186 | { | 187 | { |
@@ -280,6 +281,9 @@ static void ql_update_stats(struct ql_adapter *qdev) | |||
280 | iter++; | 281 | iter++; |
281 | } | 282 | } |
282 | 283 | ||
284 | /* Update receive mac error statistics */ | ||
285 | iter += QLGE_RCV_MAC_ERR_STATS; | ||
286 | |||
283 | /* | 287 | /* |
284 | * Get Per-priority TX pause frame counter statistics. | 288 | * Get Per-priority TX pause frame counter statistics. |
285 | */ | 289 | */ |
diff --git a/drivers/net/ethernet/qlogic/qlge/qlge_main.c b/drivers/net/ethernet/qlogic/qlge/qlge_main.c index a245dc18d769..449f506d2e8f 100644 --- a/drivers/net/ethernet/qlogic/qlge/qlge_main.c +++ b/drivers/net/ethernet/qlogic/qlge/qlge_main.c | |||
@@ -2376,14 +2376,6 @@ static netdev_features_t qlge_fix_features(struct net_device *ndev, | |||
2376 | netdev_features_t features) | 2376 | netdev_features_t features) |
2377 | { | 2377 | { |
2378 | int err; | 2378 | int err; |
2379 | /* | ||
2380 | * Since there is no support for separate rx/tx vlan accel | ||
2381 | * enable/disable make sure tx flag is always in same state as rx. | ||
2382 | */ | ||
2383 | if (features & NETIF_F_HW_VLAN_CTAG_RX) | ||
2384 | features |= NETIF_F_HW_VLAN_CTAG_TX; | ||
2385 | else | ||
2386 | features &= ~NETIF_F_HW_VLAN_CTAG_TX; | ||
2387 | 2379 | ||
2388 | /* Update the behavior of vlan accel in the adapter */ | 2380 | /* Update the behavior of vlan accel in the adapter */ |
2389 | err = qlge_update_hw_vlan_features(ndev, features); | 2381 | err = qlge_update_hw_vlan_features(ndev, features); |
diff --git a/drivers/net/ethernet/realtek/8139cp.c b/drivers/net/ethernet/realtek/8139cp.c index f2a2128165dd..737c1a881f78 100644 --- a/drivers/net/ethernet/realtek/8139cp.c +++ b/drivers/net/ethernet/realtek/8139cp.c | |||
@@ -678,9 +678,6 @@ static void cp_tx (struct cp_private *cp) | |||
678 | le32_to_cpu(txd->opts1) & 0xffff, | 678 | le32_to_cpu(txd->opts1) & 0xffff, |
679 | PCI_DMA_TODEVICE); | 679 | PCI_DMA_TODEVICE); |
680 | 680 | ||
681 | bytes_compl += skb->len; | ||
682 | pkts_compl++; | ||
683 | |||
684 | if (status & LastFrag) { | 681 | if (status & LastFrag) { |
685 | if (status & (TxError | TxFIFOUnder)) { | 682 | if (status & (TxError | TxFIFOUnder)) { |
686 | netif_dbg(cp, tx_err, cp->dev, | 683 | netif_dbg(cp, tx_err, cp->dev, |
@@ -702,6 +699,8 @@ static void cp_tx (struct cp_private *cp) | |||
702 | netif_dbg(cp, tx_done, cp->dev, | 699 | netif_dbg(cp, tx_done, cp->dev, |
703 | "tx done, slot %d\n", tx_tail); | 700 | "tx done, slot %d\n", tx_tail); |
704 | } | 701 | } |
702 | bytes_compl += skb->len; | ||
703 | pkts_compl++; | ||
705 | dev_kfree_skb_irq(skb); | 704 | dev_kfree_skb_irq(skb); |
706 | } | 705 | } |
707 | 706 | ||
diff --git a/drivers/net/ethernet/realtek/r8169.c b/drivers/net/ethernet/realtek/r8169.c index 799387570766..c737f0ea5de7 100644 --- a/drivers/net/ethernet/realtek/r8169.c +++ b/drivers/net/ethernet/realtek/r8169.c | |||
@@ -3465,6 +3465,11 @@ static void rtl8168g_1_hw_phy_config(struct rtl8169_private *tp) | |||
3465 | rtl_writephy(tp, 0x14, 0x9065); | 3465 | rtl_writephy(tp, 0x14, 0x9065); |
3466 | rtl_writephy(tp, 0x14, 0x1065); | 3466 | rtl_writephy(tp, 0x14, 0x1065); |
3467 | 3467 | ||
3468 | /* Check ALDPS bit, disable it if enabled */ | ||
3469 | rtl_writephy(tp, 0x1f, 0x0a43); | ||
3470 | if (rtl_readphy(tp, 0x10) & 0x0004) | ||
3471 | rtl_w1w0_phy(tp, 0x10, 0x0000, 0x0004); | ||
3472 | |||
3468 | rtl_writephy(tp, 0x1f, 0x0000); | 3473 | rtl_writephy(tp, 0x1f, 0x0000); |
3469 | } | 3474 | } |
3470 | 3475 | ||
diff --git a/drivers/net/ethernet/sfc/efx.c b/drivers/net/ethernet/sfc/efx.c index 2e27837ce6a2..fd844b53e385 100644 --- a/drivers/net/ethernet/sfc/efx.c +++ b/drivers/net/ethernet/sfc/efx.c | |||
@@ -585,7 +585,7 @@ static void efx_start_datapath(struct efx_nic *efx) | |||
585 | EFX_MAX_FRAME_LEN(efx->net_dev->mtu) + | 585 | EFX_MAX_FRAME_LEN(efx->net_dev->mtu) + |
586 | efx->type->rx_buffer_padding); | 586 | efx->type->rx_buffer_padding); |
587 | rx_buf_len = (sizeof(struct efx_rx_page_state) + | 587 | rx_buf_len = (sizeof(struct efx_rx_page_state) + |
588 | NET_IP_ALIGN + efx->rx_dma_len); | 588 | efx->rx_ip_align + efx->rx_dma_len); |
589 | if (rx_buf_len <= PAGE_SIZE) { | 589 | if (rx_buf_len <= PAGE_SIZE) { |
590 | efx->rx_scatter = efx->type->always_rx_scatter; | 590 | efx->rx_scatter = efx->type->always_rx_scatter; |
591 | efx->rx_buffer_order = 0; | 591 | efx->rx_buffer_order = 0; |
@@ -645,6 +645,8 @@ static void efx_start_datapath(struct efx_nic *efx) | |||
645 | WARN_ON(channel->rx_pkt_n_frags); | 645 | WARN_ON(channel->rx_pkt_n_frags); |
646 | } | 646 | } |
647 | 647 | ||
648 | efx_ptp_start_datapath(efx); | ||
649 | |||
648 | if (netif_device_present(efx->net_dev)) | 650 | if (netif_device_present(efx->net_dev)) |
649 | netif_tx_wake_all_queues(efx->net_dev); | 651 | netif_tx_wake_all_queues(efx->net_dev); |
650 | } | 652 | } |
@@ -659,6 +661,8 @@ static void efx_stop_datapath(struct efx_nic *efx) | |||
659 | EFX_ASSERT_RESET_SERIALISED(efx); | 661 | EFX_ASSERT_RESET_SERIALISED(efx); |
660 | BUG_ON(efx->port_enabled); | 662 | BUG_ON(efx->port_enabled); |
661 | 663 | ||
664 | efx_ptp_stop_datapath(efx); | ||
665 | |||
662 | /* Stop RX refill */ | 666 | /* Stop RX refill */ |
663 | efx_for_each_channel(channel, efx) { | 667 | efx_for_each_channel(channel, efx) { |
664 | efx_for_each_channel_rx_queue(rx_queue, channel) | 668 | efx_for_each_channel_rx_queue(rx_queue, channel) |
@@ -2540,6 +2544,8 @@ static int efx_init_struct(struct efx_nic *efx, | |||
2540 | 2544 | ||
2541 | efx->net_dev = net_dev; | 2545 | efx->net_dev = net_dev; |
2542 | efx->rx_prefix_size = efx->type->rx_prefix_size; | 2546 | efx->rx_prefix_size = efx->type->rx_prefix_size; |
2547 | efx->rx_ip_align = | ||
2548 | NET_IP_ALIGN ? (efx->rx_prefix_size + NET_IP_ALIGN) % 4 : 0; | ||
2543 | efx->rx_packet_hash_offset = | 2549 | efx->rx_packet_hash_offset = |
2544 | efx->type->rx_hash_offset - efx->type->rx_prefix_size; | 2550 | efx->type->rx_hash_offset - efx->type->rx_prefix_size; |
2545 | spin_lock_init(&efx->stats_lock); | 2551 | spin_lock_init(&efx->stats_lock); |
diff --git a/drivers/net/ethernet/sfc/mcdi.c b/drivers/net/ethernet/sfc/mcdi.c index 366c8e3e3784..4b0bd8a1514d 100644 --- a/drivers/net/ethernet/sfc/mcdi.c +++ b/drivers/net/ethernet/sfc/mcdi.c | |||
@@ -50,6 +50,7 @@ struct efx_mcdi_async_param { | |||
50 | static void efx_mcdi_timeout_async(unsigned long context); | 50 | static void efx_mcdi_timeout_async(unsigned long context); |
51 | static int efx_mcdi_drv_attach(struct efx_nic *efx, bool driver_operating, | 51 | static int efx_mcdi_drv_attach(struct efx_nic *efx, bool driver_operating, |
52 | bool *was_attached_out); | 52 | bool *was_attached_out); |
53 | static bool efx_mcdi_poll_once(struct efx_nic *efx); | ||
53 | 54 | ||
54 | static inline struct efx_mcdi_iface *efx_mcdi(struct efx_nic *efx) | 55 | static inline struct efx_mcdi_iface *efx_mcdi(struct efx_nic *efx) |
55 | { | 56 | { |
@@ -237,6 +238,21 @@ static void efx_mcdi_read_response_header(struct efx_nic *efx) | |||
237 | } | 238 | } |
238 | } | 239 | } |
239 | 240 | ||
241 | static bool efx_mcdi_poll_once(struct efx_nic *efx) | ||
242 | { | ||
243 | struct efx_mcdi_iface *mcdi = efx_mcdi(efx); | ||
244 | |||
245 | rmb(); | ||
246 | if (!efx->type->mcdi_poll_response(efx)) | ||
247 | return false; | ||
248 | |||
249 | spin_lock_bh(&mcdi->iface_lock); | ||
250 | efx_mcdi_read_response_header(efx); | ||
251 | spin_unlock_bh(&mcdi->iface_lock); | ||
252 | |||
253 | return true; | ||
254 | } | ||
255 | |||
240 | static int efx_mcdi_poll(struct efx_nic *efx) | 256 | static int efx_mcdi_poll(struct efx_nic *efx) |
241 | { | 257 | { |
242 | struct efx_mcdi_iface *mcdi = efx_mcdi(efx); | 258 | struct efx_mcdi_iface *mcdi = efx_mcdi(efx); |
@@ -272,18 +288,13 @@ static int efx_mcdi_poll(struct efx_nic *efx) | |||
272 | 288 | ||
273 | time = jiffies; | 289 | time = jiffies; |
274 | 290 | ||
275 | rmb(); | 291 | if (efx_mcdi_poll_once(efx)) |
276 | if (efx->type->mcdi_poll_response(efx)) | ||
277 | break; | 292 | break; |
278 | 293 | ||
279 | if (time_after(time, finish)) | 294 | if (time_after(time, finish)) |
280 | return -ETIMEDOUT; | 295 | return -ETIMEDOUT; |
281 | } | 296 | } |
282 | 297 | ||
283 | spin_lock_bh(&mcdi->iface_lock); | ||
284 | efx_mcdi_read_response_header(efx); | ||
285 | spin_unlock_bh(&mcdi->iface_lock); | ||
286 | |||
287 | /* Return rc=0 like wait_event_timeout() */ | 298 | /* Return rc=0 like wait_event_timeout() */ |
288 | return 0; | 299 | return 0; |
289 | } | 300 | } |
@@ -619,6 +630,16 @@ int efx_mcdi_rpc_finish(struct efx_nic *efx, unsigned cmd, size_t inlen, | |||
619 | rc = efx_mcdi_await_completion(efx); | 630 | rc = efx_mcdi_await_completion(efx); |
620 | 631 | ||
621 | if (rc != 0) { | 632 | if (rc != 0) { |
633 | netif_err(efx, hw, efx->net_dev, | ||
634 | "MC command 0x%x inlen %d mode %d timed out\n", | ||
635 | cmd, (int)inlen, mcdi->mode); | ||
636 | |||
637 | if (mcdi->mode == MCDI_MODE_EVENTS && efx_mcdi_poll_once(efx)) { | ||
638 | netif_err(efx, hw, efx->net_dev, | ||
639 | "MCDI request was completed without an event\n"); | ||
640 | rc = 0; | ||
641 | } | ||
642 | |||
622 | /* Close the race with efx_mcdi_ev_cpl() executing just too late | 643 | /* Close the race with efx_mcdi_ev_cpl() executing just too late |
623 | * and completing a request we've just cancelled, by ensuring | 644 | * and completing a request we've just cancelled, by ensuring |
624 | * that the seqno check therein fails. | 645 | * that the seqno check therein fails. |
@@ -627,11 +648,9 @@ int efx_mcdi_rpc_finish(struct efx_nic *efx, unsigned cmd, size_t inlen, | |||
627 | ++mcdi->seqno; | 648 | ++mcdi->seqno; |
628 | ++mcdi->credits; | 649 | ++mcdi->credits; |
629 | spin_unlock_bh(&mcdi->iface_lock); | 650 | spin_unlock_bh(&mcdi->iface_lock); |
651 | } | ||
630 | 652 | ||
631 | netif_err(efx, hw, efx->net_dev, | 653 | if (rc == 0) { |
632 | "MC command 0x%x inlen %d mode %d timed out\n", | ||
633 | cmd, (int)inlen, mcdi->mode); | ||
634 | } else { | ||
635 | size_t hdr_len, data_len; | 654 | size_t hdr_len, data_len; |
636 | 655 | ||
637 | /* At the very least we need a memory barrier here to ensure | 656 | /* At the very least we need a memory barrier here to ensure |
diff --git a/drivers/net/ethernet/sfc/mcdi.h b/drivers/net/ethernet/sfc/mcdi.h index 656a3277c2b2..15816cacb548 100644 --- a/drivers/net/ethernet/sfc/mcdi.h +++ b/drivers/net/ethernet/sfc/mcdi.h | |||
@@ -75,6 +75,8 @@ struct efx_mcdi_mon { | |||
75 | unsigned long last_update; | 75 | unsigned long last_update; |
76 | struct device *device; | 76 | struct device *device; |
77 | struct efx_mcdi_mon_attribute *attrs; | 77 | struct efx_mcdi_mon_attribute *attrs; |
78 | struct attribute_group group; | ||
79 | const struct attribute_group *groups[2]; | ||
78 | unsigned int n_attrs; | 80 | unsigned int n_attrs; |
79 | }; | 81 | }; |
80 | 82 | ||
diff --git a/drivers/net/ethernet/sfc/mcdi_mon.c b/drivers/net/ethernet/sfc/mcdi_mon.c index 4cc5d95b2a5a..d72ad4fc3617 100644 --- a/drivers/net/ethernet/sfc/mcdi_mon.c +++ b/drivers/net/ethernet/sfc/mcdi_mon.c | |||
@@ -139,17 +139,10 @@ static int efx_mcdi_mon_update(struct efx_nic *efx) | |||
139 | return rc; | 139 | return rc; |
140 | } | 140 | } |
141 | 141 | ||
142 | static ssize_t efx_mcdi_mon_show_name(struct device *dev, | ||
143 | struct device_attribute *attr, | ||
144 | char *buf) | ||
145 | { | ||
146 | return sprintf(buf, "%s\n", KBUILD_MODNAME); | ||
147 | } | ||
148 | |||
149 | static int efx_mcdi_mon_get_entry(struct device *dev, unsigned int index, | 142 | static int efx_mcdi_mon_get_entry(struct device *dev, unsigned int index, |
150 | efx_dword_t *entry) | 143 | efx_dword_t *entry) |
151 | { | 144 | { |
152 | struct efx_nic *efx = dev_get_drvdata(dev); | 145 | struct efx_nic *efx = dev_get_drvdata(dev->parent); |
153 | struct efx_mcdi_mon *hwmon = efx_mcdi_mon(efx); | 146 | struct efx_mcdi_mon *hwmon = efx_mcdi_mon(efx); |
154 | int rc; | 147 | int rc; |
155 | 148 | ||
@@ -263,7 +256,7 @@ static ssize_t efx_mcdi_mon_show_label(struct device *dev, | |||
263 | efx_mcdi_sensor_type[mon_attr->type].label); | 256 | efx_mcdi_sensor_type[mon_attr->type].label); |
264 | } | 257 | } |
265 | 258 | ||
266 | static int | 259 | static void |
267 | efx_mcdi_mon_add_attr(struct efx_nic *efx, const char *name, | 260 | efx_mcdi_mon_add_attr(struct efx_nic *efx, const char *name, |
268 | ssize_t (*reader)(struct device *, | 261 | ssize_t (*reader)(struct device *, |
269 | struct device_attribute *, char *), | 262 | struct device_attribute *, char *), |
@@ -272,7 +265,6 @@ efx_mcdi_mon_add_attr(struct efx_nic *efx, const char *name, | |||
272 | { | 265 | { |
273 | struct efx_mcdi_mon *hwmon = efx_mcdi_mon(efx); | 266 | struct efx_mcdi_mon *hwmon = efx_mcdi_mon(efx); |
274 | struct efx_mcdi_mon_attribute *attr = &hwmon->attrs[hwmon->n_attrs]; | 267 | struct efx_mcdi_mon_attribute *attr = &hwmon->attrs[hwmon->n_attrs]; |
275 | int rc; | ||
276 | 268 | ||
277 | strlcpy(attr->name, name, sizeof(attr->name)); | 269 | strlcpy(attr->name, name, sizeof(attr->name)); |
278 | attr->index = index; | 270 | attr->index = index; |
@@ -286,10 +278,7 @@ efx_mcdi_mon_add_attr(struct efx_nic *efx, const char *name, | |||
286 | attr->dev_attr.attr.name = attr->name; | 278 | attr->dev_attr.attr.name = attr->name; |
287 | attr->dev_attr.attr.mode = S_IRUGO; | 279 | attr->dev_attr.attr.mode = S_IRUGO; |
288 | attr->dev_attr.show = reader; | 280 | attr->dev_attr.show = reader; |
289 | rc = device_create_file(&efx->pci_dev->dev, &attr->dev_attr); | 281 | hwmon->group.attrs[hwmon->n_attrs++] = &attr->dev_attr.attr; |
290 | if (rc == 0) | ||
291 | ++hwmon->n_attrs; | ||
292 | return rc; | ||
293 | } | 282 | } |
294 | 283 | ||
295 | int efx_mcdi_mon_probe(struct efx_nic *efx) | 284 | int efx_mcdi_mon_probe(struct efx_nic *efx) |
@@ -338,26 +327,22 @@ int efx_mcdi_mon_probe(struct efx_nic *efx) | |||
338 | efx_mcdi_mon_update(efx); | 327 | efx_mcdi_mon_update(efx); |
339 | 328 | ||
340 | /* Allocate space for the maximum possible number of | 329 | /* Allocate space for the maximum possible number of |
341 | * attributes for this set of sensors: name of the driver plus | 330 | * attributes for this set of sensors: |
342 | * value, min, max, crit, alarm and label for each sensor. | 331 | * value, min, max, crit, alarm and label for each sensor. |
343 | */ | 332 | */ |
344 | n_attrs = 1 + 6 * n_sensors; | 333 | n_attrs = 6 * n_sensors; |
345 | hwmon->attrs = kcalloc(n_attrs, sizeof(*hwmon->attrs), GFP_KERNEL); | 334 | hwmon->attrs = kcalloc(n_attrs, sizeof(*hwmon->attrs), GFP_KERNEL); |
346 | if (!hwmon->attrs) { | 335 | if (!hwmon->attrs) { |
347 | rc = -ENOMEM; | 336 | rc = -ENOMEM; |
348 | goto fail; | 337 | goto fail; |
349 | } | 338 | } |
350 | 339 | hwmon->group.attrs = kcalloc(n_attrs + 1, sizeof(struct attribute *), | |
351 | hwmon->device = hwmon_device_register(&efx->pci_dev->dev); | 340 | GFP_KERNEL); |
352 | if (IS_ERR(hwmon->device)) { | 341 | if (!hwmon->group.attrs) { |
353 | rc = PTR_ERR(hwmon->device); | 342 | rc = -ENOMEM; |
354 | goto fail; | 343 | goto fail; |
355 | } | 344 | } |
356 | 345 | ||
357 | rc = efx_mcdi_mon_add_attr(efx, "name", efx_mcdi_mon_show_name, 0, 0, 0); | ||
358 | if (rc) | ||
359 | goto fail; | ||
360 | |||
361 | for (i = 0, j = -1, type = -1; ; i++) { | 346 | for (i = 0, j = -1, type = -1; ; i++) { |
362 | enum efx_hwmon_type hwmon_type; | 347 | enum efx_hwmon_type hwmon_type; |
363 | const char *hwmon_prefix; | 348 | const char *hwmon_prefix; |
@@ -372,7 +357,7 @@ int efx_mcdi_mon_probe(struct efx_nic *efx) | |||
372 | page = type / 32; | 357 | page = type / 32; |
373 | j = -1; | 358 | j = -1; |
374 | if (page == n_pages) | 359 | if (page == n_pages) |
375 | return 0; | 360 | goto hwmon_register; |
376 | 361 | ||
377 | MCDI_SET_DWORD(inbuf, SENSOR_INFO_EXT_IN_PAGE, | 362 | MCDI_SET_DWORD(inbuf, SENSOR_INFO_EXT_IN_PAGE, |
378 | page); | 363 | page); |
@@ -453,28 +438,22 @@ int efx_mcdi_mon_probe(struct efx_nic *efx) | |||
453 | if (min1 != max1) { | 438 | if (min1 != max1) { |
454 | snprintf(name, sizeof(name), "%s%u_input", | 439 | snprintf(name, sizeof(name), "%s%u_input", |
455 | hwmon_prefix, hwmon_index); | 440 | hwmon_prefix, hwmon_index); |
456 | rc = efx_mcdi_mon_add_attr( | 441 | efx_mcdi_mon_add_attr( |
457 | efx, name, efx_mcdi_mon_show_value, i, type, 0); | 442 | efx, name, efx_mcdi_mon_show_value, i, type, 0); |
458 | if (rc) | ||
459 | goto fail; | ||
460 | 443 | ||
461 | if (hwmon_type != EFX_HWMON_POWER) { | 444 | if (hwmon_type != EFX_HWMON_POWER) { |
462 | snprintf(name, sizeof(name), "%s%u_min", | 445 | snprintf(name, sizeof(name), "%s%u_min", |
463 | hwmon_prefix, hwmon_index); | 446 | hwmon_prefix, hwmon_index); |
464 | rc = efx_mcdi_mon_add_attr( | 447 | efx_mcdi_mon_add_attr( |
465 | efx, name, efx_mcdi_mon_show_limit, | 448 | efx, name, efx_mcdi_mon_show_limit, |
466 | i, type, min1); | 449 | i, type, min1); |
467 | if (rc) | ||
468 | goto fail; | ||
469 | } | 450 | } |
470 | 451 | ||
471 | snprintf(name, sizeof(name), "%s%u_max", | 452 | snprintf(name, sizeof(name), "%s%u_max", |
472 | hwmon_prefix, hwmon_index); | 453 | hwmon_prefix, hwmon_index); |
473 | rc = efx_mcdi_mon_add_attr( | 454 | efx_mcdi_mon_add_attr( |
474 | efx, name, efx_mcdi_mon_show_limit, | 455 | efx, name, efx_mcdi_mon_show_limit, |
475 | i, type, max1); | 456 | i, type, max1); |
476 | if (rc) | ||
477 | goto fail; | ||
478 | 457 | ||
479 | if (min2 != max2) { | 458 | if (min2 != max2) { |
480 | /* Assume max2 is critical value. | 459 | /* Assume max2 is critical value. |
@@ -482,32 +461,38 @@ int efx_mcdi_mon_probe(struct efx_nic *efx) | |||
482 | */ | 461 | */ |
483 | snprintf(name, sizeof(name), "%s%u_crit", | 462 | snprintf(name, sizeof(name), "%s%u_crit", |
484 | hwmon_prefix, hwmon_index); | 463 | hwmon_prefix, hwmon_index); |
485 | rc = efx_mcdi_mon_add_attr( | 464 | efx_mcdi_mon_add_attr( |
486 | efx, name, efx_mcdi_mon_show_limit, | 465 | efx, name, efx_mcdi_mon_show_limit, |
487 | i, type, max2); | 466 | i, type, max2); |
488 | if (rc) | ||
489 | goto fail; | ||
490 | } | 467 | } |
491 | } | 468 | } |
492 | 469 | ||
493 | snprintf(name, sizeof(name), "%s%u_alarm", | 470 | snprintf(name, sizeof(name), "%s%u_alarm", |
494 | hwmon_prefix, hwmon_index); | 471 | hwmon_prefix, hwmon_index); |
495 | rc = efx_mcdi_mon_add_attr( | 472 | efx_mcdi_mon_add_attr( |
496 | efx, name, efx_mcdi_mon_show_alarm, i, type, 0); | 473 | efx, name, efx_mcdi_mon_show_alarm, i, type, 0); |
497 | if (rc) | ||
498 | goto fail; | ||
499 | 474 | ||
500 | if (type < ARRAY_SIZE(efx_mcdi_sensor_type) && | 475 | if (type < ARRAY_SIZE(efx_mcdi_sensor_type) && |
501 | efx_mcdi_sensor_type[type].label) { | 476 | efx_mcdi_sensor_type[type].label) { |
502 | snprintf(name, sizeof(name), "%s%u_label", | 477 | snprintf(name, sizeof(name), "%s%u_label", |
503 | hwmon_prefix, hwmon_index); | 478 | hwmon_prefix, hwmon_index); |
504 | rc = efx_mcdi_mon_add_attr( | 479 | efx_mcdi_mon_add_attr( |
505 | efx, name, efx_mcdi_mon_show_label, i, type, 0); | 480 | efx, name, efx_mcdi_mon_show_label, i, type, 0); |
506 | if (rc) | ||
507 | goto fail; | ||
508 | } | 481 | } |
509 | } | 482 | } |
510 | 483 | ||
484 | hwmon_register: | ||
485 | hwmon->groups[0] = &hwmon->group; | ||
486 | hwmon->device = hwmon_device_register_with_groups(&efx->pci_dev->dev, | ||
487 | KBUILD_MODNAME, NULL, | ||
488 | hwmon->groups); | ||
489 | if (IS_ERR(hwmon->device)) { | ||
490 | rc = PTR_ERR(hwmon->device); | ||
491 | goto fail; | ||
492 | } | ||
493 | |||
494 | return 0; | ||
495 | |||
511 | fail: | 496 | fail: |
512 | efx_mcdi_mon_remove(efx); | 497 | efx_mcdi_mon_remove(efx); |
513 | return rc; | 498 | return rc; |
@@ -516,14 +501,11 @@ fail: | |||
516 | void efx_mcdi_mon_remove(struct efx_nic *efx) | 501 | void efx_mcdi_mon_remove(struct efx_nic *efx) |
517 | { | 502 | { |
518 | struct efx_mcdi_mon *hwmon = efx_mcdi_mon(efx); | 503 | struct efx_mcdi_mon *hwmon = efx_mcdi_mon(efx); |
519 | unsigned int i; | ||
520 | 504 | ||
521 | for (i = 0; i < hwmon->n_attrs; i++) | ||
522 | device_remove_file(&efx->pci_dev->dev, | ||
523 | &hwmon->attrs[i].dev_attr); | ||
524 | kfree(hwmon->attrs); | ||
525 | if (hwmon->device) | 505 | if (hwmon->device) |
526 | hwmon_device_unregister(hwmon->device); | 506 | hwmon_device_unregister(hwmon->device); |
507 | kfree(hwmon->attrs); | ||
508 | kfree(hwmon->group.attrs); | ||
527 | efx_nic_free_buffer(efx, &hwmon->dma_buf); | 509 | efx_nic_free_buffer(efx, &hwmon->dma_buf); |
528 | } | 510 | } |
529 | 511 | ||
diff --git a/drivers/net/ethernet/sfc/net_driver.h b/drivers/net/ethernet/sfc/net_driver.h index b14a717ac3e8..542a0d252ae0 100644 --- a/drivers/net/ethernet/sfc/net_driver.h +++ b/drivers/net/ethernet/sfc/net_driver.h | |||
@@ -683,6 +683,8 @@ struct vfdi_status; | |||
683 | * @n_channels: Number of channels in use | 683 | * @n_channels: Number of channels in use |
684 | * @n_rx_channels: Number of channels used for RX (= number of RX queues) | 684 | * @n_rx_channels: Number of channels used for RX (= number of RX queues) |
685 | * @n_tx_channels: Number of channels used for TX | 685 | * @n_tx_channels: Number of channels used for TX |
686 | * @rx_ip_align: RX DMA address offset to have IP header aligned in | ||
687 | * in accordance with NET_IP_ALIGN | ||
686 | * @rx_dma_len: Current maximum RX DMA length | 688 | * @rx_dma_len: Current maximum RX DMA length |
687 | * @rx_buffer_order: Order (log2) of number of pages for each RX buffer | 689 | * @rx_buffer_order: Order (log2) of number of pages for each RX buffer |
688 | * @rx_buffer_truesize: Amortised allocation size of an RX buffer, | 690 | * @rx_buffer_truesize: Amortised allocation size of an RX buffer, |
@@ -816,6 +818,7 @@ struct efx_nic { | |||
816 | unsigned rss_spread; | 818 | unsigned rss_spread; |
817 | unsigned tx_channel_offset; | 819 | unsigned tx_channel_offset; |
818 | unsigned n_tx_channels; | 820 | unsigned n_tx_channels; |
821 | unsigned int rx_ip_align; | ||
819 | unsigned int rx_dma_len; | 822 | unsigned int rx_dma_len; |
820 | unsigned int rx_buffer_order; | 823 | unsigned int rx_buffer_order; |
821 | unsigned int rx_buffer_truesize; | 824 | unsigned int rx_buffer_truesize; |
diff --git a/drivers/net/ethernet/sfc/nic.h b/drivers/net/ethernet/sfc/nic.h index 11b6112d9249..91c63ec79c5f 100644 --- a/drivers/net/ethernet/sfc/nic.h +++ b/drivers/net/ethernet/sfc/nic.h | |||
@@ -560,6 +560,8 @@ void efx_ptp_get_ts_info(struct efx_nic *efx, struct ethtool_ts_info *ts_info); | |||
560 | bool efx_ptp_is_ptp_tx(struct efx_nic *efx, struct sk_buff *skb); | 560 | bool efx_ptp_is_ptp_tx(struct efx_nic *efx, struct sk_buff *skb); |
561 | int efx_ptp_tx(struct efx_nic *efx, struct sk_buff *skb); | 561 | int efx_ptp_tx(struct efx_nic *efx, struct sk_buff *skb); |
562 | void efx_ptp_event(struct efx_nic *efx, efx_qword_t *ev); | 562 | void efx_ptp_event(struct efx_nic *efx, efx_qword_t *ev); |
563 | void efx_ptp_start_datapath(struct efx_nic *efx); | ||
564 | void efx_ptp_stop_datapath(struct efx_nic *efx); | ||
563 | 565 | ||
564 | extern const struct efx_nic_type falcon_a1_nic_type; | 566 | extern const struct efx_nic_type falcon_a1_nic_type; |
565 | extern const struct efx_nic_type falcon_b0_nic_type; | 567 | extern const struct efx_nic_type falcon_b0_nic_type; |
diff --git a/drivers/net/ethernet/sfc/ptp.c b/drivers/net/ethernet/sfc/ptp.c index 03acf57df045..3dd39dcfe36b 100644 --- a/drivers/net/ethernet/sfc/ptp.c +++ b/drivers/net/ethernet/sfc/ptp.c | |||
@@ -220,6 +220,7 @@ struct efx_ptp_timeset { | |||
220 | * @evt_list: List of MC receive events awaiting packets | 220 | * @evt_list: List of MC receive events awaiting packets |
221 | * @evt_free_list: List of free events | 221 | * @evt_free_list: List of free events |
222 | * @evt_lock: Lock for manipulating evt_list and evt_free_list | 222 | * @evt_lock: Lock for manipulating evt_list and evt_free_list |
223 | * @evt_overflow: Boolean indicating that event list has overflowed | ||
223 | * @rx_evts: Instantiated events (on evt_list and evt_free_list) | 224 | * @rx_evts: Instantiated events (on evt_list and evt_free_list) |
224 | * @workwq: Work queue for processing pending PTP operations | 225 | * @workwq: Work queue for processing pending PTP operations |
225 | * @work: Work task | 226 | * @work: Work task |
@@ -270,6 +271,7 @@ struct efx_ptp_data { | |||
270 | struct list_head evt_list; | 271 | struct list_head evt_list; |
271 | struct list_head evt_free_list; | 272 | struct list_head evt_free_list; |
272 | spinlock_t evt_lock; | 273 | spinlock_t evt_lock; |
274 | bool evt_overflow; | ||
273 | struct efx_ptp_event_rx rx_evts[MAX_RECEIVE_EVENTS]; | 275 | struct efx_ptp_event_rx rx_evts[MAX_RECEIVE_EVENTS]; |
274 | struct workqueue_struct *workwq; | 276 | struct workqueue_struct *workwq; |
275 | struct work_struct work; | 277 | struct work_struct work; |
@@ -635,6 +637,11 @@ static void efx_ptp_drop_time_expired_events(struct efx_nic *efx) | |||
635 | } | 637 | } |
636 | } | 638 | } |
637 | } | 639 | } |
640 | /* If the event overflow flag is set and the event list is now empty | ||
641 | * clear the flag to re-enable the overflow warning message. | ||
642 | */ | ||
643 | if (ptp->evt_overflow && list_empty(&ptp->evt_list)) | ||
644 | ptp->evt_overflow = false; | ||
638 | spin_unlock_bh(&ptp->evt_lock); | 645 | spin_unlock_bh(&ptp->evt_lock); |
639 | } | 646 | } |
640 | 647 | ||
@@ -676,6 +683,11 @@ static enum ptp_packet_state efx_ptp_match_rx(struct efx_nic *efx, | |||
676 | break; | 683 | break; |
677 | } | 684 | } |
678 | } | 685 | } |
686 | /* If the event overflow flag is set and the event list is now empty | ||
687 | * clear the flag to re-enable the overflow warning message. | ||
688 | */ | ||
689 | if (ptp->evt_overflow && list_empty(&ptp->evt_list)) | ||
690 | ptp->evt_overflow = false; | ||
679 | spin_unlock_bh(&ptp->evt_lock); | 691 | spin_unlock_bh(&ptp->evt_lock); |
680 | 692 | ||
681 | return rc; | 693 | return rc; |
@@ -705,8 +717,9 @@ static bool efx_ptp_process_events(struct efx_nic *efx, struct sk_buff_head *q) | |||
705 | __skb_queue_tail(q, skb); | 717 | __skb_queue_tail(q, skb); |
706 | } else if (time_after(jiffies, match->expiry)) { | 718 | } else if (time_after(jiffies, match->expiry)) { |
707 | match->state = PTP_PACKET_STATE_TIMED_OUT; | 719 | match->state = PTP_PACKET_STATE_TIMED_OUT; |
708 | netif_warn(efx, rx_err, efx->net_dev, | 720 | if (net_ratelimit()) |
709 | "PTP packet - no timestamp seen\n"); | 721 | netif_warn(efx, rx_err, efx->net_dev, |
722 | "PTP packet - no timestamp seen\n"); | ||
710 | __skb_queue_tail(q, skb); | 723 | __skb_queue_tail(q, skb); |
711 | } else { | 724 | } else { |
712 | /* Replace unprocessed entry and stop */ | 725 | /* Replace unprocessed entry and stop */ |
@@ -788,9 +801,14 @@ fail: | |||
788 | static int efx_ptp_stop(struct efx_nic *efx) | 801 | static int efx_ptp_stop(struct efx_nic *efx) |
789 | { | 802 | { |
790 | struct efx_ptp_data *ptp = efx->ptp_data; | 803 | struct efx_ptp_data *ptp = efx->ptp_data; |
791 | int rc = efx_ptp_disable(efx); | ||
792 | struct list_head *cursor; | 804 | struct list_head *cursor; |
793 | struct list_head *next; | 805 | struct list_head *next; |
806 | int rc; | ||
807 | |||
808 | if (ptp == NULL) | ||
809 | return 0; | ||
810 | |||
811 | rc = efx_ptp_disable(efx); | ||
794 | 812 | ||
795 | if (ptp->rxfilter_installed) { | 813 | if (ptp->rxfilter_installed) { |
796 | efx_filter_remove_id_safe(efx, EFX_FILTER_PRI_REQUIRED, | 814 | efx_filter_remove_id_safe(efx, EFX_FILTER_PRI_REQUIRED, |
@@ -809,11 +827,19 @@ static int efx_ptp_stop(struct efx_nic *efx) | |||
809 | list_for_each_safe(cursor, next, &efx->ptp_data->evt_list) { | 827 | list_for_each_safe(cursor, next, &efx->ptp_data->evt_list) { |
810 | list_move(cursor, &efx->ptp_data->evt_free_list); | 828 | list_move(cursor, &efx->ptp_data->evt_free_list); |
811 | } | 829 | } |
830 | ptp->evt_overflow = false; | ||
812 | spin_unlock_bh(&efx->ptp_data->evt_lock); | 831 | spin_unlock_bh(&efx->ptp_data->evt_lock); |
813 | 832 | ||
814 | return rc; | 833 | return rc; |
815 | } | 834 | } |
816 | 835 | ||
836 | static int efx_ptp_restart(struct efx_nic *efx) | ||
837 | { | ||
838 | if (efx->ptp_data && efx->ptp_data->enabled) | ||
839 | return efx_ptp_start(efx); | ||
840 | return 0; | ||
841 | } | ||
842 | |||
817 | static void efx_ptp_pps_worker(struct work_struct *work) | 843 | static void efx_ptp_pps_worker(struct work_struct *work) |
818 | { | 844 | { |
819 | struct efx_ptp_data *ptp = | 845 | struct efx_ptp_data *ptp = |
@@ -901,6 +927,7 @@ static int efx_ptp_probe_channel(struct efx_channel *channel) | |||
901 | spin_lock_init(&ptp->evt_lock); | 927 | spin_lock_init(&ptp->evt_lock); |
902 | for (pos = 0; pos < MAX_RECEIVE_EVENTS; pos++) | 928 | for (pos = 0; pos < MAX_RECEIVE_EVENTS; pos++) |
903 | list_add(&ptp->rx_evts[pos].link, &ptp->evt_free_list); | 929 | list_add(&ptp->rx_evts[pos].link, &ptp->evt_free_list); |
930 | ptp->evt_overflow = false; | ||
904 | 931 | ||
905 | ptp->phc_clock_info.owner = THIS_MODULE; | 932 | ptp->phc_clock_info.owner = THIS_MODULE; |
906 | snprintf(ptp->phc_clock_info.name, | 933 | snprintf(ptp->phc_clock_info.name, |
@@ -989,7 +1016,11 @@ bool efx_ptp_is_ptp_tx(struct efx_nic *efx, struct sk_buff *skb) | |||
989 | skb->len >= PTP_MIN_LENGTH && | 1016 | skb->len >= PTP_MIN_LENGTH && |
990 | skb->len <= MC_CMD_PTP_IN_TRANSMIT_PACKET_MAXNUM && | 1017 | skb->len <= MC_CMD_PTP_IN_TRANSMIT_PACKET_MAXNUM && |
991 | likely(skb->protocol == htons(ETH_P_IP)) && | 1018 | likely(skb->protocol == htons(ETH_P_IP)) && |
1019 | skb_transport_header_was_set(skb) && | ||
1020 | skb_network_header_len(skb) >= sizeof(struct iphdr) && | ||
992 | ip_hdr(skb)->protocol == IPPROTO_UDP && | 1021 | ip_hdr(skb)->protocol == IPPROTO_UDP && |
1022 | skb_headlen(skb) >= | ||
1023 | skb_transport_offset(skb) + sizeof(struct udphdr) && | ||
993 | udp_hdr(skb)->dest == htons(PTP_EVENT_PORT); | 1024 | udp_hdr(skb)->dest == htons(PTP_EVENT_PORT); |
994 | } | 1025 | } |
995 | 1026 | ||
@@ -1106,7 +1137,7 @@ static int efx_ptp_change_mode(struct efx_nic *efx, bool enable_wanted, | |||
1106 | { | 1137 | { |
1107 | if ((enable_wanted != efx->ptp_data->enabled) || | 1138 | if ((enable_wanted != efx->ptp_data->enabled) || |
1108 | (enable_wanted && (efx->ptp_data->mode != new_mode))) { | 1139 | (enable_wanted && (efx->ptp_data->mode != new_mode))) { |
1109 | int rc; | 1140 | int rc = 0; |
1110 | 1141 | ||
1111 | if (enable_wanted) { | 1142 | if (enable_wanted) { |
1112 | /* Change of mode requires disable */ | 1143 | /* Change of mode requires disable */ |
@@ -1123,7 +1154,8 @@ static int efx_ptp_change_mode(struct efx_nic *efx, bool enable_wanted, | |||
1123 | * succeed. | 1154 | * succeed. |
1124 | */ | 1155 | */ |
1125 | efx->ptp_data->mode = new_mode; | 1156 | efx->ptp_data->mode = new_mode; |
1126 | rc = efx_ptp_start(efx); | 1157 | if (netif_running(efx->net_dev)) |
1158 | rc = efx_ptp_start(efx); | ||
1127 | if (rc == 0) { | 1159 | if (rc == 0) { |
1128 | rc = efx_ptp_synchronize(efx, | 1160 | rc = efx_ptp_synchronize(efx, |
1129 | PTP_SYNC_ATTEMPTS * 2); | 1161 | PTP_SYNC_ATTEMPTS * 2); |
@@ -1295,8 +1327,13 @@ static void ptp_event_rx(struct efx_nic *efx, struct efx_ptp_data *ptp) | |||
1295 | list_add_tail(&evt->link, &ptp->evt_list); | 1327 | list_add_tail(&evt->link, &ptp->evt_list); |
1296 | 1328 | ||
1297 | queue_work(ptp->workwq, &ptp->work); | 1329 | queue_work(ptp->workwq, &ptp->work); |
1298 | } else { | 1330 | } else if (!ptp->evt_overflow) { |
1299 | netif_err(efx, rx_err, efx->net_dev, "No free PTP event"); | 1331 | /* Log a warning message and set the event overflow flag. |
1332 | * The message won't be logged again until the event queue | ||
1333 | * becomes empty. | ||
1334 | */ | ||
1335 | netif_err(efx, rx_err, efx->net_dev, "PTP event queue overflow\n"); | ||
1336 | ptp->evt_overflow = true; | ||
1300 | } | 1337 | } |
1301 | spin_unlock_bh(&ptp->evt_lock); | 1338 | spin_unlock_bh(&ptp->evt_lock); |
1302 | } | 1339 | } |
@@ -1389,7 +1426,7 @@ static int efx_phc_adjfreq(struct ptp_clock_info *ptp, s32 delta) | |||
1389 | if (rc != 0) | 1426 | if (rc != 0) |
1390 | return rc; | 1427 | return rc; |
1391 | 1428 | ||
1392 | ptp_data->current_adjfreq = delta; | 1429 | ptp_data->current_adjfreq = adjustment_ns; |
1393 | return 0; | 1430 | return 0; |
1394 | } | 1431 | } |
1395 | 1432 | ||
@@ -1404,7 +1441,7 @@ static int efx_phc_adjtime(struct ptp_clock_info *ptp, s64 delta) | |||
1404 | 1441 | ||
1405 | MCDI_SET_DWORD(inbuf, PTP_IN_OP, MC_CMD_PTP_OP_ADJUST); | 1442 | MCDI_SET_DWORD(inbuf, PTP_IN_OP, MC_CMD_PTP_OP_ADJUST); |
1406 | MCDI_SET_DWORD(inbuf, PTP_IN_PERIPH_ID, 0); | 1443 | MCDI_SET_DWORD(inbuf, PTP_IN_PERIPH_ID, 0); |
1407 | MCDI_SET_QWORD(inbuf, PTP_IN_ADJUST_FREQ, 0); | 1444 | MCDI_SET_QWORD(inbuf, PTP_IN_ADJUST_FREQ, ptp_data->current_adjfreq); |
1408 | MCDI_SET_DWORD(inbuf, PTP_IN_ADJUST_SECONDS, (u32)delta_ts.tv_sec); | 1445 | MCDI_SET_DWORD(inbuf, PTP_IN_ADJUST_SECONDS, (u32)delta_ts.tv_sec); |
1409 | MCDI_SET_DWORD(inbuf, PTP_IN_ADJUST_NANOSECONDS, (u32)delta_ts.tv_nsec); | 1446 | MCDI_SET_DWORD(inbuf, PTP_IN_ADJUST_NANOSECONDS, (u32)delta_ts.tv_nsec); |
1410 | return efx_mcdi_rpc(efx, MC_CMD_PTP, inbuf, sizeof(inbuf), | 1447 | return efx_mcdi_rpc(efx, MC_CMD_PTP, inbuf, sizeof(inbuf), |
@@ -1491,3 +1528,14 @@ void efx_ptp_probe(struct efx_nic *efx) | |||
1491 | efx->extra_channel_type[EFX_EXTRA_CHANNEL_PTP] = | 1528 | efx->extra_channel_type[EFX_EXTRA_CHANNEL_PTP] = |
1492 | &efx_ptp_channel_type; | 1529 | &efx_ptp_channel_type; |
1493 | } | 1530 | } |
1531 | |||
1532 | void efx_ptp_start_datapath(struct efx_nic *efx) | ||
1533 | { | ||
1534 | if (efx_ptp_restart(efx)) | ||
1535 | netif_err(efx, drv, efx->net_dev, "Failed to restart PTP.\n"); | ||
1536 | } | ||
1537 | |||
1538 | void efx_ptp_stop_datapath(struct efx_nic *efx) | ||
1539 | { | ||
1540 | efx_ptp_stop(efx); | ||
1541 | } | ||
diff --git a/drivers/net/ethernet/sfc/rx.c b/drivers/net/ethernet/sfc/rx.c index 8f09e686fc23..42488df1f4ec 100644 --- a/drivers/net/ethernet/sfc/rx.c +++ b/drivers/net/ethernet/sfc/rx.c | |||
@@ -94,7 +94,7 @@ static inline void efx_sync_rx_buffer(struct efx_nic *efx, | |||
94 | 94 | ||
95 | void efx_rx_config_page_split(struct efx_nic *efx) | 95 | void efx_rx_config_page_split(struct efx_nic *efx) |
96 | { | 96 | { |
97 | efx->rx_page_buf_step = ALIGN(efx->rx_dma_len + NET_IP_ALIGN, | 97 | efx->rx_page_buf_step = ALIGN(efx->rx_dma_len + efx->rx_ip_align, |
98 | EFX_RX_BUF_ALIGNMENT); | 98 | EFX_RX_BUF_ALIGNMENT); |
99 | efx->rx_bufs_per_page = efx->rx_buffer_order ? 1 : | 99 | efx->rx_bufs_per_page = efx->rx_buffer_order ? 1 : |
100 | ((PAGE_SIZE - sizeof(struct efx_rx_page_state)) / | 100 | ((PAGE_SIZE - sizeof(struct efx_rx_page_state)) / |
@@ -189,9 +189,9 @@ static int efx_init_rx_buffers(struct efx_rx_queue *rx_queue) | |||
189 | do { | 189 | do { |
190 | index = rx_queue->added_count & rx_queue->ptr_mask; | 190 | index = rx_queue->added_count & rx_queue->ptr_mask; |
191 | rx_buf = efx_rx_buffer(rx_queue, index); | 191 | rx_buf = efx_rx_buffer(rx_queue, index); |
192 | rx_buf->dma_addr = dma_addr + NET_IP_ALIGN; | 192 | rx_buf->dma_addr = dma_addr + efx->rx_ip_align; |
193 | rx_buf->page = page; | 193 | rx_buf->page = page; |
194 | rx_buf->page_offset = page_offset + NET_IP_ALIGN; | 194 | rx_buf->page_offset = page_offset + efx->rx_ip_align; |
195 | rx_buf->len = efx->rx_dma_len; | 195 | rx_buf->len = efx->rx_dma_len; |
196 | rx_buf->flags = 0; | 196 | rx_buf->flags = 0; |
197 | ++rx_queue->added_count; | 197 | ++rx_queue->added_count; |
diff --git a/drivers/net/ethernet/smsc/smc91x.c b/drivers/net/ethernet/smsc/smc91x.c index 0c9b5d94154f..8bf29eb4a5a0 100644 --- a/drivers/net/ethernet/smsc/smc91x.c +++ b/drivers/net/ethernet/smsc/smc91x.c | |||
@@ -82,6 +82,7 @@ static const char version[] = | |||
82 | #include <linux/mii.h> | 82 | #include <linux/mii.h> |
83 | #include <linux/workqueue.h> | 83 | #include <linux/workqueue.h> |
84 | #include <linux/of.h> | 84 | #include <linux/of.h> |
85 | #include <linux/of_device.h> | ||
85 | 86 | ||
86 | #include <linux/netdevice.h> | 87 | #include <linux/netdevice.h> |
87 | #include <linux/etherdevice.h> | 88 | #include <linux/etherdevice.h> |
@@ -2184,6 +2185,15 @@ static void smc_release_datacs(struct platform_device *pdev, struct net_device * | |||
2184 | } | 2185 | } |
2185 | } | 2186 | } |
2186 | 2187 | ||
2188 | #if IS_BUILTIN(CONFIG_OF) | ||
2189 | static const struct of_device_id smc91x_match[] = { | ||
2190 | { .compatible = "smsc,lan91c94", }, | ||
2191 | { .compatible = "smsc,lan91c111", }, | ||
2192 | {}, | ||
2193 | }; | ||
2194 | MODULE_DEVICE_TABLE(of, smc91x_match); | ||
2195 | #endif | ||
2196 | |||
2187 | /* | 2197 | /* |
2188 | * smc_init(void) | 2198 | * smc_init(void) |
2189 | * Input parameters: | 2199 | * Input parameters: |
@@ -2198,6 +2208,7 @@ static void smc_release_datacs(struct platform_device *pdev, struct net_device * | |||
2198 | static int smc_drv_probe(struct platform_device *pdev) | 2208 | static int smc_drv_probe(struct platform_device *pdev) |
2199 | { | 2209 | { |
2200 | struct smc91x_platdata *pd = dev_get_platdata(&pdev->dev); | 2210 | struct smc91x_platdata *pd = dev_get_platdata(&pdev->dev); |
2211 | const struct of_device_id *match = NULL; | ||
2201 | struct smc_local *lp; | 2212 | struct smc_local *lp; |
2202 | struct net_device *ndev; | 2213 | struct net_device *ndev; |
2203 | struct resource *res, *ires; | 2214 | struct resource *res, *ires; |
@@ -2217,11 +2228,34 @@ static int smc_drv_probe(struct platform_device *pdev) | |||
2217 | */ | 2228 | */ |
2218 | 2229 | ||
2219 | lp = netdev_priv(ndev); | 2230 | lp = netdev_priv(ndev); |
2231 | lp->cfg.flags = 0; | ||
2220 | 2232 | ||
2221 | if (pd) { | 2233 | if (pd) { |
2222 | memcpy(&lp->cfg, pd, sizeof(lp->cfg)); | 2234 | memcpy(&lp->cfg, pd, sizeof(lp->cfg)); |
2223 | lp->io_shift = SMC91X_IO_SHIFT(lp->cfg.flags); | 2235 | lp->io_shift = SMC91X_IO_SHIFT(lp->cfg.flags); |
2224 | } else { | 2236 | } |
2237 | |||
2238 | #if IS_BUILTIN(CONFIG_OF) | ||
2239 | match = of_match_device(of_match_ptr(smc91x_match), &pdev->dev); | ||
2240 | if (match) { | ||
2241 | struct device_node *np = pdev->dev.of_node; | ||
2242 | u32 val; | ||
2243 | |||
2244 | /* Combination of IO widths supported, default to 16-bit */ | ||
2245 | if (!of_property_read_u32(np, "reg-io-width", &val)) { | ||
2246 | if (val & 1) | ||
2247 | lp->cfg.flags |= SMC91X_USE_8BIT; | ||
2248 | if ((val == 0) || (val & 2)) | ||
2249 | lp->cfg.flags |= SMC91X_USE_16BIT; | ||
2250 | if (val & 4) | ||
2251 | lp->cfg.flags |= SMC91X_USE_32BIT; | ||
2252 | } else { | ||
2253 | lp->cfg.flags |= SMC91X_USE_16BIT; | ||
2254 | } | ||
2255 | } | ||
2256 | #endif | ||
2257 | |||
2258 | if (!pd && !match) { | ||
2225 | lp->cfg.flags |= (SMC_CAN_USE_8BIT) ? SMC91X_USE_8BIT : 0; | 2259 | lp->cfg.flags |= (SMC_CAN_USE_8BIT) ? SMC91X_USE_8BIT : 0; |
2226 | lp->cfg.flags |= (SMC_CAN_USE_16BIT) ? SMC91X_USE_16BIT : 0; | 2260 | lp->cfg.flags |= (SMC_CAN_USE_16BIT) ? SMC91X_USE_16BIT : 0; |
2227 | lp->cfg.flags |= (SMC_CAN_USE_32BIT) ? SMC91X_USE_32BIT : 0; | 2261 | lp->cfg.flags |= (SMC_CAN_USE_32BIT) ? SMC91X_USE_32BIT : 0; |
@@ -2370,15 +2404,6 @@ static int smc_drv_resume(struct device *dev) | |||
2370 | return 0; | 2404 | return 0; |
2371 | } | 2405 | } |
2372 | 2406 | ||
2373 | #ifdef CONFIG_OF | ||
2374 | static const struct of_device_id smc91x_match[] = { | ||
2375 | { .compatible = "smsc,lan91c94", }, | ||
2376 | { .compatible = "smsc,lan91c111", }, | ||
2377 | {}, | ||
2378 | }; | ||
2379 | MODULE_DEVICE_TABLE(of, smc91x_match); | ||
2380 | #endif | ||
2381 | |||
2382 | static struct dev_pm_ops smc_drv_pm_ops = { | 2407 | static struct dev_pm_ops smc_drv_pm_ops = { |
2383 | .suspend = smc_drv_suspend, | 2408 | .suspend = smc_drv_suspend, |
2384 | .resume = smc_drv_resume, | 2409 | .resume = smc_drv_resume, |
diff --git a/drivers/net/ethernet/smsc/smc91x.h b/drivers/net/ethernet/smsc/smc91x.h index c9d4c872e81d..749654b976bc 100644 --- a/drivers/net/ethernet/smsc/smc91x.h +++ b/drivers/net/ethernet/smsc/smc91x.h | |||
@@ -46,7 +46,8 @@ | |||
46 | defined(CONFIG_MACH_LITTLETON) ||\ | 46 | defined(CONFIG_MACH_LITTLETON) ||\ |
47 | defined(CONFIG_MACH_ZYLONITE2) ||\ | 47 | defined(CONFIG_MACH_ZYLONITE2) ||\ |
48 | defined(CONFIG_ARCH_VIPER) ||\ | 48 | defined(CONFIG_ARCH_VIPER) ||\ |
49 | defined(CONFIG_MACH_STARGATE2) | 49 | defined(CONFIG_MACH_STARGATE2) ||\ |
50 | defined(CONFIG_ARCH_VERSATILE) | ||
50 | 51 | ||
51 | #include <asm/mach-types.h> | 52 | #include <asm/mach-types.h> |
52 | 53 | ||
@@ -154,6 +155,8 @@ static inline void SMC_outw(u16 val, void __iomem *ioaddr, int reg) | |||
154 | #define SMC_outl(v, a, r) writel(v, (a) + (r)) | 155 | #define SMC_outl(v, a, r) writel(v, (a) + (r)) |
155 | #define SMC_insl(a, r, p, l) readsl((a) + (r), p, l) | 156 | #define SMC_insl(a, r, p, l) readsl((a) + (r), p, l) |
156 | #define SMC_outsl(a, r, p, l) writesl((a) + (r), p, l) | 157 | #define SMC_outsl(a, r, p, l) writesl((a) + (r), p, l) |
158 | #define SMC_insw(a, r, p, l) readsw((a) + (r), p, l) | ||
159 | #define SMC_outsw(a, r, p, l) writesw((a) + (r), p, l) | ||
157 | #define SMC_IRQ_FLAGS (-1) /* from resource */ | 160 | #define SMC_IRQ_FLAGS (-1) /* from resource */ |
158 | 161 | ||
159 | /* We actually can't write halfwords properly if not word aligned */ | 162 | /* We actually can't write halfwords properly if not word aligned */ |
@@ -206,23 +209,6 @@ SMC_outw(u16 val, void __iomem *ioaddr, int reg) | |||
206 | #define RPC_LSA_DEFAULT RPC_LED_TX_RX | 209 | #define RPC_LSA_DEFAULT RPC_LED_TX_RX |
207 | #define RPC_LSB_DEFAULT RPC_LED_100_10 | 210 | #define RPC_LSB_DEFAULT RPC_LED_100_10 |
208 | 211 | ||
209 | #elif defined(CONFIG_ARCH_VERSATILE) | ||
210 | |||
211 | #define SMC_CAN_USE_8BIT 1 | ||
212 | #define SMC_CAN_USE_16BIT 1 | ||
213 | #define SMC_CAN_USE_32BIT 1 | ||
214 | #define SMC_NOWAIT 1 | ||
215 | |||
216 | #define SMC_inb(a, r) readb((a) + (r)) | ||
217 | #define SMC_inw(a, r) readw((a) + (r)) | ||
218 | #define SMC_inl(a, r) readl((a) + (r)) | ||
219 | #define SMC_outb(v, a, r) writeb(v, (a) + (r)) | ||
220 | #define SMC_outw(v, a, r) writew(v, (a) + (r)) | ||
221 | #define SMC_outl(v, a, r) writel(v, (a) + (r)) | ||
222 | #define SMC_insl(a, r, p, l) readsl((a) + (r), p, l) | ||
223 | #define SMC_outsl(a, r, p, l) writesl((a) + (r), p, l) | ||
224 | #define SMC_IRQ_FLAGS (-1) /* from resource */ | ||
225 | |||
226 | #elif defined(CONFIG_MN10300) | 212 | #elif defined(CONFIG_MN10300) |
227 | 213 | ||
228 | /* | 214 | /* |
diff --git a/drivers/net/ethernet/tehuti/tehuti.c b/drivers/net/ethernet/tehuti/tehuti.c index dd0dd6279b4e..4f1d2549130e 100644 --- a/drivers/net/ethernet/tehuti/tehuti.c +++ b/drivers/net/ethernet/tehuti/tehuti.c | |||
@@ -2019,7 +2019,6 @@ bdx_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
2019 | ndev->features = NETIF_F_IP_CSUM | NETIF_F_SG | NETIF_F_TSO | 2019 | ndev->features = NETIF_F_IP_CSUM | NETIF_F_SG | NETIF_F_TSO |
2020 | | NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_CTAG_RX | | 2020 | | NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_CTAG_RX | |
2021 | NETIF_F_HW_VLAN_CTAG_FILTER | NETIF_F_RXCSUM | 2021 | NETIF_F_HW_VLAN_CTAG_FILTER | NETIF_F_RXCSUM |
2022 | /*| NETIF_F_FRAGLIST */ | ||
2023 | ; | 2022 | ; |
2024 | ndev->hw_features = NETIF_F_IP_CSUM | NETIF_F_SG | | 2023 | ndev->hw_features = NETIF_F_IP_CSUM | NETIF_F_SG | |
2025 | NETIF_F_TSO | NETIF_F_HW_VLAN_CTAG_TX; | 2024 | NETIF_F_TSO | NETIF_F_HW_VLAN_CTAG_TX; |
diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c index 7536a4c01293..5120d9ce1dd4 100644 --- a/drivers/net/ethernet/ti/cpsw.c +++ b/drivers/net/ethernet/ti/cpsw.c | |||
@@ -1151,6 +1151,12 @@ static int cpsw_ndo_open(struct net_device *ndev) | |||
1151 | * receive descs | 1151 | * receive descs |
1152 | */ | 1152 | */ |
1153 | cpsw_info(priv, ifup, "submitted %d rx descriptors\n", i); | 1153 | cpsw_info(priv, ifup, "submitted %d rx descriptors\n", i); |
1154 | |||
1155 | if (cpts_register(&priv->pdev->dev, priv->cpts, | ||
1156 | priv->data.cpts_clock_mult, | ||
1157 | priv->data.cpts_clock_shift)) | ||
1158 | dev_err(priv->dev, "error registering cpts device\n"); | ||
1159 | |||
1154 | } | 1160 | } |
1155 | 1161 | ||
1156 | /* Enable Interrupt pacing if configured */ | 1162 | /* Enable Interrupt pacing if configured */ |
@@ -1197,6 +1203,7 @@ static int cpsw_ndo_stop(struct net_device *ndev) | |||
1197 | netif_carrier_off(priv->ndev); | 1203 | netif_carrier_off(priv->ndev); |
1198 | 1204 | ||
1199 | if (cpsw_common_res_usage_state(priv) <= 1) { | 1205 | if (cpsw_common_res_usage_state(priv) <= 1) { |
1206 | cpts_unregister(priv->cpts); | ||
1200 | cpsw_intr_disable(priv); | 1207 | cpsw_intr_disable(priv); |
1201 | cpdma_ctlr_int_ctrl(priv->dma, false); | 1208 | cpdma_ctlr_int_ctrl(priv->dma, false); |
1202 | cpdma_ctlr_stop(priv->dma); | 1209 | cpdma_ctlr_stop(priv->dma); |
@@ -1816,6 +1823,8 @@ static int cpsw_probe_dt(struct cpsw_platform_data *data, | |||
1816 | } | 1823 | } |
1817 | 1824 | ||
1818 | i++; | 1825 | i++; |
1826 | if (i == data->slaves) | ||
1827 | break; | ||
1819 | } | 1828 | } |
1820 | 1829 | ||
1821 | return 0; | 1830 | return 0; |
@@ -1983,9 +1992,15 @@ static int cpsw_probe(struct platform_device *pdev) | |||
1983 | goto clean_runtime_disable_ret; | 1992 | goto clean_runtime_disable_ret; |
1984 | } | 1993 | } |
1985 | priv->regs = ss_regs; | 1994 | priv->regs = ss_regs; |
1986 | priv->version = __raw_readl(&priv->regs->id_ver); | ||
1987 | priv->host_port = HOST_PORT_NUM; | 1995 | priv->host_port = HOST_PORT_NUM; |
1988 | 1996 | ||
1997 | /* Need to enable clocks with runtime PM api to access module | ||
1998 | * registers | ||
1999 | */ | ||
2000 | pm_runtime_get_sync(&pdev->dev); | ||
2001 | priv->version = readl(&priv->regs->id_ver); | ||
2002 | pm_runtime_put_sync(&pdev->dev); | ||
2003 | |||
1989 | res = platform_get_resource(pdev, IORESOURCE_MEM, 1); | 2004 | res = platform_get_resource(pdev, IORESOURCE_MEM, 1); |
1990 | priv->wr_regs = devm_ioremap_resource(&pdev->dev, res); | 2005 | priv->wr_regs = devm_ioremap_resource(&pdev->dev, res); |
1991 | if (IS_ERR(priv->wr_regs)) { | 2006 | if (IS_ERR(priv->wr_regs)) { |
@@ -2155,8 +2170,6 @@ static int cpsw_remove(struct platform_device *pdev) | |||
2155 | unregister_netdev(cpsw_get_slave_ndev(priv, 1)); | 2170 | unregister_netdev(cpsw_get_slave_ndev(priv, 1)); |
2156 | unregister_netdev(ndev); | 2171 | unregister_netdev(ndev); |
2157 | 2172 | ||
2158 | cpts_unregister(priv->cpts); | ||
2159 | |||
2160 | cpsw_ale_destroy(priv->ale); | 2173 | cpsw_ale_destroy(priv->ale); |
2161 | cpdma_chan_destroy(priv->txch); | 2174 | cpdma_chan_destroy(priv->txch); |
2162 | cpdma_chan_destroy(priv->rxch); | 2175 | cpdma_chan_destroy(priv->rxch); |
diff --git a/drivers/net/ethernet/ti/davinci_emac.c b/drivers/net/ethernet/ti/davinci_emac.c index 41ba974bf37c..cd9b164a0434 100644 --- a/drivers/net/ethernet/ti/davinci_emac.c +++ b/drivers/net/ethernet/ti/davinci_emac.c | |||
@@ -61,6 +61,7 @@ | |||
61 | #include <linux/davinci_emac.h> | 61 | #include <linux/davinci_emac.h> |
62 | #include <linux/of.h> | 62 | #include <linux/of.h> |
63 | #include <linux/of_address.h> | 63 | #include <linux/of_address.h> |
64 | #include <linux/of_device.h> | ||
64 | #include <linux/of_irq.h> | 65 | #include <linux/of_irq.h> |
65 | #include <linux/of_net.h> | 66 | #include <linux/of_net.h> |
66 | 67 | ||
@@ -1752,10 +1753,14 @@ static const struct net_device_ops emac_netdev_ops = { | |||
1752 | #endif | 1753 | #endif |
1753 | }; | 1754 | }; |
1754 | 1755 | ||
1756 | static const struct of_device_id davinci_emac_of_match[]; | ||
1757 | |||
1755 | static struct emac_platform_data * | 1758 | static struct emac_platform_data * |
1756 | davinci_emac_of_get_pdata(struct platform_device *pdev, struct emac_priv *priv) | 1759 | davinci_emac_of_get_pdata(struct platform_device *pdev, struct emac_priv *priv) |
1757 | { | 1760 | { |
1758 | struct device_node *np; | 1761 | struct device_node *np; |
1762 | const struct of_device_id *match; | ||
1763 | const struct emac_platform_data *auxdata; | ||
1759 | struct emac_platform_data *pdata = NULL; | 1764 | struct emac_platform_data *pdata = NULL; |
1760 | const u8 *mac_addr; | 1765 | const u8 *mac_addr; |
1761 | 1766 | ||
@@ -1793,7 +1798,20 @@ davinci_emac_of_get_pdata(struct platform_device *pdev, struct emac_priv *priv) | |||
1793 | 1798 | ||
1794 | priv->phy_node = of_parse_phandle(np, "phy-handle", 0); | 1799 | priv->phy_node = of_parse_phandle(np, "phy-handle", 0); |
1795 | if (!priv->phy_node) | 1800 | if (!priv->phy_node) |
1796 | pdata->phy_id = ""; | 1801 | pdata->phy_id = NULL; |
1802 | |||
1803 | auxdata = pdev->dev.platform_data; | ||
1804 | if (auxdata) { | ||
1805 | pdata->interrupt_enable = auxdata->interrupt_enable; | ||
1806 | pdata->interrupt_disable = auxdata->interrupt_disable; | ||
1807 | } | ||
1808 | |||
1809 | match = of_match_device(davinci_emac_of_match, &pdev->dev); | ||
1810 | if (match && match->data) { | ||
1811 | auxdata = match->data; | ||
1812 | pdata->version = auxdata->version; | ||
1813 | pdata->hw_ram_addr = auxdata->hw_ram_addr; | ||
1814 | } | ||
1797 | 1815 | ||
1798 | pdev->dev.platform_data = pdata; | 1816 | pdev->dev.platform_data = pdata; |
1799 | 1817 | ||
@@ -2020,8 +2038,14 @@ static const struct dev_pm_ops davinci_emac_pm_ops = { | |||
2020 | }; | 2038 | }; |
2021 | 2039 | ||
2022 | #if IS_ENABLED(CONFIG_OF) | 2040 | #if IS_ENABLED(CONFIG_OF) |
2041 | static const struct emac_platform_data am3517_emac_data = { | ||
2042 | .version = EMAC_VERSION_2, | ||
2043 | .hw_ram_addr = 0x01e20000, | ||
2044 | }; | ||
2045 | |||
2023 | static const struct of_device_id davinci_emac_of_match[] = { | 2046 | static const struct of_device_id davinci_emac_of_match[] = { |
2024 | {.compatible = "ti,davinci-dm6467-emac", }, | 2047 | {.compatible = "ti,davinci-dm6467-emac", }, |
2048 | {.compatible = "ti,am3517-emac", .data = &am3517_emac_data, }, | ||
2025 | {}, | 2049 | {}, |
2026 | }; | 2050 | }; |
2027 | MODULE_DEVICE_TABLE(of, davinci_emac_of_match); | 2051 | MODULE_DEVICE_TABLE(of, davinci_emac_of_match); |
diff --git a/drivers/net/ethernet/via/via-velocity.c b/drivers/net/ethernet/via/via-velocity.c index d022bf936572..ad61d26a44f3 100644 --- a/drivers/net/ethernet/via/via-velocity.c +++ b/drivers/net/ethernet/via/via-velocity.c | |||
@@ -2172,16 +2172,13 @@ static int velocity_poll(struct napi_struct *napi, int budget) | |||
2172 | unsigned int rx_done; | 2172 | unsigned int rx_done; |
2173 | unsigned long flags; | 2173 | unsigned long flags; |
2174 | 2174 | ||
2175 | spin_lock_irqsave(&vptr->lock, flags); | ||
2176 | /* | 2175 | /* |
2177 | * Do rx and tx twice for performance (taken from the VIA | 2176 | * Do rx and tx twice for performance (taken from the VIA |
2178 | * out-of-tree driver). | 2177 | * out-of-tree driver). |
2179 | */ | 2178 | */ |
2180 | rx_done = velocity_rx_srv(vptr, budget / 2); | 2179 | rx_done = velocity_rx_srv(vptr, budget); |
2181 | velocity_tx_srv(vptr); | 2180 | spin_lock_irqsave(&vptr->lock, flags); |
2182 | rx_done += velocity_rx_srv(vptr, budget - rx_done); | ||
2183 | velocity_tx_srv(vptr); | 2181 | velocity_tx_srv(vptr); |
2184 | |||
2185 | /* If budget not fully consumed, exit the polling mode */ | 2182 | /* If budget not fully consumed, exit the polling mode */ |
2186 | if (rx_done < budget) { | 2183 | if (rx_done < budget) { |
2187 | napi_complete(napi); | 2184 | napi_complete(napi); |
@@ -2342,6 +2339,8 @@ static int velocity_change_mtu(struct net_device *dev, int new_mtu) | |||
2342 | if (ret < 0) | 2339 | if (ret < 0) |
2343 | goto out_free_tmp_vptr_1; | 2340 | goto out_free_tmp_vptr_1; |
2344 | 2341 | ||
2342 | napi_disable(&vptr->napi); | ||
2343 | |||
2345 | spin_lock_irqsave(&vptr->lock, flags); | 2344 | spin_lock_irqsave(&vptr->lock, flags); |
2346 | 2345 | ||
2347 | netif_stop_queue(dev); | 2346 | netif_stop_queue(dev); |
@@ -2362,6 +2361,8 @@ static int velocity_change_mtu(struct net_device *dev, int new_mtu) | |||
2362 | 2361 | ||
2363 | velocity_give_many_rx_descs(vptr); | 2362 | velocity_give_many_rx_descs(vptr); |
2364 | 2363 | ||
2364 | napi_enable(&vptr->napi); | ||
2365 | |||
2365 | mac_enable_int(vptr->mac_regs); | 2366 | mac_enable_int(vptr->mac_regs); |
2366 | netif_start_queue(dev); | 2367 | netif_start_queue(dev); |
2367 | 2368 | ||
diff --git a/drivers/net/ethernet/xilinx/ll_temac_main.c b/drivers/net/ethernet/xilinx/ll_temac_main.c index 1f2364126323..2166e879a096 100644 --- a/drivers/net/ethernet/xilinx/ll_temac_main.c +++ b/drivers/net/ethernet/xilinx/ll_temac_main.c | |||
@@ -1017,7 +1017,7 @@ static int temac_of_probe(struct platform_device *op) | |||
1017 | platform_set_drvdata(op, ndev); | 1017 | platform_set_drvdata(op, ndev); |
1018 | SET_NETDEV_DEV(ndev, &op->dev); | 1018 | SET_NETDEV_DEV(ndev, &op->dev); |
1019 | ndev->flags &= ~IFF_MULTICAST; /* clear multicast */ | 1019 | ndev->flags &= ~IFF_MULTICAST; /* clear multicast */ |
1020 | ndev->features = NETIF_F_SG | NETIF_F_FRAGLIST; | 1020 | ndev->features = NETIF_F_SG; |
1021 | ndev->netdev_ops = &temac_netdev_ops; | 1021 | ndev->netdev_ops = &temac_netdev_ops; |
1022 | ndev->ethtool_ops = &temac_ethtool_ops; | 1022 | ndev->ethtool_ops = &temac_ethtool_ops; |
1023 | #if 0 | 1023 | #if 0 |
diff --git a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c index b2ff038d6d20..f9293da19e26 100644 --- a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c +++ b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c | |||
@@ -1486,7 +1486,7 @@ static int axienet_of_probe(struct platform_device *op) | |||
1486 | 1486 | ||
1487 | SET_NETDEV_DEV(ndev, &op->dev); | 1487 | SET_NETDEV_DEV(ndev, &op->dev); |
1488 | ndev->flags &= ~IFF_MULTICAST; /* clear multicast */ | 1488 | ndev->flags &= ~IFF_MULTICAST; /* clear multicast */ |
1489 | ndev->features = NETIF_F_SG | NETIF_F_FRAGLIST; | 1489 | ndev->features = NETIF_F_SG; |
1490 | ndev->netdev_ops = &axienet_netdev_ops; | 1490 | ndev->netdev_ops = &axienet_netdev_ops; |
1491 | ndev->ethtool_ops = &axienet_ethtool_ops; | 1491 | ndev->ethtool_ops = &axienet_ethtool_ops; |
1492 | 1492 | ||
diff --git a/drivers/net/ethernet/xilinx/xilinx_emaclite.c b/drivers/net/ethernet/xilinx/xilinx_emaclite.c index 74234a51c851..fefb8cd5eb65 100644 --- a/drivers/net/ethernet/xilinx/xilinx_emaclite.c +++ b/drivers/net/ethernet/xilinx/xilinx_emaclite.c | |||
@@ -163,26 +163,9 @@ static void xemaclite_enable_interrupts(struct net_local *drvdata) | |||
163 | __raw_writel(reg_data | XEL_TSR_XMIT_IE_MASK, | 163 | __raw_writel(reg_data | XEL_TSR_XMIT_IE_MASK, |
164 | drvdata->base_addr + XEL_TSR_OFFSET); | 164 | drvdata->base_addr + XEL_TSR_OFFSET); |
165 | 165 | ||
166 | /* Enable the Tx interrupts for the second Buffer if | ||
167 | * configured in HW */ | ||
168 | if (drvdata->tx_ping_pong != 0) { | ||
169 | reg_data = __raw_readl(drvdata->base_addr + | ||
170 | XEL_BUFFER_OFFSET + XEL_TSR_OFFSET); | ||
171 | __raw_writel(reg_data | XEL_TSR_XMIT_IE_MASK, | ||
172 | drvdata->base_addr + XEL_BUFFER_OFFSET + | ||
173 | XEL_TSR_OFFSET); | ||
174 | } | ||
175 | |||
176 | /* Enable the Rx interrupts for the first buffer */ | 166 | /* Enable the Rx interrupts for the first buffer */ |
177 | __raw_writel(XEL_RSR_RECV_IE_MASK, drvdata->base_addr + XEL_RSR_OFFSET); | 167 | __raw_writel(XEL_RSR_RECV_IE_MASK, drvdata->base_addr + XEL_RSR_OFFSET); |
178 | 168 | ||
179 | /* Enable the Rx interrupts for the second Buffer if | ||
180 | * configured in HW */ | ||
181 | if (drvdata->rx_ping_pong != 0) { | ||
182 | __raw_writel(XEL_RSR_RECV_IE_MASK, drvdata->base_addr + | ||
183 | XEL_BUFFER_OFFSET + XEL_RSR_OFFSET); | ||
184 | } | ||
185 | |||
186 | /* Enable the Global Interrupt Enable */ | 169 | /* Enable the Global Interrupt Enable */ |
187 | __raw_writel(XEL_GIER_GIE_MASK, drvdata->base_addr + XEL_GIER_OFFSET); | 170 | __raw_writel(XEL_GIER_GIE_MASK, drvdata->base_addr + XEL_GIER_OFFSET); |
188 | } | 171 | } |
@@ -206,31 +189,10 @@ static void xemaclite_disable_interrupts(struct net_local *drvdata) | |||
206 | __raw_writel(reg_data & (~XEL_TSR_XMIT_IE_MASK), | 189 | __raw_writel(reg_data & (~XEL_TSR_XMIT_IE_MASK), |
207 | drvdata->base_addr + XEL_TSR_OFFSET); | 190 | drvdata->base_addr + XEL_TSR_OFFSET); |
208 | 191 | ||
209 | /* Disable the Tx interrupts for the second Buffer | ||
210 | * if configured in HW */ | ||
211 | if (drvdata->tx_ping_pong != 0) { | ||
212 | reg_data = __raw_readl(drvdata->base_addr + XEL_BUFFER_OFFSET + | ||
213 | XEL_TSR_OFFSET); | ||
214 | __raw_writel(reg_data & (~XEL_TSR_XMIT_IE_MASK), | ||
215 | drvdata->base_addr + XEL_BUFFER_OFFSET + | ||
216 | XEL_TSR_OFFSET); | ||
217 | } | ||
218 | |||
219 | /* Disable the Rx interrupts for the first buffer */ | 192 | /* Disable the Rx interrupts for the first buffer */ |
220 | reg_data = __raw_readl(drvdata->base_addr + XEL_RSR_OFFSET); | 193 | reg_data = __raw_readl(drvdata->base_addr + XEL_RSR_OFFSET); |
221 | __raw_writel(reg_data & (~XEL_RSR_RECV_IE_MASK), | 194 | __raw_writel(reg_data & (~XEL_RSR_RECV_IE_MASK), |
222 | drvdata->base_addr + XEL_RSR_OFFSET); | 195 | drvdata->base_addr + XEL_RSR_OFFSET); |
223 | |||
224 | /* Disable the Rx interrupts for the second buffer | ||
225 | * if configured in HW */ | ||
226 | if (drvdata->rx_ping_pong != 0) { | ||
227 | |||
228 | reg_data = __raw_readl(drvdata->base_addr + XEL_BUFFER_OFFSET + | ||
229 | XEL_RSR_OFFSET); | ||
230 | __raw_writel(reg_data & (~XEL_RSR_RECV_IE_MASK), | ||
231 | drvdata->base_addr + XEL_BUFFER_OFFSET + | ||
232 | XEL_RSR_OFFSET); | ||
233 | } | ||
234 | } | 196 | } |
235 | 197 | ||
236 | /** | 198 | /** |
@@ -258,6 +220,13 @@ static void xemaclite_aligned_write(void *src_ptr, u32 *dest_ptr, | |||
258 | *to_u16_ptr++ = *from_u16_ptr++; | 220 | *to_u16_ptr++ = *from_u16_ptr++; |
259 | *to_u16_ptr++ = *from_u16_ptr++; | 221 | *to_u16_ptr++ = *from_u16_ptr++; |
260 | 222 | ||
223 | /* This barrier resolves occasional issues seen around | ||
224 | * cases where the data is not properly flushed out | ||
225 | * from the processor store buffers to the destination | ||
226 | * memory locations. | ||
227 | */ | ||
228 | wmb(); | ||
229 | |||
261 | /* Output a word */ | 230 | /* Output a word */ |
262 | *to_u32_ptr++ = align_buffer; | 231 | *to_u32_ptr++ = align_buffer; |
263 | } | 232 | } |
@@ -273,6 +242,12 @@ static void xemaclite_aligned_write(void *src_ptr, u32 *dest_ptr, | |||
273 | for (; length > 0; length--) | 242 | for (; length > 0; length--) |
274 | *to_u8_ptr++ = *from_u8_ptr++; | 243 | *to_u8_ptr++ = *from_u8_ptr++; |
275 | 244 | ||
245 | /* This barrier resolves occasional issues seen around | ||
246 | * cases where the data is not properly flushed out | ||
247 | * from the processor store buffers to the destination | ||
248 | * memory locations. | ||
249 | */ | ||
250 | wmb(); | ||
276 | *to_u32_ptr = align_buffer; | 251 | *to_u32_ptr = align_buffer; |
277 | } | 252 | } |
278 | } | 253 | } |
diff --git a/drivers/net/macvtap.c b/drivers/net/macvtap.c index dc76670c2f2a..2a89da080317 100644 --- a/drivers/net/macvtap.c +++ b/drivers/net/macvtap.c | |||
@@ -744,7 +744,7 @@ err: | |||
744 | rcu_read_lock(); | 744 | rcu_read_lock(); |
745 | vlan = rcu_dereference(q->vlan); | 745 | vlan = rcu_dereference(q->vlan); |
746 | if (vlan) | 746 | if (vlan) |
747 | vlan->dev->stats.tx_dropped++; | 747 | this_cpu_inc(vlan->pcpu_stats->tx_dropped); |
748 | rcu_read_unlock(); | 748 | rcu_read_unlock(); |
749 | 749 | ||
750 | return err; | 750 | return err; |
@@ -767,11 +767,10 @@ static ssize_t macvtap_put_user(struct macvtap_queue *q, | |||
767 | const struct sk_buff *skb, | 767 | const struct sk_buff *skb, |
768 | const struct iovec *iv, int len) | 768 | const struct iovec *iv, int len) |
769 | { | 769 | { |
770 | struct macvlan_dev *vlan; | ||
771 | int ret; | 770 | int ret; |
772 | int vnet_hdr_len = 0; | 771 | int vnet_hdr_len = 0; |
773 | int vlan_offset = 0; | 772 | int vlan_offset = 0; |
774 | int copied; | 773 | int copied, total; |
775 | 774 | ||
776 | if (q->flags & IFF_VNET_HDR) { | 775 | if (q->flags & IFF_VNET_HDR) { |
777 | struct virtio_net_hdr vnet_hdr; | 776 | struct virtio_net_hdr vnet_hdr; |
@@ -786,7 +785,8 @@ static ssize_t macvtap_put_user(struct macvtap_queue *q, | |||
786 | if (memcpy_toiovecend(iv, (void *)&vnet_hdr, 0, sizeof(vnet_hdr))) | 785 | if (memcpy_toiovecend(iv, (void *)&vnet_hdr, 0, sizeof(vnet_hdr))) |
787 | return -EFAULT; | 786 | return -EFAULT; |
788 | } | 787 | } |
789 | copied = vnet_hdr_len; | 788 | total = copied = vnet_hdr_len; |
789 | total += skb->len; | ||
790 | 790 | ||
791 | if (!vlan_tx_tag_present(skb)) | 791 | if (!vlan_tx_tag_present(skb)) |
792 | len = min_t(int, skb->len, len); | 792 | len = min_t(int, skb->len, len); |
@@ -801,6 +801,7 @@ static ssize_t macvtap_put_user(struct macvtap_queue *q, | |||
801 | 801 | ||
802 | vlan_offset = offsetof(struct vlan_ethhdr, h_vlan_proto); | 802 | vlan_offset = offsetof(struct vlan_ethhdr, h_vlan_proto); |
803 | len = min_t(int, skb->len + VLAN_HLEN, len); | 803 | len = min_t(int, skb->len + VLAN_HLEN, len); |
804 | total += VLAN_HLEN; | ||
804 | 805 | ||
805 | copy = min_t(int, vlan_offset, len); | 806 | copy = min_t(int, vlan_offset, len); |
806 | ret = skb_copy_datagram_const_iovec(skb, 0, iv, copied, copy); | 807 | ret = skb_copy_datagram_const_iovec(skb, 0, iv, copied, copy); |
@@ -818,19 +819,9 @@ static ssize_t macvtap_put_user(struct macvtap_queue *q, | |||
818 | } | 819 | } |
819 | 820 | ||
820 | ret = skb_copy_datagram_const_iovec(skb, vlan_offset, iv, copied, len); | 821 | ret = skb_copy_datagram_const_iovec(skb, vlan_offset, iv, copied, len); |
821 | copied += len; | ||
822 | 822 | ||
823 | done: | 823 | done: |
824 | rcu_read_lock(); | 824 | return ret ? ret : total; |
825 | vlan = rcu_dereference(q->vlan); | ||
826 | if (vlan) { | ||
827 | preempt_disable(); | ||
828 | macvlan_count_rx(vlan, copied - vnet_hdr_len, ret == 0, 0); | ||
829 | preempt_enable(); | ||
830 | } | ||
831 | rcu_read_unlock(); | ||
832 | |||
833 | return ret ? ret : copied; | ||
834 | } | 825 | } |
835 | 826 | ||
836 | static ssize_t macvtap_do_read(struct macvtap_queue *q, struct kiocb *iocb, | 827 | static ssize_t macvtap_do_read(struct macvtap_queue *q, struct kiocb *iocb, |
@@ -885,7 +876,9 @@ static ssize_t macvtap_aio_read(struct kiocb *iocb, const struct iovec *iv, | |||
885 | } | 876 | } |
886 | 877 | ||
887 | ret = macvtap_do_read(q, iocb, iv, len, file->f_flags & O_NONBLOCK); | 878 | ret = macvtap_do_read(q, iocb, iv, len, file->f_flags & O_NONBLOCK); |
888 | ret = min_t(ssize_t, ret, len); /* XXX copied from tun.c. Why? */ | 879 | ret = min_t(ssize_t, ret, len); |
880 | if (ret > 0) | ||
881 | iocb->ki_pos = ret; | ||
889 | out: | 882 | out: |
890 | return ret; | 883 | return ret; |
891 | } | 884 | } |
diff --git a/drivers/net/phy/micrel.c b/drivers/net/phy/micrel.c index 3ae28f420868..26fa05a472b4 100644 --- a/drivers/net/phy/micrel.c +++ b/drivers/net/phy/micrel.c | |||
@@ -336,6 +336,21 @@ static struct phy_driver ksphy_driver[] = { | |||
336 | .resume = genphy_resume, | 336 | .resume = genphy_resume, |
337 | .driver = { .owner = THIS_MODULE,}, | 337 | .driver = { .owner = THIS_MODULE,}, |
338 | }, { | 338 | }, { |
339 | .phy_id = PHY_ID_KSZ8041RNLI, | ||
340 | .phy_id_mask = 0x00fffff0, | ||
341 | .name = "Micrel KSZ8041RNLI", | ||
342 | .features = PHY_BASIC_FEATURES | | ||
343 | SUPPORTED_Pause | SUPPORTED_Asym_Pause, | ||
344 | .flags = PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT, | ||
345 | .config_init = kszphy_config_init, | ||
346 | .config_aneg = genphy_config_aneg, | ||
347 | .read_status = genphy_read_status, | ||
348 | .ack_interrupt = kszphy_ack_interrupt, | ||
349 | .config_intr = kszphy_config_intr, | ||
350 | .suspend = genphy_suspend, | ||
351 | .resume = genphy_resume, | ||
352 | .driver = { .owner = THIS_MODULE,}, | ||
353 | }, { | ||
339 | .phy_id = PHY_ID_KSZ8051, | 354 | .phy_id = PHY_ID_KSZ8051, |
340 | .phy_id_mask = 0x00fffff0, | 355 | .phy_id_mask = 0x00fffff0, |
341 | .name = "Micrel KSZ8051", | 356 | .name = "Micrel KSZ8051", |
diff --git a/drivers/net/phy/vitesse.c b/drivers/net/phy/vitesse.c index 508e4359338b..14372c65a7e8 100644 --- a/drivers/net/phy/vitesse.c +++ b/drivers/net/phy/vitesse.c | |||
@@ -64,6 +64,7 @@ | |||
64 | 64 | ||
65 | #define PHY_ID_VSC8234 0x000fc620 | 65 | #define PHY_ID_VSC8234 0x000fc620 |
66 | #define PHY_ID_VSC8244 0x000fc6c0 | 66 | #define PHY_ID_VSC8244 0x000fc6c0 |
67 | #define PHY_ID_VSC8514 0x00070670 | ||
67 | #define PHY_ID_VSC8574 0x000704a0 | 68 | #define PHY_ID_VSC8574 0x000704a0 |
68 | #define PHY_ID_VSC8662 0x00070660 | 69 | #define PHY_ID_VSC8662 0x00070660 |
69 | #define PHY_ID_VSC8221 0x000fc550 | 70 | #define PHY_ID_VSC8221 0x000fc550 |
@@ -131,6 +132,7 @@ static int vsc82xx_config_intr(struct phy_device *phydev) | |||
131 | err = phy_write(phydev, MII_VSC8244_IMASK, | 132 | err = phy_write(phydev, MII_VSC8244_IMASK, |
132 | (phydev->drv->phy_id == PHY_ID_VSC8234 || | 133 | (phydev->drv->phy_id == PHY_ID_VSC8234 || |
133 | phydev->drv->phy_id == PHY_ID_VSC8244 || | 134 | phydev->drv->phy_id == PHY_ID_VSC8244 || |
135 | phydev->drv->phy_id == PHY_ID_VSC8514 || | ||
134 | phydev->drv->phy_id == PHY_ID_VSC8574) ? | 136 | phydev->drv->phy_id == PHY_ID_VSC8574) ? |
135 | MII_VSC8244_IMASK_MASK : | 137 | MII_VSC8244_IMASK_MASK : |
136 | MII_VSC8221_IMASK_MASK); | 138 | MII_VSC8221_IMASK_MASK); |
@@ -246,6 +248,18 @@ static struct phy_driver vsc82xx_driver[] = { | |||
246 | .config_intr = &vsc82xx_config_intr, | 248 | .config_intr = &vsc82xx_config_intr, |
247 | .driver = { .owner = THIS_MODULE,}, | 249 | .driver = { .owner = THIS_MODULE,}, |
248 | }, { | 250 | }, { |
251 | .phy_id = PHY_ID_VSC8514, | ||
252 | .name = "Vitesse VSC8514", | ||
253 | .phy_id_mask = 0x000ffff0, | ||
254 | .features = PHY_GBIT_FEATURES, | ||
255 | .flags = PHY_HAS_INTERRUPT, | ||
256 | .config_init = &vsc824x_config_init, | ||
257 | .config_aneg = &vsc82x4_config_aneg, | ||
258 | .read_status = &genphy_read_status, | ||
259 | .ack_interrupt = &vsc824x_ack_interrupt, | ||
260 | .config_intr = &vsc82xx_config_intr, | ||
261 | .driver = { .owner = THIS_MODULE,}, | ||
262 | }, { | ||
249 | .phy_id = PHY_ID_VSC8574, | 263 | .phy_id = PHY_ID_VSC8574, |
250 | .name = "Vitesse VSC8574", | 264 | .name = "Vitesse VSC8574", |
251 | .phy_id_mask = 0x000ffff0, | 265 | .phy_id_mask = 0x000ffff0, |
@@ -315,6 +329,7 @@ module_exit(vsc82xx_exit); | |||
315 | static struct mdio_device_id __maybe_unused vitesse_tbl[] = { | 329 | static struct mdio_device_id __maybe_unused vitesse_tbl[] = { |
316 | { PHY_ID_VSC8234, 0x000ffff0 }, | 330 | { PHY_ID_VSC8234, 0x000ffff0 }, |
317 | { PHY_ID_VSC8244, 0x000fffc0 }, | 331 | { PHY_ID_VSC8244, 0x000fffc0 }, |
332 | { PHY_ID_VSC8514, 0x000ffff0 }, | ||
318 | { PHY_ID_VSC8574, 0x000ffff0 }, | 333 | { PHY_ID_VSC8574, 0x000ffff0 }, |
319 | { PHY_ID_VSC8662, 0x000ffff0 }, | 334 | { PHY_ID_VSC8662, 0x000ffff0 }, |
320 | { PHY_ID_VSC8221, 0x000ffff0 }, | 335 | { PHY_ID_VSC8221, 0x000ffff0 }, |
diff --git a/drivers/net/team/team.c b/drivers/net/team/team.c index 34b0de09d881..736050d6b451 100644 --- a/drivers/net/team/team.c +++ b/drivers/net/team/team.c | |||
@@ -1366,6 +1366,8 @@ static int team_user_linkup_option_get(struct team *team, | |||
1366 | return 0; | 1366 | return 0; |
1367 | } | 1367 | } |
1368 | 1368 | ||
1369 | static void __team_carrier_check(struct team *team); | ||
1370 | |||
1369 | static int team_user_linkup_option_set(struct team *team, | 1371 | static int team_user_linkup_option_set(struct team *team, |
1370 | struct team_gsetter_ctx *ctx) | 1372 | struct team_gsetter_ctx *ctx) |
1371 | { | 1373 | { |
@@ -1373,6 +1375,7 @@ static int team_user_linkup_option_set(struct team *team, | |||
1373 | 1375 | ||
1374 | port->user.linkup = ctx->data.bool_val; | 1376 | port->user.linkup = ctx->data.bool_val; |
1375 | team_refresh_port_linkup(port); | 1377 | team_refresh_port_linkup(port); |
1378 | __team_carrier_check(port->team); | ||
1376 | return 0; | 1379 | return 0; |
1377 | } | 1380 | } |
1378 | 1381 | ||
@@ -1392,6 +1395,7 @@ static int team_user_linkup_en_option_set(struct team *team, | |||
1392 | 1395 | ||
1393 | port->user.linkup_enabled = ctx->data.bool_val; | 1396 | port->user.linkup_enabled = ctx->data.bool_val; |
1394 | team_refresh_port_linkup(port); | 1397 | team_refresh_port_linkup(port); |
1398 | __team_carrier_check(port->team); | ||
1395 | return 0; | 1399 | return 0; |
1396 | } | 1400 | } |
1397 | 1401 | ||
diff --git a/drivers/net/tun.c b/drivers/net/tun.c index 782e38bfc1ee..7c8343a4f918 100644 --- a/drivers/net/tun.c +++ b/drivers/net/tun.c | |||
@@ -1184,7 +1184,7 @@ static ssize_t tun_put_user(struct tun_struct *tun, | |||
1184 | { | 1184 | { |
1185 | struct tun_pi pi = { 0, skb->protocol }; | 1185 | struct tun_pi pi = { 0, skb->protocol }; |
1186 | ssize_t total = 0; | 1186 | ssize_t total = 0; |
1187 | int vlan_offset = 0; | 1187 | int vlan_offset = 0, copied; |
1188 | 1188 | ||
1189 | if (!(tun->flags & TUN_NO_PI)) { | 1189 | if (!(tun->flags & TUN_NO_PI)) { |
1190 | if ((len -= sizeof(pi)) < 0) | 1190 | if ((len -= sizeof(pi)) < 0) |
@@ -1248,6 +1248,8 @@ static ssize_t tun_put_user(struct tun_struct *tun, | |||
1248 | total += tun->vnet_hdr_sz; | 1248 | total += tun->vnet_hdr_sz; |
1249 | } | 1249 | } |
1250 | 1250 | ||
1251 | copied = total; | ||
1252 | total += skb->len; | ||
1251 | if (!vlan_tx_tag_present(skb)) { | 1253 | if (!vlan_tx_tag_present(skb)) { |
1252 | len = min_t(int, skb->len, len); | 1254 | len = min_t(int, skb->len, len); |
1253 | } else { | 1255 | } else { |
@@ -1262,24 +1264,24 @@ static ssize_t tun_put_user(struct tun_struct *tun, | |||
1262 | 1264 | ||
1263 | vlan_offset = offsetof(struct vlan_ethhdr, h_vlan_proto); | 1265 | vlan_offset = offsetof(struct vlan_ethhdr, h_vlan_proto); |
1264 | len = min_t(int, skb->len + VLAN_HLEN, len); | 1266 | len = min_t(int, skb->len + VLAN_HLEN, len); |
1267 | total += VLAN_HLEN; | ||
1265 | 1268 | ||
1266 | copy = min_t(int, vlan_offset, len); | 1269 | copy = min_t(int, vlan_offset, len); |
1267 | ret = skb_copy_datagram_const_iovec(skb, 0, iv, total, copy); | 1270 | ret = skb_copy_datagram_const_iovec(skb, 0, iv, copied, copy); |
1268 | len -= copy; | 1271 | len -= copy; |
1269 | total += copy; | 1272 | copied += copy; |
1270 | if (ret || !len) | 1273 | if (ret || !len) |
1271 | goto done; | 1274 | goto done; |
1272 | 1275 | ||
1273 | copy = min_t(int, sizeof(veth), len); | 1276 | copy = min_t(int, sizeof(veth), len); |
1274 | ret = memcpy_toiovecend(iv, (void *)&veth, total, copy); | 1277 | ret = memcpy_toiovecend(iv, (void *)&veth, copied, copy); |
1275 | len -= copy; | 1278 | len -= copy; |
1276 | total += copy; | 1279 | copied += copy; |
1277 | if (ret || !len) | 1280 | if (ret || !len) |
1278 | goto done; | 1281 | goto done; |
1279 | } | 1282 | } |
1280 | 1283 | ||
1281 | skb_copy_datagram_const_iovec(skb, vlan_offset, iv, total, len); | 1284 | skb_copy_datagram_const_iovec(skb, vlan_offset, iv, copied, len); |
1282 | total += len; | ||
1283 | 1285 | ||
1284 | done: | 1286 | done: |
1285 | tun->dev->stats.tx_packets++; | 1287 | tun->dev->stats.tx_packets++; |
@@ -1356,6 +1358,8 @@ static ssize_t tun_chr_aio_read(struct kiocb *iocb, const struct iovec *iv, | |||
1356 | ret = tun_do_read(tun, tfile, iocb, iv, len, | 1358 | ret = tun_do_read(tun, tfile, iocb, iv, len, |
1357 | file->f_flags & O_NONBLOCK); | 1359 | file->f_flags & O_NONBLOCK); |
1358 | ret = min_t(ssize_t, ret, len); | 1360 | ret = min_t(ssize_t, ret, len); |
1361 | if (ret > 0) | ||
1362 | iocb->ki_pos = ret; | ||
1359 | out: | 1363 | out: |
1360 | tun_put(tun); | 1364 | tun_put(tun); |
1361 | return ret; | 1365 | return ret; |
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index 7bab4de658a9..d208f8604981 100644 --- a/drivers/net/virtio_net.c +++ b/drivers/net/virtio_net.c | |||
@@ -299,35 +299,76 @@ static struct sk_buff *page_to_skb(struct receive_queue *rq, | |||
299 | return skb; | 299 | return skb; |
300 | } | 300 | } |
301 | 301 | ||
302 | static int receive_mergeable(struct receive_queue *rq, struct sk_buff *head_skb) | 302 | static struct sk_buff *receive_small(void *buf, unsigned int len) |
303 | { | 303 | { |
304 | struct skb_vnet_hdr *hdr = skb_vnet_hdr(head_skb); | 304 | struct sk_buff * skb = buf; |
305 | |||
306 | len -= sizeof(struct virtio_net_hdr); | ||
307 | skb_trim(skb, len); | ||
308 | |||
309 | return skb; | ||
310 | } | ||
311 | |||
312 | static struct sk_buff *receive_big(struct net_device *dev, | ||
313 | struct receive_queue *rq, | ||
314 | void *buf, | ||
315 | unsigned int len) | ||
316 | { | ||
317 | struct page *page = buf; | ||
318 | struct sk_buff *skb = page_to_skb(rq, page, 0, len, PAGE_SIZE); | ||
319 | |||
320 | if (unlikely(!skb)) | ||
321 | goto err; | ||
322 | |||
323 | return skb; | ||
324 | |||
325 | err: | ||
326 | dev->stats.rx_dropped++; | ||
327 | give_pages(rq, page); | ||
328 | return NULL; | ||
329 | } | ||
330 | |||
331 | static struct sk_buff *receive_mergeable(struct net_device *dev, | ||
332 | struct receive_queue *rq, | ||
333 | void *buf, | ||
334 | unsigned int len) | ||
335 | { | ||
336 | struct skb_vnet_hdr *hdr = buf; | ||
337 | int num_buf = hdr->mhdr.num_buffers; | ||
338 | struct page *page = virt_to_head_page(buf); | ||
339 | int offset = buf - page_address(page); | ||
340 | struct sk_buff *head_skb = page_to_skb(rq, page, offset, len, | ||
341 | MERGE_BUFFER_LEN); | ||
305 | struct sk_buff *curr_skb = head_skb; | 342 | struct sk_buff *curr_skb = head_skb; |
306 | char *buf; | ||
307 | struct page *page; | ||
308 | int num_buf, len, offset; | ||
309 | 343 | ||
310 | num_buf = hdr->mhdr.num_buffers; | 344 | if (unlikely(!curr_skb)) |
345 | goto err_skb; | ||
346 | |||
311 | while (--num_buf) { | 347 | while (--num_buf) { |
312 | int num_skb_frags = skb_shinfo(curr_skb)->nr_frags; | 348 | int num_skb_frags; |
349 | |||
313 | buf = virtqueue_get_buf(rq->vq, &len); | 350 | buf = virtqueue_get_buf(rq->vq, &len); |
314 | if (unlikely(!buf)) { | 351 | if (unlikely(!buf)) { |
315 | pr_debug("%s: rx error: %d buffers missing\n", | 352 | pr_debug("%s: rx error: %d buffers out of %d missing\n", |
316 | head_skb->dev->name, hdr->mhdr.num_buffers); | 353 | dev->name, num_buf, hdr->mhdr.num_buffers); |
317 | head_skb->dev->stats.rx_length_errors++; | 354 | dev->stats.rx_length_errors++; |
318 | return -EINVAL; | 355 | goto err_buf; |
319 | } | 356 | } |
320 | if (unlikely(len > MERGE_BUFFER_LEN)) { | 357 | if (unlikely(len > MERGE_BUFFER_LEN)) { |
321 | pr_debug("%s: rx error: merge buffer too long\n", | 358 | pr_debug("%s: rx error: merge buffer too long\n", |
322 | head_skb->dev->name); | 359 | dev->name); |
323 | len = MERGE_BUFFER_LEN; | 360 | len = MERGE_BUFFER_LEN; |
324 | } | 361 | } |
362 | |||
363 | page = virt_to_head_page(buf); | ||
364 | --rq->num; | ||
365 | |||
366 | num_skb_frags = skb_shinfo(curr_skb)->nr_frags; | ||
325 | if (unlikely(num_skb_frags == MAX_SKB_FRAGS)) { | 367 | if (unlikely(num_skb_frags == MAX_SKB_FRAGS)) { |
326 | struct sk_buff *nskb = alloc_skb(0, GFP_ATOMIC); | 368 | struct sk_buff *nskb = alloc_skb(0, GFP_ATOMIC); |
327 | if (unlikely(!nskb)) { | 369 | |
328 | head_skb->dev->stats.rx_dropped++; | 370 | if (unlikely(!nskb)) |
329 | return -ENOMEM; | 371 | goto err_skb; |
330 | } | ||
331 | if (curr_skb == head_skb) | 372 | if (curr_skb == head_skb) |
332 | skb_shinfo(curr_skb)->frag_list = nskb; | 373 | skb_shinfo(curr_skb)->frag_list = nskb; |
333 | else | 374 | else |
@@ -341,8 +382,7 @@ static int receive_mergeable(struct receive_queue *rq, struct sk_buff *head_skb) | |||
341 | head_skb->len += len; | 382 | head_skb->len += len; |
342 | head_skb->truesize += MERGE_BUFFER_LEN; | 383 | head_skb->truesize += MERGE_BUFFER_LEN; |
343 | } | 384 | } |
344 | page = virt_to_head_page(buf); | 385 | offset = buf - page_address(page); |
345 | offset = buf - (char *)page_address(page); | ||
346 | if (skb_can_coalesce(curr_skb, num_skb_frags, page, offset)) { | 386 | if (skb_can_coalesce(curr_skb, num_skb_frags, page, offset)) { |
347 | put_page(page); | 387 | put_page(page); |
348 | skb_coalesce_rx_frag(curr_skb, num_skb_frags - 1, | 388 | skb_coalesce_rx_frag(curr_skb, num_skb_frags - 1, |
@@ -351,9 +391,28 @@ static int receive_mergeable(struct receive_queue *rq, struct sk_buff *head_skb) | |||
351 | skb_add_rx_frag(curr_skb, num_skb_frags, page, | 391 | skb_add_rx_frag(curr_skb, num_skb_frags, page, |
352 | offset, len, MERGE_BUFFER_LEN); | 392 | offset, len, MERGE_BUFFER_LEN); |
353 | } | 393 | } |
394 | } | ||
395 | |||
396 | return head_skb; | ||
397 | |||
398 | err_skb: | ||
399 | put_page(page); | ||
400 | while (--num_buf) { | ||
401 | buf = virtqueue_get_buf(rq->vq, &len); | ||
402 | if (unlikely(!buf)) { | ||
403 | pr_debug("%s: rx error: %d buffers missing\n", | ||
404 | dev->name, num_buf); | ||
405 | dev->stats.rx_length_errors++; | ||
406 | break; | ||
407 | } | ||
408 | page = virt_to_head_page(buf); | ||
409 | put_page(page); | ||
354 | --rq->num; | 410 | --rq->num; |
355 | } | 411 | } |
356 | return 0; | 412 | err_buf: |
413 | dev->stats.rx_dropped++; | ||
414 | dev_kfree_skb(head_skb); | ||
415 | return NULL; | ||
357 | } | 416 | } |
358 | 417 | ||
359 | static void receive_buf(struct receive_queue *rq, void *buf, unsigned int len) | 418 | static void receive_buf(struct receive_queue *rq, void *buf, unsigned int len) |
@@ -362,48 +421,29 @@ static void receive_buf(struct receive_queue *rq, void *buf, unsigned int len) | |||
362 | struct net_device *dev = vi->dev; | 421 | struct net_device *dev = vi->dev; |
363 | struct virtnet_stats *stats = this_cpu_ptr(vi->stats); | 422 | struct virtnet_stats *stats = this_cpu_ptr(vi->stats); |
364 | struct sk_buff *skb; | 423 | struct sk_buff *skb; |
365 | struct page *page; | ||
366 | struct skb_vnet_hdr *hdr; | 424 | struct skb_vnet_hdr *hdr; |
367 | 425 | ||
368 | if (unlikely(len < sizeof(struct virtio_net_hdr) + ETH_HLEN)) { | 426 | if (unlikely(len < sizeof(struct virtio_net_hdr) + ETH_HLEN)) { |
369 | pr_debug("%s: short packet %i\n", dev->name, len); | 427 | pr_debug("%s: short packet %i\n", dev->name, len); |
370 | dev->stats.rx_length_errors++; | 428 | dev->stats.rx_length_errors++; |
371 | if (vi->big_packets) | 429 | if (vi->mergeable_rx_bufs) |
372 | give_pages(rq, buf); | ||
373 | else if (vi->mergeable_rx_bufs) | ||
374 | put_page(virt_to_head_page(buf)); | 430 | put_page(virt_to_head_page(buf)); |
431 | else if (vi->big_packets) | ||
432 | give_pages(rq, buf); | ||
375 | else | 433 | else |
376 | dev_kfree_skb(buf); | 434 | dev_kfree_skb(buf); |
377 | return; | 435 | return; |
378 | } | 436 | } |
379 | 437 | ||
380 | if (!vi->mergeable_rx_bufs && !vi->big_packets) { | 438 | if (vi->mergeable_rx_bufs) |
381 | skb = buf; | 439 | skb = receive_mergeable(dev, rq, buf, len); |
382 | len -= sizeof(struct virtio_net_hdr); | 440 | else if (vi->big_packets) |
383 | skb_trim(skb, len); | 441 | skb = receive_big(dev, rq, buf, len); |
384 | } else if (vi->mergeable_rx_bufs) { | 442 | else |
385 | struct page *page = virt_to_head_page(buf); | 443 | skb = receive_small(buf, len); |
386 | skb = page_to_skb(rq, page, | 444 | |
387 | (char *)buf - (char *)page_address(page), | 445 | if (unlikely(!skb)) |
388 | len, MERGE_BUFFER_LEN); | 446 | return; |
389 | if (unlikely(!skb)) { | ||
390 | dev->stats.rx_dropped++; | ||
391 | put_page(page); | ||
392 | return; | ||
393 | } | ||
394 | if (receive_mergeable(rq, skb)) { | ||
395 | dev_kfree_skb(skb); | ||
396 | return; | ||
397 | } | ||
398 | } else { | ||
399 | page = buf; | ||
400 | skb = page_to_skb(rq, page, 0, len, PAGE_SIZE); | ||
401 | if (unlikely(!skb)) { | ||
402 | dev->stats.rx_dropped++; | ||
403 | give_pages(rq, page); | ||
404 | return; | ||
405 | } | ||
406 | } | ||
407 | 447 | ||
408 | hdr = skb_vnet_hdr(skb); | 448 | hdr = skb_vnet_hdr(skb); |
409 | 449 | ||
@@ -1084,7 +1124,7 @@ static void virtnet_set_rx_mode(struct net_device *dev) | |||
1084 | if (!virtnet_send_command(vi, VIRTIO_NET_CTRL_MAC, | 1124 | if (!virtnet_send_command(vi, VIRTIO_NET_CTRL_MAC, |
1085 | VIRTIO_NET_CTRL_MAC_TABLE_SET, | 1125 | VIRTIO_NET_CTRL_MAC_TABLE_SET, |
1086 | sg, NULL)) | 1126 | sg, NULL)) |
1087 | dev_warn(&dev->dev, "Failed to set MAC fitler table.\n"); | 1127 | dev_warn(&dev->dev, "Failed to set MAC filter table.\n"); |
1088 | 1128 | ||
1089 | kfree(buf); | 1129 | kfree(buf); |
1090 | } | 1130 | } |
@@ -1327,6 +1367,11 @@ static void virtnet_config_changed(struct virtio_device *vdev) | |||
1327 | 1367 | ||
1328 | static void virtnet_free_queues(struct virtnet_info *vi) | 1368 | static void virtnet_free_queues(struct virtnet_info *vi) |
1329 | { | 1369 | { |
1370 | int i; | ||
1371 | |||
1372 | for (i = 0; i < vi->max_queue_pairs; i++) | ||
1373 | netif_napi_del(&vi->rq[i].napi); | ||
1374 | |||
1330 | kfree(vi->rq); | 1375 | kfree(vi->rq); |
1331 | kfree(vi->sq); | 1376 | kfree(vi->sq); |
1332 | } | 1377 | } |
@@ -1356,10 +1401,10 @@ static void free_unused_bufs(struct virtnet_info *vi) | |||
1356 | struct virtqueue *vq = vi->rq[i].vq; | 1401 | struct virtqueue *vq = vi->rq[i].vq; |
1357 | 1402 | ||
1358 | while ((buf = virtqueue_detach_unused_buf(vq)) != NULL) { | 1403 | while ((buf = virtqueue_detach_unused_buf(vq)) != NULL) { |
1359 | if (vi->big_packets) | 1404 | if (vi->mergeable_rx_bufs) |
1360 | give_pages(&vi->rq[i], buf); | ||
1361 | else if (vi->mergeable_rx_bufs) | ||
1362 | put_page(virt_to_head_page(buf)); | 1405 | put_page(virt_to_head_page(buf)); |
1406 | else if (vi->big_packets) | ||
1407 | give_pages(&vi->rq[i], buf); | ||
1363 | else | 1408 | else |
1364 | dev_kfree_skb(buf); | 1409 | dev_kfree_skb(buf); |
1365 | --vi->rq[i].num; | 1410 | --vi->rq[i].num; |
diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c index 0358c07f7669..249e01c5600c 100644 --- a/drivers/net/vxlan.c +++ b/drivers/net/vxlan.c | |||
@@ -1668,7 +1668,7 @@ static void vxlan_xmit_one(struct sk_buff *skb, struct net_device *dev, | |||
1668 | netdev_dbg(dev, "circular route to %pI4\n", | 1668 | netdev_dbg(dev, "circular route to %pI4\n", |
1669 | &dst->sin.sin_addr.s_addr); | 1669 | &dst->sin.sin_addr.s_addr); |
1670 | dev->stats.collisions++; | 1670 | dev->stats.collisions++; |
1671 | goto tx_error; | 1671 | goto rt_tx_error; |
1672 | } | 1672 | } |
1673 | 1673 | ||
1674 | /* Bypass encapsulation if the destination is local */ | 1674 | /* Bypass encapsulation if the destination is local */ |
diff --git a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c b/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c index 1ec52356b5a1..130657db5c43 100644 --- a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c +++ b/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c | |||
@@ -3984,18 +3984,20 @@ static void ar9003_hw_quick_drop_apply(struct ath_hw *ah, u16 freq) | |||
3984 | int quick_drop; | 3984 | int quick_drop; |
3985 | s32 t[3], f[3] = {5180, 5500, 5785}; | 3985 | s32 t[3], f[3] = {5180, 5500, 5785}; |
3986 | 3986 | ||
3987 | if (!(pBase->miscConfiguration & BIT(1))) | 3987 | if (!(pBase->miscConfiguration & BIT(4))) |
3988 | return; | 3988 | return; |
3989 | 3989 | ||
3990 | if (freq < 4000) | 3990 | if (AR_SREV_9300(ah) || AR_SREV_9580(ah) || AR_SREV_9340(ah)) { |
3991 | quick_drop = eep->modalHeader2G.quick_drop; | 3991 | if (freq < 4000) { |
3992 | else { | 3992 | quick_drop = eep->modalHeader2G.quick_drop; |
3993 | t[0] = eep->base_ext1.quick_drop_low; | 3993 | } else { |
3994 | t[1] = eep->modalHeader5G.quick_drop; | 3994 | t[0] = eep->base_ext1.quick_drop_low; |
3995 | t[2] = eep->base_ext1.quick_drop_high; | 3995 | t[1] = eep->modalHeader5G.quick_drop; |
3996 | quick_drop = ar9003_hw_power_interpolate(freq, f, t, 3); | 3996 | t[2] = eep->base_ext1.quick_drop_high; |
3997 | quick_drop = ar9003_hw_power_interpolate(freq, f, t, 3); | ||
3998 | } | ||
3999 | REG_RMW_FIELD(ah, AR_PHY_AGC, AR_PHY_AGC_QUICK_DROP, quick_drop); | ||
3997 | } | 4000 | } |
3998 | REG_RMW_FIELD(ah, AR_PHY_AGC, AR_PHY_AGC_QUICK_DROP, quick_drop); | ||
3999 | } | 4001 | } |
4000 | 4002 | ||
4001 | static void ar9003_hw_txend_to_xpa_off_apply(struct ath_hw *ah, bool is2ghz) | 4003 | static void ar9003_hw_txend_to_xpa_off_apply(struct ath_hw *ah, bool is2ghz) |
@@ -4035,7 +4037,7 @@ static void ar9003_hw_xlna_bias_strength_apply(struct ath_hw *ah, bool is2ghz) | |||
4035 | struct ar9300_eeprom *eep = &ah->eeprom.ar9300_eep; | 4037 | struct ar9300_eeprom *eep = &ah->eeprom.ar9300_eep; |
4036 | u8 bias; | 4038 | u8 bias; |
4037 | 4039 | ||
4038 | if (!(eep->baseEepHeader.featureEnable & 0x40)) | 4040 | if (!(eep->baseEepHeader.miscConfiguration & 0x40)) |
4039 | return; | 4041 | return; |
4040 | 4042 | ||
4041 | if (!AR_SREV_9300(ah)) | 4043 | if (!AR_SREV_9300(ah)) |
diff --git a/drivers/net/wireless/ath/ath9k/hw.c b/drivers/net/wireless/ath/ath9k/hw.c index 54b04155e43b..8918035da3a3 100644 --- a/drivers/net/wireless/ath/ath9k/hw.c +++ b/drivers/net/wireless/ath/ath9k/hw.c | |||
@@ -146,10 +146,9 @@ static void ath9k_hw_set_clockrate(struct ath_hw *ah) | |||
146 | else | 146 | else |
147 | clockrate = ATH9K_CLOCK_RATE_5GHZ_OFDM; | 147 | clockrate = ATH9K_CLOCK_RATE_5GHZ_OFDM; |
148 | 148 | ||
149 | if (IS_CHAN_HT40(chan)) | 149 | if (chan) { |
150 | clockrate *= 2; | 150 | if (IS_CHAN_HT40(chan)) |
151 | 151 | clockrate *= 2; | |
152 | if (ah->curchan) { | ||
153 | if (IS_CHAN_HALF_RATE(chan)) | 152 | if (IS_CHAN_HALF_RATE(chan)) |
154 | clockrate /= 2; | 153 | clockrate /= 2; |
155 | if (IS_CHAN_QUARTER_RATE(chan)) | 154 | if (IS_CHAN_QUARTER_RATE(chan)) |
diff --git a/drivers/net/wireless/ath/ath9k/xmit.c b/drivers/net/wireless/ath/ath9k/xmit.c index 09cdbcd09739..b5a19e098f2d 100644 --- a/drivers/net/wireless/ath/ath9k/xmit.c +++ b/drivers/net/wireless/ath/ath9k/xmit.c | |||
@@ -1276,6 +1276,10 @@ static void ath_tx_fill_desc(struct ath_softc *sc, struct ath_buf *bf, | |||
1276 | if (!rts_thresh || (len > rts_thresh)) | 1276 | if (!rts_thresh || (len > rts_thresh)) |
1277 | rts = true; | 1277 | rts = true; |
1278 | } | 1278 | } |
1279 | |||
1280 | if (!aggr) | ||
1281 | len = fi->framelen; | ||
1282 | |||
1279 | ath_buf_set_rate(sc, bf, &info, len, rts); | 1283 | ath_buf_set_rate(sc, bf, &info, len, rts); |
1280 | } | 1284 | } |
1281 | 1285 | ||
diff --git a/drivers/net/wireless/ath/wcn36xx/smd.c b/drivers/net/wireless/ath/wcn36xx/smd.c index de9eb2cfbf4b..366339421d4f 100644 --- a/drivers/net/wireless/ath/wcn36xx/smd.c +++ b/drivers/net/wireless/ath/wcn36xx/smd.c | |||
@@ -2041,13 +2041,20 @@ static void wcn36xx_smd_rsp_process(struct wcn36xx *wcn, void *buf, size_t len) | |||
2041 | case WCN36XX_HAL_DELETE_STA_CONTEXT_IND: | 2041 | case WCN36XX_HAL_DELETE_STA_CONTEXT_IND: |
2042 | mutex_lock(&wcn->hal_ind_mutex); | 2042 | mutex_lock(&wcn->hal_ind_mutex); |
2043 | msg_ind = kmalloc(sizeof(*msg_ind), GFP_KERNEL); | 2043 | msg_ind = kmalloc(sizeof(*msg_ind), GFP_KERNEL); |
2044 | msg_ind->msg_len = len; | 2044 | if (msg_ind) { |
2045 | msg_ind->msg = kmalloc(len, GFP_KERNEL); | 2045 | msg_ind->msg_len = len; |
2046 | memcpy(msg_ind->msg, buf, len); | 2046 | msg_ind->msg = kmalloc(len, GFP_KERNEL); |
2047 | list_add_tail(&msg_ind->list, &wcn->hal_ind_queue); | 2047 | memcpy(msg_ind->msg, buf, len); |
2048 | queue_work(wcn->hal_ind_wq, &wcn->hal_ind_work); | 2048 | list_add_tail(&msg_ind->list, &wcn->hal_ind_queue); |
2049 | wcn36xx_dbg(WCN36XX_DBG_HAL, "indication arrived\n"); | 2049 | queue_work(wcn->hal_ind_wq, &wcn->hal_ind_work); |
2050 | wcn36xx_dbg(WCN36XX_DBG_HAL, "indication arrived\n"); | ||
2051 | } | ||
2050 | mutex_unlock(&wcn->hal_ind_mutex); | 2052 | mutex_unlock(&wcn->hal_ind_mutex); |
2053 | if (msg_ind) | ||
2054 | break; | ||
2055 | /* FIXME: Do something smarter then just printing an error. */ | ||
2056 | wcn36xx_err("Run out of memory while handling SMD_EVENT (%d)\n", | ||
2057 | msg_header->msg_type); | ||
2051 | break; | 2058 | break; |
2052 | default: | 2059 | default: |
2053 | wcn36xx_err("SMD_EVENT (%d) not supported\n", | 2060 | wcn36xx_err("SMD_EVENT (%d) not supported\n", |
diff --git a/drivers/net/wireless/brcm80211/Kconfig b/drivers/net/wireless/brcm80211/Kconfig index b00a7e92225f..54e36fcb3954 100644 --- a/drivers/net/wireless/brcm80211/Kconfig +++ b/drivers/net/wireless/brcm80211/Kconfig | |||
@@ -5,6 +5,8 @@ config BRCMSMAC | |||
5 | tristate "Broadcom IEEE802.11n PCIe SoftMAC WLAN driver" | 5 | tristate "Broadcom IEEE802.11n PCIe SoftMAC WLAN driver" |
6 | depends on MAC80211 | 6 | depends on MAC80211 |
7 | depends on BCMA | 7 | depends on BCMA |
8 | select NEW_LEDS if BCMA_DRIVER_GPIO | ||
9 | select LEDS_CLASS if BCMA_DRIVER_GPIO | ||
8 | select BRCMUTIL | 10 | select BRCMUTIL |
9 | select FW_LOADER | 11 | select FW_LOADER |
10 | select CRC_CCITT | 12 | select CRC_CCITT |
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh_sdmmc.c b/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh_sdmmc.c index 905704e335d7..abc9ceca70f3 100644 --- a/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh_sdmmc.c +++ b/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh_sdmmc.c | |||
@@ -109,6 +109,8 @@ static inline int brcmf_sdioh_f0_write_byte(struct brcmf_sdio_dev *sdiodev, | |||
109 | brcmf_err("Disable F2 failed:%d\n", | 109 | brcmf_err("Disable F2 failed:%d\n", |
110 | err_ret); | 110 | err_ret); |
111 | } | 111 | } |
112 | } else { | ||
113 | err_ret = -ENOENT; | ||
112 | } | 114 | } |
113 | } else if ((regaddr == SDIO_CCCR_ABORT) || | 115 | } else if ((regaddr == SDIO_CCCR_ABORT) || |
114 | (regaddr == SDIO_CCCR_IENx)) { | 116 | (regaddr == SDIO_CCCR_IENx)) { |
diff --git a/drivers/net/wireless/iwlwifi/iwl-7000.c b/drivers/net/wireless/iwlwifi/iwl-7000.c index 85879dbaa402..3c34a72a5d64 100644 --- a/drivers/net/wireless/iwlwifi/iwl-7000.c +++ b/drivers/net/wireless/iwlwifi/iwl-7000.c | |||
@@ -67,8 +67,8 @@ | |||
67 | #include "iwl-agn-hw.h" | 67 | #include "iwl-agn-hw.h" |
68 | 68 | ||
69 | /* Highest firmware API version supported */ | 69 | /* Highest firmware API version supported */ |
70 | #define IWL7260_UCODE_API_MAX 7 | 70 | #define IWL7260_UCODE_API_MAX 8 |
71 | #define IWL3160_UCODE_API_MAX 7 | 71 | #define IWL3160_UCODE_API_MAX 8 |
72 | 72 | ||
73 | /* Oldest version we won't warn about */ | 73 | /* Oldest version we won't warn about */ |
74 | #define IWL7260_UCODE_API_OK 7 | 74 | #define IWL7260_UCODE_API_OK 7 |
@@ -130,6 +130,7 @@ const struct iwl_cfg iwl7260_2ac_cfg = { | |||
130 | .ht_params = &iwl7000_ht_params, | 130 | .ht_params = &iwl7000_ht_params, |
131 | .nvm_ver = IWL7260_NVM_VERSION, | 131 | .nvm_ver = IWL7260_NVM_VERSION, |
132 | .nvm_calib_ver = IWL7260_TX_POWER_VERSION, | 132 | .nvm_calib_ver = IWL7260_TX_POWER_VERSION, |
133 | .host_interrupt_operation_mode = true, | ||
133 | }; | 134 | }; |
134 | 135 | ||
135 | const struct iwl_cfg iwl7260_2ac_cfg_high_temp = { | 136 | const struct iwl_cfg iwl7260_2ac_cfg_high_temp = { |
@@ -140,6 +141,7 @@ const struct iwl_cfg iwl7260_2ac_cfg_high_temp = { | |||
140 | .nvm_ver = IWL7260_NVM_VERSION, | 141 | .nvm_ver = IWL7260_NVM_VERSION, |
141 | .nvm_calib_ver = IWL7260_TX_POWER_VERSION, | 142 | .nvm_calib_ver = IWL7260_TX_POWER_VERSION, |
142 | .high_temp = true, | 143 | .high_temp = true, |
144 | .host_interrupt_operation_mode = true, | ||
143 | }; | 145 | }; |
144 | 146 | ||
145 | const struct iwl_cfg iwl7260_2n_cfg = { | 147 | const struct iwl_cfg iwl7260_2n_cfg = { |
@@ -149,6 +151,7 @@ const struct iwl_cfg iwl7260_2n_cfg = { | |||
149 | .ht_params = &iwl7000_ht_params, | 151 | .ht_params = &iwl7000_ht_params, |
150 | .nvm_ver = IWL7260_NVM_VERSION, | 152 | .nvm_ver = IWL7260_NVM_VERSION, |
151 | .nvm_calib_ver = IWL7260_TX_POWER_VERSION, | 153 | .nvm_calib_ver = IWL7260_TX_POWER_VERSION, |
154 | .host_interrupt_operation_mode = true, | ||
152 | }; | 155 | }; |
153 | 156 | ||
154 | const struct iwl_cfg iwl7260_n_cfg = { | 157 | const struct iwl_cfg iwl7260_n_cfg = { |
@@ -158,6 +161,7 @@ const struct iwl_cfg iwl7260_n_cfg = { | |||
158 | .ht_params = &iwl7000_ht_params, | 161 | .ht_params = &iwl7000_ht_params, |
159 | .nvm_ver = IWL7260_NVM_VERSION, | 162 | .nvm_ver = IWL7260_NVM_VERSION, |
160 | .nvm_calib_ver = IWL7260_TX_POWER_VERSION, | 163 | .nvm_calib_ver = IWL7260_TX_POWER_VERSION, |
164 | .host_interrupt_operation_mode = true, | ||
161 | }; | 165 | }; |
162 | 166 | ||
163 | const struct iwl_cfg iwl3160_2ac_cfg = { | 167 | const struct iwl_cfg iwl3160_2ac_cfg = { |
@@ -167,6 +171,7 @@ const struct iwl_cfg iwl3160_2ac_cfg = { | |||
167 | .ht_params = &iwl7000_ht_params, | 171 | .ht_params = &iwl7000_ht_params, |
168 | .nvm_ver = IWL3160_NVM_VERSION, | 172 | .nvm_ver = IWL3160_NVM_VERSION, |
169 | .nvm_calib_ver = IWL3160_TX_POWER_VERSION, | 173 | .nvm_calib_ver = IWL3160_TX_POWER_VERSION, |
174 | .host_interrupt_operation_mode = true, | ||
170 | }; | 175 | }; |
171 | 176 | ||
172 | const struct iwl_cfg iwl3160_2n_cfg = { | 177 | const struct iwl_cfg iwl3160_2n_cfg = { |
@@ -176,6 +181,7 @@ const struct iwl_cfg iwl3160_2n_cfg = { | |||
176 | .ht_params = &iwl7000_ht_params, | 181 | .ht_params = &iwl7000_ht_params, |
177 | .nvm_ver = IWL3160_NVM_VERSION, | 182 | .nvm_ver = IWL3160_NVM_VERSION, |
178 | .nvm_calib_ver = IWL3160_TX_POWER_VERSION, | 183 | .nvm_calib_ver = IWL3160_TX_POWER_VERSION, |
184 | .host_interrupt_operation_mode = true, | ||
179 | }; | 185 | }; |
180 | 186 | ||
181 | const struct iwl_cfg iwl3160_n_cfg = { | 187 | const struct iwl_cfg iwl3160_n_cfg = { |
@@ -185,6 +191,7 @@ const struct iwl_cfg iwl3160_n_cfg = { | |||
185 | .ht_params = &iwl7000_ht_params, | 191 | .ht_params = &iwl7000_ht_params, |
186 | .nvm_ver = IWL3160_NVM_VERSION, | 192 | .nvm_ver = IWL3160_NVM_VERSION, |
187 | .nvm_calib_ver = IWL3160_TX_POWER_VERSION, | 193 | .nvm_calib_ver = IWL3160_TX_POWER_VERSION, |
194 | .host_interrupt_operation_mode = true, | ||
188 | }; | 195 | }; |
189 | 196 | ||
190 | const struct iwl_cfg iwl7265_2ac_cfg = { | 197 | const struct iwl_cfg iwl7265_2ac_cfg = { |
@@ -196,5 +203,23 @@ const struct iwl_cfg iwl7265_2ac_cfg = { | |||
196 | .nvm_calib_ver = IWL7265_TX_POWER_VERSION, | 203 | .nvm_calib_ver = IWL7265_TX_POWER_VERSION, |
197 | }; | 204 | }; |
198 | 205 | ||
206 | const struct iwl_cfg iwl7265_2n_cfg = { | ||
207 | .name = "Intel(R) Dual Band Wireless N 7265", | ||
208 | .fw_name_pre = IWL7265_FW_PRE, | ||
209 | IWL_DEVICE_7000, | ||
210 | .ht_params = &iwl7000_ht_params, | ||
211 | .nvm_ver = IWL7265_NVM_VERSION, | ||
212 | .nvm_calib_ver = IWL7265_TX_POWER_VERSION, | ||
213 | }; | ||
214 | |||
215 | const struct iwl_cfg iwl7265_n_cfg = { | ||
216 | .name = "Intel(R) Wireless N 7265", | ||
217 | .fw_name_pre = IWL7265_FW_PRE, | ||
218 | IWL_DEVICE_7000, | ||
219 | .ht_params = &iwl7000_ht_params, | ||
220 | .nvm_ver = IWL7265_NVM_VERSION, | ||
221 | .nvm_calib_ver = IWL7265_TX_POWER_VERSION, | ||
222 | }; | ||
223 | |||
199 | MODULE_FIRMWARE(IWL7260_MODULE_FIRMWARE(IWL7260_UCODE_API_OK)); | 224 | MODULE_FIRMWARE(IWL7260_MODULE_FIRMWARE(IWL7260_UCODE_API_OK)); |
200 | MODULE_FIRMWARE(IWL3160_MODULE_FIRMWARE(IWL3160_UCODE_API_OK)); | 225 | MODULE_FIRMWARE(IWL3160_MODULE_FIRMWARE(IWL3160_UCODE_API_OK)); |
diff --git a/drivers/net/wireless/iwlwifi/iwl-config.h b/drivers/net/wireless/iwlwifi/iwl-config.h index 18f232e8e812..03fd9aa8bfda 100644 --- a/drivers/net/wireless/iwlwifi/iwl-config.h +++ b/drivers/net/wireless/iwlwifi/iwl-config.h | |||
@@ -207,6 +207,8 @@ struct iwl_eeprom_params { | |||
207 | * @rx_with_siso_diversity: 1x1 device with rx antenna diversity | 207 | * @rx_with_siso_diversity: 1x1 device with rx antenna diversity |
208 | * @internal_wimax_coex: internal wifi/wimax combo device | 208 | * @internal_wimax_coex: internal wifi/wimax combo device |
209 | * @high_temp: Is this NIC is designated to be in high temperature. | 209 | * @high_temp: Is this NIC is designated to be in high temperature. |
210 | * @host_interrupt_operation_mode: device needs host interrupt operation | ||
211 | * mode set | ||
210 | * | 212 | * |
211 | * We enable the driver to be backward compatible wrt. hardware features. | 213 | * We enable the driver to be backward compatible wrt. hardware features. |
212 | * API differences in uCode shouldn't be handled here but through TLVs | 214 | * API differences in uCode shouldn't be handled here but through TLVs |
@@ -235,6 +237,7 @@ struct iwl_cfg { | |||
235 | enum iwl_led_mode led_mode; | 237 | enum iwl_led_mode led_mode; |
236 | const bool rx_with_siso_diversity; | 238 | const bool rx_with_siso_diversity; |
237 | const bool internal_wimax_coex; | 239 | const bool internal_wimax_coex; |
240 | const bool host_interrupt_operation_mode; | ||
238 | bool high_temp; | 241 | bool high_temp; |
239 | }; | 242 | }; |
240 | 243 | ||
@@ -294,6 +297,8 @@ extern const struct iwl_cfg iwl3160_2ac_cfg; | |||
294 | extern const struct iwl_cfg iwl3160_2n_cfg; | 297 | extern const struct iwl_cfg iwl3160_2n_cfg; |
295 | extern const struct iwl_cfg iwl3160_n_cfg; | 298 | extern const struct iwl_cfg iwl3160_n_cfg; |
296 | extern const struct iwl_cfg iwl7265_2ac_cfg; | 299 | extern const struct iwl_cfg iwl7265_2ac_cfg; |
300 | extern const struct iwl_cfg iwl7265_2n_cfg; | ||
301 | extern const struct iwl_cfg iwl7265_n_cfg; | ||
297 | #endif /* CONFIG_IWLMVM */ | 302 | #endif /* CONFIG_IWLMVM */ |
298 | 303 | ||
299 | #endif /* __IWL_CONFIG_H__ */ | 304 | #endif /* __IWL_CONFIG_H__ */ |
diff --git a/drivers/net/wireless/iwlwifi/iwl-csr.h b/drivers/net/wireless/iwlwifi/iwl-csr.h index 54a4fdc631b7..da4eca8b3007 100644 --- a/drivers/net/wireless/iwlwifi/iwl-csr.h +++ b/drivers/net/wireless/iwlwifi/iwl-csr.h | |||
@@ -495,14 +495,11 @@ enum secure_load_status_reg { | |||
495 | * the CSR_INT_COALESCING is an 8 bit register in 32-usec unit | 495 | * the CSR_INT_COALESCING is an 8 bit register in 32-usec unit |
496 | * | 496 | * |
497 | * default interrupt coalescing timer is 64 x 32 = 2048 usecs | 497 | * default interrupt coalescing timer is 64 x 32 = 2048 usecs |
498 | * default interrupt coalescing calibration timer is 16 x 32 = 512 usecs | ||
499 | */ | 498 | */ |
500 | #define IWL_HOST_INT_TIMEOUT_MAX (0xFF) | 499 | #define IWL_HOST_INT_TIMEOUT_MAX (0xFF) |
501 | #define IWL_HOST_INT_TIMEOUT_DEF (0x40) | 500 | #define IWL_HOST_INT_TIMEOUT_DEF (0x40) |
502 | #define IWL_HOST_INT_TIMEOUT_MIN (0x0) | 501 | #define IWL_HOST_INT_TIMEOUT_MIN (0x0) |
503 | #define IWL_HOST_INT_CALIB_TIMEOUT_MAX (0xFF) | 502 | #define IWL_HOST_INT_OPER_MODE BIT(31) |
504 | #define IWL_HOST_INT_CALIB_TIMEOUT_DEF (0x10) | ||
505 | #define IWL_HOST_INT_CALIB_TIMEOUT_MIN (0x0) | ||
506 | 503 | ||
507 | /***************************************************************************** | 504 | /***************************************************************************** |
508 | * 7000/3000 series SHR DTS addresses * | 505 | * 7000/3000 series SHR DTS addresses * |
diff --git a/drivers/net/wireless/iwlwifi/mvm/bt-coex.c b/drivers/net/wireless/iwlwifi/mvm/bt-coex.c index 5d066cbc5ac7..75b72a956552 100644 --- a/drivers/net/wireless/iwlwifi/mvm/bt-coex.c +++ b/drivers/net/wireless/iwlwifi/mvm/bt-coex.c | |||
@@ -391,7 +391,6 @@ int iwl_send_bt_init_conf(struct iwl_mvm *mvm) | |||
391 | BT_VALID_LUT | | 391 | BT_VALID_LUT | |
392 | BT_VALID_WIFI_RX_SW_PRIO_BOOST | | 392 | BT_VALID_WIFI_RX_SW_PRIO_BOOST | |
393 | BT_VALID_WIFI_TX_SW_PRIO_BOOST | | 393 | BT_VALID_WIFI_TX_SW_PRIO_BOOST | |
394 | BT_VALID_MULTI_PRIO_LUT | | ||
395 | BT_VALID_CORUN_LUT_20 | | 394 | BT_VALID_CORUN_LUT_20 | |
396 | BT_VALID_CORUN_LUT_40 | | 395 | BT_VALID_CORUN_LUT_40 | |
397 | BT_VALID_ANT_ISOLATION | | 396 | BT_VALID_ANT_ISOLATION | |
@@ -842,6 +841,11 @@ static void iwl_mvm_bt_rssi_iterator(void *_data, u8 *mac, | |||
842 | 841 | ||
843 | sta = rcu_dereference_protected(mvm->fw_id_to_mac_id[mvmvif->ap_sta_id], | 842 | sta = rcu_dereference_protected(mvm->fw_id_to_mac_id[mvmvif->ap_sta_id], |
844 | lockdep_is_held(&mvm->mutex)); | 843 | lockdep_is_held(&mvm->mutex)); |
844 | |||
845 | /* This can happen if the station has been removed right now */ | ||
846 | if (IS_ERR_OR_NULL(sta)) | ||
847 | return; | ||
848 | |||
845 | mvmsta = (void *)sta->drv_priv; | 849 | mvmsta = (void *)sta->drv_priv; |
846 | 850 | ||
847 | data->num_bss_ifaces++; | 851 | data->num_bss_ifaces++; |
diff --git a/drivers/net/wireless/iwlwifi/mvm/d3.c b/drivers/net/wireless/iwlwifi/mvm/d3.c index 6f45966817bb..b9b81e881dd0 100644 --- a/drivers/net/wireless/iwlwifi/mvm/d3.c +++ b/drivers/net/wireless/iwlwifi/mvm/d3.c | |||
@@ -895,7 +895,7 @@ static int iwl_mvm_get_last_nonqos_seq(struct iwl_mvm *mvm, | |||
895 | /* new API returns next, not last-used seqno */ | 895 | /* new API returns next, not last-used seqno */ |
896 | if (mvm->fw->ucode_capa.flags & | 896 | if (mvm->fw->ucode_capa.flags & |
897 | IWL_UCODE_TLV_FLAGS_D3_CONTINUITY_API) | 897 | IWL_UCODE_TLV_FLAGS_D3_CONTINUITY_API) |
898 | err -= 0x10; | 898 | err = (u16) (err - 0x10); |
899 | } | 899 | } |
900 | 900 | ||
901 | iwl_free_resp(&cmd); | 901 | iwl_free_resp(&cmd); |
@@ -1549,7 +1549,7 @@ static bool iwl_mvm_setup_connection_keep(struct iwl_mvm *mvm, | |||
1549 | if (gtkdata.unhandled_cipher) | 1549 | if (gtkdata.unhandled_cipher) |
1550 | return false; | 1550 | return false; |
1551 | if (!gtkdata.num_keys) | 1551 | if (!gtkdata.num_keys) |
1552 | return true; | 1552 | goto out; |
1553 | if (!gtkdata.last_gtk) | 1553 | if (!gtkdata.last_gtk) |
1554 | return false; | 1554 | return false; |
1555 | 1555 | ||
@@ -1600,6 +1600,7 @@ static bool iwl_mvm_setup_connection_keep(struct iwl_mvm *mvm, | |||
1600 | (void *)&replay_ctr, GFP_KERNEL); | 1600 | (void *)&replay_ctr, GFP_KERNEL); |
1601 | } | 1601 | } |
1602 | 1602 | ||
1603 | out: | ||
1603 | mvmvif->seqno_valid = true; | 1604 | mvmvif->seqno_valid = true; |
1604 | /* +0x10 because the set API expects next-to-use, not last-used */ | 1605 | /* +0x10 because the set API expects next-to-use, not last-used */ |
1605 | mvmvif->seqno = le16_to_cpu(status->non_qos_seq_ctr) + 0x10; | 1606 | mvmvif->seqno = le16_to_cpu(status->non_qos_seq_ctr) + 0x10; |
diff --git a/drivers/net/wireless/iwlwifi/mvm/debugfs.c b/drivers/net/wireless/iwlwifi/mvm/debugfs.c index 9864d713eb2c..a8fe6b41f9a3 100644 --- a/drivers/net/wireless/iwlwifi/mvm/debugfs.c +++ b/drivers/net/wireless/iwlwifi/mvm/debugfs.c | |||
@@ -119,6 +119,10 @@ static ssize_t iwl_dbgfs_sta_drain_write(struct file *file, | |||
119 | 119 | ||
120 | if (sscanf(buf, "%d %d", &sta_id, &drain) != 2) | 120 | if (sscanf(buf, "%d %d", &sta_id, &drain) != 2) |
121 | return -EINVAL; | 121 | return -EINVAL; |
122 | if (sta_id < 0 || sta_id >= IWL_MVM_STATION_COUNT) | ||
123 | return -EINVAL; | ||
124 | if (drain < 0 || drain > 1) | ||
125 | return -EINVAL; | ||
122 | 126 | ||
123 | mutex_lock(&mvm->mutex); | 127 | mutex_lock(&mvm->mutex); |
124 | 128 | ||
diff --git a/drivers/net/wireless/iwlwifi/mvm/time-event.c b/drivers/net/wireless/iwlwifi/mvm/time-event.c index 33cf56fdfc41..95ce4b601fef 100644 --- a/drivers/net/wireless/iwlwifi/mvm/time-event.c +++ b/drivers/net/wireless/iwlwifi/mvm/time-event.c | |||
@@ -176,8 +176,11 @@ static void iwl_mvm_te_handle_notif(struct iwl_mvm *mvm, | |||
176 | * P2P Device discoveribility, while there are other higher priority | 176 | * P2P Device discoveribility, while there are other higher priority |
177 | * events in the system). | 177 | * events in the system). |
178 | */ | 178 | */ |
179 | if (WARN_ONCE(!le32_to_cpu(notif->status), | 179 | if (!le32_to_cpu(notif->status)) { |
180 | "Failed to schedule time event\n")) { | 180 | bool start = le32_to_cpu(notif->action) & |
181 | TE_V2_NOTIF_HOST_EVENT_START; | ||
182 | IWL_WARN(mvm, "Time Event %s notification failure\n", | ||
183 | start ? "start" : "end"); | ||
181 | if (iwl_mvm_te_check_disconnect(mvm, te_data->vif, NULL)) { | 184 | if (iwl_mvm_te_check_disconnect(mvm, te_data->vif, NULL)) { |
182 | iwl_mvm_te_clear_data(mvm, te_data); | 185 | iwl_mvm_te_clear_data(mvm, te_data); |
183 | return; | 186 | return; |
diff --git a/drivers/net/wireless/iwlwifi/pcie/drv.c b/drivers/net/wireless/iwlwifi/pcie/drv.c index 941c0c88f982..86605027c41d 100644 --- a/drivers/net/wireless/iwlwifi/pcie/drv.c +++ b/drivers/net/wireless/iwlwifi/pcie/drv.c | |||
@@ -353,6 +353,27 @@ static DEFINE_PCI_DEVICE_TABLE(iwl_hw_card_ids) = { | |||
353 | 353 | ||
354 | /* 7265 Series */ | 354 | /* 7265 Series */ |
355 | {IWL_PCI_DEVICE(0x095A, 0x5010, iwl7265_2ac_cfg)}, | 355 | {IWL_PCI_DEVICE(0x095A, 0x5010, iwl7265_2ac_cfg)}, |
356 | {IWL_PCI_DEVICE(0x095A, 0x5110, iwl7265_2ac_cfg)}, | ||
357 | {IWL_PCI_DEVICE(0x095B, 0x5310, iwl7265_2ac_cfg)}, | ||
358 | {IWL_PCI_DEVICE(0x095B, 0x5302, iwl7265_2ac_cfg)}, | ||
359 | {IWL_PCI_DEVICE(0x095B, 0x5210, iwl7265_2ac_cfg)}, | ||
360 | {IWL_PCI_DEVICE(0x095B, 0x5012, iwl7265_2ac_cfg)}, | ||
361 | {IWL_PCI_DEVICE(0x095B, 0x500A, iwl7265_2ac_cfg)}, | ||
362 | {IWL_PCI_DEVICE(0x095A, 0x5410, iwl7265_2ac_cfg)}, | ||
363 | {IWL_PCI_DEVICE(0x095A, 0x1010, iwl7265_2ac_cfg)}, | ||
364 | {IWL_PCI_DEVICE(0x095A, 0x5000, iwl7265_2n_cfg)}, | ||
365 | {IWL_PCI_DEVICE(0x095B, 0x5200, iwl7265_2n_cfg)}, | ||
366 | {IWL_PCI_DEVICE(0x095A, 0x5002, iwl7265_n_cfg)}, | ||
367 | {IWL_PCI_DEVICE(0x095B, 0x5202, iwl7265_n_cfg)}, | ||
368 | {IWL_PCI_DEVICE(0x095A, 0x9010, iwl7265_2ac_cfg)}, | ||
369 | {IWL_PCI_DEVICE(0x095A, 0x9210, iwl7265_2ac_cfg)}, | ||
370 | {IWL_PCI_DEVICE(0x095A, 0x9410, iwl7265_2ac_cfg)}, | ||
371 | {IWL_PCI_DEVICE(0x095A, 0x5020, iwl7265_2n_cfg)}, | ||
372 | {IWL_PCI_DEVICE(0x095A, 0x502A, iwl7265_2n_cfg)}, | ||
373 | {IWL_PCI_DEVICE(0x095A, 0x5420, iwl7265_2n_cfg)}, | ||
374 | {IWL_PCI_DEVICE(0x095A, 0x5090, iwl7265_2ac_cfg)}, | ||
375 | {IWL_PCI_DEVICE(0x095B, 0x5290, iwl7265_2ac_cfg)}, | ||
376 | {IWL_PCI_DEVICE(0x095A, 0x5490, iwl7265_2ac_cfg)}, | ||
356 | #endif /* CONFIG_IWLMVM */ | 377 | #endif /* CONFIG_IWLMVM */ |
357 | 378 | ||
358 | {0} | 379 | {0} |
diff --git a/drivers/net/wireless/iwlwifi/pcie/internal.h b/drivers/net/wireless/iwlwifi/pcie/internal.h index fa22639b63c9..051268c037b1 100644 --- a/drivers/net/wireless/iwlwifi/pcie/internal.h +++ b/drivers/net/wireless/iwlwifi/pcie/internal.h | |||
@@ -477,4 +477,12 @@ static inline bool iwl_is_rfkill_set(struct iwl_trans *trans) | |||
477 | CSR_GP_CNTRL_REG_FLAG_HW_RF_KILL_SW); | 477 | CSR_GP_CNTRL_REG_FLAG_HW_RF_KILL_SW); |
478 | } | 478 | } |
479 | 479 | ||
480 | static inline void iwl_nic_error(struct iwl_trans *trans) | ||
481 | { | ||
482 | struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); | ||
483 | |||
484 | set_bit(STATUS_FW_ERROR, &trans_pcie->status); | ||
485 | iwl_op_mode_nic_error(trans->op_mode); | ||
486 | } | ||
487 | |||
480 | #endif /* __iwl_trans_int_pcie_h__ */ | 488 | #endif /* __iwl_trans_int_pcie_h__ */ |
diff --git a/drivers/net/wireless/iwlwifi/pcie/rx.c b/drivers/net/wireless/iwlwifi/pcie/rx.c index 3f237b42eb36..be3995afa9d0 100644 --- a/drivers/net/wireless/iwlwifi/pcie/rx.c +++ b/drivers/net/wireless/iwlwifi/pcie/rx.c | |||
@@ -489,6 +489,10 @@ static void iwl_pcie_rx_hw_init(struct iwl_trans *trans, struct iwl_rxq *rxq) | |||
489 | 489 | ||
490 | /* Set interrupt coalescing timer to default (2048 usecs) */ | 490 | /* Set interrupt coalescing timer to default (2048 usecs) */ |
491 | iwl_write8(trans, CSR_INT_COALESCING, IWL_HOST_INT_TIMEOUT_DEF); | 491 | iwl_write8(trans, CSR_INT_COALESCING, IWL_HOST_INT_TIMEOUT_DEF); |
492 | |||
493 | /* W/A for interrupt coalescing bug in 7260 and 3160 */ | ||
494 | if (trans->cfg->host_interrupt_operation_mode) | ||
495 | iwl_set_bit(trans, CSR_INT_COALESCING, IWL_HOST_INT_OPER_MODE); | ||
492 | } | 496 | } |
493 | 497 | ||
494 | static void iwl_pcie_rx_init_rxb_lists(struct iwl_rxq *rxq) | 498 | static void iwl_pcie_rx_init_rxb_lists(struct iwl_rxq *rxq) |
@@ -796,12 +800,13 @@ static void iwl_pcie_irq_handle_error(struct iwl_trans *trans) | |||
796 | iwl_pcie_dump_csr(trans); | 800 | iwl_pcie_dump_csr(trans); |
797 | iwl_dump_fh(trans, NULL); | 801 | iwl_dump_fh(trans, NULL); |
798 | 802 | ||
803 | /* set the ERROR bit before we wake up the caller */ | ||
799 | set_bit(STATUS_FW_ERROR, &trans_pcie->status); | 804 | set_bit(STATUS_FW_ERROR, &trans_pcie->status); |
800 | clear_bit(STATUS_HCMD_ACTIVE, &trans_pcie->status); | 805 | clear_bit(STATUS_HCMD_ACTIVE, &trans_pcie->status); |
801 | wake_up(&trans_pcie->wait_command_queue); | 806 | wake_up(&trans_pcie->wait_command_queue); |
802 | 807 | ||
803 | local_bh_disable(); | 808 | local_bh_disable(); |
804 | iwl_op_mode_nic_error(trans->op_mode); | 809 | iwl_nic_error(trans); |
805 | local_bh_enable(); | 810 | local_bh_enable(); |
806 | } | 811 | } |
807 | 812 | ||
diff --git a/drivers/net/wireless/iwlwifi/pcie/trans.c b/drivers/net/wireless/iwlwifi/pcie/trans.c index 5d9337bec67a..cde9c16f6e4f 100644 --- a/drivers/net/wireless/iwlwifi/pcie/trans.c +++ b/drivers/net/wireless/iwlwifi/pcie/trans.c | |||
@@ -279,9 +279,6 @@ static int iwl_pcie_nic_init(struct iwl_trans *trans) | |||
279 | spin_lock_irqsave(&trans_pcie->irq_lock, flags); | 279 | spin_lock_irqsave(&trans_pcie->irq_lock, flags); |
280 | iwl_pcie_apm_init(trans); | 280 | iwl_pcie_apm_init(trans); |
281 | 281 | ||
282 | /* Set interrupt coalescing calibration timer to default (512 usecs) */ | ||
283 | iwl_write8(trans, CSR_INT_COALESCING, IWL_HOST_INT_CALIB_TIMEOUT_DEF); | ||
284 | |||
285 | spin_unlock_irqrestore(&trans_pcie->irq_lock, flags); | 282 | spin_unlock_irqrestore(&trans_pcie->irq_lock, flags); |
286 | 283 | ||
287 | iwl_pcie_set_pwr(trans, false); | 284 | iwl_pcie_set_pwr(trans, false); |
diff --git a/drivers/net/wireless/iwlwifi/pcie/tx.c b/drivers/net/wireless/iwlwifi/pcie/tx.c index 059c5acad3a0..0adde919a258 100644 --- a/drivers/net/wireless/iwlwifi/pcie/tx.c +++ b/drivers/net/wireless/iwlwifi/pcie/tx.c | |||
@@ -207,7 +207,7 @@ static void iwl_pcie_txq_stuck_timer(unsigned long data) | |||
207 | IWL_ERR(trans, "scratch %d = 0x%08x\n", i, | 207 | IWL_ERR(trans, "scratch %d = 0x%08x\n", i, |
208 | le32_to_cpu(txq->scratchbufs[i].scratch)); | 208 | le32_to_cpu(txq->scratchbufs[i].scratch)); |
209 | 209 | ||
210 | iwl_op_mode_nic_error(trans->op_mode); | 210 | iwl_nic_error(trans); |
211 | } | 211 | } |
212 | 212 | ||
213 | /* | 213 | /* |
@@ -1023,7 +1023,7 @@ static void iwl_pcie_cmdq_reclaim(struct iwl_trans *trans, int txq_id, int idx) | |||
1023 | if (nfreed++ > 0) { | 1023 | if (nfreed++ > 0) { |
1024 | IWL_ERR(trans, "HCMD skipped: index (%d) %d %d\n", | 1024 | IWL_ERR(trans, "HCMD skipped: index (%d) %d %d\n", |
1025 | idx, q->write_ptr, q->read_ptr); | 1025 | idx, q->write_ptr, q->read_ptr); |
1026 | iwl_op_mode_nic_error(trans->op_mode); | 1026 | iwl_nic_error(trans); |
1027 | } | 1027 | } |
1028 | } | 1028 | } |
1029 | 1029 | ||
@@ -1562,7 +1562,7 @@ static int iwl_pcie_send_hcmd_sync(struct iwl_trans *trans, | |||
1562 | get_cmd_string(trans_pcie, cmd->id)); | 1562 | get_cmd_string(trans_pcie, cmd->id)); |
1563 | ret = -ETIMEDOUT; | 1563 | ret = -ETIMEDOUT; |
1564 | 1564 | ||
1565 | iwl_op_mode_nic_error(trans->op_mode); | 1565 | iwl_nic_error(trans); |
1566 | 1566 | ||
1567 | goto cancel; | 1567 | goto cancel; |
1568 | } | 1568 | } |
diff --git a/drivers/net/wireless/mac80211_hwsim.c b/drivers/net/wireless/mac80211_hwsim.c index 9df7bc91a26f..c72438bb2faf 100644 --- a/drivers/net/wireless/mac80211_hwsim.c +++ b/drivers/net/wireless/mac80211_hwsim.c | |||
@@ -383,6 +383,14 @@ struct hwsim_radiotap_hdr { | |||
383 | __le16 rt_chbitmask; | 383 | __le16 rt_chbitmask; |
384 | } __packed; | 384 | } __packed; |
385 | 385 | ||
386 | struct hwsim_radiotap_ack_hdr { | ||
387 | struct ieee80211_radiotap_header hdr; | ||
388 | u8 rt_flags; | ||
389 | u8 pad; | ||
390 | __le16 rt_channel; | ||
391 | __le16 rt_chbitmask; | ||
392 | } __packed; | ||
393 | |||
386 | /* MAC80211_HWSIM netlinf family */ | 394 | /* MAC80211_HWSIM netlinf family */ |
387 | static struct genl_family hwsim_genl_family = { | 395 | static struct genl_family hwsim_genl_family = { |
388 | .id = GENL_ID_GENERATE, | 396 | .id = GENL_ID_GENERATE, |
@@ -500,7 +508,7 @@ static void mac80211_hwsim_monitor_ack(struct ieee80211_channel *chan, | |||
500 | const u8 *addr) | 508 | const u8 *addr) |
501 | { | 509 | { |
502 | struct sk_buff *skb; | 510 | struct sk_buff *skb; |
503 | struct hwsim_radiotap_hdr *hdr; | 511 | struct hwsim_radiotap_ack_hdr *hdr; |
504 | u16 flags; | 512 | u16 flags; |
505 | struct ieee80211_hdr *hdr11; | 513 | struct ieee80211_hdr *hdr11; |
506 | 514 | ||
@@ -511,14 +519,14 @@ static void mac80211_hwsim_monitor_ack(struct ieee80211_channel *chan, | |||
511 | if (skb == NULL) | 519 | if (skb == NULL) |
512 | return; | 520 | return; |
513 | 521 | ||
514 | hdr = (struct hwsim_radiotap_hdr *) skb_put(skb, sizeof(*hdr)); | 522 | hdr = (struct hwsim_radiotap_ack_hdr *) skb_put(skb, sizeof(*hdr)); |
515 | hdr->hdr.it_version = PKTHDR_RADIOTAP_VERSION; | 523 | hdr->hdr.it_version = PKTHDR_RADIOTAP_VERSION; |
516 | hdr->hdr.it_pad = 0; | 524 | hdr->hdr.it_pad = 0; |
517 | hdr->hdr.it_len = cpu_to_le16(sizeof(*hdr)); | 525 | hdr->hdr.it_len = cpu_to_le16(sizeof(*hdr)); |
518 | hdr->hdr.it_present = cpu_to_le32((1 << IEEE80211_RADIOTAP_FLAGS) | | 526 | hdr->hdr.it_present = cpu_to_le32((1 << IEEE80211_RADIOTAP_FLAGS) | |
519 | (1 << IEEE80211_RADIOTAP_CHANNEL)); | 527 | (1 << IEEE80211_RADIOTAP_CHANNEL)); |
520 | hdr->rt_flags = 0; | 528 | hdr->rt_flags = 0; |
521 | hdr->rt_rate = 0; | 529 | hdr->pad = 0; |
522 | hdr->rt_channel = cpu_to_le16(chan->center_freq); | 530 | hdr->rt_channel = cpu_to_le16(chan->center_freq); |
523 | flags = IEEE80211_CHAN_2GHZ; | 531 | flags = IEEE80211_CHAN_2GHZ; |
524 | hdr->rt_chbitmask = cpu_to_le16(flags); | 532 | hdr->rt_chbitmask = cpu_to_le16(flags); |
@@ -1230,7 +1238,7 @@ static void mac80211_hwsim_bss_info_changed(struct ieee80211_hw *hw, | |||
1230 | HRTIMER_MODE_REL); | 1238 | HRTIMER_MODE_REL); |
1231 | } else if (!info->enable_beacon) { | 1239 | } else if (!info->enable_beacon) { |
1232 | unsigned int count = 0; | 1240 | unsigned int count = 0; |
1233 | ieee80211_iterate_active_interfaces( | 1241 | ieee80211_iterate_active_interfaces_atomic( |
1234 | data->hw, IEEE80211_IFACE_ITER_NORMAL, | 1242 | data->hw, IEEE80211_IFACE_ITER_NORMAL, |
1235 | mac80211_hwsim_bcn_en_iter, &count); | 1243 | mac80211_hwsim_bcn_en_iter, &count); |
1236 | wiphy_debug(hw->wiphy, " beaconing vifs remaining: %u", | 1244 | wiphy_debug(hw->wiphy, " beaconing vifs remaining: %u", |
diff --git a/drivers/net/wireless/mwifiex/sta_ioctl.c b/drivers/net/wireless/mwifiex/sta_ioctl.c index c8e029df770e..a09398fe9e2a 100644 --- a/drivers/net/wireless/mwifiex/sta_ioctl.c +++ b/drivers/net/wireless/mwifiex/sta_ioctl.c | |||
@@ -319,8 +319,8 @@ int mwifiex_bss_start(struct mwifiex_private *priv, struct cfg80211_bss *bss, | |||
319 | if (bss_desc && bss_desc->ssid.ssid_len && | 319 | if (bss_desc && bss_desc->ssid.ssid_len && |
320 | (!mwifiex_ssid_cmp(&priv->curr_bss_params.bss_descriptor. | 320 | (!mwifiex_ssid_cmp(&priv->curr_bss_params.bss_descriptor. |
321 | ssid, &bss_desc->ssid))) { | 321 | ssid, &bss_desc->ssid))) { |
322 | kfree(bss_desc); | 322 | ret = 0; |
323 | return 0; | 323 | goto done; |
324 | } | 324 | } |
325 | 325 | ||
326 | /* Exit Adhoc mode first */ | 326 | /* Exit Adhoc mode first */ |
diff --git a/drivers/net/xen-netback/interface.c b/drivers/net/xen-netback/interface.c index 2329cccf1fa6..870f1fa58370 100644 --- a/drivers/net/xen-netback/interface.c +++ b/drivers/net/xen-netback/interface.c | |||
@@ -368,11 +368,11 @@ int xenvif_connect(struct xenvif *vif, unsigned long tx_ring_ref, | |||
368 | unsigned long rx_ring_ref, unsigned int tx_evtchn, | 368 | unsigned long rx_ring_ref, unsigned int tx_evtchn, |
369 | unsigned int rx_evtchn) | 369 | unsigned int rx_evtchn) |
370 | { | 370 | { |
371 | struct task_struct *task; | ||
371 | int err = -ENOMEM; | 372 | int err = -ENOMEM; |
372 | 373 | ||
373 | /* Already connected through? */ | 374 | BUG_ON(vif->tx_irq); |
374 | if (vif->tx_irq) | 375 | BUG_ON(vif->task); |
375 | return 0; | ||
376 | 376 | ||
377 | err = xenvif_map_frontend_rings(vif, tx_ring_ref, rx_ring_ref); | 377 | err = xenvif_map_frontend_rings(vif, tx_ring_ref, rx_ring_ref); |
378 | if (err < 0) | 378 | if (err < 0) |
@@ -411,14 +411,16 @@ int xenvif_connect(struct xenvif *vif, unsigned long tx_ring_ref, | |||
411 | } | 411 | } |
412 | 412 | ||
413 | init_waitqueue_head(&vif->wq); | 413 | init_waitqueue_head(&vif->wq); |
414 | vif->task = kthread_create(xenvif_kthread, | 414 | task = kthread_create(xenvif_kthread, |
415 | (void *)vif, "%s", vif->dev->name); | 415 | (void *)vif, "%s", vif->dev->name); |
416 | if (IS_ERR(vif->task)) { | 416 | if (IS_ERR(task)) { |
417 | pr_warn("Could not allocate kthread for %s\n", vif->dev->name); | 417 | pr_warn("Could not allocate kthread for %s\n", vif->dev->name); |
418 | err = PTR_ERR(vif->task); | 418 | err = PTR_ERR(task); |
419 | goto err_rx_unbind; | 419 | goto err_rx_unbind; |
420 | } | 420 | } |
421 | 421 | ||
422 | vif->task = task; | ||
423 | |||
422 | rtnl_lock(); | 424 | rtnl_lock(); |
423 | if (!vif->can_sg && vif->dev->mtu > ETH_DATA_LEN) | 425 | if (!vif->can_sg && vif->dev->mtu > ETH_DATA_LEN) |
424 | dev_set_mtu(vif->dev, ETH_DATA_LEN); | 426 | dev_set_mtu(vif->dev, ETH_DATA_LEN); |
@@ -461,8 +463,10 @@ void xenvif_disconnect(struct xenvif *vif) | |||
461 | if (netif_carrier_ok(vif->dev)) | 463 | if (netif_carrier_ok(vif->dev)) |
462 | xenvif_carrier_off(vif); | 464 | xenvif_carrier_off(vif); |
463 | 465 | ||
464 | if (vif->task) | 466 | if (vif->task) { |
465 | kthread_stop(vif->task); | 467 | kthread_stop(vif->task); |
468 | vif->task = NULL; | ||
469 | } | ||
466 | 470 | ||
467 | if (vif->tx_irq) { | 471 | if (vif->tx_irq) { |
468 | if (vif->tx_irq == vif->rx_irq) | 472 | if (vif->tx_irq == vif->rx_irq) |
diff --git a/drivers/net/xen-netback/netback.c b/drivers/net/xen-netback/netback.c index 919b6509455c..e884ee1fe7ed 100644 --- a/drivers/net/xen-netback/netback.c +++ b/drivers/net/xen-netback/netback.c | |||
@@ -39,6 +39,7 @@ | |||
39 | #include <linux/udp.h> | 39 | #include <linux/udp.h> |
40 | 40 | ||
41 | #include <net/tcp.h> | 41 | #include <net/tcp.h> |
42 | #include <net/ip6_checksum.h> | ||
42 | 43 | ||
43 | #include <xen/xen.h> | 44 | #include <xen/xen.h> |
44 | #include <xen/events.h> | 45 | #include <xen/events.h> |
@@ -451,7 +452,7 @@ static int xenvif_gop_skb(struct sk_buff *skb, | |||
451 | } | 452 | } |
452 | 453 | ||
453 | /* Set up a GSO prefix descriptor, if necessary */ | 454 | /* Set up a GSO prefix descriptor, if necessary */ |
454 | if ((1 << skb_shinfo(skb)->gso_type) & vif->gso_prefix_mask) { | 455 | if ((1 << gso_type) & vif->gso_prefix_mask) { |
455 | req = RING_GET_REQUEST(&vif->rx, vif->rx.req_cons++); | 456 | req = RING_GET_REQUEST(&vif->rx, vif->rx.req_cons++); |
456 | meta = npo->meta + npo->meta_prod++; | 457 | meta = npo->meta + npo->meta_prod++; |
457 | meta->gso_type = gso_type; | 458 | meta->gso_type = gso_type; |
@@ -1148,75 +1149,92 @@ static int xenvif_set_skb_gso(struct xenvif *vif, | |||
1148 | return 0; | 1149 | return 0; |
1149 | } | 1150 | } |
1150 | 1151 | ||
1151 | static inline void maybe_pull_tail(struct sk_buff *skb, unsigned int len) | 1152 | static inline int maybe_pull_tail(struct sk_buff *skb, unsigned int len, |
1153 | unsigned int max) | ||
1152 | { | 1154 | { |
1153 | if (skb_is_nonlinear(skb) && skb_headlen(skb) < len) { | 1155 | if (skb_headlen(skb) >= len) |
1154 | /* If we need to pullup then pullup to the max, so we | 1156 | return 0; |
1155 | * won't need to do it again. | 1157 | |
1156 | */ | 1158 | /* If we need to pullup then pullup to the max, so we |
1157 | int target = min_t(int, skb->len, MAX_TCP_HEADER); | 1159 | * won't need to do it again. |
1158 | __pskb_pull_tail(skb, target - skb_headlen(skb)); | 1160 | */ |
1159 | } | 1161 | if (max > skb->len) |
1162 | max = skb->len; | ||
1163 | |||
1164 | if (__pskb_pull_tail(skb, max - skb_headlen(skb)) == NULL) | ||
1165 | return -ENOMEM; | ||
1166 | |||
1167 | if (skb_headlen(skb) < len) | ||
1168 | return -EPROTO; | ||
1169 | |||
1170 | return 0; | ||
1160 | } | 1171 | } |
1161 | 1172 | ||
1173 | /* This value should be large enough to cover a tagged ethernet header plus | ||
1174 | * maximally sized IP and TCP or UDP headers. | ||
1175 | */ | ||
1176 | #define MAX_IP_HDR_LEN 128 | ||
1177 | |||
1162 | static int checksum_setup_ip(struct xenvif *vif, struct sk_buff *skb, | 1178 | static int checksum_setup_ip(struct xenvif *vif, struct sk_buff *skb, |
1163 | int recalculate_partial_csum) | 1179 | int recalculate_partial_csum) |
1164 | { | 1180 | { |
1165 | struct iphdr *iph = (void *)skb->data; | ||
1166 | unsigned int header_size; | ||
1167 | unsigned int off; | 1181 | unsigned int off; |
1168 | int err = -EPROTO; | 1182 | bool fragment; |
1183 | int err; | ||
1169 | 1184 | ||
1170 | off = sizeof(struct iphdr); | 1185 | fragment = false; |
1171 | 1186 | ||
1172 | header_size = skb->network_header + off + MAX_IPOPTLEN; | 1187 | err = maybe_pull_tail(skb, |
1173 | maybe_pull_tail(skb, header_size); | 1188 | sizeof(struct iphdr), |
1189 | MAX_IP_HDR_LEN); | ||
1190 | if (err < 0) | ||
1191 | goto out; | ||
1174 | 1192 | ||
1175 | off = iph->ihl * 4; | 1193 | if (ip_hdr(skb)->frag_off & htons(IP_OFFSET | IP_MF)) |
1194 | fragment = true; | ||
1176 | 1195 | ||
1177 | switch (iph->protocol) { | 1196 | off = ip_hdrlen(skb); |
1197 | |||
1198 | err = -EPROTO; | ||
1199 | |||
1200 | switch (ip_hdr(skb)->protocol) { | ||
1178 | case IPPROTO_TCP: | 1201 | case IPPROTO_TCP: |
1202 | err = maybe_pull_tail(skb, | ||
1203 | off + sizeof(struct tcphdr), | ||
1204 | MAX_IP_HDR_LEN); | ||
1205 | if (err < 0) | ||
1206 | goto out; | ||
1207 | |||
1179 | if (!skb_partial_csum_set(skb, off, | 1208 | if (!skb_partial_csum_set(skb, off, |
1180 | offsetof(struct tcphdr, check))) | 1209 | offsetof(struct tcphdr, check))) |
1181 | goto out; | 1210 | goto out; |
1182 | 1211 | ||
1183 | if (recalculate_partial_csum) { | 1212 | if (recalculate_partial_csum) |
1184 | struct tcphdr *tcph = tcp_hdr(skb); | 1213 | tcp_hdr(skb)->check = |
1185 | 1214 | ~csum_tcpudp_magic(ip_hdr(skb)->saddr, | |
1186 | header_size = skb->network_header + | 1215 | ip_hdr(skb)->daddr, |
1187 | off + | 1216 | skb->len - off, |
1188 | sizeof(struct tcphdr); | 1217 | IPPROTO_TCP, 0); |
1189 | maybe_pull_tail(skb, header_size); | ||
1190 | |||
1191 | tcph->check = ~csum_tcpudp_magic(iph->saddr, iph->daddr, | ||
1192 | skb->len - off, | ||
1193 | IPPROTO_TCP, 0); | ||
1194 | } | ||
1195 | break; | 1218 | break; |
1196 | case IPPROTO_UDP: | 1219 | case IPPROTO_UDP: |
1220 | err = maybe_pull_tail(skb, | ||
1221 | off + sizeof(struct udphdr), | ||
1222 | MAX_IP_HDR_LEN); | ||
1223 | if (err < 0) | ||
1224 | goto out; | ||
1225 | |||
1197 | if (!skb_partial_csum_set(skb, off, | 1226 | if (!skb_partial_csum_set(skb, off, |
1198 | offsetof(struct udphdr, check))) | 1227 | offsetof(struct udphdr, check))) |
1199 | goto out; | 1228 | goto out; |
1200 | 1229 | ||
1201 | if (recalculate_partial_csum) { | 1230 | if (recalculate_partial_csum) |
1202 | struct udphdr *udph = udp_hdr(skb); | 1231 | udp_hdr(skb)->check = |
1203 | 1232 | ~csum_tcpudp_magic(ip_hdr(skb)->saddr, | |
1204 | header_size = skb->network_header + | 1233 | ip_hdr(skb)->daddr, |
1205 | off + | 1234 | skb->len - off, |
1206 | sizeof(struct udphdr); | 1235 | IPPROTO_UDP, 0); |
1207 | maybe_pull_tail(skb, header_size); | ||
1208 | |||
1209 | udph->check = ~csum_tcpudp_magic(iph->saddr, iph->daddr, | ||
1210 | skb->len - off, | ||
1211 | IPPROTO_UDP, 0); | ||
1212 | } | ||
1213 | break; | 1236 | break; |
1214 | default: | 1237 | default: |
1215 | if (net_ratelimit()) | ||
1216 | netdev_err(vif->dev, | ||
1217 | "Attempting to checksum a non-TCP/UDP packet, " | ||
1218 | "dropping a protocol %d packet\n", | ||
1219 | iph->protocol); | ||
1220 | goto out; | 1238 | goto out; |
1221 | } | 1239 | } |
1222 | 1240 | ||
@@ -1226,121 +1244,138 @@ out: | |||
1226 | return err; | 1244 | return err; |
1227 | } | 1245 | } |
1228 | 1246 | ||
1247 | /* This value should be large enough to cover a tagged ethernet header plus | ||
1248 | * an IPv6 header, all options, and a maximal TCP or UDP header. | ||
1249 | */ | ||
1250 | #define MAX_IPV6_HDR_LEN 256 | ||
1251 | |||
1252 | #define OPT_HDR(type, skb, off) \ | ||
1253 | (type *)(skb_network_header(skb) + (off)) | ||
1254 | |||
1229 | static int checksum_setup_ipv6(struct xenvif *vif, struct sk_buff *skb, | 1255 | static int checksum_setup_ipv6(struct xenvif *vif, struct sk_buff *skb, |
1230 | int recalculate_partial_csum) | 1256 | int recalculate_partial_csum) |
1231 | { | 1257 | { |
1232 | int err = -EPROTO; | 1258 | int err; |
1233 | struct ipv6hdr *ipv6h = (void *)skb->data; | ||
1234 | u8 nexthdr; | 1259 | u8 nexthdr; |
1235 | unsigned int header_size; | ||
1236 | unsigned int off; | 1260 | unsigned int off; |
1261 | unsigned int len; | ||
1237 | bool fragment; | 1262 | bool fragment; |
1238 | bool done; | 1263 | bool done; |
1239 | 1264 | ||
1265 | fragment = false; | ||
1240 | done = false; | 1266 | done = false; |
1241 | 1267 | ||
1242 | off = sizeof(struct ipv6hdr); | 1268 | off = sizeof(struct ipv6hdr); |
1243 | 1269 | ||
1244 | header_size = skb->network_header + off; | 1270 | err = maybe_pull_tail(skb, off, MAX_IPV6_HDR_LEN); |
1245 | maybe_pull_tail(skb, header_size); | 1271 | if (err < 0) |
1272 | goto out; | ||
1246 | 1273 | ||
1247 | nexthdr = ipv6h->nexthdr; | 1274 | nexthdr = ipv6_hdr(skb)->nexthdr; |
1248 | 1275 | ||
1249 | while ((off <= sizeof(struct ipv6hdr) + ntohs(ipv6h->payload_len)) && | 1276 | len = sizeof(struct ipv6hdr) + ntohs(ipv6_hdr(skb)->payload_len); |
1250 | !done) { | 1277 | while (off <= len && !done) { |
1251 | switch (nexthdr) { | 1278 | switch (nexthdr) { |
1252 | case IPPROTO_DSTOPTS: | 1279 | case IPPROTO_DSTOPTS: |
1253 | case IPPROTO_HOPOPTS: | 1280 | case IPPROTO_HOPOPTS: |
1254 | case IPPROTO_ROUTING: { | 1281 | case IPPROTO_ROUTING: { |
1255 | struct ipv6_opt_hdr *hp = (void *)(skb->data + off); | 1282 | struct ipv6_opt_hdr *hp; |
1256 | 1283 | ||
1257 | header_size = skb->network_header + | 1284 | err = maybe_pull_tail(skb, |
1258 | off + | 1285 | off + |
1259 | sizeof(struct ipv6_opt_hdr); | 1286 | sizeof(struct ipv6_opt_hdr), |
1260 | maybe_pull_tail(skb, header_size); | 1287 | MAX_IPV6_HDR_LEN); |
1288 | if (err < 0) | ||
1289 | goto out; | ||
1261 | 1290 | ||
1291 | hp = OPT_HDR(struct ipv6_opt_hdr, skb, off); | ||
1262 | nexthdr = hp->nexthdr; | 1292 | nexthdr = hp->nexthdr; |
1263 | off += ipv6_optlen(hp); | 1293 | off += ipv6_optlen(hp); |
1264 | break; | 1294 | break; |
1265 | } | 1295 | } |
1266 | case IPPROTO_AH: { | 1296 | case IPPROTO_AH: { |
1267 | struct ip_auth_hdr *hp = (void *)(skb->data + off); | 1297 | struct ip_auth_hdr *hp; |
1268 | 1298 | ||
1269 | header_size = skb->network_header + | 1299 | err = maybe_pull_tail(skb, |
1270 | off + | 1300 | off + |
1271 | sizeof(struct ip_auth_hdr); | 1301 | sizeof(struct ip_auth_hdr), |
1272 | maybe_pull_tail(skb, header_size); | 1302 | MAX_IPV6_HDR_LEN); |
1303 | if (err < 0) | ||
1304 | goto out; | ||
1273 | 1305 | ||
1306 | hp = OPT_HDR(struct ip_auth_hdr, skb, off); | ||
1274 | nexthdr = hp->nexthdr; | 1307 | nexthdr = hp->nexthdr; |
1275 | off += (hp->hdrlen+2)<<2; | 1308 | off += ipv6_authlen(hp); |
1309 | break; | ||
1310 | } | ||
1311 | case IPPROTO_FRAGMENT: { | ||
1312 | struct frag_hdr *hp; | ||
1313 | |||
1314 | err = maybe_pull_tail(skb, | ||
1315 | off + | ||
1316 | sizeof(struct frag_hdr), | ||
1317 | MAX_IPV6_HDR_LEN); | ||
1318 | if (err < 0) | ||
1319 | goto out; | ||
1320 | |||
1321 | hp = OPT_HDR(struct frag_hdr, skb, off); | ||
1322 | |||
1323 | if (hp->frag_off & htons(IP6_OFFSET | IP6_MF)) | ||
1324 | fragment = true; | ||
1325 | |||
1326 | nexthdr = hp->nexthdr; | ||
1327 | off += sizeof(struct frag_hdr); | ||
1276 | break; | 1328 | break; |
1277 | } | 1329 | } |
1278 | case IPPROTO_FRAGMENT: | ||
1279 | fragment = true; | ||
1280 | /* fall through */ | ||
1281 | default: | 1330 | default: |
1282 | done = true; | 1331 | done = true; |
1283 | break; | 1332 | break; |
1284 | } | 1333 | } |
1285 | } | 1334 | } |
1286 | 1335 | ||
1287 | if (!done) { | 1336 | err = -EPROTO; |
1288 | if (net_ratelimit()) | ||
1289 | netdev_err(vif->dev, "Failed to parse packet header\n"); | ||
1290 | goto out; | ||
1291 | } | ||
1292 | 1337 | ||
1293 | if (fragment) { | 1338 | if (!done || fragment) |
1294 | if (net_ratelimit()) | ||
1295 | netdev_err(vif->dev, "Packet is a fragment!\n"); | ||
1296 | goto out; | 1339 | goto out; |
1297 | } | ||
1298 | 1340 | ||
1299 | switch (nexthdr) { | 1341 | switch (nexthdr) { |
1300 | case IPPROTO_TCP: | 1342 | case IPPROTO_TCP: |
1343 | err = maybe_pull_tail(skb, | ||
1344 | off + sizeof(struct tcphdr), | ||
1345 | MAX_IPV6_HDR_LEN); | ||
1346 | if (err < 0) | ||
1347 | goto out; | ||
1348 | |||
1301 | if (!skb_partial_csum_set(skb, off, | 1349 | if (!skb_partial_csum_set(skb, off, |
1302 | offsetof(struct tcphdr, check))) | 1350 | offsetof(struct tcphdr, check))) |
1303 | goto out; | 1351 | goto out; |
1304 | 1352 | ||
1305 | if (recalculate_partial_csum) { | 1353 | if (recalculate_partial_csum) |
1306 | struct tcphdr *tcph = tcp_hdr(skb); | 1354 | tcp_hdr(skb)->check = |
1307 | 1355 | ~csum_ipv6_magic(&ipv6_hdr(skb)->saddr, | |
1308 | header_size = skb->network_header + | 1356 | &ipv6_hdr(skb)->daddr, |
1309 | off + | 1357 | skb->len - off, |
1310 | sizeof(struct tcphdr); | 1358 | IPPROTO_TCP, 0); |
1311 | maybe_pull_tail(skb, header_size); | ||
1312 | |||
1313 | tcph->check = ~csum_ipv6_magic(&ipv6h->saddr, | ||
1314 | &ipv6h->daddr, | ||
1315 | skb->len - off, | ||
1316 | IPPROTO_TCP, 0); | ||
1317 | } | ||
1318 | break; | 1359 | break; |
1319 | case IPPROTO_UDP: | 1360 | case IPPROTO_UDP: |
1361 | err = maybe_pull_tail(skb, | ||
1362 | off + sizeof(struct udphdr), | ||
1363 | MAX_IPV6_HDR_LEN); | ||
1364 | if (err < 0) | ||
1365 | goto out; | ||
1366 | |||
1320 | if (!skb_partial_csum_set(skb, off, | 1367 | if (!skb_partial_csum_set(skb, off, |
1321 | offsetof(struct udphdr, check))) | 1368 | offsetof(struct udphdr, check))) |
1322 | goto out; | 1369 | goto out; |
1323 | 1370 | ||
1324 | if (recalculate_partial_csum) { | 1371 | if (recalculate_partial_csum) |
1325 | struct udphdr *udph = udp_hdr(skb); | 1372 | udp_hdr(skb)->check = |
1326 | 1373 | ~csum_ipv6_magic(&ipv6_hdr(skb)->saddr, | |
1327 | header_size = skb->network_header + | 1374 | &ipv6_hdr(skb)->daddr, |
1328 | off + | 1375 | skb->len - off, |
1329 | sizeof(struct udphdr); | 1376 | IPPROTO_UDP, 0); |
1330 | maybe_pull_tail(skb, header_size); | ||
1331 | |||
1332 | udph->check = ~csum_ipv6_magic(&ipv6h->saddr, | ||
1333 | &ipv6h->daddr, | ||
1334 | skb->len - off, | ||
1335 | IPPROTO_UDP, 0); | ||
1336 | } | ||
1337 | break; | 1377 | break; |
1338 | default: | 1378 | default: |
1339 | if (net_ratelimit()) | ||
1340 | netdev_err(vif->dev, | ||
1341 | "Attempting to checksum a non-TCP/UDP packet, " | ||
1342 | "dropping a protocol %d packet\n", | ||
1343 | nexthdr); | ||
1344 | goto out; | 1379 | goto out; |
1345 | } | 1380 | } |
1346 | 1381 | ||
@@ -1410,14 +1445,15 @@ static bool tx_credit_exceeded(struct xenvif *vif, unsigned size) | |||
1410 | return false; | 1445 | return false; |
1411 | } | 1446 | } |
1412 | 1447 | ||
1413 | static unsigned xenvif_tx_build_gops(struct xenvif *vif) | 1448 | static unsigned xenvif_tx_build_gops(struct xenvif *vif, int budget) |
1414 | { | 1449 | { |
1415 | struct gnttab_copy *gop = vif->tx_copy_ops, *request_gop; | 1450 | struct gnttab_copy *gop = vif->tx_copy_ops, *request_gop; |
1416 | struct sk_buff *skb; | 1451 | struct sk_buff *skb; |
1417 | int ret; | 1452 | int ret; |
1418 | 1453 | ||
1419 | while ((nr_pending_reqs(vif) + XEN_NETBK_LEGACY_SLOTS_MAX | 1454 | while ((nr_pending_reqs(vif) + XEN_NETBK_LEGACY_SLOTS_MAX |
1420 | < MAX_PENDING_REQS)) { | 1455 | < MAX_PENDING_REQS) && |
1456 | (skb_queue_len(&vif->tx_queue) < budget)) { | ||
1421 | struct xen_netif_tx_request txreq; | 1457 | struct xen_netif_tx_request txreq; |
1422 | struct xen_netif_tx_request txfrags[XEN_NETBK_LEGACY_SLOTS_MAX]; | 1458 | struct xen_netif_tx_request txfrags[XEN_NETBK_LEGACY_SLOTS_MAX]; |
1423 | struct page *page; | 1459 | struct page *page; |
@@ -1439,7 +1475,7 @@ static unsigned xenvif_tx_build_gops(struct xenvif *vif) | |||
1439 | continue; | 1475 | continue; |
1440 | } | 1476 | } |
1441 | 1477 | ||
1442 | RING_FINAL_CHECK_FOR_REQUESTS(&vif->tx, work_to_do); | 1478 | work_to_do = RING_HAS_UNCONSUMED_REQUESTS(&vif->tx); |
1443 | if (!work_to_do) | 1479 | if (!work_to_do) |
1444 | break; | 1480 | break; |
1445 | 1481 | ||
@@ -1579,14 +1615,13 @@ static unsigned xenvif_tx_build_gops(struct xenvif *vif) | |||
1579 | } | 1615 | } |
1580 | 1616 | ||
1581 | 1617 | ||
1582 | static int xenvif_tx_submit(struct xenvif *vif, int budget) | 1618 | static int xenvif_tx_submit(struct xenvif *vif) |
1583 | { | 1619 | { |
1584 | struct gnttab_copy *gop = vif->tx_copy_ops; | 1620 | struct gnttab_copy *gop = vif->tx_copy_ops; |
1585 | struct sk_buff *skb; | 1621 | struct sk_buff *skb; |
1586 | int work_done = 0; | 1622 | int work_done = 0; |
1587 | 1623 | ||
1588 | while (work_done < budget && | 1624 | while ((skb = __skb_dequeue(&vif->tx_queue)) != NULL) { |
1589 | (skb = __skb_dequeue(&vif->tx_queue)) != NULL) { | ||
1590 | struct xen_netif_tx_request *txp; | 1625 | struct xen_netif_tx_request *txp; |
1591 | u16 pending_idx; | 1626 | u16 pending_idx; |
1592 | unsigned data_len; | 1627 | unsigned data_len; |
@@ -1661,14 +1696,14 @@ int xenvif_tx_action(struct xenvif *vif, int budget) | |||
1661 | if (unlikely(!tx_work_todo(vif))) | 1696 | if (unlikely(!tx_work_todo(vif))) |
1662 | return 0; | 1697 | return 0; |
1663 | 1698 | ||
1664 | nr_gops = xenvif_tx_build_gops(vif); | 1699 | nr_gops = xenvif_tx_build_gops(vif, budget); |
1665 | 1700 | ||
1666 | if (nr_gops == 0) | 1701 | if (nr_gops == 0) |
1667 | return 0; | 1702 | return 0; |
1668 | 1703 | ||
1669 | gnttab_batch_copy(vif->tx_copy_ops, nr_gops); | 1704 | gnttab_batch_copy(vif->tx_copy_ops, nr_gops); |
1670 | 1705 | ||
1671 | work_done = xenvif_tx_submit(vif, nr_gops); | 1706 | work_done = xenvif_tx_submit(vif); |
1672 | 1707 | ||
1673 | return work_done; | 1708 | return work_done; |
1674 | } | 1709 | } |
diff --git a/drivers/pci/host/pci-mvebu.c b/drivers/pci/host/pci-mvebu.c index c269e430c760..2aa7b77c7c88 100644 --- a/drivers/pci/host/pci-mvebu.c +++ b/drivers/pci/host/pci-mvebu.c | |||
@@ -447,6 +447,11 @@ static int mvebu_sw_pci_bridge_read(struct mvebu_pcie_port *port, | |||
447 | *value = 0; | 447 | *value = 0; |
448 | break; | 448 | break; |
449 | 449 | ||
450 | case PCI_INTERRUPT_LINE: | ||
451 | /* LINE PIN MIN_GNT MAX_LAT */ | ||
452 | *value = 0; | ||
453 | break; | ||
454 | |||
450 | default: | 455 | default: |
451 | *value = 0xffffffff; | 456 | *value = 0xffffffff; |
452 | return PCIBIOS_BAD_REGISTER_NUMBER; | 457 | return PCIBIOS_BAD_REGISTER_NUMBER; |
diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c index 9042fdbd7244..25f0bc659164 100644 --- a/drivers/pci/pci-driver.c +++ b/drivers/pci/pci-driver.c | |||
@@ -19,6 +19,7 @@ | |||
19 | #include <linux/cpu.h> | 19 | #include <linux/cpu.h> |
20 | #include <linux/pm_runtime.h> | 20 | #include <linux/pm_runtime.h> |
21 | #include <linux/suspend.h> | 21 | #include <linux/suspend.h> |
22 | #include <linux/kexec.h> | ||
22 | #include "pci.h" | 23 | #include "pci.h" |
23 | 24 | ||
24 | struct pci_dynid { | 25 | struct pci_dynid { |
@@ -288,12 +289,27 @@ static int pci_call_probe(struct pci_driver *drv, struct pci_dev *dev, | |||
288 | int error, node; | 289 | int error, node; |
289 | struct drv_dev_and_id ddi = { drv, dev, id }; | 290 | struct drv_dev_and_id ddi = { drv, dev, id }; |
290 | 291 | ||
291 | /* Execute driver initialization on node where the device's | 292 | /* |
292 | bus is attached to. This way the driver likely allocates | 293 | * Execute driver initialization on node where the device is |
293 | its local memory on the right node without any need to | 294 | * attached. This way the driver likely allocates its local memory |
294 | change it. */ | 295 | * on the right node. |
296 | */ | ||
295 | node = dev_to_node(&dev->dev); | 297 | node = dev_to_node(&dev->dev); |
296 | if (node >= 0) { | 298 | |
299 | /* | ||
300 | * On NUMA systems, we are likely to call a PF probe function using | ||
301 | * work_on_cpu(). If that probe calls pci_enable_sriov() (which | ||
302 | * adds the VF devices via pci_bus_add_device()), we may re-enter | ||
303 | * this function to call the VF probe function. Calling | ||
304 | * work_on_cpu() again will cause a lockdep warning. Since VFs are | ||
305 | * always on the same node as the PF, we can work around this by | ||
306 | * avoiding work_on_cpu() when we're already on the correct node. | ||
307 | * | ||
308 | * Preemption is enabled, so it's theoretically unsafe to use | ||
309 | * numa_node_id(), but even if we run the probe function on the | ||
310 | * wrong node, it should be functionally correct. | ||
311 | */ | ||
312 | if (node >= 0 && node != numa_node_id()) { | ||
297 | int cpu; | 313 | int cpu; |
298 | 314 | ||
299 | get_online_cpus(); | 315 | get_online_cpus(); |
@@ -305,6 +321,7 @@ static int pci_call_probe(struct pci_driver *drv, struct pci_dev *dev, | |||
305 | put_online_cpus(); | 321 | put_online_cpus(); |
306 | } else | 322 | } else |
307 | error = local_pci_probe(&ddi); | 323 | error = local_pci_probe(&ddi); |
324 | |||
308 | return error; | 325 | return error; |
309 | } | 326 | } |
310 | 327 | ||
@@ -399,12 +416,17 @@ static void pci_device_shutdown(struct device *dev) | |||
399 | pci_msi_shutdown(pci_dev); | 416 | pci_msi_shutdown(pci_dev); |
400 | pci_msix_shutdown(pci_dev); | 417 | pci_msix_shutdown(pci_dev); |
401 | 418 | ||
419 | #ifdef CONFIG_KEXEC | ||
402 | /* | 420 | /* |
403 | * Turn off Bus Master bit on the device to tell it to not | 421 | * If this is a kexec reboot, turn off Bus Master bit on the |
404 | * continue to do DMA. Don't touch devices in D3cold or unknown states. | 422 | * device to tell it to not continue to do DMA. Don't touch |
423 | * devices in D3cold or unknown states. | ||
424 | * If it is not a kexec reboot, firmware will hit the PCI | ||
425 | * devices with big hammer and stop their DMA any way. | ||
405 | */ | 426 | */ |
406 | if (pci_dev->current_state <= PCI_D3hot) | 427 | if (kexec_in_progress && (pci_dev->current_state <= PCI_D3hot)) |
407 | pci_clear_master(pci_dev); | 428 | pci_clear_master(pci_dev); |
429 | #endif | ||
408 | } | 430 | } |
409 | 431 | ||
410 | #ifdef CONFIG_PM | 432 | #ifdef CONFIG_PM |
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index 33120d156668..07369f32e8bb 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c | |||
@@ -4165,6 +4165,14 @@ int pci_set_vga_state(struct pci_dev *dev, bool decode, | |||
4165 | return 0; | 4165 | return 0; |
4166 | } | 4166 | } |
4167 | 4167 | ||
4168 | bool pci_device_is_present(struct pci_dev *pdev) | ||
4169 | { | ||
4170 | u32 v; | ||
4171 | |||
4172 | return pci_bus_read_dev_vendor_id(pdev->bus, pdev->devfn, &v, 0); | ||
4173 | } | ||
4174 | EXPORT_SYMBOL_GPL(pci_device_is_present); | ||
4175 | |||
4168 | #define RESOURCE_ALIGNMENT_PARAM_SIZE COMMAND_LINE_SIZE | 4176 | #define RESOURCE_ALIGNMENT_PARAM_SIZE COMMAND_LINE_SIZE |
4169 | static char resource_alignment_param[RESOURCE_ALIGNMENT_PARAM_SIZE] = {0}; | 4177 | static char resource_alignment_param[RESOURCE_ALIGNMENT_PARAM_SIZE] = {0}; |
4170 | static DEFINE_SPINLOCK(resource_alignment_lock); | 4178 | static DEFINE_SPINLOCK(resource_alignment_lock); |
diff --git a/drivers/pci/remove.c b/drivers/pci/remove.c index 1576851028db..cc9337a71529 100644 --- a/drivers/pci/remove.c +++ b/drivers/pci/remove.c | |||
@@ -24,7 +24,7 @@ static void pci_stop_dev(struct pci_dev *dev) | |||
24 | if (dev->is_added) { | 24 | if (dev->is_added) { |
25 | pci_proc_detach_device(dev); | 25 | pci_proc_detach_device(dev); |
26 | pci_remove_sysfs_dev_files(dev); | 26 | pci_remove_sysfs_dev_files(dev); |
27 | device_del(&dev->dev); | 27 | device_release_driver(&dev->dev); |
28 | dev->is_added = 0; | 28 | dev->is_added = 0; |
29 | } | 29 | } |
30 | 30 | ||
@@ -34,6 +34,8 @@ static void pci_stop_dev(struct pci_dev *dev) | |||
34 | 34 | ||
35 | static void pci_destroy_dev(struct pci_dev *dev) | 35 | static void pci_destroy_dev(struct pci_dev *dev) |
36 | { | 36 | { |
37 | device_del(&dev->dev); | ||
38 | |||
37 | down_write(&pci_bus_sem); | 39 | down_write(&pci_bus_sem); |
38 | list_del(&dev->bus_list); | 40 | list_del(&dev->bus_list); |
39 | up_write(&pci_bus_sem); | 41 | up_write(&pci_bus_sem); |
diff --git a/drivers/pinctrl/pinctrl-abx500.c b/drivers/pinctrl/pinctrl-abx500.c index 4780959e11d4..5183e7bb8de3 100644 --- a/drivers/pinctrl/pinctrl-abx500.c +++ b/drivers/pinctrl/pinctrl-abx500.c | |||
@@ -418,7 +418,7 @@ static int abx500_set_mode(struct pinctrl_dev *pctldev, struct gpio_chip *chip, | |||
418 | ret = abx500_gpio_set_bits(chip, | 418 | ret = abx500_gpio_set_bits(chip, |
419 | AB8500_GPIO_ALTFUN_REG, | 419 | AB8500_GPIO_ALTFUN_REG, |
420 | af.alt_bit1, | 420 | af.alt_bit1, |
421 | !!(af.alta_val && BIT(0))); | 421 | !!(af.alta_val & BIT(0))); |
422 | if (ret < 0) | 422 | if (ret < 0) |
423 | goto out; | 423 | goto out; |
424 | 424 | ||
@@ -439,7 +439,7 @@ static int abx500_set_mode(struct pinctrl_dev *pctldev, struct gpio_chip *chip, | |||
439 | goto out; | 439 | goto out; |
440 | 440 | ||
441 | ret = abx500_gpio_set_bits(chip, AB8500_GPIO_ALTFUN_REG, | 441 | ret = abx500_gpio_set_bits(chip, AB8500_GPIO_ALTFUN_REG, |
442 | af.alt_bit1, !!(af.altb_val && BIT(0))); | 442 | af.alt_bit1, !!(af.altb_val & BIT(0))); |
443 | if (ret < 0) | 443 | if (ret < 0) |
444 | goto out; | 444 | goto out; |
445 | 445 | ||
@@ -462,7 +462,7 @@ static int abx500_set_mode(struct pinctrl_dev *pctldev, struct gpio_chip *chip, | |||
462 | goto out; | 462 | goto out; |
463 | 463 | ||
464 | ret = abx500_gpio_set_bits(chip, AB8500_GPIO_ALTFUN_REG, | 464 | ret = abx500_gpio_set_bits(chip, AB8500_GPIO_ALTFUN_REG, |
465 | af.alt_bit2, !!(af.altc_val && BIT(1))); | 465 | af.alt_bit2, !!(af.altc_val & BIT(1))); |
466 | break; | 466 | break; |
467 | 467 | ||
468 | default: | 468 | default: |
diff --git a/drivers/pinctrl/pinctrl-abx500.h b/drivers/pinctrl/pinctrl-abx500.h index eeca8f973999..82293806e842 100644 --- a/drivers/pinctrl/pinctrl-abx500.h +++ b/drivers/pinctrl/pinctrl-abx500.h | |||
@@ -1,4 +1,4 @@ | |||
1 | #ifndef PINCTRL_PINCTRL_ABx5O0_H | 1 | #ifndef PINCTRL_PINCTRL_ABx500_H |
2 | #define PINCTRL_PINCTRL_ABx500_H | 2 | #define PINCTRL_PINCTRL_ABx500_H |
3 | 3 | ||
4 | /* Package definitions */ | 4 | /* Package definitions */ |
diff --git a/drivers/pinctrl/pinctrl-rockchip.c b/drivers/pinctrl/pinctrl-rockchip.c index e939c28cbf1f..46dddc159286 100644 --- a/drivers/pinctrl/pinctrl-rockchip.c +++ b/drivers/pinctrl/pinctrl-rockchip.c | |||
@@ -504,6 +504,7 @@ static int rockchip_set_pull(struct rockchip_pin_bank *bank, | |||
504 | data |= (3 << bit); | 504 | data |= (3 << bit); |
505 | break; | 505 | break; |
506 | default: | 506 | default: |
507 | spin_unlock_irqrestore(&bank->slock, flags); | ||
507 | dev_err(info->dev, "unsupported pull setting %d\n", | 508 | dev_err(info->dev, "unsupported pull setting %d\n", |
508 | pull); | 509 | pull); |
509 | return -EINVAL; | 510 | return -EINVAL; |
@@ -1453,8 +1454,8 @@ static int rockchip_pinctrl_probe(struct platform_device *pdev) | |||
1453 | if (ctrl->type == RK3188) { | 1454 | if (ctrl->type == RK3188) { |
1454 | res = platform_get_resource(pdev, IORESOURCE_MEM, 1); | 1455 | res = platform_get_resource(pdev, IORESOURCE_MEM, 1); |
1455 | info->reg_pull = devm_ioremap_resource(&pdev->dev, res); | 1456 | info->reg_pull = devm_ioremap_resource(&pdev->dev, res); |
1456 | if (IS_ERR(info->reg_base)) | 1457 | if (IS_ERR(info->reg_pull)) |
1457 | return PTR_ERR(info->reg_base); | 1458 | return PTR_ERR(info->reg_pull); |
1458 | } | 1459 | } |
1459 | 1460 | ||
1460 | ret = rockchip_gpiolib_register(pdev, info); | 1461 | ret = rockchip_gpiolib_register(pdev, info); |
diff --git a/drivers/pinctrl/sh-pfc/pfc-r8a7740.c b/drivers/pinctrl/sh-pfc/pfc-r8a7740.c index 009174d07767..bc5eb453a45c 100644 --- a/drivers/pinctrl/sh-pfc/pfc-r8a7740.c +++ b/drivers/pinctrl/sh-pfc/pfc-r8a7740.c | |||
@@ -3720,7 +3720,7 @@ static void __iomem *r8a7740_pinmux_portcr(struct sh_pfc *pfc, unsigned int pin) | |||
3720 | const struct r8a7740_portcr_group *group = | 3720 | const struct r8a7740_portcr_group *group = |
3721 | &r8a7740_portcr_offsets[i]; | 3721 | &r8a7740_portcr_offsets[i]; |
3722 | 3722 | ||
3723 | if (i <= group->end_pin) | 3723 | if (pin <= group->end_pin) |
3724 | return pfc->window->virt + group->offset + pin; | 3724 | return pfc->window->virt + group->offset + pin; |
3725 | } | 3725 | } |
3726 | 3726 | ||
diff --git a/drivers/pinctrl/sh-pfc/pfc-sh7372.c b/drivers/pinctrl/sh-pfc/pfc-sh7372.c index 70b522d34821..cc097b693820 100644 --- a/drivers/pinctrl/sh-pfc/pfc-sh7372.c +++ b/drivers/pinctrl/sh-pfc/pfc-sh7372.c | |||
@@ -2584,7 +2584,7 @@ static void __iomem *sh7372_pinmux_portcr(struct sh_pfc *pfc, unsigned int pin) | |||
2584 | const struct sh7372_portcr_group *group = | 2584 | const struct sh7372_portcr_group *group = |
2585 | &sh7372_portcr_offsets[i]; | 2585 | &sh7372_portcr_offsets[i]; |
2586 | 2586 | ||
2587 | if (i <= group->end_pin) | 2587 | if (pin <= group->end_pin) |
2588 | return pfc->window->virt + group->offset + pin; | 2588 | return pfc->window->virt + group->offset + pin; |
2589 | } | 2589 | } |
2590 | 2590 | ||
diff --git a/drivers/pnp/driver.c b/drivers/pnp/driver.c index 6936e0acedcd..f748cc8cbb03 100644 --- a/drivers/pnp/driver.c +++ b/drivers/pnp/driver.c | |||
@@ -197,6 +197,11 @@ static int pnp_bus_freeze(struct device *dev) | |||
197 | return __pnp_bus_suspend(dev, PMSG_FREEZE); | 197 | return __pnp_bus_suspend(dev, PMSG_FREEZE); |
198 | } | 198 | } |
199 | 199 | ||
200 | static int pnp_bus_poweroff(struct device *dev) | ||
201 | { | ||
202 | return __pnp_bus_suspend(dev, PMSG_HIBERNATE); | ||
203 | } | ||
204 | |||
200 | static int pnp_bus_resume(struct device *dev) | 205 | static int pnp_bus_resume(struct device *dev) |
201 | { | 206 | { |
202 | struct pnp_dev *pnp_dev = to_pnp_dev(dev); | 207 | struct pnp_dev *pnp_dev = to_pnp_dev(dev); |
@@ -234,9 +239,14 @@ static int pnp_bus_resume(struct device *dev) | |||
234 | } | 239 | } |
235 | 240 | ||
236 | static const struct dev_pm_ops pnp_bus_dev_pm_ops = { | 241 | static const struct dev_pm_ops pnp_bus_dev_pm_ops = { |
242 | /* Suspend callbacks */ | ||
237 | .suspend = pnp_bus_suspend, | 243 | .suspend = pnp_bus_suspend, |
238 | .freeze = pnp_bus_freeze, | ||
239 | .resume = pnp_bus_resume, | 244 | .resume = pnp_bus_resume, |
245 | /* Hibernate callbacks */ | ||
246 | .freeze = pnp_bus_freeze, | ||
247 | .thaw = pnp_bus_resume, | ||
248 | .poweroff = pnp_bus_poweroff, | ||
249 | .restore = pnp_bus_resume, | ||
240 | }; | 250 | }; |
241 | 251 | ||
242 | struct bus_type pnp_bus_type = { | 252 | struct bus_type pnp_bus_type = { |
diff --git a/drivers/powercap/powercap_sys.c b/drivers/powercap/powercap_sys.c index 8d0fe431dbdd..84419af16f77 100644 --- a/drivers/powercap/powercap_sys.c +++ b/drivers/powercap/powercap_sys.c | |||
@@ -377,9 +377,14 @@ static void create_power_zone_common_attributes( | |||
377 | if (power_zone->ops->get_max_energy_range_uj) | 377 | if (power_zone->ops->get_max_energy_range_uj) |
378 | power_zone->zone_dev_attrs[count++] = | 378 | power_zone->zone_dev_attrs[count++] = |
379 | &dev_attr_max_energy_range_uj.attr; | 379 | &dev_attr_max_energy_range_uj.attr; |
380 | if (power_zone->ops->get_energy_uj) | 380 | if (power_zone->ops->get_energy_uj) { |
381 | if (power_zone->ops->reset_energy_uj) | ||
382 | dev_attr_energy_uj.attr.mode = S_IWUSR | S_IRUGO; | ||
383 | else | ||
384 | dev_attr_energy_uj.attr.mode = S_IRUGO; | ||
381 | power_zone->zone_dev_attrs[count++] = | 385 | power_zone->zone_dev_attrs[count++] = |
382 | &dev_attr_energy_uj.attr; | 386 | &dev_attr_energy_uj.attr; |
387 | } | ||
383 | if (power_zone->ops->get_power_uw) | 388 | if (power_zone->ops->get_power_uw) |
384 | power_zone->zone_dev_attrs[count++] = | 389 | power_zone->zone_dev_attrs[count++] = |
385 | &dev_attr_power_uw.attr; | 390 | &dev_attr_power_uw.attr; |
diff --git a/drivers/regulator/as3722-regulator.c b/drivers/regulator/as3722-regulator.c index 5917fe3dc983..b9f1d24c6812 100644 --- a/drivers/regulator/as3722-regulator.c +++ b/drivers/regulator/as3722-regulator.c | |||
@@ -590,8 +590,8 @@ static int as3722_sd016_set_current_limit(struct regulator_dev *rdev, | |||
590 | default: | 590 | default: |
591 | return -EINVAL; | 591 | return -EINVAL; |
592 | } | 592 | } |
593 | ret <<= ffs(mask) - 1; | ||
593 | val = ret & mask; | 594 | val = ret & mask; |
594 | val <<= ffs(mask) - 1; | ||
595 | return as3722_update_bits(as3722, reg, mask, val); | 595 | return as3722_update_bits(as3722, reg, mask, val); |
596 | } | 596 | } |
597 | 597 | ||
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c index 3fe13130baec..d85f31385b24 100644 --- a/drivers/regulator/core.c +++ b/drivers/regulator/core.c | |||
@@ -119,6 +119,11 @@ static const char *rdev_get_name(struct regulator_dev *rdev) | |||
119 | return ""; | 119 | return ""; |
120 | } | 120 | } |
121 | 121 | ||
122 | static bool have_full_constraints(void) | ||
123 | { | ||
124 | return has_full_constraints || of_have_populated_dt(); | ||
125 | } | ||
126 | |||
122 | /** | 127 | /** |
123 | * of_get_regulator - get a regulator device node based on supply name | 128 | * of_get_regulator - get a regulator device node based on supply name |
124 | * @dev: Device pointer for the consumer (of regulator) device | 129 | * @dev: Device pointer for the consumer (of regulator) device |
@@ -1340,7 +1345,7 @@ static struct regulator *_regulator_get(struct device *dev, const char *id, | |||
1340 | * Assume that a regulator is physically present and enabled | 1345 | * Assume that a regulator is physically present and enabled |
1341 | * even if it isn't hooked up and just provide a dummy. | 1346 | * even if it isn't hooked up and just provide a dummy. |
1342 | */ | 1347 | */ |
1343 | if (has_full_constraints && allow_dummy) { | 1348 | if (have_full_constraints() && allow_dummy) { |
1344 | pr_warn("%s supply %s not found, using dummy regulator\n", | 1349 | pr_warn("%s supply %s not found, using dummy regulator\n", |
1345 | devname, id); | 1350 | devname, id); |
1346 | 1351 | ||
@@ -3627,7 +3632,7 @@ int regulator_suspend_finish(void) | |||
3627 | if (error) | 3632 | if (error) |
3628 | ret = error; | 3633 | ret = error; |
3629 | } else { | 3634 | } else { |
3630 | if (!has_full_constraints) | 3635 | if (!have_full_constraints()) |
3631 | goto unlock; | 3636 | goto unlock; |
3632 | if (!ops->disable) | 3637 | if (!ops->disable) |
3633 | goto unlock; | 3638 | goto unlock; |
@@ -3825,7 +3830,7 @@ static int __init regulator_init_complete(void) | |||
3825 | if (!enabled) | 3830 | if (!enabled) |
3826 | goto unlock; | 3831 | goto unlock; |
3827 | 3832 | ||
3828 | if (has_full_constraints) { | 3833 | if (have_full_constraints()) { |
3829 | /* We log since this may kill the system if it | 3834 | /* We log since this may kill the system if it |
3830 | * goes wrong. */ | 3835 | * goes wrong. */ |
3831 | rdev_info(rdev, "disabling\n"); | 3836 | rdev_info(rdev, "disabling\n"); |
diff --git a/drivers/regulator/pfuze100-regulator.c b/drivers/regulator/pfuze100-regulator.c index 032df3799efb..8b5e4c712a01 100644 --- a/drivers/regulator/pfuze100-regulator.c +++ b/drivers/regulator/pfuze100-regulator.c | |||
@@ -38,7 +38,7 @@ | |||
38 | 38 | ||
39 | #define PFUZE100_DEVICEID 0x0 | 39 | #define PFUZE100_DEVICEID 0x0 |
40 | #define PFUZE100_REVID 0x3 | 40 | #define PFUZE100_REVID 0x3 |
41 | #define PFUZE100_FABID 0x3 | 41 | #define PFUZE100_FABID 0x4 |
42 | 42 | ||
43 | #define PFUZE100_SW1ABVOL 0x20 | 43 | #define PFUZE100_SW1ABVOL 0x20 |
44 | #define PFUZE100_SW1CVOL 0x2e | 44 | #define PFUZE100_SW1CVOL 0x2e |
diff --git a/drivers/regulator/s5m8767.c b/drivers/regulator/s5m8767.c index cbf91e25cf7f..aeb40aad0ae7 100644 --- a/drivers/regulator/s5m8767.c +++ b/drivers/regulator/s5m8767.c | |||
@@ -925,7 +925,7 @@ static int s5m8767_pmic_probe(struct platform_device *pdev) | |||
925 | config.dev = s5m8767->dev; | 925 | config.dev = s5m8767->dev; |
926 | config.init_data = pdata->regulators[i].initdata; | 926 | config.init_data = pdata->regulators[i].initdata; |
927 | config.driver_data = s5m8767; | 927 | config.driver_data = s5m8767; |
928 | config.regmap = iodev->regmap; | 928 | config.regmap = iodev->regmap_pmic; |
929 | config.of_node = pdata->regulators[i].reg_node; | 929 | config.of_node = pdata->regulators[i].reg_node; |
930 | 930 | ||
931 | rdev[i] = devm_regulator_register(&pdev->dev, ®ulators[id], | 931 | rdev[i] = devm_regulator_register(&pdev->dev, ®ulators[id], |
diff --git a/drivers/rtc/rtc-at91rm9200.c b/drivers/rtc/rtc-at91rm9200.c index c0da95e95702..3281c90691c3 100644 --- a/drivers/rtc/rtc-at91rm9200.c +++ b/drivers/rtc/rtc-at91rm9200.c | |||
@@ -220,6 +220,8 @@ static int at91_rtc_setalarm(struct device *dev, struct rtc_wkalrm *alrm) | |||
220 | 220 | ||
221 | at91_alarm_year = tm.tm_year; | 221 | at91_alarm_year = tm.tm_year; |
222 | 222 | ||
223 | tm.tm_mon = alrm->time.tm_mon; | ||
224 | tm.tm_mday = alrm->time.tm_mday; | ||
223 | tm.tm_hour = alrm->time.tm_hour; | 225 | tm.tm_hour = alrm->time.tm_hour; |
224 | tm.tm_min = alrm->time.tm_min; | 226 | tm.tm_min = alrm->time.tm_min; |
225 | tm.tm_sec = alrm->time.tm_sec; | 227 | tm.tm_sec = alrm->time.tm_sec; |
diff --git a/drivers/rtc/rtc-s5m.c b/drivers/rtc/rtc-s5m.c index b7fd02bc0a14..ae8119dc2846 100644 --- a/drivers/rtc/rtc-s5m.c +++ b/drivers/rtc/rtc-s5m.c | |||
@@ -28,10 +28,20 @@ | |||
28 | #include <linux/mfd/samsung/irq.h> | 28 | #include <linux/mfd/samsung/irq.h> |
29 | #include <linux/mfd/samsung/rtc.h> | 29 | #include <linux/mfd/samsung/rtc.h> |
30 | 30 | ||
31 | /* | ||
32 | * Maximum number of retries for checking changes in UDR field | ||
33 | * of SEC_RTC_UDR_CON register (to limit possible endless loop). | ||
34 | * | ||
35 | * After writing to RTC registers (setting time or alarm) read the UDR field | ||
36 | * in SEC_RTC_UDR_CON register. UDR is auto-cleared when data have | ||
37 | * been transferred. | ||
38 | */ | ||
39 | #define UDR_READ_RETRY_CNT 5 | ||
40 | |||
31 | struct s5m_rtc_info { | 41 | struct s5m_rtc_info { |
32 | struct device *dev; | 42 | struct device *dev; |
33 | struct sec_pmic_dev *s5m87xx; | 43 | struct sec_pmic_dev *s5m87xx; |
34 | struct regmap *rtc; | 44 | struct regmap *regmap; |
35 | struct rtc_device *rtc_dev; | 45 | struct rtc_device *rtc_dev; |
36 | int irq; | 46 | int irq; |
37 | int device_type; | 47 | int device_type; |
@@ -84,12 +94,31 @@ static int s5m8767_tm_to_data(struct rtc_time *tm, u8 *data) | |||
84 | } | 94 | } |
85 | } | 95 | } |
86 | 96 | ||
97 | /* | ||
98 | * Read RTC_UDR_CON register and wait till UDR field is cleared. | ||
99 | * This indicates that time/alarm update ended. | ||
100 | */ | ||
101 | static inline int s5m8767_wait_for_udr_update(struct s5m_rtc_info *info) | ||
102 | { | ||
103 | int ret, retry = UDR_READ_RETRY_CNT; | ||
104 | unsigned int data; | ||
105 | |||
106 | do { | ||
107 | ret = regmap_read(info->regmap, SEC_RTC_UDR_CON, &data); | ||
108 | } while (--retry && (data & RTC_UDR_MASK) && !ret); | ||
109 | |||
110 | if (!retry) | ||
111 | dev_err(info->dev, "waiting for UDR update, reached max number of retries\n"); | ||
112 | |||
113 | return ret; | ||
114 | } | ||
115 | |||
87 | static inline int s5m8767_rtc_set_time_reg(struct s5m_rtc_info *info) | 116 | static inline int s5m8767_rtc_set_time_reg(struct s5m_rtc_info *info) |
88 | { | 117 | { |
89 | int ret; | 118 | int ret; |
90 | unsigned int data; | 119 | unsigned int data; |
91 | 120 | ||
92 | ret = regmap_read(info->rtc, SEC_RTC_UDR_CON, &data); | 121 | ret = regmap_read(info->regmap, SEC_RTC_UDR_CON, &data); |
93 | if (ret < 0) { | 122 | if (ret < 0) { |
94 | dev_err(info->dev, "failed to read update reg(%d)\n", ret); | 123 | dev_err(info->dev, "failed to read update reg(%d)\n", ret); |
95 | return ret; | 124 | return ret; |
@@ -98,15 +127,13 @@ static inline int s5m8767_rtc_set_time_reg(struct s5m_rtc_info *info) | |||
98 | data |= RTC_TIME_EN_MASK; | 127 | data |= RTC_TIME_EN_MASK; |
99 | data |= RTC_UDR_MASK; | 128 | data |= RTC_UDR_MASK; |
100 | 129 | ||
101 | ret = regmap_write(info->rtc, SEC_RTC_UDR_CON, data); | 130 | ret = regmap_write(info->regmap, SEC_RTC_UDR_CON, data); |
102 | if (ret < 0) { | 131 | if (ret < 0) { |
103 | dev_err(info->dev, "failed to write update reg(%d)\n", ret); | 132 | dev_err(info->dev, "failed to write update reg(%d)\n", ret); |
104 | return ret; | 133 | return ret; |
105 | } | 134 | } |
106 | 135 | ||
107 | do { | 136 | ret = s5m8767_wait_for_udr_update(info); |
108 | ret = regmap_read(info->rtc, SEC_RTC_UDR_CON, &data); | ||
109 | } while ((data & RTC_UDR_MASK) && !ret); | ||
110 | 137 | ||
111 | return ret; | 138 | return ret; |
112 | } | 139 | } |
@@ -116,7 +143,7 @@ static inline int s5m8767_rtc_set_alarm_reg(struct s5m_rtc_info *info) | |||
116 | int ret; | 143 | int ret; |
117 | unsigned int data; | 144 | unsigned int data; |
118 | 145 | ||
119 | ret = regmap_read(info->rtc, SEC_RTC_UDR_CON, &data); | 146 | ret = regmap_read(info->regmap, SEC_RTC_UDR_CON, &data); |
120 | if (ret < 0) { | 147 | if (ret < 0) { |
121 | dev_err(info->dev, "%s: fail to read update reg(%d)\n", | 148 | dev_err(info->dev, "%s: fail to read update reg(%d)\n", |
122 | __func__, ret); | 149 | __func__, ret); |
@@ -126,16 +153,14 @@ static inline int s5m8767_rtc_set_alarm_reg(struct s5m_rtc_info *info) | |||
126 | data &= ~RTC_TIME_EN_MASK; | 153 | data &= ~RTC_TIME_EN_MASK; |
127 | data |= RTC_UDR_MASK; | 154 | data |= RTC_UDR_MASK; |
128 | 155 | ||
129 | ret = regmap_write(info->rtc, SEC_RTC_UDR_CON, data); | 156 | ret = regmap_write(info->regmap, SEC_RTC_UDR_CON, data); |
130 | if (ret < 0) { | 157 | if (ret < 0) { |
131 | dev_err(info->dev, "%s: fail to write update reg(%d)\n", | 158 | dev_err(info->dev, "%s: fail to write update reg(%d)\n", |
132 | __func__, ret); | 159 | __func__, ret); |
133 | return ret; | 160 | return ret; |
134 | } | 161 | } |
135 | 162 | ||
136 | do { | 163 | ret = s5m8767_wait_for_udr_update(info); |
137 | ret = regmap_read(info->rtc, SEC_RTC_UDR_CON, &data); | ||
138 | } while ((data & RTC_UDR_MASK) && !ret); | ||
139 | 164 | ||
140 | return ret; | 165 | return ret; |
141 | } | 166 | } |
@@ -178,7 +203,7 @@ static int s5m_rtc_read_time(struct device *dev, struct rtc_time *tm) | |||
178 | u8 data[8]; | 203 | u8 data[8]; |
179 | int ret; | 204 | int ret; |
180 | 205 | ||
181 | ret = regmap_bulk_read(info->rtc, SEC_RTC_SEC, data, 8); | 206 | ret = regmap_bulk_read(info->regmap, SEC_RTC_SEC, data, 8); |
182 | if (ret < 0) | 207 | if (ret < 0) |
183 | return ret; | 208 | return ret; |
184 | 209 | ||
@@ -226,7 +251,7 @@ static int s5m_rtc_set_time(struct device *dev, struct rtc_time *tm) | |||
226 | 1900 + tm->tm_year, 1 + tm->tm_mon, tm->tm_mday, | 251 | 1900 + tm->tm_year, 1 + tm->tm_mon, tm->tm_mday, |
227 | tm->tm_hour, tm->tm_min, tm->tm_sec, tm->tm_wday); | 252 | tm->tm_hour, tm->tm_min, tm->tm_sec, tm->tm_wday); |
228 | 253 | ||
229 | ret = regmap_raw_write(info->rtc, SEC_RTC_SEC, data, 8); | 254 | ret = regmap_raw_write(info->regmap, SEC_RTC_SEC, data, 8); |
230 | if (ret < 0) | 255 | if (ret < 0) |
231 | return ret; | 256 | return ret; |
232 | 257 | ||
@@ -242,20 +267,20 @@ static int s5m_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alrm) | |||
242 | unsigned int val; | 267 | unsigned int val; |
243 | int ret, i; | 268 | int ret, i; |
244 | 269 | ||
245 | ret = regmap_bulk_read(info->rtc, SEC_ALARM0_SEC, data, 8); | 270 | ret = regmap_bulk_read(info->regmap, SEC_ALARM0_SEC, data, 8); |
246 | if (ret < 0) | 271 | if (ret < 0) |
247 | return ret; | 272 | return ret; |
248 | 273 | ||
249 | switch (info->device_type) { | 274 | switch (info->device_type) { |
250 | case S5M8763X: | 275 | case S5M8763X: |
251 | s5m8763_data_to_tm(data, &alrm->time); | 276 | s5m8763_data_to_tm(data, &alrm->time); |
252 | ret = regmap_read(info->rtc, SEC_ALARM0_CONF, &val); | 277 | ret = regmap_read(info->regmap, SEC_ALARM0_CONF, &val); |
253 | if (ret < 0) | 278 | if (ret < 0) |
254 | return ret; | 279 | return ret; |
255 | 280 | ||
256 | alrm->enabled = !!val; | 281 | alrm->enabled = !!val; |
257 | 282 | ||
258 | ret = regmap_read(info->rtc, SEC_RTC_STATUS, &val); | 283 | ret = regmap_read(info->regmap, SEC_RTC_STATUS, &val); |
259 | if (ret < 0) | 284 | if (ret < 0) |
260 | return ret; | 285 | return ret; |
261 | 286 | ||
@@ -278,7 +303,7 @@ static int s5m_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alrm) | |||
278 | } | 303 | } |
279 | 304 | ||
280 | alrm->pending = 0; | 305 | alrm->pending = 0; |
281 | ret = regmap_read(info->rtc, SEC_RTC_STATUS, &val); | 306 | ret = regmap_read(info->regmap, SEC_RTC_STATUS, &val); |
282 | if (ret < 0) | 307 | if (ret < 0) |
283 | return ret; | 308 | return ret; |
284 | break; | 309 | break; |
@@ -301,7 +326,7 @@ static int s5m_rtc_stop_alarm(struct s5m_rtc_info *info) | |||
301 | int ret, i; | 326 | int ret, i; |
302 | struct rtc_time tm; | 327 | struct rtc_time tm; |
303 | 328 | ||
304 | ret = regmap_bulk_read(info->rtc, SEC_ALARM0_SEC, data, 8); | 329 | ret = regmap_bulk_read(info->regmap, SEC_ALARM0_SEC, data, 8); |
305 | if (ret < 0) | 330 | if (ret < 0) |
306 | return ret; | 331 | return ret; |
307 | 332 | ||
@@ -312,14 +337,14 @@ static int s5m_rtc_stop_alarm(struct s5m_rtc_info *info) | |||
312 | 337 | ||
313 | switch (info->device_type) { | 338 | switch (info->device_type) { |
314 | case S5M8763X: | 339 | case S5M8763X: |
315 | ret = regmap_write(info->rtc, SEC_ALARM0_CONF, 0); | 340 | ret = regmap_write(info->regmap, SEC_ALARM0_CONF, 0); |
316 | break; | 341 | break; |
317 | 342 | ||
318 | case S5M8767X: | 343 | case S5M8767X: |
319 | for (i = 0; i < 7; i++) | 344 | for (i = 0; i < 7; i++) |
320 | data[i] &= ~ALARM_ENABLE_MASK; | 345 | data[i] &= ~ALARM_ENABLE_MASK; |
321 | 346 | ||
322 | ret = regmap_raw_write(info->rtc, SEC_ALARM0_SEC, data, 8); | 347 | ret = regmap_raw_write(info->regmap, SEC_ALARM0_SEC, data, 8); |
323 | if (ret < 0) | 348 | if (ret < 0) |
324 | return ret; | 349 | return ret; |
325 | 350 | ||
@@ -341,7 +366,7 @@ static int s5m_rtc_start_alarm(struct s5m_rtc_info *info) | |||
341 | u8 alarm0_conf; | 366 | u8 alarm0_conf; |
342 | struct rtc_time tm; | 367 | struct rtc_time tm; |
343 | 368 | ||
344 | ret = regmap_bulk_read(info->rtc, SEC_ALARM0_SEC, data, 8); | 369 | ret = regmap_bulk_read(info->regmap, SEC_ALARM0_SEC, data, 8); |
345 | if (ret < 0) | 370 | if (ret < 0) |
346 | return ret; | 371 | return ret; |
347 | 372 | ||
@@ -353,7 +378,7 @@ static int s5m_rtc_start_alarm(struct s5m_rtc_info *info) | |||
353 | switch (info->device_type) { | 378 | switch (info->device_type) { |
354 | case S5M8763X: | 379 | case S5M8763X: |
355 | alarm0_conf = 0x77; | 380 | alarm0_conf = 0x77; |
356 | ret = regmap_write(info->rtc, SEC_ALARM0_CONF, alarm0_conf); | 381 | ret = regmap_write(info->regmap, SEC_ALARM0_CONF, alarm0_conf); |
357 | break; | 382 | break; |
358 | 383 | ||
359 | case S5M8767X: | 384 | case S5M8767X: |
@@ -368,7 +393,7 @@ static int s5m_rtc_start_alarm(struct s5m_rtc_info *info) | |||
368 | if (data[RTC_YEAR1] & 0x7f) | 393 | if (data[RTC_YEAR1] & 0x7f) |
369 | data[RTC_YEAR1] |= ALARM_ENABLE_MASK; | 394 | data[RTC_YEAR1] |= ALARM_ENABLE_MASK; |
370 | 395 | ||
371 | ret = regmap_raw_write(info->rtc, SEC_ALARM0_SEC, data, 8); | 396 | ret = regmap_raw_write(info->regmap, SEC_ALARM0_SEC, data, 8); |
372 | if (ret < 0) | 397 | if (ret < 0) |
373 | return ret; | 398 | return ret; |
374 | ret = s5m8767_rtc_set_alarm_reg(info); | 399 | ret = s5m8767_rtc_set_alarm_reg(info); |
@@ -410,7 +435,7 @@ static int s5m_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alrm) | |||
410 | if (ret < 0) | 435 | if (ret < 0) |
411 | return ret; | 436 | return ret; |
412 | 437 | ||
413 | ret = regmap_raw_write(info->rtc, SEC_ALARM0_SEC, data, 8); | 438 | ret = regmap_raw_write(info->regmap, SEC_ALARM0_SEC, data, 8); |
414 | if (ret < 0) | 439 | if (ret < 0) |
415 | return ret; | 440 | return ret; |
416 | 441 | ||
@@ -455,7 +480,7 @@ static const struct rtc_class_ops s5m_rtc_ops = { | |||
455 | static void s5m_rtc_enable_wtsr(struct s5m_rtc_info *info, bool enable) | 480 | static void s5m_rtc_enable_wtsr(struct s5m_rtc_info *info, bool enable) |
456 | { | 481 | { |
457 | int ret; | 482 | int ret; |
458 | ret = regmap_update_bits(info->rtc, SEC_WTSR_SMPL_CNTL, | 483 | ret = regmap_update_bits(info->regmap, SEC_WTSR_SMPL_CNTL, |
459 | WTSR_ENABLE_MASK, | 484 | WTSR_ENABLE_MASK, |
460 | enable ? WTSR_ENABLE_MASK : 0); | 485 | enable ? WTSR_ENABLE_MASK : 0); |
461 | if (ret < 0) | 486 | if (ret < 0) |
@@ -466,7 +491,7 @@ static void s5m_rtc_enable_wtsr(struct s5m_rtc_info *info, bool enable) | |||
466 | static void s5m_rtc_enable_smpl(struct s5m_rtc_info *info, bool enable) | 491 | static void s5m_rtc_enable_smpl(struct s5m_rtc_info *info, bool enable) |
467 | { | 492 | { |
468 | int ret; | 493 | int ret; |
469 | ret = regmap_update_bits(info->rtc, SEC_WTSR_SMPL_CNTL, | 494 | ret = regmap_update_bits(info->regmap, SEC_WTSR_SMPL_CNTL, |
470 | SMPL_ENABLE_MASK, | 495 | SMPL_ENABLE_MASK, |
471 | enable ? SMPL_ENABLE_MASK : 0); | 496 | enable ? SMPL_ENABLE_MASK : 0); |
472 | if (ret < 0) | 497 | if (ret < 0) |
@@ -481,7 +506,7 @@ static int s5m8767_rtc_init_reg(struct s5m_rtc_info *info) | |||
481 | int ret; | 506 | int ret; |
482 | struct rtc_time tm; | 507 | struct rtc_time tm; |
483 | 508 | ||
484 | ret = regmap_read(info->rtc, SEC_RTC_UDR_CON, &tp_read); | 509 | ret = regmap_read(info->regmap, SEC_RTC_UDR_CON, &tp_read); |
485 | if (ret < 0) { | 510 | if (ret < 0) { |
486 | dev_err(info->dev, "%s: fail to read control reg(%d)\n", | 511 | dev_err(info->dev, "%s: fail to read control reg(%d)\n", |
487 | __func__, ret); | 512 | __func__, ret); |
@@ -493,7 +518,7 @@ static int s5m8767_rtc_init_reg(struct s5m_rtc_info *info) | |||
493 | data[1] = (0 << BCD_EN_SHIFT) | (1 << MODEL24_SHIFT); | 518 | data[1] = (0 << BCD_EN_SHIFT) | (1 << MODEL24_SHIFT); |
494 | 519 | ||
495 | info->rtc_24hr_mode = 1; | 520 | info->rtc_24hr_mode = 1; |
496 | ret = regmap_raw_write(info->rtc, SEC_ALARM0_CONF, data, 2); | 521 | ret = regmap_raw_write(info->regmap, SEC_ALARM0_CONF, data, 2); |
497 | if (ret < 0) { | 522 | if (ret < 0) { |
498 | dev_err(info->dev, "%s: fail to write controlm reg(%d)\n", | 523 | dev_err(info->dev, "%s: fail to write controlm reg(%d)\n", |
499 | __func__, ret); | 524 | __func__, ret); |
@@ -515,7 +540,7 @@ static int s5m8767_rtc_init_reg(struct s5m_rtc_info *info) | |||
515 | ret = s5m_rtc_set_time(info->dev, &tm); | 540 | ret = s5m_rtc_set_time(info->dev, &tm); |
516 | } | 541 | } |
517 | 542 | ||
518 | ret = regmap_update_bits(info->rtc, SEC_RTC_UDR_CON, | 543 | ret = regmap_update_bits(info->regmap, SEC_RTC_UDR_CON, |
519 | RTC_TCON_MASK, tp_read | RTC_TCON_MASK); | 544 | RTC_TCON_MASK, tp_read | RTC_TCON_MASK); |
520 | if (ret < 0) | 545 | if (ret < 0) |
521 | dev_err(info->dev, "%s: fail to update TCON reg(%d)\n", | 546 | dev_err(info->dev, "%s: fail to update TCON reg(%d)\n", |
@@ -542,17 +567,19 @@ static int s5m_rtc_probe(struct platform_device *pdev) | |||
542 | 567 | ||
543 | info->dev = &pdev->dev; | 568 | info->dev = &pdev->dev; |
544 | info->s5m87xx = s5m87xx; | 569 | info->s5m87xx = s5m87xx; |
545 | info->rtc = s5m87xx->rtc; | 570 | info->regmap = s5m87xx->regmap_rtc; |
546 | info->device_type = s5m87xx->device_type; | 571 | info->device_type = s5m87xx->device_type; |
547 | info->wtsr_smpl = s5m87xx->wtsr_smpl; | 572 | info->wtsr_smpl = s5m87xx->wtsr_smpl; |
548 | 573 | ||
549 | switch (pdata->device_type) { | 574 | switch (pdata->device_type) { |
550 | case S5M8763X: | 575 | case S5M8763X: |
551 | info->irq = s5m87xx->irq_base + S5M8763_IRQ_ALARM0; | 576 | info->irq = regmap_irq_get_virq(s5m87xx->irq_data, |
577 | S5M8763_IRQ_ALARM0); | ||
552 | break; | 578 | break; |
553 | 579 | ||
554 | case S5M8767X: | 580 | case S5M8767X: |
555 | info->irq = s5m87xx->irq_base + S5M8767_IRQ_RTCA1; | 581 | info->irq = regmap_irq_get_virq(s5m87xx->irq_data, |
582 | S5M8767_IRQ_RTCA1); | ||
556 | break; | 583 | break; |
557 | 584 | ||
558 | default: | 585 | default: |
@@ -596,7 +623,7 @@ static void s5m_rtc_shutdown(struct platform_device *pdev) | |||
596 | if (info->wtsr_smpl) { | 623 | if (info->wtsr_smpl) { |
597 | for (i = 0; i < 3; i++) { | 624 | for (i = 0; i < 3; i++) { |
598 | s5m_rtc_enable_wtsr(info, false); | 625 | s5m_rtc_enable_wtsr(info, false); |
599 | regmap_read(info->rtc, SEC_WTSR_SMPL_CNTL, &val); | 626 | regmap_read(info->regmap, SEC_WTSR_SMPL_CNTL, &val); |
600 | pr_debug("%s: WTSR_SMPL reg(0x%02x)\n", __func__, val); | 627 | pr_debug("%s: WTSR_SMPL reg(0x%02x)\n", __func__, val); |
601 | if (val & WTSR_ENABLE_MASK) | 628 | if (val & WTSR_ENABLE_MASK) |
602 | pr_emerg("%s: fail to disable WTSR\n", | 629 | pr_emerg("%s: fail to disable WTSR\n", |
@@ -612,6 +639,30 @@ static void s5m_rtc_shutdown(struct platform_device *pdev) | |||
612 | s5m_rtc_enable_smpl(info, false); | 639 | s5m_rtc_enable_smpl(info, false); |
613 | } | 640 | } |
614 | 641 | ||
642 | static int s5m_rtc_resume(struct device *dev) | ||
643 | { | ||
644 | struct s5m_rtc_info *info = dev_get_drvdata(dev); | ||
645 | int ret = 0; | ||
646 | |||
647 | if (device_may_wakeup(dev)) | ||
648 | ret = disable_irq_wake(info->irq); | ||
649 | |||
650 | return ret; | ||
651 | } | ||
652 | |||
653 | static int s5m_rtc_suspend(struct device *dev) | ||
654 | { | ||
655 | struct s5m_rtc_info *info = dev_get_drvdata(dev); | ||
656 | int ret = 0; | ||
657 | |||
658 | if (device_may_wakeup(dev)) | ||
659 | ret = enable_irq_wake(info->irq); | ||
660 | |||
661 | return ret; | ||
662 | } | ||
663 | |||
664 | static SIMPLE_DEV_PM_OPS(s5m_rtc_pm_ops, s5m_rtc_suspend, s5m_rtc_resume); | ||
665 | |||
615 | static const struct platform_device_id s5m_rtc_id[] = { | 666 | static const struct platform_device_id s5m_rtc_id[] = { |
616 | { "s5m-rtc", 0 }, | 667 | { "s5m-rtc", 0 }, |
617 | }; | 668 | }; |
@@ -620,6 +671,7 @@ static struct platform_driver s5m_rtc_driver = { | |||
620 | .driver = { | 671 | .driver = { |
621 | .name = "s5m-rtc", | 672 | .name = "s5m-rtc", |
622 | .owner = THIS_MODULE, | 673 | .owner = THIS_MODULE, |
674 | .pm = &s5m_rtc_pm_ops, | ||
623 | }, | 675 | }, |
624 | .probe = s5m_rtc_probe, | 676 | .probe = s5m_rtc_probe, |
625 | .shutdown = s5m_rtc_shutdown, | 677 | .shutdown = s5m_rtc_shutdown, |
diff --git a/drivers/s390/block/dasd_genhd.c b/drivers/s390/block/dasd_genhd.c index f64921756ad6..f224d59c4b6b 100644 --- a/drivers/s390/block/dasd_genhd.c +++ b/drivers/s390/block/dasd_genhd.c | |||
@@ -87,7 +87,6 @@ void dasd_gendisk_free(struct dasd_block *block) | |||
87 | { | 87 | { |
88 | if (block->gdp) { | 88 | if (block->gdp) { |
89 | del_gendisk(block->gdp); | 89 | del_gendisk(block->gdp); |
90 | block->gdp->queue = NULL; | ||
91 | block->gdp->private_data = NULL; | 90 | block->gdp->private_data = NULL; |
92 | put_disk(block->gdp); | 91 | put_disk(block->gdp); |
93 | block->gdp = NULL; | 92 | block->gdp = NULL; |
diff --git a/drivers/s390/char/sclp_early.c b/drivers/s390/char/sclp_early.c index f7aa080e9b28..1465e9563101 100644 --- a/drivers/s390/char/sclp_early.c +++ b/drivers/s390/char/sclp_early.c | |||
@@ -35,7 +35,6 @@ struct read_info_sccb { | |||
35 | u8 _reserved5[4096 - 112]; /* 112-4095 */ | 35 | u8 _reserved5[4096 - 112]; /* 112-4095 */ |
36 | } __packed __aligned(PAGE_SIZE); | 36 | } __packed __aligned(PAGE_SIZE); |
37 | 37 | ||
38 | static __initdata struct init_sccb early_event_mask_sccb __aligned(PAGE_SIZE); | ||
39 | static __initdata struct read_info_sccb early_read_info_sccb; | 38 | static __initdata struct read_info_sccb early_read_info_sccb; |
40 | static __initdata char sccb_early[PAGE_SIZE] __aligned(PAGE_SIZE); | 39 | static __initdata char sccb_early[PAGE_SIZE] __aligned(PAGE_SIZE); |
41 | static unsigned long sclp_hsa_size; | 40 | static unsigned long sclp_hsa_size; |
@@ -113,7 +112,7 @@ static void __init sclp_facilities_detect(void) | |||
113 | 112 | ||
114 | bool __init sclp_has_linemode(void) | 113 | bool __init sclp_has_linemode(void) |
115 | { | 114 | { |
116 | struct init_sccb *sccb = &early_event_mask_sccb; | 115 | struct init_sccb *sccb = (void *) &sccb_early; |
117 | 116 | ||
118 | if (sccb->header.response_code != 0x20) | 117 | if (sccb->header.response_code != 0x20) |
119 | return 0; | 118 | return 0; |
@@ -126,7 +125,7 @@ bool __init sclp_has_linemode(void) | |||
126 | 125 | ||
127 | bool __init sclp_has_vt220(void) | 126 | bool __init sclp_has_vt220(void) |
128 | { | 127 | { |
129 | struct init_sccb *sccb = &early_event_mask_sccb; | 128 | struct init_sccb *sccb = (void *) &sccb_early; |
130 | 129 | ||
131 | if (sccb->header.response_code != 0x20) | 130 | if (sccb->header.response_code != 0x20) |
132 | return 0; | 131 | return 0; |
diff --git a/drivers/scsi/3w-9xxx.c b/drivers/scsi/3w-9xxx.c index 5e1e12c0cf42..0a7325361d29 100644 --- a/drivers/scsi/3w-9xxx.c +++ b/drivers/scsi/3w-9xxx.c | |||
@@ -2025,7 +2025,8 @@ static struct scsi_host_template driver_template = { | |||
2025 | .cmd_per_lun = TW_MAX_CMDS_PER_LUN, | 2025 | .cmd_per_lun = TW_MAX_CMDS_PER_LUN, |
2026 | .use_clustering = ENABLE_CLUSTERING, | 2026 | .use_clustering = ENABLE_CLUSTERING, |
2027 | .shost_attrs = twa_host_attrs, | 2027 | .shost_attrs = twa_host_attrs, |
2028 | .emulated = 1 | 2028 | .emulated = 1, |
2029 | .no_write_same = 1, | ||
2029 | }; | 2030 | }; |
2030 | 2031 | ||
2031 | /* This function will probe and initialize a card */ | 2032 | /* This function will probe and initialize a card */ |
diff --git a/drivers/scsi/3w-sas.c b/drivers/scsi/3w-sas.c index c845bdbeb6c0..4de346017e9f 100644 --- a/drivers/scsi/3w-sas.c +++ b/drivers/scsi/3w-sas.c | |||
@@ -1600,7 +1600,8 @@ static struct scsi_host_template driver_template = { | |||
1600 | .cmd_per_lun = TW_MAX_CMDS_PER_LUN, | 1600 | .cmd_per_lun = TW_MAX_CMDS_PER_LUN, |
1601 | .use_clustering = ENABLE_CLUSTERING, | 1601 | .use_clustering = ENABLE_CLUSTERING, |
1602 | .shost_attrs = twl_host_attrs, | 1602 | .shost_attrs = twl_host_attrs, |
1603 | .emulated = 1 | 1603 | .emulated = 1, |
1604 | .no_write_same = 1, | ||
1604 | }; | 1605 | }; |
1605 | 1606 | ||
1606 | /* This function will probe and initialize a card */ | 1607 | /* This function will probe and initialize a card */ |
diff --git a/drivers/scsi/3w-xxxx.c b/drivers/scsi/3w-xxxx.c index b9276d10b25c..752624e6bc00 100644 --- a/drivers/scsi/3w-xxxx.c +++ b/drivers/scsi/3w-xxxx.c | |||
@@ -2279,7 +2279,8 @@ static struct scsi_host_template driver_template = { | |||
2279 | .cmd_per_lun = TW_MAX_CMDS_PER_LUN, | 2279 | .cmd_per_lun = TW_MAX_CMDS_PER_LUN, |
2280 | .use_clustering = ENABLE_CLUSTERING, | 2280 | .use_clustering = ENABLE_CLUSTERING, |
2281 | .shost_attrs = tw_host_attrs, | 2281 | .shost_attrs = tw_host_attrs, |
2282 | .emulated = 1 | 2282 | .emulated = 1, |
2283 | .no_write_same = 1, | ||
2283 | }; | 2284 | }; |
2284 | 2285 | ||
2285 | /* This function will probe and initialize a card */ | 2286 | /* This function will probe and initialize a card */ |
diff --git a/drivers/scsi/aacraid/linit.c b/drivers/scsi/aacraid/linit.c index f0d432c139d0..4921ed19a027 100644 --- a/drivers/scsi/aacraid/linit.c +++ b/drivers/scsi/aacraid/linit.c | |||
@@ -1081,6 +1081,7 @@ static struct scsi_host_template aac_driver_template = { | |||
1081 | #endif | 1081 | #endif |
1082 | .use_clustering = ENABLE_CLUSTERING, | 1082 | .use_clustering = ENABLE_CLUSTERING, |
1083 | .emulated = 1, | 1083 | .emulated = 1, |
1084 | .no_write_same = 1, | ||
1084 | }; | 1085 | }; |
1085 | 1086 | ||
1086 | static void __aac_shutdown(struct aac_dev * aac) | 1087 | static void __aac_shutdown(struct aac_dev * aac) |
diff --git a/drivers/scsi/arcmsr/arcmsr_hba.c b/drivers/scsi/arcmsr/arcmsr_hba.c index 97fd450aff09..4f6a30b8e5f9 100644 --- a/drivers/scsi/arcmsr/arcmsr_hba.c +++ b/drivers/scsi/arcmsr/arcmsr_hba.c | |||
@@ -137,6 +137,7 @@ static struct scsi_host_template arcmsr_scsi_host_template = { | |||
137 | .cmd_per_lun = ARCMSR_MAX_CMD_PERLUN, | 137 | .cmd_per_lun = ARCMSR_MAX_CMD_PERLUN, |
138 | .use_clustering = ENABLE_CLUSTERING, | 138 | .use_clustering = ENABLE_CLUSTERING, |
139 | .shost_attrs = arcmsr_host_attrs, | 139 | .shost_attrs = arcmsr_host_attrs, |
140 | .no_write_same = 1, | ||
140 | }; | 141 | }; |
141 | static struct pci_device_id arcmsr_device_id_table[] = { | 142 | static struct pci_device_id arcmsr_device_id_table[] = { |
142 | {PCI_DEVICE(PCI_VENDOR_ID_ARECA, PCI_DEVICE_ID_ARECA_1110)}, | 143 | {PCI_DEVICE(PCI_VENDOR_ID_ARECA, PCI_DEVICE_ID_ARECA_1110)}, |
diff --git a/drivers/scsi/bfa/bfa_fcs.h b/drivers/scsi/bfa/bfa_fcs.h index 94d5d0102f7d..42bcb970445a 100644 --- a/drivers/scsi/bfa/bfa_fcs.h +++ b/drivers/scsi/bfa/bfa_fcs.h | |||
@@ -296,6 +296,7 @@ wwn_t bfa_fcs_lport_get_rport(struct bfa_fcs_lport_s *port, wwn_t wwn, | |||
296 | struct bfa_fcs_lport_s *bfa_fcs_lookup_port(struct bfa_fcs_s *fcs, | 296 | struct bfa_fcs_lport_s *bfa_fcs_lookup_port(struct bfa_fcs_s *fcs, |
297 | u16 vf_id, wwn_t lpwwn); | 297 | u16 vf_id, wwn_t lpwwn); |
298 | 298 | ||
299 | void bfa_fcs_lport_set_symname(struct bfa_fcs_lport_s *port, char *symname); | ||
299 | void bfa_fcs_lport_get_info(struct bfa_fcs_lport_s *port, | 300 | void bfa_fcs_lport_get_info(struct bfa_fcs_lport_s *port, |
300 | struct bfa_lport_info_s *port_info); | 301 | struct bfa_lport_info_s *port_info); |
301 | void bfa_fcs_lport_get_attr(struct bfa_fcs_lport_s *port, | 302 | void bfa_fcs_lport_get_attr(struct bfa_fcs_lport_s *port, |
diff --git a/drivers/scsi/bfa/bfa_fcs_lport.c b/drivers/scsi/bfa/bfa_fcs_lport.c index 2f61a5af3658..f5e4e61a0fd7 100644 --- a/drivers/scsi/bfa/bfa_fcs_lport.c +++ b/drivers/scsi/bfa/bfa_fcs_lport.c | |||
@@ -1097,6 +1097,17 @@ bfa_fcs_lport_init(struct bfa_fcs_lport_s *lport, | |||
1097 | bfa_sm_send_event(lport, BFA_FCS_PORT_SM_CREATE); | 1097 | bfa_sm_send_event(lport, BFA_FCS_PORT_SM_CREATE); |
1098 | } | 1098 | } |
1099 | 1099 | ||
1100 | void | ||
1101 | bfa_fcs_lport_set_symname(struct bfa_fcs_lport_s *port, | ||
1102 | char *symname) | ||
1103 | { | ||
1104 | strcpy(port->port_cfg.sym_name.symname, symname); | ||
1105 | |||
1106 | if (bfa_sm_cmp_state(port, bfa_fcs_lport_sm_online)) | ||
1107 | bfa_fcs_lport_ns_util_send_rspn_id( | ||
1108 | BFA_FCS_GET_NS_FROM_PORT(port), NULL); | ||
1109 | } | ||
1110 | |||
1100 | /* | 1111 | /* |
1101 | * fcs_lport_api | 1112 | * fcs_lport_api |
1102 | */ | 1113 | */ |
@@ -5140,9 +5151,6 @@ bfa_fcs_lport_ns_util_send_rspn_id(void *cbarg, struct bfa_fcxp_s *fcxp_alloced) | |||
5140 | u8 *psymbl = &symbl[0]; | 5151 | u8 *psymbl = &symbl[0]; |
5141 | int len; | 5152 | int len; |
5142 | 5153 | ||
5143 | if (!bfa_sm_cmp_state(port, bfa_fcs_lport_sm_online)) | ||
5144 | return; | ||
5145 | |||
5146 | /* Avoid sending RSPN in the following states. */ | 5154 | /* Avoid sending RSPN in the following states. */ |
5147 | if (bfa_sm_cmp_state(ns, bfa_fcs_lport_ns_sm_offline) || | 5155 | if (bfa_sm_cmp_state(ns, bfa_fcs_lport_ns_sm_offline) || |
5148 | bfa_sm_cmp_state(ns, bfa_fcs_lport_ns_sm_plogi_sending) || | 5156 | bfa_sm_cmp_state(ns, bfa_fcs_lport_ns_sm_plogi_sending) || |
diff --git a/drivers/scsi/bfa/bfad_attr.c b/drivers/scsi/bfa/bfad_attr.c index e9a681d31223..40be670a1cbc 100644 --- a/drivers/scsi/bfa/bfad_attr.c +++ b/drivers/scsi/bfa/bfad_attr.c | |||
@@ -593,11 +593,8 @@ bfad_im_vport_set_symbolic_name(struct fc_vport *fc_vport) | |||
593 | return; | 593 | return; |
594 | 594 | ||
595 | spin_lock_irqsave(&bfad->bfad_lock, flags); | 595 | spin_lock_irqsave(&bfad->bfad_lock, flags); |
596 | if (strlen(sym_name) > 0) { | 596 | if (strlen(sym_name) > 0) |
597 | strcpy(fcs_vport->lport.port_cfg.sym_name.symname, sym_name); | 597 | bfa_fcs_lport_set_symname(&fcs_vport->lport, sym_name); |
598 | bfa_fcs_lport_ns_util_send_rspn_id( | ||
599 | BFA_FCS_GET_NS_FROM_PORT((&fcs_vport->lport)), NULL); | ||
600 | } | ||
601 | spin_unlock_irqrestore(&bfad->bfad_lock, flags); | 598 | spin_unlock_irqrestore(&bfad->bfad_lock, flags); |
602 | } | 599 | } |
603 | 600 | ||
diff --git a/drivers/scsi/gdth.c b/drivers/scsi/gdth.c index ee4fa40a50b1..ce5ef0190bad 100644 --- a/drivers/scsi/gdth.c +++ b/drivers/scsi/gdth.c | |||
@@ -4684,6 +4684,7 @@ static struct scsi_host_template gdth_template = { | |||
4684 | .cmd_per_lun = GDTH_MAXC_P_L, | 4684 | .cmd_per_lun = GDTH_MAXC_P_L, |
4685 | .unchecked_isa_dma = 1, | 4685 | .unchecked_isa_dma = 1, |
4686 | .use_clustering = ENABLE_CLUSTERING, | 4686 | .use_clustering = ENABLE_CLUSTERING, |
4687 | .no_write_same = 1, | ||
4687 | }; | 4688 | }; |
4688 | 4689 | ||
4689 | #ifdef CONFIG_ISA | 4690 | #ifdef CONFIG_ISA |
diff --git a/drivers/scsi/hosts.c b/drivers/scsi/hosts.c index f334859024c0..f2c5005f312a 100644 --- a/drivers/scsi/hosts.c +++ b/drivers/scsi/hosts.c | |||
@@ -395,6 +395,7 @@ struct Scsi_Host *scsi_host_alloc(struct scsi_host_template *sht, int privsize) | |||
395 | shost->use_clustering = sht->use_clustering; | 395 | shost->use_clustering = sht->use_clustering; |
396 | shost->ordered_tag = sht->ordered_tag; | 396 | shost->ordered_tag = sht->ordered_tag; |
397 | shost->eh_deadline = shost_eh_deadline * HZ; | 397 | shost->eh_deadline = shost_eh_deadline * HZ; |
398 | shost->no_write_same = sht->no_write_same; | ||
398 | 399 | ||
399 | if (sht->supported_mode == MODE_UNKNOWN) | 400 | if (sht->supported_mode == MODE_UNKNOWN) |
400 | /* means we didn't set it ... default to INITIATOR */ | 401 | /* means we didn't set it ... default to INITIATOR */ |
diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c index 22f6432eb475..20a5e6ecf945 100644 --- a/drivers/scsi/hpsa.c +++ b/drivers/scsi/hpsa.c | |||
@@ -561,6 +561,7 @@ static struct scsi_host_template hpsa_driver_template = { | |||
561 | .sdev_attrs = hpsa_sdev_attrs, | 561 | .sdev_attrs = hpsa_sdev_attrs, |
562 | .shost_attrs = hpsa_shost_attrs, | 562 | .shost_attrs = hpsa_shost_attrs, |
563 | .max_sectors = 8192, | 563 | .max_sectors = 8192, |
564 | .no_write_same = 1, | ||
564 | }; | 565 | }; |
565 | 566 | ||
566 | 567 | ||
@@ -1288,7 +1289,7 @@ static void complete_scsi_command(struct CommandList *cp) | |||
1288 | "has check condition: aborted command: " | 1289 | "has check condition: aborted command: " |
1289 | "ASC: 0x%x, ASCQ: 0x%x\n", | 1290 | "ASC: 0x%x, ASCQ: 0x%x\n", |
1290 | cp, asc, ascq); | 1291 | cp, asc, ascq); |
1291 | cmd->result = DID_SOFT_ERROR << 16; | 1292 | cmd->result |= DID_SOFT_ERROR << 16; |
1292 | break; | 1293 | break; |
1293 | } | 1294 | } |
1294 | /* Must be some other type of check condition */ | 1295 | /* Must be some other type of check condition */ |
@@ -4925,7 +4926,7 @@ reinit_after_soft_reset: | |||
4925 | hpsa_hba_inquiry(h); | 4926 | hpsa_hba_inquiry(h); |
4926 | hpsa_register_scsi(h); /* hook ourselves into SCSI subsystem */ | 4927 | hpsa_register_scsi(h); /* hook ourselves into SCSI subsystem */ |
4927 | start_controller_lockup_detector(h); | 4928 | start_controller_lockup_detector(h); |
4928 | return 1; | 4929 | return 0; |
4929 | 4930 | ||
4930 | clean4: | 4931 | clean4: |
4931 | hpsa_free_sg_chain_blocks(h); | 4932 | hpsa_free_sg_chain_blocks(h); |
diff --git a/drivers/scsi/ipr.c b/drivers/scsi/ipr.c index 36ac1c34ce97..573f4128b6b6 100644 --- a/drivers/scsi/ipr.c +++ b/drivers/scsi/ipr.c | |||
@@ -6305,7 +6305,8 @@ static struct scsi_host_template driver_template = { | |||
6305 | .use_clustering = ENABLE_CLUSTERING, | 6305 | .use_clustering = ENABLE_CLUSTERING, |
6306 | .shost_attrs = ipr_ioa_attrs, | 6306 | .shost_attrs = ipr_ioa_attrs, |
6307 | .sdev_attrs = ipr_dev_attrs, | 6307 | .sdev_attrs = ipr_dev_attrs, |
6308 | .proc_name = IPR_NAME | 6308 | .proc_name = IPR_NAME, |
6309 | .no_write_same = 1, | ||
6309 | }; | 6310 | }; |
6310 | 6311 | ||
6311 | /** | 6312 | /** |
diff --git a/drivers/scsi/ips.c b/drivers/scsi/ips.c index 8d5ea8a1e5a6..52a216f21ae5 100644 --- a/drivers/scsi/ips.c +++ b/drivers/scsi/ips.c | |||
@@ -374,6 +374,7 @@ static struct scsi_host_template ips_driver_template = { | |||
374 | .sg_tablesize = IPS_MAX_SG, | 374 | .sg_tablesize = IPS_MAX_SG, |
375 | .cmd_per_lun = 3, | 375 | .cmd_per_lun = 3, |
376 | .use_clustering = ENABLE_CLUSTERING, | 376 | .use_clustering = ENABLE_CLUSTERING, |
377 | .no_write_same = 1, | ||
377 | }; | 378 | }; |
378 | 379 | ||
379 | 380 | ||
diff --git a/drivers/scsi/libsas/sas_ata.c b/drivers/scsi/libsas/sas_ata.c index 161c98efade9..d2895836f9fa 100644 --- a/drivers/scsi/libsas/sas_ata.c +++ b/drivers/scsi/libsas/sas_ata.c | |||
@@ -211,7 +211,7 @@ static unsigned int sas_ata_qc_issue(struct ata_queued_cmd *qc) | |||
211 | qc->tf.nsect = 0; | 211 | qc->tf.nsect = 0; |
212 | } | 212 | } |
213 | 213 | ||
214 | ata_tf_to_fis(&qc->tf, 1, 0, (u8*)&task->ata_task.fis); | 214 | ata_tf_to_fis(&qc->tf, qc->dev->link->pmp, 1, (u8 *)&task->ata_task.fis); |
215 | task->uldd_task = qc; | 215 | task->uldd_task = qc; |
216 | if (ata_is_atapi(qc->tf.protocol)) { | 216 | if (ata_is_atapi(qc->tf.protocol)) { |
217 | memcpy(task->ata_task.atapi_packet, qc->cdb, qc->dev->cdb_len); | 217 | memcpy(task->ata_task.atapi_packet, qc->cdb, qc->dev->cdb_len); |
diff --git a/drivers/scsi/megaraid.c b/drivers/scsi/megaraid.c index 90c95a3385d1..816db12ef5d5 100644 --- a/drivers/scsi/megaraid.c +++ b/drivers/scsi/megaraid.c | |||
@@ -4244,6 +4244,7 @@ static struct scsi_host_template megaraid_template = { | |||
4244 | .eh_device_reset_handler = megaraid_reset, | 4244 | .eh_device_reset_handler = megaraid_reset, |
4245 | .eh_bus_reset_handler = megaraid_reset, | 4245 | .eh_bus_reset_handler = megaraid_reset, |
4246 | .eh_host_reset_handler = megaraid_reset, | 4246 | .eh_host_reset_handler = megaraid_reset, |
4247 | .no_write_same = 1, | ||
4247 | }; | 4248 | }; |
4248 | 4249 | ||
4249 | static int | 4250 | static int |
diff --git a/drivers/scsi/megaraid/megaraid_mbox.c b/drivers/scsi/megaraid/megaraid_mbox.c index d1a4b82836ea..e2237a97cb9d 100644 --- a/drivers/scsi/megaraid/megaraid_mbox.c +++ b/drivers/scsi/megaraid/megaraid_mbox.c | |||
@@ -367,6 +367,7 @@ static struct scsi_host_template megaraid_template_g = { | |||
367 | .eh_host_reset_handler = megaraid_reset_handler, | 367 | .eh_host_reset_handler = megaraid_reset_handler, |
368 | .change_queue_depth = megaraid_change_queue_depth, | 368 | .change_queue_depth = megaraid_change_queue_depth, |
369 | .use_clustering = ENABLE_CLUSTERING, | 369 | .use_clustering = ENABLE_CLUSTERING, |
370 | .no_write_same = 1, | ||
370 | .sdev_attrs = megaraid_sdev_attrs, | 371 | .sdev_attrs = megaraid_sdev_attrs, |
371 | .shost_attrs = megaraid_shost_attrs, | 372 | .shost_attrs = megaraid_shost_attrs, |
372 | }; | 373 | }; |
diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c index 0a743a5d1647..c99812bf2a73 100644 --- a/drivers/scsi/megaraid/megaraid_sas_base.c +++ b/drivers/scsi/megaraid/megaraid_sas_base.c | |||
@@ -2148,6 +2148,7 @@ static struct scsi_host_template megasas_template = { | |||
2148 | .bios_param = megasas_bios_param, | 2148 | .bios_param = megasas_bios_param, |
2149 | .use_clustering = ENABLE_CLUSTERING, | 2149 | .use_clustering = ENABLE_CLUSTERING, |
2150 | .change_queue_depth = megasas_change_queue_depth, | 2150 | .change_queue_depth = megasas_change_queue_depth, |
2151 | .no_write_same = 1, | ||
2151 | }; | 2152 | }; |
2152 | 2153 | ||
2153 | /** | 2154 | /** |
diff --git a/drivers/scsi/pm8001/pm8001_hwi.c b/drivers/scsi/pm8001/pm8001_hwi.c index f16ece91b94a..0a1296a87d66 100644 --- a/drivers/scsi/pm8001/pm8001_hwi.c +++ b/drivers/scsi/pm8001/pm8001_hwi.c | |||
@@ -3403,6 +3403,7 @@ hw_event_sas_phy_up(struct pm8001_hba_info *pm8001_ha, void *piomb) | |||
3403 | unsigned long flags; | 3403 | unsigned long flags; |
3404 | u8 deviceType = pPayload->sas_identify.dev_type; | 3404 | u8 deviceType = pPayload->sas_identify.dev_type; |
3405 | port->port_state = portstate; | 3405 | port->port_state = portstate; |
3406 | phy->phy_state = PHY_STATE_LINK_UP_SPC; | ||
3406 | PM8001_MSG_DBG(pm8001_ha, | 3407 | PM8001_MSG_DBG(pm8001_ha, |
3407 | pm8001_printk("HW_EVENT_SAS_PHY_UP port id = %d, phy id = %d\n", | 3408 | pm8001_printk("HW_EVENT_SAS_PHY_UP port id = %d, phy id = %d\n", |
3408 | port_id, phy_id)); | 3409 | port_id, phy_id)); |
@@ -3483,6 +3484,7 @@ hw_event_sata_phy_up(struct pm8001_hba_info *pm8001_ha, void *piomb) | |||
3483 | pm8001_printk("HW_EVENT_SATA_PHY_UP port id = %d," | 3484 | pm8001_printk("HW_EVENT_SATA_PHY_UP port id = %d," |
3484 | " phy id = %d\n", port_id, phy_id)); | 3485 | " phy id = %d\n", port_id, phy_id)); |
3485 | port->port_state = portstate; | 3486 | port->port_state = portstate; |
3487 | phy->phy_state = PHY_STATE_LINK_UP_SPC; | ||
3486 | port->port_attached = 1; | 3488 | port->port_attached = 1; |
3487 | pm8001_get_lrate_mode(phy, link_rate); | 3489 | pm8001_get_lrate_mode(phy, link_rate); |
3488 | phy->phy_type |= PORT_TYPE_SATA; | 3490 | phy->phy_type |= PORT_TYPE_SATA; |
diff --git a/drivers/scsi/pm8001/pm8001_hwi.h b/drivers/scsi/pm8001/pm8001_hwi.h index 6d91e2446542..e4867e690c84 100644 --- a/drivers/scsi/pm8001/pm8001_hwi.h +++ b/drivers/scsi/pm8001/pm8001_hwi.h | |||
@@ -131,6 +131,10 @@ | |||
131 | #define LINKRATE_30 (0x02 << 8) | 131 | #define LINKRATE_30 (0x02 << 8) |
132 | #define LINKRATE_60 (0x04 << 8) | 132 | #define LINKRATE_60 (0x04 << 8) |
133 | 133 | ||
134 | /* for phy state */ | ||
135 | |||
136 | #define PHY_STATE_LINK_UP_SPC 0x1 | ||
137 | |||
134 | /* for new SPC controllers MEMBASE III is shared between BIOS and DATA */ | 138 | /* for new SPC controllers MEMBASE III is shared between BIOS and DATA */ |
135 | #define GSM_SM_BASE 0x4F0000 | 139 | #define GSM_SM_BASE 0x4F0000 |
136 | struct mpi_msg_hdr{ | 140 | struct mpi_msg_hdr{ |
diff --git a/drivers/scsi/pm8001/pm8001_init.c b/drivers/scsi/pm8001/pm8001_init.c index 34f5f5ffef05..73a120d81b4d 100644 --- a/drivers/scsi/pm8001/pm8001_init.c +++ b/drivers/scsi/pm8001/pm8001_init.c | |||
@@ -175,20 +175,16 @@ static void pm8001_free(struct pm8001_hba_info *pm8001_ha) | |||
175 | static void pm8001_tasklet(unsigned long opaque) | 175 | static void pm8001_tasklet(unsigned long opaque) |
176 | { | 176 | { |
177 | struct pm8001_hba_info *pm8001_ha; | 177 | struct pm8001_hba_info *pm8001_ha; |
178 | u32 vec; | 178 | struct isr_param *irq_vector; |
179 | pm8001_ha = (struct pm8001_hba_info *)opaque; | 179 | |
180 | irq_vector = (struct isr_param *)opaque; | ||
181 | pm8001_ha = irq_vector->drv_inst; | ||
180 | if (unlikely(!pm8001_ha)) | 182 | if (unlikely(!pm8001_ha)) |
181 | BUG_ON(1); | 183 | BUG_ON(1); |
182 | vec = pm8001_ha->int_vector; | 184 | PM8001_CHIP_DISP->isr(pm8001_ha, irq_vector->irq_id); |
183 | PM8001_CHIP_DISP->isr(pm8001_ha, vec); | ||
184 | } | 185 | } |
185 | #endif | 186 | #endif |
186 | 187 | ||
187 | static struct pm8001_hba_info *outq_to_hba(u8 *outq) | ||
188 | { | ||
189 | return container_of((outq - *outq), struct pm8001_hba_info, outq[0]); | ||
190 | } | ||
191 | |||
192 | /** | 188 | /** |
193 | * pm8001_interrupt_handler_msix - main MSIX interrupt handler. | 189 | * pm8001_interrupt_handler_msix - main MSIX interrupt handler. |
194 | * It obtains the vector number and calls the equivalent bottom | 190 | * It obtains the vector number and calls the equivalent bottom |
@@ -198,18 +194,20 @@ static struct pm8001_hba_info *outq_to_hba(u8 *outq) | |||
198 | */ | 194 | */ |
199 | static irqreturn_t pm8001_interrupt_handler_msix(int irq, void *opaque) | 195 | static irqreturn_t pm8001_interrupt_handler_msix(int irq, void *opaque) |
200 | { | 196 | { |
201 | struct pm8001_hba_info *pm8001_ha = outq_to_hba(opaque); | 197 | struct isr_param *irq_vector; |
202 | u8 outq = *(u8 *)opaque; | 198 | struct pm8001_hba_info *pm8001_ha; |
203 | irqreturn_t ret = IRQ_HANDLED; | 199 | irqreturn_t ret = IRQ_HANDLED; |
200 | irq_vector = (struct isr_param *)opaque; | ||
201 | pm8001_ha = irq_vector->drv_inst; | ||
202 | |||
204 | if (unlikely(!pm8001_ha)) | 203 | if (unlikely(!pm8001_ha)) |
205 | return IRQ_NONE; | 204 | return IRQ_NONE; |
206 | if (!PM8001_CHIP_DISP->is_our_interupt(pm8001_ha)) | 205 | if (!PM8001_CHIP_DISP->is_our_interupt(pm8001_ha)) |
207 | return IRQ_NONE; | 206 | return IRQ_NONE; |
208 | pm8001_ha->int_vector = outq; | ||
209 | #ifdef PM8001_USE_TASKLET | 207 | #ifdef PM8001_USE_TASKLET |
210 | tasklet_schedule(&pm8001_ha->tasklet); | 208 | tasklet_schedule(&pm8001_ha->tasklet[irq_vector->irq_id]); |
211 | #else | 209 | #else |
212 | ret = PM8001_CHIP_DISP->isr(pm8001_ha, outq); | 210 | ret = PM8001_CHIP_DISP->isr(pm8001_ha, irq_vector->irq_id); |
213 | #endif | 211 | #endif |
214 | return ret; | 212 | return ret; |
215 | } | 213 | } |
@@ -230,9 +228,8 @@ static irqreturn_t pm8001_interrupt_handler_intx(int irq, void *dev_id) | |||
230 | if (!PM8001_CHIP_DISP->is_our_interupt(pm8001_ha)) | 228 | if (!PM8001_CHIP_DISP->is_our_interupt(pm8001_ha)) |
231 | return IRQ_NONE; | 229 | return IRQ_NONE; |
232 | 230 | ||
233 | pm8001_ha->int_vector = 0; | ||
234 | #ifdef PM8001_USE_TASKLET | 231 | #ifdef PM8001_USE_TASKLET |
235 | tasklet_schedule(&pm8001_ha->tasklet); | 232 | tasklet_schedule(&pm8001_ha->tasklet[0]); |
236 | #else | 233 | #else |
237 | ret = PM8001_CHIP_DISP->isr(pm8001_ha, 0); | 234 | ret = PM8001_CHIP_DISP->isr(pm8001_ha, 0); |
238 | #endif | 235 | #endif |
@@ -457,7 +454,7 @@ static struct pm8001_hba_info *pm8001_pci_alloc(struct pci_dev *pdev, | |||
457 | { | 454 | { |
458 | struct pm8001_hba_info *pm8001_ha; | 455 | struct pm8001_hba_info *pm8001_ha; |
459 | struct sas_ha_struct *sha = SHOST_TO_SAS_HA(shost); | 456 | struct sas_ha_struct *sha = SHOST_TO_SAS_HA(shost); |
460 | 457 | int j; | |
461 | 458 | ||
462 | pm8001_ha = sha->lldd_ha; | 459 | pm8001_ha = sha->lldd_ha; |
463 | if (!pm8001_ha) | 460 | if (!pm8001_ha) |
@@ -480,12 +477,14 @@ static struct pm8001_hba_info *pm8001_pci_alloc(struct pci_dev *pdev, | |||
480 | pm8001_ha->iomb_size = IOMB_SIZE_SPC; | 477 | pm8001_ha->iomb_size = IOMB_SIZE_SPC; |
481 | 478 | ||
482 | #ifdef PM8001_USE_TASKLET | 479 | #ifdef PM8001_USE_TASKLET |
483 | /** | 480 | /* Tasklet for non msi-x interrupt handler */ |
484 | * default tasklet for non msi-x interrupt handler/first msi-x | 481 | if ((!pdev->msix_cap) || (pm8001_ha->chip_id == chip_8001)) |
485 | * interrupt handler | 482 | tasklet_init(&pm8001_ha->tasklet[0], pm8001_tasklet, |
486 | **/ | 483 | (unsigned long)&(pm8001_ha->irq_vector[0])); |
487 | tasklet_init(&pm8001_ha->tasklet, pm8001_tasklet, | 484 | else |
488 | (unsigned long)pm8001_ha); | 485 | for (j = 0; j < PM8001_MAX_MSIX_VEC; j++) |
486 | tasklet_init(&pm8001_ha->tasklet[j], pm8001_tasklet, | ||
487 | (unsigned long)&(pm8001_ha->irq_vector[j])); | ||
489 | #endif | 488 | #endif |
490 | pm8001_ioremap(pm8001_ha); | 489 | pm8001_ioremap(pm8001_ha); |
491 | if (!pm8001_alloc(pm8001_ha, ent)) | 490 | if (!pm8001_alloc(pm8001_ha, ent)) |
@@ -733,19 +732,20 @@ static u32 pm8001_setup_msix(struct pm8001_hba_info *pm8001_ha) | |||
733 | "pci_enable_msix request ret:%d no of intr %d\n", | 732 | "pci_enable_msix request ret:%d no of intr %d\n", |
734 | rc, pm8001_ha->number_of_intr)); | 733 | rc, pm8001_ha->number_of_intr)); |
735 | 734 | ||
736 | for (i = 0; i < number_of_intr; i++) | ||
737 | pm8001_ha->outq[i] = i; | ||
738 | 735 | ||
739 | for (i = 0; i < number_of_intr; i++) { | 736 | for (i = 0; i < number_of_intr; i++) { |
740 | snprintf(intr_drvname[i], sizeof(intr_drvname[0]), | 737 | snprintf(intr_drvname[i], sizeof(intr_drvname[0]), |
741 | DRV_NAME"%d", i); | 738 | DRV_NAME"%d", i); |
739 | pm8001_ha->irq_vector[i].irq_id = i; | ||
740 | pm8001_ha->irq_vector[i].drv_inst = pm8001_ha; | ||
741 | |||
742 | if (request_irq(pm8001_ha->msix_entries[i].vector, | 742 | if (request_irq(pm8001_ha->msix_entries[i].vector, |
743 | pm8001_interrupt_handler_msix, flag, | 743 | pm8001_interrupt_handler_msix, flag, |
744 | intr_drvname[i], &pm8001_ha->outq[i])) { | 744 | intr_drvname[i], &(pm8001_ha->irq_vector[i]))) { |
745 | for (j = 0; j < i; j++) | 745 | for (j = 0; j < i; j++) |
746 | free_irq( | 746 | free_irq( |
747 | pm8001_ha->msix_entries[j].vector, | 747 | pm8001_ha->msix_entries[j].vector, |
748 | &pm8001_ha->outq[j]); | 748 | &(pm8001_ha->irq_vector[i])); |
749 | pci_disable_msix(pm8001_ha->pdev); | 749 | pci_disable_msix(pm8001_ha->pdev); |
750 | break; | 750 | break; |
751 | } | 751 | } |
@@ -907,7 +907,7 @@ static void pm8001_pci_remove(struct pci_dev *pdev) | |||
907 | { | 907 | { |
908 | struct sas_ha_struct *sha = pci_get_drvdata(pdev); | 908 | struct sas_ha_struct *sha = pci_get_drvdata(pdev); |
909 | struct pm8001_hba_info *pm8001_ha; | 909 | struct pm8001_hba_info *pm8001_ha; |
910 | int i; | 910 | int i, j; |
911 | pm8001_ha = sha->lldd_ha; | 911 | pm8001_ha = sha->lldd_ha; |
912 | sas_unregister_ha(sha); | 912 | sas_unregister_ha(sha); |
913 | sas_remove_host(pm8001_ha->shost); | 913 | sas_remove_host(pm8001_ha->shost); |
@@ -921,13 +921,18 @@ static void pm8001_pci_remove(struct pci_dev *pdev) | |||
921 | synchronize_irq(pm8001_ha->msix_entries[i].vector); | 921 | synchronize_irq(pm8001_ha->msix_entries[i].vector); |
922 | for (i = 0; i < pm8001_ha->number_of_intr; i++) | 922 | for (i = 0; i < pm8001_ha->number_of_intr; i++) |
923 | free_irq(pm8001_ha->msix_entries[i].vector, | 923 | free_irq(pm8001_ha->msix_entries[i].vector, |
924 | &pm8001_ha->outq[i]); | 924 | &(pm8001_ha->irq_vector[i])); |
925 | pci_disable_msix(pdev); | 925 | pci_disable_msix(pdev); |
926 | #else | 926 | #else |
927 | free_irq(pm8001_ha->irq, sha); | 927 | free_irq(pm8001_ha->irq, sha); |
928 | #endif | 928 | #endif |
929 | #ifdef PM8001_USE_TASKLET | 929 | #ifdef PM8001_USE_TASKLET |
930 | tasklet_kill(&pm8001_ha->tasklet); | 930 | /* For non-msix and msix interrupts */ |
931 | if ((!pdev->msix_cap) || (pm8001_ha->chip_id == chip_8001)) | ||
932 | tasklet_kill(&pm8001_ha->tasklet[0]); | ||
933 | else | ||
934 | for (j = 0; j < PM8001_MAX_MSIX_VEC; j++) | ||
935 | tasklet_kill(&pm8001_ha->tasklet[j]); | ||
931 | #endif | 936 | #endif |
932 | pm8001_free(pm8001_ha); | 937 | pm8001_free(pm8001_ha); |
933 | kfree(sha->sas_phy); | 938 | kfree(sha->sas_phy); |
@@ -948,7 +953,7 @@ static int pm8001_pci_suspend(struct pci_dev *pdev, pm_message_t state) | |||
948 | { | 953 | { |
949 | struct sas_ha_struct *sha = pci_get_drvdata(pdev); | 954 | struct sas_ha_struct *sha = pci_get_drvdata(pdev); |
950 | struct pm8001_hba_info *pm8001_ha; | 955 | struct pm8001_hba_info *pm8001_ha; |
951 | int i; | 956 | int i, j; |
952 | u32 device_state; | 957 | u32 device_state; |
953 | pm8001_ha = sha->lldd_ha; | 958 | pm8001_ha = sha->lldd_ha; |
954 | flush_workqueue(pm8001_wq); | 959 | flush_workqueue(pm8001_wq); |
@@ -964,13 +969,18 @@ static int pm8001_pci_suspend(struct pci_dev *pdev, pm_message_t state) | |||
964 | synchronize_irq(pm8001_ha->msix_entries[i].vector); | 969 | synchronize_irq(pm8001_ha->msix_entries[i].vector); |
965 | for (i = 0; i < pm8001_ha->number_of_intr; i++) | 970 | for (i = 0; i < pm8001_ha->number_of_intr; i++) |
966 | free_irq(pm8001_ha->msix_entries[i].vector, | 971 | free_irq(pm8001_ha->msix_entries[i].vector, |
967 | &pm8001_ha->outq[i]); | 972 | &(pm8001_ha->irq_vector[i])); |
968 | pci_disable_msix(pdev); | 973 | pci_disable_msix(pdev); |
969 | #else | 974 | #else |
970 | free_irq(pm8001_ha->irq, sha); | 975 | free_irq(pm8001_ha->irq, sha); |
971 | #endif | 976 | #endif |
972 | #ifdef PM8001_USE_TASKLET | 977 | #ifdef PM8001_USE_TASKLET |
973 | tasklet_kill(&pm8001_ha->tasklet); | 978 | /* For non-msix and msix interrupts */ |
979 | if ((!pdev->msix_cap) || (pm8001_ha->chip_id == chip_8001)) | ||
980 | tasklet_kill(&pm8001_ha->tasklet[0]); | ||
981 | else | ||
982 | for (j = 0; j < PM8001_MAX_MSIX_VEC; j++) | ||
983 | tasklet_kill(&pm8001_ha->tasklet[j]); | ||
974 | #endif | 984 | #endif |
975 | device_state = pci_choose_state(pdev, state); | 985 | device_state = pci_choose_state(pdev, state); |
976 | pm8001_printk("pdev=0x%p, slot=%s, entering " | 986 | pm8001_printk("pdev=0x%p, slot=%s, entering " |
@@ -993,7 +1003,7 @@ static int pm8001_pci_resume(struct pci_dev *pdev) | |||
993 | struct sas_ha_struct *sha = pci_get_drvdata(pdev); | 1003 | struct sas_ha_struct *sha = pci_get_drvdata(pdev); |
994 | struct pm8001_hba_info *pm8001_ha; | 1004 | struct pm8001_hba_info *pm8001_ha; |
995 | int rc; | 1005 | int rc; |
996 | u8 i = 0; | 1006 | u8 i = 0, j; |
997 | u32 device_state; | 1007 | u32 device_state; |
998 | pm8001_ha = sha->lldd_ha; | 1008 | pm8001_ha = sha->lldd_ha; |
999 | device_state = pdev->current_state; | 1009 | device_state = pdev->current_state; |
@@ -1033,10 +1043,14 @@ static int pm8001_pci_resume(struct pci_dev *pdev) | |||
1033 | if (rc) | 1043 | if (rc) |
1034 | goto err_out_disable; | 1044 | goto err_out_disable; |
1035 | #ifdef PM8001_USE_TASKLET | 1045 | #ifdef PM8001_USE_TASKLET |
1036 | /* default tasklet for non msi-x interrupt handler/first msi-x | 1046 | /* Tasklet for non msi-x interrupt handler */ |
1037 | * interrupt handler */ | 1047 | if ((!pdev->msix_cap) || (pm8001_ha->chip_id == chip_8001)) |
1038 | tasklet_init(&pm8001_ha->tasklet, pm8001_tasklet, | 1048 | tasklet_init(&pm8001_ha->tasklet[0], pm8001_tasklet, |
1039 | (unsigned long)pm8001_ha); | 1049 | (unsigned long)&(pm8001_ha->irq_vector[0])); |
1050 | else | ||
1051 | for (j = 0; j < PM8001_MAX_MSIX_VEC; j++) | ||
1052 | tasklet_init(&pm8001_ha->tasklet[j], pm8001_tasklet, | ||
1053 | (unsigned long)&(pm8001_ha->irq_vector[j])); | ||
1040 | #endif | 1054 | #endif |
1041 | PM8001_CHIP_DISP->interrupt_enable(pm8001_ha, 0); | 1055 | PM8001_CHIP_DISP->interrupt_enable(pm8001_ha, 0); |
1042 | if (pm8001_ha->chip_id != chip_8001) { | 1056 | if (pm8001_ha->chip_id != chip_8001) { |
@@ -1169,6 +1183,7 @@ module_exit(pm8001_exit); | |||
1169 | MODULE_AUTHOR("Jack Wang <jack_wang@usish.com>"); | 1183 | MODULE_AUTHOR("Jack Wang <jack_wang@usish.com>"); |
1170 | MODULE_AUTHOR("Anand Kumar Santhanam <AnandKumar.Santhanam@pmcs.com>"); | 1184 | MODULE_AUTHOR("Anand Kumar Santhanam <AnandKumar.Santhanam@pmcs.com>"); |
1171 | MODULE_AUTHOR("Sangeetha Gnanasekaran <Sangeetha.Gnanasekaran@pmcs.com>"); | 1185 | MODULE_AUTHOR("Sangeetha Gnanasekaran <Sangeetha.Gnanasekaran@pmcs.com>"); |
1186 | MODULE_AUTHOR("Nikith Ganigarakoppal <Nikith.Ganigarakoppal@pmcs.com>"); | ||
1172 | MODULE_DESCRIPTION( | 1187 | MODULE_DESCRIPTION( |
1173 | "PMC-Sierra PM8001/8081/8088/8089/8074/8076/8077 " | 1188 | "PMC-Sierra PM8001/8081/8088/8089/8074/8076/8077 " |
1174 | "SAS/SATA controller driver"); | 1189 | "SAS/SATA controller driver"); |
diff --git a/drivers/scsi/pm8001/pm8001_sas.c b/drivers/scsi/pm8001/pm8001_sas.c index f4eb18e51631..f50ac44b950e 100644 --- a/drivers/scsi/pm8001/pm8001_sas.c +++ b/drivers/scsi/pm8001/pm8001_sas.c | |||
@@ -1098,15 +1098,17 @@ int pm8001_lu_reset(struct domain_device *dev, u8 *lun) | |||
1098 | struct pm8001_tmf_task tmf_task; | 1098 | struct pm8001_tmf_task tmf_task; |
1099 | struct pm8001_device *pm8001_dev = dev->lldd_dev; | 1099 | struct pm8001_device *pm8001_dev = dev->lldd_dev; |
1100 | struct pm8001_hba_info *pm8001_ha = pm8001_find_ha_by_dev(dev); | 1100 | struct pm8001_hba_info *pm8001_ha = pm8001_find_ha_by_dev(dev); |
1101 | DECLARE_COMPLETION_ONSTACK(completion_setstate); | ||
1101 | if (dev_is_sata(dev)) { | 1102 | if (dev_is_sata(dev)) { |
1102 | struct sas_phy *phy = sas_get_local_phy(dev); | 1103 | struct sas_phy *phy = sas_get_local_phy(dev); |
1103 | rc = pm8001_exec_internal_task_abort(pm8001_ha, pm8001_dev , | 1104 | rc = pm8001_exec_internal_task_abort(pm8001_ha, pm8001_dev , |
1104 | dev, 1, 0); | 1105 | dev, 1, 0); |
1105 | rc = sas_phy_reset(phy, 1); | 1106 | rc = sas_phy_reset(phy, 1); |
1106 | sas_put_local_phy(phy); | 1107 | sas_put_local_phy(phy); |
1108 | pm8001_dev->setds_completion = &completion_setstate; | ||
1107 | rc = PM8001_CHIP_DISP->set_dev_state_req(pm8001_ha, | 1109 | rc = PM8001_CHIP_DISP->set_dev_state_req(pm8001_ha, |
1108 | pm8001_dev, 0x01); | 1110 | pm8001_dev, 0x01); |
1109 | msleep(2000); | 1111 | wait_for_completion(&completion_setstate); |
1110 | } else { | 1112 | } else { |
1111 | tmf_task.tmf = TMF_LU_RESET; | 1113 | tmf_task.tmf = TMF_LU_RESET; |
1112 | rc = pm8001_issue_ssp_tmf(dev, lun, &tmf_task); | 1114 | rc = pm8001_issue_ssp_tmf(dev, lun, &tmf_task); |
diff --git a/drivers/scsi/pm8001/pm8001_sas.h b/drivers/scsi/pm8001/pm8001_sas.h index 6037d477a183..6c5fd5ee22d3 100644 --- a/drivers/scsi/pm8001/pm8001_sas.h +++ b/drivers/scsi/pm8001/pm8001_sas.h | |||
@@ -466,6 +466,10 @@ struct pm8001_hba_memspace { | |||
466 | u64 membase; | 466 | u64 membase; |
467 | u32 memsize; | 467 | u32 memsize; |
468 | }; | 468 | }; |
469 | struct isr_param { | ||
470 | struct pm8001_hba_info *drv_inst; | ||
471 | u32 irq_id; | ||
472 | }; | ||
469 | struct pm8001_hba_info { | 473 | struct pm8001_hba_info { |
470 | char name[PM8001_NAME_LENGTH]; | 474 | char name[PM8001_NAME_LENGTH]; |
471 | struct list_head list; | 475 | struct list_head list; |
@@ -519,14 +523,13 @@ struct pm8001_hba_info { | |||
519 | int number_of_intr;/*will be used in remove()*/ | 523 | int number_of_intr;/*will be used in remove()*/ |
520 | #endif | 524 | #endif |
521 | #ifdef PM8001_USE_TASKLET | 525 | #ifdef PM8001_USE_TASKLET |
522 | struct tasklet_struct tasklet; | 526 | struct tasklet_struct tasklet[PM8001_MAX_MSIX_VEC]; |
523 | #endif | 527 | #endif |
524 | u32 logging_level; | 528 | u32 logging_level; |
525 | u32 fw_status; | 529 | u32 fw_status; |
526 | u32 smp_exp_mode; | 530 | u32 smp_exp_mode; |
527 | u32 int_vector; | ||
528 | const struct firmware *fw_image; | 531 | const struct firmware *fw_image; |
529 | u8 outq[PM8001_MAX_MSIX_VEC]; | 532 | struct isr_param irq_vector[PM8001_MAX_MSIX_VEC]; |
530 | }; | 533 | }; |
531 | 534 | ||
532 | struct pm8001_work { | 535 | struct pm8001_work { |
diff --git a/drivers/scsi/pm8001/pm80xx_hwi.c b/drivers/scsi/pm8001/pm80xx_hwi.c index 8987b1706216..c950dc5c9943 100644 --- a/drivers/scsi/pm8001/pm80xx_hwi.c +++ b/drivers/scsi/pm8001/pm80xx_hwi.c | |||
@@ -2894,6 +2894,7 @@ hw_event_sas_phy_up(struct pm8001_hba_info *pm8001_ha, void *piomb) | |||
2894 | unsigned long flags; | 2894 | unsigned long flags; |
2895 | u8 deviceType = pPayload->sas_identify.dev_type; | 2895 | u8 deviceType = pPayload->sas_identify.dev_type; |
2896 | port->port_state = portstate; | 2896 | port->port_state = portstate; |
2897 | phy->phy_state = PHY_STATE_LINK_UP_SPCV; | ||
2897 | PM8001_MSG_DBG(pm8001_ha, pm8001_printk( | 2898 | PM8001_MSG_DBG(pm8001_ha, pm8001_printk( |
2898 | "portid:%d; phyid:%d; linkrate:%d; " | 2899 | "portid:%d; phyid:%d; linkrate:%d; " |
2899 | "portstate:%x; devicetype:%x\n", | 2900 | "portstate:%x; devicetype:%x\n", |
@@ -2978,6 +2979,7 @@ hw_event_sata_phy_up(struct pm8001_hba_info *pm8001_ha, void *piomb) | |||
2978 | port_id, phy_id, link_rate, portstate)); | 2979 | port_id, phy_id, link_rate, portstate)); |
2979 | 2980 | ||
2980 | port->port_state = portstate; | 2981 | port->port_state = portstate; |
2982 | phy->phy_state = PHY_STATE_LINK_UP_SPCV; | ||
2981 | port->port_attached = 1; | 2983 | port->port_attached = 1; |
2982 | pm8001_get_lrate_mode(phy, link_rate); | 2984 | pm8001_get_lrate_mode(phy, link_rate); |
2983 | phy->phy_type |= PORT_TYPE_SATA; | 2985 | phy->phy_type |= PORT_TYPE_SATA; |
diff --git a/drivers/scsi/pm8001/pm80xx_hwi.h b/drivers/scsi/pm8001/pm80xx_hwi.h index c86816bea424..9970a385795d 100644 --- a/drivers/scsi/pm8001/pm80xx_hwi.h +++ b/drivers/scsi/pm8001/pm80xx_hwi.h | |||
@@ -215,6 +215,8 @@ | |||
215 | #define SAS_DOPNRJT_RTRY_TMO 128 | 215 | #define SAS_DOPNRJT_RTRY_TMO 128 |
216 | #define SAS_COPNRJT_RTRY_TMO 128 | 216 | #define SAS_COPNRJT_RTRY_TMO 128 |
217 | 217 | ||
218 | /* for phy state */ | ||
219 | #define PHY_STATE_LINK_UP_SPCV 0x2 | ||
218 | /* | 220 | /* |
219 | Making ORR bigger than IT NEXUS LOSS which is 2000000us = 2 second. | 221 | Making ORR bigger than IT NEXUS LOSS which is 2000000us = 2 second. |
220 | Assuming a bigger value 3 second, 3000000/128 = 23437.5 where 128 | 222 | Assuming a bigger value 3 second, 3000000/128 = 23437.5 where 128 |
diff --git a/drivers/scsi/pmcraid.c b/drivers/scsi/pmcraid.c index bd6f743d87a7..be8ce54f99b2 100644 --- a/drivers/scsi/pmcraid.c +++ b/drivers/scsi/pmcraid.c | |||
@@ -1404,11 +1404,22 @@ enum { | |||
1404 | }; | 1404 | }; |
1405 | #define PMCRAID_AEN_CMD_MAX (__PMCRAID_AEN_CMD_MAX - 1) | 1405 | #define PMCRAID_AEN_CMD_MAX (__PMCRAID_AEN_CMD_MAX - 1) |
1406 | 1406 | ||
1407 | static struct genl_multicast_group pmcraid_mcgrps[] = { | ||
1408 | { .name = "events", /* not really used - see ID discussion below */ }, | ||
1409 | }; | ||
1410 | |||
1407 | static struct genl_family pmcraid_event_family = { | 1411 | static struct genl_family pmcraid_event_family = { |
1408 | .id = GENL_ID_GENERATE, | 1412 | /* |
1413 | * Due to prior multicast group abuse (the code having assumed that | ||
1414 | * the family ID can be used as a multicast group ID) we need to | ||
1415 | * statically allocate a family (and thus group) ID. | ||
1416 | */ | ||
1417 | .id = GENL_ID_PMCRAID, | ||
1409 | .name = "pmcraid", | 1418 | .name = "pmcraid", |
1410 | .version = 1, | 1419 | .version = 1, |
1411 | .maxattr = PMCRAID_AEN_ATTR_MAX | 1420 | .maxattr = PMCRAID_AEN_ATTR_MAX, |
1421 | .mcgrps = pmcraid_mcgrps, | ||
1422 | .n_mcgrps = ARRAY_SIZE(pmcraid_mcgrps), | ||
1412 | }; | 1423 | }; |
1413 | 1424 | ||
1414 | /** | 1425 | /** |
@@ -1511,9 +1522,8 @@ static int pmcraid_notify_aen( | |||
1511 | return result; | 1522 | return result; |
1512 | } | 1523 | } |
1513 | 1524 | ||
1514 | result = | 1525 | result = genlmsg_multicast(&pmcraid_event_family, skb, |
1515 | genlmsg_multicast(&pmcraid_event_family, skb, 0, | 1526 | 0, 0, GFP_ATOMIC); |
1516 | pmcraid_event_family.id, GFP_ATOMIC); | ||
1517 | 1527 | ||
1518 | /* If there are no listeners, genlmsg_multicast may return non-zero | 1528 | /* If there are no listeners, genlmsg_multicast may return non-zero |
1519 | * value. | 1529 | * value. |
@@ -4315,6 +4325,7 @@ static struct scsi_host_template pmcraid_host_template = { | |||
4315 | .this_id = -1, | 4325 | .this_id = -1, |
4316 | .sg_tablesize = PMCRAID_MAX_IOADLS, | 4326 | .sg_tablesize = PMCRAID_MAX_IOADLS, |
4317 | .max_sectors = PMCRAID_IOA_MAX_SECTORS, | 4327 | .max_sectors = PMCRAID_IOA_MAX_SECTORS, |
4328 | .no_write_same = 1, | ||
4318 | .cmd_per_lun = PMCRAID_MAX_CMD_PER_LUN, | 4329 | .cmd_per_lun = PMCRAID_MAX_CMD_PER_LUN, |
4319 | .use_clustering = ENABLE_CLUSTERING, | 4330 | .use_clustering = ENABLE_CLUSTERING, |
4320 | .shost_attrs = pmcraid_host_attrs, | 4331 | .shost_attrs = pmcraid_host_attrs, |
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index e6c4bff04339..69725f7c32c1 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c | |||
@@ -2659,6 +2659,12 @@ static void sd_read_write_same(struct scsi_disk *sdkp, unsigned char *buffer) | |||
2659 | { | 2659 | { |
2660 | struct scsi_device *sdev = sdkp->device; | 2660 | struct scsi_device *sdev = sdkp->device; |
2661 | 2661 | ||
2662 | if (sdev->host->no_write_same) { | ||
2663 | sdev->no_write_same = 1; | ||
2664 | |||
2665 | return; | ||
2666 | } | ||
2667 | |||
2662 | if (scsi_report_opcode(sdev, buffer, SD_BUF_SIZE, INQUIRY) < 0) { | 2668 | if (scsi_report_opcode(sdev, buffer, SD_BUF_SIZE, INQUIRY) < 0) { |
2663 | /* too large values might cause issues with arcmsr */ | 2669 | /* too large values might cause issues with arcmsr */ |
2664 | int vpd_buf_len = 64; | 2670 | int vpd_buf_len = 64; |
diff --git a/drivers/scsi/storvsc_drv.c b/drivers/scsi/storvsc_drv.c index 1a28f5632797..17d740427240 100644 --- a/drivers/scsi/storvsc_drv.c +++ b/drivers/scsi/storvsc_drv.c | |||
@@ -1697,6 +1697,7 @@ static struct scsi_host_template scsi_driver = { | |||
1697 | .use_clustering = DISABLE_CLUSTERING, | 1697 | .use_clustering = DISABLE_CLUSTERING, |
1698 | /* Make sure we dont get a sg segment crosses a page boundary */ | 1698 | /* Make sure we dont get a sg segment crosses a page boundary */ |
1699 | .dma_boundary = PAGE_SIZE-1, | 1699 | .dma_boundary = PAGE_SIZE-1, |
1700 | .no_write_same = 1, | ||
1700 | }; | 1701 | }; |
1701 | 1702 | ||
1702 | enum { | 1703 | enum { |
diff --git a/drivers/spi/spi-bcm2835.c b/drivers/spi/spi-bcm2835.c index 3ed666fe840a..9025edd7dc45 100644 --- a/drivers/spi/spi-bcm2835.c +++ b/drivers/spi/spi-bcm2835.c | |||
@@ -377,7 +377,7 @@ out_master_put: | |||
377 | 377 | ||
378 | static int bcm2835_spi_remove(struct platform_device *pdev) | 378 | static int bcm2835_spi_remove(struct platform_device *pdev) |
379 | { | 379 | { |
380 | struct spi_master *master = spi_master_get(platform_get_drvdata(pdev)); | 380 | struct spi_master *master = platform_get_drvdata(pdev); |
381 | struct bcm2835_spi *bs = spi_master_get_devdata(master); | 381 | struct bcm2835_spi *bs = spi_master_get_devdata(master); |
382 | 382 | ||
383 | free_irq(bs->irq, master); | 383 | free_irq(bs->irq, master); |
diff --git a/drivers/spi/spi-bcm63xx.c b/drivers/spi/spi-bcm63xx.c index 80d56b214eb5..469ecd876358 100644 --- a/drivers/spi/spi-bcm63xx.c +++ b/drivers/spi/spi-bcm63xx.c | |||
@@ -435,7 +435,7 @@ out: | |||
435 | 435 | ||
436 | static int bcm63xx_spi_remove(struct platform_device *pdev) | 436 | static int bcm63xx_spi_remove(struct platform_device *pdev) |
437 | { | 437 | { |
438 | struct spi_master *master = spi_master_get(platform_get_drvdata(pdev)); | 438 | struct spi_master *master = platform_get_drvdata(pdev); |
439 | struct bcm63xx_spi *bs = spi_master_get_devdata(master); | 439 | struct bcm63xx_spi *bs = spi_master_get_devdata(master); |
440 | 440 | ||
441 | /* reset spi block */ | 441 | /* reset spi block */ |
diff --git a/drivers/spi/spi-mpc512x-psc.c b/drivers/spi/spi-mpc512x-psc.c index 9602bbd8d7ea..87676587d783 100644 --- a/drivers/spi/spi-mpc512x-psc.c +++ b/drivers/spi/spi-mpc512x-psc.c | |||
@@ -557,7 +557,7 @@ free_master: | |||
557 | 557 | ||
558 | static int mpc512x_psc_spi_do_remove(struct device *dev) | 558 | static int mpc512x_psc_spi_do_remove(struct device *dev) |
559 | { | 559 | { |
560 | struct spi_master *master = spi_master_get(dev_get_drvdata(dev)); | 560 | struct spi_master *master = dev_get_drvdata(dev); |
561 | struct mpc512x_psc_spi *mps = spi_master_get_devdata(master); | 561 | struct mpc512x_psc_spi *mps = spi_master_get_devdata(master); |
562 | 562 | ||
563 | clk_disable_unprepare(mps->clk_mclk); | 563 | clk_disable_unprepare(mps->clk_mclk); |
diff --git a/drivers/spi/spi-mxs.c b/drivers/spi/spi-mxs.c index 73afb56c08cc..3adebfa22e3d 100644 --- a/drivers/spi/spi-mxs.c +++ b/drivers/spi/spi-mxs.c | |||
@@ -565,7 +565,7 @@ static int mxs_spi_remove(struct platform_device *pdev) | |||
565 | struct mxs_spi *spi; | 565 | struct mxs_spi *spi; |
566 | struct mxs_ssp *ssp; | 566 | struct mxs_ssp *ssp; |
567 | 567 | ||
568 | master = spi_master_get(platform_get_drvdata(pdev)); | 568 | master = platform_get_drvdata(pdev); |
569 | spi = spi_master_get_devdata(master); | 569 | spi = spi_master_get_devdata(master); |
570 | ssp = &spi->ssp; | 570 | ssp = &spi->ssp; |
571 | 571 | ||
diff --git a/drivers/spi/spi-pxa2xx.c b/drivers/spi/spi-pxa2xx.c index cb0e1f1137ad..7765b1999537 100644 --- a/drivers/spi/spi-pxa2xx.c +++ b/drivers/spi/spi-pxa2xx.c | |||
@@ -1073,6 +1073,8 @@ pxa2xx_spi_acpi_get_pdata(struct platform_device *pdev) | |||
1073 | static struct acpi_device_id pxa2xx_spi_acpi_match[] = { | 1073 | static struct acpi_device_id pxa2xx_spi_acpi_match[] = { |
1074 | { "INT33C0", 0 }, | 1074 | { "INT33C0", 0 }, |
1075 | { "INT33C1", 0 }, | 1075 | { "INT33C1", 0 }, |
1076 | { "INT3430", 0 }, | ||
1077 | { "INT3431", 0 }, | ||
1076 | { "80860F0E", 0 }, | 1078 | { "80860F0E", 0 }, |
1077 | { }, | 1079 | { }, |
1078 | }; | 1080 | }; |
@@ -1291,6 +1293,9 @@ static int pxa2xx_spi_resume(struct device *dev) | |||
1291 | /* Enable the SSP clock */ | 1293 | /* Enable the SSP clock */ |
1292 | clk_prepare_enable(ssp->clk); | 1294 | clk_prepare_enable(ssp->clk); |
1293 | 1295 | ||
1296 | /* Restore LPSS private register bits */ | ||
1297 | lpss_ssp_setup(drv_data); | ||
1298 | |||
1294 | /* Start the queue running */ | 1299 | /* Start the queue running */ |
1295 | status = spi_master_resume(drv_data->master); | 1300 | status = spi_master_resume(drv_data->master); |
1296 | if (status != 0) { | 1301 | if (status != 0) { |
diff --git a/drivers/spi/spi-rspi.c b/drivers/spi/spi-rspi.c index 58449ad4ad0d..9e829cee7357 100644 --- a/drivers/spi/spi-rspi.c +++ b/drivers/spi/spi-rspi.c | |||
@@ -885,14 +885,13 @@ static void rspi_release_dma(struct rspi_data *rspi) | |||
885 | 885 | ||
886 | static int rspi_remove(struct platform_device *pdev) | 886 | static int rspi_remove(struct platform_device *pdev) |
887 | { | 887 | { |
888 | struct rspi_data *rspi = spi_master_get(platform_get_drvdata(pdev)); | 888 | struct rspi_data *rspi = platform_get_drvdata(pdev); |
889 | 889 | ||
890 | spi_unregister_master(rspi->master); | 890 | spi_unregister_master(rspi->master); |
891 | rspi_release_dma(rspi); | 891 | rspi_release_dma(rspi); |
892 | free_irq(platform_get_irq(pdev, 0), rspi); | 892 | free_irq(platform_get_irq(pdev, 0), rspi); |
893 | clk_put(rspi->clk); | 893 | clk_put(rspi->clk); |
894 | iounmap(rspi->addr); | 894 | iounmap(rspi->addr); |
895 | spi_master_put(rspi->master); | ||
896 | 895 | ||
897 | return 0; | 896 | return 0; |
898 | } | 897 | } |
diff --git a/drivers/spi/spi-ti-qspi.c b/drivers/spi/spi-ti-qspi.c index 0b71270fbf67..4396bd448540 100644 --- a/drivers/spi/spi-ti-qspi.c +++ b/drivers/spi/spi-ti-qspi.c | |||
@@ -161,7 +161,7 @@ static int ti_qspi_setup(struct spi_device *spi) | |||
161 | qspi->spi_max_frequency, clk_div); | 161 | qspi->spi_max_frequency, clk_div); |
162 | 162 | ||
163 | ret = pm_runtime_get_sync(qspi->dev); | 163 | ret = pm_runtime_get_sync(qspi->dev); |
164 | if (ret) { | 164 | if (ret < 0) { |
165 | dev_err(qspi->dev, "pm_runtime_get_sync() failed\n"); | 165 | dev_err(qspi->dev, "pm_runtime_get_sync() failed\n"); |
166 | return ret; | 166 | return ret; |
167 | } | 167 | } |
@@ -459,11 +459,10 @@ static int ti_qspi_probe(struct platform_device *pdev) | |||
459 | if (!of_property_read_u32(np, "num-cs", &num_cs)) | 459 | if (!of_property_read_u32(np, "num-cs", &num_cs)) |
460 | master->num_chipselect = num_cs; | 460 | master->num_chipselect = num_cs; |
461 | 461 | ||
462 | platform_set_drvdata(pdev, master); | ||
463 | |||
464 | qspi = spi_master_get_devdata(master); | 462 | qspi = spi_master_get_devdata(master); |
465 | qspi->master = master; | 463 | qspi->master = master; |
466 | qspi->dev = &pdev->dev; | 464 | qspi->dev = &pdev->dev; |
465 | platform_set_drvdata(pdev, qspi); | ||
467 | 466 | ||
468 | r = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 467 | r = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
469 | 468 | ||
@@ -517,10 +516,26 @@ free_master: | |||
517 | 516 | ||
518 | static int ti_qspi_remove(struct platform_device *pdev) | 517 | static int ti_qspi_remove(struct platform_device *pdev) |
519 | { | 518 | { |
520 | struct ti_qspi *qspi = platform_get_drvdata(pdev); | 519 | struct spi_master *master; |
520 | struct ti_qspi *qspi; | ||
521 | int ret; | ||
522 | |||
523 | master = platform_get_drvdata(pdev); | ||
524 | qspi = spi_master_get_devdata(master); | ||
525 | |||
526 | ret = pm_runtime_get_sync(qspi->dev); | ||
527 | if (ret < 0) { | ||
528 | dev_err(qspi->dev, "pm_runtime_get_sync() failed\n"); | ||
529 | return ret; | ||
530 | } | ||
521 | 531 | ||
522 | ti_qspi_write(qspi, QSPI_WC_INT_DISABLE, QSPI_INTR_ENABLE_CLEAR_REG); | 532 | ti_qspi_write(qspi, QSPI_WC_INT_DISABLE, QSPI_INTR_ENABLE_CLEAR_REG); |
523 | 533 | ||
534 | pm_runtime_put(qspi->dev); | ||
535 | pm_runtime_disable(&pdev->dev); | ||
536 | |||
537 | spi_unregister_master(master); | ||
538 | |||
524 | return 0; | 539 | return 0; |
525 | } | 540 | } |
526 | 541 | ||
diff --git a/drivers/spi/spi-txx9.c b/drivers/spi/spi-txx9.c index 637cce2b8bdd..18c9bb2b5f39 100644 --- a/drivers/spi/spi-txx9.c +++ b/drivers/spi/spi-txx9.c | |||
@@ -425,7 +425,7 @@ exit: | |||
425 | 425 | ||
426 | static int txx9spi_remove(struct platform_device *dev) | 426 | static int txx9spi_remove(struct platform_device *dev) |
427 | { | 427 | { |
428 | struct spi_master *master = spi_master_get(platform_get_drvdata(dev)); | 428 | struct spi_master *master = platform_get_drvdata(dev); |
429 | struct txx9spi *c = spi_master_get_devdata(master); | 429 | struct txx9spi *c = spi_master_get_devdata(master); |
430 | 430 | ||
431 | destroy_workqueue(c->workqueue); | 431 | destroy_workqueue(c->workqueue); |
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index 18cc625d887f..349ebba4b199 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c | |||
@@ -1415,7 +1415,7 @@ int devm_spi_register_master(struct device *dev, struct spi_master *master) | |||
1415 | return -ENOMEM; | 1415 | return -ENOMEM; |
1416 | 1416 | ||
1417 | ret = spi_register_master(master); | 1417 | ret = spi_register_master(master); |
1418 | if (ret != 0) { | 1418 | if (!ret) { |
1419 | *ptr = master; | 1419 | *ptr = master; |
1420 | devres_add(dev, ptr); | 1420 | devres_add(dev, ptr); |
1421 | } else { | 1421 | } else { |
diff --git a/drivers/staging/tidspbridge/rmgr/drv_interface.c b/drivers/staging/tidspbridge/rmgr/drv_interface.c index 1aa4a3fd0f1b..56e355b3e7fa 100644 --- a/drivers/staging/tidspbridge/rmgr/drv_interface.c +++ b/drivers/staging/tidspbridge/rmgr/drv_interface.c | |||
@@ -258,7 +258,8 @@ err: | |||
258 | /* This function maps kernel space memory to user space memory. */ | 258 | /* This function maps kernel space memory to user space memory. */ |
259 | static int bridge_mmap(struct file *filp, struct vm_area_struct *vma) | 259 | static int bridge_mmap(struct file *filp, struct vm_area_struct *vma) |
260 | { | 260 | { |
261 | u32 status; | 261 | struct omap_dsp_platform_data *pdata = |
262 | omap_dspbridge_dev->dev.platform_data; | ||
262 | 263 | ||
263 | /* VM_IO | VM_DONTEXPAND | VM_DONTDUMP are set by remap_pfn_range() */ | 264 | /* VM_IO | VM_DONTEXPAND | VM_DONTDUMP are set by remap_pfn_range() */ |
264 | vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); | 265 | vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); |
@@ -268,13 +269,9 @@ static int bridge_mmap(struct file *filp, struct vm_area_struct *vma) | |||
268 | vma->vm_start, vma->vm_end, vma->vm_page_prot, | 269 | vma->vm_start, vma->vm_end, vma->vm_page_prot, |
269 | vma->vm_flags); | 270 | vma->vm_flags); |
270 | 271 | ||
271 | status = remap_pfn_range(vma, vma->vm_start, vma->vm_pgoff, | 272 | return vm_iomap_memory(vma, |
272 | vma->vm_end - vma->vm_start, | 273 | pdata->phys_mempool_base, |
273 | vma->vm_page_prot); | 274 | pdata->phys_mempool_size); |
274 | if (status != 0) | ||
275 | status = -EAGAIN; | ||
276 | |||
277 | return status; | ||
278 | } | 275 | } |
279 | 276 | ||
280 | static const struct file_operations bridge_fops = { | 277 | static const struct file_operations bridge_fops = { |
diff --git a/drivers/tty/n_tty.c b/drivers/tty/n_tty.c index 0f74945af624..268b62768f2b 100644 --- a/drivers/tty/n_tty.c +++ b/drivers/tty/n_tty.c | |||
@@ -810,7 +810,8 @@ static void process_echoes(struct tty_struct *tty) | |||
810 | struct n_tty_data *ldata = tty->disc_data; | 810 | struct n_tty_data *ldata = tty->disc_data; |
811 | size_t echoed; | 811 | size_t echoed; |
812 | 812 | ||
813 | if (!L_ECHO(tty) || ldata->echo_commit == ldata->echo_tail) | 813 | if ((!L_ECHO(tty) && !L_ECHONL(tty)) || |
814 | ldata->echo_commit == ldata->echo_tail) | ||
814 | return; | 815 | return; |
815 | 816 | ||
816 | mutex_lock(&ldata->output_lock); | 817 | mutex_lock(&ldata->output_lock); |
@@ -825,7 +826,8 @@ static void flush_echoes(struct tty_struct *tty) | |||
825 | { | 826 | { |
826 | struct n_tty_data *ldata = tty->disc_data; | 827 | struct n_tty_data *ldata = tty->disc_data; |
827 | 828 | ||
828 | if (!L_ECHO(tty) || ldata->echo_commit == ldata->echo_head) | 829 | if ((!L_ECHO(tty) && !L_ECHONL(tty)) || |
830 | ldata->echo_commit == ldata->echo_head) | ||
829 | return; | 831 | return; |
830 | 832 | ||
831 | mutex_lock(&ldata->output_lock); | 833 | mutex_lock(&ldata->output_lock); |
diff --git a/drivers/uio/uio.c b/drivers/uio/uio.c index 67beb8444930..f7beb6eb40c7 100644 --- a/drivers/uio/uio.c +++ b/drivers/uio/uio.c | |||
@@ -653,6 +653,8 @@ static int uio_mmap_physical(struct vm_area_struct *vma) | |||
653 | return -EINVAL; | 653 | return -EINVAL; |
654 | mem = idev->info->mem + mi; | 654 | mem = idev->info->mem + mi; |
655 | 655 | ||
656 | if (mem->addr & ~PAGE_MASK) | ||
657 | return -ENODEV; | ||
656 | if (vma->vm_end - vma->vm_start > mem->size) | 658 | if (vma->vm_end - vma->vm_start > mem->size) |
657 | return -EINVAL; | 659 | return -EINVAL; |
658 | 660 | ||
diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c index 3e7560f004f8..e8404319ca68 100644 --- a/drivers/usb/class/cdc-acm.c +++ b/drivers/usb/class/cdc-acm.c | |||
@@ -1515,6 +1515,8 @@ static int acm_reset_resume(struct usb_interface *intf) | |||
1515 | 1515 | ||
1516 | static const struct usb_device_id acm_ids[] = { | 1516 | static const struct usb_device_id acm_ids[] = { |
1517 | /* quirky and broken devices */ | 1517 | /* quirky and broken devices */ |
1518 | { USB_DEVICE(0x17ef, 0x7000), /* Lenovo USB modem */ | ||
1519 | .driver_info = NO_UNION_NORMAL, },/* has no union descriptor */ | ||
1518 | { USB_DEVICE(0x0870, 0x0001), /* Metricom GS Modem */ | 1520 | { USB_DEVICE(0x0870, 0x0001), /* Metricom GS Modem */ |
1519 | .driver_info = NO_UNION_NORMAL, /* has no union descriptor */ | 1521 | .driver_info = NO_UNION_NORMAL, /* has no union descriptor */ |
1520 | }, | 1522 | }, |
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c index a7c04e24ca48..bd9dc3504b51 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c | |||
@@ -4832,8 +4832,9 @@ static void hub_events(void) | |||
4832 | hub->ports[i - 1]->child; | 4832 | hub->ports[i - 1]->child; |
4833 | 4833 | ||
4834 | dev_dbg(hub_dev, "warm reset port %d\n", i); | 4834 | dev_dbg(hub_dev, "warm reset port %d\n", i); |
4835 | if (!udev || !(portstatus & | 4835 | if (!udev || |
4836 | USB_PORT_STAT_CONNECTION)) { | 4836 | !(portstatus & USB_PORT_STAT_CONNECTION) || |
4837 | udev->state == USB_STATE_NOTATTACHED) { | ||
4837 | status = hub_port_reset(hub, i, | 4838 | status = hub_port_reset(hub, i, |
4838 | NULL, HUB_BH_RESET_TIME, | 4839 | NULL, HUB_BH_RESET_TIME, |
4839 | true); | 4840 | true); |
diff --git a/drivers/usb/dwc3/ep0.c b/drivers/usb/dwc3/ep0.c index 95f7649c71a7..21a352079bc2 100644 --- a/drivers/usb/dwc3/ep0.c +++ b/drivers/usb/dwc3/ep0.c | |||
@@ -459,6 +459,8 @@ static int dwc3_ep0_handle_feature(struct dwc3 *dwc, | |||
459 | dep = dwc3_wIndex_to_dep(dwc, wIndex); | 459 | dep = dwc3_wIndex_to_dep(dwc, wIndex); |
460 | if (!dep) | 460 | if (!dep) |
461 | return -EINVAL; | 461 | return -EINVAL; |
462 | if (set == 0 && (dep->flags & DWC3_EP_WEDGE)) | ||
463 | break; | ||
462 | ret = __dwc3_gadget_ep_set_halt(dep, set); | 464 | ret = __dwc3_gadget_ep_set_halt(dep, set); |
463 | if (ret) | 465 | if (ret) |
464 | return -EINVAL; | 466 | return -EINVAL; |
diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c index 5452c0fce360..02e44fcaf205 100644 --- a/drivers/usb/dwc3/gadget.c +++ b/drivers/usb/dwc3/gadget.c | |||
@@ -1200,9 +1200,6 @@ int __dwc3_gadget_ep_set_halt(struct dwc3_ep *dep, int value) | |||
1200 | else | 1200 | else |
1201 | dep->flags |= DWC3_EP_STALL; | 1201 | dep->flags |= DWC3_EP_STALL; |
1202 | } else { | 1202 | } else { |
1203 | if (dep->flags & DWC3_EP_WEDGE) | ||
1204 | return 0; | ||
1205 | |||
1206 | ret = dwc3_send_gadget_ep_cmd(dwc, dep->number, | 1203 | ret = dwc3_send_gadget_ep_cmd(dwc, dep->number, |
1207 | DWC3_DEPCMD_CLEARSTALL, ¶ms); | 1204 | DWC3_DEPCMD_CLEARSTALL, ¶ms); |
1208 | if (ret) | 1205 | if (ret) |
@@ -1210,7 +1207,7 @@ int __dwc3_gadget_ep_set_halt(struct dwc3_ep *dep, int value) | |||
1210 | value ? "set" : "clear", | 1207 | value ? "set" : "clear", |
1211 | dep->name); | 1208 | dep->name); |
1212 | else | 1209 | else |
1213 | dep->flags &= ~DWC3_EP_STALL; | 1210 | dep->flags &= ~(DWC3_EP_STALL | DWC3_EP_WEDGE); |
1214 | } | 1211 | } |
1215 | 1212 | ||
1216 | return ret; | 1213 | return ret; |
diff --git a/drivers/usb/gadget/Kconfig b/drivers/usb/gadget/Kconfig index a91e6422f930..f66d96ad1f51 100644 --- a/drivers/usb/gadget/Kconfig +++ b/drivers/usb/gadget/Kconfig | |||
@@ -682,6 +682,7 @@ config USB_CONFIGFS_PHONET | |||
682 | config USB_CONFIGFS_MASS_STORAGE | 682 | config USB_CONFIGFS_MASS_STORAGE |
683 | boolean "Mass storage" | 683 | boolean "Mass storage" |
684 | depends on USB_CONFIGFS | 684 | depends on USB_CONFIGFS |
685 | depends on BLOCK | ||
685 | select USB_F_MASS_STORAGE | 686 | select USB_F_MASS_STORAGE |
686 | help | 687 | help |
687 | The Mass Storage Gadget acts as a USB Mass Storage disk drive. | 688 | The Mass Storage Gadget acts as a USB Mass Storage disk drive. |
diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c index 3e7ae707f691..2018ba1a2172 100644 --- a/drivers/usb/gadget/composite.c +++ b/drivers/usb/gadget/composite.c | |||
@@ -593,6 +593,7 @@ static void reset_config(struct usb_composite_dev *cdev) | |||
593 | bitmap_zero(f->endpoints, 32); | 593 | bitmap_zero(f->endpoints, 32); |
594 | } | 594 | } |
595 | cdev->config = NULL; | 595 | cdev->config = NULL; |
596 | cdev->delayed_status = 0; | ||
596 | } | 597 | } |
597 | 598 | ||
598 | static int set_config(struct usb_composite_dev *cdev, | 599 | static int set_config(struct usb_composite_dev *cdev, |
diff --git a/drivers/usb/gadget/f_fs.c b/drivers/usb/gadget/f_fs.c index 774e8b89cdb5..241fc873ffa4 100644 --- a/drivers/usb/gadget/f_fs.c +++ b/drivers/usb/gadget/f_fs.c | |||
@@ -1304,7 +1304,7 @@ static struct ffs_data *ffs_data_new(void) | |||
1304 | { | 1304 | { |
1305 | struct ffs_data *ffs = kzalloc(sizeof *ffs, GFP_KERNEL); | 1305 | struct ffs_data *ffs = kzalloc(sizeof *ffs, GFP_KERNEL); |
1306 | if (unlikely(!ffs)) | 1306 | if (unlikely(!ffs)) |
1307 | return 0; | 1307 | return NULL; |
1308 | 1308 | ||
1309 | ENTER(); | 1309 | ENTER(); |
1310 | 1310 | ||
diff --git a/drivers/usb/gadget/f_mass_storage.c b/drivers/usb/gadget/f_mass_storage.c index a03ba2c83589..b96393908860 100644 --- a/drivers/usb/gadget/f_mass_storage.c +++ b/drivers/usb/gadget/f_mass_storage.c | |||
@@ -523,7 +523,7 @@ static int fsg_setup(struct usb_function *f, | |||
523 | */ | 523 | */ |
524 | DBG(fsg, "bulk reset request\n"); | 524 | DBG(fsg, "bulk reset request\n"); |
525 | raise_exception(fsg->common, FSG_STATE_RESET); | 525 | raise_exception(fsg->common, FSG_STATE_RESET); |
526 | return DELAYED_STATUS; | 526 | return USB_GADGET_DELAYED_STATUS; |
527 | 527 | ||
528 | case US_BULK_GET_MAX_LUN: | 528 | case US_BULK_GET_MAX_LUN: |
529 | if (ctrl->bRequestType != | 529 | if (ctrl->bRequestType != |
@@ -602,13 +602,14 @@ static bool start_out_transfer(struct fsg_common *common, struct fsg_buffhd *bh) | |||
602 | return true; | 602 | return true; |
603 | } | 603 | } |
604 | 604 | ||
605 | static int sleep_thread(struct fsg_common *common) | 605 | static int sleep_thread(struct fsg_common *common, bool can_freeze) |
606 | { | 606 | { |
607 | int rc = 0; | 607 | int rc = 0; |
608 | 608 | ||
609 | /* Wait until a signal arrives or we are woken up */ | 609 | /* Wait until a signal arrives or we are woken up */ |
610 | for (;;) { | 610 | for (;;) { |
611 | try_to_freeze(); | 611 | if (can_freeze) |
612 | try_to_freeze(); | ||
612 | set_current_state(TASK_INTERRUPTIBLE); | 613 | set_current_state(TASK_INTERRUPTIBLE); |
613 | if (signal_pending(current)) { | 614 | if (signal_pending(current)) { |
614 | rc = -EINTR; | 615 | rc = -EINTR; |
@@ -682,7 +683,7 @@ static int do_read(struct fsg_common *common) | |||
682 | /* Wait for the next buffer to become available */ | 683 | /* Wait for the next buffer to become available */ |
683 | bh = common->next_buffhd_to_fill; | 684 | bh = common->next_buffhd_to_fill; |
684 | while (bh->state != BUF_STATE_EMPTY) { | 685 | while (bh->state != BUF_STATE_EMPTY) { |
685 | rc = sleep_thread(common); | 686 | rc = sleep_thread(common, false); |
686 | if (rc) | 687 | if (rc) |
687 | return rc; | 688 | return rc; |
688 | } | 689 | } |
@@ -937,7 +938,7 @@ static int do_write(struct fsg_common *common) | |||
937 | } | 938 | } |
938 | 939 | ||
939 | /* Wait for something to happen */ | 940 | /* Wait for something to happen */ |
940 | rc = sleep_thread(common); | 941 | rc = sleep_thread(common, false); |
941 | if (rc) | 942 | if (rc) |
942 | return rc; | 943 | return rc; |
943 | } | 944 | } |
@@ -1504,7 +1505,7 @@ static int throw_away_data(struct fsg_common *common) | |||
1504 | } | 1505 | } |
1505 | 1506 | ||
1506 | /* Otherwise wait for something to happen */ | 1507 | /* Otherwise wait for something to happen */ |
1507 | rc = sleep_thread(common); | 1508 | rc = sleep_thread(common, true); |
1508 | if (rc) | 1509 | if (rc) |
1509 | return rc; | 1510 | return rc; |
1510 | } | 1511 | } |
@@ -1625,7 +1626,7 @@ static int send_status(struct fsg_common *common) | |||
1625 | /* Wait for the next buffer to become available */ | 1626 | /* Wait for the next buffer to become available */ |
1626 | bh = common->next_buffhd_to_fill; | 1627 | bh = common->next_buffhd_to_fill; |
1627 | while (bh->state != BUF_STATE_EMPTY) { | 1628 | while (bh->state != BUF_STATE_EMPTY) { |
1628 | rc = sleep_thread(common); | 1629 | rc = sleep_thread(common, true); |
1629 | if (rc) | 1630 | if (rc) |
1630 | return rc; | 1631 | return rc; |
1631 | } | 1632 | } |
@@ -1828,7 +1829,7 @@ static int do_scsi_command(struct fsg_common *common) | |||
1828 | bh = common->next_buffhd_to_fill; | 1829 | bh = common->next_buffhd_to_fill; |
1829 | common->next_buffhd_to_drain = bh; | 1830 | common->next_buffhd_to_drain = bh; |
1830 | while (bh->state != BUF_STATE_EMPTY) { | 1831 | while (bh->state != BUF_STATE_EMPTY) { |
1831 | rc = sleep_thread(common); | 1832 | rc = sleep_thread(common, true); |
1832 | if (rc) | 1833 | if (rc) |
1833 | return rc; | 1834 | return rc; |
1834 | } | 1835 | } |
@@ -2174,7 +2175,7 @@ static int get_next_command(struct fsg_common *common) | |||
2174 | /* Wait for the next buffer to become available */ | 2175 | /* Wait for the next buffer to become available */ |
2175 | bh = common->next_buffhd_to_fill; | 2176 | bh = common->next_buffhd_to_fill; |
2176 | while (bh->state != BUF_STATE_EMPTY) { | 2177 | while (bh->state != BUF_STATE_EMPTY) { |
2177 | rc = sleep_thread(common); | 2178 | rc = sleep_thread(common, true); |
2178 | if (rc) | 2179 | if (rc) |
2179 | return rc; | 2180 | return rc; |
2180 | } | 2181 | } |
@@ -2193,7 +2194,7 @@ static int get_next_command(struct fsg_common *common) | |||
2193 | 2194 | ||
2194 | /* Wait for the CBW to arrive */ | 2195 | /* Wait for the CBW to arrive */ |
2195 | while (bh->state != BUF_STATE_FULL) { | 2196 | while (bh->state != BUF_STATE_FULL) { |
2196 | rc = sleep_thread(common); | 2197 | rc = sleep_thread(common, true); |
2197 | if (rc) | 2198 | if (rc) |
2198 | return rc; | 2199 | return rc; |
2199 | } | 2200 | } |
@@ -2379,7 +2380,7 @@ static void handle_exception(struct fsg_common *common) | |||
2379 | } | 2380 | } |
2380 | if (num_active == 0) | 2381 | if (num_active == 0) |
2381 | break; | 2382 | break; |
2382 | if (sleep_thread(common)) | 2383 | if (sleep_thread(common, true)) |
2383 | return; | 2384 | return; |
2384 | } | 2385 | } |
2385 | 2386 | ||
@@ -2516,7 +2517,7 @@ static int fsg_main_thread(void *common_) | |||
2516 | } | 2517 | } |
2517 | 2518 | ||
2518 | if (!common->running) { | 2519 | if (!common->running) { |
2519 | sleep_thread(common); | 2520 | sleep_thread(common, true); |
2520 | continue; | 2521 | continue; |
2521 | } | 2522 | } |
2522 | 2523 | ||
@@ -3111,7 +3112,7 @@ static int fsg_bind(struct usb_configuration *c, struct usb_function *f) | |||
3111 | fsg->common->can_stall); | 3112 | fsg->common->can_stall); |
3112 | if (ret) | 3113 | if (ret) |
3113 | return ret; | 3114 | return ret; |
3114 | fsg_common_set_inquiry_string(fsg->common, 0, 0); | 3115 | fsg_common_set_inquiry_string(fsg->common, NULL, NULL); |
3115 | ret = fsg_common_run_thread(fsg->common); | 3116 | ret = fsg_common_run_thread(fsg->common); |
3116 | if (ret) | 3117 | if (ret) |
3117 | return ret; | 3118 | return ret; |
diff --git a/drivers/usb/gadget/pxa25x_udc.c b/drivers/usb/gadget/pxa25x_udc.c index 0ac6064aa3b8..409a3c45a36a 100644 --- a/drivers/usb/gadget/pxa25x_udc.c +++ b/drivers/usb/gadget/pxa25x_udc.c | |||
@@ -54,6 +54,7 @@ | |||
54 | */ | 54 | */ |
55 | #ifdef CONFIG_ARCH_PXA | 55 | #ifdef CONFIG_ARCH_PXA |
56 | #include <mach/pxa25x-udc.h> | 56 | #include <mach/pxa25x-udc.h> |
57 | #include <mach/hardware.h> | ||
57 | #endif | 58 | #endif |
58 | 59 | ||
59 | #ifdef CONFIG_ARCH_LUBBOCK | 60 | #ifdef CONFIG_ARCH_LUBBOCK |
diff --git a/drivers/usb/gadget/s3c-hsotg.c b/drivers/usb/gadget/s3c-hsotg.c index 9875d9c0823f..e20bc109fdd7 100644 --- a/drivers/usb/gadget/s3c-hsotg.c +++ b/drivers/usb/gadget/s3c-hsotg.c | |||
@@ -1180,6 +1180,7 @@ static int s3c_hsotg_process_req_feature(struct s3c_hsotg *hsotg, | |||
1180 | } | 1180 | } |
1181 | 1181 | ||
1182 | static void s3c_hsotg_enqueue_setup(struct s3c_hsotg *hsotg); | 1182 | static void s3c_hsotg_enqueue_setup(struct s3c_hsotg *hsotg); |
1183 | static void s3c_hsotg_disconnect(struct s3c_hsotg *hsotg); | ||
1183 | 1184 | ||
1184 | /** | 1185 | /** |
1185 | * s3c_hsotg_process_control - process a control request | 1186 | * s3c_hsotg_process_control - process a control request |
@@ -1221,6 +1222,7 @@ static void s3c_hsotg_process_control(struct s3c_hsotg *hsotg, | |||
1221 | if ((ctrl->bRequestType & USB_TYPE_MASK) == USB_TYPE_STANDARD) { | 1222 | if ((ctrl->bRequestType & USB_TYPE_MASK) == USB_TYPE_STANDARD) { |
1222 | switch (ctrl->bRequest) { | 1223 | switch (ctrl->bRequest) { |
1223 | case USB_REQ_SET_ADDRESS: | 1224 | case USB_REQ_SET_ADDRESS: |
1225 | s3c_hsotg_disconnect(hsotg); | ||
1224 | dcfg = readl(hsotg->regs + DCFG); | 1226 | dcfg = readl(hsotg->regs + DCFG); |
1225 | dcfg &= ~DCFG_DevAddr_MASK; | 1227 | dcfg &= ~DCFG_DevAddr_MASK; |
1226 | dcfg |= ctrl->wValue << DCFG_DevAddr_SHIFT; | 1228 | dcfg |= ctrl->wValue << DCFG_DevAddr_SHIFT; |
@@ -1245,7 +1247,9 @@ static void s3c_hsotg_process_control(struct s3c_hsotg *hsotg, | |||
1245 | /* as a fallback, try delivering it to the driver to deal with */ | 1247 | /* as a fallback, try delivering it to the driver to deal with */ |
1246 | 1248 | ||
1247 | if (ret == 0 && hsotg->driver) { | 1249 | if (ret == 0 && hsotg->driver) { |
1250 | spin_unlock(&hsotg->lock); | ||
1248 | ret = hsotg->driver->setup(&hsotg->gadget, ctrl); | 1251 | ret = hsotg->driver->setup(&hsotg->gadget, ctrl); |
1252 | spin_lock(&hsotg->lock); | ||
1249 | if (ret < 0) | 1253 | if (ret < 0) |
1250 | dev_dbg(hsotg->dev, "driver->setup() ret %d\n", ret); | 1254 | dev_dbg(hsotg->dev, "driver->setup() ret %d\n", ret); |
1251 | } | 1255 | } |
@@ -1308,10 +1312,12 @@ static void s3c_hsotg_complete_setup(struct usb_ep *ep, | |||
1308 | return; | 1312 | return; |
1309 | } | 1313 | } |
1310 | 1314 | ||
1315 | spin_lock(&hsotg->lock); | ||
1311 | if (req->actual == 0) | 1316 | if (req->actual == 0) |
1312 | s3c_hsotg_enqueue_setup(hsotg); | 1317 | s3c_hsotg_enqueue_setup(hsotg); |
1313 | else | 1318 | else |
1314 | s3c_hsotg_process_control(hsotg, req->buf); | 1319 | s3c_hsotg_process_control(hsotg, req->buf); |
1320 | spin_unlock(&hsotg->lock); | ||
1315 | } | 1321 | } |
1316 | 1322 | ||
1317 | /** | 1323 | /** |
@@ -2533,7 +2539,6 @@ irq_retry: | |||
2533 | writel(GINTSTS_USBSusp, hsotg->regs + GINTSTS); | 2539 | writel(GINTSTS_USBSusp, hsotg->regs + GINTSTS); |
2534 | 2540 | ||
2535 | call_gadget(hsotg, suspend); | 2541 | call_gadget(hsotg, suspend); |
2536 | s3c_hsotg_disconnect(hsotg); | ||
2537 | } | 2542 | } |
2538 | 2543 | ||
2539 | if (gintsts & GINTSTS_WkUpInt) { | 2544 | if (gintsts & GINTSTS_WkUpInt) { |
diff --git a/drivers/usb/gadget/storage_common.h b/drivers/usb/gadget/storage_common.h index c74c2fdbd56e..70c891469f57 100644 --- a/drivers/usb/gadget/storage_common.h +++ b/drivers/usb/gadget/storage_common.h | |||
@@ -119,10 +119,6 @@ static inline bool fsg_lun_is_open(struct fsg_lun *curlun) | |||
119 | return curlun->filp != NULL; | 119 | return curlun->filp != NULL; |
120 | } | 120 | } |
121 | 121 | ||
122 | /* Big enough to hold our biggest descriptor */ | ||
123 | #define EP0_BUFSIZE 256 | ||
124 | #define DELAYED_STATUS (EP0_BUFSIZE + 999) /* An impossibly large value */ | ||
125 | |||
126 | /* Default size of buffer length. */ | 122 | /* Default size of buffer length. */ |
127 | #define FSG_BUFLEN ((u32)16384) | 123 | #define FSG_BUFLEN ((u32)16384) |
128 | 124 | ||
diff --git a/drivers/usb/gadget/tcm_usb_gadget.c b/drivers/usb/gadget/tcm_usb_gadget.c index 6c3d7950d2a9..0f8aad78b54f 100644 --- a/drivers/usb/gadget/tcm_usb_gadget.c +++ b/drivers/usb/gadget/tcm_usb_gadget.c | |||
@@ -370,7 +370,7 @@ err: | |||
370 | return -ENOMEM; | 370 | return -ENOMEM; |
371 | } | 371 | } |
372 | 372 | ||
373 | void bot_cleanup_old_alt(struct f_uas *fu) | 373 | static void bot_cleanup_old_alt(struct f_uas *fu) |
374 | { | 374 | { |
375 | if (!(fu->flags & USBG_ENABLED)) | 375 | if (!(fu->flags & USBG_ENABLED)) |
376 | return; | 376 | return; |
diff --git a/drivers/usb/gadget/zero.c b/drivers/usb/gadget/zero.c index 0dd07ae1555d..f49b0b61ecc8 100644 --- a/drivers/usb/gadget/zero.c +++ b/drivers/usb/gadget/zero.c | |||
@@ -91,17 +91,17 @@ static struct usb_zero_options gzero_options = { | |||
91 | * functional coverage for the "USBCV" test harness from USB-IF. | 91 | * functional coverage for the "USBCV" test harness from USB-IF. |
92 | * It's always set if OTG mode is enabled. | 92 | * It's always set if OTG mode is enabled. |
93 | */ | 93 | */ |
94 | unsigned autoresume = DEFAULT_AUTORESUME; | 94 | static unsigned autoresume = DEFAULT_AUTORESUME; |
95 | module_param(autoresume, uint, S_IRUGO); | 95 | module_param(autoresume, uint, S_IRUGO); |
96 | MODULE_PARM_DESC(autoresume, "zero, or seconds before remote wakeup"); | 96 | MODULE_PARM_DESC(autoresume, "zero, or seconds before remote wakeup"); |
97 | 97 | ||
98 | /* Maximum Autoresume time */ | 98 | /* Maximum Autoresume time */ |
99 | unsigned max_autoresume; | 99 | static unsigned max_autoresume; |
100 | module_param(max_autoresume, uint, S_IRUGO); | 100 | module_param(max_autoresume, uint, S_IRUGO); |
101 | MODULE_PARM_DESC(max_autoresume, "maximum seconds before remote wakeup"); | 101 | MODULE_PARM_DESC(max_autoresume, "maximum seconds before remote wakeup"); |
102 | 102 | ||
103 | /* Interval between two remote wakeups */ | 103 | /* Interval between two remote wakeups */ |
104 | unsigned autoresume_interval_ms; | 104 | static unsigned autoresume_interval_ms; |
105 | module_param(autoresume_interval_ms, uint, S_IRUGO); | 105 | module_param(autoresume_interval_ms, uint, S_IRUGO); |
106 | MODULE_PARM_DESC(autoresume_interval_ms, | 106 | MODULE_PARM_DESC(autoresume_interval_ms, |
107 | "milliseconds to increase successive wakeup delays"); | 107 | "milliseconds to increase successive wakeup delays"); |
diff --git a/drivers/usb/host/ohci-pxa27x.c b/drivers/usb/host/ohci-pxa27x.c index e89ac4d4b87e..9b7435f0dcd6 100644 --- a/drivers/usb/host/ohci-pxa27x.c +++ b/drivers/usb/host/ohci-pxa27x.c | |||
@@ -21,6 +21,7 @@ | |||
21 | 21 | ||
22 | #include <linux/clk.h> | 22 | #include <linux/clk.h> |
23 | #include <linux/device.h> | 23 | #include <linux/device.h> |
24 | #include <linux/dma-mapping.h> | ||
24 | #include <linux/io.h> | 25 | #include <linux/io.h> |
25 | #include <linux/kernel.h> | 26 | #include <linux/kernel.h> |
26 | #include <linux/module.h> | 27 | #include <linux/module.h> |
diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c index 1e2f3f495843..53c2e296467f 100644 --- a/drivers/usb/host/xhci-ring.c +++ b/drivers/usb/host/xhci-ring.c | |||
@@ -2973,8 +2973,58 @@ static int prepare_ring(struct xhci_hcd *xhci, struct xhci_ring *ep_ring, | |||
2973 | } | 2973 | } |
2974 | 2974 | ||
2975 | while (1) { | 2975 | while (1) { |
2976 | if (room_on_ring(xhci, ep_ring, num_trbs)) | 2976 | if (room_on_ring(xhci, ep_ring, num_trbs)) { |
2977 | break; | 2977 | union xhci_trb *trb = ep_ring->enqueue; |
2978 | unsigned int usable = ep_ring->enq_seg->trbs + | ||
2979 | TRBS_PER_SEGMENT - 1 - trb; | ||
2980 | u32 nop_cmd; | ||
2981 | |||
2982 | /* | ||
2983 | * Section 4.11.7.1 TD Fragments states that a link | ||
2984 | * TRB must only occur at the boundary between | ||
2985 | * data bursts (eg 512 bytes for 480M). | ||
2986 | * While it is possible to split a large fragment | ||
2987 | * we don't know the size yet. | ||
2988 | * Simplest solution is to fill the trb before the | ||
2989 | * LINK with nop commands. | ||
2990 | */ | ||
2991 | if (num_trbs == 1 || num_trbs <= usable || usable == 0) | ||
2992 | break; | ||
2993 | |||
2994 | if (ep_ring->type != TYPE_BULK) | ||
2995 | /* | ||
2996 | * While isoc transfers might have a buffer that | ||
2997 | * crosses a 64k boundary it is unlikely. | ||
2998 | * Since we can't add NOPs without generating | ||
2999 | * gaps in the traffic just hope it never | ||
3000 | * happens at the end of the ring. | ||
3001 | * This could be fixed by writing a LINK TRB | ||
3002 | * instead of the first NOP - however the | ||
3003 | * TRB_TYPE_LINK_LE32() calls would all need | ||
3004 | * changing to check the ring length. | ||
3005 | */ | ||
3006 | break; | ||
3007 | |||
3008 | if (num_trbs >= TRBS_PER_SEGMENT) { | ||
3009 | xhci_err(xhci, "Too many fragments %d, max %d\n", | ||
3010 | num_trbs, TRBS_PER_SEGMENT - 1); | ||
3011 | return -ENOMEM; | ||
3012 | } | ||
3013 | |||
3014 | nop_cmd = cpu_to_le32(TRB_TYPE(TRB_TR_NOOP) | | ||
3015 | ep_ring->cycle_state); | ||
3016 | ep_ring->num_trbs_free -= usable; | ||
3017 | do { | ||
3018 | trb->generic.field[0] = 0; | ||
3019 | trb->generic.field[1] = 0; | ||
3020 | trb->generic.field[2] = 0; | ||
3021 | trb->generic.field[3] = nop_cmd; | ||
3022 | trb++; | ||
3023 | } while (--usable); | ||
3024 | ep_ring->enqueue = trb; | ||
3025 | if (room_on_ring(xhci, ep_ring, num_trbs)) | ||
3026 | break; | ||
3027 | } | ||
2978 | 3028 | ||
2979 | if (ep_ring == xhci->cmd_ring) { | 3029 | if (ep_ring == xhci->cmd_ring) { |
2980 | xhci_err(xhci, "Do not support expand command ring\n"); | 3030 | xhci_err(xhci, "Do not support expand command ring\n"); |
diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c index 0a43329569d1..4d4499b80449 100644 --- a/drivers/usb/musb/musb_core.c +++ b/drivers/usb/musb/musb_core.c | |||
@@ -1809,7 +1809,6 @@ static void musb_free(struct musb *musb) | |||
1809 | disable_irq_wake(musb->nIrq); | 1809 | disable_irq_wake(musb->nIrq); |
1810 | free_irq(musb->nIrq, musb); | 1810 | free_irq(musb->nIrq, musb); |
1811 | } | 1811 | } |
1812 | cancel_work_sync(&musb->irq_work); | ||
1813 | 1812 | ||
1814 | musb_host_free(musb); | 1813 | musb_host_free(musb); |
1815 | } | 1814 | } |
@@ -1896,6 +1895,9 @@ musb_init_controller(struct device *dev, int nIrq, void __iomem *ctrl) | |||
1896 | musb_platform_disable(musb); | 1895 | musb_platform_disable(musb); |
1897 | musb_generic_disable(musb); | 1896 | musb_generic_disable(musb); |
1898 | 1897 | ||
1898 | /* Init IRQ workqueue before request_irq */ | ||
1899 | INIT_WORK(&musb->irq_work, musb_irq_work); | ||
1900 | |||
1899 | /* setup musb parts of the core (especially endpoints) */ | 1901 | /* setup musb parts of the core (especially endpoints) */ |
1900 | status = musb_core_init(plat->config->multipoint | 1902 | status = musb_core_init(plat->config->multipoint |
1901 | ? MUSB_CONTROLLER_MHDRC | 1903 | ? MUSB_CONTROLLER_MHDRC |
@@ -1905,9 +1907,6 @@ musb_init_controller(struct device *dev, int nIrq, void __iomem *ctrl) | |||
1905 | 1907 | ||
1906 | setup_timer(&musb->otg_timer, musb_otg_timer_func, (unsigned long) musb); | 1908 | setup_timer(&musb->otg_timer, musb_otg_timer_func, (unsigned long) musb); |
1907 | 1909 | ||
1908 | /* Init IRQ workqueue before request_irq */ | ||
1909 | INIT_WORK(&musb->irq_work, musb_irq_work); | ||
1910 | |||
1911 | /* attach to the IRQ */ | 1910 | /* attach to the IRQ */ |
1912 | if (request_irq(nIrq, musb->isr, 0, dev_name(dev), musb)) { | 1911 | if (request_irq(nIrq, musb->isr, 0, dev_name(dev), musb)) { |
1913 | dev_err(dev, "request_irq %d failed!\n", nIrq); | 1912 | dev_err(dev, "request_irq %d failed!\n", nIrq); |
@@ -1981,6 +1980,7 @@ fail4: | |||
1981 | musb_host_cleanup(musb); | 1980 | musb_host_cleanup(musb); |
1982 | 1981 | ||
1983 | fail3: | 1982 | fail3: |
1983 | cancel_work_sync(&musb->irq_work); | ||
1984 | if (musb->dma_controller) | 1984 | if (musb->dma_controller) |
1985 | dma_controller_destroy(musb->dma_controller); | 1985 | dma_controller_destroy(musb->dma_controller); |
1986 | fail2_5: | 1986 | fail2_5: |
@@ -2043,6 +2043,7 @@ static int musb_remove(struct platform_device *pdev) | |||
2043 | if (musb->dma_controller) | 2043 | if (musb->dma_controller) |
2044 | dma_controller_destroy(musb->dma_controller); | 2044 | dma_controller_destroy(musb->dma_controller); |
2045 | 2045 | ||
2046 | cancel_work_sync(&musb->irq_work); | ||
2046 | musb_free(musb); | 2047 | musb_free(musb); |
2047 | device_init_wakeup(dev, 0); | 2048 | device_init_wakeup(dev, 0); |
2048 | return 0; | 2049 | return 0; |
diff --git a/drivers/usb/musb/musb_cppi41.c b/drivers/usb/musb/musb_cppi41.c index ff9d6de2b746..a12bd30401e0 100644 --- a/drivers/usb/musb/musb_cppi41.c +++ b/drivers/usb/musb/musb_cppi41.c | |||
@@ -38,6 +38,7 @@ struct cppi41_dma_channel { | |||
38 | u32 prog_len; | 38 | u32 prog_len; |
39 | u32 transferred; | 39 | u32 transferred; |
40 | u32 packet_sz; | 40 | u32 packet_sz; |
41 | struct list_head tx_check; | ||
41 | }; | 42 | }; |
42 | 43 | ||
43 | #define MUSB_DMA_NUM_CHANNELS 15 | 44 | #define MUSB_DMA_NUM_CHANNELS 15 |
@@ -47,6 +48,8 @@ struct cppi41_dma_controller { | |||
47 | struct cppi41_dma_channel rx_channel[MUSB_DMA_NUM_CHANNELS]; | 48 | struct cppi41_dma_channel rx_channel[MUSB_DMA_NUM_CHANNELS]; |
48 | struct cppi41_dma_channel tx_channel[MUSB_DMA_NUM_CHANNELS]; | 49 | struct cppi41_dma_channel tx_channel[MUSB_DMA_NUM_CHANNELS]; |
49 | struct musb *musb; | 50 | struct musb *musb; |
51 | struct hrtimer early_tx; | ||
52 | struct list_head early_tx_list; | ||
50 | u32 rx_mode; | 53 | u32 rx_mode; |
51 | u32 tx_mode; | 54 | u32 tx_mode; |
52 | u32 auto_req; | 55 | u32 auto_req; |
@@ -96,31 +99,27 @@ static void update_rx_toggle(struct cppi41_dma_channel *cppi41_channel) | |||
96 | cppi41_channel->usb_toggle = toggle; | 99 | cppi41_channel->usb_toggle = toggle; |
97 | } | 100 | } |
98 | 101 | ||
99 | static void cppi41_dma_callback(void *private_data) | 102 | static bool musb_is_tx_fifo_empty(struct musb_hw_ep *hw_ep) |
100 | { | 103 | { |
101 | struct dma_channel *channel = private_data; | 104 | u8 epnum = hw_ep->epnum; |
102 | struct cppi41_dma_channel *cppi41_channel = channel->private_data; | 105 | struct musb *musb = hw_ep->musb; |
103 | struct musb_hw_ep *hw_ep = cppi41_channel->hw_ep; | 106 | void __iomem *epio = musb->endpoints[epnum].regs; |
104 | struct musb *musb = hw_ep->musb; | 107 | u16 csr; |
105 | unsigned long flags; | ||
106 | struct dma_tx_state txstate; | ||
107 | u32 transferred; | ||
108 | 108 | ||
109 | spin_lock_irqsave(&musb->lock, flags); | 109 | csr = musb_readw(epio, MUSB_TXCSR); |
110 | if (csr & MUSB_TXCSR_TXPKTRDY) | ||
111 | return false; | ||
112 | return true; | ||
113 | } | ||
110 | 114 | ||
111 | dmaengine_tx_status(cppi41_channel->dc, cppi41_channel->cookie, | 115 | static void cppi41_dma_callback(void *private_data); |
112 | &txstate); | ||
113 | transferred = cppi41_channel->prog_len - txstate.residue; | ||
114 | cppi41_channel->transferred += transferred; | ||
115 | 116 | ||
116 | dev_dbg(musb->controller, "DMA transfer done on hw_ep=%d bytes=%d/%d\n", | 117 | static void cppi41_trans_done(struct cppi41_dma_channel *cppi41_channel) |
117 | hw_ep->epnum, cppi41_channel->transferred, | 118 | { |
118 | cppi41_channel->total_len); | 119 | struct musb_hw_ep *hw_ep = cppi41_channel->hw_ep; |
120 | struct musb *musb = hw_ep->musb; | ||
119 | 121 | ||
120 | update_rx_toggle(cppi41_channel); | 122 | if (!cppi41_channel->prog_len) { |
121 | |||
122 | if (cppi41_channel->transferred == cppi41_channel->total_len || | ||
123 | transferred < cppi41_channel->packet_sz) { | ||
124 | 123 | ||
125 | /* done, complete */ | 124 | /* done, complete */ |
126 | cppi41_channel->channel.actual_len = | 125 | cppi41_channel->channel.actual_len = |
@@ -150,13 +149,11 @@ static void cppi41_dma_callback(void *private_data) | |||
150 | remain_bytes, | 149 | remain_bytes, |
151 | direction, | 150 | direction, |
152 | DMA_PREP_INTERRUPT | DMA_CTRL_ACK); | 151 | DMA_PREP_INTERRUPT | DMA_CTRL_ACK); |
153 | if (WARN_ON(!dma_desc)) { | 152 | if (WARN_ON(!dma_desc)) |
154 | spin_unlock_irqrestore(&musb->lock, flags); | ||
155 | return; | 153 | return; |
156 | } | ||
157 | 154 | ||
158 | dma_desc->callback = cppi41_dma_callback; | 155 | dma_desc->callback = cppi41_dma_callback; |
159 | dma_desc->callback_param = channel; | 156 | dma_desc->callback_param = &cppi41_channel->channel; |
160 | cppi41_channel->cookie = dma_desc->tx_submit(dma_desc); | 157 | cppi41_channel->cookie = dma_desc->tx_submit(dma_desc); |
161 | dma_async_issue_pending(dc); | 158 | dma_async_issue_pending(dc); |
162 | 159 | ||
@@ -166,6 +163,117 @@ static void cppi41_dma_callback(void *private_data) | |||
166 | musb_writew(epio, MUSB_RXCSR, csr); | 163 | musb_writew(epio, MUSB_RXCSR, csr); |
167 | } | 164 | } |
168 | } | 165 | } |
166 | } | ||
167 | |||
168 | static enum hrtimer_restart cppi41_recheck_tx_req(struct hrtimer *timer) | ||
169 | { | ||
170 | struct cppi41_dma_controller *controller; | ||
171 | struct cppi41_dma_channel *cppi41_channel, *n; | ||
172 | struct musb *musb; | ||
173 | unsigned long flags; | ||
174 | enum hrtimer_restart ret = HRTIMER_NORESTART; | ||
175 | |||
176 | controller = container_of(timer, struct cppi41_dma_controller, | ||
177 | early_tx); | ||
178 | musb = controller->musb; | ||
179 | |||
180 | spin_lock_irqsave(&musb->lock, flags); | ||
181 | list_for_each_entry_safe(cppi41_channel, n, &controller->early_tx_list, | ||
182 | tx_check) { | ||
183 | bool empty; | ||
184 | struct musb_hw_ep *hw_ep = cppi41_channel->hw_ep; | ||
185 | |||
186 | empty = musb_is_tx_fifo_empty(hw_ep); | ||
187 | if (empty) { | ||
188 | list_del_init(&cppi41_channel->tx_check); | ||
189 | cppi41_trans_done(cppi41_channel); | ||
190 | } | ||
191 | } | ||
192 | |||
193 | if (!list_empty(&controller->early_tx_list)) { | ||
194 | ret = HRTIMER_RESTART; | ||
195 | hrtimer_forward_now(&controller->early_tx, | ||
196 | ktime_set(0, 150 * NSEC_PER_USEC)); | ||
197 | } | ||
198 | |||
199 | spin_unlock_irqrestore(&musb->lock, flags); | ||
200 | return ret; | ||
201 | } | ||
202 | |||
203 | static void cppi41_dma_callback(void *private_data) | ||
204 | { | ||
205 | struct dma_channel *channel = private_data; | ||
206 | struct cppi41_dma_channel *cppi41_channel = channel->private_data; | ||
207 | struct musb_hw_ep *hw_ep = cppi41_channel->hw_ep; | ||
208 | struct musb *musb = hw_ep->musb; | ||
209 | unsigned long flags; | ||
210 | struct dma_tx_state txstate; | ||
211 | u32 transferred; | ||
212 | bool empty; | ||
213 | |||
214 | spin_lock_irqsave(&musb->lock, flags); | ||
215 | |||
216 | dmaengine_tx_status(cppi41_channel->dc, cppi41_channel->cookie, | ||
217 | &txstate); | ||
218 | transferred = cppi41_channel->prog_len - txstate.residue; | ||
219 | cppi41_channel->transferred += transferred; | ||
220 | |||
221 | dev_dbg(musb->controller, "DMA transfer done on hw_ep=%d bytes=%d/%d\n", | ||
222 | hw_ep->epnum, cppi41_channel->transferred, | ||
223 | cppi41_channel->total_len); | ||
224 | |||
225 | update_rx_toggle(cppi41_channel); | ||
226 | |||
227 | if (cppi41_channel->transferred == cppi41_channel->total_len || | ||
228 | transferred < cppi41_channel->packet_sz) | ||
229 | cppi41_channel->prog_len = 0; | ||
230 | |||
231 | empty = musb_is_tx_fifo_empty(hw_ep); | ||
232 | if (empty) { | ||
233 | cppi41_trans_done(cppi41_channel); | ||
234 | } else { | ||
235 | struct cppi41_dma_controller *controller; | ||
236 | /* | ||
237 | * On AM335x it has been observed that the TX interrupt fires | ||
238 | * too early that means the TXFIFO is not yet empty but the DMA | ||
239 | * engine says that it is done with the transfer. We don't | ||
240 | * receive a FIFO empty interrupt so the only thing we can do is | ||
241 | * to poll for the bit. On HS it usually takes 2us, on FS around | ||
242 | * 110us - 150us depending on the transfer size. | ||
243 | * We spin on HS (no longer than than 25us and setup a timer on | ||
244 | * FS to check for the bit and complete the transfer. | ||
245 | */ | ||
246 | controller = cppi41_channel->controller; | ||
247 | |||
248 | if (musb->g.speed == USB_SPEED_HIGH) { | ||
249 | unsigned wait = 25; | ||
250 | |||
251 | do { | ||
252 | empty = musb_is_tx_fifo_empty(hw_ep); | ||
253 | if (empty) | ||
254 | break; | ||
255 | wait--; | ||
256 | if (!wait) | ||
257 | break; | ||
258 | udelay(1); | ||
259 | } while (1); | ||
260 | |||
261 | empty = musb_is_tx_fifo_empty(hw_ep); | ||
262 | if (empty) { | ||
263 | cppi41_trans_done(cppi41_channel); | ||
264 | goto out; | ||
265 | } | ||
266 | } | ||
267 | list_add_tail(&cppi41_channel->tx_check, | ||
268 | &controller->early_tx_list); | ||
269 | if (!hrtimer_active(&controller->early_tx)) { | ||
270 | hrtimer_start_range_ns(&controller->early_tx, | ||
271 | ktime_set(0, 140 * NSEC_PER_USEC), | ||
272 | 40 * NSEC_PER_USEC, | ||
273 | HRTIMER_MODE_REL); | ||
274 | } | ||
275 | } | ||
276 | out: | ||
169 | spin_unlock_irqrestore(&musb->lock, flags); | 277 | spin_unlock_irqrestore(&musb->lock, flags); |
170 | } | 278 | } |
171 | 279 | ||
@@ -364,6 +472,8 @@ static int cppi41_is_compatible(struct dma_channel *channel, u16 maxpacket, | |||
364 | WARN_ON(1); | 472 | WARN_ON(1); |
365 | return 1; | 473 | return 1; |
366 | } | 474 | } |
475 | if (cppi41_channel->hw_ep->ep_in.type != USB_ENDPOINT_XFER_BULK) | ||
476 | return 0; | ||
367 | if (cppi41_channel->is_tx) | 477 | if (cppi41_channel->is_tx) |
368 | return 1; | 478 | return 1; |
369 | /* AM335x Advisory 1.0.13. No workaround for device RX mode */ | 479 | /* AM335x Advisory 1.0.13. No workaround for device RX mode */ |
@@ -388,6 +498,7 @@ static int cppi41_dma_channel_abort(struct dma_channel *channel) | |||
388 | if (cppi41_channel->channel.status == MUSB_DMA_STATUS_FREE) | 498 | if (cppi41_channel->channel.status == MUSB_DMA_STATUS_FREE) |
389 | return 0; | 499 | return 0; |
390 | 500 | ||
501 | list_del_init(&cppi41_channel->tx_check); | ||
391 | if (is_tx) { | 502 | if (is_tx) { |
392 | csr = musb_readw(epio, MUSB_TXCSR); | 503 | csr = musb_readw(epio, MUSB_TXCSR); |
393 | csr &= ~MUSB_TXCSR_DMAENAB; | 504 | csr &= ~MUSB_TXCSR_DMAENAB; |
@@ -495,6 +606,7 @@ static int cppi41_dma_controller_start(struct cppi41_dma_controller *controller) | |||
495 | cppi41_channel->controller = controller; | 606 | cppi41_channel->controller = controller; |
496 | cppi41_channel->port_num = port; | 607 | cppi41_channel->port_num = port; |
497 | cppi41_channel->is_tx = is_tx; | 608 | cppi41_channel->is_tx = is_tx; |
609 | INIT_LIST_HEAD(&cppi41_channel->tx_check); | ||
498 | 610 | ||
499 | musb_dma = &cppi41_channel->channel; | 611 | musb_dma = &cppi41_channel->channel; |
500 | musb_dma->private_data = cppi41_channel; | 612 | musb_dma->private_data = cppi41_channel; |
@@ -520,6 +632,7 @@ void dma_controller_destroy(struct dma_controller *c) | |||
520 | struct cppi41_dma_controller *controller = container_of(c, | 632 | struct cppi41_dma_controller *controller = container_of(c, |
521 | struct cppi41_dma_controller, controller); | 633 | struct cppi41_dma_controller, controller); |
522 | 634 | ||
635 | hrtimer_cancel(&controller->early_tx); | ||
523 | cppi41_dma_controller_stop(controller); | 636 | cppi41_dma_controller_stop(controller); |
524 | kfree(controller); | 637 | kfree(controller); |
525 | } | 638 | } |
@@ -539,6 +652,9 @@ struct dma_controller *dma_controller_create(struct musb *musb, | |||
539 | if (!controller) | 652 | if (!controller) |
540 | goto kzalloc_fail; | 653 | goto kzalloc_fail; |
541 | 654 | ||
655 | hrtimer_init(&controller->early_tx, CLOCK_MONOTONIC, HRTIMER_MODE_REL); | ||
656 | controller->early_tx.function = cppi41_recheck_tx_req; | ||
657 | INIT_LIST_HEAD(&controller->early_tx_list); | ||
542 | controller->musb = musb; | 658 | controller->musb = musb; |
543 | 659 | ||
544 | controller->controller.channel_alloc = cppi41_dma_channel_allocate; | 660 | controller->controller.channel_alloc = cppi41_dma_channel_allocate; |
diff --git a/drivers/usb/musb/musb_gadget.c b/drivers/usb/musb/musb_gadget.c index d2d3a173b315..32fb057c03f5 100644 --- a/drivers/usb/musb/musb_gadget.c +++ b/drivers/usb/musb/musb_gadget.c | |||
@@ -1796,7 +1796,11 @@ int musb_gadget_setup(struct musb *musb) | |||
1796 | 1796 | ||
1797 | /* this "gadget" abstracts/virtualizes the controller */ | 1797 | /* this "gadget" abstracts/virtualizes the controller */ |
1798 | musb->g.name = musb_driver_name; | 1798 | musb->g.name = musb_driver_name; |
1799 | #if IS_ENABLED(CONFIG_USB_MUSB_DUAL_ROLE) | ||
1799 | musb->g.is_otg = 1; | 1800 | musb->g.is_otg = 1; |
1801 | #elif IS_ENABLED(CONFIG_USB_MUSB_GADGET) | ||
1802 | musb->g.is_otg = 0; | ||
1803 | #endif | ||
1800 | 1804 | ||
1801 | musb_g_init_endpoints(musb); | 1805 | musb_g_init_endpoints(musb); |
1802 | 1806 | ||
diff --git a/drivers/usb/phy/phy-am335x.c b/drivers/usb/phy/phy-am335x.c index 6370e50649d7..0e3c60cb669a 100644 --- a/drivers/usb/phy/phy-am335x.c +++ b/drivers/usb/phy/phy-am335x.c | |||
@@ -52,8 +52,7 @@ static int am335x_phy_probe(struct platform_device *pdev) | |||
52 | return am_phy->id; | 52 | return am_phy->id; |
53 | } | 53 | } |
54 | 54 | ||
55 | ret = usb_phy_gen_create_phy(dev, &am_phy->usb_phy_gen, | 55 | ret = usb_phy_gen_create_phy(dev, &am_phy->usb_phy_gen, NULL); |
56 | USB_PHY_TYPE_USB2, 0, false); | ||
57 | if (ret) | 56 | if (ret) |
58 | return ret; | 57 | return ret; |
59 | 58 | ||
@@ -66,8 +65,6 @@ static int am335x_phy_probe(struct platform_device *pdev) | |||
66 | platform_set_drvdata(pdev, am_phy); | 65 | platform_set_drvdata(pdev, am_phy); |
67 | 66 | ||
68 | return 0; | 67 | return 0; |
69 | |||
70 | return ret; | ||
71 | } | 68 | } |
72 | 69 | ||
73 | static int am335x_phy_remove(struct platform_device *pdev) | 70 | static int am335x_phy_remove(struct platform_device *pdev) |
diff --git a/drivers/usb/phy/phy-generic.c b/drivers/usb/phy/phy-generic.c index fce3a9e9bb5d..aa6d37b3378a 100644 --- a/drivers/usb/phy/phy-generic.c +++ b/drivers/usb/phy/phy-generic.c | |||
@@ -48,8 +48,9 @@ void usb_nop_xceiv_register(void) | |||
48 | if (pd) | 48 | if (pd) |
49 | return; | 49 | return; |
50 | pd = platform_device_register_simple("usb_phy_gen_xceiv", -1, NULL, 0); | 50 | pd = platform_device_register_simple("usb_phy_gen_xceiv", -1, NULL, 0); |
51 | if (!pd) { | 51 | if (IS_ERR(pd)) { |
52 | pr_err("Unable to register generic usb transceiver\n"); | 52 | pr_err("Unable to register generic usb transceiver\n"); |
53 | pd = NULL; | ||
53 | return; | 54 | return; |
54 | } | 55 | } |
55 | } | 56 | } |
@@ -150,10 +151,40 @@ static int nop_set_host(struct usb_otg *otg, struct usb_bus *host) | |||
150 | } | 151 | } |
151 | 152 | ||
152 | int usb_phy_gen_create_phy(struct device *dev, struct usb_phy_gen_xceiv *nop, | 153 | int usb_phy_gen_create_phy(struct device *dev, struct usb_phy_gen_xceiv *nop, |
153 | enum usb_phy_type type, u32 clk_rate, bool needs_vcc) | 154 | struct usb_phy_gen_xceiv_platform_data *pdata) |
154 | { | 155 | { |
156 | enum usb_phy_type type = USB_PHY_TYPE_USB2; | ||
155 | int err; | 157 | int err; |
156 | 158 | ||
159 | u32 clk_rate = 0; | ||
160 | bool needs_vcc = false; | ||
161 | |||
162 | nop->reset_active_low = true; /* default behaviour */ | ||
163 | |||
164 | if (dev->of_node) { | ||
165 | struct device_node *node = dev->of_node; | ||
166 | enum of_gpio_flags flags = 0; | ||
167 | |||
168 | if (of_property_read_u32(node, "clock-frequency", &clk_rate)) | ||
169 | clk_rate = 0; | ||
170 | |||
171 | needs_vcc = of_property_read_bool(node, "vcc-supply"); | ||
172 | nop->gpio_reset = of_get_named_gpio_flags(node, "reset-gpios", | ||
173 | 0, &flags); | ||
174 | if (nop->gpio_reset == -EPROBE_DEFER) | ||
175 | return -EPROBE_DEFER; | ||
176 | |||
177 | nop->reset_active_low = flags & OF_GPIO_ACTIVE_LOW; | ||
178 | |||
179 | } else if (pdata) { | ||
180 | type = pdata->type; | ||
181 | clk_rate = pdata->clk_rate; | ||
182 | needs_vcc = pdata->needs_vcc; | ||
183 | nop->gpio_reset = pdata->gpio_reset; | ||
184 | } else { | ||
185 | nop->gpio_reset = -1; | ||
186 | } | ||
187 | |||
157 | nop->phy.otg = devm_kzalloc(dev, sizeof(*nop->phy.otg), | 188 | nop->phy.otg = devm_kzalloc(dev, sizeof(*nop->phy.otg), |
158 | GFP_KERNEL); | 189 | GFP_KERNEL); |
159 | if (!nop->phy.otg) | 190 | if (!nop->phy.otg) |
@@ -218,43 +249,14 @@ EXPORT_SYMBOL_GPL(usb_phy_gen_create_phy); | |||
218 | static int usb_phy_gen_xceiv_probe(struct platform_device *pdev) | 249 | static int usb_phy_gen_xceiv_probe(struct platform_device *pdev) |
219 | { | 250 | { |
220 | struct device *dev = &pdev->dev; | 251 | struct device *dev = &pdev->dev; |
221 | struct usb_phy_gen_xceiv_platform_data *pdata = | ||
222 | dev_get_platdata(&pdev->dev); | ||
223 | struct usb_phy_gen_xceiv *nop; | 252 | struct usb_phy_gen_xceiv *nop; |
224 | enum usb_phy_type type = USB_PHY_TYPE_USB2; | ||
225 | int err; | 253 | int err; |
226 | u32 clk_rate = 0; | ||
227 | bool needs_vcc = false; | ||
228 | 254 | ||
229 | nop = devm_kzalloc(dev, sizeof(*nop), GFP_KERNEL); | 255 | nop = devm_kzalloc(dev, sizeof(*nop), GFP_KERNEL); |
230 | if (!nop) | 256 | if (!nop) |
231 | return -ENOMEM; | 257 | return -ENOMEM; |
232 | 258 | ||
233 | nop->reset_active_low = true; /* default behaviour */ | 259 | err = usb_phy_gen_create_phy(dev, nop, dev_get_platdata(&pdev->dev)); |
234 | |||
235 | if (dev->of_node) { | ||
236 | struct device_node *node = dev->of_node; | ||
237 | enum of_gpio_flags flags; | ||
238 | |||
239 | if (of_property_read_u32(node, "clock-frequency", &clk_rate)) | ||
240 | clk_rate = 0; | ||
241 | |||
242 | needs_vcc = of_property_read_bool(node, "vcc-supply"); | ||
243 | nop->gpio_reset = of_get_named_gpio_flags(node, "reset-gpios", | ||
244 | 0, &flags); | ||
245 | if (nop->gpio_reset == -EPROBE_DEFER) | ||
246 | return -EPROBE_DEFER; | ||
247 | |||
248 | nop->reset_active_low = flags & OF_GPIO_ACTIVE_LOW; | ||
249 | |||
250 | } else if (pdata) { | ||
251 | type = pdata->type; | ||
252 | clk_rate = pdata->clk_rate; | ||
253 | needs_vcc = pdata->needs_vcc; | ||
254 | nop->gpio_reset = pdata->gpio_reset; | ||
255 | } | ||
256 | |||
257 | err = usb_phy_gen_create_phy(dev, nop, type, clk_rate, needs_vcc); | ||
258 | if (err) | 260 | if (err) |
259 | return err; | 261 | return err; |
260 | 262 | ||
@@ -271,8 +273,6 @@ static int usb_phy_gen_xceiv_probe(struct platform_device *pdev) | |||
271 | platform_set_drvdata(pdev, nop); | 273 | platform_set_drvdata(pdev, nop); |
272 | 274 | ||
273 | return 0; | 275 | return 0; |
274 | |||
275 | return err; | ||
276 | } | 276 | } |
277 | 277 | ||
278 | static int usb_phy_gen_xceiv_remove(struct platform_device *pdev) | 278 | static int usb_phy_gen_xceiv_remove(struct platform_device *pdev) |
diff --git a/drivers/usb/phy/phy-generic.h b/drivers/usb/phy/phy-generic.h index d2a220d81734..38a81f307b82 100644 --- a/drivers/usb/phy/phy-generic.h +++ b/drivers/usb/phy/phy-generic.h | |||
@@ -1,6 +1,8 @@ | |||
1 | #ifndef _PHY_GENERIC_H_ | 1 | #ifndef _PHY_GENERIC_H_ |
2 | #define _PHY_GENERIC_H_ | 2 | #define _PHY_GENERIC_H_ |
3 | 3 | ||
4 | #include <linux/usb/usb_phy_gen_xceiv.h> | ||
5 | |||
4 | struct usb_phy_gen_xceiv { | 6 | struct usb_phy_gen_xceiv { |
5 | struct usb_phy phy; | 7 | struct usb_phy phy; |
6 | struct device *dev; | 8 | struct device *dev; |
@@ -14,6 +16,6 @@ int usb_gen_phy_init(struct usb_phy *phy); | |||
14 | void usb_gen_phy_shutdown(struct usb_phy *phy); | 16 | void usb_gen_phy_shutdown(struct usb_phy *phy); |
15 | 17 | ||
16 | int usb_phy_gen_create_phy(struct device *dev, struct usb_phy_gen_xceiv *nop, | 18 | int usb_phy_gen_create_phy(struct device *dev, struct usb_phy_gen_xceiv *nop, |
17 | enum usb_phy_type type, u32 clk_rate, bool needs_vcc); | 19 | struct usb_phy_gen_xceiv_platform_data *pdata); |
18 | 20 | ||
19 | #endif | 21 | #endif |
diff --git a/drivers/usb/phy/phy-mxs-usb.c b/drivers/usb/phy/phy-mxs-usb.c index fdd33b44dbd3..545844b7e796 100644 --- a/drivers/usb/phy/phy-mxs-usb.c +++ b/drivers/usb/phy/phy-mxs-usb.c | |||
@@ -164,7 +164,7 @@ static int mxs_phy_probe(struct platform_device *pdev) | |||
164 | 164 | ||
165 | mxs_phy->clk = clk; | 165 | mxs_phy->clk = clk; |
166 | 166 | ||
167 | platform_set_drvdata(pdev, &mxs_phy->phy); | 167 | platform_set_drvdata(pdev, mxs_phy); |
168 | 168 | ||
169 | ret = usb_add_phy_dev(&mxs_phy->phy); | 169 | ret = usb_add_phy_dev(&mxs_phy->phy); |
170 | if (ret) | 170 | if (ret) |
diff --git a/drivers/usb/phy/phy-rcar-gen2-usb.c b/drivers/usb/phy/phy-rcar-gen2-usb.c index a99a6953f11c..db3ab34cddb4 100644 --- a/drivers/usb/phy/phy-rcar-gen2-usb.c +++ b/drivers/usb/phy/phy-rcar-gen2-usb.c | |||
@@ -107,10 +107,10 @@ static void __rcar_gen2_usb_phy_init(struct rcar_gen2_usb_phy_priv *priv) | |||
107 | clk_prepare_enable(priv->clk); | 107 | clk_prepare_enable(priv->clk); |
108 | 108 | ||
109 | /* Set USB channels in the USBHS UGCTRL2 register */ | 109 | /* Set USB channels in the USBHS UGCTRL2 register */ |
110 | val = ioread32(priv->base); | 110 | val = ioread32(priv->base + USBHS_UGCTRL2_REG); |
111 | val &= ~(USBHS_UGCTRL2_USB0_HS | USBHS_UGCTRL2_USB2_SS); | 111 | val &= ~(USBHS_UGCTRL2_USB0_HS | USBHS_UGCTRL2_USB2_SS); |
112 | val |= priv->ugctrl2; | 112 | val |= priv->ugctrl2; |
113 | iowrite32(val, priv->base); | 113 | iowrite32(val, priv->base + USBHS_UGCTRL2_REG); |
114 | } | 114 | } |
115 | 115 | ||
116 | /* Shutdown USB channels */ | 116 | /* Shutdown USB channels */ |
diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c index 9ced8937a8f3..fb0d537435eb 100644 --- a/drivers/usb/serial/ftdi_sio.c +++ b/drivers/usb/serial/ftdi_sio.c | |||
@@ -2123,6 +2123,20 @@ static void ftdi_set_termios(struct tty_struct *tty, | |||
2123 | termios->c_cflag |= CRTSCTS; | 2123 | termios->c_cflag |= CRTSCTS; |
2124 | } | 2124 | } |
2125 | 2125 | ||
2126 | /* | ||
2127 | * All FTDI UART chips are limited to CS7/8. We won't pretend to | ||
2128 | * support CS5/6 and revert the CSIZE setting instead. | ||
2129 | */ | ||
2130 | if ((C_CSIZE(tty) != CS8) && (C_CSIZE(tty) != CS7)) { | ||
2131 | dev_warn(ddev, "requested CSIZE setting not supported\n"); | ||
2132 | |||
2133 | termios->c_cflag &= ~CSIZE; | ||
2134 | if (old_termios) | ||
2135 | termios->c_cflag |= old_termios->c_cflag & CSIZE; | ||
2136 | else | ||
2137 | termios->c_cflag |= CS8; | ||
2138 | } | ||
2139 | |||
2126 | cflag = termios->c_cflag; | 2140 | cflag = termios->c_cflag; |
2127 | 2141 | ||
2128 | if (!old_termios) | 2142 | if (!old_termios) |
@@ -2159,19 +2173,16 @@ no_skip: | |||
2159 | } else { | 2173 | } else { |
2160 | urb_value |= FTDI_SIO_SET_DATA_PARITY_NONE; | 2174 | urb_value |= FTDI_SIO_SET_DATA_PARITY_NONE; |
2161 | } | 2175 | } |
2162 | if (cflag & CSIZE) { | 2176 | switch (cflag & CSIZE) { |
2163 | switch (cflag & CSIZE) { | 2177 | case CS7: |
2164 | case CS7: | 2178 | urb_value |= 7; |
2165 | urb_value |= 7; | 2179 | dev_dbg(ddev, "Setting CS7\n"); |
2166 | dev_dbg(ddev, "Setting CS7\n"); | 2180 | break; |
2167 | break; | 2181 | default: |
2168 | case CS8: | 2182 | case CS8: |
2169 | urb_value |= 8; | 2183 | urb_value |= 8; |
2170 | dev_dbg(ddev, "Setting CS8\n"); | 2184 | dev_dbg(ddev, "Setting CS8\n"); |
2171 | break; | 2185 | break; |
2172 | default: | ||
2173 | dev_err(ddev, "CSIZE was set but not CS7-CS8\n"); | ||
2174 | } | ||
2175 | } | 2186 | } |
2176 | 2187 | ||
2177 | /* This is needed by the break command since it uses the same command | 2188 | /* This is needed by the break command since it uses the same command |
diff --git a/drivers/usb/serial/generic.c b/drivers/usb/serial/generic.c index 2b01ec8651c2..b63ce023f96f 100644 --- a/drivers/usb/serial/generic.c +++ b/drivers/usb/serial/generic.c | |||
@@ -173,16 +173,8 @@ retry: | |||
173 | clear_bit_unlock(USB_SERIAL_WRITE_BUSY, &port->flags); | 173 | clear_bit_unlock(USB_SERIAL_WRITE_BUSY, &port->flags); |
174 | return result; | 174 | return result; |
175 | } | 175 | } |
176 | /* | ||
177 | * Try sending off another urb, unless called from completion handler | ||
178 | * (in which case there will be no free urb or no data). | ||
179 | */ | ||
180 | if (mem_flags != GFP_ATOMIC) | ||
181 | goto retry; | ||
182 | 176 | ||
183 | clear_bit_unlock(USB_SERIAL_WRITE_BUSY, &port->flags); | 177 | goto retry; /* try sending off another urb */ |
184 | |||
185 | return 0; | ||
186 | } | 178 | } |
187 | EXPORT_SYMBOL_GPL(usb_serial_generic_write_start); | 179 | EXPORT_SYMBOL_GPL(usb_serial_generic_write_start); |
188 | 180 | ||
@@ -208,7 +200,7 @@ int usb_serial_generic_write(struct tty_struct *tty, | |||
208 | return 0; | 200 | return 0; |
209 | 201 | ||
210 | count = kfifo_in_locked(&port->write_fifo, buf, count, &port->lock); | 202 | count = kfifo_in_locked(&port->write_fifo, buf, count, &port->lock); |
211 | result = usb_serial_generic_write_start(port, GFP_KERNEL); | 203 | result = usb_serial_generic_write_start(port, GFP_ATOMIC); |
212 | if (result) | 204 | if (result) |
213 | return result; | 205 | return result; |
214 | 206 | ||
diff --git a/drivers/usb/serial/mos7840.c b/drivers/usb/serial/mos7840.c index e5bdd987b9e8..a69da83604c0 100644 --- a/drivers/usb/serial/mos7840.c +++ b/drivers/usb/serial/mos7840.c | |||
@@ -1813,25 +1813,25 @@ static void mos7840_change_port_settings(struct tty_struct *tty, | |||
1813 | iflag = tty->termios.c_iflag; | 1813 | iflag = tty->termios.c_iflag; |
1814 | 1814 | ||
1815 | /* Change the number of bits */ | 1815 | /* Change the number of bits */ |
1816 | if (cflag & CSIZE) { | 1816 | switch (cflag & CSIZE) { |
1817 | switch (cflag & CSIZE) { | 1817 | case CS5: |
1818 | case CS5: | 1818 | lData = LCR_BITS_5; |
1819 | lData = LCR_BITS_5; | 1819 | break; |
1820 | break; | ||
1821 | 1820 | ||
1822 | case CS6: | 1821 | case CS6: |
1823 | lData = LCR_BITS_6; | 1822 | lData = LCR_BITS_6; |
1824 | break; | 1823 | break; |
1825 | 1824 | ||
1826 | case CS7: | 1825 | case CS7: |
1827 | lData = LCR_BITS_7; | 1826 | lData = LCR_BITS_7; |
1828 | break; | 1827 | break; |
1829 | default: | 1828 | |
1830 | case CS8: | 1829 | default: |
1831 | lData = LCR_BITS_8; | 1830 | case CS8: |
1832 | break; | 1831 | lData = LCR_BITS_8; |
1833 | } | 1832 | break; |
1834 | } | 1833 | } |
1834 | |||
1835 | /* Change the Parity bit */ | 1835 | /* Change the Parity bit */ |
1836 | if (cflag & PARENB) { | 1836 | if (cflag & PARENB) { |
1837 | if (cflag & PARODD) { | 1837 | if (cflag & PARODD) { |
diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c index c3d94853b4ab..496b7e39d5be 100644 --- a/drivers/usb/serial/option.c +++ b/drivers/usb/serial/option.c | |||
@@ -85,6 +85,7 @@ static void option_instat_callback(struct urb *urb); | |||
85 | #define HUAWEI_PRODUCT_K4505 0x1464 | 85 | #define HUAWEI_PRODUCT_K4505 0x1464 |
86 | #define HUAWEI_PRODUCT_K3765 0x1465 | 86 | #define HUAWEI_PRODUCT_K3765 0x1465 |
87 | #define HUAWEI_PRODUCT_K4605 0x14C6 | 87 | #define HUAWEI_PRODUCT_K4605 0x14C6 |
88 | #define HUAWEI_PRODUCT_E173S6 0x1C07 | ||
88 | 89 | ||
89 | #define QUANTA_VENDOR_ID 0x0408 | 90 | #define QUANTA_VENDOR_ID 0x0408 |
90 | #define QUANTA_PRODUCT_Q101 0xEA02 | 91 | #define QUANTA_PRODUCT_Q101 0xEA02 |
@@ -572,6 +573,8 @@ static const struct usb_device_id option_ids[] = { | |||
572 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0x1c23, USB_CLASS_COMM, 0x02, 0xff) }, | 573 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0x1c23, USB_CLASS_COMM, 0x02, 0xff) }, |
573 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E173, 0xff, 0xff, 0xff), | 574 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E173, 0xff, 0xff, 0xff), |
574 | .driver_info = (kernel_ulong_t) &net_intf1_blacklist }, | 575 | .driver_info = (kernel_ulong_t) &net_intf1_blacklist }, |
576 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E173S6, 0xff, 0xff, 0xff), | ||
577 | .driver_info = (kernel_ulong_t) &net_intf1_blacklist }, | ||
575 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1750, 0xff, 0xff, 0xff), | 578 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1750, 0xff, 0xff, 0xff), |
576 | .driver_info = (kernel_ulong_t) &net_intf2_blacklist }, | 579 | .driver_info = (kernel_ulong_t) &net_intf2_blacklist }, |
577 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0x1441, USB_CLASS_COMM, 0x02, 0xff) }, | 580 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0x1441, USB_CLASS_COMM, 0x02, 0xff) }, |
@@ -634,6 +637,10 @@ static const struct usb_device_id option_ids[] = { | |||
634 | { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x6D) }, | 637 | { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x6D) }, |
635 | { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x6E) }, | 638 | { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x6E) }, |
636 | { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x6F) }, | 639 | { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x6F) }, |
640 | { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x72) }, | ||
641 | { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x73) }, | ||
642 | { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x74) }, | ||
643 | { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x75) }, | ||
637 | { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x78) }, | 644 | { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x78) }, |
638 | { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x79) }, | 645 | { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x79) }, |
639 | { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x7A) }, | 646 | { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x7A) }, |
@@ -688,6 +695,10 @@ static const struct usb_device_id option_ids[] = { | |||
688 | { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x02, 0x6D) }, | 695 | { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x02, 0x6D) }, |
689 | { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x02, 0x6E) }, | 696 | { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x02, 0x6E) }, |
690 | { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x02, 0x6F) }, | 697 | { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x02, 0x6F) }, |
698 | { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x02, 0x72) }, | ||
699 | { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x02, 0x73) }, | ||
700 | { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x02, 0x74) }, | ||
701 | { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x02, 0x75) }, | ||
691 | { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x02, 0x78) }, | 702 | { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x02, 0x78) }, |
692 | { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x02, 0x79) }, | 703 | { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x02, 0x79) }, |
693 | { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x02, 0x7A) }, | 704 | { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x02, 0x7A) }, |
@@ -742,6 +753,10 @@ static const struct usb_device_id option_ids[] = { | |||
742 | { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x03, 0x6D) }, | 753 | { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x03, 0x6D) }, |
743 | { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x03, 0x6E) }, | 754 | { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x03, 0x6E) }, |
744 | { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x03, 0x6F) }, | 755 | { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x03, 0x6F) }, |
756 | { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x03, 0x72) }, | ||
757 | { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x03, 0x73) }, | ||
758 | { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x03, 0x74) }, | ||
759 | { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x03, 0x75) }, | ||
745 | { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x03, 0x78) }, | 760 | { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x03, 0x78) }, |
746 | { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x03, 0x79) }, | 761 | { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x03, 0x79) }, |
747 | { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x03, 0x7A) }, | 762 | { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x03, 0x7A) }, |
@@ -796,6 +811,10 @@ static const struct usb_device_id option_ids[] = { | |||
796 | { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x04, 0x6D) }, | 811 | { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x04, 0x6D) }, |
797 | { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x04, 0x6E) }, | 812 | { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x04, 0x6E) }, |
798 | { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x04, 0x6F) }, | 813 | { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x04, 0x6F) }, |
814 | { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x04, 0x72) }, | ||
815 | { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x04, 0x73) }, | ||
816 | { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x04, 0x74) }, | ||
817 | { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x04, 0x75) }, | ||
799 | { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x04, 0x78) }, | 818 | { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x04, 0x78) }, |
800 | { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x04, 0x79) }, | 819 | { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x04, 0x79) }, |
801 | { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x04, 0x7A) }, | 820 | { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x04, 0x7A) }, |
@@ -850,6 +869,10 @@ static const struct usb_device_id option_ids[] = { | |||
850 | { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x05, 0x6D) }, | 869 | { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x05, 0x6D) }, |
851 | { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x05, 0x6E) }, | 870 | { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x05, 0x6E) }, |
852 | { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x05, 0x6F) }, | 871 | { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x05, 0x6F) }, |
872 | { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x05, 0x72) }, | ||
873 | { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x05, 0x73) }, | ||
874 | { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x05, 0x74) }, | ||
875 | { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x05, 0x75) }, | ||
853 | { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x05, 0x78) }, | 876 | { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x05, 0x78) }, |
854 | { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x05, 0x79) }, | 877 | { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x05, 0x79) }, |
855 | { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x05, 0x7A) }, | 878 | { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x05, 0x7A) }, |
@@ -904,6 +927,10 @@ static const struct usb_device_id option_ids[] = { | |||
904 | { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x06, 0x6D) }, | 927 | { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x06, 0x6D) }, |
905 | { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x06, 0x6E) }, | 928 | { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x06, 0x6E) }, |
906 | { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x06, 0x6F) }, | 929 | { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x06, 0x6F) }, |
930 | { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x06, 0x72) }, | ||
931 | { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x06, 0x73) }, | ||
932 | { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x06, 0x74) }, | ||
933 | { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x06, 0x75) }, | ||
907 | { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x06, 0x78) }, | 934 | { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x06, 0x78) }, |
908 | { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x06, 0x79) }, | 935 | { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x06, 0x79) }, |
909 | { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x06, 0x7A) }, | 936 | { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x06, 0x7A) }, |
diff --git a/drivers/usb/serial/pl2303.c b/drivers/usb/serial/pl2303.c index 1e6de4cd079d..1e3318dfa1cb 100644 --- a/drivers/usb/serial/pl2303.c +++ b/drivers/usb/serial/pl2303.c | |||
@@ -361,23 +361,21 @@ static void pl2303_set_termios(struct tty_struct *tty, | |||
361 | 0, 0, buf, 7, 100); | 361 | 0, 0, buf, 7, 100); |
362 | dev_dbg(&port->dev, "0xa1:0x21:0:0 %d - %7ph\n", i, buf); | 362 | dev_dbg(&port->dev, "0xa1:0x21:0:0 %d - %7ph\n", i, buf); |
363 | 363 | ||
364 | if (C_CSIZE(tty)) { | 364 | switch (C_CSIZE(tty)) { |
365 | switch (C_CSIZE(tty)) { | 365 | case CS5: |
366 | case CS5: | 366 | buf[6] = 5; |
367 | buf[6] = 5; | 367 | break; |
368 | break; | 368 | case CS6: |
369 | case CS6: | 369 | buf[6] = 6; |
370 | buf[6] = 6; | 370 | break; |
371 | break; | 371 | case CS7: |
372 | case CS7: | 372 | buf[6] = 7; |
373 | buf[6] = 7; | 373 | break; |
374 | break; | 374 | default: |
375 | default: | 375 | case CS8: |
376 | case CS8: | 376 | buf[6] = 8; |
377 | buf[6] = 8; | ||
378 | } | ||
379 | dev_dbg(&port->dev, "data bits = %d\n", buf[6]); | ||
380 | } | 377 | } |
378 | dev_dbg(&port->dev, "data bits = %d\n", buf[6]); | ||
381 | 379 | ||
382 | /* For reference buf[0]:buf[3] baud rate value */ | 380 | /* For reference buf[0]:buf[3] baud rate value */ |
383 | pl2303_encode_baudrate(tty, port, &buf[0]); | 381 | pl2303_encode_baudrate(tty, port, &buf[0]); |
diff --git a/drivers/usb/serial/spcp8x5.c b/drivers/usb/serial/spcp8x5.c index 4abac28b5992..5b793c352267 100644 --- a/drivers/usb/serial/spcp8x5.c +++ b/drivers/usb/serial/spcp8x5.c | |||
@@ -348,22 +348,20 @@ static void spcp8x5_set_termios(struct tty_struct *tty, | |||
348 | } | 348 | } |
349 | 349 | ||
350 | /* Set Data Length : 00:5bit, 01:6bit, 10:7bit, 11:8bit */ | 350 | /* Set Data Length : 00:5bit, 01:6bit, 10:7bit, 11:8bit */ |
351 | if (cflag & CSIZE) { | 351 | switch (cflag & CSIZE) { |
352 | switch (cflag & CSIZE) { | 352 | case CS5: |
353 | case CS5: | 353 | buf[1] |= SET_UART_FORMAT_SIZE_5; |
354 | buf[1] |= SET_UART_FORMAT_SIZE_5; | 354 | break; |
355 | break; | 355 | case CS6: |
356 | case CS6: | 356 | buf[1] |= SET_UART_FORMAT_SIZE_6; |
357 | buf[1] |= SET_UART_FORMAT_SIZE_6; | 357 | break; |
358 | break; | 358 | case CS7: |
359 | case CS7: | 359 | buf[1] |= SET_UART_FORMAT_SIZE_7; |
360 | buf[1] |= SET_UART_FORMAT_SIZE_7; | 360 | break; |
361 | break; | 361 | default: |
362 | default: | 362 | case CS8: |
363 | case CS8: | 363 | buf[1] |= SET_UART_FORMAT_SIZE_8; |
364 | buf[1] |= SET_UART_FORMAT_SIZE_8; | 364 | break; |
365 | break; | ||
366 | } | ||
367 | } | 365 | } |
368 | 366 | ||
369 | /* Set Stop bit2 : 0:1bit 1:2bit */ | 367 | /* Set Stop bit2 : 0:1bit 1:2bit */ |
diff --git a/drivers/usb/wusbcore/devconnect.c b/drivers/usb/wusbcore/devconnect.c index e538b72c4e3a..f14e7929ba22 100644 --- a/drivers/usb/wusbcore/devconnect.c +++ b/drivers/usb/wusbcore/devconnect.c | |||
@@ -97,18 +97,12 @@ static void wusbhc_devconnect_acked_work(struct work_struct *work); | |||
97 | 97 | ||
98 | static void wusb_dev_free(struct wusb_dev *wusb_dev) | 98 | static void wusb_dev_free(struct wusb_dev *wusb_dev) |
99 | { | 99 | { |
100 | if (wusb_dev) { | 100 | kfree(wusb_dev); |
101 | kfree(wusb_dev->set_gtk_req); | ||
102 | usb_free_urb(wusb_dev->set_gtk_urb); | ||
103 | kfree(wusb_dev); | ||
104 | } | ||
105 | } | 101 | } |
106 | 102 | ||
107 | static struct wusb_dev *wusb_dev_alloc(struct wusbhc *wusbhc) | 103 | static struct wusb_dev *wusb_dev_alloc(struct wusbhc *wusbhc) |
108 | { | 104 | { |
109 | struct wusb_dev *wusb_dev; | 105 | struct wusb_dev *wusb_dev; |
110 | struct urb *urb; | ||
111 | struct usb_ctrlrequest *req; | ||
112 | 106 | ||
113 | wusb_dev = kzalloc(sizeof(*wusb_dev), GFP_KERNEL); | 107 | wusb_dev = kzalloc(sizeof(*wusb_dev), GFP_KERNEL); |
114 | if (wusb_dev == NULL) | 108 | if (wusb_dev == NULL) |
@@ -118,22 +112,6 @@ static struct wusb_dev *wusb_dev_alloc(struct wusbhc *wusbhc) | |||
118 | 112 | ||
119 | INIT_WORK(&wusb_dev->devconnect_acked_work, wusbhc_devconnect_acked_work); | 113 | INIT_WORK(&wusb_dev->devconnect_acked_work, wusbhc_devconnect_acked_work); |
120 | 114 | ||
121 | urb = usb_alloc_urb(0, GFP_KERNEL); | ||
122 | if (urb == NULL) | ||
123 | goto err; | ||
124 | wusb_dev->set_gtk_urb = urb; | ||
125 | |||
126 | req = kmalloc(sizeof(*req), GFP_KERNEL); | ||
127 | if (req == NULL) | ||
128 | goto err; | ||
129 | wusb_dev->set_gtk_req = req; | ||
130 | |||
131 | req->bRequestType = USB_DIR_OUT | USB_TYPE_STANDARD | USB_RECIP_DEVICE; | ||
132 | req->bRequest = USB_REQ_SET_DESCRIPTOR; | ||
133 | req->wValue = cpu_to_le16(USB_DT_KEY << 8 | wusbhc->gtk_index); | ||
134 | req->wIndex = 0; | ||
135 | req->wLength = cpu_to_le16(wusbhc->gtk.descr.bLength); | ||
136 | |||
137 | return wusb_dev; | 115 | return wusb_dev; |
138 | err: | 116 | err: |
139 | wusb_dev_free(wusb_dev); | 117 | wusb_dev_free(wusb_dev); |
@@ -411,9 +389,6 @@ static void __wusbhc_dev_disconnect(struct wusbhc *wusbhc, | |||
411 | /* | 389 | /* |
412 | * Refresh the list of keep alives to emit in the MMC | 390 | * Refresh the list of keep alives to emit in the MMC |
413 | * | 391 | * |
414 | * Some devices don't respond to keep alives unless they've been | ||
415 | * authenticated, so skip unauthenticated devices. | ||
416 | * | ||
417 | * We only publish the first four devices that have a coming timeout | 392 | * We only publish the first four devices that have a coming timeout |
418 | * condition. Then when we are done processing those, we go for the | 393 | * condition. Then when we are done processing those, we go for the |
419 | * next ones. We ignore the ones that have timed out already (they'll | 394 | * next ones. We ignore the ones that have timed out already (they'll |
@@ -448,7 +423,7 @@ static void __wusbhc_keep_alive(struct wusbhc *wusbhc) | |||
448 | 423 | ||
449 | if (wusb_dev == NULL) | 424 | if (wusb_dev == NULL) |
450 | continue; | 425 | continue; |
451 | if (wusb_dev->usb_dev == NULL || !wusb_dev->usb_dev->authenticated) | 426 | if (wusb_dev->usb_dev == NULL) |
452 | continue; | 427 | continue; |
453 | 428 | ||
454 | if (time_after(jiffies, wusb_dev->entry_ts + tt)) { | 429 | if (time_after(jiffies, wusb_dev->entry_ts + tt)) { |
@@ -524,11 +499,19 @@ static struct wusb_dev *wusbhc_find_dev_by_addr(struct wusbhc *wusbhc, u8 addr) | |||
524 | * | 499 | * |
525 | * @wusbhc shall be referenced and unlocked | 500 | * @wusbhc shall be referenced and unlocked |
526 | */ | 501 | */ |
527 | static void wusbhc_handle_dn_alive(struct wusbhc *wusbhc, struct wusb_dev *wusb_dev) | 502 | static void wusbhc_handle_dn_alive(struct wusbhc *wusbhc, u8 srcaddr) |
528 | { | 503 | { |
504 | struct wusb_dev *wusb_dev; | ||
505 | |||
529 | mutex_lock(&wusbhc->mutex); | 506 | mutex_lock(&wusbhc->mutex); |
530 | wusb_dev->entry_ts = jiffies; | 507 | wusb_dev = wusbhc_find_dev_by_addr(wusbhc, srcaddr); |
531 | __wusbhc_keep_alive(wusbhc); | 508 | if (wusb_dev == NULL) { |
509 | dev_dbg(wusbhc->dev, "ignoring DN_Alive from unconnected device %02x\n", | ||
510 | srcaddr); | ||
511 | } else { | ||
512 | wusb_dev->entry_ts = jiffies; | ||
513 | __wusbhc_keep_alive(wusbhc); | ||
514 | } | ||
532 | mutex_unlock(&wusbhc->mutex); | 515 | mutex_unlock(&wusbhc->mutex); |
533 | } | 516 | } |
534 | 517 | ||
@@ -582,14 +565,22 @@ static void wusbhc_handle_dn_connect(struct wusbhc *wusbhc, | |||
582 | * | 565 | * |
583 | * @wusbhc shall be referenced and unlocked | 566 | * @wusbhc shall be referenced and unlocked |
584 | */ | 567 | */ |
585 | static void wusbhc_handle_dn_disconnect(struct wusbhc *wusbhc, struct wusb_dev *wusb_dev) | 568 | static void wusbhc_handle_dn_disconnect(struct wusbhc *wusbhc, u8 srcaddr) |
586 | { | 569 | { |
587 | struct device *dev = wusbhc->dev; | 570 | struct device *dev = wusbhc->dev; |
588 | 571 | struct wusb_dev *wusb_dev; | |
589 | dev_info(dev, "DN DISCONNECT: device 0x%02x going down\n", wusb_dev->addr); | ||
590 | 572 | ||
591 | mutex_lock(&wusbhc->mutex); | 573 | mutex_lock(&wusbhc->mutex); |
592 | __wusbhc_dev_disconnect(wusbhc, wusb_port_by_idx(wusbhc, wusb_dev->port_idx)); | 574 | wusb_dev = wusbhc_find_dev_by_addr(wusbhc, srcaddr); |
575 | if (wusb_dev == NULL) { | ||
576 | dev_dbg(dev, "ignoring DN DISCONNECT from unconnected device %02x\n", | ||
577 | srcaddr); | ||
578 | } else { | ||
579 | dev_info(dev, "DN DISCONNECT: device 0x%02x going down\n", | ||
580 | wusb_dev->addr); | ||
581 | __wusbhc_dev_disconnect(wusbhc, wusb_port_by_idx(wusbhc, | ||
582 | wusb_dev->port_idx)); | ||
583 | } | ||
593 | mutex_unlock(&wusbhc->mutex); | 584 | mutex_unlock(&wusbhc->mutex); |
594 | } | 585 | } |
595 | 586 | ||
@@ -611,30 +602,21 @@ void wusbhc_handle_dn(struct wusbhc *wusbhc, u8 srcaddr, | |||
611 | struct wusb_dn_hdr *dn_hdr, size_t size) | 602 | struct wusb_dn_hdr *dn_hdr, size_t size) |
612 | { | 603 | { |
613 | struct device *dev = wusbhc->dev; | 604 | struct device *dev = wusbhc->dev; |
614 | struct wusb_dev *wusb_dev; | ||
615 | 605 | ||
616 | if (size < sizeof(struct wusb_dn_hdr)) { | 606 | if (size < sizeof(struct wusb_dn_hdr)) { |
617 | dev_err(dev, "DN data shorter than DN header (%d < %d)\n", | 607 | dev_err(dev, "DN data shorter than DN header (%d < %d)\n", |
618 | (int)size, (int)sizeof(struct wusb_dn_hdr)); | 608 | (int)size, (int)sizeof(struct wusb_dn_hdr)); |
619 | return; | 609 | return; |
620 | } | 610 | } |
621 | |||
622 | wusb_dev = wusbhc_find_dev_by_addr(wusbhc, srcaddr); | ||
623 | if (wusb_dev == NULL && dn_hdr->bType != WUSB_DN_CONNECT) { | ||
624 | dev_dbg(dev, "ignoring DN %d from unconnected device %02x\n", | ||
625 | dn_hdr->bType, srcaddr); | ||
626 | return; | ||
627 | } | ||
628 | |||
629 | switch (dn_hdr->bType) { | 611 | switch (dn_hdr->bType) { |
630 | case WUSB_DN_CONNECT: | 612 | case WUSB_DN_CONNECT: |
631 | wusbhc_handle_dn_connect(wusbhc, dn_hdr, size); | 613 | wusbhc_handle_dn_connect(wusbhc, dn_hdr, size); |
632 | break; | 614 | break; |
633 | case WUSB_DN_ALIVE: | 615 | case WUSB_DN_ALIVE: |
634 | wusbhc_handle_dn_alive(wusbhc, wusb_dev); | 616 | wusbhc_handle_dn_alive(wusbhc, srcaddr); |
635 | break; | 617 | break; |
636 | case WUSB_DN_DISCONNECT: | 618 | case WUSB_DN_DISCONNECT: |
637 | wusbhc_handle_dn_disconnect(wusbhc, wusb_dev); | 619 | wusbhc_handle_dn_disconnect(wusbhc, srcaddr); |
638 | break; | 620 | break; |
639 | case WUSB_DN_MASAVAILCHANGED: | 621 | case WUSB_DN_MASAVAILCHANGED: |
640 | case WUSB_DN_RWAKE: | 622 | case WUSB_DN_RWAKE: |
diff --git a/drivers/usb/wusbcore/security.c b/drivers/usb/wusbcore/security.c index dd88441c8f78..4c40d0dbf53d 100644 --- a/drivers/usb/wusbcore/security.c +++ b/drivers/usb/wusbcore/security.c | |||
@@ -29,19 +29,16 @@ | |||
29 | #include <linux/export.h> | 29 | #include <linux/export.h> |
30 | #include "wusbhc.h" | 30 | #include "wusbhc.h" |
31 | 31 | ||
32 | static void wusbhc_set_gtk_callback(struct urb *urb); | 32 | static void wusbhc_gtk_rekey_work(struct work_struct *work); |
33 | static void wusbhc_gtk_rekey_done_work(struct work_struct *work); | ||
34 | 33 | ||
35 | int wusbhc_sec_create(struct wusbhc *wusbhc) | 34 | int wusbhc_sec_create(struct wusbhc *wusbhc) |
36 | { | 35 | { |
37 | wusbhc->gtk.descr.bLength = sizeof(wusbhc->gtk.descr) + sizeof(wusbhc->gtk.data); | 36 | wusbhc->gtk.descr.bLength = sizeof(wusbhc->gtk.descr) + sizeof(wusbhc->gtk.data); |
38 | wusbhc->gtk.descr.bDescriptorType = USB_DT_KEY; | 37 | wusbhc->gtk.descr.bDescriptorType = USB_DT_KEY; |
39 | wusbhc->gtk.descr.bReserved = 0; | 38 | wusbhc->gtk.descr.bReserved = 0; |
39 | wusbhc->gtk_index = 0; | ||
40 | 40 | ||
41 | wusbhc->gtk_index = wusb_key_index(0, WUSB_KEY_INDEX_TYPE_GTK, | 41 | INIT_WORK(&wusbhc->gtk_rekey_work, wusbhc_gtk_rekey_work); |
42 | WUSB_KEY_INDEX_ORIGINATOR_HOST); | ||
43 | |||
44 | INIT_WORK(&wusbhc->gtk_rekey_done_work, wusbhc_gtk_rekey_done_work); | ||
45 | 42 | ||
46 | return 0; | 43 | return 0; |
47 | } | 44 | } |
@@ -113,7 +110,7 @@ int wusbhc_sec_start(struct wusbhc *wusbhc) | |||
113 | wusbhc_generate_gtk(wusbhc); | 110 | wusbhc_generate_gtk(wusbhc); |
114 | 111 | ||
115 | result = wusbhc->set_gtk(wusbhc, wusbhc->gtk_tkid, | 112 | result = wusbhc->set_gtk(wusbhc, wusbhc->gtk_tkid, |
116 | &wusbhc->gtk.descr.bKeyData, key_size); | 113 | &wusbhc->gtk.descr.bKeyData, key_size); |
117 | if (result < 0) | 114 | if (result < 0) |
118 | dev_err(wusbhc->dev, "cannot set GTK for the host: %d\n", | 115 | dev_err(wusbhc->dev, "cannot set GTK for the host: %d\n", |
119 | result); | 116 | result); |
@@ -129,7 +126,7 @@ int wusbhc_sec_start(struct wusbhc *wusbhc) | |||
129 | */ | 126 | */ |
130 | void wusbhc_sec_stop(struct wusbhc *wusbhc) | 127 | void wusbhc_sec_stop(struct wusbhc *wusbhc) |
131 | { | 128 | { |
132 | cancel_work_sync(&wusbhc->gtk_rekey_done_work); | 129 | cancel_work_sync(&wusbhc->gtk_rekey_work); |
133 | } | 130 | } |
134 | 131 | ||
135 | 132 | ||
@@ -185,12 +182,14 @@ static int wusb_dev_set_encryption(struct usb_device *usb_dev, int value) | |||
185 | static int wusb_dev_set_gtk(struct wusbhc *wusbhc, struct wusb_dev *wusb_dev) | 182 | static int wusb_dev_set_gtk(struct wusbhc *wusbhc, struct wusb_dev *wusb_dev) |
186 | { | 183 | { |
187 | struct usb_device *usb_dev = wusb_dev->usb_dev; | 184 | struct usb_device *usb_dev = wusb_dev->usb_dev; |
185 | u8 key_index = wusb_key_index(wusbhc->gtk_index, | ||
186 | WUSB_KEY_INDEX_TYPE_GTK, WUSB_KEY_INDEX_ORIGINATOR_HOST); | ||
188 | 187 | ||
189 | return usb_control_msg( | 188 | return usb_control_msg( |
190 | usb_dev, usb_sndctrlpipe(usb_dev, 0), | 189 | usb_dev, usb_sndctrlpipe(usb_dev, 0), |
191 | USB_REQ_SET_DESCRIPTOR, | 190 | USB_REQ_SET_DESCRIPTOR, |
192 | USB_DIR_OUT | USB_TYPE_STANDARD | USB_RECIP_DEVICE, | 191 | USB_DIR_OUT | USB_TYPE_STANDARD | USB_RECIP_DEVICE, |
193 | USB_DT_KEY << 8 | wusbhc->gtk_index, 0, | 192 | USB_DT_KEY << 8 | key_index, 0, |
194 | &wusbhc->gtk.descr, wusbhc->gtk.descr.bLength, | 193 | &wusbhc->gtk.descr, wusbhc->gtk.descr.bLength, |
195 | 1000); | 194 | 1000); |
196 | } | 195 | } |
@@ -520,24 +519,55 @@ error_kzalloc: | |||
520 | * Once all connected and authenticated devices have received the new | 519 | * Once all connected and authenticated devices have received the new |
521 | * GTK, switch the host to using it. | 520 | * GTK, switch the host to using it. |
522 | */ | 521 | */ |
523 | static void wusbhc_gtk_rekey_done_work(struct work_struct *work) | 522 | static void wusbhc_gtk_rekey_work(struct work_struct *work) |
524 | { | 523 | { |
525 | struct wusbhc *wusbhc = container_of(work, struct wusbhc, gtk_rekey_done_work); | 524 | struct wusbhc *wusbhc = container_of(work, |
525 | struct wusbhc, gtk_rekey_work); | ||
526 | size_t key_size = sizeof(wusbhc->gtk.data); | 526 | size_t key_size = sizeof(wusbhc->gtk.data); |
527 | int port_idx; | ||
528 | struct wusb_dev *wusb_dev, *wusb_dev_next; | ||
529 | LIST_HEAD(rekey_list); | ||
527 | 530 | ||
528 | mutex_lock(&wusbhc->mutex); | 531 | mutex_lock(&wusbhc->mutex); |
532 | /* generate the new key */ | ||
533 | wusbhc_generate_gtk(wusbhc); | ||
534 | /* roll the gtk index. */ | ||
535 | wusbhc->gtk_index = (wusbhc->gtk_index + 1) % (WUSB_KEY_INDEX_MAX + 1); | ||
536 | /* | ||
537 | * Save all connected devices on a list while holding wusbhc->mutex and | ||
538 | * take a reference to each one. Then submit the set key request to | ||
539 | * them after releasing the lock in order to avoid a deadlock. | ||
540 | */ | ||
541 | for (port_idx = 0; port_idx < wusbhc->ports_max; port_idx++) { | ||
542 | wusb_dev = wusbhc->port[port_idx].wusb_dev; | ||
543 | if (!wusb_dev || !wusb_dev->usb_dev | ||
544 | || !wusb_dev->usb_dev->authenticated) | ||
545 | continue; | ||
529 | 546 | ||
530 | if (--wusbhc->pending_set_gtks == 0) | 547 | wusb_dev_get(wusb_dev); |
531 | wusbhc->set_gtk(wusbhc, wusbhc->gtk_tkid, &wusbhc->gtk.descr.bKeyData, key_size); | 548 | list_add_tail(&wusb_dev->rekey_node, &rekey_list); |
532 | 549 | } | |
533 | mutex_unlock(&wusbhc->mutex); | 550 | mutex_unlock(&wusbhc->mutex); |
534 | } | ||
535 | 551 | ||
536 | static void wusbhc_set_gtk_callback(struct urb *urb) | 552 | /* Submit the rekey requests without holding wusbhc->mutex. */ |
537 | { | 553 | list_for_each_entry_safe(wusb_dev, wusb_dev_next, &rekey_list, |
538 | struct wusbhc *wusbhc = urb->context; | 554 | rekey_node) { |
555 | list_del_init(&wusb_dev->rekey_node); | ||
556 | dev_dbg(&wusb_dev->usb_dev->dev, "%s: rekey device at port %d\n", | ||
557 | __func__, wusb_dev->port_idx); | ||
558 | |||
559 | if (wusb_dev_set_gtk(wusbhc, wusb_dev) < 0) { | ||
560 | dev_err(&wusb_dev->usb_dev->dev, "%s: rekey device at port %d failed\n", | ||
561 | __func__, wusb_dev->port_idx); | ||
562 | } | ||
563 | wusb_dev_put(wusb_dev); | ||
564 | } | ||
539 | 565 | ||
540 | queue_work(wusbd, &wusbhc->gtk_rekey_done_work); | 566 | /* Switch the host controller to use the new GTK. */ |
567 | mutex_lock(&wusbhc->mutex); | ||
568 | wusbhc->set_gtk(wusbhc, wusbhc->gtk_tkid, | ||
569 | &wusbhc->gtk.descr.bKeyData, key_size); | ||
570 | mutex_unlock(&wusbhc->mutex); | ||
541 | } | 571 | } |
542 | 572 | ||
543 | /** | 573 | /** |
@@ -553,26 +583,12 @@ static void wusbhc_set_gtk_callback(struct urb *urb) | |||
553 | */ | 583 | */ |
554 | void wusbhc_gtk_rekey(struct wusbhc *wusbhc) | 584 | void wusbhc_gtk_rekey(struct wusbhc *wusbhc) |
555 | { | 585 | { |
556 | static const size_t key_size = sizeof(wusbhc->gtk.data); | 586 | /* |
557 | int p; | 587 | * We need to submit a URB to the downstream WUSB devices in order to |
558 | 588 | * change the group key. This can't be done while holding the | |
559 | wusbhc_generate_gtk(wusbhc); | 589 | * wusbhc->mutex since that is also taken in the urb_enqueue routine |
560 | 590 | * and will cause a deadlock. Instead, queue a work item to do | |
561 | for (p = 0; p < wusbhc->ports_max; p++) { | 591 | * it when the lock is not held |
562 | struct wusb_dev *wusb_dev; | 592 | */ |
563 | 593 | queue_work(wusbd, &wusbhc->gtk_rekey_work); | |
564 | wusb_dev = wusbhc->port[p].wusb_dev; | ||
565 | if (!wusb_dev || !wusb_dev->usb_dev || !wusb_dev->usb_dev->authenticated) | ||
566 | continue; | ||
567 | |||
568 | usb_fill_control_urb(wusb_dev->set_gtk_urb, wusb_dev->usb_dev, | ||
569 | usb_sndctrlpipe(wusb_dev->usb_dev, 0), | ||
570 | (void *)wusb_dev->set_gtk_req, | ||
571 | &wusbhc->gtk.descr, wusbhc->gtk.descr.bLength, | ||
572 | wusbhc_set_gtk_callback, wusbhc); | ||
573 | if (usb_submit_urb(wusb_dev->set_gtk_urb, GFP_KERNEL) == 0) | ||
574 | wusbhc->pending_set_gtks++; | ||
575 | } | ||
576 | if (wusbhc->pending_set_gtks == 0) | ||
577 | wusbhc->set_gtk(wusbhc, wusbhc->gtk_tkid, &wusbhc->gtk.descr.bKeyData, key_size); | ||
578 | } | 594 | } |
diff --git a/drivers/usb/wusbcore/wusbhc.h b/drivers/usb/wusbcore/wusbhc.h index 711b1952b114..6bd3b819a6b5 100644 --- a/drivers/usb/wusbcore/wusbhc.h +++ b/drivers/usb/wusbcore/wusbhc.h | |||
@@ -97,6 +97,7 @@ struct wusb_dev { | |||
97 | struct kref refcnt; | 97 | struct kref refcnt; |
98 | struct wusbhc *wusbhc; | 98 | struct wusbhc *wusbhc; |
99 | struct list_head cack_node; /* Connect-Ack list */ | 99 | struct list_head cack_node; /* Connect-Ack list */ |
100 | struct list_head rekey_node; /* GTK rekey list */ | ||
100 | u8 port_idx; | 101 | u8 port_idx; |
101 | u8 addr; | 102 | u8 addr; |
102 | u8 beacon_type:4; | 103 | u8 beacon_type:4; |
@@ -107,8 +108,6 @@ struct wusb_dev { | |||
107 | struct usb_wireless_cap_descriptor *wusb_cap_descr; | 108 | struct usb_wireless_cap_descriptor *wusb_cap_descr; |
108 | struct uwb_mas_bm availability; | 109 | struct uwb_mas_bm availability; |
109 | struct work_struct devconnect_acked_work; | 110 | struct work_struct devconnect_acked_work; |
110 | struct urb *set_gtk_urb; | ||
111 | struct usb_ctrlrequest *set_gtk_req; | ||
112 | struct usb_device *usb_dev; | 111 | struct usb_device *usb_dev; |
113 | }; | 112 | }; |
114 | 113 | ||
@@ -296,8 +295,7 @@ struct wusbhc { | |||
296 | } __attribute__((packed)) gtk; | 295 | } __attribute__((packed)) gtk; |
297 | u8 gtk_index; | 296 | u8 gtk_index; |
298 | u32 gtk_tkid; | 297 | u32 gtk_tkid; |
299 | struct work_struct gtk_rekey_done_work; | 298 | struct work_struct gtk_rekey_work; |
300 | int pending_set_gtks; | ||
301 | 299 | ||
302 | struct usb_encryption_descriptor *ccm1_etd; | 300 | struct usb_encryption_descriptor *ccm1_etd; |
303 | }; | 301 | }; |
diff --git a/drivers/video/atmel_lcdfb.c b/drivers/video/atmel_lcdfb.c index 8521051cf946..cd961622f9c1 100644 --- a/drivers/video/atmel_lcdfb.c +++ b/drivers/video/atmel_lcdfb.c | |||
@@ -131,6 +131,7 @@ static const struct platform_device_id atmel_lcdfb_devtypes[] = { | |||
131 | /* terminator */ | 131 | /* terminator */ |
132 | } | 132 | } |
133 | }; | 133 | }; |
134 | MODULE_DEVICE_TABLE(platform, atmel_lcdfb_devtypes); | ||
134 | 135 | ||
135 | static struct atmel_lcdfb_config * | 136 | static struct atmel_lcdfb_config * |
136 | atmel_lcdfb_get_config(struct platform_device *pdev) | 137 | atmel_lcdfb_get_config(struct platform_device *pdev) |
diff --git a/drivers/video/kyro/fbdev.c b/drivers/video/kyro/fbdev.c index 50c857477e4f..65041e15fd59 100644 --- a/drivers/video/kyro/fbdev.c +++ b/drivers/video/kyro/fbdev.c | |||
@@ -624,15 +624,15 @@ static int kyrofb_ioctl(struct fb_info *info, | |||
624 | return -EINVAL; | 624 | return -EINVAL; |
625 | } | 625 | } |
626 | case KYRO_IOCTL_UVSTRIDE: | 626 | case KYRO_IOCTL_UVSTRIDE: |
627 | if (copy_to_user(argp, &deviceInfo.ulOverlayUVStride, sizeof(unsigned long))) | 627 | if (copy_to_user(argp, &deviceInfo.ulOverlayUVStride, sizeof(deviceInfo.ulOverlayUVStride))) |
628 | return -EFAULT; | 628 | return -EFAULT; |
629 | break; | 629 | break; |
630 | case KYRO_IOCTL_STRIDE: | 630 | case KYRO_IOCTL_STRIDE: |
631 | if (copy_to_user(argp, &deviceInfo.ulOverlayStride, sizeof(unsigned long))) | 631 | if (copy_to_user(argp, &deviceInfo.ulOverlayStride, sizeof(deviceInfo.ulOverlayStride))) |
632 | return -EFAULT; | 632 | return -EFAULT; |
633 | break; | 633 | break; |
634 | case KYRO_IOCTL_OVERLAY_OFFSET: | 634 | case KYRO_IOCTL_OVERLAY_OFFSET: |
635 | if (copy_to_user(argp, &deviceInfo.ulOverlayOffset, sizeof(unsigned long))) | 635 | if (copy_to_user(argp, &deviceInfo.ulOverlayOffset, sizeof(deviceInfo.ulOverlayOffset))) |
636 | return -EFAULT; | 636 | return -EFAULT; |
637 | break; | 637 | break; |
638 | } | 638 | } |
diff --git a/drivers/video/offb.c b/drivers/video/offb.c index 9dbea2223401..7d44d669d5b6 100644 --- a/drivers/video/offb.c +++ b/drivers/video/offb.c | |||
@@ -91,6 +91,15 @@ extern boot_infos_t *boot_infos; | |||
91 | #define AVIVO_DC_LUTB_WHITE_OFFSET_GREEN 0x6cd4 | 91 | #define AVIVO_DC_LUTB_WHITE_OFFSET_GREEN 0x6cd4 |
92 | #define AVIVO_DC_LUTB_WHITE_OFFSET_RED 0x6cd8 | 92 | #define AVIVO_DC_LUTB_WHITE_OFFSET_RED 0x6cd8 |
93 | 93 | ||
94 | #define FB_RIGHT_POS(p, bpp) (fb_be_math(p) ? 0 : (32 - (bpp))) | ||
95 | |||
96 | static inline u32 offb_cmap_byteswap(struct fb_info *info, u32 value) | ||
97 | { | ||
98 | u32 bpp = info->var.bits_per_pixel; | ||
99 | |||
100 | return cpu_to_be32(value) >> FB_RIGHT_POS(info, bpp); | ||
101 | } | ||
102 | |||
94 | /* | 103 | /* |
95 | * Set a single color register. The values supplied are already | 104 | * Set a single color register. The values supplied are already |
96 | * rounded down to the hardware's capabilities (according to the | 105 | * rounded down to the hardware's capabilities (according to the |
@@ -120,7 +129,7 @@ static int offb_setcolreg(u_int regno, u_int red, u_int green, u_int blue, | |||
120 | mask <<= info->var.transp.offset; | 129 | mask <<= info->var.transp.offset; |
121 | value |= mask; | 130 | value |= mask; |
122 | } | 131 | } |
123 | pal[regno] = value; | 132 | pal[regno] = offb_cmap_byteswap(info, value); |
124 | return 0; | 133 | return 0; |
125 | } | 134 | } |
126 | 135 | ||
@@ -301,7 +310,7 @@ static struct fb_ops offb_ops = { | |||
301 | static void __iomem *offb_map_reg(struct device_node *np, int index, | 310 | static void __iomem *offb_map_reg(struct device_node *np, int index, |
302 | unsigned long offset, unsigned long size) | 311 | unsigned long offset, unsigned long size) |
303 | { | 312 | { |
304 | const u32 *addrp; | 313 | const __be32 *addrp; |
305 | u64 asize, taddr; | 314 | u64 asize, taddr; |
306 | unsigned int flags; | 315 | unsigned int flags; |
307 | 316 | ||
@@ -369,7 +378,11 @@ static void offb_init_palette_hacks(struct fb_info *info, struct device_node *dp | |||
369 | } | 378 | } |
370 | of_node_put(pciparent); | 379 | of_node_put(pciparent); |
371 | } else if (dp && of_device_is_compatible(dp, "qemu,std-vga")) { | 380 | } else if (dp && of_device_is_compatible(dp, "qemu,std-vga")) { |
372 | const u32 io_of_addr[3] = { 0x01000000, 0x0, 0x0 }; | 381 | #ifdef __BIG_ENDIAN |
382 | const __be32 io_of_addr[3] = { 0x01000000, 0x0, 0x0 }; | ||
383 | #else | ||
384 | const __be32 io_of_addr[3] = { 0x00000001, 0x0, 0x0 }; | ||
385 | #endif | ||
373 | u64 io_addr = of_translate_address(dp, io_of_addr); | 386 | u64 io_addr = of_translate_address(dp, io_of_addr); |
374 | if (io_addr != OF_BAD_ADDR) { | 387 | if (io_addr != OF_BAD_ADDR) { |
375 | par->cmap_adr = ioremap(io_addr + 0x3c8, 2); | 388 | par->cmap_adr = ioremap(io_addr + 0x3c8, 2); |
@@ -535,7 +548,7 @@ static void __init offb_init_nodriver(struct device_node *dp, int no_real_node) | |||
535 | unsigned int flags, rsize, addr_prop = 0; | 548 | unsigned int flags, rsize, addr_prop = 0; |
536 | unsigned long max_size = 0; | 549 | unsigned long max_size = 0; |
537 | u64 rstart, address = OF_BAD_ADDR; | 550 | u64 rstart, address = OF_BAD_ADDR; |
538 | const u32 *pp, *addrp, *up; | 551 | const __be32 *pp, *addrp, *up; |
539 | u64 asize; | 552 | u64 asize; |
540 | int foreign_endian = 0; | 553 | int foreign_endian = 0; |
541 | 554 | ||
@@ -551,25 +564,25 @@ static void __init offb_init_nodriver(struct device_node *dp, int no_real_node) | |||
551 | if (pp == NULL) | 564 | if (pp == NULL) |
552 | pp = of_get_property(dp, "depth", &len); | 565 | pp = of_get_property(dp, "depth", &len); |
553 | if (pp && len == sizeof(u32)) | 566 | if (pp && len == sizeof(u32)) |
554 | depth = *pp; | 567 | depth = be32_to_cpup(pp); |
555 | 568 | ||
556 | pp = of_get_property(dp, "linux,bootx-width", &len); | 569 | pp = of_get_property(dp, "linux,bootx-width", &len); |
557 | if (pp == NULL) | 570 | if (pp == NULL) |
558 | pp = of_get_property(dp, "width", &len); | 571 | pp = of_get_property(dp, "width", &len); |
559 | if (pp && len == sizeof(u32)) | 572 | if (pp && len == sizeof(u32)) |
560 | width = *pp; | 573 | width = be32_to_cpup(pp); |
561 | 574 | ||
562 | pp = of_get_property(dp, "linux,bootx-height", &len); | 575 | pp = of_get_property(dp, "linux,bootx-height", &len); |
563 | if (pp == NULL) | 576 | if (pp == NULL) |
564 | pp = of_get_property(dp, "height", &len); | 577 | pp = of_get_property(dp, "height", &len); |
565 | if (pp && len == sizeof(u32)) | 578 | if (pp && len == sizeof(u32)) |
566 | height = *pp; | 579 | height = be32_to_cpup(pp); |
567 | 580 | ||
568 | pp = of_get_property(dp, "linux,bootx-linebytes", &len); | 581 | pp = of_get_property(dp, "linux,bootx-linebytes", &len); |
569 | if (pp == NULL) | 582 | if (pp == NULL) |
570 | pp = of_get_property(dp, "linebytes", &len); | 583 | pp = of_get_property(dp, "linebytes", &len); |
571 | if (pp && len == sizeof(u32) && (*pp != 0xffffffffu)) | 584 | if (pp && len == sizeof(u32) && (*pp != 0xffffffffu)) |
572 | pitch = *pp; | 585 | pitch = be32_to_cpup(pp); |
573 | else | 586 | else |
574 | pitch = width * ((depth + 7) / 8); | 587 | pitch = width * ((depth + 7) / 8); |
575 | 588 | ||
diff --git a/drivers/video/omap2/displays-new/panel-sony-acx565akm.c b/drivers/video/omap2/displays-new/panel-sony-acx565akm.c index e6d56f714ae4..d94f35dbd536 100644 --- a/drivers/video/omap2/displays-new/panel-sony-acx565akm.c +++ b/drivers/video/omap2/displays-new/panel-sony-acx565akm.c | |||
@@ -526,6 +526,8 @@ static int acx565akm_panel_power_on(struct omap_dss_device *dssdev) | |||
526 | struct omap_dss_device *in = ddata->in; | 526 | struct omap_dss_device *in = ddata->in; |
527 | int r; | 527 | int r; |
528 | 528 | ||
529 | mutex_lock(&ddata->mutex); | ||
530 | |||
529 | dev_dbg(&ddata->spi->dev, "%s\n", __func__); | 531 | dev_dbg(&ddata->spi->dev, "%s\n", __func__); |
530 | 532 | ||
531 | in->ops.sdi->set_timings(in, &ddata->videomode); | 533 | in->ops.sdi->set_timings(in, &ddata->videomode); |
@@ -614,10 +616,7 @@ static int acx565akm_enable(struct omap_dss_device *dssdev) | |||
614 | if (omapdss_device_is_enabled(dssdev)) | 616 | if (omapdss_device_is_enabled(dssdev)) |
615 | return 0; | 617 | return 0; |
616 | 618 | ||
617 | mutex_lock(&ddata->mutex); | ||
618 | r = acx565akm_panel_power_on(dssdev); | 619 | r = acx565akm_panel_power_on(dssdev); |
619 | mutex_unlock(&ddata->mutex); | ||
620 | |||
621 | if (r) | 620 | if (r) |
622 | return r; | 621 | return r; |
623 | 622 | ||
diff --git a/drivers/video/sh_mobile_meram.c b/drivers/video/sh_mobile_meram.c index e0f098562a74..a297de5cc859 100644 --- a/drivers/video/sh_mobile_meram.c +++ b/drivers/video/sh_mobile_meram.c | |||
@@ -569,6 +569,7 @@ EXPORT_SYMBOL_GPL(sh_mobile_meram_cache_update); | |||
569 | * Power management | 569 | * Power management |
570 | */ | 570 | */ |
571 | 571 | ||
572 | #if defined(CONFIG_PM_SLEEP) || defined(CONFIG_PM_RUNTIME) | ||
572 | static int sh_mobile_meram_suspend(struct device *dev) | 573 | static int sh_mobile_meram_suspend(struct device *dev) |
573 | { | 574 | { |
574 | struct platform_device *pdev = to_platform_device(dev); | 575 | struct platform_device *pdev = to_platform_device(dev); |
@@ -611,6 +612,7 @@ static int sh_mobile_meram_resume(struct device *dev) | |||
611 | meram_write_reg(priv->base, common_regs[i], priv->regs[i]); | 612 | meram_write_reg(priv->base, common_regs[i], priv->regs[i]); |
612 | return 0; | 613 | return 0; |
613 | } | 614 | } |
615 | #endif /* CONFIG_PM_SLEEP || CONFIG_PM_RUNTIME */ | ||
614 | 616 | ||
615 | static UNIVERSAL_DEV_PM_OPS(sh_mobile_meram_dev_pm_ops, | 617 | static UNIVERSAL_DEV_PM_OPS(sh_mobile_meram_dev_pm_ops, |
616 | sh_mobile_meram_suspend, | 618 | sh_mobile_meram_suspend, |
diff --git a/drivers/video/vt8500lcdfb.c b/drivers/video/vt8500lcdfb.c index b30e5a439d1f..a8f2b280f796 100644 --- a/drivers/video/vt8500lcdfb.c +++ b/drivers/video/vt8500lcdfb.c | |||
@@ -293,8 +293,7 @@ static int vt8500lcd_probe(struct platform_device *pdev) | |||
293 | + sizeof(u32) * 16, GFP_KERNEL); | 293 | + sizeof(u32) * 16, GFP_KERNEL); |
294 | if (!fbi) { | 294 | if (!fbi) { |
295 | dev_err(&pdev->dev, "Failed to initialize framebuffer device\n"); | 295 | dev_err(&pdev->dev, "Failed to initialize framebuffer device\n"); |
296 | ret = -ENOMEM; | 296 | return -ENOMEM; |
297 | goto failed; | ||
298 | } | 297 | } |
299 | 298 | ||
300 | strcpy(fbi->fb.fix.id, "VT8500 LCD"); | 299 | strcpy(fbi->fb.fix.id, "VT8500 LCD"); |
@@ -327,15 +326,13 @@ static int vt8500lcd_probe(struct platform_device *pdev) | |||
327 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 326 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
328 | if (res == NULL) { | 327 | if (res == NULL) { |
329 | dev_err(&pdev->dev, "no I/O memory resource defined\n"); | 328 | dev_err(&pdev->dev, "no I/O memory resource defined\n"); |
330 | ret = -ENODEV; | 329 | return -ENODEV; |
331 | goto failed_fbi; | ||
332 | } | 330 | } |
333 | 331 | ||
334 | res = request_mem_region(res->start, resource_size(res), "vt8500lcd"); | 332 | res = request_mem_region(res->start, resource_size(res), "vt8500lcd"); |
335 | if (res == NULL) { | 333 | if (res == NULL) { |
336 | dev_err(&pdev->dev, "failed to request I/O memory\n"); | 334 | dev_err(&pdev->dev, "failed to request I/O memory\n"); |
337 | ret = -EBUSY; | 335 | return -EBUSY; |
338 | goto failed_fbi; | ||
339 | } | 336 | } |
340 | 337 | ||
341 | fbi->regbase = ioremap(res->start, resource_size(res)); | 338 | fbi->regbase = ioremap(res->start, resource_size(res)); |
@@ -346,17 +343,19 @@ static int vt8500lcd_probe(struct platform_device *pdev) | |||
346 | } | 343 | } |
347 | 344 | ||
348 | disp_timing = of_get_display_timings(pdev->dev.of_node); | 345 | disp_timing = of_get_display_timings(pdev->dev.of_node); |
349 | if (!disp_timing) | 346 | if (!disp_timing) { |
350 | return -EINVAL; | 347 | ret = -EINVAL; |
348 | goto failed_free_io; | ||
349 | } | ||
351 | 350 | ||
352 | ret = of_get_fb_videomode(pdev->dev.of_node, &of_mode, | 351 | ret = of_get_fb_videomode(pdev->dev.of_node, &of_mode, |
353 | OF_USE_NATIVE_MODE); | 352 | OF_USE_NATIVE_MODE); |
354 | if (ret) | 353 | if (ret) |
355 | return ret; | 354 | goto failed_free_io; |
356 | 355 | ||
357 | ret = of_property_read_u32(pdev->dev.of_node, "bits-per-pixel", &bpp); | 356 | ret = of_property_read_u32(pdev->dev.of_node, "bits-per-pixel", &bpp); |
358 | if (ret) | 357 | if (ret) |
359 | return ret; | 358 | goto failed_free_io; |
360 | 359 | ||
361 | /* try allocating the framebuffer */ | 360 | /* try allocating the framebuffer */ |
362 | fb_mem_len = of_mode.xres * of_mode.yres * 2 * (bpp / 8); | 361 | fb_mem_len = of_mode.xres * of_mode.yres * 2 * (bpp / 8); |
@@ -364,7 +363,8 @@ static int vt8500lcd_probe(struct platform_device *pdev) | |||
364 | GFP_KERNEL); | 363 | GFP_KERNEL); |
365 | if (!fb_mem_virt) { | 364 | if (!fb_mem_virt) { |
366 | pr_err("%s: Failed to allocate framebuffer\n", __func__); | 365 | pr_err("%s: Failed to allocate framebuffer\n", __func__); |
367 | return -ENOMEM; | 366 | ret = -ENOMEM; |
367 | goto failed_free_io; | ||
368 | } | 368 | } |
369 | 369 | ||
370 | fbi->fb.fix.smem_start = fb_mem_phys; | 370 | fbi->fb.fix.smem_start = fb_mem_phys; |
@@ -447,9 +447,6 @@ failed_free_io: | |||
447 | iounmap(fbi->regbase); | 447 | iounmap(fbi->regbase); |
448 | failed_free_res: | 448 | failed_free_res: |
449 | release_mem_region(res->start, resource_size(res)); | 449 | release_mem_region(res->start, resource_size(res)); |
450 | failed_fbi: | ||
451 | kfree(fbi); | ||
452 | failed: | ||
453 | return ret; | 450 | return ret; |
454 | } | 451 | } |
455 | 452 | ||
diff --git a/drivers/watchdog/bcm2835_wdt.c b/drivers/watchdog/bcm2835_wdt.c index a6a2cebb2587..cafa973c43be 100644 --- a/drivers/watchdog/bcm2835_wdt.c +++ b/drivers/watchdog/bcm2835_wdt.c | |||
@@ -19,7 +19,6 @@ | |||
19 | #include <linux/watchdog.h> | 19 | #include <linux/watchdog.h> |
20 | #include <linux/platform_device.h> | 20 | #include <linux/platform_device.h> |
21 | #include <linux/of_address.h> | 21 | #include <linux/of_address.h> |
22 | #include <linux/miscdevice.h> | ||
23 | 22 | ||
24 | #define PM_RSTC 0x1c | 23 | #define PM_RSTC 0x1c |
25 | #define PM_WDOG 0x24 | 24 | #define PM_WDOG 0x24 |
diff --git a/drivers/watchdog/ep93xx_wdt.c b/drivers/watchdog/ep93xx_wdt.c index 833e81311848..d1d07f2f69df 100644 --- a/drivers/watchdog/ep93xx_wdt.c +++ b/drivers/watchdog/ep93xx_wdt.c | |||
@@ -28,7 +28,6 @@ | |||
28 | 28 | ||
29 | #include <linux/platform_device.h> | 29 | #include <linux/platform_device.h> |
30 | #include <linux/module.h> | 30 | #include <linux/module.h> |
31 | #include <linux/miscdevice.h> | ||
32 | #include <linux/watchdog.h> | 31 | #include <linux/watchdog.h> |
33 | #include <linux/timer.h> | 32 | #include <linux/timer.h> |
34 | #include <linux/io.h> | 33 | #include <linux/io.h> |
diff --git a/drivers/watchdog/ie6xx_wdt.c b/drivers/watchdog/ie6xx_wdt.c index 70a240297c6d..07f88f54e5c0 100644 --- a/drivers/watchdog/ie6xx_wdt.c +++ b/drivers/watchdog/ie6xx_wdt.c | |||
@@ -28,7 +28,6 @@ | |||
28 | #include <linux/kernel.h> | 28 | #include <linux/kernel.h> |
29 | #include <linux/types.h> | 29 | #include <linux/types.h> |
30 | #include <linux/watchdog.h> | 30 | #include <linux/watchdog.h> |
31 | #include <linux/miscdevice.h> | ||
32 | #include <linux/seq_file.h> | 31 | #include <linux/seq_file.h> |
33 | #include <linux/debugfs.h> | 32 | #include <linux/debugfs.h> |
34 | #include <linux/uaccess.h> | 33 | #include <linux/uaccess.h> |
diff --git a/drivers/watchdog/jz4740_wdt.c b/drivers/watchdog/jz4740_wdt.c index 2de486a7eea1..3aa50cfa335f 100644 --- a/drivers/watchdog/jz4740_wdt.c +++ b/drivers/watchdog/jz4740_wdt.c | |||
@@ -17,7 +17,6 @@ | |||
17 | #include <linux/moduleparam.h> | 17 | #include <linux/moduleparam.h> |
18 | #include <linux/types.h> | 18 | #include <linux/types.h> |
19 | #include <linux/kernel.h> | 19 | #include <linux/kernel.h> |
20 | #include <linux/miscdevice.h> | ||
21 | #include <linux/watchdog.h> | 20 | #include <linux/watchdog.h> |
22 | #include <linux/init.h> | 21 | #include <linux/init.h> |
23 | #include <linux/platform_device.h> | 22 | #include <linux/platform_device.h> |
diff --git a/drivers/watchdog/kempld_wdt.c b/drivers/watchdog/kempld_wdt.c index a1a3638c579c..20dc73844737 100644 --- a/drivers/watchdog/kempld_wdt.c +++ b/drivers/watchdog/kempld_wdt.c | |||
@@ -26,7 +26,6 @@ | |||
26 | 26 | ||
27 | #include <linux/module.h> | 27 | #include <linux/module.h> |
28 | #include <linux/moduleparam.h> | 28 | #include <linux/moduleparam.h> |
29 | #include <linux/miscdevice.h> | ||
30 | #include <linux/uaccess.h> | 29 | #include <linux/uaccess.h> |
31 | #include <linux/watchdog.h> | 30 | #include <linux/watchdog.h> |
32 | #include <linux/platform_device.h> | 31 | #include <linux/platform_device.h> |
diff --git a/drivers/watchdog/max63xx_wdt.c b/drivers/watchdog/max63xx_wdt.c index 6d4f3998e1f6..bdb3f4a5b27c 100644 --- a/drivers/watchdog/max63xx_wdt.c +++ b/drivers/watchdog/max63xx_wdt.c | |||
@@ -19,7 +19,6 @@ | |||
19 | #include <linux/moduleparam.h> | 19 | #include <linux/moduleparam.h> |
20 | #include <linux/types.h> | 20 | #include <linux/types.h> |
21 | #include <linux/kernel.h> | 21 | #include <linux/kernel.h> |
22 | #include <linux/miscdevice.h> | ||
23 | #include <linux/watchdog.h> | 22 | #include <linux/watchdog.h> |
24 | #include <linux/init.h> | 23 | #include <linux/init.h> |
25 | #include <linux/bitops.h> | 24 | #include <linux/bitops.h> |
diff --git a/drivers/watchdog/orion_wdt.c b/drivers/watchdog/orion_wdt.c index 44edca66d564..f7722a424676 100644 --- a/drivers/watchdog/orion_wdt.c +++ b/drivers/watchdog/orion_wdt.c | |||
@@ -16,7 +16,6 @@ | |||
16 | #include <linux/moduleparam.h> | 16 | #include <linux/moduleparam.h> |
17 | #include <linux/types.h> | 17 | #include <linux/types.h> |
18 | #include <linux/kernel.h> | 18 | #include <linux/kernel.h> |
19 | #include <linux/miscdevice.h> | ||
20 | #include <linux/platform_device.h> | 19 | #include <linux/platform_device.h> |
21 | #include <linux/watchdog.h> | 20 | #include <linux/watchdog.h> |
22 | #include <linux/init.h> | 21 | #include <linux/init.h> |
diff --git a/drivers/watchdog/pnx4008_wdt.c b/drivers/watchdog/pnx4008_wdt.c index 1bdcc313e1d9..5bec20f5dc2d 100644 --- a/drivers/watchdog/pnx4008_wdt.c +++ b/drivers/watchdog/pnx4008_wdt.c | |||
@@ -23,7 +23,6 @@ | |||
23 | #include <linux/moduleparam.h> | 23 | #include <linux/moduleparam.h> |
24 | #include <linux/types.h> | 24 | #include <linux/types.h> |
25 | #include <linux/kernel.h> | 25 | #include <linux/kernel.h> |
26 | #include <linux/miscdevice.h> | ||
27 | #include <linux/watchdog.h> | 26 | #include <linux/watchdog.h> |
28 | #include <linux/init.h> | 27 | #include <linux/init.h> |
29 | #include <linux/platform_device.h> | 28 | #include <linux/platform_device.h> |
diff --git a/drivers/watchdog/rt2880_wdt.c b/drivers/watchdog/rt2880_wdt.c index 53d37fea183e..d92c2d5859ce 100644 --- a/drivers/watchdog/rt2880_wdt.c +++ b/drivers/watchdog/rt2880_wdt.c | |||
@@ -16,7 +16,6 @@ | |||
16 | #include <linux/module.h> | 16 | #include <linux/module.h> |
17 | #include <linux/kernel.h> | 17 | #include <linux/kernel.h> |
18 | #include <linux/watchdog.h> | 18 | #include <linux/watchdog.h> |
19 | #include <linux/miscdevice.h> | ||
20 | #include <linux/moduleparam.h> | 19 | #include <linux/moduleparam.h> |
21 | #include <linux/platform_device.h> | 20 | #include <linux/platform_device.h> |
22 | 21 | ||
diff --git a/drivers/watchdog/sc1200wdt.c b/drivers/watchdog/sc1200wdt.c index 3b9fff9dcf65..131193a7acdf 100644 --- a/drivers/watchdog/sc1200wdt.c +++ b/drivers/watchdog/sc1200wdt.c | |||
@@ -409,8 +409,9 @@ static int __init sc1200wdt_init(void) | |||
409 | #if defined CONFIG_PNP | 409 | #if defined CONFIG_PNP |
410 | /* now that the user has specified an IO port and we haven't detected | 410 | /* now that the user has specified an IO port and we haven't detected |
411 | * any devices, disable pnp support */ | 411 | * any devices, disable pnp support */ |
412 | if (isapnp) | ||
413 | pnp_unregister_driver(&scl200wdt_pnp_driver); | ||
412 | isapnp = 0; | 414 | isapnp = 0; |
413 | pnp_unregister_driver(&scl200wdt_pnp_driver); | ||
414 | #endif | 415 | #endif |
415 | 416 | ||
416 | if (!request_region(io, io_len, SC1200_MODULE_NAME)) { | 417 | if (!request_region(io, io_len, SC1200_MODULE_NAME)) { |
diff --git a/drivers/watchdog/shwdt.c b/drivers/watchdog/shwdt.c index f9b8e06f3558..af3528f84d65 100644 --- a/drivers/watchdog/shwdt.c +++ b/drivers/watchdog/shwdt.c | |||
@@ -26,7 +26,6 @@ | |||
26 | #include <linux/init.h> | 26 | #include <linux/init.h> |
27 | #include <linux/types.h> | 27 | #include <linux/types.h> |
28 | #include <linux/spinlock.h> | 28 | #include <linux/spinlock.h> |
29 | #include <linux/miscdevice.h> | ||
30 | #include <linux/watchdog.h> | 29 | #include <linux/watchdog.h> |
31 | #include <linux/pm_runtime.h> | 30 | #include <linux/pm_runtime.h> |
32 | #include <linux/fs.h> | 31 | #include <linux/fs.h> |
diff --git a/drivers/watchdog/softdog.c b/drivers/watchdog/softdog.c index ef2638fee4a8..c04a1aa158e2 100644 --- a/drivers/watchdog/softdog.c +++ b/drivers/watchdog/softdog.c | |||
@@ -42,7 +42,6 @@ | |||
42 | #include <linux/moduleparam.h> | 42 | #include <linux/moduleparam.h> |
43 | #include <linux/types.h> | 43 | #include <linux/types.h> |
44 | #include <linux/timer.h> | 44 | #include <linux/timer.h> |
45 | #include <linux/miscdevice.h> | ||
46 | #include <linux/watchdog.h> | 45 | #include <linux/watchdog.h> |
47 | #include <linux/notifier.h> | 46 | #include <linux/notifier.h> |
48 | #include <linux/reboot.h> | 47 | #include <linux/reboot.h> |
diff --git a/drivers/watchdog/stmp3xxx_rtc_wdt.c b/drivers/watchdog/stmp3xxx_rtc_wdt.c index d667f6b51d35..bb64ae3f47da 100644 --- a/drivers/watchdog/stmp3xxx_rtc_wdt.c +++ b/drivers/watchdog/stmp3xxx_rtc_wdt.c | |||
@@ -12,7 +12,6 @@ | |||
12 | #include <linux/init.h> | 12 | #include <linux/init.h> |
13 | #include <linux/kernel.h> | 13 | #include <linux/kernel.h> |
14 | #include <linux/module.h> | 14 | #include <linux/module.h> |
15 | #include <linux/miscdevice.h> | ||
16 | #include <linux/watchdog.h> | 15 | #include <linux/watchdog.h> |
17 | #include <linux/platform_device.h> | 16 | #include <linux/platform_device.h> |
18 | #include <linux/stmp3xxx_rtc_wdt.h> | 17 | #include <linux/stmp3xxx_rtc_wdt.h> |
diff --git a/drivers/watchdog/txx9wdt.c b/drivers/watchdog/txx9wdt.c index 0fd0e8ae62a8..6a447e321dd0 100644 --- a/drivers/watchdog/txx9wdt.c +++ b/drivers/watchdog/txx9wdt.c | |||
@@ -13,7 +13,6 @@ | |||
13 | #include <linux/module.h> | 13 | #include <linux/module.h> |
14 | #include <linux/moduleparam.h> | 14 | #include <linux/moduleparam.h> |
15 | #include <linux/types.h> | 15 | #include <linux/types.h> |
16 | #include <linux/miscdevice.h> | ||
17 | #include <linux/watchdog.h> | 16 | #include <linux/watchdog.h> |
18 | #include <linux/init.h> | 17 | #include <linux/init.h> |
19 | #include <linux/platform_device.h> | 18 | #include <linux/platform_device.h> |
diff --git a/drivers/watchdog/ux500_wdt.c b/drivers/watchdog/ux500_wdt.c index e029b5768f2c..5aed9d7ad47e 100644 --- a/drivers/watchdog/ux500_wdt.c +++ b/drivers/watchdog/ux500_wdt.c | |||
@@ -12,7 +12,6 @@ | |||
12 | #include <linux/module.h> | 12 | #include <linux/module.h> |
13 | #include <linux/kernel.h> | 13 | #include <linux/kernel.h> |
14 | #include <linux/moduleparam.h> | 14 | #include <linux/moduleparam.h> |
15 | #include <linux/miscdevice.h> | ||
16 | #include <linux/err.h> | 15 | #include <linux/err.h> |
17 | #include <linux/uaccess.h> | 16 | #include <linux/uaccess.h> |
18 | #include <linux/watchdog.h> | 17 | #include <linux/watchdog.h> |
diff --git a/drivers/xen/grant-table.c b/drivers/xen/grant-table.c index 62ccf5424ba8..028387192b60 100644 --- a/drivers/xen/grant-table.c +++ b/drivers/xen/grant-table.c | |||
@@ -930,9 +930,10 @@ int gnttab_map_refs(struct gnttab_map_grant_ref *map_ops, | |||
930 | ret = m2p_add_override(mfn, pages[i], kmap_ops ? | 930 | ret = m2p_add_override(mfn, pages[i], kmap_ops ? |
931 | &kmap_ops[i] : NULL); | 931 | &kmap_ops[i] : NULL); |
932 | if (ret) | 932 | if (ret) |
933 | return ret; | 933 | goto out; |
934 | } | 934 | } |
935 | 935 | ||
936 | out: | ||
936 | if (lazy) | 937 | if (lazy) |
937 | arch_leave_lazy_mmu_mode(); | 938 | arch_leave_lazy_mmu_mode(); |
938 | 939 | ||
@@ -969,9 +970,10 @@ int gnttab_unmap_refs(struct gnttab_unmap_grant_ref *unmap_ops, | |||
969 | ret = m2p_remove_override(pages[i], kmap_ops ? | 970 | ret = m2p_remove_override(pages[i], kmap_ops ? |
970 | &kmap_ops[i] : NULL); | 971 | &kmap_ops[i] : NULL); |
971 | if (ret) | 972 | if (ret) |
972 | return ret; | 973 | goto out; |
973 | } | 974 | } |
974 | 975 | ||
976 | out: | ||
975 | if (lazy) | 977 | if (lazy) |
976 | arch_leave_lazy_mmu_mode(); | 978 | arch_leave_lazy_mmu_mode(); |
977 | 979 | ||
diff --git a/drivers/xen/swiotlb-xen.c b/drivers/xen/swiotlb-xen.c index a224bc74b6b9..1eac0731c349 100644 --- a/drivers/xen/swiotlb-xen.c +++ b/drivers/xen/swiotlb-xen.c | |||
@@ -555,6 +555,11 @@ xen_swiotlb_map_sg_attrs(struct device *hwdev, struct scatterlist *sgl, | |||
555 | sg_dma_len(sgl) = 0; | 555 | sg_dma_len(sgl) = 0; |
556 | return 0; | 556 | return 0; |
557 | } | 557 | } |
558 | xen_dma_map_page(hwdev, pfn_to_page(map >> PAGE_SHIFT), | ||
559 | map & ~PAGE_MASK, | ||
560 | sg->length, | ||
561 | dir, | ||
562 | attrs); | ||
558 | sg->dma_address = xen_phys_to_bus(map); | 563 | sg->dma_address = xen_phys_to_bus(map); |
559 | } else { | 564 | } else { |
560 | /* we are not interested in the dma_addr returned by | 565 | /* we are not interested in the dma_addr returned by |
@@ -367,8 +367,10 @@ static int aio_setup_ring(struct kioctx *ctx) | |||
367 | if (nr_pages > AIO_RING_PAGES) { | 367 | if (nr_pages > AIO_RING_PAGES) { |
368 | ctx->ring_pages = kcalloc(nr_pages, sizeof(struct page *), | 368 | ctx->ring_pages = kcalloc(nr_pages, sizeof(struct page *), |
369 | GFP_KERNEL); | 369 | GFP_KERNEL); |
370 | if (!ctx->ring_pages) | 370 | if (!ctx->ring_pages) { |
371 | put_aio_ring_file(ctx); | ||
371 | return -ENOMEM; | 372 | return -ENOMEM; |
373 | } | ||
372 | } | 374 | } |
373 | 375 | ||
374 | ctx->mmap_size = nr_pages * PAGE_SIZE; | 376 | ctx->mmap_size = nr_pages * PAGE_SIZE; |
@@ -645,7 +647,7 @@ static struct kioctx *ioctx_alloc(unsigned nr_events) | |||
645 | aio_nr + nr_events < aio_nr) { | 647 | aio_nr + nr_events < aio_nr) { |
646 | spin_unlock(&aio_nr_lock); | 648 | spin_unlock(&aio_nr_lock); |
647 | err = -EAGAIN; | 649 | err = -EAGAIN; |
648 | goto err; | 650 | goto err_ctx; |
649 | } | 651 | } |
650 | aio_nr += ctx->max_reqs; | 652 | aio_nr += ctx->max_reqs; |
651 | spin_unlock(&aio_nr_lock); | 653 | spin_unlock(&aio_nr_lock); |
@@ -662,6 +664,8 @@ static struct kioctx *ioctx_alloc(unsigned nr_events) | |||
662 | 664 | ||
663 | err_cleanup: | 665 | err_cleanup: |
664 | aio_nr_sub(ctx->max_reqs); | 666 | aio_nr_sub(ctx->max_reqs); |
667 | err_ctx: | ||
668 | aio_free_ring(ctx); | ||
665 | err: | 669 | err: |
666 | free_percpu(ctx->cpu); | 670 | free_percpu(ctx->cpu); |
667 | free_percpu(ctx->reqs.pcpu_count); | 671 | free_percpu(ctx->reqs.pcpu_count); |
diff --git a/fs/btrfs/check-integrity.c b/fs/btrfs/check-integrity.c index b50764bef141..131d82800b3a 100644 --- a/fs/btrfs/check-integrity.c +++ b/fs/btrfs/check-integrity.c | |||
@@ -333,7 +333,6 @@ static void btrfsic_release_block_ctx(struct btrfsic_block_data_ctx *block_ctx); | |||
333 | static int btrfsic_read_block(struct btrfsic_state *state, | 333 | static int btrfsic_read_block(struct btrfsic_state *state, |
334 | struct btrfsic_block_data_ctx *block_ctx); | 334 | struct btrfsic_block_data_ctx *block_ctx); |
335 | static void btrfsic_dump_database(struct btrfsic_state *state); | 335 | static void btrfsic_dump_database(struct btrfsic_state *state); |
336 | static void btrfsic_complete_bio_end_io(struct bio *bio, int err); | ||
337 | static int btrfsic_test_for_metadata(struct btrfsic_state *state, | 336 | static int btrfsic_test_for_metadata(struct btrfsic_state *state, |
338 | char **datav, unsigned int num_pages); | 337 | char **datav, unsigned int num_pages); |
339 | static void btrfsic_process_written_block(struct btrfsic_dev_state *dev_state, | 338 | static void btrfsic_process_written_block(struct btrfsic_dev_state *dev_state, |
@@ -1687,7 +1686,6 @@ static int btrfsic_read_block(struct btrfsic_state *state, | |||
1687 | for (i = 0; i < num_pages;) { | 1686 | for (i = 0; i < num_pages;) { |
1688 | struct bio *bio; | 1687 | struct bio *bio; |
1689 | unsigned int j; | 1688 | unsigned int j; |
1690 | DECLARE_COMPLETION_ONSTACK(complete); | ||
1691 | 1689 | ||
1692 | bio = btrfs_io_bio_alloc(GFP_NOFS, num_pages - i); | 1690 | bio = btrfs_io_bio_alloc(GFP_NOFS, num_pages - i); |
1693 | if (!bio) { | 1691 | if (!bio) { |
@@ -1698,8 +1696,6 @@ static int btrfsic_read_block(struct btrfsic_state *state, | |||
1698 | } | 1696 | } |
1699 | bio->bi_bdev = block_ctx->dev->bdev; | 1697 | bio->bi_bdev = block_ctx->dev->bdev; |
1700 | bio->bi_sector = dev_bytenr >> 9; | 1698 | bio->bi_sector = dev_bytenr >> 9; |
1701 | bio->bi_end_io = btrfsic_complete_bio_end_io; | ||
1702 | bio->bi_private = &complete; | ||
1703 | 1699 | ||
1704 | for (j = i; j < num_pages; j++) { | 1700 | for (j = i; j < num_pages; j++) { |
1705 | ret = bio_add_page(bio, block_ctx->pagev[j], | 1701 | ret = bio_add_page(bio, block_ctx->pagev[j], |
@@ -1712,12 +1708,7 @@ static int btrfsic_read_block(struct btrfsic_state *state, | |||
1712 | "btrfsic: error, failed to add a single page!\n"); | 1708 | "btrfsic: error, failed to add a single page!\n"); |
1713 | return -1; | 1709 | return -1; |
1714 | } | 1710 | } |
1715 | submit_bio(READ, bio); | 1711 | if (submit_bio_wait(READ, bio)) { |
1716 | |||
1717 | /* this will also unplug the queue */ | ||
1718 | wait_for_completion(&complete); | ||
1719 | |||
1720 | if (!test_bit(BIO_UPTODATE, &bio->bi_flags)) { | ||
1721 | printk(KERN_INFO | 1712 | printk(KERN_INFO |
1722 | "btrfsic: read error at logical %llu dev %s!\n", | 1713 | "btrfsic: read error at logical %llu dev %s!\n", |
1723 | block_ctx->start, block_ctx->dev->name); | 1714 | block_ctx->start, block_ctx->dev->name); |
@@ -1740,11 +1731,6 @@ static int btrfsic_read_block(struct btrfsic_state *state, | |||
1740 | return block_ctx->len; | 1731 | return block_ctx->len; |
1741 | } | 1732 | } |
1742 | 1733 | ||
1743 | static void btrfsic_complete_bio_end_io(struct bio *bio, int err) | ||
1744 | { | ||
1745 | complete((struct completion *)bio->bi_private); | ||
1746 | } | ||
1747 | |||
1748 | static void btrfsic_dump_database(struct btrfsic_state *state) | 1734 | static void btrfsic_dump_database(struct btrfsic_state *state) |
1749 | { | 1735 | { |
1750 | struct list_head *elem_all; | 1736 | struct list_head *elem_all; |
@@ -3008,14 +2994,12 @@ int btrfsic_submit_bh(int rw, struct buffer_head *bh) | |||
3008 | return submit_bh(rw, bh); | 2994 | return submit_bh(rw, bh); |
3009 | } | 2995 | } |
3010 | 2996 | ||
3011 | void btrfsic_submit_bio(int rw, struct bio *bio) | 2997 | static void __btrfsic_submit_bio(int rw, struct bio *bio) |
3012 | { | 2998 | { |
3013 | struct btrfsic_dev_state *dev_state; | 2999 | struct btrfsic_dev_state *dev_state; |
3014 | 3000 | ||
3015 | if (!btrfsic_is_initialized) { | 3001 | if (!btrfsic_is_initialized) |
3016 | submit_bio(rw, bio); | ||
3017 | return; | 3002 | return; |
3018 | } | ||
3019 | 3003 | ||
3020 | mutex_lock(&btrfsic_mutex); | 3004 | mutex_lock(&btrfsic_mutex); |
3021 | /* since btrfsic_submit_bio() is also called before | 3005 | /* since btrfsic_submit_bio() is also called before |
@@ -3106,10 +3090,20 @@ void btrfsic_submit_bio(int rw, struct bio *bio) | |||
3106 | } | 3090 | } |
3107 | leave: | 3091 | leave: |
3108 | mutex_unlock(&btrfsic_mutex); | 3092 | mutex_unlock(&btrfsic_mutex); |
3093 | } | ||
3109 | 3094 | ||
3095 | void btrfsic_submit_bio(int rw, struct bio *bio) | ||
3096 | { | ||
3097 | __btrfsic_submit_bio(rw, bio); | ||
3110 | submit_bio(rw, bio); | 3098 | submit_bio(rw, bio); |
3111 | } | 3099 | } |
3112 | 3100 | ||
3101 | int btrfsic_submit_bio_wait(int rw, struct bio *bio) | ||
3102 | { | ||
3103 | __btrfsic_submit_bio(rw, bio); | ||
3104 | return submit_bio_wait(rw, bio); | ||
3105 | } | ||
3106 | |||
3113 | int btrfsic_mount(struct btrfs_root *root, | 3107 | int btrfsic_mount(struct btrfs_root *root, |
3114 | struct btrfs_fs_devices *fs_devices, | 3108 | struct btrfs_fs_devices *fs_devices, |
3115 | int including_extent_data, u32 print_mask) | 3109 | int including_extent_data, u32 print_mask) |
diff --git a/fs/btrfs/check-integrity.h b/fs/btrfs/check-integrity.h index 8b59175cc502..13b8566c97ab 100644 --- a/fs/btrfs/check-integrity.h +++ b/fs/btrfs/check-integrity.h | |||
@@ -22,9 +22,11 @@ | |||
22 | #ifdef CONFIG_BTRFS_FS_CHECK_INTEGRITY | 22 | #ifdef CONFIG_BTRFS_FS_CHECK_INTEGRITY |
23 | int btrfsic_submit_bh(int rw, struct buffer_head *bh); | 23 | int btrfsic_submit_bh(int rw, struct buffer_head *bh); |
24 | void btrfsic_submit_bio(int rw, struct bio *bio); | 24 | void btrfsic_submit_bio(int rw, struct bio *bio); |
25 | int btrfsic_submit_bio_wait(int rw, struct bio *bio); | ||
25 | #else | 26 | #else |
26 | #define btrfsic_submit_bh submit_bh | 27 | #define btrfsic_submit_bh submit_bh |
27 | #define btrfsic_submit_bio submit_bio | 28 | #define btrfsic_submit_bio submit_bio |
29 | #define btrfsic_submit_bio_wait submit_bio_wait | ||
28 | #endif | 30 | #endif |
29 | 31 | ||
30 | int btrfsic_mount(struct btrfs_root *root, | 32 | int btrfsic_mount(struct btrfs_root *root, |
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index 45d98d01028f..9c01509dd8ab 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c | |||
@@ -767,20 +767,19 @@ int btrfs_lookup_extent_info(struct btrfs_trans_handle *trans, | |||
767 | if (!path) | 767 | if (!path) |
768 | return -ENOMEM; | 768 | return -ENOMEM; |
769 | 769 | ||
770 | if (metadata) { | ||
771 | key.objectid = bytenr; | ||
772 | key.type = BTRFS_METADATA_ITEM_KEY; | ||
773 | key.offset = offset; | ||
774 | } else { | ||
775 | key.objectid = bytenr; | ||
776 | key.type = BTRFS_EXTENT_ITEM_KEY; | ||
777 | key.offset = offset; | ||
778 | } | ||
779 | |||
780 | if (!trans) { | 770 | if (!trans) { |
781 | path->skip_locking = 1; | 771 | path->skip_locking = 1; |
782 | path->search_commit_root = 1; | 772 | path->search_commit_root = 1; |
783 | } | 773 | } |
774 | |||
775 | search_again: | ||
776 | key.objectid = bytenr; | ||
777 | key.offset = offset; | ||
778 | if (metadata) | ||
779 | key.type = BTRFS_METADATA_ITEM_KEY; | ||
780 | else | ||
781 | key.type = BTRFS_EXTENT_ITEM_KEY; | ||
782 | |||
784 | again: | 783 | again: |
785 | ret = btrfs_search_slot(trans, root->fs_info->extent_root, | 784 | ret = btrfs_search_slot(trans, root->fs_info->extent_root, |
786 | &key, path, 0, 0); | 785 | &key, path, 0, 0); |
@@ -788,7 +787,6 @@ again: | |||
788 | goto out_free; | 787 | goto out_free; |
789 | 788 | ||
790 | if (ret > 0 && metadata && key.type == BTRFS_METADATA_ITEM_KEY) { | 789 | if (ret > 0 && metadata && key.type == BTRFS_METADATA_ITEM_KEY) { |
791 | metadata = 0; | ||
792 | if (path->slots[0]) { | 790 | if (path->slots[0]) { |
793 | path->slots[0]--; | 791 | path->slots[0]--; |
794 | btrfs_item_key_to_cpu(path->nodes[0], &key, | 792 | btrfs_item_key_to_cpu(path->nodes[0], &key, |
@@ -855,7 +853,7 @@ again: | |||
855 | mutex_lock(&head->mutex); | 853 | mutex_lock(&head->mutex); |
856 | mutex_unlock(&head->mutex); | 854 | mutex_unlock(&head->mutex); |
857 | btrfs_put_delayed_ref(&head->node); | 855 | btrfs_put_delayed_ref(&head->node); |
858 | goto again; | 856 | goto search_again; |
859 | } | 857 | } |
860 | if (head->extent_op && head->extent_op->update_flags) | 858 | if (head->extent_op && head->extent_op->update_flags) |
861 | extent_flags |= head->extent_op->flags_to_set; | 859 | extent_flags |= head->extent_op->flags_to_set; |
diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c index 8e457fca0a0b..ff43802a7c88 100644 --- a/fs/btrfs/extent_io.c +++ b/fs/btrfs/extent_io.c | |||
@@ -1952,11 +1952,6 @@ static int free_io_failure(struct inode *inode, struct io_failure_record *rec, | |||
1952 | return err; | 1952 | return err; |
1953 | } | 1953 | } |
1954 | 1954 | ||
1955 | static void repair_io_failure_callback(struct bio *bio, int err) | ||
1956 | { | ||
1957 | complete(bio->bi_private); | ||
1958 | } | ||
1959 | |||
1960 | /* | 1955 | /* |
1961 | * this bypasses the standard btrfs submit functions deliberately, as | 1956 | * this bypasses the standard btrfs submit functions deliberately, as |
1962 | * the standard behavior is to write all copies in a raid setup. here we only | 1957 | * the standard behavior is to write all copies in a raid setup. here we only |
@@ -1973,7 +1968,6 @@ int repair_io_failure(struct btrfs_fs_info *fs_info, u64 start, | |||
1973 | { | 1968 | { |
1974 | struct bio *bio; | 1969 | struct bio *bio; |
1975 | struct btrfs_device *dev; | 1970 | struct btrfs_device *dev; |
1976 | DECLARE_COMPLETION_ONSTACK(compl); | ||
1977 | u64 map_length = 0; | 1971 | u64 map_length = 0; |
1978 | u64 sector; | 1972 | u64 sector; |
1979 | struct btrfs_bio *bbio = NULL; | 1973 | struct btrfs_bio *bbio = NULL; |
@@ -1990,8 +1984,6 @@ int repair_io_failure(struct btrfs_fs_info *fs_info, u64 start, | |||
1990 | bio = btrfs_io_bio_alloc(GFP_NOFS, 1); | 1984 | bio = btrfs_io_bio_alloc(GFP_NOFS, 1); |
1991 | if (!bio) | 1985 | if (!bio) |
1992 | return -EIO; | 1986 | return -EIO; |
1993 | bio->bi_private = &compl; | ||
1994 | bio->bi_end_io = repair_io_failure_callback; | ||
1995 | bio->bi_size = 0; | 1987 | bio->bi_size = 0; |
1996 | map_length = length; | 1988 | map_length = length; |
1997 | 1989 | ||
@@ -2012,10 +2004,8 @@ int repair_io_failure(struct btrfs_fs_info *fs_info, u64 start, | |||
2012 | } | 2004 | } |
2013 | bio->bi_bdev = dev->bdev; | 2005 | bio->bi_bdev = dev->bdev; |
2014 | bio_add_page(bio, page, length, start - page_offset(page)); | 2006 | bio_add_page(bio, page, length, start - page_offset(page)); |
2015 | btrfsic_submit_bio(WRITE_SYNC, bio); | ||
2016 | wait_for_completion(&compl); | ||
2017 | 2007 | ||
2018 | if (!test_bit(BIO_UPTODATE, &bio->bi_flags)) { | 2008 | if (btrfsic_submit_bio_wait(WRITE_SYNC, bio)) { |
2019 | /* try to remap that extent elsewhere? */ | 2009 | /* try to remap that extent elsewhere? */ |
2020 | bio_put(bio); | 2010 | bio_put(bio); |
2021 | btrfs_dev_stat_inc_and_print(dev, BTRFS_DEV_STAT_WRITE_ERRS); | 2011 | btrfs_dev_stat_inc_and_print(dev, BTRFS_DEV_STAT_WRITE_ERRS); |
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index a111622598b0..21da5762b0b1 100644 --- a/fs/btrfs/ioctl.c +++ b/fs/btrfs/ioctl.c | |||
@@ -2121,7 +2121,7 @@ static noinline int btrfs_ioctl_snap_destroy(struct file *file, | |||
2121 | 2121 | ||
2122 | err = mutex_lock_killable_nested(&dir->i_mutex, I_MUTEX_PARENT); | 2122 | err = mutex_lock_killable_nested(&dir->i_mutex, I_MUTEX_PARENT); |
2123 | if (err == -EINTR) | 2123 | if (err == -EINTR) |
2124 | goto out; | 2124 | goto out_drop_write; |
2125 | dentry = lookup_one_len(vol_args->name, parent, namelen); | 2125 | dentry = lookup_one_len(vol_args->name, parent, namelen); |
2126 | if (IS_ERR(dentry)) { | 2126 | if (IS_ERR(dentry)) { |
2127 | err = PTR_ERR(dentry); | 2127 | err = PTR_ERR(dentry); |
@@ -2284,6 +2284,7 @@ out_dput: | |||
2284 | dput(dentry); | 2284 | dput(dentry); |
2285 | out_unlock_dir: | 2285 | out_unlock_dir: |
2286 | mutex_unlock(&dir->i_mutex); | 2286 | mutex_unlock(&dir->i_mutex); |
2287 | out_drop_write: | ||
2287 | mnt_drop_write_file(file); | 2288 | mnt_drop_write_file(file); |
2288 | out: | 2289 | out: |
2289 | kfree(vol_args); | 2290 | kfree(vol_args); |
diff --git a/fs/btrfs/relocation.c b/fs/btrfs/relocation.c index ce459a7cb16d..429c73c374b8 100644 --- a/fs/btrfs/relocation.c +++ b/fs/btrfs/relocation.c | |||
@@ -571,7 +571,9 @@ static int is_cowonly_root(u64 root_objectid) | |||
571 | root_objectid == BTRFS_CHUNK_TREE_OBJECTID || | 571 | root_objectid == BTRFS_CHUNK_TREE_OBJECTID || |
572 | root_objectid == BTRFS_DEV_TREE_OBJECTID || | 572 | root_objectid == BTRFS_DEV_TREE_OBJECTID || |
573 | root_objectid == BTRFS_TREE_LOG_OBJECTID || | 573 | root_objectid == BTRFS_TREE_LOG_OBJECTID || |
574 | root_objectid == BTRFS_CSUM_TREE_OBJECTID) | 574 | root_objectid == BTRFS_CSUM_TREE_OBJECTID || |
575 | root_objectid == BTRFS_UUID_TREE_OBJECTID || | ||
576 | root_objectid == BTRFS_QUOTA_TREE_OBJECTID) | ||
575 | return 1; | 577 | return 1; |
576 | return 0; | 578 | return 0; |
577 | } | 579 | } |
@@ -1264,10 +1266,10 @@ static int __must_check __add_reloc_root(struct btrfs_root *root) | |||
1264 | } | 1266 | } |
1265 | 1267 | ||
1266 | /* | 1268 | /* |
1267 | * helper to update/delete the 'address of tree root -> reloc tree' | 1269 | * helper to delete the 'address of tree root -> reloc tree' |
1268 | * mapping | 1270 | * mapping |
1269 | */ | 1271 | */ |
1270 | static int __update_reloc_root(struct btrfs_root *root, int del) | 1272 | static void __del_reloc_root(struct btrfs_root *root) |
1271 | { | 1273 | { |
1272 | struct rb_node *rb_node; | 1274 | struct rb_node *rb_node; |
1273 | struct mapping_node *node = NULL; | 1275 | struct mapping_node *node = NULL; |
@@ -1275,7 +1277,7 @@ static int __update_reloc_root(struct btrfs_root *root, int del) | |||
1275 | 1277 | ||
1276 | spin_lock(&rc->reloc_root_tree.lock); | 1278 | spin_lock(&rc->reloc_root_tree.lock); |
1277 | rb_node = tree_search(&rc->reloc_root_tree.rb_root, | 1279 | rb_node = tree_search(&rc->reloc_root_tree.rb_root, |
1278 | root->commit_root->start); | 1280 | root->node->start); |
1279 | if (rb_node) { | 1281 | if (rb_node) { |
1280 | node = rb_entry(rb_node, struct mapping_node, rb_node); | 1282 | node = rb_entry(rb_node, struct mapping_node, rb_node); |
1281 | rb_erase(&node->rb_node, &rc->reloc_root_tree.rb_root); | 1283 | rb_erase(&node->rb_node, &rc->reloc_root_tree.rb_root); |
@@ -1283,23 +1285,45 @@ static int __update_reloc_root(struct btrfs_root *root, int del) | |||
1283 | spin_unlock(&rc->reloc_root_tree.lock); | 1285 | spin_unlock(&rc->reloc_root_tree.lock); |
1284 | 1286 | ||
1285 | if (!node) | 1287 | if (!node) |
1286 | return 0; | 1288 | return; |
1287 | BUG_ON((struct btrfs_root *)node->data != root); | 1289 | BUG_ON((struct btrfs_root *)node->data != root); |
1288 | 1290 | ||
1289 | if (!del) { | 1291 | spin_lock(&root->fs_info->trans_lock); |
1290 | spin_lock(&rc->reloc_root_tree.lock); | 1292 | list_del_init(&root->root_list); |
1291 | node->bytenr = root->node->start; | 1293 | spin_unlock(&root->fs_info->trans_lock); |
1292 | rb_node = tree_insert(&rc->reloc_root_tree.rb_root, | 1294 | kfree(node); |
1293 | node->bytenr, &node->rb_node); | 1295 | } |
1294 | spin_unlock(&rc->reloc_root_tree.lock); | 1296 | |
1295 | if (rb_node) | 1297 | /* |
1296 | backref_tree_panic(rb_node, -EEXIST, node->bytenr); | 1298 | * helper to update the 'address of tree root -> reloc tree' |
1297 | } else { | 1299 | * mapping |
1298 | spin_lock(&root->fs_info->trans_lock); | 1300 | */ |
1299 | list_del_init(&root->root_list); | 1301 | static int __update_reloc_root(struct btrfs_root *root, u64 new_bytenr) |
1300 | spin_unlock(&root->fs_info->trans_lock); | 1302 | { |
1301 | kfree(node); | 1303 | struct rb_node *rb_node; |
1304 | struct mapping_node *node = NULL; | ||
1305 | struct reloc_control *rc = root->fs_info->reloc_ctl; | ||
1306 | |||
1307 | spin_lock(&rc->reloc_root_tree.lock); | ||
1308 | rb_node = tree_search(&rc->reloc_root_tree.rb_root, | ||
1309 | root->node->start); | ||
1310 | if (rb_node) { | ||
1311 | node = rb_entry(rb_node, struct mapping_node, rb_node); | ||
1312 | rb_erase(&node->rb_node, &rc->reloc_root_tree.rb_root); | ||
1302 | } | 1313 | } |
1314 | spin_unlock(&rc->reloc_root_tree.lock); | ||
1315 | |||
1316 | if (!node) | ||
1317 | return 0; | ||
1318 | BUG_ON((struct btrfs_root *)node->data != root); | ||
1319 | |||
1320 | spin_lock(&rc->reloc_root_tree.lock); | ||
1321 | node->bytenr = new_bytenr; | ||
1322 | rb_node = tree_insert(&rc->reloc_root_tree.rb_root, | ||
1323 | node->bytenr, &node->rb_node); | ||
1324 | spin_unlock(&rc->reloc_root_tree.lock); | ||
1325 | if (rb_node) | ||
1326 | backref_tree_panic(rb_node, -EEXIST, node->bytenr); | ||
1303 | return 0; | 1327 | return 0; |
1304 | } | 1328 | } |
1305 | 1329 | ||
@@ -1420,7 +1444,6 @@ int btrfs_update_reloc_root(struct btrfs_trans_handle *trans, | |||
1420 | { | 1444 | { |
1421 | struct btrfs_root *reloc_root; | 1445 | struct btrfs_root *reloc_root; |
1422 | struct btrfs_root_item *root_item; | 1446 | struct btrfs_root_item *root_item; |
1423 | int del = 0; | ||
1424 | int ret; | 1447 | int ret; |
1425 | 1448 | ||
1426 | if (!root->reloc_root) | 1449 | if (!root->reloc_root) |
@@ -1432,11 +1455,9 @@ int btrfs_update_reloc_root(struct btrfs_trans_handle *trans, | |||
1432 | if (root->fs_info->reloc_ctl->merge_reloc_tree && | 1455 | if (root->fs_info->reloc_ctl->merge_reloc_tree && |
1433 | btrfs_root_refs(root_item) == 0) { | 1456 | btrfs_root_refs(root_item) == 0) { |
1434 | root->reloc_root = NULL; | 1457 | root->reloc_root = NULL; |
1435 | del = 1; | 1458 | __del_reloc_root(reloc_root); |
1436 | } | 1459 | } |
1437 | 1460 | ||
1438 | __update_reloc_root(reloc_root, del); | ||
1439 | |||
1440 | if (reloc_root->commit_root != reloc_root->node) { | 1461 | if (reloc_root->commit_root != reloc_root->node) { |
1441 | btrfs_set_root_node(root_item, reloc_root->node); | 1462 | btrfs_set_root_node(root_item, reloc_root->node); |
1442 | free_extent_buffer(reloc_root->commit_root); | 1463 | free_extent_buffer(reloc_root->commit_root); |
@@ -2287,7 +2308,7 @@ void free_reloc_roots(struct list_head *list) | |||
2287 | while (!list_empty(list)) { | 2308 | while (!list_empty(list)) { |
2288 | reloc_root = list_entry(list->next, struct btrfs_root, | 2309 | reloc_root = list_entry(list->next, struct btrfs_root, |
2289 | root_list); | 2310 | root_list); |
2290 | __update_reloc_root(reloc_root, 1); | 2311 | __del_reloc_root(reloc_root); |
2291 | free_extent_buffer(reloc_root->node); | 2312 | free_extent_buffer(reloc_root->node); |
2292 | free_extent_buffer(reloc_root->commit_root); | 2313 | free_extent_buffer(reloc_root->commit_root); |
2293 | kfree(reloc_root); | 2314 | kfree(reloc_root); |
@@ -2332,7 +2353,7 @@ again: | |||
2332 | 2353 | ||
2333 | ret = merge_reloc_root(rc, root); | 2354 | ret = merge_reloc_root(rc, root); |
2334 | if (ret) { | 2355 | if (ret) { |
2335 | __update_reloc_root(reloc_root, 1); | 2356 | __del_reloc_root(reloc_root); |
2336 | free_extent_buffer(reloc_root->node); | 2357 | free_extent_buffer(reloc_root->node); |
2337 | free_extent_buffer(reloc_root->commit_root); | 2358 | free_extent_buffer(reloc_root->commit_root); |
2338 | kfree(reloc_root); | 2359 | kfree(reloc_root); |
@@ -2388,6 +2409,13 @@ out: | |||
2388 | btrfs_std_error(root->fs_info, ret); | 2409 | btrfs_std_error(root->fs_info, ret); |
2389 | if (!list_empty(&reloc_roots)) | 2410 | if (!list_empty(&reloc_roots)) |
2390 | free_reloc_roots(&reloc_roots); | 2411 | free_reloc_roots(&reloc_roots); |
2412 | |||
2413 | /* new reloc root may be added */ | ||
2414 | mutex_lock(&root->fs_info->reloc_mutex); | ||
2415 | list_splice_init(&rc->reloc_roots, &reloc_roots); | ||
2416 | mutex_unlock(&root->fs_info->reloc_mutex); | ||
2417 | if (!list_empty(&reloc_roots)) | ||
2418 | free_reloc_roots(&reloc_roots); | ||
2391 | } | 2419 | } |
2392 | 2420 | ||
2393 | BUG_ON(!RB_EMPTY_ROOT(&rc->reloc_root_tree.rb_root)); | 2421 | BUG_ON(!RB_EMPTY_ROOT(&rc->reloc_root_tree.rb_root)); |
@@ -4522,6 +4550,11 @@ int btrfs_reloc_cow_block(struct btrfs_trans_handle *trans, | |||
4522 | BUG_ON(rc->stage == UPDATE_DATA_PTRS && | 4550 | BUG_ON(rc->stage == UPDATE_DATA_PTRS && |
4523 | root->root_key.objectid == BTRFS_DATA_RELOC_TREE_OBJECTID); | 4551 | root->root_key.objectid == BTRFS_DATA_RELOC_TREE_OBJECTID); |
4524 | 4552 | ||
4553 | if (root->root_key.objectid == BTRFS_TREE_RELOC_OBJECTID) { | ||
4554 | if (buf == root->node) | ||
4555 | __update_reloc_root(root, cow->start); | ||
4556 | } | ||
4557 | |||
4525 | level = btrfs_header_level(buf); | 4558 | level = btrfs_header_level(buf); |
4526 | if (btrfs_header_generation(buf) <= | 4559 | if (btrfs_header_generation(buf) <= |
4527 | btrfs_root_last_snapshot(&root->root_item)) | 4560 | btrfs_root_last_snapshot(&root->root_item)) |
diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c index 561e2f16ba3e..1fd3f33c330a 100644 --- a/fs/btrfs/scrub.c +++ b/fs/btrfs/scrub.c | |||
@@ -208,7 +208,6 @@ static void scrub_recheck_block_checksum(struct btrfs_fs_info *fs_info, | |||
208 | int is_metadata, int have_csum, | 208 | int is_metadata, int have_csum, |
209 | const u8 *csum, u64 generation, | 209 | const u8 *csum, u64 generation, |
210 | u16 csum_size); | 210 | u16 csum_size); |
211 | static void scrub_complete_bio_end_io(struct bio *bio, int err); | ||
212 | static int scrub_repair_block_from_good_copy(struct scrub_block *sblock_bad, | 211 | static int scrub_repair_block_from_good_copy(struct scrub_block *sblock_bad, |
213 | struct scrub_block *sblock_good, | 212 | struct scrub_block *sblock_good, |
214 | int force_write); | 213 | int force_write); |
@@ -1294,7 +1293,6 @@ static void scrub_recheck_block(struct btrfs_fs_info *fs_info, | |||
1294 | for (page_num = 0; page_num < sblock->page_count; page_num++) { | 1293 | for (page_num = 0; page_num < sblock->page_count; page_num++) { |
1295 | struct bio *bio; | 1294 | struct bio *bio; |
1296 | struct scrub_page *page = sblock->pagev[page_num]; | 1295 | struct scrub_page *page = sblock->pagev[page_num]; |
1297 | DECLARE_COMPLETION_ONSTACK(complete); | ||
1298 | 1296 | ||
1299 | if (page->dev->bdev == NULL) { | 1297 | if (page->dev->bdev == NULL) { |
1300 | page->io_error = 1; | 1298 | page->io_error = 1; |
@@ -1311,18 +1309,11 @@ static void scrub_recheck_block(struct btrfs_fs_info *fs_info, | |||
1311 | } | 1309 | } |
1312 | bio->bi_bdev = page->dev->bdev; | 1310 | bio->bi_bdev = page->dev->bdev; |
1313 | bio->bi_sector = page->physical >> 9; | 1311 | bio->bi_sector = page->physical >> 9; |
1314 | bio->bi_end_io = scrub_complete_bio_end_io; | ||
1315 | bio->bi_private = &complete; | ||
1316 | 1312 | ||
1317 | bio_add_page(bio, page->page, PAGE_SIZE, 0); | 1313 | bio_add_page(bio, page->page, PAGE_SIZE, 0); |
1318 | btrfsic_submit_bio(READ, bio); | 1314 | if (btrfsic_submit_bio_wait(READ, bio)) |
1319 | |||
1320 | /* this will also unplug the queue */ | ||
1321 | wait_for_completion(&complete); | ||
1322 | |||
1323 | page->io_error = !test_bit(BIO_UPTODATE, &bio->bi_flags); | ||
1324 | if (!test_bit(BIO_UPTODATE, &bio->bi_flags)) | ||
1325 | sblock->no_io_error_seen = 0; | 1315 | sblock->no_io_error_seen = 0; |
1316 | |||
1326 | bio_put(bio); | 1317 | bio_put(bio); |
1327 | } | 1318 | } |
1328 | 1319 | ||
@@ -1391,11 +1382,6 @@ static void scrub_recheck_block_checksum(struct btrfs_fs_info *fs_info, | |||
1391 | sblock->checksum_error = 1; | 1382 | sblock->checksum_error = 1; |
1392 | } | 1383 | } |
1393 | 1384 | ||
1394 | static void scrub_complete_bio_end_io(struct bio *bio, int err) | ||
1395 | { | ||
1396 | complete((struct completion *)bio->bi_private); | ||
1397 | } | ||
1398 | |||
1399 | static int scrub_repair_block_from_good_copy(struct scrub_block *sblock_bad, | 1385 | static int scrub_repair_block_from_good_copy(struct scrub_block *sblock_bad, |
1400 | struct scrub_block *sblock_good, | 1386 | struct scrub_block *sblock_good, |
1401 | int force_write) | 1387 | int force_write) |
@@ -1430,7 +1416,6 @@ static int scrub_repair_page_from_good_copy(struct scrub_block *sblock_bad, | |||
1430 | sblock_bad->checksum_error || page_bad->io_error) { | 1416 | sblock_bad->checksum_error || page_bad->io_error) { |
1431 | struct bio *bio; | 1417 | struct bio *bio; |
1432 | int ret; | 1418 | int ret; |
1433 | DECLARE_COMPLETION_ONSTACK(complete); | ||
1434 | 1419 | ||
1435 | if (!page_bad->dev->bdev) { | 1420 | if (!page_bad->dev->bdev) { |
1436 | printk_ratelimited(KERN_WARNING | 1421 | printk_ratelimited(KERN_WARNING |
@@ -1443,19 +1428,14 @@ static int scrub_repair_page_from_good_copy(struct scrub_block *sblock_bad, | |||
1443 | return -EIO; | 1428 | return -EIO; |
1444 | bio->bi_bdev = page_bad->dev->bdev; | 1429 | bio->bi_bdev = page_bad->dev->bdev; |
1445 | bio->bi_sector = page_bad->physical >> 9; | 1430 | bio->bi_sector = page_bad->physical >> 9; |
1446 | bio->bi_end_io = scrub_complete_bio_end_io; | ||
1447 | bio->bi_private = &complete; | ||
1448 | 1431 | ||
1449 | ret = bio_add_page(bio, page_good->page, PAGE_SIZE, 0); | 1432 | ret = bio_add_page(bio, page_good->page, PAGE_SIZE, 0); |
1450 | if (PAGE_SIZE != ret) { | 1433 | if (PAGE_SIZE != ret) { |
1451 | bio_put(bio); | 1434 | bio_put(bio); |
1452 | return -EIO; | 1435 | return -EIO; |
1453 | } | 1436 | } |
1454 | btrfsic_submit_bio(WRITE, bio); | ||
1455 | 1437 | ||
1456 | /* this will also unplug the queue */ | 1438 | if (btrfsic_submit_bio_wait(WRITE, bio)) { |
1457 | wait_for_completion(&complete); | ||
1458 | if (!bio_flagged(bio, BIO_UPTODATE)) { | ||
1459 | btrfs_dev_stat_inc_and_print(page_bad->dev, | 1439 | btrfs_dev_stat_inc_and_print(page_bad->dev, |
1460 | BTRFS_DEV_STAT_WRITE_ERRS); | 1440 | BTRFS_DEV_STAT_WRITE_ERRS); |
1461 | btrfs_dev_replace_stats_inc( | 1441 | btrfs_dev_replace_stats_inc( |
@@ -3375,7 +3355,6 @@ static int write_page_nocow(struct scrub_ctx *sctx, | |||
3375 | struct bio *bio; | 3355 | struct bio *bio; |
3376 | struct btrfs_device *dev; | 3356 | struct btrfs_device *dev; |
3377 | int ret; | 3357 | int ret; |
3378 | DECLARE_COMPLETION_ONSTACK(compl); | ||
3379 | 3358 | ||
3380 | dev = sctx->wr_ctx.tgtdev; | 3359 | dev = sctx->wr_ctx.tgtdev; |
3381 | if (!dev) | 3360 | if (!dev) |
@@ -3392,8 +3371,6 @@ static int write_page_nocow(struct scrub_ctx *sctx, | |||
3392 | spin_unlock(&sctx->stat_lock); | 3371 | spin_unlock(&sctx->stat_lock); |
3393 | return -ENOMEM; | 3372 | return -ENOMEM; |
3394 | } | 3373 | } |
3395 | bio->bi_private = &compl; | ||
3396 | bio->bi_end_io = scrub_complete_bio_end_io; | ||
3397 | bio->bi_size = 0; | 3374 | bio->bi_size = 0; |
3398 | bio->bi_sector = physical_for_dev_replace >> 9; | 3375 | bio->bi_sector = physical_for_dev_replace >> 9; |
3399 | bio->bi_bdev = dev->bdev; | 3376 | bio->bi_bdev = dev->bdev; |
@@ -3404,10 +3381,8 @@ leave_with_eio: | |||
3404 | btrfs_dev_stat_inc_and_print(dev, BTRFS_DEV_STAT_WRITE_ERRS); | 3381 | btrfs_dev_stat_inc_and_print(dev, BTRFS_DEV_STAT_WRITE_ERRS); |
3405 | return -EIO; | 3382 | return -EIO; |
3406 | } | 3383 | } |
3407 | btrfsic_submit_bio(WRITE_SYNC, bio); | ||
3408 | wait_for_completion(&compl); | ||
3409 | 3384 | ||
3410 | if (!test_bit(BIO_UPTODATE, &bio->bi_flags)) | 3385 | if (btrfsic_submit_bio_wait(WRITE_SYNC, bio)) |
3411 | goto leave_with_eio; | 3386 | goto leave_with_eio; |
3412 | 3387 | ||
3413 | bio_put(bio); | 3388 | bio_put(bio); |
diff --git a/fs/btrfs/send.c b/fs/btrfs/send.c index 6837fe87f3a6..945d1db98f26 100644 --- a/fs/btrfs/send.c +++ b/fs/btrfs/send.c | |||
@@ -4723,8 +4723,8 @@ long btrfs_ioctl_send(struct file *mnt_file, void __user *arg_) | |||
4723 | } | 4723 | } |
4724 | 4724 | ||
4725 | if (!access_ok(VERIFY_READ, arg->clone_sources, | 4725 | if (!access_ok(VERIFY_READ, arg->clone_sources, |
4726 | sizeof(*arg->clone_sources * | 4726 | sizeof(*arg->clone_sources) * |
4727 | arg->clone_sources_count))) { | 4727 | arg->clone_sources_count)) { |
4728 | ret = -EFAULT; | 4728 | ret = -EFAULT; |
4729 | goto out; | 4729 | goto out; |
4730 | } | 4730 | } |
diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c index 2d8ac1bf0cf9..d71a11d13dfa 100644 --- a/fs/btrfs/super.c +++ b/fs/btrfs/super.c | |||
@@ -432,7 +432,6 @@ int btrfs_parse_options(struct btrfs_root *root, char *options) | |||
432 | } else { | 432 | } else { |
433 | printk(KERN_INFO "btrfs: setting nodatacow\n"); | 433 | printk(KERN_INFO "btrfs: setting nodatacow\n"); |
434 | } | 434 | } |
435 | info->compress_type = BTRFS_COMPRESS_NONE; | ||
436 | btrfs_clear_opt(info->mount_opt, COMPRESS); | 435 | btrfs_clear_opt(info->mount_opt, COMPRESS); |
437 | btrfs_clear_opt(info->mount_opt, FORCE_COMPRESS); | 436 | btrfs_clear_opt(info->mount_opt, FORCE_COMPRESS); |
438 | btrfs_set_opt(info->mount_opt, NODATACOW); | 437 | btrfs_set_opt(info->mount_opt, NODATACOW); |
@@ -461,7 +460,6 @@ int btrfs_parse_options(struct btrfs_root *root, char *options) | |||
461 | btrfs_set_fs_incompat(info, COMPRESS_LZO); | 460 | btrfs_set_fs_incompat(info, COMPRESS_LZO); |
462 | } else if (strncmp(args[0].from, "no", 2) == 0) { | 461 | } else if (strncmp(args[0].from, "no", 2) == 0) { |
463 | compress_type = "no"; | 462 | compress_type = "no"; |
464 | info->compress_type = BTRFS_COMPRESS_NONE; | ||
465 | btrfs_clear_opt(info->mount_opt, COMPRESS); | 463 | btrfs_clear_opt(info->mount_opt, COMPRESS); |
466 | btrfs_clear_opt(info->mount_opt, FORCE_COMPRESS); | 464 | btrfs_clear_opt(info->mount_opt, FORCE_COMPRESS); |
467 | compress_force = false; | 465 | compress_force = false; |
@@ -474,9 +472,10 @@ int btrfs_parse_options(struct btrfs_root *root, char *options) | |||
474 | btrfs_set_opt(info->mount_opt, FORCE_COMPRESS); | 472 | btrfs_set_opt(info->mount_opt, FORCE_COMPRESS); |
475 | pr_info("btrfs: force %s compression\n", | 473 | pr_info("btrfs: force %s compression\n", |
476 | compress_type); | 474 | compress_type); |
477 | } else | 475 | } else if (btrfs_test_opt(root, COMPRESS)) { |
478 | pr_info("btrfs: use %s compression\n", | 476 | pr_info("btrfs: use %s compression\n", |
479 | compress_type); | 477 | compress_type); |
478 | } | ||
480 | break; | 479 | break; |
481 | case Opt_ssd: | 480 | case Opt_ssd: |
482 | printk(KERN_INFO "btrfs: use ssd allocation scheme\n"); | 481 | printk(KERN_INFO "btrfs: use ssd allocation scheme\n"); |
diff --git a/fs/dcache.c b/fs/dcache.c index 4bdb300b16e2..6055d61811d3 100644 --- a/fs/dcache.c +++ b/fs/dcache.c | |||
@@ -192,7 +192,7 @@ static inline int dentry_string_cmp(const unsigned char *cs, const unsigned char | |||
192 | if (!tcount) | 192 | if (!tcount) |
193 | return 0; | 193 | return 0; |
194 | } | 194 | } |
195 | mask = ~(~0ul << tcount*8); | 195 | mask = bytemask_from_count(tcount); |
196 | return unlikely(!!((a ^ b) & mask)); | 196 | return unlikely(!!((a ^ b) & mask)); |
197 | } | 197 | } |
198 | 198 | ||
diff --git a/fs/eventpoll.c b/fs/eventpoll.c index 79b65c3b9e87..8b5e2584c840 100644 --- a/fs/eventpoll.c +++ b/fs/eventpoll.c | |||
@@ -1852,8 +1852,7 @@ SYSCALL_DEFINE4(epoll_ctl, int, epfd, int, op, int, fd, | |||
1852 | goto error_tgt_fput; | 1852 | goto error_tgt_fput; |
1853 | 1853 | ||
1854 | /* Check if EPOLLWAKEUP is allowed */ | 1854 | /* Check if EPOLLWAKEUP is allowed */ |
1855 | if ((epds.events & EPOLLWAKEUP) && !capable(CAP_BLOCK_SUSPEND)) | 1855 | ep_take_care_of_epollwakeup(&epds); |
1856 | epds.events &= ~EPOLLWAKEUP; | ||
1857 | 1856 | ||
1858 | /* | 1857 | /* |
1859 | * We have to check that the file structure underneath the file descriptor | 1858 | * We have to check that the file structure underneath the file descriptor |
diff --git a/fs/hfsplus/wrapper.c b/fs/hfsplus/wrapper.c index b51a6079108d..e9a97a0d4314 100644 --- a/fs/hfsplus/wrapper.c +++ b/fs/hfsplus/wrapper.c | |||
@@ -24,13 +24,6 @@ struct hfsplus_wd { | |||
24 | u16 embed_count; | 24 | u16 embed_count; |
25 | }; | 25 | }; |
26 | 26 | ||
27 | static void hfsplus_end_io_sync(struct bio *bio, int err) | ||
28 | { | ||
29 | if (err) | ||
30 | clear_bit(BIO_UPTODATE, &bio->bi_flags); | ||
31 | complete(bio->bi_private); | ||
32 | } | ||
33 | |||
34 | /* | 27 | /* |
35 | * hfsplus_submit_bio - Perfrom block I/O | 28 | * hfsplus_submit_bio - Perfrom block I/O |
36 | * @sb: super block of volume for I/O | 29 | * @sb: super block of volume for I/O |
@@ -53,7 +46,6 @@ static void hfsplus_end_io_sync(struct bio *bio, int err) | |||
53 | int hfsplus_submit_bio(struct super_block *sb, sector_t sector, | 46 | int hfsplus_submit_bio(struct super_block *sb, sector_t sector, |
54 | void *buf, void **data, int rw) | 47 | void *buf, void **data, int rw) |
55 | { | 48 | { |
56 | DECLARE_COMPLETION_ONSTACK(wait); | ||
57 | struct bio *bio; | 49 | struct bio *bio; |
58 | int ret = 0; | 50 | int ret = 0; |
59 | u64 io_size; | 51 | u64 io_size; |
@@ -73,8 +65,6 @@ int hfsplus_submit_bio(struct super_block *sb, sector_t sector, | |||
73 | bio = bio_alloc(GFP_NOIO, 1); | 65 | bio = bio_alloc(GFP_NOIO, 1); |
74 | bio->bi_sector = sector; | 66 | bio->bi_sector = sector; |
75 | bio->bi_bdev = sb->s_bdev; | 67 | bio->bi_bdev = sb->s_bdev; |
76 | bio->bi_end_io = hfsplus_end_io_sync; | ||
77 | bio->bi_private = &wait; | ||
78 | 68 | ||
79 | if (!(rw & WRITE) && data) | 69 | if (!(rw & WRITE) && data) |
80 | *data = (u8 *)buf + offset; | 70 | *data = (u8 *)buf + offset; |
@@ -93,12 +83,7 @@ int hfsplus_submit_bio(struct super_block *sb, sector_t sector, | |||
93 | buf = (u8 *)buf + len; | 83 | buf = (u8 *)buf + len; |
94 | } | 84 | } |
95 | 85 | ||
96 | submit_bio(rw, bio); | 86 | ret = submit_bio_wait(rw, bio); |
97 | wait_for_completion(&wait); | ||
98 | |||
99 | if (!bio_flagged(bio, BIO_UPTODATE)) | ||
100 | ret = -EIO; | ||
101 | |||
102 | out: | 87 | out: |
103 | bio_put(bio); | 88 | bio_put(bio); |
104 | return ret < 0 ? ret : 0; | 89 | return ret < 0 ? ret : 0; |
diff --git a/fs/logfs/dev_bdev.c b/fs/logfs/dev_bdev.c index 550475ca6a0e..0f95f0d0b313 100644 --- a/fs/logfs/dev_bdev.c +++ b/fs/logfs/dev_bdev.c | |||
@@ -14,16 +14,10 @@ | |||
14 | 14 | ||
15 | #define PAGE_OFS(ofs) ((ofs) & (PAGE_SIZE-1)) | 15 | #define PAGE_OFS(ofs) ((ofs) & (PAGE_SIZE-1)) |
16 | 16 | ||
17 | static void request_complete(struct bio *bio, int err) | ||
18 | { | ||
19 | complete((struct completion *)bio->bi_private); | ||
20 | } | ||
21 | |||
22 | static int sync_request(struct page *page, struct block_device *bdev, int rw) | 17 | static int sync_request(struct page *page, struct block_device *bdev, int rw) |
23 | { | 18 | { |
24 | struct bio bio; | 19 | struct bio bio; |
25 | struct bio_vec bio_vec; | 20 | struct bio_vec bio_vec; |
26 | struct completion complete; | ||
27 | 21 | ||
28 | bio_init(&bio); | 22 | bio_init(&bio); |
29 | bio.bi_max_vecs = 1; | 23 | bio.bi_max_vecs = 1; |
@@ -35,13 +29,8 @@ static int sync_request(struct page *page, struct block_device *bdev, int rw) | |||
35 | bio.bi_size = PAGE_SIZE; | 29 | bio.bi_size = PAGE_SIZE; |
36 | bio.bi_bdev = bdev; | 30 | bio.bi_bdev = bdev; |
37 | bio.bi_sector = page->index * (PAGE_SIZE >> 9); | 31 | bio.bi_sector = page->index * (PAGE_SIZE >> 9); |
38 | init_completion(&complete); | ||
39 | bio.bi_private = &complete; | ||
40 | bio.bi_end_io = request_complete; | ||
41 | 32 | ||
42 | submit_bio(rw, &bio); | 33 | return submit_bio_wait(rw, &bio); |
43 | wait_for_completion(&complete); | ||
44 | return test_bit(BIO_UPTODATE, &bio.bi_flags) ? 0 : -EIO; | ||
45 | } | 34 | } |
46 | 35 | ||
47 | static int bdev_readpage(void *_sb, struct page *page) | 36 | static int bdev_readpage(void *_sb, struct page *page) |
diff --git a/fs/namei.c b/fs/namei.c index c53d3a9547f9..3531deebad30 100644 --- a/fs/namei.c +++ b/fs/namei.c | |||
@@ -1598,11 +1598,6 @@ static inline int nested_symlink(struct path *path, struct nameidata *nd) | |||
1598 | * do a "get_unaligned()" if this helps and is sufficiently | 1598 | * do a "get_unaligned()" if this helps and is sufficiently |
1599 | * fast. | 1599 | * fast. |
1600 | * | 1600 | * |
1601 | * - Little-endian machines (so that we can generate the mask | ||
1602 | * of low bytes efficiently). Again, we *could* do a byte | ||
1603 | * swapping load on big-endian architectures if that is not | ||
1604 | * expensive enough to make the optimization worthless. | ||
1605 | * | ||
1606 | * - non-CONFIG_DEBUG_PAGEALLOC configurations (so that we | 1601 | * - non-CONFIG_DEBUG_PAGEALLOC configurations (so that we |
1607 | * do not trap on the (extremely unlikely) case of a page | 1602 | * do not trap on the (extremely unlikely) case of a page |
1608 | * crossing operation. | 1603 | * crossing operation. |
@@ -1646,7 +1641,7 @@ unsigned int full_name_hash(const unsigned char *name, unsigned int len) | |||
1646 | if (!len) | 1641 | if (!len) |
1647 | goto done; | 1642 | goto done; |
1648 | } | 1643 | } |
1649 | mask = ~(~0ul << len*8); | 1644 | mask = bytemask_from_count(len); |
1650 | hash += mask & a; | 1645 | hash += mask & a; |
1651 | done: | 1646 | done: |
1652 | return fold_hash(hash); | 1647 | return fold_hash(hash); |
diff --git a/fs/nfs/blocklayout/blocklayout.h b/fs/nfs/blocklayout/blocklayout.h index 8485978993e8..9838fb020473 100644 --- a/fs/nfs/blocklayout/blocklayout.h +++ b/fs/nfs/blocklayout/blocklayout.h | |||
@@ -36,6 +36,7 @@ | |||
36 | #include <linux/nfs_fs.h> | 36 | #include <linux/nfs_fs.h> |
37 | #include <linux/sunrpc/rpc_pipe_fs.h> | 37 | #include <linux/sunrpc/rpc_pipe_fs.h> |
38 | 38 | ||
39 | #include "../nfs4_fs.h" | ||
39 | #include "../pnfs.h" | 40 | #include "../pnfs.h" |
40 | #include "../netns.h" | 41 | #include "../netns.h" |
41 | 42 | ||
diff --git a/fs/nfs/blocklayout/extents.c b/fs/nfs/blocklayout/extents.c index 9c3e117c3ed1..4d0161442565 100644 --- a/fs/nfs/blocklayout/extents.c +++ b/fs/nfs/blocklayout/extents.c | |||
@@ -44,7 +44,7 @@ | |||
44 | static inline sector_t normalize(sector_t s, int base) | 44 | static inline sector_t normalize(sector_t s, int base) |
45 | { | 45 | { |
46 | sector_t tmp = s; /* Since do_div modifies its argument */ | 46 | sector_t tmp = s; /* Since do_div modifies its argument */ |
47 | return s - do_div(tmp, base); | 47 | return s - sector_div(tmp, base); |
48 | } | 48 | } |
49 | 49 | ||
50 | static inline sector_t normalize_up(sector_t s, int base) | 50 | static inline sector_t normalize_up(sector_t s, int base) |
diff --git a/fs/nfs/dns_resolve.c b/fs/nfs/dns_resolve.c index fc0f95ec7358..d25f10fb4926 100644 --- a/fs/nfs/dns_resolve.c +++ b/fs/nfs/dns_resolve.c | |||
@@ -46,7 +46,9 @@ ssize_t nfs_dns_resolve_name(struct net *net, char *name, size_t namelen, | |||
46 | #include <linux/sunrpc/cache.h> | 46 | #include <linux/sunrpc/cache.h> |
47 | #include <linux/sunrpc/svcauth.h> | 47 | #include <linux/sunrpc/svcauth.h> |
48 | #include <linux/sunrpc/rpc_pipe_fs.h> | 48 | #include <linux/sunrpc/rpc_pipe_fs.h> |
49 | #include <linux/nfs_fs.h> | ||
49 | 50 | ||
51 | #include "nfs4_fs.h" | ||
50 | #include "dns_resolve.h" | 52 | #include "dns_resolve.h" |
51 | #include "cache_lib.h" | 53 | #include "cache_lib.h" |
52 | #include "netns.h" | 54 | #include "netns.h" |
diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c index 18ab2da4eeb6..00ad1c2b217d 100644 --- a/fs/nfs/inode.c +++ b/fs/nfs/inode.c | |||
@@ -312,7 +312,7 @@ struct nfs4_label *nfs4_label_alloc(struct nfs_server *server, gfp_t flags) | |||
312 | } | 312 | } |
313 | EXPORT_SYMBOL_GPL(nfs4_label_alloc); | 313 | EXPORT_SYMBOL_GPL(nfs4_label_alloc); |
314 | #else | 314 | #else |
315 | void inline nfs_setsecurity(struct inode *inode, struct nfs_fattr *fattr, | 315 | void nfs_setsecurity(struct inode *inode, struct nfs_fattr *fattr, |
316 | struct nfs4_label *label) | 316 | struct nfs4_label *label) |
317 | { | 317 | { |
318 | } | 318 | } |
diff --git a/fs/nfs/internal.h b/fs/nfs/internal.h index bca6a3e3c49c..8b5cc04a8611 100644 --- a/fs/nfs/internal.h +++ b/fs/nfs/internal.h | |||
@@ -269,6 +269,21 @@ extern const u32 nfs41_maxgetdevinfo_overhead; | |||
269 | extern struct rpc_procinfo nfs4_procedures[]; | 269 | extern struct rpc_procinfo nfs4_procedures[]; |
270 | #endif | 270 | #endif |
271 | 271 | ||
272 | #ifdef CONFIG_NFS_V4_SECURITY_LABEL | ||
273 | extern struct nfs4_label *nfs4_label_alloc(struct nfs_server *server, gfp_t flags); | ||
274 | static inline void nfs4_label_free(struct nfs4_label *label) | ||
275 | { | ||
276 | if (label) { | ||
277 | kfree(label->label); | ||
278 | kfree(label); | ||
279 | } | ||
280 | return; | ||
281 | } | ||
282 | #else | ||
283 | static inline struct nfs4_label *nfs4_label_alloc(struct nfs_server *server, gfp_t flags) { return NULL; } | ||
284 | static inline void nfs4_label_free(void *label) {} | ||
285 | #endif /* CONFIG_NFS_V4_SECURITY_LABEL */ | ||
286 | |||
272 | /* proc.c */ | 287 | /* proc.c */ |
273 | void nfs_close_context(struct nfs_open_context *ctx, int is_sync); | 288 | void nfs_close_context(struct nfs_open_context *ctx, int is_sync); |
274 | extern struct nfs_client *nfs_init_client(struct nfs_client *clp, | 289 | extern struct nfs_client *nfs_init_client(struct nfs_client *clp, |
diff --git a/fs/nfs/nfs4_fs.h b/fs/nfs/nfs4_fs.h index 3ce79b04522e..5609edc742a0 100644 --- a/fs/nfs/nfs4_fs.h +++ b/fs/nfs/nfs4_fs.h | |||
@@ -9,6 +9,14 @@ | |||
9 | #ifndef __LINUX_FS_NFS_NFS4_FS_H | 9 | #ifndef __LINUX_FS_NFS_NFS4_FS_H |
10 | #define __LINUX_FS_NFS_NFS4_FS_H | 10 | #define __LINUX_FS_NFS_NFS4_FS_H |
11 | 11 | ||
12 | #if defined(CONFIG_NFS_V4_2) | ||
13 | #define NFS4_MAX_MINOR_VERSION 2 | ||
14 | #elif defined(CONFIG_NFS_V4_1) | ||
15 | #define NFS4_MAX_MINOR_VERSION 1 | ||
16 | #else | ||
17 | #define NFS4_MAX_MINOR_VERSION 0 | ||
18 | #endif | ||
19 | |||
12 | #if IS_ENABLED(CONFIG_NFS_V4) | 20 | #if IS_ENABLED(CONFIG_NFS_V4) |
13 | 21 | ||
14 | #define NFS4_MAX_LOOP_ON_RECOVER (10) | 22 | #define NFS4_MAX_LOOP_ON_RECOVER (10) |
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index 659990c0109e..15052b81df42 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c | |||
@@ -2518,9 +2518,8 @@ static void nfs4_close_done(struct rpc_task *task, void *data) | |||
2518 | calldata->roc_barrier); | 2518 | calldata->roc_barrier); |
2519 | nfs_set_open_stateid(state, &calldata->res.stateid, 0); | 2519 | nfs_set_open_stateid(state, &calldata->res.stateid, 0); |
2520 | renew_lease(server, calldata->timestamp); | 2520 | renew_lease(server, calldata->timestamp); |
2521 | nfs4_close_clear_stateid_flags(state, | ||
2522 | calldata->arg.fmode); | ||
2523 | break; | 2521 | break; |
2522 | case -NFS4ERR_ADMIN_REVOKED: | ||
2524 | case -NFS4ERR_STALE_STATEID: | 2523 | case -NFS4ERR_STALE_STATEID: |
2525 | case -NFS4ERR_OLD_STATEID: | 2524 | case -NFS4ERR_OLD_STATEID: |
2526 | case -NFS4ERR_BAD_STATEID: | 2525 | case -NFS4ERR_BAD_STATEID: |
@@ -2528,9 +2527,13 @@ static void nfs4_close_done(struct rpc_task *task, void *data) | |||
2528 | if (calldata->arg.fmode == 0) | 2527 | if (calldata->arg.fmode == 0) |
2529 | break; | 2528 | break; |
2530 | default: | 2529 | default: |
2531 | if (nfs4_async_handle_error(task, server, state) == -EAGAIN) | 2530 | if (nfs4_async_handle_error(task, server, state) == -EAGAIN) { |
2532 | rpc_restart_call_prepare(task); | 2531 | rpc_restart_call_prepare(task); |
2532 | goto out_release; | ||
2533 | } | ||
2533 | } | 2534 | } |
2535 | nfs4_close_clear_stateid_flags(state, calldata->arg.fmode); | ||
2536 | out_release: | ||
2534 | nfs_release_seqid(calldata->arg.seqid); | 2537 | nfs_release_seqid(calldata->arg.seqid); |
2535 | nfs_refresh_inode(calldata->inode, calldata->res.fattr); | 2538 | nfs_refresh_inode(calldata->inode, calldata->res.fattr); |
2536 | dprintk("%s: done, ret = %d!\n", __func__, task->tk_status); | 2539 | dprintk("%s: done, ret = %d!\n", __func__, task->tk_status); |
@@ -4802,7 +4805,7 @@ nfs4_async_handle_error(struct rpc_task *task, const struct nfs_server *server, | |||
4802 | dprintk("%s ERROR %d, Reset session\n", __func__, | 4805 | dprintk("%s ERROR %d, Reset session\n", __func__, |
4803 | task->tk_status); | 4806 | task->tk_status); |
4804 | nfs4_schedule_session_recovery(clp->cl_session, task->tk_status); | 4807 | nfs4_schedule_session_recovery(clp->cl_session, task->tk_status); |
4805 | goto restart_call; | 4808 | goto wait_on_recovery; |
4806 | #endif /* CONFIG_NFS_V4_1 */ | 4809 | #endif /* CONFIG_NFS_V4_1 */ |
4807 | case -NFS4ERR_DELAY: | 4810 | case -NFS4ERR_DELAY: |
4808 | nfs_inc_server_stats(server, NFSIOS_DELAY); | 4811 | nfs_inc_server_stats(server, NFSIOS_DELAY); |
@@ -4987,11 +4990,17 @@ static void nfs4_delegreturn_done(struct rpc_task *task, void *calldata) | |||
4987 | 4990 | ||
4988 | trace_nfs4_delegreturn_exit(&data->args, &data->res, task->tk_status); | 4991 | trace_nfs4_delegreturn_exit(&data->args, &data->res, task->tk_status); |
4989 | switch (task->tk_status) { | 4992 | switch (task->tk_status) { |
4990 | case -NFS4ERR_STALE_STATEID: | ||
4991 | case -NFS4ERR_EXPIRED: | ||
4992 | case 0: | 4993 | case 0: |
4993 | renew_lease(data->res.server, data->timestamp); | 4994 | renew_lease(data->res.server, data->timestamp); |
4994 | break; | 4995 | break; |
4996 | case -NFS4ERR_ADMIN_REVOKED: | ||
4997 | case -NFS4ERR_DELEG_REVOKED: | ||
4998 | case -NFS4ERR_BAD_STATEID: | ||
4999 | case -NFS4ERR_OLD_STATEID: | ||
5000 | case -NFS4ERR_STALE_STATEID: | ||
5001 | case -NFS4ERR_EXPIRED: | ||
5002 | task->tk_status = 0; | ||
5003 | break; | ||
4995 | default: | 5004 | default: |
4996 | if (nfs4_async_handle_error(task, data->res.server, NULL) == | 5005 | if (nfs4_async_handle_error(task, data->res.server, NULL) == |
4997 | -EAGAIN) { | 5006 | -EAGAIN) { |
@@ -7589,7 +7598,14 @@ static void nfs4_layoutreturn_done(struct rpc_task *task, void *calldata) | |||
7589 | return; | 7598 | return; |
7590 | 7599 | ||
7591 | server = NFS_SERVER(lrp->args.inode); | 7600 | server = NFS_SERVER(lrp->args.inode); |
7592 | if (nfs4_async_handle_error(task, server, NULL) == -EAGAIN) { | 7601 | switch (task->tk_status) { |
7602 | default: | ||
7603 | task->tk_status = 0; | ||
7604 | case 0: | ||
7605 | break; | ||
7606 | case -NFS4ERR_DELAY: | ||
7607 | if (nfs4_async_handle_error(task, server, NULL) != -EAGAIN) | ||
7608 | break; | ||
7593 | rpc_restart_call_prepare(task); | 7609 | rpc_restart_call_prepare(task); |
7594 | return; | 7610 | return; |
7595 | } | 7611 | } |
diff --git a/fs/nfsd/nfscache.c b/fs/nfsd/nfscache.c index 9186c7ce0b14..b6af150c96b8 100644 --- a/fs/nfsd/nfscache.c +++ b/fs/nfsd/nfscache.c | |||
@@ -132,6 +132,13 @@ nfsd_reply_cache_alloc(void) | |||
132 | } | 132 | } |
133 | 133 | ||
134 | static void | 134 | static void |
135 | nfsd_reply_cache_unhash(struct svc_cacherep *rp) | ||
136 | { | ||
137 | hlist_del_init(&rp->c_hash); | ||
138 | list_del_init(&rp->c_lru); | ||
139 | } | ||
140 | |||
141 | static void | ||
135 | nfsd_reply_cache_free_locked(struct svc_cacherep *rp) | 142 | nfsd_reply_cache_free_locked(struct svc_cacherep *rp) |
136 | { | 143 | { |
137 | if (rp->c_type == RC_REPLBUFF && rp->c_replvec.iov_base) { | 144 | if (rp->c_type == RC_REPLBUFF && rp->c_replvec.iov_base) { |
@@ -417,7 +424,7 @@ nfsd_cache_lookup(struct svc_rqst *rqstp) | |||
417 | rp = list_first_entry(&lru_head, struct svc_cacherep, c_lru); | 424 | rp = list_first_entry(&lru_head, struct svc_cacherep, c_lru); |
418 | if (nfsd_cache_entry_expired(rp) || | 425 | if (nfsd_cache_entry_expired(rp) || |
419 | num_drc_entries >= max_drc_entries) { | 426 | num_drc_entries >= max_drc_entries) { |
420 | lru_put_end(rp); | 427 | nfsd_reply_cache_unhash(rp); |
421 | prune_cache_entries(); | 428 | prune_cache_entries(); |
422 | goto search_cache; | 429 | goto search_cache; |
423 | } | 430 | } |
@@ -726,11 +726,25 @@ pipe_poll(struct file *filp, poll_table *wait) | |||
726 | return mask; | 726 | return mask; |
727 | } | 727 | } |
728 | 728 | ||
729 | static void put_pipe_info(struct inode *inode, struct pipe_inode_info *pipe) | ||
730 | { | ||
731 | int kill = 0; | ||
732 | |||
733 | spin_lock(&inode->i_lock); | ||
734 | if (!--pipe->files) { | ||
735 | inode->i_pipe = NULL; | ||
736 | kill = 1; | ||
737 | } | ||
738 | spin_unlock(&inode->i_lock); | ||
739 | |||
740 | if (kill) | ||
741 | free_pipe_info(pipe); | ||
742 | } | ||
743 | |||
729 | static int | 744 | static int |
730 | pipe_release(struct inode *inode, struct file *file) | 745 | pipe_release(struct inode *inode, struct file *file) |
731 | { | 746 | { |
732 | struct pipe_inode_info *pipe = inode->i_pipe; | 747 | struct pipe_inode_info *pipe = file->private_data; |
733 | int kill = 0; | ||
734 | 748 | ||
735 | __pipe_lock(pipe); | 749 | __pipe_lock(pipe); |
736 | if (file->f_mode & FMODE_READ) | 750 | if (file->f_mode & FMODE_READ) |
@@ -743,17 +757,9 @@ pipe_release(struct inode *inode, struct file *file) | |||
743 | kill_fasync(&pipe->fasync_readers, SIGIO, POLL_IN); | 757 | kill_fasync(&pipe->fasync_readers, SIGIO, POLL_IN); |
744 | kill_fasync(&pipe->fasync_writers, SIGIO, POLL_OUT); | 758 | kill_fasync(&pipe->fasync_writers, SIGIO, POLL_OUT); |
745 | } | 759 | } |
746 | spin_lock(&inode->i_lock); | ||
747 | if (!--pipe->files) { | ||
748 | inode->i_pipe = NULL; | ||
749 | kill = 1; | ||
750 | } | ||
751 | spin_unlock(&inode->i_lock); | ||
752 | __pipe_unlock(pipe); | 760 | __pipe_unlock(pipe); |
753 | 761 | ||
754 | if (kill) | 762 | put_pipe_info(inode, pipe); |
755 | free_pipe_info(pipe); | ||
756 | |||
757 | return 0; | 763 | return 0; |
758 | } | 764 | } |
759 | 765 | ||
@@ -1014,7 +1020,6 @@ static int fifo_open(struct inode *inode, struct file *filp) | |||
1014 | { | 1020 | { |
1015 | struct pipe_inode_info *pipe; | 1021 | struct pipe_inode_info *pipe; |
1016 | bool is_pipe = inode->i_sb->s_magic == PIPEFS_MAGIC; | 1022 | bool is_pipe = inode->i_sb->s_magic == PIPEFS_MAGIC; |
1017 | int kill = 0; | ||
1018 | int ret; | 1023 | int ret; |
1019 | 1024 | ||
1020 | filp->f_version = 0; | 1025 | filp->f_version = 0; |
@@ -1130,15 +1135,9 @@ err_wr: | |||
1130 | goto err; | 1135 | goto err; |
1131 | 1136 | ||
1132 | err: | 1137 | err: |
1133 | spin_lock(&inode->i_lock); | ||
1134 | if (!--pipe->files) { | ||
1135 | inode->i_pipe = NULL; | ||
1136 | kill = 1; | ||
1137 | } | ||
1138 | spin_unlock(&inode->i_lock); | ||
1139 | __pipe_unlock(pipe); | 1138 | __pipe_unlock(pipe); |
1140 | if (kill) | 1139 | |
1141 | free_pipe_info(pipe); | 1140 | put_pipe_info(inode, pipe); |
1142 | return ret; | 1141 | return ret; |
1143 | } | 1142 | } |
1144 | 1143 | ||
diff --git a/fs/proc/inode.c b/fs/proc/inode.c index 28955d4b7218..124fc43c7090 100644 --- a/fs/proc/inode.c +++ b/fs/proc/inode.c | |||
@@ -292,16 +292,20 @@ proc_reg_get_unmapped_area(struct file *file, unsigned long orig_addr, | |||
292 | { | 292 | { |
293 | struct proc_dir_entry *pde = PDE(file_inode(file)); | 293 | struct proc_dir_entry *pde = PDE(file_inode(file)); |
294 | unsigned long rv = -EIO; | 294 | unsigned long rv = -EIO; |
295 | unsigned long (*get_area)(struct file *, unsigned long, unsigned long, | 295 | |
296 | unsigned long, unsigned long) = NULL; | ||
297 | if (use_pde(pde)) { | 296 | if (use_pde(pde)) { |
297 | typeof(proc_reg_get_unmapped_area) *get_area; | ||
298 | |||
299 | get_area = pde->proc_fops->get_unmapped_area; | ||
298 | #ifdef CONFIG_MMU | 300 | #ifdef CONFIG_MMU |
299 | get_area = current->mm->get_unmapped_area; | 301 | if (!get_area) |
302 | get_area = current->mm->get_unmapped_area; | ||
300 | #endif | 303 | #endif |
301 | if (pde->proc_fops->get_unmapped_area) | 304 | |
302 | get_area = pde->proc_fops->get_unmapped_area; | ||
303 | if (get_area) | 305 | if (get_area) |
304 | rv = get_area(file, orig_addr, len, pgoff, flags); | 306 | rv = get_area(file, orig_addr, len, pgoff, flags); |
307 | else | ||
308 | rv = orig_addr; | ||
305 | unuse_pde(pde); | 309 | unuse_pde(pde); |
306 | } | 310 | } |
307 | return rv; | 311 | return rv; |
diff --git a/fs/squashfs/file_direct.c b/fs/squashfs/file_direct.c index 2943b2bfae48..62a0de6632e1 100644 --- a/fs/squashfs/file_direct.c +++ b/fs/squashfs/file_direct.c | |||
@@ -84,6 +84,9 @@ int squashfs_readpage_block(struct page *target_page, u64 block, int bsize) | |||
84 | */ | 84 | */ |
85 | res = squashfs_read_cache(target_page, block, bsize, pages, | 85 | res = squashfs_read_cache(target_page, block, bsize, pages, |
86 | page); | 86 | page); |
87 | if (res < 0) | ||
88 | goto mark_errored; | ||
89 | |||
87 | goto out; | 90 | goto out; |
88 | } | 91 | } |
89 | 92 | ||
@@ -119,7 +122,7 @@ mark_errored: | |||
119 | * dealt with by the caller | 122 | * dealt with by the caller |
120 | */ | 123 | */ |
121 | for (i = 0; i < pages; i++) { | 124 | for (i = 0; i < pages; i++) { |
122 | if (page[i] == target_page) | 125 | if (page[i] == NULL || page[i] == target_page) |
123 | continue; | 126 | continue; |
124 | flush_dcache_page(page[i]); | 127 | flush_dcache_page(page[i]); |
125 | SetPageError(page[i]); | 128 | SetPageError(page[i]); |
diff --git a/fs/xfs/xfs_discard.c b/fs/xfs/xfs_discard.c index 8367d6dc18c9..4f11ef011139 100644 --- a/fs/xfs/xfs_discard.c +++ b/fs/xfs/xfs_discard.c | |||
@@ -157,7 +157,7 @@ xfs_ioc_trim( | |||
157 | struct xfs_mount *mp, | 157 | struct xfs_mount *mp, |
158 | struct fstrim_range __user *urange) | 158 | struct fstrim_range __user *urange) |
159 | { | 159 | { |
160 | struct request_queue *q = mp->m_ddev_targp->bt_bdev->bd_disk->queue; | 160 | struct request_queue *q = bdev_get_queue(mp->m_ddev_targp->bt_bdev); |
161 | unsigned int granularity = q->limits.discard_granularity; | 161 | unsigned int granularity = q->limits.discard_granularity; |
162 | struct fstrim_range range; | 162 | struct fstrim_range range; |
163 | xfs_daddr_t start, end, minlen; | 163 | xfs_daddr_t start, end, minlen; |
@@ -180,7 +180,8 @@ xfs_ioc_trim( | |||
180 | * matter as trimming blocks is an advisory interface. | 180 | * matter as trimming blocks is an advisory interface. |
181 | */ | 181 | */ |
182 | if (range.start >= XFS_FSB_TO_B(mp, mp->m_sb.sb_dblocks) || | 182 | if (range.start >= XFS_FSB_TO_B(mp, mp->m_sb.sb_dblocks) || |
183 | range.minlen > XFS_FSB_TO_B(mp, XFS_ALLOC_AG_MAX_USABLE(mp))) | 183 | range.minlen > XFS_FSB_TO_B(mp, XFS_ALLOC_AG_MAX_USABLE(mp)) || |
184 | range.len < mp->m_sb.sb_blocksize) | ||
184 | return -XFS_ERROR(EINVAL); | 185 | return -XFS_ERROR(EINVAL); |
185 | 186 | ||
186 | start = BTOBB(range.start); | 187 | start = BTOBB(range.start); |
diff --git a/fs/xfs/xfs_fsops.c b/fs/xfs/xfs_fsops.c index a6e54b3319bd..02fb943cbf22 100644 --- a/fs/xfs/xfs_fsops.c +++ b/fs/xfs/xfs_fsops.c | |||
@@ -220,6 +220,8 @@ xfs_growfs_data_private( | |||
220 | */ | 220 | */ |
221 | nfree = 0; | 221 | nfree = 0; |
222 | for (agno = nagcount - 1; agno >= oagcount; agno--, new -= agsize) { | 222 | for (agno = nagcount - 1; agno >= oagcount; agno--, new -= agsize) { |
223 | __be32 *agfl_bno; | ||
224 | |||
223 | /* | 225 | /* |
224 | * AG freespace header block | 226 | * AG freespace header block |
225 | */ | 227 | */ |
@@ -279,8 +281,10 @@ xfs_growfs_data_private( | |||
279 | agfl->agfl_seqno = cpu_to_be32(agno); | 281 | agfl->agfl_seqno = cpu_to_be32(agno); |
280 | uuid_copy(&agfl->agfl_uuid, &mp->m_sb.sb_uuid); | 282 | uuid_copy(&agfl->agfl_uuid, &mp->m_sb.sb_uuid); |
281 | } | 283 | } |
284 | |||
285 | agfl_bno = XFS_BUF_TO_AGFL_BNO(mp, bp); | ||
282 | for (bucket = 0; bucket < XFS_AGFL_SIZE(mp); bucket++) | 286 | for (bucket = 0; bucket < XFS_AGFL_SIZE(mp); bucket++) |
283 | agfl->agfl_bno[bucket] = cpu_to_be32(NULLAGBLOCK); | 287 | agfl_bno[bucket] = cpu_to_be32(NULLAGBLOCK); |
284 | 288 | ||
285 | error = xfs_bwrite(bp); | 289 | error = xfs_bwrite(bp); |
286 | xfs_buf_relse(bp); | 290 | xfs_buf_relse(bp); |
diff --git a/fs/xfs/xfs_ioctl.c b/fs/xfs/xfs_ioctl.c index 4d613401a5e0..33ad9a77791f 100644 --- a/fs/xfs/xfs_ioctl.c +++ b/fs/xfs/xfs_ioctl.c | |||
@@ -442,7 +442,8 @@ xfs_attrlist_by_handle( | |||
442 | return -XFS_ERROR(EPERM); | 442 | return -XFS_ERROR(EPERM); |
443 | if (copy_from_user(&al_hreq, arg, sizeof(xfs_fsop_attrlist_handlereq_t))) | 443 | if (copy_from_user(&al_hreq, arg, sizeof(xfs_fsop_attrlist_handlereq_t))) |
444 | return -XFS_ERROR(EFAULT); | 444 | return -XFS_ERROR(EFAULT); |
445 | if (al_hreq.buflen > XATTR_LIST_MAX) | 445 | if (al_hreq.buflen < sizeof(struct attrlist) || |
446 | al_hreq.buflen > XATTR_LIST_MAX) | ||
446 | return -XFS_ERROR(EINVAL); | 447 | return -XFS_ERROR(EINVAL); |
447 | 448 | ||
448 | /* | 449 | /* |
diff --git a/fs/xfs/xfs_ioctl32.c b/fs/xfs/xfs_ioctl32.c index e8fb1231db81..a7992f8de9d3 100644 --- a/fs/xfs/xfs_ioctl32.c +++ b/fs/xfs/xfs_ioctl32.c | |||
@@ -356,7 +356,8 @@ xfs_compat_attrlist_by_handle( | |||
356 | if (copy_from_user(&al_hreq, arg, | 356 | if (copy_from_user(&al_hreq, arg, |
357 | sizeof(compat_xfs_fsop_attrlist_handlereq_t))) | 357 | sizeof(compat_xfs_fsop_attrlist_handlereq_t))) |
358 | return -XFS_ERROR(EFAULT); | 358 | return -XFS_ERROR(EFAULT); |
359 | if (al_hreq.buflen > XATTR_LIST_MAX) | 359 | if (al_hreq.buflen < sizeof(struct attrlist) || |
360 | al_hreq.buflen > XATTR_LIST_MAX) | ||
360 | return -XFS_ERROR(EINVAL); | 361 | return -XFS_ERROR(EINVAL); |
361 | 362 | ||
362 | /* | 363 | /* |
diff --git a/include/asm-generic/word-at-a-time.h b/include/asm-generic/word-at-a-time.h index 3f21f1b72e45..d3909effd725 100644 --- a/include/asm-generic/word-at-a-time.h +++ b/include/asm-generic/word-at-a-time.h | |||
@@ -49,4 +49,12 @@ static inline bool has_zero(unsigned long val, unsigned long *data, const struct | |||
49 | return (val + c->high_bits) & ~rhs; | 49 | return (val + c->high_bits) & ~rhs; |
50 | } | 50 | } |
51 | 51 | ||
52 | #ifndef zero_bytemask | ||
53 | #ifdef CONFIG_64BIT | ||
54 | #define zero_bytemask(mask) (~0ul << fls64(mask)) | ||
55 | #else | ||
56 | #define zero_bytemask(mask) (~0ul << fls(mask)) | ||
57 | #endif /* CONFIG_64BIT */ | ||
58 | #endif /* zero_bytemask */ | ||
59 | |||
52 | #endif /* _ASM_WORD_AT_A_TIME_H */ | 60 | #endif /* _ASM_WORD_AT_A_TIME_H */ |
diff --git a/include/crypto/scatterwalk.h b/include/crypto/scatterwalk.h index 13621cc8cf4c..6a626a507b8c 100644 --- a/include/crypto/scatterwalk.h +++ b/include/crypto/scatterwalk.h | |||
@@ -36,6 +36,7 @@ static inline void scatterwalk_sg_chain(struct scatterlist *sg1, int num, | |||
36 | { | 36 | { |
37 | sg_set_page(&sg1[num - 1], (void *)sg2, 0, 0); | 37 | sg_set_page(&sg1[num - 1], (void *)sg2, 0, 0); |
38 | sg1[num - 1].page_link &= ~0x02; | 38 | sg1[num - 1].page_link &= ~0x02; |
39 | sg1[num - 1].page_link |= 0x01; | ||
39 | } | 40 | } |
40 | 41 | ||
41 | static inline struct scatterlist *scatterwalk_sg_next(struct scatterlist *sg) | 42 | static inline struct scatterlist *scatterwalk_sg_next(struct scatterlist *sg) |
@@ -43,7 +44,7 @@ static inline struct scatterlist *scatterwalk_sg_next(struct scatterlist *sg) | |||
43 | if (sg_is_last(sg)) | 44 | if (sg_is_last(sg)) |
44 | return NULL; | 45 | return NULL; |
45 | 46 | ||
46 | return (++sg)->length ? sg : (void *)sg_page(sg); | 47 | return (++sg)->length ? sg : sg_chain_ptr(sg); |
47 | } | 48 | } |
48 | 49 | ||
49 | static inline void scatterwalk_crypto_chain(struct scatterlist *head, | 50 | static inline void scatterwalk_crypto_chain(struct scatterlist *head, |
diff --git a/include/linux/assoc_array.h b/include/linux/assoc_array.h index 9a193b84238a..a89df3be1686 100644 --- a/include/linux/assoc_array.h +++ b/include/linux/assoc_array.h | |||
@@ -41,10 +41,10 @@ struct assoc_array_ops { | |||
41 | /* Is this the object we're looking for? */ | 41 | /* Is this the object we're looking for? */ |
42 | bool (*compare_object)(const void *object, const void *index_key); | 42 | bool (*compare_object)(const void *object, const void *index_key); |
43 | 43 | ||
44 | /* How different are two objects, to a bit position in their keys? (or | 44 | /* How different is an object from an index key, to a bit position in |
45 | * -1 if they're the same) | 45 | * their keys? (or -1 if they're the same) |
46 | */ | 46 | */ |
47 | int (*diff_objects)(const void *a, const void *b); | 47 | int (*diff_objects)(const void *object, const void *index_key); |
48 | 48 | ||
49 | /* Method to free an object. */ | 49 | /* Method to free an object. */ |
50 | void (*free_object)(void *object); | 50 | void (*free_object)(void *object); |
diff --git a/include/linux/compiler-intel.h b/include/linux/compiler-intel.h index 973ce10c40b6..dc1bd3dcf11f 100644 --- a/include/linux/compiler-intel.h +++ b/include/linux/compiler-intel.h | |||
@@ -28,8 +28,6 @@ | |||
28 | 28 | ||
29 | #endif | 29 | #endif |
30 | 30 | ||
31 | #define uninitialized_var(x) x | ||
32 | |||
33 | #ifndef __HAVE_BUILTIN_BSWAP16__ | 31 | #ifndef __HAVE_BUILTIN_BSWAP16__ |
34 | /* icc has this, but it's called _bswap16 */ | 32 | /* icc has this, but it's called _bswap16 */ |
35 | #define __HAVE_BUILTIN_BSWAP16__ | 33 | #define __HAVE_BUILTIN_BSWAP16__ |
diff --git a/include/linux/dcache.h b/include/linux/dcache.h index 57e87e749a48..bf72e9ac6de0 100644 --- a/include/linux/dcache.h +++ b/include/linux/dcache.h | |||
@@ -29,8 +29,10 @@ struct vfsmount; | |||
29 | /* The hash is always the low bits of hash_len */ | 29 | /* The hash is always the low bits of hash_len */ |
30 | #ifdef __LITTLE_ENDIAN | 30 | #ifdef __LITTLE_ENDIAN |
31 | #define HASH_LEN_DECLARE u32 hash; u32 len; | 31 | #define HASH_LEN_DECLARE u32 hash; u32 len; |
32 | #define bytemask_from_count(cnt) (~(~0ul << (cnt)*8)) | ||
32 | #else | 33 | #else |
33 | #define HASH_LEN_DECLARE u32 len; u32 hash; | 34 | #define HASH_LEN_DECLARE u32 len; u32 hash; |
35 | #define bytemask_from_count(cnt) (~(~0ul >> (cnt)*8)) | ||
34 | #endif | 36 | #endif |
35 | 37 | ||
36 | /* | 38 | /* |
diff --git a/include/linux/efi.h b/include/linux/efi.h index bc5687d0f315..11ce6784a196 100644 --- a/include/linux/efi.h +++ b/include/linux/efi.h | |||
@@ -801,6 +801,8 @@ struct efivar_entry { | |||
801 | struct efi_variable var; | 801 | struct efi_variable var; |
802 | struct list_head list; | 802 | struct list_head list; |
803 | struct kobject kobj; | 803 | struct kobject kobj; |
804 | bool scanning; | ||
805 | bool deleting; | ||
804 | }; | 806 | }; |
805 | 807 | ||
806 | 808 | ||
@@ -866,6 +868,8 @@ void efivar_run_worker(void); | |||
866 | #if defined(CONFIG_EFI_VARS) || defined(CONFIG_EFI_VARS_MODULE) | 868 | #if defined(CONFIG_EFI_VARS) || defined(CONFIG_EFI_VARS_MODULE) |
867 | int efivars_sysfs_init(void); | 869 | int efivars_sysfs_init(void); |
868 | 870 | ||
871 | #define EFIVARS_DATA_SIZE_MAX 1024 | ||
872 | |||
869 | #endif /* CONFIG_EFI_VARS */ | 873 | #endif /* CONFIG_EFI_VARS */ |
870 | 874 | ||
871 | #endif /* _LINUX_EFI_H */ | 875 | #endif /* _LINUX_EFI_H */ |
diff --git a/include/linux/ftrace_event.h b/include/linux/ftrace_event.h index 9abbe630c456..8c9b7a1c4138 100644 --- a/include/linux/ftrace_event.h +++ b/include/linux/ftrace_event.h | |||
@@ -248,6 +248,9 @@ struct ftrace_event_call { | |||
248 | #ifdef CONFIG_PERF_EVENTS | 248 | #ifdef CONFIG_PERF_EVENTS |
249 | int perf_refcount; | 249 | int perf_refcount; |
250 | struct hlist_head __percpu *perf_events; | 250 | struct hlist_head __percpu *perf_events; |
251 | |||
252 | int (*perf_perm)(struct ftrace_event_call *, | ||
253 | struct perf_event *); | ||
251 | #endif | 254 | #endif |
252 | }; | 255 | }; |
253 | 256 | ||
@@ -317,6 +320,19 @@ struct ftrace_event_file { | |||
317 | } \ | 320 | } \ |
318 | early_initcall(trace_init_flags_##name); | 321 | early_initcall(trace_init_flags_##name); |
319 | 322 | ||
323 | #define __TRACE_EVENT_PERF_PERM(name, expr...) \ | ||
324 | static int perf_perm_##name(struct ftrace_event_call *tp_event, \ | ||
325 | struct perf_event *p_event) \ | ||
326 | { \ | ||
327 | return ({ expr; }); \ | ||
328 | } \ | ||
329 | static int __init trace_init_perf_perm_##name(void) \ | ||
330 | { \ | ||
331 | event_##name.perf_perm = &perf_perm_##name; \ | ||
332 | return 0; \ | ||
333 | } \ | ||
334 | early_initcall(trace_init_perf_perm_##name); | ||
335 | |||
320 | #define PERF_MAX_TRACE_SIZE 2048 | 336 | #define PERF_MAX_TRACE_SIZE 2048 |
321 | 337 | ||
322 | #define MAX_FILTER_STR_VAL 256 /* Should handle KSYM_SYMBOL_LEN */ | 338 | #define MAX_FILTER_STR_VAL 256 /* Should handle KSYM_SYMBOL_LEN */ |
diff --git a/include/linux/gpio/driver.h b/include/linux/gpio/driver.h index 82eac610ce1a..3ea2cf6b0e6c 100644 --- a/include/linux/gpio/driver.h +++ b/include/linux/gpio/driver.h | |||
@@ -2,9 +2,12 @@ | |||
2 | #define __LINUX_GPIO_DRIVER_H | 2 | #define __LINUX_GPIO_DRIVER_H |
3 | 3 | ||
4 | #include <linux/types.h> | 4 | #include <linux/types.h> |
5 | #include <linux/module.h> | ||
5 | 6 | ||
6 | struct device; | 7 | struct device; |
7 | struct gpio_desc; | 8 | struct gpio_desc; |
9 | struct of_phandle_args; | ||
10 | struct device_node; | ||
8 | struct seq_file; | 11 | struct seq_file; |
9 | 12 | ||
10 | /** | 13 | /** |
diff --git a/include/linux/hid-sensor-hub.h b/include/linux/hid-sensor-hub.h index 206a2af6b62b..b914ca3f57ba 100644 --- a/include/linux/hid-sensor-hub.h +++ b/include/linux/hid-sensor-hub.h | |||
@@ -42,6 +42,8 @@ struct hid_sensor_hub_attribute_info { | |||
42 | s32 units; | 42 | s32 units; |
43 | s32 unit_expo; | 43 | s32 unit_expo; |
44 | s32 size; | 44 | s32 size; |
45 | s32 logical_minimum; | ||
46 | s32 logical_maximum; | ||
45 | }; | 47 | }; |
46 | 48 | ||
47 | /** | 49 | /** |
diff --git a/include/linux/hid-sensor-ids.h b/include/linux/hid-sensor-ids.h index 4f945d3ed49f..8323775ac21d 100644 --- a/include/linux/hid-sensor-ids.h +++ b/include/linux/hid-sensor-ids.h | |||
@@ -117,4 +117,16 @@ | |||
117 | #define HID_USAGE_SENSOR_PROP_REPORT_STATE 0x200316 | 117 | #define HID_USAGE_SENSOR_PROP_REPORT_STATE 0x200316 |
118 | #define HID_USAGE_SENSOR_PROY_POWER_STATE 0x200319 | 118 | #define HID_USAGE_SENSOR_PROY_POWER_STATE 0x200319 |
119 | 119 | ||
120 | /* Power state enumerations */ | ||
121 | #define HID_USAGE_SENSOR_PROP_POWER_STATE_UNDEFINED_ENUM 0x00 | ||
122 | #define HID_USAGE_SENSOR_PROP_POWER_STATE_D0_FULL_POWER_ENUM 0x01 | ||
123 | #define HID_USAGE_SENSOR_PROP_POWER_STATE_D1_LOW_POWER_ENUM 0x02 | ||
124 | #define HID_USAGE_SENSOR_PROP_POWER_STATE_D2_STANDBY_WITH_WAKE_ENUM 0x03 | ||
125 | #define HID_USAGE_SENSOR_PROP_POWER_STATE_D3_SLEEP_WITH_WAKE_ENUM 0x04 | ||
126 | #define HID_USAGE_SENSOR_PROP_POWER_STATE_D4_POWER_OFF_ENUM 0x05 | ||
127 | |||
128 | /* Report State enumerations */ | ||
129 | #define HID_USAGE_SENSOR_PROP_REPORTING_STATE_NO_EVENTS_ENUM 0x00 | ||
130 | #define HID_USAGE_SENSOR_PROP_REPORTING_STATE_ALL_EVENTS_ENUM 0x01 | ||
131 | |||
120 | #endif | 132 | #endif |
diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h index 9649ff0c63f8..bd7e98752222 100644 --- a/include/linux/hugetlb.h +++ b/include/linux/hugetlb.h | |||
@@ -142,7 +142,10 @@ static inline int dequeue_hwpoisoned_huge_page(struct page *page) | |||
142 | return 0; | 142 | return 0; |
143 | } | 143 | } |
144 | 144 | ||
145 | #define isolate_huge_page(p, l) false | 145 | static inline bool isolate_huge_page(struct page *page, struct list_head *list) |
146 | { | ||
147 | return false; | ||
148 | } | ||
146 | #define putback_active_hugepage(p) do {} while (0) | 149 | #define putback_active_hugepage(p) do {} while (0) |
147 | #define is_hugepage_active(x) false | 150 | #define is_hugepage_active(x) false |
148 | 151 | ||
diff --git a/include/linux/ipv6.h b/include/linux/ipv6.h index 5d89d1b808a6..c56c350324e4 100644 --- a/include/linux/ipv6.h +++ b/include/linux/ipv6.h | |||
@@ -4,6 +4,7 @@ | |||
4 | #include <uapi/linux/ipv6.h> | 4 | #include <uapi/linux/ipv6.h> |
5 | 5 | ||
6 | #define ipv6_optlen(p) (((p)->hdrlen+1) << 3) | 6 | #define ipv6_optlen(p) (((p)->hdrlen+1) << 3) |
7 | #define ipv6_authlen(p) (((p)->hdrlen+2) << 2) | ||
7 | /* | 8 | /* |
8 | * This structure contains configuration options per IPv6 link. | 9 | * This structure contains configuration options per IPv6 link. |
9 | */ | 10 | */ |
diff --git a/include/linux/irqreturn.h b/include/linux/irqreturn.h index 714ba08dc092..e374e369fb2f 100644 --- a/include/linux/irqreturn.h +++ b/include/linux/irqreturn.h | |||
@@ -14,6 +14,6 @@ enum irqreturn { | |||
14 | }; | 14 | }; |
15 | 15 | ||
16 | typedef enum irqreturn irqreturn_t; | 16 | typedef enum irqreturn irqreturn_t; |
17 | #define IRQ_RETVAL(x) ((x) != IRQ_NONE) | 17 | #define IRQ_RETVAL(x) ((x) ? IRQ_HANDLED : IRQ_NONE) |
18 | 18 | ||
19 | #endif | 19 | #endif |
diff --git a/include/linux/kernel.h b/include/linux/kernel.h index d4e98d13eff4..ecb87544cc5d 100644 --- a/include/linux/kernel.h +++ b/include/linux/kernel.h | |||
@@ -193,7 +193,8 @@ extern int _cond_resched(void); | |||
193 | (__x < 0) ? -__x : __x; \ | 193 | (__x < 0) ? -__x : __x; \ |
194 | }) | 194 | }) |
195 | 195 | ||
196 | #if defined(CONFIG_PROVE_LOCKING) || defined(CONFIG_DEBUG_ATOMIC_SLEEP) | 196 | #if defined(CONFIG_MMU) && \ |
197 | (defined(CONFIG_PROVE_LOCKING) || defined(CONFIG_DEBUG_ATOMIC_SLEEP)) | ||
197 | void might_fault(void); | 198 | void might_fault(void); |
198 | #else | 199 | #else |
199 | static inline void might_fault(void) { } | 200 | static inline void might_fault(void) { } |
diff --git a/include/linux/kexec.h b/include/linux/kexec.h index d78d28a733b1..5fd33dc1fe3a 100644 --- a/include/linux/kexec.h +++ b/include/linux/kexec.h | |||
@@ -198,6 +198,9 @@ extern u32 vmcoreinfo_note[VMCOREINFO_NOTE_SIZE/4]; | |||
198 | extern size_t vmcoreinfo_size; | 198 | extern size_t vmcoreinfo_size; |
199 | extern size_t vmcoreinfo_max_size; | 199 | extern size_t vmcoreinfo_max_size; |
200 | 200 | ||
201 | /* flag to track if kexec reboot is in progress */ | ||
202 | extern bool kexec_in_progress; | ||
203 | |||
201 | int __init parse_crashkernel(char *cmdline, unsigned long long system_ram, | 204 | int __init parse_crashkernel(char *cmdline, unsigned long long system_ram, |
202 | unsigned long long *crash_size, unsigned long long *crash_base); | 205 | unsigned long long *crash_size, unsigned long long *crash_base); |
203 | int parse_crashkernel_high(char *cmdline, unsigned long long system_ram, | 206 | int parse_crashkernel_high(char *cmdline, unsigned long long system_ram, |
diff --git a/include/linux/mfd/samsung/core.h b/include/linux/mfd/samsung/core.h index 2d0c9071bcfb..cab2dd279076 100644 --- a/include/linux/mfd/samsung/core.h +++ b/include/linux/mfd/samsung/core.h | |||
@@ -39,7 +39,8 @@ enum sec_device_type { | |||
39 | struct sec_pmic_dev { | 39 | struct sec_pmic_dev { |
40 | struct device *dev; | 40 | struct device *dev; |
41 | struct sec_platform_data *pdata; | 41 | struct sec_platform_data *pdata; |
42 | struct regmap *regmap; | 42 | struct regmap *regmap_pmic; |
43 | struct regmap *regmap_rtc; | ||
43 | struct i2c_client *i2c; | 44 | struct i2c_client *i2c; |
44 | struct i2c_client *rtc; | 45 | struct i2c_client *rtc; |
45 | 46 | ||
diff --git a/include/linux/micrel_phy.h b/include/linux/micrel_phy.h index ad05ce60c1c9..2e5b194b9b19 100644 --- a/include/linux/micrel_phy.h +++ b/include/linux/micrel_phy.h | |||
@@ -22,6 +22,8 @@ | |||
22 | #define PHY_ID_KSZ8021 0x00221555 | 22 | #define PHY_ID_KSZ8021 0x00221555 |
23 | #define PHY_ID_KSZ8031 0x00221556 | 23 | #define PHY_ID_KSZ8031 0x00221556 |
24 | #define PHY_ID_KSZ8041 0x00221510 | 24 | #define PHY_ID_KSZ8041 0x00221510 |
25 | /* undocumented */ | ||
26 | #define PHY_ID_KSZ8041RNLI 0x00221537 | ||
25 | #define PHY_ID_KSZ8051 0x00221550 | 27 | #define PHY_ID_KSZ8051 0x00221550 |
26 | /* same id: ks8001 Rev. A/B, and ks8721 Rev 3. */ | 28 | /* same id: ks8001 Rev. A/B, and ks8721 Rev 3. */ |
27 | #define PHY_ID_KSZ8001 0x0022161A | 29 | #define PHY_ID_KSZ8001 0x0022161A |
diff --git a/include/linux/net.h b/include/linux/net.h index 4bcee94cef93..69be3e6079c8 100644 --- a/include/linux/net.h +++ b/include/linux/net.h | |||
@@ -181,7 +181,7 @@ struct proto_ops { | |||
181 | int offset, size_t size, int flags); | 181 | int offset, size_t size, int flags); |
182 | ssize_t (*splice_read)(struct socket *sock, loff_t *ppos, | 182 | ssize_t (*splice_read)(struct socket *sock, loff_t *ppos, |
183 | struct pipe_inode_info *pipe, size_t len, unsigned int flags); | 183 | struct pipe_inode_info *pipe, size_t len, unsigned int flags); |
184 | void (*set_peek_off)(struct sock *sk, int val); | 184 | int (*set_peek_off)(struct sock *sk, int val); |
185 | }; | 185 | }; |
186 | 186 | ||
187 | #define DECLARE_SOCKADDR(type, dst, src) \ | 187 | #define DECLARE_SOCKADDR(type, dst, src) \ |
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index 7f0ed423a360..d9a550bf3e8e 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h | |||
@@ -1255,7 +1255,7 @@ struct net_device { | |||
1255 | unsigned char perm_addr[MAX_ADDR_LEN]; /* permanent hw address */ | 1255 | unsigned char perm_addr[MAX_ADDR_LEN]; /* permanent hw address */ |
1256 | unsigned char addr_assign_type; /* hw address assignment type */ | 1256 | unsigned char addr_assign_type; /* hw address assignment type */ |
1257 | unsigned char addr_len; /* hardware address length */ | 1257 | unsigned char addr_len; /* hardware address length */ |
1258 | unsigned char neigh_priv_len; | 1258 | unsigned short neigh_priv_len; |
1259 | unsigned short dev_id; /* Used to differentiate devices | 1259 | unsigned short dev_id; /* Used to differentiate devices |
1260 | * that share the same link | 1260 | * that share the same link |
1261 | * layer address | 1261 | * layer address |
diff --git a/include/linux/nfs4.h b/include/linux/nfs4.h index c1637062c1ce..12c2cb947df5 100644 --- a/include/linux/nfs4.h +++ b/include/linux/nfs4.h | |||
@@ -413,16 +413,6 @@ enum lock_type4 { | |||
413 | #define NFS4_VERSION 4 | 413 | #define NFS4_VERSION 4 |
414 | #define NFS4_MINOR_VERSION 0 | 414 | #define NFS4_MINOR_VERSION 0 |
415 | 415 | ||
416 | #if defined(CONFIG_NFS_V4_2) | ||
417 | #define NFS4_MAX_MINOR_VERSION 2 | ||
418 | #else | ||
419 | #if defined(CONFIG_NFS_V4_1) | ||
420 | #define NFS4_MAX_MINOR_VERSION 1 | ||
421 | #else | ||
422 | #define NFS4_MAX_MINOR_VERSION 0 | ||
423 | #endif /* CONFIG_NFS_V4_1 */ | ||
424 | #endif /* CONFIG_NFS_V4_2 */ | ||
425 | |||
426 | #define NFS4_DEBUG 1 | 416 | #define NFS4_DEBUG 1 |
427 | 417 | ||
428 | /* Index of predefined Linux client operations */ | 418 | /* Index of predefined Linux client operations */ |
diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h index 14a48207a304..48997374eaf0 100644 --- a/include/linux/nfs_fs.h +++ b/include/linux/nfs_fs.h | |||
@@ -507,24 +507,6 @@ extern int nfs_mountpoint_expiry_timeout; | |||
507 | extern void nfs_release_automount_timer(void); | 507 | extern void nfs_release_automount_timer(void); |
508 | 508 | ||
509 | /* | 509 | /* |
510 | * linux/fs/nfs/nfs4proc.c | ||
511 | */ | ||
512 | #ifdef CONFIG_NFS_V4_SECURITY_LABEL | ||
513 | extern struct nfs4_label *nfs4_label_alloc(struct nfs_server *server, gfp_t flags); | ||
514 | static inline void nfs4_label_free(struct nfs4_label *label) | ||
515 | { | ||
516 | if (label) { | ||
517 | kfree(label->label); | ||
518 | kfree(label); | ||
519 | } | ||
520 | return; | ||
521 | } | ||
522 | #else | ||
523 | static inline struct nfs4_label *nfs4_label_alloc(struct nfs_server *server, gfp_t flags) { return NULL; } | ||
524 | static inline void nfs4_label_free(void *label) {} | ||
525 | #endif | ||
526 | |||
527 | /* | ||
528 | * linux/fs/nfs/unlink.c | 510 | * linux/fs/nfs/unlink.c |
529 | */ | 511 | */ |
530 | extern void nfs_complete_unlink(struct dentry *dentry, struct inode *); | 512 | extern void nfs_complete_unlink(struct dentry *dentry, struct inode *); |
diff --git a/include/linux/pci.h b/include/linux/pci.h index 1084a15175e0..a13d6825e586 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h | |||
@@ -960,6 +960,7 @@ void pci_update_resource(struct pci_dev *dev, int resno); | |||
960 | int __must_check pci_assign_resource(struct pci_dev *dev, int i); | 960 | int __must_check pci_assign_resource(struct pci_dev *dev, int i); |
961 | int __must_check pci_reassign_resource(struct pci_dev *dev, int i, resource_size_t add_size, resource_size_t align); | 961 | int __must_check pci_reassign_resource(struct pci_dev *dev, int i, resource_size_t add_size, resource_size_t align); |
962 | int pci_select_bars(struct pci_dev *dev, unsigned long flags); | 962 | int pci_select_bars(struct pci_dev *dev, unsigned long flags); |
963 | bool pci_device_is_present(struct pci_dev *pdev); | ||
963 | 964 | ||
964 | /* ROM control related routines */ | 965 | /* ROM control related routines */ |
965 | int pci_enable_rom(struct pci_dev *pdev); | 966 | int pci_enable_rom(struct pci_dev *pdev); |
@@ -1567,65 +1568,65 @@ enum pci_fixup_pass { | |||
1567 | /* Anonymous variables would be nice... */ | 1568 | /* Anonymous variables would be nice... */ |
1568 | #define DECLARE_PCI_FIXUP_SECTION(section, name, vendor, device, class, \ | 1569 | #define DECLARE_PCI_FIXUP_SECTION(section, name, vendor, device, class, \ |
1569 | class_shift, hook) \ | 1570 | class_shift, hook) \ |
1570 | static const struct pci_fixup __pci_fixup_##name __used \ | 1571 | static const struct pci_fixup __PASTE(__pci_fixup_##name,__LINE__) __used \ |
1571 | __attribute__((__section__(#section), aligned((sizeof(void *))))) \ | 1572 | __attribute__((__section__(#section), aligned((sizeof(void *))))) \ |
1572 | = { vendor, device, class, class_shift, hook }; | 1573 | = { vendor, device, class, class_shift, hook }; |
1573 | 1574 | ||
1574 | #define DECLARE_PCI_FIXUP_CLASS_EARLY(vendor, device, class, \ | 1575 | #define DECLARE_PCI_FIXUP_CLASS_EARLY(vendor, device, class, \ |
1575 | class_shift, hook) \ | 1576 | class_shift, hook) \ |
1576 | DECLARE_PCI_FIXUP_SECTION(.pci_fixup_early, \ | 1577 | DECLARE_PCI_FIXUP_SECTION(.pci_fixup_early, \ |
1577 | vendor##device##hook, vendor, device, class, class_shift, hook) | 1578 | hook, vendor, device, class, class_shift, hook) |
1578 | #define DECLARE_PCI_FIXUP_CLASS_HEADER(vendor, device, class, \ | 1579 | #define DECLARE_PCI_FIXUP_CLASS_HEADER(vendor, device, class, \ |
1579 | class_shift, hook) \ | 1580 | class_shift, hook) \ |
1580 | DECLARE_PCI_FIXUP_SECTION(.pci_fixup_header, \ | 1581 | DECLARE_PCI_FIXUP_SECTION(.pci_fixup_header, \ |
1581 | vendor##device##hook, vendor, device, class, class_shift, hook) | 1582 | hook, vendor, device, class, class_shift, hook) |
1582 | #define DECLARE_PCI_FIXUP_CLASS_FINAL(vendor, device, class, \ | 1583 | #define DECLARE_PCI_FIXUP_CLASS_FINAL(vendor, device, class, \ |
1583 | class_shift, hook) \ | 1584 | class_shift, hook) \ |
1584 | DECLARE_PCI_FIXUP_SECTION(.pci_fixup_final, \ | 1585 | DECLARE_PCI_FIXUP_SECTION(.pci_fixup_final, \ |
1585 | vendor##device##hook, vendor, device, class, class_shift, hook) | 1586 | hook, vendor, device, class, class_shift, hook) |
1586 | #define DECLARE_PCI_FIXUP_CLASS_ENABLE(vendor, device, class, \ | 1587 | #define DECLARE_PCI_FIXUP_CLASS_ENABLE(vendor, device, class, \ |
1587 | class_shift, hook) \ | 1588 | class_shift, hook) \ |
1588 | DECLARE_PCI_FIXUP_SECTION(.pci_fixup_enable, \ | 1589 | DECLARE_PCI_FIXUP_SECTION(.pci_fixup_enable, \ |
1589 | vendor##device##hook, vendor, device, class, class_shift, hook) | 1590 | hook, vendor, device, class, class_shift, hook) |
1590 | #define DECLARE_PCI_FIXUP_CLASS_RESUME(vendor, device, class, \ | 1591 | #define DECLARE_PCI_FIXUP_CLASS_RESUME(vendor, device, class, \ |
1591 | class_shift, hook) \ | 1592 | class_shift, hook) \ |
1592 | DECLARE_PCI_FIXUP_SECTION(.pci_fixup_resume, \ | 1593 | DECLARE_PCI_FIXUP_SECTION(.pci_fixup_resume, \ |
1593 | resume##vendor##device##hook, vendor, device, class, \ | 1594 | resume##hook, vendor, device, class, \ |
1594 | class_shift, hook) | 1595 | class_shift, hook) |
1595 | #define DECLARE_PCI_FIXUP_CLASS_RESUME_EARLY(vendor, device, class, \ | 1596 | #define DECLARE_PCI_FIXUP_CLASS_RESUME_EARLY(vendor, device, class, \ |
1596 | class_shift, hook) \ | 1597 | class_shift, hook) \ |
1597 | DECLARE_PCI_FIXUP_SECTION(.pci_fixup_resume_early, \ | 1598 | DECLARE_PCI_FIXUP_SECTION(.pci_fixup_resume_early, \ |
1598 | resume_early##vendor##device##hook, vendor, device, \ | 1599 | resume_early##hook, vendor, device, \ |
1599 | class, class_shift, hook) | 1600 | class, class_shift, hook) |
1600 | #define DECLARE_PCI_FIXUP_CLASS_SUSPEND(vendor, device, class, \ | 1601 | #define DECLARE_PCI_FIXUP_CLASS_SUSPEND(vendor, device, class, \ |
1601 | class_shift, hook) \ | 1602 | class_shift, hook) \ |
1602 | DECLARE_PCI_FIXUP_SECTION(.pci_fixup_suspend, \ | 1603 | DECLARE_PCI_FIXUP_SECTION(.pci_fixup_suspend, \ |
1603 | suspend##vendor##device##hook, vendor, device, class, \ | 1604 | suspend##hook, vendor, device, class, \ |
1604 | class_shift, hook) | 1605 | class_shift, hook) |
1605 | 1606 | ||
1606 | #define DECLARE_PCI_FIXUP_EARLY(vendor, device, hook) \ | 1607 | #define DECLARE_PCI_FIXUP_EARLY(vendor, device, hook) \ |
1607 | DECLARE_PCI_FIXUP_SECTION(.pci_fixup_early, \ | 1608 | DECLARE_PCI_FIXUP_SECTION(.pci_fixup_early, \ |
1608 | vendor##device##hook, vendor, device, PCI_ANY_ID, 0, hook) | 1609 | hook, vendor, device, PCI_ANY_ID, 0, hook) |
1609 | #define DECLARE_PCI_FIXUP_HEADER(vendor, device, hook) \ | 1610 | #define DECLARE_PCI_FIXUP_HEADER(vendor, device, hook) \ |
1610 | DECLARE_PCI_FIXUP_SECTION(.pci_fixup_header, \ | 1611 | DECLARE_PCI_FIXUP_SECTION(.pci_fixup_header, \ |
1611 | vendor##device##hook, vendor, device, PCI_ANY_ID, 0, hook) | 1612 | hook, vendor, device, PCI_ANY_ID, 0, hook) |
1612 | #define DECLARE_PCI_FIXUP_FINAL(vendor, device, hook) \ | 1613 | #define DECLARE_PCI_FIXUP_FINAL(vendor, device, hook) \ |
1613 | DECLARE_PCI_FIXUP_SECTION(.pci_fixup_final, \ | 1614 | DECLARE_PCI_FIXUP_SECTION(.pci_fixup_final, \ |
1614 | vendor##device##hook, vendor, device, PCI_ANY_ID, 0, hook) | 1615 | hook, vendor, device, PCI_ANY_ID, 0, hook) |
1615 | #define DECLARE_PCI_FIXUP_ENABLE(vendor, device, hook) \ | 1616 | #define DECLARE_PCI_FIXUP_ENABLE(vendor, device, hook) \ |
1616 | DECLARE_PCI_FIXUP_SECTION(.pci_fixup_enable, \ | 1617 | DECLARE_PCI_FIXUP_SECTION(.pci_fixup_enable, \ |
1617 | vendor##device##hook, vendor, device, PCI_ANY_ID, 0, hook) | 1618 | hook, vendor, device, PCI_ANY_ID, 0, hook) |
1618 | #define DECLARE_PCI_FIXUP_RESUME(vendor, device, hook) \ | 1619 | #define DECLARE_PCI_FIXUP_RESUME(vendor, device, hook) \ |
1619 | DECLARE_PCI_FIXUP_SECTION(.pci_fixup_resume, \ | 1620 | DECLARE_PCI_FIXUP_SECTION(.pci_fixup_resume, \ |
1620 | resume##vendor##device##hook, vendor, device, \ | 1621 | resume##hook, vendor, device, \ |
1621 | PCI_ANY_ID, 0, hook) | 1622 | PCI_ANY_ID, 0, hook) |
1622 | #define DECLARE_PCI_FIXUP_RESUME_EARLY(vendor, device, hook) \ | 1623 | #define DECLARE_PCI_FIXUP_RESUME_EARLY(vendor, device, hook) \ |
1623 | DECLARE_PCI_FIXUP_SECTION(.pci_fixup_resume_early, \ | 1624 | DECLARE_PCI_FIXUP_SECTION(.pci_fixup_resume_early, \ |
1624 | resume_early##vendor##device##hook, vendor, device, \ | 1625 | resume_early##hook, vendor, device, \ |
1625 | PCI_ANY_ID, 0, hook) | 1626 | PCI_ANY_ID, 0, hook) |
1626 | #define DECLARE_PCI_FIXUP_SUSPEND(vendor, device, hook) \ | 1627 | #define DECLARE_PCI_FIXUP_SUSPEND(vendor, device, hook) \ |
1627 | DECLARE_PCI_FIXUP_SECTION(.pci_fixup_suspend, \ | 1628 | DECLARE_PCI_FIXUP_SECTION(.pci_fixup_suspend, \ |
1628 | suspend##vendor##device##hook, vendor, device, \ | 1629 | suspend##hook, vendor, device, \ |
1629 | PCI_ANY_ID, 0, hook) | 1630 | PCI_ANY_ID, 0, hook) |
1630 | 1631 | ||
1631 | #ifdef CONFIG_PCI_QUIRKS | 1632 | #ifdef CONFIG_PCI_QUIRKS |
diff --git a/include/linux/platform_data/gpio-davinci.h b/include/linux/platform_data/gpio-davinci.h index 6efd20264585..fbe2f7535741 100644 --- a/include/linux/platform_data/gpio-davinci.h +++ b/include/linux/platform_data/gpio-davinci.h | |||
@@ -28,13 +28,12 @@ enum davinci_gpio_type { | |||
28 | struct davinci_gpio_platform_data { | 28 | struct davinci_gpio_platform_data { |
29 | u32 ngpio; | 29 | u32 ngpio; |
30 | u32 gpio_unbanked; | 30 | u32 gpio_unbanked; |
31 | u32 intc_irq_num; | ||
32 | }; | 31 | }; |
33 | 32 | ||
34 | 33 | ||
35 | struct davinci_gpio_controller { | 34 | struct davinci_gpio_controller { |
36 | struct gpio_chip chip; | 35 | struct gpio_chip chip; |
37 | int irq_base; | 36 | struct irq_domain *irq_domain; |
38 | /* Serialize access to GPIO registers */ | 37 | /* Serialize access to GPIO registers */ |
39 | spinlock_t lock; | 38 | spinlock_t lock; |
40 | void __iomem *regs; | 39 | void __iomem *regs; |
diff --git a/include/linux/sched.h b/include/linux/sched.h index 7e35d4b9e14a..768b037dfacb 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h | |||
@@ -831,8 +831,6 @@ struct sched_domain { | |||
831 | unsigned int balance_interval; /* initialise to 1. units in ms. */ | 831 | unsigned int balance_interval; /* initialise to 1. units in ms. */ |
832 | unsigned int nr_balance_failed; /* initialise to 0 */ | 832 | unsigned int nr_balance_failed; /* initialise to 0 */ |
833 | 833 | ||
834 | u64 last_update; | ||
835 | |||
836 | /* idle_balance() stats */ | 834 | /* idle_balance() stats */ |
837 | u64 max_newidle_lb_cost; | 835 | u64 max_newidle_lb_cost; |
838 | unsigned long next_decay_max_lb_cost; | 836 | unsigned long next_decay_max_lb_cost; |
diff --git a/include/linux/shmem_fs.h b/include/linux/shmem_fs.h index 30aa0dc60d75..9d55438bc4ad 100644 --- a/include/linux/shmem_fs.h +++ b/include/linux/shmem_fs.h | |||
@@ -47,6 +47,8 @@ extern int shmem_init(void); | |||
47 | extern int shmem_fill_super(struct super_block *sb, void *data, int silent); | 47 | extern int shmem_fill_super(struct super_block *sb, void *data, int silent); |
48 | extern struct file *shmem_file_setup(const char *name, | 48 | extern struct file *shmem_file_setup(const char *name, |
49 | loff_t size, unsigned long flags); | 49 | loff_t size, unsigned long flags); |
50 | extern struct file *shmem_kernel_file_setup(const char *name, loff_t size, | ||
51 | unsigned long flags); | ||
50 | extern int shmem_zero_setup(struct vm_area_struct *); | 52 | extern int shmem_zero_setup(struct vm_area_struct *); |
51 | extern int shmem_lock(struct file *file, int lock, struct user_struct *user); | 53 | extern int shmem_lock(struct file *file, int lock, struct user_struct *user); |
52 | extern void shmem_unlock_mapping(struct address_space *mapping); | 54 | extern void shmem_unlock_mapping(struct address_space *mapping); |
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index bec1cc7d5e3c..215b5ea1cb30 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h | |||
@@ -2263,6 +2263,24 @@ static inline void skb_postpull_rcsum(struct sk_buff *skb, | |||
2263 | 2263 | ||
2264 | unsigned char *skb_pull_rcsum(struct sk_buff *skb, unsigned int len); | 2264 | unsigned char *skb_pull_rcsum(struct sk_buff *skb, unsigned int len); |
2265 | 2265 | ||
2266 | /** | ||
2267 | * pskb_trim_rcsum - trim received skb and update checksum | ||
2268 | * @skb: buffer to trim | ||
2269 | * @len: new length | ||
2270 | * | ||
2271 | * This is exactly the same as pskb_trim except that it ensures the | ||
2272 | * checksum of received packets are still valid after the operation. | ||
2273 | */ | ||
2274 | |||
2275 | static inline int pskb_trim_rcsum(struct sk_buff *skb, unsigned int len) | ||
2276 | { | ||
2277 | if (likely(len >= skb->len)) | ||
2278 | return 0; | ||
2279 | if (skb->ip_summed == CHECKSUM_COMPLETE) | ||
2280 | skb->ip_summed = CHECKSUM_NONE; | ||
2281 | return __pskb_trim(skb, len); | ||
2282 | } | ||
2283 | |||
2266 | #define skb_queue_walk(queue, skb) \ | 2284 | #define skb_queue_walk(queue, skb) \ |
2267 | for (skb = (queue)->next; \ | 2285 | for (skb = (queue)->next; \ |
2268 | skb != (struct sk_buff *)(queue); \ | 2286 | skb != (struct sk_buff *)(queue); \ |
@@ -2360,27 +2378,6 @@ __wsum __skb_checksum(const struct sk_buff *skb, int offset, int len, | |||
2360 | __wsum skb_checksum(const struct sk_buff *skb, int offset, int len, | 2378 | __wsum skb_checksum(const struct sk_buff *skb, int offset, int len, |
2361 | __wsum csum); | 2379 | __wsum csum); |
2362 | 2380 | ||
2363 | /** | ||
2364 | * pskb_trim_rcsum - trim received skb and update checksum | ||
2365 | * @skb: buffer to trim | ||
2366 | * @len: new length | ||
2367 | * | ||
2368 | * This is exactly the same as pskb_trim except that it ensures the | ||
2369 | * checksum of received packets are still valid after the operation. | ||
2370 | */ | ||
2371 | |||
2372 | static inline int pskb_trim_rcsum(struct sk_buff *skb, unsigned int len) | ||
2373 | { | ||
2374 | if (likely(len >= skb->len)) | ||
2375 | return 0; | ||
2376 | if (skb->ip_summed == CHECKSUM_COMPLETE) { | ||
2377 | __wsum adj = skb_checksum(skb, len, skb->len - len, 0); | ||
2378 | |||
2379 | skb->csum = csum_sub(skb->csum, adj); | ||
2380 | } | ||
2381 | return __pskb_trim(skb, len); | ||
2382 | } | ||
2383 | |||
2384 | static inline void *skb_header_pointer(const struct sk_buff *skb, int offset, | 2381 | static inline void *skb_header_pointer(const struct sk_buff *skb, int offset, |
2385 | int len, void *buffer) | 2382 | int len, void *buffer) |
2386 | { | 2383 | { |
diff --git a/include/linux/tracepoint.h b/include/linux/tracepoint.h index ebeab360d851..f16dc0a40049 100644 --- a/include/linux/tracepoint.h +++ b/include/linux/tracepoint.h | |||
@@ -267,6 +267,8 @@ static inline void tracepoint_synchronize_unregister(void) | |||
267 | 267 | ||
268 | #define TRACE_EVENT_FLAGS(event, flag) | 268 | #define TRACE_EVENT_FLAGS(event, flag) |
269 | 269 | ||
270 | #define TRACE_EVENT_PERF_PERM(event, expr...) | ||
271 | |||
270 | #endif /* DECLARE_TRACE */ | 272 | #endif /* DECLARE_TRACE */ |
271 | 273 | ||
272 | #ifndef TRACE_EVENT | 274 | #ifndef TRACE_EVENT |
@@ -399,4 +401,6 @@ static inline void tracepoint_synchronize_unregister(void) | |||
399 | 401 | ||
400 | #define TRACE_EVENT_FLAGS(event, flag) | 402 | #define TRACE_EVENT_FLAGS(event, flag) |
401 | 403 | ||
404 | #define TRACE_EVENT_PERF_PERM(event, expr...) | ||
405 | |||
402 | #endif /* ifdef TRACE_EVENT (see note above) */ | 406 | #endif /* ifdef TRACE_EVENT (see note above) */ |
diff --git a/include/linux/usb.h b/include/linux/usb.h index 7454865ad148..512ab162832c 100644 --- a/include/linux/usb.h +++ b/include/linux/usb.h | |||
@@ -1264,6 +1264,8 @@ typedef void (*usb_complete_t)(struct urb *); | |||
1264 | * @sg: scatter gather buffer list, the buffer size of each element in | 1264 | * @sg: scatter gather buffer list, the buffer size of each element in |
1265 | * the list (except the last) must be divisible by the endpoint's | 1265 | * the list (except the last) must be divisible by the endpoint's |
1266 | * max packet size if no_sg_constraint isn't set in 'struct usb_bus' | 1266 | * max packet size if no_sg_constraint isn't set in 'struct usb_bus' |
1267 | * (FIXME: scatter-gather under xHCI is broken for periodic transfers. | ||
1268 | * Do not use urb->sg for interrupt endpoints for now, only bulk.) | ||
1267 | * @num_mapped_sgs: (internal) number of mapped sg entries | 1269 | * @num_mapped_sgs: (internal) number of mapped sg entries |
1268 | * @num_sgs: number of entries in the sg list | 1270 | * @num_sgs: number of entries in the sg list |
1269 | * @transfer_buffer_length: How big is transfer_buffer. The transfer may | 1271 | * @transfer_buffer_length: How big is transfer_buffer. The transfer may |
diff --git a/include/linux/usb/wusb.h b/include/linux/usb/wusb.h index 0c4d4ca370ec..eeb28329fa3c 100644 --- a/include/linux/usb/wusb.h +++ b/include/linux/usb/wusb.h | |||
@@ -271,6 +271,8 @@ static inline u8 wusb_key_index(int index, int type, int originator) | |||
271 | #define WUSB_KEY_INDEX_TYPE_GTK 2 | 271 | #define WUSB_KEY_INDEX_TYPE_GTK 2 |
272 | #define WUSB_KEY_INDEX_ORIGINATOR_HOST 0 | 272 | #define WUSB_KEY_INDEX_ORIGINATOR_HOST 0 |
273 | #define WUSB_KEY_INDEX_ORIGINATOR_DEVICE 1 | 273 | #define WUSB_KEY_INDEX_ORIGINATOR_DEVICE 1 |
274 | /* bits 0-3 used for the key index. */ | ||
275 | #define WUSB_KEY_INDEX_MAX 15 | ||
274 | 276 | ||
275 | /* A CCM Nonce, defined in WUSB1.0[6.4.1] */ | 277 | /* A CCM Nonce, defined in WUSB1.0[6.4.1] */ |
276 | struct aes_ccm_nonce { | 278 | struct aes_ccm_nonce { |
diff --git a/include/media/videobuf2-core.h b/include/media/videobuf2-core.h index bd8218b15009..941055e9d125 100644 --- a/include/media/videobuf2-core.h +++ b/include/media/videobuf2-core.h | |||
@@ -83,7 +83,7 @@ struct vb2_fileio_data; | |||
83 | struct vb2_mem_ops { | 83 | struct vb2_mem_ops { |
84 | void *(*alloc)(void *alloc_ctx, unsigned long size, gfp_t gfp_flags); | 84 | void *(*alloc)(void *alloc_ctx, unsigned long size, gfp_t gfp_flags); |
85 | void (*put)(void *buf_priv); | 85 | void (*put)(void *buf_priv); |
86 | struct dma_buf *(*get_dmabuf)(void *buf_priv); | 86 | struct dma_buf *(*get_dmabuf)(void *buf_priv, unsigned long flags); |
87 | 87 | ||
88 | void *(*get_userptr)(void *alloc_ctx, unsigned long vaddr, | 88 | void *(*get_userptr)(void *alloc_ctx, unsigned long vaddr, |
89 | unsigned long size, int write); | 89 | unsigned long size, int write); |
diff --git a/include/net/ip.h b/include/net/ip.h index 217bc5bfc6c6..5a25f36fe3a7 100644 --- a/include/net/ip.h +++ b/include/net/ip.h | |||
@@ -473,7 +473,7 @@ int compat_ip_getsockopt(struct sock *sk, int level, int optname, | |||
473 | int ip_ra_control(struct sock *sk, unsigned char on, | 473 | int ip_ra_control(struct sock *sk, unsigned char on, |
474 | void (*destructor)(struct sock *)); | 474 | void (*destructor)(struct sock *)); |
475 | 475 | ||
476 | int ip_recv_error(struct sock *sk, struct msghdr *msg, int len); | 476 | int ip_recv_error(struct sock *sk, struct msghdr *msg, int len, int *addr_len); |
477 | void ip_icmp_error(struct sock *sk, struct sk_buff *skb, int err, __be16 port, | 477 | void ip_icmp_error(struct sock *sk, struct sk_buff *skb, int err, __be16 port, |
478 | u32 info, u8 *payload); | 478 | u32 info, u8 *payload); |
479 | void ip_local_error(struct sock *sk, int err, __be32 daddr, __be16 dport, | 479 | void ip_local_error(struct sock *sk, int err, __be32 daddr, __be16 dport, |
diff --git a/include/net/ipv6.h b/include/net/ipv6.h index 2a5f668cd683..488316e339a1 100644 --- a/include/net/ipv6.h +++ b/include/net/ipv6.h | |||
@@ -110,7 +110,8 @@ struct frag_hdr { | |||
110 | __be32 identification; | 110 | __be32 identification; |
111 | }; | 111 | }; |
112 | 112 | ||
113 | #define IP6_MF 0x0001 | 113 | #define IP6_MF 0x0001 |
114 | #define IP6_OFFSET 0xFFF8 | ||
114 | 115 | ||
115 | #include <net/sock.h> | 116 | #include <net/sock.h> |
116 | 117 | ||
@@ -776,8 +777,10 @@ int compat_ipv6_getsockopt(struct sock *sk, int level, int optname, | |||
776 | 777 | ||
777 | int ip6_datagram_connect(struct sock *sk, struct sockaddr *addr, int addr_len); | 778 | int ip6_datagram_connect(struct sock *sk, struct sockaddr *addr, int addr_len); |
778 | 779 | ||
779 | int ipv6_recv_error(struct sock *sk, struct msghdr *msg, int len); | 780 | int ipv6_recv_error(struct sock *sk, struct msghdr *msg, int len, |
780 | int ipv6_recv_rxpmtu(struct sock *sk, struct msghdr *msg, int len); | 781 | int *addr_len); |
782 | int ipv6_recv_rxpmtu(struct sock *sk, struct msghdr *msg, int len, | ||
783 | int *addr_len); | ||
781 | void ipv6_icmp_error(struct sock *sk, struct sk_buff *skb, int err, __be16 port, | 784 | void ipv6_icmp_error(struct sock *sk, struct sk_buff *skb, int err, __be16 port, |
782 | u32 info, u8 *payload); | 785 | u32 info, u8 *payload); |
783 | void ipv6_local_error(struct sock *sk, int err, struct flowi6 *fl6, u32 info); | 786 | void ipv6_local_error(struct sock *sk, int err, struct flowi6 *fl6, u32 info); |
diff --git a/include/net/ping.h b/include/net/ping.h index 3f67704f3747..90f48417b03d 100644 --- a/include/net/ping.h +++ b/include/net/ping.h | |||
@@ -31,7 +31,8 @@ | |||
31 | 31 | ||
32 | /* Compatibility glue so we can support IPv6 when it's compiled as a module */ | 32 | /* Compatibility glue so we can support IPv6 when it's compiled as a module */ |
33 | struct pingv6_ops { | 33 | struct pingv6_ops { |
34 | int (*ipv6_recv_error)(struct sock *sk, struct msghdr *msg, int len); | 34 | int (*ipv6_recv_error)(struct sock *sk, struct msghdr *msg, int len, |
35 | int *addr_len); | ||
35 | int (*ip6_datagram_recv_ctl)(struct sock *sk, struct msghdr *msg, | 36 | int (*ip6_datagram_recv_ctl)(struct sock *sk, struct msghdr *msg, |
36 | struct sk_buff *skb); | 37 | struct sk_buff *skb); |
37 | int (*icmpv6_err_convert)(u8 type, u8 code, int *err); | 38 | int (*icmpv6_err_convert)(u8 type, u8 code, int *err); |
diff --git a/include/net/sctp/structs.h b/include/net/sctp/structs.h index 2174d8da0770..67b5d0068273 100644 --- a/include/net/sctp/structs.h +++ b/include/net/sctp/structs.h | |||
@@ -629,6 +629,7 @@ struct sctp_chunk { | |||
629 | #define SCTP_NEED_FRTX 0x1 | 629 | #define SCTP_NEED_FRTX 0x1 |
630 | #define SCTP_DONT_FRTX 0x2 | 630 | #define SCTP_DONT_FRTX 0x2 |
631 | __u16 rtt_in_progress:1, /* This chunk used for RTT calc? */ | 631 | __u16 rtt_in_progress:1, /* This chunk used for RTT calc? */ |
632 | resent:1, /* Has this chunk ever been resent. */ | ||
632 | has_tsn:1, /* Does this chunk have a TSN yet? */ | 633 | has_tsn:1, /* Does this chunk have a TSN yet? */ |
633 | has_ssn:1, /* Does this chunk have a SSN yet? */ | 634 | has_ssn:1, /* Does this chunk have a SSN yet? */ |
634 | singleton:1, /* Only chunk in the packet? */ | 635 | singleton:1, /* Only chunk in the packet? */ |
@@ -1725,12 +1726,6 @@ struct sctp_association { | |||
1725 | /* How many duplicated TSNs have we seen? */ | 1726 | /* How many duplicated TSNs have we seen? */ |
1726 | int numduptsns; | 1727 | int numduptsns; |
1727 | 1728 | ||
1728 | /* Number of seconds of idle time before an association is closed. | ||
1729 | * In the association context, this is really used as a boolean | ||
1730 | * since the real timeout is stored in the timeouts array | ||
1731 | */ | ||
1732 | __u32 autoclose; | ||
1733 | |||
1734 | /* These are to support | 1729 | /* These are to support |
1735 | * "SCTP Extensions for Dynamic Reconfiguration of IP Addresses | 1730 | * "SCTP Extensions for Dynamic Reconfiguration of IP Addresses |
1736 | * and Enforcement of Flow and Message Limits" | 1731 | * and Enforcement of Flow and Message Limits" |
diff --git a/include/net/sock.h b/include/net/sock.h index e3a18ff0c38b..2ef3c3eca47a 100644 --- a/include/net/sock.h +++ b/include/net/sock.h | |||
@@ -1035,7 +1035,6 @@ enum cg_proto_flags { | |||
1035 | }; | 1035 | }; |
1036 | 1036 | ||
1037 | struct cg_proto { | 1037 | struct cg_proto { |
1038 | void (*enter_memory_pressure)(struct sock *sk); | ||
1039 | struct res_counter memory_allocated; /* Current allocated memory. */ | 1038 | struct res_counter memory_allocated; /* Current allocated memory. */ |
1040 | struct percpu_counter sockets_allocated; /* Current number of sockets. */ | 1039 | struct percpu_counter sockets_allocated; /* Current number of sockets. */ |
1041 | int memory_pressure; | 1040 | int memory_pressure; |
@@ -1155,8 +1154,7 @@ static inline void sk_leave_memory_pressure(struct sock *sk) | |||
1155 | struct proto *prot = sk->sk_prot; | 1154 | struct proto *prot = sk->sk_prot; |
1156 | 1155 | ||
1157 | for (; cg_proto; cg_proto = parent_cg_proto(prot, cg_proto)) | 1156 | for (; cg_proto; cg_proto = parent_cg_proto(prot, cg_proto)) |
1158 | if (cg_proto->memory_pressure) | 1157 | cg_proto->memory_pressure = 0; |
1159 | cg_proto->memory_pressure = 0; | ||
1160 | } | 1158 | } |
1161 | 1159 | ||
1162 | } | 1160 | } |
@@ -1171,7 +1169,7 @@ static inline void sk_enter_memory_pressure(struct sock *sk) | |||
1171 | struct proto *prot = sk->sk_prot; | 1169 | struct proto *prot = sk->sk_prot; |
1172 | 1170 | ||
1173 | for (; cg_proto; cg_proto = parent_cg_proto(prot, cg_proto)) | 1171 | for (; cg_proto; cg_proto = parent_cg_proto(prot, cg_proto)) |
1174 | cg_proto->enter_memory_pressure(sk); | 1172 | cg_proto->memory_pressure = 1; |
1175 | } | 1173 | } |
1176 | 1174 | ||
1177 | sk->sk_prot->enter_memory_pressure(sk); | 1175 | sk->sk_prot->enter_memory_pressure(sk); |
diff --git a/include/scsi/scsi_host.h b/include/scsi/scsi_host.h index 546084964d55..fe3b58e836c8 100644 --- a/include/scsi/scsi_host.h +++ b/include/scsi/scsi_host.h | |||
@@ -475,6 +475,9 @@ struct scsi_host_template { | |||
475 | */ | 475 | */ |
476 | unsigned ordered_tag:1; | 476 | unsigned ordered_tag:1; |
477 | 477 | ||
478 | /* True if the controller does not support WRITE SAME */ | ||
479 | unsigned no_write_same:1; | ||
480 | |||
478 | /* | 481 | /* |
479 | * Countdown for host blocking with no commands outstanding. | 482 | * Countdown for host blocking with no commands outstanding. |
480 | */ | 483 | */ |
@@ -677,6 +680,9 @@ struct Scsi_Host { | |||
677 | /* Don't resume host in EH */ | 680 | /* Don't resume host in EH */ |
678 | unsigned eh_noresume:1; | 681 | unsigned eh_noresume:1; |
679 | 682 | ||
683 | /* The controller does not support WRITE SAME */ | ||
684 | unsigned no_write_same:1; | ||
685 | |||
680 | /* | 686 | /* |
681 | * Optional work queue to be utilized by the transport | 687 | * Optional work queue to be utilized by the transport |
682 | */ | 688 | */ |
diff --git a/include/sound/memalloc.h b/include/sound/memalloc.h index af9983970417..5f73785f5977 100644 --- a/include/sound/memalloc.h +++ b/include/sound/memalloc.h | |||
@@ -108,7 +108,7 @@ static inline dma_addr_t snd_sgbuf_get_addr(struct snd_dma_buffer *dmab, | |||
108 | { | 108 | { |
109 | struct snd_sg_buf *sgbuf = dmab->private_data; | 109 | struct snd_sg_buf *sgbuf = dmab->private_data; |
110 | dma_addr_t addr = sgbuf->table[offset >> PAGE_SHIFT].addr; | 110 | dma_addr_t addr = sgbuf->table[offset >> PAGE_SHIFT].addr; |
111 | addr &= PAGE_MASK; | 111 | addr &= ~((dma_addr_t)PAGE_SIZE - 1); |
112 | return addr + offset % PAGE_SIZE; | 112 | return addr + offset % PAGE_SIZE; |
113 | } | 113 | } |
114 | 114 | ||
diff --git a/include/sound/soc-dapm.h b/include/sound/soc-dapm.h index 2037c45adfe6..56ebdfca6273 100644 --- a/include/sound/soc-dapm.h +++ b/include/sound/soc-dapm.h | |||
@@ -104,7 +104,8 @@ struct device; | |||
104 | SND_SOC_DAPM_INIT_REG_VAL(wreg, wshift, winvert), \ | 104 | SND_SOC_DAPM_INIT_REG_VAL(wreg, wshift, winvert), \ |
105 | .kcontrol_news = wcontrols, .num_kcontrols = 1} | 105 | .kcontrol_news = wcontrols, .num_kcontrols = 1} |
106 | #define SND_SOC_DAPM_MUX(wname, wreg, wshift, winvert, wcontrols) \ | 106 | #define SND_SOC_DAPM_MUX(wname, wreg, wshift, winvert, wcontrols) \ |
107 | { .id = snd_soc_dapm_mux, .name = wname, .reg = wreg, \ | 107 | { .id = snd_soc_dapm_mux, .name = wname, \ |
108 | SND_SOC_DAPM_INIT_REG_VAL(wreg, wshift, winvert), \ | ||
108 | .kcontrol_news = wcontrols, .num_kcontrols = 1} | 109 | .kcontrol_news = wcontrols, .num_kcontrols = 1} |
109 | #define SND_SOC_DAPM_VIRT_MUX(wname, wreg, wshift, winvert, wcontrols) \ | 110 | #define SND_SOC_DAPM_VIRT_MUX(wname, wreg, wshift, winvert, wcontrols) \ |
110 | { .id = snd_soc_dapm_virt_mux, .name = wname, \ | 111 | { .id = snd_soc_dapm_virt_mux, .name = wname, \ |
diff --git a/include/trace/ftrace.h b/include/trace/ftrace.h index d17a35c6537e..5c38606613d8 100644 --- a/include/trace/ftrace.h +++ b/include/trace/ftrace.h | |||
@@ -90,6 +90,10 @@ | |||
90 | #define TRACE_EVENT_FLAGS(name, value) \ | 90 | #define TRACE_EVENT_FLAGS(name, value) \ |
91 | __TRACE_EVENT_FLAGS(name, value) | 91 | __TRACE_EVENT_FLAGS(name, value) |
92 | 92 | ||
93 | #undef TRACE_EVENT_PERF_PERM | ||
94 | #define TRACE_EVENT_PERF_PERM(name, expr...) \ | ||
95 | __TRACE_EVENT_PERF_PERM(name, expr) | ||
96 | |||
93 | #include TRACE_INCLUDE(TRACE_INCLUDE_FILE) | 97 | #include TRACE_INCLUDE(TRACE_INCLUDE_FILE) |
94 | 98 | ||
95 | 99 | ||
@@ -140,6 +144,9 @@ | |||
140 | #undef TRACE_EVENT_FLAGS | 144 | #undef TRACE_EVENT_FLAGS |
141 | #define TRACE_EVENT_FLAGS(event, flag) | 145 | #define TRACE_EVENT_FLAGS(event, flag) |
142 | 146 | ||
147 | #undef TRACE_EVENT_PERF_PERM | ||
148 | #define TRACE_EVENT_PERF_PERM(event, expr...) | ||
149 | |||
143 | #include TRACE_INCLUDE(TRACE_INCLUDE_FILE) | 150 | #include TRACE_INCLUDE(TRACE_INCLUDE_FILE) |
144 | 151 | ||
145 | /* | 152 | /* |
diff --git a/include/uapi/linux/eventpoll.h b/include/uapi/linux/eventpoll.h index 2c267bcbb85c..bc81fb2e1f0e 100644 --- a/include/uapi/linux/eventpoll.h +++ b/include/uapi/linux/eventpoll.h | |||
@@ -61,5 +61,16 @@ struct epoll_event { | |||
61 | __u64 data; | 61 | __u64 data; |
62 | } EPOLL_PACKED; | 62 | } EPOLL_PACKED; |
63 | 63 | ||
64 | 64 | #ifdef CONFIG_PM_SLEEP | |
65 | static inline void ep_take_care_of_epollwakeup(struct epoll_event *epev) | ||
66 | { | ||
67 | if ((epev->events & EPOLLWAKEUP) && !capable(CAP_BLOCK_SUSPEND)) | ||
68 | epev->events &= ~EPOLLWAKEUP; | ||
69 | } | ||
70 | #else | ||
71 | static inline void ep_take_care_of_epollwakeup(struct epoll_event *epev) | ||
72 | { | ||
73 | epev->events &= ~EPOLLWAKEUP; | ||
74 | } | ||
75 | #endif | ||
65 | #endif /* _UAPI_LINUX_EVENTPOLL_H */ | 76 | #endif /* _UAPI_LINUX_EVENTPOLL_H */ |
diff --git a/include/uapi/linux/genetlink.h b/include/uapi/linux/genetlink.h index 1af72d8228e0..c3363ba1ae05 100644 --- a/include/uapi/linux/genetlink.h +++ b/include/uapi/linux/genetlink.h | |||
@@ -28,6 +28,7 @@ struct genlmsghdr { | |||
28 | #define GENL_ID_GENERATE 0 | 28 | #define GENL_ID_GENERATE 0 |
29 | #define GENL_ID_CTRL NLMSG_MIN_TYPE | 29 | #define GENL_ID_CTRL NLMSG_MIN_TYPE |
30 | #define GENL_ID_VFS_DQUOT (NLMSG_MIN_TYPE + 1) | 30 | #define GENL_ID_VFS_DQUOT (NLMSG_MIN_TYPE + 1) |
31 | #define GENL_ID_PMCRAID (NLMSG_MIN_TYPE + 2) | ||
31 | 32 | ||
32 | /************************************************************************** | 33 | /************************************************************************** |
33 | * Controller | 34 | * Controller |
diff --git a/include/uapi/linux/if_link.h b/include/uapi/linux/if_link.h index b78566f59aba..6db460121f84 100644 --- a/include/uapi/linux/if_link.h +++ b/include/uapi/linux/if_link.h | |||
@@ -488,7 +488,9 @@ enum { | |||
488 | IFLA_HSR_UNSPEC, | 488 | IFLA_HSR_UNSPEC, |
489 | IFLA_HSR_SLAVE1, | 489 | IFLA_HSR_SLAVE1, |
490 | IFLA_HSR_SLAVE2, | 490 | IFLA_HSR_SLAVE2, |
491 | IFLA_HSR_MULTICAST_SPEC, | 491 | IFLA_HSR_MULTICAST_SPEC, /* Last byte of supervision addr */ |
492 | IFLA_HSR_SUPERVISION_ADDR, /* Supervision frame multicast addr */ | ||
493 | IFLA_HSR_SEQ_NR, | ||
492 | __IFLA_HSR_MAX, | 494 | __IFLA_HSR_MAX, |
493 | }; | 495 | }; |
494 | 496 | ||
diff --git a/include/uapi/linux/input.h b/include/uapi/linux/input.h index a3726275876d..ecc88592ecbe 100644 --- a/include/uapi/linux/input.h +++ b/include/uapi/linux/input.h | |||
@@ -719,6 +719,8 @@ struct input_keymap_entry { | |||
719 | #define BTN_DPAD_LEFT 0x222 | 719 | #define BTN_DPAD_LEFT 0x222 |
720 | #define BTN_DPAD_RIGHT 0x223 | 720 | #define BTN_DPAD_RIGHT 0x223 |
721 | 721 | ||
722 | #define KEY_ALS_TOGGLE 0x230 /* Ambient light sensor */ | ||
723 | |||
722 | #define BTN_TRIGGER_HAPPY 0x2c0 | 724 | #define BTN_TRIGGER_HAPPY 0x2c0 |
723 | #define BTN_TRIGGER_HAPPY1 0x2c0 | 725 | #define BTN_TRIGGER_HAPPY1 0x2c0 |
724 | #define BTN_TRIGGER_HAPPY2 0x2c1 | 726 | #define BTN_TRIGGER_HAPPY2 0x2c1 |
@@ -856,6 +858,7 @@ struct input_keymap_entry { | |||
856 | #define SW_FRONT_PROXIMITY 0x0b /* set = front proximity sensor active */ | 858 | #define SW_FRONT_PROXIMITY 0x0b /* set = front proximity sensor active */ |
857 | #define SW_ROTATE_LOCK 0x0c /* set = rotate locked/disabled */ | 859 | #define SW_ROTATE_LOCK 0x0c /* set = rotate locked/disabled */ |
858 | #define SW_LINEIN_INSERT 0x0d /* set = inserted */ | 860 | #define SW_LINEIN_INSERT 0x0d /* set = inserted */ |
861 | #define SW_MUTE_DEVICE 0x0e /* set = device disabled */ | ||
859 | #define SW_MAX 0x0f | 862 | #define SW_MAX 0x0f |
860 | #define SW_CNT (SW_MAX+1) | 863 | #define SW_CNT (SW_MAX+1) |
861 | 864 | ||
diff --git a/include/uapi/linux/mic_common.h b/include/uapi/linux/mic_common.h index 17e7d95e4f53..6eb40244e019 100644 --- a/include/uapi/linux/mic_common.h +++ b/include/uapi/linux/mic_common.h | |||
@@ -23,12 +23,7 @@ | |||
23 | 23 | ||
24 | #include <linux/virtio_ring.h> | 24 | #include <linux/virtio_ring.h> |
25 | 25 | ||
26 | #ifndef __KERNEL__ | 26 | #define __mic_align(a, x) (((a) + (x) - 1) & ~((x) - 1)) |
27 | #define ALIGN(a, x) (((a) + (x) - 1) & ~((x) - 1)) | ||
28 | #define __aligned(x) __attribute__ ((aligned(x))) | ||
29 | #endif | ||
30 | |||
31 | #define mic_aligned_size(x) ALIGN(sizeof(x), 8) | ||
32 | 27 | ||
33 | /** | 28 | /** |
34 | * struct mic_device_desc: Virtio device information shared between the | 29 | * struct mic_device_desc: Virtio device information shared between the |
@@ -48,8 +43,8 @@ struct mic_device_desc { | |||
48 | __u8 feature_len; | 43 | __u8 feature_len; |
49 | __u8 config_len; | 44 | __u8 config_len; |
50 | __u8 status; | 45 | __u8 status; |
51 | __u64 config[0]; | 46 | __le64 config[0]; |
52 | } __aligned(8); | 47 | } __attribute__ ((aligned(8))); |
53 | 48 | ||
54 | /** | 49 | /** |
55 | * struct mic_device_ctrl: Per virtio device information in the device page | 50 | * struct mic_device_ctrl: Per virtio device information in the device page |
@@ -66,7 +61,7 @@ struct mic_device_desc { | |||
66 | * @h2c_vdev_db: The doorbell number to be used by host. Set by guest. | 61 | * @h2c_vdev_db: The doorbell number to be used by host. Set by guest. |
67 | */ | 62 | */ |
68 | struct mic_device_ctrl { | 63 | struct mic_device_ctrl { |
69 | __u64 vdev; | 64 | __le64 vdev; |
70 | __u8 config_change; | 65 | __u8 config_change; |
71 | __u8 vdev_reset; | 66 | __u8 vdev_reset; |
72 | __u8 guest_ack; | 67 | __u8 guest_ack; |
@@ -74,7 +69,7 @@ struct mic_device_ctrl { | |||
74 | __u8 used_address_updated; | 69 | __u8 used_address_updated; |
75 | __s8 c2h_vdev_db; | 70 | __s8 c2h_vdev_db; |
76 | __s8 h2c_vdev_db; | 71 | __s8 h2c_vdev_db; |
77 | } __aligned(8); | 72 | } __attribute__ ((aligned(8))); |
78 | 73 | ||
79 | /** | 74 | /** |
80 | * struct mic_bootparam: Virtio device independent information in device page | 75 | * struct mic_bootparam: Virtio device independent information in device page |
@@ -87,13 +82,13 @@ struct mic_device_ctrl { | |||
87 | * @shutdown_card: Set to 1 by the host when a card shutdown is initiated | 82 | * @shutdown_card: Set to 1 by the host when a card shutdown is initiated |
88 | */ | 83 | */ |
89 | struct mic_bootparam { | 84 | struct mic_bootparam { |
90 | __u32 magic; | 85 | __le32 magic; |
91 | __s8 c2h_shutdown_db; | 86 | __s8 c2h_shutdown_db; |
92 | __s8 h2c_shutdown_db; | 87 | __s8 h2c_shutdown_db; |
93 | __s8 h2c_config_db; | 88 | __s8 h2c_config_db; |
94 | __u8 shutdown_status; | 89 | __u8 shutdown_status; |
95 | __u8 shutdown_card; | 90 | __u8 shutdown_card; |
96 | } __aligned(8); | 91 | } __attribute__ ((aligned(8))); |
97 | 92 | ||
98 | /** | 93 | /** |
99 | * struct mic_device_page: High level representation of the device page | 94 | * struct mic_device_page: High level representation of the device page |
@@ -116,10 +111,10 @@ struct mic_device_page { | |||
116 | * @num: The number of entries in the virtio_ring | 111 | * @num: The number of entries in the virtio_ring |
117 | */ | 112 | */ |
118 | struct mic_vqconfig { | 113 | struct mic_vqconfig { |
119 | __u64 address; | 114 | __le64 address; |
120 | __u64 used_address; | 115 | __le64 used_address; |
121 | __u16 num; | 116 | __le16 num; |
122 | } __aligned(8); | 117 | } __attribute__ ((aligned(8))); |
123 | 118 | ||
124 | /* | 119 | /* |
125 | * The alignment to use between consumer and producer parts of vring. | 120 | * The alignment to use between consumer and producer parts of vring. |
@@ -154,7 +149,7 @@ struct mic_vqconfig { | |||
154 | */ | 149 | */ |
155 | struct _mic_vring_info { | 150 | struct _mic_vring_info { |
156 | __u16 avail_idx; | 151 | __u16 avail_idx; |
157 | int magic; | 152 | __le32 magic; |
158 | }; | 153 | }; |
159 | 154 | ||
160 | /** | 155 | /** |
@@ -173,15 +168,13 @@ struct mic_vring { | |||
173 | int len; | 168 | int len; |
174 | }; | 169 | }; |
175 | 170 | ||
176 | #define mic_aligned_desc_size(d) ALIGN(mic_desc_size(d), 8) | 171 | #define mic_aligned_desc_size(d) __mic_align(mic_desc_size(d), 8) |
177 | 172 | ||
178 | #ifndef INTEL_MIC_CARD | 173 | #ifndef INTEL_MIC_CARD |
179 | static inline unsigned mic_desc_size(const struct mic_device_desc *desc) | 174 | static inline unsigned mic_desc_size(const struct mic_device_desc *desc) |
180 | { | 175 | { |
181 | return mic_aligned_size(*desc) | 176 | return sizeof(*desc) + desc->num_vq * sizeof(struct mic_vqconfig) |
182 | + desc->num_vq * mic_aligned_size(struct mic_vqconfig) | 177 | + desc->feature_len * 2 + desc->config_len; |
183 | + desc->feature_len * 2 | ||
184 | + desc->config_len; | ||
185 | } | 178 | } |
186 | 179 | ||
187 | static inline struct mic_vqconfig * | 180 | static inline struct mic_vqconfig * |
@@ -201,8 +194,7 @@ static inline __u8 *mic_vq_configspace(const struct mic_device_desc *desc) | |||
201 | } | 194 | } |
202 | static inline unsigned mic_total_desc_size(struct mic_device_desc *desc) | 195 | static inline unsigned mic_total_desc_size(struct mic_device_desc *desc) |
203 | { | 196 | { |
204 | return mic_aligned_desc_size(desc) + | 197 | return mic_aligned_desc_size(desc) + sizeof(struct mic_device_ctrl); |
205 | mic_aligned_size(struct mic_device_ctrl); | ||
206 | } | 198 | } |
207 | #endif | 199 | #endif |
208 | 200 | ||
diff --git a/include/uapi/linux/netlink_diag.h b/include/uapi/linux/netlink_diag.h index 4e31db4eea41..f2159d30d1f5 100644 --- a/include/uapi/linux/netlink_diag.h +++ b/include/uapi/linux/netlink_diag.h | |||
@@ -33,6 +33,7 @@ struct netlink_diag_ring { | |||
33 | }; | 33 | }; |
34 | 34 | ||
35 | enum { | 35 | enum { |
36 | /* NETLINK_DIAG_NONE, standard nl API requires this attribute! */ | ||
36 | NETLINK_DIAG_MEMINFO, | 37 | NETLINK_DIAG_MEMINFO, |
37 | NETLINK_DIAG_GROUPS, | 38 | NETLINK_DIAG_GROUPS, |
38 | NETLINK_DIAG_RX_RING, | 39 | NETLINK_DIAG_RX_RING, |
diff --git a/include/uapi/linux/packet_diag.h b/include/uapi/linux/packet_diag.h index b2cc0cd9c4d9..d08c63f3dd6f 100644 --- a/include/uapi/linux/packet_diag.h +++ b/include/uapi/linux/packet_diag.h | |||
@@ -29,6 +29,7 @@ struct packet_diag_msg { | |||
29 | }; | 29 | }; |
30 | 30 | ||
31 | enum { | 31 | enum { |
32 | /* PACKET_DIAG_NONE, standard nl API requires this attribute! */ | ||
32 | PACKET_DIAG_INFO, | 33 | PACKET_DIAG_INFO, |
33 | PACKET_DIAG_MCLIST, | 34 | PACKET_DIAG_MCLIST, |
34 | PACKET_DIAG_RX_RING, | 35 | PACKET_DIAG_RX_RING, |
diff --git a/include/uapi/linux/unix_diag.h b/include/uapi/linux/unix_diag.h index b9e2a6a7446f..1eb0b8dd1830 100644 --- a/include/uapi/linux/unix_diag.h +++ b/include/uapi/linux/unix_diag.h | |||
@@ -31,6 +31,7 @@ struct unix_diag_msg { | |||
31 | }; | 31 | }; |
32 | 32 | ||
33 | enum { | 33 | enum { |
34 | /* UNIX_DIAG_NONE, standard nl API requires this attribute! */ | ||
34 | UNIX_DIAG_NAME, | 35 | UNIX_DIAG_NAME, |
35 | UNIX_DIAG_VFS, | 36 | UNIX_DIAG_VFS, |
36 | UNIX_DIAG_PEER, | 37 | UNIX_DIAG_PEER, |
diff --git a/include/uapi/sound/compress_offload.h b/include/uapi/sound/compress_offload.h index d630163b9a2e..5759810e1c1b 100644 --- a/include/uapi/sound/compress_offload.h +++ b/include/uapi/sound/compress_offload.h | |||
@@ -30,7 +30,7 @@ | |||
30 | #include <sound/compress_params.h> | 30 | #include <sound/compress_params.h> |
31 | 31 | ||
32 | 32 | ||
33 | #define SNDRV_COMPRESS_VERSION SNDRV_PROTOCOL_VERSION(0, 1, 1) | 33 | #define SNDRV_COMPRESS_VERSION SNDRV_PROTOCOL_VERSION(0, 1, 2) |
34 | /** | 34 | /** |
35 | * struct snd_compressed_buffer: compressed buffer | 35 | * struct snd_compressed_buffer: compressed buffer |
36 | * @fragment_size: size of buffer fragment in bytes | 36 | * @fragment_size: size of buffer fragment in bytes |
@@ -67,8 +67,8 @@ struct snd_compr_params { | |||
67 | struct snd_compr_tstamp { | 67 | struct snd_compr_tstamp { |
68 | __u32 byte_offset; | 68 | __u32 byte_offset; |
69 | __u32 copied_total; | 69 | __u32 copied_total; |
70 | snd_pcm_uframes_t pcm_frames; | 70 | __u32 pcm_frames; |
71 | snd_pcm_uframes_t pcm_io_frames; | 71 | __u32 pcm_io_frames; |
72 | __u32 sampling_rate; | 72 | __u32 sampling_rate; |
73 | }; | 73 | }; |
74 | 74 | ||
diff --git a/kernel/.gitignore b/kernel/.gitignore index b3097bde4e9c..790d83c7d160 100644 --- a/kernel/.gitignore +++ b/kernel/.gitignore | |||
@@ -5,3 +5,4 @@ config_data.h | |||
5 | config_data.gz | 5 | config_data.gz |
6 | timeconst.h | 6 | timeconst.h |
7 | hz.bc | 7 | hz.bc |
8 | x509_certificate_list | ||
diff --git a/kernel/events/core.c b/kernel/events/core.c index d724e7757cd1..72348dc192c1 100644 --- a/kernel/events/core.c +++ b/kernel/events/core.c | |||
@@ -5680,11 +5680,6 @@ static void swevent_hlist_put(struct perf_event *event) | |||
5680 | { | 5680 | { |
5681 | int cpu; | 5681 | int cpu; |
5682 | 5682 | ||
5683 | if (event->cpu != -1) { | ||
5684 | swevent_hlist_put_cpu(event, event->cpu); | ||
5685 | return; | ||
5686 | } | ||
5687 | |||
5688 | for_each_possible_cpu(cpu) | 5683 | for_each_possible_cpu(cpu) |
5689 | swevent_hlist_put_cpu(event, cpu); | 5684 | swevent_hlist_put_cpu(event, cpu); |
5690 | } | 5685 | } |
@@ -5718,9 +5713,6 @@ static int swevent_hlist_get(struct perf_event *event) | |||
5718 | int err; | 5713 | int err; |
5719 | int cpu, failed_cpu; | 5714 | int cpu, failed_cpu; |
5720 | 5715 | ||
5721 | if (event->cpu != -1) | ||
5722 | return swevent_hlist_get_cpu(event, event->cpu); | ||
5723 | |||
5724 | get_online_cpus(); | 5716 | get_online_cpus(); |
5725 | for_each_possible_cpu(cpu) { | 5717 | for_each_possible_cpu(cpu) { |
5726 | err = swevent_hlist_get_cpu(event, cpu); | 5718 | err = swevent_hlist_get_cpu(event, cpu); |
diff --git a/kernel/futex.c b/kernel/futex.c index 80ba086f021d..f6ff0191ecf7 100644 --- a/kernel/futex.c +++ b/kernel/futex.c | |||
@@ -251,6 +251,9 @@ get_futex_key(u32 __user *uaddr, int fshared, union futex_key *key, int rw) | |||
251 | return -EINVAL; | 251 | return -EINVAL; |
252 | address -= key->both.offset; | 252 | address -= key->both.offset; |
253 | 253 | ||
254 | if (unlikely(!access_ok(rw, uaddr, sizeof(u32)))) | ||
255 | return -EFAULT; | ||
256 | |||
254 | /* | 257 | /* |
255 | * PROCESS_PRIVATE futexes are fast. | 258 | * PROCESS_PRIVATE futexes are fast. |
256 | * As the mm cannot disappear under us and the 'key' only needs | 259 | * As the mm cannot disappear under us and the 'key' only needs |
@@ -259,8 +262,6 @@ get_futex_key(u32 __user *uaddr, int fshared, union futex_key *key, int rw) | |||
259 | * but access_ok() should be faster than find_vma() | 262 | * but access_ok() should be faster than find_vma() |
260 | */ | 263 | */ |
261 | if (!fshared) { | 264 | if (!fshared) { |
262 | if (unlikely(!access_ok(VERIFY_WRITE, uaddr, sizeof(u32)))) | ||
263 | return -EFAULT; | ||
264 | key->private.mm = mm; | 265 | key->private.mm = mm; |
265 | key->private.address = address; | 266 | key->private.address = address; |
266 | get_futex_key_refs(key); | 267 | get_futex_key_refs(key); |
@@ -288,7 +289,7 @@ again: | |||
288 | put_page(page); | 289 | put_page(page); |
289 | /* serialize against __split_huge_page_splitting() */ | 290 | /* serialize against __split_huge_page_splitting() */ |
290 | local_irq_disable(); | 291 | local_irq_disable(); |
291 | if (likely(__get_user_pages_fast(address, 1, 1, &page) == 1)) { | 292 | if (likely(__get_user_pages_fast(address, 1, !ro, &page) == 1)) { |
292 | page_head = compound_head(page); | 293 | page_head = compound_head(page); |
293 | /* | 294 | /* |
294 | * page_head is valid pointer but we must pin | 295 | * page_head is valid pointer but we must pin |
diff --git a/kernel/irq/pm.c b/kernel/irq/pm.c index cb228bf21760..abcd6ca86cb7 100644 --- a/kernel/irq/pm.c +++ b/kernel/irq/pm.c | |||
@@ -50,7 +50,7 @@ static void resume_irqs(bool want_early) | |||
50 | bool is_early = desc->action && | 50 | bool is_early = desc->action && |
51 | desc->action->flags & IRQF_EARLY_RESUME; | 51 | desc->action->flags & IRQF_EARLY_RESUME; |
52 | 52 | ||
53 | if (is_early != want_early) | 53 | if (!is_early && want_early) |
54 | continue; | 54 | continue; |
55 | 55 | ||
56 | raw_spin_lock_irqsave(&desc->lock, flags); | 56 | raw_spin_lock_irqsave(&desc->lock, flags); |
diff --git a/kernel/kexec.c b/kernel/kexec.c index 490afc03627e..d0d8fca54065 100644 --- a/kernel/kexec.c +++ b/kernel/kexec.c | |||
@@ -47,6 +47,9 @@ u32 vmcoreinfo_note[VMCOREINFO_NOTE_SIZE/4]; | |||
47 | size_t vmcoreinfo_size; | 47 | size_t vmcoreinfo_size; |
48 | size_t vmcoreinfo_max_size = sizeof(vmcoreinfo_data); | 48 | size_t vmcoreinfo_max_size = sizeof(vmcoreinfo_data); |
49 | 49 | ||
50 | /* Flag to indicate we are going to kexec a new kernel */ | ||
51 | bool kexec_in_progress = false; | ||
52 | |||
50 | /* Location of the reserved area for the crash kernel */ | 53 | /* Location of the reserved area for the crash kernel */ |
51 | struct resource crashk_res = { | 54 | struct resource crashk_res = { |
52 | .name = "Crash kernel", | 55 | .name = "Crash kernel", |
@@ -1675,6 +1678,7 @@ int kernel_kexec(void) | |||
1675 | } else | 1678 | } else |
1676 | #endif | 1679 | #endif |
1677 | { | 1680 | { |
1681 | kexec_in_progress = true; | ||
1678 | kernel_restart_prepare(NULL); | 1682 | kernel_restart_prepare(NULL); |
1679 | printk(KERN_EMERG "Starting new kernel\n"); | 1683 | printk(KERN_EMERG "Starting new kernel\n"); |
1680 | machine_shutdown(); | 1684 | machine_shutdown(); |
diff --git a/kernel/rcu/tree_plugin.h b/kernel/rcu/tree_plugin.h index 6abb03dff5c0..08a765232432 100644 --- a/kernel/rcu/tree_plugin.h +++ b/kernel/rcu/tree_plugin.h | |||
@@ -1632,7 +1632,7 @@ module_param(rcu_idle_gp_delay, int, 0644); | |||
1632 | static int rcu_idle_lazy_gp_delay = RCU_IDLE_LAZY_GP_DELAY; | 1632 | static int rcu_idle_lazy_gp_delay = RCU_IDLE_LAZY_GP_DELAY; |
1633 | module_param(rcu_idle_lazy_gp_delay, int, 0644); | 1633 | module_param(rcu_idle_lazy_gp_delay, int, 0644); |
1634 | 1634 | ||
1635 | extern int tick_nohz_enabled; | 1635 | extern int tick_nohz_active; |
1636 | 1636 | ||
1637 | /* | 1637 | /* |
1638 | * Try to advance callbacks for all flavors of RCU on the current CPU, but | 1638 | * Try to advance callbacks for all flavors of RCU on the current CPU, but |
@@ -1729,7 +1729,7 @@ static void rcu_prepare_for_idle(int cpu) | |||
1729 | int tne; | 1729 | int tne; |
1730 | 1730 | ||
1731 | /* Handle nohz enablement switches conservatively. */ | 1731 | /* Handle nohz enablement switches conservatively. */ |
1732 | tne = ACCESS_ONCE(tick_nohz_enabled); | 1732 | tne = ACCESS_ONCE(tick_nohz_active); |
1733 | if (tne != rdtp->tick_nohz_enabled_snap) { | 1733 | if (tne != rdtp->tick_nohz_enabled_snap) { |
1734 | if (rcu_cpu_has_callbacks(cpu, NULL)) | 1734 | if (rcu_cpu_has_callbacks(cpu, NULL)) |
1735 | invoke_rcu_core(); /* force nohz to see update. */ | 1735 | invoke_rcu_core(); /* force nohz to see update. */ |
diff --git a/kernel/sched/core.c b/kernel/sched/core.c index c1808606ee5f..e85cda20ab2b 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c | |||
@@ -2660,6 +2660,7 @@ asmlinkage void __sched notrace preempt_schedule(void) | |||
2660 | } while (need_resched()); | 2660 | } while (need_resched()); |
2661 | } | 2661 | } |
2662 | EXPORT_SYMBOL(preempt_schedule); | 2662 | EXPORT_SYMBOL(preempt_schedule); |
2663 | #endif /* CONFIG_PREEMPT */ | ||
2663 | 2664 | ||
2664 | /* | 2665 | /* |
2665 | * this is the entry point to schedule() from kernel preemption | 2666 | * this is the entry point to schedule() from kernel preemption |
@@ -2693,8 +2694,6 @@ asmlinkage void __sched preempt_schedule_irq(void) | |||
2693 | exception_exit(prev_state); | 2694 | exception_exit(prev_state); |
2694 | } | 2695 | } |
2695 | 2696 | ||
2696 | #endif /* CONFIG_PREEMPT */ | ||
2697 | |||
2698 | int default_wake_function(wait_queue_t *curr, unsigned mode, int wake_flags, | 2697 | int default_wake_function(wait_queue_t *curr, unsigned mode, int wake_flags, |
2699 | void *key) | 2698 | void *key) |
2700 | { | 2699 | { |
@@ -4762,7 +4761,7 @@ static void rq_attach_root(struct rq *rq, struct root_domain *rd) | |||
4762 | cpumask_clear_cpu(rq->cpu, old_rd->span); | 4761 | cpumask_clear_cpu(rq->cpu, old_rd->span); |
4763 | 4762 | ||
4764 | /* | 4763 | /* |
4765 | * If we dont want to free the old_rt yet then | 4764 | * If we dont want to free the old_rd yet then |
4766 | * set old_rd to NULL to skip the freeing later | 4765 | * set old_rd to NULL to skip the freeing later |
4767 | * in this function: | 4766 | * in this function: |
4768 | */ | 4767 | */ |
@@ -4910,8 +4909,9 @@ static void update_top_cache_domain(int cpu) | |||
4910 | if (sd) { | 4909 | if (sd) { |
4911 | id = cpumask_first(sched_domain_span(sd)); | 4910 | id = cpumask_first(sched_domain_span(sd)); |
4912 | size = cpumask_weight(sched_domain_span(sd)); | 4911 | size = cpumask_weight(sched_domain_span(sd)); |
4913 | rcu_assign_pointer(per_cpu(sd_busy, cpu), sd->parent); | 4912 | sd = sd->parent; /* sd_busy */ |
4914 | } | 4913 | } |
4914 | rcu_assign_pointer(per_cpu(sd_busy, cpu), sd); | ||
4915 | 4915 | ||
4916 | rcu_assign_pointer(per_cpu(sd_llc, cpu), sd); | 4916 | rcu_assign_pointer(per_cpu(sd_llc, cpu), sd); |
4917 | per_cpu(sd_llc_size, cpu) = size; | 4917 | per_cpu(sd_llc_size, cpu) = size; |
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index e8b652ebe027..fd773ade1a31 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c | |||
@@ -5379,10 +5379,31 @@ void update_group_power(struct sched_domain *sd, int cpu) | |||
5379 | */ | 5379 | */ |
5380 | 5380 | ||
5381 | for_each_cpu(cpu, sched_group_cpus(sdg)) { | 5381 | for_each_cpu(cpu, sched_group_cpus(sdg)) { |
5382 | struct sched_group *sg = cpu_rq(cpu)->sd->groups; | 5382 | struct sched_group_power *sgp; |
5383 | struct rq *rq = cpu_rq(cpu); | ||
5383 | 5384 | ||
5384 | power_orig += sg->sgp->power_orig; | 5385 | /* |
5385 | power += sg->sgp->power; | 5386 | * build_sched_domains() -> init_sched_groups_power() |
5387 | * gets here before we've attached the domains to the | ||
5388 | * runqueues. | ||
5389 | * | ||
5390 | * Use power_of(), which is set irrespective of domains | ||
5391 | * in update_cpu_power(). | ||
5392 | * | ||
5393 | * This avoids power/power_orig from being 0 and | ||
5394 | * causing divide-by-zero issues on boot. | ||
5395 | * | ||
5396 | * Runtime updates will correct power_orig. | ||
5397 | */ | ||
5398 | if (unlikely(!rq->sd)) { | ||
5399 | power_orig += power_of(cpu); | ||
5400 | power += power_of(cpu); | ||
5401 | continue; | ||
5402 | } | ||
5403 | |||
5404 | sgp = rq->sd->groups->sgp; | ||
5405 | power_orig += sgp->power_orig; | ||
5406 | power += sgp->power; | ||
5386 | } | 5407 | } |
5387 | } else { | 5408 | } else { |
5388 | /* | 5409 | /* |
diff --git a/kernel/system_certificates.S b/kernel/system_certificates.S index 4aef390671cb..3e9868d47535 100644 --- a/kernel/system_certificates.S +++ b/kernel/system_certificates.S | |||
@@ -3,8 +3,18 @@ | |||
3 | 3 | ||
4 | __INITRODATA | 4 | __INITRODATA |
5 | 5 | ||
6 | .align 8 | ||
6 | .globl VMLINUX_SYMBOL(system_certificate_list) | 7 | .globl VMLINUX_SYMBOL(system_certificate_list) |
7 | VMLINUX_SYMBOL(system_certificate_list): | 8 | VMLINUX_SYMBOL(system_certificate_list): |
9 | __cert_list_start: | ||
8 | .incbin "kernel/x509_certificate_list" | 10 | .incbin "kernel/x509_certificate_list" |
9 | .globl VMLINUX_SYMBOL(system_certificate_list_end) | 11 | __cert_list_end: |
10 | VMLINUX_SYMBOL(system_certificate_list_end): | 12 | |
13 | .align 8 | ||
14 | .globl VMLINUX_SYMBOL(system_certificate_list_size) | ||
15 | VMLINUX_SYMBOL(system_certificate_list_size): | ||
16 | #ifdef CONFIG_64BIT | ||
17 | .quad __cert_list_end - __cert_list_start | ||
18 | #else | ||
19 | .long __cert_list_end - __cert_list_start | ||
20 | #endif | ||
diff --git a/kernel/system_keyring.c b/kernel/system_keyring.c index 564dd93430a2..52ebc70263f4 100644 --- a/kernel/system_keyring.c +++ b/kernel/system_keyring.c | |||
@@ -22,7 +22,7 @@ struct key *system_trusted_keyring; | |||
22 | EXPORT_SYMBOL_GPL(system_trusted_keyring); | 22 | EXPORT_SYMBOL_GPL(system_trusted_keyring); |
23 | 23 | ||
24 | extern __initconst const u8 system_certificate_list[]; | 24 | extern __initconst const u8 system_certificate_list[]; |
25 | extern __initconst const u8 system_certificate_list_end[]; | 25 | extern __initconst const unsigned long system_certificate_list_size; |
26 | 26 | ||
27 | /* | 27 | /* |
28 | * Load the compiled-in keys | 28 | * Load the compiled-in keys |
@@ -60,8 +60,8 @@ static __init int load_system_certificate_list(void) | |||
60 | 60 | ||
61 | pr_notice("Loading compiled-in X.509 certificates\n"); | 61 | pr_notice("Loading compiled-in X.509 certificates\n"); |
62 | 62 | ||
63 | end = system_certificate_list_end; | ||
64 | p = system_certificate_list; | 63 | p = system_certificate_list; |
64 | end = p + system_certificate_list_size; | ||
65 | while (p < end) { | 65 | while (p < end) { |
66 | /* Each cert begins with an ASN.1 SEQUENCE tag and must be more | 66 | /* Each cert begins with an ASN.1 SEQUENCE tag and must be more |
67 | * than 256 bytes in size. | 67 | * than 256 bytes in size. |
diff --git a/kernel/time/tick-common.c b/kernel/time/tick-common.c index 64522ecdfe0e..162b03ab0ad2 100644 --- a/kernel/time/tick-common.c +++ b/kernel/time/tick-common.c | |||
@@ -33,6 +33,21 @@ DEFINE_PER_CPU(struct tick_device, tick_cpu_device); | |||
33 | */ | 33 | */ |
34 | ktime_t tick_next_period; | 34 | ktime_t tick_next_period; |
35 | ktime_t tick_period; | 35 | ktime_t tick_period; |
36 | |||
37 | /* | ||
38 | * tick_do_timer_cpu is a timer core internal variable which holds the CPU NR | ||
39 | * which is responsible for calling do_timer(), i.e. the timekeeping stuff. This | ||
40 | * variable has two functions: | ||
41 | * | ||
42 | * 1) Prevent a thundering herd issue of a gazillion of CPUs trying to grab the | ||
43 | * timekeeping lock all at once. Only the CPU which is assigned to do the | ||
44 | * update is handling it. | ||
45 | * | ||
46 | * 2) Hand off the duty in the NOHZ idle case by setting the value to | ||
47 | * TICK_DO_TIMER_NONE, i.e. a non existing CPU. So the next cpu which looks | ||
48 | * at it will take over and keep the time keeping alive. The handover | ||
49 | * procedure also covers cpu hotplug. | ||
50 | */ | ||
36 | int tick_do_timer_cpu __read_mostly = TICK_DO_TIMER_BOOT; | 51 | int tick_do_timer_cpu __read_mostly = TICK_DO_TIMER_BOOT; |
37 | 52 | ||
38 | /* | 53 | /* |
diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c index 3612fc77f834..ea20f7d1ac2c 100644 --- a/kernel/time/tick-sched.c +++ b/kernel/time/tick-sched.c | |||
@@ -361,8 +361,8 @@ void __init tick_nohz_init(void) | |||
361 | /* | 361 | /* |
362 | * NO HZ enabled ? | 362 | * NO HZ enabled ? |
363 | */ | 363 | */ |
364 | int tick_nohz_enabled __read_mostly = 1; | 364 | static int tick_nohz_enabled __read_mostly = 1; |
365 | 365 | int tick_nohz_active __read_mostly; | |
366 | /* | 366 | /* |
367 | * Enable / Disable tickless mode | 367 | * Enable / Disable tickless mode |
368 | */ | 368 | */ |
@@ -465,7 +465,7 @@ u64 get_cpu_idle_time_us(int cpu, u64 *last_update_time) | |||
465 | struct tick_sched *ts = &per_cpu(tick_cpu_sched, cpu); | 465 | struct tick_sched *ts = &per_cpu(tick_cpu_sched, cpu); |
466 | ktime_t now, idle; | 466 | ktime_t now, idle; |
467 | 467 | ||
468 | if (!tick_nohz_enabled) | 468 | if (!tick_nohz_active) |
469 | return -1; | 469 | return -1; |
470 | 470 | ||
471 | now = ktime_get(); | 471 | now = ktime_get(); |
@@ -506,7 +506,7 @@ u64 get_cpu_iowait_time_us(int cpu, u64 *last_update_time) | |||
506 | struct tick_sched *ts = &per_cpu(tick_cpu_sched, cpu); | 506 | struct tick_sched *ts = &per_cpu(tick_cpu_sched, cpu); |
507 | ktime_t now, iowait; | 507 | ktime_t now, iowait; |
508 | 508 | ||
509 | if (!tick_nohz_enabled) | 509 | if (!tick_nohz_active) |
510 | return -1; | 510 | return -1; |
511 | 511 | ||
512 | now = ktime_get(); | 512 | now = ktime_get(); |
@@ -711,8 +711,10 @@ static bool can_stop_idle_tick(int cpu, struct tick_sched *ts) | |||
711 | return false; | 711 | return false; |
712 | } | 712 | } |
713 | 713 | ||
714 | if (unlikely(ts->nohz_mode == NOHZ_MODE_INACTIVE)) | 714 | if (unlikely(ts->nohz_mode == NOHZ_MODE_INACTIVE)) { |
715 | ts->sleep_length = (ktime_t) { .tv64 = NSEC_PER_SEC/HZ }; | ||
715 | return false; | 716 | return false; |
717 | } | ||
716 | 718 | ||
717 | if (need_resched()) | 719 | if (need_resched()) |
718 | return false; | 720 | return false; |
@@ -799,11 +801,6 @@ void tick_nohz_idle_enter(void) | |||
799 | local_irq_disable(); | 801 | local_irq_disable(); |
800 | 802 | ||
801 | ts = &__get_cpu_var(tick_cpu_sched); | 803 | ts = &__get_cpu_var(tick_cpu_sched); |
802 | /* | ||
803 | * set ts->inidle unconditionally. even if the system did not | ||
804 | * switch to nohz mode the cpu frequency governers rely on the | ||
805 | * update of the idle time accounting in tick_nohz_start_idle(). | ||
806 | */ | ||
807 | ts->inidle = 1; | 804 | ts->inidle = 1; |
808 | __tick_nohz_idle_enter(ts); | 805 | __tick_nohz_idle_enter(ts); |
809 | 806 | ||
@@ -973,7 +970,7 @@ static void tick_nohz_switch_to_nohz(void) | |||
973 | struct tick_sched *ts = &__get_cpu_var(tick_cpu_sched); | 970 | struct tick_sched *ts = &__get_cpu_var(tick_cpu_sched); |
974 | ktime_t next; | 971 | ktime_t next; |
975 | 972 | ||
976 | if (!tick_nohz_enabled) | 973 | if (!tick_nohz_active) |
977 | return; | 974 | return; |
978 | 975 | ||
979 | local_irq_disable(); | 976 | local_irq_disable(); |
@@ -981,7 +978,7 @@ static void tick_nohz_switch_to_nohz(void) | |||
981 | local_irq_enable(); | 978 | local_irq_enable(); |
982 | return; | 979 | return; |
983 | } | 980 | } |
984 | 981 | tick_nohz_active = 1; | |
985 | ts->nohz_mode = NOHZ_MODE_LOWRES; | 982 | ts->nohz_mode = NOHZ_MODE_LOWRES; |
986 | 983 | ||
987 | /* | 984 | /* |
@@ -1139,8 +1136,10 @@ void tick_setup_sched_timer(void) | |||
1139 | } | 1136 | } |
1140 | 1137 | ||
1141 | #ifdef CONFIG_NO_HZ_COMMON | 1138 | #ifdef CONFIG_NO_HZ_COMMON |
1142 | if (tick_nohz_enabled) | 1139 | if (tick_nohz_enabled) { |
1143 | ts->nohz_mode = NOHZ_MODE_HIGHRES; | 1140 | ts->nohz_mode = NOHZ_MODE_HIGHRES; |
1141 | tick_nohz_active = 1; | ||
1142 | } | ||
1144 | #endif | 1143 | #endif |
1145 | } | 1144 | } |
1146 | #endif /* HIGH_RES_TIMERS */ | 1145 | #endif /* HIGH_RES_TIMERS */ |
diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c index 3abf53418b67..87b4f00284c9 100644 --- a/kernel/time/timekeeping.c +++ b/kernel/time/timekeeping.c | |||
@@ -1347,7 +1347,7 @@ static inline void old_vsyscall_fixup(struct timekeeper *tk) | |||
1347 | tk->xtime_nsec -= remainder; | 1347 | tk->xtime_nsec -= remainder; |
1348 | tk->xtime_nsec += 1ULL << tk->shift; | 1348 | tk->xtime_nsec += 1ULL << tk->shift; |
1349 | tk->ntp_error += remainder << tk->ntp_error_shift; | 1349 | tk->ntp_error += remainder << tk->ntp_error_shift; |
1350 | 1350 | tk->ntp_error -= (1ULL << tk->shift) << tk->ntp_error_shift; | |
1351 | } | 1351 | } |
1352 | #else | 1352 | #else |
1353 | #define old_vsyscall_fixup(tk) | 1353 | #define old_vsyscall_fixup(tk) |
diff --git a/kernel/timer.c b/kernel/timer.c index 6582b82fa966..accfd241b9e5 100644 --- a/kernel/timer.c +++ b/kernel/timer.c | |||
@@ -1518,9 +1518,8 @@ static int init_timers_cpu(int cpu) | |||
1518 | /* | 1518 | /* |
1519 | * The APs use this path later in boot | 1519 | * The APs use this path later in boot |
1520 | */ | 1520 | */ |
1521 | base = kmalloc_node(sizeof(*base), | 1521 | base = kzalloc_node(sizeof(*base), GFP_KERNEL, |
1522 | GFP_KERNEL | __GFP_ZERO, | 1522 | cpu_to_node(cpu)); |
1523 | cpu_to_node(cpu)); | ||
1524 | if (!base) | 1523 | if (!base) |
1525 | return -ENOMEM; | 1524 | return -ENOMEM; |
1526 | 1525 | ||
diff --git a/kernel/trace/trace_event_perf.c b/kernel/trace/trace_event_perf.c index 78e27e3b52ac..e854f420e033 100644 --- a/kernel/trace/trace_event_perf.c +++ b/kernel/trace/trace_event_perf.c | |||
@@ -24,6 +24,12 @@ static int total_ref_count; | |||
24 | static int perf_trace_event_perm(struct ftrace_event_call *tp_event, | 24 | static int perf_trace_event_perm(struct ftrace_event_call *tp_event, |
25 | struct perf_event *p_event) | 25 | struct perf_event *p_event) |
26 | { | 26 | { |
27 | if (tp_event->perf_perm) { | ||
28 | int ret = tp_event->perf_perm(tp_event, p_event); | ||
29 | if (ret) | ||
30 | return ret; | ||
31 | } | ||
32 | |||
27 | /* The ftrace function trace is allowed only for root. */ | 33 | /* The ftrace function trace is allowed only for root. */ |
28 | if (ftrace_event_is_function(tp_event) && | 34 | if (ftrace_event_is_function(tp_event) && |
29 | perf_paranoid_tracepoint_raw() && !capable(CAP_SYS_ADMIN)) | 35 | perf_paranoid_tracepoint_raw() && !capable(CAP_SYS_ADMIN)) |
@@ -173,7 +179,7 @@ static int perf_trace_event_init(struct ftrace_event_call *tp_event, | |||
173 | int perf_trace_init(struct perf_event *p_event) | 179 | int perf_trace_init(struct perf_event *p_event) |
174 | { | 180 | { |
175 | struct ftrace_event_call *tp_event; | 181 | struct ftrace_event_call *tp_event; |
176 | int event_id = p_event->attr.config; | 182 | u64 event_id = p_event->attr.config; |
177 | int ret = -EINVAL; | 183 | int ret = -EINVAL; |
178 | 184 | ||
179 | mutex_lock(&event_mutex); | 185 | mutex_lock(&event_mutex); |
diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c index f919a2e21bf3..a11800ae96de 100644 --- a/kernel/trace/trace_events.c +++ b/kernel/trace/trace_events.c | |||
@@ -2314,6 +2314,9 @@ int event_trace_del_tracer(struct trace_array *tr) | |||
2314 | /* Disable any running events */ | 2314 | /* Disable any running events */ |
2315 | __ftrace_set_clr_event_nolock(tr, NULL, NULL, NULL, 0); | 2315 | __ftrace_set_clr_event_nolock(tr, NULL, NULL, NULL, 0); |
2316 | 2316 | ||
2317 | /* Access to events are within rcu_read_lock_sched() */ | ||
2318 | synchronize_sched(); | ||
2319 | |||
2317 | down_write(&trace_event_sem); | 2320 | down_write(&trace_event_sem); |
2318 | __trace_remove_event_dirs(tr); | 2321 | __trace_remove_event_dirs(tr); |
2319 | debugfs_remove_recursive(tr->event_dir); | 2322 | debugfs_remove_recursive(tr->event_dir); |
diff --git a/kernel/trace/trace_syscalls.c b/kernel/trace/trace_syscalls.c index e4b6d11bdf78..ea90eb5f6f17 100644 --- a/kernel/trace/trace_syscalls.c +++ b/kernel/trace/trace_syscalls.c | |||
@@ -431,11 +431,6 @@ static void unreg_event_syscall_enter(struct ftrace_event_file *file, | |||
431 | if (!tr->sys_refcount_enter) | 431 | if (!tr->sys_refcount_enter) |
432 | unregister_trace_sys_enter(ftrace_syscall_enter, tr); | 432 | unregister_trace_sys_enter(ftrace_syscall_enter, tr); |
433 | mutex_unlock(&syscall_trace_lock); | 433 | mutex_unlock(&syscall_trace_lock); |
434 | /* | ||
435 | * Callers expect the event to be completely disabled on | ||
436 | * return, so wait for current handlers to finish. | ||
437 | */ | ||
438 | synchronize_sched(); | ||
439 | } | 434 | } |
440 | 435 | ||
441 | static int reg_event_syscall_exit(struct ftrace_event_file *file, | 436 | static int reg_event_syscall_exit(struct ftrace_event_file *file, |
@@ -474,11 +469,6 @@ static void unreg_event_syscall_exit(struct ftrace_event_file *file, | |||
474 | if (!tr->sys_refcount_exit) | 469 | if (!tr->sys_refcount_exit) |
475 | unregister_trace_sys_exit(ftrace_syscall_exit, tr); | 470 | unregister_trace_sys_exit(ftrace_syscall_exit, tr); |
476 | mutex_unlock(&syscall_trace_lock); | 471 | mutex_unlock(&syscall_trace_lock); |
477 | /* | ||
478 | * Callers expect the event to be completely disabled on | ||
479 | * return, so wait for current handlers to finish. | ||
480 | */ | ||
481 | synchronize_sched(); | ||
482 | } | 472 | } |
483 | 473 | ||
484 | static int __init init_syscall_trace(struct ftrace_event_call *call) | 474 | static int __init init_syscall_trace(struct ftrace_event_call *call) |
diff --git a/kernel/workqueue.c b/kernel/workqueue.c index c66912be990f..b010eac595d2 100644 --- a/kernel/workqueue.c +++ b/kernel/workqueue.c | |||
@@ -2851,19 +2851,6 @@ already_gone: | |||
2851 | return false; | 2851 | return false; |
2852 | } | 2852 | } |
2853 | 2853 | ||
2854 | static bool __flush_work(struct work_struct *work) | ||
2855 | { | ||
2856 | struct wq_barrier barr; | ||
2857 | |||
2858 | if (start_flush_work(work, &barr)) { | ||
2859 | wait_for_completion(&barr.done); | ||
2860 | destroy_work_on_stack(&barr.work); | ||
2861 | return true; | ||
2862 | } else { | ||
2863 | return false; | ||
2864 | } | ||
2865 | } | ||
2866 | |||
2867 | /** | 2854 | /** |
2868 | * flush_work - wait for a work to finish executing the last queueing instance | 2855 | * flush_work - wait for a work to finish executing the last queueing instance |
2869 | * @work: the work to flush | 2856 | * @work: the work to flush |
@@ -2877,10 +2864,18 @@ static bool __flush_work(struct work_struct *work) | |||
2877 | */ | 2864 | */ |
2878 | bool flush_work(struct work_struct *work) | 2865 | bool flush_work(struct work_struct *work) |
2879 | { | 2866 | { |
2867 | struct wq_barrier barr; | ||
2868 | |||
2880 | lock_map_acquire(&work->lockdep_map); | 2869 | lock_map_acquire(&work->lockdep_map); |
2881 | lock_map_release(&work->lockdep_map); | 2870 | lock_map_release(&work->lockdep_map); |
2882 | 2871 | ||
2883 | return __flush_work(work); | 2872 | if (start_flush_work(work, &barr)) { |
2873 | wait_for_completion(&barr.done); | ||
2874 | destroy_work_on_stack(&barr.work); | ||
2875 | return true; | ||
2876 | } else { | ||
2877 | return false; | ||
2878 | } | ||
2884 | } | 2879 | } |
2885 | EXPORT_SYMBOL_GPL(flush_work); | 2880 | EXPORT_SYMBOL_GPL(flush_work); |
2886 | 2881 | ||
@@ -4832,14 +4827,7 @@ long work_on_cpu(int cpu, long (*fn)(void *), void *arg) | |||
4832 | 4827 | ||
4833 | INIT_WORK_ONSTACK(&wfc.work, work_for_cpu_fn); | 4828 | INIT_WORK_ONSTACK(&wfc.work, work_for_cpu_fn); |
4834 | schedule_work_on(cpu, &wfc.work); | 4829 | schedule_work_on(cpu, &wfc.work); |
4835 | 4830 | flush_work(&wfc.work); | |
4836 | /* | ||
4837 | * The work item is on-stack and can't lead to deadlock through | ||
4838 | * flushing. Use __flush_work() to avoid spurious lockdep warnings | ||
4839 | * when work_on_cpu()s are nested. | ||
4840 | */ | ||
4841 | __flush_work(&wfc.work); | ||
4842 | |||
4843 | return wfc.ret; | 4831 | return wfc.ret; |
4844 | } | 4832 | } |
4845 | EXPORT_SYMBOL_GPL(work_on_cpu); | 4833 | EXPORT_SYMBOL_GPL(work_on_cpu); |
diff --git a/lib/assoc_array.c b/lib/assoc_array.c index 17edeaf19180..1b6a44f1ec3e 100644 --- a/lib/assoc_array.c +++ b/lib/assoc_array.c | |||
@@ -759,8 +759,8 @@ all_leaves_cluster_together: | |||
759 | pr_devel("all leaves cluster together\n"); | 759 | pr_devel("all leaves cluster together\n"); |
760 | diff = INT_MAX; | 760 | diff = INT_MAX; |
761 | for (i = 0; i < ASSOC_ARRAY_FAN_OUT; i++) { | 761 | for (i = 0; i < ASSOC_ARRAY_FAN_OUT; i++) { |
762 | int x = ops->diff_objects(assoc_array_ptr_to_leaf(edit->leaf), | 762 | int x = ops->diff_objects(assoc_array_ptr_to_leaf(node->slots[i]), |
763 | assoc_array_ptr_to_leaf(node->slots[i])); | 763 | index_key); |
764 | if (x < diff) { | 764 | if (x < diff) { |
765 | BUG_ON(x < 0); | 765 | BUG_ON(x < 0); |
766 | diff = x; | 766 | diff = x; |
diff --git a/mm/huge_memory.c b/mm/huge_memory.c index bccd5a628ea6..33a5dc492810 100644 --- a/mm/huge_memory.c +++ b/mm/huge_memory.c | |||
@@ -1481,8 +1481,18 @@ int move_huge_pmd(struct vm_area_struct *vma, struct vm_area_struct *new_vma, | |||
1481 | pmd = pmdp_get_and_clear(mm, old_addr, old_pmd); | 1481 | pmd = pmdp_get_and_clear(mm, old_addr, old_pmd); |
1482 | VM_BUG_ON(!pmd_none(*new_pmd)); | 1482 | VM_BUG_ON(!pmd_none(*new_pmd)); |
1483 | set_pmd_at(mm, new_addr, new_pmd, pmd_mksoft_dirty(pmd)); | 1483 | set_pmd_at(mm, new_addr, new_pmd, pmd_mksoft_dirty(pmd)); |
1484 | if (new_ptl != old_ptl) | 1484 | if (new_ptl != old_ptl) { |
1485 | pgtable_t pgtable; | ||
1486 | |||
1487 | /* | ||
1488 | * Move preallocated PTE page table if new_pmd is on | ||
1489 | * different PMD page table. | ||
1490 | */ | ||
1491 | pgtable = pgtable_trans_huge_withdraw(mm, old_pmd); | ||
1492 | pgtable_trans_huge_deposit(mm, new_pmd, pgtable); | ||
1493 | |||
1485 | spin_unlock(new_ptl); | 1494 | spin_unlock(new_ptl); |
1495 | } | ||
1486 | spin_unlock(old_ptl); | 1496 | spin_unlock(old_ptl); |
1487 | } | 1497 | } |
1488 | out: | 1498 | out: |
diff --git a/mm/memcontrol.c b/mm/memcontrol.c index f1a0ae6e11b8..bf5e89457149 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c | |||
@@ -2694,7 +2694,10 @@ static int __mem_cgroup_try_charge(struct mm_struct *mm, | |||
2694 | goto bypass; | 2694 | goto bypass; |
2695 | 2695 | ||
2696 | if (unlikely(task_in_memcg_oom(current))) | 2696 | if (unlikely(task_in_memcg_oom(current))) |
2697 | goto bypass; | 2697 | goto nomem; |
2698 | |||
2699 | if (gfp_mask & __GFP_NOFAIL) | ||
2700 | oom = false; | ||
2698 | 2701 | ||
2699 | /* | 2702 | /* |
2700 | * We always charge the cgroup the mm_struct belongs to. | 2703 | * We always charge the cgroup the mm_struct belongs to. |
@@ -6352,6 +6355,42 @@ static void mem_cgroup_css_offline(struct cgroup_subsys_state *css) | |||
6352 | static void mem_cgroup_css_free(struct cgroup_subsys_state *css) | 6355 | static void mem_cgroup_css_free(struct cgroup_subsys_state *css) |
6353 | { | 6356 | { |
6354 | struct mem_cgroup *memcg = mem_cgroup_from_css(css); | 6357 | struct mem_cgroup *memcg = mem_cgroup_from_css(css); |
6358 | /* | ||
6359 | * XXX: css_offline() would be where we should reparent all | ||
6360 | * memory to prepare the cgroup for destruction. However, | ||
6361 | * memcg does not do css_tryget() and res_counter charging | ||
6362 | * under the same RCU lock region, which means that charging | ||
6363 | * could race with offlining. Offlining only happens to | ||
6364 | * cgroups with no tasks in them but charges can show up | ||
6365 | * without any tasks from the swapin path when the target | ||
6366 | * memcg is looked up from the swapout record and not from the | ||
6367 | * current task as it usually is. A race like this can leak | ||
6368 | * charges and put pages with stale cgroup pointers into | ||
6369 | * circulation: | ||
6370 | * | ||
6371 | * #0 #1 | ||
6372 | * lookup_swap_cgroup_id() | ||
6373 | * rcu_read_lock() | ||
6374 | * mem_cgroup_lookup() | ||
6375 | * css_tryget() | ||
6376 | * rcu_read_unlock() | ||
6377 | * disable css_tryget() | ||
6378 | * call_rcu() | ||
6379 | * offline_css() | ||
6380 | * reparent_charges() | ||
6381 | * res_counter_charge() | ||
6382 | * css_put() | ||
6383 | * css_free() | ||
6384 | * pc->mem_cgroup = dead memcg | ||
6385 | * add page to lru | ||
6386 | * | ||
6387 | * The bulk of the charges are still moved in offline_css() to | ||
6388 | * avoid pinning a lot of pages in case a long-term reference | ||
6389 | * like a swapout record is deferring the css_free() to long | ||
6390 | * after offlining. But this makes sure we catch any charges | ||
6391 | * made after offlining: | ||
6392 | */ | ||
6393 | mem_cgroup_reparent_charges(memcg); | ||
6355 | 6394 | ||
6356 | memcg_destroy_kmem(memcg); | 6395 | memcg_destroy_kmem(memcg); |
6357 | __mem_cgroup_free(memcg); | 6396 | __mem_cgroup_free(memcg); |
diff --git a/mm/shmem.c b/mm/shmem.c index 8297623fcaed..902a14842b74 100644 --- a/mm/shmem.c +++ b/mm/shmem.c | |||
@@ -2918,13 +2918,8 @@ static struct dentry_operations anon_ops = { | |||
2918 | .d_dname = simple_dname | 2918 | .d_dname = simple_dname |
2919 | }; | 2919 | }; |
2920 | 2920 | ||
2921 | /** | 2921 | static struct file *__shmem_file_setup(const char *name, loff_t size, |
2922 | * shmem_file_setup - get an unlinked file living in tmpfs | 2922 | unsigned long flags, unsigned int i_flags) |
2923 | * @name: name for dentry (to be seen in /proc/<pid>/maps | ||
2924 | * @size: size to be set for the file | ||
2925 | * @flags: VM_NORESERVE suppresses pre-accounting of the entire object size | ||
2926 | */ | ||
2927 | struct file *shmem_file_setup(const char *name, loff_t size, unsigned long flags) | ||
2928 | { | 2923 | { |
2929 | struct file *res; | 2924 | struct file *res; |
2930 | struct inode *inode; | 2925 | struct inode *inode; |
@@ -2957,6 +2952,7 @@ struct file *shmem_file_setup(const char *name, loff_t size, unsigned long flags | |||
2957 | if (!inode) | 2952 | if (!inode) |
2958 | goto put_dentry; | 2953 | goto put_dentry; |
2959 | 2954 | ||
2955 | inode->i_flags |= i_flags; | ||
2960 | d_instantiate(path.dentry, inode); | 2956 | d_instantiate(path.dentry, inode); |
2961 | inode->i_size = size; | 2957 | inode->i_size = size; |
2962 | clear_nlink(inode); /* It is unlinked */ | 2958 | clear_nlink(inode); /* It is unlinked */ |
@@ -2977,6 +2973,32 @@ put_memory: | |||
2977 | shmem_unacct_size(flags, size); | 2973 | shmem_unacct_size(flags, size); |
2978 | return res; | 2974 | return res; |
2979 | } | 2975 | } |
2976 | |||
2977 | /** | ||
2978 | * shmem_kernel_file_setup - get an unlinked file living in tmpfs which must be | ||
2979 | * kernel internal. There will be NO LSM permission checks against the | ||
2980 | * underlying inode. So users of this interface must do LSM checks at a | ||
2981 | * higher layer. The one user is the big_key implementation. LSM checks | ||
2982 | * are provided at the key level rather than the inode level. | ||
2983 | * @name: name for dentry (to be seen in /proc/<pid>/maps | ||
2984 | * @size: size to be set for the file | ||
2985 | * @flags: VM_NORESERVE suppresses pre-accounting of the entire object size | ||
2986 | */ | ||
2987 | struct file *shmem_kernel_file_setup(const char *name, loff_t size, unsigned long flags) | ||
2988 | { | ||
2989 | return __shmem_file_setup(name, size, flags, S_PRIVATE); | ||
2990 | } | ||
2991 | |||
2992 | /** | ||
2993 | * shmem_file_setup - get an unlinked file living in tmpfs | ||
2994 | * @name: name for dentry (to be seen in /proc/<pid>/maps | ||
2995 | * @size: size to be set for the file | ||
2996 | * @flags: VM_NORESERVE suppresses pre-accounting of the entire object size | ||
2997 | */ | ||
2998 | struct file *shmem_file_setup(const char *name, loff_t size, unsigned long flags) | ||
2999 | { | ||
3000 | return __shmem_file_setup(name, size, flags, 0); | ||
3001 | } | ||
2980 | EXPORT_SYMBOL_GPL(shmem_file_setup); | 3002 | EXPORT_SYMBOL_GPL(shmem_file_setup); |
2981 | 3003 | ||
2982 | /** | 3004 | /** |
diff --git a/net/bridge/br_private.h b/net/bridge/br_private.h index 229d820bdf0b..045d56eaeca2 100644 --- a/net/bridge/br_private.h +++ b/net/bridge/br_private.h | |||
@@ -426,6 +426,16 @@ netdev_features_t br_features_recompute(struct net_bridge *br, | |||
426 | int br_handle_frame_finish(struct sk_buff *skb); | 426 | int br_handle_frame_finish(struct sk_buff *skb); |
427 | rx_handler_result_t br_handle_frame(struct sk_buff **pskb); | 427 | rx_handler_result_t br_handle_frame(struct sk_buff **pskb); |
428 | 428 | ||
429 | static inline bool br_rx_handler_check_rcu(const struct net_device *dev) | ||
430 | { | ||
431 | return rcu_dereference(dev->rx_handler) == br_handle_frame; | ||
432 | } | ||
433 | |||
434 | static inline struct net_bridge_port *br_port_get_check_rcu(const struct net_device *dev) | ||
435 | { | ||
436 | return br_rx_handler_check_rcu(dev) ? br_port_get_rcu(dev) : NULL; | ||
437 | } | ||
438 | |||
429 | /* br_ioctl.c */ | 439 | /* br_ioctl.c */ |
430 | int br_dev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd); | 440 | int br_dev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd); |
431 | int br_ioctl_deviceless_stub(struct net *net, unsigned int cmd, | 441 | int br_ioctl_deviceless_stub(struct net *net, unsigned int cmd, |
diff --git a/net/bridge/br_stp_bpdu.c b/net/bridge/br_stp_bpdu.c index 8660ea3be705..bdb459d21ad8 100644 --- a/net/bridge/br_stp_bpdu.c +++ b/net/bridge/br_stp_bpdu.c | |||
@@ -153,7 +153,7 @@ void br_stp_rcv(const struct stp_proto *proto, struct sk_buff *skb, | |||
153 | if (buf[0] != 0 || buf[1] != 0 || buf[2] != 0) | 153 | if (buf[0] != 0 || buf[1] != 0 || buf[2] != 0) |
154 | goto err; | 154 | goto err; |
155 | 155 | ||
156 | p = br_port_get_rcu(dev); | 156 | p = br_port_get_check_rcu(dev); |
157 | if (!p) | 157 | if (!p) |
158 | goto err; | 158 | goto err; |
159 | 159 | ||
diff --git a/net/compat.c b/net/compat.c index 618c6a8a911b..dd32e34c1e2c 100644 --- a/net/compat.c +++ b/net/compat.c | |||
@@ -72,7 +72,7 @@ int get_compat_msghdr(struct msghdr *kmsg, struct compat_msghdr __user *umsg) | |||
72 | __get_user(kmsg->msg_flags, &umsg->msg_flags)) | 72 | __get_user(kmsg->msg_flags, &umsg->msg_flags)) |
73 | return -EFAULT; | 73 | return -EFAULT; |
74 | if (kmsg->msg_namelen > sizeof(struct sockaddr_storage)) | 74 | if (kmsg->msg_namelen > sizeof(struct sockaddr_storage)) |
75 | return -EINVAL; | 75 | kmsg->msg_namelen = sizeof(struct sockaddr_storage); |
76 | kmsg->msg_name = compat_ptr(tmp1); | 76 | kmsg->msg_name = compat_ptr(tmp1); |
77 | kmsg->msg_iov = compat_ptr(tmp2); | 77 | kmsg->msg_iov = compat_ptr(tmp2); |
78 | kmsg->msg_control = compat_ptr(tmp3); | 78 | kmsg->msg_control = compat_ptr(tmp3); |
diff --git a/net/core/drop_monitor.c b/net/core/drop_monitor.c index 95897183226e..e70301eb7a4a 100644 --- a/net/core/drop_monitor.c +++ b/net/core/drop_monitor.c | |||
@@ -64,7 +64,6 @@ static struct genl_family net_drop_monitor_family = { | |||
64 | .hdrsize = 0, | 64 | .hdrsize = 0, |
65 | .name = "NET_DM", | 65 | .name = "NET_DM", |
66 | .version = 2, | 66 | .version = 2, |
67 | .maxattr = NET_DM_CMD_MAX, | ||
68 | }; | 67 | }; |
69 | 68 | ||
70 | static DEFINE_PER_CPU(struct per_cpu_dm_data, dm_cpu_data); | 69 | static DEFINE_PER_CPU(struct per_cpu_dm_data, dm_cpu_data); |
diff --git a/net/core/pktgen.c b/net/core/pktgen.c index 261357a66300..a797fff7f222 100644 --- a/net/core/pktgen.c +++ b/net/core/pktgen.c | |||
@@ -2527,6 +2527,8 @@ static int process_ipsec(struct pktgen_dev *pkt_dev, | |||
2527 | if (x) { | 2527 | if (x) { |
2528 | int ret; | 2528 | int ret; |
2529 | __u8 *eth; | 2529 | __u8 *eth; |
2530 | struct iphdr *iph; | ||
2531 | |||
2530 | nhead = x->props.header_len - skb_headroom(skb); | 2532 | nhead = x->props.header_len - skb_headroom(skb); |
2531 | if (nhead > 0) { | 2533 | if (nhead > 0) { |
2532 | ret = pskb_expand_head(skb, nhead, 0, GFP_ATOMIC); | 2534 | ret = pskb_expand_head(skb, nhead, 0, GFP_ATOMIC); |
@@ -2548,6 +2550,11 @@ static int process_ipsec(struct pktgen_dev *pkt_dev, | |||
2548 | eth = (__u8 *) skb_push(skb, ETH_HLEN); | 2550 | eth = (__u8 *) skb_push(skb, ETH_HLEN); |
2549 | memcpy(eth, pkt_dev->hh, 12); | 2551 | memcpy(eth, pkt_dev->hh, 12); |
2550 | *(u16 *) ð[12] = protocol; | 2552 | *(u16 *) ð[12] = protocol; |
2553 | |||
2554 | /* Update IPv4 header len as well as checksum value */ | ||
2555 | iph = ip_hdr(skb); | ||
2556 | iph->tot_len = htons(skb->len - ETH_HLEN); | ||
2557 | ip_send_check(iph); | ||
2551 | } | 2558 | } |
2552 | } | 2559 | } |
2553 | return 1; | 2560 | return 1; |
diff --git a/net/core/skbuff.c b/net/core/skbuff.c index 2718fed53d8c..06e72d3cdf60 100644 --- a/net/core/skbuff.c +++ b/net/core/skbuff.c | |||
@@ -3584,6 +3584,7 @@ void skb_scrub_packet(struct sk_buff *skb, bool xnet) | |||
3584 | skb->tstamp.tv64 = 0; | 3584 | skb->tstamp.tv64 = 0; |
3585 | skb->pkt_type = PACKET_HOST; | 3585 | skb->pkt_type = PACKET_HOST; |
3586 | skb->skb_iif = 0; | 3586 | skb->skb_iif = 0; |
3587 | skb->local_df = 0; | ||
3587 | skb_dst_drop(skb); | 3588 | skb_dst_drop(skb); |
3588 | skb->mark = 0; | 3589 | skb->mark = 0; |
3589 | secpath_reset(skb); | 3590 | secpath_reset(skb); |
diff --git a/net/core/sock.c b/net/core/sock.c index ab20ed9b0f31..5393b4b719d7 100644 --- a/net/core/sock.c +++ b/net/core/sock.c | |||
@@ -882,7 +882,7 @@ set_rcvbuf: | |||
882 | 882 | ||
883 | case SO_PEEK_OFF: | 883 | case SO_PEEK_OFF: |
884 | if (sock->ops->set_peek_off) | 884 | if (sock->ops->set_peek_off) |
885 | sock->ops->set_peek_off(sk, val); | 885 | ret = sock->ops->set_peek_off(sk, val); |
886 | else | 886 | else |
887 | ret = -EOPNOTSUPP; | 887 | ret = -EOPNOTSUPP; |
888 | break; | 888 | break; |
diff --git a/net/dccp/ipv6.c b/net/dccp/ipv6.c index 4ac71ff7c2e4..2b90a786e475 100644 --- a/net/dccp/ipv6.c +++ b/net/dccp/ipv6.c | |||
@@ -851,7 +851,6 @@ static int dccp_v6_connect(struct sock *sk, struct sockaddr *uaddr, | |||
851 | flowlabel = fl6_sock_lookup(sk, fl6.flowlabel); | 851 | flowlabel = fl6_sock_lookup(sk, fl6.flowlabel); |
852 | if (flowlabel == NULL) | 852 | if (flowlabel == NULL) |
853 | return -EINVAL; | 853 | return -EINVAL; |
854 | usin->sin6_addr = flowlabel->dst; | ||
855 | fl6_sock_release(flowlabel); | 854 | fl6_sock_release(flowlabel); |
856 | } | 855 | } |
857 | } | 856 | } |
diff --git a/net/hsr/hsr_framereg.c b/net/hsr/hsr_framereg.c index 003f5bb3acd2..4bdab1521878 100644 --- a/net/hsr/hsr_framereg.c +++ b/net/hsr/hsr_framereg.c | |||
@@ -288,7 +288,8 @@ void hsr_addr_subst_dest(struct hsr_priv *hsr_priv, struct ethhdr *ethhdr, | |||
288 | static bool seq_nr_after(u16 a, u16 b) | 288 | static bool seq_nr_after(u16 a, u16 b) |
289 | { | 289 | { |
290 | /* Remove inconsistency where | 290 | /* Remove inconsistency where |
291 | * seq_nr_after(a, b) == seq_nr_before(a, b) */ | 291 | * seq_nr_after(a, b) == seq_nr_before(a, b) |
292 | */ | ||
292 | if ((int) b - a == 32768) | 293 | if ((int) b - a == 32768) |
293 | return false; | 294 | return false; |
294 | 295 | ||
diff --git a/net/hsr/hsr_netlink.c b/net/hsr/hsr_netlink.c index 5325af85eea6..01a5261ac7a5 100644 --- a/net/hsr/hsr_netlink.c +++ b/net/hsr/hsr_netlink.c | |||
@@ -23,6 +23,8 @@ static const struct nla_policy hsr_policy[IFLA_HSR_MAX + 1] = { | |||
23 | [IFLA_HSR_SLAVE1] = { .type = NLA_U32 }, | 23 | [IFLA_HSR_SLAVE1] = { .type = NLA_U32 }, |
24 | [IFLA_HSR_SLAVE2] = { .type = NLA_U32 }, | 24 | [IFLA_HSR_SLAVE2] = { .type = NLA_U32 }, |
25 | [IFLA_HSR_MULTICAST_SPEC] = { .type = NLA_U8 }, | 25 | [IFLA_HSR_MULTICAST_SPEC] = { .type = NLA_U8 }, |
26 | [IFLA_HSR_SUPERVISION_ADDR] = { .type = NLA_BINARY, .len = ETH_ALEN }, | ||
27 | [IFLA_HSR_SEQ_NR] = { .type = NLA_U16 }, | ||
26 | }; | 28 | }; |
27 | 29 | ||
28 | 30 | ||
@@ -59,6 +61,31 @@ static int hsr_newlink(struct net *src_net, struct net_device *dev, | |||
59 | return hsr_dev_finalize(dev, link, multicast_spec); | 61 | return hsr_dev_finalize(dev, link, multicast_spec); |
60 | } | 62 | } |
61 | 63 | ||
64 | static int hsr_fill_info(struct sk_buff *skb, const struct net_device *dev) | ||
65 | { | ||
66 | struct hsr_priv *hsr_priv; | ||
67 | |||
68 | hsr_priv = netdev_priv(dev); | ||
69 | |||
70 | if (hsr_priv->slave[0]) | ||
71 | if (nla_put_u32(skb, IFLA_HSR_SLAVE1, hsr_priv->slave[0]->ifindex)) | ||
72 | goto nla_put_failure; | ||
73 | |||
74 | if (hsr_priv->slave[1]) | ||
75 | if (nla_put_u32(skb, IFLA_HSR_SLAVE2, hsr_priv->slave[1]->ifindex)) | ||
76 | goto nla_put_failure; | ||
77 | |||
78 | if (nla_put(skb, IFLA_HSR_SUPERVISION_ADDR, ETH_ALEN, | ||
79 | hsr_priv->sup_multicast_addr) || | ||
80 | nla_put_u16(skb, IFLA_HSR_SEQ_NR, hsr_priv->sequence_nr)) | ||
81 | goto nla_put_failure; | ||
82 | |||
83 | return 0; | ||
84 | |||
85 | nla_put_failure: | ||
86 | return -EMSGSIZE; | ||
87 | } | ||
88 | |||
62 | static struct rtnl_link_ops hsr_link_ops __read_mostly = { | 89 | static struct rtnl_link_ops hsr_link_ops __read_mostly = { |
63 | .kind = "hsr", | 90 | .kind = "hsr", |
64 | .maxtype = IFLA_HSR_MAX, | 91 | .maxtype = IFLA_HSR_MAX, |
@@ -66,6 +93,7 @@ static struct rtnl_link_ops hsr_link_ops __read_mostly = { | |||
66 | .priv_size = sizeof(struct hsr_priv), | 93 | .priv_size = sizeof(struct hsr_priv), |
67 | .setup = hsr_dev_setup, | 94 | .setup = hsr_dev_setup, |
68 | .newlink = hsr_newlink, | 95 | .newlink = hsr_newlink, |
96 | .fill_info = hsr_fill_info, | ||
69 | }; | 97 | }; |
70 | 98 | ||
71 | 99 | ||
diff --git a/net/ipv4/fib_rules.c b/net/ipv4/fib_rules.c index 523be38e37de..f2e15738534d 100644 --- a/net/ipv4/fib_rules.c +++ b/net/ipv4/fib_rules.c | |||
@@ -104,7 +104,10 @@ errout: | |||
104 | static bool fib4_rule_suppress(struct fib_rule *rule, struct fib_lookup_arg *arg) | 104 | static bool fib4_rule_suppress(struct fib_rule *rule, struct fib_lookup_arg *arg) |
105 | { | 105 | { |
106 | struct fib_result *result = (struct fib_result *) arg->result; | 106 | struct fib_result *result = (struct fib_result *) arg->result; |
107 | struct net_device *dev = result->fi->fib_dev; | 107 | struct net_device *dev = NULL; |
108 | |||
109 | if (result->fi) | ||
110 | dev = result->fi->fib_dev; | ||
108 | 111 | ||
109 | /* do not accept result if the route does | 112 | /* do not accept result if the route does |
110 | * not meet the required prefix length | 113 | * not meet the required prefix length |
diff --git a/net/ipv4/ip_sockglue.c b/net/ipv4/ip_sockglue.c index 3f858266fa7e..ddf32a6bc415 100644 --- a/net/ipv4/ip_sockglue.c +++ b/net/ipv4/ip_sockglue.c | |||
@@ -386,7 +386,7 @@ void ip_local_error(struct sock *sk, int err, __be32 daddr, __be16 port, u32 inf | |||
386 | /* | 386 | /* |
387 | * Handle MSG_ERRQUEUE | 387 | * Handle MSG_ERRQUEUE |
388 | */ | 388 | */ |
389 | int ip_recv_error(struct sock *sk, struct msghdr *msg, int len) | 389 | int ip_recv_error(struct sock *sk, struct msghdr *msg, int len, int *addr_len) |
390 | { | 390 | { |
391 | struct sock_exterr_skb *serr; | 391 | struct sock_exterr_skb *serr; |
392 | struct sk_buff *skb, *skb2; | 392 | struct sk_buff *skb, *skb2; |
@@ -423,6 +423,7 @@ int ip_recv_error(struct sock *sk, struct msghdr *msg, int len) | |||
423 | serr->addr_offset); | 423 | serr->addr_offset); |
424 | sin->sin_port = serr->port; | 424 | sin->sin_port = serr->port; |
425 | memset(&sin->sin_zero, 0, sizeof(sin->sin_zero)); | 425 | memset(&sin->sin_zero, 0, sizeof(sin->sin_zero)); |
426 | *addr_len = sizeof(*sin); | ||
426 | } | 427 | } |
427 | 428 | ||
428 | memcpy(&errhdr.ee, &serr->ee, sizeof(struct sock_extended_err)); | 429 | memcpy(&errhdr.ee, &serr->ee, sizeof(struct sock_extended_err)); |
diff --git a/net/ipv4/ping.c b/net/ipv4/ping.c index 876c6ca2d8f9..242e7f4ed6f4 100644 --- a/net/ipv4/ping.c +++ b/net/ipv4/ping.c | |||
@@ -772,7 +772,7 @@ int ping_v4_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg, | |||
772 | err = PTR_ERR(rt); | 772 | err = PTR_ERR(rt); |
773 | rt = NULL; | 773 | rt = NULL; |
774 | if (err == -ENETUNREACH) | 774 | if (err == -ENETUNREACH) |
775 | IP_INC_STATS_BH(net, IPSTATS_MIB_OUTNOROUTES); | 775 | IP_INC_STATS(net, IPSTATS_MIB_OUTNOROUTES); |
776 | goto out; | 776 | goto out; |
777 | } | 777 | } |
778 | 778 | ||
@@ -841,10 +841,11 @@ int ping_recvmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg, | |||
841 | 841 | ||
842 | if (flags & MSG_ERRQUEUE) { | 842 | if (flags & MSG_ERRQUEUE) { |
843 | if (family == AF_INET) { | 843 | if (family == AF_INET) { |
844 | return ip_recv_error(sk, msg, len); | 844 | return ip_recv_error(sk, msg, len, addr_len); |
845 | #if IS_ENABLED(CONFIG_IPV6) | 845 | #if IS_ENABLED(CONFIG_IPV6) |
846 | } else if (family == AF_INET6) { | 846 | } else if (family == AF_INET6) { |
847 | return pingv6_ops.ipv6_recv_error(sk, msg, len); | 847 | return pingv6_ops.ipv6_recv_error(sk, msg, len, |
848 | addr_len); | ||
848 | #endif | 849 | #endif |
849 | } | 850 | } |
850 | } | 851 | } |
diff --git a/net/ipv4/protocol.c b/net/ipv4/protocol.c index ce848461acbb..46d6a1c923a8 100644 --- a/net/ipv4/protocol.c +++ b/net/ipv4/protocol.c | |||
@@ -31,10 +31,6 @@ | |||
31 | const struct net_protocol __rcu *inet_protos[MAX_INET_PROTOS] __read_mostly; | 31 | const struct net_protocol __rcu *inet_protos[MAX_INET_PROTOS] __read_mostly; |
32 | const struct net_offload __rcu *inet_offloads[MAX_INET_PROTOS] __read_mostly; | 32 | const struct net_offload __rcu *inet_offloads[MAX_INET_PROTOS] __read_mostly; |
33 | 33 | ||
34 | /* | ||
35 | * Add a protocol handler to the hash tables | ||
36 | */ | ||
37 | |||
38 | int inet_add_protocol(const struct net_protocol *prot, unsigned char protocol) | 34 | int inet_add_protocol(const struct net_protocol *prot, unsigned char protocol) |
39 | { | 35 | { |
40 | if (!prot->netns_ok) { | 36 | if (!prot->netns_ok) { |
@@ -55,10 +51,6 @@ int inet_add_offload(const struct net_offload *prot, unsigned char protocol) | |||
55 | } | 51 | } |
56 | EXPORT_SYMBOL(inet_add_offload); | 52 | EXPORT_SYMBOL(inet_add_offload); |
57 | 53 | ||
58 | /* | ||
59 | * Remove a protocol from the hash tables. | ||
60 | */ | ||
61 | |||
62 | int inet_del_protocol(const struct net_protocol *prot, unsigned char protocol) | 54 | int inet_del_protocol(const struct net_protocol *prot, unsigned char protocol) |
63 | { | 55 | { |
64 | int ret; | 56 | int ret; |
diff --git a/net/ipv4/raw.c b/net/ipv4/raw.c index 5cb8ddb505ee..23c3e5b5bb53 100644 --- a/net/ipv4/raw.c +++ b/net/ipv4/raw.c | |||
@@ -697,7 +697,7 @@ static int raw_recvmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg, | |||
697 | goto out; | 697 | goto out; |
698 | 698 | ||
699 | if (flags & MSG_ERRQUEUE) { | 699 | if (flags & MSG_ERRQUEUE) { |
700 | err = ip_recv_error(sk, msg, len); | 700 | err = ip_recv_error(sk, msg, len, addr_len); |
701 | goto out; | 701 | goto out; |
702 | } | 702 | } |
703 | 703 | ||
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c index 59a6f8b90cd9..067213924751 100644 --- a/net/ipv4/tcp_ipv4.c +++ b/net/ipv4/tcp_ipv4.c | |||
@@ -177,7 +177,7 @@ int tcp_v4_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len) | |||
177 | if (IS_ERR(rt)) { | 177 | if (IS_ERR(rt)) { |
178 | err = PTR_ERR(rt); | 178 | err = PTR_ERR(rt); |
179 | if (err == -ENETUNREACH) | 179 | if (err == -ENETUNREACH) |
180 | IP_INC_STATS_BH(sock_net(sk), IPSTATS_MIB_OUTNOROUTES); | 180 | IP_INC_STATS(sock_net(sk), IPSTATS_MIB_OUTNOROUTES); |
181 | return err; | 181 | return err; |
182 | } | 182 | } |
183 | 183 | ||
diff --git a/net/ipv4/tcp_memcontrol.c b/net/ipv4/tcp_memcontrol.c index 03e9154f7e68..f7e522c558ba 100644 --- a/net/ipv4/tcp_memcontrol.c +++ b/net/ipv4/tcp_memcontrol.c | |||
@@ -6,13 +6,6 @@ | |||
6 | #include <linux/memcontrol.h> | 6 | #include <linux/memcontrol.h> |
7 | #include <linux/module.h> | 7 | #include <linux/module.h> |
8 | 8 | ||
9 | static void memcg_tcp_enter_memory_pressure(struct sock *sk) | ||
10 | { | ||
11 | if (sk->sk_cgrp->memory_pressure) | ||
12 | sk->sk_cgrp->memory_pressure = 1; | ||
13 | } | ||
14 | EXPORT_SYMBOL(memcg_tcp_enter_memory_pressure); | ||
15 | |||
16 | int tcp_init_cgroup(struct mem_cgroup *memcg, struct cgroup_subsys *ss) | 9 | int tcp_init_cgroup(struct mem_cgroup *memcg, struct cgroup_subsys *ss) |
17 | { | 10 | { |
18 | /* | 11 | /* |
@@ -60,7 +53,6 @@ EXPORT_SYMBOL(tcp_destroy_cgroup); | |||
60 | static int tcp_update_limit(struct mem_cgroup *memcg, u64 val) | 53 | static int tcp_update_limit(struct mem_cgroup *memcg, u64 val) |
61 | { | 54 | { |
62 | struct cg_proto *cg_proto; | 55 | struct cg_proto *cg_proto; |
63 | u64 old_lim; | ||
64 | int i; | 56 | int i; |
65 | int ret; | 57 | int ret; |
66 | 58 | ||
@@ -71,7 +63,6 @@ static int tcp_update_limit(struct mem_cgroup *memcg, u64 val) | |||
71 | if (val > RES_COUNTER_MAX) | 63 | if (val > RES_COUNTER_MAX) |
72 | val = RES_COUNTER_MAX; | 64 | val = RES_COUNTER_MAX; |
73 | 65 | ||
74 | old_lim = res_counter_read_u64(&cg_proto->memory_allocated, RES_LIMIT); | ||
75 | ret = res_counter_set_limit(&cg_proto->memory_allocated, val); | 66 | ret = res_counter_set_limit(&cg_proto->memory_allocated, val); |
76 | if (ret) | 67 | if (ret) |
77 | return ret; | 68 | return ret; |
diff --git a/net/ipv4/tcp_offload.c b/net/ipv4/tcp_offload.c index a2b68a108eae..05606353c7e7 100644 --- a/net/ipv4/tcp_offload.c +++ b/net/ipv4/tcp_offload.c | |||
@@ -274,33 +274,32 @@ static struct sk_buff **tcp4_gro_receive(struct sk_buff **head, struct sk_buff * | |||
274 | { | 274 | { |
275 | const struct iphdr *iph = skb_gro_network_header(skb); | 275 | const struct iphdr *iph = skb_gro_network_header(skb); |
276 | __wsum wsum; | 276 | __wsum wsum; |
277 | __sum16 sum; | 277 | |
278 | /* Don't bother verifying checksum if we're going to flush anyway. */ | ||
279 | if (NAPI_GRO_CB(skb)->flush) | ||
280 | goto skip_csum; | ||
281 | |||
282 | wsum = skb->csum; | ||
278 | 283 | ||
279 | switch (skb->ip_summed) { | 284 | switch (skb->ip_summed) { |
285 | case CHECKSUM_NONE: | ||
286 | wsum = skb_checksum(skb, skb_gro_offset(skb), skb_gro_len(skb), | ||
287 | 0); | ||
288 | |||
289 | /* fall through */ | ||
290 | |||
280 | case CHECKSUM_COMPLETE: | 291 | case CHECKSUM_COMPLETE: |
281 | if (!tcp_v4_check(skb_gro_len(skb), iph->saddr, iph->daddr, | 292 | if (!tcp_v4_check(skb_gro_len(skb), iph->saddr, iph->daddr, |
282 | skb->csum)) { | 293 | wsum)) { |
283 | skb->ip_summed = CHECKSUM_UNNECESSARY; | 294 | skb->ip_summed = CHECKSUM_UNNECESSARY; |
284 | break; | 295 | break; |
285 | } | 296 | } |
286 | flush: | 297 | |
287 | NAPI_GRO_CB(skb)->flush = 1; | 298 | NAPI_GRO_CB(skb)->flush = 1; |
288 | return NULL; | 299 | return NULL; |
289 | |||
290 | case CHECKSUM_NONE: | ||
291 | wsum = csum_tcpudp_nofold(iph->saddr, iph->daddr, | ||
292 | skb_gro_len(skb), IPPROTO_TCP, 0); | ||
293 | sum = csum_fold(skb_checksum(skb, | ||
294 | skb_gro_offset(skb), | ||
295 | skb_gro_len(skb), | ||
296 | wsum)); | ||
297 | if (sum) | ||
298 | goto flush; | ||
299 | |||
300 | skb->ip_summed = CHECKSUM_UNNECESSARY; | ||
301 | break; | ||
302 | } | 300 | } |
303 | 301 | ||
302 | skip_csum: | ||
304 | return tcp_gro_receive(head, skb); | 303 | return tcp_gro_receive(head, skb); |
305 | } | 304 | } |
306 | 305 | ||
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c index 5944d7d668dd..62c19fdd102d 100644 --- a/net/ipv4/udp.c +++ b/net/ipv4/udp.c | |||
@@ -560,15 +560,11 @@ static inline struct sock *__udp4_lib_lookup_skb(struct sk_buff *skb, | |||
560 | __be16 sport, __be16 dport, | 560 | __be16 sport, __be16 dport, |
561 | struct udp_table *udptable) | 561 | struct udp_table *udptable) |
562 | { | 562 | { |
563 | struct sock *sk; | ||
564 | const struct iphdr *iph = ip_hdr(skb); | 563 | const struct iphdr *iph = ip_hdr(skb); |
565 | 564 | ||
566 | if (unlikely(sk = skb_steal_sock(skb))) | 565 | return __udp4_lib_lookup(dev_net(skb_dst(skb)->dev), iph->saddr, sport, |
567 | return sk; | 566 | iph->daddr, dport, inet_iif(skb), |
568 | else | 567 | udptable); |
569 | return __udp4_lib_lookup(dev_net(skb_dst(skb)->dev), iph->saddr, sport, | ||
570 | iph->daddr, dport, inet_iif(skb), | ||
571 | udptable); | ||
572 | } | 568 | } |
573 | 569 | ||
574 | struct sock *udp4_lib_lookup(struct net *net, __be32 saddr, __be16 sport, | 570 | struct sock *udp4_lib_lookup(struct net *net, __be32 saddr, __be16 sport, |
@@ -999,7 +995,7 @@ int udp_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg, | |||
999 | err = PTR_ERR(rt); | 995 | err = PTR_ERR(rt); |
1000 | rt = NULL; | 996 | rt = NULL; |
1001 | if (err == -ENETUNREACH) | 997 | if (err == -ENETUNREACH) |
1002 | IP_INC_STATS_BH(net, IPSTATS_MIB_OUTNOROUTES); | 998 | IP_INC_STATS(net, IPSTATS_MIB_OUTNOROUTES); |
1003 | goto out; | 999 | goto out; |
1004 | } | 1000 | } |
1005 | 1001 | ||
@@ -1098,6 +1094,9 @@ int udp_sendpage(struct sock *sk, struct page *page, int offset, | |||
1098 | struct udp_sock *up = udp_sk(sk); | 1094 | struct udp_sock *up = udp_sk(sk); |
1099 | int ret; | 1095 | int ret; |
1100 | 1096 | ||
1097 | if (flags & MSG_SENDPAGE_NOTLAST) | ||
1098 | flags |= MSG_MORE; | ||
1099 | |||
1101 | if (!up->pending) { | 1100 | if (!up->pending) { |
1102 | struct msghdr msg = { .msg_flags = flags|MSG_MORE }; | 1101 | struct msghdr msg = { .msg_flags = flags|MSG_MORE }; |
1103 | 1102 | ||
@@ -1236,7 +1235,7 @@ int udp_recvmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg, | |||
1236 | bool slow; | 1235 | bool slow; |
1237 | 1236 | ||
1238 | if (flags & MSG_ERRQUEUE) | 1237 | if (flags & MSG_ERRQUEUE) |
1239 | return ip_recv_error(sk, msg, len); | 1238 | return ip_recv_error(sk, msg, len, addr_len); |
1240 | 1239 | ||
1241 | try_again: | 1240 | try_again: |
1242 | skb = __skb_recv_datagram(sk, flags | (noblock ? MSG_DONTWAIT : 0), | 1241 | skb = __skb_recv_datagram(sk, flags | (noblock ? MSG_DONTWAIT : 0), |
@@ -1600,12 +1599,21 @@ static void flush_stack(struct sock **stack, unsigned int count, | |||
1600 | kfree_skb(skb1); | 1599 | kfree_skb(skb1); |
1601 | } | 1600 | } |
1602 | 1601 | ||
1603 | static void udp_sk_rx_dst_set(struct sock *sk, const struct sk_buff *skb) | 1602 | /* For TCP sockets, sk_rx_dst is protected by socket lock |
1603 | * For UDP, we use sk_dst_lock to guard against concurrent changes. | ||
1604 | */ | ||
1605 | static void udp_sk_rx_dst_set(struct sock *sk, struct dst_entry *dst) | ||
1604 | { | 1606 | { |
1605 | struct dst_entry *dst = skb_dst(skb); | 1607 | struct dst_entry *old; |
1606 | 1608 | ||
1607 | dst_hold(dst); | 1609 | spin_lock(&sk->sk_dst_lock); |
1608 | sk->sk_rx_dst = dst; | 1610 | old = sk->sk_rx_dst; |
1611 | if (likely(old != dst)) { | ||
1612 | dst_hold(dst); | ||
1613 | sk->sk_rx_dst = dst; | ||
1614 | dst_release(old); | ||
1615 | } | ||
1616 | spin_unlock(&sk->sk_dst_lock); | ||
1609 | } | 1617 | } |
1610 | 1618 | ||
1611 | /* | 1619 | /* |
@@ -1736,15 +1744,16 @@ int __udp4_lib_rcv(struct sk_buff *skb, struct udp_table *udptable, | |||
1736 | if (udp4_csum_init(skb, uh, proto)) | 1744 | if (udp4_csum_init(skb, uh, proto)) |
1737 | goto csum_error; | 1745 | goto csum_error; |
1738 | 1746 | ||
1739 | if (skb->sk) { | 1747 | sk = skb_steal_sock(skb); |
1748 | if (sk) { | ||
1749 | struct dst_entry *dst = skb_dst(skb); | ||
1740 | int ret; | 1750 | int ret; |
1741 | sk = skb->sk; | ||
1742 | 1751 | ||
1743 | if (unlikely(sk->sk_rx_dst == NULL)) | 1752 | if (unlikely(sk->sk_rx_dst != dst)) |
1744 | udp_sk_rx_dst_set(sk, skb); | 1753 | udp_sk_rx_dst_set(sk, dst); |
1745 | 1754 | ||
1746 | ret = udp_queue_rcv_skb(sk, skb); | 1755 | ret = udp_queue_rcv_skb(sk, skb); |
1747 | 1756 | sock_put(sk); | |
1748 | /* a return value > 0 means to resubmit the input, but | 1757 | /* a return value > 0 means to resubmit the input, but |
1749 | * it wants the return to be -protocol, or 0 | 1758 | * it wants the return to be -protocol, or 0 |
1750 | */ | 1759 | */ |
@@ -1910,17 +1919,20 @@ static struct sock *__udp4_lib_demux_lookup(struct net *net, | |||
1910 | 1919 | ||
1911 | void udp_v4_early_demux(struct sk_buff *skb) | 1920 | void udp_v4_early_demux(struct sk_buff *skb) |
1912 | { | 1921 | { |
1913 | const struct iphdr *iph = ip_hdr(skb); | 1922 | struct net *net = dev_net(skb->dev); |
1914 | const struct udphdr *uh = udp_hdr(skb); | 1923 | const struct iphdr *iph; |
1924 | const struct udphdr *uh; | ||
1915 | struct sock *sk; | 1925 | struct sock *sk; |
1916 | struct dst_entry *dst; | 1926 | struct dst_entry *dst; |
1917 | struct net *net = dev_net(skb->dev); | ||
1918 | int dif = skb->dev->ifindex; | 1927 | int dif = skb->dev->ifindex; |
1919 | 1928 | ||
1920 | /* validate the packet */ | 1929 | /* validate the packet */ |
1921 | if (!pskb_may_pull(skb, skb_transport_offset(skb) + sizeof(struct udphdr))) | 1930 | if (!pskb_may_pull(skb, skb_transport_offset(skb) + sizeof(struct udphdr))) |
1922 | return; | 1931 | return; |
1923 | 1932 | ||
1933 | iph = ip_hdr(skb); | ||
1934 | uh = udp_hdr(skb); | ||
1935 | |||
1924 | if (skb->pkt_type == PACKET_BROADCAST || | 1936 | if (skb->pkt_type == PACKET_BROADCAST || |
1925 | skb->pkt_type == PACKET_MULTICAST) | 1937 | skb->pkt_type == PACKET_MULTICAST) |
1926 | sk = __udp4_lib_mcast_demux_lookup(net, uh->dest, iph->daddr, | 1938 | sk = __udp4_lib_mcast_demux_lookup(net, uh->dest, iph->daddr, |
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c index 12c97d8aa6bb..d5fa5b8c443e 100644 --- a/net/ipv6/addrconf.c +++ b/net/ipv6/addrconf.c | |||
@@ -2613,7 +2613,7 @@ static void init_loopback(struct net_device *dev) | |||
2613 | if (sp_ifa->rt) | 2613 | if (sp_ifa->rt) |
2614 | continue; | 2614 | continue; |
2615 | 2615 | ||
2616 | sp_rt = addrconf_dst_alloc(idev, &sp_ifa->addr, 0); | 2616 | sp_rt = addrconf_dst_alloc(idev, &sp_ifa->addr, false); |
2617 | 2617 | ||
2618 | /* Failure cases are ignored */ | 2618 | /* Failure cases are ignored */ |
2619 | if (!IS_ERR(sp_rt)) { | 2619 | if (!IS_ERR(sp_rt)) { |
diff --git a/net/ipv6/datagram.c b/net/ipv6/datagram.c index a454b0ff57c7..93b1aa34c432 100644 --- a/net/ipv6/datagram.c +++ b/net/ipv6/datagram.c | |||
@@ -73,7 +73,6 @@ int ip6_datagram_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len) | |||
73 | flowlabel = fl6_sock_lookup(sk, fl6.flowlabel); | 73 | flowlabel = fl6_sock_lookup(sk, fl6.flowlabel); |
74 | if (flowlabel == NULL) | 74 | if (flowlabel == NULL) |
75 | return -EINVAL; | 75 | return -EINVAL; |
76 | usin->sin6_addr = flowlabel->dst; | ||
77 | } | 76 | } |
78 | } | 77 | } |
79 | 78 | ||
@@ -318,7 +317,7 @@ void ipv6_local_rxpmtu(struct sock *sk, struct flowi6 *fl6, u32 mtu) | |||
318 | /* | 317 | /* |
319 | * Handle MSG_ERRQUEUE | 318 | * Handle MSG_ERRQUEUE |
320 | */ | 319 | */ |
321 | int ipv6_recv_error(struct sock *sk, struct msghdr *msg, int len) | 320 | int ipv6_recv_error(struct sock *sk, struct msghdr *msg, int len, int *addr_len) |
322 | { | 321 | { |
323 | struct ipv6_pinfo *np = inet6_sk(sk); | 322 | struct ipv6_pinfo *np = inet6_sk(sk); |
324 | struct sock_exterr_skb *serr; | 323 | struct sock_exterr_skb *serr; |
@@ -369,6 +368,7 @@ int ipv6_recv_error(struct sock *sk, struct msghdr *msg, int len) | |||
369 | &sin->sin6_addr); | 368 | &sin->sin6_addr); |
370 | sin->sin6_scope_id = 0; | 369 | sin->sin6_scope_id = 0; |
371 | } | 370 | } |
371 | *addr_len = sizeof(*sin); | ||
372 | } | 372 | } |
373 | 373 | ||
374 | memcpy(&errhdr.ee, &serr->ee, sizeof(struct sock_extended_err)); | 374 | memcpy(&errhdr.ee, &serr->ee, sizeof(struct sock_extended_err)); |
@@ -377,6 +377,7 @@ int ipv6_recv_error(struct sock *sk, struct msghdr *msg, int len) | |||
377 | if (serr->ee.ee_origin != SO_EE_ORIGIN_LOCAL) { | 377 | if (serr->ee.ee_origin != SO_EE_ORIGIN_LOCAL) { |
378 | sin->sin6_family = AF_INET6; | 378 | sin->sin6_family = AF_INET6; |
379 | sin->sin6_flowinfo = 0; | 379 | sin->sin6_flowinfo = 0; |
380 | sin->sin6_port = 0; | ||
380 | if (skb->protocol == htons(ETH_P_IPV6)) { | 381 | if (skb->protocol == htons(ETH_P_IPV6)) { |
381 | sin->sin6_addr = ipv6_hdr(skb)->saddr; | 382 | sin->sin6_addr = ipv6_hdr(skb)->saddr; |
382 | if (np->rxopt.all) | 383 | if (np->rxopt.all) |
@@ -423,7 +424,8 @@ EXPORT_SYMBOL_GPL(ipv6_recv_error); | |||
423 | /* | 424 | /* |
424 | * Handle IPV6_RECVPATHMTU | 425 | * Handle IPV6_RECVPATHMTU |
425 | */ | 426 | */ |
426 | int ipv6_recv_rxpmtu(struct sock *sk, struct msghdr *msg, int len) | 427 | int ipv6_recv_rxpmtu(struct sock *sk, struct msghdr *msg, int len, |
428 | int *addr_len) | ||
427 | { | 429 | { |
428 | struct ipv6_pinfo *np = inet6_sk(sk); | 430 | struct ipv6_pinfo *np = inet6_sk(sk); |
429 | struct sk_buff *skb; | 431 | struct sk_buff *skb; |
@@ -457,6 +459,7 @@ int ipv6_recv_rxpmtu(struct sock *sk, struct msghdr *msg, int len) | |||
457 | sin->sin6_port = 0; | 459 | sin->sin6_port = 0; |
458 | sin->sin6_scope_id = mtu_info.ip6m_addr.sin6_scope_id; | 460 | sin->sin6_scope_id = mtu_info.ip6m_addr.sin6_scope_id; |
459 | sin->sin6_addr = mtu_info.ip6m_addr.sin6_addr; | 461 | sin->sin6_addr = mtu_info.ip6m_addr.sin6_addr; |
462 | *addr_len = sizeof(*sin); | ||
460 | } | 463 | } |
461 | 464 | ||
462 | put_cmsg(msg, SOL_IPV6, IPV6_PATHMTU, sizeof(mtu_info), &mtu_info); | 465 | put_cmsg(msg, SOL_IPV6, IPV6_PATHMTU, sizeof(mtu_info), &mtu_info); |
diff --git a/net/ipv6/fib6_rules.c b/net/ipv6/fib6_rules.c index e27591635f92..3fd0a578329e 100644 --- a/net/ipv6/fib6_rules.c +++ b/net/ipv6/fib6_rules.c | |||
@@ -122,7 +122,11 @@ out: | |||
122 | static bool fib6_rule_suppress(struct fib_rule *rule, struct fib_lookup_arg *arg) | 122 | static bool fib6_rule_suppress(struct fib_rule *rule, struct fib_lookup_arg *arg) |
123 | { | 123 | { |
124 | struct rt6_info *rt = (struct rt6_info *) arg->result; | 124 | struct rt6_info *rt = (struct rt6_info *) arg->result; |
125 | struct net_device *dev = rt->rt6i_idev->dev; | 125 | struct net_device *dev = NULL; |
126 | |||
127 | if (rt->rt6i_idev) | ||
128 | dev = rt->rt6i_idev->dev; | ||
129 | |||
126 | /* do not accept result if the route does | 130 | /* do not accept result if the route does |
127 | * not meet the required prefix length | 131 | * not meet the required prefix length |
128 | */ | 132 | */ |
diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c index 59df872e2f4d..4acdb63495db 100644 --- a/net/ipv6/ip6_output.c +++ b/net/ipv6/ip6_output.c | |||
@@ -116,8 +116,8 @@ static int ip6_finish_output2(struct sk_buff *skb) | |||
116 | } | 116 | } |
117 | rcu_read_unlock_bh(); | 117 | rcu_read_unlock_bh(); |
118 | 118 | ||
119 | IP6_INC_STATS_BH(dev_net(dst->dev), | 119 | IP6_INC_STATS(dev_net(dst->dev), |
120 | ip6_dst_idev(dst), IPSTATS_MIB_OUTNOROUTES); | 120 | ip6_dst_idev(dst), IPSTATS_MIB_OUTNOROUTES); |
121 | kfree_skb(skb); | 121 | kfree_skb(skb); |
122 | return -EINVAL; | 122 | return -EINVAL; |
123 | } | 123 | } |
diff --git a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c index 3512177deb4d..300865171394 100644 --- a/net/ipv6/ndisc.c +++ b/net/ipv6/ndisc.c | |||
@@ -1277,6 +1277,9 @@ skip_linkparms: | |||
1277 | ri->prefix_len == 0) | 1277 | ri->prefix_len == 0) |
1278 | continue; | 1278 | continue; |
1279 | #endif | 1279 | #endif |
1280 | if (ri->prefix_len == 0 && | ||
1281 | !in6_dev->cnf.accept_ra_defrtr) | ||
1282 | continue; | ||
1280 | if (ri->prefix_len > in6_dev->cnf.accept_ra_rt_info_max_plen) | 1283 | if (ri->prefix_len > in6_dev->cnf.accept_ra_rt_info_max_plen) |
1281 | continue; | 1284 | continue; |
1282 | rt6_route_rcv(skb->dev, (u8*)p, (p->nd_opt_len) << 3, | 1285 | rt6_route_rcv(skb->dev, (u8*)p, (p->nd_opt_len) << 3, |
diff --git a/net/ipv6/ping.c b/net/ipv6/ping.c index 8815e31a87fe..a83243c3d656 100644 --- a/net/ipv6/ping.c +++ b/net/ipv6/ping.c | |||
@@ -57,7 +57,8 @@ static struct inet_protosw pingv6_protosw = { | |||
57 | 57 | ||
58 | 58 | ||
59 | /* Compatibility glue so we can support IPv6 when it's compiled as a module */ | 59 | /* Compatibility glue so we can support IPv6 when it's compiled as a module */ |
60 | static int dummy_ipv6_recv_error(struct sock *sk, struct msghdr *msg, int len) | 60 | static int dummy_ipv6_recv_error(struct sock *sk, struct msghdr *msg, int len, |
61 | int *addr_len) | ||
61 | { | 62 | { |
62 | return -EAFNOSUPPORT; | 63 | return -EAFNOSUPPORT; |
63 | } | 64 | } |
diff --git a/net/ipv6/protocol.c b/net/ipv6/protocol.c index 22d1bd4670da..e048cf1bb6a2 100644 --- a/net/ipv6/protocol.c +++ b/net/ipv6/protocol.c | |||
@@ -36,10 +36,6 @@ int inet6_add_protocol(const struct inet6_protocol *prot, unsigned char protocol | |||
36 | } | 36 | } |
37 | EXPORT_SYMBOL(inet6_add_protocol); | 37 | EXPORT_SYMBOL(inet6_add_protocol); |
38 | 38 | ||
39 | /* | ||
40 | * Remove a protocol from the hash tables. | ||
41 | */ | ||
42 | |||
43 | int inet6_del_protocol(const struct inet6_protocol *prot, unsigned char protocol) | 39 | int inet6_del_protocol(const struct inet6_protocol *prot, unsigned char protocol) |
44 | { | 40 | { |
45 | int ret; | 41 | int ret; |
diff --git a/net/ipv6/raw.c b/net/ipv6/raw.c index e24ff1df0401..b6bb87e55805 100644 --- a/net/ipv6/raw.c +++ b/net/ipv6/raw.c | |||
@@ -466,10 +466,10 @@ static int rawv6_recvmsg(struct kiocb *iocb, struct sock *sk, | |||
466 | return -EOPNOTSUPP; | 466 | return -EOPNOTSUPP; |
467 | 467 | ||
468 | if (flags & MSG_ERRQUEUE) | 468 | if (flags & MSG_ERRQUEUE) |
469 | return ipv6_recv_error(sk, msg, len); | 469 | return ipv6_recv_error(sk, msg, len, addr_len); |
470 | 470 | ||
471 | if (np->rxpmtu && np->rxopt.bits.rxpmtu) | 471 | if (np->rxpmtu && np->rxopt.bits.rxpmtu) |
472 | return ipv6_recv_rxpmtu(sk, msg, len); | 472 | return ipv6_recv_rxpmtu(sk, msg, len, addr_len); |
473 | 473 | ||
474 | skb = skb_recv_datagram(sk, flags, noblock, &err); | 474 | skb = skb_recv_datagram(sk, flags, noblock, &err); |
475 | if (!skb) | 475 | if (!skb) |
@@ -792,7 +792,6 @@ static int rawv6_sendmsg(struct kiocb *iocb, struct sock *sk, | |||
792 | flowlabel = fl6_sock_lookup(sk, fl6.flowlabel); | 792 | flowlabel = fl6_sock_lookup(sk, fl6.flowlabel); |
793 | if (flowlabel == NULL) | 793 | if (flowlabel == NULL) |
794 | return -EINVAL; | 794 | return -EINVAL; |
795 | daddr = &flowlabel->dst; | ||
796 | } | 795 | } |
797 | } | 796 | } |
798 | 797 | ||
diff --git a/net/ipv6/route.c b/net/ipv6/route.c index 7faa9d5e1503..a0a48ac3403f 100644 --- a/net/ipv6/route.c +++ b/net/ipv6/route.c | |||
@@ -84,6 +84,8 @@ static int ip6_dst_gc(struct dst_ops *ops); | |||
84 | 84 | ||
85 | static int ip6_pkt_discard(struct sk_buff *skb); | 85 | static int ip6_pkt_discard(struct sk_buff *skb); |
86 | static int ip6_pkt_discard_out(struct sk_buff *skb); | 86 | static int ip6_pkt_discard_out(struct sk_buff *skb); |
87 | static int ip6_pkt_prohibit(struct sk_buff *skb); | ||
88 | static int ip6_pkt_prohibit_out(struct sk_buff *skb); | ||
87 | static void ip6_link_failure(struct sk_buff *skb); | 89 | static void ip6_link_failure(struct sk_buff *skb); |
88 | static void ip6_rt_update_pmtu(struct dst_entry *dst, struct sock *sk, | 90 | static void ip6_rt_update_pmtu(struct dst_entry *dst, struct sock *sk, |
89 | struct sk_buff *skb, u32 mtu); | 91 | struct sk_buff *skb, u32 mtu); |
@@ -234,9 +236,6 @@ static const struct rt6_info ip6_null_entry_template = { | |||
234 | 236 | ||
235 | #ifdef CONFIG_IPV6_MULTIPLE_TABLES | 237 | #ifdef CONFIG_IPV6_MULTIPLE_TABLES |
236 | 238 | ||
237 | static int ip6_pkt_prohibit(struct sk_buff *skb); | ||
238 | static int ip6_pkt_prohibit_out(struct sk_buff *skb); | ||
239 | |||
240 | static const struct rt6_info ip6_prohibit_entry_template = { | 239 | static const struct rt6_info ip6_prohibit_entry_template = { |
241 | .dst = { | 240 | .dst = { |
242 | .__refcnt = ATOMIC_INIT(1), | 241 | .__refcnt = ATOMIC_INIT(1), |
@@ -1565,21 +1564,24 @@ int ip6_route_add(struct fib6_config *cfg) | |||
1565 | goto out; | 1564 | goto out; |
1566 | } | 1565 | } |
1567 | } | 1566 | } |
1568 | rt->dst.output = ip6_pkt_discard_out; | ||
1569 | rt->dst.input = ip6_pkt_discard; | ||
1570 | rt->rt6i_flags = RTF_REJECT|RTF_NONEXTHOP; | 1567 | rt->rt6i_flags = RTF_REJECT|RTF_NONEXTHOP; |
1571 | switch (cfg->fc_type) { | 1568 | switch (cfg->fc_type) { |
1572 | case RTN_BLACKHOLE: | 1569 | case RTN_BLACKHOLE: |
1573 | rt->dst.error = -EINVAL; | 1570 | rt->dst.error = -EINVAL; |
1571 | rt->dst.output = dst_discard; | ||
1572 | rt->dst.input = dst_discard; | ||
1574 | break; | 1573 | break; |
1575 | case RTN_PROHIBIT: | 1574 | case RTN_PROHIBIT: |
1576 | rt->dst.error = -EACCES; | 1575 | rt->dst.error = -EACCES; |
1576 | rt->dst.output = ip6_pkt_prohibit_out; | ||
1577 | rt->dst.input = ip6_pkt_prohibit; | ||
1577 | break; | 1578 | break; |
1578 | case RTN_THROW: | 1579 | case RTN_THROW: |
1579 | rt->dst.error = -EAGAIN; | ||
1580 | break; | ||
1581 | default: | 1580 | default: |
1582 | rt->dst.error = -ENETUNREACH; | 1581 | rt->dst.error = (cfg->fc_type == RTN_THROW) ? -EAGAIN |
1582 | : -ENETUNREACH; | ||
1583 | rt->dst.output = ip6_pkt_discard_out; | ||
1584 | rt->dst.input = ip6_pkt_discard; | ||
1583 | break; | 1585 | break; |
1584 | } | 1586 | } |
1585 | goto install_route; | 1587 | goto install_route; |
@@ -2144,8 +2146,6 @@ static int ip6_pkt_discard_out(struct sk_buff *skb) | |||
2144 | return ip6_pkt_drop(skb, ICMPV6_NOROUTE, IPSTATS_MIB_OUTNOROUTES); | 2146 | return ip6_pkt_drop(skb, ICMPV6_NOROUTE, IPSTATS_MIB_OUTNOROUTES); |
2145 | } | 2147 | } |
2146 | 2148 | ||
2147 | #ifdef CONFIG_IPV6_MULTIPLE_TABLES | ||
2148 | |||
2149 | static int ip6_pkt_prohibit(struct sk_buff *skb) | 2149 | static int ip6_pkt_prohibit(struct sk_buff *skb) |
2150 | { | 2150 | { |
2151 | return ip6_pkt_drop(skb, ICMPV6_ADM_PROHIBITED, IPSTATS_MIB_INNOROUTES); | 2151 | return ip6_pkt_drop(skb, ICMPV6_ADM_PROHIBITED, IPSTATS_MIB_INNOROUTES); |
@@ -2157,8 +2157,6 @@ static int ip6_pkt_prohibit_out(struct sk_buff *skb) | |||
2157 | return ip6_pkt_drop(skb, ICMPV6_ADM_PROHIBITED, IPSTATS_MIB_OUTNOROUTES); | 2157 | return ip6_pkt_drop(skb, ICMPV6_ADM_PROHIBITED, IPSTATS_MIB_OUTNOROUTES); |
2158 | } | 2158 | } |
2159 | 2159 | ||
2160 | #endif | ||
2161 | |||
2162 | /* | 2160 | /* |
2163 | * Allocate a dst for local (unicast / anycast) address. | 2161 | * Allocate a dst for local (unicast / anycast) address. |
2164 | */ | 2162 | */ |
@@ -2168,12 +2166,10 @@ struct rt6_info *addrconf_dst_alloc(struct inet6_dev *idev, | |||
2168 | bool anycast) | 2166 | bool anycast) |
2169 | { | 2167 | { |
2170 | struct net *net = dev_net(idev->dev); | 2168 | struct net *net = dev_net(idev->dev); |
2171 | struct rt6_info *rt = ip6_dst_alloc(net, net->loopback_dev, 0, NULL); | 2169 | struct rt6_info *rt = ip6_dst_alloc(net, net->loopback_dev, |
2172 | 2170 | DST_NOCOUNT, NULL); | |
2173 | if (!rt) { | 2171 | if (!rt) |
2174 | net_warn_ratelimited("Maximum number of routes reached, consider increasing route/max_size\n"); | ||
2175 | return ERR_PTR(-ENOMEM); | 2172 | return ERR_PTR(-ENOMEM); |
2176 | } | ||
2177 | 2173 | ||
2178 | in6_dev_hold(idev); | 2174 | in6_dev_hold(idev); |
2179 | 2175 | ||
diff --git a/net/ipv6/sit.c b/net/ipv6/sit.c index 1b4a4a953675..366fbba3359a 100644 --- a/net/ipv6/sit.c +++ b/net/ipv6/sit.c | |||
@@ -478,14 +478,44 @@ static void ipip6_tunnel_uninit(struct net_device *dev) | |||
478 | dev_put(dev); | 478 | dev_put(dev); |
479 | } | 479 | } |
480 | 480 | ||
481 | /* Generate icmpv6 with type/code ICMPV6_DEST_UNREACH/ICMPV6_ADDR_UNREACH | ||
482 | * if sufficient data bytes are available | ||
483 | */ | ||
484 | static int ipip6_err_gen_icmpv6_unreach(struct sk_buff *skb) | ||
485 | { | ||
486 | const struct iphdr *iph = (const struct iphdr *) skb->data; | ||
487 | struct rt6_info *rt; | ||
488 | struct sk_buff *skb2; | ||
489 | |||
490 | if (!pskb_may_pull(skb, iph->ihl * 4 + sizeof(struct ipv6hdr) + 8)) | ||
491 | return 1; | ||
492 | |||
493 | skb2 = skb_clone(skb, GFP_ATOMIC); | ||
494 | |||
495 | if (!skb2) | ||
496 | return 1; | ||
497 | |||
498 | skb_dst_drop(skb2); | ||
499 | skb_pull(skb2, iph->ihl * 4); | ||
500 | skb_reset_network_header(skb2); | ||
501 | |||
502 | rt = rt6_lookup(dev_net(skb->dev), &ipv6_hdr(skb2)->saddr, NULL, 0, 0); | ||
503 | |||
504 | if (rt && rt->dst.dev) | ||
505 | skb2->dev = rt->dst.dev; | ||
506 | |||
507 | icmpv6_send(skb2, ICMPV6_DEST_UNREACH, ICMPV6_ADDR_UNREACH, 0); | ||
508 | |||
509 | if (rt) | ||
510 | ip6_rt_put(rt); | ||
511 | |||
512 | kfree_skb(skb2); | ||
513 | |||
514 | return 0; | ||
515 | } | ||
481 | 516 | ||
482 | static int ipip6_err(struct sk_buff *skb, u32 info) | 517 | static int ipip6_err(struct sk_buff *skb, u32 info) |
483 | { | 518 | { |
484 | |||
485 | /* All the routers (except for Linux) return only | ||
486 | 8 bytes of packet payload. It means, that precise relaying of | ||
487 | ICMP in the real Internet is absolutely infeasible. | ||
488 | */ | ||
489 | const struct iphdr *iph = (const struct iphdr *)skb->data; | 519 | const struct iphdr *iph = (const struct iphdr *)skb->data; |
490 | const int type = icmp_hdr(skb)->type; | 520 | const int type = icmp_hdr(skb)->type; |
491 | const int code = icmp_hdr(skb)->code; | 521 | const int code = icmp_hdr(skb)->code; |
@@ -500,7 +530,6 @@ static int ipip6_err(struct sk_buff *skb, u32 info) | |||
500 | case ICMP_DEST_UNREACH: | 530 | case ICMP_DEST_UNREACH: |
501 | switch (code) { | 531 | switch (code) { |
502 | case ICMP_SR_FAILED: | 532 | case ICMP_SR_FAILED: |
503 | case ICMP_PORT_UNREACH: | ||
504 | /* Impossible event. */ | 533 | /* Impossible event. */ |
505 | return 0; | 534 | return 0; |
506 | default: | 535 | default: |
@@ -545,6 +574,9 @@ static int ipip6_err(struct sk_buff *skb, u32 info) | |||
545 | goto out; | 574 | goto out; |
546 | 575 | ||
547 | err = 0; | 576 | err = 0; |
577 | if (!ipip6_err_gen_icmpv6_unreach(skb)) | ||
578 | goto out; | ||
579 | |||
548 | if (t->parms.iph.ttl == 0 && type == ICMP_TIME_EXCEEDED) | 580 | if (t->parms.iph.ttl == 0 && type == ICMP_TIME_EXCEEDED) |
549 | goto out; | 581 | goto out; |
550 | 582 | ||
@@ -919,7 +951,7 @@ static netdev_tx_t ipip6_tunnel_xmit(struct sk_buff *skb, | |||
919 | if (!new_skb) { | 951 | if (!new_skb) { |
920 | ip_rt_put(rt); | 952 | ip_rt_put(rt); |
921 | dev->stats.tx_dropped++; | 953 | dev->stats.tx_dropped++; |
922 | dev_kfree_skb(skb); | 954 | kfree_skb(skb); |
923 | return NETDEV_TX_OK; | 955 | return NETDEV_TX_OK; |
924 | } | 956 | } |
925 | if (skb->sk) | 957 | if (skb->sk) |
@@ -945,7 +977,7 @@ static netdev_tx_t ipip6_tunnel_xmit(struct sk_buff *skb, | |||
945 | tx_error_icmp: | 977 | tx_error_icmp: |
946 | dst_link_failure(skb); | 978 | dst_link_failure(skb); |
947 | tx_error: | 979 | tx_error: |
948 | dev_kfree_skb(skb); | 980 | kfree_skb(skb); |
949 | out: | 981 | out: |
950 | dev->stats.tx_errors++; | 982 | dev->stats.tx_errors++; |
951 | return NETDEV_TX_OK; | 983 | return NETDEV_TX_OK; |
@@ -985,7 +1017,7 @@ static netdev_tx_t sit_tunnel_xmit(struct sk_buff *skb, | |||
985 | 1017 | ||
986 | tx_err: | 1018 | tx_err: |
987 | dev->stats.tx_errors++; | 1019 | dev->stats.tx_errors++; |
988 | dev_kfree_skb(skb); | 1020 | kfree_skb(skb); |
989 | return NETDEV_TX_OK; | 1021 | return NETDEV_TX_OK; |
990 | 1022 | ||
991 | } | 1023 | } |
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c index 0740f93a114a..f67033b4bb66 100644 --- a/net/ipv6/tcp_ipv6.c +++ b/net/ipv6/tcp_ipv6.c | |||
@@ -156,7 +156,6 @@ static int tcp_v6_connect(struct sock *sk, struct sockaddr *uaddr, | |||
156 | flowlabel = fl6_sock_lookup(sk, fl6.flowlabel); | 156 | flowlabel = fl6_sock_lookup(sk, fl6.flowlabel); |
157 | if (flowlabel == NULL) | 157 | if (flowlabel == NULL) |
158 | return -EINVAL; | 158 | return -EINVAL; |
159 | usin->sin6_addr = flowlabel->dst; | ||
160 | fl6_sock_release(flowlabel); | 159 | fl6_sock_release(flowlabel); |
161 | } | 160 | } |
162 | } | 161 | } |
diff --git a/net/ipv6/tcpv6_offload.c b/net/ipv6/tcpv6_offload.c index c1097c798900..6d18157dc32c 100644 --- a/net/ipv6/tcpv6_offload.c +++ b/net/ipv6/tcpv6_offload.c | |||
@@ -37,34 +37,32 @@ static struct sk_buff **tcp6_gro_receive(struct sk_buff **head, | |||
37 | { | 37 | { |
38 | const struct ipv6hdr *iph = skb_gro_network_header(skb); | 38 | const struct ipv6hdr *iph = skb_gro_network_header(skb); |
39 | __wsum wsum; | 39 | __wsum wsum; |
40 | __sum16 sum; | 40 | |
41 | /* Don't bother verifying checksum if we're going to flush anyway. */ | ||
42 | if (NAPI_GRO_CB(skb)->flush) | ||
43 | goto skip_csum; | ||
44 | |||
45 | wsum = skb->csum; | ||
41 | 46 | ||
42 | switch (skb->ip_summed) { | 47 | switch (skb->ip_summed) { |
48 | case CHECKSUM_NONE: | ||
49 | wsum = skb_checksum(skb, skb_gro_offset(skb), skb_gro_len(skb), | ||
50 | wsum); | ||
51 | |||
52 | /* fall through */ | ||
53 | |||
43 | case CHECKSUM_COMPLETE: | 54 | case CHECKSUM_COMPLETE: |
44 | if (!tcp_v6_check(skb_gro_len(skb), &iph->saddr, &iph->daddr, | 55 | if (!tcp_v6_check(skb_gro_len(skb), &iph->saddr, &iph->daddr, |
45 | skb->csum)) { | 56 | wsum)) { |
46 | skb->ip_summed = CHECKSUM_UNNECESSARY; | 57 | skb->ip_summed = CHECKSUM_UNNECESSARY; |
47 | break; | 58 | break; |
48 | } | 59 | } |
49 | flush: | 60 | |
50 | NAPI_GRO_CB(skb)->flush = 1; | 61 | NAPI_GRO_CB(skb)->flush = 1; |
51 | return NULL; | 62 | return NULL; |
52 | |||
53 | case CHECKSUM_NONE: | ||
54 | wsum = ~csum_unfold(csum_ipv6_magic(&iph->saddr, &iph->daddr, | ||
55 | skb_gro_len(skb), | ||
56 | IPPROTO_TCP, 0)); | ||
57 | sum = csum_fold(skb_checksum(skb, | ||
58 | skb_gro_offset(skb), | ||
59 | skb_gro_len(skb), | ||
60 | wsum)); | ||
61 | if (sum) | ||
62 | goto flush; | ||
63 | |||
64 | skb->ip_summed = CHECKSUM_UNNECESSARY; | ||
65 | break; | ||
66 | } | 63 | } |
67 | 64 | ||
65 | skip_csum: | ||
68 | return tcp_gro_receive(head, skb); | 66 | return tcp_gro_receive(head, skb); |
69 | } | 67 | } |
70 | 68 | ||
diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c index 81eb8cf8389b..089c741a3992 100644 --- a/net/ipv6/udp.c +++ b/net/ipv6/udp.c | |||
@@ -393,10 +393,10 @@ int udpv6_recvmsg(struct kiocb *iocb, struct sock *sk, | |||
393 | bool slow; | 393 | bool slow; |
394 | 394 | ||
395 | if (flags & MSG_ERRQUEUE) | 395 | if (flags & MSG_ERRQUEUE) |
396 | return ipv6_recv_error(sk, msg, len); | 396 | return ipv6_recv_error(sk, msg, len, addr_len); |
397 | 397 | ||
398 | if (np->rxpmtu && np->rxopt.bits.rxpmtu) | 398 | if (np->rxpmtu && np->rxopt.bits.rxpmtu) |
399 | return ipv6_recv_rxpmtu(sk, msg, len); | 399 | return ipv6_recv_rxpmtu(sk, msg, len, addr_len); |
400 | 400 | ||
401 | try_again: | 401 | try_again: |
402 | skb = __skb_recv_datagram(sk, flags | (noblock ? MSG_DONTWAIT : 0), | 402 | skb = __skb_recv_datagram(sk, flags | (noblock ? MSG_DONTWAIT : 0), |
@@ -1140,7 +1140,6 @@ do_udp_sendmsg: | |||
1140 | flowlabel = fl6_sock_lookup(sk, fl6.flowlabel); | 1140 | flowlabel = fl6_sock_lookup(sk, fl6.flowlabel); |
1141 | if (flowlabel == NULL) | 1141 | if (flowlabel == NULL) |
1142 | return -EINVAL; | 1142 | return -EINVAL; |
1143 | daddr = &flowlabel->dst; | ||
1144 | } | 1143 | } |
1145 | } | 1144 | } |
1146 | 1145 | ||
diff --git a/net/l2tp/l2tp_ip6.c b/net/l2tp/l2tp_ip6.c index cfd65304be60..bb6e206ea70b 100644 --- a/net/l2tp/l2tp_ip6.c +++ b/net/l2tp/l2tp_ip6.c | |||
@@ -528,7 +528,6 @@ static int l2tp_ip6_sendmsg(struct kiocb *iocb, struct sock *sk, | |||
528 | flowlabel = fl6_sock_lookup(sk, fl6.flowlabel); | 528 | flowlabel = fl6_sock_lookup(sk, fl6.flowlabel); |
529 | if (flowlabel == NULL) | 529 | if (flowlabel == NULL) |
530 | return -EINVAL; | 530 | return -EINVAL; |
531 | daddr = &flowlabel->dst; | ||
532 | } | 531 | } |
533 | } | 532 | } |
534 | 533 | ||
@@ -665,7 +664,7 @@ static int l2tp_ip6_recvmsg(struct kiocb *iocb, struct sock *sk, | |||
665 | *addr_len = sizeof(*lsa); | 664 | *addr_len = sizeof(*lsa); |
666 | 665 | ||
667 | if (flags & MSG_ERRQUEUE) | 666 | if (flags & MSG_ERRQUEUE) |
668 | return ipv6_recv_error(sk, msg, len); | 667 | return ipv6_recv_error(sk, msg, len, addr_len); |
669 | 668 | ||
670 | skb = skb_recv_datagram(sk, flags, noblock, &err); | 669 | skb = skb_recv_datagram(sk, flags, noblock, &err); |
671 | if (!skb) | 670 | if (!skb) |
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c index 95667b088c5b..364ce0c5962f 100644 --- a/net/mac80211/cfg.c +++ b/net/mac80211/cfg.c | |||
@@ -1368,7 +1368,7 @@ static int sta_apply_parameters(struct ieee80211_local *local, | |||
1368 | changed |= | 1368 | changed |= |
1369 | ieee80211_mps_set_sta_local_pm(sta, | 1369 | ieee80211_mps_set_sta_local_pm(sta, |
1370 | params->local_pm); | 1370 | params->local_pm); |
1371 | ieee80211_bss_info_change_notify(sdata, changed); | 1371 | ieee80211_mbss_info_change_notify(sdata, changed); |
1372 | #endif | 1372 | #endif |
1373 | } | 1373 | } |
1374 | 1374 | ||
@@ -2488,8 +2488,7 @@ static int ieee80211_set_power_mgmt(struct wiphy *wiphy, struct net_device *dev, | |||
2488 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); | 2488 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); |
2489 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); | 2489 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); |
2490 | 2490 | ||
2491 | if (sdata->vif.type != NL80211_IFTYPE_STATION && | 2491 | if (sdata->vif.type != NL80211_IFTYPE_STATION) |
2492 | sdata->vif.type != NL80211_IFTYPE_MESH_POINT) | ||
2493 | return -EOPNOTSUPP; | 2492 | return -EOPNOTSUPP; |
2494 | 2493 | ||
2495 | if (!(local->hw.flags & IEEE80211_HW_SUPPORTS_PS)) | 2494 | if (!(local->hw.flags & IEEE80211_HW_SUPPORTS_PS)) |
@@ -3120,9 +3119,17 @@ static int ieee80211_channel_switch(struct wiphy *wiphy, struct net_device *dev, | |||
3120 | params->chandef.chan->band) | 3119 | params->chandef.chan->band) |
3121 | return -EINVAL; | 3120 | return -EINVAL; |
3122 | 3121 | ||
3122 | ifmsh->chsw_init = true; | ||
3123 | if (!ifmsh->pre_value) | ||
3124 | ifmsh->pre_value = 1; | ||
3125 | else | ||
3126 | ifmsh->pre_value++; | ||
3127 | |||
3123 | err = ieee80211_mesh_csa_beacon(sdata, params, true); | 3128 | err = ieee80211_mesh_csa_beacon(sdata, params, true); |
3124 | if (err < 0) | 3129 | if (err < 0) { |
3130 | ifmsh->chsw_init = false; | ||
3125 | return err; | 3131 | return err; |
3132 | } | ||
3126 | break; | 3133 | break; |
3127 | #endif | 3134 | #endif |
3128 | default: | 3135 | default: |
diff --git a/net/mac80211/ibss.c b/net/mac80211/ibss.c index 531be040b9ae..27a39de89679 100644 --- a/net/mac80211/ibss.c +++ b/net/mac80211/ibss.c | |||
@@ -823,6 +823,10 @@ ieee80211_ibss_process_chanswitch(struct ieee80211_sub_if_data *sdata, | |||
823 | if (err) | 823 | if (err) |
824 | return false; | 824 | return false; |
825 | 825 | ||
826 | /* channel switch is not supported, disconnect */ | ||
827 | if (!(sdata->local->hw.wiphy->flags & WIPHY_FLAG_HAS_CHANNEL_SWITCH)) | ||
828 | goto disconnect; | ||
829 | |||
826 | params.count = csa_ie.count; | 830 | params.count = csa_ie.count; |
827 | params.chandef = csa_ie.chandef; | 831 | params.chandef = csa_ie.chandef; |
828 | 832 | ||
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h index 29dc505be125..4aea4e791113 100644 --- a/net/mac80211/ieee80211_i.h +++ b/net/mac80211/ieee80211_i.h | |||
@@ -1228,6 +1228,7 @@ struct ieee80211_csa_ie { | |||
1228 | u8 mode; | 1228 | u8 mode; |
1229 | u8 count; | 1229 | u8 count; |
1230 | u8 ttl; | 1230 | u8 ttl; |
1231 | u16 pre_value; | ||
1231 | }; | 1232 | }; |
1232 | 1233 | ||
1233 | /* Parsed Information Elements */ | 1234 | /* Parsed Information Elements */ |
diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c index ff101ea1d9ae..36c3a4cbcabf 100644 --- a/net/mac80211/iface.c +++ b/net/mac80211/iface.c | |||
@@ -1325,7 +1325,6 @@ static void ieee80211_setup_sdata(struct ieee80211_sub_if_data *sdata, | |||
1325 | sdata->vif.bss_conf.bssid = NULL; | 1325 | sdata->vif.bss_conf.bssid = NULL; |
1326 | break; | 1326 | break; |
1327 | case NL80211_IFTYPE_AP_VLAN: | 1327 | case NL80211_IFTYPE_AP_VLAN: |
1328 | break; | ||
1329 | case NL80211_IFTYPE_P2P_DEVICE: | 1328 | case NL80211_IFTYPE_P2P_DEVICE: |
1330 | sdata->vif.bss_conf.bssid = sdata->vif.addr; | 1329 | sdata->vif.bss_conf.bssid = sdata->vif.addr; |
1331 | break; | 1330 | break; |
diff --git a/net/mac80211/main.c b/net/mac80211/main.c index 21d5d44444d0..7d1c3ac48ed9 100644 --- a/net/mac80211/main.c +++ b/net/mac80211/main.c | |||
@@ -940,6 +940,8 @@ int ieee80211_register_hw(struct ieee80211_hw *hw) | |||
940 | wiphy_debug(local->hw.wiphy, "Failed to initialize wep: %d\n", | 940 | wiphy_debug(local->hw.wiphy, "Failed to initialize wep: %d\n", |
941 | result); | 941 | result); |
942 | 942 | ||
943 | local->hw.conf.flags = IEEE80211_CONF_IDLE; | ||
944 | |||
943 | ieee80211_led_init(local); | 945 | ieee80211_led_init(local); |
944 | 946 | ||
945 | rtnl_lock(); | 947 | rtnl_lock(); |
@@ -1047,6 +1049,7 @@ void ieee80211_unregister_hw(struct ieee80211_hw *hw) | |||
1047 | 1049 | ||
1048 | cancel_work_sync(&local->restart_work); | 1050 | cancel_work_sync(&local->restart_work); |
1049 | cancel_work_sync(&local->reconfig_filter); | 1051 | cancel_work_sync(&local->reconfig_filter); |
1052 | flush_work(&local->sched_scan_stopped_work); | ||
1050 | 1053 | ||
1051 | ieee80211_clear_tx_pending(local); | 1054 | ieee80211_clear_tx_pending(local); |
1052 | rate_control_deinitialize(local); | 1055 | rate_control_deinitialize(local); |
diff --git a/net/mac80211/mesh.c b/net/mac80211/mesh.c index 896fe3bd599e..ba105257d03f 100644 --- a/net/mac80211/mesh.c +++ b/net/mac80211/mesh.c | |||
@@ -943,14 +943,19 @@ ieee80211_mesh_process_chnswitch(struct ieee80211_sub_if_data *sdata, | |||
943 | params.chandef.chan->center_freq); | 943 | params.chandef.chan->center_freq); |
944 | 944 | ||
945 | params.block_tx = csa_ie.mode & WLAN_EID_CHAN_SWITCH_PARAM_TX_RESTRICT; | 945 | params.block_tx = csa_ie.mode & WLAN_EID_CHAN_SWITCH_PARAM_TX_RESTRICT; |
946 | if (beacon) | 946 | if (beacon) { |
947 | ifmsh->chsw_ttl = csa_ie.ttl - 1; | 947 | ifmsh->chsw_ttl = csa_ie.ttl - 1; |
948 | else | 948 | if (ifmsh->pre_value >= csa_ie.pre_value) |
949 | ifmsh->chsw_ttl = 0; | 949 | return false; |
950 | ifmsh->pre_value = csa_ie.pre_value; | ||
951 | } | ||
950 | 952 | ||
951 | if (ifmsh->chsw_ttl > 0) | 953 | if (ifmsh->chsw_ttl < ifmsh->mshcfg.dot11MeshTTL) { |
952 | if (ieee80211_mesh_csa_beacon(sdata, ¶ms, false) < 0) | 954 | if (ieee80211_mesh_csa_beacon(sdata, ¶ms, false) < 0) |
953 | return false; | 955 | return false; |
956 | } else { | ||
957 | return false; | ||
958 | } | ||
954 | 959 | ||
955 | sdata->csa_radar_required = params.radar_required; | 960 | sdata->csa_radar_required = params.radar_required; |
956 | 961 | ||
@@ -1163,7 +1168,6 @@ static int mesh_fwd_csa_frame(struct ieee80211_sub_if_data *sdata, | |||
1163 | offset_ttl = (len < 42) ? 7 : 10; | 1168 | offset_ttl = (len < 42) ? 7 : 10; |
1164 | *(pos + offset_ttl) -= 1; | 1169 | *(pos + offset_ttl) -= 1; |
1165 | *(pos + offset_ttl + 1) &= ~WLAN_EID_CHAN_SWITCH_PARAM_INITIATOR; | 1170 | *(pos + offset_ttl + 1) &= ~WLAN_EID_CHAN_SWITCH_PARAM_INITIATOR; |
1166 | sdata->u.mesh.chsw_ttl = *(pos + offset_ttl); | ||
1167 | 1171 | ||
1168 | memcpy(mgmt_fwd, mgmt, len); | 1172 | memcpy(mgmt_fwd, mgmt, len); |
1169 | eth_broadcast_addr(mgmt_fwd->da); | 1173 | eth_broadcast_addr(mgmt_fwd->da); |
@@ -1182,7 +1186,7 @@ static void mesh_rx_csa_frame(struct ieee80211_sub_if_data *sdata, | |||
1182 | u16 pre_value; | 1186 | u16 pre_value; |
1183 | bool fwd_csa = true; | 1187 | bool fwd_csa = true; |
1184 | size_t baselen; | 1188 | size_t baselen; |
1185 | u8 *pos, ttl; | 1189 | u8 *pos; |
1186 | 1190 | ||
1187 | if (mgmt->u.action.u.measurement.action_code != | 1191 | if (mgmt->u.action.u.measurement.action_code != |
1188 | WLAN_ACTION_SPCT_CHL_SWITCH) | 1192 | WLAN_ACTION_SPCT_CHL_SWITCH) |
@@ -1193,8 +1197,8 @@ static void mesh_rx_csa_frame(struct ieee80211_sub_if_data *sdata, | |||
1193 | u.action.u.chan_switch.variable); | 1197 | u.action.u.chan_switch.variable); |
1194 | ieee802_11_parse_elems(pos, len - baselen, false, &elems); | 1198 | ieee802_11_parse_elems(pos, len - baselen, false, &elems); |
1195 | 1199 | ||
1196 | ttl = elems.mesh_chansw_params_ie->mesh_ttl; | 1200 | ifmsh->chsw_ttl = elems.mesh_chansw_params_ie->mesh_ttl; |
1197 | if (!--ttl) | 1201 | if (!--ifmsh->chsw_ttl) |
1198 | fwd_csa = false; | 1202 | fwd_csa = false; |
1199 | 1203 | ||
1200 | pre_value = le16_to_cpu(elems.mesh_chansw_params_ie->mesh_pre_value); | 1204 | pre_value = le16_to_cpu(elems.mesh_chansw_params_ie->mesh_pre_value); |
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c index d7504ab61a34..b3a3ce316656 100644 --- a/net/mac80211/mlme.c +++ b/net/mac80211/mlme.c | |||
@@ -1910,6 +1910,8 @@ static void ieee80211_mgd_probe_ap(struct ieee80211_sub_if_data *sdata, | |||
1910 | if (ifmgd->flags & IEEE80211_STA_CONNECTION_POLL) | 1910 | if (ifmgd->flags & IEEE80211_STA_CONNECTION_POLL) |
1911 | already = true; | 1911 | already = true; |
1912 | 1912 | ||
1913 | ifmgd->flags |= IEEE80211_STA_CONNECTION_POLL; | ||
1914 | |||
1913 | mutex_unlock(&sdata->local->mtx); | 1915 | mutex_unlock(&sdata->local->mtx); |
1914 | 1916 | ||
1915 | if (already) | 1917 | if (already) |
diff --git a/net/mac80211/rc80211_minstrel_ht.c b/net/mac80211/rc80211_minstrel_ht.c index 5d60779a0c1b..4096ff6cc24f 100644 --- a/net/mac80211/rc80211_minstrel_ht.c +++ b/net/mac80211/rc80211_minstrel_ht.c | |||
@@ -226,7 +226,7 @@ minstrel_ht_calc_tp(struct minstrel_ht_sta *mi, int group, int rate) | |||
226 | nsecs = 1000 * mi->overhead / MINSTREL_TRUNC(mi->avg_ampdu_len); | 226 | nsecs = 1000 * mi->overhead / MINSTREL_TRUNC(mi->avg_ampdu_len); |
227 | 227 | ||
228 | nsecs += minstrel_mcs_groups[group].duration[rate]; | 228 | nsecs += minstrel_mcs_groups[group].duration[rate]; |
229 | tp = 1000000 * ((mr->probability * 1000) / nsecs); | 229 | tp = 1000000 * ((prob * 1000) / nsecs); |
230 | 230 | ||
231 | mr->cur_tp = MINSTREL_TRUNC(tp); | 231 | mr->cur_tp = MINSTREL_TRUNC(tp); |
232 | } | 232 | } |
@@ -277,13 +277,15 @@ minstrel_ht_update_stats(struct minstrel_priv *mp, struct minstrel_ht_sta *mi) | |||
277 | if (!(mg->supported & BIT(i))) | 277 | if (!(mg->supported & BIT(i))) |
278 | continue; | 278 | continue; |
279 | 279 | ||
280 | index = MCS_GROUP_RATES * group + i; | ||
281 | |||
280 | /* initialize rates selections starting indexes */ | 282 | /* initialize rates selections starting indexes */ |
281 | if (!mg_rates_valid) { | 283 | if (!mg_rates_valid) { |
282 | mg->max_tp_rate = mg->max_tp_rate2 = | 284 | mg->max_tp_rate = mg->max_tp_rate2 = |
283 | mg->max_prob_rate = i; | 285 | mg->max_prob_rate = i; |
284 | if (!mi_rates_valid) { | 286 | if (!mi_rates_valid) { |
285 | mi->max_tp_rate = mi->max_tp_rate2 = | 287 | mi->max_tp_rate = mi->max_tp_rate2 = |
286 | mi->max_prob_rate = i; | 288 | mi->max_prob_rate = index; |
287 | mi_rates_valid = true; | 289 | mi_rates_valid = true; |
288 | } | 290 | } |
289 | mg_rates_valid = true; | 291 | mg_rates_valid = true; |
@@ -291,7 +293,6 @@ minstrel_ht_update_stats(struct minstrel_priv *mp, struct minstrel_ht_sta *mi) | |||
291 | 293 | ||
292 | mr = &mg->rates[i]; | 294 | mr = &mg->rates[i]; |
293 | mr->retry_updated = false; | 295 | mr->retry_updated = false; |
294 | index = MCS_GROUP_RATES * group + i; | ||
295 | minstrel_calc_rate_ewma(mr); | 296 | minstrel_calc_rate_ewma(mr); |
296 | minstrel_ht_calc_tp(mi, group, i); | 297 | minstrel_ht_calc_tp(mi, group, i); |
297 | 298 | ||
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c index caecef870c0e..2b0debb0422b 100644 --- a/net/mac80211/rx.c +++ b/net/mac80211/rx.c | |||
@@ -911,7 +911,8 @@ static void ieee80211_rx_reorder_ampdu(struct ieee80211_rx_data *rx, | |||
911 | u16 sc; | 911 | u16 sc; |
912 | u8 tid, ack_policy; | 912 | u8 tid, ack_policy; |
913 | 913 | ||
914 | if (!ieee80211_is_data_qos(hdr->frame_control)) | 914 | if (!ieee80211_is_data_qos(hdr->frame_control) || |
915 | is_multicast_ether_addr(hdr->addr1)) | ||
915 | goto dont_reorder; | 916 | goto dont_reorder; |
916 | 917 | ||
917 | /* | 918 | /* |
diff --git a/net/mac80211/scan.c b/net/mac80211/scan.c index 5ad66a83ef7f..bcc4833d7542 100644 --- a/net/mac80211/scan.c +++ b/net/mac80211/scan.c | |||
@@ -1088,6 +1088,6 @@ void ieee80211_sched_scan_stopped(struct ieee80211_hw *hw) | |||
1088 | 1088 | ||
1089 | trace_api_sched_scan_stopped(local); | 1089 | trace_api_sched_scan_stopped(local); |
1090 | 1090 | ||
1091 | ieee80211_queue_work(&local->hw, &local->sched_scan_stopped_work); | 1091 | schedule_work(&local->sched_scan_stopped_work); |
1092 | } | 1092 | } |
1093 | EXPORT_SYMBOL(ieee80211_sched_scan_stopped); | 1093 | EXPORT_SYMBOL(ieee80211_sched_scan_stopped); |
diff --git a/net/mac80211/spectmgmt.c b/net/mac80211/spectmgmt.c index a40da20b32e0..6ab009070084 100644 --- a/net/mac80211/spectmgmt.c +++ b/net/mac80211/spectmgmt.c | |||
@@ -78,6 +78,8 @@ int ieee80211_parse_ch_switch_ie(struct ieee80211_sub_if_data *sdata, | |||
78 | if (elems->mesh_chansw_params_ie) { | 78 | if (elems->mesh_chansw_params_ie) { |
79 | csa_ie->ttl = elems->mesh_chansw_params_ie->mesh_ttl; | 79 | csa_ie->ttl = elems->mesh_chansw_params_ie->mesh_ttl; |
80 | csa_ie->mode = elems->mesh_chansw_params_ie->mesh_flags; | 80 | csa_ie->mode = elems->mesh_chansw_params_ie->mesh_flags; |
81 | csa_ie->pre_value = le16_to_cpu( | ||
82 | elems->mesh_chansw_params_ie->mesh_pre_value); | ||
81 | } | 83 | } |
82 | 84 | ||
83 | new_freq = ieee80211_channel_to_frequency(new_chan_no, new_band); | 85 | new_freq = ieee80211_channel_to_frequency(new_chan_no, new_band); |
diff --git a/net/mac80211/util.c b/net/mac80211/util.c index 592a18171f95..9f9b9bd3fd44 100644 --- a/net/mac80211/util.c +++ b/net/mac80211/util.c | |||
@@ -2278,17 +2278,15 @@ void ieee80211_dfs_radar_detected_work(struct work_struct *work) | |||
2278 | { | 2278 | { |
2279 | struct ieee80211_local *local = | 2279 | struct ieee80211_local *local = |
2280 | container_of(work, struct ieee80211_local, radar_detected_work); | 2280 | container_of(work, struct ieee80211_local, radar_detected_work); |
2281 | struct cfg80211_chan_def chandef; | 2281 | struct cfg80211_chan_def chandef = local->hw.conf.chandef; |
2282 | 2282 | ||
2283 | ieee80211_dfs_cac_cancel(local); | 2283 | ieee80211_dfs_cac_cancel(local); |
2284 | 2284 | ||
2285 | if (local->use_chanctx) | 2285 | if (local->use_chanctx) |
2286 | /* currently not handled */ | 2286 | /* currently not handled */ |
2287 | WARN_ON(1); | 2287 | WARN_ON(1); |
2288 | else { | 2288 | else |
2289 | chandef = local->hw.conf.chandef; | ||
2290 | cfg80211_radar_event(local->hw.wiphy, &chandef, GFP_KERNEL); | 2289 | cfg80211_radar_event(local->hw.wiphy, &chandef, GFP_KERNEL); |
2291 | } | ||
2292 | } | 2290 | } |
2293 | 2291 | ||
2294 | void ieee80211_radar_detected(struct ieee80211_hw *hw) | 2292 | void ieee80211_radar_detected(struct ieee80211_hw *hw) |
@@ -2459,14 +2457,9 @@ int ieee80211_send_action_csa(struct ieee80211_sub_if_data *sdata, | |||
2459 | WLAN_EID_CHAN_SWITCH_PARAM_TX_RESTRICT : 0x00; | 2457 | WLAN_EID_CHAN_SWITCH_PARAM_TX_RESTRICT : 0x00; |
2460 | put_unaligned_le16(WLAN_REASON_MESH_CHAN, pos); /* Reason Cd */ | 2458 | put_unaligned_le16(WLAN_REASON_MESH_CHAN, pos); /* Reason Cd */ |
2461 | pos += 2; | 2459 | pos += 2; |
2462 | if (!ifmsh->pre_value) | ||
2463 | ifmsh->pre_value = 1; | ||
2464 | else | ||
2465 | ifmsh->pre_value++; | ||
2466 | pre_value = cpu_to_le16(ifmsh->pre_value); | 2460 | pre_value = cpu_to_le16(ifmsh->pre_value); |
2467 | memcpy(pos, &pre_value, 2); /* Precedence Value */ | 2461 | memcpy(pos, &pre_value, 2); /* Precedence Value */ |
2468 | pos += 2; | 2462 | pos += 2; |
2469 | ifmsh->chsw_init = true; | ||
2470 | } | 2463 | } |
2471 | 2464 | ||
2472 | ieee80211_tx_skb(sdata, skb); | 2465 | ieee80211_tx_skb(sdata, skb); |
diff --git a/net/netfilter/ipset/ip_set_hash_netnet.c b/net/netfilter/ipset/ip_set_hash_netnet.c index 2bc2dec20b00..6226803fc490 100644 --- a/net/netfilter/ipset/ip_set_hash_netnet.c +++ b/net/netfilter/ipset/ip_set_hash_netnet.c | |||
@@ -59,7 +59,7 @@ hash_netnet4_data_equal(const struct hash_netnet4_elem *ip1, | |||
59 | u32 *multi) | 59 | u32 *multi) |
60 | { | 60 | { |
61 | return ip1->ipcmp == ip2->ipcmp && | 61 | return ip1->ipcmp == ip2->ipcmp && |
62 | ip2->ccmp == ip2->ccmp; | 62 | ip1->ccmp == ip2->ccmp; |
63 | } | 63 | } |
64 | 64 | ||
65 | static inline int | 65 | static inline int |
diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c index dcddc49c0e08..f93b7d06f4be 100644 --- a/net/netfilter/nf_tables_api.c +++ b/net/netfilter/nf_tables_api.c | |||
@@ -1717,6 +1717,19 @@ nf_tables_delrule_one(struct nft_ctx *ctx, struct nft_rule *rule) | |||
1717 | return -ENOENT; | 1717 | return -ENOENT; |
1718 | } | 1718 | } |
1719 | 1719 | ||
1720 | static int nf_table_delrule_by_chain(struct nft_ctx *ctx) | ||
1721 | { | ||
1722 | struct nft_rule *rule; | ||
1723 | int err; | ||
1724 | |||
1725 | list_for_each_entry(rule, &ctx->chain->rules, list) { | ||
1726 | err = nf_tables_delrule_one(ctx, rule); | ||
1727 | if (err < 0) | ||
1728 | return err; | ||
1729 | } | ||
1730 | return 0; | ||
1731 | } | ||
1732 | |||
1720 | static int nf_tables_delrule(struct sock *nlsk, struct sk_buff *skb, | 1733 | static int nf_tables_delrule(struct sock *nlsk, struct sk_buff *skb, |
1721 | const struct nlmsghdr *nlh, | 1734 | const struct nlmsghdr *nlh, |
1722 | const struct nlattr * const nla[]) | 1735 | const struct nlattr * const nla[]) |
@@ -1725,8 +1738,8 @@ static int nf_tables_delrule(struct sock *nlsk, struct sk_buff *skb, | |||
1725 | const struct nft_af_info *afi; | 1738 | const struct nft_af_info *afi; |
1726 | struct net *net = sock_net(skb->sk); | 1739 | struct net *net = sock_net(skb->sk); |
1727 | const struct nft_table *table; | 1740 | const struct nft_table *table; |
1728 | struct nft_chain *chain; | 1741 | struct nft_chain *chain = NULL; |
1729 | struct nft_rule *rule, *tmp; | 1742 | struct nft_rule *rule; |
1730 | int family = nfmsg->nfgen_family, err = 0; | 1743 | int family = nfmsg->nfgen_family, err = 0; |
1731 | struct nft_ctx ctx; | 1744 | struct nft_ctx ctx; |
1732 | 1745 | ||
@@ -1738,22 +1751,29 @@ static int nf_tables_delrule(struct sock *nlsk, struct sk_buff *skb, | |||
1738 | if (IS_ERR(table)) | 1751 | if (IS_ERR(table)) |
1739 | return PTR_ERR(table); | 1752 | return PTR_ERR(table); |
1740 | 1753 | ||
1741 | chain = nf_tables_chain_lookup(table, nla[NFTA_RULE_CHAIN]); | 1754 | if (nla[NFTA_RULE_CHAIN]) { |
1742 | if (IS_ERR(chain)) | 1755 | chain = nf_tables_chain_lookup(table, nla[NFTA_RULE_CHAIN]); |
1743 | return PTR_ERR(chain); | 1756 | if (IS_ERR(chain)) |
1757 | return PTR_ERR(chain); | ||
1758 | } | ||
1744 | 1759 | ||
1745 | nft_ctx_init(&ctx, skb, nlh, afi, table, chain, nla); | 1760 | nft_ctx_init(&ctx, skb, nlh, afi, table, chain, nla); |
1746 | 1761 | ||
1747 | if (nla[NFTA_RULE_HANDLE]) { | 1762 | if (chain) { |
1748 | rule = nf_tables_rule_lookup(chain, nla[NFTA_RULE_HANDLE]); | 1763 | if (nla[NFTA_RULE_HANDLE]) { |
1749 | if (IS_ERR(rule)) | 1764 | rule = nf_tables_rule_lookup(chain, |
1750 | return PTR_ERR(rule); | 1765 | nla[NFTA_RULE_HANDLE]); |
1766 | if (IS_ERR(rule)) | ||
1767 | return PTR_ERR(rule); | ||
1751 | 1768 | ||
1752 | err = nf_tables_delrule_one(&ctx, rule); | ||
1753 | } else { | ||
1754 | /* Remove all rules in this chain */ | ||
1755 | list_for_each_entry_safe(rule, tmp, &chain->rules, list) { | ||
1756 | err = nf_tables_delrule_one(&ctx, rule); | 1769 | err = nf_tables_delrule_one(&ctx, rule); |
1770 | } else { | ||
1771 | err = nf_table_delrule_by_chain(&ctx); | ||
1772 | } | ||
1773 | } else { | ||
1774 | list_for_each_entry(chain, &table->chains, list) { | ||
1775 | ctx.chain = chain; | ||
1776 | err = nf_table_delrule_by_chain(&ctx); | ||
1757 | if (err < 0) | 1777 | if (err < 0) |
1758 | break; | 1778 | break; |
1759 | } | 1779 | } |
diff --git a/net/netfilter/xt_hashlimit.c b/net/netfilter/xt_hashlimit.c index 9ff035c71403..a3910fc2122b 100644 --- a/net/netfilter/xt_hashlimit.c +++ b/net/netfilter/xt_hashlimit.c | |||
@@ -325,21 +325,24 @@ static void htable_gc(unsigned long htlong) | |||
325 | add_timer(&ht->timer); | 325 | add_timer(&ht->timer); |
326 | } | 326 | } |
327 | 327 | ||
328 | static void htable_destroy(struct xt_hashlimit_htable *hinfo) | 328 | static void htable_remove_proc_entry(struct xt_hashlimit_htable *hinfo) |
329 | { | 329 | { |
330 | struct hashlimit_net *hashlimit_net = hashlimit_pernet(hinfo->net); | 330 | struct hashlimit_net *hashlimit_net = hashlimit_pernet(hinfo->net); |
331 | struct proc_dir_entry *parent; | 331 | struct proc_dir_entry *parent; |
332 | 332 | ||
333 | del_timer_sync(&hinfo->timer); | ||
334 | |||
335 | if (hinfo->family == NFPROTO_IPV4) | 333 | if (hinfo->family == NFPROTO_IPV4) |
336 | parent = hashlimit_net->ipt_hashlimit; | 334 | parent = hashlimit_net->ipt_hashlimit; |
337 | else | 335 | else |
338 | parent = hashlimit_net->ip6t_hashlimit; | 336 | parent = hashlimit_net->ip6t_hashlimit; |
339 | 337 | ||
340 | if(parent != NULL) | 338 | if (parent != NULL) |
341 | remove_proc_entry(hinfo->name, parent); | 339 | remove_proc_entry(hinfo->name, parent); |
340 | } | ||
342 | 341 | ||
342 | static void htable_destroy(struct xt_hashlimit_htable *hinfo) | ||
343 | { | ||
344 | del_timer_sync(&hinfo->timer); | ||
345 | htable_remove_proc_entry(hinfo); | ||
343 | htable_selective_cleanup(hinfo, select_all); | 346 | htable_selective_cleanup(hinfo, select_all); |
344 | kfree(hinfo->name); | 347 | kfree(hinfo->name); |
345 | vfree(hinfo); | 348 | vfree(hinfo); |
@@ -883,21 +886,15 @@ static int __net_init hashlimit_proc_net_init(struct net *net) | |||
883 | static void __net_exit hashlimit_proc_net_exit(struct net *net) | 886 | static void __net_exit hashlimit_proc_net_exit(struct net *net) |
884 | { | 887 | { |
885 | struct xt_hashlimit_htable *hinfo; | 888 | struct xt_hashlimit_htable *hinfo; |
886 | struct proc_dir_entry *pde; | ||
887 | struct hashlimit_net *hashlimit_net = hashlimit_pernet(net); | 889 | struct hashlimit_net *hashlimit_net = hashlimit_pernet(net); |
888 | 890 | ||
889 | /* recent_net_exit() is called before recent_mt_destroy(). Make sure | 891 | /* hashlimit_net_exit() is called before hashlimit_mt_destroy(). |
890 | * that the parent xt_recent proc entry is is empty before trying to | 892 | * Make sure that the parent ipt_hashlimit and ip6t_hashlimit proc |
891 | * remove it. | 893 | * entries is empty before trying to remove it. |
892 | */ | 894 | */ |
893 | mutex_lock(&hashlimit_mutex); | 895 | mutex_lock(&hashlimit_mutex); |
894 | pde = hashlimit_net->ipt_hashlimit; | ||
895 | if (pde == NULL) | ||
896 | pde = hashlimit_net->ip6t_hashlimit; | ||
897 | |||
898 | hlist_for_each_entry(hinfo, &hashlimit_net->htables, node) | 896 | hlist_for_each_entry(hinfo, &hashlimit_net->htables, node) |
899 | remove_proc_entry(hinfo->name, pde); | 897 | htable_remove_proc_entry(hinfo); |
900 | |||
901 | hashlimit_net->ipt_hashlimit = NULL; | 898 | hashlimit_net->ipt_hashlimit = NULL; |
902 | hashlimit_net->ip6t_hashlimit = NULL; | 899 | hashlimit_net->ip6t_hashlimit = NULL; |
903 | mutex_unlock(&hashlimit_mutex); | 900 | mutex_unlock(&hashlimit_mutex); |
diff --git a/net/netlink/genetlink.c b/net/netlink/genetlink.c index 4518a57aa5fe..713671ae45af 100644 --- a/net/netlink/genetlink.c +++ b/net/netlink/genetlink.c | |||
@@ -74,9 +74,12 @@ static struct list_head family_ht[GENL_FAM_TAB_SIZE]; | |||
74 | * Bit 17 is marked as already used since the VFS quota code | 74 | * Bit 17 is marked as already used since the VFS quota code |
75 | * also abused this API and relied on family == group ID, we | 75 | * also abused this API and relied on family == group ID, we |
76 | * cater to that by giving it a static family and group ID. | 76 | * cater to that by giving it a static family and group ID. |
77 | * Bit 18 is marked as already used since the PMCRAID driver | ||
78 | * did the same thing as the VFS quota code (maybe copied?) | ||
77 | */ | 79 | */ |
78 | static unsigned long mc_group_start = 0x3 | BIT(GENL_ID_CTRL) | | 80 | static unsigned long mc_group_start = 0x3 | BIT(GENL_ID_CTRL) | |
79 | BIT(GENL_ID_VFS_DQUOT); | 81 | BIT(GENL_ID_VFS_DQUOT) | |
82 | BIT(GENL_ID_PMCRAID); | ||
80 | static unsigned long *mc_groups = &mc_group_start; | 83 | static unsigned long *mc_groups = &mc_group_start; |
81 | static unsigned long mc_groups_longs = 1; | 84 | static unsigned long mc_groups_longs = 1; |
82 | 85 | ||
@@ -139,6 +142,7 @@ static u16 genl_generate_id(void) | |||
139 | 142 | ||
140 | for (i = 0; i <= GENL_MAX_ID - GENL_MIN_ID; i++) { | 143 | for (i = 0; i <= GENL_MAX_ID - GENL_MIN_ID; i++) { |
141 | if (id_gen_idx != GENL_ID_VFS_DQUOT && | 144 | if (id_gen_idx != GENL_ID_VFS_DQUOT && |
145 | id_gen_idx != GENL_ID_PMCRAID && | ||
142 | !genl_family_find_byid(id_gen_idx)) | 146 | !genl_family_find_byid(id_gen_idx)) |
143 | return id_gen_idx; | 147 | return id_gen_idx; |
144 | if (++id_gen_idx > GENL_MAX_ID) | 148 | if (++id_gen_idx > GENL_MAX_ID) |
@@ -214,7 +218,7 @@ static int genl_validate_assign_mc_groups(struct genl_family *family) | |||
214 | { | 218 | { |
215 | int first_id; | 219 | int first_id; |
216 | int n_groups = family->n_mcgrps; | 220 | int n_groups = family->n_mcgrps; |
217 | int err, i; | 221 | int err = 0, i; |
218 | bool groups_allocated = false; | 222 | bool groups_allocated = false; |
219 | 223 | ||
220 | if (!n_groups) | 224 | if (!n_groups) |
@@ -236,9 +240,12 @@ static int genl_validate_assign_mc_groups(struct genl_family *family) | |||
236 | } else if (strcmp(family->name, "NET_DM") == 0) { | 240 | } else if (strcmp(family->name, "NET_DM") == 0) { |
237 | first_id = 1; | 241 | first_id = 1; |
238 | BUG_ON(n_groups != 1); | 242 | BUG_ON(n_groups != 1); |
239 | } else if (strcmp(family->name, "VFS_DQUOT") == 0) { | 243 | } else if (family->id == GENL_ID_VFS_DQUOT) { |
240 | first_id = GENL_ID_VFS_DQUOT; | 244 | first_id = GENL_ID_VFS_DQUOT; |
241 | BUG_ON(n_groups != 1); | 245 | BUG_ON(n_groups != 1); |
246 | } else if (family->id == GENL_ID_PMCRAID) { | ||
247 | first_id = GENL_ID_PMCRAID; | ||
248 | BUG_ON(n_groups != 1); | ||
242 | } else { | 249 | } else { |
243 | groups_allocated = true; | 250 | groups_allocated = true; |
244 | err = genl_allocate_reserve_groups(n_groups, &first_id); | 251 | err = genl_allocate_reserve_groups(n_groups, &first_id); |
diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c index ac27c86ef6d1..88cfbc189558 100644 --- a/net/packet/af_packet.c +++ b/net/packet/af_packet.c | |||
@@ -237,6 +237,30 @@ struct packet_skb_cb { | |||
237 | static void __fanout_unlink(struct sock *sk, struct packet_sock *po); | 237 | static void __fanout_unlink(struct sock *sk, struct packet_sock *po); |
238 | static void __fanout_link(struct sock *sk, struct packet_sock *po); | 238 | static void __fanout_link(struct sock *sk, struct packet_sock *po); |
239 | 239 | ||
240 | static struct net_device *packet_cached_dev_get(struct packet_sock *po) | ||
241 | { | ||
242 | struct net_device *dev; | ||
243 | |||
244 | rcu_read_lock(); | ||
245 | dev = rcu_dereference(po->cached_dev); | ||
246 | if (likely(dev)) | ||
247 | dev_hold(dev); | ||
248 | rcu_read_unlock(); | ||
249 | |||
250 | return dev; | ||
251 | } | ||
252 | |||
253 | static void packet_cached_dev_assign(struct packet_sock *po, | ||
254 | struct net_device *dev) | ||
255 | { | ||
256 | rcu_assign_pointer(po->cached_dev, dev); | ||
257 | } | ||
258 | |||
259 | static void packet_cached_dev_reset(struct packet_sock *po) | ||
260 | { | ||
261 | RCU_INIT_POINTER(po->cached_dev, NULL); | ||
262 | } | ||
263 | |||
240 | /* register_prot_hook must be invoked with the po->bind_lock held, | 264 | /* register_prot_hook must be invoked with the po->bind_lock held, |
241 | * or from a context in which asynchronous accesses to the packet | 265 | * or from a context in which asynchronous accesses to the packet |
242 | * socket is not possible (packet_create()). | 266 | * socket is not possible (packet_create()). |
@@ -246,12 +270,10 @@ static void register_prot_hook(struct sock *sk) | |||
246 | struct packet_sock *po = pkt_sk(sk); | 270 | struct packet_sock *po = pkt_sk(sk); |
247 | 271 | ||
248 | if (!po->running) { | 272 | if (!po->running) { |
249 | if (po->fanout) { | 273 | if (po->fanout) |
250 | __fanout_link(sk, po); | 274 | __fanout_link(sk, po); |
251 | } else { | 275 | else |
252 | dev_add_pack(&po->prot_hook); | 276 | dev_add_pack(&po->prot_hook); |
253 | rcu_assign_pointer(po->cached_dev, po->prot_hook.dev); | ||
254 | } | ||
255 | 277 | ||
256 | sock_hold(sk); | 278 | sock_hold(sk); |
257 | po->running = 1; | 279 | po->running = 1; |
@@ -270,12 +292,11 @@ static void __unregister_prot_hook(struct sock *sk, bool sync) | |||
270 | struct packet_sock *po = pkt_sk(sk); | 292 | struct packet_sock *po = pkt_sk(sk); |
271 | 293 | ||
272 | po->running = 0; | 294 | po->running = 0; |
273 | if (po->fanout) { | 295 | |
296 | if (po->fanout) | ||
274 | __fanout_unlink(sk, po); | 297 | __fanout_unlink(sk, po); |
275 | } else { | 298 | else |
276 | __dev_remove_pack(&po->prot_hook); | 299 | __dev_remove_pack(&po->prot_hook); |
277 | RCU_INIT_POINTER(po->cached_dev, NULL); | ||
278 | } | ||
279 | 300 | ||
280 | __sock_put(sk); | 301 | __sock_put(sk); |
281 | 302 | ||
@@ -439,9 +460,9 @@ static void prb_shutdown_retire_blk_timer(struct packet_sock *po, | |||
439 | 460 | ||
440 | pkc = tx_ring ? &po->tx_ring.prb_bdqc : &po->rx_ring.prb_bdqc; | 461 | pkc = tx_ring ? &po->tx_ring.prb_bdqc : &po->rx_ring.prb_bdqc; |
441 | 462 | ||
442 | spin_lock(&rb_queue->lock); | 463 | spin_lock_bh(&rb_queue->lock); |
443 | pkc->delete_blk_timer = 1; | 464 | pkc->delete_blk_timer = 1; |
444 | spin_unlock(&rb_queue->lock); | 465 | spin_unlock_bh(&rb_queue->lock); |
445 | 466 | ||
446 | prb_del_retire_blk_timer(pkc); | 467 | prb_del_retire_blk_timer(pkc); |
447 | } | 468 | } |
@@ -2059,19 +2080,6 @@ static int tpacket_fill_skb(struct packet_sock *po, struct sk_buff *skb, | |||
2059 | return tp_len; | 2080 | return tp_len; |
2060 | } | 2081 | } |
2061 | 2082 | ||
2062 | static struct net_device *packet_cached_dev_get(struct packet_sock *po) | ||
2063 | { | ||
2064 | struct net_device *dev; | ||
2065 | |||
2066 | rcu_read_lock(); | ||
2067 | dev = rcu_dereference(po->cached_dev); | ||
2068 | if (dev) | ||
2069 | dev_hold(dev); | ||
2070 | rcu_read_unlock(); | ||
2071 | |||
2072 | return dev; | ||
2073 | } | ||
2074 | |||
2075 | static int tpacket_snd(struct packet_sock *po, struct msghdr *msg) | 2083 | static int tpacket_snd(struct packet_sock *po, struct msghdr *msg) |
2076 | { | 2084 | { |
2077 | struct sk_buff *skb; | 2085 | struct sk_buff *skb; |
@@ -2088,7 +2096,7 @@ static int tpacket_snd(struct packet_sock *po, struct msghdr *msg) | |||
2088 | 2096 | ||
2089 | mutex_lock(&po->pg_vec_lock); | 2097 | mutex_lock(&po->pg_vec_lock); |
2090 | 2098 | ||
2091 | if (saddr == NULL) { | 2099 | if (likely(saddr == NULL)) { |
2092 | dev = packet_cached_dev_get(po); | 2100 | dev = packet_cached_dev_get(po); |
2093 | proto = po->num; | 2101 | proto = po->num; |
2094 | addr = NULL; | 2102 | addr = NULL; |
@@ -2242,7 +2250,7 @@ static int packet_snd(struct socket *sock, | |||
2242 | * Get and verify the address. | 2250 | * Get and verify the address. |
2243 | */ | 2251 | */ |
2244 | 2252 | ||
2245 | if (saddr == NULL) { | 2253 | if (likely(saddr == NULL)) { |
2246 | dev = packet_cached_dev_get(po); | 2254 | dev = packet_cached_dev_get(po); |
2247 | proto = po->num; | 2255 | proto = po->num; |
2248 | addr = NULL; | 2256 | addr = NULL; |
@@ -2451,6 +2459,8 @@ static int packet_release(struct socket *sock) | |||
2451 | 2459 | ||
2452 | spin_lock(&po->bind_lock); | 2460 | spin_lock(&po->bind_lock); |
2453 | unregister_prot_hook(sk, false); | 2461 | unregister_prot_hook(sk, false); |
2462 | packet_cached_dev_reset(po); | ||
2463 | |||
2454 | if (po->prot_hook.dev) { | 2464 | if (po->prot_hook.dev) { |
2455 | dev_put(po->prot_hook.dev); | 2465 | dev_put(po->prot_hook.dev); |
2456 | po->prot_hook.dev = NULL; | 2466 | po->prot_hook.dev = NULL; |
@@ -2506,14 +2516,17 @@ static int packet_do_bind(struct sock *sk, struct net_device *dev, __be16 protoc | |||
2506 | 2516 | ||
2507 | spin_lock(&po->bind_lock); | 2517 | spin_lock(&po->bind_lock); |
2508 | unregister_prot_hook(sk, true); | 2518 | unregister_prot_hook(sk, true); |
2519 | |||
2509 | po->num = protocol; | 2520 | po->num = protocol; |
2510 | po->prot_hook.type = protocol; | 2521 | po->prot_hook.type = protocol; |
2511 | if (po->prot_hook.dev) | 2522 | if (po->prot_hook.dev) |
2512 | dev_put(po->prot_hook.dev); | 2523 | dev_put(po->prot_hook.dev); |
2513 | po->prot_hook.dev = dev; | ||
2514 | 2524 | ||
2525 | po->prot_hook.dev = dev; | ||
2515 | po->ifindex = dev ? dev->ifindex : 0; | 2526 | po->ifindex = dev ? dev->ifindex : 0; |
2516 | 2527 | ||
2528 | packet_cached_dev_assign(po, dev); | ||
2529 | |||
2517 | if (protocol == 0) | 2530 | if (protocol == 0) |
2518 | goto out_unlock; | 2531 | goto out_unlock; |
2519 | 2532 | ||
@@ -2626,7 +2639,8 @@ static int packet_create(struct net *net, struct socket *sock, int protocol, | |||
2626 | po = pkt_sk(sk); | 2639 | po = pkt_sk(sk); |
2627 | sk->sk_family = PF_PACKET; | 2640 | sk->sk_family = PF_PACKET; |
2628 | po->num = proto; | 2641 | po->num = proto; |
2629 | RCU_INIT_POINTER(po->cached_dev, NULL); | 2642 | |
2643 | packet_cached_dev_reset(po); | ||
2630 | 2644 | ||
2631 | sk->sk_destruct = packet_sock_destruct; | 2645 | sk->sk_destruct = packet_sock_destruct; |
2632 | sk_refcnt_debug_inc(sk); | 2646 | sk_refcnt_debug_inc(sk); |
@@ -3337,6 +3351,7 @@ static int packet_notifier(struct notifier_block *this, | |||
3337 | sk->sk_error_report(sk); | 3351 | sk->sk_error_report(sk); |
3338 | } | 3352 | } |
3339 | if (msg == NETDEV_UNREGISTER) { | 3353 | if (msg == NETDEV_UNREGISTER) { |
3354 | packet_cached_dev_reset(po); | ||
3340 | po->ifindex = -1; | 3355 | po->ifindex = -1; |
3341 | if (po->prot_hook.dev) | 3356 | if (po->prot_hook.dev) |
3342 | dev_put(po->prot_hook.dev); | 3357 | dev_put(po->prot_hook.dev); |
diff --git a/net/rds/ib_send.c b/net/rds/ib_send.c index e59094981175..37be6e226d1b 100644 --- a/net/rds/ib_send.c +++ b/net/rds/ib_send.c | |||
@@ -552,9 +552,8 @@ int rds_ib_xmit(struct rds_connection *conn, struct rds_message *rm, | |||
552 | && rm->m_inc.i_hdr.h_flags & RDS_FLAG_CONG_BITMAP) { | 552 | && rm->m_inc.i_hdr.h_flags & RDS_FLAG_CONG_BITMAP) { |
553 | rds_cong_map_updated(conn->c_fcong, ~(u64) 0); | 553 | rds_cong_map_updated(conn->c_fcong, ~(u64) 0); |
554 | scat = &rm->data.op_sg[sg]; | 554 | scat = &rm->data.op_sg[sg]; |
555 | ret = sizeof(struct rds_header) + RDS_CONG_MAP_BYTES; | 555 | ret = max_t(int, RDS_CONG_MAP_BYTES, scat->length); |
556 | ret = min_t(int, ret, scat->length - conn->c_xmit_data_off); | 556 | return sizeof(struct rds_header) + ret; |
557 | return ret; | ||
558 | } | 557 | } |
559 | 558 | ||
560 | /* FIXME we may overallocate here */ | 559 | /* FIXME we may overallocate here */ |
diff --git a/net/sched/act_api.c b/net/sched/act_api.c index fd7072827a40..69cb848e8345 100644 --- a/net/sched/act_api.c +++ b/net/sched/act_api.c | |||
@@ -270,6 +270,16 @@ int tcf_register_action(struct tc_action_ops *act) | |||
270 | { | 270 | { |
271 | struct tc_action_ops *a, **ap; | 271 | struct tc_action_ops *a, **ap; |
272 | 272 | ||
273 | /* Must supply act, dump, cleanup and init */ | ||
274 | if (!act->act || !act->dump || !act->cleanup || !act->init) | ||
275 | return -EINVAL; | ||
276 | |||
277 | /* Supply defaults */ | ||
278 | if (!act->lookup) | ||
279 | act->lookup = tcf_hash_search; | ||
280 | if (!act->walk) | ||
281 | act->walk = tcf_generic_walker; | ||
282 | |||
273 | write_lock(&act_mod_lock); | 283 | write_lock(&act_mod_lock); |
274 | for (ap = &act_base; (a = *ap) != NULL; ap = &a->next) { | 284 | for (ap = &act_base; (a = *ap) != NULL; ap = &a->next) { |
275 | if (act->type == a->type || (strcmp(act->kind, a->kind) == 0)) { | 285 | if (act->type == a->type || (strcmp(act->kind, a->kind) == 0)) { |
@@ -381,7 +391,7 @@ int tcf_action_exec(struct sk_buff *skb, const struct tc_action *act, | |||
381 | } | 391 | } |
382 | while ((a = act) != NULL) { | 392 | while ((a = act) != NULL) { |
383 | repeat: | 393 | repeat: |
384 | if (a->ops && a->ops->act) { | 394 | if (a->ops) { |
385 | ret = a->ops->act(skb, a, res); | 395 | ret = a->ops->act(skb, a, res); |
386 | if (TC_MUNGED & skb->tc_verd) { | 396 | if (TC_MUNGED & skb->tc_verd) { |
387 | /* copied already, allow trampling */ | 397 | /* copied already, allow trampling */ |
@@ -405,7 +415,7 @@ void tcf_action_destroy(struct tc_action *act, int bind) | |||
405 | struct tc_action *a; | 415 | struct tc_action *a; |
406 | 416 | ||
407 | for (a = act; a; a = act) { | 417 | for (a = act; a; a = act) { |
408 | if (a->ops && a->ops->cleanup) { | 418 | if (a->ops) { |
409 | if (a->ops->cleanup(a, bind) == ACT_P_DELETED) | 419 | if (a->ops->cleanup(a, bind) == ACT_P_DELETED) |
410 | module_put(a->ops->owner); | 420 | module_put(a->ops->owner); |
411 | act = act->next; | 421 | act = act->next; |
@@ -424,7 +434,7 @@ tcf_action_dump_old(struct sk_buff *skb, struct tc_action *a, int bind, int ref) | |||
424 | { | 434 | { |
425 | int err = -EINVAL; | 435 | int err = -EINVAL; |
426 | 436 | ||
427 | if (a->ops == NULL || a->ops->dump == NULL) | 437 | if (a->ops == NULL) |
428 | return err; | 438 | return err; |
429 | return a->ops->dump(skb, a, bind, ref); | 439 | return a->ops->dump(skb, a, bind, ref); |
430 | } | 440 | } |
@@ -436,7 +446,7 @@ tcf_action_dump_1(struct sk_buff *skb, struct tc_action *a, int bind, int ref) | |||
436 | unsigned char *b = skb_tail_pointer(skb); | 446 | unsigned char *b = skb_tail_pointer(skb); |
437 | struct nlattr *nest; | 447 | struct nlattr *nest; |
438 | 448 | ||
439 | if (a->ops == NULL || a->ops->dump == NULL) | 449 | if (a->ops == NULL) |
440 | return err; | 450 | return err; |
441 | 451 | ||
442 | if (nla_put_string(skb, TCA_KIND, a->ops->kind)) | 452 | if (nla_put_string(skb, TCA_KIND, a->ops->kind)) |
@@ -723,8 +733,6 @@ tcf_action_get_1(struct nlattr *nla, struct nlmsghdr *n, u32 portid) | |||
723 | a->ops = tc_lookup_action(tb[TCA_ACT_KIND]); | 733 | a->ops = tc_lookup_action(tb[TCA_ACT_KIND]); |
724 | if (a->ops == NULL) | 734 | if (a->ops == NULL) |
725 | goto err_free; | 735 | goto err_free; |
726 | if (a->ops->lookup == NULL) | ||
727 | goto err_mod; | ||
728 | err = -ENOENT; | 736 | err = -ENOENT; |
729 | if (a->ops->lookup(a, index) == 0) | 737 | if (a->ops->lookup(a, index) == 0) |
730 | goto err_mod; | 738 | goto err_mod; |
@@ -1084,12 +1092,6 @@ tc_dump_action(struct sk_buff *skb, struct netlink_callback *cb) | |||
1084 | memset(&a, 0, sizeof(struct tc_action)); | 1092 | memset(&a, 0, sizeof(struct tc_action)); |
1085 | a.ops = a_o; | 1093 | a.ops = a_o; |
1086 | 1094 | ||
1087 | if (a_o->walk == NULL) { | ||
1088 | WARN(1, "tc_dump_action: %s !capable of dumping table\n", | ||
1089 | a_o->kind); | ||
1090 | goto out_module_put; | ||
1091 | } | ||
1092 | |||
1093 | nlh = nlmsg_put(skb, NETLINK_CB(cb->skb).portid, cb->nlh->nlmsg_seq, | 1095 | nlh = nlmsg_put(skb, NETLINK_CB(cb->skb).portid, cb->nlh->nlmsg_seq, |
1094 | cb->nlh->nlmsg_type, sizeof(*t), 0); | 1096 | cb->nlh->nlmsg_type, sizeof(*t), 0); |
1095 | if (!nlh) | 1097 | if (!nlh) |
diff --git a/net/sched/act_csum.c b/net/sched/act_csum.c index 3a4c0caa1f7d..5c5edf56adbd 100644 --- a/net/sched/act_csum.c +++ b/net/sched/act_csum.c | |||
@@ -585,9 +585,7 @@ static struct tc_action_ops act_csum_ops = { | |||
585 | .act = tcf_csum, | 585 | .act = tcf_csum, |
586 | .dump = tcf_csum_dump, | 586 | .dump = tcf_csum_dump, |
587 | .cleanup = tcf_csum_cleanup, | 587 | .cleanup = tcf_csum_cleanup, |
588 | .lookup = tcf_hash_search, | ||
589 | .init = tcf_csum_init, | 588 | .init = tcf_csum_init, |
590 | .walk = tcf_generic_walker | ||
591 | }; | 589 | }; |
592 | 590 | ||
593 | MODULE_DESCRIPTION("Checksum updating actions"); | 591 | MODULE_DESCRIPTION("Checksum updating actions"); |
diff --git a/net/sched/act_gact.c b/net/sched/act_gact.c index fd2b3cff5fa2..5645a4d32abd 100644 --- a/net/sched/act_gact.c +++ b/net/sched/act_gact.c | |||
@@ -206,9 +206,7 @@ static struct tc_action_ops act_gact_ops = { | |||
206 | .act = tcf_gact, | 206 | .act = tcf_gact, |
207 | .dump = tcf_gact_dump, | 207 | .dump = tcf_gact_dump, |
208 | .cleanup = tcf_gact_cleanup, | 208 | .cleanup = tcf_gact_cleanup, |
209 | .lookup = tcf_hash_search, | ||
210 | .init = tcf_gact_init, | 209 | .init = tcf_gact_init, |
211 | .walk = tcf_generic_walker | ||
212 | }; | 210 | }; |
213 | 211 | ||
214 | MODULE_AUTHOR("Jamal Hadi Salim(2002-4)"); | 212 | MODULE_AUTHOR("Jamal Hadi Salim(2002-4)"); |
diff --git a/net/sched/act_ipt.c b/net/sched/act_ipt.c index 60d88b6b9560..882a89762f77 100644 --- a/net/sched/act_ipt.c +++ b/net/sched/act_ipt.c | |||
@@ -298,9 +298,7 @@ static struct tc_action_ops act_ipt_ops = { | |||
298 | .act = tcf_ipt, | 298 | .act = tcf_ipt, |
299 | .dump = tcf_ipt_dump, | 299 | .dump = tcf_ipt_dump, |
300 | .cleanup = tcf_ipt_cleanup, | 300 | .cleanup = tcf_ipt_cleanup, |
301 | .lookup = tcf_hash_search, | ||
302 | .init = tcf_ipt_init, | 301 | .init = tcf_ipt_init, |
303 | .walk = tcf_generic_walker | ||
304 | }; | 302 | }; |
305 | 303 | ||
306 | static struct tc_action_ops act_xt_ops = { | 304 | static struct tc_action_ops act_xt_ops = { |
@@ -312,9 +310,7 @@ static struct tc_action_ops act_xt_ops = { | |||
312 | .act = tcf_ipt, | 310 | .act = tcf_ipt, |
313 | .dump = tcf_ipt_dump, | 311 | .dump = tcf_ipt_dump, |
314 | .cleanup = tcf_ipt_cleanup, | 312 | .cleanup = tcf_ipt_cleanup, |
315 | .lookup = tcf_hash_search, | ||
316 | .init = tcf_ipt_init, | 313 | .init = tcf_ipt_init, |
317 | .walk = tcf_generic_walker | ||
318 | }; | 314 | }; |
319 | 315 | ||
320 | MODULE_AUTHOR("Jamal Hadi Salim(2002-13)"); | 316 | MODULE_AUTHOR("Jamal Hadi Salim(2002-13)"); |
diff --git a/net/sched/act_mirred.c b/net/sched/act_mirred.c index 977c10e0631b..252378121ce7 100644 --- a/net/sched/act_mirred.c +++ b/net/sched/act_mirred.c | |||
@@ -271,9 +271,7 @@ static struct tc_action_ops act_mirred_ops = { | |||
271 | .act = tcf_mirred, | 271 | .act = tcf_mirred, |
272 | .dump = tcf_mirred_dump, | 272 | .dump = tcf_mirred_dump, |
273 | .cleanup = tcf_mirred_cleanup, | 273 | .cleanup = tcf_mirred_cleanup, |
274 | .lookup = tcf_hash_search, | ||
275 | .init = tcf_mirred_init, | 274 | .init = tcf_mirred_init, |
276 | .walk = tcf_generic_walker | ||
277 | }; | 275 | }; |
278 | 276 | ||
279 | MODULE_AUTHOR("Jamal Hadi Salim(2002)"); | 277 | MODULE_AUTHOR("Jamal Hadi Salim(2002)"); |
diff --git a/net/sched/act_nat.c b/net/sched/act_nat.c index 876f0ef29694..6a15ace00241 100644 --- a/net/sched/act_nat.c +++ b/net/sched/act_nat.c | |||
@@ -308,9 +308,7 @@ static struct tc_action_ops act_nat_ops = { | |||
308 | .act = tcf_nat, | 308 | .act = tcf_nat, |
309 | .dump = tcf_nat_dump, | 309 | .dump = tcf_nat_dump, |
310 | .cleanup = tcf_nat_cleanup, | 310 | .cleanup = tcf_nat_cleanup, |
311 | .lookup = tcf_hash_search, | ||
312 | .init = tcf_nat_init, | 311 | .init = tcf_nat_init, |
313 | .walk = tcf_generic_walker | ||
314 | }; | 312 | }; |
315 | 313 | ||
316 | MODULE_DESCRIPTION("Stateless NAT actions"); | 314 | MODULE_DESCRIPTION("Stateless NAT actions"); |
diff --git a/net/sched/act_pedit.c b/net/sched/act_pedit.c index 7ed78c9e505c..03b67674169c 100644 --- a/net/sched/act_pedit.c +++ b/net/sched/act_pedit.c | |||
@@ -243,9 +243,7 @@ static struct tc_action_ops act_pedit_ops = { | |||
243 | .act = tcf_pedit, | 243 | .act = tcf_pedit, |
244 | .dump = tcf_pedit_dump, | 244 | .dump = tcf_pedit_dump, |
245 | .cleanup = tcf_pedit_cleanup, | 245 | .cleanup = tcf_pedit_cleanup, |
246 | .lookup = tcf_hash_search, | ||
247 | .init = tcf_pedit_init, | 246 | .init = tcf_pedit_init, |
248 | .walk = tcf_generic_walker | ||
249 | }; | 247 | }; |
250 | 248 | ||
251 | MODULE_AUTHOR("Jamal Hadi Salim(2002-4)"); | 249 | MODULE_AUTHOR("Jamal Hadi Salim(2002-4)"); |
diff --git a/net/sched/act_police.c b/net/sched/act_police.c index 272d8e924cf6..16a62c36928a 100644 --- a/net/sched/act_police.c +++ b/net/sched/act_police.c | |||
@@ -407,7 +407,6 @@ static struct tc_action_ops act_police_ops = { | |||
407 | .act = tcf_act_police, | 407 | .act = tcf_act_police, |
408 | .dump = tcf_act_police_dump, | 408 | .dump = tcf_act_police_dump, |
409 | .cleanup = tcf_act_police_cleanup, | 409 | .cleanup = tcf_act_police_cleanup, |
410 | .lookup = tcf_hash_search, | ||
411 | .init = tcf_act_police_locate, | 410 | .init = tcf_act_police_locate, |
412 | .walk = tcf_act_police_walker | 411 | .walk = tcf_act_police_walker |
413 | }; | 412 | }; |
diff --git a/net/sched/act_simple.c b/net/sched/act_simple.c index 7725eb4ab756..31157d3e729c 100644 --- a/net/sched/act_simple.c +++ b/net/sched/act_simple.c | |||
@@ -201,7 +201,6 @@ static struct tc_action_ops act_simp_ops = { | |||
201 | .dump = tcf_simp_dump, | 201 | .dump = tcf_simp_dump, |
202 | .cleanup = tcf_simp_cleanup, | 202 | .cleanup = tcf_simp_cleanup, |
203 | .init = tcf_simp_init, | 203 | .init = tcf_simp_init, |
204 | .walk = tcf_generic_walker, | ||
205 | }; | 204 | }; |
206 | 205 | ||
207 | MODULE_AUTHOR("Jamal Hadi Salim(2005)"); | 206 | MODULE_AUTHOR("Jamal Hadi Salim(2005)"); |
diff --git a/net/sched/act_skbedit.c b/net/sched/act_skbedit.c index cb4221171f93..35ea643b4325 100644 --- a/net/sched/act_skbedit.c +++ b/net/sched/act_skbedit.c | |||
@@ -203,7 +203,6 @@ static struct tc_action_ops act_skbedit_ops = { | |||
203 | .dump = tcf_skbedit_dump, | 203 | .dump = tcf_skbedit_dump, |
204 | .cleanup = tcf_skbedit_cleanup, | 204 | .cleanup = tcf_skbedit_cleanup, |
205 | .init = tcf_skbedit_init, | 205 | .init = tcf_skbedit_init, |
206 | .walk = tcf_generic_walker, | ||
207 | }; | 206 | }; |
208 | 207 | ||
209 | MODULE_AUTHOR("Alexander Duyck, <alexander.h.duyck@intel.com>"); | 208 | MODULE_AUTHOR("Alexander Duyck, <alexander.h.duyck@intel.com>"); |
diff --git a/net/sched/sch_htb.c b/net/sched/sch_htb.c index 0e1e38b40025..717b2108f852 100644 --- a/net/sched/sch_htb.c +++ b/net/sched/sch_htb.c | |||
@@ -1477,11 +1477,22 @@ static int htb_change_class(struct Qdisc *sch, u32 classid, | |||
1477 | sch_tree_lock(sch); | 1477 | sch_tree_lock(sch); |
1478 | } | 1478 | } |
1479 | 1479 | ||
1480 | rate64 = tb[TCA_HTB_RATE64] ? nla_get_u64(tb[TCA_HTB_RATE64]) : 0; | ||
1481 | |||
1482 | ceil64 = tb[TCA_HTB_CEIL64] ? nla_get_u64(tb[TCA_HTB_CEIL64]) : 0; | ||
1483 | |||
1484 | psched_ratecfg_precompute(&cl->rate, &hopt->rate, rate64); | ||
1485 | psched_ratecfg_precompute(&cl->ceil, &hopt->ceil, ceil64); | ||
1486 | |||
1480 | /* it used to be a nasty bug here, we have to check that node | 1487 | /* it used to be a nasty bug here, we have to check that node |
1481 | * is really leaf before changing cl->un.leaf ! | 1488 | * is really leaf before changing cl->un.leaf ! |
1482 | */ | 1489 | */ |
1483 | if (!cl->level) { | 1490 | if (!cl->level) { |
1484 | cl->quantum = hopt->rate.rate / q->rate2quantum; | 1491 | u64 quantum = cl->rate.rate_bytes_ps; |
1492 | |||
1493 | do_div(quantum, q->rate2quantum); | ||
1494 | cl->quantum = min_t(u64, quantum, INT_MAX); | ||
1495 | |||
1485 | if (!hopt->quantum && cl->quantum < 1000) { | 1496 | if (!hopt->quantum && cl->quantum < 1000) { |
1486 | pr_warning( | 1497 | pr_warning( |
1487 | "HTB: quantum of class %X is small. Consider r2q change.\n", | 1498 | "HTB: quantum of class %X is small. Consider r2q change.\n", |
@@ -1500,13 +1511,6 @@ static int htb_change_class(struct Qdisc *sch, u32 classid, | |||
1500 | cl->prio = TC_HTB_NUMPRIO - 1; | 1511 | cl->prio = TC_HTB_NUMPRIO - 1; |
1501 | } | 1512 | } |
1502 | 1513 | ||
1503 | rate64 = tb[TCA_HTB_RATE64] ? nla_get_u64(tb[TCA_HTB_RATE64]) : 0; | ||
1504 | |||
1505 | ceil64 = tb[TCA_HTB_CEIL64] ? nla_get_u64(tb[TCA_HTB_CEIL64]) : 0; | ||
1506 | |||
1507 | psched_ratecfg_precompute(&cl->rate, &hopt->rate, rate64); | ||
1508 | psched_ratecfg_precompute(&cl->ceil, &hopt->ceil, ceil64); | ||
1509 | |||
1510 | cl->buffer = PSCHED_TICKS2NS(hopt->buffer); | 1514 | cl->buffer = PSCHED_TICKS2NS(hopt->buffer); |
1511 | cl->cbuffer = PSCHED_TICKS2NS(hopt->cbuffer); | 1515 | cl->cbuffer = PSCHED_TICKS2NS(hopt->cbuffer); |
1512 | 1516 | ||
diff --git a/net/sched/sch_netem.c b/net/sched/sch_netem.c index 75c94e59a3bd..bccd52b36e97 100644 --- a/net/sched/sch_netem.c +++ b/net/sched/sch_netem.c | |||
@@ -215,10 +215,10 @@ static bool loss_4state(struct netem_sched_data *q) | |||
215 | if (rnd < clg->a4) { | 215 | if (rnd < clg->a4) { |
216 | clg->state = 4; | 216 | clg->state = 4; |
217 | return true; | 217 | return true; |
218 | } else if (clg->a4 < rnd && rnd < clg->a1) { | 218 | } else if (clg->a4 < rnd && rnd < clg->a1 + clg->a4) { |
219 | clg->state = 3; | 219 | clg->state = 3; |
220 | return true; | 220 | return true; |
221 | } else if (clg->a1 < rnd) | 221 | } else if (clg->a1 + clg->a4 < rnd) |
222 | clg->state = 1; | 222 | clg->state = 1; |
223 | 223 | ||
224 | break; | 224 | break; |
@@ -268,10 +268,11 @@ static bool loss_gilb_ell(struct netem_sched_data *q) | |||
268 | clg->state = 2; | 268 | clg->state = 2; |
269 | if (net_random() < clg->a4) | 269 | if (net_random() < clg->a4) |
270 | return true; | 270 | return true; |
271 | break; | ||
271 | case 2: | 272 | case 2: |
272 | if (net_random() < clg->a2) | 273 | if (net_random() < clg->a2) |
273 | clg->state = 1; | 274 | clg->state = 1; |
274 | if (clg->a3 > net_random()) | 275 | if (net_random() > clg->a3) |
275 | return true; | 276 | return true; |
276 | } | 277 | } |
277 | 278 | ||
diff --git a/net/sched/sch_tbf.c b/net/sched/sch_tbf.c index 68f98595819c..887e672f9d7d 100644 --- a/net/sched/sch_tbf.c +++ b/net/sched/sch_tbf.c | |||
@@ -21,6 +21,7 @@ | |||
21 | #include <net/netlink.h> | 21 | #include <net/netlink.h> |
22 | #include <net/sch_generic.h> | 22 | #include <net/sch_generic.h> |
23 | #include <net/pkt_sched.h> | 23 | #include <net/pkt_sched.h> |
24 | #include <net/tcp.h> | ||
24 | 25 | ||
25 | 26 | ||
26 | /* Simple Token Bucket Filter. | 27 | /* Simple Token Bucket Filter. |
@@ -117,6 +118,48 @@ struct tbf_sched_data { | |||
117 | }; | 118 | }; |
118 | 119 | ||
119 | 120 | ||
121 | /* Time to Length, convert time in ns to length in bytes | ||
122 | * to determinate how many bytes can be sent in given time. | ||
123 | */ | ||
124 | static u64 psched_ns_t2l(const struct psched_ratecfg *r, | ||
125 | u64 time_in_ns) | ||
126 | { | ||
127 | /* The formula is : | ||
128 | * len = (time_in_ns * r->rate_bytes_ps) / NSEC_PER_SEC | ||
129 | */ | ||
130 | u64 len = time_in_ns * r->rate_bytes_ps; | ||
131 | |||
132 | do_div(len, NSEC_PER_SEC); | ||
133 | |||
134 | if (unlikely(r->linklayer == TC_LINKLAYER_ATM)) { | ||
135 | do_div(len, 53); | ||
136 | len = len * 48; | ||
137 | } | ||
138 | |||
139 | if (len > r->overhead) | ||
140 | len -= r->overhead; | ||
141 | else | ||
142 | len = 0; | ||
143 | |||
144 | return len; | ||
145 | } | ||
146 | |||
147 | /* | ||
148 | * Return length of individual segments of a gso packet, | ||
149 | * including all headers (MAC, IP, TCP/UDP) | ||
150 | */ | ||
151 | static unsigned int skb_gso_seglen(const struct sk_buff *skb) | ||
152 | { | ||
153 | unsigned int hdr_len = skb_transport_header(skb) - skb_mac_header(skb); | ||
154 | const struct skb_shared_info *shinfo = skb_shinfo(skb); | ||
155 | |||
156 | if (likely(shinfo->gso_type & (SKB_GSO_TCPV4 | SKB_GSO_TCPV6))) | ||
157 | hdr_len += tcp_hdrlen(skb); | ||
158 | else | ||
159 | hdr_len += sizeof(struct udphdr); | ||
160 | return hdr_len + shinfo->gso_size; | ||
161 | } | ||
162 | |||
120 | /* GSO packet is too big, segment it so that tbf can transmit | 163 | /* GSO packet is too big, segment it so that tbf can transmit |
121 | * each segment in time | 164 | * each segment in time |
122 | */ | 165 | */ |
@@ -136,12 +179,8 @@ static int tbf_segment(struct sk_buff *skb, struct Qdisc *sch) | |||
136 | while (segs) { | 179 | while (segs) { |
137 | nskb = segs->next; | 180 | nskb = segs->next; |
138 | segs->next = NULL; | 181 | segs->next = NULL; |
139 | if (likely(segs->len <= q->max_size)) { | 182 | qdisc_skb_cb(segs)->pkt_len = segs->len; |
140 | qdisc_skb_cb(segs)->pkt_len = segs->len; | 183 | ret = qdisc_enqueue(segs, q->qdisc); |
141 | ret = qdisc_enqueue(segs, q->qdisc); | ||
142 | } else { | ||
143 | ret = qdisc_reshape_fail(skb, sch); | ||
144 | } | ||
145 | if (ret != NET_XMIT_SUCCESS) { | 184 | if (ret != NET_XMIT_SUCCESS) { |
146 | if (net_xmit_drop_count(ret)) | 185 | if (net_xmit_drop_count(ret)) |
147 | sch->qstats.drops++; | 186 | sch->qstats.drops++; |
@@ -163,7 +202,7 @@ static int tbf_enqueue(struct sk_buff *skb, struct Qdisc *sch) | |||
163 | int ret; | 202 | int ret; |
164 | 203 | ||
165 | if (qdisc_pkt_len(skb) > q->max_size) { | 204 | if (qdisc_pkt_len(skb) > q->max_size) { |
166 | if (skb_is_gso(skb)) | 205 | if (skb_is_gso(skb) && skb_gso_seglen(skb) <= q->max_size) |
167 | return tbf_segment(skb, sch); | 206 | return tbf_segment(skb, sch); |
168 | return qdisc_reshape_fail(skb, sch); | 207 | return qdisc_reshape_fail(skb, sch); |
169 | } | 208 | } |
@@ -276,10 +315,11 @@ static int tbf_change(struct Qdisc *sch, struct nlattr *opt) | |||
276 | struct tbf_sched_data *q = qdisc_priv(sch); | 315 | struct tbf_sched_data *q = qdisc_priv(sch); |
277 | struct nlattr *tb[TCA_TBF_MAX + 1]; | 316 | struct nlattr *tb[TCA_TBF_MAX + 1]; |
278 | struct tc_tbf_qopt *qopt; | 317 | struct tc_tbf_qopt *qopt; |
279 | struct qdisc_rate_table *rtab = NULL; | ||
280 | struct qdisc_rate_table *ptab = NULL; | ||
281 | struct Qdisc *child = NULL; | 318 | struct Qdisc *child = NULL; |
282 | int max_size, n; | 319 | struct psched_ratecfg rate; |
320 | struct psched_ratecfg peak; | ||
321 | u64 max_size; | ||
322 | s64 buffer, mtu; | ||
283 | u64 rate64 = 0, prate64 = 0; | 323 | u64 rate64 = 0, prate64 = 0; |
284 | 324 | ||
285 | err = nla_parse_nested(tb, TCA_TBF_MAX, opt, tbf_policy); | 325 | err = nla_parse_nested(tb, TCA_TBF_MAX, opt, tbf_policy); |
@@ -291,33 +331,13 @@ static int tbf_change(struct Qdisc *sch, struct nlattr *opt) | |||
291 | goto done; | 331 | goto done; |
292 | 332 | ||
293 | qopt = nla_data(tb[TCA_TBF_PARMS]); | 333 | qopt = nla_data(tb[TCA_TBF_PARMS]); |
294 | rtab = qdisc_get_rtab(&qopt->rate, tb[TCA_TBF_RTAB]); | 334 | if (qopt->rate.linklayer == TC_LINKLAYER_UNAWARE) |
295 | if (rtab == NULL) | 335 | qdisc_put_rtab(qdisc_get_rtab(&qopt->rate, |
296 | goto done; | 336 | tb[TCA_TBF_RTAB])); |
297 | 337 | ||
298 | if (qopt->peakrate.rate) { | 338 | if (qopt->peakrate.linklayer == TC_LINKLAYER_UNAWARE) |
299 | if (qopt->peakrate.rate > qopt->rate.rate) | 339 | qdisc_put_rtab(qdisc_get_rtab(&qopt->peakrate, |
300 | ptab = qdisc_get_rtab(&qopt->peakrate, tb[TCA_TBF_PTAB]); | 340 | tb[TCA_TBF_PTAB])); |
301 | if (ptab == NULL) | ||
302 | goto done; | ||
303 | } | ||
304 | |||
305 | for (n = 0; n < 256; n++) | ||
306 | if (rtab->data[n] > qopt->buffer) | ||
307 | break; | ||
308 | max_size = (n << qopt->rate.cell_log) - 1; | ||
309 | if (ptab) { | ||
310 | int size; | ||
311 | |||
312 | for (n = 0; n < 256; n++) | ||
313 | if (ptab->data[n] > qopt->mtu) | ||
314 | break; | ||
315 | size = (n << qopt->peakrate.cell_log) - 1; | ||
316 | if (size < max_size) | ||
317 | max_size = size; | ||
318 | } | ||
319 | if (max_size < 0) | ||
320 | goto done; | ||
321 | 341 | ||
322 | if (q->qdisc != &noop_qdisc) { | 342 | if (q->qdisc != &noop_qdisc) { |
323 | err = fifo_set_limit(q->qdisc, qopt->limit); | 343 | err = fifo_set_limit(q->qdisc, qopt->limit); |
@@ -331,6 +351,39 @@ static int tbf_change(struct Qdisc *sch, struct nlattr *opt) | |||
331 | } | 351 | } |
332 | } | 352 | } |
333 | 353 | ||
354 | buffer = min_t(u64, PSCHED_TICKS2NS(qopt->buffer), ~0U); | ||
355 | mtu = min_t(u64, PSCHED_TICKS2NS(qopt->mtu), ~0U); | ||
356 | |||
357 | if (tb[TCA_TBF_RATE64]) | ||
358 | rate64 = nla_get_u64(tb[TCA_TBF_RATE64]); | ||
359 | psched_ratecfg_precompute(&rate, &qopt->rate, rate64); | ||
360 | |||
361 | max_size = min_t(u64, psched_ns_t2l(&rate, buffer), ~0U); | ||
362 | |||
363 | if (qopt->peakrate.rate) { | ||
364 | if (tb[TCA_TBF_PRATE64]) | ||
365 | prate64 = nla_get_u64(tb[TCA_TBF_PRATE64]); | ||
366 | psched_ratecfg_precompute(&peak, &qopt->peakrate, prate64); | ||
367 | if (peak.rate_bytes_ps <= rate.rate_bytes_ps) { | ||
368 | pr_warn_ratelimited("sch_tbf: peakrate %llu is lower than or equals to rate %llu !\n", | ||
369 | peak.rate_bytes_ps, rate.rate_bytes_ps); | ||
370 | err = -EINVAL; | ||
371 | goto done; | ||
372 | } | ||
373 | |||
374 | max_size = min_t(u64, max_size, psched_ns_t2l(&peak, mtu)); | ||
375 | } | ||
376 | |||
377 | if (max_size < psched_mtu(qdisc_dev(sch))) | ||
378 | pr_warn_ratelimited("sch_tbf: burst %llu is lower than device %s mtu (%u) !\n", | ||
379 | max_size, qdisc_dev(sch)->name, | ||
380 | psched_mtu(qdisc_dev(sch))); | ||
381 | |||
382 | if (!max_size) { | ||
383 | err = -EINVAL; | ||
384 | goto done; | ||
385 | } | ||
386 | |||
334 | sch_tree_lock(sch); | 387 | sch_tree_lock(sch); |
335 | if (child) { | 388 | if (child) { |
336 | qdisc_tree_decrease_qlen(q->qdisc, q->qdisc->q.qlen); | 389 | qdisc_tree_decrease_qlen(q->qdisc, q->qdisc->q.qlen); |
@@ -344,13 +397,9 @@ static int tbf_change(struct Qdisc *sch, struct nlattr *opt) | |||
344 | q->tokens = q->buffer; | 397 | q->tokens = q->buffer; |
345 | q->ptokens = q->mtu; | 398 | q->ptokens = q->mtu; |
346 | 399 | ||
347 | if (tb[TCA_TBF_RATE64]) | 400 | memcpy(&q->rate, &rate, sizeof(struct psched_ratecfg)); |
348 | rate64 = nla_get_u64(tb[TCA_TBF_RATE64]); | 401 | if (qopt->peakrate.rate) { |
349 | psched_ratecfg_precompute(&q->rate, &rtab->rate, rate64); | 402 | memcpy(&q->peak, &peak, sizeof(struct psched_ratecfg)); |
350 | if (ptab) { | ||
351 | if (tb[TCA_TBF_PRATE64]) | ||
352 | prate64 = nla_get_u64(tb[TCA_TBF_PRATE64]); | ||
353 | psched_ratecfg_precompute(&q->peak, &ptab->rate, prate64); | ||
354 | q->peak_present = true; | 403 | q->peak_present = true; |
355 | } else { | 404 | } else { |
356 | q->peak_present = false; | 405 | q->peak_present = false; |
@@ -359,10 +408,6 @@ static int tbf_change(struct Qdisc *sch, struct nlattr *opt) | |||
359 | sch_tree_unlock(sch); | 408 | sch_tree_unlock(sch); |
360 | err = 0; | 409 | err = 0; |
361 | done: | 410 | done: |
362 | if (rtab) | ||
363 | qdisc_put_rtab(rtab); | ||
364 | if (ptab) | ||
365 | qdisc_put_rtab(ptab); | ||
366 | return err; | 411 | return err; |
367 | } | 412 | } |
368 | 413 | ||
diff --git a/net/sctp/associola.c b/net/sctp/associola.c index 68a27f9796d2..31ed008c8e13 100644 --- a/net/sctp/associola.c +++ b/net/sctp/associola.c | |||
@@ -154,8 +154,7 @@ static struct sctp_association *sctp_association_init(struct sctp_association *a | |||
154 | 154 | ||
155 | asoc->timeouts[SCTP_EVENT_TIMEOUT_HEARTBEAT] = 0; | 155 | asoc->timeouts[SCTP_EVENT_TIMEOUT_HEARTBEAT] = 0; |
156 | asoc->timeouts[SCTP_EVENT_TIMEOUT_SACK] = asoc->sackdelay; | 156 | asoc->timeouts[SCTP_EVENT_TIMEOUT_SACK] = asoc->sackdelay; |
157 | asoc->timeouts[SCTP_EVENT_TIMEOUT_AUTOCLOSE] = | 157 | asoc->timeouts[SCTP_EVENT_TIMEOUT_AUTOCLOSE] = sp->autoclose * HZ; |
158 | min_t(unsigned long, sp->autoclose, net->sctp.max_autoclose) * HZ; | ||
159 | 158 | ||
160 | /* Initializes the timers */ | 159 | /* Initializes the timers */ |
161 | for (i = SCTP_EVENT_TIMEOUT_NONE; i < SCTP_NUM_TIMEOUT_TYPES; ++i) | 160 | for (i = SCTP_EVENT_TIMEOUT_NONE; i < SCTP_NUM_TIMEOUT_TYPES; ++i) |
@@ -291,8 +290,6 @@ static struct sctp_association *sctp_association_init(struct sctp_association *a | |||
291 | asoc->peer.ipv6_address = 1; | 290 | asoc->peer.ipv6_address = 1; |
292 | INIT_LIST_HEAD(&asoc->asocs); | 291 | INIT_LIST_HEAD(&asoc->asocs); |
293 | 292 | ||
294 | asoc->autoclose = sp->autoclose; | ||
295 | |||
296 | asoc->default_stream = sp->default_stream; | 293 | asoc->default_stream = sp->default_stream; |
297 | asoc->default_ppid = sp->default_ppid; | 294 | asoc->default_ppid = sp->default_ppid; |
298 | asoc->default_flags = sp->default_flags; | 295 | asoc->default_flags = sp->default_flags; |
diff --git a/net/sctp/output.c b/net/sctp/output.c index e650978daf27..0fb140f8f088 100644 --- a/net/sctp/output.c +++ b/net/sctp/output.c | |||
@@ -474,10 +474,11 @@ int sctp_packet_transmit(struct sctp_packet *packet) | |||
474 | * for a given destination transport address. | 474 | * for a given destination transport address. |
475 | */ | 475 | */ |
476 | 476 | ||
477 | if (!tp->rto_pending) { | 477 | if (!chunk->resent && !tp->rto_pending) { |
478 | chunk->rtt_in_progress = 1; | 478 | chunk->rtt_in_progress = 1; |
479 | tp->rto_pending = 1; | 479 | tp->rto_pending = 1; |
480 | } | 480 | } |
481 | |||
481 | has_data = 1; | 482 | has_data = 1; |
482 | } | 483 | } |
483 | 484 | ||
@@ -580,7 +581,8 @@ int sctp_packet_transmit(struct sctp_packet *packet) | |||
580 | unsigned long timeout; | 581 | unsigned long timeout; |
581 | 582 | ||
582 | /* Restart the AUTOCLOSE timer when sending data. */ | 583 | /* Restart the AUTOCLOSE timer when sending data. */ |
583 | if (sctp_state(asoc, ESTABLISHED) && asoc->autoclose) { | 584 | if (sctp_state(asoc, ESTABLISHED) && |
585 | asoc->timeouts[SCTP_EVENT_TIMEOUT_AUTOCLOSE]) { | ||
584 | timer = &asoc->timers[SCTP_EVENT_TIMEOUT_AUTOCLOSE]; | 586 | timer = &asoc->timers[SCTP_EVENT_TIMEOUT_AUTOCLOSE]; |
585 | timeout = asoc->timeouts[SCTP_EVENT_TIMEOUT_AUTOCLOSE]; | 587 | timeout = asoc->timeouts[SCTP_EVENT_TIMEOUT_AUTOCLOSE]; |
586 | 588 | ||
diff --git a/net/sctp/outqueue.c b/net/sctp/outqueue.c index 94df75877869..f51ba985a36e 100644 --- a/net/sctp/outqueue.c +++ b/net/sctp/outqueue.c | |||
@@ -446,6 +446,8 @@ void sctp_retransmit_mark(struct sctp_outq *q, | |||
446 | transport->rto_pending = 0; | 446 | transport->rto_pending = 0; |
447 | } | 447 | } |
448 | 448 | ||
449 | chunk->resent = 1; | ||
450 | |||
449 | /* Move the chunk to the retransmit queue. The chunks | 451 | /* Move the chunk to the retransmit queue. The chunks |
450 | * on the retransmit queue are always kept in order. | 452 | * on the retransmit queue are always kept in order. |
451 | */ | 453 | */ |
@@ -1375,6 +1377,7 @@ static void sctp_check_transmitted(struct sctp_outq *q, | |||
1375 | * instance). | 1377 | * instance). |
1376 | */ | 1378 | */ |
1377 | if (!tchunk->tsn_gap_acked && | 1379 | if (!tchunk->tsn_gap_acked && |
1380 | !tchunk->resent && | ||
1378 | tchunk->rtt_in_progress) { | 1381 | tchunk->rtt_in_progress) { |
1379 | tchunk->rtt_in_progress = 0; | 1382 | tchunk->rtt_in_progress = 0; |
1380 | rtt = jiffies - tchunk->sent_at; | 1383 | rtt = jiffies - tchunk->sent_at; |
@@ -1391,7 +1394,8 @@ static void sctp_check_transmitted(struct sctp_outq *q, | |||
1391 | */ | 1394 | */ |
1392 | if (!tchunk->tsn_gap_acked) { | 1395 | if (!tchunk->tsn_gap_acked) { |
1393 | tchunk->tsn_gap_acked = 1; | 1396 | tchunk->tsn_gap_acked = 1; |
1394 | *highest_new_tsn_in_sack = tsn; | 1397 | if (TSN_lt(*highest_new_tsn_in_sack, tsn)) |
1398 | *highest_new_tsn_in_sack = tsn; | ||
1395 | bytes_acked += sctp_data_size(tchunk); | 1399 | bytes_acked += sctp_data_size(tchunk); |
1396 | if (!tchunk->transport) | 1400 | if (!tchunk->transport) |
1397 | migrate_bytes += sctp_data_size(tchunk); | 1401 | migrate_bytes += sctp_data_size(tchunk); |
diff --git a/net/sctp/sm_statefuns.c b/net/sctp/sm_statefuns.c index dfe3f36ff2aa..a26065be7289 100644 --- a/net/sctp/sm_statefuns.c +++ b/net/sctp/sm_statefuns.c | |||
@@ -820,7 +820,7 @@ sctp_disposition_t sctp_sf_do_5_1D_ce(struct net *net, | |||
820 | SCTP_INC_STATS(net, SCTP_MIB_PASSIVEESTABS); | 820 | SCTP_INC_STATS(net, SCTP_MIB_PASSIVEESTABS); |
821 | sctp_add_cmd_sf(commands, SCTP_CMD_HB_TIMERS_START, SCTP_NULL()); | 821 | sctp_add_cmd_sf(commands, SCTP_CMD_HB_TIMERS_START, SCTP_NULL()); |
822 | 822 | ||
823 | if (new_asoc->autoclose) | 823 | if (new_asoc->timeouts[SCTP_EVENT_TIMEOUT_AUTOCLOSE]) |
824 | sctp_add_cmd_sf(commands, SCTP_CMD_TIMER_START, | 824 | sctp_add_cmd_sf(commands, SCTP_CMD_TIMER_START, |
825 | SCTP_TO(SCTP_EVENT_TIMEOUT_AUTOCLOSE)); | 825 | SCTP_TO(SCTP_EVENT_TIMEOUT_AUTOCLOSE)); |
826 | 826 | ||
@@ -908,7 +908,7 @@ sctp_disposition_t sctp_sf_do_5_1E_ca(struct net *net, | |||
908 | SCTP_INC_STATS(net, SCTP_MIB_CURRESTAB); | 908 | SCTP_INC_STATS(net, SCTP_MIB_CURRESTAB); |
909 | SCTP_INC_STATS(net, SCTP_MIB_ACTIVEESTABS); | 909 | SCTP_INC_STATS(net, SCTP_MIB_ACTIVEESTABS); |
910 | sctp_add_cmd_sf(commands, SCTP_CMD_HB_TIMERS_START, SCTP_NULL()); | 910 | sctp_add_cmd_sf(commands, SCTP_CMD_HB_TIMERS_START, SCTP_NULL()); |
911 | if (asoc->autoclose) | 911 | if (asoc->timeouts[SCTP_EVENT_TIMEOUT_AUTOCLOSE]) |
912 | sctp_add_cmd_sf(commands, SCTP_CMD_TIMER_START, | 912 | sctp_add_cmd_sf(commands, SCTP_CMD_TIMER_START, |
913 | SCTP_TO(SCTP_EVENT_TIMEOUT_AUTOCLOSE)); | 913 | SCTP_TO(SCTP_EVENT_TIMEOUT_AUTOCLOSE)); |
914 | 914 | ||
@@ -2970,7 +2970,7 @@ sctp_disposition_t sctp_sf_eat_data_6_2(struct net *net, | |||
2970 | if (chunk->chunk_hdr->flags & SCTP_DATA_SACK_IMM) | 2970 | if (chunk->chunk_hdr->flags & SCTP_DATA_SACK_IMM) |
2971 | force = SCTP_FORCE(); | 2971 | force = SCTP_FORCE(); |
2972 | 2972 | ||
2973 | if (asoc->autoclose) { | 2973 | if (asoc->timeouts[SCTP_EVENT_TIMEOUT_AUTOCLOSE]) { |
2974 | sctp_add_cmd_sf(commands, SCTP_CMD_TIMER_RESTART, | 2974 | sctp_add_cmd_sf(commands, SCTP_CMD_TIMER_RESTART, |
2975 | SCTP_TO(SCTP_EVENT_TIMEOUT_AUTOCLOSE)); | 2975 | SCTP_TO(SCTP_EVENT_TIMEOUT_AUTOCLOSE)); |
2976 | } | 2976 | } |
@@ -3878,7 +3878,7 @@ sctp_disposition_t sctp_sf_eat_fwd_tsn(struct net *net, | |||
3878 | SCTP_CHUNK(chunk)); | 3878 | SCTP_CHUNK(chunk)); |
3879 | 3879 | ||
3880 | /* Count this as receiving DATA. */ | 3880 | /* Count this as receiving DATA. */ |
3881 | if (asoc->autoclose) { | 3881 | if (asoc->timeouts[SCTP_EVENT_TIMEOUT_AUTOCLOSE]) { |
3882 | sctp_add_cmd_sf(commands, SCTP_CMD_TIMER_RESTART, | 3882 | sctp_add_cmd_sf(commands, SCTP_CMD_TIMER_RESTART, |
3883 | SCTP_TO(SCTP_EVENT_TIMEOUT_AUTOCLOSE)); | 3883 | SCTP_TO(SCTP_EVENT_TIMEOUT_AUTOCLOSE)); |
3884 | } | 3884 | } |
@@ -5267,7 +5267,7 @@ sctp_disposition_t sctp_sf_do_9_2_start_shutdown( | |||
5267 | sctp_add_cmd_sf(commands, SCTP_CMD_TIMER_RESTART, | 5267 | sctp_add_cmd_sf(commands, SCTP_CMD_TIMER_RESTART, |
5268 | SCTP_TO(SCTP_EVENT_TIMEOUT_T5_SHUTDOWN_GUARD)); | 5268 | SCTP_TO(SCTP_EVENT_TIMEOUT_T5_SHUTDOWN_GUARD)); |
5269 | 5269 | ||
5270 | if (asoc->autoclose) | 5270 | if (asoc->timeouts[SCTP_EVENT_TIMEOUT_AUTOCLOSE]) |
5271 | sctp_add_cmd_sf(commands, SCTP_CMD_TIMER_STOP, | 5271 | sctp_add_cmd_sf(commands, SCTP_CMD_TIMER_STOP, |
5272 | SCTP_TO(SCTP_EVENT_TIMEOUT_AUTOCLOSE)); | 5272 | SCTP_TO(SCTP_EVENT_TIMEOUT_AUTOCLOSE)); |
5273 | 5273 | ||
@@ -5346,7 +5346,7 @@ sctp_disposition_t sctp_sf_do_9_2_shutdown_ack( | |||
5346 | sctp_add_cmd_sf(commands, SCTP_CMD_TIMER_RESTART, | 5346 | sctp_add_cmd_sf(commands, SCTP_CMD_TIMER_RESTART, |
5347 | SCTP_TO(SCTP_EVENT_TIMEOUT_T2_SHUTDOWN)); | 5347 | SCTP_TO(SCTP_EVENT_TIMEOUT_T2_SHUTDOWN)); |
5348 | 5348 | ||
5349 | if (asoc->autoclose) | 5349 | if (asoc->timeouts[SCTP_EVENT_TIMEOUT_AUTOCLOSE]) |
5350 | sctp_add_cmd_sf(commands, SCTP_CMD_TIMER_STOP, | 5350 | sctp_add_cmd_sf(commands, SCTP_CMD_TIMER_STOP, |
5351 | SCTP_TO(SCTP_EVENT_TIMEOUT_AUTOCLOSE)); | 5351 | SCTP_TO(SCTP_EVENT_TIMEOUT_AUTOCLOSE)); |
5352 | 5352 | ||
diff --git a/net/sctp/socket.c b/net/sctp/socket.c index 72046b9729a8..42b709c95cf3 100644 --- a/net/sctp/socket.c +++ b/net/sctp/socket.c | |||
@@ -2196,6 +2196,7 @@ static int sctp_setsockopt_autoclose(struct sock *sk, char __user *optval, | |||
2196 | unsigned int optlen) | 2196 | unsigned int optlen) |
2197 | { | 2197 | { |
2198 | struct sctp_sock *sp = sctp_sk(sk); | 2198 | struct sctp_sock *sp = sctp_sk(sk); |
2199 | struct net *net = sock_net(sk); | ||
2199 | 2200 | ||
2200 | /* Applicable to UDP-style socket only */ | 2201 | /* Applicable to UDP-style socket only */ |
2201 | if (sctp_style(sk, TCP)) | 2202 | if (sctp_style(sk, TCP)) |
@@ -2205,6 +2206,9 @@ static int sctp_setsockopt_autoclose(struct sock *sk, char __user *optval, | |||
2205 | if (copy_from_user(&sp->autoclose, optval, optlen)) | 2206 | if (copy_from_user(&sp->autoclose, optval, optlen)) |
2206 | return -EFAULT; | 2207 | return -EFAULT; |
2207 | 2208 | ||
2209 | if (sp->autoclose > net->sctp.max_autoclose) | ||
2210 | sp->autoclose = net->sctp.max_autoclose; | ||
2211 | |||
2208 | return 0; | 2212 | return 0; |
2209 | } | 2213 | } |
2210 | 2214 | ||
@@ -2811,6 +2815,8 @@ static int sctp_setsockopt_rtoinfo(struct sock *sk, char __user *optval, unsigne | |||
2811 | { | 2815 | { |
2812 | struct sctp_rtoinfo rtoinfo; | 2816 | struct sctp_rtoinfo rtoinfo; |
2813 | struct sctp_association *asoc; | 2817 | struct sctp_association *asoc; |
2818 | unsigned long rto_min, rto_max; | ||
2819 | struct sctp_sock *sp = sctp_sk(sk); | ||
2814 | 2820 | ||
2815 | if (optlen != sizeof (struct sctp_rtoinfo)) | 2821 | if (optlen != sizeof (struct sctp_rtoinfo)) |
2816 | return -EINVAL; | 2822 | return -EINVAL; |
@@ -2824,26 +2830,36 @@ static int sctp_setsockopt_rtoinfo(struct sock *sk, char __user *optval, unsigne | |||
2824 | if (!asoc && rtoinfo.srto_assoc_id && sctp_style(sk, UDP)) | 2830 | if (!asoc && rtoinfo.srto_assoc_id && sctp_style(sk, UDP)) |
2825 | return -EINVAL; | 2831 | return -EINVAL; |
2826 | 2832 | ||
2833 | rto_max = rtoinfo.srto_max; | ||
2834 | rto_min = rtoinfo.srto_min; | ||
2835 | |||
2836 | if (rto_max) | ||
2837 | rto_max = asoc ? msecs_to_jiffies(rto_max) : rto_max; | ||
2838 | else | ||
2839 | rto_max = asoc ? asoc->rto_max : sp->rtoinfo.srto_max; | ||
2840 | |||
2841 | if (rto_min) | ||
2842 | rto_min = asoc ? msecs_to_jiffies(rto_min) : rto_min; | ||
2843 | else | ||
2844 | rto_min = asoc ? asoc->rto_min : sp->rtoinfo.srto_min; | ||
2845 | |||
2846 | if (rto_min > rto_max) | ||
2847 | return -EINVAL; | ||
2848 | |||
2827 | if (asoc) { | 2849 | if (asoc) { |
2828 | if (rtoinfo.srto_initial != 0) | 2850 | if (rtoinfo.srto_initial != 0) |
2829 | asoc->rto_initial = | 2851 | asoc->rto_initial = |
2830 | msecs_to_jiffies(rtoinfo.srto_initial); | 2852 | msecs_to_jiffies(rtoinfo.srto_initial); |
2831 | if (rtoinfo.srto_max != 0) | 2853 | asoc->rto_max = rto_max; |
2832 | asoc->rto_max = msecs_to_jiffies(rtoinfo.srto_max); | 2854 | asoc->rto_min = rto_min; |
2833 | if (rtoinfo.srto_min != 0) | ||
2834 | asoc->rto_min = msecs_to_jiffies(rtoinfo.srto_min); | ||
2835 | } else { | 2855 | } else { |
2836 | /* If there is no association or the association-id = 0 | 2856 | /* If there is no association or the association-id = 0 |
2837 | * set the values to the endpoint. | 2857 | * set the values to the endpoint. |
2838 | */ | 2858 | */ |
2839 | struct sctp_sock *sp = sctp_sk(sk); | ||
2840 | |||
2841 | if (rtoinfo.srto_initial != 0) | 2859 | if (rtoinfo.srto_initial != 0) |
2842 | sp->rtoinfo.srto_initial = rtoinfo.srto_initial; | 2860 | sp->rtoinfo.srto_initial = rtoinfo.srto_initial; |
2843 | if (rtoinfo.srto_max != 0) | 2861 | sp->rtoinfo.srto_max = rto_max; |
2844 | sp->rtoinfo.srto_max = rtoinfo.srto_max; | 2862 | sp->rtoinfo.srto_min = rto_min; |
2845 | if (rtoinfo.srto_min != 0) | ||
2846 | sp->rtoinfo.srto_min = rtoinfo.srto_min; | ||
2847 | } | 2863 | } |
2848 | 2864 | ||
2849 | return 0; | 2865 | return 0; |
diff --git a/net/sctp/sysctl.c b/net/sctp/sysctl.c index 6b36561a1b3b..b0565afb61c7 100644 --- a/net/sctp/sysctl.c +++ b/net/sctp/sysctl.c | |||
@@ -56,11 +56,16 @@ extern long sysctl_sctp_mem[3]; | |||
56 | extern int sysctl_sctp_rmem[3]; | 56 | extern int sysctl_sctp_rmem[3]; |
57 | extern int sysctl_sctp_wmem[3]; | 57 | extern int sysctl_sctp_wmem[3]; |
58 | 58 | ||
59 | static int proc_sctp_do_hmac_alg(struct ctl_table *ctl, | 59 | static int proc_sctp_do_hmac_alg(struct ctl_table *ctl, int write, |
60 | int write, | 60 | void __user *buffer, size_t *lenp, |
61 | loff_t *ppos); | ||
62 | static int proc_sctp_do_rto_min(struct ctl_table *ctl, int write, | ||
63 | void __user *buffer, size_t *lenp, | ||
64 | loff_t *ppos); | ||
65 | static int proc_sctp_do_rto_max(struct ctl_table *ctl, int write, | ||
61 | void __user *buffer, size_t *lenp, | 66 | void __user *buffer, size_t *lenp, |
62 | |||
63 | loff_t *ppos); | 67 | loff_t *ppos); |
68 | |||
64 | static struct ctl_table sctp_table[] = { | 69 | static struct ctl_table sctp_table[] = { |
65 | { | 70 | { |
66 | .procname = "sctp_mem", | 71 | .procname = "sctp_mem", |
@@ -102,17 +107,17 @@ static struct ctl_table sctp_net_table[] = { | |||
102 | .data = &init_net.sctp.rto_min, | 107 | .data = &init_net.sctp.rto_min, |
103 | .maxlen = sizeof(unsigned int), | 108 | .maxlen = sizeof(unsigned int), |
104 | .mode = 0644, | 109 | .mode = 0644, |
105 | .proc_handler = proc_dointvec_minmax, | 110 | .proc_handler = proc_sctp_do_rto_min, |
106 | .extra1 = &one, | 111 | .extra1 = &one, |
107 | .extra2 = &timer_max | 112 | .extra2 = &init_net.sctp.rto_max |
108 | }, | 113 | }, |
109 | { | 114 | { |
110 | .procname = "rto_max", | 115 | .procname = "rto_max", |
111 | .data = &init_net.sctp.rto_max, | 116 | .data = &init_net.sctp.rto_max, |
112 | .maxlen = sizeof(unsigned int), | 117 | .maxlen = sizeof(unsigned int), |
113 | .mode = 0644, | 118 | .mode = 0644, |
114 | .proc_handler = proc_dointvec_minmax, | 119 | .proc_handler = proc_sctp_do_rto_max, |
115 | .extra1 = &one, | 120 | .extra1 = &init_net.sctp.rto_min, |
116 | .extra2 = &timer_max | 121 | .extra2 = &timer_max |
117 | }, | 122 | }, |
118 | { | 123 | { |
@@ -294,8 +299,7 @@ static struct ctl_table sctp_net_table[] = { | |||
294 | { /* sentinel */ } | 299 | { /* sentinel */ } |
295 | }; | 300 | }; |
296 | 301 | ||
297 | static int proc_sctp_do_hmac_alg(struct ctl_table *ctl, | 302 | static int proc_sctp_do_hmac_alg(struct ctl_table *ctl, int write, |
298 | int write, | ||
299 | void __user *buffer, size_t *lenp, | 303 | void __user *buffer, size_t *lenp, |
300 | loff_t *ppos) | 304 | loff_t *ppos) |
301 | { | 305 | { |
@@ -342,6 +346,60 @@ static int proc_sctp_do_hmac_alg(struct ctl_table *ctl, | |||
342 | return ret; | 346 | return ret; |
343 | } | 347 | } |
344 | 348 | ||
349 | static int proc_sctp_do_rto_min(struct ctl_table *ctl, int write, | ||
350 | void __user *buffer, size_t *lenp, | ||
351 | loff_t *ppos) | ||
352 | { | ||
353 | struct net *net = current->nsproxy->net_ns; | ||
354 | int new_value; | ||
355 | struct ctl_table tbl; | ||
356 | unsigned int min = *(unsigned int *) ctl->extra1; | ||
357 | unsigned int max = *(unsigned int *) ctl->extra2; | ||
358 | int ret; | ||
359 | |||
360 | memset(&tbl, 0, sizeof(struct ctl_table)); | ||
361 | tbl.maxlen = sizeof(unsigned int); | ||
362 | |||
363 | if (write) | ||
364 | tbl.data = &new_value; | ||
365 | else | ||
366 | tbl.data = &net->sctp.rto_min; | ||
367 | ret = proc_dointvec(&tbl, write, buffer, lenp, ppos); | ||
368 | if (write) { | ||
369 | if (ret || new_value > max || new_value < min) | ||
370 | return -EINVAL; | ||
371 | net->sctp.rto_min = new_value; | ||
372 | } | ||
373 | return ret; | ||
374 | } | ||
375 | |||
376 | static int proc_sctp_do_rto_max(struct ctl_table *ctl, int write, | ||
377 | void __user *buffer, size_t *lenp, | ||
378 | loff_t *ppos) | ||
379 | { | ||
380 | struct net *net = current->nsproxy->net_ns; | ||
381 | int new_value; | ||
382 | struct ctl_table tbl; | ||
383 | unsigned int min = *(unsigned int *) ctl->extra1; | ||
384 | unsigned int max = *(unsigned int *) ctl->extra2; | ||
385 | int ret; | ||
386 | |||
387 | memset(&tbl, 0, sizeof(struct ctl_table)); | ||
388 | tbl.maxlen = sizeof(unsigned int); | ||
389 | |||
390 | if (write) | ||
391 | tbl.data = &new_value; | ||
392 | else | ||
393 | tbl.data = &net->sctp.rto_max; | ||
394 | ret = proc_dointvec(&tbl, write, buffer, lenp, ppos); | ||
395 | if (write) { | ||
396 | if (ret || new_value > max || new_value < min) | ||
397 | return -EINVAL; | ||
398 | net->sctp.rto_max = new_value; | ||
399 | } | ||
400 | return ret; | ||
401 | } | ||
402 | |||
345 | int sctp_sysctl_net_register(struct net *net) | 403 | int sctp_sysctl_net_register(struct net *net) |
346 | { | 404 | { |
347 | struct ctl_table *table; | 405 | struct ctl_table *table; |
diff --git a/net/sctp/transport.c b/net/sctp/transport.c index e332efb124cc..efc46ffed1fd 100644 --- a/net/sctp/transport.c +++ b/net/sctp/transport.c | |||
@@ -573,7 +573,7 @@ void sctp_transport_burst_limited(struct sctp_transport *t) | |||
573 | u32 old_cwnd = t->cwnd; | 573 | u32 old_cwnd = t->cwnd; |
574 | u32 max_burst_bytes; | 574 | u32 max_burst_bytes; |
575 | 575 | ||
576 | if (t->burst_limited) | 576 | if (t->burst_limited || asoc->max_burst == 0) |
577 | return; | 577 | return; |
578 | 578 | ||
579 | max_burst_bytes = t->flight_size + (asoc->max_burst * asoc->pathmtu); | 579 | max_burst_bytes = t->flight_size + (asoc->max_burst * asoc->pathmtu); |
diff --git a/net/socket.c b/net/socket.c index 0b18693f2be6..e83c416708af 100644 --- a/net/socket.c +++ b/net/socket.c | |||
@@ -1973,7 +1973,7 @@ static int copy_msghdr_from_user(struct msghdr *kmsg, | |||
1973 | if (copy_from_user(kmsg, umsg, sizeof(struct msghdr))) | 1973 | if (copy_from_user(kmsg, umsg, sizeof(struct msghdr))) |
1974 | return -EFAULT; | 1974 | return -EFAULT; |
1975 | if (kmsg->msg_namelen > sizeof(struct sockaddr_storage)) | 1975 | if (kmsg->msg_namelen > sizeof(struct sockaddr_storage)) |
1976 | return -EINVAL; | 1976 | kmsg->msg_namelen = sizeof(struct sockaddr_storage); |
1977 | return 0; | 1977 | return 0; |
1978 | } | 1978 | } |
1979 | 1979 | ||
diff --git a/net/sunrpc/auth_gss/auth_gss.c b/net/sunrpc/auth_gss/auth_gss.c index 97912b40c254..42fdfc634e56 100644 --- a/net/sunrpc/auth_gss/auth_gss.c +++ b/net/sunrpc/auth_gss/auth_gss.c | |||
@@ -1517,7 +1517,7 @@ out: | |||
1517 | static int | 1517 | static int |
1518 | gss_refresh_null(struct rpc_task *task) | 1518 | gss_refresh_null(struct rpc_task *task) |
1519 | { | 1519 | { |
1520 | return -EACCES; | 1520 | return 0; |
1521 | } | 1521 | } |
1522 | 1522 | ||
1523 | static __be32 * | 1523 | static __be32 * |
diff --git a/net/tipc/core.c b/net/tipc/core.c index fd4eeeaa972a..c6d3f75a9e1b 100644 --- a/net/tipc/core.c +++ b/net/tipc/core.c | |||
@@ -113,7 +113,6 @@ err: | |||
113 | static void tipc_core_stop(void) | 113 | static void tipc_core_stop(void) |
114 | { | 114 | { |
115 | tipc_netlink_stop(); | 115 | tipc_netlink_stop(); |
116 | tipc_handler_stop(); | ||
117 | tipc_cfg_stop(); | 116 | tipc_cfg_stop(); |
118 | tipc_subscr_stop(); | 117 | tipc_subscr_stop(); |
119 | tipc_nametbl_stop(); | 118 | tipc_nametbl_stop(); |
@@ -146,9 +145,10 @@ static int tipc_core_start(void) | |||
146 | res = tipc_subscr_start(); | 145 | res = tipc_subscr_start(); |
147 | if (!res) | 146 | if (!res) |
148 | res = tipc_cfg_init(); | 147 | res = tipc_cfg_init(); |
149 | if (res) | 148 | if (res) { |
149 | tipc_handler_stop(); | ||
150 | tipc_core_stop(); | 150 | tipc_core_stop(); |
151 | 151 | } | |
152 | return res; | 152 | return res; |
153 | } | 153 | } |
154 | 154 | ||
@@ -178,6 +178,7 @@ static int __init tipc_init(void) | |||
178 | 178 | ||
179 | static void __exit tipc_exit(void) | 179 | static void __exit tipc_exit(void) |
180 | { | 180 | { |
181 | tipc_handler_stop(); | ||
181 | tipc_core_stop_net(); | 182 | tipc_core_stop_net(); |
182 | tipc_core_stop(); | 183 | tipc_core_stop(); |
183 | pr_info("Deactivated\n"); | 184 | pr_info("Deactivated\n"); |
diff --git a/net/tipc/handler.c b/net/tipc/handler.c index b36f0fcd9bdf..e4bc8a296744 100644 --- a/net/tipc/handler.c +++ b/net/tipc/handler.c | |||
@@ -56,12 +56,13 @@ unsigned int tipc_k_signal(Handler routine, unsigned long argument) | |||
56 | { | 56 | { |
57 | struct queue_item *item; | 57 | struct queue_item *item; |
58 | 58 | ||
59 | spin_lock_bh(&qitem_lock); | ||
59 | if (!handler_enabled) { | 60 | if (!handler_enabled) { |
60 | pr_err("Signal request ignored by handler\n"); | 61 | pr_err("Signal request ignored by handler\n"); |
62 | spin_unlock_bh(&qitem_lock); | ||
61 | return -ENOPROTOOPT; | 63 | return -ENOPROTOOPT; |
62 | } | 64 | } |
63 | 65 | ||
64 | spin_lock_bh(&qitem_lock); | ||
65 | item = kmem_cache_alloc(tipc_queue_item_cache, GFP_ATOMIC); | 66 | item = kmem_cache_alloc(tipc_queue_item_cache, GFP_ATOMIC); |
66 | if (!item) { | 67 | if (!item) { |
67 | pr_err("Signal queue out of memory\n"); | 68 | pr_err("Signal queue out of memory\n"); |
@@ -112,10 +113,14 @@ void tipc_handler_stop(void) | |||
112 | struct list_head *l, *n; | 113 | struct list_head *l, *n; |
113 | struct queue_item *item; | 114 | struct queue_item *item; |
114 | 115 | ||
115 | if (!handler_enabled) | 116 | spin_lock_bh(&qitem_lock); |
117 | if (!handler_enabled) { | ||
118 | spin_unlock_bh(&qitem_lock); | ||
116 | return; | 119 | return; |
117 | 120 | } | |
118 | handler_enabled = 0; | 121 | handler_enabled = 0; |
122 | spin_unlock_bh(&qitem_lock); | ||
123 | |||
119 | tasklet_kill(&tipc_tasklet); | 124 | tasklet_kill(&tipc_tasklet); |
120 | 125 | ||
121 | spin_lock_bh(&qitem_lock); | 126 | spin_lock_bh(&qitem_lock); |
diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c index 01625ccc3ae6..a0ca162e5bd5 100644 --- a/net/unix/af_unix.c +++ b/net/unix/af_unix.c | |||
@@ -530,13 +530,17 @@ static int unix_seqpacket_sendmsg(struct kiocb *, struct socket *, | |||
530 | static int unix_seqpacket_recvmsg(struct kiocb *, struct socket *, | 530 | static int unix_seqpacket_recvmsg(struct kiocb *, struct socket *, |
531 | struct msghdr *, size_t, int); | 531 | struct msghdr *, size_t, int); |
532 | 532 | ||
533 | static void unix_set_peek_off(struct sock *sk, int val) | 533 | static int unix_set_peek_off(struct sock *sk, int val) |
534 | { | 534 | { |
535 | struct unix_sock *u = unix_sk(sk); | 535 | struct unix_sock *u = unix_sk(sk); |
536 | 536 | ||
537 | mutex_lock(&u->readlock); | 537 | if (mutex_lock_interruptible(&u->readlock)) |
538 | return -EINTR; | ||
539 | |||
538 | sk->sk_peek_off = val; | 540 | sk->sk_peek_off = val; |
539 | mutex_unlock(&u->readlock); | 541 | mutex_unlock(&u->readlock); |
542 | |||
543 | return 0; | ||
540 | } | 544 | } |
541 | 545 | ||
542 | 546 | ||
diff --git a/net/wireless/core.c b/net/wireless/core.c index aff959e5a1b3..52b865fb7351 100644 --- a/net/wireless/core.c +++ b/net/wireless/core.c | |||
@@ -451,6 +451,15 @@ int wiphy_register(struct wiphy *wiphy) | |||
451 | int i; | 451 | int i; |
452 | u16 ifmodes = wiphy->interface_modes; | 452 | u16 ifmodes = wiphy->interface_modes; |
453 | 453 | ||
454 | /* support for 5/10 MHz is broken due to nl80211 API mess - disable */ | ||
455 | wiphy->flags &= ~WIPHY_FLAG_SUPPORTS_5_10_MHZ; | ||
456 | |||
457 | /* | ||
458 | * There are major locking problems in nl80211/mac80211 for CSA, | ||
459 | * disable for all drivers until this has been reworked. | ||
460 | */ | ||
461 | wiphy->flags &= ~WIPHY_FLAG_HAS_CHANNEL_SWITCH; | ||
462 | |||
454 | #ifdef CONFIG_PM | 463 | #ifdef CONFIG_PM |
455 | if (WARN_ON(wiphy->wowlan && | 464 | if (WARN_ON(wiphy->wowlan && |
456 | (wiphy->wowlan->flags & WIPHY_WOWLAN_GTK_REKEY_FAILURE) && | 465 | (wiphy->wowlan->flags & WIPHY_WOWLAN_GTK_REKEY_FAILURE) && |
diff --git a/net/wireless/ibss.c b/net/wireless/ibss.c index 9d797df56649..89737ee2669a 100644 --- a/net/wireless/ibss.c +++ b/net/wireless/ibss.c | |||
@@ -262,7 +262,7 @@ int cfg80211_ibss_wext_join(struct cfg80211_registered_device *rdev, | |||
262 | 262 | ||
263 | /* try to find an IBSS channel if none requested ... */ | 263 | /* try to find an IBSS channel if none requested ... */ |
264 | if (!wdev->wext.ibss.chandef.chan) { | 264 | if (!wdev->wext.ibss.chandef.chan) { |
265 | wdev->wext.ibss.chandef.width = NL80211_CHAN_WIDTH_20_NOHT; | 265 | struct ieee80211_channel *new_chan = NULL; |
266 | 266 | ||
267 | for (band = 0; band < IEEE80211_NUM_BANDS; band++) { | 267 | for (band = 0; band < IEEE80211_NUM_BANDS; band++) { |
268 | struct ieee80211_supported_band *sband; | 268 | struct ieee80211_supported_band *sband; |
@@ -278,18 +278,19 @@ int cfg80211_ibss_wext_join(struct cfg80211_registered_device *rdev, | |||
278 | continue; | 278 | continue; |
279 | if (chan->flags & IEEE80211_CHAN_DISABLED) | 279 | if (chan->flags & IEEE80211_CHAN_DISABLED) |
280 | continue; | 280 | continue; |
281 | wdev->wext.ibss.chandef.chan = chan; | 281 | new_chan = chan; |
282 | wdev->wext.ibss.chandef.center_freq1 = | ||
283 | chan->center_freq; | ||
284 | break; | 282 | break; |
285 | } | 283 | } |
286 | 284 | ||
287 | if (wdev->wext.ibss.chandef.chan) | 285 | if (new_chan) |
288 | break; | 286 | break; |
289 | } | 287 | } |
290 | 288 | ||
291 | if (!wdev->wext.ibss.chandef.chan) | 289 | if (!new_chan) |
292 | return -EINVAL; | 290 | return -EINVAL; |
291 | |||
292 | cfg80211_chandef_create(&wdev->wext.ibss.chandef, new_chan, | ||
293 | NL80211_CHAN_NO_HT); | ||
293 | } | 294 | } |
294 | 295 | ||
295 | /* don't join -- SSID is not there */ | 296 | /* don't join -- SSID is not there */ |
@@ -363,9 +364,8 @@ int cfg80211_ibss_wext_siwfreq(struct net_device *dev, | |||
363 | return err; | 364 | return err; |
364 | 365 | ||
365 | if (chan) { | 366 | if (chan) { |
366 | wdev->wext.ibss.chandef.chan = chan; | 367 | cfg80211_chandef_create(&wdev->wext.ibss.chandef, chan, |
367 | wdev->wext.ibss.chandef.width = NL80211_CHAN_WIDTH_20_NOHT; | 368 | NL80211_CHAN_NO_HT); |
368 | wdev->wext.ibss.chandef.center_freq1 = freq; | ||
369 | wdev->wext.ibss.channel_fixed = true; | 369 | wdev->wext.ibss.channel_fixed = true; |
370 | } else { | 370 | } else { |
371 | /* cfg80211_ibss_wext_join will pick one if needed */ | 371 | /* cfg80211_ibss_wext_join will pick one if needed */ |
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index a1eb21073176..138dc3bb8b67 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c | |||
@@ -2687,7 +2687,7 @@ static int nl80211_get_key(struct sk_buff *skb, struct genl_info *info) | |||
2687 | hdr = nl80211hdr_put(msg, info->snd_portid, info->snd_seq, 0, | 2687 | hdr = nl80211hdr_put(msg, info->snd_portid, info->snd_seq, 0, |
2688 | NL80211_CMD_NEW_KEY); | 2688 | NL80211_CMD_NEW_KEY); |
2689 | if (!hdr) | 2689 | if (!hdr) |
2690 | return -ENOBUFS; | 2690 | goto nla_put_failure; |
2691 | 2691 | ||
2692 | cookie.msg = msg; | 2692 | cookie.msg = msg; |
2693 | cookie.idx = key_idx; | 2693 | cookie.idx = key_idx; |
@@ -5349,6 +5349,10 @@ static int nl80211_trigger_scan(struct sk_buff *skb, struct genl_info *info) | |||
5349 | err = -EINVAL; | 5349 | err = -EINVAL; |
5350 | goto out_free; | 5350 | goto out_free; |
5351 | } | 5351 | } |
5352 | |||
5353 | if (!wiphy->bands[band]) | ||
5354 | continue; | ||
5355 | |||
5352 | err = ieee80211_get_ratemask(wiphy->bands[band], | 5356 | err = ieee80211_get_ratemask(wiphy->bands[band], |
5353 | nla_data(attr), | 5357 | nla_data(attr), |
5354 | nla_len(attr), | 5358 | nla_len(attr), |
@@ -9633,8 +9637,9 @@ static int nl80211_add_scan_req(struct sk_buff *msg, | |||
9633 | nla_put(msg, NL80211_ATTR_IE, req->ie_len, req->ie)) | 9637 | nla_put(msg, NL80211_ATTR_IE, req->ie_len, req->ie)) |
9634 | goto nla_put_failure; | 9638 | goto nla_put_failure; |
9635 | 9639 | ||
9636 | if (req->flags) | 9640 | if (req->flags && |
9637 | nla_put_u32(msg, NL80211_ATTR_SCAN_FLAGS, req->flags); | 9641 | nla_put_u32(msg, NL80211_ATTR_SCAN_FLAGS, req->flags)) |
9642 | goto nla_put_failure; | ||
9638 | 9643 | ||
9639 | return 0; | 9644 | return 0; |
9640 | nla_put_failure: | 9645 | nla_put_failure: |
@@ -11093,6 +11098,8 @@ void cfg80211_report_wowlan_wakeup(struct wireless_dev *wdev, | |||
11093 | struct nlattr *reasons; | 11098 | struct nlattr *reasons; |
11094 | 11099 | ||
11095 | reasons = nla_nest_start(msg, NL80211_ATTR_WOWLAN_TRIGGERS); | 11100 | reasons = nla_nest_start(msg, NL80211_ATTR_WOWLAN_TRIGGERS); |
11101 | if (!reasons) | ||
11102 | goto free_msg; | ||
11096 | 11103 | ||
11097 | if (wakeup->disconnect && | 11104 | if (wakeup->disconnect && |
11098 | nla_put_flag(msg, NL80211_WOWLAN_TRIG_DISCONNECT)) | 11105 | nla_put_flag(msg, NL80211_WOWLAN_TRIG_DISCONNECT)) |
@@ -11118,16 +11125,18 @@ void cfg80211_report_wowlan_wakeup(struct wireless_dev *wdev, | |||
11118 | wakeup->pattern_idx)) | 11125 | wakeup->pattern_idx)) |
11119 | goto free_msg; | 11126 | goto free_msg; |
11120 | 11127 | ||
11121 | if (wakeup->tcp_match) | 11128 | if (wakeup->tcp_match && |
11122 | nla_put_flag(msg, NL80211_WOWLAN_TRIG_WAKEUP_TCP_MATCH); | 11129 | nla_put_flag(msg, NL80211_WOWLAN_TRIG_WAKEUP_TCP_MATCH)) |
11130 | goto free_msg; | ||
11123 | 11131 | ||
11124 | if (wakeup->tcp_connlost) | 11132 | if (wakeup->tcp_connlost && |
11125 | nla_put_flag(msg, | 11133 | nla_put_flag(msg, NL80211_WOWLAN_TRIG_WAKEUP_TCP_CONNLOST)) |
11126 | NL80211_WOWLAN_TRIG_WAKEUP_TCP_CONNLOST); | 11134 | goto free_msg; |
11127 | 11135 | ||
11128 | if (wakeup->tcp_nomoretokens) | 11136 | if (wakeup->tcp_nomoretokens && |
11129 | nla_put_flag(msg, | 11137 | nla_put_flag(msg, |
11130 | NL80211_WOWLAN_TRIG_WAKEUP_TCP_NOMORETOKENS); | 11138 | NL80211_WOWLAN_TRIG_WAKEUP_TCP_NOMORETOKENS)) |
11139 | goto free_msg; | ||
11131 | 11140 | ||
11132 | if (wakeup->packet) { | 11141 | if (wakeup->packet) { |
11133 | u32 pkt_attr = NL80211_WOWLAN_TRIG_WAKEUP_PKT_80211; | 11142 | u32 pkt_attr = NL80211_WOWLAN_TRIG_WAKEUP_PKT_80211; |
@@ -11263,24 +11272,29 @@ void cfg80211_ft_event(struct net_device *netdev, | |||
11263 | return; | 11272 | return; |
11264 | 11273 | ||
11265 | hdr = nl80211hdr_put(msg, 0, 0, 0, NL80211_CMD_FT_EVENT); | 11274 | hdr = nl80211hdr_put(msg, 0, 0, 0, NL80211_CMD_FT_EVENT); |
11266 | if (!hdr) { | 11275 | if (!hdr) |
11267 | nlmsg_free(msg); | 11276 | goto out; |
11268 | return; | ||
11269 | } | ||
11270 | 11277 | ||
11271 | nla_put_u32(msg, NL80211_ATTR_WIPHY, rdev->wiphy_idx); | 11278 | if (nla_put_u32(msg, NL80211_ATTR_WIPHY, rdev->wiphy_idx) || |
11272 | nla_put_u32(msg, NL80211_ATTR_IFINDEX, netdev->ifindex); | 11279 | nla_put_u32(msg, NL80211_ATTR_IFINDEX, netdev->ifindex) || |
11273 | nla_put(msg, NL80211_ATTR_MAC, ETH_ALEN, ft_event->target_ap); | 11280 | nla_put(msg, NL80211_ATTR_MAC, ETH_ALEN, ft_event->target_ap)) |
11274 | if (ft_event->ies) | 11281 | goto out; |
11275 | nla_put(msg, NL80211_ATTR_IE, ft_event->ies_len, ft_event->ies); | 11282 | |
11276 | if (ft_event->ric_ies) | 11283 | if (ft_event->ies && |
11277 | nla_put(msg, NL80211_ATTR_IE_RIC, ft_event->ric_ies_len, | 11284 | nla_put(msg, NL80211_ATTR_IE, ft_event->ies_len, ft_event->ies)) |
11278 | ft_event->ric_ies); | 11285 | goto out; |
11286 | if (ft_event->ric_ies && | ||
11287 | nla_put(msg, NL80211_ATTR_IE_RIC, ft_event->ric_ies_len, | ||
11288 | ft_event->ric_ies)) | ||
11289 | goto out; | ||
11279 | 11290 | ||
11280 | genlmsg_end(msg, hdr); | 11291 | genlmsg_end(msg, hdr); |
11281 | 11292 | ||
11282 | genlmsg_multicast_netns(&nl80211_fam, wiphy_net(&rdev->wiphy), msg, 0, | 11293 | genlmsg_multicast_netns(&nl80211_fam, wiphy_net(&rdev->wiphy), msg, 0, |
11283 | NL80211_MCGRP_MLME, GFP_KERNEL); | 11294 | NL80211_MCGRP_MLME, GFP_KERNEL); |
11295 | return; | ||
11296 | out: | ||
11297 | nlmsg_free(msg); | ||
11284 | } | 11298 | } |
11285 | EXPORT_SYMBOL(cfg80211_ft_event); | 11299 | EXPORT_SYMBOL(cfg80211_ft_event); |
11286 | 11300 | ||
diff --git a/scripts/recordmcount.pl b/scripts/recordmcount.pl index d0da66396f62..91280b82da08 100755 --- a/scripts/recordmcount.pl +++ b/scripts/recordmcount.pl | |||
@@ -364,7 +364,8 @@ if ($arch eq "x86_64") { | |||
364 | } elsif ($arch eq "blackfin") { | 364 | } elsif ($arch eq "blackfin") { |
365 | $mcount_regex = "^\\s*([0-9a-fA-F]+):.*\\s__mcount\$"; | 365 | $mcount_regex = "^\\s*([0-9a-fA-F]+):.*\\s__mcount\$"; |
366 | $mcount_adjust = -4; | 366 | $mcount_adjust = -4; |
367 | } elsif ($arch eq "tilegx") { | 367 | } elsif ($arch eq "tilegx" || $arch eq "tile") { |
368 | # Default to the newer TILE-Gx architecture if only "tile" is given. | ||
368 | $mcount_regex = "^\\s*([0-9a-fA-F]+):.*\\s__mcount\$"; | 369 | $mcount_regex = "^\\s*([0-9a-fA-F]+):.*\\s__mcount\$"; |
369 | $type = ".quad"; | 370 | $type = ".quad"; |
370 | $alignment = 8; | 371 | $alignment = 8; |
diff --git a/scripts/sortextable.c b/scripts/sortextable.c index 5f7a8b663cb9..7941fbdfb050 100644 --- a/scripts/sortextable.c +++ b/scripts/sortextable.c | |||
@@ -31,6 +31,10 @@ | |||
31 | #include <tools/be_byteshift.h> | 31 | #include <tools/be_byteshift.h> |
32 | #include <tools/le_byteshift.h> | 32 | #include <tools/le_byteshift.h> |
33 | 33 | ||
34 | #ifndef EM_ARCOMPACT | ||
35 | #define EM_ARCOMPACT 93 | ||
36 | #endif | ||
37 | |||
34 | #ifndef EM_AARCH64 | 38 | #ifndef EM_AARCH64 |
35 | #define EM_AARCH64 183 | 39 | #define EM_AARCH64 183 |
36 | #endif | 40 | #endif |
@@ -268,6 +272,7 @@ do_file(char const *const fname) | |||
268 | case EM_S390: | 272 | case EM_S390: |
269 | custom_sort = sort_relative_table; | 273 | custom_sort = sort_relative_table; |
270 | break; | 274 | break; |
275 | case EM_ARCOMPACT: | ||
271 | case EM_ARM: | 276 | case EM_ARM: |
272 | case EM_AARCH64: | 277 | case EM_AARCH64: |
273 | case EM_MIPS: | 278 | case EM_MIPS: |
diff --git a/security/integrity/ima/ima.h b/security/integrity/ima/ima.h index 9636e17c9f5d..0356e1d437ca 100644 --- a/security/integrity/ima/ima.h +++ b/security/integrity/ima/ima.h | |||
@@ -148,6 +148,7 @@ int ima_alloc_init_template(struct integrity_iint_cache *iint, | |||
148 | int xattr_len, struct ima_template_entry **entry); | 148 | int xattr_len, struct ima_template_entry **entry); |
149 | int ima_store_template(struct ima_template_entry *entry, int violation, | 149 | int ima_store_template(struct ima_template_entry *entry, int violation, |
150 | struct inode *inode, const unsigned char *filename); | 150 | struct inode *inode, const unsigned char *filename); |
151 | void ima_free_template_entry(struct ima_template_entry *entry); | ||
151 | const char *ima_d_path(struct path *path, char **pathbuf); | 152 | const char *ima_d_path(struct path *path, char **pathbuf); |
152 | 153 | ||
153 | /* rbtree tree calls to lookup, insert, delete | 154 | /* rbtree tree calls to lookup, insert, delete |
diff --git a/security/integrity/ima/ima_api.c b/security/integrity/ima/ima_api.c index 80374842fe0b..c38bbce8c6a6 100644 --- a/security/integrity/ima/ima_api.c +++ b/security/integrity/ima/ima_api.c | |||
@@ -22,6 +22,19 @@ | |||
22 | #include "ima.h" | 22 | #include "ima.h" |
23 | 23 | ||
24 | /* | 24 | /* |
25 | * ima_free_template_entry - free an existing template entry | ||
26 | */ | ||
27 | void ima_free_template_entry(struct ima_template_entry *entry) | ||
28 | { | ||
29 | int i; | ||
30 | |||
31 | for (i = 0; i < entry->template_desc->num_fields; i++) | ||
32 | kfree(entry->template_data[i].data); | ||
33 | |||
34 | kfree(entry); | ||
35 | } | ||
36 | |||
37 | /* | ||
25 | * ima_alloc_init_template - create and initialize a new template entry | 38 | * ima_alloc_init_template - create and initialize a new template entry |
26 | */ | 39 | */ |
27 | int ima_alloc_init_template(struct integrity_iint_cache *iint, | 40 | int ima_alloc_init_template(struct integrity_iint_cache *iint, |
@@ -37,6 +50,7 @@ int ima_alloc_init_template(struct integrity_iint_cache *iint, | |||
37 | if (!*entry) | 50 | if (!*entry) |
38 | return -ENOMEM; | 51 | return -ENOMEM; |
39 | 52 | ||
53 | (*entry)->template_desc = template_desc; | ||
40 | for (i = 0; i < template_desc->num_fields; i++) { | 54 | for (i = 0; i < template_desc->num_fields; i++) { |
41 | struct ima_template_field *field = template_desc->fields[i]; | 55 | struct ima_template_field *field = template_desc->fields[i]; |
42 | u32 len; | 56 | u32 len; |
@@ -51,10 +65,9 @@ int ima_alloc_init_template(struct integrity_iint_cache *iint, | |||
51 | (*entry)->template_data_len += sizeof(len); | 65 | (*entry)->template_data_len += sizeof(len); |
52 | (*entry)->template_data_len += len; | 66 | (*entry)->template_data_len += len; |
53 | } | 67 | } |
54 | (*entry)->template_desc = template_desc; | ||
55 | return 0; | 68 | return 0; |
56 | out: | 69 | out: |
57 | kfree(*entry); | 70 | ima_free_template_entry(*entry); |
58 | *entry = NULL; | 71 | *entry = NULL; |
59 | return result; | 72 | return result; |
60 | } | 73 | } |
@@ -134,7 +147,7 @@ void ima_add_violation(struct file *file, const unsigned char *filename, | |||
134 | } | 147 | } |
135 | result = ima_store_template(entry, violation, inode, filename); | 148 | result = ima_store_template(entry, violation, inode, filename); |
136 | if (result < 0) | 149 | if (result < 0) |
137 | kfree(entry); | 150 | ima_free_template_entry(entry); |
138 | err_out: | 151 | err_out: |
139 | integrity_audit_msg(AUDIT_INTEGRITY_PCR, inode, filename, | 152 | integrity_audit_msg(AUDIT_INTEGRITY_PCR, inode, filename, |
140 | op, cause, result, 0); | 153 | op, cause, result, 0); |
@@ -269,7 +282,7 @@ void ima_store_measurement(struct integrity_iint_cache *iint, | |||
269 | if (!result || result == -EEXIST) | 282 | if (!result || result == -EEXIST) |
270 | iint->flags |= IMA_MEASURED; | 283 | iint->flags |= IMA_MEASURED; |
271 | if (result < 0) | 284 | if (result < 0) |
272 | kfree(entry); | 285 | ima_free_template_entry(entry); |
273 | } | 286 | } |
274 | 287 | ||
275 | void ima_audit_measurement(struct integrity_iint_cache *iint, | 288 | void ima_audit_measurement(struct integrity_iint_cache *iint, |
diff --git a/security/integrity/ima/ima_init.c b/security/integrity/ima/ima_init.c index 15f34bd40abe..37122768554a 100644 --- a/security/integrity/ima/ima_init.c +++ b/security/integrity/ima/ima_init.c | |||
@@ -63,7 +63,6 @@ static void __init ima_add_boot_aggregate(void) | |||
63 | result = ima_calc_boot_aggregate(&hash.hdr); | 63 | result = ima_calc_boot_aggregate(&hash.hdr); |
64 | if (result < 0) { | 64 | if (result < 0) { |
65 | audit_cause = "hashing_error"; | 65 | audit_cause = "hashing_error"; |
66 | kfree(entry); | ||
67 | goto err_out; | 66 | goto err_out; |
68 | } | 67 | } |
69 | } | 68 | } |
@@ -76,7 +75,7 @@ static void __init ima_add_boot_aggregate(void) | |||
76 | result = ima_store_template(entry, violation, NULL, | 75 | result = ima_store_template(entry, violation, NULL, |
77 | boot_aggregate_name); | 76 | boot_aggregate_name); |
78 | if (result < 0) | 77 | if (result < 0) |
79 | kfree(entry); | 78 | ima_free_template_entry(entry); |
80 | return; | 79 | return; |
81 | err_out: | 80 | err_out: |
82 | integrity_audit_msg(AUDIT_INTEGRITY_PCR, NULL, boot_aggregate_name, op, | 81 | integrity_audit_msg(AUDIT_INTEGRITY_PCR, NULL, boot_aggregate_name, op, |
diff --git a/security/integrity/ima/ima_template.c b/security/integrity/ima/ima_template.c index 913e1927f916..635695f6a185 100644 --- a/security/integrity/ima/ima_template.c +++ b/security/integrity/ima/ima_template.c | |||
@@ -110,7 +110,7 @@ static int template_desc_init_fields(const char *template_fmt, | |||
110 | struct ima_template_field ***fields, | 110 | struct ima_template_field ***fields, |
111 | int *num_fields) | 111 | int *num_fields) |
112 | { | 112 | { |
113 | char *c, *template_fmt_copy; | 113 | char *c, *template_fmt_copy, *template_fmt_ptr; |
114 | int template_num_fields = template_fmt_size(template_fmt); | 114 | int template_num_fields = template_fmt_size(template_fmt); |
115 | int i, result = 0; | 115 | int i, result = 0; |
116 | 116 | ||
@@ -127,7 +127,9 @@ static int template_desc_init_fields(const char *template_fmt, | |||
127 | result = -ENOMEM; | 127 | result = -ENOMEM; |
128 | goto out; | 128 | goto out; |
129 | } | 129 | } |
130 | for (i = 0; (c = strsep(&template_fmt_copy, "|")) != NULL && | 130 | |
131 | template_fmt_ptr = template_fmt_copy; | ||
132 | for (i = 0; (c = strsep(&template_fmt_ptr, "|")) != NULL && | ||
131 | i < template_num_fields; i++) { | 133 | i < template_num_fields; i++) { |
132 | struct ima_template_field *f = lookup_template_field(c); | 134 | struct ima_template_field *f = lookup_template_field(c); |
133 | 135 | ||
diff --git a/security/keys/big_key.c b/security/keys/big_key.c index 7f44c3207a9b..8137b27d641d 100644 --- a/security/keys/big_key.c +++ b/security/keys/big_key.c | |||
@@ -70,7 +70,7 @@ int big_key_instantiate(struct key *key, struct key_preparsed_payload *prep) | |||
70 | * | 70 | * |
71 | * TODO: Encrypt the stored data with a temporary key. | 71 | * TODO: Encrypt the stored data with a temporary key. |
72 | */ | 72 | */ |
73 | file = shmem_file_setup("", datalen, 0); | 73 | file = shmem_kernel_file_setup("", datalen, 0); |
74 | if (IS_ERR(file)) { | 74 | if (IS_ERR(file)) { |
75 | ret = PTR_ERR(file); | 75 | ret = PTR_ERR(file); |
76 | goto err_quota; | 76 | goto err_quota; |
diff --git a/security/keys/key.c b/security/keys/key.c index 55d110f0aced..6e21c11e48bc 100644 --- a/security/keys/key.c +++ b/security/keys/key.c | |||
@@ -272,7 +272,7 @@ struct key *key_alloc(struct key_type *type, const char *desc, | |||
272 | } | 272 | } |
273 | 273 | ||
274 | /* allocate and initialise the key and its description */ | 274 | /* allocate and initialise the key and its description */ |
275 | key = kmem_cache_alloc(key_jar, GFP_KERNEL); | 275 | key = kmem_cache_zalloc(key_jar, GFP_KERNEL); |
276 | if (!key) | 276 | if (!key) |
277 | goto no_memory_2; | 277 | goto no_memory_2; |
278 | 278 | ||
@@ -293,18 +293,12 @@ struct key *key_alloc(struct key_type *type, const char *desc, | |||
293 | key->uid = uid; | 293 | key->uid = uid; |
294 | key->gid = gid; | 294 | key->gid = gid; |
295 | key->perm = perm; | 295 | key->perm = perm; |
296 | key->flags = 0; | ||
297 | key->expiry = 0; | ||
298 | key->payload.data = NULL; | ||
299 | key->security = NULL; | ||
300 | 296 | ||
301 | if (!(flags & KEY_ALLOC_NOT_IN_QUOTA)) | 297 | if (!(flags & KEY_ALLOC_NOT_IN_QUOTA)) |
302 | key->flags |= 1 << KEY_FLAG_IN_QUOTA; | 298 | key->flags |= 1 << KEY_FLAG_IN_QUOTA; |
303 | if (flags & KEY_ALLOC_TRUSTED) | 299 | if (flags & KEY_ALLOC_TRUSTED) |
304 | key->flags |= 1 << KEY_FLAG_TRUSTED; | 300 | key->flags |= 1 << KEY_FLAG_TRUSTED; |
305 | 301 | ||
306 | memset(&key->type_data, 0, sizeof(key->type_data)); | ||
307 | |||
308 | #ifdef KEY_DEBUGGING | 302 | #ifdef KEY_DEBUGGING |
309 | key->magic = KEY_DEBUG_MAGIC; | 303 | key->magic = KEY_DEBUG_MAGIC; |
310 | #endif | 304 | #endif |
diff --git a/security/keys/keyring.c b/security/keys/keyring.c index 69f0cb7bab7e..d46cbc5e335e 100644 --- a/security/keys/keyring.c +++ b/security/keys/keyring.c | |||
@@ -160,7 +160,7 @@ static u64 mult_64x32_and_fold(u64 x, u32 y) | |||
160 | static unsigned long hash_key_type_and_desc(const struct keyring_index_key *index_key) | 160 | static unsigned long hash_key_type_and_desc(const struct keyring_index_key *index_key) |
161 | { | 161 | { |
162 | const unsigned level_shift = ASSOC_ARRAY_LEVEL_STEP; | 162 | const unsigned level_shift = ASSOC_ARRAY_LEVEL_STEP; |
163 | const unsigned long level_mask = ASSOC_ARRAY_LEVEL_STEP_MASK; | 163 | const unsigned long fan_mask = ASSOC_ARRAY_FAN_MASK; |
164 | const char *description = index_key->description; | 164 | const char *description = index_key->description; |
165 | unsigned long hash, type; | 165 | unsigned long hash, type; |
166 | u32 piece; | 166 | u32 piece; |
@@ -194,10 +194,10 @@ static unsigned long hash_key_type_and_desc(const struct keyring_index_key *inde | |||
194 | * ordinary keys by making sure the lowest level segment in the hash is | 194 | * ordinary keys by making sure the lowest level segment in the hash is |
195 | * zero for keyrings and non-zero otherwise. | 195 | * zero for keyrings and non-zero otherwise. |
196 | */ | 196 | */ |
197 | if (index_key->type != &key_type_keyring && (hash & level_mask) == 0) | 197 | if (index_key->type != &key_type_keyring && (hash & fan_mask) == 0) |
198 | return hash | (hash >> (ASSOC_ARRAY_KEY_CHUNK_SIZE - level_shift)) | 1; | 198 | return hash | (hash >> (ASSOC_ARRAY_KEY_CHUNK_SIZE - level_shift)) | 1; |
199 | if (index_key->type == &key_type_keyring && (hash & level_mask) != 0) | 199 | if (index_key->type == &key_type_keyring && (hash & fan_mask) != 0) |
200 | return (hash + (hash << level_shift)) & ~level_mask; | 200 | return (hash + (hash << level_shift)) & ~fan_mask; |
201 | return hash; | 201 | return hash; |
202 | } | 202 | } |
203 | 203 | ||
@@ -279,12 +279,11 @@ static bool keyring_compare_object(const void *object, const void *data) | |||
279 | * Compare the index keys of a pair of objects and determine the bit position | 279 | * Compare the index keys of a pair of objects and determine the bit position |
280 | * at which they differ - if they differ. | 280 | * at which they differ - if they differ. |
281 | */ | 281 | */ |
282 | static int keyring_diff_objects(const void *_a, const void *_b) | 282 | static int keyring_diff_objects(const void *object, const void *data) |
283 | { | 283 | { |
284 | const struct key *key_a = keyring_ptr_to_key(_a); | 284 | const struct key *key_a = keyring_ptr_to_key(object); |
285 | const struct key *key_b = keyring_ptr_to_key(_b); | ||
286 | const struct keyring_index_key *a = &key_a->index_key; | 285 | const struct keyring_index_key *a = &key_a->index_key; |
287 | const struct keyring_index_key *b = &key_b->index_key; | 286 | const struct keyring_index_key *b = data; |
288 | unsigned long seg_a, seg_b; | 287 | unsigned long seg_a, seg_b; |
289 | int level, i; | 288 | int level, i; |
290 | 289 | ||
@@ -691,8 +690,8 @@ descend_to_node: | |||
691 | smp_read_barrier_depends(); | 690 | smp_read_barrier_depends(); |
692 | ptr = ACCESS_ONCE(shortcut->next_node); | 691 | ptr = ACCESS_ONCE(shortcut->next_node); |
693 | BUG_ON(!assoc_array_ptr_is_node(ptr)); | 692 | BUG_ON(!assoc_array_ptr_is_node(ptr)); |
694 | node = assoc_array_ptr_to_node(ptr); | ||
695 | } | 693 | } |
694 | node = assoc_array_ptr_to_node(ptr); | ||
696 | 695 | ||
697 | begin_node: | 696 | begin_node: |
698 | kdebug("begin_node"); | 697 | kdebug("begin_node"); |
diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c index 794c3ca49eac..419491d8e7d2 100644 --- a/security/selinux/hooks.c +++ b/security/selinux/hooks.c | |||
@@ -53,6 +53,7 @@ | |||
53 | #include <net/ip.h> /* for local_port_range[] */ | 53 | #include <net/ip.h> /* for local_port_range[] */ |
54 | #include <net/sock.h> | 54 | #include <net/sock.h> |
55 | #include <net/tcp.h> /* struct or_callable used in sock_rcv_skb */ | 55 | #include <net/tcp.h> /* struct or_callable used in sock_rcv_skb */ |
56 | #include <net/inet_connection_sock.h> | ||
56 | #include <net/net_namespace.h> | 57 | #include <net/net_namespace.h> |
57 | #include <net/netlabel.h> | 58 | #include <net/netlabel.h> |
58 | #include <linux/uaccess.h> | 59 | #include <linux/uaccess.h> |
@@ -95,10 +96,6 @@ | |||
95 | #include "audit.h" | 96 | #include "audit.h" |
96 | #include "avc_ss.h" | 97 | #include "avc_ss.h" |
97 | 98 | ||
98 | #define SB_TYPE_FMT "%s%s%s" | ||
99 | #define SB_SUBTYPE(sb) (sb->s_subtype && sb->s_subtype[0]) | ||
100 | #define SB_TYPE_ARGS(sb) sb->s_type->name, SB_SUBTYPE(sb) ? "." : "", SB_SUBTYPE(sb) ? sb->s_subtype : "" | ||
101 | |||
102 | extern struct security_operations *security_ops; | 99 | extern struct security_operations *security_ops; |
103 | 100 | ||
104 | /* SECMARK reference count */ | 101 | /* SECMARK reference count */ |
@@ -413,8 +410,8 @@ static int sb_finish_set_opts(struct super_block *sb) | |||
413 | the first boot of the SELinux kernel before we have | 410 | the first boot of the SELinux kernel before we have |
414 | assigned xattr values to the filesystem. */ | 411 | assigned xattr values to the filesystem. */ |
415 | if (!root_inode->i_op->getxattr) { | 412 | if (!root_inode->i_op->getxattr) { |
416 | printk(KERN_WARNING "SELinux: (dev %s, type "SB_TYPE_FMT") has no " | 413 | printk(KERN_WARNING "SELinux: (dev %s, type %s) has no " |
417 | "xattr support\n", sb->s_id, SB_TYPE_ARGS(sb)); | 414 | "xattr support\n", sb->s_id, sb->s_type->name); |
418 | rc = -EOPNOTSUPP; | 415 | rc = -EOPNOTSUPP; |
419 | goto out; | 416 | goto out; |
420 | } | 417 | } |
@@ -422,22 +419,22 @@ static int sb_finish_set_opts(struct super_block *sb) | |||
422 | if (rc < 0 && rc != -ENODATA) { | 419 | if (rc < 0 && rc != -ENODATA) { |
423 | if (rc == -EOPNOTSUPP) | 420 | if (rc == -EOPNOTSUPP) |
424 | printk(KERN_WARNING "SELinux: (dev %s, type " | 421 | printk(KERN_WARNING "SELinux: (dev %s, type " |
425 | SB_TYPE_FMT") has no security xattr handler\n", | 422 | "%s) has no security xattr handler\n", |
426 | sb->s_id, SB_TYPE_ARGS(sb)); | 423 | sb->s_id, sb->s_type->name); |
427 | else | 424 | else |
428 | printk(KERN_WARNING "SELinux: (dev %s, type " | 425 | printk(KERN_WARNING "SELinux: (dev %s, type " |
429 | SB_TYPE_FMT") getxattr errno %d\n", sb->s_id, | 426 | "%s) getxattr errno %d\n", sb->s_id, |
430 | SB_TYPE_ARGS(sb), -rc); | 427 | sb->s_type->name, -rc); |
431 | goto out; | 428 | goto out; |
432 | } | 429 | } |
433 | } | 430 | } |
434 | 431 | ||
435 | if (sbsec->behavior > ARRAY_SIZE(labeling_behaviors)) | 432 | if (sbsec->behavior > ARRAY_SIZE(labeling_behaviors)) |
436 | printk(KERN_ERR "SELinux: initialized (dev %s, type "SB_TYPE_FMT"), unknown behavior\n", | 433 | printk(KERN_ERR "SELinux: initialized (dev %s, type %s), unknown behavior\n", |
437 | sb->s_id, SB_TYPE_ARGS(sb)); | 434 | sb->s_id, sb->s_type->name); |
438 | else | 435 | else |
439 | printk(KERN_DEBUG "SELinux: initialized (dev %s, type "SB_TYPE_FMT"), %s\n", | 436 | printk(KERN_DEBUG "SELinux: initialized (dev %s, type %s), %s\n", |
440 | sb->s_id, SB_TYPE_ARGS(sb), | 437 | sb->s_id, sb->s_type->name, |
441 | labeling_behaviors[sbsec->behavior-1]); | 438 | labeling_behaviors[sbsec->behavior-1]); |
442 | 439 | ||
443 | sbsec->flags |= SE_SBINITIALIZED; | 440 | sbsec->flags |= SE_SBINITIALIZED; |
@@ -600,6 +597,7 @@ static int selinux_set_mnt_opts(struct super_block *sb, | |||
600 | const struct cred *cred = current_cred(); | 597 | const struct cred *cred = current_cred(); |
601 | int rc = 0, i; | 598 | int rc = 0, i; |
602 | struct superblock_security_struct *sbsec = sb->s_security; | 599 | struct superblock_security_struct *sbsec = sb->s_security; |
600 | const char *name = sb->s_type->name; | ||
603 | struct inode *inode = sbsec->sb->s_root->d_inode; | 601 | struct inode *inode = sbsec->sb->s_root->d_inode; |
604 | struct inode_security_struct *root_isec = inode->i_security; | 602 | struct inode_security_struct *root_isec = inode->i_security; |
605 | u32 fscontext_sid = 0, context_sid = 0, rootcontext_sid = 0; | 603 | u32 fscontext_sid = 0, context_sid = 0, rootcontext_sid = 0; |
@@ -658,8 +656,8 @@ static int selinux_set_mnt_opts(struct super_block *sb, | |||
658 | strlen(mount_options[i]), &sid); | 656 | strlen(mount_options[i]), &sid); |
659 | if (rc) { | 657 | if (rc) { |
660 | printk(KERN_WARNING "SELinux: security_context_to_sid" | 658 | printk(KERN_WARNING "SELinux: security_context_to_sid" |
661 | "(%s) failed for (dev %s, type "SB_TYPE_FMT") errno=%d\n", | 659 | "(%s) failed for (dev %s, type %s) errno=%d\n", |
662 | mount_options[i], sb->s_id, SB_TYPE_ARGS(sb), rc); | 660 | mount_options[i], sb->s_id, name, rc); |
663 | goto out; | 661 | goto out; |
664 | } | 662 | } |
665 | switch (flags[i]) { | 663 | switch (flags[i]) { |
@@ -806,8 +804,7 @@ out: | |||
806 | out_double_mount: | 804 | out_double_mount: |
807 | rc = -EINVAL; | 805 | rc = -EINVAL; |
808 | printk(KERN_WARNING "SELinux: mount invalid. Same superblock, different " | 806 | printk(KERN_WARNING "SELinux: mount invalid. Same superblock, different " |
809 | "security settings for (dev %s, type "SB_TYPE_FMT")\n", sb->s_id, | 807 | "security settings for (dev %s, type %s)\n", sb->s_id, name); |
810 | SB_TYPE_ARGS(sb)); | ||
811 | goto out; | 808 | goto out; |
812 | } | 809 | } |
813 | 810 | ||
@@ -2480,8 +2477,8 @@ static int selinux_sb_remount(struct super_block *sb, void *data) | |||
2480 | rc = security_context_to_sid(mount_options[i], len, &sid); | 2477 | rc = security_context_to_sid(mount_options[i], len, &sid); |
2481 | if (rc) { | 2478 | if (rc) { |
2482 | printk(KERN_WARNING "SELinux: security_context_to_sid" | 2479 | printk(KERN_WARNING "SELinux: security_context_to_sid" |
2483 | "(%s) failed for (dev %s, type "SB_TYPE_FMT") errno=%d\n", | 2480 | "(%s) failed for (dev %s, type %s) errno=%d\n", |
2484 | mount_options[i], sb->s_id, SB_TYPE_ARGS(sb), rc); | 2481 | mount_options[i], sb->s_id, sb->s_type->name, rc); |
2485 | goto out_free_opts; | 2482 | goto out_free_opts; |
2486 | } | 2483 | } |
2487 | rc = -EINVAL; | 2484 | rc = -EINVAL; |
@@ -2519,8 +2516,8 @@ out_free_secdata: | |||
2519 | return rc; | 2516 | return rc; |
2520 | out_bad_option: | 2517 | out_bad_option: |
2521 | printk(KERN_WARNING "SELinux: unable to change security options " | 2518 | printk(KERN_WARNING "SELinux: unable to change security options " |
2522 | "during remount (dev %s, type "SB_TYPE_FMT")\n", sb->s_id, | 2519 | "during remount (dev %s, type=%s)\n", sb->s_id, |
2523 | SB_TYPE_ARGS(sb)); | 2520 | sb->s_type->name); |
2524 | goto out_free_opts; | 2521 | goto out_free_opts; |
2525 | } | 2522 | } |
2526 | 2523 | ||
@@ -3828,7 +3825,7 @@ static int selinux_skb_peerlbl_sid(struct sk_buff *skb, u16 family, u32 *sid) | |||
3828 | u32 nlbl_sid; | 3825 | u32 nlbl_sid; |
3829 | u32 nlbl_type; | 3826 | u32 nlbl_type; |
3830 | 3827 | ||
3831 | err = selinux_skb_xfrm_sid(skb, &xfrm_sid); | 3828 | err = selinux_xfrm_skb_sid(skb, &xfrm_sid); |
3832 | if (unlikely(err)) | 3829 | if (unlikely(err)) |
3833 | return -EACCES; | 3830 | return -EACCES; |
3834 | err = selinux_netlbl_skbuff_getsid(skb, family, &nlbl_type, &nlbl_sid); | 3831 | err = selinux_netlbl_skbuff_getsid(skb, family, &nlbl_type, &nlbl_sid); |
@@ -3846,6 +3843,30 @@ static int selinux_skb_peerlbl_sid(struct sk_buff *skb, u16 family, u32 *sid) | |||
3846 | return 0; | 3843 | return 0; |
3847 | } | 3844 | } |
3848 | 3845 | ||
3846 | /** | ||
3847 | * selinux_conn_sid - Determine the child socket label for a connection | ||
3848 | * @sk_sid: the parent socket's SID | ||
3849 | * @skb_sid: the packet's SID | ||
3850 | * @conn_sid: the resulting connection SID | ||
3851 | * | ||
3852 | * If @skb_sid is valid then the user:role:type information from @sk_sid is | ||
3853 | * combined with the MLS information from @skb_sid in order to create | ||
3854 | * @conn_sid. If @skb_sid is not valid then then @conn_sid is simply a copy | ||
3855 | * of @sk_sid. Returns zero on success, negative values on failure. | ||
3856 | * | ||
3857 | */ | ||
3858 | static int selinux_conn_sid(u32 sk_sid, u32 skb_sid, u32 *conn_sid) | ||
3859 | { | ||
3860 | int err = 0; | ||
3861 | |||
3862 | if (skb_sid != SECSID_NULL) | ||
3863 | err = security_sid_mls_copy(sk_sid, skb_sid, conn_sid); | ||
3864 | else | ||
3865 | *conn_sid = sk_sid; | ||
3866 | |||
3867 | return err; | ||
3868 | } | ||
3869 | |||
3849 | /* socket security operations */ | 3870 | /* socket security operations */ |
3850 | 3871 | ||
3851 | static int socket_sockcreate_sid(const struct task_security_struct *tsec, | 3872 | static int socket_sockcreate_sid(const struct task_security_struct *tsec, |
@@ -4452,7 +4473,7 @@ static int selinux_inet_conn_request(struct sock *sk, struct sk_buff *skb, | |||
4452 | struct sk_security_struct *sksec = sk->sk_security; | 4473 | struct sk_security_struct *sksec = sk->sk_security; |
4453 | int err; | 4474 | int err; |
4454 | u16 family = sk->sk_family; | 4475 | u16 family = sk->sk_family; |
4455 | u32 newsid; | 4476 | u32 connsid; |
4456 | u32 peersid; | 4477 | u32 peersid; |
4457 | 4478 | ||
4458 | /* handle mapped IPv4 packets arriving via IPv6 sockets */ | 4479 | /* handle mapped IPv4 packets arriving via IPv6 sockets */ |
@@ -4462,16 +4483,11 @@ static int selinux_inet_conn_request(struct sock *sk, struct sk_buff *skb, | |||
4462 | err = selinux_skb_peerlbl_sid(skb, family, &peersid); | 4483 | err = selinux_skb_peerlbl_sid(skb, family, &peersid); |
4463 | if (err) | 4484 | if (err) |
4464 | return err; | 4485 | return err; |
4465 | if (peersid == SECSID_NULL) { | 4486 | err = selinux_conn_sid(sksec->sid, peersid, &connsid); |
4466 | req->secid = sksec->sid; | 4487 | if (err) |
4467 | req->peer_secid = SECSID_NULL; | 4488 | return err; |
4468 | } else { | 4489 | req->secid = connsid; |
4469 | err = security_sid_mls_copy(sksec->sid, peersid, &newsid); | 4490 | req->peer_secid = peersid; |
4470 | if (err) | ||
4471 | return err; | ||
4472 | req->secid = newsid; | ||
4473 | req->peer_secid = peersid; | ||
4474 | } | ||
4475 | 4491 | ||
4476 | return selinux_netlbl_inet_conn_request(req, family); | 4492 | return selinux_netlbl_inet_conn_request(req, family); |
4477 | } | 4493 | } |
@@ -4731,6 +4747,7 @@ static unsigned int selinux_ipv6_forward(const struct nf_hook_ops *ops, | |||
4731 | static unsigned int selinux_ip_output(struct sk_buff *skb, | 4747 | static unsigned int selinux_ip_output(struct sk_buff *skb, |
4732 | u16 family) | 4748 | u16 family) |
4733 | { | 4749 | { |
4750 | struct sock *sk; | ||
4734 | u32 sid; | 4751 | u32 sid; |
4735 | 4752 | ||
4736 | if (!netlbl_enabled()) | 4753 | if (!netlbl_enabled()) |
@@ -4739,8 +4756,27 @@ static unsigned int selinux_ip_output(struct sk_buff *skb, | |||
4739 | /* we do this in the LOCAL_OUT path and not the POST_ROUTING path | 4756 | /* we do this in the LOCAL_OUT path and not the POST_ROUTING path |
4740 | * because we want to make sure we apply the necessary labeling | 4757 | * because we want to make sure we apply the necessary labeling |
4741 | * before IPsec is applied so we can leverage AH protection */ | 4758 | * before IPsec is applied so we can leverage AH protection */ |
4742 | if (skb->sk) { | 4759 | sk = skb->sk; |
4743 | struct sk_security_struct *sksec = skb->sk->sk_security; | 4760 | if (sk) { |
4761 | struct sk_security_struct *sksec; | ||
4762 | |||
4763 | if (sk->sk_state == TCP_LISTEN) | ||
4764 | /* if the socket is the listening state then this | ||
4765 | * packet is a SYN-ACK packet which means it needs to | ||
4766 | * be labeled based on the connection/request_sock and | ||
4767 | * not the parent socket. unfortunately, we can't | ||
4768 | * lookup the request_sock yet as it isn't queued on | ||
4769 | * the parent socket until after the SYN-ACK is sent. | ||
4770 | * the "solution" is to simply pass the packet as-is | ||
4771 | * as any IP option based labeling should be copied | ||
4772 | * from the initial connection request (in the IP | ||
4773 | * layer). it is far from ideal, but until we get a | ||
4774 | * security label in the packet itself this is the | ||
4775 | * best we can do. */ | ||
4776 | return NF_ACCEPT; | ||
4777 | |||
4778 | /* standard practice, label using the parent socket */ | ||
4779 | sksec = sk->sk_security; | ||
4744 | sid = sksec->sid; | 4780 | sid = sksec->sid; |
4745 | } else | 4781 | } else |
4746 | sid = SECINITSID_KERNEL; | 4782 | sid = SECINITSID_KERNEL; |
@@ -4810,27 +4846,36 @@ static unsigned int selinux_ip_postroute(struct sk_buff *skb, int ifindex, | |||
4810 | * as fast and as clean as possible. */ | 4846 | * as fast and as clean as possible. */ |
4811 | if (!selinux_policycap_netpeer) | 4847 | if (!selinux_policycap_netpeer) |
4812 | return selinux_ip_postroute_compat(skb, ifindex, family); | 4848 | return selinux_ip_postroute_compat(skb, ifindex, family); |
4849 | |||
4850 | secmark_active = selinux_secmark_enabled(); | ||
4851 | peerlbl_active = selinux_peerlbl_enabled(); | ||
4852 | if (!secmark_active && !peerlbl_active) | ||
4853 | return NF_ACCEPT; | ||
4854 | |||
4855 | sk = skb->sk; | ||
4856 | |||
4813 | #ifdef CONFIG_XFRM | 4857 | #ifdef CONFIG_XFRM |
4814 | /* If skb->dst->xfrm is non-NULL then the packet is undergoing an IPsec | 4858 | /* If skb->dst->xfrm is non-NULL then the packet is undergoing an IPsec |
4815 | * packet transformation so allow the packet to pass without any checks | 4859 | * packet transformation so allow the packet to pass without any checks |
4816 | * since we'll have another chance to perform access control checks | 4860 | * since we'll have another chance to perform access control checks |
4817 | * when the packet is on it's final way out. | 4861 | * when the packet is on it's final way out. |
4818 | * NOTE: there appear to be some IPv6 multicast cases where skb->dst | 4862 | * NOTE: there appear to be some IPv6 multicast cases where skb->dst |
4819 | * is NULL, in this case go ahead and apply access control. */ | 4863 | * is NULL, in this case go ahead and apply access control. |
4820 | if (skb_dst(skb) != NULL && skb_dst(skb)->xfrm != NULL) | 4864 | * NOTE: if this is a local socket (skb->sk != NULL) that is in the |
4865 | * TCP listening state we cannot wait until the XFRM processing | ||
4866 | * is done as we will miss out on the SA label if we do; | ||
4867 | * unfortunately, this means more work, but it is only once per | ||
4868 | * connection. */ | ||
4869 | if (skb_dst(skb) != NULL && skb_dst(skb)->xfrm != NULL && | ||
4870 | !(sk != NULL && sk->sk_state == TCP_LISTEN)) | ||
4821 | return NF_ACCEPT; | 4871 | return NF_ACCEPT; |
4822 | #endif | 4872 | #endif |
4823 | secmark_active = selinux_secmark_enabled(); | ||
4824 | peerlbl_active = selinux_peerlbl_enabled(); | ||
4825 | if (!secmark_active && !peerlbl_active) | ||
4826 | return NF_ACCEPT; | ||
4827 | 4873 | ||
4828 | /* if the packet is being forwarded then get the peer label from the | ||
4829 | * packet itself; otherwise check to see if it is from a local | ||
4830 | * application or the kernel, if from an application get the peer label | ||
4831 | * from the sending socket, otherwise use the kernel's sid */ | ||
4832 | sk = skb->sk; | ||
4833 | if (sk == NULL) { | 4874 | if (sk == NULL) { |
4875 | /* Without an associated socket the packet is either coming | ||
4876 | * from the kernel or it is being forwarded; check the packet | ||
4877 | * to determine which and if the packet is being forwarded | ||
4878 | * query the packet directly to determine the security label. */ | ||
4834 | if (skb->skb_iif) { | 4879 | if (skb->skb_iif) { |
4835 | secmark_perm = PACKET__FORWARD_OUT; | 4880 | secmark_perm = PACKET__FORWARD_OUT; |
4836 | if (selinux_skb_peerlbl_sid(skb, family, &peer_sid)) | 4881 | if (selinux_skb_peerlbl_sid(skb, family, &peer_sid)) |
@@ -4839,7 +4884,45 @@ static unsigned int selinux_ip_postroute(struct sk_buff *skb, int ifindex, | |||
4839 | secmark_perm = PACKET__SEND; | 4884 | secmark_perm = PACKET__SEND; |
4840 | peer_sid = SECINITSID_KERNEL; | 4885 | peer_sid = SECINITSID_KERNEL; |
4841 | } | 4886 | } |
4887 | } else if (sk->sk_state == TCP_LISTEN) { | ||
4888 | /* Locally generated packet but the associated socket is in the | ||
4889 | * listening state which means this is a SYN-ACK packet. In | ||
4890 | * this particular case the correct security label is assigned | ||
4891 | * to the connection/request_sock but unfortunately we can't | ||
4892 | * query the request_sock as it isn't queued on the parent | ||
4893 | * socket until after the SYN-ACK packet is sent; the only | ||
4894 | * viable choice is to regenerate the label like we do in | ||
4895 | * selinux_inet_conn_request(). See also selinux_ip_output() | ||
4896 | * for similar problems. */ | ||
4897 | u32 skb_sid; | ||
4898 | struct sk_security_struct *sksec = sk->sk_security; | ||
4899 | if (selinux_skb_peerlbl_sid(skb, family, &skb_sid)) | ||
4900 | return NF_DROP; | ||
4901 | /* At this point, if the returned skb peerlbl is SECSID_NULL | ||
4902 | * and the packet has been through at least one XFRM | ||
4903 | * transformation then we must be dealing with the "final" | ||
4904 | * form of labeled IPsec packet; since we've already applied | ||
4905 | * all of our access controls on this packet we can safely | ||
4906 | * pass the packet. */ | ||
4907 | if (skb_sid == SECSID_NULL) { | ||
4908 | switch (family) { | ||
4909 | case PF_INET: | ||
4910 | if (IPCB(skb)->flags & IPSKB_XFRM_TRANSFORMED) | ||
4911 | return NF_ACCEPT; | ||
4912 | break; | ||
4913 | case PF_INET6: | ||
4914 | if (IP6CB(skb)->flags & IP6SKB_XFRM_TRANSFORMED) | ||
4915 | return NF_ACCEPT; | ||
4916 | default: | ||
4917 | return NF_DROP_ERR(-ECONNREFUSED); | ||
4918 | } | ||
4919 | } | ||
4920 | if (selinux_conn_sid(sksec->sid, skb_sid, &peer_sid)) | ||
4921 | return NF_DROP; | ||
4922 | secmark_perm = PACKET__SEND; | ||
4842 | } else { | 4923 | } else { |
4924 | /* Locally generated packet, fetch the security label from the | ||
4925 | * associated socket. */ | ||
4843 | struct sk_security_struct *sksec = sk->sk_security; | 4926 | struct sk_security_struct *sksec = sk->sk_security; |
4844 | peer_sid = sksec->sid; | 4927 | peer_sid = sksec->sid; |
4845 | secmark_perm = PACKET__SEND; | 4928 | secmark_perm = PACKET__SEND; |
diff --git a/security/selinux/include/xfrm.h b/security/selinux/include/xfrm.h index 0dec76c64cf5..48c3cc94c168 100644 --- a/security/selinux/include/xfrm.h +++ b/security/selinux/include/xfrm.h | |||
@@ -39,6 +39,7 @@ int selinux_xfrm_sock_rcv_skb(u32 sk_sid, struct sk_buff *skb, | |||
39 | int selinux_xfrm_postroute_last(u32 sk_sid, struct sk_buff *skb, | 39 | int selinux_xfrm_postroute_last(u32 sk_sid, struct sk_buff *skb, |
40 | struct common_audit_data *ad, u8 proto); | 40 | struct common_audit_data *ad, u8 proto); |
41 | int selinux_xfrm_decode_session(struct sk_buff *skb, u32 *sid, int ckall); | 41 | int selinux_xfrm_decode_session(struct sk_buff *skb, u32 *sid, int ckall); |
42 | int selinux_xfrm_skb_sid(struct sk_buff *skb, u32 *sid); | ||
42 | 43 | ||
43 | static inline void selinux_xfrm_notify_policyload(void) | 44 | static inline void selinux_xfrm_notify_policyload(void) |
44 | { | 45 | { |
@@ -79,11 +80,12 @@ static inline int selinux_xfrm_decode_session(struct sk_buff *skb, u32 *sid, | |||
79 | static inline void selinux_xfrm_notify_policyload(void) | 80 | static inline void selinux_xfrm_notify_policyload(void) |
80 | { | 81 | { |
81 | } | 82 | } |
82 | #endif | ||
83 | 83 | ||
84 | static inline int selinux_skb_xfrm_sid(struct sk_buff *skb, u32 *sid) | 84 | static inline int selinux_xfrm_skb_sid(struct sk_buff *skb, u32 *sid) |
85 | { | 85 | { |
86 | return selinux_xfrm_decode_session(skb, sid, 0); | 86 | *sid = SECSID_NULL; |
87 | return 0; | ||
87 | } | 88 | } |
89 | #endif | ||
88 | 90 | ||
89 | #endif /* _SELINUX_XFRM_H_ */ | 91 | #endif /* _SELINUX_XFRM_H_ */ |
diff --git a/security/selinux/ss/services.c b/security/selinux/ss/services.c index ee470a0b5c27..d106733ad987 100644 --- a/security/selinux/ss/services.c +++ b/security/selinux/ss/services.c | |||
@@ -2334,50 +2334,16 @@ int security_fs_use(struct super_block *sb) | |||
2334 | struct ocontext *c; | 2334 | struct ocontext *c; |
2335 | struct superblock_security_struct *sbsec = sb->s_security; | 2335 | struct superblock_security_struct *sbsec = sb->s_security; |
2336 | const char *fstype = sb->s_type->name; | 2336 | const char *fstype = sb->s_type->name; |
2337 | const char *subtype = (sb->s_subtype && sb->s_subtype[0]) ? sb->s_subtype : NULL; | ||
2338 | struct ocontext *base = NULL; | ||
2339 | 2337 | ||
2340 | read_lock(&policy_rwlock); | 2338 | read_lock(&policy_rwlock); |
2341 | 2339 | ||
2342 | for (c = policydb.ocontexts[OCON_FSUSE]; c; c = c->next) { | 2340 | c = policydb.ocontexts[OCON_FSUSE]; |
2343 | char *sub; | 2341 | while (c) { |
2344 | int baselen; | 2342 | if (strcmp(fstype, c->u.name) == 0) |
2345 | |||
2346 | baselen = strlen(fstype); | ||
2347 | |||
2348 | /* if base does not match, this is not the one */ | ||
2349 | if (strncmp(fstype, c->u.name, baselen)) | ||
2350 | continue; | ||
2351 | |||
2352 | /* if there is no subtype, this is the one! */ | ||
2353 | if (!subtype) | ||
2354 | break; | ||
2355 | |||
2356 | /* skip past the base in this entry */ | ||
2357 | sub = c->u.name + baselen; | ||
2358 | |||
2359 | /* entry is only a base. save it. keep looking for subtype */ | ||
2360 | if (sub[0] == '\0') { | ||
2361 | base = c; | ||
2362 | continue; | ||
2363 | } | ||
2364 | |||
2365 | /* entry is not followed by a subtype, so it is not a match */ | ||
2366 | if (sub[0] != '.') | ||
2367 | continue; | ||
2368 | |||
2369 | /* whew, we found a subtype of this fstype */ | ||
2370 | sub++; /* move past '.' */ | ||
2371 | |||
2372 | /* exact match of fstype AND subtype */ | ||
2373 | if (!strcmp(subtype, sub)) | ||
2374 | break; | 2343 | break; |
2344 | c = c->next; | ||
2375 | } | 2345 | } |
2376 | 2346 | ||
2377 | /* in case we had found an fstype match but no subtype match */ | ||
2378 | if (!c) | ||
2379 | c = base; | ||
2380 | |||
2381 | if (c) { | 2347 | if (c) { |
2382 | sbsec->behavior = c->v.behavior; | 2348 | sbsec->behavior = c->v.behavior; |
2383 | if (!c->sid[0]) { | 2349 | if (!c->sid[0]) { |
diff --git a/security/selinux/xfrm.c b/security/selinux/xfrm.c index a91d205ec0c6..0462cb3ff0a7 100644 --- a/security/selinux/xfrm.c +++ b/security/selinux/xfrm.c | |||
@@ -209,19 +209,26 @@ int selinux_xfrm_state_pol_flow_match(struct xfrm_state *x, | |||
209 | NULL) ? 0 : 1); | 209 | NULL) ? 0 : 1); |
210 | } | 210 | } |
211 | 211 | ||
212 | /* | 212 | static u32 selinux_xfrm_skb_sid_egress(struct sk_buff *skb) |
213 | * LSM hook implementation that checks and/or returns the xfrm sid for the | ||
214 | * incoming packet. | ||
215 | */ | ||
216 | int selinux_xfrm_decode_session(struct sk_buff *skb, u32 *sid, int ckall) | ||
217 | { | 213 | { |
218 | u32 sid_session = SECSID_NULL; | 214 | struct dst_entry *dst = skb_dst(skb); |
219 | struct sec_path *sp; | 215 | struct xfrm_state *x; |
220 | 216 | ||
221 | if (skb == NULL) | 217 | if (dst == NULL) |
222 | goto out; | 218 | return SECSID_NULL; |
219 | x = dst->xfrm; | ||
220 | if (x == NULL || !selinux_authorizable_xfrm(x)) | ||
221 | return SECSID_NULL; | ||
222 | |||
223 | return x->security->ctx_sid; | ||
224 | } | ||
225 | |||
226 | static int selinux_xfrm_skb_sid_ingress(struct sk_buff *skb, | ||
227 | u32 *sid, int ckall) | ||
228 | { | ||
229 | u32 sid_session = SECSID_NULL; | ||
230 | struct sec_path *sp = skb->sp; | ||
223 | 231 | ||
224 | sp = skb->sp; | ||
225 | if (sp) { | 232 | if (sp) { |
226 | int i; | 233 | int i; |
227 | 234 | ||
@@ -248,6 +255,30 @@ out: | |||
248 | } | 255 | } |
249 | 256 | ||
250 | /* | 257 | /* |
258 | * LSM hook implementation that checks and/or returns the xfrm sid for the | ||
259 | * incoming packet. | ||
260 | */ | ||
261 | int selinux_xfrm_decode_session(struct sk_buff *skb, u32 *sid, int ckall) | ||
262 | { | ||
263 | if (skb == NULL) { | ||
264 | *sid = SECSID_NULL; | ||
265 | return 0; | ||
266 | } | ||
267 | return selinux_xfrm_skb_sid_ingress(skb, sid, ckall); | ||
268 | } | ||
269 | |||
270 | int selinux_xfrm_skb_sid(struct sk_buff *skb, u32 *sid) | ||
271 | { | ||
272 | int rc; | ||
273 | |||
274 | rc = selinux_xfrm_skb_sid_ingress(skb, sid, 0); | ||
275 | if (rc == 0 && *sid == SECSID_NULL) | ||
276 | *sid = selinux_xfrm_skb_sid_egress(skb); | ||
277 | |||
278 | return rc; | ||
279 | } | ||
280 | |||
281 | /* | ||
251 | * LSM hook implementation that allocs and transfers uctx spec to xfrm_policy. | 282 | * LSM hook implementation that allocs and transfers uctx spec to xfrm_policy. |
252 | */ | 283 | */ |
253 | int selinux_xfrm_policy_alloc(struct xfrm_sec_ctx **ctxp, | 284 | int selinux_xfrm_policy_alloc(struct xfrm_sec_ctx **ctxp, |
@@ -327,19 +358,22 @@ int selinux_xfrm_state_alloc_acquire(struct xfrm_state *x, | |||
327 | return rc; | 358 | return rc; |
328 | 359 | ||
329 | ctx = kmalloc(sizeof(*ctx) + str_len, GFP_ATOMIC); | 360 | ctx = kmalloc(sizeof(*ctx) + str_len, GFP_ATOMIC); |
330 | if (!ctx) | 361 | if (!ctx) { |
331 | return -ENOMEM; | 362 | rc = -ENOMEM; |
363 | goto out; | ||
364 | } | ||
332 | 365 | ||
333 | ctx->ctx_doi = XFRM_SC_DOI_LSM; | 366 | ctx->ctx_doi = XFRM_SC_DOI_LSM; |
334 | ctx->ctx_alg = XFRM_SC_ALG_SELINUX; | 367 | ctx->ctx_alg = XFRM_SC_ALG_SELINUX; |
335 | ctx->ctx_sid = secid; | 368 | ctx->ctx_sid = secid; |
336 | ctx->ctx_len = str_len; | 369 | ctx->ctx_len = str_len; |
337 | memcpy(ctx->ctx_str, ctx_str, str_len); | 370 | memcpy(ctx->ctx_str, ctx_str, str_len); |
338 | kfree(ctx_str); | ||
339 | 371 | ||
340 | x->security = ctx; | 372 | x->security = ctx; |
341 | atomic_inc(&selinux_xfrm_refcount); | 373 | atomic_inc(&selinux_xfrm_refcount); |
342 | return 0; | 374 | out: |
375 | kfree(ctx_str); | ||
376 | return rc; | ||
343 | } | 377 | } |
344 | 378 | ||
345 | /* | 379 | /* |
diff --git a/sound/atmel/abdac.c b/sound/atmel/abdac.c index 872d59e35ee2..721d8fd45685 100644 --- a/sound/atmel/abdac.c +++ b/sound/atmel/abdac.c | |||
@@ -357,7 +357,8 @@ static int set_sample_rates(struct atmel_abdac *dac) | |||
357 | if (new_rate < 0) | 357 | if (new_rate < 0) |
358 | break; | 358 | break; |
359 | /* make sure we are below the ABDAC clock */ | 359 | /* make sure we are below the ABDAC clock */ |
360 | if (new_rate <= clk_get_rate(dac->pclk)) { | 360 | if (index < MAX_NUM_RATES && |
361 | new_rate <= clk_get_rate(dac->pclk)) { | ||
361 | dac->rates[index] = new_rate / 256; | 362 | dac->rates[index] = new_rate / 256; |
362 | index++; | 363 | index++; |
363 | } | 364 | } |
diff --git a/sound/firewire/dice.c b/sound/firewire/dice.c index 57bcd31fcc12..c0aa64941cee 100644 --- a/sound/firewire/dice.c +++ b/sound/firewire/dice.c | |||
@@ -1019,7 +1019,7 @@ static void dice_proc_read(struct snd_info_entry *entry, | |||
1019 | 1019 | ||
1020 | if (dice_proc_read_mem(dice, &tx_rx_header, sections[2], 2) < 0) | 1020 | if (dice_proc_read_mem(dice, &tx_rx_header, sections[2], 2) < 0) |
1021 | return; | 1021 | return; |
1022 | quadlets = min_t(u32, tx_rx_header.size, sizeof(buf.tx)); | 1022 | quadlets = min_t(u32, tx_rx_header.size, sizeof(buf.tx) / 4); |
1023 | for (stream = 0; stream < tx_rx_header.number; ++stream) { | 1023 | for (stream = 0; stream < tx_rx_header.number; ++stream) { |
1024 | if (dice_proc_read_mem(dice, &buf.tx, sections[2] + 2 + | 1024 | if (dice_proc_read_mem(dice, &buf.tx, sections[2] + 2 + |
1025 | stream * tx_rx_header.size, | 1025 | stream * tx_rx_header.size, |
@@ -1045,7 +1045,7 @@ static void dice_proc_read(struct snd_info_entry *entry, | |||
1045 | 1045 | ||
1046 | if (dice_proc_read_mem(dice, &tx_rx_header, sections[4], 2) < 0) | 1046 | if (dice_proc_read_mem(dice, &tx_rx_header, sections[4], 2) < 0) |
1047 | return; | 1047 | return; |
1048 | quadlets = min_t(u32, tx_rx_header.size, sizeof(buf.rx)); | 1048 | quadlets = min_t(u32, tx_rx_header.size, sizeof(buf.rx) / 4); |
1049 | for (stream = 0; stream < tx_rx_header.number; ++stream) { | 1049 | for (stream = 0; stream < tx_rx_header.number; ++stream) { |
1050 | if (dice_proc_read_mem(dice, &buf.rx, sections[4] + 2 + | 1050 | if (dice_proc_read_mem(dice, &buf.rx, sections[4] + 2 + |
1051 | stream * tx_rx_header.size, | 1051 | stream * tx_rx_header.size, |
diff --git a/sound/pci/hda/hda_generic.c b/sound/pci/hda/hda_generic.c index c4671d00babd..c7f6d1cab606 100644 --- a/sound/pci/hda/hda_generic.c +++ b/sound/pci/hda/hda_generic.c | |||
@@ -474,6 +474,20 @@ static void invalidate_nid_path(struct hda_codec *codec, int idx) | |||
474 | memset(path, 0, sizeof(*path)); | 474 | memset(path, 0, sizeof(*path)); |
475 | } | 475 | } |
476 | 476 | ||
477 | /* return a DAC if paired to the given pin by codec driver */ | ||
478 | static hda_nid_t get_preferred_dac(struct hda_codec *codec, hda_nid_t pin) | ||
479 | { | ||
480 | struct hda_gen_spec *spec = codec->spec; | ||
481 | const hda_nid_t *list = spec->preferred_dacs; | ||
482 | |||
483 | if (!list) | ||
484 | return 0; | ||
485 | for (; *list; list += 2) | ||
486 | if (*list == pin) | ||
487 | return list[1]; | ||
488 | return 0; | ||
489 | } | ||
490 | |||
477 | /* look for an empty DAC slot */ | 491 | /* look for an empty DAC slot */ |
478 | static hda_nid_t look_for_dac(struct hda_codec *codec, hda_nid_t pin, | 492 | static hda_nid_t look_for_dac(struct hda_codec *codec, hda_nid_t pin, |
479 | bool is_digital) | 493 | bool is_digital) |
@@ -1192,7 +1206,14 @@ static int try_assign_dacs(struct hda_codec *codec, int num_outs, | |||
1192 | continue; | 1206 | continue; |
1193 | } | 1207 | } |
1194 | 1208 | ||
1195 | dacs[i] = look_for_dac(codec, pin, false); | 1209 | dacs[i] = get_preferred_dac(codec, pin); |
1210 | if (dacs[i]) { | ||
1211 | if (is_dac_already_used(codec, dacs[i])) | ||
1212 | badness += bad->shared_primary; | ||
1213 | } | ||
1214 | |||
1215 | if (!dacs[i]) | ||
1216 | dacs[i] = look_for_dac(codec, pin, false); | ||
1196 | if (!dacs[i] && !i) { | 1217 | if (!dacs[i] && !i) { |
1197 | /* try to steal the DAC of surrounds for the front */ | 1218 | /* try to steal the DAC of surrounds for the front */ |
1198 | for (j = 1; j < num_outs; j++) { | 1219 | for (j = 1; j < num_outs; j++) { |
@@ -4297,6 +4318,26 @@ static unsigned int snd_hda_gen_path_power_filter(struct hda_codec *codec, | |||
4297 | return AC_PWRST_D3; | 4318 | return AC_PWRST_D3; |
4298 | } | 4319 | } |
4299 | 4320 | ||
4321 | /* mute all aamix inputs initially; parse up to the first leaves */ | ||
4322 | static void mute_all_mixer_nid(struct hda_codec *codec, hda_nid_t mix) | ||
4323 | { | ||
4324 | int i, nums; | ||
4325 | const hda_nid_t *conn; | ||
4326 | bool has_amp; | ||
4327 | |||
4328 | nums = snd_hda_get_conn_list(codec, mix, &conn); | ||
4329 | has_amp = nid_has_mute(codec, mix, HDA_INPUT); | ||
4330 | for (i = 0; i < nums; i++) { | ||
4331 | if (has_amp) | ||
4332 | snd_hda_codec_amp_stereo(codec, mix, | ||
4333 | HDA_INPUT, i, | ||
4334 | 0xff, HDA_AMP_MUTE); | ||
4335 | else if (nid_has_volume(codec, conn[i], HDA_OUTPUT)) | ||
4336 | snd_hda_codec_amp_stereo(codec, conn[i], | ||
4337 | HDA_OUTPUT, 0, | ||
4338 | 0xff, HDA_AMP_MUTE); | ||
4339 | } | ||
4340 | } | ||
4300 | 4341 | ||
4301 | /* | 4342 | /* |
4302 | * Parse the given BIOS configuration and set up the hda_gen_spec | 4343 | * Parse the given BIOS configuration and set up the hda_gen_spec |
@@ -4435,6 +4476,10 @@ int snd_hda_gen_parse_auto_config(struct hda_codec *codec, | |||
4435 | } | 4476 | } |
4436 | } | 4477 | } |
4437 | 4478 | ||
4479 | /* mute all aamix input initially */ | ||
4480 | if (spec->mixer_nid) | ||
4481 | mute_all_mixer_nid(codec, spec->mixer_nid); | ||
4482 | |||
4438 | dig_only: | 4483 | dig_only: |
4439 | parse_digital(codec); | 4484 | parse_digital(codec); |
4440 | 4485 | ||
diff --git a/sound/pci/hda/hda_generic.h b/sound/pci/hda/hda_generic.h index 7e45cb44d151..0929a06df812 100644 --- a/sound/pci/hda/hda_generic.h +++ b/sound/pci/hda/hda_generic.h | |||
@@ -249,6 +249,9 @@ struct hda_gen_spec { | |||
249 | const struct badness_table *main_out_badness; | 249 | const struct badness_table *main_out_badness; |
250 | const struct badness_table *extra_out_badness; | 250 | const struct badness_table *extra_out_badness; |
251 | 251 | ||
252 | /* preferred pin/DAC pairs; an array of paired NIDs */ | ||
253 | const hda_nid_t *preferred_dacs; | ||
254 | |||
252 | /* loopback mixing mode */ | 255 | /* loopback mixing mode */ |
253 | bool aamix_mode; | 256 | bool aamix_mode; |
254 | 257 | ||
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c index c6d230193da6..27aa14007cbd 100644 --- a/sound/pci/hda/hda_intel.c +++ b/sound/pci/hda/hda_intel.c | |||
@@ -3876,7 +3876,8 @@ static int azx_probe(struct pci_dev *pci, | |||
3876 | } | 3876 | } |
3877 | 3877 | ||
3878 | dev++; | 3878 | dev++; |
3879 | complete_all(&chip->probe_wait); | 3879 | if (chip->disabled) |
3880 | complete_all(&chip->probe_wait); | ||
3880 | return 0; | 3881 | return 0; |
3881 | 3882 | ||
3882 | out_free: | 3883 | out_free: |
@@ -3953,10 +3954,10 @@ static int azx_probe_continue(struct azx *chip) | |||
3953 | if ((chip->driver_caps & AZX_DCAPS_PM_RUNTIME) || chip->use_vga_switcheroo) | 3954 | if ((chip->driver_caps & AZX_DCAPS_PM_RUNTIME) || chip->use_vga_switcheroo) |
3954 | pm_runtime_put_noidle(&pci->dev); | 3955 | pm_runtime_put_noidle(&pci->dev); |
3955 | 3956 | ||
3956 | return 0; | ||
3957 | |||
3958 | out_free: | 3957 | out_free: |
3959 | chip->init_failed = 1; | 3958 | if (err < 0) |
3959 | chip->init_failed = 1; | ||
3960 | complete_all(&chip->probe_wait); | ||
3960 | return err; | 3961 | return err; |
3961 | } | 3962 | } |
3962 | 3963 | ||
diff --git a/sound/pci/hda/patch_analog.c b/sound/pci/hda/patch_analog.c index 1a83559f4cbd..699262a3e07a 100644 --- a/sound/pci/hda/patch_analog.c +++ b/sound/pci/hda/patch_analog.c | |||
@@ -147,6 +147,8 @@ static void ad_vmaster_eapd_hook(void *private_data, int enabled) | |||
147 | 147 | ||
148 | if (!spec->eapd_nid) | 148 | if (!spec->eapd_nid) |
149 | return; | 149 | return; |
150 | if (codec->inv_eapd) | ||
151 | enabled = !enabled; | ||
150 | snd_hda_codec_update_cache(codec, spec->eapd_nid, 0, | 152 | snd_hda_codec_update_cache(codec, spec->eapd_nid, 0, |
151 | AC_VERB_SET_EAPD_BTLENABLE, | 153 | AC_VERB_SET_EAPD_BTLENABLE, |
152 | enabled ? 0x02 : 0x00); | 154 | enabled ? 0x02 : 0x00); |
@@ -338,6 +340,14 @@ static int patch_ad1986a(struct hda_codec *codec) | |||
338 | { | 340 | { |
339 | int err; | 341 | int err; |
340 | struct ad198x_spec *spec; | 342 | struct ad198x_spec *spec; |
343 | static hda_nid_t preferred_pairs[] = { | ||
344 | 0x1a, 0x03, | ||
345 | 0x1b, 0x03, | ||
346 | 0x1c, 0x04, | ||
347 | 0x1d, 0x05, | ||
348 | 0x1e, 0x03, | ||
349 | 0 | ||
350 | }; | ||
341 | 351 | ||
342 | err = alloc_ad_spec(codec); | 352 | err = alloc_ad_spec(codec); |
343 | if (err < 0) | 353 | if (err < 0) |
@@ -358,6 +368,11 @@ static int patch_ad1986a(struct hda_codec *codec) | |||
358 | * So, let's disable the shared stream. | 368 | * So, let's disable the shared stream. |
359 | */ | 369 | */ |
360 | spec->gen.multiout.no_share_stream = 1; | 370 | spec->gen.multiout.no_share_stream = 1; |
371 | /* give fixed DAC/pin pairs */ | ||
372 | spec->gen.preferred_dacs = preferred_pairs; | ||
373 | |||
374 | /* AD1986A can't manage the dynamic pin on/off smoothly */ | ||
375 | spec->gen.auto_mute_via_amp = 1; | ||
361 | 376 | ||
362 | snd_hda_pick_fixup(codec, ad1986a_fixup_models, ad1986a_fixup_tbl, | 377 | snd_hda_pick_fixup(codec, ad1986a_fixup_models, ad1986a_fixup_tbl, |
363 | ad1986a_fixups); | 378 | ad1986a_fixups); |
@@ -962,6 +977,7 @@ static void ad1884_fixup_hp_eapd(struct hda_codec *codec, | |||
962 | switch (action) { | 977 | switch (action) { |
963 | case HDA_FIXUP_ACT_PRE_PROBE: | 978 | case HDA_FIXUP_ACT_PRE_PROBE: |
964 | spec->gen.vmaster_mute.hook = ad1884_vmaster_hp_gpio_hook; | 979 | spec->gen.vmaster_mute.hook = ad1884_vmaster_hp_gpio_hook; |
980 | spec->gen.own_eapd_ctl = 1; | ||
965 | snd_hda_sequence_write_cache(codec, gpio_init_verbs); | 981 | snd_hda_sequence_write_cache(codec, gpio_init_verbs); |
966 | break; | 982 | break; |
967 | case HDA_FIXUP_ACT_PROBE: | 983 | case HDA_FIXUP_ACT_PROBE: |
diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c index 1f2717f817a0..3fbf2883e06e 100644 --- a/sound/pci/hda/patch_conexant.c +++ b/sound/pci/hda/patch_conexant.c | |||
@@ -2936,7 +2936,6 @@ static const struct snd_pci_quirk cxt5066_cfg_tbl[] = { | |||
2936 | SND_PCI_QUIRK(0x1028, 0x0401, "Dell Vostro 1014", CXT5066_DELL_VOSTRO), | 2936 | SND_PCI_QUIRK(0x1028, 0x0401, "Dell Vostro 1014", CXT5066_DELL_VOSTRO), |
2937 | SND_PCI_QUIRK(0x1028, 0x0408, "Dell Inspiron One 19T", CXT5066_IDEAPAD), | 2937 | SND_PCI_QUIRK(0x1028, 0x0408, "Dell Inspiron One 19T", CXT5066_IDEAPAD), |
2938 | SND_PCI_QUIRK(0x1028, 0x050f, "Dell Inspiron", CXT5066_IDEAPAD), | 2938 | SND_PCI_QUIRK(0x1028, 0x050f, "Dell Inspiron", CXT5066_IDEAPAD), |
2939 | SND_PCI_QUIRK(0x1028, 0x0510, "Dell Vostro", CXT5066_IDEAPAD), | ||
2940 | SND_PCI_QUIRK(0x103c, 0x360b, "HP G60", CXT5066_HP_LAPTOP), | 2939 | SND_PCI_QUIRK(0x103c, 0x360b, "HP G60", CXT5066_HP_LAPTOP), |
2941 | SND_PCI_QUIRK(0x1043, 0x13f3, "Asus A52J", CXT5066_ASUS), | 2940 | SND_PCI_QUIRK(0x1043, 0x13f3, "Asus A52J", CXT5066_ASUS), |
2942 | SND_PCI_QUIRK(0x1043, 0x1643, "Asus K52JU", CXT5066_ASUS), | 2941 | SND_PCI_QUIRK(0x1043, 0x1643, "Asus K52JU", CXT5066_ASUS), |
diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c index 08407bed093e..f281c8068557 100644 --- a/sound/pci/hda/patch_hdmi.c +++ b/sound/pci/hda/patch_hdmi.c | |||
@@ -1142,32 +1142,34 @@ static void hdmi_setup_audio_infoframe(struct hda_codec *codec, | |||
1142 | 1142 | ||
1143 | static bool hdmi_present_sense(struct hdmi_spec_per_pin *per_pin, int repoll); | 1143 | static bool hdmi_present_sense(struct hdmi_spec_per_pin *per_pin, int repoll); |
1144 | 1144 | ||
1145 | static void hdmi_intrinsic_event(struct hda_codec *codec, unsigned int res) | 1145 | static void jack_callback(struct hda_codec *codec, struct hda_jack_tbl *jack) |
1146 | { | 1146 | { |
1147 | struct hdmi_spec *spec = codec->spec; | 1147 | struct hdmi_spec *spec = codec->spec; |
1148 | int pin_idx = pin_nid_to_pin_index(spec, jack->nid); | ||
1149 | if (pin_idx < 0) | ||
1150 | return; | ||
1151 | |||
1152 | if (hdmi_present_sense(get_pin(spec, pin_idx), 1)) | ||
1153 | snd_hda_jack_report_sync(codec); | ||
1154 | } | ||
1155 | |||
1156 | static void hdmi_intrinsic_event(struct hda_codec *codec, unsigned int res) | ||
1157 | { | ||
1148 | int tag = res >> AC_UNSOL_RES_TAG_SHIFT; | 1158 | int tag = res >> AC_UNSOL_RES_TAG_SHIFT; |
1149 | int pin_nid; | ||
1150 | int pin_idx; | ||
1151 | struct hda_jack_tbl *jack; | 1159 | struct hda_jack_tbl *jack; |
1152 | int dev_entry = (res & AC_UNSOL_RES_DE) >> AC_UNSOL_RES_DE_SHIFT; | 1160 | int dev_entry = (res & AC_UNSOL_RES_DE) >> AC_UNSOL_RES_DE_SHIFT; |
1153 | 1161 | ||
1154 | jack = snd_hda_jack_tbl_get_from_tag(codec, tag); | 1162 | jack = snd_hda_jack_tbl_get_from_tag(codec, tag); |
1155 | if (!jack) | 1163 | if (!jack) |
1156 | return; | 1164 | return; |
1157 | pin_nid = jack->nid; | ||
1158 | jack->jack_dirty = 1; | 1165 | jack->jack_dirty = 1; |
1159 | 1166 | ||
1160 | _snd_printd(SND_PR_VERBOSE, | 1167 | _snd_printd(SND_PR_VERBOSE, |
1161 | "HDMI hot plug event: Codec=%d Pin=%d Device=%d Inactive=%d Presence_Detect=%d ELD_Valid=%d\n", | 1168 | "HDMI hot plug event: Codec=%d Pin=%d Device=%d Inactive=%d Presence_Detect=%d ELD_Valid=%d\n", |
1162 | codec->addr, pin_nid, dev_entry, !!(res & AC_UNSOL_RES_IA), | 1169 | codec->addr, jack->nid, dev_entry, !!(res & AC_UNSOL_RES_IA), |
1163 | !!(res & AC_UNSOL_RES_PD), !!(res & AC_UNSOL_RES_ELDV)); | 1170 | !!(res & AC_UNSOL_RES_PD), !!(res & AC_UNSOL_RES_ELDV)); |
1164 | 1171 | ||
1165 | pin_idx = pin_nid_to_pin_index(spec, pin_nid); | 1172 | jack_callback(codec, jack); |
1166 | if (pin_idx < 0) | ||
1167 | return; | ||
1168 | |||
1169 | if (hdmi_present_sense(get_pin(spec, pin_idx), 1)) | ||
1170 | snd_hda_jack_report_sync(codec); | ||
1171 | } | 1173 | } |
1172 | 1174 | ||
1173 | static void hdmi_non_intrinsic_event(struct hda_codec *codec, unsigned int res) | 1175 | static void hdmi_non_intrinsic_event(struct hda_codec *codec, unsigned int res) |
@@ -2095,7 +2097,8 @@ static int generic_hdmi_init(struct hda_codec *codec) | |||
2095 | hda_nid_t pin_nid = per_pin->pin_nid; | 2097 | hda_nid_t pin_nid = per_pin->pin_nid; |
2096 | 2098 | ||
2097 | hdmi_init_pin(codec, pin_nid); | 2099 | hdmi_init_pin(codec, pin_nid); |
2098 | snd_hda_jack_detect_enable(codec, pin_nid, pin_nid); | 2100 | snd_hda_jack_detect_enable_callback(codec, pin_nid, pin_nid, |
2101 | codec->jackpoll_interval > 0 ? jack_callback : NULL); | ||
2099 | } | 2102 | } |
2100 | return 0; | 2103 | return 0; |
2101 | } | 2104 | } |
@@ -2334,8 +2337,9 @@ static int simple_playback_build_controls(struct hda_codec *codec) | |||
2334 | int err; | 2337 | int err; |
2335 | 2338 | ||
2336 | per_cvt = get_cvt(spec, 0); | 2339 | per_cvt = get_cvt(spec, 0); |
2337 | err = snd_hda_create_spdif_out_ctls(codec, per_cvt->cvt_nid, | 2340 | err = snd_hda_create_dig_out_ctls(codec, per_cvt->cvt_nid, |
2338 | per_cvt->cvt_nid); | 2341 | per_cvt->cvt_nid, |
2342 | HDA_PCM_TYPE_HDMI); | ||
2339 | if (err < 0) | 2343 | if (err < 0) |
2340 | return err; | 2344 | return err; |
2341 | return simple_hdmi_build_jack(codec, 0); | 2345 | return simple_hdmi_build_jack(codec, 0); |
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index c770bdba6531..34de5dc2fe9b 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c | |||
@@ -1780,6 +1780,7 @@ enum { | |||
1780 | ALC889_FIXUP_DAC_ROUTE, | 1780 | ALC889_FIXUP_DAC_ROUTE, |
1781 | ALC889_FIXUP_MBP_VREF, | 1781 | ALC889_FIXUP_MBP_VREF, |
1782 | ALC889_FIXUP_IMAC91_VREF, | 1782 | ALC889_FIXUP_IMAC91_VREF, |
1783 | ALC889_FIXUP_MBA21_VREF, | ||
1783 | ALC882_FIXUP_INV_DMIC, | 1784 | ALC882_FIXUP_INV_DMIC, |
1784 | ALC882_FIXUP_NO_PRIMARY_HP, | 1785 | ALC882_FIXUP_NO_PRIMARY_HP, |
1785 | ALC887_FIXUP_ASUS_BASS, | 1786 | ALC887_FIXUP_ASUS_BASS, |
@@ -1884,17 +1885,13 @@ static void alc889_fixup_mbp_vref(struct hda_codec *codec, | |||
1884 | } | 1885 | } |
1885 | } | 1886 | } |
1886 | 1887 | ||
1887 | /* Set VREF on speaker pins on imac91 */ | 1888 | static void alc889_fixup_mac_pins(struct hda_codec *codec, |
1888 | static void alc889_fixup_imac91_vref(struct hda_codec *codec, | 1889 | const hda_nid_t *nids, int num_nids) |
1889 | const struct hda_fixup *fix, int action) | ||
1890 | { | 1890 | { |
1891 | struct alc_spec *spec = codec->spec; | 1891 | struct alc_spec *spec = codec->spec; |
1892 | static hda_nid_t nids[2] = { 0x18, 0x1a }; | ||
1893 | int i; | 1892 | int i; |
1894 | 1893 | ||
1895 | if (action != HDA_FIXUP_ACT_INIT) | 1894 | for (i = 0; i < num_nids; i++) { |
1896 | return; | ||
1897 | for (i = 0; i < ARRAY_SIZE(nids); i++) { | ||
1898 | unsigned int val; | 1895 | unsigned int val; |
1899 | val = snd_hda_codec_get_pin_target(codec, nids[i]); | 1896 | val = snd_hda_codec_get_pin_target(codec, nids[i]); |
1900 | val |= AC_PINCTL_VREF_50; | 1897 | val |= AC_PINCTL_VREF_50; |
@@ -1903,6 +1900,26 @@ static void alc889_fixup_imac91_vref(struct hda_codec *codec, | |||
1903 | spec->gen.keep_vref_in_automute = 1; | 1900 | spec->gen.keep_vref_in_automute = 1; |
1904 | } | 1901 | } |
1905 | 1902 | ||
1903 | /* Set VREF on speaker pins on imac91 */ | ||
1904 | static void alc889_fixup_imac91_vref(struct hda_codec *codec, | ||
1905 | const struct hda_fixup *fix, int action) | ||
1906 | { | ||
1907 | static hda_nid_t nids[2] = { 0x18, 0x1a }; | ||
1908 | |||
1909 | if (action == HDA_FIXUP_ACT_INIT) | ||
1910 | alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids)); | ||
1911 | } | ||
1912 | |||
1913 | /* Set VREF on speaker pins on mba21 */ | ||
1914 | static void alc889_fixup_mba21_vref(struct hda_codec *codec, | ||
1915 | const struct hda_fixup *fix, int action) | ||
1916 | { | ||
1917 | static hda_nid_t nids[2] = { 0x18, 0x19 }; | ||
1918 | |||
1919 | if (action == HDA_FIXUP_ACT_INIT) | ||
1920 | alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids)); | ||
1921 | } | ||
1922 | |||
1906 | /* Don't take HP output as primary | 1923 | /* Don't take HP output as primary |
1907 | * Strangely, the speaker output doesn't work on Vaio Z and some Vaio | 1924 | * Strangely, the speaker output doesn't work on Vaio Z and some Vaio |
1908 | * all-in-one desktop PCs (for example VGC-LN51JGB) through DAC 0x05 | 1925 | * all-in-one desktop PCs (for example VGC-LN51JGB) through DAC 0x05 |
@@ -2102,6 +2119,12 @@ static const struct hda_fixup alc882_fixups[] = { | |||
2102 | .chained = true, | 2119 | .chained = true, |
2103 | .chain_id = ALC882_FIXUP_GPIO1, | 2120 | .chain_id = ALC882_FIXUP_GPIO1, |
2104 | }, | 2121 | }, |
2122 | [ALC889_FIXUP_MBA21_VREF] = { | ||
2123 | .type = HDA_FIXUP_FUNC, | ||
2124 | .v.func = alc889_fixup_mba21_vref, | ||
2125 | .chained = true, | ||
2126 | .chain_id = ALC889_FIXUP_MBP_VREF, | ||
2127 | }, | ||
2105 | [ALC882_FIXUP_INV_DMIC] = { | 2128 | [ALC882_FIXUP_INV_DMIC] = { |
2106 | .type = HDA_FIXUP_FUNC, | 2129 | .type = HDA_FIXUP_FUNC, |
2107 | .v.func = alc_fixup_inv_dmic_0x12, | 2130 | .v.func = alc_fixup_inv_dmic_0x12, |
@@ -2172,7 +2195,7 @@ static const struct snd_pci_quirk alc882_fixup_tbl[] = { | |||
2172 | SND_PCI_QUIRK(0x106b, 0x3000, "iMac", ALC889_FIXUP_MBP_VREF), | 2195 | SND_PCI_QUIRK(0x106b, 0x3000, "iMac", ALC889_FIXUP_MBP_VREF), |
2173 | SND_PCI_QUIRK(0x106b, 0x3200, "iMac 7,1 Aluminum", ALC882_FIXUP_EAPD), | 2196 | SND_PCI_QUIRK(0x106b, 0x3200, "iMac 7,1 Aluminum", ALC882_FIXUP_EAPD), |
2174 | SND_PCI_QUIRK(0x106b, 0x3400, "MacBookAir 1,1", ALC889_FIXUP_MBP_VREF), | 2197 | SND_PCI_QUIRK(0x106b, 0x3400, "MacBookAir 1,1", ALC889_FIXUP_MBP_VREF), |
2175 | SND_PCI_QUIRK(0x106b, 0x3500, "MacBookAir 2,1", ALC889_FIXUP_MBP_VREF), | 2198 | SND_PCI_QUIRK(0x106b, 0x3500, "MacBookAir 2,1", ALC889_FIXUP_MBA21_VREF), |
2176 | SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889_FIXUP_MBP_VREF), | 2199 | SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889_FIXUP_MBP_VREF), |
2177 | SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC889_FIXUP_MBP_VREF), | 2200 | SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC889_FIXUP_MBP_VREF), |
2178 | SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_FIXUP_MACPRO_GPIO), | 2201 | SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_FIXUP_MACPRO_GPIO), |
@@ -3287,6 +3310,7 @@ static void alc_headset_mode_ctia(struct hda_codec *codec) | |||
3287 | alc_write_coef_idx(codec, 0x18, 0x7388); | 3310 | alc_write_coef_idx(codec, 0x18, 0x7388); |
3288 | break; | 3311 | break; |
3289 | case 0x10ec0668: | 3312 | case 0x10ec0668: |
3313 | alc_write_coef_idx(codec, 0x11, 0x0001); | ||
3290 | alc_write_coef_idx(codec, 0x15, 0x0d60); | 3314 | alc_write_coef_idx(codec, 0x15, 0x0d60); |
3291 | alc_write_coef_idx(codec, 0xc3, 0x0000); | 3315 | alc_write_coef_idx(codec, 0xc3, 0x0000); |
3292 | break; | 3316 | break; |
@@ -3315,6 +3339,7 @@ static void alc_headset_mode_omtp(struct hda_codec *codec) | |||
3315 | alc_write_coef_idx(codec, 0x18, 0x7388); | 3339 | alc_write_coef_idx(codec, 0x18, 0x7388); |
3316 | break; | 3340 | break; |
3317 | case 0x10ec0668: | 3341 | case 0x10ec0668: |
3342 | alc_write_coef_idx(codec, 0x11, 0x0001); | ||
3318 | alc_write_coef_idx(codec, 0x15, 0x0d50); | 3343 | alc_write_coef_idx(codec, 0x15, 0x0d50); |
3319 | alc_write_coef_idx(codec, 0xc3, 0x0000); | 3344 | alc_write_coef_idx(codec, 0xc3, 0x0000); |
3320 | break; | 3345 | break; |
@@ -3600,11 +3625,6 @@ static void alc283_hp_automute_hook(struct hda_codec *codec, | |||
3600 | vref); | 3625 | vref); |
3601 | } | 3626 | } |
3602 | 3627 | ||
3603 | static void alc283_chromebook_caps(struct hda_codec *codec) | ||
3604 | { | ||
3605 | snd_hda_override_wcaps(codec, 0x03, 0); | ||
3606 | } | ||
3607 | |||
3608 | static void alc283_fixup_chromebook(struct hda_codec *codec, | 3628 | static void alc283_fixup_chromebook(struct hda_codec *codec, |
3609 | const struct hda_fixup *fix, int action) | 3629 | const struct hda_fixup *fix, int action) |
3610 | { | 3630 | { |
@@ -3613,9 +3633,26 @@ static void alc283_fixup_chromebook(struct hda_codec *codec, | |||
3613 | 3633 | ||
3614 | switch (action) { | 3634 | switch (action) { |
3615 | case HDA_FIXUP_ACT_PRE_PROBE: | 3635 | case HDA_FIXUP_ACT_PRE_PROBE: |
3616 | alc283_chromebook_caps(codec); | 3636 | snd_hda_override_wcaps(codec, 0x03, 0); |
3617 | /* Disable AA-loopback as it causes white noise */ | 3637 | /* Disable AA-loopback as it causes white noise */ |
3618 | spec->gen.mixer_nid = 0; | 3638 | spec->gen.mixer_nid = 0; |
3639 | break; | ||
3640 | case HDA_FIXUP_ACT_INIT: | ||
3641 | /* Enable Line1 input control by verb */ | ||
3642 | val = alc_read_coef_idx(codec, 0x1a); | ||
3643 | alc_write_coef_idx(codec, 0x1a, val | (1 << 4)); | ||
3644 | break; | ||
3645 | } | ||
3646 | } | ||
3647 | |||
3648 | static void alc283_fixup_sense_combo_jack(struct hda_codec *codec, | ||
3649 | const struct hda_fixup *fix, int action) | ||
3650 | { | ||
3651 | struct alc_spec *spec = codec->spec; | ||
3652 | int val; | ||
3653 | |||
3654 | switch (action) { | ||
3655 | case HDA_FIXUP_ACT_PRE_PROBE: | ||
3619 | spec->gen.hp_automute_hook = alc283_hp_automute_hook; | 3656 | spec->gen.hp_automute_hook = alc283_hp_automute_hook; |
3620 | break; | 3657 | break; |
3621 | case HDA_FIXUP_ACT_INIT: | 3658 | case HDA_FIXUP_ACT_INIT: |
@@ -3623,9 +3660,6 @@ static void alc283_fixup_chromebook(struct hda_codec *codec, | |||
3623 | /* Set to manual mode */ | 3660 | /* Set to manual mode */ |
3624 | val = alc_read_coef_idx(codec, 0x06); | 3661 | val = alc_read_coef_idx(codec, 0x06); |
3625 | alc_write_coef_idx(codec, 0x06, val & ~0x000c); | 3662 | alc_write_coef_idx(codec, 0x06, val & ~0x000c); |
3626 | /* Enable Line1 input control by verb */ | ||
3627 | val = alc_read_coef_idx(codec, 0x1a); | ||
3628 | alc_write_coef_idx(codec, 0x1a, val | (1 << 4)); | ||
3629 | break; | 3663 | break; |
3630 | } | 3664 | } |
3631 | } | 3665 | } |
@@ -3815,12 +3849,14 @@ enum { | |||
3815 | ALC269_FIXUP_ASUS_X101, | 3849 | ALC269_FIXUP_ASUS_X101, |
3816 | ALC271_FIXUP_AMIC_MIC2, | 3850 | ALC271_FIXUP_AMIC_MIC2, |
3817 | ALC271_FIXUP_HP_GATE_MIC_JACK, | 3851 | ALC271_FIXUP_HP_GATE_MIC_JACK, |
3852 | ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572, | ||
3818 | ALC269_FIXUP_ACER_AC700, | 3853 | ALC269_FIXUP_ACER_AC700, |
3819 | ALC269_FIXUP_LIMIT_INT_MIC_BOOST, | 3854 | ALC269_FIXUP_LIMIT_INT_MIC_BOOST, |
3820 | ALC269VB_FIXUP_ASUS_ZENBOOK, | 3855 | ALC269VB_FIXUP_ASUS_ZENBOOK, |
3821 | ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED, | 3856 | ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED, |
3822 | ALC269VB_FIXUP_ORDISSIMO_EVE2, | 3857 | ALC269VB_FIXUP_ORDISSIMO_EVE2, |
3823 | ALC283_FIXUP_CHROME_BOOK, | 3858 | ALC283_FIXUP_CHROME_BOOK, |
3859 | ALC283_FIXUP_SENSE_COMBO_JACK, | ||
3824 | ALC282_FIXUP_ASUS_TX300, | 3860 | ALC282_FIXUP_ASUS_TX300, |
3825 | ALC283_FIXUP_INT_MIC, | 3861 | ALC283_FIXUP_INT_MIC, |
3826 | ALC290_FIXUP_MONO_SPEAKERS, | 3862 | ALC290_FIXUP_MONO_SPEAKERS, |
@@ -4076,6 +4112,12 @@ static const struct hda_fixup alc269_fixups[] = { | |||
4076 | .chained = true, | 4112 | .chained = true, |
4077 | .chain_id = ALC271_FIXUP_AMIC_MIC2, | 4113 | .chain_id = ALC271_FIXUP_AMIC_MIC2, |
4078 | }, | 4114 | }, |
4115 | [ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572] = { | ||
4116 | .type = HDA_FIXUP_FUNC, | ||
4117 | .v.func = alc269_fixup_limit_int_mic_boost, | ||
4118 | .chained = true, | ||
4119 | .chain_id = ALC271_FIXUP_HP_GATE_MIC_JACK, | ||
4120 | }, | ||
4079 | [ALC269_FIXUP_ACER_AC700] = { | 4121 | [ALC269_FIXUP_ACER_AC700] = { |
4080 | .type = HDA_FIXUP_PINS, | 4122 | .type = HDA_FIXUP_PINS, |
4081 | .v.pins = (const struct hda_pintbl[]) { | 4123 | .v.pins = (const struct hda_pintbl[]) { |
@@ -4120,6 +4162,12 @@ static const struct hda_fixup alc269_fixups[] = { | |||
4120 | .type = HDA_FIXUP_FUNC, | 4162 | .type = HDA_FIXUP_FUNC, |
4121 | .v.func = alc283_fixup_chromebook, | 4163 | .v.func = alc283_fixup_chromebook, |
4122 | }, | 4164 | }, |
4165 | [ALC283_FIXUP_SENSE_COMBO_JACK] = { | ||
4166 | .type = HDA_FIXUP_FUNC, | ||
4167 | .v.func = alc283_fixup_sense_combo_jack, | ||
4168 | .chained = true, | ||
4169 | .chain_id = ALC283_FIXUP_CHROME_BOOK, | ||
4170 | }, | ||
4123 | [ALC282_FIXUP_ASUS_TX300] = { | 4171 | [ALC282_FIXUP_ASUS_TX300] = { |
4124 | .type = HDA_FIXUP_FUNC, | 4172 | .type = HDA_FIXUP_FUNC, |
4125 | .v.func = alc282_fixup_asus_tx300, | 4173 | .v.func = alc282_fixup_asus_tx300, |
@@ -4167,6 +4215,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { | |||
4167 | SND_PCI_QUIRK(0x1025, 0x0740, "Acer AO725", ALC271_FIXUP_HP_GATE_MIC_JACK), | 4215 | SND_PCI_QUIRK(0x1025, 0x0740, "Acer AO725", ALC271_FIXUP_HP_GATE_MIC_JACK), |
4168 | SND_PCI_QUIRK(0x1025, 0x0742, "Acer AO756", ALC271_FIXUP_HP_GATE_MIC_JACK), | 4216 | SND_PCI_QUIRK(0x1025, 0x0742, "Acer AO756", ALC271_FIXUP_HP_GATE_MIC_JACK), |
4169 | SND_PCI_QUIRK_VENDOR(0x1025, "Acer Aspire", ALC271_FIXUP_DMIC), | 4217 | SND_PCI_QUIRK_VENDOR(0x1025, "Acer Aspire", ALC271_FIXUP_DMIC), |
4218 | SND_PCI_QUIRK(0x1025, 0x0775, "Acer Aspire E1-572", ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572), | ||
4170 | SND_PCI_QUIRK(0x1028, 0x0470, "Dell M101z", ALC269_FIXUP_DELL_M101Z), | 4219 | SND_PCI_QUIRK(0x1028, 0x0470, "Dell M101z", ALC269_FIXUP_DELL_M101Z), |
4171 | SND_PCI_QUIRK(0x1028, 0x05bd, "Dell", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE), | 4220 | SND_PCI_QUIRK(0x1028, 0x05bd, "Dell", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE), |
4172 | SND_PCI_QUIRK(0x1028, 0x05be, "Dell", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE), | 4221 | SND_PCI_QUIRK(0x1028, 0x05be, "Dell", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE), |
@@ -4202,6 +4251,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { | |||
4202 | SND_PCI_QUIRK(0x1028, 0x0614, "Dell Inspiron 3135", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE), | 4251 | SND_PCI_QUIRK(0x1028, 0x0614, "Dell Inspiron 3135", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE), |
4203 | SND_PCI_QUIRK(0x1028, 0x0616, "Dell Vostro 5470", ALC290_FIXUP_MONO_SPEAKERS), | 4252 | SND_PCI_QUIRK(0x1028, 0x0616, "Dell Vostro 5470", ALC290_FIXUP_MONO_SPEAKERS), |
4204 | SND_PCI_QUIRK(0x1028, 0x061f, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE), | 4253 | SND_PCI_QUIRK(0x1028, 0x061f, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE), |
4254 | SND_PCI_QUIRK(0x1028, 0x0638, "Dell Inspiron 5439", ALC290_FIXUP_MONO_SPEAKERS), | ||
4205 | SND_PCI_QUIRK(0x1028, 0x063f, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE), | 4255 | SND_PCI_QUIRK(0x1028, 0x063f, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE), |
4206 | SND_PCI_QUIRK(0x1028, 0x15cc, "Dell X5 Precision", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE), | 4256 | SND_PCI_QUIRK(0x1028, 0x15cc, "Dell X5 Precision", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE), |
4207 | SND_PCI_QUIRK(0x1028, 0x15cd, "Dell X5 Precision", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE), | 4257 | SND_PCI_QUIRK(0x1028, 0x15cd, "Dell X5 Precision", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE), |
@@ -4210,7 +4260,6 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { | |||
4210 | SND_PCI_QUIRK(0x103c, 0x1973, "HP Pavilion", ALC269_FIXUP_HP_MUTE_LED_MIC1), | 4260 | SND_PCI_QUIRK(0x103c, 0x1973, "HP Pavilion", ALC269_FIXUP_HP_MUTE_LED_MIC1), |
4211 | SND_PCI_QUIRK(0x103c, 0x1983, "HP Pavilion", ALC269_FIXUP_HP_MUTE_LED_MIC1), | 4261 | SND_PCI_QUIRK(0x103c, 0x1983, "HP Pavilion", ALC269_FIXUP_HP_MUTE_LED_MIC1), |
4212 | SND_PCI_QUIRK(0x103c, 0x218b, "HP", ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED), | 4262 | SND_PCI_QUIRK(0x103c, 0x218b, "HP", ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED), |
4213 | SND_PCI_QUIRK(0x103c, 0x21ed, "HP Falco Chromebook", ALC283_FIXUP_CHROME_BOOK), | ||
4214 | SND_PCI_QUIRK_VENDOR(0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED), | 4263 | SND_PCI_QUIRK_VENDOR(0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED), |
4215 | SND_PCI_QUIRK(0x1043, 0x103f, "ASUS TX300", ALC282_FIXUP_ASUS_TX300), | 4264 | SND_PCI_QUIRK(0x1043, 0x103f, "ASUS TX300", ALC282_FIXUP_ASUS_TX300), |
4216 | SND_PCI_QUIRK(0x1043, 0x106d, "Asus K53BE", ALC269_FIXUP_LIMIT_INT_MIC_BOOST), | 4265 | SND_PCI_QUIRK(0x1043, 0x106d, "Asus K53BE", ALC269_FIXUP_LIMIT_INT_MIC_BOOST), |
@@ -4318,6 +4367,8 @@ static const struct hda_model_fixup alc269_fixup_models[] = { | |||
4318 | {.id = ALC269_FIXUP_HP_GPIO_LED, .name = "hp-gpio-led"}, | 4367 | {.id = ALC269_FIXUP_HP_GPIO_LED, .name = "hp-gpio-led"}, |
4319 | {.id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "dell-headset-multi"}, | 4368 | {.id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "dell-headset-multi"}, |
4320 | {.id = ALC269_FIXUP_DELL2_MIC_NO_PRESENCE, .name = "dell-headset-dock"}, | 4369 | {.id = ALC269_FIXUP_DELL2_MIC_NO_PRESENCE, .name = "dell-headset-dock"}, |
4370 | {.id = ALC283_FIXUP_CHROME_BOOK, .name = "alc283-chrome"}, | ||
4371 | {.id = ALC283_FIXUP_SENSE_COMBO_JACK, .name = "alc283-sense-combo"}, | ||
4321 | {} | 4372 | {} |
4322 | }; | 4373 | }; |
4323 | 4374 | ||
@@ -4493,6 +4544,7 @@ enum { | |||
4493 | ALC861_FIXUP_AMP_VREF_0F, | 4544 | ALC861_FIXUP_AMP_VREF_0F, |
4494 | ALC861_FIXUP_NO_JACK_DETECT, | 4545 | ALC861_FIXUP_NO_JACK_DETECT, |
4495 | ALC861_FIXUP_ASUS_A6RP, | 4546 | ALC861_FIXUP_ASUS_A6RP, |
4547 | ALC660_FIXUP_ASUS_W7J, | ||
4496 | }; | 4548 | }; |
4497 | 4549 | ||
4498 | /* On some laptops, VREF of pin 0x0f is abused for controlling the main amp */ | 4550 | /* On some laptops, VREF of pin 0x0f is abused for controlling the main amp */ |
@@ -4542,10 +4594,22 @@ static const struct hda_fixup alc861_fixups[] = { | |||
4542 | .v.func = alc861_fixup_asus_amp_vref_0f, | 4594 | .v.func = alc861_fixup_asus_amp_vref_0f, |
4543 | .chained = true, | 4595 | .chained = true, |
4544 | .chain_id = ALC861_FIXUP_NO_JACK_DETECT, | 4596 | .chain_id = ALC861_FIXUP_NO_JACK_DETECT, |
4597 | }, | ||
4598 | [ALC660_FIXUP_ASUS_W7J] = { | ||
4599 | .type = HDA_FIXUP_VERBS, | ||
4600 | .v.verbs = (const struct hda_verb[]) { | ||
4601 | /* ASUS W7J needs a magic pin setup on unused NID 0x10 | ||
4602 | * for enabling outputs | ||
4603 | */ | ||
4604 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, | ||
4605 | { } | ||
4606 | }, | ||
4545 | } | 4607 | } |
4546 | }; | 4608 | }; |
4547 | 4609 | ||
4548 | static const struct snd_pci_quirk alc861_fixup_tbl[] = { | 4610 | static const struct snd_pci_quirk alc861_fixup_tbl[] = { |
4611 | SND_PCI_QUIRK(0x1043, 0x1253, "ASUS W7J", ALC660_FIXUP_ASUS_W7J), | ||
4612 | SND_PCI_QUIRK(0x1043, 0x1263, "ASUS Z35HL", ALC660_FIXUP_ASUS_W7J), | ||
4549 | SND_PCI_QUIRK(0x1043, 0x1393, "ASUS A6Rp", ALC861_FIXUP_ASUS_A6RP), | 4613 | SND_PCI_QUIRK(0x1043, 0x1393, "ASUS A6Rp", ALC861_FIXUP_ASUS_A6RP), |
4550 | SND_PCI_QUIRK_VENDOR(0x1043, "ASUS laptop", ALC861_FIXUP_AMP_VREF_0F), | 4614 | SND_PCI_QUIRK_VENDOR(0x1043, "ASUS laptop", ALC861_FIXUP_AMP_VREF_0F), |
4551 | SND_PCI_QUIRK(0x1462, 0x7254, "HP DX2200", ALC861_FIXUP_NO_JACK_DETECT), | 4615 | SND_PCI_QUIRK(0x1462, 0x7254, "HP DX2200", ALC861_FIXUP_NO_JACK_DETECT), |
@@ -4978,8 +5042,11 @@ static const struct snd_pci_quirk alc662_fixup_tbl[] = { | |||
4978 | SND_PCI_QUIRK(0x1025, 0x038b, "Acer Aspire 8943G", ALC662_FIXUP_ASPIRE), | 5042 | SND_PCI_QUIRK(0x1025, 0x038b, "Acer Aspire 8943G", ALC662_FIXUP_ASPIRE), |
4979 | SND_PCI_QUIRK(0x1028, 0x05d8, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE), | 5043 | SND_PCI_QUIRK(0x1028, 0x05d8, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE), |
4980 | SND_PCI_QUIRK(0x1028, 0x05db, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE), | 5044 | SND_PCI_QUIRK(0x1028, 0x05db, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE), |
5045 | SND_PCI_QUIRK(0x1028, 0x0623, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE), | ||
5046 | SND_PCI_QUIRK(0x1028, 0x0624, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE), | ||
4981 | SND_PCI_QUIRK(0x1028, 0x0625, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE), | 5047 | SND_PCI_QUIRK(0x1028, 0x0625, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE), |
4982 | SND_PCI_QUIRK(0x1028, 0x0626, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE), | 5048 | SND_PCI_QUIRK(0x1028, 0x0626, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE), |
5049 | SND_PCI_QUIRK(0x1028, 0x0628, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE), | ||
4983 | SND_PCI_QUIRK(0x103c, 0x1632, "HP RP5800", ALC662_FIXUP_HP_RP5800), | 5050 | SND_PCI_QUIRK(0x103c, 0x1632, "HP RP5800", ALC662_FIXUP_HP_RP5800), |
4984 | SND_PCI_QUIRK(0x1043, 0x11cd, "Asus N550", ALC662_FIXUP_BASS_1A_CHMAP), | 5051 | SND_PCI_QUIRK(0x1043, 0x11cd, "Asus N550", ALC662_FIXUP_BASS_1A_CHMAP), |
4985 | SND_PCI_QUIRK(0x1043, 0x1477, "ASUS N56VZ", ALC662_FIXUP_BASS_CHMAP), | 5052 | SND_PCI_QUIRK(0x1043, 0x1477, "ASUS N56VZ", ALC662_FIXUP_BASS_CHMAP), |
diff --git a/sound/soc/atmel/sam9x5_wm8731.c b/sound/soc/atmel/sam9x5_wm8731.c index 992ae38d5a15..1b372283bd01 100644 --- a/sound/soc/atmel/sam9x5_wm8731.c +++ b/sound/soc/atmel/sam9x5_wm8731.c | |||
@@ -97,6 +97,8 @@ static int sam9x5_wm8731_driver_probe(struct platform_device *pdev) | |||
97 | goto out; | 97 | goto out; |
98 | } | 98 | } |
99 | 99 | ||
100 | snd_soc_card_set_drvdata(card, priv); | ||
101 | |||
100 | card->dev = &pdev->dev; | 102 | card->dev = &pdev->dev; |
101 | card->owner = THIS_MODULE; | 103 | card->owner = THIS_MODULE; |
102 | card->dai_link = dai; | 104 | card->dai_link = dai; |
diff --git a/sound/soc/codecs/wm5110.c b/sound/soc/codecs/wm5110.c index c3c7396a6181..99b359e19d35 100644 --- a/sound/soc/codecs/wm5110.c +++ b/sound/soc/codecs/wm5110.c | |||
@@ -248,19 +248,6 @@ ARIZONA_MIXER_CONTROLS("SPKDAT1R", ARIZONA_OUT5RMIX_INPUT_1_SOURCE), | |||
248 | ARIZONA_MIXER_CONTROLS("SPKDAT2L", ARIZONA_OUT6LMIX_INPUT_1_SOURCE), | 248 | ARIZONA_MIXER_CONTROLS("SPKDAT2L", ARIZONA_OUT6LMIX_INPUT_1_SOURCE), |
249 | ARIZONA_MIXER_CONTROLS("SPKDAT2R", ARIZONA_OUT6RMIX_INPUT_1_SOURCE), | 249 | ARIZONA_MIXER_CONTROLS("SPKDAT2R", ARIZONA_OUT6RMIX_INPUT_1_SOURCE), |
250 | 250 | ||
251 | SOC_SINGLE("HPOUT1 High Performance Switch", ARIZONA_OUTPUT_PATH_CONFIG_1L, | ||
252 | ARIZONA_OUT1_OSR_SHIFT, 1, 0), | ||
253 | SOC_SINGLE("HPOUT2 High Performance Switch", ARIZONA_OUTPUT_PATH_CONFIG_2L, | ||
254 | ARIZONA_OUT2_OSR_SHIFT, 1, 0), | ||
255 | SOC_SINGLE("HPOUT3 High Performance Switch", ARIZONA_OUTPUT_PATH_CONFIG_3L, | ||
256 | ARIZONA_OUT3_OSR_SHIFT, 1, 0), | ||
257 | SOC_SINGLE("Speaker High Performance Switch", ARIZONA_OUTPUT_PATH_CONFIG_4L, | ||
258 | ARIZONA_OUT4_OSR_SHIFT, 1, 0), | ||
259 | SOC_SINGLE("SPKDAT1 High Performance Switch", ARIZONA_OUTPUT_PATH_CONFIG_5L, | ||
260 | ARIZONA_OUT5_OSR_SHIFT, 1, 0), | ||
261 | SOC_SINGLE("SPKDAT2 High Performance Switch", ARIZONA_OUTPUT_PATH_CONFIG_6L, | ||
262 | ARIZONA_OUT6_OSR_SHIFT, 1, 0), | ||
263 | |||
264 | SOC_DOUBLE_R("HPOUT1 Digital Switch", ARIZONA_DAC_DIGITAL_VOLUME_1L, | 251 | SOC_DOUBLE_R("HPOUT1 Digital Switch", ARIZONA_DAC_DIGITAL_VOLUME_1L, |
265 | ARIZONA_DAC_DIGITAL_VOLUME_1R, ARIZONA_OUT1L_MUTE_SHIFT, 1, 1), | 252 | ARIZONA_DAC_DIGITAL_VOLUME_1R, ARIZONA_OUT1L_MUTE_SHIFT, 1, 1), |
266 | SOC_DOUBLE_R("HPOUT2 Digital Switch", ARIZONA_DAC_DIGITAL_VOLUME_2L, | 253 | SOC_DOUBLE_R("HPOUT2 Digital Switch", ARIZONA_DAC_DIGITAL_VOLUME_2L, |
@@ -293,18 +280,6 @@ SOC_DOUBLE_R_TLV("SPKDAT2 Digital Volume", ARIZONA_DAC_DIGITAL_VOLUME_6L, | |||
293 | ARIZONA_DAC_DIGITAL_VOLUME_6R, ARIZONA_OUT6L_VOL_SHIFT, | 280 | ARIZONA_DAC_DIGITAL_VOLUME_6R, ARIZONA_OUT6L_VOL_SHIFT, |
294 | 0xbf, 0, digital_tlv), | 281 | 0xbf, 0, digital_tlv), |
295 | 282 | ||
296 | SOC_DOUBLE_R_RANGE_TLV("HPOUT1 Volume", ARIZONA_OUTPUT_PATH_CONFIG_1L, | ||
297 | ARIZONA_OUTPUT_PATH_CONFIG_1R, | ||
298 | ARIZONA_OUT1L_PGA_VOL_SHIFT, | ||
299 | 0x34, 0x40, 0, ana_tlv), | ||
300 | SOC_DOUBLE_R_RANGE_TLV("HPOUT2 Volume", ARIZONA_OUTPUT_PATH_CONFIG_2L, | ||
301 | ARIZONA_OUTPUT_PATH_CONFIG_2R, | ||
302 | ARIZONA_OUT2L_PGA_VOL_SHIFT, | ||
303 | 0x34, 0x40, 0, ana_tlv), | ||
304 | SOC_DOUBLE_R_RANGE_TLV("HPOUT3 Volume", ARIZONA_OUTPUT_PATH_CONFIG_3L, | ||
305 | ARIZONA_OUTPUT_PATH_CONFIG_3R, | ||
306 | ARIZONA_OUT3L_PGA_VOL_SHIFT, 0x34, 0x40, 0, ana_tlv), | ||
307 | |||
308 | SOC_DOUBLE("SPKDAT1 Switch", ARIZONA_PDM_SPK1_CTRL_1, ARIZONA_SPK1L_MUTE_SHIFT, | 283 | SOC_DOUBLE("SPKDAT1 Switch", ARIZONA_PDM_SPK1_CTRL_1, ARIZONA_SPK1L_MUTE_SHIFT, |
309 | ARIZONA_SPK1R_MUTE_SHIFT, 1, 1), | 284 | ARIZONA_SPK1R_MUTE_SHIFT, 1, 1), |
310 | SOC_DOUBLE("SPKDAT2 Switch", ARIZONA_PDM_SPK2_CTRL_1, ARIZONA_SPK2L_MUTE_SHIFT, | 285 | SOC_DOUBLE("SPKDAT2 Switch", ARIZONA_PDM_SPK2_CTRL_1, ARIZONA_SPK2L_MUTE_SHIFT, |
diff --git a/sound/soc/codecs/wm8731.c b/sound/soc/codecs/wm8731.c index 456bb8c6d759..bc7472c968e3 100644 --- a/sound/soc/codecs/wm8731.c +++ b/sound/soc/codecs/wm8731.c | |||
@@ -447,10 +447,10 @@ static int wm8731_set_dai_fmt(struct snd_soc_dai *codec_dai, | |||
447 | iface |= 0x0001; | 447 | iface |= 0x0001; |
448 | break; | 448 | break; |
449 | case SND_SOC_DAIFMT_DSP_A: | 449 | case SND_SOC_DAIFMT_DSP_A: |
450 | iface |= 0x0003; | 450 | iface |= 0x0013; |
451 | break; | 451 | break; |
452 | case SND_SOC_DAIFMT_DSP_B: | 452 | case SND_SOC_DAIFMT_DSP_B: |
453 | iface |= 0x0013; | 453 | iface |= 0x0003; |
454 | break; | 454 | break; |
455 | default: | 455 | default: |
456 | return -EINVAL; | 456 | return -EINVAL; |
diff --git a/sound/soc/codecs/wm8990.c b/sound/soc/codecs/wm8990.c index 253c88bb7a4c..4f05fb88bddf 100644 --- a/sound/soc/codecs/wm8990.c +++ b/sound/soc/codecs/wm8990.c | |||
@@ -1259,6 +1259,8 @@ static int wm8990_set_bias_level(struct snd_soc_codec *codec, | |||
1259 | 1259 | ||
1260 | /* disable POBCTRL, SOFT_ST and BUFDCOPEN */ | 1260 | /* disable POBCTRL, SOFT_ST and BUFDCOPEN */ |
1261 | snd_soc_write(codec, WM8990_ANTIPOP2, 0x0); | 1261 | snd_soc_write(codec, WM8990_ANTIPOP2, 0x0); |
1262 | |||
1263 | codec->cache_sync = 1; | ||
1262 | break; | 1264 | break; |
1263 | } | 1265 | } |
1264 | 1266 | ||
diff --git a/sound/soc/fsl/pcm030-audio-fabric.c b/sound/soc/fsl/pcm030-audio-fabric.c index eb4373840bb6..3665f612819d 100644 --- a/sound/soc/fsl/pcm030-audio-fabric.c +++ b/sound/soc/fsl/pcm030-audio-fabric.c | |||
@@ -69,7 +69,6 @@ static int pcm030_fabric_probe(struct platform_device *op) | |||
69 | return -ENOMEM; | 69 | return -ENOMEM; |
70 | 70 | ||
71 | card->dev = &op->dev; | 71 | card->dev = &op->dev; |
72 | platform_set_drvdata(op, pdata); | ||
73 | 72 | ||
74 | pdata->card = card; | 73 | pdata->card = card; |
75 | 74 | ||
@@ -98,6 +97,8 @@ static int pcm030_fabric_probe(struct platform_device *op) | |||
98 | if (ret) | 97 | if (ret) |
99 | dev_err(&op->dev, "snd_soc_register_card() failed: %d\n", ret); | 98 | dev_err(&op->dev, "snd_soc_register_card() failed: %d\n", ret); |
100 | 99 | ||
100 | platform_set_drvdata(op, pdata); | ||
101 | |||
101 | return ret; | 102 | return ret; |
102 | } | 103 | } |
103 | 104 | ||
diff --git a/sound/soc/kirkwood/kirkwood-i2s.c b/sound/soc/kirkwood/kirkwood-i2s.c index d34d91743e3f..0b18f654b413 100644 --- a/sound/soc/kirkwood/kirkwood-i2s.c +++ b/sound/soc/kirkwood/kirkwood-i2s.c | |||
@@ -33,6 +33,10 @@ | |||
33 | SNDRV_PCM_FMTBIT_S24_LE | \ | 33 | SNDRV_PCM_FMTBIT_S24_LE | \ |
34 | SNDRV_PCM_FMTBIT_S32_LE) | 34 | SNDRV_PCM_FMTBIT_S32_LE) |
35 | 35 | ||
36 | #define KIRKWOOD_SPDIF_FORMATS \ | ||
37 | (SNDRV_PCM_FMTBIT_S16_LE | \ | ||
38 | SNDRV_PCM_FMTBIT_S24_LE) | ||
39 | |||
36 | static int kirkwood_i2s_set_fmt(struct snd_soc_dai *cpu_dai, | 40 | static int kirkwood_i2s_set_fmt(struct snd_soc_dai *cpu_dai, |
37 | unsigned int fmt) | 41 | unsigned int fmt) |
38 | { | 42 | { |
@@ -244,15 +248,15 @@ static int kirkwood_i2s_play_trigger(struct snd_pcm_substream *substream, | |||
244 | ctl); | 248 | ctl); |
245 | } | 249 | } |
246 | 250 | ||
247 | if (dai->id == 0) | ||
248 | ctl &= ~KIRKWOOD_PLAYCTL_SPDIF_EN; /* i2s */ | ||
249 | else | ||
250 | ctl &= ~KIRKWOOD_PLAYCTL_I2S_EN; /* spdif */ | ||
251 | |||
252 | switch (cmd) { | 251 | switch (cmd) { |
253 | case SNDRV_PCM_TRIGGER_START: | 252 | case SNDRV_PCM_TRIGGER_START: |
254 | /* configure */ | 253 | /* configure */ |
255 | ctl = priv->ctl_play; | 254 | ctl = priv->ctl_play; |
255 | if (dai->id == 0) | ||
256 | ctl &= ~KIRKWOOD_PLAYCTL_SPDIF_EN; /* i2s */ | ||
257 | else | ||
258 | ctl &= ~KIRKWOOD_PLAYCTL_I2S_EN; /* spdif */ | ||
259 | |||
256 | value = ctl & ~KIRKWOOD_PLAYCTL_ENABLE_MASK; | 260 | value = ctl & ~KIRKWOOD_PLAYCTL_ENABLE_MASK; |
257 | writel(value, priv->io + KIRKWOOD_PLAYCTL); | 261 | writel(value, priv->io + KIRKWOOD_PLAYCTL); |
258 | 262 | ||
@@ -449,14 +453,14 @@ static struct snd_soc_dai_driver kirkwood_i2s_dai[2] = { | |||
449 | .channels_max = 2, | 453 | .channels_max = 2, |
450 | .rates = SNDRV_PCM_RATE_44100 | SNDRV_PCM_RATE_48000 | | 454 | .rates = SNDRV_PCM_RATE_44100 | SNDRV_PCM_RATE_48000 | |
451 | SNDRV_PCM_RATE_96000, | 455 | SNDRV_PCM_RATE_96000, |
452 | .formats = KIRKWOOD_I2S_FORMATS, | 456 | .formats = KIRKWOOD_SPDIF_FORMATS, |
453 | }, | 457 | }, |
454 | .capture = { | 458 | .capture = { |
455 | .channels_min = 1, | 459 | .channels_min = 1, |
456 | .channels_max = 2, | 460 | .channels_max = 2, |
457 | .rates = SNDRV_PCM_RATE_44100 | SNDRV_PCM_RATE_48000 | | 461 | .rates = SNDRV_PCM_RATE_44100 | SNDRV_PCM_RATE_48000 | |
458 | SNDRV_PCM_RATE_96000, | 462 | SNDRV_PCM_RATE_96000, |
459 | .formats = KIRKWOOD_I2S_FORMATS, | 463 | .formats = KIRKWOOD_SPDIF_FORMATS, |
460 | }, | 464 | }, |
461 | .ops = &kirkwood_i2s_dai_ops, | 465 | .ops = &kirkwood_i2s_dai_ops, |
462 | }, | 466 | }, |
@@ -493,7 +497,7 @@ static struct snd_soc_dai_driver kirkwood_i2s_dai_extclk[2] = { | |||
493 | .rates = SNDRV_PCM_RATE_8000_192000 | | 497 | .rates = SNDRV_PCM_RATE_8000_192000 | |
494 | SNDRV_PCM_RATE_CONTINUOUS | | 498 | SNDRV_PCM_RATE_CONTINUOUS | |
495 | SNDRV_PCM_RATE_KNOT, | 499 | SNDRV_PCM_RATE_KNOT, |
496 | .formats = KIRKWOOD_I2S_FORMATS, | 500 | .formats = KIRKWOOD_SPDIF_FORMATS, |
497 | }, | 501 | }, |
498 | .capture = { | 502 | .capture = { |
499 | .channels_min = 1, | 503 | .channels_min = 1, |
@@ -501,7 +505,7 @@ static struct snd_soc_dai_driver kirkwood_i2s_dai_extclk[2] = { | |||
501 | .rates = SNDRV_PCM_RATE_8000_192000 | | 505 | .rates = SNDRV_PCM_RATE_8000_192000 | |
502 | SNDRV_PCM_RATE_CONTINUOUS | | 506 | SNDRV_PCM_RATE_CONTINUOUS | |
503 | SNDRV_PCM_RATE_KNOT, | 507 | SNDRV_PCM_RATE_KNOT, |
504 | .formats = KIRKWOOD_I2S_FORMATS, | 508 | .formats = KIRKWOOD_SPDIF_FORMATS, |
505 | }, | 509 | }, |
506 | .ops = &kirkwood_i2s_dai_ops, | 510 | .ops = &kirkwood_i2s_dai_ops, |
507 | }, | 511 | }, |
diff --git a/sound/soc/omap/n810.c b/sound/soc/omap/n810.c index 6d216cb6c19b..3fde9e402710 100644 --- a/sound/soc/omap/n810.c +++ b/sound/soc/omap/n810.c | |||
@@ -100,12 +100,12 @@ static int n810_startup(struct snd_pcm_substream *substream) | |||
100 | SNDRV_PCM_HW_PARAM_CHANNELS, 2, 2); | 100 | SNDRV_PCM_HW_PARAM_CHANNELS, 2, 2); |
101 | 101 | ||
102 | n810_ext_control(&codec->dapm); | 102 | n810_ext_control(&codec->dapm); |
103 | return clk_enable(sys_clkout2); | 103 | return clk_prepare_enable(sys_clkout2); |
104 | } | 104 | } |
105 | 105 | ||
106 | static void n810_shutdown(struct snd_pcm_substream *substream) | 106 | static void n810_shutdown(struct snd_pcm_substream *substream) |
107 | { | 107 | { |
108 | clk_disable(sys_clkout2); | 108 | clk_disable_unprepare(sys_clkout2); |
109 | } | 109 | } |
110 | 110 | ||
111 | static int n810_hw_params(struct snd_pcm_substream *substream, | 111 | static int n810_hw_params(struct snd_pcm_substream *substream, |
diff --git a/sound/soc/sh/Kconfig b/sound/soc/sh/Kconfig index 14011d90d70a..ff60e11ecb56 100644 --- a/sound/soc/sh/Kconfig +++ b/sound/soc/sh/Kconfig | |||
@@ -37,6 +37,7 @@ config SND_SOC_SH4_SIU | |||
37 | config SND_SOC_RCAR | 37 | config SND_SOC_RCAR |
38 | tristate "R-Car series SRU/SCU/SSIU/SSI support" | 38 | tristate "R-Car series SRU/SCU/SSIU/SSI support" |
39 | select SND_SIMPLE_CARD | 39 | select SND_SIMPLE_CARD |
40 | select REGMAP | ||
40 | help | 41 | help |
41 | This option enables R-Car SUR/SCU/SSIU/SSI sound support | 42 | This option enables R-Car SUR/SCU/SSIU/SSI sound support |
42 | 43 | ||
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index 4e53d87e881d..a66783e13a9c 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c | |||
@@ -3212,11 +3212,11 @@ int snd_soc_bytes_get(struct snd_kcontrol *kcontrol, | |||
3212 | break; | 3212 | break; |
3213 | case 2: | 3213 | case 2: |
3214 | ((u16 *)(&ucontrol->value.bytes.data))[0] | 3214 | ((u16 *)(&ucontrol->value.bytes.data))[0] |
3215 | &= ~params->mask; | 3215 | &= cpu_to_be16(~params->mask); |
3216 | break; | 3216 | break; |
3217 | case 4: | 3217 | case 4: |
3218 | ((u32 *)(&ucontrol->value.bytes.data))[0] | 3218 | ((u32 *)(&ucontrol->value.bytes.data))[0] |
3219 | &= ~params->mask; | 3219 | &= cpu_to_be32(~params->mask); |
3220 | break; | 3220 | break; |
3221 | default: | 3221 | default: |
3222 | return -EINVAL; | 3222 | return -EINVAL; |
diff --git a/sound/soc/soc-devres.c b/sound/soc/soc-devres.c index b1d732255c02..3449c1e909ae 100644 --- a/sound/soc/soc-devres.c +++ b/sound/soc/soc-devres.c | |||
@@ -66,7 +66,7 @@ static void devm_card_release(struct device *dev, void *res) | |||
66 | */ | 66 | */ |
67 | int devm_snd_soc_register_card(struct device *dev, struct snd_soc_card *card) | 67 | int devm_snd_soc_register_card(struct device *dev, struct snd_soc_card *card) |
68 | { | 68 | { |
69 | struct device **ptr; | 69 | struct snd_soc_card **ptr; |
70 | int ret; | 70 | int ret; |
71 | 71 | ||
72 | ptr = devres_alloc(devm_card_release, sizeof(*ptr), GFP_KERNEL); | 72 | ptr = devres_alloc(devm_card_release, sizeof(*ptr), GFP_KERNEL); |
@@ -75,7 +75,7 @@ int devm_snd_soc_register_card(struct device *dev, struct snd_soc_card *card) | |||
75 | 75 | ||
76 | ret = snd_soc_register_card(card); | 76 | ret = snd_soc_register_card(card); |
77 | if (ret == 0) { | 77 | if (ret == 0) { |
78 | *ptr = dev; | 78 | *ptr = card; |
79 | devres_add(dev, ptr); | 79 | devres_add(dev, ptr); |
80 | } else { | 80 | } else { |
81 | devres_free(ptr); | 81 | devres_free(ptr); |
diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c index 42782c01e413..11a90cd027fa 100644 --- a/sound/soc/soc-pcm.c +++ b/sound/soc/soc-pcm.c | |||
@@ -148,12 +148,12 @@ static void soc_pcm_apply_msb(struct snd_pcm_substream *substream, | |||
148 | } | 148 | } |
149 | } | 149 | } |
150 | 150 | ||
151 | static void soc_pcm_init_runtime_hw(struct snd_pcm_hardware *hw, | 151 | static void soc_pcm_init_runtime_hw(struct snd_pcm_runtime *runtime, |
152 | struct snd_soc_pcm_stream *codec_stream, | 152 | struct snd_soc_pcm_stream *codec_stream, |
153 | struct snd_soc_pcm_stream *cpu_stream) | 153 | struct snd_soc_pcm_stream *cpu_stream) |
154 | { | 154 | { |
155 | hw->rate_min = max(codec_stream->rate_min, cpu_stream->rate_min); | 155 | struct snd_pcm_hardware *hw = &runtime->hw; |
156 | hw->rate_max = max(codec_stream->rate_max, cpu_stream->rate_max); | 156 | |
157 | hw->channels_min = max(codec_stream->channels_min, | 157 | hw->channels_min = max(codec_stream->channels_min, |
158 | cpu_stream->channels_min); | 158 | cpu_stream->channels_min); |
159 | hw->channels_max = min(codec_stream->channels_max, | 159 | hw->channels_max = min(codec_stream->channels_max, |
@@ -166,6 +166,13 @@ static void soc_pcm_init_runtime_hw(struct snd_pcm_hardware *hw, | |||
166 | if (cpu_stream->rates | 166 | if (cpu_stream->rates |
167 | & (SNDRV_PCM_RATE_KNOT | SNDRV_PCM_RATE_CONTINUOUS)) | 167 | & (SNDRV_PCM_RATE_KNOT | SNDRV_PCM_RATE_CONTINUOUS)) |
168 | hw->rates |= codec_stream->rates; | 168 | hw->rates |= codec_stream->rates; |
169 | |||
170 | snd_pcm_limit_hw_rates(runtime); | ||
171 | |||
172 | hw->rate_min = max(hw->rate_min, cpu_stream->rate_min); | ||
173 | hw->rate_min = max(hw->rate_min, codec_stream->rate_min); | ||
174 | hw->rate_max = min_not_zero(hw->rate_max, cpu_stream->rate_max); | ||
175 | hw->rate_max = min_not_zero(hw->rate_max, codec_stream->rate_max); | ||
169 | } | 176 | } |
170 | 177 | ||
171 | /* | 178 | /* |
@@ -235,15 +242,14 @@ static int soc_pcm_open(struct snd_pcm_substream *substream) | |||
235 | 242 | ||
236 | /* Check that the codec and cpu DAIs are compatible */ | 243 | /* Check that the codec and cpu DAIs are compatible */ |
237 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { | 244 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { |
238 | soc_pcm_init_runtime_hw(&runtime->hw, &codec_dai_drv->playback, | 245 | soc_pcm_init_runtime_hw(runtime, &codec_dai_drv->playback, |
239 | &cpu_dai_drv->playback); | 246 | &cpu_dai_drv->playback); |
240 | } else { | 247 | } else { |
241 | soc_pcm_init_runtime_hw(&runtime->hw, &codec_dai_drv->capture, | 248 | soc_pcm_init_runtime_hw(runtime, &codec_dai_drv->capture, |
242 | &cpu_dai_drv->capture); | 249 | &cpu_dai_drv->capture); |
243 | } | 250 | } |
244 | 251 | ||
245 | ret = -EINVAL; | 252 | ret = -EINVAL; |
246 | snd_pcm_limit_hw_rates(runtime); | ||
247 | if (!runtime->hw.rates) { | 253 | if (!runtime->hw.rates) { |
248 | printk(KERN_ERR "ASoC: %s <-> %s No matching rates\n", | 254 | printk(KERN_ERR "ASoC: %s <-> %s No matching rates\n", |
249 | codec_dai->name, cpu_dai->name); | 255 | codec_dai->name, cpu_dai->name); |
diff --git a/sound/usb/mixer_quirks.c b/sound/usb/mixer_quirks.c index 3454262358b3..f4b12c216f1c 100644 --- a/sound/usb/mixer_quirks.c +++ b/sound/usb/mixer_quirks.c | |||
@@ -1603,7 +1603,7 @@ static int snd_microii_controls_create(struct usb_mixer_interface *mixer) | |||
1603 | return err; | 1603 | return err; |
1604 | } | 1604 | } |
1605 | 1605 | ||
1606 | return err; | 1606 | return 0; |
1607 | } | 1607 | } |
1608 | 1608 | ||
1609 | int snd_usb_mixer_apply_create_quirk(struct usb_mixer_interface *mixer) | 1609 | int snd_usb_mixer_apply_create_quirk(struct usb_mixer_interface *mixer) |
diff --git a/tools/lib/traceevent/event-parse.c b/tools/lib/traceevent/event-parse.c index 0362d575de7d..217c82ee3665 100644 --- a/tools/lib/traceevent/event-parse.c +++ b/tools/lib/traceevent/event-parse.c | |||
@@ -1606,6 +1606,24 @@ process_arg(struct event_format *event, struct print_arg *arg, char **tok) | |||
1606 | static enum event_type | 1606 | static enum event_type |
1607 | process_op(struct event_format *event, struct print_arg *arg, char **tok); | 1607 | process_op(struct event_format *event, struct print_arg *arg, char **tok); |
1608 | 1608 | ||
1609 | /* | ||
1610 | * For __print_symbolic() and __print_flags, we need to completely | ||
1611 | * evaluate the first argument, which defines what to print next. | ||
1612 | */ | ||
1613 | static enum event_type | ||
1614 | process_field_arg(struct event_format *event, struct print_arg *arg, char **tok) | ||
1615 | { | ||
1616 | enum event_type type; | ||
1617 | |||
1618 | type = process_arg(event, arg, tok); | ||
1619 | |||
1620 | while (type == EVENT_OP) { | ||
1621 | type = process_op(event, arg, tok); | ||
1622 | } | ||
1623 | |||
1624 | return type; | ||
1625 | } | ||
1626 | |||
1609 | static enum event_type | 1627 | static enum event_type |
1610 | process_cond(struct event_format *event, struct print_arg *top, char **tok) | 1628 | process_cond(struct event_format *event, struct print_arg *top, char **tok) |
1611 | { | 1629 | { |
@@ -2371,7 +2389,7 @@ process_flags(struct event_format *event, struct print_arg *arg, char **tok) | |||
2371 | goto out_free; | 2389 | goto out_free; |
2372 | } | 2390 | } |
2373 | 2391 | ||
2374 | type = process_arg(event, field, &token); | 2392 | type = process_field_arg(event, field, &token); |
2375 | 2393 | ||
2376 | /* Handle operations in the first argument */ | 2394 | /* Handle operations in the first argument */ |
2377 | while (type == EVENT_OP) | 2395 | while (type == EVENT_OP) |
@@ -2424,7 +2442,8 @@ process_symbols(struct event_format *event, struct print_arg *arg, char **tok) | |||
2424 | goto out_free; | 2442 | goto out_free; |
2425 | } | 2443 | } |
2426 | 2444 | ||
2427 | type = process_arg(event, field, &token); | 2445 | type = process_field_arg(event, field, &token); |
2446 | |||
2428 | if (test_type_token(type, token, EVENT_DELIM, ",")) | 2447 | if (test_type_token(type, token, EVENT_DELIM, ",")) |
2429 | goto out_free_field; | 2448 | goto out_free_field; |
2430 | 2449 | ||
@@ -3446,7 +3465,7 @@ eval_num_arg(void *data, int size, struct event_format *event, struct print_arg | |||
3446 | * is in the bottom half of the 32 bit field. | 3465 | * is in the bottom half of the 32 bit field. |
3447 | */ | 3466 | */ |
3448 | offset &= 0xffff; | 3467 | offset &= 0xffff; |
3449 | val = (unsigned long long)(data + offset); | 3468 | val = (unsigned long long)((unsigned long)data + offset); |
3450 | break; | 3469 | break; |
3451 | default: /* not sure what to do there */ | 3470 | default: /* not sure what to do there */ |
3452 | return 0; | 3471 | return 0; |
diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c index 369c03648f88..1cd035708931 100644 --- a/tools/perf/util/header.c +++ b/tools/perf/util/header.c | |||
@@ -2078,8 +2078,10 @@ static int process_group_desc(struct perf_file_section *section __maybe_unused, | |||
2078 | if (evsel->idx == (int) desc[i].leader_idx) { | 2078 | if (evsel->idx == (int) desc[i].leader_idx) { |
2079 | evsel->leader = evsel; | 2079 | evsel->leader = evsel; |
2080 | /* {anon_group} is a dummy name */ | 2080 | /* {anon_group} is a dummy name */ |
2081 | if (strcmp(desc[i].name, "{anon_group}")) | 2081 | if (strcmp(desc[i].name, "{anon_group}")) { |
2082 | evsel->group_name = desc[i].name; | 2082 | evsel->group_name = desc[i].name; |
2083 | desc[i].name = NULL; | ||
2084 | } | ||
2083 | evsel->nr_members = desc[i].nr_members; | 2085 | evsel->nr_members = desc[i].nr_members; |
2084 | 2086 | ||
2085 | if (i >= nr_groups || nr > 0) { | 2087 | if (i >= nr_groups || nr > 0) { |
@@ -2105,7 +2107,7 @@ static int process_group_desc(struct perf_file_section *section __maybe_unused, | |||
2105 | 2107 | ||
2106 | ret = 0; | 2108 | ret = 0; |
2107 | out_free: | 2109 | out_free: |
2108 | while ((int) --i >= 0) | 2110 | for (i = 0; i < nr_groups; i++) |
2109 | free(desc[i].name); | 2111 | free(desc[i].name); |
2110 | free(desc); | 2112 | free(desc); |
2111 | 2113 | ||
diff --git a/tools/perf/util/thread.c b/tools/perf/util/thread.c index cd8e2f592719..49eaf1d7d89d 100644 --- a/tools/perf/util/thread.c +++ b/tools/perf/util/thread.c | |||
@@ -70,14 +70,13 @@ int thread__set_comm(struct thread *thread, const char *str, u64 timestamp) | |||
70 | /* Override latest entry if it had no specific time coverage */ | 70 | /* Override latest entry if it had no specific time coverage */ |
71 | if (!curr->start) { | 71 | if (!curr->start) { |
72 | comm__override(curr, str, timestamp); | 72 | comm__override(curr, str, timestamp); |
73 | return 0; | 73 | } else { |
74 | new = comm__new(str, timestamp); | ||
75 | if (!new) | ||
76 | return -ENOMEM; | ||
77 | list_add(&new->list, &thread->comm_list); | ||
74 | } | 78 | } |
75 | 79 | ||
76 | new = comm__new(str, timestamp); | ||
77 | if (!new) | ||
78 | return -ENOMEM; | ||
79 | |||
80 | list_add(&new->list, &thread->comm_list); | ||
81 | thread->comm_set = true; | 80 | thread->comm_set = true; |
82 | 81 | ||
83 | return 0; | 82 | return 0; |
diff --git a/tools/usb/Makefile b/tools/usb/Makefile index 396d6c44e9d7..acf2165c04e6 100644 --- a/tools/usb/Makefile +++ b/tools/usb/Makefile | |||
@@ -3,11 +3,12 @@ | |||
3 | CC = $(CROSS_COMPILE)gcc | 3 | CC = $(CROSS_COMPILE)gcc |
4 | PTHREAD_LIBS = -lpthread | 4 | PTHREAD_LIBS = -lpthread |
5 | WARNINGS = -Wall -Wextra | 5 | WARNINGS = -Wall -Wextra |
6 | CFLAGS = $(WARNINGS) -g $(PTHREAD_LIBS) -I../include | 6 | CFLAGS = $(WARNINGS) -g -I../include |
7 | LDFLAGS = $(PTHREAD_LIBS) | ||
7 | 8 | ||
8 | all: testusb ffs-test | 9 | all: testusb ffs-test |
9 | %: %.c | 10 | %: %.c |
10 | $(CC) $(CFLAGS) -o $@ $^ | 11 | $(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS) |
11 | 12 | ||
12 | clean: | 13 | clean: |
13 | $(RM) testusb ffs-test | 14 | $(RM) testusb ffs-test |
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c index a0aa84b5941a..4f588bc94186 100644 --- a/virt/kvm/kvm_main.c +++ b/virt/kvm/kvm_main.c | |||
@@ -1898,6 +1898,9 @@ static int kvm_vm_ioctl_create_vcpu(struct kvm *kvm, u32 id) | |||
1898 | int r; | 1898 | int r; |
1899 | struct kvm_vcpu *vcpu, *v; | 1899 | struct kvm_vcpu *vcpu, *v; |
1900 | 1900 | ||
1901 | if (id >= KVM_MAX_VCPUS) | ||
1902 | return -EINVAL; | ||
1903 | |||
1901 | vcpu = kvm_arch_vcpu_create(kvm, id); | 1904 | vcpu = kvm_arch_vcpu_create(kvm, id); |
1902 | if (IS_ERR(vcpu)) | 1905 | if (IS_ERR(vcpu)) |
1903 | return PTR_ERR(vcpu); | 1906 | return PTR_ERR(vcpu); |