diff options
author | Jason Cooper <jason@lakedaemon.net> | 2013-04-15 10:55:23 -0400 |
---|---|---|
committer | Jason Cooper <jason@lakedaemon.net> | 2013-04-15 10:55:23 -0400 |
commit | b757f17e9184b65428c48a281d82f9acb3e96f0e (patch) | |
tree | 7dc22c9f82f78c20caeff00fdd68a2e92e40504a | |
parent | 3c76a8a95daeecd881718f88324041f6a5faab86 (diff) | |
parent | da497f6fbaa190d34907ecc9dd85cfc62ba9f5a2 (diff) |
Merge tag 'tags/soc_for_v3.10' into mvebu/dt
Pulling in mvebu branches which contain changes to armada*.dts? files for LPAE
conversion.
mvebu soc changes for v3.10
- use the mvebu-mbus driver
- prep for LPAE support
Depends:
- mvebu/cleanup (tags/cleanup_for_v3.10)
- mvebu/drivers (tags/drivers_for_v3.10)
668 files changed, 6910 insertions, 4090 deletions
@@ -1510,6 +1510,14 @@ D: Natsemi ethernet | |||
1510 | D: Cobalt Networks (x86) support | 1510 | D: Cobalt Networks (x86) support |
1511 | D: This-and-That | 1511 | D: This-and-That |
1512 | 1512 | ||
1513 | N: Mark M. Hoffman | ||
1514 | E: mhoffman@lightlink.com | ||
1515 | D: asb100, lm93 and smsc47b397 hardware monitoring drivers | ||
1516 | D: hwmon subsystem core | ||
1517 | D: hwmon subsystem maintainer | ||
1518 | D: i2c-sis96x and i2c-stub SMBus drivers | ||
1519 | S: USA | ||
1520 | |||
1513 | N: Dirk Hohndel | 1521 | N: Dirk Hohndel |
1514 | E: hohndel@suse.de | 1522 | E: hohndel@suse.de |
1515 | D: The XFree86[tm] Project | 1523 | D: The XFree86[tm] Project |
diff --git a/Documentation/devicetree/bindings/mfd/ab8500.txt b/Documentation/devicetree/bindings/mfd/ab8500.txt index 13b707b7355c..c3a14e0ad0ad 100644 --- a/Documentation/devicetree/bindings/mfd/ab8500.txt +++ b/Documentation/devicetree/bindings/mfd/ab8500.txt | |||
@@ -13,9 +13,6 @@ Required parent device properties: | |||
13 | 4 = active high level-sensitive | 13 | 4 = active high level-sensitive |
14 | 8 = active low level-sensitive | 14 | 8 = active low level-sensitive |
15 | 15 | ||
16 | Optional parent device properties: | ||
17 | - reg : contains the PRCMU mailbox address for the AB8500 i2c port | ||
18 | |||
19 | The AB8500 consists of a large and varied group of sub-devices: | 16 | The AB8500 consists of a large and varied group of sub-devices: |
20 | 17 | ||
21 | Device IRQ Names Supply Names Description | 18 | Device IRQ Names Supply Names Description |
@@ -86,9 +83,8 @@ Non-standard child device properties: | |||
86 | - stericsson,amic2-bias-vamic1 : Analoge Mic wishes to use a non-standard Vamic | 83 | - stericsson,amic2-bias-vamic1 : Analoge Mic wishes to use a non-standard Vamic |
87 | - stericsson,earpeice-cmv : Earpeice voltage (only: 950 | 1100 | 1270 | 1580) | 84 | - stericsson,earpeice-cmv : Earpeice voltage (only: 950 | 1100 | 1270 | 1580) |
88 | 85 | ||
89 | ab8500@5 { | 86 | ab8500 { |
90 | compatible = "stericsson,ab8500"; | 87 | compatible = "stericsson,ab8500"; |
91 | reg = <5>; /* mailbox 5 is i2c */ | ||
92 | interrupts = <0 40 0x4>; | 88 | interrupts = <0 40 0x4>; |
93 | interrupt-controller; | 89 | interrupt-controller; |
94 | #interrupt-cells = <2>; | 90 | #interrupt-cells = <2>; |
diff --git a/Documentation/devicetree/bindings/tty/serial/of-serial.txt b/Documentation/devicetree/bindings/tty/serial/of-serial.txt index 1e1145ca4f3c..8f01cb190f25 100644 --- a/Documentation/devicetree/bindings/tty/serial/of-serial.txt +++ b/Documentation/devicetree/bindings/tty/serial/of-serial.txt | |||
@@ -11,6 +11,9 @@ Required properties: | |||
11 | - "nvidia,tegra20-uart" | 11 | - "nvidia,tegra20-uart" |
12 | - "nxp,lpc3220-uart" | 12 | - "nxp,lpc3220-uart" |
13 | - "ibm,qpace-nwp-serial" | 13 | - "ibm,qpace-nwp-serial" |
14 | - "altr,16550-FIFO32" | ||
15 | - "altr,16550-FIFO64" | ||
16 | - "altr,16550-FIFO128" | ||
14 | - "serial" if the port type is unknown. | 17 | - "serial" if the port type is unknown. |
15 | - reg : offset and length of the register set for the device. | 18 | - reg : offset and length of the register set for the device. |
16 | - interrupts : should contain uart interrupt. | 19 | - interrupts : should contain uart interrupt. |
diff --git a/Documentation/hwmon/lm75 b/Documentation/hwmon/lm75 index c91a1d15fa28..69af1c7db6b7 100644 --- a/Documentation/hwmon/lm75 +++ b/Documentation/hwmon/lm75 | |||
@@ -23,7 +23,7 @@ Supported chips: | |||
23 | Datasheet: Publicly available at the Maxim website | 23 | Datasheet: Publicly available at the Maxim website |
24 | http://www.maxim-ic.com/ | 24 | http://www.maxim-ic.com/ |
25 | * Microchip (TelCom) TCN75 | 25 | * Microchip (TelCom) TCN75 |
26 | Prefix: 'lm75' | 26 | Prefix: 'tcn75' |
27 | Addresses scanned: none | 27 | Addresses scanned: none |
28 | Datasheet: Publicly available at the Microchip website | 28 | Datasheet: Publicly available at the Microchip website |
29 | http://www.microchip.com/ | 29 | http://www.microchip.com/ |
diff --git a/Documentation/i2c/busses/i2c-diolan-u2c b/Documentation/i2c/busses/i2c-diolan-u2c index 30fe4bb9a069..0d6018c316c7 100644 --- a/Documentation/i2c/busses/i2c-diolan-u2c +++ b/Documentation/i2c/busses/i2c-diolan-u2c | |||
@@ -5,7 +5,7 @@ Supported adapters: | |||
5 | Documentation: | 5 | Documentation: |
6 | http://www.diolan.com/i2c/u2c12.html | 6 | http://www.diolan.com/i2c/u2c12.html |
7 | 7 | ||
8 | Author: Guenter Roeck <guenter.roeck@ericsson.com> | 8 | Author: Guenter Roeck <linux@roeck-us.net> |
9 | 9 | ||
10 | Description | 10 | Description |
11 | ----------- | 11 | ----------- |
diff --git a/Documentation/input/alps.txt b/Documentation/input/alps.txt index 3262b6e4d686..e544c7ff8cfa 100644 --- a/Documentation/input/alps.txt +++ b/Documentation/input/alps.txt | |||
@@ -3,10 +3,26 @@ ALPS Touchpad Protocol | |||
3 | 3 | ||
4 | Introduction | 4 | Introduction |
5 | ------------ | 5 | ------------ |
6 | 6 | Currently the ALPS touchpad driver supports five protocol versions in use by | |
7 | Currently the ALPS touchpad driver supports four protocol versions in use by | 7 | ALPS touchpads, called versions 1, 2, 3, 4 and 5. |
8 | ALPS touchpads, called versions 1, 2, 3, and 4. Information about the various | 8 | |
9 | protocol versions is contained in the following sections. | 9 | Since roughly mid-2010 several new ALPS touchpads have been released and |
10 | integrated into a variety of laptops and netbooks. These new touchpads | ||
11 | have enough behavior differences that the alps_model_data definition | ||
12 | table, describing the properties of the different versions, is no longer | ||
13 | adequate. The design choices were to re-define the alps_model_data | ||
14 | table, with the risk of regression testing existing devices, or isolate | ||
15 | the new devices outside of the alps_model_data table. The latter design | ||
16 | choice was made. The new touchpad signatures are named: "Rushmore", | ||
17 | "Pinnacle", and "Dolphin", which you will see in the alps.c code. | ||
18 | For the purposes of this document, this group of ALPS touchpads will | ||
19 | generically be called "new ALPS touchpads". | ||
20 | |||
21 | We experimented with probing the ACPI interface _HID (Hardware ID)/_CID | ||
22 | (Compatibility ID) definition as a way to uniquely identify the | ||
23 | different ALPS variants but there did not appear to be a 1:1 mapping. | ||
24 | In fact, it appeared to be an m:n mapping between the _HID and actual | ||
25 | hardware type. | ||
10 | 26 | ||
11 | Detection | 27 | Detection |
12 | --------- | 28 | --------- |
@@ -20,9 +36,13 @@ If the E6 report is successful, the touchpad model is identified using the "E7 | |||
20 | report" sequence: E8-E7-E7-E7-E9. The response is the model signature and is | 36 | report" sequence: E8-E7-E7-E7-E9. The response is the model signature and is |
21 | matched against known models in the alps_model_data_array. | 37 | matched against known models in the alps_model_data_array. |
22 | 38 | ||
23 | With protocol versions 3 and 4, the E7 report model signature is always | 39 | For older touchpads supporting protocol versions 3 and 4, the E7 report |
24 | 73-02-64. To differentiate between these versions, the response from the | 40 | model signature is always 73-02-64. To differentiate between these |
25 | "Enter Command Mode" sequence must be inspected as described below. | 41 | versions, the response from the "Enter Command Mode" sequence must be |
42 | inspected as described below. | ||
43 | |||
44 | The new ALPS touchpads have an E7 signature of 73-03-50 or 73-03-0A but | ||
45 | seem to be better differentiated by the EC Command Mode response. | ||
26 | 46 | ||
27 | Command Mode | 47 | Command Mode |
28 | ------------ | 48 | ------------ |
@@ -47,6 +67,14 @@ address of the register being read, and the third contains the value of the | |||
47 | register. Registers are written by writing the value one nibble at a time | 67 | register. Registers are written by writing the value one nibble at a time |
48 | using the same encoding used for addresses. | 68 | using the same encoding used for addresses. |
49 | 69 | ||
70 | For the new ALPS touchpads, the EC command is used to enter command | ||
71 | mode. The response in the new ALPS touchpads is significantly different, | ||
72 | and more important in determining the behavior. This code has been | ||
73 | separated from the original alps_model_data table and put in the | ||
74 | alps_identify function. For example, there seem to be two hardware init | ||
75 | sequences for the "Dolphin" touchpads as determined by the second byte | ||
76 | of the EC response. | ||
77 | |||
50 | Packet Format | 78 | Packet Format |
51 | ------------- | 79 | ------------- |
52 | 80 | ||
@@ -187,3 +215,28 @@ There are several things worth noting here. | |||
187 | well. | 215 | well. |
188 | 216 | ||
189 | So far no v4 devices with tracksticks have been encountered. | 217 | So far no v4 devices with tracksticks have been encountered. |
218 | |||
219 | ALPS Absolute Mode - Protocol Version 5 | ||
220 | --------------------------------------- | ||
221 | This is basically Protocol Version 3 but with different logic for packet | ||
222 | decode. It uses the same alps_process_touchpad_packet_v3 call with a | ||
223 | specialized decode_fields function pointer to correctly interpret the | ||
224 | packets. This appears to only be used by the Dolphin devices. | ||
225 | |||
226 | For single-touch, the 6-byte packet format is: | ||
227 | |||
228 | byte 0: 1 1 0 0 1 0 0 0 | ||
229 | byte 1: 0 x6 x5 x4 x3 x2 x1 x0 | ||
230 | byte 2: 0 y6 y5 y4 y3 y2 y1 y0 | ||
231 | byte 3: 0 M R L 1 m r l | ||
232 | byte 4: y10 y9 y8 y7 x10 x9 x8 x7 | ||
233 | byte 5: 0 z6 z5 z4 z3 z2 z1 z0 | ||
234 | |||
235 | For mt, the format is: | ||
236 | |||
237 | byte 0: 1 1 1 n3 1 n2 n1 x24 | ||
238 | byte 1: 1 y7 y6 y5 y4 y3 y2 y1 | ||
239 | byte 2: ? x2 x1 y12 y11 y10 y9 y8 | ||
240 | byte 3: 0 x23 x22 x21 x20 x19 x18 x17 | ||
241 | byte 4: 0 x9 x8 x7 x6 x5 x4 x3 | ||
242 | byte 5: 0 x16 x15 x14 x13 x12 x11 x10 | ||
diff --git a/Documentation/networking/tuntap.txt b/Documentation/networking/tuntap.txt index c0aab985bad9..949d5dcdd9a3 100644 --- a/Documentation/networking/tuntap.txt +++ b/Documentation/networking/tuntap.txt | |||
@@ -105,6 +105,83 @@ Copyright (C) 1999-2000 Maxim Krasnyansky <max_mk@yahoo.com> | |||
105 | Proto [2 bytes] | 105 | Proto [2 bytes] |
106 | Raw protocol(IP, IPv6, etc) frame. | 106 | Raw protocol(IP, IPv6, etc) frame. |
107 | 107 | ||
108 | 3.3 Multiqueue tuntap interface: | ||
109 | |||
110 | From version 3.8, Linux supports multiqueue tuntap which can uses multiple | ||
111 | file descriptors (queues) to parallelize packets sending or receiving. The | ||
112 | device allocation is the same as before, and if user wants to create multiple | ||
113 | queues, TUNSETIFF with the same device name must be called many times with | ||
114 | IFF_MULTI_QUEUE flag. | ||
115 | |||
116 | char *dev should be the name of the device, queues is the number of queues to | ||
117 | be created, fds is used to store and return the file descriptors (queues) | ||
118 | created to the caller. Each file descriptor were served as the interface of a | ||
119 | queue which could be accessed by userspace. | ||
120 | |||
121 | #include <linux/if.h> | ||
122 | #include <linux/if_tun.h> | ||
123 | |||
124 | int tun_alloc_mq(char *dev, int queues, int *fds) | ||
125 | { | ||
126 | struct ifreq ifr; | ||
127 | int fd, err, i; | ||
128 | |||
129 | if (!dev) | ||
130 | return -1; | ||
131 | |||
132 | memset(&ifr, 0, sizeof(ifr)); | ||
133 | /* Flags: IFF_TUN - TUN device (no Ethernet headers) | ||
134 | * IFF_TAP - TAP device | ||
135 | * | ||
136 | * IFF_NO_PI - Do not provide packet information | ||
137 | * IFF_MULTI_QUEUE - Create a queue of multiqueue device | ||
138 | */ | ||
139 | ifr.ifr_flags = IFF_TAP | IFF_NO_PI | IFF_MULTI_QUEUE; | ||
140 | strcpy(ifr.ifr_name, dev); | ||
141 | |||
142 | for (i = 0; i < queues; i++) { | ||
143 | if ((fd = open("/dev/net/tun", O_RDWR)) < 0) | ||
144 | goto err; | ||
145 | err = ioctl(fd, TUNSETIFF, (void *)&ifr); | ||
146 | if (err) { | ||
147 | close(fd); | ||
148 | goto err; | ||
149 | } | ||
150 | fds[i] = fd; | ||
151 | } | ||
152 | |||
153 | return 0; | ||
154 | err: | ||
155 | for (--i; i >= 0; i--) | ||
156 | close(fds[i]); | ||
157 | return err; | ||
158 | } | ||
159 | |||
160 | A new ioctl(TUNSETQUEUE) were introduced to enable or disable a queue. When | ||
161 | calling it with IFF_DETACH_QUEUE flag, the queue were disabled. And when | ||
162 | calling it with IFF_ATTACH_QUEUE flag, the queue were enabled. The queue were | ||
163 | enabled by default after it was created through TUNSETIFF. | ||
164 | |||
165 | fd is the file descriptor (queue) that we want to enable or disable, when | ||
166 | enable is true we enable it, otherwise we disable it | ||
167 | |||
168 | #include <linux/if.h> | ||
169 | #include <linux/if_tun.h> | ||
170 | |||
171 | int tun_set_queue(int fd, int enable) | ||
172 | { | ||
173 | struct ifreq ifr; | ||
174 | |||
175 | memset(&ifr, 0, sizeof(ifr)); | ||
176 | |||
177 | if (enable) | ||
178 | ifr.ifr_flags = IFF_ATTACH_QUEUE; | ||
179 | else | ||
180 | ifr.ifr_flags = IFF_DETACH_QUEUE; | ||
181 | |||
182 | return ioctl(fd, TUNSETQUEUE, (void *)&ifr); | ||
183 | } | ||
184 | |||
108 | Universal TUN/TAP device driver Frequently Asked Question. | 185 | Universal TUN/TAP device driver Frequently Asked Question. |
109 | 186 | ||
110 | 1. What platforms are supported by TUN/TAP driver ? | 187 | 1. What platforms are supported by TUN/TAP driver ? |
diff --git a/Documentation/sound/alsa/ALSA-Configuration.txt b/Documentation/sound/alsa/ALSA-Configuration.txt index ce6581c8ca26..4499bd948860 100644 --- a/Documentation/sound/alsa/ALSA-Configuration.txt +++ b/Documentation/sound/alsa/ALSA-Configuration.txt | |||
@@ -912,7 +912,7 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed. | |||
912 | models depending on the codec chip. The list of available models | 912 | models depending on the codec chip. The list of available models |
913 | is found in HD-Audio-Models.txt | 913 | is found in HD-Audio-Models.txt |
914 | 914 | ||
915 | The model name "genric" is treated as a special case. When this | 915 | The model name "generic" is treated as a special case. When this |
916 | model is given, the driver uses the generic codec parser without | 916 | model is given, the driver uses the generic codec parser without |
917 | "codec-patch". It's sometimes good for testing and debugging. | 917 | "codec-patch". It's sometimes good for testing and debugging. |
918 | 918 | ||
diff --git a/Documentation/sound/alsa/seq_oss.html b/Documentation/sound/alsa/seq_oss.html index d9776cf60c07..9663b45f6fde 100644 --- a/Documentation/sound/alsa/seq_oss.html +++ b/Documentation/sound/alsa/seq_oss.html | |||
@@ -285,7 +285,7 @@ sample data. | |||
285 | <H4> | 285 | <H4> |
286 | 7.2.4 Close Callback</H4> | 286 | 7.2.4 Close Callback</H4> |
287 | The <TT>close</TT> callback is called when this device is closed by the | 287 | The <TT>close</TT> callback is called when this device is closed by the |
288 | applicaion. If any private data was allocated in open callback, it must | 288 | application. If any private data was allocated in open callback, it must |
289 | be released in the close callback. The deletion of ALSA port should be | 289 | be released in the close callback. The deletion of ALSA port should be |
290 | done here, too. This callback must not be NULL. | 290 | done here, too. This callback must not be NULL. |
291 | <H4> | 291 | <H4> |
diff --git a/Documentation/trace/ftrace.txt b/Documentation/trace/ftrace.txt index 53d6a3c51d87..a372304aef10 100644 --- a/Documentation/trace/ftrace.txt +++ b/Documentation/trace/ftrace.txt | |||
@@ -1873,7 +1873,7 @@ feature: | |||
1873 | 1873 | ||
1874 | status\input | 0 | 1 | else | | 1874 | status\input | 0 | 1 | else | |
1875 | --------------+------------+------------+------------+ | 1875 | --------------+------------+------------+------------+ |
1876 | not allocated |(do nothing)| alloc+swap | EINVAL | | 1876 | not allocated |(do nothing)| alloc+swap |(do nothing)| |
1877 | --------------+------------+------------+------------+ | 1877 | --------------+------------+------------+------------+ |
1878 | allocated | free | swap | clear | | 1878 | allocated | free | swap | clear | |
1879 | --------------+------------+------------+------------+ | 1879 | --------------+------------+------------+------------+ |
diff --git a/MAINTAINERS b/MAINTAINERS index 95616582c728..4cf5fd334a06 100644 --- a/MAINTAINERS +++ b/MAINTAINERS | |||
@@ -1338,12 +1338,6 @@ S: Maintained | |||
1338 | F: drivers/platform/x86/asus*.c | 1338 | F: drivers/platform/x86/asus*.c |
1339 | F: drivers/platform/x86/eeepc*.c | 1339 | F: drivers/platform/x86/eeepc*.c |
1340 | 1340 | ||
1341 | ASUS ASB100 HARDWARE MONITOR DRIVER | ||
1342 | M: "Mark M. Hoffman" <mhoffman@lightlink.com> | ||
1343 | L: lm-sensors@lm-sensors.org | ||
1344 | S: Maintained | ||
1345 | F: drivers/hwmon/asb100.c | ||
1346 | |||
1347 | ASYNCHRONOUS TRANSFERS/TRANSFORMS (IOAT) API | 1341 | ASYNCHRONOUS TRANSFERS/TRANSFORMS (IOAT) API |
1348 | M: Dan Williams <djbw@fb.com> | 1342 | M: Dan Williams <djbw@fb.com> |
1349 | W: http://sourceforge.net/projects/xscaleiop | 1343 | W: http://sourceforge.net/projects/xscaleiop |
@@ -1467,6 +1461,12 @@ F: drivers/dma/at_hdmac.c | |||
1467 | F: drivers/dma/at_hdmac_regs.h | 1461 | F: drivers/dma/at_hdmac_regs.h |
1468 | F: include/linux/platform_data/dma-atmel.h | 1462 | F: include/linux/platform_data/dma-atmel.h |
1469 | 1463 | ||
1464 | ATMEL I2C DRIVER | ||
1465 | M: Ludovic Desroches <ludovic.desroches@atmel.com> | ||
1466 | L: linux-i2c@vger.kernel.org | ||
1467 | S: Supported | ||
1468 | F: drivers/i2c/busses/i2c-at91.c | ||
1469 | |||
1470 | ATMEL ISI DRIVER | 1470 | ATMEL ISI DRIVER |
1471 | M: Josh Wu <josh.wu@atmel.com> | 1471 | M: Josh Wu <josh.wu@atmel.com> |
1472 | L: linux-media@vger.kernel.org | 1472 | L: linux-media@vger.kernel.org |
@@ -2629,7 +2629,7 @@ F: include/uapi/drm/ | |||
2629 | 2629 | ||
2630 | INTEL DRM DRIVERS (excluding Poulsbo, Moorestown and derivative chipsets) | 2630 | INTEL DRM DRIVERS (excluding Poulsbo, Moorestown and derivative chipsets) |
2631 | M: Daniel Vetter <daniel.vetter@ffwll.ch> | 2631 | M: Daniel Vetter <daniel.vetter@ffwll.ch> |
2632 | L: intel-gfx@lists.freedesktop.org (subscribers-only) | 2632 | L: intel-gfx@lists.freedesktop.org |
2633 | L: dri-devel@lists.freedesktop.org | 2633 | L: dri-devel@lists.freedesktop.org |
2634 | T: git git://people.freedesktop.org/~danvet/drm-intel | 2634 | T: git git://people.freedesktop.org/~danvet/drm-intel |
2635 | S: Supported | 2635 | S: Supported |
@@ -3851,7 +3851,7 @@ F: drivers/i2c/busses/i2c-ismt.c | |||
3851 | F: Documentation/i2c/busses/i2c-ismt | 3851 | F: Documentation/i2c/busses/i2c-ismt |
3852 | 3852 | ||
3853 | I2C/SMBUS STUB DRIVER | 3853 | I2C/SMBUS STUB DRIVER |
3854 | M: "Mark M. Hoffman" <mhoffman@lightlink.com> | 3854 | M: Jean Delvare <khali@linux-fr.org> |
3855 | L: linux-i2c@vger.kernel.org | 3855 | L: linux-i2c@vger.kernel.org |
3856 | S: Maintained | 3856 | S: Maintained |
3857 | F: drivers/i2c/i2c-stub.c | 3857 | F: drivers/i2c/i2c-stub.c |
@@ -4005,6 +4005,22 @@ M: Stanislaw Gruszka <stf_xl@wp.pl> | |||
4005 | S: Maintained | 4005 | S: Maintained |
4006 | F: drivers/usb/atm/ueagle-atm.c | 4006 | F: drivers/usb/atm/ueagle-atm.c |
4007 | 4007 | ||
4008 | INA209 HARDWARE MONITOR DRIVER | ||
4009 | M: Guenter Roeck <linux@roeck-us.net> | ||
4010 | L: lm-sensors@lm-sensors.org | ||
4011 | S: Maintained | ||
4012 | F: Documentation/hwmon/ina209 | ||
4013 | F: Documentation/devicetree/bindings/i2c/ina209.txt | ||
4014 | F: drivers/hwmon/ina209.c | ||
4015 | |||
4016 | INA2XX HARDWARE MONITOR DRIVER | ||
4017 | M: Guenter Roeck <linux@roeck-us.net> | ||
4018 | L: lm-sensors@lm-sensors.org | ||
4019 | S: Maintained | ||
4020 | F: Documentation/hwmon/ina2xx | ||
4021 | F: drivers/hwmon/ina2xx.c | ||
4022 | F: include/linux/platform_data/ina2xx.h | ||
4023 | |||
4008 | INDUSTRY PACK SUBSYSTEM (IPACK) | 4024 | INDUSTRY PACK SUBSYSTEM (IPACK) |
4009 | M: Samuel Iglesias Gonsalvez <siglesias@igalia.com> | 4025 | M: Samuel Iglesias Gonsalvez <siglesias@igalia.com> |
4010 | M: Jens Taprogge <jens.taprogge@taprogge.org> | 4026 | M: Jens Taprogge <jens.taprogge@taprogge.org> |
@@ -5098,6 +5114,15 @@ S: Maintained | |||
5098 | F: Documentation/hwmon/max6650 | 5114 | F: Documentation/hwmon/max6650 |
5099 | F: drivers/hwmon/max6650.c | 5115 | F: drivers/hwmon/max6650.c |
5100 | 5116 | ||
5117 | MAX6697 HARDWARE MONITOR DRIVER | ||
5118 | M: Guenter Roeck <linux@roeck-us.net> | ||
5119 | L: lm-sensors@lm-sensors.org | ||
5120 | S: Maintained | ||
5121 | F: Documentation/hwmon/max6697 | ||
5122 | F: Documentation/devicetree/bindings/i2c/max6697.txt | ||
5123 | F: drivers/hwmon/max6697.c | ||
5124 | F: include/linux/platform_data/max6697.h | ||
5125 | |||
5101 | MAXIRADIO FM RADIO RECEIVER DRIVER | 5126 | MAXIRADIO FM RADIO RECEIVER DRIVER |
5102 | M: Hans Verkuil <hverkuil@xs4all.nl> | 5127 | M: Hans Verkuil <hverkuil@xs4all.nl> |
5103 | L: linux-media@vger.kernel.org | 5128 | L: linux-media@vger.kernel.org |
@@ -5622,6 +5647,14 @@ S: Maintained | |||
5622 | F: drivers/video/riva/ | 5647 | F: drivers/video/riva/ |
5623 | F: drivers/video/nvidia/ | 5648 | F: drivers/video/nvidia/ |
5624 | 5649 | ||
5650 | NVM EXPRESS DRIVER | ||
5651 | M: Matthew Wilcox <willy@linux.intel.com> | ||
5652 | L: linux-nvme@lists.infradead.org | ||
5653 | T: git git://git.infradead.org/users/willy/linux-nvme.git | ||
5654 | S: Supported | ||
5655 | F: drivers/block/nvme.c | ||
5656 | F: include/linux/nvme.h | ||
5657 | |||
5625 | OMAP SUPPORT | 5658 | OMAP SUPPORT |
5626 | M: Tony Lindgren <tony@atomide.com> | 5659 | M: Tony Lindgren <tony@atomide.com> |
5627 | L: linux-omap@vger.kernel.org | 5660 | L: linux-omap@vger.kernel.org |
@@ -6412,6 +6445,8 @@ F: Documentation/networking/LICENSE.qla3xxx | |||
6412 | F: drivers/net/ethernet/qlogic/qla3xxx.* | 6445 | F: drivers/net/ethernet/qlogic/qla3xxx.* |
6413 | 6446 | ||
6414 | QLOGIC QLCNIC (1/10)Gb ETHERNET DRIVER | 6447 | QLOGIC QLCNIC (1/10)Gb ETHERNET DRIVER |
6448 | M: Rajesh Borundia <rajesh.borundia@qlogic.com> | ||
6449 | M: Shahed Shaikh <shahed.shaikh@qlogic.com> | ||
6415 | M: Jitendra Kalsaria <jitendra.kalsaria@qlogic.com> | 6450 | M: Jitendra Kalsaria <jitendra.kalsaria@qlogic.com> |
6416 | M: Sony Chacko <sony.chacko@qlogic.com> | 6451 | M: Sony Chacko <sony.chacko@qlogic.com> |
6417 | M: linux-driver@qlogic.com | 6452 | M: linux-driver@qlogic.com |
@@ -7171,13 +7206,6 @@ L: netdev@vger.kernel.org | |||
7171 | S: Maintained | 7206 | S: Maintained |
7172 | F: drivers/net/ethernet/sis/sis900.* | 7207 | F: drivers/net/ethernet/sis/sis900.* |
7173 | 7208 | ||
7174 | SIS 96X I2C/SMBUS DRIVER | ||
7175 | M: "Mark M. Hoffman" <mhoffman@lightlink.com> | ||
7176 | L: linux-i2c@vger.kernel.org | ||
7177 | S: Maintained | ||
7178 | F: Documentation/i2c/busses/i2c-sis96x | ||
7179 | F: drivers/i2c/busses/i2c-sis96x.c | ||
7180 | |||
7181 | SIS FRAMEBUFFER DRIVER | 7209 | SIS FRAMEBUFFER DRIVER |
7182 | M: Thomas Winischhofer <thomas@winischhofer.net> | 7210 | M: Thomas Winischhofer <thomas@winischhofer.net> |
7183 | W: http://www.winischhofer.net/linuxsisvga.shtml | 7211 | W: http://www.winischhofer.net/linuxsisvga.shtml |
@@ -7255,7 +7283,7 @@ F: Documentation/hwmon/sch5627 | |||
7255 | F: drivers/hwmon/sch5627.c | 7283 | F: drivers/hwmon/sch5627.c |
7256 | 7284 | ||
7257 | SMSC47B397 HARDWARE MONITOR DRIVER | 7285 | SMSC47B397 HARDWARE MONITOR DRIVER |
7258 | M: "Mark M. Hoffman" <mhoffman@lightlink.com> | 7286 | M: Jean Delvare <khali@linux-fr.org> |
7259 | L: lm-sensors@lm-sensors.org | 7287 | L: lm-sensors@lm-sensors.org |
7260 | S: Maintained | 7288 | S: Maintained |
7261 | F: Documentation/hwmon/smsc47b397 | 7289 | F: Documentation/hwmon/smsc47b397 |
@@ -1,7 +1,7 @@ | |||
1 | VERSION = 3 | 1 | VERSION = 3 |
2 | PATCHLEVEL = 9 | 2 | PATCHLEVEL = 9 |
3 | SUBLEVEL = 0 | 3 | SUBLEVEL = 0 |
4 | EXTRAVERSION = -rc2 | 4 | EXTRAVERSION = -rc4 |
5 | NAME = Unicycling Gorilla | 5 | NAME = Unicycling Gorilla |
6 | 6 | ||
7 | # *DOCUMENTATION* | 7 | # *DOCUMENTATION* |
diff --git a/arch/Kconfig b/arch/Kconfig index 5a1779c93940..1455579791ec 100644 --- a/arch/Kconfig +++ b/arch/Kconfig | |||
@@ -319,13 +319,6 @@ config ARCH_WANT_OLD_COMPAT_IPC | |||
319 | select ARCH_WANT_COMPAT_IPC_PARSE_VERSION | 319 | select ARCH_WANT_COMPAT_IPC_PARSE_VERSION |
320 | bool | 320 | bool |
321 | 321 | ||
322 | config HAVE_VIRT_TO_BUS | ||
323 | bool | ||
324 | help | ||
325 | An architecture should select this if it implements the | ||
326 | deprecated interface virt_to_bus(). All new architectures | ||
327 | should probably not select this. | ||
328 | |||
329 | config HAVE_ARCH_SECCOMP_FILTER | 322 | config HAVE_ARCH_SECCOMP_FILTER |
330 | bool | 323 | bool |
331 | help | 324 | help |
diff --git a/arch/alpha/Kconfig b/arch/alpha/Kconfig index 5833aa441481..8a33ba01301f 100644 --- a/arch/alpha/Kconfig +++ b/arch/alpha/Kconfig | |||
@@ -9,7 +9,7 @@ config ALPHA | |||
9 | select HAVE_PERF_EVENTS | 9 | select HAVE_PERF_EVENTS |
10 | select HAVE_DMA_ATTRS | 10 | select HAVE_DMA_ATTRS |
11 | select HAVE_GENERIC_HARDIRQS | 11 | select HAVE_GENERIC_HARDIRQS |
12 | select HAVE_VIRT_TO_BUS | 12 | select VIRT_TO_BUS |
13 | select GENERIC_IRQ_PROBE | 13 | select GENERIC_IRQ_PROBE |
14 | select AUTO_IRQ_AFFINITY if SMP | 14 | select AUTO_IRQ_AFFINITY if SMP |
15 | select GENERIC_IRQ_SHOW | 15 | select GENERIC_IRQ_SHOW |
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index 0c990b75082f..9462dd931b33 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig | |||
@@ -49,7 +49,6 @@ config ARM | |||
49 | select HAVE_REGS_AND_STACK_ACCESS_API | 49 | select HAVE_REGS_AND_STACK_ACCESS_API |
50 | select HAVE_SYSCALL_TRACEPOINTS | 50 | select HAVE_SYSCALL_TRACEPOINTS |
51 | select HAVE_UID16 | 51 | select HAVE_UID16 |
52 | select HAVE_VIRT_TO_BUS | ||
53 | select KTIME_SCALAR | 52 | select KTIME_SCALAR |
54 | select PERF_USE_VMALLOC | 53 | select PERF_USE_VMALLOC |
55 | select RTC_LIB | 54 | select RTC_LIB |
@@ -563,6 +562,7 @@ config ARCH_DOVE | |||
563 | select PINCTRL_DOVE | 562 | select PINCTRL_DOVE |
564 | select PLAT_ORION_LEGACY | 563 | select PLAT_ORION_LEGACY |
565 | select USB_ARCH_HAS_EHCI | 564 | select USB_ARCH_HAS_EHCI |
565 | select MVEBU_MBUS | ||
566 | help | 566 | help |
567 | Support for the Marvell Dove SoC 88AP510 | 567 | Support for the Marvell Dove SoC 88AP510 |
568 | 568 | ||
@@ -576,6 +576,7 @@ config ARCH_KIRKWOOD | |||
576 | select PINCTRL | 576 | select PINCTRL |
577 | select PINCTRL_KIRKWOOD | 577 | select PINCTRL_KIRKWOOD |
578 | select PLAT_ORION_LEGACY | 578 | select PLAT_ORION_LEGACY |
579 | select MVEBU_MBUS | ||
579 | help | 580 | help |
580 | Support for the following Marvell Kirkwood series SoCs: | 581 | Support for the following Marvell Kirkwood series SoCs: |
581 | 88F6180, 88F6192 and 88F6281. | 582 | 88F6180, 88F6192 and 88F6281. |
@@ -587,6 +588,7 @@ config ARCH_MV78XX0 | |||
587 | select GENERIC_CLOCKEVENTS | 588 | select GENERIC_CLOCKEVENTS |
588 | select PCI | 589 | select PCI |
589 | select PLAT_ORION_LEGACY | 590 | select PLAT_ORION_LEGACY |
591 | select MVEBU_MBUS | ||
590 | help | 592 | help |
591 | Support for the following Marvell MV78xx0 series SoCs: | 593 | Support for the following Marvell MV78xx0 series SoCs: |
592 | MV781x0, MV782x0. | 594 | MV781x0, MV782x0. |
@@ -599,6 +601,7 @@ config ARCH_ORION5X | |||
599 | select GENERIC_CLOCKEVENTS | 601 | select GENERIC_CLOCKEVENTS |
600 | select PCI | 602 | select PCI |
601 | select PLAT_ORION_LEGACY | 603 | select PLAT_ORION_LEGACY |
604 | select MVEBU_MBUS | ||
602 | help | 605 | help |
603 | Support for the following Marvell Orion 5x series SoCs: | 606 | Support for the following Marvell Orion 5x series SoCs: |
604 | Orion-1 (5181), Orion-VoIP (5181L), Orion-NAS (5182), | 607 | Orion-1 (5181), Orion-VoIP (5181L), Orion-NAS (5182), |
@@ -743,6 +746,7 @@ config ARCH_RPC | |||
743 | select NEED_MACH_IO_H | 746 | select NEED_MACH_IO_H |
744 | select NEED_MACH_MEMORY_H | 747 | select NEED_MACH_MEMORY_H |
745 | select NO_IOPORT | 748 | select NO_IOPORT |
749 | select VIRT_TO_BUS | ||
746 | help | 750 | help |
747 | On the Acorn Risc-PC, Linux can support the internal IDE disk and | 751 | On the Acorn Risc-PC, Linux can support the internal IDE disk and |
748 | CD-ROM interface, serial and parallel port, and the floppy drive. | 752 | CD-ROM interface, serial and parallel port, and the floppy drive. |
@@ -878,6 +882,7 @@ config ARCH_SHARK | |||
878 | select ISA_DMA | 882 | select ISA_DMA |
879 | select NEED_MACH_MEMORY_H | 883 | select NEED_MACH_MEMORY_H |
880 | select PCI | 884 | select PCI |
885 | select VIRT_TO_BUS | ||
881 | select ZONE_DMA | 886 | select ZONE_DMA |
882 | help | 887 | help |
883 | Support for the StrongARM based Digital DNARD machine, also known | 888 | Support for the StrongARM based Digital DNARD machine, also known |
@@ -1005,12 +1010,12 @@ config ARCH_MULTI_V4_V5 | |||
1005 | bool | 1010 | bool |
1006 | 1011 | ||
1007 | config ARCH_MULTI_V6 | 1012 | config ARCH_MULTI_V6 |
1008 | bool "ARMv6 based platforms (ARM11, Scorpion, ...)" | 1013 | bool "ARMv6 based platforms (ARM11)" |
1009 | select ARCH_MULTI_V6_V7 | 1014 | select ARCH_MULTI_V6_V7 |
1010 | select CPU_V6 | 1015 | select CPU_V6 |
1011 | 1016 | ||
1012 | config ARCH_MULTI_V7 | 1017 | config ARCH_MULTI_V7 |
1013 | bool "ARMv7 based platforms (Cortex-A, PJ4, Krait)" | 1018 | bool "ARMv7 based platforms (Cortex-A, PJ4, Scorpion, Krait)" |
1014 | default y | 1019 | default y |
1015 | select ARCH_MULTI_V6_V7 | 1020 | select ARCH_MULTI_V6_V7 |
1016 | select ARCH_VEXPRESS | 1021 | select ARCH_VEXPRESS |
@@ -1461,10 +1466,6 @@ config ISA_DMA | |||
1461 | bool | 1466 | bool |
1462 | select ISA_DMA_API | 1467 | select ISA_DMA_API |
1463 | 1468 | ||
1464 | config ARCH_NO_VIRT_TO_BUS | ||
1465 | def_bool y | ||
1466 | depends on !ARCH_RPC && !ARCH_NETWINDER && !ARCH_SHARK | ||
1467 | |||
1468 | # Select ISA DMA interface | 1469 | # Select ISA DMA interface |
1469 | config ISA_DMA_API | 1470 | config ISA_DMA_API |
1470 | bool | 1471 | bool |
@@ -1656,13 +1657,16 @@ config LOCAL_TIMERS | |||
1656 | accounting to be spread across the timer interval, preventing a | 1657 | accounting to be spread across the timer interval, preventing a |
1657 | "thundering herd" at every timer tick. | 1658 | "thundering herd" at every timer tick. |
1658 | 1659 | ||
1660 | # The GPIO number here must be sorted by descending number. In case of | ||
1661 | # a multiplatform kernel, we just want the highest value required by the | ||
1662 | # selected platforms. | ||
1659 | config ARCH_NR_GPIO | 1663 | config ARCH_NR_GPIO |
1660 | int | 1664 | int |
1661 | default 1024 if ARCH_SHMOBILE || ARCH_TEGRA | 1665 | default 1024 if ARCH_SHMOBILE || ARCH_TEGRA |
1662 | default 355 if ARCH_U8500 | ||
1663 | default 264 if MACH_H4700 | ||
1664 | default 512 if SOC_OMAP5 | 1666 | default 512 if SOC_OMAP5 |
1667 | default 355 if ARCH_U8500 | ||
1665 | default 288 if ARCH_VT8500 || ARCH_SUNXI | 1668 | default 288 if ARCH_VT8500 || ARCH_SUNXI |
1669 | default 264 if MACH_H4700 | ||
1666 | default 0 | 1670 | default 0 |
1667 | help | 1671 | help |
1668 | Maximum number of GPIOs in the system. | 1672 | Maximum number of GPIOs in the system. |
@@ -1886,8 +1890,9 @@ config XEN_DOM0 | |||
1886 | 1890 | ||
1887 | config XEN | 1891 | config XEN |
1888 | bool "Xen guest support on ARM (EXPERIMENTAL)" | 1892 | bool "Xen guest support on ARM (EXPERIMENTAL)" |
1889 | depends on ARM && OF | 1893 | depends on ARM && AEABI && OF |
1890 | depends on CPU_V7 && !CPU_V6 | 1894 | depends on CPU_V7 && !CPU_V6 |
1895 | depends on !GENERIC_ATOMIC64 | ||
1891 | help | 1896 | help |
1892 | Say Y if you want to run Linux in a Virtual Machine on Xen on ARM. | 1897 | Say Y if you want to run Linux in a Virtual Machine on Xen on ARM. |
1893 | 1898 | ||
diff --git a/arch/arm/Kconfig.debug b/arch/arm/Kconfig.debug index acddddac7ee4..ecfcdba2d17c 100644 --- a/arch/arm/Kconfig.debug +++ b/arch/arm/Kconfig.debug | |||
@@ -492,7 +492,7 @@ config DEBUG_IMX_UART_PORT | |||
492 | DEBUG_IMX31_UART || \ | 492 | DEBUG_IMX31_UART || \ |
493 | DEBUG_IMX35_UART || \ | 493 | DEBUG_IMX35_UART || \ |
494 | DEBUG_IMX51_UART || \ | 494 | DEBUG_IMX51_UART || \ |
495 | DEBUG_IMX50_IMX53_UART || \ | 495 | DEBUG_IMX53_UART || \ |
496 | DEBUG_IMX6Q_UART | 496 | DEBUG_IMX6Q_UART |
497 | default 1 | 497 | default 1 |
498 | help | 498 | help |
diff --git a/arch/arm/boot/Makefile b/arch/arm/boot/Makefile index 71768b8a1ab9..84aa2caf07ed 100644 --- a/arch/arm/boot/Makefile +++ b/arch/arm/boot/Makefile | |||
@@ -115,4 +115,4 @@ i: | |||
115 | $(CONFIG_SHELL) $(srctree)/$(src)/install.sh $(KERNELRELEASE) \ | 115 | $(CONFIG_SHELL) $(srctree)/$(src)/install.sh $(KERNELRELEASE) \ |
116 | $(obj)/Image System.map "$(INSTALL_PATH)" | 116 | $(obj)/Image System.map "$(INSTALL_PATH)" |
117 | 117 | ||
118 | subdir- := bootp compressed | 118 | subdir- := bootp compressed dts |
diff --git a/arch/arm/boot/dts/armada-370-xp.dtsi b/arch/arm/boot/dts/armada-370-xp.dtsi index 758c4ea90344..9693f796bcfe 100644 --- a/arch/arm/boot/dts/armada-370-xp.dtsi +++ b/arch/arm/boot/dts/armada-370-xp.dtsi | |||
@@ -73,11 +73,6 @@ | |||
73 | clocks = <&coreclk 2>; | 73 | clocks = <&coreclk 2>; |
74 | }; | 74 | }; |
75 | 75 | ||
76 | addr-decoding@d0020000 { | ||
77 | compatible = "marvell,armada-addr-decoding-controller"; | ||
78 | reg = <0xd0020000 0x258>; | ||
79 | }; | ||
80 | |||
81 | sata@d00a0000 { | 76 | sata@d00a0000 { |
82 | compatible = "marvell,orion-sata"; | 77 | compatible = "marvell,orion-sata"; |
83 | reg = <0xd00a0000 0x2400>; | 78 | reg = <0xd00a0000 0x2400>; |
diff --git a/arch/arm/boot/dts/at91sam9x5.dtsi b/arch/arm/boot/dts/at91sam9x5.dtsi index aa98e641931f..a98c0d50fbbe 100644 --- a/arch/arm/boot/dts/at91sam9x5.dtsi +++ b/arch/arm/boot/dts/at91sam9x5.dtsi | |||
@@ -238,8 +238,32 @@ | |||
238 | nand { | 238 | nand { |
239 | pinctrl_nand: nand-0 { | 239 | pinctrl_nand: nand-0 { |
240 | atmel,pins = | 240 | atmel,pins = |
241 | <3 4 0x0 0x1 /* PD5 gpio RDY pin pull_up */ | 241 | <3 0 0x1 0x0 /* PD0 periph A Read Enable */ |
242 | 3 5 0x0 0x1>; /* PD4 gpio enable pin pull_up */ | 242 | 3 1 0x1 0x0 /* PD1 periph A Write Enable */ |
243 | 3 2 0x1 0x0 /* PD2 periph A Address Latch Enable */ | ||
244 | 3 3 0x1 0x0 /* PD3 periph A Command Latch Enable */ | ||
245 | 3 4 0x0 0x1 /* PD4 gpio Chip Enable pin pull_up */ | ||
246 | 3 5 0x0 0x1 /* PD5 gpio RDY/BUSY pin pull_up */ | ||
247 | 3 6 0x1 0x0 /* PD6 periph A Data bit 0 */ | ||
248 | 3 7 0x1 0x0 /* PD7 periph A Data bit 1 */ | ||
249 | 3 8 0x1 0x0 /* PD8 periph A Data bit 2 */ | ||
250 | 3 9 0x1 0x0 /* PD9 periph A Data bit 3 */ | ||
251 | 3 10 0x1 0x0 /* PD10 periph A Data bit 4 */ | ||
252 | 3 11 0x1 0x0 /* PD11 periph A Data bit 5 */ | ||
253 | 3 12 0x1 0x0 /* PD12 periph A Data bit 6 */ | ||
254 | 3 13 0x1 0x0>; /* PD13 periph A Data bit 7 */ | ||
255 | }; | ||
256 | |||
257 | pinctrl_nand_16bits: nand_16bits-0 { | ||
258 | atmel,pins = | ||
259 | <3 14 0x1 0x0 /* PD14 periph A Data bit 8 */ | ||
260 | 3 15 0x1 0x0 /* PD15 periph A Data bit 9 */ | ||
261 | 3 16 0x1 0x0 /* PD16 periph A Data bit 10 */ | ||
262 | 3 17 0x1 0x0 /* PD17 periph A Data bit 11 */ | ||
263 | 3 18 0x1 0x0 /* PD18 periph A Data bit 12 */ | ||
264 | 3 19 0x1 0x0 /* PD19 periph A Data bit 13 */ | ||
265 | 3 20 0x1 0x0 /* PD20 periph A Data bit 14 */ | ||
266 | 3 21 0x1 0x0>; /* PD21 periph A Data bit 15 */ | ||
243 | }; | 267 | }; |
244 | }; | 268 | }; |
245 | 269 | ||
diff --git a/arch/arm/boot/dts/bcm2835.dtsi b/arch/arm/boot/dts/bcm2835.dtsi index 4bf2a8774aa7..7e0481e2441a 100644 --- a/arch/arm/boot/dts/bcm2835.dtsi +++ b/arch/arm/boot/dts/bcm2835.dtsi | |||
@@ -105,7 +105,7 @@ | |||
105 | compatible = "fixed-clock"; | 105 | compatible = "fixed-clock"; |
106 | reg = <1>; | 106 | reg = <1>; |
107 | #clock-cells = <0>; | 107 | #clock-cells = <0>; |
108 | clock-frequency = <150000000>; | 108 | clock-frequency = <250000000>; |
109 | }; | 109 | }; |
110 | }; | 110 | }; |
111 | }; | 111 | }; |
diff --git a/arch/arm/boot/dts/dbx5x0.dtsi b/arch/arm/boot/dts/dbx5x0.dtsi index 69140ba99f46..9de93096601a 100644 --- a/arch/arm/boot/dts/dbx5x0.dtsi +++ b/arch/arm/boot/dts/dbx5x0.dtsi | |||
@@ -319,9 +319,8 @@ | |||
319 | }; | 319 | }; |
320 | }; | 320 | }; |
321 | 321 | ||
322 | ab8500@5 { | 322 | ab8500 { |
323 | compatible = "stericsson,ab8500"; | 323 | compatible = "stericsson,ab8500"; |
324 | reg = <5>; /* mailbox 5 is i2c */ | ||
325 | interrupt-parent = <&intc>; | 324 | interrupt-parent = <&intc>; |
326 | interrupts = <0 40 0x4>; | 325 | interrupts = <0 40 0x4>; |
327 | interrupt-controller; | 326 | interrupt-controller; |
diff --git a/arch/arm/boot/dts/exynos4.dtsi b/arch/arm/boot/dts/exynos4.dtsi index e1347fceb5bc..1a62bcf18aa3 100644 --- a/arch/arm/boot/dts/exynos4.dtsi +++ b/arch/arm/boot/dts/exynos4.dtsi | |||
@@ -275,18 +275,27 @@ | |||
275 | compatible = "arm,pl330", "arm,primecell"; | 275 | compatible = "arm,pl330", "arm,primecell"; |
276 | reg = <0x12680000 0x1000>; | 276 | reg = <0x12680000 0x1000>; |
277 | interrupts = <0 35 0>; | 277 | interrupts = <0 35 0>; |
278 | #dma-cells = <1>; | ||
279 | #dma-channels = <8>; | ||
280 | #dma-requests = <32>; | ||
278 | }; | 281 | }; |
279 | 282 | ||
280 | pdma1: pdma@12690000 { | 283 | pdma1: pdma@12690000 { |
281 | compatible = "arm,pl330", "arm,primecell"; | 284 | compatible = "arm,pl330", "arm,primecell"; |
282 | reg = <0x12690000 0x1000>; | 285 | reg = <0x12690000 0x1000>; |
283 | interrupts = <0 36 0>; | 286 | interrupts = <0 36 0>; |
287 | #dma-cells = <1>; | ||
288 | #dma-channels = <8>; | ||
289 | #dma-requests = <32>; | ||
284 | }; | 290 | }; |
285 | 291 | ||
286 | mdma1: mdma@12850000 { | 292 | mdma1: mdma@12850000 { |
287 | compatible = "arm,pl330", "arm,primecell"; | 293 | compatible = "arm,pl330", "arm,primecell"; |
288 | reg = <0x12850000 0x1000>; | 294 | reg = <0x12850000 0x1000>; |
289 | interrupts = <0 34 0>; | 295 | interrupts = <0 34 0>; |
296 | #dma-cells = <1>; | ||
297 | #dma-channels = <8>; | ||
298 | #dma-requests = <1>; | ||
290 | }; | 299 | }; |
291 | }; | 300 | }; |
292 | }; | 301 | }; |
diff --git a/arch/arm/boot/dts/exynos5440.dtsi b/arch/arm/boot/dts/exynos5440.dtsi index 5f3562ad6746..9a99755920c0 100644 --- a/arch/arm/boot/dts/exynos5440.dtsi +++ b/arch/arm/boot/dts/exynos5440.dtsi | |||
@@ -142,12 +142,18 @@ | |||
142 | compatible = "arm,pl330", "arm,primecell"; | 142 | compatible = "arm,pl330", "arm,primecell"; |
143 | reg = <0x120000 0x1000>; | 143 | reg = <0x120000 0x1000>; |
144 | interrupts = <0 34 0>; | 144 | interrupts = <0 34 0>; |
145 | #dma-cells = <1>; | ||
146 | #dma-channels = <8>; | ||
147 | #dma-requests = <32>; | ||
145 | }; | 148 | }; |
146 | 149 | ||
147 | pdma1: pdma@121B0000 { | 150 | pdma1: pdma@121B0000 { |
148 | compatible = "arm,pl330", "arm,primecell"; | 151 | compatible = "arm,pl330", "arm,primecell"; |
149 | reg = <0x121000 0x1000>; | 152 | reg = <0x121000 0x1000>; |
150 | interrupts = <0 35 0>; | 153 | interrupts = <0 35 0>; |
154 | #dma-cells = <1>; | ||
155 | #dma-channels = <8>; | ||
156 | #dma-requests = <32>; | ||
151 | }; | 157 | }; |
152 | }; | 158 | }; |
153 | 159 | ||
diff --git a/arch/arm/boot/dts/href.dtsi b/arch/arm/boot/dts/href.dtsi index 592fb9dc35bd..379128eb9d98 100644 --- a/arch/arm/boot/dts/href.dtsi +++ b/arch/arm/boot/dts/href.dtsi | |||
@@ -221,7 +221,7 @@ | |||
221 | }; | 221 | }; |
222 | }; | 222 | }; |
223 | 223 | ||
224 | ab8500@5 { | 224 | ab8500 { |
225 | ab8500-regulators { | 225 | ab8500-regulators { |
226 | ab8500_ldo_aux1_reg: ab8500_ldo_aux1 { | 226 | ab8500_ldo_aux1_reg: ab8500_ldo_aux1 { |
227 | regulator-name = "V-DISPLAY"; | 227 | regulator-name = "V-DISPLAY"; |
diff --git a/arch/arm/boot/dts/hrefv60plus.dts b/arch/arm/boot/dts/hrefv60plus.dts index 55f4191a626e..2b587a74b813 100644 --- a/arch/arm/boot/dts/hrefv60plus.dts +++ b/arch/arm/boot/dts/hrefv60plus.dts | |||
@@ -158,7 +158,7 @@ | |||
158 | }; | 158 | }; |
159 | }; | 159 | }; |
160 | 160 | ||
161 | ab8500@5 { | 161 | ab8500 { |
162 | ab8500-regulators { | 162 | ab8500-regulators { |
163 | ab8500_ldo_aux1_reg: ab8500_ldo_aux1 { | 163 | ab8500_ldo_aux1_reg: ab8500_ldo_aux1 { |
164 | regulator-name = "V-DISPLAY"; | 164 | regulator-name = "V-DISPLAY"; |
diff --git a/arch/arm/boot/dts/imx53-mba53.dts b/arch/arm/boot/dts/imx53-mba53.dts index e54fffd48369..468c0a1d48d9 100644 --- a/arch/arm/boot/dts/imx53-mba53.dts +++ b/arch/arm/boot/dts/imx53-mba53.dts | |||
@@ -42,10 +42,9 @@ | |||
42 | fsl,pins = <689 0x10000 /* DISP1_DRDY */ | 42 | fsl,pins = <689 0x10000 /* DISP1_DRDY */ |
43 | 482 0x10000 /* DISP1_HSYNC */ | 43 | 482 0x10000 /* DISP1_HSYNC */ |
44 | 489 0x10000 /* DISP1_VSYNC */ | 44 | 489 0x10000 /* DISP1_VSYNC */ |
45 | 684 0x10000 /* DISP1_DAT_0 */ | ||
46 | 515 0x10000 /* DISP1_DAT_22 */ | 45 | 515 0x10000 /* DISP1_DAT_22 */ |
47 | 523 0x10000 /* DISP1_DAT_23 */ | 46 | 523 0x10000 /* DISP1_DAT_23 */ |
48 | 543 0x10000 /* DISP1_DAT_21 */ | 47 | 545 0x10000 /* DISP1_DAT_21 */ |
49 | 553 0x10000 /* DISP1_DAT_20 */ | 48 | 553 0x10000 /* DISP1_DAT_20 */ |
50 | 558 0x10000 /* DISP1_DAT_19 */ | 49 | 558 0x10000 /* DISP1_DAT_19 */ |
51 | 564 0x10000 /* DISP1_DAT_18 */ | 50 | 564 0x10000 /* DISP1_DAT_18 */ |
diff --git a/arch/arm/boot/dts/snowball.dts b/arch/arm/boot/dts/snowball.dts index 27f31a5fa494..d3ec32f6b790 100644 --- a/arch/arm/boot/dts/snowball.dts +++ b/arch/arm/boot/dts/snowball.dts | |||
@@ -298,7 +298,7 @@ | |||
298 | }; | 298 | }; |
299 | }; | 299 | }; |
300 | 300 | ||
301 | ab8500@5 { | 301 | ab8500 { |
302 | ab8500-regulators { | 302 | ab8500-regulators { |
303 | ab8500_ldo_aux1_reg: ab8500_ldo_aux1 { | 303 | ab8500_ldo_aux1_reg: ab8500_ldo_aux1 { |
304 | regulator-name = "V-DISPLAY"; | 304 | regulator-name = "V-DISPLAY"; |
diff --git a/arch/arm/boot/dts/socfpga.dtsi b/arch/arm/boot/dts/socfpga.dtsi index 936d2306e7e1..7e8769bd5977 100644 --- a/arch/arm/boot/dts/socfpga.dtsi +++ b/arch/arm/boot/dts/socfpga.dtsi | |||
@@ -75,6 +75,9 @@ | |||
75 | compatible = "arm,pl330", "arm,primecell"; | 75 | compatible = "arm,pl330", "arm,primecell"; |
76 | reg = <0xffe01000 0x1000>; | 76 | reg = <0xffe01000 0x1000>; |
77 | interrupts = <0 180 4>; | 77 | interrupts = <0 180 4>; |
78 | #dma-cells = <1>; | ||
79 | #dma-channels = <8>; | ||
80 | #dma-requests = <32>; | ||
78 | }; | 81 | }; |
79 | }; | 82 | }; |
80 | 83 | ||
diff --git a/arch/arm/boot/dts/tegra20.dtsi b/arch/arm/boot/dts/tegra20.dtsi index 9a428931d042..48d00a099ce3 100644 --- a/arch/arm/boot/dts/tegra20.dtsi +++ b/arch/arm/boot/dts/tegra20.dtsi | |||
@@ -118,6 +118,7 @@ | |||
118 | compatible = "arm,cortex-a9-twd-timer"; | 118 | compatible = "arm,cortex-a9-twd-timer"; |
119 | reg = <0x50040600 0x20>; | 119 | reg = <0x50040600 0x20>; |
120 | interrupts = <1 13 0x304>; | 120 | interrupts = <1 13 0x304>; |
121 | clocks = <&tegra_car 132>; | ||
121 | }; | 122 | }; |
122 | 123 | ||
123 | intc: interrupt-controller { | 124 | intc: interrupt-controller { |
diff --git a/arch/arm/boot/dts/tegra30.dtsi b/arch/arm/boot/dts/tegra30.dtsi index 767803e1fd55..9d87a3ffe998 100644 --- a/arch/arm/boot/dts/tegra30.dtsi +++ b/arch/arm/boot/dts/tegra30.dtsi | |||
@@ -119,6 +119,7 @@ | |||
119 | compatible = "arm,cortex-a9-twd-timer"; | 119 | compatible = "arm,cortex-a9-twd-timer"; |
120 | reg = <0x50040600 0x20>; | 120 | reg = <0x50040600 0x20>; |
121 | interrupts = <1 13 0xf04>; | 121 | interrupts = <1 13 0xf04>; |
122 | clocks = <&tegra_car 214>; | ||
122 | }; | 123 | }; |
123 | 124 | ||
124 | intc: interrupt-controller { | 125 | intc: interrupt-controller { |
diff --git a/arch/arm/configs/mxs_defconfig b/arch/arm/configs/mxs_defconfig index fbbc5bb022d5..6a99e30f81d2 100644 --- a/arch/arm/configs/mxs_defconfig +++ b/arch/arm/configs/mxs_defconfig | |||
@@ -116,6 +116,7 @@ CONFIG_SND_SOC=y | |||
116 | CONFIG_SND_MXS_SOC=y | 116 | CONFIG_SND_MXS_SOC=y |
117 | CONFIG_SND_SOC_MXS_SGTL5000=y | 117 | CONFIG_SND_SOC_MXS_SGTL5000=y |
118 | CONFIG_USB=y | 118 | CONFIG_USB=y |
119 | CONFIG_USB_EHCI_HCD=y | ||
119 | CONFIG_USB_CHIPIDEA=y | 120 | CONFIG_USB_CHIPIDEA=y |
120 | CONFIG_USB_CHIPIDEA_HOST=y | 121 | CONFIG_USB_CHIPIDEA_HOST=y |
121 | CONFIG_USB_STORAGE=y | 122 | CONFIG_USB_STORAGE=y |
diff --git a/arch/arm/configs/omap2plus_defconfig b/arch/arm/configs/omap2plus_defconfig index b16bae2c9a60..bd07864f14a0 100644 --- a/arch/arm/configs/omap2plus_defconfig +++ b/arch/arm/configs/omap2plus_defconfig | |||
@@ -126,6 +126,8 @@ CONFIG_INPUT_MISC=y | |||
126 | CONFIG_INPUT_TWL4030_PWRBUTTON=y | 126 | CONFIG_INPUT_TWL4030_PWRBUTTON=y |
127 | CONFIG_VT_HW_CONSOLE_BINDING=y | 127 | CONFIG_VT_HW_CONSOLE_BINDING=y |
128 | # CONFIG_LEGACY_PTYS is not set | 128 | # CONFIG_LEGACY_PTYS is not set |
129 | CONFIG_SERIAL_8250=y | ||
130 | CONFIG_SERIAL_8250_CONSOLE=y | ||
129 | CONFIG_SERIAL_8250_NR_UARTS=32 | 131 | CONFIG_SERIAL_8250_NR_UARTS=32 |
130 | CONFIG_SERIAL_8250_EXTENDED=y | 132 | CONFIG_SERIAL_8250_EXTENDED=y |
131 | CONFIG_SERIAL_8250_MANY_PORTS=y | 133 | CONFIG_SERIAL_8250_MANY_PORTS=y |
diff --git a/arch/arm/include/asm/xen/events.h b/arch/arm/include/asm/xen/events.h index 5c27696de14f..8b1f37bfeeec 100644 --- a/arch/arm/include/asm/xen/events.h +++ b/arch/arm/include/asm/xen/events.h | |||
@@ -2,6 +2,7 @@ | |||
2 | #define _ASM_ARM_XEN_EVENTS_H | 2 | #define _ASM_ARM_XEN_EVENTS_H |
3 | 3 | ||
4 | #include <asm/ptrace.h> | 4 | #include <asm/ptrace.h> |
5 | #include <asm/atomic.h> | ||
5 | 6 | ||
6 | enum ipi_vector { | 7 | enum ipi_vector { |
7 | XEN_PLACEHOLDER_VECTOR, | 8 | XEN_PLACEHOLDER_VECTOR, |
@@ -15,26 +16,8 @@ static inline int xen_irqs_disabled(struct pt_regs *regs) | |||
15 | return raw_irqs_disabled_flags(regs->ARM_cpsr); | 16 | return raw_irqs_disabled_flags(regs->ARM_cpsr); |
16 | } | 17 | } |
17 | 18 | ||
18 | /* | 19 | #define xchg_xen_ulong(ptr, val) atomic64_xchg(container_of((ptr), \ |
19 | * We cannot use xchg because it does not support 8-byte | 20 | atomic64_t, \ |
20 | * values. However it is safe to use {ldr,dtd}exd directly because all | 21 | counter), (val)) |
21 | * platforms which Xen can run on support those instructions. | ||
22 | */ | ||
23 | static inline xen_ulong_t xchg_xen_ulong(xen_ulong_t *ptr, xen_ulong_t val) | ||
24 | { | ||
25 | xen_ulong_t oldval; | ||
26 | unsigned int tmp; | ||
27 | |||
28 | wmb(); | ||
29 | asm volatile("@ xchg_xen_ulong\n" | ||
30 | "1: ldrexd %0, %H0, [%3]\n" | ||
31 | " strexd %1, %2, %H2, [%3]\n" | ||
32 | " teq %1, #0\n" | ||
33 | " bne 1b" | ||
34 | : "=&r" (oldval), "=&r" (tmp) | ||
35 | : "r" (val), "r" (ptr) | ||
36 | : "memory", "cc"); | ||
37 | return oldval; | ||
38 | } | ||
39 | 22 | ||
40 | #endif /* _ASM_ARM_XEN_EVENTS_H */ | 23 | #endif /* _ASM_ARM_XEN_EVENTS_H */ |
diff --git a/arch/arm/include/debug/mvebu.S b/arch/arm/include/debug/mvebu.S index 865c6d02b332..df191afa3be1 100644 --- a/arch/arm/include/debug/mvebu.S +++ b/arch/arm/include/debug/mvebu.S | |||
@@ -12,7 +12,7 @@ | |||
12 | */ | 12 | */ |
13 | 13 | ||
14 | #define ARMADA_370_XP_REGS_PHYS_BASE 0xd0000000 | 14 | #define ARMADA_370_XP_REGS_PHYS_BASE 0xd0000000 |
15 | #define ARMADA_370_XP_REGS_VIRT_BASE 0xfeb00000 | 15 | #define ARMADA_370_XP_REGS_VIRT_BASE 0xfec00000 |
16 | 16 | ||
17 | .macro addruart, rp, rv, tmp | 17 | .macro addruart, rp, rv, tmp |
18 | ldr \rp, =ARMADA_370_XP_REGS_PHYS_BASE | 18 | ldr \rp, =ARMADA_370_XP_REGS_PHYS_BASE |
diff --git a/arch/arm/kernel/smp.c b/arch/arm/kernel/smp.c index 31644f1978d5..79078edbb9bc 100644 --- a/arch/arm/kernel/smp.c +++ b/arch/arm/kernel/smp.c | |||
@@ -480,7 +480,7 @@ static void __cpuinit broadcast_timer_setup(struct clock_event_device *evt) | |||
480 | evt->features = CLOCK_EVT_FEAT_ONESHOT | | 480 | evt->features = CLOCK_EVT_FEAT_ONESHOT | |
481 | CLOCK_EVT_FEAT_PERIODIC | | 481 | CLOCK_EVT_FEAT_PERIODIC | |
482 | CLOCK_EVT_FEAT_DUMMY; | 482 | CLOCK_EVT_FEAT_DUMMY; |
483 | evt->rating = 400; | 483 | evt->rating = 100; |
484 | evt->mult = 1; | 484 | evt->mult = 1; |
485 | evt->set_mode = broadcast_timer_set_mode; | 485 | evt->set_mode = broadcast_timer_set_mode; |
486 | 486 | ||
diff --git a/arch/arm/lib/memset.S b/arch/arm/lib/memset.S index d912e7397ecc..94b0650ea98f 100644 --- a/arch/arm/lib/memset.S +++ b/arch/arm/lib/memset.S | |||
@@ -14,31 +14,15 @@ | |||
14 | 14 | ||
15 | .text | 15 | .text |
16 | .align 5 | 16 | .align 5 |
17 | .word 0 | ||
18 | |||
19 | 1: subs r2, r2, #4 @ 1 do we have enough | ||
20 | blt 5f @ 1 bytes to align with? | ||
21 | cmp r3, #2 @ 1 | ||
22 | strltb r1, [ip], #1 @ 1 | ||
23 | strleb r1, [ip], #1 @ 1 | ||
24 | strb r1, [ip], #1 @ 1 | ||
25 | add r2, r2, r3 @ 1 (r2 = r2 - (4 - r3)) | ||
26 | /* | ||
27 | * The pointer is now aligned and the length is adjusted. Try doing the | ||
28 | * memset again. | ||
29 | */ | ||
30 | 17 | ||
31 | ENTRY(memset) | 18 | ENTRY(memset) |
32 | /* | 19 | ands r3, r0, #3 @ 1 unaligned? |
33 | * Preserve the contents of r0 for the return value. | 20 | mov ip, r0 @ preserve r0 as return value |
34 | */ | 21 | bne 6f @ 1 |
35 | mov ip, r0 | ||
36 | ands r3, ip, #3 @ 1 unaligned? | ||
37 | bne 1b @ 1 | ||
38 | /* | 22 | /* |
39 | * we know that the pointer in ip is aligned to a word boundary. | 23 | * we know that the pointer in ip is aligned to a word boundary. |
40 | */ | 24 | */ |
41 | orr r1, r1, r1, lsl #8 | 25 | 1: orr r1, r1, r1, lsl #8 |
42 | orr r1, r1, r1, lsl #16 | 26 | orr r1, r1, r1, lsl #16 |
43 | mov r3, r1 | 27 | mov r3, r1 |
44 | cmp r2, #16 | 28 | cmp r2, #16 |
@@ -127,4 +111,13 @@ ENTRY(memset) | |||
127 | tst r2, #1 | 111 | tst r2, #1 |
128 | strneb r1, [ip], #1 | 112 | strneb r1, [ip], #1 |
129 | mov pc, lr | 113 | mov pc, lr |
114 | |||
115 | 6: subs r2, r2, #4 @ 1 do we have enough | ||
116 | blt 5b @ 1 bytes to align with? | ||
117 | cmp r3, #2 @ 1 | ||
118 | strltb r1, [ip], #1 @ 1 | ||
119 | strleb r1, [ip], #1 @ 1 | ||
120 | strb r1, [ip], #1 @ 1 | ||
121 | add r2, r2, r3 @ 1 (r2 = r2 - (4 - r3)) | ||
122 | b 1b | ||
130 | ENDPROC(memset) | 123 | ENDPROC(memset) |
diff --git a/arch/arm/mach-at91/board-foxg20.c b/arch/arm/mach-at91/board-foxg20.c index 2ea7059b840b..c20a870ea9c9 100644 --- a/arch/arm/mach-at91/board-foxg20.c +++ b/arch/arm/mach-at91/board-foxg20.c | |||
@@ -176,6 +176,7 @@ static struct w1_gpio_platform_data w1_gpio_pdata = { | |||
176 | /* If you choose to use a pin other than PB16 it needs to be 3.3V */ | 176 | /* If you choose to use a pin other than PB16 it needs to be 3.3V */ |
177 | .pin = AT91_PIN_PB16, | 177 | .pin = AT91_PIN_PB16, |
178 | .is_open_drain = 1, | 178 | .is_open_drain = 1, |
179 | .ext_pullup_enable_pin = -EINVAL, | ||
179 | }; | 180 | }; |
180 | 181 | ||
181 | static struct platform_device w1_device = { | 182 | static struct platform_device w1_device = { |
diff --git a/arch/arm/mach-at91/board-stamp9g20.c b/arch/arm/mach-at91/board-stamp9g20.c index a033b8df9fb2..869cbecf00b7 100644 --- a/arch/arm/mach-at91/board-stamp9g20.c +++ b/arch/arm/mach-at91/board-stamp9g20.c | |||
@@ -188,6 +188,7 @@ static struct spi_board_info portuxg20_spi_devices[] = { | |||
188 | static struct w1_gpio_platform_data w1_gpio_pdata = { | 188 | static struct w1_gpio_platform_data w1_gpio_pdata = { |
189 | .pin = AT91_PIN_PA29, | 189 | .pin = AT91_PIN_PA29, |
190 | .is_open_drain = 1, | 190 | .is_open_drain = 1, |
191 | .ext_pullup_enable_pin = -EINVAL, | ||
191 | }; | 192 | }; |
192 | 193 | ||
193 | static struct platform_device w1_device = { | 194 | static struct platform_device w1_device = { |
diff --git a/arch/arm/mach-at91/include/mach/gpio.h b/arch/arm/mach-at91/include/mach/gpio.h index eed465ab0dd7..5fc23771c154 100644 --- a/arch/arm/mach-at91/include/mach/gpio.h +++ b/arch/arm/mach-at91/include/mach/gpio.h | |||
@@ -209,6 +209,14 @@ extern int at91_get_gpio_value(unsigned pin); | |||
209 | extern void at91_gpio_suspend(void); | 209 | extern void at91_gpio_suspend(void); |
210 | extern void at91_gpio_resume(void); | 210 | extern void at91_gpio_resume(void); |
211 | 211 | ||
212 | #ifdef CONFIG_PINCTRL_AT91 | ||
213 | extern void at91_pinctrl_gpio_suspend(void); | ||
214 | extern void at91_pinctrl_gpio_resume(void); | ||
215 | #else | ||
216 | static inline void at91_pinctrl_gpio_suspend(void) {} | ||
217 | static inline void at91_pinctrl_gpio_resume(void) {} | ||
218 | #endif | ||
219 | |||
212 | #endif /* __ASSEMBLY__ */ | 220 | #endif /* __ASSEMBLY__ */ |
213 | 221 | ||
214 | #endif | 222 | #endif |
diff --git a/arch/arm/mach-at91/irq.c b/arch/arm/mach-at91/irq.c index 8e210262aeee..e0ca59171022 100644 --- a/arch/arm/mach-at91/irq.c +++ b/arch/arm/mach-at91/irq.c | |||
@@ -92,23 +92,21 @@ static int at91_aic_set_wake(struct irq_data *d, unsigned value) | |||
92 | 92 | ||
93 | void at91_irq_suspend(void) | 93 | void at91_irq_suspend(void) |
94 | { | 94 | { |
95 | int i = 0, bit; | 95 | int bit = -1; |
96 | 96 | ||
97 | if (has_aic5()) { | 97 | if (has_aic5()) { |
98 | /* disable enabled irqs */ | 98 | /* disable enabled irqs */ |
99 | while ((bit = find_next_bit(backups, n_irqs, i)) < n_irqs) { | 99 | while ((bit = find_next_bit(backups, n_irqs, bit + 1)) < n_irqs) { |
100 | at91_aic_write(AT91_AIC5_SSR, | 100 | at91_aic_write(AT91_AIC5_SSR, |
101 | bit & AT91_AIC5_INTSEL_MSK); | 101 | bit & AT91_AIC5_INTSEL_MSK); |
102 | at91_aic_write(AT91_AIC5_IDCR, 1); | 102 | at91_aic_write(AT91_AIC5_IDCR, 1); |
103 | i = bit; | ||
104 | } | 103 | } |
105 | /* enable wakeup irqs */ | 104 | /* enable wakeup irqs */ |
106 | i = 0; | 105 | bit = -1; |
107 | while ((bit = find_next_bit(wakeups, n_irqs, i)) < n_irqs) { | 106 | while ((bit = find_next_bit(wakeups, n_irqs, bit + 1)) < n_irqs) { |
108 | at91_aic_write(AT91_AIC5_SSR, | 107 | at91_aic_write(AT91_AIC5_SSR, |
109 | bit & AT91_AIC5_INTSEL_MSK); | 108 | bit & AT91_AIC5_INTSEL_MSK); |
110 | at91_aic_write(AT91_AIC5_IECR, 1); | 109 | at91_aic_write(AT91_AIC5_IECR, 1); |
111 | i = bit; | ||
112 | } | 110 | } |
113 | } else { | 111 | } else { |
114 | at91_aic_write(AT91_AIC_IDCR, *backups); | 112 | at91_aic_write(AT91_AIC_IDCR, *backups); |
@@ -118,23 +116,21 @@ void at91_irq_suspend(void) | |||
118 | 116 | ||
119 | void at91_irq_resume(void) | 117 | void at91_irq_resume(void) |
120 | { | 118 | { |
121 | int i = 0, bit; | 119 | int bit = -1; |
122 | 120 | ||
123 | if (has_aic5()) { | 121 | if (has_aic5()) { |
124 | /* disable wakeup irqs */ | 122 | /* disable wakeup irqs */ |
125 | while ((bit = find_next_bit(wakeups, n_irqs, i)) < n_irqs) { | 123 | while ((bit = find_next_bit(wakeups, n_irqs, bit + 1)) < n_irqs) { |
126 | at91_aic_write(AT91_AIC5_SSR, | 124 | at91_aic_write(AT91_AIC5_SSR, |
127 | bit & AT91_AIC5_INTSEL_MSK); | 125 | bit & AT91_AIC5_INTSEL_MSK); |
128 | at91_aic_write(AT91_AIC5_IDCR, 1); | 126 | at91_aic_write(AT91_AIC5_IDCR, 1); |
129 | i = bit; | ||
130 | } | 127 | } |
131 | /* enable irqs disabled for suspend */ | 128 | /* enable irqs disabled for suspend */ |
132 | i = 0; | 129 | bit = -1; |
133 | while ((bit = find_next_bit(backups, n_irqs, i)) < n_irqs) { | 130 | while ((bit = find_next_bit(backups, n_irqs, bit + 1)) < n_irqs) { |
134 | at91_aic_write(AT91_AIC5_SSR, | 131 | at91_aic_write(AT91_AIC5_SSR, |
135 | bit & AT91_AIC5_INTSEL_MSK); | 132 | bit & AT91_AIC5_INTSEL_MSK); |
136 | at91_aic_write(AT91_AIC5_IECR, 1); | 133 | at91_aic_write(AT91_AIC5_IECR, 1); |
137 | i = bit; | ||
138 | } | 134 | } |
139 | } else { | 135 | } else { |
140 | at91_aic_write(AT91_AIC_IDCR, *wakeups); | 136 | at91_aic_write(AT91_AIC_IDCR, *wakeups); |
diff --git a/arch/arm/mach-at91/pm.c b/arch/arm/mach-at91/pm.c index adb6db888a1f..73f1f250403a 100644 --- a/arch/arm/mach-at91/pm.c +++ b/arch/arm/mach-at91/pm.c | |||
@@ -201,7 +201,10 @@ extern u32 at91_slow_clock_sz; | |||
201 | 201 | ||
202 | static int at91_pm_enter(suspend_state_t state) | 202 | static int at91_pm_enter(suspend_state_t state) |
203 | { | 203 | { |
204 | at91_gpio_suspend(); | 204 | if (of_have_populated_dt()) |
205 | at91_pinctrl_gpio_suspend(); | ||
206 | else | ||
207 | at91_gpio_suspend(); | ||
205 | at91_irq_suspend(); | 208 | at91_irq_suspend(); |
206 | 209 | ||
207 | pr_debug("AT91: PM - wake mask %08x, pm state %d\n", | 210 | pr_debug("AT91: PM - wake mask %08x, pm state %d\n", |
@@ -286,7 +289,10 @@ static int at91_pm_enter(suspend_state_t state) | |||
286 | error: | 289 | error: |
287 | target_state = PM_SUSPEND_ON; | 290 | target_state = PM_SUSPEND_ON; |
288 | at91_irq_resume(); | 291 | at91_irq_resume(); |
289 | at91_gpio_resume(); | 292 | if (of_have_populated_dt()) |
293 | at91_pinctrl_gpio_resume(); | ||
294 | else | ||
295 | at91_gpio_resume(); | ||
290 | return 0; | 296 | return 0; |
291 | } | 297 | } |
292 | 298 | ||
diff --git a/arch/arm/mach-davinci/dma.c b/arch/arm/mach-davinci/dma.c index a685e9706b7b..45b7c71d9cc1 100644 --- a/arch/arm/mach-davinci/dma.c +++ b/arch/arm/mach-davinci/dma.c | |||
@@ -743,6 +743,9 @@ EXPORT_SYMBOL(edma_free_channel); | |||
743 | */ | 743 | */ |
744 | int edma_alloc_slot(unsigned ctlr, int slot) | 744 | int edma_alloc_slot(unsigned ctlr, int slot) |
745 | { | 745 | { |
746 | if (!edma_cc[ctlr]) | ||
747 | return -EINVAL; | ||
748 | |||
746 | if (slot >= 0) | 749 | if (slot >= 0) |
747 | slot = EDMA_CHAN_SLOT(slot); | 750 | slot = EDMA_CHAN_SLOT(slot); |
748 | 751 | ||
diff --git a/arch/arm/mach-dove/Makefile b/arch/arm/mach-dove/Makefile index 3f0a858fb597..4d9d2ffc4535 100644 --- a/arch/arm/mach-dove/Makefile +++ b/arch/arm/mach-dove/Makefile | |||
@@ -1,4 +1,4 @@ | |||
1 | obj-y += common.o addr-map.o irq.o | 1 | obj-y += common.o irq.o |
2 | obj-$(CONFIG_DOVE_LEGACY) += mpp.o | 2 | obj-$(CONFIG_DOVE_LEGACY) += mpp.o |
3 | obj-$(CONFIG_PCI) += pcie.o | 3 | obj-$(CONFIG_PCI) += pcie.o |
4 | obj-$(CONFIG_MACH_DOVE_DB) += dove-db-setup.o | 4 | obj-$(CONFIG_MACH_DOVE_DB) += dove-db-setup.o |
diff --git a/arch/arm/mach-dove/addr-map.c b/arch/arm/mach-dove/addr-map.c deleted file mode 100644 index 2a06c0163418..000000000000 --- a/arch/arm/mach-dove/addr-map.c +++ /dev/null | |||
@@ -1,125 +0,0 @@ | |||
1 | /* | ||
2 | * arch/arm/mach-dove/addr-map.c | ||
3 | * | ||
4 | * Address map functions for Marvell Dove 88AP510 SoC | ||
5 | * | ||
6 | * This file is licensed under the terms of the GNU General Public | ||
7 | * License version 2. This program is licensed "as is" without any | ||
8 | * warranty of any kind, whether express or implied. | ||
9 | */ | ||
10 | |||
11 | #include <linux/kernel.h> | ||
12 | #include <linux/init.h> | ||
13 | #include <linux/mbus.h> | ||
14 | #include <linux/io.h> | ||
15 | #include <asm/mach/arch.h> | ||
16 | #include <asm/setup.h> | ||
17 | #include <mach/dove.h> | ||
18 | #include <plat/addr-map.h> | ||
19 | #include "common.h" | ||
20 | |||
21 | /* | ||
22 | * Generic Address Decode Windows bit settings | ||
23 | */ | ||
24 | #define TARGET_DDR 0x0 | ||
25 | #define TARGET_BOOTROM 0x1 | ||
26 | #define TARGET_CESA 0x3 | ||
27 | #define TARGET_PCIE0 0x4 | ||
28 | #define TARGET_PCIE1 0x8 | ||
29 | #define TARGET_SCRATCHPAD 0xd | ||
30 | |||
31 | #define ATTR_CESA 0x01 | ||
32 | #define ATTR_BOOTROM 0xfd | ||
33 | #define ATTR_DEV_SPI0_ROM 0xfe | ||
34 | #define ATTR_DEV_SPI1_ROM 0xfb | ||
35 | #define ATTR_PCIE_IO 0xe0 | ||
36 | #define ATTR_PCIE_MEM 0xe8 | ||
37 | #define ATTR_SCRATCHPAD 0x0 | ||
38 | |||
39 | static inline void __iomem *ddr_map_sc(int i) | ||
40 | { | ||
41 | return (void __iomem *)(DOVE_MC_VIRT_BASE + 0x100 + ((i) << 4)); | ||
42 | } | ||
43 | |||
44 | /* | ||
45 | * Description of the windows needed by the platform code | ||
46 | */ | ||
47 | static struct __initdata orion_addr_map_cfg addr_map_cfg = { | ||
48 | .num_wins = 8, | ||
49 | .remappable_wins = 4, | ||
50 | .bridge_virt_base = BRIDGE_VIRT_BASE, | ||
51 | }; | ||
52 | |||
53 | static const struct __initdata orion_addr_map_info addr_map_info[] = { | ||
54 | /* | ||
55 | * Windows for PCIe IO+MEM space. | ||
56 | */ | ||
57 | { 0, DOVE_PCIE0_IO_PHYS_BASE, DOVE_PCIE0_IO_SIZE, | ||
58 | TARGET_PCIE0, ATTR_PCIE_IO, DOVE_PCIE0_IO_BUS_BASE | ||
59 | }, | ||
60 | { 1, DOVE_PCIE1_IO_PHYS_BASE, DOVE_PCIE1_IO_SIZE, | ||
61 | TARGET_PCIE1, ATTR_PCIE_IO, DOVE_PCIE1_IO_BUS_BASE | ||
62 | }, | ||
63 | { 2, DOVE_PCIE0_MEM_PHYS_BASE, DOVE_PCIE0_MEM_SIZE, | ||
64 | TARGET_PCIE0, ATTR_PCIE_MEM, -1 | ||
65 | }, | ||
66 | { 3, DOVE_PCIE1_MEM_PHYS_BASE, DOVE_PCIE1_MEM_SIZE, | ||
67 | TARGET_PCIE1, ATTR_PCIE_MEM, -1 | ||
68 | }, | ||
69 | /* | ||
70 | * Window for CESA engine. | ||
71 | */ | ||
72 | { 4, DOVE_CESA_PHYS_BASE, DOVE_CESA_SIZE, | ||
73 | TARGET_CESA, ATTR_CESA, -1 | ||
74 | }, | ||
75 | /* | ||
76 | * Window to the BootROM for Standby and Sleep Resume | ||
77 | */ | ||
78 | { 5, DOVE_BOOTROM_PHYS_BASE, DOVE_BOOTROM_SIZE, | ||
79 | TARGET_BOOTROM, ATTR_BOOTROM, -1 | ||
80 | }, | ||
81 | /* | ||
82 | * Window to the PMU Scratch Pad space | ||
83 | */ | ||
84 | { 6, DOVE_SCRATCHPAD_PHYS_BASE, DOVE_SCRATCHPAD_SIZE, | ||
85 | TARGET_SCRATCHPAD, ATTR_SCRATCHPAD, -1 | ||
86 | }, | ||
87 | /* End marker */ | ||
88 | { -1, 0, 0, 0, 0, 0 } | ||
89 | }; | ||
90 | |||
91 | void __init dove_setup_cpu_mbus(void) | ||
92 | { | ||
93 | int i; | ||
94 | int cs; | ||
95 | |||
96 | /* | ||
97 | * Disable, clear and configure windows. | ||
98 | */ | ||
99 | orion_config_wins(&addr_map_cfg, addr_map_info); | ||
100 | |||
101 | /* | ||
102 | * Setup MBUS dram target info. | ||
103 | */ | ||
104 | orion_mbus_dram_info.mbus_dram_target_id = TARGET_DDR; | ||
105 | |||
106 | for (i = 0, cs = 0; i < 2; i++) { | ||
107 | u32 map = readl(ddr_map_sc(i)); | ||
108 | |||
109 | /* | ||
110 | * Chip select enabled? | ||
111 | */ | ||
112 | if (map & 1) { | ||
113 | struct mbus_dram_window *w; | ||
114 | |||
115 | w = &orion_mbus_dram_info.cs[cs++]; | ||
116 | w->cs_index = i; | ||
117 | w->mbus_attr = 0; /* CS address decoding done inside */ | ||
118 | /* the DDR controller, no need to */ | ||
119 | /* provide attributes */ | ||
120 | w->base = map & 0xff800000; | ||
121 | w->size = 0x100000 << (((map & 0x000f0000) >> 16) - 4); | ||
122 | } | ||
123 | } | ||
124 | orion_mbus_dram_info.num_cs = cs; | ||
125 | } | ||
diff --git a/arch/arm/mach-dove/board-dt.c b/arch/arm/mach-dove/board-dt.c index fbde1dd67113..0b142803b2e1 100644 --- a/arch/arm/mach-dove/board-dt.c +++ b/arch/arm/mach-dove/board-dt.c | |||
@@ -64,7 +64,7 @@ static void __init dove_dt_init(void) | |||
64 | #ifdef CONFIG_CACHE_TAUROS2 | 64 | #ifdef CONFIG_CACHE_TAUROS2 |
65 | tauros2_init(0); | 65 | tauros2_init(0); |
66 | #endif | 66 | #endif |
67 | dove_setup_cpu_mbus(); | 67 | dove_setup_cpu_wins(); |
68 | 68 | ||
69 | /* Setup root of clk tree */ | 69 | /* Setup root of clk tree */ |
70 | dove_of_clk_init(); | 70 | dove_of_clk_init(); |
diff --git a/arch/arm/mach-dove/common.c b/arch/arm/mach-dove/common.c index c6b3b2bb50e7..e2b5da031f96 100644 --- a/arch/arm/mach-dove/common.c +++ b/arch/arm/mach-dove/common.c | |||
@@ -224,6 +224,9 @@ void __init dove_i2c_init(void) | |||
224 | void __init dove_init_early(void) | 224 | void __init dove_init_early(void) |
225 | { | 225 | { |
226 | orion_time_set_base(TIMER_VIRT_BASE); | 226 | orion_time_set_base(TIMER_VIRT_BASE); |
227 | mvebu_mbus_init("marvell,dove-mbus", | ||
228 | BRIDGE_WINS_BASE, BRIDGE_WINS_SZ, | ||
229 | DOVE_MC_WINS_BASE, DOVE_MC_WINS_SZ); | ||
227 | } | 230 | } |
228 | 231 | ||
229 | static int __init dove_find_tclk(void) | 232 | static int __init dove_find_tclk(void) |
@@ -326,6 +329,40 @@ void __init dove_sdio1_init(void) | |||
326 | platform_device_register(&dove_sdio1); | 329 | platform_device_register(&dove_sdio1); |
327 | } | 330 | } |
328 | 331 | ||
332 | void __init dove_setup_cpu_wins(void) | ||
333 | { | ||
334 | /* | ||
335 | * The PCIe windows will no longer be statically allocated | ||
336 | * here once Dove is migrated to the pci-mvebu driver. | ||
337 | */ | ||
338 | mvebu_mbus_add_window_remap_flags("pcie0.0", | ||
339 | DOVE_PCIE0_IO_PHYS_BASE, | ||
340 | DOVE_PCIE0_IO_SIZE, | ||
341 | DOVE_PCIE0_IO_BUS_BASE, | ||
342 | MVEBU_MBUS_PCI_IO); | ||
343 | mvebu_mbus_add_window_remap_flags("pcie1.0", | ||
344 | DOVE_PCIE1_IO_PHYS_BASE, | ||
345 | DOVE_PCIE1_IO_SIZE, | ||
346 | DOVE_PCIE1_IO_BUS_BASE, | ||
347 | MVEBU_MBUS_PCI_IO); | ||
348 | mvebu_mbus_add_window_remap_flags("pcie0.0", | ||
349 | DOVE_PCIE0_MEM_PHYS_BASE, | ||
350 | DOVE_PCIE0_MEM_SIZE, | ||
351 | MVEBU_MBUS_NO_REMAP, | ||
352 | MVEBU_MBUS_PCI_MEM); | ||
353 | mvebu_mbus_add_window_remap_flags("pcie1.0", | ||
354 | DOVE_PCIE1_MEM_PHYS_BASE, | ||
355 | DOVE_PCIE1_MEM_SIZE, | ||
356 | MVEBU_MBUS_NO_REMAP, | ||
357 | MVEBU_MBUS_PCI_MEM); | ||
358 | mvebu_mbus_add_window("cesa", DOVE_CESA_PHYS_BASE, | ||
359 | DOVE_CESA_SIZE); | ||
360 | mvebu_mbus_add_window("bootrom", DOVE_BOOTROM_PHYS_BASE, | ||
361 | DOVE_BOOTROM_SIZE); | ||
362 | mvebu_mbus_add_window("scratchpad", DOVE_SCRATCHPAD_PHYS_BASE, | ||
363 | DOVE_SCRATCHPAD_SIZE); | ||
364 | } | ||
365 | |||
329 | void __init dove_init(void) | 366 | void __init dove_init(void) |
330 | { | 367 | { |
331 | pr_info("Dove 88AP510 SoC, TCLK = %d MHz.\n", | 368 | pr_info("Dove 88AP510 SoC, TCLK = %d MHz.\n", |
@@ -334,7 +371,7 @@ void __init dove_init(void) | |||
334 | #ifdef CONFIG_CACHE_TAUROS2 | 371 | #ifdef CONFIG_CACHE_TAUROS2 |
335 | tauros2_init(0); | 372 | tauros2_init(0); |
336 | #endif | 373 | #endif |
337 | dove_setup_cpu_mbus(); | 374 | dove_setup_cpu_wins(); |
338 | 375 | ||
339 | /* Setup root of clk tree */ | 376 | /* Setup root of clk tree */ |
340 | dove_clk_init(); | 377 | dove_clk_init(); |
diff --git a/arch/arm/mach-dove/common.h b/arch/arm/mach-dove/common.h index ee59fba4c6d1..e86347928b67 100644 --- a/arch/arm/mach-dove/common.h +++ b/arch/arm/mach-dove/common.h | |||
@@ -23,7 +23,7 @@ void dove_map_io(void); | |||
23 | void dove_init(void); | 23 | void dove_init(void); |
24 | void dove_init_early(void); | 24 | void dove_init_early(void); |
25 | void dove_init_irq(void); | 25 | void dove_init_irq(void); |
26 | void dove_setup_cpu_mbus(void); | 26 | void dove_setup_cpu_wins(void); |
27 | void dove_ge00_init(struct mv643xx_eth_platform_data *eth_data); | 27 | void dove_ge00_init(struct mv643xx_eth_platform_data *eth_data); |
28 | void dove_sata_init(struct mv_sata_platform_data *sata_data); | 28 | void dove_sata_init(struct mv_sata_platform_data *sata_data); |
29 | #ifdef CONFIG_PCI | 29 | #ifdef CONFIG_PCI |
diff --git a/arch/arm/mach-dove/include/mach/dove.h b/arch/arm/mach-dove/include/mach/dove.h index 661725e3115a..0c4b35f4ee5b 100644 --- a/arch/arm/mach-dove/include/mach/dove.h +++ b/arch/arm/mach-dove/include/mach/dove.h | |||
@@ -77,6 +77,8 @@ | |||
77 | /* North-South Bridge */ | 77 | /* North-South Bridge */ |
78 | #define BRIDGE_VIRT_BASE (DOVE_SB_REGS_VIRT_BASE + 0x20000) | 78 | #define BRIDGE_VIRT_BASE (DOVE_SB_REGS_VIRT_BASE + 0x20000) |
79 | #define BRIDGE_PHYS_BASE (DOVE_SB_REGS_PHYS_BASE + 0x20000) | 79 | #define BRIDGE_PHYS_BASE (DOVE_SB_REGS_PHYS_BASE + 0x20000) |
80 | #define BRIDGE_WINS_BASE (BRIDGE_PHYS_BASE) | ||
81 | #define BRIDGE_WINS_SZ (0x80) | ||
80 | 82 | ||
81 | /* Cryptographic Engine */ | 83 | /* Cryptographic Engine */ |
82 | #define DOVE_CRYPT_PHYS_BASE (DOVE_SB_REGS_PHYS_BASE + 0x30000) | 84 | #define DOVE_CRYPT_PHYS_BASE (DOVE_SB_REGS_PHYS_BASE + 0x30000) |
@@ -168,6 +170,9 @@ | |||
168 | #define DOVE_SSP_CLOCK_ENABLE (1 << 1) | 170 | #define DOVE_SSP_CLOCK_ENABLE (1 << 1) |
169 | #define DOVE_SSP_BPB_CLOCK_SRC_SSP (1 << 11) | 171 | #define DOVE_SSP_BPB_CLOCK_SRC_SSP (1 << 11) |
170 | /* Memory Controller */ | 172 | /* Memory Controller */ |
173 | #define DOVE_MC_PHYS_BASE (DOVE_NB_REGS_PHYS_BASE + 0x00000) | ||
174 | #define DOVE_MC_WINS_BASE (DOVE_MC_PHYS_BASE + 0x100) | ||
175 | #define DOVE_MC_WINS_SZ (0x8) | ||
171 | #define DOVE_MC_VIRT_BASE (DOVE_NB_REGS_VIRT_BASE + 0x00000) | 176 | #define DOVE_MC_VIRT_BASE (DOVE_NB_REGS_VIRT_BASE + 0x00000) |
172 | 177 | ||
173 | /* LCD Controller */ | 178 | /* LCD Controller */ |
diff --git a/arch/arm/mach-footbridge/Kconfig b/arch/arm/mach-footbridge/Kconfig index abda5a18a664..0f2111a11315 100644 --- a/arch/arm/mach-footbridge/Kconfig +++ b/arch/arm/mach-footbridge/Kconfig | |||
@@ -67,6 +67,7 @@ config ARCH_NETWINDER | |||
67 | select ISA | 67 | select ISA |
68 | select ISA_DMA | 68 | select ISA_DMA |
69 | select PCI | 69 | select PCI |
70 | select VIRT_TO_BUS | ||
70 | help | 71 | help |
71 | Say Y here if you intend to run this kernel on the Rebel.COM | 72 | Say Y here if you intend to run this kernel on the Rebel.COM |
72 | NetWinder. Information about this machine can be found at: | 73 | NetWinder. Information about this machine can be found at: |
diff --git a/arch/arm/mach-imx/clk-imx35.c b/arch/arm/mach-imx/clk-imx35.c index 74e3a34d78b8..e13a8fa5e62c 100644 --- a/arch/arm/mach-imx/clk-imx35.c +++ b/arch/arm/mach-imx/clk-imx35.c | |||
@@ -264,6 +264,7 @@ int __init mx35_clocks_init(void) | |||
264 | clk_prepare_enable(clk[gpio3_gate]); | 264 | clk_prepare_enable(clk[gpio3_gate]); |
265 | clk_prepare_enable(clk[iim_gate]); | 265 | clk_prepare_enable(clk[iim_gate]); |
266 | clk_prepare_enable(clk[emi_gate]); | 266 | clk_prepare_enable(clk[emi_gate]); |
267 | clk_prepare_enable(clk[max_gate]); | ||
267 | 268 | ||
268 | /* | 269 | /* |
269 | * SCC is needed to boot via mmc after a watchdog reset. The clock code | 270 | * SCC is needed to boot via mmc after a watchdog reset. The clock code |
diff --git a/arch/arm/mach-imx/clk-imx6q.c b/arch/arm/mach-imx/clk-imx6q.c index 7b025ee528a5..2f9ff93a4e61 100644 --- a/arch/arm/mach-imx/clk-imx6q.c +++ b/arch/arm/mach-imx/clk-imx6q.c | |||
@@ -172,7 +172,7 @@ static struct clk *clk[clk_max]; | |||
172 | static struct clk_onecell_data clk_data; | 172 | static struct clk_onecell_data clk_data; |
173 | 173 | ||
174 | static enum mx6q_clks const clks_init_on[] __initconst = { | 174 | static enum mx6q_clks const clks_init_on[] __initconst = { |
175 | mmdc_ch0_axi, rom, | 175 | mmdc_ch0_axi, rom, pll1_sys, |
176 | }; | 176 | }; |
177 | 177 | ||
178 | static struct clk_div_table clk_enet_ref_table[] = { | 178 | static struct clk_div_table clk_enet_ref_table[] = { |
diff --git a/arch/arm/mach-imx/headsmp.S b/arch/arm/mach-imx/headsmp.S index 921fc1555854..a58c8b0527cc 100644 --- a/arch/arm/mach-imx/headsmp.S +++ b/arch/arm/mach-imx/headsmp.S | |||
@@ -26,16 +26,16 @@ ENDPROC(v7_secondary_startup) | |||
26 | 26 | ||
27 | #ifdef CONFIG_PM | 27 | #ifdef CONFIG_PM |
28 | /* | 28 | /* |
29 | * The following code is located into the .data section. This is to | 29 | * The following code must assume it is running from physical address |
30 | * allow phys_l2x0_saved_regs to be accessed with a relative load | 30 | * where absolute virtual addresses to the data section have to be |
31 | * as we are running on physical address here. | 31 | * turned into relative ones. |
32 | */ | 32 | */ |
33 | .data | ||
34 | .align | ||
35 | 33 | ||
36 | #ifdef CONFIG_CACHE_L2X0 | 34 | #ifdef CONFIG_CACHE_L2X0 |
37 | .macro pl310_resume | 35 | .macro pl310_resume |
38 | ldr r2, phys_l2x0_saved_regs | 36 | adr r0, l2x0_saved_regs_offset |
37 | ldr r2, [r0] | ||
38 | add r2, r2, r0 | ||
39 | ldr r0, [r2, #L2X0_R_PHY_BASE] @ get physical base of l2x0 | 39 | ldr r0, [r2, #L2X0_R_PHY_BASE] @ get physical base of l2x0 |
40 | ldr r1, [r2, #L2X0_R_AUX_CTRL] @ get aux_ctrl value | 40 | ldr r1, [r2, #L2X0_R_AUX_CTRL] @ get aux_ctrl value |
41 | str r1, [r0, #L2X0_AUX_CTRL] @ restore aux_ctrl | 41 | str r1, [r0, #L2X0_AUX_CTRL] @ restore aux_ctrl |
@@ -43,9 +43,9 @@ ENDPROC(v7_secondary_startup) | |||
43 | str r1, [r0, #L2X0_CTRL] @ re-enable L2 | 43 | str r1, [r0, #L2X0_CTRL] @ re-enable L2 |
44 | .endm | 44 | .endm |
45 | 45 | ||
46 | .globl phys_l2x0_saved_regs | 46 | l2x0_saved_regs_offset: |
47 | phys_l2x0_saved_regs: | 47 | .word l2x0_saved_regs - . |
48 | .long 0 | 48 | |
49 | #else | 49 | #else |
50 | .macro pl310_resume | 50 | .macro pl310_resume |
51 | .endm | 51 | .endm |
diff --git a/arch/arm/mach-imx/imx25-dt.c b/arch/arm/mach-imx/imx25-dt.c index 03b65e5ea541..82348391582a 100644 --- a/arch/arm/mach-imx/imx25-dt.c +++ b/arch/arm/mach-imx/imx25-dt.c | |||
@@ -27,6 +27,11 @@ static const char * const imx25_dt_board_compat[] __initconst = { | |||
27 | NULL | 27 | NULL |
28 | }; | 28 | }; |
29 | 29 | ||
30 | static void __init imx25_timer_init(void) | ||
31 | { | ||
32 | mx25_clocks_init_dt(); | ||
33 | } | ||
34 | |||
30 | DT_MACHINE_START(IMX25_DT, "Freescale i.MX25 (Device Tree Support)") | 35 | DT_MACHINE_START(IMX25_DT, "Freescale i.MX25 (Device Tree Support)") |
31 | .map_io = mx25_map_io, | 36 | .map_io = mx25_map_io, |
32 | .init_early = imx25_init_early, | 37 | .init_early = imx25_init_early, |
diff --git a/arch/arm/mach-imx/pm-imx6q.c b/arch/arm/mach-imx/pm-imx6q.c index ee42d20cba19..5faba7a3c95f 100644 --- a/arch/arm/mach-imx/pm-imx6q.c +++ b/arch/arm/mach-imx/pm-imx6q.c | |||
@@ -22,8 +22,6 @@ | |||
22 | #include "common.h" | 22 | #include "common.h" |
23 | #include "hardware.h" | 23 | #include "hardware.h" |
24 | 24 | ||
25 | extern unsigned long phys_l2x0_saved_regs; | ||
26 | |||
27 | static int imx6q_suspend_finish(unsigned long val) | 25 | static int imx6q_suspend_finish(unsigned long val) |
28 | { | 26 | { |
29 | cpu_do_idle(); | 27 | cpu_do_idle(); |
@@ -57,18 +55,5 @@ static const struct platform_suspend_ops imx6q_pm_ops = { | |||
57 | 55 | ||
58 | void __init imx6q_pm_init(void) | 56 | void __init imx6q_pm_init(void) |
59 | { | 57 | { |
60 | /* | ||
61 | * The l2x0 core code provides an infrastucture to save and restore | ||
62 | * l2x0 registers across suspend/resume cycle. But because imx6q | ||
63 | * retains L2 content during suspend and needs to resume L2 before | ||
64 | * MMU is enabled, it can only utilize register saving support and | ||
65 | * have to take care of restoring on its own. So we save physical | ||
66 | * address of the data structure used by l2x0 core to save registers, | ||
67 | * and later restore the necessary ones in imx6q resume entry. | ||
68 | */ | ||
69 | #ifdef CONFIG_CACHE_L2X0 | ||
70 | phys_l2x0_saved_regs = __pa(&l2x0_saved_regs); | ||
71 | #endif | ||
72 | |||
73 | suspend_set_ops(&imx6q_pm_ops); | 58 | suspend_set_ops(&imx6q_pm_ops); |
74 | } | 59 | } |
diff --git a/arch/arm/mach-ixp4xx/vulcan-setup.c b/arch/arm/mach-ixp4xx/vulcan-setup.c index d42730a1d4ab..d599e354ca57 100644 --- a/arch/arm/mach-ixp4xx/vulcan-setup.c +++ b/arch/arm/mach-ixp4xx/vulcan-setup.c | |||
@@ -163,6 +163,7 @@ static struct platform_device vulcan_max6369 = { | |||
163 | 163 | ||
164 | static struct w1_gpio_platform_data vulcan_w1_gpio_pdata = { | 164 | static struct w1_gpio_platform_data vulcan_w1_gpio_pdata = { |
165 | .pin = 14, | 165 | .pin = 14, |
166 | .ext_pullup_enable_pin = -EINVAL, | ||
166 | }; | 167 | }; |
167 | 168 | ||
168 | static struct platform_device vulcan_w1_gpio = { | 169 | static struct platform_device vulcan_w1_gpio = { |
diff --git a/arch/arm/mach-kirkwood/Makefile b/arch/arm/mach-kirkwood/Makefile index 4cc4bee4d0cf..d805f8078fa3 100644 --- a/arch/arm/mach-kirkwood/Makefile +++ b/arch/arm/mach-kirkwood/Makefile | |||
@@ -1,4 +1,4 @@ | |||
1 | obj-y += common.o addr-map.o irq.o pcie.o mpp.o | 1 | obj-y += common.o irq.o pcie.o mpp.o |
2 | 2 | ||
3 | obj-$(CONFIG_MACH_DB88F6281_BP) += db88f6281-bp-setup.o | 3 | obj-$(CONFIG_MACH_DB88F6281_BP) += db88f6281-bp-setup.o |
4 | obj-$(CONFIG_MACH_RD88F6192_NAS) += rd88f6192-nas-setup.o | 4 | obj-$(CONFIG_MACH_RD88F6192_NAS) += rd88f6192-nas-setup.o |
diff --git a/arch/arm/mach-kirkwood/addr-map.c b/arch/arm/mach-kirkwood/addr-map.c deleted file mode 100644 index 8f0d162a1e1d..000000000000 --- a/arch/arm/mach-kirkwood/addr-map.c +++ /dev/null | |||
@@ -1,91 +0,0 @@ | |||
1 | /* | ||
2 | * arch/arm/mach-kirkwood/addr-map.c | ||
3 | * | ||
4 | * Address map functions for Marvell Kirkwood SoCs | ||
5 | * | ||
6 | * This file is licensed under the terms of the GNU General Public | ||
7 | * License version 2. This program is licensed "as is" without any | ||
8 | * warranty of any kind, whether express or implied. | ||
9 | */ | ||
10 | |||
11 | #include <linux/kernel.h> | ||
12 | #include <linux/init.h> | ||
13 | #include <linux/mbus.h> | ||
14 | #include <linux/io.h> | ||
15 | #include <mach/hardware.h> | ||
16 | #include <plat/addr-map.h> | ||
17 | #include "common.h" | ||
18 | |||
19 | /* | ||
20 | * Generic Address Decode Windows bit settings | ||
21 | */ | ||
22 | #define TARGET_DEV_BUS 1 | ||
23 | #define TARGET_SRAM 3 | ||
24 | #define TARGET_PCIE 4 | ||
25 | #define ATTR_DEV_SPI_ROM 0x1e | ||
26 | #define ATTR_DEV_BOOT 0x1d | ||
27 | #define ATTR_DEV_NAND 0x2f | ||
28 | #define ATTR_DEV_CS3 0x37 | ||
29 | #define ATTR_DEV_CS2 0x3b | ||
30 | #define ATTR_DEV_CS1 0x3d | ||
31 | #define ATTR_DEV_CS0 0x3e | ||
32 | #define ATTR_PCIE_IO 0xe0 | ||
33 | #define ATTR_PCIE_MEM 0xe8 | ||
34 | #define ATTR_PCIE1_IO 0xd0 | ||
35 | #define ATTR_PCIE1_MEM 0xd8 | ||
36 | #define ATTR_SRAM 0x01 | ||
37 | |||
38 | /* | ||
39 | * Description of the windows needed by the platform code | ||
40 | */ | ||
41 | static struct __initdata orion_addr_map_cfg addr_map_cfg = { | ||
42 | .num_wins = 8, | ||
43 | .remappable_wins = 4, | ||
44 | .bridge_virt_base = BRIDGE_VIRT_BASE, | ||
45 | }; | ||
46 | |||
47 | static const struct __initdata orion_addr_map_info addr_map_info[] = { | ||
48 | /* | ||
49 | * Windows for PCIe IO+MEM space. | ||
50 | */ | ||
51 | { 0, KIRKWOOD_PCIE_IO_PHYS_BASE, KIRKWOOD_PCIE_IO_SIZE, | ||
52 | TARGET_PCIE, ATTR_PCIE_IO, KIRKWOOD_PCIE_IO_BUS_BASE | ||
53 | }, | ||
54 | { 1, KIRKWOOD_PCIE_MEM_PHYS_BASE, KIRKWOOD_PCIE_MEM_SIZE, | ||
55 | TARGET_PCIE, ATTR_PCIE_MEM, KIRKWOOD_PCIE_MEM_BUS_BASE | ||
56 | }, | ||
57 | { 2, KIRKWOOD_PCIE1_IO_PHYS_BASE, KIRKWOOD_PCIE1_IO_SIZE, | ||
58 | TARGET_PCIE, ATTR_PCIE1_IO, KIRKWOOD_PCIE1_IO_BUS_BASE | ||
59 | }, | ||
60 | { 3, KIRKWOOD_PCIE1_MEM_PHYS_BASE, KIRKWOOD_PCIE1_MEM_SIZE, | ||
61 | TARGET_PCIE, ATTR_PCIE1_MEM, KIRKWOOD_PCIE1_MEM_BUS_BASE | ||
62 | }, | ||
63 | /* | ||
64 | * Window for NAND controller. | ||
65 | */ | ||
66 | { 4, KIRKWOOD_NAND_MEM_PHYS_BASE, KIRKWOOD_NAND_MEM_SIZE, | ||
67 | TARGET_DEV_BUS, ATTR_DEV_NAND, -1 | ||
68 | }, | ||
69 | /* | ||
70 | * Window for SRAM. | ||
71 | */ | ||
72 | { 5, KIRKWOOD_SRAM_PHYS_BASE, KIRKWOOD_SRAM_SIZE, | ||
73 | TARGET_SRAM, ATTR_SRAM, -1 | ||
74 | }, | ||
75 | /* End marker */ | ||
76 | { -1, 0, 0, 0, 0, 0 } | ||
77 | }; | ||
78 | |||
79 | void __init kirkwood_setup_cpu_mbus(void) | ||
80 | { | ||
81 | /* | ||
82 | * Disable, clear and configure windows. | ||
83 | */ | ||
84 | orion_config_wins(&addr_map_cfg, addr_map_info); | ||
85 | |||
86 | /* | ||
87 | * Setup MBUS dram target info. | ||
88 | */ | ||
89 | orion_setup_cpu_mbus_target(&addr_map_cfg, | ||
90 | (void __iomem *) DDR_WINDOW_CPU_BASE); | ||
91 | } | ||
diff --git a/arch/arm/mach-kirkwood/board-dt.c b/arch/arm/mach-kirkwood/board-dt.c index d367aa6b47bb..f5437c27dc2a 100644 --- a/arch/arm/mach-kirkwood/board-dt.c +++ b/arch/arm/mach-kirkwood/board-dt.c | |||
@@ -93,7 +93,7 @@ static void __init kirkwood_dt_init(void) | |||
93 | */ | 93 | */ |
94 | writel(readl(CPU_CONFIG) & ~CPU_CONFIG_ERROR_PROP, CPU_CONFIG); | 94 | writel(readl(CPU_CONFIG) & ~CPU_CONFIG_ERROR_PROP, CPU_CONFIG); |
95 | 95 | ||
96 | kirkwood_setup_cpu_mbus(); | 96 | kirkwood_setup_wins(); |
97 | 97 | ||
98 | kirkwood_l2_init(); | 98 | kirkwood_l2_init(); |
99 | 99 | ||
diff --git a/arch/arm/mach-kirkwood/common.c b/arch/arm/mach-kirkwood/common.c index 49792a0cd2d3..c2cae69e6d2b 100644 --- a/arch/arm/mach-kirkwood/common.c +++ b/arch/arm/mach-kirkwood/common.c | |||
@@ -33,7 +33,6 @@ | |||
33 | #include <linux/platform_data/usb-ehci-orion.h> | 33 | #include <linux/platform_data/usb-ehci-orion.h> |
34 | #include <plat/common.h> | 34 | #include <plat/common.h> |
35 | #include <plat/time.h> | 35 | #include <plat/time.h> |
36 | #include <plat/addr-map.h> | ||
37 | #include <linux/platform_data/dma-mv_xor.h> | 36 | #include <linux/platform_data/dma-mv_xor.h> |
38 | #include "common.h" | 37 | #include "common.h" |
39 | 38 | ||
@@ -535,6 +534,9 @@ void __init kirkwood_init_early(void) | |||
535 | * the allocations won't fail. | 534 | * the allocations won't fail. |
536 | */ | 535 | */ |
537 | init_dma_coherent_pool_size(SZ_1M); | 536 | init_dma_coherent_pool_size(SZ_1M); |
537 | mvebu_mbus_init("marvell,kirkwood-mbus", | ||
538 | BRIDGE_WINS_BASE, BRIDGE_WINS_SZ, | ||
539 | DDR_WINDOW_CPU_BASE, DDR_WINDOW_CPU_SZ); | ||
538 | } | 540 | } |
539 | 541 | ||
540 | int kirkwood_tclk; | 542 | int kirkwood_tclk; |
@@ -650,6 +652,38 @@ char * __init kirkwood_id(void) | |||
650 | } | 652 | } |
651 | } | 653 | } |
652 | 654 | ||
655 | void __init kirkwood_setup_wins(void) | ||
656 | { | ||
657 | /* | ||
658 | * The PCIe windows will no longer be statically allocated | ||
659 | * here once Kirkwood is migrated to the pci-mvebu driver. | ||
660 | */ | ||
661 | mvebu_mbus_add_window_remap_flags("pcie0.0", | ||
662 | KIRKWOOD_PCIE_IO_PHYS_BASE, | ||
663 | KIRKWOOD_PCIE_IO_SIZE, | ||
664 | KIRKWOOD_PCIE_IO_BUS_BASE, | ||
665 | MVEBU_MBUS_PCI_IO); | ||
666 | mvebu_mbus_add_window_remap_flags("pcie0.0", | ||
667 | KIRKWOOD_PCIE_MEM_PHYS_BASE, | ||
668 | KIRKWOOD_PCIE_MEM_SIZE, | ||
669 | MVEBU_MBUS_NO_REMAP, | ||
670 | MVEBU_MBUS_PCI_MEM); | ||
671 | mvebu_mbus_add_window_remap_flags("pcie1.0", | ||
672 | KIRKWOOD_PCIE1_IO_PHYS_BASE, | ||
673 | KIRKWOOD_PCIE1_IO_SIZE, | ||
674 | KIRKWOOD_PCIE1_IO_BUS_BASE, | ||
675 | MVEBU_MBUS_PCI_IO); | ||
676 | mvebu_mbus_add_window_remap_flags("pcie1.0", | ||
677 | KIRKWOOD_PCIE1_MEM_PHYS_BASE, | ||
678 | KIRKWOOD_PCIE1_MEM_SIZE, | ||
679 | MVEBU_MBUS_NO_REMAP, | ||
680 | MVEBU_MBUS_PCI_MEM); | ||
681 | mvebu_mbus_add_window("nand", KIRKWOOD_NAND_MEM_PHYS_BASE, | ||
682 | KIRKWOOD_NAND_MEM_SIZE); | ||
683 | mvebu_mbus_add_window("sram", KIRKWOOD_SRAM_PHYS_BASE, | ||
684 | KIRKWOOD_SRAM_SIZE); | ||
685 | } | ||
686 | |||
653 | void __init kirkwood_l2_init(void) | 687 | void __init kirkwood_l2_init(void) |
654 | { | 688 | { |
655 | #ifdef CONFIG_CACHE_FEROCEON_L2 | 689 | #ifdef CONFIG_CACHE_FEROCEON_L2 |
@@ -675,7 +709,7 @@ void __init kirkwood_init(void) | |||
675 | */ | 709 | */ |
676 | writel(readl(CPU_CONFIG) & ~CPU_CONFIG_ERROR_PROP, CPU_CONFIG); | 710 | writel(readl(CPU_CONFIG) & ~CPU_CONFIG_ERROR_PROP, CPU_CONFIG); |
677 | 711 | ||
678 | kirkwood_setup_cpu_mbus(); | 712 | kirkwood_setup_wins(); |
679 | 713 | ||
680 | kirkwood_l2_init(); | 714 | kirkwood_l2_init(); |
681 | 715 | ||
diff --git a/arch/arm/mach-kirkwood/common.h b/arch/arm/mach-kirkwood/common.h index 5ed70565c843..e24f74305b34 100644 --- a/arch/arm/mach-kirkwood/common.h +++ b/arch/arm/mach-kirkwood/common.h | |||
@@ -30,7 +30,7 @@ void kirkwood_init(void); | |||
30 | void kirkwood_init_early(void); | 30 | void kirkwood_init_early(void); |
31 | void kirkwood_init_irq(void); | 31 | void kirkwood_init_irq(void); |
32 | 32 | ||
33 | void kirkwood_setup_cpu_mbus(void); | 33 | void kirkwood_setup_wins(void); |
34 | 34 | ||
35 | void kirkwood_enable_pcie(void); | 35 | void kirkwood_enable_pcie(void); |
36 | void kirkwood_pcie_id(u32 *dev, u32 *rev); | 36 | void kirkwood_pcie_id(u32 *dev, u32 *rev); |
diff --git a/arch/arm/mach-kirkwood/include/mach/kirkwood.h b/arch/arm/mach-kirkwood/include/mach/kirkwood.h index a05563a31c95..92976cef3910 100644 --- a/arch/arm/mach-kirkwood/include/mach/kirkwood.h +++ b/arch/arm/mach-kirkwood/include/mach/kirkwood.h | |||
@@ -60,8 +60,9 @@ | |||
60 | * Register Map | 60 | * Register Map |
61 | */ | 61 | */ |
62 | #define DDR_VIRT_BASE (KIRKWOOD_REGS_VIRT_BASE + 0x00000) | 62 | #define DDR_VIRT_BASE (KIRKWOOD_REGS_VIRT_BASE + 0x00000) |
63 | #define DDR_PHYS_BASE (KIRKWOOD_REGS_PHYS_BASE + 0x00000) | 63 | #define DDR_PHYS_BASE (KIRKWOOD_REGS_PHYS_BASE + 0x00000) |
64 | #define DDR_WINDOW_CPU_BASE (DDR_VIRT_BASE + 0x1500) | 64 | #define DDR_WINDOW_CPU_BASE (DDR_PHYS_BASE + 0x1500) |
65 | #define DDR_WINDOW_CPU_SZ (0x20) | ||
65 | #define DDR_OPERATION_BASE (DDR_PHYS_BASE + 0x1418) | 66 | #define DDR_OPERATION_BASE (DDR_PHYS_BASE + 0x1418) |
66 | 67 | ||
67 | #define DEV_BUS_PHYS_BASE (KIRKWOOD_REGS_PHYS_BASE + 0x10000) | 68 | #define DEV_BUS_PHYS_BASE (KIRKWOOD_REGS_PHYS_BASE + 0x10000) |
@@ -80,6 +81,8 @@ | |||
80 | 81 | ||
81 | #define BRIDGE_VIRT_BASE (KIRKWOOD_REGS_VIRT_BASE + 0x20000) | 82 | #define BRIDGE_VIRT_BASE (KIRKWOOD_REGS_VIRT_BASE + 0x20000) |
82 | #define BRIDGE_PHYS_BASE (KIRKWOOD_REGS_PHYS_BASE + 0x20000) | 83 | #define BRIDGE_PHYS_BASE (KIRKWOOD_REGS_PHYS_BASE + 0x20000) |
84 | #define BRIDGE_WINS_BASE (BRIDGE_PHYS_BASE) | ||
85 | #define BRIDGE_WINS_SZ (0x80) | ||
83 | 86 | ||
84 | #define CRYPTO_PHYS_BASE (KIRKWOOD_REGS_PHYS_BASE + 0x30000) | 87 | #define CRYPTO_PHYS_BASE (KIRKWOOD_REGS_PHYS_BASE + 0x30000) |
85 | 88 | ||
diff --git a/arch/arm/mach-kirkwood/pcie.c b/arch/arm/mach-kirkwood/pcie.c index d96ad4c09972..7f43e6c2f8c0 100644 --- a/arch/arm/mach-kirkwood/pcie.c +++ b/arch/arm/mach-kirkwood/pcie.c | |||
@@ -17,7 +17,6 @@ | |||
17 | #include <asm/mach/pci.h> | 17 | #include <asm/mach/pci.h> |
18 | #include <plat/pcie.h> | 18 | #include <plat/pcie.h> |
19 | #include <mach/bridge-regs.h> | 19 | #include <mach/bridge-regs.h> |
20 | #include <plat/addr-map.h> | ||
21 | #include "common.h" | 20 | #include "common.h" |
22 | 21 | ||
23 | static void kirkwood_enable_pcie_clk(const char *port) | 22 | static void kirkwood_enable_pcie_clk(const char *port) |
diff --git a/arch/arm/mach-mmp/gplugd.c b/arch/arm/mach-mmp/gplugd.c index d1e2d595e79c..f62b68d926f4 100644 --- a/arch/arm/mach-mmp/gplugd.c +++ b/arch/arm/mach-mmp/gplugd.c | |||
@@ -9,6 +9,7 @@ | |||
9 | */ | 9 | */ |
10 | 10 | ||
11 | #include <linux/init.h> | 11 | #include <linux/init.h> |
12 | #include <linux/platform_device.h> | ||
12 | #include <linux/gpio.h> | 13 | #include <linux/gpio.h> |
13 | 14 | ||
14 | #include <asm/mach/arch.h> | 15 | #include <asm/mach/arch.h> |
diff --git a/arch/arm/mach-mv78xx0/Makefile b/arch/arm/mach-mv78xx0/Makefile index 67a13f9bfe64..7cd04634d302 100644 --- a/arch/arm/mach-mv78xx0/Makefile +++ b/arch/arm/mach-mv78xx0/Makefile | |||
@@ -1,4 +1,4 @@ | |||
1 | obj-y += common.o addr-map.o mpp.o irq.o pcie.o | 1 | obj-y += common.o mpp.o irq.o pcie.o |
2 | obj-$(CONFIG_MACH_DB78X00_BP) += db78x00-bp-setup.o | 2 | obj-$(CONFIG_MACH_DB78X00_BP) += db78x00-bp-setup.o |
3 | obj-$(CONFIG_MACH_RD78X00_MASA) += rd78x00-masa-setup.o | 3 | obj-$(CONFIG_MACH_RD78X00_MASA) += rd78x00-masa-setup.o |
4 | obj-$(CONFIG_MACH_TERASTATION_WXL) += buffalo-wxl-setup.o | 4 | obj-$(CONFIG_MACH_TERASTATION_WXL) += buffalo-wxl-setup.o |
diff --git a/arch/arm/mach-mv78xx0/addr-map.c b/arch/arm/mach-mv78xx0/addr-map.c deleted file mode 100644 index 26e9876b50e9..000000000000 --- a/arch/arm/mach-mv78xx0/addr-map.c +++ /dev/null | |||
@@ -1,93 +0,0 @@ | |||
1 | /* | ||
2 | * arch/arm/mach-mv78xx0/addr-map.c | ||
3 | * | ||
4 | * Address map functions for Marvell MV78xx0 SoCs | ||
5 | * | ||
6 | * This file is licensed under the terms of the GNU General Public | ||
7 | * License version 2. This program is licensed "as is" without any | ||
8 | * warranty of any kind, whether express or implied. | ||
9 | */ | ||
10 | |||
11 | #include <linux/kernel.h> | ||
12 | #include <linux/init.h> | ||
13 | #include <linux/mbus.h> | ||
14 | #include <linux/io.h> | ||
15 | #include <plat/addr-map.h> | ||
16 | #include <mach/mv78xx0.h> | ||
17 | #include "common.h" | ||
18 | |||
19 | /* | ||
20 | * Generic Address Decode Windows bit settings | ||
21 | */ | ||
22 | #define TARGET_DEV_BUS 1 | ||
23 | #define TARGET_PCIE0 4 | ||
24 | #define TARGET_PCIE1 8 | ||
25 | #define TARGET_PCIE(i) ((i) ? TARGET_PCIE1 : TARGET_PCIE0) | ||
26 | #define ATTR_DEV_SPI_ROM 0x1f | ||
27 | #define ATTR_DEV_BOOT 0x2f | ||
28 | #define ATTR_DEV_CS3 0x37 | ||
29 | #define ATTR_DEV_CS2 0x3b | ||
30 | #define ATTR_DEV_CS1 0x3d | ||
31 | #define ATTR_DEV_CS0 0x3e | ||
32 | #define ATTR_PCIE_IO(l) (0xf0 & ~(0x10 << (l))) | ||
33 | #define ATTR_PCIE_MEM(l) (0xf8 & ~(0x10 << (l))) | ||
34 | |||
35 | /* | ||
36 | * CPU Address Decode Windows registers | ||
37 | */ | ||
38 | #define WIN0_OFF(n) (BRIDGE_VIRT_BASE + 0x0000 + ((n) << 4)) | ||
39 | #define WIN8_OFF(n) (BRIDGE_VIRT_BASE + 0x0900 + (((n) - 8) << 4)) | ||
40 | |||
41 | static void __init __iomem *win_cfg_base(const struct orion_addr_map_cfg *cfg, int win) | ||
42 | { | ||
43 | /* | ||
44 | * Find the control register base address for this window. | ||
45 | * | ||
46 | * BRIDGE_VIRT_BASE points to the right (CPU0's or CPU1's) | ||
47 | * MBUS bridge depending on which CPU core we're running on, | ||
48 | * so we don't need to take that into account here. | ||
49 | */ | ||
50 | |||
51 | return (win < 8) ? WIN0_OFF(win) : WIN8_OFF(win); | ||
52 | } | ||
53 | |||
54 | /* | ||
55 | * Description of the windows needed by the platform code | ||
56 | */ | ||
57 | static struct orion_addr_map_cfg addr_map_cfg __initdata = { | ||
58 | .num_wins = 14, | ||
59 | .remappable_wins = 8, | ||
60 | .win_cfg_base = win_cfg_base, | ||
61 | }; | ||
62 | |||
63 | void __init mv78xx0_setup_cpu_mbus(void) | ||
64 | { | ||
65 | /* | ||
66 | * Disable, clear and configure windows. | ||
67 | */ | ||
68 | orion_config_wins(&addr_map_cfg, NULL); | ||
69 | |||
70 | /* | ||
71 | * Setup MBUS dram target info. | ||
72 | */ | ||
73 | if (mv78xx0_core_index() == 0) | ||
74 | orion_setup_cpu_mbus_target(&addr_map_cfg, | ||
75 | (void __iomem *) DDR_WINDOW_CPU0_BASE); | ||
76 | else | ||
77 | orion_setup_cpu_mbus_target(&addr_map_cfg, | ||
78 | (void __iomem *) DDR_WINDOW_CPU1_BASE); | ||
79 | } | ||
80 | |||
81 | void __init mv78xx0_setup_pcie_io_win(int window, u32 base, u32 size, | ||
82 | int maj, int min) | ||
83 | { | ||
84 | orion_setup_cpu_win(&addr_map_cfg, window, base, size, | ||
85 | TARGET_PCIE(maj), ATTR_PCIE_IO(min), 0); | ||
86 | } | ||
87 | |||
88 | void __init mv78xx0_setup_pcie_mem_win(int window, u32 base, u32 size, | ||
89 | int maj, int min) | ||
90 | { | ||
91 | orion_setup_cpu_win(&addr_map_cfg, window, base, size, | ||
92 | TARGET_PCIE(maj), ATTR_PCIE_MEM(min), -1); | ||
93 | } | ||
diff --git a/arch/arm/mach-mv78xx0/common.c b/arch/arm/mach-mv78xx0/common.c index 0efa14498ebc..749a7f8c4992 100644 --- a/arch/arm/mach-mv78xx0/common.c +++ b/arch/arm/mach-mv78xx0/common.c | |||
@@ -334,6 +334,14 @@ void __init mv78xx0_uart3_init(void) | |||
334 | void __init mv78xx0_init_early(void) | 334 | void __init mv78xx0_init_early(void) |
335 | { | 335 | { |
336 | orion_time_set_base(TIMER_VIRT_BASE); | 336 | orion_time_set_base(TIMER_VIRT_BASE); |
337 | if (mv78xx0_core_index() == 0) | ||
338 | mvebu_mbus_init("marvell,mv78xx0-mbus", | ||
339 | BRIDGE_WINS_CPU0_BASE, BRIDGE_WINS_SZ, | ||
340 | DDR_WINDOW_CPU0_BASE, DDR_WINDOW_CPU_SZ); | ||
341 | else | ||
342 | mvebu_mbus_init("marvell,mv78xx0-mbus", | ||
343 | BRIDGE_WINS_CPU1_BASE, BRIDGE_WINS_SZ, | ||
344 | DDR_WINDOW_CPU1_BASE, DDR_WINDOW_CPU_SZ); | ||
337 | } | 345 | } |
338 | 346 | ||
339 | void __init_refok mv78xx0_timer_init(void) | 347 | void __init_refok mv78xx0_timer_init(void) |
@@ -397,8 +405,6 @@ void __init mv78xx0_init(void) | |||
397 | printk("HCLK = %dMHz, ", (hclk + 499999) / 1000000); | 405 | printk("HCLK = %dMHz, ", (hclk + 499999) / 1000000); |
398 | printk("TCLK = %dMHz\n", (get_tclk() + 499999) / 1000000); | 406 | printk("TCLK = %dMHz\n", (get_tclk() + 499999) / 1000000); |
399 | 407 | ||
400 | mv78xx0_setup_cpu_mbus(); | ||
401 | |||
402 | #ifdef CONFIG_CACHE_FEROCEON_L2 | 408 | #ifdef CONFIG_CACHE_FEROCEON_L2 |
403 | feroceon_l2_init(is_l2_writethrough()); | 409 | feroceon_l2_init(is_l2_writethrough()); |
404 | #endif | 410 | #endif |
diff --git a/arch/arm/mach-mv78xx0/include/mach/mv78xx0.h b/arch/arm/mach-mv78xx0/include/mach/mv78xx0.h index 46200a183cf2..723748d8ba7d 100644 --- a/arch/arm/mach-mv78xx0/include/mach/mv78xx0.h +++ b/arch/arm/mach-mv78xx0/include/mach/mv78xx0.h | |||
@@ -60,13 +60,18 @@ | |||
60 | */ | 60 | */ |
61 | #define BRIDGE_VIRT_BASE (MV78XX0_CORE_REGS_VIRT_BASE) | 61 | #define BRIDGE_VIRT_BASE (MV78XX0_CORE_REGS_VIRT_BASE) |
62 | #define BRIDGE_PHYS_BASE (MV78XX0_CORE_REGS_PHYS_BASE) | 62 | #define BRIDGE_PHYS_BASE (MV78XX0_CORE_REGS_PHYS_BASE) |
63 | #define BRIDGE_WINS_CPU0_BASE (MV78XX0_CORE0_REGS_PHYS_BASE) | ||
64 | #define BRIDGE_WINS_CPU1_BASE (MV78XX0_CORE1_REGS_PHYS_BASE) | ||
65 | #define BRIDGE_WINS_SZ (0xA000) | ||
63 | 66 | ||
64 | /* | 67 | /* |
65 | * Register Map | 68 | * Register Map |
66 | */ | 69 | */ |
67 | #define DDR_VIRT_BASE (MV78XX0_REGS_VIRT_BASE + 0x00000) | 70 | #define DDR_VIRT_BASE (MV78XX0_REGS_VIRT_BASE + 0x00000) |
68 | #define DDR_WINDOW_CPU0_BASE (DDR_VIRT_BASE + 0x1500) | 71 | #define DDR_PHYS_BASE (MV78XX0_REGS_PHYS_BASE + 0x00000) |
69 | #define DDR_WINDOW_CPU1_BASE (DDR_VIRT_BASE + 0x1570) | 72 | #define DDR_WINDOW_CPU0_BASE (DDR_PHYS_BASE + 0x1500) |
73 | #define DDR_WINDOW_CPU1_BASE (DDR_PHYS_BASE + 0x1570) | ||
74 | #define DDR_WINDOW_CPU_SZ (0x20) | ||
70 | 75 | ||
71 | #define DEV_BUS_PHYS_BASE (MV78XX0_REGS_PHYS_BASE + 0x10000) | 76 | #define DEV_BUS_PHYS_BASE (MV78XX0_REGS_PHYS_BASE + 0x10000) |
72 | #define DEV_BUS_VIRT_BASE (MV78XX0_REGS_VIRT_BASE + 0x10000) | 77 | #define DEV_BUS_VIRT_BASE (MV78XX0_REGS_VIRT_BASE + 0x10000) |
diff --git a/arch/arm/mach-mv78xx0/pcie.c b/arch/arm/mach-mv78xx0/pcie.c index ee8c0b51df2c..dc26a654c496 100644 --- a/arch/arm/mach-mv78xx0/pcie.c +++ b/arch/arm/mach-mv78xx0/pcie.c | |||
@@ -10,11 +10,11 @@ | |||
10 | 10 | ||
11 | #include <linux/kernel.h> | 11 | #include <linux/kernel.h> |
12 | #include <linux/pci.h> | 12 | #include <linux/pci.h> |
13 | #include <linux/mbus.h> | ||
13 | #include <video/vga.h> | 14 | #include <video/vga.h> |
14 | #include <asm/irq.h> | 15 | #include <asm/irq.h> |
15 | #include <asm/mach/pci.h> | 16 | #include <asm/mach/pci.h> |
16 | #include <plat/pcie.h> | 17 | #include <plat/pcie.h> |
17 | #include <plat/addr-map.h> | ||
18 | #include <mach/mv78xx0.h> | 18 | #include <mach/mv78xx0.h> |
19 | #include "common.h" | 19 | #include "common.h" |
20 | 20 | ||
@@ -54,7 +54,6 @@ static void __init mv78xx0_pcie_preinit(void) | |||
54 | int i; | 54 | int i; |
55 | u32 size_each; | 55 | u32 size_each; |
56 | u32 start; | 56 | u32 start; |
57 | int win = 0; | ||
58 | 57 | ||
59 | pcie_io_space.name = "PCIe I/O Space"; | 58 | pcie_io_space.name = "PCIe I/O Space"; |
60 | pcie_io_space.start = MV78XX0_PCIE_IO_PHYS_BASE(0); | 59 | pcie_io_space.start = MV78XX0_PCIE_IO_PHYS_BASE(0); |
@@ -72,6 +71,7 @@ static void __init mv78xx0_pcie_preinit(void) | |||
72 | start = MV78XX0_PCIE_MEM_PHYS_BASE; | 71 | start = MV78XX0_PCIE_MEM_PHYS_BASE; |
73 | for (i = 0; i < num_pcie_ports; i++) { | 72 | for (i = 0; i < num_pcie_ports; i++) { |
74 | struct pcie_port *pp = pcie_port + i; | 73 | struct pcie_port *pp = pcie_port + i; |
74 | char winname[MVEBU_MBUS_MAX_WINNAME_SZ]; | ||
75 | 75 | ||
76 | snprintf(pp->mem_space_name, sizeof(pp->mem_space_name), | 76 | snprintf(pp->mem_space_name, sizeof(pp->mem_space_name), |
77 | "PCIe %d.%d MEM", pp->maj, pp->min); | 77 | "PCIe %d.%d MEM", pp->maj, pp->min); |
@@ -85,12 +85,17 @@ static void __init mv78xx0_pcie_preinit(void) | |||
85 | if (request_resource(&iomem_resource, &pp->res)) | 85 | if (request_resource(&iomem_resource, &pp->res)) |
86 | panic("can't allocate PCIe MEM sub-space"); | 86 | panic("can't allocate PCIe MEM sub-space"); |
87 | 87 | ||
88 | mv78xx0_setup_pcie_mem_win(win + i + 8, pp->res.start, | 88 | snprintf(winname, sizeof(winname), "pcie%d.%d", |
89 | resource_size(&pp->res), | 89 | pp->maj, pp->min); |
90 | pp->maj, pp->min); | 90 | |
91 | 91 | mvebu_mbus_add_window_remap_flags(winname, | |
92 | mv78xx0_setup_pcie_io_win(win + i, i * SZ_64K, SZ_64K, | 92 | pp->res.start, |
93 | pp->maj, pp->min); | 93 | resource_size(&pp->res), |
94 | MVEBU_MBUS_NO_REMAP, | ||
95 | MVEBU_MBUS_PCI_MEM); | ||
96 | mvebu_mbus_add_window_remap_flags(winname, | ||
97 | i * SZ_64K, SZ_64K, | ||
98 | 0, MVEBU_MBUS_PCI_IO); | ||
94 | } | 99 | } |
95 | } | 100 | } |
96 | 101 | ||
diff --git a/arch/arm/mach-mvebu/Kconfig b/arch/arm/mach-mvebu/Kconfig index 440b13ef1fed..e11acbb0a46d 100644 --- a/arch/arm/mach-mvebu/Kconfig +++ b/arch/arm/mach-mvebu/Kconfig | |||
@@ -13,6 +13,8 @@ config ARCH_MVEBU | |||
13 | select MVEBU_CLK_CORE | 13 | select MVEBU_CLK_CORE |
14 | select MVEBU_CLK_CPU | 14 | select MVEBU_CLK_CPU |
15 | select MVEBU_CLK_GATING | 15 | select MVEBU_CLK_GATING |
16 | select MVEBU_MBUS | ||
17 | select ZONE_DMA if ARM_LPAE | ||
16 | 18 | ||
17 | if ARCH_MVEBU | 19 | if ARCH_MVEBU |
18 | 20 | ||
diff --git a/arch/arm/mach-mvebu/Makefile b/arch/arm/mach-mvebu/Makefile index da93bcbc74c1..ba769e082ad4 100644 --- a/arch/arm/mach-mvebu/Makefile +++ b/arch/arm/mach-mvebu/Makefile | |||
@@ -5,6 +5,6 @@ AFLAGS_coherency_ll.o := -Wa,-march=armv7-a | |||
5 | 5 | ||
6 | obj-y += system-controller.o | 6 | obj-y += system-controller.o |
7 | obj-$(CONFIG_MACH_ARMADA_370_XP) += armada-370-xp.o | 7 | obj-$(CONFIG_MACH_ARMADA_370_XP) += armada-370-xp.o |
8 | obj-$(CONFIG_ARCH_MVEBU) += addr-map.o coherency.o coherency_ll.o pmsu.o irq-armada-370-xp.o | 8 | obj-$(CONFIG_ARCH_MVEBU) += coherency.o coherency_ll.o pmsu.o irq-armada-370-xp.o |
9 | obj-$(CONFIG_SMP) += platsmp.o headsmp.o | 9 | obj-$(CONFIG_SMP) += platsmp.o headsmp.o |
10 | obj-$(CONFIG_HOTPLUG_CPU) += hotplug.o | 10 | obj-$(CONFIG_HOTPLUG_CPU) += hotplug.o |
diff --git a/arch/arm/mach-mvebu/addr-map.c b/arch/arm/mach-mvebu/addr-map.c deleted file mode 100644 index ab9b3bd4fef5..000000000000 --- a/arch/arm/mach-mvebu/addr-map.c +++ /dev/null | |||
@@ -1,137 +0,0 @@ | |||
1 | /* | ||
2 | * Address map functions for Marvell 370 / XP SoCs | ||
3 | * | ||
4 | * Copyright (C) 2012 Marvell | ||
5 | * | ||
6 | * Thomas Petazzoni <thomas.petazzoni@free-electrons.com> | ||
7 | * | ||
8 | * This file is licensed under the terms of the GNU General Public | ||
9 | * License version 2. This program is licensed "as is" without any | ||
10 | * warranty of any kind, whether express or implied. | ||
11 | */ | ||
12 | |||
13 | #include <linux/kernel.h> | ||
14 | #include <linux/init.h> | ||
15 | #include <linux/mbus.h> | ||
16 | #include <linux/io.h> | ||
17 | #include <linux/of.h> | ||
18 | #include <linux/of_address.h> | ||
19 | #include <plat/addr-map.h> | ||
20 | |||
21 | /* | ||
22 | * Generic Address Decode Windows bit settings | ||
23 | */ | ||
24 | #define ARMADA_XP_TARGET_DEV_BUS 1 | ||
25 | #define ARMADA_XP_ATTR_DEV_BOOTROM 0x1D | ||
26 | #define ARMADA_XP_TARGET_ETH1 3 | ||
27 | #define ARMADA_XP_TARGET_PCIE_0_2 4 | ||
28 | #define ARMADA_XP_TARGET_ETH0 7 | ||
29 | #define ARMADA_XP_TARGET_PCIE_1_3 8 | ||
30 | |||
31 | #define ARMADA_370_TARGET_DEV_BUS 1 | ||
32 | #define ARMADA_370_ATTR_DEV_BOOTROM 0x1D | ||
33 | #define ARMADA_370_TARGET_PCIE_0 4 | ||
34 | #define ARMADA_370_TARGET_PCIE_1 8 | ||
35 | |||
36 | #define ARMADA_WINDOW_8_PLUS_OFFSET 0x90 | ||
37 | #define ARMADA_SDRAM_ADDR_DECODING_OFFSET 0x180 | ||
38 | |||
39 | static const struct __initdata orion_addr_map_info | ||
40 | armada_xp_addr_map_info[] = { | ||
41 | /* | ||
42 | * Window for the BootROM, needed for SMP on Armada XP | ||
43 | */ | ||
44 | { 0, 0xfff00000, SZ_1M, ARMADA_XP_TARGET_DEV_BUS, | ||
45 | ARMADA_XP_ATTR_DEV_BOOTROM, -1 }, | ||
46 | /* End marker */ | ||
47 | { -1, 0, 0, 0, 0, 0 }, | ||
48 | }; | ||
49 | |||
50 | static const struct __initdata orion_addr_map_info | ||
51 | armada_370_addr_map_info[] = { | ||
52 | /* End marker */ | ||
53 | { -1, 0, 0, 0, 0, 0 }, | ||
54 | }; | ||
55 | |||
56 | static struct of_device_id of_addr_decoding_controller_table[] = { | ||
57 | { .compatible = "marvell,armada-addr-decoding-controller" }, | ||
58 | { /* end of list */ }, | ||
59 | }; | ||
60 | |||
61 | static void __iomem * | ||
62 | armada_cfg_base(const struct orion_addr_map_cfg *cfg, int win) | ||
63 | { | ||
64 | unsigned int offset; | ||
65 | |||
66 | /* The register layout is a bit annoying and the below code | ||
67 | * tries to cope with it. | ||
68 | * - At offset 0x0, there are the registers for the first 8 | ||
69 | * windows, with 4 registers of 32 bits per window (ctrl, | ||
70 | * base, remap low, remap high) | ||
71 | * - Then at offset 0x80, there is a hole of 0x10 bytes for | ||
72 | * the internal registers base address and internal units | ||
73 | * sync barrier register. | ||
74 | * - Then at offset 0x90, there the registers for 12 | ||
75 | * windows, with only 2 registers of 32 bits per window | ||
76 | * (ctrl, base). | ||
77 | */ | ||
78 | if (win < 8) | ||
79 | offset = (win << 4); | ||
80 | else | ||
81 | offset = ARMADA_WINDOW_8_PLUS_OFFSET + ((win - 8) << 3); | ||
82 | |||
83 | return cfg->bridge_virt_base + offset; | ||
84 | } | ||
85 | |||
86 | static struct __initdata orion_addr_map_cfg addr_map_cfg = { | ||
87 | .num_wins = 20, | ||
88 | .remappable_wins = 8, | ||
89 | .win_cfg_base = armada_cfg_base, | ||
90 | }; | ||
91 | |||
92 | static int __init armada_setup_cpu_mbus(void) | ||
93 | { | ||
94 | struct device_node *np; | ||
95 | void __iomem *mbus_unit_addr_decoding_base; | ||
96 | void __iomem *sdram_addr_decoding_base; | ||
97 | |||
98 | np = of_find_matching_node(NULL, of_addr_decoding_controller_table); | ||
99 | if (!np) | ||
100 | return -ENODEV; | ||
101 | |||
102 | mbus_unit_addr_decoding_base = of_iomap(np, 0); | ||
103 | BUG_ON(!mbus_unit_addr_decoding_base); | ||
104 | |||
105 | sdram_addr_decoding_base = | ||
106 | mbus_unit_addr_decoding_base + | ||
107 | ARMADA_SDRAM_ADDR_DECODING_OFFSET; | ||
108 | |||
109 | addr_map_cfg.bridge_virt_base = mbus_unit_addr_decoding_base; | ||
110 | |||
111 | if (of_find_compatible_node(NULL, NULL, "marvell,coherency-fabric")) | ||
112 | addr_map_cfg.hw_io_coherency = 1; | ||
113 | |||
114 | /* | ||
115 | * Disable, clear and configure windows. | ||
116 | */ | ||
117 | if (of_machine_is_compatible("marvell,armadaxp")) | ||
118 | orion_config_wins(&addr_map_cfg, armada_xp_addr_map_info); | ||
119 | else if (of_machine_is_compatible("marvell,armada370")) | ||
120 | orion_config_wins(&addr_map_cfg, armada_370_addr_map_info); | ||
121 | else { | ||
122 | pr_err("Unsupported SoC\n"); | ||
123 | return -EINVAL; | ||
124 | } | ||
125 | |||
126 | /* | ||
127 | * Setup MBUS dram target info. | ||
128 | */ | ||
129 | orion_setup_cpu_mbus_target(&addr_map_cfg, | ||
130 | sdram_addr_decoding_base); | ||
131 | return 0; | ||
132 | } | ||
133 | |||
134 | /* Using a early_initcall is needed so that this initialization gets | ||
135 | * done before the SMP initialization, which requires the BootROM to | ||
136 | * be remapped. */ | ||
137 | early_initcall(armada_setup_cpu_mbus); | ||
diff --git a/arch/arm/mach-mvebu/armada-370-xp.c b/arch/arm/mach-mvebu/armada-370-xp.c index a5ea616d6d12..12d3655830d1 100644 --- a/arch/arm/mach-mvebu/armada-370-xp.c +++ b/arch/arm/mach-mvebu/armada-370-xp.c | |||
@@ -19,6 +19,7 @@ | |||
19 | #include <linux/time-armada-370-xp.h> | 19 | #include <linux/time-armada-370-xp.h> |
20 | #include <linux/clk/mvebu.h> | 20 | #include <linux/clk/mvebu.h> |
21 | #include <linux/dma-mapping.h> | 21 | #include <linux/dma-mapping.h> |
22 | #include <linux/mbus.h> | ||
22 | #include <asm/mach/arch.h> | 23 | #include <asm/mach/arch.h> |
23 | #include <asm/mach/map.h> | 24 | #include <asm/mach/map.h> |
24 | #include <asm/mach/time.h> | 25 | #include <asm/mach/time.h> |
@@ -48,12 +49,29 @@ void __init armada_370_xp_timer_and_clk_init(void) | |||
48 | 49 | ||
49 | void __init armada_370_xp_init_early(void) | 50 | void __init armada_370_xp_init_early(void) |
50 | { | 51 | { |
52 | char *mbus_soc_name; | ||
53 | |||
51 | /* | 54 | /* |
52 | * Some Armada 370/XP devices allocate their coherent buffers | 55 | * Some Armada 370/XP devices allocate their coherent buffers |
53 | * from atomic context. Increase size of atomic coherent pool | 56 | * from atomic context. Increase size of atomic coherent pool |
54 | * to make sure such the allocations won't fail. | 57 | * to make sure such the allocations won't fail. |
55 | */ | 58 | */ |
56 | init_dma_coherent_pool_size(SZ_1M); | 59 | init_dma_coherent_pool_size(SZ_1M); |
60 | |||
61 | /* | ||
62 | * This initialization will be replaced by a DT-based | ||
63 | * initialization once the mvebu-mbus driver gains DT support. | ||
64 | */ | ||
65 | if (of_machine_is_compatible("marvell,armada370")) | ||
66 | mbus_soc_name = "marvell,armada370-mbus"; | ||
67 | else | ||
68 | mbus_soc_name = "marvell,armadaxp-mbus"; | ||
69 | |||
70 | mvebu_mbus_init(mbus_soc_name, | ||
71 | ARMADA_370_XP_MBUS_WINS_BASE, | ||
72 | ARMADA_370_XP_MBUS_WINS_SIZE, | ||
73 | ARMADA_370_XP_SDRAM_WINS_BASE, | ||
74 | ARMADA_370_XP_SDRAM_WINS_SIZE); | ||
57 | } | 75 | } |
58 | 76 | ||
59 | static void __init armada_370_xp_dt_init(void) | 77 | static void __init armada_370_xp_dt_init(void) |
diff --git a/arch/arm/mach-mvebu/armada-370-xp.h b/arch/arm/mach-mvebu/armada-370-xp.h index c6a7d74fddfe..2070e1b4f342 100644 --- a/arch/arm/mach-mvebu/armada-370-xp.h +++ b/arch/arm/mach-mvebu/armada-370-xp.h | |||
@@ -16,9 +16,15 @@ | |||
16 | #define __MACH_ARMADA_370_XP_H | 16 | #define __MACH_ARMADA_370_XP_H |
17 | 17 | ||
18 | #define ARMADA_370_XP_REGS_PHYS_BASE 0xd0000000 | 18 | #define ARMADA_370_XP_REGS_PHYS_BASE 0xd0000000 |
19 | #define ARMADA_370_XP_REGS_VIRT_BASE IOMEM(0xfeb00000) | 19 | #define ARMADA_370_XP_REGS_VIRT_BASE IOMEM(0xfec00000) |
20 | #define ARMADA_370_XP_REGS_SIZE SZ_1M | 20 | #define ARMADA_370_XP_REGS_SIZE SZ_1M |
21 | 21 | ||
22 | /* These defines can go away once mvebu-mbus has a DT binding */ | ||
23 | #define ARMADA_370_XP_MBUS_WINS_BASE (ARMADA_370_XP_REGS_PHYS_BASE + 0x20000) | ||
24 | #define ARMADA_370_XP_MBUS_WINS_SIZE 0x100 | ||
25 | #define ARMADA_370_XP_SDRAM_WINS_BASE (ARMADA_370_XP_REGS_PHYS_BASE + 0x20180) | ||
26 | #define ARMADA_370_XP_SDRAM_WINS_SIZE 0x20 | ||
27 | |||
22 | #ifdef CONFIG_SMP | 28 | #ifdef CONFIG_SMP |
23 | #include <linux/cpumask.h> | 29 | #include <linux/cpumask.h> |
24 | 30 | ||
diff --git a/arch/arm/mach-mvebu/platsmp.c b/arch/arm/mach-mvebu/platsmp.c index fe16aaf7c19c..875ea748391c 100644 --- a/arch/arm/mach-mvebu/platsmp.c +++ b/arch/arm/mach-mvebu/platsmp.c | |||
@@ -21,6 +21,7 @@ | |||
21 | #include <linux/smp.h> | 21 | #include <linux/smp.h> |
22 | #include <linux/clk.h> | 22 | #include <linux/clk.h> |
23 | #include <linux/of.h> | 23 | #include <linux/of.h> |
24 | #include <linux/mbus.h> | ||
24 | #include <asm/cacheflush.h> | 25 | #include <asm/cacheflush.h> |
25 | #include <asm/smp_plat.h> | 26 | #include <asm/smp_plat.h> |
26 | #include "common.h" | 27 | #include "common.h" |
@@ -109,6 +110,7 @@ void __init armada_xp_smp_prepare_cpus(unsigned int max_cpus) | |||
109 | set_secondary_cpus_clock(); | 110 | set_secondary_cpus_clock(); |
110 | flush_cache_all(); | 111 | flush_cache_all(); |
111 | set_cpu_coherent(cpu_logical_map(smp_processor_id()), 0); | 112 | set_cpu_coherent(cpu_logical_map(smp_processor_id()), 0); |
113 | mvebu_mbus_add_window("bootrom", 0xfff00000, SZ_1M); | ||
112 | } | 114 | } |
113 | 115 | ||
114 | struct smp_operations armada_xp_smp_ops __initdata = { | 116 | struct smp_operations armada_xp_smp_ops __initdata = { |
diff --git a/arch/arm/mach-mxs/icoll.c b/arch/arm/mach-mxs/icoll.c index 8fb23af154b3..e26eeba46598 100644 --- a/arch/arm/mach-mxs/icoll.c +++ b/arch/arm/mach-mxs/icoll.c | |||
@@ -100,7 +100,7 @@ static struct irq_domain_ops icoll_irq_domain_ops = { | |||
100 | .xlate = irq_domain_xlate_onecell, | 100 | .xlate = irq_domain_xlate_onecell, |
101 | }; | 101 | }; |
102 | 102 | ||
103 | void __init icoll_of_init(struct device_node *np, | 103 | static void __init icoll_of_init(struct device_node *np, |
104 | struct device_node *interrupt_parent) | 104 | struct device_node *interrupt_parent) |
105 | { | 105 | { |
106 | /* | 106 | /* |
diff --git a/arch/arm/mach-mxs/mach-mxs.c b/arch/arm/mach-mxs/mach-mxs.c index 052186713347..3218f1f2c0e0 100644 --- a/arch/arm/mach-mxs/mach-mxs.c +++ b/arch/arm/mach-mxs/mach-mxs.c | |||
@@ -402,17 +402,17 @@ static void __init cfa10049_init(void) | |||
402 | { | 402 | { |
403 | enable_clk_enet_out(); | 403 | enable_clk_enet_out(); |
404 | update_fec_mac_prop(OUI_CRYSTALFONTZ); | 404 | update_fec_mac_prop(OUI_CRYSTALFONTZ); |
405 | |||
406 | mxsfb_pdata.mode_list = cfa10049_video_modes; | ||
407 | mxsfb_pdata.mode_count = ARRAY_SIZE(cfa10049_video_modes); | ||
408 | mxsfb_pdata.default_bpp = 32; | ||
409 | mxsfb_pdata.ld_intf_width = STMLCDIF_18BIT; | ||
405 | } | 410 | } |
406 | 411 | ||
407 | static void __init cfa10037_init(void) | 412 | static void __init cfa10037_init(void) |
408 | { | 413 | { |
409 | enable_clk_enet_out(); | 414 | enable_clk_enet_out(); |
410 | update_fec_mac_prop(OUI_CRYSTALFONTZ); | 415 | update_fec_mac_prop(OUI_CRYSTALFONTZ); |
411 | |||
412 | mxsfb_pdata.mode_list = cfa10049_video_modes; | ||
413 | mxsfb_pdata.mode_count = ARRAY_SIZE(cfa10049_video_modes); | ||
414 | mxsfb_pdata.default_bpp = 32; | ||
415 | mxsfb_pdata.ld_intf_width = STMLCDIF_18BIT; | ||
416 | } | 416 | } |
417 | 417 | ||
418 | static void __init apf28_init(void) | 418 | static void __init apf28_init(void) |
diff --git a/arch/arm/mach-mxs/mm.c b/arch/arm/mach-mxs/mm.c index a4294aa9f301..e63b7d87acbd 100644 --- a/arch/arm/mach-mxs/mm.c +++ b/arch/arm/mach-mxs/mm.c | |||
@@ -18,6 +18,7 @@ | |||
18 | 18 | ||
19 | #include <mach/mx23.h> | 19 | #include <mach/mx23.h> |
20 | #include <mach/mx28.h> | 20 | #include <mach/mx28.h> |
21 | #include <mach/common.h> | ||
21 | 22 | ||
22 | /* | 23 | /* |
23 | * Define the MX23 memory map. | 24 | * Define the MX23 memory map. |
diff --git a/arch/arm/mach-mxs/ocotp.c b/arch/arm/mach-mxs/ocotp.c index 54add60f94c9..1dff46703753 100644 --- a/arch/arm/mach-mxs/ocotp.c +++ b/arch/arm/mach-mxs/ocotp.c | |||
@@ -19,6 +19,7 @@ | |||
19 | #include <asm/processor.h> /* for cpu_relax() */ | 19 | #include <asm/processor.h> /* for cpu_relax() */ |
20 | 20 | ||
21 | #include <mach/mxs.h> | 21 | #include <mach/mxs.h> |
22 | #include <mach/common.h> | ||
22 | 23 | ||
23 | #define OCOTP_WORD_OFFSET 0x20 | 24 | #define OCOTP_WORD_OFFSET 0x20 |
24 | #define OCOTP_WORD_COUNT 0x20 | 25 | #define OCOTP_WORD_COUNT 0x20 |
diff --git a/arch/arm/mach-omap1/common.h b/arch/arm/mach-omap1/common.h index fb18831e88aa..14f7e9920479 100644 --- a/arch/arm/mach-omap1/common.h +++ b/arch/arm/mach-omap1/common.h | |||
@@ -31,6 +31,8 @@ | |||
31 | 31 | ||
32 | #include <plat/i2c.h> | 32 | #include <plat/i2c.h> |
33 | 33 | ||
34 | #include <mach/irqs.h> | ||
35 | |||
34 | #if defined(CONFIG_ARCH_OMAP730) || defined(CONFIG_ARCH_OMAP850) | 36 | #if defined(CONFIG_ARCH_OMAP730) || defined(CONFIG_ARCH_OMAP850) |
35 | void omap7xx_map_io(void); | 37 | void omap7xx_map_io(void); |
36 | #else | 38 | #else |
diff --git a/arch/arm/mach-omap2/Kconfig b/arch/arm/mach-omap2/Kconfig index 49ac3dfebef9..8111cd9ff3e5 100644 --- a/arch/arm/mach-omap2/Kconfig +++ b/arch/arm/mach-omap2/Kconfig | |||
@@ -311,9 +311,6 @@ config MACH_OMAP_ZOOM2 | |||
311 | default y | 311 | default y |
312 | select OMAP_PACKAGE_CBB | 312 | select OMAP_PACKAGE_CBB |
313 | select REGULATOR_FIXED_VOLTAGE if REGULATOR | 313 | select REGULATOR_FIXED_VOLTAGE if REGULATOR |
314 | select SERIAL_8250 | ||
315 | select SERIAL_8250_CONSOLE | ||
316 | select SERIAL_CORE_CONSOLE | ||
317 | 314 | ||
318 | config MACH_OMAP_ZOOM3 | 315 | config MACH_OMAP_ZOOM3 |
319 | bool "OMAP3630 Zoom3 board" | 316 | bool "OMAP3630 Zoom3 board" |
@@ -321,9 +318,6 @@ config MACH_OMAP_ZOOM3 | |||
321 | default y | 318 | default y |
322 | select OMAP_PACKAGE_CBP | 319 | select OMAP_PACKAGE_CBP |
323 | select REGULATOR_FIXED_VOLTAGE if REGULATOR | 320 | select REGULATOR_FIXED_VOLTAGE if REGULATOR |
324 | select SERIAL_8250 | ||
325 | select SERIAL_8250_CONSOLE | ||
326 | select SERIAL_CORE_CONSOLE | ||
327 | 321 | ||
328 | config MACH_CM_T35 | 322 | config MACH_CM_T35 |
329 | bool "CompuLab CM-T35/CM-T3730 modules" | 323 | bool "CompuLab CM-T35/CM-T3730 modules" |
diff --git a/arch/arm/mach-omap2/board-generic.c b/arch/arm/mach-omap2/board-generic.c index 0274ff7a2a2b..e54a48060198 100644 --- a/arch/arm/mach-omap2/board-generic.c +++ b/arch/arm/mach-omap2/board-generic.c | |||
@@ -102,6 +102,7 @@ DT_MACHINE_START(OMAP3_DT, "Generic OMAP3 (Flattened Device Tree)") | |||
102 | .init_irq = omap_intc_of_init, | 102 | .init_irq = omap_intc_of_init, |
103 | .handle_irq = omap3_intc_handle_irq, | 103 | .handle_irq = omap3_intc_handle_irq, |
104 | .init_machine = omap_generic_init, | 104 | .init_machine = omap_generic_init, |
105 | .init_late = omap3_init_late, | ||
105 | .init_time = omap3_sync32k_timer_init, | 106 | .init_time = omap3_sync32k_timer_init, |
106 | .dt_compat = omap3_boards_compat, | 107 | .dt_compat = omap3_boards_compat, |
107 | .restart = omap3xxx_restart, | 108 | .restart = omap3xxx_restart, |
@@ -119,6 +120,7 @@ DT_MACHINE_START(OMAP3_GP_DT, "Generic OMAP3-GP (Flattened Device Tree)") | |||
119 | .init_irq = omap_intc_of_init, | 120 | .init_irq = omap_intc_of_init, |
120 | .handle_irq = omap3_intc_handle_irq, | 121 | .handle_irq = omap3_intc_handle_irq, |
121 | .init_machine = omap_generic_init, | 122 | .init_machine = omap_generic_init, |
123 | .init_late = omap3_init_late, | ||
122 | .init_time = omap3_secure_sync32k_timer_init, | 124 | .init_time = omap3_secure_sync32k_timer_init, |
123 | .dt_compat = omap3_gp_boards_compat, | 125 | .dt_compat = omap3_gp_boards_compat, |
124 | .restart = omap3xxx_restart, | 126 | .restart = omap3xxx_restart, |
diff --git a/arch/arm/mach-omap2/board-rx51.c b/arch/arm/mach-omap2/board-rx51.c index f7c4616cbb60..d2ea68ea678a 100644 --- a/arch/arm/mach-omap2/board-rx51.c +++ b/arch/arm/mach-omap2/board-rx51.c | |||
@@ -17,6 +17,7 @@ | |||
17 | #include <linux/io.h> | 17 | #include <linux/io.h> |
18 | #include <linux/gpio.h> | 18 | #include <linux/gpio.h> |
19 | #include <linux/leds.h> | 19 | #include <linux/leds.h> |
20 | #include <linux/usb/phy.h> | ||
20 | #include <linux/usb/musb.h> | 21 | #include <linux/usb/musb.h> |
21 | #include <linux/platform_data/spi-omap2-mcspi.h> | 22 | #include <linux/platform_data/spi-omap2-mcspi.h> |
22 | 23 | ||
@@ -98,6 +99,7 @@ static void __init rx51_init(void) | |||
98 | sdrc_params = nokia_get_sdram_timings(); | 99 | sdrc_params = nokia_get_sdram_timings(); |
99 | omap_sdrc_init(sdrc_params, sdrc_params); | 100 | omap_sdrc_init(sdrc_params, sdrc_params); |
100 | 101 | ||
102 | usb_bind_phy("musb-hdrc.0.auto", 0, "twl4030_usb"); | ||
101 | usb_musb_init(&musb_board_data); | 103 | usb_musb_init(&musb_board_data); |
102 | rx51_peripherals_init(); | 104 | rx51_peripherals_init(); |
103 | 105 | ||
diff --git a/arch/arm/mach-omap2/common.h b/arch/arm/mach-omap2/common.h index 0a6b9c7a63da..40f4a03d728f 100644 --- a/arch/arm/mach-omap2/common.h +++ b/arch/arm/mach-omap2/common.h | |||
@@ -108,7 +108,6 @@ void omap35xx_init_late(void); | |||
108 | void omap3630_init_late(void); | 108 | void omap3630_init_late(void); |
109 | void am35xx_init_late(void); | 109 | void am35xx_init_late(void); |
110 | void ti81xx_init_late(void); | 110 | void ti81xx_init_late(void); |
111 | void omap4430_init_late(void); | ||
112 | int omap2_common_pm_late_init(void); | 111 | int omap2_common_pm_late_init(void); |
113 | 112 | ||
114 | #if defined(CONFIG_SOC_OMAP2420) || defined(CONFIG_SOC_OMAP2430) | 113 | #if defined(CONFIG_SOC_OMAP2420) || defined(CONFIG_SOC_OMAP2430) |
diff --git a/arch/arm/mach-omap2/gpmc.c b/arch/arm/mach-omap2/gpmc.c index e4b16c8efe8b..410e1bac7815 100644 --- a/arch/arm/mach-omap2/gpmc.c +++ b/arch/arm/mach-omap2/gpmc.c | |||
@@ -1122,9 +1122,6 @@ int gpmc_calc_timings(struct gpmc_timings *gpmc_t, | |||
1122 | /* TODO: remove, see function definition */ | 1122 | /* TODO: remove, see function definition */ |
1123 | gpmc_convert_ps_to_ns(gpmc_t); | 1123 | gpmc_convert_ps_to_ns(gpmc_t); |
1124 | 1124 | ||
1125 | /* Now the GPMC is initialised, unreserve the chip-selects */ | ||
1126 | gpmc_cs_map = 0; | ||
1127 | |||
1128 | return 0; | 1125 | return 0; |
1129 | } | 1126 | } |
1130 | 1127 | ||
@@ -1383,6 +1380,9 @@ static int gpmc_probe(struct platform_device *pdev) | |||
1383 | if (IS_ERR_VALUE(gpmc_setup_irq())) | 1380 | if (IS_ERR_VALUE(gpmc_setup_irq())) |
1384 | dev_warn(gpmc_dev, "gpmc_setup_irq failed\n"); | 1381 | dev_warn(gpmc_dev, "gpmc_setup_irq failed\n"); |
1385 | 1382 | ||
1383 | /* Now the GPMC is initialised, unreserve the chip-selects */ | ||
1384 | gpmc_cs_map = 0; | ||
1385 | |||
1386 | rc = gpmc_probe_dt(pdev); | 1386 | rc = gpmc_probe_dt(pdev); |
1387 | if (rc < 0) { | 1387 | if (rc < 0) { |
1388 | clk_disable_unprepare(gpmc_l3_clk); | 1388 | clk_disable_unprepare(gpmc_l3_clk); |
diff --git a/arch/arm/mach-omap2/mux.c b/arch/arm/mach-omap2/mux.c index 6a217c98db54..f82cf878d6af 100644 --- a/arch/arm/mach-omap2/mux.c +++ b/arch/arm/mach-omap2/mux.c | |||
@@ -211,8 +211,6 @@ static int __init _omap_mux_get_by_name(struct omap_mux_partition *partition, | |||
211 | return -EINVAL; | 211 | return -EINVAL; |
212 | } | 212 | } |
213 | 213 | ||
214 | pr_err("%s: Could not find signal %s\n", __func__, muxname); | ||
215 | |||
216 | return -ENODEV; | 214 | return -ENODEV; |
217 | } | 215 | } |
218 | 216 | ||
@@ -234,6 +232,8 @@ int __init omap_mux_get_by_name(const char *muxname, | |||
234 | return mux_mode; | 232 | return mux_mode; |
235 | } | 233 | } |
236 | 234 | ||
235 | pr_err("%s: Could not find signal %s\n", __func__, muxname); | ||
236 | |||
237 | return -ENODEV; | 237 | return -ENODEV; |
238 | } | 238 | } |
239 | 239 | ||
@@ -739,8 +739,9 @@ static void __init omap_mux_dbg_create_entry( | |||
739 | list_for_each_entry(e, &partition->muxmodes, node) { | 739 | list_for_each_entry(e, &partition->muxmodes, node) { |
740 | struct omap_mux *m = &e->mux; | 740 | struct omap_mux *m = &e->mux; |
741 | 741 | ||
742 | (void)debugfs_create_file(m->muxnames[0], S_IWUSR, mux_dbg_dir, | 742 | (void)debugfs_create_file(m->muxnames[0], S_IWUSR | S_IRUGO, |
743 | m, &omap_mux_dbg_signal_fops); | 743 | mux_dbg_dir, m, |
744 | &omap_mux_dbg_signal_fops); | ||
744 | } | 745 | } |
745 | } | 746 | } |
746 | 747 | ||
diff --git a/arch/arm/mach-orion5x/Makefile b/arch/arm/mach-orion5x/Makefile index 9e809a7c05c0..45da805fb236 100644 --- a/arch/arm/mach-orion5x/Makefile +++ b/arch/arm/mach-orion5x/Makefile | |||
@@ -1,4 +1,4 @@ | |||
1 | obj-y += common.o addr-map.o pci.o irq.o mpp.o | 1 | obj-y += common.o pci.o irq.o mpp.o |
2 | obj-$(CONFIG_MACH_DB88F5281) += db88f5281-setup.o | 2 | obj-$(CONFIG_MACH_DB88F5281) += db88f5281-setup.o |
3 | obj-$(CONFIG_MACH_RD88F5182) += rd88f5182-setup.o | 3 | obj-$(CONFIG_MACH_RD88F5182) += rd88f5182-setup.o |
4 | obj-$(CONFIG_MACH_KUROBOX_PRO) += kurobox_pro-setup.o | 4 | obj-$(CONFIG_MACH_KUROBOX_PRO) += kurobox_pro-setup.o |
diff --git a/arch/arm/mach-orion5x/addr-map.c b/arch/arm/mach-orion5x/addr-map.c deleted file mode 100644 index b5efc0fd31cb..000000000000 --- a/arch/arm/mach-orion5x/addr-map.c +++ /dev/null | |||
@@ -1,155 +0,0 @@ | |||
1 | /* | ||
2 | * arch/arm/mach-orion5x/addr-map.c | ||
3 | * | ||
4 | * Address map functions for Marvell Orion 5x SoCs | ||
5 | * | ||
6 | * Maintainer: Tzachi Perelstein <tzachi@marvell.com> | ||
7 | * | ||
8 | * This file is licensed under the terms of the GNU General Public | ||
9 | * License version 2. This program is licensed "as is" without any | ||
10 | * warranty of any kind, whether express or implied. | ||
11 | */ | ||
12 | |||
13 | #include <linux/kernel.h> | ||
14 | #include <linux/init.h> | ||
15 | #include <linux/mbus.h> | ||
16 | #include <linux/io.h> | ||
17 | #include <mach/hardware.h> | ||
18 | #include <plat/addr-map.h> | ||
19 | #include "common.h" | ||
20 | |||
21 | /* | ||
22 | * The Orion has fully programmable address map. There's a separate address | ||
23 | * map for each of the device _master_ interfaces, e.g. CPU, PCI, PCIe, USB, | ||
24 | * Gigabit Ethernet, DMA/XOR engines, etc. Each interface has its own | ||
25 | * address decode windows that allow it to access any of the Orion resources. | ||
26 | * | ||
27 | * CPU address decoding -- | ||
28 | * Linux assumes that it is the boot loader that already setup the access to | ||
29 | * DDR and internal registers. | ||
30 | * Setup access to PCI and PCIe IO/MEM space is issued by this file. | ||
31 | * Setup access to various devices located on the device bus interface (e.g. | ||
32 | * flashes, RTC, etc) should be issued by machine-setup.c according to | ||
33 | * specific board population (by using orion5x_setup_*_win()). | ||
34 | * | ||
35 | * Non-CPU Masters address decoding -- | ||
36 | * Unlike the CPU, we setup the access from Orion's master interfaces to DDR | ||
37 | * banks only (the typical use case). | ||
38 | * Setup access for each master to DDR is issued by platform device setup. | ||
39 | */ | ||
40 | |||
41 | /* | ||
42 | * Generic Address Decode Windows bit settings | ||
43 | */ | ||
44 | #define TARGET_DEV_BUS 1 | ||
45 | #define TARGET_PCI 3 | ||
46 | #define TARGET_PCIE 4 | ||
47 | #define TARGET_SRAM 9 | ||
48 | #define ATTR_PCIE_MEM 0x59 | ||
49 | #define ATTR_PCIE_IO 0x51 | ||
50 | #define ATTR_PCIE_WA 0x79 | ||
51 | #define ATTR_PCI_MEM 0x59 | ||
52 | #define ATTR_PCI_IO 0x51 | ||
53 | #define ATTR_DEV_CS0 0x1e | ||
54 | #define ATTR_DEV_CS1 0x1d | ||
55 | #define ATTR_DEV_CS2 0x1b | ||
56 | #define ATTR_DEV_BOOT 0xf | ||
57 | #define ATTR_SRAM 0x0 | ||
58 | |||
59 | static int __initdata win_alloc_count; | ||
60 | |||
61 | static int __init cpu_win_can_remap(const struct orion_addr_map_cfg *cfg, | ||
62 | const int win) | ||
63 | { | ||
64 | u32 dev, rev; | ||
65 | |||
66 | orion5x_pcie_id(&dev, &rev); | ||
67 | if ((dev == MV88F5281_DEV_ID && win < 4) | ||
68 | || (dev == MV88F5182_DEV_ID && win < 2) | ||
69 | || (dev == MV88F5181_DEV_ID && win < 2) | ||
70 | || (dev == MV88F6183_DEV_ID && win < 4)) | ||
71 | return 1; | ||
72 | |||
73 | return 0; | ||
74 | } | ||
75 | |||
76 | /* | ||
77 | * Description of the windows needed by the platform code | ||
78 | */ | ||
79 | static struct orion_addr_map_cfg addr_map_cfg __initdata = { | ||
80 | .num_wins = 8, | ||
81 | .cpu_win_can_remap = cpu_win_can_remap, | ||
82 | .bridge_virt_base = ORION5X_BRIDGE_VIRT_BASE, | ||
83 | }; | ||
84 | |||
85 | static const struct __initdata orion_addr_map_info addr_map_info[] = { | ||
86 | /* | ||
87 | * Setup windows for PCI+PCIe IO+MEM space. | ||
88 | */ | ||
89 | { 0, ORION5X_PCIE_IO_PHYS_BASE, ORION5X_PCIE_IO_SIZE, | ||
90 | TARGET_PCIE, ATTR_PCIE_IO, ORION5X_PCIE_IO_BUS_BASE | ||
91 | }, | ||
92 | { 1, ORION5X_PCI_IO_PHYS_BASE, ORION5X_PCI_IO_SIZE, | ||
93 | TARGET_PCI, ATTR_PCI_IO, ORION5X_PCI_IO_BUS_BASE | ||
94 | }, | ||
95 | { 2, ORION5X_PCIE_MEM_PHYS_BASE, ORION5X_PCIE_MEM_SIZE, | ||
96 | TARGET_PCIE, ATTR_PCIE_MEM, -1 | ||
97 | }, | ||
98 | { 3, ORION5X_PCI_MEM_PHYS_BASE, ORION5X_PCI_MEM_SIZE, | ||
99 | TARGET_PCI, ATTR_PCI_MEM, -1 | ||
100 | }, | ||
101 | /* End marker */ | ||
102 | { -1, 0, 0, 0, 0, 0 } | ||
103 | }; | ||
104 | |||
105 | void __init orion5x_setup_cpu_mbus_bridge(void) | ||
106 | { | ||
107 | /* | ||
108 | * Disable, clear and configure windows. | ||
109 | */ | ||
110 | orion_config_wins(&addr_map_cfg, addr_map_info); | ||
111 | win_alloc_count = 4; | ||
112 | |||
113 | /* | ||
114 | * Setup MBUS dram target info. | ||
115 | */ | ||
116 | orion_setup_cpu_mbus_target(&addr_map_cfg, | ||
117 | (void __iomem *) ORION5X_DDR_WINDOW_CPU_BASE); | ||
118 | } | ||
119 | |||
120 | void __init orion5x_setup_dev_boot_win(u32 base, u32 size) | ||
121 | { | ||
122 | orion_setup_cpu_win(&addr_map_cfg, win_alloc_count++, base, size, | ||
123 | TARGET_DEV_BUS, ATTR_DEV_BOOT, -1); | ||
124 | } | ||
125 | |||
126 | void __init orion5x_setup_dev0_win(u32 base, u32 size) | ||
127 | { | ||
128 | orion_setup_cpu_win(&addr_map_cfg, win_alloc_count++, base, size, | ||
129 | TARGET_DEV_BUS, ATTR_DEV_CS0, -1); | ||
130 | } | ||
131 | |||
132 | void __init orion5x_setup_dev1_win(u32 base, u32 size) | ||
133 | { | ||
134 | orion_setup_cpu_win(&addr_map_cfg, win_alloc_count++, base, size, | ||
135 | TARGET_DEV_BUS, ATTR_DEV_CS1, -1); | ||
136 | } | ||
137 | |||
138 | void __init orion5x_setup_dev2_win(u32 base, u32 size) | ||
139 | { | ||
140 | orion_setup_cpu_win(&addr_map_cfg, win_alloc_count++, base, size, | ||
141 | TARGET_DEV_BUS, ATTR_DEV_CS2, -1); | ||
142 | } | ||
143 | |||
144 | void __init orion5x_setup_pcie_wa_win(u32 base, u32 size) | ||
145 | { | ||
146 | orion_setup_cpu_win(&addr_map_cfg, win_alloc_count++, base, size, | ||
147 | TARGET_PCIE, ATTR_PCIE_WA, -1); | ||
148 | } | ||
149 | |||
150 | void __init orion5x_setup_sram_win(void) | ||
151 | { | ||
152 | orion_setup_cpu_win(&addr_map_cfg, win_alloc_count++, | ||
153 | ORION5X_SRAM_PHYS_BASE, ORION5X_SRAM_SIZE, | ||
154 | TARGET_SRAM, ATTR_SRAM, -1); | ||
155 | } | ||
diff --git a/arch/arm/mach-orion5x/board-dt.c b/arch/arm/mach-orion5x/board-dt.c index 35a8014529ca..6bbc8786c1e3 100644 --- a/arch/arm/mach-orion5x/board-dt.c +++ b/arch/arm/mach-orion5x/board-dt.c | |||
@@ -41,7 +41,7 @@ static void __init orion5x_dt_init(void) | |||
41 | /* | 41 | /* |
42 | * Setup Orion address map | 42 | * Setup Orion address map |
43 | */ | 43 | */ |
44 | orion5x_setup_cpu_mbus_bridge(); | 44 | orion5x_setup_wins(); |
45 | 45 | ||
46 | /* Setup root of clk tree */ | 46 | /* Setup root of clk tree */ |
47 | clk_init(); | 47 | clk_init(); |
diff --git a/arch/arm/mach-orion5x/common.c b/arch/arm/mach-orion5x/common.c index d068f1431c40..8e468e3a6015 100644 --- a/arch/arm/mach-orion5x/common.c +++ b/arch/arm/mach-orion5x/common.c | |||
@@ -34,7 +34,6 @@ | |||
34 | #include <linux/platform_data/usb-ehci-orion.h> | 34 | #include <linux/platform_data/usb-ehci-orion.h> |
35 | #include <plat/time.h> | 35 | #include <plat/time.h> |
36 | #include <plat/common.h> | 36 | #include <plat/common.h> |
37 | #include <plat/addr-map.h> | ||
38 | #include "common.h" | 37 | #include "common.h" |
39 | 38 | ||
40 | /***************************************************************************** | 39 | /***************************************************************************** |
@@ -174,7 +173,8 @@ void __init orion5x_xor_init(void) | |||
174 | ****************************************************************************/ | 173 | ****************************************************************************/ |
175 | static void __init orion5x_crypto_init(void) | 174 | static void __init orion5x_crypto_init(void) |
176 | { | 175 | { |
177 | orion5x_setup_sram_win(); | 176 | mvebu_mbus_add_window("sram", ORION5X_SRAM_PHYS_BASE, |
177 | ORION5X_SRAM_SIZE); | ||
178 | orion_crypto_init(ORION5X_CRYPTO_PHYS_BASE, ORION5X_SRAM_PHYS_BASE, | 178 | orion_crypto_init(ORION5X_CRYPTO_PHYS_BASE, ORION5X_SRAM_PHYS_BASE, |
179 | SZ_8K, IRQ_ORION5X_CESA); | 179 | SZ_8K, IRQ_ORION5X_CESA); |
180 | } | 180 | } |
@@ -193,6 +193,9 @@ void __init orion5x_wdt_init(void) | |||
193 | ****************************************************************************/ | 193 | ****************************************************************************/ |
194 | void __init orion5x_init_early(void) | 194 | void __init orion5x_init_early(void) |
195 | { | 195 | { |
196 | u32 rev, dev; | ||
197 | const char *mbus_soc_name; | ||
198 | |||
196 | orion_time_set_base(TIMER_VIRT_BASE); | 199 | orion_time_set_base(TIMER_VIRT_BASE); |
197 | 200 | ||
198 | /* | 201 | /* |
@@ -201,6 +204,46 @@ void __init orion5x_init_early(void) | |||
201 | * the allocations won't fail. | 204 | * the allocations won't fail. |
202 | */ | 205 | */ |
203 | init_dma_coherent_pool_size(SZ_1M); | 206 | init_dma_coherent_pool_size(SZ_1M); |
207 | |||
208 | /* Initialize the MBUS driver */ | ||
209 | orion5x_pcie_id(&dev, &rev); | ||
210 | if (dev == MV88F5281_DEV_ID) | ||
211 | mbus_soc_name = "marvell,orion5x-88f5281-mbus"; | ||
212 | else if (dev == MV88F5182_DEV_ID) | ||
213 | mbus_soc_name = "marvell,orion5x-88f5182-mbus"; | ||
214 | else if (dev == MV88F5181_DEV_ID) | ||
215 | mbus_soc_name = "marvell,orion5x-88f5181-mbus"; | ||
216 | else if (dev == MV88F6183_DEV_ID) | ||
217 | mbus_soc_name = "marvell,orion5x-88f6183-mbus"; | ||
218 | else | ||
219 | mbus_soc_name = NULL; | ||
220 | mvebu_mbus_init(mbus_soc_name, ORION5X_BRIDGE_WINS_BASE, | ||
221 | ORION5X_BRIDGE_WINS_SZ, | ||
222 | ORION5X_DDR_WINS_BASE, ORION5X_DDR_WINS_SZ); | ||
223 | } | ||
224 | |||
225 | void orion5x_setup_wins(void) | ||
226 | { | ||
227 | /* | ||
228 | * The PCIe windows will no longer be statically allocated | ||
229 | * here once Orion5x is migrated to the pci-mvebu driver. | ||
230 | */ | ||
231 | mvebu_mbus_add_window_remap_flags("pcie0.0", ORION5X_PCIE_IO_PHYS_BASE, | ||
232 | ORION5X_PCIE_IO_SIZE, | ||
233 | ORION5X_PCIE_IO_BUS_BASE, | ||
234 | MVEBU_MBUS_PCI_IO); | ||
235 | mvebu_mbus_add_window_remap_flags("pcie0.0", ORION5X_PCIE_MEM_PHYS_BASE, | ||
236 | ORION5X_PCIE_MEM_SIZE, | ||
237 | MVEBU_MBUS_NO_REMAP, | ||
238 | MVEBU_MBUS_PCI_MEM); | ||
239 | mvebu_mbus_add_window_remap_flags("pci0.0", ORION5X_PCI_IO_PHYS_BASE, | ||
240 | ORION5X_PCI_IO_SIZE, | ||
241 | ORION5X_PCI_IO_BUS_BASE, | ||
242 | MVEBU_MBUS_PCI_IO); | ||
243 | mvebu_mbus_add_window_remap_flags("pci0.0", ORION5X_PCI_MEM_PHYS_BASE, | ||
244 | ORION5X_PCI_MEM_SIZE, | ||
245 | MVEBU_MBUS_NO_REMAP, | ||
246 | MVEBU_MBUS_PCI_MEM); | ||
204 | } | 247 | } |
205 | 248 | ||
206 | int orion5x_tclk; | 249 | int orion5x_tclk; |
@@ -282,7 +325,7 @@ void __init orion5x_init(void) | |||
282 | /* | 325 | /* |
283 | * Setup Orion address map | 326 | * Setup Orion address map |
284 | */ | 327 | */ |
285 | orion5x_setup_cpu_mbus_bridge(); | 328 | orion5x_setup_wins(); |
286 | 329 | ||
287 | /* Setup root of clk tree */ | 330 | /* Setup root of clk tree */ |
288 | clk_init(); | 331 | clk_init(); |
diff --git a/arch/arm/mach-orion5x/common.h b/arch/arm/mach-orion5x/common.h index e60345760283..cdaa01f3d186 100644 --- a/arch/arm/mach-orion5x/common.h +++ b/arch/arm/mach-orion5x/common.h | |||
@@ -17,18 +17,7 @@ void clk_init(void); | |||
17 | extern int orion5x_tclk; | 17 | extern int orion5x_tclk; |
18 | extern void orion5x_timer_init(void); | 18 | extern void orion5x_timer_init(void); |
19 | 19 | ||
20 | /* | 20 | void orion5x_setup_wins(void); |
21 | * Enumerations and functions for Orion windows mapping. Used by Orion core | ||
22 | * functions to map its interfaces and by the machine-setup to map its on- | ||
23 | * board devices. Details in /mach-orion/addr-map.c | ||
24 | */ | ||
25 | void orion5x_setup_cpu_mbus_bridge(void); | ||
26 | void orion5x_setup_dev_boot_win(u32 base, u32 size); | ||
27 | void orion5x_setup_dev0_win(u32 base, u32 size); | ||
28 | void orion5x_setup_dev1_win(u32 base, u32 size); | ||
29 | void orion5x_setup_dev2_win(u32 base, u32 size); | ||
30 | void orion5x_setup_pcie_wa_win(u32 base, u32 size); | ||
31 | void orion5x_setup_sram_win(void); | ||
32 | 21 | ||
33 | void orion5x_ehci0_init(void); | 22 | void orion5x_ehci0_init(void); |
34 | void orion5x_ehci1_init(void); | 23 | void orion5x_ehci1_init(void); |
diff --git a/arch/arm/mach-orion5x/d2net-setup.c b/arch/arm/mach-orion5x/d2net-setup.c index 57d0af74874d..16c88bbabc98 100644 --- a/arch/arm/mach-orion5x/d2net-setup.c +++ b/arch/arm/mach-orion5x/d2net-setup.c | |||
@@ -317,8 +317,8 @@ static void __init d2net_init(void) | |||
317 | d2net_sata_power_init(); | 317 | d2net_sata_power_init(); |
318 | orion5x_sata_init(&d2net_sata_data); | 318 | orion5x_sata_init(&d2net_sata_data); |
319 | 319 | ||
320 | orion5x_setup_dev_boot_win(D2NET_NOR_BOOT_BASE, | 320 | mvebu_mbus_add_window("devbus-boot", D2NET_NOR_BOOT_BASE, |
321 | D2NET_NOR_BOOT_SIZE); | 321 | D2NET_NOR_BOOT_SIZE); |
322 | platform_device_register(&d2net_nor_flash); | 322 | platform_device_register(&d2net_nor_flash); |
323 | 323 | ||
324 | platform_device_register(&d2net_gpio_buttons); | 324 | platform_device_register(&d2net_gpio_buttons); |
diff --git a/arch/arm/mach-orion5x/db88f5281-setup.c b/arch/arm/mach-orion5x/db88f5281-setup.c index 76665640087b..4e1263da38bb 100644 --- a/arch/arm/mach-orion5x/db88f5281-setup.c +++ b/arch/arm/mach-orion5x/db88f5281-setup.c | |||
@@ -340,16 +340,19 @@ static void __init db88f5281_init(void) | |||
340 | orion5x_uart0_init(); | 340 | orion5x_uart0_init(); |
341 | orion5x_uart1_init(); | 341 | orion5x_uart1_init(); |
342 | 342 | ||
343 | orion5x_setup_dev_boot_win(DB88F5281_NOR_BOOT_BASE, | 343 | mvebu_mbus_add_window("devbus-boot", DB88F5281_NOR_BOOT_BASE, |
344 | DB88F5281_NOR_BOOT_SIZE); | 344 | DB88F5281_NOR_BOOT_SIZE); |
345 | platform_device_register(&db88f5281_boot_flash); | 345 | platform_device_register(&db88f5281_boot_flash); |
346 | 346 | ||
347 | orion5x_setup_dev0_win(DB88F5281_7SEG_BASE, DB88F5281_7SEG_SIZE); | 347 | mvebu_mbus_add_window("devbus-cs0", DB88F5281_7SEG_BASE, |
348 | DB88F5281_7SEG_SIZE); | ||
348 | 349 | ||
349 | orion5x_setup_dev1_win(DB88F5281_NOR_BASE, DB88F5281_NOR_SIZE); | 350 | mvebu_mbus_add_window("devbus-cs1", DB88F5281_NOR_BASE, |
351 | DB88F5281_NOR_SIZE); | ||
350 | platform_device_register(&db88f5281_nor_flash); | 352 | platform_device_register(&db88f5281_nor_flash); |
351 | 353 | ||
352 | orion5x_setup_dev2_win(DB88F5281_NAND_BASE, DB88F5281_NAND_SIZE); | 354 | mvebu_mbus_add_window("devbus-cs2", DB88F5281_NAND_BASE, |
355 | DB88F5281_NAND_SIZE); | ||
353 | platform_device_register(&db88f5281_nand_flash); | 356 | platform_device_register(&db88f5281_nand_flash); |
354 | 357 | ||
355 | i2c_register_board_info(0, &db88f5281_i2c_rtc, 1); | 358 | i2c_register_board_info(0, &db88f5281_i2c_rtc, 1); |
diff --git a/arch/arm/mach-orion5x/dns323-setup.c b/arch/arm/mach-orion5x/dns323-setup.c index 6eb1732757fd..9e6baf581ed3 100644 --- a/arch/arm/mach-orion5x/dns323-setup.c +++ b/arch/arm/mach-orion5x/dns323-setup.c | |||
@@ -611,7 +611,8 @@ static void __init dns323_init(void) | |||
611 | /* setup flash mapping | 611 | /* setup flash mapping |
612 | * CS3 holds a 8 MB Spansion S29GL064M90TFIR4 | 612 | * CS3 holds a 8 MB Spansion S29GL064M90TFIR4 |
613 | */ | 613 | */ |
614 | orion5x_setup_dev_boot_win(DNS323_NOR_BOOT_BASE, DNS323_NOR_BOOT_SIZE); | 614 | mvebu_mbus_add_window("devbus-boot", DNS323_NOR_BOOT_BASE, |
615 | DNS323_NOR_BOOT_SIZE); | ||
615 | platform_device_register(&dns323_nor_flash); | 616 | platform_device_register(&dns323_nor_flash); |
616 | 617 | ||
617 | /* Sort out LEDs, Buttons and i2c devices */ | 618 | /* Sort out LEDs, Buttons and i2c devices */ |
diff --git a/arch/arm/mach-orion5x/edmini_v2-setup.c b/arch/arm/mach-orion5x/edmini_v2-setup.c index d675e727803d..147615510dd0 100644 --- a/arch/arm/mach-orion5x/edmini_v2-setup.c +++ b/arch/arm/mach-orion5x/edmini_v2-setup.c | |||
@@ -154,8 +154,8 @@ void __init edmini_v2_init(void) | |||
154 | orion5x_ehci0_init(); | 154 | orion5x_ehci0_init(); |
155 | orion5x_eth_init(&edmini_v2_eth_data); | 155 | orion5x_eth_init(&edmini_v2_eth_data); |
156 | 156 | ||
157 | orion5x_setup_dev_boot_win(EDMINI_V2_NOR_BOOT_BASE, | 157 | mvebu_mbus_add_window("devbus-boot", EDMINI_V2_NOR_BOOT_BASE, |
158 | EDMINI_V2_NOR_BOOT_SIZE); | 158 | EDMINI_V2_NOR_BOOT_SIZE); |
159 | platform_device_register(&edmini_v2_nor_flash); | 159 | platform_device_register(&edmini_v2_nor_flash); |
160 | 160 | ||
161 | pr_notice("edmini_v2: USB device port, flash write and power-off " | 161 | pr_notice("edmini_v2: USB device port, flash write and power-off " |
diff --git a/arch/arm/mach-orion5x/include/mach/orion5x.h b/arch/arm/mach-orion5x/include/mach/orion5x.h index d265f5484a8e..b78ff3248868 100644 --- a/arch/arm/mach-orion5x/include/mach/orion5x.h +++ b/arch/arm/mach-orion5x/include/mach/orion5x.h | |||
@@ -66,8 +66,10 @@ | |||
66 | * Orion Registers Map | 66 | * Orion Registers Map |
67 | ******************************************************************************/ | 67 | ******************************************************************************/ |
68 | 68 | ||
69 | #define ORION5X_DDR_PHYS_BASE (ORION5X_REGS_PHYS_BASE + 0x00000) | ||
70 | #define ORION5X_DDR_WINS_BASE (ORION5X_DDR_PHYS_BASE + 0x1500) | ||
71 | #define ORION5X_DDR_WINS_SZ (0x10) | ||
69 | #define ORION5X_DDR_VIRT_BASE (ORION5X_REGS_VIRT_BASE + 0x00000) | 72 | #define ORION5X_DDR_VIRT_BASE (ORION5X_REGS_VIRT_BASE + 0x00000) |
70 | #define ORION5X_DDR_WINDOW_CPU_BASE (ORION5X_DDR_VIRT_BASE + 0x1500) | ||
71 | #define ORION5X_DEV_BUS_PHYS_BASE (ORION5X_REGS_PHYS_BASE + 0x10000) | 73 | #define ORION5X_DEV_BUS_PHYS_BASE (ORION5X_REGS_PHYS_BASE + 0x10000) |
72 | #define ORION5X_DEV_BUS_VIRT_BASE (ORION5X_REGS_VIRT_BASE + 0x10000) | 74 | #define ORION5X_DEV_BUS_VIRT_BASE (ORION5X_REGS_VIRT_BASE + 0x10000) |
73 | #define ORION5X_DEV_BUS_REG(x) (ORION5X_DEV_BUS_VIRT_BASE + (x)) | 75 | #define ORION5X_DEV_BUS_REG(x) (ORION5X_DEV_BUS_VIRT_BASE + (x)) |
@@ -81,6 +83,8 @@ | |||
81 | 83 | ||
82 | #define ORION5X_BRIDGE_VIRT_BASE (ORION5X_REGS_VIRT_BASE + 0x20000) | 84 | #define ORION5X_BRIDGE_VIRT_BASE (ORION5X_REGS_VIRT_BASE + 0x20000) |
83 | #define ORION5X_BRIDGE_PHYS_BASE (ORION5X_REGS_PHYS_BASE + 0x20000) | 85 | #define ORION5X_BRIDGE_PHYS_BASE (ORION5X_REGS_PHYS_BASE + 0x20000) |
86 | #define ORION5X_BRIDGE_WINS_BASE (ORION5X_BRIDGE_PHYS_BASE) | ||
87 | #define ORION5X_BRIDGE_WINS_SZ (0x80) | ||
84 | 88 | ||
85 | #define ORION5X_PCI_VIRT_BASE (ORION5X_REGS_VIRT_BASE + 0x30000) | 89 | #define ORION5X_PCI_VIRT_BASE (ORION5X_REGS_VIRT_BASE + 0x30000) |
86 | 90 | ||
diff --git a/arch/arm/mach-orion5x/kurobox_pro-setup.c b/arch/arm/mach-orion5x/kurobox_pro-setup.c index b98403526218..aae10e4a917c 100644 --- a/arch/arm/mach-orion5x/kurobox_pro-setup.c +++ b/arch/arm/mach-orion5x/kurobox_pro-setup.c | |||
@@ -359,13 +359,13 @@ static void __init kurobox_pro_init(void) | |||
359 | orion5x_uart1_init(); | 359 | orion5x_uart1_init(); |
360 | orion5x_xor_init(); | 360 | orion5x_xor_init(); |
361 | 361 | ||
362 | orion5x_setup_dev_boot_win(KUROBOX_PRO_NOR_BOOT_BASE, | 362 | mvebu_mbus_add_window("devbus-boot", KUROBOX_PRO_NOR_BOOT_BASE, |
363 | KUROBOX_PRO_NOR_BOOT_SIZE); | 363 | KUROBOX_PRO_NOR_BOOT_SIZE); |
364 | platform_device_register(&kurobox_pro_nor_flash); | 364 | platform_device_register(&kurobox_pro_nor_flash); |
365 | 365 | ||
366 | if (machine_is_kurobox_pro()) { | 366 | if (machine_is_kurobox_pro()) { |
367 | orion5x_setup_dev0_win(KUROBOX_PRO_NAND_BASE, | 367 | mvebu_mbus_add_window("devbus-cs0", KUROBOX_PRO_NAND_BASE, |
368 | KUROBOX_PRO_NAND_SIZE); | 368 | KUROBOX_PRO_NAND_SIZE); |
369 | platform_device_register(&kurobox_pro_nand_flash); | 369 | platform_device_register(&kurobox_pro_nand_flash); |
370 | } | 370 | } |
371 | 371 | ||
diff --git a/arch/arm/mach-orion5x/ls-chl-setup.c b/arch/arm/mach-orion5x/ls-chl-setup.c index 044da5b6a6ae..24f4e14e5893 100644 --- a/arch/arm/mach-orion5x/ls-chl-setup.c +++ b/arch/arm/mach-orion5x/ls-chl-setup.c | |||
@@ -294,8 +294,8 @@ static void __init lschl_init(void) | |||
294 | orion5x_uart0_init(); | 294 | orion5x_uart0_init(); |
295 | orion5x_xor_init(); | 295 | orion5x_xor_init(); |
296 | 296 | ||
297 | orion5x_setup_dev_boot_win(LSCHL_NOR_BOOT_BASE, | 297 | mvebu_mbus_add_window("devbus-boot", LSCHL_NOR_BOOT_BASE, |
298 | LSCHL_NOR_BOOT_SIZE); | 298 | LSCHL_NOR_BOOT_SIZE); |
299 | platform_device_register(&lschl_nor_flash); | 299 | platform_device_register(&lschl_nor_flash); |
300 | 300 | ||
301 | platform_device_register(&lschl_leds); | 301 | platform_device_register(&lschl_leds); |
diff --git a/arch/arm/mach-orion5x/ls_hgl-setup.c b/arch/arm/mach-orion5x/ls_hgl-setup.c index d49f93423f52..fc653bb41e78 100644 --- a/arch/arm/mach-orion5x/ls_hgl-setup.c +++ b/arch/arm/mach-orion5x/ls_hgl-setup.c | |||
@@ -243,8 +243,8 @@ static void __init ls_hgl_init(void) | |||
243 | orion5x_uart0_init(); | 243 | orion5x_uart0_init(); |
244 | orion5x_xor_init(); | 244 | orion5x_xor_init(); |
245 | 245 | ||
246 | orion5x_setup_dev_boot_win(LS_HGL_NOR_BOOT_BASE, | 246 | mvebu_mbus_add_window("devbus-boot", LS_HGL_NOR_BOOT_BASE, |
247 | LS_HGL_NOR_BOOT_SIZE); | 247 | LS_HGL_NOR_BOOT_SIZE); |
248 | platform_device_register(&ls_hgl_nor_flash); | 248 | platform_device_register(&ls_hgl_nor_flash); |
249 | 249 | ||
250 | platform_device_register(&ls_hgl_button_device); | 250 | platform_device_register(&ls_hgl_button_device); |
diff --git a/arch/arm/mach-orion5x/lsmini-setup.c b/arch/arm/mach-orion5x/lsmini-setup.c index 8e3965c6c0fe..18e66e617dc2 100644 --- a/arch/arm/mach-orion5x/lsmini-setup.c +++ b/arch/arm/mach-orion5x/lsmini-setup.c | |||
@@ -244,8 +244,8 @@ static void __init lsmini_init(void) | |||
244 | orion5x_uart0_init(); | 244 | orion5x_uart0_init(); |
245 | orion5x_xor_init(); | 245 | orion5x_xor_init(); |
246 | 246 | ||
247 | orion5x_setup_dev_boot_win(LSMINI_NOR_BOOT_BASE, | 247 | mvebu_mbus_add_window("devbus-boot", LSMINI_NOR_BOOT_BASE, |
248 | LSMINI_NOR_BOOT_SIZE); | 248 | LSMINI_NOR_BOOT_SIZE); |
249 | platform_device_register(&lsmini_nor_flash); | 249 | platform_device_register(&lsmini_nor_flash); |
250 | 250 | ||
251 | platform_device_register(&lsmini_button_device); | 251 | platform_device_register(&lsmini_button_device); |
diff --git a/arch/arm/mach-orion5x/mss2-setup.c b/arch/arm/mach-orion5x/mss2-setup.c index 0ec94a1f2b16..827acbafc9dc 100644 --- a/arch/arm/mach-orion5x/mss2-setup.c +++ b/arch/arm/mach-orion5x/mss2-setup.c | |||
@@ -241,7 +241,8 @@ static void __init mss2_init(void) | |||
241 | orion5x_uart0_init(); | 241 | orion5x_uart0_init(); |
242 | orion5x_xor_init(); | 242 | orion5x_xor_init(); |
243 | 243 | ||
244 | orion5x_setup_dev_boot_win(MSS2_NOR_BOOT_BASE, MSS2_NOR_BOOT_SIZE); | 244 | mvebu_mbus_add_window("devbus-boot", MSS2_NOR_BOOT_BASE, |
245 | MSS2_NOR_BOOT_SIZE); | ||
245 | platform_device_register(&mss2_nor_flash); | 246 | platform_device_register(&mss2_nor_flash); |
246 | 247 | ||
247 | platform_device_register(&mss2_button_device); | 248 | platform_device_register(&mss2_button_device); |
diff --git a/arch/arm/mach-orion5x/mv2120-setup.c b/arch/arm/mach-orion5x/mv2120-setup.c index 18143f2a9093..92600ae2b4b6 100644 --- a/arch/arm/mach-orion5x/mv2120-setup.c +++ b/arch/arm/mach-orion5x/mv2120-setup.c | |||
@@ -204,7 +204,8 @@ static void __init mv2120_init(void) | |||
204 | orion5x_uart0_init(); | 204 | orion5x_uart0_init(); |
205 | orion5x_xor_init(); | 205 | orion5x_xor_init(); |
206 | 206 | ||
207 | orion5x_setup_dev_boot_win(MV2120_NOR_BOOT_BASE, MV2120_NOR_BOOT_SIZE); | 207 | mvebu_mbus_add_window("devbus-boot", MV2120_NOR_BOOT_BASE, |
208 | MV2120_NOR_BOOT_SIZE); | ||
208 | platform_device_register(&mv2120_nor_flash); | 209 | platform_device_register(&mv2120_nor_flash); |
209 | 210 | ||
210 | platform_device_register(&mv2120_button_device); | 211 | platform_device_register(&mv2120_button_device); |
diff --git a/arch/arm/mach-orion5x/net2big-setup.c b/arch/arm/mach-orion5x/net2big-setup.c index 282e503b003e..dd0641a0d074 100644 --- a/arch/arm/mach-orion5x/net2big-setup.c +++ b/arch/arm/mach-orion5x/net2big-setup.c | |||
@@ -397,8 +397,8 @@ static void __init net2big_init(void) | |||
397 | net2big_sata_power_init(); | 397 | net2big_sata_power_init(); |
398 | orion5x_sata_init(&net2big_sata_data); | 398 | orion5x_sata_init(&net2big_sata_data); |
399 | 399 | ||
400 | orion5x_setup_dev_boot_win(NET2BIG_NOR_BOOT_BASE, | 400 | mvebu_mbus_add_window("devbus-boot", NET2BIG_NOR_BOOT_BASE, |
401 | NET2BIG_NOR_BOOT_SIZE); | 401 | NET2BIG_NOR_BOOT_SIZE); |
402 | platform_device_register(&net2big_nor_flash); | 402 | platform_device_register(&net2big_nor_flash); |
403 | 403 | ||
404 | platform_device_register(&net2big_gpio_buttons); | 404 | platform_device_register(&net2big_gpio_buttons); |
diff --git a/arch/arm/mach-orion5x/pci.c b/arch/arm/mach-orion5x/pci.c index d9c7c3bf0d9c..503368023bb1 100644 --- a/arch/arm/mach-orion5x/pci.c +++ b/arch/arm/mach-orion5x/pci.c | |||
@@ -157,8 +157,11 @@ static int __init pcie_setup(struct pci_sys_data *sys) | |||
157 | if (dev == MV88F5181_DEV_ID || dev == MV88F5182_DEV_ID) { | 157 | if (dev == MV88F5181_DEV_ID || dev == MV88F5182_DEV_ID) { |
158 | printk(KERN_NOTICE "Applying Orion-1/Orion-NAS PCIe config " | 158 | printk(KERN_NOTICE "Applying Orion-1/Orion-NAS PCIe config " |
159 | "read transaction workaround\n"); | 159 | "read transaction workaround\n"); |
160 | orion5x_setup_pcie_wa_win(ORION5X_PCIE_WA_PHYS_BASE, | 160 | mvebu_mbus_add_window_remap_flags("pcie0.0", |
161 | ORION5X_PCIE_WA_SIZE); | 161 | ORION5X_PCIE_WA_PHYS_BASE, |
162 | ORION5X_PCIE_WA_SIZE, | ||
163 | MVEBU_MBUS_NO_REMAP, | ||
164 | MVEBU_MBUS_PCI_WA); | ||
162 | pcie_ops.read = pcie_rd_conf_wa; | 165 | pcie_ops.read = pcie_rd_conf_wa; |
163 | } | 166 | } |
164 | 167 | ||
@@ -402,8 +405,9 @@ static void __init orion5x_pci_master_slave_enable(void) | |||
402 | orion5x_pci_hw_wr_conf(bus_nr, 0, func, reg, 4, val | 0x7); | 405 | orion5x_pci_hw_wr_conf(bus_nr, 0, func, reg, 4, val | 0x7); |
403 | } | 406 | } |
404 | 407 | ||
405 | static void __init orion5x_setup_pci_wins(struct mbus_dram_target_info *dram) | 408 | static void __init orion5x_setup_pci_wins(void) |
406 | { | 409 | { |
410 | const struct mbus_dram_target_info *dram = mv_mbus_dram_info(); | ||
407 | u32 win_enable; | 411 | u32 win_enable; |
408 | int bus; | 412 | int bus; |
409 | int i; | 413 | int i; |
@@ -420,7 +424,7 @@ static void __init orion5x_setup_pci_wins(struct mbus_dram_target_info *dram) | |||
420 | bus = orion5x_pci_local_bus_nr(); | 424 | bus = orion5x_pci_local_bus_nr(); |
421 | 425 | ||
422 | for (i = 0; i < dram->num_cs; i++) { | 426 | for (i = 0; i < dram->num_cs; i++) { |
423 | struct mbus_dram_window *cs = dram->cs + i; | 427 | const struct mbus_dram_window *cs = dram->cs + i; |
424 | u32 func = PCI_CONF_FUNC_BAR_CS(cs->cs_index); | 428 | u32 func = PCI_CONF_FUNC_BAR_CS(cs->cs_index); |
425 | u32 reg; | 429 | u32 reg; |
426 | u32 val; | 430 | u32 val; |
@@ -467,7 +471,7 @@ static int __init pci_setup(struct pci_sys_data *sys) | |||
467 | /* | 471 | /* |
468 | * Point PCI unit MBUS decode windows to DRAM space. | 472 | * Point PCI unit MBUS decode windows to DRAM space. |
469 | */ | 473 | */ |
470 | orion5x_setup_pci_wins(&orion_mbus_dram_info); | 474 | orion5x_setup_pci_wins(); |
471 | 475 | ||
472 | /* | 476 | /* |
473 | * Master + Slave enable | 477 | * Master + Slave enable |
diff --git a/arch/arm/mach-orion5x/rd88f5181l-fxo-setup.c b/arch/arm/mach-orion5x/rd88f5181l-fxo-setup.c index d6e72f672afb..1c4498bf650a 100644 --- a/arch/arm/mach-orion5x/rd88f5181l-fxo-setup.c +++ b/arch/arm/mach-orion5x/rd88f5181l-fxo-setup.c | |||
@@ -123,8 +123,8 @@ static void __init rd88f5181l_fxo_init(void) | |||
123 | orion5x_eth_switch_init(&rd88f5181l_fxo_switch_plat_data, NO_IRQ); | 123 | orion5x_eth_switch_init(&rd88f5181l_fxo_switch_plat_data, NO_IRQ); |
124 | orion5x_uart0_init(); | 124 | orion5x_uart0_init(); |
125 | 125 | ||
126 | orion5x_setup_dev_boot_win(RD88F5181L_FXO_NOR_BOOT_BASE, | 126 | mvebu_mbus_add_window("devbus-boot", RD88F5181L_FXO_NOR_BOOT_BASE, |
127 | RD88F5181L_FXO_NOR_BOOT_SIZE); | 127 | RD88F5181L_FXO_NOR_BOOT_SIZE); |
128 | platform_device_register(&rd88f5181l_fxo_nor_boot_flash); | 128 | platform_device_register(&rd88f5181l_fxo_nor_boot_flash); |
129 | } | 129 | } |
130 | 130 | ||
diff --git a/arch/arm/mach-orion5x/rd88f5181l-ge-setup.c b/arch/arm/mach-orion5x/rd88f5181l-ge-setup.c index c8b7913310e5..adabe34c4fc6 100644 --- a/arch/arm/mach-orion5x/rd88f5181l-ge-setup.c +++ b/arch/arm/mach-orion5x/rd88f5181l-ge-setup.c | |||
@@ -130,8 +130,8 @@ static void __init rd88f5181l_ge_init(void) | |||
130 | orion5x_i2c_init(); | 130 | orion5x_i2c_init(); |
131 | orion5x_uart0_init(); | 131 | orion5x_uart0_init(); |
132 | 132 | ||
133 | orion5x_setup_dev_boot_win(RD88F5181L_GE_NOR_BOOT_BASE, | 133 | mvebu_mbus_add_window("devbus-boot", RD88F5181L_GE_NOR_BOOT_BASE, |
134 | RD88F5181L_GE_NOR_BOOT_SIZE); | 134 | RD88F5181L_GE_NOR_BOOT_SIZE); |
135 | platform_device_register(&rd88f5181l_ge_nor_boot_flash); | 135 | platform_device_register(&rd88f5181l_ge_nor_boot_flash); |
136 | 136 | ||
137 | i2c_register_board_info(0, &rd88f5181l_ge_i2c_rtc, 1); | 137 | i2c_register_board_info(0, &rd88f5181l_ge_i2c_rtc, 1); |
diff --git a/arch/arm/mach-orion5x/rd88f5182-setup.c b/arch/arm/mach-orion5x/rd88f5182-setup.c index f9e156725d7c..66e77ec91532 100644 --- a/arch/arm/mach-orion5x/rd88f5182-setup.c +++ b/arch/arm/mach-orion5x/rd88f5182-setup.c | |||
@@ -264,10 +264,11 @@ static void __init rd88f5182_init(void) | |||
264 | orion5x_uart0_init(); | 264 | orion5x_uart0_init(); |
265 | orion5x_xor_init(); | 265 | orion5x_xor_init(); |
266 | 266 | ||
267 | orion5x_setup_dev_boot_win(RD88F5182_NOR_BOOT_BASE, | 267 | mvebu_mbus_add_window("devbus-boot", RD88F5182_NOR_BOOT_BASE, |
268 | RD88F5182_NOR_BOOT_SIZE); | 268 | RD88F5182_NOR_BOOT_SIZE); |
269 | 269 | ||
270 | orion5x_setup_dev1_win(RD88F5182_NOR_BASE, RD88F5182_NOR_SIZE); | 270 | mvebu_mbus_add_window("devbus-cs1", RD88F5182_NOR_BASE, |
271 | RD88F5182_NOR_SIZE); | ||
271 | platform_device_register(&rd88f5182_nor_flash); | 272 | platform_device_register(&rd88f5182_nor_flash); |
272 | platform_device_register(&rd88f5182_gpio_leds); | 273 | platform_device_register(&rd88f5182_gpio_leds); |
273 | 274 | ||
diff --git a/arch/arm/mach-orion5x/terastation_pro2-setup.c b/arch/arm/mach-orion5x/terastation_pro2-setup.c index acc0877ec1c9..a0bfa53e7556 100644 --- a/arch/arm/mach-orion5x/terastation_pro2-setup.c +++ b/arch/arm/mach-orion5x/terastation_pro2-setup.c | |||
@@ -329,8 +329,8 @@ static void __init tsp2_init(void) | |||
329 | /* | 329 | /* |
330 | * Configure peripherals. | 330 | * Configure peripherals. |
331 | */ | 331 | */ |
332 | orion5x_setup_dev_boot_win(TSP2_NOR_BOOT_BASE, | 332 | mvebu_mbus_add_window("devbus-boot", TSP2_NOR_BOOT_BASE, |
333 | TSP2_NOR_BOOT_SIZE); | 333 | TSP2_NOR_BOOT_SIZE); |
334 | platform_device_register(&tsp2_nor_flash); | 334 | platform_device_register(&tsp2_nor_flash); |
335 | 335 | ||
336 | orion5x_ehci0_init(); | 336 | orion5x_ehci0_init(); |
diff --git a/arch/arm/mach-orion5x/ts209-setup.c b/arch/arm/mach-orion5x/ts209-setup.c index 9c17f0c2b488..80174f0f168e 100644 --- a/arch/arm/mach-orion5x/ts209-setup.c +++ b/arch/arm/mach-orion5x/ts209-setup.c | |||
@@ -286,8 +286,8 @@ static void __init qnap_ts209_init(void) | |||
286 | /* | 286 | /* |
287 | * Configure peripherals. | 287 | * Configure peripherals. |
288 | */ | 288 | */ |
289 | orion5x_setup_dev_boot_win(QNAP_TS209_NOR_BOOT_BASE, | 289 | mvebu_mbus_add_window("devbus-boot", QNAP_TS209_NOR_BOOT_BASE, |
290 | QNAP_TS209_NOR_BOOT_SIZE); | 290 | QNAP_TS209_NOR_BOOT_SIZE); |
291 | platform_device_register(&qnap_ts209_nor_flash); | 291 | platform_device_register(&qnap_ts209_nor_flash); |
292 | 292 | ||
293 | orion5x_ehci0_init(); | 293 | orion5x_ehci0_init(); |
diff --git a/arch/arm/mach-orion5x/ts409-setup.c b/arch/arm/mach-orion5x/ts409-setup.c index 8cc5ab6c503e..92592790d6da 100644 --- a/arch/arm/mach-orion5x/ts409-setup.c +++ b/arch/arm/mach-orion5x/ts409-setup.c | |||
@@ -277,8 +277,8 @@ static void __init qnap_ts409_init(void) | |||
277 | /* | 277 | /* |
278 | * Configure peripherals. | 278 | * Configure peripherals. |
279 | */ | 279 | */ |
280 | orion5x_setup_dev_boot_win(QNAP_TS409_NOR_BOOT_BASE, | 280 | mvebu_mbus_add_window("devbus-boot", QNAP_TS409_NOR_BOOT_BASE, |
281 | QNAP_TS409_NOR_BOOT_SIZE); | 281 | QNAP_TS409_NOR_BOOT_SIZE); |
282 | platform_device_register(&qnap_ts409_nor_flash); | 282 | platform_device_register(&qnap_ts409_nor_flash); |
283 | 283 | ||
284 | orion5x_ehci0_init(); | 284 | orion5x_ehci0_init(); |
diff --git a/arch/arm/mach-orion5x/wnr854t-setup.c b/arch/arm/mach-orion5x/wnr854t-setup.c index 66552ca7e05d..6b84863c018d 100644 --- a/arch/arm/mach-orion5x/wnr854t-setup.c +++ b/arch/arm/mach-orion5x/wnr854t-setup.c | |||
@@ -127,8 +127,8 @@ static void __init wnr854t_init(void) | |||
127 | orion5x_eth_switch_init(&wnr854t_switch_plat_data, NO_IRQ); | 127 | orion5x_eth_switch_init(&wnr854t_switch_plat_data, NO_IRQ); |
128 | orion5x_uart0_init(); | 128 | orion5x_uart0_init(); |
129 | 129 | ||
130 | orion5x_setup_dev_boot_win(WNR854T_NOR_BOOT_BASE, | 130 | mvebu_mbus_add_window("devbus-boot", WNR854T_NOR_BOOT_BASE, |
131 | WNR854T_NOR_BOOT_SIZE); | 131 | WNR854T_NOR_BOOT_SIZE); |
132 | platform_device_register(&wnr854t_nor_flash); | 132 | platform_device_register(&wnr854t_nor_flash); |
133 | } | 133 | } |
134 | 134 | ||
diff --git a/arch/arm/mach-orion5x/wrt350n-v2-setup.c b/arch/arm/mach-orion5x/wrt350n-v2-setup.c index 2c5408e2e689..fae684bc54f2 100644 --- a/arch/arm/mach-orion5x/wrt350n-v2-setup.c +++ b/arch/arm/mach-orion5x/wrt350n-v2-setup.c | |||
@@ -213,8 +213,8 @@ static void __init wrt350n_v2_init(void) | |||
213 | orion5x_eth_switch_init(&wrt350n_v2_switch_plat_data, NO_IRQ); | 213 | orion5x_eth_switch_init(&wrt350n_v2_switch_plat_data, NO_IRQ); |
214 | orion5x_uart0_init(); | 214 | orion5x_uart0_init(); |
215 | 215 | ||
216 | orion5x_setup_dev_boot_win(WRT350N_V2_NOR_BOOT_BASE, | 216 | mvebu_mbus_add_window("devbus-boot", WRT350N_V2_NOR_BOOT_BASE, |
217 | WRT350N_V2_NOR_BOOT_SIZE); | 217 | WRT350N_V2_NOR_BOOT_SIZE); |
218 | platform_device_register(&wrt350n_v2_nor_flash); | 218 | platform_device_register(&wrt350n_v2_nor_flash); |
219 | platform_device_register(&wrt350n_v2_leds); | 219 | platform_device_register(&wrt350n_v2_leds); |
220 | platform_device_register(&wrt350n_v2_button_device); | 220 | platform_device_register(&wrt350n_v2_button_device); |
diff --git a/arch/arm/mach-pxa/raumfeld.c b/arch/arm/mach-pxa/raumfeld.c index af41888acbd6..969b0ba7fa70 100644 --- a/arch/arm/mach-pxa/raumfeld.c +++ b/arch/arm/mach-pxa/raumfeld.c | |||
@@ -505,6 +505,7 @@ static struct w1_gpio_platform_data w1_gpio_platform_data = { | |||
505 | .pin = GPIO_ONE_WIRE, | 505 | .pin = GPIO_ONE_WIRE, |
506 | .is_open_drain = 0, | 506 | .is_open_drain = 0, |
507 | .enable_external_pullup = w1_enable_external_pullup, | 507 | .enable_external_pullup = w1_enable_external_pullup, |
508 | .ext_pullup_enable_pin = -EINVAL, | ||
508 | }; | 509 | }; |
509 | 510 | ||
510 | struct platform_device raumfeld_w1_gpio_device = { | 511 | struct platform_device raumfeld_w1_gpio_device = { |
diff --git a/arch/arm/mach-s5pv210/clock.c b/arch/arm/mach-s5pv210/clock.c index fcdf52dbcc49..f051f53e35b7 100644 --- a/arch/arm/mach-s5pv210/clock.c +++ b/arch/arm/mach-s5pv210/clock.c | |||
@@ -214,11 +214,6 @@ static struct clk clk_pcmcdclk2 = { | |||
214 | .name = "pcmcdclk", | 214 | .name = "pcmcdclk", |
215 | }; | 215 | }; |
216 | 216 | ||
217 | static struct clk dummy_apb_pclk = { | ||
218 | .name = "apb_pclk", | ||
219 | .id = -1, | ||
220 | }; | ||
221 | |||
222 | static struct clk *clkset_vpllsrc_list[] = { | 217 | static struct clk *clkset_vpllsrc_list[] = { |
223 | [0] = &clk_fin_vpll, | 218 | [0] = &clk_fin_vpll, |
224 | [1] = &clk_sclk_hdmi27m, | 219 | [1] = &clk_sclk_hdmi27m, |
@@ -305,18 +300,6 @@ static struct clk_ops clk_fout_apll_ops = { | |||
305 | 300 | ||
306 | static struct clk init_clocks_off[] = { | 301 | static struct clk init_clocks_off[] = { |
307 | { | 302 | { |
308 | .name = "dma", | ||
309 | .devname = "dma-pl330.0", | ||
310 | .parent = &clk_hclk_psys.clk, | ||
311 | .enable = s5pv210_clk_ip0_ctrl, | ||
312 | .ctrlbit = (1 << 3), | ||
313 | }, { | ||
314 | .name = "dma", | ||
315 | .devname = "dma-pl330.1", | ||
316 | .parent = &clk_hclk_psys.clk, | ||
317 | .enable = s5pv210_clk_ip0_ctrl, | ||
318 | .ctrlbit = (1 << 4), | ||
319 | }, { | ||
320 | .name = "rot", | 303 | .name = "rot", |
321 | .parent = &clk_hclk_dsys.clk, | 304 | .parent = &clk_hclk_dsys.clk, |
322 | .enable = s5pv210_clk_ip0_ctrl, | 305 | .enable = s5pv210_clk_ip0_ctrl, |
@@ -573,6 +556,20 @@ static struct clk clk_hsmmc3 = { | |||
573 | .ctrlbit = (1<<19), | 556 | .ctrlbit = (1<<19), |
574 | }; | 557 | }; |
575 | 558 | ||
559 | static struct clk clk_pdma0 = { | ||
560 | .name = "pdma0", | ||
561 | .parent = &clk_hclk_psys.clk, | ||
562 | .enable = s5pv210_clk_ip0_ctrl, | ||
563 | .ctrlbit = (1 << 3), | ||
564 | }; | ||
565 | |||
566 | static struct clk clk_pdma1 = { | ||
567 | .name = "pdma1", | ||
568 | .parent = &clk_hclk_psys.clk, | ||
569 | .enable = s5pv210_clk_ip0_ctrl, | ||
570 | .ctrlbit = (1 << 4), | ||
571 | }; | ||
572 | |||
576 | static struct clk *clkset_uart_list[] = { | 573 | static struct clk *clkset_uart_list[] = { |
577 | [6] = &clk_mout_mpll.clk, | 574 | [6] = &clk_mout_mpll.clk, |
578 | [7] = &clk_mout_epll.clk, | 575 | [7] = &clk_mout_epll.clk, |
@@ -1075,6 +1072,8 @@ static struct clk *clk_cdev[] = { | |||
1075 | &clk_hsmmc1, | 1072 | &clk_hsmmc1, |
1076 | &clk_hsmmc2, | 1073 | &clk_hsmmc2, |
1077 | &clk_hsmmc3, | 1074 | &clk_hsmmc3, |
1075 | &clk_pdma0, | ||
1076 | &clk_pdma1, | ||
1078 | }; | 1077 | }; |
1079 | 1078 | ||
1080 | /* Clock initialisation code */ | 1079 | /* Clock initialisation code */ |
@@ -1333,6 +1332,8 @@ static struct clk_lookup s5pv210_clk_lookup[] = { | |||
1333 | CLKDEV_INIT(NULL, "spi_busclk0", &clk_p), | 1332 | CLKDEV_INIT(NULL, "spi_busclk0", &clk_p), |
1334 | CLKDEV_INIT("s5pv210-spi.0", "spi_busclk1", &clk_sclk_spi0.clk), | 1333 | CLKDEV_INIT("s5pv210-spi.0", "spi_busclk1", &clk_sclk_spi0.clk), |
1335 | CLKDEV_INIT("s5pv210-spi.1", "spi_busclk1", &clk_sclk_spi1.clk), | 1334 | CLKDEV_INIT("s5pv210-spi.1", "spi_busclk1", &clk_sclk_spi1.clk), |
1335 | CLKDEV_INIT("dma-pl330.0", "apb_pclk", &clk_pdma0), | ||
1336 | CLKDEV_INIT("dma-pl330.1", "apb_pclk", &clk_pdma1), | ||
1336 | }; | 1337 | }; |
1337 | 1338 | ||
1338 | void __init s5pv210_register_clocks(void) | 1339 | void __init s5pv210_register_clocks(void) |
@@ -1361,6 +1362,5 @@ void __init s5pv210_register_clocks(void) | |||
1361 | for (ptr = 0; ptr < ARRAY_SIZE(clk_cdev); ptr++) | 1362 | for (ptr = 0; ptr < ARRAY_SIZE(clk_cdev); ptr++) |
1362 | s3c_disable_clocks(clk_cdev[ptr], 1); | 1363 | s3c_disable_clocks(clk_cdev[ptr], 1); |
1363 | 1364 | ||
1364 | s3c24xx_register_clock(&dummy_apb_pclk); | ||
1365 | s3c_pwmclk_init(); | 1365 | s3c_pwmclk_init(); |
1366 | } | 1366 | } |
diff --git a/arch/arm/mach-s5pv210/mach-goni.c b/arch/arm/mach-s5pv210/mach-goni.c index 3a38f7b34b94..e373de44a8b6 100644 --- a/arch/arm/mach-s5pv210/mach-goni.c +++ b/arch/arm/mach-s5pv210/mach-goni.c | |||
@@ -845,7 +845,7 @@ static struct fimc_source_info goni_camera_sensors[] = { | |||
845 | .mux_id = 0, | 845 | .mux_id = 0, |
846 | .flags = V4L2_MBUS_PCLK_SAMPLE_FALLING | | 846 | .flags = V4L2_MBUS_PCLK_SAMPLE_FALLING | |
847 | V4L2_MBUS_VSYNC_ACTIVE_LOW, | 847 | V4L2_MBUS_VSYNC_ACTIVE_LOW, |
848 | .bus_type = FIMC_BUS_TYPE_ITU_601, | 848 | .fimc_bus_type = FIMC_BUS_TYPE_ITU_601, |
849 | .board_info = &noon010pc30_board_info, | 849 | .board_info = &noon010pc30_board_info, |
850 | .i2c_bus_num = 0, | 850 | .i2c_bus_num = 0, |
851 | .clk_frequency = 16000000UL, | 851 | .clk_frequency = 16000000UL, |
diff --git a/arch/arm/mach-shmobile/board-marzen.c b/arch/arm/mach-shmobile/board-marzen.c index cdcb799e802f..fec49ebc359a 100644 --- a/arch/arm/mach-shmobile/board-marzen.c +++ b/arch/arm/mach-shmobile/board-marzen.c | |||
@@ -32,6 +32,7 @@ | |||
32 | #include <linux/smsc911x.h> | 32 | #include <linux/smsc911x.h> |
33 | #include <linux/spi/spi.h> | 33 | #include <linux/spi/spi.h> |
34 | #include <linux/spi/sh_hspi.h> | 34 | #include <linux/spi/sh_hspi.h> |
35 | #include <linux/mmc/host.h> | ||
35 | #include <linux/mmc/sh_mobile_sdhi.h> | 36 | #include <linux/mmc/sh_mobile_sdhi.h> |
36 | #include <linux/mfd/tmio.h> | 37 | #include <linux/mfd/tmio.h> |
37 | #include <linux/usb/otg.h> | 38 | #include <linux/usb/otg.h> |
diff --git a/arch/arm/mach-spear3xx/spear3xx.c b/arch/arm/mach-spear3xx/spear3xx.c index f9d754f90c59..d2b3937c4014 100644 --- a/arch/arm/mach-spear3xx/spear3xx.c +++ b/arch/arm/mach-spear3xx/spear3xx.c | |||
@@ -14,7 +14,7 @@ | |||
14 | #define pr_fmt(fmt) "SPEAr3xx: " fmt | 14 | #define pr_fmt(fmt) "SPEAr3xx: " fmt |
15 | 15 | ||
16 | #include <linux/amba/pl022.h> | 16 | #include <linux/amba/pl022.h> |
17 | #include <linux/amba/pl08x.h> | 17 | #include <linux/amba/pl080.h> |
18 | #include <linux/io.h> | 18 | #include <linux/io.h> |
19 | #include <plat/pl080.h> | 19 | #include <plat/pl080.h> |
20 | #include <mach/generic.h> | 20 | #include <mach/generic.h> |
diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c index c7e3759f16d3..e9db6b4bf65a 100644 --- a/arch/arm/mm/dma-mapping.c +++ b/arch/arm/mm/dma-mapping.c | |||
@@ -342,6 +342,7 @@ static int __init atomic_pool_init(void) | |||
342 | { | 342 | { |
343 | struct dma_pool *pool = &atomic_pool; | 343 | struct dma_pool *pool = &atomic_pool; |
344 | pgprot_t prot = pgprot_dmacoherent(pgprot_kernel); | 344 | pgprot_t prot = pgprot_dmacoherent(pgprot_kernel); |
345 | gfp_t gfp = GFP_KERNEL | GFP_DMA; | ||
345 | unsigned long nr_pages = pool->size >> PAGE_SHIFT; | 346 | unsigned long nr_pages = pool->size >> PAGE_SHIFT; |
346 | unsigned long *bitmap; | 347 | unsigned long *bitmap; |
347 | struct page *page; | 348 | struct page *page; |
@@ -361,8 +362,8 @@ static int __init atomic_pool_init(void) | |||
361 | ptr = __alloc_from_contiguous(NULL, pool->size, prot, &page, | 362 | ptr = __alloc_from_contiguous(NULL, pool->size, prot, &page, |
362 | atomic_pool_init); | 363 | atomic_pool_init); |
363 | else | 364 | else |
364 | ptr = __alloc_remap_buffer(NULL, pool->size, GFP_KERNEL, prot, | 365 | ptr = __alloc_remap_buffer(NULL, pool->size, gfp, prot, &page, |
365 | &page, atomic_pool_init); | 366 | atomic_pool_init); |
366 | if (ptr) { | 367 | if (ptr) { |
367 | int i; | 368 | int i; |
368 | 369 | ||
diff --git a/arch/arm/net/bpf_jit_32.c b/arch/arm/net/bpf_jit_32.c index 6828ef6ce80e..a0bd8a755bdf 100644 --- a/arch/arm/net/bpf_jit_32.c +++ b/arch/arm/net/bpf_jit_32.c | |||
@@ -576,7 +576,7 @@ load_ind: | |||
576 | /* x = ((*(frame + k)) & 0xf) << 2; */ | 576 | /* x = ((*(frame + k)) & 0xf) << 2; */ |
577 | ctx->seen |= SEEN_X | SEEN_DATA | SEEN_CALL; | 577 | ctx->seen |= SEEN_X | SEEN_DATA | SEEN_CALL; |
578 | /* the interpreter should deal with the negative K */ | 578 | /* the interpreter should deal with the negative K */ |
579 | if (k < 0) | 579 | if ((int)k < 0) |
580 | return -1; | 580 | return -1; |
581 | /* offset in r1: we might have to take the slow path */ | 581 | /* offset in r1: we might have to take the slow path */ |
582 | emit_mov_i(r_off, k, ctx); | 582 | emit_mov_i(r_off, k, ctx); |
diff --git a/arch/arm/plat-orion/Makefile b/arch/arm/plat-orion/Makefile index a82cecb84948..2eca54b65906 100644 --- a/arch/arm/plat-orion/Makefile +++ b/arch/arm/plat-orion/Makefile | |||
@@ -3,8 +3,6 @@ | |||
3 | # | 3 | # |
4 | ccflags-$(CONFIG_ARCH_MULTIPLATFORM) := -I$(srctree)/$(src)/include | 4 | ccflags-$(CONFIG_ARCH_MULTIPLATFORM) := -I$(srctree)/$(src)/include |
5 | 5 | ||
6 | obj-y += addr-map.o | ||
7 | |||
8 | orion-gpio-$(CONFIG_GENERIC_GPIO) += gpio.o | 6 | orion-gpio-$(CONFIG_GENERIC_GPIO) += gpio.o |
9 | obj-$(CONFIG_PLAT_ORION_LEGACY) += irq.o pcie.o time.o common.o mpp.o | 7 | obj-$(CONFIG_PLAT_ORION_LEGACY) += irq.o pcie.o time.o common.o mpp.o |
10 | obj-$(CONFIG_PLAT_ORION_LEGACY) += $(orion-gpio-y) | 8 | obj-$(CONFIG_PLAT_ORION_LEGACY) += $(orion-gpio-y) |
diff --git a/arch/arm/plat-orion/addr-map.c b/arch/arm/plat-orion/addr-map.c deleted file mode 100644 index 807ac8e5cbc0..000000000000 --- a/arch/arm/plat-orion/addr-map.c +++ /dev/null | |||
@@ -1,178 +0,0 @@ | |||
1 | /* | ||
2 | * arch/arm/plat-orion/addr-map.c | ||
3 | * | ||
4 | * Address map functions for Marvell Orion based SoCs | ||
5 | * | ||
6 | * This file is licensed under the terms of the GNU General Public | ||
7 | * License version 2. This program is licensed "as is" without any | ||
8 | * warranty of any kind, whether express or implied. | ||
9 | */ | ||
10 | |||
11 | #include <linux/kernel.h> | ||
12 | #include <linux/module.h> | ||
13 | #include <linux/init.h> | ||
14 | #include <linux/mbus.h> | ||
15 | #include <linux/io.h> | ||
16 | #include <plat/addr-map.h> | ||
17 | |||
18 | struct mbus_dram_target_info orion_mbus_dram_info; | ||
19 | |||
20 | const struct mbus_dram_target_info *mv_mbus_dram_info(void) | ||
21 | { | ||
22 | return &orion_mbus_dram_info; | ||
23 | } | ||
24 | EXPORT_SYMBOL_GPL(mv_mbus_dram_info); | ||
25 | |||
26 | /* | ||
27 | * DDR target is the same on all Orion platforms. | ||
28 | */ | ||
29 | #define TARGET_DDR 0 | ||
30 | |||
31 | /* | ||
32 | * Helpers to get DDR bank info | ||
33 | */ | ||
34 | #define DDR_BASE_CS_OFF(n) (0x0000 + ((n) << 3)) | ||
35 | #define DDR_SIZE_CS_OFF(n) (0x0004 + ((n) << 3)) | ||
36 | |||
37 | /* | ||
38 | * CPU Address Decode Windows registers | ||
39 | */ | ||
40 | #define WIN_CTRL_OFF 0x0000 | ||
41 | #define WIN_BASE_OFF 0x0004 | ||
42 | #define WIN_REMAP_LO_OFF 0x0008 | ||
43 | #define WIN_REMAP_HI_OFF 0x000c | ||
44 | |||
45 | #define ATTR_HW_COHERENCY (0x1 << 4) | ||
46 | |||
47 | /* | ||
48 | * Default implementation | ||
49 | */ | ||
50 | static void __init __iomem * | ||
51 | orion_win_cfg_base(const struct orion_addr_map_cfg *cfg, int win) | ||
52 | { | ||
53 | return cfg->bridge_virt_base + (win << 4); | ||
54 | } | ||
55 | |||
56 | /* | ||
57 | * Default implementation | ||
58 | */ | ||
59 | static int __init orion_cpu_win_can_remap(const struct orion_addr_map_cfg *cfg, | ||
60 | const int win) | ||
61 | { | ||
62 | if (win < cfg->remappable_wins) | ||
63 | return 1; | ||
64 | |||
65 | return 0; | ||
66 | } | ||
67 | |||
68 | void __init orion_setup_cpu_win(const struct orion_addr_map_cfg *cfg, | ||
69 | const int win, const u32 base, | ||
70 | const u32 size, const u8 target, | ||
71 | const u8 attr, const int remap) | ||
72 | { | ||
73 | void __iomem *addr = cfg->win_cfg_base(cfg, win); | ||
74 | u32 ctrl, base_high, remap_addr; | ||
75 | |||
76 | if (win >= cfg->num_wins) { | ||
77 | printk(KERN_ERR "setup_cpu_win: trying to allocate window " | ||
78 | "%d when only %d allowed\n", win, cfg->num_wins); | ||
79 | } | ||
80 | |||
81 | base_high = base & 0xffff0000; | ||
82 | ctrl = ((size - 1) & 0xffff0000) | (attr << 8) | (target << 4) | 1; | ||
83 | |||
84 | writel(base_high, addr + WIN_BASE_OFF); | ||
85 | writel(ctrl, addr + WIN_CTRL_OFF); | ||
86 | if (cfg->cpu_win_can_remap(cfg, win)) { | ||
87 | if (remap < 0) | ||
88 | remap_addr = base; | ||
89 | else | ||
90 | remap_addr = remap; | ||
91 | writel(remap_addr & 0xffff0000, addr + WIN_REMAP_LO_OFF); | ||
92 | writel(0, addr + WIN_REMAP_HI_OFF); | ||
93 | } | ||
94 | } | ||
95 | |||
96 | /* | ||
97 | * Configure a number of windows. | ||
98 | */ | ||
99 | static void __init orion_setup_cpu_wins(const struct orion_addr_map_cfg * cfg, | ||
100 | const struct orion_addr_map_info *info) | ||
101 | { | ||
102 | while (info->win != -1) { | ||
103 | orion_setup_cpu_win(cfg, info->win, info->base, info->size, | ||
104 | info->target, info->attr, info->remap); | ||
105 | info++; | ||
106 | } | ||
107 | } | ||
108 | |||
109 | static void __init orion_disable_wins(const struct orion_addr_map_cfg * cfg) | ||
110 | { | ||
111 | void __iomem *addr; | ||
112 | int i; | ||
113 | |||
114 | for (i = 0; i < cfg->num_wins; i++) { | ||
115 | addr = cfg->win_cfg_base(cfg, i); | ||
116 | |||
117 | writel(0, addr + WIN_BASE_OFF); | ||
118 | writel(0, addr + WIN_CTRL_OFF); | ||
119 | if (cfg->cpu_win_can_remap(cfg, i)) { | ||
120 | writel(0, addr + WIN_REMAP_LO_OFF); | ||
121 | writel(0, addr + WIN_REMAP_HI_OFF); | ||
122 | } | ||
123 | } | ||
124 | } | ||
125 | |||
126 | /* | ||
127 | * Disable, clear and configure windows. | ||
128 | */ | ||
129 | void __init orion_config_wins(struct orion_addr_map_cfg * cfg, | ||
130 | const struct orion_addr_map_info *info) | ||
131 | { | ||
132 | if (!cfg->cpu_win_can_remap) | ||
133 | cfg->cpu_win_can_remap = orion_cpu_win_can_remap; | ||
134 | |||
135 | if (!cfg->win_cfg_base) | ||
136 | cfg->win_cfg_base = orion_win_cfg_base; | ||
137 | |||
138 | orion_disable_wins(cfg); | ||
139 | |||
140 | if (info) | ||
141 | orion_setup_cpu_wins(cfg, info); | ||
142 | } | ||
143 | |||
144 | /* | ||
145 | * Setup MBUS dram target info. | ||
146 | */ | ||
147 | void __init orion_setup_cpu_mbus_target(const struct orion_addr_map_cfg *cfg, | ||
148 | const void __iomem *ddr_window_cpu_base) | ||
149 | { | ||
150 | int i; | ||
151 | int cs; | ||
152 | |||
153 | orion_mbus_dram_info.mbus_dram_target_id = TARGET_DDR; | ||
154 | |||
155 | for (i = 0, cs = 0; i < 4; i++) { | ||
156 | u32 base = readl(ddr_window_cpu_base + DDR_BASE_CS_OFF(i)); | ||
157 | u32 size = readl(ddr_window_cpu_base + DDR_SIZE_CS_OFF(i)); | ||
158 | |||
159 | /* | ||
160 | * We only take care of entries for which the chip | ||
161 | * select is enabled, and that don't have high base | ||
162 | * address bits set (devices can only access the first | ||
163 | * 32 bits of the memory). | ||
164 | */ | ||
165 | if ((size & 1) && !(base & 0xF)) { | ||
166 | struct mbus_dram_window *w; | ||
167 | |||
168 | w = &orion_mbus_dram_info.cs[cs++]; | ||
169 | w->cs_index = i; | ||
170 | w->mbus_attr = 0xf & ~(1 << i); | ||
171 | if (cfg->hw_io_coherency) | ||
172 | w->mbus_attr |= ATTR_HW_COHERENCY; | ||
173 | w->base = base & 0xffff0000; | ||
174 | w->size = (size | 0x0000ffff) + 1; | ||
175 | } | ||
176 | } | ||
177 | orion_mbus_dram_info.num_cs = cs; | ||
178 | } | ||
diff --git a/arch/arm/plat-orion/gpio.c b/arch/arm/plat-orion/gpio.c index c29ee7ea200b..e39c2ba6e2fb 100644 --- a/arch/arm/plat-orion/gpio.c +++ b/arch/arm/plat-orion/gpio.c | |||
@@ -439,6 +439,64 @@ static void gpio_irq_handler(unsigned irq, struct irq_desc *desc) | |||
439 | } | 439 | } |
440 | } | 440 | } |
441 | 441 | ||
442 | #ifdef CONFIG_DEBUG_FS | ||
443 | #include <linux/seq_file.h> | ||
444 | |||
445 | static void orion_gpio_dbg_show(struct seq_file *s, struct gpio_chip *chip) | ||
446 | { | ||
447 | struct orion_gpio_chip *ochip = | ||
448 | container_of(chip, struct orion_gpio_chip, chip); | ||
449 | u32 out, io_conf, blink, in_pol, data_in, cause, edg_msk, lvl_msk; | ||
450 | int i; | ||
451 | |||
452 | out = readl_relaxed(GPIO_OUT(ochip)); | ||
453 | io_conf = readl_relaxed(GPIO_IO_CONF(ochip)); | ||
454 | blink = readl_relaxed(GPIO_BLINK_EN(ochip)); | ||
455 | in_pol = readl_relaxed(GPIO_IN_POL(ochip)); | ||
456 | data_in = readl_relaxed(GPIO_DATA_IN(ochip)); | ||
457 | cause = readl_relaxed(GPIO_EDGE_CAUSE(ochip)); | ||
458 | edg_msk = readl_relaxed(GPIO_EDGE_MASK(ochip)); | ||
459 | lvl_msk = readl_relaxed(GPIO_LEVEL_MASK(ochip)); | ||
460 | |||
461 | for (i = 0; i < chip->ngpio; i++) { | ||
462 | const char *label; | ||
463 | u32 msk; | ||
464 | bool is_out; | ||
465 | |||
466 | label = gpiochip_is_requested(chip, i); | ||
467 | if (!label) | ||
468 | continue; | ||
469 | |||
470 | msk = 1 << i; | ||
471 | is_out = !(io_conf & msk); | ||
472 | |||
473 | seq_printf(s, " gpio-%-3d (%-20.20s)", chip->base + i, label); | ||
474 | |||
475 | if (is_out) { | ||
476 | seq_printf(s, " out %s %s\n", | ||
477 | out & msk ? "hi" : "lo", | ||
478 | blink & msk ? "(blink )" : ""); | ||
479 | continue; | ||
480 | } | ||
481 | |||
482 | seq_printf(s, " in %s (act %s) - IRQ", | ||
483 | (data_in ^ in_pol) & msk ? "hi" : "lo", | ||
484 | in_pol & msk ? "lo" : "hi"); | ||
485 | if (!((edg_msk | lvl_msk) & msk)) { | ||
486 | seq_printf(s, " disabled\n"); | ||
487 | continue; | ||
488 | } | ||
489 | if (edg_msk & msk) | ||
490 | seq_printf(s, " edge "); | ||
491 | if (lvl_msk & msk) | ||
492 | seq_printf(s, " level"); | ||
493 | seq_printf(s, " (%s)\n", cause & msk ? "pending" : "clear "); | ||
494 | } | ||
495 | } | ||
496 | #else | ||
497 | #define orion_gpio_dbg_show NULL | ||
498 | #endif | ||
499 | |||
442 | void __init orion_gpio_init(struct device_node *np, | 500 | void __init orion_gpio_init(struct device_node *np, |
443 | int gpio_base, int ngpio, | 501 | int gpio_base, int ngpio, |
444 | void __iomem *base, int mask_offset, | 502 | void __iomem *base, int mask_offset, |
@@ -471,6 +529,7 @@ void __init orion_gpio_init(struct device_node *np, | |||
471 | #ifdef CONFIG_OF | 529 | #ifdef CONFIG_OF |
472 | ochip->chip.of_node = np; | 530 | ochip->chip.of_node = np; |
473 | #endif | 531 | #endif |
532 | ochip->chip.dbg_show = orion_gpio_dbg_show; | ||
474 | 533 | ||
475 | spin_lock_init(&ochip->lock); | 534 | spin_lock_init(&ochip->lock); |
476 | ochip->base = (void __iomem *)base; | 535 | ochip->base = (void __iomem *)base; |
diff --git a/arch/arm/plat-orion/pcie.c b/arch/arm/plat-orion/pcie.c index f20a321088a2..8b8c06d2e9c4 100644 --- a/arch/arm/plat-orion/pcie.c +++ b/arch/arm/plat-orion/pcie.c | |||
@@ -120,12 +120,14 @@ void __init orion_pcie_reset(void __iomem *base) | |||
120 | * BAR[0,2] -> disabled, BAR[1] -> covers all DRAM banks | 120 | * BAR[0,2] -> disabled, BAR[1] -> covers all DRAM banks |
121 | * WIN[0-3] -> DRAM bank[0-3] | 121 | * WIN[0-3] -> DRAM bank[0-3] |
122 | */ | 122 | */ |
123 | static void __init orion_pcie_setup_wins(void __iomem *base, | 123 | static void __init orion_pcie_setup_wins(void __iomem *base) |
124 | struct mbus_dram_target_info *dram) | ||
125 | { | 124 | { |
125 | const struct mbus_dram_target_info *dram; | ||
126 | u32 size; | 126 | u32 size; |
127 | int i; | 127 | int i; |
128 | 128 | ||
129 | dram = mv_mbus_dram_info(); | ||
130 | |||
129 | /* | 131 | /* |
130 | * First, disable and clear BARs and windows. | 132 | * First, disable and clear BARs and windows. |
131 | */ | 133 | */ |
@@ -150,7 +152,7 @@ static void __init orion_pcie_setup_wins(void __iomem *base, | |||
150 | */ | 152 | */ |
151 | size = 0; | 153 | size = 0; |
152 | for (i = 0; i < dram->num_cs; i++) { | 154 | for (i = 0; i < dram->num_cs; i++) { |
153 | struct mbus_dram_window *cs = dram->cs + i; | 155 | const struct mbus_dram_window *cs = dram->cs + i; |
154 | 156 | ||
155 | writel(cs->base & 0xffff0000, base + PCIE_WIN04_BASE_OFF(i)); | 157 | writel(cs->base & 0xffff0000, base + PCIE_WIN04_BASE_OFF(i)); |
156 | writel(0, base + PCIE_WIN04_REMAP_OFF(i)); | 158 | writel(0, base + PCIE_WIN04_REMAP_OFF(i)); |
@@ -184,7 +186,7 @@ void __init orion_pcie_setup(void __iomem *base) | |||
184 | /* | 186 | /* |
185 | * Point PCIe unit MBUS decode windows to DRAM space. | 187 | * Point PCIe unit MBUS decode windows to DRAM space. |
186 | */ | 188 | */ |
187 | orion_pcie_setup_wins(base, &orion_mbus_dram_info); | 189 | orion_pcie_setup_wins(base); |
188 | 190 | ||
189 | /* | 191 | /* |
190 | * Master + slave enable. | 192 | * Master + slave enable. |
diff --git a/arch/arm/plat-spear/Kconfig b/arch/arm/plat-spear/Kconfig index 739d016eb273..8a08c31b5e20 100644 --- a/arch/arm/plat-spear/Kconfig +++ b/arch/arm/plat-spear/Kconfig | |||
@@ -10,7 +10,7 @@ choice | |||
10 | 10 | ||
11 | config ARCH_SPEAR13XX | 11 | config ARCH_SPEAR13XX |
12 | bool "ST SPEAr13xx with Device Tree" | 12 | bool "ST SPEAr13xx with Device Tree" |
13 | select ARCH_HAVE_CPUFREQ | 13 | select ARCH_HAS_CPUFREQ |
14 | select ARM_GIC | 14 | select ARM_GIC |
15 | select CPU_V7 | 15 | select CPU_V7 |
16 | select GPIO_SPEAR_SPICS | 16 | select GPIO_SPEAR_SPICS |
diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig index fd70a68387eb..9b6d19f74078 100644 --- a/arch/arm64/Kconfig +++ b/arch/arm64/Kconfig | |||
@@ -9,7 +9,6 @@ config ARM64 | |||
9 | select CLONE_BACKWARDS | 9 | select CLONE_BACKWARDS |
10 | select COMMON_CLK | 10 | select COMMON_CLK |
11 | select GENERIC_CLOCKEVENTS | 11 | select GENERIC_CLOCKEVENTS |
12 | select GENERIC_HARDIRQS_NO_DEPRECATED | ||
13 | select GENERIC_IOMAP | 12 | select GENERIC_IOMAP |
14 | select GENERIC_IRQ_PROBE | 13 | select GENERIC_IRQ_PROBE |
15 | select GENERIC_IRQ_SHOW | 14 | select GENERIC_IRQ_SHOW |
diff --git a/arch/arm64/Kconfig.debug b/arch/arm64/Kconfig.debug index 51493430f142..1a6bfe954d49 100644 --- a/arch/arm64/Kconfig.debug +++ b/arch/arm64/Kconfig.debug | |||
@@ -6,17 +6,6 @@ config FRAME_POINTER | |||
6 | bool | 6 | bool |
7 | default y | 7 | default y |
8 | 8 | ||
9 | config DEBUG_ERRORS | ||
10 | bool "Verbose kernel error messages" | ||
11 | depends on DEBUG_KERNEL | ||
12 | help | ||
13 | This option controls verbose debugging information which can be | ||
14 | printed when the kernel detects an internal error. This debugging | ||
15 | information is useful to kernel hackers when tracking down problems, | ||
16 | but mostly meaningless to other people. It's safe to say Y unless | ||
17 | you are concerned with the code size or don't want to see these | ||
18 | messages. | ||
19 | |||
20 | config DEBUG_STACK_USAGE | 9 | config DEBUG_STACK_USAGE |
21 | bool "Enable stack utilization instrumentation" | 10 | bool "Enable stack utilization instrumentation" |
22 | depends on DEBUG_KERNEL | 11 | depends on DEBUG_KERNEL |
diff --git a/arch/arm64/configs/defconfig b/arch/arm64/configs/defconfig index 9212c7880da7..09bef29f3a09 100644 --- a/arch/arm64/configs/defconfig +++ b/arch/arm64/configs/defconfig | |||
@@ -82,4 +82,3 @@ CONFIG_DEBUG_KERNEL=y | |||
82 | CONFIG_DEBUG_INFO=y | 82 | CONFIG_DEBUG_INFO=y |
83 | # CONFIG_FTRACE is not set | 83 | # CONFIG_FTRACE is not set |
84 | CONFIG_ATOMIC64_SELFTEST=y | 84 | CONFIG_ATOMIC64_SELFTEST=y |
85 | CONFIG_DEBUG_ERRORS=y | ||
diff --git a/arch/arm64/include/asm/ucontext.h b/arch/arm64/include/asm/ucontext.h index bde960720892..42e04c877428 100644 --- a/arch/arm64/include/asm/ucontext.h +++ b/arch/arm64/include/asm/ucontext.h | |||
@@ -22,7 +22,7 @@ struct ucontext { | |||
22 | stack_t uc_stack; | 22 | stack_t uc_stack; |
23 | sigset_t uc_sigmask; | 23 | sigset_t uc_sigmask; |
24 | /* glibc uses a 1024-bit sigset_t */ | 24 | /* glibc uses a 1024-bit sigset_t */ |
25 | __u8 __unused[(1024 - sizeof(sigset_t)) / 8]; | 25 | __u8 __unused[1024 / 8 - sizeof(sigset_t)]; |
26 | /* last for future expansion */ | 26 | /* last for future expansion */ |
27 | struct sigcontext uc_mcontext; | 27 | struct sigcontext uc_mcontext; |
28 | }; | 28 | }; |
diff --git a/arch/arm64/kernel/arm64ksyms.c b/arch/arm64/kernel/arm64ksyms.c index cef3925eaf60..aa3e948f7885 100644 --- a/arch/arm64/kernel/arm64ksyms.c +++ b/arch/arm64/kernel/arm64ksyms.c | |||
@@ -40,7 +40,9 @@ EXPORT_SYMBOL(__copy_to_user); | |||
40 | EXPORT_SYMBOL(__clear_user); | 40 | EXPORT_SYMBOL(__clear_user); |
41 | 41 | ||
42 | /* bitops */ | 42 | /* bitops */ |
43 | #ifdef CONFIG_SMP | ||
43 | EXPORT_SYMBOL(__atomic_hash); | 44 | EXPORT_SYMBOL(__atomic_hash); |
45 | #endif | ||
44 | 46 | ||
45 | /* physical memory */ | 47 | /* physical memory */ |
46 | EXPORT_SYMBOL(memstart_addr); | 48 | EXPORT_SYMBOL(memstart_addr); |
diff --git a/arch/arm64/kernel/signal32.c b/arch/arm64/kernel/signal32.c index 7f4f3673f2bc..e393174fe859 100644 --- a/arch/arm64/kernel/signal32.c +++ b/arch/arm64/kernel/signal32.c | |||
@@ -549,7 +549,6 @@ int compat_setup_rt_frame(int usig, struct k_sigaction *ka, siginfo_t *info, | |||
549 | sigset_t *set, struct pt_regs *regs) | 549 | sigset_t *set, struct pt_regs *regs) |
550 | { | 550 | { |
551 | struct compat_rt_sigframe __user *frame; | 551 | struct compat_rt_sigframe __user *frame; |
552 | compat_stack_t stack; | ||
553 | int err = 0; | 552 | int err = 0; |
554 | 553 | ||
555 | frame = compat_get_sigframe(ka, regs, sizeof(*frame)); | 554 | frame = compat_get_sigframe(ka, regs, sizeof(*frame)); |
diff --git a/arch/avr32/Kconfig b/arch/avr32/Kconfig index 9b89257b2cfd..c1a868d398bd 100644 --- a/arch/avr32/Kconfig +++ b/arch/avr32/Kconfig | |||
@@ -7,7 +7,7 @@ config AVR32 | |||
7 | select HAVE_OPROFILE | 7 | select HAVE_OPROFILE |
8 | select HAVE_KPROBES | 8 | select HAVE_KPROBES |
9 | select HAVE_GENERIC_HARDIRQS | 9 | select HAVE_GENERIC_HARDIRQS |
10 | select HAVE_VIRT_TO_BUS | 10 | select VIRT_TO_BUS |
11 | select GENERIC_IRQ_PROBE | 11 | select GENERIC_IRQ_PROBE |
12 | select GENERIC_ATOMIC64 | 12 | select GENERIC_ATOMIC64 |
13 | select HARDIRQS_SW_RESEND | 13 | select HARDIRQS_SW_RESEND |
diff --git a/arch/blackfin/Kconfig b/arch/blackfin/Kconfig index 600494c70e96..c3f2e0bc644a 100644 --- a/arch/blackfin/Kconfig +++ b/arch/blackfin/Kconfig | |||
@@ -33,7 +33,7 @@ config BLACKFIN | |||
33 | select ARCH_HAVE_CUSTOM_GPIO_H | 33 | select ARCH_HAVE_CUSTOM_GPIO_H |
34 | select ARCH_WANT_OPTIONAL_GPIOLIB | 34 | select ARCH_WANT_OPTIONAL_GPIOLIB |
35 | select HAVE_UID16 | 35 | select HAVE_UID16 |
36 | select HAVE_VIRT_TO_BUS | 36 | select VIRT_TO_BUS |
37 | select ARCH_WANT_IPC_PARSE_VERSION | 37 | select ARCH_WANT_IPC_PARSE_VERSION |
38 | select HAVE_GENERIC_HARDIRQS | 38 | select HAVE_GENERIC_HARDIRQS |
39 | select GENERIC_ATOMIC64 | 39 | select GENERIC_ATOMIC64 |
diff --git a/arch/cris/Kconfig b/arch/cris/Kconfig index bb0ac66cf533..06dd026533e3 100644 --- a/arch/cris/Kconfig +++ b/arch/cris/Kconfig | |||
@@ -43,7 +43,7 @@ config CRIS | |||
43 | select GENERIC_ATOMIC64 | 43 | select GENERIC_ATOMIC64 |
44 | select HAVE_GENERIC_HARDIRQS | 44 | select HAVE_GENERIC_HARDIRQS |
45 | select HAVE_UID16 | 45 | select HAVE_UID16 |
46 | select HAVE_VIRT_TO_BUS | 46 | select VIRT_TO_BUS |
47 | select ARCH_WANT_IPC_PARSE_VERSION | 47 | select ARCH_WANT_IPC_PARSE_VERSION |
48 | select GENERIC_IRQ_SHOW | 48 | select GENERIC_IRQ_SHOW |
49 | select GENERIC_IOMAP | 49 | select GENERIC_IOMAP |
diff --git a/arch/frv/Kconfig b/arch/frv/Kconfig index 12369b194c7b..2ce731f9aa4d 100644 --- a/arch/frv/Kconfig +++ b/arch/frv/Kconfig | |||
@@ -6,7 +6,7 @@ config FRV | |||
6 | select HAVE_PERF_EVENTS | 6 | select HAVE_PERF_EVENTS |
7 | select HAVE_UID16 | 7 | select HAVE_UID16 |
8 | select HAVE_GENERIC_HARDIRQS | 8 | select HAVE_GENERIC_HARDIRQS |
9 | select HAVE_VIRT_TO_BUS | 9 | select VIRT_TO_BUS |
10 | select GENERIC_IRQ_SHOW | 10 | select GENERIC_IRQ_SHOW |
11 | select HAVE_DEBUG_BUGVERBOSE | 11 | select HAVE_DEBUG_BUGVERBOSE |
12 | select ARCH_HAVE_NMI_SAFE_CMPXCHG | 12 | select ARCH_HAVE_NMI_SAFE_CMPXCHG |
diff --git a/arch/h8300/Kconfig b/arch/h8300/Kconfig index ae8551eb3736..79250de1b12a 100644 --- a/arch/h8300/Kconfig +++ b/arch/h8300/Kconfig | |||
@@ -5,7 +5,7 @@ config H8300 | |||
5 | select HAVE_GENERIC_HARDIRQS | 5 | select HAVE_GENERIC_HARDIRQS |
6 | select GENERIC_ATOMIC64 | 6 | select GENERIC_ATOMIC64 |
7 | select HAVE_UID16 | 7 | select HAVE_UID16 |
8 | select HAVE_VIRT_TO_BUS | 8 | select VIRT_TO_BUS |
9 | select ARCH_WANT_IPC_PARSE_VERSION | 9 | select ARCH_WANT_IPC_PARSE_VERSION |
10 | select GENERIC_IRQ_SHOW | 10 | select GENERIC_IRQ_SHOW |
11 | select GENERIC_CPU_DEVICES | 11 | select GENERIC_CPU_DEVICES |
diff --git a/arch/ia64/Kconfig b/arch/ia64/Kconfig index 33f3fdc0b214..9a02f71c6b1f 100644 --- a/arch/ia64/Kconfig +++ b/arch/ia64/Kconfig | |||
@@ -26,7 +26,7 @@ config IA64 | |||
26 | select HAVE_MEMBLOCK | 26 | select HAVE_MEMBLOCK |
27 | select HAVE_MEMBLOCK_NODE_MAP | 27 | select HAVE_MEMBLOCK_NODE_MAP |
28 | select HAVE_VIRT_CPU_ACCOUNTING | 28 | select HAVE_VIRT_CPU_ACCOUNTING |
29 | select HAVE_VIRT_TO_BUS | 29 | select VIRT_TO_BUS |
30 | select ARCH_DISCARD_MEMBLOCK | 30 | select ARCH_DISCARD_MEMBLOCK |
31 | select GENERIC_IRQ_PROBE | 31 | select GENERIC_IRQ_PROBE |
32 | select GENERIC_PENDING_IRQ if SMP | 32 | select GENERIC_PENDING_IRQ if SMP |
diff --git a/arch/m32r/Kconfig b/arch/m32r/Kconfig index 92623818a1fe..bcd17b206571 100644 --- a/arch/m32r/Kconfig +++ b/arch/m32r/Kconfig | |||
@@ -10,7 +10,7 @@ config M32R | |||
10 | select ARCH_WANT_IPC_PARSE_VERSION | 10 | select ARCH_WANT_IPC_PARSE_VERSION |
11 | select HAVE_DEBUG_BUGVERBOSE | 11 | select HAVE_DEBUG_BUGVERBOSE |
12 | select HAVE_GENERIC_HARDIRQS | 12 | select HAVE_GENERIC_HARDIRQS |
13 | select HAVE_VIRT_TO_BUS | 13 | select VIRT_TO_BUS |
14 | select GENERIC_IRQ_PROBE | 14 | select GENERIC_IRQ_PROBE |
15 | select GENERIC_IRQ_SHOW | 15 | select GENERIC_IRQ_SHOW |
16 | select GENERIC_ATOMIC64 | 16 | select GENERIC_ATOMIC64 |
diff --git a/arch/m32r/include/uapi/asm/stat.h b/arch/m32r/include/uapi/asm/stat.h index da4518f82d6d..98470fe483b6 100644 --- a/arch/m32r/include/uapi/asm/stat.h +++ b/arch/m32r/include/uapi/asm/stat.h | |||
@@ -63,10 +63,10 @@ struct stat64 { | |||
63 | long long st_size; | 63 | long long st_size; |
64 | unsigned long st_blksize; | 64 | unsigned long st_blksize; |
65 | 65 | ||
66 | #if defined(__BIG_ENDIAN) | 66 | #if defined(__BYTE_ORDER) ? __BYTE_ORDER == __BIG_ENDIAN : defined(__BIG_ENDIAN) |
67 | unsigned long __pad4; /* future possible st_blocks high bits */ | 67 | unsigned long __pad4; /* future possible st_blocks high bits */ |
68 | unsigned long st_blocks; /* Number 512-byte blocks allocated. */ | 68 | unsigned long st_blocks; /* Number 512-byte blocks allocated. */ |
69 | #elif defined(__LITTLE_ENDIAN) | 69 | #elif defined(__BYTE_ORDER) ? __BYTE_ORDER == __LITTLE_ENDIAN : defined(__LITTLE_ENDIAN) |
70 | unsigned long st_blocks; /* Number 512-byte blocks allocated. */ | 70 | unsigned long st_blocks; /* Number 512-byte blocks allocated. */ |
71 | unsigned long __pad4; /* future possible st_blocks high bits */ | 71 | unsigned long __pad4; /* future possible st_blocks high bits */ |
72 | #else | 72 | #else |
diff --git a/arch/m68k/Kconfig b/arch/m68k/Kconfig index 0e708c78e01c..6de813370b8c 100644 --- a/arch/m68k/Kconfig +++ b/arch/m68k/Kconfig | |||
@@ -8,7 +8,7 @@ config M68K | |||
8 | select GENERIC_IRQ_SHOW | 8 | select GENERIC_IRQ_SHOW |
9 | select GENERIC_ATOMIC64 | 9 | select GENERIC_ATOMIC64 |
10 | select HAVE_UID16 | 10 | select HAVE_UID16 |
11 | select HAVE_VIRT_TO_BUS | 11 | select VIRT_TO_BUS |
12 | select ARCH_HAVE_NMI_SAFE_CMPXCHG if RMW_INSNS | 12 | select ARCH_HAVE_NMI_SAFE_CMPXCHG if RMW_INSNS |
13 | select GENERIC_CPU_DEVICES | 13 | select GENERIC_CPU_DEVICES |
14 | select GENERIC_STRNCPY_FROM_USER if MMU | 14 | select GENERIC_STRNCPY_FROM_USER if MMU |
diff --git a/arch/m68k/Kconfig.machine b/arch/m68k/Kconfig.machine index 7cdf6b010381..7240584d3439 100644 --- a/arch/m68k/Kconfig.machine +++ b/arch/m68k/Kconfig.machine | |||
@@ -310,7 +310,6 @@ config COBRA5282 | |||
310 | config SOM5282EM | 310 | config SOM5282EM |
311 | bool "EMAC.Inc SOM5282EM board support" | 311 | bool "EMAC.Inc SOM5282EM board support" |
312 | depends on M528x | 312 | depends on M528x |
313 | select EMAC_INC | ||
314 | help | 313 | help |
315 | Support for the EMAC.Inc SOM5282EM module. | 314 | Support for the EMAC.Inc SOM5282EM module. |
316 | 315 | ||
diff --git a/arch/m68k/include/asm/MC68328.h b/arch/m68k/include/asm/MC68328.h index a337e56d09bf..4ebf098b8a1f 100644 --- a/arch/m68k/include/asm/MC68328.h +++ b/arch/m68k/include/asm/MC68328.h | |||
@@ -293,7 +293,7 @@ | |||
293 | /* | 293 | /* |
294 | * Here go the bitmasks themselves | 294 | * Here go the bitmasks themselves |
295 | */ | 295 | */ |
296 | #define IMR_MSPIM (1 << SPIM _IRQ_NUM) /* Mask SPI Master interrupt */ | 296 | #define IMR_MSPIM (1 << SPIM_IRQ_NUM) /* Mask SPI Master interrupt */ |
297 | #define IMR_MTMR2 (1 << TMR2_IRQ_NUM) /* Mask Timer 2 interrupt */ | 297 | #define IMR_MTMR2 (1 << TMR2_IRQ_NUM) /* Mask Timer 2 interrupt */ |
298 | #define IMR_MUART (1 << UART_IRQ_NUM) /* Mask UART interrupt */ | 298 | #define IMR_MUART (1 << UART_IRQ_NUM) /* Mask UART interrupt */ |
299 | #define IMR_MWDT (1 << WDT_IRQ_NUM) /* Mask Watchdog Timer interrupt */ | 299 | #define IMR_MWDT (1 << WDT_IRQ_NUM) /* Mask Watchdog Timer interrupt */ |
@@ -327,7 +327,7 @@ | |||
327 | #define IWR_ADDR 0xfffff308 | 327 | #define IWR_ADDR 0xfffff308 |
328 | #define IWR LONG_REF(IWR_ADDR) | 328 | #define IWR LONG_REF(IWR_ADDR) |
329 | 329 | ||
330 | #define IWR_SPIM (1 << SPIM _IRQ_NUM) /* SPI Master interrupt */ | 330 | #define IWR_SPIM (1 << SPIM_IRQ_NUM) /* SPI Master interrupt */ |
331 | #define IWR_TMR2 (1 << TMR2_IRQ_NUM) /* Timer 2 interrupt */ | 331 | #define IWR_TMR2 (1 << TMR2_IRQ_NUM) /* Timer 2 interrupt */ |
332 | #define IWR_UART (1 << UART_IRQ_NUM) /* UART interrupt */ | 332 | #define IWR_UART (1 << UART_IRQ_NUM) /* UART interrupt */ |
333 | #define IWR_WDT (1 << WDT_IRQ_NUM) /* Watchdog Timer interrupt */ | 333 | #define IWR_WDT (1 << WDT_IRQ_NUM) /* Watchdog Timer interrupt */ |
@@ -357,7 +357,7 @@ | |||
357 | #define ISR_ADDR 0xfffff30c | 357 | #define ISR_ADDR 0xfffff30c |
358 | #define ISR LONG_REF(ISR_ADDR) | 358 | #define ISR LONG_REF(ISR_ADDR) |
359 | 359 | ||
360 | #define ISR_SPIM (1 << SPIM _IRQ_NUM) /* SPI Master interrupt */ | 360 | #define ISR_SPIM (1 << SPIM_IRQ_NUM) /* SPI Master interrupt */ |
361 | #define ISR_TMR2 (1 << TMR2_IRQ_NUM) /* Timer 2 interrupt */ | 361 | #define ISR_TMR2 (1 << TMR2_IRQ_NUM) /* Timer 2 interrupt */ |
362 | #define ISR_UART (1 << UART_IRQ_NUM) /* UART interrupt */ | 362 | #define ISR_UART (1 << UART_IRQ_NUM) /* UART interrupt */ |
363 | #define ISR_WDT (1 << WDT_IRQ_NUM) /* Watchdog Timer interrupt */ | 363 | #define ISR_WDT (1 << WDT_IRQ_NUM) /* Watchdog Timer interrupt */ |
@@ -391,7 +391,7 @@ | |||
391 | #define IPR_ADDR 0xfffff310 | 391 | #define IPR_ADDR 0xfffff310 |
392 | #define IPR LONG_REF(IPR_ADDR) | 392 | #define IPR LONG_REF(IPR_ADDR) |
393 | 393 | ||
394 | #define IPR_SPIM (1 << SPIM _IRQ_NUM) /* SPI Master interrupt */ | 394 | #define IPR_SPIM (1 << SPIM_IRQ_NUM) /* SPI Master interrupt */ |
395 | #define IPR_TMR2 (1 << TMR2_IRQ_NUM) /* Timer 2 interrupt */ | 395 | #define IPR_TMR2 (1 << TMR2_IRQ_NUM) /* Timer 2 interrupt */ |
396 | #define IPR_UART (1 << UART_IRQ_NUM) /* UART interrupt */ | 396 | #define IPR_UART (1 << UART_IRQ_NUM) /* UART interrupt */ |
397 | #define IPR_WDT (1 << WDT_IRQ_NUM) /* Watchdog Timer interrupt */ | 397 | #define IPR_WDT (1 << WDT_IRQ_NUM) /* Watchdog Timer interrupt */ |
@@ -757,7 +757,7 @@ | |||
757 | 757 | ||
758 | /* 'EZ328-compatible definitions */ | 758 | /* 'EZ328-compatible definitions */ |
759 | #define TCN_ADDR TCN1_ADDR | 759 | #define TCN_ADDR TCN1_ADDR |
760 | #define TCN TCN | 760 | #define TCN TCN1 |
761 | 761 | ||
762 | /* | 762 | /* |
763 | * Timer Unit 1 and 2 Status Registers | 763 | * Timer Unit 1 and 2 Status Registers |
diff --git a/arch/m68k/kernel/setup_no.c b/arch/m68k/kernel/setup_no.c index 71fb29938dba..911ba472e6c4 100644 --- a/arch/m68k/kernel/setup_no.c +++ b/arch/m68k/kernel/setup_no.c | |||
@@ -57,6 +57,9 @@ void (*mach_reset)(void); | |||
57 | void (*mach_halt)(void); | 57 | void (*mach_halt)(void); |
58 | void (*mach_power_off)(void); | 58 | void (*mach_power_off)(void); |
59 | 59 | ||
60 | #ifdef CONFIG_M68000 | ||
61 | #define CPU_NAME "MC68000" | ||
62 | #endif | ||
60 | #ifdef CONFIG_M68328 | 63 | #ifdef CONFIG_M68328 |
61 | #define CPU_NAME "MC68328" | 64 | #define CPU_NAME "MC68328" |
62 | #endif | 65 | #endif |
diff --git a/arch/m68k/mm/init.c b/arch/m68k/mm/init.c index afd8106fd83b..519aad8fa812 100644 --- a/arch/m68k/mm/init.c +++ b/arch/m68k/mm/init.c | |||
@@ -188,7 +188,7 @@ void __init mem_init(void) | |||
188 | } | 188 | } |
189 | } | 189 | } |
190 | 190 | ||
191 | #if !defined(CONFIG_SUN3) && !defined(CONFIG_COLDFIRE) | 191 | #if defined(CONFIG_MMU) && !defined(CONFIG_SUN3) && !defined(CONFIG_COLDFIRE) |
192 | /* insert pointer tables allocated so far into the tablelist */ | 192 | /* insert pointer tables allocated so far into the tablelist */ |
193 | init_pointer_table((unsigned long)kernel_pg_dir); | 193 | init_pointer_table((unsigned long)kernel_pg_dir); |
194 | for (i = 0; i < PTRS_PER_PGD; i++) { | 194 | for (i = 0; i < PTRS_PER_PGD; i++) { |
diff --git a/arch/m68k/platform/coldfire/m528x.c b/arch/m68k/platform/coldfire/m528x.c index 83b7dad7a84e..b03a9d271837 100644 --- a/arch/m68k/platform/coldfire/m528x.c +++ b/arch/m68k/platform/coldfire/m528x.c | |||
@@ -69,7 +69,7 @@ static void __init m528x_uarts_init(void) | |||
69 | u8 port; | 69 | u8 port; |
70 | 70 | ||
71 | /* make sure PUAPAR is set for UART0 and UART1 */ | 71 | /* make sure PUAPAR is set for UART0 and UART1 */ |
72 | port = readb(MCF5282_GPIO_PUAPAR); | 72 | port = readb(MCFGPIO_PUAPAR); |
73 | port |= 0x03 | (0x03 << 2); | 73 | port |= 0x03 | (0x03 << 2); |
74 | writeb(port, MCFGPIO_PUAPAR); | 74 | writeb(port, MCFGPIO_PUAPAR); |
75 | } | 75 | } |
diff --git a/arch/microblaze/Kconfig b/arch/microblaze/Kconfig index 7843d11156e6..1323fa2530eb 100644 --- a/arch/microblaze/Kconfig +++ b/arch/microblaze/Kconfig | |||
@@ -19,7 +19,7 @@ config MICROBLAZE | |||
19 | select HAVE_DEBUG_KMEMLEAK | 19 | select HAVE_DEBUG_KMEMLEAK |
20 | select IRQ_DOMAIN | 20 | select IRQ_DOMAIN |
21 | select HAVE_GENERIC_HARDIRQS | 21 | select HAVE_GENERIC_HARDIRQS |
22 | select HAVE_VIRT_TO_BUS | 22 | select VIRT_TO_BUS |
23 | select GENERIC_IRQ_PROBE | 23 | select GENERIC_IRQ_PROBE |
24 | select GENERIC_IRQ_SHOW | 24 | select GENERIC_IRQ_SHOW |
25 | select GENERIC_PCI_IOMAP | 25 | select GENERIC_PCI_IOMAP |
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig index ae9c716c46bb..cd2e21ff562a 100644 --- a/arch/mips/Kconfig +++ b/arch/mips/Kconfig | |||
@@ -38,7 +38,7 @@ config MIPS | |||
38 | select GENERIC_CLOCKEVENTS | 38 | select GENERIC_CLOCKEVENTS |
39 | select GENERIC_CMOS_UPDATE | 39 | select GENERIC_CMOS_UPDATE |
40 | select HAVE_MOD_ARCH_SPECIFIC | 40 | select HAVE_MOD_ARCH_SPECIFIC |
41 | select HAVE_VIRT_TO_BUS | 41 | select VIRT_TO_BUS |
42 | select MODULES_USE_ELF_REL if MODULES | 42 | select MODULES_USE_ELF_REL if MODULES |
43 | select MODULES_USE_ELF_RELA if MODULES && 64BIT | 43 | select MODULES_USE_ELF_RELA if MODULES && 64BIT |
44 | select CLONE_BACKWARDS | 44 | select CLONE_BACKWARDS |
diff --git a/arch/mn10300/Kconfig b/arch/mn10300/Kconfig index b06c7360b1c6..428da175d073 100644 --- a/arch/mn10300/Kconfig +++ b/arch/mn10300/Kconfig | |||
@@ -8,7 +8,7 @@ config MN10300 | |||
8 | select HAVE_ARCH_KGDB | 8 | select HAVE_ARCH_KGDB |
9 | select GENERIC_ATOMIC64 | 9 | select GENERIC_ATOMIC64 |
10 | select HAVE_NMI_WATCHDOG if MN10300_WD_TIMER | 10 | select HAVE_NMI_WATCHDOG if MN10300_WD_TIMER |
11 | select HAVE_VIRT_TO_BUS | 11 | select VIRT_TO_BUS |
12 | select GENERIC_CLOCKEVENTS | 12 | select GENERIC_CLOCKEVENTS |
13 | select MODULES_USE_ELF_RELA | 13 | select MODULES_USE_ELF_RELA |
14 | select OLD_SIGSUSPEND3 | 14 | select OLD_SIGSUSPEND3 |
diff --git a/arch/openrisc/Kconfig b/arch/openrisc/Kconfig index 014a6482ed4c..9ab3bf2eca8d 100644 --- a/arch/openrisc/Kconfig +++ b/arch/openrisc/Kconfig | |||
@@ -9,10 +9,9 @@ config OPENRISC | |||
9 | select OF_EARLY_FLATTREE | 9 | select OF_EARLY_FLATTREE |
10 | select IRQ_DOMAIN | 10 | select IRQ_DOMAIN |
11 | select HAVE_MEMBLOCK | 11 | select HAVE_MEMBLOCK |
12 | select ARCH_WANT_OPTIONAL_GPIOLIB | 12 | select ARCH_REQUIRE_GPIOLIB |
13 | select HAVE_ARCH_TRACEHOOK | 13 | select HAVE_ARCH_TRACEHOOK |
14 | select HAVE_GENERIC_HARDIRQS | 14 | select HAVE_GENERIC_HARDIRQS |
15 | select HAVE_VIRT_TO_BUS | ||
16 | select GENERIC_IRQ_CHIP | 15 | select GENERIC_IRQ_CHIP |
17 | select GENERIC_IRQ_PROBE | 16 | select GENERIC_IRQ_PROBE |
18 | select GENERIC_IRQ_SHOW | 17 | select GENERIC_IRQ_SHOW |
diff --git a/arch/parisc/Kconfig b/arch/parisc/Kconfig index a9ff712a2864..0339181bf3ac 100644 --- a/arch/parisc/Kconfig +++ b/arch/parisc/Kconfig | |||
@@ -21,7 +21,7 @@ config PARISC | |||
21 | select GENERIC_STRNCPY_FROM_USER | 21 | select GENERIC_STRNCPY_FROM_USER |
22 | select SYSCTL_ARCH_UNALIGN_ALLOW | 22 | select SYSCTL_ARCH_UNALIGN_ALLOW |
23 | select HAVE_MOD_ARCH_SPECIFIC | 23 | select HAVE_MOD_ARCH_SPECIFIC |
24 | select HAVE_VIRT_TO_BUS | 24 | select VIRT_TO_BUS |
25 | select MODULES_USE_ELF_RELA | 25 | select MODULES_USE_ELF_RELA |
26 | select CLONE_BACKWARDS | 26 | select CLONE_BACKWARDS |
27 | select TTY # Needed for pdc_cons.c | 27 | select TTY # Needed for pdc_cons.c |
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig index b89d7eb730a2..ea5bb045983a 100644 --- a/arch/powerpc/Kconfig +++ b/arch/powerpc/Kconfig | |||
@@ -90,6 +90,7 @@ config GENERIC_GPIO | |||
90 | config PPC | 90 | config PPC |
91 | bool | 91 | bool |
92 | default y | 92 | default y |
93 | select BINFMT_ELF | ||
93 | select OF | 94 | select OF |
94 | select OF_EARLY_FLATTREE | 95 | select OF_EARLY_FLATTREE |
95 | select HAVE_FTRACE_MCOUNT_RECORD | 96 | select HAVE_FTRACE_MCOUNT_RECORD |
@@ -98,7 +99,7 @@ config PPC | |||
98 | select HAVE_FUNCTION_GRAPH_TRACER | 99 | select HAVE_FUNCTION_GRAPH_TRACER |
99 | select SYSCTL_EXCEPTION_TRACE | 100 | select SYSCTL_EXCEPTION_TRACE |
100 | select ARCH_WANT_OPTIONAL_GPIOLIB | 101 | select ARCH_WANT_OPTIONAL_GPIOLIB |
101 | select HAVE_VIRT_TO_BUS if !PPC64 | 102 | select VIRT_TO_BUS if !PPC64 |
102 | select HAVE_IDE | 103 | select HAVE_IDE |
103 | select HAVE_IOREMAP_PROT | 104 | select HAVE_IOREMAP_PROT |
104 | select HAVE_EFFICIENT_UNALIGNED_ACCESS | 105 | select HAVE_EFFICIENT_UNALIGNED_ACCESS |
diff --git a/arch/powerpc/include/asm/mmu-hash64.h b/arch/powerpc/include/asm/mmu-hash64.h index 2fdb47a19efd..b59e06f507ea 100644 --- a/arch/powerpc/include/asm/mmu-hash64.h +++ b/arch/powerpc/include/asm/mmu-hash64.h | |||
@@ -343,17 +343,16 @@ extern void slb_set_size(u16 size); | |||
343 | /* | 343 | /* |
344 | * VSID allocation (256MB segment) | 344 | * VSID allocation (256MB segment) |
345 | * | 345 | * |
346 | * We first generate a 38-bit "proto-VSID". For kernel addresses this | 346 | * We first generate a 37-bit "proto-VSID". Proto-VSIDs are generated |
347 | * is equal to the ESID | 1 << 37, for user addresses it is: | 347 | * from mmu context id and effective segment id of the address. |
348 | * (context << USER_ESID_BITS) | (esid & ((1U << USER_ESID_BITS) - 1) | ||
349 | * | 348 | * |
350 | * This splits the proto-VSID into the below range | 349 | * For user processes max context id is limited to ((1ul << 19) - 5) |
351 | * 0 - (2^(CONTEXT_BITS + USER_ESID_BITS) - 1) : User proto-VSID range | 350 | * for kernel space, we use the top 4 context ids to map address as below |
352 | * 2^(CONTEXT_BITS + USER_ESID_BITS) - 2^(VSID_BITS) : Kernel proto-VSID range | 351 | * NOTE: each context only support 64TB now. |
353 | * | 352 | * 0x7fffc - [ 0xc000000000000000 - 0xc0003fffffffffff ] |
354 | * We also have CONTEXT_BITS + USER_ESID_BITS = VSID_BITS - 1 | 353 | * 0x7fffd - [ 0xd000000000000000 - 0xd0003fffffffffff ] |
355 | * That is, we assign half of the space to user processes and half | 354 | * 0x7fffe - [ 0xe000000000000000 - 0xe0003fffffffffff ] |
356 | * to the kernel. | 355 | * 0x7ffff - [ 0xf000000000000000 - 0xf0003fffffffffff ] |
357 | * | 356 | * |
358 | * The proto-VSIDs are then scrambled into real VSIDs with the | 357 | * The proto-VSIDs are then scrambled into real VSIDs with the |
359 | * multiplicative hash: | 358 | * multiplicative hash: |
@@ -363,41 +362,49 @@ extern void slb_set_size(u16 size); | |||
363 | * VSID_MULTIPLIER is prime, so in particular it is | 362 | * VSID_MULTIPLIER is prime, so in particular it is |
364 | * co-prime to VSID_MODULUS, making this a 1:1 scrambling function. | 363 | * co-prime to VSID_MODULUS, making this a 1:1 scrambling function. |
365 | * Because the modulus is 2^n-1 we can compute it efficiently without | 364 | * Because the modulus is 2^n-1 we can compute it efficiently without |
366 | * a divide or extra multiply (see below). | 365 | * a divide or extra multiply (see below). The scramble function gives |
367 | * | 366 | * robust scattering in the hash table (at least based on some initial |
368 | * This scheme has several advantages over older methods: | 367 | * results). |
369 | * | ||
370 | * - We have VSIDs allocated for every kernel address | ||
371 | * (i.e. everything above 0xC000000000000000), except the very top | ||
372 | * segment, which simplifies several things. | ||
373 | * | 368 | * |
374 | * - We allow for USER_ESID_BITS significant bits of ESID and | 369 | * We also consider VSID 0 special. We use VSID 0 for slb entries mapping |
375 | * CONTEXT_BITS bits of context for user addresses. | 370 | * bad address. This enables us to consolidate bad address handling in |
376 | * i.e. 64T (46 bits) of address space for up to half a million contexts. | 371 | * hash_page. |
377 | * | 372 | * |
378 | * - The scramble function gives robust scattering in the hash | 373 | * We also need to avoid the last segment of the last context, because that |
379 | * table (at least based on some initial results). The previous | 374 | * would give a protovsid of 0x1fffffffff. That will result in a VSID 0 |
380 | * method was more susceptible to pathological cases giving excessive | 375 | * because of the modulo operation in vsid scramble. But the vmemmap |
381 | * hash collisions. | 376 | * (which is what uses region 0xf) will never be close to 64TB in size |
377 | * (it's 56 bytes per page of system memory). | ||
382 | */ | 378 | */ |
383 | 379 | ||
380 | #define CONTEXT_BITS 19 | ||
381 | #define ESID_BITS 18 | ||
382 | #define ESID_BITS_1T 6 | ||
383 | |||
384 | /* | ||
385 | * 256MB segment | ||
386 | * The proto-VSID space has 2^(CONTEX_BITS + ESID_BITS) - 1 segments | ||
387 | * available for user + kernel mapping. The top 4 contexts are used for | ||
388 | * kernel mapping. Each segment contains 2^28 bytes. Each | ||
389 | * context maps 2^46 bytes (64TB) so we can support 2^19-1 contexts | ||
390 | * (19 == 37 + 28 - 46). | ||
391 | */ | ||
392 | #define MAX_USER_CONTEXT ((ASM_CONST(1) << CONTEXT_BITS) - 5) | ||
393 | |||
384 | /* | 394 | /* |
385 | * This should be computed such that protovosid * vsid_mulitplier | 395 | * This should be computed such that protovosid * vsid_mulitplier |
386 | * doesn't overflow 64 bits. It should also be co-prime to vsid_modulus | 396 | * doesn't overflow 64 bits. It should also be co-prime to vsid_modulus |
387 | */ | 397 | */ |
388 | #define VSID_MULTIPLIER_256M ASM_CONST(12538073) /* 24-bit prime */ | 398 | #define VSID_MULTIPLIER_256M ASM_CONST(12538073) /* 24-bit prime */ |
389 | #define VSID_BITS_256M 38 | 399 | #define VSID_BITS_256M (CONTEXT_BITS + ESID_BITS) |
390 | #define VSID_MODULUS_256M ((1UL<<VSID_BITS_256M)-1) | 400 | #define VSID_MODULUS_256M ((1UL<<VSID_BITS_256M)-1) |
391 | 401 | ||
392 | #define VSID_MULTIPLIER_1T ASM_CONST(12538073) /* 24-bit prime */ | 402 | #define VSID_MULTIPLIER_1T ASM_CONST(12538073) /* 24-bit prime */ |
393 | #define VSID_BITS_1T 26 | 403 | #define VSID_BITS_1T (CONTEXT_BITS + ESID_BITS_1T) |
394 | #define VSID_MODULUS_1T ((1UL<<VSID_BITS_1T)-1) | 404 | #define VSID_MODULUS_1T ((1UL<<VSID_BITS_1T)-1) |
395 | 405 | ||
396 | #define CONTEXT_BITS 19 | ||
397 | #define USER_ESID_BITS 18 | ||
398 | #define USER_ESID_BITS_1T 6 | ||
399 | 406 | ||
400 | #define USER_VSID_RANGE (1UL << (USER_ESID_BITS + SID_SHIFT)) | 407 | #define USER_VSID_RANGE (1UL << (ESID_BITS + SID_SHIFT)) |
401 | 408 | ||
402 | /* | 409 | /* |
403 | * This macro generates asm code to compute the VSID scramble | 410 | * This macro generates asm code to compute the VSID scramble |
@@ -421,7 +428,8 @@ extern void slb_set_size(u16 size); | |||
421 | srdi rx,rt,VSID_BITS_##size; \ | 428 | srdi rx,rt,VSID_BITS_##size; \ |
422 | clrldi rt,rt,(64-VSID_BITS_##size); \ | 429 | clrldi rt,rt,(64-VSID_BITS_##size); \ |
423 | add rt,rt,rx; /* add high and low bits */ \ | 430 | add rt,rt,rx; /* add high and low bits */ \ |
424 | /* Now, r3 == VSID (mod 2^36-1), and lies between 0 and \ | 431 | /* NOTE: explanation based on VSID_BITS_##size = 36 \ |
432 | * Now, r3 == VSID (mod 2^36-1), and lies between 0 and \ | ||
425 | * 2^36-1+2^28-1. That in particular means that if r3 >= \ | 433 | * 2^36-1+2^28-1. That in particular means that if r3 >= \ |
426 | * 2^36-1, then r3+1 has the 2^36 bit set. So, if r3+1 has \ | 434 | * 2^36-1, then r3+1 has the 2^36 bit set. So, if r3+1 has \ |
427 | * the bit clear, r3 already has the answer we want, if it \ | 435 | * the bit clear, r3 already has the answer we want, if it \ |
@@ -513,34 +521,6 @@ typedef struct { | |||
513 | }) | 521 | }) |
514 | #endif /* 1 */ | 522 | #endif /* 1 */ |
515 | 523 | ||
516 | /* | ||
517 | * This is only valid for addresses >= PAGE_OFFSET | ||
518 | * The proto-VSID space is divided into two class | ||
519 | * User: 0 to 2^(CONTEXT_BITS + USER_ESID_BITS) -1 | ||
520 | * kernel: 2^(CONTEXT_BITS + USER_ESID_BITS) to 2^(VSID_BITS) - 1 | ||
521 | * | ||
522 | * With KERNEL_START at 0xc000000000000000, the proto vsid for | ||
523 | * the kernel ends up with 0xc00000000 (36 bits). With 64TB | ||
524 | * support we need to have kernel proto-VSID in the | ||
525 | * [2^37 to 2^38 - 1] range due to the increased USER_ESID_BITS. | ||
526 | */ | ||
527 | static inline unsigned long get_kernel_vsid(unsigned long ea, int ssize) | ||
528 | { | ||
529 | unsigned long proto_vsid; | ||
530 | /* | ||
531 | * We need to make sure proto_vsid for the kernel is | ||
532 | * >= 2^(CONTEXT_BITS + USER_ESID_BITS[_1T]) | ||
533 | */ | ||
534 | if (ssize == MMU_SEGSIZE_256M) { | ||
535 | proto_vsid = ea >> SID_SHIFT; | ||
536 | proto_vsid |= (1UL << (CONTEXT_BITS + USER_ESID_BITS)); | ||
537 | return vsid_scramble(proto_vsid, 256M); | ||
538 | } | ||
539 | proto_vsid = ea >> SID_SHIFT_1T; | ||
540 | proto_vsid |= (1UL << (CONTEXT_BITS + USER_ESID_BITS_1T)); | ||
541 | return vsid_scramble(proto_vsid, 1T); | ||
542 | } | ||
543 | |||
544 | /* Returns the segment size indicator for a user address */ | 524 | /* Returns the segment size indicator for a user address */ |
545 | static inline int user_segment_size(unsigned long addr) | 525 | static inline int user_segment_size(unsigned long addr) |
546 | { | 526 | { |
@@ -550,17 +530,41 @@ static inline int user_segment_size(unsigned long addr) | |||
550 | return MMU_SEGSIZE_256M; | 530 | return MMU_SEGSIZE_256M; |
551 | } | 531 | } |
552 | 532 | ||
553 | /* This is only valid for user addresses (which are below 2^44) */ | ||
554 | static inline unsigned long get_vsid(unsigned long context, unsigned long ea, | 533 | static inline unsigned long get_vsid(unsigned long context, unsigned long ea, |
555 | int ssize) | 534 | int ssize) |
556 | { | 535 | { |
536 | /* | ||
537 | * Bad address. We return VSID 0 for that | ||
538 | */ | ||
539 | if ((ea & ~REGION_MASK) >= PGTABLE_RANGE) | ||
540 | return 0; | ||
541 | |||
557 | if (ssize == MMU_SEGSIZE_256M) | 542 | if (ssize == MMU_SEGSIZE_256M) |
558 | return vsid_scramble((context << USER_ESID_BITS) | 543 | return vsid_scramble((context << ESID_BITS) |
559 | | (ea >> SID_SHIFT), 256M); | 544 | | (ea >> SID_SHIFT), 256M); |
560 | return vsid_scramble((context << USER_ESID_BITS_1T) | 545 | return vsid_scramble((context << ESID_BITS_1T) |
561 | | (ea >> SID_SHIFT_1T), 1T); | 546 | | (ea >> SID_SHIFT_1T), 1T); |
562 | } | 547 | } |
563 | 548 | ||
549 | /* | ||
550 | * This is only valid for addresses >= PAGE_OFFSET | ||
551 | * | ||
552 | * For kernel space, we use the top 4 context ids to map address as below | ||
553 | * 0x7fffc - [ 0xc000000000000000 - 0xc0003fffffffffff ] | ||
554 | * 0x7fffd - [ 0xd000000000000000 - 0xd0003fffffffffff ] | ||
555 | * 0x7fffe - [ 0xe000000000000000 - 0xe0003fffffffffff ] | ||
556 | * 0x7ffff - [ 0xf000000000000000 - 0xf0003fffffffffff ] | ||
557 | */ | ||
558 | static inline unsigned long get_kernel_vsid(unsigned long ea, int ssize) | ||
559 | { | ||
560 | unsigned long context; | ||
561 | |||
562 | /* | ||
563 | * kernel take the top 4 context from the available range | ||
564 | */ | ||
565 | context = (MAX_USER_CONTEXT) + ((ea >> 60) - 0xc) + 1; | ||
566 | return get_vsid(context, ea, ssize); | ||
567 | } | ||
564 | #endif /* __ASSEMBLY__ */ | 568 | #endif /* __ASSEMBLY__ */ |
565 | 569 | ||
566 | #endif /* _ASM_POWERPC_MMU_HASH64_H_ */ | 570 | #endif /* _ASM_POWERPC_MMU_HASH64_H_ */ |
diff --git a/arch/powerpc/kernel/cputable.c b/arch/powerpc/kernel/cputable.c index 75a3d71b895d..19599ef352bc 100644 --- a/arch/powerpc/kernel/cputable.c +++ b/arch/powerpc/kernel/cputable.c | |||
@@ -275,7 +275,7 @@ static struct cpu_spec __initdata cpu_specs[] = { | |||
275 | .cpu_features = CPU_FTRS_PPC970, | 275 | .cpu_features = CPU_FTRS_PPC970, |
276 | .cpu_user_features = COMMON_USER_POWER4 | | 276 | .cpu_user_features = COMMON_USER_POWER4 | |
277 | PPC_FEATURE_HAS_ALTIVEC_COMP, | 277 | PPC_FEATURE_HAS_ALTIVEC_COMP, |
278 | .mmu_features = MMU_FTR_HPTE_TABLE, | 278 | .mmu_features = MMU_FTRS_PPC970, |
279 | .icache_bsize = 128, | 279 | .icache_bsize = 128, |
280 | .dcache_bsize = 128, | 280 | .dcache_bsize = 128, |
281 | .num_pmcs = 8, | 281 | .num_pmcs = 8, |
diff --git a/arch/powerpc/kernel/exceptions-64s.S b/arch/powerpc/kernel/exceptions-64s.S index 87ef8f5ee5bc..200afa5bcfb7 100644 --- a/arch/powerpc/kernel/exceptions-64s.S +++ b/arch/powerpc/kernel/exceptions-64s.S | |||
@@ -1452,20 +1452,36 @@ do_ste_alloc: | |||
1452 | _GLOBAL(do_stab_bolted) | 1452 | _GLOBAL(do_stab_bolted) |
1453 | stw r9,PACA_EXSLB+EX_CCR(r13) /* save CR in exc. frame */ | 1453 | stw r9,PACA_EXSLB+EX_CCR(r13) /* save CR in exc. frame */ |
1454 | std r11,PACA_EXSLB+EX_SRR0(r13) /* save SRR0 in exc. frame */ | 1454 | std r11,PACA_EXSLB+EX_SRR0(r13) /* save SRR0 in exc. frame */ |
1455 | mfspr r11,SPRN_DAR /* ea */ | ||
1455 | 1456 | ||
1457 | /* | ||
1458 | * check for bad kernel/user address | ||
1459 | * (ea & ~REGION_MASK) >= PGTABLE_RANGE | ||
1460 | */ | ||
1461 | rldicr. r9,r11,4,(63 - 46 - 4) | ||
1462 | li r9,0 /* VSID = 0 for bad address */ | ||
1463 | bne- 0f | ||
1464 | |||
1465 | /* | ||
1466 | * Calculate VSID: | ||
1467 | * This is the kernel vsid, we take the top for context from | ||
1468 | * the range. context = (MAX_USER_CONTEXT) + ((ea >> 60) - 0xc) + 1 | ||
1469 | * Here we know that (ea >> 60) == 0xc | ||
1470 | */ | ||
1471 | lis r9,(MAX_USER_CONTEXT + 1)@ha | ||
1472 | addi r9,r9,(MAX_USER_CONTEXT + 1)@l | ||
1473 | |||
1474 | srdi r10,r11,SID_SHIFT | ||
1475 | rldimi r10,r9,ESID_BITS,0 /* proto vsid */ | ||
1476 | ASM_VSID_SCRAMBLE(r10, r9, 256M) | ||
1477 | rldic r9,r10,12,16 /* r9 = vsid << 12 */ | ||
1478 | |||
1479 | 0: | ||
1456 | /* Hash to the primary group */ | 1480 | /* Hash to the primary group */ |
1457 | ld r10,PACASTABVIRT(r13) | 1481 | ld r10,PACASTABVIRT(r13) |
1458 | mfspr r11,SPRN_DAR | 1482 | srdi r11,r11,SID_SHIFT |
1459 | srdi r11,r11,28 | ||
1460 | rldimi r10,r11,7,52 /* r10 = first ste of the group */ | 1483 | rldimi r10,r11,7,52 /* r10 = first ste of the group */ |
1461 | 1484 | ||
1462 | /* Calculate VSID */ | ||
1463 | /* This is a kernel address, so protovsid = ESID | 1 << 37 */ | ||
1464 | li r9,0x1 | ||
1465 | rldimi r11,r9,(CONTEXT_BITS + USER_ESID_BITS),0 | ||
1466 | ASM_VSID_SCRAMBLE(r11, r9, 256M) | ||
1467 | rldic r9,r11,12,16 /* r9 = vsid << 12 */ | ||
1468 | |||
1469 | /* Search the primary group for a free entry */ | 1485 | /* Search the primary group for a free entry */ |
1470 | 1: ld r11,0(r10) /* Test valid bit of the current ste */ | 1486 | 1: ld r11,0(r10) /* Test valid bit of the current ste */ |
1471 | andi. r11,r11,0x80 | 1487 | andi. r11,r11,0x80 |
diff --git a/arch/powerpc/kernel/prom_init.c b/arch/powerpc/kernel/prom_init.c index 7f7fb7fd991b..13f8d168b3f1 100644 --- a/arch/powerpc/kernel/prom_init.c +++ b/arch/powerpc/kernel/prom_init.c | |||
@@ -2832,11 +2832,13 @@ static void unreloc_toc(void) | |||
2832 | { | 2832 | { |
2833 | } | 2833 | } |
2834 | #else | 2834 | #else |
2835 | static void __reloc_toc(void *tocstart, unsigned long offset, | 2835 | static void __reloc_toc(unsigned long offset, unsigned long nr_entries) |
2836 | unsigned long nr_entries) | ||
2837 | { | 2836 | { |
2838 | unsigned long i; | 2837 | unsigned long i; |
2839 | unsigned long *toc_entry = (unsigned long *)tocstart; | 2838 | unsigned long *toc_entry; |
2839 | |||
2840 | /* Get the start of the TOC by using r2 directly. */ | ||
2841 | asm volatile("addi %0,2,-0x8000" : "=b" (toc_entry)); | ||
2840 | 2842 | ||
2841 | for (i = 0; i < nr_entries; i++) { | 2843 | for (i = 0; i < nr_entries; i++) { |
2842 | *toc_entry = *toc_entry + offset; | 2844 | *toc_entry = *toc_entry + offset; |
@@ -2850,8 +2852,7 @@ static void reloc_toc(void) | |||
2850 | unsigned long nr_entries = | 2852 | unsigned long nr_entries = |
2851 | (__prom_init_toc_end - __prom_init_toc_start) / sizeof(long); | 2853 | (__prom_init_toc_end - __prom_init_toc_start) / sizeof(long); |
2852 | 2854 | ||
2853 | /* Need to add offset to get at __prom_init_toc_start */ | 2855 | __reloc_toc(offset, nr_entries); |
2854 | __reloc_toc(__prom_init_toc_start + offset, offset, nr_entries); | ||
2855 | 2856 | ||
2856 | mb(); | 2857 | mb(); |
2857 | } | 2858 | } |
@@ -2864,8 +2865,7 @@ static void unreloc_toc(void) | |||
2864 | 2865 | ||
2865 | mb(); | 2866 | mb(); |
2866 | 2867 | ||
2867 | /* __prom_init_toc_start has been relocated, no need to add offset */ | 2868 | __reloc_toc(-offset, nr_entries); |
2868 | __reloc_toc(__prom_init_toc_start, -offset, nr_entries); | ||
2869 | } | 2869 | } |
2870 | #endif | 2870 | #endif |
2871 | #endif | 2871 | #endif |
diff --git a/arch/powerpc/kernel/ptrace.c b/arch/powerpc/kernel/ptrace.c index 245c1b6a0858..f9b30c68ba47 100644 --- a/arch/powerpc/kernel/ptrace.c +++ b/arch/powerpc/kernel/ptrace.c | |||
@@ -1428,6 +1428,7 @@ static long ppc_set_hwdebug(struct task_struct *child, | |||
1428 | 1428 | ||
1429 | brk.address = bp_info->addr & ~7UL; | 1429 | brk.address = bp_info->addr & ~7UL; |
1430 | brk.type = HW_BRK_TYPE_TRANSLATE; | 1430 | brk.type = HW_BRK_TYPE_TRANSLATE; |
1431 | brk.len = 8; | ||
1431 | if (bp_info->trigger_type & PPC_BREAKPOINT_TRIGGER_READ) | 1432 | if (bp_info->trigger_type & PPC_BREAKPOINT_TRIGGER_READ) |
1432 | brk.type |= HW_BRK_TYPE_READ; | 1433 | brk.type |= HW_BRK_TYPE_READ; |
1433 | if (bp_info->trigger_type & PPC_BREAKPOINT_TRIGGER_WRITE) | 1434 | if (bp_info->trigger_type & PPC_BREAKPOINT_TRIGGER_WRITE) |
diff --git a/arch/powerpc/kvm/book3s_64_mmu_host.c b/arch/powerpc/kvm/book3s_64_mmu_host.c index ead58e317294..5d7d29a313eb 100644 --- a/arch/powerpc/kvm/book3s_64_mmu_host.c +++ b/arch/powerpc/kvm/book3s_64_mmu_host.c | |||
@@ -326,8 +326,8 @@ int kvmppc_mmu_init(struct kvm_vcpu *vcpu) | |||
326 | vcpu3s->context_id[0] = err; | 326 | vcpu3s->context_id[0] = err; |
327 | 327 | ||
328 | vcpu3s->proto_vsid_max = ((vcpu3s->context_id[0] + 1) | 328 | vcpu3s->proto_vsid_max = ((vcpu3s->context_id[0] + 1) |
329 | << USER_ESID_BITS) - 1; | 329 | << ESID_BITS) - 1; |
330 | vcpu3s->proto_vsid_first = vcpu3s->context_id[0] << USER_ESID_BITS; | 330 | vcpu3s->proto_vsid_first = vcpu3s->context_id[0] << ESID_BITS; |
331 | vcpu3s->proto_vsid_next = vcpu3s->proto_vsid_first; | 331 | vcpu3s->proto_vsid_next = vcpu3s->proto_vsid_first; |
332 | 332 | ||
333 | kvmppc_mmu_hpte_init(vcpu); | 333 | kvmppc_mmu_hpte_init(vcpu); |
diff --git a/arch/powerpc/mm/hash_utils_64.c b/arch/powerpc/mm/hash_utils_64.c index 1b6e1271719f..f410c3e12c1e 100644 --- a/arch/powerpc/mm/hash_utils_64.c +++ b/arch/powerpc/mm/hash_utils_64.c | |||
@@ -195,6 +195,11 @@ int htab_bolt_mapping(unsigned long vstart, unsigned long vend, | |||
195 | unsigned long vpn = hpt_vpn(vaddr, vsid, ssize); | 195 | unsigned long vpn = hpt_vpn(vaddr, vsid, ssize); |
196 | unsigned long tprot = prot; | 196 | unsigned long tprot = prot; |
197 | 197 | ||
198 | /* | ||
199 | * If we hit a bad address return error. | ||
200 | */ | ||
201 | if (!vsid) | ||
202 | return -1; | ||
198 | /* Make kernel text executable */ | 203 | /* Make kernel text executable */ |
199 | if (overlaps_kernel_text(vaddr, vaddr + step)) | 204 | if (overlaps_kernel_text(vaddr, vaddr + step)) |
200 | tprot &= ~HPTE_R_N; | 205 | tprot &= ~HPTE_R_N; |
@@ -759,6 +764,8 @@ void __init early_init_mmu(void) | |||
759 | /* Initialize stab / SLB management */ | 764 | /* Initialize stab / SLB management */ |
760 | if (mmu_has_feature(MMU_FTR_SLB)) | 765 | if (mmu_has_feature(MMU_FTR_SLB)) |
761 | slb_initialize(); | 766 | slb_initialize(); |
767 | else | ||
768 | stab_initialize(get_paca()->stab_real); | ||
762 | } | 769 | } |
763 | 770 | ||
764 | #ifdef CONFIG_SMP | 771 | #ifdef CONFIG_SMP |
@@ -922,11 +929,6 @@ int hash_page(unsigned long ea, unsigned long access, unsigned long trap) | |||
922 | DBG_LOW("hash_page(ea=%016lx, access=%lx, trap=%lx\n", | 929 | DBG_LOW("hash_page(ea=%016lx, access=%lx, trap=%lx\n", |
923 | ea, access, trap); | 930 | ea, access, trap); |
924 | 931 | ||
925 | if ((ea & ~REGION_MASK) >= PGTABLE_RANGE) { | ||
926 | DBG_LOW(" out of pgtable range !\n"); | ||
927 | return 1; | ||
928 | } | ||
929 | |||
930 | /* Get region & vsid */ | 932 | /* Get region & vsid */ |
931 | switch (REGION_ID(ea)) { | 933 | switch (REGION_ID(ea)) { |
932 | case USER_REGION_ID: | 934 | case USER_REGION_ID: |
@@ -957,6 +959,11 @@ int hash_page(unsigned long ea, unsigned long access, unsigned long trap) | |||
957 | } | 959 | } |
958 | DBG_LOW(" mm=%p, mm->pgdir=%p, vsid=%016lx\n", mm, mm->pgd, vsid); | 960 | DBG_LOW(" mm=%p, mm->pgdir=%p, vsid=%016lx\n", mm, mm->pgd, vsid); |
959 | 961 | ||
962 | /* Bad address. */ | ||
963 | if (!vsid) { | ||
964 | DBG_LOW("Bad address!\n"); | ||
965 | return 1; | ||
966 | } | ||
960 | /* Get pgdir */ | 967 | /* Get pgdir */ |
961 | pgdir = mm->pgd; | 968 | pgdir = mm->pgd; |
962 | if (pgdir == NULL) | 969 | if (pgdir == NULL) |
@@ -1126,6 +1133,8 @@ void hash_preload(struct mm_struct *mm, unsigned long ea, | |||
1126 | /* Get VSID */ | 1133 | /* Get VSID */ |
1127 | ssize = user_segment_size(ea); | 1134 | ssize = user_segment_size(ea); |
1128 | vsid = get_vsid(mm->context.id, ea, ssize); | 1135 | vsid = get_vsid(mm->context.id, ea, ssize); |
1136 | if (!vsid) | ||
1137 | return; | ||
1129 | 1138 | ||
1130 | /* Hash doesn't like irqs */ | 1139 | /* Hash doesn't like irqs */ |
1131 | local_irq_save(flags); | 1140 | local_irq_save(flags); |
@@ -1233,6 +1242,9 @@ static void kernel_map_linear_page(unsigned long vaddr, unsigned long lmi) | |||
1233 | hash = hpt_hash(vpn, PAGE_SHIFT, mmu_kernel_ssize); | 1242 | hash = hpt_hash(vpn, PAGE_SHIFT, mmu_kernel_ssize); |
1234 | hpteg = ((hash & htab_hash_mask) * HPTES_PER_GROUP); | 1243 | hpteg = ((hash & htab_hash_mask) * HPTES_PER_GROUP); |
1235 | 1244 | ||
1245 | /* Don't create HPTE entries for bad address */ | ||
1246 | if (!vsid) | ||
1247 | return; | ||
1236 | ret = ppc_md.hpte_insert(hpteg, vpn, __pa(vaddr), | 1248 | ret = ppc_md.hpte_insert(hpteg, vpn, __pa(vaddr), |
1237 | mode, HPTE_V_BOLTED, | 1249 | mode, HPTE_V_BOLTED, |
1238 | mmu_linear_psize, mmu_kernel_ssize); | 1250 | mmu_linear_psize, mmu_kernel_ssize); |
diff --git a/arch/powerpc/mm/mmu_context_hash64.c b/arch/powerpc/mm/mmu_context_hash64.c index 40bc5b0ace54..d1d1b92c5b99 100644 --- a/arch/powerpc/mm/mmu_context_hash64.c +++ b/arch/powerpc/mm/mmu_context_hash64.c | |||
@@ -29,15 +29,6 @@ | |||
29 | static DEFINE_SPINLOCK(mmu_context_lock); | 29 | static DEFINE_SPINLOCK(mmu_context_lock); |
30 | static DEFINE_IDA(mmu_context_ida); | 30 | static DEFINE_IDA(mmu_context_ida); |
31 | 31 | ||
32 | /* | ||
33 | * 256MB segment | ||
34 | * The proto-VSID space has 2^(CONTEX_BITS + USER_ESID_BITS) - 1 segments | ||
35 | * available for user mappings. Each segment contains 2^28 bytes. Each | ||
36 | * context maps 2^46 bytes (64TB) so we can support 2^19-1 contexts | ||
37 | * (19 == 37 + 28 - 46). | ||
38 | */ | ||
39 | #define MAX_CONTEXT ((1UL << CONTEXT_BITS) - 1) | ||
40 | |||
41 | int __init_new_context(void) | 32 | int __init_new_context(void) |
42 | { | 33 | { |
43 | int index; | 34 | int index; |
@@ -56,7 +47,7 @@ again: | |||
56 | else if (err) | 47 | else if (err) |
57 | return err; | 48 | return err; |
58 | 49 | ||
59 | if (index > MAX_CONTEXT) { | 50 | if (index > MAX_USER_CONTEXT) { |
60 | spin_lock(&mmu_context_lock); | 51 | spin_lock(&mmu_context_lock); |
61 | ida_remove(&mmu_context_ida, index); | 52 | ida_remove(&mmu_context_ida, index); |
62 | spin_unlock(&mmu_context_lock); | 53 | spin_unlock(&mmu_context_lock); |
diff --git a/arch/powerpc/mm/pgtable_64.c b/arch/powerpc/mm/pgtable_64.c index e212a271c7a4..654258f165ae 100644 --- a/arch/powerpc/mm/pgtable_64.c +++ b/arch/powerpc/mm/pgtable_64.c | |||
@@ -61,7 +61,7 @@ | |||
61 | #endif | 61 | #endif |
62 | 62 | ||
63 | #ifdef CONFIG_PPC_STD_MMU_64 | 63 | #ifdef CONFIG_PPC_STD_MMU_64 |
64 | #if TASK_SIZE_USER64 > (1UL << (USER_ESID_BITS + SID_SHIFT)) | 64 | #if TASK_SIZE_USER64 > (1UL << (ESID_BITS + SID_SHIFT)) |
65 | #error TASK_SIZE_USER64 exceeds user VSID range | 65 | #error TASK_SIZE_USER64 exceeds user VSID range |
66 | #endif | 66 | #endif |
67 | #endif | 67 | #endif |
diff --git a/arch/powerpc/mm/slb_low.S b/arch/powerpc/mm/slb_low.S index 1a16ca227757..17aa6dfceb34 100644 --- a/arch/powerpc/mm/slb_low.S +++ b/arch/powerpc/mm/slb_low.S | |||
@@ -31,10 +31,15 @@ | |||
31 | * No other registers are examined or changed. | 31 | * No other registers are examined or changed. |
32 | */ | 32 | */ |
33 | _GLOBAL(slb_allocate_realmode) | 33 | _GLOBAL(slb_allocate_realmode) |
34 | /* r3 = faulting address */ | 34 | /* |
35 | * check for bad kernel/user address | ||
36 | * (ea & ~REGION_MASK) >= PGTABLE_RANGE | ||
37 | */ | ||
38 | rldicr. r9,r3,4,(63 - 46 - 4) | ||
39 | bne- 8f | ||
35 | 40 | ||
36 | srdi r9,r3,60 /* get region */ | 41 | srdi r9,r3,60 /* get region */ |
37 | srdi r10,r3,28 /* get esid */ | 42 | srdi r10,r3,SID_SHIFT /* get esid */ |
38 | cmpldi cr7,r9,0xc /* cmp PAGE_OFFSET for later use */ | 43 | cmpldi cr7,r9,0xc /* cmp PAGE_OFFSET for later use */ |
39 | 44 | ||
40 | /* r3 = address, r10 = esid, cr7 = <> PAGE_OFFSET */ | 45 | /* r3 = address, r10 = esid, cr7 = <> PAGE_OFFSET */ |
@@ -56,12 +61,14 @@ _GLOBAL(slb_allocate_realmode) | |||
56 | */ | 61 | */ |
57 | _GLOBAL(slb_miss_kernel_load_linear) | 62 | _GLOBAL(slb_miss_kernel_load_linear) |
58 | li r11,0 | 63 | li r11,0 |
59 | li r9,0x1 | ||
60 | /* | 64 | /* |
61 | * for 1T we shift 12 bits more. slb_finish_load_1T will do | 65 | * context = (MAX_USER_CONTEXT) + ((ea >> 60) - 0xc) + 1 |
62 | * the necessary adjustment | 66 | * r9 = region id. |
63 | */ | 67 | */ |
64 | rldimi r10,r9,(CONTEXT_BITS + USER_ESID_BITS),0 | 68 | addis r9,r9,(MAX_USER_CONTEXT - 0xc + 1)@ha |
69 | addi r9,r9,(MAX_USER_CONTEXT - 0xc + 1)@l | ||
70 | |||
71 | |||
65 | BEGIN_FTR_SECTION | 72 | BEGIN_FTR_SECTION |
66 | b slb_finish_load | 73 | b slb_finish_load |
67 | END_MMU_FTR_SECTION_IFCLR(MMU_FTR_1T_SEGMENT) | 74 | END_MMU_FTR_SECTION_IFCLR(MMU_FTR_1T_SEGMENT) |
@@ -91,24 +98,19 @@ _GLOBAL(slb_miss_kernel_load_vmemmap) | |||
91 | _GLOBAL(slb_miss_kernel_load_io) | 98 | _GLOBAL(slb_miss_kernel_load_io) |
92 | li r11,0 | 99 | li r11,0 |
93 | 6: | 100 | 6: |
94 | li r9,0x1 | ||
95 | /* | 101 | /* |
96 | * for 1T we shift 12 bits more. slb_finish_load_1T will do | 102 | * context = (MAX_USER_CONTEXT) + ((ea >> 60) - 0xc) + 1 |
97 | * the necessary adjustment | 103 | * r9 = region id. |
98 | */ | 104 | */ |
99 | rldimi r10,r9,(CONTEXT_BITS + USER_ESID_BITS),0 | 105 | addis r9,r9,(MAX_USER_CONTEXT - 0xc + 1)@ha |
106 | addi r9,r9,(MAX_USER_CONTEXT - 0xc + 1)@l | ||
107 | |||
100 | BEGIN_FTR_SECTION | 108 | BEGIN_FTR_SECTION |
101 | b slb_finish_load | 109 | b slb_finish_load |
102 | END_MMU_FTR_SECTION_IFCLR(MMU_FTR_1T_SEGMENT) | 110 | END_MMU_FTR_SECTION_IFCLR(MMU_FTR_1T_SEGMENT) |
103 | b slb_finish_load_1T | 111 | b slb_finish_load_1T |
104 | 112 | ||
105 | 0: /* user address: proto-VSID = context << 15 | ESID. First check | 113 | 0: |
106 | * if the address is within the boundaries of the user region | ||
107 | */ | ||
108 | srdi. r9,r10,USER_ESID_BITS | ||
109 | bne- 8f /* invalid ea bits set */ | ||
110 | |||
111 | |||
112 | /* when using slices, we extract the psize off the slice bitmaps | 114 | /* when using slices, we extract the psize off the slice bitmaps |
113 | * and then we need to get the sllp encoding off the mmu_psize_defs | 115 | * and then we need to get the sllp encoding off the mmu_psize_defs |
114 | * array. | 116 | * array. |
@@ -164,15 +166,13 @@ END_MMU_FTR_SECTION_IFCLR(MMU_FTR_1T_SEGMENT) | |||
164 | ld r9,PACACONTEXTID(r13) | 166 | ld r9,PACACONTEXTID(r13) |
165 | BEGIN_FTR_SECTION | 167 | BEGIN_FTR_SECTION |
166 | cmpldi r10,0x1000 | 168 | cmpldi r10,0x1000 |
167 | END_MMU_FTR_SECTION_IFSET(MMU_FTR_1T_SEGMENT) | ||
168 | rldimi r10,r9,USER_ESID_BITS,0 | ||
169 | BEGIN_FTR_SECTION | ||
170 | bge slb_finish_load_1T | 169 | bge slb_finish_load_1T |
171 | END_MMU_FTR_SECTION_IFSET(MMU_FTR_1T_SEGMENT) | 170 | END_MMU_FTR_SECTION_IFSET(MMU_FTR_1T_SEGMENT) |
172 | b slb_finish_load | 171 | b slb_finish_load |
173 | 172 | ||
174 | 8: /* invalid EA */ | 173 | 8: /* invalid EA */ |
175 | li r10,0 /* BAD_VSID */ | 174 | li r10,0 /* BAD_VSID */ |
175 | li r9,0 /* BAD_VSID */ | ||
176 | li r11,SLB_VSID_USER /* flags don't much matter */ | 176 | li r11,SLB_VSID_USER /* flags don't much matter */ |
177 | b slb_finish_load | 177 | b slb_finish_load |
178 | 178 | ||
@@ -221,8 +221,6 @@ _GLOBAL(slb_allocate_user) | |||
221 | 221 | ||
222 | /* get context to calculate proto-VSID */ | 222 | /* get context to calculate proto-VSID */ |
223 | ld r9,PACACONTEXTID(r13) | 223 | ld r9,PACACONTEXTID(r13) |
224 | rldimi r10,r9,USER_ESID_BITS,0 | ||
225 | |||
226 | /* fall through slb_finish_load */ | 224 | /* fall through slb_finish_load */ |
227 | 225 | ||
228 | #endif /* __DISABLED__ */ | 226 | #endif /* __DISABLED__ */ |
@@ -231,9 +229,10 @@ _GLOBAL(slb_allocate_user) | |||
231 | /* | 229 | /* |
232 | * Finish loading of an SLB entry and return | 230 | * Finish loading of an SLB entry and return |
233 | * | 231 | * |
234 | * r3 = EA, r10 = proto-VSID, r11 = flags, clobbers r9, cr7 = <> PAGE_OFFSET | 232 | * r3 = EA, r9 = context, r10 = ESID, r11 = flags, clobbers r9, cr7 = <> PAGE_OFFSET |
235 | */ | 233 | */ |
236 | slb_finish_load: | 234 | slb_finish_load: |
235 | rldimi r10,r9,ESID_BITS,0 | ||
237 | ASM_VSID_SCRAMBLE(r10,r9,256M) | 236 | ASM_VSID_SCRAMBLE(r10,r9,256M) |
238 | /* | 237 | /* |
239 | * bits above VSID_BITS_256M need to be ignored from r10 | 238 | * bits above VSID_BITS_256M need to be ignored from r10 |
@@ -298,10 +297,11 @@ _GLOBAL(slb_compare_rr_to_size) | |||
298 | /* | 297 | /* |
299 | * Finish loading of a 1T SLB entry (for the kernel linear mapping) and return. | 298 | * Finish loading of a 1T SLB entry (for the kernel linear mapping) and return. |
300 | * | 299 | * |
301 | * r3 = EA, r10 = proto-VSID, r11 = flags, clobbers r9 | 300 | * r3 = EA, r9 = context, r10 = ESID(256MB), r11 = flags, clobbers r9 |
302 | */ | 301 | */ |
303 | slb_finish_load_1T: | 302 | slb_finish_load_1T: |
304 | srdi r10,r10,40-28 /* get 1T ESID */ | 303 | srdi r10,r10,(SID_SHIFT_1T - SID_SHIFT) /* get 1T ESID */ |
304 | rldimi r10,r9,ESID_BITS_1T,0 | ||
305 | ASM_VSID_SCRAMBLE(r10,r9,1T) | 305 | ASM_VSID_SCRAMBLE(r10,r9,1T) |
306 | /* | 306 | /* |
307 | * bits above VSID_BITS_1T need to be ignored from r10 | 307 | * bits above VSID_BITS_1T need to be ignored from r10 |
diff --git a/arch/powerpc/mm/tlb_hash64.c b/arch/powerpc/mm/tlb_hash64.c index 0d82ef50dc3f..023ec8a13f38 100644 --- a/arch/powerpc/mm/tlb_hash64.c +++ b/arch/powerpc/mm/tlb_hash64.c | |||
@@ -82,11 +82,11 @@ void hpte_need_flush(struct mm_struct *mm, unsigned long addr, | |||
82 | if (!is_kernel_addr(addr)) { | 82 | if (!is_kernel_addr(addr)) { |
83 | ssize = user_segment_size(addr); | 83 | ssize = user_segment_size(addr); |
84 | vsid = get_vsid(mm->context.id, addr, ssize); | 84 | vsid = get_vsid(mm->context.id, addr, ssize); |
85 | WARN_ON(vsid == 0); | ||
86 | } else { | 85 | } else { |
87 | vsid = get_kernel_vsid(addr, mmu_kernel_ssize); | 86 | vsid = get_kernel_vsid(addr, mmu_kernel_ssize); |
88 | ssize = mmu_kernel_ssize; | 87 | ssize = mmu_kernel_ssize; |
89 | } | 88 | } |
89 | WARN_ON(vsid == 0); | ||
90 | vpn = hpt_vpn(addr, vsid, ssize); | 90 | vpn = hpt_vpn(addr, vsid, ssize); |
91 | rpte = __real_pte(__pte(pte), ptep); | 91 | rpte = __real_pte(__pte(pte), ptep); |
92 | 92 | ||
diff --git a/arch/powerpc/perf/power7-pmu.c b/arch/powerpc/perf/power7-pmu.c index b554879bd31e..3c475d6267c7 100644 --- a/arch/powerpc/perf/power7-pmu.c +++ b/arch/powerpc/perf/power7-pmu.c | |||
@@ -420,7 +420,20 @@ static struct attribute_group power7_pmu_events_group = { | |||
420 | .attrs = power7_events_attr, | 420 | .attrs = power7_events_attr, |
421 | }; | 421 | }; |
422 | 422 | ||
423 | PMU_FORMAT_ATTR(event, "config:0-19"); | ||
424 | |||
425 | static struct attribute *power7_pmu_format_attr[] = { | ||
426 | &format_attr_event.attr, | ||
427 | NULL, | ||
428 | }; | ||
429 | |||
430 | struct attribute_group power7_pmu_format_group = { | ||
431 | .name = "format", | ||
432 | .attrs = power7_pmu_format_attr, | ||
433 | }; | ||
434 | |||
423 | static const struct attribute_group *power7_pmu_attr_groups[] = { | 435 | static const struct attribute_group *power7_pmu_attr_groups[] = { |
436 | &power7_pmu_format_group, | ||
424 | &power7_pmu_events_group, | 437 | &power7_pmu_events_group, |
425 | NULL, | 438 | NULL, |
426 | }; | 439 | }; |
diff --git a/arch/powerpc/platforms/85xx/sgy_cts1000.c b/arch/powerpc/platforms/85xx/sgy_cts1000.c index 611e92f291c4..7179726ba5c5 100644 --- a/arch/powerpc/platforms/85xx/sgy_cts1000.c +++ b/arch/powerpc/platforms/85xx/sgy_cts1000.c | |||
@@ -69,7 +69,7 @@ static irqreturn_t gpio_halt_irq(int irq, void *__data) | |||
69 | return IRQ_HANDLED; | 69 | return IRQ_HANDLED; |
70 | }; | 70 | }; |
71 | 71 | ||
72 | static int __devinit gpio_halt_probe(struct platform_device *pdev) | 72 | static int gpio_halt_probe(struct platform_device *pdev) |
73 | { | 73 | { |
74 | enum of_gpio_flags flags; | 74 | enum of_gpio_flags flags; |
75 | struct device_node *node = pdev->dev.of_node; | 75 | struct device_node *node = pdev->dev.of_node; |
@@ -128,7 +128,7 @@ static int __devinit gpio_halt_probe(struct platform_device *pdev) | |||
128 | return 0; | 128 | return 0; |
129 | } | 129 | } |
130 | 130 | ||
131 | static int __devexit gpio_halt_remove(struct platform_device *pdev) | 131 | static int gpio_halt_remove(struct platform_device *pdev) |
132 | { | 132 | { |
133 | if (halt_node) { | 133 | if (halt_node) { |
134 | int gpio = of_get_gpio(halt_node, 0); | 134 | int gpio = of_get_gpio(halt_node, 0); |
@@ -165,7 +165,7 @@ static struct platform_driver gpio_halt_driver = { | |||
165 | .of_match_table = gpio_halt_match, | 165 | .of_match_table = gpio_halt_match, |
166 | }, | 166 | }, |
167 | .probe = gpio_halt_probe, | 167 | .probe = gpio_halt_probe, |
168 | .remove = __devexit_p(gpio_halt_remove), | 168 | .remove = gpio_halt_remove, |
169 | }; | 169 | }; |
170 | 170 | ||
171 | module_platform_driver(gpio_halt_driver); | 171 | module_platform_driver(gpio_halt_driver); |
diff --git a/arch/powerpc/platforms/Kconfig.cputype b/arch/powerpc/platforms/Kconfig.cputype index cea2f09c4241..18e3b76c78d7 100644 --- a/arch/powerpc/platforms/Kconfig.cputype +++ b/arch/powerpc/platforms/Kconfig.cputype | |||
@@ -124,9 +124,8 @@ config 6xx | |||
124 | select PPC_HAVE_PMU_SUPPORT | 124 | select PPC_HAVE_PMU_SUPPORT |
125 | 125 | ||
126 | config POWER3 | 126 | config POWER3 |
127 | bool | ||
128 | depends on PPC64 && PPC_BOOK3S | 127 | depends on PPC64 && PPC_BOOK3S |
129 | default y if !POWER4_ONLY | 128 | def_bool y |
130 | 129 | ||
131 | config POWER4 | 130 | config POWER4 |
132 | depends on PPC64 && PPC_BOOK3S | 131 | depends on PPC64 && PPC_BOOK3S |
@@ -145,8 +144,7 @@ config TUNE_CELL | |||
145 | but somewhat slower on other machines. This option only changes | 144 | but somewhat slower on other machines. This option only changes |
146 | the scheduling of instructions, not the selection of instructions | 145 | the scheduling of instructions, not the selection of instructions |
147 | itself, so the resulting kernel will keep running on all other | 146 | itself, so the resulting kernel will keep running on all other |
148 | machines. When building a kernel that is supposed to run only | 147 | machines. |
149 | on Cell, you should also select the POWER4_ONLY option. | ||
150 | 148 | ||
151 | # this is temp to handle compat with arch=ppc | 149 | # this is temp to handle compat with arch=ppc |
152 | config 8xx | 150 | config 8xx |
diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig index 4b505370a1d5..eb8fb629f00b 100644 --- a/arch/s390/Kconfig +++ b/arch/s390/Kconfig | |||
@@ -134,7 +134,7 @@ config S390 | |||
134 | select HAVE_SYSCALL_WRAPPERS | 134 | select HAVE_SYSCALL_WRAPPERS |
135 | select HAVE_UID16 if 32BIT | 135 | select HAVE_UID16 if 32BIT |
136 | select HAVE_VIRT_CPU_ACCOUNTING | 136 | select HAVE_VIRT_CPU_ACCOUNTING |
137 | select HAVE_VIRT_TO_BUS | 137 | select VIRT_TO_BUS |
138 | select INIT_ALL_POSSIBLE | 138 | select INIT_ALL_POSSIBLE |
139 | select KTIME_SCALAR if 32BIT | 139 | select KTIME_SCALAR if 32BIT |
140 | select MODULES_USE_ELF_RELA | 140 | select MODULES_USE_ELF_RELA |
diff --git a/arch/s390/include/asm/cpu_mf.h b/arch/s390/include/asm/cpu_mf.h index f1eddd150dd7..c879fad404c8 100644 --- a/arch/s390/include/asm/cpu_mf.h +++ b/arch/s390/include/asm/cpu_mf.h | |||
@@ -12,6 +12,7 @@ | |||
12 | #ifndef _ASM_S390_CPU_MF_H | 12 | #ifndef _ASM_S390_CPU_MF_H |
13 | #define _ASM_S390_CPU_MF_H | 13 | #define _ASM_S390_CPU_MF_H |
14 | 14 | ||
15 | #include <linux/errno.h> | ||
15 | #include <asm/facility.h> | 16 | #include <asm/facility.h> |
16 | 17 | ||
17 | #define CPU_MF_INT_SF_IAE (1 << 31) /* invalid entry address */ | 18 | #define CPU_MF_INT_SF_IAE (1 << 31) /* invalid entry address */ |
diff --git a/arch/s390/include/asm/eadm.h b/arch/s390/include/asm/eadm.h index 8d4847191ecc..dc9200ca32ed 100644 --- a/arch/s390/include/asm/eadm.h +++ b/arch/s390/include/asm/eadm.h | |||
@@ -34,6 +34,8 @@ struct arsb { | |||
34 | u32 reserved[4]; | 34 | u32 reserved[4]; |
35 | } __packed; | 35 | } __packed; |
36 | 36 | ||
37 | #define EQC_WR_PROHIBIT 22 | ||
38 | |||
37 | struct msb { | 39 | struct msb { |
38 | u8 fmt:4; | 40 | u8 fmt:4; |
39 | u8 oc:4; | 41 | u8 oc:4; |
@@ -96,11 +98,13 @@ struct scm_device { | |||
96 | #define OP_STATE_TEMP_ERR 2 | 98 | #define OP_STATE_TEMP_ERR 2 |
97 | #define OP_STATE_PERM_ERR 3 | 99 | #define OP_STATE_PERM_ERR 3 |
98 | 100 | ||
101 | enum scm_event {SCM_CHANGE, SCM_AVAIL}; | ||
102 | |||
99 | struct scm_driver { | 103 | struct scm_driver { |
100 | struct device_driver drv; | 104 | struct device_driver drv; |
101 | int (*probe) (struct scm_device *scmdev); | 105 | int (*probe) (struct scm_device *scmdev); |
102 | int (*remove) (struct scm_device *scmdev); | 106 | int (*remove) (struct scm_device *scmdev); |
103 | void (*notify) (struct scm_device *scmdev); | 107 | void (*notify) (struct scm_device *scmdev, enum scm_event event); |
104 | void (*handler) (struct scm_device *scmdev, void *data, int error); | 108 | void (*handler) (struct scm_device *scmdev, void *data, int error); |
105 | }; | 109 | }; |
106 | 110 | ||
diff --git a/arch/s390/include/asm/tlbflush.h b/arch/s390/include/asm/tlbflush.h index 1d8fe2b17ef6..6b32af30878c 100644 --- a/arch/s390/include/asm/tlbflush.h +++ b/arch/s390/include/asm/tlbflush.h | |||
@@ -74,8 +74,6 @@ static inline void __tlb_flush_idte(unsigned long asce) | |||
74 | 74 | ||
75 | static inline void __tlb_flush_mm(struct mm_struct * mm) | 75 | static inline void __tlb_flush_mm(struct mm_struct * mm) |
76 | { | 76 | { |
77 | if (unlikely(cpumask_empty(mm_cpumask(mm)))) | ||
78 | return; | ||
79 | /* | 77 | /* |
80 | * If the machine has IDTE we prefer to do a per mm flush | 78 | * If the machine has IDTE we prefer to do a per mm flush |
81 | * on all cpus instead of doing a local flush if the mm | 79 | * on all cpus instead of doing a local flush if the mm |
diff --git a/arch/s390/kernel/entry.S b/arch/s390/kernel/entry.S index 550228523267..94feff7d6132 100644 --- a/arch/s390/kernel/entry.S +++ b/arch/s390/kernel/entry.S | |||
@@ -636,7 +636,8 @@ ENTRY(mcck_int_handler) | |||
636 | UPDATE_VTIME %r14,%r15,__LC_MCCK_ENTER_TIMER | 636 | UPDATE_VTIME %r14,%r15,__LC_MCCK_ENTER_TIMER |
637 | mcck_skip: | 637 | mcck_skip: |
638 | SWITCH_ASYNC __LC_GPREGS_SAVE_AREA+32,__LC_PANIC_STACK,PAGE_SHIFT | 638 | SWITCH_ASYNC __LC_GPREGS_SAVE_AREA+32,__LC_PANIC_STACK,PAGE_SHIFT |
639 | mvc __PT_R0(64,%r11),__LC_GPREGS_SAVE_AREA | 639 | stm %r0,%r7,__PT_R0(%r11) |
640 | mvc __PT_R8(32,%r11),__LC_GPREGS_SAVE_AREA+32 | ||
640 | stm %r8,%r9,__PT_PSW(%r11) | 641 | stm %r8,%r9,__PT_PSW(%r11) |
641 | xc __SF_BACKCHAIN(4,%r15),__SF_BACKCHAIN(%r15) | 642 | xc __SF_BACKCHAIN(4,%r15),__SF_BACKCHAIN(%r15) |
642 | l %r1,BASED(.Ldo_machine_check) | 643 | l %r1,BASED(.Ldo_machine_check) |
diff --git a/arch/s390/kernel/entry64.S b/arch/s390/kernel/entry64.S index 9c837c101297..2e6d60c55f90 100644 --- a/arch/s390/kernel/entry64.S +++ b/arch/s390/kernel/entry64.S | |||
@@ -678,8 +678,9 @@ ENTRY(mcck_int_handler) | |||
678 | UPDATE_VTIME %r14,__LC_MCCK_ENTER_TIMER | 678 | UPDATE_VTIME %r14,__LC_MCCK_ENTER_TIMER |
679 | LAST_BREAK %r14 | 679 | LAST_BREAK %r14 |
680 | mcck_skip: | 680 | mcck_skip: |
681 | lghi %r14,__LC_GPREGS_SAVE_AREA | 681 | lghi %r14,__LC_GPREGS_SAVE_AREA+64 |
682 | mvc __PT_R0(128,%r11),0(%r14) | 682 | stmg %r0,%r7,__PT_R0(%r11) |
683 | mvc __PT_R8(64,%r11),0(%r14) | ||
683 | stmg %r8,%r9,__PT_PSW(%r11) | 684 | stmg %r8,%r9,__PT_PSW(%r11) |
684 | xc __SF_BACKCHAIN(8,%r15),__SF_BACKCHAIN(%r15) | 685 | xc __SF_BACKCHAIN(8,%r15),__SF_BACKCHAIN(%r15) |
685 | lgr %r2,%r11 # pass pointer to pt_regs | 686 | lgr %r2,%r11 # pass pointer to pt_regs |
diff --git a/arch/s390/kernel/setup.c b/arch/s390/kernel/setup.c index a5360de85ec7..29268859d8ee 100644 --- a/arch/s390/kernel/setup.c +++ b/arch/s390/kernel/setup.c | |||
@@ -571,6 +571,8 @@ static void __init setup_memory_end(void) | |||
571 | 571 | ||
572 | /* Split remaining virtual space between 1:1 mapping & vmemmap array */ | 572 | /* Split remaining virtual space between 1:1 mapping & vmemmap array */ |
573 | tmp = VMALLOC_START / (PAGE_SIZE + sizeof(struct page)); | 573 | tmp = VMALLOC_START / (PAGE_SIZE + sizeof(struct page)); |
574 | /* vmemmap contains a multiple of PAGES_PER_SECTION struct pages */ | ||
575 | tmp = SECTION_ALIGN_UP(tmp); | ||
574 | tmp = VMALLOC_START - tmp * sizeof(struct page); | 576 | tmp = VMALLOC_START - tmp * sizeof(struct page); |
575 | tmp &= ~((vmax >> 11) - 1); /* align to page table level */ | 577 | tmp &= ~((vmax >> 11) - 1); /* align to page table level */ |
576 | tmp = min(tmp, 1UL << MAX_PHYSMEM_BITS); | 578 | tmp = min(tmp, 1UL << MAX_PHYSMEM_BITS); |
diff --git a/arch/score/Kconfig b/arch/score/Kconfig index e569aa1fd2ba..c8def8bc9020 100644 --- a/arch/score/Kconfig +++ b/arch/score/Kconfig | |||
@@ -12,7 +12,7 @@ config SCORE | |||
12 | select GENERIC_CPU_DEVICES | 12 | select GENERIC_CPU_DEVICES |
13 | select GENERIC_CLOCKEVENTS | 13 | select GENERIC_CLOCKEVENTS |
14 | select HAVE_MOD_ARCH_SPECIFIC | 14 | select HAVE_MOD_ARCH_SPECIFIC |
15 | select HAVE_VIRT_TO_BUS | 15 | select VIRT_TO_BUS |
16 | select MODULES_USE_ELF_REL | 16 | select MODULES_USE_ELF_REL |
17 | select CLONE_BACKWARDS | 17 | select CLONE_BACKWARDS |
18 | 18 | ||
diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig index 289127d5241c..3d361f236308 100644 --- a/arch/sparc/Kconfig +++ b/arch/sparc/Kconfig | |||
@@ -84,12 +84,6 @@ config ARCH_DEFCONFIG | |||
84 | default "arch/sparc/configs/sparc32_defconfig" if SPARC32 | 84 | default "arch/sparc/configs/sparc32_defconfig" if SPARC32 |
85 | default "arch/sparc/configs/sparc64_defconfig" if SPARC64 | 85 | default "arch/sparc/configs/sparc64_defconfig" if SPARC64 |
86 | 86 | ||
87 | # CONFIG_BITS can be used at source level to get 32/64 bits | ||
88 | config BITS | ||
89 | int | ||
90 | default 32 if SPARC32 | ||
91 | default 64 if SPARC64 | ||
92 | |||
93 | config IOMMU_HELPER | 87 | config IOMMU_HELPER |
94 | bool | 88 | bool |
95 | default y if SPARC64 | 89 | default y if SPARC64 |
@@ -197,7 +191,7 @@ config RWSEM_XCHGADD_ALGORITHM | |||
197 | 191 | ||
198 | config GENERIC_HWEIGHT | 192 | config GENERIC_HWEIGHT |
199 | bool | 193 | bool |
200 | default y if !ULTRA_HAS_POPULATION_COUNT | 194 | default y |
201 | 195 | ||
202 | config GENERIC_CALIBRATE_DELAY | 196 | config GENERIC_CALIBRATE_DELAY |
203 | bool | 197 | bool |
diff --git a/arch/sparc/include/asm/spitfire.h b/arch/sparc/include/asm/spitfire.h index d06a26601753..6b67e50fb9b4 100644 --- a/arch/sparc/include/asm/spitfire.h +++ b/arch/sparc/include/asm/spitfire.h | |||
@@ -45,6 +45,7 @@ | |||
45 | #define SUN4V_CHIP_NIAGARA3 0x03 | 45 | #define SUN4V_CHIP_NIAGARA3 0x03 |
46 | #define SUN4V_CHIP_NIAGARA4 0x04 | 46 | #define SUN4V_CHIP_NIAGARA4 0x04 |
47 | #define SUN4V_CHIP_NIAGARA5 0x05 | 47 | #define SUN4V_CHIP_NIAGARA5 0x05 |
48 | #define SUN4V_CHIP_SPARC64X 0x8a | ||
48 | #define SUN4V_CHIP_UNKNOWN 0xff | 49 | #define SUN4V_CHIP_UNKNOWN 0xff |
49 | 50 | ||
50 | #ifndef __ASSEMBLY__ | 51 | #ifndef __ASSEMBLY__ |
diff --git a/arch/sparc/kernel/cpu.c b/arch/sparc/kernel/cpu.c index a6c94a2bf9d4..5c5125895db8 100644 --- a/arch/sparc/kernel/cpu.c +++ b/arch/sparc/kernel/cpu.c | |||
@@ -493,6 +493,12 @@ static void __init sun4v_cpu_probe(void) | |||
493 | sparc_pmu_type = "niagara5"; | 493 | sparc_pmu_type = "niagara5"; |
494 | break; | 494 | break; |
495 | 495 | ||
496 | case SUN4V_CHIP_SPARC64X: | ||
497 | sparc_cpu_type = "SPARC64-X"; | ||
498 | sparc_fpu_type = "SPARC64-X integrated FPU"; | ||
499 | sparc_pmu_type = "sparc64-x"; | ||
500 | break; | ||
501 | |||
496 | default: | 502 | default: |
497 | printk(KERN_WARNING "CPU: Unknown sun4v cpu type [%s]\n", | 503 | printk(KERN_WARNING "CPU: Unknown sun4v cpu type [%s]\n", |
498 | prom_cpu_compatible); | 504 | prom_cpu_compatible); |
diff --git a/arch/sparc/kernel/head_64.S b/arch/sparc/kernel/head_64.S index 2feb15c35d9e..26b706a1867d 100644 --- a/arch/sparc/kernel/head_64.S +++ b/arch/sparc/kernel/head_64.S | |||
@@ -134,6 +134,8 @@ prom_niagara_prefix: | |||
134 | .asciz "SUNW,UltraSPARC-T" | 134 | .asciz "SUNW,UltraSPARC-T" |
135 | prom_sparc_prefix: | 135 | prom_sparc_prefix: |
136 | .asciz "SPARC-" | 136 | .asciz "SPARC-" |
137 | prom_sparc64x_prefix: | ||
138 | .asciz "SPARC64-X" | ||
137 | .align 4 | 139 | .align 4 |
138 | prom_root_compatible: | 140 | prom_root_compatible: |
139 | .skip 64 | 141 | .skip 64 |
@@ -412,7 +414,7 @@ sun4v_chip_type: | |||
412 | cmp %g2, 'T' | 414 | cmp %g2, 'T' |
413 | be,pt %xcc, 70f | 415 | be,pt %xcc, 70f |
414 | cmp %g2, 'M' | 416 | cmp %g2, 'M' |
415 | bne,pn %xcc, 4f | 417 | bne,pn %xcc, 49f |
416 | nop | 418 | nop |
417 | 419 | ||
418 | 70: ldub [%g1 + 7], %g2 | 420 | 70: ldub [%g1 + 7], %g2 |
@@ -425,7 +427,7 @@ sun4v_chip_type: | |||
425 | cmp %g2, '5' | 427 | cmp %g2, '5' |
426 | be,pt %xcc, 5f | 428 | be,pt %xcc, 5f |
427 | mov SUN4V_CHIP_NIAGARA5, %g4 | 429 | mov SUN4V_CHIP_NIAGARA5, %g4 |
428 | ba,pt %xcc, 4f | 430 | ba,pt %xcc, 49f |
429 | nop | 431 | nop |
430 | 432 | ||
431 | 91: sethi %hi(prom_cpu_compatible), %g1 | 433 | 91: sethi %hi(prom_cpu_compatible), %g1 |
@@ -439,6 +441,25 @@ sun4v_chip_type: | |||
439 | mov SUN4V_CHIP_NIAGARA2, %g4 | 441 | mov SUN4V_CHIP_NIAGARA2, %g4 |
440 | 442 | ||
441 | 4: | 443 | 4: |
444 | /* Athena */ | ||
445 | sethi %hi(prom_cpu_compatible), %g1 | ||
446 | or %g1, %lo(prom_cpu_compatible), %g1 | ||
447 | sethi %hi(prom_sparc64x_prefix), %g7 | ||
448 | or %g7, %lo(prom_sparc64x_prefix), %g7 | ||
449 | mov 9, %g3 | ||
450 | 41: ldub [%g7], %g2 | ||
451 | ldub [%g1], %g4 | ||
452 | cmp %g2, %g4 | ||
453 | bne,pn %icc, 49f | ||
454 | add %g7, 1, %g7 | ||
455 | subcc %g3, 1, %g3 | ||
456 | bne,pt %xcc, 41b | ||
457 | add %g1, 1, %g1 | ||
458 | mov SUN4V_CHIP_SPARC64X, %g4 | ||
459 | ba,pt %xcc, 5f | ||
460 | nop | ||
461 | |||
462 | 49: | ||
442 | mov SUN4V_CHIP_UNKNOWN, %g4 | 463 | mov SUN4V_CHIP_UNKNOWN, %g4 |
443 | 5: sethi %hi(sun4v_chip_type), %g2 | 464 | 5: sethi %hi(sun4v_chip_type), %g2 |
444 | or %g2, %lo(sun4v_chip_type), %g2 | 465 | or %g2, %lo(sun4v_chip_type), %g2 |
diff --git a/arch/sparc/kernel/leon_pci_grpci2.c b/arch/sparc/kernel/leon_pci_grpci2.c index fc4320886a3a..4d1487138d26 100644 --- a/arch/sparc/kernel/leon_pci_grpci2.c +++ b/arch/sparc/kernel/leon_pci_grpci2.c | |||
@@ -186,6 +186,8 @@ struct grpci2_cap_first { | |||
186 | #define CAP9_IOMAP_OFS 0x20 | 186 | #define CAP9_IOMAP_OFS 0x20 |
187 | #define CAP9_BARSIZE_OFS 0x24 | 187 | #define CAP9_BARSIZE_OFS 0x24 |
188 | 188 | ||
189 | #define TGT 256 | ||
190 | |||
189 | struct grpci2_priv { | 191 | struct grpci2_priv { |
190 | struct leon_pci_info info; /* must be on top of this structure */ | 192 | struct leon_pci_info info; /* must be on top of this structure */ |
191 | struct grpci2_regs *regs; | 193 | struct grpci2_regs *regs; |
@@ -237,8 +239,12 @@ static int grpci2_cfg_r32(struct grpci2_priv *priv, unsigned int bus, | |||
237 | if (where & 0x3) | 239 | if (where & 0x3) |
238 | return -EINVAL; | 240 | return -EINVAL; |
239 | 241 | ||
240 | if (bus == 0 && PCI_SLOT(devfn) != 0) | 242 | if (bus == 0) { |
241 | devfn += (0x8 * 6); | 243 | devfn += (0x8 * 6); /* start at AD16=Device0 */ |
244 | } else if (bus == TGT) { | ||
245 | bus = 0; | ||
246 | devfn = 0; /* special case: bridge controller itself */ | ||
247 | } | ||
242 | 248 | ||
243 | /* Select bus */ | 249 | /* Select bus */ |
244 | spin_lock_irqsave(&grpci2_dev_lock, flags); | 250 | spin_lock_irqsave(&grpci2_dev_lock, flags); |
@@ -303,8 +309,12 @@ static int grpci2_cfg_w32(struct grpci2_priv *priv, unsigned int bus, | |||
303 | if (where & 0x3) | 309 | if (where & 0x3) |
304 | return -EINVAL; | 310 | return -EINVAL; |
305 | 311 | ||
306 | if (bus == 0 && PCI_SLOT(devfn) != 0) | 312 | if (bus == 0) { |
307 | devfn += (0x8 * 6); | 313 | devfn += (0x8 * 6); /* start at AD16=Device0 */ |
314 | } else if (bus == TGT) { | ||
315 | bus = 0; | ||
316 | devfn = 0; /* special case: bridge controller itself */ | ||
317 | } | ||
308 | 318 | ||
309 | /* Select bus */ | 319 | /* Select bus */ |
310 | spin_lock_irqsave(&grpci2_dev_lock, flags); | 320 | spin_lock_irqsave(&grpci2_dev_lock, flags); |
@@ -368,7 +378,7 @@ static int grpci2_read_config(struct pci_bus *bus, unsigned int devfn, | |||
368 | unsigned int busno = bus->number; | 378 | unsigned int busno = bus->number; |
369 | int ret; | 379 | int ret; |
370 | 380 | ||
371 | if (PCI_SLOT(devfn) > 15 || (PCI_SLOT(devfn) == 0 && busno == 0)) { | 381 | if (PCI_SLOT(devfn) > 15 || busno > 255) { |
372 | *val = ~0; | 382 | *val = ~0; |
373 | return 0; | 383 | return 0; |
374 | } | 384 | } |
@@ -406,7 +416,7 @@ static int grpci2_write_config(struct pci_bus *bus, unsigned int devfn, | |||
406 | struct grpci2_priv *priv = grpci2priv; | 416 | struct grpci2_priv *priv = grpci2priv; |
407 | unsigned int busno = bus->number; | 417 | unsigned int busno = bus->number; |
408 | 418 | ||
409 | if (PCI_SLOT(devfn) > 15 || (PCI_SLOT(devfn) == 0 && busno == 0)) | 419 | if (PCI_SLOT(devfn) > 15 || busno > 255) |
410 | return 0; | 420 | return 0; |
411 | 421 | ||
412 | #ifdef GRPCI2_DEBUG_CFGACCESS | 422 | #ifdef GRPCI2_DEBUG_CFGACCESS |
@@ -578,15 +588,15 @@ void grpci2_hw_init(struct grpci2_priv *priv) | |||
578 | REGSTORE(regs->ahbmst_map[i], priv->pci_area); | 588 | REGSTORE(regs->ahbmst_map[i], priv->pci_area); |
579 | 589 | ||
580 | /* Get the GRPCI2 Host PCI ID */ | 590 | /* Get the GRPCI2 Host PCI ID */ |
581 | grpci2_cfg_r32(priv, 0, 0, PCI_VENDOR_ID, &priv->pciid); | 591 | grpci2_cfg_r32(priv, TGT, 0, PCI_VENDOR_ID, &priv->pciid); |
582 | 592 | ||
583 | /* Get address to first (always defined) capability structure */ | 593 | /* Get address to first (always defined) capability structure */ |
584 | grpci2_cfg_r8(priv, 0, 0, PCI_CAPABILITY_LIST, &capptr); | 594 | grpci2_cfg_r8(priv, TGT, 0, PCI_CAPABILITY_LIST, &capptr); |
585 | 595 | ||
586 | /* Enable/Disable Byte twisting */ | 596 | /* Enable/Disable Byte twisting */ |
587 | grpci2_cfg_r32(priv, 0, 0, capptr+CAP9_IOMAP_OFS, &io_map); | 597 | grpci2_cfg_r32(priv, TGT, 0, capptr+CAP9_IOMAP_OFS, &io_map); |
588 | io_map = (io_map & ~0x1) | (priv->bt_enabled ? 1 : 0); | 598 | io_map = (io_map & ~0x1) | (priv->bt_enabled ? 1 : 0); |
589 | grpci2_cfg_w32(priv, 0, 0, capptr+CAP9_IOMAP_OFS, io_map); | 599 | grpci2_cfg_w32(priv, TGT, 0, capptr+CAP9_IOMAP_OFS, io_map); |
590 | 600 | ||
591 | /* Setup the Host's PCI Target BARs for other peripherals to access, | 601 | /* Setup the Host's PCI Target BARs for other peripherals to access, |
592 | * and do DMA to the host's memory. The target BARs can be sized and | 602 | * and do DMA to the host's memory. The target BARs can be sized and |
@@ -617,17 +627,18 @@ void grpci2_hw_init(struct grpci2_priv *priv) | |||
617 | pciadr = 0; | 627 | pciadr = 0; |
618 | } | 628 | } |
619 | } | 629 | } |
620 | grpci2_cfg_w32(priv, 0, 0, capptr+CAP9_BARSIZE_OFS+i*4, bar_sz); | 630 | grpci2_cfg_w32(priv, TGT, 0, capptr+CAP9_BARSIZE_OFS+i*4, |
621 | grpci2_cfg_w32(priv, 0, 0, PCI_BASE_ADDRESS_0+i*4, pciadr); | 631 | bar_sz); |
622 | grpci2_cfg_w32(priv, 0, 0, capptr+CAP9_BAR_OFS+i*4, ahbadr); | 632 | grpci2_cfg_w32(priv, TGT, 0, PCI_BASE_ADDRESS_0+i*4, pciadr); |
633 | grpci2_cfg_w32(priv, TGT, 0, capptr+CAP9_BAR_OFS+i*4, ahbadr); | ||
623 | printk(KERN_INFO " TGT BAR[%d]: 0x%08x (PCI)-> 0x%08x\n", | 634 | printk(KERN_INFO " TGT BAR[%d]: 0x%08x (PCI)-> 0x%08x\n", |
624 | i, pciadr, ahbadr); | 635 | i, pciadr, ahbadr); |
625 | } | 636 | } |
626 | 637 | ||
627 | /* set as bus master and enable pci memory responses */ | 638 | /* set as bus master and enable pci memory responses */ |
628 | grpci2_cfg_r32(priv, 0, 0, PCI_COMMAND, &data); | 639 | grpci2_cfg_r32(priv, TGT, 0, PCI_COMMAND, &data); |
629 | data |= (PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER); | 640 | data |= (PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER); |
630 | grpci2_cfg_w32(priv, 0, 0, PCI_COMMAND, data); | 641 | grpci2_cfg_w32(priv, TGT, 0, PCI_COMMAND, data); |
631 | 642 | ||
632 | /* Enable Error respone (CPU-TRAP) on illegal memory access. */ | 643 | /* Enable Error respone (CPU-TRAP) on illegal memory access. */ |
633 | REGSTORE(regs->ctrl, CTRL_ER | CTRL_PE); | 644 | REGSTORE(regs->ctrl, CTRL_ER | CTRL_PE); |
diff --git a/arch/tile/Kconfig b/arch/tile/Kconfig index ff496ab1e794..25877aebc685 100644 --- a/arch/tile/Kconfig +++ b/arch/tile/Kconfig | |||
@@ -17,7 +17,7 @@ config TILE | |||
17 | select GENERIC_IRQ_SHOW | 17 | select GENERIC_IRQ_SHOW |
18 | select HAVE_DEBUG_BUGVERBOSE | 18 | select HAVE_DEBUG_BUGVERBOSE |
19 | select HAVE_SYSCALL_WRAPPERS if TILEGX | 19 | select HAVE_SYSCALL_WRAPPERS if TILEGX |
20 | select HAVE_VIRT_TO_BUS | 20 | select VIRT_TO_BUS |
21 | select SYS_HYPERVISOR | 21 | select SYS_HYPERVISOR |
22 | select ARCH_HAVE_NMI_SAFE_CMPXCHG | 22 | select ARCH_HAVE_NMI_SAFE_CMPXCHG |
23 | select GENERIC_CLOCKEVENTS | 23 | select GENERIC_CLOCKEVENTS |
diff --git a/arch/tile/configs/tilegx_defconfig b/arch/tile/configs/tilegx_defconfig index 8c5eff6d6df5..47684815e5c8 100644 --- a/arch/tile/configs/tilegx_defconfig +++ b/arch/tile/configs/tilegx_defconfig | |||
@@ -330,7 +330,6 @@ CONFIG_MD_RAID0=m | |||
330 | CONFIG_MD_RAID1=m | 330 | CONFIG_MD_RAID1=m |
331 | CONFIG_MD_RAID10=m | 331 | CONFIG_MD_RAID10=m |
332 | CONFIG_MD_RAID456=m | 332 | CONFIG_MD_RAID456=m |
333 | CONFIG_MULTICORE_RAID456=y | ||
334 | CONFIG_MD_FAULTY=m | 333 | CONFIG_MD_FAULTY=m |
335 | CONFIG_BLK_DEV_DM=m | 334 | CONFIG_BLK_DEV_DM=m |
336 | CONFIG_DM_DEBUG=y | 335 | CONFIG_DM_DEBUG=y |
diff --git a/arch/tile/configs/tilepro_defconfig b/arch/tile/configs/tilepro_defconfig index e7a3dfcbcda7..dd2b8f0c631f 100644 --- a/arch/tile/configs/tilepro_defconfig +++ b/arch/tile/configs/tilepro_defconfig | |||
@@ -324,7 +324,6 @@ CONFIG_MD_RAID0=m | |||
324 | CONFIG_MD_RAID1=m | 324 | CONFIG_MD_RAID1=m |
325 | CONFIG_MD_RAID10=m | 325 | CONFIG_MD_RAID10=m |
326 | CONFIG_MD_RAID456=m | 326 | CONFIG_MD_RAID456=m |
327 | CONFIG_MULTICORE_RAID456=y | ||
328 | CONFIG_MD_FAULTY=m | 327 | CONFIG_MD_FAULTY=m |
329 | CONFIG_BLK_DEV_DM=m | 328 | CONFIG_BLK_DEV_DM=m |
330 | CONFIG_DM_DEBUG=y | 329 | CONFIG_DM_DEBUG=y |
diff --git a/arch/um/drivers/chan.h b/arch/um/drivers/chan.h index 78f1b8999964..c512b0306dd4 100644 --- a/arch/um/drivers/chan.h +++ b/arch/um/drivers/chan.h | |||
@@ -37,7 +37,7 @@ extern int console_write_chan(struct chan *chan, const char *buf, | |||
37 | extern int console_open_chan(struct line *line, struct console *co); | 37 | extern int console_open_chan(struct line *line, struct console *co); |
38 | extern void deactivate_chan(struct chan *chan, int irq); | 38 | extern void deactivate_chan(struct chan *chan, int irq); |
39 | extern void reactivate_chan(struct chan *chan, int irq); | 39 | extern void reactivate_chan(struct chan *chan, int irq); |
40 | extern void chan_enable_winch(struct chan *chan, struct tty_struct *tty); | 40 | extern void chan_enable_winch(struct chan *chan, struct tty_port *port); |
41 | extern int enable_chan(struct line *line); | 41 | extern int enable_chan(struct line *line); |
42 | extern void close_chan(struct line *line); | 42 | extern void close_chan(struct line *line); |
43 | extern int chan_window_size(struct line *line, | 43 | extern int chan_window_size(struct line *line, |
diff --git a/arch/um/drivers/chan_kern.c b/arch/um/drivers/chan_kern.c index 15c553c239a1..80b47cb71e0a 100644 --- a/arch/um/drivers/chan_kern.c +++ b/arch/um/drivers/chan_kern.c | |||
@@ -122,10 +122,10 @@ static int open_chan(struct list_head *chans) | |||
122 | return err; | 122 | return err; |
123 | } | 123 | } |
124 | 124 | ||
125 | void chan_enable_winch(struct chan *chan, struct tty_struct *tty) | 125 | void chan_enable_winch(struct chan *chan, struct tty_port *port) |
126 | { | 126 | { |
127 | if (chan && chan->primary && chan->ops->winch) | 127 | if (chan && chan->primary && chan->ops->winch) |
128 | register_winch(chan->fd, tty); | 128 | register_winch(chan->fd, port); |
129 | } | 129 | } |
130 | 130 | ||
131 | static void line_timer_cb(struct work_struct *work) | 131 | static void line_timer_cb(struct work_struct *work) |
diff --git a/arch/um/drivers/chan_user.c b/arch/um/drivers/chan_user.c index 9be670ad23b5..3fd7c3efdb18 100644 --- a/arch/um/drivers/chan_user.c +++ b/arch/um/drivers/chan_user.c | |||
@@ -216,7 +216,7 @@ static int winch_thread(void *arg) | |||
216 | } | 216 | } |
217 | } | 217 | } |
218 | 218 | ||
219 | static int winch_tramp(int fd, struct tty_struct *tty, int *fd_out, | 219 | static int winch_tramp(int fd, struct tty_port *port, int *fd_out, |
220 | unsigned long *stack_out) | 220 | unsigned long *stack_out) |
221 | { | 221 | { |
222 | struct winch_data data; | 222 | struct winch_data data; |
@@ -271,7 +271,7 @@ static int winch_tramp(int fd, struct tty_struct *tty, int *fd_out, | |||
271 | return err; | 271 | return err; |
272 | } | 272 | } |
273 | 273 | ||
274 | void register_winch(int fd, struct tty_struct *tty) | 274 | void register_winch(int fd, struct tty_port *port) |
275 | { | 275 | { |
276 | unsigned long stack; | 276 | unsigned long stack; |
277 | int pid, thread, count, thread_fd = -1; | 277 | int pid, thread, count, thread_fd = -1; |
@@ -281,17 +281,17 @@ void register_winch(int fd, struct tty_struct *tty) | |||
281 | return; | 281 | return; |
282 | 282 | ||
283 | pid = tcgetpgrp(fd); | 283 | pid = tcgetpgrp(fd); |
284 | if (is_skas_winch(pid, fd, tty)) { | 284 | if (is_skas_winch(pid, fd, port)) { |
285 | register_winch_irq(-1, fd, -1, tty, 0); | 285 | register_winch_irq(-1, fd, -1, port, 0); |
286 | return; | 286 | return; |
287 | } | 287 | } |
288 | 288 | ||
289 | if (pid == -1) { | 289 | if (pid == -1) { |
290 | thread = winch_tramp(fd, tty, &thread_fd, &stack); | 290 | thread = winch_tramp(fd, port, &thread_fd, &stack); |
291 | if (thread < 0) | 291 | if (thread < 0) |
292 | return; | 292 | return; |
293 | 293 | ||
294 | register_winch_irq(thread_fd, fd, thread, tty, stack); | 294 | register_winch_irq(thread_fd, fd, thread, port, stack); |
295 | 295 | ||
296 | count = write(thread_fd, &c, sizeof(c)); | 296 | count = write(thread_fd, &c, sizeof(c)); |
297 | if (count != sizeof(c)) | 297 | if (count != sizeof(c)) |
diff --git a/arch/um/drivers/chan_user.h b/arch/um/drivers/chan_user.h index dc693298eb8f..03f1b565c5f9 100644 --- a/arch/um/drivers/chan_user.h +++ b/arch/um/drivers/chan_user.h | |||
@@ -38,10 +38,10 @@ extern int generic_window_size(int fd, void *unused, unsigned short *rows_out, | |||
38 | unsigned short *cols_out); | 38 | unsigned short *cols_out); |
39 | extern void generic_free(void *data); | 39 | extern void generic_free(void *data); |
40 | 40 | ||
41 | struct tty_struct; | 41 | struct tty_port; |
42 | extern void register_winch(int fd, struct tty_struct *tty); | 42 | extern void register_winch(int fd, struct tty_port *port); |
43 | extern void register_winch_irq(int fd, int tty_fd, int pid, | 43 | extern void register_winch_irq(int fd, int tty_fd, int pid, |
44 | struct tty_struct *tty, unsigned long stack); | 44 | struct tty_port *port, unsigned long stack); |
45 | 45 | ||
46 | #define __channel_help(fn, prefix) \ | 46 | #define __channel_help(fn, prefix) \ |
47 | __uml_help(fn, prefix "[0-9]*=<channel description>\n" \ | 47 | __uml_help(fn, prefix "[0-9]*=<channel description>\n" \ |
diff --git a/arch/um/drivers/line.c b/arch/um/drivers/line.c index f1b38571f94e..be541cf69fd2 100644 --- a/arch/um/drivers/line.c +++ b/arch/um/drivers/line.c | |||
@@ -305,7 +305,7 @@ static int line_activate(struct tty_port *port, struct tty_struct *tty) | |||
305 | return ret; | 305 | return ret; |
306 | 306 | ||
307 | if (!line->sigio) { | 307 | if (!line->sigio) { |
308 | chan_enable_winch(line->chan_out, tty); | 308 | chan_enable_winch(line->chan_out, port); |
309 | line->sigio = 1; | 309 | line->sigio = 1; |
310 | } | 310 | } |
311 | 311 | ||
@@ -315,8 +315,22 @@ static int line_activate(struct tty_port *port, struct tty_struct *tty) | |||
315 | return 0; | 315 | return 0; |
316 | } | 316 | } |
317 | 317 | ||
318 | static void unregister_winch(struct tty_struct *tty); | ||
319 | |||
320 | static void line_destruct(struct tty_port *port) | ||
321 | { | ||
322 | struct tty_struct *tty = tty_port_tty_get(port); | ||
323 | struct line *line = tty->driver_data; | ||
324 | |||
325 | if (line->sigio) { | ||
326 | unregister_winch(tty); | ||
327 | line->sigio = 0; | ||
328 | } | ||
329 | } | ||
330 | |||
318 | static const struct tty_port_operations line_port_ops = { | 331 | static const struct tty_port_operations line_port_ops = { |
319 | .activate = line_activate, | 332 | .activate = line_activate, |
333 | .destruct = line_destruct, | ||
320 | }; | 334 | }; |
321 | 335 | ||
322 | int line_open(struct tty_struct *tty, struct file *filp) | 336 | int line_open(struct tty_struct *tty, struct file *filp) |
@@ -340,18 +354,6 @@ int line_install(struct tty_driver *driver, struct tty_struct *tty, | |||
340 | return 0; | 354 | return 0; |
341 | } | 355 | } |
342 | 356 | ||
343 | static void unregister_winch(struct tty_struct *tty); | ||
344 | |||
345 | void line_cleanup(struct tty_struct *tty) | ||
346 | { | ||
347 | struct line *line = tty->driver_data; | ||
348 | |||
349 | if (line->sigio) { | ||
350 | unregister_winch(tty); | ||
351 | line->sigio = 0; | ||
352 | } | ||
353 | } | ||
354 | |||
355 | void line_close(struct tty_struct *tty, struct file * filp) | 357 | void line_close(struct tty_struct *tty, struct file * filp) |
356 | { | 358 | { |
357 | struct line *line = tty->driver_data; | 359 | struct line *line = tty->driver_data; |
@@ -601,7 +603,7 @@ struct winch { | |||
601 | int fd; | 603 | int fd; |
602 | int tty_fd; | 604 | int tty_fd; |
603 | int pid; | 605 | int pid; |
604 | struct tty_struct *tty; | 606 | struct tty_port *port; |
605 | unsigned long stack; | 607 | unsigned long stack; |
606 | struct work_struct work; | 608 | struct work_struct work; |
607 | }; | 609 | }; |
@@ -655,7 +657,7 @@ static irqreturn_t winch_interrupt(int irq, void *data) | |||
655 | goto out; | 657 | goto out; |
656 | } | 658 | } |
657 | } | 659 | } |
658 | tty = winch->tty; | 660 | tty = tty_port_tty_get(winch->port); |
659 | if (tty != NULL) { | 661 | if (tty != NULL) { |
660 | line = tty->driver_data; | 662 | line = tty->driver_data; |
661 | if (line != NULL) { | 663 | if (line != NULL) { |
@@ -663,6 +665,7 @@ static irqreturn_t winch_interrupt(int irq, void *data) | |||
663 | &tty->winsize.ws_col); | 665 | &tty->winsize.ws_col); |
664 | kill_pgrp(tty->pgrp, SIGWINCH, 1); | 666 | kill_pgrp(tty->pgrp, SIGWINCH, 1); |
665 | } | 667 | } |
668 | tty_kref_put(tty); | ||
666 | } | 669 | } |
667 | out: | 670 | out: |
668 | if (winch->fd != -1) | 671 | if (winch->fd != -1) |
@@ -670,7 +673,7 @@ static irqreturn_t winch_interrupt(int irq, void *data) | |||
670 | return IRQ_HANDLED; | 673 | return IRQ_HANDLED; |
671 | } | 674 | } |
672 | 675 | ||
673 | void register_winch_irq(int fd, int tty_fd, int pid, struct tty_struct *tty, | 676 | void register_winch_irq(int fd, int tty_fd, int pid, struct tty_port *port, |
674 | unsigned long stack) | 677 | unsigned long stack) |
675 | { | 678 | { |
676 | struct winch *winch; | 679 | struct winch *winch; |
@@ -685,7 +688,7 @@ void register_winch_irq(int fd, int tty_fd, int pid, struct tty_struct *tty, | |||
685 | .fd = fd, | 688 | .fd = fd, |
686 | .tty_fd = tty_fd, | 689 | .tty_fd = tty_fd, |
687 | .pid = pid, | 690 | .pid = pid, |
688 | .tty = tty, | 691 | .port = port, |
689 | .stack = stack }); | 692 | .stack = stack }); |
690 | 693 | ||
691 | if (um_request_irq(WINCH_IRQ, fd, IRQ_READ, winch_interrupt, | 694 | if (um_request_irq(WINCH_IRQ, fd, IRQ_READ, winch_interrupt, |
@@ -714,15 +717,18 @@ static void unregister_winch(struct tty_struct *tty) | |||
714 | { | 717 | { |
715 | struct list_head *ele, *next; | 718 | struct list_head *ele, *next; |
716 | struct winch *winch; | 719 | struct winch *winch; |
720 | struct tty_struct *wtty; | ||
717 | 721 | ||
718 | spin_lock(&winch_handler_lock); | 722 | spin_lock(&winch_handler_lock); |
719 | 723 | ||
720 | list_for_each_safe(ele, next, &winch_handlers) { | 724 | list_for_each_safe(ele, next, &winch_handlers) { |
721 | winch = list_entry(ele, struct winch, list); | 725 | winch = list_entry(ele, struct winch, list); |
722 | if (winch->tty == tty) { | 726 | wtty = tty_port_tty_get(winch->port); |
727 | if (wtty == tty) { | ||
723 | free_winch(winch); | 728 | free_winch(winch); |
724 | break; | 729 | break; |
725 | } | 730 | } |
731 | tty_kref_put(wtty); | ||
726 | } | 732 | } |
727 | spin_unlock(&winch_handler_lock); | 733 | spin_unlock(&winch_handler_lock); |
728 | } | 734 | } |
diff --git a/arch/um/drivers/net_kern.c b/arch/um/drivers/net_kern.c index d8926c303629..39f186252e02 100644 --- a/arch/um/drivers/net_kern.c +++ b/arch/um/drivers/net_kern.c | |||
@@ -218,6 +218,7 @@ static int uml_net_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
218 | spin_lock_irqsave(&lp->lock, flags); | 218 | spin_lock_irqsave(&lp->lock, flags); |
219 | 219 | ||
220 | len = (*lp->write)(lp->fd, skb, lp); | 220 | len = (*lp->write)(lp->fd, skb, lp); |
221 | skb_tx_timestamp(skb); | ||
221 | 222 | ||
222 | if (len == skb->len) { | 223 | if (len == skb->len) { |
223 | dev->stats.tx_packets++; | 224 | dev->stats.tx_packets++; |
@@ -281,6 +282,7 @@ static void uml_net_get_drvinfo(struct net_device *dev, | |||
281 | static const struct ethtool_ops uml_net_ethtool_ops = { | 282 | static const struct ethtool_ops uml_net_ethtool_ops = { |
282 | .get_drvinfo = uml_net_get_drvinfo, | 283 | .get_drvinfo = uml_net_get_drvinfo, |
283 | .get_link = ethtool_op_get_link, | 284 | .get_link = ethtool_op_get_link, |
285 | .get_ts_info = ethtool_op_get_ts_info, | ||
284 | }; | 286 | }; |
285 | 287 | ||
286 | static void uml_net_user_timer_expire(unsigned long _conn) | 288 | static void uml_net_user_timer_expire(unsigned long _conn) |
diff --git a/arch/um/drivers/ssl.c b/arch/um/drivers/ssl.c index 16fdd0a0f9d6..b8d14fa52059 100644 --- a/arch/um/drivers/ssl.c +++ b/arch/um/drivers/ssl.c | |||
@@ -105,7 +105,6 @@ static const struct tty_operations ssl_ops = { | |||
105 | .throttle = line_throttle, | 105 | .throttle = line_throttle, |
106 | .unthrottle = line_unthrottle, | 106 | .unthrottle = line_unthrottle, |
107 | .install = ssl_install, | 107 | .install = ssl_install, |
108 | .cleanup = line_cleanup, | ||
109 | .hangup = line_hangup, | 108 | .hangup = line_hangup, |
110 | }; | 109 | }; |
111 | 110 | ||
diff --git a/arch/um/drivers/stdio_console.c b/arch/um/drivers/stdio_console.c index 827777af3f6d..7b361f36ca96 100644 --- a/arch/um/drivers/stdio_console.c +++ b/arch/um/drivers/stdio_console.c | |||
@@ -110,7 +110,6 @@ static const struct tty_operations console_ops = { | |||
110 | .set_termios = line_set_termios, | 110 | .set_termios = line_set_termios, |
111 | .throttle = line_throttle, | 111 | .throttle = line_throttle, |
112 | .unthrottle = line_unthrottle, | 112 | .unthrottle = line_unthrottle, |
113 | .cleanup = line_cleanup, | ||
114 | .hangup = line_hangup, | 113 | .hangup = line_hangup, |
115 | }; | 114 | }; |
116 | 115 | ||
diff --git a/arch/um/os-Linux/signal.c b/arch/um/os-Linux/signal.c index b1469fe93295..9d9f1b4bf826 100644 --- a/arch/um/os-Linux/signal.c +++ b/arch/um/os-Linux/signal.c | |||
@@ -15,7 +15,7 @@ | |||
15 | #include <sysdep/mcontext.h> | 15 | #include <sysdep/mcontext.h> |
16 | #include "internal.h" | 16 | #include "internal.h" |
17 | 17 | ||
18 | void (*sig_info[NSIG])(int, siginfo_t *, struct uml_pt_regs *) = { | 18 | void (*sig_info[NSIG])(int, struct siginfo *, struct uml_pt_regs *) = { |
19 | [SIGTRAP] = relay_signal, | 19 | [SIGTRAP] = relay_signal, |
20 | [SIGFPE] = relay_signal, | 20 | [SIGFPE] = relay_signal, |
21 | [SIGILL] = relay_signal, | 21 | [SIGILL] = relay_signal, |
diff --git a/arch/um/os-Linux/start_up.c b/arch/um/os-Linux/start_up.c index da4b9e9999fd..337518c5042a 100644 --- a/arch/um/os-Linux/start_up.c +++ b/arch/um/os-Linux/start_up.c | |||
@@ -15,6 +15,8 @@ | |||
15 | #include <sys/mman.h> | 15 | #include <sys/mman.h> |
16 | #include <sys/stat.h> | 16 | #include <sys/stat.h> |
17 | #include <sys/wait.h> | 17 | #include <sys/wait.h> |
18 | #include <sys/time.h> | ||
19 | #include <sys/resource.h> | ||
18 | #include <asm/unistd.h> | 20 | #include <asm/unistd.h> |
19 | #include <init.h> | 21 | #include <init.h> |
20 | #include <os.h> | 22 | #include <os.h> |
diff --git a/arch/unicore32/Kconfig b/arch/unicore32/Kconfig index dc50b157fc83..2943e3acdf0c 100644 --- a/arch/unicore32/Kconfig +++ b/arch/unicore32/Kconfig | |||
@@ -9,7 +9,7 @@ config UNICORE32 | |||
9 | select GENERIC_ATOMIC64 | 9 | select GENERIC_ATOMIC64 |
10 | select HAVE_KERNEL_LZO | 10 | select HAVE_KERNEL_LZO |
11 | select HAVE_KERNEL_LZMA | 11 | select HAVE_KERNEL_LZMA |
12 | select HAVE_VIRT_TO_BUS | 12 | select VIRT_TO_BUS |
13 | select ARCH_HAVE_CUSTOM_GPIO_H | 13 | select ARCH_HAVE_CUSTOM_GPIO_H |
14 | select GENERIC_FIND_FIRST_BIT | 14 | select GENERIC_FIND_FIRST_BIT |
15 | select GENERIC_IRQ_PROBE | 15 | select GENERIC_IRQ_PROBE |
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index a4f24f5b1218..70c0f3da0476 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig | |||
@@ -112,7 +112,7 @@ config X86 | |||
112 | select GENERIC_STRNLEN_USER | 112 | select GENERIC_STRNLEN_USER |
113 | select HAVE_CONTEXT_TRACKING if X86_64 | 113 | select HAVE_CONTEXT_TRACKING if X86_64 |
114 | select HAVE_IRQ_TIME_ACCOUNTING | 114 | select HAVE_IRQ_TIME_ACCOUNTING |
115 | select HAVE_VIRT_TO_BUS | 115 | select VIRT_TO_BUS |
116 | select MODULES_USE_ELF_REL if X86_32 | 116 | select MODULES_USE_ELF_REL if X86_32 |
117 | select MODULES_USE_ELF_RELA if X86_64 | 117 | select MODULES_USE_ELF_RELA if X86_64 |
118 | select CLONE_BACKWARDS if X86_32 | 118 | select CLONE_BACKWARDS if X86_32 |
diff --git a/arch/x86/include/asm/kprobes.h b/arch/x86/include/asm/kprobes.h index d3ddd17405d0..5a6d2873f80e 100644 --- a/arch/x86/include/asm/kprobes.h +++ b/arch/x86/include/asm/kprobes.h | |||
@@ -77,6 +77,7 @@ struct arch_specific_insn { | |||
77 | * a post_handler or break_handler). | 77 | * a post_handler or break_handler). |
78 | */ | 78 | */ |
79 | int boostable; | 79 | int boostable; |
80 | bool if_modifier; | ||
80 | }; | 81 | }; |
81 | 82 | ||
82 | struct arch_optimized_insn { | 83 | struct arch_optimized_insn { |
diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h index 635a74d22409..4979778cc7fb 100644 --- a/arch/x86/include/asm/kvm_host.h +++ b/arch/x86/include/asm/kvm_host.h | |||
@@ -414,8 +414,8 @@ struct kvm_vcpu_arch { | |||
414 | gpa_t time; | 414 | gpa_t time; |
415 | struct pvclock_vcpu_time_info hv_clock; | 415 | struct pvclock_vcpu_time_info hv_clock; |
416 | unsigned int hw_tsc_khz; | 416 | unsigned int hw_tsc_khz; |
417 | unsigned int time_offset; | 417 | struct gfn_to_hva_cache pv_time; |
418 | struct page *time_page; | 418 | bool pv_time_enabled; |
419 | /* set guest stopped flag in pvclock flags field */ | 419 | /* set guest stopped flag in pvclock flags field */ |
420 | bool pvclock_set_guest_stopped_request; | 420 | bool pvclock_set_guest_stopped_request; |
421 | 421 | ||
diff --git a/arch/x86/kernel/cpu/perf_event_intel.c b/arch/x86/kernel/cpu/perf_event_intel.c index 529c8931fc02..dab7580c47ae 100644 --- a/arch/x86/kernel/cpu/perf_event_intel.c +++ b/arch/x86/kernel/cpu/perf_event_intel.c | |||
@@ -101,6 +101,10 @@ static struct event_constraint intel_snb_event_constraints[] __read_mostly = | |||
101 | FIXED_EVENT_CONSTRAINT(0x00c0, 0), /* INST_RETIRED.ANY */ | 101 | FIXED_EVENT_CONSTRAINT(0x00c0, 0), /* INST_RETIRED.ANY */ |
102 | FIXED_EVENT_CONSTRAINT(0x003c, 1), /* CPU_CLK_UNHALTED.CORE */ | 102 | FIXED_EVENT_CONSTRAINT(0x003c, 1), /* CPU_CLK_UNHALTED.CORE */ |
103 | FIXED_EVENT_CONSTRAINT(0x0300, 2), /* CPU_CLK_UNHALTED.REF */ | 103 | FIXED_EVENT_CONSTRAINT(0x0300, 2), /* CPU_CLK_UNHALTED.REF */ |
104 | INTEL_UEVENT_CONSTRAINT(0x04a3, 0xf), /* CYCLE_ACTIVITY.CYCLES_NO_DISPATCH */ | ||
105 | INTEL_UEVENT_CONSTRAINT(0x05a3, 0xf), /* CYCLE_ACTIVITY.STALLS_L2_PENDING */ | ||
106 | INTEL_UEVENT_CONSTRAINT(0x02a3, 0x4), /* CYCLE_ACTIVITY.CYCLES_L1D_PENDING */ | ||
107 | INTEL_UEVENT_CONSTRAINT(0x06a3, 0x4), /* CYCLE_ACTIVITY.STALLS_L1D_PENDING */ | ||
104 | INTEL_EVENT_CONSTRAINT(0x48, 0x4), /* L1D_PEND_MISS.PENDING */ | 108 | INTEL_EVENT_CONSTRAINT(0x48, 0x4), /* L1D_PEND_MISS.PENDING */ |
105 | INTEL_UEVENT_CONSTRAINT(0x01c0, 0x2), /* INST_RETIRED.PREC_DIST */ | 109 | INTEL_UEVENT_CONSTRAINT(0x01c0, 0x2), /* INST_RETIRED.PREC_DIST */ |
106 | INTEL_EVENT_CONSTRAINT(0xcd, 0x8), /* MEM_TRANS_RETIRED.LOAD_LATENCY */ | 110 | INTEL_EVENT_CONSTRAINT(0xcd, 0x8), /* MEM_TRANS_RETIRED.LOAD_LATENCY */ |
diff --git a/arch/x86/kernel/cpu/perf_event_intel_ds.c b/arch/x86/kernel/cpu/perf_event_intel_ds.c index 826054a4f2ee..b05a575d56f4 100644 --- a/arch/x86/kernel/cpu/perf_event_intel_ds.c +++ b/arch/x86/kernel/cpu/perf_event_intel_ds.c | |||
@@ -729,3 +729,13 @@ void intel_ds_init(void) | |||
729 | } | 729 | } |
730 | } | 730 | } |
731 | } | 731 | } |
732 | |||
733 | void perf_restore_debug_store(void) | ||
734 | { | ||
735 | struct debug_store *ds = __this_cpu_read(cpu_hw_events.ds); | ||
736 | |||
737 | if (!x86_pmu.bts && !x86_pmu.pebs) | ||
738 | return; | ||
739 | |||
740 | wrmsrl(MSR_IA32_DS_AREA, (unsigned long)ds); | ||
741 | } | ||
diff --git a/arch/x86/kernel/kprobes/core.c b/arch/x86/kernel/kprobes/core.c index 3f06e6149981..7bfe318d3d8a 100644 --- a/arch/x86/kernel/kprobes/core.c +++ b/arch/x86/kernel/kprobes/core.c | |||
@@ -375,6 +375,9 @@ static void __kprobes arch_copy_kprobe(struct kprobe *p) | |||
375 | else | 375 | else |
376 | p->ainsn.boostable = -1; | 376 | p->ainsn.boostable = -1; |
377 | 377 | ||
378 | /* Check whether the instruction modifies Interrupt Flag or not */ | ||
379 | p->ainsn.if_modifier = is_IF_modifier(p->ainsn.insn); | ||
380 | |||
378 | /* Also, displacement change doesn't affect the first byte */ | 381 | /* Also, displacement change doesn't affect the first byte */ |
379 | p->opcode = p->ainsn.insn[0]; | 382 | p->opcode = p->ainsn.insn[0]; |
380 | } | 383 | } |
@@ -434,7 +437,7 @@ static void __kprobes set_current_kprobe(struct kprobe *p, struct pt_regs *regs, | |||
434 | __this_cpu_write(current_kprobe, p); | 437 | __this_cpu_write(current_kprobe, p); |
435 | kcb->kprobe_saved_flags = kcb->kprobe_old_flags | 438 | kcb->kprobe_saved_flags = kcb->kprobe_old_flags |
436 | = (regs->flags & (X86_EFLAGS_TF | X86_EFLAGS_IF)); | 439 | = (regs->flags & (X86_EFLAGS_TF | X86_EFLAGS_IF)); |
437 | if (is_IF_modifier(p->ainsn.insn)) | 440 | if (p->ainsn.if_modifier) |
438 | kcb->kprobe_saved_flags &= ~X86_EFLAGS_IF; | 441 | kcb->kprobe_saved_flags &= ~X86_EFLAGS_IF; |
439 | } | 442 | } |
440 | 443 | ||
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index f71500af1f81..f19ac0aca60d 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c | |||
@@ -1406,25 +1406,15 @@ static int kvm_guest_time_update(struct kvm_vcpu *v) | |||
1406 | unsigned long flags, this_tsc_khz; | 1406 | unsigned long flags, this_tsc_khz; |
1407 | struct kvm_vcpu_arch *vcpu = &v->arch; | 1407 | struct kvm_vcpu_arch *vcpu = &v->arch; |
1408 | struct kvm_arch *ka = &v->kvm->arch; | 1408 | struct kvm_arch *ka = &v->kvm->arch; |
1409 | void *shared_kaddr; | ||
1410 | s64 kernel_ns, max_kernel_ns; | 1409 | s64 kernel_ns, max_kernel_ns; |
1411 | u64 tsc_timestamp, host_tsc; | 1410 | u64 tsc_timestamp, host_tsc; |
1412 | struct pvclock_vcpu_time_info *guest_hv_clock; | 1411 | struct pvclock_vcpu_time_info guest_hv_clock; |
1413 | u8 pvclock_flags; | 1412 | u8 pvclock_flags; |
1414 | bool use_master_clock; | 1413 | bool use_master_clock; |
1415 | 1414 | ||
1416 | kernel_ns = 0; | 1415 | kernel_ns = 0; |
1417 | host_tsc = 0; | 1416 | host_tsc = 0; |
1418 | 1417 | ||
1419 | /* Keep irq disabled to prevent changes to the clock */ | ||
1420 | local_irq_save(flags); | ||
1421 | this_tsc_khz = __get_cpu_var(cpu_tsc_khz); | ||
1422 | if (unlikely(this_tsc_khz == 0)) { | ||
1423 | local_irq_restore(flags); | ||
1424 | kvm_make_request(KVM_REQ_CLOCK_UPDATE, v); | ||
1425 | return 1; | ||
1426 | } | ||
1427 | |||
1428 | /* | 1418 | /* |
1429 | * If the host uses TSC clock, then passthrough TSC as stable | 1419 | * If the host uses TSC clock, then passthrough TSC as stable |
1430 | * to the guest. | 1420 | * to the guest. |
@@ -1436,6 +1426,15 @@ static int kvm_guest_time_update(struct kvm_vcpu *v) | |||
1436 | kernel_ns = ka->master_kernel_ns; | 1426 | kernel_ns = ka->master_kernel_ns; |
1437 | } | 1427 | } |
1438 | spin_unlock(&ka->pvclock_gtod_sync_lock); | 1428 | spin_unlock(&ka->pvclock_gtod_sync_lock); |
1429 | |||
1430 | /* Keep irq disabled to prevent changes to the clock */ | ||
1431 | local_irq_save(flags); | ||
1432 | this_tsc_khz = __get_cpu_var(cpu_tsc_khz); | ||
1433 | if (unlikely(this_tsc_khz == 0)) { | ||
1434 | local_irq_restore(flags); | ||
1435 | kvm_make_request(KVM_REQ_CLOCK_UPDATE, v); | ||
1436 | return 1; | ||
1437 | } | ||
1439 | if (!use_master_clock) { | 1438 | if (!use_master_clock) { |
1440 | host_tsc = native_read_tsc(); | 1439 | host_tsc = native_read_tsc(); |
1441 | kernel_ns = get_kernel_ns(); | 1440 | kernel_ns = get_kernel_ns(); |
@@ -1463,7 +1462,7 @@ static int kvm_guest_time_update(struct kvm_vcpu *v) | |||
1463 | 1462 | ||
1464 | local_irq_restore(flags); | 1463 | local_irq_restore(flags); |
1465 | 1464 | ||
1466 | if (!vcpu->time_page) | 1465 | if (!vcpu->pv_time_enabled) |
1467 | return 0; | 1466 | return 0; |
1468 | 1467 | ||
1469 | /* | 1468 | /* |
@@ -1525,12 +1524,12 @@ static int kvm_guest_time_update(struct kvm_vcpu *v) | |||
1525 | */ | 1524 | */ |
1526 | vcpu->hv_clock.version += 2; | 1525 | vcpu->hv_clock.version += 2; |
1527 | 1526 | ||
1528 | shared_kaddr = kmap_atomic(vcpu->time_page); | 1527 | if (unlikely(kvm_read_guest_cached(v->kvm, &vcpu->pv_time, |
1529 | 1528 | &guest_hv_clock, sizeof(guest_hv_clock)))) | |
1530 | guest_hv_clock = shared_kaddr + vcpu->time_offset; | 1529 | return 0; |
1531 | 1530 | ||
1532 | /* retain PVCLOCK_GUEST_STOPPED if set in guest copy */ | 1531 | /* retain PVCLOCK_GUEST_STOPPED if set in guest copy */ |
1533 | pvclock_flags = (guest_hv_clock->flags & PVCLOCK_GUEST_STOPPED); | 1532 | pvclock_flags = (guest_hv_clock.flags & PVCLOCK_GUEST_STOPPED); |
1534 | 1533 | ||
1535 | if (vcpu->pvclock_set_guest_stopped_request) { | 1534 | if (vcpu->pvclock_set_guest_stopped_request) { |
1536 | pvclock_flags |= PVCLOCK_GUEST_STOPPED; | 1535 | pvclock_flags |= PVCLOCK_GUEST_STOPPED; |
@@ -1543,12 +1542,9 @@ static int kvm_guest_time_update(struct kvm_vcpu *v) | |||
1543 | 1542 | ||
1544 | vcpu->hv_clock.flags = pvclock_flags; | 1543 | vcpu->hv_clock.flags = pvclock_flags; |
1545 | 1544 | ||
1546 | memcpy(shared_kaddr + vcpu->time_offset, &vcpu->hv_clock, | 1545 | kvm_write_guest_cached(v->kvm, &vcpu->pv_time, |
1547 | sizeof(vcpu->hv_clock)); | 1546 | &vcpu->hv_clock, |
1548 | 1547 | sizeof(vcpu->hv_clock)); | |
1549 | kunmap_atomic(shared_kaddr); | ||
1550 | |||
1551 | mark_page_dirty(v->kvm, vcpu->time >> PAGE_SHIFT); | ||
1552 | return 0; | 1548 | return 0; |
1553 | } | 1549 | } |
1554 | 1550 | ||
@@ -1837,10 +1833,7 @@ static int kvm_pv_enable_async_pf(struct kvm_vcpu *vcpu, u64 data) | |||
1837 | 1833 | ||
1838 | static void kvmclock_reset(struct kvm_vcpu *vcpu) | 1834 | static void kvmclock_reset(struct kvm_vcpu *vcpu) |
1839 | { | 1835 | { |
1840 | if (vcpu->arch.time_page) { | 1836 | vcpu->arch.pv_time_enabled = false; |
1841 | kvm_release_page_dirty(vcpu->arch.time_page); | ||
1842 | vcpu->arch.time_page = NULL; | ||
1843 | } | ||
1844 | } | 1837 | } |
1845 | 1838 | ||
1846 | static void accumulate_steal_time(struct kvm_vcpu *vcpu) | 1839 | static void accumulate_steal_time(struct kvm_vcpu *vcpu) |
@@ -1947,6 +1940,7 @@ int kvm_set_msr_common(struct kvm_vcpu *vcpu, struct msr_data *msr_info) | |||
1947 | break; | 1940 | break; |
1948 | case MSR_KVM_SYSTEM_TIME_NEW: | 1941 | case MSR_KVM_SYSTEM_TIME_NEW: |
1949 | case MSR_KVM_SYSTEM_TIME: { | 1942 | case MSR_KVM_SYSTEM_TIME: { |
1943 | u64 gpa_offset; | ||
1950 | kvmclock_reset(vcpu); | 1944 | kvmclock_reset(vcpu); |
1951 | 1945 | ||
1952 | vcpu->arch.time = data; | 1946 | vcpu->arch.time = data; |
@@ -1956,14 +1950,17 @@ int kvm_set_msr_common(struct kvm_vcpu *vcpu, struct msr_data *msr_info) | |||
1956 | if (!(data & 1)) | 1950 | if (!(data & 1)) |
1957 | break; | 1951 | break; |
1958 | 1952 | ||
1959 | /* ...but clean it before doing the actual write */ | 1953 | gpa_offset = data & ~(PAGE_MASK | 1); |
1960 | vcpu->arch.time_offset = data & ~(PAGE_MASK | 1); | ||
1961 | 1954 | ||
1962 | vcpu->arch.time_page = | 1955 | /* Check that the address is 32-byte aligned. */ |
1963 | gfn_to_page(vcpu->kvm, data >> PAGE_SHIFT); | 1956 | if (gpa_offset & (sizeof(struct pvclock_vcpu_time_info) - 1)) |
1957 | break; | ||
1964 | 1958 | ||
1965 | if (is_error_page(vcpu->arch.time_page)) | 1959 | if (kvm_gfn_to_hva_cache_init(vcpu->kvm, |
1966 | vcpu->arch.time_page = NULL; | 1960 | &vcpu->arch.pv_time, data & ~1ULL)) |
1961 | vcpu->arch.pv_time_enabled = false; | ||
1962 | else | ||
1963 | vcpu->arch.pv_time_enabled = true; | ||
1967 | 1964 | ||
1968 | break; | 1965 | break; |
1969 | } | 1966 | } |
@@ -2967,7 +2964,7 @@ static int kvm_vcpu_ioctl_x86_set_xcrs(struct kvm_vcpu *vcpu, | |||
2967 | */ | 2964 | */ |
2968 | static int kvm_set_guest_paused(struct kvm_vcpu *vcpu) | 2965 | static int kvm_set_guest_paused(struct kvm_vcpu *vcpu) |
2969 | { | 2966 | { |
2970 | if (!vcpu->arch.time_page) | 2967 | if (!vcpu->arch.pv_time_enabled) |
2971 | return -EINVAL; | 2968 | return -EINVAL; |
2972 | vcpu->arch.pvclock_set_guest_stopped_request = true; | 2969 | vcpu->arch.pvclock_set_guest_stopped_request = true; |
2973 | kvm_make_request(KVM_REQ_CLOCK_UPDATE, vcpu); | 2970 | kvm_make_request(KVM_REQ_CLOCK_UPDATE, vcpu); |
@@ -6718,6 +6715,7 @@ int kvm_arch_vcpu_init(struct kvm_vcpu *vcpu) | |||
6718 | goto fail_free_wbinvd_dirty_mask; | 6715 | goto fail_free_wbinvd_dirty_mask; |
6719 | 6716 | ||
6720 | vcpu->arch.ia32_tsc_adjust_msr = 0x0; | 6717 | vcpu->arch.ia32_tsc_adjust_msr = 0x0; |
6718 | vcpu->arch.pv_time_enabled = false; | ||
6721 | kvm_async_pf_hash_reset(vcpu); | 6719 | kvm_async_pf_hash_reset(vcpu); |
6722 | kvm_pmu_init(vcpu); | 6720 | kvm_pmu_init(vcpu); |
6723 | 6721 | ||
diff --git a/arch/x86/power/cpu.c b/arch/x86/power/cpu.c index 120cee1c3f8d..3c68768d7a75 100644 --- a/arch/x86/power/cpu.c +++ b/arch/x86/power/cpu.c | |||
@@ -11,6 +11,7 @@ | |||
11 | #include <linux/suspend.h> | 11 | #include <linux/suspend.h> |
12 | #include <linux/export.h> | 12 | #include <linux/export.h> |
13 | #include <linux/smp.h> | 13 | #include <linux/smp.h> |
14 | #include <linux/perf_event.h> | ||
14 | 15 | ||
15 | #include <asm/pgtable.h> | 16 | #include <asm/pgtable.h> |
16 | #include <asm/proto.h> | 17 | #include <asm/proto.h> |
@@ -228,6 +229,7 @@ static void __restore_processor_state(struct saved_context *ctxt) | |||
228 | do_fpu_end(); | 229 | do_fpu_end(); |
229 | x86_platform.restore_sched_clock_state(); | 230 | x86_platform.restore_sched_clock_state(); |
230 | mtrr_bp_restore(); | 231 | mtrr_bp_restore(); |
232 | perf_restore_debug_store(); | ||
231 | } | 233 | } |
232 | 234 | ||
233 | /* Needed by apm.c */ | 235 | /* Needed by apm.c */ |
diff --git a/arch/xtensa/Kconfig b/arch/xtensa/Kconfig index 35876ffac11d..b09de49dbec5 100644 --- a/arch/xtensa/Kconfig +++ b/arch/xtensa/Kconfig | |||
@@ -9,7 +9,7 @@ config XTENSA | |||
9 | select HAVE_IDE | 9 | select HAVE_IDE |
10 | select GENERIC_ATOMIC64 | 10 | select GENERIC_ATOMIC64 |
11 | select HAVE_GENERIC_HARDIRQS | 11 | select HAVE_GENERIC_HARDIRQS |
12 | select HAVE_VIRT_TO_BUS | 12 | select VIRT_TO_BUS |
13 | select GENERIC_IRQ_SHOW | 13 | select GENERIC_IRQ_SHOW |
14 | select GENERIC_CPU_DEVICES | 14 | select GENERIC_CPU_DEVICES |
15 | select MODULES_USE_ELF_RELA | 15 | select MODULES_USE_ELF_RELA |
diff --git a/drivers/acpi/processor_perflib.c b/drivers/acpi/processor_perflib.c index 53e7ac9403a7..e854582f29a6 100644 --- a/drivers/acpi/processor_perflib.c +++ b/drivers/acpi/processor_perflib.c | |||
@@ -465,7 +465,7 @@ static int acpi_processor_get_performance_states(struct acpi_processor *pr) | |||
465 | return result; | 465 | return result; |
466 | } | 466 | } |
467 | 467 | ||
468 | static int acpi_processor_get_performance_info(struct acpi_processor *pr) | 468 | int acpi_processor_get_performance_info(struct acpi_processor *pr) |
469 | { | 469 | { |
470 | int result = 0; | 470 | int result = 0; |
471 | acpi_status status = AE_OK; | 471 | acpi_status status = AE_OK; |
@@ -509,7 +509,7 @@ static int acpi_processor_get_performance_info(struct acpi_processor *pr) | |||
509 | #endif | 509 | #endif |
510 | return result; | 510 | return result; |
511 | } | 511 | } |
512 | 512 | EXPORT_SYMBOL_GPL(acpi_processor_get_performance_info); | |
513 | int acpi_processor_notify_smm(struct module *calling_module) | 513 | int acpi_processor_notify_smm(struct module *calling_module) |
514 | { | 514 | { |
515 | acpi_status status; | 515 | acpi_status status; |
diff --git a/drivers/amba/tegra-ahb.c b/drivers/amba/tegra-ahb.c index 093c43554963..1f44e56cc65d 100644 --- a/drivers/amba/tegra-ahb.c +++ b/drivers/amba/tegra-ahb.c | |||
@@ -158,7 +158,7 @@ int tegra_ahb_enable_smmu(struct device_node *dn) | |||
158 | EXPORT_SYMBOL(tegra_ahb_enable_smmu); | 158 | EXPORT_SYMBOL(tegra_ahb_enable_smmu); |
159 | #endif | 159 | #endif |
160 | 160 | ||
161 | #ifdef CONFIG_PM_SLEEP | 161 | #ifdef CONFIG_PM |
162 | static int tegra_ahb_suspend(struct device *dev) | 162 | static int tegra_ahb_suspend(struct device *dev) |
163 | { | 163 | { |
164 | int i; | 164 | int i; |
diff --git a/drivers/ata/Kconfig b/drivers/ata/Kconfig index 3e751b74615e..a5a3ebcbdd2c 100644 --- a/drivers/ata/Kconfig +++ b/drivers/ata/Kconfig | |||
@@ -59,15 +59,16 @@ config ATA_ACPI | |||
59 | option libata.noacpi=1 | 59 | option libata.noacpi=1 |
60 | 60 | ||
61 | config SATA_ZPODD | 61 | config SATA_ZPODD |
62 | bool "SATA Zero Power ODD Support" | 62 | bool "SATA Zero Power Optical Disc Drive (ZPODD) support" |
63 | depends on ATA_ACPI | 63 | depends on ATA_ACPI |
64 | default n | 64 | default n |
65 | help | 65 | help |
66 | This option adds support for SATA ZPODD. It requires both | 66 | This option adds support for SATA Zero Power Optical Disc |
67 | ODD and the platform support, and if enabled, will automatically | 67 | Drive (ZPODD). It requires both the ODD and the platform |
68 | power on/off the ODD when certain condition is satisfied. This | 68 | support, and if enabled, will automatically power on/off the |
69 | does not impact user's experience of the ODD, only power is saved | 69 | ODD when certain condition is satisfied. This does not impact |
70 | when ODD is not in use(i.e. no disc inside). | 70 | end user's experience of the ODD, only power is saved when |
71 | the ODD is not in use (i.e. no disc inside). | ||
71 | 72 | ||
72 | If unsure, say N. | 73 | If unsure, say N. |
73 | 74 | ||
diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c index a99112cfd8b1..6a67b07de494 100644 --- a/drivers/ata/ahci.c +++ b/drivers/ata/ahci.c | |||
@@ -281,6 +281,8 @@ static const struct pci_device_id ahci_pci_tbl[] = { | |||
281 | { PCI_VDEVICE(INTEL, 0x1f37), board_ahci }, /* Avoton RAID */ | 281 | { PCI_VDEVICE(INTEL, 0x1f37), board_ahci }, /* Avoton RAID */ |
282 | { PCI_VDEVICE(INTEL, 0x1f3e), board_ahci }, /* Avoton RAID */ | 282 | { PCI_VDEVICE(INTEL, 0x1f3e), board_ahci }, /* Avoton RAID */ |
283 | { PCI_VDEVICE(INTEL, 0x1f3f), board_ahci }, /* Avoton RAID */ | 283 | { PCI_VDEVICE(INTEL, 0x1f3f), board_ahci }, /* Avoton RAID */ |
284 | { PCI_VDEVICE(INTEL, 0x2823), board_ahci }, /* Wellsburg RAID */ | ||
285 | { PCI_VDEVICE(INTEL, 0x2827), board_ahci }, /* Wellsburg RAID */ | ||
284 | { PCI_VDEVICE(INTEL, 0x8d02), board_ahci }, /* Wellsburg AHCI */ | 286 | { PCI_VDEVICE(INTEL, 0x8d02), board_ahci }, /* Wellsburg AHCI */ |
285 | { PCI_VDEVICE(INTEL, 0x8d04), board_ahci }, /* Wellsburg RAID */ | 287 | { PCI_VDEVICE(INTEL, 0x8d04), board_ahci }, /* Wellsburg RAID */ |
286 | { PCI_VDEVICE(INTEL, 0x8d06), board_ahci }, /* Wellsburg RAID */ | 288 | { PCI_VDEVICE(INTEL, 0x8d06), board_ahci }, /* Wellsburg RAID */ |
diff --git a/drivers/ata/ata_piix.c b/drivers/ata/ata_piix.c index d2ba439cfe54..ffdd32d22602 100644 --- a/drivers/ata/ata_piix.c +++ b/drivers/ata/ata_piix.c | |||
@@ -1547,6 +1547,10 @@ static bool piix_broken_system_poweroff(struct pci_dev *pdev) | |||
1547 | 1547 | ||
1548 | static int prefer_ms_hyperv = 1; | 1548 | static int prefer_ms_hyperv = 1; |
1549 | module_param(prefer_ms_hyperv, int, 0); | 1549 | module_param(prefer_ms_hyperv, int, 0); |
1550 | MODULE_PARM_DESC(prefer_ms_hyperv, | ||
1551 | "Prefer Hyper-V paravirtualization drivers instead of ATA, " | ||
1552 | "0 - Use ATA drivers, " | ||
1553 | "1 (Default) - Use the paravirtualization drivers."); | ||
1550 | 1554 | ||
1551 | static void piix_ignore_devices_quirk(struct ata_host *host) | 1555 | static void piix_ignore_devices_quirk(struct ata_host *host) |
1552 | { | 1556 | { |
diff --git a/drivers/ata/libata-acpi.c b/drivers/ata/libata-acpi.c index beea3115577e..8a52dab412e2 100644 --- a/drivers/ata/libata-acpi.c +++ b/drivers/ata/libata-acpi.c | |||
@@ -1027,7 +1027,7 @@ static void ata_acpi_register_power_resource(struct ata_device *dev) | |||
1027 | 1027 | ||
1028 | handle = ata_dev_acpi_handle(dev); | 1028 | handle = ata_dev_acpi_handle(dev); |
1029 | if (handle) | 1029 | if (handle) |
1030 | acpi_dev_pm_remove_dependent(handle, &sdev->sdev_gendev); | 1030 | acpi_dev_pm_add_dependent(handle, &sdev->sdev_gendev); |
1031 | } | 1031 | } |
1032 | 1032 | ||
1033 | static void ata_acpi_unregister_power_resource(struct ata_device *dev) | 1033 | static void ata_acpi_unregister_power_resource(struct ata_device *dev) |
diff --git a/drivers/ata/pata_samsung_cf.c b/drivers/ata/pata_samsung_cf.c index 70b0e01372b3..6ef27e98c508 100644 --- a/drivers/ata/pata_samsung_cf.c +++ b/drivers/ata/pata_samsung_cf.c | |||
@@ -661,18 +661,7 @@ static struct platform_driver pata_s3c_driver = { | |||
661 | }, | 661 | }, |
662 | }; | 662 | }; |
663 | 663 | ||
664 | static int __init pata_s3c_init(void) | 664 | module_platform_driver_probe(pata_s3c_driver, pata_s3c_probe); |
665 | { | ||
666 | return platform_driver_probe(&pata_s3c_driver, pata_s3c_probe); | ||
667 | } | ||
668 | |||
669 | static void __exit pata_s3c_exit(void) | ||
670 | { | ||
671 | platform_driver_unregister(&pata_s3c_driver); | ||
672 | } | ||
673 | |||
674 | module_init(pata_s3c_init); | ||
675 | module_exit(pata_s3c_exit); | ||
676 | 665 | ||
677 | MODULE_AUTHOR("Abhilash Kesavan, <a.kesavan@samsung.com>"); | 666 | MODULE_AUTHOR("Abhilash Kesavan, <a.kesavan@samsung.com>"); |
678 | MODULE_DESCRIPTION("low-level driver for Samsung PATA controller"); | 667 | MODULE_DESCRIPTION("low-level driver for Samsung PATA controller"); |
diff --git a/drivers/ata/sata_fsl.c b/drivers/ata/sata_fsl.c index 124b2c1d9c0b..608f82fed632 100644 --- a/drivers/ata/sata_fsl.c +++ b/drivers/ata/sata_fsl.c | |||
@@ -1511,8 +1511,7 @@ error_exit_with_cleanup: | |||
1511 | 1511 | ||
1512 | if (hcr_base) | 1512 | if (hcr_base) |
1513 | iounmap(hcr_base); | 1513 | iounmap(hcr_base); |
1514 | if (host_priv) | 1514 | kfree(host_priv); |
1515 | kfree(host_priv); | ||
1516 | 1515 | ||
1517 | return retval; | 1516 | return retval; |
1518 | } | 1517 | } |
diff --git a/drivers/block/nvme.c b/drivers/block/nvme.c index 07fb2dfaae13..9dcefe40380b 100644 --- a/drivers/block/nvme.c +++ b/drivers/block/nvme.c | |||
@@ -135,6 +135,7 @@ static inline void _nvme_check_size(void) | |||
135 | BUILD_BUG_ON(sizeof(struct nvme_id_ctrl) != 4096); | 135 | BUILD_BUG_ON(sizeof(struct nvme_id_ctrl) != 4096); |
136 | BUILD_BUG_ON(sizeof(struct nvme_id_ns) != 4096); | 136 | BUILD_BUG_ON(sizeof(struct nvme_id_ns) != 4096); |
137 | BUILD_BUG_ON(sizeof(struct nvme_lba_range_type) != 64); | 137 | BUILD_BUG_ON(sizeof(struct nvme_lba_range_type) != 64); |
138 | BUILD_BUG_ON(sizeof(struct nvme_smart_log) != 512); | ||
138 | } | 139 | } |
139 | 140 | ||
140 | typedef void (*nvme_completion_fn)(struct nvme_dev *, void *, | 141 | typedef void (*nvme_completion_fn)(struct nvme_dev *, void *, |
@@ -237,7 +238,8 @@ static void *free_cmdid(struct nvme_queue *nvmeq, int cmdid, | |||
237 | *fn = special_completion; | 238 | *fn = special_completion; |
238 | return CMD_CTX_INVALID; | 239 | return CMD_CTX_INVALID; |
239 | } | 240 | } |
240 | *fn = info[cmdid].fn; | 241 | if (fn) |
242 | *fn = info[cmdid].fn; | ||
241 | ctx = info[cmdid].ctx; | 243 | ctx = info[cmdid].ctx; |
242 | info[cmdid].fn = special_completion; | 244 | info[cmdid].fn = special_completion; |
243 | info[cmdid].ctx = CMD_CTX_COMPLETED; | 245 | info[cmdid].ctx = CMD_CTX_COMPLETED; |
@@ -335,6 +337,7 @@ nvme_alloc_iod(unsigned nseg, unsigned nbytes, gfp_t gfp) | |||
335 | iod->offset = offsetof(struct nvme_iod, sg[nseg]); | 337 | iod->offset = offsetof(struct nvme_iod, sg[nseg]); |
336 | iod->npages = -1; | 338 | iod->npages = -1; |
337 | iod->length = nbytes; | 339 | iod->length = nbytes; |
340 | iod->nents = 0; | ||
338 | } | 341 | } |
339 | 342 | ||
340 | return iod; | 343 | return iod; |
@@ -375,7 +378,8 @@ static void bio_completion(struct nvme_dev *dev, void *ctx, | |||
375 | struct bio *bio = iod->private; | 378 | struct bio *bio = iod->private; |
376 | u16 status = le16_to_cpup(&cqe->status) >> 1; | 379 | u16 status = le16_to_cpup(&cqe->status) >> 1; |
377 | 380 | ||
378 | dma_unmap_sg(&dev->pci_dev->dev, iod->sg, iod->nents, | 381 | if (iod->nents) |
382 | dma_unmap_sg(&dev->pci_dev->dev, iod->sg, iod->nents, | ||
379 | bio_data_dir(bio) ? DMA_TO_DEVICE : DMA_FROM_DEVICE); | 383 | bio_data_dir(bio) ? DMA_TO_DEVICE : DMA_FROM_DEVICE); |
380 | nvme_free_iod(dev, iod); | 384 | nvme_free_iod(dev, iod); |
381 | if (status) { | 385 | if (status) { |
@@ -589,7 +593,7 @@ static int nvme_submit_bio_queue(struct nvme_queue *nvmeq, struct nvme_ns *ns, | |||
589 | 593 | ||
590 | result = nvme_map_bio(nvmeq->q_dmadev, iod, bio, dma_dir, psegs); | 594 | result = nvme_map_bio(nvmeq->q_dmadev, iod, bio, dma_dir, psegs); |
591 | if (result < 0) | 595 | if (result < 0) |
592 | goto free_iod; | 596 | goto free_cmdid; |
593 | length = result; | 597 | length = result; |
594 | 598 | ||
595 | cmnd->rw.command_id = cmdid; | 599 | cmnd->rw.command_id = cmdid; |
@@ -609,6 +613,8 @@ static int nvme_submit_bio_queue(struct nvme_queue *nvmeq, struct nvme_ns *ns, | |||
609 | 613 | ||
610 | return 0; | 614 | return 0; |
611 | 615 | ||
616 | free_cmdid: | ||
617 | free_cmdid(nvmeq, cmdid, NULL); | ||
612 | free_iod: | 618 | free_iod: |
613 | nvme_free_iod(nvmeq->dev, iod); | 619 | nvme_free_iod(nvmeq->dev, iod); |
614 | nomem: | 620 | nomem: |
@@ -835,8 +841,8 @@ static int nvme_identify(struct nvme_dev *dev, unsigned nsid, unsigned cns, | |||
835 | return nvme_submit_admin_cmd(dev, &c, NULL); | 841 | return nvme_submit_admin_cmd(dev, &c, NULL); |
836 | } | 842 | } |
837 | 843 | ||
838 | static int nvme_get_features(struct nvme_dev *dev, unsigned fid, | 844 | static int nvme_get_features(struct nvme_dev *dev, unsigned fid, unsigned nsid, |
839 | unsigned nsid, dma_addr_t dma_addr) | 845 | dma_addr_t dma_addr, u32 *result) |
840 | { | 846 | { |
841 | struct nvme_command c; | 847 | struct nvme_command c; |
842 | 848 | ||
@@ -846,7 +852,7 @@ static int nvme_get_features(struct nvme_dev *dev, unsigned fid, | |||
846 | c.features.prp1 = cpu_to_le64(dma_addr); | 852 | c.features.prp1 = cpu_to_le64(dma_addr); |
847 | c.features.fid = cpu_to_le32(fid); | 853 | c.features.fid = cpu_to_le32(fid); |
848 | 854 | ||
849 | return nvme_submit_admin_cmd(dev, &c, NULL); | 855 | return nvme_submit_admin_cmd(dev, &c, result); |
850 | } | 856 | } |
851 | 857 | ||
852 | static int nvme_set_features(struct nvme_dev *dev, unsigned fid, | 858 | static int nvme_set_features(struct nvme_dev *dev, unsigned fid, |
@@ -906,6 +912,10 @@ static void nvme_free_queue(struct nvme_dev *dev, int qid) | |||
906 | 912 | ||
907 | spin_lock_irq(&nvmeq->q_lock); | 913 | spin_lock_irq(&nvmeq->q_lock); |
908 | nvme_cancel_ios(nvmeq, false); | 914 | nvme_cancel_ios(nvmeq, false); |
915 | while (bio_list_peek(&nvmeq->sq_cong)) { | ||
916 | struct bio *bio = bio_list_pop(&nvmeq->sq_cong); | ||
917 | bio_endio(bio, -EIO); | ||
918 | } | ||
909 | spin_unlock_irq(&nvmeq->q_lock); | 919 | spin_unlock_irq(&nvmeq->q_lock); |
910 | 920 | ||
911 | irq_set_affinity_hint(vector, NULL); | 921 | irq_set_affinity_hint(vector, NULL); |
@@ -1230,12 +1240,17 @@ static int nvme_user_admin_cmd(struct nvme_dev *dev, | |||
1230 | if (length != cmd.data_len) | 1240 | if (length != cmd.data_len) |
1231 | status = -ENOMEM; | 1241 | status = -ENOMEM; |
1232 | else | 1242 | else |
1233 | status = nvme_submit_admin_cmd(dev, &c, NULL); | 1243 | status = nvme_submit_admin_cmd(dev, &c, &cmd.result); |
1234 | 1244 | ||
1235 | if (cmd.data_len) { | 1245 | if (cmd.data_len) { |
1236 | nvme_unmap_user_pages(dev, cmd.opcode & 1, iod); | 1246 | nvme_unmap_user_pages(dev, cmd.opcode & 1, iod); |
1237 | nvme_free_iod(dev, iod); | 1247 | nvme_free_iod(dev, iod); |
1238 | } | 1248 | } |
1249 | |||
1250 | if (!status && copy_to_user(&ucmd->result, &cmd.result, | ||
1251 | sizeof(cmd.result))) | ||
1252 | status = -EFAULT; | ||
1253 | |||
1239 | return status; | 1254 | return status; |
1240 | } | 1255 | } |
1241 | 1256 | ||
@@ -1523,9 +1538,9 @@ static int nvme_dev_add(struct nvme_dev *dev) | |||
1523 | continue; | 1538 | continue; |
1524 | 1539 | ||
1525 | res = nvme_get_features(dev, NVME_FEAT_LBA_RANGE, i, | 1540 | res = nvme_get_features(dev, NVME_FEAT_LBA_RANGE, i, |
1526 | dma_addr + 4096); | 1541 | dma_addr + 4096, NULL); |
1527 | if (res) | 1542 | if (res) |
1528 | continue; | 1543 | memset(mem + 4096, 0, 4096); |
1529 | 1544 | ||
1530 | ns = nvme_alloc_ns(dev, i, mem, mem + 4096); | 1545 | ns = nvme_alloc_ns(dev, i, mem, mem + 4096); |
1531 | if (ns) | 1546 | if (ns) |
diff --git a/drivers/bluetooth/ath3k.c b/drivers/bluetooth/ath3k.c index a8a41e07a221..b282af181b44 100644 --- a/drivers/bluetooth/ath3k.c +++ b/drivers/bluetooth/ath3k.c | |||
@@ -74,8 +74,10 @@ static struct usb_device_id ath3k_table[] = { | |||
74 | 74 | ||
75 | /* Atheros AR3012 with sflash firmware*/ | 75 | /* Atheros AR3012 with sflash firmware*/ |
76 | { USB_DEVICE(0x0CF3, 0x3004) }, | 76 | { USB_DEVICE(0x0CF3, 0x3004) }, |
77 | { USB_DEVICE(0x0CF3, 0x3008) }, | ||
77 | { USB_DEVICE(0x0CF3, 0x311D) }, | 78 | { USB_DEVICE(0x0CF3, 0x311D) }, |
78 | { USB_DEVICE(0x13d3, 0x3375) }, | 79 | { USB_DEVICE(0x13d3, 0x3375) }, |
80 | { USB_DEVICE(0x04CA, 0x3004) }, | ||
79 | { USB_DEVICE(0x04CA, 0x3005) }, | 81 | { USB_DEVICE(0x04CA, 0x3005) }, |
80 | { USB_DEVICE(0x04CA, 0x3006) }, | 82 | { USB_DEVICE(0x04CA, 0x3006) }, |
81 | { USB_DEVICE(0x04CA, 0x3008) }, | 83 | { USB_DEVICE(0x04CA, 0x3008) }, |
@@ -106,8 +108,10 @@ static struct usb_device_id ath3k_blist_tbl[] = { | |||
106 | 108 | ||
107 | /* Atheros AR3012 with sflash firmware*/ | 109 | /* Atheros AR3012 with sflash firmware*/ |
108 | { USB_DEVICE(0x0cf3, 0x3004), .driver_info = BTUSB_ATH3012 }, | 110 | { USB_DEVICE(0x0cf3, 0x3004), .driver_info = BTUSB_ATH3012 }, |
111 | { USB_DEVICE(0x0cf3, 0x3008), .driver_info = BTUSB_ATH3012 }, | ||
109 | { USB_DEVICE(0x0cf3, 0x311D), .driver_info = BTUSB_ATH3012 }, | 112 | { USB_DEVICE(0x0cf3, 0x311D), .driver_info = BTUSB_ATH3012 }, |
110 | { USB_DEVICE(0x13d3, 0x3375), .driver_info = BTUSB_ATH3012 }, | 113 | { USB_DEVICE(0x13d3, 0x3375), .driver_info = BTUSB_ATH3012 }, |
114 | { USB_DEVICE(0x04ca, 0x3004), .driver_info = BTUSB_ATH3012 }, | ||
111 | { USB_DEVICE(0x04ca, 0x3005), .driver_info = BTUSB_ATH3012 }, | 115 | { USB_DEVICE(0x04ca, 0x3005), .driver_info = BTUSB_ATH3012 }, |
112 | { USB_DEVICE(0x04ca, 0x3006), .driver_info = BTUSB_ATH3012 }, | 116 | { USB_DEVICE(0x04ca, 0x3006), .driver_info = BTUSB_ATH3012 }, |
113 | { USB_DEVICE(0x04ca, 0x3008), .driver_info = BTUSB_ATH3012 }, | 117 | { USB_DEVICE(0x04ca, 0x3008), .driver_info = BTUSB_ATH3012 }, |
diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c index 7e351e345476..e547851870e7 100644 --- a/drivers/bluetooth/btusb.c +++ b/drivers/bluetooth/btusb.c | |||
@@ -132,8 +132,10 @@ static struct usb_device_id blacklist_table[] = { | |||
132 | 132 | ||
133 | /* Atheros 3012 with sflash firmware */ | 133 | /* Atheros 3012 with sflash firmware */ |
134 | { USB_DEVICE(0x0cf3, 0x3004), .driver_info = BTUSB_ATH3012 }, | 134 | { USB_DEVICE(0x0cf3, 0x3004), .driver_info = BTUSB_ATH3012 }, |
135 | { USB_DEVICE(0x0cf3, 0x3008), .driver_info = BTUSB_ATH3012 }, | ||
135 | { USB_DEVICE(0x0cf3, 0x311d), .driver_info = BTUSB_ATH3012 }, | 136 | { USB_DEVICE(0x0cf3, 0x311d), .driver_info = BTUSB_ATH3012 }, |
136 | { USB_DEVICE(0x13d3, 0x3375), .driver_info = BTUSB_ATH3012 }, | 137 | { USB_DEVICE(0x13d3, 0x3375), .driver_info = BTUSB_ATH3012 }, |
138 | { USB_DEVICE(0x04ca, 0x3004), .driver_info = BTUSB_ATH3012 }, | ||
137 | { USB_DEVICE(0x04ca, 0x3005), .driver_info = BTUSB_ATH3012 }, | 139 | { USB_DEVICE(0x04ca, 0x3005), .driver_info = BTUSB_ATH3012 }, |
138 | { USB_DEVICE(0x04ca, 0x3006), .driver_info = BTUSB_ATH3012 }, | 140 | { USB_DEVICE(0x04ca, 0x3006), .driver_info = BTUSB_ATH3012 }, |
139 | { USB_DEVICE(0x04ca, 0x3008), .driver_info = BTUSB_ATH3012 }, | 141 | { USB_DEVICE(0x04ca, 0x3008), .driver_info = BTUSB_ATH3012 }, |
diff --git a/drivers/bus/Kconfig b/drivers/bus/Kconfig index 0f51ed687dc8..b05ecab915c4 100644 --- a/drivers/bus/Kconfig +++ b/drivers/bus/Kconfig | |||
@@ -4,6 +4,13 @@ | |||
4 | 4 | ||
5 | menu "Bus devices" | 5 | menu "Bus devices" |
6 | 6 | ||
7 | config MVEBU_MBUS | ||
8 | bool | ||
9 | depends on PLAT_ORION | ||
10 | help | ||
11 | Driver needed for the MBus configuration on Marvell EBU SoCs | ||
12 | (Kirkwood, Dove, Orion5x, MV78XX0 and Armada 370/XP). | ||
13 | |||
7 | config OMAP_OCP2SCP | 14 | config OMAP_OCP2SCP |
8 | tristate "OMAP OCP2SCP DRIVER" | 15 | tristate "OMAP OCP2SCP DRIVER" |
9 | depends on ARCH_OMAP2PLUS | 16 | depends on ARCH_OMAP2PLUS |
diff --git a/drivers/bus/Makefile b/drivers/bus/Makefile index 45d997c85453..3c7b53c12091 100644 --- a/drivers/bus/Makefile +++ b/drivers/bus/Makefile | |||
@@ -2,6 +2,7 @@ | |||
2 | # Makefile for the bus drivers. | 2 | # Makefile for the bus drivers. |
3 | # | 3 | # |
4 | 4 | ||
5 | obj-$(CONFIG_MVEBU_MBUS) += mvebu-mbus.o | ||
5 | obj-$(CONFIG_OMAP_OCP2SCP) += omap-ocp2scp.o | 6 | obj-$(CONFIG_OMAP_OCP2SCP) += omap-ocp2scp.o |
6 | 7 | ||
7 | # Interconnect bus driver for OMAP SoCs. | 8 | # Interconnect bus driver for OMAP SoCs. |
diff --git a/drivers/bus/mvebu-mbus.c b/drivers/bus/mvebu-mbus.c new file mode 100644 index 000000000000..8740f46b4d0d --- /dev/null +++ b/drivers/bus/mvebu-mbus.c | |||
@@ -0,0 +1,870 @@ | |||
1 | /* | ||
2 | * Address map functions for Marvell EBU SoCs (Kirkwood, Armada | ||
3 | * 370/XP, Dove, Orion5x and MV78xx0) | ||
4 | * | ||
5 | * This file is licensed under the terms of the GNU General Public | ||
6 | * License version 2. This program is licensed "as is" without any | ||
7 | * warranty of any kind, whether express or implied. | ||
8 | * | ||
9 | * The Marvell EBU SoCs have a configurable physical address space: | ||
10 | * the physical address at which certain devices (PCIe, NOR, NAND, | ||
11 | * etc.) sit can be configured. The configuration takes place through | ||
12 | * two sets of registers: | ||
13 | * | ||
14 | * - One to configure the access of the CPU to the devices. Depending | ||
15 | * on the families, there are between 8 and 20 configurable windows, | ||
16 | * each can be use to create a physical memory window that maps to a | ||
17 | * specific device. Devices are identified by a tuple (target, | ||
18 | * attribute). | ||
19 | * | ||
20 | * - One to configure the access to the CPU to the SDRAM. There are | ||
21 | * either 2 (for Dove) or 4 (for other families) windows to map the | ||
22 | * SDRAM into the physical address space. | ||
23 | * | ||
24 | * This driver: | ||
25 | * | ||
26 | * - Reads out the SDRAM address decoding windows at initialization | ||
27 | * time, and fills the mvebu_mbus_dram_info structure with these | ||
28 | * informations. The exported function mv_mbus_dram_info() allow | ||
29 | * device drivers to get those informations related to the SDRAM | ||
30 | * address decoding windows. This is because devices also have their | ||
31 | * own windows (configured through registers that are part of each | ||
32 | * device register space), and therefore the drivers for Marvell | ||
33 | * devices have to configure those device -> SDRAM windows to ensure | ||
34 | * that DMA works properly. | ||
35 | * | ||
36 | * - Provides an API for platform code or device drivers to | ||
37 | * dynamically add or remove address decoding windows for the CPU -> | ||
38 | * device accesses. This API is mvebu_mbus_add_window(), | ||
39 | * mvebu_mbus_add_window_remap_flags() and | ||
40 | * mvebu_mbus_del_window(). Since the (target, attribute) values | ||
41 | * differ from one SoC family to another, the API uses a 'const char | ||
42 | * *' string to identify devices, and this driver is responsible for | ||
43 | * knowing the mapping between the name of a device and its | ||
44 | * corresponding (target, attribute) in the current SoC family. | ||
45 | * | ||
46 | * - Provides a debugfs interface in /sys/kernel/debug/mvebu-mbus/ to | ||
47 | * see the list of CPU -> SDRAM windows and their configuration | ||
48 | * (file 'sdram') and the list of CPU -> devices windows and their | ||
49 | * configuration (file 'devices'). | ||
50 | */ | ||
51 | |||
52 | #include <linux/kernel.h> | ||
53 | #include <linux/module.h> | ||
54 | #include <linux/init.h> | ||
55 | #include <linux/mbus.h> | ||
56 | #include <linux/io.h> | ||
57 | #include <linux/ioport.h> | ||
58 | #include <linux/of.h> | ||
59 | #include <linux/of_address.h> | ||
60 | #include <linux/debugfs.h> | ||
61 | |||
62 | /* | ||
63 | * DDR target is the same on all platforms. | ||
64 | */ | ||
65 | #define TARGET_DDR 0 | ||
66 | |||
67 | /* | ||
68 | * CPU Address Decode Windows registers | ||
69 | */ | ||
70 | #define WIN_CTRL_OFF 0x0000 | ||
71 | #define WIN_CTRL_ENABLE BIT(0) | ||
72 | #define WIN_CTRL_TGT_MASK 0xf0 | ||
73 | #define WIN_CTRL_TGT_SHIFT 4 | ||
74 | #define WIN_CTRL_ATTR_MASK 0xff00 | ||
75 | #define WIN_CTRL_ATTR_SHIFT 8 | ||
76 | #define WIN_CTRL_SIZE_MASK 0xffff0000 | ||
77 | #define WIN_CTRL_SIZE_SHIFT 16 | ||
78 | #define WIN_BASE_OFF 0x0004 | ||
79 | #define WIN_BASE_LOW 0xffff0000 | ||
80 | #define WIN_BASE_HIGH 0xf | ||
81 | #define WIN_REMAP_LO_OFF 0x0008 | ||
82 | #define WIN_REMAP_LOW 0xffff0000 | ||
83 | #define WIN_REMAP_HI_OFF 0x000c | ||
84 | |||
85 | #define ATTR_HW_COHERENCY (0x1 << 4) | ||
86 | |||
87 | #define DDR_BASE_CS_OFF(n) (0x0000 + ((n) << 3)) | ||
88 | #define DDR_BASE_CS_HIGH_MASK 0xf | ||
89 | #define DDR_BASE_CS_LOW_MASK 0xff000000 | ||
90 | #define DDR_SIZE_CS_OFF(n) (0x0004 + ((n) << 3)) | ||
91 | #define DDR_SIZE_ENABLED BIT(0) | ||
92 | #define DDR_SIZE_CS_MASK 0x1c | ||
93 | #define DDR_SIZE_CS_SHIFT 2 | ||
94 | #define DDR_SIZE_MASK 0xff000000 | ||
95 | |||
96 | #define DOVE_DDR_BASE_CS_OFF(n) ((n) << 4) | ||
97 | |||
98 | struct mvebu_mbus_mapping { | ||
99 | const char *name; | ||
100 | u8 target; | ||
101 | u8 attr; | ||
102 | u8 attrmask; | ||
103 | }; | ||
104 | |||
105 | /* | ||
106 | * Masks used for the 'attrmask' field of mvebu_mbus_mapping. They | ||
107 | * allow to get the real attribute value, discarding the special bits | ||
108 | * used to select a PCI MEM region or a PCI WA region. This allows the | ||
109 | * debugfs code to reverse-match the name of a device from its | ||
110 | * target/attr values. | ||
111 | * | ||
112 | * For all devices except PCI, all bits of 'attr' must be | ||
113 | * considered. For most SoCs, only bit 3 should be ignored (it allows | ||
114 | * to select between PCI MEM and PCI I/O). On Orion5x however, there | ||
115 | * is the special bit 5 to select a PCI WA region. | ||
116 | */ | ||
117 | #define MAPDEF_NOMASK 0xff | ||
118 | #define MAPDEF_PCIMASK 0xf7 | ||
119 | #define MAPDEF_ORIONPCIMASK 0xd7 | ||
120 | |||
121 | /* Macro used to define one mvebu_mbus_mapping entry */ | ||
122 | #define MAPDEF(__n, __t, __a, __m) \ | ||
123 | { .name = __n, .target = __t, .attr = __a, .attrmask = __m } | ||
124 | |||
125 | struct mvebu_mbus_state; | ||
126 | |||
127 | struct mvebu_mbus_soc_data { | ||
128 | unsigned int num_wins; | ||
129 | unsigned int num_remappable_wins; | ||
130 | unsigned int (*win_cfg_offset)(const int win); | ||
131 | void (*setup_cpu_target)(struct mvebu_mbus_state *s); | ||
132 | int (*show_cpu_target)(struct mvebu_mbus_state *s, | ||
133 | struct seq_file *seq, void *v); | ||
134 | const struct mvebu_mbus_mapping *map; | ||
135 | }; | ||
136 | |||
137 | struct mvebu_mbus_state { | ||
138 | void __iomem *mbuswins_base; | ||
139 | void __iomem *sdramwins_base; | ||
140 | struct dentry *debugfs_root; | ||
141 | struct dentry *debugfs_sdram; | ||
142 | struct dentry *debugfs_devs; | ||
143 | const struct mvebu_mbus_soc_data *soc; | ||
144 | int hw_io_coherency; | ||
145 | }; | ||
146 | |||
147 | static struct mvebu_mbus_state mbus_state; | ||
148 | |||
149 | static struct mbus_dram_target_info mvebu_mbus_dram_info; | ||
150 | const struct mbus_dram_target_info *mv_mbus_dram_info(void) | ||
151 | { | ||
152 | return &mvebu_mbus_dram_info; | ||
153 | } | ||
154 | EXPORT_SYMBOL_GPL(mv_mbus_dram_info); | ||
155 | |||
156 | /* | ||
157 | * Functions to manipulate the address decoding windows | ||
158 | */ | ||
159 | |||
160 | static void mvebu_mbus_read_window(struct mvebu_mbus_state *mbus, | ||
161 | int win, int *enabled, u64 *base, | ||
162 | u32 *size, u8 *target, u8 *attr, | ||
163 | u64 *remap) | ||
164 | { | ||
165 | void __iomem *addr = mbus->mbuswins_base + | ||
166 | mbus->soc->win_cfg_offset(win); | ||
167 | u32 basereg = readl(addr + WIN_BASE_OFF); | ||
168 | u32 ctrlreg = readl(addr + WIN_CTRL_OFF); | ||
169 | |||
170 | if (!(ctrlreg & WIN_CTRL_ENABLE)) { | ||
171 | *enabled = 0; | ||
172 | return; | ||
173 | } | ||
174 | |||
175 | *enabled = 1; | ||
176 | *base = ((u64)basereg & WIN_BASE_HIGH) << 32; | ||
177 | *base |= (basereg & WIN_BASE_LOW); | ||
178 | *size = (ctrlreg | ~WIN_CTRL_SIZE_MASK) + 1; | ||
179 | |||
180 | if (target) | ||
181 | *target = (ctrlreg & WIN_CTRL_TGT_MASK) >> WIN_CTRL_TGT_SHIFT; | ||
182 | |||
183 | if (attr) | ||
184 | *attr = (ctrlreg & WIN_CTRL_ATTR_MASK) >> WIN_CTRL_ATTR_SHIFT; | ||
185 | |||
186 | if (remap) { | ||
187 | if (win < mbus->soc->num_remappable_wins) { | ||
188 | u32 remap_low = readl(addr + WIN_REMAP_LO_OFF); | ||
189 | u32 remap_hi = readl(addr + WIN_REMAP_HI_OFF); | ||
190 | *remap = ((u64)remap_hi << 32) | remap_low; | ||
191 | } else | ||
192 | *remap = 0; | ||
193 | } | ||
194 | } | ||
195 | |||
196 | static void mvebu_mbus_disable_window(struct mvebu_mbus_state *mbus, | ||
197 | int win) | ||
198 | { | ||
199 | void __iomem *addr; | ||
200 | |||
201 | addr = mbus->mbuswins_base + mbus->soc->win_cfg_offset(win); | ||
202 | |||
203 | writel(0, addr + WIN_BASE_OFF); | ||
204 | writel(0, addr + WIN_CTRL_OFF); | ||
205 | if (win < mbus->soc->num_remappable_wins) { | ||
206 | writel(0, addr + WIN_REMAP_LO_OFF); | ||
207 | writel(0, addr + WIN_REMAP_HI_OFF); | ||
208 | } | ||
209 | } | ||
210 | |||
211 | /* Checks whether the given window number is available */ | ||
212 | static int mvebu_mbus_window_is_free(struct mvebu_mbus_state *mbus, | ||
213 | const int win) | ||
214 | { | ||
215 | void __iomem *addr = mbus->mbuswins_base + | ||
216 | mbus->soc->win_cfg_offset(win); | ||
217 | u32 ctrl = readl(addr + WIN_CTRL_OFF); | ||
218 | return !(ctrl & WIN_CTRL_ENABLE); | ||
219 | } | ||
220 | |||
221 | /* | ||
222 | * Checks whether the given (base, base+size) area doesn't overlap an | ||
223 | * existing region | ||
224 | */ | ||
225 | static int mvebu_mbus_window_conflicts(struct mvebu_mbus_state *mbus, | ||
226 | phys_addr_t base, size_t size, | ||
227 | u8 target, u8 attr) | ||
228 | { | ||
229 | u64 end = (u64)base + size; | ||
230 | int win; | ||
231 | |||
232 | for (win = 0; win < mbus->soc->num_wins; win++) { | ||
233 | u64 wbase, wend; | ||
234 | u32 wsize; | ||
235 | u8 wtarget, wattr; | ||
236 | int enabled; | ||
237 | |||
238 | mvebu_mbus_read_window(mbus, win, | ||
239 | &enabled, &wbase, &wsize, | ||
240 | &wtarget, &wattr, NULL); | ||
241 | |||
242 | if (!enabled) | ||
243 | continue; | ||
244 | |||
245 | wend = wbase + wsize; | ||
246 | |||
247 | /* | ||
248 | * Check if the current window overlaps with the | ||
249 | * proposed physical range | ||
250 | */ | ||
251 | if ((u64)base < wend && end > wbase) | ||
252 | return 0; | ||
253 | |||
254 | /* | ||
255 | * Check if target/attribute conflicts | ||
256 | */ | ||
257 | if (target == wtarget && attr == wattr) | ||
258 | return 0; | ||
259 | } | ||
260 | |||
261 | return 1; | ||
262 | } | ||
263 | |||
264 | static int mvebu_mbus_find_window(struct mvebu_mbus_state *mbus, | ||
265 | phys_addr_t base, size_t size) | ||
266 | { | ||
267 | int win; | ||
268 | |||
269 | for (win = 0; win < mbus->soc->num_wins; win++) { | ||
270 | u64 wbase; | ||
271 | u32 wsize; | ||
272 | int enabled; | ||
273 | |||
274 | mvebu_mbus_read_window(mbus, win, | ||
275 | &enabled, &wbase, &wsize, | ||
276 | NULL, NULL, NULL); | ||
277 | |||
278 | if (!enabled) | ||
279 | continue; | ||
280 | |||
281 | if (base == wbase && size == wsize) | ||
282 | return win; | ||
283 | } | ||
284 | |||
285 | return -ENODEV; | ||
286 | } | ||
287 | |||
288 | static int mvebu_mbus_setup_window(struct mvebu_mbus_state *mbus, | ||
289 | int win, phys_addr_t base, size_t size, | ||
290 | phys_addr_t remap, u8 target, | ||
291 | u8 attr) | ||
292 | { | ||
293 | void __iomem *addr = mbus->mbuswins_base + | ||
294 | mbus->soc->win_cfg_offset(win); | ||
295 | u32 ctrl, remap_addr; | ||
296 | |||
297 | ctrl = ((size - 1) & WIN_CTRL_SIZE_MASK) | | ||
298 | (attr << WIN_CTRL_ATTR_SHIFT) | | ||
299 | (target << WIN_CTRL_TGT_SHIFT) | | ||
300 | WIN_CTRL_ENABLE; | ||
301 | |||
302 | writel(base & WIN_BASE_LOW, addr + WIN_BASE_OFF); | ||
303 | writel(ctrl, addr + WIN_CTRL_OFF); | ||
304 | if (win < mbus->soc->num_remappable_wins) { | ||
305 | if (remap == MVEBU_MBUS_NO_REMAP) | ||
306 | remap_addr = base; | ||
307 | else | ||
308 | remap_addr = remap; | ||
309 | writel(remap_addr & WIN_REMAP_LOW, addr + WIN_REMAP_LO_OFF); | ||
310 | writel(0, addr + WIN_REMAP_HI_OFF); | ||
311 | } | ||
312 | |||
313 | return 0; | ||
314 | } | ||
315 | |||
316 | static int mvebu_mbus_alloc_window(struct mvebu_mbus_state *mbus, | ||
317 | phys_addr_t base, size_t size, | ||
318 | phys_addr_t remap, u8 target, | ||
319 | u8 attr) | ||
320 | { | ||
321 | int win; | ||
322 | |||
323 | if (remap == MVEBU_MBUS_NO_REMAP) { | ||
324 | for (win = mbus->soc->num_remappable_wins; | ||
325 | win < mbus->soc->num_wins; win++) | ||
326 | if (mvebu_mbus_window_is_free(mbus, win)) | ||
327 | return mvebu_mbus_setup_window(mbus, win, base, | ||
328 | size, remap, | ||
329 | target, attr); | ||
330 | } | ||
331 | |||
332 | |||
333 | for (win = 0; win < mbus->soc->num_wins; win++) | ||
334 | if (mvebu_mbus_window_is_free(mbus, win)) | ||
335 | return mvebu_mbus_setup_window(mbus, win, base, size, | ||
336 | remap, target, attr); | ||
337 | |||
338 | return -ENOMEM; | ||
339 | } | ||
340 | |||
341 | /* | ||
342 | * Debugfs debugging | ||
343 | */ | ||
344 | |||
345 | /* Common function used for Dove, Kirkwood, Armada 370/XP and Orion 5x */ | ||
346 | static int mvebu_sdram_debug_show_orion(struct mvebu_mbus_state *mbus, | ||
347 | struct seq_file *seq, void *v) | ||
348 | { | ||
349 | int i; | ||
350 | |||
351 | for (i = 0; i < 4; i++) { | ||
352 | u32 basereg = readl(mbus->sdramwins_base + DDR_BASE_CS_OFF(i)); | ||
353 | u32 sizereg = readl(mbus->sdramwins_base + DDR_SIZE_CS_OFF(i)); | ||
354 | u64 base; | ||
355 | u32 size; | ||
356 | |||
357 | if (!(sizereg & DDR_SIZE_ENABLED)) { | ||
358 | seq_printf(seq, "[%d] disabled\n", i); | ||
359 | continue; | ||
360 | } | ||
361 | |||
362 | base = ((u64)basereg & DDR_BASE_CS_HIGH_MASK) << 32; | ||
363 | base |= basereg & DDR_BASE_CS_LOW_MASK; | ||
364 | size = (sizereg | ~DDR_SIZE_MASK); | ||
365 | |||
366 | seq_printf(seq, "[%d] %016llx - %016llx : cs%d\n", | ||
367 | i, (unsigned long long)base, | ||
368 | (unsigned long long)base + size + 1, | ||
369 | (sizereg & DDR_SIZE_CS_MASK) >> DDR_SIZE_CS_SHIFT); | ||
370 | } | ||
371 | |||
372 | return 0; | ||
373 | } | ||
374 | |||
375 | /* Special function for Dove */ | ||
376 | static int mvebu_sdram_debug_show_dove(struct mvebu_mbus_state *mbus, | ||
377 | struct seq_file *seq, void *v) | ||
378 | { | ||
379 | int i; | ||
380 | |||
381 | for (i = 0; i < 2; i++) { | ||
382 | u32 map = readl(mbus->sdramwins_base + DOVE_DDR_BASE_CS_OFF(i)); | ||
383 | u64 base; | ||
384 | u32 size; | ||
385 | |||
386 | if (!(map & 1)) { | ||
387 | seq_printf(seq, "[%d] disabled\n", i); | ||
388 | continue; | ||
389 | } | ||
390 | |||
391 | base = map & 0xff800000; | ||
392 | size = 0x100000 << (((map & 0x000f0000) >> 16) - 4); | ||
393 | |||
394 | seq_printf(seq, "[%d] %016llx - %016llx : cs%d\n", | ||
395 | i, (unsigned long long)base, | ||
396 | (unsigned long long)base + size, i); | ||
397 | } | ||
398 | |||
399 | return 0; | ||
400 | } | ||
401 | |||
402 | static int mvebu_sdram_debug_show(struct seq_file *seq, void *v) | ||
403 | { | ||
404 | struct mvebu_mbus_state *mbus = &mbus_state; | ||
405 | return mbus->soc->show_cpu_target(mbus, seq, v); | ||
406 | } | ||
407 | |||
408 | static int mvebu_sdram_debug_open(struct inode *inode, struct file *file) | ||
409 | { | ||
410 | return single_open(file, mvebu_sdram_debug_show, inode->i_private); | ||
411 | } | ||
412 | |||
413 | static const struct file_operations mvebu_sdram_debug_fops = { | ||
414 | .open = mvebu_sdram_debug_open, | ||
415 | .read = seq_read, | ||
416 | .llseek = seq_lseek, | ||
417 | .release = single_release, | ||
418 | }; | ||
419 | |||
420 | static int mvebu_devs_debug_show(struct seq_file *seq, void *v) | ||
421 | { | ||
422 | struct mvebu_mbus_state *mbus = &mbus_state; | ||
423 | int win; | ||
424 | |||
425 | for (win = 0; win < mbus->soc->num_wins; win++) { | ||
426 | u64 wbase, wremap; | ||
427 | u32 wsize; | ||
428 | u8 wtarget, wattr; | ||
429 | int enabled, i; | ||
430 | const char *name; | ||
431 | |||
432 | mvebu_mbus_read_window(mbus, win, | ||
433 | &enabled, &wbase, &wsize, | ||
434 | &wtarget, &wattr, &wremap); | ||
435 | |||
436 | if (!enabled) { | ||
437 | seq_printf(seq, "[%02d] disabled\n", win); | ||
438 | continue; | ||
439 | } | ||
440 | |||
441 | |||
442 | for (i = 0; mbus->soc->map[i].name; i++) | ||
443 | if (mbus->soc->map[i].target == wtarget && | ||
444 | mbus->soc->map[i].attr == | ||
445 | (wattr & mbus->soc->map[i].attrmask)) | ||
446 | break; | ||
447 | |||
448 | name = mbus->soc->map[i].name ?: "unknown"; | ||
449 | |||
450 | seq_printf(seq, "[%02d] %016llx - %016llx : %s", | ||
451 | win, (unsigned long long)wbase, | ||
452 | (unsigned long long)(wbase + wsize), name); | ||
453 | |||
454 | if (win < mbus->soc->num_remappable_wins) { | ||
455 | seq_printf(seq, " (remap %016llx)\n", | ||
456 | (unsigned long long)wremap); | ||
457 | } else | ||
458 | seq_printf(seq, "\n"); | ||
459 | } | ||
460 | |||
461 | return 0; | ||
462 | } | ||
463 | |||
464 | static int mvebu_devs_debug_open(struct inode *inode, struct file *file) | ||
465 | { | ||
466 | return single_open(file, mvebu_devs_debug_show, inode->i_private); | ||
467 | } | ||
468 | |||
469 | static const struct file_operations mvebu_devs_debug_fops = { | ||
470 | .open = mvebu_devs_debug_open, | ||
471 | .read = seq_read, | ||
472 | .llseek = seq_lseek, | ||
473 | .release = single_release, | ||
474 | }; | ||
475 | |||
476 | /* | ||
477 | * SoC-specific functions and definitions | ||
478 | */ | ||
479 | |||
480 | static unsigned int orion_mbus_win_offset(int win) | ||
481 | { | ||
482 | return win << 4; | ||
483 | } | ||
484 | |||
485 | static unsigned int armada_370_xp_mbus_win_offset(int win) | ||
486 | { | ||
487 | /* The register layout is a bit annoying and the below code | ||
488 | * tries to cope with it. | ||
489 | * - At offset 0x0, there are the registers for the first 8 | ||
490 | * windows, with 4 registers of 32 bits per window (ctrl, | ||
491 | * base, remap low, remap high) | ||
492 | * - Then at offset 0x80, there is a hole of 0x10 bytes for | ||
493 | * the internal registers base address and internal units | ||
494 | * sync barrier register. | ||
495 | * - Then at offset 0x90, there the registers for 12 | ||
496 | * windows, with only 2 registers of 32 bits per window | ||
497 | * (ctrl, base). | ||
498 | */ | ||
499 | if (win < 8) | ||
500 | return win << 4; | ||
501 | else | ||
502 | return 0x90 + ((win - 8) << 3); | ||
503 | } | ||
504 | |||
505 | static unsigned int mv78xx0_mbus_win_offset(int win) | ||
506 | { | ||
507 | if (win < 8) | ||
508 | return win << 4; | ||
509 | else | ||
510 | return 0x900 + ((win - 8) << 4); | ||
511 | } | ||
512 | |||
513 | static void __init | ||
514 | mvebu_mbus_default_setup_cpu_target(struct mvebu_mbus_state *mbus) | ||
515 | { | ||
516 | int i; | ||
517 | int cs; | ||
518 | |||
519 | mvebu_mbus_dram_info.mbus_dram_target_id = TARGET_DDR; | ||
520 | |||
521 | for (i = 0, cs = 0; i < 4; i++) { | ||
522 | u32 base = readl(mbus->sdramwins_base + DDR_BASE_CS_OFF(i)); | ||
523 | u32 size = readl(mbus->sdramwins_base + DDR_SIZE_CS_OFF(i)); | ||
524 | |||
525 | /* | ||
526 | * We only take care of entries for which the chip | ||
527 | * select is enabled, and that don't have high base | ||
528 | * address bits set (devices can only access the first | ||
529 | * 32 bits of the memory). | ||
530 | */ | ||
531 | if ((size & DDR_SIZE_ENABLED) && | ||
532 | !(base & DDR_BASE_CS_HIGH_MASK)) { | ||
533 | struct mbus_dram_window *w; | ||
534 | |||
535 | w = &mvebu_mbus_dram_info.cs[cs++]; | ||
536 | w->cs_index = i; | ||
537 | w->mbus_attr = 0xf & ~(1 << i); | ||
538 | if (mbus->hw_io_coherency) | ||
539 | w->mbus_attr |= ATTR_HW_COHERENCY; | ||
540 | w->base = base & DDR_BASE_CS_LOW_MASK; | ||
541 | w->size = (size | ~DDR_SIZE_MASK) + 1; | ||
542 | } | ||
543 | } | ||
544 | mvebu_mbus_dram_info.num_cs = cs; | ||
545 | } | ||
546 | |||
547 | static void __init | ||
548 | mvebu_mbus_dove_setup_cpu_target(struct mvebu_mbus_state *mbus) | ||
549 | { | ||
550 | int i; | ||
551 | int cs; | ||
552 | |||
553 | mvebu_mbus_dram_info.mbus_dram_target_id = TARGET_DDR; | ||
554 | |||
555 | for (i = 0, cs = 0; i < 2; i++) { | ||
556 | u32 map = readl(mbus->sdramwins_base + DOVE_DDR_BASE_CS_OFF(i)); | ||
557 | |||
558 | /* | ||
559 | * Chip select enabled? | ||
560 | */ | ||
561 | if (map & 1) { | ||
562 | struct mbus_dram_window *w; | ||
563 | |||
564 | w = &mvebu_mbus_dram_info.cs[cs++]; | ||
565 | w->cs_index = i; | ||
566 | w->mbus_attr = 0; /* CS address decoding done inside */ | ||
567 | /* the DDR controller, no need to */ | ||
568 | /* provide attributes */ | ||
569 | w->base = map & 0xff800000; | ||
570 | w->size = 0x100000 << (((map & 0x000f0000) >> 16) - 4); | ||
571 | } | ||
572 | } | ||
573 | |||
574 | mvebu_mbus_dram_info.num_cs = cs; | ||
575 | } | ||
576 | |||
577 | static const struct mvebu_mbus_mapping armada_370_map[] = { | ||
578 | MAPDEF("bootrom", 1, 0xe0, MAPDEF_NOMASK), | ||
579 | MAPDEF("devbus-boot", 1, 0x2f, MAPDEF_NOMASK), | ||
580 | MAPDEF("devbus-cs0", 1, 0x3e, MAPDEF_NOMASK), | ||
581 | MAPDEF("devbus-cs1", 1, 0x3d, MAPDEF_NOMASK), | ||
582 | MAPDEF("devbus-cs2", 1, 0x3b, MAPDEF_NOMASK), | ||
583 | MAPDEF("devbus-cs3", 1, 0x37, MAPDEF_NOMASK), | ||
584 | MAPDEF("pcie0.0", 4, 0xe0, MAPDEF_PCIMASK), | ||
585 | MAPDEF("pcie1.0", 8, 0xe0, MAPDEF_PCIMASK), | ||
586 | {}, | ||
587 | }; | ||
588 | |||
589 | static const struct mvebu_mbus_soc_data armada_370_mbus_data = { | ||
590 | .num_wins = 20, | ||
591 | .num_remappable_wins = 8, | ||
592 | .win_cfg_offset = armada_370_xp_mbus_win_offset, | ||
593 | .setup_cpu_target = mvebu_mbus_default_setup_cpu_target, | ||
594 | .show_cpu_target = mvebu_sdram_debug_show_orion, | ||
595 | .map = armada_370_map, | ||
596 | }; | ||
597 | |||
598 | static const struct mvebu_mbus_mapping armada_xp_map[] = { | ||
599 | MAPDEF("bootrom", 1, 0x1d, MAPDEF_NOMASK), | ||
600 | MAPDEF("devbus-boot", 1, 0x2f, MAPDEF_NOMASK), | ||
601 | MAPDEF("devbus-cs0", 1, 0x3e, MAPDEF_NOMASK), | ||
602 | MAPDEF("devbus-cs1", 1, 0x3d, MAPDEF_NOMASK), | ||
603 | MAPDEF("devbus-cs2", 1, 0x3b, MAPDEF_NOMASK), | ||
604 | MAPDEF("devbus-cs3", 1, 0x37, MAPDEF_NOMASK), | ||
605 | MAPDEF("pcie0.0", 4, 0xe0, MAPDEF_PCIMASK), | ||
606 | MAPDEF("pcie0.1", 4, 0xd0, MAPDEF_PCIMASK), | ||
607 | MAPDEF("pcie0.2", 4, 0xb0, MAPDEF_PCIMASK), | ||
608 | MAPDEF("pcie0.3", 4, 0x70, MAPDEF_PCIMASK), | ||
609 | MAPDEF("pcie1.0", 8, 0xe0, MAPDEF_PCIMASK), | ||
610 | MAPDEF("pcie1.1", 8, 0xd0, MAPDEF_PCIMASK), | ||
611 | MAPDEF("pcie1.2", 8, 0xb0, MAPDEF_PCIMASK), | ||
612 | MAPDEF("pcie1.3", 8, 0x70, MAPDEF_PCIMASK), | ||
613 | MAPDEF("pcie2.0", 4, 0xf0, MAPDEF_PCIMASK), | ||
614 | MAPDEF("pcie3.0", 8, 0xf0, MAPDEF_PCIMASK), | ||
615 | {}, | ||
616 | }; | ||
617 | |||
618 | static const struct mvebu_mbus_soc_data armada_xp_mbus_data = { | ||
619 | .num_wins = 20, | ||
620 | .num_remappable_wins = 8, | ||
621 | .win_cfg_offset = armada_370_xp_mbus_win_offset, | ||
622 | .setup_cpu_target = mvebu_mbus_default_setup_cpu_target, | ||
623 | .show_cpu_target = mvebu_sdram_debug_show_orion, | ||
624 | .map = armada_xp_map, | ||
625 | }; | ||
626 | |||
627 | static const struct mvebu_mbus_mapping kirkwood_map[] = { | ||
628 | MAPDEF("pcie0.0", 4, 0xe0, MAPDEF_PCIMASK), | ||
629 | MAPDEF("pcie1.0", 4, 0xd0, MAPDEF_PCIMASK), | ||
630 | MAPDEF("sram", 3, 0x01, MAPDEF_NOMASK), | ||
631 | MAPDEF("nand", 1, 0x2f, MAPDEF_NOMASK), | ||
632 | {}, | ||
633 | }; | ||
634 | |||
635 | static const struct mvebu_mbus_soc_data kirkwood_mbus_data = { | ||
636 | .num_wins = 8, | ||
637 | .num_remappable_wins = 4, | ||
638 | .win_cfg_offset = orion_mbus_win_offset, | ||
639 | .setup_cpu_target = mvebu_mbus_default_setup_cpu_target, | ||
640 | .show_cpu_target = mvebu_sdram_debug_show_orion, | ||
641 | .map = kirkwood_map, | ||
642 | }; | ||
643 | |||
644 | static const struct mvebu_mbus_mapping dove_map[] = { | ||
645 | MAPDEF("pcie0.0", 0x4, 0xe0, MAPDEF_PCIMASK), | ||
646 | MAPDEF("pcie1.0", 0x8, 0xe0, MAPDEF_PCIMASK), | ||
647 | MAPDEF("cesa", 0x3, 0x01, MAPDEF_NOMASK), | ||
648 | MAPDEF("bootrom", 0x1, 0xfd, MAPDEF_NOMASK), | ||
649 | MAPDEF("scratchpad", 0xd, 0x0, MAPDEF_NOMASK), | ||
650 | {}, | ||
651 | }; | ||
652 | |||
653 | static const struct mvebu_mbus_soc_data dove_mbus_data = { | ||
654 | .num_wins = 8, | ||
655 | .num_remappable_wins = 4, | ||
656 | .win_cfg_offset = orion_mbus_win_offset, | ||
657 | .setup_cpu_target = mvebu_mbus_dove_setup_cpu_target, | ||
658 | .show_cpu_target = mvebu_sdram_debug_show_dove, | ||
659 | .map = dove_map, | ||
660 | }; | ||
661 | |||
662 | static const struct mvebu_mbus_mapping orion5x_map[] = { | ||
663 | MAPDEF("pcie0.0", 4, 0x51, MAPDEF_ORIONPCIMASK), | ||
664 | MAPDEF("pci0.0", 3, 0x51, MAPDEF_ORIONPCIMASK), | ||
665 | MAPDEF("devbus-boot", 1, 0x0f, MAPDEF_NOMASK), | ||
666 | MAPDEF("devbus-cs0", 1, 0x1e, MAPDEF_NOMASK), | ||
667 | MAPDEF("devbus-cs1", 1, 0x1d, MAPDEF_NOMASK), | ||
668 | MAPDEF("devbus-cs2", 1, 0x1b, MAPDEF_NOMASK), | ||
669 | MAPDEF("sram", 0, 0x00, MAPDEF_NOMASK), | ||
670 | {}, | ||
671 | }; | ||
672 | |||
673 | /* | ||
674 | * Some variants of Orion5x have 4 remappable windows, some other have | ||
675 | * only two of them. | ||
676 | */ | ||
677 | static const struct mvebu_mbus_soc_data orion5x_4win_mbus_data = { | ||
678 | .num_wins = 8, | ||
679 | .num_remappable_wins = 4, | ||
680 | .win_cfg_offset = orion_mbus_win_offset, | ||
681 | .setup_cpu_target = mvebu_mbus_default_setup_cpu_target, | ||
682 | .show_cpu_target = mvebu_sdram_debug_show_orion, | ||
683 | .map = orion5x_map, | ||
684 | }; | ||
685 | |||
686 | static const struct mvebu_mbus_soc_data orion5x_2win_mbus_data = { | ||
687 | .num_wins = 8, | ||
688 | .num_remappable_wins = 2, | ||
689 | .win_cfg_offset = orion_mbus_win_offset, | ||
690 | .setup_cpu_target = mvebu_mbus_default_setup_cpu_target, | ||
691 | .show_cpu_target = mvebu_sdram_debug_show_orion, | ||
692 | .map = orion5x_map, | ||
693 | }; | ||
694 | |||
695 | static const struct mvebu_mbus_mapping mv78xx0_map[] = { | ||
696 | MAPDEF("pcie0.0", 4, 0xe0, MAPDEF_PCIMASK), | ||
697 | MAPDEF("pcie0.1", 4, 0xd0, MAPDEF_PCIMASK), | ||
698 | MAPDEF("pcie0.2", 4, 0xb0, MAPDEF_PCIMASK), | ||
699 | MAPDEF("pcie0.3", 4, 0x70, MAPDEF_PCIMASK), | ||
700 | MAPDEF("pcie1.0", 8, 0xe0, MAPDEF_PCIMASK), | ||
701 | MAPDEF("pcie1.1", 8, 0xd0, MAPDEF_PCIMASK), | ||
702 | MAPDEF("pcie1.2", 8, 0xb0, MAPDEF_PCIMASK), | ||
703 | MAPDEF("pcie1.3", 8, 0x70, MAPDEF_PCIMASK), | ||
704 | MAPDEF("pcie2.0", 4, 0xf0, MAPDEF_PCIMASK), | ||
705 | MAPDEF("pcie3.0", 8, 0xf0, MAPDEF_PCIMASK), | ||
706 | {}, | ||
707 | }; | ||
708 | |||
709 | static const struct mvebu_mbus_soc_data mv78xx0_mbus_data = { | ||
710 | .num_wins = 14, | ||
711 | .num_remappable_wins = 8, | ||
712 | .win_cfg_offset = mv78xx0_mbus_win_offset, | ||
713 | .setup_cpu_target = mvebu_mbus_default_setup_cpu_target, | ||
714 | .show_cpu_target = mvebu_sdram_debug_show_orion, | ||
715 | .map = mv78xx0_map, | ||
716 | }; | ||
717 | |||
718 | /* | ||
719 | * The driver doesn't yet have a DT binding because the details of | ||
720 | * this DT binding still need to be sorted out. However, as a | ||
721 | * preparation, we already use of_device_id to match a SoC description | ||
722 | * string against the SoC specific details of this driver. | ||
723 | */ | ||
724 | static const struct of_device_id of_mvebu_mbus_ids[] = { | ||
725 | { .compatible = "marvell,armada370-mbus", | ||
726 | .data = &armada_370_mbus_data, }, | ||
727 | { .compatible = "marvell,armadaxp-mbus", | ||
728 | .data = &armada_xp_mbus_data, }, | ||
729 | { .compatible = "marvell,kirkwood-mbus", | ||
730 | .data = &kirkwood_mbus_data, }, | ||
731 | { .compatible = "marvell,dove-mbus", | ||
732 | .data = &dove_mbus_data, }, | ||
733 | { .compatible = "marvell,orion5x-88f5281-mbus", | ||
734 | .data = &orion5x_4win_mbus_data, }, | ||
735 | { .compatible = "marvell,orion5x-88f5182-mbus", | ||
736 | .data = &orion5x_2win_mbus_data, }, | ||
737 | { .compatible = "marvell,orion5x-88f5181-mbus", | ||
738 | .data = &orion5x_2win_mbus_data, }, | ||
739 | { .compatible = "marvell,orion5x-88f6183-mbus", | ||
740 | .data = &orion5x_4win_mbus_data, }, | ||
741 | { .compatible = "marvell,mv78xx0-mbus", | ||
742 | .data = &mv78xx0_mbus_data, }, | ||
743 | { }, | ||
744 | }; | ||
745 | |||
746 | /* | ||
747 | * Public API of the driver | ||
748 | */ | ||
749 | int mvebu_mbus_add_window_remap_flags(const char *devname, phys_addr_t base, | ||
750 | size_t size, phys_addr_t remap, | ||
751 | unsigned int flags) | ||
752 | { | ||
753 | struct mvebu_mbus_state *s = &mbus_state; | ||
754 | u8 target, attr; | ||
755 | int i; | ||
756 | |||
757 | if (!s->soc->map) | ||
758 | return -ENODEV; | ||
759 | |||
760 | for (i = 0; s->soc->map[i].name; i++) | ||
761 | if (!strcmp(s->soc->map[i].name, devname)) | ||
762 | break; | ||
763 | |||
764 | if (!s->soc->map[i].name) { | ||
765 | pr_err("mvebu-mbus: unknown device '%s'\n", devname); | ||
766 | return -ENODEV; | ||
767 | } | ||
768 | |||
769 | target = s->soc->map[i].target; | ||
770 | attr = s->soc->map[i].attr; | ||
771 | |||
772 | if (flags == MVEBU_MBUS_PCI_MEM) | ||
773 | attr |= 0x8; | ||
774 | else if (flags == MVEBU_MBUS_PCI_WA) | ||
775 | attr |= 0x28; | ||
776 | |||
777 | if (!mvebu_mbus_window_conflicts(s, base, size, target, attr)) { | ||
778 | pr_err("mvebu-mbus: cannot add window '%s', conflicts with another window\n", | ||
779 | devname); | ||
780 | return -EINVAL; | ||
781 | } | ||
782 | |||
783 | return mvebu_mbus_alloc_window(s, base, size, remap, target, attr); | ||
784 | |||
785 | } | ||
786 | |||
787 | int mvebu_mbus_add_window(const char *devname, phys_addr_t base, size_t size) | ||
788 | { | ||
789 | return mvebu_mbus_add_window_remap_flags(devname, base, size, | ||
790 | MVEBU_MBUS_NO_REMAP, 0); | ||
791 | } | ||
792 | |||
793 | int mvebu_mbus_del_window(phys_addr_t base, size_t size) | ||
794 | { | ||
795 | int win; | ||
796 | |||
797 | win = mvebu_mbus_find_window(&mbus_state, base, size); | ||
798 | if (win < 0) | ||
799 | return win; | ||
800 | |||
801 | mvebu_mbus_disable_window(&mbus_state, win); | ||
802 | return 0; | ||
803 | } | ||
804 | |||
805 | static __init int mvebu_mbus_debugfs_init(void) | ||
806 | { | ||
807 | struct mvebu_mbus_state *s = &mbus_state; | ||
808 | |||
809 | /* | ||
810 | * If no base has been initialized, doesn't make sense to | ||
811 | * register the debugfs entries. We may be on a multiplatform | ||
812 | * kernel that isn't running a Marvell EBU SoC. | ||
813 | */ | ||
814 | if (!s->mbuswins_base) | ||
815 | return 0; | ||
816 | |||
817 | s->debugfs_root = debugfs_create_dir("mvebu-mbus", NULL); | ||
818 | if (s->debugfs_root) { | ||
819 | s->debugfs_sdram = debugfs_create_file("sdram", S_IRUGO, | ||
820 | s->debugfs_root, NULL, | ||
821 | &mvebu_sdram_debug_fops); | ||
822 | s->debugfs_devs = debugfs_create_file("devices", S_IRUGO, | ||
823 | s->debugfs_root, NULL, | ||
824 | &mvebu_devs_debug_fops); | ||
825 | } | ||
826 | |||
827 | return 0; | ||
828 | } | ||
829 | fs_initcall(mvebu_mbus_debugfs_init); | ||
830 | |||
831 | int __init mvebu_mbus_init(const char *soc, phys_addr_t mbuswins_phys_base, | ||
832 | size_t mbuswins_size, | ||
833 | phys_addr_t sdramwins_phys_base, | ||
834 | size_t sdramwins_size) | ||
835 | { | ||
836 | struct mvebu_mbus_state *mbus = &mbus_state; | ||
837 | const struct of_device_id *of_id; | ||
838 | int win; | ||
839 | |||
840 | for (of_id = of_mvebu_mbus_ids; of_id->compatible; of_id++) | ||
841 | if (!strcmp(of_id->compatible, soc)) | ||
842 | break; | ||
843 | |||
844 | if (!of_id->compatible) { | ||
845 | pr_err("mvebu-mbus: could not find a matching SoC family\n"); | ||
846 | return -ENODEV; | ||
847 | } | ||
848 | |||
849 | mbus->soc = of_id->data; | ||
850 | |||
851 | mbus->mbuswins_base = ioremap(mbuswins_phys_base, mbuswins_size); | ||
852 | if (!mbus->mbuswins_base) | ||
853 | return -ENOMEM; | ||
854 | |||
855 | mbus->sdramwins_base = ioremap(sdramwins_phys_base, sdramwins_size); | ||
856 | if (!mbus->sdramwins_base) { | ||
857 | iounmap(mbus_state.mbuswins_base); | ||
858 | return -ENOMEM; | ||
859 | } | ||
860 | |||
861 | if (of_find_compatible_node(NULL, NULL, "marvell,coherency-fabric")) | ||
862 | mbus->hw_io_coherency = 1; | ||
863 | |||
864 | for (win = 0; win < mbus->soc->num_wins; win++) | ||
865 | mvebu_mbus_disable_window(mbus, win); | ||
866 | |||
867 | mbus->soc->setup_cpu_target(mbus); | ||
868 | |||
869 | return 0; | ||
870 | } | ||
diff --git a/drivers/char/hw_random/virtio-rng.c b/drivers/char/hw_random/virtio-rng.c index 10fd71ccf587..6bf4d47324eb 100644 --- a/drivers/char/hw_random/virtio-rng.c +++ b/drivers/char/hw_random/virtio-rng.c | |||
@@ -92,14 +92,22 @@ static int probe_common(struct virtio_device *vdev) | |||
92 | { | 92 | { |
93 | int err; | 93 | int err; |
94 | 94 | ||
95 | if (vq) { | ||
96 | /* We only support one device for now */ | ||
97 | return -EBUSY; | ||
98 | } | ||
95 | /* We expect a single virtqueue. */ | 99 | /* We expect a single virtqueue. */ |
96 | vq = virtio_find_single_vq(vdev, random_recv_done, "input"); | 100 | vq = virtio_find_single_vq(vdev, random_recv_done, "input"); |
97 | if (IS_ERR(vq)) | 101 | if (IS_ERR(vq)) { |
98 | return PTR_ERR(vq); | 102 | err = PTR_ERR(vq); |
103 | vq = NULL; | ||
104 | return err; | ||
105 | } | ||
99 | 106 | ||
100 | err = hwrng_register(&virtio_hwrng); | 107 | err = hwrng_register(&virtio_hwrng); |
101 | if (err) { | 108 | if (err) { |
102 | vdev->config->del_vqs(vdev); | 109 | vdev->config->del_vqs(vdev); |
110 | vq = NULL; | ||
103 | return err; | 111 | return err; |
104 | } | 112 | } |
105 | 113 | ||
@@ -112,6 +120,7 @@ static void remove_common(struct virtio_device *vdev) | |||
112 | busy = false; | 120 | busy = false; |
113 | hwrng_unregister(&virtio_hwrng); | 121 | hwrng_unregister(&virtio_hwrng); |
114 | vdev->config->del_vqs(vdev); | 122 | vdev->config->del_vqs(vdev); |
123 | vq = NULL; | ||
115 | } | 124 | } |
116 | 125 | ||
117 | static int virtrng_probe(struct virtio_device *vdev) | 126 | static int virtrng_probe(struct virtio_device *vdev) |
diff --git a/drivers/clk/clk-vt8500.c b/drivers/clk/clk-vt8500.c index b5538bba7a10..09c63315e579 100644 --- a/drivers/clk/clk-vt8500.c +++ b/drivers/clk/clk-vt8500.c | |||
@@ -157,7 +157,7 @@ static int vt8500_dclk_set_rate(struct clk_hw *hw, unsigned long rate, | |||
157 | divisor = parent_rate / rate; | 157 | divisor = parent_rate / rate; |
158 | 158 | ||
159 | /* If prate / rate would be decimal, incr the divisor */ | 159 | /* If prate / rate would be decimal, incr the divisor */ |
160 | if (rate * divisor < *prate) | 160 | if (rate * divisor < parent_rate) |
161 | divisor++; | 161 | divisor++; |
162 | 162 | ||
163 | if (divisor == cdev->div_mask + 1) | 163 | if (divisor == cdev->div_mask + 1) |
diff --git a/drivers/clk/tegra/clk-tegra20.c b/drivers/clk/tegra/clk-tegra20.c index 143ce1f899ad..1e2de7305362 100644 --- a/drivers/clk/tegra/clk-tegra20.c +++ b/drivers/clk/tegra/clk-tegra20.c | |||
@@ -1292,7 +1292,6 @@ static struct tegra_clk_duplicate tegra_clk_duplicates[] = { | |||
1292 | TEGRA_CLK_DUPLICATE(usbd, "tegra-ehci.0", NULL), | 1292 | TEGRA_CLK_DUPLICATE(usbd, "tegra-ehci.0", NULL), |
1293 | TEGRA_CLK_DUPLICATE(usbd, "tegra-otg", NULL), | 1293 | TEGRA_CLK_DUPLICATE(usbd, "tegra-otg", NULL), |
1294 | TEGRA_CLK_DUPLICATE(cclk, NULL, "cpu"), | 1294 | TEGRA_CLK_DUPLICATE(cclk, NULL, "cpu"), |
1295 | TEGRA_CLK_DUPLICATE(twd, "smp_twd", NULL), | ||
1296 | TEGRA_CLK_DUPLICATE(clk_max, NULL, NULL), /* Must be the last entry */ | 1295 | TEGRA_CLK_DUPLICATE(clk_max, NULL, NULL), /* Must be the last entry */ |
1297 | }; | 1296 | }; |
1298 | 1297 | ||
diff --git a/drivers/clk/tegra/clk-tegra30.c b/drivers/clk/tegra/clk-tegra30.c index 32c61cb6d0bb..ba6f51bc9f3b 100644 --- a/drivers/clk/tegra/clk-tegra30.c +++ b/drivers/clk/tegra/clk-tegra30.c | |||
@@ -1931,7 +1931,6 @@ static struct tegra_clk_duplicate tegra_clk_duplicates[] = { | |||
1931 | TEGRA_CLK_DUPLICATE(cml1, "tegra_sata_cml", NULL), | 1931 | TEGRA_CLK_DUPLICATE(cml1, "tegra_sata_cml", NULL), |
1932 | TEGRA_CLK_DUPLICATE(cml0, "tegra_pcie", "cml"), | 1932 | TEGRA_CLK_DUPLICATE(cml0, "tegra_pcie", "cml"), |
1933 | TEGRA_CLK_DUPLICATE(pciex, "tegra_pcie", "pciex"), | 1933 | TEGRA_CLK_DUPLICATE(pciex, "tegra_pcie", "pciex"), |
1934 | TEGRA_CLK_DUPLICATE(twd, "smp_twd", NULL), | ||
1935 | TEGRA_CLK_DUPLICATE(vcp, "nvavp", "vcp"), | 1934 | TEGRA_CLK_DUPLICATE(vcp, "nvavp", "vcp"), |
1936 | TEGRA_CLK_DUPLICATE(clk_max, NULL, NULL), /* MUST be the last entry */ | 1935 | TEGRA_CLK_DUPLICATE(clk_max, NULL, NULL), /* MUST be the last entry */ |
1937 | }; | 1936 | }; |
diff --git a/drivers/edac/amd64_edac.c b/drivers/edac/amd64_edac.c index 910b0116c128..e1d13c463c90 100644 --- a/drivers/edac/amd64_edac.c +++ b/drivers/edac/amd64_edac.c | |||
@@ -2048,12 +2048,18 @@ static int init_csrows(struct mem_ctl_info *mci) | |||
2048 | edac_dbg(1, "MC node: %d, csrow: %d\n", | 2048 | edac_dbg(1, "MC node: %d, csrow: %d\n", |
2049 | pvt->mc_node_id, i); | 2049 | pvt->mc_node_id, i); |
2050 | 2050 | ||
2051 | if (row_dct0) | 2051 | if (row_dct0) { |
2052 | nr_pages = amd64_csrow_nr_pages(pvt, 0, i); | 2052 | nr_pages = amd64_csrow_nr_pages(pvt, 0, i); |
2053 | csrow->channels[0]->dimm->nr_pages = nr_pages; | ||
2054 | } | ||
2053 | 2055 | ||
2054 | /* K8 has only one DCT */ | 2056 | /* K8 has only one DCT */ |
2055 | if (boot_cpu_data.x86 != 0xf && row_dct1) | 2057 | if (boot_cpu_data.x86 != 0xf && row_dct1) { |
2056 | nr_pages += amd64_csrow_nr_pages(pvt, 1, i); | 2058 | int row_dct1_pages = amd64_csrow_nr_pages(pvt, 1, i); |
2059 | |||
2060 | csrow->channels[1]->dimm->nr_pages = row_dct1_pages; | ||
2061 | nr_pages += row_dct1_pages; | ||
2062 | } | ||
2057 | 2063 | ||
2058 | mtype = amd64_determine_memory_type(pvt, i); | 2064 | mtype = amd64_determine_memory_type(pvt, i); |
2059 | 2065 | ||
@@ -2072,9 +2078,7 @@ static int init_csrows(struct mem_ctl_info *mci) | |||
2072 | dimm = csrow->channels[j]->dimm; | 2078 | dimm = csrow->channels[j]->dimm; |
2073 | dimm->mtype = mtype; | 2079 | dimm->mtype = mtype; |
2074 | dimm->edac_mode = edac_mode; | 2080 | dimm->edac_mode = edac_mode; |
2075 | dimm->nr_pages = nr_pages; | ||
2076 | } | 2081 | } |
2077 | csrow->nr_pages = nr_pages; | ||
2078 | } | 2082 | } |
2079 | 2083 | ||
2080 | return empty; | 2084 | return empty; |
@@ -2419,7 +2423,6 @@ static int amd64_init_one_instance(struct pci_dev *F2) | |||
2419 | 2423 | ||
2420 | mci->pvt_info = pvt; | 2424 | mci->pvt_info = pvt; |
2421 | mci->pdev = &pvt->F2->dev; | 2425 | mci->pdev = &pvt->F2->dev; |
2422 | mci->csbased = 1; | ||
2423 | 2426 | ||
2424 | setup_mci_misc_attrs(mci, fam_type); | 2427 | setup_mci_misc_attrs(mci, fam_type); |
2425 | 2428 | ||
diff --git a/drivers/edac/edac_mc.c b/drivers/edac/edac_mc.c index cdb81aa73ab7..27e86d938262 100644 --- a/drivers/edac/edac_mc.c +++ b/drivers/edac/edac_mc.c | |||
@@ -86,7 +86,7 @@ static void edac_mc_dump_dimm(struct dimm_info *dimm, int number) | |||
86 | edac_dimm_info_location(dimm, location, sizeof(location)); | 86 | edac_dimm_info_location(dimm, location, sizeof(location)); |
87 | 87 | ||
88 | edac_dbg(4, "%s%i: %smapped as virtual row %d, chan %d\n", | 88 | edac_dbg(4, "%s%i: %smapped as virtual row %d, chan %d\n", |
89 | dimm->mci->mem_is_per_rank ? "rank" : "dimm", | 89 | dimm->mci->csbased ? "rank" : "dimm", |
90 | number, location, dimm->csrow, dimm->cschannel); | 90 | number, location, dimm->csrow, dimm->cschannel); |
91 | edac_dbg(4, " dimm = %p\n", dimm); | 91 | edac_dbg(4, " dimm = %p\n", dimm); |
92 | edac_dbg(4, " dimm->label = '%s'\n", dimm->label); | 92 | edac_dbg(4, " dimm->label = '%s'\n", dimm->label); |
@@ -341,7 +341,7 @@ struct mem_ctl_info *edac_mc_alloc(unsigned mc_num, | |||
341 | memcpy(mci->layers, layers, sizeof(*layer) * n_layers); | 341 | memcpy(mci->layers, layers, sizeof(*layer) * n_layers); |
342 | mci->nr_csrows = tot_csrows; | 342 | mci->nr_csrows = tot_csrows; |
343 | mci->num_cschannel = tot_channels; | 343 | mci->num_cschannel = tot_channels; |
344 | mci->mem_is_per_rank = per_rank; | 344 | mci->csbased = per_rank; |
345 | 345 | ||
346 | /* | 346 | /* |
347 | * Alocate and fill the csrow/channels structs | 347 | * Alocate and fill the csrow/channels structs |
@@ -1235,7 +1235,7 @@ void edac_mc_handle_error(const enum hw_event_mc_err_type type, | |||
1235 | * incrementing the compat API counters | 1235 | * incrementing the compat API counters |
1236 | */ | 1236 | */ |
1237 | edac_dbg(4, "%s csrows map: (%d,%d)\n", | 1237 | edac_dbg(4, "%s csrows map: (%d,%d)\n", |
1238 | mci->mem_is_per_rank ? "rank" : "dimm", | 1238 | mci->csbased ? "rank" : "dimm", |
1239 | dimm->csrow, dimm->cschannel); | 1239 | dimm->csrow, dimm->cschannel); |
1240 | if (row == -1) | 1240 | if (row == -1) |
1241 | row = dimm->csrow; | 1241 | row = dimm->csrow; |
diff --git a/drivers/edac/edac_mc_sysfs.c b/drivers/edac/edac_mc_sysfs.c index 4f4b6137d74e..5899a76eec3b 100644 --- a/drivers/edac/edac_mc_sysfs.c +++ b/drivers/edac/edac_mc_sysfs.c | |||
@@ -143,7 +143,7 @@ static const char *edac_caps[] = { | |||
143 | * and the per-dimm/per-rank one | 143 | * and the per-dimm/per-rank one |
144 | */ | 144 | */ |
145 | #define DEVICE_ATTR_LEGACY(_name, _mode, _show, _store) \ | 145 | #define DEVICE_ATTR_LEGACY(_name, _mode, _show, _store) \ |
146 | struct device_attribute dev_attr_legacy_##_name = __ATTR(_name, _mode, _show, _store) | 146 | static struct device_attribute dev_attr_legacy_##_name = __ATTR(_name, _mode, _show, _store) |
147 | 147 | ||
148 | struct dev_ch_attribute { | 148 | struct dev_ch_attribute { |
149 | struct device_attribute attr; | 149 | struct device_attribute attr; |
@@ -180,9 +180,6 @@ static ssize_t csrow_size_show(struct device *dev, | |||
180 | int i; | 180 | int i; |
181 | u32 nr_pages = 0; | 181 | u32 nr_pages = 0; |
182 | 182 | ||
183 | if (csrow->mci->csbased) | ||
184 | return sprintf(data, "%u\n", PAGES_TO_MiB(csrow->nr_pages)); | ||
185 | |||
186 | for (i = 0; i < csrow->nr_channels; i++) | 183 | for (i = 0; i < csrow->nr_channels; i++) |
187 | nr_pages += csrow->channels[i]->dimm->nr_pages; | 184 | nr_pages += csrow->channels[i]->dimm->nr_pages; |
188 | return sprintf(data, "%u\n", PAGES_TO_MiB(nr_pages)); | 185 | return sprintf(data, "%u\n", PAGES_TO_MiB(nr_pages)); |
@@ -612,7 +609,7 @@ static int edac_create_dimm_object(struct mem_ctl_info *mci, | |||
612 | device_initialize(&dimm->dev); | 609 | device_initialize(&dimm->dev); |
613 | 610 | ||
614 | dimm->dev.parent = &mci->dev; | 611 | dimm->dev.parent = &mci->dev; |
615 | if (mci->mem_is_per_rank) | 612 | if (mci->csbased) |
616 | dev_set_name(&dimm->dev, "rank%d", index); | 613 | dev_set_name(&dimm->dev, "rank%d", index); |
617 | else | 614 | else |
618 | dev_set_name(&dimm->dev, "dimm%d", index); | 615 | dev_set_name(&dimm->dev, "dimm%d", index); |
@@ -778,14 +775,10 @@ static ssize_t mci_size_mb_show(struct device *dev, | |||
778 | for (csrow_idx = 0; csrow_idx < mci->nr_csrows; csrow_idx++) { | 775 | for (csrow_idx = 0; csrow_idx < mci->nr_csrows; csrow_idx++) { |
779 | struct csrow_info *csrow = mci->csrows[csrow_idx]; | 776 | struct csrow_info *csrow = mci->csrows[csrow_idx]; |
780 | 777 | ||
781 | if (csrow->mci->csbased) { | 778 | for (j = 0; j < csrow->nr_channels; j++) { |
782 | total_pages += csrow->nr_pages; | 779 | struct dimm_info *dimm = csrow->channels[j]->dimm; |
783 | } else { | ||
784 | for (j = 0; j < csrow->nr_channels; j++) { | ||
785 | struct dimm_info *dimm = csrow->channels[j]->dimm; | ||
786 | 780 | ||
787 | total_pages += dimm->nr_pages; | 781 | total_pages += dimm->nr_pages; |
788 | } | ||
789 | } | 782 | } |
790 | } | 783 | } |
791 | 784 | ||
diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c index c194f4e680ad..e2acfdbf7d3c 100644 --- a/drivers/gpu/drm/drm_edid.c +++ b/drivers/gpu/drm/drm_edid.c | |||
@@ -1634,7 +1634,7 @@ static struct drm_display_mode *drm_mode_detailed(struct drm_device *dev, | |||
1634 | unsigned vblank = (pt->vactive_vblank_hi & 0xf) << 8 | pt->vblank_lo; | 1634 | unsigned vblank = (pt->vactive_vblank_hi & 0xf) << 8 | pt->vblank_lo; |
1635 | unsigned hsync_offset = (pt->hsync_vsync_offset_pulse_width_hi & 0xc0) << 2 | pt->hsync_offset_lo; | 1635 | unsigned hsync_offset = (pt->hsync_vsync_offset_pulse_width_hi & 0xc0) << 2 | pt->hsync_offset_lo; |
1636 | unsigned hsync_pulse_width = (pt->hsync_vsync_offset_pulse_width_hi & 0x30) << 4 | pt->hsync_pulse_width_lo; | 1636 | unsigned hsync_pulse_width = (pt->hsync_vsync_offset_pulse_width_hi & 0x30) << 4 | pt->hsync_pulse_width_lo; |
1637 | unsigned vsync_offset = (pt->hsync_vsync_offset_pulse_width_hi & 0xc) >> 2 | pt->vsync_offset_pulse_width_lo >> 4; | 1637 | unsigned vsync_offset = (pt->hsync_vsync_offset_pulse_width_hi & 0xc) << 2 | pt->vsync_offset_pulse_width_lo >> 4; |
1638 | unsigned vsync_pulse_width = (pt->hsync_vsync_offset_pulse_width_hi & 0x3) << 4 | (pt->vsync_offset_pulse_width_lo & 0xf); | 1638 | unsigned vsync_pulse_width = (pt->hsync_vsync_offset_pulse_width_hi & 0x3) << 4 | (pt->vsync_offset_pulse_width_lo & 0xf); |
1639 | 1639 | ||
1640 | /* ignore tiny modes */ | 1640 | /* ignore tiny modes */ |
@@ -1715,6 +1715,7 @@ set_size: | |||
1715 | } | 1715 | } |
1716 | 1716 | ||
1717 | mode->type = DRM_MODE_TYPE_DRIVER; | 1717 | mode->type = DRM_MODE_TYPE_DRIVER; |
1718 | mode->vrefresh = drm_mode_vrefresh(mode); | ||
1718 | drm_mode_set_name(mode); | 1719 | drm_mode_set_name(mode); |
1719 | 1720 | ||
1720 | return mode; | 1721 | return mode; |
diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c index aae31489c893..7299ea45dd03 100644 --- a/drivers/gpu/drm/i915/i915_debugfs.c +++ b/drivers/gpu/drm/i915/i915_debugfs.c | |||
@@ -103,7 +103,7 @@ static const char *cache_level_str(int type) | |||
103 | static void | 103 | static void |
104 | describe_obj(struct seq_file *m, struct drm_i915_gem_object *obj) | 104 | describe_obj(struct seq_file *m, struct drm_i915_gem_object *obj) |
105 | { | 105 | { |
106 | seq_printf(m, "%p: %s%s %8zdKiB %02x %02x %d %d %d%s%s%s", | 106 | seq_printf(m, "%pK: %s%s %8zdKiB %02x %02x %d %d %d%s%s%s", |
107 | &obj->base, | 107 | &obj->base, |
108 | get_pin_flag(obj), | 108 | get_pin_flag(obj), |
109 | get_tiling_flag(obj), | 109 | get_tiling_flag(obj), |
diff --git a/drivers/gpu/drm/i915/i915_gem_execbuffer.c b/drivers/gpu/drm/i915/i915_gem_execbuffer.c index 2f2daebd0eef..3b11ab0fbc96 100644 --- a/drivers/gpu/drm/i915/i915_gem_execbuffer.c +++ b/drivers/gpu/drm/i915/i915_gem_execbuffer.c | |||
@@ -732,6 +732,8 @@ validate_exec_list(struct drm_i915_gem_exec_object2 *exec, | |||
732 | int count) | 732 | int count) |
733 | { | 733 | { |
734 | int i; | 734 | int i; |
735 | int relocs_total = 0; | ||
736 | int relocs_max = INT_MAX / sizeof(struct drm_i915_gem_relocation_entry); | ||
735 | 737 | ||
736 | for (i = 0; i < count; i++) { | 738 | for (i = 0; i < count; i++) { |
737 | char __user *ptr = (char __user *)(uintptr_t)exec[i].relocs_ptr; | 739 | char __user *ptr = (char __user *)(uintptr_t)exec[i].relocs_ptr; |
@@ -740,10 +742,13 @@ validate_exec_list(struct drm_i915_gem_exec_object2 *exec, | |||
740 | if (exec[i].flags & __EXEC_OBJECT_UNKNOWN_FLAGS) | 742 | if (exec[i].flags & __EXEC_OBJECT_UNKNOWN_FLAGS) |
741 | return -EINVAL; | 743 | return -EINVAL; |
742 | 744 | ||
743 | /* First check for malicious input causing overflow */ | 745 | /* First check for malicious input causing overflow in |
744 | if (exec[i].relocation_count > | 746 | * the worst case where we need to allocate the entire |
745 | INT_MAX / sizeof(struct drm_i915_gem_relocation_entry)) | 747 | * relocation tree as a single array. |
748 | */ | ||
749 | if (exec[i].relocation_count > relocs_max - relocs_total) | ||
746 | return -EINVAL; | 750 | return -EINVAL; |
751 | relocs_total += exec[i].relocation_count; | ||
747 | 752 | ||
748 | length = exec[i].relocation_count * | 753 | length = exec[i].relocation_count * |
749 | sizeof(struct drm_i915_gem_relocation_entry); | 754 | sizeof(struct drm_i915_gem_relocation_entry); |
diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c index 6f728e5ee793..d7d4afe01341 100644 --- a/drivers/gpu/drm/i915/intel_dp.c +++ b/drivers/gpu/drm/i915/intel_dp.c | |||
@@ -820,6 +820,7 @@ intel_dp_set_m_n(struct drm_crtc *crtc, struct drm_display_mode *mode, | |||
820 | struct intel_link_m_n m_n; | 820 | struct intel_link_m_n m_n; |
821 | int pipe = intel_crtc->pipe; | 821 | int pipe = intel_crtc->pipe; |
822 | enum transcoder cpu_transcoder = intel_crtc->cpu_transcoder; | 822 | enum transcoder cpu_transcoder = intel_crtc->cpu_transcoder; |
823 | int target_clock; | ||
823 | 824 | ||
824 | /* | 825 | /* |
825 | * Find the lane count in the intel_encoder private | 826 | * Find the lane count in the intel_encoder private |
@@ -835,13 +836,22 @@ intel_dp_set_m_n(struct drm_crtc *crtc, struct drm_display_mode *mode, | |||
835 | } | 836 | } |
836 | } | 837 | } |
837 | 838 | ||
839 | target_clock = mode->clock; | ||
840 | for_each_encoder_on_crtc(dev, crtc, intel_encoder) { | ||
841 | if (intel_encoder->type == INTEL_OUTPUT_EDP) { | ||
842 | target_clock = intel_edp_target_clock(intel_encoder, | ||
843 | mode); | ||
844 | break; | ||
845 | } | ||
846 | } | ||
847 | |||
838 | /* | 848 | /* |
839 | * Compute the GMCH and Link ratios. The '3' here is | 849 | * Compute the GMCH and Link ratios. The '3' here is |
840 | * the number of bytes_per_pixel post-LUT, which we always | 850 | * the number of bytes_per_pixel post-LUT, which we always |
841 | * set up for 8-bits of R/G/B, or 3 bytes total. | 851 | * set up for 8-bits of R/G/B, or 3 bytes total. |
842 | */ | 852 | */ |
843 | intel_link_compute_m_n(intel_crtc->bpp, lane_count, | 853 | intel_link_compute_m_n(intel_crtc->bpp, lane_count, |
844 | mode->clock, adjusted_mode->clock, &m_n); | 854 | target_clock, adjusted_mode->clock, &m_n); |
845 | 855 | ||
846 | if (IS_HASWELL(dev)) { | 856 | if (IS_HASWELL(dev)) { |
847 | I915_WRITE(PIPE_DATA_M1(cpu_transcoder), | 857 | I915_WRITE(PIPE_DATA_M1(cpu_transcoder), |
@@ -1930,7 +1940,7 @@ intel_dp_start_link_train(struct intel_dp *intel_dp) | |||
1930 | for (i = 0; i < intel_dp->lane_count; i++) | 1940 | for (i = 0; i < intel_dp->lane_count; i++) |
1931 | if ((intel_dp->train_set[i] & DP_TRAIN_MAX_SWING_REACHED) == 0) | 1941 | if ((intel_dp->train_set[i] & DP_TRAIN_MAX_SWING_REACHED) == 0) |
1932 | break; | 1942 | break; |
1933 | if (i == intel_dp->lane_count && voltage_tries == 5) { | 1943 | if (i == intel_dp->lane_count) { |
1934 | ++loop_tries; | 1944 | ++loop_tries; |
1935 | if (loop_tries == 5) { | 1945 | if (loop_tries == 5) { |
1936 | DRM_DEBUG_KMS("too many full retries, give up\n"); | 1946 | DRM_DEBUG_KMS("too many full retries, give up\n"); |
diff --git a/drivers/gpu/drm/i915/intel_i2c.c b/drivers/gpu/drm/i915/intel_i2c.c index acf8aec9ada7..ef4744e1bf0b 100644 --- a/drivers/gpu/drm/i915/intel_i2c.c +++ b/drivers/gpu/drm/i915/intel_i2c.c | |||
@@ -203,7 +203,13 @@ intel_gpio_setup(struct intel_gmbus *bus, u32 pin) | |||
203 | algo->data = bus; | 203 | algo->data = bus; |
204 | } | 204 | } |
205 | 205 | ||
206 | #define HAS_GMBUS_IRQ(dev) (INTEL_INFO(dev)->gen >= 4) | 206 | /* |
207 | * gmbus on gen4 seems to be able to generate legacy interrupts even when in MSI | ||
208 | * mode. This results in spurious interrupt warnings if the legacy irq no. is | ||
209 | * shared with another device. The kernel then disables that interrupt source | ||
210 | * and so prevents the other device from working properly. | ||
211 | */ | ||
212 | #define HAS_GMBUS_IRQ(dev) (INTEL_INFO(dev)->gen >= 5) | ||
207 | static int | 213 | static int |
208 | gmbus_wait_hw_status(struct drm_i915_private *dev_priv, | 214 | gmbus_wait_hw_status(struct drm_i915_private *dev_priv, |
209 | u32 gmbus2_status, | 215 | u32 gmbus2_status, |
@@ -214,6 +220,9 @@ gmbus_wait_hw_status(struct drm_i915_private *dev_priv, | |||
214 | u32 gmbus2 = 0; | 220 | u32 gmbus2 = 0; |
215 | DEFINE_WAIT(wait); | 221 | DEFINE_WAIT(wait); |
216 | 222 | ||
223 | if (!HAS_GMBUS_IRQ(dev_priv->dev)) | ||
224 | gmbus4_irq_en = 0; | ||
225 | |||
217 | /* Important: The hw handles only the first bit, so set only one! Since | 226 | /* Important: The hw handles only the first bit, so set only one! Since |
218 | * we also need to check for NAKs besides the hw ready/idle signal, we | 227 | * we also need to check for NAKs besides the hw ready/idle signal, we |
219 | * need to wake up periodically and check that ourselves. */ | 228 | * need to wake up periodically and check that ourselves. */ |
diff --git a/drivers/gpu/drm/mgag200/mgag200_mode.c b/drivers/gpu/drm/mgag200/mgag200_mode.c index a274b9906ef8..fe22bb780e1d 100644 --- a/drivers/gpu/drm/mgag200/mgag200_mode.c +++ b/drivers/gpu/drm/mgag200/mgag200_mode.c | |||
@@ -382,19 +382,19 @@ static int mga_g200eh_set_plls(struct mga_device *mdev, long clock) | |||
382 | m = n = p = 0; | 382 | m = n = p = 0; |
383 | vcomax = 800000; | 383 | vcomax = 800000; |
384 | vcomin = 400000; | 384 | vcomin = 400000; |
385 | pllreffreq = 3333; | 385 | pllreffreq = 33333; |
386 | 386 | ||
387 | delta = 0xffffffff; | 387 | delta = 0xffffffff; |
388 | permitteddelta = clock * 5 / 1000; | 388 | permitteddelta = clock * 5 / 1000; |
389 | 389 | ||
390 | for (testp = 16; testp > 0; testp--) { | 390 | for (testp = 16; testp > 0; testp >>= 1) { |
391 | if (clock * testp > vcomax) | 391 | if (clock * testp > vcomax) |
392 | continue; | 392 | continue; |
393 | if (clock * testp < vcomin) | 393 | if (clock * testp < vcomin) |
394 | continue; | 394 | continue; |
395 | 395 | ||
396 | for (testm = 1; testm < 33; testm++) { | 396 | for (testm = 1; testm < 33; testm++) { |
397 | for (testn = 1; testn < 257; testn++) { | 397 | for (testn = 17; testn < 257; testn++) { |
398 | computed = (pllreffreq * testn) / | 398 | computed = (pllreffreq * testn) / |
399 | (testm * testp); | 399 | (testm * testp); |
400 | if (computed > clock) | 400 | if (computed > clock) |
@@ -404,11 +404,11 @@ static int mga_g200eh_set_plls(struct mga_device *mdev, long clock) | |||
404 | if (tmpdelta < delta) { | 404 | if (tmpdelta < delta) { |
405 | delta = tmpdelta; | 405 | delta = tmpdelta; |
406 | n = testn - 1; | 406 | n = testn - 1; |
407 | m = (testm - 1) | ((n >> 1) & 0x80); | 407 | m = (testm - 1); |
408 | p = testp - 1; | 408 | p = testp - 1; |
409 | } | 409 | } |
410 | if ((clock * testp) >= 600000) | 410 | if ((clock * testp) >= 600000) |
411 | p |= 80; | 411 | p |= 0x80; |
412 | } | 412 | } |
413 | } | 413 | } |
414 | } | 414 | } |
diff --git a/drivers/gpu/drm/nouveau/core/core/object.c b/drivers/gpu/drm/nouveau/core/core/object.c index 0daab62ea14c..3b2e7b6304d3 100644 --- a/drivers/gpu/drm/nouveau/core/core/object.c +++ b/drivers/gpu/drm/nouveau/core/core/object.c | |||
@@ -278,7 +278,6 @@ nouveau_object_del(struct nouveau_object *client, u32 _parent, u32 _handle) | |||
278 | struct nouveau_object *parent = NULL; | 278 | struct nouveau_object *parent = NULL; |
279 | struct nouveau_object *namedb = NULL; | 279 | struct nouveau_object *namedb = NULL; |
280 | struct nouveau_handle *handle = NULL; | 280 | struct nouveau_handle *handle = NULL; |
281 | int ret = -EINVAL; | ||
282 | 281 | ||
283 | parent = nouveau_handle_ref(client, _parent); | 282 | parent = nouveau_handle_ref(client, _parent); |
284 | if (!parent) | 283 | if (!parent) |
@@ -295,7 +294,7 @@ nouveau_object_del(struct nouveau_object *client, u32 _parent, u32 _handle) | |||
295 | } | 294 | } |
296 | 295 | ||
297 | nouveau_object_ref(NULL, &parent); | 296 | nouveau_object_ref(NULL, &parent); |
298 | return ret; | 297 | return handle ? 0 : -EINVAL; |
299 | } | 298 | } |
300 | 299 | ||
301 | int | 300 | int |
diff --git a/drivers/gpu/drm/nouveau/core/engine/disp/nv50.c b/drivers/gpu/drm/nouveau/core/engine/disp/nv50.c index 5fa13267bd9f..02e369f80449 100644 --- a/drivers/gpu/drm/nouveau/core/engine/disp/nv50.c +++ b/drivers/gpu/drm/nouveau/core/engine/disp/nv50.c | |||
@@ -544,13 +544,13 @@ nv50_disp_curs_ofuncs = { | |||
544 | static void | 544 | static void |
545 | nv50_disp_base_vblank_enable(struct nouveau_event *event, int head) | 545 | nv50_disp_base_vblank_enable(struct nouveau_event *event, int head) |
546 | { | 546 | { |
547 | nv_mask(event->priv, 0x61002c, (1 << head), (1 << head)); | 547 | nv_mask(event->priv, 0x61002c, (4 << head), (4 << head)); |
548 | } | 548 | } |
549 | 549 | ||
550 | static void | 550 | static void |
551 | nv50_disp_base_vblank_disable(struct nouveau_event *event, int head) | 551 | nv50_disp_base_vblank_disable(struct nouveau_event *event, int head) |
552 | { | 552 | { |
553 | nv_mask(event->priv, 0x61002c, (1 << head), (0 << head)); | 553 | nv_mask(event->priv, 0x61002c, (4 << head), 0); |
554 | } | 554 | } |
555 | 555 | ||
556 | static int | 556 | static int |
diff --git a/drivers/gpu/drm/nouveau/core/include/subdev/therm.h b/drivers/gpu/drm/nouveau/core/include/subdev/therm.h index 6b17b614629f..0b20fc0d19c1 100644 --- a/drivers/gpu/drm/nouveau/core/include/subdev/therm.h +++ b/drivers/gpu/drm/nouveau/core/include/subdev/therm.h | |||
@@ -4,7 +4,7 @@ | |||
4 | #include <core/device.h> | 4 | #include <core/device.h> |
5 | #include <core/subdev.h> | 5 | #include <core/subdev.h> |
6 | 6 | ||
7 | enum nouveau_therm_mode { | 7 | enum nouveau_therm_fan_mode { |
8 | NOUVEAU_THERM_CTRL_NONE = 0, | 8 | NOUVEAU_THERM_CTRL_NONE = 0, |
9 | NOUVEAU_THERM_CTRL_MANUAL = 1, | 9 | NOUVEAU_THERM_CTRL_MANUAL = 1, |
10 | NOUVEAU_THERM_CTRL_AUTO = 2, | 10 | NOUVEAU_THERM_CTRL_AUTO = 2, |
diff --git a/drivers/gpu/drm/nouveau/core/subdev/therm/base.c b/drivers/gpu/drm/nouveau/core/subdev/therm/base.c index f794dc89a3b2..a00a5a76e2d6 100644 --- a/drivers/gpu/drm/nouveau/core/subdev/therm/base.c +++ b/drivers/gpu/drm/nouveau/core/subdev/therm/base.c | |||
@@ -134,7 +134,7 @@ nouveau_therm_alarm(struct nouveau_alarm *alarm) | |||
134 | } | 134 | } |
135 | 135 | ||
136 | int | 136 | int |
137 | nouveau_therm_mode(struct nouveau_therm *therm, int mode) | 137 | nouveau_therm_fan_mode(struct nouveau_therm *therm, int mode) |
138 | { | 138 | { |
139 | struct nouveau_therm_priv *priv = (void *)therm; | 139 | struct nouveau_therm_priv *priv = (void *)therm; |
140 | struct nouveau_device *device = nv_device(therm); | 140 | struct nouveau_device *device = nv_device(therm); |
@@ -149,10 +149,15 @@ nouveau_therm_mode(struct nouveau_therm *therm, int mode) | |||
149 | (mode != NOUVEAU_THERM_CTRL_NONE && device->card_type >= NV_C0)) | 149 | (mode != NOUVEAU_THERM_CTRL_NONE && device->card_type >= NV_C0)) |
150 | return -EINVAL; | 150 | return -EINVAL; |
151 | 151 | ||
152 | /* do not allow automatic fan management if the thermal sensor is | ||
153 | * not available */ | ||
154 | if (priv->mode == 2 && therm->temp_get(therm) < 0) | ||
155 | return -EINVAL; | ||
156 | |||
152 | if (priv->mode == mode) | 157 | if (priv->mode == mode) |
153 | return 0; | 158 | return 0; |
154 | 159 | ||
155 | nv_info(therm, "Thermal management: %s\n", name[mode]); | 160 | nv_info(therm, "fan management: %s\n", name[mode]); |
156 | nouveau_therm_update(therm, mode); | 161 | nouveau_therm_update(therm, mode); |
157 | return 0; | 162 | return 0; |
158 | } | 163 | } |
@@ -213,7 +218,7 @@ nouveau_therm_attr_set(struct nouveau_therm *therm, | |||
213 | priv->fan->bios.max_duty = value; | 218 | priv->fan->bios.max_duty = value; |
214 | return 0; | 219 | return 0; |
215 | case NOUVEAU_THERM_ATTR_FAN_MODE: | 220 | case NOUVEAU_THERM_ATTR_FAN_MODE: |
216 | return nouveau_therm_mode(therm, value); | 221 | return nouveau_therm_fan_mode(therm, value); |
217 | case NOUVEAU_THERM_ATTR_THRS_FAN_BOOST: | 222 | case NOUVEAU_THERM_ATTR_THRS_FAN_BOOST: |
218 | priv->bios_sensor.thrs_fan_boost.temp = value; | 223 | priv->bios_sensor.thrs_fan_boost.temp = value; |
219 | priv->sensor.program_alarms(therm); | 224 | priv->sensor.program_alarms(therm); |
@@ -263,7 +268,7 @@ _nouveau_therm_init(struct nouveau_object *object) | |||
263 | return ret; | 268 | return ret; |
264 | 269 | ||
265 | if (priv->suspend >= 0) | 270 | if (priv->suspend >= 0) |
266 | nouveau_therm_mode(therm, priv->mode); | 271 | nouveau_therm_fan_mode(therm, priv->mode); |
267 | priv->sensor.program_alarms(therm); | 272 | priv->sensor.program_alarms(therm); |
268 | return 0; | 273 | return 0; |
269 | } | 274 | } |
@@ -313,11 +318,12 @@ nouveau_therm_create_(struct nouveau_object *parent, | |||
313 | int | 318 | int |
314 | nouveau_therm_preinit(struct nouveau_therm *therm) | 319 | nouveau_therm_preinit(struct nouveau_therm *therm) |
315 | { | 320 | { |
316 | nouveau_therm_ic_ctor(therm); | ||
317 | nouveau_therm_sensor_ctor(therm); | 321 | nouveau_therm_sensor_ctor(therm); |
322 | nouveau_therm_ic_ctor(therm); | ||
318 | nouveau_therm_fan_ctor(therm); | 323 | nouveau_therm_fan_ctor(therm); |
319 | 324 | ||
320 | nouveau_therm_mode(therm, NOUVEAU_THERM_CTRL_NONE); | 325 | nouveau_therm_fan_mode(therm, NOUVEAU_THERM_CTRL_NONE); |
326 | nouveau_therm_sensor_preinit(therm); | ||
321 | return 0; | 327 | return 0; |
322 | } | 328 | } |
323 | 329 | ||
diff --git a/drivers/gpu/drm/nouveau/core/subdev/therm/ic.c b/drivers/gpu/drm/nouveau/core/subdev/therm/ic.c index e24090bac195..8b3adec5fbb1 100644 --- a/drivers/gpu/drm/nouveau/core/subdev/therm/ic.c +++ b/drivers/gpu/drm/nouveau/core/subdev/therm/ic.c | |||
@@ -32,6 +32,7 @@ probe_monitoring_device(struct nouveau_i2c_port *i2c, | |||
32 | struct i2c_board_info *info) | 32 | struct i2c_board_info *info) |
33 | { | 33 | { |
34 | struct nouveau_therm_priv *priv = (void *)nouveau_therm(i2c); | 34 | struct nouveau_therm_priv *priv = (void *)nouveau_therm(i2c); |
35 | struct nvbios_therm_sensor *sensor = &priv->bios_sensor; | ||
35 | struct i2c_client *client; | 36 | struct i2c_client *client; |
36 | 37 | ||
37 | request_module("%s%s", I2C_MODULE_PREFIX, info->type); | 38 | request_module("%s%s", I2C_MODULE_PREFIX, info->type); |
@@ -46,8 +47,9 @@ probe_monitoring_device(struct nouveau_i2c_port *i2c, | |||
46 | } | 47 | } |
47 | 48 | ||
48 | nv_info(priv, | 49 | nv_info(priv, |
49 | "Found an %s at address 0x%x (controlled by lm_sensors)\n", | 50 | "Found an %s at address 0x%x (controlled by lm_sensors, " |
50 | info->type, info->addr); | 51 | "temp offset %+i C)\n", |
52 | info->type, info->addr, sensor->offset_constant); | ||
51 | priv->ic = client; | 53 | priv->ic = client; |
52 | 54 | ||
53 | return true; | 55 | return true; |
diff --git a/drivers/gpu/drm/nouveau/core/subdev/therm/nv40.c b/drivers/gpu/drm/nouveau/core/subdev/therm/nv40.c index 0f5363edb964..a70d1b7e397b 100644 --- a/drivers/gpu/drm/nouveau/core/subdev/therm/nv40.c +++ b/drivers/gpu/drm/nouveau/core/subdev/therm/nv40.c | |||
@@ -29,54 +29,83 @@ struct nv40_therm_priv { | |||
29 | struct nouveau_therm_priv base; | 29 | struct nouveau_therm_priv base; |
30 | }; | 30 | }; |
31 | 31 | ||
32 | enum nv40_sensor_style { INVALID_STYLE = -1, OLD_STYLE = 0, NEW_STYLE = 1 }; | ||
33 | |||
34 | static enum nv40_sensor_style | ||
35 | nv40_sensor_style(struct nouveau_therm *therm) | ||
36 | { | ||
37 | struct nouveau_device *device = nv_device(therm); | ||
38 | |||
39 | switch (device->chipset) { | ||
40 | case 0x43: | ||
41 | case 0x44: | ||
42 | case 0x4a: | ||
43 | case 0x47: | ||
44 | return OLD_STYLE; | ||
45 | |||
46 | case 0x46: | ||
47 | case 0x49: | ||
48 | case 0x4b: | ||
49 | case 0x4e: | ||
50 | case 0x4c: | ||
51 | case 0x67: | ||
52 | case 0x68: | ||
53 | case 0x63: | ||
54 | return NEW_STYLE; | ||
55 | default: | ||
56 | return INVALID_STYLE; | ||
57 | } | ||
58 | } | ||
59 | |||
32 | static int | 60 | static int |
33 | nv40_sensor_setup(struct nouveau_therm *therm) | 61 | nv40_sensor_setup(struct nouveau_therm *therm) |
34 | { | 62 | { |
35 | struct nouveau_device *device = nv_device(therm); | 63 | enum nv40_sensor_style style = nv40_sensor_style(therm); |
36 | 64 | ||
37 | /* enable ADC readout and disable the ALARM threshold */ | 65 | /* enable ADC readout and disable the ALARM threshold */ |
38 | if (device->chipset >= 0x46) { | 66 | if (style == NEW_STYLE) { |
39 | nv_mask(therm, 0x15b8, 0x80000000, 0); | 67 | nv_mask(therm, 0x15b8, 0x80000000, 0); |
40 | nv_wr32(therm, 0x15b0, 0x80003fff); | 68 | nv_wr32(therm, 0x15b0, 0x80003fff); |
41 | mdelay(10); /* wait for the temperature to stabilize */ | 69 | mdelay(20); /* wait for the temperature to stabilize */ |
42 | return nv_rd32(therm, 0x15b4) & 0x3fff; | 70 | return nv_rd32(therm, 0x15b4) & 0x3fff; |
43 | } else { | 71 | } else if (style == OLD_STYLE) { |
44 | nv_wr32(therm, 0x15b0, 0xff); | 72 | nv_wr32(therm, 0x15b0, 0xff); |
73 | mdelay(20); /* wait for the temperature to stabilize */ | ||
45 | return nv_rd32(therm, 0x15b4) & 0xff; | 74 | return nv_rd32(therm, 0x15b4) & 0xff; |
46 | } | 75 | } else |
76 | return -ENODEV; | ||
47 | } | 77 | } |
48 | 78 | ||
49 | static int | 79 | static int |
50 | nv40_temp_get(struct nouveau_therm *therm) | 80 | nv40_temp_get(struct nouveau_therm *therm) |
51 | { | 81 | { |
52 | struct nouveau_therm_priv *priv = (void *)therm; | 82 | struct nouveau_therm_priv *priv = (void *)therm; |
53 | struct nouveau_device *device = nv_device(therm); | ||
54 | struct nvbios_therm_sensor *sensor = &priv->bios_sensor; | 83 | struct nvbios_therm_sensor *sensor = &priv->bios_sensor; |
84 | enum nv40_sensor_style style = nv40_sensor_style(therm); | ||
55 | int core_temp; | 85 | int core_temp; |
56 | 86 | ||
57 | if (device->chipset >= 0x46) { | 87 | if (style == NEW_STYLE) { |
58 | nv_wr32(therm, 0x15b0, 0x80003fff); | 88 | nv_wr32(therm, 0x15b0, 0x80003fff); |
59 | core_temp = nv_rd32(therm, 0x15b4) & 0x3fff; | 89 | core_temp = nv_rd32(therm, 0x15b4) & 0x3fff; |
60 | } else { | 90 | } else if (style == OLD_STYLE) { |
61 | nv_wr32(therm, 0x15b0, 0xff); | 91 | nv_wr32(therm, 0x15b0, 0xff); |
62 | core_temp = nv_rd32(therm, 0x15b4) & 0xff; | 92 | core_temp = nv_rd32(therm, 0x15b4) & 0xff; |
63 | } | 93 | } else |
64 | 94 | return -ENODEV; | |
65 | /* Setup the sensor if the temperature is 0 */ | ||
66 | if (core_temp == 0) | ||
67 | core_temp = nv40_sensor_setup(therm); | ||
68 | 95 | ||
69 | if (sensor->slope_div == 0) | 96 | /* if the slope or the offset is unset, do no use the sensor */ |
70 | sensor->slope_div = 1; | 97 | if (!sensor->slope_div || !sensor->slope_mult || |
71 | if (sensor->offset_den == 0) | 98 | !sensor->offset_num || !sensor->offset_den) |
72 | sensor->offset_den = 1; | 99 | return -ENODEV; |
73 | if (sensor->slope_mult < 1) | ||
74 | sensor->slope_mult = 1; | ||
75 | 100 | ||
76 | core_temp = core_temp * sensor->slope_mult / sensor->slope_div; | 101 | core_temp = core_temp * sensor->slope_mult / sensor->slope_div; |
77 | core_temp = core_temp + sensor->offset_num / sensor->offset_den; | 102 | core_temp = core_temp + sensor->offset_num / sensor->offset_den; |
78 | core_temp = core_temp + sensor->offset_constant - 8; | 103 | core_temp = core_temp + sensor->offset_constant - 8; |
79 | 104 | ||
105 | /* reserve negative temperatures for errors */ | ||
106 | if (core_temp < 0) | ||
107 | core_temp = 0; | ||
108 | |||
80 | return core_temp; | 109 | return core_temp; |
81 | } | 110 | } |
82 | 111 | ||
diff --git a/drivers/gpu/drm/nouveau/core/subdev/therm/priv.h b/drivers/gpu/drm/nouveau/core/subdev/therm/priv.h index 06b98706b3fc..438d9824b774 100644 --- a/drivers/gpu/drm/nouveau/core/subdev/therm/priv.h +++ b/drivers/gpu/drm/nouveau/core/subdev/therm/priv.h | |||
@@ -102,7 +102,7 @@ struct nouveau_therm_priv { | |||
102 | struct i2c_client *ic; | 102 | struct i2c_client *ic; |
103 | }; | 103 | }; |
104 | 104 | ||
105 | int nouveau_therm_mode(struct nouveau_therm *therm, int mode); | 105 | int nouveau_therm_fan_mode(struct nouveau_therm *therm, int mode); |
106 | int nouveau_therm_attr_get(struct nouveau_therm *therm, | 106 | int nouveau_therm_attr_get(struct nouveau_therm *therm, |
107 | enum nouveau_therm_attr_type type); | 107 | enum nouveau_therm_attr_type type); |
108 | int nouveau_therm_attr_set(struct nouveau_therm *therm, | 108 | int nouveau_therm_attr_set(struct nouveau_therm *therm, |
@@ -122,6 +122,7 @@ int nouveau_therm_fan_sense(struct nouveau_therm *therm); | |||
122 | 122 | ||
123 | int nouveau_therm_preinit(struct nouveau_therm *); | 123 | int nouveau_therm_preinit(struct nouveau_therm *); |
124 | 124 | ||
125 | void nouveau_therm_sensor_preinit(struct nouveau_therm *); | ||
125 | void nouveau_therm_sensor_set_threshold_state(struct nouveau_therm *therm, | 126 | void nouveau_therm_sensor_set_threshold_state(struct nouveau_therm *therm, |
126 | enum nouveau_therm_thrs thrs, | 127 | enum nouveau_therm_thrs thrs, |
127 | enum nouveau_therm_thrs_state st); | 128 | enum nouveau_therm_thrs_state st); |
diff --git a/drivers/gpu/drm/nouveau/core/subdev/therm/temp.c b/drivers/gpu/drm/nouveau/core/subdev/therm/temp.c index b37624af8297..470f6a47b656 100644 --- a/drivers/gpu/drm/nouveau/core/subdev/therm/temp.c +++ b/drivers/gpu/drm/nouveau/core/subdev/therm/temp.c | |||
@@ -34,10 +34,6 @@ nouveau_therm_temp_set_defaults(struct nouveau_therm *therm) | |||
34 | { | 34 | { |
35 | struct nouveau_therm_priv *priv = (void *)therm; | 35 | struct nouveau_therm_priv *priv = (void *)therm; |
36 | 36 | ||
37 | priv->bios_sensor.slope_mult = 1; | ||
38 | priv->bios_sensor.slope_div = 1; | ||
39 | priv->bios_sensor.offset_num = 0; | ||
40 | priv->bios_sensor.offset_den = 1; | ||
41 | priv->bios_sensor.offset_constant = 0; | 37 | priv->bios_sensor.offset_constant = 0; |
42 | 38 | ||
43 | priv->bios_sensor.thrs_fan_boost.temp = 90; | 39 | priv->bios_sensor.thrs_fan_boost.temp = 90; |
@@ -60,11 +56,6 @@ nouveau_therm_temp_safety_checks(struct nouveau_therm *therm) | |||
60 | struct nouveau_therm_priv *priv = (void *)therm; | 56 | struct nouveau_therm_priv *priv = (void *)therm; |
61 | struct nvbios_therm_sensor *s = &priv->bios_sensor; | 57 | struct nvbios_therm_sensor *s = &priv->bios_sensor; |
62 | 58 | ||
63 | if (!priv->bios_sensor.slope_div) | ||
64 | priv->bios_sensor.slope_div = 1; | ||
65 | if (!priv->bios_sensor.offset_den) | ||
66 | priv->bios_sensor.offset_den = 1; | ||
67 | |||
68 | /* enforce a minimum hysteresis on thresholds */ | 59 | /* enforce a minimum hysteresis on thresholds */ |
69 | s->thrs_fan_boost.hysteresis = max_t(u8, s->thrs_fan_boost.hysteresis, 2); | 60 | s->thrs_fan_boost.hysteresis = max_t(u8, s->thrs_fan_boost.hysteresis, 2); |
70 | s->thrs_down_clock.hysteresis = max_t(u8, s->thrs_down_clock.hysteresis, 2); | 61 | s->thrs_down_clock.hysteresis = max_t(u8, s->thrs_down_clock.hysteresis, 2); |
@@ -106,16 +97,16 @@ void nouveau_therm_sensor_event(struct nouveau_therm *therm, | |||
106 | const char *thresolds[] = { | 97 | const char *thresolds[] = { |
107 | "fanboost", "downclock", "critical", "shutdown" | 98 | "fanboost", "downclock", "critical", "shutdown" |
108 | }; | 99 | }; |
109 | uint8_t temperature = therm->temp_get(therm); | 100 | int temperature = therm->temp_get(therm); |
110 | 101 | ||
111 | if (thrs < 0 || thrs > 3) | 102 | if (thrs < 0 || thrs > 3) |
112 | return; | 103 | return; |
113 | 104 | ||
114 | if (dir == NOUVEAU_THERM_THRS_FALLING) | 105 | if (dir == NOUVEAU_THERM_THRS_FALLING) |
115 | nv_info(therm, "temperature (%u C) went below the '%s' threshold\n", | 106 | nv_info(therm, "temperature (%i C) went below the '%s' threshold\n", |
116 | temperature, thresolds[thrs]); | 107 | temperature, thresolds[thrs]); |
117 | else | 108 | else |
118 | nv_info(therm, "temperature (%u C) hit the '%s' threshold\n", | 109 | nv_info(therm, "temperature (%i C) hit the '%s' threshold\n", |
119 | temperature, thresolds[thrs]); | 110 | temperature, thresolds[thrs]); |
120 | 111 | ||
121 | active = (dir == NOUVEAU_THERM_THRS_RISING); | 112 | active = (dir == NOUVEAU_THERM_THRS_RISING); |
@@ -123,7 +114,7 @@ void nouveau_therm_sensor_event(struct nouveau_therm *therm, | |||
123 | case NOUVEAU_THERM_THRS_FANBOOST: | 114 | case NOUVEAU_THERM_THRS_FANBOOST: |
124 | if (active) { | 115 | if (active) { |
125 | nouveau_therm_fan_set(therm, true, 100); | 116 | nouveau_therm_fan_set(therm, true, 100); |
126 | nouveau_therm_mode(therm, NOUVEAU_THERM_CTRL_AUTO); | 117 | nouveau_therm_fan_mode(therm, NOUVEAU_THERM_CTRL_AUTO); |
127 | } | 118 | } |
128 | break; | 119 | break; |
129 | case NOUVEAU_THERM_THRS_DOWNCLOCK: | 120 | case NOUVEAU_THERM_THRS_DOWNCLOCK: |
@@ -202,7 +193,7 @@ alarm_timer_callback(struct nouveau_alarm *alarm) | |||
202 | NOUVEAU_THERM_THRS_SHUTDOWN); | 193 | NOUVEAU_THERM_THRS_SHUTDOWN); |
203 | 194 | ||
204 | /* schedule the next poll in one second */ | 195 | /* schedule the next poll in one second */ |
205 | if (list_empty(&alarm->head)) | 196 | if (therm->temp_get(therm) >= 0 && list_empty(&alarm->head)) |
206 | ptimer->alarm(ptimer, 1000 * 1000 * 1000, alarm); | 197 | ptimer->alarm(ptimer, 1000 * 1000 * 1000, alarm); |
207 | 198 | ||
208 | spin_unlock_irqrestore(&priv->sensor.alarm_program_lock, flags); | 199 | spin_unlock_irqrestore(&priv->sensor.alarm_program_lock, flags); |
@@ -225,6 +216,17 @@ nouveau_therm_program_alarms_polling(struct nouveau_therm *therm) | |||
225 | alarm_timer_callback(&priv->sensor.therm_poll_alarm); | 216 | alarm_timer_callback(&priv->sensor.therm_poll_alarm); |
226 | } | 217 | } |
227 | 218 | ||
219 | void | ||
220 | nouveau_therm_sensor_preinit(struct nouveau_therm *therm) | ||
221 | { | ||
222 | const char *sensor_avail = "yes"; | ||
223 | |||
224 | if (therm->temp_get(therm) < 0) | ||
225 | sensor_avail = "no"; | ||
226 | |||
227 | nv_info(therm, "internal sensor: %s\n", sensor_avail); | ||
228 | } | ||
229 | |||
228 | int | 230 | int |
229 | nouveau_therm_sensor_ctor(struct nouveau_therm *therm) | 231 | nouveau_therm_sensor_ctor(struct nouveau_therm *therm) |
230 | { | 232 | { |
diff --git a/drivers/gpu/drm/nouveau/nouveau_abi16.c b/drivers/gpu/drm/nouveau/nouveau_abi16.c index 41241922263f..3b6dc883e150 100644 --- a/drivers/gpu/drm/nouveau/nouveau_abi16.c +++ b/drivers/gpu/drm/nouveau/nouveau_abi16.c | |||
@@ -116,6 +116,11 @@ nouveau_abi16_chan_fini(struct nouveau_abi16 *abi16, | |||
116 | { | 116 | { |
117 | struct nouveau_abi16_ntfy *ntfy, *temp; | 117 | struct nouveau_abi16_ntfy *ntfy, *temp; |
118 | 118 | ||
119 | /* wait for all activity to stop before releasing notify object, which | ||
120 | * may be still in use */ | ||
121 | if (chan->chan && chan->ntfy) | ||
122 | nouveau_channel_idle(chan->chan); | ||
123 | |||
119 | /* cleanup notifier state */ | 124 | /* cleanup notifier state */ |
120 | list_for_each_entry_safe(ntfy, temp, &chan->notifiers, head) { | 125 | list_for_each_entry_safe(ntfy, temp, &chan->notifiers, head) { |
121 | nouveau_abi16_ntfy_fini(chan, ntfy); | 126 | nouveau_abi16_ntfy_fini(chan, ntfy); |
diff --git a/drivers/gpu/drm/nouveau/nouveau_bo.c b/drivers/gpu/drm/nouveau/nouveau_bo.c index 11ca82148edc..7ff10711a4d0 100644 --- a/drivers/gpu/drm/nouveau/nouveau_bo.c +++ b/drivers/gpu/drm/nouveau/nouveau_bo.c | |||
@@ -801,7 +801,7 @@ nv50_bo_move_m2mf(struct nouveau_channel *chan, struct ttm_buffer_object *bo, | |||
801 | stride = 16 * 4; | 801 | stride = 16 * 4; |
802 | height = amount / stride; | 802 | height = amount / stride; |
803 | 803 | ||
804 | if (new_mem->mem_type == TTM_PL_VRAM && | 804 | if (old_mem->mem_type == TTM_PL_VRAM && |
805 | nouveau_bo_tile_layout(nvbo)) { | 805 | nouveau_bo_tile_layout(nvbo)) { |
806 | ret = RING_SPACE(chan, 8); | 806 | ret = RING_SPACE(chan, 8); |
807 | if (ret) | 807 | if (ret) |
@@ -823,7 +823,7 @@ nv50_bo_move_m2mf(struct nouveau_channel *chan, struct ttm_buffer_object *bo, | |||
823 | BEGIN_NV04(chan, NvSubCopy, 0x0200, 1); | 823 | BEGIN_NV04(chan, NvSubCopy, 0x0200, 1); |
824 | OUT_RING (chan, 1); | 824 | OUT_RING (chan, 1); |
825 | } | 825 | } |
826 | if (old_mem->mem_type == TTM_PL_VRAM && | 826 | if (new_mem->mem_type == TTM_PL_VRAM && |
827 | nouveau_bo_tile_layout(nvbo)) { | 827 | nouveau_bo_tile_layout(nvbo)) { |
828 | ret = RING_SPACE(chan, 8); | 828 | ret = RING_SPACE(chan, 8); |
829 | if (ret) | 829 | if (ret) |
diff --git a/drivers/gpu/drm/nouveau/nouveau_pm.c b/drivers/gpu/drm/nouveau/nouveau_pm.c index bb54098c6d97..936b442a6ab7 100644 --- a/drivers/gpu/drm/nouveau/nouveau_pm.c +++ b/drivers/gpu/drm/nouveau/nouveau_pm.c | |||
@@ -402,8 +402,12 @@ nouveau_hwmon_show_temp(struct device *d, struct device_attribute *a, char *buf) | |||
402 | struct drm_device *dev = dev_get_drvdata(d); | 402 | struct drm_device *dev = dev_get_drvdata(d); |
403 | struct nouveau_drm *drm = nouveau_drm(dev); | 403 | struct nouveau_drm *drm = nouveau_drm(dev); |
404 | struct nouveau_therm *therm = nouveau_therm(drm->device); | 404 | struct nouveau_therm *therm = nouveau_therm(drm->device); |
405 | int temp = therm->temp_get(therm); | ||
405 | 406 | ||
406 | return snprintf(buf, PAGE_SIZE, "%d\n", therm->temp_get(therm) * 1000); | 407 | if (temp < 0) |
408 | return temp; | ||
409 | |||
410 | return snprintf(buf, PAGE_SIZE, "%d\n", temp * 1000); | ||
407 | } | 411 | } |
408 | static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, nouveau_hwmon_show_temp, | 412 | static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, nouveau_hwmon_show_temp, |
409 | NULL, 0); | 413 | NULL, 0); |
@@ -871,7 +875,12 @@ static SENSOR_DEVICE_ATTR(pwm1_max, S_IRUGO | S_IWUSR, | |||
871 | nouveau_hwmon_get_pwm1_max, | 875 | nouveau_hwmon_get_pwm1_max, |
872 | nouveau_hwmon_set_pwm1_max, 0); | 876 | nouveau_hwmon_set_pwm1_max, 0); |
873 | 877 | ||
874 | static struct attribute *hwmon_attributes[] = { | 878 | static struct attribute *hwmon_default_attributes[] = { |
879 | &sensor_dev_attr_name.dev_attr.attr, | ||
880 | &sensor_dev_attr_update_rate.dev_attr.attr, | ||
881 | NULL | ||
882 | }; | ||
883 | static struct attribute *hwmon_temp_attributes[] = { | ||
875 | &sensor_dev_attr_temp1_input.dev_attr.attr, | 884 | &sensor_dev_attr_temp1_input.dev_attr.attr, |
876 | &sensor_dev_attr_temp1_auto_point1_pwm.dev_attr.attr, | 885 | &sensor_dev_attr_temp1_auto_point1_pwm.dev_attr.attr, |
877 | &sensor_dev_attr_temp1_auto_point1_temp.dev_attr.attr, | 886 | &sensor_dev_attr_temp1_auto_point1_temp.dev_attr.attr, |
@@ -882,8 +891,6 @@ static struct attribute *hwmon_attributes[] = { | |||
882 | &sensor_dev_attr_temp1_crit_hyst.dev_attr.attr, | 891 | &sensor_dev_attr_temp1_crit_hyst.dev_attr.attr, |
883 | &sensor_dev_attr_temp1_emergency.dev_attr.attr, | 892 | &sensor_dev_attr_temp1_emergency.dev_attr.attr, |
884 | &sensor_dev_attr_temp1_emergency_hyst.dev_attr.attr, | 893 | &sensor_dev_attr_temp1_emergency_hyst.dev_attr.attr, |
885 | &sensor_dev_attr_name.dev_attr.attr, | ||
886 | &sensor_dev_attr_update_rate.dev_attr.attr, | ||
887 | NULL | 894 | NULL |
888 | }; | 895 | }; |
889 | static struct attribute *hwmon_fan_rpm_attributes[] = { | 896 | static struct attribute *hwmon_fan_rpm_attributes[] = { |
@@ -898,8 +905,11 @@ static struct attribute *hwmon_pwm_fan_attributes[] = { | |||
898 | NULL | 905 | NULL |
899 | }; | 906 | }; |
900 | 907 | ||
901 | static const struct attribute_group hwmon_attrgroup = { | 908 | static const struct attribute_group hwmon_default_attrgroup = { |
902 | .attrs = hwmon_attributes, | 909 | .attrs = hwmon_default_attributes, |
910 | }; | ||
911 | static const struct attribute_group hwmon_temp_attrgroup = { | ||
912 | .attrs = hwmon_temp_attributes, | ||
903 | }; | 913 | }; |
904 | static const struct attribute_group hwmon_fan_rpm_attrgroup = { | 914 | static const struct attribute_group hwmon_fan_rpm_attrgroup = { |
905 | .attrs = hwmon_fan_rpm_attributes, | 915 | .attrs = hwmon_fan_rpm_attributes, |
@@ -931,13 +941,22 @@ nouveau_hwmon_init(struct drm_device *dev) | |||
931 | } | 941 | } |
932 | dev_set_drvdata(hwmon_dev, dev); | 942 | dev_set_drvdata(hwmon_dev, dev); |
933 | 943 | ||
934 | /* default sysfs entries */ | 944 | /* set the default attributes */ |
935 | ret = sysfs_create_group(&hwmon_dev->kobj, &hwmon_attrgroup); | 945 | ret = sysfs_create_group(&hwmon_dev->kobj, &hwmon_default_attrgroup); |
936 | if (ret) { | 946 | if (ret) { |
937 | if (ret) | 947 | if (ret) |
938 | goto error; | 948 | goto error; |
939 | } | 949 | } |
940 | 950 | ||
951 | /* if the card has a working thermal sensor */ | ||
952 | if (therm->temp_get(therm) >= 0) { | ||
953 | ret = sysfs_create_group(&hwmon_dev->kobj, &hwmon_temp_attrgroup); | ||
954 | if (ret) { | ||
955 | if (ret) | ||
956 | goto error; | ||
957 | } | ||
958 | } | ||
959 | |||
941 | /* if the card has a pwm fan */ | 960 | /* if the card has a pwm fan */ |
942 | /*XXX: incorrect, need better detection for this, some boards have | 961 | /*XXX: incorrect, need better detection for this, some boards have |
943 | * the gpio entries for pwm fan control even when there's no | 962 | * the gpio entries for pwm fan control even when there's no |
@@ -979,11 +998,10 @@ nouveau_hwmon_fini(struct drm_device *dev) | |||
979 | struct nouveau_pm *pm = nouveau_pm(dev); | 998 | struct nouveau_pm *pm = nouveau_pm(dev); |
980 | 999 | ||
981 | if (pm->hwmon) { | 1000 | if (pm->hwmon) { |
982 | sysfs_remove_group(&pm->hwmon->kobj, &hwmon_attrgroup); | 1001 | sysfs_remove_group(&pm->hwmon->kobj, &hwmon_default_attrgroup); |
983 | sysfs_remove_group(&pm->hwmon->kobj, | 1002 | sysfs_remove_group(&pm->hwmon->kobj, &hwmon_temp_attrgroup); |
984 | &hwmon_pwm_fan_attrgroup); | 1003 | sysfs_remove_group(&pm->hwmon->kobj, &hwmon_pwm_fan_attrgroup); |
985 | sysfs_remove_group(&pm->hwmon->kobj, | 1004 | sysfs_remove_group(&pm->hwmon->kobj, &hwmon_fan_rpm_attrgroup); |
986 | &hwmon_fan_rpm_attrgroup); | ||
987 | 1005 | ||
988 | hwmon_device_unregister(pm->hwmon); | 1006 | hwmon_device_unregister(pm->hwmon); |
989 | } | 1007 | } |
diff --git a/drivers/gpu/drm/nouveau/nv50_display.c b/drivers/gpu/drm/nouveau/nv50_display.c index 87a5a56ed358..7f0e6c3f37d1 100644 --- a/drivers/gpu/drm/nouveau/nv50_display.c +++ b/drivers/gpu/drm/nouveau/nv50_display.c | |||
@@ -524,6 +524,8 @@ nv50_display_flip_next(struct drm_crtc *crtc, struct drm_framebuffer *fb, | |||
524 | swap_interval <<= 4; | 524 | swap_interval <<= 4; |
525 | if (swap_interval == 0) | 525 | if (swap_interval == 0) |
526 | swap_interval |= 0x100; | 526 | swap_interval |= 0x100; |
527 | if (chan == NULL) | ||
528 | evo_sync(crtc->dev); | ||
527 | 529 | ||
528 | push = evo_wait(sync, 128); | 530 | push = evo_wait(sync, 128); |
529 | if (unlikely(push == NULL)) | 531 | if (unlikely(push == NULL)) |
@@ -586,8 +588,6 @@ nv50_display_flip_next(struct drm_crtc *crtc, struct drm_framebuffer *fb, | |||
586 | sync->addr ^= 0x10; | 588 | sync->addr ^= 0x10; |
587 | sync->data++; | 589 | sync->data++; |
588 | FIRE_RING (chan); | 590 | FIRE_RING (chan); |
589 | } else { | ||
590 | evo_sync(crtc->dev); | ||
591 | } | 591 | } |
592 | 592 | ||
593 | /* queue the flip */ | 593 | /* queue the flip */ |
@@ -2276,6 +2276,7 @@ nv50_display_create(struct drm_device *dev) | |||
2276 | NV_WARN(drm, "failed to create encoder %d/%d/%d: %d\n", | 2276 | NV_WARN(drm, "failed to create encoder %d/%d/%d: %d\n", |
2277 | dcbe->location, dcbe->type, | 2277 | dcbe->location, dcbe->type, |
2278 | ffs(dcbe->or) - 1, ret); | 2278 | ffs(dcbe->or) - 1, ret); |
2279 | ret = 0; | ||
2279 | } | 2280 | } |
2280 | } | 2281 | } |
2281 | 2282 | ||
diff --git a/drivers/gpu/drm/radeon/ni.c b/drivers/gpu/drm/radeon/ni.c index d4c633e12863..27769e724b6d 100644 --- a/drivers/gpu/drm/radeon/ni.c +++ b/drivers/gpu/drm/radeon/ni.c | |||
@@ -468,13 +468,19 @@ static void cayman_gpu_init(struct radeon_device *rdev) | |||
468 | (rdev->pdev->device == 0x9907) || | 468 | (rdev->pdev->device == 0x9907) || |
469 | (rdev->pdev->device == 0x9908) || | 469 | (rdev->pdev->device == 0x9908) || |
470 | (rdev->pdev->device == 0x9909) || | 470 | (rdev->pdev->device == 0x9909) || |
471 | (rdev->pdev->device == 0x990B) || | ||
472 | (rdev->pdev->device == 0x990C) || | ||
473 | (rdev->pdev->device == 0x990F) || | ||
471 | (rdev->pdev->device == 0x9910) || | 474 | (rdev->pdev->device == 0x9910) || |
472 | (rdev->pdev->device == 0x9917)) { | 475 | (rdev->pdev->device == 0x9917) || |
476 | (rdev->pdev->device == 0x9999)) { | ||
473 | rdev->config.cayman.max_simds_per_se = 6; | 477 | rdev->config.cayman.max_simds_per_se = 6; |
474 | rdev->config.cayman.max_backends_per_se = 2; | 478 | rdev->config.cayman.max_backends_per_se = 2; |
475 | } else if ((rdev->pdev->device == 0x9903) || | 479 | } else if ((rdev->pdev->device == 0x9903) || |
476 | (rdev->pdev->device == 0x9904) || | 480 | (rdev->pdev->device == 0x9904) || |
477 | (rdev->pdev->device == 0x990A) || | 481 | (rdev->pdev->device == 0x990A) || |
482 | (rdev->pdev->device == 0x990D) || | ||
483 | (rdev->pdev->device == 0x990E) || | ||
478 | (rdev->pdev->device == 0x9913) || | 484 | (rdev->pdev->device == 0x9913) || |
479 | (rdev->pdev->device == 0x9918)) { | 485 | (rdev->pdev->device == 0x9918)) { |
480 | rdev->config.cayman.max_simds_per_se = 4; | 486 | rdev->config.cayman.max_simds_per_se = 4; |
@@ -483,6 +489,9 @@ static void cayman_gpu_init(struct radeon_device *rdev) | |||
483 | (rdev->pdev->device == 0x9990) || | 489 | (rdev->pdev->device == 0x9990) || |
484 | (rdev->pdev->device == 0x9991) || | 490 | (rdev->pdev->device == 0x9991) || |
485 | (rdev->pdev->device == 0x9994) || | 491 | (rdev->pdev->device == 0x9994) || |
492 | (rdev->pdev->device == 0x9995) || | ||
493 | (rdev->pdev->device == 0x9996) || | ||
494 | (rdev->pdev->device == 0x999A) || | ||
486 | (rdev->pdev->device == 0x99A0)) { | 495 | (rdev->pdev->device == 0x99A0)) { |
487 | rdev->config.cayman.max_simds_per_se = 3; | 496 | rdev->config.cayman.max_simds_per_se = 3; |
488 | rdev->config.cayman.max_backends_per_se = 1; | 497 | rdev->config.cayman.max_backends_per_se = 1; |
@@ -616,11 +625,22 @@ static void cayman_gpu_init(struct radeon_device *rdev) | |||
616 | WREG32(DMA_TILING_CONFIG + DMA0_REGISTER_OFFSET, gb_addr_config); | 625 | WREG32(DMA_TILING_CONFIG + DMA0_REGISTER_OFFSET, gb_addr_config); |
617 | WREG32(DMA_TILING_CONFIG + DMA1_REGISTER_OFFSET, gb_addr_config); | 626 | WREG32(DMA_TILING_CONFIG + DMA1_REGISTER_OFFSET, gb_addr_config); |
618 | 627 | ||
619 | tmp = gb_addr_config & NUM_PIPES_MASK; | 628 | if ((rdev->config.cayman.max_backends_per_se == 1) && |
620 | tmp = r6xx_remap_render_backend(rdev, tmp, | 629 | (rdev->flags & RADEON_IS_IGP)) { |
621 | rdev->config.cayman.max_backends_per_se * | 630 | if ((disabled_rb_mask & 3) == 1) { |
622 | rdev->config.cayman.max_shader_engines, | 631 | /* RB0 disabled, RB1 enabled */ |
623 | CAYMAN_MAX_BACKENDS, disabled_rb_mask); | 632 | tmp = 0x11111111; |
633 | } else { | ||
634 | /* RB1 disabled, RB0 enabled */ | ||
635 | tmp = 0x00000000; | ||
636 | } | ||
637 | } else { | ||
638 | tmp = gb_addr_config & NUM_PIPES_MASK; | ||
639 | tmp = r6xx_remap_render_backend(rdev, tmp, | ||
640 | rdev->config.cayman.max_backends_per_se * | ||
641 | rdev->config.cayman.max_shader_engines, | ||
642 | CAYMAN_MAX_BACKENDS, disabled_rb_mask); | ||
643 | } | ||
624 | WREG32(GB_BACKEND_MAP, tmp); | 644 | WREG32(GB_BACKEND_MAP, tmp); |
625 | 645 | ||
626 | cgts_tcc_disable = 0xffff0000; | 646 | cgts_tcc_disable = 0xffff0000; |
@@ -1771,6 +1791,7 @@ int cayman_resume(struct radeon_device *rdev) | |||
1771 | int cayman_suspend(struct radeon_device *rdev) | 1791 | int cayman_suspend(struct radeon_device *rdev) |
1772 | { | 1792 | { |
1773 | r600_audio_fini(rdev); | 1793 | r600_audio_fini(rdev); |
1794 | radeon_vm_manager_fini(rdev); | ||
1774 | cayman_cp_enable(rdev, false); | 1795 | cayman_cp_enable(rdev, false); |
1775 | cayman_dma_stop(rdev); | 1796 | cayman_dma_stop(rdev); |
1776 | evergreen_irq_suspend(rdev); | 1797 | evergreen_irq_suspend(rdev); |
diff --git a/drivers/gpu/drm/radeon/radeon_benchmark.c b/drivers/gpu/drm/radeon/radeon_benchmark.c index bedda9caadd9..6e05a2e75a46 100644 --- a/drivers/gpu/drm/radeon/radeon_benchmark.c +++ b/drivers/gpu/drm/radeon/radeon_benchmark.c | |||
@@ -122,10 +122,7 @@ static void radeon_benchmark_move(struct radeon_device *rdev, unsigned size, | |||
122 | goto out_cleanup; | 122 | goto out_cleanup; |
123 | } | 123 | } |
124 | 124 | ||
125 | /* r100 doesn't have dma engine so skip the test */ | 125 | if (rdev->asic->copy.dma) { |
126 | /* also, VRAM-to-VRAM test doesn't make much sense for DMA */ | ||
127 | /* skip it as well if domains are the same */ | ||
128 | if ((rdev->asic->copy.dma) && (sdomain != ddomain)) { | ||
129 | time = radeon_benchmark_do_move(rdev, size, saddr, daddr, | 126 | time = radeon_benchmark_do_move(rdev, size, saddr, daddr, |
130 | RADEON_BENCHMARK_COPY_DMA, n); | 127 | RADEON_BENCHMARK_COPY_DMA, n); |
131 | if (time < 0) | 128 | if (time < 0) |
@@ -135,13 +132,15 @@ static void radeon_benchmark_move(struct radeon_device *rdev, unsigned size, | |||
135 | sdomain, ddomain, "dma"); | 132 | sdomain, ddomain, "dma"); |
136 | } | 133 | } |
137 | 134 | ||
138 | time = radeon_benchmark_do_move(rdev, size, saddr, daddr, | 135 | if (rdev->asic->copy.blit) { |
139 | RADEON_BENCHMARK_COPY_BLIT, n); | 136 | time = radeon_benchmark_do_move(rdev, size, saddr, daddr, |
140 | if (time < 0) | 137 | RADEON_BENCHMARK_COPY_BLIT, n); |
141 | goto out_cleanup; | 138 | if (time < 0) |
142 | if (time > 0) | 139 | goto out_cleanup; |
143 | radeon_benchmark_log_results(n, size, time, | 140 | if (time > 0) |
144 | sdomain, ddomain, "blit"); | 141 | radeon_benchmark_log_results(n, size, time, |
142 | sdomain, ddomain, "blit"); | ||
143 | } | ||
145 | 144 | ||
146 | out_cleanup: | 145 | out_cleanup: |
147 | if (sobj) { | 146 | if (sobj) { |
diff --git a/drivers/gpu/drm/radeon/si.c b/drivers/gpu/drm/radeon/si.c index 9128120da044..bafbe3216952 100644 --- a/drivers/gpu/drm/radeon/si.c +++ b/drivers/gpu/drm/radeon/si.c | |||
@@ -4469,6 +4469,7 @@ int si_resume(struct radeon_device *rdev) | |||
4469 | 4469 | ||
4470 | int si_suspend(struct radeon_device *rdev) | 4470 | int si_suspend(struct radeon_device *rdev) |
4471 | { | 4471 | { |
4472 | radeon_vm_manager_fini(rdev); | ||
4472 | si_cp_enable(rdev, false); | 4473 | si_cp_enable(rdev, false); |
4473 | cayman_dma_stop(rdev); | 4474 | cayman_dma_stop(rdev); |
4474 | si_irq_suspend(rdev); | 4475 | si_irq_suspend(rdev); |
diff --git a/drivers/hwmon/lineage-pem.c b/drivers/hwmon/lineage-pem.c index 41df29f59b0e..ebbb9f4f27a3 100644 --- a/drivers/hwmon/lineage-pem.c +++ b/drivers/hwmon/lineage-pem.c | |||
@@ -422,6 +422,7 @@ static struct attribute *pem_input_attributes[] = { | |||
422 | &sensor_dev_attr_in2_input.dev_attr.attr, | 422 | &sensor_dev_attr_in2_input.dev_attr.attr, |
423 | &sensor_dev_attr_curr1_input.dev_attr.attr, | 423 | &sensor_dev_attr_curr1_input.dev_attr.attr, |
424 | &sensor_dev_attr_power1_input.dev_attr.attr, | 424 | &sensor_dev_attr_power1_input.dev_attr.attr, |
425 | NULL | ||
425 | }; | 426 | }; |
426 | 427 | ||
427 | static const struct attribute_group pem_input_group = { | 428 | static const struct attribute_group pem_input_group = { |
@@ -432,6 +433,7 @@ static struct attribute *pem_fan_attributes[] = { | |||
432 | &sensor_dev_attr_fan1_input.dev_attr.attr, | 433 | &sensor_dev_attr_fan1_input.dev_attr.attr, |
433 | &sensor_dev_attr_fan2_input.dev_attr.attr, | 434 | &sensor_dev_attr_fan2_input.dev_attr.attr, |
434 | &sensor_dev_attr_fan3_input.dev_attr.attr, | 435 | &sensor_dev_attr_fan3_input.dev_attr.attr, |
436 | NULL | ||
435 | }; | 437 | }; |
436 | 438 | ||
437 | static const struct attribute_group pem_fan_group = { | 439 | static const struct attribute_group pem_fan_group = { |
diff --git a/drivers/hwmon/lm75.h b/drivers/hwmon/lm75.h index 668ff4721323..5cde94e56f17 100644 --- a/drivers/hwmon/lm75.h +++ b/drivers/hwmon/lm75.h | |||
@@ -25,7 +25,7 @@ | |||
25 | which contains this code, we don't worry about the wasted space. | 25 | which contains this code, we don't worry about the wasted space. |
26 | */ | 26 | */ |
27 | 27 | ||
28 | #include <linux/hwmon.h> | 28 | #include <linux/kernel.h> |
29 | 29 | ||
30 | /* straight from the datasheet */ | 30 | /* straight from the datasheet */ |
31 | #define LM75_TEMP_MIN (-55000) | 31 | #define LM75_TEMP_MIN (-55000) |
diff --git a/drivers/hwmon/pmbus/ltc2978.c b/drivers/hwmon/pmbus/ltc2978.c index a58de38e23d8..6d6130752f94 100644 --- a/drivers/hwmon/pmbus/ltc2978.c +++ b/drivers/hwmon/pmbus/ltc2978.c | |||
@@ -59,7 +59,7 @@ enum chips { ltc2978, ltc3880 }; | |||
59 | struct ltc2978_data { | 59 | struct ltc2978_data { |
60 | enum chips id; | 60 | enum chips id; |
61 | int vin_min, vin_max; | 61 | int vin_min, vin_max; |
62 | int temp_min, temp_max; | 62 | int temp_min, temp_max[2]; |
63 | int vout_min[8], vout_max[8]; | 63 | int vout_min[8], vout_max[8]; |
64 | int iout_max[2]; | 64 | int iout_max[2]; |
65 | int temp2_max; | 65 | int temp2_max; |
@@ -113,9 +113,10 @@ static int ltc2978_read_word_data_common(struct i2c_client *client, int page, | |||
113 | ret = pmbus_read_word_data(client, page, | 113 | ret = pmbus_read_word_data(client, page, |
114 | LTC2978_MFR_TEMPERATURE_PEAK); | 114 | LTC2978_MFR_TEMPERATURE_PEAK); |
115 | if (ret >= 0) { | 115 | if (ret >= 0) { |
116 | if (lin11_to_val(ret) > lin11_to_val(data->temp_max)) | 116 | if (lin11_to_val(ret) |
117 | data->temp_max = ret; | 117 | > lin11_to_val(data->temp_max[page])) |
118 | ret = data->temp_max; | 118 | data->temp_max[page] = ret; |
119 | ret = data->temp_max[page]; | ||
119 | } | 120 | } |
120 | break; | 121 | break; |
121 | case PMBUS_VIRT_RESET_VOUT_HISTORY: | 122 | case PMBUS_VIRT_RESET_VOUT_HISTORY: |
@@ -266,7 +267,7 @@ static int ltc2978_write_word_data(struct i2c_client *client, int page, | |||
266 | break; | 267 | break; |
267 | case PMBUS_VIRT_RESET_TEMP_HISTORY: | 268 | case PMBUS_VIRT_RESET_TEMP_HISTORY: |
268 | data->temp_min = 0x7bff; | 269 | data->temp_min = 0x7bff; |
269 | data->temp_max = 0x7c00; | 270 | data->temp_max[page] = 0x7c00; |
270 | ret = ltc2978_clear_peaks(client, page, data->id); | 271 | ret = ltc2978_clear_peaks(client, page, data->id); |
271 | break; | 272 | break; |
272 | default: | 273 | default: |
@@ -323,7 +324,8 @@ static int ltc2978_probe(struct i2c_client *client, | |||
323 | data->vin_min = 0x7bff; | 324 | data->vin_min = 0x7bff; |
324 | data->vin_max = 0x7c00; | 325 | data->vin_max = 0x7c00; |
325 | data->temp_min = 0x7bff; | 326 | data->temp_min = 0x7bff; |
326 | data->temp_max = 0x7c00; | 327 | for (i = 0; i < ARRAY_SIZE(data->temp_max); i++) |
328 | data->temp_max[i] = 0x7c00; | ||
327 | data->temp2_max = 0x7c00; | 329 | data->temp2_max = 0x7c00; |
328 | 330 | ||
329 | switch (data->id) { | 331 | switch (data->id) { |
diff --git a/drivers/hwmon/pmbus/pmbus_core.c b/drivers/hwmon/pmbus/pmbus_core.c index 80eef50c50fd..9add60920ac0 100644 --- a/drivers/hwmon/pmbus/pmbus_core.c +++ b/drivers/hwmon/pmbus/pmbus_core.c | |||
@@ -766,12 +766,14 @@ static ssize_t pmbus_show_label(struct device *dev, | |||
766 | static int pmbus_add_attribute(struct pmbus_data *data, struct attribute *attr) | 766 | static int pmbus_add_attribute(struct pmbus_data *data, struct attribute *attr) |
767 | { | 767 | { |
768 | if (data->num_attributes >= data->max_attributes - 1) { | 768 | if (data->num_attributes >= data->max_attributes - 1) { |
769 | data->max_attributes += PMBUS_ATTR_ALLOC_SIZE; | 769 | int new_max_attrs = data->max_attributes + PMBUS_ATTR_ALLOC_SIZE; |
770 | data->group.attrs = krealloc(data->group.attrs, | 770 | void *new_attrs = krealloc(data->group.attrs, |
771 | sizeof(struct attribute *) * | 771 | new_max_attrs * sizeof(void *), |
772 | data->max_attributes, GFP_KERNEL); | 772 | GFP_KERNEL); |
773 | if (data->group.attrs == NULL) | 773 | if (!new_attrs) |
774 | return -ENOMEM; | 774 | return -ENOMEM; |
775 | data->group.attrs = new_attrs; | ||
776 | data->max_attributes = new_max_attrs; | ||
775 | } | 777 | } |
776 | 778 | ||
777 | data->group.attrs[data->num_attributes++] = attr; | 779 | data->group.attrs[data->num_attributes++] = attr; |
diff --git a/drivers/i2c/Kconfig b/drivers/i2c/Kconfig index 46cde098c11c..e380c6eef3af 100644 --- a/drivers/i2c/Kconfig +++ b/drivers/i2c/Kconfig | |||
@@ -4,7 +4,6 @@ | |||
4 | 4 | ||
5 | menuconfig I2C | 5 | menuconfig I2C |
6 | tristate "I2C support" | 6 | tristate "I2C support" |
7 | depends on !S390 | ||
8 | select RT_MUTEXES | 7 | select RT_MUTEXES |
9 | ---help--- | 8 | ---help--- |
10 | I2C (pronounce: I-squared-C) is a slow serial bus protocol used in | 9 | I2C (pronounce: I-squared-C) is a slow serial bus protocol used in |
@@ -76,6 +75,7 @@ config I2C_HELPER_AUTO | |||
76 | 75 | ||
77 | config I2C_SMBUS | 76 | config I2C_SMBUS |
78 | tristate "SMBus-specific protocols" if !I2C_HELPER_AUTO | 77 | tristate "SMBus-specific protocols" if !I2C_HELPER_AUTO |
78 | depends on GENERIC_HARDIRQS | ||
79 | help | 79 | help |
80 | Say Y here if you want support for SMBus extensions to the I2C | 80 | Say Y here if you want support for SMBus extensions to the I2C |
81 | specification. At the moment, the only supported extension is | 81 | specification. At the moment, the only supported extension is |
diff --git a/drivers/i2c/busses/Kconfig b/drivers/i2c/busses/Kconfig index a3725de92384..adfee98486b1 100644 --- a/drivers/i2c/busses/Kconfig +++ b/drivers/i2c/busses/Kconfig | |||
@@ -114,7 +114,7 @@ config I2C_I801 | |||
114 | 114 | ||
115 | config I2C_ISCH | 115 | config I2C_ISCH |
116 | tristate "Intel SCH SMBus 1.0" | 116 | tristate "Intel SCH SMBus 1.0" |
117 | depends on PCI | 117 | depends on PCI && GENERIC_HARDIRQS |
118 | select LPC_SCH | 118 | select LPC_SCH |
119 | help | 119 | help |
120 | Say Y here if you want to use SMBus controller on the Intel SCH | 120 | Say Y here if you want to use SMBus controller on the Intel SCH |
@@ -543,6 +543,7 @@ config I2C_NUC900 | |||
543 | 543 | ||
544 | config I2C_OCORES | 544 | config I2C_OCORES |
545 | tristate "OpenCores I2C Controller" | 545 | tristate "OpenCores I2C Controller" |
546 | depends on GENERIC_HARDIRQS | ||
546 | help | 547 | help |
547 | If you say yes to this option, support will be included for the | 548 | If you say yes to this option, support will be included for the |
548 | OpenCores I2C controller. For details see | 549 | OpenCores I2C controller. For details see |
@@ -777,7 +778,7 @@ config I2C_DIOLAN_U2C | |||
777 | 778 | ||
778 | config I2C_PARPORT | 779 | config I2C_PARPORT |
779 | tristate "Parallel port adapter" | 780 | tristate "Parallel port adapter" |
780 | depends on PARPORT | 781 | depends on PARPORT && GENERIC_HARDIRQS |
781 | select I2C_ALGOBIT | 782 | select I2C_ALGOBIT |
782 | select I2C_SMBUS | 783 | select I2C_SMBUS |
783 | help | 784 | help |
@@ -802,6 +803,7 @@ config I2C_PARPORT | |||
802 | 803 | ||
803 | config I2C_PARPORT_LIGHT | 804 | config I2C_PARPORT_LIGHT |
804 | tristate "Parallel port adapter (light)" | 805 | tristate "Parallel port adapter (light)" |
806 | depends on GENERIC_HARDIRQS | ||
805 | select I2C_ALGOBIT | 807 | select I2C_ALGOBIT |
806 | select I2C_SMBUS | 808 | select I2C_SMBUS |
807 | help | 809 | help |
diff --git a/drivers/i2c/busses/i2c-ismt.c b/drivers/i2c/busses/i2c-ismt.c index e9205ee8cf94..130f02cc9d94 100644 --- a/drivers/i2c/busses/i2c-ismt.c +++ b/drivers/i2c/busses/i2c-ismt.c | |||
@@ -80,6 +80,7 @@ | |||
80 | /* PCI DIDs for the Intel SMBus Message Transport (SMT) Devices */ | 80 | /* PCI DIDs for the Intel SMBus Message Transport (SMT) Devices */ |
81 | #define PCI_DEVICE_ID_INTEL_S1200_SMT0 0x0c59 | 81 | #define PCI_DEVICE_ID_INTEL_S1200_SMT0 0x0c59 |
82 | #define PCI_DEVICE_ID_INTEL_S1200_SMT1 0x0c5a | 82 | #define PCI_DEVICE_ID_INTEL_S1200_SMT1 0x0c5a |
83 | #define PCI_DEVICE_ID_INTEL_AVOTON_SMT 0x1f15 | ||
83 | 84 | ||
84 | #define ISMT_DESC_ENTRIES 32 /* number of descriptor entries */ | 85 | #define ISMT_DESC_ENTRIES 32 /* number of descriptor entries */ |
85 | #define ISMT_MAX_RETRIES 3 /* number of SMBus retries to attempt */ | 86 | #define ISMT_MAX_RETRIES 3 /* number of SMBus retries to attempt */ |
@@ -185,6 +186,7 @@ struct ismt_priv { | |||
185 | static const DEFINE_PCI_DEVICE_TABLE(ismt_ids) = { | 186 | static const DEFINE_PCI_DEVICE_TABLE(ismt_ids) = { |
186 | { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_S1200_SMT0) }, | 187 | { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_S1200_SMT0) }, |
187 | { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_S1200_SMT1) }, | 188 | { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_S1200_SMT1) }, |
189 | { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_AVOTON_SMT) }, | ||
188 | { 0, } | 190 | { 0, } |
189 | }; | 191 | }; |
190 | 192 | ||
diff --git a/drivers/i2c/busses/i2c-tegra.c b/drivers/i2c/busses/i2c-tegra.c index 36704e3ab3fa..b714776b6ddd 100644 --- a/drivers/i2c/busses/i2c-tegra.c +++ b/drivers/i2c/busses/i2c-tegra.c | |||
@@ -411,7 +411,11 @@ static int tegra_i2c_init(struct tegra_i2c_dev *i2c_dev) | |||
411 | int clk_multiplier = I2C_CLK_MULTIPLIER_STD_FAST_MODE; | 411 | int clk_multiplier = I2C_CLK_MULTIPLIER_STD_FAST_MODE; |
412 | u32 clk_divisor; | 412 | u32 clk_divisor; |
413 | 413 | ||
414 | tegra_i2c_clock_enable(i2c_dev); | 414 | err = tegra_i2c_clock_enable(i2c_dev); |
415 | if (err < 0) { | ||
416 | dev_err(i2c_dev->dev, "Clock enable failed %d\n", err); | ||
417 | return err; | ||
418 | } | ||
415 | 419 | ||
416 | tegra_periph_reset_assert(i2c_dev->div_clk); | 420 | tegra_periph_reset_assert(i2c_dev->div_clk); |
417 | udelay(2); | 421 | udelay(2); |
@@ -628,7 +632,12 @@ static int tegra_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[], | |||
628 | if (i2c_dev->is_suspended) | 632 | if (i2c_dev->is_suspended) |
629 | return -EBUSY; | 633 | return -EBUSY; |
630 | 634 | ||
631 | tegra_i2c_clock_enable(i2c_dev); | 635 | ret = tegra_i2c_clock_enable(i2c_dev); |
636 | if (ret < 0) { | ||
637 | dev_err(i2c_dev->dev, "Clock enable failed %d\n", ret); | ||
638 | return ret; | ||
639 | } | ||
640 | |||
632 | for (i = 0; i < num; i++) { | 641 | for (i = 0; i < num; i++) { |
633 | enum msg_end_type end_type = MSG_END_STOP; | 642 | enum msg_end_type end_type = MSG_END_STOP; |
634 | if (i < (num - 1)) { | 643 | if (i < (num - 1)) { |
diff --git a/drivers/i2c/muxes/i2c-mux-pca9541.c b/drivers/i2c/muxes/i2c-mux-pca9541.c index f3b8f9a6a89b..966a18a5d12d 100644 --- a/drivers/i2c/muxes/i2c-mux-pca9541.c +++ b/drivers/i2c/muxes/i2c-mux-pca9541.c | |||
@@ -3,7 +3,7 @@ | |||
3 | * | 3 | * |
4 | * Copyright (c) 2010 Ericsson AB. | 4 | * Copyright (c) 2010 Ericsson AB. |
5 | * | 5 | * |
6 | * Author: Guenter Roeck <guenter.roeck@ericsson.com> | 6 | * Author: Guenter Roeck <linux@roeck-us.net> |
7 | * | 7 | * |
8 | * Derived from: | 8 | * Derived from: |
9 | * pca954x.c | 9 | * pca954x.c |
diff --git a/drivers/iio/common/st_sensors/st_sensors_core.c b/drivers/iio/common/st_sensors/st_sensors_core.c index 0198324a8b0c..bd33473f8e38 100644 --- a/drivers/iio/common/st_sensors/st_sensors_core.c +++ b/drivers/iio/common/st_sensors/st_sensors_core.c | |||
@@ -62,7 +62,7 @@ st_sensors_match_odr_error: | |||
62 | int st_sensors_set_odr(struct iio_dev *indio_dev, unsigned int odr) | 62 | int st_sensors_set_odr(struct iio_dev *indio_dev, unsigned int odr) |
63 | { | 63 | { |
64 | int err; | 64 | int err; |
65 | struct st_sensor_odr_avl odr_out; | 65 | struct st_sensor_odr_avl odr_out = {0, 0}; |
66 | struct st_sensor_data *sdata = iio_priv(indio_dev); | 66 | struct st_sensor_data *sdata = iio_priv(indio_dev); |
67 | 67 | ||
68 | err = st_sensors_match_odr(sdata->sensor, odr, &odr_out); | 68 | err = st_sensors_match_odr(sdata->sensor, odr, &odr_out); |
@@ -114,7 +114,7 @@ st_sensors_match_odr_error: | |||
114 | 114 | ||
115 | static int st_sensors_set_fullscale(struct iio_dev *indio_dev, unsigned int fs) | 115 | static int st_sensors_set_fullscale(struct iio_dev *indio_dev, unsigned int fs) |
116 | { | 116 | { |
117 | int err, i; | 117 | int err, i = 0; |
118 | struct st_sensor_data *sdata = iio_priv(indio_dev); | 118 | struct st_sensor_data *sdata = iio_priv(indio_dev); |
119 | 119 | ||
120 | err = st_sensors_match_fs(sdata->sensor, fs, &i); | 120 | err = st_sensors_match_fs(sdata->sensor, fs, &i); |
@@ -139,14 +139,13 @@ st_accel_set_fullscale_error: | |||
139 | 139 | ||
140 | int st_sensors_set_enable(struct iio_dev *indio_dev, bool enable) | 140 | int st_sensors_set_enable(struct iio_dev *indio_dev, bool enable) |
141 | { | 141 | { |
142 | bool found; | ||
143 | u8 tmp_value; | 142 | u8 tmp_value; |
144 | int err = -EINVAL; | 143 | int err = -EINVAL; |
145 | struct st_sensor_odr_avl odr_out; | 144 | bool found = false; |
145 | struct st_sensor_odr_avl odr_out = {0, 0}; | ||
146 | struct st_sensor_data *sdata = iio_priv(indio_dev); | 146 | struct st_sensor_data *sdata = iio_priv(indio_dev); |
147 | 147 | ||
148 | if (enable) { | 148 | if (enable) { |
149 | found = false; | ||
150 | tmp_value = sdata->sensor->pw.value_on; | 149 | tmp_value = sdata->sensor->pw.value_on; |
151 | if ((sdata->sensor->odr.addr == sdata->sensor->pw.addr) && | 150 | if ((sdata->sensor->odr.addr == sdata->sensor->pw.addr) && |
152 | (sdata->sensor->odr.mask == sdata->sensor->pw.mask)) { | 151 | (sdata->sensor->odr.mask == sdata->sensor->pw.mask)) { |
diff --git a/drivers/iio/dac/ad5064.c b/drivers/iio/dac/ad5064.c index 2fe1d4edcb2f..74f2d52795f6 100644 --- a/drivers/iio/dac/ad5064.c +++ b/drivers/iio/dac/ad5064.c | |||
@@ -27,7 +27,6 @@ | |||
27 | #define AD5064_ADDR(x) ((x) << 20) | 27 | #define AD5064_ADDR(x) ((x) << 20) |
28 | #define AD5064_CMD(x) ((x) << 24) | 28 | #define AD5064_CMD(x) ((x) << 24) |
29 | 29 | ||
30 | #define AD5064_ADDR_DAC(chan) (chan) | ||
31 | #define AD5064_ADDR_ALL_DAC 0xF | 30 | #define AD5064_ADDR_ALL_DAC 0xF |
32 | 31 | ||
33 | #define AD5064_CMD_WRITE_INPUT_N 0x0 | 32 | #define AD5064_CMD_WRITE_INPUT_N 0x0 |
@@ -131,15 +130,15 @@ static int ad5064_write(struct ad5064_state *st, unsigned int cmd, | |||
131 | } | 130 | } |
132 | 131 | ||
133 | static int ad5064_sync_powerdown_mode(struct ad5064_state *st, | 132 | static int ad5064_sync_powerdown_mode(struct ad5064_state *st, |
134 | unsigned int channel) | 133 | const struct iio_chan_spec *chan) |
135 | { | 134 | { |
136 | unsigned int val; | 135 | unsigned int val; |
137 | int ret; | 136 | int ret; |
138 | 137 | ||
139 | val = (0x1 << channel); | 138 | val = (0x1 << chan->address); |
140 | 139 | ||
141 | if (st->pwr_down[channel]) | 140 | if (st->pwr_down[chan->channel]) |
142 | val |= st->pwr_down_mode[channel] << 8; | 141 | val |= st->pwr_down_mode[chan->channel] << 8; |
143 | 142 | ||
144 | ret = ad5064_write(st, AD5064_CMD_POWERDOWN_DAC, 0, val, 0); | 143 | ret = ad5064_write(st, AD5064_CMD_POWERDOWN_DAC, 0, val, 0); |
145 | 144 | ||
@@ -169,7 +168,7 @@ static int ad5064_set_powerdown_mode(struct iio_dev *indio_dev, | |||
169 | mutex_lock(&indio_dev->mlock); | 168 | mutex_lock(&indio_dev->mlock); |
170 | st->pwr_down_mode[chan->channel] = mode + 1; | 169 | st->pwr_down_mode[chan->channel] = mode + 1; |
171 | 170 | ||
172 | ret = ad5064_sync_powerdown_mode(st, chan->channel); | 171 | ret = ad5064_sync_powerdown_mode(st, chan); |
173 | mutex_unlock(&indio_dev->mlock); | 172 | mutex_unlock(&indio_dev->mlock); |
174 | 173 | ||
175 | return ret; | 174 | return ret; |
@@ -205,7 +204,7 @@ static ssize_t ad5064_write_dac_powerdown(struct iio_dev *indio_dev, | |||
205 | mutex_lock(&indio_dev->mlock); | 204 | mutex_lock(&indio_dev->mlock); |
206 | st->pwr_down[chan->channel] = pwr_down; | 205 | st->pwr_down[chan->channel] = pwr_down; |
207 | 206 | ||
208 | ret = ad5064_sync_powerdown_mode(st, chan->channel); | 207 | ret = ad5064_sync_powerdown_mode(st, chan); |
209 | mutex_unlock(&indio_dev->mlock); | 208 | mutex_unlock(&indio_dev->mlock); |
210 | return ret ? ret : len; | 209 | return ret ? ret : len; |
211 | } | 210 | } |
@@ -258,7 +257,7 @@ static int ad5064_write_raw(struct iio_dev *indio_dev, | |||
258 | 257 | ||
259 | switch (mask) { | 258 | switch (mask) { |
260 | case IIO_CHAN_INFO_RAW: | 259 | case IIO_CHAN_INFO_RAW: |
261 | if (val > (1 << chan->scan_type.realbits) || val < 0) | 260 | if (val >= (1 << chan->scan_type.realbits) || val < 0) |
262 | return -EINVAL; | 261 | return -EINVAL; |
263 | 262 | ||
264 | mutex_lock(&indio_dev->mlock); | 263 | mutex_lock(&indio_dev->mlock); |
@@ -292,34 +291,44 @@ static const struct iio_chan_spec_ext_info ad5064_ext_info[] = { | |||
292 | { }, | 291 | { }, |
293 | }; | 292 | }; |
294 | 293 | ||
295 | #define AD5064_CHANNEL(chan, bits) { \ | 294 | #define AD5064_CHANNEL(chan, addr, bits) { \ |
296 | .type = IIO_VOLTAGE, \ | 295 | .type = IIO_VOLTAGE, \ |
297 | .indexed = 1, \ | 296 | .indexed = 1, \ |
298 | .output = 1, \ | 297 | .output = 1, \ |
299 | .channel = (chan), \ | 298 | .channel = (chan), \ |
300 | .info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT | \ | 299 | .info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT | \ |
301 | IIO_CHAN_INFO_SCALE_SEPARATE_BIT, \ | 300 | IIO_CHAN_INFO_SCALE_SEPARATE_BIT, \ |
302 | .address = AD5064_ADDR_DAC(chan), \ | 301 | .address = addr, \ |
303 | .scan_type = IIO_ST('u', (bits), 16, 20 - (bits)), \ | 302 | .scan_type = IIO_ST('u', (bits), 16, 20 - (bits)), \ |
304 | .ext_info = ad5064_ext_info, \ | 303 | .ext_info = ad5064_ext_info, \ |
305 | } | 304 | } |
306 | 305 | ||
307 | #define DECLARE_AD5064_CHANNELS(name, bits) \ | 306 | #define DECLARE_AD5064_CHANNELS(name, bits) \ |
308 | const struct iio_chan_spec name[] = { \ | 307 | const struct iio_chan_spec name[] = { \ |
309 | AD5064_CHANNEL(0, bits), \ | 308 | AD5064_CHANNEL(0, 0, bits), \ |
310 | AD5064_CHANNEL(1, bits), \ | 309 | AD5064_CHANNEL(1, 1, bits), \ |
311 | AD5064_CHANNEL(2, bits), \ | 310 | AD5064_CHANNEL(2, 2, bits), \ |
312 | AD5064_CHANNEL(3, bits), \ | 311 | AD5064_CHANNEL(3, 3, bits), \ |
313 | AD5064_CHANNEL(4, bits), \ | 312 | AD5064_CHANNEL(4, 4, bits), \ |
314 | AD5064_CHANNEL(5, bits), \ | 313 | AD5064_CHANNEL(5, 5, bits), \ |
315 | AD5064_CHANNEL(6, bits), \ | 314 | AD5064_CHANNEL(6, 6, bits), \ |
316 | AD5064_CHANNEL(7, bits), \ | 315 | AD5064_CHANNEL(7, 7, bits), \ |
316 | } | ||
317 | |||
318 | #define DECLARE_AD5065_CHANNELS(name, bits) \ | ||
319 | const struct iio_chan_spec name[] = { \ | ||
320 | AD5064_CHANNEL(0, 0, bits), \ | ||
321 | AD5064_CHANNEL(1, 3, bits), \ | ||
317 | } | 322 | } |
318 | 323 | ||
319 | static DECLARE_AD5064_CHANNELS(ad5024_channels, 12); | 324 | static DECLARE_AD5064_CHANNELS(ad5024_channels, 12); |
320 | static DECLARE_AD5064_CHANNELS(ad5044_channels, 14); | 325 | static DECLARE_AD5064_CHANNELS(ad5044_channels, 14); |
321 | static DECLARE_AD5064_CHANNELS(ad5064_channels, 16); | 326 | static DECLARE_AD5064_CHANNELS(ad5064_channels, 16); |
322 | 327 | ||
328 | static DECLARE_AD5065_CHANNELS(ad5025_channels, 12); | ||
329 | static DECLARE_AD5065_CHANNELS(ad5045_channels, 14); | ||
330 | static DECLARE_AD5065_CHANNELS(ad5065_channels, 16); | ||
331 | |||
323 | static const struct ad5064_chip_info ad5064_chip_info_tbl[] = { | 332 | static const struct ad5064_chip_info ad5064_chip_info_tbl[] = { |
324 | [ID_AD5024] = { | 333 | [ID_AD5024] = { |
325 | .shared_vref = false, | 334 | .shared_vref = false, |
@@ -328,7 +337,7 @@ static const struct ad5064_chip_info ad5064_chip_info_tbl[] = { | |||
328 | }, | 337 | }, |
329 | [ID_AD5025] = { | 338 | [ID_AD5025] = { |
330 | .shared_vref = false, | 339 | .shared_vref = false, |
331 | .channels = ad5024_channels, | 340 | .channels = ad5025_channels, |
332 | .num_channels = 2, | 341 | .num_channels = 2, |
333 | }, | 342 | }, |
334 | [ID_AD5044] = { | 343 | [ID_AD5044] = { |
@@ -338,7 +347,7 @@ static const struct ad5064_chip_info ad5064_chip_info_tbl[] = { | |||
338 | }, | 347 | }, |
339 | [ID_AD5045] = { | 348 | [ID_AD5045] = { |
340 | .shared_vref = false, | 349 | .shared_vref = false, |
341 | .channels = ad5044_channels, | 350 | .channels = ad5045_channels, |
342 | .num_channels = 2, | 351 | .num_channels = 2, |
343 | }, | 352 | }, |
344 | [ID_AD5064] = { | 353 | [ID_AD5064] = { |
@@ -353,7 +362,7 @@ static const struct ad5064_chip_info ad5064_chip_info_tbl[] = { | |||
353 | }, | 362 | }, |
354 | [ID_AD5065] = { | 363 | [ID_AD5065] = { |
355 | .shared_vref = false, | 364 | .shared_vref = false, |
356 | .channels = ad5064_channels, | 365 | .channels = ad5065_channels, |
357 | .num_channels = 2, | 366 | .num_channels = 2, |
358 | }, | 367 | }, |
359 | [ID_AD5628_1] = { | 368 | [ID_AD5628_1] = { |
@@ -429,6 +438,7 @@ static int ad5064_probe(struct device *dev, enum ad5064_type type, | |||
429 | { | 438 | { |
430 | struct iio_dev *indio_dev; | 439 | struct iio_dev *indio_dev; |
431 | struct ad5064_state *st; | 440 | struct ad5064_state *st; |
441 | unsigned int midscale; | ||
432 | unsigned int i; | 442 | unsigned int i; |
433 | int ret; | 443 | int ret; |
434 | 444 | ||
@@ -465,11 +475,6 @@ static int ad5064_probe(struct device *dev, enum ad5064_type type, | |||
465 | goto error_free_reg; | 475 | goto error_free_reg; |
466 | } | 476 | } |
467 | 477 | ||
468 | for (i = 0; i < st->chip_info->num_channels; ++i) { | ||
469 | st->pwr_down_mode[i] = AD5064_LDAC_PWRDN_1K; | ||
470 | st->dac_cache[i] = 0x8000; | ||
471 | } | ||
472 | |||
473 | indio_dev->dev.parent = dev; | 478 | indio_dev->dev.parent = dev; |
474 | indio_dev->name = name; | 479 | indio_dev->name = name; |
475 | indio_dev->info = &ad5064_info; | 480 | indio_dev->info = &ad5064_info; |
@@ -477,6 +482,13 @@ static int ad5064_probe(struct device *dev, enum ad5064_type type, | |||
477 | indio_dev->channels = st->chip_info->channels; | 482 | indio_dev->channels = st->chip_info->channels; |
478 | indio_dev->num_channels = st->chip_info->num_channels; | 483 | indio_dev->num_channels = st->chip_info->num_channels; |
479 | 484 | ||
485 | midscale = (1 << indio_dev->channels[0].scan_type.realbits) / 2; | ||
486 | |||
487 | for (i = 0; i < st->chip_info->num_channels; ++i) { | ||
488 | st->pwr_down_mode[i] = AD5064_LDAC_PWRDN_1K; | ||
489 | st->dac_cache[i] = midscale; | ||
490 | } | ||
491 | |||
480 | ret = iio_device_register(indio_dev); | 492 | ret = iio_device_register(indio_dev); |
481 | if (ret) | 493 | if (ret) |
482 | goto error_disable_reg; | 494 | goto error_disable_reg; |
diff --git a/drivers/iio/imu/inv_mpu6050/Kconfig b/drivers/iio/imu/inv_mpu6050/Kconfig index b5cfa3a354cf..361b2328453d 100644 --- a/drivers/iio/imu/inv_mpu6050/Kconfig +++ b/drivers/iio/imu/inv_mpu6050/Kconfig | |||
@@ -5,6 +5,7 @@ | |||
5 | config INV_MPU6050_IIO | 5 | config INV_MPU6050_IIO |
6 | tristate "Invensense MPU6050 devices" | 6 | tristate "Invensense MPU6050 devices" |
7 | depends on I2C && SYSFS | 7 | depends on I2C && SYSFS |
8 | select IIO_BUFFER | ||
8 | select IIO_TRIGGERED_BUFFER | 9 | select IIO_TRIGGERED_BUFFER |
9 | help | 10 | help |
10 | This driver supports the Invensense MPU6050 devices. | 11 | This driver supports the Invensense MPU6050 devices. |
diff --git a/drivers/infiniband/hw/cxgb4/cm.c b/drivers/infiniband/hw/cxgb4/cm.c index 565bfb161c1a..a3fde52840ca 100644 --- a/drivers/infiniband/hw/cxgb4/cm.c +++ b/drivers/infiniband/hw/cxgb4/cm.c | |||
@@ -1575,6 +1575,12 @@ static int c4iw_reconnect(struct c4iw_ep *ep) | |||
1575 | 1575 | ||
1576 | neigh = dst_neigh_lookup(ep->dst, | 1576 | neigh = dst_neigh_lookup(ep->dst, |
1577 | &ep->com.cm_id->remote_addr.sin_addr.s_addr); | 1577 | &ep->com.cm_id->remote_addr.sin_addr.s_addr); |
1578 | if (!neigh) { | ||
1579 | pr_err("%s - cannot alloc neigh.\n", __func__); | ||
1580 | err = -ENOMEM; | ||
1581 | goto fail4; | ||
1582 | } | ||
1583 | |||
1578 | /* get a l2t entry */ | 1584 | /* get a l2t entry */ |
1579 | if (neigh->dev->flags & IFF_LOOPBACK) { | 1585 | if (neigh->dev->flags & IFF_LOOPBACK) { |
1580 | PDBG("%s LOOPBACK\n", __func__); | 1586 | PDBG("%s LOOPBACK\n", __func__); |
@@ -3053,6 +3059,12 @@ static int rx_pkt(struct c4iw_dev *dev, struct sk_buff *skb) | |||
3053 | dst = &rt->dst; | 3059 | dst = &rt->dst; |
3054 | neigh = dst_neigh_lookup_skb(dst, skb); | 3060 | neigh = dst_neigh_lookup_skb(dst, skb); |
3055 | 3061 | ||
3062 | if (!neigh) { | ||
3063 | pr_err("%s - failed to allocate neigh!\n", | ||
3064 | __func__); | ||
3065 | goto free_dst; | ||
3066 | } | ||
3067 | |||
3056 | if (neigh->dev->flags & IFF_LOOPBACK) { | 3068 | if (neigh->dev->flags & IFF_LOOPBACK) { |
3057 | pdev = ip_dev_find(&init_net, iph->daddr); | 3069 | pdev = ip_dev_find(&init_net, iph->daddr); |
3058 | e = cxgb4_l2t_get(dev->rdev.lldi.l2t, neigh, | 3070 | e = cxgb4_l2t_get(dev->rdev.lldi.l2t, neigh, |
diff --git a/drivers/infiniband/hw/mlx4/cm.c b/drivers/infiniband/hw/mlx4/cm.c index e0d79b2395e4..add98d01476c 100644 --- a/drivers/infiniband/hw/mlx4/cm.c +++ b/drivers/infiniband/hw/mlx4/cm.c | |||
@@ -362,7 +362,6 @@ void mlx4_ib_cm_paravirt_init(struct mlx4_ib_dev *dev) | |||
362 | INIT_LIST_HEAD(&dev->sriov.cm_list); | 362 | INIT_LIST_HEAD(&dev->sriov.cm_list); |
363 | dev->sriov.sl_id_map = RB_ROOT; | 363 | dev->sriov.sl_id_map = RB_ROOT; |
364 | idr_init(&dev->sriov.pv_id_table); | 364 | idr_init(&dev->sriov.pv_id_table); |
365 | idr_pre_get(&dev->sriov.pv_id_table, GFP_KERNEL); | ||
366 | } | 365 | } |
367 | 366 | ||
368 | /* slave = -1 ==> all slaves */ | 367 | /* slave = -1 ==> all slaves */ |
diff --git a/drivers/input/joystick/analog.c b/drivers/input/joystick/analog.c index 7cd74e29cbc8..9135606c8649 100644 --- a/drivers/input/joystick/analog.c +++ b/drivers/input/joystick/analog.c | |||
@@ -158,14 +158,10 @@ static unsigned int get_time_pit(void) | |||
158 | #define GET_TIME(x) rdtscl(x) | 158 | #define GET_TIME(x) rdtscl(x) |
159 | #define DELTA(x,y) ((y)-(x)) | 159 | #define DELTA(x,y) ((y)-(x)) |
160 | #define TIME_NAME "TSC" | 160 | #define TIME_NAME "TSC" |
161 | #elif defined(__alpha__) | 161 | #elif defined(__alpha__) || defined(CONFIG_MN10300) || defined(CONFIG_ARM) || defined(CONFIG_TILE) |
162 | #define GET_TIME(x) do { x = get_cycles(); } while (0) | 162 | #define GET_TIME(x) do { x = get_cycles(); } while (0) |
163 | #define DELTA(x,y) ((y)-(x)) | 163 | #define DELTA(x,y) ((y)-(x)) |
164 | #define TIME_NAME "PCC" | 164 | #define TIME_NAME "get_cycles" |
165 | #elif defined(CONFIG_MN10300) || defined(CONFIG_TILE) | ||
166 | #define GET_TIME(x) do { x = get_cycles(); } while (0) | ||
167 | #define DELTA(x, y) ((x) - (y)) | ||
168 | #define TIME_NAME "TSC" | ||
169 | #else | 165 | #else |
170 | #define FAKE_TIME | 166 | #define FAKE_TIME |
171 | static unsigned long analog_faketime = 0; | 167 | static unsigned long analog_faketime = 0; |
diff --git a/drivers/input/keyboard/tc3589x-keypad.c b/drivers/input/keyboard/tc3589x-keypad.c index 2fb0d76a04c4..208de7cbb7fa 100644 --- a/drivers/input/keyboard/tc3589x-keypad.c +++ b/drivers/input/keyboard/tc3589x-keypad.c | |||
@@ -70,8 +70,6 @@ | |||
70 | #define TC3589x_EVT_INT_CLR 0x2 | 70 | #define TC3589x_EVT_INT_CLR 0x2 |
71 | #define TC3589x_KBD_INT_CLR 0x1 | 71 | #define TC3589x_KBD_INT_CLR 0x1 |
72 | 72 | ||
73 | #define TC3589x_KBD_KEYMAP_SIZE 64 | ||
74 | |||
75 | /** | 73 | /** |
76 | * struct tc_keypad - data structure used by keypad driver | 74 | * struct tc_keypad - data structure used by keypad driver |
77 | * @tc3589x: pointer to tc35893 | 75 | * @tc3589x: pointer to tc35893 |
@@ -88,7 +86,7 @@ struct tc_keypad { | |||
88 | const struct tc3589x_keypad_platform_data *board; | 86 | const struct tc3589x_keypad_platform_data *board; |
89 | unsigned int krow; | 87 | unsigned int krow; |
90 | unsigned int kcol; | 88 | unsigned int kcol; |
91 | unsigned short keymap[TC3589x_KBD_KEYMAP_SIZE]; | 89 | unsigned short *keymap; |
92 | bool keypad_stopped; | 90 | bool keypad_stopped; |
93 | }; | 91 | }; |
94 | 92 | ||
@@ -338,12 +336,14 @@ static int tc3589x_keypad_probe(struct platform_device *pdev) | |||
338 | 336 | ||
339 | error = matrix_keypad_build_keymap(plat->keymap_data, NULL, | 337 | error = matrix_keypad_build_keymap(plat->keymap_data, NULL, |
340 | TC3589x_MAX_KPROW, TC3589x_MAX_KPCOL, | 338 | TC3589x_MAX_KPROW, TC3589x_MAX_KPCOL, |
341 | keypad->keymap, input); | 339 | NULL, input); |
342 | if (error) { | 340 | if (error) { |
343 | dev_err(&pdev->dev, "Failed to build keymap\n"); | 341 | dev_err(&pdev->dev, "Failed to build keymap\n"); |
344 | goto err_free_mem; | 342 | goto err_free_mem; |
345 | } | 343 | } |
346 | 344 | ||
345 | keypad->keymap = input->keycode; | ||
346 | |||
347 | input_set_capability(input, EV_MSC, MSC_SCAN); | 347 | input_set_capability(input, EV_MSC, MSC_SCAN); |
348 | if (!plat->no_autorepeat) | 348 | if (!plat->no_autorepeat) |
349 | __set_bit(EV_REP, input->evbit); | 349 | __set_bit(EV_REP, input->evbit); |
diff --git a/drivers/input/mouse/alps.c b/drivers/input/mouse/alps.c index 7b99fc7c9438..0238e0e14335 100644 --- a/drivers/input/mouse/alps.c +++ b/drivers/input/mouse/alps.c | |||
@@ -490,6 +490,29 @@ static void alps_decode_rushmore(struct alps_fields *f, unsigned char *p) | |||
490 | f->y_map |= (p[5] & 0x20) << 6; | 490 | f->y_map |= (p[5] & 0x20) << 6; |
491 | } | 491 | } |
492 | 492 | ||
493 | static void alps_decode_dolphin(struct alps_fields *f, unsigned char *p) | ||
494 | { | ||
495 | f->first_mp = !!(p[0] & 0x02); | ||
496 | f->is_mp = !!(p[0] & 0x20); | ||
497 | |||
498 | f->fingers = ((p[0] & 0x6) >> 1 | | ||
499 | (p[0] & 0x10) >> 2); | ||
500 | f->x_map = ((p[2] & 0x60) >> 5) | | ||
501 | ((p[4] & 0x7f) << 2) | | ||
502 | ((p[5] & 0x7f) << 9) | | ||
503 | ((p[3] & 0x07) << 16) | | ||
504 | ((p[3] & 0x70) << 15) | | ||
505 | ((p[0] & 0x01) << 22); | ||
506 | f->y_map = (p[1] & 0x7f) | | ||
507 | ((p[2] & 0x1f) << 7); | ||
508 | |||
509 | f->x = ((p[1] & 0x7f) | ((p[4] & 0x0f) << 7)); | ||
510 | f->y = ((p[2] & 0x7f) | ((p[4] & 0xf0) << 3)); | ||
511 | f->z = (p[0] & 4) ? 0 : p[5] & 0x7f; | ||
512 | |||
513 | alps_decode_buttons_v3(f, p); | ||
514 | } | ||
515 | |||
493 | static void alps_process_touchpad_packet_v3(struct psmouse *psmouse) | 516 | static void alps_process_touchpad_packet_v3(struct psmouse *psmouse) |
494 | { | 517 | { |
495 | struct alps_data *priv = psmouse->private; | 518 | struct alps_data *priv = psmouse->private; |
@@ -874,7 +897,8 @@ static psmouse_ret_t alps_process_byte(struct psmouse *psmouse) | |||
874 | } | 897 | } |
875 | 898 | ||
876 | /* Bytes 2 - pktsize should have 0 in the highest bit */ | 899 | /* Bytes 2 - pktsize should have 0 in the highest bit */ |
877 | if (psmouse->pktcnt >= 2 && psmouse->pktcnt <= psmouse->pktsize && | 900 | if (priv->proto_version != ALPS_PROTO_V5 && |
901 | psmouse->pktcnt >= 2 && psmouse->pktcnt <= psmouse->pktsize && | ||
878 | (psmouse->packet[psmouse->pktcnt - 1] & 0x80)) { | 902 | (psmouse->packet[psmouse->pktcnt - 1] & 0x80)) { |
879 | psmouse_dbg(psmouse, "refusing packet[%i] = %x\n", | 903 | psmouse_dbg(psmouse, "refusing packet[%i] = %x\n", |
880 | psmouse->pktcnt - 1, | 904 | psmouse->pktcnt - 1, |
@@ -994,8 +1018,7 @@ static int alps_rpt_cmd(struct psmouse *psmouse, int init_command, | |||
994 | return 0; | 1018 | return 0; |
995 | } | 1019 | } |
996 | 1020 | ||
997 | static int alps_enter_command_mode(struct psmouse *psmouse, | 1021 | static int alps_enter_command_mode(struct psmouse *psmouse) |
998 | unsigned char *resp) | ||
999 | { | 1022 | { |
1000 | unsigned char param[4]; | 1023 | unsigned char param[4]; |
1001 | 1024 | ||
@@ -1004,14 +1027,12 @@ static int alps_enter_command_mode(struct psmouse *psmouse, | |||
1004 | return -1; | 1027 | return -1; |
1005 | } | 1028 | } |
1006 | 1029 | ||
1007 | if (param[0] != 0x88 || (param[1] != 0x07 && param[1] != 0x08)) { | 1030 | if ((param[0] != 0x88 || (param[1] != 0x07 && param[1] != 0x08)) && |
1031 | param[0] != 0x73) { | ||
1008 | psmouse_dbg(psmouse, | 1032 | psmouse_dbg(psmouse, |
1009 | "unknown response while entering command mode\n"); | 1033 | "unknown response while entering command mode\n"); |
1010 | return -1; | 1034 | return -1; |
1011 | } | 1035 | } |
1012 | |||
1013 | if (resp) | ||
1014 | *resp = param[2]; | ||
1015 | return 0; | 1036 | return 0; |
1016 | } | 1037 | } |
1017 | 1038 | ||
@@ -1176,7 +1197,7 @@ static int alps_passthrough_mode_v3(struct psmouse *psmouse, | |||
1176 | { | 1197 | { |
1177 | int reg_val, ret = -1; | 1198 | int reg_val, ret = -1; |
1178 | 1199 | ||
1179 | if (alps_enter_command_mode(psmouse, NULL)) | 1200 | if (alps_enter_command_mode(psmouse)) |
1180 | return -1; | 1201 | return -1; |
1181 | 1202 | ||
1182 | reg_val = alps_command_mode_read_reg(psmouse, reg_base + 0x0008); | 1203 | reg_val = alps_command_mode_read_reg(psmouse, reg_base + 0x0008); |
@@ -1216,7 +1237,7 @@ static int alps_probe_trackstick_v3(struct psmouse *psmouse, int reg_base) | |||
1216 | { | 1237 | { |
1217 | int ret = -EIO, reg_val; | 1238 | int ret = -EIO, reg_val; |
1218 | 1239 | ||
1219 | if (alps_enter_command_mode(psmouse, NULL)) | 1240 | if (alps_enter_command_mode(psmouse)) |
1220 | goto error; | 1241 | goto error; |
1221 | 1242 | ||
1222 | reg_val = alps_command_mode_read_reg(psmouse, reg_base + 0x08); | 1243 | reg_val = alps_command_mode_read_reg(psmouse, reg_base + 0x08); |
@@ -1279,7 +1300,7 @@ static int alps_setup_trackstick_v3(struct psmouse *psmouse, int reg_base) | |||
1279 | * supported by this driver. If bit 1 isn't set the packet | 1300 | * supported by this driver. If bit 1 isn't set the packet |
1280 | * format is different. | 1301 | * format is different. |
1281 | */ | 1302 | */ |
1282 | if (alps_enter_command_mode(psmouse, NULL) || | 1303 | if (alps_enter_command_mode(psmouse) || |
1283 | alps_command_mode_write_reg(psmouse, | 1304 | alps_command_mode_write_reg(psmouse, |
1284 | reg_base + 0x08, 0x82) || | 1305 | reg_base + 0x08, 0x82) || |
1285 | alps_exit_command_mode(psmouse)) | 1306 | alps_exit_command_mode(psmouse)) |
@@ -1306,7 +1327,7 @@ static int alps_hw_init_v3(struct psmouse *psmouse) | |||
1306 | alps_setup_trackstick_v3(psmouse, ALPS_REG_BASE_PINNACLE) == -EIO) | 1327 | alps_setup_trackstick_v3(psmouse, ALPS_REG_BASE_PINNACLE) == -EIO) |
1307 | goto error; | 1328 | goto error; |
1308 | 1329 | ||
1309 | if (alps_enter_command_mode(psmouse, NULL) || | 1330 | if (alps_enter_command_mode(psmouse) || |
1310 | alps_absolute_mode_v3(psmouse)) { | 1331 | alps_absolute_mode_v3(psmouse)) { |
1311 | psmouse_err(psmouse, "Failed to enter absolute mode\n"); | 1332 | psmouse_err(psmouse, "Failed to enter absolute mode\n"); |
1312 | goto error; | 1333 | goto error; |
@@ -1381,7 +1402,7 @@ static int alps_hw_init_rushmore_v3(struct psmouse *psmouse) | |||
1381 | priv->flags &= ~ALPS_DUALPOINT; | 1402 | priv->flags &= ~ALPS_DUALPOINT; |
1382 | } | 1403 | } |
1383 | 1404 | ||
1384 | if (alps_enter_command_mode(psmouse, NULL) || | 1405 | if (alps_enter_command_mode(psmouse) || |
1385 | alps_command_mode_read_reg(psmouse, 0xc2d9) == -1 || | 1406 | alps_command_mode_read_reg(psmouse, 0xc2d9) == -1 || |
1386 | alps_command_mode_write_reg(psmouse, 0xc2cb, 0x00)) | 1407 | alps_command_mode_write_reg(psmouse, 0xc2cb, 0x00)) |
1387 | goto error; | 1408 | goto error; |
@@ -1431,7 +1452,7 @@ static int alps_hw_init_v4(struct psmouse *psmouse) | |||
1431 | struct ps2dev *ps2dev = &psmouse->ps2dev; | 1452 | struct ps2dev *ps2dev = &psmouse->ps2dev; |
1432 | unsigned char param[4]; | 1453 | unsigned char param[4]; |
1433 | 1454 | ||
1434 | if (alps_enter_command_mode(psmouse, NULL)) | 1455 | if (alps_enter_command_mode(psmouse)) |
1435 | goto error; | 1456 | goto error; |
1436 | 1457 | ||
1437 | if (alps_absolute_mode_v4(psmouse)) { | 1458 | if (alps_absolute_mode_v4(psmouse)) { |
@@ -1499,6 +1520,23 @@ error: | |||
1499 | return -1; | 1520 | return -1; |
1500 | } | 1521 | } |
1501 | 1522 | ||
1523 | static int alps_hw_init_dolphin_v1(struct psmouse *psmouse) | ||
1524 | { | ||
1525 | struct ps2dev *ps2dev = &psmouse->ps2dev; | ||
1526 | unsigned char param[2]; | ||
1527 | |||
1528 | /* This is dolphin "v1" as empirically defined by florin9doi */ | ||
1529 | param[0] = 0x64; | ||
1530 | param[1] = 0x28; | ||
1531 | |||
1532 | if (ps2_command(ps2dev, NULL, PSMOUSE_CMD_SETSTREAM) || | ||
1533 | ps2_command(ps2dev, ¶m[0], PSMOUSE_CMD_SETRATE) || | ||
1534 | ps2_command(ps2dev, ¶m[1], PSMOUSE_CMD_SETRATE)) | ||
1535 | return -1; | ||
1536 | |||
1537 | return 0; | ||
1538 | } | ||
1539 | |||
1502 | static void alps_set_defaults(struct alps_data *priv) | 1540 | static void alps_set_defaults(struct alps_data *priv) |
1503 | { | 1541 | { |
1504 | priv->byte0 = 0x8f; | 1542 | priv->byte0 = 0x8f; |
@@ -1532,6 +1570,21 @@ static void alps_set_defaults(struct alps_data *priv) | |||
1532 | priv->nibble_commands = alps_v4_nibble_commands; | 1570 | priv->nibble_commands = alps_v4_nibble_commands; |
1533 | priv->addr_command = PSMOUSE_CMD_DISABLE; | 1571 | priv->addr_command = PSMOUSE_CMD_DISABLE; |
1534 | break; | 1572 | break; |
1573 | case ALPS_PROTO_V5: | ||
1574 | priv->hw_init = alps_hw_init_dolphin_v1; | ||
1575 | priv->process_packet = alps_process_packet_v3; | ||
1576 | priv->decode_fields = alps_decode_dolphin; | ||
1577 | priv->set_abs_params = alps_set_abs_params_mt; | ||
1578 | priv->nibble_commands = alps_v3_nibble_commands; | ||
1579 | priv->addr_command = PSMOUSE_CMD_RESET_WRAP; | ||
1580 | priv->byte0 = 0xc8; | ||
1581 | priv->mask0 = 0xc8; | ||
1582 | priv->flags = 0; | ||
1583 | priv->x_max = 1360; | ||
1584 | priv->y_max = 660; | ||
1585 | priv->x_bits = 23; | ||
1586 | priv->y_bits = 12; | ||
1587 | break; | ||
1535 | } | 1588 | } |
1536 | } | 1589 | } |
1537 | 1590 | ||
@@ -1592,6 +1645,12 @@ static int alps_identify(struct psmouse *psmouse, struct alps_data *priv) | |||
1592 | 1645 | ||
1593 | if (alps_match_table(psmouse, priv, e7, ec) == 0) { | 1646 | if (alps_match_table(psmouse, priv, e7, ec) == 0) { |
1594 | return 0; | 1647 | return 0; |
1648 | } else if (e7[0] == 0x73 && e7[1] == 0x03 && e7[2] == 0x50 && | ||
1649 | ec[0] == 0x73 && ec[1] == 0x01) { | ||
1650 | priv->proto_version = ALPS_PROTO_V5; | ||
1651 | alps_set_defaults(priv); | ||
1652 | |||
1653 | return 0; | ||
1595 | } else if (ec[0] == 0x88 && ec[1] == 0x08) { | 1654 | } else if (ec[0] == 0x88 && ec[1] == 0x08) { |
1596 | priv->proto_version = ALPS_PROTO_V3; | 1655 | priv->proto_version = ALPS_PROTO_V3; |
1597 | alps_set_defaults(priv); | 1656 | alps_set_defaults(priv); |
diff --git a/drivers/input/mouse/alps.h b/drivers/input/mouse/alps.h index 970480551b6e..eee59853b9ce 100644 --- a/drivers/input/mouse/alps.h +++ b/drivers/input/mouse/alps.h | |||
@@ -16,6 +16,7 @@ | |||
16 | #define ALPS_PROTO_V2 2 | 16 | #define ALPS_PROTO_V2 2 |
17 | #define ALPS_PROTO_V3 3 | 17 | #define ALPS_PROTO_V3 3 |
18 | #define ALPS_PROTO_V4 4 | 18 | #define ALPS_PROTO_V4 4 |
19 | #define ALPS_PROTO_V5 5 | ||
19 | 20 | ||
20 | /** | 21 | /** |
21 | * struct alps_model_info - touchpad ID table | 22 | * struct alps_model_info - touchpad ID table |
diff --git a/drivers/input/mouse/cypress_ps2.c b/drivers/input/mouse/cypress_ps2.c index 1673dc6c8092..f51765fff054 100644 --- a/drivers/input/mouse/cypress_ps2.c +++ b/drivers/input/mouse/cypress_ps2.c | |||
@@ -236,6 +236,13 @@ static int cypress_read_fw_version(struct psmouse *psmouse) | |||
236 | cytp->fw_version = param[2] & FW_VERSION_MASX; | 236 | cytp->fw_version = param[2] & FW_VERSION_MASX; |
237 | cytp->tp_metrics_supported = (param[2] & TP_METRICS_MASK) ? 1 : 0; | 237 | cytp->tp_metrics_supported = (param[2] & TP_METRICS_MASK) ? 1 : 0; |
238 | 238 | ||
239 | /* | ||
240 | * Trackpad fw_version 11 (in Dell XPS12) yields a bogus response to | ||
241 | * CYTP_CMD_READ_TP_METRICS so do not try to use it. LP: #1103594. | ||
242 | */ | ||
243 | if (cytp->fw_version >= 11) | ||
244 | cytp->tp_metrics_supported = 0; | ||
245 | |||
239 | psmouse_dbg(psmouse, "cytp->fw_version = %d\n", cytp->fw_version); | 246 | psmouse_dbg(psmouse, "cytp->fw_version = %d\n", cytp->fw_version); |
240 | psmouse_dbg(psmouse, "cytp->tp_metrics_supported = %d\n", | 247 | psmouse_dbg(psmouse, "cytp->tp_metrics_supported = %d\n", |
241 | cytp->tp_metrics_supported); | 248 | cytp->tp_metrics_supported); |
@@ -258,6 +265,9 @@ static int cypress_read_tp_metrics(struct psmouse *psmouse) | |||
258 | cytp->tp_res_x = cytp->tp_max_abs_x / cytp->tp_width; | 265 | cytp->tp_res_x = cytp->tp_max_abs_x / cytp->tp_width; |
259 | cytp->tp_res_y = cytp->tp_max_abs_y / cytp->tp_high; | 266 | cytp->tp_res_y = cytp->tp_max_abs_y / cytp->tp_high; |
260 | 267 | ||
268 | if (!cytp->tp_metrics_supported) | ||
269 | return 0; | ||
270 | |||
261 | memset(param, 0, sizeof(param)); | 271 | memset(param, 0, sizeof(param)); |
262 | if (cypress_send_ext_cmd(psmouse, CYTP_CMD_READ_TP_METRICS, param) == 0) { | 272 | if (cypress_send_ext_cmd(psmouse, CYTP_CMD_READ_TP_METRICS, param) == 0) { |
263 | /* Update trackpad parameters. */ | 273 | /* Update trackpad parameters. */ |
@@ -315,18 +325,15 @@ static int cypress_read_tp_metrics(struct psmouse *psmouse) | |||
315 | 325 | ||
316 | static int cypress_query_hardware(struct psmouse *psmouse) | 326 | static int cypress_query_hardware(struct psmouse *psmouse) |
317 | { | 327 | { |
318 | struct cytp_data *cytp = psmouse->private; | ||
319 | int ret; | 328 | int ret; |
320 | 329 | ||
321 | ret = cypress_read_fw_version(psmouse); | 330 | ret = cypress_read_fw_version(psmouse); |
322 | if (ret) | 331 | if (ret) |
323 | return ret; | 332 | return ret; |
324 | 333 | ||
325 | if (cytp->tp_metrics_supported) { | 334 | ret = cypress_read_tp_metrics(psmouse); |
326 | ret = cypress_read_tp_metrics(psmouse); | 335 | if (ret) |
327 | if (ret) | 336 | return ret; |
328 | return ret; | ||
329 | } | ||
330 | 337 | ||
331 | return 0; | 338 | return 0; |
332 | } | 339 | } |
diff --git a/drivers/input/tablet/wacom_wac.c b/drivers/input/tablet/wacom_wac.c index 41b6fbf60112..1daa97913b7d 100644 --- a/drivers/input/tablet/wacom_wac.c +++ b/drivers/input/tablet/wacom_wac.c | |||
@@ -2017,6 +2017,9 @@ static const struct wacom_features wacom_features_0x100 = | |||
2017 | static const struct wacom_features wacom_features_0x101 = | 2017 | static const struct wacom_features wacom_features_0x101 = |
2018 | { "Wacom ISDv4 101", WACOM_PKGLEN_MTTPC, 26202, 16325, 255, | 2018 | { "Wacom ISDv4 101", WACOM_PKGLEN_MTTPC, 26202, 16325, 255, |
2019 | 0, MTTPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; | 2019 | 0, MTTPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; |
2020 | static const struct wacom_features wacom_features_0x10D = | ||
2021 | { "Wacom ISDv4 10D", WACOM_PKGLEN_MTTPC, 26202, 16325, 255, | ||
2022 | 0, MTTPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; | ||
2020 | static const struct wacom_features wacom_features_0x4001 = | 2023 | static const struct wacom_features wacom_features_0x4001 = |
2021 | { "Wacom ISDv4 4001", WACOM_PKGLEN_MTTPC, 26202, 16325, 255, | 2024 | { "Wacom ISDv4 4001", WACOM_PKGLEN_MTTPC, 26202, 16325, 255, |
2022 | 0, MTTPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; | 2025 | 0, MTTPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; |
@@ -2201,6 +2204,7 @@ const struct usb_device_id wacom_ids[] = { | |||
2201 | { USB_DEVICE_WACOM(0xEF) }, | 2204 | { USB_DEVICE_WACOM(0xEF) }, |
2202 | { USB_DEVICE_WACOM(0x100) }, | 2205 | { USB_DEVICE_WACOM(0x100) }, |
2203 | { USB_DEVICE_WACOM(0x101) }, | 2206 | { USB_DEVICE_WACOM(0x101) }, |
2207 | { USB_DEVICE_WACOM(0x10D) }, | ||
2204 | { USB_DEVICE_WACOM(0x4001) }, | 2208 | { USB_DEVICE_WACOM(0x4001) }, |
2205 | { USB_DEVICE_WACOM(0x47) }, | 2209 | { USB_DEVICE_WACOM(0x47) }, |
2206 | { USB_DEVICE_WACOM(0xF4) }, | 2210 | { USB_DEVICE_WACOM(0xF4) }, |
diff --git a/drivers/input/touchscreen/ads7846.c b/drivers/input/touchscreen/ads7846.c index 4f702b3ec1a3..434c3df250ca 100644 --- a/drivers/input/touchscreen/ads7846.c +++ b/drivers/input/touchscreen/ads7846.c | |||
@@ -236,7 +236,12 @@ static void __ads7846_disable(struct ads7846 *ts) | |||
236 | /* Must be called with ts->lock held */ | 236 | /* Must be called with ts->lock held */ |
237 | static void __ads7846_enable(struct ads7846 *ts) | 237 | static void __ads7846_enable(struct ads7846 *ts) |
238 | { | 238 | { |
239 | regulator_enable(ts->reg); | 239 | int error; |
240 | |||
241 | error = regulator_enable(ts->reg); | ||
242 | if (error != 0) | ||
243 | dev_err(&ts->spi->dev, "Failed to enable supply: %d\n", error); | ||
244 | |||
240 | ads7846_restart(ts); | 245 | ads7846_restart(ts); |
241 | } | 246 | } |
242 | 247 | ||
diff --git a/drivers/input/touchscreen/mms114.c b/drivers/input/touchscreen/mms114.c index 4a29ddf6bf1e..1443532fe6c4 100644 --- a/drivers/input/touchscreen/mms114.c +++ b/drivers/input/touchscreen/mms114.c | |||
@@ -314,15 +314,27 @@ static int mms114_start(struct mms114_data *data) | |||
314 | struct i2c_client *client = data->client; | 314 | struct i2c_client *client = data->client; |
315 | int error; | 315 | int error; |
316 | 316 | ||
317 | if (data->core_reg) | 317 | error = regulator_enable(data->core_reg); |
318 | regulator_enable(data->core_reg); | 318 | if (error) { |
319 | if (data->io_reg) | 319 | dev_err(&client->dev, "Failed to enable avdd: %d\n", error); |
320 | regulator_enable(data->io_reg); | 320 | return error; |
321 | } | ||
322 | |||
323 | error = regulator_enable(data->io_reg); | ||
324 | if (error) { | ||
325 | dev_err(&client->dev, "Failed to enable vdd: %d\n", error); | ||
326 | regulator_disable(data->core_reg); | ||
327 | return error; | ||
328 | } | ||
329 | |||
321 | mdelay(MMS114_POWERON_DELAY); | 330 | mdelay(MMS114_POWERON_DELAY); |
322 | 331 | ||
323 | error = mms114_setup_regs(data); | 332 | error = mms114_setup_regs(data); |
324 | if (error < 0) | 333 | if (error < 0) { |
334 | regulator_disable(data->io_reg); | ||
335 | regulator_disable(data->core_reg); | ||
325 | return error; | 336 | return error; |
337 | } | ||
326 | 338 | ||
327 | if (data->pdata->cfg_pin) | 339 | if (data->pdata->cfg_pin) |
328 | data->pdata->cfg_pin(true); | 340 | data->pdata->cfg_pin(true); |
@@ -335,16 +347,20 @@ static int mms114_start(struct mms114_data *data) | |||
335 | static void mms114_stop(struct mms114_data *data) | 347 | static void mms114_stop(struct mms114_data *data) |
336 | { | 348 | { |
337 | struct i2c_client *client = data->client; | 349 | struct i2c_client *client = data->client; |
350 | int error; | ||
338 | 351 | ||
339 | disable_irq(client->irq); | 352 | disable_irq(client->irq); |
340 | 353 | ||
341 | if (data->pdata->cfg_pin) | 354 | if (data->pdata->cfg_pin) |
342 | data->pdata->cfg_pin(false); | 355 | data->pdata->cfg_pin(false); |
343 | 356 | ||
344 | if (data->io_reg) | 357 | error = regulator_disable(data->io_reg); |
345 | regulator_disable(data->io_reg); | 358 | if (error) |
346 | if (data->core_reg) | 359 | dev_warn(&client->dev, "Failed to disable vdd: %d\n", error); |
347 | regulator_disable(data->core_reg); | 360 | |
361 | error = regulator_disable(data->core_reg); | ||
362 | if (error) | ||
363 | dev_warn(&client->dev, "Failed to disable avdd: %d\n", error); | ||
348 | } | 364 | } |
349 | 365 | ||
350 | static int mms114_input_open(struct input_dev *dev) | 366 | static int mms114_input_open(struct input_dev *dev) |
diff --git a/drivers/irqchip/irq-gic.c b/drivers/irqchip/irq-gic.c index 644d72468423..a32e0d5aa45f 100644 --- a/drivers/irqchip/irq-gic.c +++ b/drivers/irqchip/irq-gic.c | |||
@@ -648,7 +648,7 @@ void gic_raise_softirq(const struct cpumask *mask, unsigned int irq) | |||
648 | 648 | ||
649 | /* Convert our logical CPU mask into a physical one. */ | 649 | /* Convert our logical CPU mask into a physical one. */ |
650 | for_each_cpu(cpu, mask) | 650 | for_each_cpu(cpu, mask) |
651 | map |= 1 << cpu_logical_map(cpu); | 651 | map |= gic_cpu_map[cpu]; |
652 | 652 | ||
653 | /* | 653 | /* |
654 | * Ensure that stores to Normal memory are visible to the | 654 | * Ensure that stores to Normal memory are visible to the |
diff --git a/drivers/isdn/hisax/Kconfig b/drivers/isdn/hisax/Kconfig index 5313c9ea44dc..d9edcc94c2a8 100644 --- a/drivers/isdn/hisax/Kconfig +++ b/drivers/isdn/hisax/Kconfig | |||
@@ -237,7 +237,8 @@ config HISAX_MIC | |||
237 | 237 | ||
238 | config HISAX_NETJET | 238 | config HISAX_NETJET |
239 | bool "NETjet card" | 239 | bool "NETjet card" |
240 | depends on PCI && (BROKEN || !(SPARC || PPC || PARISC || M68K || (MIPS && !CPU_LITTLE_ENDIAN) || FRV || (XTENSA && !CPU_LITTLE_ENDIAN))) | 240 | depends on PCI && (BROKEN || !(PPC || PARISC || M68K || (MIPS && !CPU_LITTLE_ENDIAN) || FRV || (XTENSA && !CPU_LITTLE_ENDIAN))) |
241 | depends on VIRT_TO_BUS | ||
241 | help | 242 | help |
242 | This enables HiSax support for the NetJet from Traverse | 243 | This enables HiSax support for the NetJet from Traverse |
243 | Technologies. | 244 | Technologies. |
@@ -248,7 +249,8 @@ config HISAX_NETJET | |||
248 | 249 | ||
249 | config HISAX_NETJET_U | 250 | config HISAX_NETJET_U |
250 | bool "NETspider U card" | 251 | bool "NETspider U card" |
251 | depends on PCI && (BROKEN || !(SPARC || PPC || PARISC || M68K || (MIPS && !CPU_LITTLE_ENDIAN) || FRV || (XTENSA && !CPU_LITTLE_ENDIAN))) | 252 | depends on PCI && (BROKEN || !(PPC || PARISC || M68K || (MIPS && !CPU_LITTLE_ENDIAN) || FRV || (XTENSA && !CPU_LITTLE_ENDIAN))) |
253 | depends on VIRT_TO_BUS | ||
252 | help | 254 | help |
253 | This enables HiSax support for the Netspider U interface ISDN card | 255 | This enables HiSax support for the Netspider U interface ISDN card |
254 | from Traverse Technologies. | 256 | from Traverse Technologies. |
diff --git a/drivers/isdn/i4l/isdn_tty.c b/drivers/isdn/i4l/isdn_tty.c index d8a7d8323414..ebaebdf30f98 100644 --- a/drivers/isdn/i4l/isdn_tty.c +++ b/drivers/isdn/i4l/isdn_tty.c | |||
@@ -902,7 +902,9 @@ isdn_tty_send_msg(modem_info *info, atemu *m, char *msg) | |||
902 | int j; | 902 | int j; |
903 | int l; | 903 | int l; |
904 | 904 | ||
905 | l = strlen(msg); | 905 | l = min(strlen(msg), sizeof(cmd.parm) - sizeof(cmd.parm.cmsg) |
906 | + sizeof(cmd.parm.cmsg.para) - 2); | ||
907 | |||
906 | if (!l) { | 908 | if (!l) { |
907 | isdn_tty_modem_result(RESULT_ERROR, info); | 909 | isdn_tty_modem_result(RESULT_ERROR, info); |
908 | return; | 910 | return; |
diff --git a/drivers/md/dm-bufio.c b/drivers/md/dm-bufio.c index 3c955e10a618..c6083132c4b8 100644 --- a/drivers/md/dm-bufio.c +++ b/drivers/md/dm-bufio.c | |||
@@ -1025,6 +1025,8 @@ void dm_bufio_prefetch(struct dm_bufio_client *c, | |||
1025 | { | 1025 | { |
1026 | struct blk_plug plug; | 1026 | struct blk_plug plug; |
1027 | 1027 | ||
1028 | BUG_ON(dm_bufio_in_request()); | ||
1029 | |||
1028 | blk_start_plug(&plug); | 1030 | blk_start_plug(&plug); |
1029 | dm_bufio_lock(c); | 1031 | dm_bufio_lock(c); |
1030 | 1032 | ||
diff --git a/drivers/md/dm-cache-metadata.c b/drivers/md/dm-cache-metadata.c index fbd3625f2748..83e995fece88 100644 --- a/drivers/md/dm-cache-metadata.c +++ b/drivers/md/dm-cache-metadata.c | |||
@@ -83,6 +83,8 @@ struct cache_disk_superblock { | |||
83 | __le32 read_misses; | 83 | __le32 read_misses; |
84 | __le32 write_hits; | 84 | __le32 write_hits; |
85 | __le32 write_misses; | 85 | __le32 write_misses; |
86 | |||
87 | __le32 policy_version[CACHE_POLICY_VERSION_SIZE]; | ||
86 | } __packed; | 88 | } __packed; |
87 | 89 | ||
88 | struct dm_cache_metadata { | 90 | struct dm_cache_metadata { |
@@ -109,6 +111,7 @@ struct dm_cache_metadata { | |||
109 | bool clean_when_opened:1; | 111 | bool clean_when_opened:1; |
110 | 112 | ||
111 | char policy_name[CACHE_POLICY_NAME_SIZE]; | 113 | char policy_name[CACHE_POLICY_NAME_SIZE]; |
114 | unsigned policy_version[CACHE_POLICY_VERSION_SIZE]; | ||
112 | size_t policy_hint_size; | 115 | size_t policy_hint_size; |
113 | struct dm_cache_statistics stats; | 116 | struct dm_cache_statistics stats; |
114 | }; | 117 | }; |
@@ -268,7 +271,8 @@ static int __write_initial_superblock(struct dm_cache_metadata *cmd) | |||
268 | memset(disk_super->uuid, 0, sizeof(disk_super->uuid)); | 271 | memset(disk_super->uuid, 0, sizeof(disk_super->uuid)); |
269 | disk_super->magic = cpu_to_le64(CACHE_SUPERBLOCK_MAGIC); | 272 | disk_super->magic = cpu_to_le64(CACHE_SUPERBLOCK_MAGIC); |
270 | disk_super->version = cpu_to_le32(CACHE_VERSION); | 273 | disk_super->version = cpu_to_le32(CACHE_VERSION); |
271 | memset(disk_super->policy_name, 0, CACHE_POLICY_NAME_SIZE); | 274 | memset(disk_super->policy_name, 0, sizeof(disk_super->policy_name)); |
275 | memset(disk_super->policy_version, 0, sizeof(disk_super->policy_version)); | ||
272 | disk_super->policy_hint_size = 0; | 276 | disk_super->policy_hint_size = 0; |
273 | 277 | ||
274 | r = dm_sm_copy_root(cmd->metadata_sm, &disk_super->metadata_space_map_root, | 278 | r = dm_sm_copy_root(cmd->metadata_sm, &disk_super->metadata_space_map_root, |
@@ -284,7 +288,6 @@ static int __write_initial_superblock(struct dm_cache_metadata *cmd) | |||
284 | disk_super->metadata_block_size = cpu_to_le32(DM_CACHE_METADATA_BLOCK_SIZE >> SECTOR_SHIFT); | 288 | disk_super->metadata_block_size = cpu_to_le32(DM_CACHE_METADATA_BLOCK_SIZE >> SECTOR_SHIFT); |
285 | disk_super->data_block_size = cpu_to_le32(cmd->data_block_size); | 289 | disk_super->data_block_size = cpu_to_le32(cmd->data_block_size); |
286 | disk_super->cache_blocks = cpu_to_le32(0); | 290 | disk_super->cache_blocks = cpu_to_le32(0); |
287 | memset(disk_super->policy_name, 0, sizeof(disk_super->policy_name)); | ||
288 | 291 | ||
289 | disk_super->read_hits = cpu_to_le32(0); | 292 | disk_super->read_hits = cpu_to_le32(0); |
290 | disk_super->read_misses = cpu_to_le32(0); | 293 | disk_super->read_misses = cpu_to_le32(0); |
@@ -478,6 +481,9 @@ static void read_superblock_fields(struct dm_cache_metadata *cmd, | |||
478 | cmd->data_block_size = le32_to_cpu(disk_super->data_block_size); | 481 | cmd->data_block_size = le32_to_cpu(disk_super->data_block_size); |
479 | cmd->cache_blocks = to_cblock(le32_to_cpu(disk_super->cache_blocks)); | 482 | cmd->cache_blocks = to_cblock(le32_to_cpu(disk_super->cache_blocks)); |
480 | strncpy(cmd->policy_name, disk_super->policy_name, sizeof(cmd->policy_name)); | 483 | strncpy(cmd->policy_name, disk_super->policy_name, sizeof(cmd->policy_name)); |
484 | cmd->policy_version[0] = le32_to_cpu(disk_super->policy_version[0]); | ||
485 | cmd->policy_version[1] = le32_to_cpu(disk_super->policy_version[1]); | ||
486 | cmd->policy_version[2] = le32_to_cpu(disk_super->policy_version[2]); | ||
481 | cmd->policy_hint_size = le32_to_cpu(disk_super->policy_hint_size); | 487 | cmd->policy_hint_size = le32_to_cpu(disk_super->policy_hint_size); |
482 | 488 | ||
483 | cmd->stats.read_hits = le32_to_cpu(disk_super->read_hits); | 489 | cmd->stats.read_hits = le32_to_cpu(disk_super->read_hits); |
@@ -572,6 +578,9 @@ static int __commit_transaction(struct dm_cache_metadata *cmd, | |||
572 | disk_super->discard_nr_blocks = cpu_to_le64(from_dblock(cmd->discard_nr_blocks)); | 578 | disk_super->discard_nr_blocks = cpu_to_le64(from_dblock(cmd->discard_nr_blocks)); |
573 | disk_super->cache_blocks = cpu_to_le32(from_cblock(cmd->cache_blocks)); | 579 | disk_super->cache_blocks = cpu_to_le32(from_cblock(cmd->cache_blocks)); |
574 | strncpy(disk_super->policy_name, cmd->policy_name, sizeof(disk_super->policy_name)); | 580 | strncpy(disk_super->policy_name, cmd->policy_name, sizeof(disk_super->policy_name)); |
581 | disk_super->policy_version[0] = cpu_to_le32(cmd->policy_version[0]); | ||
582 | disk_super->policy_version[1] = cpu_to_le32(cmd->policy_version[1]); | ||
583 | disk_super->policy_version[2] = cpu_to_le32(cmd->policy_version[2]); | ||
575 | 584 | ||
576 | disk_super->read_hits = cpu_to_le32(cmd->stats.read_hits); | 585 | disk_super->read_hits = cpu_to_le32(cmd->stats.read_hits); |
577 | disk_super->read_misses = cpu_to_le32(cmd->stats.read_misses); | 586 | disk_super->read_misses = cpu_to_le32(cmd->stats.read_misses); |
@@ -854,18 +863,43 @@ struct thunk { | |||
854 | bool hints_valid; | 863 | bool hints_valid; |
855 | }; | 864 | }; |
856 | 865 | ||
866 | static bool policy_unchanged(struct dm_cache_metadata *cmd, | ||
867 | struct dm_cache_policy *policy) | ||
868 | { | ||
869 | const char *policy_name = dm_cache_policy_get_name(policy); | ||
870 | const unsigned *policy_version = dm_cache_policy_get_version(policy); | ||
871 | size_t policy_hint_size = dm_cache_policy_get_hint_size(policy); | ||
872 | |||
873 | /* | ||
874 | * Ensure policy names match. | ||
875 | */ | ||
876 | if (strncmp(cmd->policy_name, policy_name, sizeof(cmd->policy_name))) | ||
877 | return false; | ||
878 | |||
879 | /* | ||
880 | * Ensure policy major versions match. | ||
881 | */ | ||
882 | if (cmd->policy_version[0] != policy_version[0]) | ||
883 | return false; | ||
884 | |||
885 | /* | ||
886 | * Ensure policy hint sizes match. | ||
887 | */ | ||
888 | if (cmd->policy_hint_size != policy_hint_size) | ||
889 | return false; | ||
890 | |||
891 | return true; | ||
892 | } | ||
893 | |||
857 | static bool hints_array_initialized(struct dm_cache_metadata *cmd) | 894 | static bool hints_array_initialized(struct dm_cache_metadata *cmd) |
858 | { | 895 | { |
859 | return cmd->hint_root && cmd->policy_hint_size; | 896 | return cmd->hint_root && cmd->policy_hint_size; |
860 | } | 897 | } |
861 | 898 | ||
862 | static bool hints_array_available(struct dm_cache_metadata *cmd, | 899 | static bool hints_array_available(struct dm_cache_metadata *cmd, |
863 | const char *policy_name) | 900 | struct dm_cache_policy *policy) |
864 | { | 901 | { |
865 | bool policy_names_match = !strncmp(cmd->policy_name, policy_name, | 902 | return cmd->clean_when_opened && policy_unchanged(cmd, policy) && |
866 | sizeof(cmd->policy_name)); | ||
867 | |||
868 | return cmd->clean_when_opened && policy_names_match && | ||
869 | hints_array_initialized(cmd); | 903 | hints_array_initialized(cmd); |
870 | } | 904 | } |
871 | 905 | ||
@@ -899,7 +933,8 @@ static int __load_mapping(void *context, uint64_t cblock, void *leaf) | |||
899 | return r; | 933 | return r; |
900 | } | 934 | } |
901 | 935 | ||
902 | static int __load_mappings(struct dm_cache_metadata *cmd, const char *policy_name, | 936 | static int __load_mappings(struct dm_cache_metadata *cmd, |
937 | struct dm_cache_policy *policy, | ||
903 | load_mapping_fn fn, void *context) | 938 | load_mapping_fn fn, void *context) |
904 | { | 939 | { |
905 | struct thunk thunk; | 940 | struct thunk thunk; |
@@ -909,18 +944,19 @@ static int __load_mappings(struct dm_cache_metadata *cmd, const char *policy_nam | |||
909 | 944 | ||
910 | thunk.cmd = cmd; | 945 | thunk.cmd = cmd; |
911 | thunk.respect_dirty_flags = cmd->clean_when_opened; | 946 | thunk.respect_dirty_flags = cmd->clean_when_opened; |
912 | thunk.hints_valid = hints_array_available(cmd, policy_name); | 947 | thunk.hints_valid = hints_array_available(cmd, policy); |
913 | 948 | ||
914 | return dm_array_walk(&cmd->info, cmd->root, __load_mapping, &thunk); | 949 | return dm_array_walk(&cmd->info, cmd->root, __load_mapping, &thunk); |
915 | } | 950 | } |
916 | 951 | ||
917 | int dm_cache_load_mappings(struct dm_cache_metadata *cmd, const char *policy_name, | 952 | int dm_cache_load_mappings(struct dm_cache_metadata *cmd, |
953 | struct dm_cache_policy *policy, | ||
918 | load_mapping_fn fn, void *context) | 954 | load_mapping_fn fn, void *context) |
919 | { | 955 | { |
920 | int r; | 956 | int r; |
921 | 957 | ||
922 | down_read(&cmd->root_lock); | 958 | down_read(&cmd->root_lock); |
923 | r = __load_mappings(cmd, policy_name, fn, context); | 959 | r = __load_mappings(cmd, policy, fn, context); |
924 | up_read(&cmd->root_lock); | 960 | up_read(&cmd->root_lock); |
925 | 961 | ||
926 | return r; | 962 | return r; |
@@ -979,7 +1015,7 @@ static int __dirty(struct dm_cache_metadata *cmd, dm_cblock_t cblock, bool dirty | |||
979 | /* nothing to be done */ | 1015 | /* nothing to be done */ |
980 | return 0; | 1016 | return 0; |
981 | 1017 | ||
982 | value = pack_value(oblock, flags | (dirty ? M_DIRTY : 0)); | 1018 | value = pack_value(oblock, (flags & ~M_DIRTY) | (dirty ? M_DIRTY : 0)); |
983 | __dm_bless_for_disk(&value); | 1019 | __dm_bless_for_disk(&value); |
984 | 1020 | ||
985 | r = dm_array_set_value(&cmd->info, cmd->root, from_cblock(cblock), | 1021 | r = dm_array_set_value(&cmd->info, cmd->root, from_cblock(cblock), |
@@ -1070,13 +1106,15 @@ static int begin_hints(struct dm_cache_metadata *cmd, struct dm_cache_policy *po | |||
1070 | __le32 value; | 1106 | __le32 value; |
1071 | size_t hint_size; | 1107 | size_t hint_size; |
1072 | const char *policy_name = dm_cache_policy_get_name(policy); | 1108 | const char *policy_name = dm_cache_policy_get_name(policy); |
1109 | const unsigned *policy_version = dm_cache_policy_get_version(policy); | ||
1073 | 1110 | ||
1074 | if (!policy_name[0] || | 1111 | if (!policy_name[0] || |
1075 | (strlen(policy_name) > sizeof(cmd->policy_name) - 1)) | 1112 | (strlen(policy_name) > sizeof(cmd->policy_name) - 1)) |
1076 | return -EINVAL; | 1113 | return -EINVAL; |
1077 | 1114 | ||
1078 | if (strcmp(cmd->policy_name, policy_name)) { | 1115 | if (!policy_unchanged(cmd, policy)) { |
1079 | strncpy(cmd->policy_name, policy_name, sizeof(cmd->policy_name)); | 1116 | strncpy(cmd->policy_name, policy_name, sizeof(cmd->policy_name)); |
1117 | memcpy(cmd->policy_version, policy_version, sizeof(cmd->policy_version)); | ||
1080 | 1118 | ||
1081 | hint_size = dm_cache_policy_get_hint_size(policy); | 1119 | hint_size = dm_cache_policy_get_hint_size(policy); |
1082 | if (!hint_size) | 1120 | if (!hint_size) |
diff --git a/drivers/md/dm-cache-metadata.h b/drivers/md/dm-cache-metadata.h index 135864ea0eee..f45cef21f3d0 100644 --- a/drivers/md/dm-cache-metadata.h +++ b/drivers/md/dm-cache-metadata.h | |||
@@ -89,7 +89,7 @@ typedef int (*load_mapping_fn)(void *context, dm_oblock_t oblock, | |||
89 | dm_cblock_t cblock, bool dirty, | 89 | dm_cblock_t cblock, bool dirty, |
90 | uint32_t hint, bool hint_valid); | 90 | uint32_t hint, bool hint_valid); |
91 | int dm_cache_load_mappings(struct dm_cache_metadata *cmd, | 91 | int dm_cache_load_mappings(struct dm_cache_metadata *cmd, |
92 | const char *policy_name, | 92 | struct dm_cache_policy *policy, |
93 | load_mapping_fn fn, | 93 | load_mapping_fn fn, |
94 | void *context); | 94 | void *context); |
95 | 95 | ||
diff --git a/drivers/md/dm-cache-policy-cleaner.c b/drivers/md/dm-cache-policy-cleaner.c index cc05d70b3cb8..b04d1f904d07 100644 --- a/drivers/md/dm-cache-policy-cleaner.c +++ b/drivers/md/dm-cache-policy-cleaner.c | |||
@@ -17,7 +17,6 @@ | |||
17 | /*----------------------------------------------------------------*/ | 17 | /*----------------------------------------------------------------*/ |
18 | 18 | ||
19 | #define DM_MSG_PREFIX "cache cleaner" | 19 | #define DM_MSG_PREFIX "cache cleaner" |
20 | #define CLEANER_VERSION "1.0.0" | ||
21 | 20 | ||
22 | /* Cache entry struct. */ | 21 | /* Cache entry struct. */ |
23 | struct wb_cache_entry { | 22 | struct wb_cache_entry { |
@@ -434,6 +433,7 @@ static struct dm_cache_policy *wb_create(dm_cblock_t cache_size, | |||
434 | 433 | ||
435 | static struct dm_cache_policy_type wb_policy_type = { | 434 | static struct dm_cache_policy_type wb_policy_type = { |
436 | .name = "cleaner", | 435 | .name = "cleaner", |
436 | .version = {1, 0, 0}, | ||
437 | .hint_size = 0, | 437 | .hint_size = 0, |
438 | .owner = THIS_MODULE, | 438 | .owner = THIS_MODULE, |
439 | .create = wb_create | 439 | .create = wb_create |
@@ -446,7 +446,10 @@ static int __init wb_init(void) | |||
446 | if (r < 0) | 446 | if (r < 0) |
447 | DMERR("register failed %d", r); | 447 | DMERR("register failed %d", r); |
448 | else | 448 | else |
449 | DMINFO("version " CLEANER_VERSION " loaded"); | 449 | DMINFO("version %u.%u.%u loaded", |
450 | wb_policy_type.version[0], | ||
451 | wb_policy_type.version[1], | ||
452 | wb_policy_type.version[2]); | ||
450 | 453 | ||
451 | return r; | 454 | return r; |
452 | } | 455 | } |
diff --git a/drivers/md/dm-cache-policy-internal.h b/drivers/md/dm-cache-policy-internal.h index 52a75beeced5..0928abdc49f0 100644 --- a/drivers/md/dm-cache-policy-internal.h +++ b/drivers/md/dm-cache-policy-internal.h | |||
@@ -117,6 +117,8 @@ void dm_cache_policy_destroy(struct dm_cache_policy *p); | |||
117 | */ | 117 | */ |
118 | const char *dm_cache_policy_get_name(struct dm_cache_policy *p); | 118 | const char *dm_cache_policy_get_name(struct dm_cache_policy *p); |
119 | 119 | ||
120 | const unsigned *dm_cache_policy_get_version(struct dm_cache_policy *p); | ||
121 | |||
120 | size_t dm_cache_policy_get_hint_size(struct dm_cache_policy *p); | 122 | size_t dm_cache_policy_get_hint_size(struct dm_cache_policy *p); |
121 | 123 | ||
122 | /*----------------------------------------------------------------*/ | 124 | /*----------------------------------------------------------------*/ |
diff --git a/drivers/md/dm-cache-policy-mq.c b/drivers/md/dm-cache-policy-mq.c index 964153255076..dc112a7137fe 100644 --- a/drivers/md/dm-cache-policy-mq.c +++ b/drivers/md/dm-cache-policy-mq.c | |||
@@ -14,7 +14,6 @@ | |||
14 | #include <linux/vmalloc.h> | 14 | #include <linux/vmalloc.h> |
15 | 15 | ||
16 | #define DM_MSG_PREFIX "cache-policy-mq" | 16 | #define DM_MSG_PREFIX "cache-policy-mq" |
17 | #define MQ_VERSION "1.0.0" | ||
18 | 17 | ||
19 | static struct kmem_cache *mq_entry_cache; | 18 | static struct kmem_cache *mq_entry_cache; |
20 | 19 | ||
@@ -1133,6 +1132,7 @@ bad_cache_alloc: | |||
1133 | 1132 | ||
1134 | static struct dm_cache_policy_type mq_policy_type = { | 1133 | static struct dm_cache_policy_type mq_policy_type = { |
1135 | .name = "mq", | 1134 | .name = "mq", |
1135 | .version = {1, 0, 0}, | ||
1136 | .hint_size = 4, | 1136 | .hint_size = 4, |
1137 | .owner = THIS_MODULE, | 1137 | .owner = THIS_MODULE, |
1138 | .create = mq_create | 1138 | .create = mq_create |
@@ -1140,6 +1140,7 @@ static struct dm_cache_policy_type mq_policy_type = { | |||
1140 | 1140 | ||
1141 | static struct dm_cache_policy_type default_policy_type = { | 1141 | static struct dm_cache_policy_type default_policy_type = { |
1142 | .name = "default", | 1142 | .name = "default", |
1143 | .version = {1, 0, 0}, | ||
1143 | .hint_size = 4, | 1144 | .hint_size = 4, |
1144 | .owner = THIS_MODULE, | 1145 | .owner = THIS_MODULE, |
1145 | .create = mq_create | 1146 | .create = mq_create |
@@ -1164,7 +1165,10 @@ static int __init mq_init(void) | |||
1164 | 1165 | ||
1165 | r = dm_cache_policy_register(&default_policy_type); | 1166 | r = dm_cache_policy_register(&default_policy_type); |
1166 | if (!r) { | 1167 | if (!r) { |
1167 | DMINFO("version " MQ_VERSION " loaded"); | 1168 | DMINFO("version %u.%u.%u loaded", |
1169 | mq_policy_type.version[0], | ||
1170 | mq_policy_type.version[1], | ||
1171 | mq_policy_type.version[2]); | ||
1168 | return 0; | 1172 | return 0; |
1169 | } | 1173 | } |
1170 | 1174 | ||
diff --git a/drivers/md/dm-cache-policy.c b/drivers/md/dm-cache-policy.c index 2cbf5fdaac52..21c03c570c06 100644 --- a/drivers/md/dm-cache-policy.c +++ b/drivers/md/dm-cache-policy.c | |||
@@ -150,6 +150,14 @@ const char *dm_cache_policy_get_name(struct dm_cache_policy *p) | |||
150 | } | 150 | } |
151 | EXPORT_SYMBOL_GPL(dm_cache_policy_get_name); | 151 | EXPORT_SYMBOL_GPL(dm_cache_policy_get_name); |
152 | 152 | ||
153 | const unsigned *dm_cache_policy_get_version(struct dm_cache_policy *p) | ||
154 | { | ||
155 | struct dm_cache_policy_type *t = p->private; | ||
156 | |||
157 | return t->version; | ||
158 | } | ||
159 | EXPORT_SYMBOL_GPL(dm_cache_policy_get_version); | ||
160 | |||
153 | size_t dm_cache_policy_get_hint_size(struct dm_cache_policy *p) | 161 | size_t dm_cache_policy_get_hint_size(struct dm_cache_policy *p) |
154 | { | 162 | { |
155 | struct dm_cache_policy_type *t = p->private; | 163 | struct dm_cache_policy_type *t = p->private; |
diff --git a/drivers/md/dm-cache-policy.h b/drivers/md/dm-cache-policy.h index f0f51b260544..558bdfdabf5f 100644 --- a/drivers/md/dm-cache-policy.h +++ b/drivers/md/dm-cache-policy.h | |||
@@ -196,6 +196,7 @@ struct dm_cache_policy { | |||
196 | * We maintain a little register of the different policy types. | 196 | * We maintain a little register of the different policy types. |
197 | */ | 197 | */ |
198 | #define CACHE_POLICY_NAME_SIZE 16 | 198 | #define CACHE_POLICY_NAME_SIZE 16 |
199 | #define CACHE_POLICY_VERSION_SIZE 3 | ||
199 | 200 | ||
200 | struct dm_cache_policy_type { | 201 | struct dm_cache_policy_type { |
201 | /* For use by the register code only. */ | 202 | /* For use by the register code only. */ |
@@ -206,6 +207,7 @@ struct dm_cache_policy_type { | |||
206 | * what gets passed on the target line to select your policy. | 207 | * what gets passed on the target line to select your policy. |
207 | */ | 208 | */ |
208 | char name[CACHE_POLICY_NAME_SIZE]; | 209 | char name[CACHE_POLICY_NAME_SIZE]; |
210 | unsigned version[CACHE_POLICY_VERSION_SIZE]; | ||
209 | 211 | ||
210 | /* | 212 | /* |
211 | * Policies may store a hint for each each cache block. | 213 | * Policies may store a hint for each each cache block. |
diff --git a/drivers/md/dm-cache-target.c b/drivers/md/dm-cache-target.c index 0f4e84b15c30..66120bd46d15 100644 --- a/drivers/md/dm-cache-target.c +++ b/drivers/md/dm-cache-target.c | |||
@@ -142,6 +142,7 @@ struct cache { | |||
142 | spinlock_t lock; | 142 | spinlock_t lock; |
143 | struct bio_list deferred_bios; | 143 | struct bio_list deferred_bios; |
144 | struct bio_list deferred_flush_bios; | 144 | struct bio_list deferred_flush_bios; |
145 | struct bio_list deferred_writethrough_bios; | ||
145 | struct list_head quiesced_migrations; | 146 | struct list_head quiesced_migrations; |
146 | struct list_head completed_migrations; | 147 | struct list_head completed_migrations; |
147 | struct list_head need_commit_migrations; | 148 | struct list_head need_commit_migrations; |
@@ -158,7 +159,7 @@ struct cache { | |||
158 | /* | 159 | /* |
159 | * origin_blocks entries, discarded if set. | 160 | * origin_blocks entries, discarded if set. |
160 | */ | 161 | */ |
161 | sector_t discard_block_size; /* a power of 2 times sectors per block */ | 162 | uint32_t discard_block_size; /* a power of 2 times sectors per block */ |
162 | dm_dblock_t discard_nr_blocks; | 163 | dm_dblock_t discard_nr_blocks; |
163 | unsigned long *discard_bitset; | 164 | unsigned long *discard_bitset; |
164 | 165 | ||
@@ -199,6 +200,11 @@ struct per_bio_data { | |||
199 | bool tick:1; | 200 | bool tick:1; |
200 | unsigned req_nr:2; | 201 | unsigned req_nr:2; |
201 | struct dm_deferred_entry *all_io_entry; | 202 | struct dm_deferred_entry *all_io_entry; |
203 | |||
204 | /* writethrough fields */ | ||
205 | struct cache *cache; | ||
206 | dm_cblock_t cblock; | ||
207 | bio_end_io_t *saved_bi_end_io; | ||
202 | }; | 208 | }; |
203 | 209 | ||
204 | struct dm_cache_migration { | 210 | struct dm_cache_migration { |
@@ -412,17 +418,24 @@ static bool block_size_is_power_of_two(struct cache *cache) | |||
412 | return cache->sectors_per_block_shift >= 0; | 418 | return cache->sectors_per_block_shift >= 0; |
413 | } | 419 | } |
414 | 420 | ||
421 | static dm_block_t block_div(dm_block_t b, uint32_t n) | ||
422 | { | ||
423 | do_div(b, n); | ||
424 | |||
425 | return b; | ||
426 | } | ||
427 | |||
415 | static dm_dblock_t oblock_to_dblock(struct cache *cache, dm_oblock_t oblock) | 428 | static dm_dblock_t oblock_to_dblock(struct cache *cache, dm_oblock_t oblock) |
416 | { | 429 | { |
417 | sector_t discard_blocks = cache->discard_block_size; | 430 | uint32_t discard_blocks = cache->discard_block_size; |
418 | dm_block_t b = from_oblock(oblock); | 431 | dm_block_t b = from_oblock(oblock); |
419 | 432 | ||
420 | if (!block_size_is_power_of_two(cache)) | 433 | if (!block_size_is_power_of_two(cache)) |
421 | (void) sector_div(discard_blocks, cache->sectors_per_block); | 434 | discard_blocks = discard_blocks / cache->sectors_per_block; |
422 | else | 435 | else |
423 | discard_blocks >>= cache->sectors_per_block_shift; | 436 | discard_blocks >>= cache->sectors_per_block_shift; |
424 | 437 | ||
425 | (void) sector_div(b, discard_blocks); | 438 | b = block_div(b, discard_blocks); |
426 | 439 | ||
427 | return to_dblock(b); | 440 | return to_dblock(b); |
428 | } | 441 | } |
@@ -609,6 +622,56 @@ static void issue(struct cache *cache, struct bio *bio) | |||
609 | spin_unlock_irqrestore(&cache->lock, flags); | 622 | spin_unlock_irqrestore(&cache->lock, flags); |
610 | } | 623 | } |
611 | 624 | ||
625 | static void defer_writethrough_bio(struct cache *cache, struct bio *bio) | ||
626 | { | ||
627 | unsigned long flags; | ||
628 | |||
629 | spin_lock_irqsave(&cache->lock, flags); | ||
630 | bio_list_add(&cache->deferred_writethrough_bios, bio); | ||
631 | spin_unlock_irqrestore(&cache->lock, flags); | ||
632 | |||
633 | wake_worker(cache); | ||
634 | } | ||
635 | |||
636 | static void writethrough_endio(struct bio *bio, int err) | ||
637 | { | ||
638 | struct per_bio_data *pb = get_per_bio_data(bio); | ||
639 | bio->bi_end_io = pb->saved_bi_end_io; | ||
640 | |||
641 | if (err) { | ||
642 | bio_endio(bio, err); | ||
643 | return; | ||
644 | } | ||
645 | |||
646 | remap_to_cache(pb->cache, bio, pb->cblock); | ||
647 | |||
648 | /* | ||
649 | * We can't issue this bio directly, since we're in interrupt | ||
650 | * context. So it get's put on a bio list for processing by the | ||
651 | * worker thread. | ||
652 | */ | ||
653 | defer_writethrough_bio(pb->cache, bio); | ||
654 | } | ||
655 | |||
656 | /* | ||
657 | * When running in writethrough mode we need to send writes to clean blocks | ||
658 | * to both the cache and origin devices. In future we'd like to clone the | ||
659 | * bio and send them in parallel, but for now we're doing them in | ||
660 | * series as this is easier. | ||
661 | */ | ||
662 | static void remap_to_origin_then_cache(struct cache *cache, struct bio *bio, | ||
663 | dm_oblock_t oblock, dm_cblock_t cblock) | ||
664 | { | ||
665 | struct per_bio_data *pb = get_per_bio_data(bio); | ||
666 | |||
667 | pb->cache = cache; | ||
668 | pb->cblock = cblock; | ||
669 | pb->saved_bi_end_io = bio->bi_end_io; | ||
670 | bio->bi_end_io = writethrough_endio; | ||
671 | |||
672 | remap_to_origin_clear_discard(pb->cache, bio, oblock); | ||
673 | } | ||
674 | |||
612 | /*---------------------------------------------------------------- | 675 | /*---------------------------------------------------------------- |
613 | * Migration processing | 676 | * Migration processing |
614 | * | 677 | * |
@@ -1002,7 +1065,7 @@ static void process_discard_bio(struct cache *cache, struct bio *bio) | |||
1002 | dm_block_t end_block = bio->bi_sector + bio_sectors(bio); | 1065 | dm_block_t end_block = bio->bi_sector + bio_sectors(bio); |
1003 | dm_block_t b; | 1066 | dm_block_t b; |
1004 | 1067 | ||
1005 | (void) sector_div(end_block, cache->discard_block_size); | 1068 | end_block = block_div(end_block, cache->discard_block_size); |
1006 | 1069 | ||
1007 | for (b = start_block; b < end_block; b++) | 1070 | for (b = start_block; b < end_block; b++) |
1008 | set_discard(cache, to_dblock(b)); | 1071 | set_discard(cache, to_dblock(b)); |
@@ -1070,14 +1133,9 @@ static void process_bio(struct cache *cache, struct prealloc *structs, | |||
1070 | inc_hit_counter(cache, bio); | 1133 | inc_hit_counter(cache, bio); |
1071 | pb->all_io_entry = dm_deferred_entry_inc(cache->all_io_ds); | 1134 | pb->all_io_entry = dm_deferred_entry_inc(cache->all_io_ds); |
1072 | 1135 | ||
1073 | if (is_writethrough_io(cache, bio, lookup_result.cblock)) { | 1136 | if (is_writethrough_io(cache, bio, lookup_result.cblock)) |
1074 | /* | 1137 | remap_to_origin_then_cache(cache, bio, block, lookup_result.cblock); |
1075 | * No need to mark anything dirty in write through mode. | 1138 | else |
1076 | */ | ||
1077 | pb->req_nr == 0 ? | ||
1078 | remap_to_cache(cache, bio, lookup_result.cblock) : | ||
1079 | remap_to_origin_clear_discard(cache, bio, block); | ||
1080 | } else | ||
1081 | remap_to_cache_dirty(cache, bio, block, lookup_result.cblock); | 1139 | remap_to_cache_dirty(cache, bio, block, lookup_result.cblock); |
1082 | 1140 | ||
1083 | issue(cache, bio); | 1141 | issue(cache, bio); |
@@ -1086,17 +1144,8 @@ static void process_bio(struct cache *cache, struct prealloc *structs, | |||
1086 | case POLICY_MISS: | 1144 | case POLICY_MISS: |
1087 | inc_miss_counter(cache, bio); | 1145 | inc_miss_counter(cache, bio); |
1088 | pb->all_io_entry = dm_deferred_entry_inc(cache->all_io_ds); | 1146 | pb->all_io_entry = dm_deferred_entry_inc(cache->all_io_ds); |
1089 | 1147 | remap_to_origin_clear_discard(cache, bio, block); | |
1090 | if (pb->req_nr != 0) { | 1148 | issue(cache, bio); |
1091 | /* | ||
1092 | * This is a duplicate writethrough io that is no | ||
1093 | * longer needed because the block has been demoted. | ||
1094 | */ | ||
1095 | bio_endio(bio, 0); | ||
1096 | } else { | ||
1097 | remap_to_origin_clear_discard(cache, bio, block); | ||
1098 | issue(cache, bio); | ||
1099 | } | ||
1100 | break; | 1149 | break; |
1101 | 1150 | ||
1102 | case POLICY_NEW: | 1151 | case POLICY_NEW: |
@@ -1217,6 +1266,23 @@ static void process_deferred_flush_bios(struct cache *cache, bool submit_bios) | |||
1217 | submit_bios ? generic_make_request(bio) : bio_io_error(bio); | 1266 | submit_bios ? generic_make_request(bio) : bio_io_error(bio); |
1218 | } | 1267 | } |
1219 | 1268 | ||
1269 | static void process_deferred_writethrough_bios(struct cache *cache) | ||
1270 | { | ||
1271 | unsigned long flags; | ||
1272 | struct bio_list bios; | ||
1273 | struct bio *bio; | ||
1274 | |||
1275 | bio_list_init(&bios); | ||
1276 | |||
1277 | spin_lock_irqsave(&cache->lock, flags); | ||
1278 | bio_list_merge(&bios, &cache->deferred_writethrough_bios); | ||
1279 | bio_list_init(&cache->deferred_writethrough_bios); | ||
1280 | spin_unlock_irqrestore(&cache->lock, flags); | ||
1281 | |||
1282 | while ((bio = bio_list_pop(&bios))) | ||
1283 | generic_make_request(bio); | ||
1284 | } | ||
1285 | |||
1220 | static void writeback_some_dirty_blocks(struct cache *cache) | 1286 | static void writeback_some_dirty_blocks(struct cache *cache) |
1221 | { | 1287 | { |
1222 | int r = 0; | 1288 | int r = 0; |
@@ -1313,6 +1379,7 @@ static int more_work(struct cache *cache) | |||
1313 | else | 1379 | else |
1314 | return !bio_list_empty(&cache->deferred_bios) || | 1380 | return !bio_list_empty(&cache->deferred_bios) || |
1315 | !bio_list_empty(&cache->deferred_flush_bios) || | 1381 | !bio_list_empty(&cache->deferred_flush_bios) || |
1382 | !bio_list_empty(&cache->deferred_writethrough_bios) || | ||
1316 | !list_empty(&cache->quiesced_migrations) || | 1383 | !list_empty(&cache->quiesced_migrations) || |
1317 | !list_empty(&cache->completed_migrations) || | 1384 | !list_empty(&cache->completed_migrations) || |
1318 | !list_empty(&cache->need_commit_migrations); | 1385 | !list_empty(&cache->need_commit_migrations); |
@@ -1331,6 +1398,8 @@ static void do_worker(struct work_struct *ws) | |||
1331 | 1398 | ||
1332 | writeback_some_dirty_blocks(cache); | 1399 | writeback_some_dirty_blocks(cache); |
1333 | 1400 | ||
1401 | process_deferred_writethrough_bios(cache); | ||
1402 | |||
1334 | if (commit_if_needed(cache)) { | 1403 | if (commit_if_needed(cache)) { |
1335 | process_deferred_flush_bios(cache, false); | 1404 | process_deferred_flush_bios(cache, false); |
1336 | 1405 | ||
@@ -1756,8 +1825,11 @@ static int create_cache_policy(struct cache *cache, struct cache_args *ca, | |||
1756 | } | 1825 | } |
1757 | 1826 | ||
1758 | r = set_config_values(cache->policy, ca->policy_argc, ca->policy_argv); | 1827 | r = set_config_values(cache->policy, ca->policy_argc, ca->policy_argv); |
1759 | if (r) | 1828 | if (r) { |
1829 | *error = "Error setting cache policy's config values"; | ||
1760 | dm_cache_policy_destroy(cache->policy); | 1830 | dm_cache_policy_destroy(cache->policy); |
1831 | cache->policy = NULL; | ||
1832 | } | ||
1761 | 1833 | ||
1762 | return r; | 1834 | return r; |
1763 | } | 1835 | } |
@@ -1793,8 +1865,6 @@ static sector_t calculate_discard_block_size(sector_t cache_block_size, | |||
1793 | 1865 | ||
1794 | #define DEFAULT_MIGRATION_THRESHOLD (2048 * 100) | 1866 | #define DEFAULT_MIGRATION_THRESHOLD (2048 * 100) |
1795 | 1867 | ||
1796 | static unsigned cache_num_write_bios(struct dm_target *ti, struct bio *bio); | ||
1797 | |||
1798 | static int cache_create(struct cache_args *ca, struct cache **result) | 1868 | static int cache_create(struct cache_args *ca, struct cache **result) |
1799 | { | 1869 | { |
1800 | int r = 0; | 1870 | int r = 0; |
@@ -1821,9 +1891,6 @@ static int cache_create(struct cache_args *ca, struct cache **result) | |||
1821 | 1891 | ||
1822 | memcpy(&cache->features, &ca->features, sizeof(cache->features)); | 1892 | memcpy(&cache->features, &ca->features, sizeof(cache->features)); |
1823 | 1893 | ||
1824 | if (cache->features.write_through) | ||
1825 | ti->num_write_bios = cache_num_write_bios; | ||
1826 | |||
1827 | cache->callbacks.congested_fn = cache_is_congested; | 1894 | cache->callbacks.congested_fn = cache_is_congested; |
1828 | dm_table_add_target_callbacks(ti->table, &cache->callbacks); | 1895 | dm_table_add_target_callbacks(ti->table, &cache->callbacks); |
1829 | 1896 | ||
@@ -1835,7 +1902,7 @@ static int cache_create(struct cache_args *ca, struct cache **result) | |||
1835 | 1902 | ||
1836 | /* FIXME: factor out this whole section */ | 1903 | /* FIXME: factor out this whole section */ |
1837 | origin_blocks = cache->origin_sectors = ca->origin_sectors; | 1904 | origin_blocks = cache->origin_sectors = ca->origin_sectors; |
1838 | (void) sector_div(origin_blocks, ca->block_size); | 1905 | origin_blocks = block_div(origin_blocks, ca->block_size); |
1839 | cache->origin_blocks = to_oblock(origin_blocks); | 1906 | cache->origin_blocks = to_oblock(origin_blocks); |
1840 | 1907 | ||
1841 | cache->sectors_per_block = ca->block_size; | 1908 | cache->sectors_per_block = ca->block_size; |
@@ -1848,7 +1915,7 @@ static int cache_create(struct cache_args *ca, struct cache **result) | |||
1848 | dm_block_t cache_size = ca->cache_sectors; | 1915 | dm_block_t cache_size = ca->cache_sectors; |
1849 | 1916 | ||
1850 | cache->sectors_per_block_shift = -1; | 1917 | cache->sectors_per_block_shift = -1; |
1851 | (void) sector_div(cache_size, ca->block_size); | 1918 | cache_size = block_div(cache_size, ca->block_size); |
1852 | cache->cache_size = to_cblock(cache_size); | 1919 | cache->cache_size = to_cblock(cache_size); |
1853 | } else { | 1920 | } else { |
1854 | cache->sectors_per_block_shift = __ffs(ca->block_size); | 1921 | cache->sectors_per_block_shift = __ffs(ca->block_size); |
@@ -1873,6 +1940,7 @@ static int cache_create(struct cache_args *ca, struct cache **result) | |||
1873 | spin_lock_init(&cache->lock); | 1940 | spin_lock_init(&cache->lock); |
1874 | bio_list_init(&cache->deferred_bios); | 1941 | bio_list_init(&cache->deferred_bios); |
1875 | bio_list_init(&cache->deferred_flush_bios); | 1942 | bio_list_init(&cache->deferred_flush_bios); |
1943 | bio_list_init(&cache->deferred_writethrough_bios); | ||
1876 | INIT_LIST_HEAD(&cache->quiesced_migrations); | 1944 | INIT_LIST_HEAD(&cache->quiesced_migrations); |
1877 | INIT_LIST_HEAD(&cache->completed_migrations); | 1945 | INIT_LIST_HEAD(&cache->completed_migrations); |
1878 | INIT_LIST_HEAD(&cache->need_commit_migrations); | 1946 | INIT_LIST_HEAD(&cache->need_commit_migrations); |
@@ -2002,6 +2070,8 @@ static int cache_ctr(struct dm_target *ti, unsigned argc, char **argv) | |||
2002 | goto out; | 2070 | goto out; |
2003 | 2071 | ||
2004 | r = cache_create(ca, &cache); | 2072 | r = cache_create(ca, &cache); |
2073 | if (r) | ||
2074 | goto out; | ||
2005 | 2075 | ||
2006 | r = copy_ctr_args(cache, argc - 3, (const char **)argv + 3); | 2076 | r = copy_ctr_args(cache, argc - 3, (const char **)argv + 3); |
2007 | if (r) { | 2077 | if (r) { |
@@ -2016,20 +2086,6 @@ out: | |||
2016 | return r; | 2086 | return r; |
2017 | } | 2087 | } |
2018 | 2088 | ||
2019 | static unsigned cache_num_write_bios(struct dm_target *ti, struct bio *bio) | ||
2020 | { | ||
2021 | int r; | ||
2022 | struct cache *cache = ti->private; | ||
2023 | dm_oblock_t block = get_bio_block(cache, bio); | ||
2024 | dm_cblock_t cblock; | ||
2025 | |||
2026 | r = policy_lookup(cache->policy, block, &cblock); | ||
2027 | if (r < 0) | ||
2028 | return 2; /* assume the worst */ | ||
2029 | |||
2030 | return (!r && !is_dirty(cache, cblock)) ? 2 : 1; | ||
2031 | } | ||
2032 | |||
2033 | static int cache_map(struct dm_target *ti, struct bio *bio) | 2089 | static int cache_map(struct dm_target *ti, struct bio *bio) |
2034 | { | 2090 | { |
2035 | struct cache *cache = ti->private; | 2091 | struct cache *cache = ti->private; |
@@ -2097,18 +2153,12 @@ static int cache_map(struct dm_target *ti, struct bio *bio) | |||
2097 | inc_hit_counter(cache, bio); | 2153 | inc_hit_counter(cache, bio); |
2098 | pb->all_io_entry = dm_deferred_entry_inc(cache->all_io_ds); | 2154 | pb->all_io_entry = dm_deferred_entry_inc(cache->all_io_ds); |
2099 | 2155 | ||
2100 | if (is_writethrough_io(cache, bio, lookup_result.cblock)) { | 2156 | if (is_writethrough_io(cache, bio, lookup_result.cblock)) |
2101 | /* | 2157 | remap_to_origin_then_cache(cache, bio, block, lookup_result.cblock); |
2102 | * No need to mark anything dirty in write through mode. | 2158 | else |
2103 | */ | ||
2104 | pb->req_nr == 0 ? | ||
2105 | remap_to_cache(cache, bio, lookup_result.cblock) : | ||
2106 | remap_to_origin_clear_discard(cache, bio, block); | ||
2107 | cell_defer(cache, cell, false); | ||
2108 | } else { | ||
2109 | remap_to_cache_dirty(cache, bio, block, lookup_result.cblock); | 2159 | remap_to_cache_dirty(cache, bio, block, lookup_result.cblock); |
2110 | cell_defer(cache, cell, false); | 2160 | |
2111 | } | 2161 | cell_defer(cache, cell, false); |
2112 | break; | 2162 | break; |
2113 | 2163 | ||
2114 | case POLICY_MISS: | 2164 | case POLICY_MISS: |
@@ -2319,8 +2369,7 @@ static int cache_preresume(struct dm_target *ti) | |||
2319 | } | 2369 | } |
2320 | 2370 | ||
2321 | if (!cache->loaded_mappings) { | 2371 | if (!cache->loaded_mappings) { |
2322 | r = dm_cache_load_mappings(cache->cmd, | 2372 | r = dm_cache_load_mappings(cache->cmd, cache->policy, |
2323 | dm_cache_policy_get_name(cache->policy), | ||
2324 | load_mapping, cache); | 2373 | load_mapping, cache); |
2325 | if (r) { | 2374 | if (r) { |
2326 | DMERR("could not load cache mappings"); | 2375 | DMERR("could not load cache mappings"); |
@@ -2535,7 +2584,7 @@ static void cache_io_hints(struct dm_target *ti, struct queue_limits *limits) | |||
2535 | 2584 | ||
2536 | static struct target_type cache_target = { | 2585 | static struct target_type cache_target = { |
2537 | .name = "cache", | 2586 | .name = "cache", |
2538 | .version = {1, 0, 0}, | 2587 | .version = {1, 1, 0}, |
2539 | .module = THIS_MODULE, | 2588 | .module = THIS_MODULE, |
2540 | .ctr = cache_ctr, | 2589 | .ctr = cache_ctr, |
2541 | .dtr = cache_dtr, | 2590 | .dtr = cache_dtr, |
diff --git a/drivers/md/dm-thin.c b/drivers/md/dm-thin.c index 009339d62828..004ad1652b73 100644 --- a/drivers/md/dm-thin.c +++ b/drivers/md/dm-thin.c | |||
@@ -1577,6 +1577,11 @@ static bool data_dev_supports_discard(struct pool_c *pt) | |||
1577 | return q && blk_queue_discard(q); | 1577 | return q && blk_queue_discard(q); |
1578 | } | 1578 | } |
1579 | 1579 | ||
1580 | static bool is_factor(sector_t block_size, uint32_t n) | ||
1581 | { | ||
1582 | return !sector_div(block_size, n); | ||
1583 | } | ||
1584 | |||
1580 | /* | 1585 | /* |
1581 | * If discard_passdown was enabled verify that the data device | 1586 | * If discard_passdown was enabled verify that the data device |
1582 | * supports discards. Disable discard_passdown if not. | 1587 | * supports discards. Disable discard_passdown if not. |
@@ -1602,7 +1607,7 @@ static void disable_passdown_if_not_supported(struct pool_c *pt) | |||
1602 | else if (data_limits->discard_granularity > block_size) | 1607 | else if (data_limits->discard_granularity > block_size) |
1603 | reason = "discard granularity larger than a block"; | 1608 | reason = "discard granularity larger than a block"; |
1604 | 1609 | ||
1605 | else if (block_size & (data_limits->discard_granularity - 1)) | 1610 | else if (!is_factor(block_size, data_limits->discard_granularity)) |
1606 | reason = "discard granularity not a factor of block size"; | 1611 | reason = "discard granularity not a factor of block size"; |
1607 | 1612 | ||
1608 | if (reason) { | 1613 | if (reason) { |
@@ -2544,7 +2549,7 @@ static struct target_type pool_target = { | |||
2544 | .name = "thin-pool", | 2549 | .name = "thin-pool", |
2545 | .features = DM_TARGET_SINGLETON | DM_TARGET_ALWAYS_WRITEABLE | | 2550 | .features = DM_TARGET_SINGLETON | DM_TARGET_ALWAYS_WRITEABLE | |
2546 | DM_TARGET_IMMUTABLE, | 2551 | DM_TARGET_IMMUTABLE, |
2547 | .version = {1, 6, 1}, | 2552 | .version = {1, 7, 0}, |
2548 | .module = THIS_MODULE, | 2553 | .module = THIS_MODULE, |
2549 | .ctr = pool_ctr, | 2554 | .ctr = pool_ctr, |
2550 | .dtr = pool_dtr, | 2555 | .dtr = pool_dtr, |
@@ -2831,7 +2836,7 @@ static int thin_iterate_devices(struct dm_target *ti, | |||
2831 | 2836 | ||
2832 | static struct target_type thin_target = { | 2837 | static struct target_type thin_target = { |
2833 | .name = "thin", | 2838 | .name = "thin", |
2834 | .version = {1, 7, 1}, | 2839 | .version = {1, 8, 0}, |
2835 | .module = THIS_MODULE, | 2840 | .module = THIS_MODULE, |
2836 | .ctr = thin_ctr, | 2841 | .ctr = thin_ctr, |
2837 | .dtr = thin_dtr, | 2842 | .dtr = thin_dtr, |
diff --git a/drivers/md/dm-verity.c b/drivers/md/dm-verity.c index 6ad538375c3c..a746f1d21c66 100644 --- a/drivers/md/dm-verity.c +++ b/drivers/md/dm-verity.c | |||
@@ -93,6 +93,13 @@ struct dm_verity_io { | |||
93 | */ | 93 | */ |
94 | }; | 94 | }; |
95 | 95 | ||
96 | struct dm_verity_prefetch_work { | ||
97 | struct work_struct work; | ||
98 | struct dm_verity *v; | ||
99 | sector_t block; | ||
100 | unsigned n_blocks; | ||
101 | }; | ||
102 | |||
96 | static struct shash_desc *io_hash_desc(struct dm_verity *v, struct dm_verity_io *io) | 103 | static struct shash_desc *io_hash_desc(struct dm_verity *v, struct dm_verity_io *io) |
97 | { | 104 | { |
98 | return (struct shash_desc *)(io + 1); | 105 | return (struct shash_desc *)(io + 1); |
@@ -424,15 +431,18 @@ static void verity_end_io(struct bio *bio, int error) | |||
424 | * The root buffer is not prefetched, it is assumed that it will be cached | 431 | * The root buffer is not prefetched, it is assumed that it will be cached |
425 | * all the time. | 432 | * all the time. |
426 | */ | 433 | */ |
427 | static void verity_prefetch_io(struct dm_verity *v, struct dm_verity_io *io) | 434 | static void verity_prefetch_io(struct work_struct *work) |
428 | { | 435 | { |
436 | struct dm_verity_prefetch_work *pw = | ||
437 | container_of(work, struct dm_verity_prefetch_work, work); | ||
438 | struct dm_verity *v = pw->v; | ||
429 | int i; | 439 | int i; |
430 | 440 | ||
431 | for (i = v->levels - 2; i >= 0; i--) { | 441 | for (i = v->levels - 2; i >= 0; i--) { |
432 | sector_t hash_block_start; | 442 | sector_t hash_block_start; |
433 | sector_t hash_block_end; | 443 | sector_t hash_block_end; |
434 | verity_hash_at_level(v, io->block, i, &hash_block_start, NULL); | 444 | verity_hash_at_level(v, pw->block, i, &hash_block_start, NULL); |
435 | verity_hash_at_level(v, io->block + io->n_blocks - 1, i, &hash_block_end, NULL); | 445 | verity_hash_at_level(v, pw->block + pw->n_blocks - 1, i, &hash_block_end, NULL); |
436 | if (!i) { | 446 | if (!i) { |
437 | unsigned cluster = ACCESS_ONCE(dm_verity_prefetch_cluster); | 447 | unsigned cluster = ACCESS_ONCE(dm_verity_prefetch_cluster); |
438 | 448 | ||
@@ -452,6 +462,25 @@ no_prefetch_cluster: | |||
452 | dm_bufio_prefetch(v->bufio, hash_block_start, | 462 | dm_bufio_prefetch(v->bufio, hash_block_start, |
453 | hash_block_end - hash_block_start + 1); | 463 | hash_block_end - hash_block_start + 1); |
454 | } | 464 | } |
465 | |||
466 | kfree(pw); | ||
467 | } | ||
468 | |||
469 | static void verity_submit_prefetch(struct dm_verity *v, struct dm_verity_io *io) | ||
470 | { | ||
471 | struct dm_verity_prefetch_work *pw; | ||
472 | |||
473 | pw = kmalloc(sizeof(struct dm_verity_prefetch_work), | ||
474 | GFP_NOIO | __GFP_NORETRY | __GFP_NOMEMALLOC | __GFP_NOWARN); | ||
475 | |||
476 | if (!pw) | ||
477 | return; | ||
478 | |||
479 | INIT_WORK(&pw->work, verity_prefetch_io); | ||
480 | pw->v = v; | ||
481 | pw->block = io->block; | ||
482 | pw->n_blocks = io->n_blocks; | ||
483 | queue_work(v->verify_wq, &pw->work); | ||
455 | } | 484 | } |
456 | 485 | ||
457 | /* | 486 | /* |
@@ -498,7 +527,7 @@ static int verity_map(struct dm_target *ti, struct bio *bio) | |||
498 | memcpy(io->io_vec, bio_iovec(bio), | 527 | memcpy(io->io_vec, bio_iovec(bio), |
499 | io->io_vec_size * sizeof(struct bio_vec)); | 528 | io->io_vec_size * sizeof(struct bio_vec)); |
500 | 529 | ||
501 | verity_prefetch_io(v, io); | 530 | verity_submit_prefetch(v, io); |
502 | 531 | ||
503 | generic_make_request(bio); | 532 | generic_make_request(bio); |
504 | 533 | ||
@@ -858,7 +887,7 @@ bad: | |||
858 | 887 | ||
859 | static struct target_type verity_target = { | 888 | static struct target_type verity_target = { |
860 | .name = "verity", | 889 | .name = "verity", |
861 | .version = {1, 1, 1}, | 890 | .version = {1, 2, 0}, |
862 | .module = THIS_MODULE, | 891 | .module = THIS_MODULE, |
863 | .ctr = verity_ctr, | 892 | .ctr = verity_ctr, |
864 | .dtr = verity_dtr, | 893 | .dtr = verity_dtr, |
diff --git a/drivers/md/md.c b/drivers/md/md.c index fcb878f88796..aeceedfc530b 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c | |||
@@ -7663,10 +7663,8 @@ static int remove_and_add_spares(struct mddev *mddev) | |||
7663 | removed++; | 7663 | removed++; |
7664 | } | 7664 | } |
7665 | } | 7665 | } |
7666 | if (removed) | 7666 | if (removed && mddev->kobj.sd) |
7667 | sysfs_notify(&mddev->kobj, NULL, | 7667 | sysfs_notify(&mddev->kobj, NULL, "degraded"); |
7668 | "degraded"); | ||
7669 | |||
7670 | 7668 | ||
7671 | rdev_for_each(rdev, mddev) { | 7669 | rdev_for_each(rdev, mddev) { |
7672 | if (rdev->raid_disk >= 0 && | 7670 | if (rdev->raid_disk >= 0 && |
diff --git a/drivers/md/md.h b/drivers/md/md.h index eca59c3074ef..d90fb1a879e1 100644 --- a/drivers/md/md.h +++ b/drivers/md/md.h | |||
@@ -506,7 +506,7 @@ static inline char * mdname (struct mddev * mddev) | |||
506 | static inline int sysfs_link_rdev(struct mddev *mddev, struct md_rdev *rdev) | 506 | static inline int sysfs_link_rdev(struct mddev *mddev, struct md_rdev *rdev) |
507 | { | 507 | { |
508 | char nm[20]; | 508 | char nm[20]; |
509 | if (!test_bit(Replacement, &rdev->flags)) { | 509 | if (!test_bit(Replacement, &rdev->flags) && mddev->kobj.sd) { |
510 | sprintf(nm, "rd%d", rdev->raid_disk); | 510 | sprintf(nm, "rd%d", rdev->raid_disk); |
511 | return sysfs_create_link(&mddev->kobj, &rdev->kobj, nm); | 511 | return sysfs_create_link(&mddev->kobj, &rdev->kobj, nm); |
512 | } else | 512 | } else |
@@ -516,7 +516,7 @@ static inline int sysfs_link_rdev(struct mddev *mddev, struct md_rdev *rdev) | |||
516 | static inline void sysfs_unlink_rdev(struct mddev *mddev, struct md_rdev *rdev) | 516 | static inline void sysfs_unlink_rdev(struct mddev *mddev, struct md_rdev *rdev) |
517 | { | 517 | { |
518 | char nm[20]; | 518 | char nm[20]; |
519 | if (!test_bit(Replacement, &rdev->flags)) { | 519 | if (!test_bit(Replacement, &rdev->flags) && mddev->kobj.sd) { |
520 | sprintf(nm, "rd%d", rdev->raid_disk); | 520 | sprintf(nm, "rd%d", rdev->raid_disk); |
521 | sysfs_remove_link(&mddev->kobj, nm); | 521 | sysfs_remove_link(&mddev->kobj, nm); |
522 | } | 522 | } |
diff --git a/drivers/md/persistent-data/dm-btree-remove.c b/drivers/md/persistent-data/dm-btree-remove.c index c4f28133ef82..b88757cd0d1d 100644 --- a/drivers/md/persistent-data/dm-btree-remove.c +++ b/drivers/md/persistent-data/dm-btree-remove.c | |||
@@ -139,15 +139,8 @@ struct child { | |||
139 | struct btree_node *n; | 139 | struct btree_node *n; |
140 | }; | 140 | }; |
141 | 141 | ||
142 | static struct dm_btree_value_type le64_type = { | 142 | static int init_child(struct dm_btree_info *info, struct dm_btree_value_type *vt, |
143 | .context = NULL, | 143 | struct btree_node *parent, |
144 | .size = sizeof(__le64), | ||
145 | .inc = NULL, | ||
146 | .dec = NULL, | ||
147 | .equal = NULL | ||
148 | }; | ||
149 | |||
150 | static int init_child(struct dm_btree_info *info, struct btree_node *parent, | ||
151 | unsigned index, struct child *result) | 144 | unsigned index, struct child *result) |
152 | { | 145 | { |
153 | int r, inc; | 146 | int r, inc; |
@@ -164,7 +157,7 @@ static int init_child(struct dm_btree_info *info, struct btree_node *parent, | |||
164 | result->n = dm_block_data(result->block); | 157 | result->n = dm_block_data(result->block); |
165 | 158 | ||
166 | if (inc) | 159 | if (inc) |
167 | inc_children(info->tm, result->n, &le64_type); | 160 | inc_children(info->tm, result->n, vt); |
168 | 161 | ||
169 | *((__le64 *) value_ptr(parent, index)) = | 162 | *((__le64 *) value_ptr(parent, index)) = |
170 | cpu_to_le64(dm_block_location(result->block)); | 163 | cpu_to_le64(dm_block_location(result->block)); |
@@ -236,7 +229,7 @@ static void __rebalance2(struct dm_btree_info *info, struct btree_node *parent, | |||
236 | } | 229 | } |
237 | 230 | ||
238 | static int rebalance2(struct shadow_spine *s, struct dm_btree_info *info, | 231 | static int rebalance2(struct shadow_spine *s, struct dm_btree_info *info, |
239 | unsigned left_index) | 232 | struct dm_btree_value_type *vt, unsigned left_index) |
240 | { | 233 | { |
241 | int r; | 234 | int r; |
242 | struct btree_node *parent; | 235 | struct btree_node *parent; |
@@ -244,11 +237,11 @@ static int rebalance2(struct shadow_spine *s, struct dm_btree_info *info, | |||
244 | 237 | ||
245 | parent = dm_block_data(shadow_current(s)); | 238 | parent = dm_block_data(shadow_current(s)); |
246 | 239 | ||
247 | r = init_child(info, parent, left_index, &left); | 240 | r = init_child(info, vt, parent, left_index, &left); |
248 | if (r) | 241 | if (r) |
249 | return r; | 242 | return r; |
250 | 243 | ||
251 | r = init_child(info, parent, left_index + 1, &right); | 244 | r = init_child(info, vt, parent, left_index + 1, &right); |
252 | if (r) { | 245 | if (r) { |
253 | exit_child(info, &left); | 246 | exit_child(info, &left); |
254 | return r; | 247 | return r; |
@@ -368,7 +361,7 @@ static void __rebalance3(struct dm_btree_info *info, struct btree_node *parent, | |||
368 | } | 361 | } |
369 | 362 | ||
370 | static int rebalance3(struct shadow_spine *s, struct dm_btree_info *info, | 363 | static int rebalance3(struct shadow_spine *s, struct dm_btree_info *info, |
371 | unsigned left_index) | 364 | struct dm_btree_value_type *vt, unsigned left_index) |
372 | { | 365 | { |
373 | int r; | 366 | int r; |
374 | struct btree_node *parent = dm_block_data(shadow_current(s)); | 367 | struct btree_node *parent = dm_block_data(shadow_current(s)); |
@@ -377,17 +370,17 @@ static int rebalance3(struct shadow_spine *s, struct dm_btree_info *info, | |||
377 | /* | 370 | /* |
378 | * FIXME: fill out an array? | 371 | * FIXME: fill out an array? |
379 | */ | 372 | */ |
380 | r = init_child(info, parent, left_index, &left); | 373 | r = init_child(info, vt, parent, left_index, &left); |
381 | if (r) | 374 | if (r) |
382 | return r; | 375 | return r; |
383 | 376 | ||
384 | r = init_child(info, parent, left_index + 1, ¢er); | 377 | r = init_child(info, vt, parent, left_index + 1, ¢er); |
385 | if (r) { | 378 | if (r) { |
386 | exit_child(info, &left); | 379 | exit_child(info, &left); |
387 | return r; | 380 | return r; |
388 | } | 381 | } |
389 | 382 | ||
390 | r = init_child(info, parent, left_index + 2, &right); | 383 | r = init_child(info, vt, parent, left_index + 2, &right); |
391 | if (r) { | 384 | if (r) { |
392 | exit_child(info, &left); | 385 | exit_child(info, &left); |
393 | exit_child(info, ¢er); | 386 | exit_child(info, ¢er); |
@@ -434,7 +427,8 @@ static int get_nr_entries(struct dm_transaction_manager *tm, | |||
434 | } | 427 | } |
435 | 428 | ||
436 | static int rebalance_children(struct shadow_spine *s, | 429 | static int rebalance_children(struct shadow_spine *s, |
437 | struct dm_btree_info *info, uint64_t key) | 430 | struct dm_btree_info *info, |
431 | struct dm_btree_value_type *vt, uint64_t key) | ||
438 | { | 432 | { |
439 | int i, r, has_left_sibling, has_right_sibling; | 433 | int i, r, has_left_sibling, has_right_sibling; |
440 | uint32_t child_entries; | 434 | uint32_t child_entries; |
@@ -472,13 +466,13 @@ static int rebalance_children(struct shadow_spine *s, | |||
472 | has_right_sibling = i < (le32_to_cpu(n->header.nr_entries) - 1); | 466 | has_right_sibling = i < (le32_to_cpu(n->header.nr_entries) - 1); |
473 | 467 | ||
474 | if (!has_left_sibling) | 468 | if (!has_left_sibling) |
475 | r = rebalance2(s, info, i); | 469 | r = rebalance2(s, info, vt, i); |
476 | 470 | ||
477 | else if (!has_right_sibling) | 471 | else if (!has_right_sibling) |
478 | r = rebalance2(s, info, i - 1); | 472 | r = rebalance2(s, info, vt, i - 1); |
479 | 473 | ||
480 | else | 474 | else |
481 | r = rebalance3(s, info, i - 1); | 475 | r = rebalance3(s, info, vt, i - 1); |
482 | 476 | ||
483 | return r; | 477 | return r; |
484 | } | 478 | } |
@@ -529,7 +523,7 @@ static int remove_raw(struct shadow_spine *s, struct dm_btree_info *info, | |||
529 | if (le32_to_cpu(n->header.flags) & LEAF_NODE) | 523 | if (le32_to_cpu(n->header.flags) & LEAF_NODE) |
530 | return do_leaf(n, key, index); | 524 | return do_leaf(n, key, index); |
531 | 525 | ||
532 | r = rebalance_children(s, info, key); | 526 | r = rebalance_children(s, info, vt, key); |
533 | if (r) | 527 | if (r) |
534 | break; | 528 | break; |
535 | 529 | ||
@@ -550,6 +544,14 @@ static int remove_raw(struct shadow_spine *s, struct dm_btree_info *info, | |||
550 | return r; | 544 | return r; |
551 | } | 545 | } |
552 | 546 | ||
547 | static struct dm_btree_value_type le64_type = { | ||
548 | .context = NULL, | ||
549 | .size = sizeof(__le64), | ||
550 | .inc = NULL, | ||
551 | .dec = NULL, | ||
552 | .equal = NULL | ||
553 | }; | ||
554 | |||
553 | int dm_btree_remove(struct dm_btree_info *info, dm_block_t root, | 555 | int dm_btree_remove(struct dm_btree_info *info, dm_block_t root, |
554 | uint64_t *keys, dm_block_t *new_root) | 556 | uint64_t *keys, dm_block_t *new_root) |
555 | { | 557 | { |
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c index 3ee2912889e7..24909eb13fec 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c | |||
@@ -671,9 +671,11 @@ static void ops_run_io(struct stripe_head *sh, struct stripe_head_state *s) | |||
671 | bi->bi_next = NULL; | 671 | bi->bi_next = NULL; |
672 | if (rrdev) | 672 | if (rrdev) |
673 | set_bit(R5_DOUBLE_LOCKED, &sh->dev[i].flags); | 673 | set_bit(R5_DOUBLE_LOCKED, &sh->dev[i].flags); |
674 | trace_block_bio_remap(bdev_get_queue(bi->bi_bdev), | 674 | |
675 | bi, disk_devt(conf->mddev->gendisk), | 675 | if (conf->mddev->gendisk) |
676 | sh->dev[i].sector); | 676 | trace_block_bio_remap(bdev_get_queue(bi->bi_bdev), |
677 | bi, disk_devt(conf->mddev->gendisk), | ||
678 | sh->dev[i].sector); | ||
677 | generic_make_request(bi); | 679 | generic_make_request(bi); |
678 | } | 680 | } |
679 | if (rrdev) { | 681 | if (rrdev) { |
@@ -701,9 +703,10 @@ static void ops_run_io(struct stripe_head *sh, struct stripe_head_state *s) | |||
701 | rbi->bi_io_vec[0].bv_offset = 0; | 703 | rbi->bi_io_vec[0].bv_offset = 0; |
702 | rbi->bi_size = STRIPE_SIZE; | 704 | rbi->bi_size = STRIPE_SIZE; |
703 | rbi->bi_next = NULL; | 705 | rbi->bi_next = NULL; |
704 | trace_block_bio_remap(bdev_get_queue(rbi->bi_bdev), | 706 | if (conf->mddev->gendisk) |
705 | rbi, disk_devt(conf->mddev->gendisk), | 707 | trace_block_bio_remap(bdev_get_queue(rbi->bi_bdev), |
706 | sh->dev[i].sector); | 708 | rbi, disk_devt(conf->mddev->gendisk), |
709 | sh->dev[i].sector); | ||
707 | generic_make_request(rbi); | 710 | generic_make_request(rbi); |
708 | } | 711 | } |
709 | if (!rdev && !rrdev) { | 712 | if (!rdev && !rrdev) { |
@@ -2280,17 +2283,6 @@ schedule_reconstruction(struct stripe_head *sh, struct stripe_head_state *s, | |||
2280 | int level = conf->level; | 2283 | int level = conf->level; |
2281 | 2284 | ||
2282 | if (rcw) { | 2285 | if (rcw) { |
2283 | /* if we are not expanding this is a proper write request, and | ||
2284 | * there will be bios with new data to be drained into the | ||
2285 | * stripe cache | ||
2286 | */ | ||
2287 | if (!expand) { | ||
2288 | sh->reconstruct_state = reconstruct_state_drain_run; | ||
2289 | set_bit(STRIPE_OP_BIODRAIN, &s->ops_request); | ||
2290 | } else | ||
2291 | sh->reconstruct_state = reconstruct_state_run; | ||
2292 | |||
2293 | set_bit(STRIPE_OP_RECONSTRUCT, &s->ops_request); | ||
2294 | 2286 | ||
2295 | for (i = disks; i--; ) { | 2287 | for (i = disks; i--; ) { |
2296 | struct r5dev *dev = &sh->dev[i]; | 2288 | struct r5dev *dev = &sh->dev[i]; |
@@ -2303,6 +2295,21 @@ schedule_reconstruction(struct stripe_head *sh, struct stripe_head_state *s, | |||
2303 | s->locked++; | 2295 | s->locked++; |
2304 | } | 2296 | } |
2305 | } | 2297 | } |
2298 | /* if we are not expanding this is a proper write request, and | ||
2299 | * there will be bios with new data to be drained into the | ||
2300 | * stripe cache | ||
2301 | */ | ||
2302 | if (!expand) { | ||
2303 | if (!s->locked) | ||
2304 | /* False alarm, nothing to do */ | ||
2305 | return; | ||
2306 | sh->reconstruct_state = reconstruct_state_drain_run; | ||
2307 | set_bit(STRIPE_OP_BIODRAIN, &s->ops_request); | ||
2308 | } else | ||
2309 | sh->reconstruct_state = reconstruct_state_run; | ||
2310 | |||
2311 | set_bit(STRIPE_OP_RECONSTRUCT, &s->ops_request); | ||
2312 | |||
2306 | if (s->locked + conf->max_degraded == disks) | 2313 | if (s->locked + conf->max_degraded == disks) |
2307 | if (!test_and_set_bit(STRIPE_FULL_WRITE, &sh->state)) | 2314 | if (!test_and_set_bit(STRIPE_FULL_WRITE, &sh->state)) |
2308 | atomic_inc(&conf->pending_full_writes); | 2315 | atomic_inc(&conf->pending_full_writes); |
@@ -2311,11 +2318,6 @@ schedule_reconstruction(struct stripe_head *sh, struct stripe_head_state *s, | |||
2311 | BUG_ON(!(test_bit(R5_UPTODATE, &sh->dev[pd_idx].flags) || | 2318 | BUG_ON(!(test_bit(R5_UPTODATE, &sh->dev[pd_idx].flags) || |
2312 | test_bit(R5_Wantcompute, &sh->dev[pd_idx].flags))); | 2319 | test_bit(R5_Wantcompute, &sh->dev[pd_idx].flags))); |
2313 | 2320 | ||
2314 | sh->reconstruct_state = reconstruct_state_prexor_drain_run; | ||
2315 | set_bit(STRIPE_OP_PREXOR, &s->ops_request); | ||
2316 | set_bit(STRIPE_OP_BIODRAIN, &s->ops_request); | ||
2317 | set_bit(STRIPE_OP_RECONSTRUCT, &s->ops_request); | ||
2318 | |||
2319 | for (i = disks; i--; ) { | 2321 | for (i = disks; i--; ) { |
2320 | struct r5dev *dev = &sh->dev[i]; | 2322 | struct r5dev *dev = &sh->dev[i]; |
2321 | if (i == pd_idx) | 2323 | if (i == pd_idx) |
@@ -2330,6 +2332,13 @@ schedule_reconstruction(struct stripe_head *sh, struct stripe_head_state *s, | |||
2330 | s->locked++; | 2332 | s->locked++; |
2331 | } | 2333 | } |
2332 | } | 2334 | } |
2335 | if (!s->locked) | ||
2336 | /* False alarm - nothing to do */ | ||
2337 | return; | ||
2338 | sh->reconstruct_state = reconstruct_state_prexor_drain_run; | ||
2339 | set_bit(STRIPE_OP_PREXOR, &s->ops_request); | ||
2340 | set_bit(STRIPE_OP_BIODRAIN, &s->ops_request); | ||
2341 | set_bit(STRIPE_OP_RECONSTRUCT, &s->ops_request); | ||
2333 | } | 2342 | } |
2334 | 2343 | ||
2335 | /* keep the parity disk(s) locked while asynchronous operations | 2344 | /* keep the parity disk(s) locked while asynchronous operations |
@@ -2564,6 +2573,8 @@ handle_failed_sync(struct r5conf *conf, struct stripe_head *sh, | |||
2564 | int i; | 2573 | int i; |
2565 | 2574 | ||
2566 | clear_bit(STRIPE_SYNCING, &sh->state); | 2575 | clear_bit(STRIPE_SYNCING, &sh->state); |
2576 | if (test_and_clear_bit(R5_Overlap, &sh->dev[sh->pd_idx].flags)) | ||
2577 | wake_up(&conf->wait_for_overlap); | ||
2567 | s->syncing = 0; | 2578 | s->syncing = 0; |
2568 | s->replacing = 0; | 2579 | s->replacing = 0; |
2569 | /* There is nothing more to do for sync/check/repair. | 2580 | /* There is nothing more to do for sync/check/repair. |
@@ -2737,6 +2748,7 @@ static void handle_stripe_clean_event(struct r5conf *conf, | |||
2737 | { | 2748 | { |
2738 | int i; | 2749 | int i; |
2739 | struct r5dev *dev; | 2750 | struct r5dev *dev; |
2751 | int discard_pending = 0; | ||
2740 | 2752 | ||
2741 | for (i = disks; i--; ) | 2753 | for (i = disks; i--; ) |
2742 | if (sh->dev[i].written) { | 2754 | if (sh->dev[i].written) { |
@@ -2765,9 +2777,23 @@ static void handle_stripe_clean_event(struct r5conf *conf, | |||
2765 | STRIPE_SECTORS, | 2777 | STRIPE_SECTORS, |
2766 | !test_bit(STRIPE_DEGRADED, &sh->state), | 2778 | !test_bit(STRIPE_DEGRADED, &sh->state), |
2767 | 0); | 2779 | 0); |
2768 | } | 2780 | } else if (test_bit(R5_Discard, &dev->flags)) |
2769 | } else if (test_bit(R5_Discard, &sh->dev[i].flags)) | 2781 | discard_pending = 1; |
2770 | clear_bit(R5_Discard, &sh->dev[i].flags); | 2782 | } |
2783 | if (!discard_pending && | ||
2784 | test_bit(R5_Discard, &sh->dev[sh->pd_idx].flags)) { | ||
2785 | clear_bit(R5_Discard, &sh->dev[sh->pd_idx].flags); | ||
2786 | clear_bit(R5_UPTODATE, &sh->dev[sh->pd_idx].flags); | ||
2787 | if (sh->qd_idx >= 0) { | ||
2788 | clear_bit(R5_Discard, &sh->dev[sh->qd_idx].flags); | ||
2789 | clear_bit(R5_UPTODATE, &sh->dev[sh->qd_idx].flags); | ||
2790 | } | ||
2791 | /* now that discard is done we can proceed with any sync */ | ||
2792 | clear_bit(STRIPE_DISCARD, &sh->state); | ||
2793 | if (test_bit(STRIPE_SYNC_REQUESTED, &sh->state)) | ||
2794 | set_bit(STRIPE_HANDLE, &sh->state); | ||
2795 | |||
2796 | } | ||
2771 | 2797 | ||
2772 | if (test_and_clear_bit(STRIPE_FULL_WRITE, &sh->state)) | 2798 | if (test_and_clear_bit(STRIPE_FULL_WRITE, &sh->state)) |
2773 | if (atomic_dec_and_test(&conf->pending_full_writes)) | 2799 | if (atomic_dec_and_test(&conf->pending_full_writes)) |
@@ -2826,8 +2852,10 @@ static void handle_stripe_dirtying(struct r5conf *conf, | |||
2826 | set_bit(STRIPE_HANDLE, &sh->state); | 2852 | set_bit(STRIPE_HANDLE, &sh->state); |
2827 | if (rmw < rcw && rmw > 0) { | 2853 | if (rmw < rcw && rmw > 0) { |
2828 | /* prefer read-modify-write, but need to get some data */ | 2854 | /* prefer read-modify-write, but need to get some data */ |
2829 | blk_add_trace_msg(conf->mddev->queue, "raid5 rmw %llu %d", | 2855 | if (conf->mddev->queue) |
2830 | (unsigned long long)sh->sector, rmw); | 2856 | blk_add_trace_msg(conf->mddev->queue, |
2857 | "raid5 rmw %llu %d", | ||
2858 | (unsigned long long)sh->sector, rmw); | ||
2831 | for (i = disks; i--; ) { | 2859 | for (i = disks; i--; ) { |
2832 | struct r5dev *dev = &sh->dev[i]; | 2860 | struct r5dev *dev = &sh->dev[i]; |
2833 | if ((dev->towrite || i == sh->pd_idx) && | 2861 | if ((dev->towrite || i == sh->pd_idx) && |
@@ -2877,7 +2905,7 @@ static void handle_stripe_dirtying(struct r5conf *conf, | |||
2877 | } | 2905 | } |
2878 | } | 2906 | } |
2879 | } | 2907 | } |
2880 | if (rcw) | 2908 | if (rcw && conf->mddev->queue) |
2881 | blk_add_trace_msg(conf->mddev->queue, "raid5 rcw %llu %d %d %d", | 2909 | blk_add_trace_msg(conf->mddev->queue, "raid5 rcw %llu %d %d %d", |
2882 | (unsigned long long)sh->sector, | 2910 | (unsigned long long)sh->sector, |
2883 | rcw, qread, test_bit(STRIPE_DELAYED, &sh->state)); | 2911 | rcw, qread, test_bit(STRIPE_DELAYED, &sh->state)); |
@@ -3417,9 +3445,15 @@ static void handle_stripe(struct stripe_head *sh) | |||
3417 | return; | 3445 | return; |
3418 | } | 3446 | } |
3419 | 3447 | ||
3420 | if (test_and_clear_bit(STRIPE_SYNC_REQUESTED, &sh->state)) { | 3448 | if (test_bit(STRIPE_SYNC_REQUESTED, &sh->state)) { |
3421 | set_bit(STRIPE_SYNCING, &sh->state); | 3449 | spin_lock(&sh->stripe_lock); |
3422 | clear_bit(STRIPE_INSYNC, &sh->state); | 3450 | /* Cannot process 'sync' concurrently with 'discard' */ |
3451 | if (!test_bit(STRIPE_DISCARD, &sh->state) && | ||
3452 | test_and_clear_bit(STRIPE_SYNC_REQUESTED, &sh->state)) { | ||
3453 | set_bit(STRIPE_SYNCING, &sh->state); | ||
3454 | clear_bit(STRIPE_INSYNC, &sh->state); | ||
3455 | } | ||
3456 | spin_unlock(&sh->stripe_lock); | ||
3423 | } | 3457 | } |
3424 | clear_bit(STRIPE_DELAYED, &sh->state); | 3458 | clear_bit(STRIPE_DELAYED, &sh->state); |
3425 | 3459 | ||
@@ -3579,6 +3613,8 @@ static void handle_stripe(struct stripe_head *sh) | |||
3579 | test_bit(STRIPE_INSYNC, &sh->state)) { | 3613 | test_bit(STRIPE_INSYNC, &sh->state)) { |
3580 | md_done_sync(conf->mddev, STRIPE_SECTORS, 1); | 3614 | md_done_sync(conf->mddev, STRIPE_SECTORS, 1); |
3581 | clear_bit(STRIPE_SYNCING, &sh->state); | 3615 | clear_bit(STRIPE_SYNCING, &sh->state); |
3616 | if (test_and_clear_bit(R5_Overlap, &sh->dev[sh->pd_idx].flags)) | ||
3617 | wake_up(&conf->wait_for_overlap); | ||
3582 | } | 3618 | } |
3583 | 3619 | ||
3584 | /* If the failed drives are just a ReadError, then we might need | 3620 | /* If the failed drives are just a ReadError, then we might need |
@@ -3982,9 +4018,10 @@ static int chunk_aligned_read(struct mddev *mddev, struct bio * raid_bio) | |||
3982 | atomic_inc(&conf->active_aligned_reads); | 4018 | atomic_inc(&conf->active_aligned_reads); |
3983 | spin_unlock_irq(&conf->device_lock); | 4019 | spin_unlock_irq(&conf->device_lock); |
3984 | 4020 | ||
3985 | trace_block_bio_remap(bdev_get_queue(align_bi->bi_bdev), | 4021 | if (mddev->gendisk) |
3986 | align_bi, disk_devt(mddev->gendisk), | 4022 | trace_block_bio_remap(bdev_get_queue(align_bi->bi_bdev), |
3987 | raid_bio->bi_sector); | 4023 | align_bi, disk_devt(mddev->gendisk), |
4024 | raid_bio->bi_sector); | ||
3988 | generic_make_request(align_bi); | 4025 | generic_make_request(align_bi); |
3989 | return 1; | 4026 | return 1; |
3990 | } else { | 4027 | } else { |
@@ -4078,7 +4115,8 @@ static void raid5_unplug(struct blk_plug_cb *blk_cb, bool from_schedule) | |||
4078 | } | 4115 | } |
4079 | spin_unlock_irq(&conf->device_lock); | 4116 | spin_unlock_irq(&conf->device_lock); |
4080 | } | 4117 | } |
4081 | trace_block_unplug(mddev->queue, cnt, !from_schedule); | 4118 | if (mddev->queue) |
4119 | trace_block_unplug(mddev->queue, cnt, !from_schedule); | ||
4082 | kfree(cb); | 4120 | kfree(cb); |
4083 | } | 4121 | } |
4084 | 4122 | ||
@@ -4141,6 +4179,13 @@ static void make_discard_request(struct mddev *mddev, struct bio *bi) | |||
4141 | sh = get_active_stripe(conf, logical_sector, 0, 0, 0); | 4179 | sh = get_active_stripe(conf, logical_sector, 0, 0, 0); |
4142 | prepare_to_wait(&conf->wait_for_overlap, &w, | 4180 | prepare_to_wait(&conf->wait_for_overlap, &w, |
4143 | TASK_UNINTERRUPTIBLE); | 4181 | TASK_UNINTERRUPTIBLE); |
4182 | set_bit(R5_Overlap, &sh->dev[sh->pd_idx].flags); | ||
4183 | if (test_bit(STRIPE_SYNCING, &sh->state)) { | ||
4184 | release_stripe(sh); | ||
4185 | schedule(); | ||
4186 | goto again; | ||
4187 | } | ||
4188 | clear_bit(R5_Overlap, &sh->dev[sh->pd_idx].flags); | ||
4144 | spin_lock_irq(&sh->stripe_lock); | 4189 | spin_lock_irq(&sh->stripe_lock); |
4145 | for (d = 0; d < conf->raid_disks; d++) { | 4190 | for (d = 0; d < conf->raid_disks; d++) { |
4146 | if (d == sh->pd_idx || d == sh->qd_idx) | 4191 | if (d == sh->pd_idx || d == sh->qd_idx) |
@@ -4153,6 +4198,7 @@ static void make_discard_request(struct mddev *mddev, struct bio *bi) | |||
4153 | goto again; | 4198 | goto again; |
4154 | } | 4199 | } |
4155 | } | 4200 | } |
4201 | set_bit(STRIPE_DISCARD, &sh->state); | ||
4156 | finish_wait(&conf->wait_for_overlap, &w); | 4202 | finish_wait(&conf->wait_for_overlap, &w); |
4157 | for (d = 0; d < conf->raid_disks; d++) { | 4203 | for (d = 0; d < conf->raid_disks; d++) { |
4158 | if (d == sh->pd_idx || d == sh->qd_idx) | 4204 | if (d == sh->pd_idx || d == sh->qd_idx) |
diff --git a/drivers/md/raid5.h b/drivers/md/raid5.h index 18b2c4a8a1fd..b0b663b119a8 100644 --- a/drivers/md/raid5.h +++ b/drivers/md/raid5.h | |||
@@ -221,10 +221,6 @@ struct stripe_head { | |||
221 | struct stripe_operations { | 221 | struct stripe_operations { |
222 | int target, target2; | 222 | int target, target2; |
223 | enum sum_check_flags zero_sum_result; | 223 | enum sum_check_flags zero_sum_result; |
224 | #ifdef CONFIG_MULTICORE_RAID456 | ||
225 | unsigned long request; | ||
226 | wait_queue_head_t wait_for_ops; | ||
227 | #endif | ||
228 | } ops; | 224 | } ops; |
229 | struct r5dev { | 225 | struct r5dev { |
230 | /* rreq and rvec are used for the replacement device when | 226 | /* rreq and rvec are used for the replacement device when |
@@ -323,6 +319,7 @@ enum { | |||
323 | STRIPE_COMPUTE_RUN, | 319 | STRIPE_COMPUTE_RUN, |
324 | STRIPE_OPS_REQ_PENDING, | 320 | STRIPE_OPS_REQ_PENDING, |
325 | STRIPE_ON_UNPLUG_LIST, | 321 | STRIPE_ON_UNPLUG_LIST, |
322 | STRIPE_DISCARD, | ||
326 | }; | 323 | }; |
327 | 324 | ||
328 | /* | 325 | /* |
diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig index 671f5b171c73..c346941a2515 100644 --- a/drivers/mfd/Kconfig +++ b/drivers/mfd/Kconfig | |||
@@ -858,6 +858,7 @@ config EZX_PCAP | |||
858 | config AB8500_CORE | 858 | config AB8500_CORE |
859 | bool "ST-Ericsson AB8500 Mixed Signal Power Management chip" | 859 | bool "ST-Ericsson AB8500 Mixed Signal Power Management chip" |
860 | depends on GENERIC_HARDIRQS && ABX500_CORE && MFD_DB8500_PRCMU | 860 | depends on GENERIC_HARDIRQS && ABX500_CORE && MFD_DB8500_PRCMU |
861 | select POWER_SUPPLY | ||
861 | select MFD_CORE | 862 | select MFD_CORE |
862 | select IRQ_DOMAIN | 863 | select IRQ_DOMAIN |
863 | help | 864 | help |
diff --git a/drivers/mfd/ab8500-gpadc.c b/drivers/mfd/ab8500-gpadc.c index b1f3561b023f..5f341a50ee5a 100644 --- a/drivers/mfd/ab8500-gpadc.c +++ b/drivers/mfd/ab8500-gpadc.c | |||
@@ -594,9 +594,12 @@ static int ab8500_gpadc_runtime_suspend(struct device *dev) | |||
594 | static int ab8500_gpadc_runtime_resume(struct device *dev) | 594 | static int ab8500_gpadc_runtime_resume(struct device *dev) |
595 | { | 595 | { |
596 | struct ab8500_gpadc *gpadc = dev_get_drvdata(dev); | 596 | struct ab8500_gpadc *gpadc = dev_get_drvdata(dev); |
597 | int ret; | ||
597 | 598 | ||
598 | regulator_enable(gpadc->regu); | 599 | ret = regulator_enable(gpadc->regu); |
599 | return 0; | 600 | if (ret) |
601 | dev_err(dev, "Failed to enable vtvout LDO: %d\n", ret); | ||
602 | return ret; | ||
600 | } | 603 | } |
601 | 604 | ||
602 | static int ab8500_gpadc_runtime_idle(struct device *dev) | 605 | static int ab8500_gpadc_runtime_idle(struct device *dev) |
@@ -643,7 +646,7 @@ static int ab8500_gpadc_probe(struct platform_device *pdev) | |||
643 | } | 646 | } |
644 | 647 | ||
645 | /* VTVout LDO used to power up ab8500-GPADC */ | 648 | /* VTVout LDO used to power up ab8500-GPADC */ |
646 | gpadc->regu = regulator_get(&pdev->dev, "vddadc"); | 649 | gpadc->regu = devm_regulator_get(&pdev->dev, "vddadc"); |
647 | if (IS_ERR(gpadc->regu)) { | 650 | if (IS_ERR(gpadc->regu)) { |
648 | ret = PTR_ERR(gpadc->regu); | 651 | ret = PTR_ERR(gpadc->regu); |
649 | dev_err(gpadc->dev, "failed to get vtvout LDO\n"); | 652 | dev_err(gpadc->dev, "failed to get vtvout LDO\n"); |
@@ -652,7 +655,11 @@ static int ab8500_gpadc_probe(struct platform_device *pdev) | |||
652 | 655 | ||
653 | platform_set_drvdata(pdev, gpadc); | 656 | platform_set_drvdata(pdev, gpadc); |
654 | 657 | ||
655 | regulator_enable(gpadc->regu); | 658 | ret = regulator_enable(gpadc->regu); |
659 | if (ret) { | ||
660 | dev_err(gpadc->dev, "Failed to enable vtvout LDO: %d\n", ret); | ||
661 | goto fail_enable; | ||
662 | } | ||
656 | 663 | ||
657 | pm_runtime_set_autosuspend_delay(gpadc->dev, GPADC_AUDOSUSPEND_DELAY); | 664 | pm_runtime_set_autosuspend_delay(gpadc->dev, GPADC_AUDOSUSPEND_DELAY); |
658 | pm_runtime_use_autosuspend(gpadc->dev); | 665 | pm_runtime_use_autosuspend(gpadc->dev); |
@@ -663,6 +670,8 @@ static int ab8500_gpadc_probe(struct platform_device *pdev) | |||
663 | list_add_tail(&gpadc->node, &ab8500_gpadc_list); | 670 | list_add_tail(&gpadc->node, &ab8500_gpadc_list); |
664 | dev_dbg(gpadc->dev, "probe success\n"); | 671 | dev_dbg(gpadc->dev, "probe success\n"); |
665 | return 0; | 672 | return 0; |
673 | |||
674 | fail_enable: | ||
666 | fail_irq: | 675 | fail_irq: |
667 | free_irq(gpadc->irq, gpadc); | 676 | free_irq(gpadc->irq, gpadc); |
668 | fail: | 677 | fail: |
diff --git a/drivers/mfd/omap-usb-host.c b/drivers/mfd/omap-usb-host.c index 6b5edf64de2b..4febc5c7fdee 100644 --- a/drivers/mfd/omap-usb-host.c +++ b/drivers/mfd/omap-usb-host.c | |||
@@ -460,15 +460,15 @@ static void omap_usbhs_init(struct device *dev) | |||
460 | 460 | ||
461 | switch (omap->usbhs_rev) { | 461 | switch (omap->usbhs_rev) { |
462 | case OMAP_USBHS_REV1: | 462 | case OMAP_USBHS_REV1: |
463 | omap_usbhs_rev1_hostconfig(omap, reg); | 463 | reg = omap_usbhs_rev1_hostconfig(omap, reg); |
464 | break; | 464 | break; |
465 | 465 | ||
466 | case OMAP_USBHS_REV2: | 466 | case OMAP_USBHS_REV2: |
467 | omap_usbhs_rev2_hostconfig(omap, reg); | 467 | reg = omap_usbhs_rev2_hostconfig(omap, reg); |
468 | break; | 468 | break; |
469 | 469 | ||
470 | default: /* newer revisions */ | 470 | default: /* newer revisions */ |
471 | omap_usbhs_rev2_hostconfig(omap, reg); | 471 | reg = omap_usbhs_rev2_hostconfig(omap, reg); |
472 | break; | 472 | break; |
473 | } | 473 | } |
474 | 474 | ||
diff --git a/drivers/mfd/palmas.c b/drivers/mfd/palmas.c index bbdbc50a3cca..73bf76df1044 100644 --- a/drivers/mfd/palmas.c +++ b/drivers/mfd/palmas.c | |||
@@ -257,9 +257,24 @@ static struct regmap_irq_chip palmas_irq_chip = { | |||
257 | PALMAS_INT1_MASK), | 257 | PALMAS_INT1_MASK), |
258 | }; | 258 | }; |
259 | 259 | ||
260 | static void palmas_dt_to_pdata(struct device_node *node, | 260 | static int palmas_set_pdata_irq_flag(struct i2c_client *i2c, |
261 | struct palmas_platform_data *pdata) | 261 | struct palmas_platform_data *pdata) |
262 | { | 262 | { |
263 | struct irq_data *irq_data = irq_get_irq_data(i2c->irq); | ||
264 | if (!irq_data) { | ||
265 | dev_err(&i2c->dev, "Invalid IRQ: %d\n", i2c->irq); | ||
266 | return -EINVAL; | ||
267 | } | ||
268 | |||
269 | pdata->irq_flags = irqd_get_trigger_type(irq_data); | ||
270 | dev_info(&i2c->dev, "Irq flag is 0x%08x\n", pdata->irq_flags); | ||
271 | return 0; | ||
272 | } | ||
273 | |||
274 | static void palmas_dt_to_pdata(struct i2c_client *i2c, | ||
275 | struct palmas_platform_data *pdata) | ||
276 | { | ||
277 | struct device_node *node = i2c->dev.of_node; | ||
263 | int ret; | 278 | int ret; |
264 | u32 prop; | 279 | u32 prop; |
265 | 280 | ||
@@ -283,6 +298,8 @@ static void palmas_dt_to_pdata(struct device_node *node, | |||
283 | pdata->power_ctrl = PALMAS_POWER_CTRL_NSLEEP_MASK | | 298 | pdata->power_ctrl = PALMAS_POWER_CTRL_NSLEEP_MASK | |
284 | PALMAS_POWER_CTRL_ENABLE1_MASK | | 299 | PALMAS_POWER_CTRL_ENABLE1_MASK | |
285 | PALMAS_POWER_CTRL_ENABLE2_MASK; | 300 | PALMAS_POWER_CTRL_ENABLE2_MASK; |
301 | if (i2c->irq) | ||
302 | palmas_set_pdata_irq_flag(i2c, pdata); | ||
286 | } | 303 | } |
287 | 304 | ||
288 | static int palmas_i2c_probe(struct i2c_client *i2c, | 305 | static int palmas_i2c_probe(struct i2c_client *i2c, |
@@ -304,7 +321,7 @@ static int palmas_i2c_probe(struct i2c_client *i2c, | |||
304 | if (!pdata) | 321 | if (!pdata) |
305 | return -ENOMEM; | 322 | return -ENOMEM; |
306 | 323 | ||
307 | palmas_dt_to_pdata(node, pdata); | 324 | palmas_dt_to_pdata(i2c, pdata); |
308 | } | 325 | } |
309 | 326 | ||
310 | if (!pdata) | 327 | if (!pdata) |
@@ -344,6 +361,19 @@ static int palmas_i2c_probe(struct i2c_client *i2c, | |||
344 | } | 361 | } |
345 | } | 362 | } |
346 | 363 | ||
364 | /* Change interrupt line output polarity */ | ||
365 | if (pdata->irq_flags & IRQ_TYPE_LEVEL_HIGH) | ||
366 | reg = PALMAS_POLARITY_CTRL_INT_POLARITY; | ||
367 | else | ||
368 | reg = 0; | ||
369 | ret = palmas_update_bits(palmas, PALMAS_PU_PD_OD_BASE, | ||
370 | PALMAS_POLARITY_CTRL, PALMAS_POLARITY_CTRL_INT_POLARITY, | ||
371 | reg); | ||
372 | if (ret < 0) { | ||
373 | dev_err(palmas->dev, "POLARITY_CTRL updat failed: %d\n", ret); | ||
374 | goto err; | ||
375 | } | ||
376 | |||
347 | /* Change IRQ into clear on read mode for efficiency */ | 377 | /* Change IRQ into clear on read mode for efficiency */ |
348 | slave = PALMAS_BASE_TO_SLAVE(PALMAS_INTERRUPT_BASE); | 378 | slave = PALMAS_BASE_TO_SLAVE(PALMAS_INTERRUPT_BASE); |
349 | addr = PALMAS_BASE_TO_REG(PALMAS_INTERRUPT_BASE, PALMAS_INT_CTRL); | 379 | addr = PALMAS_BASE_TO_REG(PALMAS_INTERRUPT_BASE, PALMAS_INT_CTRL); |
@@ -352,7 +382,7 @@ static int palmas_i2c_probe(struct i2c_client *i2c, | |||
352 | regmap_write(palmas->regmap[slave], addr, reg); | 382 | regmap_write(palmas->regmap[slave], addr, reg); |
353 | 383 | ||
354 | ret = regmap_add_irq_chip(palmas->regmap[slave], palmas->irq, | 384 | ret = regmap_add_irq_chip(palmas->regmap[slave], palmas->irq, |
355 | IRQF_ONESHOT | IRQF_TRIGGER_LOW, 0, &palmas_irq_chip, | 385 | IRQF_ONESHOT | pdata->irq_flags, 0, &palmas_irq_chip, |
356 | &palmas->irq_data); | 386 | &palmas->irq_data); |
357 | if (ret < 0) | 387 | if (ret < 0) |
358 | goto err; | 388 | goto err; |
diff --git a/drivers/mfd/tps65912-core.c b/drivers/mfd/tps65912-core.c index 4658b5bdcd84..aeb8e40ab424 100644 --- a/drivers/mfd/tps65912-core.c +++ b/drivers/mfd/tps65912-core.c | |||
@@ -169,6 +169,7 @@ err: | |||
169 | void tps65912_device_exit(struct tps65912 *tps65912) | 169 | void tps65912_device_exit(struct tps65912 *tps65912) |
170 | { | 170 | { |
171 | mfd_remove_devices(tps65912->dev); | 171 | mfd_remove_devices(tps65912->dev); |
172 | tps65912_irq_exit(tps65912); | ||
172 | kfree(tps65912); | 173 | kfree(tps65912); |
173 | } | 174 | } |
174 | 175 | ||
diff --git a/drivers/mfd/twl4030-audio.c b/drivers/mfd/twl4030-audio.c index e16edca92670..d2ab222138c2 100644 --- a/drivers/mfd/twl4030-audio.c +++ b/drivers/mfd/twl4030-audio.c | |||
@@ -118,7 +118,7 @@ EXPORT_SYMBOL_GPL(twl4030_audio_enable_resource); | |||
118 | * Disable the resource. | 118 | * Disable the resource. |
119 | * The function returns with error or the content of the register | 119 | * The function returns with error or the content of the register |
120 | */ | 120 | */ |
121 | int twl4030_audio_disable_resource(unsigned id) | 121 | int twl4030_audio_disable_resource(enum twl4030_audio_res id) |
122 | { | 122 | { |
123 | struct twl4030_audio *audio = platform_get_drvdata(twl4030_audio_dev); | 123 | struct twl4030_audio *audio = platform_get_drvdata(twl4030_audio_dev); |
124 | int val; | 124 | int val; |
diff --git a/drivers/mfd/twl4030-madc.c b/drivers/mfd/twl4030-madc.c index 88ff9dc83305..942b666a2a07 100644 --- a/drivers/mfd/twl4030-madc.c +++ b/drivers/mfd/twl4030-madc.c | |||
@@ -800,7 +800,7 @@ static int twl4030_madc_remove(struct platform_device *pdev) | |||
800 | 800 | ||
801 | static struct platform_driver twl4030_madc_driver = { | 801 | static struct platform_driver twl4030_madc_driver = { |
802 | .probe = twl4030_madc_probe, | 802 | .probe = twl4030_madc_probe, |
803 | .remove = __exit_p(twl4030_madc_remove), | 803 | .remove = twl4030_madc_remove, |
804 | .driver = { | 804 | .driver = { |
805 | .name = "twl4030_madc", | 805 | .name = "twl4030_madc", |
806 | .owner = THIS_MODULE, | 806 | .owner = THIS_MODULE, |
diff --git a/drivers/mtd/bcm47xxpart.c b/drivers/mtd/bcm47xxpart.c index 63feb75cc8e0..9279a9174f84 100644 --- a/drivers/mtd/bcm47xxpart.c +++ b/drivers/mtd/bcm47xxpart.c | |||
@@ -19,6 +19,12 @@ | |||
19 | /* 10 parts were found on sflash on Netgear WNDR4500 */ | 19 | /* 10 parts were found on sflash on Netgear WNDR4500 */ |
20 | #define BCM47XXPART_MAX_PARTS 12 | 20 | #define BCM47XXPART_MAX_PARTS 12 |
21 | 21 | ||
22 | /* | ||
23 | * Amount of bytes we read when analyzing each block of flash memory. | ||
24 | * Set it big enough to allow detecting partition and reading important data. | ||
25 | */ | ||
26 | #define BCM47XXPART_BYTES_TO_READ 0x404 | ||
27 | |||
22 | /* Magics */ | 28 | /* Magics */ |
23 | #define BOARD_DATA_MAGIC 0x5246504D /* MPFR */ | 29 | #define BOARD_DATA_MAGIC 0x5246504D /* MPFR */ |
24 | #define POT_MAGIC1 0x54544f50 /* POTT */ | 30 | #define POT_MAGIC1 0x54544f50 /* POTT */ |
@@ -57,17 +63,15 @@ static int bcm47xxpart_parse(struct mtd_info *master, | |||
57 | struct trx_header *trx; | 63 | struct trx_header *trx; |
58 | int trx_part = -1; | 64 | int trx_part = -1; |
59 | int last_trx_part = -1; | 65 | int last_trx_part = -1; |
60 | int max_bytes_to_read = 0x8004; | 66 | int possible_nvram_sizes[] = { 0x8000, 0xF000, 0x10000, }; |
61 | 67 | ||
62 | if (blocksize <= 0x10000) | 68 | if (blocksize <= 0x10000) |
63 | blocksize = 0x10000; | 69 | blocksize = 0x10000; |
64 | if (blocksize == 0x20000) | ||
65 | max_bytes_to_read = 0x18004; | ||
66 | 70 | ||
67 | /* Alloc */ | 71 | /* Alloc */ |
68 | parts = kzalloc(sizeof(struct mtd_partition) * BCM47XXPART_MAX_PARTS, | 72 | parts = kzalloc(sizeof(struct mtd_partition) * BCM47XXPART_MAX_PARTS, |
69 | GFP_KERNEL); | 73 | GFP_KERNEL); |
70 | buf = kzalloc(max_bytes_to_read, GFP_KERNEL); | 74 | buf = kzalloc(BCM47XXPART_BYTES_TO_READ, GFP_KERNEL); |
71 | 75 | ||
72 | /* Parse block by block looking for magics */ | 76 | /* Parse block by block looking for magics */ |
73 | for (offset = 0; offset <= master->size - blocksize; | 77 | for (offset = 0; offset <= master->size - blocksize; |
@@ -82,7 +86,7 @@ static int bcm47xxpart_parse(struct mtd_info *master, | |||
82 | } | 86 | } |
83 | 87 | ||
84 | /* Read beginning of the block */ | 88 | /* Read beginning of the block */ |
85 | if (mtd_read(master, offset, max_bytes_to_read, | 89 | if (mtd_read(master, offset, BCM47XXPART_BYTES_TO_READ, |
86 | &bytes_read, (uint8_t *)buf) < 0) { | 90 | &bytes_read, (uint8_t *)buf) < 0) { |
87 | pr_err("mtd_read error while parsing (offset: 0x%X)!\n", | 91 | pr_err("mtd_read error while parsing (offset: 0x%X)!\n", |
88 | offset); | 92 | offset); |
@@ -96,20 +100,6 @@ static int bcm47xxpart_parse(struct mtd_info *master, | |||
96 | continue; | 100 | continue; |
97 | } | 101 | } |
98 | 102 | ||
99 | /* Standard NVRAM */ | ||
100 | if (buf[0x000 / 4] == NVRAM_HEADER || | ||
101 | buf[0x1000 / 4] == NVRAM_HEADER || | ||
102 | buf[0x8000 / 4] == NVRAM_HEADER || | ||
103 | (blocksize == 0x20000 && ( | ||
104 | buf[0x10000 / 4] == NVRAM_HEADER || | ||
105 | buf[0x11000 / 4] == NVRAM_HEADER || | ||
106 | buf[0x18000 / 4] == NVRAM_HEADER))) { | ||
107 | bcm47xxpart_add_part(&parts[curr_part++], "nvram", | ||
108 | offset, 0); | ||
109 | offset = rounddown(offset, blocksize); | ||
110 | continue; | ||
111 | } | ||
112 | |||
113 | /* | 103 | /* |
114 | * board_data starts with board_id which differs across boards, | 104 | * board_data starts with board_id which differs across boards, |
115 | * but we can use 'MPFR' (hopefully) magic at 0x100 | 105 | * but we can use 'MPFR' (hopefully) magic at 0x100 |
@@ -178,6 +168,30 @@ static int bcm47xxpart_parse(struct mtd_info *master, | |||
178 | continue; | 168 | continue; |
179 | } | 169 | } |
180 | } | 170 | } |
171 | |||
172 | /* Look for NVRAM at the end of the last block. */ | ||
173 | for (i = 0; i < ARRAY_SIZE(possible_nvram_sizes); i++) { | ||
174 | if (curr_part > BCM47XXPART_MAX_PARTS) { | ||
175 | pr_warn("Reached maximum number of partitions, scanning stopped!\n"); | ||
176 | break; | ||
177 | } | ||
178 | |||
179 | offset = master->size - possible_nvram_sizes[i]; | ||
180 | if (mtd_read(master, offset, 0x4, &bytes_read, | ||
181 | (uint8_t *)buf) < 0) { | ||
182 | pr_err("mtd_read error while reading at offset 0x%X!\n", | ||
183 | offset); | ||
184 | continue; | ||
185 | } | ||
186 | |||
187 | /* Standard NVRAM */ | ||
188 | if (buf[0] == NVRAM_HEADER) { | ||
189 | bcm47xxpart_add_part(&parts[curr_part++], "nvram", | ||
190 | master->size - blocksize, 0); | ||
191 | break; | ||
192 | } | ||
193 | } | ||
194 | |||
181 | kfree(buf); | 195 | kfree(buf); |
182 | 196 | ||
183 | /* | 197 | /* |
diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c index 43214151b882..42c63927609d 100644 --- a/drivers/mtd/nand/nand_base.c +++ b/drivers/mtd/nand/nand_base.c | |||
@@ -1523,6 +1523,14 @@ static int nand_do_read_ops(struct mtd_info *mtd, loff_t from, | |||
1523 | oobreadlen -= toread; | 1523 | oobreadlen -= toread; |
1524 | } | 1524 | } |
1525 | } | 1525 | } |
1526 | |||
1527 | if (chip->options & NAND_NEED_READRDY) { | ||
1528 | /* Apply delay or wait for ready/busy pin */ | ||
1529 | if (!chip->dev_ready) | ||
1530 | udelay(chip->chip_delay); | ||
1531 | else | ||
1532 | nand_wait_ready(mtd); | ||
1533 | } | ||
1526 | } else { | 1534 | } else { |
1527 | memcpy(buf, chip->buffers->databuf + col, bytes); | 1535 | memcpy(buf, chip->buffers->databuf + col, bytes); |
1528 | buf += bytes; | 1536 | buf += bytes; |
@@ -1787,6 +1795,14 @@ static int nand_do_read_oob(struct mtd_info *mtd, loff_t from, | |||
1787 | len = min(len, readlen); | 1795 | len = min(len, readlen); |
1788 | buf = nand_transfer_oob(chip, buf, ops, len); | 1796 | buf = nand_transfer_oob(chip, buf, ops, len); |
1789 | 1797 | ||
1798 | if (chip->options & NAND_NEED_READRDY) { | ||
1799 | /* Apply delay or wait for ready/busy pin */ | ||
1800 | if (!chip->dev_ready) | ||
1801 | udelay(chip->chip_delay); | ||
1802 | else | ||
1803 | nand_wait_ready(mtd); | ||
1804 | } | ||
1805 | |||
1790 | readlen -= len; | 1806 | readlen -= len; |
1791 | if (!readlen) | 1807 | if (!readlen) |
1792 | break; | 1808 | break; |
diff --git a/drivers/mtd/nand/nand_ids.c b/drivers/mtd/nand/nand_ids.c index e3aa2748a6e7..9c612388e5de 100644 --- a/drivers/mtd/nand/nand_ids.c +++ b/drivers/mtd/nand/nand_ids.c | |||
@@ -22,49 +22,51 @@ | |||
22 | * 512 512 Byte page size | 22 | * 512 512 Byte page size |
23 | */ | 23 | */ |
24 | struct nand_flash_dev nand_flash_ids[] = { | 24 | struct nand_flash_dev nand_flash_ids[] = { |
25 | #define SP_OPTIONS NAND_NEED_READRDY | ||
26 | #define SP_OPTIONS16 (SP_OPTIONS | NAND_BUSWIDTH_16) | ||
25 | 27 | ||
26 | #ifdef CONFIG_MTD_NAND_MUSEUM_IDS | 28 | #ifdef CONFIG_MTD_NAND_MUSEUM_IDS |
27 | {"NAND 1MiB 5V 8-bit", 0x6e, 256, 1, 0x1000, 0}, | 29 | {"NAND 1MiB 5V 8-bit", 0x6e, 256, 1, 0x1000, SP_OPTIONS}, |
28 | {"NAND 2MiB 5V 8-bit", 0x64, 256, 2, 0x1000, 0}, | 30 | {"NAND 2MiB 5V 8-bit", 0x64, 256, 2, 0x1000, SP_OPTIONS}, |
29 | {"NAND 4MiB 5V 8-bit", 0x6b, 512, 4, 0x2000, 0}, | 31 | {"NAND 4MiB 5V 8-bit", 0x6b, 512, 4, 0x2000, SP_OPTIONS}, |
30 | {"NAND 1MiB 3,3V 8-bit", 0xe8, 256, 1, 0x1000, 0}, | 32 | {"NAND 1MiB 3,3V 8-bit", 0xe8, 256, 1, 0x1000, SP_OPTIONS}, |
31 | {"NAND 1MiB 3,3V 8-bit", 0xec, 256, 1, 0x1000, 0}, | 33 | {"NAND 1MiB 3,3V 8-bit", 0xec, 256, 1, 0x1000, SP_OPTIONS}, |
32 | {"NAND 2MiB 3,3V 8-bit", 0xea, 256, 2, 0x1000, 0}, | 34 | {"NAND 2MiB 3,3V 8-bit", 0xea, 256, 2, 0x1000, SP_OPTIONS}, |
33 | {"NAND 4MiB 3,3V 8-bit", 0xd5, 512, 4, 0x2000, 0}, | 35 | {"NAND 4MiB 3,3V 8-bit", 0xd5, 512, 4, 0x2000, SP_OPTIONS}, |
34 | {"NAND 4MiB 3,3V 8-bit", 0xe3, 512, 4, 0x2000, 0}, | 36 | {"NAND 4MiB 3,3V 8-bit", 0xe3, 512, 4, 0x2000, SP_OPTIONS}, |
35 | {"NAND 4MiB 3,3V 8-bit", 0xe5, 512, 4, 0x2000, 0}, | 37 | {"NAND 4MiB 3,3V 8-bit", 0xe5, 512, 4, 0x2000, SP_OPTIONS}, |
36 | {"NAND 8MiB 3,3V 8-bit", 0xd6, 512, 8, 0x2000, 0}, | 38 | {"NAND 8MiB 3,3V 8-bit", 0xd6, 512, 8, 0x2000, SP_OPTIONS}, |
37 | 39 | ||
38 | {"NAND 8MiB 1,8V 8-bit", 0x39, 512, 8, 0x2000, 0}, | 40 | {"NAND 8MiB 1,8V 8-bit", 0x39, 512, 8, 0x2000, SP_OPTIONS}, |
39 | {"NAND 8MiB 3,3V 8-bit", 0xe6, 512, 8, 0x2000, 0}, | 41 | {"NAND 8MiB 3,3V 8-bit", 0xe6, 512, 8, 0x2000, SP_OPTIONS}, |
40 | {"NAND 8MiB 1,8V 16-bit", 0x49, 512, 8, 0x2000, NAND_BUSWIDTH_16}, | 42 | {"NAND 8MiB 1,8V 16-bit", 0x49, 512, 8, 0x2000, SP_OPTIONS16}, |
41 | {"NAND 8MiB 3,3V 16-bit", 0x59, 512, 8, 0x2000, NAND_BUSWIDTH_16}, | 43 | {"NAND 8MiB 3,3V 16-bit", 0x59, 512, 8, 0x2000, SP_OPTIONS16}, |
42 | #endif | 44 | #endif |
43 | 45 | ||
44 | {"NAND 16MiB 1,8V 8-bit", 0x33, 512, 16, 0x4000, 0}, | 46 | {"NAND 16MiB 1,8V 8-bit", 0x33, 512, 16, 0x4000, SP_OPTIONS}, |
45 | {"NAND 16MiB 3,3V 8-bit", 0x73, 512, 16, 0x4000, 0}, | 47 | {"NAND 16MiB 3,3V 8-bit", 0x73, 512, 16, 0x4000, SP_OPTIONS}, |
46 | {"NAND 16MiB 1,8V 16-bit", 0x43, 512, 16, 0x4000, NAND_BUSWIDTH_16}, | 48 | {"NAND 16MiB 1,8V 16-bit", 0x43, 512, 16, 0x4000, SP_OPTIONS16}, |
47 | {"NAND 16MiB 3,3V 16-bit", 0x53, 512, 16, 0x4000, NAND_BUSWIDTH_16}, | 49 | {"NAND 16MiB 3,3V 16-bit", 0x53, 512, 16, 0x4000, SP_OPTIONS16}, |
48 | 50 | ||
49 | {"NAND 32MiB 1,8V 8-bit", 0x35, 512, 32, 0x4000, 0}, | 51 | {"NAND 32MiB 1,8V 8-bit", 0x35, 512, 32, 0x4000, SP_OPTIONS}, |
50 | {"NAND 32MiB 3,3V 8-bit", 0x75, 512, 32, 0x4000, 0}, | 52 | {"NAND 32MiB 3,3V 8-bit", 0x75, 512, 32, 0x4000, SP_OPTIONS}, |
51 | {"NAND 32MiB 1,8V 16-bit", 0x45, 512, 32, 0x4000, NAND_BUSWIDTH_16}, | 53 | {"NAND 32MiB 1,8V 16-bit", 0x45, 512, 32, 0x4000, SP_OPTIONS16}, |
52 | {"NAND 32MiB 3,3V 16-bit", 0x55, 512, 32, 0x4000, NAND_BUSWIDTH_16}, | 54 | {"NAND 32MiB 3,3V 16-bit", 0x55, 512, 32, 0x4000, SP_OPTIONS16}, |
53 | 55 | ||
54 | {"NAND 64MiB 1,8V 8-bit", 0x36, 512, 64, 0x4000, 0}, | 56 | {"NAND 64MiB 1,8V 8-bit", 0x36, 512, 64, 0x4000, SP_OPTIONS}, |
55 | {"NAND 64MiB 3,3V 8-bit", 0x76, 512, 64, 0x4000, 0}, | 57 | {"NAND 64MiB 3,3V 8-bit", 0x76, 512, 64, 0x4000, SP_OPTIONS}, |
56 | {"NAND 64MiB 1,8V 16-bit", 0x46, 512, 64, 0x4000, NAND_BUSWIDTH_16}, | 58 | {"NAND 64MiB 1,8V 16-bit", 0x46, 512, 64, 0x4000, SP_OPTIONS16}, |
57 | {"NAND 64MiB 3,3V 16-bit", 0x56, 512, 64, 0x4000, NAND_BUSWIDTH_16}, | 59 | {"NAND 64MiB 3,3V 16-bit", 0x56, 512, 64, 0x4000, SP_OPTIONS16}, |
58 | 60 | ||
59 | {"NAND 128MiB 1,8V 8-bit", 0x78, 512, 128, 0x4000, 0}, | 61 | {"NAND 128MiB 1,8V 8-bit", 0x78, 512, 128, 0x4000, SP_OPTIONS}, |
60 | {"NAND 128MiB 1,8V 8-bit", 0x39, 512, 128, 0x4000, 0}, | 62 | {"NAND 128MiB 1,8V 8-bit", 0x39, 512, 128, 0x4000, SP_OPTIONS}, |
61 | {"NAND 128MiB 3,3V 8-bit", 0x79, 512, 128, 0x4000, 0}, | 63 | {"NAND 128MiB 3,3V 8-bit", 0x79, 512, 128, 0x4000, SP_OPTIONS}, |
62 | {"NAND 128MiB 1,8V 16-bit", 0x72, 512, 128, 0x4000, NAND_BUSWIDTH_16}, | 64 | {"NAND 128MiB 1,8V 16-bit", 0x72, 512, 128, 0x4000, SP_OPTIONS16}, |
63 | {"NAND 128MiB 1,8V 16-bit", 0x49, 512, 128, 0x4000, NAND_BUSWIDTH_16}, | 65 | {"NAND 128MiB 1,8V 16-bit", 0x49, 512, 128, 0x4000, SP_OPTIONS16}, |
64 | {"NAND 128MiB 3,3V 16-bit", 0x74, 512, 128, 0x4000, NAND_BUSWIDTH_16}, | 66 | {"NAND 128MiB 3,3V 16-bit", 0x74, 512, 128, 0x4000, SP_OPTIONS16}, |
65 | {"NAND 128MiB 3,3V 16-bit", 0x59, 512, 128, 0x4000, NAND_BUSWIDTH_16}, | 67 | {"NAND 128MiB 3,3V 16-bit", 0x59, 512, 128, 0x4000, SP_OPTIONS16}, |
66 | 68 | ||
67 | {"NAND 256MiB 3,3V 8-bit", 0x71, 512, 256, 0x4000, 0}, | 69 | {"NAND 256MiB 3,3V 8-bit", 0x71, 512, 256, 0x4000, SP_OPTIONS}, |
68 | 70 | ||
69 | /* | 71 | /* |
70 | * These are the new chips with large page size. The pagesize and the | 72 | * These are the new chips with large page size. The pagesize and the |
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c index 7bd068a6056a..6bbd90e1123c 100644 --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c | |||
@@ -1746,6 +1746,8 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev) | |||
1746 | 1746 | ||
1747 | bond_compute_features(bond); | 1747 | bond_compute_features(bond); |
1748 | 1748 | ||
1749 | bond_update_speed_duplex(new_slave); | ||
1750 | |||
1749 | read_lock(&bond->lock); | 1751 | read_lock(&bond->lock); |
1750 | 1752 | ||
1751 | new_slave->last_arp_rx = jiffies - | 1753 | new_slave->last_arp_rx = jiffies - |
@@ -1798,8 +1800,6 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev) | |||
1798 | new_slave->link == BOND_LINK_DOWN ? "DOWN" : | 1800 | new_slave->link == BOND_LINK_DOWN ? "DOWN" : |
1799 | (new_slave->link == BOND_LINK_UP ? "UP" : "BACK")); | 1801 | (new_slave->link == BOND_LINK_UP ? "UP" : "BACK")); |
1800 | 1802 | ||
1801 | bond_update_speed_duplex(new_slave); | ||
1802 | |||
1803 | if (USES_PRIMARY(bond->params.mode) && bond->params.primary[0]) { | 1803 | if (USES_PRIMARY(bond->params.mode) && bond->params.primary[0]) { |
1804 | /* if there is a primary slave, remember it */ | 1804 | /* if there is a primary slave, remember it */ |
1805 | if (strcmp(bond->params.primary, new_slave->dev->name) == 0) { | 1805 | if (strcmp(bond->params.primary, new_slave->dev->name) == 0) { |
@@ -1964,7 +1964,6 @@ static int __bond_release_one(struct net_device *bond_dev, | |||
1964 | } | 1964 | } |
1965 | 1965 | ||
1966 | block_netpoll_tx(); | 1966 | block_netpoll_tx(); |
1967 | call_netdevice_notifiers(NETDEV_RELEASE, bond_dev); | ||
1968 | write_lock_bh(&bond->lock); | 1967 | write_lock_bh(&bond->lock); |
1969 | 1968 | ||
1970 | slave = bond_get_slave_by_dev(bond, slave_dev); | 1969 | slave = bond_get_slave_by_dev(bond, slave_dev); |
@@ -2066,8 +2065,10 @@ static int __bond_release_one(struct net_device *bond_dev, | |||
2066 | write_unlock_bh(&bond->lock); | 2065 | write_unlock_bh(&bond->lock); |
2067 | unblock_netpoll_tx(); | 2066 | unblock_netpoll_tx(); |
2068 | 2067 | ||
2069 | if (bond->slave_cnt == 0) | 2068 | if (bond->slave_cnt == 0) { |
2070 | call_netdevice_notifiers(NETDEV_CHANGEADDR, bond->dev); | 2069 | call_netdevice_notifiers(NETDEV_CHANGEADDR, bond->dev); |
2070 | call_netdevice_notifiers(NETDEV_RELEASE, bond->dev); | ||
2071 | } | ||
2071 | 2072 | ||
2072 | bond_compute_features(bond); | 2073 | bond_compute_features(bond); |
2073 | if (!(bond_dev->features & NETIF_F_VLAN_CHALLENGED) && | 2074 | if (!(bond_dev->features & NETIF_F_VLAN_CHALLENGED) && |
@@ -2373,8 +2374,6 @@ static void bond_miimon_commit(struct bonding *bond) | |||
2373 | bond_set_backup_slave(slave); | 2374 | bond_set_backup_slave(slave); |
2374 | } | 2375 | } |
2375 | 2376 | ||
2376 | bond_update_speed_duplex(slave); | ||
2377 | |||
2378 | pr_info("%s: link status definitely up for interface %s, %u Mbps %s duplex.\n", | 2377 | pr_info("%s: link status definitely up for interface %s, %u Mbps %s duplex.\n", |
2379 | bond->dev->name, slave->dev->name, | 2378 | bond->dev->name, slave->dev->name, |
2380 | slave->speed, slave->duplex ? "full" : "half"); | 2379 | slave->speed, slave->duplex ? "full" : "half"); |
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c index a923bc4d5a1f..4046f97378c2 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c | |||
@@ -2760,6 +2760,7 @@ load_error2: | |||
2760 | bp->port.pmf = 0; | 2760 | bp->port.pmf = 0; |
2761 | load_error1: | 2761 | load_error1: |
2762 | bnx2x_napi_disable(bp); | 2762 | bnx2x_napi_disable(bp); |
2763 | bnx2x_del_all_napi(bp); | ||
2763 | 2764 | ||
2764 | /* clear pf_load status, as it was already set */ | 2765 | /* clear pf_load status, as it was already set */ |
2765 | if (IS_PF(bp)) | 2766 | if (IS_PF(bp)) |
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c index 31c5787970db..77ebae0ac64a 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c | |||
@@ -8647,7 +8647,9 @@ void bnx2x_handle_module_detect_int(struct link_params *params) | |||
8647 | MDIO_WC_DEVAD, | 8647 | MDIO_WC_DEVAD, |
8648 | MDIO_WC_REG_DIGITAL5_MISC6, | 8648 | MDIO_WC_REG_DIGITAL5_MISC6, |
8649 | &rx_tx_in_reset); | 8649 | &rx_tx_in_reset); |
8650 | if (!rx_tx_in_reset) { | 8650 | if ((!rx_tx_in_reset) && |
8651 | (params->link_flags & | ||
8652 | PHY_INITIALIZED)) { | ||
8651 | bnx2x_warpcore_reset_lane(bp, phy, 1); | 8653 | bnx2x_warpcore_reset_lane(bp, phy, 1); |
8652 | bnx2x_warpcore_config_sfi(phy, params); | 8654 | bnx2x_warpcore_config_sfi(phy, params); |
8653 | bnx2x_warpcore_reset_lane(bp, phy, 0); | 8655 | bnx2x_warpcore_reset_lane(bp, phy, 0); |
@@ -12527,6 +12529,8 @@ int bnx2x_phy_init(struct link_params *params, struct link_vars *vars) | |||
12527 | vars->flow_ctrl = BNX2X_FLOW_CTRL_NONE; | 12529 | vars->flow_ctrl = BNX2X_FLOW_CTRL_NONE; |
12528 | vars->mac_type = MAC_TYPE_NONE; | 12530 | vars->mac_type = MAC_TYPE_NONE; |
12529 | vars->phy_flags = 0; | 12531 | vars->phy_flags = 0; |
12532 | vars->check_kr2_recovery_cnt = 0; | ||
12533 | params->link_flags = PHY_INITIALIZED; | ||
12530 | /* Driver opens NIG-BRB filters */ | 12534 | /* Driver opens NIG-BRB filters */ |
12531 | bnx2x_set_rx_filter(params, 1); | 12535 | bnx2x_set_rx_filter(params, 1); |
12532 | /* Check if link flap can be avoided */ | 12536 | /* Check if link flap can be avoided */ |
@@ -12691,6 +12695,7 @@ int bnx2x_lfa_reset(struct link_params *params, | |||
12691 | struct bnx2x *bp = params->bp; | 12695 | struct bnx2x *bp = params->bp; |
12692 | vars->link_up = 0; | 12696 | vars->link_up = 0; |
12693 | vars->phy_flags = 0; | 12697 | vars->phy_flags = 0; |
12698 | params->link_flags &= ~PHY_INITIALIZED; | ||
12694 | if (!params->lfa_base) | 12699 | if (!params->lfa_base) |
12695 | return bnx2x_link_reset(params, vars, 1); | 12700 | return bnx2x_link_reset(params, vars, 1); |
12696 | /* | 12701 | /* |
@@ -13411,6 +13416,7 @@ static void bnx2x_disable_kr2(struct link_params *params, | |||
13411 | vars->link_attr_sync &= ~LINK_ATTR_SYNC_KR2_ENABLE; | 13416 | vars->link_attr_sync &= ~LINK_ATTR_SYNC_KR2_ENABLE; |
13412 | bnx2x_update_link_attr(params, vars->link_attr_sync); | 13417 | bnx2x_update_link_attr(params, vars->link_attr_sync); |
13413 | 13418 | ||
13419 | vars->check_kr2_recovery_cnt = CHECK_KR2_RECOVERY_CNT; | ||
13414 | /* Restart AN on leading lane */ | 13420 | /* Restart AN on leading lane */ |
13415 | bnx2x_warpcore_restart_AN_KR(phy, params); | 13421 | bnx2x_warpcore_restart_AN_KR(phy, params); |
13416 | } | 13422 | } |
@@ -13439,6 +13445,15 @@ static void bnx2x_check_kr2_wa(struct link_params *params, | |||
13439 | return; | 13445 | return; |
13440 | } | 13446 | } |
13441 | 13447 | ||
13448 | /* Once KR2 was disabled, wait 5 seconds before checking KR2 recovery | ||
13449 | * since some switches tend to reinit the AN process and clear the | ||
13450 | * advertised BP/NP after ~2 seconds causing the KR2 to be disabled | ||
13451 | * and recovered many times | ||
13452 | */ | ||
13453 | if (vars->check_kr2_recovery_cnt > 0) { | ||
13454 | vars->check_kr2_recovery_cnt--; | ||
13455 | return; | ||
13456 | } | ||
13442 | lane = bnx2x_get_warpcore_lane(phy, params); | 13457 | lane = bnx2x_get_warpcore_lane(phy, params); |
13443 | CL22_WR_OVER_CL45(bp, phy, MDIO_REG_BANK_AER_BLOCK, | 13458 | CL22_WR_OVER_CL45(bp, phy, MDIO_REG_BANK_AER_BLOCK, |
13444 | MDIO_AER_BLOCK_AER_REG, lane); | 13459 | MDIO_AER_BLOCK_AER_REG, lane); |
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.h b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.h index be5c195d03dd..56c2aae4e2c8 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.h +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.h | |||
@@ -309,6 +309,7 @@ struct link_params { | |||
309 | req_flow_ctrl is set to AUTO */ | 309 | req_flow_ctrl is set to AUTO */ |
310 | u16 link_flags; | 310 | u16 link_flags; |
311 | #define LINK_FLAGS_INT_DISABLED (1<<0) | 311 | #define LINK_FLAGS_INT_DISABLED (1<<0) |
312 | #define PHY_INITIALIZED (1<<1) | ||
312 | u32 lfa_base; | 313 | u32 lfa_base; |
313 | }; | 314 | }; |
314 | 315 | ||
@@ -342,7 +343,8 @@ struct link_vars { | |||
342 | u32 link_status; | 343 | u32 link_status; |
343 | u32 eee_status; | 344 | u32 eee_status; |
344 | u8 fault_detected; | 345 | u8 fault_detected; |
345 | u8 rsrv1; | 346 | u8 check_kr2_recovery_cnt; |
347 | #define CHECK_KR2_RECOVERY_CNT 5 | ||
346 | u16 periodic_flags; | 348 | u16 periodic_flags; |
347 | #define PERIODIC_FLAGS_LINK_EVENT 0x0001 | 349 | #define PERIODIC_FLAGS_LINK_EVENT 0x0001 |
348 | 350 | ||
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_stats.h b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_stats.h index 364e37ecbc5c..198f6f1c9ad5 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_stats.h +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_stats.h | |||
@@ -459,8 +459,9 @@ struct bnx2x_fw_port_stats_old { | |||
459 | 459 | ||
460 | #define UPDATE_QSTAT(s, t) \ | 460 | #define UPDATE_QSTAT(s, t) \ |
461 | do { \ | 461 | do { \ |
462 | qstats->t##_hi = qstats_old->t##_hi + le32_to_cpu(s.hi); \ | ||
463 | qstats->t##_lo = qstats_old->t##_lo + le32_to_cpu(s.lo); \ | 462 | qstats->t##_lo = qstats_old->t##_lo + le32_to_cpu(s.lo); \ |
463 | qstats->t##_hi = qstats_old->t##_hi + le32_to_cpu(s.hi) \ | ||
464 | + ((qstats->t##_lo < qstats_old->t##_lo) ? 1 : 0); \ | ||
464 | } while (0) | 465 | } while (0) |
465 | 466 | ||
466 | #define UPDATE_QSTAT_OLD(f) \ | 467 | #define UPDATE_QSTAT_OLD(f) \ |
diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c index fdb9b5655414..67d2663b3974 100644 --- a/drivers/net/ethernet/broadcom/tg3.c +++ b/drivers/net/ethernet/broadcom/tg3.c | |||
@@ -1869,6 +1869,8 @@ static void tg3_link_report(struct tg3 *tp) | |||
1869 | 1869 | ||
1870 | tg3_ump_link_report(tp); | 1870 | tg3_ump_link_report(tp); |
1871 | } | 1871 | } |
1872 | |||
1873 | tp->link_up = netif_carrier_ok(tp->dev); | ||
1872 | } | 1874 | } |
1873 | 1875 | ||
1874 | static u16 tg3_advert_flowctrl_1000X(u8 flow_ctrl) | 1876 | static u16 tg3_advert_flowctrl_1000X(u8 flow_ctrl) |
@@ -2522,12 +2524,6 @@ static int tg3_phy_reset_5703_4_5(struct tg3 *tp) | |||
2522 | return err; | 2524 | return err; |
2523 | } | 2525 | } |
2524 | 2526 | ||
2525 | static void tg3_carrier_on(struct tg3 *tp) | ||
2526 | { | ||
2527 | netif_carrier_on(tp->dev); | ||
2528 | tp->link_up = true; | ||
2529 | } | ||
2530 | |||
2531 | static void tg3_carrier_off(struct tg3 *tp) | 2527 | static void tg3_carrier_off(struct tg3 *tp) |
2532 | { | 2528 | { |
2533 | netif_carrier_off(tp->dev); | 2529 | netif_carrier_off(tp->dev); |
@@ -2553,7 +2549,7 @@ static int tg3_phy_reset(struct tg3 *tp) | |||
2553 | return -EBUSY; | 2549 | return -EBUSY; |
2554 | 2550 | ||
2555 | if (netif_running(tp->dev) && tp->link_up) { | 2551 | if (netif_running(tp->dev) && tp->link_up) { |
2556 | tg3_carrier_off(tp); | 2552 | netif_carrier_off(tp->dev); |
2557 | tg3_link_report(tp); | 2553 | tg3_link_report(tp); |
2558 | } | 2554 | } |
2559 | 2555 | ||
@@ -4134,6 +4130,14 @@ static void tg3_phy_copper_begin(struct tg3 *tp) | |||
4134 | tp->link_config.active_speed = tp->link_config.speed; | 4130 | tp->link_config.active_speed = tp->link_config.speed; |
4135 | tp->link_config.active_duplex = tp->link_config.duplex; | 4131 | tp->link_config.active_duplex = tp->link_config.duplex; |
4136 | 4132 | ||
4133 | if (tg3_asic_rev(tp) == ASIC_REV_5714) { | ||
4134 | /* With autoneg disabled, 5715 only links up when the | ||
4135 | * advertisement register has the configured speed | ||
4136 | * enabled. | ||
4137 | */ | ||
4138 | tg3_writephy(tp, MII_ADVERTISE, ADVERTISE_ALL); | ||
4139 | } | ||
4140 | |||
4137 | bmcr = 0; | 4141 | bmcr = 0; |
4138 | switch (tp->link_config.speed) { | 4142 | switch (tp->link_config.speed) { |
4139 | default: | 4143 | default: |
@@ -4262,9 +4266,9 @@ static bool tg3_test_and_report_link_chg(struct tg3 *tp, int curr_link_up) | |||
4262 | { | 4266 | { |
4263 | if (curr_link_up != tp->link_up) { | 4267 | if (curr_link_up != tp->link_up) { |
4264 | if (curr_link_up) { | 4268 | if (curr_link_up) { |
4265 | tg3_carrier_on(tp); | 4269 | netif_carrier_on(tp->dev); |
4266 | } else { | 4270 | } else { |
4267 | tg3_carrier_off(tp); | 4271 | netif_carrier_off(tp->dev); |
4268 | if (tp->phy_flags & TG3_PHYFLG_MII_SERDES) | 4272 | if (tp->phy_flags & TG3_PHYFLG_MII_SERDES) |
4269 | tp->phy_flags &= ~TG3_PHYFLG_PARALLEL_DETECT; | 4273 | tp->phy_flags &= ~TG3_PHYFLG_PARALLEL_DETECT; |
4270 | } | 4274 | } |
diff --git a/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c b/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c index 4ce62031f62f..8049268ce0f2 100644 --- a/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c +++ b/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c | |||
@@ -497,8 +497,9 @@ int t4_memory_write(struct adapter *adap, int mtype, u32 addr, u32 len, | |||
497 | } | 497 | } |
498 | 498 | ||
499 | #define EEPROM_STAT_ADDR 0x7bfc | 499 | #define EEPROM_STAT_ADDR 0x7bfc |
500 | #define VPD_BASE 0 | ||
501 | #define VPD_LEN 512 | 500 | #define VPD_LEN 512 |
501 | #define VPD_BASE 0x400 | ||
502 | #define VPD_BASE_OLD 0 | ||
502 | 503 | ||
503 | /** | 504 | /** |
504 | * t4_seeprom_wp - enable/disable EEPROM write protection | 505 | * t4_seeprom_wp - enable/disable EEPROM write protection |
@@ -524,7 +525,7 @@ int t4_seeprom_wp(struct adapter *adapter, bool enable) | |||
524 | int get_vpd_params(struct adapter *adapter, struct vpd_params *p) | 525 | int get_vpd_params(struct adapter *adapter, struct vpd_params *p) |
525 | { | 526 | { |
526 | u32 cclk_param, cclk_val; | 527 | u32 cclk_param, cclk_val; |
527 | int i, ret; | 528 | int i, ret, addr; |
528 | int ec, sn; | 529 | int ec, sn; |
529 | u8 *vpd, csum; | 530 | u8 *vpd, csum; |
530 | unsigned int vpdr_len, kw_offset, id_len; | 531 | unsigned int vpdr_len, kw_offset, id_len; |
@@ -533,7 +534,12 @@ int get_vpd_params(struct adapter *adapter, struct vpd_params *p) | |||
533 | if (!vpd) | 534 | if (!vpd) |
534 | return -ENOMEM; | 535 | return -ENOMEM; |
535 | 536 | ||
536 | ret = pci_read_vpd(adapter->pdev, VPD_BASE, VPD_LEN, vpd); | 537 | ret = pci_read_vpd(adapter->pdev, VPD_BASE, sizeof(u32), vpd); |
538 | if (ret < 0) | ||
539 | goto out; | ||
540 | addr = *vpd == 0x82 ? VPD_BASE : VPD_BASE_OLD; | ||
541 | |||
542 | ret = pci_read_vpd(adapter->pdev, addr, VPD_LEN, vpd); | ||
537 | if (ret < 0) | 543 | if (ret < 0) |
538 | goto out; | 544 | goto out; |
539 | 545 | ||
diff --git a/drivers/net/ethernet/dec/tulip/Kconfig b/drivers/net/ethernet/dec/tulip/Kconfig index 0c37fb2cc867..1df33c799c00 100644 --- a/drivers/net/ethernet/dec/tulip/Kconfig +++ b/drivers/net/ethernet/dec/tulip/Kconfig | |||
@@ -108,6 +108,7 @@ config TULIP_DM910X | |||
108 | config DE4X5 | 108 | config DE4X5 |
109 | tristate "Generic DECchip & DIGITAL EtherWORKS PCI/EISA" | 109 | tristate "Generic DECchip & DIGITAL EtherWORKS PCI/EISA" |
110 | depends on (PCI || EISA) | 110 | depends on (PCI || EISA) |
111 | depends on VIRT_TO_BUS || ALPHA || PPC || SPARC | ||
111 | select CRC32 | 112 | select CRC32 |
112 | ---help--- | 113 | ---help--- |
113 | This is support for the DIGITAL series of PCI/EISA Ethernet cards. | 114 | This is support for the DIGITAL series of PCI/EISA Ethernet cards. |
diff --git a/drivers/net/ethernet/emulex/benet/be.h b/drivers/net/ethernet/emulex/benet/be.h index 28ceb8414185..29aff55f2eea 100644 --- a/drivers/net/ethernet/emulex/benet/be.h +++ b/drivers/net/ethernet/emulex/benet/be.h | |||
@@ -349,6 +349,7 @@ struct be_adapter { | |||
349 | struct pci_dev *pdev; | 349 | struct pci_dev *pdev; |
350 | struct net_device *netdev; | 350 | struct net_device *netdev; |
351 | 351 | ||
352 | u8 __iomem *csr; /* CSR BAR used only for BE2/3 */ | ||
352 | u8 __iomem *db; /* Door Bell */ | 353 | u8 __iomem *db; /* Door Bell */ |
353 | 354 | ||
354 | struct mutex mbox_lock; /* For serializing mbox cmds to BE card */ | 355 | struct mutex mbox_lock; /* For serializing mbox cmds to BE card */ |
diff --git a/drivers/net/ethernet/emulex/benet/be_cmds.c b/drivers/net/ethernet/emulex/benet/be_cmds.c index 071aea79d218..3c9b4f12e3e5 100644 --- a/drivers/net/ethernet/emulex/benet/be_cmds.c +++ b/drivers/net/ethernet/emulex/benet/be_cmds.c | |||
@@ -473,19 +473,17 @@ static int be_mbox_notify_wait(struct be_adapter *adapter) | |||
473 | return 0; | 473 | return 0; |
474 | } | 474 | } |
475 | 475 | ||
476 | static int be_POST_stage_get(struct be_adapter *adapter, u16 *stage) | 476 | static u16 be_POST_stage_get(struct be_adapter *adapter) |
477 | { | 477 | { |
478 | u32 sem; | 478 | u32 sem; |
479 | u32 reg = skyhawk_chip(adapter) ? SLIPORT_SEMAPHORE_OFFSET_SH : | ||
480 | SLIPORT_SEMAPHORE_OFFSET_BE; | ||
481 | 479 | ||
482 | pci_read_config_dword(adapter->pdev, reg, &sem); | 480 | if (BEx_chip(adapter)) |
483 | *stage = sem & POST_STAGE_MASK; | 481 | sem = ioread32(adapter->csr + SLIPORT_SEMAPHORE_OFFSET_BEx); |
484 | |||
485 | if ((sem >> POST_ERR_SHIFT) & POST_ERR_MASK) | ||
486 | return -1; | ||
487 | else | 482 | else |
488 | return 0; | 483 | pci_read_config_dword(adapter->pdev, |
484 | SLIPORT_SEMAPHORE_OFFSET_SH, &sem); | ||
485 | |||
486 | return sem & POST_STAGE_MASK; | ||
489 | } | 487 | } |
490 | 488 | ||
491 | int lancer_wait_ready(struct be_adapter *adapter) | 489 | int lancer_wait_ready(struct be_adapter *adapter) |
@@ -579,19 +577,17 @@ int be_fw_wait_ready(struct be_adapter *adapter) | |||
579 | } | 577 | } |
580 | 578 | ||
581 | do { | 579 | do { |
582 | status = be_POST_stage_get(adapter, &stage); | 580 | stage = be_POST_stage_get(adapter); |
583 | if (status) { | 581 | if (stage == POST_STAGE_ARMFW_RDY) |
584 | dev_err(dev, "POST error; stage=0x%x\n", stage); | ||
585 | return -1; | ||
586 | } else if (stage != POST_STAGE_ARMFW_RDY) { | ||
587 | if (msleep_interruptible(2000)) { | ||
588 | dev_err(dev, "Waiting for POST aborted\n"); | ||
589 | return -EINTR; | ||
590 | } | ||
591 | timeout += 2; | ||
592 | } else { | ||
593 | return 0; | 582 | return 0; |
583 | |||
584 | dev_info(dev, "Waiting for POST, %ds elapsed\n", | ||
585 | timeout); | ||
586 | if (msleep_interruptible(2000)) { | ||
587 | dev_err(dev, "Waiting for POST aborted\n"); | ||
588 | return -EINTR; | ||
594 | } | 589 | } |
590 | timeout += 2; | ||
595 | } while (timeout < 60); | 591 | } while (timeout < 60); |
596 | 592 | ||
597 | dev_err(dev, "POST timeout; stage=0x%x\n", stage); | 593 | dev_err(dev, "POST timeout; stage=0x%x\n", stage); |
diff --git a/drivers/net/ethernet/emulex/benet/be_hw.h b/drivers/net/ethernet/emulex/benet/be_hw.h index 541d4530d5bf..62dc220695f7 100644 --- a/drivers/net/ethernet/emulex/benet/be_hw.h +++ b/drivers/net/ethernet/emulex/benet/be_hw.h | |||
@@ -32,8 +32,8 @@ | |||
32 | #define MPU_EP_CONTROL 0 | 32 | #define MPU_EP_CONTROL 0 |
33 | 33 | ||
34 | /********** MPU semphore: used for SH & BE *************/ | 34 | /********** MPU semphore: used for SH & BE *************/ |
35 | #define SLIPORT_SEMAPHORE_OFFSET_BE 0x7c | 35 | #define SLIPORT_SEMAPHORE_OFFSET_BEx 0xac /* CSR BAR offset */ |
36 | #define SLIPORT_SEMAPHORE_OFFSET_SH 0x94 | 36 | #define SLIPORT_SEMAPHORE_OFFSET_SH 0x94 /* PCI-CFG offset */ |
37 | #define POST_STAGE_MASK 0x0000FFFF | 37 | #define POST_STAGE_MASK 0x0000FFFF |
38 | #define POST_ERR_MASK 0x1 | 38 | #define POST_ERR_MASK 0x1 |
39 | #define POST_ERR_SHIFT 31 | 39 | #define POST_ERR_SHIFT 31 |
diff --git a/drivers/net/ethernet/emulex/benet/be_main.c b/drivers/net/ethernet/emulex/benet/be_main.c index 3860888ac711..08e54f3d288b 100644 --- a/drivers/net/ethernet/emulex/benet/be_main.c +++ b/drivers/net/ethernet/emulex/benet/be_main.c | |||
@@ -3688,6 +3688,8 @@ static void be_netdev_init(struct net_device *netdev) | |||
3688 | 3688 | ||
3689 | static void be_unmap_pci_bars(struct be_adapter *adapter) | 3689 | static void be_unmap_pci_bars(struct be_adapter *adapter) |
3690 | { | 3690 | { |
3691 | if (adapter->csr) | ||
3692 | pci_iounmap(adapter->pdev, adapter->csr); | ||
3691 | if (adapter->db) | 3693 | if (adapter->db) |
3692 | pci_iounmap(adapter->pdev, adapter->db); | 3694 | pci_iounmap(adapter->pdev, adapter->db); |
3693 | } | 3695 | } |
@@ -3721,6 +3723,12 @@ static int be_map_pci_bars(struct be_adapter *adapter) | |||
3721 | adapter->if_type = (sli_intf & SLI_INTF_IF_TYPE_MASK) >> | 3723 | adapter->if_type = (sli_intf & SLI_INTF_IF_TYPE_MASK) >> |
3722 | SLI_INTF_IF_TYPE_SHIFT; | 3724 | SLI_INTF_IF_TYPE_SHIFT; |
3723 | 3725 | ||
3726 | if (BEx_chip(adapter) && be_physfn(adapter)) { | ||
3727 | adapter->csr = pci_iomap(adapter->pdev, 2, 0); | ||
3728 | if (adapter->csr == NULL) | ||
3729 | return -ENOMEM; | ||
3730 | } | ||
3731 | |||
3724 | addr = pci_iomap(adapter->pdev, db_bar(adapter), 0); | 3732 | addr = pci_iomap(adapter->pdev, db_bar(adapter), 0); |
3725 | if (addr == NULL) | 3733 | if (addr == NULL) |
3726 | goto pci_map_err; | 3734 | goto pci_map_err; |
@@ -4329,6 +4337,8 @@ static pci_ers_result_t be_eeh_reset(struct pci_dev *pdev) | |||
4329 | pci_restore_state(pdev); | 4337 | pci_restore_state(pdev); |
4330 | 4338 | ||
4331 | /* Check if card is ok and fw is ready */ | 4339 | /* Check if card is ok and fw is ready */ |
4340 | dev_info(&adapter->pdev->dev, | ||
4341 | "Waiting for FW to be ready after EEH reset\n"); | ||
4332 | status = be_fw_wait_ready(adapter); | 4342 | status = be_fw_wait_ready(adapter); |
4333 | if (status) | 4343 | if (status) |
4334 | return PCI_ERS_RESULT_DISCONNECT; | 4344 | return PCI_ERS_RESULT_DISCONNECT; |
diff --git a/drivers/net/ethernet/freescale/fec.c b/drivers/net/ethernet/freescale/fec.c index 069a155d16ed..e3f39372ce25 100644 --- a/drivers/net/ethernet/freescale/fec.c +++ b/drivers/net/ethernet/freescale/fec.c | |||
@@ -934,24 +934,28 @@ static void fec_enet_adjust_link(struct net_device *ndev) | |||
934 | goto spin_unlock; | 934 | goto spin_unlock; |
935 | } | 935 | } |
936 | 936 | ||
937 | /* Duplex link change */ | ||
938 | if (phy_dev->link) { | 937 | if (phy_dev->link) { |
939 | if (fep->full_duplex != phy_dev->duplex) { | 938 | if (!fep->link) { |
940 | fec_restart(ndev, phy_dev->duplex); | ||
941 | /* prevent unnecessary second fec_restart() below */ | ||
942 | fep->link = phy_dev->link; | 939 | fep->link = phy_dev->link; |
943 | status_change = 1; | 940 | status_change = 1; |
944 | } | 941 | } |
945 | } | ||
946 | 942 | ||
947 | /* Link on or off change */ | 943 | if (fep->full_duplex != phy_dev->duplex) |
948 | if (phy_dev->link != fep->link) { | 944 | status_change = 1; |
949 | fep->link = phy_dev->link; | 945 | |
950 | if (phy_dev->link) | 946 | if (phy_dev->speed != fep->speed) { |
947 | fep->speed = phy_dev->speed; | ||
948 | status_change = 1; | ||
949 | } | ||
950 | |||
951 | /* if any of the above changed restart the FEC */ | ||
952 | if (status_change) | ||
951 | fec_restart(ndev, phy_dev->duplex); | 953 | fec_restart(ndev, phy_dev->duplex); |
952 | else | 954 | } else { |
955 | if (fep->link) { | ||
953 | fec_stop(ndev); | 956 | fec_stop(ndev); |
954 | status_change = 1; | 957 | status_change = 1; |
958 | } | ||
955 | } | 959 | } |
956 | 960 | ||
957 | spin_unlock: | 961 | spin_unlock: |
@@ -1437,6 +1441,7 @@ fec_enet_close(struct net_device *ndev) | |||
1437 | struct fec_enet_private *fep = netdev_priv(ndev); | 1441 | struct fec_enet_private *fep = netdev_priv(ndev); |
1438 | 1442 | ||
1439 | /* Don't know what to do yet. */ | 1443 | /* Don't know what to do yet. */ |
1444 | napi_disable(&fep->napi); | ||
1440 | fep->opened = 0; | 1445 | fep->opened = 0; |
1441 | netif_stop_queue(ndev); | 1446 | netif_stop_queue(ndev); |
1442 | fec_stop(ndev); | 1447 | fec_stop(ndev); |
diff --git a/drivers/net/ethernet/freescale/fec.h b/drivers/net/ethernet/freescale/fec.h index f5390071efd0..eb4372962839 100644 --- a/drivers/net/ethernet/freescale/fec.h +++ b/drivers/net/ethernet/freescale/fec.h | |||
@@ -240,6 +240,7 @@ struct fec_enet_private { | |||
240 | phy_interface_t phy_interface; | 240 | phy_interface_t phy_interface; |
241 | int link; | 241 | int link; |
242 | int full_duplex; | 242 | int full_duplex; |
243 | int speed; | ||
243 | struct completion mdio_done; | 244 | struct completion mdio_done; |
244 | int irq[FEC_IRQ_NUM]; | 245 | int irq[FEC_IRQ_NUM]; |
245 | int bufdesc_ex; | 246 | int bufdesc_ex; |
diff --git a/drivers/net/ethernet/intel/e1000e/ethtool.c b/drivers/net/ethernet/intel/e1000e/ethtool.c index 2c1813737f6d..f91a8f3f9d48 100644 --- a/drivers/net/ethernet/intel/e1000e/ethtool.c +++ b/drivers/net/ethernet/intel/e1000e/ethtool.c | |||
@@ -36,6 +36,7 @@ | |||
36 | #include <linux/delay.h> | 36 | #include <linux/delay.h> |
37 | #include <linux/vmalloc.h> | 37 | #include <linux/vmalloc.h> |
38 | #include <linux/mdio.h> | 38 | #include <linux/mdio.h> |
39 | #include <linux/pm_runtime.h> | ||
39 | 40 | ||
40 | #include "e1000.h" | 41 | #include "e1000.h" |
41 | 42 | ||
@@ -2229,7 +2230,19 @@ static int e1000e_get_ts_info(struct net_device *netdev, | |||
2229 | return 0; | 2230 | return 0; |
2230 | } | 2231 | } |
2231 | 2232 | ||
2233 | static int e1000e_ethtool_begin(struct net_device *netdev) | ||
2234 | { | ||
2235 | return pm_runtime_get_sync(netdev->dev.parent); | ||
2236 | } | ||
2237 | |||
2238 | static void e1000e_ethtool_complete(struct net_device *netdev) | ||
2239 | { | ||
2240 | pm_runtime_put_sync(netdev->dev.parent); | ||
2241 | } | ||
2242 | |||
2232 | static const struct ethtool_ops e1000_ethtool_ops = { | 2243 | static const struct ethtool_ops e1000_ethtool_ops = { |
2244 | .begin = e1000e_ethtool_begin, | ||
2245 | .complete = e1000e_ethtool_complete, | ||
2233 | .get_settings = e1000_get_settings, | 2246 | .get_settings = e1000_get_settings, |
2234 | .set_settings = e1000_set_settings, | 2247 | .set_settings = e1000_set_settings, |
2235 | .get_drvinfo = e1000_get_drvinfo, | 2248 | .get_drvinfo = e1000_get_drvinfo, |
diff --git a/drivers/net/ethernet/intel/e1000e/ich8lan.c b/drivers/net/ethernet/intel/e1000e/ich8lan.c index dff7bff8b8e0..121a865c7fbd 100644 --- a/drivers/net/ethernet/intel/e1000e/ich8lan.c +++ b/drivers/net/ethernet/intel/e1000e/ich8lan.c | |||
@@ -782,6 +782,59 @@ release: | |||
782 | } | 782 | } |
783 | 783 | ||
784 | /** | 784 | /** |
785 | * e1000_k1_workaround_lpt_lp - K1 workaround on Lynxpoint-LP | ||
786 | * @hw: pointer to the HW structure | ||
787 | * @link: link up bool flag | ||
788 | * | ||
789 | * When K1 is enabled for 1Gbps, the MAC can miss 2 DMA completion indications | ||
790 | * preventing further DMA write requests. Workaround the issue by disabling | ||
791 | * the de-assertion of the clock request when in 1Gpbs mode. | ||
792 | **/ | ||
793 | static s32 e1000_k1_workaround_lpt_lp(struct e1000_hw *hw, bool link) | ||
794 | { | ||
795 | u32 fextnvm6 = er32(FEXTNVM6); | ||
796 | s32 ret_val = 0; | ||
797 | |||
798 | if (link && (er32(STATUS) & E1000_STATUS_SPEED_1000)) { | ||
799 | u16 kmrn_reg; | ||
800 | |||
801 | ret_val = hw->phy.ops.acquire(hw); | ||
802 | if (ret_val) | ||
803 | return ret_val; | ||
804 | |||
805 | ret_val = | ||
806 | e1000e_read_kmrn_reg_locked(hw, E1000_KMRNCTRLSTA_K1_CONFIG, | ||
807 | &kmrn_reg); | ||
808 | if (ret_val) | ||
809 | goto release; | ||
810 | |||
811 | ret_val = | ||
812 | e1000e_write_kmrn_reg_locked(hw, | ||
813 | E1000_KMRNCTRLSTA_K1_CONFIG, | ||
814 | kmrn_reg & | ||
815 | ~E1000_KMRNCTRLSTA_K1_ENABLE); | ||
816 | if (ret_val) | ||
817 | goto release; | ||
818 | |||
819 | usleep_range(10, 20); | ||
820 | |||
821 | ew32(FEXTNVM6, fextnvm6 | E1000_FEXTNVM6_REQ_PLL_CLK); | ||
822 | |||
823 | ret_val = | ||
824 | e1000e_write_kmrn_reg_locked(hw, | ||
825 | E1000_KMRNCTRLSTA_K1_CONFIG, | ||
826 | kmrn_reg); | ||
827 | release: | ||
828 | hw->phy.ops.release(hw); | ||
829 | } else { | ||
830 | /* clear FEXTNVM6 bit 8 on link down or 10/100 */ | ||
831 | ew32(FEXTNVM6, fextnvm6 & ~E1000_FEXTNVM6_REQ_PLL_CLK); | ||
832 | } | ||
833 | |||
834 | return ret_val; | ||
835 | } | ||
836 | |||
837 | /** | ||
785 | * e1000_check_for_copper_link_ich8lan - Check for link (Copper) | 838 | * e1000_check_for_copper_link_ich8lan - Check for link (Copper) |
786 | * @hw: pointer to the HW structure | 839 | * @hw: pointer to the HW structure |
787 | * | 840 | * |
@@ -818,6 +871,14 @@ static s32 e1000_check_for_copper_link_ich8lan(struct e1000_hw *hw) | |||
818 | return ret_val; | 871 | return ret_val; |
819 | } | 872 | } |
820 | 873 | ||
874 | /* Work-around I218 hang issue */ | ||
875 | if ((hw->adapter->pdev->device == E1000_DEV_ID_PCH_LPTLP_I218_LM) || | ||
876 | (hw->adapter->pdev->device == E1000_DEV_ID_PCH_LPTLP_I218_V)) { | ||
877 | ret_val = e1000_k1_workaround_lpt_lp(hw, link); | ||
878 | if (ret_val) | ||
879 | return ret_val; | ||
880 | } | ||
881 | |||
821 | /* Clear link partner's EEE ability */ | 882 | /* Clear link partner's EEE ability */ |
822 | hw->dev_spec.ich8lan.eee_lp_ability = 0; | 883 | hw->dev_spec.ich8lan.eee_lp_ability = 0; |
823 | 884 | ||
@@ -3954,8 +4015,16 @@ void e1000_suspend_workarounds_ich8lan(struct e1000_hw *hw) | |||
3954 | 4015 | ||
3955 | phy_ctrl = er32(PHY_CTRL); | 4016 | phy_ctrl = er32(PHY_CTRL); |
3956 | phy_ctrl |= E1000_PHY_CTRL_GBE_DISABLE; | 4017 | phy_ctrl |= E1000_PHY_CTRL_GBE_DISABLE; |
4018 | |||
3957 | if (hw->phy.type == e1000_phy_i217) { | 4019 | if (hw->phy.type == e1000_phy_i217) { |
3958 | u16 phy_reg; | 4020 | u16 phy_reg, device_id = hw->adapter->pdev->device; |
4021 | |||
4022 | if ((device_id == E1000_DEV_ID_PCH_LPTLP_I218_LM) || | ||
4023 | (device_id == E1000_DEV_ID_PCH_LPTLP_I218_V)) { | ||
4024 | u32 fextnvm6 = er32(FEXTNVM6); | ||
4025 | |||
4026 | ew32(FEXTNVM6, fextnvm6 & ~E1000_FEXTNVM6_REQ_PLL_CLK); | ||
4027 | } | ||
3959 | 4028 | ||
3960 | ret_val = hw->phy.ops.acquire(hw); | 4029 | ret_val = hw->phy.ops.acquire(hw); |
3961 | if (ret_val) | 4030 | if (ret_val) |
diff --git a/drivers/net/ethernet/intel/e1000e/ich8lan.h b/drivers/net/ethernet/intel/e1000e/ich8lan.h index b6d3174d7d2d..8bf4655c2e17 100644 --- a/drivers/net/ethernet/intel/e1000e/ich8lan.h +++ b/drivers/net/ethernet/intel/e1000e/ich8lan.h | |||
@@ -92,6 +92,8 @@ | |||
92 | #define E1000_FEXTNVM4_BEACON_DURATION_8USEC 0x7 | 92 | #define E1000_FEXTNVM4_BEACON_DURATION_8USEC 0x7 |
93 | #define E1000_FEXTNVM4_BEACON_DURATION_16USEC 0x3 | 93 | #define E1000_FEXTNVM4_BEACON_DURATION_16USEC 0x3 |
94 | 94 | ||
95 | #define E1000_FEXTNVM6_REQ_PLL_CLK 0x00000100 | ||
96 | |||
95 | #define PCIE_ICH8_SNOOP_ALL PCIE_NO_SNOOP_ALL | 97 | #define PCIE_ICH8_SNOOP_ALL PCIE_NO_SNOOP_ALL |
96 | 98 | ||
97 | #define E1000_ICH_RAR_ENTRIES 7 | 99 | #define E1000_ICH_RAR_ENTRIES 7 |
diff --git a/drivers/net/ethernet/intel/e1000e/netdev.c b/drivers/net/ethernet/intel/e1000e/netdev.c index a177b8b65c44..948b86ffa4f0 100644 --- a/drivers/net/ethernet/intel/e1000e/netdev.c +++ b/drivers/net/ethernet/intel/e1000e/netdev.c | |||
@@ -4303,6 +4303,7 @@ static int e1000_open(struct net_device *netdev) | |||
4303 | netif_start_queue(netdev); | 4303 | netif_start_queue(netdev); |
4304 | 4304 | ||
4305 | adapter->idle_check = true; | 4305 | adapter->idle_check = true; |
4306 | hw->mac.get_link_status = true; | ||
4306 | pm_runtime_put(&pdev->dev); | 4307 | pm_runtime_put(&pdev->dev); |
4307 | 4308 | ||
4308 | /* fire a link status change interrupt to start the watchdog */ | 4309 | /* fire a link status change interrupt to start the watchdog */ |
@@ -4662,6 +4663,7 @@ static void e1000_phy_read_status(struct e1000_adapter *adapter) | |||
4662 | (adapter->hw.phy.media_type == e1000_media_type_copper)) { | 4663 | (adapter->hw.phy.media_type == e1000_media_type_copper)) { |
4663 | int ret_val; | 4664 | int ret_val; |
4664 | 4665 | ||
4666 | pm_runtime_get_sync(&adapter->pdev->dev); | ||
4665 | ret_val = e1e_rphy(hw, MII_BMCR, &phy->bmcr); | 4667 | ret_val = e1e_rphy(hw, MII_BMCR, &phy->bmcr); |
4666 | ret_val |= e1e_rphy(hw, MII_BMSR, &phy->bmsr); | 4668 | ret_val |= e1e_rphy(hw, MII_BMSR, &phy->bmsr); |
4667 | ret_val |= e1e_rphy(hw, MII_ADVERTISE, &phy->advertise); | 4669 | ret_val |= e1e_rphy(hw, MII_ADVERTISE, &phy->advertise); |
@@ -4672,6 +4674,7 @@ static void e1000_phy_read_status(struct e1000_adapter *adapter) | |||
4672 | ret_val |= e1e_rphy(hw, MII_ESTATUS, &phy->estatus); | 4674 | ret_val |= e1e_rphy(hw, MII_ESTATUS, &phy->estatus); |
4673 | if (ret_val) | 4675 | if (ret_val) |
4674 | e_warn("Error reading PHY register\n"); | 4676 | e_warn("Error reading PHY register\n"); |
4677 | pm_runtime_put_sync(&adapter->pdev->dev); | ||
4675 | } else { | 4678 | } else { |
4676 | /* Do not read PHY registers if link is not up | 4679 | /* Do not read PHY registers if link is not up |
4677 | * Set values to typical power-on defaults | 4680 | * Set values to typical power-on defaults |
@@ -5887,8 +5890,7 @@ release: | |||
5887 | return retval; | 5890 | return retval; |
5888 | } | 5891 | } |
5889 | 5892 | ||
5890 | static int __e1000_shutdown(struct pci_dev *pdev, bool *enable_wake, | 5893 | static int __e1000_shutdown(struct pci_dev *pdev, bool runtime) |
5891 | bool runtime) | ||
5892 | { | 5894 | { |
5893 | struct net_device *netdev = pci_get_drvdata(pdev); | 5895 | struct net_device *netdev = pci_get_drvdata(pdev); |
5894 | struct e1000_adapter *adapter = netdev_priv(netdev); | 5896 | struct e1000_adapter *adapter = netdev_priv(netdev); |
@@ -5912,10 +5914,6 @@ static int __e1000_shutdown(struct pci_dev *pdev, bool *enable_wake, | |||
5912 | } | 5914 | } |
5913 | e1000e_reset_interrupt_capability(adapter); | 5915 | e1000e_reset_interrupt_capability(adapter); |
5914 | 5916 | ||
5915 | retval = pci_save_state(pdev); | ||
5916 | if (retval) | ||
5917 | return retval; | ||
5918 | |||
5919 | status = er32(STATUS); | 5917 | status = er32(STATUS); |
5920 | if (status & E1000_STATUS_LU) | 5918 | if (status & E1000_STATUS_LU) |
5921 | wufc &= ~E1000_WUFC_LNKC; | 5919 | wufc &= ~E1000_WUFC_LNKC; |
@@ -5971,13 +5969,6 @@ static int __e1000_shutdown(struct pci_dev *pdev, bool *enable_wake, | |||
5971 | ew32(WUFC, 0); | 5969 | ew32(WUFC, 0); |
5972 | } | 5970 | } |
5973 | 5971 | ||
5974 | *enable_wake = !!wufc; | ||
5975 | |||
5976 | /* make sure adapter isn't asleep if manageability is enabled */ | ||
5977 | if ((adapter->flags & FLAG_MNG_PT_ENABLED) || | ||
5978 | (hw->mac.ops.check_mng_mode(hw))) | ||
5979 | *enable_wake = true; | ||
5980 | |||
5981 | if (adapter->hw.phy.type == e1000_phy_igp_3) | 5972 | if (adapter->hw.phy.type == e1000_phy_igp_3) |
5982 | e1000e_igp3_phy_powerdown_workaround_ich8lan(&adapter->hw); | 5973 | e1000e_igp3_phy_powerdown_workaround_ich8lan(&adapter->hw); |
5983 | 5974 | ||
@@ -5986,27 +5977,7 @@ static int __e1000_shutdown(struct pci_dev *pdev, bool *enable_wake, | |||
5986 | */ | 5977 | */ |
5987 | e1000e_release_hw_control(adapter); | 5978 | e1000e_release_hw_control(adapter); |
5988 | 5979 | ||
5989 | pci_disable_device(pdev); | 5980 | pci_clear_master(pdev); |
5990 | |||
5991 | return 0; | ||
5992 | } | ||
5993 | |||
5994 | static void e1000_power_off(struct pci_dev *pdev, bool sleep, bool wake) | ||
5995 | { | ||
5996 | if (sleep && wake) { | ||
5997 | pci_prepare_to_sleep(pdev); | ||
5998 | return; | ||
5999 | } | ||
6000 | |||
6001 | pci_wake_from_d3(pdev, wake); | ||
6002 | pci_set_power_state(pdev, PCI_D3hot); | ||
6003 | } | ||
6004 | |||
6005 | static void e1000_complete_shutdown(struct pci_dev *pdev, bool sleep, | ||
6006 | bool wake) | ||
6007 | { | ||
6008 | struct net_device *netdev = pci_get_drvdata(pdev); | ||
6009 | struct e1000_adapter *adapter = netdev_priv(netdev); | ||
6010 | 5981 | ||
6011 | /* The pci-e switch on some quad port adapters will report a | 5982 | /* The pci-e switch on some quad port adapters will report a |
6012 | * correctable error when the MAC transitions from D0 to D3. To | 5983 | * correctable error when the MAC transitions from D0 to D3. To |
@@ -6021,12 +5992,13 @@ static void e1000_complete_shutdown(struct pci_dev *pdev, bool sleep, | |||
6021 | pcie_capability_write_word(us_dev, PCI_EXP_DEVCTL, | 5992 | pcie_capability_write_word(us_dev, PCI_EXP_DEVCTL, |
6022 | (devctl & ~PCI_EXP_DEVCTL_CERE)); | 5993 | (devctl & ~PCI_EXP_DEVCTL_CERE)); |
6023 | 5994 | ||
6024 | e1000_power_off(pdev, sleep, wake); | 5995 | pci_save_state(pdev); |
5996 | pci_prepare_to_sleep(pdev); | ||
6025 | 5997 | ||
6026 | pcie_capability_write_word(us_dev, PCI_EXP_DEVCTL, devctl); | 5998 | pcie_capability_write_word(us_dev, PCI_EXP_DEVCTL, devctl); |
6027 | } else { | ||
6028 | e1000_power_off(pdev, sleep, wake); | ||
6029 | } | 5999 | } |
6000 | |||
6001 | return 0; | ||
6030 | } | 6002 | } |
6031 | 6003 | ||
6032 | #ifdef CONFIG_PCIEASPM | 6004 | #ifdef CONFIG_PCIEASPM |
@@ -6084,9 +6056,7 @@ static int __e1000_resume(struct pci_dev *pdev) | |||
6084 | if (aspm_disable_flag) | 6056 | if (aspm_disable_flag) |
6085 | e1000e_disable_aspm(pdev, aspm_disable_flag); | 6057 | e1000e_disable_aspm(pdev, aspm_disable_flag); |
6086 | 6058 | ||
6087 | pci_set_power_state(pdev, PCI_D0); | 6059 | pci_set_master(pdev); |
6088 | pci_restore_state(pdev); | ||
6089 | pci_save_state(pdev); | ||
6090 | 6060 | ||
6091 | e1000e_set_interrupt_capability(adapter); | 6061 | e1000e_set_interrupt_capability(adapter); |
6092 | if (netif_running(netdev)) { | 6062 | if (netif_running(netdev)) { |
@@ -6152,14 +6122,8 @@ static int __e1000_resume(struct pci_dev *pdev) | |||
6152 | static int e1000_suspend(struct device *dev) | 6122 | static int e1000_suspend(struct device *dev) |
6153 | { | 6123 | { |
6154 | struct pci_dev *pdev = to_pci_dev(dev); | 6124 | struct pci_dev *pdev = to_pci_dev(dev); |
6155 | int retval; | ||
6156 | bool wake; | ||
6157 | |||
6158 | retval = __e1000_shutdown(pdev, &wake, false); | ||
6159 | if (!retval) | ||
6160 | e1000_complete_shutdown(pdev, true, wake); | ||
6161 | 6125 | ||
6162 | return retval; | 6126 | return __e1000_shutdown(pdev, false); |
6163 | } | 6127 | } |
6164 | 6128 | ||
6165 | static int e1000_resume(struct device *dev) | 6129 | static int e1000_resume(struct device *dev) |
@@ -6182,13 +6146,10 @@ static int e1000_runtime_suspend(struct device *dev) | |||
6182 | struct net_device *netdev = pci_get_drvdata(pdev); | 6146 | struct net_device *netdev = pci_get_drvdata(pdev); |
6183 | struct e1000_adapter *adapter = netdev_priv(netdev); | 6147 | struct e1000_adapter *adapter = netdev_priv(netdev); |
6184 | 6148 | ||
6185 | if (e1000e_pm_ready(adapter)) { | 6149 | if (!e1000e_pm_ready(adapter)) |
6186 | bool wake; | 6150 | return 0; |
6187 | |||
6188 | __e1000_shutdown(pdev, &wake, true); | ||
6189 | } | ||
6190 | 6151 | ||
6191 | return 0; | 6152 | return __e1000_shutdown(pdev, true); |
6192 | } | 6153 | } |
6193 | 6154 | ||
6194 | static int e1000_idle(struct device *dev) | 6155 | static int e1000_idle(struct device *dev) |
@@ -6226,12 +6187,7 @@ static int e1000_runtime_resume(struct device *dev) | |||
6226 | 6187 | ||
6227 | static void e1000_shutdown(struct pci_dev *pdev) | 6188 | static void e1000_shutdown(struct pci_dev *pdev) |
6228 | { | 6189 | { |
6229 | bool wake = false; | 6190 | __e1000_shutdown(pdev, false); |
6230 | |||
6231 | __e1000_shutdown(pdev, &wake, false); | ||
6232 | |||
6233 | if (system_state == SYSTEM_POWER_OFF) | ||
6234 | e1000_complete_shutdown(pdev, false, wake); | ||
6235 | } | 6191 | } |
6236 | 6192 | ||
6237 | #ifdef CONFIG_NET_POLL_CONTROLLER | 6193 | #ifdef CONFIG_NET_POLL_CONTROLLER |
@@ -6352,9 +6308,9 @@ static pci_ers_result_t e1000_io_slot_reset(struct pci_dev *pdev) | |||
6352 | "Cannot re-enable PCI device after reset.\n"); | 6308 | "Cannot re-enable PCI device after reset.\n"); |
6353 | result = PCI_ERS_RESULT_DISCONNECT; | 6309 | result = PCI_ERS_RESULT_DISCONNECT; |
6354 | } else { | 6310 | } else { |
6355 | pci_set_master(pdev); | ||
6356 | pdev->state_saved = true; | 6311 | pdev->state_saved = true; |
6357 | pci_restore_state(pdev); | 6312 | pci_restore_state(pdev); |
6313 | pci_set_master(pdev); | ||
6358 | 6314 | ||
6359 | pci_enable_wake(pdev, PCI_D3hot, 0); | 6315 | pci_enable_wake(pdev, PCI_D3hot, 0); |
6360 | pci_enable_wake(pdev, PCI_D3cold, 0); | 6316 | pci_enable_wake(pdev, PCI_D3cold, 0); |
@@ -6783,7 +6739,11 @@ static int e1000_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
6783 | 6739 | ||
6784 | /* initialize the wol settings based on the eeprom settings */ | 6740 | /* initialize the wol settings based on the eeprom settings */ |
6785 | adapter->wol = adapter->eeprom_wol; | 6741 | adapter->wol = adapter->eeprom_wol; |
6786 | device_set_wakeup_enable(&adapter->pdev->dev, adapter->wol); | 6742 | |
6743 | /* make sure adapter isn't asleep if manageability is enabled */ | ||
6744 | if (adapter->wol || (adapter->flags & FLAG_MNG_PT_ENABLED) || | ||
6745 | (hw->mac.ops.check_mng_mode(hw))) | ||
6746 | device_wakeup_enable(&pdev->dev); | ||
6787 | 6747 | ||
6788 | /* save off EEPROM version number */ | 6748 | /* save off EEPROM version number */ |
6789 | e1000_read_nvm(&adapter->hw, 5, 1, &adapter->eeprom_vers); | 6749 | e1000_read_nvm(&adapter->hw, 5, 1, &adapter->eeprom_vers); |
diff --git a/drivers/net/ethernet/intel/e1000e/regs.h b/drivers/net/ethernet/intel/e1000e/regs.h index 794fe1497666..a7e6a3e37257 100644 --- a/drivers/net/ethernet/intel/e1000e/regs.h +++ b/drivers/net/ethernet/intel/e1000e/regs.h | |||
@@ -42,6 +42,7 @@ | |||
42 | #define E1000_FEXTNVM 0x00028 /* Future Extended NVM - RW */ | 42 | #define E1000_FEXTNVM 0x00028 /* Future Extended NVM - RW */ |
43 | #define E1000_FEXTNVM3 0x0003C /* Future Extended NVM 3 - RW */ | 43 | #define E1000_FEXTNVM3 0x0003C /* Future Extended NVM 3 - RW */ |
44 | #define E1000_FEXTNVM4 0x00024 /* Future Extended NVM 4 - RW */ | 44 | #define E1000_FEXTNVM4 0x00024 /* Future Extended NVM 4 - RW */ |
45 | #define E1000_FEXTNVM6 0x00010 /* Future Extended NVM 6 - RW */ | ||
45 | #define E1000_FEXTNVM7 0x000E4 /* Future Extended NVM 7 - RW */ | 46 | #define E1000_FEXTNVM7 0x000E4 /* Future Extended NVM 7 - RW */ |
46 | #define E1000_FCT 0x00030 /* Flow Control Type - RW */ | 47 | #define E1000_FCT 0x00030 /* Flow Control Type - RW */ |
47 | #define E1000_VET 0x00038 /* VLAN Ether Type - RW */ | 48 | #define E1000_VET 0x00038 /* VLAN Ether Type - RW */ |
diff --git a/drivers/net/ethernet/intel/igb/e1000_82575.c b/drivers/net/ethernet/intel/igb/e1000_82575.c index 84e7e0909def..b64542acfa34 100644 --- a/drivers/net/ethernet/intel/igb/e1000_82575.c +++ b/drivers/net/ethernet/intel/igb/e1000_82575.c | |||
@@ -1361,11 +1361,16 @@ static s32 igb_setup_copper_link_82575(struct e1000_hw *hw) | |||
1361 | switch (hw->phy.type) { | 1361 | switch (hw->phy.type) { |
1362 | case e1000_phy_i210: | 1362 | case e1000_phy_i210: |
1363 | case e1000_phy_m88: | 1363 | case e1000_phy_m88: |
1364 | if (hw->phy.id == I347AT4_E_PHY_ID || | 1364 | switch (hw->phy.id) { |
1365 | hw->phy.id == M88E1112_E_PHY_ID) | 1365 | case I347AT4_E_PHY_ID: |
1366 | case M88E1112_E_PHY_ID: | ||
1367 | case I210_I_PHY_ID: | ||
1366 | ret_val = igb_copper_link_setup_m88_gen2(hw); | 1368 | ret_val = igb_copper_link_setup_m88_gen2(hw); |
1367 | else | 1369 | break; |
1370 | default: | ||
1368 | ret_val = igb_copper_link_setup_m88(hw); | 1371 | ret_val = igb_copper_link_setup_m88(hw); |
1372 | break; | ||
1373 | } | ||
1369 | break; | 1374 | break; |
1370 | case e1000_phy_igp_3: | 1375 | case e1000_phy_igp_3: |
1371 | ret_val = igb_copper_link_setup_igp(hw); | 1376 | ret_val = igb_copper_link_setup_igp(hw); |
diff --git a/drivers/net/ethernet/intel/igb/igb.h b/drivers/net/ethernet/intel/igb/igb.h index d27edbc63923..25151401c2ab 100644 --- a/drivers/net/ethernet/intel/igb/igb.h +++ b/drivers/net/ethernet/intel/igb/igb.h | |||
@@ -447,7 +447,7 @@ struct igb_adapter { | |||
447 | #endif | 447 | #endif |
448 | struct i2c_algo_bit_data i2c_algo; | 448 | struct i2c_algo_bit_data i2c_algo; |
449 | struct i2c_adapter i2c_adap; | 449 | struct i2c_adapter i2c_adap; |
450 | struct igb_i2c_client_list *i2c_clients; | 450 | struct i2c_client *i2c_client; |
451 | }; | 451 | }; |
452 | 452 | ||
453 | #define IGB_FLAG_HAS_MSI (1 << 0) | 453 | #define IGB_FLAG_HAS_MSI (1 << 0) |
diff --git a/drivers/net/ethernet/intel/igb/igb_hwmon.c b/drivers/net/ethernet/intel/igb/igb_hwmon.c index 0a9b073d0b03..4623502054d5 100644 --- a/drivers/net/ethernet/intel/igb/igb_hwmon.c +++ b/drivers/net/ethernet/intel/igb/igb_hwmon.c | |||
@@ -39,6 +39,10 @@ | |||
39 | #include <linux/pci.h> | 39 | #include <linux/pci.h> |
40 | 40 | ||
41 | #ifdef CONFIG_IGB_HWMON | 41 | #ifdef CONFIG_IGB_HWMON |
42 | struct i2c_board_info i350_sensor_info = { | ||
43 | I2C_BOARD_INFO("i350bb", (0Xf8 >> 1)), | ||
44 | }; | ||
45 | |||
42 | /* hwmon callback functions */ | 46 | /* hwmon callback functions */ |
43 | static ssize_t igb_hwmon_show_location(struct device *dev, | 47 | static ssize_t igb_hwmon_show_location(struct device *dev, |
44 | struct device_attribute *attr, | 48 | struct device_attribute *attr, |
@@ -188,6 +192,7 @@ int igb_sysfs_init(struct igb_adapter *adapter) | |||
188 | unsigned int i; | 192 | unsigned int i; |
189 | int n_attrs; | 193 | int n_attrs; |
190 | int rc = 0; | 194 | int rc = 0; |
195 | struct i2c_client *client = NULL; | ||
191 | 196 | ||
192 | /* If this method isn't defined we don't support thermals */ | 197 | /* If this method isn't defined we don't support thermals */ |
193 | if (adapter->hw.mac.ops.init_thermal_sensor_thresh == NULL) | 198 | if (adapter->hw.mac.ops.init_thermal_sensor_thresh == NULL) |
@@ -198,6 +203,15 @@ int igb_sysfs_init(struct igb_adapter *adapter) | |||
198 | if (rc) | 203 | if (rc) |
199 | goto exit; | 204 | goto exit; |
200 | 205 | ||
206 | /* init i2c_client */ | ||
207 | client = i2c_new_device(&adapter->i2c_adap, &i350_sensor_info); | ||
208 | if (client == NULL) { | ||
209 | dev_info(&adapter->pdev->dev, | ||
210 | "Failed to create new i2c device..\n"); | ||
211 | goto exit; | ||
212 | } | ||
213 | adapter->i2c_client = client; | ||
214 | |||
201 | /* Allocation space for max attributes | 215 | /* Allocation space for max attributes |
202 | * max num sensors * values (loc, temp, max, caution) | 216 | * max num sensors * values (loc, temp, max, caution) |
203 | */ | 217 | */ |
diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c index ed79a1c53b59..4dbd62968c7a 100644 --- a/drivers/net/ethernet/intel/igb/igb_main.c +++ b/drivers/net/ethernet/intel/igb/igb_main.c | |||
@@ -1923,10 +1923,6 @@ void igb_set_fw_version(struct igb_adapter *adapter) | |||
1923 | return; | 1923 | return; |
1924 | } | 1924 | } |
1925 | 1925 | ||
1926 | static const struct i2c_board_info i350_sensor_info = { | ||
1927 | I2C_BOARD_INFO("i350bb", 0Xf8), | ||
1928 | }; | ||
1929 | |||
1930 | /* igb_init_i2c - Init I2C interface | 1926 | /* igb_init_i2c - Init I2C interface |
1931 | * @adapter: pointer to adapter structure | 1927 | * @adapter: pointer to adapter structure |
1932 | * | 1928 | * |
@@ -6227,13 +6223,6 @@ static struct sk_buff *igb_build_rx_buffer(struct igb_ring *rx_ring, | |||
6227 | /* If we spanned a buffer we have a huge mess so test for it */ | 6223 | /* If we spanned a buffer we have a huge mess so test for it */ |
6228 | BUG_ON(unlikely(!igb_test_staterr(rx_desc, E1000_RXD_STAT_EOP))); | 6224 | BUG_ON(unlikely(!igb_test_staterr(rx_desc, E1000_RXD_STAT_EOP))); |
6229 | 6225 | ||
6230 | /* Guarantee this function can be used by verifying buffer sizes */ | ||
6231 | BUILD_BUG_ON(SKB_WITH_OVERHEAD(IGB_RX_BUFSZ) < (NET_SKB_PAD + | ||
6232 | NET_IP_ALIGN + | ||
6233 | IGB_TS_HDR_LEN + | ||
6234 | ETH_FRAME_LEN + | ||
6235 | ETH_FCS_LEN)); | ||
6236 | |||
6237 | rx_buffer = &rx_ring->rx_buffer_info[rx_ring->next_to_clean]; | 6226 | rx_buffer = &rx_ring->rx_buffer_info[rx_ring->next_to_clean]; |
6238 | page = rx_buffer->page; | 6227 | page = rx_buffer->page; |
6239 | prefetchw(page); | 6228 | prefetchw(page); |
@@ -7724,67 +7713,6 @@ static void igb_init_dmac(struct igb_adapter *adapter, u32 pba) | |||
7724 | } | 7713 | } |
7725 | } | 7714 | } |
7726 | 7715 | ||
7727 | static DEFINE_SPINLOCK(i2c_clients_lock); | ||
7728 | |||
7729 | /* igb_get_i2c_client - returns matching client | ||
7730 | * in adapters's client list. | ||
7731 | * @adapter: adapter struct | ||
7732 | * @dev_addr: device address of i2c needed. | ||
7733 | */ | ||
7734 | static struct i2c_client * | ||
7735 | igb_get_i2c_client(struct igb_adapter *adapter, u8 dev_addr) | ||
7736 | { | ||
7737 | ulong flags; | ||
7738 | struct igb_i2c_client_list *client_list; | ||
7739 | struct i2c_client *client = NULL; | ||
7740 | struct i2c_board_info client_info = { | ||
7741 | I2C_BOARD_INFO("igb", 0x00), | ||
7742 | }; | ||
7743 | |||
7744 | spin_lock_irqsave(&i2c_clients_lock, flags); | ||
7745 | client_list = adapter->i2c_clients; | ||
7746 | |||
7747 | /* See if we already have an i2c_client */ | ||
7748 | while (client_list) { | ||
7749 | if (client_list->client->addr == (dev_addr >> 1)) { | ||
7750 | client = client_list->client; | ||
7751 | goto exit; | ||
7752 | } else { | ||
7753 | client_list = client_list->next; | ||
7754 | } | ||
7755 | } | ||
7756 | |||
7757 | /* no client_list found, create a new one */ | ||
7758 | client_list = kzalloc(sizeof(*client_list), GFP_ATOMIC); | ||
7759 | if (client_list == NULL) | ||
7760 | goto exit; | ||
7761 | |||
7762 | /* dev_addr passed to us is left-shifted by 1 bit | ||
7763 | * i2c_new_device call expects it to be flush to the right. | ||
7764 | */ | ||
7765 | client_info.addr = dev_addr >> 1; | ||
7766 | client_info.platform_data = adapter; | ||
7767 | client_list->client = i2c_new_device(&adapter->i2c_adap, &client_info); | ||
7768 | if (client_list->client == NULL) { | ||
7769 | dev_info(&adapter->pdev->dev, | ||
7770 | "Failed to create new i2c device..\n"); | ||
7771 | goto err_no_client; | ||
7772 | } | ||
7773 | |||
7774 | /* insert new client at head of list */ | ||
7775 | client_list->next = adapter->i2c_clients; | ||
7776 | adapter->i2c_clients = client_list; | ||
7777 | |||
7778 | client = client_list->client; | ||
7779 | goto exit; | ||
7780 | |||
7781 | err_no_client: | ||
7782 | kfree(client_list); | ||
7783 | exit: | ||
7784 | spin_unlock_irqrestore(&i2c_clients_lock, flags); | ||
7785 | return client; | ||
7786 | } | ||
7787 | |||
7788 | /* igb_read_i2c_byte - Reads 8 bit word over I2C | 7716 | /* igb_read_i2c_byte - Reads 8 bit word over I2C |
7789 | * @hw: pointer to hardware structure | 7717 | * @hw: pointer to hardware structure |
7790 | * @byte_offset: byte offset to read | 7718 | * @byte_offset: byte offset to read |
@@ -7798,7 +7726,7 @@ s32 igb_read_i2c_byte(struct e1000_hw *hw, u8 byte_offset, | |||
7798 | u8 dev_addr, u8 *data) | 7726 | u8 dev_addr, u8 *data) |
7799 | { | 7727 | { |
7800 | struct igb_adapter *adapter = container_of(hw, struct igb_adapter, hw); | 7728 | struct igb_adapter *adapter = container_of(hw, struct igb_adapter, hw); |
7801 | struct i2c_client *this_client = igb_get_i2c_client(adapter, dev_addr); | 7729 | struct i2c_client *this_client = adapter->i2c_client; |
7802 | s32 status; | 7730 | s32 status; |
7803 | u16 swfw_mask = 0; | 7731 | u16 swfw_mask = 0; |
7804 | 7732 | ||
@@ -7835,7 +7763,7 @@ s32 igb_write_i2c_byte(struct e1000_hw *hw, u8 byte_offset, | |||
7835 | u8 dev_addr, u8 data) | 7763 | u8 dev_addr, u8 data) |
7836 | { | 7764 | { |
7837 | struct igb_adapter *adapter = container_of(hw, struct igb_adapter, hw); | 7765 | struct igb_adapter *adapter = container_of(hw, struct igb_adapter, hw); |
7838 | struct i2c_client *this_client = igb_get_i2c_client(adapter, dev_addr); | 7766 | struct i2c_client *this_client = adapter->i2c_client; |
7839 | s32 status; | 7767 | s32 status; |
7840 | u16 swfw_mask = E1000_SWFW_PHY0_SM; | 7768 | u16 swfw_mask = E1000_SWFW_PHY0_SM; |
7841 | 7769 | ||
diff --git a/drivers/net/ethernet/marvell/mv643xx_eth.c b/drivers/net/ethernet/marvell/mv643xx_eth.c index 29140502b71a..6562c736a1d8 100644 --- a/drivers/net/ethernet/marvell/mv643xx_eth.c +++ b/drivers/net/ethernet/marvell/mv643xx_eth.c | |||
@@ -1081,6 +1081,45 @@ static void txq_set_fixed_prio_mode(struct tx_queue *txq) | |||
1081 | 1081 | ||
1082 | 1082 | ||
1083 | /* mii management interface *************************************************/ | 1083 | /* mii management interface *************************************************/ |
1084 | static void mv643xx_adjust_pscr(struct mv643xx_eth_private *mp) | ||
1085 | { | ||
1086 | u32 pscr = rdlp(mp, PORT_SERIAL_CONTROL); | ||
1087 | u32 autoneg_disable = FORCE_LINK_PASS | | ||
1088 | DISABLE_AUTO_NEG_SPEED_GMII | | ||
1089 | DISABLE_AUTO_NEG_FOR_FLOW_CTRL | | ||
1090 | DISABLE_AUTO_NEG_FOR_DUPLEX; | ||
1091 | |||
1092 | if (mp->phy->autoneg == AUTONEG_ENABLE) { | ||
1093 | /* enable auto negotiation */ | ||
1094 | pscr &= ~autoneg_disable; | ||
1095 | goto out_write; | ||
1096 | } | ||
1097 | |||
1098 | pscr |= autoneg_disable; | ||
1099 | |||
1100 | if (mp->phy->speed == SPEED_1000) { | ||
1101 | /* force gigabit, half duplex not supported */ | ||
1102 | pscr |= SET_GMII_SPEED_TO_1000; | ||
1103 | pscr |= SET_FULL_DUPLEX_MODE; | ||
1104 | goto out_write; | ||
1105 | } | ||
1106 | |||
1107 | pscr &= ~SET_GMII_SPEED_TO_1000; | ||
1108 | |||
1109 | if (mp->phy->speed == SPEED_100) | ||
1110 | pscr |= SET_MII_SPEED_TO_100; | ||
1111 | else | ||
1112 | pscr &= ~SET_MII_SPEED_TO_100; | ||
1113 | |||
1114 | if (mp->phy->duplex == DUPLEX_FULL) | ||
1115 | pscr |= SET_FULL_DUPLEX_MODE; | ||
1116 | else | ||
1117 | pscr &= ~SET_FULL_DUPLEX_MODE; | ||
1118 | |||
1119 | out_write: | ||
1120 | wrlp(mp, PORT_SERIAL_CONTROL, pscr); | ||
1121 | } | ||
1122 | |||
1084 | static irqreturn_t mv643xx_eth_err_irq(int irq, void *dev_id) | 1123 | static irqreturn_t mv643xx_eth_err_irq(int irq, void *dev_id) |
1085 | { | 1124 | { |
1086 | struct mv643xx_eth_shared_private *msp = dev_id; | 1125 | struct mv643xx_eth_shared_private *msp = dev_id; |
@@ -1499,6 +1538,7 @@ static int | |||
1499 | mv643xx_eth_set_settings(struct net_device *dev, struct ethtool_cmd *cmd) | 1538 | mv643xx_eth_set_settings(struct net_device *dev, struct ethtool_cmd *cmd) |
1500 | { | 1539 | { |
1501 | struct mv643xx_eth_private *mp = netdev_priv(dev); | 1540 | struct mv643xx_eth_private *mp = netdev_priv(dev); |
1541 | int ret; | ||
1502 | 1542 | ||
1503 | if (mp->phy == NULL) | 1543 | if (mp->phy == NULL) |
1504 | return -EINVAL; | 1544 | return -EINVAL; |
@@ -1508,7 +1548,10 @@ mv643xx_eth_set_settings(struct net_device *dev, struct ethtool_cmd *cmd) | |||
1508 | */ | 1548 | */ |
1509 | cmd->advertising &= ~ADVERTISED_1000baseT_Half; | 1549 | cmd->advertising &= ~ADVERTISED_1000baseT_Half; |
1510 | 1550 | ||
1511 | return phy_ethtool_sset(mp->phy, cmd); | 1551 | ret = phy_ethtool_sset(mp->phy, cmd); |
1552 | if (!ret) | ||
1553 | mv643xx_adjust_pscr(mp); | ||
1554 | return ret; | ||
1512 | } | 1555 | } |
1513 | 1556 | ||
1514 | static void mv643xx_eth_get_drvinfo(struct net_device *dev, | 1557 | static void mv643xx_eth_get_drvinfo(struct net_device *dev, |
@@ -2442,11 +2485,15 @@ static int mv643xx_eth_stop(struct net_device *dev) | |||
2442 | static int mv643xx_eth_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) | 2485 | static int mv643xx_eth_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) |
2443 | { | 2486 | { |
2444 | struct mv643xx_eth_private *mp = netdev_priv(dev); | 2487 | struct mv643xx_eth_private *mp = netdev_priv(dev); |
2488 | int ret; | ||
2445 | 2489 | ||
2446 | if (mp->phy != NULL) | 2490 | if (mp->phy == NULL) |
2447 | return phy_mii_ioctl(mp->phy, ifr, cmd); | 2491 | return -ENOTSUPP; |
2448 | 2492 | ||
2449 | return -EOPNOTSUPP; | 2493 | ret = phy_mii_ioctl(mp->phy, ifr, cmd); |
2494 | if (!ret) | ||
2495 | mv643xx_adjust_pscr(mp); | ||
2496 | return ret; | ||
2450 | } | 2497 | } |
2451 | 2498 | ||
2452 | static int mv643xx_eth_change_mtu(struct net_device *dev, int new_mtu) | 2499 | static int mv643xx_eth_change_mtu(struct net_device *dev, int new_mtu) |
diff --git a/drivers/net/ethernet/mellanox/mlx4/cq.c b/drivers/net/ethernet/mellanox/mlx4/cq.c index 7e64033d7de3..0706623cfb96 100644 --- a/drivers/net/ethernet/mellanox/mlx4/cq.c +++ b/drivers/net/ethernet/mellanox/mlx4/cq.c | |||
@@ -226,7 +226,7 @@ void __mlx4_cq_free_icm(struct mlx4_dev *dev, int cqn) | |||
226 | 226 | ||
227 | static void mlx4_cq_free_icm(struct mlx4_dev *dev, int cqn) | 227 | static void mlx4_cq_free_icm(struct mlx4_dev *dev, int cqn) |
228 | { | 228 | { |
229 | u64 in_param; | 229 | u64 in_param = 0; |
230 | int err; | 230 | int err; |
231 | 231 | ||
232 | if (mlx4_is_mfunc(dev)) { | 232 | if (mlx4_is_mfunc(dev)) { |
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c index bb4d8d99f36d..995d4b6d5c1e 100644 --- a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c +++ b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c | |||
@@ -565,34 +565,38 @@ static void mlx4_en_put_qp(struct mlx4_en_priv *priv) | |||
565 | struct mlx4_en_dev *mdev = priv->mdev; | 565 | struct mlx4_en_dev *mdev = priv->mdev; |
566 | struct mlx4_dev *dev = mdev->dev; | 566 | struct mlx4_dev *dev = mdev->dev; |
567 | int qpn = priv->base_qpn; | 567 | int qpn = priv->base_qpn; |
568 | u64 mac = mlx4_en_mac_to_u64(priv->dev->dev_addr); | 568 | u64 mac; |
569 | |||
570 | en_dbg(DRV, priv, "Registering MAC: %pM for deleting\n", | ||
571 | priv->dev->dev_addr); | ||
572 | mlx4_unregister_mac(dev, priv->port, mac); | ||
573 | 569 | ||
574 | if (dev->caps.steering_mode != MLX4_STEERING_MODE_A0) { | 570 | if (dev->caps.steering_mode == MLX4_STEERING_MODE_A0) { |
571 | mac = mlx4_en_mac_to_u64(priv->dev->dev_addr); | ||
572 | en_dbg(DRV, priv, "Registering MAC: %pM for deleting\n", | ||
573 | priv->dev->dev_addr); | ||
574 | mlx4_unregister_mac(dev, priv->port, mac); | ||
575 | } else { | ||
575 | struct mlx4_mac_entry *entry; | 576 | struct mlx4_mac_entry *entry; |
576 | struct hlist_node *tmp; | 577 | struct hlist_node *tmp; |
577 | struct hlist_head *bucket; | 578 | struct hlist_head *bucket; |
578 | unsigned int mac_hash; | 579 | unsigned int i; |
579 | 580 | ||
580 | mac_hash = priv->dev->dev_addr[MLX4_EN_MAC_HASH_IDX]; | 581 | for (i = 0; i < MLX4_EN_MAC_HASH_SIZE; ++i) { |
581 | bucket = &priv->mac_hash[mac_hash]; | 582 | bucket = &priv->mac_hash[i]; |
582 | hlist_for_each_entry_safe(entry, tmp, bucket, hlist) { | 583 | hlist_for_each_entry_safe(entry, tmp, bucket, hlist) { |
583 | if (ether_addr_equal_64bits(entry->mac, | 584 | mac = mlx4_en_mac_to_u64(entry->mac); |
584 | priv->dev->dev_addr)) { | 585 | en_dbg(DRV, priv, "Registering MAC: %pM for deleting\n", |
585 | en_dbg(DRV, priv, "Releasing qp: port %d, MAC %pM, qpn %d\n", | 586 | entry->mac); |
586 | priv->port, priv->dev->dev_addr, qpn); | ||
587 | mlx4_en_uc_steer_release(priv, entry->mac, | 587 | mlx4_en_uc_steer_release(priv, entry->mac, |
588 | qpn, entry->reg_id); | 588 | qpn, entry->reg_id); |
589 | mlx4_qp_release_range(dev, qpn, 1); | ||
590 | 589 | ||
590 | mlx4_unregister_mac(dev, priv->port, mac); | ||
591 | hlist_del_rcu(&entry->hlist); | 591 | hlist_del_rcu(&entry->hlist); |
592 | kfree_rcu(entry, rcu); | 592 | kfree_rcu(entry, rcu); |
593 | break; | ||
594 | } | 593 | } |
595 | } | 594 | } |
595 | |||
596 | en_dbg(DRV, priv, "Releasing qp: port %d, qpn %d\n", | ||
597 | priv->port, qpn); | ||
598 | mlx4_qp_release_range(dev, qpn, 1); | ||
599 | priv->flags &= ~MLX4_EN_FLAG_FORCE_PROMISC; | ||
596 | } | 600 | } |
597 | } | 601 | } |
598 | 602 | ||
@@ -650,28 +654,10 @@ u64 mlx4_en_mac_to_u64(u8 *addr) | |||
650 | return mac; | 654 | return mac; |
651 | } | 655 | } |
652 | 656 | ||
653 | static int mlx4_en_set_mac(struct net_device *dev, void *addr) | 657 | static int mlx4_en_do_set_mac(struct mlx4_en_priv *priv) |
654 | { | ||
655 | struct mlx4_en_priv *priv = netdev_priv(dev); | ||
656 | struct mlx4_en_dev *mdev = priv->mdev; | ||
657 | struct sockaddr *saddr = addr; | ||
658 | |||
659 | if (!is_valid_ether_addr(saddr->sa_data)) | ||
660 | return -EADDRNOTAVAIL; | ||
661 | |||
662 | memcpy(dev->dev_addr, saddr->sa_data, ETH_ALEN); | ||
663 | queue_work(mdev->workqueue, &priv->mac_task); | ||
664 | return 0; | ||
665 | } | ||
666 | |||
667 | static void mlx4_en_do_set_mac(struct work_struct *work) | ||
668 | { | 658 | { |
669 | struct mlx4_en_priv *priv = container_of(work, struct mlx4_en_priv, | ||
670 | mac_task); | ||
671 | struct mlx4_en_dev *mdev = priv->mdev; | ||
672 | int err = 0; | 659 | int err = 0; |
673 | 660 | ||
674 | mutex_lock(&mdev->state_lock); | ||
675 | if (priv->port_up) { | 661 | if (priv->port_up) { |
676 | /* Remove old MAC and insert the new one */ | 662 | /* Remove old MAC and insert the new one */ |
677 | err = mlx4_en_replace_mac(priv, priv->base_qpn, | 663 | err = mlx4_en_replace_mac(priv, priv->base_qpn, |
@@ -683,7 +669,26 @@ static void mlx4_en_do_set_mac(struct work_struct *work) | |||
683 | } else | 669 | } else |
684 | en_dbg(HW, priv, "Port is down while registering mac, exiting...\n"); | 670 | en_dbg(HW, priv, "Port is down while registering mac, exiting...\n"); |
685 | 671 | ||
672 | return err; | ||
673 | } | ||
674 | |||
675 | static int mlx4_en_set_mac(struct net_device *dev, void *addr) | ||
676 | { | ||
677 | struct mlx4_en_priv *priv = netdev_priv(dev); | ||
678 | struct mlx4_en_dev *mdev = priv->mdev; | ||
679 | struct sockaddr *saddr = addr; | ||
680 | int err; | ||
681 | |||
682 | if (!is_valid_ether_addr(saddr->sa_data)) | ||
683 | return -EADDRNOTAVAIL; | ||
684 | |||
685 | memcpy(dev->dev_addr, saddr->sa_data, ETH_ALEN); | ||
686 | |||
687 | mutex_lock(&mdev->state_lock); | ||
688 | err = mlx4_en_do_set_mac(priv); | ||
686 | mutex_unlock(&mdev->state_lock); | 689 | mutex_unlock(&mdev->state_lock); |
690 | |||
691 | return err; | ||
687 | } | 692 | } |
688 | 693 | ||
689 | static void mlx4_en_clear_list(struct net_device *dev) | 694 | static void mlx4_en_clear_list(struct net_device *dev) |
@@ -1348,7 +1353,7 @@ static void mlx4_en_do_get_stats(struct work_struct *work) | |||
1348 | queue_delayed_work(mdev->workqueue, &priv->stats_task, STATS_DELAY); | 1353 | queue_delayed_work(mdev->workqueue, &priv->stats_task, STATS_DELAY); |
1349 | } | 1354 | } |
1350 | if (mdev->mac_removed[MLX4_MAX_PORTS + 1 - priv->port]) { | 1355 | if (mdev->mac_removed[MLX4_MAX_PORTS + 1 - priv->port]) { |
1351 | queue_work(mdev->workqueue, &priv->mac_task); | 1356 | mlx4_en_do_set_mac(priv); |
1352 | mdev->mac_removed[MLX4_MAX_PORTS + 1 - priv->port] = 0; | 1357 | mdev->mac_removed[MLX4_MAX_PORTS + 1 - priv->port] = 0; |
1353 | } | 1358 | } |
1354 | mutex_unlock(&mdev->state_lock); | 1359 | mutex_unlock(&mdev->state_lock); |
@@ -1828,9 +1833,11 @@ int mlx4_en_alloc_resources(struct mlx4_en_priv *priv) | |||
1828 | } | 1833 | } |
1829 | 1834 | ||
1830 | #ifdef CONFIG_RFS_ACCEL | 1835 | #ifdef CONFIG_RFS_ACCEL |
1831 | priv->dev->rx_cpu_rmap = alloc_irq_cpu_rmap(priv->mdev->dev->caps.comp_pool); | 1836 | if (priv->mdev->dev->caps.comp_pool) { |
1832 | if (!priv->dev->rx_cpu_rmap) | 1837 | priv->dev->rx_cpu_rmap = alloc_irq_cpu_rmap(priv->mdev->dev->caps.comp_pool); |
1833 | goto err; | 1838 | if (!priv->dev->rx_cpu_rmap) |
1839 | goto err; | ||
1840 | } | ||
1834 | #endif | 1841 | #endif |
1835 | 1842 | ||
1836 | return 0; | 1843 | return 0; |
@@ -2078,7 +2085,6 @@ int mlx4_en_init_netdev(struct mlx4_en_dev *mdev, int port, | |||
2078 | priv->msg_enable = MLX4_EN_MSG_LEVEL; | 2085 | priv->msg_enable = MLX4_EN_MSG_LEVEL; |
2079 | spin_lock_init(&priv->stats_lock); | 2086 | spin_lock_init(&priv->stats_lock); |
2080 | INIT_WORK(&priv->rx_mode_task, mlx4_en_do_set_rx_mode); | 2087 | INIT_WORK(&priv->rx_mode_task, mlx4_en_do_set_rx_mode); |
2081 | INIT_WORK(&priv->mac_task, mlx4_en_do_set_mac); | ||
2082 | INIT_WORK(&priv->watchdog_task, mlx4_en_restart); | 2088 | INIT_WORK(&priv->watchdog_task, mlx4_en_restart); |
2083 | INIT_WORK(&priv->linkstate_task, mlx4_en_linkstate); | 2089 | INIT_WORK(&priv->linkstate_task, mlx4_en_linkstate); |
2084 | INIT_DELAYED_WORK(&priv->stats_task, mlx4_en_do_get_stats); | 2090 | INIT_DELAYED_WORK(&priv->stats_task, mlx4_en_do_get_stats); |
diff --git a/drivers/net/ethernet/mellanox/mlx4/fw.c b/drivers/net/ethernet/mellanox/mlx4/fw.c index 50917eb3013e..f6245579962d 100644 --- a/drivers/net/ethernet/mellanox/mlx4/fw.c +++ b/drivers/net/ethernet/mellanox/mlx4/fw.c | |||
@@ -787,6 +787,14 @@ int mlx4_QUERY_DEV_CAP_wrapper(struct mlx4_dev *dev, int slave, | |||
787 | bmme_flags &= ~MLX4_BMME_FLAG_TYPE_2_WIN; | 787 | bmme_flags &= ~MLX4_BMME_FLAG_TYPE_2_WIN; |
788 | MLX4_PUT(outbox->buf, bmme_flags, QUERY_DEV_CAP_BMME_FLAGS_OFFSET); | 788 | MLX4_PUT(outbox->buf, bmme_flags, QUERY_DEV_CAP_BMME_FLAGS_OFFSET); |
789 | 789 | ||
790 | /* turn off device-managed steering capability if not enabled */ | ||
791 | if (dev->caps.steering_mode != MLX4_STEERING_MODE_DEVICE_MANAGED) { | ||
792 | MLX4_GET(field, outbox->buf, | ||
793 | QUERY_DEV_CAP_FLOW_STEERING_RANGE_EN_OFFSET); | ||
794 | field &= 0x7f; | ||
795 | MLX4_PUT(outbox->buf, field, | ||
796 | QUERY_DEV_CAP_FLOW_STEERING_RANGE_EN_OFFSET); | ||
797 | } | ||
790 | return 0; | 798 | return 0; |
791 | } | 799 | } |
792 | 800 | ||
diff --git a/drivers/net/ethernet/mellanox/mlx4/main.c b/drivers/net/ethernet/mellanox/mlx4/main.c index d180bc46826a..16abde20e1fc 100644 --- a/drivers/net/ethernet/mellanox/mlx4/main.c +++ b/drivers/net/ethernet/mellanox/mlx4/main.c | |||
@@ -1555,7 +1555,7 @@ void __mlx4_counter_free(struct mlx4_dev *dev, u32 idx) | |||
1555 | 1555 | ||
1556 | void mlx4_counter_free(struct mlx4_dev *dev, u32 idx) | 1556 | void mlx4_counter_free(struct mlx4_dev *dev, u32 idx) |
1557 | { | 1557 | { |
1558 | u64 in_param; | 1558 | u64 in_param = 0; |
1559 | 1559 | ||
1560 | if (mlx4_is_mfunc(dev)) { | 1560 | if (mlx4_is_mfunc(dev)) { |
1561 | set_param_l(&in_param, idx); | 1561 | set_param_l(&in_param, idx); |
diff --git a/drivers/net/ethernet/mellanox/mlx4/mlx4.h b/drivers/net/ethernet/mellanox/mlx4/mlx4.h index cf883345af88..d738454116a0 100644 --- a/drivers/net/ethernet/mellanox/mlx4/mlx4.h +++ b/drivers/net/ethernet/mellanox/mlx4/mlx4.h | |||
@@ -1235,7 +1235,7 @@ int mlx4_get_qp_per_mgm(struct mlx4_dev *dev); | |||
1235 | 1235 | ||
1236 | static inline void set_param_l(u64 *arg, u32 val) | 1236 | static inline void set_param_l(u64 *arg, u32 val) |
1237 | { | 1237 | { |
1238 | *((u32 *)arg) = val; | 1238 | *arg = (*arg & 0xffffffff00000000ULL) | (u64) val; |
1239 | } | 1239 | } |
1240 | 1240 | ||
1241 | static inline void set_param_h(u64 *arg, u32 val) | 1241 | static inline void set_param_h(u64 *arg, u32 val) |
diff --git a/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h b/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h index c313d7e943a9..f710b7ce0dcb 100644 --- a/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h +++ b/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h | |||
@@ -509,7 +509,6 @@ struct mlx4_en_priv { | |||
509 | struct mlx4_en_cq rx_cq[MAX_RX_RINGS]; | 509 | struct mlx4_en_cq rx_cq[MAX_RX_RINGS]; |
510 | struct mlx4_qp drop_qp; | 510 | struct mlx4_qp drop_qp; |
511 | struct work_struct rx_mode_task; | 511 | struct work_struct rx_mode_task; |
512 | struct work_struct mac_task; | ||
513 | struct work_struct watchdog_task; | 512 | struct work_struct watchdog_task; |
514 | struct work_struct linkstate_task; | 513 | struct work_struct linkstate_task; |
515 | struct delayed_work stats_task; | 514 | struct delayed_work stats_task; |
diff --git a/drivers/net/ethernet/mellanox/mlx4/mr.c b/drivers/net/ethernet/mellanox/mlx4/mr.c index 602ca9bf78e4..f91719a08cba 100644 --- a/drivers/net/ethernet/mellanox/mlx4/mr.c +++ b/drivers/net/ethernet/mellanox/mlx4/mr.c | |||
@@ -183,7 +183,7 @@ u32 __mlx4_alloc_mtt_range(struct mlx4_dev *dev, int order) | |||
183 | 183 | ||
184 | static u32 mlx4_alloc_mtt_range(struct mlx4_dev *dev, int order) | 184 | static u32 mlx4_alloc_mtt_range(struct mlx4_dev *dev, int order) |
185 | { | 185 | { |
186 | u64 in_param; | 186 | u64 in_param = 0; |
187 | u64 out_param; | 187 | u64 out_param; |
188 | int err; | 188 | int err; |
189 | 189 | ||
@@ -240,7 +240,7 @@ void __mlx4_free_mtt_range(struct mlx4_dev *dev, u32 offset, int order) | |||
240 | 240 | ||
241 | static void mlx4_free_mtt_range(struct mlx4_dev *dev, u32 offset, int order) | 241 | static void mlx4_free_mtt_range(struct mlx4_dev *dev, u32 offset, int order) |
242 | { | 242 | { |
243 | u64 in_param; | 243 | u64 in_param = 0; |
244 | int err; | 244 | int err; |
245 | 245 | ||
246 | if (mlx4_is_mfunc(dev)) { | 246 | if (mlx4_is_mfunc(dev)) { |
@@ -351,7 +351,7 @@ void __mlx4_mpt_release(struct mlx4_dev *dev, u32 index) | |||
351 | 351 | ||
352 | static void mlx4_mpt_release(struct mlx4_dev *dev, u32 index) | 352 | static void mlx4_mpt_release(struct mlx4_dev *dev, u32 index) |
353 | { | 353 | { |
354 | u64 in_param; | 354 | u64 in_param = 0; |
355 | 355 | ||
356 | if (mlx4_is_mfunc(dev)) { | 356 | if (mlx4_is_mfunc(dev)) { |
357 | set_param_l(&in_param, index); | 357 | set_param_l(&in_param, index); |
@@ -374,7 +374,7 @@ int __mlx4_mpt_alloc_icm(struct mlx4_dev *dev, u32 index) | |||
374 | 374 | ||
375 | static int mlx4_mpt_alloc_icm(struct mlx4_dev *dev, u32 index) | 375 | static int mlx4_mpt_alloc_icm(struct mlx4_dev *dev, u32 index) |
376 | { | 376 | { |
377 | u64 param; | 377 | u64 param = 0; |
378 | 378 | ||
379 | if (mlx4_is_mfunc(dev)) { | 379 | if (mlx4_is_mfunc(dev)) { |
380 | set_param_l(¶m, index); | 380 | set_param_l(¶m, index); |
@@ -395,7 +395,7 @@ void __mlx4_mpt_free_icm(struct mlx4_dev *dev, u32 index) | |||
395 | 395 | ||
396 | static void mlx4_mpt_free_icm(struct mlx4_dev *dev, u32 index) | 396 | static void mlx4_mpt_free_icm(struct mlx4_dev *dev, u32 index) |
397 | { | 397 | { |
398 | u64 in_param; | 398 | u64 in_param = 0; |
399 | 399 | ||
400 | if (mlx4_is_mfunc(dev)) { | 400 | if (mlx4_is_mfunc(dev)) { |
401 | set_param_l(&in_param, index); | 401 | set_param_l(&in_param, index); |
diff --git a/drivers/net/ethernet/mellanox/mlx4/pd.c b/drivers/net/ethernet/mellanox/mlx4/pd.c index 1ac88637ad9d..00f223acada7 100644 --- a/drivers/net/ethernet/mellanox/mlx4/pd.c +++ b/drivers/net/ethernet/mellanox/mlx4/pd.c | |||
@@ -101,7 +101,7 @@ void __mlx4_xrcd_free(struct mlx4_dev *dev, u32 xrcdn) | |||
101 | 101 | ||
102 | void mlx4_xrcd_free(struct mlx4_dev *dev, u32 xrcdn) | 102 | void mlx4_xrcd_free(struct mlx4_dev *dev, u32 xrcdn) |
103 | { | 103 | { |
104 | u64 in_param; | 104 | u64 in_param = 0; |
105 | int err; | 105 | int err; |
106 | 106 | ||
107 | if (mlx4_is_mfunc(dev)) { | 107 | if (mlx4_is_mfunc(dev)) { |
diff --git a/drivers/net/ethernet/mellanox/mlx4/port.c b/drivers/net/ethernet/mellanox/mlx4/port.c index 719ead15e491..10c57c86388b 100644 --- a/drivers/net/ethernet/mellanox/mlx4/port.c +++ b/drivers/net/ethernet/mellanox/mlx4/port.c | |||
@@ -175,7 +175,7 @@ EXPORT_SYMBOL_GPL(__mlx4_register_mac); | |||
175 | 175 | ||
176 | int mlx4_register_mac(struct mlx4_dev *dev, u8 port, u64 mac) | 176 | int mlx4_register_mac(struct mlx4_dev *dev, u8 port, u64 mac) |
177 | { | 177 | { |
178 | u64 out_param; | 178 | u64 out_param = 0; |
179 | int err; | 179 | int err; |
180 | 180 | ||
181 | if (mlx4_is_mfunc(dev)) { | 181 | if (mlx4_is_mfunc(dev)) { |
@@ -222,7 +222,7 @@ EXPORT_SYMBOL_GPL(__mlx4_unregister_mac); | |||
222 | 222 | ||
223 | void mlx4_unregister_mac(struct mlx4_dev *dev, u8 port, u64 mac) | 223 | void mlx4_unregister_mac(struct mlx4_dev *dev, u8 port, u64 mac) |
224 | { | 224 | { |
225 | u64 out_param; | 225 | u64 out_param = 0; |
226 | 226 | ||
227 | if (mlx4_is_mfunc(dev)) { | 227 | if (mlx4_is_mfunc(dev)) { |
228 | set_param_l(&out_param, port); | 228 | set_param_l(&out_param, port); |
@@ -361,7 +361,7 @@ out: | |||
361 | 361 | ||
362 | int mlx4_register_vlan(struct mlx4_dev *dev, u8 port, u16 vlan, int *index) | 362 | int mlx4_register_vlan(struct mlx4_dev *dev, u8 port, u16 vlan, int *index) |
363 | { | 363 | { |
364 | u64 out_param; | 364 | u64 out_param = 0; |
365 | int err; | 365 | int err; |
366 | 366 | ||
367 | if (mlx4_is_mfunc(dev)) { | 367 | if (mlx4_is_mfunc(dev)) { |
@@ -406,7 +406,7 @@ out: | |||
406 | 406 | ||
407 | void mlx4_unregister_vlan(struct mlx4_dev *dev, u8 port, int index) | 407 | void mlx4_unregister_vlan(struct mlx4_dev *dev, u8 port, int index) |
408 | { | 408 | { |
409 | u64 in_param; | 409 | u64 in_param = 0; |
410 | int err; | 410 | int err; |
411 | 411 | ||
412 | if (mlx4_is_mfunc(dev)) { | 412 | if (mlx4_is_mfunc(dev)) { |
diff --git a/drivers/net/ethernet/mellanox/mlx4/qp.c b/drivers/net/ethernet/mellanox/mlx4/qp.c index 81e2abe07bbb..e891b058c1be 100644 --- a/drivers/net/ethernet/mellanox/mlx4/qp.c +++ b/drivers/net/ethernet/mellanox/mlx4/qp.c | |||
@@ -222,7 +222,7 @@ int __mlx4_qp_reserve_range(struct mlx4_dev *dev, int cnt, int align, | |||
222 | 222 | ||
223 | int mlx4_qp_reserve_range(struct mlx4_dev *dev, int cnt, int align, int *base) | 223 | int mlx4_qp_reserve_range(struct mlx4_dev *dev, int cnt, int align, int *base) |
224 | { | 224 | { |
225 | u64 in_param; | 225 | u64 in_param = 0; |
226 | u64 out_param; | 226 | u64 out_param; |
227 | int err; | 227 | int err; |
228 | 228 | ||
@@ -255,7 +255,7 @@ void __mlx4_qp_release_range(struct mlx4_dev *dev, int base_qpn, int cnt) | |||
255 | 255 | ||
256 | void mlx4_qp_release_range(struct mlx4_dev *dev, int base_qpn, int cnt) | 256 | void mlx4_qp_release_range(struct mlx4_dev *dev, int base_qpn, int cnt) |
257 | { | 257 | { |
258 | u64 in_param; | 258 | u64 in_param = 0; |
259 | int err; | 259 | int err; |
260 | 260 | ||
261 | if (mlx4_is_mfunc(dev)) { | 261 | if (mlx4_is_mfunc(dev)) { |
@@ -319,7 +319,7 @@ err_out: | |||
319 | 319 | ||
320 | static int mlx4_qp_alloc_icm(struct mlx4_dev *dev, int qpn) | 320 | static int mlx4_qp_alloc_icm(struct mlx4_dev *dev, int qpn) |
321 | { | 321 | { |
322 | u64 param; | 322 | u64 param = 0; |
323 | 323 | ||
324 | if (mlx4_is_mfunc(dev)) { | 324 | if (mlx4_is_mfunc(dev)) { |
325 | set_param_l(¶m, qpn); | 325 | set_param_l(¶m, qpn); |
@@ -344,7 +344,7 @@ void __mlx4_qp_free_icm(struct mlx4_dev *dev, int qpn) | |||
344 | 344 | ||
345 | static void mlx4_qp_free_icm(struct mlx4_dev *dev, int qpn) | 345 | static void mlx4_qp_free_icm(struct mlx4_dev *dev, int qpn) |
346 | { | 346 | { |
347 | u64 in_param; | 347 | u64 in_param = 0; |
348 | 348 | ||
349 | if (mlx4_is_mfunc(dev)) { | 349 | if (mlx4_is_mfunc(dev)) { |
350 | set_param_l(&in_param, qpn); | 350 | set_param_l(&in_param, qpn); |
diff --git a/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c b/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c index 083fb48dc3d7..2995687f1aee 100644 --- a/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c +++ b/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c | |||
@@ -2990,6 +2990,9 @@ int mlx4_QP_ATTACH_wrapper(struct mlx4_dev *dev, int slave, | |||
2990 | u8 steer_type_mask = 2; | 2990 | u8 steer_type_mask = 2; |
2991 | enum mlx4_steer_type type = (gid[7] & steer_type_mask) >> 1; | 2991 | enum mlx4_steer_type type = (gid[7] & steer_type_mask) >> 1; |
2992 | 2992 | ||
2993 | if (dev->caps.steering_mode != MLX4_STEERING_MODE_B0) | ||
2994 | return -EINVAL; | ||
2995 | |||
2993 | qpn = vhcr->in_modifier & 0xffffff; | 2996 | qpn = vhcr->in_modifier & 0xffffff; |
2994 | err = get_res(dev, slave, qpn, RES_QP, &rqp); | 2997 | err = get_res(dev, slave, qpn, RES_QP, &rqp); |
2995 | if (err) | 2998 | if (err) |
diff --git a/drivers/net/ethernet/mellanox/mlx4/srq.c b/drivers/net/ethernet/mellanox/mlx4/srq.c index feda6c00829f..e329fe1f11b7 100644 --- a/drivers/net/ethernet/mellanox/mlx4/srq.c +++ b/drivers/net/ethernet/mellanox/mlx4/srq.c | |||
@@ -149,7 +149,7 @@ void __mlx4_srq_free_icm(struct mlx4_dev *dev, int srqn) | |||
149 | 149 | ||
150 | static void mlx4_srq_free_icm(struct mlx4_dev *dev, int srqn) | 150 | static void mlx4_srq_free_icm(struct mlx4_dev *dev, int srqn) |
151 | { | 151 | { |
152 | u64 in_param; | 152 | u64 in_param = 0; |
153 | 153 | ||
154 | if (mlx4_is_mfunc(dev)) { | 154 | if (mlx4_is_mfunc(dev)) { |
155 | set_param_l(&in_param, srqn); | 155 | set_param_l(&in_param, srqn); |
diff --git a/drivers/net/ethernet/sfc/efx.h b/drivers/net/ethernet/sfc/efx.h index 50247dfe8f57..d2f790df6dcb 100644 --- a/drivers/net/ethernet/sfc/efx.h +++ b/drivers/net/ethernet/sfc/efx.h | |||
@@ -171,9 +171,9 @@ static inline void efx_device_detach_sync(struct efx_nic *efx) | |||
171 | * TX scheduler is stopped when we're done and before | 171 | * TX scheduler is stopped when we're done and before |
172 | * netif_device_present() becomes false. | 172 | * netif_device_present() becomes false. |
173 | */ | 173 | */ |
174 | netif_tx_lock(dev); | 174 | netif_tx_lock_bh(dev); |
175 | netif_device_detach(dev); | 175 | netif_device_detach(dev); |
176 | netif_tx_unlock(dev); | 176 | netif_tx_unlock_bh(dev); |
177 | } | 177 | } |
178 | 178 | ||
179 | #endif /* EFX_EFX_H */ | 179 | #endif /* EFX_EFX_H */ |
diff --git a/drivers/net/ethernet/sfc/nic.c b/drivers/net/ethernet/sfc/nic.c index 0ad790cc473c..eaa8e874a3cb 100644 --- a/drivers/net/ethernet/sfc/nic.c +++ b/drivers/net/ethernet/sfc/nic.c | |||
@@ -376,7 +376,8 @@ efx_may_push_tx_desc(struct efx_tx_queue *tx_queue, unsigned int write_count) | |||
376 | return false; | 376 | return false; |
377 | 377 | ||
378 | tx_queue->empty_read_count = 0; | 378 | tx_queue->empty_read_count = 0; |
379 | return ((empty_read_count ^ write_count) & ~EFX_EMPTY_COUNT_VALID) == 0; | 379 | return ((empty_read_count ^ write_count) & ~EFX_EMPTY_COUNT_VALID) == 0 |
380 | && tx_queue->write_count - write_count == 1; | ||
380 | } | 381 | } |
381 | 382 | ||
382 | /* For each entry inserted into the software descriptor ring, create a | 383 | /* For each entry inserted into the software descriptor ring, create a |
diff --git a/drivers/net/ethernet/sfc/rx.c b/drivers/net/ethernet/sfc/rx.c index 879ff5849bbd..bb579a6128c8 100644 --- a/drivers/net/ethernet/sfc/rx.c +++ b/drivers/net/ethernet/sfc/rx.c | |||
@@ -215,7 +215,7 @@ static int efx_init_rx_buffers_page(struct efx_rx_queue *rx_queue) | |||
215 | rx_buf = efx_rx_buffer(rx_queue, index); | 215 | rx_buf = efx_rx_buffer(rx_queue, index); |
216 | rx_buf->dma_addr = dma_addr + EFX_PAGE_IP_ALIGN; | 216 | rx_buf->dma_addr = dma_addr + EFX_PAGE_IP_ALIGN; |
217 | rx_buf->u.page = page; | 217 | rx_buf->u.page = page; |
218 | rx_buf->page_offset = page_offset; | 218 | rx_buf->page_offset = page_offset + EFX_PAGE_IP_ALIGN; |
219 | rx_buf->len = efx->rx_buffer_len - EFX_PAGE_IP_ALIGN; | 219 | rx_buf->len = efx->rx_buffer_len - EFX_PAGE_IP_ALIGN; |
220 | rx_buf->flags = EFX_RX_BUF_PAGE; | 220 | rx_buf->flags = EFX_RX_BUF_PAGE; |
221 | ++rx_queue->added_count; | 221 | ++rx_queue->added_count; |
diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c index 01ffbc486982..75c48558e6fd 100644 --- a/drivers/net/ethernet/ti/cpsw.c +++ b/drivers/net/ethernet/ti/cpsw.c | |||
@@ -905,7 +905,7 @@ static netdev_tx_t cpsw_ndo_start_xmit(struct sk_buff *skb, | |||
905 | /* If there is no more tx desc left free then we need to | 905 | /* If there is no more tx desc left free then we need to |
906 | * tell the kernel to stop sending us tx frames. | 906 | * tell the kernel to stop sending us tx frames. |
907 | */ | 907 | */ |
908 | if (unlikely(cpdma_check_free_tx_desc(priv->txch))) | 908 | if (unlikely(!cpdma_check_free_tx_desc(priv->txch))) |
909 | netif_stop_queue(ndev); | 909 | netif_stop_queue(ndev); |
910 | 910 | ||
911 | return NETDEV_TX_OK; | 911 | return NETDEV_TX_OK; |
diff --git a/drivers/net/ethernet/ti/davinci_emac.c b/drivers/net/ethernet/ti/davinci_emac.c index 52c05366599a..ae1b77aa199f 100644 --- a/drivers/net/ethernet/ti/davinci_emac.c +++ b/drivers/net/ethernet/ti/davinci_emac.c | |||
@@ -1102,7 +1102,7 @@ static int emac_dev_xmit(struct sk_buff *skb, struct net_device *ndev) | |||
1102 | /* If there is no more tx desc left free then we need to | 1102 | /* If there is no more tx desc left free then we need to |
1103 | * tell the kernel to stop sending us tx frames. | 1103 | * tell the kernel to stop sending us tx frames. |
1104 | */ | 1104 | */ |
1105 | if (unlikely(cpdma_check_free_tx_desc(priv->txchan))) | 1105 | if (unlikely(!cpdma_check_free_tx_desc(priv->txchan))) |
1106 | netif_stop_queue(ndev); | 1106 | netif_stop_queue(ndev); |
1107 | 1107 | ||
1108 | return NETDEV_TX_OK; | 1108 | return NETDEV_TX_OK; |
diff --git a/drivers/net/hippi/rrunner.c b/drivers/net/hippi/rrunner.c index e5b19b056909..3c4d6274bb9b 100644 --- a/drivers/net/hippi/rrunner.c +++ b/drivers/net/hippi/rrunner.c | |||
@@ -202,6 +202,9 @@ static int rr_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
202 | return 0; | 202 | return 0; |
203 | 203 | ||
204 | out: | 204 | out: |
205 | if (rrpriv->evt_ring) | ||
206 | pci_free_consistent(pdev, EVT_RING_SIZE, rrpriv->evt_ring, | ||
207 | rrpriv->evt_ring_dma); | ||
205 | if (rrpriv->rx_ring) | 208 | if (rrpriv->rx_ring) |
206 | pci_free_consistent(pdev, RX_TOTAL_SIZE, rrpriv->rx_ring, | 209 | pci_free_consistent(pdev, RX_TOTAL_SIZE, rrpriv->rx_ring, |
207 | rrpriv->rx_ring_dma); | 210 | rrpriv->rx_ring_dma); |
diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c index 417b2af1aa80..73abbc1655d5 100644 --- a/drivers/net/macvlan.c +++ b/drivers/net/macvlan.c | |||
@@ -660,6 +660,7 @@ void macvlan_common_setup(struct net_device *dev) | |||
660 | ether_setup(dev); | 660 | ether_setup(dev); |
661 | 661 | ||
662 | dev->priv_flags &= ~(IFF_XMIT_DST_RELEASE | IFF_TX_SKB_SHARING); | 662 | dev->priv_flags &= ~(IFF_XMIT_DST_RELEASE | IFF_TX_SKB_SHARING); |
663 | dev->priv_flags |= IFF_UNICAST_FLT; | ||
663 | dev->netdev_ops = &macvlan_netdev_ops; | 664 | dev->netdev_ops = &macvlan_netdev_ops; |
664 | dev->destructor = free_netdev; | 665 | dev->destructor = free_netdev; |
665 | dev->header_ops = &macvlan_hard_header_ops, | 666 | dev->header_ops = &macvlan_hard_header_ops, |
diff --git a/drivers/net/netconsole.c b/drivers/net/netconsole.c index 37add21a3d7d..59ac143dec25 100644 --- a/drivers/net/netconsole.c +++ b/drivers/net/netconsole.c | |||
@@ -666,6 +666,7 @@ static int netconsole_netdev_event(struct notifier_block *this, | |||
666 | goto done; | 666 | goto done; |
667 | 667 | ||
668 | spin_lock_irqsave(&target_list_lock, flags); | 668 | spin_lock_irqsave(&target_list_lock, flags); |
669 | restart: | ||
669 | list_for_each_entry(nt, &target_list, list) { | 670 | list_for_each_entry(nt, &target_list, list) { |
670 | netconsole_target_get(nt); | 671 | netconsole_target_get(nt); |
671 | if (nt->np.dev == dev) { | 672 | if (nt->np.dev == dev) { |
@@ -678,15 +679,17 @@ static int netconsole_netdev_event(struct notifier_block *this, | |||
678 | case NETDEV_UNREGISTER: | 679 | case NETDEV_UNREGISTER: |
679 | /* | 680 | /* |
680 | * rtnl_lock already held | 681 | * rtnl_lock already held |
682 | * we might sleep in __netpoll_cleanup() | ||
681 | */ | 683 | */ |
682 | if (nt->np.dev) { | 684 | spin_unlock_irqrestore(&target_list_lock, flags); |
683 | __netpoll_cleanup(&nt->np); | 685 | __netpoll_cleanup(&nt->np); |
684 | dev_put(nt->np.dev); | 686 | spin_lock_irqsave(&target_list_lock, flags); |
685 | nt->np.dev = NULL; | 687 | dev_put(nt->np.dev); |
686 | } | 688 | nt->np.dev = NULL; |
687 | nt->enabled = 0; | 689 | nt->enabled = 0; |
688 | stopped = true; | 690 | stopped = true; |
689 | break; | 691 | netconsole_target_put(nt); |
692 | goto restart; | ||
690 | } | 693 | } |
691 | } | 694 | } |
692 | netconsole_target_put(nt); | 695 | netconsole_target_put(nt); |
diff --git a/drivers/net/team/team.c b/drivers/net/team/team.c index 05c5efe84591..bf3419297875 100644 --- a/drivers/net/team/team.c +++ b/drivers/net/team/team.c | |||
@@ -1138,6 +1138,8 @@ static int team_port_del(struct team *team, struct net_device *port_dev) | |||
1138 | netdev_upper_dev_unlink(port_dev, dev); | 1138 | netdev_upper_dev_unlink(port_dev, dev); |
1139 | team_port_disable_netpoll(port); | 1139 | team_port_disable_netpoll(port); |
1140 | vlan_vids_del_by_dev(port_dev, dev); | 1140 | vlan_vids_del_by_dev(port_dev, dev); |
1141 | dev_uc_unsync(port_dev, dev); | ||
1142 | dev_mc_unsync(port_dev, dev); | ||
1141 | dev_close(port_dev); | 1143 | dev_close(port_dev); |
1142 | team_port_leave(team, port); | 1144 | team_port_leave(team, port); |
1143 | 1145 | ||
diff --git a/drivers/net/tun.c b/drivers/net/tun.c index 2c6a22e278ea..b7c457adc0dc 100644 --- a/drivers/net/tun.c +++ b/drivers/net/tun.c | |||
@@ -747,6 +747,8 @@ static netdev_tx_t tun_net_xmit(struct sk_buff *skb, struct net_device *dev) | |||
747 | goto drop; | 747 | goto drop; |
748 | skb_orphan(skb); | 748 | skb_orphan(skb); |
749 | 749 | ||
750 | nf_reset(skb); | ||
751 | |||
750 | /* Enqueue packet */ | 752 | /* Enqueue packet */ |
751 | skb_queue_tail(&tfile->socket.sk->sk_receive_queue, skb); | 753 | skb_queue_tail(&tfile->socket.sk->sk_receive_queue, skb); |
752 | 754 | ||
diff --git a/drivers/net/usb/Kconfig b/drivers/net/usb/Kconfig index 3b6e9b83342d..7c769d8e25ad 100644 --- a/drivers/net/usb/Kconfig +++ b/drivers/net/usb/Kconfig | |||
@@ -268,7 +268,7 @@ config USB_NET_SMSC75XX | |||
268 | select CRC16 | 268 | select CRC16 |
269 | select CRC32 | 269 | select CRC32 |
270 | help | 270 | help |
271 | This option adds support for SMSC LAN95XX based USB 2.0 | 271 | This option adds support for SMSC LAN75XX based USB 2.0 |
272 | Gigabit Ethernet adapters. | 272 | Gigabit Ethernet adapters. |
273 | 273 | ||
274 | config USB_NET_SMSC95XX | 274 | config USB_NET_SMSC95XX |
diff --git a/drivers/net/usb/cdc_mbim.c b/drivers/net/usb/cdc_mbim.c index 248d2dc765a5..16c842997291 100644 --- a/drivers/net/usb/cdc_mbim.c +++ b/drivers/net/usb/cdc_mbim.c | |||
@@ -68,18 +68,9 @@ static int cdc_mbim_bind(struct usbnet *dev, struct usb_interface *intf) | |||
68 | struct cdc_ncm_ctx *ctx; | 68 | struct cdc_ncm_ctx *ctx; |
69 | struct usb_driver *subdriver = ERR_PTR(-ENODEV); | 69 | struct usb_driver *subdriver = ERR_PTR(-ENODEV); |
70 | int ret = -ENODEV; | 70 | int ret = -ENODEV; |
71 | u8 data_altsetting = CDC_NCM_DATA_ALTSETTING_NCM; | 71 | u8 data_altsetting = cdc_ncm_select_altsetting(dev, intf); |
72 | struct cdc_mbim_state *info = (void *)&dev->data; | 72 | struct cdc_mbim_state *info = (void *)&dev->data; |
73 | 73 | ||
74 | /* see if interface supports MBIM alternate setting */ | ||
75 | if (intf->num_altsetting == 2) { | ||
76 | if (!cdc_ncm_comm_intf_is_mbim(intf->cur_altsetting)) | ||
77 | usb_set_interface(dev->udev, | ||
78 | intf->cur_altsetting->desc.bInterfaceNumber, | ||
79 | CDC_NCM_COMM_ALTSETTING_MBIM); | ||
80 | data_altsetting = CDC_NCM_DATA_ALTSETTING_MBIM; | ||
81 | } | ||
82 | |||
83 | /* Probably NCM, defer for cdc_ncm_bind */ | 74 | /* Probably NCM, defer for cdc_ncm_bind */ |
84 | if (!cdc_ncm_comm_intf_is_mbim(intf->cur_altsetting)) | 75 | if (!cdc_ncm_comm_intf_is_mbim(intf->cur_altsetting)) |
85 | goto err; | 76 | goto err; |
diff --git a/drivers/net/usb/cdc_ncm.c b/drivers/net/usb/cdc_ncm.c index 61b74a2b89ac..4709fa3497cf 100644 --- a/drivers/net/usb/cdc_ncm.c +++ b/drivers/net/usb/cdc_ncm.c | |||
@@ -55,6 +55,14 @@ | |||
55 | 55 | ||
56 | #define DRIVER_VERSION "14-Mar-2012" | 56 | #define DRIVER_VERSION "14-Mar-2012" |
57 | 57 | ||
58 | #if IS_ENABLED(CONFIG_USB_NET_CDC_MBIM) | ||
59 | static bool prefer_mbim = true; | ||
60 | #else | ||
61 | static bool prefer_mbim; | ||
62 | #endif | ||
63 | module_param(prefer_mbim, bool, S_IRUGO | S_IWUSR); | ||
64 | MODULE_PARM_DESC(prefer_mbim, "Prefer MBIM setting on dual NCM/MBIM functions"); | ||
65 | |||
58 | static void cdc_ncm_txpath_bh(unsigned long param); | 66 | static void cdc_ncm_txpath_bh(unsigned long param); |
59 | static void cdc_ncm_tx_timeout_start(struct cdc_ncm_ctx *ctx); | 67 | static void cdc_ncm_tx_timeout_start(struct cdc_ncm_ctx *ctx); |
60 | static enum hrtimer_restart cdc_ncm_tx_timer_cb(struct hrtimer *hr_timer); | 68 | static enum hrtimer_restart cdc_ncm_tx_timer_cb(struct hrtimer *hr_timer); |
@@ -550,9 +558,12 @@ void cdc_ncm_unbind(struct usbnet *dev, struct usb_interface *intf) | |||
550 | } | 558 | } |
551 | EXPORT_SYMBOL_GPL(cdc_ncm_unbind); | 559 | EXPORT_SYMBOL_GPL(cdc_ncm_unbind); |
552 | 560 | ||
553 | static int cdc_ncm_bind(struct usbnet *dev, struct usb_interface *intf) | 561 | /* Select the MBIM altsetting iff it is preferred and available, |
562 | * returning the number of the corresponding data interface altsetting | ||
563 | */ | ||
564 | u8 cdc_ncm_select_altsetting(struct usbnet *dev, struct usb_interface *intf) | ||
554 | { | 565 | { |
555 | int ret; | 566 | struct usb_host_interface *alt; |
556 | 567 | ||
557 | /* The MBIM spec defines a NCM compatible default altsetting, | 568 | /* The MBIM spec defines a NCM compatible default altsetting, |
558 | * which we may have matched: | 569 | * which we may have matched: |
@@ -568,23 +579,27 @@ static int cdc_ncm_bind(struct usbnet *dev, struct usb_interface *intf) | |||
568 | * endpoint descriptors, shall be constructed according to | 579 | * endpoint descriptors, shall be constructed according to |
569 | * the rules given in section 6 (USB Device Model) of this | 580 | * the rules given in section 6 (USB Device Model) of this |
570 | * specification." | 581 | * specification." |
571 | * | ||
572 | * Do not bind to such interfaces, allowing cdc_mbim to handle | ||
573 | * them | ||
574 | */ | 582 | */ |
575 | #if IS_ENABLED(CONFIG_USB_NET_CDC_MBIM) | 583 | if (prefer_mbim && intf->num_altsetting == 2) { |
576 | if ((intf->num_altsetting == 2) && | 584 | alt = usb_altnum_to_altsetting(intf, CDC_NCM_COMM_ALTSETTING_MBIM); |
577 | !usb_set_interface(dev->udev, | 585 | if (alt && cdc_ncm_comm_intf_is_mbim(alt) && |
578 | intf->cur_altsetting->desc.bInterfaceNumber, | 586 | !usb_set_interface(dev->udev, |
579 | CDC_NCM_COMM_ALTSETTING_MBIM)) { | 587 | intf->cur_altsetting->desc.bInterfaceNumber, |
580 | if (cdc_ncm_comm_intf_is_mbim(intf->cur_altsetting)) | 588 | CDC_NCM_COMM_ALTSETTING_MBIM)) |
581 | return -ENODEV; | 589 | return CDC_NCM_DATA_ALTSETTING_MBIM; |
582 | else | ||
583 | usb_set_interface(dev->udev, | ||
584 | intf->cur_altsetting->desc.bInterfaceNumber, | ||
585 | CDC_NCM_COMM_ALTSETTING_NCM); | ||
586 | } | 590 | } |
587 | #endif | 591 | return CDC_NCM_DATA_ALTSETTING_NCM; |
592 | } | ||
593 | EXPORT_SYMBOL_GPL(cdc_ncm_select_altsetting); | ||
594 | |||
595 | static int cdc_ncm_bind(struct usbnet *dev, struct usb_interface *intf) | ||
596 | { | ||
597 | int ret; | ||
598 | |||
599 | /* MBIM backwards compatible function? */ | ||
600 | cdc_ncm_select_altsetting(dev, intf); | ||
601 | if (cdc_ncm_comm_intf_is_mbim(intf->cur_altsetting)) | ||
602 | return -ENODEV; | ||
588 | 603 | ||
589 | /* NCM data altsetting is always 1 */ | 604 | /* NCM data altsetting is always 1 */ |
590 | ret = cdc_ncm_bind_common(dev, intf, 1); | 605 | ret = cdc_ncm_bind_common(dev, intf, 1); |
diff --git a/drivers/net/usb/qmi_wwan.c b/drivers/net/usb/qmi_wwan.c index efb5c7c33a28..968d5d50751d 100644 --- a/drivers/net/usb/qmi_wwan.c +++ b/drivers/net/usb/qmi_wwan.c | |||
@@ -139,16 +139,9 @@ static int qmi_wwan_bind(struct usbnet *dev, struct usb_interface *intf) | |||
139 | 139 | ||
140 | BUILD_BUG_ON((sizeof(((struct usbnet *)0)->data) < sizeof(struct qmi_wwan_state))); | 140 | BUILD_BUG_ON((sizeof(((struct usbnet *)0)->data) < sizeof(struct qmi_wwan_state))); |
141 | 141 | ||
142 | /* control and data is shared? */ | 142 | /* set up initial state */ |
143 | if (intf->cur_altsetting->desc.bNumEndpoints == 3) { | 143 | info->control = intf; |
144 | info->control = intf; | 144 | info->data = intf; |
145 | info->data = intf; | ||
146 | goto shared; | ||
147 | } | ||
148 | |||
149 | /* else require a single interrupt status endpoint on control intf */ | ||
150 | if (intf->cur_altsetting->desc.bNumEndpoints != 1) | ||
151 | goto err; | ||
152 | 145 | ||
153 | /* and a number of CDC descriptors */ | 146 | /* and a number of CDC descriptors */ |
154 | while (len > 3) { | 147 | while (len > 3) { |
@@ -207,25 +200,14 @@ next_desc: | |||
207 | buf += h->bLength; | 200 | buf += h->bLength; |
208 | } | 201 | } |
209 | 202 | ||
210 | /* did we find all the required ones? */ | 203 | /* Use separate control and data interfaces if we found a CDC Union */ |
211 | if (!(found & (1 << USB_CDC_HEADER_TYPE)) || | 204 | if (cdc_union) { |
212 | !(found & (1 << USB_CDC_UNION_TYPE))) { | 205 | info->data = usb_ifnum_to_if(dev->udev, cdc_union->bSlaveInterface0); |
213 | dev_err(&intf->dev, "CDC functional descriptors missing\n"); | 206 | if (desc->bInterfaceNumber != cdc_union->bMasterInterface0 || !info->data) { |
214 | goto err; | 207 | dev_err(&intf->dev, "bogus CDC Union: master=%u, slave=%u\n", |
215 | } | 208 | cdc_union->bMasterInterface0, cdc_union->bSlaveInterface0); |
216 | 209 | goto err; | |
217 | /* verify CDC Union */ | 210 | } |
218 | if (desc->bInterfaceNumber != cdc_union->bMasterInterface0) { | ||
219 | dev_err(&intf->dev, "bogus CDC Union: master=%u\n", cdc_union->bMasterInterface0); | ||
220 | goto err; | ||
221 | } | ||
222 | |||
223 | /* need to save these for unbind */ | ||
224 | info->control = intf; | ||
225 | info->data = usb_ifnum_to_if(dev->udev, cdc_union->bSlaveInterface0); | ||
226 | if (!info->data) { | ||
227 | dev_err(&intf->dev, "bogus CDC Union: slave=%u\n", cdc_union->bSlaveInterface0); | ||
228 | goto err; | ||
229 | } | 211 | } |
230 | 212 | ||
231 | /* errors aren't fatal - we can live with the dynamic address */ | 213 | /* errors aren't fatal - we can live with the dynamic address */ |
@@ -235,11 +217,12 @@ next_desc: | |||
235 | } | 217 | } |
236 | 218 | ||
237 | /* claim data interface and set it up */ | 219 | /* claim data interface and set it up */ |
238 | status = usb_driver_claim_interface(driver, info->data, dev); | 220 | if (info->control != info->data) { |
239 | if (status < 0) | 221 | status = usb_driver_claim_interface(driver, info->data, dev); |
240 | goto err; | 222 | if (status < 0) |
223 | goto err; | ||
224 | } | ||
241 | 225 | ||
242 | shared: | ||
243 | status = qmi_wwan_register_subdriver(dev); | 226 | status = qmi_wwan_register_subdriver(dev); |
244 | if (status < 0 && info->control != info->data) { | 227 | if (status < 0 && info->control != info->data) { |
245 | usb_set_intfdata(info->data, NULL); | 228 | usb_set_intfdata(info->data, NULL); |
diff --git a/drivers/net/vmxnet3/vmxnet3_drv.c b/drivers/net/vmxnet3/vmxnet3_drv.c index 4aad350e4dae..eae7a03d4f9b 100644 --- a/drivers/net/vmxnet3/vmxnet3_drv.c +++ b/drivers/net/vmxnet3/vmxnet3_drv.c | |||
@@ -2958,6 +2958,7 @@ vmxnet3_probe_device(struct pci_dev *pdev, | |||
2958 | 2958 | ||
2959 | adapter->num_rx_queues = num_rx_queues; | 2959 | adapter->num_rx_queues = num_rx_queues; |
2960 | adapter->num_tx_queues = num_tx_queues; | 2960 | adapter->num_tx_queues = num_tx_queues; |
2961 | adapter->rx_buf_per_pkt = 1; | ||
2961 | 2962 | ||
2962 | size = sizeof(struct Vmxnet3_TxQueueDesc) * adapter->num_tx_queues; | 2963 | size = sizeof(struct Vmxnet3_TxQueueDesc) * adapter->num_tx_queues; |
2963 | size += sizeof(struct Vmxnet3_RxQueueDesc) * adapter->num_rx_queues; | 2964 | size += sizeof(struct Vmxnet3_RxQueueDesc) * adapter->num_rx_queues; |
diff --git a/drivers/net/vmxnet3/vmxnet3_ethtool.c b/drivers/net/vmxnet3/vmxnet3_ethtool.c index a0feb17a0238..63a124340cbe 100644 --- a/drivers/net/vmxnet3/vmxnet3_ethtool.c +++ b/drivers/net/vmxnet3/vmxnet3_ethtool.c | |||
@@ -472,6 +472,12 @@ vmxnet3_set_ringparam(struct net_device *netdev, | |||
472 | VMXNET3_RX_RING_MAX_SIZE) | 472 | VMXNET3_RX_RING_MAX_SIZE) |
473 | return -EINVAL; | 473 | return -EINVAL; |
474 | 474 | ||
475 | /* if adapter not yet initialized, do nothing */ | ||
476 | if (adapter->rx_buf_per_pkt == 0) { | ||
477 | netdev_err(netdev, "adapter not completely initialized, " | ||
478 | "ring size cannot be changed yet\n"); | ||
479 | return -EOPNOTSUPP; | ||
480 | } | ||
475 | 481 | ||
476 | /* round it up to a multiple of VMXNET3_RING_SIZE_ALIGN */ | 482 | /* round it up to a multiple of VMXNET3_RING_SIZE_ALIGN */ |
477 | new_tx_ring_size = (param->tx_pending + VMXNET3_RING_SIZE_MASK) & | 483 | new_tx_ring_size = (param->tx_pending + VMXNET3_RING_SIZE_MASK) & |
diff --git a/drivers/net/vmxnet3/vmxnet3_int.h b/drivers/net/vmxnet3/vmxnet3_int.h index 3198384689d9..35418146fa17 100644 --- a/drivers/net/vmxnet3/vmxnet3_int.h +++ b/drivers/net/vmxnet3/vmxnet3_int.h | |||
@@ -70,10 +70,10 @@ | |||
70 | /* | 70 | /* |
71 | * Version numbers | 71 | * Version numbers |
72 | */ | 72 | */ |
73 | #define VMXNET3_DRIVER_VERSION_STRING "1.1.29.0-k" | 73 | #define VMXNET3_DRIVER_VERSION_STRING "1.1.30.0-k" |
74 | 74 | ||
75 | /* a 32-bit int, each byte encode a verion number in VMXNET3_DRIVER_VERSION */ | 75 | /* a 32-bit int, each byte encode a verion number in VMXNET3_DRIVER_VERSION */ |
76 | #define VMXNET3_DRIVER_VERSION_NUM 0x01011D00 | 76 | #define VMXNET3_DRIVER_VERSION_NUM 0x01011E00 |
77 | 77 | ||
78 | #if defined(CONFIG_PCI_MSI) | 78 | #if defined(CONFIG_PCI_MSI) |
79 | /* RSS only makes sense if MSI-X is supported. */ | 79 | /* RSS only makes sense if MSI-X is supported. */ |
diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c index f10e58ac9c1b..7cee7a3068ec 100644 --- a/drivers/net/vxlan.c +++ b/drivers/net/vxlan.c | |||
@@ -961,6 +961,8 @@ static netdev_tx_t vxlan_xmit(struct sk_buff *skb, struct net_device *dev) | |||
961 | iph->ttl = ttl ? : ip4_dst_hoplimit(&rt->dst); | 961 | iph->ttl = ttl ? : ip4_dst_hoplimit(&rt->dst); |
962 | tunnel_ip_select_ident(skb, old_iph, &rt->dst); | 962 | tunnel_ip_select_ident(skb, old_iph, &rt->dst); |
963 | 963 | ||
964 | nf_reset(skb); | ||
965 | |||
964 | vxlan_set_owner(dev, skb); | 966 | vxlan_set_owner(dev, skb); |
965 | 967 | ||
966 | /* See iptunnel_xmit() */ | 968 | /* See iptunnel_xmit() */ |
@@ -1504,6 +1506,14 @@ static __net_init int vxlan_init_net(struct net *net) | |||
1504 | static __net_exit void vxlan_exit_net(struct net *net) | 1506 | static __net_exit void vxlan_exit_net(struct net *net) |
1505 | { | 1507 | { |
1506 | struct vxlan_net *vn = net_generic(net, vxlan_net_id); | 1508 | struct vxlan_net *vn = net_generic(net, vxlan_net_id); |
1509 | struct vxlan_dev *vxlan; | ||
1510 | unsigned h; | ||
1511 | |||
1512 | rtnl_lock(); | ||
1513 | for (h = 0; h < VNI_HASH_SIZE; ++h) | ||
1514 | hlist_for_each_entry(vxlan, &vn->vni_list[h], hlist) | ||
1515 | dev_close(vxlan->dev); | ||
1516 | rtnl_unlock(); | ||
1507 | 1517 | ||
1508 | if (vn->sock) { | 1518 | if (vn->sock) { |
1509 | sk_release_kernel(vn->sock->sk); | 1519 | sk_release_kernel(vn->sock->sk); |
diff --git a/drivers/net/wireless/iwlwifi/dvm/sta.c b/drivers/net/wireless/iwlwifi/dvm/sta.c index 94ef33838bc6..b775769f8322 100644 --- a/drivers/net/wireless/iwlwifi/dvm/sta.c +++ b/drivers/net/wireless/iwlwifi/dvm/sta.c | |||
@@ -151,7 +151,7 @@ int iwl_send_add_sta(struct iwl_priv *priv, | |||
151 | sta_id, sta->sta.addr, flags & CMD_ASYNC ? "a" : ""); | 151 | sta_id, sta->sta.addr, flags & CMD_ASYNC ? "a" : ""); |
152 | 152 | ||
153 | if (!(flags & CMD_ASYNC)) { | 153 | if (!(flags & CMD_ASYNC)) { |
154 | cmd.flags |= CMD_WANT_SKB | CMD_WANT_HCMD; | 154 | cmd.flags |= CMD_WANT_SKB; |
155 | might_sleep(); | 155 | might_sleep(); |
156 | } | 156 | } |
157 | 157 | ||
diff --git a/drivers/net/wireless/iwlwifi/iwl-devtrace.h b/drivers/net/wireless/iwlwifi/iwl-devtrace.h index 10f01793d7a6..81aa91fab5aa 100644 --- a/drivers/net/wireless/iwlwifi/iwl-devtrace.h +++ b/drivers/net/wireless/iwlwifi/iwl-devtrace.h | |||
@@ -363,7 +363,7 @@ TRACE_EVENT(iwlwifi_dev_hcmd, | |||
363 | __entry->flags = cmd->flags; | 363 | __entry->flags = cmd->flags; |
364 | memcpy(__get_dynamic_array(hcmd), hdr, sizeof(*hdr)); | 364 | memcpy(__get_dynamic_array(hcmd), hdr, sizeof(*hdr)); |
365 | 365 | ||
366 | for (i = 0; i < IWL_MAX_CMD_TFDS; i++) { | 366 | for (i = 0; i < IWL_MAX_CMD_TBS_PER_TFD; i++) { |
367 | if (!cmd->len[i]) | 367 | if (!cmd->len[i]) |
368 | continue; | 368 | continue; |
369 | memcpy((u8 *)__get_dynamic_array(hcmd) + offset, | 369 | memcpy((u8 *)__get_dynamic_array(hcmd) + offset, |
diff --git a/drivers/net/wireless/iwlwifi/iwl-drv.c b/drivers/net/wireless/iwlwifi/iwl-drv.c index 6f228bb2b844..fbfd2d137117 100644 --- a/drivers/net/wireless/iwlwifi/iwl-drv.c +++ b/drivers/net/wireless/iwlwifi/iwl-drv.c | |||
@@ -1102,7 +1102,6 @@ void iwl_drv_stop(struct iwl_drv *drv) | |||
1102 | 1102 | ||
1103 | /* shared module parameters */ | 1103 | /* shared module parameters */ |
1104 | struct iwl_mod_params iwlwifi_mod_params = { | 1104 | struct iwl_mod_params iwlwifi_mod_params = { |
1105 | .amsdu_size_8K = 1, | ||
1106 | .restart_fw = 1, | 1105 | .restart_fw = 1, |
1107 | .plcp_check = true, | 1106 | .plcp_check = true, |
1108 | .bt_coex_active = true, | 1107 | .bt_coex_active = true, |
@@ -1207,7 +1206,7 @@ MODULE_PARM_DESC(11n_disable, | |||
1207 | "disable 11n functionality, bitmap: 1: full, 2: agg TX, 4: agg RX"); | 1206 | "disable 11n functionality, bitmap: 1: full, 2: agg TX, 4: agg RX"); |
1208 | module_param_named(amsdu_size_8K, iwlwifi_mod_params.amsdu_size_8K, | 1207 | module_param_named(amsdu_size_8K, iwlwifi_mod_params.amsdu_size_8K, |
1209 | int, S_IRUGO); | 1208 | int, S_IRUGO); |
1210 | MODULE_PARM_DESC(amsdu_size_8K, "enable 8K amsdu size"); | 1209 | MODULE_PARM_DESC(amsdu_size_8K, "enable 8K amsdu size (default 0)"); |
1211 | module_param_named(fw_restart, iwlwifi_mod_params.restart_fw, int, S_IRUGO); | 1210 | module_param_named(fw_restart, iwlwifi_mod_params.restart_fw, int, S_IRUGO); |
1212 | MODULE_PARM_DESC(fw_restart, "restart firmware in case of error"); | 1211 | MODULE_PARM_DESC(fw_restart, "restart firmware in case of error"); |
1213 | 1212 | ||
diff --git a/drivers/net/wireless/iwlwifi/iwl-modparams.h b/drivers/net/wireless/iwlwifi/iwl-modparams.h index e5e3a79eae2f..2c2a729092f5 100644 --- a/drivers/net/wireless/iwlwifi/iwl-modparams.h +++ b/drivers/net/wireless/iwlwifi/iwl-modparams.h | |||
@@ -91,7 +91,7 @@ enum iwl_power_level { | |||
91 | * @sw_crypto: using hardware encryption, default = 0 | 91 | * @sw_crypto: using hardware encryption, default = 0 |
92 | * @disable_11n: disable 11n capabilities, default = 0, | 92 | * @disable_11n: disable 11n capabilities, default = 0, |
93 | * use IWL_DISABLE_HT_* constants | 93 | * use IWL_DISABLE_HT_* constants |
94 | * @amsdu_size_8K: enable 8K amsdu size, default = 1 | 94 | * @amsdu_size_8K: enable 8K amsdu size, default = 0 |
95 | * @restart_fw: restart firmware, default = 1 | 95 | * @restart_fw: restart firmware, default = 1 |
96 | * @plcp_check: enable plcp health check, default = true | 96 | * @plcp_check: enable plcp health check, default = true |
97 | * @wd_disable: enable stuck queue check, default = 0 | 97 | * @wd_disable: enable stuck queue check, default = 0 |
diff --git a/drivers/net/wireless/iwlwifi/iwl-trans.h b/drivers/net/wireless/iwlwifi/iwl-trans.h index 8c7bec6b9a0b..0cac2b7af78b 100644 --- a/drivers/net/wireless/iwlwifi/iwl-trans.h +++ b/drivers/net/wireless/iwlwifi/iwl-trans.h | |||
@@ -186,19 +186,13 @@ struct iwl_rx_packet { | |||
186 | * @CMD_ASYNC: Return right away and don't want for the response | 186 | * @CMD_ASYNC: Return right away and don't want for the response |
187 | * @CMD_WANT_SKB: valid only with CMD_SYNC. The caller needs the buffer of the | 187 | * @CMD_WANT_SKB: valid only with CMD_SYNC. The caller needs the buffer of the |
188 | * response. The caller needs to call iwl_free_resp when done. | 188 | * response. The caller needs to call iwl_free_resp when done. |
189 | * @CMD_WANT_HCMD: The caller needs to get the HCMD that was sent in the | ||
190 | * response handler. Chunks flagged by %IWL_HCMD_DFL_NOCOPY won't be | ||
191 | * copied. The pointer passed to the response handler is in the transport | ||
192 | * ownership and don't need to be freed by the op_mode. This also means | ||
193 | * that the pointer is invalidated after the op_mode's handler returns. | ||
194 | * @CMD_ON_DEMAND: This command is sent by the test mode pipe. | 189 | * @CMD_ON_DEMAND: This command is sent by the test mode pipe. |
195 | */ | 190 | */ |
196 | enum CMD_MODE { | 191 | enum CMD_MODE { |
197 | CMD_SYNC = 0, | 192 | CMD_SYNC = 0, |
198 | CMD_ASYNC = BIT(0), | 193 | CMD_ASYNC = BIT(0), |
199 | CMD_WANT_SKB = BIT(1), | 194 | CMD_WANT_SKB = BIT(1), |
200 | CMD_WANT_HCMD = BIT(2), | 195 | CMD_ON_DEMAND = BIT(2), |
201 | CMD_ON_DEMAND = BIT(3), | ||
202 | }; | 196 | }; |
203 | 197 | ||
204 | #define DEF_CMD_PAYLOAD_SIZE 320 | 198 | #define DEF_CMD_PAYLOAD_SIZE 320 |
@@ -217,7 +211,11 @@ struct iwl_device_cmd { | |||
217 | 211 | ||
218 | #define TFD_MAX_PAYLOAD_SIZE (sizeof(struct iwl_device_cmd)) | 212 | #define TFD_MAX_PAYLOAD_SIZE (sizeof(struct iwl_device_cmd)) |
219 | 213 | ||
220 | #define IWL_MAX_CMD_TFDS 2 | 214 | /* |
215 | * number of transfer buffers (fragments) per transmit frame descriptor; | ||
216 | * this is just the driver's idea, the hardware supports 20 | ||
217 | */ | ||
218 | #define IWL_MAX_CMD_TBS_PER_TFD 2 | ||
221 | 219 | ||
222 | /** | 220 | /** |
223 | * struct iwl_hcmd_dataflag - flag for each one of the chunks of the command | 221 | * struct iwl_hcmd_dataflag - flag for each one of the chunks of the command |
@@ -254,15 +252,15 @@ enum iwl_hcmd_dataflag { | |||
254 | * @id: id of the host command | 252 | * @id: id of the host command |
255 | */ | 253 | */ |
256 | struct iwl_host_cmd { | 254 | struct iwl_host_cmd { |
257 | const void *data[IWL_MAX_CMD_TFDS]; | 255 | const void *data[IWL_MAX_CMD_TBS_PER_TFD]; |
258 | struct iwl_rx_packet *resp_pkt; | 256 | struct iwl_rx_packet *resp_pkt; |
259 | unsigned long _rx_page_addr; | 257 | unsigned long _rx_page_addr; |
260 | u32 _rx_page_order; | 258 | u32 _rx_page_order; |
261 | int handler_status; | 259 | int handler_status; |
262 | 260 | ||
263 | u32 flags; | 261 | u32 flags; |
264 | u16 len[IWL_MAX_CMD_TFDS]; | 262 | u16 len[IWL_MAX_CMD_TBS_PER_TFD]; |
265 | u8 dataflags[IWL_MAX_CMD_TFDS]; | 263 | u8 dataflags[IWL_MAX_CMD_TBS_PER_TFD]; |
266 | u8 id; | 264 | u8 id; |
267 | }; | 265 | }; |
268 | 266 | ||
diff --git a/drivers/net/wireless/iwlwifi/mvm/fw-api.h b/drivers/net/wireless/iwlwifi/mvm/fw-api.h index 23eebda848b0..2adb61f103f4 100644 --- a/drivers/net/wireless/iwlwifi/mvm/fw-api.h +++ b/drivers/net/wireless/iwlwifi/mvm/fw-api.h | |||
@@ -762,18 +762,20 @@ struct iwl_phy_context_cmd { | |||
762 | #define IWL_RX_INFO_PHY_CNT 8 | 762 | #define IWL_RX_INFO_PHY_CNT 8 |
763 | #define IWL_RX_INFO_AGC_IDX 1 | 763 | #define IWL_RX_INFO_AGC_IDX 1 |
764 | #define IWL_RX_INFO_RSSI_AB_IDX 2 | 764 | #define IWL_RX_INFO_RSSI_AB_IDX 2 |
765 | #define IWL_RX_INFO_RSSI_C_IDX 3 | 765 | #define IWL_OFDM_AGC_A_MSK 0x0000007f |
766 | #define IWL_OFDM_AGC_DB_MSK 0xfe00 | 766 | #define IWL_OFDM_AGC_A_POS 0 |
767 | #define IWL_OFDM_AGC_DB_POS 9 | 767 | #define IWL_OFDM_AGC_B_MSK 0x00003f80 |
768 | #define IWL_OFDM_AGC_B_POS 7 | ||
769 | #define IWL_OFDM_AGC_CODE_MSK 0x3fe00000 | ||
770 | #define IWL_OFDM_AGC_CODE_POS 20 | ||
768 | #define IWL_OFDM_RSSI_INBAND_A_MSK 0x00ff | 771 | #define IWL_OFDM_RSSI_INBAND_A_MSK 0x00ff |
769 | #define IWL_OFDM_RSSI_ALLBAND_A_MSK 0xff00 | ||
770 | #define IWL_OFDM_RSSI_A_POS 0 | 772 | #define IWL_OFDM_RSSI_A_POS 0 |
773 | #define IWL_OFDM_RSSI_ALLBAND_A_MSK 0xff00 | ||
774 | #define IWL_OFDM_RSSI_ALLBAND_A_POS 8 | ||
771 | #define IWL_OFDM_RSSI_INBAND_B_MSK 0xff0000 | 775 | #define IWL_OFDM_RSSI_INBAND_B_MSK 0xff0000 |
772 | #define IWL_OFDM_RSSI_ALLBAND_B_MSK 0xff000000 | ||
773 | #define IWL_OFDM_RSSI_B_POS 16 | 776 | #define IWL_OFDM_RSSI_B_POS 16 |
774 | #define IWL_OFDM_RSSI_INBAND_C_MSK 0x00ff | 777 | #define IWL_OFDM_RSSI_ALLBAND_B_MSK 0xff000000 |
775 | #define IWL_OFDM_RSSI_ALLBAND_C_MSK 0xff00 | 778 | #define IWL_OFDM_RSSI_ALLBAND_B_POS 24 |
776 | #define IWL_OFDM_RSSI_C_POS 0 | ||
777 | 779 | ||
778 | /** | 780 | /** |
779 | * struct iwl_rx_phy_info - phy info | 781 | * struct iwl_rx_phy_info - phy info |
diff --git a/drivers/net/wireless/iwlwifi/mvm/fw.c b/drivers/net/wireless/iwlwifi/mvm/fw.c index d3d959db03a9..500f818dba04 100644 --- a/drivers/net/wireless/iwlwifi/mvm/fw.c +++ b/drivers/net/wireless/iwlwifi/mvm/fw.c | |||
@@ -79,17 +79,8 @@ | |||
79 | #define UCODE_VALID_OK cpu_to_le32(0x1) | 79 | #define UCODE_VALID_OK cpu_to_le32(0x1) |
80 | 80 | ||
81 | /* Default calibration values for WkP - set to INIT image w/o running */ | 81 | /* Default calibration values for WkP - set to INIT image w/o running */ |
82 | static const u8 wkp_calib_values_bb_filter[] = { 0xbf, 0x00, 0x5f, 0x00, 0x2f, | ||
83 | 0x00, 0x18, 0x00 }; | ||
84 | static const u8 wkp_calib_values_rx_dc[] = { 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, | ||
85 | 0x7f, 0x7f, 0x7f }; | ||
86 | static const u8 wkp_calib_values_tx_lo[] = { 0x00, 0x00, 0x00, 0x00 }; | ||
87 | static const u8 wkp_calib_values_tx_iq[] = { 0xff, 0x00, 0xff, 0x00, 0x00, | ||
88 | 0x00 }; | ||
89 | static const u8 wkp_calib_values_rx_iq[] = { 0xff, 0x00, 0x00, 0x00 }; | ||
90 | static const u8 wkp_calib_values_rx_iq_skew[] = { 0x00, 0x00, 0x01, 0x00 }; | 82 | static const u8 wkp_calib_values_rx_iq_skew[] = { 0x00, 0x00, 0x01, 0x00 }; |
91 | static const u8 wkp_calib_values_tx_iq_skew[] = { 0x01, 0x00, 0x00, 0x00 }; | 83 | static const u8 wkp_calib_values_tx_iq_skew[] = { 0x01, 0x00, 0x00, 0x00 }; |
92 | static const u8 wkp_calib_values_xtal[] = { 0xd2, 0xd2 }; | ||
93 | 84 | ||
94 | struct iwl_calib_default_data { | 85 | struct iwl_calib_default_data { |
95 | u16 size; | 86 | u16 size; |
@@ -99,12 +90,7 @@ struct iwl_calib_default_data { | |||
99 | #define CALIB_SIZE_N_DATA(_buf) {.size = sizeof(_buf), .data = &_buf} | 90 | #define CALIB_SIZE_N_DATA(_buf) {.size = sizeof(_buf), .data = &_buf} |
100 | 91 | ||
101 | static const struct iwl_calib_default_data wkp_calib_default_data[12] = { | 92 | static const struct iwl_calib_default_data wkp_calib_default_data[12] = { |
102 | [5] = CALIB_SIZE_N_DATA(wkp_calib_values_rx_dc), | ||
103 | [6] = CALIB_SIZE_N_DATA(wkp_calib_values_bb_filter), | ||
104 | [7] = CALIB_SIZE_N_DATA(wkp_calib_values_tx_lo), | ||
105 | [8] = CALIB_SIZE_N_DATA(wkp_calib_values_tx_iq), | ||
106 | [9] = CALIB_SIZE_N_DATA(wkp_calib_values_tx_iq_skew), | 93 | [9] = CALIB_SIZE_N_DATA(wkp_calib_values_tx_iq_skew), |
107 | [10] = CALIB_SIZE_N_DATA(wkp_calib_values_rx_iq), | ||
108 | [11] = CALIB_SIZE_N_DATA(wkp_calib_values_rx_iq_skew), | 94 | [11] = CALIB_SIZE_N_DATA(wkp_calib_values_rx_iq_skew), |
109 | }; | 95 | }; |
110 | 96 | ||
@@ -241,20 +227,6 @@ static int iwl_mvm_load_ucode_wait_alive(struct iwl_mvm *mvm, | |||
241 | 227 | ||
242 | return 0; | 228 | return 0; |
243 | } | 229 | } |
244 | #define IWL_HW_REV_ID_RAINBOW 0x2 | ||
245 | #define IWL_PROJ_TYPE_LHP 0x5 | ||
246 | |||
247 | static u32 iwl_mvm_build_phy_cfg(struct iwl_mvm *mvm) | ||
248 | { | ||
249 | struct iwl_nvm_data *data = mvm->nvm_data; | ||
250 | /* Temp calls to static definitions, will be changed to CSR calls */ | ||
251 | u8 hw_rev_id = IWL_HW_REV_ID_RAINBOW; | ||
252 | u8 project_type = IWL_PROJ_TYPE_LHP; | ||
253 | |||
254 | return data->radio_cfg_dash | (data->radio_cfg_step << 2) | | ||
255 | (hw_rev_id << 4) | ((project_type & 0x7f) << 6) | | ||
256 | (data->valid_tx_ant << 16) | (data->valid_rx_ant << 20); | ||
257 | } | ||
258 | 230 | ||
259 | static int iwl_send_phy_cfg_cmd(struct iwl_mvm *mvm) | 231 | static int iwl_send_phy_cfg_cmd(struct iwl_mvm *mvm) |
260 | { | 232 | { |
@@ -262,7 +234,7 @@ static int iwl_send_phy_cfg_cmd(struct iwl_mvm *mvm) | |||
262 | enum iwl_ucode_type ucode_type = mvm->cur_ucode; | 234 | enum iwl_ucode_type ucode_type = mvm->cur_ucode; |
263 | 235 | ||
264 | /* Set parameters */ | 236 | /* Set parameters */ |
265 | phy_cfg_cmd.phy_cfg = cpu_to_le32(iwl_mvm_build_phy_cfg(mvm)); | 237 | phy_cfg_cmd.phy_cfg = cpu_to_le32(mvm->fw->phy_config); |
266 | phy_cfg_cmd.calib_control.event_trigger = | 238 | phy_cfg_cmd.calib_control.event_trigger = |
267 | mvm->fw->default_calib[ucode_type].event_trigger; | 239 | mvm->fw->default_calib[ucode_type].event_trigger; |
268 | phy_cfg_cmd.calib_control.flow_trigger = | 240 | phy_cfg_cmd.calib_control.flow_trigger = |
@@ -275,103 +247,6 @@ static int iwl_send_phy_cfg_cmd(struct iwl_mvm *mvm) | |||
275 | sizeof(phy_cfg_cmd), &phy_cfg_cmd); | 247 | sizeof(phy_cfg_cmd), &phy_cfg_cmd); |
276 | } | 248 | } |
277 | 249 | ||
278 | /* Starting with the new PHY DB implementation - New calibs are enabled */ | ||
279 | /* Value - 0x405e7 */ | ||
280 | #define IWL_CALIB_DEFAULT_FLOW_INIT (IWL_CALIB_CFG_XTAL_IDX |\ | ||
281 | IWL_CALIB_CFG_TEMPERATURE_IDX |\ | ||
282 | IWL_CALIB_CFG_VOLTAGE_READ_IDX |\ | ||
283 | IWL_CALIB_CFG_DC_IDX |\ | ||
284 | IWL_CALIB_CFG_BB_FILTER_IDX |\ | ||
285 | IWL_CALIB_CFG_LO_LEAKAGE_IDX |\ | ||
286 | IWL_CALIB_CFG_TX_IQ_IDX |\ | ||
287 | IWL_CALIB_CFG_RX_IQ_IDX |\ | ||
288 | IWL_CALIB_CFG_AGC_IDX) | ||
289 | |||
290 | #define IWL_CALIB_DEFAULT_EVENT_INIT 0x0 | ||
291 | |||
292 | /* Value 0x41567 */ | ||
293 | #define IWL_CALIB_DEFAULT_FLOW_RUN (IWL_CALIB_CFG_XTAL_IDX |\ | ||
294 | IWL_CALIB_CFG_TEMPERATURE_IDX |\ | ||
295 | IWL_CALIB_CFG_VOLTAGE_READ_IDX |\ | ||
296 | IWL_CALIB_CFG_BB_FILTER_IDX |\ | ||
297 | IWL_CALIB_CFG_DC_IDX |\ | ||
298 | IWL_CALIB_CFG_TX_IQ_IDX |\ | ||
299 | IWL_CALIB_CFG_RX_IQ_IDX |\ | ||
300 | IWL_CALIB_CFG_SENSITIVITY_IDX |\ | ||
301 | IWL_CALIB_CFG_AGC_IDX) | ||
302 | |||
303 | #define IWL_CALIB_DEFAULT_EVENT_RUN (IWL_CALIB_CFG_XTAL_IDX |\ | ||
304 | IWL_CALIB_CFG_TEMPERATURE_IDX |\ | ||
305 | IWL_CALIB_CFG_VOLTAGE_READ_IDX |\ | ||
306 | IWL_CALIB_CFG_TX_PWR_IDX |\ | ||
307 | IWL_CALIB_CFG_DC_IDX |\ | ||
308 | IWL_CALIB_CFG_TX_IQ_IDX |\ | ||
309 | IWL_CALIB_CFG_SENSITIVITY_IDX) | ||
310 | |||
311 | /* | ||
312 | * Sets the calibrations trigger values that will be sent to the FW for runtime | ||
313 | * and init calibrations. | ||
314 | * The ones given in the FW TLV are not correct. | ||
315 | */ | ||
316 | static void iwl_set_default_calib_trigger(struct iwl_mvm *mvm) | ||
317 | { | ||
318 | struct iwl_tlv_calib_ctrl default_calib; | ||
319 | |||
320 | /* | ||
321 | * WkP FW TLV calib bits are wrong, overwrite them. | ||
322 | * This defines the dynamic calibrations which are implemented in the | ||
323 | * uCode both for init(flow) calculation and event driven calibs. | ||
324 | */ | ||
325 | |||
326 | /* Init Image */ | ||
327 | default_calib.event_trigger = cpu_to_le32(IWL_CALIB_DEFAULT_EVENT_INIT); | ||
328 | default_calib.flow_trigger = cpu_to_le32(IWL_CALIB_DEFAULT_FLOW_INIT); | ||
329 | |||
330 | if (default_calib.event_trigger != | ||
331 | mvm->fw->default_calib[IWL_UCODE_INIT].event_trigger) | ||
332 | IWL_ERR(mvm, | ||
333 | "Updating the event calib for INIT image: 0x%x -> 0x%x\n", | ||
334 | mvm->fw->default_calib[IWL_UCODE_INIT].event_trigger, | ||
335 | default_calib.event_trigger); | ||
336 | if (default_calib.flow_trigger != | ||
337 | mvm->fw->default_calib[IWL_UCODE_INIT].flow_trigger) | ||
338 | IWL_ERR(mvm, | ||
339 | "Updating the flow calib for INIT image: 0x%x -> 0x%x\n", | ||
340 | mvm->fw->default_calib[IWL_UCODE_INIT].flow_trigger, | ||
341 | default_calib.flow_trigger); | ||
342 | |||
343 | memcpy((void *)&mvm->fw->default_calib[IWL_UCODE_INIT], | ||
344 | &default_calib, sizeof(struct iwl_tlv_calib_ctrl)); | ||
345 | IWL_ERR(mvm, | ||
346 | "Setting uCode init calibrations event 0x%x, trigger 0x%x\n", | ||
347 | default_calib.event_trigger, | ||
348 | default_calib.flow_trigger); | ||
349 | |||
350 | /* Run time image */ | ||
351 | default_calib.event_trigger = cpu_to_le32(IWL_CALIB_DEFAULT_EVENT_RUN); | ||
352 | default_calib.flow_trigger = cpu_to_le32(IWL_CALIB_DEFAULT_FLOW_RUN); | ||
353 | |||
354 | if (default_calib.event_trigger != | ||
355 | mvm->fw->default_calib[IWL_UCODE_REGULAR].event_trigger) | ||
356 | IWL_ERR(mvm, | ||
357 | "Updating the event calib for RT image: 0x%x -> 0x%x\n", | ||
358 | mvm->fw->default_calib[IWL_UCODE_REGULAR].event_trigger, | ||
359 | default_calib.event_trigger); | ||
360 | if (default_calib.flow_trigger != | ||
361 | mvm->fw->default_calib[IWL_UCODE_REGULAR].flow_trigger) | ||
362 | IWL_ERR(mvm, | ||
363 | "Updating the flow calib for RT image: 0x%x -> 0x%x\n", | ||
364 | mvm->fw->default_calib[IWL_UCODE_REGULAR].flow_trigger, | ||
365 | default_calib.flow_trigger); | ||
366 | |||
367 | memcpy((void *)&mvm->fw->default_calib[IWL_UCODE_REGULAR], | ||
368 | &default_calib, sizeof(struct iwl_tlv_calib_ctrl)); | ||
369 | IWL_ERR(mvm, | ||
370 | "Setting uCode runtime calibs event 0x%x, trigger 0x%x\n", | ||
371 | default_calib.event_trigger, | ||
372 | default_calib.flow_trigger); | ||
373 | } | ||
374 | |||
375 | static int iwl_set_default_calibrations(struct iwl_mvm *mvm) | 250 | static int iwl_set_default_calibrations(struct iwl_mvm *mvm) |
376 | { | 251 | { |
377 | u8 cmd_raw[16]; /* holds the variable size commands */ | 252 | u8 cmd_raw[16]; /* holds the variable size commands */ |
@@ -446,8 +321,10 @@ int iwl_run_init_mvm_ucode(struct iwl_mvm *mvm, bool read_nvm) | |||
446 | ret = iwl_nvm_check_version(mvm->nvm_data, mvm->trans); | 321 | ret = iwl_nvm_check_version(mvm->nvm_data, mvm->trans); |
447 | WARN_ON(ret); | 322 | WARN_ON(ret); |
448 | 323 | ||
449 | /* Override the calibrations from TLV and the const of fw */ | 324 | /* Send TX valid antennas before triggering calibrations */ |
450 | iwl_set_default_calib_trigger(mvm); | 325 | ret = iwl_send_tx_ant_cfg(mvm, mvm->nvm_data->valid_tx_ant); |
326 | if (ret) | ||
327 | goto error; | ||
451 | 328 | ||
452 | /* WkP doesn't have all calibrations, need to set default values */ | 329 | /* WkP doesn't have all calibrations, need to set default values */ |
453 | if (mvm->cfg->device_family == IWL_DEVICE_FAMILY_7000) { | 330 | if (mvm->cfg->device_family == IWL_DEVICE_FAMILY_7000) { |
diff --git a/drivers/net/wireless/iwlwifi/mvm/mvm.h b/drivers/net/wireless/iwlwifi/mvm/mvm.h index 537711b10478..bdae700c769e 100644 --- a/drivers/net/wireless/iwlwifi/mvm/mvm.h +++ b/drivers/net/wireless/iwlwifi/mvm/mvm.h | |||
@@ -80,7 +80,8 @@ | |||
80 | 80 | ||
81 | #define IWL_INVALID_MAC80211_QUEUE 0xff | 81 | #define IWL_INVALID_MAC80211_QUEUE 0xff |
82 | #define IWL_MVM_MAX_ADDRESSES 2 | 82 | #define IWL_MVM_MAX_ADDRESSES 2 |
83 | #define IWL_RSSI_OFFSET 44 | 83 | /* RSSI offset for WkP */ |
84 | #define IWL_RSSI_OFFSET 50 | ||
84 | 85 | ||
85 | enum iwl_mvm_tx_fifo { | 86 | enum iwl_mvm_tx_fifo { |
86 | IWL_MVM_TX_FIFO_BK = 0, | 87 | IWL_MVM_TX_FIFO_BK = 0, |
diff --git a/drivers/net/wireless/iwlwifi/mvm/ops.c b/drivers/net/wireless/iwlwifi/mvm/ops.c index aa59adf87db3..d0f9c1e0475e 100644 --- a/drivers/net/wireless/iwlwifi/mvm/ops.c +++ b/drivers/net/wireless/iwlwifi/mvm/ops.c | |||
@@ -624,12 +624,8 @@ static void iwl_mvm_free_skb(struct iwl_op_mode *op_mode, struct sk_buff *skb) | |||
624 | ieee80211_free_txskb(mvm->hw, skb); | 624 | ieee80211_free_txskb(mvm->hw, skb); |
625 | } | 625 | } |
626 | 626 | ||
627 | static void iwl_mvm_nic_error(struct iwl_op_mode *op_mode) | 627 | static void iwl_mvm_nic_restart(struct iwl_mvm *mvm) |
628 | { | 628 | { |
629 | struct iwl_mvm *mvm = IWL_OP_MODE_GET_MVM(op_mode); | ||
630 | |||
631 | iwl_mvm_dump_nic_error_log(mvm); | ||
632 | |||
633 | iwl_abort_notification_waits(&mvm->notif_wait); | 629 | iwl_abort_notification_waits(&mvm->notif_wait); |
634 | 630 | ||
635 | /* | 631 | /* |
@@ -663,9 +659,21 @@ static void iwl_mvm_nic_error(struct iwl_op_mode *op_mode) | |||
663 | } | 659 | } |
664 | } | 660 | } |
665 | 661 | ||
662 | static void iwl_mvm_nic_error(struct iwl_op_mode *op_mode) | ||
663 | { | ||
664 | struct iwl_mvm *mvm = IWL_OP_MODE_GET_MVM(op_mode); | ||
665 | |||
666 | iwl_mvm_dump_nic_error_log(mvm); | ||
667 | |||
668 | iwl_mvm_nic_restart(mvm); | ||
669 | } | ||
670 | |||
666 | static void iwl_mvm_cmd_queue_full(struct iwl_op_mode *op_mode) | 671 | static void iwl_mvm_cmd_queue_full(struct iwl_op_mode *op_mode) |
667 | { | 672 | { |
673 | struct iwl_mvm *mvm = IWL_OP_MODE_GET_MVM(op_mode); | ||
674 | |||
668 | WARN_ON(1); | 675 | WARN_ON(1); |
676 | iwl_mvm_nic_restart(mvm); | ||
669 | } | 677 | } |
670 | 678 | ||
671 | static const struct iwl_op_mode_ops iwl_mvm_ops = { | 679 | static const struct iwl_op_mode_ops iwl_mvm_ops = { |
diff --git a/drivers/net/wireless/iwlwifi/mvm/rx.c b/drivers/net/wireless/iwlwifi/mvm/rx.c index 3f40ab05bbd8..b0b190d0ec23 100644 --- a/drivers/net/wireless/iwlwifi/mvm/rx.c +++ b/drivers/net/wireless/iwlwifi/mvm/rx.c | |||
@@ -131,33 +131,42 @@ static void iwl_mvm_pass_packet_to_mac80211(struct iwl_mvm *mvm, | |||
131 | static int iwl_mvm_calc_rssi(struct iwl_mvm *mvm, | 131 | static int iwl_mvm_calc_rssi(struct iwl_mvm *mvm, |
132 | struct iwl_rx_phy_info *phy_info) | 132 | struct iwl_rx_phy_info *phy_info) |
133 | { | 133 | { |
134 | u32 rssi_a, rssi_b, rssi_c, max_rssi, agc_db; | 134 | int rssi_a, rssi_b, rssi_a_dbm, rssi_b_dbm, max_rssi_dbm; |
135 | int rssi_all_band_a, rssi_all_band_b; | ||
136 | u32 agc_a, agc_b, max_agc; | ||
135 | u32 val; | 137 | u32 val; |
136 | 138 | ||
137 | /* Find max rssi among 3 possible receivers. | 139 | /* Find max rssi among 2 possible receivers. |
138 | * These values are measured by the Digital Signal Processor (DSP). | 140 | * These values are measured by the Digital Signal Processor (DSP). |
139 | * They should stay fairly constant even as the signal strength varies, | 141 | * They should stay fairly constant even as the signal strength varies, |
140 | * if the radio's Automatic Gain Control (AGC) is working right. | 142 | * if the radio's Automatic Gain Control (AGC) is working right. |
141 | * AGC value (see below) will provide the "interesting" info. | 143 | * AGC value (see below) will provide the "interesting" info. |
142 | */ | 144 | */ |
145 | val = le32_to_cpu(phy_info->non_cfg_phy[IWL_RX_INFO_AGC_IDX]); | ||
146 | agc_a = (val & IWL_OFDM_AGC_A_MSK) >> IWL_OFDM_AGC_A_POS; | ||
147 | agc_b = (val & IWL_OFDM_AGC_B_MSK) >> IWL_OFDM_AGC_B_POS; | ||
148 | max_agc = max_t(u32, agc_a, agc_b); | ||
149 | |||
143 | val = le32_to_cpu(phy_info->non_cfg_phy[IWL_RX_INFO_RSSI_AB_IDX]); | 150 | val = le32_to_cpu(phy_info->non_cfg_phy[IWL_RX_INFO_RSSI_AB_IDX]); |
144 | rssi_a = (val & IWL_OFDM_RSSI_INBAND_A_MSK) >> IWL_OFDM_RSSI_A_POS; | 151 | rssi_a = (val & IWL_OFDM_RSSI_INBAND_A_MSK) >> IWL_OFDM_RSSI_A_POS; |
145 | rssi_b = (val & IWL_OFDM_RSSI_INBAND_B_MSK) >> IWL_OFDM_RSSI_B_POS; | 152 | rssi_b = (val & IWL_OFDM_RSSI_INBAND_B_MSK) >> IWL_OFDM_RSSI_B_POS; |
146 | val = le32_to_cpu(phy_info->non_cfg_phy[IWL_RX_INFO_RSSI_C_IDX]); | 153 | rssi_all_band_a = (val & IWL_OFDM_RSSI_ALLBAND_A_MSK) >> |
147 | rssi_c = (val & IWL_OFDM_RSSI_INBAND_C_MSK) >> IWL_OFDM_RSSI_C_POS; | 154 | IWL_OFDM_RSSI_ALLBAND_A_POS; |
148 | 155 | rssi_all_band_b = (val & IWL_OFDM_RSSI_ALLBAND_B_MSK) >> | |
149 | val = le32_to_cpu(phy_info->non_cfg_phy[IWL_RX_INFO_AGC_IDX]); | 156 | IWL_OFDM_RSSI_ALLBAND_B_POS; |
150 | agc_db = (val & IWL_OFDM_AGC_DB_MSK) >> IWL_OFDM_AGC_DB_POS; | ||
151 | 157 | ||
152 | max_rssi = max_t(u32, rssi_a, rssi_b); | 158 | /* |
153 | max_rssi = max_t(u32, max_rssi, rssi_c); | 159 | * dBm = rssi dB - agc dB - constant. |
160 | * Higher AGC (higher radio gain) means lower signal. | ||
161 | */ | ||
162 | rssi_a_dbm = rssi_a - IWL_RSSI_OFFSET - agc_a; | ||
163 | rssi_b_dbm = rssi_b - IWL_RSSI_OFFSET - agc_b; | ||
164 | max_rssi_dbm = max_t(int, rssi_a_dbm, rssi_b_dbm); | ||
154 | 165 | ||
155 | IWL_DEBUG_STATS(mvm, "Rssi In A %d B %d C %d Max %d AGC dB %d\n", | 166 | IWL_DEBUG_STATS(mvm, "Rssi In A %d B %d Max %d AGCA %d AGCB %d\n", |
156 | rssi_a, rssi_b, rssi_c, max_rssi, agc_db); | 167 | rssi_a_dbm, rssi_b_dbm, max_rssi_dbm, agc_a, agc_b); |
157 | 168 | ||
158 | /* dBm = max_rssi dB - agc dB - constant. | 169 | return max_rssi_dbm; |
159 | * Higher AGC (higher radio gain) means lower signal. */ | ||
160 | return max_rssi - agc_db - IWL_RSSI_OFFSET; | ||
161 | } | 170 | } |
162 | 171 | ||
163 | /* | 172 | /* |
diff --git a/drivers/net/wireless/iwlwifi/mvm/sta.c b/drivers/net/wireless/iwlwifi/mvm/sta.c index 861a7f9f8e7f..274f44e2ef60 100644 --- a/drivers/net/wireless/iwlwifi/mvm/sta.c +++ b/drivers/net/wireless/iwlwifi/mvm/sta.c | |||
@@ -770,6 +770,16 @@ int iwl_mvm_sta_tx_agg_stop(struct iwl_mvm *mvm, struct ieee80211_vif *vif, | |||
770 | u16 txq_id; | 770 | u16 txq_id; |
771 | int err; | 771 | int err; |
772 | 772 | ||
773 | |||
774 | /* | ||
775 | * If mac80211 is cleaning its state, then say that we finished since | ||
776 | * our state has been cleared anyway. | ||
777 | */ | ||
778 | if (test_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status)) { | ||
779 | ieee80211_stop_tx_ba_cb_irqsafe(vif, sta->addr, tid); | ||
780 | return 0; | ||
781 | } | ||
782 | |||
773 | spin_lock_bh(&mvmsta->lock); | 783 | spin_lock_bh(&mvmsta->lock); |
774 | 784 | ||
775 | txq_id = tid_data->txq_id; | 785 | txq_id = tid_data->txq_id; |
diff --git a/drivers/net/wireless/iwlwifi/mvm/tx.c b/drivers/net/wireless/iwlwifi/mvm/tx.c index 6b67ce3f679c..6645efe5c03e 100644 --- a/drivers/net/wireless/iwlwifi/mvm/tx.c +++ b/drivers/net/wireless/iwlwifi/mvm/tx.c | |||
@@ -607,12 +607,8 @@ static void iwl_mvm_rx_tx_cmd_single(struct iwl_mvm *mvm, | |||
607 | 607 | ||
608 | /* Single frame failure in an AMPDU queue => send BAR */ | 608 | /* Single frame failure in an AMPDU queue => send BAR */ |
609 | if (txq_id >= IWL_FIRST_AMPDU_QUEUE && | 609 | if (txq_id >= IWL_FIRST_AMPDU_QUEUE && |
610 | !(info->flags & IEEE80211_TX_STAT_ACK)) { | 610 | !(info->flags & IEEE80211_TX_STAT_ACK)) |
611 | /* there must be only one skb in the skb_list */ | ||
612 | WARN_ON_ONCE(skb_freed > 1 || | ||
613 | !skb_queue_empty(&skbs)); | ||
614 | info->flags |= IEEE80211_TX_STAT_AMPDU_NO_BACK; | 611 | info->flags |= IEEE80211_TX_STAT_AMPDU_NO_BACK; |
615 | } | ||
616 | 612 | ||
617 | /* W/A FW bug: seq_ctl is wrong when the queue is flushed */ | 613 | /* W/A FW bug: seq_ctl is wrong when the queue is flushed */ |
618 | if (status == TX_STATUS_FAIL_FIFO_FLUSHED) { | 614 | if (status == TX_STATUS_FAIL_FIFO_FLUSHED) { |
diff --git a/drivers/net/wireless/iwlwifi/pcie/internal.h b/drivers/net/wireless/iwlwifi/pcie/internal.h index 3d62e8055352..148843e7f34f 100644 --- a/drivers/net/wireless/iwlwifi/pcie/internal.h +++ b/drivers/net/wireless/iwlwifi/pcie/internal.h | |||
@@ -137,10 +137,6 @@ static inline int iwl_queue_dec_wrap(int index, int n_bd) | |||
137 | struct iwl_cmd_meta { | 137 | struct iwl_cmd_meta { |
138 | /* only for SYNC commands, iff the reply skb is wanted */ | 138 | /* only for SYNC commands, iff the reply skb is wanted */ |
139 | struct iwl_host_cmd *source; | 139 | struct iwl_host_cmd *source; |
140 | |||
141 | DEFINE_DMA_UNMAP_ADDR(mapping); | ||
142 | DEFINE_DMA_UNMAP_LEN(len); | ||
143 | |||
144 | u32 flags; | 140 | u32 flags; |
145 | }; | 141 | }; |
146 | 142 | ||
@@ -185,25 +181,36 @@ struct iwl_queue { | |||
185 | /* | 181 | /* |
186 | * The FH will write back to the first TB only, so we need | 182 | * The FH will write back to the first TB only, so we need |
187 | * to copy some data into the buffer regardless of whether | 183 | * to copy some data into the buffer regardless of whether |
188 | * it should be mapped or not. This indicates how much to | 184 | * it should be mapped or not. This indicates how big the |
189 | * copy, even for HCMDs it must be big enough to fit the | 185 | * first TB must be to include the scratch buffer. Since |
190 | * DRAM scratch from the TX cmd, at least 16 bytes. | 186 | * the scratch is 4 bytes at offset 12, it's 16 now. If we |
187 | * make it bigger then allocations will be bigger and copy | ||
188 | * slower, so that's probably not useful. | ||
191 | */ | 189 | */ |
192 | #define IWL_HCMD_MIN_COPY_SIZE 16 | 190 | #define IWL_HCMD_SCRATCHBUF_SIZE 16 |
193 | 191 | ||
194 | struct iwl_pcie_txq_entry { | 192 | struct iwl_pcie_txq_entry { |
195 | struct iwl_device_cmd *cmd; | 193 | struct iwl_device_cmd *cmd; |
196 | struct iwl_device_cmd *copy_cmd; | ||
197 | struct sk_buff *skb; | 194 | struct sk_buff *skb; |
198 | /* buffer to free after command completes */ | 195 | /* buffer to free after command completes */ |
199 | const void *free_buf; | 196 | const void *free_buf; |
200 | struct iwl_cmd_meta meta; | 197 | struct iwl_cmd_meta meta; |
201 | }; | 198 | }; |
202 | 199 | ||
200 | struct iwl_pcie_txq_scratch_buf { | ||
201 | struct iwl_cmd_header hdr; | ||
202 | u8 buf[8]; | ||
203 | __le32 scratch; | ||
204 | }; | ||
205 | |||
203 | /** | 206 | /** |
204 | * struct iwl_txq - Tx Queue for DMA | 207 | * struct iwl_txq - Tx Queue for DMA |
205 | * @q: generic Rx/Tx queue descriptor | 208 | * @q: generic Rx/Tx queue descriptor |
206 | * @tfds: transmit frame descriptors (DMA memory) | 209 | * @tfds: transmit frame descriptors (DMA memory) |
210 | * @scratchbufs: start of command headers, including scratch buffers, for | ||
211 | * the writeback -- this is DMA memory and an array holding one buffer | ||
212 | * for each command on the queue | ||
213 | * @scratchbufs_dma: DMA address for the scratchbufs start | ||
207 | * @entries: transmit entries (driver state) | 214 | * @entries: transmit entries (driver state) |
208 | * @lock: queue lock | 215 | * @lock: queue lock |
209 | * @stuck_timer: timer that fires if queue gets stuck | 216 | * @stuck_timer: timer that fires if queue gets stuck |
@@ -217,6 +224,8 @@ struct iwl_pcie_txq_entry { | |||
217 | struct iwl_txq { | 224 | struct iwl_txq { |
218 | struct iwl_queue q; | 225 | struct iwl_queue q; |
219 | struct iwl_tfd *tfds; | 226 | struct iwl_tfd *tfds; |
227 | struct iwl_pcie_txq_scratch_buf *scratchbufs; | ||
228 | dma_addr_t scratchbufs_dma; | ||
220 | struct iwl_pcie_txq_entry *entries; | 229 | struct iwl_pcie_txq_entry *entries; |
221 | spinlock_t lock; | 230 | spinlock_t lock; |
222 | struct timer_list stuck_timer; | 231 | struct timer_list stuck_timer; |
@@ -225,6 +234,13 @@ struct iwl_txq { | |||
225 | u8 active; | 234 | u8 active; |
226 | }; | 235 | }; |
227 | 236 | ||
237 | static inline dma_addr_t | ||
238 | iwl_pcie_get_scratchbuf_dma(struct iwl_txq *txq, int idx) | ||
239 | { | ||
240 | return txq->scratchbufs_dma + | ||
241 | sizeof(struct iwl_pcie_txq_scratch_buf) * idx; | ||
242 | } | ||
243 | |||
228 | /** | 244 | /** |
229 | * struct iwl_trans_pcie - PCIe transport specific data | 245 | * struct iwl_trans_pcie - PCIe transport specific data |
230 | * @rxq: all the RX queue data | 246 | * @rxq: all the RX queue data |
diff --git a/drivers/net/wireless/iwlwifi/pcie/rx.c b/drivers/net/wireless/iwlwifi/pcie/rx.c index b0ae06d2456f..567e67ad1f61 100644 --- a/drivers/net/wireless/iwlwifi/pcie/rx.c +++ b/drivers/net/wireless/iwlwifi/pcie/rx.c | |||
@@ -637,22 +637,14 @@ static void iwl_pcie_rx_handle_rb(struct iwl_trans *trans, | |||
637 | index = SEQ_TO_INDEX(sequence); | 637 | index = SEQ_TO_INDEX(sequence); |
638 | cmd_index = get_cmd_index(&txq->q, index); | 638 | cmd_index = get_cmd_index(&txq->q, index); |
639 | 639 | ||
640 | if (reclaim) { | 640 | if (reclaim) |
641 | struct iwl_pcie_txq_entry *ent; | 641 | cmd = txq->entries[cmd_index].cmd; |
642 | ent = &txq->entries[cmd_index]; | 642 | else |
643 | cmd = ent->copy_cmd; | ||
644 | WARN_ON_ONCE(!cmd && ent->meta.flags & CMD_WANT_HCMD); | ||
645 | } else { | ||
646 | cmd = NULL; | 643 | cmd = NULL; |
647 | } | ||
648 | 644 | ||
649 | err = iwl_op_mode_rx(trans->op_mode, &rxcb, cmd); | 645 | err = iwl_op_mode_rx(trans->op_mode, &rxcb, cmd); |
650 | 646 | ||
651 | if (reclaim) { | 647 | if (reclaim) { |
652 | /* The original command isn't needed any more */ | ||
653 | kfree(txq->entries[cmd_index].copy_cmd); | ||
654 | txq->entries[cmd_index].copy_cmd = NULL; | ||
655 | /* nor is the duplicated part of the command */ | ||
656 | kfree(txq->entries[cmd_index].free_buf); | 648 | kfree(txq->entries[cmd_index].free_buf); |
657 | txq->entries[cmd_index].free_buf = NULL; | 649 | txq->entries[cmd_index].free_buf = NULL; |
658 | } | 650 | } |
diff --git a/drivers/net/wireless/iwlwifi/pcie/tx.c b/drivers/net/wireless/iwlwifi/pcie/tx.c index 8b625a7f5685..8595c16f74de 100644 --- a/drivers/net/wireless/iwlwifi/pcie/tx.c +++ b/drivers/net/wireless/iwlwifi/pcie/tx.c | |||
@@ -191,12 +191,9 @@ static void iwl_pcie_txq_stuck_timer(unsigned long data) | |||
191 | } | 191 | } |
192 | 192 | ||
193 | for (i = q->read_ptr; i != q->write_ptr; | 193 | for (i = q->read_ptr; i != q->write_ptr; |
194 | i = iwl_queue_inc_wrap(i, q->n_bd)) { | 194 | i = iwl_queue_inc_wrap(i, q->n_bd)) |
195 | struct iwl_tx_cmd *tx_cmd = | ||
196 | (struct iwl_tx_cmd *)txq->entries[i].cmd->payload; | ||
197 | IWL_ERR(trans, "scratch %d = 0x%08x\n", i, | 195 | IWL_ERR(trans, "scratch %d = 0x%08x\n", i, |
198 | get_unaligned_le32(&tx_cmd->scratch)); | 196 | le32_to_cpu(txq->scratchbufs[i].scratch)); |
199 | } | ||
200 | 197 | ||
201 | iwl_op_mode_nic_error(trans->op_mode); | 198 | iwl_op_mode_nic_error(trans->op_mode); |
202 | } | 199 | } |
@@ -367,8 +364,8 @@ static inline u8 iwl_pcie_tfd_get_num_tbs(struct iwl_tfd *tfd) | |||
367 | } | 364 | } |
368 | 365 | ||
369 | static void iwl_pcie_tfd_unmap(struct iwl_trans *trans, | 366 | static void iwl_pcie_tfd_unmap(struct iwl_trans *trans, |
370 | struct iwl_cmd_meta *meta, struct iwl_tfd *tfd, | 367 | struct iwl_cmd_meta *meta, |
371 | enum dma_data_direction dma_dir) | 368 | struct iwl_tfd *tfd) |
372 | { | 369 | { |
373 | int i; | 370 | int i; |
374 | int num_tbs; | 371 | int num_tbs; |
@@ -382,17 +379,12 @@ static void iwl_pcie_tfd_unmap(struct iwl_trans *trans, | |||
382 | return; | 379 | return; |
383 | } | 380 | } |
384 | 381 | ||
385 | /* Unmap tx_cmd */ | 382 | /* first TB is never freed - it's the scratchbuf data */ |
386 | if (num_tbs) | ||
387 | dma_unmap_single(trans->dev, | ||
388 | dma_unmap_addr(meta, mapping), | ||
389 | dma_unmap_len(meta, len), | ||
390 | DMA_BIDIRECTIONAL); | ||
391 | 383 | ||
392 | /* Unmap chunks, if any. */ | ||
393 | for (i = 1; i < num_tbs; i++) | 384 | for (i = 1; i < num_tbs; i++) |
394 | dma_unmap_single(trans->dev, iwl_pcie_tfd_tb_get_addr(tfd, i), | 385 | dma_unmap_single(trans->dev, iwl_pcie_tfd_tb_get_addr(tfd, i), |
395 | iwl_pcie_tfd_tb_get_len(tfd, i), dma_dir); | 386 | iwl_pcie_tfd_tb_get_len(tfd, i), |
387 | DMA_TO_DEVICE); | ||
396 | 388 | ||
397 | tfd->num_tbs = 0; | 389 | tfd->num_tbs = 0; |
398 | } | 390 | } |
@@ -406,8 +398,7 @@ static void iwl_pcie_tfd_unmap(struct iwl_trans *trans, | |||
406 | * Does NOT advance any TFD circular buffer read/write indexes | 398 | * Does NOT advance any TFD circular buffer read/write indexes |
407 | * Does NOT free the TFD itself (which is within circular buffer) | 399 | * Does NOT free the TFD itself (which is within circular buffer) |
408 | */ | 400 | */ |
409 | static void iwl_pcie_txq_free_tfd(struct iwl_trans *trans, struct iwl_txq *txq, | 401 | static void iwl_pcie_txq_free_tfd(struct iwl_trans *trans, struct iwl_txq *txq) |
410 | enum dma_data_direction dma_dir) | ||
411 | { | 402 | { |
412 | struct iwl_tfd *tfd_tmp = txq->tfds; | 403 | struct iwl_tfd *tfd_tmp = txq->tfds; |
413 | 404 | ||
@@ -418,8 +409,7 @@ static void iwl_pcie_txq_free_tfd(struct iwl_trans *trans, struct iwl_txq *txq, | |||
418 | lockdep_assert_held(&txq->lock); | 409 | lockdep_assert_held(&txq->lock); |
419 | 410 | ||
420 | /* We have only q->n_window txq->entries, but we use q->n_bd tfds */ | 411 | /* We have only q->n_window txq->entries, but we use q->n_bd tfds */ |
421 | iwl_pcie_tfd_unmap(trans, &txq->entries[idx].meta, &tfd_tmp[rd_ptr], | 412 | iwl_pcie_tfd_unmap(trans, &txq->entries[idx].meta, &tfd_tmp[rd_ptr]); |
422 | dma_dir); | ||
423 | 413 | ||
424 | /* free SKB */ | 414 | /* free SKB */ |
425 | if (txq->entries) { | 415 | if (txq->entries) { |
@@ -479,6 +469,7 @@ static int iwl_pcie_txq_alloc(struct iwl_trans *trans, | |||
479 | { | 469 | { |
480 | struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); | 470 | struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); |
481 | size_t tfd_sz = sizeof(struct iwl_tfd) * TFD_QUEUE_SIZE_MAX; | 471 | size_t tfd_sz = sizeof(struct iwl_tfd) * TFD_QUEUE_SIZE_MAX; |
472 | size_t scratchbuf_sz; | ||
482 | int i; | 473 | int i; |
483 | 474 | ||
484 | if (WARN_ON(txq->entries || txq->tfds)) | 475 | if (WARN_ON(txq->entries || txq->tfds)) |
@@ -514,9 +505,25 @@ static int iwl_pcie_txq_alloc(struct iwl_trans *trans, | |||
514 | IWL_ERR(trans, "dma_alloc_coherent(%zd) failed\n", tfd_sz); | 505 | IWL_ERR(trans, "dma_alloc_coherent(%zd) failed\n", tfd_sz); |
515 | goto error; | 506 | goto error; |
516 | } | 507 | } |
508 | |||
509 | BUILD_BUG_ON(IWL_HCMD_SCRATCHBUF_SIZE != sizeof(*txq->scratchbufs)); | ||
510 | BUILD_BUG_ON(offsetof(struct iwl_pcie_txq_scratch_buf, scratch) != | ||
511 | sizeof(struct iwl_cmd_header) + | ||
512 | offsetof(struct iwl_tx_cmd, scratch)); | ||
513 | |||
514 | scratchbuf_sz = sizeof(*txq->scratchbufs) * slots_num; | ||
515 | |||
516 | txq->scratchbufs = dma_alloc_coherent(trans->dev, scratchbuf_sz, | ||
517 | &txq->scratchbufs_dma, | ||
518 | GFP_KERNEL); | ||
519 | if (!txq->scratchbufs) | ||
520 | goto err_free_tfds; | ||
521 | |||
517 | txq->q.id = txq_id; | 522 | txq->q.id = txq_id; |
518 | 523 | ||
519 | return 0; | 524 | return 0; |
525 | err_free_tfds: | ||
526 | dma_free_coherent(trans->dev, tfd_sz, txq->tfds, txq->q.dma_addr); | ||
520 | error: | 527 | error: |
521 | if (txq->entries && txq_id == trans_pcie->cmd_queue) | 528 | if (txq->entries && txq_id == trans_pcie->cmd_queue) |
522 | for (i = 0; i < slots_num; i++) | 529 | for (i = 0; i < slots_num; i++) |
@@ -565,22 +572,13 @@ static void iwl_pcie_txq_unmap(struct iwl_trans *trans, int txq_id) | |||
565 | struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); | 572 | struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); |
566 | struct iwl_txq *txq = &trans_pcie->txq[txq_id]; | 573 | struct iwl_txq *txq = &trans_pcie->txq[txq_id]; |
567 | struct iwl_queue *q = &txq->q; | 574 | struct iwl_queue *q = &txq->q; |
568 | enum dma_data_direction dma_dir; | ||
569 | 575 | ||
570 | if (!q->n_bd) | 576 | if (!q->n_bd) |
571 | return; | 577 | return; |
572 | 578 | ||
573 | /* In the command queue, all the TBs are mapped as BIDI | ||
574 | * so unmap them as such. | ||
575 | */ | ||
576 | if (txq_id == trans_pcie->cmd_queue) | ||
577 | dma_dir = DMA_BIDIRECTIONAL; | ||
578 | else | ||
579 | dma_dir = DMA_TO_DEVICE; | ||
580 | |||
581 | spin_lock_bh(&txq->lock); | 579 | spin_lock_bh(&txq->lock); |
582 | while (q->write_ptr != q->read_ptr) { | 580 | while (q->write_ptr != q->read_ptr) { |
583 | iwl_pcie_txq_free_tfd(trans, txq, dma_dir); | 581 | iwl_pcie_txq_free_tfd(trans, txq); |
584 | q->read_ptr = iwl_queue_inc_wrap(q->read_ptr, q->n_bd); | 582 | q->read_ptr = iwl_queue_inc_wrap(q->read_ptr, q->n_bd); |
585 | } | 583 | } |
586 | spin_unlock_bh(&txq->lock); | 584 | spin_unlock_bh(&txq->lock); |
@@ -610,7 +608,6 @@ static void iwl_pcie_txq_free(struct iwl_trans *trans, int txq_id) | |||
610 | if (txq_id == trans_pcie->cmd_queue) | 608 | if (txq_id == trans_pcie->cmd_queue) |
611 | for (i = 0; i < txq->q.n_window; i++) { | 609 | for (i = 0; i < txq->q.n_window; i++) { |
612 | kfree(txq->entries[i].cmd); | 610 | kfree(txq->entries[i].cmd); |
613 | kfree(txq->entries[i].copy_cmd); | ||
614 | kfree(txq->entries[i].free_buf); | 611 | kfree(txq->entries[i].free_buf); |
615 | } | 612 | } |
616 | 613 | ||
@@ -619,6 +616,10 @@ static void iwl_pcie_txq_free(struct iwl_trans *trans, int txq_id) | |||
619 | dma_free_coherent(dev, sizeof(struct iwl_tfd) * | 616 | dma_free_coherent(dev, sizeof(struct iwl_tfd) * |
620 | txq->q.n_bd, txq->tfds, txq->q.dma_addr); | 617 | txq->q.n_bd, txq->tfds, txq->q.dma_addr); |
621 | txq->q.dma_addr = 0; | 618 | txq->q.dma_addr = 0; |
619 | |||
620 | dma_free_coherent(dev, | ||
621 | sizeof(*txq->scratchbufs) * txq->q.n_window, | ||
622 | txq->scratchbufs, txq->scratchbufs_dma); | ||
622 | } | 623 | } |
623 | 624 | ||
624 | kfree(txq->entries); | 625 | kfree(txq->entries); |
@@ -962,7 +963,7 @@ void iwl_trans_pcie_reclaim(struct iwl_trans *trans, int txq_id, int ssn, | |||
962 | 963 | ||
963 | iwl_pcie_txq_inval_byte_cnt_tbl(trans, txq); | 964 | iwl_pcie_txq_inval_byte_cnt_tbl(trans, txq); |
964 | 965 | ||
965 | iwl_pcie_txq_free_tfd(trans, txq, DMA_TO_DEVICE); | 966 | iwl_pcie_txq_free_tfd(trans, txq); |
966 | } | 967 | } |
967 | 968 | ||
968 | iwl_pcie_txq_progress(trans_pcie, txq); | 969 | iwl_pcie_txq_progress(trans_pcie, txq); |
@@ -1152,29 +1153,29 @@ static int iwl_pcie_enqueue_hcmd(struct iwl_trans *trans, | |||
1152 | void *dup_buf = NULL; | 1153 | void *dup_buf = NULL; |
1153 | dma_addr_t phys_addr; | 1154 | dma_addr_t phys_addr; |
1154 | int idx; | 1155 | int idx; |
1155 | u16 copy_size, cmd_size, dma_size; | 1156 | u16 copy_size, cmd_size, scratch_size; |
1156 | bool had_nocopy = false; | 1157 | bool had_nocopy = false; |
1157 | int i; | 1158 | int i; |
1158 | u32 cmd_pos; | 1159 | u32 cmd_pos; |
1159 | const u8 *cmddata[IWL_MAX_CMD_TFDS]; | 1160 | const u8 *cmddata[IWL_MAX_CMD_TBS_PER_TFD]; |
1160 | u16 cmdlen[IWL_MAX_CMD_TFDS]; | 1161 | u16 cmdlen[IWL_MAX_CMD_TBS_PER_TFD]; |
1161 | 1162 | ||
1162 | copy_size = sizeof(out_cmd->hdr); | 1163 | copy_size = sizeof(out_cmd->hdr); |
1163 | cmd_size = sizeof(out_cmd->hdr); | 1164 | cmd_size = sizeof(out_cmd->hdr); |
1164 | 1165 | ||
1165 | /* need one for the header if the first is NOCOPY */ | 1166 | /* need one for the header if the first is NOCOPY */ |
1166 | BUILD_BUG_ON(IWL_MAX_CMD_TFDS > IWL_NUM_OF_TBS - 1); | 1167 | BUILD_BUG_ON(IWL_MAX_CMD_TBS_PER_TFD > IWL_NUM_OF_TBS - 1); |
1167 | 1168 | ||
1168 | for (i = 0; i < IWL_MAX_CMD_TFDS; i++) { | 1169 | for (i = 0; i < IWL_MAX_CMD_TBS_PER_TFD; i++) { |
1169 | cmddata[i] = cmd->data[i]; | 1170 | cmddata[i] = cmd->data[i]; |
1170 | cmdlen[i] = cmd->len[i]; | 1171 | cmdlen[i] = cmd->len[i]; |
1171 | 1172 | ||
1172 | if (!cmd->len[i]) | 1173 | if (!cmd->len[i]) |
1173 | continue; | 1174 | continue; |
1174 | 1175 | ||
1175 | /* need at least IWL_HCMD_MIN_COPY_SIZE copied */ | 1176 | /* need at least IWL_HCMD_SCRATCHBUF_SIZE copied */ |
1176 | if (copy_size < IWL_HCMD_MIN_COPY_SIZE) { | 1177 | if (copy_size < IWL_HCMD_SCRATCHBUF_SIZE) { |
1177 | int copy = IWL_HCMD_MIN_COPY_SIZE - copy_size; | 1178 | int copy = IWL_HCMD_SCRATCHBUF_SIZE - copy_size; |
1178 | 1179 | ||
1179 | if (copy > cmdlen[i]) | 1180 | if (copy > cmdlen[i]) |
1180 | copy = cmdlen[i]; | 1181 | copy = cmdlen[i]; |
@@ -1260,15 +1261,15 @@ static int iwl_pcie_enqueue_hcmd(struct iwl_trans *trans, | |||
1260 | /* and copy the data that needs to be copied */ | 1261 | /* and copy the data that needs to be copied */ |
1261 | cmd_pos = offsetof(struct iwl_device_cmd, payload); | 1262 | cmd_pos = offsetof(struct iwl_device_cmd, payload); |
1262 | copy_size = sizeof(out_cmd->hdr); | 1263 | copy_size = sizeof(out_cmd->hdr); |
1263 | for (i = 0; i < IWL_MAX_CMD_TFDS; i++) { | 1264 | for (i = 0; i < IWL_MAX_CMD_TBS_PER_TFD; i++) { |
1264 | int copy = 0; | 1265 | int copy = 0; |
1265 | 1266 | ||
1266 | if (!cmd->len) | 1267 | if (!cmd->len) |
1267 | continue; | 1268 | continue; |
1268 | 1269 | ||
1269 | /* need at least IWL_HCMD_MIN_COPY_SIZE copied */ | 1270 | /* need at least IWL_HCMD_SCRATCHBUF_SIZE copied */ |
1270 | if (copy_size < IWL_HCMD_MIN_COPY_SIZE) { | 1271 | if (copy_size < IWL_HCMD_SCRATCHBUF_SIZE) { |
1271 | copy = IWL_HCMD_MIN_COPY_SIZE - copy_size; | 1272 | copy = IWL_HCMD_SCRATCHBUF_SIZE - copy_size; |
1272 | 1273 | ||
1273 | if (copy > cmd->len[i]) | 1274 | if (copy > cmd->len[i]) |
1274 | copy = cmd->len[i]; | 1275 | copy = cmd->len[i]; |
@@ -1286,50 +1287,38 @@ static int iwl_pcie_enqueue_hcmd(struct iwl_trans *trans, | |||
1286 | } | 1287 | } |
1287 | } | 1288 | } |
1288 | 1289 | ||
1289 | WARN_ON_ONCE(txq->entries[idx].copy_cmd); | ||
1290 | |||
1291 | /* | ||
1292 | * since out_cmd will be the source address of the FH, it will write | ||
1293 | * the retry count there. So when the user needs to receivce the HCMD | ||
1294 | * that corresponds to the response in the response handler, it needs | ||
1295 | * to set CMD_WANT_HCMD. | ||
1296 | */ | ||
1297 | if (cmd->flags & CMD_WANT_HCMD) { | ||
1298 | txq->entries[idx].copy_cmd = | ||
1299 | kmemdup(out_cmd, cmd_pos, GFP_ATOMIC); | ||
1300 | if (unlikely(!txq->entries[idx].copy_cmd)) { | ||
1301 | idx = -ENOMEM; | ||
1302 | goto out; | ||
1303 | } | ||
1304 | } | ||
1305 | |||
1306 | IWL_DEBUG_HC(trans, | 1290 | IWL_DEBUG_HC(trans, |
1307 | "Sending command %s (#%x), seq: 0x%04X, %d bytes at %d[%d]:%d\n", | 1291 | "Sending command %s (#%x), seq: 0x%04X, %d bytes at %d[%d]:%d\n", |
1308 | get_cmd_string(trans_pcie, out_cmd->hdr.cmd), | 1292 | get_cmd_string(trans_pcie, out_cmd->hdr.cmd), |
1309 | out_cmd->hdr.cmd, le16_to_cpu(out_cmd->hdr.sequence), | 1293 | out_cmd->hdr.cmd, le16_to_cpu(out_cmd->hdr.sequence), |
1310 | cmd_size, q->write_ptr, idx, trans_pcie->cmd_queue); | 1294 | cmd_size, q->write_ptr, idx, trans_pcie->cmd_queue); |
1311 | 1295 | ||
1312 | /* | 1296 | /* start the TFD with the scratchbuf */ |
1313 | * If the entire command is smaller than IWL_HCMD_MIN_COPY_SIZE, we must | 1297 | scratch_size = min_t(int, copy_size, IWL_HCMD_SCRATCHBUF_SIZE); |
1314 | * still map at least that many bytes for the hardware to write back to. | 1298 | memcpy(&txq->scratchbufs[q->write_ptr], &out_cmd->hdr, scratch_size); |
1315 | * We have enough space, so that's not a problem. | 1299 | iwl_pcie_txq_build_tfd(trans, txq, |
1316 | */ | 1300 | iwl_pcie_get_scratchbuf_dma(txq, q->write_ptr), |
1317 | dma_size = max_t(u16, copy_size, IWL_HCMD_MIN_COPY_SIZE); | 1301 | scratch_size, 1); |
1302 | |||
1303 | /* map first command fragment, if any remains */ | ||
1304 | if (copy_size > scratch_size) { | ||
1305 | phys_addr = dma_map_single(trans->dev, | ||
1306 | ((u8 *)&out_cmd->hdr) + scratch_size, | ||
1307 | copy_size - scratch_size, | ||
1308 | DMA_TO_DEVICE); | ||
1309 | if (dma_mapping_error(trans->dev, phys_addr)) { | ||
1310 | iwl_pcie_tfd_unmap(trans, out_meta, | ||
1311 | &txq->tfds[q->write_ptr]); | ||
1312 | idx = -ENOMEM; | ||
1313 | goto out; | ||
1314 | } | ||
1318 | 1315 | ||
1319 | phys_addr = dma_map_single(trans->dev, &out_cmd->hdr, dma_size, | 1316 | iwl_pcie_txq_build_tfd(trans, txq, phys_addr, |
1320 | DMA_BIDIRECTIONAL); | 1317 | copy_size - scratch_size, 0); |
1321 | if (unlikely(dma_mapping_error(trans->dev, phys_addr))) { | ||
1322 | idx = -ENOMEM; | ||
1323 | goto out; | ||
1324 | } | 1318 | } |
1325 | 1319 | ||
1326 | dma_unmap_addr_set(out_meta, mapping, phys_addr); | ||
1327 | dma_unmap_len_set(out_meta, len, dma_size); | ||
1328 | |||
1329 | iwl_pcie_txq_build_tfd(trans, txq, phys_addr, copy_size, 1); | ||
1330 | |||
1331 | /* map the remaining (adjusted) nocopy/dup fragments */ | 1320 | /* map the remaining (adjusted) nocopy/dup fragments */ |
1332 | for (i = 0; i < IWL_MAX_CMD_TFDS; i++) { | 1321 | for (i = 0; i < IWL_MAX_CMD_TBS_PER_TFD; i++) { |
1333 | const void *data = cmddata[i]; | 1322 | const void *data = cmddata[i]; |
1334 | 1323 | ||
1335 | if (!cmdlen[i]) | 1324 | if (!cmdlen[i]) |
@@ -1340,11 +1329,10 @@ static int iwl_pcie_enqueue_hcmd(struct iwl_trans *trans, | |||
1340 | if (cmd->dataflags[i] & IWL_HCMD_DFL_DUP) | 1329 | if (cmd->dataflags[i] & IWL_HCMD_DFL_DUP) |
1341 | data = dup_buf; | 1330 | data = dup_buf; |
1342 | phys_addr = dma_map_single(trans->dev, (void *)data, | 1331 | phys_addr = dma_map_single(trans->dev, (void *)data, |
1343 | cmdlen[i], DMA_BIDIRECTIONAL); | 1332 | cmdlen[i], DMA_TO_DEVICE); |
1344 | if (dma_mapping_error(trans->dev, phys_addr)) { | 1333 | if (dma_mapping_error(trans->dev, phys_addr)) { |
1345 | iwl_pcie_tfd_unmap(trans, out_meta, | 1334 | iwl_pcie_tfd_unmap(trans, out_meta, |
1346 | &txq->tfds[q->write_ptr], | 1335 | &txq->tfds[q->write_ptr]); |
1347 | DMA_BIDIRECTIONAL); | ||
1348 | idx = -ENOMEM; | 1336 | idx = -ENOMEM; |
1349 | goto out; | 1337 | goto out; |
1350 | } | 1338 | } |
@@ -1418,7 +1406,7 @@ void iwl_pcie_hcmd_complete(struct iwl_trans *trans, | |||
1418 | cmd = txq->entries[cmd_index].cmd; | 1406 | cmd = txq->entries[cmd_index].cmd; |
1419 | meta = &txq->entries[cmd_index].meta; | 1407 | meta = &txq->entries[cmd_index].meta; |
1420 | 1408 | ||
1421 | iwl_pcie_tfd_unmap(trans, meta, &txq->tfds[index], DMA_BIDIRECTIONAL); | 1409 | iwl_pcie_tfd_unmap(trans, meta, &txq->tfds[index]); |
1422 | 1410 | ||
1423 | /* Input error checking is done when commands are added to queue. */ | 1411 | /* Input error checking is done when commands are added to queue. */ |
1424 | if (meta->flags & CMD_WANT_SKB) { | 1412 | if (meta->flags & CMD_WANT_SKB) { |
@@ -1597,10 +1585,9 @@ int iwl_trans_pcie_tx(struct iwl_trans *trans, struct sk_buff *skb, | |||
1597 | struct iwl_cmd_meta *out_meta; | 1585 | struct iwl_cmd_meta *out_meta; |
1598 | struct iwl_txq *txq; | 1586 | struct iwl_txq *txq; |
1599 | struct iwl_queue *q; | 1587 | struct iwl_queue *q; |
1600 | dma_addr_t phys_addr = 0; | 1588 | dma_addr_t tb0_phys, tb1_phys, scratch_phys; |
1601 | dma_addr_t txcmd_phys; | 1589 | void *tb1_addr; |
1602 | dma_addr_t scratch_phys; | 1590 | u16 len, tb1_len, tb2_len; |
1603 | u16 len, firstlen, secondlen; | ||
1604 | u8 wait_write_ptr = 0; | 1591 | u8 wait_write_ptr = 0; |
1605 | __le16 fc = hdr->frame_control; | 1592 | __le16 fc = hdr->frame_control; |
1606 | u8 hdr_len = ieee80211_hdrlen(fc); | 1593 | u8 hdr_len = ieee80211_hdrlen(fc); |
@@ -1638,85 +1625,80 @@ int iwl_trans_pcie_tx(struct iwl_trans *trans, struct sk_buff *skb, | |||
1638 | cpu_to_le16((u16)(QUEUE_TO_SEQ(txq_id) | | 1625 | cpu_to_le16((u16)(QUEUE_TO_SEQ(txq_id) | |
1639 | INDEX_TO_SEQ(q->write_ptr))); | 1626 | INDEX_TO_SEQ(q->write_ptr))); |
1640 | 1627 | ||
1628 | tb0_phys = iwl_pcie_get_scratchbuf_dma(txq, q->write_ptr); | ||
1629 | scratch_phys = tb0_phys + sizeof(struct iwl_cmd_header) + | ||
1630 | offsetof(struct iwl_tx_cmd, scratch); | ||
1631 | |||
1632 | tx_cmd->dram_lsb_ptr = cpu_to_le32(scratch_phys); | ||
1633 | tx_cmd->dram_msb_ptr = iwl_get_dma_hi_addr(scratch_phys); | ||
1634 | |||
1641 | /* Set up first empty entry in queue's array of Tx/cmd buffers */ | 1635 | /* Set up first empty entry in queue's array of Tx/cmd buffers */ |
1642 | out_meta = &txq->entries[q->write_ptr].meta; | 1636 | out_meta = &txq->entries[q->write_ptr].meta; |
1643 | 1637 | ||
1644 | /* | 1638 | /* |
1645 | * Use the first empty entry in this queue's command buffer array | 1639 | * The second TB (tb1) points to the remainder of the TX command |
1646 | * to contain the Tx command and MAC header concatenated together | 1640 | * and the 802.11 header - dword aligned size |
1647 | * (payload data will be in another buffer). | 1641 | * (This calculation modifies the TX command, so do it before the |
1648 | * Size of this varies, due to varying MAC header length. | 1642 | * setup of the first TB) |
1649 | * If end is not dword aligned, we'll have 2 extra bytes at the end | ||
1650 | * of the MAC header (device reads on dword boundaries). | ||
1651 | * We'll tell device about this padding later. | ||
1652 | */ | 1643 | */ |
1653 | len = sizeof(struct iwl_tx_cmd) + | 1644 | len = sizeof(struct iwl_tx_cmd) + sizeof(struct iwl_cmd_header) + |
1654 | sizeof(struct iwl_cmd_header) + hdr_len; | 1645 | hdr_len - IWL_HCMD_SCRATCHBUF_SIZE; |
1655 | firstlen = (len + 3) & ~3; | 1646 | tb1_len = (len + 3) & ~3; |
1656 | 1647 | ||
1657 | /* Tell NIC about any 2-byte padding after MAC header */ | 1648 | /* Tell NIC about any 2-byte padding after MAC header */ |
1658 | if (firstlen != len) | 1649 | if (tb1_len != len) |
1659 | tx_cmd->tx_flags |= TX_CMD_FLG_MH_PAD_MSK; | 1650 | tx_cmd->tx_flags |= TX_CMD_FLG_MH_PAD_MSK; |
1660 | 1651 | ||
1661 | /* Physical address of this Tx command's header (not MAC header!), | 1652 | /* The first TB points to the scratchbuf data - min_copy bytes */ |
1662 | * within command buffer array. */ | 1653 | memcpy(&txq->scratchbufs[q->write_ptr], &dev_cmd->hdr, |
1663 | txcmd_phys = dma_map_single(trans->dev, | 1654 | IWL_HCMD_SCRATCHBUF_SIZE); |
1664 | &dev_cmd->hdr, firstlen, | 1655 | iwl_pcie_txq_build_tfd(trans, txq, tb0_phys, |
1665 | DMA_BIDIRECTIONAL); | 1656 | IWL_HCMD_SCRATCHBUF_SIZE, 1); |
1666 | if (unlikely(dma_mapping_error(trans->dev, txcmd_phys))) | ||
1667 | goto out_err; | ||
1668 | dma_unmap_addr_set(out_meta, mapping, txcmd_phys); | ||
1669 | dma_unmap_len_set(out_meta, len, firstlen); | ||
1670 | 1657 | ||
1671 | if (!ieee80211_has_morefrags(fc)) { | 1658 | /* there must be data left over for TB1 or this code must be changed */ |
1672 | txq->need_update = 1; | 1659 | BUILD_BUG_ON(sizeof(struct iwl_tx_cmd) < IWL_HCMD_SCRATCHBUF_SIZE); |
1673 | } else { | ||
1674 | wait_write_ptr = 1; | ||
1675 | txq->need_update = 0; | ||
1676 | } | ||
1677 | 1660 | ||
1678 | /* Set up TFD's 2nd entry to point directly to remainder of skb, | 1661 | /* map the data for TB1 */ |
1679 | * if any (802.11 null frames have no payload). */ | 1662 | tb1_addr = ((u8 *)&dev_cmd->hdr) + IWL_HCMD_SCRATCHBUF_SIZE; |
1680 | secondlen = skb->len - hdr_len; | 1663 | tb1_phys = dma_map_single(trans->dev, tb1_addr, tb1_len, DMA_TO_DEVICE); |
1681 | if (secondlen > 0) { | 1664 | if (unlikely(dma_mapping_error(trans->dev, tb1_phys))) |
1682 | phys_addr = dma_map_single(trans->dev, skb->data + hdr_len, | 1665 | goto out_err; |
1683 | secondlen, DMA_TO_DEVICE); | 1666 | iwl_pcie_txq_build_tfd(trans, txq, tb1_phys, tb1_len, 0); |
1684 | if (unlikely(dma_mapping_error(trans->dev, phys_addr))) { | 1667 | |
1685 | dma_unmap_single(trans->dev, | 1668 | /* |
1686 | dma_unmap_addr(out_meta, mapping), | 1669 | * Set up TFD's third entry to point directly to remainder |
1687 | dma_unmap_len(out_meta, len), | 1670 | * of skb, if any (802.11 null frames have no payload). |
1688 | DMA_BIDIRECTIONAL); | 1671 | */ |
1672 | tb2_len = skb->len - hdr_len; | ||
1673 | if (tb2_len > 0) { | ||
1674 | dma_addr_t tb2_phys = dma_map_single(trans->dev, | ||
1675 | skb->data + hdr_len, | ||
1676 | tb2_len, DMA_TO_DEVICE); | ||
1677 | if (unlikely(dma_mapping_error(trans->dev, tb2_phys))) { | ||
1678 | iwl_pcie_tfd_unmap(trans, out_meta, | ||
1679 | &txq->tfds[q->write_ptr]); | ||
1689 | goto out_err; | 1680 | goto out_err; |
1690 | } | 1681 | } |
1682 | iwl_pcie_txq_build_tfd(trans, txq, tb2_phys, tb2_len, 0); | ||
1691 | } | 1683 | } |
1692 | 1684 | ||
1693 | /* Attach buffers to TFD */ | ||
1694 | iwl_pcie_txq_build_tfd(trans, txq, txcmd_phys, firstlen, 1); | ||
1695 | if (secondlen > 0) | ||
1696 | iwl_pcie_txq_build_tfd(trans, txq, phys_addr, secondlen, 0); | ||
1697 | |||
1698 | scratch_phys = txcmd_phys + sizeof(struct iwl_cmd_header) + | ||
1699 | offsetof(struct iwl_tx_cmd, scratch); | ||
1700 | |||
1701 | /* take back ownership of DMA buffer to enable update */ | ||
1702 | dma_sync_single_for_cpu(trans->dev, txcmd_phys, firstlen, | ||
1703 | DMA_BIDIRECTIONAL); | ||
1704 | tx_cmd->dram_lsb_ptr = cpu_to_le32(scratch_phys); | ||
1705 | tx_cmd->dram_msb_ptr = iwl_get_dma_hi_addr(scratch_phys); | ||
1706 | |||
1707 | /* Set up entry for this TFD in Tx byte-count array */ | 1685 | /* Set up entry for this TFD in Tx byte-count array */ |
1708 | iwl_pcie_txq_update_byte_cnt_tbl(trans, txq, le16_to_cpu(tx_cmd->len)); | 1686 | iwl_pcie_txq_update_byte_cnt_tbl(trans, txq, le16_to_cpu(tx_cmd->len)); |
1709 | 1687 | ||
1710 | dma_sync_single_for_device(trans->dev, txcmd_phys, firstlen, | ||
1711 | DMA_BIDIRECTIONAL); | ||
1712 | |||
1713 | trace_iwlwifi_dev_tx(trans->dev, skb, | 1688 | trace_iwlwifi_dev_tx(trans->dev, skb, |
1714 | &txq->tfds[txq->q.write_ptr], | 1689 | &txq->tfds[txq->q.write_ptr], |
1715 | sizeof(struct iwl_tfd), | 1690 | sizeof(struct iwl_tfd), |
1716 | &dev_cmd->hdr, firstlen, | 1691 | &dev_cmd->hdr, IWL_HCMD_SCRATCHBUF_SIZE + tb1_len, |
1717 | skb->data + hdr_len, secondlen); | 1692 | skb->data + hdr_len, tb2_len); |
1718 | trace_iwlwifi_dev_tx_data(trans->dev, skb, | 1693 | trace_iwlwifi_dev_tx_data(trans->dev, skb, |
1719 | skb->data + hdr_len, secondlen); | 1694 | skb->data + hdr_len, tb2_len); |
1695 | |||
1696 | if (!ieee80211_has_morefrags(fc)) { | ||
1697 | txq->need_update = 1; | ||
1698 | } else { | ||
1699 | wait_write_ptr = 1; | ||
1700 | txq->need_update = 0; | ||
1701 | } | ||
1720 | 1702 | ||
1721 | /* start timer if queue currently empty */ | 1703 | /* start timer if queue currently empty */ |
1722 | if (txq->need_update && q->read_ptr == q->write_ptr && | 1704 | if (txq->need_update && q->read_ptr == q->write_ptr && |
diff --git a/drivers/net/wireless/mwifiex/join.c b/drivers/net/wireless/mwifiex/join.c index 246aa62a4817..2fe0ceba4400 100644 --- a/drivers/net/wireless/mwifiex/join.c +++ b/drivers/net/wireless/mwifiex/join.c | |||
@@ -1117,10 +1117,9 @@ mwifiex_cmd_802_11_ad_hoc_join(struct mwifiex_private *priv, | |||
1117 | adhoc_join->bss_descriptor.bssid, | 1117 | adhoc_join->bss_descriptor.bssid, |
1118 | adhoc_join->bss_descriptor.ssid); | 1118 | adhoc_join->bss_descriptor.ssid); |
1119 | 1119 | ||
1120 | for (i = 0; bss_desc->supported_rates[i] && | 1120 | for (i = 0; i < MWIFIEX_SUPPORTED_RATES && |
1121 | i < MWIFIEX_SUPPORTED_RATES; | 1121 | bss_desc->supported_rates[i]; i++) |
1122 | i++) | 1122 | ; |
1123 | ; | ||
1124 | rates_size = i; | 1123 | rates_size = i; |
1125 | 1124 | ||
1126 | /* Copy Data Rates from the Rates recorded in scan response */ | 1125 | /* Copy Data Rates from the Rates recorded in scan response */ |
diff --git a/drivers/net/wireless/rt2x00/Kconfig b/drivers/net/wireless/rt2x00/Kconfig index 44d6ead43341..2bf4efa33186 100644 --- a/drivers/net/wireless/rt2x00/Kconfig +++ b/drivers/net/wireless/rt2x00/Kconfig | |||
@@ -55,10 +55,10 @@ config RT61PCI | |||
55 | 55 | ||
56 | config RT2800PCI | 56 | config RT2800PCI |
57 | tristate "Ralink rt27xx/rt28xx/rt30xx (PCI/PCIe/PCMCIA) support" | 57 | tristate "Ralink rt27xx/rt28xx/rt30xx (PCI/PCIe/PCMCIA) support" |
58 | depends on PCI || RALINK_RT288X || RALINK_RT305X | 58 | depends on PCI || SOC_RT288X || SOC_RT305X |
59 | select RT2800_LIB | 59 | select RT2800_LIB |
60 | select RT2X00_LIB_PCI if PCI | 60 | select RT2X00_LIB_PCI if PCI |
61 | select RT2X00_LIB_SOC if RALINK_RT288X || RALINK_RT305X | 61 | select RT2X00_LIB_SOC if SOC_RT288X || SOC_RT305X |
62 | select RT2X00_LIB_FIRMWARE | 62 | select RT2X00_LIB_FIRMWARE |
63 | select RT2X00_LIB_CRYPTO | 63 | select RT2X00_LIB_CRYPTO |
64 | select CRC_CCITT | 64 | select CRC_CCITT |
diff --git a/drivers/net/wireless/rt2x00/rt2800pci.c b/drivers/net/wireless/rt2x00/rt2800pci.c index 48a01aa21f1c..ded73da4de0b 100644 --- a/drivers/net/wireless/rt2x00/rt2800pci.c +++ b/drivers/net/wireless/rt2x00/rt2800pci.c | |||
@@ -89,7 +89,7 @@ static void rt2800pci_mcu_status(struct rt2x00_dev *rt2x00dev, const u8 token) | |||
89 | rt2x00pci_register_write(rt2x00dev, H2M_MAILBOX_CID, ~0); | 89 | rt2x00pci_register_write(rt2x00dev, H2M_MAILBOX_CID, ~0); |
90 | } | 90 | } |
91 | 91 | ||
92 | #if defined(CONFIG_RALINK_RT288X) || defined(CONFIG_RALINK_RT305X) | 92 | #if defined(CONFIG_SOC_RT288X) || defined(CONFIG_SOC_RT305X) |
93 | static int rt2800pci_read_eeprom_soc(struct rt2x00_dev *rt2x00dev) | 93 | static int rt2800pci_read_eeprom_soc(struct rt2x00_dev *rt2x00dev) |
94 | { | 94 | { |
95 | void __iomem *base_addr = ioremap(0x1F040000, EEPROM_SIZE); | 95 | void __iomem *base_addr = ioremap(0x1F040000, EEPROM_SIZE); |
@@ -107,7 +107,7 @@ static inline int rt2800pci_read_eeprom_soc(struct rt2x00_dev *rt2x00dev) | |||
107 | { | 107 | { |
108 | return -ENOMEM; | 108 | return -ENOMEM; |
109 | } | 109 | } |
110 | #endif /* CONFIG_RALINK_RT288X || CONFIG_RALINK_RT305X */ | 110 | #endif /* CONFIG_SOC_RT288X || CONFIG_SOC_RT305X */ |
111 | 111 | ||
112 | #ifdef CONFIG_PCI | 112 | #ifdef CONFIG_PCI |
113 | static void rt2800pci_eepromregister_read(struct eeprom_93cx6 *eeprom) | 113 | static void rt2800pci_eepromregister_read(struct eeprom_93cx6 *eeprom) |
@@ -1177,7 +1177,7 @@ MODULE_DEVICE_TABLE(pci, rt2800pci_device_table); | |||
1177 | #endif /* CONFIG_PCI */ | 1177 | #endif /* CONFIG_PCI */ |
1178 | MODULE_LICENSE("GPL"); | 1178 | MODULE_LICENSE("GPL"); |
1179 | 1179 | ||
1180 | #if defined(CONFIG_RALINK_RT288X) || defined(CONFIG_RALINK_RT305X) | 1180 | #if defined(CONFIG_SOC_RT288X) || defined(CONFIG_SOC_RT305X) |
1181 | static int rt2800soc_probe(struct platform_device *pdev) | 1181 | static int rt2800soc_probe(struct platform_device *pdev) |
1182 | { | 1182 | { |
1183 | return rt2x00soc_probe(pdev, &rt2800pci_ops); | 1183 | return rt2x00soc_probe(pdev, &rt2800pci_ops); |
@@ -1194,7 +1194,7 @@ static struct platform_driver rt2800soc_driver = { | |||
1194 | .suspend = rt2x00soc_suspend, | 1194 | .suspend = rt2x00soc_suspend, |
1195 | .resume = rt2x00soc_resume, | 1195 | .resume = rt2x00soc_resume, |
1196 | }; | 1196 | }; |
1197 | #endif /* CONFIG_RALINK_RT288X || CONFIG_RALINK_RT305X */ | 1197 | #endif /* CONFIG_SOC_RT288X || CONFIG_SOC_RT305X */ |
1198 | 1198 | ||
1199 | #ifdef CONFIG_PCI | 1199 | #ifdef CONFIG_PCI |
1200 | static int rt2800pci_probe(struct pci_dev *pci_dev, | 1200 | static int rt2800pci_probe(struct pci_dev *pci_dev, |
@@ -1217,7 +1217,7 @@ static int __init rt2800pci_init(void) | |||
1217 | { | 1217 | { |
1218 | int ret = 0; | 1218 | int ret = 0; |
1219 | 1219 | ||
1220 | #if defined(CONFIG_RALINK_RT288X) || defined(CONFIG_RALINK_RT305X) | 1220 | #if defined(CONFIG_SOC_RT288X) || defined(CONFIG_SOC_RT305X) |
1221 | ret = platform_driver_register(&rt2800soc_driver); | 1221 | ret = platform_driver_register(&rt2800soc_driver); |
1222 | if (ret) | 1222 | if (ret) |
1223 | return ret; | 1223 | return ret; |
@@ -1225,7 +1225,7 @@ static int __init rt2800pci_init(void) | |||
1225 | #ifdef CONFIG_PCI | 1225 | #ifdef CONFIG_PCI |
1226 | ret = pci_register_driver(&rt2800pci_driver); | 1226 | ret = pci_register_driver(&rt2800pci_driver); |
1227 | if (ret) { | 1227 | if (ret) { |
1228 | #if defined(CONFIG_RALINK_RT288X) || defined(CONFIG_RALINK_RT305X) | 1228 | #if defined(CONFIG_SOC_RT288X) || defined(CONFIG_SOC_RT305X) |
1229 | platform_driver_unregister(&rt2800soc_driver); | 1229 | platform_driver_unregister(&rt2800soc_driver); |
1230 | #endif | 1230 | #endif |
1231 | return ret; | 1231 | return ret; |
@@ -1240,7 +1240,7 @@ static void __exit rt2800pci_exit(void) | |||
1240 | #ifdef CONFIG_PCI | 1240 | #ifdef CONFIG_PCI |
1241 | pci_unregister_driver(&rt2800pci_driver); | 1241 | pci_unregister_driver(&rt2800pci_driver); |
1242 | #endif | 1242 | #endif |
1243 | #if defined(CONFIG_RALINK_RT288X) || defined(CONFIG_RALINK_RT305X) | 1243 | #if defined(CONFIG_SOC_RT288X) || defined(CONFIG_SOC_RT305X) |
1244 | platform_driver_unregister(&rt2800soc_driver); | 1244 | platform_driver_unregister(&rt2800soc_driver); |
1245 | #endif | 1245 | #endif |
1246 | } | 1246 | } |
diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/hw.c b/drivers/net/wireless/rtlwifi/rtl8192cu/hw.c index b1ccff474c79..c08d0f4c5f3d 100644 --- a/drivers/net/wireless/rtlwifi/rtl8192cu/hw.c +++ b/drivers/net/wireless/rtlwifi/rtl8192cu/hw.c | |||
@@ -1377,74 +1377,57 @@ void rtl92cu_card_disable(struct ieee80211_hw *hw) | |||
1377 | 1377 | ||
1378 | void rtl92cu_set_check_bssid(struct ieee80211_hw *hw, bool check_bssid) | 1378 | void rtl92cu_set_check_bssid(struct ieee80211_hw *hw, bool check_bssid) |
1379 | { | 1379 | { |
1380 | /* dummy routine needed for callback from rtl_op_configure_filter() */ | ||
1381 | } | ||
1382 | |||
1383 | /*========================================================================== */ | ||
1384 | |||
1385 | static void _rtl92cu_set_check_bssid(struct ieee80211_hw *hw, | ||
1386 | enum nl80211_iftype type) | ||
1387 | { | ||
1388 | struct rtl_priv *rtlpriv = rtl_priv(hw); | 1380 | struct rtl_priv *rtlpriv = rtl_priv(hw); |
1389 | u32 reg_rcr = rtl_read_dword(rtlpriv, REG_RCR); | ||
1390 | struct rtl_hal *rtlhal = rtl_hal(rtlpriv); | 1381 | struct rtl_hal *rtlhal = rtl_hal(rtlpriv); |
1391 | struct rtl_phy *rtlphy = &(rtlpriv->phy); | 1382 | u32 reg_rcr = rtl_read_dword(rtlpriv, REG_RCR); |
1392 | u8 filterout_non_associated_bssid = false; | ||
1393 | 1383 | ||
1394 | switch (type) { | 1384 | if (rtlpriv->psc.rfpwr_state != ERFON) |
1395 | case NL80211_IFTYPE_ADHOC: | 1385 | return; |
1396 | case NL80211_IFTYPE_STATION: | 1386 | |
1397 | filterout_non_associated_bssid = true; | 1387 | if (check_bssid) { |
1398 | break; | 1388 | u8 tmp; |
1399 | case NL80211_IFTYPE_UNSPECIFIED: | ||
1400 | case NL80211_IFTYPE_AP: | ||
1401 | default: | ||
1402 | break; | ||
1403 | } | ||
1404 | if (filterout_non_associated_bssid) { | ||
1405 | if (IS_NORMAL_CHIP(rtlhal->version)) { | 1389 | if (IS_NORMAL_CHIP(rtlhal->version)) { |
1406 | switch (rtlphy->current_io_type) { | 1390 | reg_rcr |= (RCR_CBSSID_DATA | RCR_CBSSID_BCN); |
1407 | case IO_CMD_RESUME_DM_BY_SCAN: | 1391 | tmp = BIT(4); |
1408 | reg_rcr |= (RCR_CBSSID_DATA | RCR_CBSSID_BCN); | ||
1409 | rtlpriv->cfg->ops->set_hw_reg(hw, | ||
1410 | HW_VAR_RCR, (u8 *)(®_rcr)); | ||
1411 | /* enable update TSF */ | ||
1412 | _rtl92cu_set_bcn_ctrl_reg(hw, 0, BIT(4)); | ||
1413 | break; | ||
1414 | case IO_CMD_PAUSE_DM_BY_SCAN: | ||
1415 | reg_rcr &= ~(RCR_CBSSID_DATA | RCR_CBSSID_BCN); | ||
1416 | rtlpriv->cfg->ops->set_hw_reg(hw, | ||
1417 | HW_VAR_RCR, (u8 *)(®_rcr)); | ||
1418 | /* disable update TSF */ | ||
1419 | _rtl92cu_set_bcn_ctrl_reg(hw, BIT(4), 0); | ||
1420 | break; | ||
1421 | } | ||
1422 | } else { | 1392 | } else { |
1423 | reg_rcr |= (RCR_CBSSID); | 1393 | reg_rcr |= RCR_CBSSID; |
1424 | rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_RCR, | 1394 | tmp = BIT(4) | BIT(5); |
1425 | (u8 *)(®_rcr)); | ||
1426 | _rtl92cu_set_bcn_ctrl_reg(hw, 0, (BIT(4)|BIT(5))); | ||
1427 | } | 1395 | } |
1428 | } else if (filterout_non_associated_bssid == false) { | 1396 | rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_RCR, |
1397 | (u8 *) (®_rcr)); | ||
1398 | _rtl92cu_set_bcn_ctrl_reg(hw, 0, tmp); | ||
1399 | } else { | ||
1400 | u8 tmp; | ||
1429 | if (IS_NORMAL_CHIP(rtlhal->version)) { | 1401 | if (IS_NORMAL_CHIP(rtlhal->version)) { |
1430 | reg_rcr &= (~(RCR_CBSSID_DATA | RCR_CBSSID_BCN)); | 1402 | reg_rcr &= ~(RCR_CBSSID_DATA | RCR_CBSSID_BCN); |
1431 | rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_RCR, | 1403 | tmp = BIT(4); |
1432 | (u8 *)(®_rcr)); | ||
1433 | _rtl92cu_set_bcn_ctrl_reg(hw, BIT(4), 0); | ||
1434 | } else { | 1404 | } else { |
1435 | reg_rcr &= (~RCR_CBSSID); | 1405 | reg_rcr &= ~RCR_CBSSID; |
1436 | rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_RCR, | 1406 | tmp = BIT(4) | BIT(5); |
1437 | (u8 *)(®_rcr)); | ||
1438 | _rtl92cu_set_bcn_ctrl_reg(hw, (BIT(4)|BIT(5)), 0); | ||
1439 | } | 1407 | } |
1408 | reg_rcr &= (~(RCR_CBSSID_DATA | RCR_CBSSID_BCN)); | ||
1409 | rtlpriv->cfg->ops->set_hw_reg(hw, | ||
1410 | HW_VAR_RCR, (u8 *) (®_rcr)); | ||
1411 | _rtl92cu_set_bcn_ctrl_reg(hw, tmp, 0); | ||
1440 | } | 1412 | } |
1441 | } | 1413 | } |
1442 | 1414 | ||
1415 | /*========================================================================== */ | ||
1416 | |||
1443 | int rtl92cu_set_network_type(struct ieee80211_hw *hw, enum nl80211_iftype type) | 1417 | int rtl92cu_set_network_type(struct ieee80211_hw *hw, enum nl80211_iftype type) |
1444 | { | 1418 | { |
1419 | struct rtl_priv *rtlpriv = rtl_priv(hw); | ||
1420 | |||
1445 | if (_rtl92cu_set_media_status(hw, type)) | 1421 | if (_rtl92cu_set_media_status(hw, type)) |
1446 | return -EOPNOTSUPP; | 1422 | return -EOPNOTSUPP; |
1447 | _rtl92cu_set_check_bssid(hw, type); | 1423 | |
1424 | if (rtlpriv->mac80211.link_state == MAC80211_LINKED) { | ||
1425 | if (type != NL80211_IFTYPE_AP) | ||
1426 | rtl92cu_set_check_bssid(hw, true); | ||
1427 | } else { | ||
1428 | rtl92cu_set_check_bssid(hw, false); | ||
1429 | } | ||
1430 | |||
1448 | return 0; | 1431 | return 0; |
1449 | } | 1432 | } |
1450 | 1433 | ||
@@ -2058,8 +2041,6 @@ void rtl92cu_update_hal_rate_table(struct ieee80211_hw *hw, | |||
2058 | (shortgi_rate << 4) | (shortgi_rate); | 2041 | (shortgi_rate << 4) | (shortgi_rate); |
2059 | } | 2042 | } |
2060 | rtl_write_dword(rtlpriv, REG_ARFR0 + ratr_index * 4, ratr_value); | 2043 | rtl_write_dword(rtlpriv, REG_ARFR0 + ratr_index * 4, ratr_value); |
2061 | RT_TRACE(rtlpriv, COMP_RATR, DBG_DMESG, "%x\n", | ||
2062 | rtl_read_dword(rtlpriv, REG_ARFR0)); | ||
2063 | } | 2044 | } |
2064 | 2045 | ||
2065 | void rtl92cu_update_hal_rate_mask(struct ieee80211_hw *hw, u8 rssi_level) | 2046 | void rtl92cu_update_hal_rate_mask(struct ieee80211_hw *hw, u8 rssi_level) |
diff --git a/drivers/pci/rom.c b/drivers/pci/rom.c index ab886b7ee327..b41ac7756a4b 100644 --- a/drivers/pci/rom.c +++ b/drivers/pci/rom.c | |||
@@ -100,6 +100,27 @@ size_t pci_get_rom_size(struct pci_dev *pdev, void __iomem *rom, size_t size) | |||
100 | return min((size_t)(image - rom), size); | 100 | return min((size_t)(image - rom), size); |
101 | } | 101 | } |
102 | 102 | ||
103 | static loff_t pci_find_rom(struct pci_dev *pdev, size_t *size) | ||
104 | { | ||
105 | struct resource *res = &pdev->resource[PCI_ROM_RESOURCE]; | ||
106 | loff_t start; | ||
107 | |||
108 | /* assign the ROM an address if it doesn't have one */ | ||
109 | if (res->parent == NULL && pci_assign_resource(pdev, PCI_ROM_RESOURCE)) | ||
110 | return 0; | ||
111 | start = pci_resource_start(pdev, PCI_ROM_RESOURCE); | ||
112 | *size = pci_resource_len(pdev, PCI_ROM_RESOURCE); | ||
113 | |||
114 | if (*size == 0) | ||
115 | return 0; | ||
116 | |||
117 | /* Enable ROM space decodes */ | ||
118 | if (pci_enable_rom(pdev)) | ||
119 | return 0; | ||
120 | |||
121 | return start; | ||
122 | } | ||
123 | |||
103 | /** | 124 | /** |
104 | * pci_map_rom - map a PCI ROM to kernel space | 125 | * pci_map_rom - map a PCI ROM to kernel space |
105 | * @pdev: pointer to pci device struct | 126 | * @pdev: pointer to pci device struct |
@@ -114,21 +135,15 @@ size_t pci_get_rom_size(struct pci_dev *pdev, void __iomem *rom, size_t size) | |||
114 | void __iomem *pci_map_rom(struct pci_dev *pdev, size_t *size) | 135 | void __iomem *pci_map_rom(struct pci_dev *pdev, size_t *size) |
115 | { | 136 | { |
116 | struct resource *res = &pdev->resource[PCI_ROM_RESOURCE]; | 137 | struct resource *res = &pdev->resource[PCI_ROM_RESOURCE]; |
117 | loff_t start; | 138 | loff_t start = 0; |
118 | void __iomem *rom; | 139 | void __iomem *rom; |
119 | 140 | ||
120 | /* | 141 | /* |
121 | * Some devices may provide ROMs via a source other than the BAR | ||
122 | */ | ||
123 | if (pdev->rom && pdev->romlen) { | ||
124 | *size = pdev->romlen; | ||
125 | return phys_to_virt(pdev->rom); | ||
126 | /* | ||
127 | * IORESOURCE_ROM_SHADOW set on x86, x86_64 and IA64 supports legacy | 142 | * IORESOURCE_ROM_SHADOW set on x86, x86_64 and IA64 supports legacy |
128 | * memory map if the VGA enable bit of the Bridge Control register is | 143 | * memory map if the VGA enable bit of the Bridge Control register is |
129 | * set for embedded VGA. | 144 | * set for embedded VGA. |
130 | */ | 145 | */ |
131 | } else if (res->flags & IORESOURCE_ROM_SHADOW) { | 146 | if (res->flags & IORESOURCE_ROM_SHADOW) { |
132 | /* primary video rom always starts here */ | 147 | /* primary video rom always starts here */ |
133 | start = (loff_t)0xC0000; | 148 | start = (loff_t)0xC0000; |
134 | *size = 0x20000; /* cover C000:0 through E000:0 */ | 149 | *size = 0x20000; /* cover C000:0 through E000:0 */ |
@@ -139,21 +154,21 @@ void __iomem *pci_map_rom(struct pci_dev *pdev, size_t *size) | |||
139 | return (void __iomem *)(unsigned long) | 154 | return (void __iomem *)(unsigned long) |
140 | pci_resource_start(pdev, PCI_ROM_RESOURCE); | 155 | pci_resource_start(pdev, PCI_ROM_RESOURCE); |
141 | } else { | 156 | } else { |
142 | /* assign the ROM an address if it doesn't have one */ | 157 | start = pci_find_rom(pdev, size); |
143 | if (res->parent == NULL && | ||
144 | pci_assign_resource(pdev,PCI_ROM_RESOURCE)) | ||
145 | return NULL; | ||
146 | start = pci_resource_start(pdev, PCI_ROM_RESOURCE); | ||
147 | *size = pci_resource_len(pdev, PCI_ROM_RESOURCE); | ||
148 | if (*size == 0) | ||
149 | return NULL; | ||
150 | |||
151 | /* Enable ROM space decodes */ | ||
152 | if (pci_enable_rom(pdev)) | ||
153 | return NULL; | ||
154 | } | 158 | } |
155 | } | 159 | } |
156 | 160 | ||
161 | /* | ||
162 | * Some devices may provide ROMs via a source other than the BAR | ||
163 | */ | ||
164 | if (!start && pdev->rom && pdev->romlen) { | ||
165 | *size = pdev->romlen; | ||
166 | return phys_to_virt(pdev->rom); | ||
167 | } | ||
168 | |||
169 | if (!start) | ||
170 | return NULL; | ||
171 | |||
157 | rom = ioremap(start, *size); | 172 | rom = ioremap(start, *size); |
158 | if (!rom) { | 173 | if (!rom) { |
159 | /* restore enable if ioremap fails */ | 174 | /* restore enable if ioremap fails */ |
diff --git a/drivers/pinctrl/pinctrl-at91.c b/drivers/pinctrl/pinctrl-at91.c index 75933a6aa828..efb7f10e902a 100644 --- a/drivers/pinctrl/pinctrl-at91.c +++ b/drivers/pinctrl/pinctrl-at91.c | |||
@@ -1277,21 +1277,80 @@ static int alt_gpio_irq_type(struct irq_data *d, unsigned type) | |||
1277 | } | 1277 | } |
1278 | 1278 | ||
1279 | #ifdef CONFIG_PM | 1279 | #ifdef CONFIG_PM |
1280 | |||
1281 | static u32 wakeups[MAX_GPIO_BANKS]; | ||
1282 | static u32 backups[MAX_GPIO_BANKS]; | ||
1283 | |||
1280 | static int gpio_irq_set_wake(struct irq_data *d, unsigned state) | 1284 | static int gpio_irq_set_wake(struct irq_data *d, unsigned state) |
1281 | { | 1285 | { |
1282 | struct at91_gpio_chip *at91_gpio = irq_data_get_irq_chip_data(d); | 1286 | struct at91_gpio_chip *at91_gpio = irq_data_get_irq_chip_data(d); |
1283 | unsigned bank = at91_gpio->pioc_idx; | 1287 | unsigned bank = at91_gpio->pioc_idx; |
1288 | unsigned mask = 1 << d->hwirq; | ||
1284 | 1289 | ||
1285 | if (unlikely(bank >= MAX_GPIO_BANKS)) | 1290 | if (unlikely(bank >= MAX_GPIO_BANKS)) |
1286 | return -EINVAL; | 1291 | return -EINVAL; |
1287 | 1292 | ||
1293 | if (state) | ||
1294 | wakeups[bank] |= mask; | ||
1295 | else | ||
1296 | wakeups[bank] &= ~mask; | ||
1297 | |||
1288 | irq_set_irq_wake(at91_gpio->pioc_virq, state); | 1298 | irq_set_irq_wake(at91_gpio->pioc_virq, state); |
1289 | 1299 | ||
1290 | return 0; | 1300 | return 0; |
1291 | } | 1301 | } |
1302 | |||
1303 | void at91_pinctrl_gpio_suspend(void) | ||
1304 | { | ||
1305 | int i; | ||
1306 | |||
1307 | for (i = 0; i < gpio_banks; i++) { | ||
1308 | void __iomem *pio; | ||
1309 | |||
1310 | if (!gpio_chips[i]) | ||
1311 | continue; | ||
1312 | |||
1313 | pio = gpio_chips[i]->regbase; | ||
1314 | |||
1315 | backups[i] = __raw_readl(pio + PIO_IMR); | ||
1316 | __raw_writel(backups[i], pio + PIO_IDR); | ||
1317 | __raw_writel(wakeups[i], pio + PIO_IER); | ||
1318 | |||
1319 | if (!wakeups[i]) { | ||
1320 | clk_unprepare(gpio_chips[i]->clock); | ||
1321 | clk_disable(gpio_chips[i]->clock); | ||
1322 | } else { | ||
1323 | printk(KERN_DEBUG "GPIO-%c may wake for %08x\n", | ||
1324 | 'A'+i, wakeups[i]); | ||
1325 | } | ||
1326 | } | ||
1327 | } | ||
1328 | |||
1329 | void at91_pinctrl_gpio_resume(void) | ||
1330 | { | ||
1331 | int i; | ||
1332 | |||
1333 | for (i = 0; i < gpio_banks; i++) { | ||
1334 | void __iomem *pio; | ||
1335 | |||
1336 | if (!gpio_chips[i]) | ||
1337 | continue; | ||
1338 | |||
1339 | pio = gpio_chips[i]->regbase; | ||
1340 | |||
1341 | if (!wakeups[i]) { | ||
1342 | if (clk_prepare(gpio_chips[i]->clock) == 0) | ||
1343 | clk_enable(gpio_chips[i]->clock); | ||
1344 | } | ||
1345 | |||
1346 | __raw_writel(wakeups[i], pio + PIO_IDR); | ||
1347 | __raw_writel(backups[i], pio + PIO_IER); | ||
1348 | } | ||
1349 | } | ||
1350 | |||
1292 | #else | 1351 | #else |
1293 | #define gpio_irq_set_wake NULL | 1352 | #define gpio_irq_set_wake NULL |
1294 | #endif | 1353 | #endif /* CONFIG_PM */ |
1295 | 1354 | ||
1296 | static struct irq_chip gpio_irqchip = { | 1355 | static struct irq_chip gpio_irqchip = { |
1297 | .name = "GPIO", | 1356 | .name = "GPIO", |
diff --git a/drivers/rtc/rtc-at91rm9200.c b/drivers/rtc/rtc-at91rm9200.c index 434ebc3a99dc..0a9f27e094ea 100644 --- a/drivers/rtc/rtc-at91rm9200.c +++ b/drivers/rtc/rtc-at91rm9200.c | |||
@@ -44,6 +44,7 @@ static DECLARE_COMPLETION(at91_rtc_updated); | |||
44 | static unsigned int at91_alarm_year = AT91_RTC_EPOCH; | 44 | static unsigned int at91_alarm_year = AT91_RTC_EPOCH; |
45 | static void __iomem *at91_rtc_regs; | 45 | static void __iomem *at91_rtc_regs; |
46 | static int irq; | 46 | static int irq; |
47 | static u32 at91_rtc_imr; | ||
47 | 48 | ||
48 | /* | 49 | /* |
49 | * Decode time/date into rtc_time structure | 50 | * Decode time/date into rtc_time structure |
@@ -108,9 +109,11 @@ static int at91_rtc_settime(struct device *dev, struct rtc_time *tm) | |||
108 | cr = at91_rtc_read(AT91_RTC_CR); | 109 | cr = at91_rtc_read(AT91_RTC_CR); |
109 | at91_rtc_write(AT91_RTC_CR, cr | AT91_RTC_UPDCAL | AT91_RTC_UPDTIM); | 110 | at91_rtc_write(AT91_RTC_CR, cr | AT91_RTC_UPDCAL | AT91_RTC_UPDTIM); |
110 | 111 | ||
112 | at91_rtc_imr |= AT91_RTC_ACKUPD; | ||
111 | at91_rtc_write(AT91_RTC_IER, AT91_RTC_ACKUPD); | 113 | at91_rtc_write(AT91_RTC_IER, AT91_RTC_ACKUPD); |
112 | wait_for_completion(&at91_rtc_updated); /* wait for ACKUPD interrupt */ | 114 | wait_for_completion(&at91_rtc_updated); /* wait for ACKUPD interrupt */ |
113 | at91_rtc_write(AT91_RTC_IDR, AT91_RTC_ACKUPD); | 115 | at91_rtc_write(AT91_RTC_IDR, AT91_RTC_ACKUPD); |
116 | at91_rtc_imr &= ~AT91_RTC_ACKUPD; | ||
114 | 117 | ||
115 | at91_rtc_write(AT91_RTC_TIMR, | 118 | at91_rtc_write(AT91_RTC_TIMR, |
116 | bin2bcd(tm->tm_sec) << 0 | 119 | bin2bcd(tm->tm_sec) << 0 |
@@ -142,7 +145,7 @@ static int at91_rtc_readalarm(struct device *dev, struct rtc_wkalrm *alrm) | |||
142 | tm->tm_yday = rtc_year_days(tm->tm_mday, tm->tm_mon, tm->tm_year); | 145 | tm->tm_yday = rtc_year_days(tm->tm_mday, tm->tm_mon, tm->tm_year); |
143 | tm->tm_year = at91_alarm_year - 1900; | 146 | tm->tm_year = at91_alarm_year - 1900; |
144 | 147 | ||
145 | alrm->enabled = (at91_rtc_read(AT91_RTC_IMR) & AT91_RTC_ALARM) | 148 | alrm->enabled = (at91_rtc_imr & AT91_RTC_ALARM) |
146 | ? 1 : 0; | 149 | ? 1 : 0; |
147 | 150 | ||
148 | dev_dbg(dev, "%s(): %4d-%02d-%02d %02d:%02d:%02d\n", __func__, | 151 | dev_dbg(dev, "%s(): %4d-%02d-%02d %02d:%02d:%02d\n", __func__, |
@@ -168,6 +171,7 @@ static int at91_rtc_setalarm(struct device *dev, struct rtc_wkalrm *alrm) | |||
168 | tm.tm_sec = alrm->time.tm_sec; | 171 | tm.tm_sec = alrm->time.tm_sec; |
169 | 172 | ||
170 | at91_rtc_write(AT91_RTC_IDR, AT91_RTC_ALARM); | 173 | at91_rtc_write(AT91_RTC_IDR, AT91_RTC_ALARM); |
174 | at91_rtc_imr &= ~AT91_RTC_ALARM; | ||
171 | at91_rtc_write(AT91_RTC_TIMALR, | 175 | at91_rtc_write(AT91_RTC_TIMALR, |
172 | bin2bcd(tm.tm_sec) << 0 | 176 | bin2bcd(tm.tm_sec) << 0 |
173 | | bin2bcd(tm.tm_min) << 8 | 177 | | bin2bcd(tm.tm_min) << 8 |
@@ -180,6 +184,7 @@ static int at91_rtc_setalarm(struct device *dev, struct rtc_wkalrm *alrm) | |||
180 | 184 | ||
181 | if (alrm->enabled) { | 185 | if (alrm->enabled) { |
182 | at91_rtc_write(AT91_RTC_SCCR, AT91_RTC_ALARM); | 186 | at91_rtc_write(AT91_RTC_SCCR, AT91_RTC_ALARM); |
187 | at91_rtc_imr |= AT91_RTC_ALARM; | ||
183 | at91_rtc_write(AT91_RTC_IER, AT91_RTC_ALARM); | 188 | at91_rtc_write(AT91_RTC_IER, AT91_RTC_ALARM); |
184 | } | 189 | } |
185 | 190 | ||
@@ -196,9 +201,12 @@ static int at91_rtc_alarm_irq_enable(struct device *dev, unsigned int enabled) | |||
196 | 201 | ||
197 | if (enabled) { | 202 | if (enabled) { |
198 | at91_rtc_write(AT91_RTC_SCCR, AT91_RTC_ALARM); | 203 | at91_rtc_write(AT91_RTC_SCCR, AT91_RTC_ALARM); |
204 | at91_rtc_imr |= AT91_RTC_ALARM; | ||
199 | at91_rtc_write(AT91_RTC_IER, AT91_RTC_ALARM); | 205 | at91_rtc_write(AT91_RTC_IER, AT91_RTC_ALARM); |
200 | } else | 206 | } else { |
201 | at91_rtc_write(AT91_RTC_IDR, AT91_RTC_ALARM); | 207 | at91_rtc_write(AT91_RTC_IDR, AT91_RTC_ALARM); |
208 | at91_rtc_imr &= ~AT91_RTC_ALARM; | ||
209 | } | ||
202 | 210 | ||
203 | return 0; | 211 | return 0; |
204 | } | 212 | } |
@@ -207,12 +215,10 @@ static int at91_rtc_alarm_irq_enable(struct device *dev, unsigned int enabled) | |||
207 | */ | 215 | */ |
208 | static int at91_rtc_proc(struct device *dev, struct seq_file *seq) | 216 | static int at91_rtc_proc(struct device *dev, struct seq_file *seq) |
209 | { | 217 | { |
210 | unsigned long imr = at91_rtc_read(AT91_RTC_IMR); | ||
211 | |||
212 | seq_printf(seq, "update_IRQ\t: %s\n", | 218 | seq_printf(seq, "update_IRQ\t: %s\n", |
213 | (imr & AT91_RTC_ACKUPD) ? "yes" : "no"); | 219 | (at91_rtc_imr & AT91_RTC_ACKUPD) ? "yes" : "no"); |
214 | seq_printf(seq, "periodic_IRQ\t: %s\n", | 220 | seq_printf(seq, "periodic_IRQ\t: %s\n", |
215 | (imr & AT91_RTC_SECEV) ? "yes" : "no"); | 221 | (at91_rtc_imr & AT91_RTC_SECEV) ? "yes" : "no"); |
216 | 222 | ||
217 | return 0; | 223 | return 0; |
218 | } | 224 | } |
@@ -227,7 +233,7 @@ static irqreturn_t at91_rtc_interrupt(int irq, void *dev_id) | |||
227 | unsigned int rtsr; | 233 | unsigned int rtsr; |
228 | unsigned long events = 0; | 234 | unsigned long events = 0; |
229 | 235 | ||
230 | rtsr = at91_rtc_read(AT91_RTC_SR) & at91_rtc_read(AT91_RTC_IMR); | 236 | rtsr = at91_rtc_read(AT91_RTC_SR) & at91_rtc_imr; |
231 | if (rtsr) { /* this interrupt is shared! Is it ours? */ | 237 | if (rtsr) { /* this interrupt is shared! Is it ours? */ |
232 | if (rtsr & AT91_RTC_ALARM) | 238 | if (rtsr & AT91_RTC_ALARM) |
233 | events |= (RTC_AF | RTC_IRQF); | 239 | events |= (RTC_AF | RTC_IRQF); |
@@ -291,6 +297,7 @@ static int __init at91_rtc_probe(struct platform_device *pdev) | |||
291 | at91_rtc_write(AT91_RTC_IDR, AT91_RTC_ACKUPD | AT91_RTC_ALARM | | 297 | at91_rtc_write(AT91_RTC_IDR, AT91_RTC_ACKUPD | AT91_RTC_ALARM | |
292 | AT91_RTC_SECEV | AT91_RTC_TIMEV | | 298 | AT91_RTC_SECEV | AT91_RTC_TIMEV | |
293 | AT91_RTC_CALEV); | 299 | AT91_RTC_CALEV); |
300 | at91_rtc_imr = 0; | ||
294 | 301 | ||
295 | ret = request_irq(irq, at91_rtc_interrupt, | 302 | ret = request_irq(irq, at91_rtc_interrupt, |
296 | IRQF_SHARED, | 303 | IRQF_SHARED, |
@@ -329,6 +336,7 @@ static int __exit at91_rtc_remove(struct platform_device *pdev) | |||
329 | at91_rtc_write(AT91_RTC_IDR, AT91_RTC_ACKUPD | AT91_RTC_ALARM | | 336 | at91_rtc_write(AT91_RTC_IDR, AT91_RTC_ACKUPD | AT91_RTC_ALARM | |
330 | AT91_RTC_SECEV | AT91_RTC_TIMEV | | 337 | AT91_RTC_SECEV | AT91_RTC_TIMEV | |
331 | AT91_RTC_CALEV); | 338 | AT91_RTC_CALEV); |
339 | at91_rtc_imr = 0; | ||
332 | free_irq(irq, pdev); | 340 | free_irq(irq, pdev); |
333 | 341 | ||
334 | rtc_device_unregister(rtc); | 342 | rtc_device_unregister(rtc); |
@@ -341,31 +349,35 @@ static int __exit at91_rtc_remove(struct platform_device *pdev) | |||
341 | 349 | ||
342 | /* AT91RM9200 RTC Power management control */ | 350 | /* AT91RM9200 RTC Power management control */ |
343 | 351 | ||
344 | static u32 at91_rtc_imr; | 352 | static u32 at91_rtc_bkpimr; |
353 | |||
345 | 354 | ||
346 | static int at91_rtc_suspend(struct device *dev) | 355 | static int at91_rtc_suspend(struct device *dev) |
347 | { | 356 | { |
348 | /* this IRQ is shared with DBGU and other hardware which isn't | 357 | /* this IRQ is shared with DBGU and other hardware which isn't |
349 | * necessarily doing PM like we are... | 358 | * necessarily doing PM like we are... |
350 | */ | 359 | */ |
351 | at91_rtc_imr = at91_rtc_read(AT91_RTC_IMR) | 360 | at91_rtc_bkpimr = at91_rtc_imr & (AT91_RTC_ALARM|AT91_RTC_SECEV); |
352 | & (AT91_RTC_ALARM|AT91_RTC_SECEV); | 361 | if (at91_rtc_bkpimr) { |
353 | if (at91_rtc_imr) { | 362 | if (device_may_wakeup(dev)) { |
354 | if (device_may_wakeup(dev)) | ||
355 | enable_irq_wake(irq); | 363 | enable_irq_wake(irq); |
356 | else | 364 | } else { |
357 | at91_rtc_write(AT91_RTC_IDR, at91_rtc_imr); | 365 | at91_rtc_write(AT91_RTC_IDR, at91_rtc_bkpimr); |
358 | } | 366 | at91_rtc_imr &= ~at91_rtc_bkpimr; |
367 | } | ||
368 | } | ||
359 | return 0; | 369 | return 0; |
360 | } | 370 | } |
361 | 371 | ||
362 | static int at91_rtc_resume(struct device *dev) | 372 | static int at91_rtc_resume(struct device *dev) |
363 | { | 373 | { |
364 | if (at91_rtc_imr) { | 374 | if (at91_rtc_bkpimr) { |
365 | if (device_may_wakeup(dev)) | 375 | if (device_may_wakeup(dev)) { |
366 | disable_irq_wake(irq); | 376 | disable_irq_wake(irq); |
367 | else | 377 | } else { |
368 | at91_rtc_write(AT91_RTC_IER, at91_rtc_imr); | 378 | at91_rtc_imr |= at91_rtc_bkpimr; |
379 | at91_rtc_write(AT91_RTC_IER, at91_rtc_bkpimr); | ||
380 | } | ||
369 | } | 381 | } |
370 | return 0; | 382 | return 0; |
371 | } | 383 | } |
diff --git a/drivers/rtc/rtc-at91rm9200.h b/drivers/rtc/rtc-at91rm9200.h index da1945e5f714..5f940b6844cb 100644 --- a/drivers/rtc/rtc-at91rm9200.h +++ b/drivers/rtc/rtc-at91rm9200.h | |||
@@ -64,7 +64,6 @@ | |||
64 | #define AT91_RTC_SCCR 0x1c /* Status Clear Command Register */ | 64 | #define AT91_RTC_SCCR 0x1c /* Status Clear Command Register */ |
65 | #define AT91_RTC_IER 0x20 /* Interrupt Enable Register */ | 65 | #define AT91_RTC_IER 0x20 /* Interrupt Enable Register */ |
66 | #define AT91_RTC_IDR 0x24 /* Interrupt Disable Register */ | 66 | #define AT91_RTC_IDR 0x24 /* Interrupt Disable Register */ |
67 | #define AT91_RTC_IMR 0x28 /* Interrupt Mask Register */ | ||
68 | 67 | ||
69 | #define AT91_RTC_VER 0x2c /* Valid Entry Register */ | 68 | #define AT91_RTC_VER 0x2c /* Valid Entry Register */ |
70 | #define AT91_RTC_NVTIM (1 << 0) /* Non valid Time */ | 69 | #define AT91_RTC_NVTIM (1 << 0) /* Non valid Time */ |
diff --git a/drivers/rtc/rtc-da9052.c b/drivers/rtc/rtc-da9052.c index 0dde688ca09b..969abbad7fe3 100644 --- a/drivers/rtc/rtc-da9052.c +++ b/drivers/rtc/rtc-da9052.c | |||
@@ -239,11 +239,9 @@ static int da9052_rtc_probe(struct platform_device *pdev) | |||
239 | 239 | ||
240 | rtc->da9052 = dev_get_drvdata(pdev->dev.parent); | 240 | rtc->da9052 = dev_get_drvdata(pdev->dev.parent); |
241 | platform_set_drvdata(pdev, rtc); | 241 | platform_set_drvdata(pdev, rtc); |
242 | rtc->irq = platform_get_irq_byname(pdev, "ALM"); | 242 | rtc->irq = DA9052_IRQ_ALARM; |
243 | ret = devm_request_threaded_irq(&pdev->dev, rtc->irq, NULL, | 243 | ret = da9052_request_irq(rtc->da9052, rtc->irq, "ALM", |
244 | da9052_rtc_irq, | 244 | da9052_rtc_irq, rtc); |
245 | IRQF_TRIGGER_LOW | IRQF_ONESHOT, | ||
246 | "ALM", rtc); | ||
247 | if (ret != 0) { | 245 | if (ret != 0) { |
248 | rtc_err(rtc->da9052, "irq registration failed: %d\n", ret); | 246 | rtc_err(rtc->da9052, "irq registration failed: %d\n", ret); |
249 | return ret; | 247 | return ret; |
diff --git a/drivers/s390/block/scm_blk.c b/drivers/s390/block/scm_blk.c index 9978ad4433cb..5ac9c935c151 100644 --- a/drivers/s390/block/scm_blk.c +++ b/drivers/s390/block/scm_blk.c | |||
@@ -135,6 +135,11 @@ static const struct block_device_operations scm_blk_devops = { | |||
135 | .release = scm_release, | 135 | .release = scm_release, |
136 | }; | 136 | }; |
137 | 137 | ||
138 | static bool scm_permit_request(struct scm_blk_dev *bdev, struct request *req) | ||
139 | { | ||
140 | return rq_data_dir(req) != WRITE || bdev->state != SCM_WR_PROHIBIT; | ||
141 | } | ||
142 | |||
138 | static void scm_request_prepare(struct scm_request *scmrq) | 143 | static void scm_request_prepare(struct scm_request *scmrq) |
139 | { | 144 | { |
140 | struct scm_blk_dev *bdev = scmrq->bdev; | 145 | struct scm_blk_dev *bdev = scmrq->bdev; |
@@ -195,14 +200,18 @@ void scm_request_requeue(struct scm_request *scmrq) | |||
195 | 200 | ||
196 | scm_release_cluster(scmrq); | 201 | scm_release_cluster(scmrq); |
197 | blk_requeue_request(bdev->rq, scmrq->request); | 202 | blk_requeue_request(bdev->rq, scmrq->request); |
203 | atomic_dec(&bdev->queued_reqs); | ||
198 | scm_request_done(scmrq); | 204 | scm_request_done(scmrq); |
199 | scm_ensure_queue_restart(bdev); | 205 | scm_ensure_queue_restart(bdev); |
200 | } | 206 | } |
201 | 207 | ||
202 | void scm_request_finish(struct scm_request *scmrq) | 208 | void scm_request_finish(struct scm_request *scmrq) |
203 | { | 209 | { |
210 | struct scm_blk_dev *bdev = scmrq->bdev; | ||
211 | |||
204 | scm_release_cluster(scmrq); | 212 | scm_release_cluster(scmrq); |
205 | blk_end_request_all(scmrq->request, scmrq->error); | 213 | blk_end_request_all(scmrq->request, scmrq->error); |
214 | atomic_dec(&bdev->queued_reqs); | ||
206 | scm_request_done(scmrq); | 215 | scm_request_done(scmrq); |
207 | } | 216 | } |
208 | 217 | ||
@@ -218,6 +227,10 @@ static void scm_blk_request(struct request_queue *rq) | |||
218 | if (req->cmd_type != REQ_TYPE_FS) | 227 | if (req->cmd_type != REQ_TYPE_FS) |
219 | continue; | 228 | continue; |
220 | 229 | ||
230 | if (!scm_permit_request(bdev, req)) { | ||
231 | scm_ensure_queue_restart(bdev); | ||
232 | return; | ||
233 | } | ||
221 | scmrq = scm_request_fetch(); | 234 | scmrq = scm_request_fetch(); |
222 | if (!scmrq) { | 235 | if (!scmrq) { |
223 | SCM_LOG(5, "no request"); | 236 | SCM_LOG(5, "no request"); |
@@ -231,11 +244,13 @@ static void scm_blk_request(struct request_queue *rq) | |||
231 | return; | 244 | return; |
232 | } | 245 | } |
233 | if (scm_need_cluster_request(scmrq)) { | 246 | if (scm_need_cluster_request(scmrq)) { |
247 | atomic_inc(&bdev->queued_reqs); | ||
234 | blk_start_request(req); | 248 | blk_start_request(req); |
235 | scm_initiate_cluster_request(scmrq); | 249 | scm_initiate_cluster_request(scmrq); |
236 | return; | 250 | return; |
237 | } | 251 | } |
238 | scm_request_prepare(scmrq); | 252 | scm_request_prepare(scmrq); |
253 | atomic_inc(&bdev->queued_reqs); | ||
239 | blk_start_request(req); | 254 | blk_start_request(req); |
240 | 255 | ||
241 | ret = scm_start_aob(scmrq->aob); | 256 | ret = scm_start_aob(scmrq->aob); |
@@ -244,7 +259,6 @@ static void scm_blk_request(struct request_queue *rq) | |||
244 | scm_request_requeue(scmrq); | 259 | scm_request_requeue(scmrq); |
245 | return; | 260 | return; |
246 | } | 261 | } |
247 | atomic_inc(&bdev->queued_reqs); | ||
248 | } | 262 | } |
249 | } | 263 | } |
250 | 264 | ||
@@ -280,6 +294,38 @@ void scm_blk_irq(struct scm_device *scmdev, void *data, int error) | |||
280 | tasklet_hi_schedule(&bdev->tasklet); | 294 | tasklet_hi_schedule(&bdev->tasklet); |
281 | } | 295 | } |
282 | 296 | ||
297 | static void scm_blk_handle_error(struct scm_request *scmrq) | ||
298 | { | ||
299 | struct scm_blk_dev *bdev = scmrq->bdev; | ||
300 | unsigned long flags; | ||
301 | |||
302 | if (scmrq->error != -EIO) | ||
303 | goto restart; | ||
304 | |||
305 | /* For -EIO the response block is valid. */ | ||
306 | switch (scmrq->aob->response.eqc) { | ||
307 | case EQC_WR_PROHIBIT: | ||
308 | spin_lock_irqsave(&bdev->lock, flags); | ||
309 | if (bdev->state != SCM_WR_PROHIBIT) | ||
310 | pr_info("%lu: Write access to the SCM increment is suspended\n", | ||
311 | (unsigned long) bdev->scmdev->address); | ||
312 | bdev->state = SCM_WR_PROHIBIT; | ||
313 | spin_unlock_irqrestore(&bdev->lock, flags); | ||
314 | goto requeue; | ||
315 | default: | ||
316 | break; | ||
317 | } | ||
318 | |||
319 | restart: | ||
320 | if (!scm_start_aob(scmrq->aob)) | ||
321 | return; | ||
322 | |||
323 | requeue: | ||
324 | spin_lock_irqsave(&bdev->rq_lock, flags); | ||
325 | scm_request_requeue(scmrq); | ||
326 | spin_unlock_irqrestore(&bdev->rq_lock, flags); | ||
327 | } | ||
328 | |||
283 | static void scm_blk_tasklet(struct scm_blk_dev *bdev) | 329 | static void scm_blk_tasklet(struct scm_blk_dev *bdev) |
284 | { | 330 | { |
285 | struct scm_request *scmrq; | 331 | struct scm_request *scmrq; |
@@ -293,11 +339,8 @@ static void scm_blk_tasklet(struct scm_blk_dev *bdev) | |||
293 | spin_unlock_irqrestore(&bdev->lock, flags); | 339 | spin_unlock_irqrestore(&bdev->lock, flags); |
294 | 340 | ||
295 | if (scmrq->error && scmrq->retries-- > 0) { | 341 | if (scmrq->error && scmrq->retries-- > 0) { |
296 | if (scm_start_aob(scmrq->aob)) { | 342 | scm_blk_handle_error(scmrq); |
297 | spin_lock_irqsave(&bdev->rq_lock, flags); | 343 | |
298 | scm_request_requeue(scmrq); | ||
299 | spin_unlock_irqrestore(&bdev->rq_lock, flags); | ||
300 | } | ||
301 | /* Request restarted or requeued, handle next. */ | 344 | /* Request restarted or requeued, handle next. */ |
302 | spin_lock_irqsave(&bdev->lock, flags); | 345 | spin_lock_irqsave(&bdev->lock, flags); |
303 | continue; | 346 | continue; |
@@ -310,7 +353,6 @@ static void scm_blk_tasklet(struct scm_blk_dev *bdev) | |||
310 | } | 353 | } |
311 | 354 | ||
312 | scm_request_finish(scmrq); | 355 | scm_request_finish(scmrq); |
313 | atomic_dec(&bdev->queued_reqs); | ||
314 | spin_lock_irqsave(&bdev->lock, flags); | 356 | spin_lock_irqsave(&bdev->lock, flags); |
315 | } | 357 | } |
316 | spin_unlock_irqrestore(&bdev->lock, flags); | 358 | spin_unlock_irqrestore(&bdev->lock, flags); |
@@ -332,6 +374,7 @@ int scm_blk_dev_setup(struct scm_blk_dev *bdev, struct scm_device *scmdev) | |||
332 | } | 374 | } |
333 | 375 | ||
334 | bdev->scmdev = scmdev; | 376 | bdev->scmdev = scmdev; |
377 | bdev->state = SCM_OPER; | ||
335 | spin_lock_init(&bdev->rq_lock); | 378 | spin_lock_init(&bdev->rq_lock); |
336 | spin_lock_init(&bdev->lock); | 379 | spin_lock_init(&bdev->lock); |
337 | INIT_LIST_HEAD(&bdev->finished_requests); | 380 | INIT_LIST_HEAD(&bdev->finished_requests); |
@@ -396,6 +439,18 @@ void scm_blk_dev_cleanup(struct scm_blk_dev *bdev) | |||
396 | put_disk(bdev->gendisk); | 439 | put_disk(bdev->gendisk); |
397 | } | 440 | } |
398 | 441 | ||
442 | void scm_blk_set_available(struct scm_blk_dev *bdev) | ||
443 | { | ||
444 | unsigned long flags; | ||
445 | |||
446 | spin_lock_irqsave(&bdev->lock, flags); | ||
447 | if (bdev->state == SCM_WR_PROHIBIT) | ||
448 | pr_info("%lu: Write access to the SCM increment is restored\n", | ||
449 | (unsigned long) bdev->scmdev->address); | ||
450 | bdev->state = SCM_OPER; | ||
451 | spin_unlock_irqrestore(&bdev->lock, flags); | ||
452 | } | ||
453 | |||
399 | static int __init scm_blk_init(void) | 454 | static int __init scm_blk_init(void) |
400 | { | 455 | { |
401 | int ret = -EINVAL; | 456 | int ret = -EINVAL; |
diff --git a/drivers/s390/block/scm_blk.h b/drivers/s390/block/scm_blk.h index 3c1ccf494647..8b387b32fd62 100644 --- a/drivers/s390/block/scm_blk.h +++ b/drivers/s390/block/scm_blk.h | |||
@@ -21,6 +21,7 @@ struct scm_blk_dev { | |||
21 | spinlock_t rq_lock; /* guard the request queue */ | 21 | spinlock_t rq_lock; /* guard the request queue */ |
22 | spinlock_t lock; /* guard the rest of the blockdev */ | 22 | spinlock_t lock; /* guard the rest of the blockdev */ |
23 | atomic_t queued_reqs; | 23 | atomic_t queued_reqs; |
24 | enum {SCM_OPER, SCM_WR_PROHIBIT} state; | ||
24 | struct list_head finished_requests; | 25 | struct list_head finished_requests; |
25 | #ifdef CONFIG_SCM_BLOCK_CLUSTER_WRITE | 26 | #ifdef CONFIG_SCM_BLOCK_CLUSTER_WRITE |
26 | struct list_head cluster_list; | 27 | struct list_head cluster_list; |
@@ -48,6 +49,7 @@ struct scm_request { | |||
48 | 49 | ||
49 | int scm_blk_dev_setup(struct scm_blk_dev *, struct scm_device *); | 50 | int scm_blk_dev_setup(struct scm_blk_dev *, struct scm_device *); |
50 | void scm_blk_dev_cleanup(struct scm_blk_dev *); | 51 | void scm_blk_dev_cleanup(struct scm_blk_dev *); |
52 | void scm_blk_set_available(struct scm_blk_dev *); | ||
51 | void scm_blk_irq(struct scm_device *, void *, int); | 53 | void scm_blk_irq(struct scm_device *, void *, int); |
52 | 54 | ||
53 | void scm_request_finish(struct scm_request *); | 55 | void scm_request_finish(struct scm_request *); |
diff --git a/drivers/s390/block/scm_drv.c b/drivers/s390/block/scm_drv.c index 9fa0a908607b..5f6180d6ff08 100644 --- a/drivers/s390/block/scm_drv.c +++ b/drivers/s390/block/scm_drv.c | |||
@@ -13,12 +13,23 @@ | |||
13 | #include <asm/eadm.h> | 13 | #include <asm/eadm.h> |
14 | #include "scm_blk.h" | 14 | #include "scm_blk.h" |
15 | 15 | ||
16 | static void notify(struct scm_device *scmdev) | 16 | static void scm_notify(struct scm_device *scmdev, enum scm_event event) |
17 | { | 17 | { |
18 | pr_info("%lu: The capabilities of the SCM increment changed\n", | 18 | struct scm_blk_dev *bdev = dev_get_drvdata(&scmdev->dev); |
19 | (unsigned long) scmdev->address); | 19 | |
20 | SCM_LOG(2, "State changed"); | 20 | switch (event) { |
21 | SCM_LOG_STATE(2, scmdev); | 21 | case SCM_CHANGE: |
22 | pr_info("%lu: The capabilities of the SCM increment changed\n", | ||
23 | (unsigned long) scmdev->address); | ||
24 | SCM_LOG(2, "State changed"); | ||
25 | SCM_LOG_STATE(2, scmdev); | ||
26 | break; | ||
27 | case SCM_AVAIL: | ||
28 | SCM_LOG(2, "Increment available"); | ||
29 | SCM_LOG_STATE(2, scmdev); | ||
30 | scm_blk_set_available(bdev); | ||
31 | break; | ||
32 | } | ||
22 | } | 33 | } |
23 | 34 | ||
24 | static int scm_probe(struct scm_device *scmdev) | 35 | static int scm_probe(struct scm_device *scmdev) |
@@ -64,7 +75,7 @@ static struct scm_driver scm_drv = { | |||
64 | .name = "scm_block", | 75 | .name = "scm_block", |
65 | .owner = THIS_MODULE, | 76 | .owner = THIS_MODULE, |
66 | }, | 77 | }, |
67 | .notify = notify, | 78 | .notify = scm_notify, |
68 | .probe = scm_probe, | 79 | .probe = scm_probe, |
69 | .remove = scm_remove, | 80 | .remove = scm_remove, |
70 | .handler = scm_blk_irq, | 81 | .handler = scm_blk_irq, |
diff --git a/drivers/s390/char/sclp_cmd.c b/drivers/s390/char/sclp_cmd.c index 30a2255389e5..cd798386b622 100644 --- a/drivers/s390/char/sclp_cmd.c +++ b/drivers/s390/char/sclp_cmd.c | |||
@@ -627,6 +627,8 @@ static int __init sclp_detect_standby_memory(void) | |||
627 | struct read_storage_sccb *sccb; | 627 | struct read_storage_sccb *sccb; |
628 | int i, id, assigned, rc; | 628 | int i, id, assigned, rc; |
629 | 629 | ||
630 | if (OLDMEM_BASE) /* No standby memory in kdump mode */ | ||
631 | return 0; | ||
630 | if (!early_read_info_sccb_valid) | 632 | if (!early_read_info_sccb_valid) |
631 | return 0; | 633 | return 0; |
632 | if ((sclp_facilities & 0xe00000000000ULL) != 0xe00000000000ULL) | 634 | if ((sclp_facilities & 0xe00000000000ULL) != 0xe00000000000ULL) |
diff --git a/drivers/s390/cio/chsc.c b/drivers/s390/cio/chsc.c index 31ceef1beb8b..e16c553f6556 100644 --- a/drivers/s390/cio/chsc.c +++ b/drivers/s390/cio/chsc.c | |||
@@ -433,6 +433,20 @@ static void chsc_process_sei_scm_change(struct chsc_sei_nt0_area *sei_area) | |||
433 | " failed (rc=%d).\n", ret); | 433 | " failed (rc=%d).\n", ret); |
434 | } | 434 | } |
435 | 435 | ||
436 | static void chsc_process_sei_scm_avail(struct chsc_sei_nt0_area *sei_area) | ||
437 | { | ||
438 | int ret; | ||
439 | |||
440 | CIO_CRW_EVENT(4, "chsc: scm available information\n"); | ||
441 | if (sei_area->rs != 7) | ||
442 | return; | ||
443 | |||
444 | ret = scm_process_availability_information(); | ||
445 | if (ret) | ||
446 | CIO_CRW_EVENT(0, "chsc: process availability information" | ||
447 | " failed (rc=%d).\n", ret); | ||
448 | } | ||
449 | |||
436 | static void chsc_process_sei_nt2(struct chsc_sei_nt2_area *sei_area) | 450 | static void chsc_process_sei_nt2(struct chsc_sei_nt2_area *sei_area) |
437 | { | 451 | { |
438 | switch (sei_area->cc) { | 452 | switch (sei_area->cc) { |
@@ -468,6 +482,9 @@ static void chsc_process_sei_nt0(struct chsc_sei_nt0_area *sei_area) | |||
468 | case 12: /* scm change notification */ | 482 | case 12: /* scm change notification */ |
469 | chsc_process_sei_scm_change(sei_area); | 483 | chsc_process_sei_scm_change(sei_area); |
470 | break; | 484 | break; |
485 | case 14: /* scm available notification */ | ||
486 | chsc_process_sei_scm_avail(sei_area); | ||
487 | break; | ||
471 | default: /* other stuff */ | 488 | default: /* other stuff */ |
472 | CIO_CRW_EVENT(2, "chsc: sei nt0 unhandled cc=%d\n", | 489 | CIO_CRW_EVENT(2, "chsc: sei nt0 unhandled cc=%d\n", |
473 | sei_area->cc); | 490 | sei_area->cc); |
diff --git a/drivers/s390/cio/chsc.h b/drivers/s390/cio/chsc.h index 227e05f674b3..349d5fc47196 100644 --- a/drivers/s390/cio/chsc.h +++ b/drivers/s390/cio/chsc.h | |||
@@ -156,8 +156,10 @@ int chsc_scm_info(struct chsc_scm_info *scm_area, u64 token); | |||
156 | 156 | ||
157 | #ifdef CONFIG_SCM_BUS | 157 | #ifdef CONFIG_SCM_BUS |
158 | int scm_update_information(void); | 158 | int scm_update_information(void); |
159 | int scm_process_availability_information(void); | ||
159 | #else /* CONFIG_SCM_BUS */ | 160 | #else /* CONFIG_SCM_BUS */ |
160 | static inline int scm_update_information(void) { return 0; } | 161 | static inline int scm_update_information(void) { return 0; } |
162 | static inline int scm_process_availability_information(void) { return 0; } | ||
161 | #endif /* CONFIG_SCM_BUS */ | 163 | #endif /* CONFIG_SCM_BUS */ |
162 | 164 | ||
163 | 165 | ||
diff --git a/drivers/s390/cio/scm.c b/drivers/s390/cio/scm.c index bcf20f3aa51b..46ec25632e8b 100644 --- a/drivers/s390/cio/scm.c +++ b/drivers/s390/cio/scm.c | |||
@@ -211,7 +211,7 @@ static void scmdev_update(struct scm_device *scmdev, struct sale *sale) | |||
211 | goto out; | 211 | goto out; |
212 | scmdrv = to_scm_drv(scmdev->dev.driver); | 212 | scmdrv = to_scm_drv(scmdev->dev.driver); |
213 | if (changed && scmdrv->notify) | 213 | if (changed && scmdrv->notify) |
214 | scmdrv->notify(scmdev); | 214 | scmdrv->notify(scmdev, SCM_CHANGE); |
215 | out: | 215 | out: |
216 | device_unlock(&scmdev->dev); | 216 | device_unlock(&scmdev->dev); |
217 | if (changed) | 217 | if (changed) |
@@ -297,6 +297,22 @@ int scm_update_information(void) | |||
297 | return ret; | 297 | return ret; |
298 | } | 298 | } |
299 | 299 | ||
300 | static int scm_dev_avail(struct device *dev, void *unused) | ||
301 | { | ||
302 | struct scm_driver *scmdrv = to_scm_drv(dev->driver); | ||
303 | struct scm_device *scmdev = to_scm_dev(dev); | ||
304 | |||
305 | if (dev->driver && scmdrv->notify) | ||
306 | scmdrv->notify(scmdev, SCM_AVAIL); | ||
307 | |||
308 | return 0; | ||
309 | } | ||
310 | |||
311 | int scm_process_availability_information(void) | ||
312 | { | ||
313 | return bus_for_each_dev(&scm_bus_type, NULL, NULL, scm_dev_avail); | ||
314 | } | ||
315 | |||
300 | static int __init scm_init(void) | 316 | static int __init scm_init(void) |
301 | { | 317 | { |
302 | int ret; | 318 | int ret; |
diff --git a/drivers/s390/net/qeth_core.h b/drivers/s390/net/qeth_core.h index d87961d4c0de..8c0622399fcd 100644 --- a/drivers/s390/net/qeth_core.h +++ b/drivers/s390/net/qeth_core.h | |||
@@ -916,6 +916,7 @@ int qeth_send_control_data(struct qeth_card *, int, struct qeth_cmd_buffer *, | |||
916 | void *reply_param); | 916 | void *reply_param); |
917 | int qeth_get_priority_queue(struct qeth_card *, struct sk_buff *, int, int); | 917 | int qeth_get_priority_queue(struct qeth_card *, struct sk_buff *, int, int); |
918 | int qeth_get_elements_no(struct qeth_card *, void *, struct sk_buff *, int); | 918 | int qeth_get_elements_no(struct qeth_card *, void *, struct sk_buff *, int); |
919 | int qeth_get_elements_for_frags(struct sk_buff *); | ||
919 | int qeth_do_send_packet_fast(struct qeth_card *, struct qeth_qdio_out_q *, | 920 | int qeth_do_send_packet_fast(struct qeth_card *, struct qeth_qdio_out_q *, |
920 | struct sk_buff *, struct qeth_hdr *, int, int, int); | 921 | struct sk_buff *, struct qeth_hdr *, int, int, int); |
921 | int qeth_do_send_packet(struct qeth_card *, struct qeth_qdio_out_q *, | 922 | int qeth_do_send_packet(struct qeth_card *, struct qeth_qdio_out_q *, |
diff --git a/drivers/s390/net/qeth_core_main.c b/drivers/s390/net/qeth_core_main.c index 0d8cdff81813..0d73a999983d 100644 --- a/drivers/s390/net/qeth_core_main.c +++ b/drivers/s390/net/qeth_core_main.c | |||
@@ -3679,6 +3679,25 @@ int qeth_get_priority_queue(struct qeth_card *card, struct sk_buff *skb, | |||
3679 | } | 3679 | } |
3680 | EXPORT_SYMBOL_GPL(qeth_get_priority_queue); | 3680 | EXPORT_SYMBOL_GPL(qeth_get_priority_queue); |
3681 | 3681 | ||
3682 | int qeth_get_elements_for_frags(struct sk_buff *skb) | ||
3683 | { | ||
3684 | int cnt, length, e, elements = 0; | ||
3685 | struct skb_frag_struct *frag; | ||
3686 | char *data; | ||
3687 | |||
3688 | for (cnt = 0; cnt < skb_shinfo(skb)->nr_frags; cnt++) { | ||
3689 | frag = &skb_shinfo(skb)->frags[cnt]; | ||
3690 | data = (char *)page_to_phys(skb_frag_page(frag)) + | ||
3691 | frag->page_offset; | ||
3692 | length = frag->size; | ||
3693 | e = PFN_UP((unsigned long)data + length - 1) - | ||
3694 | PFN_DOWN((unsigned long)data); | ||
3695 | elements += e; | ||
3696 | } | ||
3697 | return elements; | ||
3698 | } | ||
3699 | EXPORT_SYMBOL_GPL(qeth_get_elements_for_frags); | ||
3700 | |||
3682 | int qeth_get_elements_no(struct qeth_card *card, void *hdr, | 3701 | int qeth_get_elements_no(struct qeth_card *card, void *hdr, |
3683 | struct sk_buff *skb, int elems) | 3702 | struct sk_buff *skb, int elems) |
3684 | { | 3703 | { |
@@ -3686,7 +3705,8 @@ int qeth_get_elements_no(struct qeth_card *card, void *hdr, | |||
3686 | int elements_needed = PFN_UP((unsigned long)skb->data + dlen - 1) - | 3705 | int elements_needed = PFN_UP((unsigned long)skb->data + dlen - 1) - |
3687 | PFN_DOWN((unsigned long)skb->data); | 3706 | PFN_DOWN((unsigned long)skb->data); |
3688 | 3707 | ||
3689 | elements_needed += skb_shinfo(skb)->nr_frags; | 3708 | elements_needed += qeth_get_elements_for_frags(skb); |
3709 | |||
3690 | if ((elements_needed + elems) > QETH_MAX_BUFFER_ELEMENTS(card)) { | 3710 | if ((elements_needed + elems) > QETH_MAX_BUFFER_ELEMENTS(card)) { |
3691 | QETH_DBF_MESSAGE(2, "Invalid size of IP packet " | 3711 | QETH_DBF_MESSAGE(2, "Invalid size of IP packet " |
3692 | "(Number=%d / Length=%d). Discarded.\n", | 3712 | "(Number=%d / Length=%d). Discarded.\n", |
@@ -3771,12 +3791,23 @@ static inline void __qeth_fill_buffer(struct sk_buff *skb, | |||
3771 | 3791 | ||
3772 | for (cnt = 0; cnt < skb_shinfo(skb)->nr_frags; cnt++) { | 3792 | for (cnt = 0; cnt < skb_shinfo(skb)->nr_frags; cnt++) { |
3773 | frag = &skb_shinfo(skb)->frags[cnt]; | 3793 | frag = &skb_shinfo(skb)->frags[cnt]; |
3774 | buffer->element[element].addr = (char *) | 3794 | data = (char *)page_to_phys(skb_frag_page(frag)) + |
3775 | page_to_phys(skb_frag_page(frag)) | 3795 | frag->page_offset; |
3776 | + frag->page_offset; | 3796 | length = frag->size; |
3777 | buffer->element[element].length = frag->size; | 3797 | while (length > 0) { |
3778 | buffer->element[element].eflags = SBAL_EFLAGS_MIDDLE_FRAG; | 3798 | length_here = PAGE_SIZE - |
3779 | element++; | 3799 | ((unsigned long) data % PAGE_SIZE); |
3800 | if (length < length_here) | ||
3801 | length_here = length; | ||
3802 | |||
3803 | buffer->element[element].addr = data; | ||
3804 | buffer->element[element].length = length_here; | ||
3805 | buffer->element[element].eflags = | ||
3806 | SBAL_EFLAGS_MIDDLE_FRAG; | ||
3807 | length -= length_here; | ||
3808 | data += length_here; | ||
3809 | element++; | ||
3810 | } | ||
3780 | } | 3811 | } |
3781 | 3812 | ||
3782 | if (buffer->element[element - 1].eflags) | 3813 | if (buffer->element[element - 1].eflags) |
diff --git a/drivers/s390/net/qeth_l3_main.c b/drivers/s390/net/qeth_l3_main.c index 091ca0efa1c5..8710337dab3e 100644 --- a/drivers/s390/net/qeth_l3_main.c +++ b/drivers/s390/net/qeth_l3_main.c | |||
@@ -623,7 +623,7 @@ static int qeth_l3_send_setrouting(struct qeth_card *card, | |||
623 | return rc; | 623 | return rc; |
624 | } | 624 | } |
625 | 625 | ||
626 | static void qeth_l3_correct_routing_type(struct qeth_card *card, | 626 | static int qeth_l3_correct_routing_type(struct qeth_card *card, |
627 | enum qeth_routing_types *type, enum qeth_prot_versions prot) | 627 | enum qeth_routing_types *type, enum qeth_prot_versions prot) |
628 | { | 628 | { |
629 | if (card->info.type == QETH_CARD_TYPE_IQD) { | 629 | if (card->info.type == QETH_CARD_TYPE_IQD) { |
@@ -632,7 +632,7 @@ static void qeth_l3_correct_routing_type(struct qeth_card *card, | |||
632 | case PRIMARY_CONNECTOR: | 632 | case PRIMARY_CONNECTOR: |
633 | case SECONDARY_CONNECTOR: | 633 | case SECONDARY_CONNECTOR: |
634 | case MULTICAST_ROUTER: | 634 | case MULTICAST_ROUTER: |
635 | return; | 635 | return 0; |
636 | default: | 636 | default: |
637 | goto out_inval; | 637 | goto out_inval; |
638 | } | 638 | } |
@@ -641,17 +641,18 @@ static void qeth_l3_correct_routing_type(struct qeth_card *card, | |||
641 | case NO_ROUTER: | 641 | case NO_ROUTER: |
642 | case PRIMARY_ROUTER: | 642 | case PRIMARY_ROUTER: |
643 | case SECONDARY_ROUTER: | 643 | case SECONDARY_ROUTER: |
644 | return; | 644 | return 0; |
645 | case MULTICAST_ROUTER: | 645 | case MULTICAST_ROUTER: |
646 | if (qeth_is_ipafunc_supported(card, prot, | 646 | if (qeth_is_ipafunc_supported(card, prot, |
647 | IPA_OSA_MC_ROUTER)) | 647 | IPA_OSA_MC_ROUTER)) |
648 | return; | 648 | return 0; |
649 | default: | 649 | default: |
650 | goto out_inval; | 650 | goto out_inval; |
651 | } | 651 | } |
652 | } | 652 | } |
653 | out_inval: | 653 | out_inval: |
654 | *type = NO_ROUTER; | 654 | *type = NO_ROUTER; |
655 | return -EINVAL; | ||
655 | } | 656 | } |
656 | 657 | ||
657 | int qeth_l3_setrouting_v4(struct qeth_card *card) | 658 | int qeth_l3_setrouting_v4(struct qeth_card *card) |
@@ -660,8 +661,10 @@ int qeth_l3_setrouting_v4(struct qeth_card *card) | |||
660 | 661 | ||
661 | QETH_CARD_TEXT(card, 3, "setrtg4"); | 662 | QETH_CARD_TEXT(card, 3, "setrtg4"); |
662 | 663 | ||
663 | qeth_l3_correct_routing_type(card, &card->options.route4.type, | 664 | rc = qeth_l3_correct_routing_type(card, &card->options.route4.type, |
664 | QETH_PROT_IPV4); | 665 | QETH_PROT_IPV4); |
666 | if (rc) | ||
667 | return rc; | ||
665 | 668 | ||
666 | rc = qeth_l3_send_setrouting(card, card->options.route4.type, | 669 | rc = qeth_l3_send_setrouting(card, card->options.route4.type, |
667 | QETH_PROT_IPV4); | 670 | QETH_PROT_IPV4); |
@@ -683,8 +686,10 @@ int qeth_l3_setrouting_v6(struct qeth_card *card) | |||
683 | 686 | ||
684 | if (!qeth_is_supported(card, IPA_IPV6)) | 687 | if (!qeth_is_supported(card, IPA_IPV6)) |
685 | return 0; | 688 | return 0; |
686 | qeth_l3_correct_routing_type(card, &card->options.route6.type, | 689 | rc = qeth_l3_correct_routing_type(card, &card->options.route6.type, |
687 | QETH_PROT_IPV6); | 690 | QETH_PROT_IPV6); |
691 | if (rc) | ||
692 | return rc; | ||
688 | 693 | ||
689 | rc = qeth_l3_send_setrouting(card, card->options.route6.type, | 694 | rc = qeth_l3_send_setrouting(card, card->options.route6.type, |
690 | QETH_PROT_IPV6); | 695 | QETH_PROT_IPV6); |
@@ -2898,7 +2903,9 @@ static inline int qeth_l3_tso_elements(struct sk_buff *skb) | |||
2898 | tcp_hdr(skb)->doff * 4; | 2903 | tcp_hdr(skb)->doff * 4; |
2899 | int tcpd_len = skb->len - (tcpd - (unsigned long)skb->data); | 2904 | int tcpd_len = skb->len - (tcpd - (unsigned long)skb->data); |
2900 | int elements = PFN_UP(tcpd + tcpd_len - 1) - PFN_DOWN(tcpd); | 2905 | int elements = PFN_UP(tcpd + tcpd_len - 1) - PFN_DOWN(tcpd); |
2901 | elements += skb_shinfo(skb)->nr_frags; | 2906 | |
2907 | elements += qeth_get_elements_for_frags(skb); | ||
2908 | |||
2902 | return elements; | 2909 | return elements; |
2903 | } | 2910 | } |
2904 | 2911 | ||
@@ -3348,7 +3355,6 @@ static int __qeth_l3_set_online(struct ccwgroup_device *gdev, int recovery_mode) | |||
3348 | rc = -ENODEV; | 3355 | rc = -ENODEV; |
3349 | goto out_remove; | 3356 | goto out_remove; |
3350 | } | 3357 | } |
3351 | qeth_trace_features(card); | ||
3352 | 3358 | ||
3353 | if (!card->dev && qeth_l3_setup_netdev(card)) { | 3359 | if (!card->dev && qeth_l3_setup_netdev(card)) { |
3354 | rc = -ENODEV; | 3360 | rc = -ENODEV; |
@@ -3425,6 +3431,7 @@ contin: | |||
3425 | qeth_l3_set_multicast_list(card->dev); | 3431 | qeth_l3_set_multicast_list(card->dev); |
3426 | rtnl_unlock(); | 3432 | rtnl_unlock(); |
3427 | } | 3433 | } |
3434 | qeth_trace_features(card); | ||
3428 | /* let user_space know that device is online */ | 3435 | /* let user_space know that device is online */ |
3429 | kobject_uevent(&gdev->dev.kobj, KOBJ_CHANGE); | 3436 | kobject_uevent(&gdev->dev.kobj, KOBJ_CHANGE); |
3430 | mutex_unlock(&card->conf_mutex); | 3437 | mutex_unlock(&card->conf_mutex); |
diff --git a/drivers/s390/net/qeth_l3_sys.c b/drivers/s390/net/qeth_l3_sys.c index ebc379486267..e70af2406ff9 100644 --- a/drivers/s390/net/qeth_l3_sys.c +++ b/drivers/s390/net/qeth_l3_sys.c | |||
@@ -87,6 +87,8 @@ static ssize_t qeth_l3_dev_route_store(struct qeth_card *card, | |||
87 | rc = qeth_l3_setrouting_v6(card); | 87 | rc = qeth_l3_setrouting_v6(card); |
88 | } | 88 | } |
89 | out: | 89 | out: |
90 | if (rc) | ||
91 | route->type = old_route_type; | ||
90 | mutex_unlock(&card->conf_mutex); | 92 | mutex_unlock(&card->conf_mutex); |
91 | return rc ? rc : count; | 93 | return rc ? rc : count; |
92 | } | 94 | } |
diff --git a/drivers/staging/comedi/drivers/dt9812.c b/drivers/staging/comedi/drivers/dt9812.c index 192cf088f834..57b451904791 100644 --- a/drivers/staging/comedi/drivers/dt9812.c +++ b/drivers/staging/comedi/drivers/dt9812.c | |||
@@ -947,12 +947,13 @@ static int dt9812_di_rinsn(struct comedi_device *dev, | |||
947 | unsigned int *data) | 947 | unsigned int *data) |
948 | { | 948 | { |
949 | struct comedi_dt9812 *devpriv = dev->private; | 949 | struct comedi_dt9812 *devpriv = dev->private; |
950 | unsigned int channel = CR_CHAN(insn->chanspec); | ||
950 | int n; | 951 | int n; |
951 | u8 bits = 0; | 952 | u8 bits = 0; |
952 | 953 | ||
953 | dt9812_digital_in(devpriv->slot, &bits); | 954 | dt9812_digital_in(devpriv->slot, &bits); |
954 | for (n = 0; n < insn->n; n++) | 955 | for (n = 0; n < insn->n; n++) |
955 | data[n] = ((1 << insn->chanspec) & bits) != 0; | 956 | data[n] = ((1 << channel) & bits) != 0; |
956 | return n; | 957 | return n; |
957 | } | 958 | } |
958 | 959 | ||
@@ -961,12 +962,13 @@ static int dt9812_do_winsn(struct comedi_device *dev, | |||
961 | unsigned int *data) | 962 | unsigned int *data) |
962 | { | 963 | { |
963 | struct comedi_dt9812 *devpriv = dev->private; | 964 | struct comedi_dt9812 *devpriv = dev->private; |
965 | unsigned int channel = CR_CHAN(insn->chanspec); | ||
964 | int n; | 966 | int n; |
965 | u8 bits = 0; | 967 | u8 bits = 0; |
966 | 968 | ||
967 | dt9812_digital_out_shadow(devpriv->slot, &bits); | 969 | dt9812_digital_out_shadow(devpriv->slot, &bits); |
968 | for (n = 0; n < insn->n; n++) { | 970 | for (n = 0; n < insn->n; n++) { |
969 | u8 mask = 1 << insn->chanspec; | 971 | u8 mask = 1 << channel; |
970 | 972 | ||
971 | bits &= ~mask; | 973 | bits &= ~mask; |
972 | if (data[n]) | 974 | if (data[n]) |
@@ -981,13 +983,13 @@ static int dt9812_ai_rinsn(struct comedi_device *dev, | |||
981 | unsigned int *data) | 983 | unsigned int *data) |
982 | { | 984 | { |
983 | struct comedi_dt9812 *devpriv = dev->private; | 985 | struct comedi_dt9812 *devpriv = dev->private; |
986 | unsigned int channel = CR_CHAN(insn->chanspec); | ||
984 | int n; | 987 | int n; |
985 | 988 | ||
986 | for (n = 0; n < insn->n; n++) { | 989 | for (n = 0; n < insn->n; n++) { |
987 | u16 value = 0; | 990 | u16 value = 0; |
988 | 991 | ||
989 | dt9812_analog_in(devpriv->slot, insn->chanspec, &value, | 992 | dt9812_analog_in(devpriv->slot, channel, &value, DT9812_GAIN_1); |
990 | DT9812_GAIN_1); | ||
991 | data[n] = value; | 993 | data[n] = value; |
992 | } | 994 | } |
993 | return n; | 995 | return n; |
@@ -998,12 +1000,13 @@ static int dt9812_ao_rinsn(struct comedi_device *dev, | |||
998 | unsigned int *data) | 1000 | unsigned int *data) |
999 | { | 1001 | { |
1000 | struct comedi_dt9812 *devpriv = dev->private; | 1002 | struct comedi_dt9812 *devpriv = dev->private; |
1003 | unsigned int channel = CR_CHAN(insn->chanspec); | ||
1001 | int n; | 1004 | int n; |
1002 | u16 value; | 1005 | u16 value; |
1003 | 1006 | ||
1004 | for (n = 0; n < insn->n; n++) { | 1007 | for (n = 0; n < insn->n; n++) { |
1005 | value = 0; | 1008 | value = 0; |
1006 | dt9812_analog_out_shadow(devpriv->slot, insn->chanspec, &value); | 1009 | dt9812_analog_out_shadow(devpriv->slot, channel, &value); |
1007 | data[n] = value; | 1010 | data[n] = value; |
1008 | } | 1011 | } |
1009 | return n; | 1012 | return n; |
@@ -1014,10 +1017,11 @@ static int dt9812_ao_winsn(struct comedi_device *dev, | |||
1014 | unsigned int *data) | 1017 | unsigned int *data) |
1015 | { | 1018 | { |
1016 | struct comedi_dt9812 *devpriv = dev->private; | 1019 | struct comedi_dt9812 *devpriv = dev->private; |
1020 | unsigned int channel = CR_CHAN(insn->chanspec); | ||
1017 | int n; | 1021 | int n; |
1018 | 1022 | ||
1019 | for (n = 0; n < insn->n; n++) | 1023 | for (n = 0; n < insn->n; n++) |
1020 | dt9812_analog_out(devpriv->slot, insn->chanspec, data[n]); | 1024 | dt9812_analog_out(devpriv->slot, channel, data[n]); |
1021 | return n; | 1025 | return n; |
1022 | } | 1026 | } |
1023 | 1027 | ||
diff --git a/drivers/staging/comedi/drivers/usbdux.c b/drivers/staging/comedi/drivers/usbdux.c index 1a0062a04456..6aac1f60bc42 100644 --- a/drivers/staging/comedi/drivers/usbdux.c +++ b/drivers/staging/comedi/drivers/usbdux.c | |||
@@ -730,10 +730,14 @@ static void usbduxsub_ao_IsocIrq(struct urb *urb) | |||
730 | static int usbduxsub_start(struct usbduxsub *usbduxsub) | 730 | static int usbduxsub_start(struct usbduxsub *usbduxsub) |
731 | { | 731 | { |
732 | int errcode = 0; | 732 | int errcode = 0; |
733 | uint8_t local_transfer_buffer[16]; | 733 | uint8_t *local_transfer_buffer; |
734 | |||
735 | local_transfer_buffer = kmalloc(1, GFP_KERNEL); | ||
736 | if (!local_transfer_buffer) | ||
737 | return -ENOMEM; | ||
734 | 738 | ||
735 | /* 7f92 to zero */ | 739 | /* 7f92 to zero */ |
736 | local_transfer_buffer[0] = 0; | 740 | *local_transfer_buffer = 0; |
737 | errcode = usb_control_msg(usbduxsub->usbdev, | 741 | errcode = usb_control_msg(usbduxsub->usbdev, |
738 | /* create a pipe for a control transfer */ | 742 | /* create a pipe for a control transfer */ |
739 | usb_sndctrlpipe(usbduxsub->usbdev, 0), | 743 | usb_sndctrlpipe(usbduxsub->usbdev, 0), |
@@ -751,22 +755,25 @@ static int usbduxsub_start(struct usbduxsub *usbduxsub) | |||
751 | 1, | 755 | 1, |
752 | /* Timeout */ | 756 | /* Timeout */ |
753 | BULK_TIMEOUT); | 757 | BULK_TIMEOUT); |
754 | if (errcode < 0) { | 758 | if (errcode < 0) |
755 | dev_err(&usbduxsub->interface->dev, | 759 | dev_err(&usbduxsub->interface->dev, |
756 | "comedi_: control msg failed (start)\n"); | 760 | "comedi_: control msg failed (start)\n"); |
757 | return errcode; | 761 | |
758 | } | 762 | kfree(local_transfer_buffer); |
759 | return 0; | 763 | return errcode; |
760 | } | 764 | } |
761 | 765 | ||
762 | static int usbduxsub_stop(struct usbduxsub *usbduxsub) | 766 | static int usbduxsub_stop(struct usbduxsub *usbduxsub) |
763 | { | 767 | { |
764 | int errcode = 0; | 768 | int errcode = 0; |
769 | uint8_t *local_transfer_buffer; | ||
765 | 770 | ||
766 | uint8_t local_transfer_buffer[16]; | 771 | local_transfer_buffer = kmalloc(1, GFP_KERNEL); |
772 | if (!local_transfer_buffer) | ||
773 | return -ENOMEM; | ||
767 | 774 | ||
768 | /* 7f92 to one */ | 775 | /* 7f92 to one */ |
769 | local_transfer_buffer[0] = 1; | 776 | *local_transfer_buffer = 1; |
770 | errcode = usb_control_msg(usbduxsub->usbdev, | 777 | errcode = usb_control_msg(usbduxsub->usbdev, |
771 | usb_sndctrlpipe(usbduxsub->usbdev, 0), | 778 | usb_sndctrlpipe(usbduxsub->usbdev, 0), |
772 | /* bRequest, "Firmware" */ | 779 | /* bRequest, "Firmware" */ |
@@ -781,12 +788,12 @@ static int usbduxsub_stop(struct usbduxsub *usbduxsub) | |||
781 | 1, | 788 | 1, |
782 | /* Timeout */ | 789 | /* Timeout */ |
783 | BULK_TIMEOUT); | 790 | BULK_TIMEOUT); |
784 | if (errcode < 0) { | 791 | if (errcode < 0) |
785 | dev_err(&usbduxsub->interface->dev, | 792 | dev_err(&usbduxsub->interface->dev, |
786 | "comedi_: control msg failed (stop)\n"); | 793 | "comedi_: control msg failed (stop)\n"); |
787 | return errcode; | 794 | |
788 | } | 795 | kfree(local_transfer_buffer); |
789 | return 0; | 796 | return errcode; |
790 | } | 797 | } |
791 | 798 | ||
792 | static int usbduxsub_upload(struct usbduxsub *usbduxsub, | 799 | static int usbduxsub_upload(struct usbduxsub *usbduxsub, |
diff --git a/drivers/staging/comedi/drivers/usbduxfast.c b/drivers/staging/comedi/drivers/usbduxfast.c index 4bf5dd094dc9..1ba0e3df492d 100644 --- a/drivers/staging/comedi/drivers/usbduxfast.c +++ b/drivers/staging/comedi/drivers/usbduxfast.c | |||
@@ -436,10 +436,14 @@ static void usbduxfastsub_ai_Irq(struct urb *urb) | |||
436 | static int usbduxfastsub_start(struct usbduxfastsub_s *udfs) | 436 | static int usbduxfastsub_start(struct usbduxfastsub_s *udfs) |
437 | { | 437 | { |
438 | int ret; | 438 | int ret; |
439 | unsigned char local_transfer_buffer[16]; | 439 | unsigned char *local_transfer_buffer; |
440 | |||
441 | local_transfer_buffer = kmalloc(1, GFP_KERNEL); | ||
442 | if (!local_transfer_buffer) | ||
443 | return -ENOMEM; | ||
440 | 444 | ||
441 | /* 7f92 to zero */ | 445 | /* 7f92 to zero */ |
442 | local_transfer_buffer[0] = 0; | 446 | *local_transfer_buffer = 0; |
443 | /* bRequest, "Firmware" */ | 447 | /* bRequest, "Firmware" */ |
444 | ret = usb_control_msg(udfs->usbdev, usb_sndctrlpipe(udfs->usbdev, 0), | 448 | ret = usb_control_msg(udfs->usbdev, usb_sndctrlpipe(udfs->usbdev, 0), |
445 | USBDUXFASTSUB_FIRMWARE, | 449 | USBDUXFASTSUB_FIRMWARE, |
@@ -450,22 +454,25 @@ static int usbduxfastsub_start(struct usbduxfastsub_s *udfs) | |||
450 | local_transfer_buffer, | 454 | local_transfer_buffer, |
451 | 1, /* Length */ | 455 | 1, /* Length */ |
452 | EZTIMEOUT); /* Timeout */ | 456 | EZTIMEOUT); /* Timeout */ |
453 | if (ret < 0) { | 457 | if (ret < 0) |
454 | dev_err(&udfs->interface->dev, | 458 | dev_err(&udfs->interface->dev, |
455 | "control msg failed (start)\n"); | 459 | "control msg failed (start)\n"); |
456 | return ret; | ||
457 | } | ||
458 | 460 | ||
459 | return 0; | 461 | kfree(local_transfer_buffer); |
462 | return ret; | ||
460 | } | 463 | } |
461 | 464 | ||
462 | static int usbduxfastsub_stop(struct usbduxfastsub_s *udfs) | 465 | static int usbduxfastsub_stop(struct usbduxfastsub_s *udfs) |
463 | { | 466 | { |
464 | int ret; | 467 | int ret; |
465 | unsigned char local_transfer_buffer[16]; | 468 | unsigned char *local_transfer_buffer; |
469 | |||
470 | local_transfer_buffer = kmalloc(1, GFP_KERNEL); | ||
471 | if (!local_transfer_buffer) | ||
472 | return -ENOMEM; | ||
466 | 473 | ||
467 | /* 7f92 to one */ | 474 | /* 7f92 to one */ |
468 | local_transfer_buffer[0] = 1; | 475 | *local_transfer_buffer = 1; |
469 | /* bRequest, "Firmware" */ | 476 | /* bRequest, "Firmware" */ |
470 | ret = usb_control_msg(udfs->usbdev, usb_sndctrlpipe(udfs->usbdev, 0), | 477 | ret = usb_control_msg(udfs->usbdev, usb_sndctrlpipe(udfs->usbdev, 0), |
471 | USBDUXFASTSUB_FIRMWARE, | 478 | USBDUXFASTSUB_FIRMWARE, |
@@ -474,13 +481,12 @@ static int usbduxfastsub_stop(struct usbduxfastsub_s *udfs) | |||
474 | 0x0000, /* Index */ | 481 | 0x0000, /* Index */ |
475 | local_transfer_buffer, 1, /* Length */ | 482 | local_transfer_buffer, 1, /* Length */ |
476 | EZTIMEOUT); /* Timeout */ | 483 | EZTIMEOUT); /* Timeout */ |
477 | if (ret < 0) { | 484 | if (ret < 0) |
478 | dev_err(&udfs->interface->dev, | 485 | dev_err(&udfs->interface->dev, |
479 | "control msg failed (stop)\n"); | 486 | "control msg failed (stop)\n"); |
480 | return ret; | ||
481 | } | ||
482 | 487 | ||
483 | return 0; | 488 | kfree(local_transfer_buffer); |
489 | return ret; | ||
484 | } | 490 | } |
485 | 491 | ||
486 | static int usbduxfastsub_upload(struct usbduxfastsub_s *udfs, | 492 | static int usbduxfastsub_upload(struct usbduxfastsub_s *udfs, |
diff --git a/drivers/staging/comedi/drivers/usbduxsigma.c b/drivers/staging/comedi/drivers/usbduxsigma.c index d066351a71b2..a728c8fc32a2 100644 --- a/drivers/staging/comedi/drivers/usbduxsigma.c +++ b/drivers/staging/comedi/drivers/usbduxsigma.c | |||
@@ -681,7 +681,11 @@ static void usbduxsub_ao_IsocIrq(struct urb *urb) | |||
681 | static int usbduxsub_start(struct usbduxsub *usbduxsub) | 681 | static int usbduxsub_start(struct usbduxsub *usbduxsub) |
682 | { | 682 | { |
683 | int errcode = 0; | 683 | int errcode = 0; |
684 | uint8_t local_transfer_buffer[16]; | 684 | uint8_t *local_transfer_buffer; |
685 | |||
686 | local_transfer_buffer = kmalloc(16, GFP_KERNEL); | ||
687 | if (!local_transfer_buffer) | ||
688 | return -ENOMEM; | ||
685 | 689 | ||
686 | /* 7f92 to zero */ | 690 | /* 7f92 to zero */ |
687 | local_transfer_buffer[0] = 0; | 691 | local_transfer_buffer[0] = 0; |
@@ -702,19 +706,22 @@ static int usbduxsub_start(struct usbduxsub *usbduxsub) | |||
702 | 1, | 706 | 1, |
703 | /* Timeout */ | 707 | /* Timeout */ |
704 | BULK_TIMEOUT); | 708 | BULK_TIMEOUT); |
705 | if (errcode < 0) { | 709 | if (errcode < 0) |
706 | dev_err(&usbduxsub->interface->dev, | 710 | dev_err(&usbduxsub->interface->dev, |
707 | "comedi_: control msg failed (start)\n"); | 711 | "comedi_: control msg failed (start)\n"); |
708 | return errcode; | 712 | |
709 | } | 713 | kfree(local_transfer_buffer); |
710 | return 0; | 714 | return errcode; |
711 | } | 715 | } |
712 | 716 | ||
713 | static int usbduxsub_stop(struct usbduxsub *usbduxsub) | 717 | static int usbduxsub_stop(struct usbduxsub *usbduxsub) |
714 | { | 718 | { |
715 | int errcode = 0; | 719 | int errcode = 0; |
720 | uint8_t *local_transfer_buffer; | ||
716 | 721 | ||
717 | uint8_t local_transfer_buffer[16]; | 722 | local_transfer_buffer = kmalloc(16, GFP_KERNEL); |
723 | if (!local_transfer_buffer) | ||
724 | return -ENOMEM; | ||
718 | 725 | ||
719 | /* 7f92 to one */ | 726 | /* 7f92 to one */ |
720 | local_transfer_buffer[0] = 1; | 727 | local_transfer_buffer[0] = 1; |
@@ -732,12 +739,12 @@ static int usbduxsub_stop(struct usbduxsub *usbduxsub) | |||
732 | 1, | 739 | 1, |
733 | /* Timeout */ | 740 | /* Timeout */ |
734 | BULK_TIMEOUT); | 741 | BULK_TIMEOUT); |
735 | if (errcode < 0) { | 742 | if (errcode < 0) |
736 | dev_err(&usbduxsub->interface->dev, | 743 | dev_err(&usbduxsub->interface->dev, |
737 | "comedi_: control msg failed (stop)\n"); | 744 | "comedi_: control msg failed (stop)\n"); |
738 | return errcode; | 745 | |
739 | } | 746 | kfree(local_transfer_buffer); |
740 | return 0; | 747 | return errcode; |
741 | } | 748 | } |
742 | 749 | ||
743 | static int usbduxsub_upload(struct usbduxsub *usbduxsub, | 750 | static int usbduxsub_upload(struct usbduxsub *usbduxsub, |
diff --git a/drivers/staging/imx-drm/ipuv3-crtc.c b/drivers/staging/imx-drm/ipuv3-crtc.c index 4b3a019409b5..b028b0d1317b 100644 --- a/drivers/staging/imx-drm/ipuv3-crtc.c +++ b/drivers/staging/imx-drm/ipuv3-crtc.c | |||
@@ -483,17 +483,6 @@ static int ipu_get_resources(struct ipu_crtc *ipu_crtc, | |||
483 | goto err_out; | 483 | goto err_out; |
484 | } | 484 | } |
485 | 485 | ||
486 | ipu_crtc->irq = ipu_idmac_channel_irq(ipu, ipu_crtc->ipu_ch, | ||
487 | IPU_IRQ_EOF); | ||
488 | ret = devm_request_irq(ipu_crtc->dev, ipu_crtc->irq, ipu_irq_handler, 0, | ||
489 | "imx_drm", ipu_crtc); | ||
490 | if (ret < 0) { | ||
491 | dev_err(ipu_crtc->dev, "irq request failed with %d.\n", ret); | ||
492 | goto err_out; | ||
493 | } | ||
494 | |||
495 | disable_irq(ipu_crtc->irq); | ||
496 | |||
497 | return 0; | 486 | return 0; |
498 | err_out: | 487 | err_out: |
499 | ipu_put_resources(ipu_crtc); | 488 | ipu_put_resources(ipu_crtc); |
@@ -504,6 +493,7 @@ err_out: | |||
504 | static int ipu_crtc_init(struct ipu_crtc *ipu_crtc, | 493 | static int ipu_crtc_init(struct ipu_crtc *ipu_crtc, |
505 | struct ipu_client_platformdata *pdata) | 494 | struct ipu_client_platformdata *pdata) |
506 | { | 495 | { |
496 | struct ipu_soc *ipu = dev_get_drvdata(ipu_crtc->dev->parent); | ||
507 | int ret; | 497 | int ret; |
508 | 498 | ||
509 | ret = ipu_get_resources(ipu_crtc, pdata); | 499 | ret = ipu_get_resources(ipu_crtc, pdata); |
@@ -522,6 +512,17 @@ static int ipu_crtc_init(struct ipu_crtc *ipu_crtc, | |||
522 | goto err_put_resources; | 512 | goto err_put_resources; |
523 | } | 513 | } |
524 | 514 | ||
515 | ipu_crtc->irq = ipu_idmac_channel_irq(ipu, ipu_crtc->ipu_ch, | ||
516 | IPU_IRQ_EOF); | ||
517 | ret = devm_request_irq(ipu_crtc->dev, ipu_crtc->irq, ipu_irq_handler, 0, | ||
518 | "imx_drm", ipu_crtc); | ||
519 | if (ret < 0) { | ||
520 | dev_err(ipu_crtc->dev, "irq request failed with %d.\n", ret); | ||
521 | goto err_put_resources; | ||
522 | } | ||
523 | |||
524 | disable_irq(ipu_crtc->irq); | ||
525 | |||
525 | return 0; | 526 | return 0; |
526 | 527 | ||
527 | err_put_resources: | 528 | err_put_resources: |
diff --git a/drivers/staging/tidspbridge/rmgr/drv.c b/drivers/staging/tidspbridge/rmgr/drv.c index db1da28cecba..be26917a6896 100644 --- a/drivers/staging/tidspbridge/rmgr/drv.c +++ b/drivers/staging/tidspbridge/rmgr/drv.c | |||
@@ -76,37 +76,28 @@ int drv_insert_node_res_element(void *hnode, void *node_resource, | |||
76 | struct node_res_object **node_res_obj = | 76 | struct node_res_object **node_res_obj = |
77 | (struct node_res_object **)node_resource; | 77 | (struct node_res_object **)node_resource; |
78 | struct process_context *ctxt = (struct process_context *)process_ctxt; | 78 | struct process_context *ctxt = (struct process_context *)process_ctxt; |
79 | int status = 0; | ||
80 | int retval; | 79 | int retval; |
81 | 80 | ||
82 | *node_res_obj = kzalloc(sizeof(struct node_res_object), GFP_KERNEL); | 81 | *node_res_obj = kzalloc(sizeof(struct node_res_object), GFP_KERNEL); |
83 | if (!*node_res_obj) { | 82 | if (!*node_res_obj) |
84 | status = -ENOMEM; | 83 | return -ENOMEM; |
85 | goto func_end; | ||
86 | } | ||
87 | 84 | ||
88 | (*node_res_obj)->node = hnode; | 85 | (*node_res_obj)->node = hnode; |
89 | retval = idr_get_new(ctxt->node_id, *node_res_obj, | 86 | retval = idr_alloc(ctxt->node_id, *node_res_obj, 0, 0, GFP_KERNEL); |
90 | &(*node_res_obj)->id); | 87 | if (retval >= 0) { |
91 | if (retval == -EAGAIN) { | 88 | (*node_res_obj)->id = retval; |
92 | if (!idr_pre_get(ctxt->node_id, GFP_KERNEL)) { | 89 | return 0; |
93 | pr_err("%s: OUT OF MEMORY\n", __func__); | ||
94 | status = -ENOMEM; | ||
95 | goto func_end; | ||
96 | } | ||
97 | |||
98 | retval = idr_get_new(ctxt->node_id, *node_res_obj, | ||
99 | &(*node_res_obj)->id); | ||
100 | } | 90 | } |
101 | if (retval) { | 91 | |
92 | kfree(*node_res_obj); | ||
93 | |||
94 | if (retval == -ENOSPC) { | ||
102 | pr_err("%s: FAILED, IDR is FULL\n", __func__); | 95 | pr_err("%s: FAILED, IDR is FULL\n", __func__); |
103 | status = -EFAULT; | 96 | return -EFAULT; |
97 | } else { | ||
98 | pr_err("%s: OUT OF MEMORY\n", __func__); | ||
99 | return -ENOMEM; | ||
104 | } | 100 | } |
105 | func_end: | ||
106 | if (status) | ||
107 | kfree(*node_res_obj); | ||
108 | |||
109 | return status; | ||
110 | } | 101 | } |
111 | 102 | ||
112 | /* Release all Node resources and its context | 103 | /* Release all Node resources and its context |
@@ -201,35 +192,26 @@ int drv_proc_insert_strm_res_element(void *stream_obj, | |||
201 | struct strm_res_object **pstrm_res = | 192 | struct strm_res_object **pstrm_res = |
202 | (struct strm_res_object **)strm_res; | 193 | (struct strm_res_object **)strm_res; |
203 | struct process_context *ctxt = (struct process_context *)process_ctxt; | 194 | struct process_context *ctxt = (struct process_context *)process_ctxt; |
204 | int status = 0; | ||
205 | int retval; | 195 | int retval; |
206 | 196 | ||
207 | *pstrm_res = kzalloc(sizeof(struct strm_res_object), GFP_KERNEL); | 197 | *pstrm_res = kzalloc(sizeof(struct strm_res_object), GFP_KERNEL); |
208 | if (*pstrm_res == NULL) { | 198 | if (*pstrm_res == NULL) |
209 | status = -EFAULT; | 199 | return -EFAULT; |
210 | goto func_end; | ||
211 | } | ||
212 | 200 | ||
213 | (*pstrm_res)->stream = stream_obj; | 201 | (*pstrm_res)->stream = stream_obj; |
214 | retval = idr_get_new(ctxt->stream_id, *pstrm_res, | 202 | retval = idr_alloc(ctxt->stream_id, *pstrm_res, 0, 0, GFP_KERNEL); |
215 | &(*pstrm_res)->id); | 203 | if (retval >= 0) { |
216 | if (retval == -EAGAIN) { | 204 | (*pstrm_res)->id = retval; |
217 | if (!idr_pre_get(ctxt->stream_id, GFP_KERNEL)) { | 205 | return 0; |
218 | pr_err("%s: OUT OF MEMORY\n", __func__); | ||
219 | status = -ENOMEM; | ||
220 | goto func_end; | ||
221 | } | ||
222 | |||
223 | retval = idr_get_new(ctxt->stream_id, *pstrm_res, | ||
224 | &(*pstrm_res)->id); | ||
225 | } | 206 | } |
226 | if (retval) { | 207 | |
208 | if (retval == -ENOSPC) { | ||
227 | pr_err("%s: FAILED, IDR is FULL\n", __func__); | 209 | pr_err("%s: FAILED, IDR is FULL\n", __func__); |
228 | status = -EPERM; | 210 | return -EPERM; |
211 | } else { | ||
212 | pr_err("%s: OUT OF MEMORY\n", __func__); | ||
213 | return -ENOMEM; | ||
229 | } | 214 | } |
230 | |||
231 | func_end: | ||
232 | return status; | ||
233 | } | 215 | } |
234 | 216 | ||
235 | static int drv_proc_free_strm_res(int id, void *p, void *process_ctxt) | 217 | static int drv_proc_free_strm_res(int id, void *p, void *process_ctxt) |
diff --git a/drivers/staging/vt6656/card.c b/drivers/staging/vt6656/card.c index 22918a106d73..d2479b766450 100644 --- a/drivers/staging/vt6656/card.c +++ b/drivers/staging/vt6656/card.c | |||
@@ -790,7 +790,7 @@ u64 CARDqGetNextTBTT(u64 qwTSF, WORD wBeaconInterval) | |||
790 | if ((~uLowNextTBTT) < uLowRemain) | 790 | if ((~uLowNextTBTT) < uLowRemain) |
791 | qwTSF = ((qwTSF >> 32) + 1) << 32; | 791 | qwTSF = ((qwTSF >> 32) + 1) << 32; |
792 | 792 | ||
793 | qwTSF = (qwTSF & 0xffffffff00000000UL) | | 793 | qwTSF = (qwTSF & 0xffffffff00000000ULL) | |
794 | (u64)(uLowNextTBTT + uLowRemain); | 794 | (u64)(uLowNextTBTT + uLowRemain); |
795 | 795 | ||
796 | return (qwTSF); | 796 | return (qwTSF); |
diff --git a/drivers/staging/vt6656/main_usb.c b/drivers/staging/vt6656/main_usb.c index d5f53e1a74a2..a5063a6f64d9 100644 --- a/drivers/staging/vt6656/main_usb.c +++ b/drivers/staging/vt6656/main_usb.c | |||
@@ -669,8 +669,6 @@ static int vt6656_suspend(struct usb_interface *intf, pm_message_t message) | |||
669 | if (device->flags & DEVICE_FLAGS_OPENED) | 669 | if (device->flags & DEVICE_FLAGS_OPENED) |
670 | device_close(device->dev); | 670 | device_close(device->dev); |
671 | 671 | ||
672 | usb_put_dev(interface_to_usbdev(intf)); | ||
673 | |||
674 | return 0; | 672 | return 0; |
675 | } | 673 | } |
676 | 674 | ||
@@ -681,8 +679,6 @@ static int vt6656_resume(struct usb_interface *intf) | |||
681 | if (!device || !device->dev) | 679 | if (!device || !device->dev) |
682 | return -ENODEV; | 680 | return -ENODEV; |
683 | 681 | ||
684 | usb_get_dev(interface_to_usbdev(intf)); | ||
685 | |||
686 | if (!(device->flags & DEVICE_FLAGS_OPENED)) | 682 | if (!(device->flags & DEVICE_FLAGS_OPENED)) |
687 | device_open(device->dev); | 683 | device_open(device->dev); |
688 | 684 | ||
diff --git a/drivers/staging/zcache/ramster/tcp.c b/drivers/staging/zcache/ramster/tcp.c index aa2a1a763aa4..f6e1e5209d88 100644 --- a/drivers/staging/zcache/ramster/tcp.c +++ b/drivers/staging/zcache/ramster/tcp.c | |||
@@ -300,27 +300,22 @@ static u8 r2net_num_from_nn(struct r2net_node *nn) | |||
300 | 300 | ||
301 | static int r2net_prep_nsw(struct r2net_node *nn, struct r2net_status_wait *nsw) | 301 | static int r2net_prep_nsw(struct r2net_node *nn, struct r2net_status_wait *nsw) |
302 | { | 302 | { |
303 | int ret = 0; | 303 | int ret; |
304 | 304 | ||
305 | do { | 305 | spin_lock(&nn->nn_lock); |
306 | if (!idr_pre_get(&nn->nn_status_idr, GFP_ATOMIC)) { | 306 | ret = idr_alloc(&nn->nn_status_idr, nsw, 0, 0, GFP_ATOMIC); |
307 | ret = -EAGAIN; | 307 | if (ret >= 0) { |
308 | break; | 308 | nsw->ns_id = ret; |
309 | } | 309 | list_add_tail(&nsw->ns_node_item, &nn->nn_status_list); |
310 | spin_lock(&nn->nn_lock); | 310 | } |
311 | ret = idr_get_new(&nn->nn_status_idr, nsw, &nsw->ns_id); | 311 | spin_unlock(&nn->nn_lock); |
312 | if (ret == 0) | ||
313 | list_add_tail(&nsw->ns_node_item, | ||
314 | &nn->nn_status_list); | ||
315 | spin_unlock(&nn->nn_lock); | ||
316 | } while (ret == -EAGAIN); | ||
317 | 312 | ||
318 | if (ret == 0) { | 313 | if (ret >= 0) { |
319 | init_waitqueue_head(&nsw->ns_wq); | 314 | init_waitqueue_head(&nsw->ns_wq); |
320 | nsw->ns_sys_status = R2NET_ERR_NONE; | 315 | nsw->ns_sys_status = R2NET_ERR_NONE; |
321 | nsw->ns_status = 0; | 316 | nsw->ns_status = 0; |
317 | return 0; | ||
322 | } | 318 | } |
323 | |||
324 | return ret; | 319 | return ret; |
325 | } | 320 | } |
326 | 321 | ||
diff --git a/drivers/target/iscsi/iscsi_target_auth.c b/drivers/target/iscsi/iscsi_target_auth.c index db0cf7c8adde..a0fc7b9eea65 100644 --- a/drivers/target/iscsi/iscsi_target_auth.c +++ b/drivers/target/iscsi/iscsi_target_auth.c | |||
@@ -166,6 +166,7 @@ static int chap_server_compute_md5( | |||
166 | { | 166 | { |
167 | char *endptr; | 167 | char *endptr; |
168 | unsigned long id; | 168 | unsigned long id; |
169 | unsigned char id_as_uchar; | ||
169 | unsigned char digest[MD5_SIGNATURE_SIZE]; | 170 | unsigned char digest[MD5_SIGNATURE_SIZE]; |
170 | unsigned char type, response[MD5_SIGNATURE_SIZE * 2 + 2]; | 171 | unsigned char type, response[MD5_SIGNATURE_SIZE * 2 + 2]; |
171 | unsigned char identifier[10], *challenge = NULL; | 172 | unsigned char identifier[10], *challenge = NULL; |
@@ -355,7 +356,9 @@ static int chap_server_compute_md5( | |||
355 | goto out; | 356 | goto out; |
356 | } | 357 | } |
357 | 358 | ||
358 | sg_init_one(&sg, &id, 1); | 359 | /* To handle both endiannesses */ |
360 | id_as_uchar = id; | ||
361 | sg_init_one(&sg, &id_as_uchar, 1); | ||
359 | ret = crypto_hash_update(&desc, &sg, 1); | 362 | ret = crypto_hash_update(&desc, &sg, 1); |
360 | if (ret < 0) { | 363 | if (ret < 0) { |
361 | pr_err("crypto_hash_update() failed for id\n"); | 364 | pr_err("crypto_hash_update() failed for id\n"); |
diff --git a/drivers/target/target_core_file.h b/drivers/target/target_core_file.h index bc02b018ae46..37ffc5bd2399 100644 --- a/drivers/target/target_core_file.h +++ b/drivers/target/target_core_file.h | |||
@@ -7,7 +7,7 @@ | |||
7 | #define FD_DEVICE_QUEUE_DEPTH 32 | 7 | #define FD_DEVICE_QUEUE_DEPTH 32 |
8 | #define FD_MAX_DEVICE_QUEUE_DEPTH 128 | 8 | #define FD_MAX_DEVICE_QUEUE_DEPTH 128 |
9 | #define FD_BLOCKSIZE 512 | 9 | #define FD_BLOCKSIZE 512 |
10 | #define FD_MAX_SECTORS 1024 | 10 | #define FD_MAX_SECTORS 2048 |
11 | 11 | ||
12 | #define RRF_EMULATE_CDB 0x01 | 12 | #define RRF_EMULATE_CDB 0x01 |
13 | #define RRF_GOT_LBA 0x02 | 13 | #define RRF_GOT_LBA 0x02 |
diff --git a/drivers/target/target_core_pscsi.c b/drivers/target/target_core_pscsi.c index 82e78d72fdb6..e992b27aa090 100644 --- a/drivers/target/target_core_pscsi.c +++ b/drivers/target/target_core_pscsi.c | |||
@@ -883,7 +883,14 @@ pscsi_map_sg(struct se_cmd *cmd, struct scatterlist *sgl, u32 sgl_nents, | |||
883 | pr_debug("PSCSI: i: %d page: %p len: %d off: %d\n", i, | 883 | pr_debug("PSCSI: i: %d page: %p len: %d off: %d\n", i, |
884 | page, len, off); | 884 | page, len, off); |
885 | 885 | ||
886 | while (len > 0 && data_len > 0) { | 886 | /* |
887 | * We only have one page of data in each sg element, | ||
888 | * we can not cross a page boundary. | ||
889 | */ | ||
890 | if (off + len > PAGE_SIZE) | ||
891 | goto fail; | ||
892 | |||
893 | if (len > 0 && data_len > 0) { | ||
887 | bytes = min_t(unsigned int, len, PAGE_SIZE - off); | 894 | bytes = min_t(unsigned int, len, PAGE_SIZE - off); |
888 | bytes = min(bytes, data_len); | 895 | bytes = min(bytes, data_len); |
889 | 896 | ||
@@ -940,9 +947,7 @@ pscsi_map_sg(struct se_cmd *cmd, struct scatterlist *sgl, u32 sgl_nents, | |||
940 | bio = NULL; | 947 | bio = NULL; |
941 | } | 948 | } |
942 | 949 | ||
943 | len -= bytes; | ||
944 | data_len -= bytes; | 950 | data_len -= bytes; |
945 | off = 0; | ||
946 | } | 951 | } |
947 | } | 952 | } |
948 | 953 | ||
diff --git a/drivers/target/target_core_sbc.c b/drivers/target/target_core_sbc.c index 290230de2c53..60d4b5185f32 100644 --- a/drivers/target/target_core_sbc.c +++ b/drivers/target/target_core_sbc.c | |||
@@ -464,8 +464,11 @@ sbc_parse_cdb(struct se_cmd *cmd, struct sbc_ops *ops) | |||
464 | break; | 464 | break; |
465 | case SYNCHRONIZE_CACHE: | 465 | case SYNCHRONIZE_CACHE: |
466 | case SYNCHRONIZE_CACHE_16: | 466 | case SYNCHRONIZE_CACHE_16: |
467 | if (!ops->execute_sync_cache) | 467 | if (!ops->execute_sync_cache) { |
468 | return TCM_UNSUPPORTED_SCSI_OPCODE; | 468 | size = 0; |
469 | cmd->execute_cmd = sbc_emulate_noop; | ||
470 | break; | ||
471 | } | ||
469 | 472 | ||
470 | /* | 473 | /* |
471 | * Extract LBA and range to be flushed for emulated SYNCHRONIZE_CACHE | 474 | * Extract LBA and range to be flushed for emulated SYNCHRONIZE_CACHE |
diff --git a/drivers/target/target_core_tpg.c b/drivers/target/target_core_tpg.c index 9169d6a5d7e4..aac9d2727e3c 100644 --- a/drivers/target/target_core_tpg.c +++ b/drivers/target/target_core_tpg.c | |||
@@ -711,7 +711,8 @@ int core_tpg_register( | |||
711 | 711 | ||
712 | if (se_tpg->se_tpg_type == TRANSPORT_TPG_TYPE_NORMAL) { | 712 | if (se_tpg->se_tpg_type == TRANSPORT_TPG_TYPE_NORMAL) { |
713 | if (core_tpg_setup_virtual_lun0(se_tpg) < 0) { | 713 | if (core_tpg_setup_virtual_lun0(se_tpg) < 0) { |
714 | kfree(se_tpg); | 714 | array_free(se_tpg->tpg_lun_list, |
715 | TRANSPORT_MAX_LUNS_PER_TPG); | ||
715 | return -ENOMEM; | 716 | return -ENOMEM; |
716 | } | 717 | } |
717 | } | 718 | } |
diff --git a/drivers/thermal/dove_thermal.c b/drivers/thermal/dove_thermal.c index 7b0bfa0e7a9c..3078c403b42d 100644 --- a/drivers/thermal/dove_thermal.c +++ b/drivers/thermal/dove_thermal.c | |||
@@ -143,22 +143,18 @@ static int dove_thermal_probe(struct platform_device *pdev) | |||
143 | if (!priv) | 143 | if (!priv) |
144 | return -ENOMEM; | 144 | return -ENOMEM; |
145 | 145 | ||
146 | priv->sensor = devm_request_and_ioremap(&pdev->dev, res); | 146 | priv->sensor = devm_ioremap_resource(&pdev->dev, res); |
147 | if (!priv->sensor) { | 147 | if (IS_ERR(priv->sensor)) |
148 | dev_err(&pdev->dev, "Failed to request_ioremap memory\n"); | 148 | return PTR_ERR(priv->sensor); |
149 | return -EADDRNOTAVAIL; | ||
150 | } | ||
151 | 149 | ||
152 | res = platform_get_resource(pdev, IORESOURCE_MEM, 1); | 150 | res = platform_get_resource(pdev, IORESOURCE_MEM, 1); |
153 | if (!res) { | 151 | if (!res) { |
154 | dev_err(&pdev->dev, "Failed to get platform resource\n"); | 152 | dev_err(&pdev->dev, "Failed to get platform resource\n"); |
155 | return -ENODEV; | 153 | return -ENODEV; |
156 | } | 154 | } |
157 | priv->control = devm_request_and_ioremap(&pdev->dev, res); | 155 | priv->control = devm_ioremap_resource(&pdev->dev, res); |
158 | if (!priv->control) { | 156 | if (IS_ERR(priv->control)) |
159 | dev_err(&pdev->dev, "Failed to request_ioremap memory\n"); | 157 | return PTR_ERR(priv->control); |
160 | return -EADDRNOTAVAIL; | ||
161 | } | ||
162 | 158 | ||
163 | ret = dove_init_sensor(priv); | 159 | ret = dove_init_sensor(priv); |
164 | if (ret) { | 160 | if (ret) { |
diff --git a/drivers/thermal/exynos_thermal.c b/drivers/thermal/exynos_thermal.c index e04ebd8671ac..46568c078dee 100644 --- a/drivers/thermal/exynos_thermal.c +++ b/drivers/thermal/exynos_thermal.c | |||
@@ -476,7 +476,7 @@ static int exynos_register_thermal(struct thermal_sensor_conf *sensor_conf) | |||
476 | 476 | ||
477 | if (IS_ERR(th_zone->therm_dev)) { | 477 | if (IS_ERR(th_zone->therm_dev)) { |
478 | pr_err("Failed to register thermal zone device\n"); | 478 | pr_err("Failed to register thermal zone device\n"); |
479 | ret = -EINVAL; | 479 | ret = PTR_ERR(th_zone->therm_dev); |
480 | goto err_unregister; | 480 | goto err_unregister; |
481 | } | 481 | } |
482 | th_zone->mode = THERMAL_DEVICE_ENABLED; | 482 | th_zone->mode = THERMAL_DEVICE_ENABLED; |
diff --git a/drivers/thermal/kirkwood_thermal.c b/drivers/thermal/kirkwood_thermal.c index 65cb4f09e8f6..e5500edb5285 100644 --- a/drivers/thermal/kirkwood_thermal.c +++ b/drivers/thermal/kirkwood_thermal.c | |||
@@ -85,11 +85,9 @@ static int kirkwood_thermal_probe(struct platform_device *pdev) | |||
85 | if (!priv) | 85 | if (!priv) |
86 | return -ENOMEM; | 86 | return -ENOMEM; |
87 | 87 | ||
88 | priv->sensor = devm_request_and_ioremap(&pdev->dev, res); | 88 | priv->sensor = devm_ioremap_resource(&pdev->dev, res); |
89 | if (!priv->sensor) { | 89 | if (IS_ERR(priv->sensor)) |
90 | dev_err(&pdev->dev, "Failed to request_ioremap memory\n"); | 90 | return PTR_ERR(priv->sensor); |
91 | return -EADDRNOTAVAIL; | ||
92 | } | ||
93 | 91 | ||
94 | thermal = thermal_zone_device_register("kirkwood_thermal", 0, 0, | 92 | thermal = thermal_zone_device_register("kirkwood_thermal", 0, 0, |
95 | priv, &ops, NULL, 0, 0); | 93 | priv, &ops, NULL, 0, 0); |
diff --git a/drivers/thermal/rcar_thermal.c b/drivers/thermal/rcar_thermal.c index 28f091994013..2cc5b6115e3e 100644 --- a/drivers/thermal/rcar_thermal.c +++ b/drivers/thermal/rcar_thermal.c | |||
@@ -145,6 +145,7 @@ static int rcar_thermal_update_temp(struct rcar_thermal_priv *priv) | |||
145 | struct device *dev = rcar_priv_to_dev(priv); | 145 | struct device *dev = rcar_priv_to_dev(priv); |
146 | int i; | 146 | int i; |
147 | int ctemp, old, new; | 147 | int ctemp, old, new; |
148 | int ret = -EINVAL; | ||
148 | 149 | ||
149 | mutex_lock(&priv->lock); | 150 | mutex_lock(&priv->lock); |
150 | 151 | ||
@@ -174,7 +175,7 @@ static int rcar_thermal_update_temp(struct rcar_thermal_priv *priv) | |||
174 | 175 | ||
175 | if (!ctemp) { | 176 | if (!ctemp) { |
176 | dev_err(dev, "thermal sensor was broken\n"); | 177 | dev_err(dev, "thermal sensor was broken\n"); |
177 | return -EINVAL; | 178 | goto err_out_unlock; |
178 | } | 179 | } |
179 | 180 | ||
180 | /* | 181 | /* |
@@ -192,10 +193,10 @@ static int rcar_thermal_update_temp(struct rcar_thermal_priv *priv) | |||
192 | dev_dbg(dev, "thermal%d %d -> %d\n", priv->id, priv->ctemp, ctemp); | 193 | dev_dbg(dev, "thermal%d %d -> %d\n", priv->id, priv->ctemp, ctemp); |
193 | 194 | ||
194 | priv->ctemp = ctemp; | 195 | priv->ctemp = ctemp; |
195 | 196 | ret = 0; | |
197 | err_out_unlock: | ||
196 | mutex_unlock(&priv->lock); | 198 | mutex_unlock(&priv->lock); |
197 | 199 | return ret; | |
198 | return 0; | ||
199 | } | 200 | } |
200 | 201 | ||
201 | static int rcar_thermal_get_temp(struct thermal_zone_device *zone, | 202 | static int rcar_thermal_get_temp(struct thermal_zone_device *zone, |
@@ -363,6 +364,7 @@ static int rcar_thermal_probe(struct platform_device *pdev) | |||
363 | struct resource *res, *irq; | 364 | struct resource *res, *irq; |
364 | int mres = 0; | 365 | int mres = 0; |
365 | int i; | 366 | int i; |
367 | int ret = -ENODEV; | ||
366 | int idle = IDLE_INTERVAL; | 368 | int idle = IDLE_INTERVAL; |
367 | 369 | ||
368 | common = devm_kzalloc(dev, sizeof(*common), GFP_KERNEL); | 370 | common = devm_kzalloc(dev, sizeof(*common), GFP_KERNEL); |
@@ -399,11 +401,9 @@ static int rcar_thermal_probe(struct platform_device *pdev) | |||
399 | /* | 401 | /* |
400 | * rcar_has_irq_support() will be enabled | 402 | * rcar_has_irq_support() will be enabled |
401 | */ | 403 | */ |
402 | common->base = devm_request_and_ioremap(dev, res); | 404 | common->base = devm_ioremap_resource(dev, res); |
403 | if (!common->base) { | 405 | if (IS_ERR(common->base)) |
404 | dev_err(dev, "Unable to ioremap thermal register\n"); | 406 | return PTR_ERR(common->base); |
405 | return -ENOMEM; | ||
406 | } | ||
407 | 407 | ||
408 | /* enable temperature comparation */ | 408 | /* enable temperature comparation */ |
409 | rcar_thermal_common_write(common, ENR, 0x00030303); | 409 | rcar_thermal_common_write(common, ENR, 0x00030303); |
@@ -422,11 +422,9 @@ static int rcar_thermal_probe(struct platform_device *pdev) | |||
422 | return -ENOMEM; | 422 | return -ENOMEM; |
423 | } | 423 | } |
424 | 424 | ||
425 | priv->base = devm_request_and_ioremap(dev, res); | 425 | priv->base = devm_ioremap_resource(dev, res); |
426 | if (!priv->base) { | 426 | if (IS_ERR(priv->base)) |
427 | dev_err(dev, "Unable to ioremap priv register\n"); | 427 | return PTR_ERR(priv->base); |
428 | return -ENOMEM; | ||
429 | } | ||
430 | 428 | ||
431 | priv->common = common; | 429 | priv->common = common; |
432 | priv->id = i; | 430 | priv->id = i; |
@@ -441,6 +439,7 @@ static int rcar_thermal_probe(struct platform_device *pdev) | |||
441 | idle); | 439 | idle); |
442 | if (IS_ERR(priv->zone)) { | 440 | if (IS_ERR(priv->zone)) { |
443 | dev_err(dev, "can't register thermal zone\n"); | 441 | dev_err(dev, "can't register thermal zone\n"); |
442 | ret = PTR_ERR(priv->zone); | ||
444 | goto error_unregister; | 443 | goto error_unregister; |
445 | } | 444 | } |
446 | 445 | ||
@@ -460,7 +459,7 @@ error_unregister: | |||
460 | rcar_thermal_for_each_priv(priv, common) | 459 | rcar_thermal_for_each_priv(priv, common) |
461 | thermal_zone_device_unregister(priv->zone); | 460 | thermal_zone_device_unregister(priv->zone); |
462 | 461 | ||
463 | return -ENODEV; | 462 | return ret; |
464 | } | 463 | } |
465 | 464 | ||
466 | static int rcar_thermal_remove(struct platform_device *pdev) | 465 | static int rcar_thermal_remove(struct platform_device *pdev) |
diff --git a/drivers/tty/serial/8250/8250.c b/drivers/tty/serial/8250/8250.c index 0efc815a4968..cf6a5383748a 100644 --- a/drivers/tty/serial/8250/8250.c +++ b/drivers/tty/serial/8250/8250.c | |||
@@ -301,7 +301,28 @@ static const struct serial8250_config uart_config[] = { | |||
301 | }, | 301 | }, |
302 | [PORT_8250_CIR] = { | 302 | [PORT_8250_CIR] = { |
303 | .name = "CIR port" | 303 | .name = "CIR port" |
304 | } | 304 | }, |
305 | [PORT_ALTR_16550_F32] = { | ||
306 | .name = "Altera 16550 FIFO32", | ||
307 | .fifo_size = 32, | ||
308 | .tx_loadsz = 32, | ||
309 | .fcr = UART_FCR_ENABLE_FIFO | UART_FCR_R_TRIG_10, | ||
310 | .flags = UART_CAP_FIFO | UART_CAP_AFE, | ||
311 | }, | ||
312 | [PORT_ALTR_16550_F64] = { | ||
313 | .name = "Altera 16550 FIFO64", | ||
314 | .fifo_size = 64, | ||
315 | .tx_loadsz = 64, | ||
316 | .fcr = UART_FCR_ENABLE_FIFO | UART_FCR_R_TRIG_10, | ||
317 | .flags = UART_CAP_FIFO | UART_CAP_AFE, | ||
318 | }, | ||
319 | [PORT_ALTR_16550_F128] = { | ||
320 | .name = "Altera 16550 FIFO128", | ||
321 | .fifo_size = 128, | ||
322 | .tx_loadsz = 128, | ||
323 | .fcr = UART_FCR_ENABLE_FIFO | UART_FCR_R_TRIG_10, | ||
324 | .flags = UART_CAP_FIFO | UART_CAP_AFE, | ||
325 | }, | ||
305 | }; | 326 | }; |
306 | 327 | ||
307 | /* Uart divisor latch read */ | 328 | /* Uart divisor latch read */ |
@@ -3396,3 +3417,32 @@ module_param_array(probe_rsa, ulong, &probe_rsa_count, 0444); | |||
3396 | MODULE_PARM_DESC(probe_rsa, "Probe I/O ports for RSA"); | 3417 | MODULE_PARM_DESC(probe_rsa, "Probe I/O ports for RSA"); |
3397 | #endif | 3418 | #endif |
3398 | MODULE_ALIAS_CHARDEV_MAJOR(TTY_MAJOR); | 3419 | MODULE_ALIAS_CHARDEV_MAJOR(TTY_MAJOR); |
3420 | |||
3421 | #ifndef MODULE | ||
3422 | /* This module was renamed to 8250_core in 3.7. Keep the old "8250" name | ||
3423 | * working as well for the module options so we don't break people. We | ||
3424 | * need to keep the names identical and the convenient macros will happily | ||
3425 | * refuse to let us do that by failing the build with redefinition errors | ||
3426 | * of global variables. So we stick them inside a dummy function to avoid | ||
3427 | * those conflicts. The options still get parsed, and the redefined | ||
3428 | * MODULE_PARAM_PREFIX lets us keep the "8250." syntax alive. | ||
3429 | * | ||
3430 | * This is hacky. I'm sorry. | ||
3431 | */ | ||
3432 | static void __used s8250_options(void) | ||
3433 | { | ||
3434 | #undef MODULE_PARAM_PREFIX | ||
3435 | #define MODULE_PARAM_PREFIX "8250." | ||
3436 | |||
3437 | module_param_cb(share_irqs, ¶m_ops_uint, &share_irqs, 0644); | ||
3438 | module_param_cb(nr_uarts, ¶m_ops_uint, &nr_uarts, 0644); | ||
3439 | module_param_cb(skip_txen_test, ¶m_ops_uint, &skip_txen_test, 0644); | ||
3440 | #ifdef CONFIG_SERIAL_8250_RSA | ||
3441 | __module_param_call(MODULE_PARAM_PREFIX, probe_rsa, | ||
3442 | ¶m_array_ops, .arr = &__param_arr_probe_rsa, | ||
3443 | 0444, -1); | ||
3444 | #endif | ||
3445 | } | ||
3446 | #else | ||
3447 | MODULE_ALIAS("8250"); | ||
3448 | #endif | ||
diff --git a/drivers/tty/serial/8250/8250_pci.c b/drivers/tty/serial/8250/8250_pci.c index 791c5a77ec61..aa76825229dc 100644 --- a/drivers/tty/serial/8250/8250_pci.c +++ b/drivers/tty/serial/8250/8250_pci.c | |||
@@ -1571,6 +1571,7 @@ pci_wch_ch353_setup(struct serial_private *priv, | |||
1571 | 1571 | ||
1572 | /* Unknown vendors/cards - this should not be in linux/pci_ids.h */ | 1572 | /* Unknown vendors/cards - this should not be in linux/pci_ids.h */ |
1573 | #define PCI_SUBDEVICE_ID_UNKNOWN_0x1584 0x1584 | 1573 | #define PCI_SUBDEVICE_ID_UNKNOWN_0x1584 0x1584 |
1574 | #define PCI_SUBDEVICE_ID_UNKNOWN_0x1588 0x1588 | ||
1574 | 1575 | ||
1575 | /* | 1576 | /* |
1576 | * Master list of serial port init/setup/exit quirks. | 1577 | * Master list of serial port init/setup/exit quirks. |
@@ -1852,15 +1853,6 @@ static struct pci_serial_quirk pci_serial_quirks[] __refdata = { | |||
1852 | }, | 1853 | }, |
1853 | { | 1854 | { |
1854 | .vendor = PCI_VENDOR_ID_PLX, | 1855 | .vendor = PCI_VENDOR_ID_PLX, |
1855 | .device = PCI_DEVICE_ID_PLX_9050, | ||
1856 | .subvendor = PCI_VENDOR_ID_PLX, | ||
1857 | .subdevice = PCI_SUBDEVICE_ID_UNKNOWN_0x1584, | ||
1858 | .init = pci_plx9050_init, | ||
1859 | .setup = pci_default_setup, | ||
1860 | .exit = pci_plx9050_exit, | ||
1861 | }, | ||
1862 | { | ||
1863 | .vendor = PCI_VENDOR_ID_PLX, | ||
1864 | .device = PCI_DEVICE_ID_PLX_ROMULUS, | 1856 | .device = PCI_DEVICE_ID_PLX_ROMULUS, |
1865 | .subvendor = PCI_VENDOR_ID_PLX, | 1857 | .subvendor = PCI_VENDOR_ID_PLX, |
1866 | .subdevice = PCI_DEVICE_ID_PLX_ROMULUS, | 1858 | .subdevice = PCI_DEVICE_ID_PLX_ROMULUS, |
@@ -3733,7 +3725,12 @@ static struct pci_device_id serial_pci_tbl[] = { | |||
3733 | { PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_9050, | 3725 | { PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_9050, |
3734 | PCI_VENDOR_ID_PLX, | 3726 | PCI_VENDOR_ID_PLX, |
3735 | PCI_SUBDEVICE_ID_UNKNOWN_0x1584, 0, 0, | 3727 | PCI_SUBDEVICE_ID_UNKNOWN_0x1584, 0, 0, |
3736 | pbn_b0_4_115200 }, | 3728 | pbn_b2_4_115200 }, |
3729 | /* Unknown card - subdevice 0x1588 */ | ||
3730 | { PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_9050, | ||
3731 | PCI_VENDOR_ID_PLX, | ||
3732 | PCI_SUBDEVICE_ID_UNKNOWN_0x1588, 0, 0, | ||
3733 | pbn_b2_8_115200 }, | ||
3737 | { PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_9050, | 3734 | { PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_9050, |
3738 | PCI_SUBVENDOR_ID_KEYSPAN, | 3735 | PCI_SUBVENDOR_ID_KEYSPAN, |
3739 | PCI_SUBDEVICE_ID_KEYSPAN_SX2, 0, 0, | 3736 | PCI_SUBDEVICE_ID_KEYSPAN_SX2, 0, 0, |
@@ -4791,6 +4788,10 @@ static struct pci_device_id serial_pci_tbl[] = { | |||
4791 | PCI_VENDOR_ID_IBM, 0x0299, | 4788 | PCI_VENDOR_ID_IBM, 0x0299, |
4792 | 0, 0, pbn_b0_bt_2_115200 }, | 4789 | 0, 0, pbn_b0_bt_2_115200 }, |
4793 | 4790 | ||
4791 | { PCI_VENDOR_ID_NETMOS, PCI_DEVICE_ID_NETMOS_9835, | ||
4792 | 0x1000, 0x0012, | ||
4793 | 0, 0, pbn_b0_bt_2_115200 }, | ||
4794 | |||
4794 | { PCI_VENDOR_ID_NETMOS, PCI_DEVICE_ID_NETMOS_9901, | 4795 | { PCI_VENDOR_ID_NETMOS, PCI_DEVICE_ID_NETMOS_9901, |
4795 | 0xA000, 0x1000, | 4796 | 0xA000, 0x1000, |
4796 | 0, 0, pbn_b0_1_115200 }, | 4797 | 0, 0, pbn_b0_1_115200 }, |
diff --git a/drivers/tty/serial/8250/8250_pnp.c b/drivers/tty/serial/8250/8250_pnp.c index 35d9ab95c5cb..b3455a970a1d 100644 --- a/drivers/tty/serial/8250/8250_pnp.c +++ b/drivers/tty/serial/8250/8250_pnp.c | |||
@@ -429,6 +429,7 @@ serial_pnp_probe(struct pnp_dev *dev, const struct pnp_device_id *dev_id) | |||
429 | { | 429 | { |
430 | struct uart_8250_port uart; | 430 | struct uart_8250_port uart; |
431 | int ret, line, flags = dev_id->driver_data; | 431 | int ret, line, flags = dev_id->driver_data; |
432 | struct resource *res = NULL; | ||
432 | 433 | ||
433 | if (flags & UNKNOWN_DEV) { | 434 | if (flags & UNKNOWN_DEV) { |
434 | ret = serial_pnp_guess_board(dev); | 435 | ret = serial_pnp_guess_board(dev); |
@@ -439,11 +440,12 @@ serial_pnp_probe(struct pnp_dev *dev, const struct pnp_device_id *dev_id) | |||
439 | memset(&uart, 0, sizeof(uart)); | 440 | memset(&uart, 0, sizeof(uart)); |
440 | if (pnp_irq_valid(dev, 0)) | 441 | if (pnp_irq_valid(dev, 0)) |
441 | uart.port.irq = pnp_irq(dev, 0); | 442 | uart.port.irq = pnp_irq(dev, 0); |
442 | if ((flags & CIR_PORT) && pnp_port_valid(dev, 2)) { | 443 | if ((flags & CIR_PORT) && pnp_port_valid(dev, 2)) |
443 | uart.port.iobase = pnp_port_start(dev, 2); | 444 | res = pnp_get_resource(dev, IORESOURCE_IO, 2); |
444 | uart.port.iotype = UPIO_PORT; | 445 | else if (pnp_port_valid(dev, 0)) |
445 | } else if (pnp_port_valid(dev, 0)) { | 446 | res = pnp_get_resource(dev, IORESOURCE_IO, 0); |
446 | uart.port.iobase = pnp_port_start(dev, 0); | 447 | if (pnp_resource_enabled(res)) { |
448 | uart.port.iobase = res->start; | ||
447 | uart.port.iotype = UPIO_PORT; | 449 | uart.port.iotype = UPIO_PORT; |
448 | } else if (pnp_mem_valid(dev, 0)) { | 450 | } else if (pnp_mem_valid(dev, 0)) { |
449 | uart.port.mapbase = pnp_mem_start(dev, 0); | 451 | uart.port.mapbase = pnp_mem_start(dev, 0); |
diff --git a/drivers/tty/serial/Kconfig b/drivers/tty/serial/Kconfig index cf9210db9fa9..7e7006fd404e 100644 --- a/drivers/tty/serial/Kconfig +++ b/drivers/tty/serial/Kconfig | |||
@@ -211,14 +211,14 @@ config SERIAL_SAMSUNG | |||
211 | config SERIAL_SAMSUNG_UARTS_4 | 211 | config SERIAL_SAMSUNG_UARTS_4 |
212 | bool | 212 | bool |
213 | depends on PLAT_SAMSUNG | 213 | depends on PLAT_SAMSUNG |
214 | default y if !(CPU_S3C2410 || SERIAL_S3C2412 || CPU_S3C2440 || CPU_S3C2442) | 214 | default y if !(CPU_S3C2410 || CPU_S3C2412 || CPU_S3C2440 || CPU_S3C2442) |
215 | help | 215 | help |
216 | Internal node for the common case of 4 Samsung compatible UARTs | 216 | Internal node for the common case of 4 Samsung compatible UARTs |
217 | 217 | ||
218 | config SERIAL_SAMSUNG_UARTS | 218 | config SERIAL_SAMSUNG_UARTS |
219 | int | 219 | int |
220 | depends on PLAT_SAMSUNG | 220 | depends on PLAT_SAMSUNG |
221 | default 6 if ARCH_S5P6450 | 221 | default 6 if CPU_S5P6450 |
222 | default 4 if SERIAL_SAMSUNG_UARTS_4 || CPU_S3C2416 | 222 | default 4 if SERIAL_SAMSUNG_UARTS_4 || CPU_S3C2416 |
223 | default 3 | 223 | default 3 |
224 | help | 224 | help |
diff --git a/drivers/tty/serial/bcm63xx_uart.c b/drivers/tty/serial/bcm63xx_uart.c index 719594e5fc21..52a3ecd40421 100644 --- a/drivers/tty/serial/bcm63xx_uart.c +++ b/drivers/tty/serial/bcm63xx_uart.c | |||
@@ -235,7 +235,7 @@ static const char *bcm_uart_type(struct uart_port *port) | |||
235 | */ | 235 | */ |
236 | static void bcm_uart_do_rx(struct uart_port *port) | 236 | static void bcm_uart_do_rx(struct uart_port *port) |
237 | { | 237 | { |
238 | struct tty_port *port = &port->state->port; | 238 | struct tty_port *tty_port = &port->state->port; |
239 | unsigned int max_count; | 239 | unsigned int max_count; |
240 | 240 | ||
241 | /* limit number of char read in interrupt, should not be | 241 | /* limit number of char read in interrupt, should not be |
@@ -260,7 +260,7 @@ static void bcm_uart_do_rx(struct uart_port *port) | |||
260 | bcm_uart_writel(port, val, UART_CTL_REG); | 260 | bcm_uart_writel(port, val, UART_CTL_REG); |
261 | 261 | ||
262 | port->icount.overrun++; | 262 | port->icount.overrun++; |
263 | tty_insert_flip_char(port, 0, TTY_OVERRUN); | 263 | tty_insert_flip_char(tty_port, 0, TTY_OVERRUN); |
264 | } | 264 | } |
265 | 265 | ||
266 | if (!(iestat & UART_IR_STAT(UART_IR_RXNOTEMPTY))) | 266 | if (!(iestat & UART_IR_STAT(UART_IR_RXNOTEMPTY))) |
@@ -299,11 +299,11 @@ static void bcm_uart_do_rx(struct uart_port *port) | |||
299 | 299 | ||
300 | 300 | ||
301 | if ((cstat & port->ignore_status_mask) == 0) | 301 | if ((cstat & port->ignore_status_mask) == 0) |
302 | tty_insert_flip_char(port, c, flag); | 302 | tty_insert_flip_char(tty_port, c, flag); |
303 | 303 | ||
304 | } while (--max_count); | 304 | } while (--max_count); |
305 | 305 | ||
306 | tty_flip_buffer_push(port); | 306 | tty_flip_buffer_push(tty_port); |
307 | } | 307 | } |
308 | 308 | ||
309 | /* | 309 | /* |
diff --git a/drivers/tty/serial/mpc52xx_uart.c b/drivers/tty/serial/mpc52xx_uart.c index c0e1fad51be7..018bad922554 100644 --- a/drivers/tty/serial/mpc52xx_uart.c +++ b/drivers/tty/serial/mpc52xx_uart.c | |||
@@ -550,7 +550,7 @@ static int mpc512x_psc_clock(struct uart_port *port, int enable) | |||
550 | return 0; | 550 | return 0; |
551 | 551 | ||
552 | psc_num = (port->mapbase & 0xf00) >> 8; | 552 | psc_num = (port->mapbase & 0xf00) >> 8; |
553 | snprintf(clk_name, sizeof(clk_name), "psc%d_clk", psc_num); | 553 | snprintf(clk_name, sizeof(clk_name), "psc%d_mclk", psc_num); |
554 | psc_clk = clk_get(port->dev, clk_name); | 554 | psc_clk = clk_get(port->dev, clk_name); |
555 | if (IS_ERR(psc_clk)) { | 555 | if (IS_ERR(psc_clk)) { |
556 | dev_err(port->dev, "Failed to get PSC clock entry!\n"); | 556 | dev_err(port->dev, "Failed to get PSC clock entry!\n"); |
diff --git a/drivers/tty/serial/of_serial.c b/drivers/tty/serial/of_serial.c index d5874605682b..b025d5438275 100644 --- a/drivers/tty/serial/of_serial.c +++ b/drivers/tty/serial/of_serial.c | |||
@@ -241,6 +241,12 @@ static struct of_device_id of_platform_serial_table[] = { | |||
241 | { .compatible = "ns16850", .data = (void *)PORT_16850, }, | 241 | { .compatible = "ns16850", .data = (void *)PORT_16850, }, |
242 | { .compatible = "nvidia,tegra20-uart", .data = (void *)PORT_TEGRA, }, | 242 | { .compatible = "nvidia,tegra20-uart", .data = (void *)PORT_TEGRA, }, |
243 | { .compatible = "nxp,lpc3220-uart", .data = (void *)PORT_LPC3220, }, | 243 | { .compatible = "nxp,lpc3220-uart", .data = (void *)PORT_LPC3220, }, |
244 | { .compatible = "altr,16550-FIFO32", | ||
245 | .data = (void *)PORT_ALTR_16550_F32, }, | ||
246 | { .compatible = "altr,16550-FIFO64", | ||
247 | .data = (void *)PORT_ALTR_16550_F64, }, | ||
248 | { .compatible = "altr,16550-FIFO128", | ||
249 | .data = (void *)PORT_ALTR_16550_F128, }, | ||
244 | #ifdef CONFIG_SERIAL_OF_PLATFORM_NWPSERIAL | 250 | #ifdef CONFIG_SERIAL_OF_PLATFORM_NWPSERIAL |
245 | { .compatible = "ibm,qpace-nwp-serial", | 251 | { .compatible = "ibm,qpace-nwp-serial", |
246 | .data = (void *)PORT_NWPSERIAL, }, | 252 | .data = (void *)PORT_NWPSERIAL, }, |
diff --git a/drivers/tty/serial/sunsu.c b/drivers/tty/serial/sunsu.c index e343d6670854..451687cb9685 100644 --- a/drivers/tty/serial/sunsu.c +++ b/drivers/tty/serial/sunsu.c | |||
@@ -968,6 +968,7 @@ static struct uart_ops sunsu_pops = { | |||
968 | #define UART_NR 4 | 968 | #define UART_NR 4 |
969 | 969 | ||
970 | static struct uart_sunsu_port sunsu_ports[UART_NR]; | 970 | static struct uart_sunsu_port sunsu_ports[UART_NR]; |
971 | static int nr_inst; /* Number of already registered ports */ | ||
971 | 972 | ||
972 | #ifdef CONFIG_SERIO | 973 | #ifdef CONFIG_SERIO |
973 | 974 | ||
@@ -1337,13 +1338,8 @@ static int __init sunsu_console_setup(struct console *co, char *options) | |||
1337 | printk("Console: ttyS%d (SU)\n", | 1338 | printk("Console: ttyS%d (SU)\n", |
1338 | (sunsu_reg.minor - 64) + co->index); | 1339 | (sunsu_reg.minor - 64) + co->index); |
1339 | 1340 | ||
1340 | /* | 1341 | if (co->index > nr_inst) |
1341 | * Check whether an invalid uart number has been specified, and | 1342 | return -ENODEV; |
1342 | * if so, search for the first available port that does have | ||
1343 | * console support. | ||
1344 | */ | ||
1345 | if (co->index >= UART_NR) | ||
1346 | co->index = 0; | ||
1347 | port = &sunsu_ports[co->index].port; | 1343 | port = &sunsu_ports[co->index].port; |
1348 | 1344 | ||
1349 | /* | 1345 | /* |
@@ -1408,7 +1404,6 @@ static enum su_type su_get_type(struct device_node *dp) | |||
1408 | 1404 | ||
1409 | static int su_probe(struct platform_device *op) | 1405 | static int su_probe(struct platform_device *op) |
1410 | { | 1406 | { |
1411 | static int inst; | ||
1412 | struct device_node *dp = op->dev.of_node; | 1407 | struct device_node *dp = op->dev.of_node; |
1413 | struct uart_sunsu_port *up; | 1408 | struct uart_sunsu_port *up; |
1414 | struct resource *rp; | 1409 | struct resource *rp; |
@@ -1418,16 +1413,16 @@ static int su_probe(struct platform_device *op) | |||
1418 | 1413 | ||
1419 | type = su_get_type(dp); | 1414 | type = su_get_type(dp); |
1420 | if (type == SU_PORT_PORT) { | 1415 | if (type == SU_PORT_PORT) { |
1421 | if (inst >= UART_NR) | 1416 | if (nr_inst >= UART_NR) |
1422 | return -EINVAL; | 1417 | return -EINVAL; |
1423 | up = &sunsu_ports[inst]; | 1418 | up = &sunsu_ports[nr_inst]; |
1424 | } else { | 1419 | } else { |
1425 | up = kzalloc(sizeof(*up), GFP_KERNEL); | 1420 | up = kzalloc(sizeof(*up), GFP_KERNEL); |
1426 | if (!up) | 1421 | if (!up) |
1427 | return -ENOMEM; | 1422 | return -ENOMEM; |
1428 | } | 1423 | } |
1429 | 1424 | ||
1430 | up->port.line = inst; | 1425 | up->port.line = nr_inst; |
1431 | 1426 | ||
1432 | spin_lock_init(&up->port.lock); | 1427 | spin_lock_init(&up->port.lock); |
1433 | 1428 | ||
@@ -1461,6 +1456,8 @@ static int su_probe(struct platform_device *op) | |||
1461 | } | 1456 | } |
1462 | dev_set_drvdata(&op->dev, up); | 1457 | dev_set_drvdata(&op->dev, up); |
1463 | 1458 | ||
1459 | nr_inst++; | ||
1460 | |||
1464 | return 0; | 1461 | return 0; |
1465 | } | 1462 | } |
1466 | 1463 | ||
@@ -1488,7 +1485,7 @@ static int su_probe(struct platform_device *op) | |||
1488 | 1485 | ||
1489 | dev_set_drvdata(&op->dev, up); | 1486 | dev_set_drvdata(&op->dev, up); |
1490 | 1487 | ||
1491 | inst++; | 1488 | nr_inst++; |
1492 | 1489 | ||
1493 | return 0; | 1490 | return 0; |
1494 | 1491 | ||
diff --git a/drivers/tty/serial/vt8500_serial.c b/drivers/tty/serial/vt8500_serial.c index a3f9dd5c9dff..705240e6c4ec 100644 --- a/drivers/tty/serial/vt8500_serial.c +++ b/drivers/tty/serial/vt8500_serial.c | |||
@@ -611,14 +611,7 @@ static int vt8500_serial_probe(struct platform_device *pdev) | |||
611 | vt8500_port->uart.dev = &pdev->dev; | 611 | vt8500_port->uart.dev = &pdev->dev; |
612 | vt8500_port->uart.flags = UPF_IOREMAP | UPF_BOOT_AUTOCONF; | 612 | vt8500_port->uart.flags = UPF_IOREMAP | UPF_BOOT_AUTOCONF; |
613 | 613 | ||
614 | vt8500_port->clk = of_clk_get(pdev->dev.of_node, 0); | 614 | vt8500_port->uart.uartclk = clk_get_rate(vt8500_port->clk); |
615 | if (!IS_ERR(vt8500_port->clk)) { | ||
616 | vt8500_port->uart.uartclk = clk_get_rate(vt8500_port->clk); | ||
617 | } else { | ||
618 | /* use the default of 24Mhz if not specified and warn */ | ||
619 | pr_warn("%s: serial clock source not specified\n", __func__); | ||
620 | vt8500_port->uart.uartclk = 24000000; | ||
621 | } | ||
622 | 615 | ||
623 | snprintf(vt8500_port->name, sizeof(vt8500_port->name), | 616 | snprintf(vt8500_port->name, sizeof(vt8500_port->name), |
624 | "VT8500 UART%d", pdev->id); | 617 | "VT8500 UART%d", pdev->id); |
diff --git a/drivers/tty/tty_buffer.c b/drivers/tty/tty_buffer.c index bb119934e76c..578aa7594b11 100644 --- a/drivers/tty/tty_buffer.c +++ b/drivers/tty/tty_buffer.c | |||
@@ -425,7 +425,7 @@ static void flush_to_ldisc(struct work_struct *work) | |||
425 | struct tty_ldisc *disc; | 425 | struct tty_ldisc *disc; |
426 | 426 | ||
427 | tty = port->itty; | 427 | tty = port->itty; |
428 | if (WARN_RATELIMIT(tty == NULL, "tty is NULL\n")) | 428 | if (tty == NULL) |
429 | return; | 429 | return; |
430 | 430 | ||
431 | disc = tty_ldisc_ref(tty); | 431 | disc = tty_ldisc_ref(tty); |
diff --git a/drivers/usb/Makefile b/drivers/usb/Makefile index f5ed3d75fa5a..8f5ebced5df0 100644 --- a/drivers/usb/Makefile +++ b/drivers/usb/Makefile | |||
@@ -46,7 +46,7 @@ obj-$(CONFIG_USB_MICROTEK) += image/ | |||
46 | obj-$(CONFIG_USB_SERIAL) += serial/ | 46 | obj-$(CONFIG_USB_SERIAL) += serial/ |
47 | 47 | ||
48 | obj-$(CONFIG_USB) += misc/ | 48 | obj-$(CONFIG_USB) += misc/ |
49 | obj-$(CONFIG_USB_COMMON) += phy/ | 49 | obj-$(CONFIG_USB_OTG_UTILS) += phy/ |
50 | obj-$(CONFIG_EARLY_PRINTK_DBGP) += early/ | 50 | obj-$(CONFIG_EARLY_PRINTK_DBGP) += early/ |
51 | 51 | ||
52 | obj-$(CONFIG_USB_ATM) += atm/ | 52 | obj-$(CONFIG_USB_ATM) += atm/ |
diff --git a/drivers/usb/c67x00/c67x00-sched.c b/drivers/usb/c67x00/c67x00-sched.c index a03fbc15fa9c..aa491627a45b 100644 --- a/drivers/usb/c67x00/c67x00-sched.c +++ b/drivers/usb/c67x00/c67x00-sched.c | |||
@@ -100,7 +100,7 @@ struct c67x00_urb_priv { | |||
100 | #define TD_PIDEP_OFFSET 0x04 | 100 | #define TD_PIDEP_OFFSET 0x04 |
101 | #define TD_PIDEPMASK_PID 0xF0 | 101 | #define TD_PIDEPMASK_PID 0xF0 |
102 | #define TD_PIDEPMASK_EP 0x0F | 102 | #define TD_PIDEPMASK_EP 0x0F |
103 | #define TD_PORTLENMASK_DL 0x02FF | 103 | #define TD_PORTLENMASK_DL 0x03FF |
104 | #define TD_PORTLENMASK_PN 0xC000 | 104 | #define TD_PORTLENMASK_PN 0xC000 |
105 | 105 | ||
106 | #define TD_STATUS_OFFSET 0x07 | 106 | #define TD_STATUS_OFFSET 0x07 |
@@ -590,7 +590,7 @@ static int c67x00_create_td(struct c67x00_hcd *c67x00, struct urb *urb, | |||
590 | { | 590 | { |
591 | struct c67x00_td *td; | 591 | struct c67x00_td *td; |
592 | struct c67x00_urb_priv *urbp = urb->hcpriv; | 592 | struct c67x00_urb_priv *urbp = urb->hcpriv; |
593 | const __u8 active_flag = 1, retry_cnt = 1; | 593 | const __u8 active_flag = 1, retry_cnt = 3; |
594 | __u8 cmd = 0; | 594 | __u8 cmd = 0; |
595 | int tt = 0; | 595 | int tt = 0; |
596 | 596 | ||
diff --git a/drivers/usb/chipidea/udc.c b/drivers/usb/chipidea/udc.c index 2f45bba8561d..f64fbea1cf20 100644 --- a/drivers/usb/chipidea/udc.c +++ b/drivers/usb/chipidea/udc.c | |||
@@ -1767,7 +1767,7 @@ static int udc_start(struct ci13xxx *ci) | |||
1767 | goto put_transceiver; | 1767 | goto put_transceiver; |
1768 | } | 1768 | } |
1769 | 1769 | ||
1770 | retval = dbg_create_files(&ci->gadget.dev); | 1770 | retval = dbg_create_files(ci->dev); |
1771 | if (retval) | 1771 | if (retval) |
1772 | goto unreg_device; | 1772 | goto unreg_device; |
1773 | 1773 | ||
@@ -1796,7 +1796,7 @@ remove_trans: | |||
1796 | 1796 | ||
1797 | dev_err(dev, "error = %i\n", retval); | 1797 | dev_err(dev, "error = %i\n", retval); |
1798 | remove_dbg: | 1798 | remove_dbg: |
1799 | dbg_remove_files(&ci->gadget.dev); | 1799 | dbg_remove_files(ci->dev); |
1800 | unreg_device: | 1800 | unreg_device: |
1801 | device_unregister(&ci->gadget.dev); | 1801 | device_unregister(&ci->gadget.dev); |
1802 | put_transceiver: | 1802 | put_transceiver: |
@@ -1836,7 +1836,7 @@ static void udc_stop(struct ci13xxx *ci) | |||
1836 | if (ci->global_phy) | 1836 | if (ci->global_phy) |
1837 | usb_put_phy(ci->transceiver); | 1837 | usb_put_phy(ci->transceiver); |
1838 | } | 1838 | } |
1839 | dbg_remove_files(&ci->gadget.dev); | 1839 | dbg_remove_files(ci->dev); |
1840 | device_unregister(&ci->gadget.dev); | 1840 | device_unregister(&ci->gadget.dev); |
1841 | /* my kobject is dynamic, I swear! */ | 1841 | /* my kobject is dynamic, I swear! */ |
1842 | memset(&ci->gadget, 0, sizeof(ci->gadget)); | 1842 | memset(&ci->gadget, 0, sizeof(ci->gadget)); |
diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c index 8ac25adf31b4..387dc6c8ad25 100644 --- a/drivers/usb/class/cdc-acm.c +++ b/drivers/usb/class/cdc-acm.c | |||
@@ -593,7 +593,6 @@ static void acm_port_destruct(struct tty_port *port) | |||
593 | 593 | ||
594 | dev_dbg(&acm->control->dev, "%s\n", __func__); | 594 | dev_dbg(&acm->control->dev, "%s\n", __func__); |
595 | 595 | ||
596 | tty_unregister_device(acm_tty_driver, acm->minor); | ||
597 | acm_release_minor(acm); | 596 | acm_release_minor(acm); |
598 | usb_put_intf(acm->control); | 597 | usb_put_intf(acm->control); |
599 | kfree(acm->country_codes); | 598 | kfree(acm->country_codes); |
@@ -977,6 +976,8 @@ static int acm_probe(struct usb_interface *intf, | |||
977 | int num_rx_buf; | 976 | int num_rx_buf; |
978 | int i; | 977 | int i; |
979 | int combined_interfaces = 0; | 978 | int combined_interfaces = 0; |
979 | struct device *tty_dev; | ||
980 | int rv = -ENOMEM; | ||
980 | 981 | ||
981 | /* normal quirks */ | 982 | /* normal quirks */ |
982 | quirks = (unsigned long)id->driver_info; | 983 | quirks = (unsigned long)id->driver_info; |
@@ -1339,11 +1340,24 @@ skip_countries: | |||
1339 | usb_set_intfdata(data_interface, acm); | 1340 | usb_set_intfdata(data_interface, acm); |
1340 | 1341 | ||
1341 | usb_get_intf(control_interface); | 1342 | usb_get_intf(control_interface); |
1342 | tty_port_register_device(&acm->port, acm_tty_driver, minor, | 1343 | tty_dev = tty_port_register_device(&acm->port, acm_tty_driver, minor, |
1343 | &control_interface->dev); | 1344 | &control_interface->dev); |
1345 | if (IS_ERR(tty_dev)) { | ||
1346 | rv = PTR_ERR(tty_dev); | ||
1347 | goto alloc_fail8; | ||
1348 | } | ||
1344 | 1349 | ||
1345 | return 0; | 1350 | return 0; |
1351 | alloc_fail8: | ||
1352 | if (acm->country_codes) { | ||
1353 | device_remove_file(&acm->control->dev, | ||
1354 | &dev_attr_wCountryCodes); | ||
1355 | device_remove_file(&acm->control->dev, | ||
1356 | &dev_attr_iCountryCodeRelDate); | ||
1357 | } | ||
1358 | device_remove_file(&acm->control->dev, &dev_attr_bmCapabilities); | ||
1346 | alloc_fail7: | 1359 | alloc_fail7: |
1360 | usb_set_intfdata(intf, NULL); | ||
1347 | for (i = 0; i < ACM_NW; i++) | 1361 | for (i = 0; i < ACM_NW; i++) |
1348 | usb_free_urb(acm->wb[i].urb); | 1362 | usb_free_urb(acm->wb[i].urb); |
1349 | alloc_fail6: | 1363 | alloc_fail6: |
@@ -1359,7 +1373,7 @@ alloc_fail2: | |||
1359 | acm_release_minor(acm); | 1373 | acm_release_minor(acm); |
1360 | kfree(acm); | 1374 | kfree(acm); |
1361 | alloc_fail: | 1375 | alloc_fail: |
1362 | return -ENOMEM; | 1376 | return rv; |
1363 | } | 1377 | } |
1364 | 1378 | ||
1365 | static void stop_data_traffic(struct acm *acm) | 1379 | static void stop_data_traffic(struct acm *acm) |
@@ -1411,6 +1425,8 @@ static void acm_disconnect(struct usb_interface *intf) | |||
1411 | 1425 | ||
1412 | stop_data_traffic(acm); | 1426 | stop_data_traffic(acm); |
1413 | 1427 | ||
1428 | tty_unregister_device(acm_tty_driver, acm->minor); | ||
1429 | |||
1414 | usb_free_urb(acm->ctrlurb); | 1430 | usb_free_urb(acm->ctrlurb); |
1415 | for (i = 0; i < ACM_NW; i++) | 1431 | for (i = 0; i < ACM_NW; i++) |
1416 | usb_free_urb(acm->wb[i].urb); | 1432 | usb_free_urb(acm->wb[i].urb); |
diff --git a/drivers/usb/class/cdc-wdm.c b/drivers/usb/class/cdc-wdm.c index 5f0cb417b736..122d056d96d5 100644 --- a/drivers/usb/class/cdc-wdm.c +++ b/drivers/usb/class/cdc-wdm.c | |||
@@ -56,6 +56,7 @@ MODULE_DEVICE_TABLE (usb, wdm_ids); | |||
56 | #define WDM_RESPONDING 7 | 56 | #define WDM_RESPONDING 7 |
57 | #define WDM_SUSPENDING 8 | 57 | #define WDM_SUSPENDING 8 |
58 | #define WDM_RESETTING 9 | 58 | #define WDM_RESETTING 9 |
59 | #define WDM_OVERFLOW 10 | ||
59 | 60 | ||
60 | #define WDM_MAX 16 | 61 | #define WDM_MAX 16 |
61 | 62 | ||
@@ -155,6 +156,7 @@ static void wdm_in_callback(struct urb *urb) | |||
155 | { | 156 | { |
156 | struct wdm_device *desc = urb->context; | 157 | struct wdm_device *desc = urb->context; |
157 | int status = urb->status; | 158 | int status = urb->status; |
159 | int length = urb->actual_length; | ||
158 | 160 | ||
159 | spin_lock(&desc->iuspin); | 161 | spin_lock(&desc->iuspin); |
160 | clear_bit(WDM_RESPONDING, &desc->flags); | 162 | clear_bit(WDM_RESPONDING, &desc->flags); |
@@ -185,9 +187,17 @@ static void wdm_in_callback(struct urb *urb) | |||
185 | } | 187 | } |
186 | 188 | ||
187 | desc->rerr = status; | 189 | desc->rerr = status; |
188 | desc->reslength = urb->actual_length; | 190 | if (length + desc->length > desc->wMaxCommand) { |
189 | memmove(desc->ubuf + desc->length, desc->inbuf, desc->reslength); | 191 | /* The buffer would overflow */ |
190 | desc->length += desc->reslength; | 192 | set_bit(WDM_OVERFLOW, &desc->flags); |
193 | } else { | ||
194 | /* we may already be in overflow */ | ||
195 | if (!test_bit(WDM_OVERFLOW, &desc->flags)) { | ||
196 | memmove(desc->ubuf + desc->length, desc->inbuf, length); | ||
197 | desc->length += length; | ||
198 | desc->reslength = length; | ||
199 | } | ||
200 | } | ||
191 | skip_error: | 201 | skip_error: |
192 | wake_up(&desc->wait); | 202 | wake_up(&desc->wait); |
193 | 203 | ||
@@ -435,6 +445,11 @@ retry: | |||
435 | rv = -ENODEV; | 445 | rv = -ENODEV; |
436 | goto err; | 446 | goto err; |
437 | } | 447 | } |
448 | if (test_bit(WDM_OVERFLOW, &desc->flags)) { | ||
449 | clear_bit(WDM_OVERFLOW, &desc->flags); | ||
450 | rv = -ENOBUFS; | ||
451 | goto err; | ||
452 | } | ||
438 | i++; | 453 | i++; |
439 | if (file->f_flags & O_NONBLOCK) { | 454 | if (file->f_flags & O_NONBLOCK) { |
440 | if (!test_bit(WDM_READ, &desc->flags)) { | 455 | if (!test_bit(WDM_READ, &desc->flags)) { |
@@ -478,6 +493,7 @@ retry: | |||
478 | spin_unlock_irq(&desc->iuspin); | 493 | spin_unlock_irq(&desc->iuspin); |
479 | goto retry; | 494 | goto retry; |
480 | } | 495 | } |
496 | |||
481 | if (!desc->reslength) { /* zero length read */ | 497 | if (!desc->reslength) { /* zero length read */ |
482 | dev_dbg(&desc->intf->dev, "%s: zero length - clearing WDM_READ\n", __func__); | 498 | dev_dbg(&desc->intf->dev, "%s: zero length - clearing WDM_READ\n", __func__); |
483 | clear_bit(WDM_READ, &desc->flags); | 499 | clear_bit(WDM_READ, &desc->flags); |
@@ -1004,6 +1020,7 @@ static int wdm_post_reset(struct usb_interface *intf) | |||
1004 | struct wdm_device *desc = wdm_find_device(intf); | 1020 | struct wdm_device *desc = wdm_find_device(intf); |
1005 | int rv; | 1021 | int rv; |
1006 | 1022 | ||
1023 | clear_bit(WDM_OVERFLOW, &desc->flags); | ||
1007 | clear_bit(WDM_RESETTING, &desc->flags); | 1024 | clear_bit(WDM_RESETTING, &desc->flags); |
1008 | rv = recover_from_urb_loss(desc); | 1025 | rv = recover_from_urb_loss(desc); |
1009 | mutex_unlock(&desc->wlock); | 1026 | mutex_unlock(&desc->wlock); |
diff --git a/drivers/usb/core/hcd-pci.c b/drivers/usb/core/hcd-pci.c index 622b4a48e732..2b487d4797bd 100644 --- a/drivers/usb/core/hcd-pci.c +++ b/drivers/usb/core/hcd-pci.c | |||
@@ -173,6 +173,7 @@ int usb_hcd_pci_probe(struct pci_dev *dev, const struct pci_device_id *id) | |||
173 | struct hc_driver *driver; | 173 | struct hc_driver *driver; |
174 | struct usb_hcd *hcd; | 174 | struct usb_hcd *hcd; |
175 | int retval; | 175 | int retval; |
176 | int hcd_irq = 0; | ||
176 | 177 | ||
177 | if (usb_disabled()) | 178 | if (usb_disabled()) |
178 | return -ENODEV; | 179 | return -ENODEV; |
@@ -187,15 +188,19 @@ int usb_hcd_pci_probe(struct pci_dev *dev, const struct pci_device_id *id) | |||
187 | return -ENODEV; | 188 | return -ENODEV; |
188 | dev->current_state = PCI_D0; | 189 | dev->current_state = PCI_D0; |
189 | 190 | ||
190 | /* The xHCI driver supports MSI and MSI-X, | 191 | /* |
191 | * so don't fail if the BIOS doesn't provide a legacy IRQ. | 192 | * The xHCI driver has its own irq management |
193 | * make sure irq setup is not touched for xhci in generic hcd code | ||
192 | */ | 194 | */ |
193 | if (!dev->irq && (driver->flags & HCD_MASK) != HCD_USB3) { | 195 | if ((driver->flags & HCD_MASK) != HCD_USB3) { |
194 | dev_err(&dev->dev, | 196 | if (!dev->irq) { |
195 | "Found HC with no IRQ. Check BIOS/PCI %s setup!\n", | 197 | dev_err(&dev->dev, |
196 | pci_name(dev)); | 198 | "Found HC with no IRQ. Check BIOS/PCI %s setup!\n", |
197 | retval = -ENODEV; | 199 | pci_name(dev)); |
198 | goto disable_pci; | 200 | retval = -ENODEV; |
201 | goto disable_pci; | ||
202 | } | ||
203 | hcd_irq = dev->irq; | ||
199 | } | 204 | } |
200 | 205 | ||
201 | hcd = usb_create_hcd(driver, &dev->dev, pci_name(dev)); | 206 | hcd = usb_create_hcd(driver, &dev->dev, pci_name(dev)); |
@@ -245,7 +250,7 @@ int usb_hcd_pci_probe(struct pci_dev *dev, const struct pci_device_id *id) | |||
245 | 250 | ||
246 | pci_set_master(dev); | 251 | pci_set_master(dev); |
247 | 252 | ||
248 | retval = usb_add_hcd(hcd, dev->irq, IRQF_SHARED); | 253 | retval = usb_add_hcd(hcd, hcd_irq, IRQF_SHARED); |
249 | if (retval != 0) | 254 | if (retval != 0) |
250 | goto unmap_registers; | 255 | goto unmap_registers; |
251 | set_hs_companion(dev, hcd); | 256 | set_hs_companion(dev, hcd); |
diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c index 999909451e37..ffa6b004a84b 100644 --- a/drivers/usb/dwc3/core.c +++ b/drivers/usb/dwc3/core.c | |||
@@ -583,6 +583,7 @@ static int dwc3_remove(struct platform_device *pdev) | |||
583 | break; | 583 | break; |
584 | } | 584 | } |
585 | 585 | ||
586 | dwc3_free_event_buffers(dwc); | ||
586 | dwc3_core_exit(dwc); | 587 | dwc3_core_exit(dwc); |
587 | 588 | ||
588 | return 0; | 589 | return 0; |
diff --git a/drivers/usb/dwc3/dwc3-exynos.c b/drivers/usb/dwc3/dwc3-exynos.c index b50da53e9a52..b082bec7343e 100644 --- a/drivers/usb/dwc3/dwc3-exynos.c +++ b/drivers/usb/dwc3/dwc3-exynos.c | |||
@@ -23,8 +23,6 @@ | |||
23 | #include <linux/usb/nop-usb-xceiv.h> | 23 | #include <linux/usb/nop-usb-xceiv.h> |
24 | #include <linux/of.h> | 24 | #include <linux/of.h> |
25 | 25 | ||
26 | #include "core.h" | ||
27 | |||
28 | struct dwc3_exynos { | 26 | struct dwc3_exynos { |
29 | struct platform_device *dwc3; | 27 | struct platform_device *dwc3; |
30 | struct platform_device *usb2_phy; | 28 | struct platform_device *usb2_phy; |
diff --git a/drivers/usb/dwc3/dwc3-omap.c b/drivers/usb/dwc3/dwc3-omap.c index 22f337f57219..afa05e3c9cf4 100644 --- a/drivers/usb/dwc3/dwc3-omap.c +++ b/drivers/usb/dwc3/dwc3-omap.c | |||
@@ -54,8 +54,6 @@ | |||
54 | #include <linux/usb/otg.h> | 54 | #include <linux/usb/otg.h> |
55 | #include <linux/usb/nop-usb-xceiv.h> | 55 | #include <linux/usb/nop-usb-xceiv.h> |
56 | 56 | ||
57 | #include "core.h" | ||
58 | |||
59 | /* | 57 | /* |
60 | * All these registers belong to OMAP's Wrapper around the | 58 | * All these registers belong to OMAP's Wrapper around the |
61 | * DesignWare USB3 Core. | 59 | * DesignWare USB3 Core. |
@@ -465,20 +463,20 @@ static int dwc3_omap_remove(struct platform_device *pdev) | |||
465 | return 0; | 463 | return 0; |
466 | } | 464 | } |
467 | 465 | ||
468 | static const struct of_device_id of_dwc3_matach[] = { | 466 | static const struct of_device_id of_dwc3_match[] = { |
469 | { | 467 | { |
470 | "ti,dwc3", | 468 | "ti,dwc3", |
471 | }, | 469 | }, |
472 | { }, | 470 | { }, |
473 | }; | 471 | }; |
474 | MODULE_DEVICE_TABLE(of, of_dwc3_matach); | 472 | MODULE_DEVICE_TABLE(of, of_dwc3_match); |
475 | 473 | ||
476 | static struct platform_driver dwc3_omap_driver = { | 474 | static struct platform_driver dwc3_omap_driver = { |
477 | .probe = dwc3_omap_probe, | 475 | .probe = dwc3_omap_probe, |
478 | .remove = dwc3_omap_remove, | 476 | .remove = dwc3_omap_remove, |
479 | .driver = { | 477 | .driver = { |
480 | .name = "omap-dwc3", | 478 | .name = "omap-dwc3", |
481 | .of_match_table = of_dwc3_matach, | 479 | .of_match_table = of_dwc3_match, |
482 | }, | 480 | }, |
483 | }; | 481 | }; |
484 | 482 | ||
diff --git a/drivers/usb/dwc3/dwc3-pci.c b/drivers/usb/dwc3/dwc3-pci.c index 7d70f44567d2..e8d77689a322 100644 --- a/drivers/usb/dwc3/dwc3-pci.c +++ b/drivers/usb/dwc3/dwc3-pci.c | |||
@@ -45,8 +45,6 @@ | |||
45 | #include <linux/usb/otg.h> | 45 | #include <linux/usb/otg.h> |
46 | #include <linux/usb/nop-usb-xceiv.h> | 46 | #include <linux/usb/nop-usb-xceiv.h> |
47 | 47 | ||
48 | #include "core.h" | ||
49 | |||
50 | /* FIXME define these in <linux/pci_ids.h> */ | 48 | /* FIXME define these in <linux/pci_ids.h> */ |
51 | #define PCI_VENDOR_ID_SYNOPSYS 0x16c3 | 49 | #define PCI_VENDOR_ID_SYNOPSYS 0x16c3 |
52 | #define PCI_DEVICE_ID_SYNOPSYS_HAPSUSB3 0xabcd | 50 | #define PCI_DEVICE_ID_SYNOPSYS_HAPSUSB3 0xabcd |
diff --git a/drivers/usb/dwc3/ep0.c b/drivers/usb/dwc3/ep0.c index d7da073a23fe..1d139ca05ef1 100644 --- a/drivers/usb/dwc3/ep0.c +++ b/drivers/usb/dwc3/ep0.c | |||
@@ -891,7 +891,8 @@ static void __dwc3_ep0_do_control_data(struct dwc3 *dwc, | |||
891 | DWC3_TRBCTL_CONTROL_DATA); | 891 | DWC3_TRBCTL_CONTROL_DATA); |
892 | } else if (!IS_ALIGNED(req->request.length, dep->endpoint.maxpacket) | 892 | } else if (!IS_ALIGNED(req->request.length, dep->endpoint.maxpacket) |
893 | && (dep->number == 0)) { | 893 | && (dep->number == 0)) { |
894 | u32 transfer_size; | 894 | u32 transfer_size; |
895 | u32 maxpacket; | ||
895 | 896 | ||
896 | ret = usb_gadget_map_request(&dwc->gadget, &req->request, | 897 | ret = usb_gadget_map_request(&dwc->gadget, &req->request, |
897 | dep->number); | 898 | dep->number); |
@@ -902,8 +903,8 @@ static void __dwc3_ep0_do_control_data(struct dwc3 *dwc, | |||
902 | 903 | ||
903 | WARN_ON(req->request.length > DWC3_EP0_BOUNCE_SIZE); | 904 | WARN_ON(req->request.length > DWC3_EP0_BOUNCE_SIZE); |
904 | 905 | ||
905 | transfer_size = roundup(req->request.length, | 906 | maxpacket = dep->endpoint.maxpacket; |
906 | (u32) dep->endpoint.maxpacket); | 907 | transfer_size = roundup(req->request.length, maxpacket); |
907 | 908 | ||
908 | dwc->ep0_bounced = true; | 909 | dwc->ep0_bounced = true; |
909 | 910 | ||
diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c index a04342f6cbfa..82e160e96fca 100644 --- a/drivers/usb/dwc3/gadget.c +++ b/drivers/usb/dwc3/gadget.c | |||
@@ -2159,7 +2159,6 @@ static void dwc3_gadget_phy_suspend(struct dwc3 *dwc, u8 speed) | |||
2159 | 2159 | ||
2160 | static void dwc3_gadget_conndone_interrupt(struct dwc3 *dwc) | 2160 | static void dwc3_gadget_conndone_interrupt(struct dwc3 *dwc) |
2161 | { | 2161 | { |
2162 | struct dwc3_gadget_ep_cmd_params params; | ||
2163 | struct dwc3_ep *dep; | 2162 | struct dwc3_ep *dep; |
2164 | int ret; | 2163 | int ret; |
2165 | u32 reg; | 2164 | u32 reg; |
@@ -2167,8 +2166,6 @@ static void dwc3_gadget_conndone_interrupt(struct dwc3 *dwc) | |||
2167 | 2166 | ||
2168 | dev_vdbg(dwc->dev, "%s\n", __func__); | 2167 | dev_vdbg(dwc->dev, "%s\n", __func__); |
2169 | 2168 | ||
2170 | memset(¶ms, 0x00, sizeof(params)); | ||
2171 | |||
2172 | reg = dwc3_readl(dwc->regs, DWC3_DSTS); | 2169 | reg = dwc3_readl(dwc->regs, DWC3_DSTS); |
2173 | speed = reg & DWC3_DSTS_CONNECTSPD; | 2170 | speed = reg & DWC3_DSTS_CONNECTSPD; |
2174 | dwc->speed = speed; | 2171 | dwc->speed = speed; |
diff --git a/drivers/usb/gadget/Makefile b/drivers/usb/gadget/Makefile index 97a13c349cc5..82fb22511356 100644 --- a/drivers/usb/gadget/Makefile +++ b/drivers/usb/gadget/Makefile | |||
@@ -35,6 +35,12 @@ mv_udc-y := mv_udc_core.o | |||
35 | obj-$(CONFIG_USB_FUSB300) += fusb300_udc.o | 35 | obj-$(CONFIG_USB_FUSB300) += fusb300_udc.o |
36 | obj-$(CONFIG_USB_MV_U3D) += mv_u3d_core.o | 36 | obj-$(CONFIG_USB_MV_U3D) += mv_u3d_core.o |
37 | 37 | ||
38 | # USB Functions | ||
39 | obj-$(CONFIG_USB_F_ACM) += f_acm.o | ||
40 | f_ss_lb-y := f_loopback.o f_sourcesink.o | ||
41 | obj-$(CONFIG_USB_F_SS_LB) += f_ss_lb.o | ||
42 | obj-$(CONFIG_USB_U_SERIAL) += u_serial.o | ||
43 | |||
38 | # | 44 | # |
39 | # USB gadget drivers | 45 | # USB gadget drivers |
40 | # | 46 | # |
@@ -74,9 +80,3 @@ obj-$(CONFIG_USB_G_WEBCAM) += g_webcam.o | |||
74 | obj-$(CONFIG_USB_G_NCM) += g_ncm.o | 80 | obj-$(CONFIG_USB_G_NCM) += g_ncm.o |
75 | obj-$(CONFIG_USB_G_ACM_MS) += g_acm_ms.o | 81 | obj-$(CONFIG_USB_G_ACM_MS) += g_acm_ms.o |
76 | obj-$(CONFIG_USB_GADGET_TARGET) += tcm_usb_gadget.o | 82 | obj-$(CONFIG_USB_GADGET_TARGET) += tcm_usb_gadget.o |
77 | |||
78 | # USB Functions | ||
79 | obj-$(CONFIG_USB_F_ACM) += f_acm.o | ||
80 | f_ss_lb-y := f_loopback.o f_sourcesink.o | ||
81 | obj-$(CONFIG_USB_F_SS_LB) += f_ss_lb.o | ||
82 | obj-$(CONFIG_USB_U_SERIAL) += u_serial.o | ||
diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c index 7c821de8ce3d..c0d62b278610 100644 --- a/drivers/usb/gadget/composite.c +++ b/drivers/usb/gadget/composite.c | |||
@@ -1757,10 +1757,7 @@ static const struct usb_gadget_driver composite_driver_template = { | |||
1757 | /** | 1757 | /** |
1758 | * usb_composite_probe() - register a composite driver | 1758 | * usb_composite_probe() - register a composite driver |
1759 | * @driver: the driver to register | 1759 | * @driver: the driver to register |
1760 | * @bind: the callback used to allocate resources that are shared across the | 1760 | * |
1761 | * whole device, such as string IDs, and add its configurations using | ||
1762 | * @usb_add_config(). This may fail by returning a negative errno | ||
1763 | * value; it should return zero on successful initialization. | ||
1764 | * Context: single threaded during gadget setup | 1761 | * Context: single threaded during gadget setup |
1765 | * | 1762 | * |
1766 | * This function is used to register drivers using the composite driver | 1763 | * This function is used to register drivers using the composite driver |
diff --git a/drivers/usb/gadget/f_rndis.c b/drivers/usb/gadget/f_rndis.c index 71beeb833558..cc9c49c57c80 100644 --- a/drivers/usb/gadget/f_rndis.c +++ b/drivers/usb/gadget/f_rndis.c | |||
@@ -447,14 +447,13 @@ static void rndis_response_complete(struct usb_ep *ep, struct usb_request *req) | |||
447 | static void rndis_command_complete(struct usb_ep *ep, struct usb_request *req) | 447 | static void rndis_command_complete(struct usb_ep *ep, struct usb_request *req) |
448 | { | 448 | { |
449 | struct f_rndis *rndis = req->context; | 449 | struct f_rndis *rndis = req->context; |
450 | struct usb_composite_dev *cdev = rndis->port.func.config->cdev; | ||
451 | int status; | 450 | int status; |
452 | 451 | ||
453 | /* received RNDIS command from USB_CDC_SEND_ENCAPSULATED_COMMAND */ | 452 | /* received RNDIS command from USB_CDC_SEND_ENCAPSULATED_COMMAND */ |
454 | // spin_lock(&dev->lock); | 453 | // spin_lock(&dev->lock); |
455 | status = rndis_msg_parser(rndis->config, (u8 *) req->buf); | 454 | status = rndis_msg_parser(rndis->config, (u8 *) req->buf); |
456 | if (status < 0) | 455 | if (status < 0) |
457 | ERROR(cdev, "RNDIS command error %d, %d/%d\n", | 456 | pr_err("RNDIS command error %d, %d/%d\n", |
458 | status, req->actual, req->length); | 457 | status, req->actual, req->length); |
459 | // spin_unlock(&dev->lock); | 458 | // spin_unlock(&dev->lock); |
460 | } | 459 | } |
diff --git a/drivers/usb/gadget/f_uac1.c b/drivers/usb/gadget/f_uac1.c index f570e667a640..fa8ea4ea00c1 100644 --- a/drivers/usb/gadget/f_uac1.c +++ b/drivers/usb/gadget/f_uac1.c | |||
@@ -418,6 +418,7 @@ static int audio_get_intf_req(struct usb_function *f, | |||
418 | 418 | ||
419 | req->context = audio; | 419 | req->context = audio; |
420 | req->complete = f_audio_complete; | 420 | req->complete = f_audio_complete; |
421 | len = min_t(size_t, sizeof(value), len); | ||
421 | memcpy(req->buf, &value, len); | 422 | memcpy(req->buf, &value, len); |
422 | 423 | ||
423 | return len; | 424 | return len; |
diff --git a/drivers/usb/gadget/g_ffs.c b/drivers/usb/gadget/g_ffs.c index 3953dd4d7186..3b343b23e4b0 100644 --- a/drivers/usb/gadget/g_ffs.c +++ b/drivers/usb/gadget/g_ffs.c | |||
@@ -357,7 +357,7 @@ static int gfs_bind(struct usb_composite_dev *cdev) | |||
357 | goto error; | 357 | goto error; |
358 | gfs_dev_desc.iProduct = gfs_strings[USB_GADGET_PRODUCT_IDX].id; | 358 | gfs_dev_desc.iProduct = gfs_strings[USB_GADGET_PRODUCT_IDX].id; |
359 | 359 | ||
360 | for (i = func_num; --i; ) { | 360 | for (i = func_num; i--; ) { |
361 | ret = functionfs_bind(ffs_tab[i].ffs_data, cdev); | 361 | ret = functionfs_bind(ffs_tab[i].ffs_data, cdev); |
362 | if (unlikely(ret < 0)) { | 362 | if (unlikely(ret < 0)) { |
363 | while (++i < func_num) | 363 | while (++i < func_num) |
@@ -413,7 +413,7 @@ static int gfs_unbind(struct usb_composite_dev *cdev) | |||
413 | gether_cleanup(); | 413 | gether_cleanup(); |
414 | gfs_ether_setup = false; | 414 | gfs_ether_setup = false; |
415 | 415 | ||
416 | for (i = func_num; --i; ) | 416 | for (i = func_num; i--; ) |
417 | if (ffs_tab[i].ffs_data) | 417 | if (ffs_tab[i].ffs_data) |
418 | functionfs_unbind(ffs_tab[i].ffs_data); | 418 | functionfs_unbind(ffs_tab[i].ffs_data); |
419 | 419 | ||
diff --git a/drivers/usb/gadget/imx_udc.c b/drivers/usb/gadget/imx_udc.c index 8efd7555fa21..5bd930d779b9 100644 --- a/drivers/usb/gadget/imx_udc.c +++ b/drivers/usb/gadget/imx_udc.c | |||
@@ -1334,27 +1334,18 @@ static int imx_udc_start(struct usb_gadget *gadget, | |||
1334 | struct usb_gadget_driver *driver) | 1334 | struct usb_gadget_driver *driver) |
1335 | { | 1335 | { |
1336 | struct imx_udc_struct *imx_usb; | 1336 | struct imx_udc_struct *imx_usb; |
1337 | int retval; | ||
1338 | 1337 | ||
1339 | imx_usb = container_of(gadget, struct imx_udc_struct, gadget); | 1338 | imx_usb = container_of(gadget, struct imx_udc_struct, gadget); |
1340 | /* first hook up the driver ... */ | 1339 | /* first hook up the driver ... */ |
1341 | imx_usb->driver = driver; | 1340 | imx_usb->driver = driver; |
1342 | imx_usb->gadget.dev.driver = &driver->driver; | 1341 | imx_usb->gadget.dev.driver = &driver->driver; |
1343 | 1342 | ||
1344 | retval = device_add(&imx_usb->gadget.dev); | ||
1345 | if (retval) | ||
1346 | goto fail; | ||
1347 | |||
1348 | D_INI(imx_usb->dev, "<%s> registered gadget driver '%s'\n", | 1343 | D_INI(imx_usb->dev, "<%s> registered gadget driver '%s'\n", |
1349 | __func__, driver->driver.name); | 1344 | __func__, driver->driver.name); |
1350 | 1345 | ||
1351 | imx_udc_enable(imx_usb); | 1346 | imx_udc_enable(imx_usb); |
1352 | 1347 | ||
1353 | return 0; | 1348 | return 0; |
1354 | fail: | ||
1355 | imx_usb->driver = NULL; | ||
1356 | imx_usb->gadget.dev.driver = NULL; | ||
1357 | return retval; | ||
1358 | } | 1349 | } |
1359 | 1350 | ||
1360 | static int imx_udc_stop(struct usb_gadget *gadget, | 1351 | static int imx_udc_stop(struct usb_gadget *gadget, |
@@ -1370,8 +1361,6 @@ static int imx_udc_stop(struct usb_gadget *gadget, | |||
1370 | imx_usb->gadget.dev.driver = NULL; | 1361 | imx_usb->gadget.dev.driver = NULL; |
1371 | imx_usb->driver = NULL; | 1362 | imx_usb->driver = NULL; |
1372 | 1363 | ||
1373 | device_del(&imx_usb->gadget.dev); | ||
1374 | |||
1375 | D_INI(imx_usb->dev, "<%s> unregistered gadget driver '%s'\n", | 1364 | D_INI(imx_usb->dev, "<%s> unregistered gadget driver '%s'\n", |
1376 | __func__, driver->driver.name); | 1365 | __func__, driver->driver.name); |
1377 | 1366 | ||
@@ -1477,6 +1466,10 @@ static int __init imx_udc_probe(struct platform_device *pdev) | |||
1477 | imx_usb->gadget.dev.parent = &pdev->dev; | 1466 | imx_usb->gadget.dev.parent = &pdev->dev; |
1478 | imx_usb->gadget.dev.dma_mask = pdev->dev.dma_mask; | 1467 | imx_usb->gadget.dev.dma_mask = pdev->dev.dma_mask; |
1479 | 1468 | ||
1469 | ret = device_add(&imx_usb->gadget.dev); | ||
1470 | if (retval) | ||
1471 | goto fail4; | ||
1472 | |||
1480 | platform_set_drvdata(pdev, imx_usb); | 1473 | platform_set_drvdata(pdev, imx_usb); |
1481 | 1474 | ||
1482 | usb_init_data(imx_usb); | 1475 | usb_init_data(imx_usb); |
@@ -1488,9 +1481,11 @@ static int __init imx_udc_probe(struct platform_device *pdev) | |||
1488 | 1481 | ||
1489 | ret = usb_add_gadget_udc(&pdev->dev, &imx_usb->gadget); | 1482 | ret = usb_add_gadget_udc(&pdev->dev, &imx_usb->gadget); |
1490 | if (ret) | 1483 | if (ret) |
1491 | goto fail4; | 1484 | goto fail5; |
1492 | 1485 | ||
1493 | return 0; | 1486 | return 0; |
1487 | fail5: | ||
1488 | device_unregister(&imx_usb->gadget.dev); | ||
1494 | fail4: | 1489 | fail4: |
1495 | for (i = 0; i < IMX_USB_NB_EP + 1; i++) | 1490 | for (i = 0; i < IMX_USB_NB_EP + 1; i++) |
1496 | free_irq(imx_usb->usbd_int[i], imx_usb); | 1491 | free_irq(imx_usb->usbd_int[i], imx_usb); |
@@ -1514,6 +1509,7 @@ static int __exit imx_udc_remove(struct platform_device *pdev) | |||
1514 | int i; | 1509 | int i; |
1515 | 1510 | ||
1516 | usb_del_gadget_udc(&imx_usb->gadget); | 1511 | usb_del_gadget_udc(&imx_usb->gadget); |
1512 | device_unregister(&imx_usb->gadget.dev); | ||
1517 | imx_udc_disable(imx_usb); | 1513 | imx_udc_disable(imx_usb); |
1518 | del_timer(&imx_usb->timer); | 1514 | del_timer(&imx_usb->timer); |
1519 | 1515 | ||
diff --git a/drivers/usb/gadget/net2272.c b/drivers/usb/gadget/net2272.c index d226058e3b88..32524b631959 100644 --- a/drivers/usb/gadget/net2272.c +++ b/drivers/usb/gadget/net2272.c | |||
@@ -59,7 +59,7 @@ static const char * const ep_name[] = { | |||
59 | }; | 59 | }; |
60 | 60 | ||
61 | #define DMA_ADDR_INVALID (~(dma_addr_t)0) | 61 | #define DMA_ADDR_INVALID (~(dma_addr_t)0) |
62 | #ifdef CONFIG_USB_GADGET_NET2272_DMA | 62 | #ifdef CONFIG_USB_NET2272_DMA |
63 | /* | 63 | /* |
64 | * use_dma: the NET2272 can use an external DMA controller. | 64 | * use_dma: the NET2272 can use an external DMA controller. |
65 | * Note that since there is no generic DMA api, some functions, | 65 | * Note that since there is no generic DMA api, some functions, |
@@ -1495,6 +1495,13 @@ stop_activity(struct net2272 *dev, struct usb_gadget_driver *driver) | |||
1495 | for (i = 0; i < 4; ++i) | 1495 | for (i = 0; i < 4; ++i) |
1496 | net2272_dequeue_all(&dev->ep[i]); | 1496 | net2272_dequeue_all(&dev->ep[i]); |
1497 | 1497 | ||
1498 | /* report disconnect; the driver is already quiesced */ | ||
1499 | if (driver) { | ||
1500 | spin_unlock(&dev->lock); | ||
1501 | driver->disconnect(&dev->gadget); | ||
1502 | spin_lock(&dev->lock); | ||
1503 | } | ||
1504 | |||
1498 | net2272_usb_reinit(dev); | 1505 | net2272_usb_reinit(dev); |
1499 | } | 1506 | } |
1500 | 1507 | ||
diff --git a/drivers/usb/gadget/net2280.c b/drivers/usb/gadget/net2280.c index a1b650e11339..3bd0f992fb49 100644 --- a/drivers/usb/gadget/net2280.c +++ b/drivers/usb/gadget/net2280.c | |||
@@ -1924,7 +1924,6 @@ static int net2280_start(struct usb_gadget *_gadget, | |||
1924 | err_func: | 1924 | err_func: |
1925 | device_remove_file (&dev->pdev->dev, &dev_attr_function); | 1925 | device_remove_file (&dev->pdev->dev, &dev_attr_function); |
1926 | err_unbind: | 1926 | err_unbind: |
1927 | driver->unbind (&dev->gadget); | ||
1928 | dev->gadget.dev.driver = NULL; | 1927 | dev->gadget.dev.driver = NULL; |
1929 | dev->driver = NULL; | 1928 | dev->driver = NULL; |
1930 | return retval; | 1929 | return retval; |
@@ -1946,6 +1945,13 @@ stop_activity (struct net2280 *dev, struct usb_gadget_driver *driver) | |||
1946 | for (i = 0; i < 7; i++) | 1945 | for (i = 0; i < 7; i++) |
1947 | nuke (&dev->ep [i]); | 1946 | nuke (&dev->ep [i]); |
1948 | 1947 | ||
1948 | /* report disconnect; the driver is already quiesced */ | ||
1949 | if (driver) { | ||
1950 | spin_unlock(&dev->lock); | ||
1951 | driver->disconnect(&dev->gadget); | ||
1952 | spin_lock(&dev->lock); | ||
1953 | } | ||
1954 | |||
1949 | usb_reinit (dev); | 1955 | usb_reinit (dev); |
1950 | } | 1956 | } |
1951 | 1957 | ||
diff --git a/drivers/usb/gadget/omap_udc.c b/drivers/usb/gadget/omap_udc.c index 06be85c2b233..f8445653577f 100644 --- a/drivers/usb/gadget/omap_udc.c +++ b/drivers/usb/gadget/omap_udc.c | |||
@@ -62,6 +62,7 @@ | |||
62 | #define DRIVER_VERSION "4 October 2004" | 62 | #define DRIVER_VERSION "4 October 2004" |
63 | 63 | ||
64 | #define OMAP_DMA_USB_W2FC_TX0 29 | 64 | #define OMAP_DMA_USB_W2FC_TX0 29 |
65 | #define OMAP_DMA_USB_W2FC_RX0 26 | ||
65 | 66 | ||
66 | /* | 67 | /* |
67 | * The OMAP UDC needs _very_ early endpoint setup: before enabling the | 68 | * The OMAP UDC needs _very_ early endpoint setup: before enabling the |
@@ -1310,7 +1311,7 @@ static int omap_pullup(struct usb_gadget *gadget, int is_on) | |||
1310 | } | 1311 | } |
1311 | 1312 | ||
1312 | static int omap_udc_start(struct usb_gadget *g, | 1313 | static int omap_udc_start(struct usb_gadget *g, |
1313 | struct usb_gadget_driver *driver) | 1314 | struct usb_gadget_driver *driver); |
1314 | static int omap_udc_stop(struct usb_gadget *g, | 1315 | static int omap_udc_stop(struct usb_gadget *g, |
1315 | struct usb_gadget_driver *driver); | 1316 | struct usb_gadget_driver *driver); |
1316 | 1317 | ||
diff --git a/drivers/usb/gadget/pxa25x_udc.c b/drivers/usb/gadget/pxa25x_udc.c index 2bbcdce942dc..d0f37484b6b0 100644 --- a/drivers/usb/gadget/pxa25x_udc.c +++ b/drivers/usb/gadget/pxa25x_udc.c | |||
@@ -1266,13 +1266,6 @@ static int pxa25x_udc_start(struct usb_gadget *g, | |||
1266 | dev->gadget.dev.driver = &driver->driver; | 1266 | dev->gadget.dev.driver = &driver->driver; |
1267 | dev->pullup = 1; | 1267 | dev->pullup = 1; |
1268 | 1268 | ||
1269 | retval = device_add (&dev->gadget.dev); | ||
1270 | if (retval) { | ||
1271 | dev->driver = NULL; | ||
1272 | dev->gadget.dev.driver = NULL; | ||
1273 | return retval; | ||
1274 | } | ||
1275 | |||
1276 | /* ... then enable host detection and ep0; and we're ready | 1269 | /* ... then enable host detection and ep0; and we're ready |
1277 | * for set_configuration as well as eventual disconnect. | 1270 | * for set_configuration as well as eventual disconnect. |
1278 | */ | 1271 | */ |
@@ -1310,6 +1303,10 @@ stop_activity(struct pxa25x_udc *dev, struct usb_gadget_driver *driver) | |||
1310 | } | 1303 | } |
1311 | del_timer_sync(&dev->timer); | 1304 | del_timer_sync(&dev->timer); |
1312 | 1305 | ||
1306 | /* report disconnect; the driver is already quiesced */ | ||
1307 | if (driver) | ||
1308 | driver->disconnect(&dev->gadget); | ||
1309 | |||
1313 | /* re-init driver-visible data structures */ | 1310 | /* re-init driver-visible data structures */ |
1314 | udc_reinit(dev); | 1311 | udc_reinit(dev); |
1315 | } | 1312 | } |
@@ -1331,7 +1328,6 @@ static int pxa25x_udc_stop(struct usb_gadget*g, | |||
1331 | dev->gadget.dev.driver = NULL; | 1328 | dev->gadget.dev.driver = NULL; |
1332 | dev->driver = NULL; | 1329 | dev->driver = NULL; |
1333 | 1330 | ||
1334 | device_del (&dev->gadget.dev); | ||
1335 | dump_state(dev); | 1331 | dump_state(dev); |
1336 | 1332 | ||
1337 | return 0; | 1333 | return 0; |
@@ -2146,6 +2142,13 @@ static int __init pxa25x_udc_probe(struct platform_device *pdev) | |||
2146 | dev->gadget.dev.parent = &pdev->dev; | 2142 | dev->gadget.dev.parent = &pdev->dev; |
2147 | dev->gadget.dev.dma_mask = pdev->dev.dma_mask; | 2143 | dev->gadget.dev.dma_mask = pdev->dev.dma_mask; |
2148 | 2144 | ||
2145 | retval = device_add(&dev->gadget.dev); | ||
2146 | if (retval) { | ||
2147 | dev->driver = NULL; | ||
2148 | dev->gadget.dev.driver = NULL; | ||
2149 | goto err_device_add; | ||
2150 | } | ||
2151 | |||
2149 | the_controller = dev; | 2152 | the_controller = dev; |
2150 | platform_set_drvdata(pdev, dev); | 2153 | platform_set_drvdata(pdev, dev); |
2151 | 2154 | ||
@@ -2196,6 +2199,8 @@ lubbock_fail0: | |||
2196 | free_irq(irq, dev); | 2199 | free_irq(irq, dev); |
2197 | #endif | 2200 | #endif |
2198 | err_irq1: | 2201 | err_irq1: |
2202 | device_unregister(&dev->gadget.dev); | ||
2203 | err_device_add: | ||
2199 | if (gpio_is_valid(dev->mach->gpio_pullup)) | 2204 | if (gpio_is_valid(dev->mach->gpio_pullup)) |
2200 | gpio_free(dev->mach->gpio_pullup); | 2205 | gpio_free(dev->mach->gpio_pullup); |
2201 | err_gpio_pullup: | 2206 | err_gpio_pullup: |
@@ -2217,10 +2222,11 @@ static int __exit pxa25x_udc_remove(struct platform_device *pdev) | |||
2217 | { | 2222 | { |
2218 | struct pxa25x_udc *dev = platform_get_drvdata(pdev); | 2223 | struct pxa25x_udc *dev = platform_get_drvdata(pdev); |
2219 | 2224 | ||
2220 | usb_del_gadget_udc(&dev->gadget); | ||
2221 | if (dev->driver) | 2225 | if (dev->driver) |
2222 | return -EBUSY; | 2226 | return -EBUSY; |
2223 | 2227 | ||
2228 | usb_del_gadget_udc(&dev->gadget); | ||
2229 | device_unregister(&dev->gadget.dev); | ||
2224 | dev->pullup = 0; | 2230 | dev->pullup = 0; |
2225 | pullup(dev); | 2231 | pullup(dev); |
2226 | 2232 | ||
diff --git a/drivers/usb/gadget/pxa27x_udc.c b/drivers/usb/gadget/pxa27x_udc.c index f7d25795821a..2fc867652ef5 100644 --- a/drivers/usb/gadget/pxa27x_udc.c +++ b/drivers/usb/gadget/pxa27x_udc.c | |||
@@ -1814,11 +1814,6 @@ static int pxa27x_udc_start(struct usb_gadget *g, | |||
1814 | udc->gadget.dev.driver = &driver->driver; | 1814 | udc->gadget.dev.driver = &driver->driver; |
1815 | dplus_pullup(udc, 1); | 1815 | dplus_pullup(udc, 1); |
1816 | 1816 | ||
1817 | retval = device_add(&udc->gadget.dev); | ||
1818 | if (retval) { | ||
1819 | dev_err(udc->dev, "device_add error %d\n", retval); | ||
1820 | goto fail; | ||
1821 | } | ||
1822 | if (!IS_ERR_OR_NULL(udc->transceiver)) { | 1817 | if (!IS_ERR_OR_NULL(udc->transceiver)) { |
1823 | retval = otg_set_peripheral(udc->transceiver->otg, | 1818 | retval = otg_set_peripheral(udc->transceiver->otg, |
1824 | &udc->gadget); | 1819 | &udc->gadget); |
@@ -1876,7 +1871,6 @@ static int pxa27x_udc_stop(struct usb_gadget *g, | |||
1876 | 1871 | ||
1877 | udc->driver = NULL; | 1872 | udc->driver = NULL; |
1878 | 1873 | ||
1879 | device_del(&udc->gadget.dev); | ||
1880 | 1874 | ||
1881 | if (!IS_ERR_OR_NULL(udc->transceiver)) | 1875 | if (!IS_ERR_OR_NULL(udc->transceiver)) |
1882 | return otg_set_peripheral(udc->transceiver->otg, NULL); | 1876 | return otg_set_peripheral(udc->transceiver->otg, NULL); |
@@ -2480,13 +2474,24 @@ static int __init pxa_udc_probe(struct platform_device *pdev) | |||
2480 | driver_name, udc->irq, retval); | 2474 | driver_name, udc->irq, retval); |
2481 | goto err_irq; | 2475 | goto err_irq; |
2482 | } | 2476 | } |
2477 | |||
2478 | retval = device_add(&udc->gadget.dev); | ||
2479 | if (retval) { | ||
2480 | dev_err(udc->dev, "device_add error %d\n", retval); | ||
2481 | goto err_dev_add; | ||
2482 | } | ||
2483 | |||
2483 | retval = usb_add_gadget_udc(&pdev->dev, &udc->gadget); | 2484 | retval = usb_add_gadget_udc(&pdev->dev, &udc->gadget); |
2484 | if (retval) | 2485 | if (retval) |
2485 | goto err_add_udc; | 2486 | goto err_add_udc; |
2486 | 2487 | ||
2487 | pxa_init_debugfs(udc); | 2488 | pxa_init_debugfs(udc); |
2489 | |||
2488 | return 0; | 2490 | return 0; |
2491 | |||
2489 | err_add_udc: | 2492 | err_add_udc: |
2493 | device_unregister(&udc->gadget.dev); | ||
2494 | err_dev_add: | ||
2490 | free_irq(udc->irq, udc); | 2495 | free_irq(udc->irq, udc); |
2491 | err_irq: | 2496 | err_irq: |
2492 | iounmap(udc->regs); | 2497 | iounmap(udc->regs); |
@@ -2507,6 +2512,7 @@ static int __exit pxa_udc_remove(struct platform_device *_dev) | |||
2507 | int gpio = udc->mach->gpio_pullup; | 2512 | int gpio = udc->mach->gpio_pullup; |
2508 | 2513 | ||
2509 | usb_del_gadget_udc(&udc->gadget); | 2514 | usb_del_gadget_udc(&udc->gadget); |
2515 | device_del(&udc->gadget.dev); | ||
2510 | usb_gadget_unregister_driver(udc->driver); | 2516 | usb_gadget_unregister_driver(udc->driver); |
2511 | free_irq(udc->irq, udc); | 2517 | free_irq(udc->irq, udc); |
2512 | pxa_cleanup_debugfs(udc); | 2518 | pxa_cleanup_debugfs(udc); |
diff --git a/drivers/usb/gadget/s3c2410_udc.c b/drivers/usb/gadget/s3c2410_udc.c index fc07b4381286..08f89652533b 100644 --- a/drivers/usb/gadget/s3c2410_udc.c +++ b/drivers/usb/gadget/s3c2410_udc.c | |||
@@ -1668,8 +1668,7 @@ static void s3c2410_udc_enable(struct s3c2410_udc *dev) | |||
1668 | static int s3c2410_udc_start(struct usb_gadget *g, | 1668 | static int s3c2410_udc_start(struct usb_gadget *g, |
1669 | struct usb_gadget_driver *driver) | 1669 | struct usb_gadget_driver *driver) |
1670 | { | 1670 | { |
1671 | struct s3c2410_udc *udc = to_s3c2410(g) | 1671 | struct s3c2410_udc *udc = to_s3c2410(g); |
1672 | int retval; | ||
1673 | 1672 | ||
1674 | dprintk(DEBUG_NORMAL, "%s() '%s'\n", __func__, driver->driver.name); | 1673 | dprintk(DEBUG_NORMAL, "%s() '%s'\n", __func__, driver->driver.name); |
1675 | 1674 | ||
@@ -1677,22 +1676,10 @@ static int s3c2410_udc_start(struct usb_gadget *g, | |||
1677 | udc->driver = driver; | 1676 | udc->driver = driver; |
1678 | udc->gadget.dev.driver = &driver->driver; | 1677 | udc->gadget.dev.driver = &driver->driver; |
1679 | 1678 | ||
1680 | /* Bind the driver */ | ||
1681 | retval = device_add(&udc->gadget.dev); | ||
1682 | if (retval) { | ||
1683 | dev_err(&udc->gadget.dev, "Error in device_add() : %d\n", retval); | ||
1684 | goto register_error; | ||
1685 | } | ||
1686 | |||
1687 | /* Enable udc */ | 1679 | /* Enable udc */ |
1688 | s3c2410_udc_enable(udc); | 1680 | s3c2410_udc_enable(udc); |
1689 | 1681 | ||
1690 | return 0; | 1682 | return 0; |
1691 | |||
1692 | register_error: | ||
1693 | udc->driver = NULL; | ||
1694 | udc->gadget.dev.driver = NULL; | ||
1695 | return retval; | ||
1696 | } | 1683 | } |
1697 | 1684 | ||
1698 | static int s3c2410_udc_stop(struct usb_gadget *g, | 1685 | static int s3c2410_udc_stop(struct usb_gadget *g, |
@@ -1700,7 +1687,6 @@ static int s3c2410_udc_stop(struct usb_gadget *g, | |||
1700 | { | 1687 | { |
1701 | struct s3c2410_udc *udc = to_s3c2410(g); | 1688 | struct s3c2410_udc *udc = to_s3c2410(g); |
1702 | 1689 | ||
1703 | device_del(&udc->gadget.dev); | ||
1704 | udc->driver = NULL; | 1690 | udc->driver = NULL; |
1705 | 1691 | ||
1706 | /* Disable udc */ | 1692 | /* Disable udc */ |
@@ -1842,6 +1828,13 @@ static int s3c2410_udc_probe(struct platform_device *pdev) | |||
1842 | udc->gadget.dev.parent = &pdev->dev; | 1828 | udc->gadget.dev.parent = &pdev->dev; |
1843 | udc->gadget.dev.dma_mask = pdev->dev.dma_mask; | 1829 | udc->gadget.dev.dma_mask = pdev->dev.dma_mask; |
1844 | 1830 | ||
1831 | /* Bind the driver */ | ||
1832 | retval = device_add(&udc->gadget.dev); | ||
1833 | if (retval) { | ||
1834 | dev_err(&udc->gadget.dev, "Error in device_add() : %d\n", retval); | ||
1835 | goto err_device_add; | ||
1836 | } | ||
1837 | |||
1845 | the_controller = udc; | 1838 | the_controller = udc; |
1846 | platform_set_drvdata(pdev, udc); | 1839 | platform_set_drvdata(pdev, udc); |
1847 | 1840 | ||
@@ -1930,6 +1923,8 @@ err_gpio_claim: | |||
1930 | err_int: | 1923 | err_int: |
1931 | free_irq(IRQ_USBD, udc); | 1924 | free_irq(IRQ_USBD, udc); |
1932 | err_map: | 1925 | err_map: |
1926 | device_unregister(&udc->gadget.dev); | ||
1927 | err_device_add: | ||
1933 | iounmap(base_addr); | 1928 | iounmap(base_addr); |
1934 | err_mem: | 1929 | err_mem: |
1935 | release_mem_region(rsrc_start, rsrc_len); | 1930 | release_mem_region(rsrc_start, rsrc_len); |
@@ -1947,10 +1942,11 @@ static int s3c2410_udc_remove(struct platform_device *pdev) | |||
1947 | 1942 | ||
1948 | dev_dbg(&pdev->dev, "%s()\n", __func__); | 1943 | dev_dbg(&pdev->dev, "%s()\n", __func__); |
1949 | 1944 | ||
1950 | usb_del_gadget_udc(&udc->gadget); | ||
1951 | if (udc->driver) | 1945 | if (udc->driver) |
1952 | return -EBUSY; | 1946 | return -EBUSY; |
1953 | 1947 | ||
1948 | usb_del_gadget_udc(&udc->gadget); | ||
1949 | device_unregister(&udc->gadget.dev); | ||
1954 | debugfs_remove(udc->regs_info); | 1950 | debugfs_remove(udc->regs_info); |
1955 | 1951 | ||
1956 | if (udc_info && !udc_info->udc_command && | 1952 | if (udc_info && !udc_info->udc_command && |
diff --git a/drivers/usb/gadget/u_serial.c b/drivers/usb/gadget/u_serial.c index c5034d9c946b..b369292d4b90 100644 --- a/drivers/usb/gadget/u_serial.c +++ b/drivers/usb/gadget/u_serial.c | |||
@@ -136,7 +136,7 @@ static struct portmaster { | |||
136 | pr_debug(fmt, ##arg) | 136 | pr_debug(fmt, ##arg) |
137 | #endif /* pr_vdebug */ | 137 | #endif /* pr_vdebug */ |
138 | #else | 138 | #else |
139 | #ifndef pr_vdebig | 139 | #ifndef pr_vdebug |
140 | #define pr_vdebug(fmt, arg...) \ | 140 | #define pr_vdebug(fmt, arg...) \ |
141 | ({ if (0) pr_debug(fmt, ##arg); }) | 141 | ({ if (0) pr_debug(fmt, ##arg); }) |
142 | #endif /* pr_vdebug */ | 142 | #endif /* pr_vdebug */ |
diff --git a/drivers/usb/gadget/u_uac1.c b/drivers/usb/gadget/u_uac1.c index e0c5e88e03ed..c7d460f43390 100644 --- a/drivers/usb/gadget/u_uac1.c +++ b/drivers/usb/gadget/u_uac1.c | |||
@@ -240,8 +240,11 @@ static int gaudio_open_snd_dev(struct gaudio *card) | |||
240 | snd = &card->playback; | 240 | snd = &card->playback; |
241 | snd->filp = filp_open(fn_play, O_WRONLY, 0); | 241 | snd->filp = filp_open(fn_play, O_WRONLY, 0); |
242 | if (IS_ERR(snd->filp)) { | 242 | if (IS_ERR(snd->filp)) { |
243 | int ret = PTR_ERR(snd->filp); | ||
244 | |||
243 | ERROR(card, "No such PCM playback device: %s\n", fn_play); | 245 | ERROR(card, "No such PCM playback device: %s\n", fn_play); |
244 | snd->filp = NULL; | 246 | snd->filp = NULL; |
247 | return ret; | ||
245 | } | 248 | } |
246 | pcm_file = snd->filp->private_data; | 249 | pcm_file = snd->filp->private_data; |
247 | snd->substream = pcm_file->substream; | 250 | snd->substream = pcm_file->substream; |
diff --git a/drivers/usb/gadget/udc-core.c b/drivers/usb/gadget/udc-core.c index 2a9cd369f71c..f8f62c3ed65e 100644 --- a/drivers/usb/gadget/udc-core.c +++ b/drivers/usb/gadget/udc-core.c | |||
@@ -216,7 +216,7 @@ static void usb_gadget_remove_driver(struct usb_udc *udc) | |||
216 | usb_gadget_disconnect(udc->gadget); | 216 | usb_gadget_disconnect(udc->gadget); |
217 | udc->driver->disconnect(udc->gadget); | 217 | udc->driver->disconnect(udc->gadget); |
218 | udc->driver->unbind(udc->gadget); | 218 | udc->driver->unbind(udc->gadget); |
219 | usb_gadget_udc_stop(udc->gadget, udc->driver); | 219 | usb_gadget_udc_stop(udc->gadget, NULL); |
220 | 220 | ||
221 | udc->driver = NULL; | 221 | udc->driver = NULL; |
222 | udc->dev.driver = NULL; | 222 | udc->dev.driver = NULL; |
diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c index b416a3fc9959..416a6dce5e11 100644 --- a/drivers/usb/host/ehci-hcd.c +++ b/drivers/usb/host/ehci-hcd.c | |||
@@ -302,6 +302,7 @@ static void ehci_quiesce (struct ehci_hcd *ehci) | |||
302 | 302 | ||
303 | static void end_unlink_async(struct ehci_hcd *ehci); | 303 | static void end_unlink_async(struct ehci_hcd *ehci); |
304 | static void unlink_empty_async(struct ehci_hcd *ehci); | 304 | static void unlink_empty_async(struct ehci_hcd *ehci); |
305 | static void unlink_empty_async_suspended(struct ehci_hcd *ehci); | ||
305 | static void ehci_work(struct ehci_hcd *ehci); | 306 | static void ehci_work(struct ehci_hcd *ehci); |
306 | static void start_unlink_intr(struct ehci_hcd *ehci, struct ehci_qh *qh); | 307 | static void start_unlink_intr(struct ehci_hcd *ehci, struct ehci_qh *qh); |
307 | static void end_unlink_intr(struct ehci_hcd *ehci, struct ehci_qh *qh); | 308 | static void end_unlink_intr(struct ehci_hcd *ehci, struct ehci_qh *qh); |
@@ -748,11 +749,9 @@ static irqreturn_t ehci_irq (struct usb_hcd *hcd) | |||
748 | /* guard against (alleged) silicon errata */ | 749 | /* guard against (alleged) silicon errata */ |
749 | if (cmd & CMD_IAAD) | 750 | if (cmd & CMD_IAAD) |
750 | ehci_dbg(ehci, "IAA with IAAD still set?\n"); | 751 | ehci_dbg(ehci, "IAA with IAAD still set?\n"); |
751 | if (ehci->async_iaa) { | 752 | if (ehci->async_iaa) |
752 | COUNT(ehci->stats.iaa); | 753 | COUNT(ehci->stats.iaa); |
753 | end_unlink_async(ehci); | 754 | end_unlink_async(ehci); |
754 | } else | ||
755 | ehci_dbg(ehci, "IAA with nothing unlinked?\n"); | ||
756 | } | 755 | } |
757 | 756 | ||
758 | /* remote wakeup [4.3.1] */ | 757 | /* remote wakeup [4.3.1] */ |
diff --git a/drivers/usb/host/ehci-hub.c b/drivers/usb/host/ehci-hub.c index 4d3b294f203e..7d06e77f6c4f 100644 --- a/drivers/usb/host/ehci-hub.c +++ b/drivers/usb/host/ehci-hub.c | |||
@@ -328,7 +328,7 @@ static int ehci_bus_suspend (struct usb_hcd *hcd) | |||
328 | ehci->rh_state = EHCI_RH_SUSPENDED; | 328 | ehci->rh_state = EHCI_RH_SUSPENDED; |
329 | 329 | ||
330 | end_unlink_async(ehci); | 330 | end_unlink_async(ehci); |
331 | unlink_empty_async(ehci); | 331 | unlink_empty_async_suspended(ehci); |
332 | ehci_handle_intr_unlinks(ehci); | 332 | ehci_handle_intr_unlinks(ehci); |
333 | end_free_itds(ehci); | 333 | end_free_itds(ehci); |
334 | 334 | ||
diff --git a/drivers/usb/host/ehci-q.c b/drivers/usb/host/ehci-q.c index fd252f0cfb3a..23d136904285 100644 --- a/drivers/usb/host/ehci-q.c +++ b/drivers/usb/host/ehci-q.c | |||
@@ -135,7 +135,7 @@ qh_refresh (struct ehci_hcd *ehci, struct ehci_qh *qh) | |||
135 | * qtd is updated in qh_completions(). Update the QH | 135 | * qtd is updated in qh_completions(). Update the QH |
136 | * overlay here. | 136 | * overlay here. |
137 | */ | 137 | */ |
138 | if (cpu_to_hc32(ehci, qtd->qtd_dma) == qh->hw->hw_current) { | 138 | if (qh->hw->hw_token & ACTIVE_BIT(ehci)) { |
139 | qh->hw->hw_qtd_next = qtd->hw_next; | 139 | qh->hw->hw_qtd_next = qtd->hw_next; |
140 | qtd = NULL; | 140 | qtd = NULL; |
141 | } | 141 | } |
@@ -449,11 +449,19 @@ qh_completions (struct ehci_hcd *ehci, struct ehci_qh *qh) | |||
449 | else if (last_status == -EINPROGRESS && !urb->unlinked) | 449 | else if (last_status == -EINPROGRESS && !urb->unlinked) |
450 | continue; | 450 | continue; |
451 | 451 | ||
452 | /* qh unlinked; token in overlay may be most current */ | 452 | /* |
453 | if (state == QH_STATE_IDLE | 453 | * If this was the active qtd when the qh was unlinked |
454 | && cpu_to_hc32(ehci, qtd->qtd_dma) | 454 | * and the overlay's token is active, then the overlay |
455 | == hw->hw_current) { | 455 | * hasn't been written back to the qtd yet so use its |
456 | * token instead of the qtd's. After the qtd is | ||
457 | * processed and removed, the overlay won't be valid | ||
458 | * any more. | ||
459 | */ | ||
460 | if (state == QH_STATE_IDLE && | ||
461 | qh->qtd_list.next == &qtd->qtd_list && | ||
462 | (hw->hw_token & ACTIVE_BIT(ehci))) { | ||
456 | token = hc32_to_cpu(ehci, hw->hw_token); | 463 | token = hc32_to_cpu(ehci, hw->hw_token); |
464 | hw->hw_token &= ~ACTIVE_BIT(ehci); | ||
457 | 465 | ||
458 | /* An unlink may leave an incomplete | 466 | /* An unlink may leave an incomplete |
459 | * async transaction in the TT buffer. | 467 | * async transaction in the TT buffer. |
@@ -1170,7 +1178,7 @@ static void single_unlink_async(struct ehci_hcd *ehci, struct ehci_qh *qh) | |||
1170 | struct ehci_qh *prev; | 1178 | struct ehci_qh *prev; |
1171 | 1179 | ||
1172 | /* Add to the end of the list of QHs waiting for the next IAAD */ | 1180 | /* Add to the end of the list of QHs waiting for the next IAAD */ |
1173 | qh->qh_state = QH_STATE_UNLINK; | 1181 | qh->qh_state = QH_STATE_UNLINK_WAIT; |
1174 | if (ehci->async_unlink) | 1182 | if (ehci->async_unlink) |
1175 | ehci->async_unlink_last->unlink_next = qh; | 1183 | ehci->async_unlink_last->unlink_next = qh; |
1176 | else | 1184 | else |
@@ -1213,9 +1221,19 @@ static void start_iaa_cycle(struct ehci_hcd *ehci, bool nested) | |||
1213 | 1221 | ||
1214 | /* Do only the first waiting QH (nVidia bug?) */ | 1222 | /* Do only the first waiting QH (nVidia bug?) */ |
1215 | qh = ehci->async_unlink; | 1223 | qh = ehci->async_unlink; |
1216 | ehci->async_iaa = qh; | 1224 | |
1217 | ehci->async_unlink = qh->unlink_next; | 1225 | /* |
1218 | qh->unlink_next = NULL; | 1226 | * Intel (?) bug: The HC can write back the overlay region |
1227 | * even after the IAA interrupt occurs. In self-defense, | ||
1228 | * always go through two IAA cycles for each QH. | ||
1229 | */ | ||
1230 | if (qh->qh_state == QH_STATE_UNLINK_WAIT) { | ||
1231 | qh->qh_state = QH_STATE_UNLINK; | ||
1232 | } else { | ||
1233 | ehci->async_iaa = qh; | ||
1234 | ehci->async_unlink = qh->unlink_next; | ||
1235 | qh->unlink_next = NULL; | ||
1236 | } | ||
1219 | 1237 | ||
1220 | /* Make sure the unlinks are all visible to the hardware */ | 1238 | /* Make sure the unlinks are all visible to the hardware */ |
1221 | wmb(); | 1239 | wmb(); |
@@ -1298,6 +1316,19 @@ static void unlink_empty_async(struct ehci_hcd *ehci) | |||
1298 | } | 1316 | } |
1299 | } | 1317 | } |
1300 | 1318 | ||
1319 | /* The root hub is suspended; unlink all the async QHs */ | ||
1320 | static void unlink_empty_async_suspended(struct ehci_hcd *ehci) | ||
1321 | { | ||
1322 | struct ehci_qh *qh; | ||
1323 | |||
1324 | while (ehci->async->qh_next.qh) { | ||
1325 | qh = ehci->async->qh_next.qh; | ||
1326 | WARN_ON(!list_empty(&qh->qtd_list)); | ||
1327 | single_unlink_async(ehci, qh); | ||
1328 | } | ||
1329 | start_iaa_cycle(ehci, false); | ||
1330 | } | ||
1331 | |||
1301 | /* makes sure the async qh will become idle */ | 1332 | /* makes sure the async qh will become idle */ |
1302 | /* caller must own ehci->lock */ | 1333 | /* caller must own ehci->lock */ |
1303 | 1334 | ||
diff --git a/drivers/usb/host/ehci-timer.c b/drivers/usb/host/ehci-timer.c index 20dbdcbe9b0f..c3fa1305f830 100644 --- a/drivers/usb/host/ehci-timer.c +++ b/drivers/usb/host/ehci-timer.c | |||
@@ -304,7 +304,7 @@ static void ehci_iaa_watchdog(struct ehci_hcd *ehci) | |||
304 | * (a) SMP races against real IAA firing and retriggering, and | 304 | * (a) SMP races against real IAA firing and retriggering, and |
305 | * (b) clean HC shutdown, when IAA watchdog was pending. | 305 | * (b) clean HC shutdown, when IAA watchdog was pending. |
306 | */ | 306 | */ |
307 | if (ehci->async_iaa) { | 307 | if (1) { |
308 | u32 cmd, status; | 308 | u32 cmd, status; |
309 | 309 | ||
310 | /* If we get here, IAA is *REALLY* late. It's barely | 310 | /* If we get here, IAA is *REALLY* late. It's barely |
diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c index f1f01a834ba7..849470b18831 100644 --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c | |||
@@ -350,7 +350,7 @@ static int xhci_try_enable_msi(struct usb_hcd *hcd) | |||
350 | * generate interrupts. Don't even try to enable MSI. | 350 | * generate interrupts. Don't even try to enable MSI. |
351 | */ | 351 | */ |
352 | if (xhci->quirks & XHCI_BROKEN_MSI) | 352 | if (xhci->quirks & XHCI_BROKEN_MSI) |
353 | return 0; | 353 | goto legacy_irq; |
354 | 354 | ||
355 | /* unregister the legacy interrupt */ | 355 | /* unregister the legacy interrupt */ |
356 | if (hcd->irq) | 356 | if (hcd->irq) |
@@ -371,6 +371,7 @@ static int xhci_try_enable_msi(struct usb_hcd *hcd) | |||
371 | return -EINVAL; | 371 | return -EINVAL; |
372 | } | 372 | } |
373 | 373 | ||
374 | legacy_irq: | ||
374 | /* fall back to legacy interrupt*/ | 375 | /* fall back to legacy interrupt*/ |
375 | ret = request_irq(pdev->irq, &usb_hcd_irq, IRQF_SHARED, | 376 | ret = request_irq(pdev->irq, &usb_hcd_irq, IRQF_SHARED, |
376 | hcd->irq_descr, hcd); | 377 | hcd->irq_descr, hcd); |
diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h index f791bd0aee6c..2c510e4a7d4c 100644 --- a/drivers/usb/host/xhci.h +++ b/drivers/usb/host/xhci.h | |||
@@ -206,8 +206,8 @@ struct xhci_op_regs { | |||
206 | /* bits 12:31 are reserved (and should be preserved on writes). */ | 206 | /* bits 12:31 are reserved (and should be preserved on writes). */ |
207 | 207 | ||
208 | /* IMAN - Interrupt Management Register */ | 208 | /* IMAN - Interrupt Management Register */ |
209 | #define IMAN_IP (1 << 1) | 209 | #define IMAN_IE (1 << 1) |
210 | #define IMAN_IE (1 << 0) | 210 | #define IMAN_IP (1 << 0) |
211 | 211 | ||
212 | /* USBSTS - USB status - status bitmasks */ | 212 | /* USBSTS - USB status - status bitmasks */ |
213 | /* HC not running - set to 1 when run/stop bit is cleared. */ | 213 | /* HC not running - set to 1 when run/stop bit is cleared. */ |
diff --git a/drivers/usb/musb/Kconfig b/drivers/usb/musb/Kconfig index 45b19e2c60ba..05e51432dd2f 100644 --- a/drivers/usb/musb/Kconfig +++ b/drivers/usb/musb/Kconfig | |||
@@ -7,11 +7,6 @@ | |||
7 | config USB_MUSB_HDRC | 7 | config USB_MUSB_HDRC |
8 | tristate 'Inventra Highspeed Dual Role Controller (TI, ADI, ...)' | 8 | tristate 'Inventra Highspeed Dual Role Controller (TI, ADI, ...)' |
9 | depends on USB && USB_GADGET | 9 | depends on USB && USB_GADGET |
10 | select NOP_USB_XCEIV if (ARCH_DAVINCI || MACH_OMAP3EVM || BLACKFIN) | ||
11 | select NOP_USB_XCEIV if (SOC_TI81XX || SOC_AM33XX) | ||
12 | select TWL4030_USB if MACH_OMAP_3430SDP | ||
13 | select TWL6030_USB if MACH_OMAP_4430SDP || MACH_OMAP4_PANDA | ||
14 | select OMAP_CONTROL_USB if MACH_OMAP_4430SDP || MACH_OMAP4_PANDA | ||
15 | select USB_OTG_UTILS | 10 | select USB_OTG_UTILS |
16 | help | 11 | help |
17 | Say Y here if your system has a dual role high speed USB | 12 | Say Y here if your system has a dual role high speed USB |
diff --git a/drivers/usb/musb/da8xx.c b/drivers/usb/musb/da8xx.c index 7c71769d71ff..41613a2b35e8 100644 --- a/drivers/usb/musb/da8xx.c +++ b/drivers/usb/musb/da8xx.c | |||
@@ -327,7 +327,7 @@ static irqreturn_t da8xx_musb_interrupt(int irq, void *hci) | |||
327 | u8 devctl = musb_readb(mregs, MUSB_DEVCTL); | 327 | u8 devctl = musb_readb(mregs, MUSB_DEVCTL); |
328 | int err; | 328 | int err; |
329 | 329 | ||
330 | err = musb->int_usb & USB_INTR_VBUSERROR; | 330 | err = musb->int_usb & MUSB_INTR_VBUSERROR; |
331 | if (err) { | 331 | if (err) { |
332 | /* | 332 | /* |
333 | * The Mentor core doesn't debounce VBUS as needed | 333 | * The Mentor core doesn't debounce VBUS as needed |
diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c index 60b41cc28da4..daec6e0f7e38 100644 --- a/drivers/usb/musb/musb_core.c +++ b/drivers/usb/musb/musb_core.c | |||
@@ -1624,8 +1624,6 @@ EXPORT_SYMBOL_GPL(musb_dma_completion); | |||
1624 | 1624 | ||
1625 | /*-------------------------------------------------------------------------*/ | 1625 | /*-------------------------------------------------------------------------*/ |
1626 | 1626 | ||
1627 | #ifdef CONFIG_SYSFS | ||
1628 | |||
1629 | static ssize_t | 1627 | static ssize_t |
1630 | musb_mode_show(struct device *dev, struct device_attribute *attr, char *buf) | 1628 | musb_mode_show(struct device *dev, struct device_attribute *attr, char *buf) |
1631 | { | 1629 | { |
@@ -1742,8 +1740,6 @@ static const struct attribute_group musb_attr_group = { | |||
1742 | .attrs = musb_attributes, | 1740 | .attrs = musb_attributes, |
1743 | }; | 1741 | }; |
1744 | 1742 | ||
1745 | #endif /* sysfs */ | ||
1746 | |||
1747 | /* Only used to provide driver mode change events */ | 1743 | /* Only used to provide driver mode change events */ |
1748 | static void musb_irq_work(struct work_struct *data) | 1744 | static void musb_irq_work(struct work_struct *data) |
1749 | { | 1745 | { |
@@ -1968,11 +1964,9 @@ musb_init_controller(struct device *dev, int nIrq, void __iomem *ctrl) | |||
1968 | if (status < 0) | 1964 | if (status < 0) |
1969 | goto fail4; | 1965 | goto fail4; |
1970 | 1966 | ||
1971 | #ifdef CONFIG_SYSFS | ||
1972 | status = sysfs_create_group(&musb->controller->kobj, &musb_attr_group); | 1967 | status = sysfs_create_group(&musb->controller->kobj, &musb_attr_group); |
1973 | if (status) | 1968 | if (status) |
1974 | goto fail5; | 1969 | goto fail5; |
1975 | #endif | ||
1976 | 1970 | ||
1977 | pm_runtime_put(musb->controller); | 1971 | pm_runtime_put(musb->controller); |
1978 | 1972 | ||
diff --git a/drivers/usb/musb/musb_gadget.c b/drivers/usb/musb/musb_gadget.c index be18537c5f14..83eddedcd9be 100644 --- a/drivers/usb/musb/musb_gadget.c +++ b/drivers/usb/musb/musb_gadget.c | |||
@@ -141,7 +141,9 @@ static inline void map_dma_buffer(struct musb_request *request, | |||
141 | static inline void unmap_dma_buffer(struct musb_request *request, | 141 | static inline void unmap_dma_buffer(struct musb_request *request, |
142 | struct musb *musb) | 142 | struct musb *musb) |
143 | { | 143 | { |
144 | if (!is_buffer_mapped(request)) | 144 | struct musb_ep *musb_ep = request->ep; |
145 | |||
146 | if (!is_buffer_mapped(request) || !musb_ep->dma) | ||
145 | return; | 147 | return; |
146 | 148 | ||
147 | if (request->request.dma == DMA_ADDR_INVALID) { | 149 | if (request->request.dma == DMA_ADDR_INVALID) { |
@@ -195,7 +197,10 @@ __acquires(ep->musb->lock) | |||
195 | 197 | ||
196 | ep->busy = 1; | 198 | ep->busy = 1; |
197 | spin_unlock(&musb->lock); | 199 | spin_unlock(&musb->lock); |
198 | unmap_dma_buffer(req, musb); | 200 | |
201 | if (!dma_mapping_error(&musb->g.dev, request->dma)) | ||
202 | unmap_dma_buffer(req, musb); | ||
203 | |||
199 | if (request->status == 0) | 204 | if (request->status == 0) |
200 | dev_dbg(musb->controller, "%s done request %p, %d/%d\n", | 205 | dev_dbg(musb->controller, "%s done request %p, %d/%d\n", |
201 | ep->end_point.name, request, | 206 | ep->end_point.name, request, |
diff --git a/drivers/usb/musb/omap2430.c b/drivers/usb/musb/omap2430.c index 1762354fe793..1a42a458f2c4 100644 --- a/drivers/usb/musb/omap2430.c +++ b/drivers/usb/musb/omap2430.c | |||
@@ -51,7 +51,7 @@ struct omap2430_glue { | |||
51 | }; | 51 | }; |
52 | #define glue_to_musb(g) platform_get_drvdata(g->musb) | 52 | #define glue_to_musb(g) platform_get_drvdata(g->musb) |
53 | 53 | ||
54 | struct omap2430_glue *_glue; | 54 | static struct omap2430_glue *_glue; |
55 | 55 | ||
56 | static struct timer_list musb_idle_timer; | 56 | static struct timer_list musb_idle_timer; |
57 | 57 | ||
@@ -237,9 +237,13 @@ void omap_musb_mailbox(enum omap_musb_vbus_id_status status) | |||
237 | { | 237 | { |
238 | struct omap2430_glue *glue = _glue; | 238 | struct omap2430_glue *glue = _glue; |
239 | 239 | ||
240 | if (glue && glue_to_musb(glue)) { | 240 | if (!glue) { |
241 | glue->status = status; | 241 | pr_err("%s: musb core is not yet initialized\n", __func__); |
242 | } else { | 242 | return; |
243 | } | ||
244 | glue->status = status; | ||
245 | |||
246 | if (!glue_to_musb(glue)) { | ||
243 | pr_err("%s: musb core is not yet ready\n", __func__); | 247 | pr_err("%s: musb core is not yet ready\n", __func__); |
244 | return; | 248 | return; |
245 | } | 249 | } |
diff --git a/drivers/usb/otg/otg.c b/drivers/usb/otg/otg.c index e1814397ca3a..2bd03d261a50 100644 --- a/drivers/usb/otg/otg.c +++ b/drivers/usb/otg/otg.c | |||
@@ -130,7 +130,7 @@ struct usb_phy *usb_get_phy(enum usb_phy_type type) | |||
130 | spin_lock_irqsave(&phy_lock, flags); | 130 | spin_lock_irqsave(&phy_lock, flags); |
131 | 131 | ||
132 | phy = __usb_find_phy(&phy_list, type); | 132 | phy = __usb_find_phy(&phy_list, type); |
133 | if (IS_ERR(phy)) { | 133 | if (IS_ERR(phy) || !try_module_get(phy->dev->driver->owner)) { |
134 | pr_err("unable to find transceiver of type %s\n", | 134 | pr_err("unable to find transceiver of type %s\n", |
135 | usb_phy_type_string(type)); | 135 | usb_phy_type_string(type)); |
136 | goto err0; | 136 | goto err0; |
@@ -228,7 +228,7 @@ struct usb_phy *usb_get_phy_dev(struct device *dev, u8 index) | |||
228 | spin_lock_irqsave(&phy_lock, flags); | 228 | spin_lock_irqsave(&phy_lock, flags); |
229 | 229 | ||
230 | phy = __usb_find_phy_dev(dev, &phy_bind_list, index); | 230 | phy = __usb_find_phy_dev(dev, &phy_bind_list, index); |
231 | if (IS_ERR(phy)) { | 231 | if (IS_ERR(phy) || !try_module_get(phy->dev->driver->owner)) { |
232 | pr_err("unable to find transceiver\n"); | 232 | pr_err("unable to find transceiver\n"); |
233 | goto err0; | 233 | goto err0; |
234 | } | 234 | } |
@@ -301,8 +301,12 @@ EXPORT_SYMBOL(devm_usb_put_phy); | |||
301 | */ | 301 | */ |
302 | void usb_put_phy(struct usb_phy *x) | 302 | void usb_put_phy(struct usb_phy *x) |
303 | { | 303 | { |
304 | if (x) | 304 | if (x) { |
305 | struct module *owner = x->dev->driver->owner; | ||
306 | |||
305 | put_device(x->dev); | 307 | put_device(x->dev); |
308 | module_put(owner); | ||
309 | } | ||
306 | } | 310 | } |
307 | EXPORT_SYMBOL(usb_put_phy); | 311 | EXPORT_SYMBOL(usb_put_phy); |
308 | 312 | ||
diff --git a/drivers/usb/phy/omap-control-usb.c b/drivers/usb/phy/omap-control-usb.c index 5323b71c3521..1419ceda9759 100644 --- a/drivers/usb/phy/omap-control-usb.c +++ b/drivers/usb/phy/omap-control-usb.c | |||
@@ -219,32 +219,26 @@ static int omap_control_usb_probe(struct platform_device *pdev) | |||
219 | 219 | ||
220 | res = platform_get_resource_byname(pdev, IORESOURCE_MEM, | 220 | res = platform_get_resource_byname(pdev, IORESOURCE_MEM, |
221 | "control_dev_conf"); | 221 | "control_dev_conf"); |
222 | control_usb->dev_conf = devm_request_and_ioremap(&pdev->dev, res); | 222 | control_usb->dev_conf = devm_ioremap_resource(&pdev->dev, res); |
223 | if (!control_usb->dev_conf) { | 223 | if (IS_ERR(control_usb->dev_conf)) |
224 | dev_err(&pdev->dev, "Failed to obtain io memory\n"); | 224 | return PTR_ERR(control_usb->dev_conf); |
225 | return -EADDRNOTAVAIL; | ||
226 | } | ||
227 | 225 | ||
228 | if (control_usb->type == OMAP_CTRL_DEV_TYPE1) { | 226 | if (control_usb->type == OMAP_CTRL_DEV_TYPE1) { |
229 | res = platform_get_resource_byname(pdev, IORESOURCE_MEM, | 227 | res = platform_get_resource_byname(pdev, IORESOURCE_MEM, |
230 | "otghs_control"); | 228 | "otghs_control"); |
231 | control_usb->otghs_control = devm_request_and_ioremap( | 229 | control_usb->otghs_control = devm_ioremap_resource( |
232 | &pdev->dev, res); | 230 | &pdev->dev, res); |
233 | if (!control_usb->otghs_control) { | 231 | if (IS_ERR(control_usb->otghs_control)) |
234 | dev_err(&pdev->dev, "Failed to obtain io memory\n"); | 232 | return PTR_ERR(control_usb->otghs_control); |
235 | return -EADDRNOTAVAIL; | ||
236 | } | ||
237 | } | 233 | } |
238 | 234 | ||
239 | if (control_usb->type == OMAP_CTRL_DEV_TYPE2) { | 235 | if (control_usb->type == OMAP_CTRL_DEV_TYPE2) { |
240 | res = platform_get_resource_byname(pdev, IORESOURCE_MEM, | 236 | res = platform_get_resource_byname(pdev, IORESOURCE_MEM, |
241 | "phy_power_usb"); | 237 | "phy_power_usb"); |
242 | control_usb->phy_power = devm_request_and_ioremap( | 238 | control_usb->phy_power = devm_ioremap_resource( |
243 | &pdev->dev, res); | 239 | &pdev->dev, res); |
244 | if (!control_usb->phy_power) { | 240 | if (IS_ERR(control_usb->phy_power)) |
245 | dev_dbg(&pdev->dev, "Failed to obtain io memory\n"); | 241 | return PTR_ERR(control_usb->phy_power); |
246 | return -EADDRNOTAVAIL; | ||
247 | } | ||
248 | 242 | ||
249 | control_usb->sys_clk = devm_clk_get(control_usb->dev, | 243 | control_usb->sys_clk = devm_clk_get(control_usb->dev, |
250 | "sys_clkin"); | 244 | "sys_clkin"); |
diff --git a/drivers/usb/phy/omap-usb3.c b/drivers/usb/phy/omap-usb3.c index fadc0c2b65bb..a6e60b1e102e 100644 --- a/drivers/usb/phy/omap-usb3.c +++ b/drivers/usb/phy/omap-usb3.c | |||
@@ -212,11 +212,9 @@ static int omap_usb3_probe(struct platform_device *pdev) | |||
212 | } | 212 | } |
213 | 213 | ||
214 | res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "pll_ctrl"); | 214 | res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "pll_ctrl"); |
215 | phy->pll_ctrl_base = devm_request_and_ioremap(&pdev->dev, res); | 215 | phy->pll_ctrl_base = devm_ioremap_resource(&pdev->dev, res); |
216 | if (!phy->pll_ctrl_base) { | 216 | if (IS_ERR(phy->pll_ctrl_base)) |
217 | dev_err(&pdev->dev, "ioremap of pll_ctrl failed\n"); | 217 | return PTR_ERR(phy->pll_ctrl_base); |
218 | return -ENOMEM; | ||
219 | } | ||
220 | 218 | ||
221 | phy->dev = &pdev->dev; | 219 | phy->dev = &pdev->dev; |
222 | 220 | ||
diff --git a/drivers/usb/phy/samsung-usbphy.c b/drivers/usb/phy/samsung-usbphy.c index 6ea553733832..967101ec15fd 100644 --- a/drivers/usb/phy/samsung-usbphy.c +++ b/drivers/usb/phy/samsung-usbphy.c | |||
@@ -787,11 +787,9 @@ static int samsung_usbphy_probe(struct platform_device *pdev) | |||
787 | return -ENODEV; | 787 | return -ENODEV; |
788 | } | 788 | } |
789 | 789 | ||
790 | phy_base = devm_request_and_ioremap(dev, phy_mem); | 790 | phy_base = devm_ioremap_resource(dev, phy_mem); |
791 | if (!phy_base) { | 791 | if (IS_ERR(phy_base)) |
792 | dev_err(dev, "%s: register mapping failed\n", __func__); | 792 | return PTR_ERR(phy_base); |
793 | return -ENXIO; | ||
794 | } | ||
795 | 793 | ||
796 | sphy = devm_kzalloc(dev, sizeof(*sphy), GFP_KERNEL); | 794 | sphy = devm_kzalloc(dev, sizeof(*sphy), GFP_KERNEL); |
797 | if (!sphy) | 795 | if (!sphy) |
diff --git a/drivers/usb/serial/ark3116.c b/drivers/usb/serial/ark3116.c index cbd904b8fba5..4775f8209e55 100644 --- a/drivers/usb/serial/ark3116.c +++ b/drivers/usb/serial/ark3116.c | |||
@@ -62,7 +62,6 @@ static int is_irda(struct usb_serial *serial) | |||
62 | } | 62 | } |
63 | 63 | ||
64 | struct ark3116_private { | 64 | struct ark3116_private { |
65 | wait_queue_head_t delta_msr_wait; | ||
66 | struct async_icount icount; | 65 | struct async_icount icount; |
67 | int irda; /* 1 for irda device */ | 66 | int irda; /* 1 for irda device */ |
68 | 67 | ||
@@ -146,7 +145,6 @@ static int ark3116_port_probe(struct usb_serial_port *port) | |||
146 | if (!priv) | 145 | if (!priv) |
147 | return -ENOMEM; | 146 | return -ENOMEM; |
148 | 147 | ||
149 | init_waitqueue_head(&priv->delta_msr_wait); | ||
150 | mutex_init(&priv->hw_lock); | 148 | mutex_init(&priv->hw_lock); |
151 | spin_lock_init(&priv->status_lock); | 149 | spin_lock_init(&priv->status_lock); |
152 | 150 | ||
@@ -456,10 +454,14 @@ static int ark3116_ioctl(struct tty_struct *tty, | |||
456 | case TIOCMIWAIT: | 454 | case TIOCMIWAIT: |
457 | for (;;) { | 455 | for (;;) { |
458 | struct async_icount prev = priv->icount; | 456 | struct async_icount prev = priv->icount; |
459 | interruptible_sleep_on(&priv->delta_msr_wait); | 457 | interruptible_sleep_on(&port->delta_msr_wait); |
460 | /* see if a signal did it */ | 458 | /* see if a signal did it */ |
461 | if (signal_pending(current)) | 459 | if (signal_pending(current)) |
462 | return -ERESTARTSYS; | 460 | return -ERESTARTSYS; |
461 | |||
462 | if (port->serial->disconnected) | ||
463 | return -EIO; | ||
464 | |||
463 | if ((prev.rng == priv->icount.rng) && | 465 | if ((prev.rng == priv->icount.rng) && |
464 | (prev.dsr == priv->icount.dsr) && | 466 | (prev.dsr == priv->icount.dsr) && |
465 | (prev.dcd == priv->icount.dcd) && | 467 | (prev.dcd == priv->icount.dcd) && |
@@ -580,7 +582,7 @@ static void ark3116_update_msr(struct usb_serial_port *port, __u8 msr) | |||
580 | priv->icount.dcd++; | 582 | priv->icount.dcd++; |
581 | if (msr & UART_MSR_TERI) | 583 | if (msr & UART_MSR_TERI) |
582 | priv->icount.rng++; | 584 | priv->icount.rng++; |
583 | wake_up_interruptible(&priv->delta_msr_wait); | 585 | wake_up_interruptible(&port->delta_msr_wait); |
584 | } | 586 | } |
585 | } | 587 | } |
586 | 588 | ||
diff --git a/drivers/usb/serial/ch341.c b/drivers/usb/serial/ch341.c index d255f66e708e..07d4650a32ab 100644 --- a/drivers/usb/serial/ch341.c +++ b/drivers/usb/serial/ch341.c | |||
@@ -80,7 +80,6 @@ MODULE_DEVICE_TABLE(usb, id_table); | |||
80 | 80 | ||
81 | struct ch341_private { | 81 | struct ch341_private { |
82 | spinlock_t lock; /* access lock */ | 82 | spinlock_t lock; /* access lock */ |
83 | wait_queue_head_t delta_msr_wait; /* wait queue for modem status */ | ||
84 | unsigned baud_rate; /* set baud rate */ | 83 | unsigned baud_rate; /* set baud rate */ |
85 | u8 line_control; /* set line control value RTS/DTR */ | 84 | u8 line_control; /* set line control value RTS/DTR */ |
86 | u8 line_status; /* active status of modem control inputs */ | 85 | u8 line_status; /* active status of modem control inputs */ |
@@ -252,7 +251,6 @@ static int ch341_port_probe(struct usb_serial_port *port) | |||
252 | return -ENOMEM; | 251 | return -ENOMEM; |
253 | 252 | ||
254 | spin_lock_init(&priv->lock); | 253 | spin_lock_init(&priv->lock); |
255 | init_waitqueue_head(&priv->delta_msr_wait); | ||
256 | priv->baud_rate = DEFAULT_BAUD_RATE; | 254 | priv->baud_rate = DEFAULT_BAUD_RATE; |
257 | priv->line_control = CH341_BIT_RTS | CH341_BIT_DTR; | 255 | priv->line_control = CH341_BIT_RTS | CH341_BIT_DTR; |
258 | 256 | ||
@@ -298,7 +296,7 @@ static void ch341_dtr_rts(struct usb_serial_port *port, int on) | |||
298 | priv->line_control &= ~(CH341_BIT_RTS | CH341_BIT_DTR); | 296 | priv->line_control &= ~(CH341_BIT_RTS | CH341_BIT_DTR); |
299 | spin_unlock_irqrestore(&priv->lock, flags); | 297 | spin_unlock_irqrestore(&priv->lock, flags); |
300 | ch341_set_handshake(port->serial->dev, priv->line_control); | 298 | ch341_set_handshake(port->serial->dev, priv->line_control); |
301 | wake_up_interruptible(&priv->delta_msr_wait); | 299 | wake_up_interruptible(&port->delta_msr_wait); |
302 | } | 300 | } |
303 | 301 | ||
304 | static void ch341_close(struct usb_serial_port *port) | 302 | static void ch341_close(struct usb_serial_port *port) |
@@ -491,7 +489,7 @@ static void ch341_read_int_callback(struct urb *urb) | |||
491 | tty_kref_put(tty); | 489 | tty_kref_put(tty); |
492 | } | 490 | } |
493 | 491 | ||
494 | wake_up_interruptible(&priv->delta_msr_wait); | 492 | wake_up_interruptible(&port->delta_msr_wait); |
495 | } | 493 | } |
496 | 494 | ||
497 | exit: | 495 | exit: |
@@ -517,11 +515,14 @@ static int wait_modem_info(struct usb_serial_port *port, unsigned int arg) | |||
517 | spin_unlock_irqrestore(&priv->lock, flags); | 515 | spin_unlock_irqrestore(&priv->lock, flags); |
518 | 516 | ||
519 | while (!multi_change) { | 517 | while (!multi_change) { |
520 | interruptible_sleep_on(&priv->delta_msr_wait); | 518 | interruptible_sleep_on(&port->delta_msr_wait); |
521 | /* see if a signal did it */ | 519 | /* see if a signal did it */ |
522 | if (signal_pending(current)) | 520 | if (signal_pending(current)) |
523 | return -ERESTARTSYS; | 521 | return -ERESTARTSYS; |
524 | 522 | ||
523 | if (port->serial->disconnected) | ||
524 | return -EIO; | ||
525 | |||
525 | spin_lock_irqsave(&priv->lock, flags); | 526 | spin_lock_irqsave(&priv->lock, flags); |
526 | status = priv->line_status; | 527 | status = priv->line_status; |
527 | multi_change = priv->multi_status_change; | 528 | multi_change = priv->multi_status_change; |
diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c index edc0f0dcad83..4747d1c328ff 100644 --- a/drivers/usb/serial/cp210x.c +++ b/drivers/usb/serial/cp210x.c | |||
@@ -85,6 +85,7 @@ static const struct usb_device_id id_table[] = { | |||
85 | { USB_DEVICE(0x10C4, 0x813F) }, /* Tams Master Easy Control */ | 85 | { USB_DEVICE(0x10C4, 0x813F) }, /* Tams Master Easy Control */ |
86 | { USB_DEVICE(0x10C4, 0x814A) }, /* West Mountain Radio RIGblaster P&P */ | 86 | { USB_DEVICE(0x10C4, 0x814A) }, /* West Mountain Radio RIGblaster P&P */ |
87 | { USB_DEVICE(0x10C4, 0x814B) }, /* West Mountain Radio RIGtalk */ | 87 | { USB_DEVICE(0x10C4, 0x814B) }, /* West Mountain Radio RIGtalk */ |
88 | { USB_DEVICE(0x2405, 0x0003) }, /* West Mountain Radio RIGblaster Advantage */ | ||
88 | { USB_DEVICE(0x10C4, 0x8156) }, /* B&G H3000 link cable */ | 89 | { USB_DEVICE(0x10C4, 0x8156) }, /* B&G H3000 link cable */ |
89 | { USB_DEVICE(0x10C4, 0x815E) }, /* Helicomm IP-Link 1220-DVM */ | 90 | { USB_DEVICE(0x10C4, 0x815E) }, /* Helicomm IP-Link 1220-DVM */ |
90 | { USB_DEVICE(0x10C4, 0x815F) }, /* Timewave HamLinkUSB */ | 91 | { USB_DEVICE(0x10C4, 0x815F) }, /* Timewave HamLinkUSB */ |
@@ -150,6 +151,25 @@ static const struct usb_device_id id_table[] = { | |||
150 | { USB_DEVICE(0x1BE3, 0x07A6) }, /* WAGO 750-923 USB Service Cable */ | 151 | { USB_DEVICE(0x1BE3, 0x07A6) }, /* WAGO 750-923 USB Service Cable */ |
151 | { USB_DEVICE(0x1E29, 0x0102) }, /* Festo CPX-USB */ | 152 | { USB_DEVICE(0x1E29, 0x0102) }, /* Festo CPX-USB */ |
152 | { USB_DEVICE(0x1E29, 0x0501) }, /* Festo CMSP */ | 153 | { USB_DEVICE(0x1E29, 0x0501) }, /* Festo CMSP */ |
154 | { USB_DEVICE(0x1FB9, 0x0100) }, /* Lake Shore Model 121 Current Source */ | ||
155 | { USB_DEVICE(0x1FB9, 0x0200) }, /* Lake Shore Model 218A Temperature Monitor */ | ||
156 | { USB_DEVICE(0x1FB9, 0x0201) }, /* Lake Shore Model 219 Temperature Monitor */ | ||
157 | { USB_DEVICE(0x1FB9, 0x0202) }, /* Lake Shore Model 233 Temperature Transmitter */ | ||
158 | { USB_DEVICE(0x1FB9, 0x0203) }, /* Lake Shore Model 235 Temperature Transmitter */ | ||
159 | { USB_DEVICE(0x1FB9, 0x0300) }, /* Lake Shore Model 335 Temperature Controller */ | ||
160 | { USB_DEVICE(0x1FB9, 0x0301) }, /* Lake Shore Model 336 Temperature Controller */ | ||
161 | { USB_DEVICE(0x1FB9, 0x0302) }, /* Lake Shore Model 350 Temperature Controller */ | ||
162 | { USB_DEVICE(0x1FB9, 0x0303) }, /* Lake Shore Model 371 AC Bridge */ | ||
163 | { USB_DEVICE(0x1FB9, 0x0400) }, /* Lake Shore Model 411 Handheld Gaussmeter */ | ||
164 | { USB_DEVICE(0x1FB9, 0x0401) }, /* Lake Shore Model 425 Gaussmeter */ | ||
165 | { USB_DEVICE(0x1FB9, 0x0402) }, /* Lake Shore Model 455A Gaussmeter */ | ||
166 | { USB_DEVICE(0x1FB9, 0x0403) }, /* Lake Shore Model 475A Gaussmeter */ | ||
167 | { USB_DEVICE(0x1FB9, 0x0404) }, /* Lake Shore Model 465 Three Axis Gaussmeter */ | ||
168 | { USB_DEVICE(0x1FB9, 0x0600) }, /* Lake Shore Model 625A Superconducting MPS */ | ||
169 | { USB_DEVICE(0x1FB9, 0x0601) }, /* Lake Shore Model 642A Magnet Power Supply */ | ||
170 | { USB_DEVICE(0x1FB9, 0x0602) }, /* Lake Shore Model 648 Magnet Power Supply */ | ||
171 | { USB_DEVICE(0x1FB9, 0x0700) }, /* Lake Shore Model 737 VSM Controller */ | ||
172 | { USB_DEVICE(0x1FB9, 0x0701) }, /* Lake Shore Model 776 Hall Matrix */ | ||
153 | { USB_DEVICE(0x3195, 0xF190) }, /* Link Instruments MSO-19 */ | 173 | { USB_DEVICE(0x3195, 0xF190) }, /* Link Instruments MSO-19 */ |
154 | { USB_DEVICE(0x3195, 0xF280) }, /* Link Instruments MSO-28 */ | 174 | { USB_DEVICE(0x3195, 0xF280) }, /* Link Instruments MSO-28 */ |
155 | { USB_DEVICE(0x3195, 0xF281) }, /* Link Instruments MSO-28 */ | 175 | { USB_DEVICE(0x3195, 0xF281) }, /* Link Instruments MSO-28 */ |
diff --git a/drivers/usb/serial/cypress_m8.c b/drivers/usb/serial/cypress_m8.c index 8efa19d0e9fb..ba7352e4187e 100644 --- a/drivers/usb/serial/cypress_m8.c +++ b/drivers/usb/serial/cypress_m8.c | |||
@@ -111,7 +111,6 @@ struct cypress_private { | |||
111 | int baud_rate; /* stores current baud rate in | 111 | int baud_rate; /* stores current baud rate in |
112 | integer form */ | 112 | integer form */ |
113 | int isthrottled; /* if throttled, discard reads */ | 113 | int isthrottled; /* if throttled, discard reads */ |
114 | wait_queue_head_t delta_msr_wait; /* used for TIOCMIWAIT */ | ||
115 | char prev_status, diff_status; /* used for TIOCMIWAIT */ | 114 | char prev_status, diff_status; /* used for TIOCMIWAIT */ |
116 | /* we pass a pointer to this as the argument sent to | 115 | /* we pass a pointer to this as the argument sent to |
117 | cypress_set_termios old_termios */ | 116 | cypress_set_termios old_termios */ |
@@ -449,7 +448,6 @@ static int cypress_generic_port_probe(struct usb_serial_port *port) | |||
449 | kfree(priv); | 448 | kfree(priv); |
450 | return -ENOMEM; | 449 | return -ENOMEM; |
451 | } | 450 | } |
452 | init_waitqueue_head(&priv->delta_msr_wait); | ||
453 | 451 | ||
454 | usb_reset_configuration(serial->dev); | 452 | usb_reset_configuration(serial->dev); |
455 | 453 | ||
@@ -868,12 +866,16 @@ static int cypress_ioctl(struct tty_struct *tty, | |||
868 | switch (cmd) { | 866 | switch (cmd) { |
869 | /* This code comes from drivers/char/serial.c and ftdi_sio.c */ | 867 | /* This code comes from drivers/char/serial.c and ftdi_sio.c */ |
870 | case TIOCMIWAIT: | 868 | case TIOCMIWAIT: |
871 | while (priv != NULL) { | 869 | for (;;) { |
872 | interruptible_sleep_on(&priv->delta_msr_wait); | 870 | interruptible_sleep_on(&port->delta_msr_wait); |
873 | /* see if a signal did it */ | 871 | /* see if a signal did it */ |
874 | if (signal_pending(current)) | 872 | if (signal_pending(current)) |
875 | return -ERESTARTSYS; | 873 | return -ERESTARTSYS; |
876 | else { | 874 | |
875 | if (port->serial->disconnected) | ||
876 | return -EIO; | ||
877 | |||
878 | { | ||
877 | char diff = priv->diff_status; | 879 | char diff = priv->diff_status; |
878 | if (diff == 0) | 880 | if (diff == 0) |
879 | return -EIO; /* no change => error */ | 881 | return -EIO; /* no change => error */ |
@@ -1187,7 +1189,7 @@ static void cypress_read_int_callback(struct urb *urb) | |||
1187 | if (priv->current_status != priv->prev_status) { | 1189 | if (priv->current_status != priv->prev_status) { |
1188 | priv->diff_status |= priv->current_status ^ | 1190 | priv->diff_status |= priv->current_status ^ |
1189 | priv->prev_status; | 1191 | priv->prev_status; |
1190 | wake_up_interruptible(&priv->delta_msr_wait); | 1192 | wake_up_interruptible(&port->delta_msr_wait); |
1191 | priv->prev_status = priv->current_status; | 1193 | priv->prev_status = priv->current_status; |
1192 | } | 1194 | } |
1193 | spin_unlock_irqrestore(&priv->lock, flags); | 1195 | spin_unlock_irqrestore(&priv->lock, flags); |
diff --git a/drivers/usb/serial/f81232.c b/drivers/usb/serial/f81232.c index b1b2dc64b50b..a172ad5c5ce8 100644 --- a/drivers/usb/serial/f81232.c +++ b/drivers/usb/serial/f81232.c | |||
@@ -47,7 +47,6 @@ MODULE_DEVICE_TABLE(usb, id_table); | |||
47 | 47 | ||
48 | struct f81232_private { | 48 | struct f81232_private { |
49 | spinlock_t lock; | 49 | spinlock_t lock; |
50 | wait_queue_head_t delta_msr_wait; | ||
51 | u8 line_control; | 50 | u8 line_control; |
52 | u8 line_status; | 51 | u8 line_status; |
53 | }; | 52 | }; |
@@ -111,7 +110,7 @@ static void f81232_process_read_urb(struct urb *urb) | |||
111 | line_status = priv->line_status; | 110 | line_status = priv->line_status; |
112 | priv->line_status &= ~UART_STATE_TRANSIENT_MASK; | 111 | priv->line_status &= ~UART_STATE_TRANSIENT_MASK; |
113 | spin_unlock_irqrestore(&priv->lock, flags); | 112 | spin_unlock_irqrestore(&priv->lock, flags); |
114 | wake_up_interruptible(&priv->delta_msr_wait); | 113 | wake_up_interruptible(&port->delta_msr_wait); |
115 | 114 | ||
116 | if (!urb->actual_length) | 115 | if (!urb->actual_length) |
117 | return; | 116 | return; |
@@ -256,11 +255,14 @@ static int wait_modem_info(struct usb_serial_port *port, unsigned int arg) | |||
256 | spin_unlock_irqrestore(&priv->lock, flags); | 255 | spin_unlock_irqrestore(&priv->lock, flags); |
257 | 256 | ||
258 | while (1) { | 257 | while (1) { |
259 | interruptible_sleep_on(&priv->delta_msr_wait); | 258 | interruptible_sleep_on(&port->delta_msr_wait); |
260 | /* see if a signal did it */ | 259 | /* see if a signal did it */ |
261 | if (signal_pending(current)) | 260 | if (signal_pending(current)) |
262 | return -ERESTARTSYS; | 261 | return -ERESTARTSYS; |
263 | 262 | ||
263 | if (port->serial->disconnected) | ||
264 | return -EIO; | ||
265 | |||
264 | spin_lock_irqsave(&priv->lock, flags); | 266 | spin_lock_irqsave(&priv->lock, flags); |
265 | status = priv->line_status; | 267 | status = priv->line_status; |
266 | spin_unlock_irqrestore(&priv->lock, flags); | 268 | spin_unlock_irqrestore(&priv->lock, flags); |
@@ -322,7 +324,6 @@ static int f81232_port_probe(struct usb_serial_port *port) | |||
322 | return -ENOMEM; | 324 | return -ENOMEM; |
323 | 325 | ||
324 | spin_lock_init(&priv->lock); | 326 | spin_lock_init(&priv->lock); |
325 | init_waitqueue_head(&priv->delta_msr_wait); | ||
326 | 327 | ||
327 | usb_set_serial_port_data(port, priv); | 328 | usb_set_serial_port_data(port, priv); |
328 | 329 | ||
diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c index edd162df49ca..d4809d551473 100644 --- a/drivers/usb/serial/ftdi_sio.c +++ b/drivers/usb/serial/ftdi_sio.c | |||
@@ -69,9 +69,7 @@ struct ftdi_private { | |||
69 | int flags; /* some ASYNC_xxxx flags are supported */ | 69 | int flags; /* some ASYNC_xxxx flags are supported */ |
70 | unsigned long last_dtr_rts; /* saved modem control outputs */ | 70 | unsigned long last_dtr_rts; /* saved modem control outputs */ |
71 | struct async_icount icount; | 71 | struct async_icount icount; |
72 | wait_queue_head_t delta_msr_wait; /* Used for TIOCMIWAIT */ | ||
73 | char prev_status; /* Used for TIOCMIWAIT */ | 72 | char prev_status; /* Used for TIOCMIWAIT */ |
74 | bool dev_gone; /* Used to abort TIOCMIWAIT */ | ||
75 | char transmit_empty; /* If transmitter is empty or not */ | 73 | char transmit_empty; /* If transmitter is empty or not */ |
76 | __u16 interface; /* FT2232C, FT2232H or FT4232H port interface | 74 | __u16 interface; /* FT2232C, FT2232H or FT4232H port interface |
77 | (0 for FT232/245) */ | 75 | (0 for FT232/245) */ |
@@ -1691,10 +1689,8 @@ static int ftdi_sio_port_probe(struct usb_serial_port *port) | |||
1691 | 1689 | ||
1692 | kref_init(&priv->kref); | 1690 | kref_init(&priv->kref); |
1693 | mutex_init(&priv->cfg_lock); | 1691 | mutex_init(&priv->cfg_lock); |
1694 | init_waitqueue_head(&priv->delta_msr_wait); | ||
1695 | 1692 | ||
1696 | priv->flags = ASYNC_LOW_LATENCY; | 1693 | priv->flags = ASYNC_LOW_LATENCY; |
1697 | priv->dev_gone = false; | ||
1698 | 1694 | ||
1699 | if (quirk && quirk->port_probe) | 1695 | if (quirk && quirk->port_probe) |
1700 | quirk->port_probe(priv); | 1696 | quirk->port_probe(priv); |
@@ -1840,8 +1836,7 @@ static int ftdi_sio_port_remove(struct usb_serial_port *port) | |||
1840 | { | 1836 | { |
1841 | struct ftdi_private *priv = usb_get_serial_port_data(port); | 1837 | struct ftdi_private *priv = usb_get_serial_port_data(port); |
1842 | 1838 | ||
1843 | priv->dev_gone = true; | 1839 | wake_up_interruptible(&port->delta_msr_wait); |
1844 | wake_up_interruptible_all(&priv->delta_msr_wait); | ||
1845 | 1840 | ||
1846 | remove_sysfs_attrs(port); | 1841 | remove_sysfs_attrs(port); |
1847 | 1842 | ||
@@ -1989,7 +1984,7 @@ static int ftdi_process_packet(struct usb_serial_port *port, | |||
1989 | if (diff_status & FTDI_RS0_RLSD) | 1984 | if (diff_status & FTDI_RS0_RLSD) |
1990 | priv->icount.dcd++; | 1985 | priv->icount.dcd++; |
1991 | 1986 | ||
1992 | wake_up_interruptible_all(&priv->delta_msr_wait); | 1987 | wake_up_interruptible(&port->delta_msr_wait); |
1993 | priv->prev_status = status; | 1988 | priv->prev_status = status; |
1994 | } | 1989 | } |
1995 | 1990 | ||
@@ -2440,11 +2435,15 @@ static int ftdi_ioctl(struct tty_struct *tty, | |||
2440 | */ | 2435 | */ |
2441 | case TIOCMIWAIT: | 2436 | case TIOCMIWAIT: |
2442 | cprev = priv->icount; | 2437 | cprev = priv->icount; |
2443 | while (!priv->dev_gone) { | 2438 | for (;;) { |
2444 | interruptible_sleep_on(&priv->delta_msr_wait); | 2439 | interruptible_sleep_on(&port->delta_msr_wait); |
2445 | /* see if a signal did it */ | 2440 | /* see if a signal did it */ |
2446 | if (signal_pending(current)) | 2441 | if (signal_pending(current)) |
2447 | return -ERESTARTSYS; | 2442 | return -ERESTARTSYS; |
2443 | |||
2444 | if (port->serial->disconnected) | ||
2445 | return -EIO; | ||
2446 | |||
2448 | cnow = priv->icount; | 2447 | cnow = priv->icount; |
2449 | if (((arg & TIOCM_RNG) && (cnow.rng != cprev.rng)) || | 2448 | if (((arg & TIOCM_RNG) && (cnow.rng != cprev.rng)) || |
2450 | ((arg & TIOCM_DSR) && (cnow.dsr != cprev.dsr)) || | 2449 | ((arg & TIOCM_DSR) && (cnow.dsr != cprev.dsr)) || |
@@ -2454,8 +2453,6 @@ static int ftdi_ioctl(struct tty_struct *tty, | |||
2454 | } | 2453 | } |
2455 | cprev = cnow; | 2454 | cprev = cnow; |
2456 | } | 2455 | } |
2457 | return -EIO; | ||
2458 | break; | ||
2459 | case TIOCSERGETLSR: | 2456 | case TIOCSERGETLSR: |
2460 | return get_lsr_info(port, (struct serial_struct __user *)arg); | 2457 | return get_lsr_info(port, (struct serial_struct __user *)arg); |
2461 | break; | 2458 | break; |
diff --git a/drivers/usb/serial/garmin_gps.c b/drivers/usb/serial/garmin_gps.c index 1a07b12ef341..81caf5623ee2 100644 --- a/drivers/usb/serial/garmin_gps.c +++ b/drivers/usb/serial/garmin_gps.c | |||
@@ -956,10 +956,7 @@ static void garmin_close(struct usb_serial_port *port) | |||
956 | if (!serial) | 956 | if (!serial) |
957 | return; | 957 | return; |
958 | 958 | ||
959 | mutex_lock(&port->serial->disc_mutex); | 959 | garmin_clear(garmin_data_p); |
960 | |||
961 | if (!port->serial->disconnected) | ||
962 | garmin_clear(garmin_data_p); | ||
963 | 960 | ||
964 | /* shutdown our urbs */ | 961 | /* shutdown our urbs */ |
965 | usb_kill_urb(port->read_urb); | 962 | usb_kill_urb(port->read_urb); |
@@ -968,8 +965,6 @@ static void garmin_close(struct usb_serial_port *port) | |||
968 | /* keep reset state so we know that we must start a new session */ | 965 | /* keep reset state so we know that we must start a new session */ |
969 | if (garmin_data_p->state != STATE_RESET) | 966 | if (garmin_data_p->state != STATE_RESET) |
970 | garmin_data_p->state = STATE_DISCONNECTED; | 967 | garmin_data_p->state = STATE_DISCONNECTED; |
971 | |||
972 | mutex_unlock(&port->serial->disc_mutex); | ||
973 | } | 968 | } |
974 | 969 | ||
975 | 970 | ||
diff --git a/drivers/usb/serial/io_edgeport.c b/drivers/usb/serial/io_edgeport.c index b00e5cbf741f..efd8b978128c 100644 --- a/drivers/usb/serial/io_edgeport.c +++ b/drivers/usb/serial/io_edgeport.c | |||
@@ -110,7 +110,6 @@ struct edgeport_port { | |||
110 | wait_queue_head_t wait_chase; /* for handling sleeping while waiting for chase to finish */ | 110 | wait_queue_head_t wait_chase; /* for handling sleeping while waiting for chase to finish */ |
111 | wait_queue_head_t wait_open; /* for handling sleeping while waiting for open to finish */ | 111 | wait_queue_head_t wait_open; /* for handling sleeping while waiting for open to finish */ |
112 | wait_queue_head_t wait_command; /* for handling sleeping while waiting for command to finish */ | 112 | wait_queue_head_t wait_command; /* for handling sleeping while waiting for command to finish */ |
113 | wait_queue_head_t delta_msr_wait; /* for handling sleeping while waiting for msr change to happen */ | ||
114 | 113 | ||
115 | struct async_icount icount; | 114 | struct async_icount icount; |
116 | struct usb_serial_port *port; /* loop back to the owner of this object */ | 115 | struct usb_serial_port *port; /* loop back to the owner of this object */ |
@@ -884,7 +883,6 @@ static int edge_open(struct tty_struct *tty, struct usb_serial_port *port) | |||
884 | /* initialize our wait queues */ | 883 | /* initialize our wait queues */ |
885 | init_waitqueue_head(&edge_port->wait_open); | 884 | init_waitqueue_head(&edge_port->wait_open); |
886 | init_waitqueue_head(&edge_port->wait_chase); | 885 | init_waitqueue_head(&edge_port->wait_chase); |
887 | init_waitqueue_head(&edge_port->delta_msr_wait); | ||
888 | init_waitqueue_head(&edge_port->wait_command); | 886 | init_waitqueue_head(&edge_port->wait_command); |
889 | 887 | ||
890 | /* initialize our icount structure */ | 888 | /* initialize our icount structure */ |
@@ -1669,13 +1667,17 @@ static int edge_ioctl(struct tty_struct *tty, | |||
1669 | dev_dbg(&port->dev, "%s (%d) TIOCMIWAIT\n", __func__, port->number); | 1667 | dev_dbg(&port->dev, "%s (%d) TIOCMIWAIT\n", __func__, port->number); |
1670 | cprev = edge_port->icount; | 1668 | cprev = edge_port->icount; |
1671 | while (1) { | 1669 | while (1) { |
1672 | prepare_to_wait(&edge_port->delta_msr_wait, | 1670 | prepare_to_wait(&port->delta_msr_wait, |
1673 | &wait, TASK_INTERRUPTIBLE); | 1671 | &wait, TASK_INTERRUPTIBLE); |
1674 | schedule(); | 1672 | schedule(); |
1675 | finish_wait(&edge_port->delta_msr_wait, &wait); | 1673 | finish_wait(&port->delta_msr_wait, &wait); |
1676 | /* see if a signal did it */ | 1674 | /* see if a signal did it */ |
1677 | if (signal_pending(current)) | 1675 | if (signal_pending(current)) |
1678 | return -ERESTARTSYS; | 1676 | return -ERESTARTSYS; |
1677 | |||
1678 | if (port->serial->disconnected) | ||
1679 | return -EIO; | ||
1680 | |||
1679 | cnow = edge_port->icount; | 1681 | cnow = edge_port->icount; |
1680 | if (cnow.rng == cprev.rng && cnow.dsr == cprev.dsr && | 1682 | if (cnow.rng == cprev.rng && cnow.dsr == cprev.dsr && |
1681 | cnow.dcd == cprev.dcd && cnow.cts == cprev.cts) | 1683 | cnow.dcd == cprev.dcd && cnow.cts == cprev.cts) |
@@ -2051,7 +2053,7 @@ static void handle_new_msr(struct edgeport_port *edge_port, __u8 newMsr) | |||
2051 | icount->dcd++; | 2053 | icount->dcd++; |
2052 | if (newMsr & EDGEPORT_MSR_DELTA_RI) | 2054 | if (newMsr & EDGEPORT_MSR_DELTA_RI) |
2053 | icount->rng++; | 2055 | icount->rng++; |
2054 | wake_up_interruptible(&edge_port->delta_msr_wait); | 2056 | wake_up_interruptible(&edge_port->port->delta_msr_wait); |
2055 | } | 2057 | } |
2056 | 2058 | ||
2057 | /* Save the new modem status */ | 2059 | /* Save the new modem status */ |
diff --git a/drivers/usb/serial/io_ti.c b/drivers/usb/serial/io_ti.c index c23776679f70..7777172206de 100644 --- a/drivers/usb/serial/io_ti.c +++ b/drivers/usb/serial/io_ti.c | |||
@@ -87,9 +87,6 @@ struct edgeport_port { | |||
87 | int close_pending; | 87 | int close_pending; |
88 | int lsr_event; | 88 | int lsr_event; |
89 | struct async_icount icount; | 89 | struct async_icount icount; |
90 | wait_queue_head_t delta_msr_wait; /* for handling sleeping while | ||
91 | waiting for msr change to | ||
92 | happen */ | ||
93 | struct edgeport_serial *edge_serial; | 90 | struct edgeport_serial *edge_serial; |
94 | struct usb_serial_port *port; | 91 | struct usb_serial_port *port; |
95 | __u8 bUartMode; /* Port type, 0: RS232, etc. */ | 92 | __u8 bUartMode; /* Port type, 0: RS232, etc. */ |
@@ -1459,7 +1456,7 @@ static void handle_new_msr(struct edgeport_port *edge_port, __u8 msr) | |||
1459 | icount->dcd++; | 1456 | icount->dcd++; |
1460 | if (msr & EDGEPORT_MSR_DELTA_RI) | 1457 | if (msr & EDGEPORT_MSR_DELTA_RI) |
1461 | icount->rng++; | 1458 | icount->rng++; |
1462 | wake_up_interruptible(&edge_port->delta_msr_wait); | 1459 | wake_up_interruptible(&edge_port->port->delta_msr_wait); |
1463 | } | 1460 | } |
1464 | 1461 | ||
1465 | /* Save the new modem status */ | 1462 | /* Save the new modem status */ |
@@ -1754,7 +1751,6 @@ static int edge_open(struct tty_struct *tty, struct usb_serial_port *port) | |||
1754 | dev = port->serial->dev; | 1751 | dev = port->serial->dev; |
1755 | 1752 | ||
1756 | memset(&(edge_port->icount), 0x00, sizeof(edge_port->icount)); | 1753 | memset(&(edge_port->icount), 0x00, sizeof(edge_port->icount)); |
1757 | init_waitqueue_head(&edge_port->delta_msr_wait); | ||
1758 | 1754 | ||
1759 | /* turn off loopback */ | 1755 | /* turn off loopback */ |
1760 | status = ti_do_config(edge_port, UMPC_SET_CLR_LOOPBACK, 0); | 1756 | status = ti_do_config(edge_port, UMPC_SET_CLR_LOOPBACK, 0); |
@@ -2434,10 +2430,14 @@ static int edge_ioctl(struct tty_struct *tty, | |||
2434 | dev_dbg(&port->dev, "%s - TIOCMIWAIT\n", __func__); | 2430 | dev_dbg(&port->dev, "%s - TIOCMIWAIT\n", __func__); |
2435 | cprev = edge_port->icount; | 2431 | cprev = edge_port->icount; |
2436 | while (1) { | 2432 | while (1) { |
2437 | interruptible_sleep_on(&edge_port->delta_msr_wait); | 2433 | interruptible_sleep_on(&port->delta_msr_wait); |
2438 | /* see if a signal did it */ | 2434 | /* see if a signal did it */ |
2439 | if (signal_pending(current)) | 2435 | if (signal_pending(current)) |
2440 | return -ERESTARTSYS; | 2436 | return -ERESTARTSYS; |
2437 | |||
2438 | if (port->serial->disconnected) | ||
2439 | return -EIO; | ||
2440 | |||
2441 | cnow = edge_port->icount; | 2441 | cnow = edge_port->icount; |
2442 | if (cnow.rng == cprev.rng && cnow.dsr == cprev.dsr && | 2442 | if (cnow.rng == cprev.rng && cnow.dsr == cprev.dsr && |
2443 | cnow.dcd == cprev.dcd && cnow.cts == cprev.cts) | 2443 | cnow.dcd == cprev.dcd && cnow.cts == cprev.cts) |
@@ -2649,6 +2649,7 @@ static struct usb_serial_driver edgeport_2port_device = { | |||
2649 | .set_termios = edge_set_termios, | 2649 | .set_termios = edge_set_termios, |
2650 | .tiocmget = edge_tiocmget, | 2650 | .tiocmget = edge_tiocmget, |
2651 | .tiocmset = edge_tiocmset, | 2651 | .tiocmset = edge_tiocmset, |
2652 | .get_icount = edge_get_icount, | ||
2652 | .write = edge_write, | 2653 | .write = edge_write, |
2653 | .write_room = edge_write_room, | 2654 | .write_room = edge_write_room, |
2654 | .chars_in_buffer = edge_chars_in_buffer, | 2655 | .chars_in_buffer = edge_chars_in_buffer, |
diff --git a/drivers/usb/serial/mct_u232.c b/drivers/usb/serial/mct_u232.c index a64d420f687b..06d5a60be2c4 100644 --- a/drivers/usb/serial/mct_u232.c +++ b/drivers/usb/serial/mct_u232.c | |||
@@ -114,8 +114,6 @@ struct mct_u232_private { | |||
114 | unsigned char last_msr; /* Modem Status Register */ | 114 | unsigned char last_msr; /* Modem Status Register */ |
115 | unsigned int rx_flags; /* Throttling flags */ | 115 | unsigned int rx_flags; /* Throttling flags */ |
116 | struct async_icount icount; | 116 | struct async_icount icount; |
117 | wait_queue_head_t msr_wait; /* for handling sleeping while waiting | ||
118 | for msr change to happen */ | ||
119 | }; | 117 | }; |
120 | 118 | ||
121 | #define THROTTLED 0x01 | 119 | #define THROTTLED 0x01 |
@@ -409,7 +407,6 @@ static int mct_u232_port_probe(struct usb_serial_port *port) | |||
409 | return -ENOMEM; | 407 | return -ENOMEM; |
410 | 408 | ||
411 | spin_lock_init(&priv->lock); | 409 | spin_lock_init(&priv->lock); |
412 | init_waitqueue_head(&priv->msr_wait); | ||
413 | 410 | ||
414 | usb_set_serial_port_data(port, priv); | 411 | usb_set_serial_port_data(port, priv); |
415 | 412 | ||
@@ -601,7 +598,7 @@ static void mct_u232_read_int_callback(struct urb *urb) | |||
601 | tty_kref_put(tty); | 598 | tty_kref_put(tty); |
602 | } | 599 | } |
603 | #endif | 600 | #endif |
604 | wake_up_interruptible(&priv->msr_wait); | 601 | wake_up_interruptible(&port->delta_msr_wait); |
605 | spin_unlock_irqrestore(&priv->lock, flags); | 602 | spin_unlock_irqrestore(&priv->lock, flags); |
606 | exit: | 603 | exit: |
607 | retval = usb_submit_urb(urb, GFP_ATOMIC); | 604 | retval = usb_submit_urb(urb, GFP_ATOMIC); |
@@ -810,13 +807,17 @@ static int mct_u232_ioctl(struct tty_struct *tty, | |||
810 | cprev = mct_u232_port->icount; | 807 | cprev = mct_u232_port->icount; |
811 | spin_unlock_irqrestore(&mct_u232_port->lock, flags); | 808 | spin_unlock_irqrestore(&mct_u232_port->lock, flags); |
812 | for ( ; ; ) { | 809 | for ( ; ; ) { |
813 | prepare_to_wait(&mct_u232_port->msr_wait, | 810 | prepare_to_wait(&port->delta_msr_wait, |
814 | &wait, TASK_INTERRUPTIBLE); | 811 | &wait, TASK_INTERRUPTIBLE); |
815 | schedule(); | 812 | schedule(); |
816 | finish_wait(&mct_u232_port->msr_wait, &wait); | 813 | finish_wait(&port->delta_msr_wait, &wait); |
817 | /* see if a signal did it */ | 814 | /* see if a signal did it */ |
818 | if (signal_pending(current)) | 815 | if (signal_pending(current)) |
819 | return -ERESTARTSYS; | 816 | return -ERESTARTSYS; |
817 | |||
818 | if (port->serial->disconnected) | ||
819 | return -EIO; | ||
820 | |||
820 | spin_lock_irqsave(&mct_u232_port->lock, flags); | 821 | spin_lock_irqsave(&mct_u232_port->lock, flags); |
821 | cnow = mct_u232_port->icount; | 822 | cnow = mct_u232_port->icount; |
822 | spin_unlock_irqrestore(&mct_u232_port->lock, flags); | 823 | spin_unlock_irqrestore(&mct_u232_port->lock, flags); |
diff --git a/drivers/usb/serial/mos7840.c b/drivers/usb/serial/mos7840.c index 809fb329eca5..b8051fa61911 100644 --- a/drivers/usb/serial/mos7840.c +++ b/drivers/usb/serial/mos7840.c | |||
@@ -219,7 +219,6 @@ struct moschip_port { | |||
219 | char open; | 219 | char open; |
220 | char open_ports; | 220 | char open_ports; |
221 | wait_queue_head_t wait_chase; /* for handling sleeping while waiting for chase to finish */ | 221 | wait_queue_head_t wait_chase; /* for handling sleeping while waiting for chase to finish */ |
222 | wait_queue_head_t delta_msr_wait; /* for handling sleeping while waiting for msr change to happen */ | ||
223 | int delta_msr_cond; | 222 | int delta_msr_cond; |
224 | struct async_icount icount; | 223 | struct async_icount icount; |
225 | struct usb_serial_port *port; /* loop back to the owner of this object */ | 224 | struct usb_serial_port *port; /* loop back to the owner of this object */ |
@@ -423,6 +422,9 @@ static void mos7840_handle_new_msr(struct moschip_port *port, __u8 new_msr) | |||
423 | icount->rng++; | 422 | icount->rng++; |
424 | smp_wmb(); | 423 | smp_wmb(); |
425 | } | 424 | } |
425 | |||
426 | mos7840_port->delta_msr_cond = 1; | ||
427 | wake_up_interruptible(&port->port->delta_msr_wait); | ||
426 | } | 428 | } |
427 | } | 429 | } |
428 | 430 | ||
@@ -1127,7 +1129,6 @@ static int mos7840_open(struct tty_struct *tty, struct usb_serial_port *port) | |||
1127 | 1129 | ||
1128 | /* initialize our wait queues */ | 1130 | /* initialize our wait queues */ |
1129 | init_waitqueue_head(&mos7840_port->wait_chase); | 1131 | init_waitqueue_head(&mos7840_port->wait_chase); |
1130 | init_waitqueue_head(&mos7840_port->delta_msr_wait); | ||
1131 | 1132 | ||
1132 | /* initialize our icount structure */ | 1133 | /* initialize our icount structure */ |
1133 | memset(&(mos7840_port->icount), 0x00, sizeof(mos7840_port->icount)); | 1134 | memset(&(mos7840_port->icount), 0x00, sizeof(mos7840_port->icount)); |
@@ -2017,8 +2018,6 @@ static void mos7840_change_port_settings(struct tty_struct *tty, | |||
2017 | mos7840_port->read_urb_busy = false; | 2018 | mos7840_port->read_urb_busy = false; |
2018 | } | 2019 | } |
2019 | } | 2020 | } |
2020 | wake_up(&mos7840_port->delta_msr_wait); | ||
2021 | mos7840_port->delta_msr_cond = 1; | ||
2022 | dev_dbg(&port->dev, "%s - mos7840_port->shadowLCR is End %x\n", __func__, | 2021 | dev_dbg(&port->dev, "%s - mos7840_port->shadowLCR is End %x\n", __func__, |
2023 | mos7840_port->shadowLCR); | 2022 | mos7840_port->shadowLCR); |
2024 | } | 2023 | } |
@@ -2219,13 +2218,18 @@ static int mos7840_ioctl(struct tty_struct *tty, | |||
2219 | while (1) { | 2218 | while (1) { |
2220 | /* interruptible_sleep_on(&mos7840_port->delta_msr_wait); */ | 2219 | /* interruptible_sleep_on(&mos7840_port->delta_msr_wait); */ |
2221 | mos7840_port->delta_msr_cond = 0; | 2220 | mos7840_port->delta_msr_cond = 0; |
2222 | wait_event_interruptible(mos7840_port->delta_msr_wait, | 2221 | wait_event_interruptible(port->delta_msr_wait, |
2223 | (mos7840_port-> | 2222 | (port->serial->disconnected || |
2223 | mos7840_port-> | ||
2224 | delta_msr_cond == 1)); | 2224 | delta_msr_cond == 1)); |
2225 | 2225 | ||
2226 | /* see if a signal did it */ | 2226 | /* see if a signal did it */ |
2227 | if (signal_pending(current)) | 2227 | if (signal_pending(current)) |
2228 | return -ERESTARTSYS; | 2228 | return -ERESTARTSYS; |
2229 | |||
2230 | if (port->serial->disconnected) | ||
2231 | return -EIO; | ||
2232 | |||
2229 | cnow = mos7840_port->icount; | 2233 | cnow = mos7840_port->icount; |
2230 | smp_rmb(); | 2234 | smp_rmb(); |
2231 | if (cnow.rng == cprev.rng && cnow.dsr == cprev.dsr && | 2235 | if (cnow.rng == cprev.rng && cnow.dsr == cprev.dsr && |
diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c index f7d339d8187b..558adfc05007 100644 --- a/drivers/usb/serial/option.c +++ b/drivers/usb/serial/option.c | |||
@@ -341,6 +341,8 @@ static void option_instat_callback(struct urb *urb); | |||
341 | #define CINTERION_PRODUCT_EU3_E 0x0051 | 341 | #define CINTERION_PRODUCT_EU3_E 0x0051 |
342 | #define CINTERION_PRODUCT_EU3_P 0x0052 | 342 | #define CINTERION_PRODUCT_EU3_P 0x0052 |
343 | #define CINTERION_PRODUCT_PH8 0x0053 | 343 | #define CINTERION_PRODUCT_PH8 0x0053 |
344 | #define CINTERION_PRODUCT_AH6 0x0055 | ||
345 | #define CINTERION_PRODUCT_PLS8 0x0060 | ||
344 | 346 | ||
345 | /* Olivetti products */ | 347 | /* Olivetti products */ |
346 | #define OLIVETTI_VENDOR_ID 0x0b3c | 348 | #define OLIVETTI_VENDOR_ID 0x0b3c |
@@ -579,6 +581,7 @@ static const struct usb_device_id option_ids[] = { | |||
579 | { USB_DEVICE(QUANTA_VENDOR_ID, 0xea42), | 581 | { USB_DEVICE(QUANTA_VENDOR_ID, 0xea42), |
580 | .driver_info = (kernel_ulong_t)&net_intf4_blacklist }, | 582 | .driver_info = (kernel_ulong_t)&net_intf4_blacklist }, |
581 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0x1c05, USB_CLASS_COMM, 0x02, 0xff) }, | 583 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0x1c05, USB_CLASS_COMM, 0x02, 0xff) }, |
584 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0x1c1f, USB_CLASS_COMM, 0x02, 0xff) }, | ||
582 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0x1c23, USB_CLASS_COMM, 0x02, 0xff) }, | 585 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0x1c23, USB_CLASS_COMM, 0x02, 0xff) }, |
583 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E173, 0xff, 0xff, 0xff), | 586 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E173, 0xff, 0xff, 0xff), |
584 | .driver_info = (kernel_ulong_t) &net_intf1_blacklist }, | 587 | .driver_info = (kernel_ulong_t) &net_intf1_blacklist }, |
@@ -1260,6 +1263,8 @@ static const struct usb_device_id option_ids[] = { | |||
1260 | { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_EU3_E) }, | 1263 | { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_EU3_E) }, |
1261 | { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_EU3_P) }, | 1264 | { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_EU3_P) }, |
1262 | { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_PH8) }, | 1265 | { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_PH8) }, |
1266 | { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_AH6) }, | ||
1267 | { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_PLS8) }, | ||
1263 | { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_HC28_MDM) }, | 1268 | { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_HC28_MDM) }, |
1264 | { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_HC28_MDMNET) }, | 1269 | { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_HC28_MDMNET) }, |
1265 | { USB_DEVICE(SIEMENS_VENDOR_ID, CINTERION_PRODUCT_HC25_MDM) }, | 1270 | { USB_DEVICE(SIEMENS_VENDOR_ID, CINTERION_PRODUCT_HC25_MDM) }, |
diff --git a/drivers/usb/serial/oti6858.c b/drivers/usb/serial/oti6858.c index a958fd41b5b3..87c71ccfee87 100644 --- a/drivers/usb/serial/oti6858.c +++ b/drivers/usb/serial/oti6858.c | |||
@@ -188,7 +188,6 @@ struct oti6858_private { | |||
188 | u8 setup_done; | 188 | u8 setup_done; |
189 | struct delayed_work delayed_setup_work; | 189 | struct delayed_work delayed_setup_work; |
190 | 190 | ||
191 | wait_queue_head_t intr_wait; | ||
192 | struct usb_serial_port *port; /* USB port with which associated */ | 191 | struct usb_serial_port *port; /* USB port with which associated */ |
193 | }; | 192 | }; |
194 | 193 | ||
@@ -339,7 +338,6 @@ static int oti6858_port_probe(struct usb_serial_port *port) | |||
339 | return -ENOMEM; | 338 | return -ENOMEM; |
340 | 339 | ||
341 | spin_lock_init(&priv->lock); | 340 | spin_lock_init(&priv->lock); |
342 | init_waitqueue_head(&priv->intr_wait); | ||
343 | priv->port = port; | 341 | priv->port = port; |
344 | INIT_DELAYED_WORK(&priv->delayed_setup_work, setup_line); | 342 | INIT_DELAYED_WORK(&priv->delayed_setup_work, setup_line); |
345 | INIT_DELAYED_WORK(&priv->delayed_write_work, send_data); | 343 | INIT_DELAYED_WORK(&priv->delayed_write_work, send_data); |
@@ -664,11 +662,15 @@ static int wait_modem_info(struct usb_serial_port *port, unsigned int arg) | |||
664 | spin_unlock_irqrestore(&priv->lock, flags); | 662 | spin_unlock_irqrestore(&priv->lock, flags); |
665 | 663 | ||
666 | while (1) { | 664 | while (1) { |
667 | wait_event_interruptible(priv->intr_wait, | 665 | wait_event_interruptible(port->delta_msr_wait, |
666 | port->serial->disconnected || | ||
668 | priv->status.pin_state != prev); | 667 | priv->status.pin_state != prev); |
669 | if (signal_pending(current)) | 668 | if (signal_pending(current)) |
670 | return -ERESTARTSYS; | 669 | return -ERESTARTSYS; |
671 | 670 | ||
671 | if (port->serial->disconnected) | ||
672 | return -EIO; | ||
673 | |||
672 | spin_lock_irqsave(&priv->lock, flags); | 674 | spin_lock_irqsave(&priv->lock, flags); |
673 | status = priv->status.pin_state & PIN_MASK; | 675 | status = priv->status.pin_state & PIN_MASK; |
674 | spin_unlock_irqrestore(&priv->lock, flags); | 676 | spin_unlock_irqrestore(&priv->lock, flags); |
@@ -763,7 +765,7 @@ static void oti6858_read_int_callback(struct urb *urb) | |||
763 | 765 | ||
764 | if (!priv->transient) { | 766 | if (!priv->transient) { |
765 | if (xs->pin_state != priv->status.pin_state) | 767 | if (xs->pin_state != priv->status.pin_state) |
766 | wake_up_interruptible(&priv->intr_wait); | 768 | wake_up_interruptible(&port->delta_msr_wait); |
767 | memcpy(&priv->status, xs, OTI6858_CTRL_PKT_SIZE); | 769 | memcpy(&priv->status, xs, OTI6858_CTRL_PKT_SIZE); |
768 | } | 770 | } |
769 | 771 | ||
diff --git a/drivers/usb/serial/pl2303.c b/drivers/usb/serial/pl2303.c index 54adc9125e5c..3b10018d89a3 100644 --- a/drivers/usb/serial/pl2303.c +++ b/drivers/usb/serial/pl2303.c | |||
@@ -139,7 +139,6 @@ struct pl2303_serial_private { | |||
139 | 139 | ||
140 | struct pl2303_private { | 140 | struct pl2303_private { |
141 | spinlock_t lock; | 141 | spinlock_t lock; |
142 | wait_queue_head_t delta_msr_wait; | ||
143 | u8 line_control; | 142 | u8 line_control; |
144 | u8 line_status; | 143 | u8 line_status; |
145 | }; | 144 | }; |
@@ -233,7 +232,6 @@ static int pl2303_port_probe(struct usb_serial_port *port) | |||
233 | return -ENOMEM; | 232 | return -ENOMEM; |
234 | 233 | ||
235 | spin_lock_init(&priv->lock); | 234 | spin_lock_init(&priv->lock); |
236 | init_waitqueue_head(&priv->delta_msr_wait); | ||
237 | 235 | ||
238 | usb_set_serial_port_data(port, priv); | 236 | usb_set_serial_port_data(port, priv); |
239 | 237 | ||
@@ -607,11 +605,14 @@ static int wait_modem_info(struct usb_serial_port *port, unsigned int arg) | |||
607 | spin_unlock_irqrestore(&priv->lock, flags); | 605 | spin_unlock_irqrestore(&priv->lock, flags); |
608 | 606 | ||
609 | while (1) { | 607 | while (1) { |
610 | interruptible_sleep_on(&priv->delta_msr_wait); | 608 | interruptible_sleep_on(&port->delta_msr_wait); |
611 | /* see if a signal did it */ | 609 | /* see if a signal did it */ |
612 | if (signal_pending(current)) | 610 | if (signal_pending(current)) |
613 | return -ERESTARTSYS; | 611 | return -ERESTARTSYS; |
614 | 612 | ||
613 | if (port->serial->disconnected) | ||
614 | return -EIO; | ||
615 | |||
615 | spin_lock_irqsave(&priv->lock, flags); | 616 | spin_lock_irqsave(&priv->lock, flags); |
616 | status = priv->line_status; | 617 | status = priv->line_status; |
617 | spin_unlock_irqrestore(&priv->lock, flags); | 618 | spin_unlock_irqrestore(&priv->lock, flags); |
@@ -719,7 +720,7 @@ static void pl2303_update_line_status(struct usb_serial_port *port, | |||
719 | spin_unlock_irqrestore(&priv->lock, flags); | 720 | spin_unlock_irqrestore(&priv->lock, flags); |
720 | if (priv->line_status & UART_BREAK_ERROR) | 721 | if (priv->line_status & UART_BREAK_ERROR) |
721 | usb_serial_handle_break(port); | 722 | usb_serial_handle_break(port); |
722 | wake_up_interruptible(&priv->delta_msr_wait); | 723 | wake_up_interruptible(&port->delta_msr_wait); |
723 | 724 | ||
724 | tty = tty_port_tty_get(&port->port); | 725 | tty = tty_port_tty_get(&port->port); |
725 | if (!tty) | 726 | if (!tty) |
@@ -783,7 +784,7 @@ static void pl2303_process_read_urb(struct urb *urb) | |||
783 | line_status = priv->line_status; | 784 | line_status = priv->line_status; |
784 | priv->line_status &= ~UART_STATE_TRANSIENT_MASK; | 785 | priv->line_status &= ~UART_STATE_TRANSIENT_MASK; |
785 | spin_unlock_irqrestore(&priv->lock, flags); | 786 | spin_unlock_irqrestore(&priv->lock, flags); |
786 | wake_up_interruptible(&priv->delta_msr_wait); | 787 | wake_up_interruptible(&port->delta_msr_wait); |
787 | 788 | ||
788 | if (!urb->actual_length) | 789 | if (!urb->actual_length) |
789 | return; | 790 | return; |
diff --git a/drivers/usb/serial/qcaux.c b/drivers/usb/serial/qcaux.c index 9b1b96f2d095..31f81c3c15eb 100644 --- a/drivers/usb/serial/qcaux.c +++ b/drivers/usb/serial/qcaux.c | |||
@@ -69,6 +69,7 @@ static struct usb_device_id id_table[] = { | |||
69 | { USB_VENDOR_AND_INTERFACE_INFO(UTSTARCOM_VENDOR_ID, 0xff, 0xfd, 0xff) }, /* NMEA */ | 69 | { USB_VENDOR_AND_INTERFACE_INFO(UTSTARCOM_VENDOR_ID, 0xff, 0xfd, 0xff) }, /* NMEA */ |
70 | { USB_VENDOR_AND_INTERFACE_INFO(UTSTARCOM_VENDOR_ID, 0xff, 0xfe, 0xff) }, /* WMC */ | 70 | { USB_VENDOR_AND_INTERFACE_INFO(UTSTARCOM_VENDOR_ID, 0xff, 0xfe, 0xff) }, /* WMC */ |
71 | { USB_VENDOR_AND_INTERFACE_INFO(UTSTARCOM_VENDOR_ID, 0xff, 0xff, 0xff) }, /* DIAG */ | 71 | { USB_VENDOR_AND_INTERFACE_INFO(UTSTARCOM_VENDOR_ID, 0xff, 0xff, 0xff) }, /* DIAG */ |
72 | { USB_DEVICE_AND_INTERFACE_INFO(0x1fac, 0x0151, 0xff, 0xff, 0xff) }, | ||
72 | { }, | 73 | { }, |
73 | }; | 74 | }; |
74 | MODULE_DEVICE_TABLE(usb, id_table); | 75 | MODULE_DEVICE_TABLE(usb, id_table); |
diff --git a/drivers/usb/serial/qcserial.c b/drivers/usb/serial/qcserial.c index 24662547dc5b..59b32b782126 100644 --- a/drivers/usb/serial/qcserial.c +++ b/drivers/usb/serial/qcserial.c | |||
@@ -197,12 +197,15 @@ static int qcprobe(struct usb_serial *serial, const struct usb_device_id *id) | |||
197 | 197 | ||
198 | if (is_gobi1k) { | 198 | if (is_gobi1k) { |
199 | /* Gobi 1K USB layout: | 199 | /* Gobi 1K USB layout: |
200 | * 0: serial port (doesn't respond) | 200 | * 0: DM/DIAG (use libqcdm from ModemManager for communication) |
201 | * 1: serial port (doesn't respond) | 201 | * 1: serial port (doesn't respond) |
202 | * 2: AT-capable modem port | 202 | * 2: AT-capable modem port |
203 | * 3: QMI/net | 203 | * 3: QMI/net |
204 | */ | 204 | */ |
205 | if (ifnum == 2) | 205 | if (ifnum == 0) { |
206 | dev_dbg(dev, "Gobi 1K DM/DIAG interface found\n"); | ||
207 | altsetting = 1; | ||
208 | } else if (ifnum == 2) | ||
206 | dev_dbg(dev, "Modem port found\n"); | 209 | dev_dbg(dev, "Modem port found\n"); |
207 | else | 210 | else |
208 | altsetting = -1; | 211 | altsetting = -1; |
diff --git a/drivers/usb/serial/quatech2.c b/drivers/usb/serial/quatech2.c index 00e6c9bac8a3..75f125ddb0c9 100644 --- a/drivers/usb/serial/quatech2.c +++ b/drivers/usb/serial/quatech2.c | |||
@@ -128,7 +128,6 @@ struct qt2_port_private { | |||
128 | u8 shadowLSR; | 128 | u8 shadowLSR; |
129 | u8 shadowMSR; | 129 | u8 shadowMSR; |
130 | 130 | ||
131 | wait_queue_head_t delta_msr_wait; /* Used for TIOCMIWAIT */ | ||
132 | struct async_icount icount; | 131 | struct async_icount icount; |
133 | 132 | ||
134 | struct usb_serial_port *port; | 133 | struct usb_serial_port *port; |
@@ -506,8 +505,9 @@ static int wait_modem_info(struct usb_serial_port *port, unsigned int arg) | |||
506 | spin_unlock_irqrestore(&priv->lock, flags); | 505 | spin_unlock_irqrestore(&priv->lock, flags); |
507 | 506 | ||
508 | while (1) { | 507 | while (1) { |
509 | wait_event_interruptible(priv->delta_msr_wait, | 508 | wait_event_interruptible(port->delta_msr_wait, |
510 | ((priv->icount.rng != prev.rng) || | 509 | (port->serial->disconnected || |
510 | (priv->icount.rng != prev.rng) || | ||
511 | (priv->icount.dsr != prev.dsr) || | 511 | (priv->icount.dsr != prev.dsr) || |
512 | (priv->icount.dcd != prev.dcd) || | 512 | (priv->icount.dcd != prev.dcd) || |
513 | (priv->icount.cts != prev.cts))); | 513 | (priv->icount.cts != prev.cts))); |
@@ -515,6 +515,9 @@ static int wait_modem_info(struct usb_serial_port *port, unsigned int arg) | |||
515 | if (signal_pending(current)) | 515 | if (signal_pending(current)) |
516 | return -ERESTARTSYS; | 516 | return -ERESTARTSYS; |
517 | 517 | ||
518 | if (port->serial->disconnected) | ||
519 | return -EIO; | ||
520 | |||
518 | spin_lock_irqsave(&priv->lock, flags); | 521 | spin_lock_irqsave(&priv->lock, flags); |
519 | cur = priv->icount; | 522 | cur = priv->icount; |
520 | spin_unlock_irqrestore(&priv->lock, flags); | 523 | spin_unlock_irqrestore(&priv->lock, flags); |
@@ -661,7 +664,9 @@ void qt2_process_read_urb(struct urb *urb) | |||
661 | __func__); | 664 | __func__); |
662 | break; | 665 | break; |
663 | } | 666 | } |
664 | tty_flip_buffer_push(&port->port); | 667 | |
668 | if (port_priv->is_open) | ||
669 | tty_flip_buffer_push(&port->port); | ||
665 | 670 | ||
666 | newport = *(ch + 3); | 671 | newport = *(ch + 3); |
667 | 672 | ||
@@ -704,7 +709,8 @@ void qt2_process_read_urb(struct urb *urb) | |||
704 | tty_insert_flip_string(&port->port, ch, 1); | 709 | tty_insert_flip_string(&port->port, ch, 1); |
705 | } | 710 | } |
706 | 711 | ||
707 | tty_flip_buffer_push(&port->port); | 712 | if (port_priv->is_open) |
713 | tty_flip_buffer_push(&port->port); | ||
708 | } | 714 | } |
709 | 715 | ||
710 | static void qt2_write_bulk_callback(struct urb *urb) | 716 | static void qt2_write_bulk_callback(struct urb *urb) |
@@ -824,7 +830,6 @@ static int qt2_port_probe(struct usb_serial_port *port) | |||
824 | 830 | ||
825 | spin_lock_init(&port_priv->lock); | 831 | spin_lock_init(&port_priv->lock); |
826 | spin_lock_init(&port_priv->urb_lock); | 832 | spin_lock_init(&port_priv->urb_lock); |
827 | init_waitqueue_head(&port_priv->delta_msr_wait); | ||
828 | port_priv->port = port; | 833 | port_priv->port = port; |
829 | 834 | ||
830 | port_priv->write_urb = usb_alloc_urb(0, GFP_KERNEL); | 835 | port_priv->write_urb = usb_alloc_urb(0, GFP_KERNEL); |
@@ -967,7 +972,7 @@ static void qt2_update_msr(struct usb_serial_port *port, unsigned char *ch) | |||
967 | if (newMSR & UART_MSR_TERI) | 972 | if (newMSR & UART_MSR_TERI) |
968 | port_priv->icount.rng++; | 973 | port_priv->icount.rng++; |
969 | 974 | ||
970 | wake_up_interruptible(&port_priv->delta_msr_wait); | 975 | wake_up_interruptible(&port->delta_msr_wait); |
971 | } | 976 | } |
972 | } | 977 | } |
973 | 978 | ||
diff --git a/drivers/usb/serial/spcp8x5.c b/drivers/usb/serial/spcp8x5.c index 91ff8e3bddbd..549ef68ff5fa 100644 --- a/drivers/usb/serial/spcp8x5.c +++ b/drivers/usb/serial/spcp8x5.c | |||
@@ -149,7 +149,6 @@ enum spcp8x5_type { | |||
149 | struct spcp8x5_private { | 149 | struct spcp8x5_private { |
150 | spinlock_t lock; | 150 | spinlock_t lock; |
151 | enum spcp8x5_type type; | 151 | enum spcp8x5_type type; |
152 | wait_queue_head_t delta_msr_wait; | ||
153 | u8 line_control; | 152 | u8 line_control; |
154 | u8 line_status; | 153 | u8 line_status; |
155 | }; | 154 | }; |
@@ -179,7 +178,6 @@ static int spcp8x5_port_probe(struct usb_serial_port *port) | |||
179 | return -ENOMEM; | 178 | return -ENOMEM; |
180 | 179 | ||
181 | spin_lock_init(&priv->lock); | 180 | spin_lock_init(&priv->lock); |
182 | init_waitqueue_head(&priv->delta_msr_wait); | ||
183 | priv->type = type; | 181 | priv->type = type; |
184 | 182 | ||
185 | usb_set_serial_port_data(port , priv); | 183 | usb_set_serial_port_data(port , priv); |
@@ -475,7 +473,7 @@ static void spcp8x5_process_read_urb(struct urb *urb) | |||
475 | priv->line_status &= ~UART_STATE_TRANSIENT_MASK; | 473 | priv->line_status &= ~UART_STATE_TRANSIENT_MASK; |
476 | spin_unlock_irqrestore(&priv->lock, flags); | 474 | spin_unlock_irqrestore(&priv->lock, flags); |
477 | /* wake up the wait for termios */ | 475 | /* wake up the wait for termios */ |
478 | wake_up_interruptible(&priv->delta_msr_wait); | 476 | wake_up_interruptible(&port->delta_msr_wait); |
479 | 477 | ||
480 | if (!urb->actual_length) | 478 | if (!urb->actual_length) |
481 | return; | 479 | return; |
@@ -526,12 +524,15 @@ static int spcp8x5_wait_modem_info(struct usb_serial_port *port, | |||
526 | 524 | ||
527 | while (1) { | 525 | while (1) { |
528 | /* wake up in bulk read */ | 526 | /* wake up in bulk read */ |
529 | interruptible_sleep_on(&priv->delta_msr_wait); | 527 | interruptible_sleep_on(&port->delta_msr_wait); |
530 | 528 | ||
531 | /* see if a signal did it */ | 529 | /* see if a signal did it */ |
532 | if (signal_pending(current)) | 530 | if (signal_pending(current)) |
533 | return -ERESTARTSYS; | 531 | return -ERESTARTSYS; |
534 | 532 | ||
533 | if (port->serial->disconnected) | ||
534 | return -EIO; | ||
535 | |||
535 | spin_lock_irqsave(&priv->lock, flags); | 536 | spin_lock_irqsave(&priv->lock, flags); |
536 | status = priv->line_status; | 537 | status = priv->line_status; |
537 | spin_unlock_irqrestore(&priv->lock, flags); | 538 | spin_unlock_irqrestore(&priv->lock, flags); |
diff --git a/drivers/usb/serial/ssu100.c b/drivers/usb/serial/ssu100.c index b57cf841c5b6..4b2a19757b4d 100644 --- a/drivers/usb/serial/ssu100.c +++ b/drivers/usb/serial/ssu100.c | |||
@@ -61,7 +61,6 @@ struct ssu100_port_private { | |||
61 | spinlock_t status_lock; | 61 | spinlock_t status_lock; |
62 | u8 shadowLSR; | 62 | u8 shadowLSR; |
63 | u8 shadowMSR; | 63 | u8 shadowMSR; |
64 | wait_queue_head_t delta_msr_wait; /* Used for TIOCMIWAIT */ | ||
65 | struct async_icount icount; | 64 | struct async_icount icount; |
66 | }; | 65 | }; |
67 | 66 | ||
@@ -355,8 +354,9 @@ static int wait_modem_info(struct usb_serial_port *port, unsigned int arg) | |||
355 | spin_unlock_irqrestore(&priv->status_lock, flags); | 354 | spin_unlock_irqrestore(&priv->status_lock, flags); |
356 | 355 | ||
357 | while (1) { | 356 | while (1) { |
358 | wait_event_interruptible(priv->delta_msr_wait, | 357 | wait_event_interruptible(port->delta_msr_wait, |
359 | ((priv->icount.rng != prev.rng) || | 358 | (port->serial->disconnected || |
359 | (priv->icount.rng != prev.rng) || | ||
360 | (priv->icount.dsr != prev.dsr) || | 360 | (priv->icount.dsr != prev.dsr) || |
361 | (priv->icount.dcd != prev.dcd) || | 361 | (priv->icount.dcd != prev.dcd) || |
362 | (priv->icount.cts != prev.cts))); | 362 | (priv->icount.cts != prev.cts))); |
@@ -364,6 +364,9 @@ static int wait_modem_info(struct usb_serial_port *port, unsigned int arg) | |||
364 | if (signal_pending(current)) | 364 | if (signal_pending(current)) |
365 | return -ERESTARTSYS; | 365 | return -ERESTARTSYS; |
366 | 366 | ||
367 | if (port->serial->disconnected) | ||
368 | return -EIO; | ||
369 | |||
367 | spin_lock_irqsave(&priv->status_lock, flags); | 370 | spin_lock_irqsave(&priv->status_lock, flags); |
368 | cur = priv->icount; | 371 | cur = priv->icount; |
369 | spin_unlock_irqrestore(&priv->status_lock, flags); | 372 | spin_unlock_irqrestore(&priv->status_lock, flags); |
@@ -445,7 +448,6 @@ static int ssu100_port_probe(struct usb_serial_port *port) | |||
445 | return -ENOMEM; | 448 | return -ENOMEM; |
446 | 449 | ||
447 | spin_lock_init(&priv->status_lock); | 450 | spin_lock_init(&priv->status_lock); |
448 | init_waitqueue_head(&priv->delta_msr_wait); | ||
449 | 451 | ||
450 | usb_set_serial_port_data(port, priv); | 452 | usb_set_serial_port_data(port, priv); |
451 | 453 | ||
@@ -537,7 +539,7 @@ static void ssu100_update_msr(struct usb_serial_port *port, u8 msr) | |||
537 | priv->icount.dcd++; | 539 | priv->icount.dcd++; |
538 | if (msr & UART_MSR_TERI) | 540 | if (msr & UART_MSR_TERI) |
539 | priv->icount.rng++; | 541 | priv->icount.rng++; |
540 | wake_up_interruptible(&priv->delta_msr_wait); | 542 | wake_up_interruptible(&port->delta_msr_wait); |
541 | } | 543 | } |
542 | } | 544 | } |
543 | 545 | ||
diff --git a/drivers/usb/serial/ti_usb_3410_5052.c b/drivers/usb/serial/ti_usb_3410_5052.c index 39cb9b807c3c..73deb029fc05 100644 --- a/drivers/usb/serial/ti_usb_3410_5052.c +++ b/drivers/usb/serial/ti_usb_3410_5052.c | |||
@@ -74,7 +74,6 @@ struct ti_port { | |||
74 | int tp_flags; | 74 | int tp_flags; |
75 | int tp_closing_wait;/* in .01 secs */ | 75 | int tp_closing_wait;/* in .01 secs */ |
76 | struct async_icount tp_icount; | 76 | struct async_icount tp_icount; |
77 | wait_queue_head_t tp_msr_wait; /* wait for msr change */ | ||
78 | wait_queue_head_t tp_write_wait; | 77 | wait_queue_head_t tp_write_wait; |
79 | struct ti_device *tp_tdev; | 78 | struct ti_device *tp_tdev; |
80 | struct usb_serial_port *tp_port; | 79 | struct usb_serial_port *tp_port; |
@@ -432,7 +431,6 @@ static int ti_port_probe(struct usb_serial_port *port) | |||
432 | else | 431 | else |
433 | tport->tp_uart_base_addr = TI_UART2_BASE_ADDR; | 432 | tport->tp_uart_base_addr = TI_UART2_BASE_ADDR; |
434 | tport->tp_closing_wait = closing_wait; | 433 | tport->tp_closing_wait = closing_wait; |
435 | init_waitqueue_head(&tport->tp_msr_wait); | ||
436 | init_waitqueue_head(&tport->tp_write_wait); | 434 | init_waitqueue_head(&tport->tp_write_wait); |
437 | if (kfifo_alloc(&tport->write_fifo, TI_WRITE_BUF_SIZE, GFP_KERNEL)) { | 435 | if (kfifo_alloc(&tport->write_fifo, TI_WRITE_BUF_SIZE, GFP_KERNEL)) { |
438 | kfree(tport); | 436 | kfree(tport); |
@@ -784,9 +782,13 @@ static int ti_ioctl(struct tty_struct *tty, | |||
784 | dev_dbg(&port->dev, "%s - TIOCMIWAIT\n", __func__); | 782 | dev_dbg(&port->dev, "%s - TIOCMIWAIT\n", __func__); |
785 | cprev = tport->tp_icount; | 783 | cprev = tport->tp_icount; |
786 | while (1) { | 784 | while (1) { |
787 | interruptible_sleep_on(&tport->tp_msr_wait); | 785 | interruptible_sleep_on(&port->delta_msr_wait); |
788 | if (signal_pending(current)) | 786 | if (signal_pending(current)) |
789 | return -ERESTARTSYS; | 787 | return -ERESTARTSYS; |
788 | |||
789 | if (port->serial->disconnected) | ||
790 | return -EIO; | ||
791 | |||
790 | cnow = tport->tp_icount; | 792 | cnow = tport->tp_icount; |
791 | if (cnow.rng == cprev.rng && cnow.dsr == cprev.dsr && | 793 | if (cnow.rng == cprev.rng && cnow.dsr == cprev.dsr && |
792 | cnow.dcd == cprev.dcd && cnow.cts == cprev.cts) | 794 | cnow.dcd == cprev.dcd && cnow.cts == cprev.cts) |
@@ -1392,7 +1394,7 @@ static void ti_handle_new_msr(struct ti_port *tport, __u8 msr) | |||
1392 | icount->dcd++; | 1394 | icount->dcd++; |
1393 | if (msr & TI_MSR_DELTA_RI) | 1395 | if (msr & TI_MSR_DELTA_RI) |
1394 | icount->rng++; | 1396 | icount->rng++; |
1395 | wake_up_interruptible(&tport->tp_msr_wait); | 1397 | wake_up_interruptible(&tport->tp_port->delta_msr_wait); |
1396 | spin_unlock_irqrestore(&tport->tp_lock, flags); | 1398 | spin_unlock_irqrestore(&tport->tp_lock, flags); |
1397 | } | 1399 | } |
1398 | 1400 | ||
diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c index a19ed74d770d..2e70efa08b77 100644 --- a/drivers/usb/serial/usb-serial.c +++ b/drivers/usb/serial/usb-serial.c | |||
@@ -151,6 +151,7 @@ static void destroy_serial(struct kref *kref) | |||
151 | } | 151 | } |
152 | } | 152 | } |
153 | 153 | ||
154 | usb_put_intf(serial->interface); | ||
154 | usb_put_dev(serial->dev); | 155 | usb_put_dev(serial->dev); |
155 | kfree(serial); | 156 | kfree(serial); |
156 | } | 157 | } |
@@ -620,7 +621,7 @@ static struct usb_serial *create_serial(struct usb_device *dev, | |||
620 | } | 621 | } |
621 | serial->dev = usb_get_dev(dev); | 622 | serial->dev = usb_get_dev(dev); |
622 | serial->type = driver; | 623 | serial->type = driver; |
623 | serial->interface = interface; | 624 | serial->interface = usb_get_intf(interface); |
624 | kref_init(&serial->kref); | 625 | kref_init(&serial->kref); |
625 | mutex_init(&serial->disc_mutex); | 626 | mutex_init(&serial->disc_mutex); |
626 | serial->minor = SERIAL_TTY_NO_MINOR; | 627 | serial->minor = SERIAL_TTY_NO_MINOR; |
diff --git a/drivers/usb/storage/initializers.c b/drivers/usb/storage/initializers.c index 7ab9046ae0ec..105d900150c1 100644 --- a/drivers/usb/storage/initializers.c +++ b/drivers/usb/storage/initializers.c | |||
@@ -92,8 +92,8 @@ int usb_stor_ucr61s2b_init(struct us_data *us) | |||
92 | return 0; | 92 | return 0; |
93 | } | 93 | } |
94 | 94 | ||
95 | /* This places the HUAWEI usb dongles in multi-port mode */ | 95 | /* This places the HUAWEI E220 devices in multi-port mode */ |
96 | static int usb_stor_huawei_feature_init(struct us_data *us) | 96 | int usb_stor_huawei_e220_init(struct us_data *us) |
97 | { | 97 | { |
98 | int result; | 98 | int result; |
99 | 99 | ||
@@ -104,75 +104,3 @@ static int usb_stor_huawei_feature_init(struct us_data *us) | |||
104 | US_DEBUGP("Huawei mode set result is %d\n", result); | 104 | US_DEBUGP("Huawei mode set result is %d\n", result); |
105 | return 0; | 105 | return 0; |
106 | } | 106 | } |
107 | |||
108 | /* | ||
109 | * It will send a scsi switch command called rewind' to huawei dongle. | ||
110 | * When the dongle receives this command at the first time, | ||
111 | * it will reboot immediately. After rebooted, it will ignore this command. | ||
112 | * So it is unnecessary to read its response. | ||
113 | */ | ||
114 | static int usb_stor_huawei_scsi_init(struct us_data *us) | ||
115 | { | ||
116 | int result = 0; | ||
117 | int act_len = 0; | ||
118 | struct bulk_cb_wrap *bcbw = (struct bulk_cb_wrap *) us->iobuf; | ||
119 | char rewind_cmd[] = {0x11, 0x06, 0x20, 0x00, 0x00, 0x01, 0x01, 0x00, | ||
120 | 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; | ||
121 | |||
122 | bcbw->Signature = cpu_to_le32(US_BULK_CB_SIGN); | ||
123 | bcbw->Tag = 0; | ||
124 | bcbw->DataTransferLength = 0; | ||
125 | bcbw->Flags = bcbw->Lun = 0; | ||
126 | bcbw->Length = sizeof(rewind_cmd); | ||
127 | memset(bcbw->CDB, 0, sizeof(bcbw->CDB)); | ||
128 | memcpy(bcbw->CDB, rewind_cmd, sizeof(rewind_cmd)); | ||
129 | |||
130 | result = usb_stor_bulk_transfer_buf(us, us->send_bulk_pipe, bcbw, | ||
131 | US_BULK_CB_WRAP_LEN, &act_len); | ||
132 | US_DEBUGP("transfer actual length=%d, result=%d\n", act_len, result); | ||
133 | return result; | ||
134 | } | ||
135 | |||
136 | /* | ||
137 | * It tries to find the supported Huawei USB dongles. | ||
138 | * In Huawei, they assign the following product IDs | ||
139 | * for all of their mobile broadband dongles, | ||
140 | * including the new dongles in the future. | ||
141 | * So if the product ID is not included in this list, | ||
142 | * it means it is not Huawei's mobile broadband dongles. | ||
143 | */ | ||
144 | static int usb_stor_huawei_dongles_pid(struct us_data *us) | ||
145 | { | ||
146 | struct usb_interface_descriptor *idesc; | ||
147 | int idProduct; | ||
148 | |||
149 | idesc = &us->pusb_intf->cur_altsetting->desc; | ||
150 | idProduct = le16_to_cpu(us->pusb_dev->descriptor.idProduct); | ||
151 | /* The first port is CDROM, | ||
152 | * means the dongle in the single port mode, | ||
153 | * and a switch command is required to be sent. */ | ||
154 | if (idesc && idesc->bInterfaceNumber == 0) { | ||
155 | if ((idProduct == 0x1001) | ||
156 | || (idProduct == 0x1003) | ||
157 | || (idProduct == 0x1004) | ||
158 | || (idProduct >= 0x1401 && idProduct <= 0x1500) | ||
159 | || (idProduct >= 0x1505 && idProduct <= 0x1600) | ||
160 | || (idProduct >= 0x1c02 && idProduct <= 0x2202)) { | ||
161 | return 1; | ||
162 | } | ||
163 | } | ||
164 | return 0; | ||
165 | } | ||
166 | |||
167 | int usb_stor_huawei_init(struct us_data *us) | ||
168 | { | ||
169 | int result = 0; | ||
170 | |||
171 | if (usb_stor_huawei_dongles_pid(us)) { | ||
172 | if (le16_to_cpu(us->pusb_dev->descriptor.idProduct) >= 0x1446) | ||
173 | result = usb_stor_huawei_scsi_init(us); | ||
174 | else | ||
175 | result = usb_stor_huawei_feature_init(us); | ||
176 | } | ||
177 | return result; | ||
178 | } | ||
diff --git a/drivers/usb/storage/initializers.h b/drivers/usb/storage/initializers.h index 5376d4fc76f0..529327fbb06b 100644 --- a/drivers/usb/storage/initializers.h +++ b/drivers/usb/storage/initializers.h | |||
@@ -46,5 +46,5 @@ int usb_stor_euscsi_init(struct us_data *us); | |||
46 | * flash reader */ | 46 | * flash reader */ |
47 | int usb_stor_ucr61s2b_init(struct us_data *us); | 47 | int usb_stor_ucr61s2b_init(struct us_data *us); |
48 | 48 | ||
49 | /* This places the HUAWEI usb dongles in multi-port mode */ | 49 | /* This places the HUAWEI E220 devices in multi-port mode */ |
50 | int usb_stor_huawei_init(struct us_data *us); | 50 | int usb_stor_huawei_e220_init(struct us_data *us); |
diff --git a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h index 72923b56bbf6..1799335288bd 100644 --- a/drivers/usb/storage/unusual_devs.h +++ b/drivers/usb/storage/unusual_devs.h | |||
@@ -53,6 +53,14 @@ | |||
53 | * as opposed to devices that do something strangely or wrongly. | 53 | * as opposed to devices that do something strangely or wrongly. |
54 | */ | 54 | */ |
55 | 55 | ||
56 | /* In-kernel mode switching is deprecated. Do not add new devices to | ||
57 | * this list for the sole purpose of switching them to a different | ||
58 | * mode. Existing userspace solutions are superior. | ||
59 | * | ||
60 | * New mode switching devices should instead be added to the database | ||
61 | * maintained at http://www.draisberghof.de/usb_modeswitch/ | ||
62 | */ | ||
63 | |||
56 | #if !defined(CONFIG_USB_STORAGE_SDDR09) && \ | 64 | #if !defined(CONFIG_USB_STORAGE_SDDR09) && \ |
57 | !defined(CONFIG_USB_STORAGE_SDDR09_MODULE) | 65 | !defined(CONFIG_USB_STORAGE_SDDR09_MODULE) |
58 | #define NO_SDDR09 | 66 | #define NO_SDDR09 |
@@ -488,6 +496,13 @@ UNUSUAL_DEV( 0x04e8, 0x5122, 0x0000, 0x9999, | |||
488 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, | 496 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, |
489 | US_FL_MAX_SECTORS_64 | US_FL_BULK_IGNORE_TAG), | 497 | US_FL_MAX_SECTORS_64 | US_FL_BULK_IGNORE_TAG), |
490 | 498 | ||
499 | /* Added by Dmitry Artamonow <mad_soft@inbox.ru> */ | ||
500 | UNUSUAL_DEV( 0x04e8, 0x5136, 0x0000, 0x9999, | ||
501 | "Samsung", | ||
502 | "YP-Z3", | ||
503 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, | ||
504 | US_FL_MAX_SECTORS_64), | ||
505 | |||
491 | /* Entry and supporting patch by Theodore Kilgore <kilgota@auburn.edu>. | 506 | /* Entry and supporting patch by Theodore Kilgore <kilgota@auburn.edu>. |
492 | * Device uses standards-violating 32-byte Bulk Command Block Wrappers and | 507 | * Device uses standards-violating 32-byte Bulk Command Block Wrappers and |
493 | * reports itself as "Proprietary SCSI Bulk." Cf. device entry 0x084d:0x0011. | 508 | * reports itself as "Proprietary SCSI Bulk." Cf. device entry 0x084d:0x0011. |
@@ -1527,10 +1542,335 @@ UNUSUAL_DEV( 0x1210, 0x0003, 0x0100, 0x0100, | |||
1527 | /* Reported by fangxiaozhi <huananhu@huawei.com> | 1542 | /* Reported by fangxiaozhi <huananhu@huawei.com> |
1528 | * This brings the HUAWEI data card devices into multi-port mode | 1543 | * This brings the HUAWEI data card devices into multi-port mode |
1529 | */ | 1544 | */ |
1530 | UNUSUAL_VENDOR_INTF(0x12d1, 0x08, 0x06, 0x50, | 1545 | UNUSUAL_DEV( 0x12d1, 0x1001, 0x0000, 0x0000, |
1546 | "HUAWEI MOBILE", | ||
1547 | "Mass Storage", | ||
1548 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init, | ||
1549 | 0), | ||
1550 | UNUSUAL_DEV( 0x12d1, 0x1003, 0x0000, 0x0000, | ||
1551 | "HUAWEI MOBILE", | ||
1552 | "Mass Storage", | ||
1553 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init, | ||
1554 | 0), | ||
1555 | UNUSUAL_DEV( 0x12d1, 0x1004, 0x0000, 0x0000, | ||
1556 | "HUAWEI MOBILE", | ||
1557 | "Mass Storage", | ||
1558 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init, | ||
1559 | 0), | ||
1560 | UNUSUAL_DEV( 0x12d1, 0x1401, 0x0000, 0x0000, | ||
1561 | "HUAWEI MOBILE", | ||
1562 | "Mass Storage", | ||
1563 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init, | ||
1564 | 0), | ||
1565 | UNUSUAL_DEV( 0x12d1, 0x1402, 0x0000, 0x0000, | ||
1566 | "HUAWEI MOBILE", | ||
1567 | "Mass Storage", | ||
1568 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init, | ||
1569 | 0), | ||
1570 | UNUSUAL_DEV( 0x12d1, 0x1403, 0x0000, 0x0000, | ||
1571 | "HUAWEI MOBILE", | ||
1572 | "Mass Storage", | ||
1573 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init, | ||
1574 | 0), | ||
1575 | UNUSUAL_DEV( 0x12d1, 0x1404, 0x0000, 0x0000, | ||
1576 | "HUAWEI MOBILE", | ||
1577 | "Mass Storage", | ||
1578 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init, | ||
1579 | 0), | ||
1580 | UNUSUAL_DEV( 0x12d1, 0x1405, 0x0000, 0x0000, | ||
1581 | "HUAWEI MOBILE", | ||
1582 | "Mass Storage", | ||
1583 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init, | ||
1584 | 0), | ||
1585 | UNUSUAL_DEV( 0x12d1, 0x1406, 0x0000, 0x0000, | ||
1586 | "HUAWEI MOBILE", | ||
1587 | "Mass Storage", | ||
1588 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init, | ||
1589 | 0), | ||
1590 | UNUSUAL_DEV( 0x12d1, 0x1407, 0x0000, 0x0000, | ||
1591 | "HUAWEI MOBILE", | ||
1592 | "Mass Storage", | ||
1593 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init, | ||
1594 | 0), | ||
1595 | UNUSUAL_DEV( 0x12d1, 0x1408, 0x0000, 0x0000, | ||
1596 | "HUAWEI MOBILE", | ||
1597 | "Mass Storage", | ||
1598 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init, | ||
1599 | 0), | ||
1600 | UNUSUAL_DEV( 0x12d1, 0x1409, 0x0000, 0x0000, | ||
1601 | "HUAWEI MOBILE", | ||
1602 | "Mass Storage", | ||
1603 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init, | ||
1604 | 0), | ||
1605 | UNUSUAL_DEV( 0x12d1, 0x140A, 0x0000, 0x0000, | ||
1606 | "HUAWEI MOBILE", | ||
1607 | "Mass Storage", | ||
1608 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init, | ||
1609 | 0), | ||
1610 | UNUSUAL_DEV( 0x12d1, 0x140B, 0x0000, 0x0000, | ||
1611 | "HUAWEI MOBILE", | ||
1612 | "Mass Storage", | ||
1613 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init, | ||
1614 | 0), | ||
1615 | UNUSUAL_DEV( 0x12d1, 0x140C, 0x0000, 0x0000, | ||
1616 | "HUAWEI MOBILE", | ||
1617 | "Mass Storage", | ||
1618 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init, | ||
1619 | 0), | ||
1620 | UNUSUAL_DEV( 0x12d1, 0x140D, 0x0000, 0x0000, | ||
1621 | "HUAWEI MOBILE", | ||
1622 | "Mass Storage", | ||
1623 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init, | ||
1624 | 0), | ||
1625 | UNUSUAL_DEV( 0x12d1, 0x140E, 0x0000, 0x0000, | ||
1626 | "HUAWEI MOBILE", | ||
1627 | "Mass Storage", | ||
1628 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init, | ||
1629 | 0), | ||
1630 | UNUSUAL_DEV( 0x12d1, 0x140F, 0x0000, 0x0000, | ||
1631 | "HUAWEI MOBILE", | ||
1632 | "Mass Storage", | ||
1633 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init, | ||
1634 | 0), | ||
1635 | UNUSUAL_DEV( 0x12d1, 0x1410, 0x0000, 0x0000, | ||
1636 | "HUAWEI MOBILE", | ||
1637 | "Mass Storage", | ||
1638 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init, | ||
1639 | 0), | ||
1640 | UNUSUAL_DEV( 0x12d1, 0x1411, 0x0000, 0x0000, | ||
1641 | "HUAWEI MOBILE", | ||
1642 | "Mass Storage", | ||
1643 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init, | ||
1644 | 0), | ||
1645 | UNUSUAL_DEV( 0x12d1, 0x1412, 0x0000, 0x0000, | ||
1646 | "HUAWEI MOBILE", | ||
1647 | "Mass Storage", | ||
1648 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init, | ||
1649 | 0), | ||
1650 | UNUSUAL_DEV( 0x12d1, 0x1413, 0x0000, 0x0000, | ||
1651 | "HUAWEI MOBILE", | ||
1652 | "Mass Storage", | ||
1653 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init, | ||
1654 | 0), | ||
1655 | UNUSUAL_DEV( 0x12d1, 0x1414, 0x0000, 0x0000, | ||
1656 | "HUAWEI MOBILE", | ||
1657 | "Mass Storage", | ||
1658 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init, | ||
1659 | 0), | ||
1660 | UNUSUAL_DEV( 0x12d1, 0x1415, 0x0000, 0x0000, | ||
1661 | "HUAWEI MOBILE", | ||
1662 | "Mass Storage", | ||
1663 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init, | ||
1664 | 0), | ||
1665 | UNUSUAL_DEV( 0x12d1, 0x1416, 0x0000, 0x0000, | ||
1666 | "HUAWEI MOBILE", | ||
1667 | "Mass Storage", | ||
1668 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init, | ||
1669 | 0), | ||
1670 | UNUSUAL_DEV( 0x12d1, 0x1417, 0x0000, 0x0000, | ||
1671 | "HUAWEI MOBILE", | ||
1672 | "Mass Storage", | ||
1673 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init, | ||
1674 | 0), | ||
1675 | UNUSUAL_DEV( 0x12d1, 0x1418, 0x0000, 0x0000, | ||
1676 | "HUAWEI MOBILE", | ||
1677 | "Mass Storage", | ||
1678 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init, | ||
1679 | 0), | ||
1680 | UNUSUAL_DEV( 0x12d1, 0x1419, 0x0000, 0x0000, | ||
1681 | "HUAWEI MOBILE", | ||
1682 | "Mass Storage", | ||
1683 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init, | ||
1684 | 0), | ||
1685 | UNUSUAL_DEV( 0x12d1, 0x141A, 0x0000, 0x0000, | ||
1686 | "HUAWEI MOBILE", | ||
1687 | "Mass Storage", | ||
1688 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init, | ||
1689 | 0), | ||
1690 | UNUSUAL_DEV( 0x12d1, 0x141B, 0x0000, 0x0000, | ||
1691 | "HUAWEI MOBILE", | ||
1692 | "Mass Storage", | ||
1693 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init, | ||
1694 | 0), | ||
1695 | UNUSUAL_DEV( 0x12d1, 0x141C, 0x0000, 0x0000, | ||
1696 | "HUAWEI MOBILE", | ||
1697 | "Mass Storage", | ||
1698 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init, | ||
1699 | 0), | ||
1700 | UNUSUAL_DEV( 0x12d1, 0x141D, 0x0000, 0x0000, | ||
1701 | "HUAWEI MOBILE", | ||
1702 | "Mass Storage", | ||
1703 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init, | ||
1704 | 0), | ||
1705 | UNUSUAL_DEV( 0x12d1, 0x141E, 0x0000, 0x0000, | ||
1706 | "HUAWEI MOBILE", | ||
1707 | "Mass Storage", | ||
1708 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init, | ||
1709 | 0), | ||
1710 | UNUSUAL_DEV( 0x12d1, 0x141F, 0x0000, 0x0000, | ||
1711 | "HUAWEI MOBILE", | ||
1712 | "Mass Storage", | ||
1713 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init, | ||
1714 | 0), | ||
1715 | UNUSUAL_DEV( 0x12d1, 0x1420, 0x0000, 0x0000, | ||
1716 | "HUAWEI MOBILE", | ||
1717 | "Mass Storage", | ||
1718 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init, | ||
1719 | 0), | ||
1720 | UNUSUAL_DEV( 0x12d1, 0x1421, 0x0000, 0x0000, | ||
1721 | "HUAWEI MOBILE", | ||
1722 | "Mass Storage", | ||
1723 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init, | ||
1724 | 0), | ||
1725 | UNUSUAL_DEV( 0x12d1, 0x1422, 0x0000, 0x0000, | ||
1726 | "HUAWEI MOBILE", | ||
1727 | "Mass Storage", | ||
1728 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init, | ||
1729 | 0), | ||
1730 | UNUSUAL_DEV( 0x12d1, 0x1423, 0x0000, 0x0000, | ||
1731 | "HUAWEI MOBILE", | ||
1732 | "Mass Storage", | ||
1733 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init, | ||
1734 | 0), | ||
1735 | UNUSUAL_DEV( 0x12d1, 0x1424, 0x0000, 0x0000, | ||
1736 | "HUAWEI MOBILE", | ||
1737 | "Mass Storage", | ||
1738 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init, | ||
1739 | 0), | ||
1740 | UNUSUAL_DEV( 0x12d1, 0x1425, 0x0000, 0x0000, | ||
1741 | "HUAWEI MOBILE", | ||
1742 | "Mass Storage", | ||
1743 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init, | ||
1744 | 0), | ||
1745 | UNUSUAL_DEV( 0x12d1, 0x1426, 0x0000, 0x0000, | ||
1746 | "HUAWEI MOBILE", | ||
1747 | "Mass Storage", | ||
1748 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init, | ||
1749 | 0), | ||
1750 | UNUSUAL_DEV( 0x12d1, 0x1427, 0x0000, 0x0000, | ||
1751 | "HUAWEI MOBILE", | ||
1752 | "Mass Storage", | ||
1753 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init, | ||
1754 | 0), | ||
1755 | UNUSUAL_DEV( 0x12d1, 0x1428, 0x0000, 0x0000, | ||
1756 | "HUAWEI MOBILE", | ||
1757 | "Mass Storage", | ||
1758 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init, | ||
1759 | 0), | ||
1760 | UNUSUAL_DEV( 0x12d1, 0x1429, 0x0000, 0x0000, | ||
1761 | "HUAWEI MOBILE", | ||
1762 | "Mass Storage", | ||
1763 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init, | ||
1764 | 0), | ||
1765 | UNUSUAL_DEV( 0x12d1, 0x142A, 0x0000, 0x0000, | ||
1766 | "HUAWEI MOBILE", | ||
1767 | "Mass Storage", | ||
1768 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init, | ||
1769 | 0), | ||
1770 | UNUSUAL_DEV( 0x12d1, 0x142B, 0x0000, 0x0000, | ||
1771 | "HUAWEI MOBILE", | ||
1772 | "Mass Storage", | ||
1773 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init, | ||
1774 | 0), | ||
1775 | UNUSUAL_DEV( 0x12d1, 0x142C, 0x0000, 0x0000, | ||
1776 | "HUAWEI MOBILE", | ||
1777 | "Mass Storage", | ||
1778 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init, | ||
1779 | 0), | ||
1780 | UNUSUAL_DEV( 0x12d1, 0x142D, 0x0000, 0x0000, | ||
1781 | "HUAWEI MOBILE", | ||
1782 | "Mass Storage", | ||
1783 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init, | ||
1784 | 0), | ||
1785 | UNUSUAL_DEV( 0x12d1, 0x142E, 0x0000, 0x0000, | ||
1786 | "HUAWEI MOBILE", | ||
1787 | "Mass Storage", | ||
1788 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init, | ||
1789 | 0), | ||
1790 | UNUSUAL_DEV( 0x12d1, 0x142F, 0x0000, 0x0000, | ||
1791 | "HUAWEI MOBILE", | ||
1792 | "Mass Storage", | ||
1793 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init, | ||
1794 | 0), | ||
1795 | UNUSUAL_DEV( 0x12d1, 0x1430, 0x0000, 0x0000, | ||
1796 | "HUAWEI MOBILE", | ||
1797 | "Mass Storage", | ||
1798 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init, | ||
1799 | 0), | ||
1800 | UNUSUAL_DEV( 0x12d1, 0x1431, 0x0000, 0x0000, | ||
1801 | "HUAWEI MOBILE", | ||
1802 | "Mass Storage", | ||
1803 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init, | ||
1804 | 0), | ||
1805 | UNUSUAL_DEV( 0x12d1, 0x1432, 0x0000, 0x0000, | ||
1806 | "HUAWEI MOBILE", | ||
1807 | "Mass Storage", | ||
1808 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init, | ||
1809 | 0), | ||
1810 | UNUSUAL_DEV( 0x12d1, 0x1433, 0x0000, 0x0000, | ||
1811 | "HUAWEI MOBILE", | ||
1812 | "Mass Storage", | ||
1813 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init, | ||
1814 | 0), | ||
1815 | UNUSUAL_DEV( 0x12d1, 0x1434, 0x0000, 0x0000, | ||
1816 | "HUAWEI MOBILE", | ||
1817 | "Mass Storage", | ||
1818 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init, | ||
1819 | 0), | ||
1820 | UNUSUAL_DEV( 0x12d1, 0x1435, 0x0000, 0x0000, | ||
1821 | "HUAWEI MOBILE", | ||
1822 | "Mass Storage", | ||
1823 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init, | ||
1824 | 0), | ||
1825 | UNUSUAL_DEV( 0x12d1, 0x1436, 0x0000, 0x0000, | ||
1826 | "HUAWEI MOBILE", | ||
1827 | "Mass Storage", | ||
1828 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init, | ||
1829 | 0), | ||
1830 | UNUSUAL_DEV( 0x12d1, 0x1437, 0x0000, 0x0000, | ||
1831 | "HUAWEI MOBILE", | ||
1832 | "Mass Storage", | ||
1833 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init, | ||
1834 | 0), | ||
1835 | UNUSUAL_DEV( 0x12d1, 0x1438, 0x0000, 0x0000, | ||
1836 | "HUAWEI MOBILE", | ||
1837 | "Mass Storage", | ||
1838 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init, | ||
1839 | 0), | ||
1840 | UNUSUAL_DEV( 0x12d1, 0x1439, 0x0000, 0x0000, | ||
1841 | "HUAWEI MOBILE", | ||
1842 | "Mass Storage", | ||
1843 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init, | ||
1844 | 0), | ||
1845 | UNUSUAL_DEV( 0x12d1, 0x143A, 0x0000, 0x0000, | ||
1846 | "HUAWEI MOBILE", | ||
1847 | "Mass Storage", | ||
1848 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init, | ||
1849 | 0), | ||
1850 | UNUSUAL_DEV( 0x12d1, 0x143B, 0x0000, 0x0000, | ||
1851 | "HUAWEI MOBILE", | ||
1852 | "Mass Storage", | ||
1853 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init, | ||
1854 | 0), | ||
1855 | UNUSUAL_DEV( 0x12d1, 0x143C, 0x0000, 0x0000, | ||
1856 | "HUAWEI MOBILE", | ||
1857 | "Mass Storage", | ||
1858 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init, | ||
1859 | 0), | ||
1860 | UNUSUAL_DEV( 0x12d1, 0x143D, 0x0000, 0x0000, | ||
1861 | "HUAWEI MOBILE", | ||
1862 | "Mass Storage", | ||
1863 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init, | ||
1864 | 0), | ||
1865 | UNUSUAL_DEV( 0x12d1, 0x143E, 0x0000, 0x0000, | ||
1866 | "HUAWEI MOBILE", | ||
1867 | "Mass Storage", | ||
1868 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init, | ||
1869 | 0), | ||
1870 | UNUSUAL_DEV( 0x12d1, 0x143F, 0x0000, 0x0000, | ||
1531 | "HUAWEI MOBILE", | 1871 | "HUAWEI MOBILE", |
1532 | "Mass Storage", | 1872 | "Mass Storage", |
1533 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_init, | 1873 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init, |
1534 | 0), | 1874 | 0), |
1535 | 1875 | ||
1536 | /* Reported by Vilius Bilinkevicius <vilisas AT xxx DOT lt) */ | 1876 | /* Reported by Vilius Bilinkevicius <vilisas AT xxx DOT lt) */ |
diff --git a/drivers/vfio/pci/vfio_pci_config.c b/drivers/vfio/pci/vfio_pci_config.c index 964ff22bf281..aeb00fc2d3be 100644 --- a/drivers/vfio/pci/vfio_pci_config.c +++ b/drivers/vfio/pci/vfio_pci_config.c | |||
@@ -27,6 +27,7 @@ | |||
27 | #include <linux/pci.h> | 27 | #include <linux/pci.h> |
28 | #include <linux/uaccess.h> | 28 | #include <linux/uaccess.h> |
29 | #include <linux/vfio.h> | 29 | #include <linux/vfio.h> |
30 | #include <linux/slab.h> | ||
30 | 31 | ||
31 | #include "vfio_pci_private.h" | 32 | #include "vfio_pci_private.h" |
32 | 33 | ||
diff --git a/drivers/vfio/pci/vfio_pci_intrs.c b/drivers/vfio/pci/vfio_pci_intrs.c index 3639371fa697..a96509187deb 100644 --- a/drivers/vfio/pci/vfio_pci_intrs.c +++ b/drivers/vfio/pci/vfio_pci_intrs.c | |||
@@ -22,6 +22,7 @@ | |||
22 | #include <linux/vfio.h> | 22 | #include <linux/vfio.h> |
23 | #include <linux/wait.h> | 23 | #include <linux/wait.h> |
24 | #include <linux/workqueue.h> | 24 | #include <linux/workqueue.h> |
25 | #include <linux/slab.h> | ||
25 | 26 | ||
26 | #include "vfio_pci_private.h" | 27 | #include "vfio_pci_private.h" |
27 | 28 | ||
diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c index 959b1cd89e6a..ec6fb3fa59bb 100644 --- a/drivers/vhost/net.c +++ b/drivers/vhost/net.c | |||
@@ -339,7 +339,8 @@ static void handle_tx(struct vhost_net *net) | |||
339 | msg.msg_controllen = 0; | 339 | msg.msg_controllen = 0; |
340 | ubufs = NULL; | 340 | ubufs = NULL; |
341 | } else { | 341 | } else { |
342 | struct ubuf_info *ubuf = &vq->ubuf_info[head]; | 342 | struct ubuf_info *ubuf; |
343 | ubuf = vq->ubuf_info + vq->upend_idx; | ||
343 | 344 | ||
344 | vq->heads[vq->upend_idx].len = | 345 | vq->heads[vq->upend_idx].len = |
345 | VHOST_DMA_IN_PROGRESS; | 346 | VHOST_DMA_IN_PROGRESS; |
diff --git a/drivers/vhost/tcm_vhost.c b/drivers/vhost/tcm_vhost.c index 9951297b2427..43fb11ee2e8d 100644 --- a/drivers/vhost/tcm_vhost.c +++ b/drivers/vhost/tcm_vhost.c | |||
@@ -850,7 +850,7 @@ static int vhost_scsi_clear_endpoint( | |||
850 | for (index = 0; index < vs->dev.nvqs; ++index) { | 850 | for (index = 0; index < vs->dev.nvqs; ++index) { |
851 | if (!vhost_vq_access_ok(&vs->vqs[index])) { | 851 | if (!vhost_vq_access_ok(&vs->vqs[index])) { |
852 | ret = -EFAULT; | 852 | ret = -EFAULT; |
853 | goto err; | 853 | goto err_dev; |
854 | } | 854 | } |
855 | } | 855 | } |
856 | for (i = 0; i < VHOST_SCSI_MAX_TARGET; i++) { | 856 | for (i = 0; i < VHOST_SCSI_MAX_TARGET; i++) { |
@@ -860,10 +860,11 @@ static int vhost_scsi_clear_endpoint( | |||
860 | if (!tv_tpg) | 860 | if (!tv_tpg) |
861 | continue; | 861 | continue; |
862 | 862 | ||
863 | mutex_lock(&tv_tpg->tv_tpg_mutex); | ||
863 | tv_tport = tv_tpg->tport; | 864 | tv_tport = tv_tpg->tport; |
864 | if (!tv_tport) { | 865 | if (!tv_tport) { |
865 | ret = -ENODEV; | 866 | ret = -ENODEV; |
866 | goto err; | 867 | goto err_tpg; |
867 | } | 868 | } |
868 | 869 | ||
869 | if (strcmp(tv_tport->tport_name, t->vhost_wwpn)) { | 870 | if (strcmp(tv_tport->tport_name, t->vhost_wwpn)) { |
@@ -872,16 +873,19 @@ static int vhost_scsi_clear_endpoint( | |||
872 | tv_tport->tport_name, tv_tpg->tport_tpgt, | 873 | tv_tport->tport_name, tv_tpg->tport_tpgt, |
873 | t->vhost_wwpn, t->vhost_tpgt); | 874 | t->vhost_wwpn, t->vhost_tpgt); |
874 | ret = -EINVAL; | 875 | ret = -EINVAL; |
875 | goto err; | 876 | goto err_tpg; |
876 | } | 877 | } |
877 | tv_tpg->tv_tpg_vhost_count--; | 878 | tv_tpg->tv_tpg_vhost_count--; |
878 | vs->vs_tpg[target] = NULL; | 879 | vs->vs_tpg[target] = NULL; |
879 | vs->vs_endpoint = false; | 880 | vs->vs_endpoint = false; |
881 | mutex_unlock(&tv_tpg->tv_tpg_mutex); | ||
880 | } | 882 | } |
881 | mutex_unlock(&vs->dev.mutex); | 883 | mutex_unlock(&vs->dev.mutex); |
882 | return 0; | 884 | return 0; |
883 | 885 | ||
884 | err: | 886 | err_tpg: |
887 | mutex_unlock(&tv_tpg->tv_tpg_mutex); | ||
888 | err_dev: | ||
885 | mutex_unlock(&vs->dev.mutex); | 889 | mutex_unlock(&vs->dev.mutex); |
886 | return ret; | 890 | return ret; |
887 | } | 891 | } |
@@ -937,6 +941,7 @@ static void vhost_scsi_flush(struct vhost_scsi *vs) | |||
937 | 941 | ||
938 | for (i = 0; i < VHOST_SCSI_MAX_VQ; i++) | 942 | for (i = 0; i < VHOST_SCSI_MAX_VQ; i++) |
939 | vhost_scsi_flush_vq(vs, i); | 943 | vhost_scsi_flush_vq(vs, i); |
944 | vhost_work_flush(&vs->dev, &vs->vs_completion_work); | ||
940 | } | 945 | } |
941 | 946 | ||
942 | static int vhost_scsi_set_features(struct vhost_scsi *vs, u64 features) | 947 | static int vhost_scsi_set_features(struct vhost_scsi *vs, u64 features) |
diff --git a/drivers/video/atmel_lcdfb.c b/drivers/video/atmel_lcdfb.c index 12cf5f31ee8f..025428e04c33 100644 --- a/drivers/video/atmel_lcdfb.c +++ b/drivers/video/atmel_lcdfb.c | |||
@@ -422,17 +422,22 @@ static int atmel_lcdfb_check_var(struct fb_var_screeninfo *var, | |||
422 | = var->bits_per_pixel; | 422 | = var->bits_per_pixel; |
423 | break; | 423 | break; |
424 | case 16: | 424 | case 16: |
425 | /* Older SOCs use IBGR:555 rather than BGR:565. */ | ||
426 | if (sinfo->have_intensity_bit) | ||
427 | var->green.length = 5; | ||
428 | else | ||
429 | var->green.length = 6; | ||
430 | |||
425 | if (sinfo->lcd_wiring_mode == ATMEL_LCDC_WIRING_RGB) { | 431 | if (sinfo->lcd_wiring_mode == ATMEL_LCDC_WIRING_RGB) { |
426 | /* RGB:565 mode */ | 432 | /* RGB:5X5 mode */ |
427 | var->red.offset = 11; | 433 | var->red.offset = var->green.length + 5; |
428 | var->blue.offset = 0; | 434 | var->blue.offset = 0; |
429 | } else { | 435 | } else { |
430 | /* BGR:565 mode */ | 436 | /* BGR:5X5 mode */ |
431 | var->red.offset = 0; | 437 | var->red.offset = 0; |
432 | var->blue.offset = 11; | 438 | var->blue.offset = var->green.length + 5; |
433 | } | 439 | } |
434 | var->green.offset = 5; | 440 | var->green.offset = 5; |
435 | var->green.length = 6; | ||
436 | var->red.length = var->blue.length = 5; | 441 | var->red.length = var->blue.length = 5; |
437 | break; | 442 | break; |
438 | case 32: | 443 | case 32: |
@@ -679,8 +684,7 @@ static int atmel_lcdfb_setcolreg(unsigned int regno, unsigned int red, | |||
679 | 684 | ||
680 | case FB_VISUAL_PSEUDOCOLOR: | 685 | case FB_VISUAL_PSEUDOCOLOR: |
681 | if (regno < 256) { | 686 | if (regno < 256) { |
682 | if (cpu_is_at91sam9261() || cpu_is_at91sam9263() | 687 | if (sinfo->have_intensity_bit) { |
683 | || cpu_is_at91sam9rl()) { | ||
684 | /* old style I+BGR:555 */ | 688 | /* old style I+BGR:555 */ |
685 | val = ((red >> 11) & 0x001f); | 689 | val = ((red >> 11) & 0x001f); |
686 | val |= ((green >> 6) & 0x03e0); | 690 | val |= ((green >> 6) & 0x03e0); |
@@ -870,6 +874,10 @@ static int __init atmel_lcdfb_probe(struct platform_device *pdev) | |||
870 | } | 874 | } |
871 | sinfo->info = info; | 875 | sinfo->info = info; |
872 | sinfo->pdev = pdev; | 876 | sinfo->pdev = pdev; |
877 | if (cpu_is_at91sam9261() || cpu_is_at91sam9263() || | ||
878 | cpu_is_at91sam9rl()) { | ||
879 | sinfo->have_intensity_bit = true; | ||
880 | } | ||
873 | 881 | ||
874 | strcpy(info->fix.id, sinfo->pdev->name); | 882 | strcpy(info->fix.id, sinfo->pdev->name); |
875 | info->flags = ATMEL_LCDFB_FBINFO_DEFAULT; | 883 | info->flags = ATMEL_LCDFB_FBINFO_DEFAULT; |
diff --git a/drivers/video/ep93xx-fb.c b/drivers/video/ep93xx-fb.c index 3f2519d30715..e06cd5d90c97 100644 --- a/drivers/video/ep93xx-fb.c +++ b/drivers/video/ep93xx-fb.c | |||
@@ -23,6 +23,7 @@ | |||
23 | #include <linux/slab.h> | 23 | #include <linux/slab.h> |
24 | #include <linux/clk.h> | 24 | #include <linux/clk.h> |
25 | #include <linux/fb.h> | 25 | #include <linux/fb.h> |
26 | #include <linux/io.h> | ||
26 | 27 | ||
27 | #include <linux/platform_data/video-ep93xx.h> | 28 | #include <linux/platform_data/video-ep93xx.h> |
28 | 29 | ||
diff --git a/drivers/video/omap/lcd_ams_delta.c b/drivers/video/omap/lcd_ams_delta.c index ed4cad87fbcd..4a5f2cd3d3bf 100644 --- a/drivers/video/omap/lcd_ams_delta.c +++ b/drivers/video/omap/lcd_ams_delta.c | |||
@@ -27,6 +27,7 @@ | |||
27 | #include <linux/lcd.h> | 27 | #include <linux/lcd.h> |
28 | #include <linux/gpio.h> | 28 | #include <linux/gpio.h> |
29 | 29 | ||
30 | #include <mach/hardware.h> | ||
30 | #include <mach/board-ams-delta.h> | 31 | #include <mach/board-ams-delta.h> |
31 | 32 | ||
32 | #include "omapfb.h" | 33 | #include "omapfb.h" |
diff --git a/drivers/video/omap/lcd_osk.c b/drivers/video/omap/lcd_osk.c index 3aa62da89195..7fbe04bce0ed 100644 --- a/drivers/video/omap/lcd_osk.c +++ b/drivers/video/omap/lcd_osk.c | |||
@@ -24,7 +24,10 @@ | |||
24 | #include <linux/platform_device.h> | 24 | #include <linux/platform_device.h> |
25 | 25 | ||
26 | #include <asm/gpio.h> | 26 | #include <asm/gpio.h> |
27 | |||
28 | #include <mach/hardware.h> | ||
27 | #include <mach/mux.h> | 29 | #include <mach/mux.h> |
30 | |||
28 | #include "omapfb.h" | 31 | #include "omapfb.h" |
29 | 32 | ||
30 | static int osk_panel_init(struct lcd_panel *panel, struct omapfb_device *fbdev) | 33 | static int osk_panel_init(struct lcd_panel *panel, struct omapfb_device *fbdev) |
diff --git a/drivers/w1/masters/w1-gpio.c b/drivers/w1/masters/w1-gpio.c index d39dfa4cc235..46d97014342e 100644 --- a/drivers/w1/masters/w1-gpio.c +++ b/drivers/w1/masters/w1-gpio.c | |||
@@ -47,11 +47,13 @@ static u8 w1_gpio_read_bit(void *data) | |||
47 | return gpio_get_value(pdata->pin) ? 1 : 0; | 47 | return gpio_get_value(pdata->pin) ? 1 : 0; |
48 | } | 48 | } |
49 | 49 | ||
50 | #if defined(CONFIG_OF) | ||
50 | static struct of_device_id w1_gpio_dt_ids[] = { | 51 | static struct of_device_id w1_gpio_dt_ids[] = { |
51 | { .compatible = "w1-gpio" }, | 52 | { .compatible = "w1-gpio" }, |
52 | {} | 53 | {} |
53 | }; | 54 | }; |
54 | MODULE_DEVICE_TABLE(of, w1_gpio_dt_ids); | 55 | MODULE_DEVICE_TABLE(of, w1_gpio_dt_ids); |
56 | #endif | ||
55 | 57 | ||
56 | static int w1_gpio_probe_dt(struct platform_device *pdev) | 58 | static int w1_gpio_probe_dt(struct platform_device *pdev) |
57 | { | 59 | { |
@@ -158,7 +160,7 @@ static int w1_gpio_probe(struct platform_device *pdev) | |||
158 | return err; | 160 | return err; |
159 | } | 161 | } |
160 | 162 | ||
161 | static int __exit w1_gpio_remove(struct platform_device *pdev) | 163 | static int w1_gpio_remove(struct platform_device *pdev) |
162 | { | 164 | { |
163 | struct w1_bus_master *master = platform_get_drvdata(pdev); | 165 | struct w1_bus_master *master = platform_get_drvdata(pdev); |
164 | struct w1_gpio_platform_data *pdata = pdev->dev.platform_data; | 166 | struct w1_gpio_platform_data *pdata = pdev->dev.platform_data; |
@@ -210,7 +212,7 @@ static struct platform_driver w1_gpio_driver = { | |||
210 | .of_match_table = of_match_ptr(w1_gpio_dt_ids), | 212 | .of_match_table = of_match_ptr(w1_gpio_dt_ids), |
211 | }, | 213 | }, |
212 | .probe = w1_gpio_probe, | 214 | .probe = w1_gpio_probe, |
213 | .remove = __exit_p(w1_gpio_remove), | 215 | .remove = w1_gpio_remove, |
214 | .suspend = w1_gpio_suspend, | 216 | .suspend = w1_gpio_suspend, |
215 | .resume = w1_gpio_resume, | 217 | .resume = w1_gpio_resume, |
216 | }; | 218 | }; |
diff --git a/drivers/w1/w1.c b/drivers/w1/w1.c index 7994d933f040..7ce277d2bb67 100644 --- a/drivers/w1/w1.c +++ b/drivers/w1/w1.c | |||
@@ -924,7 +924,8 @@ void w1_search(struct w1_master *dev, u8 search_type, w1_slave_found_callback cb | |||
924 | tmp64 = (triplet_ret >> 2); | 924 | tmp64 = (triplet_ret >> 2); |
925 | rn |= (tmp64 << i); | 925 | rn |= (tmp64 << i); |
926 | 926 | ||
927 | if (kthread_should_stop()) { | 927 | /* ensure we're called from kthread and not by netlink callback */ |
928 | if (!dev->priv && kthread_should_stop()) { | ||
928 | mutex_unlock(&dev->bus_mutex); | 929 | mutex_unlock(&dev->bus_mutex); |
929 | dev_dbg(&dev->dev, "Abort w1_search\n"); | 930 | dev_dbg(&dev->dev, "Abort w1_search\n"); |
930 | return; | 931 | return; |
diff --git a/drivers/watchdog/sp5100_tco.c b/drivers/watchdog/sp5100_tco.c index e3b8f757d2d3..0e9d8c479c35 100644 --- a/drivers/watchdog/sp5100_tco.c +++ b/drivers/watchdog/sp5100_tco.c | |||
@@ -40,13 +40,12 @@ | |||
40 | #include "sp5100_tco.h" | 40 | #include "sp5100_tco.h" |
41 | 41 | ||
42 | /* Module and version information */ | 42 | /* Module and version information */ |
43 | #define TCO_VERSION "0.03" | 43 | #define TCO_VERSION "0.05" |
44 | #define TCO_MODULE_NAME "SP5100 TCO timer" | 44 | #define TCO_MODULE_NAME "SP5100 TCO timer" |
45 | #define TCO_DRIVER_NAME TCO_MODULE_NAME ", v" TCO_VERSION | 45 | #define TCO_DRIVER_NAME TCO_MODULE_NAME ", v" TCO_VERSION |
46 | 46 | ||
47 | /* internal variables */ | 47 | /* internal variables */ |
48 | static u32 tcobase_phys; | 48 | static u32 tcobase_phys; |
49 | static u32 resbase_phys; | ||
50 | static u32 tco_wdt_fired; | 49 | static u32 tco_wdt_fired; |
51 | static void __iomem *tcobase; | 50 | static void __iomem *tcobase; |
52 | static unsigned int pm_iobase; | 51 | static unsigned int pm_iobase; |
@@ -54,10 +53,6 @@ static DEFINE_SPINLOCK(tco_lock); /* Guards the hardware */ | |||
54 | static unsigned long timer_alive; | 53 | static unsigned long timer_alive; |
55 | static char tco_expect_close; | 54 | static char tco_expect_close; |
56 | static struct pci_dev *sp5100_tco_pci; | 55 | static struct pci_dev *sp5100_tco_pci; |
57 | static struct resource wdt_res = { | ||
58 | .name = "Watchdog Timer", | ||
59 | .flags = IORESOURCE_MEM, | ||
60 | }; | ||
61 | 56 | ||
62 | /* the watchdog platform device */ | 57 | /* the watchdog platform device */ |
63 | static struct platform_device *sp5100_tco_platform_device; | 58 | static struct platform_device *sp5100_tco_platform_device; |
@@ -75,12 +70,6 @@ module_param(nowayout, bool, 0); | |||
75 | MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started." | 70 | MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started." |
76 | " (default=" __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); | 71 | " (default=" __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); |
77 | 72 | ||
78 | static unsigned int force_addr; | ||
79 | module_param(force_addr, uint, 0); | ||
80 | MODULE_PARM_DESC(force_addr, "Force the use of specified MMIO address." | ||
81 | " ONLY USE THIS PARAMETER IF YOU REALLY KNOW" | ||
82 | " WHAT YOU ARE DOING (default=none)"); | ||
83 | |||
84 | /* | 73 | /* |
85 | * Some TCO specific functions | 74 | * Some TCO specific functions |
86 | */ | 75 | */ |
@@ -176,39 +165,6 @@ static void tco_timer_enable(void) | |||
176 | } | 165 | } |
177 | } | 166 | } |
178 | 167 | ||
179 | static void tco_timer_disable(void) | ||
180 | { | ||
181 | int val; | ||
182 | |||
183 | if (sp5100_tco_pci->revision >= 0x40) { | ||
184 | /* For SB800 or later */ | ||
185 | /* Enable watchdog decode bit and Disable watchdog timer */ | ||
186 | outb(SB800_PM_WATCHDOG_CONTROL, SB800_IO_PM_INDEX_REG); | ||
187 | val = inb(SB800_IO_PM_DATA_REG); | ||
188 | val |= SB800_PCI_WATCHDOG_DECODE_EN; | ||
189 | val |= SB800_PM_WATCHDOG_DISABLE; | ||
190 | outb(val, SB800_IO_PM_DATA_REG); | ||
191 | } else { | ||
192 | /* For SP5100 or SB7x0 */ | ||
193 | /* Enable watchdog decode bit */ | ||
194 | pci_read_config_dword(sp5100_tco_pci, | ||
195 | SP5100_PCI_WATCHDOG_MISC_REG, | ||
196 | &val); | ||
197 | |||
198 | val |= SP5100_PCI_WATCHDOG_DECODE_EN; | ||
199 | |||
200 | pci_write_config_dword(sp5100_tco_pci, | ||
201 | SP5100_PCI_WATCHDOG_MISC_REG, | ||
202 | val); | ||
203 | |||
204 | /* Disable Watchdog timer */ | ||
205 | outb(SP5100_PM_WATCHDOG_CONTROL, SP5100_IO_PM_INDEX_REG); | ||
206 | val = inb(SP5100_IO_PM_DATA_REG); | ||
207 | val |= SP5100_PM_WATCHDOG_DISABLE; | ||
208 | outb(val, SP5100_IO_PM_DATA_REG); | ||
209 | } | ||
210 | } | ||
211 | |||
212 | /* | 168 | /* |
213 | * /dev/watchdog handling | 169 | * /dev/watchdog handling |
214 | */ | 170 | */ |
@@ -361,7 +317,7 @@ static unsigned char sp5100_tco_setupdevice(void) | |||
361 | { | 317 | { |
362 | struct pci_dev *dev = NULL; | 318 | struct pci_dev *dev = NULL; |
363 | const char *dev_name = NULL; | 319 | const char *dev_name = NULL; |
364 | u32 val, tmp_val; | 320 | u32 val; |
365 | u32 index_reg, data_reg, base_addr; | 321 | u32 index_reg, data_reg, base_addr; |
366 | 322 | ||
367 | /* Match the PCI device */ | 323 | /* Match the PCI device */ |
@@ -459,63 +415,8 @@ static unsigned char sp5100_tco_setupdevice(void) | |||
459 | } else | 415 | } else |
460 | pr_debug("SBResource_MMIO is disabled(0x%04x)\n", val); | 416 | pr_debug("SBResource_MMIO is disabled(0x%04x)\n", val); |
461 | 417 | ||
462 | /* | 418 | pr_notice("failed to find MMIO address, giving up.\n"); |
463 | * Lastly re-programming the watchdog timer MMIO address, | 419 | goto unreg_region; |
464 | * This method is a last resort... | ||
465 | * | ||
466 | * Before re-programming, to ensure that the watchdog timer | ||
467 | * is disabled, disable the watchdog timer. | ||
468 | */ | ||
469 | tco_timer_disable(); | ||
470 | |||
471 | if (force_addr) { | ||
472 | /* | ||
473 | * Force the use of watchdog timer MMIO address, and aligned to | ||
474 | * 8byte boundary. | ||
475 | */ | ||
476 | force_addr &= ~0x7; | ||
477 | val = force_addr; | ||
478 | |||
479 | pr_info("Force the use of 0x%04x as MMIO address\n", val); | ||
480 | } else { | ||
481 | /* | ||
482 | * Get empty slot into the resource tree for watchdog timer. | ||
483 | */ | ||
484 | if (allocate_resource(&iomem_resource, | ||
485 | &wdt_res, | ||
486 | SP5100_WDT_MEM_MAP_SIZE, | ||
487 | 0xf0000000, | ||
488 | 0xfffffff8, | ||
489 | 0x8, | ||
490 | NULL, | ||
491 | NULL)) { | ||
492 | pr_err("MMIO allocation failed\n"); | ||
493 | goto unreg_region; | ||
494 | } | ||
495 | |||
496 | val = resbase_phys = wdt_res.start; | ||
497 | pr_debug("Got 0x%04x from resource tree\n", val); | ||
498 | } | ||
499 | |||
500 | /* Restore to the low three bits */ | ||
501 | outb(base_addr+0, index_reg); | ||
502 | tmp_val = val | (inb(data_reg) & 0x7); | ||
503 | |||
504 | /* Re-programming the watchdog timer base address */ | ||
505 | outb(base_addr+0, index_reg); | ||
506 | outb((tmp_val >> 0) & 0xff, data_reg); | ||
507 | outb(base_addr+1, index_reg); | ||
508 | outb((tmp_val >> 8) & 0xff, data_reg); | ||
509 | outb(base_addr+2, index_reg); | ||
510 | outb((tmp_val >> 16) & 0xff, data_reg); | ||
511 | outb(base_addr+3, index_reg); | ||
512 | outb((tmp_val >> 24) & 0xff, data_reg); | ||
513 | |||
514 | if (!request_mem_region_exclusive(val, SP5100_WDT_MEM_MAP_SIZE, | ||
515 | dev_name)) { | ||
516 | pr_err("MMIO address 0x%04x already in use\n", val); | ||
517 | goto unreg_resource; | ||
518 | } | ||
519 | 420 | ||
520 | setup_wdt: | 421 | setup_wdt: |
521 | tcobase_phys = val; | 422 | tcobase_phys = val; |
@@ -555,9 +456,6 @@ setup_wdt: | |||
555 | 456 | ||
556 | unreg_mem_region: | 457 | unreg_mem_region: |
557 | release_mem_region(tcobase_phys, SP5100_WDT_MEM_MAP_SIZE); | 458 | release_mem_region(tcobase_phys, SP5100_WDT_MEM_MAP_SIZE); |
558 | unreg_resource: | ||
559 | if (resbase_phys) | ||
560 | release_resource(&wdt_res); | ||
561 | unreg_region: | 459 | unreg_region: |
562 | release_region(pm_iobase, SP5100_PM_IOPORTS_SIZE); | 460 | release_region(pm_iobase, SP5100_PM_IOPORTS_SIZE); |
563 | exit: | 461 | exit: |
@@ -567,7 +465,6 @@ exit: | |||
567 | static int sp5100_tco_init(struct platform_device *dev) | 465 | static int sp5100_tco_init(struct platform_device *dev) |
568 | { | 466 | { |
569 | int ret; | 467 | int ret; |
570 | char addr_str[16]; | ||
571 | 468 | ||
572 | /* | 469 | /* |
573 | * Check whether or not the hardware watchdog is there. If found, then | 470 | * Check whether or not the hardware watchdog is there. If found, then |
@@ -599,23 +496,14 @@ static int sp5100_tco_init(struct platform_device *dev) | |||
599 | clear_bit(0, &timer_alive); | 496 | clear_bit(0, &timer_alive); |
600 | 497 | ||
601 | /* Show module parameters */ | 498 | /* Show module parameters */ |
602 | if (force_addr == tcobase_phys) | 499 | pr_info("initialized (0x%p). heartbeat=%d sec (nowayout=%d)\n", |
603 | /* The force_addr is vaild */ | 500 | tcobase, heartbeat, nowayout); |
604 | sprintf(addr_str, "0x%04x", force_addr); | ||
605 | else | ||
606 | strcpy(addr_str, "none"); | ||
607 | |||
608 | pr_info("initialized (0x%p). heartbeat=%d sec (nowayout=%d, " | ||
609 | "force_addr=%s)\n", | ||
610 | tcobase, heartbeat, nowayout, addr_str); | ||
611 | 501 | ||
612 | return 0; | 502 | return 0; |
613 | 503 | ||
614 | exit: | 504 | exit: |
615 | iounmap(tcobase); | 505 | iounmap(tcobase); |
616 | release_mem_region(tcobase_phys, SP5100_WDT_MEM_MAP_SIZE); | 506 | release_mem_region(tcobase_phys, SP5100_WDT_MEM_MAP_SIZE); |
617 | if (resbase_phys) | ||
618 | release_resource(&wdt_res); | ||
619 | release_region(pm_iobase, SP5100_PM_IOPORTS_SIZE); | 507 | release_region(pm_iobase, SP5100_PM_IOPORTS_SIZE); |
620 | return ret; | 508 | return ret; |
621 | } | 509 | } |
@@ -630,8 +518,6 @@ static void sp5100_tco_cleanup(void) | |||
630 | misc_deregister(&sp5100_tco_miscdev); | 518 | misc_deregister(&sp5100_tco_miscdev); |
631 | iounmap(tcobase); | 519 | iounmap(tcobase); |
632 | release_mem_region(tcobase_phys, SP5100_WDT_MEM_MAP_SIZE); | 520 | release_mem_region(tcobase_phys, SP5100_WDT_MEM_MAP_SIZE); |
633 | if (resbase_phys) | ||
634 | release_resource(&wdt_res); | ||
635 | release_region(pm_iobase, SP5100_PM_IOPORTS_SIZE); | 521 | release_region(pm_iobase, SP5100_PM_IOPORTS_SIZE); |
636 | } | 522 | } |
637 | 523 | ||
diff --git a/drivers/watchdog/sp5100_tco.h b/drivers/watchdog/sp5100_tco.h index 71594a0c14b7..2b28c00da0df 100644 --- a/drivers/watchdog/sp5100_tco.h +++ b/drivers/watchdog/sp5100_tco.h | |||
@@ -57,7 +57,7 @@ | |||
57 | #define SB800_PM_WATCHDOG_DISABLE (1 << 2) | 57 | #define SB800_PM_WATCHDOG_DISABLE (1 << 2) |
58 | #define SB800_PM_WATCHDOG_SECOND_RES (3 << 0) | 58 | #define SB800_PM_WATCHDOG_SECOND_RES (3 << 0) |
59 | #define SB800_ACPI_MMIO_DECODE_EN (1 << 0) | 59 | #define SB800_ACPI_MMIO_DECODE_EN (1 << 0) |
60 | #define SB800_ACPI_MMIO_SEL (1 << 2) | 60 | #define SB800_ACPI_MMIO_SEL (1 << 1) |
61 | 61 | ||
62 | 62 | ||
63 | #define SB800_PM_WDT_MMIO_OFFSET 0xB00 | 63 | #define SB800_PM_WDT_MMIO_OFFSET 0xB00 |
diff --git a/drivers/xen/xen-acpi-processor.c b/drivers/xen/xen-acpi-processor.c index 316df65163cf..f3278a6603ca 100644 --- a/drivers/xen/xen-acpi-processor.c +++ b/drivers/xen/xen-acpi-processor.c | |||
@@ -500,16 +500,16 @@ static int __init xen_acpi_processor_init(void) | |||
500 | (void)acpi_processor_preregister_performance(acpi_perf_data); | 500 | (void)acpi_processor_preregister_performance(acpi_perf_data); |
501 | 501 | ||
502 | for_each_possible_cpu(i) { | 502 | for_each_possible_cpu(i) { |
503 | struct acpi_processor *pr; | ||
503 | struct acpi_processor_performance *perf; | 504 | struct acpi_processor_performance *perf; |
504 | 505 | ||
506 | pr = per_cpu(processors, i); | ||
505 | perf = per_cpu_ptr(acpi_perf_data, i); | 507 | perf = per_cpu_ptr(acpi_perf_data, i); |
506 | rc = acpi_processor_register_performance(perf, i); | 508 | pr->performance = perf; |
509 | rc = acpi_processor_get_performance_info(pr); | ||
507 | if (rc) | 510 | if (rc) |
508 | goto err_out; | 511 | goto err_out; |
509 | } | 512 | } |
510 | rc = acpi_processor_notify_smm(THIS_MODULE); | ||
511 | if (rc) | ||
512 | goto err_unregister; | ||
513 | 513 | ||
514 | for_each_possible_cpu(i) { | 514 | for_each_possible_cpu(i) { |
515 | struct acpi_processor *_pr; | 515 | struct acpi_processor *_pr; |
diff --git a/drivers/xen/xen-pciback/pciback_ops.c b/drivers/xen/xen-pciback/pciback_ops.c index 37c1f825f513..b98cf0c35725 100644 --- a/drivers/xen/xen-pciback/pciback_ops.c +++ b/drivers/xen/xen-pciback/pciback_ops.c | |||
@@ -113,7 +113,8 @@ void xen_pcibk_reset_device(struct pci_dev *dev) | |||
113 | if (dev->msi_enabled) | 113 | if (dev->msi_enabled) |
114 | pci_disable_msi(dev); | 114 | pci_disable_msi(dev); |
115 | #endif | 115 | #endif |
116 | pci_disable_device(dev); | 116 | if (pci_is_enabled(dev)) |
117 | pci_disable_device(dev); | ||
117 | 118 | ||
118 | pci_write_config_word(dev, PCI_COMMAND, 0); | 119 | pci_write_config_word(dev, PCI_COMMAND, 0); |
119 | 120 | ||
diff --git a/drivers/xen/xen-stub.c b/drivers/xen/xen-stub.c index d85e411cbf89..bbef194c5b01 100644 --- a/drivers/xen/xen-stub.c +++ b/drivers/xen/xen-stub.c | |||
@@ -25,7 +25,6 @@ | |||
25 | #include <linux/export.h> | 25 | #include <linux/export.h> |
26 | #include <linux/types.h> | 26 | #include <linux/types.h> |
27 | #include <linux/acpi.h> | 27 | #include <linux/acpi.h> |
28 | #include <acpi/acpi_drivers.h> | ||
29 | #include <xen/acpi.h> | 28 | #include <xen/acpi.h> |
30 | 29 | ||
31 | #ifdef CONFIG_ACPI | 30 | #ifdef CONFIG_ACPI |
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index 3e074dab2d57..9ac2eca681eb 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c | |||
@@ -1467,8 +1467,11 @@ int lookup_inline_extent_backref(struct btrfs_trans_handle *trans, | |||
1467 | if (ret && !insert) { | 1467 | if (ret && !insert) { |
1468 | err = -ENOENT; | 1468 | err = -ENOENT; |
1469 | goto out; | 1469 | goto out; |
1470 | } else if (ret) { | ||
1471 | err = -EIO; | ||
1472 | WARN_ON(1); | ||
1473 | goto out; | ||
1470 | } | 1474 | } |
1471 | BUG_ON(ret); /* Corruption */ | ||
1472 | 1475 | ||
1473 | leaf = path->nodes[0]; | 1476 | leaf = path->nodes[0]; |
1474 | item_size = btrfs_item_size_nr(leaf, path->slots[0]); | 1477 | item_size = btrfs_item_size_nr(leaf, path->slots[0]); |
diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c index af1d0605a5c1..5b4ea5f55b8f 100644 --- a/fs/btrfs/file.c +++ b/fs/btrfs/file.c | |||
@@ -591,6 +591,7 @@ void btrfs_drop_extent_cache(struct inode *inode, u64 start, u64 end, | |||
591 | } | 591 | } |
592 | compressed = test_bit(EXTENT_FLAG_COMPRESSED, &em->flags); | 592 | compressed = test_bit(EXTENT_FLAG_COMPRESSED, &em->flags); |
593 | clear_bit(EXTENT_FLAG_PINNED, &em->flags); | 593 | clear_bit(EXTENT_FLAG_PINNED, &em->flags); |
594 | clear_bit(EXTENT_FLAG_LOGGING, &flags); | ||
594 | remove_extent_mapping(em_tree, em); | 595 | remove_extent_mapping(em_tree, em); |
595 | if (no_splits) | 596 | if (no_splits) |
596 | goto next; | 597 | goto next; |
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index d1470adca8f8..ca1b767d51f7 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c | |||
@@ -2312,6 +2312,7 @@ again: | |||
2312 | key.type = BTRFS_EXTENT_DATA_KEY; | 2312 | key.type = BTRFS_EXTENT_DATA_KEY; |
2313 | key.offset = start; | 2313 | key.offset = start; |
2314 | 2314 | ||
2315 | path->leave_spinning = 1; | ||
2315 | if (merge) { | 2316 | if (merge) { |
2316 | struct btrfs_file_extent_item *fi; | 2317 | struct btrfs_file_extent_item *fi; |
2317 | u64 extent_len; | 2318 | u64 extent_len; |
@@ -2368,6 +2369,7 @@ again: | |||
2368 | 2369 | ||
2369 | btrfs_mark_buffer_dirty(leaf); | 2370 | btrfs_mark_buffer_dirty(leaf); |
2370 | inode_add_bytes(inode, len); | 2371 | inode_add_bytes(inode, len); |
2372 | btrfs_release_path(path); | ||
2371 | 2373 | ||
2372 | ret = btrfs_inc_extent_ref(trans, root, new->bytenr, | 2374 | ret = btrfs_inc_extent_ref(trans, root, new->bytenr, |
2373 | new->disk_len, 0, | 2375 | new->disk_len, 0, |
@@ -2381,6 +2383,7 @@ again: | |||
2381 | ret = 1; | 2383 | ret = 1; |
2382 | out_free_path: | 2384 | out_free_path: |
2383 | btrfs_release_path(path); | 2385 | btrfs_release_path(path); |
2386 | path->leave_spinning = 0; | ||
2384 | btrfs_end_transaction(trans, root); | 2387 | btrfs_end_transaction(trans, root); |
2385 | out_unlock: | 2388 | out_unlock: |
2386 | unlock_extent_cached(&BTRFS_I(inode)->io_tree, lock_start, lock_end, | 2389 | unlock_extent_cached(&BTRFS_I(inode)->io_tree, lock_start, lock_end, |
diff --git a/fs/btrfs/locking.h b/fs/btrfs/locking.h index ca52681e5f40..b81e0e9a4894 100644 --- a/fs/btrfs/locking.h +++ b/fs/btrfs/locking.h | |||
@@ -26,7 +26,6 @@ | |||
26 | 26 | ||
27 | void btrfs_tree_lock(struct extent_buffer *eb); | 27 | void btrfs_tree_lock(struct extent_buffer *eb); |
28 | void btrfs_tree_unlock(struct extent_buffer *eb); | 28 | void btrfs_tree_unlock(struct extent_buffer *eb); |
29 | int btrfs_try_spin_lock(struct extent_buffer *eb); | ||
30 | 29 | ||
31 | void btrfs_tree_read_lock(struct extent_buffer *eb); | 30 | void btrfs_tree_read_lock(struct extent_buffer *eb); |
32 | void btrfs_tree_read_unlock(struct extent_buffer *eb); | 31 | void btrfs_tree_read_unlock(struct extent_buffer *eb); |
diff --git a/fs/btrfs/qgroup.c b/fs/btrfs/qgroup.c index aee4b1cc3d98..5471e47d6559 100644 --- a/fs/btrfs/qgroup.c +++ b/fs/btrfs/qgroup.c | |||
@@ -1525,21 +1525,23 @@ int btrfs_qgroup_reserve(struct btrfs_root *root, u64 num_bytes) | |||
1525 | 1525 | ||
1526 | if ((qg->lim_flags & BTRFS_QGROUP_LIMIT_MAX_RFER) && | 1526 | if ((qg->lim_flags & BTRFS_QGROUP_LIMIT_MAX_RFER) && |
1527 | qg->reserved + qg->rfer + num_bytes > | 1527 | qg->reserved + qg->rfer + num_bytes > |
1528 | qg->max_rfer) | 1528 | qg->max_rfer) { |
1529 | ret = -EDQUOT; | 1529 | ret = -EDQUOT; |
1530 | goto out; | ||
1531 | } | ||
1530 | 1532 | ||
1531 | if ((qg->lim_flags & BTRFS_QGROUP_LIMIT_MAX_EXCL) && | 1533 | if ((qg->lim_flags & BTRFS_QGROUP_LIMIT_MAX_EXCL) && |
1532 | qg->reserved + qg->excl + num_bytes > | 1534 | qg->reserved + qg->excl + num_bytes > |
1533 | qg->max_excl) | 1535 | qg->max_excl) { |
1534 | ret = -EDQUOT; | 1536 | ret = -EDQUOT; |
1537 | goto out; | ||
1538 | } | ||
1535 | 1539 | ||
1536 | list_for_each_entry(glist, &qg->groups, next_group) { | 1540 | list_for_each_entry(glist, &qg->groups, next_group) { |
1537 | ulist_add(ulist, glist->group->qgroupid, | 1541 | ulist_add(ulist, glist->group->qgroupid, |
1538 | (uintptr_t)glist->group, GFP_ATOMIC); | 1542 | (uintptr_t)glist->group, GFP_ATOMIC); |
1539 | } | 1543 | } |
1540 | } | 1544 | } |
1541 | if (ret) | ||
1542 | goto out; | ||
1543 | 1545 | ||
1544 | /* | 1546 | /* |
1545 | * no limits exceeded, now record the reservation into all qgroups | 1547 | * no limits exceeded, now record the reservation into all qgroups |
diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c index 9250b9c4f01e..50767bbaad6c 100644 --- a/fs/btrfs/transaction.c +++ b/fs/btrfs/transaction.c | |||
@@ -625,14 +625,13 @@ static int __btrfs_end_transaction(struct btrfs_trans_handle *trans, | |||
625 | 625 | ||
626 | btrfs_trans_release_metadata(trans, root); | 626 | btrfs_trans_release_metadata(trans, root); |
627 | trans->block_rsv = NULL; | 627 | trans->block_rsv = NULL; |
628 | /* | ||
629 | * the same root has to be passed to start_transaction and | ||
630 | * end_transaction. Subvolume quota depends on this. | ||
631 | */ | ||
632 | WARN_ON(trans->root != root); | ||
633 | 628 | ||
634 | if (trans->qgroup_reserved) { | 629 | if (trans->qgroup_reserved) { |
635 | btrfs_qgroup_free(root, trans->qgroup_reserved); | 630 | /* |
631 | * the same root has to be passed here between start_transaction | ||
632 | * and end_transaction. Subvolume quota depends on this. | ||
633 | */ | ||
634 | btrfs_qgroup_free(trans->root, trans->qgroup_reserved); | ||
636 | trans->qgroup_reserved = 0; | 635 | trans->qgroup_reserved = 0; |
637 | } | 636 | } |
638 | 637 | ||
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index 6b9cff42265d..5989a92236f7 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c | |||
@@ -684,6 +684,12 @@ int btrfs_close_devices(struct btrfs_fs_devices *fs_devices) | |||
684 | __btrfs_close_devices(fs_devices); | 684 | __btrfs_close_devices(fs_devices); |
685 | free_fs_devices(fs_devices); | 685 | free_fs_devices(fs_devices); |
686 | } | 686 | } |
687 | /* | ||
688 | * Wait for rcu kworkers under __btrfs_close_devices | ||
689 | * to finish all blkdev_puts so device is really | ||
690 | * free when umount is done. | ||
691 | */ | ||
692 | rcu_barrier(); | ||
687 | return ret; | 693 | return ret; |
688 | } | 694 | } |
689 | 695 | ||
diff --git a/fs/cifs/asn1.c b/fs/cifs/asn1.c index cfd1ce34e0bc..1d36db114772 100644 --- a/fs/cifs/asn1.c +++ b/fs/cifs/asn1.c | |||
@@ -614,53 +614,10 @@ decode_negTokenInit(unsigned char *security_blob, int length, | |||
614 | } | 614 | } |
615 | } | 615 | } |
616 | 616 | ||
617 | /* mechlistMIC */ | 617 | /* |
618 | if (asn1_header_decode(&ctx, &end, &cls, &con, &tag) == 0) { | 618 | * We currently ignore anything at the end of the SPNEGO blob after |
619 | /* Check if we have reached the end of the blob, but with | 619 | * the mechTypes have been parsed, since none of that info is |
620 | no mechListMic (e.g. NTLMSSP instead of KRB5) */ | 620 | * used at the moment. |
621 | if (ctx.error == ASN1_ERR_DEC_EMPTY) | 621 | */ |
622 | goto decode_negtoken_exit; | ||
623 | cFYI(1, "Error decoding last part negTokenInit exit3"); | ||
624 | return 0; | ||
625 | } else if ((cls != ASN1_CTX) || (con != ASN1_CON)) { | ||
626 | /* tag = 3 indicating mechListMIC */ | ||
627 | cFYI(1, "Exit 4 cls = %d con = %d tag = %d end = %p (%d)", | ||
628 | cls, con, tag, end, *end); | ||
629 | return 0; | ||
630 | } | ||
631 | |||
632 | /* sequence */ | ||
633 | if (asn1_header_decode(&ctx, &end, &cls, &con, &tag) == 0) { | ||
634 | cFYI(1, "Error decoding last part negTokenInit exit5"); | ||
635 | return 0; | ||
636 | } else if ((cls != ASN1_UNI) || (con != ASN1_CON) | ||
637 | || (tag != ASN1_SEQ)) { | ||
638 | cFYI(1, "cls = %d con = %d tag = %d end = %p (%d)", | ||
639 | cls, con, tag, end, *end); | ||
640 | } | ||
641 | |||
642 | /* sequence of */ | ||
643 | if (asn1_header_decode(&ctx, &end, &cls, &con, &tag) == 0) { | ||
644 | cFYI(1, "Error decoding last part negTokenInit exit 7"); | ||
645 | return 0; | ||
646 | } else if ((cls != ASN1_CTX) || (con != ASN1_CON)) { | ||
647 | cFYI(1, "Exit 8 cls = %d con = %d tag = %d end = %p (%d)", | ||
648 | cls, con, tag, end, *end); | ||
649 | return 0; | ||
650 | } | ||
651 | |||
652 | /* general string */ | ||
653 | if (asn1_header_decode(&ctx, &end, &cls, &con, &tag) == 0) { | ||
654 | cFYI(1, "Error decoding last part negTokenInit exit9"); | ||
655 | return 0; | ||
656 | } else if ((cls != ASN1_UNI) || (con != ASN1_PRI) | ||
657 | || (tag != ASN1_GENSTR)) { | ||
658 | cFYI(1, "Exit10 cls = %d con = %d tag = %d end = %p (%d)", | ||
659 | cls, con, tag, end, *end); | ||
660 | return 0; | ||
661 | } | ||
662 | cFYI(1, "Need to call asn1_octets_decode() function for %s", | ||
663 | ctx.pointer); /* is this UTF-8 or ASCII? */ | ||
664 | decode_negtoken_exit: | ||
665 | return 1; | 622 | return 1; |
666 | } | 623 | } |
diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c index 1a052c0eee8e..345fc89c4286 100644 --- a/fs/cifs/cifsfs.c +++ b/fs/cifs/cifsfs.c | |||
@@ -91,6 +91,30 @@ struct workqueue_struct *cifsiod_wq; | |||
91 | __u8 cifs_client_guid[SMB2_CLIENT_GUID_SIZE]; | 91 | __u8 cifs_client_guid[SMB2_CLIENT_GUID_SIZE]; |
92 | #endif | 92 | #endif |
93 | 93 | ||
94 | /* | ||
95 | * Bumps refcount for cifs super block. | ||
96 | * Note that it should be only called if a referece to VFS super block is | ||
97 | * already held, e.g. in open-type syscalls context. Otherwise it can race with | ||
98 | * atomic_dec_and_test in deactivate_locked_super. | ||
99 | */ | ||
100 | void | ||
101 | cifs_sb_active(struct super_block *sb) | ||
102 | { | ||
103 | struct cifs_sb_info *server = CIFS_SB(sb); | ||
104 | |||
105 | if (atomic_inc_return(&server->active) == 1) | ||
106 | atomic_inc(&sb->s_active); | ||
107 | } | ||
108 | |||
109 | void | ||
110 | cifs_sb_deactive(struct super_block *sb) | ||
111 | { | ||
112 | struct cifs_sb_info *server = CIFS_SB(sb); | ||
113 | |||
114 | if (atomic_dec_and_test(&server->active)) | ||
115 | deactivate_super(sb); | ||
116 | } | ||
117 | |||
94 | static int | 118 | static int |
95 | cifs_read_super(struct super_block *sb) | 119 | cifs_read_super(struct super_block *sb) |
96 | { | 120 | { |
@@ -777,6 +801,7 @@ struct file_system_type cifs_fs_type = { | |||
777 | .kill_sb = cifs_kill_sb, | 801 | .kill_sb = cifs_kill_sb, |
778 | /* .fs_flags */ | 802 | /* .fs_flags */ |
779 | }; | 803 | }; |
804 | MODULE_ALIAS_FS("cifs"); | ||
780 | const struct inode_operations cifs_dir_inode_ops = { | 805 | const struct inode_operations cifs_dir_inode_ops = { |
781 | .create = cifs_create, | 806 | .create = cifs_create, |
782 | .atomic_open = cifs_atomic_open, | 807 | .atomic_open = cifs_atomic_open, |
diff --git a/fs/cifs/cifsfs.h b/fs/cifs/cifsfs.h index 7163419cecd9..0e32c3446ce9 100644 --- a/fs/cifs/cifsfs.h +++ b/fs/cifs/cifsfs.h | |||
@@ -41,6 +41,10 @@ extern struct file_system_type cifs_fs_type; | |||
41 | extern const struct address_space_operations cifs_addr_ops; | 41 | extern const struct address_space_operations cifs_addr_ops; |
42 | extern const struct address_space_operations cifs_addr_ops_smallbuf; | 42 | extern const struct address_space_operations cifs_addr_ops_smallbuf; |
43 | 43 | ||
44 | /* Functions related to super block operations */ | ||
45 | extern void cifs_sb_active(struct super_block *sb); | ||
46 | extern void cifs_sb_deactive(struct super_block *sb); | ||
47 | |||
44 | /* Functions related to inodes */ | 48 | /* Functions related to inodes */ |
45 | extern const struct inode_operations cifs_dir_inode_ops; | 49 | extern const struct inode_operations cifs_dir_inode_ops; |
46 | extern struct inode *cifs_root_iget(struct super_block *); | 50 | extern struct inode *cifs_root_iget(struct super_block *); |
diff --git a/fs/cifs/file.c b/fs/cifs/file.c index 8c0d85577314..7a0dd99e4507 100644 --- a/fs/cifs/file.c +++ b/fs/cifs/file.c | |||
@@ -300,6 +300,8 @@ cifs_new_fileinfo(struct cifs_fid *fid, struct file *file, | |||
300 | INIT_WORK(&cfile->oplock_break, cifs_oplock_break); | 300 | INIT_WORK(&cfile->oplock_break, cifs_oplock_break); |
301 | mutex_init(&cfile->fh_mutex); | 301 | mutex_init(&cfile->fh_mutex); |
302 | 302 | ||
303 | cifs_sb_active(inode->i_sb); | ||
304 | |||
303 | /* | 305 | /* |
304 | * If the server returned a read oplock and we have mandatory brlocks, | 306 | * If the server returned a read oplock and we have mandatory brlocks, |
305 | * set oplock level to None. | 307 | * set oplock level to None. |
@@ -349,7 +351,8 @@ void cifsFileInfo_put(struct cifsFileInfo *cifs_file) | |||
349 | struct cifs_tcon *tcon = tlink_tcon(cifs_file->tlink); | 351 | struct cifs_tcon *tcon = tlink_tcon(cifs_file->tlink); |
350 | struct TCP_Server_Info *server = tcon->ses->server; | 352 | struct TCP_Server_Info *server = tcon->ses->server; |
351 | struct cifsInodeInfo *cifsi = CIFS_I(inode); | 353 | struct cifsInodeInfo *cifsi = CIFS_I(inode); |
352 | struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb); | 354 | struct super_block *sb = inode->i_sb; |
355 | struct cifs_sb_info *cifs_sb = CIFS_SB(sb); | ||
353 | struct cifsLockInfo *li, *tmp; | 356 | struct cifsLockInfo *li, *tmp; |
354 | struct cifs_fid fid; | 357 | struct cifs_fid fid; |
355 | struct cifs_pending_open open; | 358 | struct cifs_pending_open open; |
@@ -414,6 +417,7 @@ void cifsFileInfo_put(struct cifsFileInfo *cifs_file) | |||
414 | 417 | ||
415 | cifs_put_tlink(cifs_file->tlink); | 418 | cifs_put_tlink(cifs_file->tlink); |
416 | dput(cifs_file->dentry); | 419 | dput(cifs_file->dentry); |
420 | cifs_sb_deactive(sb); | ||
417 | kfree(cifs_file); | 421 | kfree(cifs_file); |
418 | } | 422 | } |
419 | 423 | ||
diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c index 0079696305c9..20887bf63121 100644 --- a/fs/cifs/inode.c +++ b/fs/cifs/inode.c | |||
@@ -1043,7 +1043,7 @@ cifs_rename_pending_delete(const char *full_path, struct dentry *dentry, | |||
1043 | cifs_sb->mnt_cifs_flags & | 1043 | cifs_sb->mnt_cifs_flags & |
1044 | CIFS_MOUNT_MAP_SPECIAL_CHR); | 1044 | CIFS_MOUNT_MAP_SPECIAL_CHR); |
1045 | if (rc != 0) { | 1045 | if (rc != 0) { |
1046 | rc = -ETXTBSY; | 1046 | rc = -EBUSY; |
1047 | goto undo_setattr; | 1047 | goto undo_setattr; |
1048 | } | 1048 | } |
1049 | 1049 | ||
@@ -1062,7 +1062,7 @@ cifs_rename_pending_delete(const char *full_path, struct dentry *dentry, | |||
1062 | if (rc == -ENOENT) | 1062 | if (rc == -ENOENT) |
1063 | rc = 0; | 1063 | rc = 0; |
1064 | else if (rc != 0) { | 1064 | else if (rc != 0) { |
1065 | rc = -ETXTBSY; | 1065 | rc = -EBUSY; |
1066 | goto undo_rename; | 1066 | goto undo_rename; |
1067 | } | 1067 | } |
1068 | cifsInode->delete_pending = true; | 1068 | cifsInode->delete_pending = true; |
@@ -1169,15 +1169,13 @@ psx_del_no_retry: | |||
1169 | cifs_drop_nlink(inode); | 1169 | cifs_drop_nlink(inode); |
1170 | } else if (rc == -ENOENT) { | 1170 | } else if (rc == -ENOENT) { |
1171 | d_drop(dentry); | 1171 | d_drop(dentry); |
1172 | } else if (rc == -ETXTBSY) { | 1172 | } else if (rc == -EBUSY) { |
1173 | if (server->ops->rename_pending_delete) { | 1173 | if (server->ops->rename_pending_delete) { |
1174 | rc = server->ops->rename_pending_delete(full_path, | 1174 | rc = server->ops->rename_pending_delete(full_path, |
1175 | dentry, xid); | 1175 | dentry, xid); |
1176 | if (rc == 0) | 1176 | if (rc == 0) |
1177 | cifs_drop_nlink(inode); | 1177 | cifs_drop_nlink(inode); |
1178 | } | 1178 | } |
1179 | if (rc == -ETXTBSY) | ||
1180 | rc = -EBUSY; | ||
1181 | } else if ((rc == -EACCES) && (dosattr == 0) && inode) { | 1179 | } else if ((rc == -EACCES) && (dosattr == 0) && inode) { |
1182 | attrs = kzalloc(sizeof(*attrs), GFP_KERNEL); | 1180 | attrs = kzalloc(sizeof(*attrs), GFP_KERNEL); |
1183 | if (attrs == NULL) { | 1181 | if (attrs == NULL) { |
@@ -1518,7 +1516,7 @@ cifs_do_rename(const unsigned int xid, struct dentry *from_dentry, | |||
1518 | * source. Note that cross directory moves do not work with | 1516 | * source. Note that cross directory moves do not work with |
1519 | * rename by filehandle to various Windows servers. | 1517 | * rename by filehandle to various Windows servers. |
1520 | */ | 1518 | */ |
1521 | if (rc == 0 || rc != -ETXTBSY) | 1519 | if (rc == 0 || rc != -EBUSY) |
1522 | goto do_rename_exit; | 1520 | goto do_rename_exit; |
1523 | 1521 | ||
1524 | /* open-file renames don't work across directories */ | 1522 | /* open-file renames don't work across directories */ |
diff --git a/fs/cifs/netmisc.c b/fs/cifs/netmisc.c index a82bc51fdc82..c0b25b28be6c 100644 --- a/fs/cifs/netmisc.c +++ b/fs/cifs/netmisc.c | |||
@@ -62,7 +62,7 @@ static const struct smb_to_posix_error mapping_table_ERRDOS[] = { | |||
62 | {ERRdiffdevice, -EXDEV}, | 62 | {ERRdiffdevice, -EXDEV}, |
63 | {ERRnofiles, -ENOENT}, | 63 | {ERRnofiles, -ENOENT}, |
64 | {ERRwriteprot, -EROFS}, | 64 | {ERRwriteprot, -EROFS}, |
65 | {ERRbadshare, -ETXTBSY}, | 65 | {ERRbadshare, -EBUSY}, |
66 | {ERRlock, -EACCES}, | 66 | {ERRlock, -EACCES}, |
67 | {ERRunsup, -EINVAL}, | 67 | {ERRunsup, -EINVAL}, |
68 | {ERRnosuchshare, -ENXIO}, | 68 | {ERRnosuchshare, -ENXIO}, |
diff --git a/fs/compat.c b/fs/compat.c index fe40fde29111..d487985dd0ea 100644 --- a/fs/compat.c +++ b/fs/compat.c | |||
@@ -558,6 +558,10 @@ ssize_t compat_rw_copy_check_uvector(int type, | |||
558 | } | 558 | } |
559 | *ret_pointer = iov; | 559 | *ret_pointer = iov; |
560 | 560 | ||
561 | ret = -EFAULT; | ||
562 | if (!access_ok(VERIFY_READ, uvector, nr_segs*sizeof(*uvector))) | ||
563 | goto out; | ||
564 | |||
561 | /* | 565 | /* |
562 | * Single unix specification: | 566 | * Single unix specification: |
563 | * We should -EINVAL if an element length is not >= 0 and fitting an | 567 | * We should -EINVAL if an element length is not >= 0 and fitting an |
@@ -1080,17 +1084,12 @@ static ssize_t compat_do_readv_writev(int type, struct file *file, | |||
1080 | if (!file->f_op) | 1084 | if (!file->f_op) |
1081 | goto out; | 1085 | goto out; |
1082 | 1086 | ||
1083 | ret = -EFAULT; | 1087 | ret = compat_rw_copy_check_uvector(type, uvector, nr_segs, |
1084 | if (!access_ok(VERIFY_READ, uvector, nr_segs*sizeof(*uvector))) | ||
1085 | goto out; | ||
1086 | |||
1087 | tot_len = compat_rw_copy_check_uvector(type, uvector, nr_segs, | ||
1088 | UIO_FASTIOV, iovstack, &iov); | 1088 | UIO_FASTIOV, iovstack, &iov); |
1089 | if (tot_len == 0) { | 1089 | if (ret <= 0) |
1090 | ret = 0; | ||
1091 | goto out; | 1090 | goto out; |
1092 | } | ||
1093 | 1091 | ||
1092 | tot_len = ret; | ||
1094 | ret = rw_verify_area(type, file, pos, tot_len); | 1093 | ret = rw_verify_area(type, file, pos, tot_len); |
1095 | if (ret < 0) | 1094 | if (ret < 0) |
1096 | goto out; | 1095 | goto out; |
diff --git a/fs/ext2/ialloc.c b/fs/ext2/ialloc.c index 8f370e012e61..7cadd823bb31 100644 --- a/fs/ext2/ialloc.c +++ b/fs/ext2/ialloc.c | |||
@@ -118,7 +118,6 @@ void ext2_free_inode (struct inode * inode) | |||
118 | * as writing the quota to disk may need the lock as well. | 118 | * as writing the quota to disk may need the lock as well. |
119 | */ | 119 | */ |
120 | /* Quota is already initialized in iput() */ | 120 | /* Quota is already initialized in iput() */ |
121 | ext2_xattr_delete_inode(inode); | ||
122 | dquot_free_inode(inode); | 121 | dquot_free_inode(inode); |
123 | dquot_drop(inode); | 122 | dquot_drop(inode); |
124 | 123 | ||
diff --git a/fs/ext2/inode.c b/fs/ext2/inode.c index c3881e56662e..fe60cc1117d8 100644 --- a/fs/ext2/inode.c +++ b/fs/ext2/inode.c | |||
@@ -34,6 +34,7 @@ | |||
34 | #include "ext2.h" | 34 | #include "ext2.h" |
35 | #include "acl.h" | 35 | #include "acl.h" |
36 | #include "xip.h" | 36 | #include "xip.h" |
37 | #include "xattr.h" | ||
37 | 38 | ||
38 | static int __ext2_write_inode(struct inode *inode, int do_sync); | 39 | static int __ext2_write_inode(struct inode *inode, int do_sync); |
39 | 40 | ||
@@ -88,6 +89,7 @@ void ext2_evict_inode(struct inode * inode) | |||
88 | inode->i_size = 0; | 89 | inode->i_size = 0; |
89 | if (inode->i_blocks) | 90 | if (inode->i_blocks) |
90 | ext2_truncate_blocks(inode, 0); | 91 | ext2_truncate_blocks(inode, 0); |
92 | ext2_xattr_delete_inode(inode); | ||
91 | } | 93 | } |
92 | 94 | ||
93 | invalidate_inode_buffers(inode); | 95 | invalidate_inode_buffers(inode); |
diff --git a/fs/ext3/super.c b/fs/ext3/super.c index 1d6e2ed85322..fb5120a5505c 100644 --- a/fs/ext3/super.c +++ b/fs/ext3/super.c | |||
@@ -353,7 +353,7 @@ static struct block_device *ext3_blkdev_get(dev_t dev, struct super_block *sb) | |||
353 | return bdev; | 353 | return bdev; |
354 | 354 | ||
355 | fail: | 355 | fail: |
356 | ext3_msg(sb, "error: failed to open journal device %s: %ld", | 356 | ext3_msg(sb, KERN_ERR, "error: failed to open journal device %s: %ld", |
357 | __bdevname(dev, b), PTR_ERR(bdev)); | 357 | __bdevname(dev, b), PTR_ERR(bdev)); |
358 | 358 | ||
359 | return NULL; | 359 | return NULL; |
@@ -887,7 +887,7 @@ static ext3_fsblk_t get_sb_block(void **data, struct super_block *sb) | |||
887 | /*todo: use simple_strtoll with >32bit ext3 */ | 887 | /*todo: use simple_strtoll with >32bit ext3 */ |
888 | sb_block = simple_strtoul(options, &options, 0); | 888 | sb_block = simple_strtoul(options, &options, 0); |
889 | if (*options && *options != ',') { | 889 | if (*options && *options != ',') { |
890 | ext3_msg(sb, "error: invalid sb specification: %s", | 890 | ext3_msg(sb, KERN_ERR, "error: invalid sb specification: %s", |
891 | (char *) *data); | 891 | (char *) *data); |
892 | return 1; | 892 | return 1; |
893 | } | 893 | } |
diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h index 4a01ba315262..3b83cd604796 100644 --- a/fs/ext4/ext4.h +++ b/fs/ext4/ext4.h | |||
@@ -335,9 +335,9 @@ struct ext4_group_desc | |||
335 | */ | 335 | */ |
336 | 336 | ||
337 | struct flex_groups { | 337 | struct flex_groups { |
338 | atomic_t free_inodes; | 338 | atomic64_t free_clusters; |
339 | atomic_t free_clusters; | 339 | atomic_t free_inodes; |
340 | atomic_t used_dirs; | 340 | atomic_t used_dirs; |
341 | }; | 341 | }; |
342 | 342 | ||
343 | #define EXT4_BG_INODE_UNINIT 0x0001 /* Inode table/bitmap not in use */ | 343 | #define EXT4_BG_INODE_UNINIT 0x0001 /* Inode table/bitmap not in use */ |
@@ -2617,7 +2617,7 @@ extern int ext4_move_extents(struct file *o_filp, struct file *d_filp, | |||
2617 | extern int __init ext4_init_pageio(void); | 2617 | extern int __init ext4_init_pageio(void); |
2618 | extern void ext4_add_complete_io(ext4_io_end_t *io_end); | 2618 | extern void ext4_add_complete_io(ext4_io_end_t *io_end); |
2619 | extern void ext4_exit_pageio(void); | 2619 | extern void ext4_exit_pageio(void); |
2620 | extern void ext4_ioend_wait(struct inode *); | 2620 | extern void ext4_ioend_shutdown(struct inode *); |
2621 | extern void ext4_free_io_end(ext4_io_end_t *io); | 2621 | extern void ext4_free_io_end(ext4_io_end_t *io); |
2622 | extern ext4_io_end_t *ext4_init_io_end(struct inode *inode, gfp_t flags); | 2622 | extern ext4_io_end_t *ext4_init_io_end(struct inode *inode, gfp_t flags); |
2623 | extern void ext4_end_io_work(struct work_struct *work); | 2623 | extern void ext4_end_io_work(struct work_struct *work); |
diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c index 28dd8eeea6a9..56efcaadf848 100644 --- a/fs/ext4/extents.c +++ b/fs/ext4/extents.c | |||
@@ -1584,10 +1584,12 @@ ext4_can_extents_be_merged(struct inode *inode, struct ext4_extent *ex1, | |||
1584 | unsigned short ext1_ee_len, ext2_ee_len, max_len; | 1584 | unsigned short ext1_ee_len, ext2_ee_len, max_len; |
1585 | 1585 | ||
1586 | /* | 1586 | /* |
1587 | * Make sure that either both extents are uninitialized, or | 1587 | * Make sure that both extents are initialized. We don't merge |
1588 | * both are _not_. | 1588 | * uninitialized extents so that we can be sure that end_io code has |
1589 | * the extent that was written properly split out and conversion to | ||
1590 | * initialized is trivial. | ||
1589 | */ | 1591 | */ |
1590 | if (ext4_ext_is_uninitialized(ex1) ^ ext4_ext_is_uninitialized(ex2)) | 1592 | if (ext4_ext_is_uninitialized(ex1) || ext4_ext_is_uninitialized(ex2)) |
1591 | return 0; | 1593 | return 0; |
1592 | 1594 | ||
1593 | if (ext4_ext_is_uninitialized(ex1)) | 1595 | if (ext4_ext_is_uninitialized(ex1)) |
@@ -2923,7 +2925,7 @@ static int ext4_split_extent_at(handle_t *handle, | |||
2923 | { | 2925 | { |
2924 | ext4_fsblk_t newblock; | 2926 | ext4_fsblk_t newblock; |
2925 | ext4_lblk_t ee_block; | 2927 | ext4_lblk_t ee_block; |
2926 | struct ext4_extent *ex, newex, orig_ex; | 2928 | struct ext4_extent *ex, newex, orig_ex, zero_ex; |
2927 | struct ext4_extent *ex2 = NULL; | 2929 | struct ext4_extent *ex2 = NULL; |
2928 | unsigned int ee_len, depth; | 2930 | unsigned int ee_len, depth; |
2929 | int err = 0; | 2931 | int err = 0; |
@@ -2943,6 +2945,10 @@ static int ext4_split_extent_at(handle_t *handle, | |||
2943 | newblock = split - ee_block + ext4_ext_pblock(ex); | 2945 | newblock = split - ee_block + ext4_ext_pblock(ex); |
2944 | 2946 | ||
2945 | BUG_ON(split < ee_block || split >= (ee_block + ee_len)); | 2947 | BUG_ON(split < ee_block || split >= (ee_block + ee_len)); |
2948 | BUG_ON(!ext4_ext_is_uninitialized(ex) && | ||
2949 | split_flag & (EXT4_EXT_MAY_ZEROOUT | | ||
2950 | EXT4_EXT_MARK_UNINIT1 | | ||
2951 | EXT4_EXT_MARK_UNINIT2)); | ||
2946 | 2952 | ||
2947 | err = ext4_ext_get_access(handle, inode, path + depth); | 2953 | err = ext4_ext_get_access(handle, inode, path + depth); |
2948 | if (err) | 2954 | if (err) |
@@ -2990,12 +2996,26 @@ static int ext4_split_extent_at(handle_t *handle, | |||
2990 | err = ext4_ext_insert_extent(handle, inode, path, &newex, flags); | 2996 | err = ext4_ext_insert_extent(handle, inode, path, &newex, flags); |
2991 | if (err == -ENOSPC && (EXT4_EXT_MAY_ZEROOUT & split_flag)) { | 2997 | if (err == -ENOSPC && (EXT4_EXT_MAY_ZEROOUT & split_flag)) { |
2992 | if (split_flag & (EXT4_EXT_DATA_VALID1|EXT4_EXT_DATA_VALID2)) { | 2998 | if (split_flag & (EXT4_EXT_DATA_VALID1|EXT4_EXT_DATA_VALID2)) { |
2993 | if (split_flag & EXT4_EXT_DATA_VALID1) | 2999 | if (split_flag & EXT4_EXT_DATA_VALID1) { |
2994 | err = ext4_ext_zeroout(inode, ex2); | 3000 | err = ext4_ext_zeroout(inode, ex2); |
2995 | else | 3001 | zero_ex.ee_block = ex2->ee_block; |
3002 | zero_ex.ee_len = ext4_ext_get_actual_len(ex2); | ||
3003 | ext4_ext_store_pblock(&zero_ex, | ||
3004 | ext4_ext_pblock(ex2)); | ||
3005 | } else { | ||
2996 | err = ext4_ext_zeroout(inode, ex); | 3006 | err = ext4_ext_zeroout(inode, ex); |
2997 | } else | 3007 | zero_ex.ee_block = ex->ee_block; |
3008 | zero_ex.ee_len = ext4_ext_get_actual_len(ex); | ||
3009 | ext4_ext_store_pblock(&zero_ex, | ||
3010 | ext4_ext_pblock(ex)); | ||
3011 | } | ||
3012 | } else { | ||
2998 | err = ext4_ext_zeroout(inode, &orig_ex); | 3013 | err = ext4_ext_zeroout(inode, &orig_ex); |
3014 | zero_ex.ee_block = orig_ex.ee_block; | ||
3015 | zero_ex.ee_len = ext4_ext_get_actual_len(&orig_ex); | ||
3016 | ext4_ext_store_pblock(&zero_ex, | ||
3017 | ext4_ext_pblock(&orig_ex)); | ||
3018 | } | ||
2999 | 3019 | ||
3000 | if (err) | 3020 | if (err) |
3001 | goto fix_extent_len; | 3021 | goto fix_extent_len; |
@@ -3003,6 +3023,12 @@ static int ext4_split_extent_at(handle_t *handle, | |||
3003 | ex->ee_len = cpu_to_le16(ee_len); | 3023 | ex->ee_len = cpu_to_le16(ee_len); |
3004 | ext4_ext_try_to_merge(handle, inode, path, ex); | 3024 | ext4_ext_try_to_merge(handle, inode, path, ex); |
3005 | err = ext4_ext_dirty(handle, inode, path + path->p_depth); | 3025 | err = ext4_ext_dirty(handle, inode, path + path->p_depth); |
3026 | if (err) | ||
3027 | goto fix_extent_len; | ||
3028 | |||
3029 | /* update extent status tree */ | ||
3030 | err = ext4_es_zeroout(inode, &zero_ex); | ||
3031 | |||
3006 | goto out; | 3032 | goto out; |
3007 | } else if (err) | 3033 | } else if (err) |
3008 | goto fix_extent_len; | 3034 | goto fix_extent_len; |
@@ -3041,6 +3067,7 @@ static int ext4_split_extent(handle_t *handle, | |||
3041 | int err = 0; | 3067 | int err = 0; |
3042 | int uninitialized; | 3068 | int uninitialized; |
3043 | int split_flag1, flags1; | 3069 | int split_flag1, flags1; |
3070 | int allocated = map->m_len; | ||
3044 | 3071 | ||
3045 | depth = ext_depth(inode); | 3072 | depth = ext_depth(inode); |
3046 | ex = path[depth].p_ext; | 3073 | ex = path[depth].p_ext; |
@@ -3060,20 +3087,29 @@ static int ext4_split_extent(handle_t *handle, | |||
3060 | map->m_lblk + map->m_len, split_flag1, flags1); | 3087 | map->m_lblk + map->m_len, split_flag1, flags1); |
3061 | if (err) | 3088 | if (err) |
3062 | goto out; | 3089 | goto out; |
3090 | } else { | ||
3091 | allocated = ee_len - (map->m_lblk - ee_block); | ||
3063 | } | 3092 | } |
3064 | 3093 | /* | |
3094 | * Update path is required because previous ext4_split_extent_at() may | ||
3095 | * result in split of original leaf or extent zeroout. | ||
3096 | */ | ||
3065 | ext4_ext_drop_refs(path); | 3097 | ext4_ext_drop_refs(path); |
3066 | path = ext4_ext_find_extent(inode, map->m_lblk, path); | 3098 | path = ext4_ext_find_extent(inode, map->m_lblk, path); |
3067 | if (IS_ERR(path)) | 3099 | if (IS_ERR(path)) |
3068 | return PTR_ERR(path); | 3100 | return PTR_ERR(path); |
3101 | depth = ext_depth(inode); | ||
3102 | ex = path[depth].p_ext; | ||
3103 | uninitialized = ext4_ext_is_uninitialized(ex); | ||
3104 | split_flag1 = 0; | ||
3069 | 3105 | ||
3070 | if (map->m_lblk >= ee_block) { | 3106 | if (map->m_lblk >= ee_block) { |
3071 | split_flag1 = split_flag & (EXT4_EXT_MAY_ZEROOUT | | 3107 | split_flag1 = split_flag & EXT4_EXT_DATA_VALID2; |
3072 | EXT4_EXT_DATA_VALID2); | 3108 | if (uninitialized) { |
3073 | if (uninitialized) | ||
3074 | split_flag1 |= EXT4_EXT_MARK_UNINIT1; | 3109 | split_flag1 |= EXT4_EXT_MARK_UNINIT1; |
3075 | if (split_flag & EXT4_EXT_MARK_UNINIT2) | 3110 | split_flag1 |= split_flag & (EXT4_EXT_MAY_ZEROOUT | |
3076 | split_flag1 |= EXT4_EXT_MARK_UNINIT2; | 3111 | EXT4_EXT_MARK_UNINIT2); |
3112 | } | ||
3077 | err = ext4_split_extent_at(handle, inode, path, | 3113 | err = ext4_split_extent_at(handle, inode, path, |
3078 | map->m_lblk, split_flag1, flags); | 3114 | map->m_lblk, split_flag1, flags); |
3079 | if (err) | 3115 | if (err) |
@@ -3082,7 +3118,7 @@ static int ext4_split_extent(handle_t *handle, | |||
3082 | 3118 | ||
3083 | ext4_ext_show_leaf(inode, path); | 3119 | ext4_ext_show_leaf(inode, path); |
3084 | out: | 3120 | out: |
3085 | return err ? err : map->m_len; | 3121 | return err ? err : allocated; |
3086 | } | 3122 | } |
3087 | 3123 | ||
3088 | /* | 3124 | /* |
@@ -3137,6 +3173,7 @@ static int ext4_ext_convert_to_initialized(handle_t *handle, | |||
3137 | ee_block = le32_to_cpu(ex->ee_block); | 3173 | ee_block = le32_to_cpu(ex->ee_block); |
3138 | ee_len = ext4_ext_get_actual_len(ex); | 3174 | ee_len = ext4_ext_get_actual_len(ex); |
3139 | allocated = ee_len - (map->m_lblk - ee_block); | 3175 | allocated = ee_len - (map->m_lblk - ee_block); |
3176 | zero_ex.ee_len = 0; | ||
3140 | 3177 | ||
3141 | trace_ext4_ext_convert_to_initialized_enter(inode, map, ex); | 3178 | trace_ext4_ext_convert_to_initialized_enter(inode, map, ex); |
3142 | 3179 | ||
@@ -3227,13 +3264,16 @@ static int ext4_ext_convert_to_initialized(handle_t *handle, | |||
3227 | 3264 | ||
3228 | if (EXT4_EXT_MAY_ZEROOUT & split_flag) | 3265 | if (EXT4_EXT_MAY_ZEROOUT & split_flag) |
3229 | max_zeroout = sbi->s_extent_max_zeroout_kb >> | 3266 | max_zeroout = sbi->s_extent_max_zeroout_kb >> |
3230 | inode->i_sb->s_blocksize_bits; | 3267 | (inode->i_sb->s_blocksize_bits - 10); |
3231 | 3268 | ||
3232 | /* If extent is less than s_max_zeroout_kb, zeroout directly */ | 3269 | /* If extent is less than s_max_zeroout_kb, zeroout directly */ |
3233 | if (max_zeroout && (ee_len <= max_zeroout)) { | 3270 | if (max_zeroout && (ee_len <= max_zeroout)) { |
3234 | err = ext4_ext_zeroout(inode, ex); | 3271 | err = ext4_ext_zeroout(inode, ex); |
3235 | if (err) | 3272 | if (err) |
3236 | goto out; | 3273 | goto out; |
3274 | zero_ex.ee_block = ex->ee_block; | ||
3275 | zero_ex.ee_len = ext4_ext_get_actual_len(ex); | ||
3276 | ext4_ext_store_pblock(&zero_ex, ext4_ext_pblock(ex)); | ||
3237 | 3277 | ||
3238 | err = ext4_ext_get_access(handle, inode, path + depth); | 3278 | err = ext4_ext_get_access(handle, inode, path + depth); |
3239 | if (err) | 3279 | if (err) |
@@ -3292,6 +3332,9 @@ static int ext4_ext_convert_to_initialized(handle_t *handle, | |||
3292 | err = allocated; | 3332 | err = allocated; |
3293 | 3333 | ||
3294 | out: | 3334 | out: |
3335 | /* If we have gotten a failure, don't zero out status tree */ | ||
3336 | if (!err) | ||
3337 | err = ext4_es_zeroout(inode, &zero_ex); | ||
3295 | return err ? err : allocated; | 3338 | return err ? err : allocated; |
3296 | } | 3339 | } |
3297 | 3340 | ||
@@ -3374,8 +3417,19 @@ static int ext4_convert_unwritten_extents_endio(handle_t *handle, | |||
3374 | "block %llu, max_blocks %u\n", inode->i_ino, | 3417 | "block %llu, max_blocks %u\n", inode->i_ino, |
3375 | (unsigned long long)ee_block, ee_len); | 3418 | (unsigned long long)ee_block, ee_len); |
3376 | 3419 | ||
3377 | /* If extent is larger than requested then split is required */ | 3420 | /* If extent is larger than requested it is a clear sign that we still |
3421 | * have some extent state machine issues left. So extent_split is still | ||
3422 | * required. | ||
3423 | * TODO: Once all related issues will be fixed this situation should be | ||
3424 | * illegal. | ||
3425 | */ | ||
3378 | if (ee_block != map->m_lblk || ee_len > map->m_len) { | 3426 | if (ee_block != map->m_lblk || ee_len > map->m_len) { |
3427 | #ifdef EXT4_DEBUG | ||
3428 | ext4_warning("Inode (%ld) finished: extent logical block %llu," | ||
3429 | " len %u; IO logical block %llu, len %u\n", | ||
3430 | inode->i_ino, (unsigned long long)ee_block, ee_len, | ||
3431 | (unsigned long long)map->m_lblk, map->m_len); | ||
3432 | #endif | ||
3379 | err = ext4_split_unwritten_extents(handle, inode, map, path, | 3433 | err = ext4_split_unwritten_extents(handle, inode, map, path, |
3380 | EXT4_GET_BLOCKS_CONVERT); | 3434 | EXT4_GET_BLOCKS_CONVERT); |
3381 | if (err < 0) | 3435 | if (err < 0) |
@@ -3626,6 +3680,10 @@ ext4_ext_handle_uninitialized_extents(handle_t *handle, struct inode *inode, | |||
3626 | path, map->m_len); | 3680 | path, map->m_len); |
3627 | } else | 3681 | } else |
3628 | err = ret; | 3682 | err = ret; |
3683 | map->m_flags |= EXT4_MAP_MAPPED; | ||
3684 | if (allocated > map->m_len) | ||
3685 | allocated = map->m_len; | ||
3686 | map->m_len = allocated; | ||
3629 | goto out2; | 3687 | goto out2; |
3630 | } | 3688 | } |
3631 | /* buffered IO case */ | 3689 | /* buffered IO case */ |
@@ -3675,6 +3733,7 @@ out: | |||
3675 | allocated - map->m_len); | 3733 | allocated - map->m_len); |
3676 | allocated = map->m_len; | 3734 | allocated = map->m_len; |
3677 | } | 3735 | } |
3736 | map->m_len = allocated; | ||
3678 | 3737 | ||
3679 | /* | 3738 | /* |
3680 | * If we have done fallocate with the offset that is already | 3739 | * If we have done fallocate with the offset that is already |
@@ -4106,9 +4165,6 @@ got_allocated_blocks: | |||
4106 | } | 4165 | } |
4107 | } else { | 4166 | } else { |
4108 | BUG_ON(allocated_clusters < reserved_clusters); | 4167 | BUG_ON(allocated_clusters < reserved_clusters); |
4109 | /* We will claim quota for all newly allocated blocks.*/ | ||
4110 | ext4_da_update_reserve_space(inode, allocated_clusters, | ||
4111 | 1); | ||
4112 | if (reserved_clusters < allocated_clusters) { | 4168 | if (reserved_clusters < allocated_clusters) { |
4113 | struct ext4_inode_info *ei = EXT4_I(inode); | 4169 | struct ext4_inode_info *ei = EXT4_I(inode); |
4114 | int reservation = allocated_clusters - | 4170 | int reservation = allocated_clusters - |
@@ -4159,6 +4215,15 @@ got_allocated_blocks: | |||
4159 | ei->i_reserved_data_blocks += reservation; | 4215 | ei->i_reserved_data_blocks += reservation; |
4160 | spin_unlock(&ei->i_block_reservation_lock); | 4216 | spin_unlock(&ei->i_block_reservation_lock); |
4161 | } | 4217 | } |
4218 | /* | ||
4219 | * We will claim quota for all newly allocated blocks. | ||
4220 | * We're updating the reserved space *after* the | ||
4221 | * correction above so we do not accidentally free | ||
4222 | * all the metadata reservation because we might | ||
4223 | * actually need it later on. | ||
4224 | */ | ||
4225 | ext4_da_update_reserve_space(inode, allocated_clusters, | ||
4226 | 1); | ||
4162 | } | 4227 | } |
4163 | } | 4228 | } |
4164 | 4229 | ||
@@ -4368,8 +4433,6 @@ long ext4_fallocate(struct file *file, int mode, loff_t offset, loff_t len) | |||
4368 | if (len <= EXT_UNINIT_MAX_LEN << blkbits) | 4433 | if (len <= EXT_UNINIT_MAX_LEN << blkbits) |
4369 | flags |= EXT4_GET_BLOCKS_NO_NORMALIZE; | 4434 | flags |= EXT4_GET_BLOCKS_NO_NORMALIZE; |
4370 | 4435 | ||
4371 | /* Prevent race condition between unwritten */ | ||
4372 | ext4_flush_unwritten_io(inode); | ||
4373 | retry: | 4436 | retry: |
4374 | while (ret >= 0 && ret < max_blocks) { | 4437 | while (ret >= 0 && ret < max_blocks) { |
4375 | map.m_lblk = map.m_lblk + ret; | 4438 | map.m_lblk = map.m_lblk + ret; |
diff --git a/fs/ext4/extents_status.c b/fs/ext4/extents_status.c index 95796a1b7522..fe3337a85ede 100644 --- a/fs/ext4/extents_status.c +++ b/fs/ext4/extents_status.c | |||
@@ -333,17 +333,27 @@ static void ext4_es_free_extent(struct inode *inode, struct extent_status *es) | |||
333 | static int ext4_es_can_be_merged(struct extent_status *es1, | 333 | static int ext4_es_can_be_merged(struct extent_status *es1, |
334 | struct extent_status *es2) | 334 | struct extent_status *es2) |
335 | { | 335 | { |
336 | if (es1->es_lblk + es1->es_len != es2->es_lblk) | 336 | if (ext4_es_status(es1) != ext4_es_status(es2)) |
337 | return 0; | 337 | return 0; |
338 | 338 | ||
339 | if (ext4_es_status(es1) != ext4_es_status(es2)) | 339 | if (((__u64) es1->es_len) + es2->es_len > 0xFFFFFFFFULL) |
340 | return 0; | 340 | return 0; |
341 | 341 | ||
342 | if ((ext4_es_is_written(es1) || ext4_es_is_unwritten(es1)) && | 342 | if (((__u64) es1->es_lblk) + es1->es_len != es2->es_lblk) |
343 | (ext4_es_pblock(es1) + es1->es_len != ext4_es_pblock(es2))) | ||
344 | return 0; | 343 | return 0; |
345 | 344 | ||
346 | return 1; | 345 | if ((ext4_es_is_written(es1) || ext4_es_is_unwritten(es1)) && |
346 | (ext4_es_pblock(es1) + es1->es_len == ext4_es_pblock(es2))) | ||
347 | return 1; | ||
348 | |||
349 | if (ext4_es_is_hole(es1)) | ||
350 | return 1; | ||
351 | |||
352 | /* we need to check delayed extent is without unwritten status */ | ||
353 | if (ext4_es_is_delayed(es1) && !ext4_es_is_unwritten(es1)) | ||
354 | return 1; | ||
355 | |||
356 | return 0; | ||
347 | } | 357 | } |
348 | 358 | ||
349 | static struct extent_status * | 359 | static struct extent_status * |
@@ -389,6 +399,179 @@ ext4_es_try_to_merge_right(struct inode *inode, struct extent_status *es) | |||
389 | return es; | 399 | return es; |
390 | } | 400 | } |
391 | 401 | ||
402 | #ifdef ES_AGGRESSIVE_TEST | ||
403 | static void ext4_es_insert_extent_ext_check(struct inode *inode, | ||
404 | struct extent_status *es) | ||
405 | { | ||
406 | struct ext4_ext_path *path = NULL; | ||
407 | struct ext4_extent *ex; | ||
408 | ext4_lblk_t ee_block; | ||
409 | ext4_fsblk_t ee_start; | ||
410 | unsigned short ee_len; | ||
411 | int depth, ee_status, es_status; | ||
412 | |||
413 | path = ext4_ext_find_extent(inode, es->es_lblk, NULL); | ||
414 | if (IS_ERR(path)) | ||
415 | return; | ||
416 | |||
417 | depth = ext_depth(inode); | ||
418 | ex = path[depth].p_ext; | ||
419 | |||
420 | if (ex) { | ||
421 | |||
422 | ee_block = le32_to_cpu(ex->ee_block); | ||
423 | ee_start = ext4_ext_pblock(ex); | ||
424 | ee_len = ext4_ext_get_actual_len(ex); | ||
425 | |||
426 | ee_status = ext4_ext_is_uninitialized(ex) ? 1 : 0; | ||
427 | es_status = ext4_es_is_unwritten(es) ? 1 : 0; | ||
428 | |||
429 | /* | ||
430 | * Make sure ex and es are not overlap when we try to insert | ||
431 | * a delayed/hole extent. | ||
432 | */ | ||
433 | if (!ext4_es_is_written(es) && !ext4_es_is_unwritten(es)) { | ||
434 | if (in_range(es->es_lblk, ee_block, ee_len)) { | ||
435 | pr_warn("ES insert assertation failed for " | ||
436 | "inode: %lu we can find an extent " | ||
437 | "at block [%d/%d/%llu/%c], but we " | ||
438 | "want to add an delayed/hole extent " | ||
439 | "[%d/%d/%llu/%llx]\n", | ||
440 | inode->i_ino, ee_block, ee_len, | ||
441 | ee_start, ee_status ? 'u' : 'w', | ||
442 | es->es_lblk, es->es_len, | ||
443 | ext4_es_pblock(es), ext4_es_status(es)); | ||
444 | } | ||
445 | goto out; | ||
446 | } | ||
447 | |||
448 | /* | ||
449 | * We don't check ee_block == es->es_lblk, etc. because es | ||
450 | * might be a part of whole extent, vice versa. | ||
451 | */ | ||
452 | if (es->es_lblk < ee_block || | ||
453 | ext4_es_pblock(es) != ee_start + es->es_lblk - ee_block) { | ||
454 | pr_warn("ES insert assertation failed for inode: %lu " | ||
455 | "ex_status [%d/%d/%llu/%c] != " | ||
456 | "es_status [%d/%d/%llu/%c]\n", inode->i_ino, | ||
457 | ee_block, ee_len, ee_start, | ||
458 | ee_status ? 'u' : 'w', es->es_lblk, es->es_len, | ||
459 | ext4_es_pblock(es), es_status ? 'u' : 'w'); | ||
460 | goto out; | ||
461 | } | ||
462 | |||
463 | if (ee_status ^ es_status) { | ||
464 | pr_warn("ES insert assertation failed for inode: %lu " | ||
465 | "ex_status [%d/%d/%llu/%c] != " | ||
466 | "es_status [%d/%d/%llu/%c]\n", inode->i_ino, | ||
467 | ee_block, ee_len, ee_start, | ||
468 | ee_status ? 'u' : 'w', es->es_lblk, es->es_len, | ||
469 | ext4_es_pblock(es), es_status ? 'u' : 'w'); | ||
470 | } | ||
471 | } else { | ||
472 | /* | ||
473 | * We can't find an extent on disk. So we need to make sure | ||
474 | * that we don't want to add an written/unwritten extent. | ||
475 | */ | ||
476 | if (!ext4_es_is_delayed(es) && !ext4_es_is_hole(es)) { | ||
477 | pr_warn("ES insert assertation failed for inode: %lu " | ||
478 | "can't find an extent at block %d but we want " | ||
479 | "to add an written/unwritten extent " | ||
480 | "[%d/%d/%llu/%llx]\n", inode->i_ino, | ||
481 | es->es_lblk, es->es_lblk, es->es_len, | ||
482 | ext4_es_pblock(es), ext4_es_status(es)); | ||
483 | } | ||
484 | } | ||
485 | out: | ||
486 | if (path) { | ||
487 | ext4_ext_drop_refs(path); | ||
488 | kfree(path); | ||
489 | } | ||
490 | } | ||
491 | |||
492 | static void ext4_es_insert_extent_ind_check(struct inode *inode, | ||
493 | struct extent_status *es) | ||
494 | { | ||
495 | struct ext4_map_blocks map; | ||
496 | int retval; | ||
497 | |||
498 | /* | ||
499 | * Here we call ext4_ind_map_blocks to lookup a block mapping because | ||
500 | * 'Indirect' structure is defined in indirect.c. So we couldn't | ||
501 | * access direct/indirect tree from outside. It is too dirty to define | ||
502 | * this function in indirect.c file. | ||
503 | */ | ||
504 | |||
505 | map.m_lblk = es->es_lblk; | ||
506 | map.m_len = es->es_len; | ||
507 | |||
508 | retval = ext4_ind_map_blocks(NULL, inode, &map, 0); | ||
509 | if (retval > 0) { | ||
510 | if (ext4_es_is_delayed(es) || ext4_es_is_hole(es)) { | ||
511 | /* | ||
512 | * We want to add a delayed/hole extent but this | ||
513 | * block has been allocated. | ||
514 | */ | ||
515 | pr_warn("ES insert assertation failed for inode: %lu " | ||
516 | "We can find blocks but we want to add a " | ||
517 | "delayed/hole extent [%d/%d/%llu/%llx]\n", | ||
518 | inode->i_ino, es->es_lblk, es->es_len, | ||
519 | ext4_es_pblock(es), ext4_es_status(es)); | ||
520 | return; | ||
521 | } else if (ext4_es_is_written(es)) { | ||
522 | if (retval != es->es_len) { | ||
523 | pr_warn("ES insert assertation failed for " | ||
524 | "inode: %lu retval %d != es_len %d\n", | ||
525 | inode->i_ino, retval, es->es_len); | ||
526 | return; | ||
527 | } | ||
528 | if (map.m_pblk != ext4_es_pblock(es)) { | ||
529 | pr_warn("ES insert assertation failed for " | ||
530 | "inode: %lu m_pblk %llu != " | ||
531 | "es_pblk %llu\n", | ||
532 | inode->i_ino, map.m_pblk, | ||
533 | ext4_es_pblock(es)); | ||
534 | return; | ||
535 | } | ||
536 | } else { | ||
537 | /* | ||
538 | * We don't need to check unwritten extent because | ||
539 | * indirect-based file doesn't have it. | ||
540 | */ | ||
541 | BUG_ON(1); | ||
542 | } | ||
543 | } else if (retval == 0) { | ||
544 | if (ext4_es_is_written(es)) { | ||
545 | pr_warn("ES insert assertation failed for inode: %lu " | ||
546 | "We can't find the block but we want to add " | ||
547 | "an written extent [%d/%d/%llu/%llx]\n", | ||
548 | inode->i_ino, es->es_lblk, es->es_len, | ||
549 | ext4_es_pblock(es), ext4_es_status(es)); | ||
550 | return; | ||
551 | } | ||
552 | } | ||
553 | } | ||
554 | |||
555 | static inline void ext4_es_insert_extent_check(struct inode *inode, | ||
556 | struct extent_status *es) | ||
557 | { | ||
558 | /* | ||
559 | * We don't need to worry about the race condition because | ||
560 | * caller takes i_data_sem locking. | ||
561 | */ | ||
562 | BUG_ON(!rwsem_is_locked(&EXT4_I(inode)->i_data_sem)); | ||
563 | if (ext4_test_inode_flag(inode, EXT4_INODE_EXTENTS)) | ||
564 | ext4_es_insert_extent_ext_check(inode, es); | ||
565 | else | ||
566 | ext4_es_insert_extent_ind_check(inode, es); | ||
567 | } | ||
568 | #else | ||
569 | static inline void ext4_es_insert_extent_check(struct inode *inode, | ||
570 | struct extent_status *es) | ||
571 | { | ||
572 | } | ||
573 | #endif | ||
574 | |||
392 | static int __es_insert_extent(struct inode *inode, struct extent_status *newes) | 575 | static int __es_insert_extent(struct inode *inode, struct extent_status *newes) |
393 | { | 576 | { |
394 | struct ext4_es_tree *tree = &EXT4_I(inode)->i_es_tree; | 577 | struct ext4_es_tree *tree = &EXT4_I(inode)->i_es_tree; |
@@ -471,6 +654,8 @@ int ext4_es_insert_extent(struct inode *inode, ext4_lblk_t lblk, | |||
471 | ext4_es_store_status(&newes, status); | 654 | ext4_es_store_status(&newes, status); |
472 | trace_ext4_es_insert_extent(inode, &newes); | 655 | trace_ext4_es_insert_extent(inode, &newes); |
473 | 656 | ||
657 | ext4_es_insert_extent_check(inode, &newes); | ||
658 | |||
474 | write_lock(&EXT4_I(inode)->i_es_lock); | 659 | write_lock(&EXT4_I(inode)->i_es_lock); |
475 | err = __es_remove_extent(inode, lblk, end); | 660 | err = __es_remove_extent(inode, lblk, end); |
476 | if (err != 0) | 661 | if (err != 0) |
@@ -669,6 +854,23 @@ int ext4_es_remove_extent(struct inode *inode, ext4_lblk_t lblk, | |||
669 | return err; | 854 | return err; |
670 | } | 855 | } |
671 | 856 | ||
857 | int ext4_es_zeroout(struct inode *inode, struct ext4_extent *ex) | ||
858 | { | ||
859 | ext4_lblk_t ee_block; | ||
860 | ext4_fsblk_t ee_pblock; | ||
861 | unsigned int ee_len; | ||
862 | |||
863 | ee_block = le32_to_cpu(ex->ee_block); | ||
864 | ee_len = ext4_ext_get_actual_len(ex); | ||
865 | ee_pblock = ext4_ext_pblock(ex); | ||
866 | |||
867 | if (ee_len == 0) | ||
868 | return 0; | ||
869 | |||
870 | return ext4_es_insert_extent(inode, ee_block, ee_len, ee_pblock, | ||
871 | EXTENT_STATUS_WRITTEN); | ||
872 | } | ||
873 | |||
672 | static int ext4_es_shrink(struct shrinker *shrink, struct shrink_control *sc) | 874 | static int ext4_es_shrink(struct shrinker *shrink, struct shrink_control *sc) |
673 | { | 875 | { |
674 | struct ext4_sb_info *sbi = container_of(shrink, | 876 | struct ext4_sb_info *sbi = container_of(shrink, |
diff --git a/fs/ext4/extents_status.h b/fs/ext4/extents_status.h index f190dfe969da..d8e2d4dc311e 100644 --- a/fs/ext4/extents_status.h +++ b/fs/ext4/extents_status.h | |||
@@ -21,6 +21,12 @@ | |||
21 | #endif | 21 | #endif |
22 | 22 | ||
23 | /* | 23 | /* |
24 | * With ES_AGGRESSIVE_TEST defined, the result of es caching will be | ||
25 | * checked with old map_block's result. | ||
26 | */ | ||
27 | #define ES_AGGRESSIVE_TEST__ | ||
28 | |||
29 | /* | ||
24 | * These flags live in the high bits of extent_status.es_pblk | 30 | * These flags live in the high bits of extent_status.es_pblk |
25 | */ | 31 | */ |
26 | #define EXTENT_STATUS_WRITTEN (1ULL << 63) | 32 | #define EXTENT_STATUS_WRITTEN (1ULL << 63) |
@@ -33,6 +39,8 @@ | |||
33 | EXTENT_STATUS_DELAYED | \ | 39 | EXTENT_STATUS_DELAYED | \ |
34 | EXTENT_STATUS_HOLE) | 40 | EXTENT_STATUS_HOLE) |
35 | 41 | ||
42 | struct ext4_extent; | ||
43 | |||
36 | struct extent_status { | 44 | struct extent_status { |
37 | struct rb_node rb_node; | 45 | struct rb_node rb_node; |
38 | ext4_lblk_t es_lblk; /* first logical block extent covers */ | 46 | ext4_lblk_t es_lblk; /* first logical block extent covers */ |
@@ -58,6 +66,7 @@ extern void ext4_es_find_delayed_extent(struct inode *inode, ext4_lblk_t lblk, | |||
58 | struct extent_status *es); | 66 | struct extent_status *es); |
59 | extern int ext4_es_lookup_extent(struct inode *inode, ext4_lblk_t lblk, | 67 | extern int ext4_es_lookup_extent(struct inode *inode, ext4_lblk_t lblk, |
60 | struct extent_status *es); | 68 | struct extent_status *es); |
69 | extern int ext4_es_zeroout(struct inode *inode, struct ext4_extent *ex); | ||
61 | 70 | ||
62 | static inline int ext4_es_is_written(struct extent_status *es) | 71 | static inline int ext4_es_is_written(struct extent_status *es) |
63 | { | 72 | { |
diff --git a/fs/ext4/ialloc.c b/fs/ext4/ialloc.c index 32fd2b9075dd..6c5bb8d993fe 100644 --- a/fs/ext4/ialloc.c +++ b/fs/ext4/ialloc.c | |||
@@ -324,8 +324,8 @@ error_return: | |||
324 | } | 324 | } |
325 | 325 | ||
326 | struct orlov_stats { | 326 | struct orlov_stats { |
327 | __u64 free_clusters; | ||
327 | __u32 free_inodes; | 328 | __u32 free_inodes; |
328 | __u32 free_clusters; | ||
329 | __u32 used_dirs; | 329 | __u32 used_dirs; |
330 | }; | 330 | }; |
331 | 331 | ||
@@ -342,7 +342,7 @@ static void get_orlov_stats(struct super_block *sb, ext4_group_t g, | |||
342 | 342 | ||
343 | if (flex_size > 1) { | 343 | if (flex_size > 1) { |
344 | stats->free_inodes = atomic_read(&flex_group[g].free_inodes); | 344 | stats->free_inodes = atomic_read(&flex_group[g].free_inodes); |
345 | stats->free_clusters = atomic_read(&flex_group[g].free_clusters); | 345 | stats->free_clusters = atomic64_read(&flex_group[g].free_clusters); |
346 | stats->used_dirs = atomic_read(&flex_group[g].used_dirs); | 346 | stats->used_dirs = atomic_read(&flex_group[g].used_dirs); |
347 | return; | 347 | return; |
348 | } | 348 | } |
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index 9ea0cde3fa9e..b3a5213bc73e 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c | |||
@@ -185,8 +185,6 @@ void ext4_evict_inode(struct inode *inode) | |||
185 | 185 | ||
186 | trace_ext4_evict_inode(inode); | 186 | trace_ext4_evict_inode(inode); |
187 | 187 | ||
188 | ext4_ioend_wait(inode); | ||
189 | |||
190 | if (inode->i_nlink) { | 188 | if (inode->i_nlink) { |
191 | /* | 189 | /* |
192 | * When journalling data dirty buffers are tracked only in the | 190 | * When journalling data dirty buffers are tracked only in the |
@@ -207,7 +205,8 @@ void ext4_evict_inode(struct inode *inode) | |||
207 | * don't use page cache. | 205 | * don't use page cache. |
208 | */ | 206 | */ |
209 | if (ext4_should_journal_data(inode) && | 207 | if (ext4_should_journal_data(inode) && |
210 | (S_ISLNK(inode->i_mode) || S_ISREG(inode->i_mode))) { | 208 | (S_ISLNK(inode->i_mode) || S_ISREG(inode->i_mode)) && |
209 | inode->i_ino != EXT4_JOURNAL_INO) { | ||
211 | journal_t *journal = EXT4_SB(inode->i_sb)->s_journal; | 210 | journal_t *journal = EXT4_SB(inode->i_sb)->s_journal; |
212 | tid_t commit_tid = EXT4_I(inode)->i_datasync_tid; | 211 | tid_t commit_tid = EXT4_I(inode)->i_datasync_tid; |
213 | 212 | ||
@@ -216,6 +215,7 @@ void ext4_evict_inode(struct inode *inode) | |||
216 | filemap_write_and_wait(&inode->i_data); | 215 | filemap_write_and_wait(&inode->i_data); |
217 | } | 216 | } |
218 | truncate_inode_pages(&inode->i_data, 0); | 217 | truncate_inode_pages(&inode->i_data, 0); |
218 | ext4_ioend_shutdown(inode); | ||
219 | goto no_delete; | 219 | goto no_delete; |
220 | } | 220 | } |
221 | 221 | ||
@@ -225,6 +225,7 @@ void ext4_evict_inode(struct inode *inode) | |||
225 | if (ext4_should_order_data(inode)) | 225 | if (ext4_should_order_data(inode)) |
226 | ext4_begin_ordered_truncate(inode, 0); | 226 | ext4_begin_ordered_truncate(inode, 0); |
227 | truncate_inode_pages(&inode->i_data, 0); | 227 | truncate_inode_pages(&inode->i_data, 0); |
228 | ext4_ioend_shutdown(inode); | ||
228 | 229 | ||
229 | if (is_bad_inode(inode)) | 230 | if (is_bad_inode(inode)) |
230 | goto no_delete; | 231 | goto no_delete; |
@@ -482,6 +483,58 @@ static pgoff_t ext4_num_dirty_pages(struct inode *inode, pgoff_t idx, | |||
482 | return num; | 483 | return num; |
483 | } | 484 | } |
484 | 485 | ||
486 | #ifdef ES_AGGRESSIVE_TEST | ||
487 | static void ext4_map_blocks_es_recheck(handle_t *handle, | ||
488 | struct inode *inode, | ||
489 | struct ext4_map_blocks *es_map, | ||
490 | struct ext4_map_blocks *map, | ||
491 | int flags) | ||
492 | { | ||
493 | int retval; | ||
494 | |||
495 | map->m_flags = 0; | ||
496 | /* | ||
497 | * There is a race window that the result is not the same. | ||
498 | * e.g. xfstests #223 when dioread_nolock enables. The reason | ||
499 | * is that we lookup a block mapping in extent status tree with | ||
500 | * out taking i_data_sem. So at the time the unwritten extent | ||
501 | * could be converted. | ||
502 | */ | ||
503 | if (!(flags & EXT4_GET_BLOCKS_NO_LOCK)) | ||
504 | down_read((&EXT4_I(inode)->i_data_sem)); | ||
505 | if (ext4_test_inode_flag(inode, EXT4_INODE_EXTENTS)) { | ||
506 | retval = ext4_ext_map_blocks(handle, inode, map, flags & | ||
507 | EXT4_GET_BLOCKS_KEEP_SIZE); | ||
508 | } else { | ||
509 | retval = ext4_ind_map_blocks(handle, inode, map, flags & | ||
510 | EXT4_GET_BLOCKS_KEEP_SIZE); | ||
511 | } | ||
512 | if (!(flags & EXT4_GET_BLOCKS_NO_LOCK)) | ||
513 | up_read((&EXT4_I(inode)->i_data_sem)); | ||
514 | /* | ||
515 | * Clear EXT4_MAP_FROM_CLUSTER and EXT4_MAP_BOUNDARY flag | ||
516 | * because it shouldn't be marked in es_map->m_flags. | ||
517 | */ | ||
518 | map->m_flags &= ~(EXT4_MAP_FROM_CLUSTER | EXT4_MAP_BOUNDARY); | ||
519 | |||
520 | /* | ||
521 | * We don't check m_len because extent will be collpased in status | ||
522 | * tree. So the m_len might not equal. | ||
523 | */ | ||
524 | if (es_map->m_lblk != map->m_lblk || | ||
525 | es_map->m_flags != map->m_flags || | ||
526 | es_map->m_pblk != map->m_pblk) { | ||
527 | printk("ES cache assertation failed for inode: %lu " | ||
528 | "es_cached ex [%d/%d/%llu/%x] != " | ||
529 | "found ex [%d/%d/%llu/%x] retval %d flags %x\n", | ||
530 | inode->i_ino, es_map->m_lblk, es_map->m_len, | ||
531 | es_map->m_pblk, es_map->m_flags, map->m_lblk, | ||
532 | map->m_len, map->m_pblk, map->m_flags, | ||
533 | retval, flags); | ||
534 | } | ||
535 | } | ||
536 | #endif /* ES_AGGRESSIVE_TEST */ | ||
537 | |||
485 | /* | 538 | /* |
486 | * The ext4_map_blocks() function tries to look up the requested blocks, | 539 | * The ext4_map_blocks() function tries to look up the requested blocks, |
487 | * and returns if the blocks are already mapped. | 540 | * and returns if the blocks are already mapped. |
@@ -509,6 +562,11 @@ int ext4_map_blocks(handle_t *handle, struct inode *inode, | |||
509 | { | 562 | { |
510 | struct extent_status es; | 563 | struct extent_status es; |
511 | int retval; | 564 | int retval; |
565 | #ifdef ES_AGGRESSIVE_TEST | ||
566 | struct ext4_map_blocks orig_map; | ||
567 | |||
568 | memcpy(&orig_map, map, sizeof(*map)); | ||
569 | #endif | ||
512 | 570 | ||
513 | map->m_flags = 0; | 571 | map->m_flags = 0; |
514 | ext_debug("ext4_map_blocks(): inode %lu, flag %d, max_blocks %u," | 572 | ext_debug("ext4_map_blocks(): inode %lu, flag %d, max_blocks %u," |
@@ -531,6 +589,10 @@ int ext4_map_blocks(handle_t *handle, struct inode *inode, | |||
531 | } else { | 589 | } else { |
532 | BUG_ON(1); | 590 | BUG_ON(1); |
533 | } | 591 | } |
592 | #ifdef ES_AGGRESSIVE_TEST | ||
593 | ext4_map_blocks_es_recheck(handle, inode, map, | ||
594 | &orig_map, flags); | ||
595 | #endif | ||
534 | goto found; | 596 | goto found; |
535 | } | 597 | } |
536 | 598 | ||
@@ -551,6 +613,15 @@ int ext4_map_blocks(handle_t *handle, struct inode *inode, | |||
551 | int ret; | 613 | int ret; |
552 | unsigned long long status; | 614 | unsigned long long status; |
553 | 615 | ||
616 | #ifdef ES_AGGRESSIVE_TEST | ||
617 | if (retval != map->m_len) { | ||
618 | printk("ES len assertation failed for inode: %lu " | ||
619 | "retval %d != map->m_len %d " | ||
620 | "in %s (lookup)\n", inode->i_ino, retval, | ||
621 | map->m_len, __func__); | ||
622 | } | ||
623 | #endif | ||
624 | |||
554 | status = map->m_flags & EXT4_MAP_UNWRITTEN ? | 625 | status = map->m_flags & EXT4_MAP_UNWRITTEN ? |
555 | EXTENT_STATUS_UNWRITTEN : EXTENT_STATUS_WRITTEN; | 626 | EXTENT_STATUS_UNWRITTEN : EXTENT_STATUS_WRITTEN; |
556 | if (!(flags & EXT4_GET_BLOCKS_DELALLOC_RESERVE) && | 627 | if (!(flags & EXT4_GET_BLOCKS_DELALLOC_RESERVE) && |
@@ -643,6 +714,24 @@ found: | |||
643 | int ret; | 714 | int ret; |
644 | unsigned long long status; | 715 | unsigned long long status; |
645 | 716 | ||
717 | #ifdef ES_AGGRESSIVE_TEST | ||
718 | if (retval != map->m_len) { | ||
719 | printk("ES len assertation failed for inode: %lu " | ||
720 | "retval %d != map->m_len %d " | ||
721 | "in %s (allocation)\n", inode->i_ino, retval, | ||
722 | map->m_len, __func__); | ||
723 | } | ||
724 | #endif | ||
725 | |||
726 | /* | ||
727 | * If the extent has been zeroed out, we don't need to update | ||
728 | * extent status tree. | ||
729 | */ | ||
730 | if ((flags & EXT4_GET_BLOCKS_PRE_IO) && | ||
731 | ext4_es_lookup_extent(inode, map->m_lblk, &es)) { | ||
732 | if (ext4_es_is_written(&es)) | ||
733 | goto has_zeroout; | ||
734 | } | ||
646 | status = map->m_flags & EXT4_MAP_UNWRITTEN ? | 735 | status = map->m_flags & EXT4_MAP_UNWRITTEN ? |
647 | EXTENT_STATUS_UNWRITTEN : EXTENT_STATUS_WRITTEN; | 736 | EXTENT_STATUS_UNWRITTEN : EXTENT_STATUS_WRITTEN; |
648 | if (!(flags & EXT4_GET_BLOCKS_DELALLOC_RESERVE) && | 737 | if (!(flags & EXT4_GET_BLOCKS_DELALLOC_RESERVE) && |
@@ -655,6 +744,7 @@ found: | |||
655 | retval = ret; | 744 | retval = ret; |
656 | } | 745 | } |
657 | 746 | ||
747 | has_zeroout: | ||
658 | up_write((&EXT4_I(inode)->i_data_sem)); | 748 | up_write((&EXT4_I(inode)->i_data_sem)); |
659 | if (retval > 0 && map->m_flags & EXT4_MAP_MAPPED) { | 749 | if (retval > 0 && map->m_flags & EXT4_MAP_MAPPED) { |
660 | int ret = check_block_validity(inode, map); | 750 | int ret = check_block_validity(inode, map); |
@@ -1216,6 +1306,55 @@ static int ext4_journalled_write_end(struct file *file, | |||
1216 | } | 1306 | } |
1217 | 1307 | ||
1218 | /* | 1308 | /* |
1309 | * Reserve a metadata for a single block located at lblock | ||
1310 | */ | ||
1311 | static int ext4_da_reserve_metadata(struct inode *inode, ext4_lblk_t lblock) | ||
1312 | { | ||
1313 | int retries = 0; | ||
1314 | struct ext4_sb_info *sbi = EXT4_SB(inode->i_sb); | ||
1315 | struct ext4_inode_info *ei = EXT4_I(inode); | ||
1316 | unsigned int md_needed; | ||
1317 | ext4_lblk_t save_last_lblock; | ||
1318 | int save_len; | ||
1319 | |||
1320 | /* | ||
1321 | * recalculate the amount of metadata blocks to reserve | ||
1322 | * in order to allocate nrblocks | ||
1323 | * worse case is one extent per block | ||
1324 | */ | ||
1325 | repeat: | ||
1326 | spin_lock(&ei->i_block_reservation_lock); | ||
1327 | /* | ||
1328 | * ext4_calc_metadata_amount() has side effects, which we have | ||
1329 | * to be prepared undo if we fail to claim space. | ||
1330 | */ | ||
1331 | save_len = ei->i_da_metadata_calc_len; | ||
1332 | save_last_lblock = ei->i_da_metadata_calc_last_lblock; | ||
1333 | md_needed = EXT4_NUM_B2C(sbi, | ||
1334 | ext4_calc_metadata_amount(inode, lblock)); | ||
1335 | trace_ext4_da_reserve_space(inode, md_needed); | ||
1336 | |||
1337 | /* | ||
1338 | * We do still charge estimated metadata to the sb though; | ||
1339 | * we cannot afford to run out of free blocks. | ||
1340 | */ | ||
1341 | if (ext4_claim_free_clusters(sbi, md_needed, 0)) { | ||
1342 | ei->i_da_metadata_calc_len = save_len; | ||
1343 | ei->i_da_metadata_calc_last_lblock = save_last_lblock; | ||
1344 | spin_unlock(&ei->i_block_reservation_lock); | ||
1345 | if (ext4_should_retry_alloc(inode->i_sb, &retries)) { | ||
1346 | cond_resched(); | ||
1347 | goto repeat; | ||
1348 | } | ||
1349 | return -ENOSPC; | ||
1350 | } | ||
1351 | ei->i_reserved_meta_blocks += md_needed; | ||
1352 | spin_unlock(&ei->i_block_reservation_lock); | ||
1353 | |||
1354 | return 0; /* success */ | ||
1355 | } | ||
1356 | |||
1357 | /* | ||
1219 | * Reserve a single cluster located at lblock | 1358 | * Reserve a single cluster located at lblock |
1220 | */ | 1359 | */ |
1221 | static int ext4_da_reserve_space(struct inode *inode, ext4_lblk_t lblock) | 1360 | static int ext4_da_reserve_space(struct inode *inode, ext4_lblk_t lblock) |
@@ -1263,7 +1402,7 @@ repeat: | |||
1263 | ei->i_da_metadata_calc_last_lblock = save_last_lblock; | 1402 | ei->i_da_metadata_calc_last_lblock = save_last_lblock; |
1264 | spin_unlock(&ei->i_block_reservation_lock); | 1403 | spin_unlock(&ei->i_block_reservation_lock); |
1265 | if (ext4_should_retry_alloc(inode->i_sb, &retries)) { | 1404 | if (ext4_should_retry_alloc(inode->i_sb, &retries)) { |
1266 | yield(); | 1405 | cond_resched(); |
1267 | goto repeat; | 1406 | goto repeat; |
1268 | } | 1407 | } |
1269 | dquot_release_reservation_block(inode, EXT4_C2B(sbi, 1)); | 1408 | dquot_release_reservation_block(inode, EXT4_C2B(sbi, 1)); |
@@ -1768,6 +1907,11 @@ static int ext4_da_map_blocks(struct inode *inode, sector_t iblock, | |||
1768 | struct extent_status es; | 1907 | struct extent_status es; |
1769 | int retval; | 1908 | int retval; |
1770 | sector_t invalid_block = ~((sector_t) 0xffff); | 1909 | sector_t invalid_block = ~((sector_t) 0xffff); |
1910 | #ifdef ES_AGGRESSIVE_TEST | ||
1911 | struct ext4_map_blocks orig_map; | ||
1912 | |||
1913 | memcpy(&orig_map, map, sizeof(*map)); | ||
1914 | #endif | ||
1771 | 1915 | ||
1772 | if (invalid_block < ext4_blocks_count(EXT4_SB(inode->i_sb)->s_es)) | 1916 | if (invalid_block < ext4_blocks_count(EXT4_SB(inode->i_sb)->s_es)) |
1773 | invalid_block = ~0; | 1917 | invalid_block = ~0; |
@@ -1809,6 +1953,9 @@ static int ext4_da_map_blocks(struct inode *inode, sector_t iblock, | |||
1809 | else | 1953 | else |
1810 | BUG_ON(1); | 1954 | BUG_ON(1); |
1811 | 1955 | ||
1956 | #ifdef ES_AGGRESSIVE_TEST | ||
1957 | ext4_map_blocks_es_recheck(NULL, inode, map, &orig_map, 0); | ||
1958 | #endif | ||
1812 | return retval; | 1959 | return retval; |
1813 | } | 1960 | } |
1814 | 1961 | ||
@@ -1843,8 +1990,11 @@ add_delayed: | |||
1843 | * XXX: __block_prepare_write() unmaps passed block, | 1990 | * XXX: __block_prepare_write() unmaps passed block, |
1844 | * is it OK? | 1991 | * is it OK? |
1845 | */ | 1992 | */ |
1846 | /* If the block was allocated from previously allocated cluster, | 1993 | /* |
1847 | * then we dont need to reserve it again. */ | 1994 | * If the block was allocated from previously allocated cluster, |
1995 | * then we don't need to reserve it again. However we still need | ||
1996 | * to reserve metadata for every block we're going to write. | ||
1997 | */ | ||
1848 | if (!(map->m_flags & EXT4_MAP_FROM_CLUSTER)) { | 1998 | if (!(map->m_flags & EXT4_MAP_FROM_CLUSTER)) { |
1849 | ret = ext4_da_reserve_space(inode, iblock); | 1999 | ret = ext4_da_reserve_space(inode, iblock); |
1850 | if (ret) { | 2000 | if (ret) { |
@@ -1852,6 +2002,13 @@ add_delayed: | |||
1852 | retval = ret; | 2002 | retval = ret; |
1853 | goto out_unlock; | 2003 | goto out_unlock; |
1854 | } | 2004 | } |
2005 | } else { | ||
2006 | ret = ext4_da_reserve_metadata(inode, iblock); | ||
2007 | if (ret) { | ||
2008 | /* not enough space to reserve */ | ||
2009 | retval = ret; | ||
2010 | goto out_unlock; | ||
2011 | } | ||
1855 | } | 2012 | } |
1856 | 2013 | ||
1857 | ret = ext4_es_insert_extent(inode, map->m_lblk, map->m_len, | 2014 | ret = ext4_es_insert_extent(inode, map->m_lblk, map->m_len, |
@@ -1873,6 +2030,15 @@ add_delayed: | |||
1873 | int ret; | 2030 | int ret; |
1874 | unsigned long long status; | 2031 | unsigned long long status; |
1875 | 2032 | ||
2033 | #ifdef ES_AGGRESSIVE_TEST | ||
2034 | if (retval != map->m_len) { | ||
2035 | printk("ES len assertation failed for inode: %lu " | ||
2036 | "retval %d != map->m_len %d " | ||
2037 | "in %s (lookup)\n", inode->i_ino, retval, | ||
2038 | map->m_len, __func__); | ||
2039 | } | ||
2040 | #endif | ||
2041 | |||
1876 | status = map->m_flags & EXT4_MAP_UNWRITTEN ? | 2042 | status = map->m_flags & EXT4_MAP_UNWRITTEN ? |
1877 | EXTENT_STATUS_UNWRITTEN : EXTENT_STATUS_WRITTEN; | 2043 | EXTENT_STATUS_UNWRITTEN : EXTENT_STATUS_WRITTEN; |
1878 | ret = ext4_es_insert_extent(inode, map->m_lblk, map->m_len, | 2044 | ret = ext4_es_insert_extent(inode, map->m_lblk, map->m_len, |
@@ -2908,8 +3074,8 @@ static int ext4_releasepage(struct page *page, gfp_t wait) | |||
2908 | 3074 | ||
2909 | trace_ext4_releasepage(page); | 3075 | trace_ext4_releasepage(page); |
2910 | 3076 | ||
2911 | WARN_ON(PageChecked(page)); | 3077 | /* Page has dirty journalled data -> cannot release */ |
2912 | if (!page_has_buffers(page)) | 3078 | if (PageChecked(page)) |
2913 | return 0; | 3079 | return 0; |
2914 | if (journal) | 3080 | if (journal) |
2915 | return jbd2_journal_try_to_free_buffers(journal, page, wait); | 3081 | return jbd2_journal_try_to_free_buffers(journal, page, wait); |
diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c index 7bb713a46fe4..ee6614bdb639 100644 --- a/fs/ext4/mballoc.c +++ b/fs/ext4/mballoc.c | |||
@@ -2804,8 +2804,8 @@ ext4_mb_mark_diskspace_used(struct ext4_allocation_context *ac, | |||
2804 | if (sbi->s_log_groups_per_flex) { | 2804 | if (sbi->s_log_groups_per_flex) { |
2805 | ext4_group_t flex_group = ext4_flex_group(sbi, | 2805 | ext4_group_t flex_group = ext4_flex_group(sbi, |
2806 | ac->ac_b_ex.fe_group); | 2806 | ac->ac_b_ex.fe_group); |
2807 | atomic_sub(ac->ac_b_ex.fe_len, | 2807 | atomic64_sub(ac->ac_b_ex.fe_len, |
2808 | &sbi->s_flex_groups[flex_group].free_clusters); | 2808 | &sbi->s_flex_groups[flex_group].free_clusters); |
2809 | } | 2809 | } |
2810 | 2810 | ||
2811 | err = ext4_handle_dirty_metadata(handle, NULL, bitmap_bh); | 2811 | err = ext4_handle_dirty_metadata(handle, NULL, bitmap_bh); |
@@ -3692,11 +3692,7 @@ repeat: | |||
3692 | if (free < needed && busy) { | 3692 | if (free < needed && busy) { |
3693 | busy = 0; | 3693 | busy = 0; |
3694 | ext4_unlock_group(sb, group); | 3694 | ext4_unlock_group(sb, group); |
3695 | /* | 3695 | cond_resched(); |
3696 | * Yield the CPU here so that we don't get soft lockup | ||
3697 | * in non preempt case. | ||
3698 | */ | ||
3699 | yield(); | ||
3700 | goto repeat; | 3696 | goto repeat; |
3701 | } | 3697 | } |
3702 | 3698 | ||
@@ -4246,7 +4242,7 @@ ext4_fsblk_t ext4_mb_new_blocks(handle_t *handle, | |||
4246 | ext4_claim_free_clusters(sbi, ar->len, ar->flags)) { | 4242 | ext4_claim_free_clusters(sbi, ar->len, ar->flags)) { |
4247 | 4243 | ||
4248 | /* let others to free the space */ | 4244 | /* let others to free the space */ |
4249 | yield(); | 4245 | cond_resched(); |
4250 | ar->len = ar->len >> 1; | 4246 | ar->len = ar->len >> 1; |
4251 | } | 4247 | } |
4252 | if (!ar->len) { | 4248 | if (!ar->len) { |
@@ -4464,7 +4460,6 @@ void ext4_free_blocks(handle_t *handle, struct inode *inode, | |||
4464 | struct buffer_head *bitmap_bh = NULL; | 4460 | struct buffer_head *bitmap_bh = NULL; |
4465 | struct super_block *sb = inode->i_sb; | 4461 | struct super_block *sb = inode->i_sb; |
4466 | struct ext4_group_desc *gdp; | 4462 | struct ext4_group_desc *gdp; |
4467 | unsigned long freed = 0; | ||
4468 | unsigned int overflow; | 4463 | unsigned int overflow; |
4469 | ext4_grpblk_t bit; | 4464 | ext4_grpblk_t bit; |
4470 | struct buffer_head *gd_bh; | 4465 | struct buffer_head *gd_bh; |
@@ -4666,14 +4661,12 @@ do_more: | |||
4666 | 4661 | ||
4667 | if (sbi->s_log_groups_per_flex) { | 4662 | if (sbi->s_log_groups_per_flex) { |
4668 | ext4_group_t flex_group = ext4_flex_group(sbi, block_group); | 4663 | ext4_group_t flex_group = ext4_flex_group(sbi, block_group); |
4669 | atomic_add(count_clusters, | 4664 | atomic64_add(count_clusters, |
4670 | &sbi->s_flex_groups[flex_group].free_clusters); | 4665 | &sbi->s_flex_groups[flex_group].free_clusters); |
4671 | } | 4666 | } |
4672 | 4667 | ||
4673 | ext4_mb_unload_buddy(&e4b); | 4668 | ext4_mb_unload_buddy(&e4b); |
4674 | 4669 | ||
4675 | freed += count; | ||
4676 | |||
4677 | if (!(flags & EXT4_FREE_BLOCKS_NO_QUOT_UPDATE)) | 4670 | if (!(flags & EXT4_FREE_BLOCKS_NO_QUOT_UPDATE)) |
4678 | dquot_free_block(inode, EXT4_C2B(sbi, count_clusters)); | 4671 | dquot_free_block(inode, EXT4_C2B(sbi, count_clusters)); |
4679 | 4672 | ||
@@ -4811,8 +4804,8 @@ int ext4_group_add_blocks(handle_t *handle, struct super_block *sb, | |||
4811 | 4804 | ||
4812 | if (sbi->s_log_groups_per_flex) { | 4805 | if (sbi->s_log_groups_per_flex) { |
4813 | ext4_group_t flex_group = ext4_flex_group(sbi, block_group); | 4806 | ext4_group_t flex_group = ext4_flex_group(sbi, block_group); |
4814 | atomic_add(EXT4_NUM_B2C(sbi, blocks_freed), | 4807 | atomic64_add(EXT4_NUM_B2C(sbi, blocks_freed), |
4815 | &sbi->s_flex_groups[flex_group].free_clusters); | 4808 | &sbi->s_flex_groups[flex_group].free_clusters); |
4816 | } | 4809 | } |
4817 | 4810 | ||
4818 | ext4_mb_unload_buddy(&e4b); | 4811 | ext4_mb_unload_buddy(&e4b); |
diff --git a/fs/ext4/move_extent.c b/fs/ext4/move_extent.c index 4e81d47aa8cb..33e1c086858b 100644 --- a/fs/ext4/move_extent.c +++ b/fs/ext4/move_extent.c | |||
@@ -32,16 +32,18 @@ | |||
32 | */ | 32 | */ |
33 | static inline int | 33 | static inline int |
34 | get_ext_path(struct inode *inode, ext4_lblk_t lblock, | 34 | get_ext_path(struct inode *inode, ext4_lblk_t lblock, |
35 | struct ext4_ext_path **path) | 35 | struct ext4_ext_path **orig_path) |
36 | { | 36 | { |
37 | int ret = 0; | 37 | int ret = 0; |
38 | struct ext4_ext_path *path; | ||
38 | 39 | ||
39 | *path = ext4_ext_find_extent(inode, lblock, *path); | 40 | path = ext4_ext_find_extent(inode, lblock, *orig_path); |
40 | if (IS_ERR(*path)) { | 41 | if (IS_ERR(path)) |
41 | ret = PTR_ERR(*path); | 42 | ret = PTR_ERR(path); |
42 | *path = NULL; | 43 | else if (path[ext_depth(inode)].p_ext == NULL) |
43 | } else if ((*path)[ext_depth(inode)].p_ext == NULL) | ||
44 | ret = -ENODATA; | 44 | ret = -ENODATA; |
45 | else | ||
46 | *orig_path = path; | ||
45 | 47 | ||
46 | return ret; | 48 | return ret; |
47 | } | 49 | } |
@@ -611,24 +613,25 @@ mext_check_coverage(struct inode *inode, ext4_lblk_t from, ext4_lblk_t count, | |||
611 | { | 613 | { |
612 | struct ext4_ext_path *path = NULL; | 614 | struct ext4_ext_path *path = NULL; |
613 | struct ext4_extent *ext; | 615 | struct ext4_extent *ext; |
616 | int ret = 0; | ||
614 | ext4_lblk_t last = from + count; | 617 | ext4_lblk_t last = from + count; |
615 | while (from < last) { | 618 | while (from < last) { |
616 | *err = get_ext_path(inode, from, &path); | 619 | *err = get_ext_path(inode, from, &path); |
617 | if (*err) | 620 | if (*err) |
618 | return 0; | 621 | goto out; |
619 | ext = path[ext_depth(inode)].p_ext; | 622 | ext = path[ext_depth(inode)].p_ext; |
620 | if (!ext) { | 623 | if (uninit != ext4_ext_is_uninitialized(ext)) |
621 | ext4_ext_drop_refs(path); | 624 | goto out; |
622 | return 0; | ||
623 | } | ||
624 | if (uninit != ext4_ext_is_uninitialized(ext)) { | ||
625 | ext4_ext_drop_refs(path); | ||
626 | return 0; | ||
627 | } | ||
628 | from += ext4_ext_get_actual_len(ext); | 625 | from += ext4_ext_get_actual_len(ext); |
629 | ext4_ext_drop_refs(path); | 626 | ext4_ext_drop_refs(path); |
630 | } | 627 | } |
631 | return 1; | 628 | ret = 1; |
629 | out: | ||
630 | if (path) { | ||
631 | ext4_ext_drop_refs(path); | ||
632 | kfree(path); | ||
633 | } | ||
634 | return ret; | ||
632 | } | 635 | } |
633 | 636 | ||
634 | /** | 637 | /** |
@@ -666,6 +669,14 @@ mext_replace_branches(handle_t *handle, struct inode *orig_inode, | |||
666 | int replaced_count = 0; | 669 | int replaced_count = 0; |
667 | int dext_alen; | 670 | int dext_alen; |
668 | 671 | ||
672 | *err = ext4_es_remove_extent(orig_inode, from, count); | ||
673 | if (*err) | ||
674 | goto out; | ||
675 | |||
676 | *err = ext4_es_remove_extent(donor_inode, from, count); | ||
677 | if (*err) | ||
678 | goto out; | ||
679 | |||
669 | /* Get the original extent for the block "orig_off" */ | 680 | /* Get the original extent for the block "orig_off" */ |
670 | *err = get_ext_path(orig_inode, orig_off, &orig_path); | 681 | *err = get_ext_path(orig_inode, orig_off, &orig_path); |
671 | if (*err) | 682 | if (*err) |
diff --git a/fs/ext4/page-io.c b/fs/ext4/page-io.c index 809b31003ecc..047a6de04a0a 100644 --- a/fs/ext4/page-io.c +++ b/fs/ext4/page-io.c | |||
@@ -50,11 +50,21 @@ void ext4_exit_pageio(void) | |||
50 | kmem_cache_destroy(io_page_cachep); | 50 | kmem_cache_destroy(io_page_cachep); |
51 | } | 51 | } |
52 | 52 | ||
53 | void ext4_ioend_wait(struct inode *inode) | 53 | /* |
54 | * This function is called by ext4_evict_inode() to make sure there is | ||
55 | * no more pending I/O completion work left to do. | ||
56 | */ | ||
57 | void ext4_ioend_shutdown(struct inode *inode) | ||
54 | { | 58 | { |
55 | wait_queue_head_t *wq = ext4_ioend_wq(inode); | 59 | wait_queue_head_t *wq = ext4_ioend_wq(inode); |
56 | 60 | ||
57 | wait_event(*wq, (atomic_read(&EXT4_I(inode)->i_ioend_count) == 0)); | 61 | wait_event(*wq, (atomic_read(&EXT4_I(inode)->i_ioend_count) == 0)); |
62 | /* | ||
63 | * We need to make sure the work structure is finished being | ||
64 | * used before we let the inode get destroyed. | ||
65 | */ | ||
66 | if (work_pending(&EXT4_I(inode)->i_unwritten_work)) | ||
67 | cancel_work_sync(&EXT4_I(inode)->i_unwritten_work); | ||
58 | } | 68 | } |
59 | 69 | ||
60 | static void put_io_page(struct ext4_io_page *io_page) | 70 | static void put_io_page(struct ext4_io_page *io_page) |
diff --git a/fs/ext4/resize.c b/fs/ext4/resize.c index b2c8ee56eb98..c169477a62c9 100644 --- a/fs/ext4/resize.c +++ b/fs/ext4/resize.c | |||
@@ -1360,8 +1360,8 @@ static void ext4_update_super(struct super_block *sb, | |||
1360 | sbi->s_log_groups_per_flex) { | 1360 | sbi->s_log_groups_per_flex) { |
1361 | ext4_group_t flex_group; | 1361 | ext4_group_t flex_group; |
1362 | flex_group = ext4_flex_group(sbi, group_data[0].group); | 1362 | flex_group = ext4_flex_group(sbi, group_data[0].group); |
1363 | atomic_add(EXT4_NUM_B2C(sbi, free_blocks), | 1363 | atomic64_add(EXT4_NUM_B2C(sbi, free_blocks), |
1364 | &sbi->s_flex_groups[flex_group].free_clusters); | 1364 | &sbi->s_flex_groups[flex_group].free_clusters); |
1365 | atomic_add(EXT4_INODES_PER_GROUP(sb) * flex_gd->count, | 1365 | atomic_add(EXT4_INODES_PER_GROUP(sb) * flex_gd->count, |
1366 | &sbi->s_flex_groups[flex_group].free_inodes); | 1366 | &sbi->s_flex_groups[flex_group].free_inodes); |
1367 | } | 1367 | } |
diff --git a/fs/ext4/super.c b/fs/ext4/super.c index 34e855219231..5d6d53578124 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c | |||
@@ -91,6 +91,7 @@ static struct file_system_type ext2_fs_type = { | |||
91 | .fs_flags = FS_REQUIRES_DEV, | 91 | .fs_flags = FS_REQUIRES_DEV, |
92 | }; | 92 | }; |
93 | MODULE_ALIAS_FS("ext2"); | 93 | MODULE_ALIAS_FS("ext2"); |
94 | MODULE_ALIAS("ext2"); | ||
94 | #define IS_EXT2_SB(sb) ((sb)->s_bdev->bd_holder == &ext2_fs_type) | 95 | #define IS_EXT2_SB(sb) ((sb)->s_bdev->bd_holder == &ext2_fs_type) |
95 | #else | 96 | #else |
96 | #define IS_EXT2_SB(sb) (0) | 97 | #define IS_EXT2_SB(sb) (0) |
@@ -106,6 +107,7 @@ static struct file_system_type ext3_fs_type = { | |||
106 | .fs_flags = FS_REQUIRES_DEV, | 107 | .fs_flags = FS_REQUIRES_DEV, |
107 | }; | 108 | }; |
108 | MODULE_ALIAS_FS("ext3"); | 109 | MODULE_ALIAS_FS("ext3"); |
110 | MODULE_ALIAS("ext3"); | ||
109 | #define IS_EXT3_SB(sb) ((sb)->s_bdev->bd_holder == &ext3_fs_type) | 111 | #define IS_EXT3_SB(sb) ((sb)->s_bdev->bd_holder == &ext3_fs_type) |
110 | #else | 112 | #else |
111 | #define IS_EXT3_SB(sb) (0) | 113 | #define IS_EXT3_SB(sb) (0) |
@@ -1925,8 +1927,8 @@ static int ext4_fill_flex_info(struct super_block *sb) | |||
1925 | flex_group = ext4_flex_group(sbi, i); | 1927 | flex_group = ext4_flex_group(sbi, i); |
1926 | atomic_add(ext4_free_inodes_count(sb, gdp), | 1928 | atomic_add(ext4_free_inodes_count(sb, gdp), |
1927 | &sbi->s_flex_groups[flex_group].free_inodes); | 1929 | &sbi->s_flex_groups[flex_group].free_inodes); |
1928 | atomic_add(ext4_free_group_clusters(sb, gdp), | 1930 | atomic64_add(ext4_free_group_clusters(sb, gdp), |
1929 | &sbi->s_flex_groups[flex_group].free_clusters); | 1931 | &sbi->s_flex_groups[flex_group].free_clusters); |
1930 | atomic_add(ext4_used_dirs_count(sb, gdp), | 1932 | atomic_add(ext4_used_dirs_count(sb, gdp), |
1931 | &sbi->s_flex_groups[flex_group].used_dirs); | 1933 | &sbi->s_flex_groups[flex_group].used_dirs); |
1932 | } | 1934 | } |
diff --git a/fs/freevxfs/vxfs_super.c b/fs/freevxfs/vxfs_super.c index 455074308069..e37eb274e492 100644 --- a/fs/freevxfs/vxfs_super.c +++ b/fs/freevxfs/vxfs_super.c | |||
@@ -258,6 +258,7 @@ static struct file_system_type vxfs_fs_type = { | |||
258 | .fs_flags = FS_REQUIRES_DEV, | 258 | .fs_flags = FS_REQUIRES_DEV, |
259 | }; | 259 | }; |
260 | MODULE_ALIAS_FS("vxfs"); /* makes mount -t vxfs autoload the module */ | 260 | MODULE_ALIAS_FS("vxfs"); /* makes mount -t vxfs autoload the module */ |
261 | MODULE_ALIAS("vxfs"); | ||
261 | 262 | ||
262 | static int __init | 263 | static int __init |
263 | vxfs_init(void) | 264 | vxfs_init(void) |
diff --git a/fs/hostfs/hostfs_kern.c b/fs/hostfs/hostfs_kern.c index fbabb906066f..0f6e52d22b84 100644 --- a/fs/hostfs/hostfs_kern.c +++ b/fs/hostfs/hostfs_kern.c | |||
@@ -845,15 +845,8 @@ int hostfs_setattr(struct dentry *dentry, struct iattr *attr) | |||
845 | return err; | 845 | return err; |
846 | 846 | ||
847 | if ((attr->ia_valid & ATTR_SIZE) && | 847 | if ((attr->ia_valid & ATTR_SIZE) && |
848 | attr->ia_size != i_size_read(inode)) { | 848 | attr->ia_size != i_size_read(inode)) |
849 | int error; | ||
850 | |||
851 | error = inode_newsize_ok(inode, attr->ia_size); | ||
852 | if (error) | ||
853 | return error; | ||
854 | |||
855 | truncate_setsize(inode, attr->ia_size); | 849 | truncate_setsize(inode, attr->ia_size); |
856 | } | ||
857 | 850 | ||
858 | setattr_copy(inode, attr); | 851 | setattr_copy(inode, attr); |
859 | mark_inode_dirty(inode); | 852 | mark_inode_dirty(inode); |
@@ -993,6 +986,7 @@ static struct file_system_type hostfs_type = { | |||
993 | .kill_sb = hostfs_kill_sb, | 986 | .kill_sb = hostfs_kill_sb, |
994 | .fs_flags = 0, | 987 | .fs_flags = 0, |
995 | }; | 988 | }; |
989 | MODULE_ALIAS_FS("hostfs"); | ||
996 | 990 | ||
997 | static int __init init_hostfs(void) | 991 | static int __init init_hostfs(void) |
998 | { | 992 | { |
diff --git a/fs/hpfs/super.c b/fs/hpfs/super.c index a3076228523d..a0617e706957 100644 --- a/fs/hpfs/super.c +++ b/fs/hpfs/super.c | |||
@@ -688,6 +688,7 @@ static struct file_system_type hpfs_fs_type = { | |||
688 | .kill_sb = kill_block_super, | 688 | .kill_sb = kill_block_super, |
689 | .fs_flags = FS_REQUIRES_DEV, | 689 | .fs_flags = FS_REQUIRES_DEV, |
690 | }; | 690 | }; |
691 | MODULE_ALIAS_FS("hpfs"); | ||
691 | 692 | ||
692 | static int __init init_hpfs_fs(void) | 693 | static int __init init_hpfs_fs(void) |
693 | { | 694 | { |
diff --git a/fs/isofs/inode.c b/fs/isofs/inode.c index a67f16e846a2..d9b8aebdeb22 100644 --- a/fs/isofs/inode.c +++ b/fs/isofs/inode.c | |||
@@ -1557,6 +1557,7 @@ static struct file_system_type iso9660_fs_type = { | |||
1557 | .fs_flags = FS_REQUIRES_DEV, | 1557 | .fs_flags = FS_REQUIRES_DEV, |
1558 | }; | 1558 | }; |
1559 | MODULE_ALIAS_FS("iso9660"); | 1559 | MODULE_ALIAS_FS("iso9660"); |
1560 | MODULE_ALIAS("iso9660"); | ||
1560 | 1561 | ||
1561 | static int __init init_iso9660_fs(void) | 1562 | static int __init init_iso9660_fs(void) |
1562 | { | 1563 | { |
diff --git a/fs/jbd2/transaction.c b/fs/jbd2/transaction.c index d6ee5aed56b1..325bc019ed88 100644 --- a/fs/jbd2/transaction.c +++ b/fs/jbd2/transaction.c | |||
@@ -1065,9 +1065,12 @@ out: | |||
1065 | void jbd2_journal_set_triggers(struct buffer_head *bh, | 1065 | void jbd2_journal_set_triggers(struct buffer_head *bh, |
1066 | struct jbd2_buffer_trigger_type *type) | 1066 | struct jbd2_buffer_trigger_type *type) |
1067 | { | 1067 | { |
1068 | struct journal_head *jh = bh2jh(bh); | 1068 | struct journal_head *jh = jbd2_journal_grab_journal_head(bh); |
1069 | 1069 | ||
1070 | if (WARN_ON(!jh)) | ||
1071 | return; | ||
1070 | jh->b_triggers = type; | 1072 | jh->b_triggers = type; |
1073 | jbd2_journal_put_journal_head(jh); | ||
1071 | } | 1074 | } |
1072 | 1075 | ||
1073 | void jbd2_buffer_frozen_trigger(struct journal_head *jh, void *mapped_data, | 1076 | void jbd2_buffer_frozen_trigger(struct journal_head *jh, void *mapped_data, |
@@ -1119,17 +1122,18 @@ int jbd2_journal_dirty_metadata(handle_t *handle, struct buffer_head *bh) | |||
1119 | { | 1122 | { |
1120 | transaction_t *transaction = handle->h_transaction; | 1123 | transaction_t *transaction = handle->h_transaction; |
1121 | journal_t *journal = transaction->t_journal; | 1124 | journal_t *journal = transaction->t_journal; |
1122 | struct journal_head *jh = bh2jh(bh); | 1125 | struct journal_head *jh; |
1123 | int ret = 0; | 1126 | int ret = 0; |
1124 | 1127 | ||
1125 | jbd_debug(5, "journal_head %p\n", jh); | ||
1126 | JBUFFER_TRACE(jh, "entry"); | ||
1127 | if (is_handle_aborted(handle)) | 1128 | if (is_handle_aborted(handle)) |
1128 | goto out; | 1129 | goto out; |
1129 | if (!buffer_jbd(bh)) { | 1130 | jh = jbd2_journal_grab_journal_head(bh); |
1131 | if (!jh) { | ||
1130 | ret = -EUCLEAN; | 1132 | ret = -EUCLEAN; |
1131 | goto out; | 1133 | goto out; |
1132 | } | 1134 | } |
1135 | jbd_debug(5, "journal_head %p\n", jh); | ||
1136 | JBUFFER_TRACE(jh, "entry"); | ||
1133 | 1137 | ||
1134 | jbd_lock_bh_state(bh); | 1138 | jbd_lock_bh_state(bh); |
1135 | 1139 | ||
@@ -1220,6 +1224,7 @@ int jbd2_journal_dirty_metadata(handle_t *handle, struct buffer_head *bh) | |||
1220 | spin_unlock(&journal->j_list_lock); | 1224 | spin_unlock(&journal->j_list_lock); |
1221 | out_unlock_bh: | 1225 | out_unlock_bh: |
1222 | jbd_unlock_bh_state(bh); | 1226 | jbd_unlock_bh_state(bh); |
1227 | jbd2_journal_put_journal_head(jh); | ||
1223 | out: | 1228 | out: |
1224 | JBUFFER_TRACE(jh, "exit"); | 1229 | JBUFFER_TRACE(jh, "exit"); |
1225 | WARN_ON(ret); /* All errors are bugs, so dump the stack */ | 1230 | WARN_ON(ret); /* All errors are bugs, so dump the stack */ |
diff --git a/fs/nfs/super.c b/fs/nfs/super.c index 95cdcb208dfb..2f8a29db0f1b 100644 --- a/fs/nfs/super.c +++ b/fs/nfs/super.c | |||
@@ -335,6 +335,7 @@ struct file_system_type nfs4_fs_type = { | |||
335 | .fs_flags = FS_RENAME_DOES_D_MOVE|FS_BINARY_MOUNTDATA, | 335 | .fs_flags = FS_RENAME_DOES_D_MOVE|FS_BINARY_MOUNTDATA, |
336 | }; | 336 | }; |
337 | MODULE_ALIAS_FS("nfs4"); | 337 | MODULE_ALIAS_FS("nfs4"); |
338 | MODULE_ALIAS("nfs4"); | ||
338 | EXPORT_SYMBOL_GPL(nfs4_fs_type); | 339 | EXPORT_SYMBOL_GPL(nfs4_fs_type); |
339 | 340 | ||
340 | static int __init register_nfs4_fs(void) | 341 | static int __init register_nfs4_fs(void) |
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c index 16d39c6c4fbb..2e27430b9070 100644 --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c | |||
@@ -230,37 +230,6 @@ static void nfs4_file_put_access(struct nfs4_file *fp, int oflag) | |||
230 | __nfs4_file_put_access(fp, oflag); | 230 | __nfs4_file_put_access(fp, oflag); |
231 | } | 231 | } |
232 | 232 | ||
233 | static inline int get_new_stid(struct nfs4_stid *stid) | ||
234 | { | ||
235 | static int min_stateid = 0; | ||
236 | struct idr *stateids = &stid->sc_client->cl_stateids; | ||
237 | int new_stid; | ||
238 | int error; | ||
239 | |||
240 | error = idr_get_new_above(stateids, stid, min_stateid, &new_stid); | ||
241 | /* | ||
242 | * Note: the necessary preallocation was done in | ||
243 | * nfs4_alloc_stateid(). The idr code caps the number of | ||
244 | * preallocations that can exist at a time, but the state lock | ||
245 | * prevents anyone from using ours before we get here: | ||
246 | */ | ||
247 | WARN_ON_ONCE(error); | ||
248 | /* | ||
249 | * It shouldn't be a problem to reuse an opaque stateid value. | ||
250 | * I don't think it is for 4.1. But with 4.0 I worry that, for | ||
251 | * example, a stray write retransmission could be accepted by | ||
252 | * the server when it should have been rejected. Therefore, | ||
253 | * adopt a trick from the sctp code to attempt to maximize the | ||
254 | * amount of time until an id is reused, by ensuring they always | ||
255 | * "increase" (mod INT_MAX): | ||
256 | */ | ||
257 | |||
258 | min_stateid = new_stid+1; | ||
259 | if (min_stateid == INT_MAX) | ||
260 | min_stateid = 0; | ||
261 | return new_stid; | ||
262 | } | ||
263 | |||
264 | static struct nfs4_stid *nfs4_alloc_stid(struct nfs4_client *cl, struct | 233 | static struct nfs4_stid *nfs4_alloc_stid(struct nfs4_client *cl, struct |
265 | kmem_cache *slab) | 234 | kmem_cache *slab) |
266 | { | 235 | { |
@@ -273,9 +242,8 @@ kmem_cache *slab) | |||
273 | if (!stid) | 242 | if (!stid) |
274 | return NULL; | 243 | return NULL; |
275 | 244 | ||
276 | if (!idr_pre_get(stateids, GFP_KERNEL)) | 245 | new_id = idr_alloc(stateids, stid, min_stateid, 0, GFP_KERNEL); |
277 | goto out_free; | 246 | if (new_id < 0) |
278 | if (idr_get_new_above(stateids, stid, min_stateid, &new_id)) | ||
279 | goto out_free; | 247 | goto out_free; |
280 | stid->sc_client = cl; | 248 | stid->sc_client = cl; |
281 | stid->sc_type = 0; | 249 | stid->sc_type = 0; |
@@ -863,6 +863,9 @@ pipe_rdwr_open(struct inode *inode, struct file *filp) | |||
863 | { | 863 | { |
864 | int ret = -ENOENT; | 864 | int ret = -ENOENT; |
865 | 865 | ||
866 | if (!(filp->f_mode & (FMODE_READ|FMODE_WRITE))) | ||
867 | return -EINVAL; | ||
868 | |||
866 | mutex_lock(&inode->i_mutex); | 869 | mutex_lock(&inode->i_mutex); |
867 | 870 | ||
868 | if (inode->i_pipe) { | 871 | if (inode->i_pipe) { |
diff --git a/fs/proc/inode.c b/fs/proc/inode.c index a86aebc9ba7c..869116c2afbe 100644 --- a/fs/proc/inode.c +++ b/fs/proc/inode.c | |||
@@ -446,9 +446,10 @@ static const struct file_operations proc_reg_file_ops_no_compat = { | |||
446 | 446 | ||
447 | struct inode *proc_get_inode(struct super_block *sb, struct proc_dir_entry *de) | 447 | struct inode *proc_get_inode(struct super_block *sb, struct proc_dir_entry *de) |
448 | { | 448 | { |
449 | struct inode *inode = iget_locked(sb, de->low_ino); | 449 | struct inode *inode = new_inode_pseudo(sb); |
450 | 450 | ||
451 | if (inode && (inode->i_state & I_NEW)) { | 451 | if (inode) { |
452 | inode->i_ino = de->low_ino; | ||
452 | inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME; | 453 | inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME; |
453 | PROC_I(inode)->pde = de; | 454 | PROC_I(inode)->pde = de; |
454 | 455 | ||
@@ -476,7 +477,6 @@ struct inode *proc_get_inode(struct super_block *sb, struct proc_dir_entry *de) | |||
476 | inode->i_fop = de->proc_fops; | 477 | inode->i_fop = de->proc_fops; |
477 | } | 478 | } |
478 | } | 479 | } |
479 | unlock_new_inode(inode); | ||
480 | } else | 480 | } else |
481 | pde_put(de); | 481 | pde_put(de); |
482 | return inode; | 482 | return inode; |
diff --git a/fs/quota/dquot.c b/fs/quota/dquot.c index 05ae3c97f7a5..3e64169ef527 100644 --- a/fs/quota/dquot.c +++ b/fs/quota/dquot.c | |||
@@ -1439,8 +1439,11 @@ static void __dquot_initialize(struct inode *inode, int type) | |||
1439 | * did a write before quota was turned on | 1439 | * did a write before quota was turned on |
1440 | */ | 1440 | */ |
1441 | rsv = inode_get_rsv_space(inode); | 1441 | rsv = inode_get_rsv_space(inode); |
1442 | if (unlikely(rsv)) | 1442 | if (unlikely(rsv)) { |
1443 | spin_lock(&dq_data_lock); | ||
1443 | dquot_resv_space(inode->i_dquot[cnt], rsv); | 1444 | dquot_resv_space(inode->i_dquot[cnt], rsv); |
1445 | spin_unlock(&dq_data_lock); | ||
1446 | } | ||
1444 | } | 1447 | } |
1445 | } | 1448 | } |
1446 | out_err: | 1449 | out_err: |
diff --git a/fs/reiserfs/super.c b/fs/reiserfs/super.c index 194113b1b11b..f8a23c3078f8 100644 --- a/fs/reiserfs/super.c +++ b/fs/reiserfs/super.c | |||
@@ -1147,8 +1147,7 @@ static int reiserfs_parse_options(struct super_block *s, char *options, /* strin | |||
1147 | "on filesystem root."); | 1147 | "on filesystem root."); |
1148 | return 0; | 1148 | return 0; |
1149 | } | 1149 | } |
1150 | qf_names[qtype] = | 1150 | qf_names[qtype] = kstrdup(arg, GFP_KERNEL); |
1151 | kmalloc(strlen(arg) + 1, GFP_KERNEL); | ||
1152 | if (!qf_names[qtype]) { | 1151 | if (!qf_names[qtype]) { |
1153 | reiserfs_warning(s, "reiserfs-2502", | 1152 | reiserfs_warning(s, "reiserfs-2502", |
1154 | "not enough memory " | 1153 | "not enough memory " |
@@ -1156,7 +1155,6 @@ static int reiserfs_parse_options(struct super_block *s, char *options, /* strin | |||
1156 | "quotafile name."); | 1155 | "quotafile name."); |
1157 | return 0; | 1156 | return 0; |
1158 | } | 1157 | } |
1159 | strcpy(qf_names[qtype], arg); | ||
1160 | if (qtype == USRQUOTA) | 1158 | if (qtype == USRQUOTA) |
1161 | *mount_options |= 1 << REISERFS_USRQUOTA; | 1159 | *mount_options |= 1 << REISERFS_USRQUOTA; |
1162 | else | 1160 | else |
diff --git a/fs/squashfs/super.c b/fs/squashfs/super.c index 260e3928d4f5..60553a9053ca 100644 --- a/fs/squashfs/super.c +++ b/fs/squashfs/super.c | |||
@@ -489,6 +489,7 @@ static struct file_system_type squashfs_fs_type = { | |||
489 | .kill_sb = kill_block_super, | 489 | .kill_sb = kill_block_super, |
490 | .fs_flags = FS_REQUIRES_DEV | 490 | .fs_flags = FS_REQUIRES_DEV |
491 | }; | 491 | }; |
492 | MODULE_ALIAS_FS("squashfs"); | ||
492 | 493 | ||
493 | static const struct super_operations squashfs_super_ops = { | 494 | static const struct super_operations squashfs_super_ops = { |
494 | .alloc_inode = squashfs_alloc_inode, | 495 | .alloc_inode = squashfs_alloc_inode, |
diff --git a/fs/sysv/super.c b/fs/sysv/super.c index a39938b1feea..d0c6a007ce83 100644 --- a/fs/sysv/super.c +++ b/fs/sysv/super.c | |||
@@ -555,6 +555,7 @@ static struct file_system_type v7_fs_type = { | |||
555 | .fs_flags = FS_REQUIRES_DEV, | 555 | .fs_flags = FS_REQUIRES_DEV, |
556 | }; | 556 | }; |
557 | MODULE_ALIAS_FS("v7"); | 557 | MODULE_ALIAS_FS("v7"); |
558 | MODULE_ALIAS("v7"); | ||
558 | 559 | ||
559 | static int __init init_sysv_fs(void) | 560 | static int __init init_sysv_fs(void) |
560 | { | 561 | { |
diff --git a/fs/udf/super.c b/fs/udf/super.c index bc5b30a819e8..9ac4057a86c9 100644 --- a/fs/udf/super.c +++ b/fs/udf/super.c | |||
@@ -118,6 +118,7 @@ static struct file_system_type udf_fstype = { | |||
118 | .kill_sb = kill_block_super, | 118 | .kill_sb = kill_block_super, |
119 | .fs_flags = FS_REQUIRES_DEV, | 119 | .fs_flags = FS_REQUIRES_DEV, |
120 | }; | 120 | }; |
121 | MODULE_ALIAS_FS("udf"); | ||
121 | 122 | ||
122 | static struct kmem_cache *udf_inode_cachep; | 123 | static struct kmem_cache *udf_inode_cachep; |
123 | 124 | ||
diff --git a/fs/xfs/xfs_buf.c b/fs/xfs/xfs_buf.c index 4e8f0df82d02..8459b5d8cb71 100644 --- a/fs/xfs/xfs_buf.c +++ b/fs/xfs/xfs_buf.c | |||
@@ -1334,6 +1334,12 @@ _xfs_buf_ioapply( | |||
1334 | int size; | 1334 | int size; |
1335 | int i; | 1335 | int i; |
1336 | 1336 | ||
1337 | /* | ||
1338 | * Make sure we capture only current IO errors rather than stale errors | ||
1339 | * left over from previous use of the buffer (e.g. failed readahead). | ||
1340 | */ | ||
1341 | bp->b_error = 0; | ||
1342 | |||
1337 | if (bp->b_flags & XBF_WRITE) { | 1343 | if (bp->b_flags & XBF_WRITE) { |
1338 | if (bp->b_flags & XBF_SYNCIO) | 1344 | if (bp->b_flags & XBF_SYNCIO) |
1339 | rw = WRITE_SYNC; | 1345 | rw = WRITE_SYNC; |
diff --git a/fs/xfs/xfs_iomap.c b/fs/xfs/xfs_iomap.c index 912d83d8860a..5a30dd899d2b 100644 --- a/fs/xfs/xfs_iomap.c +++ b/fs/xfs/xfs_iomap.c | |||
@@ -325,7 +325,7 @@ xfs_iomap_eof_want_preallocate( | |||
325 | * rather than falling short due to things like stripe unit/width alignment of | 325 | * rather than falling short due to things like stripe unit/width alignment of |
326 | * real extents. | 326 | * real extents. |
327 | */ | 327 | */ |
328 | STATIC int | 328 | STATIC xfs_fsblock_t |
329 | xfs_iomap_eof_prealloc_initial_size( | 329 | xfs_iomap_eof_prealloc_initial_size( |
330 | struct xfs_mount *mp, | 330 | struct xfs_mount *mp, |
331 | struct xfs_inode *ip, | 331 | struct xfs_inode *ip, |
@@ -413,7 +413,7 @@ xfs_iomap_prealloc_size( | |||
413 | * have a large file on a small filesystem and the above | 413 | * have a large file on a small filesystem and the above |
414 | * lowspace thresholds are smaller than MAXEXTLEN. | 414 | * lowspace thresholds are smaller than MAXEXTLEN. |
415 | */ | 415 | */ |
416 | while (alloc_blocks >= freesp) | 416 | while (alloc_blocks && alloc_blocks >= freesp) |
417 | alloc_blocks >>= 4; | 417 | alloc_blocks >>= 4; |
418 | } | 418 | } |
419 | 419 | ||
diff --git a/include/acpi/processor.h b/include/acpi/processor.h index 555d0337ad95..b327b5a9296d 100644 --- a/include/acpi/processor.h +++ b/include/acpi/processor.h | |||
@@ -235,6 +235,9 @@ extern void acpi_processor_unregister_performance(struct | |||
235 | if a _PPC object exists, rmmod is disallowed then */ | 235 | if a _PPC object exists, rmmod is disallowed then */ |
236 | int acpi_processor_notify_smm(struct module *calling_module); | 236 | int acpi_processor_notify_smm(struct module *calling_module); |
237 | 237 | ||
238 | /* parsing the _P* objects. */ | ||
239 | extern int acpi_processor_get_performance_info(struct acpi_processor *pr); | ||
240 | |||
238 | /* for communication between multiple parts of the processor kernel module */ | 241 | /* for communication between multiple parts of the processor kernel module */ |
239 | DECLARE_PER_CPU(struct acpi_processor *, processors); | 242 | DECLARE_PER_CPU(struct acpi_processor *, processors); |
240 | extern struct acpi_processor_errata errata; | 243 | extern struct acpi_processor_errata errata; |
diff --git a/include/asm-generic/atomic.h b/include/asm-generic/atomic.h index 1ced6413ea03..33bd2de3bc1e 100644 --- a/include/asm-generic/atomic.h +++ b/include/asm-generic/atomic.h | |||
@@ -136,12 +136,6 @@ static inline void atomic_dec(atomic_t *v) | |||
136 | #define atomic_xchg(ptr, v) (xchg(&(ptr)->counter, (v))) | 136 | #define atomic_xchg(ptr, v) (xchg(&(ptr)->counter, (v))) |
137 | #define atomic_cmpxchg(v, old, new) (cmpxchg(&((v)->counter), (old), (new))) | 137 | #define atomic_cmpxchg(v, old, new) (cmpxchg(&((v)->counter), (old), (new))) |
138 | 138 | ||
139 | #define cmpxchg_local(ptr, o, n) \ | ||
140 | ((__typeof__(*(ptr)))__cmpxchg_local_generic((ptr), (unsigned long)(o),\ | ||
141 | (unsigned long)(n), sizeof(*(ptr)))) | ||
142 | |||
143 | #define cmpxchg64_local(ptr, o, n) __cmpxchg64_local_generic((ptr), (o), (n)) | ||
144 | |||
145 | static inline int __atomic_add_unless(atomic_t *v, int a, int u) | 139 | static inline int __atomic_add_unless(atomic_t *v, int a, int u) |
146 | { | 140 | { |
147 | int c, old; | 141 | int c, old; |
diff --git a/include/asm-generic/cmpxchg.h b/include/asm-generic/cmpxchg.h index 14883026015d..811fb1e9b061 100644 --- a/include/asm-generic/cmpxchg.h +++ b/include/asm-generic/cmpxchg.h | |||
@@ -92,6 +92,16 @@ unsigned long __xchg(unsigned long x, volatile void *ptr, int size) | |||
92 | */ | 92 | */ |
93 | #include <asm-generic/cmpxchg-local.h> | 93 | #include <asm-generic/cmpxchg-local.h> |
94 | 94 | ||
95 | #ifndef cmpxchg_local | ||
96 | #define cmpxchg_local(ptr, o, n) \ | ||
97 | ((__typeof__(*(ptr)))__cmpxchg_local_generic((ptr), (unsigned long)(o),\ | ||
98 | (unsigned long)(n), sizeof(*(ptr)))) | ||
99 | #endif | ||
100 | |||
101 | #ifndef cmpxchg64_local | ||
102 | #define cmpxchg64_local(ptr, o, n) __cmpxchg64_local_generic((ptr), (o), (n)) | ||
103 | #endif | ||
104 | |||
95 | #define cmpxchg(ptr, o, n) cmpxchg_local((ptr), (o), (n)) | 105 | #define cmpxchg(ptr, o, n) cmpxchg_local((ptr), (o), (n)) |
96 | #define cmpxchg64(ptr, o, n) cmpxchg64_local((ptr), (o), (n)) | 106 | #define cmpxchg64(ptr, o, n) cmpxchg64_local((ptr), (o), (n)) |
97 | 107 | ||
diff --git a/include/drm/drm_pciids.h b/include/drm/drm_pciids.h index a386b0b654cc..918e8fe2f5e9 100644 --- a/include/drm/drm_pciids.h +++ b/include/drm/drm_pciids.h | |||
@@ -581,7 +581,11 @@ | |||
581 | {0x1002, 0x9908, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ | 581 | {0x1002, 0x9908, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ |
582 | {0x1002, 0x9909, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ | 582 | {0x1002, 0x9909, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ |
583 | {0x1002, 0x990A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ | 583 | {0x1002, 0x990A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ |
584 | {0x1002, 0x990F, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ | 584 | {0x1002, 0x990B, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ |
585 | {0x1002, 0x990C, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ | ||
586 | {0x1002, 0x990D, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ | ||
587 | {0x1002, 0x990E, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ | ||
588 | {0x1002, 0x990F, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ | ||
585 | {0x1002, 0x9910, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ | 589 | {0x1002, 0x9910, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ |
586 | {0x1002, 0x9913, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ | 590 | {0x1002, 0x9913, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ |
587 | {0x1002, 0x9917, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ | 591 | {0x1002, 0x9917, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ |
@@ -592,6 +596,13 @@ | |||
592 | {0x1002, 0x9992, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ | 596 | {0x1002, 0x9992, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ |
593 | {0x1002, 0x9993, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ | 597 | {0x1002, 0x9993, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ |
594 | {0x1002, 0x9994, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ | 598 | {0x1002, 0x9994, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ |
599 | {0x1002, 0x9995, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ | ||
600 | {0x1002, 0x9996, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ | ||
601 | {0x1002, 0x9997, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ | ||
602 | {0x1002, 0x9998, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ | ||
603 | {0x1002, 0x9999, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ | ||
604 | {0x1002, 0x999A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ | ||
605 | {0x1002, 0x999B, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ | ||
595 | {0x1002, 0x99A0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ | 606 | {0x1002, 0x99A0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ |
596 | {0x1002, 0x99A2, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ | 607 | {0x1002, 0x99A2, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ |
597 | {0x1002, 0x99A4, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ | 608 | {0x1002, 0x99A4, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ |
diff --git a/include/linux/edac.h b/include/linux/edac.h index 4fd4999ccb5b..0b763276f619 100644 --- a/include/linux/edac.h +++ b/include/linux/edac.h | |||
@@ -561,7 +561,6 @@ struct csrow_info { | |||
561 | 561 | ||
562 | u32 ue_count; /* Uncorrectable Errors for this csrow */ | 562 | u32 ue_count; /* Uncorrectable Errors for this csrow */ |
563 | u32 ce_count; /* Correctable Errors for this csrow */ | 563 | u32 ce_count; /* Correctable Errors for this csrow */ |
564 | u32 nr_pages; /* combined pages count of all channels */ | ||
565 | 564 | ||
566 | struct mem_ctl_info *mci; /* the parent */ | 565 | struct mem_ctl_info *mci; /* the parent */ |
567 | 566 | ||
@@ -676,11 +675,11 @@ struct mem_ctl_info { | |||
676 | * sees memory sticks ("dimms"), and the ones that sees memory ranks. | 675 | * sees memory sticks ("dimms"), and the ones that sees memory ranks. |
677 | * All old memory controllers enumerate memories per rank, but most | 676 | * All old memory controllers enumerate memories per rank, but most |
678 | * of the recent drivers enumerate memories per DIMM, instead. | 677 | * of the recent drivers enumerate memories per DIMM, instead. |
679 | * When the memory controller is per rank, mem_is_per_rank is true. | 678 | * When the memory controller is per rank, csbased is true. |
680 | */ | 679 | */ |
681 | unsigned n_layers; | 680 | unsigned n_layers; |
682 | struct edac_mc_layer *layers; | 681 | struct edac_mc_layer *layers; |
683 | bool mem_is_per_rank; | 682 | bool csbased; |
684 | 683 | ||
685 | /* | 684 | /* |
686 | * DIMM info. Will eventually remove the entire csrows_info some day | 685 | * DIMM info. Will eventually remove the entire csrows_info some day |
@@ -741,8 +740,6 @@ struct mem_ctl_info { | |||
741 | u32 fake_inject_ue; | 740 | u32 fake_inject_ue; |
742 | u16 fake_inject_count; | 741 | u16 fake_inject_count; |
743 | #endif | 742 | #endif |
744 | __u8 csbased : 1, /* csrow-based memory controller */ | ||
745 | __resv : 7; | ||
746 | }; | 743 | }; |
747 | 744 | ||
748 | #endif | 745 | #endif |
diff --git a/include/linux/hash.h b/include/linux/hash.h index 61c97ae22e01..f09a0ae4d858 100644 --- a/include/linux/hash.h +++ b/include/linux/hash.h | |||
@@ -15,6 +15,7 @@ | |||
15 | */ | 15 | */ |
16 | 16 | ||
17 | #include <asm/types.h> | 17 | #include <asm/types.h> |
18 | #include <linux/compiler.h> | ||
18 | 19 | ||
19 | /* 2^31 + 2^29 - 2^25 + 2^22 - 2^19 - 2^16 + 1 */ | 20 | /* 2^31 + 2^29 - 2^25 + 2^22 - 2^19 - 2^16 + 1 */ |
20 | #define GOLDEN_RATIO_PRIME_32 0x9e370001UL | 21 | #define GOLDEN_RATIO_PRIME_32 0x9e370001UL |
@@ -31,7 +32,7 @@ | |||
31 | #error Wordsize not 32 or 64 | 32 | #error Wordsize not 32 or 64 |
32 | #endif | 33 | #endif |
33 | 34 | ||
34 | static inline u64 hash_64(u64 val, unsigned int bits) | 35 | static __always_inline u64 hash_64(u64 val, unsigned int bits) |
35 | { | 36 | { |
36 | u64 hash = val; | 37 | u64 hash = val; |
37 | 38 | ||
diff --git a/include/linux/idr.h b/include/linux/idr.h index a6f38b5c34e4..2640c7e99e51 100644 --- a/include/linux/idr.h +++ b/include/linux/idr.h | |||
@@ -73,8 +73,6 @@ struct idr { | |||
73 | */ | 73 | */ |
74 | 74 | ||
75 | void *idr_find_slowpath(struct idr *idp, int id); | 75 | void *idr_find_slowpath(struct idr *idp, int id); |
76 | int idr_pre_get(struct idr *idp, gfp_t gfp_mask); | ||
77 | int idr_get_new_above(struct idr *idp, void *ptr, int starting_id, int *id); | ||
78 | void idr_preload(gfp_t gfp_mask); | 76 | void idr_preload(gfp_t gfp_mask); |
79 | int idr_alloc(struct idr *idp, void *ptr, int start, int end, gfp_t gfp_mask); | 77 | int idr_alloc(struct idr *idp, void *ptr, int start, int end, gfp_t gfp_mask); |
80 | int idr_for_each(struct idr *idp, | 78 | int idr_for_each(struct idr *idp, |
@@ -99,7 +97,7 @@ static inline void idr_preload_end(void) | |||
99 | 97 | ||
100 | /** | 98 | /** |
101 | * idr_find - return pointer for given id | 99 | * idr_find - return pointer for given id |
102 | * @idp: idr handle | 100 | * @idr: idr handle |
103 | * @id: lookup key | 101 | * @id: lookup key |
104 | * | 102 | * |
105 | * Return the pointer given the id it has been registered with. A %NULL | 103 | * Return the pointer given the id it has been registered with. A %NULL |
@@ -120,19 +118,6 @@ static inline void *idr_find(struct idr *idr, int id) | |||
120 | } | 118 | } |
121 | 119 | ||
122 | /** | 120 | /** |
123 | * idr_get_new - allocate new idr entry | ||
124 | * @idp: idr handle | ||
125 | * @ptr: pointer you want associated with the id | ||
126 | * @id: pointer to the allocated handle | ||
127 | * | ||
128 | * Simple wrapper around idr_get_new_above() w/ @starting_id of zero. | ||
129 | */ | ||
130 | static inline int idr_get_new(struct idr *idp, void *ptr, int *id) | ||
131 | { | ||
132 | return idr_get_new_above(idp, ptr, 0, id); | ||
133 | } | ||
134 | |||
135 | /** | ||
136 | * idr_for_each_entry - iterate over an idr's elements of a given type | 121 | * idr_for_each_entry - iterate over an idr's elements of a given type |
137 | * @idp: idr handle | 122 | * @idp: idr handle |
138 | * @entry: the type * to use as cursor | 123 | * @entry: the type * to use as cursor |
@@ -143,7 +128,56 @@ static inline int idr_get_new(struct idr *idp, void *ptr, int *id) | |||
143 | entry != NULL; \ | 128 | entry != NULL; \ |
144 | ++id, entry = (typeof(entry))idr_get_next((idp), &(id))) | 129 | ++id, entry = (typeof(entry))idr_get_next((idp), &(id))) |
145 | 130 | ||
146 | void __idr_remove_all(struct idr *idp); /* don't use */ | 131 | /* |
132 | * Don't use the following functions. These exist only to suppress | ||
133 | * deprecated warnings on EXPORT_SYMBOL()s. | ||
134 | */ | ||
135 | int __idr_pre_get(struct idr *idp, gfp_t gfp_mask); | ||
136 | int __idr_get_new_above(struct idr *idp, void *ptr, int starting_id, int *id); | ||
137 | void __idr_remove_all(struct idr *idp); | ||
138 | |||
139 | /** | ||
140 | * idr_pre_get - reserve resources for idr allocation | ||
141 | * @idp: idr handle | ||
142 | * @gfp_mask: memory allocation flags | ||
143 | * | ||
144 | * Part of old alloc interface. This is going away. Use | ||
145 | * idr_preload[_end]() and idr_alloc() instead. | ||
146 | */ | ||
147 | static inline int __deprecated idr_pre_get(struct idr *idp, gfp_t gfp_mask) | ||
148 | { | ||
149 | return __idr_pre_get(idp, gfp_mask); | ||
150 | } | ||
151 | |||
152 | /** | ||
153 | * idr_get_new_above - allocate new idr entry above or equal to a start id | ||
154 | * @idp: idr handle | ||
155 | * @ptr: pointer you want associated with the id | ||
156 | * @starting_id: id to start search at | ||
157 | * @id: pointer to the allocated handle | ||
158 | * | ||
159 | * Part of old alloc interface. This is going away. Use | ||
160 | * idr_preload[_end]() and idr_alloc() instead. | ||
161 | */ | ||
162 | static inline int __deprecated idr_get_new_above(struct idr *idp, void *ptr, | ||
163 | int starting_id, int *id) | ||
164 | { | ||
165 | return __idr_get_new_above(idp, ptr, starting_id, id); | ||
166 | } | ||
167 | |||
168 | /** | ||
169 | * idr_get_new - allocate new idr entry | ||
170 | * @idp: idr handle | ||
171 | * @ptr: pointer you want associated with the id | ||
172 | * @id: pointer to the allocated handle | ||
173 | * | ||
174 | * Part of old alloc interface. This is going away. Use | ||
175 | * idr_preload[_end]() and idr_alloc() instead. | ||
176 | */ | ||
177 | static inline int __deprecated idr_get_new(struct idr *idp, void *ptr, int *id) | ||
178 | { | ||
179 | return __idr_get_new_above(idp, ptr, 0, id); | ||
180 | } | ||
147 | 181 | ||
148 | /** | 182 | /** |
149 | * idr_remove_all - remove all ids from the given idr tree | 183 | * idr_remove_all - remove all ids from the given idr tree |
diff --git a/include/linux/iio/common/st_sensors.h b/include/linux/iio/common/st_sensors.h index 1f86a97ab2e2..8bd12be0b02f 100644 --- a/include/linux/iio/common/st_sensors.h +++ b/include/linux/iio/common/st_sensors.h | |||
@@ -227,14 +227,17 @@ struct st_sensor_data { | |||
227 | }; | 227 | }; |
228 | 228 | ||
229 | #ifdef CONFIG_IIO_BUFFER | 229 | #ifdef CONFIG_IIO_BUFFER |
230 | irqreturn_t st_sensors_trigger_handler(int irq, void *p); | ||
231 | |||
232 | int st_sensors_get_buffer_element(struct iio_dev *indio_dev, u8 *buf); | ||
233 | #endif | ||
234 | |||
235 | #ifdef CONFIG_IIO_TRIGGER | ||
230 | int st_sensors_allocate_trigger(struct iio_dev *indio_dev, | 236 | int st_sensors_allocate_trigger(struct iio_dev *indio_dev, |
231 | const struct iio_trigger_ops *trigger_ops); | 237 | const struct iio_trigger_ops *trigger_ops); |
232 | 238 | ||
233 | void st_sensors_deallocate_trigger(struct iio_dev *indio_dev); | 239 | void st_sensors_deallocate_trigger(struct iio_dev *indio_dev); |
234 | 240 | ||
235 | irqreturn_t st_sensors_trigger_handler(int irq, void *p); | ||
236 | |||
237 | int st_sensors_get_buffer_element(struct iio_dev *indio_dev, u8 *buf); | ||
238 | #else | 241 | #else |
239 | static inline int st_sensors_allocate_trigger(struct iio_dev *indio_dev, | 242 | static inline int st_sensors_allocate_trigger(struct iio_dev *indio_dev, |
240 | const struct iio_trigger_ops *trigger_ops) | 243 | const struct iio_trigger_ops *trigger_ops) |
diff --git a/include/linux/irq_work.h b/include/linux/irq_work.h index f5dbce50466e..66017028dcb3 100644 --- a/include/linux/irq_work.h +++ b/include/linux/irq_work.h | |||
@@ -37,7 +37,7 @@ void irq_work_sync(struct irq_work *work); | |||
37 | #ifdef CONFIG_IRQ_WORK | 37 | #ifdef CONFIG_IRQ_WORK |
38 | bool irq_work_needs_cpu(void); | 38 | bool irq_work_needs_cpu(void); |
39 | #else | 39 | #else |
40 | static bool irq_work_needs_cpu(void) { return false; } | 40 | static inline bool irq_work_needs_cpu(void) { return false; } |
41 | #endif | 41 | #endif |
42 | 42 | ||
43 | #endif /* _LINUX_IRQ_WORK_H */ | 43 | #endif /* _LINUX_IRQ_WORK_H */ |
diff --git a/include/linux/kernel.h b/include/linux/kernel.h index 80d36874689b..79fdd80a42d4 100644 --- a/include/linux/kernel.h +++ b/include/linux/kernel.h | |||
@@ -390,7 +390,6 @@ extern struct pid *session_of_pgrp(struct pid *pgrp); | |||
390 | unsigned long int_sqrt(unsigned long); | 390 | unsigned long int_sqrt(unsigned long); |
391 | 391 | ||
392 | extern void bust_spinlocks(int yes); | 392 | extern void bust_spinlocks(int yes); |
393 | extern void wake_up_klogd(void); | ||
394 | extern int oops_in_progress; /* If set, an oops, panic(), BUG() or die() is in progress */ | 393 | extern int oops_in_progress; /* If set, an oops, panic(), BUG() or die() is in progress */ |
395 | extern int panic_timeout; | 394 | extern int panic_timeout; |
396 | extern int panic_on_oops; | 395 | extern int panic_on_oops; |
diff --git a/include/linux/list.h b/include/linux/list.h index d991cc147c98..6a1f8df9144b 100644 --- a/include/linux/list.h +++ b/include/linux/list.h | |||
@@ -667,7 +667,9 @@ static inline void hlist_move_list(struct hlist_head *old, | |||
667 | pos = n) | 667 | pos = n) |
668 | 668 | ||
669 | #define hlist_entry_safe(ptr, type, member) \ | 669 | #define hlist_entry_safe(ptr, type, member) \ |
670 | (ptr) ? hlist_entry(ptr, type, member) : NULL | 670 | ({ typeof(ptr) ____ptr = (ptr); \ |
671 | ____ptr ? hlist_entry(____ptr, type, member) : NULL; \ | ||
672 | }) | ||
671 | 673 | ||
672 | /** | 674 | /** |
673 | * hlist_for_each_entry - iterate over list of given type | 675 | * hlist_for_each_entry - iterate over list of given type |
diff --git a/include/linux/mbus.h b/include/linux/mbus.h index efa1a6d7aca8..dba482e31a13 100644 --- a/include/linux/mbus.h +++ b/include/linux/mbus.h | |||
@@ -32,6 +32,20 @@ struct mbus_dram_target_info | |||
32 | } cs[4]; | 32 | } cs[4]; |
33 | }; | 33 | }; |
34 | 34 | ||
35 | /* Flags for PCI/PCIe address decoding regions */ | ||
36 | #define MVEBU_MBUS_PCI_IO 0x1 | ||
37 | #define MVEBU_MBUS_PCI_MEM 0x2 | ||
38 | #define MVEBU_MBUS_PCI_WA 0x3 | ||
39 | |||
40 | /* | ||
41 | * Magic value that explicits that we don't need a remapping-capable | ||
42 | * address decoding window. | ||
43 | */ | ||
44 | #define MVEBU_MBUS_NO_REMAP (0xffffffff) | ||
45 | |||
46 | /* Maximum size of a mbus window name */ | ||
47 | #define MVEBU_MBUS_MAX_WINNAME_SZ 32 | ||
48 | |||
35 | /* | 49 | /* |
36 | * The Marvell mbus is to be found only on SOCs from the Orion family | 50 | * The Marvell mbus is to be found only on SOCs from the Orion family |
37 | * at the moment. Provide a dummy stub for other architectures. | 51 | * at the moment. Provide a dummy stub for other architectures. |
@@ -44,4 +58,15 @@ static inline const struct mbus_dram_target_info *mv_mbus_dram_info(void) | |||
44 | return NULL; | 58 | return NULL; |
45 | } | 59 | } |
46 | #endif | 60 | #endif |
47 | #endif | 61 | |
62 | int mvebu_mbus_add_window_remap_flags(const char *devname, phys_addr_t base, | ||
63 | size_t size, phys_addr_t remap, | ||
64 | unsigned int flags); | ||
65 | int mvebu_mbus_add_window(const char *devname, phys_addr_t base, | ||
66 | size_t size); | ||
67 | int mvebu_mbus_del_window(phys_addr_t base, size_t size); | ||
68 | int mvebu_mbus_init(const char *soc, phys_addr_t mbus_phys_base, | ||
69 | size_t mbus_size, phys_addr_t sdram_phys_base, | ||
70 | size_t sdram_size); | ||
71 | |||
72 | #endif /* __LINUX_MBUS_H */ | ||
diff --git a/include/linux/mfd/palmas.h b/include/linux/mfd/palmas.h index a4d13d7cd001..3bbda22721ea 100644 --- a/include/linux/mfd/palmas.h +++ b/include/linux/mfd/palmas.h | |||
@@ -221,6 +221,7 @@ struct palmas_clk_platform_data { | |||
221 | }; | 221 | }; |
222 | 222 | ||
223 | struct palmas_platform_data { | 223 | struct palmas_platform_data { |
224 | int irq_flags; | ||
224 | int gpio_base; | 225 | int gpio_base; |
225 | 226 | ||
226 | /* bit value to be loaded to the POWER_CTRL register */ | 227 | /* bit value to be loaded to the POWER_CTRL register */ |
diff --git a/include/linux/mfd/tps65912.h b/include/linux/mfd/tps65912.h index aaceab402ec5..6d309032dc0d 100644 --- a/include/linux/mfd/tps65912.h +++ b/include/linux/mfd/tps65912.h | |||
@@ -323,5 +323,6 @@ int tps65912_device_init(struct tps65912 *tps65912); | |||
323 | void tps65912_device_exit(struct tps65912 *tps65912); | 323 | void tps65912_device_exit(struct tps65912 *tps65912); |
324 | int tps65912_irq_init(struct tps65912 *tps65912, int irq, | 324 | int tps65912_irq_init(struct tps65912 *tps65912, int irq, |
325 | struct tps65912_platform_data *pdata); | 325 | struct tps65912_platform_data *pdata); |
326 | int tps65912_irq_exit(struct tps65912 *tps65912); | ||
326 | 327 | ||
327 | #endif /* __LINUX_MFD_TPS65912_H */ | 328 | #endif /* __LINUX_MFD_TPS65912_H */ |
diff --git a/include/linux/mfd/wm831x/auxadc.h b/include/linux/mfd/wm831x/auxadc.h index b132067e9e99..867aa23f9370 100644 --- a/include/linux/mfd/wm831x/auxadc.h +++ b/include/linux/mfd/wm831x/auxadc.h | |||
@@ -15,6 +15,8 @@ | |||
15 | #ifndef __MFD_WM831X_AUXADC_H__ | 15 | #ifndef __MFD_WM831X_AUXADC_H__ |
16 | #define __MFD_WM831X_AUXADC_H__ | 16 | #define __MFD_WM831X_AUXADC_H__ |
17 | 17 | ||
18 | struct wm831x; | ||
19 | |||
18 | /* | 20 | /* |
19 | * R16429 (0x402D) - AuxADC Data | 21 | * R16429 (0x402D) - AuxADC Data |
20 | */ | 22 | */ |
diff --git a/include/linux/mfd/wm831x/core.h b/include/linux/mfd/wm831x/core.h index 4a3b83a77614..76c22648436f 100644 --- a/include/linux/mfd/wm831x/core.h +++ b/include/linux/mfd/wm831x/core.h | |||
@@ -20,6 +20,7 @@ | |||
20 | #include <linux/irqdomain.h> | 20 | #include <linux/irqdomain.h> |
21 | #include <linux/list.h> | 21 | #include <linux/list.h> |
22 | #include <linux/regmap.h> | 22 | #include <linux/regmap.h> |
23 | #include <linux/mfd/wm831x/auxadc.h> | ||
23 | 24 | ||
24 | /* | 25 | /* |
25 | * Register values. | 26 | * Register values. |
@@ -355,7 +356,6 @@ enum wm831x_parent { | |||
355 | }; | 356 | }; |
356 | 357 | ||
357 | struct wm831x; | 358 | struct wm831x; |
358 | enum wm831x_auxadc; | ||
359 | 359 | ||
360 | typedef int (*wm831x_auxadc_read_fn)(struct wm831x *wm831x, | 360 | typedef int (*wm831x_auxadc_read_fn)(struct wm831x *wm831x, |
361 | enum wm831x_auxadc input); | 361 | enum wm831x_auxadc input); |
diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h index ede274957e05..c74092eebf5c 100644 --- a/include/linux/mmzone.h +++ b/include/linux/mmzone.h | |||
@@ -527,7 +527,7 @@ static inline int zone_is_oom_locked(const struct zone *zone) | |||
527 | return test_bit(ZONE_OOM_LOCKED, &zone->flags); | 527 | return test_bit(ZONE_OOM_LOCKED, &zone->flags); |
528 | } | 528 | } |
529 | 529 | ||
530 | static inline unsigned zone_end_pfn(const struct zone *zone) | 530 | static inline unsigned long zone_end_pfn(const struct zone *zone) |
531 | { | 531 | { |
532 | return zone->zone_start_pfn + zone->spanned_pages; | 532 | return zone->zone_start_pfn + zone->spanned_pages; |
533 | } | 533 | } |
diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h index 7ccb3c59ed60..ef52d9c91459 100644 --- a/include/linux/mtd/nand.h +++ b/include/linux/mtd/nand.h | |||
@@ -187,6 +187,13 @@ typedef enum { | |||
187 | * This happens with the Renesas AG-AND chips, possibly others. | 187 | * This happens with the Renesas AG-AND chips, possibly others. |
188 | */ | 188 | */ |
189 | #define BBT_AUTO_REFRESH 0x00000080 | 189 | #define BBT_AUTO_REFRESH 0x00000080 |
190 | /* | ||
191 | * Chip requires ready check on read (for auto-incremented sequential read). | ||
192 | * True only for small page devices; large page devices do not support | ||
193 | * autoincrement. | ||
194 | */ | ||
195 | #define NAND_NEED_READRDY 0x00000100 | ||
196 | |||
190 | /* Chip does not allow subpage writes */ | 197 | /* Chip does not allow subpage writes */ |
191 | #define NAND_NO_SUBPAGE_WRITE 0x00000200 | 198 | #define NAND_NO_SUBPAGE_WRITE 0x00000200 |
192 | 199 | ||
diff --git a/include/linux/nvme.h b/include/linux/nvme.h index c25cccaa555a..4fa3b0b9b071 100644 --- a/include/linux/nvme.h +++ b/include/linux/nvme.h | |||
@@ -137,6 +137,34 @@ enum { | |||
137 | NVME_LBAF_RP_DEGRADED = 3, | 137 | NVME_LBAF_RP_DEGRADED = 3, |
138 | }; | 138 | }; |
139 | 139 | ||
140 | struct nvme_smart_log { | ||
141 | __u8 critical_warning; | ||
142 | __u8 temperature[2]; | ||
143 | __u8 avail_spare; | ||
144 | __u8 spare_thresh; | ||
145 | __u8 percent_used; | ||
146 | __u8 rsvd6[26]; | ||
147 | __u8 data_units_read[16]; | ||
148 | __u8 data_units_written[16]; | ||
149 | __u8 host_reads[16]; | ||
150 | __u8 host_writes[16]; | ||
151 | __u8 ctrl_busy_time[16]; | ||
152 | __u8 power_cycles[16]; | ||
153 | __u8 power_on_hours[16]; | ||
154 | __u8 unsafe_shutdowns[16]; | ||
155 | __u8 media_errors[16]; | ||
156 | __u8 num_err_log_entries[16]; | ||
157 | __u8 rsvd192[320]; | ||
158 | }; | ||
159 | |||
160 | enum { | ||
161 | NVME_SMART_CRIT_SPARE = 1 << 0, | ||
162 | NVME_SMART_CRIT_TEMPERATURE = 1 << 1, | ||
163 | NVME_SMART_CRIT_RELIABILITY = 1 << 2, | ||
164 | NVME_SMART_CRIT_MEDIA = 1 << 3, | ||
165 | NVME_SMART_CRIT_VOLATILE_MEMORY = 1 << 4, | ||
166 | }; | ||
167 | |||
140 | struct nvme_lba_range_type { | 168 | struct nvme_lba_range_type { |
141 | __u8 type; | 169 | __u8 type; |
142 | __u8 attributes; | 170 | __u8 attributes; |
diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h index e47ee462c2f2..1d795df6f4cf 100644 --- a/include/linux/perf_event.h +++ b/include/linux/perf_event.h | |||
@@ -799,6 +799,12 @@ static inline int __perf_event_disable(void *info) { return -1; } | |||
799 | static inline void perf_event_task_tick(void) { } | 799 | static inline void perf_event_task_tick(void) { } |
800 | #endif | 800 | #endif |
801 | 801 | ||
802 | #if defined(CONFIG_PERF_EVENTS) && defined(CONFIG_CPU_SUP_INTEL) | ||
803 | extern void perf_restore_debug_store(void); | ||
804 | #else | ||
805 | static inline void perf_restore_debug_store(void) { } | ||
806 | #endif | ||
807 | |||
802 | #define perf_output_put(handle, x) perf_output_copy((handle), &(x), sizeof(x)) | 808 | #define perf_output_put(handle, x) perf_output_copy((handle), &(x), sizeof(x)) |
803 | 809 | ||
804 | /* | 810 | /* |
diff --git a/include/linux/printk.h b/include/linux/printk.h index 1249a54d17e0..822171fcb1c8 100644 --- a/include/linux/printk.h +++ b/include/linux/printk.h | |||
@@ -134,6 +134,8 @@ extern int printk_delay_msec; | |||
134 | extern int dmesg_restrict; | 134 | extern int dmesg_restrict; |
135 | extern int kptr_restrict; | 135 | extern int kptr_restrict; |
136 | 136 | ||
137 | extern void wake_up_klogd(void); | ||
138 | |||
137 | void log_buf_kexec_setup(void); | 139 | void log_buf_kexec_setup(void); |
138 | void __init setup_log_buf(int early); | 140 | void __init setup_log_buf(int early); |
139 | #else | 141 | #else |
@@ -162,6 +164,10 @@ static inline bool printk_timed_ratelimit(unsigned long *caller_jiffies, | |||
162 | return false; | 164 | return false; |
163 | } | 165 | } |
164 | 166 | ||
167 | static inline void wake_up_klogd(void) | ||
168 | { | ||
169 | } | ||
170 | |||
165 | static inline void log_buf_kexec_setup(void) | 171 | static inline void log_buf_kexec_setup(void) |
166 | { | 172 | { |
167 | } | 173 | } |
diff --git a/include/linux/res_counter.h b/include/linux/res_counter.h index 5ae8456d9670..c23099413ad6 100644 --- a/include/linux/res_counter.h +++ b/include/linux/res_counter.h | |||
@@ -14,6 +14,7 @@ | |||
14 | */ | 14 | */ |
15 | 15 | ||
16 | #include <linux/cgroup.h> | 16 | #include <linux/cgroup.h> |
17 | #include <linux/errno.h> | ||
17 | 18 | ||
18 | /* | 19 | /* |
19 | * The core object. the cgroup that wishes to account for some | 20 | * The core object. the cgroup that wishes to account for some |
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index 821c7f45d2a7..441f5bfdab8e 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h | |||
@@ -500,7 +500,7 @@ struct sk_buff { | |||
500 | union { | 500 | union { |
501 | __u32 mark; | 501 | __u32 mark; |
502 | __u32 dropcount; | 502 | __u32 dropcount; |
503 | __u32 avail_size; | 503 | __u32 reserved_tailroom; |
504 | }; | 504 | }; |
505 | 505 | ||
506 | sk_buff_data_t inner_transport_header; | 506 | sk_buff_data_t inner_transport_header; |
@@ -1288,11 +1288,13 @@ static inline void __skb_fill_page_desc(struct sk_buff *skb, int i, | |||
1288 | * do not lose pfmemalloc information as the pages would not be | 1288 | * do not lose pfmemalloc information as the pages would not be |
1289 | * allocated using __GFP_MEMALLOC. | 1289 | * allocated using __GFP_MEMALLOC. |
1290 | */ | 1290 | */ |
1291 | if (page->pfmemalloc && !page->mapping) | ||
1292 | skb->pfmemalloc = true; | ||
1293 | frag->page.p = page; | 1291 | frag->page.p = page; |
1294 | frag->page_offset = off; | 1292 | frag->page_offset = off; |
1295 | skb_frag_size_set(frag, size); | 1293 | skb_frag_size_set(frag, size); |
1294 | |||
1295 | page = compound_head(page); | ||
1296 | if (page->pfmemalloc && !page->mapping) | ||
1297 | skb->pfmemalloc = true; | ||
1296 | } | 1298 | } |
1297 | 1299 | ||
1298 | /** | 1300 | /** |
@@ -1447,7 +1449,10 @@ static inline int skb_tailroom(const struct sk_buff *skb) | |||
1447 | */ | 1449 | */ |
1448 | static inline int skb_availroom(const struct sk_buff *skb) | 1450 | static inline int skb_availroom(const struct sk_buff *skb) |
1449 | { | 1451 | { |
1450 | return skb_is_nonlinear(skb) ? 0 : skb->avail_size - skb->len; | 1452 | if (skb_is_nonlinear(skb)) |
1453 | return 0; | ||
1454 | |||
1455 | return skb->end - skb->tail - skb->reserved_tailroom; | ||
1451 | } | 1456 | } |
1452 | 1457 | ||
1453 | /** | 1458 | /** |
diff --git a/include/linux/usb/cdc_ncm.h b/include/linux/usb/cdc_ncm.h index 3b8f9d4fc3fe..cc25b70af33c 100644 --- a/include/linux/usb/cdc_ncm.h +++ b/include/linux/usb/cdc_ncm.h | |||
@@ -127,6 +127,7 @@ struct cdc_ncm_ctx { | |||
127 | u16 connected; | 127 | u16 connected; |
128 | }; | 128 | }; |
129 | 129 | ||
130 | extern u8 cdc_ncm_select_altsetting(struct usbnet *dev, struct usb_interface *intf); | ||
130 | extern int cdc_ncm_bind_common(struct usbnet *dev, struct usb_interface *intf, u8 data_altsetting); | 131 | extern int cdc_ncm_bind_common(struct usbnet *dev, struct usb_interface *intf, u8 data_altsetting); |
131 | extern void cdc_ncm_unbind(struct usbnet *dev, struct usb_interface *intf); | 132 | extern void cdc_ncm_unbind(struct usbnet *dev, struct usb_interface *intf); |
132 | extern struct sk_buff *cdc_ncm_fill_tx_frame(struct cdc_ncm_ctx *ctx, struct sk_buff *skb, __le32 sign); | 133 | extern struct sk_buff *cdc_ncm_fill_tx_frame(struct cdc_ncm_ctx *ctx, struct sk_buff *skb, __le32 sign); |
diff --git a/include/linux/usb/composite.h b/include/linux/usb/composite.h index 3c671c1b37f6..8860594d6364 100644 --- a/include/linux/usb/composite.h +++ b/include/linux/usb/composite.h | |||
@@ -60,7 +60,7 @@ struct usb_configuration; | |||
60 | * @name: For diagnostics, identifies the function. | 60 | * @name: For diagnostics, identifies the function. |
61 | * @strings: tables of strings, keyed by identifiers assigned during bind() | 61 | * @strings: tables of strings, keyed by identifiers assigned during bind() |
62 | * and by language IDs provided in control requests | 62 | * and by language IDs provided in control requests |
63 | * @descriptors: Table of full (or low) speed descriptors, using interface and | 63 | * @fs_descriptors: Table of full (or low) speed descriptors, using interface and |
64 | * string identifiers assigned during @bind(). If this pointer is null, | 64 | * string identifiers assigned during @bind(). If this pointer is null, |
65 | * the function will not be available at full speed (or at low speed). | 65 | * the function will not be available at full speed (or at low speed). |
66 | * @hs_descriptors: Table of high speed descriptors, using interface and | 66 | * @hs_descriptors: Table of high speed descriptors, using interface and |
@@ -290,6 +290,7 @@ enum { | |||
290 | * after function notifications | 290 | * after function notifications |
291 | * @resume: Notifies configuration when the host restarts USB traffic, | 291 | * @resume: Notifies configuration when the host restarts USB traffic, |
292 | * before function notifications | 292 | * before function notifications |
293 | * @gadget_driver: Gadget driver controlling this driver | ||
293 | * | 294 | * |
294 | * Devices default to reporting self powered operation. Devices which rely | 295 | * Devices default to reporting self powered operation. Devices which rely |
295 | * on bus powered operation should report this in their @bind method. | 296 | * on bus powered operation should report this in their @bind method. |
diff --git a/include/linux/usb/serial.h b/include/linux/usb/serial.h index ef9be7e1e190..1819b59aab2a 100644 --- a/include/linux/usb/serial.h +++ b/include/linux/usb/serial.h | |||
@@ -66,6 +66,7 @@ | |||
66 | * port. | 66 | * port. |
67 | * @flags: usb serial port flags | 67 | * @flags: usb serial port flags |
68 | * @write_wait: a wait_queue_head_t used by the port. | 68 | * @write_wait: a wait_queue_head_t used by the port. |
69 | * @delta_msr_wait: modem-status-change wait queue | ||
69 | * @work: work queue entry for the line discipline waking up. | 70 | * @work: work queue entry for the line discipline waking up. |
70 | * @throttled: nonzero if the read urb is inactive to throttle the device | 71 | * @throttled: nonzero if the read urb is inactive to throttle the device |
71 | * @throttle_req: nonzero if the tty wants to throttle us | 72 | * @throttle_req: nonzero if the tty wants to throttle us |
@@ -112,6 +113,7 @@ struct usb_serial_port { | |||
112 | 113 | ||
113 | unsigned long flags; | 114 | unsigned long flags; |
114 | wait_queue_head_t write_wait; | 115 | wait_queue_head_t write_wait; |
116 | wait_queue_head_t delta_msr_wait; | ||
115 | struct work_struct work; | 117 | struct work_struct work; |
116 | char throttled; | 118 | char throttled; |
117 | char throttle_req; | 119 | char throttle_req; |
diff --git a/include/linux/usb/ulpi.h b/include/linux/usb/ulpi.h index 6f033a415ecb..5c295c26ad37 100644 --- a/include/linux/usb/ulpi.h +++ b/include/linux/usb/ulpi.h | |||
@@ -181,8 +181,16 @@ | |||
181 | 181 | ||
182 | /*-------------------------------------------------------------------------*/ | 182 | /*-------------------------------------------------------------------------*/ |
183 | 183 | ||
184 | #if IS_ENABLED(CONFIG_USB_ULPI) | ||
184 | struct usb_phy *otg_ulpi_create(struct usb_phy_io_ops *ops, | 185 | struct usb_phy *otg_ulpi_create(struct usb_phy_io_ops *ops, |
185 | unsigned int flags); | 186 | unsigned int flags); |
187 | #else | ||
188 | static inline struct usb_phy *otg_ulpi_create(struct usb_phy_io_ops *ops, | ||
189 | unsigned int flags) | ||
190 | { | ||
191 | return NULL; | ||
192 | } | ||
193 | #endif | ||
186 | 194 | ||
187 | #ifdef CONFIG_USB_ULPI_VIEWPORT | 195 | #ifdef CONFIG_USB_ULPI_VIEWPORT |
188 | /* access ops for controllers with a viewport register */ | 196 | /* access ops for controllers with a viewport register */ |
diff --git a/include/net/dst.h b/include/net/dst.h index 853cda11e518..1f8fd109e225 100644 --- a/include/net/dst.h +++ b/include/net/dst.h | |||
@@ -413,13 +413,15 @@ static inline int dst_neigh_output(struct dst_entry *dst, struct neighbour *n, | |||
413 | 413 | ||
414 | static inline struct neighbour *dst_neigh_lookup(const struct dst_entry *dst, const void *daddr) | 414 | static inline struct neighbour *dst_neigh_lookup(const struct dst_entry *dst, const void *daddr) |
415 | { | 415 | { |
416 | return dst->ops->neigh_lookup(dst, NULL, daddr); | 416 | struct neighbour *n = dst->ops->neigh_lookup(dst, NULL, daddr); |
417 | return IS_ERR(n) ? NULL : n; | ||
417 | } | 418 | } |
418 | 419 | ||
419 | static inline struct neighbour *dst_neigh_lookup_skb(const struct dst_entry *dst, | 420 | static inline struct neighbour *dst_neigh_lookup_skb(const struct dst_entry *dst, |
420 | struct sk_buff *skb) | 421 | struct sk_buff *skb) |
421 | { | 422 | { |
422 | return dst->ops->neigh_lookup(dst, skb, NULL); | 423 | struct neighbour *n = dst->ops->neigh_lookup(dst, skb, NULL); |
424 | return IS_ERR(n) ? NULL : n; | ||
423 | } | 425 | } |
424 | 426 | ||
425 | static inline void dst_link_failure(struct sk_buff *skb) | 427 | static inline void dst_link_failure(struct sk_buff *skb) |
diff --git a/include/net/inet_frag.h b/include/net/inet_frag.h index 76c3fe5ecc2e..0a1dcc2fa2f5 100644 --- a/include/net/inet_frag.h +++ b/include/net/inet_frag.h | |||
@@ -43,6 +43,13 @@ struct inet_frag_queue { | |||
43 | 43 | ||
44 | #define INETFRAGS_HASHSZ 64 | 44 | #define INETFRAGS_HASHSZ 64 |
45 | 45 | ||
46 | /* averaged: | ||
47 | * max_depth = default ipfrag_high_thresh / INETFRAGS_HASHSZ / | ||
48 | * rounded up (SKB_TRUELEN(0) + sizeof(struct ipq or | ||
49 | * struct frag_queue)) | ||
50 | */ | ||
51 | #define INETFRAGS_MAXDEPTH 128 | ||
52 | |||
46 | struct inet_frags { | 53 | struct inet_frags { |
47 | struct hlist_head hash[INETFRAGS_HASHSZ]; | 54 | struct hlist_head hash[INETFRAGS_HASHSZ]; |
48 | /* This rwlock is a global lock (seperate per IPv4, IPv6 and | 55 | /* This rwlock is a global lock (seperate per IPv4, IPv6 and |
@@ -76,6 +83,8 @@ int inet_frag_evictor(struct netns_frags *nf, struct inet_frags *f, bool force); | |||
76 | struct inet_frag_queue *inet_frag_find(struct netns_frags *nf, | 83 | struct inet_frag_queue *inet_frag_find(struct netns_frags *nf, |
77 | struct inet_frags *f, void *key, unsigned int hash) | 84 | struct inet_frags *f, void *key, unsigned int hash) |
78 | __releases(&f->lock); | 85 | __releases(&f->lock); |
86 | void inet_frag_maybe_warn_overflow(struct inet_frag_queue *q, | ||
87 | const char *prefix); | ||
79 | 88 | ||
80 | static inline void inet_frag_put(struct inet_frag_queue *q, struct inet_frags *f) | 89 | static inline void inet_frag_put(struct inet_frag_queue *q, struct inet_frags *f) |
81 | { | 90 | { |
diff --git a/include/net/ip_fib.h b/include/net/ip_fib.h index 9497be1ad4c0..e49db91593a9 100644 --- a/include/net/ip_fib.h +++ b/include/net/ip_fib.h | |||
@@ -152,18 +152,16 @@ struct fib_result_nl { | |||
152 | }; | 152 | }; |
153 | 153 | ||
154 | #ifdef CONFIG_IP_ROUTE_MULTIPATH | 154 | #ifdef CONFIG_IP_ROUTE_MULTIPATH |
155 | |||
156 | #define FIB_RES_NH(res) ((res).fi->fib_nh[(res).nh_sel]) | 155 | #define FIB_RES_NH(res) ((res).fi->fib_nh[(res).nh_sel]) |
157 | |||
158 | #define FIB_TABLE_HASHSZ 2 | ||
159 | |||
160 | #else /* CONFIG_IP_ROUTE_MULTIPATH */ | 156 | #else /* CONFIG_IP_ROUTE_MULTIPATH */ |
161 | |||
162 | #define FIB_RES_NH(res) ((res).fi->fib_nh[0]) | 157 | #define FIB_RES_NH(res) ((res).fi->fib_nh[0]) |
158 | #endif /* CONFIG_IP_ROUTE_MULTIPATH */ | ||
163 | 159 | ||
160 | #ifdef CONFIG_IP_MULTIPLE_TABLES | ||
164 | #define FIB_TABLE_HASHSZ 256 | 161 | #define FIB_TABLE_HASHSZ 256 |
165 | 162 | #else | |
166 | #endif /* CONFIG_IP_ROUTE_MULTIPATH */ | 163 | #define FIB_TABLE_HASHSZ 2 |
164 | #endif | ||
167 | 165 | ||
168 | extern __be32 fib_info_update_nh_saddr(struct net *net, struct fib_nh *nh); | 166 | extern __be32 fib_info_update_nh_saddr(struct net *net, struct fib_nh *nh); |
169 | 167 | ||
diff --git a/include/uapi/linux/acct.h b/include/uapi/linux/acct.h index 11b6ca3e0873..df2f9a0bba6a 100644 --- a/include/uapi/linux/acct.h +++ b/include/uapi/linux/acct.h | |||
@@ -107,10 +107,12 @@ struct acct_v3 | |||
107 | #define ACORE 0x08 /* ... dumped core */ | 107 | #define ACORE 0x08 /* ... dumped core */ |
108 | #define AXSIG 0x10 /* ... was killed by a signal */ | 108 | #define AXSIG 0x10 /* ... was killed by a signal */ |
109 | 109 | ||
110 | #ifdef __BIG_ENDIAN | 110 | #if defined(__BYTE_ORDER) ? __BYTE_ORDER == __BIG_ENDIAN : defined(__BIG_ENDIAN) |
111 | #define ACCT_BYTEORDER 0x80 /* accounting file is big endian */ | 111 | #define ACCT_BYTEORDER 0x80 /* accounting file is big endian */ |
112 | #else | 112 | #elif defined(__BYTE_ORDER) ? __BYTE_ORDER == __LITTLE_ENDIAN : defined(__LITTLE_ENDIAN) |
113 | #define ACCT_BYTEORDER 0x00 /* accounting file is little endian */ | 113 | #define ACCT_BYTEORDER 0x00 /* accounting file is little endian */ |
114 | #else | ||
115 | #error unspecified endianness | ||
114 | #endif | 116 | #endif |
115 | 117 | ||
116 | #ifndef __KERNEL__ | 118 | #ifndef __KERNEL__ |
diff --git a/include/uapi/linux/aio_abi.h b/include/uapi/linux/aio_abi.h index 86fa7a71336a..bb2554f7fbd1 100644 --- a/include/uapi/linux/aio_abi.h +++ b/include/uapi/linux/aio_abi.h | |||
@@ -62,9 +62,9 @@ struct io_event { | |||
62 | __s64 res2; /* secondary result */ | 62 | __s64 res2; /* secondary result */ |
63 | }; | 63 | }; |
64 | 64 | ||
65 | #if defined(__LITTLE_ENDIAN) | 65 | #if defined(__BYTE_ORDER) ? __BYTE_ORDER == __LITTLE_ENDIAN : defined(__LITTLE_ENDIAN) |
66 | #define PADDED(x,y) x, y | 66 | #define PADDED(x,y) x, y |
67 | #elif defined(__BIG_ENDIAN) | 67 | #elif defined(__BYTE_ORDER) ? __BYTE_ORDER == __BIG_ENDIAN : defined(__BIG_ENDIAN) |
68 | #define PADDED(x,y) y, x | 68 | #define PADDED(x,y) y, x |
69 | #else | 69 | #else |
70 | #error edit for your odd byteorder. | 70 | #error edit for your odd byteorder. |
diff --git a/include/uapi/linux/raid/md_p.h b/include/uapi/linux/raid/md_p.h index ee753536ab70..fe1a5406d4d9 100644 --- a/include/uapi/linux/raid/md_p.h +++ b/include/uapi/linux/raid/md_p.h | |||
@@ -145,16 +145,18 @@ typedef struct mdp_superblock_s { | |||
145 | __u32 failed_disks; /* 4 Number of failed disks */ | 145 | __u32 failed_disks; /* 4 Number of failed disks */ |
146 | __u32 spare_disks; /* 5 Number of spare disks */ | 146 | __u32 spare_disks; /* 5 Number of spare disks */ |
147 | __u32 sb_csum; /* 6 checksum of the whole superblock */ | 147 | __u32 sb_csum; /* 6 checksum of the whole superblock */ |
148 | #ifdef __BIG_ENDIAN | 148 | #if defined(__BYTE_ORDER) ? __BYTE_ORDER == __BIG_ENDIAN : defined(__BIG_ENDIAN) |
149 | __u32 events_hi; /* 7 high-order of superblock update count */ | 149 | __u32 events_hi; /* 7 high-order of superblock update count */ |
150 | __u32 events_lo; /* 8 low-order of superblock update count */ | 150 | __u32 events_lo; /* 8 low-order of superblock update count */ |
151 | __u32 cp_events_hi; /* 9 high-order of checkpoint update count */ | 151 | __u32 cp_events_hi; /* 9 high-order of checkpoint update count */ |
152 | __u32 cp_events_lo; /* 10 low-order of checkpoint update count */ | 152 | __u32 cp_events_lo; /* 10 low-order of checkpoint update count */ |
153 | #else | 153 | #elif defined(__BYTE_ORDER) ? __BYTE_ORDER == __LITTLE_ENDIAN : defined(__LITTLE_ENDIAN) |
154 | __u32 events_lo; /* 7 low-order of superblock update count */ | 154 | __u32 events_lo; /* 7 low-order of superblock update count */ |
155 | __u32 events_hi; /* 8 high-order of superblock update count */ | 155 | __u32 events_hi; /* 8 high-order of superblock update count */ |
156 | __u32 cp_events_lo; /* 9 low-order of checkpoint update count */ | 156 | __u32 cp_events_lo; /* 9 low-order of checkpoint update count */ |
157 | __u32 cp_events_hi; /* 10 high-order of checkpoint update count */ | 157 | __u32 cp_events_hi; /* 10 high-order of checkpoint update count */ |
158 | #else | ||
159 | #error unspecified endianness | ||
158 | #endif | 160 | #endif |
159 | __u32 recovery_cp; /* 11 recovery checkpoint sector count */ | 161 | __u32 recovery_cp; /* 11 recovery checkpoint sector count */ |
160 | /* There are only valid for minor_version > 90 */ | 162 | /* There are only valid for minor_version > 90 */ |
diff --git a/include/uapi/linux/serial_core.h b/include/uapi/linux/serial_core.h index b6a23a483d74..74c2bf7211f8 100644 --- a/include/uapi/linux/serial_core.h +++ b/include/uapi/linux/serial_core.h | |||
@@ -51,7 +51,10 @@ | |||
51 | #define PORT_8250_CIR 23 /* CIR infrared port, has its own driver */ | 51 | #define PORT_8250_CIR 23 /* CIR infrared port, has its own driver */ |
52 | #define PORT_XR17V35X 24 /* Exar XR17V35x UARTs */ | 52 | #define PORT_XR17V35X 24 /* Exar XR17V35x UARTs */ |
53 | #define PORT_BRCM_TRUMANAGE 25 | 53 | #define PORT_BRCM_TRUMANAGE 25 |
54 | #define PORT_MAX_8250 25 /* max port ID */ | 54 | #define PORT_ALTR_16550_F32 26 /* Altera 16550 UART with 32 FIFOs */ |
55 | #define PORT_ALTR_16550_F64 27 /* Altera 16550 UART with 64 FIFOs */ | ||
56 | #define PORT_ALTR_16550_F128 28 /* Altera 16550 UART with 128 FIFOs */ | ||
57 | #define PORT_MAX_8250 28 /* max port ID */ | ||
55 | 58 | ||
56 | /* | 59 | /* |
57 | * ARM specific type numbers. These are not currently guaranteed | 60 | * ARM specific type numbers. These are not currently guaranteed |
diff --git a/include/video/atmel_lcdc.h b/include/video/atmel_lcdc.h index 28447f1594fa..8deb22672ada 100644 --- a/include/video/atmel_lcdc.h +++ b/include/video/atmel_lcdc.h | |||
@@ -30,7 +30,6 @@ | |||
30 | */ | 30 | */ |
31 | #define ATMEL_LCDC_WIRING_BGR 0 | 31 | #define ATMEL_LCDC_WIRING_BGR 0 |
32 | #define ATMEL_LCDC_WIRING_RGB 1 | 32 | #define ATMEL_LCDC_WIRING_RGB 1 |
33 | #define ATMEL_LCDC_WIRING_RGB555 2 | ||
34 | 33 | ||
35 | 34 | ||
36 | /* LCD Controller info data structure, stored in device platform_data */ | 35 | /* LCD Controller info data structure, stored in device platform_data */ |
@@ -62,6 +61,7 @@ struct atmel_lcdfb_info { | |||
62 | void (*atmel_lcdfb_power_control)(int on); | 61 | void (*atmel_lcdfb_power_control)(int on); |
63 | struct fb_monspecs *default_monspecs; | 62 | struct fb_monspecs *default_monspecs; |
64 | u32 pseudo_palette[16]; | 63 | u32 pseudo_palette[16]; |
64 | bool have_intensity_bit; | ||
65 | }; | 65 | }; |
66 | 66 | ||
67 | #define ATMEL_LCDC_DMABADDR1 0x00 | 67 | #define ATMEL_LCDC_DMABADDR1 0x00 |
diff --git a/init/Kconfig b/init/Kconfig index 22616cd434bc..5341d7232c3a 100644 --- a/init/Kconfig +++ b/init/Kconfig | |||
@@ -28,10 +28,6 @@ config BUILDTIME_EXTABLE_SORT | |||
28 | 28 | ||
29 | menu "General setup" | 29 | menu "General setup" |
30 | 30 | ||
31 | config EXPERIMENTAL | ||
32 | bool | ||
33 | default y | ||
34 | |||
35 | config BROKEN | 31 | config BROKEN |
36 | bool | 32 | bool |
37 | 33 | ||
diff --git a/ipc/mqueue.c b/ipc/mqueue.c index e5c4f609f22c..3953fda2e8bd 100644 --- a/ipc/mqueue.c +++ b/ipc/mqueue.c | |||
@@ -840,7 +840,8 @@ out_putfd: | |||
840 | fd = error; | 840 | fd = error; |
841 | } | 841 | } |
842 | mutex_unlock(&root->d_inode->i_mutex); | 842 | mutex_unlock(&root->d_inode->i_mutex); |
843 | mnt_drop_write(mnt); | 843 | if (!ro) |
844 | mnt_drop_write(mnt); | ||
844 | out_putname: | 845 | out_putname: |
845 | putname(name); | 846 | putname(name); |
846 | return fd; | 847 | return fd; |
diff --git a/kernel/events/core.c b/kernel/events/core.c index b0cd86501c30..59412d037eed 100644 --- a/kernel/events/core.c +++ b/kernel/events/core.c | |||
@@ -4434,12 +4434,15 @@ static void perf_event_task_event(struct perf_task_event *task_event) | |||
4434 | if (ctxn < 0) | 4434 | if (ctxn < 0) |
4435 | goto next; | 4435 | goto next; |
4436 | ctx = rcu_dereference(current->perf_event_ctxp[ctxn]); | 4436 | ctx = rcu_dereference(current->perf_event_ctxp[ctxn]); |
4437 | if (ctx) | ||
4438 | perf_event_task_ctx(ctx, task_event); | ||
4437 | } | 4439 | } |
4438 | if (ctx) | ||
4439 | perf_event_task_ctx(ctx, task_event); | ||
4440 | next: | 4440 | next: |
4441 | put_cpu_ptr(pmu->pmu_cpu_context); | 4441 | put_cpu_ptr(pmu->pmu_cpu_context); |
4442 | } | 4442 | } |
4443 | if (task_event->task_ctx) | ||
4444 | perf_event_task_ctx(task_event->task_ctx, task_event); | ||
4445 | |||
4443 | rcu_read_unlock(); | 4446 | rcu_read_unlock(); |
4444 | } | 4447 | } |
4445 | 4448 | ||
@@ -5647,6 +5650,7 @@ static void perf_swevent_init_hrtimer(struct perf_event *event) | |||
5647 | event->attr.sample_period = NSEC_PER_SEC / freq; | 5650 | event->attr.sample_period = NSEC_PER_SEC / freq; |
5648 | hwc->sample_period = event->attr.sample_period; | 5651 | hwc->sample_period = event->attr.sample_period; |
5649 | local64_set(&hwc->period_left, hwc->sample_period); | 5652 | local64_set(&hwc->period_left, hwc->sample_period); |
5653 | hwc->last_period = hwc->sample_period; | ||
5650 | event->attr.freq = 0; | 5654 | event->attr.freq = 0; |
5651 | } | 5655 | } |
5652 | } | 5656 | } |
diff --git a/kernel/fork.c b/kernel/fork.c index 8d932b1c9056..1766d324d5e3 100644 --- a/kernel/fork.c +++ b/kernel/fork.c | |||
@@ -1141,6 +1141,9 @@ static struct task_struct *copy_process(unsigned long clone_flags, | |||
1141 | if ((clone_flags & (CLONE_NEWNS|CLONE_FS)) == (CLONE_NEWNS|CLONE_FS)) | 1141 | if ((clone_flags & (CLONE_NEWNS|CLONE_FS)) == (CLONE_NEWNS|CLONE_FS)) |
1142 | return ERR_PTR(-EINVAL); | 1142 | return ERR_PTR(-EINVAL); |
1143 | 1143 | ||
1144 | if ((clone_flags & (CLONE_NEWUSER|CLONE_FS)) == (CLONE_NEWUSER|CLONE_FS)) | ||
1145 | return ERR_PTR(-EINVAL); | ||
1146 | |||
1144 | /* | 1147 | /* |
1145 | * Thread groups must share signals as well, and detached threads | 1148 | * Thread groups must share signals as well, and detached threads |
1146 | * can only be started up within the thread group. | 1149 | * can only be started up within the thread group. |
@@ -1807,7 +1810,7 @@ SYSCALL_DEFINE1(unshare, unsigned long, unshare_flags) | |||
1807 | * If unsharing a user namespace must also unshare the thread. | 1810 | * If unsharing a user namespace must also unshare the thread. |
1808 | */ | 1811 | */ |
1809 | if (unshare_flags & CLONE_NEWUSER) | 1812 | if (unshare_flags & CLONE_NEWUSER) |
1810 | unshare_flags |= CLONE_THREAD; | 1813 | unshare_flags |= CLONE_THREAD | CLONE_FS; |
1811 | /* | 1814 | /* |
1812 | * If unsharing a pid namespace must also unshare the thread. | 1815 | * If unsharing a pid namespace must also unshare the thread. |
1813 | */ | 1816 | */ |
diff --git a/kernel/futex.c b/kernel/futex.c index f0090a993dab..b26dcfc02c94 100644 --- a/kernel/futex.c +++ b/kernel/futex.c | |||
@@ -223,7 +223,8 @@ static void drop_futex_key_refs(union futex_key *key) | |||
223 | * @rw: mapping needs to be read/write (values: VERIFY_READ, | 223 | * @rw: mapping needs to be read/write (values: VERIFY_READ, |
224 | * VERIFY_WRITE) | 224 | * VERIFY_WRITE) |
225 | * | 225 | * |
226 | * Returns a negative error code or 0 | 226 | * Return: a negative error code or 0 |
227 | * | ||
227 | * The key words are stored in *key on success. | 228 | * The key words are stored in *key on success. |
228 | * | 229 | * |
229 | * For shared mappings, it's (page->index, file_inode(vma->vm_file), | 230 | * For shared mappings, it's (page->index, file_inode(vma->vm_file), |
@@ -705,9 +706,9 @@ lookup_pi_state(u32 uval, struct futex_hash_bucket *hb, | |||
705 | * be "current" except in the case of requeue pi. | 706 | * be "current" except in the case of requeue pi. |
706 | * @set_waiters: force setting the FUTEX_WAITERS bit (1) or not (0) | 707 | * @set_waiters: force setting the FUTEX_WAITERS bit (1) or not (0) |
707 | * | 708 | * |
708 | * Returns: | 709 | * Return: |
709 | * 0 - ready to wait | 710 | * 0 - ready to wait; |
710 | * 1 - acquired the lock | 711 | * 1 - acquired the lock; |
711 | * <0 - error | 712 | * <0 - error |
712 | * | 713 | * |
713 | * The hb->lock and futex_key refs shall be held by the caller. | 714 | * The hb->lock and futex_key refs shall be held by the caller. |
@@ -1191,9 +1192,9 @@ void requeue_pi_wake_futex(struct futex_q *q, union futex_key *key, | |||
1191 | * then direct futex_lock_pi_atomic() to force setting the FUTEX_WAITERS bit. | 1192 | * then direct futex_lock_pi_atomic() to force setting the FUTEX_WAITERS bit. |
1192 | * hb1 and hb2 must be held by the caller. | 1193 | * hb1 and hb2 must be held by the caller. |
1193 | * | 1194 | * |
1194 | * Returns: | 1195 | * Return: |
1195 | * 0 - failed to acquire the lock atomicly | 1196 | * 0 - failed to acquire the lock atomically; |
1196 | * 1 - acquired the lock | 1197 | * 1 - acquired the lock; |
1197 | * <0 - error | 1198 | * <0 - error |
1198 | */ | 1199 | */ |
1199 | static int futex_proxy_trylock_atomic(u32 __user *pifutex, | 1200 | static int futex_proxy_trylock_atomic(u32 __user *pifutex, |
@@ -1254,8 +1255,8 @@ static int futex_proxy_trylock_atomic(u32 __user *pifutex, | |||
1254 | * Requeue waiters on uaddr1 to uaddr2. In the requeue_pi case, try to acquire | 1255 | * Requeue waiters on uaddr1 to uaddr2. In the requeue_pi case, try to acquire |
1255 | * uaddr2 atomically on behalf of the top waiter. | 1256 | * uaddr2 atomically on behalf of the top waiter. |
1256 | * | 1257 | * |
1257 | * Returns: | 1258 | * Return: |
1258 | * >=0 - on success, the number of tasks requeued or woken | 1259 | * >=0 - on success, the number of tasks requeued or woken; |
1259 | * <0 - on error | 1260 | * <0 - on error |
1260 | */ | 1261 | */ |
1261 | static int futex_requeue(u32 __user *uaddr1, unsigned int flags, | 1262 | static int futex_requeue(u32 __user *uaddr1, unsigned int flags, |
@@ -1536,8 +1537,8 @@ static inline void queue_me(struct futex_q *q, struct futex_hash_bucket *hb) | |||
1536 | * The q->lock_ptr must not be held by the caller. A call to unqueue_me() must | 1537 | * The q->lock_ptr must not be held by the caller. A call to unqueue_me() must |
1537 | * be paired with exactly one earlier call to queue_me(). | 1538 | * be paired with exactly one earlier call to queue_me(). |
1538 | * | 1539 | * |
1539 | * Returns: | 1540 | * Return: |
1540 | * 1 - if the futex_q was still queued (and we removed unqueued it) | 1541 | * 1 - if the futex_q was still queued (and we removed unqueued it); |
1541 | * 0 - if the futex_q was already removed by the waking thread | 1542 | * 0 - if the futex_q was already removed by the waking thread |
1542 | */ | 1543 | */ |
1543 | static int unqueue_me(struct futex_q *q) | 1544 | static int unqueue_me(struct futex_q *q) |
@@ -1707,9 +1708,9 @@ static long futex_wait_restart(struct restart_block *restart); | |||
1707 | * the pi_state owner as well as handle race conditions that may allow us to | 1708 | * the pi_state owner as well as handle race conditions that may allow us to |
1708 | * acquire the lock. Must be called with the hb lock held. | 1709 | * acquire the lock. Must be called with the hb lock held. |
1709 | * | 1710 | * |
1710 | * Returns: | 1711 | * Return: |
1711 | * 1 - success, lock taken | 1712 | * 1 - success, lock taken; |
1712 | * 0 - success, lock not taken | 1713 | * 0 - success, lock not taken; |
1713 | * <0 - on error (-EFAULT) | 1714 | * <0 - on error (-EFAULT) |
1714 | */ | 1715 | */ |
1715 | static int fixup_owner(u32 __user *uaddr, struct futex_q *q, int locked) | 1716 | static int fixup_owner(u32 __user *uaddr, struct futex_q *q, int locked) |
@@ -1824,8 +1825,8 @@ static void futex_wait_queue_me(struct futex_hash_bucket *hb, struct futex_q *q, | |||
1824 | * Return with the hb lock held and a q.key reference on success, and unlocked | 1825 | * Return with the hb lock held and a q.key reference on success, and unlocked |
1825 | * with no q.key reference on failure. | 1826 | * with no q.key reference on failure. |
1826 | * | 1827 | * |
1827 | * Returns: | 1828 | * Return: |
1828 | * 0 - uaddr contains val and hb has been locked | 1829 | * 0 - uaddr contains val and hb has been locked; |
1829 | * <1 - -EFAULT or -EWOULDBLOCK (uaddr does not contain val) and hb is unlocked | 1830 | * <1 - -EFAULT or -EWOULDBLOCK (uaddr does not contain val) and hb is unlocked |
1830 | */ | 1831 | */ |
1831 | static int futex_wait_setup(u32 __user *uaddr, u32 val, unsigned int flags, | 1832 | static int futex_wait_setup(u32 __user *uaddr, u32 val, unsigned int flags, |
@@ -2203,9 +2204,9 @@ pi_faulted: | |||
2203 | * the wakeup and return the appropriate error code to the caller. Must be | 2204 | * the wakeup and return the appropriate error code to the caller. Must be |
2204 | * called with the hb lock held. | 2205 | * called with the hb lock held. |
2205 | * | 2206 | * |
2206 | * Returns | 2207 | * Return: |
2207 | * 0 - no early wakeup detected | 2208 | * 0 = no early wakeup detected; |
2208 | * <0 - -ETIMEDOUT or -ERESTARTNOINTR | 2209 | * <0 = -ETIMEDOUT or -ERESTARTNOINTR |
2209 | */ | 2210 | */ |
2210 | static inline | 2211 | static inline |
2211 | int handle_early_requeue_pi_wakeup(struct futex_hash_bucket *hb, | 2212 | int handle_early_requeue_pi_wakeup(struct futex_hash_bucket *hb, |
@@ -2247,7 +2248,6 @@ int handle_early_requeue_pi_wakeup(struct futex_hash_bucket *hb, | |||
2247 | * @val: the expected value of uaddr | 2248 | * @val: the expected value of uaddr |
2248 | * @abs_time: absolute timeout | 2249 | * @abs_time: absolute timeout |
2249 | * @bitset: 32 bit wakeup bitset set by userspace, defaults to all | 2250 | * @bitset: 32 bit wakeup bitset set by userspace, defaults to all |
2250 | * @clockrt: whether to use CLOCK_REALTIME (1) or CLOCK_MONOTONIC (0) | ||
2251 | * @uaddr2: the pi futex we will take prior to returning to user-space | 2251 | * @uaddr2: the pi futex we will take prior to returning to user-space |
2252 | * | 2252 | * |
2253 | * The caller will wait on uaddr and will be requeued by futex_requeue() to | 2253 | * The caller will wait on uaddr and will be requeued by futex_requeue() to |
@@ -2258,7 +2258,7 @@ int handle_early_requeue_pi_wakeup(struct futex_hash_bucket *hb, | |||
2258 | * there was a need to. | 2258 | * there was a need to. |
2259 | * | 2259 | * |
2260 | * We call schedule in futex_wait_queue_me() when we enqueue and return there | 2260 | * We call schedule in futex_wait_queue_me() when we enqueue and return there |
2261 | * via the following: | 2261 | * via the following-- |
2262 | * 1) wakeup on uaddr2 after an atomic lock acquisition by futex_requeue() | 2262 | * 1) wakeup on uaddr2 after an atomic lock acquisition by futex_requeue() |
2263 | * 2) wakeup on uaddr2 after a requeue | 2263 | * 2) wakeup on uaddr2 after a requeue |
2264 | * 3) signal | 2264 | * 3) signal |
@@ -2276,8 +2276,8 @@ int handle_early_requeue_pi_wakeup(struct futex_hash_bucket *hb, | |||
2276 | * | 2276 | * |
2277 | * If 4 or 7, we cleanup and return with -ETIMEDOUT. | 2277 | * If 4 or 7, we cleanup and return with -ETIMEDOUT. |
2278 | * | 2278 | * |
2279 | * Returns: | 2279 | * Return: |
2280 | * 0 - On success | 2280 | * 0 - On success; |
2281 | * <0 - On error | 2281 | * <0 - On error |
2282 | */ | 2282 | */ |
2283 | static int futex_wait_requeue_pi(u32 __user *uaddr, unsigned int flags, | 2283 | static int futex_wait_requeue_pi(u32 __user *uaddr, unsigned int flags, |
diff --git a/kernel/printk.c b/kernel/printk.c index 0b31715f335a..abbdd9e2ac82 100644 --- a/kernel/printk.c +++ b/kernel/printk.c | |||
@@ -63,8 +63,6 @@ void asmlinkage __attribute__((weak)) early_printk(const char *fmt, ...) | |||
63 | #define MINIMUM_CONSOLE_LOGLEVEL 1 /* Minimum loglevel we let people use */ | 63 | #define MINIMUM_CONSOLE_LOGLEVEL 1 /* Minimum loglevel we let people use */ |
64 | #define DEFAULT_CONSOLE_LOGLEVEL 7 /* anything MORE serious than KERN_DEBUG */ | 64 | #define DEFAULT_CONSOLE_LOGLEVEL 7 /* anything MORE serious than KERN_DEBUG */ |
65 | 65 | ||
66 | DECLARE_WAIT_QUEUE_HEAD(log_wait); | ||
67 | |||
68 | int console_printk[4] = { | 66 | int console_printk[4] = { |
69 | DEFAULT_CONSOLE_LOGLEVEL, /* console_loglevel */ | 67 | DEFAULT_CONSOLE_LOGLEVEL, /* console_loglevel */ |
70 | DEFAULT_MESSAGE_LOGLEVEL, /* default_message_loglevel */ | 68 | DEFAULT_MESSAGE_LOGLEVEL, /* default_message_loglevel */ |
@@ -224,6 +222,7 @@ struct log { | |||
224 | static DEFINE_RAW_SPINLOCK(logbuf_lock); | 222 | static DEFINE_RAW_SPINLOCK(logbuf_lock); |
225 | 223 | ||
226 | #ifdef CONFIG_PRINTK | 224 | #ifdef CONFIG_PRINTK |
225 | DECLARE_WAIT_QUEUE_HEAD(log_wait); | ||
227 | /* the next printk record to read by syslog(READ) or /proc/kmsg */ | 226 | /* the next printk record to read by syslog(READ) or /proc/kmsg */ |
228 | static u64 syslog_seq; | 227 | static u64 syslog_seq; |
229 | static u32 syslog_idx; | 228 | static u32 syslog_idx; |
@@ -1957,45 +1956,6 @@ int is_console_locked(void) | |||
1957 | return console_locked; | 1956 | return console_locked; |
1958 | } | 1957 | } |
1959 | 1958 | ||
1960 | /* | ||
1961 | * Delayed printk version, for scheduler-internal messages: | ||
1962 | */ | ||
1963 | #define PRINTK_BUF_SIZE 512 | ||
1964 | |||
1965 | #define PRINTK_PENDING_WAKEUP 0x01 | ||
1966 | #define PRINTK_PENDING_SCHED 0x02 | ||
1967 | |||
1968 | static DEFINE_PER_CPU(int, printk_pending); | ||
1969 | static DEFINE_PER_CPU(char [PRINTK_BUF_SIZE], printk_sched_buf); | ||
1970 | |||
1971 | static void wake_up_klogd_work_func(struct irq_work *irq_work) | ||
1972 | { | ||
1973 | int pending = __this_cpu_xchg(printk_pending, 0); | ||
1974 | |||
1975 | if (pending & PRINTK_PENDING_SCHED) { | ||
1976 | char *buf = __get_cpu_var(printk_sched_buf); | ||
1977 | printk(KERN_WARNING "[sched_delayed] %s", buf); | ||
1978 | } | ||
1979 | |||
1980 | if (pending & PRINTK_PENDING_WAKEUP) | ||
1981 | wake_up_interruptible(&log_wait); | ||
1982 | } | ||
1983 | |||
1984 | static DEFINE_PER_CPU(struct irq_work, wake_up_klogd_work) = { | ||
1985 | .func = wake_up_klogd_work_func, | ||
1986 | .flags = IRQ_WORK_LAZY, | ||
1987 | }; | ||
1988 | |||
1989 | void wake_up_klogd(void) | ||
1990 | { | ||
1991 | preempt_disable(); | ||
1992 | if (waitqueue_active(&log_wait)) { | ||
1993 | this_cpu_or(printk_pending, PRINTK_PENDING_WAKEUP); | ||
1994 | irq_work_queue(&__get_cpu_var(wake_up_klogd_work)); | ||
1995 | } | ||
1996 | preempt_enable(); | ||
1997 | } | ||
1998 | |||
1999 | static void console_cont_flush(char *text, size_t size) | 1959 | static void console_cont_flush(char *text, size_t size) |
2000 | { | 1960 | { |
2001 | unsigned long flags; | 1961 | unsigned long flags; |
@@ -2458,6 +2418,44 @@ static int __init printk_late_init(void) | |||
2458 | late_initcall(printk_late_init); | 2418 | late_initcall(printk_late_init); |
2459 | 2419 | ||
2460 | #if defined CONFIG_PRINTK | 2420 | #if defined CONFIG_PRINTK |
2421 | /* | ||
2422 | * Delayed printk version, for scheduler-internal messages: | ||
2423 | */ | ||
2424 | #define PRINTK_BUF_SIZE 512 | ||
2425 | |||
2426 | #define PRINTK_PENDING_WAKEUP 0x01 | ||
2427 | #define PRINTK_PENDING_SCHED 0x02 | ||
2428 | |||
2429 | static DEFINE_PER_CPU(int, printk_pending); | ||
2430 | static DEFINE_PER_CPU(char [PRINTK_BUF_SIZE], printk_sched_buf); | ||
2431 | |||
2432 | static void wake_up_klogd_work_func(struct irq_work *irq_work) | ||
2433 | { | ||
2434 | int pending = __this_cpu_xchg(printk_pending, 0); | ||
2435 | |||
2436 | if (pending & PRINTK_PENDING_SCHED) { | ||
2437 | char *buf = __get_cpu_var(printk_sched_buf); | ||
2438 | printk(KERN_WARNING "[sched_delayed] %s", buf); | ||
2439 | } | ||
2440 | |||
2441 | if (pending & PRINTK_PENDING_WAKEUP) | ||
2442 | wake_up_interruptible(&log_wait); | ||
2443 | } | ||
2444 | |||
2445 | static DEFINE_PER_CPU(struct irq_work, wake_up_klogd_work) = { | ||
2446 | .func = wake_up_klogd_work_func, | ||
2447 | .flags = IRQ_WORK_LAZY, | ||
2448 | }; | ||
2449 | |||
2450 | void wake_up_klogd(void) | ||
2451 | { | ||
2452 | preempt_disable(); | ||
2453 | if (waitqueue_active(&log_wait)) { | ||
2454 | this_cpu_or(printk_pending, PRINTK_PENDING_WAKEUP); | ||
2455 | irq_work_queue(&__get_cpu_var(wake_up_klogd_work)); | ||
2456 | } | ||
2457 | preempt_enable(); | ||
2458 | } | ||
2461 | 2459 | ||
2462 | int printk_sched(const char *fmt, ...) | 2460 | int printk_sched(const char *fmt, ...) |
2463 | { | 2461 | { |
diff --git a/kernel/signal.c b/kernel/signal.c index 2ec870a4c3c4..dd72567767d9 100644 --- a/kernel/signal.c +++ b/kernel/signal.c | |||
@@ -485,6 +485,9 @@ flush_signal_handlers(struct task_struct *t, int force_default) | |||
485 | if (force_default || ka->sa.sa_handler != SIG_IGN) | 485 | if (force_default || ka->sa.sa_handler != SIG_IGN) |
486 | ka->sa.sa_handler = SIG_DFL; | 486 | ka->sa.sa_handler = SIG_DFL; |
487 | ka->sa.sa_flags = 0; | 487 | ka->sa.sa_flags = 0; |
488 | #ifdef __ARCH_HAS_SA_RESTORER | ||
489 | ka->sa.sa_restorer = NULL; | ||
490 | #endif | ||
488 | sigemptyset(&ka->sa.sa_mask); | 491 | sigemptyset(&ka->sa.sa_mask); |
489 | ka++; | 492 | ka++; |
490 | } | 493 | } |
@@ -2682,7 +2685,7 @@ static int do_sigpending(void *set, unsigned long sigsetsize) | |||
2682 | /** | 2685 | /** |
2683 | * sys_rt_sigpending - examine a pending signal that has been raised | 2686 | * sys_rt_sigpending - examine a pending signal that has been raised |
2684 | * while blocked | 2687 | * while blocked |
2685 | * @set: stores pending signals | 2688 | * @uset: stores pending signals |
2686 | * @sigsetsize: size of sigset_t type or larger | 2689 | * @sigsetsize: size of sigset_t type or larger |
2687 | */ | 2690 | */ |
2688 | SYSCALL_DEFINE2(rt_sigpending, sigset_t __user *, uset, size_t, sigsetsize) | 2691 | SYSCALL_DEFINE2(rt_sigpending, sigset_t __user *, uset, size_t, sigsetsize) |
diff --git a/kernel/sys.c b/kernel/sys.c index 81f56445fba9..39c9c4a2949f 100644 --- a/kernel/sys.c +++ b/kernel/sys.c | |||
@@ -2185,9 +2185,8 @@ SYSCALL_DEFINE3(getcpu, unsigned __user *, cpup, unsigned __user *, nodep, | |||
2185 | 2185 | ||
2186 | char poweroff_cmd[POWEROFF_CMD_PATH_LEN] = "/sbin/poweroff"; | 2186 | char poweroff_cmd[POWEROFF_CMD_PATH_LEN] = "/sbin/poweroff"; |
2187 | 2187 | ||
2188 | static int __orderly_poweroff(void) | 2188 | static int __orderly_poweroff(bool force) |
2189 | { | 2189 | { |
2190 | int argc; | ||
2191 | char **argv; | 2190 | char **argv; |
2192 | static char *envp[] = { | 2191 | static char *envp[] = { |
2193 | "HOME=/", | 2192 | "HOME=/", |
@@ -2196,20 +2195,40 @@ static int __orderly_poweroff(void) | |||
2196 | }; | 2195 | }; |
2197 | int ret; | 2196 | int ret; |
2198 | 2197 | ||
2199 | argv = argv_split(GFP_ATOMIC, poweroff_cmd, &argc); | 2198 | argv = argv_split(GFP_KERNEL, poweroff_cmd, NULL); |
2200 | if (argv == NULL) { | 2199 | if (argv) { |
2200 | ret = call_usermodehelper(argv[0], argv, envp, UMH_WAIT_EXEC); | ||
2201 | argv_free(argv); | ||
2202 | } else { | ||
2201 | printk(KERN_WARNING "%s failed to allocate memory for \"%s\"\n", | 2203 | printk(KERN_WARNING "%s failed to allocate memory for \"%s\"\n", |
2202 | __func__, poweroff_cmd); | 2204 | __func__, poweroff_cmd); |
2203 | return -ENOMEM; | 2205 | ret = -ENOMEM; |
2204 | } | 2206 | } |
2205 | 2207 | ||
2206 | ret = call_usermodehelper_fns(argv[0], argv, envp, UMH_WAIT_EXEC, | 2208 | if (ret && force) { |
2207 | NULL, NULL, NULL); | 2209 | printk(KERN_WARNING "Failed to start orderly shutdown: " |
2208 | argv_free(argv); | 2210 | "forcing the issue\n"); |
2211 | /* | ||
2212 | * I guess this should try to kick off some daemon to sync and | ||
2213 | * poweroff asap. Or not even bother syncing if we're doing an | ||
2214 | * emergency shutdown? | ||
2215 | */ | ||
2216 | emergency_sync(); | ||
2217 | kernel_power_off(); | ||
2218 | } | ||
2209 | 2219 | ||
2210 | return ret; | 2220 | return ret; |
2211 | } | 2221 | } |
2212 | 2222 | ||
2223 | static bool poweroff_force; | ||
2224 | |||
2225 | static void poweroff_work_func(struct work_struct *work) | ||
2226 | { | ||
2227 | __orderly_poweroff(poweroff_force); | ||
2228 | } | ||
2229 | |||
2230 | static DECLARE_WORK(poweroff_work, poweroff_work_func); | ||
2231 | |||
2213 | /** | 2232 | /** |
2214 | * orderly_poweroff - Trigger an orderly system poweroff | 2233 | * orderly_poweroff - Trigger an orderly system poweroff |
2215 | * @force: force poweroff if command execution fails | 2234 | * @force: force poweroff if command execution fails |
@@ -2219,21 +2238,9 @@ static int __orderly_poweroff(void) | |||
2219 | */ | 2238 | */ |
2220 | int orderly_poweroff(bool force) | 2239 | int orderly_poweroff(bool force) |
2221 | { | 2240 | { |
2222 | int ret = __orderly_poweroff(); | 2241 | if (force) /* do not override the pending "true" */ |
2223 | 2242 | poweroff_force = true; | |
2224 | if (ret && force) { | 2243 | schedule_work(&poweroff_work); |
2225 | printk(KERN_WARNING "Failed to start orderly shutdown: " | 2244 | return 0; |
2226 | "forcing the issue\n"); | ||
2227 | |||
2228 | /* | ||
2229 | * I guess this should try to kick off some daemon to sync and | ||
2230 | * poweroff asap. Or not even bother syncing if we're doing an | ||
2231 | * emergency shutdown? | ||
2232 | */ | ||
2233 | emergency_sync(); | ||
2234 | kernel_power_off(); | ||
2235 | } | ||
2236 | |||
2237 | return ret; | ||
2238 | } | 2245 | } |
2239 | EXPORT_SYMBOL_GPL(orderly_poweroff); | 2246 | EXPORT_SYMBOL_GPL(orderly_poweroff); |
diff --git a/kernel/trace/Kconfig b/kernel/trace/Kconfig index 192473b22799..fc382d6e2765 100644 --- a/kernel/trace/Kconfig +++ b/kernel/trace/Kconfig | |||
@@ -414,24 +414,28 @@ config PROBE_EVENTS | |||
414 | def_bool n | 414 | def_bool n |
415 | 415 | ||
416 | config DYNAMIC_FTRACE | 416 | config DYNAMIC_FTRACE |
417 | bool "enable/disable ftrace tracepoints dynamically" | 417 | bool "enable/disable function tracing dynamically" |
418 | depends on FUNCTION_TRACER | 418 | depends on FUNCTION_TRACER |
419 | depends on HAVE_DYNAMIC_FTRACE | 419 | depends on HAVE_DYNAMIC_FTRACE |
420 | default y | 420 | default y |
421 | help | 421 | help |
422 | This option will modify all the calls to ftrace dynamically | 422 | This option will modify all the calls to function tracing |
423 | (will patch them out of the binary image and replace them | 423 | dynamically (will patch them out of the binary image and |
424 | with a No-Op instruction) as they are called. A table is | 424 | replace them with a No-Op instruction) on boot up. During |
425 | created to dynamically enable them again. | 425 | compile time, a table is made of all the locations that ftrace |
426 | can function trace, and this table is linked into the kernel | ||
427 | image. When this is enabled, functions can be individually | ||
428 | enabled, and the functions not enabled will not affect | ||
429 | performance of the system. | ||
430 | |||
431 | See the files in /sys/kernel/debug/tracing: | ||
432 | available_filter_functions | ||
433 | set_ftrace_filter | ||
434 | set_ftrace_notrace | ||
426 | 435 | ||
427 | This way a CONFIG_FUNCTION_TRACER kernel is slightly larger, but | 436 | This way a CONFIG_FUNCTION_TRACER kernel is slightly larger, but |
428 | otherwise has native performance as long as no tracing is active. | 437 | otherwise has native performance as long as no tracing is active. |
429 | 438 | ||
430 | The changes to the code are done by a kernel thread that | ||
431 | wakes up once a second and checks to see if any ftrace calls | ||
432 | were made. If so, it runs stop_machine (stops all CPUS) | ||
433 | and modifies the code to jump over the call to ftrace. | ||
434 | |||
435 | config DYNAMIC_FTRACE_WITH_REGS | 439 | config DYNAMIC_FTRACE_WITH_REGS |
436 | def_bool y | 440 | def_bool y |
437 | depends on DYNAMIC_FTRACE | 441 | depends on DYNAMIC_FTRACE |
diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c index ab25b88aae56..6893d5a2bf08 100644 --- a/kernel/trace/ftrace.c +++ b/kernel/trace/ftrace.c | |||
@@ -3104,8 +3104,8 @@ __unregister_ftrace_function_probe(char *glob, struct ftrace_probe_ops *ops, | |||
3104 | continue; | 3104 | continue; |
3105 | } | 3105 | } |
3106 | 3106 | ||
3107 | hlist_del(&entry->node); | 3107 | hlist_del_rcu(&entry->node); |
3108 | call_rcu(&entry->rcu, ftrace_free_entry_rcu); | 3108 | call_rcu_sched(&entry->rcu, ftrace_free_entry_rcu); |
3109 | } | 3109 | } |
3110 | } | 3110 | } |
3111 | __disable_ftrace_function_probe(); | 3111 | __disable_ftrace_function_probe(); |
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c index c2e2c2310374..4f1dade56981 100644 --- a/kernel/trace/trace.c +++ b/kernel/trace/trace.c | |||
@@ -704,7 +704,7 @@ __update_max_tr(struct trace_array *tr, struct task_struct *tsk, int cpu) | |||
704 | void | 704 | void |
705 | update_max_tr(struct trace_array *tr, struct task_struct *tsk, int cpu) | 705 | update_max_tr(struct trace_array *tr, struct task_struct *tsk, int cpu) |
706 | { | 706 | { |
707 | struct ring_buffer *buf = tr->buffer; | 707 | struct ring_buffer *buf; |
708 | 708 | ||
709 | if (trace_stop_count) | 709 | if (trace_stop_count) |
710 | return; | 710 | return; |
@@ -719,6 +719,7 @@ update_max_tr(struct trace_array *tr, struct task_struct *tsk, int cpu) | |||
719 | 719 | ||
720 | arch_spin_lock(&ftrace_max_lock); | 720 | arch_spin_lock(&ftrace_max_lock); |
721 | 721 | ||
722 | buf = tr->buffer; | ||
722 | tr->buffer = max_tr.buffer; | 723 | tr->buffer = max_tr.buffer; |
723 | max_tr.buffer = buf; | 724 | max_tr.buffer = buf; |
724 | 725 | ||
@@ -2400,6 +2401,27 @@ static void test_ftrace_alive(struct seq_file *m) | |||
2400 | seq_printf(m, "# MAY BE MISSING FUNCTION EVENTS\n"); | 2401 | seq_printf(m, "# MAY BE MISSING FUNCTION EVENTS\n"); |
2401 | } | 2402 | } |
2402 | 2403 | ||
2404 | #ifdef CONFIG_TRACER_MAX_TRACE | ||
2405 | static void print_snapshot_help(struct seq_file *m, struct trace_iterator *iter) | ||
2406 | { | ||
2407 | if (iter->trace->allocated_snapshot) | ||
2408 | seq_printf(m, "#\n# * Snapshot is allocated *\n#\n"); | ||
2409 | else | ||
2410 | seq_printf(m, "#\n# * Snapshot is freed *\n#\n"); | ||
2411 | |||
2412 | seq_printf(m, "# Snapshot commands:\n"); | ||
2413 | seq_printf(m, "# echo 0 > snapshot : Clears and frees snapshot buffer\n"); | ||
2414 | seq_printf(m, "# echo 1 > snapshot : Allocates snapshot buffer, if not already allocated.\n"); | ||
2415 | seq_printf(m, "# Takes a snapshot of the main buffer.\n"); | ||
2416 | seq_printf(m, "# echo 2 > snapshot : Clears snapshot buffer (but does not allocate)\n"); | ||
2417 | seq_printf(m, "# (Doesn't have to be '2' works with any number that\n"); | ||
2418 | seq_printf(m, "# is not a '0' or '1')\n"); | ||
2419 | } | ||
2420 | #else | ||
2421 | /* Should never be called */ | ||
2422 | static inline void print_snapshot_help(struct seq_file *m, struct trace_iterator *iter) { } | ||
2423 | #endif | ||
2424 | |||
2403 | static int s_show(struct seq_file *m, void *v) | 2425 | static int s_show(struct seq_file *m, void *v) |
2404 | { | 2426 | { |
2405 | struct trace_iterator *iter = v; | 2427 | struct trace_iterator *iter = v; |
@@ -2411,7 +2433,9 @@ static int s_show(struct seq_file *m, void *v) | |||
2411 | seq_puts(m, "#\n"); | 2433 | seq_puts(m, "#\n"); |
2412 | test_ftrace_alive(m); | 2434 | test_ftrace_alive(m); |
2413 | } | 2435 | } |
2414 | if (iter->trace && iter->trace->print_header) | 2436 | if (iter->snapshot && trace_empty(iter)) |
2437 | print_snapshot_help(m, iter); | ||
2438 | else if (iter->trace && iter->trace->print_header) | ||
2415 | iter->trace->print_header(m); | 2439 | iter->trace->print_header(m); |
2416 | else | 2440 | else |
2417 | trace_default_header(m); | 2441 | trace_default_header(m); |
@@ -2857,11 +2881,25 @@ static int set_tracer_option(struct tracer *trace, char *cmp, int neg) | |||
2857 | return -EINVAL; | 2881 | return -EINVAL; |
2858 | } | 2882 | } |
2859 | 2883 | ||
2860 | static void set_tracer_flags(unsigned int mask, int enabled) | 2884 | /* Some tracers require overwrite to stay enabled */ |
2885 | int trace_keep_overwrite(struct tracer *tracer, u32 mask, int set) | ||
2886 | { | ||
2887 | if (tracer->enabled && (mask & TRACE_ITER_OVERWRITE) && !set) | ||
2888 | return -1; | ||
2889 | |||
2890 | return 0; | ||
2891 | } | ||
2892 | |||
2893 | int set_tracer_flag(unsigned int mask, int enabled) | ||
2861 | { | 2894 | { |
2862 | /* do nothing if flag is already set */ | 2895 | /* do nothing if flag is already set */ |
2863 | if (!!(trace_flags & mask) == !!enabled) | 2896 | if (!!(trace_flags & mask) == !!enabled) |
2864 | return; | 2897 | return 0; |
2898 | |||
2899 | /* Give the tracer a chance to approve the change */ | ||
2900 | if (current_trace->flag_changed) | ||
2901 | if (current_trace->flag_changed(current_trace, mask, !!enabled)) | ||
2902 | return -EINVAL; | ||
2865 | 2903 | ||
2866 | if (enabled) | 2904 | if (enabled) |
2867 | trace_flags |= mask; | 2905 | trace_flags |= mask; |
@@ -2871,18 +2909,24 @@ static void set_tracer_flags(unsigned int mask, int enabled) | |||
2871 | if (mask == TRACE_ITER_RECORD_CMD) | 2909 | if (mask == TRACE_ITER_RECORD_CMD) |
2872 | trace_event_enable_cmd_record(enabled); | 2910 | trace_event_enable_cmd_record(enabled); |
2873 | 2911 | ||
2874 | if (mask == TRACE_ITER_OVERWRITE) | 2912 | if (mask == TRACE_ITER_OVERWRITE) { |
2875 | ring_buffer_change_overwrite(global_trace.buffer, enabled); | 2913 | ring_buffer_change_overwrite(global_trace.buffer, enabled); |
2914 | #ifdef CONFIG_TRACER_MAX_TRACE | ||
2915 | ring_buffer_change_overwrite(max_tr.buffer, enabled); | ||
2916 | #endif | ||
2917 | } | ||
2876 | 2918 | ||
2877 | if (mask == TRACE_ITER_PRINTK) | 2919 | if (mask == TRACE_ITER_PRINTK) |
2878 | trace_printk_start_stop_comm(enabled); | 2920 | trace_printk_start_stop_comm(enabled); |
2921 | |||
2922 | return 0; | ||
2879 | } | 2923 | } |
2880 | 2924 | ||
2881 | static int trace_set_options(char *option) | 2925 | static int trace_set_options(char *option) |
2882 | { | 2926 | { |
2883 | char *cmp; | 2927 | char *cmp; |
2884 | int neg = 0; | 2928 | int neg = 0; |
2885 | int ret = 0; | 2929 | int ret = -ENODEV; |
2886 | int i; | 2930 | int i; |
2887 | 2931 | ||
2888 | cmp = strstrip(option); | 2932 | cmp = strstrip(option); |
@@ -2892,19 +2936,20 @@ static int trace_set_options(char *option) | |||
2892 | cmp += 2; | 2936 | cmp += 2; |
2893 | } | 2937 | } |
2894 | 2938 | ||
2939 | mutex_lock(&trace_types_lock); | ||
2940 | |||
2895 | for (i = 0; trace_options[i]; i++) { | 2941 | for (i = 0; trace_options[i]; i++) { |
2896 | if (strcmp(cmp, trace_options[i]) == 0) { | 2942 | if (strcmp(cmp, trace_options[i]) == 0) { |
2897 | set_tracer_flags(1 << i, !neg); | 2943 | ret = set_tracer_flag(1 << i, !neg); |
2898 | break; | 2944 | break; |
2899 | } | 2945 | } |
2900 | } | 2946 | } |
2901 | 2947 | ||
2902 | /* If no option could be set, test the specific tracer options */ | 2948 | /* If no option could be set, test the specific tracer options */ |
2903 | if (!trace_options[i]) { | 2949 | if (!trace_options[i]) |
2904 | mutex_lock(&trace_types_lock); | ||
2905 | ret = set_tracer_option(current_trace, cmp, neg); | 2950 | ret = set_tracer_option(current_trace, cmp, neg); |
2906 | mutex_unlock(&trace_types_lock); | 2951 | |
2907 | } | 2952 | mutex_unlock(&trace_types_lock); |
2908 | 2953 | ||
2909 | return ret; | 2954 | return ret; |
2910 | } | 2955 | } |
@@ -2914,6 +2959,7 @@ tracing_trace_options_write(struct file *filp, const char __user *ubuf, | |||
2914 | size_t cnt, loff_t *ppos) | 2959 | size_t cnt, loff_t *ppos) |
2915 | { | 2960 | { |
2916 | char buf[64]; | 2961 | char buf[64]; |
2962 | int ret; | ||
2917 | 2963 | ||
2918 | if (cnt >= sizeof(buf)) | 2964 | if (cnt >= sizeof(buf)) |
2919 | return -EINVAL; | 2965 | return -EINVAL; |
@@ -2923,7 +2969,9 @@ tracing_trace_options_write(struct file *filp, const char __user *ubuf, | |||
2923 | 2969 | ||
2924 | buf[cnt] = 0; | 2970 | buf[cnt] = 0; |
2925 | 2971 | ||
2926 | trace_set_options(buf); | 2972 | ret = trace_set_options(buf); |
2973 | if (ret < 0) | ||
2974 | return ret; | ||
2927 | 2975 | ||
2928 | *ppos += cnt; | 2976 | *ppos += cnt; |
2929 | 2977 | ||
@@ -3227,6 +3275,9 @@ static int tracing_set_tracer(const char *buf) | |||
3227 | goto out; | 3275 | goto out; |
3228 | 3276 | ||
3229 | trace_branch_disable(); | 3277 | trace_branch_disable(); |
3278 | |||
3279 | current_trace->enabled = false; | ||
3280 | |||
3230 | if (current_trace->reset) | 3281 | if (current_trace->reset) |
3231 | current_trace->reset(tr); | 3282 | current_trace->reset(tr); |
3232 | 3283 | ||
@@ -3271,6 +3322,7 @@ static int tracing_set_tracer(const char *buf) | |||
3271 | } | 3322 | } |
3272 | 3323 | ||
3273 | current_trace = t; | 3324 | current_trace = t; |
3325 | current_trace->enabled = true; | ||
3274 | trace_branch_enable(tr); | 3326 | trace_branch_enable(tr); |
3275 | out: | 3327 | out: |
3276 | mutex_unlock(&trace_types_lock); | 3328 | mutex_unlock(&trace_types_lock); |
@@ -4144,8 +4196,6 @@ tracing_snapshot_write(struct file *filp, const char __user *ubuf, size_t cnt, | |||
4144 | default: | 4196 | default: |
4145 | if (current_trace->allocated_snapshot) | 4197 | if (current_trace->allocated_snapshot) |
4146 | tracing_reset_online_cpus(&max_tr); | 4198 | tracing_reset_online_cpus(&max_tr); |
4147 | else | ||
4148 | ret = -EINVAL; | ||
4149 | break; | 4199 | break; |
4150 | } | 4200 | } |
4151 | 4201 | ||
@@ -4759,7 +4809,13 @@ trace_options_core_write(struct file *filp, const char __user *ubuf, size_t cnt, | |||
4759 | 4809 | ||
4760 | if (val != 0 && val != 1) | 4810 | if (val != 0 && val != 1) |
4761 | return -EINVAL; | 4811 | return -EINVAL; |
4762 | set_tracer_flags(1 << index, val); | 4812 | |
4813 | mutex_lock(&trace_types_lock); | ||
4814 | ret = set_tracer_flag(1 << index, val); | ||
4815 | mutex_unlock(&trace_types_lock); | ||
4816 | |||
4817 | if (ret < 0) | ||
4818 | return ret; | ||
4763 | 4819 | ||
4764 | *ppos += cnt; | 4820 | *ppos += cnt; |
4765 | 4821 | ||
diff --git a/kernel/trace/trace.h b/kernel/trace/trace.h index 57d7e5397d56..2081971367ea 100644 --- a/kernel/trace/trace.h +++ b/kernel/trace/trace.h | |||
@@ -283,11 +283,15 @@ struct tracer { | |||
283 | enum print_line_t (*print_line)(struct trace_iterator *iter); | 283 | enum print_line_t (*print_line)(struct trace_iterator *iter); |
284 | /* If you handled the flag setting, return 0 */ | 284 | /* If you handled the flag setting, return 0 */ |
285 | int (*set_flag)(u32 old_flags, u32 bit, int set); | 285 | int (*set_flag)(u32 old_flags, u32 bit, int set); |
286 | /* Return 0 if OK with change, else return non-zero */ | ||
287 | int (*flag_changed)(struct tracer *tracer, | ||
288 | u32 mask, int set); | ||
286 | struct tracer *next; | 289 | struct tracer *next; |
287 | struct tracer_flags *flags; | 290 | struct tracer_flags *flags; |
288 | bool print_max; | 291 | bool print_max; |
289 | bool use_max_tr; | 292 | bool use_max_tr; |
290 | bool allocated_snapshot; | 293 | bool allocated_snapshot; |
294 | bool enabled; | ||
291 | }; | 295 | }; |
292 | 296 | ||
293 | 297 | ||
@@ -943,6 +947,8 @@ extern const char *__stop___trace_bprintk_fmt[]; | |||
943 | 947 | ||
944 | void trace_printk_init_buffers(void); | 948 | void trace_printk_init_buffers(void); |
945 | void trace_printk_start_comm(void); | 949 | void trace_printk_start_comm(void); |
950 | int trace_keep_overwrite(struct tracer *tracer, u32 mask, int set); | ||
951 | int set_tracer_flag(unsigned int mask, int enabled); | ||
946 | 952 | ||
947 | #undef FTRACE_ENTRY | 953 | #undef FTRACE_ENTRY |
948 | #define FTRACE_ENTRY(call, struct_name, id, tstruct, print, filter) \ | 954 | #define FTRACE_ENTRY(call, struct_name, id, tstruct, print, filter) \ |
diff --git a/kernel/trace/trace_irqsoff.c b/kernel/trace/trace_irqsoff.c index 713a2cac4881..443b25b43b4f 100644 --- a/kernel/trace/trace_irqsoff.c +++ b/kernel/trace/trace_irqsoff.c | |||
@@ -32,7 +32,7 @@ enum { | |||
32 | 32 | ||
33 | static int trace_type __read_mostly; | 33 | static int trace_type __read_mostly; |
34 | 34 | ||
35 | static int save_lat_flag; | 35 | static int save_flags; |
36 | 36 | ||
37 | static void stop_irqsoff_tracer(struct trace_array *tr, int graph); | 37 | static void stop_irqsoff_tracer(struct trace_array *tr, int graph); |
38 | static int start_irqsoff_tracer(struct trace_array *tr, int graph); | 38 | static int start_irqsoff_tracer(struct trace_array *tr, int graph); |
@@ -558,8 +558,11 @@ static void stop_irqsoff_tracer(struct trace_array *tr, int graph) | |||
558 | 558 | ||
559 | static void __irqsoff_tracer_init(struct trace_array *tr) | 559 | static void __irqsoff_tracer_init(struct trace_array *tr) |
560 | { | 560 | { |
561 | save_lat_flag = trace_flags & TRACE_ITER_LATENCY_FMT; | 561 | save_flags = trace_flags; |
562 | trace_flags |= TRACE_ITER_LATENCY_FMT; | 562 | |
563 | /* non overwrite screws up the latency tracers */ | ||
564 | set_tracer_flag(TRACE_ITER_OVERWRITE, 1); | ||
565 | set_tracer_flag(TRACE_ITER_LATENCY_FMT, 1); | ||
563 | 566 | ||
564 | tracing_max_latency = 0; | 567 | tracing_max_latency = 0; |
565 | irqsoff_trace = tr; | 568 | irqsoff_trace = tr; |
@@ -573,10 +576,13 @@ static void __irqsoff_tracer_init(struct trace_array *tr) | |||
573 | 576 | ||
574 | static void irqsoff_tracer_reset(struct trace_array *tr) | 577 | static void irqsoff_tracer_reset(struct trace_array *tr) |
575 | { | 578 | { |
579 | int lat_flag = save_flags & TRACE_ITER_LATENCY_FMT; | ||
580 | int overwrite_flag = save_flags & TRACE_ITER_OVERWRITE; | ||
581 | |||
576 | stop_irqsoff_tracer(tr, is_graph()); | 582 | stop_irqsoff_tracer(tr, is_graph()); |
577 | 583 | ||
578 | if (!save_lat_flag) | 584 | set_tracer_flag(TRACE_ITER_LATENCY_FMT, lat_flag); |
579 | trace_flags &= ~TRACE_ITER_LATENCY_FMT; | 585 | set_tracer_flag(TRACE_ITER_OVERWRITE, overwrite_flag); |
580 | } | 586 | } |
581 | 587 | ||
582 | static void irqsoff_tracer_start(struct trace_array *tr) | 588 | static void irqsoff_tracer_start(struct trace_array *tr) |
@@ -609,6 +615,7 @@ static struct tracer irqsoff_tracer __read_mostly = | |||
609 | .print_line = irqsoff_print_line, | 615 | .print_line = irqsoff_print_line, |
610 | .flags = &tracer_flags, | 616 | .flags = &tracer_flags, |
611 | .set_flag = irqsoff_set_flag, | 617 | .set_flag = irqsoff_set_flag, |
618 | .flag_changed = trace_keep_overwrite, | ||
612 | #ifdef CONFIG_FTRACE_SELFTEST | 619 | #ifdef CONFIG_FTRACE_SELFTEST |
613 | .selftest = trace_selftest_startup_irqsoff, | 620 | .selftest = trace_selftest_startup_irqsoff, |
614 | #endif | 621 | #endif |
@@ -642,6 +649,7 @@ static struct tracer preemptoff_tracer __read_mostly = | |||
642 | .print_line = irqsoff_print_line, | 649 | .print_line = irqsoff_print_line, |
643 | .flags = &tracer_flags, | 650 | .flags = &tracer_flags, |
644 | .set_flag = irqsoff_set_flag, | 651 | .set_flag = irqsoff_set_flag, |
652 | .flag_changed = trace_keep_overwrite, | ||
645 | #ifdef CONFIG_FTRACE_SELFTEST | 653 | #ifdef CONFIG_FTRACE_SELFTEST |
646 | .selftest = trace_selftest_startup_preemptoff, | 654 | .selftest = trace_selftest_startup_preemptoff, |
647 | #endif | 655 | #endif |
@@ -677,6 +685,7 @@ static struct tracer preemptirqsoff_tracer __read_mostly = | |||
677 | .print_line = irqsoff_print_line, | 685 | .print_line = irqsoff_print_line, |
678 | .flags = &tracer_flags, | 686 | .flags = &tracer_flags, |
679 | .set_flag = irqsoff_set_flag, | 687 | .set_flag = irqsoff_set_flag, |
688 | .flag_changed = trace_keep_overwrite, | ||
680 | #ifdef CONFIG_FTRACE_SELFTEST | 689 | #ifdef CONFIG_FTRACE_SELFTEST |
681 | .selftest = trace_selftest_startup_preemptirqsoff, | 690 | .selftest = trace_selftest_startup_preemptirqsoff, |
682 | #endif | 691 | #endif |
diff --git a/kernel/trace/trace_sched_wakeup.c b/kernel/trace/trace_sched_wakeup.c index 75aa97fbe1a1..fde652c9a511 100644 --- a/kernel/trace/trace_sched_wakeup.c +++ b/kernel/trace/trace_sched_wakeup.c | |||
@@ -36,7 +36,7 @@ static void __wakeup_reset(struct trace_array *tr); | |||
36 | static int wakeup_graph_entry(struct ftrace_graph_ent *trace); | 36 | static int wakeup_graph_entry(struct ftrace_graph_ent *trace); |
37 | static void wakeup_graph_return(struct ftrace_graph_ret *trace); | 37 | static void wakeup_graph_return(struct ftrace_graph_ret *trace); |
38 | 38 | ||
39 | static int save_lat_flag; | 39 | static int save_flags; |
40 | 40 | ||
41 | #define TRACE_DISPLAY_GRAPH 1 | 41 | #define TRACE_DISPLAY_GRAPH 1 |
42 | 42 | ||
@@ -540,8 +540,11 @@ static void stop_wakeup_tracer(struct trace_array *tr) | |||
540 | 540 | ||
541 | static int __wakeup_tracer_init(struct trace_array *tr) | 541 | static int __wakeup_tracer_init(struct trace_array *tr) |
542 | { | 542 | { |
543 | save_lat_flag = trace_flags & TRACE_ITER_LATENCY_FMT; | 543 | save_flags = trace_flags; |
544 | trace_flags |= TRACE_ITER_LATENCY_FMT; | 544 | |
545 | /* non overwrite screws up the latency tracers */ | ||
546 | set_tracer_flag(TRACE_ITER_OVERWRITE, 1); | ||
547 | set_tracer_flag(TRACE_ITER_LATENCY_FMT, 1); | ||
545 | 548 | ||
546 | tracing_max_latency = 0; | 549 | tracing_max_latency = 0; |
547 | wakeup_trace = tr; | 550 | wakeup_trace = tr; |
@@ -563,12 +566,15 @@ static int wakeup_rt_tracer_init(struct trace_array *tr) | |||
563 | 566 | ||
564 | static void wakeup_tracer_reset(struct trace_array *tr) | 567 | static void wakeup_tracer_reset(struct trace_array *tr) |
565 | { | 568 | { |
569 | int lat_flag = save_flags & TRACE_ITER_LATENCY_FMT; | ||
570 | int overwrite_flag = save_flags & TRACE_ITER_OVERWRITE; | ||
571 | |||
566 | stop_wakeup_tracer(tr); | 572 | stop_wakeup_tracer(tr); |
567 | /* make sure we put back any tasks we are tracing */ | 573 | /* make sure we put back any tasks we are tracing */ |
568 | wakeup_reset(tr); | 574 | wakeup_reset(tr); |
569 | 575 | ||
570 | if (!save_lat_flag) | 576 | set_tracer_flag(TRACE_ITER_LATENCY_FMT, lat_flag); |
571 | trace_flags &= ~TRACE_ITER_LATENCY_FMT; | 577 | set_tracer_flag(TRACE_ITER_OVERWRITE, overwrite_flag); |
572 | } | 578 | } |
573 | 579 | ||
574 | static void wakeup_tracer_start(struct trace_array *tr) | 580 | static void wakeup_tracer_start(struct trace_array *tr) |
@@ -594,6 +600,7 @@ static struct tracer wakeup_tracer __read_mostly = | |||
594 | .print_line = wakeup_print_line, | 600 | .print_line = wakeup_print_line, |
595 | .flags = &tracer_flags, | 601 | .flags = &tracer_flags, |
596 | .set_flag = wakeup_set_flag, | 602 | .set_flag = wakeup_set_flag, |
603 | .flag_changed = trace_keep_overwrite, | ||
597 | #ifdef CONFIG_FTRACE_SELFTEST | 604 | #ifdef CONFIG_FTRACE_SELFTEST |
598 | .selftest = trace_selftest_startup_wakeup, | 605 | .selftest = trace_selftest_startup_wakeup, |
599 | #endif | 606 | #endif |
@@ -615,6 +622,7 @@ static struct tracer wakeup_rt_tracer __read_mostly = | |||
615 | .print_line = wakeup_print_line, | 622 | .print_line = wakeup_print_line, |
616 | .flags = &tracer_flags, | 623 | .flags = &tracer_flags, |
617 | .set_flag = wakeup_set_flag, | 624 | .set_flag = wakeup_set_flag, |
625 | .flag_changed = trace_keep_overwrite, | ||
618 | #ifdef CONFIG_FTRACE_SELFTEST | 626 | #ifdef CONFIG_FTRACE_SELFTEST |
619 | .selftest = trace_selftest_startup_wakeup, | 627 | .selftest = trace_selftest_startup_wakeup, |
620 | #endif | 628 | #endif |
diff --git a/kernel/user_namespace.c b/kernel/user_namespace.c index 8b650837083e..b14f4d342043 100644 --- a/kernel/user_namespace.c +++ b/kernel/user_namespace.c | |||
@@ -21,6 +21,7 @@ | |||
21 | #include <linux/uaccess.h> | 21 | #include <linux/uaccess.h> |
22 | #include <linux/ctype.h> | 22 | #include <linux/ctype.h> |
23 | #include <linux/projid.h> | 23 | #include <linux/projid.h> |
24 | #include <linux/fs_struct.h> | ||
24 | 25 | ||
25 | static struct kmem_cache *user_ns_cachep __read_mostly; | 26 | static struct kmem_cache *user_ns_cachep __read_mostly; |
26 | 27 | ||
@@ -837,6 +838,9 @@ static int userns_install(struct nsproxy *nsproxy, void *ns) | |||
837 | if (atomic_read(¤t->mm->mm_users) > 1) | 838 | if (atomic_read(¤t->mm->mm_users) > 1) |
838 | return -EINVAL; | 839 | return -EINVAL; |
839 | 840 | ||
841 | if (current->fs->users != 1) | ||
842 | return -EINVAL; | ||
843 | |||
840 | if (!ns_capable(user_ns, CAP_SYS_ADMIN)) | 844 | if (!ns_capable(user_ns, CAP_SYS_ADMIN)) |
841 | return -EPERM; | 845 | return -EPERM; |
842 | 846 | ||
diff --git a/kernel/workqueue.c b/kernel/workqueue.c index 81f2457811eb..b48cd597145d 100644 --- a/kernel/workqueue.c +++ b/kernel/workqueue.c | |||
@@ -457,11 +457,12 @@ static int worker_pool_assign_id(struct worker_pool *pool) | |||
457 | int ret; | 457 | int ret; |
458 | 458 | ||
459 | mutex_lock(&worker_pool_idr_mutex); | 459 | mutex_lock(&worker_pool_idr_mutex); |
460 | idr_pre_get(&worker_pool_idr, GFP_KERNEL); | 460 | ret = idr_alloc(&worker_pool_idr, pool, 0, 0, GFP_KERNEL); |
461 | ret = idr_get_new(&worker_pool_idr, pool, &pool->id); | 461 | if (ret >= 0) |
462 | pool->id = ret; | ||
462 | mutex_unlock(&worker_pool_idr_mutex); | 463 | mutex_unlock(&worker_pool_idr_mutex); |
463 | 464 | ||
464 | return ret; | 465 | return ret < 0 ? ret : 0; |
465 | } | 466 | } |
466 | 467 | ||
467 | /* | 468 | /* |
@@ -3446,28 +3447,34 @@ static void wq_unbind_fn(struct work_struct *work) | |||
3446 | 3447 | ||
3447 | spin_unlock_irq(&pool->lock); | 3448 | spin_unlock_irq(&pool->lock); |
3448 | mutex_unlock(&pool->assoc_mutex); | 3449 | mutex_unlock(&pool->assoc_mutex); |
3449 | } | ||
3450 | 3450 | ||
3451 | /* | 3451 | /* |
3452 | * Call schedule() so that we cross rq->lock and thus can guarantee | 3452 | * Call schedule() so that we cross rq->lock and thus can |
3453 | * sched callbacks see the %WORKER_UNBOUND flag. This is necessary | 3453 | * guarantee sched callbacks see the %WORKER_UNBOUND flag. |
3454 | * as scheduler callbacks may be invoked from other cpus. | 3454 | * This is necessary as scheduler callbacks may be invoked |
3455 | */ | 3455 | * from other cpus. |
3456 | schedule(); | 3456 | */ |
3457 | schedule(); | ||
3457 | 3458 | ||
3458 | /* | 3459 | /* |
3459 | * Sched callbacks are disabled now. Zap nr_running. After this, | 3460 | * Sched callbacks are disabled now. Zap nr_running. |
3460 | * nr_running stays zero and need_more_worker() and keep_working() | 3461 | * After this, nr_running stays zero and need_more_worker() |
3461 | * are always true as long as the worklist is not empty. Pools on | 3462 | * and keep_working() are always true as long as the |
3462 | * @cpu now behave as unbound (in terms of concurrency management) | 3463 | * worklist is not empty. This pool now behaves as an |
3463 | * pools which are served by workers tied to the CPU. | 3464 | * unbound (in terms of concurrency management) pool which |
3464 | * | 3465 | * are served by workers tied to the pool. |
3465 | * On return from this function, the current worker would trigger | 3466 | */ |
3466 | * unbound chain execution of pending work items if other workers | ||
3467 | * didn't already. | ||
3468 | */ | ||
3469 | for_each_std_worker_pool(pool, cpu) | ||
3470 | atomic_set(&pool->nr_running, 0); | 3467 | atomic_set(&pool->nr_running, 0); |
3468 | |||
3469 | /* | ||
3470 | * With concurrency management just turned off, a busy | ||
3471 | * worker blocking could lead to lengthy stalls. Kick off | ||
3472 | * unbound chain execution of currently pending work items. | ||
3473 | */ | ||
3474 | spin_lock_irq(&pool->lock); | ||
3475 | wake_up_worker(pool); | ||
3476 | spin_unlock_irq(&pool->lock); | ||
3477 | } | ||
3471 | } | 3478 | } |
3472 | 3479 | ||
3473 | /* | 3480 | /* |
diff --git a/lib/bust_spinlocks.c b/lib/bust_spinlocks.c index 9681d54b95d1..f8e0e5367398 100644 --- a/lib/bust_spinlocks.c +++ b/lib/bust_spinlocks.c | |||
@@ -8,6 +8,7 @@ | |||
8 | */ | 8 | */ |
9 | 9 | ||
10 | #include <linux/kernel.h> | 10 | #include <linux/kernel.h> |
11 | #include <linux/printk.h> | ||
11 | #include <linux/spinlock.h> | 12 | #include <linux/spinlock.h> |
12 | #include <linux/tty.h> | 13 | #include <linux/tty.h> |
13 | #include <linux/wait.h> | 14 | #include <linux/wait.h> |
@@ -28,5 +29,3 @@ void __attribute__((weak)) bust_spinlocks(int yes) | |||
28 | wake_up_klogd(); | 29 | wake_up_klogd(); |
29 | } | 30 | } |
30 | } | 31 | } |
31 | |||
32 | |||
diff --git a/lib/dma-debug.c b/lib/dma-debug.c index 5e396accd3d0..d87a17a819d0 100644 --- a/lib/dma-debug.c +++ b/lib/dma-debug.c | |||
@@ -862,17 +862,21 @@ static void check_unmap(struct dma_debug_entry *ref) | |||
862 | entry = bucket_find_exact(bucket, ref); | 862 | entry = bucket_find_exact(bucket, ref); |
863 | 863 | ||
864 | if (!entry) { | 864 | if (!entry) { |
865 | /* must drop lock before calling dma_mapping_error */ | ||
866 | put_hash_bucket(bucket, &flags); | ||
867 | |||
865 | if (dma_mapping_error(ref->dev, ref->dev_addr)) { | 868 | if (dma_mapping_error(ref->dev, ref->dev_addr)) { |
866 | err_printk(ref->dev, NULL, | 869 | err_printk(ref->dev, NULL, |
867 | "DMA-API: device driver tries " | 870 | "DMA-API: device driver tries to free an " |
868 | "to free an invalid DMA memory address\n"); | 871 | "invalid DMA memory address\n"); |
869 | return; | 872 | } else { |
873 | err_printk(ref->dev, NULL, | ||
874 | "DMA-API: device driver tries to free DMA " | ||
875 | "memory it has not allocated [device " | ||
876 | "address=0x%016llx] [size=%llu bytes]\n", | ||
877 | ref->dev_addr, ref->size); | ||
870 | } | 878 | } |
871 | err_printk(ref->dev, NULL, "DMA-API: device driver tries " | 879 | return; |
872 | "to free DMA memory it has not allocated " | ||
873 | "[device address=0x%016llx] [size=%llu bytes]\n", | ||
874 | ref->dev_addr, ref->size); | ||
875 | goto out; | ||
876 | } | 880 | } |
877 | 881 | ||
878 | if (ref->size != entry->size) { | 882 | if (ref->size != entry->size) { |
@@ -936,7 +940,6 @@ static void check_unmap(struct dma_debug_entry *ref) | |||
936 | hash_bucket_del(entry); | 940 | hash_bucket_del(entry); |
937 | dma_entry_free(entry); | 941 | dma_entry_free(entry); |
938 | 942 | ||
939 | out: | ||
940 | put_hash_bucket(bucket, &flags); | 943 | put_hash_bucket(bucket, &flags); |
941 | } | 944 | } |
942 | 945 | ||
@@ -1082,13 +1085,27 @@ void debug_dma_mapping_error(struct device *dev, dma_addr_t dma_addr) | |||
1082 | ref.dev = dev; | 1085 | ref.dev = dev; |
1083 | ref.dev_addr = dma_addr; | 1086 | ref.dev_addr = dma_addr; |
1084 | bucket = get_hash_bucket(&ref, &flags); | 1087 | bucket = get_hash_bucket(&ref, &flags); |
1085 | entry = bucket_find_exact(bucket, &ref); | ||
1086 | 1088 | ||
1087 | if (!entry) | 1089 | list_for_each_entry(entry, &bucket->list, list) { |
1088 | goto out; | 1090 | if (!exact_match(&ref, entry)) |
1091 | continue; | ||
1092 | |||
1093 | /* | ||
1094 | * The same physical address can be mapped multiple | ||
1095 | * times. Without a hardware IOMMU this results in the | ||
1096 | * same device addresses being put into the dma-debug | ||
1097 | * hash multiple times too. This can result in false | ||
1098 | * positives being reported. Therefore we implement a | ||
1099 | * best-fit algorithm here which updates the first entry | ||
1100 | * from the hash which fits the reference value and is | ||
1101 | * not currently listed as being checked. | ||
1102 | */ | ||
1103 | if (entry->map_err_type == MAP_ERR_NOT_CHECKED) { | ||
1104 | entry->map_err_type = MAP_ERR_CHECKED; | ||
1105 | break; | ||
1106 | } | ||
1107 | } | ||
1089 | 1108 | ||
1090 | entry->map_err_type = MAP_ERR_CHECKED; | ||
1091 | out: | ||
1092 | put_hash_bucket(bucket, &flags); | 1109 | put_hash_bucket(bucket, &flags); |
1093 | } | 1110 | } |
1094 | EXPORT_SYMBOL(debug_dma_mapping_error); | 1111 | EXPORT_SYMBOL(debug_dma_mapping_error); |
@@ -106,8 +106,14 @@ static struct idr_layer *idr_layer_alloc(gfp_t gfp_mask, struct idr *layer_idr) | |||
106 | if (layer_idr) | 106 | if (layer_idr) |
107 | return get_from_free_list(layer_idr); | 107 | return get_from_free_list(layer_idr); |
108 | 108 | ||
109 | /* try to allocate directly from kmem_cache */ | 109 | /* |
110 | new = kmem_cache_zalloc(idr_layer_cache, gfp_mask); | 110 | * Try to allocate directly from kmem_cache. We want to try this |
111 | * before preload buffer; otherwise, non-preloading idr_alloc() | ||
112 | * users will end up taking advantage of preloading ones. As the | ||
113 | * following is allowed to fail for preloaded cases, suppress | ||
114 | * warning this time. | ||
115 | */ | ||
116 | new = kmem_cache_zalloc(idr_layer_cache, gfp_mask | __GFP_NOWARN); | ||
111 | if (new) | 117 | if (new) |
112 | return new; | 118 | return new; |
113 | 119 | ||
@@ -115,18 +121,24 @@ static struct idr_layer *idr_layer_alloc(gfp_t gfp_mask, struct idr *layer_idr) | |||
115 | * Try to fetch one from the per-cpu preload buffer if in process | 121 | * Try to fetch one from the per-cpu preload buffer if in process |
116 | * context. See idr_preload() for details. | 122 | * context. See idr_preload() for details. |
117 | */ | 123 | */ |
118 | if (in_interrupt()) | 124 | if (!in_interrupt()) { |
119 | return NULL; | 125 | preempt_disable(); |
120 | 126 | new = __this_cpu_read(idr_preload_head); | |
121 | preempt_disable(); | 127 | if (new) { |
122 | new = __this_cpu_read(idr_preload_head); | 128 | __this_cpu_write(idr_preload_head, new->ary[0]); |
123 | if (new) { | 129 | __this_cpu_dec(idr_preload_cnt); |
124 | __this_cpu_write(idr_preload_head, new->ary[0]); | 130 | new->ary[0] = NULL; |
125 | __this_cpu_dec(idr_preload_cnt); | 131 | } |
126 | new->ary[0] = NULL; | 132 | preempt_enable(); |
133 | if (new) | ||
134 | return new; | ||
127 | } | 135 | } |
128 | preempt_enable(); | 136 | |
129 | return new; | 137 | /* |
138 | * Both failed. Try kmem_cache again w/o adding __GFP_NOWARN so | ||
139 | * that memory allocation failure warning is printed as intended. | ||
140 | */ | ||
141 | return kmem_cache_zalloc(idr_layer_cache, gfp_mask); | ||
130 | } | 142 | } |
131 | 143 | ||
132 | static void idr_layer_rcu_free(struct rcu_head *head) | 144 | static void idr_layer_rcu_free(struct rcu_head *head) |
@@ -184,20 +196,7 @@ static void idr_mark_full(struct idr_layer **pa, int id) | |||
184 | } | 196 | } |
185 | } | 197 | } |
186 | 198 | ||
187 | /** | 199 | int __idr_pre_get(struct idr *idp, gfp_t gfp_mask) |
188 | * idr_pre_get - reserve resources for idr allocation | ||
189 | * @idp: idr handle | ||
190 | * @gfp_mask: memory allocation flags | ||
191 | * | ||
192 | * This function should be called prior to calling the idr_get_new* functions. | ||
193 | * It preallocates enough memory to satisfy the worst possible allocation. The | ||
194 | * caller should pass in GFP_KERNEL if possible. This of course requires that | ||
195 | * no spinning locks be held. | ||
196 | * | ||
197 | * If the system is REALLY out of memory this function returns %0, | ||
198 | * otherwise %1. | ||
199 | */ | ||
200 | int idr_pre_get(struct idr *idp, gfp_t gfp_mask) | ||
201 | { | 200 | { |
202 | while (idp->id_free_cnt < MAX_IDR_FREE) { | 201 | while (idp->id_free_cnt < MAX_IDR_FREE) { |
203 | struct idr_layer *new; | 202 | struct idr_layer *new; |
@@ -208,13 +207,12 @@ int idr_pre_get(struct idr *idp, gfp_t gfp_mask) | |||
208 | } | 207 | } |
209 | return 1; | 208 | return 1; |
210 | } | 209 | } |
211 | EXPORT_SYMBOL(idr_pre_get); | 210 | EXPORT_SYMBOL(__idr_pre_get); |
212 | 211 | ||
213 | /** | 212 | /** |
214 | * sub_alloc - try to allocate an id without growing the tree depth | 213 | * sub_alloc - try to allocate an id without growing the tree depth |
215 | * @idp: idr handle | 214 | * @idp: idr handle |
216 | * @starting_id: id to start search at | 215 | * @starting_id: id to start search at |
217 | * @id: pointer to the allocated handle | ||
218 | * @pa: idr_layer[MAX_IDR_LEVEL] used as backtrack buffer | 216 | * @pa: idr_layer[MAX_IDR_LEVEL] used as backtrack buffer |
219 | * @gfp_mask: allocation mask for idr_layer_alloc() | 217 | * @gfp_mask: allocation mask for idr_layer_alloc() |
220 | * @layer_idr: optional idr passed to idr_layer_alloc() | 218 | * @layer_idr: optional idr passed to idr_layer_alloc() |
@@ -376,25 +374,7 @@ static void idr_fill_slot(struct idr *idr, void *ptr, int id, | |||
376 | idr_mark_full(pa, id); | 374 | idr_mark_full(pa, id); |
377 | } | 375 | } |
378 | 376 | ||
379 | /** | 377 | int __idr_get_new_above(struct idr *idp, void *ptr, int starting_id, int *id) |
380 | * idr_get_new_above - allocate new idr entry above or equal to a start id | ||
381 | * @idp: idr handle | ||
382 | * @ptr: pointer you want associated with the id | ||
383 | * @starting_id: id to start search at | ||
384 | * @id: pointer to the allocated handle | ||
385 | * | ||
386 | * This is the allocate id function. It should be called with any | ||
387 | * required locks. | ||
388 | * | ||
389 | * If allocation from IDR's private freelist fails, idr_get_new_above() will | ||
390 | * return %-EAGAIN. The caller should retry the idr_pre_get() call to refill | ||
391 | * IDR's preallocation and then retry the idr_get_new_above() call. | ||
392 | * | ||
393 | * If the idr is full idr_get_new_above() will return %-ENOSPC. | ||
394 | * | ||
395 | * @id returns a value in the range @starting_id ... %0x7fffffff | ||
396 | */ | ||
397 | int idr_get_new_above(struct idr *idp, void *ptr, int starting_id, int *id) | ||
398 | { | 378 | { |
399 | struct idr_layer *pa[MAX_IDR_LEVEL + 1]; | 379 | struct idr_layer *pa[MAX_IDR_LEVEL + 1]; |
400 | int rv; | 380 | int rv; |
@@ -407,7 +387,7 @@ int idr_get_new_above(struct idr *idp, void *ptr, int starting_id, int *id) | |||
407 | *id = rv; | 387 | *id = rv; |
408 | return 0; | 388 | return 0; |
409 | } | 389 | } |
410 | EXPORT_SYMBOL(idr_get_new_above); | 390 | EXPORT_SYMBOL(__idr_get_new_above); |
411 | 391 | ||
412 | /** | 392 | /** |
413 | * idr_preload - preload for idr_alloc() | 393 | * idr_preload - preload for idr_alloc() |
@@ -908,7 +888,7 @@ static void free_bitmap(struct ida *ida, struct ida_bitmap *bitmap) | |||
908 | int ida_pre_get(struct ida *ida, gfp_t gfp_mask) | 888 | int ida_pre_get(struct ida *ida, gfp_t gfp_mask) |
909 | { | 889 | { |
910 | /* allocate idr_layers */ | 890 | /* allocate idr_layers */ |
911 | if (!idr_pre_get(&ida->idr, gfp_mask)) | 891 | if (!__idr_pre_get(&ida->idr, gfp_mask)) |
912 | return 0; | 892 | return 0; |
913 | 893 | ||
914 | /* allocate free_bitmap */ | 894 | /* allocate free_bitmap */ |
diff --git a/lib/xz/Kconfig b/lib/xz/Kconfig index 82a04d7ba99e..08837db52d94 100644 --- a/lib/xz/Kconfig +++ b/lib/xz/Kconfig | |||
@@ -15,7 +15,7 @@ config XZ_DEC_X86 | |||
15 | 15 | ||
16 | config XZ_DEC_POWERPC | 16 | config XZ_DEC_POWERPC |
17 | bool "PowerPC BCJ filter decoder" | 17 | bool "PowerPC BCJ filter decoder" |
18 | default y if POWERPC | 18 | default y if PPC |
19 | select XZ_DEC_BCJ | 19 | select XZ_DEC_BCJ |
20 | 20 | ||
21 | config XZ_DEC_IA64 | 21 | config XZ_DEC_IA64 |
diff --git a/mm/Kconfig b/mm/Kconfig index ae55c1e04d10..3bea74f1ccfe 100644 --- a/mm/Kconfig +++ b/mm/Kconfig | |||
@@ -286,8 +286,12 @@ config NR_QUICK | |||
286 | default "1" | 286 | default "1" |
287 | 287 | ||
288 | config VIRT_TO_BUS | 288 | config VIRT_TO_BUS |
289 | def_bool y | 289 | bool |
290 | depends on HAVE_VIRT_TO_BUS | 290 | help |
291 | An architecture should select this if it implements the | ||
292 | deprecated interface virt_to_bus(). All new architectures | ||
293 | should probably not select this. | ||
294 | |||
291 | 295 | ||
292 | config MMU_NOTIFIER | 296 | config MMU_NOTIFIER |
293 | bool | 297 | bool |
diff --git a/mm/fremap.c b/mm/fremap.c index 0cd4c11488ed..4723ac8d2fc2 100644 --- a/mm/fremap.c +++ b/mm/fremap.c | |||
@@ -129,7 +129,7 @@ SYSCALL_DEFINE5(remap_file_pages, unsigned long, start, unsigned long, size, | |||
129 | struct vm_area_struct *vma; | 129 | struct vm_area_struct *vma; |
130 | int err = -EINVAL; | 130 | int err = -EINVAL; |
131 | int has_write_lock = 0; | 131 | int has_write_lock = 0; |
132 | vm_flags_t vm_flags; | 132 | vm_flags_t vm_flags = 0; |
133 | 133 | ||
134 | if (prot) | 134 | if (prot) |
135 | return err; | 135 | return err; |
@@ -254,7 +254,8 @@ get_write_lock: | |||
254 | */ | 254 | */ |
255 | 255 | ||
256 | out: | 256 | out: |
257 | vm_flags = vma->vm_flags; | 257 | if (vma) |
258 | vm_flags = vma->vm_flags; | ||
258 | if (likely(!has_write_lock)) | 259 | if (likely(!has_write_lock)) |
259 | up_read(&mm->mmap_sem); | 260 | up_read(&mm->mmap_sem); |
260 | else | 261 | else |
diff --git a/mm/hugetlb.c b/mm/hugetlb.c index 0a0be33bb199..ca9a7c6d7e97 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c | |||
@@ -2124,8 +2124,12 @@ int hugetlb_report_node_meminfo(int nid, char *buf) | |||
2124 | /* Return the number pages of memory we physically have, in PAGE_SIZE units. */ | 2124 | /* Return the number pages of memory we physically have, in PAGE_SIZE units. */ |
2125 | unsigned long hugetlb_total_pages(void) | 2125 | unsigned long hugetlb_total_pages(void) |
2126 | { | 2126 | { |
2127 | struct hstate *h = &default_hstate; | 2127 | struct hstate *h; |
2128 | return h->nr_huge_pages * pages_per_huge_page(h); | 2128 | unsigned long nr_total_pages = 0; |
2129 | |||
2130 | for_each_hstate(h) | ||
2131 | nr_total_pages += h->nr_huge_pages * pages_per_huge_page(h); | ||
2132 | return nr_total_pages; | ||
2129 | } | 2133 | } |
2130 | 2134 | ||
2131 | static int hugetlb_acct_memory(struct hstate *h, long delta) | 2135 | static int hugetlb_acct_memory(struct hstate *h, long delta) |
diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c index b81a367b9f39..ee3765760818 100644 --- a/mm/memory_hotplug.c +++ b/mm/memory_hotplug.c | |||
@@ -1779,7 +1779,11 @@ void try_offline_node(int nid) | |||
1779 | for (i = 0; i < MAX_NR_ZONES; i++) { | 1779 | for (i = 0; i < MAX_NR_ZONES; i++) { |
1780 | struct zone *zone = pgdat->node_zones + i; | 1780 | struct zone *zone = pgdat->node_zones + i; |
1781 | 1781 | ||
1782 | if (zone->wait_table) | 1782 | /* |
1783 | * wait_table may be allocated from boot memory, | ||
1784 | * here only free if it's allocated by vmalloc. | ||
1785 | */ | ||
1786 | if (is_vmalloc_addr(zone->wait_table)) | ||
1783 | vfree(zone->wait_table); | 1787 | vfree(zone->wait_table); |
1784 | } | 1788 | } |
1785 | 1789 | ||
@@ -1801,7 +1805,7 @@ int __ref remove_memory(int nid, u64 start, u64 size) | |||
1801 | int retry = 1; | 1805 | int retry = 1; |
1802 | 1806 | ||
1803 | start_pfn = PFN_DOWN(start); | 1807 | start_pfn = PFN_DOWN(start); |
1804 | end_pfn = start_pfn + PFN_DOWN(size); | 1808 | end_pfn = PFN_UP(start + size - 1); |
1805 | 1809 | ||
1806 | /* | 1810 | /* |
1807 | * When CONFIG_MEMCG is on, one memory block may be used by other | 1811 | * When CONFIG_MEMCG is on, one memory block may be used by other |
diff --git a/mm/process_vm_access.c b/mm/process_vm_access.c index 926b46649749..fd26d0433509 100644 --- a/mm/process_vm_access.c +++ b/mm/process_vm_access.c | |||
@@ -429,12 +429,6 @@ compat_process_vm_rw(compat_pid_t pid, | |||
429 | if (flags != 0) | 429 | if (flags != 0) |
430 | return -EINVAL; | 430 | return -EINVAL; |
431 | 431 | ||
432 | if (!access_ok(VERIFY_READ, lvec, liovcnt * sizeof(*lvec))) | ||
433 | goto out; | ||
434 | |||
435 | if (!access_ok(VERIFY_READ, rvec, riovcnt * sizeof(*rvec))) | ||
436 | goto out; | ||
437 | |||
438 | if (vm_write) | 432 | if (vm_write) |
439 | rc = compat_rw_copy_check_uvector(WRITE, lvec, liovcnt, | 433 | rc = compat_rw_copy_check_uvector(WRITE, lvec, liovcnt, |
440 | UIO_FASTIOV, iovstack_l, | 434 | UIO_FASTIOV, iovstack_l, |
@@ -459,8 +453,6 @@ free_iovecs: | |||
459 | kfree(iov_r); | 453 | kfree(iov_r); |
460 | if (iov_l != iovstack_l) | 454 | if (iov_l != iovstack_l) |
461 | kfree(iov_l); | 455 | kfree(iov_l); |
462 | |||
463 | out: | ||
464 | return rc; | 456 | return rc; |
465 | } | 457 | } |
466 | 458 | ||
diff --git a/net/batman-adv/bat_iv_ogm.c b/net/batman-adv/bat_iv_ogm.c index a0b253ecadaf..a5bb0a769eb9 100644 --- a/net/batman-adv/bat_iv_ogm.c +++ b/net/batman-adv/bat_iv_ogm.c | |||
@@ -1288,7 +1288,8 @@ static int batadv_iv_ogm_receive(struct sk_buff *skb, | |||
1288 | batadv_ogm_packet = (struct batadv_ogm_packet *)packet_buff; | 1288 | batadv_ogm_packet = (struct batadv_ogm_packet *)packet_buff; |
1289 | 1289 | ||
1290 | /* unpack the aggregated packets and process them one by one */ | 1290 | /* unpack the aggregated packets and process them one by one */ |
1291 | do { | 1291 | while (batadv_iv_ogm_aggr_packet(buff_pos, packet_len, |
1292 | batadv_ogm_packet->tt_num_changes)) { | ||
1292 | tt_buff = packet_buff + buff_pos + BATADV_OGM_HLEN; | 1293 | tt_buff = packet_buff + buff_pos + BATADV_OGM_HLEN; |
1293 | 1294 | ||
1294 | batadv_iv_ogm_process(ethhdr, batadv_ogm_packet, tt_buff, | 1295 | batadv_iv_ogm_process(ethhdr, batadv_ogm_packet, tt_buff, |
@@ -1299,8 +1300,7 @@ static int batadv_iv_ogm_receive(struct sk_buff *skb, | |||
1299 | 1300 | ||
1300 | packet_pos = packet_buff + buff_pos; | 1301 | packet_pos = packet_buff + buff_pos; |
1301 | batadv_ogm_packet = (struct batadv_ogm_packet *)packet_pos; | 1302 | batadv_ogm_packet = (struct batadv_ogm_packet *)packet_pos; |
1302 | } while (batadv_iv_ogm_aggr_packet(buff_pos, packet_len, | 1303 | } |
1303 | batadv_ogm_packet->tt_num_changes)); | ||
1304 | 1304 | ||
1305 | kfree_skb(skb); | 1305 | kfree_skb(skb); |
1306 | return NET_RX_SUCCESS; | 1306 | return NET_RX_SUCCESS; |
diff --git a/net/bridge/br_device.c b/net/bridge/br_device.c index d5f1d3fd4b28..314c73ed418f 100644 --- a/net/bridge/br_device.c +++ b/net/bridge/br_device.c | |||
@@ -66,7 +66,7 @@ netdev_tx_t br_dev_xmit(struct sk_buff *skb, struct net_device *dev) | |||
66 | goto out; | 66 | goto out; |
67 | } | 67 | } |
68 | 68 | ||
69 | mdst = br_mdb_get(br, skb); | 69 | mdst = br_mdb_get(br, skb, vid); |
70 | if (mdst || BR_INPUT_SKB_CB_MROUTERS_ONLY(skb)) | 70 | if (mdst || BR_INPUT_SKB_CB_MROUTERS_ONLY(skb)) |
71 | br_multicast_deliver(mdst, skb); | 71 | br_multicast_deliver(mdst, skb); |
72 | else | 72 | else |
diff --git a/net/bridge/br_input.c b/net/bridge/br_input.c index 480330151898..828e2bcc1f52 100644 --- a/net/bridge/br_input.c +++ b/net/bridge/br_input.c | |||
@@ -97,7 +97,7 @@ int br_handle_frame_finish(struct sk_buff *skb) | |||
97 | if (is_broadcast_ether_addr(dest)) | 97 | if (is_broadcast_ether_addr(dest)) |
98 | skb2 = skb; | 98 | skb2 = skb; |
99 | else if (is_multicast_ether_addr(dest)) { | 99 | else if (is_multicast_ether_addr(dest)) { |
100 | mdst = br_mdb_get(br, skb); | 100 | mdst = br_mdb_get(br, skb, vid); |
101 | if (mdst || BR_INPUT_SKB_CB_MROUTERS_ONLY(skb)) { | 101 | if (mdst || BR_INPUT_SKB_CB_MROUTERS_ONLY(skb)) { |
102 | if ((mdst && mdst->mglist) || | 102 | if ((mdst && mdst->mglist) || |
103 | br_multicast_is_router(br)) | 103 | br_multicast_is_router(br)) |
diff --git a/net/bridge/br_mdb.c b/net/bridge/br_mdb.c index 9f97b850fc65..ee79f3f20383 100644 --- a/net/bridge/br_mdb.c +++ b/net/bridge/br_mdb.c | |||
@@ -80,6 +80,7 @@ static int br_mdb_fill_info(struct sk_buff *skb, struct netlink_callback *cb, | |||
80 | port = p->port; | 80 | port = p->port; |
81 | if (port) { | 81 | if (port) { |
82 | struct br_mdb_entry e; | 82 | struct br_mdb_entry e; |
83 | memset(&e, 0, sizeof(e)); | ||
83 | e.ifindex = port->dev->ifindex; | 84 | e.ifindex = port->dev->ifindex; |
84 | e.state = p->state; | 85 | e.state = p->state; |
85 | if (p->addr.proto == htons(ETH_P_IP)) | 86 | if (p->addr.proto == htons(ETH_P_IP)) |
@@ -136,6 +137,7 @@ static int br_mdb_dump(struct sk_buff *skb, struct netlink_callback *cb) | |||
136 | break; | 137 | break; |
137 | 138 | ||
138 | bpm = nlmsg_data(nlh); | 139 | bpm = nlmsg_data(nlh); |
140 | memset(bpm, 0, sizeof(*bpm)); | ||
139 | bpm->ifindex = dev->ifindex; | 141 | bpm->ifindex = dev->ifindex; |
140 | if (br_mdb_fill_info(skb, cb, dev) < 0) | 142 | if (br_mdb_fill_info(skb, cb, dev) < 0) |
141 | goto out; | 143 | goto out; |
@@ -171,6 +173,7 @@ static int nlmsg_populate_mdb_fill(struct sk_buff *skb, | |||
171 | return -EMSGSIZE; | 173 | return -EMSGSIZE; |
172 | 174 | ||
173 | bpm = nlmsg_data(nlh); | 175 | bpm = nlmsg_data(nlh); |
176 | memset(bpm, 0, sizeof(*bpm)); | ||
174 | bpm->family = AF_BRIDGE; | 177 | bpm->family = AF_BRIDGE; |
175 | bpm->ifindex = dev->ifindex; | 178 | bpm->ifindex = dev->ifindex; |
176 | nest = nla_nest_start(skb, MDBA_MDB); | 179 | nest = nla_nest_start(skb, MDBA_MDB); |
@@ -228,6 +231,7 @@ void br_mdb_notify(struct net_device *dev, struct net_bridge_port *port, | |||
228 | { | 231 | { |
229 | struct br_mdb_entry entry; | 232 | struct br_mdb_entry entry; |
230 | 233 | ||
234 | memset(&entry, 0, sizeof(entry)); | ||
231 | entry.ifindex = port->dev->ifindex; | 235 | entry.ifindex = port->dev->ifindex; |
232 | entry.addr.proto = group->proto; | 236 | entry.addr.proto = group->proto; |
233 | entry.addr.u.ip4 = group->u.ip4; | 237 | entry.addr.u.ip4 = group->u.ip4; |
diff --git a/net/bridge/br_multicast.c b/net/bridge/br_multicast.c index 10e6fce1bb62..923fbeaf7afd 100644 --- a/net/bridge/br_multicast.c +++ b/net/bridge/br_multicast.c | |||
@@ -132,7 +132,7 @@ static struct net_bridge_mdb_entry *br_mdb_ip6_get( | |||
132 | #endif | 132 | #endif |
133 | 133 | ||
134 | struct net_bridge_mdb_entry *br_mdb_get(struct net_bridge *br, | 134 | struct net_bridge_mdb_entry *br_mdb_get(struct net_bridge *br, |
135 | struct sk_buff *skb) | 135 | struct sk_buff *skb, u16 vid) |
136 | { | 136 | { |
137 | struct net_bridge_mdb_htable *mdb = rcu_dereference(br->mdb); | 137 | struct net_bridge_mdb_htable *mdb = rcu_dereference(br->mdb); |
138 | struct br_ip ip; | 138 | struct br_ip ip; |
@@ -144,6 +144,7 @@ struct net_bridge_mdb_entry *br_mdb_get(struct net_bridge *br, | |||
144 | return NULL; | 144 | return NULL; |
145 | 145 | ||
146 | ip.proto = skb->protocol; | 146 | ip.proto = skb->protocol; |
147 | ip.vid = vid; | ||
147 | 148 | ||
148 | switch (skb->protocol) { | 149 | switch (skb->protocol) { |
149 | case htons(ETH_P_IP): | 150 | case htons(ETH_P_IP): |
diff --git a/net/bridge/br_netlink.c b/net/bridge/br_netlink.c index 27aa3ee517ce..299fc5f40a26 100644 --- a/net/bridge/br_netlink.c +++ b/net/bridge/br_netlink.c | |||
@@ -29,6 +29,7 @@ static inline size_t br_port_info_size(void) | |||
29 | + nla_total_size(1) /* IFLA_BRPORT_MODE */ | 29 | + nla_total_size(1) /* IFLA_BRPORT_MODE */ |
30 | + nla_total_size(1) /* IFLA_BRPORT_GUARD */ | 30 | + nla_total_size(1) /* IFLA_BRPORT_GUARD */ |
31 | + nla_total_size(1) /* IFLA_BRPORT_PROTECT */ | 31 | + nla_total_size(1) /* IFLA_BRPORT_PROTECT */ |
32 | + nla_total_size(1) /* IFLA_BRPORT_FAST_LEAVE */ | ||
32 | + 0; | 33 | + 0; |
33 | } | 34 | } |
34 | 35 | ||
@@ -329,6 +330,7 @@ static int br_setport(struct net_bridge_port *p, struct nlattr *tb[]) | |||
329 | br_set_port_flag(p, tb, IFLA_BRPORT_MODE, BR_HAIRPIN_MODE); | 330 | br_set_port_flag(p, tb, IFLA_BRPORT_MODE, BR_HAIRPIN_MODE); |
330 | br_set_port_flag(p, tb, IFLA_BRPORT_GUARD, BR_BPDU_GUARD); | 331 | br_set_port_flag(p, tb, IFLA_BRPORT_GUARD, BR_BPDU_GUARD); |
331 | br_set_port_flag(p, tb, IFLA_BRPORT_FAST_LEAVE, BR_MULTICAST_FAST_LEAVE); | 332 | br_set_port_flag(p, tb, IFLA_BRPORT_FAST_LEAVE, BR_MULTICAST_FAST_LEAVE); |
333 | br_set_port_flag(p, tb, IFLA_BRPORT_PROTECT, BR_ROOT_BLOCK); | ||
332 | 334 | ||
333 | if (tb[IFLA_BRPORT_COST]) { | 335 | if (tb[IFLA_BRPORT_COST]) { |
334 | err = br_stp_set_path_cost(p, nla_get_u32(tb[IFLA_BRPORT_COST])); | 336 | err = br_stp_set_path_cost(p, nla_get_u32(tb[IFLA_BRPORT_COST])); |
diff --git a/net/bridge/br_private.h b/net/bridge/br_private.h index 6d314c4e6bcb..3cbf5beb3d4b 100644 --- a/net/bridge/br_private.h +++ b/net/bridge/br_private.h | |||
@@ -442,7 +442,7 @@ extern int br_multicast_rcv(struct net_bridge *br, | |||
442 | struct net_bridge_port *port, | 442 | struct net_bridge_port *port, |
443 | struct sk_buff *skb); | 443 | struct sk_buff *skb); |
444 | extern struct net_bridge_mdb_entry *br_mdb_get(struct net_bridge *br, | 444 | extern struct net_bridge_mdb_entry *br_mdb_get(struct net_bridge *br, |
445 | struct sk_buff *skb); | 445 | struct sk_buff *skb, u16 vid); |
446 | extern void br_multicast_add_port(struct net_bridge_port *port); | 446 | extern void br_multicast_add_port(struct net_bridge_port *port); |
447 | extern void br_multicast_del_port(struct net_bridge_port *port); | 447 | extern void br_multicast_del_port(struct net_bridge_port *port); |
448 | extern void br_multicast_enable_port(struct net_bridge_port *port); | 448 | extern void br_multicast_enable_port(struct net_bridge_port *port); |
@@ -504,7 +504,7 @@ static inline int br_multicast_rcv(struct net_bridge *br, | |||
504 | } | 504 | } |
505 | 505 | ||
506 | static inline struct net_bridge_mdb_entry *br_mdb_get(struct net_bridge *br, | 506 | static inline struct net_bridge_mdb_entry *br_mdb_get(struct net_bridge *br, |
507 | struct sk_buff *skb) | 507 | struct sk_buff *skb, u16 vid) |
508 | { | 508 | { |
509 | return NULL; | 509 | return NULL; |
510 | } | 510 | } |
diff --git a/net/ceph/osdmap.c b/net/ceph/osdmap.c index 69bc4bf89e3e..4543b9aba40c 100644 --- a/net/ceph/osdmap.c +++ b/net/ceph/osdmap.c | |||
@@ -654,6 +654,24 @@ static int osdmap_set_max_osd(struct ceph_osdmap *map, int max) | |||
654 | return 0; | 654 | return 0; |
655 | } | 655 | } |
656 | 656 | ||
657 | static int __decode_pgid(void **p, void *end, struct ceph_pg *pg) | ||
658 | { | ||
659 | u8 v; | ||
660 | |||
661 | ceph_decode_need(p, end, 1+8+4+4, bad); | ||
662 | v = ceph_decode_8(p); | ||
663 | if (v != 1) | ||
664 | goto bad; | ||
665 | pg->pool = ceph_decode_64(p); | ||
666 | pg->seed = ceph_decode_32(p); | ||
667 | *p += 4; /* skip preferred */ | ||
668 | return 0; | ||
669 | |||
670 | bad: | ||
671 | dout("error decoding pgid\n"); | ||
672 | return -EINVAL; | ||
673 | } | ||
674 | |||
657 | /* | 675 | /* |
658 | * decode a full map. | 676 | * decode a full map. |
659 | */ | 677 | */ |
@@ -745,13 +763,12 @@ struct ceph_osdmap *osdmap_decode(void **p, void *end) | |||
745 | for (i = 0; i < len; i++) { | 763 | for (i = 0; i < len; i++) { |
746 | int n, j; | 764 | int n, j; |
747 | struct ceph_pg pgid; | 765 | struct ceph_pg pgid; |
748 | struct ceph_pg_v1 pgid_v1; | ||
749 | struct ceph_pg_mapping *pg; | 766 | struct ceph_pg_mapping *pg; |
750 | 767 | ||
751 | ceph_decode_need(p, end, sizeof(u32) + sizeof(u64), bad); | 768 | err = __decode_pgid(p, end, &pgid); |
752 | ceph_decode_copy(p, &pgid_v1, sizeof(pgid_v1)); | 769 | if (err) |
753 | pgid.pool = le32_to_cpu(pgid_v1.pool); | 770 | goto bad; |
754 | pgid.seed = le16_to_cpu(pgid_v1.ps); | 771 | ceph_decode_need(p, end, sizeof(u32), bad); |
755 | n = ceph_decode_32(p); | 772 | n = ceph_decode_32(p); |
756 | err = -EINVAL; | 773 | err = -EINVAL; |
757 | if (n > (UINT_MAX - sizeof(*pg)) / sizeof(u32)) | 774 | if (n > (UINT_MAX - sizeof(*pg)) / sizeof(u32)) |
@@ -818,8 +835,8 @@ struct ceph_osdmap *osdmap_apply_incremental(void **p, void *end, | |||
818 | u16 version; | 835 | u16 version; |
819 | 836 | ||
820 | ceph_decode_16_safe(p, end, version, bad); | 837 | ceph_decode_16_safe(p, end, version, bad); |
821 | if (version > 6) { | 838 | if (version != 6) { |
822 | pr_warning("got unknown v %d > %d of inc osdmap\n", version, 6); | 839 | pr_warning("got unknown v %d != 6 of inc osdmap\n", version); |
823 | goto bad; | 840 | goto bad; |
824 | } | 841 | } |
825 | 842 | ||
@@ -963,15 +980,14 @@ struct ceph_osdmap *osdmap_apply_incremental(void **p, void *end, | |||
963 | while (len--) { | 980 | while (len--) { |
964 | struct ceph_pg_mapping *pg; | 981 | struct ceph_pg_mapping *pg; |
965 | int j; | 982 | int j; |
966 | struct ceph_pg_v1 pgid_v1; | ||
967 | struct ceph_pg pgid; | 983 | struct ceph_pg pgid; |
968 | u32 pglen; | 984 | u32 pglen; |
969 | ceph_decode_need(p, end, sizeof(u64) + sizeof(u32), bad); | ||
970 | ceph_decode_copy(p, &pgid_v1, sizeof(pgid_v1)); | ||
971 | pgid.pool = le32_to_cpu(pgid_v1.pool); | ||
972 | pgid.seed = le16_to_cpu(pgid_v1.ps); | ||
973 | pglen = ceph_decode_32(p); | ||
974 | 985 | ||
986 | err = __decode_pgid(p, end, &pgid); | ||
987 | if (err) | ||
988 | goto bad; | ||
989 | ceph_decode_need(p, end, sizeof(u32), bad); | ||
990 | pglen = ceph_decode_32(p); | ||
975 | if (pglen) { | 991 | if (pglen) { |
976 | ceph_decode_need(p, end, pglen*sizeof(u32), bad); | 992 | ceph_decode_need(p, end, pglen*sizeof(u32), bad); |
977 | 993 | ||
diff --git a/net/core/dev.c b/net/core/dev.c index a06a7a58dd11..d540ced1f6c6 100644 --- a/net/core/dev.c +++ b/net/core/dev.c | |||
@@ -2219,9 +2219,9 @@ struct sk_buff *skb_mac_gso_segment(struct sk_buff *skb, | |||
2219 | struct sk_buff *segs = ERR_PTR(-EPROTONOSUPPORT); | 2219 | struct sk_buff *segs = ERR_PTR(-EPROTONOSUPPORT); |
2220 | struct packet_offload *ptype; | 2220 | struct packet_offload *ptype; |
2221 | __be16 type = skb->protocol; | 2221 | __be16 type = skb->protocol; |
2222 | int vlan_depth = ETH_HLEN; | ||
2222 | 2223 | ||
2223 | while (type == htons(ETH_P_8021Q)) { | 2224 | while (type == htons(ETH_P_8021Q)) { |
2224 | int vlan_depth = ETH_HLEN; | ||
2225 | struct vlan_hdr *vh; | 2225 | struct vlan_hdr *vh; |
2226 | 2226 | ||
2227 | if (unlikely(!pskb_may_pull(skb, vlan_depth + VLAN_HLEN))) | 2227 | if (unlikely(!pskb_may_pull(skb, vlan_depth + VLAN_HLEN))) |
@@ -3444,6 +3444,7 @@ ncls: | |||
3444 | } | 3444 | } |
3445 | switch (rx_handler(&skb)) { | 3445 | switch (rx_handler(&skb)) { |
3446 | case RX_HANDLER_CONSUMED: | 3446 | case RX_HANDLER_CONSUMED: |
3447 | ret = NET_RX_SUCCESS; | ||
3447 | goto unlock; | 3448 | goto unlock; |
3448 | case RX_HANDLER_ANOTHER: | 3449 | case RX_HANDLER_ANOTHER: |
3449 | goto another_round; | 3450 | goto another_round; |
@@ -4103,7 +4104,7 @@ static void net_rx_action(struct softirq_action *h) | |||
4103 | * Allow this to run for 2 jiffies since which will allow | 4104 | * Allow this to run for 2 jiffies since which will allow |
4104 | * an average latency of 1.5/HZ. | 4105 | * an average latency of 1.5/HZ. |
4105 | */ | 4106 | */ |
4106 | if (unlikely(budget <= 0 || time_after(jiffies, time_limit))) | 4107 | if (unlikely(budget <= 0 || time_after_eq(jiffies, time_limit))) |
4107 | goto softnet_break; | 4108 | goto softnet_break; |
4108 | 4109 | ||
4109 | local_irq_enable(); | 4110 | local_irq_enable(); |
@@ -4780,7 +4781,7 @@ EXPORT_SYMBOL(dev_set_mac_address); | |||
4780 | /** | 4781 | /** |
4781 | * dev_change_carrier - Change device carrier | 4782 | * dev_change_carrier - Change device carrier |
4782 | * @dev: device | 4783 | * @dev: device |
4783 | * @new_carries: new value | 4784 | * @new_carrier: new value |
4784 | * | 4785 | * |
4785 | * Change device carrier | 4786 | * Change device carrier |
4786 | */ | 4787 | */ |
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c index b376410ff259..5fb8d7e47294 100644 --- a/net/core/rtnetlink.c +++ b/net/core/rtnetlink.c | |||
@@ -979,6 +979,7 @@ static int rtnl_fill_ifinfo(struct sk_buff *skb, struct net_device *dev, | |||
979 | * report anything. | 979 | * report anything. |
980 | */ | 980 | */ |
981 | ivi.spoofchk = -1; | 981 | ivi.spoofchk = -1; |
982 | memset(ivi.mac, 0, sizeof(ivi.mac)); | ||
982 | if (dev->netdev_ops->ndo_get_vf_config(dev, i, &ivi)) | 983 | if (dev->netdev_ops->ndo_get_vf_config(dev, i, &ivi)) |
983 | break; | 984 | break; |
984 | vf_mac.vf = | 985 | vf_mac.vf = |
@@ -2620,7 +2621,7 @@ static int rtnetlink_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh) | |||
2620 | struct rtattr *attr = (void *)nlh + NLMSG_ALIGN(min_len); | 2621 | struct rtattr *attr = (void *)nlh + NLMSG_ALIGN(min_len); |
2621 | 2622 | ||
2622 | while (RTA_OK(attr, attrlen)) { | 2623 | while (RTA_OK(attr, attrlen)) { |
2623 | unsigned int flavor = attr->rta_type; | 2624 | unsigned int flavor = attr->rta_type & NLA_TYPE_MASK; |
2624 | if (flavor) { | 2625 | if (flavor) { |
2625 | if (flavor > rta_max[sz_idx]) | 2626 | if (flavor > rta_max[sz_idx]) |
2626 | return -EINVAL; | 2627 | return -EINVAL; |
diff --git a/net/dcb/dcbnl.c b/net/dcb/dcbnl.c index 1b588e23cf80..21291f1abcd6 100644 --- a/net/dcb/dcbnl.c +++ b/net/dcb/dcbnl.c | |||
@@ -284,6 +284,7 @@ static int dcbnl_getperm_hwaddr(struct net_device *netdev, struct nlmsghdr *nlh, | |||
284 | if (!netdev->dcbnl_ops->getpermhwaddr) | 284 | if (!netdev->dcbnl_ops->getpermhwaddr) |
285 | return -EOPNOTSUPP; | 285 | return -EOPNOTSUPP; |
286 | 286 | ||
287 | memset(perm_addr, 0, sizeof(perm_addr)); | ||
287 | netdev->dcbnl_ops->getpermhwaddr(netdev, perm_addr); | 288 | netdev->dcbnl_ops->getpermhwaddr(netdev, perm_addr); |
288 | 289 | ||
289 | return nla_put(skb, DCB_ATTR_PERM_HWADDR, sizeof(perm_addr), perm_addr); | 290 | return nla_put(skb, DCB_ATTR_PERM_HWADDR, sizeof(perm_addr), perm_addr); |
@@ -1042,6 +1043,7 @@ static int dcbnl_ieee_fill(struct sk_buff *skb, struct net_device *netdev) | |||
1042 | 1043 | ||
1043 | if (ops->ieee_getets) { | 1044 | if (ops->ieee_getets) { |
1044 | struct ieee_ets ets; | 1045 | struct ieee_ets ets; |
1046 | memset(&ets, 0, sizeof(ets)); | ||
1045 | err = ops->ieee_getets(netdev, &ets); | 1047 | err = ops->ieee_getets(netdev, &ets); |
1046 | if (!err && | 1048 | if (!err && |
1047 | nla_put(skb, DCB_ATTR_IEEE_ETS, sizeof(ets), &ets)) | 1049 | nla_put(skb, DCB_ATTR_IEEE_ETS, sizeof(ets), &ets)) |
@@ -1050,6 +1052,7 @@ static int dcbnl_ieee_fill(struct sk_buff *skb, struct net_device *netdev) | |||
1050 | 1052 | ||
1051 | if (ops->ieee_getmaxrate) { | 1053 | if (ops->ieee_getmaxrate) { |
1052 | struct ieee_maxrate maxrate; | 1054 | struct ieee_maxrate maxrate; |
1055 | memset(&maxrate, 0, sizeof(maxrate)); | ||
1053 | err = ops->ieee_getmaxrate(netdev, &maxrate); | 1056 | err = ops->ieee_getmaxrate(netdev, &maxrate); |
1054 | if (!err) { | 1057 | if (!err) { |
1055 | err = nla_put(skb, DCB_ATTR_IEEE_MAXRATE, | 1058 | err = nla_put(skb, DCB_ATTR_IEEE_MAXRATE, |
@@ -1061,6 +1064,7 @@ static int dcbnl_ieee_fill(struct sk_buff *skb, struct net_device *netdev) | |||
1061 | 1064 | ||
1062 | if (ops->ieee_getpfc) { | 1065 | if (ops->ieee_getpfc) { |
1063 | struct ieee_pfc pfc; | 1066 | struct ieee_pfc pfc; |
1067 | memset(&pfc, 0, sizeof(pfc)); | ||
1064 | err = ops->ieee_getpfc(netdev, &pfc); | 1068 | err = ops->ieee_getpfc(netdev, &pfc); |
1065 | if (!err && | 1069 | if (!err && |
1066 | nla_put(skb, DCB_ATTR_IEEE_PFC, sizeof(pfc), &pfc)) | 1070 | nla_put(skb, DCB_ATTR_IEEE_PFC, sizeof(pfc), &pfc)) |
@@ -1094,6 +1098,7 @@ static int dcbnl_ieee_fill(struct sk_buff *skb, struct net_device *netdev) | |||
1094 | /* get peer info if available */ | 1098 | /* get peer info if available */ |
1095 | if (ops->ieee_peer_getets) { | 1099 | if (ops->ieee_peer_getets) { |
1096 | struct ieee_ets ets; | 1100 | struct ieee_ets ets; |
1101 | memset(&ets, 0, sizeof(ets)); | ||
1097 | err = ops->ieee_peer_getets(netdev, &ets); | 1102 | err = ops->ieee_peer_getets(netdev, &ets); |
1098 | if (!err && | 1103 | if (!err && |
1099 | nla_put(skb, DCB_ATTR_IEEE_PEER_ETS, sizeof(ets), &ets)) | 1104 | nla_put(skb, DCB_ATTR_IEEE_PEER_ETS, sizeof(ets), &ets)) |
@@ -1102,6 +1107,7 @@ static int dcbnl_ieee_fill(struct sk_buff *skb, struct net_device *netdev) | |||
1102 | 1107 | ||
1103 | if (ops->ieee_peer_getpfc) { | 1108 | if (ops->ieee_peer_getpfc) { |
1104 | struct ieee_pfc pfc; | 1109 | struct ieee_pfc pfc; |
1110 | memset(&pfc, 0, sizeof(pfc)); | ||
1105 | err = ops->ieee_peer_getpfc(netdev, &pfc); | 1111 | err = ops->ieee_peer_getpfc(netdev, &pfc); |
1106 | if (!err && | 1112 | if (!err && |
1107 | nla_put(skb, DCB_ATTR_IEEE_PEER_PFC, sizeof(pfc), &pfc)) | 1113 | nla_put(skb, DCB_ATTR_IEEE_PEER_PFC, sizeof(pfc), &pfc)) |
@@ -1280,6 +1286,7 @@ static int dcbnl_cee_fill(struct sk_buff *skb, struct net_device *netdev) | |||
1280 | /* peer info if available */ | 1286 | /* peer info if available */ |
1281 | if (ops->cee_peer_getpg) { | 1287 | if (ops->cee_peer_getpg) { |
1282 | struct cee_pg pg; | 1288 | struct cee_pg pg; |
1289 | memset(&pg, 0, sizeof(pg)); | ||
1283 | err = ops->cee_peer_getpg(netdev, &pg); | 1290 | err = ops->cee_peer_getpg(netdev, &pg); |
1284 | if (!err && | 1291 | if (!err && |
1285 | nla_put(skb, DCB_ATTR_CEE_PEER_PG, sizeof(pg), &pg)) | 1292 | nla_put(skb, DCB_ATTR_CEE_PEER_PG, sizeof(pg), &pg)) |
@@ -1288,6 +1295,7 @@ static int dcbnl_cee_fill(struct sk_buff *skb, struct net_device *netdev) | |||
1288 | 1295 | ||
1289 | if (ops->cee_peer_getpfc) { | 1296 | if (ops->cee_peer_getpfc) { |
1290 | struct cee_pfc pfc; | 1297 | struct cee_pfc pfc; |
1298 | memset(&pfc, 0, sizeof(pfc)); | ||
1291 | err = ops->cee_peer_getpfc(netdev, &pfc); | 1299 | err = ops->cee_peer_getpfc(netdev, &pfc); |
1292 | if (!err && | 1300 | if (!err && |
1293 | nla_put(skb, DCB_ATTR_CEE_PEER_PFC, sizeof(pfc), &pfc)) | 1301 | nla_put(skb, DCB_ATTR_CEE_PEER_PFC, sizeof(pfc), &pfc)) |
diff --git a/net/ieee802154/6lowpan.h b/net/ieee802154/6lowpan.h index 8c2251fb0a3f..bba5f8336317 100644 --- a/net/ieee802154/6lowpan.h +++ b/net/ieee802154/6lowpan.h | |||
@@ -84,7 +84,7 @@ | |||
84 | (memcmp(addr1, addr2, length >> 3) == 0) | 84 | (memcmp(addr1, addr2, length >> 3) == 0) |
85 | 85 | ||
86 | /* local link, i.e. FE80::/10 */ | 86 | /* local link, i.e. FE80::/10 */ |
87 | #define is_addr_link_local(a) (((a)->s6_addr16[0]) == 0x80FE) | 87 | #define is_addr_link_local(a) (((a)->s6_addr16[0]) == htons(0xFE80)) |
88 | 88 | ||
89 | /* | 89 | /* |
90 | * check whether we can compress the IID to 16 bits, | 90 | * check whether we can compress the IID to 16 bits, |
diff --git a/net/ipv4/inet_connection_sock.c b/net/ipv4/inet_connection_sock.c index 7d1874be1df3..786d97aee751 100644 --- a/net/ipv4/inet_connection_sock.c +++ b/net/ipv4/inet_connection_sock.c | |||
@@ -735,6 +735,7 @@ EXPORT_SYMBOL(inet_csk_destroy_sock); | |||
735 | * tcp/dccp_create_openreq_child(). | 735 | * tcp/dccp_create_openreq_child(). |
736 | */ | 736 | */ |
737 | void inet_csk_prepare_forced_close(struct sock *sk) | 737 | void inet_csk_prepare_forced_close(struct sock *sk) |
738 | __releases(&sk->sk_lock.slock) | ||
738 | { | 739 | { |
739 | /* sk_clone_lock locked the socket and set refcnt to 2 */ | 740 | /* sk_clone_lock locked the socket and set refcnt to 2 */ |
740 | bh_unlock_sock(sk); | 741 | bh_unlock_sock(sk); |
diff --git a/net/ipv4/inet_fragment.c b/net/ipv4/inet_fragment.c index 245ae078a07f..f4fd23de9b13 100644 --- a/net/ipv4/inet_fragment.c +++ b/net/ipv4/inet_fragment.c | |||
@@ -21,6 +21,7 @@ | |||
21 | #include <linux/rtnetlink.h> | 21 | #include <linux/rtnetlink.h> |
22 | #include <linux/slab.h> | 22 | #include <linux/slab.h> |
23 | 23 | ||
24 | #include <net/sock.h> | ||
24 | #include <net/inet_frag.h> | 25 | #include <net/inet_frag.h> |
25 | 26 | ||
26 | static void inet_frag_secret_rebuild(unsigned long dummy) | 27 | static void inet_frag_secret_rebuild(unsigned long dummy) |
@@ -277,6 +278,7 @@ struct inet_frag_queue *inet_frag_find(struct netns_frags *nf, | |||
277 | __releases(&f->lock) | 278 | __releases(&f->lock) |
278 | { | 279 | { |
279 | struct inet_frag_queue *q; | 280 | struct inet_frag_queue *q; |
281 | int depth = 0; | ||
280 | 282 | ||
281 | hlist_for_each_entry(q, &f->hash[hash], list) { | 283 | hlist_for_each_entry(q, &f->hash[hash], list) { |
282 | if (q->net == nf && f->match(q, key)) { | 284 | if (q->net == nf && f->match(q, key)) { |
@@ -284,9 +286,25 @@ struct inet_frag_queue *inet_frag_find(struct netns_frags *nf, | |||
284 | read_unlock(&f->lock); | 286 | read_unlock(&f->lock); |
285 | return q; | 287 | return q; |
286 | } | 288 | } |
289 | depth++; | ||
287 | } | 290 | } |
288 | read_unlock(&f->lock); | 291 | read_unlock(&f->lock); |
289 | 292 | ||
290 | return inet_frag_create(nf, f, key); | 293 | if (depth <= INETFRAGS_MAXDEPTH) |
294 | return inet_frag_create(nf, f, key); | ||
295 | else | ||
296 | return ERR_PTR(-ENOBUFS); | ||
291 | } | 297 | } |
292 | EXPORT_SYMBOL(inet_frag_find); | 298 | EXPORT_SYMBOL(inet_frag_find); |
299 | |||
300 | void inet_frag_maybe_warn_overflow(struct inet_frag_queue *q, | ||
301 | const char *prefix) | ||
302 | { | ||
303 | static const char msg[] = "inet_frag_find: Fragment hash bucket" | ||
304 | " list length grew over limit " __stringify(INETFRAGS_MAXDEPTH) | ||
305 | ". Dropping fragment.\n"; | ||
306 | |||
307 | if (PTR_ERR(q) == -ENOBUFS) | ||
308 | LIMIT_NETDEBUG(KERN_WARNING "%s%s", prefix, msg); | ||
309 | } | ||
310 | EXPORT_SYMBOL(inet_frag_maybe_warn_overflow); | ||
diff --git a/net/ipv4/ip_fragment.c b/net/ipv4/ip_fragment.c index b6d30acb600c..a6445b843ef4 100644 --- a/net/ipv4/ip_fragment.c +++ b/net/ipv4/ip_fragment.c | |||
@@ -292,14 +292,11 @@ static inline struct ipq *ip_find(struct net *net, struct iphdr *iph, u32 user) | |||
292 | hash = ipqhashfn(iph->id, iph->saddr, iph->daddr, iph->protocol); | 292 | hash = ipqhashfn(iph->id, iph->saddr, iph->daddr, iph->protocol); |
293 | 293 | ||
294 | q = inet_frag_find(&net->ipv4.frags, &ip4_frags, &arg, hash); | 294 | q = inet_frag_find(&net->ipv4.frags, &ip4_frags, &arg, hash); |
295 | if (q == NULL) | 295 | if (IS_ERR_OR_NULL(q)) { |
296 | goto out_nomem; | 296 | inet_frag_maybe_warn_overflow(q, pr_fmt()); |
297 | 297 | return NULL; | |
298 | } | ||
298 | return container_of(q, struct ipq, q); | 299 | return container_of(q, struct ipq, q); |
299 | |||
300 | out_nomem: | ||
301 | LIMIT_NETDEBUG(KERN_ERR pr_fmt("ip_frag_create: no memory left !\n")); | ||
302 | return NULL; | ||
303 | } | 300 | } |
304 | 301 | ||
305 | /* Is the fragment too far ahead to be part of ipq? */ | 302 | /* Is the fragment too far ahead to be part of ipq? */ |
diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c index d0ef0e674ec5..91d66dbde9c0 100644 --- a/net/ipv4/ip_gre.c +++ b/net/ipv4/ip_gre.c | |||
@@ -798,10 +798,7 @@ static netdev_tx_t ipgre_tunnel_xmit(struct sk_buff *skb, struct net_device *dev | |||
798 | 798 | ||
799 | if (dev->header_ops && dev->type == ARPHRD_IPGRE) { | 799 | if (dev->header_ops && dev->type == ARPHRD_IPGRE) { |
800 | gre_hlen = 0; | 800 | gre_hlen = 0; |
801 | if (skb->protocol == htons(ETH_P_IP)) | 801 | tiph = (const struct iphdr *)skb->data; |
802 | tiph = (const struct iphdr *)skb->data; | ||
803 | else | ||
804 | tiph = &tunnel->parms.iph; | ||
805 | } else { | 802 | } else { |
806 | gre_hlen = tunnel->hlen; | 803 | gre_hlen = tunnel->hlen; |
807 | tiph = &tunnel->parms.iph; | 804 | tiph = &tunnel->parms.iph; |
diff --git a/net/ipv4/ip_options.c b/net/ipv4/ip_options.c index f6289bf6f332..ec7264514a82 100644 --- a/net/ipv4/ip_options.c +++ b/net/ipv4/ip_options.c | |||
@@ -370,7 +370,6 @@ int ip_options_compile(struct net *net, | |||
370 | } | 370 | } |
371 | switch (optptr[3]&0xF) { | 371 | switch (optptr[3]&0xF) { |
372 | case IPOPT_TS_TSONLY: | 372 | case IPOPT_TS_TSONLY: |
373 | opt->ts = optptr - iph; | ||
374 | if (skb) | 373 | if (skb) |
375 | timeptr = &optptr[optptr[2]-1]; | 374 | timeptr = &optptr[optptr[2]-1]; |
376 | opt->ts_needtime = 1; | 375 | opt->ts_needtime = 1; |
@@ -381,7 +380,6 @@ int ip_options_compile(struct net *net, | |||
381 | pp_ptr = optptr + 2; | 380 | pp_ptr = optptr + 2; |
382 | goto error; | 381 | goto error; |
383 | } | 382 | } |
384 | opt->ts = optptr - iph; | ||
385 | if (rt) { | 383 | if (rt) { |
386 | spec_dst_fill(&spec_dst, skb); | 384 | spec_dst_fill(&spec_dst, skb); |
387 | memcpy(&optptr[optptr[2]-1], &spec_dst, 4); | 385 | memcpy(&optptr[optptr[2]-1], &spec_dst, 4); |
@@ -396,7 +394,6 @@ int ip_options_compile(struct net *net, | |||
396 | pp_ptr = optptr + 2; | 394 | pp_ptr = optptr + 2; |
397 | goto error; | 395 | goto error; |
398 | } | 396 | } |
399 | opt->ts = optptr - iph; | ||
400 | { | 397 | { |
401 | __be32 addr; | 398 | __be32 addr; |
402 | memcpy(&addr, &optptr[optptr[2]-1], 4); | 399 | memcpy(&addr, &optptr[optptr[2]-1], 4); |
@@ -423,18 +420,18 @@ int ip_options_compile(struct net *net, | |||
423 | put_unaligned_be32(midtime, timeptr); | 420 | put_unaligned_be32(midtime, timeptr); |
424 | opt->is_changed = 1; | 421 | opt->is_changed = 1; |
425 | } | 422 | } |
426 | } else { | 423 | } else if ((optptr[3]&0xF) != IPOPT_TS_PRESPEC) { |
427 | unsigned int overflow = optptr[3]>>4; | 424 | unsigned int overflow = optptr[3]>>4; |
428 | if (overflow == 15) { | 425 | if (overflow == 15) { |
429 | pp_ptr = optptr + 3; | 426 | pp_ptr = optptr + 3; |
430 | goto error; | 427 | goto error; |
431 | } | 428 | } |
432 | opt->ts = optptr - iph; | ||
433 | if (skb) { | 429 | if (skb) { |
434 | optptr[3] = (optptr[3]&0xF)|((overflow+1)<<4); | 430 | optptr[3] = (optptr[3]&0xF)|((overflow+1)<<4); |
435 | opt->is_changed = 1; | 431 | opt->is_changed = 1; |
436 | } | 432 | } |
437 | } | 433 | } |
434 | opt->ts = optptr - iph; | ||
438 | break; | 435 | break; |
439 | case IPOPT_RA: | 436 | case IPOPT_RA: |
440 | if (optlen < 4) { | 437 | if (optlen < 4) { |
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c index 47e854fcae24..e22020790709 100644 --- a/net/ipv4/tcp.c +++ b/net/ipv4/tcp.c | |||
@@ -775,7 +775,7 @@ struct sk_buff *sk_stream_alloc_skb(struct sock *sk, int size, gfp_t gfp) | |||
775 | * Make sure that we have exactly size bytes | 775 | * Make sure that we have exactly size bytes |
776 | * available to the caller, no more, no less. | 776 | * available to the caller, no more, no less. |
777 | */ | 777 | */ |
778 | skb->avail_size = size; | 778 | skb->reserved_tailroom = skb->end - skb->tail - size; |
779 | return skb; | 779 | return skb; |
780 | } | 780 | } |
781 | __kfree_skb(skb); | 781 | __kfree_skb(skb); |
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c index 4a8ec457310f..d09203c63264 100644 --- a/net/ipv4/tcp_ipv4.c +++ b/net/ipv4/tcp_ipv4.c | |||
@@ -274,13 +274,6 @@ static void tcp_v4_mtu_reduced(struct sock *sk) | |||
274 | struct inet_sock *inet = inet_sk(sk); | 274 | struct inet_sock *inet = inet_sk(sk); |
275 | u32 mtu = tcp_sk(sk)->mtu_info; | 275 | u32 mtu = tcp_sk(sk)->mtu_info; |
276 | 276 | ||
277 | /* We are not interested in TCP_LISTEN and open_requests (SYN-ACKs | ||
278 | * send out by Linux are always <576bytes so they should go through | ||
279 | * unfragmented). | ||
280 | */ | ||
281 | if (sk->sk_state == TCP_LISTEN) | ||
282 | return; | ||
283 | |||
284 | dst = inet_csk_update_pmtu(sk, mtu); | 277 | dst = inet_csk_update_pmtu(sk, mtu); |
285 | if (!dst) | 278 | if (!dst) |
286 | return; | 279 | return; |
@@ -408,6 +401,13 @@ void tcp_v4_err(struct sk_buff *icmp_skb, u32 info) | |||
408 | goto out; | 401 | goto out; |
409 | 402 | ||
410 | if (code == ICMP_FRAG_NEEDED) { /* PMTU discovery (RFC1191) */ | 403 | if (code == ICMP_FRAG_NEEDED) { /* PMTU discovery (RFC1191) */ |
404 | /* We are not interested in TCP_LISTEN and open_requests | ||
405 | * (SYN-ACKs send out by Linux are always <576bytes so | ||
406 | * they should go through unfragmented). | ||
407 | */ | ||
408 | if (sk->sk_state == TCP_LISTEN) | ||
409 | goto out; | ||
410 | |||
411 | tp->mtu_info = info; | 411 | tp->mtu_info = info; |
412 | if (!sock_owned_by_user(sk)) { | 412 | if (!sock_owned_by_user(sk)) { |
413 | tcp_v4_mtu_reduced(sk); | 413 | tcp_v4_mtu_reduced(sk); |
diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c index e2b4461074da..817fbb396bc8 100644 --- a/net/ipv4/tcp_output.c +++ b/net/ipv4/tcp_output.c | |||
@@ -1298,7 +1298,6 @@ static void __pskb_trim_head(struct sk_buff *skb, int len) | |||
1298 | eat = min_t(int, len, skb_headlen(skb)); | 1298 | eat = min_t(int, len, skb_headlen(skb)); |
1299 | if (eat) { | 1299 | if (eat) { |
1300 | __skb_pull(skb, eat); | 1300 | __skb_pull(skb, eat); |
1301 | skb->avail_size -= eat; | ||
1302 | len -= eat; | 1301 | len -= eat; |
1303 | if (!len) | 1302 | if (!len) |
1304 | return; | 1303 | return; |
diff --git a/net/ipv6/ip6_input.c b/net/ipv6/ip6_input.c index b1876e52091e..e33fe0ab2568 100644 --- a/net/ipv6/ip6_input.c +++ b/net/ipv6/ip6_input.c | |||
@@ -281,7 +281,8 @@ int ip6_mc_input(struct sk_buff *skb) | |||
281 | * IPv6 multicast router mode is now supported ;) | 281 | * IPv6 multicast router mode is now supported ;) |
282 | */ | 282 | */ |
283 | if (dev_net(skb->dev)->ipv6.devconf_all->mc_forwarding && | 283 | if (dev_net(skb->dev)->ipv6.devconf_all->mc_forwarding && |
284 | !(ipv6_addr_type(&hdr->daddr) & IPV6_ADDR_LINKLOCAL) && | 284 | !(ipv6_addr_type(&hdr->daddr) & |
285 | (IPV6_ADDR_LOOPBACK|IPV6_ADDR_LINKLOCAL)) && | ||
285 | likely(!(IP6CB(skb)->flags & IP6SKB_FORWARDED))) { | 286 | likely(!(IP6CB(skb)->flags & IP6SKB_FORWARDED))) { |
286 | /* | 287 | /* |
287 | * Okay, we try to forward - split and duplicate | 288 | * Okay, we try to forward - split and duplicate |
diff --git a/net/ipv6/netfilter/nf_conntrack_reasm.c b/net/ipv6/netfilter/nf_conntrack_reasm.c index 54087e96d7b8..6700069949dd 100644 --- a/net/ipv6/netfilter/nf_conntrack_reasm.c +++ b/net/ipv6/netfilter/nf_conntrack_reasm.c | |||
@@ -14,6 +14,8 @@ | |||
14 | * 2 of the License, or (at your option) any later version. | 14 | * 2 of the License, or (at your option) any later version. |
15 | */ | 15 | */ |
16 | 16 | ||
17 | #define pr_fmt(fmt) "IPv6-nf: " fmt | ||
18 | |||
17 | #include <linux/errno.h> | 19 | #include <linux/errno.h> |
18 | #include <linux/types.h> | 20 | #include <linux/types.h> |
19 | #include <linux/string.h> | 21 | #include <linux/string.h> |
@@ -180,13 +182,11 @@ static inline struct frag_queue *fq_find(struct net *net, __be32 id, | |||
180 | 182 | ||
181 | q = inet_frag_find(&net->nf_frag.frags, &nf_frags, &arg, hash); | 183 | q = inet_frag_find(&net->nf_frag.frags, &nf_frags, &arg, hash); |
182 | local_bh_enable(); | 184 | local_bh_enable(); |
183 | if (q == NULL) | 185 | if (IS_ERR_OR_NULL(q)) { |
184 | goto oom; | 186 | inet_frag_maybe_warn_overflow(q, pr_fmt()); |
185 | 187 | return NULL; | |
188 | } | ||
186 | return container_of(q, struct frag_queue, q); | 189 | return container_of(q, struct frag_queue, q); |
187 | |||
188 | oom: | ||
189 | return NULL; | ||
190 | } | 190 | } |
191 | 191 | ||
192 | 192 | ||
diff --git a/net/ipv6/reassembly.c b/net/ipv6/reassembly.c index 3c6a77290c6e..196ab9347ad1 100644 --- a/net/ipv6/reassembly.c +++ b/net/ipv6/reassembly.c | |||
@@ -26,6 +26,9 @@ | |||
26 | * YOSHIFUJI,H. @USAGI Always remove fragment header to | 26 | * YOSHIFUJI,H. @USAGI Always remove fragment header to |
27 | * calculate ICV correctly. | 27 | * calculate ICV correctly. |
28 | */ | 28 | */ |
29 | |||
30 | #define pr_fmt(fmt) "IPv6: " fmt | ||
31 | |||
29 | #include <linux/errno.h> | 32 | #include <linux/errno.h> |
30 | #include <linux/types.h> | 33 | #include <linux/types.h> |
31 | #include <linux/string.h> | 34 | #include <linux/string.h> |
@@ -185,9 +188,10 @@ fq_find(struct net *net, __be32 id, const struct in6_addr *src, const struct in6 | |||
185 | hash = inet6_hash_frag(id, src, dst, ip6_frags.rnd); | 188 | hash = inet6_hash_frag(id, src, dst, ip6_frags.rnd); |
186 | 189 | ||
187 | q = inet_frag_find(&net->ipv6.frags, &ip6_frags, &arg, hash); | 190 | q = inet_frag_find(&net->ipv6.frags, &ip6_frags, &arg, hash); |
188 | if (q == NULL) | 191 | if (IS_ERR_OR_NULL(q)) { |
192 | inet_frag_maybe_warn_overflow(q, pr_fmt()); | ||
189 | return NULL; | 193 | return NULL; |
190 | 194 | } | |
191 | return container_of(q, struct frag_queue, q); | 195 | return container_of(q, struct frag_queue, q); |
192 | } | 196 | } |
193 | 197 | ||
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c index 9b6460055df5..f6d629fd6aee 100644 --- a/net/ipv6/tcp_ipv6.c +++ b/net/ipv6/tcp_ipv6.c | |||
@@ -389,6 +389,13 @@ static void tcp_v6_err(struct sk_buff *skb, struct inet6_skb_parm *opt, | |||
389 | } | 389 | } |
390 | 390 | ||
391 | if (type == ICMPV6_PKT_TOOBIG) { | 391 | if (type == ICMPV6_PKT_TOOBIG) { |
392 | /* We are not interested in TCP_LISTEN and open_requests | ||
393 | * (SYN-ACKs send out by Linux are always <576bytes so | ||
394 | * they should go through unfragmented). | ||
395 | */ | ||
396 | if (sk->sk_state == TCP_LISTEN) | ||
397 | goto out; | ||
398 | |||
392 | tp->mtu_info = ntohl(info); | 399 | tp->mtu_info = ntohl(info); |
393 | if (!sock_owned_by_user(sk)) | 400 | if (!sock_owned_by_user(sk)) |
394 | tcp_v6_mtu_reduced(sk); | 401 | tcp_v6_mtu_reduced(sk); |
diff --git a/net/irda/ircomm/ircomm_tty.c b/net/irda/ircomm/ircomm_tty.c index 9a5fd3c3e530..362ba47968e4 100644 --- a/net/irda/ircomm/ircomm_tty.c +++ b/net/irda/ircomm/ircomm_tty.c | |||
@@ -280,7 +280,7 @@ static int ircomm_tty_block_til_ready(struct ircomm_tty_cb *self, | |||
280 | struct tty_port *port = &self->port; | 280 | struct tty_port *port = &self->port; |
281 | DECLARE_WAITQUEUE(wait, current); | 281 | DECLARE_WAITQUEUE(wait, current); |
282 | int retval; | 282 | int retval; |
283 | int do_clocal = 0, extra_count = 0; | 283 | int do_clocal = 0; |
284 | unsigned long flags; | 284 | unsigned long flags; |
285 | 285 | ||
286 | IRDA_DEBUG(2, "%s()\n", __func__ ); | 286 | IRDA_DEBUG(2, "%s()\n", __func__ ); |
@@ -289,8 +289,15 @@ static int ircomm_tty_block_til_ready(struct ircomm_tty_cb *self, | |||
289 | * If non-blocking mode is set, or the port is not enabled, | 289 | * If non-blocking mode is set, or the port is not enabled, |
290 | * then make the check up front and then exit. | 290 | * then make the check up front and then exit. |
291 | */ | 291 | */ |
292 | if (filp->f_flags & O_NONBLOCK || tty->flags & (1 << TTY_IO_ERROR)){ | 292 | if (test_bit(TTY_IO_ERROR, &tty->flags)) { |
293 | /* nonblock mode is set or port is not enabled */ | 293 | port->flags |= ASYNC_NORMAL_ACTIVE; |
294 | return 0; | ||
295 | } | ||
296 | |||
297 | if (filp->f_flags & O_NONBLOCK) { | ||
298 | /* nonblock mode is set */ | ||
299 | if (tty->termios.c_cflag & CBAUD) | ||
300 | tty_port_raise_dtr_rts(port); | ||
294 | port->flags |= ASYNC_NORMAL_ACTIVE; | 301 | port->flags |= ASYNC_NORMAL_ACTIVE; |
295 | IRDA_DEBUG(1, "%s(), O_NONBLOCK requested!\n", __func__ ); | 302 | IRDA_DEBUG(1, "%s(), O_NONBLOCK requested!\n", __func__ ); |
296 | return 0; | 303 | return 0; |
@@ -315,18 +322,16 @@ static int ircomm_tty_block_til_ready(struct ircomm_tty_cb *self, | |||
315 | __FILE__, __LINE__, tty->driver->name, port->count); | 322 | __FILE__, __LINE__, tty->driver->name, port->count); |
316 | 323 | ||
317 | spin_lock_irqsave(&port->lock, flags); | 324 | spin_lock_irqsave(&port->lock, flags); |
318 | if (!tty_hung_up_p(filp)) { | 325 | if (!tty_hung_up_p(filp)) |
319 | extra_count = 1; | ||
320 | port->count--; | 326 | port->count--; |
321 | } | ||
322 | spin_unlock_irqrestore(&port->lock, flags); | ||
323 | port->blocked_open++; | 327 | port->blocked_open++; |
328 | spin_unlock_irqrestore(&port->lock, flags); | ||
324 | 329 | ||
325 | while (1) { | 330 | while (1) { |
326 | if (tty->termios.c_cflag & CBAUD) | 331 | if (tty->termios.c_cflag & CBAUD) |
327 | tty_port_raise_dtr_rts(port); | 332 | tty_port_raise_dtr_rts(port); |
328 | 333 | ||
329 | current->state = TASK_INTERRUPTIBLE; | 334 | set_current_state(TASK_INTERRUPTIBLE); |
330 | 335 | ||
331 | if (tty_hung_up_p(filp) || | 336 | if (tty_hung_up_p(filp) || |
332 | !test_bit(ASYNCB_INITIALIZED, &port->flags)) { | 337 | !test_bit(ASYNCB_INITIALIZED, &port->flags)) { |
@@ -361,13 +366,11 @@ static int ircomm_tty_block_til_ready(struct ircomm_tty_cb *self, | |||
361 | __set_current_state(TASK_RUNNING); | 366 | __set_current_state(TASK_RUNNING); |
362 | remove_wait_queue(&port->open_wait, &wait); | 367 | remove_wait_queue(&port->open_wait, &wait); |
363 | 368 | ||
364 | if (extra_count) { | 369 | spin_lock_irqsave(&port->lock, flags); |
365 | /* ++ is not atomic, so this should be protected - Jean II */ | 370 | if (!tty_hung_up_p(filp)) |
366 | spin_lock_irqsave(&port->lock, flags); | ||
367 | port->count++; | 371 | port->count++; |
368 | spin_unlock_irqrestore(&port->lock, flags); | ||
369 | } | ||
370 | port->blocked_open--; | 372 | port->blocked_open--; |
373 | spin_unlock_irqrestore(&port->lock, flags); | ||
371 | 374 | ||
372 | IRDA_DEBUG(1, "%s(%d):block_til_ready after blocking on %s open_count=%d\n", | 375 | IRDA_DEBUG(1, "%s(%d):block_til_ready after blocking on %s open_count=%d\n", |
373 | __FILE__, __LINE__, tty->driver->name, port->count); | 376 | __FILE__, __LINE__, tty->driver->name, port->count); |
diff --git a/net/key/af_key.c b/net/key/af_key.c index 556fdafdd1ea..8555f331ea60 100644 --- a/net/key/af_key.c +++ b/net/key/af_key.c | |||
@@ -2201,7 +2201,7 @@ static int pfkey_spdadd(struct sock *sk, struct sk_buff *skb, const struct sadb_ | |||
2201 | XFRM_POLICY_BLOCK : XFRM_POLICY_ALLOW); | 2201 | XFRM_POLICY_BLOCK : XFRM_POLICY_ALLOW); |
2202 | xp->priority = pol->sadb_x_policy_priority; | 2202 | xp->priority = pol->sadb_x_policy_priority; |
2203 | 2203 | ||
2204 | sa = ext_hdrs[SADB_EXT_ADDRESS_SRC-1], | 2204 | sa = ext_hdrs[SADB_EXT_ADDRESS_SRC-1]; |
2205 | xp->family = pfkey_sadb_addr2xfrm_addr(sa, &xp->selector.saddr); | 2205 | xp->family = pfkey_sadb_addr2xfrm_addr(sa, &xp->selector.saddr); |
2206 | if (!xp->family) { | 2206 | if (!xp->family) { |
2207 | err = -EINVAL; | 2207 | err = -EINVAL; |
@@ -2214,7 +2214,7 @@ static int pfkey_spdadd(struct sock *sk, struct sk_buff *skb, const struct sadb_ | |||
2214 | if (xp->selector.sport) | 2214 | if (xp->selector.sport) |
2215 | xp->selector.sport_mask = htons(0xffff); | 2215 | xp->selector.sport_mask = htons(0xffff); |
2216 | 2216 | ||
2217 | sa = ext_hdrs[SADB_EXT_ADDRESS_DST-1], | 2217 | sa = ext_hdrs[SADB_EXT_ADDRESS_DST-1]; |
2218 | pfkey_sadb_addr2xfrm_addr(sa, &xp->selector.daddr); | 2218 | pfkey_sadb_addr2xfrm_addr(sa, &xp->selector.daddr); |
2219 | xp->selector.prefixlen_d = sa->sadb_address_prefixlen; | 2219 | xp->selector.prefixlen_d = sa->sadb_address_prefixlen; |
2220 | 2220 | ||
@@ -2315,7 +2315,7 @@ static int pfkey_spddelete(struct sock *sk, struct sk_buff *skb, const struct sa | |||
2315 | 2315 | ||
2316 | memset(&sel, 0, sizeof(sel)); | 2316 | memset(&sel, 0, sizeof(sel)); |
2317 | 2317 | ||
2318 | sa = ext_hdrs[SADB_EXT_ADDRESS_SRC-1], | 2318 | sa = ext_hdrs[SADB_EXT_ADDRESS_SRC-1]; |
2319 | sel.family = pfkey_sadb_addr2xfrm_addr(sa, &sel.saddr); | 2319 | sel.family = pfkey_sadb_addr2xfrm_addr(sa, &sel.saddr); |
2320 | sel.prefixlen_s = sa->sadb_address_prefixlen; | 2320 | sel.prefixlen_s = sa->sadb_address_prefixlen; |
2321 | sel.proto = pfkey_proto_to_xfrm(sa->sadb_address_proto); | 2321 | sel.proto = pfkey_proto_to_xfrm(sa->sadb_address_proto); |
@@ -2323,7 +2323,7 @@ static int pfkey_spddelete(struct sock *sk, struct sk_buff *skb, const struct sa | |||
2323 | if (sel.sport) | 2323 | if (sel.sport) |
2324 | sel.sport_mask = htons(0xffff); | 2324 | sel.sport_mask = htons(0xffff); |
2325 | 2325 | ||
2326 | sa = ext_hdrs[SADB_EXT_ADDRESS_DST-1], | 2326 | sa = ext_hdrs[SADB_EXT_ADDRESS_DST-1]; |
2327 | pfkey_sadb_addr2xfrm_addr(sa, &sel.daddr); | 2327 | pfkey_sadb_addr2xfrm_addr(sa, &sel.daddr); |
2328 | sel.prefixlen_d = sa->sadb_address_prefixlen; | 2328 | sel.prefixlen_d = sa->sadb_address_prefixlen; |
2329 | sel.proto = pfkey_proto_to_xfrm(sa->sadb_address_proto); | 2329 | sel.proto = pfkey_proto_to_xfrm(sa->sadb_address_proto); |
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c index 808f5fcd1ced..fb306814576a 100644 --- a/net/mac80211/cfg.c +++ b/net/mac80211/cfg.c | |||
@@ -3290,14 +3290,19 @@ static int ieee80211_cfg_get_channel(struct wiphy *wiphy, | |||
3290 | int ret = -ENODATA; | 3290 | int ret = -ENODATA; |
3291 | 3291 | ||
3292 | rcu_read_lock(); | 3292 | rcu_read_lock(); |
3293 | if (local->use_chanctx) { | 3293 | chanctx_conf = rcu_dereference(sdata->vif.chanctx_conf); |
3294 | chanctx_conf = rcu_dereference(sdata->vif.chanctx_conf); | 3294 | if (chanctx_conf) { |
3295 | if (chanctx_conf) { | 3295 | *chandef = chanctx_conf->def; |
3296 | *chandef = chanctx_conf->def; | 3296 | ret = 0; |
3297 | ret = 0; | 3297 | } else if (local->open_count > 0 && |
3298 | } | 3298 | local->open_count == local->monitors && |
3299 | } else if (local->open_count == local->monitors) { | 3299 | sdata->vif.type == NL80211_IFTYPE_MONITOR) { |
3300 | *chandef = local->monitor_chandef; | 3300 | if (local->use_chanctx) |
3301 | *chandef = local->monitor_chandef; | ||
3302 | else | ||
3303 | cfg80211_chandef_create(chandef, | ||
3304 | local->_oper_channel, | ||
3305 | local->_oper_channel_type); | ||
3301 | ret = 0; | 3306 | ret = 0; |
3302 | } | 3307 | } |
3303 | rcu_read_unlock(); | 3308 | rcu_read_unlock(); |
diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c index 640afab304d7..baaa8608e52d 100644 --- a/net/mac80211/iface.c +++ b/net/mac80211/iface.c | |||
@@ -541,6 +541,9 @@ int ieee80211_do_open(struct wireless_dev *wdev, bool coming_up) | |||
541 | 541 | ||
542 | ieee80211_adjust_monitor_flags(sdata, 1); | 542 | ieee80211_adjust_monitor_flags(sdata, 1); |
543 | ieee80211_configure_filter(local); | 543 | ieee80211_configure_filter(local); |
544 | mutex_lock(&local->mtx); | ||
545 | ieee80211_recalc_idle(local); | ||
546 | mutex_unlock(&local->mtx); | ||
544 | 547 | ||
545 | netif_carrier_on(dev); | 548 | netif_carrier_on(dev); |
546 | break; | 549 | break; |
@@ -812,6 +815,9 @@ static void ieee80211_do_stop(struct ieee80211_sub_if_data *sdata, | |||
812 | 815 | ||
813 | ieee80211_adjust_monitor_flags(sdata, -1); | 816 | ieee80211_adjust_monitor_flags(sdata, -1); |
814 | ieee80211_configure_filter(local); | 817 | ieee80211_configure_filter(local); |
818 | mutex_lock(&local->mtx); | ||
819 | ieee80211_recalc_idle(local); | ||
820 | mutex_unlock(&local->mtx); | ||
815 | break; | 821 | break; |
816 | case NL80211_IFTYPE_P2P_DEVICE: | 822 | case NL80211_IFTYPE_P2P_DEVICE: |
817 | /* relies on synchronize_rcu() below */ | 823 | /* relies on synchronize_rcu() below */ |
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c index 9f6464f3e05f..141577412d84 100644 --- a/net/mac80211/mlme.c +++ b/net/mac80211/mlme.c | |||
@@ -647,6 +647,9 @@ static void ieee80211_add_vht_ie(struct ieee80211_sub_if_data *sdata, | |||
647 | our_mcs = (le16_to_cpu(vht_cap.vht_mcs.rx_mcs_map) & | 647 | our_mcs = (le16_to_cpu(vht_cap.vht_mcs.rx_mcs_map) & |
648 | mask) >> shift; | 648 | mask) >> shift; |
649 | 649 | ||
650 | if (our_mcs == IEEE80211_VHT_MCS_NOT_SUPPORTED) | ||
651 | continue; | ||
652 | |||
650 | switch (ap_mcs) { | 653 | switch (ap_mcs) { |
651 | default: | 654 | default: |
652 | if (our_mcs <= ap_mcs) | 655 | if (our_mcs <= ap_mcs) |
@@ -3503,6 +3506,14 @@ void ieee80211_sta_quiesce(struct ieee80211_sub_if_data *sdata) | |||
3503 | struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; | 3506 | struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; |
3504 | 3507 | ||
3505 | /* | 3508 | /* |
3509 | * Stop timers before deleting work items, as timers | ||
3510 | * could race and re-add the work-items. They will be | ||
3511 | * re-established on connection. | ||
3512 | */ | ||
3513 | del_timer_sync(&ifmgd->conn_mon_timer); | ||
3514 | del_timer_sync(&ifmgd->bcn_mon_timer); | ||
3515 | |||
3516 | /* | ||
3506 | * we need to use atomic bitops for the running bits | 3517 | * we need to use atomic bitops for the running bits |
3507 | * only because both timers might fire at the same | 3518 | * only because both timers might fire at the same |
3508 | * time -- the code here is properly synchronised. | 3519 | * time -- the code here is properly synchronised. |
@@ -3516,13 +3527,9 @@ void ieee80211_sta_quiesce(struct ieee80211_sub_if_data *sdata) | |||
3516 | if (del_timer_sync(&ifmgd->timer)) | 3527 | if (del_timer_sync(&ifmgd->timer)) |
3517 | set_bit(TMR_RUNNING_TIMER, &ifmgd->timers_running); | 3528 | set_bit(TMR_RUNNING_TIMER, &ifmgd->timers_running); |
3518 | 3529 | ||
3519 | cancel_work_sync(&ifmgd->chswitch_work); | ||
3520 | if (del_timer_sync(&ifmgd->chswitch_timer)) | 3530 | if (del_timer_sync(&ifmgd->chswitch_timer)) |
3521 | set_bit(TMR_RUNNING_CHANSW, &ifmgd->timers_running); | 3531 | set_bit(TMR_RUNNING_CHANSW, &ifmgd->timers_running); |
3522 | 3532 | cancel_work_sync(&ifmgd->chswitch_work); | |
3523 | /* these will just be re-established on connection */ | ||
3524 | del_timer_sync(&ifmgd->conn_mon_timer); | ||
3525 | del_timer_sync(&ifmgd->bcn_mon_timer); | ||
3526 | } | 3533 | } |
3527 | 3534 | ||
3528 | void ieee80211_sta_restart(struct ieee80211_sub_if_data *sdata) | 3535 | void ieee80211_sta_restart(struct ieee80211_sub_if_data *sdata) |
@@ -4315,6 +4322,17 @@ void ieee80211_mgd_stop(struct ieee80211_sub_if_data *sdata) | |||
4315 | { | 4322 | { |
4316 | struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; | 4323 | struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; |
4317 | 4324 | ||
4325 | /* | ||
4326 | * Make sure some work items will not run after this, | ||
4327 | * they will not do anything but might not have been | ||
4328 | * cancelled when disconnecting. | ||
4329 | */ | ||
4330 | cancel_work_sync(&ifmgd->monitor_work); | ||
4331 | cancel_work_sync(&ifmgd->beacon_connection_loss_work); | ||
4332 | cancel_work_sync(&ifmgd->request_smps_work); | ||
4333 | cancel_work_sync(&ifmgd->csa_connection_drop_work); | ||
4334 | cancel_work_sync(&ifmgd->chswitch_work); | ||
4335 | |||
4318 | mutex_lock(&ifmgd->mtx); | 4336 | mutex_lock(&ifmgd->mtx); |
4319 | if (ifmgd->assoc_data) | 4337 | if (ifmgd->assoc_data) |
4320 | ieee80211_destroy_assoc_data(sdata, false); | 4338 | ieee80211_destroy_assoc_data(sdata, false); |
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c index ce78d1149f1d..8914d2d2881a 100644 --- a/net/mac80211/tx.c +++ b/net/mac80211/tx.c | |||
@@ -2745,7 +2745,8 @@ ieee80211_get_buffered_bc(struct ieee80211_hw *hw, | |||
2745 | cpu_to_le16(IEEE80211_FCTL_MOREDATA); | 2745 | cpu_to_le16(IEEE80211_FCTL_MOREDATA); |
2746 | } | 2746 | } |
2747 | 2747 | ||
2748 | sdata = IEEE80211_DEV_TO_SUB_IF(skb->dev); | 2748 | if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN) |
2749 | sdata = IEEE80211_DEV_TO_SUB_IF(skb->dev); | ||
2749 | if (!ieee80211_tx_prepare(sdata, &tx, skb)) | 2750 | if (!ieee80211_tx_prepare(sdata, &tx, skb)) |
2750 | break; | 2751 | break; |
2751 | dev_kfree_skb_any(skb); | 2752 | dev_kfree_skb_any(skb); |
diff --git a/net/netfilter/nf_conntrack_helper.c b/net/netfilter/nf_conntrack_helper.c index a9740bd6fe54..94b4b9853f60 100644 --- a/net/netfilter/nf_conntrack_helper.c +++ b/net/netfilter/nf_conntrack_helper.c | |||
@@ -339,6 +339,13 @@ void nf_ct_helper_log(struct sk_buff *skb, const struct nf_conn *ct, | |||
339 | { | 339 | { |
340 | const struct nf_conn_help *help; | 340 | const struct nf_conn_help *help; |
341 | const struct nf_conntrack_helper *helper; | 341 | const struct nf_conntrack_helper *helper; |
342 | struct va_format vaf; | ||
343 | va_list args; | ||
344 | |||
345 | va_start(args, fmt); | ||
346 | |||
347 | vaf.fmt = fmt; | ||
348 | vaf.va = &args; | ||
342 | 349 | ||
343 | /* Called from the helper function, this call never fails */ | 350 | /* Called from the helper function, this call never fails */ |
344 | help = nfct_help(ct); | 351 | help = nfct_help(ct); |
@@ -347,7 +354,9 @@ void nf_ct_helper_log(struct sk_buff *skb, const struct nf_conn *ct, | |||
347 | helper = rcu_dereference(help->helper); | 354 | helper = rcu_dereference(help->helper); |
348 | 355 | ||
349 | nf_log_packet(nf_ct_l3num(ct), 0, skb, NULL, NULL, NULL, | 356 | nf_log_packet(nf_ct_l3num(ct), 0, skb, NULL, NULL, NULL, |
350 | "nf_ct_%s: dropping packet: %s ", helper->name, fmt); | 357 | "nf_ct_%s: dropping packet: %pV ", helper->name, &vaf); |
358 | |||
359 | va_end(args); | ||
351 | } | 360 | } |
352 | EXPORT_SYMBOL_GPL(nf_ct_helper_log); | 361 | EXPORT_SYMBOL_GPL(nf_ct_helper_log); |
353 | 362 | ||
diff --git a/net/netfilter/nfnetlink.c b/net/netfilter/nfnetlink.c index d578ec251712..0b1b32cda307 100644 --- a/net/netfilter/nfnetlink.c +++ b/net/netfilter/nfnetlink.c | |||
@@ -62,11 +62,6 @@ void nfnl_unlock(__u8 subsys_id) | |||
62 | } | 62 | } |
63 | EXPORT_SYMBOL_GPL(nfnl_unlock); | 63 | EXPORT_SYMBOL_GPL(nfnl_unlock); |
64 | 64 | ||
65 | static struct mutex *nfnl_get_lock(__u8 subsys_id) | ||
66 | { | ||
67 | return &table[subsys_id].mutex; | ||
68 | } | ||
69 | |||
70 | int nfnetlink_subsys_register(const struct nfnetlink_subsystem *n) | 65 | int nfnetlink_subsys_register(const struct nfnetlink_subsystem *n) |
71 | { | 66 | { |
72 | nfnl_lock(n->subsys_id); | 67 | nfnl_lock(n->subsys_id); |
@@ -199,7 +194,7 @@ replay: | |||
199 | rcu_read_unlock(); | 194 | rcu_read_unlock(); |
200 | nfnl_lock(subsys_id); | 195 | nfnl_lock(subsys_id); |
201 | if (rcu_dereference_protected(table[subsys_id].subsys, | 196 | if (rcu_dereference_protected(table[subsys_id].subsys, |
202 | lockdep_is_held(nfnl_get_lock(subsys_id))) != ss || | 197 | lockdep_is_held(&table[subsys_id].mutex)) != ss || |
203 | nfnetlink_find_client(type, ss) != nc) | 198 | nfnetlink_find_client(type, ss) != nc) |
204 | err = -EAGAIN; | 199 | err = -EAGAIN; |
205 | else if (nc->call) | 200 | else if (nc->call) |
diff --git a/net/netfilter/xt_AUDIT.c b/net/netfilter/xt_AUDIT.c index ba92824086f3..3228d7f24eb4 100644 --- a/net/netfilter/xt_AUDIT.c +++ b/net/netfilter/xt_AUDIT.c | |||
@@ -124,6 +124,9 @@ audit_tg(struct sk_buff *skb, const struct xt_action_param *par) | |||
124 | const struct xt_audit_info *info = par->targinfo; | 124 | const struct xt_audit_info *info = par->targinfo; |
125 | struct audit_buffer *ab; | 125 | struct audit_buffer *ab; |
126 | 126 | ||
127 | if (audit_enabled == 0) | ||
128 | goto errout; | ||
129 | |||
127 | ab = audit_log_start(NULL, GFP_ATOMIC, AUDIT_NETFILTER_PKT); | 130 | ab = audit_log_start(NULL, GFP_ATOMIC, AUDIT_NETFILTER_PKT); |
128 | if (ab == NULL) | 131 | if (ab == NULL) |
129 | goto errout; | 132 | goto errout; |
diff --git a/net/netlabel/netlabel_unlabeled.c b/net/netlabel/netlabel_unlabeled.c index 847d495cd4de..8a6c6ea466d8 100644 --- a/net/netlabel/netlabel_unlabeled.c +++ b/net/netlabel/netlabel_unlabeled.c | |||
@@ -1189,8 +1189,6 @@ static int netlbl_unlabel_staticlist(struct sk_buff *skb, | |||
1189 | struct netlbl_unlhsh_walk_arg cb_arg; | 1189 | struct netlbl_unlhsh_walk_arg cb_arg; |
1190 | u32 skip_bkt = cb->args[0]; | 1190 | u32 skip_bkt = cb->args[0]; |
1191 | u32 skip_chain = cb->args[1]; | 1191 | u32 skip_chain = cb->args[1]; |
1192 | u32 skip_addr4 = cb->args[2]; | ||
1193 | u32 skip_addr6 = cb->args[3]; | ||
1194 | u32 iter_bkt; | 1192 | u32 iter_bkt; |
1195 | u32 iter_chain = 0, iter_addr4 = 0, iter_addr6 = 0; | 1193 | u32 iter_chain = 0, iter_addr4 = 0, iter_addr6 = 0; |
1196 | struct netlbl_unlhsh_iface *iface; | 1194 | struct netlbl_unlhsh_iface *iface; |
@@ -1215,7 +1213,7 @@ static int netlbl_unlabel_staticlist(struct sk_buff *skb, | |||
1215 | continue; | 1213 | continue; |
1216 | netlbl_af4list_foreach_rcu(addr4, | 1214 | netlbl_af4list_foreach_rcu(addr4, |
1217 | &iface->addr4_list) { | 1215 | &iface->addr4_list) { |
1218 | if (iter_addr4++ < skip_addr4) | 1216 | if (iter_addr4++ < cb->args[2]) |
1219 | continue; | 1217 | continue; |
1220 | if (netlbl_unlabel_staticlist_gen( | 1218 | if (netlbl_unlabel_staticlist_gen( |
1221 | NLBL_UNLABEL_C_STATICLIST, | 1219 | NLBL_UNLABEL_C_STATICLIST, |
@@ -1231,7 +1229,7 @@ static int netlbl_unlabel_staticlist(struct sk_buff *skb, | |||
1231 | #if IS_ENABLED(CONFIG_IPV6) | 1229 | #if IS_ENABLED(CONFIG_IPV6) |
1232 | netlbl_af6list_foreach_rcu(addr6, | 1230 | netlbl_af6list_foreach_rcu(addr6, |
1233 | &iface->addr6_list) { | 1231 | &iface->addr6_list) { |
1234 | if (iter_addr6++ < skip_addr6) | 1232 | if (iter_addr6++ < cb->args[3]) |
1235 | continue; | 1233 | continue; |
1236 | if (netlbl_unlabel_staticlist_gen( | 1234 | if (netlbl_unlabel_staticlist_gen( |
1237 | NLBL_UNLABEL_C_STATICLIST, | 1235 | NLBL_UNLABEL_C_STATICLIST, |
@@ -1250,10 +1248,10 @@ static int netlbl_unlabel_staticlist(struct sk_buff *skb, | |||
1250 | 1248 | ||
1251 | unlabel_staticlist_return: | 1249 | unlabel_staticlist_return: |
1252 | rcu_read_unlock(); | 1250 | rcu_read_unlock(); |
1253 | cb->args[0] = skip_bkt; | 1251 | cb->args[0] = iter_bkt; |
1254 | cb->args[1] = skip_chain; | 1252 | cb->args[1] = iter_chain; |
1255 | cb->args[2] = skip_addr4; | 1253 | cb->args[2] = iter_addr4; |
1256 | cb->args[3] = skip_addr6; | 1254 | cb->args[3] = iter_addr6; |
1257 | return skb->len; | 1255 | return skb->len; |
1258 | } | 1256 | } |
1259 | 1257 | ||
@@ -1273,12 +1271,9 @@ static int netlbl_unlabel_staticlistdef(struct sk_buff *skb, | |||
1273 | { | 1271 | { |
1274 | struct netlbl_unlhsh_walk_arg cb_arg; | 1272 | struct netlbl_unlhsh_walk_arg cb_arg; |
1275 | struct netlbl_unlhsh_iface *iface; | 1273 | struct netlbl_unlhsh_iface *iface; |
1276 | u32 skip_addr4 = cb->args[0]; | 1274 | u32 iter_addr4 = 0, iter_addr6 = 0; |
1277 | u32 skip_addr6 = cb->args[1]; | ||
1278 | u32 iter_addr4 = 0; | ||
1279 | struct netlbl_af4list *addr4; | 1275 | struct netlbl_af4list *addr4; |
1280 | #if IS_ENABLED(CONFIG_IPV6) | 1276 | #if IS_ENABLED(CONFIG_IPV6) |
1281 | u32 iter_addr6 = 0; | ||
1282 | struct netlbl_af6list *addr6; | 1277 | struct netlbl_af6list *addr6; |
1283 | #endif | 1278 | #endif |
1284 | 1279 | ||
@@ -1292,7 +1287,7 @@ static int netlbl_unlabel_staticlistdef(struct sk_buff *skb, | |||
1292 | goto unlabel_staticlistdef_return; | 1287 | goto unlabel_staticlistdef_return; |
1293 | 1288 | ||
1294 | netlbl_af4list_foreach_rcu(addr4, &iface->addr4_list) { | 1289 | netlbl_af4list_foreach_rcu(addr4, &iface->addr4_list) { |
1295 | if (iter_addr4++ < skip_addr4) | 1290 | if (iter_addr4++ < cb->args[0]) |
1296 | continue; | 1291 | continue; |
1297 | if (netlbl_unlabel_staticlist_gen(NLBL_UNLABEL_C_STATICLISTDEF, | 1292 | if (netlbl_unlabel_staticlist_gen(NLBL_UNLABEL_C_STATICLISTDEF, |
1298 | iface, | 1293 | iface, |
@@ -1305,7 +1300,7 @@ static int netlbl_unlabel_staticlistdef(struct sk_buff *skb, | |||
1305 | } | 1300 | } |
1306 | #if IS_ENABLED(CONFIG_IPV6) | 1301 | #if IS_ENABLED(CONFIG_IPV6) |
1307 | netlbl_af6list_foreach_rcu(addr6, &iface->addr6_list) { | 1302 | netlbl_af6list_foreach_rcu(addr6, &iface->addr6_list) { |
1308 | if (iter_addr6++ < skip_addr6) | 1303 | if (iter_addr6++ < cb->args[1]) |
1309 | continue; | 1304 | continue; |
1310 | if (netlbl_unlabel_staticlist_gen(NLBL_UNLABEL_C_STATICLISTDEF, | 1305 | if (netlbl_unlabel_staticlist_gen(NLBL_UNLABEL_C_STATICLISTDEF, |
1311 | iface, | 1306 | iface, |
@@ -1320,8 +1315,8 @@ static int netlbl_unlabel_staticlistdef(struct sk_buff *skb, | |||
1320 | 1315 | ||
1321 | unlabel_staticlistdef_return: | 1316 | unlabel_staticlistdef_return: |
1322 | rcu_read_unlock(); | 1317 | rcu_read_unlock(); |
1323 | cb->args[0] = skip_addr4; | 1318 | cb->args[0] = iter_addr4; |
1324 | cb->args[1] = skip_addr6; | 1319 | cb->args[1] = iter_addr6; |
1325 | return skb->len; | 1320 | return skb->len; |
1326 | } | 1321 | } |
1327 | 1322 | ||
diff --git a/net/nfc/llcp/llcp.c b/net/nfc/llcp/llcp.c index 7f8266dd14cb..b530afadd76c 100644 --- a/net/nfc/llcp/llcp.c +++ b/net/nfc/llcp/llcp.c | |||
@@ -68,7 +68,8 @@ static void nfc_llcp_socket_purge(struct nfc_llcp_sock *sock) | |||
68 | } | 68 | } |
69 | } | 69 | } |
70 | 70 | ||
71 | static void nfc_llcp_socket_release(struct nfc_llcp_local *local, bool listen) | 71 | static void nfc_llcp_socket_release(struct nfc_llcp_local *local, bool listen, |
72 | int err) | ||
72 | { | 73 | { |
73 | struct sock *sk; | 74 | struct sock *sk; |
74 | struct hlist_node *tmp; | 75 | struct hlist_node *tmp; |
@@ -100,7 +101,10 @@ static void nfc_llcp_socket_release(struct nfc_llcp_local *local, bool listen) | |||
100 | 101 | ||
101 | nfc_llcp_accept_unlink(accept_sk); | 102 | nfc_llcp_accept_unlink(accept_sk); |
102 | 103 | ||
104 | if (err) | ||
105 | accept_sk->sk_err = err; | ||
103 | accept_sk->sk_state = LLCP_CLOSED; | 106 | accept_sk->sk_state = LLCP_CLOSED; |
107 | accept_sk->sk_state_change(sk); | ||
104 | 108 | ||
105 | bh_unlock_sock(accept_sk); | 109 | bh_unlock_sock(accept_sk); |
106 | 110 | ||
@@ -123,7 +127,10 @@ static void nfc_llcp_socket_release(struct nfc_llcp_local *local, bool listen) | |||
123 | continue; | 127 | continue; |
124 | } | 128 | } |
125 | 129 | ||
130 | if (err) | ||
131 | sk->sk_err = err; | ||
126 | sk->sk_state = LLCP_CLOSED; | 132 | sk->sk_state = LLCP_CLOSED; |
133 | sk->sk_state_change(sk); | ||
127 | 134 | ||
128 | bh_unlock_sock(sk); | 135 | bh_unlock_sock(sk); |
129 | 136 | ||
@@ -133,6 +140,36 @@ static void nfc_llcp_socket_release(struct nfc_llcp_local *local, bool listen) | |||
133 | } | 140 | } |
134 | 141 | ||
135 | write_unlock(&local->sockets.lock); | 142 | write_unlock(&local->sockets.lock); |
143 | |||
144 | /* | ||
145 | * If we want to keep the listening sockets alive, | ||
146 | * we don't touch the RAW ones. | ||
147 | */ | ||
148 | if (listen == true) | ||
149 | return; | ||
150 | |||
151 | write_lock(&local->raw_sockets.lock); | ||
152 | |||
153 | sk_for_each_safe(sk, tmp, &local->raw_sockets.head) { | ||
154 | llcp_sock = nfc_llcp_sock(sk); | ||
155 | |||
156 | bh_lock_sock(sk); | ||
157 | |||
158 | nfc_llcp_socket_purge(llcp_sock); | ||
159 | |||
160 | if (err) | ||
161 | sk->sk_err = err; | ||
162 | sk->sk_state = LLCP_CLOSED; | ||
163 | sk->sk_state_change(sk); | ||
164 | |||
165 | bh_unlock_sock(sk); | ||
166 | |||
167 | sock_orphan(sk); | ||
168 | |||
169 | sk_del_node_init(sk); | ||
170 | } | ||
171 | |||
172 | write_unlock(&local->raw_sockets.lock); | ||
136 | } | 173 | } |
137 | 174 | ||
138 | struct nfc_llcp_local *nfc_llcp_local_get(struct nfc_llcp_local *local) | 175 | struct nfc_llcp_local *nfc_llcp_local_get(struct nfc_llcp_local *local) |
@@ -142,20 +179,25 @@ struct nfc_llcp_local *nfc_llcp_local_get(struct nfc_llcp_local *local) | |||
142 | return local; | 179 | return local; |
143 | } | 180 | } |
144 | 181 | ||
145 | static void local_release(struct kref *ref) | 182 | static void local_cleanup(struct nfc_llcp_local *local, bool listen) |
146 | { | 183 | { |
147 | struct nfc_llcp_local *local; | 184 | nfc_llcp_socket_release(local, listen, ENXIO); |
148 | |||
149 | local = container_of(ref, struct nfc_llcp_local, ref); | ||
150 | |||
151 | list_del(&local->list); | ||
152 | nfc_llcp_socket_release(local, false); | ||
153 | del_timer_sync(&local->link_timer); | 185 | del_timer_sync(&local->link_timer); |
154 | skb_queue_purge(&local->tx_queue); | 186 | skb_queue_purge(&local->tx_queue); |
155 | cancel_work_sync(&local->tx_work); | 187 | cancel_work_sync(&local->tx_work); |
156 | cancel_work_sync(&local->rx_work); | 188 | cancel_work_sync(&local->rx_work); |
157 | cancel_work_sync(&local->timeout_work); | 189 | cancel_work_sync(&local->timeout_work); |
158 | kfree_skb(local->rx_pending); | 190 | kfree_skb(local->rx_pending); |
191 | } | ||
192 | |||
193 | static void local_release(struct kref *ref) | ||
194 | { | ||
195 | struct nfc_llcp_local *local; | ||
196 | |||
197 | local = container_of(ref, struct nfc_llcp_local, ref); | ||
198 | |||
199 | list_del(&local->list); | ||
200 | local_cleanup(local, false); | ||
159 | kfree(local); | 201 | kfree(local); |
160 | } | 202 | } |
161 | 203 | ||
@@ -1348,7 +1390,7 @@ void nfc_llcp_mac_is_down(struct nfc_dev *dev) | |||
1348 | return; | 1390 | return; |
1349 | 1391 | ||
1350 | /* Close and purge all existing sockets */ | 1392 | /* Close and purge all existing sockets */ |
1351 | nfc_llcp_socket_release(local, true); | 1393 | nfc_llcp_socket_release(local, true, 0); |
1352 | } | 1394 | } |
1353 | 1395 | ||
1354 | void nfc_llcp_mac_is_up(struct nfc_dev *dev, u32 target_idx, | 1396 | void nfc_llcp_mac_is_up(struct nfc_dev *dev, u32 target_idx, |
@@ -1427,6 +1469,8 @@ void nfc_llcp_unregister_device(struct nfc_dev *dev) | |||
1427 | return; | 1469 | return; |
1428 | } | 1470 | } |
1429 | 1471 | ||
1472 | local_cleanup(local, false); | ||
1473 | |||
1430 | nfc_llcp_local_put(local); | 1474 | nfc_llcp_local_put(local); |
1431 | } | 1475 | } |
1432 | 1476 | ||
diff --git a/net/nfc/llcp/sock.c b/net/nfc/llcp/sock.c index 5332751943a9..5c7cdf3f2a83 100644 --- a/net/nfc/llcp/sock.c +++ b/net/nfc/llcp/sock.c | |||
@@ -278,6 +278,8 @@ struct sock *nfc_llcp_accept_dequeue(struct sock *parent, | |||
278 | 278 | ||
279 | pr_debug("Returning sk state %d\n", sk->sk_state); | 279 | pr_debug("Returning sk state %d\n", sk->sk_state); |
280 | 280 | ||
281 | sk_acceptq_removed(parent); | ||
282 | |||
281 | return sk; | 283 | return sk; |
282 | } | 284 | } |
283 | 285 | ||
diff --git a/net/openvswitch/actions.c b/net/openvswitch/actions.c index ac2defeeba83..d4d5363c7ba7 100644 --- a/net/openvswitch/actions.c +++ b/net/openvswitch/actions.c | |||
@@ -58,7 +58,7 @@ static int __pop_vlan_tci(struct sk_buff *skb, __be16 *current_tci) | |||
58 | 58 | ||
59 | if (skb->ip_summed == CHECKSUM_COMPLETE) | 59 | if (skb->ip_summed == CHECKSUM_COMPLETE) |
60 | skb->csum = csum_sub(skb->csum, csum_partial(skb->data | 60 | skb->csum = csum_sub(skb->csum, csum_partial(skb->data |
61 | + ETH_HLEN, VLAN_HLEN, 0)); | 61 | + (2 * ETH_ALEN), VLAN_HLEN, 0)); |
62 | 62 | ||
63 | vhdr = (struct vlan_hdr *)(skb->data + ETH_HLEN); | 63 | vhdr = (struct vlan_hdr *)(skb->data + ETH_HLEN); |
64 | *current_tci = vhdr->h_vlan_TCI; | 64 | *current_tci = vhdr->h_vlan_TCI; |
@@ -115,7 +115,7 @@ static int push_vlan(struct sk_buff *skb, const struct ovs_action_push_vlan *vla | |||
115 | 115 | ||
116 | if (skb->ip_summed == CHECKSUM_COMPLETE) | 116 | if (skb->ip_summed == CHECKSUM_COMPLETE) |
117 | skb->csum = csum_add(skb->csum, csum_partial(skb->data | 117 | skb->csum = csum_add(skb->csum, csum_partial(skb->data |
118 | + ETH_HLEN, VLAN_HLEN, 0)); | 118 | + (2 * ETH_ALEN), VLAN_HLEN, 0)); |
119 | 119 | ||
120 | } | 120 | } |
121 | __vlan_hwaccel_put_tag(skb, ntohs(vlan->vlan_tci) & ~VLAN_TAG_PRESENT); | 121 | __vlan_hwaccel_put_tag(skb, ntohs(vlan->vlan_tci) & ~VLAN_TAG_PRESENT); |
diff --git a/net/openvswitch/datapath.c b/net/openvswitch/datapath.c index e87a26506dba..a4b724708a1a 100644 --- a/net/openvswitch/datapath.c +++ b/net/openvswitch/datapath.c | |||
@@ -394,6 +394,7 @@ static int queue_userspace_packet(struct net *net, int dp_ifindex, | |||
394 | 394 | ||
395 | skb_copy_and_csum_dev(skb, nla_data(nla)); | 395 | skb_copy_and_csum_dev(skb, nla_data(nla)); |
396 | 396 | ||
397 | genlmsg_end(user_skb, upcall); | ||
397 | err = genlmsg_unicast(net, user_skb, upcall_info->portid); | 398 | err = genlmsg_unicast(net, user_skb, upcall_info->portid); |
398 | 399 | ||
399 | out: | 400 | out: |
@@ -1690,6 +1691,7 @@ static int ovs_vport_cmd_new(struct sk_buff *skb, struct genl_info *info) | |||
1690 | if (IS_ERR(vport)) | 1691 | if (IS_ERR(vport)) |
1691 | goto exit_unlock; | 1692 | goto exit_unlock; |
1692 | 1693 | ||
1694 | err = 0; | ||
1693 | reply = ovs_vport_cmd_build_info(vport, info->snd_portid, info->snd_seq, | 1695 | reply = ovs_vport_cmd_build_info(vport, info->snd_portid, info->snd_seq, |
1694 | OVS_VPORT_CMD_NEW); | 1696 | OVS_VPORT_CMD_NEW); |
1695 | if (IS_ERR(reply)) { | 1697 | if (IS_ERR(reply)) { |
@@ -1771,6 +1773,7 @@ static int ovs_vport_cmd_del(struct sk_buff *skb, struct genl_info *info) | |||
1771 | if (IS_ERR(reply)) | 1773 | if (IS_ERR(reply)) |
1772 | goto exit_unlock; | 1774 | goto exit_unlock; |
1773 | 1775 | ||
1776 | err = 0; | ||
1774 | ovs_dp_detach_port(vport); | 1777 | ovs_dp_detach_port(vport); |
1775 | 1778 | ||
1776 | genl_notify(reply, genl_info_net(info), info->snd_portid, | 1779 | genl_notify(reply, genl_info_net(info), info->snd_portid, |
diff --git a/net/openvswitch/flow.c b/net/openvswitch/flow.c index 20605ecf100b..fe0e4215c73d 100644 --- a/net/openvswitch/flow.c +++ b/net/openvswitch/flow.c | |||
@@ -482,7 +482,11 @@ static __be16 parse_ethertype(struct sk_buff *skb) | |||
482 | return htons(ETH_P_802_2); | 482 | return htons(ETH_P_802_2); |
483 | 483 | ||
484 | __skb_pull(skb, sizeof(struct llc_snap_hdr)); | 484 | __skb_pull(skb, sizeof(struct llc_snap_hdr)); |
485 | return llc->ethertype; | 485 | |
486 | if (ntohs(llc->ethertype) >= 1536) | ||
487 | return llc->ethertype; | ||
488 | |||
489 | return htons(ETH_P_802_2); | ||
486 | } | 490 | } |
487 | 491 | ||
488 | static int parse_icmpv6(struct sk_buff *skb, struct sw_flow_key *key, | 492 | static int parse_icmpv6(struct sk_buff *skb, struct sw_flow_key *key, |
diff --git a/net/openvswitch/vport-netdev.c b/net/openvswitch/vport-netdev.c index 670cbc3518de..2130d61c384a 100644 --- a/net/openvswitch/vport-netdev.c +++ b/net/openvswitch/vport-netdev.c | |||
@@ -43,8 +43,7 @@ static void netdev_port_receive(struct vport *vport, struct sk_buff *skb) | |||
43 | 43 | ||
44 | /* Make our own copy of the packet. Otherwise we will mangle the | 44 | /* Make our own copy of the packet. Otherwise we will mangle the |
45 | * packet for anyone who came before us (e.g. tcpdump via AF_PACKET). | 45 | * packet for anyone who came before us (e.g. tcpdump via AF_PACKET). |
46 | * (No one comes after us, since we tell handle_bridge() that we took | 46 | */ |
47 | * the packet.) */ | ||
48 | skb = skb_share_check(skb, GFP_ATOMIC); | 47 | skb = skb_share_check(skb, GFP_ATOMIC); |
49 | if (unlikely(!skb)) | 48 | if (unlikely(!skb)) |
50 | return; | 49 | return; |
diff --git a/net/openvswitch/vport.c b/net/openvswitch/vport.c index ba717cc038b3..f6b8132ce4cb 100644 --- a/net/openvswitch/vport.c +++ b/net/openvswitch/vport.c | |||
@@ -325,8 +325,7 @@ int ovs_vport_get_options(const struct vport *vport, struct sk_buff *skb) | |||
325 | * @skb: skb that was received | 325 | * @skb: skb that was received |
326 | * | 326 | * |
327 | * Must be called with rcu_read_lock. The packet cannot be shared and | 327 | * Must be called with rcu_read_lock. The packet cannot be shared and |
328 | * skb->data should point to the Ethernet header. The caller must have already | 328 | * skb->data should point to the Ethernet header. |
329 | * called compute_ip_summed() to initialize the checksumming fields. | ||
330 | */ | 329 | */ |
331 | void ovs_vport_receive(struct vport *vport, struct sk_buff *skb) | 330 | void ovs_vport_receive(struct vport *vport, struct sk_buff *skb) |
332 | { | 331 | { |
diff --git a/net/rds/stats.c b/net/rds/stats.c index 7be790d60b90..73be187d389e 100644 --- a/net/rds/stats.c +++ b/net/rds/stats.c | |||
@@ -87,6 +87,7 @@ void rds_stats_info_copy(struct rds_info_iterator *iter, | |||
87 | for (i = 0; i < nr; i++) { | 87 | for (i = 0; i < nr; i++) { |
88 | BUG_ON(strlen(names[i]) >= sizeof(ctr.name)); | 88 | BUG_ON(strlen(names[i]) >= sizeof(ctr.name)); |
89 | strncpy(ctr.name, names[i], sizeof(ctr.name) - 1); | 89 | strncpy(ctr.name, names[i], sizeof(ctr.name) - 1); |
90 | ctr.name[sizeof(ctr.name) - 1] = '\0'; | ||
90 | ctr.value = values[i]; | 91 | ctr.value = values[i]; |
91 | 92 | ||
92 | rds_info_copy(iter, &ctr, sizeof(ctr)); | 93 | rds_info_copy(iter, &ctr, sizeof(ctr)); |
diff --git a/net/sched/sch_qfq.c b/net/sched/sch_qfq.c index e9a77f621c3d..d51852bba01c 100644 --- a/net/sched/sch_qfq.c +++ b/net/sched/sch_qfq.c | |||
@@ -298,6 +298,10 @@ static void qfq_update_agg(struct qfq_sched *q, struct qfq_aggregate *agg, | |||
298 | new_num_classes == q->max_agg_classes - 1) /* agg no more full */ | 298 | new_num_classes == q->max_agg_classes - 1) /* agg no more full */ |
299 | hlist_add_head(&agg->nonfull_next, &q->nonfull_aggs); | 299 | hlist_add_head(&agg->nonfull_next, &q->nonfull_aggs); |
300 | 300 | ||
301 | /* The next assignment may let | ||
302 | * agg->initial_budget > agg->budgetmax | ||
303 | * hold, we will take it into account in charge_actual_service(). | ||
304 | */ | ||
301 | agg->budgetmax = new_num_classes * agg->lmax; | 305 | agg->budgetmax = new_num_classes * agg->lmax; |
302 | new_agg_weight = agg->class_weight * new_num_classes; | 306 | new_agg_weight = agg->class_weight * new_num_classes; |
303 | agg->inv_w = ONE_FP/new_agg_weight; | 307 | agg->inv_w = ONE_FP/new_agg_weight; |
@@ -817,7 +821,7 @@ static void qfq_make_eligible(struct qfq_sched *q) | |||
817 | unsigned long old_vslot = q->oldV >> q->min_slot_shift; | 821 | unsigned long old_vslot = q->oldV >> q->min_slot_shift; |
818 | 822 | ||
819 | if (vslot != old_vslot) { | 823 | if (vslot != old_vslot) { |
820 | unsigned long mask = (1UL << fls(vslot ^ old_vslot)) - 1; | 824 | unsigned long mask = (1ULL << fls(vslot ^ old_vslot)) - 1; |
821 | qfq_move_groups(q, mask, IR, ER); | 825 | qfq_move_groups(q, mask, IR, ER); |
822 | qfq_move_groups(q, mask, IB, EB); | 826 | qfq_move_groups(q, mask, IB, EB); |
823 | } | 827 | } |
@@ -988,12 +992,23 @@ static inline struct sk_buff *qfq_peek_skb(struct qfq_aggregate *agg, | |||
988 | /* Update F according to the actual service received by the aggregate. */ | 992 | /* Update F according to the actual service received by the aggregate. */ |
989 | static inline void charge_actual_service(struct qfq_aggregate *agg) | 993 | static inline void charge_actual_service(struct qfq_aggregate *agg) |
990 | { | 994 | { |
991 | /* compute the service received by the aggregate */ | 995 | /* Compute the service received by the aggregate, taking into |
992 | u32 service_received = agg->initial_budget - agg->budget; | 996 | * account that, after decreasing the number of classes in |
997 | * agg, it may happen that | ||
998 | * agg->initial_budget - agg->budget > agg->bugdetmax | ||
999 | */ | ||
1000 | u32 service_received = min(agg->budgetmax, | ||
1001 | agg->initial_budget - agg->budget); | ||
993 | 1002 | ||
994 | agg->F = agg->S + (u64)service_received * agg->inv_w; | 1003 | agg->F = agg->S + (u64)service_received * agg->inv_w; |
995 | } | 1004 | } |
996 | 1005 | ||
1006 | static inline void qfq_update_agg_ts(struct qfq_sched *q, | ||
1007 | struct qfq_aggregate *agg, | ||
1008 | enum update_reason reason); | ||
1009 | |||
1010 | static void qfq_schedule_agg(struct qfq_sched *q, struct qfq_aggregate *agg); | ||
1011 | |||
997 | static struct sk_buff *qfq_dequeue(struct Qdisc *sch) | 1012 | static struct sk_buff *qfq_dequeue(struct Qdisc *sch) |
998 | { | 1013 | { |
999 | struct qfq_sched *q = qdisc_priv(sch); | 1014 | struct qfq_sched *q = qdisc_priv(sch); |
@@ -1021,7 +1036,7 @@ static struct sk_buff *qfq_dequeue(struct Qdisc *sch) | |||
1021 | in_serv_agg->initial_budget = in_serv_agg->budget = | 1036 | in_serv_agg->initial_budget = in_serv_agg->budget = |
1022 | in_serv_agg->budgetmax; | 1037 | in_serv_agg->budgetmax; |
1023 | 1038 | ||
1024 | if (!list_empty(&in_serv_agg->active)) | 1039 | if (!list_empty(&in_serv_agg->active)) { |
1025 | /* | 1040 | /* |
1026 | * Still active: reschedule for | 1041 | * Still active: reschedule for |
1027 | * service. Possible optimization: if no other | 1042 | * service. Possible optimization: if no other |
@@ -1032,8 +1047,9 @@ static struct sk_buff *qfq_dequeue(struct Qdisc *sch) | |||
1032 | * handle it, we would need to maintain an | 1047 | * handle it, we would need to maintain an |
1033 | * extra num_active_aggs field. | 1048 | * extra num_active_aggs field. |
1034 | */ | 1049 | */ |
1035 | qfq_activate_agg(q, in_serv_agg, requeue); | 1050 | qfq_update_agg_ts(q, in_serv_agg, requeue); |
1036 | else if (sch->q.qlen == 0) { /* no aggregate to serve */ | 1051 | qfq_schedule_agg(q, in_serv_agg); |
1052 | } else if (sch->q.qlen == 0) { /* no aggregate to serve */ | ||
1037 | q->in_serv_agg = NULL; | 1053 | q->in_serv_agg = NULL; |
1038 | return NULL; | 1054 | return NULL; |
1039 | } | 1055 | } |
@@ -1052,7 +1068,15 @@ static struct sk_buff *qfq_dequeue(struct Qdisc *sch) | |||
1052 | qdisc_bstats_update(sch, skb); | 1068 | qdisc_bstats_update(sch, skb); |
1053 | 1069 | ||
1054 | agg_dequeue(in_serv_agg, cl, len); | 1070 | agg_dequeue(in_serv_agg, cl, len); |
1055 | in_serv_agg->budget -= len; | 1071 | /* If lmax is lowered, through qfq_change_class, for a class |
1072 | * owning pending packets with larger size than the new value | ||
1073 | * of lmax, then the following condition may hold. | ||
1074 | */ | ||
1075 | if (unlikely(in_serv_agg->budget < len)) | ||
1076 | in_serv_agg->budget = 0; | ||
1077 | else | ||
1078 | in_serv_agg->budget -= len; | ||
1079 | |||
1056 | q->V += (u64)len * IWSUM; | 1080 | q->V += (u64)len * IWSUM; |
1057 | pr_debug("qfq dequeue: len %u F %lld now %lld\n", | 1081 | pr_debug("qfq dequeue: len %u F %lld now %lld\n", |
1058 | len, (unsigned long long) in_serv_agg->F, | 1082 | len, (unsigned long long) in_serv_agg->F, |
@@ -1217,17 +1241,11 @@ static int qfq_enqueue(struct sk_buff *skb, struct Qdisc *sch) | |||
1217 | cl->deficit = agg->lmax; | 1241 | cl->deficit = agg->lmax; |
1218 | list_add_tail(&cl->alist, &agg->active); | 1242 | list_add_tail(&cl->alist, &agg->active); |
1219 | 1243 | ||
1220 | if (list_first_entry(&agg->active, struct qfq_class, alist) != cl) | 1244 | if (list_first_entry(&agg->active, struct qfq_class, alist) != cl || |
1221 | return err; /* aggregate was not empty, nothing else to do */ | 1245 | q->in_serv_agg == agg) |
1246 | return err; /* non-empty or in service, nothing else to do */ | ||
1222 | 1247 | ||
1223 | /* recharge budget */ | 1248 | qfq_activate_agg(q, agg, enqueue); |
1224 | agg->initial_budget = agg->budget = agg->budgetmax; | ||
1225 | |||
1226 | qfq_update_agg_ts(q, agg, enqueue); | ||
1227 | if (q->in_serv_agg == NULL) | ||
1228 | q->in_serv_agg = agg; | ||
1229 | else if (agg != q->in_serv_agg) | ||
1230 | qfq_schedule_agg(q, agg); | ||
1231 | 1249 | ||
1232 | return err; | 1250 | return err; |
1233 | } | 1251 | } |
@@ -1261,7 +1279,8 @@ static void qfq_schedule_agg(struct qfq_sched *q, struct qfq_aggregate *agg) | |||
1261 | /* group was surely ineligible, remove */ | 1279 | /* group was surely ineligible, remove */ |
1262 | __clear_bit(grp->index, &q->bitmaps[IR]); | 1280 | __clear_bit(grp->index, &q->bitmaps[IR]); |
1263 | __clear_bit(grp->index, &q->bitmaps[IB]); | 1281 | __clear_bit(grp->index, &q->bitmaps[IB]); |
1264 | } else if (!q->bitmaps[ER] && qfq_gt(roundedS, q->V)) | 1282 | } else if (!q->bitmaps[ER] && qfq_gt(roundedS, q->V) && |
1283 | q->in_serv_agg == NULL) | ||
1265 | q->V = roundedS; | 1284 | q->V = roundedS; |
1266 | 1285 | ||
1267 | grp->S = roundedS; | 1286 | grp->S = roundedS; |
@@ -1284,8 +1303,15 @@ skip_update: | |||
1284 | static void qfq_activate_agg(struct qfq_sched *q, struct qfq_aggregate *agg, | 1303 | static void qfq_activate_agg(struct qfq_sched *q, struct qfq_aggregate *agg, |
1285 | enum update_reason reason) | 1304 | enum update_reason reason) |
1286 | { | 1305 | { |
1306 | agg->initial_budget = agg->budget = agg->budgetmax; /* recharge budg. */ | ||
1307 | |||
1287 | qfq_update_agg_ts(q, agg, reason); | 1308 | qfq_update_agg_ts(q, agg, reason); |
1288 | qfq_schedule_agg(q, agg); | 1309 | if (q->in_serv_agg == NULL) { /* no aggr. in service or scheduled */ |
1310 | q->in_serv_agg = agg; /* start serving this aggregate */ | ||
1311 | /* update V: to be in service, agg must be eligible */ | ||
1312 | q->oldV = q->V = agg->S; | ||
1313 | } else if (agg != q->in_serv_agg) | ||
1314 | qfq_schedule_agg(q, agg); | ||
1289 | } | 1315 | } |
1290 | 1316 | ||
1291 | static void qfq_slot_remove(struct qfq_sched *q, struct qfq_group *grp, | 1317 | static void qfq_slot_remove(struct qfq_sched *q, struct qfq_group *grp, |
@@ -1357,8 +1383,6 @@ static void qfq_deactivate_agg(struct qfq_sched *q, struct qfq_aggregate *agg) | |||
1357 | __set_bit(grp->index, &q->bitmaps[s]); | 1383 | __set_bit(grp->index, &q->bitmaps[s]); |
1358 | } | 1384 | } |
1359 | } | 1385 | } |
1360 | |||
1361 | qfq_update_eligible(q); | ||
1362 | } | 1386 | } |
1363 | 1387 | ||
1364 | static void qfq_qlen_notify(struct Qdisc *sch, unsigned long arg) | 1388 | static void qfq_qlen_notify(struct Qdisc *sch, unsigned long arg) |
diff --git a/net/sctp/associola.c b/net/sctp/associola.c index 43cd0dd9149d..d2709e2b7be6 100644 --- a/net/sctp/associola.c +++ b/net/sctp/associola.c | |||
@@ -1079,7 +1079,7 @@ struct sctp_transport *sctp_assoc_lookup_tsn(struct sctp_association *asoc, | |||
1079 | transports) { | 1079 | transports) { |
1080 | 1080 | ||
1081 | if (transport == active) | 1081 | if (transport == active) |
1082 | break; | 1082 | continue; |
1083 | list_for_each_entry(chunk, &transport->transmitted, | 1083 | list_for_each_entry(chunk, &transport->transmitted, |
1084 | transmitted_list) { | 1084 | transmitted_list) { |
1085 | if (key == chunk->subh.data_hdr->tsn) { | 1085 | if (key == chunk->subh.data_hdr->tsn) { |
diff --git a/net/sctp/sm_statefuns.c b/net/sctp/sm_statefuns.c index 5131fcfedb03..de1a0138317f 100644 --- a/net/sctp/sm_statefuns.c +++ b/net/sctp/sm_statefuns.c | |||
@@ -2082,7 +2082,7 @@ sctp_disposition_t sctp_sf_do_5_2_4_dupcook(struct net *net, | |||
2082 | } | 2082 | } |
2083 | 2083 | ||
2084 | /* Delete the tempory new association. */ | 2084 | /* Delete the tempory new association. */ |
2085 | sctp_add_cmd_sf(commands, SCTP_CMD_NEW_ASOC, SCTP_ASOC(new_asoc)); | 2085 | sctp_add_cmd_sf(commands, SCTP_CMD_SET_ASOC, SCTP_ASOC(new_asoc)); |
2086 | sctp_add_cmd_sf(commands, SCTP_CMD_DELETE_TCB, SCTP_NULL()); | 2086 | sctp_add_cmd_sf(commands, SCTP_CMD_DELETE_TCB, SCTP_NULL()); |
2087 | 2087 | ||
2088 | /* Restore association pointer to provide SCTP command interpeter | 2088 | /* Restore association pointer to provide SCTP command interpeter |
diff --git a/net/sunrpc/auth_gss/svcauth_gss.c b/net/sunrpc/auth_gss/svcauth_gss.c index f7d34e7b6f81..5ead60550895 100644 --- a/net/sunrpc/auth_gss/svcauth_gss.c +++ b/net/sunrpc/auth_gss/svcauth_gss.c | |||
@@ -447,17 +447,21 @@ static int rsc_parse(struct cache_detail *cd, | |||
447 | else { | 447 | else { |
448 | int N, i; | 448 | int N, i; |
449 | 449 | ||
450 | /* | ||
451 | * NOTE: we skip uid_valid()/gid_valid() checks here: | ||
452 | * instead, * -1 id's are later mapped to the | ||
453 | * (export-specific) anonymous id by nfsd_setuser. | ||
454 | * | ||
455 | * (But supplementary gid's get no such special | ||
456 | * treatment so are checked for validity here.) | ||
457 | */ | ||
450 | /* uid */ | 458 | /* uid */ |
451 | rsci.cred.cr_uid = make_kuid(&init_user_ns, id); | 459 | rsci.cred.cr_uid = make_kuid(&init_user_ns, id); |
452 | if (!uid_valid(rsci.cred.cr_uid)) | ||
453 | goto out; | ||
454 | 460 | ||
455 | /* gid */ | 461 | /* gid */ |
456 | if (get_int(&mesg, &id)) | 462 | if (get_int(&mesg, &id)) |
457 | goto out; | 463 | goto out; |
458 | rsci.cred.cr_gid = make_kgid(&init_user_ns, id); | 464 | rsci.cred.cr_gid = make_kgid(&init_user_ns, id); |
459 | if (!gid_valid(rsci.cred.cr_gid)) | ||
460 | goto out; | ||
461 | 465 | ||
462 | /* number of additional gid's */ | 466 | /* number of additional gid's */ |
463 | if (get_int(&mesg, &N)) | 467 | if (get_int(&mesg, &N)) |
diff --git a/net/sunrpc/rpc_pipe.c b/net/sunrpc/rpc_pipe.c index a0f48a51e14e..a9129f8d7070 100644 --- a/net/sunrpc/rpc_pipe.c +++ b/net/sunrpc/rpc_pipe.c | |||
@@ -1175,6 +1175,7 @@ static struct file_system_type rpc_pipe_fs_type = { | |||
1175 | .kill_sb = rpc_kill_sb, | 1175 | .kill_sb = rpc_kill_sb, |
1176 | }; | 1176 | }; |
1177 | MODULE_ALIAS_FS("rpc_pipefs"); | 1177 | MODULE_ALIAS_FS("rpc_pipefs"); |
1178 | MODULE_ALIAS("rpc_pipefs"); | ||
1178 | 1179 | ||
1179 | static void | 1180 | static void |
1180 | init_once(void *foo) | 1181 | init_once(void *foo) |
diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c index c1d8476b7692..3d02130828da 100644 --- a/net/sunrpc/xprtsock.c +++ b/net/sunrpc/xprtsock.c | |||
@@ -849,6 +849,14 @@ static void xs_tcp_close(struct rpc_xprt *xprt) | |||
849 | xs_tcp_shutdown(xprt); | 849 | xs_tcp_shutdown(xprt); |
850 | } | 850 | } |
851 | 851 | ||
852 | static void xs_local_destroy(struct rpc_xprt *xprt) | ||
853 | { | ||
854 | xs_close(xprt); | ||
855 | xs_free_peer_addresses(xprt); | ||
856 | xprt_free(xprt); | ||
857 | module_put(THIS_MODULE); | ||
858 | } | ||
859 | |||
852 | /** | 860 | /** |
853 | * xs_destroy - prepare to shutdown a transport | 861 | * xs_destroy - prepare to shutdown a transport |
854 | * @xprt: doomed transport | 862 | * @xprt: doomed transport |
@@ -862,10 +870,7 @@ static void xs_destroy(struct rpc_xprt *xprt) | |||
862 | 870 | ||
863 | cancel_delayed_work_sync(&transport->connect_worker); | 871 | cancel_delayed_work_sync(&transport->connect_worker); |
864 | 872 | ||
865 | xs_close(xprt); | 873 | xs_local_destroy(xprt); |
866 | xs_free_peer_addresses(xprt); | ||
867 | xprt_free(xprt); | ||
868 | module_put(THIS_MODULE); | ||
869 | } | 874 | } |
870 | 875 | ||
871 | static inline struct rpc_xprt *xprt_from_sock(struct sock *sk) | 876 | static inline struct rpc_xprt *xprt_from_sock(struct sock *sk) |
@@ -2482,7 +2487,7 @@ static struct rpc_xprt_ops xs_local_ops = { | |||
2482 | .send_request = xs_local_send_request, | 2487 | .send_request = xs_local_send_request, |
2483 | .set_retrans_timeout = xprt_set_retrans_timeout_def, | 2488 | .set_retrans_timeout = xprt_set_retrans_timeout_def, |
2484 | .close = xs_close, | 2489 | .close = xs_close, |
2485 | .destroy = xs_destroy, | 2490 | .destroy = xs_local_destroy, |
2486 | .print_stats = xs_local_print_stats, | 2491 | .print_stats = xs_local_print_stats, |
2487 | }; | 2492 | }; |
2488 | 2493 | ||
diff --git a/net/wireless/core.c b/net/wireless/core.c index 5ffff039b017..ea4155fe9733 100644 --- a/net/wireless/core.c +++ b/net/wireless/core.c | |||
@@ -367,8 +367,7 @@ struct wiphy *wiphy_new(const struct cfg80211_ops *ops, int sizeof_priv) | |||
367 | rdev->wiphy.rts_threshold = (u32) -1; | 367 | rdev->wiphy.rts_threshold = (u32) -1; |
368 | rdev->wiphy.coverage_class = 0; | 368 | rdev->wiphy.coverage_class = 0; |
369 | 369 | ||
370 | rdev->wiphy.features = NL80211_FEATURE_SCAN_FLUSH | | 370 | rdev->wiphy.features = NL80211_FEATURE_SCAN_FLUSH; |
371 | NL80211_FEATURE_ADVERTISE_CHAN_LIMITS; | ||
372 | 371 | ||
373 | return &rdev->wiphy; | 372 | return &rdev->wiphy; |
374 | } | 373 | } |
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index e652d05ff712..d44ab216c0ec 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c | |||
@@ -557,18 +557,6 @@ static int nl80211_msg_put_channel(struct sk_buff *msg, | |||
557 | if ((chan->flags & IEEE80211_CHAN_RADAR) && | 557 | if ((chan->flags & IEEE80211_CHAN_RADAR) && |
558 | nla_put_flag(msg, NL80211_FREQUENCY_ATTR_RADAR)) | 558 | nla_put_flag(msg, NL80211_FREQUENCY_ATTR_RADAR)) |
559 | goto nla_put_failure; | 559 | goto nla_put_failure; |
560 | if ((chan->flags & IEEE80211_CHAN_NO_HT40MINUS) && | ||
561 | nla_put_flag(msg, NL80211_FREQUENCY_ATTR_NO_HT40_MINUS)) | ||
562 | goto nla_put_failure; | ||
563 | if ((chan->flags & IEEE80211_CHAN_NO_HT40PLUS) && | ||
564 | nla_put_flag(msg, NL80211_FREQUENCY_ATTR_NO_HT40_PLUS)) | ||
565 | goto nla_put_failure; | ||
566 | if ((chan->flags & IEEE80211_CHAN_NO_80MHZ) && | ||
567 | nla_put_flag(msg, NL80211_FREQUENCY_ATTR_NO_80MHZ)) | ||
568 | goto nla_put_failure; | ||
569 | if ((chan->flags & IEEE80211_CHAN_NO_160MHZ) && | ||
570 | nla_put_flag(msg, NL80211_FREQUENCY_ATTR_NO_160MHZ)) | ||
571 | goto nla_put_failure; | ||
572 | 560 | ||
573 | if (nla_put_u32(msg, NL80211_FREQUENCY_ATTR_MAX_TX_POWER, | 561 | if (nla_put_u32(msg, NL80211_FREQUENCY_ATTR_MAX_TX_POWER, |
574 | DBM_TO_MBM(chan->max_power))) | 562 | DBM_TO_MBM(chan->max_power))) |
@@ -1310,15 +1298,6 @@ static int nl80211_send_wiphy(struct sk_buff *msg, u32 portid, u32 seq, int flag | |||
1310 | dev->wiphy.max_acl_mac_addrs)) | 1298 | dev->wiphy.max_acl_mac_addrs)) |
1311 | goto nla_put_failure; | 1299 | goto nla_put_failure; |
1312 | 1300 | ||
1313 | if (dev->wiphy.extended_capabilities && | ||
1314 | (nla_put(msg, NL80211_ATTR_EXT_CAPA, | ||
1315 | dev->wiphy.extended_capabilities_len, | ||
1316 | dev->wiphy.extended_capabilities) || | ||
1317 | nla_put(msg, NL80211_ATTR_EXT_CAPA_MASK, | ||
1318 | dev->wiphy.extended_capabilities_len, | ||
1319 | dev->wiphy.extended_capabilities_mask))) | ||
1320 | goto nla_put_failure; | ||
1321 | |||
1322 | return genlmsg_end(msg, hdr); | 1301 | return genlmsg_end(msg, hdr); |
1323 | 1302 | ||
1324 | nla_put_failure: | 1303 | nla_put_failure: |
@@ -1328,7 +1307,7 @@ static int nl80211_send_wiphy(struct sk_buff *msg, u32 portid, u32 seq, int flag | |||
1328 | 1307 | ||
1329 | static int nl80211_dump_wiphy(struct sk_buff *skb, struct netlink_callback *cb) | 1308 | static int nl80211_dump_wiphy(struct sk_buff *skb, struct netlink_callback *cb) |
1330 | { | 1309 | { |
1331 | int idx = 0; | 1310 | int idx = 0, ret; |
1332 | int start = cb->args[0]; | 1311 | int start = cb->args[0]; |
1333 | struct cfg80211_registered_device *dev; | 1312 | struct cfg80211_registered_device *dev; |
1334 | 1313 | ||
@@ -1338,9 +1317,29 @@ static int nl80211_dump_wiphy(struct sk_buff *skb, struct netlink_callback *cb) | |||
1338 | continue; | 1317 | continue; |
1339 | if (++idx <= start) | 1318 | if (++idx <= start) |
1340 | continue; | 1319 | continue; |
1341 | if (nl80211_send_wiphy(skb, NETLINK_CB(cb->skb).portid, | 1320 | ret = nl80211_send_wiphy(skb, NETLINK_CB(cb->skb).portid, |
1342 | cb->nlh->nlmsg_seq, NLM_F_MULTI, | 1321 | cb->nlh->nlmsg_seq, NLM_F_MULTI, |
1343 | dev) < 0) { | 1322 | dev); |
1323 | if (ret < 0) { | ||
1324 | /* | ||
1325 | * If sending the wiphy data didn't fit (ENOBUFS or | ||
1326 | * EMSGSIZE returned), this SKB is still empty (so | ||
1327 | * it's not too big because another wiphy dataset is | ||
1328 | * already in the skb) and we've not tried to adjust | ||
1329 | * the dump allocation yet ... then adjust the alloc | ||
1330 | * size to be bigger, and return 1 but with the empty | ||
1331 | * skb. This results in an empty message being RX'ed | ||
1332 | * in userspace, but that is ignored. | ||
1333 | * | ||
1334 | * We can then retry with the larger buffer. | ||
1335 | */ | ||
1336 | if ((ret == -ENOBUFS || ret == -EMSGSIZE) && | ||
1337 | !skb->len && | ||
1338 | cb->min_dump_alloc < 4096) { | ||
1339 | cb->min_dump_alloc = 4096; | ||
1340 | mutex_unlock(&cfg80211_mutex); | ||
1341 | return 1; | ||
1342 | } | ||
1344 | idx--; | 1343 | idx--; |
1345 | break; | 1344 | break; |
1346 | } | 1345 | } |
@@ -1357,7 +1356,7 @@ static int nl80211_get_wiphy(struct sk_buff *skb, struct genl_info *info) | |||
1357 | struct sk_buff *msg; | 1356 | struct sk_buff *msg; |
1358 | struct cfg80211_registered_device *dev = info->user_ptr[0]; | 1357 | struct cfg80211_registered_device *dev = info->user_ptr[0]; |
1359 | 1358 | ||
1360 | msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL); | 1359 | msg = nlmsg_new(4096, GFP_KERNEL); |
1361 | if (!msg) | 1360 | if (!msg) |
1362 | return -ENOMEM; | 1361 | return -ENOMEM; |
1363 | 1362 | ||
diff --git a/scripts/Makefile.headersinst b/scripts/Makefile.headersinst index 25f216a841d5..477d137c0557 100644 --- a/scripts/Makefile.headersinst +++ b/scripts/Makefile.headersinst | |||
@@ -14,7 +14,7 @@ kbuild-file := $(srctree)/$(obj)/Kbuild | |||
14 | include $(kbuild-file) | 14 | include $(kbuild-file) |
15 | 15 | ||
16 | # called may set destination dir (when installing to asm/) | 16 | # called may set destination dir (when installing to asm/) |
17 | _dst := $(or $(destination-y),$(dst),$(obj)) | 17 | _dst := $(if $(destination-y),$(destination-y),$(if $(dst),$(dst),$(obj))) |
18 | 18 | ||
19 | old-kbuild-file := $(srctree)/$(subst uapi/,,$(obj))/Kbuild | 19 | old-kbuild-file := $(srctree)/$(subst uapi/,,$(obj))/Kbuild |
20 | ifneq ($(wildcard $(old-kbuild-file)),) | 20 | ifneq ($(wildcard $(old-kbuild-file)),) |
@@ -48,13 +48,14 @@ all-files := $(header-y) $(genhdr-y) $(wrapper-files) | |||
48 | output-files := $(addprefix $(installdir)/, $(all-files)) | 48 | output-files := $(addprefix $(installdir)/, $(all-files)) |
49 | 49 | ||
50 | input-files := $(foreach hdr, $(header-y), \ | 50 | input-files := $(foreach hdr, $(header-y), \ |
51 | $(or \ | 51 | $(if $(wildcard $(srcdir)/$(hdr)), \ |
52 | $(wildcard $(srcdir)/$(hdr)), \ | 52 | $(wildcard $(srcdir)/$(hdr)), \ |
53 | $(wildcard $(oldsrcdir)/$(hdr)), \ | 53 | $(if $(wildcard $(oldsrcdir)/$(hdr)), \ |
54 | $(error Missing UAPI file $(srcdir)/$(hdr)) \ | 54 | $(wildcard $(oldsrcdir)/$(hdr)), \ |
55 | $(error Missing UAPI file $(srcdir)/$(hdr))) \ | ||
55 | )) \ | 56 | )) \ |
56 | $(foreach hdr, $(genhdr-y), \ | 57 | $(foreach hdr, $(genhdr-y), \ |
57 | $(or \ | 58 | $(if $(wildcard $(gendir)/$(hdr)), \ |
58 | $(wildcard $(gendir)/$(hdr)), \ | 59 | $(wildcard $(gendir)/$(hdr)), \ |
59 | $(error Missing generated UAPI file $(gendir)/$(hdr)) \ | 60 | $(error Missing generated UAPI file $(gendir)/$(hdr)) \ |
60 | )) | 61 | )) |
diff --git a/security/keys/compat.c b/security/keys/compat.c index 1c261763f479..d65fa7fa29ba 100644 --- a/security/keys/compat.c +++ b/security/keys/compat.c | |||
@@ -40,12 +40,12 @@ static long compat_keyctl_instantiate_key_iov( | |||
40 | ARRAY_SIZE(iovstack), | 40 | ARRAY_SIZE(iovstack), |
41 | iovstack, &iov); | 41 | iovstack, &iov); |
42 | if (ret < 0) | 42 | if (ret < 0) |
43 | return ret; | 43 | goto err; |
44 | if (ret == 0) | 44 | if (ret == 0) |
45 | goto no_payload_free; | 45 | goto no_payload_free; |
46 | 46 | ||
47 | ret = keyctl_instantiate_key_common(id, iov, ioc, ret, ringid); | 47 | ret = keyctl_instantiate_key_common(id, iov, ioc, ret, ringid); |
48 | 48 | err: | |
49 | if (iov != iovstack) | 49 | if (iov != iovstack) |
50 | kfree(iov); | 50 | kfree(iov); |
51 | return ret; | 51 | return ret; |
diff --git a/security/keys/process_keys.c b/security/keys/process_keys.c index a571fad91010..42defae1e161 100644 --- a/security/keys/process_keys.c +++ b/security/keys/process_keys.c | |||
@@ -57,7 +57,7 @@ int install_user_keyrings(void) | |||
57 | 57 | ||
58 | kenter("%p{%u}", user, uid); | 58 | kenter("%p{%u}", user, uid); |
59 | 59 | ||
60 | if (user->uid_keyring) { | 60 | if (user->uid_keyring && user->session_keyring) { |
61 | kleave(" = 0 [exist]"); | 61 | kleave(" = 0 [exist]"); |
62 | return 0; | 62 | return 0; |
63 | } | 63 | } |
diff --git a/security/selinux/xfrm.c b/security/selinux/xfrm.c index 48665ecd1197..8ab295154517 100644 --- a/security/selinux/xfrm.c +++ b/security/selinux/xfrm.c | |||
@@ -310,7 +310,7 @@ int selinux_xfrm_policy_clone(struct xfrm_sec_ctx *old_ctx, | |||
310 | 310 | ||
311 | if (old_ctx) { | 311 | if (old_ctx) { |
312 | new_ctx = kmalloc(sizeof(*old_ctx) + old_ctx->ctx_len, | 312 | new_ctx = kmalloc(sizeof(*old_ctx) + old_ctx->ctx_len, |
313 | GFP_KERNEL); | 313 | GFP_ATOMIC); |
314 | if (!new_ctx) | 314 | if (!new_ctx) |
315 | return -ENOMEM; | 315 | return -ENOMEM; |
316 | 316 | ||
diff --git a/sound/core/seq/seq_timer.c b/sound/core/seq/seq_timer.c index 160b1bd0cd62..24d44b2f61ac 100644 --- a/sound/core/seq/seq_timer.c +++ b/sound/core/seq/seq_timer.c | |||
@@ -290,10 +290,10 @@ int snd_seq_timer_open(struct snd_seq_queue *q) | |||
290 | tid.device = SNDRV_TIMER_GLOBAL_SYSTEM; | 290 | tid.device = SNDRV_TIMER_GLOBAL_SYSTEM; |
291 | err = snd_timer_open(&t, str, &tid, q->queue); | 291 | err = snd_timer_open(&t, str, &tid, q->queue); |
292 | } | 292 | } |
293 | if (err < 0) { | 293 | } |
294 | snd_printk(KERN_ERR "seq fatal error: cannot create timer (%i)\n", err); | 294 | if (err < 0) { |
295 | return err; | 295 | snd_printk(KERN_ERR "seq fatal error: cannot create timer (%i)\n", err); |
296 | } | 296 | return err; |
297 | } | 297 | } |
298 | t->callback = snd_seq_timer_interrupt; | 298 | t->callback = snd_seq_timer_interrupt; |
299 | t->callback_data = q; | 299 | t->callback_data = q; |
diff --git a/sound/oss/sequencer.c b/sound/oss/sequencer.c index 30bcfe470f83..4ff60a6427d9 100644 --- a/sound/oss/sequencer.c +++ b/sound/oss/sequencer.c | |||
@@ -545,6 +545,9 @@ static void seq_chn_common_event(unsigned char *event_rec) | |||
545 | case MIDI_PGM_CHANGE: | 545 | case MIDI_PGM_CHANGE: |
546 | if (seq_mode == SEQ_2) | 546 | if (seq_mode == SEQ_2) |
547 | { | 547 | { |
548 | if (chn > 15) | ||
549 | break; | ||
550 | |||
548 | synth_devs[dev]->chn_info[chn].pgm_num = p1; | 551 | synth_devs[dev]->chn_info[chn].pgm_num = p1; |
549 | if ((int) dev >= num_synths) | 552 | if ((int) dev >= num_synths) |
550 | synth_devs[dev]->set_instr(dev, chn, p1); | 553 | synth_devs[dev]->set_instr(dev, chn, p1); |
@@ -596,6 +599,9 @@ static void seq_chn_common_event(unsigned char *event_rec) | |||
596 | case MIDI_PITCH_BEND: | 599 | case MIDI_PITCH_BEND: |
597 | if (seq_mode == SEQ_2) | 600 | if (seq_mode == SEQ_2) |
598 | { | 601 | { |
602 | if (chn > 15) | ||
603 | break; | ||
604 | |||
599 | synth_devs[dev]->chn_info[chn].bender_value = w14; | 605 | synth_devs[dev]->chn_info[chn].bender_value = w14; |
600 | 606 | ||
601 | if ((int) dev < num_synths) | 607 | if ((int) dev < num_synths) |
diff --git a/sound/pci/asihpi/asihpi.c b/sound/pci/asihpi/asihpi.c index 3536b076b529..0aabfedeecba 100644 --- a/sound/pci/asihpi/asihpi.c +++ b/sound/pci/asihpi/asihpi.c | |||
@@ -2549,7 +2549,7 @@ static int snd_asihpi_sampleclock_add(struct snd_card_asihpi *asihpi, | |||
2549 | 2549 | ||
2550 | static int snd_card_asihpi_mixer_new(struct snd_card_asihpi *asihpi) | 2550 | static int snd_card_asihpi_mixer_new(struct snd_card_asihpi *asihpi) |
2551 | { | 2551 | { |
2552 | struct snd_card *card = asihpi->card; | 2552 | struct snd_card *card; |
2553 | unsigned int idx = 0; | 2553 | unsigned int idx = 0; |
2554 | unsigned int subindex = 0; | 2554 | unsigned int subindex = 0; |
2555 | int err; | 2555 | int err; |
@@ -2557,6 +2557,7 @@ static int snd_card_asihpi_mixer_new(struct snd_card_asihpi *asihpi) | |||
2557 | 2557 | ||
2558 | if (snd_BUG_ON(!asihpi)) | 2558 | if (snd_BUG_ON(!asihpi)) |
2559 | return -EINVAL; | 2559 | return -EINVAL; |
2560 | card = asihpi->card; | ||
2560 | strcpy(card->mixername, "Asihpi Mixer"); | 2561 | strcpy(card->mixername, "Asihpi Mixer"); |
2561 | 2562 | ||
2562 | err = | 2563 | err = |
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c index 97c68dd24ef5..ecdf30eb5879 100644 --- a/sound/pci/hda/hda_codec.c +++ b/sound/pci/hda/hda_codec.c | |||
@@ -494,7 +494,7 @@ static unsigned int get_num_conns(struct hda_codec *codec, hda_nid_t nid) | |||
494 | 494 | ||
495 | int snd_hda_get_num_raw_conns(struct hda_codec *codec, hda_nid_t nid) | 495 | int snd_hda_get_num_raw_conns(struct hda_codec *codec, hda_nid_t nid) |
496 | { | 496 | { |
497 | return get_num_conns(codec, nid) & AC_CLIST_LENGTH; | 497 | return snd_hda_get_raw_connections(codec, nid, NULL, 0); |
498 | } | 498 | } |
499 | 499 | ||
500 | /** | 500 | /** |
@@ -517,9 +517,6 @@ int snd_hda_get_raw_connections(struct hda_codec *codec, hda_nid_t nid, | |||
517 | hda_nid_t prev_nid; | 517 | hda_nid_t prev_nid; |
518 | int null_count = 0; | 518 | int null_count = 0; |
519 | 519 | ||
520 | if (snd_BUG_ON(!conn_list || max_conns <= 0)) | ||
521 | return -EINVAL; | ||
522 | |||
523 | parm = get_num_conns(codec, nid); | 520 | parm = get_num_conns(codec, nid); |
524 | if (!parm) | 521 | if (!parm) |
525 | return 0; | 522 | return 0; |
@@ -545,7 +542,8 @@ int snd_hda_get_raw_connections(struct hda_codec *codec, hda_nid_t nid, | |||
545 | AC_VERB_GET_CONNECT_LIST, 0); | 542 | AC_VERB_GET_CONNECT_LIST, 0); |
546 | if (parm == -1 && codec->bus->rirb_error) | 543 | if (parm == -1 && codec->bus->rirb_error) |
547 | return -EIO; | 544 | return -EIO; |
548 | conn_list[0] = parm & mask; | 545 | if (conn_list) |
546 | conn_list[0] = parm & mask; | ||
549 | return 1; | 547 | return 1; |
550 | } | 548 | } |
551 | 549 | ||
@@ -580,14 +578,20 @@ int snd_hda_get_raw_connections(struct hda_codec *codec, hda_nid_t nid, | |||
580 | continue; | 578 | continue; |
581 | } | 579 | } |
582 | for (n = prev_nid + 1; n <= val; n++) { | 580 | for (n = prev_nid + 1; n <= val; n++) { |
581 | if (conn_list) { | ||
582 | if (conns >= max_conns) | ||
583 | return -ENOSPC; | ||
584 | conn_list[conns] = n; | ||
585 | } | ||
586 | conns++; | ||
587 | } | ||
588 | } else { | ||
589 | if (conn_list) { | ||
583 | if (conns >= max_conns) | 590 | if (conns >= max_conns) |
584 | return -ENOSPC; | 591 | return -ENOSPC; |
585 | conn_list[conns++] = n; | 592 | conn_list[conns] = val; |
586 | } | 593 | } |
587 | } else { | 594 | conns++; |
588 | if (conns >= max_conns) | ||
589 | return -ENOSPC; | ||
590 | conn_list[conns++] = val; | ||
591 | } | 595 | } |
592 | prev_nid = val; | 596 | prev_nid = val; |
593 | } | 597 | } |
@@ -3140,7 +3144,7 @@ static unsigned int convert_to_spdif_status(unsigned short val) | |||
3140 | if (val & AC_DIG1_PROFESSIONAL) | 3144 | if (val & AC_DIG1_PROFESSIONAL) |
3141 | sbits |= IEC958_AES0_PROFESSIONAL; | 3145 | sbits |= IEC958_AES0_PROFESSIONAL; |
3142 | if (sbits & IEC958_AES0_PROFESSIONAL) { | 3146 | if (sbits & IEC958_AES0_PROFESSIONAL) { |
3143 | if (sbits & AC_DIG1_EMPHASIS) | 3147 | if (val & AC_DIG1_EMPHASIS) |
3144 | sbits |= IEC958_AES0_PRO_EMPHASIS_5015; | 3148 | sbits |= IEC958_AES0_PRO_EMPHASIS_5015; |
3145 | } else { | 3149 | } else { |
3146 | if (val & AC_DIG1_EMPHASIS) | 3150 | if (val & AC_DIG1_EMPHASIS) |
diff --git a/sound/pci/hda/hda_generic.c b/sound/pci/hda/hda_generic.c index 78897d05d80f..43c2ea539561 100644 --- a/sound/pci/hda/hda_generic.c +++ b/sound/pci/hda/hda_generic.c | |||
@@ -995,6 +995,8 @@ enum { | |||
995 | BAD_NO_EXTRA_SURR_DAC = 0x101, | 995 | BAD_NO_EXTRA_SURR_DAC = 0x101, |
996 | /* Primary DAC shared with main surrounds */ | 996 | /* Primary DAC shared with main surrounds */ |
997 | BAD_SHARED_SURROUND = 0x100, | 997 | BAD_SHARED_SURROUND = 0x100, |
998 | /* No independent HP possible */ | ||
999 | BAD_NO_INDEP_HP = 0x40, | ||
998 | /* Primary DAC shared with main CLFE */ | 1000 | /* Primary DAC shared with main CLFE */ |
999 | BAD_SHARED_CLFE = 0x10, | 1001 | BAD_SHARED_CLFE = 0x10, |
1000 | /* Primary DAC shared with extra surrounds */ | 1002 | /* Primary DAC shared with extra surrounds */ |
@@ -1392,6 +1394,43 @@ static int check_aamix_out_path(struct hda_codec *codec, int path_idx) | |||
1392 | return snd_hda_get_path_idx(codec, path); | 1394 | return snd_hda_get_path_idx(codec, path); |
1393 | } | 1395 | } |
1394 | 1396 | ||
1397 | /* check whether the independent HP is available with the current config */ | ||
1398 | static bool indep_hp_possible(struct hda_codec *codec) | ||
1399 | { | ||
1400 | struct hda_gen_spec *spec = codec->spec; | ||
1401 | struct auto_pin_cfg *cfg = &spec->autocfg; | ||
1402 | struct nid_path *path; | ||
1403 | int i, idx; | ||
1404 | |||
1405 | if (cfg->line_out_type == AUTO_PIN_HP_OUT) | ||
1406 | idx = spec->out_paths[0]; | ||
1407 | else | ||
1408 | idx = spec->hp_paths[0]; | ||
1409 | path = snd_hda_get_path_from_idx(codec, idx); | ||
1410 | if (!path) | ||
1411 | return false; | ||
1412 | |||
1413 | /* assume no path conflicts unless aamix is involved */ | ||
1414 | if (!spec->mixer_nid || !is_nid_contained(path, spec->mixer_nid)) | ||
1415 | return true; | ||
1416 | |||
1417 | /* check whether output paths contain aamix */ | ||
1418 | for (i = 0; i < cfg->line_outs; i++) { | ||
1419 | if (spec->out_paths[i] == idx) | ||
1420 | break; | ||
1421 | path = snd_hda_get_path_from_idx(codec, spec->out_paths[i]); | ||
1422 | if (path && is_nid_contained(path, spec->mixer_nid)) | ||
1423 | return false; | ||
1424 | } | ||
1425 | for (i = 0; i < cfg->speaker_outs; i++) { | ||
1426 | path = snd_hda_get_path_from_idx(codec, spec->speaker_paths[i]); | ||
1427 | if (path && is_nid_contained(path, spec->mixer_nid)) | ||
1428 | return false; | ||
1429 | } | ||
1430 | |||
1431 | return true; | ||
1432 | } | ||
1433 | |||
1395 | /* fill the empty entries in the dac array for speaker/hp with the | 1434 | /* fill the empty entries in the dac array for speaker/hp with the |
1396 | * shared dac pointed by the paths | 1435 | * shared dac pointed by the paths |
1397 | */ | 1436 | */ |
@@ -1545,6 +1584,9 @@ static int fill_and_eval_dacs(struct hda_codec *codec, | |||
1545 | badness += BAD_MULTI_IO; | 1584 | badness += BAD_MULTI_IO; |
1546 | } | 1585 | } |
1547 | 1586 | ||
1587 | if (spec->indep_hp && !indep_hp_possible(codec)) | ||
1588 | badness += BAD_NO_INDEP_HP; | ||
1589 | |||
1548 | /* re-fill the shared DAC for speaker / headphone */ | 1590 | /* re-fill the shared DAC for speaker / headphone */ |
1549 | if (cfg->line_out_type != AUTO_PIN_HP_OUT) | 1591 | if (cfg->line_out_type != AUTO_PIN_HP_OUT) |
1550 | refill_shared_dacs(codec, cfg->hp_outs, | 1592 | refill_shared_dacs(codec, cfg->hp_outs, |
@@ -1758,6 +1800,10 @@ static int parse_output_paths(struct hda_codec *codec) | |||
1758 | cfg->speaker_pins, val); | 1800 | cfg->speaker_pins, val); |
1759 | } | 1801 | } |
1760 | 1802 | ||
1803 | /* clear indep_hp flag if not available */ | ||
1804 | if (spec->indep_hp && !indep_hp_possible(codec)) | ||
1805 | spec->indep_hp = 0; | ||
1806 | |||
1761 | kfree(best_cfg); | 1807 | kfree(best_cfg); |
1762 | return 0; | 1808 | return 0; |
1763 | } | 1809 | } |
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c index 4cea6bb6fade..418bfc0eb0a3 100644 --- a/sound/pci/hda/hda_intel.c +++ b/sound/pci/hda/hda_intel.c | |||
@@ -415,6 +415,8 @@ struct azx_dev { | |||
415 | unsigned int opened :1; | 415 | unsigned int opened :1; |
416 | unsigned int running :1; | 416 | unsigned int running :1; |
417 | unsigned int irq_pending :1; | 417 | unsigned int irq_pending :1; |
418 | unsigned int prepared:1; | ||
419 | unsigned int locked:1; | ||
418 | /* | 420 | /* |
419 | * For VIA: | 421 | * For VIA: |
420 | * A flag to ensure DMA position is 0 | 422 | * A flag to ensure DMA position is 0 |
@@ -426,8 +428,25 @@ struct azx_dev { | |||
426 | 428 | ||
427 | struct timecounter azx_tc; | 429 | struct timecounter azx_tc; |
428 | struct cyclecounter azx_cc; | 430 | struct cyclecounter azx_cc; |
431 | |||
432 | #ifdef CONFIG_SND_HDA_DSP_LOADER | ||
433 | struct mutex dsp_mutex; | ||
434 | #endif | ||
429 | }; | 435 | }; |
430 | 436 | ||
437 | /* DSP lock helpers */ | ||
438 | #ifdef CONFIG_SND_HDA_DSP_LOADER | ||
439 | #define dsp_lock_init(dev) mutex_init(&(dev)->dsp_mutex) | ||
440 | #define dsp_lock(dev) mutex_lock(&(dev)->dsp_mutex) | ||
441 | #define dsp_unlock(dev) mutex_unlock(&(dev)->dsp_mutex) | ||
442 | #define dsp_is_locked(dev) ((dev)->locked) | ||
443 | #else | ||
444 | #define dsp_lock_init(dev) do {} while (0) | ||
445 | #define dsp_lock(dev) do {} while (0) | ||
446 | #define dsp_unlock(dev) do {} while (0) | ||
447 | #define dsp_is_locked(dev) 0 | ||
448 | #endif | ||
449 | |||
431 | /* CORB/RIRB */ | 450 | /* CORB/RIRB */ |
432 | struct azx_rb { | 451 | struct azx_rb { |
433 | u32 *buf; /* CORB/RIRB buffer | 452 | u32 *buf; /* CORB/RIRB buffer |
@@ -527,6 +546,10 @@ struct azx { | |||
527 | 546 | ||
528 | /* card list (for power_save trigger) */ | 547 | /* card list (for power_save trigger) */ |
529 | struct list_head list; | 548 | struct list_head list; |
549 | |||
550 | #ifdef CONFIG_SND_HDA_DSP_LOADER | ||
551 | struct azx_dev saved_azx_dev; | ||
552 | #endif | ||
530 | }; | 553 | }; |
531 | 554 | ||
532 | #define CREATE_TRACE_POINTS | 555 | #define CREATE_TRACE_POINTS |
@@ -1793,15 +1816,25 @@ azx_assign_device(struct azx *chip, struct snd_pcm_substream *substream) | |||
1793 | dev = chip->capture_index_offset; | 1816 | dev = chip->capture_index_offset; |
1794 | nums = chip->capture_streams; | 1817 | nums = chip->capture_streams; |
1795 | } | 1818 | } |
1796 | for (i = 0; i < nums; i++, dev++) | 1819 | for (i = 0; i < nums; i++, dev++) { |
1797 | if (!chip->azx_dev[dev].opened) { | 1820 | struct azx_dev *azx_dev = &chip->azx_dev[dev]; |
1798 | res = &chip->azx_dev[dev]; | 1821 | dsp_lock(azx_dev); |
1799 | if (res->assigned_key == key) | 1822 | if (!azx_dev->opened && !dsp_is_locked(azx_dev)) { |
1800 | break; | 1823 | res = azx_dev; |
1824 | if (res->assigned_key == key) { | ||
1825 | res->opened = 1; | ||
1826 | res->assigned_key = key; | ||
1827 | dsp_unlock(azx_dev); | ||
1828 | return azx_dev; | ||
1829 | } | ||
1801 | } | 1830 | } |
1831 | dsp_unlock(azx_dev); | ||
1832 | } | ||
1802 | if (res) { | 1833 | if (res) { |
1834 | dsp_lock(res); | ||
1803 | res->opened = 1; | 1835 | res->opened = 1; |
1804 | res->assigned_key = key; | 1836 | res->assigned_key = key; |
1837 | dsp_unlock(res); | ||
1805 | } | 1838 | } |
1806 | return res; | 1839 | return res; |
1807 | } | 1840 | } |
@@ -2009,6 +2042,12 @@ static int azx_pcm_hw_params(struct snd_pcm_substream *substream, | |||
2009 | struct azx_dev *azx_dev = get_azx_dev(substream); | 2042 | struct azx_dev *azx_dev = get_azx_dev(substream); |
2010 | int ret; | 2043 | int ret; |
2011 | 2044 | ||
2045 | dsp_lock(azx_dev); | ||
2046 | if (dsp_is_locked(azx_dev)) { | ||
2047 | ret = -EBUSY; | ||
2048 | goto unlock; | ||
2049 | } | ||
2050 | |||
2012 | mark_runtime_wc(chip, azx_dev, substream, false); | 2051 | mark_runtime_wc(chip, azx_dev, substream, false); |
2013 | azx_dev->bufsize = 0; | 2052 | azx_dev->bufsize = 0; |
2014 | azx_dev->period_bytes = 0; | 2053 | azx_dev->period_bytes = 0; |
@@ -2016,8 +2055,10 @@ static int azx_pcm_hw_params(struct snd_pcm_substream *substream, | |||
2016 | ret = snd_pcm_lib_malloc_pages(substream, | 2055 | ret = snd_pcm_lib_malloc_pages(substream, |
2017 | params_buffer_bytes(hw_params)); | 2056 | params_buffer_bytes(hw_params)); |
2018 | if (ret < 0) | 2057 | if (ret < 0) |
2019 | return ret; | 2058 | goto unlock; |
2020 | mark_runtime_wc(chip, azx_dev, substream, true); | 2059 | mark_runtime_wc(chip, azx_dev, substream, true); |
2060 | unlock: | ||
2061 | dsp_unlock(azx_dev); | ||
2021 | return ret; | 2062 | return ret; |
2022 | } | 2063 | } |
2023 | 2064 | ||
@@ -2029,16 +2070,21 @@ static int azx_pcm_hw_free(struct snd_pcm_substream *substream) | |||
2029 | struct hda_pcm_stream *hinfo = apcm->hinfo[substream->stream]; | 2070 | struct hda_pcm_stream *hinfo = apcm->hinfo[substream->stream]; |
2030 | 2071 | ||
2031 | /* reset BDL address */ | 2072 | /* reset BDL address */ |
2032 | azx_sd_writel(azx_dev, SD_BDLPL, 0); | 2073 | dsp_lock(azx_dev); |
2033 | azx_sd_writel(azx_dev, SD_BDLPU, 0); | 2074 | if (!dsp_is_locked(azx_dev)) { |
2034 | azx_sd_writel(azx_dev, SD_CTL, 0); | 2075 | azx_sd_writel(azx_dev, SD_BDLPL, 0); |
2035 | azx_dev->bufsize = 0; | 2076 | azx_sd_writel(azx_dev, SD_BDLPU, 0); |
2036 | azx_dev->period_bytes = 0; | 2077 | azx_sd_writel(azx_dev, SD_CTL, 0); |
2037 | azx_dev->format_val = 0; | 2078 | azx_dev->bufsize = 0; |
2079 | azx_dev->period_bytes = 0; | ||
2080 | azx_dev->format_val = 0; | ||
2081 | } | ||
2038 | 2082 | ||
2039 | snd_hda_codec_cleanup(apcm->codec, hinfo, substream); | 2083 | snd_hda_codec_cleanup(apcm->codec, hinfo, substream); |
2040 | 2084 | ||
2041 | mark_runtime_wc(chip, azx_dev, substream, false); | 2085 | mark_runtime_wc(chip, azx_dev, substream, false); |
2086 | azx_dev->prepared = 0; | ||
2087 | dsp_unlock(azx_dev); | ||
2042 | return snd_pcm_lib_free_pages(substream); | 2088 | return snd_pcm_lib_free_pages(substream); |
2043 | } | 2089 | } |
2044 | 2090 | ||
@@ -2055,6 +2101,12 @@ static int azx_pcm_prepare(struct snd_pcm_substream *substream) | |||
2055 | snd_hda_spdif_out_of_nid(apcm->codec, hinfo->nid); | 2101 | snd_hda_spdif_out_of_nid(apcm->codec, hinfo->nid); |
2056 | unsigned short ctls = spdif ? spdif->ctls : 0; | 2102 | unsigned short ctls = spdif ? spdif->ctls : 0; |
2057 | 2103 | ||
2104 | dsp_lock(azx_dev); | ||
2105 | if (dsp_is_locked(azx_dev)) { | ||
2106 | err = -EBUSY; | ||
2107 | goto unlock; | ||
2108 | } | ||
2109 | |||
2058 | azx_stream_reset(chip, azx_dev); | 2110 | azx_stream_reset(chip, azx_dev); |
2059 | format_val = snd_hda_calc_stream_format(runtime->rate, | 2111 | format_val = snd_hda_calc_stream_format(runtime->rate, |
2060 | runtime->channels, | 2112 | runtime->channels, |
@@ -2065,7 +2117,8 @@ static int azx_pcm_prepare(struct snd_pcm_substream *substream) | |||
2065 | snd_printk(KERN_ERR SFX | 2117 | snd_printk(KERN_ERR SFX |
2066 | "%s: invalid format_val, rate=%d, ch=%d, format=%d\n", | 2118 | "%s: invalid format_val, rate=%d, ch=%d, format=%d\n", |
2067 | pci_name(chip->pci), runtime->rate, runtime->channels, runtime->format); | 2119 | pci_name(chip->pci), runtime->rate, runtime->channels, runtime->format); |
2068 | return -EINVAL; | 2120 | err = -EINVAL; |
2121 | goto unlock; | ||
2069 | } | 2122 | } |
2070 | 2123 | ||
2071 | bufsize = snd_pcm_lib_buffer_bytes(substream); | 2124 | bufsize = snd_pcm_lib_buffer_bytes(substream); |
@@ -2084,7 +2137,7 @@ static int azx_pcm_prepare(struct snd_pcm_substream *substream) | |||
2084 | azx_dev->no_period_wakeup = runtime->no_period_wakeup; | 2137 | azx_dev->no_period_wakeup = runtime->no_period_wakeup; |
2085 | err = azx_setup_periods(chip, substream, azx_dev); | 2138 | err = azx_setup_periods(chip, substream, azx_dev); |
2086 | if (err < 0) | 2139 | if (err < 0) |
2087 | return err; | 2140 | goto unlock; |
2088 | } | 2141 | } |
2089 | 2142 | ||
2090 | /* wallclk has 24Mhz clock source */ | 2143 | /* wallclk has 24Mhz clock source */ |
@@ -2101,8 +2154,14 @@ static int azx_pcm_prepare(struct snd_pcm_substream *substream) | |||
2101 | if ((chip->driver_caps & AZX_DCAPS_CTX_WORKAROUND) && | 2154 | if ((chip->driver_caps & AZX_DCAPS_CTX_WORKAROUND) && |
2102 | stream_tag > chip->capture_streams) | 2155 | stream_tag > chip->capture_streams) |
2103 | stream_tag -= chip->capture_streams; | 2156 | stream_tag -= chip->capture_streams; |
2104 | return snd_hda_codec_prepare(apcm->codec, hinfo, stream_tag, | 2157 | err = snd_hda_codec_prepare(apcm->codec, hinfo, stream_tag, |
2105 | azx_dev->format_val, substream); | 2158 | azx_dev->format_val, substream); |
2159 | |||
2160 | unlock: | ||
2161 | if (!err) | ||
2162 | azx_dev->prepared = 1; | ||
2163 | dsp_unlock(azx_dev); | ||
2164 | return err; | ||
2106 | } | 2165 | } |
2107 | 2166 | ||
2108 | static int azx_pcm_trigger(struct snd_pcm_substream *substream, int cmd) | 2167 | static int azx_pcm_trigger(struct snd_pcm_substream *substream, int cmd) |
@@ -2117,6 +2176,9 @@ static int azx_pcm_trigger(struct snd_pcm_substream *substream, int cmd) | |||
2117 | azx_dev = get_azx_dev(substream); | 2176 | azx_dev = get_azx_dev(substream); |
2118 | trace_azx_pcm_trigger(chip, azx_dev, cmd); | 2177 | trace_azx_pcm_trigger(chip, azx_dev, cmd); |
2119 | 2178 | ||
2179 | if (dsp_is_locked(azx_dev) || !azx_dev->prepared) | ||
2180 | return -EPIPE; | ||
2181 | |||
2120 | switch (cmd) { | 2182 | switch (cmd) { |
2121 | case SNDRV_PCM_TRIGGER_START: | 2183 | case SNDRV_PCM_TRIGGER_START: |
2122 | rstart = 1; | 2184 | rstart = 1; |
@@ -2621,17 +2683,27 @@ static int azx_load_dsp_prepare(struct hda_bus *bus, unsigned int format, | |||
2621 | struct azx_dev *azx_dev; | 2683 | struct azx_dev *azx_dev; |
2622 | int err; | 2684 | int err; |
2623 | 2685 | ||
2624 | if (snd_hda_lock_devices(bus)) | 2686 | azx_dev = azx_get_dsp_loader_dev(chip); |
2625 | return -EBUSY; | 2687 | |
2688 | dsp_lock(azx_dev); | ||
2689 | spin_lock_irq(&chip->reg_lock); | ||
2690 | if (azx_dev->running || azx_dev->locked) { | ||
2691 | spin_unlock_irq(&chip->reg_lock); | ||
2692 | err = -EBUSY; | ||
2693 | goto unlock; | ||
2694 | } | ||
2695 | azx_dev->prepared = 0; | ||
2696 | chip->saved_azx_dev = *azx_dev; | ||
2697 | azx_dev->locked = 1; | ||
2698 | spin_unlock_irq(&chip->reg_lock); | ||
2626 | 2699 | ||
2627 | err = snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV_SG, | 2700 | err = snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV_SG, |
2628 | snd_dma_pci_data(chip->pci), | 2701 | snd_dma_pci_data(chip->pci), |
2629 | byte_size, bufp); | 2702 | byte_size, bufp); |
2630 | if (err < 0) | 2703 | if (err < 0) |
2631 | goto unlock; | 2704 | goto err_alloc; |
2632 | 2705 | ||
2633 | mark_pages_wc(chip, bufp, true); | 2706 | mark_pages_wc(chip, bufp, true); |
2634 | azx_dev = azx_get_dsp_loader_dev(chip); | ||
2635 | azx_dev->bufsize = byte_size; | 2707 | azx_dev->bufsize = byte_size; |
2636 | azx_dev->period_bytes = byte_size; | 2708 | azx_dev->period_bytes = byte_size; |
2637 | azx_dev->format_val = format; | 2709 | azx_dev->format_val = format; |
@@ -2649,13 +2721,20 @@ static int azx_load_dsp_prepare(struct hda_bus *bus, unsigned int format, | |||
2649 | goto error; | 2721 | goto error; |
2650 | 2722 | ||
2651 | azx_setup_controller(chip, azx_dev); | 2723 | azx_setup_controller(chip, azx_dev); |
2724 | dsp_unlock(azx_dev); | ||
2652 | return azx_dev->stream_tag; | 2725 | return azx_dev->stream_tag; |
2653 | 2726 | ||
2654 | error: | 2727 | error: |
2655 | mark_pages_wc(chip, bufp, false); | 2728 | mark_pages_wc(chip, bufp, false); |
2656 | snd_dma_free_pages(bufp); | 2729 | snd_dma_free_pages(bufp); |
2657 | unlock: | 2730 | err_alloc: |
2658 | snd_hda_unlock_devices(bus); | 2731 | spin_lock_irq(&chip->reg_lock); |
2732 | if (azx_dev->opened) | ||
2733 | *azx_dev = chip->saved_azx_dev; | ||
2734 | azx_dev->locked = 0; | ||
2735 | spin_unlock_irq(&chip->reg_lock); | ||
2736 | unlock: | ||
2737 | dsp_unlock(azx_dev); | ||
2659 | return err; | 2738 | return err; |
2660 | } | 2739 | } |
2661 | 2740 | ||
@@ -2677,9 +2756,10 @@ static void azx_load_dsp_cleanup(struct hda_bus *bus, | |||
2677 | struct azx *chip = bus->private_data; | 2756 | struct azx *chip = bus->private_data; |
2678 | struct azx_dev *azx_dev = azx_get_dsp_loader_dev(chip); | 2757 | struct azx_dev *azx_dev = azx_get_dsp_loader_dev(chip); |
2679 | 2758 | ||
2680 | if (!dmab->area) | 2759 | if (!dmab->area || !azx_dev->locked) |
2681 | return; | 2760 | return; |
2682 | 2761 | ||
2762 | dsp_lock(azx_dev); | ||
2683 | /* reset BDL address */ | 2763 | /* reset BDL address */ |
2684 | azx_sd_writel(azx_dev, SD_BDLPL, 0); | 2764 | azx_sd_writel(azx_dev, SD_BDLPL, 0); |
2685 | azx_sd_writel(azx_dev, SD_BDLPU, 0); | 2765 | azx_sd_writel(azx_dev, SD_BDLPU, 0); |
@@ -2692,7 +2772,12 @@ static void azx_load_dsp_cleanup(struct hda_bus *bus, | |||
2692 | snd_dma_free_pages(dmab); | 2772 | snd_dma_free_pages(dmab); |
2693 | dmab->area = NULL; | 2773 | dmab->area = NULL; |
2694 | 2774 | ||
2695 | snd_hda_unlock_devices(bus); | 2775 | spin_lock_irq(&chip->reg_lock); |
2776 | if (azx_dev->opened) | ||
2777 | *azx_dev = chip->saved_azx_dev; | ||
2778 | azx_dev->locked = 0; | ||
2779 | spin_unlock_irq(&chip->reg_lock); | ||
2780 | dsp_unlock(azx_dev); | ||
2696 | } | 2781 | } |
2697 | #endif /* CONFIG_SND_HDA_DSP_LOADER */ | 2782 | #endif /* CONFIG_SND_HDA_DSP_LOADER */ |
2698 | 2783 | ||
@@ -3481,6 +3566,7 @@ static int azx_first_init(struct azx *chip) | |||
3481 | } | 3566 | } |
3482 | 3567 | ||
3483 | for (i = 0; i < chip->num_streams; i++) { | 3568 | for (i = 0; i < chip->num_streams; i++) { |
3569 | dsp_lock_init(&chip->azx_dev[i]); | ||
3484 | /* allocate memory for the BDL for each stream */ | 3570 | /* allocate memory for the BDL for each stream */ |
3485 | err = snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, | 3571 | err = snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, |
3486 | snd_dma_pci_data(chip->pci), | 3572 | snd_dma_pci_data(chip->pci), |
diff --git a/sound/pci/hda/patch_ca0132.c b/sound/pci/hda/patch_ca0132.c index eefc4563b2f9..0792b5725f9c 100644 --- a/sound/pci/hda/patch_ca0132.c +++ b/sound/pci/hda/patch_ca0132.c | |||
@@ -3239,7 +3239,7 @@ static int ca0132_set_vipsource(struct hda_codec *codec, int val) | |||
3239 | struct ca0132_spec *spec = codec->spec; | 3239 | struct ca0132_spec *spec = codec->spec; |
3240 | unsigned int tmp; | 3240 | unsigned int tmp; |
3241 | 3241 | ||
3242 | if (!dspload_is_loaded(codec)) | 3242 | if (spec->dsp_state != DSP_DOWNLOADED) |
3243 | return 0; | 3243 | return 0; |
3244 | 3244 | ||
3245 | /* if CrystalVoice if off, vipsource should be 0 */ | 3245 | /* if CrystalVoice if off, vipsource should be 0 */ |
@@ -4267,11 +4267,12 @@ static void ca0132_refresh_widget_caps(struct hda_codec *codec) | |||
4267 | */ | 4267 | */ |
4268 | static void ca0132_setup_defaults(struct hda_codec *codec) | 4268 | static void ca0132_setup_defaults(struct hda_codec *codec) |
4269 | { | 4269 | { |
4270 | struct ca0132_spec *spec = codec->spec; | ||
4270 | unsigned int tmp; | 4271 | unsigned int tmp; |
4271 | int num_fx; | 4272 | int num_fx; |
4272 | int idx, i; | 4273 | int idx, i; |
4273 | 4274 | ||
4274 | if (!dspload_is_loaded(codec)) | 4275 | if (spec->dsp_state != DSP_DOWNLOADED) |
4275 | return; | 4276 | return; |
4276 | 4277 | ||
4277 | /* out, in effects + voicefx */ | 4278 | /* out, in effects + voicefx */ |
@@ -4351,12 +4352,16 @@ static bool ca0132_download_dsp_images(struct hda_codec *codec) | |||
4351 | return false; | 4352 | return false; |
4352 | 4353 | ||
4353 | dsp_os_image = (struct dsp_image_seg *)(fw_entry->data); | 4354 | dsp_os_image = (struct dsp_image_seg *)(fw_entry->data); |
4354 | dspload_image(codec, dsp_os_image, 0, 0, true, 0); | 4355 | if (dspload_image(codec, dsp_os_image, 0, 0, true, 0)) { |
4356 | pr_err("ca0132 dspload_image failed.\n"); | ||
4357 | goto exit_download; | ||
4358 | } | ||
4359 | |||
4355 | dsp_loaded = dspload_wait_loaded(codec); | 4360 | dsp_loaded = dspload_wait_loaded(codec); |
4356 | 4361 | ||
4362 | exit_download: | ||
4357 | release_firmware(fw_entry); | 4363 | release_firmware(fw_entry); |
4358 | 4364 | ||
4359 | |||
4360 | return dsp_loaded; | 4365 | return dsp_loaded; |
4361 | } | 4366 | } |
4362 | 4367 | ||
@@ -4367,16 +4372,13 @@ static void ca0132_download_dsp(struct hda_codec *codec) | |||
4367 | #ifndef CONFIG_SND_HDA_CODEC_CA0132_DSP | 4372 | #ifndef CONFIG_SND_HDA_CODEC_CA0132_DSP |
4368 | return; /* NOP */ | 4373 | return; /* NOP */ |
4369 | #endif | 4374 | #endif |
4370 | spec->dsp_state = DSP_DOWNLOAD_INIT; | ||
4371 | 4375 | ||
4372 | if (spec->dsp_state == DSP_DOWNLOAD_INIT) { | 4376 | chipio_enable_clocks(codec); |
4373 | chipio_enable_clocks(codec); | 4377 | spec->dsp_state = DSP_DOWNLOADING; |
4374 | spec->dsp_state = DSP_DOWNLOADING; | 4378 | if (!ca0132_download_dsp_images(codec)) |
4375 | if (!ca0132_download_dsp_images(codec)) | 4379 | spec->dsp_state = DSP_DOWNLOAD_FAILED; |
4376 | spec->dsp_state = DSP_DOWNLOAD_FAILED; | 4380 | else |
4377 | else | 4381 | spec->dsp_state = DSP_DOWNLOADED; |
4378 | spec->dsp_state = DSP_DOWNLOADED; | ||
4379 | } | ||
4380 | 4382 | ||
4381 | if (spec->dsp_state == DSP_DOWNLOADED) | 4383 | if (spec->dsp_state == DSP_DOWNLOADED) |
4382 | ca0132_set_dsp_msr(codec, true); | 4384 | ca0132_set_dsp_msr(codec, true); |
diff --git a/sound/pci/hda/patch_cirrus.c b/sound/pci/hda/patch_cirrus.c index 72ebb8a36b13..0d9c58f13560 100644 --- a/sound/pci/hda/patch_cirrus.c +++ b/sound/pci/hda/patch_cirrus.c | |||
@@ -168,10 +168,10 @@ static void cs_automute(struct hda_codec *codec) | |||
168 | snd_hda_gen_update_outputs(codec); | 168 | snd_hda_gen_update_outputs(codec); |
169 | 169 | ||
170 | if (spec->gpio_eapd_hp) { | 170 | if (spec->gpio_eapd_hp) { |
171 | unsigned int gpio = spec->gen.hp_jack_present ? | 171 | spec->gpio_data = spec->gen.hp_jack_present ? |
172 | spec->gpio_eapd_hp : spec->gpio_eapd_speaker; | 172 | spec->gpio_eapd_hp : spec->gpio_eapd_speaker; |
173 | snd_hda_codec_write(codec, 0x01, 0, | 173 | snd_hda_codec_write(codec, 0x01, 0, |
174 | AC_VERB_SET_GPIO_DATA, gpio); | 174 | AC_VERB_SET_GPIO_DATA, spec->gpio_data); |
175 | } | 175 | } |
176 | } | 176 | } |
177 | 177 | ||
@@ -506,6 +506,8 @@ static int patch_cs420x(struct hda_codec *codec) | |||
506 | if (!spec) | 506 | if (!spec) |
507 | return -ENOMEM; | 507 | return -ENOMEM; |
508 | 508 | ||
509 | spec->gen.automute_hook = cs_automute; | ||
510 | |||
509 | snd_hda_pick_fixup(codec, cs420x_models, cs420x_fixup_tbl, | 511 | snd_hda_pick_fixup(codec, cs420x_models, cs420x_fixup_tbl, |
510 | cs420x_fixups); | 512 | cs420x_fixups); |
511 | snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); | 513 | snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); |
@@ -893,6 +895,8 @@ static int patch_cs4210(struct hda_codec *codec) | |||
893 | if (!spec) | 895 | if (!spec) |
894 | return -ENOMEM; | 896 | return -ENOMEM; |
895 | 897 | ||
898 | spec->gen.automute_hook = cs_automute; | ||
899 | |||
896 | snd_hda_pick_fixup(codec, cs421x_models, cs421x_fixup_tbl, | 900 | snd_hda_pick_fixup(codec, cs421x_models, cs421x_fixup_tbl, |
897 | cs421x_fixups); | 901 | cs421x_fixups); |
898 | snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); | 902 | snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); |
diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c index 941bf6c766ec..2a89d1eefeb6 100644 --- a/sound/pci/hda/patch_conexant.c +++ b/sound/pci/hda/patch_conexant.c | |||
@@ -1142,7 +1142,7 @@ static int patch_cxt5045(struct hda_codec *codec) | |||
1142 | } | 1142 | } |
1143 | 1143 | ||
1144 | if (spec->beep_amp) | 1144 | if (spec->beep_amp) |
1145 | snd_hda_attach_beep_device(codec, spec->beep_amp); | 1145 | snd_hda_attach_beep_device(codec, get_amp_nid_(spec->beep_amp)); |
1146 | 1146 | ||
1147 | return 0; | 1147 | return 0; |
1148 | } | 1148 | } |
@@ -1921,7 +1921,7 @@ static int patch_cxt5051(struct hda_codec *codec) | |||
1921 | } | 1921 | } |
1922 | 1922 | ||
1923 | if (spec->beep_amp) | 1923 | if (spec->beep_amp) |
1924 | snd_hda_attach_beep_device(codec, spec->beep_amp); | 1924 | snd_hda_attach_beep_device(codec, get_amp_nid_(spec->beep_amp)); |
1925 | 1925 | ||
1926 | return 0; | 1926 | return 0; |
1927 | } | 1927 | } |
@@ -3099,7 +3099,7 @@ static int patch_cxt5066(struct hda_codec *codec) | |||
3099 | } | 3099 | } |
3100 | 3100 | ||
3101 | if (spec->beep_amp) | 3101 | if (spec->beep_amp) |
3102 | snd_hda_attach_beep_device(codec, spec->beep_amp); | 3102 | snd_hda_attach_beep_device(codec, get_amp_nid_(spec->beep_amp)); |
3103 | 3103 | ||
3104 | return 0; | 3104 | return 0; |
3105 | } | 3105 | } |
@@ -3191,11 +3191,17 @@ static int cx_auto_build_controls(struct hda_codec *codec) | |||
3191 | return 0; | 3191 | return 0; |
3192 | } | 3192 | } |
3193 | 3193 | ||
3194 | static void cx_auto_free(struct hda_codec *codec) | ||
3195 | { | ||
3196 | snd_hda_detach_beep_device(codec); | ||
3197 | snd_hda_gen_free(codec); | ||
3198 | } | ||
3199 | |||
3194 | static const struct hda_codec_ops cx_auto_patch_ops = { | 3200 | static const struct hda_codec_ops cx_auto_patch_ops = { |
3195 | .build_controls = cx_auto_build_controls, | 3201 | .build_controls = cx_auto_build_controls, |
3196 | .build_pcms = snd_hda_gen_build_pcms, | 3202 | .build_pcms = snd_hda_gen_build_pcms, |
3197 | .init = snd_hda_gen_init, | 3203 | .init = snd_hda_gen_init, |
3198 | .free = snd_hda_gen_free, | 3204 | .free = cx_auto_free, |
3199 | .unsol_event = snd_hda_jack_unsol_event, | 3205 | .unsol_event = snd_hda_jack_unsol_event, |
3200 | #ifdef CONFIG_PM | 3206 | #ifdef CONFIG_PM |
3201 | .check_power_status = snd_hda_gen_check_power_status, | 3207 | .check_power_status = snd_hda_gen_check_power_status, |
@@ -3391,7 +3397,7 @@ static int patch_conexant_auto(struct hda_codec *codec) | |||
3391 | 3397 | ||
3392 | codec->patch_ops = cx_auto_patch_ops; | 3398 | codec->patch_ops = cx_auto_patch_ops; |
3393 | if (spec->beep_amp) | 3399 | if (spec->beep_amp) |
3394 | snd_hda_attach_beep_device(codec, spec->beep_amp); | 3400 | snd_hda_attach_beep_device(codec, get_amp_nid_(spec->beep_amp)); |
3395 | 3401 | ||
3396 | /* Some laptops with Conexant chips show stalls in S3 resume, | 3402 | /* Some laptops with Conexant chips show stalls in S3 resume, |
3397 | * which falls into the single-cmd mode. | 3403 | * which falls into the single-cmd mode. |
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index 83d5335ac348..dafe04ae8c72 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c | |||
@@ -815,6 +815,29 @@ static int find_mute_led_cfg(struct hda_codec *codec, int default_polarity) | |||
815 | return 0; | 815 | return 0; |
816 | } | 816 | } |
817 | 817 | ||
818 | /* check whether a built-in speaker is included in parsed pins */ | ||
819 | static bool has_builtin_speaker(struct hda_codec *codec) | ||
820 | { | ||
821 | struct sigmatel_spec *spec = codec->spec; | ||
822 | hda_nid_t *nid_pin; | ||
823 | int nids, i; | ||
824 | |||
825 | if (spec->gen.autocfg.line_out_type == AUTO_PIN_SPEAKER_OUT) { | ||
826 | nid_pin = spec->gen.autocfg.line_out_pins; | ||
827 | nids = spec->gen.autocfg.line_outs; | ||
828 | } else { | ||
829 | nid_pin = spec->gen.autocfg.speaker_pins; | ||
830 | nids = spec->gen.autocfg.speaker_outs; | ||
831 | } | ||
832 | |||
833 | for (i = 0; i < nids; i++) { | ||
834 | unsigned int def_conf = snd_hda_codec_get_pincfg(codec, nid_pin[i]); | ||
835 | if (snd_hda_get_input_pin_attr(def_conf) == INPUT_PIN_ATTR_INT) | ||
836 | return true; | ||
837 | } | ||
838 | return false; | ||
839 | } | ||
840 | |||
818 | /* | 841 | /* |
819 | * PC beep controls | 842 | * PC beep controls |
820 | */ | 843 | */ |
@@ -3890,6 +3913,12 @@ static int patch_stac92hd73xx(struct hda_codec *codec) | |||
3890 | return err; | 3913 | return err; |
3891 | } | 3914 | } |
3892 | 3915 | ||
3916 | /* Don't GPIO-mute speakers if there are no internal speakers, because | ||
3917 | * the GPIO might be necessary for Headphone | ||
3918 | */ | ||
3919 | if (spec->eapd_switch && !has_builtin_speaker(codec)) | ||
3920 | spec->eapd_switch = 0; | ||
3921 | |||
3893 | codec->proc_widget_hook = stac92hd7x_proc_hook; | 3922 | codec->proc_widget_hook = stac92hd7x_proc_hook; |
3894 | 3923 | ||
3895 | snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); | 3924 | snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); |
diff --git a/sound/usb/card.c b/sound/usb/card.c index 803953a9bff3..2da8ad75fd96 100644 --- a/sound/usb/card.c +++ b/sound/usb/card.c | |||
@@ -244,6 +244,21 @@ static int snd_usb_create_streams(struct snd_usb_audio *chip, int ctrlif) | |||
244 | usb_ifnum_to_if(dev, ctrlif)->intf_assoc; | 244 | usb_ifnum_to_if(dev, ctrlif)->intf_assoc; |
245 | 245 | ||
246 | if (!assoc) { | 246 | if (!assoc) { |
247 | /* | ||
248 | * Firmware writers cannot count to three. So to find | ||
249 | * the IAD on the NuForce UDH-100, also check the next | ||
250 | * interface. | ||
251 | */ | ||
252 | struct usb_interface *iface = | ||
253 | usb_ifnum_to_if(dev, ctrlif + 1); | ||
254 | if (iface && | ||
255 | iface->intf_assoc && | ||
256 | iface->intf_assoc->bFunctionClass == USB_CLASS_AUDIO && | ||
257 | iface->intf_assoc->bFunctionProtocol == UAC_VERSION_2) | ||
258 | assoc = iface->intf_assoc; | ||
259 | } | ||
260 | |||
261 | if (!assoc) { | ||
247 | snd_printk(KERN_ERR "Audio class v2 interfaces need an interface association\n"); | 262 | snd_printk(KERN_ERR "Audio class v2 interfaces need an interface association\n"); |
248 | return -EINVAL; | 263 | return -EINVAL; |
249 | } | 264 | } |
diff --git a/sound/usb/mixer.c b/sound/usb/mixer.c index 638e7f738018..ca4739c3f650 100644 --- a/sound/usb/mixer.c +++ b/sound/usb/mixer.c | |||
@@ -715,8 +715,9 @@ static int check_input_term(struct mixer_build *state, int id, struct usb_audio_ | |||
715 | case UAC2_CLOCK_SELECTOR: { | 715 | case UAC2_CLOCK_SELECTOR: { |
716 | struct uac_selector_unit_descriptor *d = p1; | 716 | struct uac_selector_unit_descriptor *d = p1; |
717 | /* call recursively to retrieve the channel info */ | 717 | /* call recursively to retrieve the channel info */ |
718 | if (check_input_term(state, d->baSourceID[0], term) < 0) | 718 | err = check_input_term(state, d->baSourceID[0], term); |
719 | return -ENODEV; | 719 | if (err < 0) |
720 | return err; | ||
720 | term->type = d->bDescriptorSubtype << 16; /* virtual type */ | 721 | term->type = d->bDescriptorSubtype << 16; /* virtual type */ |
721 | term->id = id; | 722 | term->id = id; |
722 | term->name = uac_selector_unit_iSelector(d); | 723 | term->name = uac_selector_unit_iSelector(d); |
@@ -725,7 +726,8 @@ static int check_input_term(struct mixer_build *state, int id, struct usb_audio_ | |||
725 | case UAC1_PROCESSING_UNIT: | 726 | case UAC1_PROCESSING_UNIT: |
726 | case UAC1_EXTENSION_UNIT: | 727 | case UAC1_EXTENSION_UNIT: |
727 | /* UAC2_PROCESSING_UNIT_V2 */ | 728 | /* UAC2_PROCESSING_UNIT_V2 */ |
728 | /* UAC2_EFFECT_UNIT */ { | 729 | /* UAC2_EFFECT_UNIT */ |
730 | case UAC2_EXTENSION_UNIT_V2: { | ||
729 | struct uac_processing_unit_descriptor *d = p1; | 731 | struct uac_processing_unit_descriptor *d = p1; |
730 | 732 | ||
731 | if (state->mixer->protocol == UAC_VERSION_2 && | 733 | if (state->mixer->protocol == UAC_VERSION_2 && |
@@ -1356,8 +1358,9 @@ static int parse_audio_feature_unit(struct mixer_build *state, int unitid, void | |||
1356 | return err; | 1358 | return err; |
1357 | 1359 | ||
1358 | /* determine the input source type and name */ | 1360 | /* determine the input source type and name */ |
1359 | if (check_input_term(state, hdr->bSourceID, &iterm) < 0) | 1361 | err = check_input_term(state, hdr->bSourceID, &iterm); |
1360 | return -EINVAL; | 1362 | if (err < 0) |
1363 | return err; | ||
1361 | 1364 | ||
1362 | master_bits = snd_usb_combine_bytes(bmaControls, csize); | 1365 | master_bits = snd_usb_combine_bytes(bmaControls, csize); |
1363 | /* master configuration quirks */ | 1366 | /* master configuration quirks */ |
@@ -2052,6 +2055,8 @@ static int parse_audio_unit(struct mixer_build *state, int unitid) | |||
2052 | return parse_audio_extension_unit(state, unitid, p1); | 2055 | return parse_audio_extension_unit(state, unitid, p1); |
2053 | else /* UAC_VERSION_2 */ | 2056 | else /* UAC_VERSION_2 */ |
2054 | return parse_audio_processing_unit(state, unitid, p1); | 2057 | return parse_audio_processing_unit(state, unitid, p1); |
2058 | case UAC2_EXTENSION_UNIT_V2: | ||
2059 | return parse_audio_extension_unit(state, unitid, p1); | ||
2055 | default: | 2060 | default: |
2056 | snd_printk(KERN_ERR "usbaudio: unit %u: unexpected type 0x%02x\n", unitid, p1[2]); | 2061 | snd_printk(KERN_ERR "usbaudio: unit %u: unexpected type 0x%02x\n", unitid, p1[2]); |
2057 | return -EINVAL; | 2062 | return -EINVAL; |
@@ -2118,7 +2123,7 @@ static int snd_usb_mixer_controls(struct usb_mixer_interface *mixer) | |||
2118 | state.oterm.type = le16_to_cpu(desc->wTerminalType); | 2123 | state.oterm.type = le16_to_cpu(desc->wTerminalType); |
2119 | state.oterm.name = desc->iTerminal; | 2124 | state.oterm.name = desc->iTerminal; |
2120 | err = parse_audio_unit(&state, desc->bSourceID); | 2125 | err = parse_audio_unit(&state, desc->bSourceID); |
2121 | if (err < 0) | 2126 | if (err < 0 && err != -EINVAL) |
2122 | return err; | 2127 | return err; |
2123 | } else { /* UAC_VERSION_2 */ | 2128 | } else { /* UAC_VERSION_2 */ |
2124 | struct uac2_output_terminal_descriptor *desc = p; | 2129 | struct uac2_output_terminal_descriptor *desc = p; |
@@ -2130,12 +2135,12 @@ static int snd_usb_mixer_controls(struct usb_mixer_interface *mixer) | |||
2130 | state.oterm.type = le16_to_cpu(desc->wTerminalType); | 2135 | state.oterm.type = le16_to_cpu(desc->wTerminalType); |
2131 | state.oterm.name = desc->iTerminal; | 2136 | state.oterm.name = desc->iTerminal; |
2132 | err = parse_audio_unit(&state, desc->bSourceID); | 2137 | err = parse_audio_unit(&state, desc->bSourceID); |
2133 | if (err < 0) | 2138 | if (err < 0 && err != -EINVAL) |
2134 | return err; | 2139 | return err; |
2135 | 2140 | ||
2136 | /* for UAC2, use the same approach to also add the clock selectors */ | 2141 | /* for UAC2, use the same approach to also add the clock selectors */ |
2137 | err = parse_audio_unit(&state, desc->bCSourceID); | 2142 | err = parse_audio_unit(&state, desc->bCSourceID); |
2138 | if (err < 0) | 2143 | if (err < 0 && err != -EINVAL) |
2139 | return err; | 2144 | return err; |
2140 | } | 2145 | } |
2141 | } | 2146 | } |
diff --git a/tools/lib/traceevent/Makefile b/tools/lib/traceevent/Makefile index a20e32033431..0b0a90787db6 100644 --- a/tools/lib/traceevent/Makefile +++ b/tools/lib/traceevent/Makefile | |||
@@ -122,7 +122,7 @@ export Q VERBOSE | |||
122 | 122 | ||
123 | EVENT_PARSE_VERSION = $(EP_VERSION).$(EP_PATCHLEVEL).$(EP_EXTRAVERSION) | 123 | EVENT_PARSE_VERSION = $(EP_VERSION).$(EP_PATCHLEVEL).$(EP_EXTRAVERSION) |
124 | 124 | ||
125 | INCLUDES = -I. -I/usr/local/include $(CONFIG_INCLUDES) | 125 | INCLUDES = -I. $(CONFIG_INCLUDES) |
126 | 126 | ||
127 | # Set compile option CFLAGS if not set elsewhere | 127 | # Set compile option CFLAGS if not set elsewhere |
128 | CFLAGS ?= -g -Wall | 128 | CFLAGS ?= -g -Wall |
diff --git a/tools/perf/Makefile b/tools/perf/Makefile index a2108ca1cc17..bb74c79cd16e 100644 --- a/tools/perf/Makefile +++ b/tools/perf/Makefile | |||
@@ -95,7 +95,7 @@ ifeq ("$(origin DEBUG)", "command line") | |||
95 | PERF_DEBUG = $(DEBUG) | 95 | PERF_DEBUG = $(DEBUG) |
96 | endif | 96 | endif |
97 | ifndef PERF_DEBUG | 97 | ifndef PERF_DEBUG |
98 | CFLAGS_OPTIMIZE = -O6 -D_FORTIFY_SOURCE=2 | 98 | CFLAGS_OPTIMIZE = -O6 |
99 | endif | 99 | endif |
100 | 100 | ||
101 | ifdef PARSER_DEBUG | 101 | ifdef PARSER_DEBUG |
@@ -180,6 +180,12 @@ ifeq ($(call try-cc,$(SOURCE_HELLO),$(CFLAGS) -Werror -Wvolatile-register-var,-W | |||
180 | CFLAGS := $(CFLAGS) -Wvolatile-register-var | 180 | CFLAGS := $(CFLAGS) -Wvolatile-register-var |
181 | endif | 181 | endif |
182 | 182 | ||
183 | ifndef PERF_DEBUG | ||
184 | ifeq ($(call try-cc,$(SOURCE_HELLO),$(CFLAGS) -D_FORTIFY_SOURCE=2,-D_FORTIFY_SOURCE=2),y) | ||
185 | CFLAGS := $(CFLAGS) -D_FORTIFY_SOURCE=2 | ||
186 | endif | ||
187 | endif | ||
188 | |||
183 | ### --- END CONFIGURATION SECTION --- | 189 | ### --- END CONFIGURATION SECTION --- |
184 | 190 | ||
185 | ifeq ($(srctree),) | 191 | ifeq ($(srctree),) |
diff --git a/tools/perf/bench/bench.h b/tools/perf/bench/bench.h index a5223e6a7b43..0fdc85269c4d 100644 --- a/tools/perf/bench/bench.h +++ b/tools/perf/bench/bench.h | |||
@@ -1,6 +1,30 @@ | |||
1 | #ifndef BENCH_H | 1 | #ifndef BENCH_H |
2 | #define BENCH_H | 2 | #define BENCH_H |
3 | 3 | ||
4 | /* | ||
5 | * The madvise transparent hugepage constants were added in glibc | ||
6 | * 2.13. For compatibility with older versions of glibc, define these | ||
7 | * tokens if they are not already defined. | ||
8 | * | ||
9 | * PA-RISC uses different madvise values from other architectures and | ||
10 | * needs to be special-cased. | ||
11 | */ | ||
12 | #ifdef __hppa__ | ||
13 | # ifndef MADV_HUGEPAGE | ||
14 | # define MADV_HUGEPAGE 67 | ||
15 | # endif | ||
16 | # ifndef MADV_NOHUGEPAGE | ||
17 | # define MADV_NOHUGEPAGE 68 | ||
18 | # endif | ||
19 | #else | ||
20 | # ifndef MADV_HUGEPAGE | ||
21 | # define MADV_HUGEPAGE 14 | ||
22 | # endif | ||
23 | # ifndef MADV_NOHUGEPAGE | ||
24 | # define MADV_NOHUGEPAGE 15 | ||
25 | # endif | ||
26 | #endif | ||
27 | |||
4 | extern int bench_numa(int argc, const char **argv, const char *prefix); | 28 | extern int bench_numa(int argc, const char **argv, const char *prefix); |
5 | extern int bench_sched_messaging(int argc, const char **argv, const char *prefix); | 29 | extern int bench_sched_messaging(int argc, const char **argv, const char *prefix); |
6 | extern int bench_sched_pipe(int argc, const char **argv, const char *prefix); | 30 | extern int bench_sched_pipe(int argc, const char **argv, const char *prefix); |
diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c index 774c90713a53..f1a939ebc19c 100644 --- a/tools/perf/builtin-record.c +++ b/tools/perf/builtin-record.c | |||
@@ -573,13 +573,15 @@ static int __cmd_record(struct perf_record *rec, int argc, const char **argv) | |||
573 | perf_event__synthesize_guest_os, tool); | 573 | perf_event__synthesize_guest_os, tool); |
574 | } | 574 | } |
575 | 575 | ||
576 | if (!opts->target.system_wide) | 576 | if (perf_target__has_task(&opts->target)) |
577 | err = perf_event__synthesize_thread_map(tool, evsel_list->threads, | 577 | err = perf_event__synthesize_thread_map(tool, evsel_list->threads, |
578 | process_synthesized_event, | 578 | process_synthesized_event, |
579 | machine); | 579 | machine); |
580 | else | 580 | else if (perf_target__has_cpu(&opts->target)) |
581 | err = perf_event__synthesize_threads(tool, process_synthesized_event, | 581 | err = perf_event__synthesize_threads(tool, process_synthesized_event, |
582 | machine); | 582 | machine); |
583 | else /* command specified */ | ||
584 | err = 0; | ||
583 | 585 | ||
584 | if (err != 0) | 586 | if (err != 0) |
585 | goto out_delete_session; | 587 | goto out_delete_session; |
diff --git a/tools/perf/util/hist.h b/tools/perf/util/hist.h index 38624686ee9a..226a4ae2f936 100644 --- a/tools/perf/util/hist.h +++ b/tools/perf/util/hist.h | |||
@@ -208,8 +208,9 @@ static inline int script_browse(const char *script_opt __maybe_unused) | |||
208 | return 0; | 208 | return 0; |
209 | } | 209 | } |
210 | 210 | ||
211 | #define K_LEFT -1 | 211 | #define K_LEFT -1000 |
212 | #define K_RIGHT -2 | 212 | #define K_RIGHT -2000 |
213 | #define K_SWITCH_INPUT_DATA -3000 | ||
213 | #endif | 214 | #endif |
214 | 215 | ||
215 | #ifdef GTK2_SUPPORT | 216 | #ifdef GTK2_SUPPORT |
diff --git a/tools/perf/util/strlist.c b/tools/perf/util/strlist.c index 55433aa42c8f..eabdce0a2daa 100644 --- a/tools/perf/util/strlist.c +++ b/tools/perf/util/strlist.c | |||
@@ -143,7 +143,7 @@ struct strlist *strlist__new(bool dupstr, const char *list) | |||
143 | slist->rblist.node_delete = strlist__node_delete; | 143 | slist->rblist.node_delete = strlist__node_delete; |
144 | 144 | ||
145 | slist->dupstr = dupstr; | 145 | slist->dupstr = dupstr; |
146 | if (slist && strlist__parse_list(slist, list) != 0) | 146 | if (list && strlist__parse_list(slist, list) != 0) |
147 | goto out_error; | 147 | goto out_error; |
148 | } | 148 | } |
149 | 149 | ||
diff --git a/tools/usb/ffs-test.c b/tools/usb/ffs-test.c index 8674b9ec14f6..fe1e66b6ef40 100644 --- a/tools/usb/ffs-test.c +++ b/tools/usb/ffs-test.c | |||
@@ -38,7 +38,7 @@ | |||
38 | #include <unistd.h> | 38 | #include <unistd.h> |
39 | #include <tools/le_byteshift.h> | 39 | #include <tools/le_byteshift.h> |
40 | 40 | ||
41 | #include "../../include/linux/usb/functionfs.h" | 41 | #include "../../include/uapi/linux/usb/functionfs.h" |
42 | 42 | ||
43 | 43 | ||
44 | /******************** Little Endian Handling ********************************/ | 44 | /******************** Little Endian Handling ********************************/ |
diff --git a/virt/kvm/ioapic.c b/virt/kvm/ioapic.c index ce82b9401958..5ba005c00e2f 100644 --- a/virt/kvm/ioapic.c +++ b/virt/kvm/ioapic.c | |||
@@ -74,9 +74,12 @@ static unsigned long ioapic_read_indirect(struct kvm_ioapic *ioapic, | |||
74 | u32 redir_index = (ioapic->ioregsel - 0x10) >> 1; | 74 | u32 redir_index = (ioapic->ioregsel - 0x10) >> 1; |
75 | u64 redir_content; | 75 | u64 redir_content; |
76 | 76 | ||
77 | ASSERT(redir_index < IOAPIC_NUM_PINS); | 77 | if (redir_index < IOAPIC_NUM_PINS) |
78 | redir_content = | ||
79 | ioapic->redirtbl[redir_index].bits; | ||
80 | else | ||
81 | redir_content = ~0ULL; | ||
78 | 82 | ||
79 | redir_content = ioapic->redirtbl[redir_index].bits; | ||
80 | result = (ioapic->ioregsel & 0x1) ? | 83 | result = (ioapic->ioregsel & 0x1) ? |
81 | (redir_content >> 32) & 0xffffffff : | 84 | (redir_content >> 32) & 0xffffffff : |
82 | redir_content & 0xffffffff; | 85 | redir_content & 0xffffffff; |