diff options
339 files changed, 2236 insertions, 1370 deletions
diff --git a/Documentation/devicetree/bindings/clock/silabs,si5351.txt b/Documentation/devicetree/bindings/clock/silabs,si5351.txt index c40711e8e8f7..28b28309f535 100644 --- a/Documentation/devicetree/bindings/clock/silabs,si5351.txt +++ b/Documentation/devicetree/bindings/clock/silabs,si5351.txt | |||
@@ -17,7 +17,8 @@ Required properties: | |||
17 | - #clock-cells: from common clock binding; shall be set to 1. | 17 | - #clock-cells: from common clock binding; shall be set to 1. |
18 | - clocks: from common clock binding; list of parent clock | 18 | - clocks: from common clock binding; list of parent clock |
19 | handles, shall be xtal reference clock or xtal and clkin for | 19 | handles, shall be xtal reference clock or xtal and clkin for |
20 | si5351c only. | 20 | si5351c only. Corresponding clock input names are "xtal" and |
21 | "clkin" respectively. | ||
21 | - #address-cells: shall be set to 1. | 22 | - #address-cells: shall be set to 1. |
22 | - #size-cells: shall be set to 0. | 23 | - #size-cells: shall be set to 0. |
23 | 24 | ||
@@ -71,6 +72,7 @@ i2c-master-node { | |||
71 | 72 | ||
72 | /* connect xtal input to 25MHz reference */ | 73 | /* connect xtal input to 25MHz reference */ |
73 | clocks = <&ref25>; | 74 | clocks = <&ref25>; |
75 | clock-names = "xtal"; | ||
74 | 76 | ||
75 | /* connect xtal input as source of pll0 and pll1 */ | 77 | /* connect xtal input as source of pll0 and pll1 */ |
76 | silabs,pll-source = <0 0>, <1 0>; | 78 | silabs,pll-source = <0 0>, <1 0>; |
diff --git a/Documentation/devicetree/bindings/mtd/m25p80.txt b/Documentation/devicetree/bindings/mtd/jedec,spi-nor.txt index f20b111b502a..2bee68103b01 100644 --- a/Documentation/devicetree/bindings/mtd/m25p80.txt +++ b/Documentation/devicetree/bindings/mtd/jedec,spi-nor.txt | |||
@@ -8,8 +8,8 @@ Required properties: | |||
8 | is not Linux-only, but in case of Linux, see the "m25p_ids" | 8 | is not Linux-only, but in case of Linux, see the "m25p_ids" |
9 | table in drivers/mtd/devices/m25p80.c for the list of supported | 9 | table in drivers/mtd/devices/m25p80.c for the list of supported |
10 | chips. | 10 | chips. |
11 | Must also include "nor-jedec" for any SPI NOR flash that can be | 11 | Must also include "jedec,spi-nor" for any SPI NOR flash that can |
12 | identified by the JEDEC READ ID opcode (0x9F). | 12 | be identified by the JEDEC READ ID opcode (0x9F). |
13 | - reg : Chip-Select number | 13 | - reg : Chip-Select number |
14 | - spi-max-frequency : Maximum frequency of the SPI bus the chip can operate at | 14 | - spi-max-frequency : Maximum frequency of the SPI bus the chip can operate at |
15 | 15 | ||
@@ -25,7 +25,7 @@ Example: | |||
25 | flash: m25p80@0 { | 25 | flash: m25p80@0 { |
26 | #address-cells = <1>; | 26 | #address-cells = <1>; |
27 | #size-cells = <1>; | 27 | #size-cells = <1>; |
28 | compatible = "spansion,m25p80", "nor-jedec"; | 28 | compatible = "spansion,m25p80", "jedec,spi-nor"; |
29 | reg = <0>; | 29 | reg = <0>; |
30 | spi-max-frequency = <40000000>; | 30 | spi-max-frequency = <40000000>; |
31 | m25p,fast-read; | 31 | m25p,fast-read; |
diff --git a/Documentation/devicetree/bindings/net/cdns-emac.txt b/Documentation/devicetree/bindings/net/cdns-emac.txt index abd67c13d344..4451ee973223 100644 --- a/Documentation/devicetree/bindings/net/cdns-emac.txt +++ b/Documentation/devicetree/bindings/net/cdns-emac.txt | |||
@@ -3,7 +3,8 @@ | |||
3 | Required properties: | 3 | Required properties: |
4 | - compatible: Should be "cdns,[<chip>-]{emac}" | 4 | - compatible: Should be "cdns,[<chip>-]{emac}" |
5 | Use "cdns,at91rm9200-emac" Atmel at91rm9200 SoC. | 5 | Use "cdns,at91rm9200-emac" Atmel at91rm9200 SoC. |
6 | or the generic form: "cdns,emac". | 6 | Use "cdns,zynq-gem" Xilinx Zynq-7xxx SoC. |
7 | Or the generic form: "cdns,emac". | ||
7 | - reg: Address and length of the register set for the device | 8 | - reg: Address and length of the register set for the device |
8 | - interrupts: Should contain macb interrupt | 9 | - interrupts: Should contain macb interrupt |
9 | - phy-mode: see ethernet.txt file in the same directory. | 10 | - phy-mode: see ethernet.txt file in the same directory. |
diff --git a/Documentation/serial/tty.txt b/Documentation/serial/tty.txt index 1e52d67d0abf..dbe6623fed1c 100644 --- a/Documentation/serial/tty.txt +++ b/Documentation/serial/tty.txt | |||
@@ -198,6 +198,9 @@ TTY_IO_ERROR If set, causes all subsequent userspace read/write | |||
198 | 198 | ||
199 | TTY_OTHER_CLOSED Device is a pty and the other side has closed. | 199 | TTY_OTHER_CLOSED Device is a pty and the other side has closed. |
200 | 200 | ||
201 | TTY_OTHER_DONE Device is a pty and the other side has closed and | ||
202 | all pending input processing has been completed. | ||
203 | |||
201 | TTY_NO_WRITE_SPLIT Prevent driver from splitting up writes into | 204 | TTY_NO_WRITE_SPLIT Prevent driver from splitting up writes into |
202 | smaller chunks. | 205 | smaller chunks. |
203 | 206 | ||
diff --git a/Documentation/virtual/kvm/mmu.txt b/Documentation/virtual/kvm/mmu.txt index 53838d9c6295..c59bd9bc41ef 100644 --- a/Documentation/virtual/kvm/mmu.txt +++ b/Documentation/virtual/kvm/mmu.txt | |||
@@ -169,6 +169,10 @@ Shadow pages contain the following information: | |||
169 | Contains the value of cr4.smep && !cr0.wp for which the page is valid | 169 | Contains the value of cr4.smep && !cr0.wp for which the page is valid |
170 | (pages for which this is true are different from other pages; see the | 170 | (pages for which this is true are different from other pages; see the |
171 | treatment of cr0.wp=0 below). | 171 | treatment of cr0.wp=0 below). |
172 | role.smap_andnot_wp: | ||
173 | Contains the value of cr4.smap && !cr0.wp for which the page is valid | ||
174 | (pages for which this is true are different from other pages; see the | ||
175 | treatment of cr0.wp=0 below). | ||
172 | gfn: | 176 | gfn: |
173 | Either the guest page table containing the translations shadowed by this | 177 | Either the guest page table containing the translations shadowed by this |
174 | page, or the base page frame for linear translations. See role.direct. | 178 | page, or the base page frame for linear translations. See role.direct. |
@@ -344,10 +348,16 @@ on fault type: | |||
344 | 348 | ||
345 | (user write faults generate a #PF) | 349 | (user write faults generate a #PF) |
346 | 350 | ||
347 | In the first case there is an additional complication if CR4.SMEP is | 351 | In the first case there are two additional complications: |
348 | enabled: since we've turned the page into a kernel page, the kernel may now | 352 | - if CR4.SMEP is enabled: since we've turned the page into a kernel page, |
349 | execute it. We handle this by also setting spte.nx. If we get a user | 353 | the kernel may now execute it. We handle this by also setting spte.nx. |
350 | fetch or read fault, we'll change spte.u=1 and spte.nx=gpte.nx back. | 354 | If we get a user fetch or read fault, we'll change spte.u=1 and |
355 | spte.nx=gpte.nx back. | ||
356 | - if CR4.SMAP is disabled: since the page has been changed to a kernel | ||
357 | page, it can not be reused when CR4.SMAP is enabled. We set | ||
358 | CR4.SMAP && !CR0.WP into shadow page's role to avoid this case. Note, | ||
359 | here we do not care the case that CR4.SMAP is enabled since KVM will | ||
360 | directly inject #PF to guest due to failed permission check. | ||
351 | 361 | ||
352 | To prevent an spte that was converted into a kernel page with cr0.wp=0 | 362 | To prevent an spte that was converted into a kernel page with cr0.wp=0 |
353 | from being written by the kernel after cr0.wp has changed to 1, we make | 363 | from being written by the kernel after cr0.wp has changed to 1, we make |
diff --git a/MAINTAINERS b/MAINTAINERS index 38abdb270111..df106f87a3ba 100644 --- a/MAINTAINERS +++ b/MAINTAINERS | |||
@@ -973,7 +973,7 @@ S: Maintained | |||
973 | ARM/CORTINA SYSTEMS GEMINI ARM ARCHITECTURE | 973 | ARM/CORTINA SYSTEMS GEMINI ARM ARCHITECTURE |
974 | M: Hans Ulli Kroll <ulli.kroll@googlemail.com> | 974 | M: Hans Ulli Kroll <ulli.kroll@googlemail.com> |
975 | L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) | 975 | L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) |
976 | T: git git://git.berlios.de/gemini-board | 976 | T: git git://github.com/ulli-kroll/linux.git |
977 | S: Maintained | 977 | S: Maintained |
978 | F: arch/arm/mach-gemini/ | 978 | F: arch/arm/mach-gemini/ |
979 | 979 | ||
@@ -1192,7 +1192,7 @@ ARM/MAGICIAN MACHINE SUPPORT | |||
1192 | M: Philipp Zabel <philipp.zabel@gmail.com> | 1192 | M: Philipp Zabel <philipp.zabel@gmail.com> |
1193 | S: Maintained | 1193 | S: Maintained |
1194 | 1194 | ||
1195 | ARM/Marvell Armada 370 and Armada XP SOC support | 1195 | ARM/Marvell Kirkwood and Armada 370, 375, 38x, XP SOC support |
1196 | M: Jason Cooper <jason@lakedaemon.net> | 1196 | M: Jason Cooper <jason@lakedaemon.net> |
1197 | M: Andrew Lunn <andrew@lunn.ch> | 1197 | M: Andrew Lunn <andrew@lunn.ch> |
1198 | M: Gregory Clement <gregory.clement@free-electrons.com> | 1198 | M: Gregory Clement <gregory.clement@free-electrons.com> |
@@ -1201,12 +1201,17 @@ L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) | |||
1201 | S: Maintained | 1201 | S: Maintained |
1202 | F: arch/arm/mach-mvebu/ | 1202 | F: arch/arm/mach-mvebu/ |
1203 | F: drivers/rtc/rtc-armada38x.c | 1203 | F: drivers/rtc/rtc-armada38x.c |
1204 | F: arch/arm/boot/dts/armada* | ||
1205 | F: arch/arm/boot/dts/kirkwood* | ||
1206 | |||
1204 | 1207 | ||
1205 | ARM/Marvell Berlin SoC support | 1208 | ARM/Marvell Berlin SoC support |
1206 | M: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com> | 1209 | M: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com> |
1207 | L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) | 1210 | L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) |
1208 | S: Maintained | 1211 | S: Maintained |
1209 | F: arch/arm/mach-berlin/ | 1212 | F: arch/arm/mach-berlin/ |
1213 | F: arch/arm/boot/dts/berlin* | ||
1214 | |||
1210 | 1215 | ||
1211 | ARM/Marvell Dove/MV78xx0/Orion SOC support | 1216 | ARM/Marvell Dove/MV78xx0/Orion SOC support |
1212 | M: Jason Cooper <jason@lakedaemon.net> | 1217 | M: Jason Cooper <jason@lakedaemon.net> |
@@ -1219,6 +1224,9 @@ F: arch/arm/mach-dove/ | |||
1219 | F: arch/arm/mach-mv78xx0/ | 1224 | F: arch/arm/mach-mv78xx0/ |
1220 | F: arch/arm/mach-orion5x/ | 1225 | F: arch/arm/mach-orion5x/ |
1221 | F: arch/arm/plat-orion/ | 1226 | F: arch/arm/plat-orion/ |
1227 | F: arch/arm/boot/dts/dove* | ||
1228 | F: arch/arm/boot/dts/orion5x* | ||
1229 | |||
1222 | 1230 | ||
1223 | ARM/Orion SoC/Technologic Systems TS-78xx platform support | 1231 | ARM/Orion SoC/Technologic Systems TS-78xx platform support |
1224 | M: Alexander Clouter <alex@digriz.org.uk> | 1232 | M: Alexander Clouter <alex@digriz.org.uk> |
@@ -1370,6 +1378,7 @@ N: rockchip | |||
1370 | 1378 | ||
1371 | ARM/SAMSUNG EXYNOS ARM ARCHITECTURES | 1379 | ARM/SAMSUNG EXYNOS ARM ARCHITECTURES |
1372 | M: Kukjin Kim <kgene@kernel.org> | 1380 | M: Kukjin Kim <kgene@kernel.org> |
1381 | M: Krzysztof Kozlowski <k.kozlowski@samsung.com> | ||
1373 | L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) | 1382 | L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) |
1374 | L: linux-samsung-soc@vger.kernel.org (moderated for non-subscribers) | 1383 | L: linux-samsung-soc@vger.kernel.org (moderated for non-subscribers) |
1375 | S: Maintained | 1384 | S: Maintained |
@@ -1934,7 +1943,7 @@ S: Maintained | |||
1934 | F: drivers/net/wireless/b43legacy/ | 1943 | F: drivers/net/wireless/b43legacy/ |
1935 | 1944 | ||
1936 | BACKLIGHT CLASS/SUBSYSTEM | 1945 | BACKLIGHT CLASS/SUBSYSTEM |
1937 | M: Jingoo Han <jg1.han@samsung.com> | 1946 | M: Jingoo Han <jingoohan1@gmail.com> |
1938 | M: Lee Jones <lee.jones@linaro.org> | 1947 | M: Lee Jones <lee.jones@linaro.org> |
1939 | S: Maintained | 1948 | S: Maintained |
1940 | F: drivers/video/backlight/ | 1949 | F: drivers/video/backlight/ |
@@ -3917,7 +3926,7 @@ F: drivers/extcon/ | |||
3917 | F: Documentation/extcon/ | 3926 | F: Documentation/extcon/ |
3918 | 3927 | ||
3919 | EXYNOS DP DRIVER | 3928 | EXYNOS DP DRIVER |
3920 | M: Jingoo Han <jg1.han@samsung.com> | 3929 | M: Jingoo Han <jingoohan1@gmail.com> |
3921 | L: dri-devel@lists.freedesktop.org | 3930 | L: dri-devel@lists.freedesktop.org |
3922 | S: Maintained | 3931 | S: Maintained |
3923 | F: drivers/gpu/drm/exynos/exynos_dp* | 3932 | F: drivers/gpu/drm/exynos/exynos_dp* |
@@ -4526,7 +4535,7 @@ M: Jean Delvare <jdelvare@suse.de> | |||
4526 | M: Guenter Roeck <linux@roeck-us.net> | 4535 | M: Guenter Roeck <linux@roeck-us.net> |
4527 | L: lm-sensors@lm-sensors.org | 4536 | L: lm-sensors@lm-sensors.org |
4528 | W: http://www.lm-sensors.org/ | 4537 | W: http://www.lm-sensors.org/ |
4529 | T: quilt kernel.org/pub/linux/kernel/people/jdelvare/linux-2.6/jdelvare-hwmon/ | 4538 | T: quilt http://jdelvare.nerim.net/devel/linux/jdelvare-hwmon/ |
4530 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging.git | 4539 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging.git |
4531 | S: Maintained | 4540 | S: Maintained |
4532 | F: Documentation/hwmon/ | 4541 | F: Documentation/hwmon/ |
@@ -7556,7 +7565,7 @@ S: Maintained | |||
7556 | F: drivers/pci/host/*rcar* | 7565 | F: drivers/pci/host/*rcar* |
7557 | 7566 | ||
7558 | PCI DRIVER FOR SAMSUNG EXYNOS | 7567 | PCI DRIVER FOR SAMSUNG EXYNOS |
7559 | M: Jingoo Han <jg1.han@samsung.com> | 7568 | M: Jingoo Han <jingoohan1@gmail.com> |
7560 | L: linux-pci@vger.kernel.org | 7569 | L: linux-pci@vger.kernel.org |
7561 | L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) | 7570 | L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) |
7562 | L: linux-samsung-soc@vger.kernel.org (moderated for non-subscribers) | 7571 | L: linux-samsung-soc@vger.kernel.org (moderated for non-subscribers) |
@@ -7564,7 +7573,7 @@ S: Maintained | |||
7564 | F: drivers/pci/host/pci-exynos.c | 7573 | F: drivers/pci/host/pci-exynos.c |
7565 | 7574 | ||
7566 | PCI DRIVER FOR SYNOPSIS DESIGNWARE | 7575 | PCI DRIVER FOR SYNOPSIS DESIGNWARE |
7567 | M: Jingoo Han <jg1.han@samsung.com> | 7576 | M: Jingoo Han <jingoohan1@gmail.com> |
7568 | L: linux-pci@vger.kernel.org | 7577 | L: linux-pci@vger.kernel.org |
7569 | S: Maintained | 7578 | S: Maintained |
7570 | F: drivers/pci/host/*designware* | 7579 | F: drivers/pci/host/*designware* |
@@ -8520,7 +8529,7 @@ S: Supported | |||
8520 | F: sound/soc/samsung/ | 8529 | F: sound/soc/samsung/ |
8521 | 8530 | ||
8522 | SAMSUNG FRAMEBUFFER DRIVER | 8531 | SAMSUNG FRAMEBUFFER DRIVER |
8523 | M: Jingoo Han <jg1.han@samsung.com> | 8532 | M: Jingoo Han <jingoohan1@gmail.com> |
8524 | L: linux-fbdev@vger.kernel.org | 8533 | L: linux-fbdev@vger.kernel.org |
8525 | S: Maintained | 8534 | S: Maintained |
8526 | F: drivers/video/fbdev/s3c-fb.c | 8535 | F: drivers/video/fbdev/s3c-fb.c |
@@ -1,7 +1,7 @@ | |||
1 | VERSION = 4 | 1 | VERSION = 4 |
2 | PATCHLEVEL = 1 | 2 | PATCHLEVEL = 1 |
3 | SUBLEVEL = 0 | 3 | SUBLEVEL = 0 |
4 | EXTRAVERSION = -rc3 | 4 | EXTRAVERSION = -rc4 |
5 | NAME = Hurr durr I'ma sheep | 5 | NAME = Hurr durr I'ma sheep |
6 | 6 | ||
7 | # *DOCUMENTATION* | 7 | # *DOCUMENTATION* |
diff --git a/arch/arc/Kconfig.debug b/arch/arc/Kconfig.debug index a7fc0da25650..ff6a4b5ce927 100644 --- a/arch/arc/Kconfig.debug +++ b/arch/arc/Kconfig.debug | |||
@@ -2,19 +2,6 @@ menu "Kernel hacking" | |||
2 | 2 | ||
3 | source "lib/Kconfig.debug" | 3 | source "lib/Kconfig.debug" |
4 | 4 | ||
5 | config EARLY_PRINTK | ||
6 | bool "Early printk" if EMBEDDED | ||
7 | default y | ||
8 | help | ||
9 | Write kernel log output directly into the VGA buffer or to a serial | ||
10 | port. | ||
11 | |||
12 | This is useful for kernel debugging when your machine crashes very | ||
13 | early before the console code is initialized. For normal operation | ||
14 | it is not recommended because it looks ugly and doesn't cooperate | ||
15 | with klogd/syslogd or the X server. You should normally N here, | ||
16 | unless you want to debug such a crash. | ||
17 | |||
18 | config 16KSTACKS | 5 | config 16KSTACKS |
19 | bool "Use 16Kb for kernel stacks instead of 8Kb" | 6 | bool "Use 16Kb for kernel stacks instead of 8Kb" |
20 | help | 7 | help |
diff --git a/arch/arc/include/asm/atomic.h b/arch/arc/include/asm/atomic.h index 067551b6920a..9917a45fc430 100644 --- a/arch/arc/include/asm/atomic.h +++ b/arch/arc/include/asm/atomic.h | |||
@@ -99,7 +99,7 @@ static inline void atomic_##op(int i, atomic_t *v) \ | |||
99 | atomic_ops_unlock(flags); \ | 99 | atomic_ops_unlock(flags); \ |
100 | } | 100 | } |
101 | 101 | ||
102 | #define ATOMIC_OP_RETURN(op, c_op) \ | 102 | #define ATOMIC_OP_RETURN(op, c_op, asm_op) \ |
103 | static inline int atomic_##op##_return(int i, atomic_t *v) \ | 103 | static inline int atomic_##op##_return(int i, atomic_t *v) \ |
104 | { \ | 104 | { \ |
105 | unsigned long flags; \ | 105 | unsigned long flags; \ |
diff --git a/arch/arc/mm/cache_arc700.c b/arch/arc/mm/cache_arc700.c index 8c3a3e02ba92..12b2100db073 100644 --- a/arch/arc/mm/cache_arc700.c +++ b/arch/arc/mm/cache_arc700.c | |||
@@ -266,7 +266,7 @@ static inline void __cache_line_loop(unsigned long paddr, unsigned long vaddr, | |||
266 | * Machine specific helpers for Entire D-Cache or Per Line ops | 266 | * Machine specific helpers for Entire D-Cache or Per Line ops |
267 | */ | 267 | */ |
268 | 268 | ||
269 | static unsigned int __before_dc_op(const int op) | 269 | static inline unsigned int __before_dc_op(const int op) |
270 | { | 270 | { |
271 | unsigned int reg = reg; | 271 | unsigned int reg = reg; |
272 | 272 | ||
@@ -284,7 +284,7 @@ static unsigned int __before_dc_op(const int op) | |||
284 | return reg; | 284 | return reg; |
285 | } | 285 | } |
286 | 286 | ||
287 | static void __after_dc_op(const int op, unsigned int reg) | 287 | static inline void __after_dc_op(const int op, unsigned int reg) |
288 | { | 288 | { |
289 | if (op & OP_FLUSH) /* flush / flush-n-inv both wait */ | 289 | if (op & OP_FLUSH) /* flush / flush-n-inv both wait */ |
290 | while (read_aux_reg(ARC_REG_DC_CTRL) & DC_CTRL_FLUSH_STATUS); | 290 | while (read_aux_reg(ARC_REG_DC_CTRL) & DC_CTRL_FLUSH_STATUS); |
diff --git a/arch/arm/boot/dts/armada-375.dtsi b/arch/arm/boot/dts/armada-375.dtsi index c675257f2377..f076ff856d8b 100644 --- a/arch/arm/boot/dts/armada-375.dtsi +++ b/arch/arm/boot/dts/armada-375.dtsi | |||
@@ -69,7 +69,7 @@ | |||
69 | mainpll: mainpll { | 69 | mainpll: mainpll { |
70 | compatible = "fixed-clock"; | 70 | compatible = "fixed-clock"; |
71 | #clock-cells = <0>; | 71 | #clock-cells = <0>; |
72 | clock-frequency = <2000000000>; | 72 | clock-frequency = <1000000000>; |
73 | }; | 73 | }; |
74 | /* 25 MHz reference crystal */ | 74 | /* 25 MHz reference crystal */ |
75 | refclk: oscillator { | 75 | refclk: oscillator { |
diff --git a/arch/arm/boot/dts/armada-38x.dtsi b/arch/arm/boot/dts/armada-38x.dtsi index ed2dd8ba4080..218a2acd36e5 100644 --- a/arch/arm/boot/dts/armada-38x.dtsi +++ b/arch/arm/boot/dts/armada-38x.dtsi | |||
@@ -585,7 +585,7 @@ | |||
585 | mainpll: mainpll { | 585 | mainpll: mainpll { |
586 | compatible = "fixed-clock"; | 586 | compatible = "fixed-clock"; |
587 | #clock-cells = <0>; | 587 | #clock-cells = <0>; |
588 | clock-frequency = <2000000000>; | 588 | clock-frequency = <1000000000>; |
589 | }; | 589 | }; |
590 | 590 | ||
591 | /* 25 MHz reference crystal */ | 591 | /* 25 MHz reference crystal */ |
diff --git a/arch/arm/boot/dts/armada-39x.dtsi b/arch/arm/boot/dts/armada-39x.dtsi index 0e85fc15ceda..ecd1318109ba 100644 --- a/arch/arm/boot/dts/armada-39x.dtsi +++ b/arch/arm/boot/dts/armada-39x.dtsi | |||
@@ -502,7 +502,7 @@ | |||
502 | mainpll: mainpll { | 502 | mainpll: mainpll { |
503 | compatible = "fixed-clock"; | 503 | compatible = "fixed-clock"; |
504 | #clock-cells = <0>; | 504 | #clock-cells = <0>; |
505 | clock-frequency = <2000000000>; | 505 | clock-frequency = <1000000000>; |
506 | }; | 506 | }; |
507 | }; | 507 | }; |
508 | }; | 508 | }; |
diff --git a/arch/arm/boot/dts/dove-cubox.dts b/arch/arm/boot/dts/dove-cubox.dts index aae7efc09b0b..e6fa251e17b9 100644 --- a/arch/arm/boot/dts/dove-cubox.dts +++ b/arch/arm/boot/dts/dove-cubox.dts | |||
@@ -87,6 +87,7 @@ | |||
87 | 87 | ||
88 | /* connect xtal input to 25MHz reference */ | 88 | /* connect xtal input to 25MHz reference */ |
89 | clocks = <&ref25>; | 89 | clocks = <&ref25>; |
90 | clock-names = "xtal"; | ||
90 | 91 | ||
91 | /* connect xtal input as source of pll0 and pll1 */ | 92 | /* connect xtal input as source of pll0 and pll1 */ |
92 | silabs,pll-source = <0 0>, <1 0>; | 93 | silabs,pll-source = <0 0>, <1 0>; |
diff --git a/arch/arm/boot/dts/exynos5420-peach-pit.dts b/arch/arm/boot/dts/exynos5420-peach-pit.dts index 0788d08fb43e..146e71118a72 100644 --- a/arch/arm/boot/dts/exynos5420-peach-pit.dts +++ b/arch/arm/boot/dts/exynos5420-peach-pit.dts | |||
@@ -711,6 +711,7 @@ | |||
711 | num-slots = <1>; | 711 | num-slots = <1>; |
712 | broken-cd; | 712 | broken-cd; |
713 | cap-sdio-irq; | 713 | cap-sdio-irq; |
714 | keep-power-in-suspend; | ||
714 | card-detect-delay = <200>; | 715 | card-detect-delay = <200>; |
715 | clock-frequency = <400000000>; | 716 | clock-frequency = <400000000>; |
716 | samsung,dw-mshc-ciu-div = <1>; | 717 | samsung,dw-mshc-ciu-div = <1>; |
diff --git a/arch/arm/boot/dts/exynos5800-peach-pi.dts b/arch/arm/boot/dts/exynos5800-peach-pi.dts index 412f41d62686..02eb8b15374f 100644 --- a/arch/arm/boot/dts/exynos5800-peach-pi.dts +++ b/arch/arm/boot/dts/exynos5800-peach-pi.dts | |||
@@ -674,6 +674,7 @@ | |||
674 | num-slots = <1>; | 674 | num-slots = <1>; |
675 | broken-cd; | 675 | broken-cd; |
676 | cap-sdio-irq; | 676 | cap-sdio-irq; |
677 | keep-power-in-suspend; | ||
677 | card-detect-delay = <200>; | 678 | card-detect-delay = <200>; |
678 | clock-frequency = <400000000>; | 679 | clock-frequency = <400000000>; |
679 | samsung,dw-mshc-ciu-div = <1>; | 680 | samsung,dw-mshc-ciu-div = <1>; |
diff --git a/arch/arm/boot/dts/tegra124.dtsi b/arch/arm/boot/dts/tegra124.dtsi index cf01c818b8ea..13cc7ca5e031 100644 --- a/arch/arm/boot/dts/tegra124.dtsi +++ b/arch/arm/boot/dts/tegra124.dtsi | |||
@@ -826,7 +826,7 @@ | |||
826 | <&tegra_car TEGRA124_CLK_PLL_U>, | 826 | <&tegra_car TEGRA124_CLK_PLL_U>, |
827 | <&tegra_car TEGRA124_CLK_USBD>; | 827 | <&tegra_car TEGRA124_CLK_USBD>; |
828 | clock-names = "reg", "pll_u", "utmi-pads"; | 828 | clock-names = "reg", "pll_u", "utmi-pads"; |
829 | resets = <&tegra_car 59>, <&tegra_car 22>; | 829 | resets = <&tegra_car 22>, <&tegra_car 22>; |
830 | reset-names = "usb", "utmi-pads"; | 830 | reset-names = "usb", "utmi-pads"; |
831 | nvidia,hssync-start-delay = <0>; | 831 | nvidia,hssync-start-delay = <0>; |
832 | nvidia,idle-wait-delay = <17>; | 832 | nvidia,idle-wait-delay = <17>; |
@@ -838,6 +838,7 @@ | |||
838 | nvidia,hssquelch-level = <2>; | 838 | nvidia,hssquelch-level = <2>; |
839 | nvidia,hsdiscon-level = <5>; | 839 | nvidia,hsdiscon-level = <5>; |
840 | nvidia,xcvr-hsslew = <12>; | 840 | nvidia,xcvr-hsslew = <12>; |
841 | nvidia,has-utmi-pad-registers; | ||
841 | status = "disabled"; | 842 | status = "disabled"; |
842 | }; | 843 | }; |
843 | 844 | ||
@@ -862,7 +863,7 @@ | |||
862 | <&tegra_car TEGRA124_CLK_PLL_U>, | 863 | <&tegra_car TEGRA124_CLK_PLL_U>, |
863 | <&tegra_car TEGRA124_CLK_USBD>; | 864 | <&tegra_car TEGRA124_CLK_USBD>; |
864 | clock-names = "reg", "pll_u", "utmi-pads"; | 865 | clock-names = "reg", "pll_u", "utmi-pads"; |
865 | resets = <&tegra_car 22>, <&tegra_car 22>; | 866 | resets = <&tegra_car 58>, <&tegra_car 22>; |
866 | reset-names = "usb", "utmi-pads"; | 867 | reset-names = "usb", "utmi-pads"; |
867 | nvidia,hssync-start-delay = <0>; | 868 | nvidia,hssync-start-delay = <0>; |
868 | nvidia,idle-wait-delay = <17>; | 869 | nvidia,idle-wait-delay = <17>; |
@@ -874,7 +875,6 @@ | |||
874 | nvidia,hssquelch-level = <2>; | 875 | nvidia,hssquelch-level = <2>; |
875 | nvidia,hsdiscon-level = <5>; | 876 | nvidia,hsdiscon-level = <5>; |
876 | nvidia,xcvr-hsslew = <12>; | 877 | nvidia,xcvr-hsslew = <12>; |
877 | nvidia,has-utmi-pad-registers; | ||
878 | status = "disabled"; | 878 | status = "disabled"; |
879 | }; | 879 | }; |
880 | 880 | ||
@@ -899,7 +899,7 @@ | |||
899 | <&tegra_car TEGRA124_CLK_PLL_U>, | 899 | <&tegra_car TEGRA124_CLK_PLL_U>, |
900 | <&tegra_car TEGRA124_CLK_USBD>; | 900 | <&tegra_car TEGRA124_CLK_USBD>; |
901 | clock-names = "reg", "pll_u", "utmi-pads"; | 901 | clock-names = "reg", "pll_u", "utmi-pads"; |
902 | resets = <&tegra_car 58>, <&tegra_car 22>; | 902 | resets = <&tegra_car 59>, <&tegra_car 22>; |
903 | reset-names = "usb", "utmi-pads"; | 903 | reset-names = "usb", "utmi-pads"; |
904 | nvidia,hssync-start-delay = <0>; | 904 | nvidia,hssync-start-delay = <0>; |
905 | nvidia,idle-wait-delay = <17>; | 905 | nvidia,idle-wait-delay = <17>; |
diff --git a/arch/arm/boot/dts/vexpress-v2p-ca15_a7.dts b/arch/arm/boot/dts/vexpress-v2p-ca15_a7.dts index 7a2aeacd62c0..107395c32d82 100644 --- a/arch/arm/boot/dts/vexpress-v2p-ca15_a7.dts +++ b/arch/arm/boot/dts/vexpress-v2p-ca15_a7.dts | |||
@@ -191,6 +191,7 @@ | |||
191 | compatible = "arm,cortex-a15-pmu"; | 191 | compatible = "arm,cortex-a15-pmu"; |
192 | interrupts = <0 68 4>, | 192 | interrupts = <0 68 4>, |
193 | <0 69 4>; | 193 | <0 69 4>; |
194 | interrupt-affinity = <&cpu0>, <&cpu1>; | ||
194 | }; | 195 | }; |
195 | 196 | ||
196 | oscclk6a: oscclk6a { | 197 | oscclk6a: oscclk6a { |
diff --git a/arch/arm/boot/dts/vexpress-v2p-ca9.dts b/arch/arm/boot/dts/vexpress-v2p-ca9.dts index 23662b5a5e9d..d949facba376 100644 --- a/arch/arm/boot/dts/vexpress-v2p-ca9.dts +++ b/arch/arm/boot/dts/vexpress-v2p-ca9.dts | |||
@@ -33,28 +33,28 @@ | |||
33 | #address-cells = <1>; | 33 | #address-cells = <1>; |
34 | #size-cells = <0>; | 34 | #size-cells = <0>; |
35 | 35 | ||
36 | cpu@0 { | 36 | A9_0: cpu@0 { |
37 | device_type = "cpu"; | 37 | device_type = "cpu"; |
38 | compatible = "arm,cortex-a9"; | 38 | compatible = "arm,cortex-a9"; |
39 | reg = <0>; | 39 | reg = <0>; |
40 | next-level-cache = <&L2>; | 40 | next-level-cache = <&L2>; |
41 | }; | 41 | }; |
42 | 42 | ||
43 | cpu@1 { | 43 | A9_1: cpu@1 { |
44 | device_type = "cpu"; | 44 | device_type = "cpu"; |
45 | compatible = "arm,cortex-a9"; | 45 | compatible = "arm,cortex-a9"; |
46 | reg = <1>; | 46 | reg = <1>; |
47 | next-level-cache = <&L2>; | 47 | next-level-cache = <&L2>; |
48 | }; | 48 | }; |
49 | 49 | ||
50 | cpu@2 { | 50 | A9_2: cpu@2 { |
51 | device_type = "cpu"; | 51 | device_type = "cpu"; |
52 | compatible = "arm,cortex-a9"; | 52 | compatible = "arm,cortex-a9"; |
53 | reg = <2>; | 53 | reg = <2>; |
54 | next-level-cache = <&L2>; | 54 | next-level-cache = <&L2>; |
55 | }; | 55 | }; |
56 | 56 | ||
57 | cpu@3 { | 57 | A9_3: cpu@3 { |
58 | device_type = "cpu"; | 58 | device_type = "cpu"; |
59 | compatible = "arm,cortex-a9"; | 59 | compatible = "arm,cortex-a9"; |
60 | reg = <3>; | 60 | reg = <3>; |
@@ -170,6 +170,7 @@ | |||
170 | compatible = "arm,pl310-cache"; | 170 | compatible = "arm,pl310-cache"; |
171 | reg = <0x1e00a000 0x1000>; | 171 | reg = <0x1e00a000 0x1000>; |
172 | interrupts = <0 43 4>; | 172 | interrupts = <0 43 4>; |
173 | cache-unified; | ||
173 | cache-level = <2>; | 174 | cache-level = <2>; |
174 | arm,data-latency = <1 1 1>; | 175 | arm,data-latency = <1 1 1>; |
175 | arm,tag-latency = <1 1 1>; | 176 | arm,tag-latency = <1 1 1>; |
@@ -181,6 +182,8 @@ | |||
181 | <0 61 4>, | 182 | <0 61 4>, |
182 | <0 62 4>, | 183 | <0 62 4>, |
183 | <0 63 4>; | 184 | <0 63 4>; |
185 | interrupt-affinity = <&A9_0>, <&A9_1>, <&A9_2>, <&A9_3>; | ||
186 | |||
184 | }; | 187 | }; |
185 | 188 | ||
186 | dcc { | 189 | dcc { |
diff --git a/arch/arm/boot/dts/zynq-7000.dtsi b/arch/arm/boot/dts/zynq-7000.dtsi index a5cd2eda3edf..9ea54b3dba09 100644 --- a/arch/arm/boot/dts/zynq-7000.dtsi +++ b/arch/arm/boot/dts/zynq-7000.dtsi | |||
@@ -193,7 +193,7 @@ | |||
193 | }; | 193 | }; |
194 | 194 | ||
195 | gem0: ethernet@e000b000 { | 195 | gem0: ethernet@e000b000 { |
196 | compatible = "cdns,gem"; | 196 | compatible = "cdns,zynq-gem"; |
197 | reg = <0xe000b000 0x1000>; | 197 | reg = <0xe000b000 0x1000>; |
198 | status = "disabled"; | 198 | status = "disabled"; |
199 | interrupts = <0 22 4>; | 199 | interrupts = <0 22 4>; |
@@ -204,7 +204,7 @@ | |||
204 | }; | 204 | }; |
205 | 205 | ||
206 | gem1: ethernet@e000c000 { | 206 | gem1: ethernet@e000c000 { |
207 | compatible = "cdns,gem"; | 207 | compatible = "cdns,zynq-gem"; |
208 | reg = <0xe000c000 0x1000>; | 208 | reg = <0xe000c000 0x1000>; |
209 | status = "disabled"; | 209 | status = "disabled"; |
210 | interrupts = <0 45 4>; | 210 | interrupts = <0 45 4>; |
diff --git a/arch/arm/mach-exynos/common.h b/arch/arm/mach-exynos/common.h index acd5b560b728..5f5cd562c593 100644 --- a/arch/arm/mach-exynos/common.h +++ b/arch/arm/mach-exynos/common.h | |||
@@ -159,6 +159,8 @@ extern void exynos_enter_aftr(void); | |||
159 | 159 | ||
160 | extern struct cpuidle_exynos_data cpuidle_coupled_exynos_data; | 160 | extern struct cpuidle_exynos_data cpuidle_coupled_exynos_data; |
161 | 161 | ||
162 | extern void exynos_set_delayed_reset_assertion(bool enable); | ||
163 | |||
162 | extern void s5p_init_cpu(void __iomem *cpuid_addr); | 164 | extern void s5p_init_cpu(void __iomem *cpuid_addr); |
163 | extern unsigned int samsung_rev(void); | 165 | extern unsigned int samsung_rev(void); |
164 | extern void __iomem *cpu_boot_reg_base(void); | 166 | extern void __iomem *cpu_boot_reg_base(void); |
diff --git a/arch/arm/mach-exynos/exynos.c b/arch/arm/mach-exynos/exynos.c index bcde0dd668df..5917a30eee33 100644 --- a/arch/arm/mach-exynos/exynos.c +++ b/arch/arm/mach-exynos/exynos.c | |||
@@ -167,6 +167,33 @@ static void __init exynos_init_io(void) | |||
167 | } | 167 | } |
168 | 168 | ||
169 | /* | 169 | /* |
170 | * Set or clear the USE_DELAYED_RESET_ASSERTION option. Used by smp code | ||
171 | * and suspend. | ||
172 | * | ||
173 | * This is necessary only on Exynos4 SoCs. When system is running | ||
174 | * USE_DELAYED_RESET_ASSERTION should be set so the ARM CLK clock down | ||
175 | * feature could properly detect global idle state when secondary CPU is | ||
176 | * powered down. | ||
177 | * | ||
178 | * However this should not be set when such system is going into suspend. | ||
179 | */ | ||
180 | void exynos_set_delayed_reset_assertion(bool enable) | ||
181 | { | ||
182 | if (of_machine_is_compatible("samsung,exynos4")) { | ||
183 | unsigned int tmp, core_id; | ||
184 | |||
185 | for (core_id = 0; core_id < num_possible_cpus(); core_id++) { | ||
186 | tmp = pmu_raw_readl(EXYNOS_ARM_CORE_OPTION(core_id)); | ||
187 | if (enable) | ||
188 | tmp |= S5P_USE_DELAYED_RESET_ASSERTION; | ||
189 | else | ||
190 | tmp &= ~(S5P_USE_DELAYED_RESET_ASSERTION); | ||
191 | pmu_raw_writel(tmp, EXYNOS_ARM_CORE_OPTION(core_id)); | ||
192 | } | ||
193 | } | ||
194 | } | ||
195 | |||
196 | /* | ||
170 | * Apparently, these SoCs are not able to wake-up from suspend using | 197 | * Apparently, these SoCs are not able to wake-up from suspend using |
171 | * the PMU. Too bad. Should they suddenly become capable of such a | 198 | * the PMU. Too bad. Should they suddenly become capable of such a |
172 | * feat, the matches below should be moved to suspend.c. | 199 | * feat, the matches below should be moved to suspend.c. |
diff --git a/arch/arm/mach-exynos/platsmp.c b/arch/arm/mach-exynos/platsmp.c index ebd135bb0995..a825bca2a2b6 100644 --- a/arch/arm/mach-exynos/platsmp.c +++ b/arch/arm/mach-exynos/platsmp.c | |||
@@ -34,30 +34,6 @@ | |||
34 | 34 | ||
35 | extern void exynos4_secondary_startup(void); | 35 | extern void exynos4_secondary_startup(void); |
36 | 36 | ||
37 | /* | ||
38 | * Set or clear the USE_DELAYED_RESET_ASSERTION option, set on Exynos4 SoCs | ||
39 | * during hot-(un)plugging CPUx. | ||
40 | * | ||
41 | * The feature can be cleared safely during first boot of secondary CPU. | ||
42 | * | ||
43 | * Exynos4 SoCs require setting USE_DELAYED_RESET_ASSERTION during powering | ||
44 | * down a CPU so the CPU idle clock down feature could properly detect global | ||
45 | * idle state when CPUx is off. | ||
46 | */ | ||
47 | static void exynos_set_delayed_reset_assertion(u32 core_id, bool enable) | ||
48 | { | ||
49 | if (soc_is_exynos4()) { | ||
50 | unsigned int tmp; | ||
51 | |||
52 | tmp = pmu_raw_readl(EXYNOS_ARM_CORE_OPTION(core_id)); | ||
53 | if (enable) | ||
54 | tmp |= S5P_USE_DELAYED_RESET_ASSERTION; | ||
55 | else | ||
56 | tmp &= ~(S5P_USE_DELAYED_RESET_ASSERTION); | ||
57 | pmu_raw_writel(tmp, EXYNOS_ARM_CORE_OPTION(core_id)); | ||
58 | } | ||
59 | } | ||
60 | |||
61 | #ifdef CONFIG_HOTPLUG_CPU | 37 | #ifdef CONFIG_HOTPLUG_CPU |
62 | static inline void cpu_leave_lowpower(u32 core_id) | 38 | static inline void cpu_leave_lowpower(u32 core_id) |
63 | { | 39 | { |
@@ -73,8 +49,6 @@ static inline void cpu_leave_lowpower(u32 core_id) | |||
73 | : "=&r" (v) | 49 | : "=&r" (v) |
74 | : "Ir" (CR_C), "Ir" (0x40) | 50 | : "Ir" (CR_C), "Ir" (0x40) |
75 | : "cc"); | 51 | : "cc"); |
76 | |||
77 | exynos_set_delayed_reset_assertion(core_id, false); | ||
78 | } | 52 | } |
79 | 53 | ||
80 | static inline void platform_do_lowpower(unsigned int cpu, int *spurious) | 54 | static inline void platform_do_lowpower(unsigned int cpu, int *spurious) |
@@ -87,14 +61,6 @@ static inline void platform_do_lowpower(unsigned int cpu, int *spurious) | |||
87 | /* Turn the CPU off on next WFI instruction. */ | 61 | /* Turn the CPU off on next WFI instruction. */ |
88 | exynos_cpu_power_down(core_id); | 62 | exynos_cpu_power_down(core_id); |
89 | 63 | ||
90 | /* | ||
91 | * Exynos4 SoCs require setting | ||
92 | * USE_DELAYED_RESET_ASSERTION so the CPU idle | ||
93 | * clock down feature could properly detect | ||
94 | * global idle state when CPUx is off. | ||
95 | */ | ||
96 | exynos_set_delayed_reset_assertion(core_id, true); | ||
97 | |||
98 | wfi(); | 64 | wfi(); |
99 | 65 | ||
100 | if (pen_release == core_id) { | 66 | if (pen_release == core_id) { |
@@ -371,9 +337,6 @@ static int exynos_boot_secondary(unsigned int cpu, struct task_struct *idle) | |||
371 | udelay(10); | 337 | udelay(10); |
372 | } | 338 | } |
373 | 339 | ||
374 | /* No harm if this is called during first boot of secondary CPU */ | ||
375 | exynos_set_delayed_reset_assertion(core_id, false); | ||
376 | |||
377 | /* | 340 | /* |
378 | * now the secondary core is starting up let it run its | 341 | * now the secondary core is starting up let it run its |
379 | * calibrations, then wait for it to finish | 342 | * calibrations, then wait for it to finish |
@@ -420,6 +383,8 @@ static void __init exynos_smp_prepare_cpus(unsigned int max_cpus) | |||
420 | 383 | ||
421 | exynos_sysram_init(); | 384 | exynos_sysram_init(); |
422 | 385 | ||
386 | exynos_set_delayed_reset_assertion(true); | ||
387 | |||
423 | if (read_cpuid_part() == ARM_CPU_PART_CORTEX_A9) | 388 | if (read_cpuid_part() == ARM_CPU_PART_CORTEX_A9) |
424 | scu_enable(scu_base_addr()); | 389 | scu_enable(scu_base_addr()); |
425 | 390 | ||
diff --git a/arch/arm/mach-exynos/pm_domains.c b/arch/arm/mach-exynos/pm_domains.c index cbe56b35aea0..a9686535f9ed 100644 --- a/arch/arm/mach-exynos/pm_domains.c +++ b/arch/arm/mach-exynos/pm_domains.c | |||
@@ -188,7 +188,7 @@ no_clk: | |||
188 | args.np = np; | 188 | args.np = np; |
189 | args.args_count = 0; | 189 | args.args_count = 0; |
190 | child_domain = of_genpd_get_from_provider(&args); | 190 | child_domain = of_genpd_get_from_provider(&args); |
191 | if (!child_domain) | 191 | if (IS_ERR(child_domain)) |
192 | continue; | 192 | continue; |
193 | 193 | ||
194 | if (of_parse_phandle_with_args(np, "power-domains", | 194 | if (of_parse_phandle_with_args(np, "power-domains", |
@@ -196,7 +196,7 @@ no_clk: | |||
196 | continue; | 196 | continue; |
197 | 197 | ||
198 | parent_domain = of_genpd_get_from_provider(&args); | 198 | parent_domain = of_genpd_get_from_provider(&args); |
199 | if (!parent_domain) | 199 | if (IS_ERR(parent_domain)) |
200 | continue; | 200 | continue; |
201 | 201 | ||
202 | if (pm_genpd_add_subdomain(parent_domain, child_domain)) | 202 | if (pm_genpd_add_subdomain(parent_domain, child_domain)) |
diff --git a/arch/arm/mach-exynos/suspend.c b/arch/arm/mach-exynos/suspend.c index 3e6aea7f83af..c0b6dccbf7bd 100644 --- a/arch/arm/mach-exynos/suspend.c +++ b/arch/arm/mach-exynos/suspend.c | |||
@@ -342,6 +342,8 @@ static void exynos_pm_enter_sleep_mode(void) | |||
342 | 342 | ||
343 | static void exynos_pm_prepare(void) | 343 | static void exynos_pm_prepare(void) |
344 | { | 344 | { |
345 | exynos_set_delayed_reset_assertion(false); | ||
346 | |||
345 | /* Set wake-up mask registers */ | 347 | /* Set wake-up mask registers */ |
346 | exynos_pm_set_wakeup_mask(); | 348 | exynos_pm_set_wakeup_mask(); |
347 | 349 | ||
@@ -482,6 +484,7 @@ early_wakeup: | |||
482 | 484 | ||
483 | /* Clear SLEEP mode set in INFORM1 */ | 485 | /* Clear SLEEP mode set in INFORM1 */ |
484 | pmu_raw_writel(0x0, S5P_INFORM1); | 486 | pmu_raw_writel(0x0, S5P_INFORM1); |
487 | exynos_set_delayed_reset_assertion(true); | ||
485 | } | 488 | } |
486 | 489 | ||
487 | static void exynos3250_pm_resume(void) | 490 | static void exynos3250_pm_resume(void) |
@@ -723,8 +726,10 @@ void __init exynos_pm_init(void) | |||
723 | return; | 726 | return; |
724 | } | 727 | } |
725 | 728 | ||
726 | if (WARN_ON(!of_find_property(np, "interrupt-controller", NULL))) | 729 | if (WARN_ON(!of_find_property(np, "interrupt-controller", NULL))) { |
727 | pr_warn("Outdated DT detected, suspend/resume will NOT work\n"); | 730 | pr_warn("Outdated DT detected, suspend/resume will NOT work\n"); |
731 | return; | ||
732 | } | ||
728 | 733 | ||
729 | pm_data = (const struct exynos_pm_data *) match->data; | 734 | pm_data = (const struct exynos_pm_data *) match->data; |
730 | 735 | ||
diff --git a/arch/arm/mach-gemini/common.h b/arch/arm/mach-gemini/common.h index 38a45260a7c8..dd883698ff7e 100644 --- a/arch/arm/mach-gemini/common.h +++ b/arch/arm/mach-gemini/common.h | |||
@@ -12,6 +12,8 @@ | |||
12 | #ifndef __GEMINI_COMMON_H__ | 12 | #ifndef __GEMINI_COMMON_H__ |
13 | #define __GEMINI_COMMON_H__ | 13 | #define __GEMINI_COMMON_H__ |
14 | 14 | ||
15 | #include <linux/reboot.h> | ||
16 | |||
15 | struct mtd_partition; | 17 | struct mtd_partition; |
16 | 18 | ||
17 | extern void gemini_map_io(void); | 19 | extern void gemini_map_io(void); |
@@ -26,6 +28,6 @@ extern int platform_register_pflash(unsigned int size, | |||
26 | struct mtd_partition *parts, | 28 | struct mtd_partition *parts, |
27 | unsigned int nr_parts); | 29 | unsigned int nr_parts); |
28 | 30 | ||
29 | extern void gemini_restart(char mode, const char *cmd); | 31 | extern void gemini_restart(enum reboot_mode mode, const char *cmd); |
30 | 32 | ||
31 | #endif /* __GEMINI_COMMON_H__ */ | 33 | #endif /* __GEMINI_COMMON_H__ */ |
diff --git a/arch/arm/mach-gemini/reset.c b/arch/arm/mach-gemini/reset.c index b26659759e27..21a6d6d4f9c4 100644 --- a/arch/arm/mach-gemini/reset.c +++ b/arch/arm/mach-gemini/reset.c | |||
@@ -14,7 +14,9 @@ | |||
14 | #include <mach/hardware.h> | 14 | #include <mach/hardware.h> |
15 | #include <mach/global_reg.h> | 15 | #include <mach/global_reg.h> |
16 | 16 | ||
17 | void gemini_restart(char mode, const char *cmd) | 17 | #include "common.h" |
18 | |||
19 | void gemini_restart(enum reboot_mode mode, const char *cmd) | ||
18 | { | 20 | { |
19 | __raw_writel(RESET_GLOBAL | RESET_CPU1, | 21 | __raw_writel(RESET_GLOBAL | RESET_CPU1, |
20 | IO_ADDRESS(GEMINI_GLOBAL_BASE) + GLOBAL_RESET); | 22 | IO_ADDRESS(GEMINI_GLOBAL_BASE) + GLOBAL_RESET); |
diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c index 355b08936871..752969ff9de0 100644 --- a/arch/arm/mach-omap2/omap_hwmod.c +++ b/arch/arm/mach-omap2/omap_hwmod.c | |||
@@ -171,6 +171,12 @@ | |||
171 | */ | 171 | */ |
172 | #define LINKS_PER_OCP_IF 2 | 172 | #define LINKS_PER_OCP_IF 2 |
173 | 173 | ||
174 | /* | ||
175 | * Address offset (in bytes) between the reset control and the reset | ||
176 | * status registers: 4 bytes on OMAP4 | ||
177 | */ | ||
178 | #define OMAP4_RST_CTRL_ST_OFFSET 4 | ||
179 | |||
174 | /** | 180 | /** |
175 | * struct omap_hwmod_soc_ops - fn ptrs for some SoC-specific operations | 181 | * struct omap_hwmod_soc_ops - fn ptrs for some SoC-specific operations |
176 | * @enable_module: function to enable a module (via MODULEMODE) | 182 | * @enable_module: function to enable a module (via MODULEMODE) |
@@ -3016,10 +3022,12 @@ static int _omap4_deassert_hardreset(struct omap_hwmod *oh, | |||
3016 | if (ohri->st_shift) | 3022 | if (ohri->st_shift) |
3017 | pr_err("omap_hwmod: %s: %s: hwmod data error: OMAP4 does not support st_shift\n", | 3023 | pr_err("omap_hwmod: %s: %s: hwmod data error: OMAP4 does not support st_shift\n", |
3018 | oh->name, ohri->name); | 3024 | oh->name, ohri->name); |
3019 | return omap_prm_deassert_hardreset(ohri->rst_shift, 0, | 3025 | return omap_prm_deassert_hardreset(ohri->rst_shift, ohri->rst_shift, |
3020 | oh->clkdm->pwrdm.ptr->prcm_partition, | 3026 | oh->clkdm->pwrdm.ptr->prcm_partition, |
3021 | oh->clkdm->pwrdm.ptr->prcm_offs, | 3027 | oh->clkdm->pwrdm.ptr->prcm_offs, |
3022 | oh->prcm.omap4.rstctrl_offs, 0); | 3028 | oh->prcm.omap4.rstctrl_offs, |
3029 | oh->prcm.omap4.rstctrl_offs + | ||
3030 | OMAP4_RST_CTRL_ST_OFFSET); | ||
3023 | } | 3031 | } |
3024 | 3032 | ||
3025 | /** | 3033 | /** |
@@ -3048,27 +3056,6 @@ static int _omap4_is_hardreset_asserted(struct omap_hwmod *oh, | |||
3048 | } | 3056 | } |
3049 | 3057 | ||
3050 | /** | 3058 | /** |
3051 | * _am33xx_assert_hardreset - call AM33XX PRM hardreset fn with hwmod args | ||
3052 | * @oh: struct omap_hwmod * to assert hardreset | ||
3053 | * @ohri: hardreset line data | ||
3054 | * | ||
3055 | * Call am33xx_prminst_assert_hardreset() with parameters extracted | ||
3056 | * from the hwmod @oh and the hardreset line data @ohri. Only | ||
3057 | * intended for use as an soc_ops function pointer. Passes along the | ||
3058 | * return value from am33xx_prminst_assert_hardreset(). XXX This | ||
3059 | * function is scheduled for removal when the PRM code is moved into | ||
3060 | * drivers/. | ||
3061 | */ | ||
3062 | static int _am33xx_assert_hardreset(struct omap_hwmod *oh, | ||
3063 | struct omap_hwmod_rst_info *ohri) | ||
3064 | |||
3065 | { | ||
3066 | return omap_prm_assert_hardreset(ohri->rst_shift, 0, | ||
3067 | oh->clkdm->pwrdm.ptr->prcm_offs, | ||
3068 | oh->prcm.omap4.rstctrl_offs); | ||
3069 | } | ||
3070 | |||
3071 | /** | ||
3072 | * _am33xx_deassert_hardreset - call AM33XX PRM hardreset fn with hwmod args | 3059 | * _am33xx_deassert_hardreset - call AM33XX PRM hardreset fn with hwmod args |
3073 | * @oh: struct omap_hwmod * to deassert hardreset | 3060 | * @oh: struct omap_hwmod * to deassert hardreset |
3074 | * @ohri: hardreset line data | 3061 | * @ohri: hardreset line data |
@@ -3083,32 +3070,13 @@ static int _am33xx_assert_hardreset(struct omap_hwmod *oh, | |||
3083 | static int _am33xx_deassert_hardreset(struct omap_hwmod *oh, | 3070 | static int _am33xx_deassert_hardreset(struct omap_hwmod *oh, |
3084 | struct omap_hwmod_rst_info *ohri) | 3071 | struct omap_hwmod_rst_info *ohri) |
3085 | { | 3072 | { |
3086 | return omap_prm_deassert_hardreset(ohri->rst_shift, ohri->st_shift, 0, | 3073 | return omap_prm_deassert_hardreset(ohri->rst_shift, ohri->st_shift, |
3074 | oh->clkdm->pwrdm.ptr->prcm_partition, | ||
3087 | oh->clkdm->pwrdm.ptr->prcm_offs, | 3075 | oh->clkdm->pwrdm.ptr->prcm_offs, |
3088 | oh->prcm.omap4.rstctrl_offs, | 3076 | oh->prcm.omap4.rstctrl_offs, |
3089 | oh->prcm.omap4.rstst_offs); | 3077 | oh->prcm.omap4.rstst_offs); |
3090 | } | 3078 | } |
3091 | 3079 | ||
3092 | /** | ||
3093 | * _am33xx_is_hardreset_asserted - call AM33XX PRM hardreset fn with hwmod args | ||
3094 | * @oh: struct omap_hwmod * to test hardreset | ||
3095 | * @ohri: hardreset line data | ||
3096 | * | ||
3097 | * Call am33xx_prminst_is_hardreset_asserted() with parameters | ||
3098 | * extracted from the hwmod @oh and the hardreset line data @ohri. | ||
3099 | * Only intended for use as an soc_ops function pointer. Passes along | ||
3100 | * the return value from am33xx_prminst_is_hardreset_asserted(). XXX | ||
3101 | * This function is scheduled for removal when the PRM code is moved | ||
3102 | * into drivers/. | ||
3103 | */ | ||
3104 | static int _am33xx_is_hardreset_asserted(struct omap_hwmod *oh, | ||
3105 | struct omap_hwmod_rst_info *ohri) | ||
3106 | { | ||
3107 | return omap_prm_is_hardreset_asserted(ohri->rst_shift, 0, | ||
3108 | oh->clkdm->pwrdm.ptr->prcm_offs, | ||
3109 | oh->prcm.omap4.rstctrl_offs); | ||
3110 | } | ||
3111 | |||
3112 | /* Public functions */ | 3080 | /* Public functions */ |
3113 | 3081 | ||
3114 | u32 omap_hwmod_read(struct omap_hwmod *oh, u16 reg_offs) | 3082 | u32 omap_hwmod_read(struct omap_hwmod *oh, u16 reg_offs) |
@@ -3908,21 +3876,13 @@ void __init omap_hwmod_init(void) | |||
3908 | soc_ops.init_clkdm = _init_clkdm; | 3876 | soc_ops.init_clkdm = _init_clkdm; |
3909 | soc_ops.update_context_lost = _omap4_update_context_lost; | 3877 | soc_ops.update_context_lost = _omap4_update_context_lost; |
3910 | soc_ops.get_context_lost = _omap4_get_context_lost; | 3878 | soc_ops.get_context_lost = _omap4_get_context_lost; |
3911 | } else if (soc_is_am43xx()) { | 3879 | } else if (cpu_is_ti816x() || soc_is_am33xx() || soc_is_am43xx()) { |
3912 | soc_ops.enable_module = _omap4_enable_module; | 3880 | soc_ops.enable_module = _omap4_enable_module; |
3913 | soc_ops.disable_module = _omap4_disable_module; | 3881 | soc_ops.disable_module = _omap4_disable_module; |
3914 | soc_ops.wait_target_ready = _omap4_wait_target_ready; | 3882 | soc_ops.wait_target_ready = _omap4_wait_target_ready; |
3915 | soc_ops.assert_hardreset = _omap4_assert_hardreset; | 3883 | soc_ops.assert_hardreset = _omap4_assert_hardreset; |
3916 | soc_ops.deassert_hardreset = _omap4_deassert_hardreset; | ||
3917 | soc_ops.is_hardreset_asserted = _omap4_is_hardreset_asserted; | ||
3918 | soc_ops.init_clkdm = _init_clkdm; | ||
3919 | } else if (cpu_is_ti816x() || soc_is_am33xx()) { | ||
3920 | soc_ops.enable_module = _omap4_enable_module; | ||
3921 | soc_ops.disable_module = _omap4_disable_module; | ||
3922 | soc_ops.wait_target_ready = _omap4_wait_target_ready; | ||
3923 | soc_ops.assert_hardreset = _am33xx_assert_hardreset; | ||
3924 | soc_ops.deassert_hardreset = _am33xx_deassert_hardreset; | 3884 | soc_ops.deassert_hardreset = _am33xx_deassert_hardreset; |
3925 | soc_ops.is_hardreset_asserted = _am33xx_is_hardreset_asserted; | 3885 | soc_ops.is_hardreset_asserted = _omap4_is_hardreset_asserted; |
3926 | soc_ops.init_clkdm = _init_clkdm; | 3886 | soc_ops.init_clkdm = _init_clkdm; |
3927 | } else { | 3887 | } else { |
3928 | WARN(1, "omap_hwmod: unknown SoC type\n"); | 3888 | WARN(1, "omap_hwmod: unknown SoC type\n"); |
diff --git a/arch/arm/mach-omap2/omap_hwmod_43xx_data.c b/arch/arm/mach-omap2/omap_hwmod_43xx_data.c index e2223148ba4d..17e8004fc20f 100644 --- a/arch/arm/mach-omap2/omap_hwmod_43xx_data.c +++ b/arch/arm/mach-omap2/omap_hwmod_43xx_data.c | |||
@@ -544,6 +544,44 @@ static struct omap_hwmod am43xx_hdq1w_hwmod = { | |||
544 | }, | 544 | }, |
545 | }; | 545 | }; |
546 | 546 | ||
547 | static struct omap_hwmod_class_sysconfig am43xx_vpfe_sysc = { | ||
548 | .rev_offs = 0x0, | ||
549 | .sysc_offs = 0x104, | ||
550 | .sysc_flags = SYSC_HAS_MIDLEMODE | SYSC_HAS_SIDLEMODE, | ||
551 | .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART | | ||
552 | MSTANDBY_FORCE | MSTANDBY_SMART | MSTANDBY_NO), | ||
553 | .sysc_fields = &omap_hwmod_sysc_type2, | ||
554 | }; | ||
555 | |||
556 | static struct omap_hwmod_class am43xx_vpfe_hwmod_class = { | ||
557 | .name = "vpfe", | ||
558 | .sysc = &am43xx_vpfe_sysc, | ||
559 | }; | ||
560 | |||
561 | static struct omap_hwmod am43xx_vpfe0_hwmod = { | ||
562 | .name = "vpfe0", | ||
563 | .class = &am43xx_vpfe_hwmod_class, | ||
564 | .clkdm_name = "l3s_clkdm", | ||
565 | .prcm = { | ||
566 | .omap4 = { | ||
567 | .modulemode = MODULEMODE_SWCTRL, | ||
568 | .clkctrl_offs = AM43XX_CM_PER_VPFE0_CLKCTRL_OFFSET, | ||
569 | }, | ||
570 | }, | ||
571 | }; | ||
572 | |||
573 | static struct omap_hwmod am43xx_vpfe1_hwmod = { | ||
574 | .name = "vpfe1", | ||
575 | .class = &am43xx_vpfe_hwmod_class, | ||
576 | .clkdm_name = "l3s_clkdm", | ||
577 | .prcm = { | ||
578 | .omap4 = { | ||
579 | .modulemode = MODULEMODE_SWCTRL, | ||
580 | .clkctrl_offs = AM43XX_CM_PER_VPFE1_CLKCTRL_OFFSET, | ||
581 | }, | ||
582 | }, | ||
583 | }; | ||
584 | |||
547 | /* Interfaces */ | 585 | /* Interfaces */ |
548 | static struct omap_hwmod_ocp_if am43xx_l3_main__l4_hs = { | 586 | static struct omap_hwmod_ocp_if am43xx_l3_main__l4_hs = { |
549 | .master = &am33xx_l3_main_hwmod, | 587 | .master = &am33xx_l3_main_hwmod, |
@@ -825,6 +863,34 @@ static struct omap_hwmod_ocp_if am43xx_l4_ls__hdq1w = { | |||
825 | .user = OCP_USER_MPU | OCP_USER_SDMA, | 863 | .user = OCP_USER_MPU | OCP_USER_SDMA, |
826 | }; | 864 | }; |
827 | 865 | ||
866 | static struct omap_hwmod_ocp_if am43xx_l3__vpfe0 = { | ||
867 | .master = &am43xx_vpfe0_hwmod, | ||
868 | .slave = &am33xx_l3_main_hwmod, | ||
869 | .clk = "l3_gclk", | ||
870 | .user = OCP_USER_MPU | OCP_USER_SDMA, | ||
871 | }; | ||
872 | |||
873 | static struct omap_hwmod_ocp_if am43xx_l3__vpfe1 = { | ||
874 | .master = &am43xx_vpfe1_hwmod, | ||
875 | .slave = &am33xx_l3_main_hwmod, | ||
876 | .clk = "l3_gclk", | ||
877 | .user = OCP_USER_MPU | OCP_USER_SDMA, | ||
878 | }; | ||
879 | |||
880 | static struct omap_hwmod_ocp_if am43xx_l4_ls__vpfe0 = { | ||
881 | .master = &am33xx_l4_ls_hwmod, | ||
882 | .slave = &am43xx_vpfe0_hwmod, | ||
883 | .clk = "l4ls_gclk", | ||
884 | .user = OCP_USER_MPU | OCP_USER_SDMA, | ||
885 | }; | ||
886 | |||
887 | static struct omap_hwmod_ocp_if am43xx_l4_ls__vpfe1 = { | ||
888 | .master = &am33xx_l4_ls_hwmod, | ||
889 | .slave = &am43xx_vpfe1_hwmod, | ||
890 | .clk = "l4ls_gclk", | ||
891 | .user = OCP_USER_MPU | OCP_USER_SDMA, | ||
892 | }; | ||
893 | |||
828 | static struct omap_hwmod_ocp_if *am43xx_hwmod_ocp_ifs[] __initdata = { | 894 | static struct omap_hwmod_ocp_if *am43xx_hwmod_ocp_ifs[] __initdata = { |
829 | &am33xx_l4_wkup__synctimer, | 895 | &am33xx_l4_wkup__synctimer, |
830 | &am43xx_l4_ls__timer8, | 896 | &am43xx_l4_ls__timer8, |
@@ -925,6 +991,10 @@ static struct omap_hwmod_ocp_if *am43xx_hwmod_ocp_ifs[] __initdata = { | |||
925 | &am43xx_l4_ls__dss_dispc, | 991 | &am43xx_l4_ls__dss_dispc, |
926 | &am43xx_l4_ls__dss_rfbi, | 992 | &am43xx_l4_ls__dss_rfbi, |
927 | &am43xx_l4_ls__hdq1w, | 993 | &am43xx_l4_ls__hdq1w, |
994 | &am43xx_l3__vpfe0, | ||
995 | &am43xx_l3__vpfe1, | ||
996 | &am43xx_l4_ls__vpfe0, | ||
997 | &am43xx_l4_ls__vpfe1, | ||
928 | NULL, | 998 | NULL, |
929 | }; | 999 | }; |
930 | 1000 | ||
diff --git a/arch/arm/mach-omap2/prcm43xx.h b/arch/arm/mach-omap2/prcm43xx.h index 48df3b55057e..d0261996db6d 100644 --- a/arch/arm/mach-omap2/prcm43xx.h +++ b/arch/arm/mach-omap2/prcm43xx.h | |||
@@ -144,5 +144,6 @@ | |||
144 | #define AM43XX_CM_PER_USBPHYOCP2SCP1_CLKCTRL_OFFSET 0x05C0 | 144 | #define AM43XX_CM_PER_USBPHYOCP2SCP1_CLKCTRL_OFFSET 0x05C0 |
145 | #define AM43XX_CM_PER_DSS_CLKCTRL_OFFSET 0x0a20 | 145 | #define AM43XX_CM_PER_DSS_CLKCTRL_OFFSET 0x0a20 |
146 | #define AM43XX_CM_PER_HDQ1W_CLKCTRL_OFFSET 0x04a0 | 146 | #define AM43XX_CM_PER_HDQ1W_CLKCTRL_OFFSET 0x04a0 |
147 | 147 | #define AM43XX_CM_PER_VPFE0_CLKCTRL_OFFSET 0x0068 | |
148 | #define AM43XX_CM_PER_VPFE1_CLKCTRL_OFFSET 0x0070 | ||
148 | #endif | 149 | #endif |
diff --git a/arch/arm/mach-omap2/prminst44xx.c b/arch/arm/mach-omap2/prminst44xx.c index c4859c4d3646..d0b15dbafa2e 100644 --- a/arch/arm/mach-omap2/prminst44xx.c +++ b/arch/arm/mach-omap2/prminst44xx.c | |||
@@ -87,12 +87,6 @@ u32 omap4_prminst_rmw_inst_reg_bits(u32 mask, u32 bits, u8 part, s16 inst, | |||
87 | return v; | 87 | return v; |
88 | } | 88 | } |
89 | 89 | ||
90 | /* | ||
91 | * Address offset (in bytes) between the reset control and the reset | ||
92 | * status registers: 4 bytes on OMAP4 | ||
93 | */ | ||
94 | #define OMAP4_RST_CTRL_ST_OFFSET 4 | ||
95 | |||
96 | /** | 90 | /** |
97 | * omap4_prminst_is_hardreset_asserted - read the HW reset line state of | 91 | * omap4_prminst_is_hardreset_asserted - read the HW reset line state of |
98 | * submodules contained in the hwmod module | 92 | * submodules contained in the hwmod module |
@@ -141,11 +135,11 @@ int omap4_prminst_assert_hardreset(u8 shift, u8 part, s16 inst, | |||
141 | * omap4_prminst_deassert_hardreset - deassert a submodule hardreset line and | 135 | * omap4_prminst_deassert_hardreset - deassert a submodule hardreset line and |
142 | * wait | 136 | * wait |
143 | * @shift: register bit shift corresponding to the reset line to deassert | 137 | * @shift: register bit shift corresponding to the reset line to deassert |
144 | * @st_shift: status bit offset, not used for OMAP4+ | 138 | * @st_shift: status bit offset corresponding to the reset line |
145 | * @part: PRM partition | 139 | * @part: PRM partition |
146 | * @inst: PRM instance offset | 140 | * @inst: PRM instance offset |
147 | * @rstctrl_offs: reset register offset | 141 | * @rstctrl_offs: reset register offset |
148 | * @st_offs: reset status register offset, not used for OMAP4+ | 142 | * @rstst_offs: reset status register offset |
149 | * | 143 | * |
150 | * Some IPs like dsp, ipu or iva contain processors that require an HW | 144 | * Some IPs like dsp, ipu or iva contain processors that require an HW |
151 | * reset line to be asserted / deasserted in order to fully enable the | 145 | * reset line to be asserted / deasserted in order to fully enable the |
@@ -157,11 +151,11 @@ int omap4_prminst_assert_hardreset(u8 shift, u8 part, s16 inst, | |||
157 | * of reset, or -EBUSY if the submodule did not exit reset promptly. | 151 | * of reset, or -EBUSY if the submodule did not exit reset promptly. |
158 | */ | 152 | */ |
159 | int omap4_prminst_deassert_hardreset(u8 shift, u8 st_shift, u8 part, s16 inst, | 153 | int omap4_prminst_deassert_hardreset(u8 shift, u8 st_shift, u8 part, s16 inst, |
160 | u16 rstctrl_offs, u16 st_offs) | 154 | u16 rstctrl_offs, u16 rstst_offs) |
161 | { | 155 | { |
162 | int c; | 156 | int c; |
163 | u32 mask = 1 << shift; | 157 | u32 mask = 1 << shift; |
164 | u16 rstst_offs = rstctrl_offs + OMAP4_RST_CTRL_ST_OFFSET; | 158 | u32 st_mask = 1 << st_shift; |
165 | 159 | ||
166 | /* Check the current status to avoid de-asserting the line twice */ | 160 | /* Check the current status to avoid de-asserting the line twice */ |
167 | if (omap4_prminst_is_hardreset_asserted(shift, part, inst, | 161 | if (omap4_prminst_is_hardreset_asserted(shift, part, inst, |
@@ -169,13 +163,13 @@ int omap4_prminst_deassert_hardreset(u8 shift, u8 st_shift, u8 part, s16 inst, | |||
169 | return -EEXIST; | 163 | return -EEXIST; |
170 | 164 | ||
171 | /* Clear the reset status by writing 1 to the status bit */ | 165 | /* Clear the reset status by writing 1 to the status bit */ |
172 | omap4_prminst_rmw_inst_reg_bits(0xffffffff, mask, part, inst, | 166 | omap4_prminst_rmw_inst_reg_bits(0xffffffff, st_mask, part, inst, |
173 | rstst_offs); | 167 | rstst_offs); |
174 | /* de-assert the reset control line */ | 168 | /* de-assert the reset control line */ |
175 | omap4_prminst_rmw_inst_reg_bits(mask, 0, part, inst, rstctrl_offs); | 169 | omap4_prminst_rmw_inst_reg_bits(mask, 0, part, inst, rstctrl_offs); |
176 | /* wait the status to be set */ | 170 | /* wait the status to be set */ |
177 | omap_test_timeout(omap4_prminst_is_hardreset_asserted(shift, part, inst, | 171 | omap_test_timeout(omap4_prminst_is_hardreset_asserted(st_shift, part, |
178 | rstst_offs), | 172 | inst, rstst_offs), |
179 | MAX_MODULE_HARDRESET_WAIT, c); | 173 | MAX_MODULE_HARDRESET_WAIT, c); |
180 | 174 | ||
181 | return (c == MAX_MODULE_HARDRESET_WAIT) ? -EBUSY : 0; | 175 | return (c == MAX_MODULE_HARDRESET_WAIT) ? -EBUSY : 0; |
diff --git a/arch/arm/mach-omap2/timer.c b/arch/arm/mach-omap2/timer.c index cef67af9e9b8..cac46d852da1 100644 --- a/arch/arm/mach-omap2/timer.c +++ b/arch/arm/mach-omap2/timer.c | |||
@@ -298,14 +298,11 @@ static int __init omap_dm_timer_init_one(struct omap_dm_timer *timer, | |||
298 | if (IS_ERR(src)) | 298 | if (IS_ERR(src)) |
299 | return PTR_ERR(src); | 299 | return PTR_ERR(src); |
300 | 300 | ||
301 | if (clk_get_parent(timer->fclk) != src) { | 301 | r = clk_set_parent(timer->fclk, src); |
302 | r = clk_set_parent(timer->fclk, src); | 302 | if (r < 0) { |
303 | if (r < 0) { | 303 | pr_warn("%s: %s cannot set source\n", __func__, oh->name); |
304 | pr_warn("%s: %s cannot set source\n", __func__, | 304 | clk_put(src); |
305 | oh->name); | 305 | return r; |
306 | clk_put(src); | ||
307 | return r; | ||
308 | } | ||
309 | } | 306 | } |
310 | 307 | ||
311 | clk_put(src); | 308 | clk_put(src); |
diff --git a/arch/arm/mach-rockchip/pm.c b/arch/arm/mach-rockchip/pm.c index 22812fe06460..b0dcbe28f78c 100644 --- a/arch/arm/mach-rockchip/pm.c +++ b/arch/arm/mach-rockchip/pm.c | |||
@@ -44,11 +44,9 @@ static void __iomem *rk3288_bootram_base; | |||
44 | static phys_addr_t rk3288_bootram_phy; | 44 | static phys_addr_t rk3288_bootram_phy; |
45 | 45 | ||
46 | static struct regmap *pmu_regmap; | 46 | static struct regmap *pmu_regmap; |
47 | static struct regmap *grf_regmap; | ||
48 | static struct regmap *sgrf_regmap; | 47 | static struct regmap *sgrf_regmap; |
49 | 48 | ||
50 | static u32 rk3288_pmu_pwr_mode_con; | 49 | static u32 rk3288_pmu_pwr_mode_con; |
51 | static u32 rk3288_grf_soc_con0; | ||
52 | static u32 rk3288_sgrf_soc_con0; | 50 | static u32 rk3288_sgrf_soc_con0; |
53 | 51 | ||
54 | static inline u32 rk3288_l2_config(void) | 52 | static inline u32 rk3288_l2_config(void) |
@@ -72,26 +70,12 @@ static void rk3288_slp_mode_set(int level) | |||
72 | { | 70 | { |
73 | u32 mode_set, mode_set1; | 71 | u32 mode_set, mode_set1; |
74 | 72 | ||
75 | regmap_read(grf_regmap, RK3288_GRF_SOC_CON0, &rk3288_grf_soc_con0); | ||
76 | |||
77 | regmap_read(sgrf_regmap, RK3288_SGRF_SOC_CON0, &rk3288_sgrf_soc_con0); | 73 | regmap_read(sgrf_regmap, RK3288_SGRF_SOC_CON0, &rk3288_sgrf_soc_con0); |
78 | 74 | ||
79 | regmap_read(pmu_regmap, RK3288_PMU_PWRMODE_CON, | 75 | regmap_read(pmu_regmap, RK3288_PMU_PWRMODE_CON, |
80 | &rk3288_pmu_pwr_mode_con); | 76 | &rk3288_pmu_pwr_mode_con); |
81 | 77 | ||
82 | /* | 78 | /* |
83 | * We need set this bit GRF_FORCE_JTAG here, for the debug module, | ||
84 | * otherwise, it may become inaccessible after resume. | ||
85 | * This creates a potential security issue, as the sdmmc pins may | ||
86 | * accept jtag data for a short time during resume if no card is | ||
87 | * inserted. | ||
88 | * But this is of course also true for the regular boot, before we | ||
89 | * turn of the jtag/sdmmc autodetect. | ||
90 | */ | ||
91 | regmap_write(grf_regmap, RK3288_GRF_SOC_CON0, GRF_FORCE_JTAG | | ||
92 | GRF_FORCE_JTAG_WRITE); | ||
93 | |||
94 | /* | ||
95 | * SGRF_FAST_BOOT_EN - system to boot from FAST_BOOT_ADDR | 79 | * SGRF_FAST_BOOT_EN - system to boot from FAST_BOOT_ADDR |
96 | * PCLK_WDT_GATE - disable WDT during suspend. | 80 | * PCLK_WDT_GATE - disable WDT during suspend. |
97 | */ | 81 | */ |
@@ -151,9 +135,6 @@ static void rk3288_slp_mode_set_resume(void) | |||
151 | regmap_write(sgrf_regmap, RK3288_SGRF_SOC_CON0, | 135 | regmap_write(sgrf_regmap, RK3288_SGRF_SOC_CON0, |
152 | rk3288_sgrf_soc_con0 | SGRF_PCLK_WDT_GATE_WRITE | 136 | rk3288_sgrf_soc_con0 | SGRF_PCLK_WDT_GATE_WRITE |
153 | | SGRF_FAST_BOOT_EN_WRITE); | 137 | | SGRF_FAST_BOOT_EN_WRITE); |
154 | |||
155 | regmap_write(grf_regmap, RK3288_GRF_SOC_CON0, rk3288_grf_soc_con0 | | ||
156 | GRF_FORCE_JTAG_WRITE); | ||
157 | } | 138 | } |
158 | 139 | ||
159 | static int rockchip_lpmode_enter(unsigned long arg) | 140 | static int rockchip_lpmode_enter(unsigned long arg) |
@@ -212,13 +193,6 @@ static int rk3288_suspend_init(struct device_node *np) | |||
212 | return PTR_ERR(pmu_regmap); | 193 | return PTR_ERR(pmu_regmap); |
213 | } | 194 | } |
214 | 195 | ||
215 | grf_regmap = syscon_regmap_lookup_by_compatible( | ||
216 | "rockchip,rk3288-grf"); | ||
217 | if (IS_ERR(grf_regmap)) { | ||
218 | pr_err("%s: could not find grf regmap\n", __func__); | ||
219 | return PTR_ERR(pmu_regmap); | ||
220 | } | ||
221 | |||
222 | sram_np = of_find_compatible_node(NULL, NULL, | 196 | sram_np = of_find_compatible_node(NULL, NULL, |
223 | "rockchip,rk3288-pmu-sram"); | 197 | "rockchip,rk3288-pmu-sram"); |
224 | if (!sram_np) { | 198 | if (!sram_np) { |
diff --git a/arch/arm/mach-rockchip/pm.h b/arch/arm/mach-rockchip/pm.h index f8a747bc1437..3e8d39c0c3d5 100644 --- a/arch/arm/mach-rockchip/pm.h +++ b/arch/arm/mach-rockchip/pm.h | |||
@@ -48,10 +48,6 @@ static inline void rockchip_suspend_init(void) | |||
48 | #define RK3288_PMU_WAKEUP_RST_CLR_CNT 0x44 | 48 | #define RK3288_PMU_WAKEUP_RST_CLR_CNT 0x44 |
49 | #define RK3288_PMU_PWRMODE_CON1 0x90 | 49 | #define RK3288_PMU_PWRMODE_CON1 0x90 |
50 | 50 | ||
51 | #define RK3288_GRF_SOC_CON0 0x244 | ||
52 | #define GRF_FORCE_JTAG BIT(12) | ||
53 | #define GRF_FORCE_JTAG_WRITE BIT(28) | ||
54 | |||
55 | #define RK3288_SGRF_SOC_CON0 (0x0000) | 51 | #define RK3288_SGRF_SOC_CON0 (0x0000) |
56 | #define RK3288_SGRF_FAST_BOOT_ADDR (0x0120) | 52 | #define RK3288_SGRF_FAST_BOOT_ADDR (0x0120) |
57 | #define SGRF_PCLK_WDT_GATE BIT(6) | 53 | #define SGRF_PCLK_WDT_GATE BIT(6) |
diff --git a/arch/arm/xen/enlighten.c b/arch/arm/xen/enlighten.c index 224081ccc92f..7d0f07020c80 100644 --- a/arch/arm/xen/enlighten.c +++ b/arch/arm/xen/enlighten.c | |||
@@ -272,6 +272,7 @@ void xen_arch_pre_suspend(void) { } | |||
272 | void xen_arch_post_suspend(int suspend_cancelled) { } | 272 | void xen_arch_post_suspend(int suspend_cancelled) { } |
273 | void xen_timer_resume(void) { } | 273 | void xen_timer_resume(void) { } |
274 | void xen_arch_resume(void) { } | 274 | void xen_arch_resume(void) { } |
275 | void xen_arch_suspend(void) { } | ||
275 | 276 | ||
276 | 277 | ||
277 | /* In the hypervisor.S file. */ | 278 | /* In the hypervisor.S file. */ |
diff --git a/arch/arm64/boot/dts/arm/juno-motherboard.dtsi b/arch/arm64/boot/dts/arm/juno-motherboard.dtsi index c138b95a8356..351c95bda89e 100644 --- a/arch/arm64/boot/dts/arm/juno-motherboard.dtsi +++ b/arch/arm64/boot/dts/arm/juno-motherboard.dtsi | |||
@@ -21,6 +21,20 @@ | |||
21 | clock-output-names = "juno_mb:clk25mhz"; | 21 | clock-output-names = "juno_mb:clk25mhz"; |
22 | }; | 22 | }; |
23 | 23 | ||
24 | v2m_refclk1mhz: refclk1mhz { | ||
25 | compatible = "fixed-clock"; | ||
26 | #clock-cells = <0>; | ||
27 | clock-frequency = <1000000>; | ||
28 | clock-output-names = "juno_mb:refclk1mhz"; | ||
29 | }; | ||
30 | |||
31 | v2m_refclk32khz: refclk32khz { | ||
32 | compatible = "fixed-clock"; | ||
33 | #clock-cells = <0>; | ||
34 | clock-frequency = <32768>; | ||
35 | clock-output-names = "juno_mb:refclk32khz"; | ||
36 | }; | ||
37 | |||
24 | motherboard { | 38 | motherboard { |
25 | compatible = "arm,vexpress,v2p-p1", "simple-bus"; | 39 | compatible = "arm,vexpress,v2p-p1", "simple-bus"; |
26 | #address-cells = <2>; /* SMB chipselect number and offset */ | 40 | #address-cells = <2>; /* SMB chipselect number and offset */ |
@@ -66,6 +80,15 @@ | |||
66 | #size-cells = <1>; | 80 | #size-cells = <1>; |
67 | ranges = <0 3 0 0x200000>; | 81 | ranges = <0 3 0 0x200000>; |
68 | 82 | ||
83 | v2m_sysctl: sysctl@020000 { | ||
84 | compatible = "arm,sp810", "arm,primecell"; | ||
85 | reg = <0x020000 0x1000>; | ||
86 | clocks = <&v2m_refclk32khz>, <&v2m_refclk1mhz>, <&mb_clk24mhz>; | ||
87 | clock-names = "refclk", "timclk", "apb_pclk"; | ||
88 | #clock-cells = <1>; | ||
89 | clock-output-names = "timerclken0", "timerclken1", "timerclken2", "timerclken3"; | ||
90 | }; | ||
91 | |||
69 | mmci@050000 { | 92 | mmci@050000 { |
70 | compatible = "arm,pl180", "arm,primecell"; | 93 | compatible = "arm,pl180", "arm,primecell"; |
71 | reg = <0x050000 0x1000>; | 94 | reg = <0x050000 0x1000>; |
@@ -106,16 +129,16 @@ | |||
106 | compatible = "arm,sp804", "arm,primecell"; | 129 | compatible = "arm,sp804", "arm,primecell"; |
107 | reg = <0x110000 0x10000>; | 130 | reg = <0x110000 0x10000>; |
108 | interrupts = <9>; | 131 | interrupts = <9>; |
109 | clocks = <&mb_clk24mhz>, <&soc_smc50mhz>; | 132 | clocks = <&v2m_sysctl 0>, <&v2m_sysctl 1>, <&mb_clk24mhz>; |
110 | clock-names = "timclken1", "apb_pclk"; | 133 | clock-names = "timclken1", "timclken2", "apb_pclk"; |
111 | }; | 134 | }; |
112 | 135 | ||
113 | v2m_timer23: timer@120000 { | 136 | v2m_timer23: timer@120000 { |
114 | compatible = "arm,sp804", "arm,primecell"; | 137 | compatible = "arm,sp804", "arm,primecell"; |
115 | reg = <0x120000 0x10000>; | 138 | reg = <0x120000 0x10000>; |
116 | interrupts = <9>; | 139 | interrupts = <9>; |
117 | clocks = <&mb_clk24mhz>, <&soc_smc50mhz>; | 140 | clocks = <&v2m_sysctl 2>, <&v2m_sysctl 3>, <&mb_clk24mhz>; |
118 | clock-names = "timclken1", "apb_pclk"; | 141 | clock-names = "timclken1", "timclken2", "apb_pclk"; |
119 | }; | 142 | }; |
120 | 143 | ||
121 | rtc@170000 { | 144 | rtc@170000 { |
diff --git a/arch/arm64/kernel/alternative.c b/arch/arm64/kernel/alternative.c index 21033bba9390..28f8365edc4c 100644 --- a/arch/arm64/kernel/alternative.c +++ b/arch/arm64/kernel/alternative.c | |||
@@ -24,7 +24,6 @@ | |||
24 | #include <asm/cacheflush.h> | 24 | #include <asm/cacheflush.h> |
25 | #include <asm/alternative.h> | 25 | #include <asm/alternative.h> |
26 | #include <asm/cpufeature.h> | 26 | #include <asm/cpufeature.h> |
27 | #include <asm/insn.h> | ||
28 | #include <linux/stop_machine.h> | 27 | #include <linux/stop_machine.h> |
29 | 28 | ||
30 | extern struct alt_instr __alt_instructions[], __alt_instructions_end[]; | 29 | extern struct alt_instr __alt_instructions[], __alt_instructions_end[]; |
@@ -34,48 +33,6 @@ struct alt_region { | |||
34 | struct alt_instr *end; | 33 | struct alt_instr *end; |
35 | }; | 34 | }; |
36 | 35 | ||
37 | /* | ||
38 | * Decode the imm field of a b/bl instruction, and return the byte | ||
39 | * offset as a signed value (so it can be used when computing a new | ||
40 | * branch target). | ||
41 | */ | ||
42 | static s32 get_branch_offset(u32 insn) | ||
43 | { | ||
44 | s32 imm = aarch64_insn_decode_immediate(AARCH64_INSN_IMM_26, insn); | ||
45 | |||
46 | /* sign-extend the immediate before turning it into a byte offset */ | ||
47 | return (imm << 6) >> 4; | ||
48 | } | ||
49 | |||
50 | static u32 get_alt_insn(u8 *insnptr, u8 *altinsnptr) | ||
51 | { | ||
52 | u32 insn; | ||
53 | |||
54 | aarch64_insn_read(altinsnptr, &insn); | ||
55 | |||
56 | /* Stop the world on instructions we don't support... */ | ||
57 | BUG_ON(aarch64_insn_is_cbz(insn)); | ||
58 | BUG_ON(aarch64_insn_is_cbnz(insn)); | ||
59 | BUG_ON(aarch64_insn_is_bcond(insn)); | ||
60 | /* ... and there is probably more. */ | ||
61 | |||
62 | if (aarch64_insn_is_b(insn) || aarch64_insn_is_bl(insn)) { | ||
63 | enum aarch64_insn_branch_type type; | ||
64 | unsigned long target; | ||
65 | |||
66 | if (aarch64_insn_is_b(insn)) | ||
67 | type = AARCH64_INSN_BRANCH_NOLINK; | ||
68 | else | ||
69 | type = AARCH64_INSN_BRANCH_LINK; | ||
70 | |||
71 | target = (unsigned long)altinsnptr + get_branch_offset(insn); | ||
72 | insn = aarch64_insn_gen_branch_imm((unsigned long)insnptr, | ||
73 | target, type); | ||
74 | } | ||
75 | |||
76 | return insn; | ||
77 | } | ||
78 | |||
79 | static int __apply_alternatives(void *alt_region) | 36 | static int __apply_alternatives(void *alt_region) |
80 | { | 37 | { |
81 | struct alt_instr *alt; | 38 | struct alt_instr *alt; |
@@ -83,9 +40,6 @@ static int __apply_alternatives(void *alt_region) | |||
83 | u8 *origptr, *replptr; | 40 | u8 *origptr, *replptr; |
84 | 41 | ||
85 | for (alt = region->begin; alt < region->end; alt++) { | 42 | for (alt = region->begin; alt < region->end; alt++) { |
86 | u32 insn; | ||
87 | int i; | ||
88 | |||
89 | if (!cpus_have_cap(alt->cpufeature)) | 43 | if (!cpus_have_cap(alt->cpufeature)) |
90 | continue; | 44 | continue; |
91 | 45 | ||
@@ -95,12 +49,7 @@ static int __apply_alternatives(void *alt_region) | |||
95 | 49 | ||
96 | origptr = (u8 *)&alt->orig_offset + alt->orig_offset; | 50 | origptr = (u8 *)&alt->orig_offset + alt->orig_offset; |
97 | replptr = (u8 *)&alt->alt_offset + alt->alt_offset; | 51 | replptr = (u8 *)&alt->alt_offset + alt->alt_offset; |
98 | 52 | memcpy(origptr, replptr, alt->alt_len); | |
99 | for (i = 0; i < alt->alt_len; i += sizeof(insn)) { | ||
100 | insn = get_alt_insn(origptr + i, replptr + i); | ||
101 | aarch64_insn_write(origptr + i, insn); | ||
102 | } | ||
103 | |||
104 | flush_icache_range((uintptr_t)origptr, | 53 | flush_icache_range((uintptr_t)origptr, |
105 | (uintptr_t)(origptr + alt->alt_len)); | 54 | (uintptr_t)(origptr + alt->alt_len)); |
106 | } | 55 | } |
diff --git a/arch/arm64/kernel/perf_event.c b/arch/arm64/kernel/perf_event.c index 23f25acf43a9..cce18c85d2e8 100644 --- a/arch/arm64/kernel/perf_event.c +++ b/arch/arm64/kernel/perf_event.c | |||
@@ -1315,15 +1315,15 @@ static int armpmu_device_probe(struct platform_device *pdev) | |||
1315 | if (!cpu_pmu) | 1315 | if (!cpu_pmu) |
1316 | return -ENODEV; | 1316 | return -ENODEV; |
1317 | 1317 | ||
1318 | irqs = kcalloc(pdev->num_resources, sizeof(*irqs), GFP_KERNEL); | ||
1319 | if (!irqs) | ||
1320 | return -ENOMEM; | ||
1321 | |||
1322 | /* Don't bother with PPIs; they're already affine */ | 1318 | /* Don't bother with PPIs; they're already affine */ |
1323 | irq = platform_get_irq(pdev, 0); | 1319 | irq = platform_get_irq(pdev, 0); |
1324 | if (irq >= 0 && irq_is_percpu(irq)) | 1320 | if (irq >= 0 && irq_is_percpu(irq)) |
1325 | return 0; | 1321 | return 0; |
1326 | 1322 | ||
1323 | irqs = kcalloc(pdev->num_resources, sizeof(*irqs), GFP_KERNEL); | ||
1324 | if (!irqs) | ||
1325 | return -ENOMEM; | ||
1326 | |||
1327 | for (i = 0; i < pdev->num_resources; ++i) { | 1327 | for (i = 0; i < pdev->num_resources; ++i) { |
1328 | struct device_node *dn; | 1328 | struct device_node *dn; |
1329 | int cpu; | 1329 | int cpu; |
diff --git a/arch/arm64/mm/dump.c b/arch/arm64/mm/dump.c index 74c256744b25..f3d6221cd5bd 100644 --- a/arch/arm64/mm/dump.c +++ b/arch/arm64/mm/dump.c | |||
@@ -328,10 +328,12 @@ static int ptdump_init(void) | |||
328 | for (j = 0; j < pg_level[i].num; j++) | 328 | for (j = 0; j < pg_level[i].num; j++) |
329 | pg_level[i].mask |= pg_level[i].bits[j].mask; | 329 | pg_level[i].mask |= pg_level[i].bits[j].mask; |
330 | 330 | ||
331 | #ifdef CONFIG_SPARSEMEM_VMEMMAP | ||
331 | address_markers[VMEMMAP_START_NR].start_address = | 332 | address_markers[VMEMMAP_START_NR].start_address = |
332 | (unsigned long)virt_to_page(PAGE_OFFSET); | 333 | (unsigned long)virt_to_page(PAGE_OFFSET); |
333 | address_markers[VMEMMAP_END_NR].start_address = | 334 | address_markers[VMEMMAP_END_NR].start_address = |
334 | (unsigned long)virt_to_page(high_memory); | 335 | (unsigned long)virt_to_page(high_memory); |
336 | #endif | ||
335 | 337 | ||
336 | pe = debugfs_create_file("kernel_page_tables", 0400, NULL, NULL, | 338 | pe = debugfs_create_file("kernel_page_tables", 0400, NULL, NULL, |
337 | &ptdump_fops); | 339 | &ptdump_fops); |
diff --git a/arch/arm64/net/bpf_jit_comp.c b/arch/arm64/net/bpf_jit_comp.c index edba042b2325..dc6a4842683a 100644 --- a/arch/arm64/net/bpf_jit_comp.c +++ b/arch/arm64/net/bpf_jit_comp.c | |||
@@ -487,7 +487,7 @@ emit_cond_jmp: | |||
487 | return -EINVAL; | 487 | return -EINVAL; |
488 | } | 488 | } |
489 | 489 | ||
490 | imm64 = (u64)insn1.imm << 32 | imm; | 490 | imm64 = (u64)insn1.imm << 32 | (u32)imm; |
491 | emit_a64_mov_i64(dst, imm64, ctx); | 491 | emit_a64_mov_i64(dst, imm64, ctx); |
492 | 492 | ||
493 | return 1; | 493 | return 1; |
diff --git a/arch/mips/Makefile b/arch/mips/Makefile index 5200f649dd4e..ae2dd59050f7 100644 --- a/arch/mips/Makefile +++ b/arch/mips/Makefile | |||
@@ -277,7 +277,7 @@ LDFLAGS += -m $(ld-emul) | |||
277 | ifdef CONFIG_MIPS | 277 | ifdef CONFIG_MIPS |
278 | CHECKFLAGS += $(shell $(CC) $(KBUILD_CFLAGS) -dM -E -x c /dev/null | \ | 278 | CHECKFLAGS += $(shell $(CC) $(KBUILD_CFLAGS) -dM -E -x c /dev/null | \ |
279 | egrep -vw '__GNUC_(|MINOR_|PATCHLEVEL_)_' | \ | 279 | egrep -vw '__GNUC_(|MINOR_|PATCHLEVEL_)_' | \ |
280 | sed -e "s/^\#define /-D'/" -e "s/ /'='/" -e "s/$$/'/") | 280 | sed -e "s/^\#define /-D'/" -e "s/ /'='/" -e "s/$$/'/" -e 's/\$$/&&/g') |
281 | ifdef CONFIG_64BIT | 281 | ifdef CONFIG_64BIT |
282 | CHECKFLAGS += -m64 | 282 | CHECKFLAGS += -m64 |
283 | endif | 283 | endif |
diff --git a/arch/mips/include/asm/elf.h b/arch/mips/include/asm/elf.h index a594d8ed9698..f19e890b99d2 100644 --- a/arch/mips/include/asm/elf.h +++ b/arch/mips/include/asm/elf.h | |||
@@ -304,7 +304,7 @@ do { \ | |||
304 | \ | 304 | \ |
305 | current->thread.abi = &mips_abi; \ | 305 | current->thread.abi = &mips_abi; \ |
306 | \ | 306 | \ |
307 | current->thread.fpu.fcr31 = current_cpu_data.fpu_csr31; \ | 307 | current->thread.fpu.fcr31 = boot_cpu_data.fpu_csr31; \ |
308 | } while (0) | 308 | } while (0) |
309 | 309 | ||
310 | #endif /* CONFIG_32BIT */ | 310 | #endif /* CONFIG_32BIT */ |
@@ -366,7 +366,7 @@ do { \ | |||
366 | else \ | 366 | else \ |
367 | current->thread.abi = &mips_abi; \ | 367 | current->thread.abi = &mips_abi; \ |
368 | \ | 368 | \ |
369 | current->thread.fpu.fcr31 = current_cpu_data.fpu_csr31; \ | 369 | current->thread.fpu.fcr31 = boot_cpu_data.fpu_csr31; \ |
370 | \ | 370 | \ |
371 | p = personality(current->personality); \ | 371 | p = personality(current->personality); \ |
372 | if (p != PER_LINUX32 && p != PER_LINUX) \ | 372 | if (p != PER_LINUX32 && p != PER_LINUX) \ |
diff --git a/arch/mips/kernel/ptrace.c b/arch/mips/kernel/ptrace.c index d544e774eea6..e933a309f2ea 100644 --- a/arch/mips/kernel/ptrace.c +++ b/arch/mips/kernel/ptrace.c | |||
@@ -176,7 +176,7 @@ int ptrace_setfpregs(struct task_struct *child, __u32 __user *data) | |||
176 | 176 | ||
177 | __get_user(value, data + 64); | 177 | __get_user(value, data + 64); |
178 | fcr31 = child->thread.fpu.fcr31; | 178 | fcr31 = child->thread.fpu.fcr31; |
179 | mask = current_cpu_data.fpu_msk31; | 179 | mask = boot_cpu_data.fpu_msk31; |
180 | child->thread.fpu.fcr31 = (value & ~mask) | (fcr31 & mask); | 180 | child->thread.fpu.fcr31 = (value & ~mask) | (fcr31 & mask); |
181 | 181 | ||
182 | /* FIR may not be written. */ | 182 | /* FIR may not be written. */ |
diff --git a/arch/mips/kernel/smp-cps.c b/arch/mips/kernel/smp-cps.c index 7e011f95bb8e..4251d390b5b6 100644 --- a/arch/mips/kernel/smp-cps.c +++ b/arch/mips/kernel/smp-cps.c | |||
@@ -92,7 +92,7 @@ static void __init cps_smp_setup(void) | |||
92 | #ifdef CONFIG_MIPS_MT_FPAFF | 92 | #ifdef CONFIG_MIPS_MT_FPAFF |
93 | /* If we have an FPU, enroll ourselves in the FPU-full mask */ | 93 | /* If we have an FPU, enroll ourselves in the FPU-full mask */ |
94 | if (cpu_has_fpu) | 94 | if (cpu_has_fpu) |
95 | cpu_set(0, mt_fpu_cpumask); | 95 | cpumask_set_cpu(0, &mt_fpu_cpumask); |
96 | #endif /* CONFIG_MIPS_MT_FPAFF */ | 96 | #endif /* CONFIG_MIPS_MT_FPAFF */ |
97 | } | 97 | } |
98 | 98 | ||
diff --git a/arch/mips/kernel/traps.c b/arch/mips/kernel/traps.c index ba32e48d4697..d2d1c1933bc9 100644 --- a/arch/mips/kernel/traps.c +++ b/arch/mips/kernel/traps.c | |||
@@ -269,7 +269,6 @@ static void __show_regs(const struct pt_regs *regs) | |||
269 | */ | 269 | */ |
270 | printk("epc : %0*lx %pS\n", field, regs->cp0_epc, | 270 | printk("epc : %0*lx %pS\n", field, regs->cp0_epc, |
271 | (void *) regs->cp0_epc); | 271 | (void *) regs->cp0_epc); |
272 | printk(" %s\n", print_tainted()); | ||
273 | printk("ra : %0*lx %pS\n", field, regs->regs[31], | 272 | printk("ra : %0*lx %pS\n", field, regs->regs[31], |
274 | (void *) regs->regs[31]); | 273 | (void *) regs->regs[31]); |
275 | 274 | ||
diff --git a/arch/mips/kvm/emulate.c b/arch/mips/kvm/emulate.c index 6230f376a44e..4b50c5787e25 100644 --- a/arch/mips/kvm/emulate.c +++ b/arch/mips/kvm/emulate.c | |||
@@ -2389,7 +2389,6 @@ enum emulation_result kvm_mips_complete_mmio_load(struct kvm_vcpu *vcpu, | |||
2389 | { | 2389 | { |
2390 | unsigned long *gpr = &vcpu->arch.gprs[vcpu->arch.io_gpr]; | 2390 | unsigned long *gpr = &vcpu->arch.gprs[vcpu->arch.io_gpr]; |
2391 | enum emulation_result er = EMULATE_DONE; | 2391 | enum emulation_result er = EMULATE_DONE; |
2392 | unsigned long curr_pc; | ||
2393 | 2392 | ||
2394 | if (run->mmio.len > sizeof(*gpr)) { | 2393 | if (run->mmio.len > sizeof(*gpr)) { |
2395 | kvm_err("Bad MMIO length: %d", run->mmio.len); | 2394 | kvm_err("Bad MMIO length: %d", run->mmio.len); |
@@ -2397,11 +2396,6 @@ enum emulation_result kvm_mips_complete_mmio_load(struct kvm_vcpu *vcpu, | |||
2397 | goto done; | 2396 | goto done; |
2398 | } | 2397 | } |
2399 | 2398 | ||
2400 | /* | ||
2401 | * Update PC and hold onto current PC in case there is | ||
2402 | * an error and we want to rollback the PC | ||
2403 | */ | ||
2404 | curr_pc = vcpu->arch.pc; | ||
2405 | er = update_pc(vcpu, vcpu->arch.pending_load_cause); | 2399 | er = update_pc(vcpu, vcpu->arch.pending_load_cause); |
2406 | if (er == EMULATE_FAIL) | 2400 | if (er == EMULATE_FAIL) |
2407 | return er; | 2401 | return er; |
diff --git a/arch/mips/math-emu/cp1emu.c b/arch/mips/math-emu/cp1emu.c index d31c537ace1d..22b9b2cb9219 100644 --- a/arch/mips/math-emu/cp1emu.c +++ b/arch/mips/math-emu/cp1emu.c | |||
@@ -889,7 +889,7 @@ static inline void cop1_cfc(struct pt_regs *xcp, struct mips_fpu_struct *ctx, | |||
889 | break; | 889 | break; |
890 | 890 | ||
891 | case FPCREG_RID: | 891 | case FPCREG_RID: |
892 | value = current_cpu_data.fpu_id; | 892 | value = boot_cpu_data.fpu_id; |
893 | break; | 893 | break; |
894 | 894 | ||
895 | default: | 895 | default: |
@@ -921,7 +921,7 @@ static inline void cop1_ctc(struct pt_regs *xcp, struct mips_fpu_struct *ctx, | |||
921 | (void *)xcp->cp0_epc, MIPSInst_RT(ir), value); | 921 | (void *)xcp->cp0_epc, MIPSInst_RT(ir), value); |
922 | 922 | ||
923 | /* Preserve read-only bits. */ | 923 | /* Preserve read-only bits. */ |
924 | mask = current_cpu_data.fpu_msk31; | 924 | mask = boot_cpu_data.fpu_msk31; |
925 | fcr31 = (value & ~mask) | (fcr31 & mask); | 925 | fcr31 = (value & ~mask) | (fcr31 & mask); |
926 | break; | 926 | break; |
927 | 927 | ||
diff --git a/arch/mips/mm/tlb-r4k.c b/arch/mips/mm/tlb-r4k.c index a27a088e6f9f..08318ecb803a 100644 --- a/arch/mips/mm/tlb-r4k.c +++ b/arch/mips/mm/tlb-r4k.c | |||
@@ -495,7 +495,7 @@ static void r4k_tlb_configure(void) | |||
495 | 495 | ||
496 | if (cpu_has_rixi) { | 496 | if (cpu_has_rixi) { |
497 | /* | 497 | /* |
498 | * Enable the no read, no exec bits, and enable large virtual | 498 | * Enable the no read, no exec bits, and enable large physical |
499 | * address. | 499 | * address. |
500 | */ | 500 | */ |
501 | #ifdef CONFIG_64BIT | 501 | #ifdef CONFIG_64BIT |
diff --git a/arch/mips/sgi-ip32/ip32-platform.c b/arch/mips/sgi-ip32/ip32-platform.c index 0134db2ad0a8..5a2a82148d8d 100644 --- a/arch/mips/sgi-ip32/ip32-platform.c +++ b/arch/mips/sgi-ip32/ip32-platform.c | |||
@@ -130,9 +130,9 @@ struct platform_device ip32_rtc_device = { | |||
130 | .resource = ip32_rtc_resources, | 130 | .resource = ip32_rtc_resources, |
131 | }; | 131 | }; |
132 | 132 | ||
133 | +static int __init sgio2_rtc_devinit(void) | 133 | static __init int sgio2_rtc_devinit(void) |
134 | { | 134 | { |
135 | return platform_device_register(&ip32_rtc_device); | 135 | return platform_device_register(&ip32_rtc_device); |
136 | } | 136 | } |
137 | 137 | ||
138 | device_initcall(sgio2_cmos_devinit); | 138 | device_initcall(sgio2_rtc_devinit); |
diff --git a/arch/parisc/include/asm/elf.h b/arch/parisc/include/asm/elf.h index 3391d061eccc..78c9fd32c554 100644 --- a/arch/parisc/include/asm/elf.h +++ b/arch/parisc/include/asm/elf.h | |||
@@ -348,6 +348,10 @@ struct pt_regs; /* forward declaration... */ | |||
348 | 348 | ||
349 | #define ELF_HWCAP 0 | 349 | #define ELF_HWCAP 0 |
350 | 350 | ||
351 | #define STACK_RND_MASK (is_32bit_task() ? \ | ||
352 | 0x7ff >> (PAGE_SHIFT - 12) : \ | ||
353 | 0x3ffff >> (PAGE_SHIFT - 12)) | ||
354 | |||
351 | struct mm_struct; | 355 | struct mm_struct; |
352 | extern unsigned long arch_randomize_brk(struct mm_struct *); | 356 | extern unsigned long arch_randomize_brk(struct mm_struct *); |
353 | #define arch_randomize_brk arch_randomize_brk | 357 | #define arch_randomize_brk arch_randomize_brk |
diff --git a/arch/parisc/kernel/process.c b/arch/parisc/kernel/process.c index 8a488c22a99f..809905a811ed 100644 --- a/arch/parisc/kernel/process.c +++ b/arch/parisc/kernel/process.c | |||
@@ -181,9 +181,12 @@ int dump_task_fpu (struct task_struct *tsk, elf_fpregset_t *r) | |||
181 | return 1; | 181 | return 1; |
182 | } | 182 | } |
183 | 183 | ||
184 | /* | ||
185 | * Copy architecture-specific thread state | ||
186 | */ | ||
184 | int | 187 | int |
185 | copy_thread(unsigned long clone_flags, unsigned long usp, | 188 | copy_thread(unsigned long clone_flags, unsigned long usp, |
186 | unsigned long arg, struct task_struct *p) | 189 | unsigned long kthread_arg, struct task_struct *p) |
187 | { | 190 | { |
188 | struct pt_regs *cregs = &(p->thread.regs); | 191 | struct pt_regs *cregs = &(p->thread.regs); |
189 | void *stack = task_stack_page(p); | 192 | void *stack = task_stack_page(p); |
@@ -195,11 +198,10 @@ copy_thread(unsigned long clone_flags, unsigned long usp, | |||
195 | extern void * const child_return; | 198 | extern void * const child_return; |
196 | 199 | ||
197 | if (unlikely(p->flags & PF_KTHREAD)) { | 200 | if (unlikely(p->flags & PF_KTHREAD)) { |
201 | /* kernel thread */ | ||
198 | memset(cregs, 0, sizeof(struct pt_regs)); | 202 | memset(cregs, 0, sizeof(struct pt_regs)); |
199 | if (!usp) /* idle thread */ | 203 | if (!usp) /* idle thread */ |
200 | return 0; | 204 | return 0; |
201 | |||
202 | /* kernel thread */ | ||
203 | /* Must exit via ret_from_kernel_thread in order | 205 | /* Must exit via ret_from_kernel_thread in order |
204 | * to call schedule_tail() | 206 | * to call schedule_tail() |
205 | */ | 207 | */ |
@@ -215,7 +217,7 @@ copy_thread(unsigned long clone_flags, unsigned long usp, | |||
215 | #else | 217 | #else |
216 | cregs->gr[26] = usp; | 218 | cregs->gr[26] = usp; |
217 | #endif | 219 | #endif |
218 | cregs->gr[25] = arg; | 220 | cregs->gr[25] = kthread_arg; |
219 | } else { | 221 | } else { |
220 | /* user thread */ | 222 | /* user thread */ |
221 | /* usp must be word aligned. This also prevents users from | 223 | /* usp must be word aligned. This also prevents users from |
diff --git a/arch/parisc/kernel/sys_parisc.c b/arch/parisc/kernel/sys_parisc.c index e1ffea2f9a0b..5aba01ac457f 100644 --- a/arch/parisc/kernel/sys_parisc.c +++ b/arch/parisc/kernel/sys_parisc.c | |||
@@ -77,6 +77,9 @@ static unsigned long mmap_upper_limit(void) | |||
77 | if (stack_base > STACK_SIZE_MAX) | 77 | if (stack_base > STACK_SIZE_MAX) |
78 | stack_base = STACK_SIZE_MAX; | 78 | stack_base = STACK_SIZE_MAX; |
79 | 79 | ||
80 | /* Add space for stack randomization. */ | ||
81 | stack_base += (STACK_RND_MASK << PAGE_SHIFT); | ||
82 | |||
80 | return PAGE_ALIGN(STACK_TOP - stack_base); | 83 | return PAGE_ALIGN(STACK_TOP - stack_base); |
81 | } | 84 | } |
82 | 85 | ||
diff --git a/arch/powerpc/kernel/mce.c b/arch/powerpc/kernel/mce.c index 15c99b649b04..b2eb4686bd8f 100644 --- a/arch/powerpc/kernel/mce.c +++ b/arch/powerpc/kernel/mce.c | |||
@@ -73,7 +73,7 @@ void save_mce_event(struct pt_regs *regs, long handled, | |||
73 | uint64_t nip, uint64_t addr) | 73 | uint64_t nip, uint64_t addr) |
74 | { | 74 | { |
75 | uint64_t srr1; | 75 | uint64_t srr1; |
76 | int index = __this_cpu_inc_return(mce_nest_count); | 76 | int index = __this_cpu_inc_return(mce_nest_count) - 1; |
77 | struct machine_check_event *mce = this_cpu_ptr(&mce_event[index]); | 77 | struct machine_check_event *mce = this_cpu_ptr(&mce_event[index]); |
78 | 78 | ||
79 | /* | 79 | /* |
@@ -184,7 +184,7 @@ void machine_check_queue_event(void) | |||
184 | if (!get_mce_event(&evt, MCE_EVENT_RELEASE)) | 184 | if (!get_mce_event(&evt, MCE_EVENT_RELEASE)) |
185 | return; | 185 | return; |
186 | 186 | ||
187 | index = __this_cpu_inc_return(mce_queue_count); | 187 | index = __this_cpu_inc_return(mce_queue_count) - 1; |
188 | /* If queue is full, just return for now. */ | 188 | /* If queue is full, just return for now. */ |
189 | if (index >= MAX_MC_EVT) { | 189 | if (index >= MAX_MC_EVT) { |
190 | __this_cpu_dec(mce_queue_count); | 190 | __this_cpu_dec(mce_queue_count); |
diff --git a/arch/powerpc/kernel/vmlinux.lds.S b/arch/powerpc/kernel/vmlinux.lds.S index f096e72262f4..1db685104ffc 100644 --- a/arch/powerpc/kernel/vmlinux.lds.S +++ b/arch/powerpc/kernel/vmlinux.lds.S | |||
@@ -213,6 +213,7 @@ SECTIONS | |||
213 | *(.opd) | 213 | *(.opd) |
214 | } | 214 | } |
215 | 215 | ||
216 | . = ALIGN(256); | ||
216 | .got : AT(ADDR(.got) - LOAD_OFFSET) { | 217 | .got : AT(ADDR(.got) - LOAD_OFFSET) { |
217 | __toc_start = .; | 218 | __toc_start = .; |
218 | #ifndef CONFIG_RELOCATABLE | 219 | #ifndef CONFIG_RELOCATABLE |
diff --git a/arch/powerpc/kvm/book3s_hv.c b/arch/powerpc/kvm/book3s_hv.c index 48d3c5d2ecc9..df81caab7383 100644 --- a/arch/powerpc/kvm/book3s_hv.c +++ b/arch/powerpc/kvm/book3s_hv.c | |||
@@ -1952,7 +1952,7 @@ static void post_guest_process(struct kvmppc_vcore *vc) | |||
1952 | */ | 1952 | */ |
1953 | static noinline void kvmppc_run_core(struct kvmppc_vcore *vc) | 1953 | static noinline void kvmppc_run_core(struct kvmppc_vcore *vc) |
1954 | { | 1954 | { |
1955 | struct kvm_vcpu *vcpu; | 1955 | struct kvm_vcpu *vcpu, *vnext; |
1956 | int i; | 1956 | int i; |
1957 | int srcu_idx; | 1957 | int srcu_idx; |
1958 | 1958 | ||
@@ -1982,7 +1982,8 @@ static noinline void kvmppc_run_core(struct kvmppc_vcore *vc) | |||
1982 | */ | 1982 | */ |
1983 | if ((threads_per_core > 1) && | 1983 | if ((threads_per_core > 1) && |
1984 | ((vc->num_threads > threads_per_subcore) || !on_primary_thread())) { | 1984 | ((vc->num_threads > threads_per_subcore) || !on_primary_thread())) { |
1985 | list_for_each_entry(vcpu, &vc->runnable_threads, arch.run_list) { | 1985 | list_for_each_entry_safe(vcpu, vnext, &vc->runnable_threads, |
1986 | arch.run_list) { | ||
1986 | vcpu->arch.ret = -EBUSY; | 1987 | vcpu->arch.ret = -EBUSY; |
1987 | kvmppc_remove_runnable(vc, vcpu); | 1988 | kvmppc_remove_runnable(vc, vcpu); |
1988 | wake_up(&vcpu->arch.cpu_run); | 1989 | wake_up(&vcpu->arch.cpu_run); |
diff --git a/arch/powerpc/mm/hugetlbpage.c b/arch/powerpc/mm/hugetlbpage.c index 0ce968b00b7c..3385e3d0506e 100644 --- a/arch/powerpc/mm/hugetlbpage.c +++ b/arch/powerpc/mm/hugetlbpage.c | |||
@@ -689,27 +689,34 @@ void hugetlb_free_pgd_range(struct mmu_gather *tlb, | |||
689 | struct page * | 689 | struct page * |
690 | follow_huge_addr(struct mm_struct *mm, unsigned long address, int write) | 690 | follow_huge_addr(struct mm_struct *mm, unsigned long address, int write) |
691 | { | 691 | { |
692 | pte_t *ptep; | 692 | pte_t *ptep, pte; |
693 | struct page *page; | ||
694 | unsigned shift; | 693 | unsigned shift; |
695 | unsigned long mask, flags; | 694 | unsigned long mask, flags; |
695 | struct page *page = ERR_PTR(-EINVAL); | ||
696 | |||
697 | local_irq_save(flags); | ||
698 | ptep = find_linux_pte_or_hugepte(mm->pgd, address, &shift); | ||
699 | if (!ptep) | ||
700 | goto no_page; | ||
701 | pte = READ_ONCE(*ptep); | ||
696 | /* | 702 | /* |
703 | * Verify it is a huge page else bail. | ||
697 | * Transparent hugepages are handled by generic code. We can skip them | 704 | * Transparent hugepages are handled by generic code. We can skip them |
698 | * here. | 705 | * here. |
699 | */ | 706 | */ |
700 | local_irq_save(flags); | 707 | if (!shift || pmd_trans_huge(__pmd(pte_val(pte)))) |
701 | ptep = find_linux_pte_or_hugepte(mm->pgd, address, &shift); | 708 | goto no_page; |
702 | 709 | ||
703 | /* Verify it is a huge page else bail. */ | 710 | if (!pte_present(pte)) { |
704 | if (!ptep || !shift || pmd_trans_huge(*(pmd_t *)ptep)) { | 711 | page = NULL; |
705 | local_irq_restore(flags); | 712 | goto no_page; |
706 | return ERR_PTR(-EINVAL); | ||
707 | } | 713 | } |
708 | mask = (1UL << shift) - 1; | 714 | mask = (1UL << shift) - 1; |
709 | page = pte_page(*ptep); | 715 | page = pte_page(pte); |
710 | if (page) | 716 | if (page) |
711 | page += (address & mask) / PAGE_SIZE; | 717 | page += (address & mask) / PAGE_SIZE; |
712 | 718 | ||
719 | no_page: | ||
713 | local_irq_restore(flags); | 720 | local_irq_restore(flags); |
714 | return page; | 721 | return page; |
715 | } | 722 | } |
diff --git a/arch/powerpc/mm/pgtable_64.c b/arch/powerpc/mm/pgtable_64.c index 59daa5eeec25..6bfadf1aa5cb 100644 --- a/arch/powerpc/mm/pgtable_64.c +++ b/arch/powerpc/mm/pgtable_64.c | |||
@@ -839,6 +839,17 @@ pmd_t pmdp_get_and_clear(struct mm_struct *mm, | |||
839 | * hash fault look at them. | 839 | * hash fault look at them. |
840 | */ | 840 | */ |
841 | memset(pgtable, 0, PTE_FRAG_SIZE); | 841 | memset(pgtable, 0, PTE_FRAG_SIZE); |
842 | /* | ||
843 | * Serialize against find_linux_pte_or_hugepte which does lock-less | ||
844 | * lookup in page tables with local interrupts disabled. For huge pages | ||
845 | * it casts pmd_t to pte_t. Since format of pte_t is different from | ||
846 | * pmd_t we want to prevent transit from pmd pointing to page table | ||
847 | * to pmd pointing to huge page (and back) while interrupts are disabled. | ||
848 | * We clear pmd to possibly replace it with page table pointer in | ||
849 | * different code paths. So make sure we wait for the parallel | ||
850 | * find_linux_pte_or_hugepage to finish. | ||
851 | */ | ||
852 | kick_all_cpus_sync(); | ||
842 | return old_pmd; | 853 | return old_pmd; |
843 | } | 854 | } |
844 | 855 | ||
diff --git a/arch/s390/crypto/ghash_s390.c b/arch/s390/crypto/ghash_s390.c index 7940dc90e80b..b258110da952 100644 --- a/arch/s390/crypto/ghash_s390.c +++ b/arch/s390/crypto/ghash_s390.c | |||
@@ -16,11 +16,12 @@ | |||
16 | #define GHASH_DIGEST_SIZE 16 | 16 | #define GHASH_DIGEST_SIZE 16 |
17 | 17 | ||
18 | struct ghash_ctx { | 18 | struct ghash_ctx { |
19 | u8 icv[16]; | 19 | u8 key[GHASH_BLOCK_SIZE]; |
20 | u8 key[16]; | ||
21 | }; | 20 | }; |
22 | 21 | ||
23 | struct ghash_desc_ctx { | 22 | struct ghash_desc_ctx { |
23 | u8 icv[GHASH_BLOCK_SIZE]; | ||
24 | u8 key[GHASH_BLOCK_SIZE]; | ||
24 | u8 buffer[GHASH_BLOCK_SIZE]; | 25 | u8 buffer[GHASH_BLOCK_SIZE]; |
25 | u32 bytes; | 26 | u32 bytes; |
26 | }; | 27 | }; |
@@ -28,8 +29,10 @@ struct ghash_desc_ctx { | |||
28 | static int ghash_init(struct shash_desc *desc) | 29 | static int ghash_init(struct shash_desc *desc) |
29 | { | 30 | { |
30 | struct ghash_desc_ctx *dctx = shash_desc_ctx(desc); | 31 | struct ghash_desc_ctx *dctx = shash_desc_ctx(desc); |
32 | struct ghash_ctx *ctx = crypto_shash_ctx(desc->tfm); | ||
31 | 33 | ||
32 | memset(dctx, 0, sizeof(*dctx)); | 34 | memset(dctx, 0, sizeof(*dctx)); |
35 | memcpy(dctx->key, ctx->key, GHASH_BLOCK_SIZE); | ||
33 | 36 | ||
34 | return 0; | 37 | return 0; |
35 | } | 38 | } |
@@ -45,7 +48,6 @@ static int ghash_setkey(struct crypto_shash *tfm, | |||
45 | } | 48 | } |
46 | 49 | ||
47 | memcpy(ctx->key, key, GHASH_BLOCK_SIZE); | 50 | memcpy(ctx->key, key, GHASH_BLOCK_SIZE); |
48 | memset(ctx->icv, 0, GHASH_BLOCK_SIZE); | ||
49 | 51 | ||
50 | return 0; | 52 | return 0; |
51 | } | 53 | } |
@@ -54,7 +56,6 @@ static int ghash_update(struct shash_desc *desc, | |||
54 | const u8 *src, unsigned int srclen) | 56 | const u8 *src, unsigned int srclen) |
55 | { | 57 | { |
56 | struct ghash_desc_ctx *dctx = shash_desc_ctx(desc); | 58 | struct ghash_desc_ctx *dctx = shash_desc_ctx(desc); |
57 | struct ghash_ctx *ctx = crypto_shash_ctx(desc->tfm); | ||
58 | unsigned int n; | 59 | unsigned int n; |
59 | u8 *buf = dctx->buffer; | 60 | u8 *buf = dctx->buffer; |
60 | int ret; | 61 | int ret; |
@@ -70,7 +71,7 @@ static int ghash_update(struct shash_desc *desc, | |||
70 | src += n; | 71 | src += n; |
71 | 72 | ||
72 | if (!dctx->bytes) { | 73 | if (!dctx->bytes) { |
73 | ret = crypt_s390_kimd(KIMD_GHASH, ctx, buf, | 74 | ret = crypt_s390_kimd(KIMD_GHASH, dctx, buf, |
74 | GHASH_BLOCK_SIZE); | 75 | GHASH_BLOCK_SIZE); |
75 | if (ret != GHASH_BLOCK_SIZE) | 76 | if (ret != GHASH_BLOCK_SIZE) |
76 | return -EIO; | 77 | return -EIO; |
@@ -79,7 +80,7 @@ static int ghash_update(struct shash_desc *desc, | |||
79 | 80 | ||
80 | n = srclen & ~(GHASH_BLOCK_SIZE - 1); | 81 | n = srclen & ~(GHASH_BLOCK_SIZE - 1); |
81 | if (n) { | 82 | if (n) { |
82 | ret = crypt_s390_kimd(KIMD_GHASH, ctx, src, n); | 83 | ret = crypt_s390_kimd(KIMD_GHASH, dctx, src, n); |
83 | if (ret != n) | 84 | if (ret != n) |
84 | return -EIO; | 85 | return -EIO; |
85 | src += n; | 86 | src += n; |
@@ -94,7 +95,7 @@ static int ghash_update(struct shash_desc *desc, | |||
94 | return 0; | 95 | return 0; |
95 | } | 96 | } |
96 | 97 | ||
97 | static int ghash_flush(struct ghash_ctx *ctx, struct ghash_desc_ctx *dctx) | 98 | static int ghash_flush(struct ghash_desc_ctx *dctx) |
98 | { | 99 | { |
99 | u8 *buf = dctx->buffer; | 100 | u8 *buf = dctx->buffer; |
100 | int ret; | 101 | int ret; |
@@ -104,24 +105,24 @@ static int ghash_flush(struct ghash_ctx *ctx, struct ghash_desc_ctx *dctx) | |||
104 | 105 | ||
105 | memset(pos, 0, dctx->bytes); | 106 | memset(pos, 0, dctx->bytes); |
106 | 107 | ||
107 | ret = crypt_s390_kimd(KIMD_GHASH, ctx, buf, GHASH_BLOCK_SIZE); | 108 | ret = crypt_s390_kimd(KIMD_GHASH, dctx, buf, GHASH_BLOCK_SIZE); |
108 | if (ret != GHASH_BLOCK_SIZE) | 109 | if (ret != GHASH_BLOCK_SIZE) |
109 | return -EIO; | 110 | return -EIO; |
111 | |||
112 | dctx->bytes = 0; | ||
110 | } | 113 | } |
111 | 114 | ||
112 | dctx->bytes = 0; | ||
113 | return 0; | 115 | return 0; |
114 | } | 116 | } |
115 | 117 | ||
116 | static int ghash_final(struct shash_desc *desc, u8 *dst) | 118 | static int ghash_final(struct shash_desc *desc, u8 *dst) |
117 | { | 119 | { |
118 | struct ghash_desc_ctx *dctx = shash_desc_ctx(desc); | 120 | struct ghash_desc_ctx *dctx = shash_desc_ctx(desc); |
119 | struct ghash_ctx *ctx = crypto_shash_ctx(desc->tfm); | ||
120 | int ret; | 121 | int ret; |
121 | 122 | ||
122 | ret = ghash_flush(ctx, dctx); | 123 | ret = ghash_flush(dctx); |
123 | if (!ret) | 124 | if (!ret) |
124 | memcpy(dst, ctx->icv, GHASH_BLOCK_SIZE); | 125 | memcpy(dst, dctx->icv, GHASH_BLOCK_SIZE); |
125 | return ret; | 126 | return ret; |
126 | } | 127 | } |
127 | 128 | ||
diff --git a/arch/s390/crypto/prng.c b/arch/s390/crypto/prng.c index 1f374b39a4ec..9d5192c94963 100644 --- a/arch/s390/crypto/prng.c +++ b/arch/s390/crypto/prng.c | |||
@@ -125,7 +125,7 @@ static int generate_entropy(u8 *ebuf, size_t nbytes) | |||
125 | /* fill page with urandom bytes */ | 125 | /* fill page with urandom bytes */ |
126 | get_random_bytes(pg, PAGE_SIZE); | 126 | get_random_bytes(pg, PAGE_SIZE); |
127 | /* exor page with stckf values */ | 127 | /* exor page with stckf values */ |
128 | for (n = 0; n < sizeof(PAGE_SIZE/sizeof(u64)); n++) { | 128 | for (n = 0; n < PAGE_SIZE / sizeof(u64); n++) { |
129 | u64 *p = ((u64 *)pg) + n; | 129 | u64 *p = ((u64 *)pg) + n; |
130 | *p ^= get_tod_clock_fast(); | 130 | *p ^= get_tod_clock_fast(); |
131 | } | 131 | } |
diff --git a/arch/s390/include/asm/pgtable.h b/arch/s390/include/asm/pgtable.h index fc642399b489..ef24a212eeb7 100644 --- a/arch/s390/include/asm/pgtable.h +++ b/arch/s390/include/asm/pgtable.h | |||
@@ -494,7 +494,7 @@ static inline int pmd_large(pmd_t pmd) | |||
494 | return (pmd_val(pmd) & _SEGMENT_ENTRY_LARGE) != 0; | 494 | return (pmd_val(pmd) & _SEGMENT_ENTRY_LARGE) != 0; |
495 | } | 495 | } |
496 | 496 | ||
497 | static inline int pmd_pfn(pmd_t pmd) | 497 | static inline unsigned long pmd_pfn(pmd_t pmd) |
498 | { | 498 | { |
499 | unsigned long origin_mask; | 499 | unsigned long origin_mask; |
500 | 500 | ||
diff --git a/arch/s390/net/bpf_jit_comp.c b/arch/s390/net/bpf_jit_comp.c index 7690dc8e1ab5..20c146d1251a 100644 --- a/arch/s390/net/bpf_jit_comp.c +++ b/arch/s390/net/bpf_jit_comp.c | |||
@@ -443,8 +443,11 @@ static void bpf_jit_epilogue(struct bpf_jit *jit) | |||
443 | 443 | ||
444 | /* | 444 | /* |
445 | * Compile one eBPF instruction into s390x code | 445 | * Compile one eBPF instruction into s390x code |
446 | * | ||
447 | * NOTE: Use noinline because for gcov (-fprofile-arcs) gcc allocates a lot of | ||
448 | * stack space for the large switch statement. | ||
446 | */ | 449 | */ |
447 | static int bpf_jit_insn(struct bpf_jit *jit, struct bpf_prog *fp, int i) | 450 | static noinline int bpf_jit_insn(struct bpf_jit *jit, struct bpf_prog *fp, int i) |
448 | { | 451 | { |
449 | struct bpf_insn *insn = &fp->insnsi[i]; | 452 | struct bpf_insn *insn = &fp->insnsi[i]; |
450 | int jmp_off, last, insn_count = 1; | 453 | int jmp_off, last, insn_count = 1; |
@@ -588,8 +591,8 @@ static int bpf_jit_insn(struct bpf_jit *jit, struct bpf_prog *fp, int i) | |||
588 | EMIT4(0xb9160000, dst_reg, rc_reg); | 591 | EMIT4(0xb9160000, dst_reg, rc_reg); |
589 | break; | 592 | break; |
590 | } | 593 | } |
591 | case BPF_ALU64 | BPF_DIV | BPF_X: /* dst = dst / (u32) src */ | 594 | case BPF_ALU64 | BPF_DIV | BPF_X: /* dst = dst / src */ |
592 | case BPF_ALU64 | BPF_MOD | BPF_X: /* dst = dst % (u32) src */ | 595 | case BPF_ALU64 | BPF_MOD | BPF_X: /* dst = dst % src */ |
593 | { | 596 | { |
594 | int rc_reg = BPF_OP(insn->code) == BPF_DIV ? REG_W1 : REG_W0; | 597 | int rc_reg = BPF_OP(insn->code) == BPF_DIV ? REG_W1 : REG_W0; |
595 | 598 | ||
@@ -602,10 +605,8 @@ static int bpf_jit_insn(struct bpf_jit *jit, struct bpf_prog *fp, int i) | |||
602 | EMIT4_IMM(0xa7090000, REG_W0, 0); | 605 | EMIT4_IMM(0xa7090000, REG_W0, 0); |
603 | /* lgr %w1,%dst */ | 606 | /* lgr %w1,%dst */ |
604 | EMIT4(0xb9040000, REG_W1, dst_reg); | 607 | EMIT4(0xb9040000, REG_W1, dst_reg); |
605 | /* llgfr %dst,%src (u32 cast) */ | ||
606 | EMIT4(0xb9160000, dst_reg, src_reg); | ||
607 | /* dlgr %w0,%dst */ | 608 | /* dlgr %w0,%dst */ |
608 | EMIT4(0xb9870000, REG_W0, dst_reg); | 609 | EMIT4(0xb9870000, REG_W0, src_reg); |
609 | /* lgr %dst,%rc */ | 610 | /* lgr %dst,%rc */ |
610 | EMIT4(0xb9040000, dst_reg, rc_reg); | 611 | EMIT4(0xb9040000, dst_reg, rc_reg); |
611 | break; | 612 | break; |
@@ -632,8 +633,8 @@ static int bpf_jit_insn(struct bpf_jit *jit, struct bpf_prog *fp, int i) | |||
632 | EMIT4(0xb9160000, dst_reg, rc_reg); | 633 | EMIT4(0xb9160000, dst_reg, rc_reg); |
633 | break; | 634 | break; |
634 | } | 635 | } |
635 | case BPF_ALU64 | BPF_DIV | BPF_K: /* dst = dst / (u32) imm */ | 636 | case BPF_ALU64 | BPF_DIV | BPF_K: /* dst = dst / imm */ |
636 | case BPF_ALU64 | BPF_MOD | BPF_K: /* dst = dst % (u32) imm */ | 637 | case BPF_ALU64 | BPF_MOD | BPF_K: /* dst = dst % imm */ |
637 | { | 638 | { |
638 | int rc_reg = BPF_OP(insn->code) == BPF_DIV ? REG_W1 : REG_W0; | 639 | int rc_reg = BPF_OP(insn->code) == BPF_DIV ? REG_W1 : REG_W0; |
639 | 640 | ||
@@ -649,7 +650,7 @@ static int bpf_jit_insn(struct bpf_jit *jit, struct bpf_prog *fp, int i) | |||
649 | EMIT4(0xb9040000, REG_W1, dst_reg); | 650 | EMIT4(0xb9040000, REG_W1, dst_reg); |
650 | /* dlg %w0,<d(imm)>(%l) */ | 651 | /* dlg %w0,<d(imm)>(%l) */ |
651 | EMIT6_DISP_LH(0xe3000000, 0x0087, REG_W0, REG_0, REG_L, | 652 | EMIT6_DISP_LH(0xe3000000, 0x0087, REG_W0, REG_0, REG_L, |
652 | EMIT_CONST_U64((u32) imm)); | 653 | EMIT_CONST_U64(imm)); |
653 | /* lgr %dst,%rc */ | 654 | /* lgr %dst,%rc */ |
654 | EMIT4(0xb9040000, dst_reg, rc_reg); | 655 | EMIT4(0xb9040000, dst_reg, rc_reg); |
655 | break; | 656 | break; |
diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h index dea2e7e962e3..f4a555beef19 100644 --- a/arch/x86/include/asm/kvm_host.h +++ b/arch/x86/include/asm/kvm_host.h | |||
@@ -207,6 +207,7 @@ union kvm_mmu_page_role { | |||
207 | unsigned nxe:1; | 207 | unsigned nxe:1; |
208 | unsigned cr0_wp:1; | 208 | unsigned cr0_wp:1; |
209 | unsigned smep_andnot_wp:1; | 209 | unsigned smep_andnot_wp:1; |
210 | unsigned smap_andnot_wp:1; | ||
210 | }; | 211 | }; |
211 | }; | 212 | }; |
212 | 213 | ||
@@ -400,6 +401,7 @@ struct kvm_vcpu_arch { | |||
400 | struct kvm_mmu_memory_cache mmu_page_header_cache; | 401 | struct kvm_mmu_memory_cache mmu_page_header_cache; |
401 | 402 | ||
402 | struct fpu guest_fpu; | 403 | struct fpu guest_fpu; |
404 | bool eager_fpu; | ||
403 | u64 xcr0; | 405 | u64 xcr0; |
404 | u64 guest_supported_xcr0; | 406 | u64 guest_supported_xcr0; |
405 | u32 guest_xstate_size; | 407 | u32 guest_xstate_size; |
@@ -743,6 +745,7 @@ struct kvm_x86_ops { | |||
743 | void (*cache_reg)(struct kvm_vcpu *vcpu, enum kvm_reg reg); | 745 | void (*cache_reg)(struct kvm_vcpu *vcpu, enum kvm_reg reg); |
744 | unsigned long (*get_rflags)(struct kvm_vcpu *vcpu); | 746 | unsigned long (*get_rflags)(struct kvm_vcpu *vcpu); |
745 | void (*set_rflags)(struct kvm_vcpu *vcpu, unsigned long rflags); | 747 | void (*set_rflags)(struct kvm_vcpu *vcpu, unsigned long rflags); |
748 | void (*fpu_activate)(struct kvm_vcpu *vcpu); | ||
746 | void (*fpu_deactivate)(struct kvm_vcpu *vcpu); | 749 | void (*fpu_deactivate)(struct kvm_vcpu *vcpu); |
747 | 750 | ||
748 | void (*tlb_flush)(struct kvm_vcpu *vcpu); | 751 | void (*tlb_flush)(struct kvm_vcpu *vcpu); |
diff --git a/arch/x86/kernel/cpu/perf_event_intel.c b/arch/x86/kernel/cpu/perf_event_intel.c index 960e85de13fb..3998131d1a68 100644 --- a/arch/x86/kernel/cpu/perf_event_intel.c +++ b/arch/x86/kernel/cpu/perf_event_intel.c | |||
@@ -1134,7 +1134,7 @@ static __initconst const u64 slm_hw_cache_extra_regs | |||
1134 | [ C(LL ) ] = { | 1134 | [ C(LL ) ] = { |
1135 | [ C(OP_READ) ] = { | 1135 | [ C(OP_READ) ] = { |
1136 | [ C(RESULT_ACCESS) ] = SLM_DMND_READ|SLM_LLC_ACCESS, | 1136 | [ C(RESULT_ACCESS) ] = SLM_DMND_READ|SLM_LLC_ACCESS, |
1137 | [ C(RESULT_MISS) ] = SLM_DMND_READ|SLM_LLC_MISS, | 1137 | [ C(RESULT_MISS) ] = 0, |
1138 | }, | 1138 | }, |
1139 | [ C(OP_WRITE) ] = { | 1139 | [ C(OP_WRITE) ] = { |
1140 | [ C(RESULT_ACCESS) ] = SLM_DMND_WRITE|SLM_LLC_ACCESS, | 1140 | [ C(RESULT_ACCESS) ] = SLM_DMND_WRITE|SLM_LLC_ACCESS, |
@@ -1184,8 +1184,7 @@ static __initconst const u64 slm_hw_cache_event_ids | |||
1184 | [ C(OP_READ) ] = { | 1184 | [ C(OP_READ) ] = { |
1185 | /* OFFCORE_RESPONSE.ANY_DATA.LOCAL_CACHE */ | 1185 | /* OFFCORE_RESPONSE.ANY_DATA.LOCAL_CACHE */ |
1186 | [ C(RESULT_ACCESS) ] = 0x01b7, | 1186 | [ C(RESULT_ACCESS) ] = 0x01b7, |
1187 | /* OFFCORE_RESPONSE.ANY_DATA.ANY_LLC_MISS */ | 1187 | [ C(RESULT_MISS) ] = 0, |
1188 | [ C(RESULT_MISS) ] = 0x01b7, | ||
1189 | }, | 1188 | }, |
1190 | [ C(OP_WRITE) ] = { | 1189 | [ C(OP_WRITE) ] = { |
1191 | /* OFFCORE_RESPONSE.ANY_RFO.LOCAL_CACHE */ | 1190 | /* OFFCORE_RESPONSE.ANY_RFO.LOCAL_CACHE */ |
@@ -1217,7 +1216,7 @@ static __initconst const u64 slm_hw_cache_event_ids | |||
1217 | [ C(ITLB) ] = { | 1216 | [ C(ITLB) ] = { |
1218 | [ C(OP_READ) ] = { | 1217 | [ C(OP_READ) ] = { |
1219 | [ C(RESULT_ACCESS) ] = 0x00c0, /* INST_RETIRED.ANY_P */ | 1218 | [ C(RESULT_ACCESS) ] = 0x00c0, /* INST_RETIRED.ANY_P */ |
1220 | [ C(RESULT_MISS) ] = 0x0282, /* ITLB.MISSES */ | 1219 | [ C(RESULT_MISS) ] = 0x40205, /* PAGE_WALKS.I_SIDE_WALKS */ |
1221 | }, | 1220 | }, |
1222 | [ C(OP_WRITE) ] = { | 1221 | [ C(OP_WRITE) ] = { |
1223 | [ C(RESULT_ACCESS) ] = -1, | 1222 | [ C(RESULT_ACCESS) ] = -1, |
diff --git a/arch/x86/kernel/cpu/perf_event_intel_rapl.c b/arch/x86/kernel/cpu/perf_event_intel_rapl.c index 999289b94025..358c54ad20d4 100644 --- a/arch/x86/kernel/cpu/perf_event_intel_rapl.c +++ b/arch/x86/kernel/cpu/perf_event_intel_rapl.c | |||
@@ -722,6 +722,7 @@ static int __init rapl_pmu_init(void) | |||
722 | break; | 722 | break; |
723 | case 60: /* Haswell */ | 723 | case 60: /* Haswell */ |
724 | case 69: /* Haswell-Celeron */ | 724 | case 69: /* Haswell-Celeron */ |
725 | case 61: /* Broadwell */ | ||
725 | rapl_cntr_mask = RAPL_IDX_HSW; | 726 | rapl_cntr_mask = RAPL_IDX_HSW; |
726 | rapl_pmu_events_group.attrs = rapl_events_hsw_attr; | 727 | rapl_pmu_events_group.attrs = rapl_events_hsw_attr; |
727 | break; | 728 | break; |
diff --git a/arch/x86/kvm/cpuid.c b/arch/x86/kvm/cpuid.c index 59b69f6a2844..1d08ad3582d0 100644 --- a/arch/x86/kvm/cpuid.c +++ b/arch/x86/kvm/cpuid.c | |||
@@ -16,6 +16,8 @@ | |||
16 | #include <linux/module.h> | 16 | #include <linux/module.h> |
17 | #include <linux/vmalloc.h> | 17 | #include <linux/vmalloc.h> |
18 | #include <linux/uaccess.h> | 18 | #include <linux/uaccess.h> |
19 | #include <asm/i387.h> /* For use_eager_fpu. Ugh! */ | ||
20 | #include <asm/fpu-internal.h> /* For use_eager_fpu. Ugh! */ | ||
19 | #include <asm/user.h> | 21 | #include <asm/user.h> |
20 | #include <asm/xsave.h> | 22 | #include <asm/xsave.h> |
21 | #include "cpuid.h" | 23 | #include "cpuid.h" |
@@ -95,6 +97,8 @@ int kvm_update_cpuid(struct kvm_vcpu *vcpu) | |||
95 | if (best && (best->eax & (F(XSAVES) | F(XSAVEC)))) | 97 | if (best && (best->eax & (F(XSAVES) | F(XSAVEC)))) |
96 | best->ebx = xstate_required_size(vcpu->arch.xcr0, true); | 98 | best->ebx = xstate_required_size(vcpu->arch.xcr0, true); |
97 | 99 | ||
100 | vcpu->arch.eager_fpu = guest_cpuid_has_mpx(vcpu); | ||
101 | |||
98 | /* | 102 | /* |
99 | * The existing code assumes virtual address is 48-bit in the canonical | 103 | * The existing code assumes virtual address is 48-bit in the canonical |
100 | * address checks; exit if it is ever changed. | 104 | * address checks; exit if it is ever changed. |
diff --git a/arch/x86/kvm/cpuid.h b/arch/x86/kvm/cpuid.h index c3b1ad9fca81..496b3695d3d3 100644 --- a/arch/x86/kvm/cpuid.h +++ b/arch/x86/kvm/cpuid.h | |||
@@ -117,4 +117,12 @@ static inline bool guest_cpuid_has_rtm(struct kvm_vcpu *vcpu) | |||
117 | best = kvm_find_cpuid_entry(vcpu, 7, 0); | 117 | best = kvm_find_cpuid_entry(vcpu, 7, 0); |
118 | return best && (best->ebx & bit(X86_FEATURE_RTM)); | 118 | return best && (best->ebx & bit(X86_FEATURE_RTM)); |
119 | } | 119 | } |
120 | |||
121 | static inline bool guest_cpuid_has_mpx(struct kvm_vcpu *vcpu) | ||
122 | { | ||
123 | struct kvm_cpuid_entry2 *best; | ||
124 | |||
125 | best = kvm_find_cpuid_entry(vcpu, 7, 0); | ||
126 | return best && (best->ebx & bit(X86_FEATURE_MPX)); | ||
127 | } | ||
120 | #endif | 128 | #endif |
diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c index d43867c33bc4..44a7d2515497 100644 --- a/arch/x86/kvm/mmu.c +++ b/arch/x86/kvm/mmu.c | |||
@@ -3736,8 +3736,8 @@ static void reset_rsvds_bits_mask_ept(struct kvm_vcpu *vcpu, | |||
3736 | } | 3736 | } |
3737 | } | 3737 | } |
3738 | 3738 | ||
3739 | void update_permission_bitmask(struct kvm_vcpu *vcpu, | 3739 | static void update_permission_bitmask(struct kvm_vcpu *vcpu, |
3740 | struct kvm_mmu *mmu, bool ept) | 3740 | struct kvm_mmu *mmu, bool ept) |
3741 | { | 3741 | { |
3742 | unsigned bit, byte, pfec; | 3742 | unsigned bit, byte, pfec; |
3743 | u8 map; | 3743 | u8 map; |
@@ -3918,6 +3918,7 @@ static void init_kvm_tdp_mmu(struct kvm_vcpu *vcpu) | |||
3918 | void kvm_init_shadow_mmu(struct kvm_vcpu *vcpu) | 3918 | void kvm_init_shadow_mmu(struct kvm_vcpu *vcpu) |
3919 | { | 3919 | { |
3920 | bool smep = kvm_read_cr4_bits(vcpu, X86_CR4_SMEP); | 3920 | bool smep = kvm_read_cr4_bits(vcpu, X86_CR4_SMEP); |
3921 | bool smap = kvm_read_cr4_bits(vcpu, X86_CR4_SMAP); | ||
3921 | struct kvm_mmu *context = &vcpu->arch.mmu; | 3922 | struct kvm_mmu *context = &vcpu->arch.mmu; |
3922 | 3923 | ||
3923 | MMU_WARN_ON(VALID_PAGE(context->root_hpa)); | 3924 | MMU_WARN_ON(VALID_PAGE(context->root_hpa)); |
@@ -3936,6 +3937,8 @@ void kvm_init_shadow_mmu(struct kvm_vcpu *vcpu) | |||
3936 | context->base_role.cr0_wp = is_write_protection(vcpu); | 3937 | context->base_role.cr0_wp = is_write_protection(vcpu); |
3937 | context->base_role.smep_andnot_wp | 3938 | context->base_role.smep_andnot_wp |
3938 | = smep && !is_write_protection(vcpu); | 3939 | = smep && !is_write_protection(vcpu); |
3940 | context->base_role.smap_andnot_wp | ||
3941 | = smap && !is_write_protection(vcpu); | ||
3939 | } | 3942 | } |
3940 | EXPORT_SYMBOL_GPL(kvm_init_shadow_mmu); | 3943 | EXPORT_SYMBOL_GPL(kvm_init_shadow_mmu); |
3941 | 3944 | ||
@@ -4207,12 +4210,18 @@ void kvm_mmu_pte_write(struct kvm_vcpu *vcpu, gpa_t gpa, | |||
4207 | const u8 *new, int bytes) | 4210 | const u8 *new, int bytes) |
4208 | { | 4211 | { |
4209 | gfn_t gfn = gpa >> PAGE_SHIFT; | 4212 | gfn_t gfn = gpa >> PAGE_SHIFT; |
4210 | union kvm_mmu_page_role mask = { .word = 0 }; | ||
4211 | struct kvm_mmu_page *sp; | 4213 | struct kvm_mmu_page *sp; |
4212 | LIST_HEAD(invalid_list); | 4214 | LIST_HEAD(invalid_list); |
4213 | u64 entry, gentry, *spte; | 4215 | u64 entry, gentry, *spte; |
4214 | int npte; | 4216 | int npte; |
4215 | bool remote_flush, local_flush, zap_page; | 4217 | bool remote_flush, local_flush, zap_page; |
4218 | union kvm_mmu_page_role mask = (union kvm_mmu_page_role) { | ||
4219 | .cr0_wp = 1, | ||
4220 | .cr4_pae = 1, | ||
4221 | .nxe = 1, | ||
4222 | .smep_andnot_wp = 1, | ||
4223 | .smap_andnot_wp = 1, | ||
4224 | }; | ||
4216 | 4225 | ||
4217 | /* | 4226 | /* |
4218 | * If we don't have indirect shadow pages, it means no page is | 4227 | * If we don't have indirect shadow pages, it means no page is |
@@ -4238,7 +4247,6 @@ void kvm_mmu_pte_write(struct kvm_vcpu *vcpu, gpa_t gpa, | |||
4238 | ++vcpu->kvm->stat.mmu_pte_write; | 4247 | ++vcpu->kvm->stat.mmu_pte_write; |
4239 | kvm_mmu_audit(vcpu, AUDIT_PRE_PTE_WRITE); | 4248 | kvm_mmu_audit(vcpu, AUDIT_PRE_PTE_WRITE); |
4240 | 4249 | ||
4241 | mask.cr0_wp = mask.cr4_pae = mask.nxe = 1; | ||
4242 | for_each_gfn_indirect_valid_sp(vcpu->kvm, sp, gfn) { | 4250 | for_each_gfn_indirect_valid_sp(vcpu->kvm, sp, gfn) { |
4243 | if (detect_write_misaligned(sp, gpa, bytes) || | 4251 | if (detect_write_misaligned(sp, gpa, bytes) || |
4244 | detect_write_flooding(sp)) { | 4252 | detect_write_flooding(sp)) { |
diff --git a/arch/x86/kvm/mmu.h b/arch/x86/kvm/mmu.h index c7d65637c851..0ada65ecddcf 100644 --- a/arch/x86/kvm/mmu.h +++ b/arch/x86/kvm/mmu.h | |||
@@ -71,8 +71,6 @@ enum { | |||
71 | int handle_mmio_page_fault_common(struct kvm_vcpu *vcpu, u64 addr, bool direct); | 71 | int handle_mmio_page_fault_common(struct kvm_vcpu *vcpu, u64 addr, bool direct); |
72 | void kvm_init_shadow_mmu(struct kvm_vcpu *vcpu); | 72 | void kvm_init_shadow_mmu(struct kvm_vcpu *vcpu); |
73 | void kvm_init_shadow_ept_mmu(struct kvm_vcpu *vcpu, bool execonly); | 73 | void kvm_init_shadow_ept_mmu(struct kvm_vcpu *vcpu, bool execonly); |
74 | void update_permission_bitmask(struct kvm_vcpu *vcpu, struct kvm_mmu *mmu, | ||
75 | bool ept); | ||
76 | 74 | ||
77 | static inline unsigned int kvm_mmu_available_pages(struct kvm *kvm) | 75 | static inline unsigned int kvm_mmu_available_pages(struct kvm *kvm) |
78 | { | 76 | { |
@@ -166,6 +164,8 @@ static inline bool permission_fault(struct kvm_vcpu *vcpu, struct kvm_mmu *mmu, | |||
166 | int index = (pfec >> 1) + | 164 | int index = (pfec >> 1) + |
167 | (smap >> (X86_EFLAGS_AC_BIT - PFERR_RSVD_BIT + 1)); | 165 | (smap >> (X86_EFLAGS_AC_BIT - PFERR_RSVD_BIT + 1)); |
168 | 166 | ||
167 | WARN_ON(pfec & PFERR_RSVD_MASK); | ||
168 | |||
169 | return (mmu->permissions[index] >> pte_access) & 1; | 169 | return (mmu->permissions[index] >> pte_access) & 1; |
170 | } | 170 | } |
171 | 171 | ||
diff --git a/arch/x86/kvm/paging_tmpl.h b/arch/x86/kvm/paging_tmpl.h index fd49c867b25a..6e6d115fe9b5 100644 --- a/arch/x86/kvm/paging_tmpl.h +++ b/arch/x86/kvm/paging_tmpl.h | |||
@@ -718,6 +718,13 @@ static int FNAME(page_fault)(struct kvm_vcpu *vcpu, gva_t addr, u32 error_code, | |||
718 | mmu_is_nested(vcpu)); | 718 | mmu_is_nested(vcpu)); |
719 | if (likely(r != RET_MMIO_PF_INVALID)) | 719 | if (likely(r != RET_MMIO_PF_INVALID)) |
720 | return r; | 720 | return r; |
721 | |||
722 | /* | ||
723 | * page fault with PFEC.RSVD = 1 is caused by shadow | ||
724 | * page fault, should not be used to walk guest page | ||
725 | * table. | ||
726 | */ | ||
727 | error_code &= ~PFERR_RSVD_MASK; | ||
721 | }; | 728 | }; |
722 | 729 | ||
723 | r = mmu_topup_memory_caches(vcpu); | 730 | r = mmu_topup_memory_caches(vcpu); |
diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c index ce741b8650f6..9afa233b5482 100644 --- a/arch/x86/kvm/svm.c +++ b/arch/x86/kvm/svm.c | |||
@@ -4381,6 +4381,7 @@ static struct kvm_x86_ops svm_x86_ops = { | |||
4381 | .cache_reg = svm_cache_reg, | 4381 | .cache_reg = svm_cache_reg, |
4382 | .get_rflags = svm_get_rflags, | 4382 | .get_rflags = svm_get_rflags, |
4383 | .set_rflags = svm_set_rflags, | 4383 | .set_rflags = svm_set_rflags, |
4384 | .fpu_activate = svm_fpu_activate, | ||
4384 | .fpu_deactivate = svm_fpu_deactivate, | 4385 | .fpu_deactivate = svm_fpu_deactivate, |
4385 | 4386 | ||
4386 | .tlb_flush = svm_flush_tlb, | 4387 | .tlb_flush = svm_flush_tlb, |
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index f7b61687bd79..2d73807f0d31 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c | |||
@@ -10185,6 +10185,7 @@ static struct kvm_x86_ops vmx_x86_ops = { | |||
10185 | .cache_reg = vmx_cache_reg, | 10185 | .cache_reg = vmx_cache_reg, |
10186 | .get_rflags = vmx_get_rflags, | 10186 | .get_rflags = vmx_get_rflags, |
10187 | .set_rflags = vmx_set_rflags, | 10187 | .set_rflags = vmx_set_rflags, |
10188 | .fpu_activate = vmx_fpu_activate, | ||
10188 | .fpu_deactivate = vmx_fpu_deactivate, | 10189 | .fpu_deactivate = vmx_fpu_deactivate, |
10189 | 10190 | ||
10190 | .tlb_flush = vmx_flush_tlb, | 10191 | .tlb_flush = vmx_flush_tlb, |
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index c73efcd03e29..ea306adbbc13 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c | |||
@@ -702,8 +702,9 @@ EXPORT_SYMBOL_GPL(kvm_set_xcr); | |||
702 | int kvm_set_cr4(struct kvm_vcpu *vcpu, unsigned long cr4) | 702 | int kvm_set_cr4(struct kvm_vcpu *vcpu, unsigned long cr4) |
703 | { | 703 | { |
704 | unsigned long old_cr4 = kvm_read_cr4(vcpu); | 704 | unsigned long old_cr4 = kvm_read_cr4(vcpu); |
705 | unsigned long pdptr_bits = X86_CR4_PGE | X86_CR4_PSE | | 705 | unsigned long pdptr_bits = X86_CR4_PGE | X86_CR4_PSE | X86_CR4_PAE | |
706 | X86_CR4_PAE | X86_CR4_SMEP; | 706 | X86_CR4_SMEP | X86_CR4_SMAP; |
707 | |||
707 | if (cr4 & CR4_RESERVED_BITS) | 708 | if (cr4 & CR4_RESERVED_BITS) |
708 | return 1; | 709 | return 1; |
709 | 710 | ||
@@ -744,9 +745,6 @@ int kvm_set_cr4(struct kvm_vcpu *vcpu, unsigned long cr4) | |||
744 | (!(cr4 & X86_CR4_PCIDE) && (old_cr4 & X86_CR4_PCIDE))) | 745 | (!(cr4 & X86_CR4_PCIDE) && (old_cr4 & X86_CR4_PCIDE))) |
745 | kvm_mmu_reset_context(vcpu); | 746 | kvm_mmu_reset_context(vcpu); |
746 | 747 | ||
747 | if ((cr4 ^ old_cr4) & X86_CR4_SMAP) | ||
748 | update_permission_bitmask(vcpu, vcpu->arch.walk_mmu, false); | ||
749 | |||
750 | if ((cr4 ^ old_cr4) & X86_CR4_OSXSAVE) | 748 | if ((cr4 ^ old_cr4) & X86_CR4_OSXSAVE) |
751 | kvm_update_cpuid(vcpu); | 749 | kvm_update_cpuid(vcpu); |
752 | 750 | ||
@@ -6197,6 +6195,8 @@ void kvm_vcpu_reload_apic_access_page(struct kvm_vcpu *vcpu) | |||
6197 | return; | 6195 | return; |
6198 | 6196 | ||
6199 | page = gfn_to_page(vcpu->kvm, APIC_DEFAULT_PHYS_BASE >> PAGE_SHIFT); | 6197 | page = gfn_to_page(vcpu->kvm, APIC_DEFAULT_PHYS_BASE >> PAGE_SHIFT); |
6198 | if (is_error_page(page)) | ||
6199 | return; | ||
6200 | kvm_x86_ops->set_apic_access_page_addr(vcpu, page_to_phys(page)); | 6200 | kvm_x86_ops->set_apic_access_page_addr(vcpu, page_to_phys(page)); |
6201 | 6201 | ||
6202 | /* | 6202 | /* |
@@ -7060,7 +7060,9 @@ void kvm_put_guest_fpu(struct kvm_vcpu *vcpu) | |||
7060 | fpu_save_init(&vcpu->arch.guest_fpu); | 7060 | fpu_save_init(&vcpu->arch.guest_fpu); |
7061 | __kernel_fpu_end(); | 7061 | __kernel_fpu_end(); |
7062 | ++vcpu->stat.fpu_reload; | 7062 | ++vcpu->stat.fpu_reload; |
7063 | kvm_make_request(KVM_REQ_DEACTIVATE_FPU, vcpu); | 7063 | if (!vcpu->arch.eager_fpu) |
7064 | kvm_make_request(KVM_REQ_DEACTIVATE_FPU, vcpu); | ||
7065 | |||
7064 | trace_kvm_fpu(0); | 7066 | trace_kvm_fpu(0); |
7065 | } | 7067 | } |
7066 | 7068 | ||
@@ -7076,11 +7078,21 @@ void kvm_arch_vcpu_free(struct kvm_vcpu *vcpu) | |||
7076 | struct kvm_vcpu *kvm_arch_vcpu_create(struct kvm *kvm, | 7078 | struct kvm_vcpu *kvm_arch_vcpu_create(struct kvm *kvm, |
7077 | unsigned int id) | 7079 | unsigned int id) |
7078 | { | 7080 | { |
7081 | struct kvm_vcpu *vcpu; | ||
7082 | |||
7079 | if (check_tsc_unstable() && atomic_read(&kvm->online_vcpus) != 0) | 7083 | if (check_tsc_unstable() && atomic_read(&kvm->online_vcpus) != 0) |
7080 | printk_once(KERN_WARNING | 7084 | printk_once(KERN_WARNING |
7081 | "kvm: SMP vm created on host with unstable TSC; " | 7085 | "kvm: SMP vm created on host with unstable TSC; " |
7082 | "guest TSC will not be reliable\n"); | 7086 | "guest TSC will not be reliable\n"); |
7083 | return kvm_x86_ops->vcpu_create(kvm, id); | 7087 | |
7088 | vcpu = kvm_x86_ops->vcpu_create(kvm, id); | ||
7089 | |||
7090 | /* | ||
7091 | * Activate fpu unconditionally in case the guest needs eager FPU. It will be | ||
7092 | * deactivated soon if it doesn't. | ||
7093 | */ | ||
7094 | kvm_x86_ops->fpu_activate(vcpu); | ||
7095 | return vcpu; | ||
7084 | } | 7096 | } |
7085 | 7097 | ||
7086 | int kvm_arch_vcpu_setup(struct kvm_vcpu *vcpu) | 7098 | int kvm_arch_vcpu_setup(struct kvm_vcpu *vcpu) |
diff --git a/arch/x86/vdso/Makefile b/arch/x86/vdso/Makefile index 275a3a8b78af..e97032069f88 100644 --- a/arch/x86/vdso/Makefile +++ b/arch/x86/vdso/Makefile | |||
@@ -51,7 +51,7 @@ VDSO_LDFLAGS_vdso.lds = -m64 -Wl,-soname=linux-vdso.so.1 \ | |||
51 | $(obj)/vdso64.so.dbg: $(src)/vdso.lds $(vobjs) FORCE | 51 | $(obj)/vdso64.so.dbg: $(src)/vdso.lds $(vobjs) FORCE |
52 | $(call if_changed,vdso) | 52 | $(call if_changed,vdso) |
53 | 53 | ||
54 | HOST_EXTRACFLAGS += -I$(srctree)/tools/include -I$(srctree)/include/uapi | 54 | HOST_EXTRACFLAGS += -I$(srctree)/tools/include -I$(srctree)/include/uapi -I$(srctree)/arch/x86/include/uapi |
55 | hostprogs-y += vdso2c | 55 | hostprogs-y += vdso2c |
56 | 56 | ||
57 | quiet_cmd_vdso2c = VDSO2C $@ | 57 | quiet_cmd_vdso2c = VDSO2C $@ |
diff --git a/block/blk-core.c b/block/blk-core.c index 7871603f0a29..03b5f8d77f37 100644 --- a/block/blk-core.c +++ b/block/blk-core.c | |||
@@ -734,6 +734,8 @@ blk_init_queue_node(request_fn_proc *rfn, spinlock_t *lock, int node_id) | |||
734 | } | 734 | } |
735 | EXPORT_SYMBOL(blk_init_queue_node); | 735 | EXPORT_SYMBOL(blk_init_queue_node); |
736 | 736 | ||
737 | static void blk_queue_bio(struct request_queue *q, struct bio *bio); | ||
738 | |||
737 | struct request_queue * | 739 | struct request_queue * |
738 | blk_init_allocated_queue(struct request_queue *q, request_fn_proc *rfn, | 740 | blk_init_allocated_queue(struct request_queue *q, request_fn_proc *rfn, |
739 | spinlock_t *lock) | 741 | spinlock_t *lock) |
@@ -1578,7 +1580,7 @@ void init_request_from_bio(struct request *req, struct bio *bio) | |||
1578 | blk_rq_bio_prep(req->q, req, bio); | 1580 | blk_rq_bio_prep(req->q, req, bio); |
1579 | } | 1581 | } |
1580 | 1582 | ||
1581 | void blk_queue_bio(struct request_queue *q, struct bio *bio) | 1583 | static void blk_queue_bio(struct request_queue *q, struct bio *bio) |
1582 | { | 1584 | { |
1583 | const bool sync = !!(bio->bi_rw & REQ_SYNC); | 1585 | const bool sync = !!(bio->bi_rw & REQ_SYNC); |
1584 | struct blk_plug *plug; | 1586 | struct blk_plug *plug; |
@@ -1686,7 +1688,6 @@ out_unlock: | |||
1686 | spin_unlock_irq(q->queue_lock); | 1688 | spin_unlock_irq(q->queue_lock); |
1687 | } | 1689 | } |
1688 | } | 1690 | } |
1689 | EXPORT_SYMBOL_GPL(blk_queue_bio); /* for device mapper only */ | ||
1690 | 1691 | ||
1691 | /* | 1692 | /* |
1692 | * If bio->bi_dev is a partition, remap the location | 1693 | * If bio->bi_dev is a partition, remap the location |
diff --git a/crypto/algif_aead.c b/crypto/algif_aead.c index 00a6fe166fed..69abada22373 100644 --- a/crypto/algif_aead.c +++ b/crypto/algif_aead.c | |||
@@ -33,7 +33,7 @@ struct aead_ctx { | |||
33 | /* | 33 | /* |
34 | * RSGL_MAX_ENTRIES is an artificial limit where user space at maximum | 34 | * RSGL_MAX_ENTRIES is an artificial limit where user space at maximum |
35 | * can cause the kernel to allocate RSGL_MAX_ENTRIES * ALG_MAX_PAGES | 35 | * can cause the kernel to allocate RSGL_MAX_ENTRIES * ALG_MAX_PAGES |
36 | * bytes | 36 | * pages |
37 | */ | 37 | */ |
38 | #define RSGL_MAX_ENTRIES ALG_MAX_PAGES | 38 | #define RSGL_MAX_ENTRIES ALG_MAX_PAGES |
39 | struct af_alg_sgl rsgl[RSGL_MAX_ENTRIES]; | 39 | struct af_alg_sgl rsgl[RSGL_MAX_ENTRIES]; |
@@ -435,11 +435,10 @@ static int aead_recvmsg(struct socket *sock, struct msghdr *msg, size_t ignored, | |||
435 | if (err < 0) | 435 | if (err < 0) |
436 | goto unlock; | 436 | goto unlock; |
437 | usedpages += err; | 437 | usedpages += err; |
438 | /* chain the new scatterlist with initial list */ | 438 | /* chain the new scatterlist with previous one */ |
439 | if (cnt) | 439 | if (cnt) |
440 | scatterwalk_crypto_chain(ctx->rsgl[0].sg, | 440 | af_alg_link_sg(&ctx->rsgl[cnt-1], &ctx->rsgl[cnt]); |
441 | ctx->rsgl[cnt].sg, 1, | 441 | |
442 | sg_nents(ctx->rsgl[cnt-1].sg)); | ||
443 | /* we do not need more iovecs as we have sufficient memory */ | 442 | /* we do not need more iovecs as we have sufficient memory */ |
444 | if (outlen <= usedpages) | 443 | if (outlen <= usedpages) |
445 | break; | 444 | break; |
diff --git a/drivers/acpi/acpica/utglobal.c b/drivers/acpi/acpica/utglobal.c index a72685c1e819..5e8df9177da4 100644 --- a/drivers/acpi/acpica/utglobal.c +++ b/drivers/acpi/acpica/utglobal.c | |||
@@ -102,19 +102,12 @@ const struct acpi_predefined_names acpi_gbl_pre_defined_names[] = { | |||
102 | {"_SB_", ACPI_TYPE_DEVICE, NULL}, | 102 | {"_SB_", ACPI_TYPE_DEVICE, NULL}, |
103 | {"_SI_", ACPI_TYPE_LOCAL_SCOPE, NULL}, | 103 | {"_SI_", ACPI_TYPE_LOCAL_SCOPE, NULL}, |
104 | {"_TZ_", ACPI_TYPE_DEVICE, NULL}, | 104 | {"_TZ_", ACPI_TYPE_DEVICE, NULL}, |
105 | /* | 105 | {"_REV", ACPI_TYPE_INTEGER, (char *)ACPI_CA_SUPPORT_LEVEL}, |
106 | * March, 2015: | ||
107 | * The _REV object is in the process of being deprecated, because | ||
108 | * other ACPI implementations permanently return 2. Thus, it | ||
109 | * has little or no value. Return 2 for compatibility with | ||
110 | * other ACPI implementations. | ||
111 | */ | ||
112 | {"_REV", ACPI_TYPE_INTEGER, ACPI_CAST_PTR(char, 2)}, | ||
113 | {"_OS_", ACPI_TYPE_STRING, ACPI_OS_NAME}, | 106 | {"_OS_", ACPI_TYPE_STRING, ACPI_OS_NAME}, |
114 | {"_GL_", ACPI_TYPE_MUTEX, ACPI_CAST_PTR(char, 1)}, | 107 | {"_GL_", ACPI_TYPE_MUTEX, (char *)1}, |
115 | 108 | ||
116 | #if !defined (ACPI_NO_METHOD_EXECUTION) || defined (ACPI_CONSTANT_EVAL_ONLY) | 109 | #if !defined (ACPI_NO_METHOD_EXECUTION) || defined (ACPI_CONSTANT_EVAL_ONLY) |
117 | {"_OSI", ACPI_TYPE_METHOD, ACPI_CAST_PTR(char, 1)}, | 110 | {"_OSI", ACPI_TYPE_METHOD, (char *)1}, |
118 | #endif | 111 | #endif |
119 | 112 | ||
120 | /* Table terminator */ | 113 | /* Table terminator */ |
diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c index 39748bb3a543..7ccba395c9dd 100644 --- a/drivers/acpi/osl.c +++ b/drivers/acpi/osl.c | |||
@@ -182,7 +182,7 @@ static void __init acpi_request_region (struct acpi_generic_address *gas, | |||
182 | request_mem_region(addr, length, desc); | 182 | request_mem_region(addr, length, desc); |
183 | } | 183 | } |
184 | 184 | ||
185 | static int __init acpi_reserve_resources(void) | 185 | static void __init acpi_reserve_resources(void) |
186 | { | 186 | { |
187 | acpi_request_region(&acpi_gbl_FADT.xpm1a_event_block, acpi_gbl_FADT.pm1_event_length, | 187 | acpi_request_region(&acpi_gbl_FADT.xpm1a_event_block, acpi_gbl_FADT.pm1_event_length, |
188 | "ACPI PM1a_EVT_BLK"); | 188 | "ACPI PM1a_EVT_BLK"); |
@@ -211,10 +211,7 @@ static int __init acpi_reserve_resources(void) | |||
211 | if (!(acpi_gbl_FADT.gpe1_block_length & 0x1)) | 211 | if (!(acpi_gbl_FADT.gpe1_block_length & 0x1)) |
212 | acpi_request_region(&acpi_gbl_FADT.xgpe1_block, | 212 | acpi_request_region(&acpi_gbl_FADT.xgpe1_block, |
213 | acpi_gbl_FADT.gpe1_block_length, "ACPI GPE1_BLK"); | 213 | acpi_gbl_FADT.gpe1_block_length, "ACPI GPE1_BLK"); |
214 | |||
215 | return 0; | ||
216 | } | 214 | } |
217 | device_initcall(acpi_reserve_resources); | ||
218 | 215 | ||
219 | void acpi_os_printf(const char *fmt, ...) | 216 | void acpi_os_printf(const char *fmt, ...) |
220 | { | 217 | { |
@@ -1845,6 +1842,7 @@ acpi_status __init acpi_os_initialize(void) | |||
1845 | 1842 | ||
1846 | acpi_status __init acpi_os_initialize1(void) | 1843 | acpi_status __init acpi_os_initialize1(void) |
1847 | { | 1844 | { |
1845 | acpi_reserve_resources(); | ||
1848 | kacpid_wq = alloc_workqueue("kacpid", 0, 1); | 1846 | kacpid_wq = alloc_workqueue("kacpid", 0, 1); |
1849 | kacpi_notify_wq = alloc_workqueue("kacpi_notify", 0, 1); | 1847 | kacpi_notify_wq = alloc_workqueue("kacpi_notify", 0, 1); |
1850 | kacpi_hotplug_wq = alloc_ordered_workqueue("kacpi_hotplug", 0); | 1848 | kacpi_hotplug_wq = alloc_ordered_workqueue("kacpi_hotplug", 0); |
diff --git a/drivers/block/nvme-scsi.c b/drivers/block/nvme-scsi.c index 88f13c525712..44f2514fb775 100644 --- a/drivers/block/nvme-scsi.c +++ b/drivers/block/nvme-scsi.c | |||
@@ -2257,7 +2257,8 @@ static int nvme_trans_inquiry(struct nvme_ns *ns, struct sg_io_hdr *hdr, | |||
2257 | page_code = GET_INQ_PAGE_CODE(cmd); | 2257 | page_code = GET_INQ_PAGE_CODE(cmd); |
2258 | alloc_len = GET_INQ_ALLOC_LENGTH(cmd); | 2258 | alloc_len = GET_INQ_ALLOC_LENGTH(cmd); |
2259 | 2259 | ||
2260 | inq_response = kmalloc(alloc_len, GFP_KERNEL); | 2260 | inq_response = kmalloc(max(alloc_len, STANDARD_INQUIRY_LENGTH), |
2261 | GFP_KERNEL); | ||
2261 | if (inq_response == NULL) { | 2262 | if (inq_response == NULL) { |
2262 | res = -ENOMEM; | 2263 | res = -ENOMEM; |
2263 | goto out_mem; | 2264 | goto out_mem; |
diff --git a/drivers/bluetooth/ath3k.c b/drivers/bluetooth/ath3k.c index 288547a3c566..8c81af6dbe06 100644 --- a/drivers/bluetooth/ath3k.c +++ b/drivers/bluetooth/ath3k.c | |||
@@ -88,6 +88,7 @@ static const struct usb_device_id ath3k_table[] = { | |||
88 | { USB_DEVICE(0x04CA, 0x3007) }, | 88 | { USB_DEVICE(0x04CA, 0x3007) }, |
89 | { USB_DEVICE(0x04CA, 0x3008) }, | 89 | { USB_DEVICE(0x04CA, 0x3008) }, |
90 | { USB_DEVICE(0x04CA, 0x300b) }, | 90 | { USB_DEVICE(0x04CA, 0x300b) }, |
91 | { USB_DEVICE(0x04CA, 0x300f) }, | ||
91 | { USB_DEVICE(0x04CA, 0x3010) }, | 92 | { USB_DEVICE(0x04CA, 0x3010) }, |
92 | { USB_DEVICE(0x0930, 0x0219) }, | 93 | { USB_DEVICE(0x0930, 0x0219) }, |
93 | { USB_DEVICE(0x0930, 0x0220) }, | 94 | { USB_DEVICE(0x0930, 0x0220) }, |
@@ -104,6 +105,7 @@ static const struct usb_device_id ath3k_table[] = { | |||
104 | { USB_DEVICE(0x0cf3, 0xe003) }, | 105 | { USB_DEVICE(0x0cf3, 0xe003) }, |
105 | { USB_DEVICE(0x0CF3, 0xE004) }, | 106 | { USB_DEVICE(0x0CF3, 0xE004) }, |
106 | { USB_DEVICE(0x0CF3, 0xE005) }, | 107 | { USB_DEVICE(0x0CF3, 0xE005) }, |
108 | { USB_DEVICE(0x0CF3, 0xE006) }, | ||
107 | { USB_DEVICE(0x13d3, 0x3362) }, | 109 | { USB_DEVICE(0x13d3, 0x3362) }, |
108 | { USB_DEVICE(0x13d3, 0x3375) }, | 110 | { USB_DEVICE(0x13d3, 0x3375) }, |
109 | { USB_DEVICE(0x13d3, 0x3393) }, | 111 | { USB_DEVICE(0x13d3, 0x3393) }, |
@@ -143,6 +145,7 @@ static const struct usb_device_id ath3k_blist_tbl[] = { | |||
143 | { USB_DEVICE(0x04ca, 0x3007), .driver_info = BTUSB_ATH3012 }, | 145 | { USB_DEVICE(0x04ca, 0x3007), .driver_info = BTUSB_ATH3012 }, |
144 | { USB_DEVICE(0x04ca, 0x3008), .driver_info = BTUSB_ATH3012 }, | 146 | { USB_DEVICE(0x04ca, 0x3008), .driver_info = BTUSB_ATH3012 }, |
145 | { USB_DEVICE(0x04ca, 0x300b), .driver_info = BTUSB_ATH3012 }, | 147 | { USB_DEVICE(0x04ca, 0x300b), .driver_info = BTUSB_ATH3012 }, |
148 | { USB_DEVICE(0x04ca, 0x300f), .driver_info = BTUSB_ATH3012 }, | ||
146 | { USB_DEVICE(0x04ca, 0x3010), .driver_info = BTUSB_ATH3012 }, | 149 | { USB_DEVICE(0x04ca, 0x3010), .driver_info = BTUSB_ATH3012 }, |
147 | { USB_DEVICE(0x0930, 0x0219), .driver_info = BTUSB_ATH3012 }, | 150 | { USB_DEVICE(0x0930, 0x0219), .driver_info = BTUSB_ATH3012 }, |
148 | { USB_DEVICE(0x0930, 0x0220), .driver_info = BTUSB_ATH3012 }, | 151 | { USB_DEVICE(0x0930, 0x0220), .driver_info = BTUSB_ATH3012 }, |
@@ -158,6 +161,7 @@ static const struct usb_device_id ath3k_blist_tbl[] = { | |||
158 | { USB_DEVICE(0x0CF3, 0x817a), .driver_info = BTUSB_ATH3012 }, | 161 | { USB_DEVICE(0x0CF3, 0x817a), .driver_info = BTUSB_ATH3012 }, |
159 | { USB_DEVICE(0x0cf3, 0xe004), .driver_info = BTUSB_ATH3012 }, | 162 | { USB_DEVICE(0x0cf3, 0xe004), .driver_info = BTUSB_ATH3012 }, |
160 | { USB_DEVICE(0x0cf3, 0xe005), .driver_info = BTUSB_ATH3012 }, | 163 | { USB_DEVICE(0x0cf3, 0xe005), .driver_info = BTUSB_ATH3012 }, |
164 | { USB_DEVICE(0x0cf3, 0xe006), .driver_info = BTUSB_ATH3012 }, | ||
161 | { USB_DEVICE(0x0cf3, 0xe003), .driver_info = BTUSB_ATH3012 }, | 165 | { USB_DEVICE(0x0cf3, 0xe003), .driver_info = BTUSB_ATH3012 }, |
162 | { USB_DEVICE(0x13d3, 0x3362), .driver_info = BTUSB_ATH3012 }, | 166 | { USB_DEVICE(0x13d3, 0x3362), .driver_info = BTUSB_ATH3012 }, |
163 | { USB_DEVICE(0x13d3, 0x3375), .driver_info = BTUSB_ATH3012 }, | 167 | { USB_DEVICE(0x13d3, 0x3375), .driver_info = BTUSB_ATH3012 }, |
diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c index d21f3b4176d3..3c10d4dfe9a7 100644 --- a/drivers/bluetooth/btusb.c +++ b/drivers/bluetooth/btusb.c | |||
@@ -186,6 +186,7 @@ static const struct usb_device_id blacklist_table[] = { | |||
186 | { USB_DEVICE(0x04ca, 0x3007), .driver_info = BTUSB_ATH3012 }, | 186 | { USB_DEVICE(0x04ca, 0x3007), .driver_info = BTUSB_ATH3012 }, |
187 | { USB_DEVICE(0x04ca, 0x3008), .driver_info = BTUSB_ATH3012 }, | 187 | { USB_DEVICE(0x04ca, 0x3008), .driver_info = BTUSB_ATH3012 }, |
188 | { USB_DEVICE(0x04ca, 0x300b), .driver_info = BTUSB_ATH3012 }, | 188 | { USB_DEVICE(0x04ca, 0x300b), .driver_info = BTUSB_ATH3012 }, |
189 | { USB_DEVICE(0x04ca, 0x300f), .driver_info = BTUSB_ATH3012 }, | ||
189 | { USB_DEVICE(0x04ca, 0x3010), .driver_info = BTUSB_ATH3012 }, | 190 | { USB_DEVICE(0x04ca, 0x3010), .driver_info = BTUSB_ATH3012 }, |
190 | { USB_DEVICE(0x0930, 0x0219), .driver_info = BTUSB_ATH3012 }, | 191 | { USB_DEVICE(0x0930, 0x0219), .driver_info = BTUSB_ATH3012 }, |
191 | { USB_DEVICE(0x0930, 0x0220), .driver_info = BTUSB_ATH3012 }, | 192 | { USB_DEVICE(0x0930, 0x0220), .driver_info = BTUSB_ATH3012 }, |
@@ -202,6 +203,7 @@ static const struct usb_device_id blacklist_table[] = { | |||
202 | { USB_DEVICE(0x0cf3, 0xe003), .driver_info = BTUSB_ATH3012 }, | 203 | { USB_DEVICE(0x0cf3, 0xe003), .driver_info = BTUSB_ATH3012 }, |
203 | { USB_DEVICE(0x0cf3, 0xe004), .driver_info = BTUSB_ATH3012 }, | 204 | { USB_DEVICE(0x0cf3, 0xe004), .driver_info = BTUSB_ATH3012 }, |
204 | { USB_DEVICE(0x0cf3, 0xe005), .driver_info = BTUSB_ATH3012 }, | 205 | { USB_DEVICE(0x0cf3, 0xe005), .driver_info = BTUSB_ATH3012 }, |
206 | { USB_DEVICE(0x0cf3, 0xe006), .driver_info = BTUSB_ATH3012 }, | ||
205 | { USB_DEVICE(0x13d3, 0x3362), .driver_info = BTUSB_ATH3012 }, | 207 | { USB_DEVICE(0x13d3, 0x3362), .driver_info = BTUSB_ATH3012 }, |
206 | { USB_DEVICE(0x13d3, 0x3375), .driver_info = BTUSB_ATH3012 }, | 208 | { USB_DEVICE(0x13d3, 0x3375), .driver_info = BTUSB_ATH3012 }, |
207 | { USB_DEVICE(0x13d3, 0x3393), .driver_info = BTUSB_ATH3012 }, | 209 | { USB_DEVICE(0x13d3, 0x3393), .driver_info = BTUSB_ATH3012 }, |
@@ -218,6 +220,7 @@ static const struct usb_device_id blacklist_table[] = { | |||
218 | { USB_DEVICE(0x0489, 0xe03c), .driver_info = BTUSB_ATH3012 }, | 220 | { USB_DEVICE(0x0489, 0xe03c), .driver_info = BTUSB_ATH3012 }, |
219 | 221 | ||
220 | /* QCA ROME chipset */ | 222 | /* QCA ROME chipset */ |
223 | { USB_DEVICE(0x0cf3, 0xe007), .driver_info = BTUSB_QCA_ROME }, | ||
221 | { USB_DEVICE(0x0cf3, 0xe300), .driver_info = BTUSB_QCA_ROME }, | 224 | { USB_DEVICE(0x0cf3, 0xe300), .driver_info = BTUSB_QCA_ROME }, |
222 | { USB_DEVICE(0x0cf3, 0xe360), .driver_info = BTUSB_QCA_ROME }, | 225 | { USB_DEVICE(0x0cf3, 0xe360), .driver_info = BTUSB_QCA_ROME }, |
223 | 226 | ||
diff --git a/drivers/clk/clk-si5351.c b/drivers/clk/clk-si5351.c index 44ea107cfc67..30335d3b99af 100644 --- a/drivers/clk/clk-si5351.c +++ b/drivers/clk/clk-si5351.c | |||
@@ -1128,13 +1128,6 @@ static int si5351_dt_parse(struct i2c_client *client, | |||
1128 | if (!pdata) | 1128 | if (!pdata) |
1129 | return -ENOMEM; | 1129 | return -ENOMEM; |
1130 | 1130 | ||
1131 | pdata->clk_xtal = of_clk_get(np, 0); | ||
1132 | if (!IS_ERR(pdata->clk_xtal)) | ||
1133 | clk_put(pdata->clk_xtal); | ||
1134 | pdata->clk_clkin = of_clk_get(np, 1); | ||
1135 | if (!IS_ERR(pdata->clk_clkin)) | ||
1136 | clk_put(pdata->clk_clkin); | ||
1137 | |||
1138 | /* | 1131 | /* |
1139 | * property silabs,pll-source : <num src>, [<..>] | 1132 | * property silabs,pll-source : <num src>, [<..>] |
1140 | * allow to selectively set pll source | 1133 | * allow to selectively set pll source |
@@ -1328,8 +1321,22 @@ static int si5351_i2c_probe(struct i2c_client *client, | |||
1328 | i2c_set_clientdata(client, drvdata); | 1321 | i2c_set_clientdata(client, drvdata); |
1329 | drvdata->client = client; | 1322 | drvdata->client = client; |
1330 | drvdata->variant = variant; | 1323 | drvdata->variant = variant; |
1331 | drvdata->pxtal = pdata->clk_xtal; | 1324 | drvdata->pxtal = devm_clk_get(&client->dev, "xtal"); |
1332 | drvdata->pclkin = pdata->clk_clkin; | 1325 | drvdata->pclkin = devm_clk_get(&client->dev, "clkin"); |
1326 | |||
1327 | if (PTR_ERR(drvdata->pxtal) == -EPROBE_DEFER || | ||
1328 | PTR_ERR(drvdata->pclkin) == -EPROBE_DEFER) | ||
1329 | return -EPROBE_DEFER; | ||
1330 | |||
1331 | /* | ||
1332 | * Check for valid parent clock: VARIANT_A and VARIANT_B need XTAL, | ||
1333 | * VARIANT_C can have CLKIN instead. | ||
1334 | */ | ||
1335 | if (IS_ERR(drvdata->pxtal) && | ||
1336 | (drvdata->variant != SI5351_VARIANT_C || IS_ERR(drvdata->pclkin))) { | ||
1337 | dev_err(&client->dev, "missing parent clock\n"); | ||
1338 | return -EINVAL; | ||
1339 | } | ||
1333 | 1340 | ||
1334 | drvdata->regmap = devm_regmap_init_i2c(client, &si5351_regmap_config); | 1341 | drvdata->regmap = devm_regmap_init_i2c(client, &si5351_regmap_config); |
1335 | if (IS_ERR(drvdata->regmap)) { | 1342 | if (IS_ERR(drvdata->regmap)) { |
@@ -1393,6 +1400,11 @@ static int si5351_i2c_probe(struct i2c_client *client, | |||
1393 | } | 1400 | } |
1394 | } | 1401 | } |
1395 | 1402 | ||
1403 | if (!IS_ERR(drvdata->pxtal)) | ||
1404 | clk_prepare_enable(drvdata->pxtal); | ||
1405 | if (!IS_ERR(drvdata->pclkin)) | ||
1406 | clk_prepare_enable(drvdata->pclkin); | ||
1407 | |||
1396 | /* register xtal input clock gate */ | 1408 | /* register xtal input clock gate */ |
1397 | memset(&init, 0, sizeof(init)); | 1409 | memset(&init, 0, sizeof(init)); |
1398 | init.name = si5351_input_names[0]; | 1410 | init.name = si5351_input_names[0]; |
@@ -1407,7 +1419,8 @@ static int si5351_i2c_probe(struct i2c_client *client, | |||
1407 | clk = devm_clk_register(&client->dev, &drvdata->xtal); | 1419 | clk = devm_clk_register(&client->dev, &drvdata->xtal); |
1408 | if (IS_ERR(clk)) { | 1420 | if (IS_ERR(clk)) { |
1409 | dev_err(&client->dev, "unable to register %s\n", init.name); | 1421 | dev_err(&client->dev, "unable to register %s\n", init.name); |
1410 | return PTR_ERR(clk); | 1422 | ret = PTR_ERR(clk); |
1423 | goto err_clk; | ||
1411 | } | 1424 | } |
1412 | 1425 | ||
1413 | /* register clkin input clock gate */ | 1426 | /* register clkin input clock gate */ |
@@ -1425,7 +1438,8 @@ static int si5351_i2c_probe(struct i2c_client *client, | |||
1425 | if (IS_ERR(clk)) { | 1438 | if (IS_ERR(clk)) { |
1426 | dev_err(&client->dev, "unable to register %s\n", | 1439 | dev_err(&client->dev, "unable to register %s\n", |
1427 | init.name); | 1440 | init.name); |
1428 | return PTR_ERR(clk); | 1441 | ret = PTR_ERR(clk); |
1442 | goto err_clk; | ||
1429 | } | 1443 | } |
1430 | } | 1444 | } |
1431 | 1445 | ||
@@ -1447,7 +1461,8 @@ static int si5351_i2c_probe(struct i2c_client *client, | |||
1447 | clk = devm_clk_register(&client->dev, &drvdata->pll[0].hw); | 1461 | clk = devm_clk_register(&client->dev, &drvdata->pll[0].hw); |
1448 | if (IS_ERR(clk)) { | 1462 | if (IS_ERR(clk)) { |
1449 | dev_err(&client->dev, "unable to register %s\n", init.name); | 1463 | dev_err(&client->dev, "unable to register %s\n", init.name); |
1450 | return -EINVAL; | 1464 | ret = PTR_ERR(clk); |
1465 | goto err_clk; | ||
1451 | } | 1466 | } |
1452 | 1467 | ||
1453 | /* register PLLB or VXCO (Si5351B) */ | 1468 | /* register PLLB or VXCO (Si5351B) */ |
@@ -1471,7 +1486,8 @@ static int si5351_i2c_probe(struct i2c_client *client, | |||
1471 | clk = devm_clk_register(&client->dev, &drvdata->pll[1].hw); | 1486 | clk = devm_clk_register(&client->dev, &drvdata->pll[1].hw); |
1472 | if (IS_ERR(clk)) { | 1487 | if (IS_ERR(clk)) { |
1473 | dev_err(&client->dev, "unable to register %s\n", init.name); | 1488 | dev_err(&client->dev, "unable to register %s\n", init.name); |
1474 | return -EINVAL; | 1489 | ret = PTR_ERR(clk); |
1490 | goto err_clk; | ||
1475 | } | 1491 | } |
1476 | 1492 | ||
1477 | /* register clk multisync and clk out divider */ | 1493 | /* register clk multisync and clk out divider */ |
@@ -1492,8 +1508,10 @@ static int si5351_i2c_probe(struct i2c_client *client, | |||
1492 | num_clocks * sizeof(*drvdata->onecell.clks), GFP_KERNEL); | 1508 | num_clocks * sizeof(*drvdata->onecell.clks), GFP_KERNEL); |
1493 | 1509 | ||
1494 | if (WARN_ON(!drvdata->msynth || !drvdata->clkout || | 1510 | if (WARN_ON(!drvdata->msynth || !drvdata->clkout || |
1495 | !drvdata->onecell.clks)) | 1511 | !drvdata->onecell.clks)) { |
1496 | return -ENOMEM; | 1512 | ret = -ENOMEM; |
1513 | goto err_clk; | ||
1514 | } | ||
1497 | 1515 | ||
1498 | for (n = 0; n < num_clocks; n++) { | 1516 | for (n = 0; n < num_clocks; n++) { |
1499 | drvdata->msynth[n].num = n; | 1517 | drvdata->msynth[n].num = n; |
@@ -1511,7 +1529,8 @@ static int si5351_i2c_probe(struct i2c_client *client, | |||
1511 | if (IS_ERR(clk)) { | 1529 | if (IS_ERR(clk)) { |
1512 | dev_err(&client->dev, "unable to register %s\n", | 1530 | dev_err(&client->dev, "unable to register %s\n", |
1513 | init.name); | 1531 | init.name); |
1514 | return -EINVAL; | 1532 | ret = PTR_ERR(clk); |
1533 | goto err_clk; | ||
1515 | } | 1534 | } |
1516 | } | 1535 | } |
1517 | 1536 | ||
@@ -1538,7 +1557,8 @@ static int si5351_i2c_probe(struct i2c_client *client, | |||
1538 | if (IS_ERR(clk)) { | 1557 | if (IS_ERR(clk)) { |
1539 | dev_err(&client->dev, "unable to register %s\n", | 1558 | dev_err(&client->dev, "unable to register %s\n", |
1540 | init.name); | 1559 | init.name); |
1541 | return -EINVAL; | 1560 | ret = PTR_ERR(clk); |
1561 | goto err_clk; | ||
1542 | } | 1562 | } |
1543 | drvdata->onecell.clks[n] = clk; | 1563 | drvdata->onecell.clks[n] = clk; |
1544 | 1564 | ||
@@ -1557,10 +1577,17 @@ static int si5351_i2c_probe(struct i2c_client *client, | |||
1557 | &drvdata->onecell); | 1577 | &drvdata->onecell); |
1558 | if (ret) { | 1578 | if (ret) { |
1559 | dev_err(&client->dev, "unable to add clk provider\n"); | 1579 | dev_err(&client->dev, "unable to add clk provider\n"); |
1560 | return ret; | 1580 | goto err_clk; |
1561 | } | 1581 | } |
1562 | 1582 | ||
1563 | return 0; | 1583 | return 0; |
1584 | |||
1585 | err_clk: | ||
1586 | if (!IS_ERR(drvdata->pxtal)) | ||
1587 | clk_disable_unprepare(drvdata->pxtal); | ||
1588 | if (!IS_ERR(drvdata->pclkin)) | ||
1589 | clk_disable_unprepare(drvdata->pclkin); | ||
1590 | return ret; | ||
1564 | } | 1591 | } |
1565 | 1592 | ||
1566 | static const struct i2c_device_id si5351_i2c_ids[] = { | 1593 | static const struct i2c_device_id si5351_i2c_ids[] = { |
diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c index 459ce9da13e0..5b0f41868b42 100644 --- a/drivers/clk/clk.c +++ b/drivers/clk/clk.c | |||
@@ -1475,8 +1475,10 @@ static struct clk_core *__clk_set_parent_before(struct clk_core *clk, | |||
1475 | */ | 1475 | */ |
1476 | if (clk->prepare_count) { | 1476 | if (clk->prepare_count) { |
1477 | clk_core_prepare(parent); | 1477 | clk_core_prepare(parent); |
1478 | flags = clk_enable_lock(); | ||
1478 | clk_core_enable(parent); | 1479 | clk_core_enable(parent); |
1479 | clk_core_enable(clk); | 1480 | clk_core_enable(clk); |
1481 | clk_enable_unlock(flags); | ||
1480 | } | 1482 | } |
1481 | 1483 | ||
1482 | /* update the clk tree topology */ | 1484 | /* update the clk tree topology */ |
@@ -1491,13 +1493,17 @@ static void __clk_set_parent_after(struct clk_core *core, | |||
1491 | struct clk_core *parent, | 1493 | struct clk_core *parent, |
1492 | struct clk_core *old_parent) | 1494 | struct clk_core *old_parent) |
1493 | { | 1495 | { |
1496 | unsigned long flags; | ||
1497 | |||
1494 | /* | 1498 | /* |
1495 | * Finish the migration of prepare state and undo the changes done | 1499 | * Finish the migration of prepare state and undo the changes done |
1496 | * for preventing a race with clk_enable(). | 1500 | * for preventing a race with clk_enable(). |
1497 | */ | 1501 | */ |
1498 | if (core->prepare_count) { | 1502 | if (core->prepare_count) { |
1503 | flags = clk_enable_lock(); | ||
1499 | clk_core_disable(core); | 1504 | clk_core_disable(core); |
1500 | clk_core_disable(old_parent); | 1505 | clk_core_disable(old_parent); |
1506 | clk_enable_unlock(flags); | ||
1501 | clk_core_unprepare(old_parent); | 1507 | clk_core_unprepare(old_parent); |
1502 | } | 1508 | } |
1503 | } | 1509 | } |
@@ -1525,8 +1531,10 @@ static int __clk_set_parent(struct clk_core *clk, struct clk_core *parent, | |||
1525 | clk_enable_unlock(flags); | 1531 | clk_enable_unlock(flags); |
1526 | 1532 | ||
1527 | if (clk->prepare_count) { | 1533 | if (clk->prepare_count) { |
1534 | flags = clk_enable_lock(); | ||
1528 | clk_core_disable(clk); | 1535 | clk_core_disable(clk); |
1529 | clk_core_disable(parent); | 1536 | clk_core_disable(parent); |
1537 | clk_enable_unlock(flags); | ||
1530 | clk_core_unprepare(parent); | 1538 | clk_core_unprepare(parent); |
1531 | } | 1539 | } |
1532 | return ret; | 1540 | return ret; |
diff --git a/drivers/clk/qcom/gcc-msm8916.c b/drivers/clk/qcom/gcc-msm8916.c index d3458474eb3a..c66f7bc2ae87 100644 --- a/drivers/clk/qcom/gcc-msm8916.c +++ b/drivers/clk/qcom/gcc-msm8916.c | |||
@@ -71,8 +71,8 @@ static const char *gcc_xo_gpll0_bimc[] = { | |||
71 | static const struct parent_map gcc_xo_gpll0a_gpll1_gpll2a_map[] = { | 71 | static const struct parent_map gcc_xo_gpll0a_gpll1_gpll2a_map[] = { |
72 | { P_XO, 0 }, | 72 | { P_XO, 0 }, |
73 | { P_GPLL0_AUX, 3 }, | 73 | { P_GPLL0_AUX, 3 }, |
74 | { P_GPLL2_AUX, 2 }, | ||
75 | { P_GPLL1, 1 }, | 74 | { P_GPLL1, 1 }, |
75 | { P_GPLL2_AUX, 2 }, | ||
76 | }; | 76 | }; |
77 | 77 | ||
78 | static const char *gcc_xo_gpll0a_gpll1_gpll2a[] = { | 78 | static const char *gcc_xo_gpll0a_gpll1_gpll2a[] = { |
@@ -1115,7 +1115,7 @@ static struct clk_rcg2 usb_hs_system_clk_src = { | |||
1115 | static const struct freq_tbl ftbl_gcc_venus0_vcodec0_clk[] = { | 1115 | static const struct freq_tbl ftbl_gcc_venus0_vcodec0_clk[] = { |
1116 | F(100000000, P_GPLL0, 8, 0, 0), | 1116 | F(100000000, P_GPLL0, 8, 0, 0), |
1117 | F(160000000, P_GPLL0, 5, 0, 0), | 1117 | F(160000000, P_GPLL0, 5, 0, 0), |
1118 | F(228570000, P_GPLL0, 5, 0, 0), | 1118 | F(228570000, P_GPLL0, 3.5, 0, 0), |
1119 | { } | 1119 | { } |
1120 | }; | 1120 | }; |
1121 | 1121 | ||
diff --git a/drivers/clk/samsung/Makefile b/drivers/clk/samsung/Makefile index 17e9af7fe81f..a17683b2cf27 100644 --- a/drivers/clk/samsung/Makefile +++ b/drivers/clk/samsung/Makefile | |||
@@ -10,7 +10,7 @@ obj-$(CONFIG_SOC_EXYNOS5250) += clk-exynos5250.o | |||
10 | obj-$(CONFIG_SOC_EXYNOS5260) += clk-exynos5260.o | 10 | obj-$(CONFIG_SOC_EXYNOS5260) += clk-exynos5260.o |
11 | obj-$(CONFIG_SOC_EXYNOS5410) += clk-exynos5410.o | 11 | obj-$(CONFIG_SOC_EXYNOS5410) += clk-exynos5410.o |
12 | obj-$(CONFIG_SOC_EXYNOS5420) += clk-exynos5420.o | 12 | obj-$(CONFIG_SOC_EXYNOS5420) += clk-exynos5420.o |
13 | obj-$(CONFIG_ARCH_EXYNOS5433) += clk-exynos5433.o | 13 | obj-$(CONFIG_ARCH_EXYNOS) += clk-exynos5433.o |
14 | obj-$(CONFIG_SOC_EXYNOS5440) += clk-exynos5440.o | 14 | obj-$(CONFIG_SOC_EXYNOS5440) += clk-exynos5440.o |
15 | obj-$(CONFIG_ARCH_EXYNOS) += clk-exynos-audss.o | 15 | obj-$(CONFIG_ARCH_EXYNOS) += clk-exynos-audss.o |
16 | obj-$(CONFIG_ARCH_EXYNOS) += clk-exynos-clkout.o | 16 | obj-$(CONFIG_ARCH_EXYNOS) += clk-exynos-clkout.o |
diff --git a/drivers/clk/samsung/clk-exynos5420.c b/drivers/clk/samsung/clk-exynos5420.c index 07d666cc6a29..bea4a173eef5 100644 --- a/drivers/clk/samsung/clk-exynos5420.c +++ b/drivers/clk/samsung/clk-exynos5420.c | |||
@@ -271,6 +271,7 @@ static const struct samsung_clk_reg_dump exynos5420_set_clksrc[] = { | |||
271 | { .offset = SRC_MASK_PERIC0, .value = 0x11111110, }, | 271 | { .offset = SRC_MASK_PERIC0, .value = 0x11111110, }, |
272 | { .offset = SRC_MASK_PERIC1, .value = 0x11111100, }, | 272 | { .offset = SRC_MASK_PERIC1, .value = 0x11111100, }, |
273 | { .offset = SRC_MASK_ISP, .value = 0x11111000, }, | 273 | { .offset = SRC_MASK_ISP, .value = 0x11111000, }, |
274 | { .offset = GATE_BUS_TOP, .value = 0xffffffff, }, | ||
274 | { .offset = GATE_BUS_DISP1, .value = 0xffffffff, }, | 275 | { .offset = GATE_BUS_DISP1, .value = 0xffffffff, }, |
275 | { .offset = GATE_IP_PERIC, .value = 0xffffffff, }, | 276 | { .offset = GATE_IP_PERIC, .value = 0xffffffff, }, |
276 | }; | 277 | }; |
diff --git a/drivers/clk/samsung/clk-exynos5433.c b/drivers/clk/samsung/clk-exynos5433.c index 387e3e39e635..9e04ae2bb4d7 100644 --- a/drivers/clk/samsung/clk-exynos5433.c +++ b/drivers/clk/samsung/clk-exynos5433.c | |||
@@ -748,7 +748,7 @@ static struct samsung_pll_rate_table exynos5443_pll_rates[] = { | |||
748 | PLL_35XX_RATE(825000000U, 275, 4, 1), | 748 | PLL_35XX_RATE(825000000U, 275, 4, 1), |
749 | PLL_35XX_RATE(800000000U, 400, 6, 1), | 749 | PLL_35XX_RATE(800000000U, 400, 6, 1), |
750 | PLL_35XX_RATE(733000000U, 733, 12, 1), | 750 | PLL_35XX_RATE(733000000U, 733, 12, 1), |
751 | PLL_35XX_RATE(700000000U, 360, 6, 1), | 751 | PLL_35XX_RATE(700000000U, 175, 3, 1), |
752 | PLL_35XX_RATE(667000000U, 222, 4, 1), | 752 | PLL_35XX_RATE(667000000U, 222, 4, 1), |
753 | PLL_35XX_RATE(633000000U, 211, 4, 1), | 753 | PLL_35XX_RATE(633000000U, 211, 4, 1), |
754 | PLL_35XX_RATE(600000000U, 500, 5, 2), | 754 | PLL_35XX_RATE(600000000U, 500, 5, 2), |
@@ -760,14 +760,14 @@ static struct samsung_pll_rate_table exynos5443_pll_rates[] = { | |||
760 | PLL_35XX_RATE(444000000U, 370, 5, 2), | 760 | PLL_35XX_RATE(444000000U, 370, 5, 2), |
761 | PLL_35XX_RATE(420000000U, 350, 5, 2), | 761 | PLL_35XX_RATE(420000000U, 350, 5, 2), |
762 | PLL_35XX_RATE(400000000U, 400, 6, 2), | 762 | PLL_35XX_RATE(400000000U, 400, 6, 2), |
763 | PLL_35XX_RATE(350000000U, 360, 6, 2), | 763 | PLL_35XX_RATE(350000000U, 350, 6, 2), |
764 | PLL_35XX_RATE(333000000U, 222, 4, 2), | 764 | PLL_35XX_RATE(333000000U, 222, 4, 2), |
765 | PLL_35XX_RATE(300000000U, 500, 5, 3), | 765 | PLL_35XX_RATE(300000000U, 500, 5, 3), |
766 | PLL_35XX_RATE(266000000U, 532, 6, 3), | 766 | PLL_35XX_RATE(266000000U, 532, 6, 3), |
767 | PLL_35XX_RATE(200000000U, 400, 6, 3), | 767 | PLL_35XX_RATE(200000000U, 400, 6, 3), |
768 | PLL_35XX_RATE(166000000U, 332, 6, 3), | 768 | PLL_35XX_RATE(166000000U, 332, 6, 3), |
769 | PLL_35XX_RATE(160000000U, 320, 6, 3), | 769 | PLL_35XX_RATE(160000000U, 320, 6, 3), |
770 | PLL_35XX_RATE(133000000U, 552, 6, 4), | 770 | PLL_35XX_RATE(133000000U, 532, 6, 4), |
771 | PLL_35XX_RATE(100000000U, 400, 6, 4), | 771 | PLL_35XX_RATE(100000000U, 400, 6, 4), |
772 | { /* sentinel */ } | 772 | { /* sentinel */ } |
773 | }; | 773 | }; |
@@ -1490,7 +1490,7 @@ static struct samsung_gate_clock mif_gate_clks[] __initdata = { | |||
1490 | 1490 | ||
1491 | /* ENABLE_PCLK_MIF_SECURE_MONOTONIC_CNT */ | 1491 | /* ENABLE_PCLK_MIF_SECURE_MONOTONIC_CNT */ |
1492 | GATE(CLK_PCLK_MONOTONIC_CNT, "pclk_monotonic_cnt", "div_aclk_mif_133", | 1492 | GATE(CLK_PCLK_MONOTONIC_CNT, "pclk_monotonic_cnt", "div_aclk_mif_133", |
1493 | ENABLE_PCLK_MIF_SECURE_RTC, 0, 0, 0), | 1493 | ENABLE_PCLK_MIF_SECURE_MONOTONIC_CNT, 0, 0, 0), |
1494 | 1494 | ||
1495 | /* ENABLE_PCLK_MIF_SECURE_RTC */ | 1495 | /* ENABLE_PCLK_MIF_SECURE_RTC */ |
1496 | GATE(CLK_PCLK_RTC, "pclk_rtc", "div_aclk_mif_133", | 1496 | GATE(CLK_PCLK_RTC, "pclk_rtc", "div_aclk_mif_133", |
@@ -3665,7 +3665,7 @@ static struct samsung_gate_clock apollo_gate_clks[] __initdata = { | |||
3665 | ENABLE_SCLK_APOLLO, 3, CLK_IGNORE_UNUSED, 0), | 3665 | ENABLE_SCLK_APOLLO, 3, CLK_IGNORE_UNUSED, 0), |
3666 | GATE(CLK_SCLK_HPM_APOLLO, "sclk_hpm_apollo", "div_sclk_hpm_apollo", | 3666 | GATE(CLK_SCLK_HPM_APOLLO, "sclk_hpm_apollo", "div_sclk_hpm_apollo", |
3667 | ENABLE_SCLK_APOLLO, 1, CLK_IGNORE_UNUSED, 0), | 3667 | ENABLE_SCLK_APOLLO, 1, CLK_IGNORE_UNUSED, 0), |
3668 | GATE(CLK_SCLK_APOLLO, "sclk_apollo", "div_apollo_pll", | 3668 | GATE(CLK_SCLK_APOLLO, "sclk_apollo", "div_apollo2", |
3669 | ENABLE_SCLK_APOLLO, 0, CLK_IGNORE_UNUSED, 0), | 3669 | ENABLE_SCLK_APOLLO, 0, CLK_IGNORE_UNUSED, 0), |
3670 | }; | 3670 | }; |
3671 | 3671 | ||
@@ -3927,7 +3927,7 @@ CLK_OF_DECLARE(exynos5433_cmu_atlas, "samsung,exynos5433-cmu-atlas", | |||
3927 | #define ENABLE_PCLK_MSCL 0x0900 | 3927 | #define ENABLE_PCLK_MSCL 0x0900 |
3928 | #define ENABLE_PCLK_MSCL_SECURE_SMMU_M2MSCALER0 0x0904 | 3928 | #define ENABLE_PCLK_MSCL_SECURE_SMMU_M2MSCALER0 0x0904 |
3929 | #define ENABLE_PCLK_MSCL_SECURE_SMMU_M2MSCALER1 0x0908 | 3929 | #define ENABLE_PCLK_MSCL_SECURE_SMMU_M2MSCALER1 0x0908 |
3930 | #define ENABLE_PCLK_MSCL_SECURE_SMMU_JPEG 0x000c | 3930 | #define ENABLE_PCLK_MSCL_SECURE_SMMU_JPEG 0x090c |
3931 | #define ENABLE_SCLK_MSCL 0x0a00 | 3931 | #define ENABLE_SCLK_MSCL 0x0a00 |
3932 | #define ENABLE_IP_MSCL0 0x0b00 | 3932 | #define ENABLE_IP_MSCL0 0x0b00 |
3933 | #define ENABLE_IP_MSCL1 0x0b04 | 3933 | #define ENABLE_IP_MSCL1 0x0b04 |
diff --git a/drivers/extcon/extcon-usb-gpio.c b/drivers/extcon/extcon-usb-gpio.c index de67fce18984..e45d1f13f445 100644 --- a/drivers/extcon/extcon-usb-gpio.c +++ b/drivers/extcon/extcon-usb-gpio.c | |||
@@ -119,6 +119,18 @@ static int usb_extcon_probe(struct platform_device *pdev) | |||
119 | return PTR_ERR(info->id_gpiod); | 119 | return PTR_ERR(info->id_gpiod); |
120 | } | 120 | } |
121 | 121 | ||
122 | info->edev = devm_extcon_dev_allocate(dev, usb_extcon_cable); | ||
123 | if (IS_ERR(info->edev)) { | ||
124 | dev_err(dev, "failed to allocate extcon device\n"); | ||
125 | return -ENOMEM; | ||
126 | } | ||
127 | |||
128 | ret = devm_extcon_dev_register(dev, info->edev); | ||
129 | if (ret < 0) { | ||
130 | dev_err(dev, "failed to register extcon device\n"); | ||
131 | return ret; | ||
132 | } | ||
133 | |||
122 | ret = gpiod_set_debounce(info->id_gpiod, | 134 | ret = gpiod_set_debounce(info->id_gpiod, |
123 | USB_GPIO_DEBOUNCE_MS * 1000); | 135 | USB_GPIO_DEBOUNCE_MS * 1000); |
124 | if (ret < 0) | 136 | if (ret < 0) |
@@ -142,18 +154,6 @@ static int usb_extcon_probe(struct platform_device *pdev) | |||
142 | return ret; | 154 | return ret; |
143 | } | 155 | } |
144 | 156 | ||
145 | info->edev = devm_extcon_dev_allocate(dev, usb_extcon_cable); | ||
146 | if (IS_ERR(info->edev)) { | ||
147 | dev_err(dev, "failed to allocate extcon device\n"); | ||
148 | return -ENOMEM; | ||
149 | } | ||
150 | |||
151 | ret = devm_extcon_dev_register(dev, info->edev); | ||
152 | if (ret < 0) { | ||
153 | dev_err(dev, "failed to register extcon device\n"); | ||
154 | return ret; | ||
155 | } | ||
156 | |||
157 | platform_set_drvdata(pdev, info); | 157 | platform_set_drvdata(pdev, info); |
158 | device_init_wakeup(dev, 1); | 158 | device_init_wakeup(dev, 1); |
159 | 159 | ||
diff --git a/drivers/firmware/dmi_scan.c b/drivers/firmware/dmi_scan.c index 6e45a43ffe84..97b1616aa391 100644 --- a/drivers/firmware/dmi_scan.c +++ b/drivers/firmware/dmi_scan.c | |||
@@ -499,19 +499,19 @@ static int __init dmi_present(const u8 *buf) | |||
499 | buf += 16; | 499 | buf += 16; |
500 | 500 | ||
501 | if (memcmp(buf, "_DMI_", 5) == 0 && dmi_checksum(buf, 15)) { | 501 | if (memcmp(buf, "_DMI_", 5) == 0 && dmi_checksum(buf, 15)) { |
502 | if (smbios_ver) | ||
503 | dmi_ver = smbios_ver; | ||
504 | else | ||
505 | dmi_ver = (buf[14] & 0xF0) << 4 | (buf[14] & 0x0F); | ||
502 | dmi_num = get_unaligned_le16(buf + 12); | 506 | dmi_num = get_unaligned_le16(buf + 12); |
503 | dmi_len = get_unaligned_le16(buf + 6); | 507 | dmi_len = get_unaligned_le16(buf + 6); |
504 | dmi_base = get_unaligned_le32(buf + 8); | 508 | dmi_base = get_unaligned_le32(buf + 8); |
505 | 509 | ||
506 | if (dmi_walk_early(dmi_decode) == 0) { | 510 | if (dmi_walk_early(dmi_decode) == 0) { |
507 | if (smbios_ver) { | 511 | if (smbios_ver) { |
508 | dmi_ver = smbios_ver; | 512 | pr_info("SMBIOS %d.%d present.\n", |
509 | pr_info("SMBIOS %d.%d%s present.\n", | 513 | dmi_ver >> 8, dmi_ver & 0xFF); |
510 | dmi_ver >> 8, dmi_ver & 0xFF, | ||
511 | (dmi_ver < 0x0300) ? "" : ".x"); | ||
512 | } else { | 514 | } else { |
513 | dmi_ver = (buf[14] & 0xF0) << 4 | | ||
514 | (buf[14] & 0x0F); | ||
515 | pr_info("Legacy DMI %d.%d present.\n", | 515 | pr_info("Legacy DMI %d.%d present.\n", |
516 | dmi_ver >> 8, dmi_ver & 0xFF); | 516 | dmi_ver >> 8, dmi_ver & 0xFF); |
517 | } | 517 | } |
diff --git a/drivers/gpu/drm/exynos/exynos7_drm_decon.c b/drivers/gpu/drm/exynos/exynos7_drm_decon.c index 1f7e33f59de6..6714e5b193ea 100644 --- a/drivers/gpu/drm/exynos/exynos7_drm_decon.c +++ b/drivers/gpu/drm/exynos/exynos7_drm_decon.c | |||
@@ -91,7 +91,7 @@ static void decon_wait_for_vblank(struct exynos_drm_crtc *crtc) | |||
91 | 91 | ||
92 | static void decon_clear_channel(struct decon_context *ctx) | 92 | static void decon_clear_channel(struct decon_context *ctx) |
93 | { | 93 | { |
94 | int win, ch_enabled = 0; | 94 | unsigned int win, ch_enabled = 0; |
95 | 95 | ||
96 | DRM_DEBUG_KMS("%s\n", __FILE__); | 96 | DRM_DEBUG_KMS("%s\n", __FILE__); |
97 | 97 | ||
@@ -710,7 +710,7 @@ static void decon_dpms(struct exynos_drm_crtc *crtc, int mode) | |||
710 | } | 710 | } |
711 | } | 711 | } |
712 | 712 | ||
713 | static struct exynos_drm_crtc_ops decon_crtc_ops = { | 713 | static const struct exynos_drm_crtc_ops decon_crtc_ops = { |
714 | .dpms = decon_dpms, | 714 | .dpms = decon_dpms, |
715 | .mode_fixup = decon_mode_fixup, | 715 | .mode_fixup = decon_mode_fixup, |
716 | .commit = decon_commit, | 716 | .commit = decon_commit, |
diff --git a/drivers/gpu/drm/exynos/exynos_dp_core.c b/drivers/gpu/drm/exynos/exynos_dp_core.c index 1dbfba58f909..30feb7d06624 100644 --- a/drivers/gpu/drm/exynos/exynos_dp_core.c +++ b/drivers/gpu/drm/exynos/exynos_dp_core.c | |||
@@ -32,7 +32,6 @@ | |||
32 | #include <drm/bridge/ptn3460.h> | 32 | #include <drm/bridge/ptn3460.h> |
33 | 33 | ||
34 | #include "exynos_dp_core.h" | 34 | #include "exynos_dp_core.h" |
35 | #include "exynos_drm_fimd.h" | ||
36 | 35 | ||
37 | #define ctx_from_connector(c) container_of(c, struct exynos_dp_device, \ | 36 | #define ctx_from_connector(c) container_of(c, struct exynos_dp_device, \ |
38 | connector) | 37 | connector) |
@@ -196,7 +195,7 @@ static int exynos_dp_read_edid(struct exynos_dp_device *dp) | |||
196 | } | 195 | } |
197 | } | 196 | } |
198 | 197 | ||
199 | dev_err(dp->dev, "EDID Read success!\n"); | 198 | dev_dbg(dp->dev, "EDID Read success!\n"); |
200 | return 0; | 199 | return 0; |
201 | } | 200 | } |
202 | 201 | ||
@@ -1066,6 +1065,8 @@ static void exynos_dp_phy_exit(struct exynos_dp_device *dp) | |||
1066 | 1065 | ||
1067 | static void exynos_dp_poweron(struct exynos_dp_device *dp) | 1066 | static void exynos_dp_poweron(struct exynos_dp_device *dp) |
1068 | { | 1067 | { |
1068 | struct exynos_drm_crtc *crtc = dp_to_crtc(dp); | ||
1069 | |||
1069 | if (dp->dpms_mode == DRM_MODE_DPMS_ON) | 1070 | if (dp->dpms_mode == DRM_MODE_DPMS_ON) |
1070 | return; | 1071 | return; |
1071 | 1072 | ||
@@ -1076,7 +1077,8 @@ static void exynos_dp_poweron(struct exynos_dp_device *dp) | |||
1076 | } | 1077 | } |
1077 | } | 1078 | } |
1078 | 1079 | ||
1079 | fimd_dp_clock_enable(dp_to_crtc(dp), true); | 1080 | if (crtc->ops->clock_enable) |
1081 | crtc->ops->clock_enable(dp_to_crtc(dp), true); | ||
1080 | 1082 | ||
1081 | clk_prepare_enable(dp->clock); | 1083 | clk_prepare_enable(dp->clock); |
1082 | exynos_dp_phy_init(dp); | 1084 | exynos_dp_phy_init(dp); |
@@ -1087,6 +1089,8 @@ static void exynos_dp_poweron(struct exynos_dp_device *dp) | |||
1087 | 1089 | ||
1088 | static void exynos_dp_poweroff(struct exynos_dp_device *dp) | 1090 | static void exynos_dp_poweroff(struct exynos_dp_device *dp) |
1089 | { | 1091 | { |
1092 | struct exynos_drm_crtc *crtc = dp_to_crtc(dp); | ||
1093 | |||
1090 | if (dp->dpms_mode != DRM_MODE_DPMS_ON) | 1094 | if (dp->dpms_mode != DRM_MODE_DPMS_ON) |
1091 | return; | 1095 | return; |
1092 | 1096 | ||
@@ -1102,7 +1106,8 @@ static void exynos_dp_poweroff(struct exynos_dp_device *dp) | |||
1102 | exynos_dp_phy_exit(dp); | 1106 | exynos_dp_phy_exit(dp); |
1103 | clk_disable_unprepare(dp->clock); | 1107 | clk_disable_unprepare(dp->clock); |
1104 | 1108 | ||
1105 | fimd_dp_clock_enable(dp_to_crtc(dp), false); | 1109 | if (crtc->ops->clock_enable) |
1110 | crtc->ops->clock_enable(dp_to_crtc(dp), false); | ||
1106 | 1111 | ||
1107 | if (dp->panel) { | 1112 | if (dp->panel) { |
1108 | if (drm_panel_unprepare(dp->panel)) | 1113 | if (drm_panel_unprepare(dp->panel)) |
diff --git a/drivers/gpu/drm/exynos/exynos_drm_crtc.c b/drivers/gpu/drm/exynos/exynos_drm_crtc.c index eb49195cec5c..9006b947e03c 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_crtc.c +++ b/drivers/gpu/drm/exynos/exynos_drm_crtc.c | |||
@@ -238,11 +238,11 @@ static struct drm_crtc_funcs exynos_crtc_funcs = { | |||
238 | }; | 238 | }; |
239 | 239 | ||
240 | struct exynos_drm_crtc *exynos_drm_crtc_create(struct drm_device *drm_dev, | 240 | struct exynos_drm_crtc *exynos_drm_crtc_create(struct drm_device *drm_dev, |
241 | struct drm_plane *plane, | 241 | struct drm_plane *plane, |
242 | int pipe, | 242 | int pipe, |
243 | enum exynos_drm_output_type type, | 243 | enum exynos_drm_output_type type, |
244 | struct exynos_drm_crtc_ops *ops, | 244 | const struct exynos_drm_crtc_ops *ops, |
245 | void *ctx) | 245 | void *ctx) |
246 | { | 246 | { |
247 | struct exynos_drm_crtc *exynos_crtc; | 247 | struct exynos_drm_crtc *exynos_crtc; |
248 | struct exynos_drm_private *private = drm_dev->dev_private; | 248 | struct exynos_drm_private *private = drm_dev->dev_private; |
diff --git a/drivers/gpu/drm/exynos/exynos_drm_crtc.h b/drivers/gpu/drm/exynos/exynos_drm_crtc.h index 0ecd8fc45cff..0f3aa70818e3 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_crtc.h +++ b/drivers/gpu/drm/exynos/exynos_drm_crtc.h | |||
@@ -18,11 +18,11 @@ | |||
18 | #include "exynos_drm_drv.h" | 18 | #include "exynos_drm_drv.h" |
19 | 19 | ||
20 | struct exynos_drm_crtc *exynos_drm_crtc_create(struct drm_device *drm_dev, | 20 | struct exynos_drm_crtc *exynos_drm_crtc_create(struct drm_device *drm_dev, |
21 | struct drm_plane *plane, | 21 | struct drm_plane *plane, |
22 | int pipe, | 22 | int pipe, |
23 | enum exynos_drm_output_type type, | 23 | enum exynos_drm_output_type type, |
24 | struct exynos_drm_crtc_ops *ops, | 24 | const struct exynos_drm_crtc_ops *ops, |
25 | void *context); | 25 | void *context); |
26 | int exynos_drm_crtc_enable_vblank(struct drm_device *dev, int pipe); | 26 | int exynos_drm_crtc_enable_vblank(struct drm_device *dev, int pipe); |
27 | void exynos_drm_crtc_disable_vblank(struct drm_device *dev, int pipe); | 27 | void exynos_drm_crtc_disable_vblank(struct drm_device *dev, int pipe); |
28 | void exynos_drm_crtc_finish_pageflip(struct drm_device *dev, int pipe); | 28 | void exynos_drm_crtc_finish_pageflip(struct drm_device *dev, int pipe); |
diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.h b/drivers/gpu/drm/exynos/exynos_drm_drv.h index e12ecb5d5d9a..29e3fb78c615 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_drv.h +++ b/drivers/gpu/drm/exynos/exynos_drm_drv.h | |||
@@ -71,13 +71,6 @@ enum exynos_drm_output_type { | |||
71 | * @dma_addr: array of bus(accessed by dma) address to the memory region | 71 | * @dma_addr: array of bus(accessed by dma) address to the memory region |
72 | * allocated for a overlay. | 72 | * allocated for a overlay. |
73 | * @zpos: order of overlay layer(z position). | 73 | * @zpos: order of overlay layer(z position). |
74 | * @index_color: if using color key feature then this value would be used | ||
75 | * as index color. | ||
76 | * @default_win: a window to be enabled. | ||
77 | * @color_key: color key on or off. | ||
78 | * @local_path: in case of lcd type, local path mode on or off. | ||
79 | * @transparency: transparency on or off. | ||
80 | * @activated: activated or not. | ||
81 | * @enabled: enabled or not. | 74 | * @enabled: enabled or not. |
82 | * @resume: to resume or not. | 75 | * @resume: to resume or not. |
83 | * | 76 | * |
@@ -108,13 +101,7 @@ struct exynos_drm_plane { | |||
108 | uint32_t pixel_format; | 101 | uint32_t pixel_format; |
109 | dma_addr_t dma_addr[MAX_FB_BUFFER]; | 102 | dma_addr_t dma_addr[MAX_FB_BUFFER]; |
110 | unsigned int zpos; | 103 | unsigned int zpos; |
111 | unsigned int index_color; | ||
112 | 104 | ||
113 | bool default_win:1; | ||
114 | bool color_key:1; | ||
115 | bool local_path:1; | ||
116 | bool transparency:1; | ||
117 | bool activated:1; | ||
118 | bool enabled:1; | 105 | bool enabled:1; |
119 | bool resume:1; | 106 | bool resume:1; |
120 | }; | 107 | }; |
@@ -181,6 +168,10 @@ struct exynos_drm_display { | |||
181 | * @win_disable: disable hardware specific overlay. | 168 | * @win_disable: disable hardware specific overlay. |
182 | * @te_handler: trigger to transfer video image at the tearing effect | 169 | * @te_handler: trigger to transfer video image at the tearing effect |
183 | * synchronization signal if there is a page flip request. | 170 | * synchronization signal if there is a page flip request. |
171 | * @clock_enable: optional function enabling/disabling display domain clock, | ||
172 | * called from exynos-dp driver before powering up (with | ||
173 | * 'enable' argument as true) and after powering down (with | ||
174 | * 'enable' as false). | ||
184 | */ | 175 | */ |
185 | struct exynos_drm_crtc; | 176 | struct exynos_drm_crtc; |
186 | struct exynos_drm_crtc_ops { | 177 | struct exynos_drm_crtc_ops { |
@@ -195,6 +186,7 @@ struct exynos_drm_crtc_ops { | |||
195 | void (*win_commit)(struct exynos_drm_crtc *crtc, unsigned int zpos); | 186 | void (*win_commit)(struct exynos_drm_crtc *crtc, unsigned int zpos); |
196 | void (*win_disable)(struct exynos_drm_crtc *crtc, unsigned int zpos); | 187 | void (*win_disable)(struct exynos_drm_crtc *crtc, unsigned int zpos); |
197 | void (*te_handler)(struct exynos_drm_crtc *crtc); | 188 | void (*te_handler)(struct exynos_drm_crtc *crtc); |
189 | void (*clock_enable)(struct exynos_drm_crtc *crtc, bool enable); | ||
198 | }; | 190 | }; |
199 | 191 | ||
200 | /* | 192 | /* |
@@ -221,7 +213,7 @@ struct exynos_drm_crtc { | |||
221 | unsigned int dpms; | 213 | unsigned int dpms; |
222 | wait_queue_head_t pending_flip_queue; | 214 | wait_queue_head_t pending_flip_queue; |
223 | struct drm_pending_vblank_event *event; | 215 | struct drm_pending_vblank_event *event; |
224 | struct exynos_drm_crtc_ops *ops; | 216 | const struct exynos_drm_crtc_ops *ops; |
225 | void *ctx; | 217 | void *ctx; |
226 | }; | 218 | }; |
227 | 219 | ||
diff --git a/drivers/gpu/drm/exynos/exynos_drm_fb.c b/drivers/gpu/drm/exynos/exynos_drm_fb.c index 929cb03a8eab..142eb4e3f59e 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_fb.c +++ b/drivers/gpu/drm/exynos/exynos_drm_fb.c | |||
@@ -171,43 +171,6 @@ exynos_drm_framebuffer_init(struct drm_device *dev, | |||
171 | return &exynos_fb->fb; | 171 | return &exynos_fb->fb; |
172 | } | 172 | } |
173 | 173 | ||
174 | static u32 exynos_drm_format_num_buffers(struct drm_mode_fb_cmd2 *mode_cmd) | ||
175 | { | ||
176 | unsigned int cnt = 0; | ||
177 | |||
178 | if (mode_cmd->pixel_format != DRM_FORMAT_NV12) | ||
179 | return drm_format_num_planes(mode_cmd->pixel_format); | ||
180 | |||
181 | while (cnt != MAX_FB_BUFFER) { | ||
182 | if (!mode_cmd->handles[cnt]) | ||
183 | break; | ||
184 | cnt++; | ||
185 | } | ||
186 | |||
187 | /* | ||
188 | * check if NV12 or NV12M. | ||
189 | * | ||
190 | * NV12 | ||
191 | * handles[0] = base1, offsets[0] = 0 | ||
192 | * handles[1] = base1, offsets[1] = Y_size | ||
193 | * | ||
194 | * NV12M | ||
195 | * handles[0] = base1, offsets[0] = 0 | ||
196 | * handles[1] = base2, offsets[1] = 0 | ||
197 | */ | ||
198 | if (cnt == 2) { | ||
199 | /* | ||
200 | * in case of NV12 format, offsets[1] is not 0 and | ||
201 | * handles[0] is same as handles[1]. | ||
202 | */ | ||
203 | if (mode_cmd->offsets[1] && | ||
204 | mode_cmd->handles[0] == mode_cmd->handles[1]) | ||
205 | cnt = 1; | ||
206 | } | ||
207 | |||
208 | return cnt; | ||
209 | } | ||
210 | |||
211 | static struct drm_framebuffer * | 174 | static struct drm_framebuffer * |
212 | exynos_user_fb_create(struct drm_device *dev, struct drm_file *file_priv, | 175 | exynos_user_fb_create(struct drm_device *dev, struct drm_file *file_priv, |
213 | struct drm_mode_fb_cmd2 *mode_cmd) | 176 | struct drm_mode_fb_cmd2 *mode_cmd) |
@@ -230,7 +193,7 @@ exynos_user_fb_create(struct drm_device *dev, struct drm_file *file_priv, | |||
230 | 193 | ||
231 | drm_helper_mode_fill_fb_struct(&exynos_fb->fb, mode_cmd); | 194 | drm_helper_mode_fill_fb_struct(&exynos_fb->fb, mode_cmd); |
232 | exynos_fb->exynos_gem_obj[0] = to_exynos_gem_obj(obj); | 195 | exynos_fb->exynos_gem_obj[0] = to_exynos_gem_obj(obj); |
233 | exynos_fb->buf_cnt = exynos_drm_format_num_buffers(mode_cmd); | 196 | exynos_fb->buf_cnt = drm_format_num_planes(mode_cmd->pixel_format); |
234 | 197 | ||
235 | DRM_DEBUG_KMS("buf_cnt = %d\n", exynos_fb->buf_cnt); | 198 | DRM_DEBUG_KMS("buf_cnt = %d\n", exynos_fb->buf_cnt); |
236 | 199 | ||
diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c b/drivers/gpu/drm/exynos/exynos_drm_fimd.c index 9819fa6a9e2a..a0edab833148 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c +++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c | |||
@@ -33,7 +33,6 @@ | |||
33 | #include "exynos_drm_crtc.h" | 33 | #include "exynos_drm_crtc.h" |
34 | #include "exynos_drm_plane.h" | 34 | #include "exynos_drm_plane.h" |
35 | #include "exynos_drm_iommu.h" | 35 | #include "exynos_drm_iommu.h" |
36 | #include "exynos_drm_fimd.h" | ||
37 | 36 | ||
38 | /* | 37 | /* |
39 | * FIMD stands for Fully Interactive Mobile Display and | 38 | * FIMD stands for Fully Interactive Mobile Display and |
@@ -216,7 +215,7 @@ static void fimd_wait_for_vblank(struct exynos_drm_crtc *crtc) | |||
216 | DRM_DEBUG_KMS("vblank wait timed out.\n"); | 215 | DRM_DEBUG_KMS("vblank wait timed out.\n"); |
217 | } | 216 | } |
218 | 217 | ||
219 | static void fimd_enable_video_output(struct fimd_context *ctx, int win, | 218 | static void fimd_enable_video_output(struct fimd_context *ctx, unsigned int win, |
220 | bool enable) | 219 | bool enable) |
221 | { | 220 | { |
222 | u32 val = readl(ctx->regs + WINCON(win)); | 221 | u32 val = readl(ctx->regs + WINCON(win)); |
@@ -229,7 +228,8 @@ static void fimd_enable_video_output(struct fimd_context *ctx, int win, | |||
229 | writel(val, ctx->regs + WINCON(win)); | 228 | writel(val, ctx->regs + WINCON(win)); |
230 | } | 229 | } |
231 | 230 | ||
232 | static void fimd_enable_shadow_channel_path(struct fimd_context *ctx, int win, | 231 | static void fimd_enable_shadow_channel_path(struct fimd_context *ctx, |
232 | unsigned int win, | ||
233 | bool enable) | 233 | bool enable) |
234 | { | 234 | { |
235 | u32 val = readl(ctx->regs + SHADOWCON); | 235 | u32 val = readl(ctx->regs + SHADOWCON); |
@@ -244,7 +244,7 @@ static void fimd_enable_shadow_channel_path(struct fimd_context *ctx, int win, | |||
244 | 244 | ||
245 | static void fimd_clear_channel(struct fimd_context *ctx) | 245 | static void fimd_clear_channel(struct fimd_context *ctx) |
246 | { | 246 | { |
247 | int win, ch_enabled = 0; | 247 | unsigned int win, ch_enabled = 0; |
248 | 248 | ||
249 | DRM_DEBUG_KMS("%s\n", __FILE__); | 249 | DRM_DEBUG_KMS("%s\n", __FILE__); |
250 | 250 | ||
@@ -946,7 +946,24 @@ static void fimd_te_handler(struct exynos_drm_crtc *crtc) | |||
946 | drm_handle_vblank(ctx->drm_dev, ctx->pipe); | 946 | drm_handle_vblank(ctx->drm_dev, ctx->pipe); |
947 | } | 947 | } |
948 | 948 | ||
949 | static struct exynos_drm_crtc_ops fimd_crtc_ops = { | 949 | static void fimd_dp_clock_enable(struct exynos_drm_crtc *crtc, bool enable) |
950 | { | ||
951 | struct fimd_context *ctx = crtc->ctx; | ||
952 | u32 val; | ||
953 | |||
954 | /* | ||
955 | * Only Exynos 5250, 5260, 5410 and 542x requires enabling DP/MIE | ||
956 | * clock. On these SoCs the bootloader may enable it but any | ||
957 | * power domain off/on will reset it to disable state. | ||
958 | */ | ||
959 | if (ctx->driver_data != &exynos5_fimd_driver_data) | ||
960 | return; | ||
961 | |||
962 | val = enable ? DP_MIE_CLK_DP_ENABLE : DP_MIE_CLK_DISABLE; | ||
963 | writel(DP_MIE_CLK_DP_ENABLE, ctx->regs + DP_MIE_CLKCON); | ||
964 | } | ||
965 | |||
966 | static const struct exynos_drm_crtc_ops fimd_crtc_ops = { | ||
950 | .dpms = fimd_dpms, | 967 | .dpms = fimd_dpms, |
951 | .mode_fixup = fimd_mode_fixup, | 968 | .mode_fixup = fimd_mode_fixup, |
952 | .commit = fimd_commit, | 969 | .commit = fimd_commit, |
@@ -956,6 +973,7 @@ static struct exynos_drm_crtc_ops fimd_crtc_ops = { | |||
956 | .win_commit = fimd_win_commit, | 973 | .win_commit = fimd_win_commit, |
957 | .win_disable = fimd_win_disable, | 974 | .win_disable = fimd_win_disable, |
958 | .te_handler = fimd_te_handler, | 975 | .te_handler = fimd_te_handler, |
976 | .clock_enable = fimd_dp_clock_enable, | ||
959 | }; | 977 | }; |
960 | 978 | ||
961 | static irqreturn_t fimd_irq_handler(int irq, void *dev_id) | 979 | static irqreturn_t fimd_irq_handler(int irq, void *dev_id) |
@@ -1025,12 +1043,7 @@ static int fimd_bind(struct device *dev, struct device *master, void *data) | |||
1025 | if (ctx->display) | 1043 | if (ctx->display) |
1026 | exynos_drm_create_enc_conn(drm_dev, ctx->display); | 1044 | exynos_drm_create_enc_conn(drm_dev, ctx->display); |
1027 | 1045 | ||
1028 | ret = fimd_iommu_attach_devices(ctx, drm_dev); | 1046 | return fimd_iommu_attach_devices(ctx, drm_dev); |
1029 | if (ret) | ||
1030 | return ret; | ||
1031 | |||
1032 | return 0; | ||
1033 | |||
1034 | } | 1047 | } |
1035 | 1048 | ||
1036 | static void fimd_unbind(struct device *dev, struct device *master, | 1049 | static void fimd_unbind(struct device *dev, struct device *master, |
@@ -1192,24 +1205,6 @@ static int fimd_remove(struct platform_device *pdev) | |||
1192 | return 0; | 1205 | return 0; |
1193 | } | 1206 | } |
1194 | 1207 | ||
1195 | void fimd_dp_clock_enable(struct exynos_drm_crtc *crtc, bool enable) | ||
1196 | { | ||
1197 | struct fimd_context *ctx = crtc->ctx; | ||
1198 | u32 val; | ||
1199 | |||
1200 | /* | ||
1201 | * Only Exynos 5250, 5260, 5410 and 542x requires enabling DP/MIE | ||
1202 | * clock. On these SoCs the bootloader may enable it but any | ||
1203 | * power domain off/on will reset it to disable state. | ||
1204 | */ | ||
1205 | if (ctx->driver_data != &exynos5_fimd_driver_data) | ||
1206 | return; | ||
1207 | |||
1208 | val = enable ? DP_MIE_CLK_DP_ENABLE : DP_MIE_CLK_DISABLE; | ||
1209 | writel(DP_MIE_CLK_DP_ENABLE, ctx->regs + DP_MIE_CLKCON); | ||
1210 | } | ||
1211 | EXPORT_SYMBOL_GPL(fimd_dp_clock_enable); | ||
1212 | |||
1213 | struct platform_driver fimd_driver = { | 1208 | struct platform_driver fimd_driver = { |
1214 | .probe = fimd_probe, | 1209 | .probe = fimd_probe, |
1215 | .remove = fimd_remove, | 1210 | .remove = fimd_remove, |
diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.h b/drivers/gpu/drm/exynos/exynos_drm_fimd.h deleted file mode 100644 index b4fcaa568456..000000000000 --- a/drivers/gpu/drm/exynos/exynos_drm_fimd.h +++ /dev/null | |||
@@ -1,15 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2015 Samsung Electronics Co., Ltd. | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify it | ||
5 | * under the terms of the GNU General Public License as published by the | ||
6 | * Free Software Foundation; either version 2 of the License, or (at your | ||
7 | * option) any later version. | ||
8 | */ | ||
9 | |||
10 | #ifndef _EXYNOS_DRM_FIMD_H_ | ||
11 | #define _EXYNOS_DRM_FIMD_H_ | ||
12 | |||
13 | extern void fimd_dp_clock_enable(struct exynos_drm_crtc *crtc, bool enable); | ||
14 | |||
15 | #endif /* _EXYNOS_DRM_FIMD_H_ */ | ||
diff --git a/drivers/gpu/drm/exynos/exynos_drm_plane.c b/drivers/gpu/drm/exynos/exynos_drm_plane.c index 13ea3349363b..b1180fbe7546 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_plane.c +++ b/drivers/gpu/drm/exynos/exynos_drm_plane.c | |||
@@ -76,7 +76,7 @@ int exynos_check_plane(struct drm_plane *plane, struct drm_framebuffer *fb) | |||
76 | return -EFAULT; | 76 | return -EFAULT; |
77 | } | 77 | } |
78 | 78 | ||
79 | exynos_plane->dma_addr[i] = buffer->dma_addr; | 79 | exynos_plane->dma_addr[i] = buffer->dma_addr + fb->offsets[i]; |
80 | 80 | ||
81 | DRM_DEBUG_KMS("buffer: %d, dma_addr = 0x%lx\n", | 81 | DRM_DEBUG_KMS("buffer: %d, dma_addr = 0x%lx\n", |
82 | i, (unsigned long)exynos_plane->dma_addr[i]); | 82 | i, (unsigned long)exynos_plane->dma_addr[i]); |
diff --git a/drivers/gpu/drm/exynos/exynos_drm_vidi.c b/drivers/gpu/drm/exynos/exynos_drm_vidi.c index 27e84ec21694..1b3479a8db5f 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_vidi.c +++ b/drivers/gpu/drm/exynos/exynos_drm_vidi.c | |||
@@ -217,7 +217,7 @@ static int vidi_ctx_initialize(struct vidi_context *ctx, | |||
217 | return 0; | 217 | return 0; |
218 | } | 218 | } |
219 | 219 | ||
220 | static struct exynos_drm_crtc_ops vidi_crtc_ops = { | 220 | static const struct exynos_drm_crtc_ops vidi_crtc_ops = { |
221 | .dpms = vidi_dpms, | 221 | .dpms = vidi_dpms, |
222 | .enable_vblank = vidi_enable_vblank, | 222 | .enable_vblank = vidi_enable_vblank, |
223 | .disable_vblank = vidi_disable_vblank, | 223 | .disable_vblank = vidi_disable_vblank, |
diff --git a/drivers/gpu/drm/exynos/exynos_mixer.c b/drivers/gpu/drm/exynos/exynos_mixer.c index fbec750574e6..8874c1fcb3ab 100644 --- a/drivers/gpu/drm/exynos/exynos_mixer.c +++ b/drivers/gpu/drm/exynos/exynos_mixer.c | |||
@@ -44,6 +44,12 @@ | |||
44 | #define MIXER_WIN_NR 3 | 44 | #define MIXER_WIN_NR 3 |
45 | #define MIXER_DEFAULT_WIN 0 | 45 | #define MIXER_DEFAULT_WIN 0 |
46 | 46 | ||
47 | /* The pixelformats that are natively supported by the mixer. */ | ||
48 | #define MXR_FORMAT_RGB565 4 | ||
49 | #define MXR_FORMAT_ARGB1555 5 | ||
50 | #define MXR_FORMAT_ARGB4444 6 | ||
51 | #define MXR_FORMAT_ARGB8888 7 | ||
52 | |||
47 | struct mixer_resources { | 53 | struct mixer_resources { |
48 | int irq; | 54 | int irq; |
49 | void __iomem *mixer_regs; | 55 | void __iomem *mixer_regs; |
@@ -327,7 +333,8 @@ static void mixer_cfg_rgb_fmt(struct mixer_context *ctx, unsigned int height) | |||
327 | mixer_reg_writemask(res, MXR_CFG, val, MXR_CFG_RGB_FMT_MASK); | 333 | mixer_reg_writemask(res, MXR_CFG, val, MXR_CFG_RGB_FMT_MASK); |
328 | } | 334 | } |
329 | 335 | ||
330 | static void mixer_cfg_layer(struct mixer_context *ctx, int win, bool enable) | 336 | static void mixer_cfg_layer(struct mixer_context *ctx, unsigned int win, |
337 | bool enable) | ||
331 | { | 338 | { |
332 | struct mixer_resources *res = &ctx->mixer_res; | 339 | struct mixer_resources *res = &ctx->mixer_res; |
333 | u32 val = enable ? ~0 : 0; | 340 | u32 val = enable ? ~0 : 0; |
@@ -359,8 +366,6 @@ static void mixer_run(struct mixer_context *ctx) | |||
359 | struct mixer_resources *res = &ctx->mixer_res; | 366 | struct mixer_resources *res = &ctx->mixer_res; |
360 | 367 | ||
361 | mixer_reg_writemask(res, MXR_STATUS, ~0, MXR_STATUS_REG_RUN); | 368 | mixer_reg_writemask(res, MXR_STATUS, ~0, MXR_STATUS_REG_RUN); |
362 | |||
363 | mixer_regs_dump(ctx); | ||
364 | } | 369 | } |
365 | 370 | ||
366 | static void mixer_stop(struct mixer_context *ctx) | 371 | static void mixer_stop(struct mixer_context *ctx) |
@@ -373,16 +378,13 @@ static void mixer_stop(struct mixer_context *ctx) | |||
373 | while (!(mixer_reg_read(res, MXR_STATUS) & MXR_STATUS_REG_IDLE) && | 378 | while (!(mixer_reg_read(res, MXR_STATUS) & MXR_STATUS_REG_IDLE) && |
374 | --timeout) | 379 | --timeout) |
375 | usleep_range(10000, 12000); | 380 | usleep_range(10000, 12000); |
376 | |||
377 | mixer_regs_dump(ctx); | ||
378 | } | 381 | } |
379 | 382 | ||
380 | static void vp_video_buffer(struct mixer_context *ctx, int win) | 383 | static void vp_video_buffer(struct mixer_context *ctx, unsigned int win) |
381 | { | 384 | { |
382 | struct mixer_resources *res = &ctx->mixer_res; | 385 | struct mixer_resources *res = &ctx->mixer_res; |
383 | unsigned long flags; | 386 | unsigned long flags; |
384 | struct exynos_drm_plane *plane; | 387 | struct exynos_drm_plane *plane; |
385 | unsigned int buf_num = 1; | ||
386 | dma_addr_t luma_addr[2], chroma_addr[2]; | 388 | dma_addr_t luma_addr[2], chroma_addr[2]; |
387 | bool tiled_mode = false; | 389 | bool tiled_mode = false; |
388 | bool crcb_mode = false; | 390 | bool crcb_mode = false; |
@@ -393,27 +395,18 @@ static void vp_video_buffer(struct mixer_context *ctx, int win) | |||
393 | switch (plane->pixel_format) { | 395 | switch (plane->pixel_format) { |
394 | case DRM_FORMAT_NV12: | 396 | case DRM_FORMAT_NV12: |
395 | crcb_mode = false; | 397 | crcb_mode = false; |
396 | buf_num = 2; | ||
397 | break; | 398 | break; |
398 | /* TODO: single buffer format NV12, NV21 */ | 399 | case DRM_FORMAT_NV21: |
400 | crcb_mode = true; | ||
401 | break; | ||
399 | default: | 402 | default: |
400 | /* ignore pixel format at disable time */ | ||
401 | if (!plane->dma_addr[0]) | ||
402 | break; | ||
403 | |||
404 | DRM_ERROR("pixel format for vp is wrong [%d].\n", | 403 | DRM_ERROR("pixel format for vp is wrong [%d].\n", |
405 | plane->pixel_format); | 404 | plane->pixel_format); |
406 | return; | 405 | return; |
407 | } | 406 | } |
408 | 407 | ||
409 | if (buf_num == 2) { | 408 | luma_addr[0] = plane->dma_addr[0]; |
410 | luma_addr[0] = plane->dma_addr[0]; | 409 | chroma_addr[0] = plane->dma_addr[1]; |
411 | chroma_addr[0] = plane->dma_addr[1]; | ||
412 | } else { | ||
413 | luma_addr[0] = plane->dma_addr[0]; | ||
414 | chroma_addr[0] = plane->dma_addr[0] | ||
415 | + (plane->pitch * plane->fb_height); | ||
416 | } | ||
417 | 410 | ||
418 | if (plane->scan_flag & DRM_MODE_FLAG_INTERLACE) { | 411 | if (plane->scan_flag & DRM_MODE_FLAG_INTERLACE) { |
419 | ctx->interlace = true; | 412 | ctx->interlace = true; |
@@ -484,6 +477,7 @@ static void vp_video_buffer(struct mixer_context *ctx, int win) | |||
484 | mixer_vsync_set_update(ctx, true); | 477 | mixer_vsync_set_update(ctx, true); |
485 | spin_unlock_irqrestore(&res->reg_slock, flags); | 478 | spin_unlock_irqrestore(&res->reg_slock, flags); |
486 | 479 | ||
480 | mixer_regs_dump(ctx); | ||
487 | vp_regs_dump(ctx); | 481 | vp_regs_dump(ctx); |
488 | } | 482 | } |
489 | 483 | ||
@@ -518,7 +512,7 @@ fail: | |||
518 | return -ENOTSUPP; | 512 | return -ENOTSUPP; |
519 | } | 513 | } |
520 | 514 | ||
521 | static void mixer_graph_buffer(struct mixer_context *ctx, int win) | 515 | static void mixer_graph_buffer(struct mixer_context *ctx, unsigned int win) |
522 | { | 516 | { |
523 | struct mixer_resources *res = &ctx->mixer_res; | 517 | struct mixer_resources *res = &ctx->mixer_res; |
524 | unsigned long flags; | 518 | unsigned long flags; |
@@ -531,20 +525,27 @@ static void mixer_graph_buffer(struct mixer_context *ctx, int win) | |||
531 | 525 | ||
532 | plane = &ctx->planes[win]; | 526 | plane = &ctx->planes[win]; |
533 | 527 | ||
534 | #define RGB565 4 | 528 | switch (plane->pixel_format) { |
535 | #define ARGB1555 5 | 529 | case DRM_FORMAT_XRGB4444: |
536 | #define ARGB4444 6 | 530 | fmt = MXR_FORMAT_ARGB4444; |
537 | #define ARGB8888 7 | 531 | break; |
538 | 532 | ||
539 | switch (plane->bpp) { | 533 | case DRM_FORMAT_XRGB1555: |
540 | case 16: | 534 | fmt = MXR_FORMAT_ARGB1555; |
541 | fmt = ARGB4444; | ||
542 | break; | 535 | break; |
543 | case 32: | 536 | |
544 | fmt = ARGB8888; | 537 | case DRM_FORMAT_RGB565: |
538 | fmt = MXR_FORMAT_RGB565; | ||
539 | break; | ||
540 | |||
541 | case DRM_FORMAT_XRGB8888: | ||
542 | case DRM_FORMAT_ARGB8888: | ||
543 | fmt = MXR_FORMAT_ARGB8888; | ||
545 | break; | 544 | break; |
545 | |||
546 | default: | 546 | default: |
547 | fmt = ARGB8888; | 547 | DRM_DEBUG_KMS("pixelformat unsupported by mixer\n"); |
548 | return; | ||
548 | } | 549 | } |
549 | 550 | ||
550 | /* check if mixer supports requested scaling setup */ | 551 | /* check if mixer supports requested scaling setup */ |
@@ -617,6 +618,8 @@ static void mixer_graph_buffer(struct mixer_context *ctx, int win) | |||
617 | 618 | ||
618 | mixer_vsync_set_update(ctx, true); | 619 | mixer_vsync_set_update(ctx, true); |
619 | spin_unlock_irqrestore(&res->reg_slock, flags); | 620 | spin_unlock_irqrestore(&res->reg_slock, flags); |
621 | |||
622 | mixer_regs_dump(ctx); | ||
620 | } | 623 | } |
621 | 624 | ||
622 | static void vp_win_reset(struct mixer_context *ctx) | 625 | static void vp_win_reset(struct mixer_context *ctx) |
@@ -1070,6 +1073,7 @@ static void mixer_poweroff(struct mixer_context *ctx) | |||
1070 | mutex_unlock(&ctx->mixer_mutex); | 1073 | mutex_unlock(&ctx->mixer_mutex); |
1071 | 1074 | ||
1072 | mixer_stop(ctx); | 1075 | mixer_stop(ctx); |
1076 | mixer_regs_dump(ctx); | ||
1073 | mixer_window_suspend(ctx); | 1077 | mixer_window_suspend(ctx); |
1074 | 1078 | ||
1075 | ctx->int_en = mixer_reg_read(res, MXR_INT_EN); | 1079 | ctx->int_en = mixer_reg_read(res, MXR_INT_EN); |
@@ -1126,7 +1130,7 @@ int mixer_check_mode(struct drm_display_mode *mode) | |||
1126 | return -EINVAL; | 1130 | return -EINVAL; |
1127 | } | 1131 | } |
1128 | 1132 | ||
1129 | static struct exynos_drm_crtc_ops mixer_crtc_ops = { | 1133 | static const struct exynos_drm_crtc_ops mixer_crtc_ops = { |
1130 | .dpms = mixer_dpms, | 1134 | .dpms = mixer_dpms, |
1131 | .enable_vblank = mixer_enable_vblank, | 1135 | .enable_vblank = mixer_enable_vblank, |
1132 | .disable_vblank = mixer_disable_vblank, | 1136 | .disable_vblank = mixer_disable_vblank, |
@@ -1156,7 +1160,7 @@ static struct mixer_drv_data exynos4210_mxr_drv_data = { | |||
1156 | .has_sclk = 1, | 1160 | .has_sclk = 1, |
1157 | }; | 1161 | }; |
1158 | 1162 | ||
1159 | static struct platform_device_id mixer_driver_types[] = { | 1163 | static const struct platform_device_id mixer_driver_types[] = { |
1160 | { | 1164 | { |
1161 | .name = "s5p-mixer", | 1165 | .name = "s5p-mixer", |
1162 | .driver_data = (unsigned long)&exynos4210_mxr_drv_data, | 1166 | .driver_data = (unsigned long)&exynos4210_mxr_drv_data, |
diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c index c302ffb5a168..a19d2c71e205 100644 --- a/drivers/gpu/drm/i915/i915_drv.c +++ b/drivers/gpu/drm/i915/i915_drv.c | |||
@@ -699,6 +699,16 @@ static int i915_drm_resume(struct drm_device *dev) | |||
699 | intel_init_pch_refclk(dev); | 699 | intel_init_pch_refclk(dev); |
700 | drm_mode_config_reset(dev); | 700 | drm_mode_config_reset(dev); |
701 | 701 | ||
702 | /* | ||
703 | * Interrupts have to be enabled before any batches are run. If not the | ||
704 | * GPU will hang. i915_gem_init_hw() will initiate batches to | ||
705 | * update/restore the context. | ||
706 | * | ||
707 | * Modeset enabling in intel_modeset_init_hw() also needs working | ||
708 | * interrupts. | ||
709 | */ | ||
710 | intel_runtime_pm_enable_interrupts(dev_priv); | ||
711 | |||
702 | mutex_lock(&dev->struct_mutex); | 712 | mutex_lock(&dev->struct_mutex); |
703 | if (i915_gem_init_hw(dev)) { | 713 | if (i915_gem_init_hw(dev)) { |
704 | DRM_ERROR("failed to re-initialize GPU, declaring wedged!\n"); | 714 | DRM_ERROR("failed to re-initialize GPU, declaring wedged!\n"); |
@@ -706,9 +716,6 @@ static int i915_drm_resume(struct drm_device *dev) | |||
706 | } | 716 | } |
707 | mutex_unlock(&dev->struct_mutex); | 717 | mutex_unlock(&dev->struct_mutex); |
708 | 718 | ||
709 | /* We need working interrupts for modeset enabling ... */ | ||
710 | intel_runtime_pm_enable_interrupts(dev_priv); | ||
711 | |||
712 | intel_modeset_init_hw(dev); | 719 | intel_modeset_init_hw(dev); |
713 | 720 | ||
714 | spin_lock_irq(&dev_priv->irq_lock); | 721 | spin_lock_irq(&dev_priv->irq_lock); |
diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c index fa4ccb346389..555b896d2bda 100644 --- a/drivers/gpu/drm/i915/intel_pm.c +++ b/drivers/gpu/drm/i915/intel_pm.c | |||
@@ -2045,22 +2045,20 @@ static void ilk_compute_wm_parameters(struct drm_crtc *crtc, | |||
2045 | p->pipe_htotal = intel_crtc->config->base.adjusted_mode.crtc_htotal; | 2045 | p->pipe_htotal = intel_crtc->config->base.adjusted_mode.crtc_htotal; |
2046 | p->pixel_rate = ilk_pipe_pixel_rate(dev, crtc); | 2046 | p->pixel_rate = ilk_pipe_pixel_rate(dev, crtc); |
2047 | 2047 | ||
2048 | if (crtc->primary->state->fb) { | 2048 | if (crtc->primary->state->fb) |
2049 | p->pri.enabled = true; | ||
2050 | p->pri.bytes_per_pixel = | 2049 | p->pri.bytes_per_pixel = |
2051 | crtc->primary->state->fb->bits_per_pixel / 8; | 2050 | crtc->primary->state->fb->bits_per_pixel / 8; |
2052 | } else { | 2051 | else |
2053 | p->pri.enabled = false; | 2052 | p->pri.bytes_per_pixel = 4; |
2054 | p->pri.bytes_per_pixel = 0; | 2053 | |
2055 | } | 2054 | p->cur.bytes_per_pixel = 4; |
2055 | /* | ||
2056 | * TODO: for now, assume primary and cursor planes are always enabled. | ||
2057 | * Setting them to false makes the screen flicker. | ||
2058 | */ | ||
2059 | p->pri.enabled = true; | ||
2060 | p->cur.enabled = true; | ||
2056 | 2061 | ||
2057 | if (crtc->cursor->state->fb) { | ||
2058 | p->cur.enabled = true; | ||
2059 | p->cur.bytes_per_pixel = 4; | ||
2060 | } else { | ||
2061 | p->cur.enabled = false; | ||
2062 | p->cur.bytes_per_pixel = 0; | ||
2063 | } | ||
2064 | p->pri.horiz_pixels = intel_crtc->config->pipe_src_w; | 2062 | p->pri.horiz_pixels = intel_crtc->config->pipe_src_w; |
2065 | p->cur.horiz_pixels = intel_crtc->base.cursor->state->crtc_w; | 2063 | p->cur.horiz_pixels = intel_crtc->base.cursor->state->crtc_w; |
2066 | 2064 | ||
diff --git a/drivers/gpu/drm/msm/adreno/adreno_gpu.c b/drivers/gpu/drm/msm/adreno/adreno_gpu.c index 94a5bee69fe7..bbdcab0a56c1 100644 --- a/drivers/gpu/drm/msm/adreno/adreno_gpu.c +++ b/drivers/gpu/drm/msm/adreno/adreno_gpu.c | |||
@@ -384,7 +384,7 @@ void adreno_gpu_cleanup(struct adreno_gpu *gpu) | |||
384 | if (gpu->memptrs_bo) { | 384 | if (gpu->memptrs_bo) { |
385 | if (gpu->memptrs_iova) | 385 | if (gpu->memptrs_iova) |
386 | msm_gem_put_iova(gpu->memptrs_bo, gpu->base.id); | 386 | msm_gem_put_iova(gpu->memptrs_bo, gpu->base.id); |
387 | drm_gem_object_unreference(gpu->memptrs_bo); | 387 | drm_gem_object_unreference_unlocked(gpu->memptrs_bo); |
388 | } | 388 | } |
389 | release_firmware(gpu->pm4); | 389 | release_firmware(gpu->pm4); |
390 | release_firmware(gpu->pfp); | 390 | release_firmware(gpu->pfp); |
diff --git a/drivers/gpu/drm/msm/dsi/dsi.c b/drivers/gpu/drm/msm/dsi/dsi.c index 28d1f95a90cc..ad50b80225f5 100644 --- a/drivers/gpu/drm/msm/dsi/dsi.c +++ b/drivers/gpu/drm/msm/dsi/dsi.c | |||
@@ -177,6 +177,11 @@ int msm_dsi_modeset_init(struct msm_dsi *msm_dsi, struct drm_device *dev, | |||
177 | goto fail; | 177 | goto fail; |
178 | } | 178 | } |
179 | 179 | ||
180 | for (i = 0; i < MSM_DSI_ENCODER_NUM; i++) { | ||
181 | encoders[i]->bridge = msm_dsi->bridge; | ||
182 | msm_dsi->encoders[i] = encoders[i]; | ||
183 | } | ||
184 | |||
180 | msm_dsi->connector = msm_dsi_manager_connector_init(msm_dsi->id); | 185 | msm_dsi->connector = msm_dsi_manager_connector_init(msm_dsi->id); |
181 | if (IS_ERR(msm_dsi->connector)) { | 186 | if (IS_ERR(msm_dsi->connector)) { |
182 | ret = PTR_ERR(msm_dsi->connector); | 187 | ret = PTR_ERR(msm_dsi->connector); |
@@ -185,11 +190,6 @@ int msm_dsi_modeset_init(struct msm_dsi *msm_dsi, struct drm_device *dev, | |||
185 | goto fail; | 190 | goto fail; |
186 | } | 191 | } |
187 | 192 | ||
188 | for (i = 0; i < MSM_DSI_ENCODER_NUM; i++) { | ||
189 | encoders[i]->bridge = msm_dsi->bridge; | ||
190 | msm_dsi->encoders[i] = encoders[i]; | ||
191 | } | ||
192 | |||
193 | priv->bridges[priv->num_bridges++] = msm_dsi->bridge; | 193 | priv->bridges[priv->num_bridges++] = msm_dsi->bridge; |
194 | priv->connectors[priv->num_connectors++] = msm_dsi->connector; | 194 | priv->connectors[priv->num_connectors++] = msm_dsi->connector; |
195 | 195 | ||
diff --git a/drivers/gpu/drm/msm/dsi/dsi_host.c b/drivers/gpu/drm/msm/dsi/dsi_host.c index 956b22492c9a..649d20d29f92 100644 --- a/drivers/gpu/drm/msm/dsi/dsi_host.c +++ b/drivers/gpu/drm/msm/dsi/dsi_host.c | |||
@@ -1023,7 +1023,7 @@ static int dsi_short_read1_resp(u8 *buf, const struct mipi_dsi_msg *msg) | |||
1023 | *data = buf[1]; /* strip out dcs type */ | 1023 | *data = buf[1]; /* strip out dcs type */ |
1024 | return 1; | 1024 | return 1; |
1025 | } else { | 1025 | } else { |
1026 | pr_err("%s: read data does not match with rx_buf len %d\n", | 1026 | pr_err("%s: read data does not match with rx_buf len %zu\n", |
1027 | __func__, msg->rx_len); | 1027 | __func__, msg->rx_len); |
1028 | return -EINVAL; | 1028 | return -EINVAL; |
1029 | } | 1029 | } |
@@ -1040,7 +1040,7 @@ static int dsi_short_read2_resp(u8 *buf, const struct mipi_dsi_msg *msg) | |||
1040 | data[1] = buf[2]; | 1040 | data[1] = buf[2]; |
1041 | return 2; | 1041 | return 2; |
1042 | } else { | 1042 | } else { |
1043 | pr_err("%s: read data does not match with rx_buf len %d\n", | 1043 | pr_err("%s: read data does not match with rx_buf len %zu\n", |
1044 | __func__, msg->rx_len); | 1044 | __func__, msg->rx_len); |
1045 | return -EINVAL; | 1045 | return -EINVAL; |
1046 | } | 1046 | } |
@@ -1093,7 +1093,6 @@ static int dsi_cmd_dma_rx(struct msm_dsi_host *msm_host, | |||
1093 | { | 1093 | { |
1094 | u32 *lp, *temp, data; | 1094 | u32 *lp, *temp, data; |
1095 | int i, j = 0, cnt; | 1095 | int i, j = 0, cnt; |
1096 | bool ack_error = false; | ||
1097 | u32 read_cnt; | 1096 | u32 read_cnt; |
1098 | u8 reg[16]; | 1097 | u8 reg[16]; |
1099 | int repeated_bytes = 0; | 1098 | int repeated_bytes = 0; |
@@ -1105,15 +1104,10 @@ static int dsi_cmd_dma_rx(struct msm_dsi_host *msm_host, | |||
1105 | if (cnt > 4) | 1104 | if (cnt > 4) |
1106 | cnt = 4; /* 4 x 32 bits registers only */ | 1105 | cnt = 4; /* 4 x 32 bits registers only */ |
1107 | 1106 | ||
1108 | /* Calculate real read data count */ | 1107 | if (rx_byte == 4) |
1109 | read_cnt = dsi_read(msm_host, 0x1d4) >> 16; | 1108 | read_cnt = 4; |
1110 | 1109 | else | |
1111 | ack_error = (rx_byte == 4) ? | 1110 | read_cnt = pkt_size + 6; |
1112 | (read_cnt == 8) : /* short pkt + 4-byte error pkt */ | ||
1113 | (read_cnt == (pkt_size + 6 + 4)); /* long pkt+4-byte error pkt*/ | ||
1114 | |||
1115 | if (ack_error) | ||
1116 | read_cnt -= 4; /* Remove 4 byte error pkt */ | ||
1117 | 1111 | ||
1118 | /* | 1112 | /* |
1119 | * In case of multiple reads from the panel, after the first read, there | 1113 | * In case of multiple reads from the panel, after the first read, there |
@@ -1215,7 +1209,7 @@ static void dsi_err_worker(struct work_struct *work) | |||
1215 | container_of(work, struct msm_dsi_host, err_work); | 1209 | container_of(work, struct msm_dsi_host, err_work); |
1216 | u32 status = msm_host->err_work_state; | 1210 | u32 status = msm_host->err_work_state; |
1217 | 1211 | ||
1218 | pr_err("%s: status=%x\n", __func__, status); | 1212 | pr_err_ratelimited("%s: status=%x\n", __func__, status); |
1219 | if (status & DSI_ERR_STATE_MDP_FIFO_UNDERFLOW) | 1213 | if (status & DSI_ERR_STATE_MDP_FIFO_UNDERFLOW) |
1220 | dsi_sw_reset_restore(msm_host); | 1214 | dsi_sw_reset_restore(msm_host); |
1221 | 1215 | ||
@@ -1797,6 +1791,7 @@ int msm_dsi_host_cmd_rx(struct mipi_dsi_host *host, | |||
1797 | case MIPI_DSI_RX_ACKNOWLEDGE_AND_ERROR_REPORT: | 1791 | case MIPI_DSI_RX_ACKNOWLEDGE_AND_ERROR_REPORT: |
1798 | pr_err("%s: rx ACK_ERR_PACLAGE\n", __func__); | 1792 | pr_err("%s: rx ACK_ERR_PACLAGE\n", __func__); |
1799 | ret = 0; | 1793 | ret = 0; |
1794 | break; | ||
1800 | case MIPI_DSI_RX_GENERIC_SHORT_READ_RESPONSE_1BYTE: | 1795 | case MIPI_DSI_RX_GENERIC_SHORT_READ_RESPONSE_1BYTE: |
1801 | case MIPI_DSI_RX_DCS_SHORT_READ_RESPONSE_1BYTE: | 1796 | case MIPI_DSI_RX_DCS_SHORT_READ_RESPONSE_1BYTE: |
1802 | ret = dsi_short_read1_resp(buf, msg); | 1797 | ret = dsi_short_read1_resp(buf, msg); |
diff --git a/drivers/gpu/drm/msm/dsi/dsi_manager.c b/drivers/gpu/drm/msm/dsi/dsi_manager.c index ee3ebcaa33f5..0a40f3c64e8b 100644 --- a/drivers/gpu/drm/msm/dsi/dsi_manager.c +++ b/drivers/gpu/drm/msm/dsi/dsi_manager.c | |||
@@ -462,7 +462,7 @@ struct drm_connector *msm_dsi_manager_connector_init(u8 id) | |||
462 | struct msm_dsi *msm_dsi = dsi_mgr_get_dsi(id); | 462 | struct msm_dsi *msm_dsi = dsi_mgr_get_dsi(id); |
463 | struct drm_connector *connector = NULL; | 463 | struct drm_connector *connector = NULL; |
464 | struct dsi_connector *dsi_connector; | 464 | struct dsi_connector *dsi_connector; |
465 | int ret; | 465 | int ret, i; |
466 | 466 | ||
467 | dsi_connector = devm_kzalloc(msm_dsi->dev->dev, | 467 | dsi_connector = devm_kzalloc(msm_dsi->dev->dev, |
468 | sizeof(*dsi_connector), GFP_KERNEL); | 468 | sizeof(*dsi_connector), GFP_KERNEL); |
@@ -495,6 +495,10 @@ struct drm_connector *msm_dsi_manager_connector_init(u8 id) | |||
495 | if (ret) | 495 | if (ret) |
496 | goto fail; | 496 | goto fail; |
497 | 497 | ||
498 | for (i = 0; i < MSM_DSI_ENCODER_NUM; i++) | ||
499 | drm_mode_connector_attach_encoder(connector, | ||
500 | msm_dsi->encoders[i]); | ||
501 | |||
498 | return connector; | 502 | return connector; |
499 | 503 | ||
500 | fail: | 504 | fail: |
diff --git a/drivers/gpu/drm/msm/edp/edp_aux.c b/drivers/gpu/drm/msm/edp/edp_aux.c index 5f5a84f6074c..208f9d47f82e 100644 --- a/drivers/gpu/drm/msm/edp/edp_aux.c +++ b/drivers/gpu/drm/msm/edp/edp_aux.c | |||
@@ -132,7 +132,7 @@ ssize_t edp_aux_transfer(struct drm_dp_aux *drm_aux, struct drm_dp_aux_msg *msg) | |||
132 | /* msg sanity check */ | 132 | /* msg sanity check */ |
133 | if ((native && (msg->size > AUX_CMD_NATIVE_MAX)) || | 133 | if ((native && (msg->size > AUX_CMD_NATIVE_MAX)) || |
134 | (msg->size > AUX_CMD_I2C_MAX)) { | 134 | (msg->size > AUX_CMD_I2C_MAX)) { |
135 | pr_err("%s: invalid msg: size(%d), request(%x)\n", | 135 | pr_err("%s: invalid msg: size(%zu), request(%x)\n", |
136 | __func__, msg->size, msg->request); | 136 | __func__, msg->size, msg->request); |
137 | return -EINVAL; | 137 | return -EINVAL; |
138 | } | 138 | } |
@@ -155,7 +155,7 @@ ssize_t edp_aux_transfer(struct drm_dp_aux *drm_aux, struct drm_dp_aux_msg *msg) | |||
155 | */ | 155 | */ |
156 | edp_write(aux->base + REG_EDP_AUX_TRANS_CTRL, 0); | 156 | edp_write(aux->base + REG_EDP_AUX_TRANS_CTRL, 0); |
157 | msm_edp_aux_ctrl(aux, 1); | 157 | msm_edp_aux_ctrl(aux, 1); |
158 | pr_err("%s: aux timeout, %d\n", __func__, ret); | 158 | pr_err("%s: aux timeout, %zd\n", __func__, ret); |
159 | goto unlock_exit; | 159 | goto unlock_exit; |
160 | } | 160 | } |
161 | DBG("completion"); | 161 | DBG("completion"); |
diff --git a/drivers/gpu/drm/msm/edp/edp_connector.c b/drivers/gpu/drm/msm/edp/edp_connector.c index d8812e84da54..b4d1b469862a 100644 --- a/drivers/gpu/drm/msm/edp/edp_connector.c +++ b/drivers/gpu/drm/msm/edp/edp_connector.c | |||
@@ -151,6 +151,8 @@ struct drm_connector *msm_edp_connector_init(struct msm_edp *edp) | |||
151 | if (ret) | 151 | if (ret) |
152 | goto fail; | 152 | goto fail; |
153 | 153 | ||
154 | drm_mode_connector_attach_encoder(connector, edp->encoder); | ||
155 | |||
154 | return connector; | 156 | return connector; |
155 | 157 | ||
156 | fail: | 158 | fail: |
diff --git a/drivers/gpu/drm/msm/edp/edp_ctrl.c b/drivers/gpu/drm/msm/edp/edp_ctrl.c index 0ec5abdba5c4..29e52d7c61c0 100644 --- a/drivers/gpu/drm/msm/edp/edp_ctrl.c +++ b/drivers/gpu/drm/msm/edp/edp_ctrl.c | |||
@@ -1149,12 +1149,13 @@ int msm_edp_ctrl_init(struct msm_edp *edp) | |||
1149 | ctrl->aux = msm_edp_aux_init(dev, ctrl->base, &ctrl->drm_aux); | 1149 | ctrl->aux = msm_edp_aux_init(dev, ctrl->base, &ctrl->drm_aux); |
1150 | if (!ctrl->aux || !ctrl->drm_aux) { | 1150 | if (!ctrl->aux || !ctrl->drm_aux) { |
1151 | pr_err("%s:failed to init aux\n", __func__); | 1151 | pr_err("%s:failed to init aux\n", __func__); |
1152 | return ret; | 1152 | return -ENOMEM; |
1153 | } | 1153 | } |
1154 | 1154 | ||
1155 | ctrl->phy = msm_edp_phy_init(dev, ctrl->base); | 1155 | ctrl->phy = msm_edp_phy_init(dev, ctrl->base); |
1156 | if (!ctrl->phy) { | 1156 | if (!ctrl->phy) { |
1157 | pr_err("%s:failed to init phy\n", __func__); | 1157 | pr_err("%s:failed to init phy\n", __func__); |
1158 | ret = -ENOMEM; | ||
1158 | goto err_destory_aux; | 1159 | goto err_destory_aux; |
1159 | } | 1160 | } |
1160 | 1161 | ||
diff --git a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_cfg.c b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_cfg.c index e001e6b2296a..8b9a7931b162 100644 --- a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_cfg.c +++ b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_cfg.c | |||
@@ -72,14 +72,13 @@ const struct mdp5_cfg_hw msm8x74_config = { | |||
72 | .base = { 0x12d00, 0x12e00, 0x12f00 }, | 72 | .base = { 0x12d00, 0x12e00, 0x12f00 }, |
73 | }, | 73 | }, |
74 | .intf = { | 74 | .intf = { |
75 | .count = 4, | ||
76 | .base = { 0x12500, 0x12700, 0x12900, 0x12b00 }, | 75 | .base = { 0x12500, 0x12700, 0x12900, 0x12b00 }, |
77 | }, | 76 | .connect = { |
78 | .intfs = { | 77 | [0] = INTF_eDP, |
79 | [0] = INTF_eDP, | 78 | [1] = INTF_DSI, |
80 | [1] = INTF_DSI, | 79 | [2] = INTF_DSI, |
81 | [2] = INTF_DSI, | 80 | [3] = INTF_HDMI, |
82 | [3] = INTF_HDMI, | 81 | }, |
83 | }, | 82 | }, |
84 | .max_clk = 200000000, | 83 | .max_clk = 200000000, |
85 | }; | 84 | }; |
@@ -142,14 +141,13 @@ const struct mdp5_cfg_hw apq8084_config = { | |||
142 | .base = { 0x12f00, 0x13000, 0x13100, 0x13200 }, | 141 | .base = { 0x12f00, 0x13000, 0x13100, 0x13200 }, |
143 | }, | 142 | }, |
144 | .intf = { | 143 | .intf = { |
145 | .count = 5, | ||
146 | .base = { 0x12500, 0x12700, 0x12900, 0x12b00, 0x12d00 }, | 144 | .base = { 0x12500, 0x12700, 0x12900, 0x12b00, 0x12d00 }, |
147 | }, | 145 | .connect = { |
148 | .intfs = { | 146 | [0] = INTF_eDP, |
149 | [0] = INTF_eDP, | 147 | [1] = INTF_DSI, |
150 | [1] = INTF_DSI, | 148 | [2] = INTF_DSI, |
151 | [2] = INTF_DSI, | 149 | [3] = INTF_HDMI, |
152 | [3] = INTF_HDMI, | 150 | }, |
153 | }, | 151 | }, |
154 | .max_clk = 320000000, | 152 | .max_clk = 320000000, |
155 | }; | 153 | }; |
@@ -196,10 +194,12 @@ const struct mdp5_cfg_hw msm8x16_config = { | |||
196 | 194 | ||
197 | }, | 195 | }, |
198 | .intf = { | 196 | .intf = { |
199 | .count = 1, /* INTF_1 */ | 197 | .base = { 0x00000, 0x6b800 }, |
200 | .base = { 0x6B800 }, | 198 | .connect = { |
199 | [0] = INTF_DISABLED, | ||
200 | [1] = INTF_DSI, | ||
201 | }, | ||
201 | }, | 202 | }, |
202 | /* TODO enable .intfs[] with [1] = INTF_DSI, once DSI is implemented */ | ||
203 | .max_clk = 320000000, | 203 | .max_clk = 320000000, |
204 | }; | 204 | }; |
205 | 205 | ||
diff --git a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_cfg.h b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_cfg.h index 3a551b0892d8..69349abe59f2 100644 --- a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_cfg.h +++ b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_cfg.h | |||
@@ -59,6 +59,11 @@ struct mdp5_smp_block { | |||
59 | 59 | ||
60 | #define MDP5_INTF_NUM_MAX 5 | 60 | #define MDP5_INTF_NUM_MAX 5 |
61 | 61 | ||
62 | struct mdp5_intf_block { | ||
63 | uint32_t base[MAX_BASES]; | ||
64 | u32 connect[MDP5_INTF_NUM_MAX]; /* array of enum mdp5_intf_type */ | ||
65 | }; | ||
66 | |||
62 | struct mdp5_cfg_hw { | 67 | struct mdp5_cfg_hw { |
63 | char *name; | 68 | char *name; |
64 | 69 | ||
@@ -72,9 +77,7 @@ struct mdp5_cfg_hw { | |||
72 | struct mdp5_sub_block dspp; | 77 | struct mdp5_sub_block dspp; |
73 | struct mdp5_sub_block ad; | 78 | struct mdp5_sub_block ad; |
74 | struct mdp5_sub_block pp; | 79 | struct mdp5_sub_block pp; |
75 | struct mdp5_sub_block intf; | 80 | struct mdp5_intf_block intf; |
76 | |||
77 | u32 intfs[MDP5_INTF_NUM_MAX]; /* array of enum mdp5_intf_type */ | ||
78 | 81 | ||
79 | uint32_t max_clk; | 82 | uint32_t max_clk; |
80 | }; | 83 | }; |
diff --git a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c index dfa8beb9343a..bbacf9d2b738 100644 --- a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c +++ b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c | |||
@@ -206,8 +206,8 @@ static struct drm_encoder *construct_encoder(struct mdp5_kms *mdp5_kms, | |||
206 | 206 | ||
207 | static int get_dsi_id_from_intf(const struct mdp5_cfg_hw *hw_cfg, int intf_num) | 207 | static int get_dsi_id_from_intf(const struct mdp5_cfg_hw *hw_cfg, int intf_num) |
208 | { | 208 | { |
209 | const int intf_cnt = hw_cfg->intf.count; | 209 | const enum mdp5_intf_type *intfs = hw_cfg->intf.connect; |
210 | const u32 *intfs = hw_cfg->intfs; | 210 | const int intf_cnt = ARRAY_SIZE(hw_cfg->intf.connect); |
211 | int id = 0, i; | 211 | int id = 0, i; |
212 | 212 | ||
213 | for (i = 0; i < intf_cnt; i++) { | 213 | for (i = 0; i < intf_cnt; i++) { |
@@ -228,7 +228,7 @@ static int modeset_init_intf(struct mdp5_kms *mdp5_kms, int intf_num) | |||
228 | struct msm_drm_private *priv = dev->dev_private; | 228 | struct msm_drm_private *priv = dev->dev_private; |
229 | const struct mdp5_cfg_hw *hw_cfg = | 229 | const struct mdp5_cfg_hw *hw_cfg = |
230 | mdp5_cfg_get_hw_config(mdp5_kms->cfg); | 230 | mdp5_cfg_get_hw_config(mdp5_kms->cfg); |
231 | enum mdp5_intf_type intf_type = hw_cfg->intfs[intf_num]; | 231 | enum mdp5_intf_type intf_type = hw_cfg->intf.connect[intf_num]; |
232 | struct drm_encoder *encoder; | 232 | struct drm_encoder *encoder; |
233 | int ret = 0; | 233 | int ret = 0; |
234 | 234 | ||
@@ -365,7 +365,7 @@ static int modeset_init(struct mdp5_kms *mdp5_kms) | |||
365 | /* Construct encoders and modeset initialize connector devices | 365 | /* Construct encoders and modeset initialize connector devices |
366 | * for each external display interface. | 366 | * for each external display interface. |
367 | */ | 367 | */ |
368 | for (i = 0; i < ARRAY_SIZE(hw_cfg->intfs); i++) { | 368 | for (i = 0; i < ARRAY_SIZE(hw_cfg->intf.connect); i++) { |
369 | ret = modeset_init_intf(mdp5_kms, i); | 369 | ret = modeset_init_intf(mdp5_kms, i); |
370 | if (ret) | 370 | if (ret) |
371 | goto fail; | 371 | goto fail; |
@@ -514,8 +514,8 @@ struct msm_kms *mdp5_kms_init(struct drm_device *dev) | |||
514 | */ | 514 | */ |
515 | mdp5_enable(mdp5_kms); | 515 | mdp5_enable(mdp5_kms); |
516 | for (i = 0; i < MDP5_INTF_NUM_MAX; i++) { | 516 | for (i = 0; i < MDP5_INTF_NUM_MAX; i++) { |
517 | if (!config->hw->intf.base[i] || | 517 | if (mdp5_cfg_intf_is_virtual(config->hw->intf.connect[i]) || |
518 | mdp5_cfg_intf_is_virtual(config->hw->intfs[i])) | 518 | !config->hw->intf.base[i]) |
519 | continue; | 519 | continue; |
520 | mdp5_write(mdp5_kms, REG_MDP5_INTF_TIMING_ENGINE_EN(i), 0); | 520 | mdp5_write(mdp5_kms, REG_MDP5_INTF_TIMING_ENGINE_EN(i), 0); |
521 | } | 521 | } |
diff --git a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c index 18a3d203b174..57b8f56ae9d0 100644 --- a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c +++ b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c | |||
@@ -273,7 +273,7 @@ static void set_scanout_locked(struct drm_plane *plane, | |||
273 | mdp5_write(mdp5_kms, REG_MDP5_PIPE_SRC2_ADDR(pipe), | 273 | mdp5_write(mdp5_kms, REG_MDP5_PIPE_SRC2_ADDR(pipe), |
274 | msm_framebuffer_iova(fb, mdp5_kms->id, 2)); | 274 | msm_framebuffer_iova(fb, mdp5_kms->id, 2)); |
275 | mdp5_write(mdp5_kms, REG_MDP5_PIPE_SRC3_ADDR(pipe), | 275 | mdp5_write(mdp5_kms, REG_MDP5_PIPE_SRC3_ADDR(pipe), |
276 | msm_framebuffer_iova(fb, mdp5_kms->id, 4)); | 276 | msm_framebuffer_iova(fb, mdp5_kms->id, 3)); |
277 | 277 | ||
278 | plane->fb = fb; | 278 | plane->fb = fb; |
279 | } | 279 | } |
diff --git a/drivers/gpu/drm/msm/msm_drv.c b/drivers/gpu/drm/msm/msm_drv.c index 47f4dd407671..c80a6bee2b18 100644 --- a/drivers/gpu/drm/msm/msm_drv.c +++ b/drivers/gpu/drm/msm/msm_drv.c | |||
@@ -21,9 +21,11 @@ | |||
21 | 21 | ||
22 | static void msm_fb_output_poll_changed(struct drm_device *dev) | 22 | static void msm_fb_output_poll_changed(struct drm_device *dev) |
23 | { | 23 | { |
24 | #ifdef CONFIG_DRM_MSM_FBDEV | ||
24 | struct msm_drm_private *priv = dev->dev_private; | 25 | struct msm_drm_private *priv = dev->dev_private; |
25 | if (priv->fbdev) | 26 | if (priv->fbdev) |
26 | drm_fb_helper_hotplug_event(priv->fbdev); | 27 | drm_fb_helper_hotplug_event(priv->fbdev); |
28 | #endif | ||
27 | } | 29 | } |
28 | 30 | ||
29 | static const struct drm_mode_config_funcs mode_config_funcs = { | 31 | static const struct drm_mode_config_funcs mode_config_funcs = { |
@@ -94,7 +96,7 @@ void __iomem *msm_ioremap(struct platform_device *pdev, const char *name, | |||
94 | } | 96 | } |
95 | 97 | ||
96 | if (reglog) | 98 | if (reglog) |
97 | printk(KERN_DEBUG "IO:region %s %08x %08lx\n", dbgname, (u32)ptr, size); | 99 | printk(KERN_DEBUG "IO:region %s %p %08lx\n", dbgname, ptr, size); |
98 | 100 | ||
99 | return ptr; | 101 | return ptr; |
100 | } | 102 | } |
@@ -102,7 +104,7 @@ void __iomem *msm_ioremap(struct platform_device *pdev, const char *name, | |||
102 | void msm_writel(u32 data, void __iomem *addr) | 104 | void msm_writel(u32 data, void __iomem *addr) |
103 | { | 105 | { |
104 | if (reglog) | 106 | if (reglog) |
105 | printk(KERN_DEBUG "IO:W %08x %08x\n", (u32)addr, data); | 107 | printk(KERN_DEBUG "IO:W %p %08x\n", addr, data); |
106 | writel(data, addr); | 108 | writel(data, addr); |
107 | } | 109 | } |
108 | 110 | ||
@@ -110,7 +112,7 @@ u32 msm_readl(const void __iomem *addr) | |||
110 | { | 112 | { |
111 | u32 val = readl(addr); | 113 | u32 val = readl(addr); |
112 | if (reglog) | 114 | if (reglog) |
113 | printk(KERN_ERR "IO:R %08x %08x\n", (u32)addr, val); | 115 | printk(KERN_ERR "IO:R %p %08x\n", addr, val); |
114 | return val; | 116 | return val; |
115 | } | 117 | } |
116 | 118 | ||
@@ -143,8 +145,8 @@ static int msm_unload(struct drm_device *dev) | |||
143 | if (gpu) { | 145 | if (gpu) { |
144 | mutex_lock(&dev->struct_mutex); | 146 | mutex_lock(&dev->struct_mutex); |
145 | gpu->funcs->pm_suspend(gpu); | 147 | gpu->funcs->pm_suspend(gpu); |
146 | gpu->funcs->destroy(gpu); | ||
147 | mutex_unlock(&dev->struct_mutex); | 148 | mutex_unlock(&dev->struct_mutex); |
149 | gpu->funcs->destroy(gpu); | ||
148 | } | 150 | } |
149 | 151 | ||
150 | if (priv->vram.paddr) { | 152 | if (priv->vram.paddr) { |
@@ -177,7 +179,7 @@ static int get_mdp_ver(struct platform_device *pdev) | |||
177 | const struct of_device_id *match; | 179 | const struct of_device_id *match; |
178 | match = of_match_node(match_types, dev->of_node); | 180 | match = of_match_node(match_types, dev->of_node); |
179 | if (match) | 181 | if (match) |
180 | return (int)match->data; | 182 | return (int)(unsigned long)match->data; |
181 | #endif | 183 | #endif |
182 | return 4; | 184 | return 4; |
183 | } | 185 | } |
@@ -216,7 +218,7 @@ static int msm_init_vram(struct drm_device *dev) | |||
216 | if (ret) | 218 | if (ret) |
217 | return ret; | 219 | return ret; |
218 | size = r.end - r.start; | 220 | size = r.end - r.start; |
219 | DRM_INFO("using VRAM carveout: %lx@%08x\n", size, r.start); | 221 | DRM_INFO("using VRAM carveout: %lx@%pa\n", size, &r.start); |
220 | } else | 222 | } else |
221 | #endif | 223 | #endif |
222 | 224 | ||
@@ -283,10 +285,6 @@ static int msm_load(struct drm_device *dev, unsigned long flags) | |||
283 | 285 | ||
284 | drm_mode_config_init(dev); | 286 | drm_mode_config_init(dev); |
285 | 287 | ||
286 | ret = msm_init_vram(dev); | ||
287 | if (ret) | ||
288 | goto fail; | ||
289 | |||
290 | platform_set_drvdata(pdev, dev); | 288 | platform_set_drvdata(pdev, dev); |
291 | 289 | ||
292 | /* Bind all our sub-components: */ | 290 | /* Bind all our sub-components: */ |
@@ -294,6 +292,10 @@ static int msm_load(struct drm_device *dev, unsigned long flags) | |||
294 | if (ret) | 292 | if (ret) |
295 | return ret; | 293 | return ret; |
296 | 294 | ||
295 | ret = msm_init_vram(dev); | ||
296 | if (ret) | ||
297 | goto fail; | ||
298 | |||
297 | switch (get_mdp_ver(pdev)) { | 299 | switch (get_mdp_ver(pdev)) { |
298 | case 4: | 300 | case 4: |
299 | kms = mdp4_kms_init(dev); | 301 | kms = mdp4_kms_init(dev); |
@@ -419,9 +421,11 @@ static void msm_preclose(struct drm_device *dev, struct drm_file *file) | |||
419 | 421 | ||
420 | static void msm_lastclose(struct drm_device *dev) | 422 | static void msm_lastclose(struct drm_device *dev) |
421 | { | 423 | { |
424 | #ifdef CONFIG_DRM_MSM_FBDEV | ||
422 | struct msm_drm_private *priv = dev->dev_private; | 425 | struct msm_drm_private *priv = dev->dev_private; |
423 | if (priv->fbdev) | 426 | if (priv->fbdev) |
424 | drm_fb_helper_restore_fbdev_mode_unlocked(priv->fbdev); | 427 | drm_fb_helper_restore_fbdev_mode_unlocked(priv->fbdev); |
428 | #endif | ||
425 | } | 429 | } |
426 | 430 | ||
427 | static irqreturn_t msm_irq(int irq, void *arg) | 431 | static irqreturn_t msm_irq(int irq, void *arg) |
diff --git a/drivers/gpu/drm/msm/msm_fb.c b/drivers/gpu/drm/msm/msm_fb.c index 6b573e612f27..121713281417 100644 --- a/drivers/gpu/drm/msm/msm_fb.c +++ b/drivers/gpu/drm/msm/msm_fb.c | |||
@@ -172,8 +172,8 @@ struct drm_framebuffer *msm_framebuffer_init(struct drm_device *dev, | |||
172 | { | 172 | { |
173 | struct msm_drm_private *priv = dev->dev_private; | 173 | struct msm_drm_private *priv = dev->dev_private; |
174 | struct msm_kms *kms = priv->kms; | 174 | struct msm_kms *kms = priv->kms; |
175 | struct msm_framebuffer *msm_fb; | 175 | struct msm_framebuffer *msm_fb = NULL; |
176 | struct drm_framebuffer *fb = NULL; | 176 | struct drm_framebuffer *fb; |
177 | const struct msm_format *format; | 177 | const struct msm_format *format; |
178 | int ret, i, n; | 178 | int ret, i, n; |
179 | unsigned int hsub, vsub; | 179 | unsigned int hsub, vsub; |
@@ -239,8 +239,7 @@ struct drm_framebuffer *msm_framebuffer_init(struct drm_device *dev, | |||
239 | return fb; | 239 | return fb; |
240 | 240 | ||
241 | fail: | 241 | fail: |
242 | if (fb) | 242 | kfree(msm_fb); |
243 | msm_framebuffer_destroy(fb); | ||
244 | 243 | ||
245 | return ERR_PTR(ret); | 244 | return ERR_PTR(ret); |
246 | } | 245 | } |
diff --git a/drivers/gpu/drm/msm/msm_gem.c b/drivers/gpu/drm/msm/msm_gem.c index 479d8af72bcb..52839769eb6c 100644 --- a/drivers/gpu/drm/msm/msm_gem.c +++ b/drivers/gpu/drm/msm/msm_gem.c | |||
@@ -483,7 +483,7 @@ void msm_gem_describe(struct drm_gem_object *obj, struct seq_file *m) | |||
483 | uint64_t off = drm_vma_node_start(&obj->vma_node); | 483 | uint64_t off = drm_vma_node_start(&obj->vma_node); |
484 | 484 | ||
485 | WARN_ON(!mutex_is_locked(&dev->struct_mutex)); | 485 | WARN_ON(!mutex_is_locked(&dev->struct_mutex)); |
486 | seq_printf(m, "%08x: %c(r=%u,w=%u) %2d (%2d) %08llx %p %d\n", | 486 | seq_printf(m, "%08x: %c(r=%u,w=%u) %2d (%2d) %08llx %p %zu\n", |
487 | msm_obj->flags, is_active(msm_obj) ? 'A' : 'I', | 487 | msm_obj->flags, is_active(msm_obj) ? 'A' : 'I', |
488 | msm_obj->read_fence, msm_obj->write_fence, | 488 | msm_obj->read_fence, msm_obj->write_fence, |
489 | obj->name, obj->refcount.refcount.counter, | 489 | obj->name, obj->refcount.refcount.counter, |
diff --git a/drivers/gpu/drm/msm/msm_iommu.c b/drivers/gpu/drm/msm/msm_iommu.c index 7acdaa5688b7..7ac2f1997e4a 100644 --- a/drivers/gpu/drm/msm/msm_iommu.c +++ b/drivers/gpu/drm/msm/msm_iommu.c | |||
@@ -60,7 +60,7 @@ static int msm_iommu_map(struct msm_mmu *mmu, uint32_t iova, | |||
60 | u32 pa = sg_phys(sg) - sg->offset; | 60 | u32 pa = sg_phys(sg) - sg->offset; |
61 | size_t bytes = sg->length + sg->offset; | 61 | size_t bytes = sg->length + sg->offset; |
62 | 62 | ||
63 | VERB("map[%d]: %08x %08x(%x)", i, iova, pa, bytes); | 63 | VERB("map[%d]: %08x %08x(%zx)", i, iova, pa, bytes); |
64 | 64 | ||
65 | ret = iommu_map(domain, da, pa, bytes, prot); | 65 | ret = iommu_map(domain, da, pa, bytes, prot); |
66 | if (ret) | 66 | if (ret) |
@@ -99,7 +99,7 @@ static int msm_iommu_unmap(struct msm_mmu *mmu, uint32_t iova, | |||
99 | if (unmapped < bytes) | 99 | if (unmapped < bytes) |
100 | return unmapped; | 100 | return unmapped; |
101 | 101 | ||
102 | VERB("unmap[%d]: %08x(%x)", i, iova, bytes); | 102 | VERB("unmap[%d]: %08x(%zx)", i, iova, bytes); |
103 | 103 | ||
104 | BUG_ON(!PAGE_ALIGNED(bytes)); | 104 | BUG_ON(!PAGE_ALIGNED(bytes)); |
105 | 105 | ||
diff --git a/drivers/gpu/drm/msm/msm_ringbuffer.c b/drivers/gpu/drm/msm/msm_ringbuffer.c index 8171537dd7d1..1f14b908b221 100644 --- a/drivers/gpu/drm/msm/msm_ringbuffer.c +++ b/drivers/gpu/drm/msm/msm_ringbuffer.c | |||
@@ -56,6 +56,6 @@ fail: | |||
56 | void msm_ringbuffer_destroy(struct msm_ringbuffer *ring) | 56 | void msm_ringbuffer_destroy(struct msm_ringbuffer *ring) |
57 | { | 57 | { |
58 | if (ring->bo) | 58 | if (ring->bo) |
59 | drm_gem_object_unreference(ring->bo); | 59 | drm_gem_object_unreference_unlocked(ring->bo); |
60 | kfree(ring); | 60 | kfree(ring); |
61 | } | 61 | } |
diff --git a/drivers/gpu/drm/radeon/atombios_dp.c b/drivers/gpu/drm/radeon/atombios_dp.c index 3e3290c203c6..b435c859dcbc 100644 --- a/drivers/gpu/drm/radeon/atombios_dp.c +++ b/drivers/gpu/drm/radeon/atombios_dp.c | |||
@@ -421,19 +421,21 @@ bool radeon_dp_getdpcd(struct radeon_connector *radeon_connector) | |||
421 | { | 421 | { |
422 | struct radeon_connector_atom_dig *dig_connector = radeon_connector->con_priv; | 422 | struct radeon_connector_atom_dig *dig_connector = radeon_connector->con_priv; |
423 | u8 msg[DP_DPCD_SIZE]; | 423 | u8 msg[DP_DPCD_SIZE]; |
424 | int ret; | 424 | int ret, i; |
425 | 425 | ||
426 | ret = drm_dp_dpcd_read(&radeon_connector->ddc_bus->aux, DP_DPCD_REV, msg, | 426 | for (i = 0; i < 7; i++) { |
427 | DP_DPCD_SIZE); | 427 | ret = drm_dp_dpcd_read(&radeon_connector->ddc_bus->aux, DP_DPCD_REV, msg, |
428 | if (ret > 0) { | 428 | DP_DPCD_SIZE); |
429 | memcpy(dig_connector->dpcd, msg, DP_DPCD_SIZE); | 429 | if (ret == DP_DPCD_SIZE) { |
430 | memcpy(dig_connector->dpcd, msg, DP_DPCD_SIZE); | ||
430 | 431 | ||
431 | DRM_DEBUG_KMS("DPCD: %*ph\n", (int)sizeof(dig_connector->dpcd), | 432 | DRM_DEBUG_KMS("DPCD: %*ph\n", (int)sizeof(dig_connector->dpcd), |
432 | dig_connector->dpcd); | 433 | dig_connector->dpcd); |
433 | 434 | ||
434 | radeon_dp_probe_oui(radeon_connector); | 435 | radeon_dp_probe_oui(radeon_connector); |
435 | 436 | ||
436 | return true; | 437 | return true; |
438 | } | ||
437 | } | 439 | } |
438 | dig_connector->dpcd[0] = 0; | 440 | dig_connector->dpcd[0] = 0; |
439 | return false; | 441 | return false; |
diff --git a/drivers/gpu/drm/radeon/cik.c b/drivers/gpu/drm/radeon/cik.c index 28faea9996f9..a0c35bbc8546 100644 --- a/drivers/gpu/drm/radeon/cik.c +++ b/drivers/gpu/drm/radeon/cik.c | |||
@@ -5822,7 +5822,7 @@ static int cik_pcie_gart_enable(struct radeon_device *rdev) | |||
5822 | L2_CACHE_BIGK_FRAGMENT_SIZE(4)); | 5822 | L2_CACHE_BIGK_FRAGMENT_SIZE(4)); |
5823 | /* setup context0 */ | 5823 | /* setup context0 */ |
5824 | WREG32(VM_CONTEXT0_PAGE_TABLE_START_ADDR, rdev->mc.gtt_start >> 12); | 5824 | WREG32(VM_CONTEXT0_PAGE_TABLE_START_ADDR, rdev->mc.gtt_start >> 12); |
5825 | WREG32(VM_CONTEXT0_PAGE_TABLE_END_ADDR, rdev->mc.gtt_end >> 12); | 5825 | WREG32(VM_CONTEXT0_PAGE_TABLE_END_ADDR, (rdev->mc.gtt_end >> 12) - 1); |
5826 | WREG32(VM_CONTEXT0_PAGE_TABLE_BASE_ADDR, rdev->gart.table_addr >> 12); | 5826 | WREG32(VM_CONTEXT0_PAGE_TABLE_BASE_ADDR, rdev->gart.table_addr >> 12); |
5827 | WREG32(VM_CONTEXT0_PROTECTION_FAULT_DEFAULT_ADDR, | 5827 | WREG32(VM_CONTEXT0_PROTECTION_FAULT_DEFAULT_ADDR, |
5828 | (u32)(rdev->dummy_page.addr >> 12)); | 5828 | (u32)(rdev->dummy_page.addr >> 12)); |
@@ -5837,7 +5837,7 @@ static int cik_pcie_gart_enable(struct radeon_device *rdev) | |||
5837 | /* restore context1-15 */ | 5837 | /* restore context1-15 */ |
5838 | /* set vm size, must be a multiple of 4 */ | 5838 | /* set vm size, must be a multiple of 4 */ |
5839 | WREG32(VM_CONTEXT1_PAGE_TABLE_START_ADDR, 0); | 5839 | WREG32(VM_CONTEXT1_PAGE_TABLE_START_ADDR, 0); |
5840 | WREG32(VM_CONTEXT1_PAGE_TABLE_END_ADDR, rdev->vm_manager.max_pfn); | 5840 | WREG32(VM_CONTEXT1_PAGE_TABLE_END_ADDR, rdev->vm_manager.max_pfn - 1); |
5841 | for (i = 1; i < 16; i++) { | 5841 | for (i = 1; i < 16; i++) { |
5842 | if (i < 8) | 5842 | if (i < 8) |
5843 | WREG32(VM_CONTEXT0_PAGE_TABLE_BASE_ADDR + (i << 2), | 5843 | WREG32(VM_CONTEXT0_PAGE_TABLE_BASE_ADDR + (i << 2), |
diff --git a/drivers/gpu/drm/radeon/evergreen.c b/drivers/gpu/drm/radeon/evergreen.c index f848acfd3fc8..05e6d6ef5963 100644 --- a/drivers/gpu/drm/radeon/evergreen.c +++ b/drivers/gpu/drm/radeon/evergreen.c | |||
@@ -2485,7 +2485,7 @@ static int evergreen_pcie_gart_enable(struct radeon_device *rdev) | |||
2485 | WREG32(MC_VM_MB_L1_TLB2_CNTL, tmp); | 2485 | WREG32(MC_VM_MB_L1_TLB2_CNTL, tmp); |
2486 | WREG32(MC_VM_MB_L1_TLB3_CNTL, tmp); | 2486 | WREG32(MC_VM_MB_L1_TLB3_CNTL, tmp); |
2487 | WREG32(VM_CONTEXT0_PAGE_TABLE_START_ADDR, rdev->mc.gtt_start >> 12); | 2487 | WREG32(VM_CONTEXT0_PAGE_TABLE_START_ADDR, rdev->mc.gtt_start >> 12); |
2488 | WREG32(VM_CONTEXT0_PAGE_TABLE_END_ADDR, rdev->mc.gtt_end >> 12); | 2488 | WREG32(VM_CONTEXT0_PAGE_TABLE_END_ADDR, (rdev->mc.gtt_end >> 12) - 1); |
2489 | WREG32(VM_CONTEXT0_PAGE_TABLE_BASE_ADDR, rdev->gart.table_addr >> 12); | 2489 | WREG32(VM_CONTEXT0_PAGE_TABLE_BASE_ADDR, rdev->gart.table_addr >> 12); |
2490 | WREG32(VM_CONTEXT0_CNTL, ENABLE_CONTEXT | PAGE_TABLE_DEPTH(0) | | 2490 | WREG32(VM_CONTEXT0_CNTL, ENABLE_CONTEXT | PAGE_TABLE_DEPTH(0) | |
2491 | RANGE_PROTECTION_FAULT_ENABLE_DEFAULT); | 2491 | RANGE_PROTECTION_FAULT_ENABLE_DEFAULT); |
diff --git a/drivers/gpu/drm/radeon/ni.c b/drivers/gpu/drm/radeon/ni.c index e8a496ff007e..aba2f428c0a8 100644 --- a/drivers/gpu/drm/radeon/ni.c +++ b/drivers/gpu/drm/radeon/ni.c | |||
@@ -1282,7 +1282,7 @@ static int cayman_pcie_gart_enable(struct radeon_device *rdev) | |||
1282 | L2_CACHE_BIGK_FRAGMENT_SIZE(6)); | 1282 | L2_CACHE_BIGK_FRAGMENT_SIZE(6)); |
1283 | /* setup context0 */ | 1283 | /* setup context0 */ |
1284 | WREG32(VM_CONTEXT0_PAGE_TABLE_START_ADDR, rdev->mc.gtt_start >> 12); | 1284 | WREG32(VM_CONTEXT0_PAGE_TABLE_START_ADDR, rdev->mc.gtt_start >> 12); |
1285 | WREG32(VM_CONTEXT0_PAGE_TABLE_END_ADDR, rdev->mc.gtt_end >> 12); | 1285 | WREG32(VM_CONTEXT0_PAGE_TABLE_END_ADDR, (rdev->mc.gtt_end >> 12) - 1); |
1286 | WREG32(VM_CONTEXT0_PAGE_TABLE_BASE_ADDR, rdev->gart.table_addr >> 12); | 1286 | WREG32(VM_CONTEXT0_PAGE_TABLE_BASE_ADDR, rdev->gart.table_addr >> 12); |
1287 | WREG32(VM_CONTEXT0_PROTECTION_FAULT_DEFAULT_ADDR, | 1287 | WREG32(VM_CONTEXT0_PROTECTION_FAULT_DEFAULT_ADDR, |
1288 | (u32)(rdev->dummy_page.addr >> 12)); | 1288 | (u32)(rdev->dummy_page.addr >> 12)); |
@@ -1301,7 +1301,8 @@ static int cayman_pcie_gart_enable(struct radeon_device *rdev) | |||
1301 | */ | 1301 | */ |
1302 | for (i = 1; i < 8; i++) { | 1302 | for (i = 1; i < 8; i++) { |
1303 | WREG32(VM_CONTEXT0_PAGE_TABLE_START_ADDR + (i << 2), 0); | 1303 | WREG32(VM_CONTEXT0_PAGE_TABLE_START_ADDR + (i << 2), 0); |
1304 | WREG32(VM_CONTEXT0_PAGE_TABLE_END_ADDR + (i << 2), rdev->vm_manager.max_pfn); | 1304 | WREG32(VM_CONTEXT0_PAGE_TABLE_END_ADDR + (i << 2), |
1305 | rdev->vm_manager.max_pfn - 1); | ||
1305 | WREG32(VM_CONTEXT0_PAGE_TABLE_BASE_ADDR + (i << 2), | 1306 | WREG32(VM_CONTEXT0_PAGE_TABLE_BASE_ADDR + (i << 2), |
1306 | rdev->vm_manager.saved_table_addr[i]); | 1307 | rdev->vm_manager.saved_table_addr[i]); |
1307 | } | 1308 | } |
diff --git a/drivers/gpu/drm/radeon/r600.c b/drivers/gpu/drm/radeon/r600.c index 8f6d862a1882..25b4ac967742 100644 --- a/drivers/gpu/drm/radeon/r600.c +++ b/drivers/gpu/drm/radeon/r600.c | |||
@@ -1112,7 +1112,7 @@ static int r600_pcie_gart_enable(struct radeon_device *rdev) | |||
1112 | WREG32(MC_VM_L1_TLB_MCB_RD_SEM_CNTL, tmp | ENABLE_SEMAPHORE_MODE); | 1112 | WREG32(MC_VM_L1_TLB_MCB_RD_SEM_CNTL, tmp | ENABLE_SEMAPHORE_MODE); |
1113 | WREG32(MC_VM_L1_TLB_MCB_WR_SEM_CNTL, tmp | ENABLE_SEMAPHORE_MODE); | 1113 | WREG32(MC_VM_L1_TLB_MCB_WR_SEM_CNTL, tmp | ENABLE_SEMAPHORE_MODE); |
1114 | WREG32(VM_CONTEXT0_PAGE_TABLE_START_ADDR, rdev->mc.gtt_start >> 12); | 1114 | WREG32(VM_CONTEXT0_PAGE_TABLE_START_ADDR, rdev->mc.gtt_start >> 12); |
1115 | WREG32(VM_CONTEXT0_PAGE_TABLE_END_ADDR, rdev->mc.gtt_end >> 12); | 1115 | WREG32(VM_CONTEXT0_PAGE_TABLE_END_ADDR, (rdev->mc.gtt_end >> 12) - 1); |
1116 | WREG32(VM_CONTEXT0_PAGE_TABLE_BASE_ADDR, rdev->gart.table_addr >> 12); | 1116 | WREG32(VM_CONTEXT0_PAGE_TABLE_BASE_ADDR, rdev->gart.table_addr >> 12); |
1117 | WREG32(VM_CONTEXT0_CNTL, ENABLE_CONTEXT | PAGE_TABLE_DEPTH(0) | | 1117 | WREG32(VM_CONTEXT0_CNTL, ENABLE_CONTEXT | PAGE_TABLE_DEPTH(0) | |
1118 | RANGE_PROTECTION_FAULT_ENABLE_DEFAULT); | 1118 | RANGE_PROTECTION_FAULT_ENABLE_DEFAULT); |
diff --git a/drivers/gpu/drm/radeon/radeon_dp_auxch.c b/drivers/gpu/drm/radeon/radeon_dp_auxch.c index bf1fecc6cceb..fcbd60bb0349 100644 --- a/drivers/gpu/drm/radeon/radeon_dp_auxch.c +++ b/drivers/gpu/drm/radeon/radeon_dp_auxch.c | |||
@@ -30,8 +30,6 @@ | |||
30 | AUX_SW_RX_HPD_DISCON | \ | 30 | AUX_SW_RX_HPD_DISCON | \ |
31 | AUX_SW_RX_PARTIAL_BYTE | \ | 31 | AUX_SW_RX_PARTIAL_BYTE | \ |
32 | AUX_SW_NON_AUX_MODE | \ | 32 | AUX_SW_NON_AUX_MODE | \ |
33 | AUX_SW_RX_MIN_COUNT_VIOL | \ | ||
34 | AUX_SW_RX_INVALID_STOP | \ | ||
35 | AUX_SW_RX_SYNC_INVALID_L | \ | 33 | AUX_SW_RX_SYNC_INVALID_L | \ |
36 | AUX_SW_RX_SYNC_INVALID_H | \ | 34 | AUX_SW_RX_SYNC_INVALID_H | \ |
37 | AUX_SW_RX_INVALID_START | \ | 35 | AUX_SW_RX_INVALID_START | \ |
diff --git a/drivers/gpu/drm/radeon/radeon_dp_mst.c b/drivers/gpu/drm/radeon/radeon_dp_mst.c index 1017338a49d9..2b98ed3e684d 100644 --- a/drivers/gpu/drm/radeon/radeon_dp_mst.c +++ b/drivers/gpu/drm/radeon/radeon_dp_mst.c | |||
@@ -666,6 +666,9 @@ radeon_dp_mst_probe(struct radeon_connector *radeon_connector) | |||
666 | int ret; | 666 | int ret; |
667 | u8 msg[1]; | 667 | u8 msg[1]; |
668 | 668 | ||
669 | if (!radeon_mst) | ||
670 | return 0; | ||
671 | |||
669 | if (dig_connector->dpcd[DP_DPCD_REV] < 0x12) | 672 | if (dig_connector->dpcd[DP_DPCD_REV] < 0x12) |
670 | return 0; | 673 | return 0; |
671 | 674 | ||
diff --git a/drivers/gpu/drm/radeon/rv770.c b/drivers/gpu/drm/radeon/rv770.c index 01ee96acb398..c54d6313a46d 100644 --- a/drivers/gpu/drm/radeon/rv770.c +++ b/drivers/gpu/drm/radeon/rv770.c | |||
@@ -921,7 +921,7 @@ static int rv770_pcie_gart_enable(struct radeon_device *rdev) | |||
921 | WREG32(MC_VM_MB_L1_TLB2_CNTL, tmp); | 921 | WREG32(MC_VM_MB_L1_TLB2_CNTL, tmp); |
922 | WREG32(MC_VM_MB_L1_TLB3_CNTL, tmp); | 922 | WREG32(MC_VM_MB_L1_TLB3_CNTL, tmp); |
923 | WREG32(VM_CONTEXT0_PAGE_TABLE_START_ADDR, rdev->mc.gtt_start >> 12); | 923 | WREG32(VM_CONTEXT0_PAGE_TABLE_START_ADDR, rdev->mc.gtt_start >> 12); |
924 | WREG32(VM_CONTEXT0_PAGE_TABLE_END_ADDR, rdev->mc.gtt_end >> 12); | 924 | WREG32(VM_CONTEXT0_PAGE_TABLE_END_ADDR, (rdev->mc.gtt_end >> 12) - 1); |
925 | WREG32(VM_CONTEXT0_PAGE_TABLE_BASE_ADDR, rdev->gart.table_addr >> 12); | 925 | WREG32(VM_CONTEXT0_PAGE_TABLE_BASE_ADDR, rdev->gart.table_addr >> 12); |
926 | WREG32(VM_CONTEXT0_CNTL, ENABLE_CONTEXT | PAGE_TABLE_DEPTH(0) | | 926 | WREG32(VM_CONTEXT0_CNTL, ENABLE_CONTEXT | PAGE_TABLE_DEPTH(0) | |
927 | RANGE_PROTECTION_FAULT_ENABLE_DEFAULT); | 927 | RANGE_PROTECTION_FAULT_ENABLE_DEFAULT); |
diff --git a/drivers/gpu/drm/radeon/si.c b/drivers/gpu/drm/radeon/si.c index b1d74bc375d8..5326f753e107 100644 --- a/drivers/gpu/drm/radeon/si.c +++ b/drivers/gpu/drm/radeon/si.c | |||
@@ -4303,7 +4303,7 @@ static int si_pcie_gart_enable(struct radeon_device *rdev) | |||
4303 | L2_CACHE_BIGK_FRAGMENT_SIZE(4)); | 4303 | L2_CACHE_BIGK_FRAGMENT_SIZE(4)); |
4304 | /* setup context0 */ | 4304 | /* setup context0 */ |
4305 | WREG32(VM_CONTEXT0_PAGE_TABLE_START_ADDR, rdev->mc.gtt_start >> 12); | 4305 | WREG32(VM_CONTEXT0_PAGE_TABLE_START_ADDR, rdev->mc.gtt_start >> 12); |
4306 | WREG32(VM_CONTEXT0_PAGE_TABLE_END_ADDR, rdev->mc.gtt_end >> 12); | 4306 | WREG32(VM_CONTEXT0_PAGE_TABLE_END_ADDR, (rdev->mc.gtt_end >> 12) - 1); |
4307 | WREG32(VM_CONTEXT0_PAGE_TABLE_BASE_ADDR, rdev->gart.table_addr >> 12); | 4307 | WREG32(VM_CONTEXT0_PAGE_TABLE_BASE_ADDR, rdev->gart.table_addr >> 12); |
4308 | WREG32(VM_CONTEXT0_PROTECTION_FAULT_DEFAULT_ADDR, | 4308 | WREG32(VM_CONTEXT0_PROTECTION_FAULT_DEFAULT_ADDR, |
4309 | (u32)(rdev->dummy_page.addr >> 12)); | 4309 | (u32)(rdev->dummy_page.addr >> 12)); |
@@ -4318,7 +4318,7 @@ static int si_pcie_gart_enable(struct radeon_device *rdev) | |||
4318 | /* empty context1-15 */ | 4318 | /* empty context1-15 */ |
4319 | /* set vm size, must be a multiple of 4 */ | 4319 | /* set vm size, must be a multiple of 4 */ |
4320 | WREG32(VM_CONTEXT1_PAGE_TABLE_START_ADDR, 0); | 4320 | WREG32(VM_CONTEXT1_PAGE_TABLE_START_ADDR, 0); |
4321 | WREG32(VM_CONTEXT1_PAGE_TABLE_END_ADDR, rdev->vm_manager.max_pfn); | 4321 | WREG32(VM_CONTEXT1_PAGE_TABLE_END_ADDR, rdev->vm_manager.max_pfn - 1); |
4322 | /* Assign the pt base to something valid for now; the pts used for | 4322 | /* Assign the pt base to something valid for now; the pts used for |
4323 | * the VMs are determined by the application and setup and assigned | 4323 | * the VMs are determined by the application and setup and assigned |
4324 | * on the fly in the vm part of radeon_gart.c | 4324 | * on the fly in the vm part of radeon_gart.c |
diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h index 41f167e4d75f..7ce93d927f62 100644 --- a/drivers/hid/hid-ids.h +++ b/drivers/hid/hid-ids.h | |||
@@ -164,6 +164,7 @@ | |||
164 | #define USB_DEVICE_ID_ATEN_2PORTKVM 0x2204 | 164 | #define USB_DEVICE_ID_ATEN_2PORTKVM 0x2204 |
165 | #define USB_DEVICE_ID_ATEN_4PORTKVM 0x2205 | 165 | #define USB_DEVICE_ID_ATEN_4PORTKVM 0x2205 |
166 | #define USB_DEVICE_ID_ATEN_4PORTKVMC 0x2208 | 166 | #define USB_DEVICE_ID_ATEN_4PORTKVMC 0x2208 |
167 | #define USB_DEVICE_ID_ATEN_CS682 0x2213 | ||
167 | 168 | ||
168 | #define USB_VENDOR_ID_ATMEL 0x03eb | 169 | #define USB_VENDOR_ID_ATMEL 0x03eb |
169 | #define USB_DEVICE_ID_ATMEL_MULTITOUCH 0x211c | 170 | #define USB_DEVICE_ID_ATMEL_MULTITOUCH 0x211c |
diff --git a/drivers/hid/hid-logitech-hidpp.c b/drivers/hid/hid-logitech-hidpp.c index b3cf6fd4be96..5fd530acf747 100644 --- a/drivers/hid/hid-logitech-hidpp.c +++ b/drivers/hid/hid-logitech-hidpp.c | |||
@@ -44,7 +44,6 @@ MODULE_PARM_DESC(disable_raw_mode, | |||
44 | /* bits 1..20 are reserved for classes */ | 44 | /* bits 1..20 are reserved for classes */ |
45 | #define HIDPP_QUIRK_DELAYED_INIT BIT(21) | 45 | #define HIDPP_QUIRK_DELAYED_INIT BIT(21) |
46 | #define HIDPP_QUIRK_WTP_PHYSICAL_BUTTONS BIT(22) | 46 | #define HIDPP_QUIRK_WTP_PHYSICAL_BUTTONS BIT(22) |
47 | #define HIDPP_QUIRK_MULTI_INPUT BIT(23) | ||
48 | 47 | ||
49 | /* | 48 | /* |
50 | * There are two hidpp protocols in use, the first version hidpp10 is known | 49 | * There are two hidpp protocols in use, the first version hidpp10 is known |
@@ -706,12 +705,6 @@ static int wtp_input_mapping(struct hid_device *hdev, struct hid_input *hi, | |||
706 | struct hid_field *field, struct hid_usage *usage, | 705 | struct hid_field *field, struct hid_usage *usage, |
707 | unsigned long **bit, int *max) | 706 | unsigned long **bit, int *max) |
708 | { | 707 | { |
709 | struct hidpp_device *hidpp = hid_get_drvdata(hdev); | ||
710 | |||
711 | if ((hidpp->quirks & HIDPP_QUIRK_MULTI_INPUT) && | ||
712 | (field->application == HID_GD_KEYBOARD)) | ||
713 | return 0; | ||
714 | |||
715 | return -1; | 708 | return -1; |
716 | } | 709 | } |
717 | 710 | ||
@@ -720,10 +713,6 @@ static void wtp_populate_input(struct hidpp_device *hidpp, | |||
720 | { | 713 | { |
721 | struct wtp_data *wd = hidpp->private_data; | 714 | struct wtp_data *wd = hidpp->private_data; |
722 | 715 | ||
723 | if ((hidpp->quirks & HIDPP_QUIRK_MULTI_INPUT) && origin_is_hid_core) | ||
724 | /* this is the generic hid-input call */ | ||
725 | return; | ||
726 | |||
727 | __set_bit(EV_ABS, input_dev->evbit); | 716 | __set_bit(EV_ABS, input_dev->evbit); |
728 | __set_bit(EV_KEY, input_dev->evbit); | 717 | __set_bit(EV_KEY, input_dev->evbit); |
729 | __clear_bit(EV_REL, input_dev->evbit); | 718 | __clear_bit(EV_REL, input_dev->evbit); |
@@ -1245,10 +1234,6 @@ static int hidpp_probe(struct hid_device *hdev, const struct hid_device_id *id) | |||
1245 | if (hidpp->quirks & HIDPP_QUIRK_DELAYED_INIT) | 1234 | if (hidpp->quirks & HIDPP_QUIRK_DELAYED_INIT) |
1246 | connect_mask &= ~HID_CONNECT_HIDINPUT; | 1235 | connect_mask &= ~HID_CONNECT_HIDINPUT; |
1247 | 1236 | ||
1248 | /* Re-enable hidinput for multi-input devices */ | ||
1249 | if (hidpp->quirks & HIDPP_QUIRK_MULTI_INPUT) | ||
1250 | connect_mask |= HID_CONNECT_HIDINPUT; | ||
1251 | |||
1252 | ret = hid_hw_start(hdev, connect_mask); | 1237 | ret = hid_hw_start(hdev, connect_mask); |
1253 | if (ret) { | 1238 | if (ret) { |
1254 | hid_err(hdev, "%s:hid_hw_start returned error\n", __func__); | 1239 | hid_err(hdev, "%s:hid_hw_start returned error\n", __func__); |
@@ -1296,11 +1281,6 @@ static const struct hid_device_id hidpp_devices[] = { | |||
1296 | HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_LOGITECH, | 1281 | HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_LOGITECH, |
1297 | USB_DEVICE_ID_LOGITECH_T651), | 1282 | USB_DEVICE_ID_LOGITECH_T651), |
1298 | .driver_data = HIDPP_QUIRK_CLASS_WTP }, | 1283 | .driver_data = HIDPP_QUIRK_CLASS_WTP }, |
1299 | { /* Keyboard TK820 */ | ||
1300 | HID_DEVICE(BUS_USB, HID_GROUP_LOGITECH_DJ_DEVICE, | ||
1301 | USB_VENDOR_ID_LOGITECH, 0x4102), | ||
1302 | .driver_data = HIDPP_QUIRK_DELAYED_INIT | HIDPP_QUIRK_MULTI_INPUT | | ||
1303 | HIDPP_QUIRK_CLASS_WTP }, | ||
1304 | 1284 | ||
1305 | { HID_DEVICE(BUS_USB, HID_GROUP_LOGITECH_DJ_DEVICE, | 1285 | { HID_DEVICE(BUS_USB, HID_GROUP_LOGITECH_DJ_DEVICE, |
1306 | USB_VENDOR_ID_LOGITECH, HID_ANY_ID)}, | 1286 | USB_VENDOR_ID_LOGITECH, HID_ANY_ID)}, |
diff --git a/drivers/hid/hid-sensor-hub.c b/drivers/hid/hid-sensor-hub.c index c3f6f1e311ea..090a1ba0abb6 100644 --- a/drivers/hid/hid-sensor-hub.c +++ b/drivers/hid/hid-sensor-hub.c | |||
@@ -294,7 +294,7 @@ int sensor_hub_input_attr_get_raw_value(struct hid_sensor_hub_device *hsdev, | |||
294 | if (!report) | 294 | if (!report) |
295 | return -EINVAL; | 295 | return -EINVAL; |
296 | 296 | ||
297 | mutex_lock(&hsdev->mutex); | 297 | mutex_lock(hsdev->mutex_ptr); |
298 | if (flag == SENSOR_HUB_SYNC) { | 298 | if (flag == SENSOR_HUB_SYNC) { |
299 | memset(&hsdev->pending, 0, sizeof(hsdev->pending)); | 299 | memset(&hsdev->pending, 0, sizeof(hsdev->pending)); |
300 | init_completion(&hsdev->pending.ready); | 300 | init_completion(&hsdev->pending.ready); |
@@ -328,7 +328,7 @@ int sensor_hub_input_attr_get_raw_value(struct hid_sensor_hub_device *hsdev, | |||
328 | kfree(hsdev->pending.raw_data); | 328 | kfree(hsdev->pending.raw_data); |
329 | hsdev->pending.status = false; | 329 | hsdev->pending.status = false; |
330 | } | 330 | } |
331 | mutex_unlock(&hsdev->mutex); | 331 | mutex_unlock(hsdev->mutex_ptr); |
332 | 332 | ||
333 | return ret_val; | 333 | return ret_val; |
334 | } | 334 | } |
@@ -667,7 +667,14 @@ static int sensor_hub_probe(struct hid_device *hdev, | |||
667 | hsdev->vendor_id = hdev->vendor; | 667 | hsdev->vendor_id = hdev->vendor; |
668 | hsdev->product_id = hdev->product; | 668 | hsdev->product_id = hdev->product; |
669 | hsdev->usage = collection->usage; | 669 | hsdev->usage = collection->usage; |
670 | mutex_init(&hsdev->mutex); | 670 | hsdev->mutex_ptr = devm_kzalloc(&hdev->dev, |
671 | sizeof(struct mutex), | ||
672 | GFP_KERNEL); | ||
673 | if (!hsdev->mutex_ptr) { | ||
674 | ret = -ENOMEM; | ||
675 | goto err_stop_hw; | ||
676 | } | ||
677 | mutex_init(hsdev->mutex_ptr); | ||
671 | hsdev->start_collection_index = i; | 678 | hsdev->start_collection_index = i; |
672 | if (last_hsdev) | 679 | if (last_hsdev) |
673 | last_hsdev->end_collection_index = i; | 680 | last_hsdev->end_collection_index = i; |
diff --git a/drivers/hid/i2c-hid/i2c-hid.c b/drivers/hid/i2c-hid/i2c-hid.c index ab4dd952b6ba..92d6cdf02460 100644 --- a/drivers/hid/i2c-hid/i2c-hid.c +++ b/drivers/hid/i2c-hid/i2c-hid.c | |||
@@ -862,6 +862,7 @@ static int i2c_hid_acpi_pdata(struct i2c_client *client, | |||
862 | union acpi_object *obj; | 862 | union acpi_object *obj; |
863 | struct acpi_device *adev; | 863 | struct acpi_device *adev; |
864 | acpi_handle handle; | 864 | acpi_handle handle; |
865 | int ret; | ||
865 | 866 | ||
866 | handle = ACPI_HANDLE(&client->dev); | 867 | handle = ACPI_HANDLE(&client->dev); |
867 | if (!handle || acpi_bus_get_device(handle, &adev)) | 868 | if (!handle || acpi_bus_get_device(handle, &adev)) |
@@ -877,7 +878,9 @@ static int i2c_hid_acpi_pdata(struct i2c_client *client, | |||
877 | pdata->hid_descriptor_address = obj->integer.value; | 878 | pdata->hid_descriptor_address = obj->integer.value; |
878 | ACPI_FREE(obj); | 879 | ACPI_FREE(obj); |
879 | 880 | ||
880 | return acpi_dev_add_driver_gpios(adev, i2c_hid_acpi_gpios); | 881 | /* GPIOs are optional */ |
882 | ret = acpi_dev_add_driver_gpios(adev, i2c_hid_acpi_gpios); | ||
883 | return ret < 0 && ret != -ENXIO ? ret : 0; | ||
881 | } | 884 | } |
882 | 885 | ||
883 | static const struct acpi_device_id i2c_hid_acpi_match[] = { | 886 | static const struct acpi_device_id i2c_hid_acpi_match[] = { |
diff --git a/drivers/hid/usbhid/hid-quirks.c b/drivers/hid/usbhid/hid-quirks.c index a775143e6265..4696895eb708 100644 --- a/drivers/hid/usbhid/hid-quirks.c +++ b/drivers/hid/usbhid/hid-quirks.c | |||
@@ -61,6 +61,7 @@ static const struct hid_blacklist { | |||
61 | { USB_VENDOR_ID_ATEN, USB_DEVICE_ID_ATEN_2PORTKVM, HID_QUIRK_NOGET }, | 61 | { USB_VENDOR_ID_ATEN, USB_DEVICE_ID_ATEN_2PORTKVM, HID_QUIRK_NOGET }, |
62 | { USB_VENDOR_ID_ATEN, USB_DEVICE_ID_ATEN_4PORTKVM, HID_QUIRK_NOGET }, | 62 | { USB_VENDOR_ID_ATEN, USB_DEVICE_ID_ATEN_4PORTKVM, HID_QUIRK_NOGET }, |
63 | { USB_VENDOR_ID_ATEN, USB_DEVICE_ID_ATEN_4PORTKVMC, HID_QUIRK_NOGET }, | 63 | { USB_VENDOR_ID_ATEN, USB_DEVICE_ID_ATEN_4PORTKVMC, HID_QUIRK_NOGET }, |
64 | { USB_VENDOR_ID_ATEN, USB_DEVICE_ID_ATEN_CS682, HID_QUIRK_NOGET }, | ||
64 | { USB_VENDOR_ID_CH, USB_DEVICE_ID_CH_FIGHTERSTICK, HID_QUIRK_NOGET }, | 65 | { USB_VENDOR_ID_CH, USB_DEVICE_ID_CH_FIGHTERSTICK, HID_QUIRK_NOGET }, |
65 | { USB_VENDOR_ID_CH, USB_DEVICE_ID_CH_COMBATSTICK, HID_QUIRK_NOGET }, | 66 | { USB_VENDOR_ID_CH, USB_DEVICE_ID_CH_COMBATSTICK, HID_QUIRK_NOGET }, |
66 | { USB_VENDOR_ID_CH, USB_DEVICE_ID_CH_FLIGHT_SIM_ECLIPSE_YOKE, HID_QUIRK_NOGET }, | 67 | { USB_VENDOR_ID_CH, USB_DEVICE_ID_CH_FLIGHT_SIM_ECLIPSE_YOKE, HID_QUIRK_NOGET }, |
diff --git a/drivers/hid/wacom_wac.c b/drivers/hid/wacom_wac.c index fa54d3290659..adf959dcfa5d 100644 --- a/drivers/hid/wacom_wac.c +++ b/drivers/hid/wacom_wac.c | |||
@@ -1072,6 +1072,9 @@ static int wacom_wac_finger_count_touches(struct wacom_wac *wacom) | |||
1072 | int count = 0; | 1072 | int count = 0; |
1073 | int i; | 1073 | int i; |
1074 | 1074 | ||
1075 | if (!touch_max) | ||
1076 | return 0; | ||
1077 | |||
1075 | /* non-HID_GENERIC single touch input doesn't call this routine */ | 1078 | /* non-HID_GENERIC single touch input doesn't call this routine */ |
1076 | if ((touch_max == 1) && (wacom->features.type == HID_GENERIC)) | 1079 | if ((touch_max == 1) && (wacom->features.type == HID_GENERIC)) |
1077 | return wacom->hid_data.tipswitch && | 1080 | return wacom->hid_data.tipswitch && |
diff --git a/drivers/iio/accel/mma9551_core.c b/drivers/iio/accel/mma9551_core.c index 7f55a6d7cd03..c6d5a3a40b60 100644 --- a/drivers/iio/accel/mma9551_core.c +++ b/drivers/iio/accel/mma9551_core.c | |||
@@ -389,7 +389,12 @@ int mma9551_read_config_words(struct i2c_client *client, u8 app_id, | |||
389 | { | 389 | { |
390 | int ret, i; | 390 | int ret, i; |
391 | int len_words = len / sizeof(u16); | 391 | int len_words = len / sizeof(u16); |
392 | __be16 be_buf[MMA9551_MAX_MAILBOX_DATA_REGS]; | 392 | __be16 be_buf[MMA9551_MAX_MAILBOX_DATA_REGS / 2]; |
393 | |||
394 | if (len_words > ARRAY_SIZE(be_buf)) { | ||
395 | dev_err(&client->dev, "Invalid buffer size %d\n", len); | ||
396 | return -EINVAL; | ||
397 | } | ||
393 | 398 | ||
394 | ret = mma9551_transfer(client, app_id, MMA9551_CMD_READ_CONFIG, | 399 | ret = mma9551_transfer(client, app_id, MMA9551_CMD_READ_CONFIG, |
395 | reg, NULL, 0, (u8 *) be_buf, len); | 400 | reg, NULL, 0, (u8 *) be_buf, len); |
@@ -424,7 +429,12 @@ int mma9551_read_status_words(struct i2c_client *client, u8 app_id, | |||
424 | { | 429 | { |
425 | int ret, i; | 430 | int ret, i; |
426 | int len_words = len / sizeof(u16); | 431 | int len_words = len / sizeof(u16); |
427 | __be16 be_buf[MMA9551_MAX_MAILBOX_DATA_REGS]; | 432 | __be16 be_buf[MMA9551_MAX_MAILBOX_DATA_REGS / 2]; |
433 | |||
434 | if (len_words > ARRAY_SIZE(be_buf)) { | ||
435 | dev_err(&client->dev, "Invalid buffer size %d\n", len); | ||
436 | return -EINVAL; | ||
437 | } | ||
428 | 438 | ||
429 | ret = mma9551_transfer(client, app_id, MMA9551_CMD_READ_STATUS, | 439 | ret = mma9551_transfer(client, app_id, MMA9551_CMD_READ_STATUS, |
430 | reg, NULL, 0, (u8 *) be_buf, len); | 440 | reg, NULL, 0, (u8 *) be_buf, len); |
@@ -459,7 +469,12 @@ int mma9551_write_config_words(struct i2c_client *client, u8 app_id, | |||
459 | { | 469 | { |
460 | int i; | 470 | int i; |
461 | int len_words = len / sizeof(u16); | 471 | int len_words = len / sizeof(u16); |
462 | __be16 be_buf[MMA9551_MAX_MAILBOX_DATA_REGS]; | 472 | __be16 be_buf[(MMA9551_MAX_MAILBOX_DATA_REGS - 1) / 2]; |
473 | |||
474 | if (len_words > ARRAY_SIZE(be_buf)) { | ||
475 | dev_err(&client->dev, "Invalid buffer size %d\n", len); | ||
476 | return -EINVAL; | ||
477 | } | ||
463 | 478 | ||
464 | for (i = 0; i < len_words; i++) | 479 | for (i = 0; i < len_words; i++) |
465 | be_buf[i] = cpu_to_be16(buf[i]); | 480 | be_buf[i] = cpu_to_be16(buf[i]); |
diff --git a/drivers/iio/accel/mma9553.c b/drivers/iio/accel/mma9553.c index 2df1af7d43fc..365a109aaaef 100644 --- a/drivers/iio/accel/mma9553.c +++ b/drivers/iio/accel/mma9553.c | |||
@@ -54,6 +54,7 @@ | |||
54 | #define MMA9553_MASK_CONF_STEPCOALESCE GENMASK(7, 0) | 54 | #define MMA9553_MASK_CONF_STEPCOALESCE GENMASK(7, 0) |
55 | 55 | ||
56 | #define MMA9553_REG_CONF_ACTTHD 0x0E | 56 | #define MMA9553_REG_CONF_ACTTHD 0x0E |
57 | #define MMA9553_MAX_ACTTHD GENMASK(15, 0) | ||
57 | 58 | ||
58 | /* Pedometer status registers (R-only) */ | 59 | /* Pedometer status registers (R-only) */ |
59 | #define MMA9553_REG_STATUS 0x00 | 60 | #define MMA9553_REG_STATUS 0x00 |
@@ -316,22 +317,19 @@ static int mma9553_set_config(struct mma9553_data *data, u16 reg, | |||
316 | static int mma9553_read_activity_stepcnt(struct mma9553_data *data, | 317 | static int mma9553_read_activity_stepcnt(struct mma9553_data *data, |
317 | u8 *activity, u16 *stepcnt) | 318 | u8 *activity, u16 *stepcnt) |
318 | { | 319 | { |
319 | u32 status_stepcnt; | 320 | u16 buf[2]; |
320 | u16 status; | ||
321 | int ret; | 321 | int ret; |
322 | 322 | ||
323 | ret = mma9551_read_status_words(data->client, MMA9551_APPID_PEDOMETER, | 323 | ret = mma9551_read_status_words(data->client, MMA9551_APPID_PEDOMETER, |
324 | MMA9553_REG_STATUS, sizeof(u32), | 324 | MMA9553_REG_STATUS, sizeof(u32), buf); |
325 | (u16 *) &status_stepcnt); | ||
326 | if (ret < 0) { | 325 | if (ret < 0) { |
327 | dev_err(&data->client->dev, | 326 | dev_err(&data->client->dev, |
328 | "error reading status and stepcnt\n"); | 327 | "error reading status and stepcnt\n"); |
329 | return ret; | 328 | return ret; |
330 | } | 329 | } |
331 | 330 | ||
332 | status = status_stepcnt & MMA9553_MASK_CONF_WORD; | 331 | *activity = mma9553_get_bits(buf[0], MMA9553_MASK_STATUS_ACTIVITY); |
333 | *activity = mma9553_get_bits(status, MMA9553_MASK_STATUS_ACTIVITY); | 332 | *stepcnt = buf[1]; |
334 | *stepcnt = status_stepcnt >> 16; | ||
335 | 333 | ||
336 | return 0; | 334 | return 0; |
337 | } | 335 | } |
@@ -872,6 +870,9 @@ static int mma9553_write_event_value(struct iio_dev *indio_dev, | |||
872 | case IIO_EV_INFO_PERIOD: | 870 | case IIO_EV_INFO_PERIOD: |
873 | switch (chan->type) { | 871 | switch (chan->type) { |
874 | case IIO_ACTIVITY: | 872 | case IIO_ACTIVITY: |
873 | if (val < 0 || val > MMA9553_ACTIVITY_THD_TO_SEC( | ||
874 | MMA9553_MAX_ACTTHD)) | ||
875 | return -EINVAL; | ||
875 | mutex_lock(&data->mutex); | 876 | mutex_lock(&data->mutex); |
876 | ret = mma9553_set_config(data, MMA9553_REG_CONF_ACTTHD, | 877 | ret = mma9553_set_config(data, MMA9553_REG_CONF_ACTTHD, |
877 | &data->conf.actthd, | 878 | &data->conf.actthd, |
@@ -971,7 +972,8 @@ static const struct iio_chan_spec_ext_info mma9553_ext_info[] = { | |||
971 | .modified = 1, \ | 972 | .modified = 1, \ |
972 | .channel2 = _chan2, \ | 973 | .channel2 = _chan2, \ |
973 | .info_mask_separate = BIT(IIO_CHAN_INFO_PROCESSED), \ | 974 | .info_mask_separate = BIT(IIO_CHAN_INFO_PROCESSED), \ |
974 | .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_CALIBHEIGHT), \ | 975 | .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_CALIBHEIGHT) | \ |
976 | BIT(IIO_CHAN_INFO_ENABLE), \ | ||
975 | .event_spec = mma9553_activity_events, \ | 977 | .event_spec = mma9553_activity_events, \ |
976 | .num_event_specs = ARRAY_SIZE(mma9553_activity_events), \ | 978 | .num_event_specs = ARRAY_SIZE(mma9553_activity_events), \ |
977 | .ext_info = mma9553_ext_info, \ | 979 | .ext_info = mma9553_ext_info, \ |
diff --git a/drivers/iio/accel/st_accel_core.c b/drivers/iio/accel/st_accel_core.c index 58d1d13d552a..211b13271c61 100644 --- a/drivers/iio/accel/st_accel_core.c +++ b/drivers/iio/accel/st_accel_core.c | |||
@@ -546,6 +546,7 @@ int st_accel_common_probe(struct iio_dev *indio_dev) | |||
546 | 546 | ||
547 | indio_dev->modes = INDIO_DIRECT_MODE; | 547 | indio_dev->modes = INDIO_DIRECT_MODE; |
548 | indio_dev->info = &accel_info; | 548 | indio_dev->info = &accel_info; |
549 | mutex_init(&adata->tb.buf_lock); | ||
549 | 550 | ||
550 | st_sensors_power_enable(indio_dev); | 551 | st_sensors_power_enable(indio_dev); |
551 | 552 | ||
diff --git a/drivers/iio/adc/axp288_adc.c b/drivers/iio/adc/axp288_adc.c index 08bcfb061ca5..56008a86b78f 100644 --- a/drivers/iio/adc/axp288_adc.c +++ b/drivers/iio/adc/axp288_adc.c | |||
@@ -53,39 +53,42 @@ static const struct iio_chan_spec const axp288_adc_channels[] = { | |||
53 | .channel = 0, | 53 | .channel = 0, |
54 | .address = AXP288_TS_ADC_H, | 54 | .address = AXP288_TS_ADC_H, |
55 | .datasheet_name = "TS_PIN", | 55 | .datasheet_name = "TS_PIN", |
56 | .info_mask_separate = BIT(IIO_CHAN_INFO_RAW), | ||
56 | }, { | 57 | }, { |
57 | .indexed = 1, | 58 | .indexed = 1, |
58 | .type = IIO_TEMP, | 59 | .type = IIO_TEMP, |
59 | .channel = 1, | 60 | .channel = 1, |
60 | .address = AXP288_PMIC_ADC_H, | 61 | .address = AXP288_PMIC_ADC_H, |
61 | .datasheet_name = "PMIC_TEMP", | 62 | .datasheet_name = "PMIC_TEMP", |
63 | .info_mask_separate = BIT(IIO_CHAN_INFO_RAW), | ||
62 | }, { | 64 | }, { |
63 | .indexed = 1, | 65 | .indexed = 1, |
64 | .type = IIO_TEMP, | 66 | .type = IIO_TEMP, |
65 | .channel = 2, | 67 | .channel = 2, |
66 | .address = AXP288_GP_ADC_H, | 68 | .address = AXP288_GP_ADC_H, |
67 | .datasheet_name = "GPADC", | 69 | .datasheet_name = "GPADC", |
70 | .info_mask_separate = BIT(IIO_CHAN_INFO_RAW), | ||
68 | }, { | 71 | }, { |
69 | .indexed = 1, | 72 | .indexed = 1, |
70 | .type = IIO_CURRENT, | 73 | .type = IIO_CURRENT, |
71 | .channel = 3, | 74 | .channel = 3, |
72 | .address = AXP20X_BATT_CHRG_I_H, | 75 | .address = AXP20X_BATT_CHRG_I_H, |
73 | .datasheet_name = "BATT_CHG_I", | 76 | .datasheet_name = "BATT_CHG_I", |
74 | .info_mask_separate = BIT(IIO_CHAN_INFO_PROCESSED), | 77 | .info_mask_separate = BIT(IIO_CHAN_INFO_RAW), |
75 | }, { | 78 | }, { |
76 | .indexed = 1, | 79 | .indexed = 1, |
77 | .type = IIO_CURRENT, | 80 | .type = IIO_CURRENT, |
78 | .channel = 4, | 81 | .channel = 4, |
79 | .address = AXP20X_BATT_DISCHRG_I_H, | 82 | .address = AXP20X_BATT_DISCHRG_I_H, |
80 | .datasheet_name = "BATT_DISCHRG_I", | 83 | .datasheet_name = "BATT_DISCHRG_I", |
81 | .info_mask_separate = BIT(IIO_CHAN_INFO_PROCESSED), | 84 | .info_mask_separate = BIT(IIO_CHAN_INFO_RAW), |
82 | }, { | 85 | }, { |
83 | .indexed = 1, | 86 | .indexed = 1, |
84 | .type = IIO_VOLTAGE, | 87 | .type = IIO_VOLTAGE, |
85 | .channel = 5, | 88 | .channel = 5, |
86 | .address = AXP20X_BATT_V_H, | 89 | .address = AXP20X_BATT_V_H, |
87 | .datasheet_name = "BATT_V", | 90 | .datasheet_name = "BATT_V", |
88 | .info_mask_separate = BIT(IIO_CHAN_INFO_PROCESSED), | 91 | .info_mask_separate = BIT(IIO_CHAN_INFO_RAW), |
89 | }, | 92 | }, |
90 | }; | 93 | }; |
91 | 94 | ||
@@ -151,9 +154,6 @@ static int axp288_adc_read_raw(struct iio_dev *indio_dev, | |||
151 | chan->address)) | 154 | chan->address)) |
152 | dev_err(&indio_dev->dev, "TS pin restore\n"); | 155 | dev_err(&indio_dev->dev, "TS pin restore\n"); |
153 | break; | 156 | break; |
154 | case IIO_CHAN_INFO_PROCESSED: | ||
155 | ret = axp288_adc_read_channel(val, chan->address, info->regmap); | ||
156 | break; | ||
157 | default: | 157 | default: |
158 | ret = -EINVAL; | 158 | ret = -EINVAL; |
159 | } | 159 | } |
diff --git a/drivers/iio/adc/cc10001_adc.c b/drivers/iio/adc/cc10001_adc.c index 51e2a83c9404..115f6e99a7fa 100644 --- a/drivers/iio/adc/cc10001_adc.c +++ b/drivers/iio/adc/cc10001_adc.c | |||
@@ -35,8 +35,9 @@ | |||
35 | #define CC10001_ADC_EOC_SET BIT(0) | 35 | #define CC10001_ADC_EOC_SET BIT(0) |
36 | 36 | ||
37 | #define CC10001_ADC_CHSEL_SAMPLED 0x0c | 37 | #define CC10001_ADC_CHSEL_SAMPLED 0x0c |
38 | #define CC10001_ADC_POWER_UP 0x10 | 38 | #define CC10001_ADC_POWER_DOWN 0x10 |
39 | #define CC10001_ADC_POWER_UP_SET BIT(0) | 39 | #define CC10001_ADC_POWER_DOWN_SET BIT(0) |
40 | |||
40 | #define CC10001_ADC_DEBUG 0x14 | 41 | #define CC10001_ADC_DEBUG 0x14 |
41 | #define CC10001_ADC_DATA_COUNT 0x20 | 42 | #define CC10001_ADC_DATA_COUNT 0x20 |
42 | 43 | ||
@@ -62,7 +63,6 @@ struct cc10001_adc_device { | |||
62 | u16 *buf; | 63 | u16 *buf; |
63 | 64 | ||
64 | struct mutex lock; | 65 | struct mutex lock; |
65 | unsigned long channel_map; | ||
66 | unsigned int start_delay_ns; | 66 | unsigned int start_delay_ns; |
67 | unsigned int eoc_delay_ns; | 67 | unsigned int eoc_delay_ns; |
68 | }; | 68 | }; |
@@ -79,6 +79,18 @@ static inline u32 cc10001_adc_read_reg(struct cc10001_adc_device *adc_dev, | |||
79 | return readl(adc_dev->reg_base + reg); | 79 | return readl(adc_dev->reg_base + reg); |
80 | } | 80 | } |
81 | 81 | ||
82 | static void cc10001_adc_power_up(struct cc10001_adc_device *adc_dev) | ||
83 | { | ||
84 | cc10001_adc_write_reg(adc_dev, CC10001_ADC_POWER_DOWN, 0); | ||
85 | ndelay(adc_dev->start_delay_ns); | ||
86 | } | ||
87 | |||
88 | static void cc10001_adc_power_down(struct cc10001_adc_device *adc_dev) | ||
89 | { | ||
90 | cc10001_adc_write_reg(adc_dev, CC10001_ADC_POWER_DOWN, | ||
91 | CC10001_ADC_POWER_DOWN_SET); | ||
92 | } | ||
93 | |||
82 | static void cc10001_adc_start(struct cc10001_adc_device *adc_dev, | 94 | static void cc10001_adc_start(struct cc10001_adc_device *adc_dev, |
83 | unsigned int channel) | 95 | unsigned int channel) |
84 | { | 96 | { |
@@ -88,6 +100,7 @@ static void cc10001_adc_start(struct cc10001_adc_device *adc_dev, | |||
88 | val = (channel & CC10001_ADC_CH_MASK) | CC10001_ADC_MODE_SINGLE_CONV; | 100 | val = (channel & CC10001_ADC_CH_MASK) | CC10001_ADC_MODE_SINGLE_CONV; |
89 | cc10001_adc_write_reg(adc_dev, CC10001_ADC_CONFIG, val); | 101 | cc10001_adc_write_reg(adc_dev, CC10001_ADC_CONFIG, val); |
90 | 102 | ||
103 | udelay(1); | ||
91 | val = cc10001_adc_read_reg(adc_dev, CC10001_ADC_CONFIG); | 104 | val = cc10001_adc_read_reg(adc_dev, CC10001_ADC_CONFIG); |
92 | val = val | CC10001_ADC_START_CONV; | 105 | val = val | CC10001_ADC_START_CONV; |
93 | cc10001_adc_write_reg(adc_dev, CC10001_ADC_CONFIG, val); | 106 | cc10001_adc_write_reg(adc_dev, CC10001_ADC_CONFIG, val); |
@@ -129,6 +142,7 @@ static irqreturn_t cc10001_adc_trigger_h(int irq, void *p) | |||
129 | struct iio_dev *indio_dev; | 142 | struct iio_dev *indio_dev; |
130 | unsigned int delay_ns; | 143 | unsigned int delay_ns; |
131 | unsigned int channel; | 144 | unsigned int channel; |
145 | unsigned int scan_idx; | ||
132 | bool sample_invalid; | 146 | bool sample_invalid; |
133 | u16 *data; | 147 | u16 *data; |
134 | int i; | 148 | int i; |
@@ -139,20 +153,17 @@ static irqreturn_t cc10001_adc_trigger_h(int irq, void *p) | |||
139 | 153 | ||
140 | mutex_lock(&adc_dev->lock); | 154 | mutex_lock(&adc_dev->lock); |
141 | 155 | ||
142 | cc10001_adc_write_reg(adc_dev, CC10001_ADC_POWER_UP, | 156 | cc10001_adc_power_up(adc_dev); |
143 | CC10001_ADC_POWER_UP_SET); | ||
144 | |||
145 | /* Wait for 8 (6+2) clock cycles before activating START */ | ||
146 | ndelay(adc_dev->start_delay_ns); | ||
147 | 157 | ||
148 | /* Calculate delay step for eoc and sampled data */ | 158 | /* Calculate delay step for eoc and sampled data */ |
149 | delay_ns = adc_dev->eoc_delay_ns / CC10001_MAX_POLL_COUNT; | 159 | delay_ns = adc_dev->eoc_delay_ns / CC10001_MAX_POLL_COUNT; |
150 | 160 | ||
151 | i = 0; | 161 | i = 0; |
152 | sample_invalid = false; | 162 | sample_invalid = false; |
153 | for_each_set_bit(channel, indio_dev->active_scan_mask, | 163 | for_each_set_bit(scan_idx, indio_dev->active_scan_mask, |
154 | indio_dev->masklength) { | 164 | indio_dev->masklength) { |
155 | 165 | ||
166 | channel = indio_dev->channels[scan_idx].channel; | ||
156 | cc10001_adc_start(adc_dev, channel); | 167 | cc10001_adc_start(adc_dev, channel); |
157 | 168 | ||
158 | data[i] = cc10001_adc_poll_done(indio_dev, channel, delay_ns); | 169 | data[i] = cc10001_adc_poll_done(indio_dev, channel, delay_ns); |
@@ -166,7 +177,7 @@ static irqreturn_t cc10001_adc_trigger_h(int irq, void *p) | |||
166 | } | 177 | } |
167 | 178 | ||
168 | done: | 179 | done: |
169 | cc10001_adc_write_reg(adc_dev, CC10001_ADC_POWER_UP, 0); | 180 | cc10001_adc_power_down(adc_dev); |
170 | 181 | ||
171 | mutex_unlock(&adc_dev->lock); | 182 | mutex_unlock(&adc_dev->lock); |
172 | 183 | ||
@@ -185,11 +196,7 @@ static u16 cc10001_adc_read_raw_voltage(struct iio_dev *indio_dev, | |||
185 | unsigned int delay_ns; | 196 | unsigned int delay_ns; |
186 | u16 val; | 197 | u16 val; |
187 | 198 | ||
188 | cc10001_adc_write_reg(adc_dev, CC10001_ADC_POWER_UP, | 199 | cc10001_adc_power_up(adc_dev); |
189 | CC10001_ADC_POWER_UP_SET); | ||
190 | |||
191 | /* Wait for 8 (6+2) clock cycles before activating START */ | ||
192 | ndelay(adc_dev->start_delay_ns); | ||
193 | 200 | ||
194 | /* Calculate delay step for eoc and sampled data */ | 201 | /* Calculate delay step for eoc and sampled data */ |
195 | delay_ns = adc_dev->eoc_delay_ns / CC10001_MAX_POLL_COUNT; | 202 | delay_ns = adc_dev->eoc_delay_ns / CC10001_MAX_POLL_COUNT; |
@@ -198,7 +205,7 @@ static u16 cc10001_adc_read_raw_voltage(struct iio_dev *indio_dev, | |||
198 | 205 | ||
199 | val = cc10001_adc_poll_done(indio_dev, chan->channel, delay_ns); | 206 | val = cc10001_adc_poll_done(indio_dev, chan->channel, delay_ns); |
200 | 207 | ||
201 | cc10001_adc_write_reg(adc_dev, CC10001_ADC_POWER_UP, 0); | 208 | cc10001_adc_power_down(adc_dev); |
202 | 209 | ||
203 | return val; | 210 | return val; |
204 | } | 211 | } |
@@ -224,7 +231,7 @@ static int cc10001_adc_read_raw(struct iio_dev *indio_dev, | |||
224 | 231 | ||
225 | case IIO_CHAN_INFO_SCALE: | 232 | case IIO_CHAN_INFO_SCALE: |
226 | ret = regulator_get_voltage(adc_dev->reg); | 233 | ret = regulator_get_voltage(adc_dev->reg); |
227 | if (ret) | 234 | if (ret < 0) |
228 | return ret; | 235 | return ret; |
229 | 236 | ||
230 | *val = ret / 1000; | 237 | *val = ret / 1000; |
@@ -255,22 +262,22 @@ static const struct iio_info cc10001_adc_info = { | |||
255 | .update_scan_mode = &cc10001_update_scan_mode, | 262 | .update_scan_mode = &cc10001_update_scan_mode, |
256 | }; | 263 | }; |
257 | 264 | ||
258 | static int cc10001_adc_channel_init(struct iio_dev *indio_dev) | 265 | static int cc10001_adc_channel_init(struct iio_dev *indio_dev, |
266 | unsigned long channel_map) | ||
259 | { | 267 | { |
260 | struct cc10001_adc_device *adc_dev = iio_priv(indio_dev); | ||
261 | struct iio_chan_spec *chan_array, *timestamp; | 268 | struct iio_chan_spec *chan_array, *timestamp; |
262 | unsigned int bit, idx = 0; | 269 | unsigned int bit, idx = 0; |
263 | 270 | ||
264 | indio_dev->num_channels = bitmap_weight(&adc_dev->channel_map, | 271 | indio_dev->num_channels = bitmap_weight(&channel_map, |
265 | CC10001_ADC_NUM_CHANNELS); | 272 | CC10001_ADC_NUM_CHANNELS) + 1; |
266 | 273 | ||
267 | chan_array = devm_kcalloc(&indio_dev->dev, indio_dev->num_channels + 1, | 274 | chan_array = devm_kcalloc(&indio_dev->dev, indio_dev->num_channels, |
268 | sizeof(struct iio_chan_spec), | 275 | sizeof(struct iio_chan_spec), |
269 | GFP_KERNEL); | 276 | GFP_KERNEL); |
270 | if (!chan_array) | 277 | if (!chan_array) |
271 | return -ENOMEM; | 278 | return -ENOMEM; |
272 | 279 | ||
273 | for_each_set_bit(bit, &adc_dev->channel_map, CC10001_ADC_NUM_CHANNELS) { | 280 | for_each_set_bit(bit, &channel_map, CC10001_ADC_NUM_CHANNELS) { |
274 | struct iio_chan_spec *chan = &chan_array[idx]; | 281 | struct iio_chan_spec *chan = &chan_array[idx]; |
275 | 282 | ||
276 | chan->type = IIO_VOLTAGE; | 283 | chan->type = IIO_VOLTAGE; |
@@ -305,6 +312,7 @@ static int cc10001_adc_probe(struct platform_device *pdev) | |||
305 | unsigned long adc_clk_rate; | 312 | unsigned long adc_clk_rate; |
306 | struct resource *res; | 313 | struct resource *res; |
307 | struct iio_dev *indio_dev; | 314 | struct iio_dev *indio_dev; |
315 | unsigned long channel_map; | ||
308 | int ret; | 316 | int ret; |
309 | 317 | ||
310 | indio_dev = devm_iio_device_alloc(&pdev->dev, sizeof(*adc_dev)); | 318 | indio_dev = devm_iio_device_alloc(&pdev->dev, sizeof(*adc_dev)); |
@@ -313,9 +321,9 @@ static int cc10001_adc_probe(struct platform_device *pdev) | |||
313 | 321 | ||
314 | adc_dev = iio_priv(indio_dev); | 322 | adc_dev = iio_priv(indio_dev); |
315 | 323 | ||
316 | adc_dev->channel_map = GENMASK(CC10001_ADC_NUM_CHANNELS - 1, 0); | 324 | channel_map = GENMASK(CC10001_ADC_NUM_CHANNELS - 1, 0); |
317 | if (!of_property_read_u32(node, "adc-reserved-channels", &ret)) | 325 | if (!of_property_read_u32(node, "adc-reserved-channels", &ret)) |
318 | adc_dev->channel_map &= ~ret; | 326 | channel_map &= ~ret; |
319 | 327 | ||
320 | adc_dev->reg = devm_regulator_get(&pdev->dev, "vref"); | 328 | adc_dev->reg = devm_regulator_get(&pdev->dev, "vref"); |
321 | if (IS_ERR(adc_dev->reg)) | 329 | if (IS_ERR(adc_dev->reg)) |
@@ -361,7 +369,7 @@ static int cc10001_adc_probe(struct platform_device *pdev) | |||
361 | adc_dev->start_delay_ns = adc_dev->eoc_delay_ns * CC10001_WAIT_CYCLES; | 369 | adc_dev->start_delay_ns = adc_dev->eoc_delay_ns * CC10001_WAIT_CYCLES; |
362 | 370 | ||
363 | /* Setup the ADC channels available on the device */ | 371 | /* Setup the ADC channels available on the device */ |
364 | ret = cc10001_adc_channel_init(indio_dev); | 372 | ret = cc10001_adc_channel_init(indio_dev, channel_map); |
365 | if (ret < 0) | 373 | if (ret < 0) |
366 | goto err_disable_clk; | 374 | goto err_disable_clk; |
367 | 375 | ||
diff --git a/drivers/iio/adc/mcp320x.c b/drivers/iio/adc/mcp320x.c index efbfd12a4bfd..8d9c9b9215dd 100644 --- a/drivers/iio/adc/mcp320x.c +++ b/drivers/iio/adc/mcp320x.c | |||
@@ -60,12 +60,12 @@ struct mcp320x { | |||
60 | struct spi_message msg; | 60 | struct spi_message msg; |
61 | struct spi_transfer transfer[2]; | 61 | struct spi_transfer transfer[2]; |
62 | 62 | ||
63 | u8 tx_buf; | ||
64 | u8 rx_buf[2]; | ||
65 | |||
66 | struct regulator *reg; | 63 | struct regulator *reg; |
67 | struct mutex lock; | 64 | struct mutex lock; |
68 | const struct mcp320x_chip_info *chip_info; | 65 | const struct mcp320x_chip_info *chip_info; |
66 | |||
67 | u8 tx_buf ____cacheline_aligned; | ||
68 | u8 rx_buf[2]; | ||
69 | }; | 69 | }; |
70 | 70 | ||
71 | static int mcp320x_channel_to_tx_data(int device_index, | 71 | static int mcp320x_channel_to_tx_data(int device_index, |
diff --git a/drivers/iio/adc/qcom-spmi-vadc.c b/drivers/iio/adc/qcom-spmi-vadc.c index 3211729bcb0b..0c4618b4d515 100644 --- a/drivers/iio/adc/qcom-spmi-vadc.c +++ b/drivers/iio/adc/qcom-spmi-vadc.c | |||
@@ -18,6 +18,7 @@ | |||
18 | #include <linux/iio/iio.h> | 18 | #include <linux/iio/iio.h> |
19 | #include <linux/interrupt.h> | 19 | #include <linux/interrupt.h> |
20 | #include <linux/kernel.h> | 20 | #include <linux/kernel.h> |
21 | #include <linux/math64.h> | ||
21 | #include <linux/module.h> | 22 | #include <linux/module.h> |
22 | #include <linux/of.h> | 23 | #include <linux/of.h> |
23 | #include <linux/platform_device.h> | 24 | #include <linux/platform_device.h> |
@@ -471,11 +472,11 @@ static s32 vadc_calibrate(struct vadc_priv *vadc, | |||
471 | const struct vadc_channel_prop *prop, u16 adc_code) | 472 | const struct vadc_channel_prop *prop, u16 adc_code) |
472 | { | 473 | { |
473 | const struct vadc_prescale_ratio *prescale; | 474 | const struct vadc_prescale_ratio *prescale; |
474 | s32 voltage; | 475 | s64 voltage; |
475 | 476 | ||
476 | voltage = adc_code - vadc->graph[prop->calibration].gnd; | 477 | voltage = adc_code - vadc->graph[prop->calibration].gnd; |
477 | voltage *= vadc->graph[prop->calibration].dx; | 478 | voltage *= vadc->graph[prop->calibration].dx; |
478 | voltage = voltage / vadc->graph[prop->calibration].dy; | 479 | voltage = div64_s64(voltage, vadc->graph[prop->calibration].dy); |
479 | 480 | ||
480 | if (prop->calibration == VADC_CALIB_ABSOLUTE) | 481 | if (prop->calibration == VADC_CALIB_ABSOLUTE) |
481 | voltage += vadc->graph[prop->calibration].dx; | 482 | voltage += vadc->graph[prop->calibration].dx; |
@@ -487,7 +488,7 @@ static s32 vadc_calibrate(struct vadc_priv *vadc, | |||
487 | 488 | ||
488 | voltage = voltage * prescale->den; | 489 | voltage = voltage * prescale->den; |
489 | 490 | ||
490 | return voltage / prescale->num; | 491 | return div64_s64(voltage, prescale->num); |
491 | } | 492 | } |
492 | 493 | ||
493 | static int vadc_decimation_from_dt(u32 value) | 494 | static int vadc_decimation_from_dt(u32 value) |
diff --git a/drivers/iio/adc/xilinx-xadc-core.c b/drivers/iio/adc/xilinx-xadc-core.c index a221f7329b79..ce93bd8e3f68 100644 --- a/drivers/iio/adc/xilinx-xadc-core.c +++ b/drivers/iio/adc/xilinx-xadc-core.c | |||
@@ -856,6 +856,7 @@ static int xadc_read_raw(struct iio_dev *indio_dev, | |||
856 | switch (chan->address) { | 856 | switch (chan->address) { |
857 | case XADC_REG_VCCINT: | 857 | case XADC_REG_VCCINT: |
858 | case XADC_REG_VCCAUX: | 858 | case XADC_REG_VCCAUX: |
859 | case XADC_REG_VREFP: | ||
859 | case XADC_REG_VCCBRAM: | 860 | case XADC_REG_VCCBRAM: |
860 | case XADC_REG_VCCPINT: | 861 | case XADC_REG_VCCPINT: |
861 | case XADC_REG_VCCPAUX: | 862 | case XADC_REG_VCCPAUX: |
@@ -996,7 +997,7 @@ static const struct iio_event_spec xadc_voltage_events[] = { | |||
996 | .num_event_specs = (_alarm) ? ARRAY_SIZE(xadc_voltage_events) : 0, \ | 997 | .num_event_specs = (_alarm) ? ARRAY_SIZE(xadc_voltage_events) : 0, \ |
997 | .scan_index = (_scan_index), \ | 998 | .scan_index = (_scan_index), \ |
998 | .scan_type = { \ | 999 | .scan_type = { \ |
999 | .sign = 'u', \ | 1000 | .sign = ((_addr) == XADC_REG_VREFN) ? 's' : 'u', \ |
1000 | .realbits = 12, \ | 1001 | .realbits = 12, \ |
1001 | .storagebits = 16, \ | 1002 | .storagebits = 16, \ |
1002 | .shift = 4, \ | 1003 | .shift = 4, \ |
@@ -1008,7 +1009,7 @@ static const struct iio_event_spec xadc_voltage_events[] = { | |||
1008 | static const struct iio_chan_spec xadc_channels[] = { | 1009 | static const struct iio_chan_spec xadc_channels[] = { |
1009 | XADC_CHAN_TEMP(0, 8, XADC_REG_TEMP), | 1010 | XADC_CHAN_TEMP(0, 8, XADC_REG_TEMP), |
1010 | XADC_CHAN_VOLTAGE(0, 9, XADC_REG_VCCINT, "vccint", true), | 1011 | XADC_CHAN_VOLTAGE(0, 9, XADC_REG_VCCINT, "vccint", true), |
1011 | XADC_CHAN_VOLTAGE(1, 10, XADC_REG_VCCINT, "vccaux", true), | 1012 | XADC_CHAN_VOLTAGE(1, 10, XADC_REG_VCCAUX, "vccaux", true), |
1012 | XADC_CHAN_VOLTAGE(2, 14, XADC_REG_VCCBRAM, "vccbram", true), | 1013 | XADC_CHAN_VOLTAGE(2, 14, XADC_REG_VCCBRAM, "vccbram", true), |
1013 | XADC_CHAN_VOLTAGE(3, 5, XADC_REG_VCCPINT, "vccpint", true), | 1014 | XADC_CHAN_VOLTAGE(3, 5, XADC_REG_VCCPINT, "vccpint", true), |
1014 | XADC_CHAN_VOLTAGE(4, 6, XADC_REG_VCCPAUX, "vccpaux", true), | 1015 | XADC_CHAN_VOLTAGE(4, 6, XADC_REG_VCCPAUX, "vccpaux", true), |
diff --git a/drivers/iio/adc/xilinx-xadc.h b/drivers/iio/adc/xilinx-xadc.h index c7487e8d7f80..54adc5087210 100644 --- a/drivers/iio/adc/xilinx-xadc.h +++ b/drivers/iio/adc/xilinx-xadc.h | |||
@@ -145,9 +145,9 @@ static inline int xadc_write_adc_reg(struct xadc *xadc, unsigned int reg, | |||
145 | #define XADC_REG_MAX_VCCPINT 0x28 | 145 | #define XADC_REG_MAX_VCCPINT 0x28 |
146 | #define XADC_REG_MAX_VCCPAUX 0x29 | 146 | #define XADC_REG_MAX_VCCPAUX 0x29 |
147 | #define XADC_REG_MAX_VCCO_DDR 0x2a | 147 | #define XADC_REG_MAX_VCCO_DDR 0x2a |
148 | #define XADC_REG_MIN_VCCPINT 0x2b | 148 | #define XADC_REG_MIN_VCCPINT 0x2c |
149 | #define XADC_REG_MIN_VCCPAUX 0x2c | 149 | #define XADC_REG_MIN_VCCPAUX 0x2d |
150 | #define XADC_REG_MIN_VCCO_DDR 0x2d | 150 | #define XADC_REG_MIN_VCCO_DDR 0x2e |
151 | 151 | ||
152 | #define XADC_REG_CONF0 0x40 | 152 | #define XADC_REG_CONF0 0x40 |
153 | #define XADC_REG_CONF1 0x41 | 153 | #define XADC_REG_CONF1 0x41 |
diff --git a/drivers/iio/common/st_sensors/st_sensors_core.c b/drivers/iio/common/st_sensors/st_sensors_core.c index edd13d2b4121..8dd0477e201c 100644 --- a/drivers/iio/common/st_sensors/st_sensors_core.c +++ b/drivers/iio/common/st_sensors/st_sensors_core.c | |||
@@ -304,8 +304,6 @@ int st_sensors_init_sensor(struct iio_dev *indio_dev, | |||
304 | struct st_sensors_platform_data *of_pdata; | 304 | struct st_sensors_platform_data *of_pdata; |
305 | int err = 0; | 305 | int err = 0; |
306 | 306 | ||
307 | mutex_init(&sdata->tb.buf_lock); | ||
308 | |||
309 | /* If OF/DT pdata exists, it will take precedence of anything else */ | 307 | /* If OF/DT pdata exists, it will take precedence of anything else */ |
310 | of_pdata = st_sensors_of_probe(indio_dev->dev.parent, pdata); | 308 | of_pdata = st_sensors_of_probe(indio_dev->dev.parent, pdata); |
311 | if (of_pdata) | 309 | if (of_pdata) |
diff --git a/drivers/iio/gyro/st_gyro_core.c b/drivers/iio/gyro/st_gyro_core.c index 21395f26d227..ffe96642b6d0 100644 --- a/drivers/iio/gyro/st_gyro_core.c +++ b/drivers/iio/gyro/st_gyro_core.c | |||
@@ -400,6 +400,7 @@ int st_gyro_common_probe(struct iio_dev *indio_dev) | |||
400 | 400 | ||
401 | indio_dev->modes = INDIO_DIRECT_MODE; | 401 | indio_dev->modes = INDIO_DIRECT_MODE; |
402 | indio_dev->info = &gyro_info; | 402 | indio_dev->info = &gyro_info; |
403 | mutex_init(&gdata->tb.buf_lock); | ||
403 | 404 | ||
404 | st_sensors_power_enable(indio_dev); | 405 | st_sensors_power_enable(indio_dev); |
405 | 406 | ||
diff --git a/drivers/iio/kfifo_buf.c b/drivers/iio/kfifo_buf.c index 847ca561afe0..55c267bbfd2f 100644 --- a/drivers/iio/kfifo_buf.c +++ b/drivers/iio/kfifo_buf.c | |||
@@ -38,7 +38,8 @@ static int iio_request_update_kfifo(struct iio_buffer *r) | |||
38 | kfifo_free(&buf->kf); | 38 | kfifo_free(&buf->kf); |
39 | ret = __iio_allocate_kfifo(buf, buf->buffer.bytes_per_datum, | 39 | ret = __iio_allocate_kfifo(buf, buf->buffer.bytes_per_datum, |
40 | buf->buffer.length); | 40 | buf->buffer.length); |
41 | buf->update_needed = false; | 41 | if (ret >= 0) |
42 | buf->update_needed = false; | ||
42 | } else { | 43 | } else { |
43 | kfifo_reset_out(&buf->kf); | 44 | kfifo_reset_out(&buf->kf); |
44 | } | 45 | } |
diff --git a/drivers/iio/light/hid-sensor-prox.c b/drivers/iio/light/hid-sensor-prox.c index 91ecc46ffeaa..ef60bae738e3 100644 --- a/drivers/iio/light/hid-sensor-prox.c +++ b/drivers/iio/light/hid-sensor-prox.c | |||
@@ -43,8 +43,6 @@ struct prox_state { | |||
43 | static const struct iio_chan_spec prox_channels[] = { | 43 | static const struct iio_chan_spec prox_channels[] = { |
44 | { | 44 | { |
45 | .type = IIO_PROXIMITY, | 45 | .type = IIO_PROXIMITY, |
46 | .modified = 1, | ||
47 | .channel2 = IIO_NO_MOD, | ||
48 | .info_mask_separate = BIT(IIO_CHAN_INFO_RAW), | 46 | .info_mask_separate = BIT(IIO_CHAN_INFO_RAW), |
49 | .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_OFFSET) | | 47 | .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_OFFSET) | |
50 | BIT(IIO_CHAN_INFO_SCALE) | | 48 | BIT(IIO_CHAN_INFO_SCALE) | |
@@ -253,7 +251,6 @@ static int hid_prox_probe(struct platform_device *pdev) | |||
253 | struct iio_dev *indio_dev; | 251 | struct iio_dev *indio_dev; |
254 | struct prox_state *prox_state; | 252 | struct prox_state *prox_state; |
255 | struct hid_sensor_hub_device *hsdev = pdev->dev.platform_data; | 253 | struct hid_sensor_hub_device *hsdev = pdev->dev.platform_data; |
256 | struct iio_chan_spec *channels; | ||
257 | 254 | ||
258 | indio_dev = devm_iio_device_alloc(&pdev->dev, | 255 | indio_dev = devm_iio_device_alloc(&pdev->dev, |
259 | sizeof(struct prox_state)); | 256 | sizeof(struct prox_state)); |
@@ -272,20 +269,21 @@ static int hid_prox_probe(struct platform_device *pdev) | |||
272 | return ret; | 269 | return ret; |
273 | } | 270 | } |
274 | 271 | ||
275 | channels = kmemdup(prox_channels, sizeof(prox_channels), GFP_KERNEL); | 272 | indio_dev->channels = kmemdup(prox_channels, sizeof(prox_channels), |
276 | if (!channels) { | 273 | GFP_KERNEL); |
274 | if (!indio_dev->channels) { | ||
277 | dev_err(&pdev->dev, "failed to duplicate channels\n"); | 275 | dev_err(&pdev->dev, "failed to duplicate channels\n"); |
278 | return -ENOMEM; | 276 | return -ENOMEM; |
279 | } | 277 | } |
280 | 278 | ||
281 | ret = prox_parse_report(pdev, hsdev, channels, | 279 | ret = prox_parse_report(pdev, hsdev, |
280 | (struct iio_chan_spec *)indio_dev->channels, | ||
282 | HID_USAGE_SENSOR_PROX, prox_state); | 281 | HID_USAGE_SENSOR_PROX, prox_state); |
283 | if (ret) { | 282 | if (ret) { |
284 | dev_err(&pdev->dev, "failed to setup attributes\n"); | 283 | dev_err(&pdev->dev, "failed to setup attributes\n"); |
285 | goto error_free_dev_mem; | 284 | goto error_free_dev_mem; |
286 | } | 285 | } |
287 | 286 | ||
288 | indio_dev->channels = channels; | ||
289 | indio_dev->num_channels = | 287 | indio_dev->num_channels = |
290 | ARRAY_SIZE(prox_channels); | 288 | ARRAY_SIZE(prox_channels); |
291 | indio_dev->dev.parent = &pdev->dev; | 289 | indio_dev->dev.parent = &pdev->dev; |
diff --git a/drivers/iio/magnetometer/st_magn_core.c b/drivers/iio/magnetometer/st_magn_core.c index 8ade473f99fe..2e56f812a644 100644 --- a/drivers/iio/magnetometer/st_magn_core.c +++ b/drivers/iio/magnetometer/st_magn_core.c | |||
@@ -369,6 +369,7 @@ int st_magn_common_probe(struct iio_dev *indio_dev) | |||
369 | 369 | ||
370 | indio_dev->modes = INDIO_DIRECT_MODE; | 370 | indio_dev->modes = INDIO_DIRECT_MODE; |
371 | indio_dev->info = &magn_info; | 371 | indio_dev->info = &magn_info; |
372 | mutex_init(&mdata->tb.buf_lock); | ||
372 | 373 | ||
373 | st_sensors_power_enable(indio_dev); | 374 | st_sensors_power_enable(indio_dev); |
374 | 375 | ||
diff --git a/drivers/iio/pressure/bmp280.c b/drivers/iio/pressure/bmp280.c index 7c623e2bd633..a2602d8dd6d5 100644 --- a/drivers/iio/pressure/bmp280.c +++ b/drivers/iio/pressure/bmp280.c | |||
@@ -172,6 +172,7 @@ static s32 bmp280_compensate_temp(struct bmp280_data *data, | |||
172 | var2 = (((((adc_temp >> 4) - ((s32)le16_to_cpu(buf[T1]))) * | 172 | var2 = (((((adc_temp >> 4) - ((s32)le16_to_cpu(buf[T1]))) * |
173 | ((adc_temp >> 4) - ((s32)le16_to_cpu(buf[T1])))) >> 12) * | 173 | ((adc_temp >> 4) - ((s32)le16_to_cpu(buf[T1])))) >> 12) * |
174 | ((s32)(s16)le16_to_cpu(buf[T3]))) >> 14; | 174 | ((s32)(s16)le16_to_cpu(buf[T3]))) >> 14; |
175 | data->t_fine = var1 + var2; | ||
175 | 176 | ||
176 | return (data->t_fine * 5 + 128) >> 8; | 177 | return (data->t_fine * 5 + 128) >> 8; |
177 | } | 178 | } |
diff --git a/drivers/iio/pressure/hid-sensor-press.c b/drivers/iio/pressure/hid-sensor-press.c index 7bb8d4c1f7df..3cf0bd67d24c 100644 --- a/drivers/iio/pressure/hid-sensor-press.c +++ b/drivers/iio/pressure/hid-sensor-press.c | |||
@@ -47,8 +47,6 @@ struct press_state { | |||
47 | static const struct iio_chan_spec press_channels[] = { | 47 | static const struct iio_chan_spec press_channels[] = { |
48 | { | 48 | { |
49 | .type = IIO_PRESSURE, | 49 | .type = IIO_PRESSURE, |
50 | .modified = 1, | ||
51 | .channel2 = IIO_NO_MOD, | ||
52 | .info_mask_separate = BIT(IIO_CHAN_INFO_RAW), | 50 | .info_mask_separate = BIT(IIO_CHAN_INFO_RAW), |
53 | .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_OFFSET) | | 51 | .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_OFFSET) | |
54 | BIT(IIO_CHAN_INFO_SCALE) | | 52 | BIT(IIO_CHAN_INFO_SCALE) | |
diff --git a/drivers/iio/pressure/st_pressure_core.c b/drivers/iio/pressure/st_pressure_core.c index 97baf40d424b..e881fa6291e9 100644 --- a/drivers/iio/pressure/st_pressure_core.c +++ b/drivers/iio/pressure/st_pressure_core.c | |||
@@ -417,6 +417,7 @@ int st_press_common_probe(struct iio_dev *indio_dev) | |||
417 | 417 | ||
418 | indio_dev->modes = INDIO_DIRECT_MODE; | 418 | indio_dev->modes = INDIO_DIRECT_MODE; |
419 | indio_dev->info = &press_info; | 419 | indio_dev->info = &press_info; |
420 | mutex_init(&press_data->tb.buf_lock); | ||
420 | 421 | ||
421 | st_sensors_power_enable(indio_dev); | 422 | st_sensors_power_enable(indio_dev); |
422 | 423 | ||
diff --git a/drivers/infiniband/core/cm.c b/drivers/infiniband/core/cm.c index 0c1419105ff0..0271608a51c4 100644 --- a/drivers/infiniband/core/cm.c +++ b/drivers/infiniband/core/cm.c | |||
@@ -861,6 +861,7 @@ retest: | |||
861 | cm_reject_sidr_req(cm_id_priv, IB_SIDR_REJECT); | 861 | cm_reject_sidr_req(cm_id_priv, IB_SIDR_REJECT); |
862 | break; | 862 | break; |
863 | case IB_CM_REQ_SENT: | 863 | case IB_CM_REQ_SENT: |
864 | case IB_CM_MRA_REQ_RCVD: | ||
864 | ib_cancel_mad(cm_id_priv->av.port->mad_agent, cm_id_priv->msg); | 865 | ib_cancel_mad(cm_id_priv->av.port->mad_agent, cm_id_priv->msg); |
865 | spin_unlock_irq(&cm_id_priv->lock); | 866 | spin_unlock_irq(&cm_id_priv->lock); |
866 | ib_send_cm_rej(cm_id, IB_CM_REJ_TIMEOUT, | 867 | ib_send_cm_rej(cm_id, IB_CM_REJ_TIMEOUT, |
@@ -879,7 +880,6 @@ retest: | |||
879 | NULL, 0, NULL, 0); | 880 | NULL, 0, NULL, 0); |
880 | } | 881 | } |
881 | break; | 882 | break; |
882 | case IB_CM_MRA_REQ_RCVD: | ||
883 | case IB_CM_REP_SENT: | 883 | case IB_CM_REP_SENT: |
884 | case IB_CM_MRA_REP_RCVD: | 884 | case IB_CM_MRA_REP_RCVD: |
885 | ib_cancel_mad(cm_id_priv->av.port->mad_agent, cm_id_priv->msg); | 885 | ib_cancel_mad(cm_id_priv->av.port->mad_agent, cm_id_priv->msg); |
diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c index 06441a43c3aa..38ffe0981503 100644 --- a/drivers/infiniband/core/cma.c +++ b/drivers/infiniband/core/cma.c | |||
@@ -845,18 +845,26 @@ static void cma_save_ib_info(struct rdma_cm_id *id, struct rdma_cm_id *listen_id | |||
845 | listen_ib = (struct sockaddr_ib *) &listen_id->route.addr.src_addr; | 845 | listen_ib = (struct sockaddr_ib *) &listen_id->route.addr.src_addr; |
846 | ib = (struct sockaddr_ib *) &id->route.addr.src_addr; | 846 | ib = (struct sockaddr_ib *) &id->route.addr.src_addr; |
847 | ib->sib_family = listen_ib->sib_family; | 847 | ib->sib_family = listen_ib->sib_family; |
848 | ib->sib_pkey = path->pkey; | 848 | if (path) { |
849 | ib->sib_flowinfo = path->flow_label; | 849 | ib->sib_pkey = path->pkey; |
850 | memcpy(&ib->sib_addr, &path->sgid, 16); | 850 | ib->sib_flowinfo = path->flow_label; |
851 | memcpy(&ib->sib_addr, &path->sgid, 16); | ||
852 | } else { | ||
853 | ib->sib_pkey = listen_ib->sib_pkey; | ||
854 | ib->sib_flowinfo = listen_ib->sib_flowinfo; | ||
855 | ib->sib_addr = listen_ib->sib_addr; | ||
856 | } | ||
851 | ib->sib_sid = listen_ib->sib_sid; | 857 | ib->sib_sid = listen_ib->sib_sid; |
852 | ib->sib_sid_mask = cpu_to_be64(0xffffffffffffffffULL); | 858 | ib->sib_sid_mask = cpu_to_be64(0xffffffffffffffffULL); |
853 | ib->sib_scope_id = listen_ib->sib_scope_id; | 859 | ib->sib_scope_id = listen_ib->sib_scope_id; |
854 | 860 | ||
855 | ib = (struct sockaddr_ib *) &id->route.addr.dst_addr; | 861 | if (path) { |
856 | ib->sib_family = listen_ib->sib_family; | 862 | ib = (struct sockaddr_ib *) &id->route.addr.dst_addr; |
857 | ib->sib_pkey = path->pkey; | 863 | ib->sib_family = listen_ib->sib_family; |
858 | ib->sib_flowinfo = path->flow_label; | 864 | ib->sib_pkey = path->pkey; |
859 | memcpy(&ib->sib_addr, &path->dgid, 16); | 865 | ib->sib_flowinfo = path->flow_label; |
866 | memcpy(&ib->sib_addr, &path->dgid, 16); | ||
867 | } | ||
860 | } | 868 | } |
861 | 869 | ||
862 | static __be16 ss_get_port(const struct sockaddr_storage *ss) | 870 | static __be16 ss_get_port(const struct sockaddr_storage *ss) |
@@ -905,9 +913,11 @@ static int cma_save_net_info(struct rdma_cm_id *id, struct rdma_cm_id *listen_id | |||
905 | { | 913 | { |
906 | struct cma_hdr *hdr; | 914 | struct cma_hdr *hdr; |
907 | 915 | ||
908 | if ((listen_id->route.addr.src_addr.ss_family == AF_IB) && | 916 | if (listen_id->route.addr.src_addr.ss_family == AF_IB) { |
909 | (ib_event->event == IB_CM_REQ_RECEIVED)) { | 917 | if (ib_event->event == IB_CM_REQ_RECEIVED) |
910 | cma_save_ib_info(id, listen_id, ib_event->param.req_rcvd.primary_path); | 918 | cma_save_ib_info(id, listen_id, ib_event->param.req_rcvd.primary_path); |
919 | else if (ib_event->event == IB_CM_SIDR_REQ_RECEIVED) | ||
920 | cma_save_ib_info(id, listen_id, NULL); | ||
911 | return 0; | 921 | return 0; |
912 | } | 922 | } |
913 | 923 | ||
diff --git a/drivers/infiniband/hw/ocrdma/ocrdma.h b/drivers/infiniband/hw/ocrdma/ocrdma.h index c9780d919769..b396344fae16 100644 --- a/drivers/infiniband/hw/ocrdma/ocrdma.h +++ b/drivers/infiniband/hw/ocrdma/ocrdma.h | |||
@@ -40,7 +40,7 @@ | |||
40 | #include <be_roce.h> | 40 | #include <be_roce.h> |
41 | #include "ocrdma_sli.h" | 41 | #include "ocrdma_sli.h" |
42 | 42 | ||
43 | #define OCRDMA_ROCE_DRV_VERSION "10.4.205.0u" | 43 | #define OCRDMA_ROCE_DRV_VERSION "10.6.0.0" |
44 | 44 | ||
45 | #define OCRDMA_ROCE_DRV_DESC "Emulex OneConnect RoCE Driver" | 45 | #define OCRDMA_ROCE_DRV_DESC "Emulex OneConnect RoCE Driver" |
46 | #define OCRDMA_NODE_DESC "Emulex OneConnect RoCE HCA" | 46 | #define OCRDMA_NODE_DESC "Emulex OneConnect RoCE HCA" |
@@ -515,6 +515,8 @@ static inline int ocrdma_resolve_dmac(struct ocrdma_dev *dev, | |||
515 | memcpy(&in6, ah_attr->grh.dgid.raw, sizeof(in6)); | 515 | memcpy(&in6, ah_attr->grh.dgid.raw, sizeof(in6)); |
516 | if (rdma_is_multicast_addr(&in6)) | 516 | if (rdma_is_multicast_addr(&in6)) |
517 | rdma_get_mcast_mac(&in6, mac_addr); | 517 | rdma_get_mcast_mac(&in6, mac_addr); |
518 | else if (rdma_link_local_addr(&in6)) | ||
519 | rdma_get_ll_mac(&in6, mac_addr); | ||
518 | else | 520 | else |
519 | memcpy(mac_addr, ah_attr->dmac, ETH_ALEN); | 521 | memcpy(mac_addr, ah_attr->dmac, ETH_ALEN); |
520 | return 0; | 522 | return 0; |
diff --git a/drivers/infiniband/hw/ocrdma/ocrdma_ah.c b/drivers/infiniband/hw/ocrdma/ocrdma_ah.c index d812904f3984..f5a5ea836dbd 100644 --- a/drivers/infiniband/hw/ocrdma/ocrdma_ah.c +++ b/drivers/infiniband/hw/ocrdma/ocrdma_ah.c | |||
@@ -56,7 +56,13 @@ static inline int set_av_attr(struct ocrdma_dev *dev, struct ocrdma_ah *ah, | |||
56 | vlan_tag = attr->vlan_id; | 56 | vlan_tag = attr->vlan_id; |
57 | if (!vlan_tag || (vlan_tag > 0xFFF)) | 57 | if (!vlan_tag || (vlan_tag > 0xFFF)) |
58 | vlan_tag = dev->pvid; | 58 | vlan_tag = dev->pvid; |
59 | if (vlan_tag && (vlan_tag < 0x1000)) { | 59 | if (vlan_tag || dev->pfc_state) { |
60 | if (!vlan_tag) { | ||
61 | pr_err("ocrdma%d:Using VLAN with PFC is recommended\n", | ||
62 | dev->id); | ||
63 | pr_err("ocrdma%d:Using VLAN 0 for this connection\n", | ||
64 | dev->id); | ||
65 | } | ||
60 | eth.eth_type = cpu_to_be16(0x8100); | 66 | eth.eth_type = cpu_to_be16(0x8100); |
61 | eth.roce_eth_type = cpu_to_be16(OCRDMA_ROCE_ETH_TYPE); | 67 | eth.roce_eth_type = cpu_to_be16(OCRDMA_ROCE_ETH_TYPE); |
62 | vlan_tag |= (dev->sl & 0x07) << OCRDMA_VID_PCP_SHIFT; | 68 | vlan_tag |= (dev->sl & 0x07) << OCRDMA_VID_PCP_SHIFT; |
@@ -121,7 +127,9 @@ struct ib_ah *ocrdma_create_ah(struct ib_pd *ibpd, struct ib_ah_attr *attr) | |||
121 | goto av_conf_err; | 127 | goto av_conf_err; |
122 | } | 128 | } |
123 | 129 | ||
124 | if (pd->uctx) { | 130 | if ((pd->uctx) && |
131 | (!rdma_is_multicast_addr((struct in6_addr *)attr->grh.dgid.raw)) && | ||
132 | (!rdma_link_local_addr((struct in6_addr *)attr->grh.dgid.raw))) { | ||
125 | status = rdma_addr_find_dmac_by_grh(&sgid, &attr->grh.dgid, | 133 | status = rdma_addr_find_dmac_by_grh(&sgid, &attr->grh.dgid, |
126 | attr->dmac, &attr->vlan_id); | 134 | attr->dmac, &attr->vlan_id); |
127 | if (status) { | 135 | if (status) { |
diff --git a/drivers/infiniband/hw/ocrdma/ocrdma_hw.c b/drivers/infiniband/hw/ocrdma/ocrdma_hw.c index 0c9e95909a64..47615ff33bc6 100644 --- a/drivers/infiniband/hw/ocrdma/ocrdma_hw.c +++ b/drivers/infiniband/hw/ocrdma/ocrdma_hw.c | |||
@@ -933,12 +933,18 @@ static irqreturn_t ocrdma_irq_handler(int irq, void *handle) | |||
933 | struct ocrdma_eqe eqe; | 933 | struct ocrdma_eqe eqe; |
934 | struct ocrdma_eqe *ptr; | 934 | struct ocrdma_eqe *ptr; |
935 | u16 cq_id; | 935 | u16 cq_id; |
936 | u8 mcode; | ||
936 | int budget = eq->cq_cnt; | 937 | int budget = eq->cq_cnt; |
937 | 938 | ||
938 | do { | 939 | do { |
939 | ptr = ocrdma_get_eqe(eq); | 940 | ptr = ocrdma_get_eqe(eq); |
940 | eqe = *ptr; | 941 | eqe = *ptr; |
941 | ocrdma_le32_to_cpu(&eqe, sizeof(eqe)); | 942 | ocrdma_le32_to_cpu(&eqe, sizeof(eqe)); |
943 | mcode = (eqe.id_valid & OCRDMA_EQE_MAJOR_CODE_MASK) | ||
944 | >> OCRDMA_EQE_MAJOR_CODE_SHIFT; | ||
945 | if (mcode == OCRDMA_MAJOR_CODE_SENTINAL) | ||
946 | pr_err("EQ full on eqid = 0x%x, eqe = 0x%x\n", | ||
947 | eq->q.id, eqe.id_valid); | ||
942 | if ((eqe.id_valid & OCRDMA_EQE_VALID_MASK) == 0) | 948 | if ((eqe.id_valid & OCRDMA_EQE_VALID_MASK) == 0) |
943 | break; | 949 | break; |
944 | 950 | ||
@@ -1434,27 +1440,30 @@ static int ocrdma_mbx_alloc_pd_range(struct ocrdma_dev *dev) | |||
1434 | struct ocrdma_alloc_pd_range_rsp *rsp; | 1440 | struct ocrdma_alloc_pd_range_rsp *rsp; |
1435 | 1441 | ||
1436 | /* Pre allocate the DPP PDs */ | 1442 | /* Pre allocate the DPP PDs */ |
1437 | cmd = ocrdma_init_emb_mqe(OCRDMA_CMD_ALLOC_PD_RANGE, sizeof(*cmd)); | 1443 | if (dev->attr.max_dpp_pds) { |
1438 | if (!cmd) | 1444 | cmd = ocrdma_init_emb_mqe(OCRDMA_CMD_ALLOC_PD_RANGE, |
1439 | return -ENOMEM; | 1445 | sizeof(*cmd)); |
1440 | cmd->pd_count = dev->attr.max_dpp_pds; | 1446 | if (!cmd) |
1441 | cmd->enable_dpp_rsvd |= OCRDMA_ALLOC_PD_ENABLE_DPP; | 1447 | return -ENOMEM; |
1442 | status = ocrdma_mbx_cmd(dev, (struct ocrdma_mqe *)cmd); | 1448 | cmd->pd_count = dev->attr.max_dpp_pds; |
1443 | if (status) | 1449 | cmd->enable_dpp_rsvd |= OCRDMA_ALLOC_PD_ENABLE_DPP; |
1444 | goto mbx_err; | 1450 | status = ocrdma_mbx_cmd(dev, (struct ocrdma_mqe *)cmd); |
1445 | rsp = (struct ocrdma_alloc_pd_range_rsp *)cmd; | 1451 | rsp = (struct ocrdma_alloc_pd_range_rsp *)cmd; |
1446 | 1452 | ||
1447 | if ((rsp->dpp_page_pdid & OCRDMA_ALLOC_PD_RSP_DPP) && rsp->pd_count) { | 1453 | if (!status && (rsp->dpp_page_pdid & OCRDMA_ALLOC_PD_RSP_DPP) && |
1448 | dev->pd_mgr->dpp_page_index = rsp->dpp_page_pdid >> | 1454 | rsp->pd_count) { |
1449 | OCRDMA_ALLOC_PD_RSP_DPP_PAGE_SHIFT; | 1455 | dev->pd_mgr->dpp_page_index = rsp->dpp_page_pdid >> |
1450 | dev->pd_mgr->pd_dpp_start = rsp->dpp_page_pdid & | 1456 | OCRDMA_ALLOC_PD_RSP_DPP_PAGE_SHIFT; |
1451 | OCRDMA_ALLOC_PD_RNG_RSP_START_PDID_MASK; | 1457 | dev->pd_mgr->pd_dpp_start = rsp->dpp_page_pdid & |
1452 | dev->pd_mgr->max_dpp_pd = rsp->pd_count; | 1458 | OCRDMA_ALLOC_PD_RNG_RSP_START_PDID_MASK; |
1453 | pd_bitmap_size = BITS_TO_LONGS(rsp->pd_count) * sizeof(long); | 1459 | dev->pd_mgr->max_dpp_pd = rsp->pd_count; |
1454 | dev->pd_mgr->pd_dpp_bitmap = kzalloc(pd_bitmap_size, | 1460 | pd_bitmap_size = |
1455 | GFP_KERNEL); | 1461 | BITS_TO_LONGS(rsp->pd_count) * sizeof(long); |
1462 | dev->pd_mgr->pd_dpp_bitmap = kzalloc(pd_bitmap_size, | ||
1463 | GFP_KERNEL); | ||
1464 | } | ||
1465 | kfree(cmd); | ||
1456 | } | 1466 | } |
1457 | kfree(cmd); | ||
1458 | 1467 | ||
1459 | cmd = ocrdma_init_emb_mqe(OCRDMA_CMD_ALLOC_PD_RANGE, sizeof(*cmd)); | 1468 | cmd = ocrdma_init_emb_mqe(OCRDMA_CMD_ALLOC_PD_RANGE, sizeof(*cmd)); |
1460 | if (!cmd) | 1469 | if (!cmd) |
@@ -1462,10 +1471,8 @@ static int ocrdma_mbx_alloc_pd_range(struct ocrdma_dev *dev) | |||
1462 | 1471 | ||
1463 | cmd->pd_count = dev->attr.max_pd - dev->attr.max_dpp_pds; | 1472 | cmd->pd_count = dev->attr.max_pd - dev->attr.max_dpp_pds; |
1464 | status = ocrdma_mbx_cmd(dev, (struct ocrdma_mqe *)cmd); | 1473 | status = ocrdma_mbx_cmd(dev, (struct ocrdma_mqe *)cmd); |
1465 | if (status) | ||
1466 | goto mbx_err; | ||
1467 | rsp = (struct ocrdma_alloc_pd_range_rsp *)cmd; | 1474 | rsp = (struct ocrdma_alloc_pd_range_rsp *)cmd; |
1468 | if (rsp->pd_count) { | 1475 | if (!status && rsp->pd_count) { |
1469 | dev->pd_mgr->pd_norm_start = rsp->dpp_page_pdid & | 1476 | dev->pd_mgr->pd_norm_start = rsp->dpp_page_pdid & |
1470 | OCRDMA_ALLOC_PD_RNG_RSP_START_PDID_MASK; | 1477 | OCRDMA_ALLOC_PD_RNG_RSP_START_PDID_MASK; |
1471 | dev->pd_mgr->max_normal_pd = rsp->pd_count; | 1478 | dev->pd_mgr->max_normal_pd = rsp->pd_count; |
@@ -1473,15 +1480,13 @@ static int ocrdma_mbx_alloc_pd_range(struct ocrdma_dev *dev) | |||
1473 | dev->pd_mgr->pd_norm_bitmap = kzalloc(pd_bitmap_size, | 1480 | dev->pd_mgr->pd_norm_bitmap = kzalloc(pd_bitmap_size, |
1474 | GFP_KERNEL); | 1481 | GFP_KERNEL); |
1475 | } | 1482 | } |
1483 | kfree(cmd); | ||
1476 | 1484 | ||
1477 | if (dev->pd_mgr->pd_norm_bitmap || dev->pd_mgr->pd_dpp_bitmap) { | 1485 | if (dev->pd_mgr->pd_norm_bitmap || dev->pd_mgr->pd_dpp_bitmap) { |
1478 | /* Enable PD resource manager */ | 1486 | /* Enable PD resource manager */ |
1479 | dev->pd_mgr->pd_prealloc_valid = true; | 1487 | dev->pd_mgr->pd_prealloc_valid = true; |
1480 | } else { | 1488 | return 0; |
1481 | return -ENOMEM; | ||
1482 | } | 1489 | } |
1483 | mbx_err: | ||
1484 | kfree(cmd); | ||
1485 | return status; | 1490 | return status; |
1486 | } | 1491 | } |
1487 | 1492 | ||
@@ -2406,7 +2411,7 @@ int ocrdma_mbx_query_qp(struct ocrdma_dev *dev, struct ocrdma_qp *qp, | |||
2406 | struct ocrdma_query_qp *cmd; | 2411 | struct ocrdma_query_qp *cmd; |
2407 | struct ocrdma_query_qp_rsp *rsp; | 2412 | struct ocrdma_query_qp_rsp *rsp; |
2408 | 2413 | ||
2409 | cmd = ocrdma_init_emb_mqe(OCRDMA_CMD_QUERY_QP, sizeof(*cmd)); | 2414 | cmd = ocrdma_init_emb_mqe(OCRDMA_CMD_QUERY_QP, sizeof(*rsp)); |
2410 | if (!cmd) | 2415 | if (!cmd) |
2411 | return status; | 2416 | return status; |
2412 | cmd->qp_id = qp->id; | 2417 | cmd->qp_id = qp->id; |
@@ -2428,7 +2433,7 @@ static int ocrdma_set_av_params(struct ocrdma_qp *qp, | |||
2428 | int status; | 2433 | int status; |
2429 | struct ib_ah_attr *ah_attr = &attrs->ah_attr; | 2434 | struct ib_ah_attr *ah_attr = &attrs->ah_attr; |
2430 | union ib_gid sgid, zgid; | 2435 | union ib_gid sgid, zgid; |
2431 | u32 vlan_id; | 2436 | u32 vlan_id = 0xFFFF; |
2432 | u8 mac_addr[6]; | 2437 | u8 mac_addr[6]; |
2433 | struct ocrdma_dev *dev = get_ocrdma_dev(qp->ibqp.device); | 2438 | struct ocrdma_dev *dev = get_ocrdma_dev(qp->ibqp.device); |
2434 | 2439 | ||
@@ -2468,12 +2473,22 @@ static int ocrdma_set_av_params(struct ocrdma_qp *qp, | |||
2468 | cmd->params.vlan_dmac_b4_to_b5 = mac_addr[4] | (mac_addr[5] << 8); | 2473 | cmd->params.vlan_dmac_b4_to_b5 = mac_addr[4] | (mac_addr[5] << 8); |
2469 | if (attr_mask & IB_QP_VID) { | 2474 | if (attr_mask & IB_QP_VID) { |
2470 | vlan_id = attrs->vlan_id; | 2475 | vlan_id = attrs->vlan_id; |
2476 | } else if (dev->pfc_state) { | ||
2477 | vlan_id = 0; | ||
2478 | pr_err("ocrdma%d:Using VLAN with PFC is recommended\n", | ||
2479 | dev->id); | ||
2480 | pr_err("ocrdma%d:Using VLAN 0 for this connection\n", | ||
2481 | dev->id); | ||
2482 | } | ||
2483 | |||
2484 | if (vlan_id < 0x1000) { | ||
2471 | cmd->params.vlan_dmac_b4_to_b5 |= | 2485 | cmd->params.vlan_dmac_b4_to_b5 |= |
2472 | vlan_id << OCRDMA_QP_PARAMS_VLAN_SHIFT; | 2486 | vlan_id << OCRDMA_QP_PARAMS_VLAN_SHIFT; |
2473 | cmd->flags |= OCRDMA_QP_PARA_VLAN_EN_VALID; | 2487 | cmd->flags |= OCRDMA_QP_PARA_VLAN_EN_VALID; |
2474 | cmd->params.rnt_rc_sl_fl |= | 2488 | cmd->params.rnt_rc_sl_fl |= |
2475 | (dev->sl & 0x07) << OCRDMA_QP_PARAMS_SL_SHIFT; | 2489 | (dev->sl & 0x07) << OCRDMA_QP_PARAMS_SL_SHIFT; |
2476 | } | 2490 | } |
2491 | |||
2477 | return 0; | 2492 | return 0; |
2478 | } | 2493 | } |
2479 | 2494 | ||
@@ -2519,8 +2534,10 @@ static int ocrdma_set_qp_params(struct ocrdma_qp *qp, | |||
2519 | cmd->flags |= OCRDMA_QP_PARA_DST_QPN_VALID; | 2534 | cmd->flags |= OCRDMA_QP_PARA_DST_QPN_VALID; |
2520 | } | 2535 | } |
2521 | if (attr_mask & IB_QP_PATH_MTU) { | 2536 | if (attr_mask & IB_QP_PATH_MTU) { |
2522 | if (attrs->path_mtu < IB_MTU_256 || | 2537 | if (attrs->path_mtu < IB_MTU_512 || |
2523 | attrs->path_mtu > IB_MTU_4096) { | 2538 | attrs->path_mtu > IB_MTU_4096) { |
2539 | pr_err("ocrdma%d: IB MTU %d is not supported\n", | ||
2540 | dev->id, ib_mtu_enum_to_int(attrs->path_mtu)); | ||
2524 | status = -EINVAL; | 2541 | status = -EINVAL; |
2525 | goto pmtu_err; | 2542 | goto pmtu_err; |
2526 | } | 2543 | } |
@@ -3147,9 +3164,9 @@ void ocrdma_cleanup_hw(struct ocrdma_dev *dev) | |||
3147 | ocrdma_free_pd_pool(dev); | 3164 | ocrdma_free_pd_pool(dev); |
3148 | ocrdma_mbx_delete_ah_tbl(dev); | 3165 | ocrdma_mbx_delete_ah_tbl(dev); |
3149 | 3166 | ||
3150 | /* cleanup the eqs */ | ||
3151 | ocrdma_destroy_eqs(dev); | ||
3152 | |||
3153 | /* cleanup the control path */ | 3167 | /* cleanup the control path */ |
3154 | ocrdma_destroy_mq(dev); | 3168 | ocrdma_destroy_mq(dev); |
3169 | |||
3170 | /* cleanup the eqs */ | ||
3171 | ocrdma_destroy_eqs(dev); | ||
3155 | } | 3172 | } |
diff --git a/drivers/infiniband/hw/ocrdma/ocrdma_sli.h b/drivers/infiniband/hw/ocrdma/ocrdma_sli.h index 243c87c8bd65..02ad0aee99af 100644 --- a/drivers/infiniband/hw/ocrdma/ocrdma_sli.h +++ b/drivers/infiniband/hw/ocrdma/ocrdma_sli.h | |||
@@ -1176,6 +1176,8 @@ struct ocrdma_query_qp_rsp { | |||
1176 | struct ocrdma_mqe_hdr hdr; | 1176 | struct ocrdma_mqe_hdr hdr; |
1177 | struct ocrdma_mbx_rsp rsp; | 1177 | struct ocrdma_mbx_rsp rsp; |
1178 | struct ocrdma_qp_params params; | 1178 | struct ocrdma_qp_params params; |
1179 | u32 dpp_credits_cqid; | ||
1180 | u32 rbq_id; | ||
1179 | }; | 1181 | }; |
1180 | 1182 | ||
1181 | enum { | 1183 | enum { |
@@ -1624,12 +1626,19 @@ struct ocrdma_delete_ah_tbl_rsp { | |||
1624 | enum { | 1626 | enum { |
1625 | OCRDMA_EQE_VALID_SHIFT = 0, | 1627 | OCRDMA_EQE_VALID_SHIFT = 0, |
1626 | OCRDMA_EQE_VALID_MASK = BIT(0), | 1628 | OCRDMA_EQE_VALID_MASK = BIT(0), |
1629 | OCRDMA_EQE_MAJOR_CODE_MASK = 0x0E, | ||
1630 | OCRDMA_EQE_MAJOR_CODE_SHIFT = 0x01, | ||
1627 | OCRDMA_EQE_FOR_CQE_MASK = 0xFFFE, | 1631 | OCRDMA_EQE_FOR_CQE_MASK = 0xFFFE, |
1628 | OCRDMA_EQE_RESOURCE_ID_SHIFT = 16, | 1632 | OCRDMA_EQE_RESOURCE_ID_SHIFT = 16, |
1629 | OCRDMA_EQE_RESOURCE_ID_MASK = 0xFFFF << | 1633 | OCRDMA_EQE_RESOURCE_ID_MASK = 0xFFFF << |
1630 | OCRDMA_EQE_RESOURCE_ID_SHIFT, | 1634 | OCRDMA_EQE_RESOURCE_ID_SHIFT, |
1631 | }; | 1635 | }; |
1632 | 1636 | ||
1637 | enum major_code { | ||
1638 | OCRDMA_MAJOR_CODE_COMPLETION = 0x00, | ||
1639 | OCRDMA_MAJOR_CODE_SENTINAL = 0x01 | ||
1640 | }; | ||
1641 | |||
1633 | struct ocrdma_eqe { | 1642 | struct ocrdma_eqe { |
1634 | u32 id_valid; | 1643 | u32 id_valid; |
1635 | }; | 1644 | }; |
diff --git a/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c b/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c index 877175563634..9dcb66077d6c 100644 --- a/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c +++ b/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c | |||
@@ -365,7 +365,7 @@ static struct ocrdma_pd *_ocrdma_alloc_pd(struct ocrdma_dev *dev, | |||
365 | if (!pd) | 365 | if (!pd) |
366 | return ERR_PTR(-ENOMEM); | 366 | return ERR_PTR(-ENOMEM); |
367 | 367 | ||
368 | if (udata && uctx) { | 368 | if (udata && uctx && dev->attr.max_dpp_pds) { |
369 | pd->dpp_enabled = | 369 | pd->dpp_enabled = |
370 | ocrdma_get_asic_type(dev) == OCRDMA_ASIC_GEN_SKH_R; | 370 | ocrdma_get_asic_type(dev) == OCRDMA_ASIC_GEN_SKH_R; |
371 | pd->num_dpp_qp = | 371 | pd->num_dpp_qp = |
@@ -1721,18 +1721,20 @@ int ocrdma_destroy_qp(struct ib_qp *ibqp) | |||
1721 | struct ocrdma_qp *qp; | 1721 | struct ocrdma_qp *qp; |
1722 | struct ocrdma_dev *dev; | 1722 | struct ocrdma_dev *dev; |
1723 | struct ib_qp_attr attrs; | 1723 | struct ib_qp_attr attrs; |
1724 | int attr_mask = IB_QP_STATE; | 1724 | int attr_mask; |
1725 | unsigned long flags; | 1725 | unsigned long flags; |
1726 | 1726 | ||
1727 | qp = get_ocrdma_qp(ibqp); | 1727 | qp = get_ocrdma_qp(ibqp); |
1728 | dev = get_ocrdma_dev(ibqp->device); | 1728 | dev = get_ocrdma_dev(ibqp->device); |
1729 | 1729 | ||
1730 | attrs.qp_state = IB_QPS_ERR; | ||
1731 | pd = qp->pd; | 1730 | pd = qp->pd; |
1732 | 1731 | ||
1733 | /* change the QP state to ERROR */ | 1732 | /* change the QP state to ERROR */ |
1734 | _ocrdma_modify_qp(ibqp, &attrs, attr_mask); | 1733 | if (qp->state != OCRDMA_QPS_RST) { |
1735 | 1734 | attrs.qp_state = IB_QPS_ERR; | |
1735 | attr_mask = IB_QP_STATE; | ||
1736 | _ocrdma_modify_qp(ibqp, &attrs, attr_mask); | ||
1737 | } | ||
1736 | /* ensure that CQEs for newly created QP (whose id may be same with | 1738 | /* ensure that CQEs for newly created QP (whose id may be same with |
1737 | * one which just getting destroyed are same), dont get | 1739 | * one which just getting destroyed are same), dont get |
1738 | * discarded until the old CQEs are discarded. | 1740 | * discarded until the old CQEs are discarded. |
diff --git a/drivers/input/joydev.c b/drivers/input/joydev.c index f362883c94e3..1d247bcf2ae2 100644 --- a/drivers/input/joydev.c +++ b/drivers/input/joydev.c | |||
@@ -747,6 +747,63 @@ static void joydev_cleanup(struct joydev *joydev) | |||
747 | input_close_device(handle); | 747 | input_close_device(handle); |
748 | } | 748 | } |
749 | 749 | ||
750 | static bool joydev_dev_is_absolute_mouse(struct input_dev *dev) | ||
751 | { | ||
752 | DECLARE_BITMAP(jd_scratch, KEY_CNT); | ||
753 | |||
754 | BUILD_BUG_ON(ABS_CNT > KEY_CNT || EV_CNT > KEY_CNT); | ||
755 | |||
756 | /* | ||
757 | * Virtualization (VMware, etc) and remote management (HP | ||
758 | * ILO2) solutions use absolute coordinates for their virtual | ||
759 | * pointing devices so that there is one-to-one relationship | ||
760 | * between pointer position on the host screen and virtual | ||
761 | * guest screen, and so their mice use ABS_X, ABS_Y and 3 | ||
762 | * primary button events. This clashes with what joydev | ||
763 | * considers to be joysticks (a device with at minimum ABS_X | ||
764 | * axis). | ||
765 | * | ||
766 | * Here we are trying to separate absolute mice from | ||
767 | * joysticks. A device is, for joystick detection purposes, | ||
768 | * considered to be an absolute mouse if the following is | ||
769 | * true: | ||
770 | * | ||
771 | * 1) Event types are exactly EV_ABS, EV_KEY and EV_SYN. | ||
772 | * 2) Absolute events are exactly ABS_X and ABS_Y. | ||
773 | * 3) Keys are exactly BTN_LEFT, BTN_RIGHT and BTN_MIDDLE. | ||
774 | * 4) Device is not on "Amiga" bus. | ||
775 | */ | ||
776 | |||
777 | bitmap_zero(jd_scratch, EV_CNT); | ||
778 | __set_bit(EV_ABS, jd_scratch); | ||
779 | __set_bit(EV_KEY, jd_scratch); | ||
780 | __set_bit(EV_SYN, jd_scratch); | ||
781 | if (!bitmap_equal(jd_scratch, dev->evbit, EV_CNT)) | ||
782 | return false; | ||
783 | |||
784 | bitmap_zero(jd_scratch, ABS_CNT); | ||
785 | __set_bit(ABS_X, jd_scratch); | ||
786 | __set_bit(ABS_Y, jd_scratch); | ||
787 | if (!bitmap_equal(dev->absbit, jd_scratch, ABS_CNT)) | ||
788 | return false; | ||
789 | |||
790 | bitmap_zero(jd_scratch, KEY_CNT); | ||
791 | __set_bit(BTN_LEFT, jd_scratch); | ||
792 | __set_bit(BTN_RIGHT, jd_scratch); | ||
793 | __set_bit(BTN_MIDDLE, jd_scratch); | ||
794 | |||
795 | if (!bitmap_equal(dev->keybit, jd_scratch, KEY_CNT)) | ||
796 | return false; | ||
797 | |||
798 | /* | ||
799 | * Amiga joystick (amijoy) historically uses left/middle/right | ||
800 | * button events. | ||
801 | */ | ||
802 | if (dev->id.bustype == BUS_AMIGA) | ||
803 | return false; | ||
804 | |||
805 | return true; | ||
806 | } | ||
750 | 807 | ||
751 | static bool joydev_match(struct input_handler *handler, struct input_dev *dev) | 808 | static bool joydev_match(struct input_handler *handler, struct input_dev *dev) |
752 | { | 809 | { |
@@ -758,6 +815,10 @@ static bool joydev_match(struct input_handler *handler, struct input_dev *dev) | |||
758 | if (test_bit(EV_KEY, dev->evbit) && test_bit(BTN_DIGI, dev->keybit)) | 815 | if (test_bit(EV_KEY, dev->evbit) && test_bit(BTN_DIGI, dev->keybit)) |
759 | return false; | 816 | return false; |
760 | 817 | ||
818 | /* Avoid absolute mice */ | ||
819 | if (joydev_dev_is_absolute_mouse(dev)) | ||
820 | return false; | ||
821 | |||
761 | return true; | 822 | return true; |
762 | } | 823 | } |
763 | 824 | ||
diff --git a/drivers/input/mouse/Kconfig b/drivers/input/mouse/Kconfig index 7462d2fc8cfe..d7820d1152d2 100644 --- a/drivers/input/mouse/Kconfig +++ b/drivers/input/mouse/Kconfig | |||
@@ -156,7 +156,7 @@ config MOUSE_PS2_VMMOUSE | |||
156 | Say Y here if you are running under control of VMware hypervisor | 156 | Say Y here if you are running under control of VMware hypervisor |
157 | (ESXi, Workstation or Fusion). Also make sure that when you enable | 157 | (ESXi, Workstation or Fusion). Also make sure that when you enable |
158 | this option, you remove the xf86-input-vmmouse user-space driver | 158 | this option, you remove the xf86-input-vmmouse user-space driver |
159 | or upgrade it to at least xf86-input-vmmouse 13.0.1, which doesn't | 159 | or upgrade it to at least xf86-input-vmmouse 13.1.0, which doesn't |
160 | load in the presence of an in-kernel vmmouse driver. | 160 | load in the presence of an in-kernel vmmouse driver. |
161 | 161 | ||
162 | If unsure, say N. | 162 | If unsure, say N. |
diff --git a/drivers/input/mouse/alps.c b/drivers/input/mouse/alps.c index e6708f6efb4d..7752bd59d4b7 100644 --- a/drivers/input/mouse/alps.c +++ b/drivers/input/mouse/alps.c | |||
@@ -941,6 +941,11 @@ static void alps_get_finger_coordinate_v7(struct input_mt_pos *mt, | |||
941 | case V7_PACKET_ID_TWO: | 941 | case V7_PACKET_ID_TWO: |
942 | mt[1].x &= ~0x000F; | 942 | mt[1].x &= ~0x000F; |
943 | mt[1].y |= 0x000F; | 943 | mt[1].y |= 0x000F; |
944 | /* Detect false-postive touches where x & y report max value */ | ||
945 | if (mt[1].y == 0x7ff && mt[1].x == 0xff0) { | ||
946 | mt[1].x = 0; | ||
947 | /* y gets set to 0 at the end of this function */ | ||
948 | } | ||
944 | break; | 949 | break; |
945 | 950 | ||
946 | case V7_PACKET_ID_MULTI: | 951 | case V7_PACKET_ID_MULTI: |
diff --git a/drivers/input/mouse/elantech.c b/drivers/input/mouse/elantech.c index 991dc6b20a58..79363b687195 100644 --- a/drivers/input/mouse/elantech.c +++ b/drivers/input/mouse/elantech.c | |||
@@ -315,7 +315,7 @@ static void elantech_report_semi_mt_data(struct input_dev *dev, | |||
315 | unsigned int x2, unsigned int y2) | 315 | unsigned int x2, unsigned int y2) |
316 | { | 316 | { |
317 | elantech_set_slot(dev, 0, num_fingers != 0, x1, y1); | 317 | elantech_set_slot(dev, 0, num_fingers != 0, x1, y1); |
318 | elantech_set_slot(dev, 1, num_fingers == 2, x2, y2); | 318 | elantech_set_slot(dev, 1, num_fingers >= 2, x2, y2); |
319 | } | 319 | } |
320 | 320 | ||
321 | /* | 321 | /* |
diff --git a/drivers/input/touchscreen/stmpe-ts.c b/drivers/input/touchscreen/stmpe-ts.c index 2d5ff86b343f..e4c31256a74d 100644 --- a/drivers/input/touchscreen/stmpe-ts.c +++ b/drivers/input/touchscreen/stmpe-ts.c | |||
@@ -164,7 +164,7 @@ static irqreturn_t stmpe_ts_handler(int irq, void *data) | |||
164 | STMPE_TSC_CTRL_TSC_EN, STMPE_TSC_CTRL_TSC_EN); | 164 | STMPE_TSC_CTRL_TSC_EN, STMPE_TSC_CTRL_TSC_EN); |
165 | 165 | ||
166 | /* start polling for touch_det to detect release */ | 166 | /* start polling for touch_det to detect release */ |
167 | schedule_delayed_work(&ts->work, HZ / 50); | 167 | schedule_delayed_work(&ts->work, msecs_to_jiffies(50)); |
168 | 168 | ||
169 | return IRQ_HANDLED; | 169 | return IRQ_HANDLED; |
170 | } | 170 | } |
diff --git a/drivers/input/touchscreen/sx8654.c b/drivers/input/touchscreen/sx8654.c index aecb9ad2e701..642f4a53de50 100644 --- a/drivers/input/touchscreen/sx8654.c +++ b/drivers/input/touchscreen/sx8654.c | |||
@@ -187,7 +187,7 @@ static int sx8654_probe(struct i2c_client *client, | |||
187 | return -ENOMEM; | 187 | return -ENOMEM; |
188 | 188 | ||
189 | input = devm_input_allocate_device(&client->dev); | 189 | input = devm_input_allocate_device(&client->dev); |
190 | if (!sx8654) | 190 | if (!input) |
191 | return -ENOMEM; | 191 | return -ENOMEM; |
192 | 192 | ||
193 | input->name = "SX8654 I2C Touchscreen"; | 193 | input->name = "SX8654 I2C Touchscreen"; |
diff --git a/drivers/irqchip/irq-tegra.c b/drivers/irqchip/irq-tegra.c index 51c485d9a877..f67bbd80433e 100644 --- a/drivers/irqchip/irq-tegra.c +++ b/drivers/irqchip/irq-tegra.c | |||
@@ -264,7 +264,7 @@ static int tegra_ictlr_domain_alloc(struct irq_domain *domain, | |||
264 | 264 | ||
265 | irq_domain_set_hwirq_and_chip(domain, virq + i, hwirq + i, | 265 | irq_domain_set_hwirq_and_chip(domain, virq + i, hwirq + i, |
266 | &tegra_ictlr_chip, | 266 | &tegra_ictlr_chip, |
267 | &info->base[ictlr]); | 267 | info->base[ictlr]); |
268 | } | 268 | } |
269 | 269 | ||
270 | parent_args = *args; | 270 | parent_args = *args; |
diff --git a/drivers/md/bitmap.c b/drivers/md/bitmap.c index 2bc56e2a3526..135a0907e9de 100644 --- a/drivers/md/bitmap.c +++ b/drivers/md/bitmap.c | |||
@@ -177,11 +177,16 @@ static struct md_rdev *next_active_rdev(struct md_rdev *rdev, struct mddev *mdde | |||
177 | * nr_pending is 0 and In_sync is clear, the entries we return will | 177 | * nr_pending is 0 and In_sync is clear, the entries we return will |
178 | * still be in the same position on the list when we re-enter | 178 | * still be in the same position on the list when we re-enter |
179 | * list_for_each_entry_continue_rcu. | 179 | * list_for_each_entry_continue_rcu. |
180 | * | ||
181 | * Note that if entered with 'rdev == NULL' to start at the | ||
182 | * beginning, we temporarily assign 'rdev' to an address which | ||
183 | * isn't really an rdev, but which can be used by | ||
184 | * list_for_each_entry_continue_rcu() to find the first entry. | ||
180 | */ | 185 | */ |
181 | rcu_read_lock(); | 186 | rcu_read_lock(); |
182 | if (rdev == NULL) | 187 | if (rdev == NULL) |
183 | /* start at the beginning */ | 188 | /* start at the beginning */ |
184 | rdev = list_entry_rcu(&mddev->disks, struct md_rdev, same_set); | 189 | rdev = list_entry(&mddev->disks, struct md_rdev, same_set); |
185 | else { | 190 | else { |
186 | /* release the previous rdev and start from there. */ | 191 | /* release the previous rdev and start from there. */ |
187 | rdev_dec_pending(rdev, mddev); | 192 | rdev_dec_pending(rdev, mddev); |
diff --git a/drivers/md/raid0.c b/drivers/md/raid0.c index 6a68ef5246d4..efb654eb5399 100644 --- a/drivers/md/raid0.c +++ b/drivers/md/raid0.c | |||
@@ -524,6 +524,9 @@ static void raid0_make_request(struct mddev *mddev, struct bio *bio) | |||
524 | ? (sector & (chunk_sects-1)) | 524 | ? (sector & (chunk_sects-1)) |
525 | : sector_div(sector, chunk_sects)); | 525 | : sector_div(sector, chunk_sects)); |
526 | 526 | ||
527 | /* Restore due to sector_div */ | ||
528 | sector = bio->bi_iter.bi_sector; | ||
529 | |||
527 | if (sectors < bio_sectors(bio)) { | 530 | if (sectors < bio_sectors(bio)) { |
528 | split = bio_split(bio, sectors, GFP_NOIO, fs_bio_set); | 531 | split = bio_split(bio, sectors, GFP_NOIO, fs_bio_set); |
529 | bio_chain(split, bio); | 532 | bio_chain(split, bio); |
@@ -531,7 +534,6 @@ static void raid0_make_request(struct mddev *mddev, struct bio *bio) | |||
531 | split = bio; | 534 | split = bio; |
532 | } | 535 | } |
533 | 536 | ||
534 | sector = bio->bi_iter.bi_sector; | ||
535 | zone = find_zone(mddev->private, §or); | 537 | zone = find_zone(mddev->private, §or); |
536 | tmp_dev = map_sector(mddev, zone, sector, §or); | 538 | tmp_dev = map_sector(mddev, zone, sector, §or); |
537 | split->bi_bdev = tmp_dev->bdev; | 539 | split->bi_bdev = tmp_dev->bdev; |
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c index 1ba97fdc6df1..b9f2b9cc6060 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c | |||
@@ -1822,7 +1822,7 @@ again: | |||
1822 | } else | 1822 | } else |
1823 | init_async_submit(&submit, 0, tx, NULL, NULL, | 1823 | init_async_submit(&submit, 0, tx, NULL, NULL, |
1824 | to_addr_conv(sh, percpu, j)); | 1824 | to_addr_conv(sh, percpu, j)); |
1825 | async_gen_syndrome(blocks, 0, count+2, STRIPE_SIZE, &submit); | 1825 | tx = async_gen_syndrome(blocks, 0, count+2, STRIPE_SIZE, &submit); |
1826 | if (!last_stripe) { | 1826 | if (!last_stripe) { |
1827 | j++; | 1827 | j++; |
1828 | sh = list_first_entry(&sh->batch_list, struct stripe_head, | 1828 | sh = list_first_entry(&sh->batch_list, struct stripe_head, |
diff --git a/drivers/mmc/host/atmel-mci.c b/drivers/mmc/host/atmel-mci.c index 03d7c7521d97..9a39e0b7e583 100644 --- a/drivers/mmc/host/atmel-mci.c +++ b/drivers/mmc/host/atmel-mci.c | |||
@@ -1304,7 +1304,7 @@ static void atmci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) | |||
1304 | 1304 | ||
1305 | if (ios->clock) { | 1305 | if (ios->clock) { |
1306 | unsigned int clock_min = ~0U; | 1306 | unsigned int clock_min = ~0U; |
1307 | u32 clkdiv; | 1307 | int clkdiv; |
1308 | 1308 | ||
1309 | spin_lock_bh(&host->lock); | 1309 | spin_lock_bh(&host->lock); |
1310 | if (!host->mode_reg) { | 1310 | if (!host->mode_reg) { |
@@ -1328,7 +1328,12 @@ static void atmci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) | |||
1328 | /* Calculate clock divider */ | 1328 | /* Calculate clock divider */ |
1329 | if (host->caps.has_odd_clk_div) { | 1329 | if (host->caps.has_odd_clk_div) { |
1330 | clkdiv = DIV_ROUND_UP(host->bus_hz, clock_min) - 2; | 1330 | clkdiv = DIV_ROUND_UP(host->bus_hz, clock_min) - 2; |
1331 | if (clkdiv > 511) { | 1331 | if (clkdiv < 0) { |
1332 | dev_warn(&mmc->class_dev, | ||
1333 | "clock %u too fast; using %lu\n", | ||
1334 | clock_min, host->bus_hz / 2); | ||
1335 | clkdiv = 0; | ||
1336 | } else if (clkdiv > 511) { | ||
1332 | dev_warn(&mmc->class_dev, | 1337 | dev_warn(&mmc->class_dev, |
1333 | "clock %u too slow; using %lu\n", | 1338 | "clock %u too slow; using %lu\n", |
1334 | clock_min, host->bus_hz / (511 + 2)); | 1339 | clock_min, host->bus_hz / (511 + 2)); |
diff --git a/drivers/mtd/devices/m25p80.c b/drivers/mtd/devices/m25p80.c index 7c8b1694a134..3af137f49ac9 100644 --- a/drivers/mtd/devices/m25p80.c +++ b/drivers/mtd/devices/m25p80.c | |||
@@ -223,7 +223,7 @@ static int m25p_probe(struct spi_device *spi) | |||
223 | */ | 223 | */ |
224 | if (data && data->type) | 224 | if (data && data->type) |
225 | flash_name = data->type; | 225 | flash_name = data->type; |
226 | else if (!strcmp(spi->modalias, "nor-jedec")) | 226 | else if (!strcmp(spi->modalias, "spi-nor")) |
227 | flash_name = NULL; /* auto-detect */ | 227 | flash_name = NULL; /* auto-detect */ |
228 | else | 228 | else |
229 | flash_name = spi->modalias; | 229 | flash_name = spi->modalias; |
@@ -255,7 +255,7 @@ static int m25p_remove(struct spi_device *spi) | |||
255 | * since most of these flash are compatible to some extent, and their | 255 | * since most of these flash are compatible to some extent, and their |
256 | * differences can often be differentiated by the JEDEC read-ID command, we | 256 | * differences can often be differentiated by the JEDEC read-ID command, we |
257 | * encourage new users to add support to the spi-nor library, and simply bind | 257 | * encourage new users to add support to the spi-nor library, and simply bind |
258 | * against a generic string here (e.g., "nor-jedec"). | 258 | * against a generic string here (e.g., "jedec,spi-nor"). |
259 | * | 259 | * |
260 | * Many flash names are kept here in this list (as well as in spi-nor.c) to | 260 | * Many flash names are kept here in this list (as well as in spi-nor.c) to |
261 | * keep them available as module aliases for existing platforms. | 261 | * keep them available as module aliases for existing platforms. |
@@ -305,7 +305,7 @@ static const struct spi_device_id m25p_ids[] = { | |||
305 | * Generic support for SPI NOR that can be identified by the JEDEC READ | 305 | * Generic support for SPI NOR that can be identified by the JEDEC READ |
306 | * ID opcode (0x9F). Use this, if possible. | 306 | * ID opcode (0x9F). Use this, if possible. |
307 | */ | 307 | */ |
308 | {"nor-jedec"}, | 308 | {"spi-nor"}, |
309 | { }, | 309 | { }, |
310 | }; | 310 | }; |
311 | MODULE_DEVICE_TABLE(spi, m25p_ids); | 311 | MODULE_DEVICE_TABLE(spi, m25p_ids); |
diff --git a/drivers/mtd/tests/readtest.c b/drivers/mtd/tests/readtest.c index a3196b750a22..58df07acdbdb 100644 --- a/drivers/mtd/tests/readtest.c +++ b/drivers/mtd/tests/readtest.c | |||
@@ -191,9 +191,11 @@ static int __init mtd_readtest_init(void) | |||
191 | err = ret; | 191 | err = ret; |
192 | } | 192 | } |
193 | 193 | ||
194 | err = mtdtest_relax(); | 194 | ret = mtdtest_relax(); |
195 | if (err) | 195 | if (ret) { |
196 | err = ret; | ||
196 | goto out; | 197 | goto out; |
198 | } | ||
197 | } | 199 | } |
198 | 200 | ||
199 | if (err) | 201 | if (err) |
diff --git a/drivers/mtd/ubi/block.c b/drivers/mtd/ubi/block.c index db2c05b6fe7f..c9eb78f10a0d 100644 --- a/drivers/mtd/ubi/block.c +++ b/drivers/mtd/ubi/block.c | |||
@@ -310,6 +310,8 @@ static void ubiblock_do_work(struct work_struct *work) | |||
310 | blk_rq_map_sg(req->q, req, pdu->usgl.sg); | 310 | blk_rq_map_sg(req->q, req, pdu->usgl.sg); |
311 | 311 | ||
312 | ret = ubiblock_read(pdu); | 312 | ret = ubiblock_read(pdu); |
313 | rq_flush_dcache_pages(req); | ||
314 | |||
313 | blk_mq_end_request(req, ret); | 315 | blk_mq_end_request(req, ret); |
314 | } | 316 | } |
315 | 317 | ||
diff --git a/drivers/net/bonding/bond_options.c b/drivers/net/bonding/bond_options.c index 9a32bbd7724e..e9c624d54dd4 100644 --- a/drivers/net/bonding/bond_options.c +++ b/drivers/net/bonding/bond_options.c | |||
@@ -665,7 +665,7 @@ int __bond_opt_set(struct bonding *bond, | |||
665 | out: | 665 | out: |
666 | if (ret) | 666 | if (ret) |
667 | bond_opt_error_interpret(bond, opt, ret, val); | 667 | bond_opt_error_interpret(bond, opt, ret, val); |
668 | else | 668 | else if (bond->dev->reg_state == NETREG_REGISTERED) |
669 | call_netdevice_notifiers(NETDEV_CHANGEINFODATA, bond->dev); | 669 | call_netdevice_notifiers(NETDEV_CHANGEINFODATA, bond->dev); |
670 | 670 | ||
671 | return ret; | 671 | return ret; |
diff --git a/drivers/net/ethernet/cadence/macb.c b/drivers/net/ethernet/cadence/macb.c index 5fca3093747c..740d04fd2223 100644 --- a/drivers/net/ethernet/cadence/macb.c +++ b/drivers/net/ethernet/cadence/macb.c | |||
@@ -352,6 +352,9 @@ static int macb_mii_probe(struct net_device *dev) | |||
352 | else | 352 | else |
353 | phydev->supported &= PHY_BASIC_FEATURES; | 353 | phydev->supported &= PHY_BASIC_FEATURES; |
354 | 354 | ||
355 | if (bp->caps & MACB_CAPS_NO_GIGABIT_HALF) | ||
356 | phydev->supported &= ~SUPPORTED_1000baseT_Half; | ||
357 | |||
355 | phydev->advertising = phydev->supported; | 358 | phydev->advertising = phydev->supported; |
356 | 359 | ||
357 | bp->link = 0; | 360 | bp->link = 0; |
@@ -1039,6 +1042,12 @@ static irqreturn_t macb_interrupt(int irq, void *dev_id) | |||
1039 | * add that if/when we get our hands on a full-blown MII PHY. | 1042 | * add that if/when we get our hands on a full-blown MII PHY. |
1040 | */ | 1043 | */ |
1041 | 1044 | ||
1045 | /* There is a hardware issue under heavy load where DMA can | ||
1046 | * stop, this causes endless "used buffer descriptor read" | ||
1047 | * interrupts but it can be cleared by re-enabling RX. See | ||
1048 | * the at91 manual, section 41.3.1 or the Zynq manual | ||
1049 | * section 16.7.4 for details. | ||
1050 | */ | ||
1042 | if (status & MACB_BIT(RXUBR)) { | 1051 | if (status & MACB_BIT(RXUBR)) { |
1043 | ctrl = macb_readl(bp, NCR); | 1052 | ctrl = macb_readl(bp, NCR); |
1044 | macb_writel(bp, NCR, ctrl & ~MACB_BIT(RE)); | 1053 | macb_writel(bp, NCR, ctrl & ~MACB_BIT(RE)); |
@@ -2723,6 +2732,7 @@ static const struct macb_config emac_config = { | |||
2723 | .init = at91ether_init, | 2732 | .init = at91ether_init, |
2724 | }; | 2733 | }; |
2725 | 2734 | ||
2735 | |||
2726 | static const struct macb_config zynqmp_config = { | 2736 | static const struct macb_config zynqmp_config = { |
2727 | .caps = MACB_CAPS_SG_DISABLED | MACB_CAPS_GIGABIT_MODE_AVAILABLE | | 2737 | .caps = MACB_CAPS_SG_DISABLED | MACB_CAPS_GIGABIT_MODE_AVAILABLE | |
2728 | MACB_CAPS_JUMBO, | 2738 | MACB_CAPS_JUMBO, |
@@ -2732,6 +2742,14 @@ static const struct macb_config zynqmp_config = { | |||
2732 | .jumbo_max_len = 10240, | 2742 | .jumbo_max_len = 10240, |
2733 | }; | 2743 | }; |
2734 | 2744 | ||
2745 | static const struct macb_config zynq_config = { | ||
2746 | .caps = MACB_CAPS_SG_DISABLED | MACB_CAPS_GIGABIT_MODE_AVAILABLE | | ||
2747 | MACB_CAPS_NO_GIGABIT_HALF, | ||
2748 | .dma_burst_length = 16, | ||
2749 | .clk_init = macb_clk_init, | ||
2750 | .init = macb_init, | ||
2751 | }; | ||
2752 | |||
2735 | static const struct of_device_id macb_dt_ids[] = { | 2753 | static const struct of_device_id macb_dt_ids[] = { |
2736 | { .compatible = "cdns,at32ap7000-macb" }, | 2754 | { .compatible = "cdns,at32ap7000-macb" }, |
2737 | { .compatible = "cdns,at91sam9260-macb", .data = &at91sam9260_config }, | 2755 | { .compatible = "cdns,at91sam9260-macb", .data = &at91sam9260_config }, |
@@ -2743,6 +2761,7 @@ static const struct of_device_id macb_dt_ids[] = { | |||
2743 | { .compatible = "cdns,at91rm9200-emac", .data = &emac_config }, | 2761 | { .compatible = "cdns,at91rm9200-emac", .data = &emac_config }, |
2744 | { .compatible = "cdns,emac", .data = &emac_config }, | 2762 | { .compatible = "cdns,emac", .data = &emac_config }, |
2745 | { .compatible = "cdns,zynqmp-gem", .data = &zynqmp_config}, | 2763 | { .compatible = "cdns,zynqmp-gem", .data = &zynqmp_config}, |
2764 | { .compatible = "cdns,zynq-gem", .data = &zynq_config }, | ||
2746 | { /* sentinel */ } | 2765 | { /* sentinel */ } |
2747 | }; | 2766 | }; |
2748 | MODULE_DEVICE_TABLE(of, macb_dt_ids); | 2767 | MODULE_DEVICE_TABLE(of, macb_dt_ids); |
diff --git a/drivers/net/ethernet/cadence/macb.h b/drivers/net/ethernet/cadence/macb.h index 7d4ef513df75..d74655993d4b 100644 --- a/drivers/net/ethernet/cadence/macb.h +++ b/drivers/net/ethernet/cadence/macb.h | |||
@@ -394,6 +394,7 @@ | |||
394 | #define MACB_CAPS_ISR_CLEAR_ON_WRITE 0x00000001 | 394 | #define MACB_CAPS_ISR_CLEAR_ON_WRITE 0x00000001 |
395 | #define MACB_CAPS_USRIO_HAS_CLKEN 0x00000002 | 395 | #define MACB_CAPS_USRIO_HAS_CLKEN 0x00000002 |
396 | #define MACB_CAPS_USRIO_DEFAULT_IS_MII 0x00000004 | 396 | #define MACB_CAPS_USRIO_DEFAULT_IS_MII 0x00000004 |
397 | #define MACB_CAPS_NO_GIGABIT_HALF 0x00000008 | ||
397 | #define MACB_CAPS_FIFO_MODE 0x10000000 | 398 | #define MACB_CAPS_FIFO_MODE 0x10000000 |
398 | #define MACB_CAPS_GIGABIT_MODE_AVAILABLE 0x20000000 | 399 | #define MACB_CAPS_GIGABIT_MODE_AVAILABLE 0x20000000 |
399 | #define MACB_CAPS_SG_DISABLED 0x40000000 | 400 | #define MACB_CAPS_SG_DISABLED 0x40000000 |
diff --git a/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c b/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c index 92fce1b98558..bafe2180cf0c 100644 --- a/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c +++ b/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c | |||
@@ -3187,7 +3187,7 @@ int mlx4_SW2HW_CQ_wrapper(struct mlx4_dev *dev, int slave, | |||
3187 | int cqn = vhcr->in_modifier; | 3187 | int cqn = vhcr->in_modifier; |
3188 | struct mlx4_cq_context *cqc = inbox->buf; | 3188 | struct mlx4_cq_context *cqc = inbox->buf; |
3189 | int mtt_base = cq_get_mtt_addr(cqc) / dev->caps.mtt_entry_sz; | 3189 | int mtt_base = cq_get_mtt_addr(cqc) / dev->caps.mtt_entry_sz; |
3190 | struct res_cq *cq; | 3190 | struct res_cq *cq = NULL; |
3191 | struct res_mtt *mtt; | 3191 | struct res_mtt *mtt; |
3192 | 3192 | ||
3193 | err = cq_res_start_move_to(dev, slave, cqn, RES_CQ_HW, &cq); | 3193 | err = cq_res_start_move_to(dev, slave, cqn, RES_CQ_HW, &cq); |
@@ -3223,7 +3223,7 @@ int mlx4_HW2SW_CQ_wrapper(struct mlx4_dev *dev, int slave, | |||
3223 | { | 3223 | { |
3224 | int err; | 3224 | int err; |
3225 | int cqn = vhcr->in_modifier; | 3225 | int cqn = vhcr->in_modifier; |
3226 | struct res_cq *cq; | 3226 | struct res_cq *cq = NULL; |
3227 | 3227 | ||
3228 | err = cq_res_start_move_to(dev, slave, cqn, RES_CQ_ALLOCATED, &cq); | 3228 | err = cq_res_start_move_to(dev, slave, cqn, RES_CQ_ALLOCATED, &cq); |
3229 | if (err) | 3229 | if (err) |
@@ -3362,7 +3362,7 @@ int mlx4_SW2HW_SRQ_wrapper(struct mlx4_dev *dev, int slave, | |||
3362 | int err; | 3362 | int err; |
3363 | int srqn = vhcr->in_modifier; | 3363 | int srqn = vhcr->in_modifier; |
3364 | struct res_mtt *mtt; | 3364 | struct res_mtt *mtt; |
3365 | struct res_srq *srq; | 3365 | struct res_srq *srq = NULL; |
3366 | struct mlx4_srq_context *srqc = inbox->buf; | 3366 | struct mlx4_srq_context *srqc = inbox->buf; |
3367 | int mtt_base = srq_get_mtt_addr(srqc) / dev->caps.mtt_entry_sz; | 3367 | int mtt_base = srq_get_mtt_addr(srqc) / dev->caps.mtt_entry_sz; |
3368 | 3368 | ||
@@ -3406,7 +3406,7 @@ int mlx4_HW2SW_SRQ_wrapper(struct mlx4_dev *dev, int slave, | |||
3406 | { | 3406 | { |
3407 | int err; | 3407 | int err; |
3408 | int srqn = vhcr->in_modifier; | 3408 | int srqn = vhcr->in_modifier; |
3409 | struct res_srq *srq; | 3409 | struct res_srq *srq = NULL; |
3410 | 3410 | ||
3411 | err = srq_res_start_move_to(dev, slave, srqn, RES_SRQ_ALLOCATED, &srq); | 3411 | err = srq_res_start_move_to(dev, slave, srqn, RES_SRQ_ALLOCATED, &srq); |
3412 | if (err) | 3412 | if (err) |
diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c index 1457ecf75dcc..377d2db04d33 100644 --- a/drivers/net/phy/phy.c +++ b/drivers/net/phy/phy.c | |||
@@ -767,6 +767,9 @@ EXPORT_SYMBOL(phy_stop); | |||
767 | */ | 767 | */ |
768 | void phy_start(struct phy_device *phydev) | 768 | void phy_start(struct phy_device *phydev) |
769 | { | 769 | { |
770 | bool do_resume = false; | ||
771 | int err = 0; | ||
772 | |||
770 | mutex_lock(&phydev->lock); | 773 | mutex_lock(&phydev->lock); |
771 | 774 | ||
772 | switch (phydev->state) { | 775 | switch (phydev->state) { |
@@ -777,11 +780,22 @@ void phy_start(struct phy_device *phydev) | |||
777 | phydev->state = PHY_UP; | 780 | phydev->state = PHY_UP; |
778 | break; | 781 | break; |
779 | case PHY_HALTED: | 782 | case PHY_HALTED: |
783 | /* make sure interrupts are re-enabled for the PHY */ | ||
784 | err = phy_enable_interrupts(phydev); | ||
785 | if (err < 0) | ||
786 | break; | ||
787 | |||
780 | phydev->state = PHY_RESUMING; | 788 | phydev->state = PHY_RESUMING; |
789 | do_resume = true; | ||
790 | break; | ||
781 | default: | 791 | default: |
782 | break; | 792 | break; |
783 | } | 793 | } |
784 | mutex_unlock(&phydev->lock); | 794 | mutex_unlock(&phydev->lock); |
795 | |||
796 | /* if phy was suspended, bring the physical link up again */ | ||
797 | if (do_resume) | ||
798 | phy_resume(phydev); | ||
785 | } | 799 | } |
786 | EXPORT_SYMBOL(phy_start); | 800 | EXPORT_SYMBOL(phy_start); |
787 | 801 | ||
@@ -794,7 +808,7 @@ void phy_state_machine(struct work_struct *work) | |||
794 | struct delayed_work *dwork = to_delayed_work(work); | 808 | struct delayed_work *dwork = to_delayed_work(work); |
795 | struct phy_device *phydev = | 809 | struct phy_device *phydev = |
796 | container_of(dwork, struct phy_device, state_queue); | 810 | container_of(dwork, struct phy_device, state_queue); |
797 | bool needs_aneg = false, do_suspend = false, do_resume = false; | 811 | bool needs_aneg = false, do_suspend = false; |
798 | enum phy_state old_state; | 812 | enum phy_state old_state; |
799 | int err = 0; | 813 | int err = 0; |
800 | 814 | ||
@@ -916,14 +930,6 @@ void phy_state_machine(struct work_struct *work) | |||
916 | } | 930 | } |
917 | break; | 931 | break; |
918 | case PHY_RESUMING: | 932 | case PHY_RESUMING: |
919 | err = phy_clear_interrupt(phydev); | ||
920 | if (err) | ||
921 | break; | ||
922 | |||
923 | err = phy_config_interrupt(phydev, PHY_INTERRUPT_ENABLED); | ||
924 | if (err) | ||
925 | break; | ||
926 | |||
927 | if (AUTONEG_ENABLE == phydev->autoneg) { | 933 | if (AUTONEG_ENABLE == phydev->autoneg) { |
928 | err = phy_aneg_done(phydev); | 934 | err = phy_aneg_done(phydev); |
929 | if (err < 0) | 935 | if (err < 0) |
@@ -961,7 +967,6 @@ void phy_state_machine(struct work_struct *work) | |||
961 | } | 967 | } |
962 | phydev->adjust_link(phydev->attached_dev); | 968 | phydev->adjust_link(phydev->attached_dev); |
963 | } | 969 | } |
964 | do_resume = true; | ||
965 | break; | 970 | break; |
966 | } | 971 | } |
967 | 972 | ||
@@ -971,8 +976,6 @@ void phy_state_machine(struct work_struct *work) | |||
971 | err = phy_start_aneg(phydev); | 976 | err = phy_start_aneg(phydev); |
972 | else if (do_suspend) | 977 | else if (do_suspend) |
973 | phy_suspend(phydev); | 978 | phy_suspend(phydev); |
974 | else if (do_resume) | ||
975 | phy_resume(phydev); | ||
976 | 979 | ||
977 | if (err < 0) | 980 | if (err < 0) |
978 | phy_error(phydev); | 981 | phy_error(phydev); |
@@ -1084,13 +1087,14 @@ int phy_init_eee(struct phy_device *phydev, bool clk_stop_enable) | |||
1084 | { | 1087 | { |
1085 | /* According to 802.3az,the EEE is supported only in full duplex-mode. | 1088 | /* According to 802.3az,the EEE is supported only in full duplex-mode. |
1086 | * Also EEE feature is active when core is operating with MII, GMII | 1089 | * Also EEE feature is active when core is operating with MII, GMII |
1087 | * or RGMII. Internal PHYs are also allowed to proceed and should | 1090 | * or RGMII (all kinds). Internal PHYs are also allowed to proceed and |
1088 | * return an error if they do not support EEE. | 1091 | * should return an error if they do not support EEE. |
1089 | */ | 1092 | */ |
1090 | if ((phydev->duplex == DUPLEX_FULL) && | 1093 | if ((phydev->duplex == DUPLEX_FULL) && |
1091 | ((phydev->interface == PHY_INTERFACE_MODE_MII) || | 1094 | ((phydev->interface == PHY_INTERFACE_MODE_MII) || |
1092 | (phydev->interface == PHY_INTERFACE_MODE_GMII) || | 1095 | (phydev->interface == PHY_INTERFACE_MODE_GMII) || |
1093 | (phydev->interface == PHY_INTERFACE_MODE_RGMII) || | 1096 | (phydev->interface >= PHY_INTERFACE_MODE_RGMII && |
1097 | phydev->interface <= PHY_INTERFACE_MODE_RGMII_TXID) || | ||
1094 | phy_is_internal(phydev))) { | 1098 | phy_is_internal(phydev))) { |
1095 | int eee_lp, eee_cap, eee_adv; | 1099 | int eee_lp, eee_cap, eee_adv; |
1096 | u32 lp, cap, adv; | 1100 | u32 lp, cap, adv; |
diff --git a/drivers/net/usb/cdc_ncm.c b/drivers/net/usb/cdc_ncm.c index c3e4da9e79ca..8067b8fbb0ee 100644 --- a/drivers/net/usb/cdc_ncm.c +++ b/drivers/net/usb/cdc_ncm.c | |||
@@ -1182,7 +1182,7 @@ cdc_ncm_fill_tx_frame(struct usbnet *dev, struct sk_buff *skb, __le32 sign) | |||
1182 | * payload data instead. | 1182 | * payload data instead. |
1183 | */ | 1183 | */ |
1184 | usbnet_set_skb_tx_stats(skb_out, n, | 1184 | usbnet_set_skb_tx_stats(skb_out, n, |
1185 | ctx->tx_curr_frame_payload - skb_out->len); | 1185 | (long)ctx->tx_curr_frame_payload - skb_out->len); |
1186 | 1186 | ||
1187 | return skb_out; | 1187 | return skb_out; |
1188 | 1188 | ||
diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c index 48341ae49012..5eddbc02c6c2 100644 --- a/drivers/net/vxlan.c +++ b/drivers/net/vxlan.c | |||
@@ -2964,7 +2964,7 @@ static void __net_exit vxlan_exit_net(struct net *net) | |||
2964 | * to the list by the previous loop. | 2964 | * to the list by the previous loop. |
2965 | */ | 2965 | */ |
2966 | if (!net_eq(dev_net(vxlan->dev), net)) | 2966 | if (!net_eq(dev_net(vxlan->dev), net)) |
2967 | unregister_netdevice_queue(dev, &list); | 2967 | unregister_netdevice_queue(vxlan->dev, &list); |
2968 | } | 2968 | } |
2969 | 2969 | ||
2970 | unregister_netdevice_many(&list); | 2970 | unregister_netdevice_many(&list); |
diff --git a/drivers/parisc/superio.c b/drivers/parisc/superio.c index 8be2096c8423..deeaed544222 100644 --- a/drivers/parisc/superio.c +++ b/drivers/parisc/superio.c | |||
@@ -348,7 +348,7 @@ int superio_fixup_irq(struct pci_dev *pcidev) | |||
348 | BUG(); | 348 | BUG(); |
349 | return -1; | 349 | return -1; |
350 | } | 350 | } |
351 | printk("superio_fixup_irq(%s) ven 0x%x dev 0x%x from %pf\n", | 351 | printk(KERN_DEBUG "superio_fixup_irq(%s) ven 0x%x dev 0x%x from %ps\n", |
352 | pci_name(pcidev), | 352 | pci_name(pcidev), |
353 | pcidev->vendor, pcidev->device, | 353 | pcidev->vendor, pcidev->device, |
354 | __builtin_return_address(0)); | 354 | __builtin_return_address(0)); |
diff --git a/drivers/pwm/pwm-img.c b/drivers/pwm/pwm-img.c index 476171a768d6..8a029f9bc18c 100644 --- a/drivers/pwm/pwm-img.c +++ b/drivers/pwm/pwm-img.c | |||
@@ -16,6 +16,7 @@ | |||
16 | #include <linux/mfd/syscon.h> | 16 | #include <linux/mfd/syscon.h> |
17 | #include <linux/module.h> | 17 | #include <linux/module.h> |
18 | #include <linux/of.h> | 18 | #include <linux/of.h> |
19 | #include <linux/of_device.h> | ||
19 | #include <linux/platform_device.h> | 20 | #include <linux/platform_device.h> |
20 | #include <linux/pwm.h> | 21 | #include <linux/pwm.h> |
21 | #include <linux/regmap.h> | 22 | #include <linux/regmap.h> |
@@ -38,7 +39,22 @@ | |||
38 | #define PERIP_PWM_PDM_CONTROL_CH_MASK 0x1 | 39 | #define PERIP_PWM_PDM_CONTROL_CH_MASK 0x1 |
39 | #define PERIP_PWM_PDM_CONTROL_CH_SHIFT(ch) ((ch) * 4) | 40 | #define PERIP_PWM_PDM_CONTROL_CH_SHIFT(ch) ((ch) * 4) |
40 | 41 | ||
41 | #define MAX_TMBASE_STEPS 65536 | 42 | /* |
43 | * PWM period is specified with a timebase register, | ||
44 | * in number of step periods. The PWM duty cycle is also | ||
45 | * specified in step periods, in the [0, $timebase] range. | ||
46 | * In other words, the timebase imposes the duty cycle | ||
47 | * resolution. Therefore, let's constraint the timebase to | ||
48 | * a minimum value to allow a sane range of duty cycle values. | ||
49 | * Imposing a minimum timebase, will impose a maximum PWM frequency. | ||
50 | * | ||
51 | * The value chosen is completely arbitrary. | ||
52 | */ | ||
53 | #define MIN_TMBASE_STEPS 16 | ||
54 | |||
55 | struct img_pwm_soc_data { | ||
56 | u32 max_timebase; | ||
57 | }; | ||
42 | 58 | ||
43 | struct img_pwm_chip { | 59 | struct img_pwm_chip { |
44 | struct device *dev; | 60 | struct device *dev; |
@@ -47,6 +63,9 @@ struct img_pwm_chip { | |||
47 | struct clk *sys_clk; | 63 | struct clk *sys_clk; |
48 | void __iomem *base; | 64 | void __iomem *base; |
49 | struct regmap *periph_regs; | 65 | struct regmap *periph_regs; |
66 | int max_period_ns; | ||
67 | int min_period_ns; | ||
68 | const struct img_pwm_soc_data *data; | ||
50 | }; | 69 | }; |
51 | 70 | ||
52 | static inline struct img_pwm_chip *to_img_pwm_chip(struct pwm_chip *chip) | 71 | static inline struct img_pwm_chip *to_img_pwm_chip(struct pwm_chip *chip) |
@@ -72,24 +91,31 @@ static int img_pwm_config(struct pwm_chip *chip, struct pwm_device *pwm, | |||
72 | u32 val, div, duty, timebase; | 91 | u32 val, div, duty, timebase; |
73 | unsigned long mul, output_clk_hz, input_clk_hz; | 92 | unsigned long mul, output_clk_hz, input_clk_hz; |
74 | struct img_pwm_chip *pwm_chip = to_img_pwm_chip(chip); | 93 | struct img_pwm_chip *pwm_chip = to_img_pwm_chip(chip); |
94 | unsigned int max_timebase = pwm_chip->data->max_timebase; | ||
95 | |||
96 | if (period_ns < pwm_chip->min_period_ns || | ||
97 | period_ns > pwm_chip->max_period_ns) { | ||
98 | dev_err(chip->dev, "configured period not in range\n"); | ||
99 | return -ERANGE; | ||
100 | } | ||
75 | 101 | ||
76 | input_clk_hz = clk_get_rate(pwm_chip->pwm_clk); | 102 | input_clk_hz = clk_get_rate(pwm_chip->pwm_clk); |
77 | output_clk_hz = DIV_ROUND_UP(NSEC_PER_SEC, period_ns); | 103 | output_clk_hz = DIV_ROUND_UP(NSEC_PER_SEC, period_ns); |
78 | 104 | ||
79 | mul = DIV_ROUND_UP(input_clk_hz, output_clk_hz); | 105 | mul = DIV_ROUND_UP(input_clk_hz, output_clk_hz); |
80 | if (mul <= MAX_TMBASE_STEPS) { | 106 | if (mul <= max_timebase) { |
81 | div = PWM_CTRL_CFG_NO_SUB_DIV; | 107 | div = PWM_CTRL_CFG_NO_SUB_DIV; |
82 | timebase = DIV_ROUND_UP(mul, 1); | 108 | timebase = DIV_ROUND_UP(mul, 1); |
83 | } else if (mul <= MAX_TMBASE_STEPS * 8) { | 109 | } else if (mul <= max_timebase * 8) { |
84 | div = PWM_CTRL_CFG_SUB_DIV0; | 110 | div = PWM_CTRL_CFG_SUB_DIV0; |
85 | timebase = DIV_ROUND_UP(mul, 8); | 111 | timebase = DIV_ROUND_UP(mul, 8); |
86 | } else if (mul <= MAX_TMBASE_STEPS * 64) { | 112 | } else if (mul <= max_timebase * 64) { |
87 | div = PWM_CTRL_CFG_SUB_DIV1; | 113 | div = PWM_CTRL_CFG_SUB_DIV1; |
88 | timebase = DIV_ROUND_UP(mul, 64); | 114 | timebase = DIV_ROUND_UP(mul, 64); |
89 | } else if (mul <= MAX_TMBASE_STEPS * 512) { | 115 | } else if (mul <= max_timebase * 512) { |
90 | div = PWM_CTRL_CFG_SUB_DIV0_DIV1; | 116 | div = PWM_CTRL_CFG_SUB_DIV0_DIV1; |
91 | timebase = DIV_ROUND_UP(mul, 512); | 117 | timebase = DIV_ROUND_UP(mul, 512); |
92 | } else if (mul > MAX_TMBASE_STEPS * 512) { | 118 | } else if (mul > max_timebase * 512) { |
93 | dev_err(chip->dev, | 119 | dev_err(chip->dev, |
94 | "failed to configure timebase steps/divider value\n"); | 120 | "failed to configure timebase steps/divider value\n"); |
95 | return -EINVAL; | 121 | return -EINVAL; |
@@ -143,11 +169,27 @@ static const struct pwm_ops img_pwm_ops = { | |||
143 | .owner = THIS_MODULE, | 169 | .owner = THIS_MODULE, |
144 | }; | 170 | }; |
145 | 171 | ||
172 | static const struct img_pwm_soc_data pistachio_pwm = { | ||
173 | .max_timebase = 255, | ||
174 | }; | ||
175 | |||
176 | static const struct of_device_id img_pwm_of_match[] = { | ||
177 | { | ||
178 | .compatible = "img,pistachio-pwm", | ||
179 | .data = &pistachio_pwm, | ||
180 | }, | ||
181 | { } | ||
182 | }; | ||
183 | MODULE_DEVICE_TABLE(of, img_pwm_of_match); | ||
184 | |||
146 | static int img_pwm_probe(struct platform_device *pdev) | 185 | static int img_pwm_probe(struct platform_device *pdev) |
147 | { | 186 | { |
148 | int ret; | 187 | int ret; |
188 | u64 val; | ||
189 | unsigned long clk_rate; | ||
149 | struct resource *res; | 190 | struct resource *res; |
150 | struct img_pwm_chip *pwm; | 191 | struct img_pwm_chip *pwm; |
192 | const struct of_device_id *of_dev_id; | ||
151 | 193 | ||
152 | pwm = devm_kzalloc(&pdev->dev, sizeof(*pwm), GFP_KERNEL); | 194 | pwm = devm_kzalloc(&pdev->dev, sizeof(*pwm), GFP_KERNEL); |
153 | if (!pwm) | 195 | if (!pwm) |
@@ -160,6 +202,11 @@ static int img_pwm_probe(struct platform_device *pdev) | |||
160 | if (IS_ERR(pwm->base)) | 202 | if (IS_ERR(pwm->base)) |
161 | return PTR_ERR(pwm->base); | 203 | return PTR_ERR(pwm->base); |
162 | 204 | ||
205 | of_dev_id = of_match_device(img_pwm_of_match, &pdev->dev); | ||
206 | if (!of_dev_id) | ||
207 | return -ENODEV; | ||
208 | pwm->data = of_dev_id->data; | ||
209 | |||
163 | pwm->periph_regs = syscon_regmap_lookup_by_phandle(pdev->dev.of_node, | 210 | pwm->periph_regs = syscon_regmap_lookup_by_phandle(pdev->dev.of_node, |
164 | "img,cr-periph"); | 211 | "img,cr-periph"); |
165 | if (IS_ERR(pwm->periph_regs)) | 212 | if (IS_ERR(pwm->periph_regs)) |
@@ -189,6 +236,17 @@ static int img_pwm_probe(struct platform_device *pdev) | |||
189 | goto disable_sysclk; | 236 | goto disable_sysclk; |
190 | } | 237 | } |
191 | 238 | ||
239 | clk_rate = clk_get_rate(pwm->pwm_clk); | ||
240 | |||
241 | /* The maximum input clock divider is 512 */ | ||
242 | val = (u64)NSEC_PER_SEC * 512 * pwm->data->max_timebase; | ||
243 | do_div(val, clk_rate); | ||
244 | pwm->max_period_ns = val; | ||
245 | |||
246 | val = (u64)NSEC_PER_SEC * MIN_TMBASE_STEPS; | ||
247 | do_div(val, clk_rate); | ||
248 | pwm->min_period_ns = val; | ||
249 | |||
192 | pwm->chip.dev = &pdev->dev; | 250 | pwm->chip.dev = &pdev->dev; |
193 | pwm->chip.ops = &img_pwm_ops; | 251 | pwm->chip.ops = &img_pwm_ops; |
194 | pwm->chip.base = -1; | 252 | pwm->chip.base = -1; |
@@ -228,12 +286,6 @@ static int img_pwm_remove(struct platform_device *pdev) | |||
228 | return pwmchip_remove(&pwm_chip->chip); | 286 | return pwmchip_remove(&pwm_chip->chip); |
229 | } | 287 | } |
230 | 288 | ||
231 | static const struct of_device_id img_pwm_of_match[] = { | ||
232 | { .compatible = "img,pistachio-pwm", }, | ||
233 | { } | ||
234 | }; | ||
235 | MODULE_DEVICE_TABLE(of, img_pwm_of_match); | ||
236 | |||
237 | static struct platform_driver img_pwm_driver = { | 289 | static struct platform_driver img_pwm_driver = { |
238 | .driver = { | 290 | .driver = { |
239 | .name = "img-pwm", | 291 | .name = "img-pwm", |
diff --git a/drivers/rtc/rtc-armada38x.c b/drivers/rtc/rtc-armada38x.c index cb70ced7e0db..4b62d1a875e4 100644 --- a/drivers/rtc/rtc-armada38x.c +++ b/drivers/rtc/rtc-armada38x.c | |||
@@ -64,7 +64,7 @@ static void rtc_delayed_write(u32 val, struct armada38x_rtc *rtc, int offset) | |||
64 | static int armada38x_rtc_read_time(struct device *dev, struct rtc_time *tm) | 64 | static int armada38x_rtc_read_time(struct device *dev, struct rtc_time *tm) |
65 | { | 65 | { |
66 | struct armada38x_rtc *rtc = dev_get_drvdata(dev); | 66 | struct armada38x_rtc *rtc = dev_get_drvdata(dev); |
67 | unsigned long time, time_check, flags; | 67 | unsigned long time, time_check; |
68 | 68 | ||
69 | mutex_lock(&rtc->mutex_time); | 69 | mutex_lock(&rtc->mutex_time); |
70 | time = readl(rtc->regs + RTC_TIME); | 70 | time = readl(rtc->regs + RTC_TIME); |
diff --git a/drivers/s390/crypto/ap_bus.c b/drivers/s390/crypto/ap_bus.c index f0b9871a4bbd..3ba611419759 100644 --- a/drivers/s390/crypto/ap_bus.c +++ b/drivers/s390/crypto/ap_bus.c | |||
@@ -1158,11 +1158,12 @@ static ssize_t poll_timeout_store(struct bus_type *bus, const char *buf, | |||
1158 | poll_timeout = time; | 1158 | poll_timeout = time; |
1159 | hr_time = ktime_set(0, poll_timeout); | 1159 | hr_time = ktime_set(0, poll_timeout); |
1160 | 1160 | ||
1161 | if (!hrtimer_is_queued(&ap_poll_timer) || | 1161 | spin_lock_bh(&ap_poll_timer_lock); |
1162 | !hrtimer_forward(&ap_poll_timer, hrtimer_get_expires(&ap_poll_timer), hr_time)) { | 1162 | hrtimer_cancel(&ap_poll_timer); |
1163 | hrtimer_set_expires(&ap_poll_timer, hr_time); | 1163 | hrtimer_set_expires(&ap_poll_timer, hr_time); |
1164 | hrtimer_start_expires(&ap_poll_timer, HRTIMER_MODE_ABS); | 1164 | hrtimer_start_expires(&ap_poll_timer, HRTIMER_MODE_ABS); |
1165 | } | 1165 | spin_unlock_bh(&ap_poll_timer_lock); |
1166 | |||
1166 | return count; | 1167 | return count; |
1167 | } | 1168 | } |
1168 | 1169 | ||
@@ -1528,14 +1529,11 @@ static inline void __ap_schedule_poll_timer(void) | |||
1528 | ktime_t hr_time; | 1529 | ktime_t hr_time; |
1529 | 1530 | ||
1530 | spin_lock_bh(&ap_poll_timer_lock); | 1531 | spin_lock_bh(&ap_poll_timer_lock); |
1531 | if (hrtimer_is_queued(&ap_poll_timer) || ap_suspend_flag) | 1532 | if (!hrtimer_is_queued(&ap_poll_timer) && !ap_suspend_flag) { |
1532 | goto out; | ||
1533 | if (ktime_to_ns(hrtimer_expires_remaining(&ap_poll_timer)) <= 0) { | ||
1534 | hr_time = ktime_set(0, poll_timeout); | 1533 | hr_time = ktime_set(0, poll_timeout); |
1535 | hrtimer_forward_now(&ap_poll_timer, hr_time); | 1534 | hrtimer_forward_now(&ap_poll_timer, hr_time); |
1536 | hrtimer_restart(&ap_poll_timer); | 1535 | hrtimer_restart(&ap_poll_timer); |
1537 | } | 1536 | } |
1538 | out: | ||
1539 | spin_unlock_bh(&ap_poll_timer_lock); | 1537 | spin_unlock_bh(&ap_poll_timer_lock); |
1540 | } | 1538 | } |
1541 | 1539 | ||
@@ -1952,7 +1950,7 @@ static void ap_reset_domain(void) | |||
1952 | { | 1950 | { |
1953 | int i; | 1951 | int i; |
1954 | 1952 | ||
1955 | if (ap_domain_index != -1) | 1953 | if ((ap_domain_index != -1) && (ap_test_config_domain(ap_domain_index))) |
1956 | for (i = 0; i < AP_DEVICES; i++) | 1954 | for (i = 0; i < AP_DEVICES; i++) |
1957 | ap_reset_queue(AP_MKQID(i, ap_domain_index)); | 1955 | ap_reset_queue(AP_MKQID(i, ap_domain_index)); |
1958 | } | 1956 | } |
@@ -2097,7 +2095,6 @@ void ap_module_exit(void) | |||
2097 | hrtimer_cancel(&ap_poll_timer); | 2095 | hrtimer_cancel(&ap_poll_timer); |
2098 | destroy_workqueue(ap_work_queue); | 2096 | destroy_workqueue(ap_work_queue); |
2099 | tasklet_kill(&ap_tasklet); | 2097 | tasklet_kill(&ap_tasklet); |
2100 | root_device_unregister(ap_root_device); | ||
2101 | while ((dev = bus_find_device(&ap_bus_type, NULL, NULL, | 2098 | while ((dev = bus_find_device(&ap_bus_type, NULL, NULL, |
2102 | __ap_match_all))) | 2099 | __ap_match_all))) |
2103 | { | 2100 | { |
@@ -2106,6 +2103,7 @@ void ap_module_exit(void) | |||
2106 | } | 2103 | } |
2107 | for (i = 0; ap_bus_attrs[i]; i++) | 2104 | for (i = 0; ap_bus_attrs[i]; i++) |
2108 | bus_remove_file(&ap_bus_type, ap_bus_attrs[i]); | 2105 | bus_remove_file(&ap_bus_type, ap_bus_attrs[i]); |
2106 | root_device_unregister(ap_root_device); | ||
2109 | bus_unregister(&ap_bus_type); | 2107 | bus_unregister(&ap_bus_type); |
2110 | unregister_reset_call(&ap_reset_call); | 2108 | unregister_reset_call(&ap_reset_call); |
2111 | if (ap_using_interrupts()) | 2109 | if (ap_using_interrupts()) |
diff --git a/drivers/staging/gdm724x/gdm_mux.c b/drivers/staging/gdm724x/gdm_mux.c index 8199b0a697bb..1cf24e4edf25 100644 --- a/drivers/staging/gdm724x/gdm_mux.c +++ b/drivers/staging/gdm724x/gdm_mux.c | |||
@@ -158,7 +158,7 @@ static int up_to_host(struct mux_rx *r) | |||
158 | unsigned int start_flag; | 158 | unsigned int start_flag; |
159 | unsigned int payload_size; | 159 | unsigned int payload_size; |
160 | unsigned short packet_type; | 160 | unsigned short packet_type; |
161 | int dummy_cnt; | 161 | int total_len; |
162 | u32 packet_size_sum = r->offset; | 162 | u32 packet_size_sum = r->offset; |
163 | int index; | 163 | int index; |
164 | int ret = TO_HOST_INVALID_PACKET; | 164 | int ret = TO_HOST_INVALID_PACKET; |
@@ -176,10 +176,10 @@ static int up_to_host(struct mux_rx *r) | |||
176 | break; | 176 | break; |
177 | } | 177 | } |
178 | 178 | ||
179 | dummy_cnt = ALIGN(MUX_HEADER_SIZE + payload_size, 4); | 179 | total_len = ALIGN(MUX_HEADER_SIZE + payload_size, 4); |
180 | 180 | ||
181 | if (len - packet_size_sum < | 181 | if (len - packet_size_sum < |
182 | MUX_HEADER_SIZE + payload_size + dummy_cnt) { | 182 | total_len) { |
183 | pr_err("invalid payload : %d %d %04x\n", | 183 | pr_err("invalid payload : %d %d %04x\n", |
184 | payload_size, len, packet_type); | 184 | payload_size, len, packet_type); |
185 | break; | 185 | break; |
@@ -202,7 +202,7 @@ static int up_to_host(struct mux_rx *r) | |||
202 | break; | 202 | break; |
203 | } | 203 | } |
204 | 204 | ||
205 | packet_size_sum += MUX_HEADER_SIZE + payload_size + dummy_cnt; | 205 | packet_size_sum += total_len; |
206 | if (len - packet_size_sum <= MUX_HEADER_SIZE + 2) { | 206 | if (len - packet_size_sum <= MUX_HEADER_SIZE + 2) { |
207 | ret = r->callback(NULL, | 207 | ret = r->callback(NULL, |
208 | 0, | 208 | 0, |
@@ -361,7 +361,6 @@ static int gdm_mux_send(void *priv_dev, void *data, int len, int tty_index, | |||
361 | struct mux_pkt_header *mux_header; | 361 | struct mux_pkt_header *mux_header; |
362 | struct mux_tx *t = NULL; | 362 | struct mux_tx *t = NULL; |
363 | static u32 seq_num = 1; | 363 | static u32 seq_num = 1; |
364 | int dummy_cnt; | ||
365 | int total_len; | 364 | int total_len; |
366 | int ret; | 365 | int ret; |
367 | unsigned long flags; | 366 | unsigned long flags; |
@@ -374,9 +373,7 @@ static int gdm_mux_send(void *priv_dev, void *data, int len, int tty_index, | |||
374 | 373 | ||
375 | spin_lock_irqsave(&mux_dev->write_lock, flags); | 374 | spin_lock_irqsave(&mux_dev->write_lock, flags); |
376 | 375 | ||
377 | dummy_cnt = ALIGN(MUX_HEADER_SIZE + len, 4); | 376 | total_len = ALIGN(MUX_HEADER_SIZE + len, 4); |
378 | |||
379 | total_len = len + MUX_HEADER_SIZE + dummy_cnt; | ||
380 | 377 | ||
381 | t = alloc_mux_tx(total_len); | 378 | t = alloc_mux_tx(total_len); |
382 | if (!t) { | 379 | if (!t) { |
@@ -392,7 +389,8 @@ static int gdm_mux_send(void *priv_dev, void *data, int len, int tty_index, | |||
392 | mux_header->packet_type = __cpu_to_le16(packet_type[tty_index]); | 389 | mux_header->packet_type = __cpu_to_le16(packet_type[tty_index]); |
393 | 390 | ||
394 | memcpy(t->buf+MUX_HEADER_SIZE, data, len); | 391 | memcpy(t->buf+MUX_HEADER_SIZE, data, len); |
395 | memset(t->buf+MUX_HEADER_SIZE+len, 0, dummy_cnt); | 392 | memset(t->buf+MUX_HEADER_SIZE+len, 0, total_len - MUX_HEADER_SIZE - |
393 | len); | ||
396 | 394 | ||
397 | t->len = total_len; | 395 | t->len = total_len; |
398 | t->callback = cb; | 396 | t->callback = cb; |
diff --git a/drivers/staging/rtl8712/rtl871x_ioctl_linux.c b/drivers/staging/rtl8712/rtl871x_ioctl_linux.c index 42fba3f5b593..cb0b6387789f 100644 --- a/drivers/staging/rtl8712/rtl871x_ioctl_linux.c +++ b/drivers/staging/rtl8712/rtl871x_ioctl_linux.c | |||
@@ -1900,23 +1900,20 @@ static int r871x_mp_ioctl_hdl(struct net_device *dev, | |||
1900 | struct mp_ioctl_handler *phandler; | 1900 | struct mp_ioctl_handler *phandler; |
1901 | struct mp_ioctl_param *poidparam; | 1901 | struct mp_ioctl_param *poidparam; |
1902 | unsigned long BytesRead, BytesWritten, BytesNeeded; | 1902 | unsigned long BytesRead, BytesWritten, BytesNeeded; |
1903 | u8 *pparmbuf = NULL, bset; | 1903 | u8 *pparmbuf, bset; |
1904 | u16 len; | 1904 | u16 len; |
1905 | uint status; | 1905 | uint status; |
1906 | int ret = 0; | 1906 | int ret = 0; |
1907 | 1907 | ||
1908 | if ((!p->length) || (!p->pointer)) { | 1908 | if ((!p->length) || (!p->pointer)) |
1909 | ret = -EINVAL; | 1909 | return -EINVAL; |
1910 | goto _r871x_mp_ioctl_hdl_exit; | 1910 | |
1911 | } | ||
1912 | bset = (u8)(p->flags & 0xFFFF); | 1911 | bset = (u8)(p->flags & 0xFFFF); |
1913 | len = p->length; | 1912 | len = p->length; |
1914 | pparmbuf = NULL; | ||
1915 | pparmbuf = memdup_user(p->pointer, len); | 1913 | pparmbuf = memdup_user(p->pointer, len); |
1916 | if (IS_ERR(pparmbuf)) { | 1914 | if (IS_ERR(pparmbuf)) |
1917 | ret = PTR_ERR(pparmbuf); | 1915 | return PTR_ERR(pparmbuf); |
1918 | goto _r871x_mp_ioctl_hdl_exit; | 1916 | |
1919 | } | ||
1920 | poidparam = (struct mp_ioctl_param *)pparmbuf; | 1917 | poidparam = (struct mp_ioctl_param *)pparmbuf; |
1921 | if (poidparam->subcode >= MAX_MP_IOCTL_SUBCODE) { | 1918 | if (poidparam->subcode >= MAX_MP_IOCTL_SUBCODE) { |
1922 | ret = -EINVAL; | 1919 | ret = -EINVAL; |
diff --git a/drivers/staging/sm750fb/sm750.c b/drivers/staging/sm750fb/sm750.c index 3c7ea95dd9f9..dbbb2f879a29 100644 --- a/drivers/staging/sm750fb/sm750.c +++ b/drivers/staging/sm750fb/sm750.c | |||
@@ -1250,7 +1250,7 @@ err_enable: | |||
1250 | return -ENODEV; | 1250 | return -ENODEV; |
1251 | } | 1251 | } |
1252 | 1252 | ||
1253 | static void __exit lynxfb_pci_remove(struct pci_dev *pdev) | 1253 | static void lynxfb_pci_remove(struct pci_dev *pdev) |
1254 | { | 1254 | { |
1255 | struct fb_info *info; | 1255 | struct fb_info *info; |
1256 | struct lynx_share *share; | 1256 | struct lynx_share *share; |
diff --git a/drivers/staging/vt6655/card.c b/drivers/staging/vt6655/card.c index 1cdcf49b2445..e00c0605d154 100644 --- a/drivers/staging/vt6655/card.c +++ b/drivers/staging/vt6655/card.c | |||
@@ -362,12 +362,16 @@ bool CARDbSetPhyParameter(struct vnt_private *pDevice, u8 bb_type) | |||
362 | * Return Value: none | 362 | * Return Value: none |
363 | */ | 363 | */ |
364 | bool CARDbUpdateTSF(struct vnt_private *pDevice, unsigned char byRxRate, | 364 | bool CARDbUpdateTSF(struct vnt_private *pDevice, unsigned char byRxRate, |
365 | u64 qwBSSTimestamp, u64 qwLocalTSF) | 365 | u64 qwBSSTimestamp) |
366 | { | 366 | { |
367 | u64 local_tsf; | ||
367 | u64 qwTSFOffset = 0; | 368 | u64 qwTSFOffset = 0; |
368 | 369 | ||
369 | if (qwBSSTimestamp != qwLocalTSF) { | 370 | CARDbGetCurrentTSF(pDevice, &local_tsf); |
370 | qwTSFOffset = CARDqGetTSFOffset(byRxRate, qwBSSTimestamp, qwLocalTSF); | 371 | |
372 | if (qwBSSTimestamp != local_tsf) { | ||
373 | qwTSFOffset = CARDqGetTSFOffset(byRxRate, qwBSSTimestamp, | ||
374 | local_tsf); | ||
371 | /* adjust TSF, HW's TSF add TSF Offset reg */ | 375 | /* adjust TSF, HW's TSF add TSF Offset reg */ |
372 | VNSvOutPortD(pDevice->PortOffset + MAC_REG_TSFOFST, (u32)qwTSFOffset); | 376 | VNSvOutPortD(pDevice->PortOffset + MAC_REG_TSFOFST, (u32)qwTSFOffset); |
373 | VNSvOutPortD(pDevice->PortOffset + MAC_REG_TSFOFST + 4, (u32)(qwTSFOffset >> 32)); | 377 | VNSvOutPortD(pDevice->PortOffset + MAC_REG_TSFOFST + 4, (u32)(qwTSFOffset >> 32)); |
diff --git a/drivers/staging/vt6655/card.h b/drivers/staging/vt6655/card.h index 2dfc41952271..16cca49e680a 100644 --- a/drivers/staging/vt6655/card.h +++ b/drivers/staging/vt6655/card.h | |||
@@ -83,7 +83,7 @@ bool CARDbRadioPowerOff(struct vnt_private *); | |||
83 | bool CARDbRadioPowerOn(struct vnt_private *); | 83 | bool CARDbRadioPowerOn(struct vnt_private *); |
84 | bool CARDbSetPhyParameter(struct vnt_private *, u8); | 84 | bool CARDbSetPhyParameter(struct vnt_private *, u8); |
85 | bool CARDbUpdateTSF(struct vnt_private *, unsigned char byRxRate, | 85 | bool CARDbUpdateTSF(struct vnt_private *, unsigned char byRxRate, |
86 | u64 qwBSSTimestamp, u64 qwLocalTSF); | 86 | u64 qwBSSTimestamp); |
87 | bool CARDbSetBeaconPeriod(struct vnt_private *, unsigned short wBeaconInterval); | 87 | bool CARDbSetBeaconPeriod(struct vnt_private *, unsigned short wBeaconInterval); |
88 | 88 | ||
89 | #endif /* __CARD_H__ */ | 89 | #endif /* __CARD_H__ */ |
diff --git a/drivers/staging/vt6655/device_main.c b/drivers/staging/vt6655/device_main.c index 6b2f813afb52..ecd7c0f82481 100644 --- a/drivers/staging/vt6655/device_main.c +++ b/drivers/staging/vt6655/device_main.c | |||
@@ -912,7 +912,11 @@ static int vnt_int_report_rate(struct vnt_private *priv, | |||
912 | 912 | ||
913 | if (!(tsr1 & TSR1_TERR)) { | 913 | if (!(tsr1 & TSR1_TERR)) { |
914 | info->status.rates[0].idx = idx; | 914 | info->status.rates[0].idx = idx; |
915 | info->flags |= IEEE80211_TX_STAT_ACK; | 915 | |
916 | if (info->flags & IEEE80211_TX_CTL_NO_ACK) | ||
917 | info->flags |= IEEE80211_TX_STAT_NOACK_TRANSMITTED; | ||
918 | else | ||
919 | info->flags |= IEEE80211_TX_STAT_ACK; | ||
916 | } | 920 | } |
917 | 921 | ||
918 | return 0; | 922 | return 0; |
@@ -937,9 +941,6 @@ static int device_tx_srv(struct vnt_private *pDevice, unsigned int uIdx) | |||
937 | /* Only the status of first TD in the chain is correct */ | 941 | /* Only the status of first TD in the chain is correct */ |
938 | if (pTD->m_td1TD1.byTCR & TCR_STP) { | 942 | if (pTD->m_td1TD1.byTCR & TCR_STP) { |
939 | if ((pTD->pTDInfo->byFlags & TD_FLAGS_NETIF_SKB) != 0) { | 943 | if ((pTD->pTDInfo->byFlags & TD_FLAGS_NETIF_SKB) != 0) { |
940 | |||
941 | vnt_int_report_rate(pDevice, pTD->pTDInfo, byTsr0, byTsr1); | ||
942 | |||
943 | if (!(byTsr1 & TSR1_TERR)) { | 944 | if (!(byTsr1 & TSR1_TERR)) { |
944 | if (byTsr0 != 0) { | 945 | if (byTsr0 != 0) { |
945 | pr_debug(" Tx[%d] OK but has error. tsr1[%02X] tsr0[%02X]\n", | 946 | pr_debug(" Tx[%d] OK but has error. tsr1[%02X] tsr0[%02X]\n", |
@@ -958,6 +959,9 @@ static int device_tx_srv(struct vnt_private *pDevice, unsigned int uIdx) | |||
958 | (int)uIdx, byTsr1, byTsr0); | 959 | (int)uIdx, byTsr1, byTsr0); |
959 | } | 960 | } |
960 | } | 961 | } |
962 | |||
963 | vnt_int_report_rate(pDevice, pTD->pTDInfo, byTsr0, byTsr1); | ||
964 | |||
961 | device_free_tx_buf(pDevice, pTD); | 965 | device_free_tx_buf(pDevice, pTD); |
962 | pDevice->iTDUsed[uIdx]--; | 966 | pDevice->iTDUsed[uIdx]--; |
963 | } | 967 | } |
@@ -989,10 +993,8 @@ static void device_free_tx_buf(struct vnt_private *pDevice, PSTxDesc pDesc) | |||
989 | skb->len, DMA_TO_DEVICE); | 993 | skb->len, DMA_TO_DEVICE); |
990 | } | 994 | } |
991 | 995 | ||
992 | if (pTDInfo->byFlags & TD_FLAGS_NETIF_SKB) | 996 | if (skb) |
993 | ieee80211_tx_status_irqsafe(pDevice->hw, skb); | 997 | ieee80211_tx_status_irqsafe(pDevice->hw, skb); |
994 | else | ||
995 | dev_kfree_skb_irq(skb); | ||
996 | 998 | ||
997 | pTDInfo->skb_dma = 0; | 999 | pTDInfo->skb_dma = 0; |
998 | pTDInfo->skb = NULL; | 1000 | pTDInfo->skb = NULL; |
@@ -1204,14 +1206,6 @@ static int vnt_tx_packet(struct vnt_private *priv, struct sk_buff *skb) | |||
1204 | if (dma_idx == TYPE_AC0DMA) | 1206 | if (dma_idx == TYPE_AC0DMA) |
1205 | head_td->pTDInfo->byFlags = TD_FLAGS_NETIF_SKB; | 1207 | head_td->pTDInfo->byFlags = TD_FLAGS_NETIF_SKB; |
1206 | 1208 | ||
1207 | priv->iTDUsed[dma_idx]++; | ||
1208 | |||
1209 | /* Take ownership */ | ||
1210 | wmb(); | ||
1211 | head_td->m_td0TD0.f1Owner = OWNED_BY_NIC; | ||
1212 | |||
1213 | /* get Next */ | ||
1214 | wmb(); | ||
1215 | priv->apCurrTD[dma_idx] = head_td->next; | 1209 | priv->apCurrTD[dma_idx] = head_td->next; |
1216 | 1210 | ||
1217 | spin_unlock_irqrestore(&priv->lock, flags); | 1211 | spin_unlock_irqrestore(&priv->lock, flags); |
@@ -1232,11 +1226,18 @@ static int vnt_tx_packet(struct vnt_private *priv, struct sk_buff *skb) | |||
1232 | 1226 | ||
1233 | head_td->buff_addr = cpu_to_le32(head_td->pTDInfo->skb_dma); | 1227 | head_td->buff_addr = cpu_to_le32(head_td->pTDInfo->skb_dma); |
1234 | 1228 | ||
1229 | /* Poll Transmit the adapter */ | ||
1230 | wmb(); | ||
1231 | head_td->m_td0TD0.f1Owner = OWNED_BY_NIC; | ||
1232 | wmb(); /* second memory barrier */ | ||
1233 | |||
1235 | if (head_td->pTDInfo->byFlags & TD_FLAGS_NETIF_SKB) | 1234 | if (head_td->pTDInfo->byFlags & TD_FLAGS_NETIF_SKB) |
1236 | MACvTransmitAC0(priv->PortOffset); | 1235 | MACvTransmitAC0(priv->PortOffset); |
1237 | else | 1236 | else |
1238 | MACvTransmit0(priv->PortOffset); | 1237 | MACvTransmit0(priv->PortOffset); |
1239 | 1238 | ||
1239 | priv->iTDUsed[dma_idx]++; | ||
1240 | |||
1240 | spin_unlock_irqrestore(&priv->lock, flags); | 1241 | spin_unlock_irqrestore(&priv->lock, flags); |
1241 | 1242 | ||
1242 | return 0; | 1243 | return 0; |
@@ -1416,9 +1417,16 @@ static void vnt_bss_info_changed(struct ieee80211_hw *hw, | |||
1416 | 1417 | ||
1417 | priv->current_aid = conf->aid; | 1418 | priv->current_aid = conf->aid; |
1418 | 1419 | ||
1419 | if (changed & BSS_CHANGED_BSSID) | 1420 | if (changed & BSS_CHANGED_BSSID) { |
1421 | unsigned long flags; | ||
1422 | |||
1423 | spin_lock_irqsave(&priv->lock, flags); | ||
1424 | |||
1420 | MACvWriteBSSIDAddress(priv->PortOffset, (u8 *)conf->bssid); | 1425 | MACvWriteBSSIDAddress(priv->PortOffset, (u8 *)conf->bssid); |
1421 | 1426 | ||
1427 | spin_unlock_irqrestore(&priv->lock, flags); | ||
1428 | } | ||
1429 | |||
1422 | if (changed & BSS_CHANGED_BASIC_RATES) { | 1430 | if (changed & BSS_CHANGED_BASIC_RATES) { |
1423 | priv->basic_rates = conf->basic_rates; | 1431 | priv->basic_rates = conf->basic_rates; |
1424 | 1432 | ||
@@ -1477,7 +1485,7 @@ static void vnt_bss_info_changed(struct ieee80211_hw *hw, | |||
1477 | if (changed & BSS_CHANGED_ASSOC && priv->op_mode != NL80211_IFTYPE_AP) { | 1485 | if (changed & BSS_CHANGED_ASSOC && priv->op_mode != NL80211_IFTYPE_AP) { |
1478 | if (conf->assoc) { | 1486 | if (conf->assoc) { |
1479 | CARDbUpdateTSF(priv, conf->beacon_rate->hw_value, | 1487 | CARDbUpdateTSF(priv, conf->beacon_rate->hw_value, |
1480 | conf->sync_device_ts, conf->sync_tsf); | 1488 | conf->sync_tsf); |
1481 | 1489 | ||
1482 | CARDbSetBeaconPeriod(priv, conf->beacon_int); | 1490 | CARDbSetBeaconPeriod(priv, conf->beacon_int); |
1483 | 1491 | ||
diff --git a/drivers/staging/vt6656/rxtx.c b/drivers/staging/vt6656/rxtx.c index f6c2cf8590c4..5c589962a1e8 100644 --- a/drivers/staging/vt6656/rxtx.c +++ b/drivers/staging/vt6656/rxtx.c | |||
@@ -805,10 +805,18 @@ int vnt_tx_packet(struct vnt_private *priv, struct sk_buff *skb) | |||
805 | vnt_schedule_command(priv, WLAN_CMD_SETPOWER); | 805 | vnt_schedule_command(priv, WLAN_CMD_SETPOWER); |
806 | } | 806 | } |
807 | 807 | ||
808 | if (current_rate > RATE_11M) | 808 | if (current_rate > RATE_11M) { |
809 | pkt_type = priv->packet_type; | 809 | if (info->band == IEEE80211_BAND_5GHZ) { |
810 | else | 810 | pkt_type = PK_TYPE_11A; |
811 | } else { | ||
812 | if (tx_rate->flags & IEEE80211_TX_RC_USE_CTS_PROTECT) | ||
813 | pkt_type = PK_TYPE_11GB; | ||
814 | else | ||
815 | pkt_type = PK_TYPE_11GA; | ||
816 | } | ||
817 | } else { | ||
811 | pkt_type = PK_TYPE_11B; | 818 | pkt_type = PK_TYPE_11B; |
819 | } | ||
812 | 820 | ||
813 | spin_lock_irqsave(&priv->lock, flags); | 821 | spin_lock_irqsave(&priv->lock, flags); |
814 | 822 | ||
diff --git a/drivers/thermal/armada_thermal.c b/drivers/thermal/armada_thermal.c index c2556cf5186b..01255fd65135 100644 --- a/drivers/thermal/armada_thermal.c +++ b/drivers/thermal/armada_thermal.c | |||
@@ -224,9 +224,9 @@ static const struct armada_thermal_data armada380_data = { | |||
224 | .is_valid_shift = 10, | 224 | .is_valid_shift = 10, |
225 | .temp_shift = 0, | 225 | .temp_shift = 0, |
226 | .temp_mask = 0x3ff, | 226 | .temp_mask = 0x3ff, |
227 | .coef_b = 1169498786UL, | 227 | .coef_b = 2931108200UL, |
228 | .coef_m = 2000000UL, | 228 | .coef_m = 5000000UL, |
229 | .coef_div = 4289, | 229 | .coef_div = 10502, |
230 | .inverted = true, | 230 | .inverted = true, |
231 | }; | 231 | }; |
232 | 232 | ||
diff --git a/drivers/thermal/intel_powerclamp.c b/drivers/thermal/intel_powerclamp.c index 12623bc02f46..725718e97a0b 100644 --- a/drivers/thermal/intel_powerclamp.c +++ b/drivers/thermal/intel_powerclamp.c | |||
@@ -206,51 +206,57 @@ static void find_target_mwait(void) | |||
206 | 206 | ||
207 | } | 207 | } |
208 | 208 | ||
209 | struct pkg_cstate_info { | ||
210 | bool skip; | ||
211 | int msr_index; | ||
212 | int cstate_id; | ||
213 | }; | ||
214 | |||
215 | #define PKG_CSTATE_INIT(id) { \ | ||
216 | .msr_index = MSR_PKG_C##id##_RESIDENCY, \ | ||
217 | .cstate_id = id \ | ||
218 | } | ||
219 | |||
220 | static struct pkg_cstate_info pkg_cstates[] = { | ||
221 | PKG_CSTATE_INIT(2), | ||
222 | PKG_CSTATE_INIT(3), | ||
223 | PKG_CSTATE_INIT(6), | ||
224 | PKG_CSTATE_INIT(7), | ||
225 | PKG_CSTATE_INIT(8), | ||
226 | PKG_CSTATE_INIT(9), | ||
227 | PKG_CSTATE_INIT(10), | ||
228 | {NULL}, | ||
229 | }; | ||
230 | |||
209 | static bool has_pkg_state_counter(void) | 231 | static bool has_pkg_state_counter(void) |
210 | { | 232 | { |
211 | u64 tmp; | 233 | u64 val; |
212 | return !rdmsrl_safe(MSR_PKG_C2_RESIDENCY, &tmp) || | 234 | struct pkg_cstate_info *info = pkg_cstates; |
213 | !rdmsrl_safe(MSR_PKG_C3_RESIDENCY, &tmp) || | 235 | |
214 | !rdmsrl_safe(MSR_PKG_C6_RESIDENCY, &tmp) || | 236 | /* check if any one of the counter msrs exists */ |
215 | !rdmsrl_safe(MSR_PKG_C7_RESIDENCY, &tmp); | 237 | while (info->msr_index) { |
238 | if (!rdmsrl_safe(info->msr_index, &val)) | ||
239 | return true; | ||
240 | info++; | ||
241 | } | ||
242 | |||
243 | return false; | ||
216 | } | 244 | } |
217 | 245 | ||
218 | static u64 pkg_state_counter(void) | 246 | static u64 pkg_state_counter(void) |
219 | { | 247 | { |
220 | u64 val; | 248 | u64 val; |
221 | u64 count = 0; | 249 | u64 count = 0; |
222 | 250 | struct pkg_cstate_info *info = pkg_cstates; | |
223 | static bool skip_c2; | 251 | |
224 | static bool skip_c3; | 252 | while (info->msr_index) { |
225 | static bool skip_c6; | 253 | if (!info->skip) { |
226 | static bool skip_c7; | 254 | if (!rdmsrl_safe(info->msr_index, &val)) |
227 | 255 | count += val; | |
228 | if (!skip_c2) { | 256 | else |
229 | if (!rdmsrl_safe(MSR_PKG_C2_RESIDENCY, &val)) | 257 | info->skip = true; |
230 | count += val; | 258 | } |
231 | else | 259 | info++; |
232 | skip_c2 = true; | ||
233 | } | ||
234 | |||
235 | if (!skip_c3) { | ||
236 | if (!rdmsrl_safe(MSR_PKG_C3_RESIDENCY, &val)) | ||
237 | count += val; | ||
238 | else | ||
239 | skip_c3 = true; | ||
240 | } | ||
241 | |||
242 | if (!skip_c6) { | ||
243 | if (!rdmsrl_safe(MSR_PKG_C6_RESIDENCY, &val)) | ||
244 | count += val; | ||
245 | else | ||
246 | skip_c6 = true; | ||
247 | } | ||
248 | |||
249 | if (!skip_c7) { | ||
250 | if (!rdmsrl_safe(MSR_PKG_C7_RESIDENCY, &val)) | ||
251 | count += val; | ||
252 | else | ||
253 | skip_c7 = true; | ||
254 | } | 260 | } |
255 | 261 | ||
256 | return count; | 262 | return count; |
@@ -667,7 +673,7 @@ static struct thermal_cooling_device_ops powerclamp_cooling_ops = { | |||
667 | }; | 673 | }; |
668 | 674 | ||
669 | /* runs on Nehalem and later */ | 675 | /* runs on Nehalem and later */ |
670 | static const struct x86_cpu_id intel_powerclamp_ids[] = { | 676 | static const struct x86_cpu_id intel_powerclamp_ids[] __initconst = { |
671 | { X86_VENDOR_INTEL, 6, 0x1a}, | 677 | { X86_VENDOR_INTEL, 6, 0x1a}, |
672 | { X86_VENDOR_INTEL, 6, 0x1c}, | 678 | { X86_VENDOR_INTEL, 6, 0x1c}, |
673 | { X86_VENDOR_INTEL, 6, 0x1e}, | 679 | { X86_VENDOR_INTEL, 6, 0x1e}, |
@@ -689,12 +695,13 @@ static const struct x86_cpu_id intel_powerclamp_ids[] = { | |||
689 | { X86_VENDOR_INTEL, 6, 0x46}, | 695 | { X86_VENDOR_INTEL, 6, 0x46}, |
690 | { X86_VENDOR_INTEL, 6, 0x4c}, | 696 | { X86_VENDOR_INTEL, 6, 0x4c}, |
691 | { X86_VENDOR_INTEL, 6, 0x4d}, | 697 | { X86_VENDOR_INTEL, 6, 0x4d}, |
698 | { X86_VENDOR_INTEL, 6, 0x4f}, | ||
692 | { X86_VENDOR_INTEL, 6, 0x56}, | 699 | { X86_VENDOR_INTEL, 6, 0x56}, |
693 | {} | 700 | {} |
694 | }; | 701 | }; |
695 | MODULE_DEVICE_TABLE(x86cpu, intel_powerclamp_ids); | 702 | MODULE_DEVICE_TABLE(x86cpu, intel_powerclamp_ids); |
696 | 703 | ||
697 | static int powerclamp_probe(void) | 704 | static int __init powerclamp_probe(void) |
698 | { | 705 | { |
699 | if (!x86_match_cpu(intel_powerclamp_ids)) { | 706 | if (!x86_match_cpu(intel_powerclamp_ids)) { |
700 | pr_err("Intel powerclamp does not run on family %d model %d\n", | 707 | pr_err("Intel powerclamp does not run on family %d model %d\n", |
@@ -760,7 +767,7 @@ file_error: | |||
760 | debugfs_remove_recursive(debug_dir); | 767 | debugfs_remove_recursive(debug_dir); |
761 | } | 768 | } |
762 | 769 | ||
763 | static int powerclamp_init(void) | 770 | static int __init powerclamp_init(void) |
764 | { | 771 | { |
765 | int retval; | 772 | int retval; |
766 | int bitmap_size; | 773 | int bitmap_size; |
@@ -809,7 +816,7 @@ exit_free: | |||
809 | } | 816 | } |
810 | module_init(powerclamp_init); | 817 | module_init(powerclamp_init); |
811 | 818 | ||
812 | static void powerclamp_exit(void) | 819 | static void __exit powerclamp_exit(void) |
813 | { | 820 | { |
814 | unregister_hotcpu_notifier(&powerclamp_cpu_notifier); | 821 | unregister_hotcpu_notifier(&powerclamp_cpu_notifier); |
815 | end_power_clamp(); | 822 | end_power_clamp(); |
diff --git a/drivers/thermal/rockchip_thermal.c b/drivers/thermal/rockchip_thermal.c index 3aa46ac7cdbc..cd8f5f93b42c 100644 --- a/drivers/thermal/rockchip_thermal.c +++ b/drivers/thermal/rockchip_thermal.c | |||
@@ -529,7 +529,7 @@ static int rockchip_thermal_probe(struct platform_device *pdev) | |||
529 | 529 | ||
530 | thermal->pclk = devm_clk_get(&pdev->dev, "apb_pclk"); | 530 | thermal->pclk = devm_clk_get(&pdev->dev, "apb_pclk"); |
531 | if (IS_ERR(thermal->pclk)) { | 531 | if (IS_ERR(thermal->pclk)) { |
532 | error = PTR_ERR(thermal->clk); | 532 | error = PTR_ERR(thermal->pclk); |
533 | dev_err(&pdev->dev, "failed to get apb_pclk clock: %d\n", | 533 | dev_err(&pdev->dev, "failed to get apb_pclk clock: %d\n", |
534 | error); | 534 | error); |
535 | return error; | 535 | return error; |
diff --git a/drivers/thermal/thermal_core.h b/drivers/thermal/thermal_core.h index 0531c752fbbb..8e391812e503 100644 --- a/drivers/thermal/thermal_core.h +++ b/drivers/thermal/thermal_core.h | |||
@@ -103,7 +103,7 @@ static inline int of_thermal_get_ntrips(struct thermal_zone_device *tz) | |||
103 | static inline bool of_thermal_is_trip_valid(struct thermal_zone_device *tz, | 103 | static inline bool of_thermal_is_trip_valid(struct thermal_zone_device *tz, |
104 | int trip) | 104 | int trip) |
105 | { | 105 | { |
106 | return 0; | 106 | return false; |
107 | } | 107 | } |
108 | static inline const struct thermal_trip * | 108 | static inline const struct thermal_trip * |
109 | of_thermal_get_trip_points(struct thermal_zone_device *tz) | 109 | of_thermal_get_trip_points(struct thermal_zone_device *tz) |
diff --git a/drivers/thermal/ti-soc-thermal/dra752-thermal-data.c b/drivers/thermal/ti-soc-thermal/dra752-thermal-data.c index a4929272074f..58b5c6694cd4 100644 --- a/drivers/thermal/ti-soc-thermal/dra752-thermal-data.c +++ b/drivers/thermal/ti-soc-thermal/dra752-thermal-data.c | |||
@@ -420,7 +420,8 @@ const struct ti_bandgap_data dra752_data = { | |||
420 | TI_BANDGAP_FEATURE_FREEZE_BIT | | 420 | TI_BANDGAP_FEATURE_FREEZE_BIT | |
421 | TI_BANDGAP_FEATURE_TALERT | | 421 | TI_BANDGAP_FEATURE_TALERT | |
422 | TI_BANDGAP_FEATURE_COUNTER_DELAY | | 422 | TI_BANDGAP_FEATURE_COUNTER_DELAY | |
423 | TI_BANDGAP_FEATURE_HISTORY_BUFFER, | 423 | TI_BANDGAP_FEATURE_HISTORY_BUFFER | |
424 | TI_BANDGAP_FEATURE_ERRATA_814, | ||
424 | .fclock_name = "l3instr_ts_gclk_div", | 425 | .fclock_name = "l3instr_ts_gclk_div", |
425 | .div_ck_name = "l3instr_ts_gclk_div", | 426 | .div_ck_name = "l3instr_ts_gclk_div", |
426 | .conv_table = dra752_adc_to_temp, | 427 | .conv_table = dra752_adc_to_temp, |
diff --git a/drivers/thermal/ti-soc-thermal/omap5-thermal-data.c b/drivers/thermal/ti-soc-thermal/omap5-thermal-data.c index eff0c80fd4af..79ff70c446ba 100644 --- a/drivers/thermal/ti-soc-thermal/omap5-thermal-data.c +++ b/drivers/thermal/ti-soc-thermal/omap5-thermal-data.c | |||
@@ -319,7 +319,8 @@ const struct ti_bandgap_data omap5430_data = { | |||
319 | TI_BANDGAP_FEATURE_FREEZE_BIT | | 319 | TI_BANDGAP_FEATURE_FREEZE_BIT | |
320 | TI_BANDGAP_FEATURE_TALERT | | 320 | TI_BANDGAP_FEATURE_TALERT | |
321 | TI_BANDGAP_FEATURE_COUNTER_DELAY | | 321 | TI_BANDGAP_FEATURE_COUNTER_DELAY | |
322 | TI_BANDGAP_FEATURE_HISTORY_BUFFER, | 322 | TI_BANDGAP_FEATURE_HISTORY_BUFFER | |
323 | TI_BANDGAP_FEATURE_ERRATA_813, | ||
323 | .fclock_name = "l3instr_ts_gclk_div", | 324 | .fclock_name = "l3instr_ts_gclk_div", |
324 | .div_ck_name = "l3instr_ts_gclk_div", | 325 | .div_ck_name = "l3instr_ts_gclk_div", |
325 | .conv_table = omap5430_adc_to_temp, | 326 | .conv_table = omap5430_adc_to_temp, |
diff --git a/drivers/thermal/ti-soc-thermal/ti-bandgap.c b/drivers/thermal/ti-soc-thermal/ti-bandgap.c index 62a5d449c388..bc14dc874594 100644 --- a/drivers/thermal/ti-soc-thermal/ti-bandgap.c +++ b/drivers/thermal/ti-soc-thermal/ti-bandgap.c | |||
@@ -119,6 +119,37 @@ exit: | |||
119 | } | 119 | } |
120 | 120 | ||
121 | /** | 121 | /** |
122 | * ti_errata814_bandgap_read_temp() - helper function to read dra7 sensor temperature | ||
123 | * @bgp: pointer to ti_bandgap structure | ||
124 | * @reg: desired register (offset) to be read | ||
125 | * | ||
126 | * Function to read dra7 bandgap sensor temperature. This is done separately | ||
127 | * so as to workaround the errata "Bandgap Temperature read Dtemp can be | ||
128 | * corrupted" - Errata ID: i814". | ||
129 | * Read accesses to registers listed below can be corrupted due to incorrect | ||
130 | * resynchronization between clock domains. | ||
131 | * Read access to registers below can be corrupted : | ||
132 | * CTRL_CORE_DTEMP_MPU/GPU/CORE/DSPEVE/IVA_n (n = 0 to 4) | ||
133 | * CTRL_CORE_TEMP_SENSOR_MPU/GPU/CORE/DSPEVE/IVA_n | ||
134 | * | ||
135 | * Return: the register value. | ||
136 | */ | ||
137 | static u32 ti_errata814_bandgap_read_temp(struct ti_bandgap *bgp, u32 reg) | ||
138 | { | ||
139 | u32 val1, val2; | ||
140 | |||
141 | val1 = ti_bandgap_readl(bgp, reg); | ||
142 | val2 = ti_bandgap_readl(bgp, reg); | ||
143 | |||
144 | /* If both times we read the same value then that is right */ | ||
145 | if (val1 == val2) | ||
146 | return val1; | ||
147 | |||
148 | /* if val1 and val2 are different read it third time */ | ||
149 | return ti_bandgap_readl(bgp, reg); | ||
150 | } | ||
151 | |||
152 | /** | ||
122 | * ti_bandgap_read_temp() - helper function to read sensor temperature | 153 | * ti_bandgap_read_temp() - helper function to read sensor temperature |
123 | * @bgp: pointer to ti_bandgap structure | 154 | * @bgp: pointer to ti_bandgap structure |
124 | * @id: bandgap sensor id | 155 | * @id: bandgap sensor id |
@@ -148,7 +179,11 @@ static u32 ti_bandgap_read_temp(struct ti_bandgap *bgp, int id) | |||
148 | } | 179 | } |
149 | 180 | ||
150 | /* read temperature */ | 181 | /* read temperature */ |
151 | temp = ti_bandgap_readl(bgp, reg); | 182 | if (TI_BANDGAP_HAS(bgp, ERRATA_814)) |
183 | temp = ti_errata814_bandgap_read_temp(bgp, reg); | ||
184 | else | ||
185 | temp = ti_bandgap_readl(bgp, reg); | ||
186 | |||
152 | temp &= tsr->bgap_dtemp_mask; | 187 | temp &= tsr->bgap_dtemp_mask; |
153 | 188 | ||
154 | if (TI_BANDGAP_HAS(bgp, FREEZE_BIT)) | 189 | if (TI_BANDGAP_HAS(bgp, FREEZE_BIT)) |
@@ -410,7 +445,7 @@ static int ti_bandgap_update_alert_threshold(struct ti_bandgap *bgp, int id, | |||
410 | { | 445 | { |
411 | struct temp_sensor_data *ts_data = bgp->conf->sensors[id].ts_data; | 446 | struct temp_sensor_data *ts_data = bgp->conf->sensors[id].ts_data; |
412 | struct temp_sensor_registers *tsr; | 447 | struct temp_sensor_registers *tsr; |
413 | u32 thresh_val, reg_val, t_hot, t_cold; | 448 | u32 thresh_val, reg_val, t_hot, t_cold, ctrl; |
414 | int err = 0; | 449 | int err = 0; |
415 | 450 | ||
416 | tsr = bgp->conf->sensors[id].registers; | 451 | tsr = bgp->conf->sensors[id].registers; |
@@ -442,8 +477,47 @@ static int ti_bandgap_update_alert_threshold(struct ti_bandgap *bgp, int id, | |||
442 | ~(tsr->threshold_thot_mask | tsr->threshold_tcold_mask); | 477 | ~(tsr->threshold_thot_mask | tsr->threshold_tcold_mask); |
443 | reg_val |= (t_hot << __ffs(tsr->threshold_thot_mask)) | | 478 | reg_val |= (t_hot << __ffs(tsr->threshold_thot_mask)) | |
444 | (t_cold << __ffs(tsr->threshold_tcold_mask)); | 479 | (t_cold << __ffs(tsr->threshold_tcold_mask)); |
480 | |||
481 | /** | ||
482 | * Errata i813: | ||
483 | * Spurious Thermal Alert: Talert can happen randomly while the device | ||
484 | * remains under the temperature limit defined for this event to trig. | ||
485 | * This spurious event is caused by a incorrect re-synchronization | ||
486 | * between clock domains. The comparison between configured threshold | ||
487 | * and current temperature value can happen while the value is | ||
488 | * transitioning (metastable), thus causing inappropriate event | ||
489 | * generation. No spurious event occurs as long as the threshold value | ||
490 | * stays unchanged. Spurious event can be generated while a thermal | ||
491 | * alert threshold is modified in | ||
492 | * CONTROL_BANDGAP_THRESHOLD_MPU/GPU/CORE/DSPEVE/IVA_n. | ||
493 | */ | ||
494 | |||
495 | if (TI_BANDGAP_HAS(bgp, ERRATA_813)) { | ||
496 | /* Mask t_hot and t_cold events at the IP Level */ | ||
497 | ctrl = ti_bandgap_readl(bgp, tsr->bgap_mask_ctrl); | ||
498 | |||
499 | if (hot) | ||
500 | ctrl &= ~tsr->mask_hot_mask; | ||
501 | else | ||
502 | ctrl &= ~tsr->mask_cold_mask; | ||
503 | |||
504 | ti_bandgap_writel(bgp, ctrl, tsr->bgap_mask_ctrl); | ||
505 | } | ||
506 | |||
507 | /* Write the threshold value */ | ||
445 | ti_bandgap_writel(bgp, reg_val, tsr->bgap_threshold); | 508 | ti_bandgap_writel(bgp, reg_val, tsr->bgap_threshold); |
446 | 509 | ||
510 | if (TI_BANDGAP_HAS(bgp, ERRATA_813)) { | ||
511 | /* Unmask t_hot and t_cold events at the IP Level */ | ||
512 | ctrl = ti_bandgap_readl(bgp, tsr->bgap_mask_ctrl); | ||
513 | if (hot) | ||
514 | ctrl |= tsr->mask_hot_mask; | ||
515 | else | ||
516 | ctrl |= tsr->mask_cold_mask; | ||
517 | |||
518 | ti_bandgap_writel(bgp, ctrl, tsr->bgap_mask_ctrl); | ||
519 | } | ||
520 | |||
447 | if (err) { | 521 | if (err) { |
448 | dev_err(bgp->dev, "failed to reprogram thot threshold\n"); | 522 | dev_err(bgp->dev, "failed to reprogram thot threshold\n"); |
449 | err = -EIO; | 523 | err = -EIO; |
diff --git a/drivers/thermal/ti-soc-thermal/ti-bandgap.h b/drivers/thermal/ti-soc-thermal/ti-bandgap.h index b3adf72f252d..0c52f7afba00 100644 --- a/drivers/thermal/ti-soc-thermal/ti-bandgap.h +++ b/drivers/thermal/ti-soc-thermal/ti-bandgap.h | |||
@@ -318,6 +318,10 @@ struct ti_temp_sensor { | |||
318 | * TI_BANDGAP_FEATURE_HISTORY_BUFFER - used when the bandgap device features | 318 | * TI_BANDGAP_FEATURE_HISTORY_BUFFER - used when the bandgap device features |
319 | * a history buffer of temperatures. | 319 | * a history buffer of temperatures. |
320 | * | 320 | * |
321 | * TI_BANDGAP_FEATURE_ERRATA_814 - used to workaorund when the bandgap device | ||
322 | * has Errata 814 | ||
323 | * TI_BANDGAP_FEATURE_ERRATA_813 - used to workaorund when the bandgap device | ||
324 | * has Errata 813 | ||
321 | * TI_BANDGAP_HAS(b, f) - macro to check if a bandgap device is capable of a | 325 | * TI_BANDGAP_HAS(b, f) - macro to check if a bandgap device is capable of a |
322 | * specific feature (above) or not. Return non-zero, if yes. | 326 | * specific feature (above) or not. Return non-zero, if yes. |
323 | */ | 327 | */ |
@@ -331,6 +335,8 @@ struct ti_temp_sensor { | |||
331 | #define TI_BANDGAP_FEATURE_FREEZE_BIT BIT(7) | 335 | #define TI_BANDGAP_FEATURE_FREEZE_BIT BIT(7) |
332 | #define TI_BANDGAP_FEATURE_COUNTER_DELAY BIT(8) | 336 | #define TI_BANDGAP_FEATURE_COUNTER_DELAY BIT(8) |
333 | #define TI_BANDGAP_FEATURE_HISTORY_BUFFER BIT(9) | 337 | #define TI_BANDGAP_FEATURE_HISTORY_BUFFER BIT(9) |
338 | #define TI_BANDGAP_FEATURE_ERRATA_814 BIT(10) | ||
339 | #define TI_BANDGAP_FEATURE_ERRATA_813 BIT(11) | ||
334 | #define TI_BANDGAP_HAS(b, f) \ | 340 | #define TI_BANDGAP_HAS(b, f) \ |
335 | ((b)->conf->features & TI_BANDGAP_FEATURE_ ## f) | 341 | ((b)->conf->features & TI_BANDGAP_FEATURE_ ## f) |
336 | 342 | ||
diff --git a/drivers/tty/hvc/hvc_xen.c b/drivers/tty/hvc/hvc_xen.c index 5bab1c684bb1..7a3d146a5f0e 100644 --- a/drivers/tty/hvc/hvc_xen.c +++ b/drivers/tty/hvc/hvc_xen.c | |||
@@ -289,7 +289,7 @@ static int xen_initial_domain_console_init(void) | |||
289 | return -ENOMEM; | 289 | return -ENOMEM; |
290 | } | 290 | } |
291 | 291 | ||
292 | info->irq = bind_virq_to_irq(VIRQ_CONSOLE, 0); | 292 | info->irq = bind_virq_to_irq(VIRQ_CONSOLE, 0, false); |
293 | info->vtermno = HVC_COOKIE; | 293 | info->vtermno = HVC_COOKIE; |
294 | 294 | ||
295 | spin_lock(&xencons_lock); | 295 | spin_lock(&xencons_lock); |
diff --git a/drivers/tty/n_gsm.c b/drivers/tty/n_gsm.c index 91abc00aa833..2c34c3249972 100644 --- a/drivers/tty/n_gsm.c +++ b/drivers/tty/n_gsm.c | |||
@@ -3170,7 +3170,7 @@ static int gsmtty_break_ctl(struct tty_struct *tty, int state) | |||
3170 | return gsmtty_modem_update(dlci, encode); | 3170 | return gsmtty_modem_update(dlci, encode); |
3171 | } | 3171 | } |
3172 | 3172 | ||
3173 | static void gsmtty_remove(struct tty_driver *driver, struct tty_struct *tty) | 3173 | static void gsmtty_cleanup(struct tty_struct *tty) |
3174 | { | 3174 | { |
3175 | struct gsm_dlci *dlci = tty->driver_data; | 3175 | struct gsm_dlci *dlci = tty->driver_data; |
3176 | struct gsm_mux *gsm = dlci->gsm; | 3176 | struct gsm_mux *gsm = dlci->gsm; |
@@ -3178,7 +3178,6 @@ static void gsmtty_remove(struct tty_driver *driver, struct tty_struct *tty) | |||
3178 | dlci_put(dlci); | 3178 | dlci_put(dlci); |
3179 | dlci_put(gsm->dlci[0]); | 3179 | dlci_put(gsm->dlci[0]); |
3180 | mux_put(gsm); | 3180 | mux_put(gsm); |
3181 | driver->ttys[tty->index] = NULL; | ||
3182 | } | 3181 | } |
3183 | 3182 | ||
3184 | /* Virtual ttys for the demux */ | 3183 | /* Virtual ttys for the demux */ |
@@ -3199,7 +3198,7 @@ static const struct tty_operations gsmtty_ops = { | |||
3199 | .tiocmget = gsmtty_tiocmget, | 3198 | .tiocmget = gsmtty_tiocmget, |
3200 | .tiocmset = gsmtty_tiocmset, | 3199 | .tiocmset = gsmtty_tiocmset, |
3201 | .break_ctl = gsmtty_break_ctl, | 3200 | .break_ctl = gsmtty_break_ctl, |
3202 | .remove = gsmtty_remove, | 3201 | .cleanup = gsmtty_cleanup, |
3203 | }; | 3202 | }; |
3204 | 3203 | ||
3205 | 3204 | ||
diff --git a/drivers/tty/n_hdlc.c b/drivers/tty/n_hdlc.c index 644ddb841d9f..bbc4ce66c2c1 100644 --- a/drivers/tty/n_hdlc.c +++ b/drivers/tty/n_hdlc.c | |||
@@ -600,7 +600,7 @@ static ssize_t n_hdlc_tty_read(struct tty_struct *tty, struct file *file, | |||
600 | add_wait_queue(&tty->read_wait, &wait); | 600 | add_wait_queue(&tty->read_wait, &wait); |
601 | 601 | ||
602 | for (;;) { | 602 | for (;;) { |
603 | if (test_bit(TTY_OTHER_CLOSED, &tty->flags)) { | 603 | if (test_bit(TTY_OTHER_DONE, &tty->flags)) { |
604 | ret = -EIO; | 604 | ret = -EIO; |
605 | break; | 605 | break; |
606 | } | 606 | } |
@@ -828,7 +828,7 @@ static unsigned int n_hdlc_tty_poll(struct tty_struct *tty, struct file *filp, | |||
828 | /* set bits for operations that won't block */ | 828 | /* set bits for operations that won't block */ |
829 | if (n_hdlc->rx_buf_list.head) | 829 | if (n_hdlc->rx_buf_list.head) |
830 | mask |= POLLIN | POLLRDNORM; /* readable */ | 830 | mask |= POLLIN | POLLRDNORM; /* readable */ |
831 | if (test_bit(TTY_OTHER_CLOSED, &tty->flags)) | 831 | if (test_bit(TTY_OTHER_DONE, &tty->flags)) |
832 | mask |= POLLHUP; | 832 | mask |= POLLHUP; |
833 | if (tty_hung_up_p(filp)) | 833 | if (tty_hung_up_p(filp)) |
834 | mask |= POLLHUP; | 834 | mask |= POLLHUP; |
diff --git a/drivers/tty/n_tty.c b/drivers/tty/n_tty.c index cf6e0f2e1331..cc57a3a6b02b 100644 --- a/drivers/tty/n_tty.c +++ b/drivers/tty/n_tty.c | |||
@@ -1949,6 +1949,18 @@ static inline int input_available_p(struct tty_struct *tty, int poll) | |||
1949 | return ldata->commit_head - ldata->read_tail >= amt; | 1949 | return ldata->commit_head - ldata->read_tail >= amt; |
1950 | } | 1950 | } |
1951 | 1951 | ||
1952 | static inline int check_other_done(struct tty_struct *tty) | ||
1953 | { | ||
1954 | int done = test_bit(TTY_OTHER_DONE, &tty->flags); | ||
1955 | if (done) { | ||
1956 | /* paired with cmpxchg() in check_other_closed(); ensures | ||
1957 | * read buffer head index is not stale | ||
1958 | */ | ||
1959 | smp_mb__after_atomic(); | ||
1960 | } | ||
1961 | return done; | ||
1962 | } | ||
1963 | |||
1952 | /** | 1964 | /** |
1953 | * copy_from_read_buf - copy read data directly | 1965 | * copy_from_read_buf - copy read data directly |
1954 | * @tty: terminal device | 1966 | * @tty: terminal device |
@@ -2167,7 +2179,7 @@ static ssize_t n_tty_read(struct tty_struct *tty, struct file *file, | |||
2167 | struct n_tty_data *ldata = tty->disc_data; | 2179 | struct n_tty_data *ldata = tty->disc_data; |
2168 | unsigned char __user *b = buf; | 2180 | unsigned char __user *b = buf; |
2169 | DEFINE_WAIT_FUNC(wait, woken_wake_function); | 2181 | DEFINE_WAIT_FUNC(wait, woken_wake_function); |
2170 | int c; | 2182 | int c, done; |
2171 | int minimum, time; | 2183 | int minimum, time; |
2172 | ssize_t retval = 0; | 2184 | ssize_t retval = 0; |
2173 | long timeout; | 2185 | long timeout; |
@@ -2235,8 +2247,10 @@ static ssize_t n_tty_read(struct tty_struct *tty, struct file *file, | |||
2235 | ((minimum - (b - buf)) >= 1)) | 2247 | ((minimum - (b - buf)) >= 1)) |
2236 | ldata->minimum_to_wake = (minimum - (b - buf)); | 2248 | ldata->minimum_to_wake = (minimum - (b - buf)); |
2237 | 2249 | ||
2250 | done = check_other_done(tty); | ||
2251 | |||
2238 | if (!input_available_p(tty, 0)) { | 2252 | if (!input_available_p(tty, 0)) { |
2239 | if (test_bit(TTY_OTHER_CLOSED, &tty->flags)) { | 2253 | if (done) { |
2240 | retval = -EIO; | 2254 | retval = -EIO; |
2241 | break; | 2255 | break; |
2242 | } | 2256 | } |
@@ -2443,12 +2457,12 @@ static unsigned int n_tty_poll(struct tty_struct *tty, struct file *file, | |||
2443 | 2457 | ||
2444 | poll_wait(file, &tty->read_wait, wait); | 2458 | poll_wait(file, &tty->read_wait, wait); |
2445 | poll_wait(file, &tty->write_wait, wait); | 2459 | poll_wait(file, &tty->write_wait, wait); |
2460 | if (check_other_done(tty)) | ||
2461 | mask |= POLLHUP; | ||
2446 | if (input_available_p(tty, 1)) | 2462 | if (input_available_p(tty, 1)) |
2447 | mask |= POLLIN | POLLRDNORM; | 2463 | mask |= POLLIN | POLLRDNORM; |
2448 | if (tty->packet && tty->link->ctrl_status) | 2464 | if (tty->packet && tty->link->ctrl_status) |
2449 | mask |= POLLPRI | POLLIN | POLLRDNORM; | 2465 | mask |= POLLPRI | POLLIN | POLLRDNORM; |
2450 | if (test_bit(TTY_OTHER_CLOSED, &tty->flags)) | ||
2451 | mask |= POLLHUP; | ||
2452 | if (tty_hung_up_p(file)) | 2466 | if (tty_hung_up_p(file)) |
2453 | mask |= POLLHUP; | 2467 | mask |= POLLHUP; |
2454 | if (!(mask & (POLLHUP | POLLIN | POLLRDNORM))) { | 2468 | if (!(mask & (POLLHUP | POLLIN | POLLRDNORM))) { |
diff --git a/drivers/tty/pty.c b/drivers/tty/pty.c index e72ee629cead..4d5e8409769c 100644 --- a/drivers/tty/pty.c +++ b/drivers/tty/pty.c | |||
@@ -53,9 +53,8 @@ static void pty_close(struct tty_struct *tty, struct file *filp) | |||
53 | /* Review - krefs on tty_link ?? */ | 53 | /* Review - krefs on tty_link ?? */ |
54 | if (!tty->link) | 54 | if (!tty->link) |
55 | return; | 55 | return; |
56 | tty_flush_to_ldisc(tty->link); | ||
57 | set_bit(TTY_OTHER_CLOSED, &tty->link->flags); | 56 | set_bit(TTY_OTHER_CLOSED, &tty->link->flags); |
58 | wake_up_interruptible(&tty->link->read_wait); | 57 | tty_flip_buffer_push(tty->link->port); |
59 | wake_up_interruptible(&tty->link->write_wait); | 58 | wake_up_interruptible(&tty->link->write_wait); |
60 | if (tty->driver->subtype == PTY_TYPE_MASTER) { | 59 | if (tty->driver->subtype == PTY_TYPE_MASTER) { |
61 | set_bit(TTY_OTHER_CLOSED, &tty->flags); | 60 | set_bit(TTY_OTHER_CLOSED, &tty->flags); |
@@ -243,7 +242,9 @@ static int pty_open(struct tty_struct *tty, struct file *filp) | |||
243 | goto out; | 242 | goto out; |
244 | 243 | ||
245 | clear_bit(TTY_IO_ERROR, &tty->flags); | 244 | clear_bit(TTY_IO_ERROR, &tty->flags); |
245 | /* TTY_OTHER_CLOSED must be cleared before TTY_OTHER_DONE */ | ||
246 | clear_bit(TTY_OTHER_CLOSED, &tty->link->flags); | 246 | clear_bit(TTY_OTHER_CLOSED, &tty->link->flags); |
247 | clear_bit(TTY_OTHER_DONE, &tty->link->flags); | ||
247 | set_bit(TTY_THROTTLED, &tty->flags); | 248 | set_bit(TTY_THROTTLED, &tty->flags); |
248 | return 0; | 249 | return 0; |
249 | 250 | ||
diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c index 5a4e9d579585..6f5a0720a8c8 100644 --- a/drivers/tty/serial/amba-pl011.c +++ b/drivers/tty/serial/amba-pl011.c | |||
@@ -1639,6 +1639,9 @@ static int pl011_startup(struct uart_port *port) | |||
1639 | 1639 | ||
1640 | writew(uap->vendor->ifls, uap->port.membase + UART011_IFLS); | 1640 | writew(uap->vendor->ifls, uap->port.membase + UART011_IFLS); |
1641 | 1641 | ||
1642 | /* Assume that TX IRQ doesn't work until we see one: */ | ||
1643 | uap->tx_irq_seen = 0; | ||
1644 | |||
1642 | spin_lock_irq(&uap->port.lock); | 1645 | spin_lock_irq(&uap->port.lock); |
1643 | 1646 | ||
1644 | /* restore RTS and DTR */ | 1647 | /* restore RTS and DTR */ |
@@ -1702,7 +1705,7 @@ static void pl011_shutdown(struct uart_port *port) | |||
1702 | spin_lock_irq(&uap->port.lock); | 1705 | spin_lock_irq(&uap->port.lock); |
1703 | uap->im = 0; | 1706 | uap->im = 0; |
1704 | writew(uap->im, uap->port.membase + UART011_IMSC); | 1707 | writew(uap->im, uap->port.membase + UART011_IMSC); |
1705 | writew(0xffff & ~UART011_TXIS, uap->port.membase + UART011_ICR); | 1708 | writew(0xffff, uap->port.membase + UART011_ICR); |
1706 | spin_unlock_irq(&uap->port.lock); | 1709 | spin_unlock_irq(&uap->port.lock); |
1707 | 1710 | ||
1708 | pl011_dma_shutdown(uap); | 1711 | pl011_dma_shutdown(uap); |
diff --git a/drivers/tty/serial/earlycon.c b/drivers/tty/serial/earlycon.c index 5fdc9f3ecd64..6dc471e30e79 100644 --- a/drivers/tty/serial/earlycon.c +++ b/drivers/tty/serial/earlycon.c | |||
@@ -187,13 +187,8 @@ static int __init param_setup_earlycon(char *buf) | |||
187 | return 0; | 187 | return 0; |
188 | 188 | ||
189 | err = setup_earlycon(buf); | 189 | err = setup_earlycon(buf); |
190 | if (err == -ENOENT) { | 190 | if (err == -ENOENT || err == -EALREADY) |
191 | pr_warn("no match for %s\n", buf); | 191 | return 0; |
192 | err = 0; | ||
193 | } else if (err == -EALREADY) { | ||
194 | pr_warn("already registered\n"); | ||
195 | err = 0; | ||
196 | } | ||
197 | return err; | 192 | return err; |
198 | } | 193 | } |
199 | early_param("earlycon", param_setup_earlycon); | 194 | early_param("earlycon", param_setup_earlycon); |
diff --git a/drivers/tty/serial/omap-serial.c b/drivers/tty/serial/omap-serial.c index 211479aa34bb..7f49172ccd86 100644 --- a/drivers/tty/serial/omap-serial.c +++ b/drivers/tty/serial/omap-serial.c | |||
@@ -1735,6 +1735,8 @@ static int serial_omap_probe(struct platform_device *pdev) | |||
1735 | err_add_port: | 1735 | err_add_port: |
1736 | pm_runtime_put(&pdev->dev); | 1736 | pm_runtime_put(&pdev->dev); |
1737 | pm_runtime_disable(&pdev->dev); | 1737 | pm_runtime_disable(&pdev->dev); |
1738 | pm_qos_remove_request(&up->pm_qos_request); | ||
1739 | device_init_wakeup(up->dev, false); | ||
1738 | err_rs485: | 1740 | err_rs485: |
1739 | err_port_line: | 1741 | err_port_line: |
1740 | return ret; | 1742 | return ret; |
diff --git a/drivers/tty/tty_buffer.c b/drivers/tty/tty_buffer.c index 75661641f5fe..2f78b77f0f81 100644 --- a/drivers/tty/tty_buffer.c +++ b/drivers/tty/tty_buffer.c | |||
@@ -37,6 +37,28 @@ | |||
37 | 37 | ||
38 | #define TTY_BUFFER_PAGE (((PAGE_SIZE - sizeof(struct tty_buffer)) / 2) & ~0xFF) | 38 | #define TTY_BUFFER_PAGE (((PAGE_SIZE - sizeof(struct tty_buffer)) / 2) & ~0xFF) |
39 | 39 | ||
40 | /* | ||
41 | * If all tty flip buffers have been processed by flush_to_ldisc() or | ||
42 | * dropped by tty_buffer_flush(), check if the linked pty has been closed. | ||
43 | * If so, wake the reader/poll to process | ||
44 | */ | ||
45 | static inline void check_other_closed(struct tty_struct *tty) | ||
46 | { | ||
47 | unsigned long flags, old; | ||
48 | |||
49 | /* transition from TTY_OTHER_CLOSED => TTY_OTHER_DONE must be atomic */ | ||
50 | for (flags = ACCESS_ONCE(tty->flags); | ||
51 | test_bit(TTY_OTHER_CLOSED, &flags); | ||
52 | ) { | ||
53 | old = flags; | ||
54 | __set_bit(TTY_OTHER_DONE, &flags); | ||
55 | flags = cmpxchg(&tty->flags, old, flags); | ||
56 | if (old == flags) { | ||
57 | wake_up_interruptible(&tty->read_wait); | ||
58 | break; | ||
59 | } | ||
60 | } | ||
61 | } | ||
40 | 62 | ||
41 | /** | 63 | /** |
42 | * tty_buffer_lock_exclusive - gain exclusive access to buffer | 64 | * tty_buffer_lock_exclusive - gain exclusive access to buffer |
@@ -229,6 +251,8 @@ void tty_buffer_flush(struct tty_struct *tty, struct tty_ldisc *ld) | |||
229 | if (ld && ld->ops->flush_buffer) | 251 | if (ld && ld->ops->flush_buffer) |
230 | ld->ops->flush_buffer(tty); | 252 | ld->ops->flush_buffer(tty); |
231 | 253 | ||
254 | check_other_closed(tty); | ||
255 | |||
232 | atomic_dec(&buf->priority); | 256 | atomic_dec(&buf->priority); |
233 | mutex_unlock(&buf->lock); | 257 | mutex_unlock(&buf->lock); |
234 | } | 258 | } |
@@ -471,8 +495,10 @@ static void flush_to_ldisc(struct work_struct *work) | |||
471 | smp_rmb(); | 495 | smp_rmb(); |
472 | count = head->commit - head->read; | 496 | count = head->commit - head->read; |
473 | if (!count) { | 497 | if (!count) { |
474 | if (next == NULL) | 498 | if (next == NULL) { |
499 | check_other_closed(tty); | ||
475 | break; | 500 | break; |
501 | } | ||
476 | buf->head = next; | 502 | buf->head = next; |
477 | tty_buffer_free(port, head); | 503 | tty_buffer_free(port, head); |
478 | continue; | 504 | continue; |
@@ -489,19 +515,6 @@ static void flush_to_ldisc(struct work_struct *work) | |||
489 | } | 515 | } |
490 | 516 | ||
491 | /** | 517 | /** |
492 | * tty_flush_to_ldisc | ||
493 | * @tty: tty to push | ||
494 | * | ||
495 | * Push the terminal flip buffers to the line discipline. | ||
496 | * | ||
497 | * Must not be called from IRQ context. | ||
498 | */ | ||
499 | void tty_flush_to_ldisc(struct tty_struct *tty) | ||
500 | { | ||
501 | flush_work(&tty->port->buf.work); | ||
502 | } | ||
503 | |||
504 | /** | ||
505 | * tty_flip_buffer_push - terminal | 518 | * tty_flip_buffer_push - terminal |
506 | * @port: tty port to push | 519 | * @port: tty port to push |
507 | * | 520 | * |
diff --git a/drivers/usb/chipidea/debug.c b/drivers/usb/chipidea/debug.c index dfb05edcdb96..5b7061a33103 100644 --- a/drivers/usb/chipidea/debug.c +++ b/drivers/usb/chipidea/debug.c | |||
@@ -88,9 +88,13 @@ static ssize_t ci_port_test_write(struct file *file, const char __user *ubuf, | |||
88 | char buf[32]; | 88 | char buf[32]; |
89 | int ret; | 89 | int ret; |
90 | 90 | ||
91 | if (copy_from_user(buf, ubuf, min_t(size_t, sizeof(buf) - 1, count))) | 91 | count = min_t(size_t, sizeof(buf) - 1, count); |
92 | if (copy_from_user(buf, ubuf, count)) | ||
92 | return -EFAULT; | 93 | return -EFAULT; |
93 | 94 | ||
95 | /* sscanf requires a zero terminated string */ | ||
96 | buf[count] = '\0'; | ||
97 | |||
94 | if (sscanf(buf, "%u", &mode) != 1) | 98 | if (sscanf(buf, "%u", &mode) != 1) |
95 | return -EINVAL; | 99 | return -EINVAL; |
96 | 100 | ||
diff --git a/drivers/usb/core/quirks.c b/drivers/usb/core/quirks.c index 41e510ae8c83..d85abfed84cc 100644 --- a/drivers/usb/core/quirks.c +++ b/drivers/usb/core/quirks.c | |||
@@ -106,6 +106,9 @@ static const struct usb_device_id usb_quirk_list[] = { | |||
106 | { USB_DEVICE(0x04f3, 0x010c), .driver_info = | 106 | { USB_DEVICE(0x04f3, 0x010c), .driver_info = |
107 | USB_QUIRK_DEVICE_QUALIFIER }, | 107 | USB_QUIRK_DEVICE_QUALIFIER }, |
108 | 108 | ||
109 | { USB_DEVICE(0x04f3, 0x0125), .driver_info = | ||
110 | USB_QUIRK_DEVICE_QUALIFIER }, | ||
111 | |||
109 | { USB_DEVICE(0x04f3, 0x016f), .driver_info = | 112 | { USB_DEVICE(0x04f3, 0x016f), .driver_info = |
110 | USB_QUIRK_DEVICE_QUALIFIER }, | 113 | USB_QUIRK_DEVICE_QUALIFIER }, |
111 | 114 | ||
diff --git a/drivers/usb/dwc3/dwc3-omap.c b/drivers/usb/dwc3/dwc3-omap.c index edba5348be18..6b486a36863c 100644 --- a/drivers/usb/dwc3/dwc3-omap.c +++ b/drivers/usb/dwc3/dwc3-omap.c | |||
@@ -65,8 +65,8 @@ | |||
65 | #define USBOTGSS_IRQENABLE_SET_MISC 0x003c | 65 | #define USBOTGSS_IRQENABLE_SET_MISC 0x003c |
66 | #define USBOTGSS_IRQENABLE_CLR_MISC 0x0040 | 66 | #define USBOTGSS_IRQENABLE_CLR_MISC 0x0040 |
67 | #define USBOTGSS_IRQMISC_OFFSET 0x03fc | 67 | #define USBOTGSS_IRQMISC_OFFSET 0x03fc |
68 | #define USBOTGSS_UTMI_OTG_CTRL 0x0080 | 68 | #define USBOTGSS_UTMI_OTG_STATUS 0x0080 |
69 | #define USBOTGSS_UTMI_OTG_STATUS 0x0084 | 69 | #define USBOTGSS_UTMI_OTG_CTRL 0x0084 |
70 | #define USBOTGSS_UTMI_OTG_OFFSET 0x0480 | 70 | #define USBOTGSS_UTMI_OTG_OFFSET 0x0480 |
71 | #define USBOTGSS_TXFIFO_DEPTH 0x0508 | 71 | #define USBOTGSS_TXFIFO_DEPTH 0x0508 |
72 | #define USBOTGSS_RXFIFO_DEPTH 0x050c | 72 | #define USBOTGSS_RXFIFO_DEPTH 0x050c |
@@ -98,20 +98,20 @@ | |||
98 | #define USBOTGSS_IRQMISC_DISCHRGVBUS_FALL (1 << 3) | 98 | #define USBOTGSS_IRQMISC_DISCHRGVBUS_FALL (1 << 3) |
99 | #define USBOTGSS_IRQMISC_IDPULLUP_FALL (1 << 0) | 99 | #define USBOTGSS_IRQMISC_IDPULLUP_FALL (1 << 0) |
100 | 100 | ||
101 | /* UTMI_OTG_CTRL REGISTER */ | ||
102 | #define USBOTGSS_UTMI_OTG_CTRL_DRVVBUS (1 << 5) | ||
103 | #define USBOTGSS_UTMI_OTG_CTRL_CHRGVBUS (1 << 4) | ||
104 | #define USBOTGSS_UTMI_OTG_CTRL_DISCHRGVBUS (1 << 3) | ||
105 | #define USBOTGSS_UTMI_OTG_CTRL_IDPULLUP (1 << 0) | ||
106 | |||
107 | /* UTMI_OTG_STATUS REGISTER */ | 101 | /* UTMI_OTG_STATUS REGISTER */ |
108 | #define USBOTGSS_UTMI_OTG_STATUS_SW_MODE (1 << 31) | 102 | #define USBOTGSS_UTMI_OTG_STATUS_DRVVBUS (1 << 5) |
109 | #define USBOTGSS_UTMI_OTG_STATUS_POWERPRESENT (1 << 9) | 103 | #define USBOTGSS_UTMI_OTG_STATUS_CHRGVBUS (1 << 4) |
110 | #define USBOTGSS_UTMI_OTG_STATUS_TXBITSTUFFENABLE (1 << 8) | 104 | #define USBOTGSS_UTMI_OTG_STATUS_DISCHRGVBUS (1 << 3) |
111 | #define USBOTGSS_UTMI_OTG_STATUS_IDDIG (1 << 4) | 105 | #define USBOTGSS_UTMI_OTG_STATUS_IDPULLUP (1 << 0) |
112 | #define USBOTGSS_UTMI_OTG_STATUS_SESSEND (1 << 3) | 106 | |
113 | #define USBOTGSS_UTMI_OTG_STATUS_SESSVALID (1 << 2) | 107 | /* UTMI_OTG_CTRL REGISTER */ |
114 | #define USBOTGSS_UTMI_OTG_STATUS_VBUSVALID (1 << 1) | 108 | #define USBOTGSS_UTMI_OTG_CTRL_SW_MODE (1 << 31) |
109 | #define USBOTGSS_UTMI_OTG_CTRL_POWERPRESENT (1 << 9) | ||
110 | #define USBOTGSS_UTMI_OTG_CTRL_TXBITSTUFFENABLE (1 << 8) | ||
111 | #define USBOTGSS_UTMI_OTG_CTRL_IDDIG (1 << 4) | ||
112 | #define USBOTGSS_UTMI_OTG_CTRL_SESSEND (1 << 3) | ||
113 | #define USBOTGSS_UTMI_OTG_CTRL_SESSVALID (1 << 2) | ||
114 | #define USBOTGSS_UTMI_OTG_CTRL_VBUSVALID (1 << 1) | ||
115 | 115 | ||
116 | struct dwc3_omap { | 116 | struct dwc3_omap { |
117 | struct device *dev; | 117 | struct device *dev; |
@@ -119,7 +119,7 @@ struct dwc3_omap { | |||
119 | int irq; | 119 | int irq; |
120 | void __iomem *base; | 120 | void __iomem *base; |
121 | 121 | ||
122 | u32 utmi_otg_status; | 122 | u32 utmi_otg_ctrl; |
123 | u32 utmi_otg_offset; | 123 | u32 utmi_otg_offset; |
124 | u32 irqmisc_offset; | 124 | u32 irqmisc_offset; |
125 | u32 irq_eoi_offset; | 125 | u32 irq_eoi_offset; |
@@ -153,15 +153,15 @@ static inline void dwc3_omap_writel(void __iomem *base, u32 offset, u32 value) | |||
153 | writel(value, base + offset); | 153 | writel(value, base + offset); |
154 | } | 154 | } |
155 | 155 | ||
156 | static u32 dwc3_omap_read_utmi_status(struct dwc3_omap *omap) | 156 | static u32 dwc3_omap_read_utmi_ctrl(struct dwc3_omap *omap) |
157 | { | 157 | { |
158 | return dwc3_omap_readl(omap->base, USBOTGSS_UTMI_OTG_STATUS + | 158 | return dwc3_omap_readl(omap->base, USBOTGSS_UTMI_OTG_CTRL + |
159 | omap->utmi_otg_offset); | 159 | omap->utmi_otg_offset); |
160 | } | 160 | } |
161 | 161 | ||
162 | static void dwc3_omap_write_utmi_status(struct dwc3_omap *omap, u32 value) | 162 | static void dwc3_omap_write_utmi_ctrl(struct dwc3_omap *omap, u32 value) |
163 | { | 163 | { |
164 | dwc3_omap_writel(omap->base, USBOTGSS_UTMI_OTG_STATUS + | 164 | dwc3_omap_writel(omap->base, USBOTGSS_UTMI_OTG_CTRL + |
165 | omap->utmi_otg_offset, value); | 165 | omap->utmi_otg_offset, value); |
166 | 166 | ||
167 | } | 167 | } |
@@ -235,25 +235,25 @@ static void dwc3_omap_set_mailbox(struct dwc3_omap *omap, | |||
235 | } | 235 | } |
236 | } | 236 | } |
237 | 237 | ||
238 | val = dwc3_omap_read_utmi_status(omap); | 238 | val = dwc3_omap_read_utmi_ctrl(omap); |
239 | val &= ~(USBOTGSS_UTMI_OTG_STATUS_IDDIG | 239 | val &= ~(USBOTGSS_UTMI_OTG_CTRL_IDDIG |
240 | | USBOTGSS_UTMI_OTG_STATUS_VBUSVALID | 240 | | USBOTGSS_UTMI_OTG_CTRL_VBUSVALID |
241 | | USBOTGSS_UTMI_OTG_STATUS_SESSEND); | 241 | | USBOTGSS_UTMI_OTG_CTRL_SESSEND); |
242 | val |= USBOTGSS_UTMI_OTG_STATUS_SESSVALID | 242 | val |= USBOTGSS_UTMI_OTG_CTRL_SESSVALID |
243 | | USBOTGSS_UTMI_OTG_STATUS_POWERPRESENT; | 243 | | USBOTGSS_UTMI_OTG_CTRL_POWERPRESENT; |
244 | dwc3_omap_write_utmi_status(omap, val); | 244 | dwc3_omap_write_utmi_ctrl(omap, val); |
245 | break; | 245 | break; |
246 | 246 | ||
247 | case OMAP_DWC3_VBUS_VALID: | 247 | case OMAP_DWC3_VBUS_VALID: |
248 | dev_dbg(omap->dev, "VBUS Connect\n"); | 248 | dev_dbg(omap->dev, "VBUS Connect\n"); |
249 | 249 | ||
250 | val = dwc3_omap_read_utmi_status(omap); | 250 | val = dwc3_omap_read_utmi_ctrl(omap); |
251 | val &= ~USBOTGSS_UTMI_OTG_STATUS_SESSEND; | 251 | val &= ~USBOTGSS_UTMI_OTG_CTRL_SESSEND; |
252 | val |= USBOTGSS_UTMI_OTG_STATUS_IDDIG | 252 | val |= USBOTGSS_UTMI_OTG_CTRL_IDDIG |
253 | | USBOTGSS_UTMI_OTG_STATUS_VBUSVALID | 253 | | USBOTGSS_UTMI_OTG_CTRL_VBUSVALID |
254 | | USBOTGSS_UTMI_OTG_STATUS_SESSVALID | 254 | | USBOTGSS_UTMI_OTG_CTRL_SESSVALID |
255 | | USBOTGSS_UTMI_OTG_STATUS_POWERPRESENT; | 255 | | USBOTGSS_UTMI_OTG_CTRL_POWERPRESENT; |
256 | dwc3_omap_write_utmi_status(omap, val); | 256 | dwc3_omap_write_utmi_ctrl(omap, val); |
257 | break; | 257 | break; |
258 | 258 | ||
259 | case OMAP_DWC3_ID_FLOAT: | 259 | case OMAP_DWC3_ID_FLOAT: |
@@ -263,13 +263,13 @@ static void dwc3_omap_set_mailbox(struct dwc3_omap *omap, | |||
263 | case OMAP_DWC3_VBUS_OFF: | 263 | case OMAP_DWC3_VBUS_OFF: |
264 | dev_dbg(omap->dev, "VBUS Disconnect\n"); | 264 | dev_dbg(omap->dev, "VBUS Disconnect\n"); |
265 | 265 | ||
266 | val = dwc3_omap_read_utmi_status(omap); | 266 | val = dwc3_omap_read_utmi_ctrl(omap); |
267 | val &= ~(USBOTGSS_UTMI_OTG_STATUS_SESSVALID | 267 | val &= ~(USBOTGSS_UTMI_OTG_CTRL_SESSVALID |
268 | | USBOTGSS_UTMI_OTG_STATUS_VBUSVALID | 268 | | USBOTGSS_UTMI_OTG_CTRL_VBUSVALID |
269 | | USBOTGSS_UTMI_OTG_STATUS_POWERPRESENT); | 269 | | USBOTGSS_UTMI_OTG_CTRL_POWERPRESENT); |
270 | val |= USBOTGSS_UTMI_OTG_STATUS_SESSEND | 270 | val |= USBOTGSS_UTMI_OTG_CTRL_SESSEND |
271 | | USBOTGSS_UTMI_OTG_STATUS_IDDIG; | 271 | | USBOTGSS_UTMI_OTG_CTRL_IDDIG; |
272 | dwc3_omap_write_utmi_status(omap, val); | 272 | dwc3_omap_write_utmi_ctrl(omap, val); |
273 | break; | 273 | break; |
274 | 274 | ||
275 | default: | 275 | default: |
@@ -422,22 +422,22 @@ static void dwc3_omap_set_utmi_mode(struct dwc3_omap *omap) | |||
422 | struct device_node *node = omap->dev->of_node; | 422 | struct device_node *node = omap->dev->of_node; |
423 | int utmi_mode = 0; | 423 | int utmi_mode = 0; |
424 | 424 | ||
425 | reg = dwc3_omap_read_utmi_status(omap); | 425 | reg = dwc3_omap_read_utmi_ctrl(omap); |
426 | 426 | ||
427 | of_property_read_u32(node, "utmi-mode", &utmi_mode); | 427 | of_property_read_u32(node, "utmi-mode", &utmi_mode); |
428 | 428 | ||
429 | switch (utmi_mode) { | 429 | switch (utmi_mode) { |
430 | case DWC3_OMAP_UTMI_MODE_SW: | 430 | case DWC3_OMAP_UTMI_MODE_SW: |
431 | reg |= USBOTGSS_UTMI_OTG_STATUS_SW_MODE; | 431 | reg |= USBOTGSS_UTMI_OTG_CTRL_SW_MODE; |
432 | break; | 432 | break; |
433 | case DWC3_OMAP_UTMI_MODE_HW: | 433 | case DWC3_OMAP_UTMI_MODE_HW: |
434 | reg &= ~USBOTGSS_UTMI_OTG_STATUS_SW_MODE; | 434 | reg &= ~USBOTGSS_UTMI_OTG_CTRL_SW_MODE; |
435 | break; | 435 | break; |
436 | default: | 436 | default: |
437 | dev_dbg(omap->dev, "UNKNOWN utmi mode %d\n", utmi_mode); | 437 | dev_dbg(omap->dev, "UNKNOWN utmi mode %d\n", utmi_mode); |
438 | } | 438 | } |
439 | 439 | ||
440 | dwc3_omap_write_utmi_status(omap, reg); | 440 | dwc3_omap_write_utmi_ctrl(omap, reg); |
441 | } | 441 | } |
442 | 442 | ||
443 | static int dwc3_omap_extcon_register(struct dwc3_omap *omap) | 443 | static int dwc3_omap_extcon_register(struct dwc3_omap *omap) |
@@ -614,7 +614,7 @@ static int dwc3_omap_suspend(struct device *dev) | |||
614 | { | 614 | { |
615 | struct dwc3_omap *omap = dev_get_drvdata(dev); | 615 | struct dwc3_omap *omap = dev_get_drvdata(dev); |
616 | 616 | ||
617 | omap->utmi_otg_status = dwc3_omap_read_utmi_status(omap); | 617 | omap->utmi_otg_ctrl = dwc3_omap_read_utmi_ctrl(omap); |
618 | dwc3_omap_disable_irqs(omap); | 618 | dwc3_omap_disable_irqs(omap); |
619 | 619 | ||
620 | return 0; | 620 | return 0; |
@@ -624,7 +624,7 @@ static int dwc3_omap_resume(struct device *dev) | |||
624 | { | 624 | { |
625 | struct dwc3_omap *omap = dev_get_drvdata(dev); | 625 | struct dwc3_omap *omap = dev_get_drvdata(dev); |
626 | 626 | ||
627 | dwc3_omap_write_utmi_status(omap, omap->utmi_otg_status); | 627 | dwc3_omap_write_utmi_ctrl(omap, omap->utmi_otg_ctrl); |
628 | dwc3_omap_enable_irqs(omap); | 628 | dwc3_omap_enable_irqs(omap); |
629 | 629 | ||
630 | pm_runtime_disable(dev); | 630 | pm_runtime_disable(dev); |
diff --git a/drivers/usb/gadget/configfs.c b/drivers/usb/gadget/configfs.c index c42765b3a060..0495c94a23d7 100644 --- a/drivers/usb/gadget/configfs.c +++ b/drivers/usb/gadget/configfs.c | |||
@@ -1295,6 +1295,7 @@ static void purge_configs_funcs(struct gadget_info *gi) | |||
1295 | } | 1295 | } |
1296 | } | 1296 | } |
1297 | c->next_interface_id = 0; | 1297 | c->next_interface_id = 0; |
1298 | memset(c->interface, 0, sizeof(c->interface)); | ||
1298 | c->superspeed = 0; | 1299 | c->superspeed = 0; |
1299 | c->highspeed = 0; | 1300 | c->highspeed = 0; |
1300 | c->fullspeed = 0; | 1301 | c->fullspeed = 0; |
diff --git a/drivers/usb/gadget/function/f_hid.c b/drivers/usb/gadget/function/f_hid.c index 13dfc9915b1d..f7f35a36c09a 100644 --- a/drivers/usb/gadget/function/f_hid.c +++ b/drivers/usb/gadget/function/f_hid.c | |||
@@ -437,12 +437,20 @@ static int hidg_setup(struct usb_function *f, | |||
437 | | USB_REQ_GET_DESCRIPTOR): | 437 | | USB_REQ_GET_DESCRIPTOR): |
438 | switch (value >> 8) { | 438 | switch (value >> 8) { |
439 | case HID_DT_HID: | 439 | case HID_DT_HID: |
440 | { | ||
441 | struct hid_descriptor hidg_desc_copy = hidg_desc; | ||
442 | |||
440 | VDBG(cdev, "USB_REQ_GET_DESCRIPTOR: HID\n"); | 443 | VDBG(cdev, "USB_REQ_GET_DESCRIPTOR: HID\n"); |
444 | hidg_desc_copy.desc[0].bDescriptorType = HID_DT_REPORT; | ||
445 | hidg_desc_copy.desc[0].wDescriptorLength = | ||
446 | cpu_to_le16(hidg->report_desc_length); | ||
447 | |||
441 | length = min_t(unsigned short, length, | 448 | length = min_t(unsigned short, length, |
442 | hidg_desc.bLength); | 449 | hidg_desc_copy.bLength); |
443 | memcpy(req->buf, &hidg_desc, length); | 450 | memcpy(req->buf, &hidg_desc_copy, length); |
444 | goto respond; | 451 | goto respond; |
445 | break; | 452 | break; |
453 | } | ||
446 | case HID_DT_REPORT: | 454 | case HID_DT_REPORT: |
447 | VDBG(cdev, "USB_REQ_GET_DESCRIPTOR: REPORT\n"); | 455 | VDBG(cdev, "USB_REQ_GET_DESCRIPTOR: REPORT\n"); |
448 | length = min_t(unsigned short, length, | 456 | length = min_t(unsigned short, length, |
@@ -632,6 +640,10 @@ static int hidg_bind(struct usb_configuration *c, struct usb_function *f) | |||
632 | hidg_fs_in_ep_desc.wMaxPacketSize = cpu_to_le16(hidg->report_length); | 640 | hidg_fs_in_ep_desc.wMaxPacketSize = cpu_to_le16(hidg->report_length); |
633 | hidg_hs_out_ep_desc.wMaxPacketSize = cpu_to_le16(hidg->report_length); | 641 | hidg_hs_out_ep_desc.wMaxPacketSize = cpu_to_le16(hidg->report_length); |
634 | hidg_fs_out_ep_desc.wMaxPacketSize = cpu_to_le16(hidg->report_length); | 642 | hidg_fs_out_ep_desc.wMaxPacketSize = cpu_to_le16(hidg->report_length); |
643 | /* | ||
644 | * We can use hidg_desc struct here but we should not relay | ||
645 | * that its content won't change after returning from this function. | ||
646 | */ | ||
635 | hidg_desc.desc[0].bDescriptorType = HID_DT_REPORT; | 647 | hidg_desc.desc[0].bDescriptorType = HID_DT_REPORT; |
636 | hidg_desc.desc[0].wDescriptorLength = | 648 | hidg_desc.desc[0].wDescriptorLength = |
637 | cpu_to_le16(hidg->report_desc_length); | 649 | cpu_to_le16(hidg->report_desc_length); |
diff --git a/drivers/usb/gadget/function/u_serial.c b/drivers/usb/gadget/function/u_serial.c index 89179ab20c10..7ee057930ae7 100644 --- a/drivers/usb/gadget/function/u_serial.c +++ b/drivers/usb/gadget/function/u_serial.c | |||
@@ -113,6 +113,7 @@ struct gs_port { | |||
113 | int write_allocated; | 113 | int write_allocated; |
114 | struct gs_buf port_write_buf; | 114 | struct gs_buf port_write_buf; |
115 | wait_queue_head_t drain_wait; /* wait while writes drain */ | 115 | wait_queue_head_t drain_wait; /* wait while writes drain */ |
116 | bool write_busy; | ||
116 | 117 | ||
117 | /* REVISIT this state ... */ | 118 | /* REVISIT this state ... */ |
118 | struct usb_cdc_line_coding port_line_coding; /* 8-N-1 etc */ | 119 | struct usb_cdc_line_coding port_line_coding; /* 8-N-1 etc */ |
@@ -363,7 +364,7 @@ __acquires(&port->port_lock) | |||
363 | int status = 0; | 364 | int status = 0; |
364 | bool do_tty_wake = false; | 365 | bool do_tty_wake = false; |
365 | 366 | ||
366 | while (!list_empty(pool)) { | 367 | while (!port->write_busy && !list_empty(pool)) { |
367 | struct usb_request *req; | 368 | struct usb_request *req; |
368 | int len; | 369 | int len; |
369 | 370 | ||
@@ -393,9 +394,11 @@ __acquires(&port->port_lock) | |||
393 | * NOTE that we may keep sending data for a while after | 394 | * NOTE that we may keep sending data for a while after |
394 | * the TTY closed (dev->ioport->port_tty is NULL). | 395 | * the TTY closed (dev->ioport->port_tty is NULL). |
395 | */ | 396 | */ |
397 | port->write_busy = true; | ||
396 | spin_unlock(&port->port_lock); | 398 | spin_unlock(&port->port_lock); |
397 | status = usb_ep_queue(in, req, GFP_ATOMIC); | 399 | status = usb_ep_queue(in, req, GFP_ATOMIC); |
398 | spin_lock(&port->port_lock); | 400 | spin_lock(&port->port_lock); |
401 | port->write_busy = false; | ||
399 | 402 | ||
400 | if (status) { | 403 | if (status) { |
401 | pr_debug("%s: %s %s err %d\n", | 404 | pr_debug("%s: %s %s err %d\n", |
diff --git a/drivers/usb/gadget/legacy/acm_ms.c b/drivers/usb/gadget/legacy/acm_ms.c index c30b7b572465..1194b09ae746 100644 --- a/drivers/usb/gadget/legacy/acm_ms.c +++ b/drivers/usb/gadget/legacy/acm_ms.c | |||
@@ -121,7 +121,7 @@ static struct usb_function *f_msg; | |||
121 | /* | 121 | /* |
122 | * We _always_ have both ACM and mass storage functions. | 122 | * We _always_ have both ACM and mass storage functions. |
123 | */ | 123 | */ |
124 | static int __init acm_ms_do_config(struct usb_configuration *c) | 124 | static int acm_ms_do_config(struct usb_configuration *c) |
125 | { | 125 | { |
126 | struct fsg_opts *opts; | 126 | struct fsg_opts *opts; |
127 | int status; | 127 | int status; |
@@ -174,7 +174,7 @@ static struct usb_configuration acm_ms_config_driver = { | |||
174 | 174 | ||
175 | /*-------------------------------------------------------------------------*/ | 175 | /*-------------------------------------------------------------------------*/ |
176 | 176 | ||
177 | static int __init acm_ms_bind(struct usb_composite_dev *cdev) | 177 | static int acm_ms_bind(struct usb_composite_dev *cdev) |
178 | { | 178 | { |
179 | struct usb_gadget *gadget = cdev->gadget; | 179 | struct usb_gadget *gadget = cdev->gadget; |
180 | struct fsg_opts *opts; | 180 | struct fsg_opts *opts; |
@@ -249,7 +249,7 @@ fail_get_msg: | |||
249 | return status; | 249 | return status; |
250 | } | 250 | } |
251 | 251 | ||
252 | static int __exit acm_ms_unbind(struct usb_composite_dev *cdev) | 252 | static int acm_ms_unbind(struct usb_composite_dev *cdev) |
253 | { | 253 | { |
254 | usb_put_function(f_msg); | 254 | usb_put_function(f_msg); |
255 | usb_put_function_instance(fi_msg); | 255 | usb_put_function_instance(fi_msg); |
@@ -258,13 +258,13 @@ static int __exit acm_ms_unbind(struct usb_composite_dev *cdev) | |||
258 | return 0; | 258 | return 0; |
259 | } | 259 | } |
260 | 260 | ||
261 | static __refdata struct usb_composite_driver acm_ms_driver = { | 261 | static struct usb_composite_driver acm_ms_driver = { |
262 | .name = "g_acm_ms", | 262 | .name = "g_acm_ms", |
263 | .dev = &device_desc, | 263 | .dev = &device_desc, |
264 | .max_speed = USB_SPEED_SUPER, | 264 | .max_speed = USB_SPEED_SUPER, |
265 | .strings = dev_strings, | 265 | .strings = dev_strings, |
266 | .bind = acm_ms_bind, | 266 | .bind = acm_ms_bind, |
267 | .unbind = __exit_p(acm_ms_unbind), | 267 | .unbind = acm_ms_unbind, |
268 | }; | 268 | }; |
269 | 269 | ||
270 | module_usb_composite_driver(acm_ms_driver); | 270 | module_usb_composite_driver(acm_ms_driver); |
diff --git a/drivers/usb/gadget/legacy/audio.c b/drivers/usb/gadget/legacy/audio.c index f46a3956e43d..f289caf18a45 100644 --- a/drivers/usb/gadget/legacy/audio.c +++ b/drivers/usb/gadget/legacy/audio.c | |||
@@ -167,7 +167,7 @@ static const struct usb_descriptor_header *otg_desc[] = { | |||
167 | 167 | ||
168 | /*-------------------------------------------------------------------------*/ | 168 | /*-------------------------------------------------------------------------*/ |
169 | 169 | ||
170 | static int __init audio_do_config(struct usb_configuration *c) | 170 | static int audio_do_config(struct usb_configuration *c) |
171 | { | 171 | { |
172 | int status; | 172 | int status; |
173 | 173 | ||
@@ -216,7 +216,7 @@ static struct usb_configuration audio_config_driver = { | |||
216 | 216 | ||
217 | /*-------------------------------------------------------------------------*/ | 217 | /*-------------------------------------------------------------------------*/ |
218 | 218 | ||
219 | static int __init audio_bind(struct usb_composite_dev *cdev) | 219 | static int audio_bind(struct usb_composite_dev *cdev) |
220 | { | 220 | { |
221 | #ifndef CONFIG_GADGET_UAC1 | 221 | #ifndef CONFIG_GADGET_UAC1 |
222 | struct f_uac2_opts *uac2_opts; | 222 | struct f_uac2_opts *uac2_opts; |
@@ -276,7 +276,7 @@ fail: | |||
276 | return status; | 276 | return status; |
277 | } | 277 | } |
278 | 278 | ||
279 | static int __exit audio_unbind(struct usb_composite_dev *cdev) | 279 | static int audio_unbind(struct usb_composite_dev *cdev) |
280 | { | 280 | { |
281 | #ifdef CONFIG_GADGET_UAC1 | 281 | #ifdef CONFIG_GADGET_UAC1 |
282 | if (!IS_ERR_OR_NULL(f_uac1)) | 282 | if (!IS_ERR_OR_NULL(f_uac1)) |
@@ -292,13 +292,13 @@ static int __exit audio_unbind(struct usb_composite_dev *cdev) | |||
292 | return 0; | 292 | return 0; |
293 | } | 293 | } |
294 | 294 | ||
295 | static __refdata struct usb_composite_driver audio_driver = { | 295 | static struct usb_composite_driver audio_driver = { |
296 | .name = "g_audio", | 296 | .name = "g_audio", |
297 | .dev = &device_desc, | 297 | .dev = &device_desc, |
298 | .strings = audio_strings, | 298 | .strings = audio_strings, |
299 | .max_speed = USB_SPEED_HIGH, | 299 | .max_speed = USB_SPEED_HIGH, |
300 | .bind = audio_bind, | 300 | .bind = audio_bind, |
301 | .unbind = __exit_p(audio_unbind), | 301 | .unbind = audio_unbind, |
302 | }; | 302 | }; |
303 | 303 | ||
304 | module_usb_composite_driver(audio_driver); | 304 | module_usb_composite_driver(audio_driver); |
diff --git a/drivers/usb/gadget/legacy/cdc2.c b/drivers/usb/gadget/legacy/cdc2.c index 2e85d9473478..afd3e37921a7 100644 --- a/drivers/usb/gadget/legacy/cdc2.c +++ b/drivers/usb/gadget/legacy/cdc2.c | |||
@@ -104,7 +104,7 @@ static struct usb_function_instance *fi_ecm; | |||
104 | /* | 104 | /* |
105 | * We _always_ have both CDC ECM and CDC ACM functions. | 105 | * We _always_ have both CDC ECM and CDC ACM functions. |
106 | */ | 106 | */ |
107 | static int __init cdc_do_config(struct usb_configuration *c) | 107 | static int cdc_do_config(struct usb_configuration *c) |
108 | { | 108 | { |
109 | int status; | 109 | int status; |
110 | 110 | ||
@@ -153,7 +153,7 @@ static struct usb_configuration cdc_config_driver = { | |||
153 | 153 | ||
154 | /*-------------------------------------------------------------------------*/ | 154 | /*-------------------------------------------------------------------------*/ |
155 | 155 | ||
156 | static int __init cdc_bind(struct usb_composite_dev *cdev) | 156 | static int cdc_bind(struct usb_composite_dev *cdev) |
157 | { | 157 | { |
158 | struct usb_gadget *gadget = cdev->gadget; | 158 | struct usb_gadget *gadget = cdev->gadget; |
159 | struct f_ecm_opts *ecm_opts; | 159 | struct f_ecm_opts *ecm_opts; |
@@ -211,7 +211,7 @@ fail: | |||
211 | return status; | 211 | return status; |
212 | } | 212 | } |
213 | 213 | ||
214 | static int __exit cdc_unbind(struct usb_composite_dev *cdev) | 214 | static int cdc_unbind(struct usb_composite_dev *cdev) |
215 | { | 215 | { |
216 | usb_put_function(f_acm); | 216 | usb_put_function(f_acm); |
217 | usb_put_function_instance(fi_serial); | 217 | usb_put_function_instance(fi_serial); |
@@ -222,13 +222,13 @@ static int __exit cdc_unbind(struct usb_composite_dev *cdev) | |||
222 | return 0; | 222 | return 0; |
223 | } | 223 | } |
224 | 224 | ||
225 | static __refdata struct usb_composite_driver cdc_driver = { | 225 | static struct usb_composite_driver cdc_driver = { |
226 | .name = "g_cdc", | 226 | .name = "g_cdc", |
227 | .dev = &device_desc, | 227 | .dev = &device_desc, |
228 | .strings = dev_strings, | 228 | .strings = dev_strings, |
229 | .max_speed = USB_SPEED_HIGH, | 229 | .max_speed = USB_SPEED_HIGH, |
230 | .bind = cdc_bind, | 230 | .bind = cdc_bind, |
231 | .unbind = __exit_p(cdc_unbind), | 231 | .unbind = cdc_unbind, |
232 | }; | 232 | }; |
233 | 233 | ||
234 | module_usb_composite_driver(cdc_driver); | 234 | module_usb_composite_driver(cdc_driver); |
diff --git a/drivers/usb/gadget/legacy/dbgp.c b/drivers/usb/gadget/legacy/dbgp.c index 633683a72a11..204b10b1a7e7 100644 --- a/drivers/usb/gadget/legacy/dbgp.c +++ b/drivers/usb/gadget/legacy/dbgp.c | |||
@@ -284,7 +284,7 @@ fail_1: | |||
284 | return -ENODEV; | 284 | return -ENODEV; |
285 | } | 285 | } |
286 | 286 | ||
287 | static int __init dbgp_bind(struct usb_gadget *gadget, | 287 | static int dbgp_bind(struct usb_gadget *gadget, |
288 | struct usb_gadget_driver *driver) | 288 | struct usb_gadget_driver *driver) |
289 | { | 289 | { |
290 | int err, stp; | 290 | int err, stp; |
@@ -406,7 +406,7 @@ fail: | |||
406 | return err; | 406 | return err; |
407 | } | 407 | } |
408 | 408 | ||
409 | static __refdata struct usb_gadget_driver dbgp_driver = { | 409 | static struct usb_gadget_driver dbgp_driver = { |
410 | .function = "dbgp", | 410 | .function = "dbgp", |
411 | .max_speed = USB_SPEED_HIGH, | 411 | .max_speed = USB_SPEED_HIGH, |
412 | .bind = dbgp_bind, | 412 | .bind = dbgp_bind, |
diff --git a/drivers/usb/gadget/legacy/ether.c b/drivers/usb/gadget/legacy/ether.c index c5fdc61cdc4a..a3323dca218f 100644 --- a/drivers/usb/gadget/legacy/ether.c +++ b/drivers/usb/gadget/legacy/ether.c | |||
@@ -222,7 +222,7 @@ static struct usb_function *f_rndis; | |||
222 | * the first one present. That's to make Microsoft's drivers happy, | 222 | * the first one present. That's to make Microsoft's drivers happy, |
223 | * and to follow DOCSIS 1.0 (cable modem standard). | 223 | * and to follow DOCSIS 1.0 (cable modem standard). |
224 | */ | 224 | */ |
225 | static int __init rndis_do_config(struct usb_configuration *c) | 225 | static int rndis_do_config(struct usb_configuration *c) |
226 | { | 226 | { |
227 | int status; | 227 | int status; |
228 | 228 | ||
@@ -264,7 +264,7 @@ MODULE_PARM_DESC(use_eem, "use CDC EEM mode"); | |||
264 | /* | 264 | /* |
265 | * We _always_ have an ECM, CDC Subset, or EEM configuration. | 265 | * We _always_ have an ECM, CDC Subset, or EEM configuration. |
266 | */ | 266 | */ |
267 | static int __init eth_do_config(struct usb_configuration *c) | 267 | static int eth_do_config(struct usb_configuration *c) |
268 | { | 268 | { |
269 | int status = 0; | 269 | int status = 0; |
270 | 270 | ||
@@ -318,7 +318,7 @@ static struct usb_configuration eth_config_driver = { | |||
318 | 318 | ||
319 | /*-------------------------------------------------------------------------*/ | 319 | /*-------------------------------------------------------------------------*/ |
320 | 320 | ||
321 | static int __init eth_bind(struct usb_composite_dev *cdev) | 321 | static int eth_bind(struct usb_composite_dev *cdev) |
322 | { | 322 | { |
323 | struct usb_gadget *gadget = cdev->gadget; | 323 | struct usb_gadget *gadget = cdev->gadget; |
324 | struct f_eem_opts *eem_opts = NULL; | 324 | struct f_eem_opts *eem_opts = NULL; |
@@ -447,7 +447,7 @@ fail: | |||
447 | return status; | 447 | return status; |
448 | } | 448 | } |
449 | 449 | ||
450 | static int __exit eth_unbind(struct usb_composite_dev *cdev) | 450 | static int eth_unbind(struct usb_composite_dev *cdev) |
451 | { | 451 | { |
452 | if (has_rndis()) { | 452 | if (has_rndis()) { |
453 | usb_put_function(f_rndis); | 453 | usb_put_function(f_rndis); |
@@ -466,13 +466,13 @@ static int __exit eth_unbind(struct usb_composite_dev *cdev) | |||
466 | return 0; | 466 | return 0; |
467 | } | 467 | } |
468 | 468 | ||
469 | static __refdata struct usb_composite_driver eth_driver = { | 469 | static struct usb_composite_driver eth_driver = { |
470 | .name = "g_ether", | 470 | .name = "g_ether", |
471 | .dev = &device_desc, | 471 | .dev = &device_desc, |
472 | .strings = dev_strings, | 472 | .strings = dev_strings, |
473 | .max_speed = USB_SPEED_SUPER, | 473 | .max_speed = USB_SPEED_SUPER, |
474 | .bind = eth_bind, | 474 | .bind = eth_bind, |
475 | .unbind = __exit_p(eth_unbind), | 475 | .unbind = eth_unbind, |
476 | }; | 476 | }; |
477 | 477 | ||
478 | module_usb_composite_driver(eth_driver); | 478 | module_usb_composite_driver(eth_driver); |
diff --git a/drivers/usb/gadget/legacy/g_ffs.c b/drivers/usb/gadget/legacy/g_ffs.c index b01b88e1b716..7b9ef7e257d2 100644 --- a/drivers/usb/gadget/legacy/g_ffs.c +++ b/drivers/usb/gadget/legacy/g_ffs.c | |||
@@ -163,7 +163,7 @@ static int gfs_unbind(struct usb_composite_dev *cdev); | |||
163 | static int gfs_do_config(struct usb_configuration *c); | 163 | static int gfs_do_config(struct usb_configuration *c); |
164 | 164 | ||
165 | 165 | ||
166 | static __refdata struct usb_composite_driver gfs_driver = { | 166 | static struct usb_composite_driver gfs_driver = { |
167 | .name = DRIVER_NAME, | 167 | .name = DRIVER_NAME, |
168 | .dev = &gfs_dev_desc, | 168 | .dev = &gfs_dev_desc, |
169 | .strings = gfs_dev_strings, | 169 | .strings = gfs_dev_strings, |
diff --git a/drivers/usb/gadget/legacy/gmidi.c b/drivers/usb/gadget/legacy/gmidi.c index e02a095294ac..da19c486b61e 100644 --- a/drivers/usb/gadget/legacy/gmidi.c +++ b/drivers/usb/gadget/legacy/gmidi.c | |||
@@ -118,7 +118,7 @@ static struct usb_gadget_strings *dev_strings[] = { | |||
118 | static struct usb_function_instance *fi_midi; | 118 | static struct usb_function_instance *fi_midi; |
119 | static struct usb_function *f_midi; | 119 | static struct usb_function *f_midi; |
120 | 120 | ||
121 | static int __exit midi_unbind(struct usb_composite_dev *dev) | 121 | static int midi_unbind(struct usb_composite_dev *dev) |
122 | { | 122 | { |
123 | usb_put_function(f_midi); | 123 | usb_put_function(f_midi); |
124 | usb_put_function_instance(fi_midi); | 124 | usb_put_function_instance(fi_midi); |
@@ -133,7 +133,7 @@ static struct usb_configuration midi_config = { | |||
133 | .MaxPower = CONFIG_USB_GADGET_VBUS_DRAW, | 133 | .MaxPower = CONFIG_USB_GADGET_VBUS_DRAW, |
134 | }; | 134 | }; |
135 | 135 | ||
136 | static int __init midi_bind_config(struct usb_configuration *c) | 136 | static int midi_bind_config(struct usb_configuration *c) |
137 | { | 137 | { |
138 | int status; | 138 | int status; |
139 | 139 | ||
@@ -150,7 +150,7 @@ static int __init midi_bind_config(struct usb_configuration *c) | |||
150 | return 0; | 150 | return 0; |
151 | } | 151 | } |
152 | 152 | ||
153 | static int __init midi_bind(struct usb_composite_dev *cdev) | 153 | static int midi_bind(struct usb_composite_dev *cdev) |
154 | { | 154 | { |
155 | struct f_midi_opts *midi_opts; | 155 | struct f_midi_opts *midi_opts; |
156 | int status; | 156 | int status; |
@@ -185,13 +185,13 @@ put: | |||
185 | return status; | 185 | return status; |
186 | } | 186 | } |
187 | 187 | ||
188 | static __refdata struct usb_composite_driver midi_driver = { | 188 | static struct usb_composite_driver midi_driver = { |
189 | .name = (char *) longname, | 189 | .name = (char *) longname, |
190 | .dev = &device_desc, | 190 | .dev = &device_desc, |
191 | .strings = dev_strings, | 191 | .strings = dev_strings, |
192 | .max_speed = USB_SPEED_HIGH, | 192 | .max_speed = USB_SPEED_HIGH, |
193 | .bind = midi_bind, | 193 | .bind = midi_bind, |
194 | .unbind = __exit_p(midi_unbind), | 194 | .unbind = midi_unbind, |
195 | }; | 195 | }; |
196 | 196 | ||
197 | module_usb_composite_driver(midi_driver); | 197 | module_usb_composite_driver(midi_driver); |
diff --git a/drivers/usb/gadget/legacy/hid.c b/drivers/usb/gadget/legacy/hid.c index 614b06d80b41..2baa572686c6 100644 --- a/drivers/usb/gadget/legacy/hid.c +++ b/drivers/usb/gadget/legacy/hid.c | |||
@@ -106,7 +106,7 @@ static struct usb_gadget_strings *dev_strings[] = { | |||
106 | 106 | ||
107 | /****************************** Configurations ******************************/ | 107 | /****************************** Configurations ******************************/ |
108 | 108 | ||
109 | static int __init do_config(struct usb_configuration *c) | 109 | static int do_config(struct usb_configuration *c) |
110 | { | 110 | { |
111 | struct hidg_func_node *e, *n; | 111 | struct hidg_func_node *e, *n; |
112 | int status = 0; | 112 | int status = 0; |
@@ -147,7 +147,7 @@ static struct usb_configuration config_driver = { | |||
147 | 147 | ||
148 | /****************************** Gadget Bind ******************************/ | 148 | /****************************** Gadget Bind ******************************/ |
149 | 149 | ||
150 | static int __init hid_bind(struct usb_composite_dev *cdev) | 150 | static int hid_bind(struct usb_composite_dev *cdev) |
151 | { | 151 | { |
152 | struct usb_gadget *gadget = cdev->gadget; | 152 | struct usb_gadget *gadget = cdev->gadget; |
153 | struct list_head *tmp; | 153 | struct list_head *tmp; |
@@ -205,7 +205,7 @@ put: | |||
205 | return status; | 205 | return status; |
206 | } | 206 | } |
207 | 207 | ||
208 | static int __exit hid_unbind(struct usb_composite_dev *cdev) | 208 | static int hid_unbind(struct usb_composite_dev *cdev) |
209 | { | 209 | { |
210 | struct hidg_func_node *n; | 210 | struct hidg_func_node *n; |
211 | 211 | ||
@@ -216,7 +216,7 @@ static int __exit hid_unbind(struct usb_composite_dev *cdev) | |||
216 | return 0; | 216 | return 0; |
217 | } | 217 | } |
218 | 218 | ||
219 | static int __init hidg_plat_driver_probe(struct platform_device *pdev) | 219 | static int hidg_plat_driver_probe(struct platform_device *pdev) |
220 | { | 220 | { |
221 | struct hidg_func_descriptor *func = dev_get_platdata(&pdev->dev); | 221 | struct hidg_func_descriptor *func = dev_get_platdata(&pdev->dev); |
222 | struct hidg_func_node *entry; | 222 | struct hidg_func_node *entry; |
@@ -252,13 +252,13 @@ static int hidg_plat_driver_remove(struct platform_device *pdev) | |||
252 | /****************************** Some noise ******************************/ | 252 | /****************************** Some noise ******************************/ |
253 | 253 | ||
254 | 254 | ||
255 | static __refdata struct usb_composite_driver hidg_driver = { | 255 | static struct usb_composite_driver hidg_driver = { |
256 | .name = "g_hid", | 256 | .name = "g_hid", |
257 | .dev = &device_desc, | 257 | .dev = &device_desc, |
258 | .strings = dev_strings, | 258 | .strings = dev_strings, |
259 | .max_speed = USB_SPEED_HIGH, | 259 | .max_speed = USB_SPEED_HIGH, |
260 | .bind = hid_bind, | 260 | .bind = hid_bind, |
261 | .unbind = __exit_p(hid_unbind), | 261 | .unbind = hid_unbind, |
262 | }; | 262 | }; |
263 | 263 | ||
264 | static struct platform_driver hidg_plat_driver = { | 264 | static struct platform_driver hidg_plat_driver = { |
diff --git a/drivers/usb/gadget/legacy/mass_storage.c b/drivers/usb/gadget/legacy/mass_storage.c index 8e27a8c96444..e7bfb081f111 100644 --- a/drivers/usb/gadget/legacy/mass_storage.c +++ b/drivers/usb/gadget/legacy/mass_storage.c | |||
@@ -130,7 +130,7 @@ static int msg_thread_exits(struct fsg_common *common) | |||
130 | return 0; | 130 | return 0; |
131 | } | 131 | } |
132 | 132 | ||
133 | static int __init msg_do_config(struct usb_configuration *c) | 133 | static int msg_do_config(struct usb_configuration *c) |
134 | { | 134 | { |
135 | struct fsg_opts *opts; | 135 | struct fsg_opts *opts; |
136 | int ret; | 136 | int ret; |
@@ -170,7 +170,7 @@ static struct usb_configuration msg_config_driver = { | |||
170 | 170 | ||
171 | /****************************** Gadget Bind ******************************/ | 171 | /****************************** Gadget Bind ******************************/ |
172 | 172 | ||
173 | static int __init msg_bind(struct usb_composite_dev *cdev) | 173 | static int msg_bind(struct usb_composite_dev *cdev) |
174 | { | 174 | { |
175 | static const struct fsg_operations ops = { | 175 | static const struct fsg_operations ops = { |
176 | .thread_exits = msg_thread_exits, | 176 | .thread_exits = msg_thread_exits, |
@@ -248,7 +248,7 @@ static int msg_unbind(struct usb_composite_dev *cdev) | |||
248 | 248 | ||
249 | /****************************** Some noise ******************************/ | 249 | /****************************** Some noise ******************************/ |
250 | 250 | ||
251 | static __refdata struct usb_composite_driver msg_driver = { | 251 | static struct usb_composite_driver msg_driver = { |
252 | .name = "g_mass_storage", | 252 | .name = "g_mass_storage", |
253 | .dev = &msg_device_desc, | 253 | .dev = &msg_device_desc, |
254 | .max_speed = USB_SPEED_SUPER, | 254 | .max_speed = USB_SPEED_SUPER, |
diff --git a/drivers/usb/gadget/legacy/multi.c b/drivers/usb/gadget/legacy/multi.c index 39d27bb343b4..b21b51f0c9fa 100644 --- a/drivers/usb/gadget/legacy/multi.c +++ b/drivers/usb/gadget/legacy/multi.c | |||
@@ -149,7 +149,7 @@ static struct usb_function *f_acm_rndis; | |||
149 | static struct usb_function *f_rndis; | 149 | static struct usb_function *f_rndis; |
150 | static struct usb_function *f_msg_rndis; | 150 | static struct usb_function *f_msg_rndis; |
151 | 151 | ||
152 | static __init int rndis_do_config(struct usb_configuration *c) | 152 | static int rndis_do_config(struct usb_configuration *c) |
153 | { | 153 | { |
154 | struct fsg_opts *fsg_opts; | 154 | struct fsg_opts *fsg_opts; |
155 | int ret; | 155 | int ret; |
@@ -237,7 +237,7 @@ static struct usb_function *f_acm_multi; | |||
237 | static struct usb_function *f_ecm; | 237 | static struct usb_function *f_ecm; |
238 | static struct usb_function *f_msg_multi; | 238 | static struct usb_function *f_msg_multi; |
239 | 239 | ||
240 | static __init int cdc_do_config(struct usb_configuration *c) | 240 | static int cdc_do_config(struct usb_configuration *c) |
241 | { | 241 | { |
242 | struct fsg_opts *fsg_opts; | 242 | struct fsg_opts *fsg_opts; |
243 | int ret; | 243 | int ret; |
@@ -466,7 +466,7 @@ fail: | |||
466 | return status; | 466 | return status; |
467 | } | 467 | } |
468 | 468 | ||
469 | static int __exit multi_unbind(struct usb_composite_dev *cdev) | 469 | static int multi_unbind(struct usb_composite_dev *cdev) |
470 | { | 470 | { |
471 | #ifdef CONFIG_USB_G_MULTI_CDC | 471 | #ifdef CONFIG_USB_G_MULTI_CDC |
472 | usb_put_function(f_msg_multi); | 472 | usb_put_function(f_msg_multi); |
@@ -497,13 +497,13 @@ static int __exit multi_unbind(struct usb_composite_dev *cdev) | |||
497 | /****************************** Some noise ******************************/ | 497 | /****************************** Some noise ******************************/ |
498 | 498 | ||
499 | 499 | ||
500 | static __refdata struct usb_composite_driver multi_driver = { | 500 | static struct usb_composite_driver multi_driver = { |
501 | .name = "g_multi", | 501 | .name = "g_multi", |
502 | .dev = &device_desc, | 502 | .dev = &device_desc, |
503 | .strings = dev_strings, | 503 | .strings = dev_strings, |
504 | .max_speed = USB_SPEED_HIGH, | 504 | .max_speed = USB_SPEED_HIGH, |
505 | .bind = multi_bind, | 505 | .bind = multi_bind, |
506 | .unbind = __exit_p(multi_unbind), | 506 | .unbind = multi_unbind, |
507 | .needs_serial = 1, | 507 | .needs_serial = 1, |
508 | }; | 508 | }; |
509 | 509 | ||
diff --git a/drivers/usb/gadget/legacy/ncm.c b/drivers/usb/gadget/legacy/ncm.c index e90e23db2acb..6ce7421412e9 100644 --- a/drivers/usb/gadget/legacy/ncm.c +++ b/drivers/usb/gadget/legacy/ncm.c | |||
@@ -107,7 +107,7 @@ static struct usb_function *f_ncm; | |||
107 | 107 | ||
108 | /*-------------------------------------------------------------------------*/ | 108 | /*-------------------------------------------------------------------------*/ |
109 | 109 | ||
110 | static int __init ncm_do_config(struct usb_configuration *c) | 110 | static int ncm_do_config(struct usb_configuration *c) |
111 | { | 111 | { |
112 | int status; | 112 | int status; |
113 | 113 | ||
@@ -143,7 +143,7 @@ static struct usb_configuration ncm_config_driver = { | |||
143 | 143 | ||
144 | /*-------------------------------------------------------------------------*/ | 144 | /*-------------------------------------------------------------------------*/ |
145 | 145 | ||
146 | static int __init gncm_bind(struct usb_composite_dev *cdev) | 146 | static int gncm_bind(struct usb_composite_dev *cdev) |
147 | { | 147 | { |
148 | struct usb_gadget *gadget = cdev->gadget; | 148 | struct usb_gadget *gadget = cdev->gadget; |
149 | struct f_ncm_opts *ncm_opts; | 149 | struct f_ncm_opts *ncm_opts; |
@@ -186,7 +186,7 @@ fail: | |||
186 | return status; | 186 | return status; |
187 | } | 187 | } |
188 | 188 | ||
189 | static int __exit gncm_unbind(struct usb_composite_dev *cdev) | 189 | static int gncm_unbind(struct usb_composite_dev *cdev) |
190 | { | 190 | { |
191 | if (!IS_ERR_OR_NULL(f_ncm)) | 191 | if (!IS_ERR_OR_NULL(f_ncm)) |
192 | usb_put_function(f_ncm); | 192 | usb_put_function(f_ncm); |
@@ -195,13 +195,13 @@ static int __exit gncm_unbind(struct usb_composite_dev *cdev) | |||
195 | return 0; | 195 | return 0; |
196 | } | 196 | } |
197 | 197 | ||
198 | static __refdata struct usb_composite_driver ncm_driver = { | 198 | static struct usb_composite_driver ncm_driver = { |
199 | .name = "g_ncm", | 199 | .name = "g_ncm", |
200 | .dev = &device_desc, | 200 | .dev = &device_desc, |
201 | .strings = dev_strings, | 201 | .strings = dev_strings, |
202 | .max_speed = USB_SPEED_HIGH, | 202 | .max_speed = USB_SPEED_HIGH, |
203 | .bind = gncm_bind, | 203 | .bind = gncm_bind, |
204 | .unbind = __exit_p(gncm_unbind), | 204 | .unbind = gncm_unbind, |
205 | }; | 205 | }; |
206 | 206 | ||
207 | module_usb_composite_driver(ncm_driver); | 207 | module_usb_composite_driver(ncm_driver); |
diff --git a/drivers/usb/gadget/legacy/nokia.c b/drivers/usb/gadget/legacy/nokia.c index 9b8fd701648c..4bb498a38a1c 100644 --- a/drivers/usb/gadget/legacy/nokia.c +++ b/drivers/usb/gadget/legacy/nokia.c | |||
@@ -118,7 +118,7 @@ static struct usb_function_instance *fi_obex1; | |||
118 | static struct usb_function_instance *fi_obex2; | 118 | static struct usb_function_instance *fi_obex2; |
119 | static struct usb_function_instance *fi_phonet; | 119 | static struct usb_function_instance *fi_phonet; |
120 | 120 | ||
121 | static int __init nokia_bind_config(struct usb_configuration *c) | 121 | static int nokia_bind_config(struct usb_configuration *c) |
122 | { | 122 | { |
123 | struct usb_function *f_acm; | 123 | struct usb_function *f_acm; |
124 | struct usb_function *f_phonet = NULL; | 124 | struct usb_function *f_phonet = NULL; |
@@ -224,7 +224,7 @@ err_get_acm: | |||
224 | return status; | 224 | return status; |
225 | } | 225 | } |
226 | 226 | ||
227 | static int __init nokia_bind(struct usb_composite_dev *cdev) | 227 | static int nokia_bind(struct usb_composite_dev *cdev) |
228 | { | 228 | { |
229 | struct usb_gadget *gadget = cdev->gadget; | 229 | struct usb_gadget *gadget = cdev->gadget; |
230 | int status; | 230 | int status; |
@@ -307,7 +307,7 @@ err_usb: | |||
307 | return status; | 307 | return status; |
308 | } | 308 | } |
309 | 309 | ||
310 | static int __exit nokia_unbind(struct usb_composite_dev *cdev) | 310 | static int nokia_unbind(struct usb_composite_dev *cdev) |
311 | { | 311 | { |
312 | if (!IS_ERR_OR_NULL(f_obex1_cfg2)) | 312 | if (!IS_ERR_OR_NULL(f_obex1_cfg2)) |
313 | usb_put_function(f_obex1_cfg2); | 313 | usb_put_function(f_obex1_cfg2); |
@@ -338,13 +338,13 @@ static int __exit nokia_unbind(struct usb_composite_dev *cdev) | |||
338 | return 0; | 338 | return 0; |
339 | } | 339 | } |
340 | 340 | ||
341 | static __refdata struct usb_composite_driver nokia_driver = { | 341 | static struct usb_composite_driver nokia_driver = { |
342 | .name = "g_nokia", | 342 | .name = "g_nokia", |
343 | .dev = &device_desc, | 343 | .dev = &device_desc, |
344 | .strings = dev_strings, | 344 | .strings = dev_strings, |
345 | .max_speed = USB_SPEED_HIGH, | 345 | .max_speed = USB_SPEED_HIGH, |
346 | .bind = nokia_bind, | 346 | .bind = nokia_bind, |
347 | .unbind = __exit_p(nokia_unbind), | 347 | .unbind = nokia_unbind, |
348 | }; | 348 | }; |
349 | 349 | ||
350 | module_usb_composite_driver(nokia_driver); | 350 | module_usb_composite_driver(nokia_driver); |
diff --git a/drivers/usb/gadget/legacy/printer.c b/drivers/usb/gadget/legacy/printer.c index d5b6ee725a2a..1ce7df1060a5 100644 --- a/drivers/usb/gadget/legacy/printer.c +++ b/drivers/usb/gadget/legacy/printer.c | |||
@@ -126,7 +126,7 @@ static struct usb_configuration printer_cfg_driver = { | |||
126 | .bmAttributes = USB_CONFIG_ATT_ONE | USB_CONFIG_ATT_SELFPOWER, | 126 | .bmAttributes = USB_CONFIG_ATT_ONE | USB_CONFIG_ATT_SELFPOWER, |
127 | }; | 127 | }; |
128 | 128 | ||
129 | static int __init printer_do_config(struct usb_configuration *c) | 129 | static int printer_do_config(struct usb_configuration *c) |
130 | { | 130 | { |
131 | struct usb_gadget *gadget = c->cdev->gadget; | 131 | struct usb_gadget *gadget = c->cdev->gadget; |
132 | int status = 0; | 132 | int status = 0; |
@@ -152,7 +152,7 @@ static int __init printer_do_config(struct usb_configuration *c) | |||
152 | return status; | 152 | return status; |
153 | } | 153 | } |
154 | 154 | ||
155 | static int __init printer_bind(struct usb_composite_dev *cdev) | 155 | static int printer_bind(struct usb_composite_dev *cdev) |
156 | { | 156 | { |
157 | struct f_printer_opts *opts; | 157 | struct f_printer_opts *opts; |
158 | int ret, len; | 158 | int ret, len; |
@@ -191,7 +191,7 @@ static int __init printer_bind(struct usb_composite_dev *cdev) | |||
191 | return ret; | 191 | return ret; |
192 | } | 192 | } |
193 | 193 | ||
194 | static int __exit printer_unbind(struct usb_composite_dev *cdev) | 194 | static int printer_unbind(struct usb_composite_dev *cdev) |
195 | { | 195 | { |
196 | usb_put_function(f_printer); | 196 | usb_put_function(f_printer); |
197 | usb_put_function_instance(fi_printer); | 197 | usb_put_function_instance(fi_printer); |
@@ -199,7 +199,7 @@ static int __exit printer_unbind(struct usb_composite_dev *cdev) | |||
199 | return 0; | 199 | return 0; |
200 | } | 200 | } |
201 | 201 | ||
202 | static __refdata struct usb_composite_driver printer_driver = { | 202 | static struct usb_composite_driver printer_driver = { |
203 | .name = shortname, | 203 | .name = shortname, |
204 | .dev = &device_desc, | 204 | .dev = &device_desc, |
205 | .strings = dev_strings, | 205 | .strings = dev_strings, |
diff --git a/drivers/usb/gadget/legacy/serial.c b/drivers/usb/gadget/legacy/serial.c index 1f5f978d35d5..8b7528f9b78e 100644 --- a/drivers/usb/gadget/legacy/serial.c +++ b/drivers/usb/gadget/legacy/serial.c | |||
@@ -174,7 +174,7 @@ out: | |||
174 | return ret; | 174 | return ret; |
175 | } | 175 | } |
176 | 176 | ||
177 | static int __init gs_bind(struct usb_composite_dev *cdev) | 177 | static int gs_bind(struct usb_composite_dev *cdev) |
178 | { | 178 | { |
179 | int status; | 179 | int status; |
180 | 180 | ||
@@ -230,7 +230,7 @@ static int gs_unbind(struct usb_composite_dev *cdev) | |||
230 | return 0; | 230 | return 0; |
231 | } | 231 | } |
232 | 232 | ||
233 | static __refdata struct usb_composite_driver gserial_driver = { | 233 | static struct usb_composite_driver gserial_driver = { |
234 | .name = "g_serial", | 234 | .name = "g_serial", |
235 | .dev = &device_desc, | 235 | .dev = &device_desc, |
236 | .strings = dev_strings, | 236 | .strings = dev_strings, |
diff --git a/drivers/usb/gadget/legacy/tcm_usb_gadget.c b/drivers/usb/gadget/legacy/tcm_usb_gadget.c index 8b80addc4ce6..f9b4882fce52 100644 --- a/drivers/usb/gadget/legacy/tcm_usb_gadget.c +++ b/drivers/usb/gadget/legacy/tcm_usb_gadget.c | |||
@@ -2397,7 +2397,7 @@ static int usb_target_bind(struct usb_composite_dev *cdev) | |||
2397 | return 0; | 2397 | return 0; |
2398 | } | 2398 | } |
2399 | 2399 | ||
2400 | static __refdata struct usb_composite_driver usbg_driver = { | 2400 | static struct usb_composite_driver usbg_driver = { |
2401 | .name = "g_target", | 2401 | .name = "g_target", |
2402 | .dev = &usbg_device_desc, | 2402 | .dev = &usbg_device_desc, |
2403 | .strings = usbg_strings, | 2403 | .strings = usbg_strings, |
diff --git a/drivers/usb/gadget/legacy/webcam.c b/drivers/usb/gadget/legacy/webcam.c index 04a3da20f742..72c976bf3530 100644 --- a/drivers/usb/gadget/legacy/webcam.c +++ b/drivers/usb/gadget/legacy/webcam.c | |||
@@ -334,7 +334,7 @@ static const struct uvc_descriptor_header * const uvc_ss_streaming_cls[] = { | |||
334 | * USB configuration | 334 | * USB configuration |
335 | */ | 335 | */ |
336 | 336 | ||
337 | static int __init | 337 | static int |
338 | webcam_config_bind(struct usb_configuration *c) | 338 | webcam_config_bind(struct usb_configuration *c) |
339 | { | 339 | { |
340 | int status = 0; | 340 | int status = 0; |
@@ -358,7 +358,7 @@ static struct usb_configuration webcam_config_driver = { | |||
358 | .MaxPower = CONFIG_USB_GADGET_VBUS_DRAW, | 358 | .MaxPower = CONFIG_USB_GADGET_VBUS_DRAW, |
359 | }; | 359 | }; |
360 | 360 | ||
361 | static int /* __init_or_exit */ | 361 | static int |
362 | webcam_unbind(struct usb_composite_dev *cdev) | 362 | webcam_unbind(struct usb_composite_dev *cdev) |
363 | { | 363 | { |
364 | if (!IS_ERR_OR_NULL(f_uvc)) | 364 | if (!IS_ERR_OR_NULL(f_uvc)) |
@@ -368,7 +368,7 @@ webcam_unbind(struct usb_composite_dev *cdev) | |||
368 | return 0; | 368 | return 0; |
369 | } | 369 | } |
370 | 370 | ||
371 | static int __init | 371 | static int |
372 | webcam_bind(struct usb_composite_dev *cdev) | 372 | webcam_bind(struct usb_composite_dev *cdev) |
373 | { | 373 | { |
374 | struct f_uvc_opts *uvc_opts; | 374 | struct f_uvc_opts *uvc_opts; |
@@ -422,7 +422,7 @@ error: | |||
422 | * Driver | 422 | * Driver |
423 | */ | 423 | */ |
424 | 424 | ||
425 | static __refdata struct usb_composite_driver webcam_driver = { | 425 | static struct usb_composite_driver webcam_driver = { |
426 | .name = "g_webcam", | 426 | .name = "g_webcam", |
427 | .dev = &webcam_device_descriptor, | 427 | .dev = &webcam_device_descriptor, |
428 | .strings = webcam_device_strings, | 428 | .strings = webcam_device_strings, |
diff --git a/drivers/usb/gadget/legacy/zero.c b/drivers/usb/gadget/legacy/zero.c index 5ee95152493c..c986e8addb90 100644 --- a/drivers/usb/gadget/legacy/zero.c +++ b/drivers/usb/gadget/legacy/zero.c | |||
@@ -272,7 +272,7 @@ static struct usb_function_instance *func_inst_lb; | |||
272 | module_param_named(qlen, gzero_options.qlen, uint, S_IRUGO|S_IWUSR); | 272 | module_param_named(qlen, gzero_options.qlen, uint, S_IRUGO|S_IWUSR); |
273 | MODULE_PARM_DESC(qlen, "depth of loopback queue"); | 273 | MODULE_PARM_DESC(qlen, "depth of loopback queue"); |
274 | 274 | ||
275 | static int __init zero_bind(struct usb_composite_dev *cdev) | 275 | static int zero_bind(struct usb_composite_dev *cdev) |
276 | { | 276 | { |
277 | struct f_ss_opts *ss_opts; | 277 | struct f_ss_opts *ss_opts; |
278 | struct f_lb_opts *lb_opts; | 278 | struct f_lb_opts *lb_opts; |
@@ -400,7 +400,7 @@ static int zero_unbind(struct usb_composite_dev *cdev) | |||
400 | return 0; | 400 | return 0; |
401 | } | 401 | } |
402 | 402 | ||
403 | static __refdata struct usb_composite_driver zero_driver = { | 403 | static struct usb_composite_driver zero_driver = { |
404 | .name = "zero", | 404 | .name = "zero", |
405 | .dev = &device_desc, | 405 | .dev = &device_desc, |
406 | .strings = dev_strings, | 406 | .strings = dev_strings, |
diff --git a/drivers/usb/gadget/udc/at91_udc.c b/drivers/usb/gadget/udc/at91_udc.c index 2fbedca3c2b4..fc4226462f8f 100644 --- a/drivers/usb/gadget/udc/at91_udc.c +++ b/drivers/usb/gadget/udc/at91_udc.c | |||
@@ -1942,7 +1942,7 @@ err_unprepare_fclk: | |||
1942 | return retval; | 1942 | return retval; |
1943 | } | 1943 | } |
1944 | 1944 | ||
1945 | static int __exit at91udc_remove(struct platform_device *pdev) | 1945 | static int at91udc_remove(struct platform_device *pdev) |
1946 | { | 1946 | { |
1947 | struct at91_udc *udc = platform_get_drvdata(pdev); | 1947 | struct at91_udc *udc = platform_get_drvdata(pdev); |
1948 | unsigned long flags; | 1948 | unsigned long flags; |
@@ -2018,7 +2018,7 @@ static int at91udc_resume(struct platform_device *pdev) | |||
2018 | #endif | 2018 | #endif |
2019 | 2019 | ||
2020 | static struct platform_driver at91_udc_driver = { | 2020 | static struct platform_driver at91_udc_driver = { |
2021 | .remove = __exit_p(at91udc_remove), | 2021 | .remove = at91udc_remove, |
2022 | .shutdown = at91udc_shutdown, | 2022 | .shutdown = at91udc_shutdown, |
2023 | .suspend = at91udc_suspend, | 2023 | .suspend = at91udc_suspend, |
2024 | .resume = at91udc_resume, | 2024 | .resume = at91udc_resume, |
diff --git a/drivers/usb/gadget/udc/atmel_usba_udc.c b/drivers/usb/gadget/udc/atmel_usba_udc.c index 4c01953a0869..351d48550c33 100644 --- a/drivers/usb/gadget/udc/atmel_usba_udc.c +++ b/drivers/usb/gadget/udc/atmel_usba_udc.c | |||
@@ -2186,7 +2186,7 @@ static int usba_udc_probe(struct platform_device *pdev) | |||
2186 | return 0; | 2186 | return 0; |
2187 | } | 2187 | } |
2188 | 2188 | ||
2189 | static int __exit usba_udc_remove(struct platform_device *pdev) | 2189 | static int usba_udc_remove(struct platform_device *pdev) |
2190 | { | 2190 | { |
2191 | struct usba_udc *udc; | 2191 | struct usba_udc *udc; |
2192 | int i; | 2192 | int i; |
@@ -2258,7 +2258,7 @@ static int usba_udc_resume(struct device *dev) | |||
2258 | static SIMPLE_DEV_PM_OPS(usba_udc_pm_ops, usba_udc_suspend, usba_udc_resume); | 2258 | static SIMPLE_DEV_PM_OPS(usba_udc_pm_ops, usba_udc_suspend, usba_udc_resume); |
2259 | 2259 | ||
2260 | static struct platform_driver udc_driver = { | 2260 | static struct platform_driver udc_driver = { |
2261 | .remove = __exit_p(usba_udc_remove), | 2261 | .remove = usba_udc_remove, |
2262 | .driver = { | 2262 | .driver = { |
2263 | .name = "atmel_usba_udc", | 2263 | .name = "atmel_usba_udc", |
2264 | .pm = &usba_udc_pm_ops, | 2264 | .pm = &usba_udc_pm_ops, |
diff --git a/drivers/usb/gadget/udc/fsl_udc_core.c b/drivers/usb/gadget/udc/fsl_udc_core.c index 55fcb930f92e..c60022b46a48 100644 --- a/drivers/usb/gadget/udc/fsl_udc_core.c +++ b/drivers/usb/gadget/udc/fsl_udc_core.c | |||
@@ -2525,7 +2525,7 @@ err_kfree: | |||
2525 | /* Driver removal function | 2525 | /* Driver removal function |
2526 | * Free resources and finish pending transactions | 2526 | * Free resources and finish pending transactions |
2527 | */ | 2527 | */ |
2528 | static int __exit fsl_udc_remove(struct platform_device *pdev) | 2528 | static int fsl_udc_remove(struct platform_device *pdev) |
2529 | { | 2529 | { |
2530 | struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 2530 | struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
2531 | struct fsl_usb2_platform_data *pdata = dev_get_platdata(&pdev->dev); | 2531 | struct fsl_usb2_platform_data *pdata = dev_get_platdata(&pdev->dev); |
@@ -2663,7 +2663,7 @@ static const struct platform_device_id fsl_udc_devtype[] = { | |||
2663 | }; | 2663 | }; |
2664 | MODULE_DEVICE_TABLE(platform, fsl_udc_devtype); | 2664 | MODULE_DEVICE_TABLE(platform, fsl_udc_devtype); |
2665 | static struct platform_driver udc_driver = { | 2665 | static struct platform_driver udc_driver = { |
2666 | .remove = __exit_p(fsl_udc_remove), | 2666 | .remove = fsl_udc_remove, |
2667 | /* Just for FSL i.mx SoC currently */ | 2667 | /* Just for FSL i.mx SoC currently */ |
2668 | .id_table = fsl_udc_devtype, | 2668 | .id_table = fsl_udc_devtype, |
2669 | /* these suspend and resume are not usb suspend and resume */ | 2669 | /* these suspend and resume are not usb suspend and resume */ |
diff --git a/drivers/usb/gadget/udc/fusb300_udc.c b/drivers/usb/gadget/udc/fusb300_udc.c index fb4df159d32d..3970f453de49 100644 --- a/drivers/usb/gadget/udc/fusb300_udc.c +++ b/drivers/usb/gadget/udc/fusb300_udc.c | |||
@@ -1342,7 +1342,7 @@ static const struct usb_gadget_ops fusb300_gadget_ops = { | |||
1342 | .udc_stop = fusb300_udc_stop, | 1342 | .udc_stop = fusb300_udc_stop, |
1343 | }; | 1343 | }; |
1344 | 1344 | ||
1345 | static int __exit fusb300_remove(struct platform_device *pdev) | 1345 | static int fusb300_remove(struct platform_device *pdev) |
1346 | { | 1346 | { |
1347 | struct fusb300 *fusb300 = platform_get_drvdata(pdev); | 1347 | struct fusb300 *fusb300 = platform_get_drvdata(pdev); |
1348 | 1348 | ||
@@ -1492,7 +1492,7 @@ clean_up: | |||
1492 | } | 1492 | } |
1493 | 1493 | ||
1494 | static struct platform_driver fusb300_driver = { | 1494 | static struct platform_driver fusb300_driver = { |
1495 | .remove = __exit_p(fusb300_remove), | 1495 | .remove = fusb300_remove, |
1496 | .driver = { | 1496 | .driver = { |
1497 | .name = (char *) udc_name, | 1497 | .name = (char *) udc_name, |
1498 | }, | 1498 | }, |
diff --git a/drivers/usb/gadget/udc/m66592-udc.c b/drivers/usb/gadget/udc/m66592-udc.c index 8c7c83c93713..309706fe4bf0 100644 --- a/drivers/usb/gadget/udc/m66592-udc.c +++ b/drivers/usb/gadget/udc/m66592-udc.c | |||
@@ -1528,7 +1528,7 @@ static const struct usb_gadget_ops m66592_gadget_ops = { | |||
1528 | .pullup = m66592_pullup, | 1528 | .pullup = m66592_pullup, |
1529 | }; | 1529 | }; |
1530 | 1530 | ||
1531 | static int __exit m66592_remove(struct platform_device *pdev) | 1531 | static int m66592_remove(struct platform_device *pdev) |
1532 | { | 1532 | { |
1533 | struct m66592 *m66592 = platform_get_drvdata(pdev); | 1533 | struct m66592 *m66592 = platform_get_drvdata(pdev); |
1534 | 1534 | ||
@@ -1695,7 +1695,7 @@ clean_up: | |||
1695 | 1695 | ||
1696 | /*-------------------------------------------------------------------------*/ | 1696 | /*-------------------------------------------------------------------------*/ |
1697 | static struct platform_driver m66592_driver = { | 1697 | static struct platform_driver m66592_driver = { |
1698 | .remove = __exit_p(m66592_remove), | 1698 | .remove = m66592_remove, |
1699 | .driver = { | 1699 | .driver = { |
1700 | .name = (char *) udc_name, | 1700 | .name = (char *) udc_name, |
1701 | }, | 1701 | }, |
diff --git a/drivers/usb/gadget/udc/r8a66597-udc.c b/drivers/usb/gadget/udc/r8a66597-udc.c index 2495fe9c95c5..0293f7169dee 100644 --- a/drivers/usb/gadget/udc/r8a66597-udc.c +++ b/drivers/usb/gadget/udc/r8a66597-udc.c | |||
@@ -1820,7 +1820,7 @@ static const struct usb_gadget_ops r8a66597_gadget_ops = { | |||
1820 | .set_selfpowered = r8a66597_set_selfpowered, | 1820 | .set_selfpowered = r8a66597_set_selfpowered, |
1821 | }; | 1821 | }; |
1822 | 1822 | ||
1823 | static int __exit r8a66597_remove(struct platform_device *pdev) | 1823 | static int r8a66597_remove(struct platform_device *pdev) |
1824 | { | 1824 | { |
1825 | struct r8a66597 *r8a66597 = platform_get_drvdata(pdev); | 1825 | struct r8a66597 *r8a66597 = platform_get_drvdata(pdev); |
1826 | 1826 | ||
@@ -1974,7 +1974,7 @@ clean_up2: | |||
1974 | 1974 | ||
1975 | /*-------------------------------------------------------------------------*/ | 1975 | /*-------------------------------------------------------------------------*/ |
1976 | static struct platform_driver r8a66597_driver = { | 1976 | static struct platform_driver r8a66597_driver = { |
1977 | .remove = __exit_p(r8a66597_remove), | 1977 | .remove = r8a66597_remove, |
1978 | .driver = { | 1978 | .driver = { |
1979 | .name = (char *) udc_name, | 1979 | .name = (char *) udc_name, |
1980 | }, | 1980 | }, |
diff --git a/drivers/usb/gadget/udc/udc-xilinx.c b/drivers/usb/gadget/udc/udc-xilinx.c index dd3e9fd31b80..1f24274477ab 100644 --- a/drivers/usb/gadget/udc/udc-xilinx.c +++ b/drivers/usb/gadget/udc/udc-xilinx.c | |||
@@ -2071,8 +2071,8 @@ static int xudc_probe(struct platform_device *pdev) | |||
2071 | /* Map the registers */ | 2071 | /* Map the registers */ |
2072 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 2072 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
2073 | udc->addr = devm_ioremap_resource(&pdev->dev, res); | 2073 | udc->addr = devm_ioremap_resource(&pdev->dev, res); |
2074 | if (!udc->addr) | 2074 | if (IS_ERR(udc->addr)) |
2075 | return -ENOMEM; | 2075 | return PTR_ERR(udc->addr); |
2076 | 2076 | ||
2077 | irq = platform_get_irq(pdev, 0); | 2077 | irq = platform_get_irq(pdev, 0); |
2078 | if (irq < 0) { | 2078 | if (irq < 0) { |
diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c index f5397a517c54..7d34cbfaf373 100644 --- a/drivers/usb/host/xhci-ring.c +++ b/drivers/usb/host/xhci-ring.c | |||
@@ -2026,8 +2026,13 @@ static int process_isoc_td(struct xhci_hcd *xhci, struct xhci_td *td, | |||
2026 | break; | 2026 | break; |
2027 | case COMP_DEV_ERR: | 2027 | case COMP_DEV_ERR: |
2028 | case COMP_STALL: | 2028 | case COMP_STALL: |
2029 | frame->status = -EPROTO; | ||
2030 | skip_td = true; | ||
2031 | break; | ||
2029 | case COMP_TX_ERR: | 2032 | case COMP_TX_ERR: |
2030 | frame->status = -EPROTO; | 2033 | frame->status = -EPROTO; |
2034 | if (event_trb != td->last_trb) | ||
2035 | return 0; | ||
2031 | skip_td = true; | 2036 | skip_td = true; |
2032 | break; | 2037 | break; |
2033 | case COMP_STOP: | 2038 | case COMP_STOP: |
@@ -2640,7 +2645,7 @@ irqreturn_t xhci_irq(struct usb_hcd *hcd) | |||
2640 | xhci_halt(xhci); | 2645 | xhci_halt(xhci); |
2641 | hw_died: | 2646 | hw_died: |
2642 | spin_unlock(&xhci->lock); | 2647 | spin_unlock(&xhci->lock); |
2643 | return -ESHUTDOWN; | 2648 | return IRQ_HANDLED; |
2644 | } | 2649 | } |
2645 | 2650 | ||
2646 | /* | 2651 | /* |
diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h index 8e421b89632d..ea75e8ccd3c1 100644 --- a/drivers/usb/host/xhci.h +++ b/drivers/usb/host/xhci.h | |||
@@ -1267,7 +1267,7 @@ union xhci_trb { | |||
1267 | * since the command ring is 64-byte aligned. | 1267 | * since the command ring is 64-byte aligned. |
1268 | * It must also be greater than 16. | 1268 | * It must also be greater than 16. |
1269 | */ | 1269 | */ |
1270 | #define TRBS_PER_SEGMENT 64 | 1270 | #define TRBS_PER_SEGMENT 256 |
1271 | /* Allow two commands + a link TRB, along with any reserved command TRBs */ | 1271 | /* Allow two commands + a link TRB, along with any reserved command TRBs */ |
1272 | #define MAX_RSVD_CMD_TRBS (TRBS_PER_SEGMENT - 3) | 1272 | #define MAX_RSVD_CMD_TRBS (TRBS_PER_SEGMENT - 3) |
1273 | #define TRB_SEGMENT_SIZE (TRBS_PER_SEGMENT*16) | 1273 | #define TRB_SEGMENT_SIZE (TRBS_PER_SEGMENT*16) |
diff --git a/drivers/usb/phy/phy-isp1301-omap.c b/drivers/usb/phy/phy-isp1301-omap.c index 1e0e10dd6ba5..3af263cc0caa 100644 --- a/drivers/usb/phy/phy-isp1301-omap.c +++ b/drivers/usb/phy/phy-isp1301-omap.c | |||
@@ -94,7 +94,7 @@ struct isp1301 { | |||
94 | 94 | ||
95 | #if defined(CONFIG_MACH_OMAP_H2) || defined(CONFIG_MACH_OMAP_H3) | 95 | #if defined(CONFIG_MACH_OMAP_H2) || defined(CONFIG_MACH_OMAP_H3) |
96 | 96 | ||
97 | #if defined(CONFIG_TPS65010) || defined(CONFIG_TPS65010_MODULE) | 97 | #if defined(CONFIG_TPS65010) || (defined(CONFIG_TPS65010_MODULE) && defined(MODULE)) |
98 | 98 | ||
99 | #include <linux/i2c/tps65010.h> | 99 | #include <linux/i2c/tps65010.h> |
100 | 100 | ||
diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c index 84ce2d74894c..9031750e7404 100644 --- a/drivers/usb/serial/cp210x.c +++ b/drivers/usb/serial/cp210x.c | |||
@@ -127,6 +127,7 @@ static const struct usb_device_id id_table[] = { | |||
127 | { USB_DEVICE(0x10C4, 0x88A5) }, /* Planet Innovation Ingeni ZigBee USB Device */ | 127 | { USB_DEVICE(0x10C4, 0x88A5) }, /* Planet Innovation Ingeni ZigBee USB Device */ |
128 | { USB_DEVICE(0x10C4, 0x8946) }, /* Ketra N1 Wireless Interface */ | 128 | { USB_DEVICE(0x10C4, 0x8946) }, /* Ketra N1 Wireless Interface */ |
129 | { USB_DEVICE(0x10C4, 0x8977) }, /* CEL MeshWorks DevKit Device */ | 129 | { USB_DEVICE(0x10C4, 0x8977) }, /* CEL MeshWorks DevKit Device */ |
130 | { USB_DEVICE(0x10C4, 0x8998) }, /* KCF Technologies PRN */ | ||
130 | { USB_DEVICE(0x10C4, 0xEA60) }, /* Silicon Labs factory default */ | 131 | { USB_DEVICE(0x10C4, 0xEA60) }, /* Silicon Labs factory default */ |
131 | { USB_DEVICE(0x10C4, 0xEA61) }, /* Silicon Labs factory default */ | 132 | { USB_DEVICE(0x10C4, 0xEA61) }, /* Silicon Labs factory default */ |
132 | { USB_DEVICE(0x10C4, 0xEA70) }, /* Silicon Labs factory default */ | 133 | { USB_DEVICE(0x10C4, 0xEA70) }, /* Silicon Labs factory default */ |
diff --git a/drivers/usb/serial/pl2303.c b/drivers/usb/serial/pl2303.c index 829604d11f3f..f5257af33ecf 100644 --- a/drivers/usb/serial/pl2303.c +++ b/drivers/usb/serial/pl2303.c | |||
@@ -61,7 +61,6 @@ static const struct usb_device_id id_table[] = { | |||
61 | { USB_DEVICE(DCU10_VENDOR_ID, DCU10_PRODUCT_ID) }, | 61 | { USB_DEVICE(DCU10_VENDOR_ID, DCU10_PRODUCT_ID) }, |
62 | { USB_DEVICE(SITECOM_VENDOR_ID, SITECOM_PRODUCT_ID) }, | 62 | { USB_DEVICE(SITECOM_VENDOR_ID, SITECOM_PRODUCT_ID) }, |
63 | { USB_DEVICE(ALCATEL_VENDOR_ID, ALCATEL_PRODUCT_ID) }, | 63 | { USB_DEVICE(ALCATEL_VENDOR_ID, ALCATEL_PRODUCT_ID) }, |
64 | { USB_DEVICE(SAMSUNG_VENDOR_ID, SAMSUNG_PRODUCT_ID) }, | ||
65 | { USB_DEVICE(SIEMENS_VENDOR_ID, SIEMENS_PRODUCT_ID_SX1), | 64 | { USB_DEVICE(SIEMENS_VENDOR_ID, SIEMENS_PRODUCT_ID_SX1), |
66 | .driver_info = PL2303_QUIRK_UART_STATE_IDX0 }, | 65 | .driver_info = PL2303_QUIRK_UART_STATE_IDX0 }, |
67 | { USB_DEVICE(SIEMENS_VENDOR_ID, SIEMENS_PRODUCT_ID_X65), | 66 | { USB_DEVICE(SIEMENS_VENDOR_ID, SIEMENS_PRODUCT_ID_X65), |
diff --git a/drivers/usb/serial/pl2303.h b/drivers/usb/serial/pl2303.h index 71fd9da1d6e7..e3b7af8adfb7 100644 --- a/drivers/usb/serial/pl2303.h +++ b/drivers/usb/serial/pl2303.h | |||
@@ -62,10 +62,6 @@ | |||
62 | #define ALCATEL_VENDOR_ID 0x11f7 | 62 | #define ALCATEL_VENDOR_ID 0x11f7 |
63 | #define ALCATEL_PRODUCT_ID 0x02df | 63 | #define ALCATEL_PRODUCT_ID 0x02df |
64 | 64 | ||
65 | /* Samsung I330 phone cradle */ | ||
66 | #define SAMSUNG_VENDOR_ID 0x04e8 | ||
67 | #define SAMSUNG_PRODUCT_ID 0x8001 | ||
68 | |||
69 | #define SIEMENS_VENDOR_ID 0x11f5 | 65 | #define SIEMENS_VENDOR_ID 0x11f5 |
70 | #define SIEMENS_PRODUCT_ID_SX1 0x0001 | 66 | #define SIEMENS_PRODUCT_ID_SX1 0x0001 |
71 | #define SIEMENS_PRODUCT_ID_X65 0x0003 | 67 | #define SIEMENS_PRODUCT_ID_X65 0x0003 |
diff --git a/drivers/usb/serial/visor.c b/drivers/usb/serial/visor.c index bf2bd40e5f2a..60afb39eb73c 100644 --- a/drivers/usb/serial/visor.c +++ b/drivers/usb/serial/visor.c | |||
@@ -95,7 +95,7 @@ static const struct usb_device_id id_table[] = { | |||
95 | .driver_info = (kernel_ulong_t)&palm_os_4_probe }, | 95 | .driver_info = (kernel_ulong_t)&palm_os_4_probe }, |
96 | { USB_DEVICE(ACER_VENDOR_ID, ACER_S10_ID), | 96 | { USB_DEVICE(ACER_VENDOR_ID, ACER_S10_ID), |
97 | .driver_info = (kernel_ulong_t)&palm_os_4_probe }, | 97 | .driver_info = (kernel_ulong_t)&palm_os_4_probe }, |
98 | { USB_DEVICE(SAMSUNG_VENDOR_ID, SAMSUNG_SCH_I330_ID), | 98 | { USB_DEVICE_INTERFACE_CLASS(SAMSUNG_VENDOR_ID, SAMSUNG_SCH_I330_ID, 0xff), |
99 | .driver_info = (kernel_ulong_t)&palm_os_4_probe }, | 99 | .driver_info = (kernel_ulong_t)&palm_os_4_probe }, |
100 | { USB_DEVICE(SAMSUNG_VENDOR_ID, SAMSUNG_SPH_I500_ID), | 100 | { USB_DEVICE(SAMSUNG_VENDOR_ID, SAMSUNG_SPH_I500_ID), |
101 | .driver_info = (kernel_ulong_t)&palm_os_4_probe }, | 101 | .driver_info = (kernel_ulong_t)&palm_os_4_probe }, |
diff --git a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h index d684b4b8108f..caf188800c67 100644 --- a/drivers/usb/storage/unusual_devs.h +++ b/drivers/usb/storage/unusual_devs.h | |||
@@ -766,6 +766,13 @@ UNUSUAL_DEV( 0x059f, 0x0643, 0x0000, 0x0000, | |||
766 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, | 766 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, |
767 | US_FL_GO_SLOW ), | 767 | US_FL_GO_SLOW ), |
768 | 768 | ||
769 | /* Reported by Christian Schaller <cschalle@redhat.com> */ | ||
770 | UNUSUAL_DEV( 0x059f, 0x0651, 0x0000, 0x0000, | ||
771 | "LaCie", | ||
772 | "External HDD", | ||
773 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, | ||
774 | US_FL_NO_WP_DETECT ), | ||
775 | |||
769 | /* Submitted by Joel Bourquard <numlock@freesurf.ch> | 776 | /* Submitted by Joel Bourquard <numlock@freesurf.ch> |
770 | * Some versions of this device need the SubClass and Protocol overrides | 777 | * Some versions of this device need the SubClass and Protocol overrides |
771 | * while others don't. | 778 | * while others don't. |
diff --git a/drivers/xen/events/events_base.c b/drivers/xen/events/events_base.c index 2b8553bd8715..38387950490e 100644 --- a/drivers/xen/events/events_base.c +++ b/drivers/xen/events/events_base.c | |||
@@ -957,7 +957,7 @@ unsigned xen_evtchn_nr_channels(void) | |||
957 | } | 957 | } |
958 | EXPORT_SYMBOL_GPL(xen_evtchn_nr_channels); | 958 | EXPORT_SYMBOL_GPL(xen_evtchn_nr_channels); |
959 | 959 | ||
960 | int bind_virq_to_irq(unsigned int virq, unsigned int cpu) | 960 | int bind_virq_to_irq(unsigned int virq, unsigned int cpu, bool percpu) |
961 | { | 961 | { |
962 | struct evtchn_bind_virq bind_virq; | 962 | struct evtchn_bind_virq bind_virq; |
963 | int evtchn, irq, ret; | 963 | int evtchn, irq, ret; |
@@ -971,8 +971,12 @@ int bind_virq_to_irq(unsigned int virq, unsigned int cpu) | |||
971 | if (irq < 0) | 971 | if (irq < 0) |
972 | goto out; | 972 | goto out; |
973 | 973 | ||
974 | irq_set_chip_and_handler_name(irq, &xen_percpu_chip, | 974 | if (percpu) |
975 | handle_percpu_irq, "virq"); | 975 | irq_set_chip_and_handler_name(irq, &xen_percpu_chip, |
976 | handle_percpu_irq, "virq"); | ||
977 | else | ||
978 | irq_set_chip_and_handler_name(irq, &xen_dynamic_chip, | ||
979 | handle_edge_irq, "virq"); | ||
976 | 980 | ||
977 | bind_virq.virq = virq; | 981 | bind_virq.virq = virq; |
978 | bind_virq.vcpu = cpu; | 982 | bind_virq.vcpu = cpu; |
@@ -1062,7 +1066,7 @@ int bind_virq_to_irqhandler(unsigned int virq, unsigned int cpu, | |||
1062 | { | 1066 | { |
1063 | int irq, retval; | 1067 | int irq, retval; |
1064 | 1068 | ||
1065 | irq = bind_virq_to_irq(virq, cpu); | 1069 | irq = bind_virq_to_irq(virq, cpu, irqflags & IRQF_PERCPU); |
1066 | if (irq < 0) | 1070 | if (irq < 0) |
1067 | return irq; | 1071 | return irq; |
1068 | retval = request_irq(irq, handler, irqflags, devname, dev_id); | 1072 | retval = request_irq(irq, handler, irqflags, devname, dev_id); |
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index 0ec8e228b89f..7effed6f2fa6 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c | |||
@@ -3180,8 +3180,6 @@ static int write_one_cache_group(struct btrfs_trans_handle *trans, | |||
3180 | btrfs_mark_buffer_dirty(leaf); | 3180 | btrfs_mark_buffer_dirty(leaf); |
3181 | fail: | 3181 | fail: |
3182 | btrfs_release_path(path); | 3182 | btrfs_release_path(path); |
3183 | if (ret) | ||
3184 | btrfs_abort_transaction(trans, root, ret); | ||
3185 | return ret; | 3183 | return ret; |
3186 | 3184 | ||
3187 | } | 3185 | } |
@@ -3487,8 +3485,30 @@ again: | |||
3487 | ret = 0; | 3485 | ret = 0; |
3488 | } | 3486 | } |
3489 | } | 3487 | } |
3490 | if (!ret) | 3488 | if (!ret) { |
3491 | ret = write_one_cache_group(trans, root, path, cache); | 3489 | ret = write_one_cache_group(trans, root, path, cache); |
3490 | /* | ||
3491 | * Our block group might still be attached to the list | ||
3492 | * of new block groups in the transaction handle of some | ||
3493 | * other task (struct btrfs_trans_handle->new_bgs). This | ||
3494 | * means its block group item isn't yet in the extent | ||
3495 | * tree. If this happens ignore the error, as we will | ||
3496 | * try again later in the critical section of the | ||
3497 | * transaction commit. | ||
3498 | */ | ||
3499 | if (ret == -ENOENT) { | ||
3500 | ret = 0; | ||
3501 | spin_lock(&cur_trans->dirty_bgs_lock); | ||
3502 | if (list_empty(&cache->dirty_list)) { | ||
3503 | list_add_tail(&cache->dirty_list, | ||
3504 | &cur_trans->dirty_bgs); | ||
3505 | btrfs_get_block_group(cache); | ||
3506 | } | ||
3507 | spin_unlock(&cur_trans->dirty_bgs_lock); | ||
3508 | } else if (ret) { | ||
3509 | btrfs_abort_transaction(trans, root, ret); | ||
3510 | } | ||
3511 | } | ||
3492 | 3512 | ||
3493 | /* if its not on the io list, we need to put the block group */ | 3513 | /* if its not on the io list, we need to put the block group */ |
3494 | if (should_put) | 3514 | if (should_put) |
@@ -3597,8 +3617,11 @@ int btrfs_write_dirty_block_groups(struct btrfs_trans_handle *trans, | |||
3597 | ret = 0; | 3617 | ret = 0; |
3598 | } | 3618 | } |
3599 | } | 3619 | } |
3600 | if (!ret) | 3620 | if (!ret) { |
3601 | ret = write_one_cache_group(trans, root, path, cache); | 3621 | ret = write_one_cache_group(trans, root, path, cache); |
3622 | if (ret) | ||
3623 | btrfs_abort_transaction(trans, root, ret); | ||
3624 | } | ||
3602 | 3625 | ||
3603 | /* if its not on the io list, we need to put the block group */ | 3626 | /* if its not on the io list, we need to put the block group */ |
3604 | if (should_put) | 3627 | if (should_put) |
diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c index 43af5a61ad25..c32d226bfecc 100644 --- a/fs/btrfs/extent_io.c +++ b/fs/btrfs/extent_io.c | |||
@@ -4772,6 +4772,25 @@ struct extent_buffer *find_extent_buffer(struct btrfs_fs_info *fs_info, | |||
4772 | start >> PAGE_CACHE_SHIFT); | 4772 | start >> PAGE_CACHE_SHIFT); |
4773 | if (eb && atomic_inc_not_zero(&eb->refs)) { | 4773 | if (eb && atomic_inc_not_zero(&eb->refs)) { |
4774 | rcu_read_unlock(); | 4774 | rcu_read_unlock(); |
4775 | /* | ||
4776 | * Lock our eb's refs_lock to avoid races with | ||
4777 | * free_extent_buffer. When we get our eb it might be flagged | ||
4778 | * with EXTENT_BUFFER_STALE and another task running | ||
4779 | * free_extent_buffer might have seen that flag set, | ||
4780 | * eb->refs == 2, that the buffer isn't under IO (dirty and | ||
4781 | * writeback flags not set) and it's still in the tree (flag | ||
4782 | * EXTENT_BUFFER_TREE_REF set), therefore being in the process | ||
4783 | * of decrementing the extent buffer's reference count twice. | ||
4784 | * So here we could race and increment the eb's reference count, | ||
4785 | * clear its stale flag, mark it as dirty and drop our reference | ||
4786 | * before the other task finishes executing free_extent_buffer, | ||
4787 | * which would later result in an attempt to free an extent | ||
4788 | * buffer that is dirty. | ||
4789 | */ | ||
4790 | if (test_bit(EXTENT_BUFFER_STALE, &eb->bflags)) { | ||
4791 | spin_lock(&eb->refs_lock); | ||
4792 | spin_unlock(&eb->refs_lock); | ||
4793 | } | ||
4775 | mark_extent_buffer_accessed(eb, NULL); | 4794 | mark_extent_buffer_accessed(eb, NULL); |
4776 | return eb; | 4795 | return eb; |
4777 | } | 4796 | } |
diff --git a/fs/btrfs/free-space-cache.c b/fs/btrfs/free-space-cache.c index 5e020d76fd07..9dbe5b548fa6 100644 --- a/fs/btrfs/free-space-cache.c +++ b/fs/btrfs/free-space-cache.c | |||
@@ -3466,6 +3466,7 @@ int btrfs_write_out_ino_cache(struct btrfs_root *root, | |||
3466 | struct btrfs_free_space_ctl *ctl = root->free_ino_ctl; | 3466 | struct btrfs_free_space_ctl *ctl = root->free_ino_ctl; |
3467 | int ret; | 3467 | int ret; |
3468 | struct btrfs_io_ctl io_ctl; | 3468 | struct btrfs_io_ctl io_ctl; |
3469 | bool release_metadata = true; | ||
3469 | 3470 | ||
3470 | if (!btrfs_test_opt(root, INODE_MAP_CACHE)) | 3471 | if (!btrfs_test_opt(root, INODE_MAP_CACHE)) |
3471 | return 0; | 3472 | return 0; |
@@ -3473,11 +3474,20 @@ int btrfs_write_out_ino_cache(struct btrfs_root *root, | |||
3473 | memset(&io_ctl, 0, sizeof(io_ctl)); | 3474 | memset(&io_ctl, 0, sizeof(io_ctl)); |
3474 | ret = __btrfs_write_out_cache(root, inode, ctl, NULL, &io_ctl, | 3475 | ret = __btrfs_write_out_cache(root, inode, ctl, NULL, &io_ctl, |
3475 | trans, path, 0); | 3476 | trans, path, 0); |
3476 | if (!ret) | 3477 | if (!ret) { |
3478 | /* | ||
3479 | * At this point writepages() didn't error out, so our metadata | ||
3480 | * reservation is released when the writeback finishes, at | ||
3481 | * inode.c:btrfs_finish_ordered_io(), regardless of it finishing | ||
3482 | * with or without an error. | ||
3483 | */ | ||
3484 | release_metadata = false; | ||
3477 | ret = btrfs_wait_cache_io(root, trans, NULL, &io_ctl, path, 0); | 3485 | ret = btrfs_wait_cache_io(root, trans, NULL, &io_ctl, path, 0); |
3486 | } | ||
3478 | 3487 | ||
3479 | if (ret) { | 3488 | if (ret) { |
3480 | btrfs_delalloc_release_metadata(inode, inode->i_size); | 3489 | if (release_metadata) |
3490 | btrfs_delalloc_release_metadata(inode, inode->i_size); | ||
3481 | #ifdef DEBUG | 3491 | #ifdef DEBUG |
3482 | btrfs_err(root->fs_info, | 3492 | btrfs_err(root->fs_info, |
3483 | "failed to write free ino cache for root %llu", | 3493 | "failed to write free ino cache for root %llu", |
diff --git a/fs/btrfs/ordered-data.c b/fs/btrfs/ordered-data.c index 157cc54fc634..760c4a5e096b 100644 --- a/fs/btrfs/ordered-data.c +++ b/fs/btrfs/ordered-data.c | |||
@@ -722,6 +722,7 @@ void btrfs_start_ordered_extent(struct inode *inode, | |||
722 | int btrfs_wait_ordered_range(struct inode *inode, u64 start, u64 len) | 722 | int btrfs_wait_ordered_range(struct inode *inode, u64 start, u64 len) |
723 | { | 723 | { |
724 | int ret = 0; | 724 | int ret = 0; |
725 | int ret_wb = 0; | ||
725 | u64 end; | 726 | u64 end; |
726 | u64 orig_end; | 727 | u64 orig_end; |
727 | struct btrfs_ordered_extent *ordered; | 728 | struct btrfs_ordered_extent *ordered; |
@@ -741,9 +742,14 @@ int btrfs_wait_ordered_range(struct inode *inode, u64 start, u64 len) | |||
741 | if (ret) | 742 | if (ret) |
742 | return ret; | 743 | return ret; |
743 | 744 | ||
744 | ret = filemap_fdatawait_range(inode->i_mapping, start, orig_end); | 745 | /* |
745 | if (ret) | 746 | * If we have a writeback error don't return immediately. Wait first |
746 | return ret; | 747 | * for any ordered extents that haven't completed yet. This is to make |
748 | * sure no one can dirty the same page ranges and call writepages() | ||
749 | * before the ordered extents complete - to avoid failures (-EEXIST) | ||
750 | * when adding the new ordered extents to the ordered tree. | ||
751 | */ | ||
752 | ret_wb = filemap_fdatawait_range(inode->i_mapping, start, orig_end); | ||
747 | 753 | ||
748 | end = orig_end; | 754 | end = orig_end; |
749 | while (1) { | 755 | while (1) { |
@@ -767,7 +773,7 @@ int btrfs_wait_ordered_range(struct inode *inode, u64 start, u64 len) | |||
767 | break; | 773 | break; |
768 | end--; | 774 | end--; |
769 | } | 775 | } |
770 | return ret; | 776 | return ret_wb ? ret_wb : ret; |
771 | } | 777 | } |
772 | 778 | ||
773 | /* | 779 | /* |
@@ -659,6 +659,9 @@ int setup_arg_pages(struct linux_binprm *bprm, | |||
659 | if (stack_base > STACK_SIZE_MAX) | 659 | if (stack_base > STACK_SIZE_MAX) |
660 | stack_base = STACK_SIZE_MAX; | 660 | stack_base = STACK_SIZE_MAX; |
661 | 661 | ||
662 | /* Add space for stack randomization. */ | ||
663 | stack_base += (STACK_RND_MASK << PAGE_SHIFT); | ||
664 | |||
662 | /* Make sure we didn't let the argument array grow too large. */ | 665 | /* Make sure we didn't let the argument array grow too large. */ |
663 | if (vma->vm_end - vma->vm_start > stack_base) | 666 | if (vma->vm_end - vma->vm_start > stack_base) |
664 | return -ENOMEM; | 667 | return -ENOMEM; |
diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h index 009a0590b20f..9a83f149ac85 100644 --- a/fs/ext4/ext4.h +++ b/fs/ext4/ext4.h | |||
@@ -2889,7 +2889,6 @@ extern int ext4_map_blocks(handle_t *handle, struct inode *inode, | |||
2889 | struct ext4_map_blocks *map, int flags); | 2889 | struct ext4_map_blocks *map, int flags); |
2890 | extern int ext4_ext_calc_metadata_amount(struct inode *inode, | 2890 | extern int ext4_ext_calc_metadata_amount(struct inode *inode, |
2891 | ext4_lblk_t lblocks); | 2891 | ext4_lblk_t lblocks); |
2892 | extern int ext4_extent_tree_init(handle_t *, struct inode *); | ||
2893 | extern int ext4_ext_calc_credits_for_single_extent(struct inode *inode, | 2892 | extern int ext4_ext_calc_credits_for_single_extent(struct inode *inode, |
2894 | int num, | 2893 | int num, |
2895 | struct ext4_ext_path *path); | 2894 | struct ext4_ext_path *path); |
diff --git a/fs/ext4/ext4_jbd2.c b/fs/ext4/ext4_jbd2.c index 3445035c7e01..d41843181818 100644 --- a/fs/ext4/ext4_jbd2.c +++ b/fs/ext4/ext4_jbd2.c | |||
@@ -87,6 +87,12 @@ int __ext4_journal_stop(const char *where, unsigned int line, handle_t *handle) | |||
87 | ext4_put_nojournal(handle); | 87 | ext4_put_nojournal(handle); |
88 | return 0; | 88 | return 0; |
89 | } | 89 | } |
90 | |||
91 | if (!handle->h_transaction) { | ||
92 | err = jbd2_journal_stop(handle); | ||
93 | return handle->h_err ? handle->h_err : err; | ||
94 | } | ||
95 | |||
90 | sb = handle->h_transaction->t_journal->j_private; | 96 | sb = handle->h_transaction->t_journal->j_private; |
91 | err = handle->h_err; | 97 | err = handle->h_err; |
92 | rc = jbd2_journal_stop(handle); | 98 | rc = jbd2_journal_stop(handle); |
diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c index d74e08029643..e003a1e81dc3 100644 --- a/fs/ext4/extents.c +++ b/fs/ext4/extents.c | |||
@@ -377,7 +377,7 @@ static int ext4_valid_extent(struct inode *inode, struct ext4_extent *ext) | |||
377 | ext4_lblk_t lblock = le32_to_cpu(ext->ee_block); | 377 | ext4_lblk_t lblock = le32_to_cpu(ext->ee_block); |
378 | ext4_lblk_t last = lblock + len - 1; | 378 | ext4_lblk_t last = lblock + len - 1; |
379 | 379 | ||
380 | if (lblock > last) | 380 | if (len == 0 || lblock > last) |
381 | return 0; | 381 | return 0; |
382 | return ext4_data_block_valid(EXT4_SB(inode->i_sb), block, len); | 382 | return ext4_data_block_valid(EXT4_SB(inode->i_sb), block, len); |
383 | } | 383 | } |
@@ -5396,6 +5396,14 @@ int ext4_collapse_range(struct inode *inode, loff_t offset, loff_t len) | |||
5396 | loff_t new_size, ioffset; | 5396 | loff_t new_size, ioffset; |
5397 | int ret; | 5397 | int ret; |
5398 | 5398 | ||
5399 | /* | ||
5400 | * We need to test this early because xfstests assumes that a | ||
5401 | * collapse range of (0, 1) will return EOPNOTSUPP if the file | ||
5402 | * system does not support collapse range. | ||
5403 | */ | ||
5404 | if (!ext4_test_inode_flag(inode, EXT4_INODE_EXTENTS)) | ||
5405 | return -EOPNOTSUPP; | ||
5406 | |||
5399 | /* Collapse range works only on fs block size aligned offsets. */ | 5407 | /* Collapse range works only on fs block size aligned offsets. */ |
5400 | if (offset & (EXT4_CLUSTER_SIZE(sb) - 1) || | 5408 | if (offset & (EXT4_CLUSTER_SIZE(sb) - 1) || |
5401 | len & (EXT4_CLUSTER_SIZE(sb) - 1)) | 5409 | len & (EXT4_CLUSTER_SIZE(sb) - 1)) |
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index 55b187c3bac1..0554b0b5957b 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c | |||
@@ -4345,7 +4345,7 @@ static void ext4_update_other_inodes_time(struct super_block *sb, | |||
4345 | int inode_size = EXT4_INODE_SIZE(sb); | 4345 | int inode_size = EXT4_INODE_SIZE(sb); |
4346 | 4346 | ||
4347 | oi.orig_ino = orig_ino; | 4347 | oi.orig_ino = orig_ino; |
4348 | ino = orig_ino & ~(inodes_per_block - 1); | 4348 | ino = (orig_ino & ~(inodes_per_block - 1)) + 1; |
4349 | for (i = 0; i < inodes_per_block; i++, ino++, buf += inode_size) { | 4349 | for (i = 0; i < inodes_per_block; i++, ino++, buf += inode_size) { |
4350 | if (ino == orig_ino) | 4350 | if (ino == orig_ino) |
4351 | continue; | 4351 | continue; |
diff --git a/fs/ext4/super.c b/fs/ext4/super.c index f06d0589ddba..ca9d4a2fed41 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c | |||
@@ -294,6 +294,8 @@ static void __save_error_info(struct super_block *sb, const char *func, | |||
294 | struct ext4_super_block *es = EXT4_SB(sb)->s_es; | 294 | struct ext4_super_block *es = EXT4_SB(sb)->s_es; |
295 | 295 | ||
296 | EXT4_SB(sb)->s_mount_state |= EXT4_ERROR_FS; | 296 | EXT4_SB(sb)->s_mount_state |= EXT4_ERROR_FS; |
297 | if (bdev_read_only(sb->s_bdev)) | ||
298 | return; | ||
297 | es->s_state |= cpu_to_le16(EXT4_ERROR_FS); | 299 | es->s_state |= cpu_to_le16(EXT4_ERROR_FS); |
298 | es->s_last_error_time = cpu_to_le32(get_seconds()); | 300 | es->s_last_error_time = cpu_to_le32(get_seconds()); |
299 | strncpy(es->s_last_error_func, func, sizeof(es->s_last_error_func)); | 301 | strncpy(es->s_last_error_func, func, sizeof(es->s_last_error_func)); |
diff --git a/fs/hostfs/hostfs_kern.c b/fs/hostfs/hostfs_kern.c index ef263174acd2..07d8d8f52faf 100644 --- a/fs/hostfs/hostfs_kern.c +++ b/fs/hostfs/hostfs_kern.c | |||
@@ -581,7 +581,7 @@ static int hostfs_create(struct inode *dir, struct dentry *dentry, umode_t mode, | |||
581 | if (name == NULL) | 581 | if (name == NULL) |
582 | goto out_put; | 582 | goto out_put; |
583 | 583 | ||
584 | fd = file_create(name, mode & S_IFMT); | 584 | fd = file_create(name, mode & 0777); |
585 | if (fd < 0) | 585 | if (fd < 0) |
586 | error = fd; | 586 | error = fd; |
587 | else | 587 | else |
diff --git a/fs/jbd2/recovery.c b/fs/jbd2/recovery.c index b5128c6e63ad..a9079d035ae5 100644 --- a/fs/jbd2/recovery.c +++ b/fs/jbd2/recovery.c | |||
@@ -842,15 +842,23 @@ static int scan_revoke_records(journal_t *journal, struct buffer_head *bh, | |||
842 | { | 842 | { |
843 | jbd2_journal_revoke_header_t *header; | 843 | jbd2_journal_revoke_header_t *header; |
844 | int offset, max; | 844 | int offset, max; |
845 | int csum_size = 0; | ||
846 | __u32 rcount; | ||
845 | int record_len = 4; | 847 | int record_len = 4; |
846 | 848 | ||
847 | header = (jbd2_journal_revoke_header_t *) bh->b_data; | 849 | header = (jbd2_journal_revoke_header_t *) bh->b_data; |
848 | offset = sizeof(jbd2_journal_revoke_header_t); | 850 | offset = sizeof(jbd2_journal_revoke_header_t); |
849 | max = be32_to_cpu(header->r_count); | 851 | rcount = be32_to_cpu(header->r_count); |
850 | 852 | ||
851 | if (!jbd2_revoke_block_csum_verify(journal, header)) | 853 | if (!jbd2_revoke_block_csum_verify(journal, header)) |
852 | return -EINVAL; | 854 | return -EINVAL; |
853 | 855 | ||
856 | if (jbd2_journal_has_csum_v2or3(journal)) | ||
857 | csum_size = sizeof(struct jbd2_journal_revoke_tail); | ||
858 | if (rcount > journal->j_blocksize - csum_size) | ||
859 | return -EINVAL; | ||
860 | max = rcount; | ||
861 | |||
854 | if (JBD2_HAS_INCOMPAT_FEATURE(journal, JBD2_FEATURE_INCOMPAT_64BIT)) | 862 | if (JBD2_HAS_INCOMPAT_FEATURE(journal, JBD2_FEATURE_INCOMPAT_64BIT)) |
855 | record_len = 8; | 863 | record_len = 8; |
856 | 864 | ||
diff --git a/fs/jbd2/revoke.c b/fs/jbd2/revoke.c index c6cbaef2bda1..14214da80eb8 100644 --- a/fs/jbd2/revoke.c +++ b/fs/jbd2/revoke.c | |||
@@ -577,7 +577,7 @@ static void write_one_revoke_record(journal_t *journal, | |||
577 | { | 577 | { |
578 | int csum_size = 0; | 578 | int csum_size = 0; |
579 | struct buffer_head *descriptor; | 579 | struct buffer_head *descriptor; |
580 | int offset; | 580 | int sz, offset; |
581 | journal_header_t *header; | 581 | journal_header_t *header; |
582 | 582 | ||
583 | /* If we are already aborting, this all becomes a noop. We | 583 | /* If we are already aborting, this all becomes a noop. We |
@@ -594,9 +594,14 @@ static void write_one_revoke_record(journal_t *journal, | |||
594 | if (jbd2_journal_has_csum_v2or3(journal)) | 594 | if (jbd2_journal_has_csum_v2or3(journal)) |
595 | csum_size = sizeof(struct jbd2_journal_revoke_tail); | 595 | csum_size = sizeof(struct jbd2_journal_revoke_tail); |
596 | 596 | ||
597 | if (JBD2_HAS_INCOMPAT_FEATURE(journal, JBD2_FEATURE_INCOMPAT_64BIT)) | ||
598 | sz = 8; | ||
599 | else | ||
600 | sz = 4; | ||
601 | |||
597 | /* Make sure we have a descriptor with space left for the record */ | 602 | /* Make sure we have a descriptor with space left for the record */ |
598 | if (descriptor) { | 603 | if (descriptor) { |
599 | if (offset >= journal->j_blocksize - csum_size) { | 604 | if (offset + sz > journal->j_blocksize - csum_size) { |
600 | flush_descriptor(journal, descriptor, offset, write_op); | 605 | flush_descriptor(journal, descriptor, offset, write_op); |
601 | descriptor = NULL; | 606 | descriptor = NULL; |
602 | } | 607 | } |
@@ -619,16 +624,13 @@ static void write_one_revoke_record(journal_t *journal, | |||
619 | *descriptorp = descriptor; | 624 | *descriptorp = descriptor; |
620 | } | 625 | } |
621 | 626 | ||
622 | if (JBD2_HAS_INCOMPAT_FEATURE(journal, JBD2_FEATURE_INCOMPAT_64BIT)) { | 627 | if (JBD2_HAS_INCOMPAT_FEATURE(journal, JBD2_FEATURE_INCOMPAT_64BIT)) |
623 | * ((__be64 *)(&descriptor->b_data[offset])) = | 628 | * ((__be64 *)(&descriptor->b_data[offset])) = |
624 | cpu_to_be64(record->blocknr); | 629 | cpu_to_be64(record->blocknr); |
625 | offset += 8; | 630 | else |
626 | |||
627 | } else { | ||
628 | * ((__be32 *)(&descriptor->b_data[offset])) = | 631 | * ((__be32 *)(&descriptor->b_data[offset])) = |
629 | cpu_to_be32(record->blocknr); | 632 | cpu_to_be32(record->blocknr); |
630 | offset += 4; | 633 | offset += sz; |
631 | } | ||
632 | 634 | ||
633 | *offsetp = offset; | 635 | *offsetp = offset; |
634 | } | 636 | } |
diff --git a/fs/jbd2/transaction.c b/fs/jbd2/transaction.c index 5f09370c90a8..ff2f2e6ad311 100644 --- a/fs/jbd2/transaction.c +++ b/fs/jbd2/transaction.c | |||
@@ -551,7 +551,6 @@ int jbd2_journal_extend(handle_t *handle, int nblocks) | |||
551 | int result; | 551 | int result; |
552 | int wanted; | 552 | int wanted; |
553 | 553 | ||
554 | WARN_ON(!transaction); | ||
555 | if (is_handle_aborted(handle)) | 554 | if (is_handle_aborted(handle)) |
556 | return -EROFS; | 555 | return -EROFS; |
557 | journal = transaction->t_journal; | 556 | journal = transaction->t_journal; |
@@ -627,7 +626,6 @@ int jbd2__journal_restart(handle_t *handle, int nblocks, gfp_t gfp_mask) | |||
627 | tid_t tid; | 626 | tid_t tid; |
628 | int need_to_start, ret; | 627 | int need_to_start, ret; |
629 | 628 | ||
630 | WARN_ON(!transaction); | ||
631 | /* If we've had an abort of any type, don't even think about | 629 | /* If we've had an abort of any type, don't even think about |
632 | * actually doing the restart! */ | 630 | * actually doing the restart! */ |
633 | if (is_handle_aborted(handle)) | 631 | if (is_handle_aborted(handle)) |
@@ -785,7 +783,6 @@ do_get_write_access(handle_t *handle, struct journal_head *jh, | |||
785 | int need_copy = 0; | 783 | int need_copy = 0; |
786 | unsigned long start_lock, time_lock; | 784 | unsigned long start_lock, time_lock; |
787 | 785 | ||
788 | WARN_ON(!transaction); | ||
789 | if (is_handle_aborted(handle)) | 786 | if (is_handle_aborted(handle)) |
790 | return -EROFS; | 787 | return -EROFS; |
791 | journal = transaction->t_journal; | 788 | journal = transaction->t_journal; |
@@ -1051,7 +1048,6 @@ int jbd2_journal_get_create_access(handle_t *handle, struct buffer_head *bh) | |||
1051 | int err; | 1048 | int err; |
1052 | 1049 | ||
1053 | jbd_debug(5, "journal_head %p\n", jh); | 1050 | jbd_debug(5, "journal_head %p\n", jh); |
1054 | WARN_ON(!transaction); | ||
1055 | err = -EROFS; | 1051 | err = -EROFS; |
1056 | if (is_handle_aborted(handle)) | 1052 | if (is_handle_aborted(handle)) |
1057 | goto out; | 1053 | goto out; |
@@ -1266,7 +1262,6 @@ int jbd2_journal_dirty_metadata(handle_t *handle, struct buffer_head *bh) | |||
1266 | struct journal_head *jh; | 1262 | struct journal_head *jh; |
1267 | int ret = 0; | 1263 | int ret = 0; |
1268 | 1264 | ||
1269 | WARN_ON(!transaction); | ||
1270 | if (is_handle_aborted(handle)) | 1265 | if (is_handle_aborted(handle)) |
1271 | return -EROFS; | 1266 | return -EROFS; |
1272 | journal = transaction->t_journal; | 1267 | journal = transaction->t_journal; |
@@ -1397,7 +1392,6 @@ int jbd2_journal_forget (handle_t *handle, struct buffer_head *bh) | |||
1397 | int err = 0; | 1392 | int err = 0; |
1398 | int was_modified = 0; | 1393 | int was_modified = 0; |
1399 | 1394 | ||
1400 | WARN_ON(!transaction); | ||
1401 | if (is_handle_aborted(handle)) | 1395 | if (is_handle_aborted(handle)) |
1402 | return -EROFS; | 1396 | return -EROFS; |
1403 | journal = transaction->t_journal; | 1397 | journal = transaction->t_journal; |
@@ -1530,8 +1524,22 @@ int jbd2_journal_stop(handle_t *handle) | |||
1530 | tid_t tid; | 1524 | tid_t tid; |
1531 | pid_t pid; | 1525 | pid_t pid; |
1532 | 1526 | ||
1533 | if (!transaction) | 1527 | if (!transaction) { |
1534 | goto free_and_exit; | 1528 | /* |
1529 | * Handle is already detached from the transaction so | ||
1530 | * there is nothing to do other than decrease a refcount, | ||
1531 | * or free the handle if refcount drops to zero | ||
1532 | */ | ||
1533 | if (--handle->h_ref > 0) { | ||
1534 | jbd_debug(4, "h_ref %d -> %d\n", handle->h_ref + 1, | ||
1535 | handle->h_ref); | ||
1536 | return err; | ||
1537 | } else { | ||
1538 | if (handle->h_rsv_handle) | ||
1539 | jbd2_free_handle(handle->h_rsv_handle); | ||
1540 | goto free_and_exit; | ||
1541 | } | ||
1542 | } | ||
1535 | journal = transaction->t_journal; | 1543 | journal = transaction->t_journal; |
1536 | 1544 | ||
1537 | J_ASSERT(journal_current_handle() == handle); | 1545 | J_ASSERT(journal_current_handle() == handle); |
@@ -2373,7 +2381,6 @@ int jbd2_journal_file_inode(handle_t *handle, struct jbd2_inode *jinode) | |||
2373 | transaction_t *transaction = handle->h_transaction; | 2381 | transaction_t *transaction = handle->h_transaction; |
2374 | journal_t *journal; | 2382 | journal_t *journal; |
2375 | 2383 | ||
2376 | WARN_ON(!transaction); | ||
2377 | if (is_handle_aborted(handle)) | 2384 | if (is_handle_aborted(handle)) |
2378 | return -EROFS; | 2385 | return -EROFS; |
2379 | journal = transaction->t_journal; | 2386 | journal = transaction->t_journal; |
diff --git a/fs/kernfs/dir.c b/fs/kernfs/dir.c index f131fc23ffc4..fffca9517321 100644 --- a/fs/kernfs/dir.c +++ b/fs/kernfs/dir.c | |||
@@ -518,7 +518,14 @@ static struct kernfs_node *__kernfs_new_node(struct kernfs_root *root, | |||
518 | if (!kn) | 518 | if (!kn) |
519 | goto err_out1; | 519 | goto err_out1; |
520 | 520 | ||
521 | ret = ida_simple_get(&root->ino_ida, 1, 0, GFP_KERNEL); | 521 | /* |
522 | * If the ino of the sysfs entry created for a kmem cache gets | ||
523 | * allocated from an ida layer, which is accounted to the memcg that | ||
524 | * owns the cache, the memcg will get pinned forever. So do not account | ||
525 | * ino ida allocations. | ||
526 | */ | ||
527 | ret = ida_simple_get(&root->ino_ida, 1, 0, | ||
528 | GFP_KERNEL | __GFP_NOACCOUNT); | ||
522 | if (ret < 0) | 529 | if (ret < 0) |
523 | goto err_out2; | 530 | goto err_out2; |
524 | kn->ino = ret; | 531 | kn->ino = ret; |
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index 45b35b9b1e36..55e1e3af23a3 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c | |||
@@ -38,6 +38,7 @@ | |||
38 | #include <linux/mm.h> | 38 | #include <linux/mm.h> |
39 | #include <linux/delay.h> | 39 | #include <linux/delay.h> |
40 | #include <linux/errno.h> | 40 | #include <linux/errno.h> |
41 | #include <linux/file.h> | ||
41 | #include <linux/string.h> | 42 | #include <linux/string.h> |
42 | #include <linux/ratelimit.h> | 43 | #include <linux/ratelimit.h> |
43 | #include <linux/printk.h> | 44 | #include <linux/printk.h> |
@@ -5604,6 +5605,7 @@ static struct nfs4_lockdata *nfs4_alloc_lockdata(struct file_lock *fl, | |||
5604 | p->server = server; | 5605 | p->server = server; |
5605 | atomic_inc(&lsp->ls_count); | 5606 | atomic_inc(&lsp->ls_count); |
5606 | p->ctx = get_nfs_open_context(ctx); | 5607 | p->ctx = get_nfs_open_context(ctx); |
5608 | get_file(fl->fl_file); | ||
5607 | memcpy(&p->fl, fl, sizeof(p->fl)); | 5609 | memcpy(&p->fl, fl, sizeof(p->fl)); |
5608 | return p; | 5610 | return p; |
5609 | out_free_seqid: | 5611 | out_free_seqid: |
@@ -5716,6 +5718,7 @@ static void nfs4_lock_release(void *calldata) | |||
5716 | nfs_free_seqid(data->arg.lock_seqid); | 5718 | nfs_free_seqid(data->arg.lock_seqid); |
5717 | nfs4_put_lock_state(data->lsp); | 5719 | nfs4_put_lock_state(data->lsp); |
5718 | put_nfs_open_context(data->ctx); | 5720 | put_nfs_open_context(data->ctx); |
5721 | fput(data->fl.fl_file); | ||
5719 | kfree(data); | 5722 | kfree(data); |
5720 | dprintk("%s: done!\n", __func__); | 5723 | dprintk("%s: done!\n", __func__); |
5721 | } | 5724 | } |
diff --git a/fs/nfs/write.c b/fs/nfs/write.c index d12a4be613a5..dfc19f1575a1 100644 --- a/fs/nfs/write.c +++ b/fs/nfs/write.c | |||
@@ -1845,12 +1845,15 @@ int nfs_wb_all(struct inode *inode) | |||
1845 | trace_nfs_writeback_inode_enter(inode); | 1845 | trace_nfs_writeback_inode_enter(inode); |
1846 | 1846 | ||
1847 | ret = filemap_write_and_wait(inode->i_mapping); | 1847 | ret = filemap_write_and_wait(inode->i_mapping); |
1848 | if (!ret) { | 1848 | if (ret) |
1849 | ret = nfs_commit_inode(inode, FLUSH_SYNC); | 1849 | goto out; |
1850 | if (!ret) | 1850 | ret = nfs_commit_inode(inode, FLUSH_SYNC); |
1851 | pnfs_sync_inode(inode, true); | 1851 | if (ret < 0) |
1852 | } | 1852 | goto out; |
1853 | pnfs_sync_inode(inode, true); | ||
1854 | ret = 0; | ||
1853 | 1855 | ||
1856 | out: | ||
1854 | trace_nfs_writeback_inode_exit(inode, ret); | 1857 | trace_nfs_writeback_inode_exit(inode, ret); |
1855 | return ret; | 1858 | return ret; |
1856 | } | 1859 | } |
diff --git a/include/drm/drm_pciids.h b/include/drm/drm_pciids.h index 2dd405c9be78..45c39a37f924 100644 --- a/include/drm/drm_pciids.h +++ b/include/drm/drm_pciids.h | |||
@@ -186,6 +186,7 @@ | |||
186 | {0x1002, 0x6658, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_BONAIRE|RADEON_NEW_MEMMAP}, \ | 186 | {0x1002, 0x6658, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_BONAIRE|RADEON_NEW_MEMMAP}, \ |
187 | {0x1002, 0x665c, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_BONAIRE|RADEON_NEW_MEMMAP}, \ | 187 | {0x1002, 0x665c, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_BONAIRE|RADEON_NEW_MEMMAP}, \ |
188 | {0x1002, 0x665d, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_BONAIRE|RADEON_NEW_MEMMAP}, \ | 188 | {0x1002, 0x665d, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_BONAIRE|RADEON_NEW_MEMMAP}, \ |
189 | {0x1002, 0x665f, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_BONAIRE|RADEON_NEW_MEMMAP}, \ | ||
189 | {0x1002, 0x6660, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_HAINAN|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ | 190 | {0x1002, 0x6660, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_HAINAN|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ |
190 | {0x1002, 0x6663, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_HAINAN|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ | 191 | {0x1002, 0x6663, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_HAINAN|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ |
191 | {0x1002, 0x6664, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_HAINAN|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ | 192 | {0x1002, 0x6664, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_HAINAN|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ |
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index 7f9a516f24de..5d93a6645e88 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h | |||
@@ -821,8 +821,6 @@ extern int scsi_cmd_ioctl(struct request_queue *, struct gendisk *, fmode_t, | |||
821 | extern int sg_scsi_ioctl(struct request_queue *, struct gendisk *, fmode_t, | 821 | extern int sg_scsi_ioctl(struct request_queue *, struct gendisk *, fmode_t, |
822 | struct scsi_ioctl_command __user *); | 822 | struct scsi_ioctl_command __user *); |
823 | 823 | ||
824 | extern void blk_queue_bio(struct request_queue *q, struct bio *bio); | ||
825 | |||
826 | /* | 824 | /* |
827 | * A queue has just exitted congestion. Note this in the global counter of | 825 | * A queue has just exitted congestion. Note this in the global counter of |
828 | * congested queues, and wake up anyone who was waiting for requests to be | 826 | * congested queues, and wake up anyone who was waiting for requests to be |
diff --git a/include/linux/gfp.h b/include/linux/gfp.h index 70a7fee1efb3..6ba7cf23748f 100644 --- a/include/linux/gfp.h +++ b/include/linux/gfp.h | |||
@@ -30,6 +30,7 @@ struct vm_area_struct; | |||
30 | #define ___GFP_HARDWALL 0x20000u | 30 | #define ___GFP_HARDWALL 0x20000u |
31 | #define ___GFP_THISNODE 0x40000u | 31 | #define ___GFP_THISNODE 0x40000u |
32 | #define ___GFP_RECLAIMABLE 0x80000u | 32 | #define ___GFP_RECLAIMABLE 0x80000u |
33 | #define ___GFP_NOACCOUNT 0x100000u | ||
33 | #define ___GFP_NOTRACK 0x200000u | 34 | #define ___GFP_NOTRACK 0x200000u |
34 | #define ___GFP_NO_KSWAPD 0x400000u | 35 | #define ___GFP_NO_KSWAPD 0x400000u |
35 | #define ___GFP_OTHER_NODE 0x800000u | 36 | #define ___GFP_OTHER_NODE 0x800000u |
@@ -87,6 +88,7 @@ struct vm_area_struct; | |||
87 | #define __GFP_HARDWALL ((__force gfp_t)___GFP_HARDWALL) /* Enforce hardwall cpuset memory allocs */ | 88 | #define __GFP_HARDWALL ((__force gfp_t)___GFP_HARDWALL) /* Enforce hardwall cpuset memory allocs */ |
88 | #define __GFP_THISNODE ((__force gfp_t)___GFP_THISNODE)/* No fallback, no policies */ | 89 | #define __GFP_THISNODE ((__force gfp_t)___GFP_THISNODE)/* No fallback, no policies */ |
89 | #define __GFP_RECLAIMABLE ((__force gfp_t)___GFP_RECLAIMABLE) /* Page is reclaimable */ | 90 | #define __GFP_RECLAIMABLE ((__force gfp_t)___GFP_RECLAIMABLE) /* Page is reclaimable */ |
91 | #define __GFP_NOACCOUNT ((__force gfp_t)___GFP_NOACCOUNT) /* Don't account to kmemcg */ | ||
90 | #define __GFP_NOTRACK ((__force gfp_t)___GFP_NOTRACK) /* Don't track with kmemcheck */ | 92 | #define __GFP_NOTRACK ((__force gfp_t)___GFP_NOTRACK) /* Don't track with kmemcheck */ |
91 | 93 | ||
92 | #define __GFP_NO_KSWAPD ((__force gfp_t)___GFP_NO_KSWAPD) | 94 | #define __GFP_NO_KSWAPD ((__force gfp_t)___GFP_NO_KSWAPD) |
diff --git a/include/linux/hid-sensor-hub.h b/include/linux/hid-sensor-hub.h index 0408421d885f..0042bf330b99 100644 --- a/include/linux/hid-sensor-hub.h +++ b/include/linux/hid-sensor-hub.h | |||
@@ -74,7 +74,7 @@ struct sensor_hub_pending { | |||
74 | * @usage: Usage id for this hub device instance. | 74 | * @usage: Usage id for this hub device instance. |
75 | * @start_collection_index: Starting index for a phy type collection | 75 | * @start_collection_index: Starting index for a phy type collection |
76 | * @end_collection_index: Last index for a phy type collection | 76 | * @end_collection_index: Last index for a phy type collection |
77 | * @mutex: synchronizing mutex. | 77 | * @mutex_ptr: synchronizing mutex pointer. |
78 | * @pending: Holds information of pending sync read request. | 78 | * @pending: Holds information of pending sync read request. |
79 | */ | 79 | */ |
80 | struct hid_sensor_hub_device { | 80 | struct hid_sensor_hub_device { |
@@ -84,7 +84,7 @@ struct hid_sensor_hub_device { | |||
84 | u32 usage; | 84 | u32 usage; |
85 | int start_collection_index; | 85 | int start_collection_index; |
86 | int end_collection_index; | 86 | int end_collection_index; |
87 | struct mutex mutex; | 87 | struct mutex *mutex_ptr; |
88 | struct sensor_hub_pending pending; | 88 | struct sensor_hub_pending pending; |
89 | }; | 89 | }; |
90 | 90 | ||
diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h index 72dff5fb0d0c..6c8918114804 100644 --- a/include/linux/memcontrol.h +++ b/include/linux/memcontrol.h | |||
@@ -463,6 +463,8 @@ memcg_kmem_newpage_charge(gfp_t gfp, struct mem_cgroup **memcg, int order) | |||
463 | if (!memcg_kmem_enabled()) | 463 | if (!memcg_kmem_enabled()) |
464 | return true; | 464 | return true; |
465 | 465 | ||
466 | if (gfp & __GFP_NOACCOUNT) | ||
467 | return true; | ||
466 | /* | 468 | /* |
467 | * __GFP_NOFAIL allocations will move on even if charging is not | 469 | * __GFP_NOFAIL allocations will move on even if charging is not |
468 | * possible. Therefore we don't even try, and have this allocation | 470 | * possible. Therefore we don't even try, and have this allocation |
@@ -522,6 +524,8 @@ memcg_kmem_get_cache(struct kmem_cache *cachep, gfp_t gfp) | |||
522 | { | 524 | { |
523 | if (!memcg_kmem_enabled()) | 525 | if (!memcg_kmem_enabled()) |
524 | return cachep; | 526 | return cachep; |
527 | if (gfp & __GFP_NOACCOUNT) | ||
528 | return cachep; | ||
525 | if (gfp & __GFP_NOFAIL) | 529 | if (gfp & __GFP_NOFAIL) |
526 | return cachep; | 530 | return cachep; |
527 | if (in_interrupt() || (!current->mm) || (current->flags & PF_KTHREAD)) | 531 | if (in_interrupt() || (!current->mm) || (current->flags & PF_KTHREAD)) |
diff --git a/include/linux/platform_data/si5351.h b/include/linux/platform_data/si5351.h index a947ab8b441a..533d9807e543 100644 --- a/include/linux/platform_data/si5351.h +++ b/include/linux/platform_data/si5351.h | |||
@@ -5,8 +5,6 @@ | |||
5 | #ifndef __LINUX_PLATFORM_DATA_SI5351_H__ | 5 | #ifndef __LINUX_PLATFORM_DATA_SI5351_H__ |
6 | #define __LINUX_PLATFORM_DATA_SI5351_H__ | 6 | #define __LINUX_PLATFORM_DATA_SI5351_H__ |
7 | 7 | ||
8 | struct clk; | ||
9 | |||
10 | /** | 8 | /** |
11 | * enum si5351_pll_src - Si5351 pll clock source | 9 | * enum si5351_pll_src - Si5351 pll clock source |
12 | * @SI5351_PLL_SRC_DEFAULT: default, do not change eeprom config | 10 | * @SI5351_PLL_SRC_DEFAULT: default, do not change eeprom config |
@@ -107,8 +105,6 @@ struct si5351_clkout_config { | |||
107 | * @clkout: array of clkout configuration | 105 | * @clkout: array of clkout configuration |
108 | */ | 106 | */ |
109 | struct si5351_platform_data { | 107 | struct si5351_platform_data { |
110 | struct clk *clk_xtal; | ||
111 | struct clk *clk_clkin; | ||
112 | enum si5351_pll_src pll_src[2]; | 108 | enum si5351_pll_src pll_src[2]; |
113 | struct si5351_clkout_config clkout[8]; | 109 | struct si5351_clkout_config clkout[8]; |
114 | }; | 110 | }; |
diff --git a/include/linux/rhashtable.h b/include/linux/rhashtable.h index dbcbcc59aa92..843ceca9a21e 100644 --- a/include/linux/rhashtable.h +++ b/include/linux/rhashtable.h | |||
@@ -17,6 +17,7 @@ | |||
17 | #ifndef _LINUX_RHASHTABLE_H | 17 | #ifndef _LINUX_RHASHTABLE_H |
18 | #define _LINUX_RHASHTABLE_H | 18 | #define _LINUX_RHASHTABLE_H |
19 | 19 | ||
20 | #include <linux/atomic.h> | ||
20 | #include <linux/compiler.h> | 21 | #include <linux/compiler.h> |
21 | #include <linux/errno.h> | 22 | #include <linux/errno.h> |
22 | #include <linux/jhash.h> | 23 | #include <linux/jhash.h> |
@@ -100,6 +101,7 @@ struct rhashtable; | |||
100 | * @key_len: Length of key | 101 | * @key_len: Length of key |
101 | * @key_offset: Offset of key in struct to be hashed | 102 | * @key_offset: Offset of key in struct to be hashed |
102 | * @head_offset: Offset of rhash_head in struct to be hashed | 103 | * @head_offset: Offset of rhash_head in struct to be hashed |
104 | * @insecure_max_entries: Maximum number of entries (may be exceeded) | ||
103 | * @max_size: Maximum size while expanding | 105 | * @max_size: Maximum size while expanding |
104 | * @min_size: Minimum size while shrinking | 106 | * @min_size: Minimum size while shrinking |
105 | * @nulls_base: Base value to generate nulls marker | 107 | * @nulls_base: Base value to generate nulls marker |
@@ -115,6 +117,7 @@ struct rhashtable_params { | |||
115 | size_t key_len; | 117 | size_t key_len; |
116 | size_t key_offset; | 118 | size_t key_offset; |
117 | size_t head_offset; | 119 | size_t head_offset; |
120 | unsigned int insecure_max_entries; | ||
118 | unsigned int max_size; | 121 | unsigned int max_size; |
119 | unsigned int min_size; | 122 | unsigned int min_size; |
120 | u32 nulls_base; | 123 | u32 nulls_base; |
@@ -286,6 +289,18 @@ static inline bool rht_grow_above_100(const struct rhashtable *ht, | |||
286 | (!ht->p.max_size || tbl->size < ht->p.max_size); | 289 | (!ht->p.max_size || tbl->size < ht->p.max_size); |
287 | } | 290 | } |
288 | 291 | ||
292 | /** | ||
293 | * rht_grow_above_max - returns true if table is above maximum | ||
294 | * @ht: hash table | ||
295 | * @tbl: current table | ||
296 | */ | ||
297 | static inline bool rht_grow_above_max(const struct rhashtable *ht, | ||
298 | const struct bucket_table *tbl) | ||
299 | { | ||
300 | return ht->p.insecure_max_entries && | ||
301 | atomic_read(&ht->nelems) >= ht->p.insecure_max_entries; | ||
302 | } | ||
303 | |||
289 | /* The bucket lock is selected based on the hash and protects mutations | 304 | /* The bucket lock is selected based on the hash and protects mutations |
290 | * on a group of hash buckets. | 305 | * on a group of hash buckets. |
291 | * | 306 | * |
@@ -589,6 +604,10 @@ restart: | |||
589 | goto out; | 604 | goto out; |
590 | } | 605 | } |
591 | 606 | ||
607 | err = -E2BIG; | ||
608 | if (unlikely(rht_grow_above_max(ht, tbl))) | ||
609 | goto out; | ||
610 | |||
592 | if (unlikely(rht_grow_above_100(ht, tbl))) { | 611 | if (unlikely(rht_grow_above_100(ht, tbl))) { |
593 | slow_path: | 612 | slow_path: |
594 | spin_unlock_bh(lock); | 613 | spin_unlock_bh(lock); |
diff --git a/include/linux/sched/rt.h b/include/linux/sched/rt.h index 6341f5be6e24..a30b172df6e1 100644 --- a/include/linux/sched/rt.h +++ b/include/linux/sched/rt.h | |||
@@ -18,7 +18,7 @@ static inline int rt_task(struct task_struct *p) | |||
18 | #ifdef CONFIG_RT_MUTEXES | 18 | #ifdef CONFIG_RT_MUTEXES |
19 | extern int rt_mutex_getprio(struct task_struct *p); | 19 | extern int rt_mutex_getprio(struct task_struct *p); |
20 | extern void rt_mutex_setprio(struct task_struct *p, int prio); | 20 | extern void rt_mutex_setprio(struct task_struct *p, int prio); |
21 | extern int rt_mutex_check_prio(struct task_struct *task, int newprio); | 21 | extern int rt_mutex_get_effective_prio(struct task_struct *task, int newprio); |
22 | extern struct task_struct *rt_mutex_get_top_task(struct task_struct *task); | 22 | extern struct task_struct *rt_mutex_get_top_task(struct task_struct *task); |
23 | extern void rt_mutex_adjust_pi(struct task_struct *p); | 23 | extern void rt_mutex_adjust_pi(struct task_struct *p); |
24 | static inline bool tsk_is_pi_blocked(struct task_struct *tsk) | 24 | static inline bool tsk_is_pi_blocked(struct task_struct *tsk) |
@@ -31,9 +31,10 @@ static inline int rt_mutex_getprio(struct task_struct *p) | |||
31 | return p->normal_prio; | 31 | return p->normal_prio; |
32 | } | 32 | } |
33 | 33 | ||
34 | static inline int rt_mutex_check_prio(struct task_struct *task, int newprio) | 34 | static inline int rt_mutex_get_effective_prio(struct task_struct *task, |
35 | int newprio) | ||
35 | { | 36 | { |
36 | return 0; | 37 | return newprio; |
37 | } | 38 | } |
38 | 39 | ||
39 | static inline struct task_struct *rt_mutex_get_top_task(struct task_struct *task) | 40 | static inline struct task_struct *rt_mutex_get_top_task(struct task_struct *task) |
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index 40960fece0b2..b617095adb88 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h | |||
@@ -178,6 +178,7 @@ struct nf_bridge_info { | |||
178 | struct net_device *physoutdev; | 178 | struct net_device *physoutdev; |
179 | char neigh_header[8]; | 179 | char neigh_header[8]; |
180 | }; | 180 | }; |
181 | __be32 ipv4_daddr; | ||
181 | }; | 182 | }; |
182 | #endif | 183 | #endif |
183 | 184 | ||
diff --git a/include/linux/tcp.h b/include/linux/tcp.h index f0212026c77f..48c3696e8645 100644 --- a/include/linux/tcp.h +++ b/include/linux/tcp.h | |||
@@ -163,6 +163,8 @@ struct tcp_sock { | |||
163 | * sum(delta(snd_una)), or how many bytes | 163 | * sum(delta(snd_una)), or how many bytes |
164 | * were acked. | 164 | * were acked. |
165 | */ | 165 | */ |
166 | struct u64_stats_sync syncp; /* protects 64bit vars (cf tcp_get_info()) */ | ||
167 | |||
166 | u32 snd_una; /* First byte we want an ack for */ | 168 | u32 snd_una; /* First byte we want an ack for */ |
167 | u32 snd_sml; /* Last byte of the most recently transmitted small packet */ | 169 | u32 snd_sml; /* Last byte of the most recently transmitted small packet */ |
168 | u32 rcv_tstamp; /* timestamp of last received ACK (for keepalives) */ | 170 | u32 rcv_tstamp; /* timestamp of last received ACK (for keepalives) */ |
diff --git a/include/linux/tty.h b/include/linux/tty.h index fe5623c9af71..d76631f615c2 100644 --- a/include/linux/tty.h +++ b/include/linux/tty.h | |||
@@ -339,6 +339,7 @@ struct tty_file_private { | |||
339 | #define TTY_EXCLUSIVE 3 /* Exclusive open mode */ | 339 | #define TTY_EXCLUSIVE 3 /* Exclusive open mode */ |
340 | #define TTY_DEBUG 4 /* Debugging */ | 340 | #define TTY_DEBUG 4 /* Debugging */ |
341 | #define TTY_DO_WRITE_WAKEUP 5 /* Call write_wakeup after queuing new */ | 341 | #define TTY_DO_WRITE_WAKEUP 5 /* Call write_wakeup after queuing new */ |
342 | #define TTY_OTHER_DONE 6 /* Closed pty has completed input processing */ | ||
342 | #define TTY_LDISC_OPEN 11 /* Line discipline is open */ | 343 | #define TTY_LDISC_OPEN 11 /* Line discipline is open */ |
343 | #define TTY_PTY_LOCK 16 /* pty private */ | 344 | #define TTY_PTY_LOCK 16 /* pty private */ |
344 | #define TTY_NO_WRITE_SPLIT 17 /* Preserve write boundaries to driver */ | 345 | #define TTY_NO_WRITE_SPLIT 17 /* Preserve write boundaries to driver */ |
@@ -462,7 +463,6 @@ extern int tty_hung_up_p(struct file *filp); | |||
462 | extern void do_SAK(struct tty_struct *tty); | 463 | extern void do_SAK(struct tty_struct *tty); |
463 | extern void __do_SAK(struct tty_struct *tty); | 464 | extern void __do_SAK(struct tty_struct *tty); |
464 | extern void no_tty(void); | 465 | extern void no_tty(void); |
465 | extern void tty_flush_to_ldisc(struct tty_struct *tty); | ||
466 | extern void tty_buffer_free_all(struct tty_port *port); | 466 | extern void tty_buffer_free_all(struct tty_port *port); |
467 | extern void tty_buffer_flush(struct tty_struct *tty, struct tty_ldisc *ld); | 467 | extern void tty_buffer_flush(struct tty_struct *tty, struct tty_ldisc *ld); |
468 | extern void tty_buffer_init(struct tty_port *port); | 468 | extern void tty_buffer_init(struct tty_port *port); |
diff --git a/include/linux/uidgid.h b/include/linux/uidgid.h index 0ee05da38899..03835522dfcb 100644 --- a/include/linux/uidgid.h +++ b/include/linux/uidgid.h | |||
@@ -109,12 +109,12 @@ static inline bool gid_lte(kgid_t left, kgid_t right) | |||
109 | 109 | ||
110 | static inline bool uid_valid(kuid_t uid) | 110 | static inline bool uid_valid(kuid_t uid) |
111 | { | 111 | { |
112 | return !uid_eq(uid, INVALID_UID); | 112 | return __kuid_val(uid) != (uid_t) -1; |
113 | } | 113 | } |
114 | 114 | ||
115 | static inline bool gid_valid(kgid_t gid) | 115 | static inline bool gid_valid(kgid_t gid) |
116 | { | 116 | { |
117 | return !gid_eq(gid, INVALID_GID); | 117 | return __kgid_val(gid) != (gid_t) -1; |
118 | } | 118 | } |
119 | 119 | ||
120 | #ifdef CONFIG_USER_NS | 120 | #ifdef CONFIG_USER_NS |
diff --git a/include/net/inet_connection_sock.h b/include/net/inet_connection_sock.h index 48a815823587..497bc14cdb85 100644 --- a/include/net/inet_connection_sock.h +++ b/include/net/inet_connection_sock.h | |||
@@ -129,9 +129,10 @@ struct inet_connection_sock { | |||
129 | 129 | ||
130 | u32 probe_timestamp; | 130 | u32 probe_timestamp; |
131 | } icsk_mtup; | 131 | } icsk_mtup; |
132 | u32 icsk_ca_priv[16]; | ||
133 | u32 icsk_user_timeout; | 132 | u32 icsk_user_timeout; |
134 | #define ICSK_CA_PRIV_SIZE (16 * sizeof(u32)) | 133 | |
134 | u64 icsk_ca_priv[64 / sizeof(u64)]; | ||
135 | #define ICSK_CA_PRIV_SIZE (8 * sizeof(u64)) | ||
135 | }; | 136 | }; |
136 | 137 | ||
137 | #define ICSK_TIME_RETRANS 1 /* Retransmit timer */ | 138 | #define ICSK_TIME_RETRANS 1 /* Retransmit timer */ |
diff --git a/include/uapi/linux/netfilter/nf_conntrack_tcp.h b/include/uapi/linux/netfilter/nf_conntrack_tcp.h index 9993a421201c..ef9f80f0f529 100644 --- a/include/uapi/linux/netfilter/nf_conntrack_tcp.h +++ b/include/uapi/linux/netfilter/nf_conntrack_tcp.h | |||
@@ -42,6 +42,9 @@ enum tcp_conntrack { | |||
42 | /* The field td_maxack has been set */ | 42 | /* The field td_maxack has been set */ |
43 | #define IP_CT_TCP_FLAG_MAXACK_SET 0x20 | 43 | #define IP_CT_TCP_FLAG_MAXACK_SET 0x20 |
44 | 44 | ||
45 | /* Marks possibility for expected RFC5961 challenge ACK */ | ||
46 | #define IP_CT_EXP_CHALLENGE_ACK 0x40 | ||
47 | |||
45 | struct nf_ct_tcp_flags { | 48 | struct nf_ct_tcp_flags { |
46 | __u8 flags; | 49 | __u8 flags; |
47 | __u8 mask; | 50 | __u8 mask; |
diff --git a/include/uapi/linux/rtnetlink.h b/include/uapi/linux/rtnetlink.h index 974db03f7b1a..17fb02f488da 100644 --- a/include/uapi/linux/rtnetlink.h +++ b/include/uapi/linux/rtnetlink.h | |||
@@ -337,7 +337,7 @@ struct rtnexthop { | |||
337 | #define RTNH_F_DEAD 1 /* Nexthop is dead (used by multipath) */ | 337 | #define RTNH_F_DEAD 1 /* Nexthop is dead (used by multipath) */ |
338 | #define RTNH_F_PERVASIVE 2 /* Do recursive gateway lookup */ | 338 | #define RTNH_F_PERVASIVE 2 /* Do recursive gateway lookup */ |
339 | #define RTNH_F_ONLINK 4 /* Gateway is forced on link */ | 339 | #define RTNH_F_ONLINK 4 /* Gateway is forced on link */ |
340 | #define RTNH_F_EXTERNAL 8 /* Route installed externally */ | 340 | #define RTNH_F_OFFLOAD 8 /* offloaded route */ |
341 | 341 | ||
342 | /* Macros to handle hexthops */ | 342 | /* Macros to handle hexthops */ |
343 | 343 | ||
diff --git a/include/xen/events.h b/include/xen/events.h index 5321cd9636e6..7d95fdf9cf3e 100644 --- a/include/xen/events.h +++ b/include/xen/events.h | |||
@@ -17,7 +17,7 @@ int bind_evtchn_to_irqhandler(unsigned int evtchn, | |||
17 | irq_handler_t handler, | 17 | irq_handler_t handler, |
18 | unsigned long irqflags, const char *devname, | 18 | unsigned long irqflags, const char *devname, |
19 | void *dev_id); | 19 | void *dev_id); |
20 | int bind_virq_to_irq(unsigned int virq, unsigned int cpu); | 20 | int bind_virq_to_irq(unsigned int virq, unsigned int cpu, bool percpu); |
21 | int bind_virq_to_irqhandler(unsigned int virq, unsigned int cpu, | 21 | int bind_virq_to_irqhandler(unsigned int virq, unsigned int cpu, |
22 | irq_handler_t handler, | 22 | irq_handler_t handler, |
23 | unsigned long irqflags, const char *devname, | 23 | unsigned long irqflags, const char *devname, |
diff --git a/kernel/events/core.c b/kernel/events/core.c index 81aa3a4ece9f..1a3bf48743ce 100644 --- a/kernel/events/core.c +++ b/kernel/events/core.c | |||
@@ -913,10 +913,30 @@ static void put_ctx(struct perf_event_context *ctx) | |||
913 | * Those places that change perf_event::ctx will hold both | 913 | * Those places that change perf_event::ctx will hold both |
914 | * perf_event_ctx::mutex of the 'old' and 'new' ctx value. | 914 | * perf_event_ctx::mutex of the 'old' and 'new' ctx value. |
915 | * | 915 | * |
916 | * Lock ordering is by mutex address. There is one other site where | 916 | * Lock ordering is by mutex address. There are two other sites where |
917 | * perf_event_context::mutex nests and that is put_event(). But remember that | 917 | * perf_event_context::mutex nests and those are: |
918 | * that is a parent<->child context relation, and migration does not affect | 918 | * |
919 | * children, therefore these two orderings should not interact. | 919 | * - perf_event_exit_task_context() [ child , 0 ] |
920 | * __perf_event_exit_task() | ||
921 | * sync_child_event() | ||
922 | * put_event() [ parent, 1 ] | ||
923 | * | ||
924 | * - perf_event_init_context() [ parent, 0 ] | ||
925 | * inherit_task_group() | ||
926 | * inherit_group() | ||
927 | * inherit_event() | ||
928 | * perf_event_alloc() | ||
929 | * perf_init_event() | ||
930 | * perf_try_init_event() [ child , 1 ] | ||
931 | * | ||
932 | * While it appears there is an obvious deadlock here -- the parent and child | ||
933 | * nesting levels are inverted between the two. This is in fact safe because | ||
934 | * life-time rules separate them. That is an exiting task cannot fork, and a | ||
935 | * spawning task cannot (yet) exit. | ||
936 | * | ||
937 | * But remember that that these are parent<->child context relations, and | ||
938 | * migration does not affect children, therefore these two orderings should not | ||
939 | * interact. | ||
920 | * | 940 | * |
921 | * The change in perf_event::ctx does not affect children (as claimed above) | 941 | * The change in perf_event::ctx does not affect children (as claimed above) |
922 | * because the sys_perf_event_open() case will install a new event and break | 942 | * because the sys_perf_event_open() case will install a new event and break |
@@ -3657,9 +3677,6 @@ static void perf_remove_from_owner(struct perf_event *event) | |||
3657 | } | 3677 | } |
3658 | } | 3678 | } |
3659 | 3679 | ||
3660 | /* | ||
3661 | * Called when the last reference to the file is gone. | ||
3662 | */ | ||
3663 | static void put_event(struct perf_event *event) | 3680 | static void put_event(struct perf_event *event) |
3664 | { | 3681 | { |
3665 | struct perf_event_context *ctx; | 3682 | struct perf_event_context *ctx; |
@@ -3697,6 +3714,9 @@ int perf_event_release_kernel(struct perf_event *event) | |||
3697 | } | 3714 | } |
3698 | EXPORT_SYMBOL_GPL(perf_event_release_kernel); | 3715 | EXPORT_SYMBOL_GPL(perf_event_release_kernel); |
3699 | 3716 | ||
3717 | /* | ||
3718 | * Called when the last reference to the file is gone. | ||
3719 | */ | ||
3700 | static int perf_release(struct inode *inode, struct file *file) | 3720 | static int perf_release(struct inode *inode, struct file *file) |
3701 | { | 3721 | { |
3702 | put_event(file->private_data); | 3722 | put_event(file->private_data); |
@@ -7364,7 +7384,12 @@ static int perf_try_init_event(struct pmu *pmu, struct perf_event *event) | |||
7364 | return -ENODEV; | 7384 | return -ENODEV; |
7365 | 7385 | ||
7366 | if (event->group_leader != event) { | 7386 | if (event->group_leader != event) { |
7367 | ctx = perf_event_ctx_lock(event->group_leader); | 7387 | /* |
7388 | * This ctx->mutex can nest when we're called through | ||
7389 | * inheritance. See the perf_event_ctx_lock_nested() comment. | ||
7390 | */ | ||
7391 | ctx = perf_event_ctx_lock_nested(event->group_leader, | ||
7392 | SINGLE_DEPTH_NESTING); | ||
7368 | BUG_ON(!ctx); | 7393 | BUG_ON(!ctx); |
7369 | } | 7394 | } |
7370 | 7395 | ||
diff --git a/kernel/locking/rtmutex.c b/kernel/locking/rtmutex.c index b73279367087..b025295f4966 100644 --- a/kernel/locking/rtmutex.c +++ b/kernel/locking/rtmutex.c | |||
@@ -265,15 +265,17 @@ struct task_struct *rt_mutex_get_top_task(struct task_struct *task) | |||
265 | } | 265 | } |
266 | 266 | ||
267 | /* | 267 | /* |
268 | * Called by sched_setscheduler() to check whether the priority change | 268 | * Called by sched_setscheduler() to get the priority which will be |
269 | * is overruled by a possible priority boosting. | 269 | * effective after the change. |
270 | */ | 270 | */ |
271 | int rt_mutex_check_prio(struct task_struct *task, int newprio) | 271 | int rt_mutex_get_effective_prio(struct task_struct *task, int newprio) |
272 | { | 272 | { |
273 | if (!task_has_pi_waiters(task)) | 273 | if (!task_has_pi_waiters(task)) |
274 | return 0; | 274 | return newprio; |
275 | 275 | ||
276 | return task_top_pi_waiter(task)->task->prio <= newprio; | 276 | if (task_top_pi_waiter(task)->task->prio <= newprio) |
277 | return task_top_pi_waiter(task)->task->prio; | ||
278 | return newprio; | ||
277 | } | 279 | } |
278 | 280 | ||
279 | /* | 281 | /* |
diff --git a/kernel/sched/core.c b/kernel/sched/core.c index fe22f7510bce..123673291ffb 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c | |||
@@ -3300,15 +3300,18 @@ static void __setscheduler_params(struct task_struct *p, | |||
3300 | 3300 | ||
3301 | /* Actually do priority change: must hold pi & rq lock. */ | 3301 | /* Actually do priority change: must hold pi & rq lock. */ |
3302 | static void __setscheduler(struct rq *rq, struct task_struct *p, | 3302 | static void __setscheduler(struct rq *rq, struct task_struct *p, |
3303 | const struct sched_attr *attr) | 3303 | const struct sched_attr *attr, bool keep_boost) |
3304 | { | 3304 | { |
3305 | __setscheduler_params(p, attr); | 3305 | __setscheduler_params(p, attr); |
3306 | 3306 | ||
3307 | /* | 3307 | /* |
3308 | * If we get here, there was no pi waiters boosting the | 3308 | * Keep a potential priority boosting if called from |
3309 | * task. It is safe to use the normal prio. | 3309 | * sched_setscheduler(). |
3310 | */ | 3310 | */ |
3311 | p->prio = normal_prio(p); | 3311 | if (keep_boost) |
3312 | p->prio = rt_mutex_get_effective_prio(p, normal_prio(p)); | ||
3313 | else | ||
3314 | p->prio = normal_prio(p); | ||
3312 | 3315 | ||
3313 | if (dl_prio(p->prio)) | 3316 | if (dl_prio(p->prio)) |
3314 | p->sched_class = &dl_sched_class; | 3317 | p->sched_class = &dl_sched_class; |
@@ -3408,7 +3411,7 @@ static int __sched_setscheduler(struct task_struct *p, | |||
3408 | int newprio = dl_policy(attr->sched_policy) ? MAX_DL_PRIO - 1 : | 3411 | int newprio = dl_policy(attr->sched_policy) ? MAX_DL_PRIO - 1 : |
3409 | MAX_RT_PRIO - 1 - attr->sched_priority; | 3412 | MAX_RT_PRIO - 1 - attr->sched_priority; |
3410 | int retval, oldprio, oldpolicy = -1, queued, running; | 3413 | int retval, oldprio, oldpolicy = -1, queued, running; |
3411 | int policy = attr->sched_policy; | 3414 | int new_effective_prio, policy = attr->sched_policy; |
3412 | unsigned long flags; | 3415 | unsigned long flags; |
3413 | const struct sched_class *prev_class; | 3416 | const struct sched_class *prev_class; |
3414 | struct rq *rq; | 3417 | struct rq *rq; |
@@ -3590,15 +3593,14 @@ change: | |||
3590 | oldprio = p->prio; | 3593 | oldprio = p->prio; |
3591 | 3594 | ||
3592 | /* | 3595 | /* |
3593 | * Special case for priority boosted tasks. | 3596 | * Take priority boosted tasks into account. If the new |
3594 | * | 3597 | * effective priority is unchanged, we just store the new |
3595 | * If the new priority is lower or equal (user space view) | ||
3596 | * than the current (boosted) priority, we just store the new | ||
3597 | * normal parameters and do not touch the scheduler class and | 3598 | * normal parameters and do not touch the scheduler class and |
3598 | * the runqueue. This will be done when the task deboost | 3599 | * the runqueue. This will be done when the task deboost |
3599 | * itself. | 3600 | * itself. |
3600 | */ | 3601 | */ |
3601 | if (rt_mutex_check_prio(p, newprio)) { | 3602 | new_effective_prio = rt_mutex_get_effective_prio(p, newprio); |
3603 | if (new_effective_prio == oldprio) { | ||
3602 | __setscheduler_params(p, attr); | 3604 | __setscheduler_params(p, attr); |
3603 | task_rq_unlock(rq, p, &flags); | 3605 | task_rq_unlock(rq, p, &flags); |
3604 | return 0; | 3606 | return 0; |
@@ -3612,7 +3614,7 @@ change: | |||
3612 | put_prev_task(rq, p); | 3614 | put_prev_task(rq, p); |
3613 | 3615 | ||
3614 | prev_class = p->sched_class; | 3616 | prev_class = p->sched_class; |
3615 | __setscheduler(rq, p, attr); | 3617 | __setscheduler(rq, p, attr, true); |
3616 | 3618 | ||
3617 | if (running) | 3619 | if (running) |
3618 | p->sched_class->set_curr_task(rq); | 3620 | p->sched_class->set_curr_task(rq); |
@@ -4387,10 +4389,7 @@ long __sched io_schedule_timeout(long timeout) | |||
4387 | long ret; | 4389 | long ret; |
4388 | 4390 | ||
4389 | current->in_iowait = 1; | 4391 | current->in_iowait = 1; |
4390 | if (old_iowait) | 4392 | blk_schedule_flush_plug(current); |
4391 | blk_schedule_flush_plug(current); | ||
4392 | else | ||
4393 | blk_flush_plug(current); | ||
4394 | 4393 | ||
4395 | delayacct_blkio_start(); | 4394 | delayacct_blkio_start(); |
4396 | rq = raw_rq(); | 4395 | rq = raw_rq(); |
@@ -6997,27 +6996,23 @@ static int cpuset_cpu_inactive(struct notifier_block *nfb, unsigned long action, | |||
6997 | unsigned long flags; | 6996 | unsigned long flags; |
6998 | long cpu = (long)hcpu; | 6997 | long cpu = (long)hcpu; |
6999 | struct dl_bw *dl_b; | 6998 | struct dl_bw *dl_b; |
6999 | bool overflow; | ||
7000 | int cpus; | ||
7000 | 7001 | ||
7001 | switch (action & ~CPU_TASKS_FROZEN) { | 7002 | switch (action) { |
7002 | case CPU_DOWN_PREPARE: | 7003 | case CPU_DOWN_PREPARE: |
7003 | /* explicitly allow suspend */ | 7004 | rcu_read_lock_sched(); |
7004 | if (!(action & CPU_TASKS_FROZEN)) { | 7005 | dl_b = dl_bw_of(cpu); |
7005 | bool overflow; | ||
7006 | int cpus; | ||
7007 | |||
7008 | rcu_read_lock_sched(); | ||
7009 | dl_b = dl_bw_of(cpu); | ||
7010 | 7006 | ||
7011 | raw_spin_lock_irqsave(&dl_b->lock, flags); | 7007 | raw_spin_lock_irqsave(&dl_b->lock, flags); |
7012 | cpus = dl_bw_cpus(cpu); | 7008 | cpus = dl_bw_cpus(cpu); |
7013 | overflow = __dl_overflow(dl_b, cpus, 0, 0); | 7009 | overflow = __dl_overflow(dl_b, cpus, 0, 0); |
7014 | raw_spin_unlock_irqrestore(&dl_b->lock, flags); | 7010 | raw_spin_unlock_irqrestore(&dl_b->lock, flags); |
7015 | 7011 | ||
7016 | rcu_read_unlock_sched(); | 7012 | rcu_read_unlock_sched(); |
7017 | 7013 | ||
7018 | if (overflow) | 7014 | if (overflow) |
7019 | return notifier_from_errno(-EBUSY); | 7015 | return notifier_from_errno(-EBUSY); |
7020 | } | ||
7021 | cpuset_update_active_cpus(false); | 7016 | cpuset_update_active_cpus(false); |
7022 | break; | 7017 | break; |
7023 | case CPU_DOWN_PREPARE_FROZEN: | 7018 | case CPU_DOWN_PREPARE_FROZEN: |
@@ -7346,7 +7341,7 @@ static void normalize_task(struct rq *rq, struct task_struct *p) | |||
7346 | queued = task_on_rq_queued(p); | 7341 | queued = task_on_rq_queued(p); |
7347 | if (queued) | 7342 | if (queued) |
7348 | dequeue_task(rq, p, 0); | 7343 | dequeue_task(rq, p, 0); |
7349 | __setscheduler(rq, p, &attr); | 7344 | __setscheduler(rq, p, &attr, false); |
7350 | if (queued) { | 7345 | if (queued) { |
7351 | enqueue_task(rq, p, 0); | 7346 | enqueue_task(rq, p, 0); |
7352 | resched_curr(rq); | 7347 | resched_curr(rq); |
diff --git a/kernel/watchdog.c b/kernel/watchdog.c index 2316f50b07a4..581a68a04c64 100644 --- a/kernel/watchdog.c +++ b/kernel/watchdog.c | |||
@@ -41,6 +41,8 @@ | |||
41 | #define NMI_WATCHDOG_ENABLED (1 << NMI_WATCHDOG_ENABLED_BIT) | 41 | #define NMI_WATCHDOG_ENABLED (1 << NMI_WATCHDOG_ENABLED_BIT) |
42 | #define SOFT_WATCHDOG_ENABLED (1 << SOFT_WATCHDOG_ENABLED_BIT) | 42 | #define SOFT_WATCHDOG_ENABLED (1 << SOFT_WATCHDOG_ENABLED_BIT) |
43 | 43 | ||
44 | static DEFINE_MUTEX(watchdog_proc_mutex); | ||
45 | |||
44 | #ifdef CONFIG_HARDLOCKUP_DETECTOR | 46 | #ifdef CONFIG_HARDLOCKUP_DETECTOR |
45 | static unsigned long __read_mostly watchdog_enabled = SOFT_WATCHDOG_ENABLED|NMI_WATCHDOG_ENABLED; | 47 | static unsigned long __read_mostly watchdog_enabled = SOFT_WATCHDOG_ENABLED|NMI_WATCHDOG_ENABLED; |
46 | #else | 48 | #else |
@@ -608,26 +610,36 @@ void watchdog_nmi_enable_all(void) | |||
608 | { | 610 | { |
609 | int cpu; | 611 | int cpu; |
610 | 612 | ||
611 | if (!watchdog_user_enabled) | 613 | mutex_lock(&watchdog_proc_mutex); |
612 | return; | 614 | |
615 | if (!(watchdog_enabled & NMI_WATCHDOG_ENABLED)) | ||
616 | goto unlock; | ||
613 | 617 | ||
614 | get_online_cpus(); | 618 | get_online_cpus(); |
615 | for_each_online_cpu(cpu) | 619 | for_each_online_cpu(cpu) |
616 | watchdog_nmi_enable(cpu); | 620 | watchdog_nmi_enable(cpu); |
617 | put_online_cpus(); | 621 | put_online_cpus(); |
622 | |||
623 | unlock: | ||
624 | mutex_unlock(&watchdog_proc_mutex); | ||
618 | } | 625 | } |
619 | 626 | ||
620 | void watchdog_nmi_disable_all(void) | 627 | void watchdog_nmi_disable_all(void) |
621 | { | 628 | { |
622 | int cpu; | 629 | int cpu; |
623 | 630 | ||
631 | mutex_lock(&watchdog_proc_mutex); | ||
632 | |||
624 | if (!watchdog_running) | 633 | if (!watchdog_running) |
625 | return; | 634 | goto unlock; |
626 | 635 | ||
627 | get_online_cpus(); | 636 | get_online_cpus(); |
628 | for_each_online_cpu(cpu) | 637 | for_each_online_cpu(cpu) |
629 | watchdog_nmi_disable(cpu); | 638 | watchdog_nmi_disable(cpu); |
630 | put_online_cpus(); | 639 | put_online_cpus(); |
640 | |||
641 | unlock: | ||
642 | mutex_unlock(&watchdog_proc_mutex); | ||
631 | } | 643 | } |
632 | #else | 644 | #else |
633 | static int watchdog_nmi_enable(unsigned int cpu) { return 0; } | 645 | static int watchdog_nmi_enable(unsigned int cpu) { return 0; } |
@@ -744,8 +756,6 @@ static int proc_watchdog_update(void) | |||
744 | 756 | ||
745 | } | 757 | } |
746 | 758 | ||
747 | static DEFINE_MUTEX(watchdog_proc_mutex); | ||
748 | |||
749 | /* | 759 | /* |
750 | * common function for watchdog, nmi_watchdog and soft_watchdog parameter | 760 | * common function for watchdog, nmi_watchdog and soft_watchdog parameter |
751 | * | 761 | * |
diff --git a/lib/rhashtable.c b/lib/rhashtable.c index 4936fc4d7f2c..ca66a0e32c8e 100644 --- a/lib/rhashtable.c +++ b/lib/rhashtable.c | |||
@@ -14,6 +14,7 @@ | |||
14 | * published by the Free Software Foundation. | 14 | * published by the Free Software Foundation. |
15 | */ | 15 | */ |
16 | 16 | ||
17 | #include <linux/atomic.h> | ||
17 | #include <linux/kernel.h> | 18 | #include <linux/kernel.h> |
18 | #include <linux/init.h> | 19 | #include <linux/init.h> |
19 | #include <linux/log2.h> | 20 | #include <linux/log2.h> |
@@ -446,6 +447,10 @@ int rhashtable_insert_slow(struct rhashtable *ht, const void *key, | |||
446 | if (key && rhashtable_lookup_fast(ht, key, ht->p)) | 447 | if (key && rhashtable_lookup_fast(ht, key, ht->p)) |
447 | goto exit; | 448 | goto exit; |
448 | 449 | ||
450 | err = -E2BIG; | ||
451 | if (unlikely(rht_grow_above_max(ht, tbl))) | ||
452 | goto exit; | ||
453 | |||
449 | err = -EAGAIN; | 454 | err = -EAGAIN; |
450 | if (rhashtable_check_elasticity(ht, tbl, hash) || | 455 | if (rhashtable_check_elasticity(ht, tbl, hash) || |
451 | rht_grow_above_100(ht, tbl)) | 456 | rht_grow_above_100(ht, tbl)) |
@@ -734,6 +739,12 @@ int rhashtable_init(struct rhashtable *ht, | |||
734 | if (params->max_size) | 739 | if (params->max_size) |
735 | ht->p.max_size = rounddown_pow_of_two(params->max_size); | 740 | ht->p.max_size = rounddown_pow_of_two(params->max_size); |
736 | 741 | ||
742 | if (params->insecure_max_entries) | ||
743 | ht->p.insecure_max_entries = | ||
744 | rounddown_pow_of_two(params->insecure_max_entries); | ||
745 | else | ||
746 | ht->p.insecure_max_entries = ht->p.max_size * 2; | ||
747 | |||
737 | ht->p.min_size = max(ht->p.min_size, HASH_MIN_SIZE); | 748 | ht->p.min_size = max(ht->p.min_size, HASH_MIN_SIZE); |
738 | 749 | ||
739 | /* The maximum (not average) chain length grows with the | 750 | /* The maximum (not average) chain length grows with the |
diff --git a/mm/kmemleak.c b/mm/kmemleak.c index 5405aff5a590..f0fe4f2c1fa7 100644 --- a/mm/kmemleak.c +++ b/mm/kmemleak.c | |||
@@ -115,7 +115,8 @@ | |||
115 | #define BYTES_PER_POINTER sizeof(void *) | 115 | #define BYTES_PER_POINTER sizeof(void *) |
116 | 116 | ||
117 | /* GFP bitmask for kmemleak internal allocations */ | 117 | /* GFP bitmask for kmemleak internal allocations */ |
118 | #define gfp_kmemleak_mask(gfp) (((gfp) & (GFP_KERNEL | GFP_ATOMIC)) | \ | 118 | #define gfp_kmemleak_mask(gfp) (((gfp) & (GFP_KERNEL | GFP_ATOMIC | \ |
119 | __GFP_NOACCOUNT)) | \ | ||
119 | __GFP_NORETRY | __GFP_NOMEMALLOC | \ | 120 | __GFP_NORETRY | __GFP_NOMEMALLOC | \ |
120 | __GFP_NOWARN) | 121 | __GFP_NOWARN) |
121 | 122 | ||
diff --git a/mm/mempolicy.c b/mm/mempolicy.c index ede26291d4aa..747743237d9f 100644 --- a/mm/mempolicy.c +++ b/mm/mempolicy.c | |||
@@ -2518,7 +2518,7 @@ static void __init check_numabalancing_enable(void) | |||
2518 | if (numabalancing_override) | 2518 | if (numabalancing_override) |
2519 | set_numabalancing_state(numabalancing_override == 1); | 2519 | set_numabalancing_state(numabalancing_override == 1); |
2520 | 2520 | ||
2521 | if (nr_node_ids > 1 && !numabalancing_override) { | 2521 | if (num_online_nodes() > 1 && !numabalancing_override) { |
2522 | pr_info("%s automatic NUMA balancing. " | 2522 | pr_info("%s automatic NUMA balancing. " |
2523 | "Configure with numa_balancing= or the " | 2523 | "Configure with numa_balancing= or the " |
2524 | "kernel.numa_balancing sysctl", | 2524 | "kernel.numa_balancing sysctl", |
diff --git a/mm/page_isolation.c b/mm/page_isolation.c index 755a42c76eb4..303c908790ef 100644 --- a/mm/page_isolation.c +++ b/mm/page_isolation.c | |||
@@ -101,7 +101,8 @@ void unset_migratetype_isolate(struct page *page, unsigned migratetype) | |||
101 | buddy_idx = __find_buddy_index(page_idx, order); | 101 | buddy_idx = __find_buddy_index(page_idx, order); |
102 | buddy = page + (buddy_idx - page_idx); | 102 | buddy = page + (buddy_idx - page_idx); |
103 | 103 | ||
104 | if (!is_migrate_isolate_page(buddy)) { | 104 | if (pfn_valid_within(page_to_pfn(buddy)) && |
105 | !is_migrate_isolate_page(buddy)) { | ||
105 | __isolate_free_page(page, order); | 106 | __isolate_free_page(page, order); |
106 | kernel_map_pages(page, (1 << order), 1); | 107 | kernel_map_pages(page, (1 << order), 1); |
107 | set_page_refcounted(page); | 108 | set_page_refcounted(page); |
diff --git a/net/8021q/vlan.c b/net/8021q/vlan.c index 98a30a5b8664..59555f0f8fc8 100644 --- a/net/8021q/vlan.c +++ b/net/8021q/vlan.c | |||
@@ -443,7 +443,7 @@ static int vlan_device_event(struct notifier_block *unused, unsigned long event, | |||
443 | case NETDEV_UP: | 443 | case NETDEV_UP: |
444 | /* Put all VLANs for this dev in the up state too. */ | 444 | /* Put all VLANs for this dev in the up state too. */ |
445 | vlan_group_for_each_dev(grp, i, vlandev) { | 445 | vlan_group_for_each_dev(grp, i, vlandev) { |
446 | flgs = vlandev->flags; | 446 | flgs = dev_get_flags(vlandev); |
447 | if (flgs & IFF_UP) | 447 | if (flgs & IFF_UP) |
448 | continue; | 448 | continue; |
449 | 449 | ||
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c index 4663c3dad3f5..c4802f3bd4c5 100644 --- a/net/bluetooth/hci_core.c +++ b/net/bluetooth/hci_core.c | |||
@@ -2854,9 +2854,11 @@ static void le_scan_disable_work_complete(struct hci_dev *hdev, u8 status, | |||
2854 | * state. If we were running both LE and BR/EDR inquiry | 2854 | * state. If we were running both LE and BR/EDR inquiry |
2855 | * simultaneously, and BR/EDR inquiry is already | 2855 | * simultaneously, and BR/EDR inquiry is already |
2856 | * finished, stop discovery, otherwise BR/EDR inquiry | 2856 | * finished, stop discovery, otherwise BR/EDR inquiry |
2857 | * will stop discovery when finished. | 2857 | * will stop discovery when finished. If we will resolve |
2858 | * remote device name, do not change discovery state. | ||
2858 | */ | 2859 | */ |
2859 | if (!test_bit(HCI_INQUIRY, &hdev->flags)) | 2860 | if (!test_bit(HCI_INQUIRY, &hdev->flags) && |
2861 | hdev->discovery.state != DISCOVERY_RESOLVING) | ||
2860 | hci_discovery_set_state(hdev, | 2862 | hci_discovery_set_state(hdev, |
2861 | DISCOVERY_STOPPED); | 2863 | DISCOVERY_STOPPED); |
2862 | } else { | 2864 | } else { |
diff --git a/net/bridge/br_multicast.c b/net/bridge/br_multicast.c index 2d69d5cab52f..d7e103e3538a 100644 --- a/net/bridge/br_multicast.c +++ b/net/bridge/br_multicast.c | |||
@@ -1069,7 +1069,7 @@ static int br_ip6_multicast_mld2_report(struct net_bridge *br, | |||
1069 | 1069 | ||
1070 | err = br_ip6_multicast_add_group(br, port, &grec->grec_mca, | 1070 | err = br_ip6_multicast_add_group(br, port, &grec->grec_mca, |
1071 | vid); | 1071 | vid); |
1072 | if (!err) | 1072 | if (err) |
1073 | break; | 1073 | break; |
1074 | } | 1074 | } |
1075 | 1075 | ||
diff --git a/net/bridge/br_netfilter.c b/net/bridge/br_netfilter.c index 1d2eb32d8270..46660a28feef 100644 --- a/net/bridge/br_netfilter.c +++ b/net/bridge/br_netfilter.c | |||
@@ -37,10 +37,6 @@ | |||
37 | #include <net/route.h> | 37 | #include <net/route.h> |
38 | #include <net/netfilter/br_netfilter.h> | 38 | #include <net/netfilter/br_netfilter.h> |
39 | 39 | ||
40 | #if IS_ENABLED(CONFIG_NF_CONNTRACK) | ||
41 | #include <net/netfilter/nf_conntrack.h> | ||
42 | #endif | ||
43 | |||
44 | #include <asm/uaccess.h> | 40 | #include <asm/uaccess.h> |
45 | #include "br_private.h" | 41 | #include "br_private.h" |
46 | #ifdef CONFIG_SYSCTL | 42 | #ifdef CONFIG_SYSCTL |
@@ -358,24 +354,15 @@ free_skb: | |||
358 | return 0; | 354 | return 0; |
359 | } | 355 | } |
360 | 356 | ||
361 | static bool dnat_took_place(const struct sk_buff *skb) | 357 | static bool daddr_was_changed(const struct sk_buff *skb, |
358 | const struct nf_bridge_info *nf_bridge) | ||
362 | { | 359 | { |
363 | #if IS_ENABLED(CONFIG_NF_CONNTRACK) | 360 | return ip_hdr(skb)->daddr != nf_bridge->ipv4_daddr; |
364 | enum ip_conntrack_info ctinfo; | ||
365 | struct nf_conn *ct; | ||
366 | |||
367 | ct = nf_ct_get(skb, &ctinfo); | ||
368 | if (!ct || nf_ct_is_untracked(ct)) | ||
369 | return false; | ||
370 | |||
371 | return test_bit(IPS_DST_NAT_BIT, &ct->status); | ||
372 | #else | ||
373 | return false; | ||
374 | #endif | ||
375 | } | 361 | } |
376 | 362 | ||
377 | /* This requires some explaining. If DNAT has taken place, | 363 | /* This requires some explaining. If DNAT has taken place, |
378 | * we will need to fix up the destination Ethernet address. | 364 | * we will need to fix up the destination Ethernet address. |
365 | * This is also true when SNAT takes place (for the reply direction). | ||
379 | * | 366 | * |
380 | * There are two cases to consider: | 367 | * There are two cases to consider: |
381 | * 1. The packet was DNAT'ed to a device in the same bridge | 368 | * 1. The packet was DNAT'ed to a device in the same bridge |
@@ -429,7 +416,7 @@ static int br_nf_pre_routing_finish(struct sock *sk, struct sk_buff *skb) | |||
429 | nf_bridge->pkt_otherhost = false; | 416 | nf_bridge->pkt_otherhost = false; |
430 | } | 417 | } |
431 | nf_bridge->mask ^= BRNF_NF_BRIDGE_PREROUTING; | 418 | nf_bridge->mask ^= BRNF_NF_BRIDGE_PREROUTING; |
432 | if (dnat_took_place(skb)) { | 419 | if (daddr_was_changed(skb, nf_bridge)) { |
433 | if ((err = ip_route_input(skb, iph->daddr, iph->saddr, iph->tos, dev))) { | 420 | if ((err = ip_route_input(skb, iph->daddr, iph->saddr, iph->tos, dev))) { |
434 | struct in_device *in_dev = __in_dev_get_rcu(dev); | 421 | struct in_device *in_dev = __in_dev_get_rcu(dev); |
435 | 422 | ||
@@ -640,6 +627,7 @@ static unsigned int br_nf_pre_routing(const struct nf_hook_ops *ops, | |||
640 | struct sk_buff *skb, | 627 | struct sk_buff *skb, |
641 | const struct nf_hook_state *state) | 628 | const struct nf_hook_state *state) |
642 | { | 629 | { |
630 | struct nf_bridge_info *nf_bridge; | ||
643 | struct net_bridge_port *p; | 631 | struct net_bridge_port *p; |
644 | struct net_bridge *br; | 632 | struct net_bridge *br; |
645 | __u32 len = nf_bridge_encap_header_len(skb); | 633 | __u32 len = nf_bridge_encap_header_len(skb); |
@@ -677,6 +665,9 @@ static unsigned int br_nf_pre_routing(const struct nf_hook_ops *ops, | |||
677 | if (!setup_pre_routing(skb)) | 665 | if (!setup_pre_routing(skb)) |
678 | return NF_DROP; | 666 | return NF_DROP; |
679 | 667 | ||
668 | nf_bridge = nf_bridge_info_get(skb); | ||
669 | nf_bridge->ipv4_daddr = ip_hdr(skb)->daddr; | ||
670 | |||
680 | skb->protocol = htons(ETH_P_IP); | 671 | skb->protocol = htons(ETH_P_IP); |
681 | 672 | ||
682 | NF_HOOK(NFPROTO_IPV4, NF_INET_PRE_ROUTING, state->sk, skb, | 673 | NF_HOOK(NFPROTO_IPV4, NF_INET_PRE_ROUTING, state->sk, skb, |
diff --git a/net/bridge/br_stp_timer.c b/net/bridge/br_stp_timer.c index 4fcaa67750fd..7caf7fae2d5b 100644 --- a/net/bridge/br_stp_timer.c +++ b/net/bridge/br_stp_timer.c | |||
@@ -97,7 +97,9 @@ static void br_forward_delay_timer_expired(unsigned long arg) | |||
97 | netif_carrier_on(br->dev); | 97 | netif_carrier_on(br->dev); |
98 | } | 98 | } |
99 | br_log_state(p); | 99 | br_log_state(p); |
100 | rcu_read_lock(); | ||
100 | br_ifinfo_notify(RTM_NEWLINK, p); | 101 | br_ifinfo_notify(RTM_NEWLINK, p); |
102 | rcu_read_unlock(); | ||
101 | spin_unlock(&br->lock); | 103 | spin_unlock(&br->lock); |
102 | } | 104 | } |
103 | 105 | ||
diff --git a/net/bridge/netfilter/ebtables.c b/net/bridge/netfilter/ebtables.c index 5149d9e71114..d5aba394ff6f 100644 --- a/net/bridge/netfilter/ebtables.c +++ b/net/bridge/netfilter/ebtables.c | |||
@@ -1117,6 +1117,8 @@ static int do_replace(struct net *net, const void __user *user, | |||
1117 | return -ENOMEM; | 1117 | return -ENOMEM; |
1118 | if (tmp.num_counters >= INT_MAX / sizeof(struct ebt_counter)) | 1118 | if (tmp.num_counters >= INT_MAX / sizeof(struct ebt_counter)) |
1119 | return -ENOMEM; | 1119 | return -ENOMEM; |
1120 | if (tmp.num_counters == 0) | ||
1121 | return -EINVAL; | ||
1120 | 1122 | ||
1121 | tmp.name[sizeof(tmp.name) - 1] = 0; | 1123 | tmp.name[sizeof(tmp.name) - 1] = 0; |
1122 | 1124 | ||
@@ -2159,6 +2161,8 @@ static int compat_copy_ebt_replace_from_user(struct ebt_replace *repl, | |||
2159 | return -ENOMEM; | 2161 | return -ENOMEM; |
2160 | if (tmp.num_counters >= INT_MAX / sizeof(struct ebt_counter)) | 2162 | if (tmp.num_counters >= INT_MAX / sizeof(struct ebt_counter)) |
2161 | return -ENOMEM; | 2163 | return -ENOMEM; |
2164 | if (tmp.num_counters == 0) | ||
2165 | return -EINVAL; | ||
2162 | 2166 | ||
2163 | memcpy(repl, &tmp, offsetof(struct ebt_replace, hook_entry)); | 2167 | memcpy(repl, &tmp, offsetof(struct ebt_replace, hook_entry)); |
2164 | 2168 | ||
diff --git a/net/core/ethtool.c b/net/core/ethtool.c index eb0c3ace7458..4f6a17ef0710 100644 --- a/net/core/ethtool.c +++ b/net/core/ethtool.c | |||
@@ -358,7 +358,15 @@ static int ethtool_get_settings(struct net_device *dev, void __user *useraddr) | |||
358 | int err; | 358 | int err; |
359 | struct ethtool_cmd cmd; | 359 | struct ethtool_cmd cmd; |
360 | 360 | ||
361 | err = __ethtool_get_settings(dev, &cmd); | 361 | if (!dev->ethtool_ops->get_settings) |
362 | return -EOPNOTSUPP; | ||
363 | |||
364 | if (copy_from_user(&cmd, useraddr, sizeof(cmd))) | ||
365 | return -EFAULT; | ||
366 | |||
367 | cmd.cmd = ETHTOOL_GSET; | ||
368 | |||
369 | err = dev->ethtool_ops->get_settings(dev, &cmd); | ||
362 | if (err < 0) | 370 | if (err < 0) |
363 | return err; | 371 | return err; |
364 | 372 | ||
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c index 141ccc357e2e..077b6d280371 100644 --- a/net/core/rtnetlink.c +++ b/net/core/rtnetlink.c | |||
@@ -2420,6 +2420,9 @@ void rtmsg_ifinfo(int type, struct net_device *dev, unsigned int change, | |||
2420 | { | 2420 | { |
2421 | struct sk_buff *skb; | 2421 | struct sk_buff *skb; |
2422 | 2422 | ||
2423 | if (dev->reg_state != NETREG_REGISTERED) | ||
2424 | return; | ||
2425 | |||
2423 | skb = rtmsg_ifinfo_build_skb(type, dev, change, flags); | 2426 | skb = rtmsg_ifinfo_build_skb(type, dev, change, flags); |
2424 | if (skb) | 2427 | if (skb) |
2425 | rtmsg_ifinfo_send(skb, dev, flags); | 2428 | rtmsg_ifinfo_send(skb, dev, flags); |
diff --git a/net/ipv4/fib_trie.c b/net/ipv4/fib_trie.c index 03444c6ae342..5a5d9bdeaeb4 100644 --- a/net/ipv4/fib_trie.c +++ b/net/ipv4/fib_trie.c | |||
@@ -1164,6 +1164,7 @@ int fib_table_insert(struct fib_table *tb, struct fib_config *cfg) | |||
1164 | state = fa->fa_state; | 1164 | state = fa->fa_state; |
1165 | new_fa->fa_state = state & ~FA_S_ACCESSED; | 1165 | new_fa->fa_state = state & ~FA_S_ACCESSED; |
1166 | new_fa->fa_slen = fa->fa_slen; | 1166 | new_fa->fa_slen = fa->fa_slen; |
1167 | new_fa->tb_id = tb->tb_id; | ||
1167 | 1168 | ||
1168 | err = switchdev_fib_ipv4_add(key, plen, fi, | 1169 | err = switchdev_fib_ipv4_add(key, plen, fi, |
1169 | new_fa->fa_tos, | 1170 | new_fa->fa_tos, |
@@ -1762,7 +1763,7 @@ void fib_table_flush_external(struct fib_table *tb) | |||
1762 | /* record local slen */ | 1763 | /* record local slen */ |
1763 | slen = fa->fa_slen; | 1764 | slen = fa->fa_slen; |
1764 | 1765 | ||
1765 | if (!fi || !(fi->fib_flags & RTNH_F_EXTERNAL)) | 1766 | if (!fi || !(fi->fib_flags & RTNH_F_OFFLOAD)) |
1766 | continue; | 1767 | continue; |
1767 | 1768 | ||
1768 | switchdev_fib_ipv4_del(n->key, KEYLENGTH - fa->fa_slen, | 1769 | switchdev_fib_ipv4_del(n->key, KEYLENGTH - fa->fa_slen, |
diff --git a/net/ipv4/netfilter/arp_tables.c b/net/ipv4/netfilter/arp_tables.c index 13bfe84bf3ca..a61200754f4b 100644 --- a/net/ipv4/netfilter/arp_tables.c +++ b/net/ipv4/netfilter/arp_tables.c | |||
@@ -1075,6 +1075,9 @@ static int do_replace(struct net *net, const void __user *user, | |||
1075 | /* overflow check */ | 1075 | /* overflow check */ |
1076 | if (tmp.num_counters >= INT_MAX / sizeof(struct xt_counters)) | 1076 | if (tmp.num_counters >= INT_MAX / sizeof(struct xt_counters)) |
1077 | return -ENOMEM; | 1077 | return -ENOMEM; |
1078 | if (tmp.num_counters == 0) | ||
1079 | return -EINVAL; | ||
1080 | |||
1078 | tmp.name[sizeof(tmp.name)-1] = 0; | 1081 | tmp.name[sizeof(tmp.name)-1] = 0; |
1079 | 1082 | ||
1080 | newinfo = xt_alloc_table_info(tmp.size); | 1083 | newinfo = xt_alloc_table_info(tmp.size); |
@@ -1499,6 +1502,9 @@ static int compat_do_replace(struct net *net, void __user *user, | |||
1499 | return -ENOMEM; | 1502 | return -ENOMEM; |
1500 | if (tmp.num_counters >= INT_MAX / sizeof(struct xt_counters)) | 1503 | if (tmp.num_counters >= INT_MAX / sizeof(struct xt_counters)) |
1501 | return -ENOMEM; | 1504 | return -ENOMEM; |
1505 | if (tmp.num_counters == 0) | ||
1506 | return -EINVAL; | ||
1507 | |||
1502 | tmp.name[sizeof(tmp.name)-1] = 0; | 1508 | tmp.name[sizeof(tmp.name)-1] = 0; |
1503 | 1509 | ||
1504 | newinfo = xt_alloc_table_info(tmp.size); | 1510 | newinfo = xt_alloc_table_info(tmp.size); |
diff --git a/net/ipv4/netfilter/ip_tables.c b/net/ipv4/netfilter/ip_tables.c index c69db7fa25ee..2d0e265fef6e 100644 --- a/net/ipv4/netfilter/ip_tables.c +++ b/net/ipv4/netfilter/ip_tables.c | |||
@@ -1262,6 +1262,9 @@ do_replace(struct net *net, const void __user *user, unsigned int len) | |||
1262 | /* overflow check */ | 1262 | /* overflow check */ |
1263 | if (tmp.num_counters >= INT_MAX / sizeof(struct xt_counters)) | 1263 | if (tmp.num_counters >= INT_MAX / sizeof(struct xt_counters)) |
1264 | return -ENOMEM; | 1264 | return -ENOMEM; |
1265 | if (tmp.num_counters == 0) | ||
1266 | return -EINVAL; | ||
1267 | |||
1265 | tmp.name[sizeof(tmp.name)-1] = 0; | 1268 | tmp.name[sizeof(tmp.name)-1] = 0; |
1266 | 1269 | ||
1267 | newinfo = xt_alloc_table_info(tmp.size); | 1270 | newinfo = xt_alloc_table_info(tmp.size); |
@@ -1809,6 +1812,9 @@ compat_do_replace(struct net *net, void __user *user, unsigned int len) | |||
1809 | return -ENOMEM; | 1812 | return -ENOMEM; |
1810 | if (tmp.num_counters >= INT_MAX / sizeof(struct xt_counters)) | 1813 | if (tmp.num_counters >= INT_MAX / sizeof(struct xt_counters)) |
1811 | return -ENOMEM; | 1814 | return -ENOMEM; |
1815 | if (tmp.num_counters == 0) | ||
1816 | return -EINVAL; | ||
1817 | |||
1812 | tmp.name[sizeof(tmp.name)-1] = 0; | 1818 | tmp.name[sizeof(tmp.name)-1] = 0; |
1813 | 1819 | ||
1814 | newinfo = xt_alloc_table_info(tmp.size); | 1820 | newinfo = xt_alloc_table_info(tmp.size); |
diff --git a/net/ipv4/route.c b/net/ipv4/route.c index 9e15f5ca4495..f6055984c307 100644 --- a/net/ipv4/route.c +++ b/net/ipv4/route.c | |||
@@ -900,6 +900,10 @@ static int ip_error(struct sk_buff *skb) | |||
900 | bool send; | 900 | bool send; |
901 | int code; | 901 | int code; |
902 | 902 | ||
903 | /* IP on this device is disabled. */ | ||
904 | if (!in_dev) | ||
905 | goto out; | ||
906 | |||
903 | net = dev_net(rt->dst.dev); | 907 | net = dev_net(rt->dst.dev); |
904 | if (!IN_DEV_FORWARD(in_dev)) { | 908 | if (!IN_DEV_FORWARD(in_dev)) { |
905 | switch (rt->dst.error) { | 909 | switch (rt->dst.error) { |
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c index 7f3e721b9e69..90afcec3f427 100644 --- a/net/ipv4/tcp.c +++ b/net/ipv4/tcp.c | |||
@@ -402,6 +402,7 @@ void tcp_init_sock(struct sock *sk) | |||
402 | tp->snd_ssthresh = TCP_INFINITE_SSTHRESH; | 402 | tp->snd_ssthresh = TCP_INFINITE_SSTHRESH; |
403 | tp->snd_cwnd_clamp = ~0; | 403 | tp->snd_cwnd_clamp = ~0; |
404 | tp->mss_cache = TCP_MSS_DEFAULT; | 404 | tp->mss_cache = TCP_MSS_DEFAULT; |
405 | u64_stats_init(&tp->syncp); | ||
405 | 406 | ||
406 | tp->reordering = sysctl_tcp_reordering; | 407 | tp->reordering = sysctl_tcp_reordering; |
407 | tcp_enable_early_retrans(tp); | 408 | tcp_enable_early_retrans(tp); |
@@ -2625,6 +2626,7 @@ void tcp_get_info(struct sock *sk, struct tcp_info *info) | |||
2625 | const struct tcp_sock *tp = tcp_sk(sk); | 2626 | const struct tcp_sock *tp = tcp_sk(sk); |
2626 | const struct inet_connection_sock *icsk = inet_csk(sk); | 2627 | const struct inet_connection_sock *icsk = inet_csk(sk); |
2627 | u32 now = tcp_time_stamp; | 2628 | u32 now = tcp_time_stamp; |
2629 | unsigned int start; | ||
2628 | u32 rate; | 2630 | u32 rate; |
2629 | 2631 | ||
2630 | memset(info, 0, sizeof(*info)); | 2632 | memset(info, 0, sizeof(*info)); |
@@ -2692,12 +2694,13 @@ void tcp_get_info(struct sock *sk, struct tcp_info *info) | |||
2692 | rate = READ_ONCE(sk->sk_max_pacing_rate); | 2694 | rate = READ_ONCE(sk->sk_max_pacing_rate); |
2693 | info->tcpi_max_pacing_rate = rate != ~0U ? rate : ~0ULL; | 2695 | info->tcpi_max_pacing_rate = rate != ~0U ? rate : ~0ULL; |
2694 | 2696 | ||
2695 | spin_lock_bh(&sk->sk_lock.slock); | 2697 | do { |
2696 | info->tcpi_bytes_acked = tp->bytes_acked; | 2698 | start = u64_stats_fetch_begin_irq(&tp->syncp); |
2697 | info->tcpi_bytes_received = tp->bytes_received; | 2699 | info->tcpi_bytes_acked = tp->bytes_acked; |
2700 | info->tcpi_bytes_received = tp->bytes_received; | ||
2701 | } while (u64_stats_fetch_retry_irq(&tp->syncp, start)); | ||
2698 | info->tcpi_segs_out = tp->segs_out; | 2702 | info->tcpi_segs_out = tp->segs_out; |
2699 | info->tcpi_segs_in = tp->segs_in; | 2703 | info->tcpi_segs_in = tp->segs_in; |
2700 | spin_unlock_bh(&sk->sk_lock.slock); | ||
2701 | } | 2704 | } |
2702 | EXPORT_SYMBOL_GPL(tcp_get_info); | 2705 | EXPORT_SYMBOL_GPL(tcp_get_info); |
2703 | 2706 | ||
diff --git a/net/ipv4/tcp_fastopen.c b/net/ipv4/tcp_fastopen.c index 3c673d5e6cff..46b087a27503 100644 --- a/net/ipv4/tcp_fastopen.c +++ b/net/ipv4/tcp_fastopen.c | |||
@@ -206,6 +206,10 @@ static bool tcp_fastopen_create_child(struct sock *sk, | |||
206 | skb_set_owner_r(skb2, child); | 206 | skb_set_owner_r(skb2, child); |
207 | __skb_queue_tail(&child->sk_receive_queue, skb2); | 207 | __skb_queue_tail(&child->sk_receive_queue, skb2); |
208 | tp->syn_data_acked = 1; | 208 | tp->syn_data_acked = 1; |
209 | |||
210 | /* u64_stats_update_begin(&tp->syncp) not needed here, | ||
211 | * as we certainly are not changing upper 32bit value (0) | ||
212 | */ | ||
209 | tp->bytes_received = end_seq - TCP_SKB_CB(skb)->seq - 1; | 213 | tp->bytes_received = end_seq - TCP_SKB_CB(skb)->seq - 1; |
210 | } else { | 214 | } else { |
211 | end_seq = TCP_SKB_CB(skb)->seq + 1; | 215 | end_seq = TCP_SKB_CB(skb)->seq + 1; |
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c index 40c435997e54..15c4536188a4 100644 --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c | |||
@@ -2695,16 +2695,21 @@ static void tcp_process_loss(struct sock *sk, int flag, bool is_dupack) | |||
2695 | struct tcp_sock *tp = tcp_sk(sk); | 2695 | struct tcp_sock *tp = tcp_sk(sk); |
2696 | bool recovered = !before(tp->snd_una, tp->high_seq); | 2696 | bool recovered = !before(tp->snd_una, tp->high_seq); |
2697 | 2697 | ||
2698 | if ((flag & FLAG_SND_UNA_ADVANCED) && | ||
2699 | tcp_try_undo_loss(sk, false)) | ||
2700 | return; | ||
2701 | |||
2698 | if (tp->frto) { /* F-RTO RFC5682 sec 3.1 (sack enhanced version). */ | 2702 | if (tp->frto) { /* F-RTO RFC5682 sec 3.1 (sack enhanced version). */ |
2699 | /* Step 3.b. A timeout is spurious if not all data are | 2703 | /* Step 3.b. A timeout is spurious if not all data are |
2700 | * lost, i.e., never-retransmitted data are (s)acked. | 2704 | * lost, i.e., never-retransmitted data are (s)acked. |
2701 | */ | 2705 | */ |
2702 | if (tcp_try_undo_loss(sk, flag & FLAG_ORIG_SACK_ACKED)) | 2706 | if ((flag & FLAG_ORIG_SACK_ACKED) && |
2707 | tcp_try_undo_loss(sk, true)) | ||
2703 | return; | 2708 | return; |
2704 | 2709 | ||
2705 | if (after(tp->snd_nxt, tp->high_seq) && | 2710 | if (after(tp->snd_nxt, tp->high_seq)) { |
2706 | (flag & FLAG_DATA_SACKED || is_dupack)) { | 2711 | if (flag & FLAG_DATA_SACKED || is_dupack) |
2707 | tp->frto = 0; /* Loss was real: 2nd part of step 3.a */ | 2712 | tp->frto = 0; /* Step 3.a. loss was real */ |
2708 | } else if (flag & FLAG_SND_UNA_ADVANCED && !recovered) { | 2713 | } else if (flag & FLAG_SND_UNA_ADVANCED && !recovered) { |
2709 | tp->high_seq = tp->snd_nxt; | 2714 | tp->high_seq = tp->snd_nxt; |
2710 | __tcp_push_pending_frames(sk, tcp_current_mss(sk), | 2715 | __tcp_push_pending_frames(sk, tcp_current_mss(sk), |
@@ -2729,8 +2734,6 @@ static void tcp_process_loss(struct sock *sk, int flag, bool is_dupack) | |||
2729 | else if (flag & FLAG_SND_UNA_ADVANCED) | 2734 | else if (flag & FLAG_SND_UNA_ADVANCED) |
2730 | tcp_reset_reno_sack(tp); | 2735 | tcp_reset_reno_sack(tp); |
2731 | } | 2736 | } |
2732 | if (tcp_try_undo_loss(sk, false)) | ||
2733 | return; | ||
2734 | tcp_xmit_retransmit_queue(sk); | 2737 | tcp_xmit_retransmit_queue(sk); |
2735 | } | 2738 | } |
2736 | 2739 | ||
@@ -3281,7 +3284,9 @@ static void tcp_snd_una_update(struct tcp_sock *tp, u32 ack) | |||
3281 | { | 3284 | { |
3282 | u32 delta = ack - tp->snd_una; | 3285 | u32 delta = ack - tp->snd_una; |
3283 | 3286 | ||
3287 | u64_stats_update_begin(&tp->syncp); | ||
3284 | tp->bytes_acked += delta; | 3288 | tp->bytes_acked += delta; |
3289 | u64_stats_update_end(&tp->syncp); | ||
3285 | tp->snd_una = ack; | 3290 | tp->snd_una = ack; |
3286 | } | 3291 | } |
3287 | 3292 | ||
@@ -3290,7 +3295,9 @@ static void tcp_rcv_nxt_update(struct tcp_sock *tp, u32 seq) | |||
3290 | { | 3295 | { |
3291 | u32 delta = seq - tp->rcv_nxt; | 3296 | u32 delta = seq - tp->rcv_nxt; |
3292 | 3297 | ||
3298 | u64_stats_update_begin(&tp->syncp); | ||
3293 | tp->bytes_received += delta; | 3299 | tp->bytes_received += delta; |
3300 | u64_stats_update_end(&tp->syncp); | ||
3294 | tp->rcv_nxt = seq; | 3301 | tp->rcv_nxt = seq; |
3295 | } | 3302 | } |
3296 | 3303 | ||
diff --git a/net/ipv4/tcp_minisocks.c b/net/ipv4/tcp_minisocks.c index b62d15c86946..df7fe3c31162 100644 --- a/net/ipv4/tcp_minisocks.c +++ b/net/ipv4/tcp_minisocks.c | |||
@@ -300,7 +300,7 @@ void tcp_time_wait(struct sock *sk, int state, int timeo) | |||
300 | tw->tw_v6_daddr = sk->sk_v6_daddr; | 300 | tw->tw_v6_daddr = sk->sk_v6_daddr; |
301 | tw->tw_v6_rcv_saddr = sk->sk_v6_rcv_saddr; | 301 | tw->tw_v6_rcv_saddr = sk->sk_v6_rcv_saddr; |
302 | tw->tw_tclass = np->tclass; | 302 | tw->tw_tclass = np->tclass; |
303 | tw->tw_flowlabel = np->flow_label >> 12; | 303 | tw->tw_flowlabel = be32_to_cpu(np->flow_label & IPV6_FLOWLABEL_MASK); |
304 | tw->tw_ipv6only = sk->sk_ipv6only; | 304 | tw->tw_ipv6only = sk->sk_ipv6only; |
305 | } | 305 | } |
306 | #endif | 306 | #endif |
diff --git a/net/ipv6/ip6_fib.c b/net/ipv6/ip6_fib.c index 96dbffff5a24..bde57b113009 100644 --- a/net/ipv6/ip6_fib.c +++ b/net/ipv6/ip6_fib.c | |||
@@ -693,6 +693,7 @@ static int fib6_add_rt2node(struct fib6_node *fn, struct rt6_info *rt, | |||
693 | { | 693 | { |
694 | struct rt6_info *iter = NULL; | 694 | struct rt6_info *iter = NULL; |
695 | struct rt6_info **ins; | 695 | struct rt6_info **ins; |
696 | struct rt6_info **fallback_ins = NULL; | ||
696 | int replace = (info->nlh && | 697 | int replace = (info->nlh && |
697 | (info->nlh->nlmsg_flags & NLM_F_REPLACE)); | 698 | (info->nlh->nlmsg_flags & NLM_F_REPLACE)); |
698 | int add = (!info->nlh || | 699 | int add = (!info->nlh || |
@@ -716,8 +717,13 @@ static int fib6_add_rt2node(struct fib6_node *fn, struct rt6_info *rt, | |||
716 | (info->nlh->nlmsg_flags & NLM_F_EXCL)) | 717 | (info->nlh->nlmsg_flags & NLM_F_EXCL)) |
717 | return -EEXIST; | 718 | return -EEXIST; |
718 | if (replace) { | 719 | if (replace) { |
719 | found++; | 720 | if (rt_can_ecmp == rt6_qualify_for_ecmp(iter)) { |
720 | break; | 721 | found++; |
722 | break; | ||
723 | } | ||
724 | if (rt_can_ecmp) | ||
725 | fallback_ins = fallback_ins ?: ins; | ||
726 | goto next_iter; | ||
721 | } | 727 | } |
722 | 728 | ||
723 | if (iter->dst.dev == rt->dst.dev && | 729 | if (iter->dst.dev == rt->dst.dev && |
@@ -753,9 +759,17 @@ static int fib6_add_rt2node(struct fib6_node *fn, struct rt6_info *rt, | |||
753 | if (iter->rt6i_metric > rt->rt6i_metric) | 759 | if (iter->rt6i_metric > rt->rt6i_metric) |
754 | break; | 760 | break; |
755 | 761 | ||
762 | next_iter: | ||
756 | ins = &iter->dst.rt6_next; | 763 | ins = &iter->dst.rt6_next; |
757 | } | 764 | } |
758 | 765 | ||
766 | if (fallback_ins && !found) { | ||
767 | /* No ECMP-able route found, replace first non-ECMP one */ | ||
768 | ins = fallback_ins; | ||
769 | iter = *ins; | ||
770 | found++; | ||
771 | } | ||
772 | |||
759 | /* Reset round-robin state, if necessary */ | 773 | /* Reset round-robin state, if necessary */ |
760 | if (ins == &fn->leaf) | 774 | if (ins == &fn->leaf) |
761 | fn->rr_ptr = NULL; | 775 | fn->rr_ptr = NULL; |
@@ -815,6 +829,8 @@ add: | |||
815 | } | 829 | } |
816 | 830 | ||
817 | } else { | 831 | } else { |
832 | int nsiblings; | ||
833 | |||
818 | if (!found) { | 834 | if (!found) { |
819 | if (add) | 835 | if (add) |
820 | goto add; | 836 | goto add; |
@@ -835,8 +851,27 @@ add: | |||
835 | info->nl_net->ipv6.rt6_stats->fib_route_nodes++; | 851 | info->nl_net->ipv6.rt6_stats->fib_route_nodes++; |
836 | fn->fn_flags |= RTN_RTINFO; | 852 | fn->fn_flags |= RTN_RTINFO; |
837 | } | 853 | } |
854 | nsiblings = iter->rt6i_nsiblings; | ||
838 | fib6_purge_rt(iter, fn, info->nl_net); | 855 | fib6_purge_rt(iter, fn, info->nl_net); |
839 | rt6_release(iter); | 856 | rt6_release(iter); |
857 | |||
858 | if (nsiblings) { | ||
859 | /* Replacing an ECMP route, remove all siblings */ | ||
860 | ins = &rt->dst.rt6_next; | ||
861 | iter = *ins; | ||
862 | while (iter) { | ||
863 | if (rt6_qualify_for_ecmp(iter)) { | ||
864 | *ins = iter->dst.rt6_next; | ||
865 | fib6_purge_rt(iter, fn, info->nl_net); | ||
866 | rt6_release(iter); | ||
867 | nsiblings--; | ||
868 | } else { | ||
869 | ins = &iter->dst.rt6_next; | ||
870 | } | ||
871 | iter = *ins; | ||
872 | } | ||
873 | WARN_ON(nsiblings != 0); | ||
874 | } | ||
840 | } | 875 | } |
841 | 876 | ||
842 | return 0; | 877 | return 0; |
diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c index c21777565c58..bc09cb97b840 100644 --- a/net/ipv6/ip6_output.c +++ b/net/ipv6/ip6_output.c | |||
@@ -1300,8 +1300,10 @@ emsgsize: | |||
1300 | 1300 | ||
1301 | /* If this is the first and only packet and device | 1301 | /* If this is the first and only packet and device |
1302 | * supports checksum offloading, let's use it. | 1302 | * supports checksum offloading, let's use it. |
1303 | * Use transhdrlen, same as IPv4, because partial | ||
1304 | * sums only work when transhdrlen is set. | ||
1303 | */ | 1305 | */ |
1304 | if (!skb && sk->sk_protocol == IPPROTO_UDP && | 1306 | if (transhdrlen && sk->sk_protocol == IPPROTO_UDP && |
1305 | length + fragheaderlen < mtu && | 1307 | length + fragheaderlen < mtu && |
1306 | rt->dst.dev->features & NETIF_F_V6_CSUM && | 1308 | rt->dst.dev->features & NETIF_F_V6_CSUM && |
1307 | !exthdrlen) | 1309 | !exthdrlen) |
diff --git a/net/ipv6/netfilter/ip6_tables.c b/net/ipv6/netfilter/ip6_tables.c index 1a732a1d3c8e..62f5b0d0bc9b 100644 --- a/net/ipv6/netfilter/ip6_tables.c +++ b/net/ipv6/netfilter/ip6_tables.c | |||
@@ -1275,6 +1275,9 @@ do_replace(struct net *net, const void __user *user, unsigned int len) | |||
1275 | /* overflow check */ | 1275 | /* overflow check */ |
1276 | if (tmp.num_counters >= INT_MAX / sizeof(struct xt_counters)) | 1276 | if (tmp.num_counters >= INT_MAX / sizeof(struct xt_counters)) |
1277 | return -ENOMEM; | 1277 | return -ENOMEM; |
1278 | if (tmp.num_counters == 0) | ||
1279 | return -EINVAL; | ||
1280 | |||
1278 | tmp.name[sizeof(tmp.name)-1] = 0; | 1281 | tmp.name[sizeof(tmp.name)-1] = 0; |
1279 | 1282 | ||
1280 | newinfo = xt_alloc_table_info(tmp.size); | 1283 | newinfo = xt_alloc_table_info(tmp.size); |
@@ -1822,6 +1825,9 @@ compat_do_replace(struct net *net, void __user *user, unsigned int len) | |||
1822 | return -ENOMEM; | 1825 | return -ENOMEM; |
1823 | if (tmp.num_counters >= INT_MAX / sizeof(struct xt_counters)) | 1826 | if (tmp.num_counters >= INT_MAX / sizeof(struct xt_counters)) |
1824 | return -ENOMEM; | 1827 | return -ENOMEM; |
1828 | if (tmp.num_counters == 0) | ||
1829 | return -EINVAL; | ||
1830 | |||
1825 | tmp.name[sizeof(tmp.name)-1] = 0; | 1831 | tmp.name[sizeof(tmp.name)-1] = 0; |
1826 | 1832 | ||
1827 | newinfo = xt_alloc_table_info(tmp.size); | 1833 | newinfo = xt_alloc_table_info(tmp.size); |
diff --git a/net/ipv6/route.c b/net/ipv6/route.c index 98fce6f4a580..0c889cb89cc3 100644 --- a/net/ipv6/route.c +++ b/net/ipv6/route.c | |||
@@ -2515,9 +2515,9 @@ static int ip6_route_multipath(struct fib6_config *cfg, int add) | |||
2515 | int attrlen; | 2515 | int attrlen; |
2516 | int err = 0, last_err = 0; | 2516 | int err = 0, last_err = 0; |
2517 | 2517 | ||
2518 | remaining = cfg->fc_mp_len; | ||
2518 | beginning: | 2519 | beginning: |
2519 | rtnh = (struct rtnexthop *)cfg->fc_mp; | 2520 | rtnh = (struct rtnexthop *)cfg->fc_mp; |
2520 | remaining = cfg->fc_mp_len; | ||
2521 | 2521 | ||
2522 | /* Parse a Multipath Entry */ | 2522 | /* Parse a Multipath Entry */ |
2523 | while (rtnh_ok(rtnh, remaining)) { | 2523 | while (rtnh_ok(rtnh, remaining)) { |
@@ -2547,15 +2547,19 @@ beginning: | |||
2547 | * next hops that have been already added. | 2547 | * next hops that have been already added. |
2548 | */ | 2548 | */ |
2549 | add = 0; | 2549 | add = 0; |
2550 | remaining = cfg->fc_mp_len - remaining; | ||
2550 | goto beginning; | 2551 | goto beginning; |
2551 | } | 2552 | } |
2552 | } | 2553 | } |
2553 | /* Because each route is added like a single route we remove | 2554 | /* Because each route is added like a single route we remove |
2554 | * this flag after the first nexthop (if there is a collision, | 2555 | * these flags after the first nexthop: if there is a collision, |
2555 | * we have already fail to add the first nexthop: | 2556 | * we have already failed to add the first nexthop: |
2556 | * fib6_add_rt2node() has reject it). | 2557 | * fib6_add_rt2node() has rejected it; when replacing, old |
2558 | * nexthops have been replaced by first new, the rest should | ||
2559 | * be added to it. | ||
2557 | */ | 2560 | */ |
2558 | cfg->fc_nlinfo.nlh->nlmsg_flags &= ~NLM_F_EXCL; | 2561 | cfg->fc_nlinfo.nlh->nlmsg_flags &= ~(NLM_F_EXCL | |
2562 | NLM_F_REPLACE); | ||
2559 | rtnh = rtnh_next(rtnh, &remaining); | 2563 | rtnh = rtnh_next(rtnh, &remaining); |
2560 | } | 2564 | } |
2561 | 2565 | ||
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c index beac6bf840b9..fefe4455e1f3 100644 --- a/net/ipv6/tcp_ipv6.c +++ b/net/ipv6/tcp_ipv6.c | |||
@@ -914,7 +914,7 @@ static void tcp_v6_timewait_ack(struct sock *sk, struct sk_buff *skb) | |||
914 | tcptw->tw_rcv_wnd >> tw->tw_rcv_wscale, | 914 | tcptw->tw_rcv_wnd >> tw->tw_rcv_wscale, |
915 | tcp_time_stamp + tcptw->tw_ts_offset, | 915 | tcp_time_stamp + tcptw->tw_ts_offset, |
916 | tcptw->tw_ts_recent, tw->tw_bound_dev_if, tcp_twsk_md5_key(tcptw), | 916 | tcptw->tw_ts_recent, tw->tw_bound_dev_if, tcp_twsk_md5_key(tcptw), |
917 | tw->tw_tclass, (tw->tw_flowlabel << 12)); | 917 | tw->tw_tclass, cpu_to_be32(tw->tw_flowlabel)); |
918 | 918 | ||
919 | inet_twsk_put(tw); | 919 | inet_twsk_put(tw); |
920 | } | 920 | } |
diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c index 3477c919fcc8..c2ec41617a35 100644 --- a/net/ipv6/udp.c +++ b/net/ipv6/udp.c | |||
@@ -731,7 +731,9 @@ static bool __udp_v6_is_mcast_sock(struct net *net, struct sock *sk, | |||
731 | (inet->inet_dport && inet->inet_dport != rmt_port) || | 731 | (inet->inet_dport && inet->inet_dport != rmt_port) || |
732 | (!ipv6_addr_any(&sk->sk_v6_daddr) && | 732 | (!ipv6_addr_any(&sk->sk_v6_daddr) && |
733 | !ipv6_addr_equal(&sk->sk_v6_daddr, rmt_addr)) || | 733 | !ipv6_addr_equal(&sk->sk_v6_daddr, rmt_addr)) || |
734 | (sk->sk_bound_dev_if && sk->sk_bound_dev_if != dif)) | 734 | (sk->sk_bound_dev_if && sk->sk_bound_dev_if != dif) || |
735 | (!ipv6_addr_any(&sk->sk_v6_rcv_saddr) && | ||
736 | !ipv6_addr_equal(&sk->sk_v6_rcv_saddr, loc_addr))) | ||
735 | return false; | 737 | return false; |
736 | if (!inet6_mc_check(sk, loc_addr, rmt_addr)) | 738 | if (!inet6_mc_check(sk, loc_addr, rmt_addr)) |
737 | return false; | 739 | return false; |
diff --git a/net/mac80211/wep.c b/net/mac80211/wep.c index a4220e92f0cc..efa3f48f1ec5 100644 --- a/net/mac80211/wep.c +++ b/net/mac80211/wep.c | |||
@@ -98,8 +98,7 @@ static u8 *ieee80211_wep_add_iv(struct ieee80211_local *local, | |||
98 | 98 | ||
99 | hdr->frame_control |= cpu_to_le16(IEEE80211_FCTL_PROTECTED); | 99 | hdr->frame_control |= cpu_to_le16(IEEE80211_FCTL_PROTECTED); |
100 | 100 | ||
101 | if (WARN_ON(skb_tailroom(skb) < IEEE80211_WEP_ICV_LEN || | 101 | if (WARN_ON(skb_headroom(skb) < IEEE80211_WEP_IV_LEN)) |
102 | skb_headroom(skb) < IEEE80211_WEP_IV_LEN)) | ||
103 | return NULL; | 102 | return NULL; |
104 | 103 | ||
105 | hdrlen = ieee80211_hdrlen(hdr->frame_control); | 104 | hdrlen = ieee80211_hdrlen(hdr->frame_control); |
@@ -167,6 +166,9 @@ int ieee80211_wep_encrypt(struct ieee80211_local *local, | |||
167 | size_t len; | 166 | size_t len; |
168 | u8 rc4key[3 + WLAN_KEY_LEN_WEP104]; | 167 | u8 rc4key[3 + WLAN_KEY_LEN_WEP104]; |
169 | 168 | ||
169 | if (WARN_ON(skb_tailroom(skb) < IEEE80211_WEP_ICV_LEN)) | ||
170 | return -1; | ||
171 | |||
170 | iv = ieee80211_wep_add_iv(local, skb, keylen, keyidx); | 172 | iv = ieee80211_wep_add_iv(local, skb, keylen, keyidx); |
171 | if (!iv) | 173 | if (!iv) |
172 | return -1; | 174 | return -1; |
diff --git a/net/netfilter/Kconfig b/net/netfilter/Kconfig index db1c674397ad..1c78d7fb1da7 100644 --- a/net/netfilter/Kconfig +++ b/net/netfilter/Kconfig | |||
@@ -870,6 +870,7 @@ config NETFILTER_XT_TARGET_TPROXY | |||
870 | depends on NETFILTER_XTABLES | 870 | depends on NETFILTER_XTABLES |
871 | depends on NETFILTER_ADVANCED | 871 | depends on NETFILTER_ADVANCED |
872 | depends on (IPV6 || IPV6=n) | 872 | depends on (IPV6 || IPV6=n) |
873 | depends on (IP6_NF_IPTABLES || IP6_NF_IPTABLES=n) | ||
873 | depends on IP_NF_MANGLE | 874 | depends on IP_NF_MANGLE |
874 | select NF_DEFRAG_IPV4 | 875 | select NF_DEFRAG_IPV4 |
875 | select NF_DEFRAG_IPV6 if IP6_NF_IPTABLES | 876 | select NF_DEFRAG_IPV6 if IP6_NF_IPTABLES |
@@ -1363,6 +1364,7 @@ config NETFILTER_XT_MATCH_SOCKET | |||
1363 | depends on NETFILTER_ADVANCED | 1364 | depends on NETFILTER_ADVANCED |
1364 | depends on !NF_CONNTRACK || NF_CONNTRACK | 1365 | depends on !NF_CONNTRACK || NF_CONNTRACK |
1365 | depends on (IPV6 || IPV6=n) | 1366 | depends on (IPV6 || IPV6=n) |
1367 | depends on (IP6_NF_IPTABLES || IP6_NF_IPTABLES=n) | ||
1366 | select NF_DEFRAG_IPV4 | 1368 | select NF_DEFRAG_IPV4 |
1367 | select NF_DEFRAG_IPV6 if IP6_NF_IPTABLES | 1369 | select NF_DEFRAG_IPV6 if IP6_NF_IPTABLES |
1368 | help | 1370 | help |
diff --git a/net/netfilter/ipvs/ip_vs_ctl.c b/net/netfilter/ipvs/ip_vs_ctl.c index 49532672f66d..285eae3a1454 100644 --- a/net/netfilter/ipvs/ip_vs_ctl.c +++ b/net/netfilter/ipvs/ip_vs_ctl.c | |||
@@ -3823,6 +3823,9 @@ static void __net_exit ip_vs_control_net_cleanup_sysctl(struct net *net) | |||
3823 | cancel_work_sync(&ipvs->defense_work.work); | 3823 | cancel_work_sync(&ipvs->defense_work.work); |
3824 | unregister_net_sysctl_table(ipvs->sysctl_hdr); | 3824 | unregister_net_sysctl_table(ipvs->sysctl_hdr); |
3825 | ip_vs_stop_estimator(net, &ipvs->tot_stats); | 3825 | ip_vs_stop_estimator(net, &ipvs->tot_stats); |
3826 | |||
3827 | if (!net_eq(net, &init_net)) | ||
3828 | kfree(ipvs->sysctl_tbl); | ||
3826 | } | 3829 | } |
3827 | 3830 | ||
3828 | #else | 3831 | #else |
diff --git a/net/netfilter/nf_conntrack_proto_tcp.c b/net/netfilter/nf_conntrack_proto_tcp.c index 5caa0c41bf26..70383de72054 100644 --- a/net/netfilter/nf_conntrack_proto_tcp.c +++ b/net/netfilter/nf_conntrack_proto_tcp.c | |||
@@ -202,7 +202,7 @@ static const u8 tcp_conntracks[2][6][TCP_CONNTRACK_MAX] = { | |||
202 | * sES -> sES :-) | 202 | * sES -> sES :-) |
203 | * sFW -> sCW Normal close request answered by ACK. | 203 | * sFW -> sCW Normal close request answered by ACK. |
204 | * sCW -> sCW | 204 | * sCW -> sCW |
205 | * sLA -> sTW Last ACK detected. | 205 | * sLA -> sTW Last ACK detected (RFC5961 challenged) |
206 | * sTW -> sTW Retransmitted last ACK. Remain in the same state. | 206 | * sTW -> sTW Retransmitted last ACK. Remain in the same state. |
207 | * sCL -> sCL | 207 | * sCL -> sCL |
208 | */ | 208 | */ |
@@ -261,7 +261,7 @@ static const u8 tcp_conntracks[2][6][TCP_CONNTRACK_MAX] = { | |||
261 | * sES -> sES :-) | 261 | * sES -> sES :-) |
262 | * sFW -> sCW Normal close request answered by ACK. | 262 | * sFW -> sCW Normal close request answered by ACK. |
263 | * sCW -> sCW | 263 | * sCW -> sCW |
264 | * sLA -> sTW Last ACK detected. | 264 | * sLA -> sTW Last ACK detected (RFC5961 challenged) |
265 | * sTW -> sTW Retransmitted last ACK. | 265 | * sTW -> sTW Retransmitted last ACK. |
266 | * sCL -> sCL | 266 | * sCL -> sCL |
267 | */ | 267 | */ |
@@ -906,6 +906,7 @@ static int tcp_packet(struct nf_conn *ct, | |||
906 | 1 : ct->proto.tcp.last_win; | 906 | 1 : ct->proto.tcp.last_win; |
907 | ct->proto.tcp.seen[ct->proto.tcp.last_dir].td_scale = | 907 | ct->proto.tcp.seen[ct->proto.tcp.last_dir].td_scale = |
908 | ct->proto.tcp.last_wscale; | 908 | ct->proto.tcp.last_wscale; |
909 | ct->proto.tcp.last_flags &= ~IP_CT_EXP_CHALLENGE_ACK; | ||
909 | ct->proto.tcp.seen[ct->proto.tcp.last_dir].flags = | 910 | ct->proto.tcp.seen[ct->proto.tcp.last_dir].flags = |
910 | ct->proto.tcp.last_flags; | 911 | ct->proto.tcp.last_flags; |
911 | memset(&ct->proto.tcp.seen[dir], 0, | 912 | memset(&ct->proto.tcp.seen[dir], 0, |
@@ -923,7 +924,9 @@ static int tcp_packet(struct nf_conn *ct, | |||
923 | * may be in sync but we are not. In that case, we annotate | 924 | * may be in sync but we are not. In that case, we annotate |
924 | * the TCP options and let the packet go through. If it is a | 925 | * the TCP options and let the packet go through. If it is a |
925 | * valid SYN packet, the server will reply with a SYN/ACK, and | 926 | * valid SYN packet, the server will reply with a SYN/ACK, and |
926 | * then we'll get in sync. Otherwise, the server ignores it. */ | 927 | * then we'll get in sync. Otherwise, the server potentially |
928 | * responds with a challenge ACK if implementing RFC5961. | ||
929 | */ | ||
927 | if (index == TCP_SYN_SET && dir == IP_CT_DIR_ORIGINAL) { | 930 | if (index == TCP_SYN_SET && dir == IP_CT_DIR_ORIGINAL) { |
928 | struct ip_ct_tcp_state seen = {}; | 931 | struct ip_ct_tcp_state seen = {}; |
929 | 932 | ||
@@ -939,6 +942,13 @@ static int tcp_packet(struct nf_conn *ct, | |||
939 | ct->proto.tcp.last_flags |= | 942 | ct->proto.tcp.last_flags |= |
940 | IP_CT_TCP_FLAG_SACK_PERM; | 943 | IP_CT_TCP_FLAG_SACK_PERM; |
941 | } | 944 | } |
945 | /* Mark the potential for RFC5961 challenge ACK, | ||
946 | * this pose a special problem for LAST_ACK state | ||
947 | * as ACK is intrepretated as ACKing last FIN. | ||
948 | */ | ||
949 | if (old_state == TCP_CONNTRACK_LAST_ACK) | ||
950 | ct->proto.tcp.last_flags |= | ||
951 | IP_CT_EXP_CHALLENGE_ACK; | ||
942 | } | 952 | } |
943 | spin_unlock_bh(&ct->lock); | 953 | spin_unlock_bh(&ct->lock); |
944 | if (LOG_INVALID(net, IPPROTO_TCP)) | 954 | if (LOG_INVALID(net, IPPROTO_TCP)) |
@@ -970,6 +980,25 @@ static int tcp_packet(struct nf_conn *ct, | |||
970 | nf_log_packet(net, pf, 0, skb, NULL, NULL, NULL, | 980 | nf_log_packet(net, pf, 0, skb, NULL, NULL, NULL, |
971 | "nf_ct_tcp: invalid state "); | 981 | "nf_ct_tcp: invalid state "); |
972 | return -NF_ACCEPT; | 982 | return -NF_ACCEPT; |
983 | case TCP_CONNTRACK_TIME_WAIT: | ||
984 | /* RFC5961 compliance cause stack to send "challenge-ACK" | ||
985 | * e.g. in response to spurious SYNs. Conntrack MUST | ||
986 | * not believe this ACK is acking last FIN. | ||
987 | */ | ||
988 | if (old_state == TCP_CONNTRACK_LAST_ACK && | ||
989 | index == TCP_ACK_SET && | ||
990 | ct->proto.tcp.last_dir != dir && | ||
991 | ct->proto.tcp.last_index == TCP_SYN_SET && | ||
992 | (ct->proto.tcp.last_flags & IP_CT_EXP_CHALLENGE_ACK)) { | ||
993 | /* Detected RFC5961 challenge ACK */ | ||
994 | ct->proto.tcp.last_flags &= ~IP_CT_EXP_CHALLENGE_ACK; | ||
995 | spin_unlock_bh(&ct->lock); | ||
996 | if (LOG_INVALID(net, IPPROTO_TCP)) | ||
997 | nf_log_packet(net, pf, 0, skb, NULL, NULL, NULL, | ||
998 | "nf_ct_tcp: challenge-ACK ignored "); | ||
999 | return NF_ACCEPT; /* Don't change state */ | ||
1000 | } | ||
1001 | break; | ||
973 | case TCP_CONNTRACK_CLOSE: | 1002 | case TCP_CONNTRACK_CLOSE: |
974 | if (index == TCP_RST_SET | 1003 | if (index == TCP_RST_SET |
975 | && (ct->proto.tcp.seen[!dir].flags & IP_CT_TCP_FLAG_MAXACK_SET) | 1004 | && (ct->proto.tcp.seen[!dir].flags & IP_CT_TCP_FLAG_MAXACK_SET) |
diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c index ad9d11fb29fd..34ded09317e7 100644 --- a/net/netfilter/nf_tables_api.c +++ b/net/netfilter/nf_tables_api.c | |||
@@ -4472,9 +4472,9 @@ EXPORT_SYMBOL_GPL(nft_data_init); | |||
4472 | */ | 4472 | */ |
4473 | void nft_data_uninit(const struct nft_data *data, enum nft_data_types type) | 4473 | void nft_data_uninit(const struct nft_data *data, enum nft_data_types type) |
4474 | { | 4474 | { |
4475 | switch (type) { | 4475 | if (type < NFT_DATA_VERDICT) |
4476 | case NFT_DATA_VALUE: | ||
4477 | return; | 4476 | return; |
4477 | switch (type) { | ||
4478 | case NFT_DATA_VERDICT: | 4478 | case NFT_DATA_VERDICT: |
4479 | return nft_verdict_uninit(data); | 4479 | return nft_verdict_uninit(data); |
4480 | default: | 4480 | default: |
diff --git a/net/netfilter/nfnetlink_log.c b/net/netfilter/nfnetlink_log.c index 3ad91266c821..4ef1fae8445e 100644 --- a/net/netfilter/nfnetlink_log.c +++ b/net/netfilter/nfnetlink_log.c | |||
@@ -1073,7 +1073,13 @@ static struct pernet_operations nfnl_log_net_ops = { | |||
1073 | 1073 | ||
1074 | static int __init nfnetlink_log_init(void) | 1074 | static int __init nfnetlink_log_init(void) |
1075 | { | 1075 | { |
1076 | int status = -ENOMEM; | 1076 | int status; |
1077 | |||
1078 | status = register_pernet_subsys(&nfnl_log_net_ops); | ||
1079 | if (status < 0) { | ||
1080 | pr_err("failed to register pernet ops\n"); | ||
1081 | goto out; | ||
1082 | } | ||
1077 | 1083 | ||
1078 | netlink_register_notifier(&nfulnl_rtnl_notifier); | 1084 | netlink_register_notifier(&nfulnl_rtnl_notifier); |
1079 | status = nfnetlink_subsys_register(&nfulnl_subsys); | 1085 | status = nfnetlink_subsys_register(&nfulnl_subsys); |
@@ -1088,28 +1094,23 @@ static int __init nfnetlink_log_init(void) | |||
1088 | goto cleanup_subsys; | 1094 | goto cleanup_subsys; |
1089 | } | 1095 | } |
1090 | 1096 | ||
1091 | status = register_pernet_subsys(&nfnl_log_net_ops); | ||
1092 | if (status < 0) { | ||
1093 | pr_err("failed to register pernet ops\n"); | ||
1094 | goto cleanup_logger; | ||
1095 | } | ||
1096 | return status; | 1097 | return status; |
1097 | 1098 | ||
1098 | cleanup_logger: | ||
1099 | nf_log_unregister(&nfulnl_logger); | ||
1100 | cleanup_subsys: | 1099 | cleanup_subsys: |
1101 | nfnetlink_subsys_unregister(&nfulnl_subsys); | 1100 | nfnetlink_subsys_unregister(&nfulnl_subsys); |
1102 | cleanup_netlink_notifier: | 1101 | cleanup_netlink_notifier: |
1103 | netlink_unregister_notifier(&nfulnl_rtnl_notifier); | 1102 | netlink_unregister_notifier(&nfulnl_rtnl_notifier); |
1103 | unregister_pernet_subsys(&nfnl_log_net_ops); | ||
1104 | out: | ||
1104 | return status; | 1105 | return status; |
1105 | } | 1106 | } |
1106 | 1107 | ||
1107 | static void __exit nfnetlink_log_fini(void) | 1108 | static void __exit nfnetlink_log_fini(void) |
1108 | { | 1109 | { |
1109 | unregister_pernet_subsys(&nfnl_log_net_ops); | ||
1110 | nf_log_unregister(&nfulnl_logger); | 1110 | nf_log_unregister(&nfulnl_logger); |
1111 | nfnetlink_subsys_unregister(&nfulnl_subsys); | 1111 | nfnetlink_subsys_unregister(&nfulnl_subsys); |
1112 | netlink_unregister_notifier(&nfulnl_rtnl_notifier); | 1112 | netlink_unregister_notifier(&nfulnl_rtnl_notifier); |
1113 | unregister_pernet_subsys(&nfnl_log_net_ops); | ||
1113 | } | 1114 | } |
1114 | 1115 | ||
1115 | MODULE_DESCRIPTION("netfilter userspace logging"); | 1116 | MODULE_DESCRIPTION("netfilter userspace logging"); |
diff --git a/net/netfilter/nfnetlink_queue_core.c b/net/netfilter/nfnetlink_queue_core.c index bec7c60fe4d0..22a5ac76683e 100644 --- a/net/netfilter/nfnetlink_queue_core.c +++ b/net/netfilter/nfnetlink_queue_core.c | |||
@@ -1317,7 +1317,13 @@ static struct pernet_operations nfnl_queue_net_ops = { | |||
1317 | 1317 | ||
1318 | static int __init nfnetlink_queue_init(void) | 1318 | static int __init nfnetlink_queue_init(void) |
1319 | { | 1319 | { |
1320 | int status = -ENOMEM; | 1320 | int status; |
1321 | |||
1322 | status = register_pernet_subsys(&nfnl_queue_net_ops); | ||
1323 | if (status < 0) { | ||
1324 | pr_err("nf_queue: failed to register pernet ops\n"); | ||
1325 | goto out; | ||
1326 | } | ||
1321 | 1327 | ||
1322 | netlink_register_notifier(&nfqnl_rtnl_notifier); | 1328 | netlink_register_notifier(&nfqnl_rtnl_notifier); |
1323 | status = nfnetlink_subsys_register(&nfqnl_subsys); | 1329 | status = nfnetlink_subsys_register(&nfqnl_subsys); |
@@ -1326,19 +1332,13 @@ static int __init nfnetlink_queue_init(void) | |||
1326 | goto cleanup_netlink_notifier; | 1332 | goto cleanup_netlink_notifier; |
1327 | } | 1333 | } |
1328 | 1334 | ||
1329 | status = register_pernet_subsys(&nfnl_queue_net_ops); | ||
1330 | if (status < 0) { | ||
1331 | pr_err("nf_queue: failed to register pernet ops\n"); | ||
1332 | goto cleanup_subsys; | ||
1333 | } | ||
1334 | register_netdevice_notifier(&nfqnl_dev_notifier); | 1335 | register_netdevice_notifier(&nfqnl_dev_notifier); |
1335 | nf_register_queue_handler(&nfqh); | 1336 | nf_register_queue_handler(&nfqh); |
1336 | return status; | 1337 | return status; |
1337 | 1338 | ||
1338 | cleanup_subsys: | ||
1339 | nfnetlink_subsys_unregister(&nfqnl_subsys); | ||
1340 | cleanup_netlink_notifier: | 1339 | cleanup_netlink_notifier: |
1341 | netlink_unregister_notifier(&nfqnl_rtnl_notifier); | 1340 | netlink_unregister_notifier(&nfqnl_rtnl_notifier); |
1341 | out: | ||
1342 | return status; | 1342 | return status; |
1343 | } | 1343 | } |
1344 | 1344 | ||
@@ -1346,9 +1346,9 @@ static void __exit nfnetlink_queue_fini(void) | |||
1346 | { | 1346 | { |
1347 | nf_unregister_queue_handler(); | 1347 | nf_unregister_queue_handler(); |
1348 | unregister_netdevice_notifier(&nfqnl_dev_notifier); | 1348 | unregister_netdevice_notifier(&nfqnl_dev_notifier); |
1349 | unregister_pernet_subsys(&nfnl_queue_net_ops); | ||
1350 | nfnetlink_subsys_unregister(&nfqnl_subsys); | 1349 | nfnetlink_subsys_unregister(&nfqnl_subsys); |
1351 | netlink_unregister_notifier(&nfqnl_rtnl_notifier); | 1350 | netlink_unregister_notifier(&nfqnl_rtnl_notifier); |
1351 | unregister_pernet_subsys(&nfnl_queue_net_ops); | ||
1352 | 1352 | ||
1353 | rcu_barrier(); /* Wait for completion of call_rcu()'s */ | 1353 | rcu_barrier(); /* Wait for completion of call_rcu()'s */ |
1354 | } | 1354 | } |
diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c index 136056f0c62c..69d67c300b80 100644 --- a/net/netlink/af_netlink.c +++ b/net/netlink/af_netlink.c | |||
@@ -90,7 +90,7 @@ static inline int netlink_is_kernel(struct sock *sk) | |||
90 | return nlk_sk(sk)->flags & NETLINK_F_KERNEL_SOCKET; | 90 | return nlk_sk(sk)->flags & NETLINK_F_KERNEL_SOCKET; |
91 | } | 91 | } |
92 | 92 | ||
93 | struct netlink_table *nl_table; | 93 | struct netlink_table *nl_table __read_mostly; |
94 | EXPORT_SYMBOL_GPL(nl_table); | 94 | EXPORT_SYMBOL_GPL(nl_table); |
95 | 95 | ||
96 | static DECLARE_WAIT_QUEUE_HEAD(nl_table_wait); | 96 | static DECLARE_WAIT_QUEUE_HEAD(nl_table_wait); |
@@ -1083,6 +1083,7 @@ static int netlink_insert(struct sock *sk, u32 portid) | |||
1083 | if (err) { | 1083 | if (err) { |
1084 | if (err == -EEXIST) | 1084 | if (err == -EEXIST) |
1085 | err = -EADDRINUSE; | 1085 | err = -EADDRINUSE; |
1086 | nlk_sk(sk)->portid = 0; | ||
1086 | sock_put(sk); | 1087 | sock_put(sk); |
1087 | } | 1088 | } |
1088 | 1089 | ||
diff --git a/net/sched/cls_api.c b/net/sched/cls_api.c index b6ef9a04de06..a75864d93142 100644 --- a/net/sched/cls_api.c +++ b/net/sched/cls_api.c | |||
@@ -81,6 +81,11 @@ int unregister_tcf_proto_ops(struct tcf_proto_ops *ops) | |||
81 | struct tcf_proto_ops *t; | 81 | struct tcf_proto_ops *t; |
82 | int rc = -ENOENT; | 82 | int rc = -ENOENT; |
83 | 83 | ||
84 | /* Wait for outstanding call_rcu()s, if any, from a | ||
85 | * tcf_proto_ops's destroy() handler. | ||
86 | */ | ||
87 | rcu_barrier(); | ||
88 | |||
84 | write_lock(&cls_mod_lock); | 89 | write_lock(&cls_mod_lock); |
85 | list_for_each_entry(t, &tcf_proto_base, head) { | 90 | list_for_each_entry(t, &tcf_proto_base, head) { |
86 | if (t == ops) { | 91 | if (t == ops) { |
diff --git a/net/switchdev/switchdev.c b/net/switchdev/switchdev.c index d4c8cf828240..ac853acbe211 100644 --- a/net/switchdev/switchdev.c +++ b/net/switchdev/switchdev.c | |||
@@ -851,7 +851,7 @@ int switchdev_fib_ipv4_add(u32 dst, int dst_len, struct fib_info *fi, | |||
851 | 851 | ||
852 | err = switchdev_port_obj_add(dev, &fib_obj); | 852 | err = switchdev_port_obj_add(dev, &fib_obj); |
853 | if (!err) | 853 | if (!err) |
854 | fi->fib_flags |= RTNH_F_EXTERNAL; | 854 | fi->fib_flags |= RTNH_F_OFFLOAD; |
855 | 855 | ||
856 | return err; | 856 | return err; |
857 | } | 857 | } |
@@ -887,7 +887,7 @@ int switchdev_fib_ipv4_del(u32 dst, int dst_len, struct fib_info *fi, | |||
887 | struct net_device *dev; | 887 | struct net_device *dev; |
888 | int err = 0; | 888 | int err = 0; |
889 | 889 | ||
890 | if (!(fi->fib_flags & RTNH_F_EXTERNAL)) | 890 | if (!(fi->fib_flags & RTNH_F_OFFLOAD)) |
891 | return 0; | 891 | return 0; |
892 | 892 | ||
893 | dev = switchdev_get_dev_by_nhs(fi); | 893 | dev = switchdev_get_dev_by_nhs(fi); |
@@ -896,7 +896,7 @@ int switchdev_fib_ipv4_del(u32 dst, int dst_len, struct fib_info *fi, | |||
896 | 896 | ||
897 | err = switchdev_port_obj_del(dev, &fib_obj); | 897 | err = switchdev_port_obj_del(dev, &fib_obj); |
898 | if (!err) | 898 | if (!err) |
899 | fi->fib_flags &= ~RTNH_F_EXTERNAL; | 899 | fi->fib_flags &= ~RTNH_F_OFFLOAD; |
900 | 900 | ||
901 | return err; | 901 | return err; |
902 | } | 902 | } |
diff --git a/sound/atmel/ac97c.c b/sound/atmel/ac97c.c index cf4cedf2b420..6dad042630d8 100644 --- a/sound/atmel/ac97c.c +++ b/sound/atmel/ac97c.c | |||
@@ -916,7 +916,6 @@ static struct ac97c_platform_data *atmel_ac97c_probe_dt(struct device *dev) | |||
916 | { | 916 | { |
917 | struct ac97c_platform_data *pdata; | 917 | struct ac97c_platform_data *pdata; |
918 | struct device_node *node = dev->of_node; | 918 | struct device_node *node = dev->of_node; |
919 | const struct of_device_id *match; | ||
920 | 919 | ||
921 | if (!node) { | 920 | if (!node) { |
922 | dev_err(dev, "Device does not have associated DT data\n"); | 921 | dev_err(dev, "Device does not have associated DT data\n"); |
diff --git a/sound/core/pcm_lib.c b/sound/core/pcm_lib.c index ac6b33f3779c..7d45645f10ba 100644 --- a/sound/core/pcm_lib.c +++ b/sound/core/pcm_lib.c | |||
@@ -339,7 +339,7 @@ static int snd_pcm_update_hw_ptr0(struct snd_pcm_substream *substream, | |||
339 | if (delta > new_hw_ptr) { | 339 | if (delta > new_hw_ptr) { |
340 | /* check for double acknowledged interrupts */ | 340 | /* check for double acknowledged interrupts */ |
341 | hdelta = curr_jiffies - runtime->hw_ptr_jiffies; | 341 | hdelta = curr_jiffies - runtime->hw_ptr_jiffies; |
342 | if (hdelta > runtime->hw_ptr_buffer_jiffies/2) { | 342 | if (hdelta > runtime->hw_ptr_buffer_jiffies/2 + 1) { |
343 | hw_base += runtime->buffer_size; | 343 | hw_base += runtime->buffer_size; |
344 | if (hw_base >= runtime->boundary) { | 344 | if (hw_base >= runtime->boundary) { |
345 | hw_base = 0; | 345 | hw_base = 0; |
diff --git a/sound/pci/hda/hda_generic.c b/sound/pci/hda/hda_generic.c index 788f969b1a68..1c8678775f40 100644 --- a/sound/pci/hda/hda_generic.c +++ b/sound/pci/hda/hda_generic.c | |||
@@ -844,8 +844,16 @@ static hda_nid_t path_power_update(struct hda_codec *codec, | |||
844 | snd_hda_codec_write(codec, nid, 0, | 844 | snd_hda_codec_write(codec, nid, 0, |
845 | AC_VERB_SET_POWER_STATE, state); | 845 | AC_VERB_SET_POWER_STATE, state); |
846 | changed = nid; | 846 | changed = nid; |
847 | /* all known codecs seem to be capable to handl | ||
848 | * widgets state even in D3, so far. | ||
849 | * if any new codecs need to restore the widget | ||
850 | * states after D0 transition, call the function | ||
851 | * below. | ||
852 | */ | ||
853 | #if 0 /* disabled */ | ||
847 | if (state == AC_PWRST_D0) | 854 | if (state == AC_PWRST_D0) |
848 | snd_hdac_regmap_sync_node(&codec->core, nid); | 855 | snd_hdac_regmap_sync_node(&codec->core, nid); |
856 | #endif | ||
849 | } | 857 | } |
850 | } | 858 | } |
851 | return changed; | 859 | return changed; |
diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c index f8f0dfbef149..78b719b5b34d 100644 --- a/sound/pci/hda/patch_conexant.c +++ b/sound/pci/hda/patch_conexant.c | |||
@@ -968,6 +968,14 @@ static const struct hda_codec_preset snd_hda_preset_conexant[] = { | |||
968 | .patch = patch_conexant_auto }, | 968 | .patch = patch_conexant_auto }, |
969 | { .id = 0x14f150b9, .name = "CX20665", | 969 | { .id = 0x14f150b9, .name = "CX20665", |
970 | .patch = patch_conexant_auto }, | 970 | .patch = patch_conexant_auto }, |
971 | { .id = 0x14f150f1, .name = "CX20721", | ||
972 | .patch = patch_conexant_auto }, | ||
973 | { .id = 0x14f150f2, .name = "CX20722", | ||
974 | .patch = patch_conexant_auto }, | ||
975 | { .id = 0x14f150f3, .name = "CX20723", | ||
976 | .patch = patch_conexant_auto }, | ||
977 | { .id = 0x14f150f4, .name = "CX20724", | ||
978 | .patch = patch_conexant_auto }, | ||
971 | { .id = 0x14f1510f, .name = "CX20751/2", | 979 | { .id = 0x14f1510f, .name = "CX20751/2", |
972 | .patch = patch_conexant_auto }, | 980 | .patch = patch_conexant_auto }, |
973 | { .id = 0x14f15110, .name = "CX20751/2", | 981 | { .id = 0x14f15110, .name = "CX20751/2", |
@@ -1002,6 +1010,10 @@ MODULE_ALIAS("snd-hda-codec-id:14f150ab"); | |||
1002 | MODULE_ALIAS("snd-hda-codec-id:14f150ac"); | 1010 | MODULE_ALIAS("snd-hda-codec-id:14f150ac"); |
1003 | MODULE_ALIAS("snd-hda-codec-id:14f150b8"); | 1011 | MODULE_ALIAS("snd-hda-codec-id:14f150b8"); |
1004 | MODULE_ALIAS("snd-hda-codec-id:14f150b9"); | 1012 | MODULE_ALIAS("snd-hda-codec-id:14f150b9"); |
1013 | MODULE_ALIAS("snd-hda-codec-id:14f150f1"); | ||
1014 | MODULE_ALIAS("snd-hda-codec-id:14f150f2"); | ||
1015 | MODULE_ALIAS("snd-hda-codec-id:14f150f3"); | ||
1016 | MODULE_ALIAS("snd-hda-codec-id:14f150f4"); | ||
1005 | MODULE_ALIAS("snd-hda-codec-id:14f1510f"); | 1017 | MODULE_ALIAS("snd-hda-codec-id:14f1510f"); |
1006 | MODULE_ALIAS("snd-hda-codec-id:14f15110"); | 1018 | MODULE_ALIAS("snd-hda-codec-id:14f15110"); |
1007 | MODULE_ALIAS("snd-hda-codec-id:14f15111"); | 1019 | MODULE_ALIAS("snd-hda-codec-id:14f15111"); |
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index e2afd53cc14c..31f8f13be907 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c | |||
@@ -883,6 +883,7 @@ static struct alc_codec_rename_pci_table rename_pci_tbl[] = { | |||
883 | { 0x10ec0668, 0x1028, 0, "ALC3661" }, | 883 | { 0x10ec0668, 0x1028, 0, "ALC3661" }, |
884 | { 0x10ec0275, 0x1028, 0, "ALC3260" }, | 884 | { 0x10ec0275, 0x1028, 0, "ALC3260" }, |
885 | { 0x10ec0899, 0x1028, 0, "ALC3861" }, | 885 | { 0x10ec0899, 0x1028, 0, "ALC3861" }, |
886 | { 0x10ec0298, 0x1028, 0, "ALC3266" }, | ||
886 | { 0x10ec0670, 0x1025, 0, "ALC669X" }, | 887 | { 0x10ec0670, 0x1025, 0, "ALC669X" }, |
887 | { 0x10ec0676, 0x1025, 0, "ALC679X" }, | 888 | { 0x10ec0676, 0x1025, 0, "ALC679X" }, |
888 | { 0x10ec0282, 0x1043, 0, "ALC3229" }, | 889 | { 0x10ec0282, 0x1043, 0, "ALC3229" }, |
@@ -3673,6 +3674,10 @@ static void alc_headset_mode_mic_in(struct hda_codec *codec, hda_nid_t hp_pin, | |||
3673 | alc_process_coef_fw(codec, coef0293); | 3674 | alc_process_coef_fw(codec, coef0293); |
3674 | snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50); | 3675 | snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50); |
3675 | break; | 3676 | break; |
3677 | case 0x10ec0662: | ||
3678 | snd_hda_set_pin_ctl_cache(codec, hp_pin, 0); | ||
3679 | snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50); | ||
3680 | break; | ||
3676 | case 0x10ec0668: | 3681 | case 0x10ec0668: |
3677 | alc_write_coef_idx(codec, 0x11, 0x0001); | 3682 | alc_write_coef_idx(codec, 0x11, 0x0001); |
3678 | snd_hda_set_pin_ctl_cache(codec, hp_pin, 0); | 3683 | snd_hda_set_pin_ctl_cache(codec, hp_pin, 0); |
@@ -3738,7 +3743,6 @@ static void alc_headset_mode_default(struct hda_codec *codec) | |||
3738 | case 0x10ec0288: | 3743 | case 0x10ec0288: |
3739 | alc_process_coef_fw(codec, coef0288); | 3744 | alc_process_coef_fw(codec, coef0288); |
3740 | break; | 3745 | break; |
3741 | break; | ||
3742 | case 0x10ec0292: | 3746 | case 0x10ec0292: |
3743 | alc_process_coef_fw(codec, coef0292); | 3747 | alc_process_coef_fw(codec, coef0292); |
3744 | break; | 3748 | break; |
@@ -4012,7 +4016,7 @@ static void alc_update_headset_mode(struct hda_codec *codec) | |||
4012 | if (new_headset_mode != ALC_HEADSET_MODE_MIC) { | 4016 | if (new_headset_mode != ALC_HEADSET_MODE_MIC) { |
4013 | snd_hda_set_pin_ctl_cache(codec, hp_pin, | 4017 | snd_hda_set_pin_ctl_cache(codec, hp_pin, |
4014 | AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN); | 4018 | AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN); |
4015 | if (spec->headphone_mic_pin) | 4019 | if (spec->headphone_mic_pin && spec->headphone_mic_pin != hp_pin) |
4016 | snd_hda_set_pin_ctl_cache(codec, spec->headphone_mic_pin, | 4020 | snd_hda_set_pin_ctl_cache(codec, spec->headphone_mic_pin, |
4017 | PIN_VREFHIZ); | 4021 | PIN_VREFHIZ); |
4018 | } | 4022 | } |
@@ -4215,6 +4219,18 @@ static void alc_fixup_dell_xps13(struct hda_codec *codec, | |||
4215 | } | 4219 | } |
4216 | } | 4220 | } |
4217 | 4221 | ||
4222 | static void alc_fixup_headset_mode_alc662(struct hda_codec *codec, | ||
4223 | const struct hda_fixup *fix, int action) | ||
4224 | { | ||
4225 | struct alc_spec *spec = codec->spec; | ||
4226 | |||
4227 | if (action == HDA_FIXUP_ACT_PRE_PROBE) { | ||
4228 | spec->parse_flags |= HDA_PINCFG_HEADSET_MIC; | ||
4229 | spec->gen.hp_mic = 1; /* Mic-in is same pin as headphone */ | ||
4230 | } else | ||
4231 | alc_fixup_headset_mode(codec, fix, action); | ||
4232 | } | ||
4233 | |||
4218 | static void alc_fixup_headset_mode_alc668(struct hda_codec *codec, | 4234 | static void alc_fixup_headset_mode_alc668(struct hda_codec *codec, |
4219 | const struct hda_fixup *fix, int action) | 4235 | const struct hda_fixup *fix, int action) |
4220 | { | 4236 | { |
@@ -5119,6 +5135,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { | |||
5119 | SND_PCI_QUIRK(0x104d, 0x9099, "Sony VAIO S13", ALC275_FIXUP_SONY_DISABLE_AAMIX), | 5135 | SND_PCI_QUIRK(0x104d, 0x9099, "Sony VAIO S13", ALC275_FIXUP_SONY_DISABLE_AAMIX), |
5120 | SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook", ALC269_FIXUP_LIFEBOOK), | 5136 | SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook", ALC269_FIXUP_LIFEBOOK), |
5121 | SND_PCI_QUIRK(0x10cf, 0x15dc, "Lifebook T731", ALC269_FIXUP_LIFEBOOK_HP_PIN), | 5137 | SND_PCI_QUIRK(0x10cf, 0x15dc, "Lifebook T731", ALC269_FIXUP_LIFEBOOK_HP_PIN), |
5138 | SND_PCI_QUIRK(0x10cf, 0x1757, "Lifebook E752", ALC269_FIXUP_LIFEBOOK_HP_PIN), | ||
5122 | SND_PCI_QUIRK(0x10cf, 0x1845, "Lifebook U904", ALC269_FIXUP_LIFEBOOK_EXTMIC), | 5139 | SND_PCI_QUIRK(0x10cf, 0x1845, "Lifebook U904", ALC269_FIXUP_LIFEBOOK_EXTMIC), |
5123 | SND_PCI_QUIRK(0x144d, 0xc109, "Samsung Ativ book 9 (NP900X3G)", ALC269_FIXUP_INV_DMIC), | 5140 | SND_PCI_QUIRK(0x144d, 0xc109, "Samsung Ativ book 9 (NP900X3G)", ALC269_FIXUP_INV_DMIC), |
5124 | SND_PCI_QUIRK(0x1458, 0xfa53, "Gigabyte BXBT-2807", ALC283_FIXUP_BXBT2807_MIC), | 5141 | SND_PCI_QUIRK(0x1458, 0xfa53, "Gigabyte BXBT-2807", ALC283_FIXUP_BXBT2807_MIC), |
@@ -5148,6 +5165,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { | |||
5148 | SND_PCI_QUIRK(0x17aa, 0x5026, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST), | 5165 | SND_PCI_QUIRK(0x17aa, 0x5026, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST), |
5149 | SND_PCI_QUIRK(0x17aa, 0x5034, "Thinkpad T450", ALC292_FIXUP_TPT440_DOCK), | 5166 | SND_PCI_QUIRK(0x17aa, 0x5034, "Thinkpad T450", ALC292_FIXUP_TPT440_DOCK), |
5150 | SND_PCI_QUIRK(0x17aa, 0x5036, "Thinkpad T450s", ALC292_FIXUP_TPT440_DOCK), | 5167 | SND_PCI_QUIRK(0x17aa, 0x5036, "Thinkpad T450s", ALC292_FIXUP_TPT440_DOCK), |
5168 | SND_PCI_QUIRK(0x17aa, 0x503c, "Thinkpad L450", ALC292_FIXUP_TPT440_DOCK), | ||
5151 | SND_PCI_QUIRK(0x17aa, 0x5109, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST), | 5169 | SND_PCI_QUIRK(0x17aa, 0x5109, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST), |
5152 | SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_FIXUP_PCM_44K), | 5170 | SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_FIXUP_PCM_44K), |
5153 | SND_PCI_QUIRK(0x17aa, 0x9e54, "LENOVO NB", ALC269_FIXUP_LENOVO_EAPD), | 5171 | SND_PCI_QUIRK(0x17aa, 0x9e54, "LENOVO NB", ALC269_FIXUP_LENOVO_EAPD), |
@@ -5345,6 +5363,13 @@ static const struct snd_hda_pin_quirk alc269_pin_fixup_tbl[] = { | |||
5345 | {0x17, 0x40000000}, | 5363 | {0x17, 0x40000000}, |
5346 | {0x1d, 0x40700001}, | 5364 | {0x1d, 0x40700001}, |
5347 | {0x21, 0x02211050}), | 5365 | {0x21, 0x02211050}), |
5366 | SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell Inspiron 5548", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE, | ||
5367 | ALC255_STANDARD_PINS, | ||
5368 | {0x12, 0x90a60180}, | ||
5369 | {0x14, 0x90170130}, | ||
5370 | {0x17, 0x40000000}, | ||
5371 | {0x1d, 0x40700001}, | ||
5372 | {0x21, 0x02211040}), | ||
5348 | SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE, | 5373 | SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE, |
5349 | ALC256_STANDARD_PINS, | 5374 | ALC256_STANDARD_PINS, |
5350 | {0x13, 0x40000000}), | 5375 | {0x13, 0x40000000}), |
@@ -5598,7 +5623,8 @@ static int patch_alc269(struct hda_codec *codec) | |||
5598 | 5623 | ||
5599 | spec = codec->spec; | 5624 | spec = codec->spec; |
5600 | spec->gen.shared_mic_vref_pin = 0x18; | 5625 | spec->gen.shared_mic_vref_pin = 0x18; |
5601 | codec->power_save_node = 1; | 5626 | if (codec->core.vendor_id != 0x10ec0292) |
5627 | codec->power_save_node = 1; | ||
5602 | 5628 | ||
5603 | snd_hda_pick_fixup(codec, alc269_fixup_models, | 5629 | snd_hda_pick_fixup(codec, alc269_fixup_models, |
5604 | alc269_fixup_tbl, alc269_fixups); | 5630 | alc269_fixup_tbl, alc269_fixups); |
@@ -6079,7 +6105,9 @@ enum { | |||
6079 | ALC662_FIXUP_NO_JACK_DETECT, | 6105 | ALC662_FIXUP_NO_JACK_DETECT, |
6080 | ALC662_FIXUP_ZOTAC_Z68, | 6106 | ALC662_FIXUP_ZOTAC_Z68, |
6081 | ALC662_FIXUP_INV_DMIC, | 6107 | ALC662_FIXUP_INV_DMIC, |
6108 | ALC662_FIXUP_DELL_MIC_NO_PRESENCE, | ||
6082 | ALC668_FIXUP_DELL_MIC_NO_PRESENCE, | 6109 | ALC668_FIXUP_DELL_MIC_NO_PRESENCE, |
6110 | ALC662_FIXUP_HEADSET_MODE, | ||
6083 | ALC668_FIXUP_HEADSET_MODE, | 6111 | ALC668_FIXUP_HEADSET_MODE, |
6084 | ALC662_FIXUP_BASS_MODE4_CHMAP, | 6112 | ALC662_FIXUP_BASS_MODE4_CHMAP, |
6085 | ALC662_FIXUP_BASS_16, | 6113 | ALC662_FIXUP_BASS_16, |
@@ -6272,6 +6300,20 @@ static const struct hda_fixup alc662_fixups[] = { | |||
6272 | .chained = true, | 6300 | .chained = true, |
6273 | .chain_id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE | 6301 | .chain_id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE |
6274 | }, | 6302 | }, |
6303 | [ALC662_FIXUP_DELL_MIC_NO_PRESENCE] = { | ||
6304 | .type = HDA_FIXUP_PINS, | ||
6305 | .v.pins = (const struct hda_pintbl[]) { | ||
6306 | { 0x19, 0x03a1113c }, /* use as headset mic, without its own jack detect */ | ||
6307 | /* headphone mic by setting pin control of 0x1b (headphone out) to in + vref_50 */ | ||
6308 | { } | ||
6309 | }, | ||
6310 | .chained = true, | ||
6311 | .chain_id = ALC662_FIXUP_HEADSET_MODE | ||
6312 | }, | ||
6313 | [ALC662_FIXUP_HEADSET_MODE] = { | ||
6314 | .type = HDA_FIXUP_FUNC, | ||
6315 | .v.func = alc_fixup_headset_mode_alc662, | ||
6316 | }, | ||
6275 | [ALC668_FIXUP_DELL_MIC_NO_PRESENCE] = { | 6317 | [ALC668_FIXUP_DELL_MIC_NO_PRESENCE] = { |
6276 | .type = HDA_FIXUP_PINS, | 6318 | .type = HDA_FIXUP_PINS, |
6277 | .v.pins = (const struct hda_pintbl[]) { | 6319 | .v.pins = (const struct hda_pintbl[]) { |
@@ -6423,6 +6465,18 @@ static const struct hda_model_fixup alc662_fixup_models[] = { | |||
6423 | }; | 6465 | }; |
6424 | 6466 | ||
6425 | static const struct snd_hda_pin_quirk alc662_pin_fixup_tbl[] = { | 6467 | static const struct snd_hda_pin_quirk alc662_pin_fixup_tbl[] = { |
6468 | SND_HDA_PIN_QUIRK(0x10ec0662, 0x1028, "Dell", ALC662_FIXUP_DELL_MIC_NO_PRESENCE, | ||
6469 | {0x12, 0x4004c000}, | ||
6470 | {0x14, 0x01014010}, | ||
6471 | {0x15, 0x411111f0}, | ||
6472 | {0x16, 0x411111f0}, | ||
6473 | {0x18, 0x01a19020}, | ||
6474 | {0x19, 0x411111f0}, | ||
6475 | {0x1a, 0x0181302f}, | ||
6476 | {0x1b, 0x0221401f}, | ||
6477 | {0x1c, 0x411111f0}, | ||
6478 | {0x1d, 0x4054c601}, | ||
6479 | {0x1e, 0x411111f0}), | ||
6426 | SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE, | 6480 | SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE, |
6427 | {0x12, 0x99a30130}, | 6481 | {0x12, 0x99a30130}, |
6428 | {0x14, 0x90170110}, | 6482 | {0x14, 0x90170110}, |
diff --git a/sound/soc/codecs/mc13783.c b/sound/soc/codecs/mc13783.c index 2ffb9a0570dc..3d44fc50e4d0 100644 --- a/sound/soc/codecs/mc13783.c +++ b/sound/soc/codecs/mc13783.c | |||
@@ -623,14 +623,14 @@ static int mc13783_probe(struct snd_soc_codec *codec) | |||
623 | AUDIO_SSI_SEL, 0); | 623 | AUDIO_SSI_SEL, 0); |
624 | else | 624 | else |
625 | mc13xxx_reg_rmw(priv->mc13xxx, MC13783_AUDIO_CODEC, | 625 | mc13xxx_reg_rmw(priv->mc13xxx, MC13783_AUDIO_CODEC, |
626 | 0, AUDIO_SSI_SEL); | 626 | AUDIO_SSI_SEL, AUDIO_SSI_SEL); |
627 | 627 | ||
628 | if (priv->dac_ssi_port == MC13783_SSI1_PORT) | 628 | if (priv->dac_ssi_port == MC13783_SSI1_PORT) |
629 | mc13xxx_reg_rmw(priv->mc13xxx, MC13783_AUDIO_DAC, | 629 | mc13xxx_reg_rmw(priv->mc13xxx, MC13783_AUDIO_DAC, |
630 | AUDIO_SSI_SEL, 0); | 630 | AUDIO_SSI_SEL, 0); |
631 | else | 631 | else |
632 | mc13xxx_reg_rmw(priv->mc13xxx, MC13783_AUDIO_DAC, | 632 | mc13xxx_reg_rmw(priv->mc13xxx, MC13783_AUDIO_DAC, |
633 | 0, AUDIO_SSI_SEL); | 633 | AUDIO_SSI_SEL, AUDIO_SSI_SEL); |
634 | 634 | ||
635 | return 0; | 635 | return 0; |
636 | } | 636 | } |
diff --git a/sound/soc/codecs/uda1380.c b/sound/soc/codecs/uda1380.c index dc7778b6dd7f..c3c33bd0df1c 100644 --- a/sound/soc/codecs/uda1380.c +++ b/sound/soc/codecs/uda1380.c | |||
@@ -437,7 +437,7 @@ static int uda1380_set_dai_fmt_both(struct snd_soc_dai *codec_dai, | |||
437 | if ((fmt & SND_SOC_DAIFMT_MASTER_MASK) != SND_SOC_DAIFMT_CBS_CFS) | 437 | if ((fmt & SND_SOC_DAIFMT_MASTER_MASK) != SND_SOC_DAIFMT_CBS_CFS) |
438 | return -EINVAL; | 438 | return -EINVAL; |
439 | 439 | ||
440 | uda1380_write(codec, UDA1380_IFACE, iface); | 440 | uda1380_write_reg_cache(codec, UDA1380_IFACE, iface); |
441 | 441 | ||
442 | return 0; | 442 | return 0; |
443 | } | 443 | } |
diff --git a/sound/soc/codecs/wm8960.c b/sound/soc/codecs/wm8960.c index 3035d9856415..e97a7615df85 100644 --- a/sound/soc/codecs/wm8960.c +++ b/sound/soc/codecs/wm8960.c | |||
@@ -395,7 +395,7 @@ static const struct snd_soc_dapm_route audio_paths[] = { | |||
395 | { "Right Input Mixer", "Boost Switch", "Right Boost Mixer", }, | 395 | { "Right Input Mixer", "Boost Switch", "Right Boost Mixer", }, |
396 | { "Right Input Mixer", NULL, "RINPUT1", }, /* Really Boost Switch */ | 396 | { "Right Input Mixer", NULL, "RINPUT1", }, /* Really Boost Switch */ |
397 | { "Right Input Mixer", NULL, "RINPUT2" }, | 397 | { "Right Input Mixer", NULL, "RINPUT2" }, |
398 | { "Right Input Mixer", NULL, "LINPUT3" }, | 398 | { "Right Input Mixer", NULL, "RINPUT3" }, |
399 | 399 | ||
400 | { "Left ADC", NULL, "Left Input Mixer" }, | 400 | { "Left ADC", NULL, "Left Input Mixer" }, |
401 | { "Right ADC", NULL, "Right Input Mixer" }, | 401 | { "Right ADC", NULL, "Right Input Mixer" }, |
diff --git a/sound/soc/codecs/wm8994.c b/sound/soc/codecs/wm8994.c index 4fbc7689339a..a1c04dab6684 100644 --- a/sound/soc/codecs/wm8994.c +++ b/sound/soc/codecs/wm8994.c | |||
@@ -2754,7 +2754,7 @@ static struct { | |||
2754 | }; | 2754 | }; |
2755 | 2755 | ||
2756 | static int fs_ratios[] = { | 2756 | static int fs_ratios[] = { |
2757 | 64, 128, 192, 256, 348, 512, 768, 1024, 1408, 1536 | 2757 | 64, 128, 192, 256, 384, 512, 768, 1024, 1408, 1536 |
2758 | }; | 2758 | }; |
2759 | 2759 | ||
2760 | static int bclk_divs[] = { | 2760 | static int bclk_divs[] = { |
diff --git a/sound/soc/davinci/davinci-mcasp.c b/sound/soc/davinci/davinci-mcasp.c index bb4b78eada58..23c91fa65ab8 100644 --- a/sound/soc/davinci/davinci-mcasp.c +++ b/sound/soc/davinci/davinci-mcasp.c | |||
@@ -1247,7 +1247,7 @@ static int davinci_mcasp_suspend(struct snd_soc_dai *dai) | |||
1247 | u32 reg; | 1247 | u32 reg; |
1248 | int i; | 1248 | int i; |
1249 | 1249 | ||
1250 | context->pm_state = pm_runtime_enabled(mcasp->dev); | 1250 | context->pm_state = pm_runtime_active(mcasp->dev); |
1251 | if (!context->pm_state) | 1251 | if (!context->pm_state) |
1252 | pm_runtime_get_sync(mcasp->dev); | 1252 | pm_runtime_get_sync(mcasp->dev); |
1253 | 1253 | ||
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c index defe0f0082b5..158204d08924 100644 --- a/sound/soc/soc-dapm.c +++ b/sound/soc/soc-dapm.c | |||
@@ -3100,11 +3100,16 @@ snd_soc_dapm_new_control(struct snd_soc_dapm_context *dapm, | |||
3100 | } | 3100 | } |
3101 | 3101 | ||
3102 | prefix = soc_dapm_prefix(dapm); | 3102 | prefix = soc_dapm_prefix(dapm); |
3103 | if (prefix) | 3103 | if (prefix) { |
3104 | w->name = kasprintf(GFP_KERNEL, "%s %s", prefix, widget->name); | 3104 | w->name = kasprintf(GFP_KERNEL, "%s %s", prefix, widget->name); |
3105 | else | 3105 | if (widget->sname) |
3106 | w->sname = kasprintf(GFP_KERNEL, "%s %s", prefix, | ||
3107 | widget->sname); | ||
3108 | } else { | ||
3106 | w->name = kasprintf(GFP_KERNEL, "%s", widget->name); | 3109 | w->name = kasprintf(GFP_KERNEL, "%s", widget->name); |
3107 | 3110 | if (widget->sname) | |
3111 | w->sname = kasprintf(GFP_KERNEL, "%s", widget->sname); | ||
3112 | } | ||
3108 | if (w->name == NULL) { | 3113 | if (w->name == NULL) { |
3109 | kfree(w); | 3114 | kfree(w); |
3110 | return NULL; | 3115 | return NULL; |
diff --git a/sound/usb/quirks.c b/sound/usb/quirks.c index 7c5a70139278..46facfc9aec1 100644 --- a/sound/usb/quirks.c +++ b/sound/usb/quirks.c | |||
@@ -1117,6 +1117,7 @@ bool snd_usb_get_sample_rate_quirk(struct snd_usb_audio *chip) | |||
1117 | switch (chip->usb_id) { | 1117 | switch (chip->usb_id) { |
1118 | case USB_ID(0x045E, 0x075D): /* MS Lifecam Cinema */ | 1118 | case USB_ID(0x045E, 0x075D): /* MS Lifecam Cinema */ |
1119 | case USB_ID(0x045E, 0x076D): /* MS Lifecam HD-5000 */ | 1119 | case USB_ID(0x045E, 0x076D): /* MS Lifecam HD-5000 */ |
1120 | case USB_ID(0x045E, 0x0772): /* MS Lifecam Studio */ | ||
1120 | case USB_ID(0x04D8, 0xFEEA): /* Benchmark DAC1 Pre */ | 1121 | case USB_ID(0x04D8, 0xFEEA): /* Benchmark DAC1 Pre */ |
1121 | return true; | 1122 | return true; |
1122 | } | 1123 | } |
diff --git a/tools/lib/lockdep/Makefile b/tools/lib/lockdep/Makefile index 0c356fb65022..18ffccf00426 100644 --- a/tools/lib/lockdep/Makefile +++ b/tools/lib/lockdep/Makefile | |||
@@ -14,9 +14,10 @@ define allow-override | |||
14 | $(eval $(1) = $(2))) | 14 | $(eval $(1) = $(2))) |
15 | endef | 15 | endef |
16 | 16 | ||
17 | # Allow setting CC and AR, or setting CROSS_COMPILE as a prefix. | 17 | # Allow setting CC and AR and LD, or setting CROSS_COMPILE as a prefix. |
18 | $(call allow-override,CC,$(CROSS_COMPILE)gcc) | 18 | $(call allow-override,CC,$(CROSS_COMPILE)gcc) |
19 | $(call allow-override,AR,$(CROSS_COMPILE)ar) | 19 | $(call allow-override,AR,$(CROSS_COMPILE)ar) |
20 | $(call allow-override,LD,$(CROSS_COMPILE)ld) | ||
20 | 21 | ||
21 | INSTALL = install | 22 | INSTALL = install |
22 | 23 | ||
diff --git a/tools/lib/lockdep/uinclude/linux/kernel.h b/tools/lib/lockdep/uinclude/linux/kernel.h index a11e3c357be7..cd2cc59a5da7 100644 --- a/tools/lib/lockdep/uinclude/linux/kernel.h +++ b/tools/lib/lockdep/uinclude/linux/kernel.h | |||
@@ -28,6 +28,9 @@ | |||
28 | #define __init | 28 | #define __init |
29 | #define noinline | 29 | #define noinline |
30 | #define list_add_tail_rcu list_add_tail | 30 | #define list_add_tail_rcu list_add_tail |
31 | #define list_for_each_entry_rcu list_for_each_entry | ||
32 | #define barrier() | ||
33 | #define synchronize_sched() | ||
31 | 34 | ||
32 | #ifndef CALLER_ADDR0 | 35 | #ifndef CALLER_ADDR0 |
33 | #define CALLER_ADDR0 ((unsigned long)__builtin_return_address(0)) | 36 | #define CALLER_ADDR0 ((unsigned long)__builtin_return_address(0)) |
diff --git a/tools/perf/Makefile b/tools/perf/Makefile index c699dc35eef9..d31a7bbd7cee 100644 --- a/tools/perf/Makefile +++ b/tools/perf/Makefile | |||
@@ -24,7 +24,7 @@ unexport MAKEFLAGS | |||
24 | # (To override it, run 'make JOBS=1' and similar.) | 24 | # (To override it, run 'make JOBS=1' and similar.) |
25 | # | 25 | # |
26 | ifeq ($(JOBS),) | 26 | ifeq ($(JOBS),) |
27 | JOBS := $(shell egrep -c '^processor|^CPU' /proc/cpuinfo 2>/dev/null) | 27 | JOBS := $(shell (getconf _NPROCESSORS_ONLN || egrep -c '^processor|^CPU[0-9]' /proc/cpuinfo) 2>/dev/null) |
28 | ifeq ($(JOBS),0) | 28 | ifeq ($(JOBS),0) |
29 | JOBS := 1 | 29 | JOBS := 1 |
30 | endif | 30 | endif |
diff --git a/tools/testing/selftests/x86/Makefile b/tools/testing/selftests/x86/Makefile index ddf63569df5a..5bdb781163d1 100644 --- a/tools/testing/selftests/x86/Makefile +++ b/tools/testing/selftests/x86/Makefile | |||
@@ -1,4 +1,8 @@ | |||
1 | .PHONY: all all_32 all_64 check_build32 clean run_tests | 1 | all: |
2 | |||
3 | include ../lib.mk | ||
4 | |||
5 | .PHONY: all all_32 all_64 warn_32bit_failure clean | ||
2 | 6 | ||
3 | TARGETS_C_BOTHBITS := sigreturn single_step_syscall | 7 | TARGETS_C_BOTHBITS := sigreturn single_step_syscall |
4 | 8 | ||
@@ -7,42 +11,47 @@ BINARIES_64 := $(TARGETS_C_BOTHBITS:%=%_64) | |||
7 | 11 | ||
8 | CFLAGS := -O2 -g -std=gnu99 -pthread -Wall | 12 | CFLAGS := -O2 -g -std=gnu99 -pthread -Wall |
9 | 13 | ||
10 | UNAME_P := $(shell uname -p) | 14 | UNAME_M := $(shell uname -m) |
15 | CAN_BUILD_I386 := $(shell ./check_cc.sh $(CC) trivial_32bit_program.c -m32) | ||
16 | CAN_BUILD_X86_64 := $(shell ./check_cc.sh $(CC) trivial_64bit_program.c) | ||
11 | 17 | ||
12 | # Always build 32-bit tests | 18 | ifeq ($(CAN_BUILD_I386),1) |
13 | all: all_32 | 19 | all: all_32 |
20 | TEST_PROGS += $(BINARIES_32) | ||
21 | endif | ||
14 | 22 | ||
15 | # If we're on a 64-bit host, build 64-bit tests as well | 23 | ifeq ($(CAN_BUILD_X86_64),1) |
16 | ifeq ($(shell uname -p),x86_64) | ||
17 | all: all_64 | 24 | all: all_64 |
25 | TEST_PROGS += $(BINARIES_64) | ||
18 | endif | 26 | endif |
19 | 27 | ||
20 | all_32: check_build32 $(BINARIES_32) | 28 | all_32: $(BINARIES_32) |
21 | 29 | ||
22 | all_64: $(BINARIES_64) | 30 | all_64: $(BINARIES_64) |
23 | 31 | ||
24 | clean: | 32 | clean: |
25 | $(RM) $(BINARIES_32) $(BINARIES_64) | 33 | $(RM) $(BINARIES_32) $(BINARIES_64) |
26 | 34 | ||
27 | run_tests: | ||
28 | ./run_x86_tests.sh | ||
29 | |||
30 | $(TARGETS_C_BOTHBITS:%=%_32): %_32: %.c | 35 | $(TARGETS_C_BOTHBITS:%=%_32): %_32: %.c |
31 | $(CC) -m32 -o $@ $(CFLAGS) $(EXTRA_CFLAGS) $^ -lrt -ldl | 36 | $(CC) -m32 -o $@ $(CFLAGS) $(EXTRA_CFLAGS) $^ -lrt -ldl |
32 | 37 | ||
33 | $(TARGETS_C_BOTHBITS:%=%_64): %_64: %.c | 38 | $(TARGETS_C_BOTHBITS:%=%_64): %_64: %.c |
34 | $(CC) -m64 -o $@ $(CFLAGS) $(EXTRA_CFLAGS) $^ -lrt -ldl | 39 | $(CC) -m64 -o $@ $(CFLAGS) $(EXTRA_CFLAGS) $^ -lrt -ldl |
35 | 40 | ||
36 | check_build32: | 41 | # x86_64 users should be encouraged to install 32-bit libraries |
37 | @if ! $(CC) -m32 -o /dev/null trivial_32bit_program.c; then \ | 42 | ifeq ($(CAN_BUILD_I386)$(CAN_BUILD_X86_64),01) |
38 | echo "Warning: you seem to have a broken 32-bit build" 2>&1; \ | 43 | all: warn_32bit_failure |
39 | echo "environment. If you are using a Debian-like"; \ | 44 | |
40 | echo " distribution, try:"; \ | 45 | warn_32bit_failure: |
41 | echo ""; \ | 46 | @echo "Warning: you seem to have a broken 32-bit build" 2>&1; \ |
42 | echo " apt-get install gcc-multilib libc6-i386 libc6-dev-i386"; \ | 47 | echo "environment. This will reduce test coverage of 64-bit" 2>&1; \ |
43 | echo ""; \ | 48 | echo "kernels. If you are using a Debian-like distribution," 2>&1; \ |
44 | echo "If you are using a Fedora-like distribution, try:"; \ | 49 | echo "try:"; 2>&1; \ |
45 | echo ""; \ | 50 | echo ""; \ |
46 | echo " yum install glibc-devel.*i686"; \ | 51 | echo " apt-get install gcc-multilib libc6-i386 libc6-dev-i386"; \ |
47 | exit 1; \ | 52 | echo ""; \ |
48 | fi | 53 | echo "If you are using a Fedora-like distribution, try:"; \ |
54 | echo ""; \ | ||
55 | echo " yum install glibc-devel.*i686"; \ | ||
56 | exit 0; | ||
57 | endif | ||
diff --git a/tools/testing/selftests/x86/check_cc.sh b/tools/testing/selftests/x86/check_cc.sh new file mode 100755 index 000000000000..172d3293fb7b --- /dev/null +++ b/tools/testing/selftests/x86/check_cc.sh | |||
@@ -0,0 +1,16 @@ | |||
1 | #!/bin/sh | ||
2 | # check_cc.sh - Helper to test userspace compilation support | ||
3 | # Copyright (c) 2015 Andrew Lutomirski | ||
4 | # GPL v2 | ||
5 | |||
6 | CC="$1" | ||
7 | TESTPROG="$2" | ||
8 | shift 2 | ||
9 | |||
10 | if "$CC" -o /dev/null "$TESTPROG" -O0 "$@" 2>/dev/null; then | ||
11 | echo 1 | ||
12 | else | ||
13 | echo 0 | ||
14 | fi | ||
15 | |||
16 | exit 0 | ||
diff --git a/tools/testing/selftests/x86/run_x86_tests.sh b/tools/testing/selftests/x86/run_x86_tests.sh deleted file mode 100644 index 3fc19b376812..000000000000 --- a/tools/testing/selftests/x86/run_x86_tests.sh +++ /dev/null | |||
@@ -1,13 +0,0 @@ | |||
1 | #!/bin/bash | ||
2 | |||
3 | # This is deliberately minimal. IMO kselftests should provide a standard | ||
4 | # script here. | ||
5 | ./sigreturn_32 || exit 1 | ||
6 | ./single_step_syscall_32 || exit 1 | ||
7 | |||
8 | if [[ "$uname -p" -eq "x86_64" ]]; then | ||
9 | ./sigreturn_64 || exit 1 | ||
10 | ./single_step_syscall_64 || exit 1 | ||
11 | fi | ||
12 | |||
13 | exit 0 | ||
diff --git a/tools/testing/selftests/x86/trivial_32bit_program.c b/tools/testing/selftests/x86/trivial_32bit_program.c index 2e231beb0a39..fabdf0f51621 100644 --- a/tools/testing/selftests/x86/trivial_32bit_program.c +++ b/tools/testing/selftests/x86/trivial_32bit_program.c | |||
@@ -4,6 +4,10 @@ | |||
4 | * GPL v2 | 4 | * GPL v2 |
5 | */ | 5 | */ |
6 | 6 | ||
7 | #ifndef __i386__ | ||
8 | # error wrong architecture | ||
9 | #endif | ||
10 | |||
7 | #include <stdio.h> | 11 | #include <stdio.h> |
8 | 12 | ||
9 | int main() | 13 | int main() |
diff --git a/tools/testing/selftests/x86/trivial_64bit_program.c b/tools/testing/selftests/x86/trivial_64bit_program.c new file mode 100644 index 000000000000..b994946c40fb --- /dev/null +++ b/tools/testing/selftests/x86/trivial_64bit_program.c | |||
@@ -0,0 +1,18 @@ | |||
1 | /* | ||
2 | * Trivial program to check that we have a valid 32-bit build environment. | ||
3 | * Copyright (c) 2015 Andy Lutomirski | ||
4 | * GPL v2 | ||
5 | */ | ||
6 | |||
7 | #ifndef __x86_64__ | ||
8 | # error wrong architecture | ||
9 | #endif | ||
10 | |||
11 | #include <stdio.h> | ||
12 | |||
13 | int main() | ||
14 | { | ||
15 | printf("\n"); | ||
16 | |||
17 | return 0; | ||
18 | } | ||
diff --git a/tools/thermal/tmon/Makefile b/tools/thermal/tmon/Makefile index 0788621c8d76..2e83dd3655a2 100644 --- a/tools/thermal/tmon/Makefile +++ b/tools/thermal/tmon/Makefile | |||
@@ -12,10 +12,6 @@ TARGET=tmon | |||
12 | INSTALL_PROGRAM=install -m 755 -p | 12 | INSTALL_PROGRAM=install -m 755 -p |
13 | DEL_FILE=rm -f | 13 | DEL_FILE=rm -f |
14 | 14 | ||
15 | INSTALL_CONFIGFILE=install -m 644 -p | ||
16 | CONFIG_FILE= | ||
17 | CONFIG_PATH= | ||
18 | |||
19 | # Static builds might require -ltinfo, for instance | 15 | # Static builds might require -ltinfo, for instance |
20 | ifneq ($(findstring -static, $(LDFLAGS)),) | 16 | ifneq ($(findstring -static, $(LDFLAGS)),) |
21 | STATIC := --static | 17 | STATIC := --static |
@@ -38,13 +34,9 @@ valgrind: tmon | |||
38 | install: | 34 | install: |
39 | - mkdir -p $(INSTALL_ROOT)/$(BINDIR) | 35 | - mkdir -p $(INSTALL_ROOT)/$(BINDIR) |
40 | - $(INSTALL_PROGRAM) "$(TARGET)" "$(INSTALL_ROOT)/$(BINDIR)/$(TARGET)" | 36 | - $(INSTALL_PROGRAM) "$(TARGET)" "$(INSTALL_ROOT)/$(BINDIR)/$(TARGET)" |
41 | - mkdir -p $(INSTALL_ROOT)/$(CONFIG_PATH) | ||
42 | - $(INSTALL_CONFIGFILE) "$(CONFIG_FILE)" "$(INSTALL_ROOT)/$(CONFIG_PATH)" | ||
43 | 37 | ||
44 | uninstall: | 38 | uninstall: |
45 | $(DEL_FILE) "$(INSTALL_ROOT)/$(BINDIR)/$(TARGET)" | 39 | $(DEL_FILE) "$(INSTALL_ROOT)/$(BINDIR)/$(TARGET)" |
46 | $(CONFIG_FILE) "$(CONFIG_PATH)" | ||
47 | |||
48 | 40 | ||
49 | clean: | 41 | clean: |
50 | find . -name "*.o" | xargs $(DEL_FILE) | 42 | find . -name "*.o" | xargs $(DEL_FILE) |
diff --git a/tools/vm/Makefile b/tools/vm/Makefile index ac884b65a072..93aadaf7ff63 100644 --- a/tools/vm/Makefile +++ b/tools/vm/Makefile | |||
@@ -3,7 +3,7 @@ | |||
3 | TARGETS=page-types slabinfo page_owner_sort | 3 | TARGETS=page-types slabinfo page_owner_sort |
4 | 4 | ||
5 | LIB_DIR = ../lib/api | 5 | LIB_DIR = ../lib/api |
6 | LIBS = $(LIB_DIR)/libapikfs.a | 6 | LIBS = $(LIB_DIR)/libapi.a |
7 | 7 | ||
8 | CC = $(CROSS_COMPILE)gcc | 8 | CC = $(CROSS_COMPILE)gcc |
9 | CFLAGS = -Wall -Wextra -I../lib/ | 9 | CFLAGS = -Wall -Wextra -I../lib/ |