diff options
302 files changed, 4827 insertions, 3460 deletions
diff --git a/Documentation/filesystems/caching/backend-api.txt b/Documentation/filesystems/caching/backend-api.txt index 382d52cdaf2d..d78bab9622c6 100644 --- a/Documentation/filesystems/caching/backend-api.txt +++ b/Documentation/filesystems/caching/backend-api.txt | |||
@@ -308,6 +308,18 @@ performed on the denizens of the cache. These are held in a structure of type: | |||
308 | obtained by calling object->cookie->def->get_aux()/get_attr(). | 308 | obtained by calling object->cookie->def->get_aux()/get_attr(). |
309 | 309 | ||
310 | 310 | ||
311 | (*) Invalidate data object [mandatory]: | ||
312 | |||
313 | int (*invalidate_object)(struct fscache_operation *op) | ||
314 | |||
315 | This is called to invalidate a data object (as pointed to by op->object). | ||
316 | All the data stored for this object should be discarded and an | ||
317 | attr_changed operation should be performed. The caller will follow up | ||
318 | with an object update operation. | ||
319 | |||
320 | fscache_op_complete() must be called on op before returning. | ||
321 | |||
322 | |||
311 | (*) Discard object [mandatory]: | 323 | (*) Discard object [mandatory]: |
312 | 324 | ||
313 | void (*drop_object)(struct fscache_object *object) | 325 | void (*drop_object)(struct fscache_object *object) |
@@ -419,7 +431,10 @@ performed on the denizens of the cache. These are held in a structure of type: | |||
419 | 431 | ||
420 | If an I/O error occurs, fscache_io_error() should be called and -ENOBUFS | 432 | If an I/O error occurs, fscache_io_error() should be called and -ENOBUFS |
421 | returned if possible or fscache_end_io() called with a suitable error | 433 | returned if possible or fscache_end_io() called with a suitable error |
422 | code.. | 434 | code. |
435 | |||
436 | fscache_put_retrieval() should be called after a page or pages are dealt | ||
437 | with. This will complete the operation when all pages are dealt with. | ||
423 | 438 | ||
424 | 439 | ||
425 | (*) Request pages be read from cache [mandatory]: | 440 | (*) Request pages be read from cache [mandatory]: |
@@ -526,6 +541,27 @@ FS-Cache provides some utilities that a cache backend may make use of: | |||
526 | error value should be 0 if successful and an error otherwise. | 541 | error value should be 0 if successful and an error otherwise. |
527 | 542 | ||
528 | 543 | ||
544 | (*) Record that one or more pages being retrieved or allocated have been dealt | ||
545 | with: | ||
546 | |||
547 | void fscache_retrieval_complete(struct fscache_retrieval *op, | ||
548 | int n_pages); | ||
549 | |||
550 | This is called to record the fact that one or more pages have been dealt | ||
551 | with and are no longer the concern of this operation. When the number of | ||
552 | pages remaining in the operation reaches 0, the operation will be | ||
553 | completed. | ||
554 | |||
555 | |||
556 | (*) Record operation completion: | ||
557 | |||
558 | void fscache_op_complete(struct fscache_operation *op); | ||
559 | |||
560 | This is called to record the completion of an operation. This deducts | ||
561 | this operation from the parent object's run state, potentially permitting | ||
562 | one or more pending operations to start running. | ||
563 | |||
564 | |||
529 | (*) Set highest store limit: | 565 | (*) Set highest store limit: |
530 | 566 | ||
531 | void fscache_set_store_limit(struct fscache_object *object, | 567 | void fscache_set_store_limit(struct fscache_object *object, |
diff --git a/Documentation/filesystems/caching/netfs-api.txt b/Documentation/filesystems/caching/netfs-api.txt index 7cc6bf2871eb..97e6c0ecc5ef 100644 --- a/Documentation/filesystems/caching/netfs-api.txt +++ b/Documentation/filesystems/caching/netfs-api.txt | |||
@@ -35,8 +35,9 @@ This document contains the following sections: | |||
35 | (12) Index and data file update | 35 | (12) Index and data file update |
36 | (13) Miscellaneous cookie operations | 36 | (13) Miscellaneous cookie operations |
37 | (14) Cookie unregistration | 37 | (14) Cookie unregistration |
38 | (15) Index and data file invalidation | 38 | (15) Index invalidation |
39 | (16) FS-Cache specific page flags. | 39 | (16) Data file invalidation |
40 | (17) FS-Cache specific page flags. | ||
40 | 41 | ||
41 | 42 | ||
42 | ============================= | 43 | ============================= |
@@ -767,13 +768,42 @@ the cookies for "child" indices, objects and pages have been relinquished | |||
767 | first. | 768 | first. |
768 | 769 | ||
769 | 770 | ||
770 | ================================ | 771 | ================== |
771 | INDEX AND DATA FILE INVALIDATION | 772 | INDEX INVALIDATION |
772 | ================================ | 773 | ================== |
774 | |||
775 | There is no direct way to invalidate an index subtree. To do this, the caller | ||
776 | should relinquish and retire the cookie they have, and then acquire a new one. | ||
777 | |||
778 | |||
779 | ====================== | ||
780 | DATA FILE INVALIDATION | ||
781 | ====================== | ||
782 | |||
783 | Sometimes it will be necessary to invalidate an object that contains data. | ||
784 | Typically this will be necessary when the server tells the netfs of a foreign | ||
785 | change - at which point the netfs has to throw away all the state it had for an | ||
786 | inode and reload from the server. | ||
787 | |||
788 | To indicate that a cache object should be invalidated, the following function | ||
789 | can be called: | ||
790 | |||
791 | void fscache_invalidate(struct fscache_cookie *cookie); | ||
792 | |||
793 | This can be called with spinlocks held as it defers the work to a thread pool. | ||
794 | All extant storage, retrieval and attribute change ops at this point are | ||
795 | cancelled and discarded. Some future operations will be rejected until the | ||
796 | cache has had a chance to insert a barrier in the operations queue. After | ||
797 | that, operations will be queued again behind the invalidation operation. | ||
798 | |||
799 | The invalidation operation will perform an attribute change operation and an | ||
800 | auxiliary data update operation as it is very likely these will have changed. | ||
801 | |||
802 | Using the following function, the netfs can wait for the invalidation operation | ||
803 | to have reached a point at which it can start submitting ordinary operations | ||
804 | once again: | ||
773 | 805 | ||
774 | There is no direct way to invalidate an index subtree or a data file. To do | 806 | void fscache_wait_on_invalidate(struct fscache_cookie *cookie); |
775 | this, the caller should relinquish and retire the cookie they have, and then | ||
776 | acquire a new one. | ||
777 | 807 | ||
778 | 808 | ||
779 | =========================== | 809 | =========================== |
diff --git a/Documentation/filesystems/caching/object.txt b/Documentation/filesystems/caching/object.txt index 58313348da87..100ff41127e4 100644 --- a/Documentation/filesystems/caching/object.txt +++ b/Documentation/filesystems/caching/object.txt | |||
@@ -216,7 +216,14 @@ servicing netfs requests: | |||
216 | The normal running state. In this state, requests the netfs makes will be | 216 | The normal running state. In this state, requests the netfs makes will be |
217 | passed on to the cache. | 217 | passed on to the cache. |
218 | 218 | ||
219 | (6) State FSCACHE_OBJECT_UPDATING. | 219 | (6) State FSCACHE_OBJECT_INVALIDATING. |
220 | |||
221 | The object is undergoing invalidation. When the state comes here, it | ||
222 | discards all pending read, write and attribute change operations as it is | ||
223 | going to clear out the cache entirely and reinitialise it. It will then | ||
224 | continue to the FSCACHE_OBJECT_UPDATING state. | ||
225 | |||
226 | (7) State FSCACHE_OBJECT_UPDATING. | ||
220 | 227 | ||
221 | The state machine comes here to update the object in the cache from the | 228 | The state machine comes here to update the object in the cache from the |
222 | netfs's records. This involves updating the auxiliary data that is used | 229 | netfs's records. This involves updating the auxiliary data that is used |
@@ -225,13 +232,13 @@ servicing netfs requests: | |||
225 | And there are terminal states in which an object cleans itself up, deallocates | 232 | And there are terminal states in which an object cleans itself up, deallocates |
226 | memory and potentially deletes stuff from disk: | 233 | memory and potentially deletes stuff from disk: |
227 | 234 | ||
228 | (7) State FSCACHE_OBJECT_LC_DYING. | 235 | (8) State FSCACHE_OBJECT_LC_DYING. |
229 | 236 | ||
230 | The object comes here if it is dying because of a lookup or creation | 237 | The object comes here if it is dying because of a lookup or creation |
231 | error. This would be due to a disk error or system error of some sort. | 238 | error. This would be due to a disk error or system error of some sort. |
232 | Temporary data is cleaned up, and the parent is released. | 239 | Temporary data is cleaned up, and the parent is released. |
233 | 240 | ||
234 | (8) State FSCACHE_OBJECT_DYING. | 241 | (9) State FSCACHE_OBJECT_DYING. |
235 | 242 | ||
236 | The object comes here if it is dying due to an error, because its parent | 243 | The object comes here if it is dying due to an error, because its parent |
237 | cookie has been relinquished by the netfs or because the cache is being | 244 | cookie has been relinquished by the netfs or because the cache is being |
@@ -241,27 +248,27 @@ memory and potentially deletes stuff from disk: | |||
241 | can destroy themselves. This object waits for all its children to go away | 248 | can destroy themselves. This object waits for all its children to go away |
242 | before advancing to the next state. | 249 | before advancing to the next state. |
243 | 250 | ||
244 | (9) State FSCACHE_OBJECT_ABORT_INIT. | 251 | (10) State FSCACHE_OBJECT_ABORT_INIT. |
245 | 252 | ||
246 | The object comes to this state if it was waiting on its parent in | 253 | The object comes to this state if it was waiting on its parent in |
247 | FSCACHE_OBJECT_INIT, but its parent died. The object will destroy itself | 254 | FSCACHE_OBJECT_INIT, but its parent died. The object will destroy itself |
248 | so that the parent may proceed from the FSCACHE_OBJECT_DYING state. | 255 | so that the parent may proceed from the FSCACHE_OBJECT_DYING state. |
249 | 256 | ||
250 | (10) State FSCACHE_OBJECT_RELEASING. | 257 | (11) State FSCACHE_OBJECT_RELEASING. |
251 | (11) State FSCACHE_OBJECT_RECYCLING. | 258 | (12) State FSCACHE_OBJECT_RECYCLING. |
252 | 259 | ||
253 | The object comes to one of these two states when dying once it is rid of | 260 | The object comes to one of these two states when dying once it is rid of |
254 | all its children, if it is dying because the netfs relinquished its | 261 | all its children, if it is dying because the netfs relinquished its |
255 | cookie. In the first state, the cached data is expected to persist, and | 262 | cookie. In the first state, the cached data is expected to persist, and |
256 | in the second it will be deleted. | 263 | in the second it will be deleted. |
257 | 264 | ||
258 | (12) State FSCACHE_OBJECT_WITHDRAWING. | 265 | (13) State FSCACHE_OBJECT_WITHDRAWING. |
259 | 266 | ||
260 | The object transits to this state if the cache decides it wants to | 267 | The object transits to this state if the cache decides it wants to |
261 | withdraw the object from service, perhaps to make space, but also due to | 268 | withdraw the object from service, perhaps to make space, but also due to |
262 | error or just because the whole cache is being withdrawn. | 269 | error or just because the whole cache is being withdrawn. |
263 | 270 | ||
264 | (13) State FSCACHE_OBJECT_DEAD. | 271 | (14) State FSCACHE_OBJECT_DEAD. |
265 | 272 | ||
266 | The object transits to this state when the in-memory object record is | 273 | The object transits to this state when the in-memory object record is |
267 | ready to be deleted. The object processor shouldn't ever see an object in | 274 | ready to be deleted. The object processor shouldn't ever see an object in |
diff --git a/Documentation/filesystems/caching/operations.txt b/Documentation/filesystems/caching/operations.txt index b6b070c57cbf..bee2a5f93d60 100644 --- a/Documentation/filesystems/caching/operations.txt +++ b/Documentation/filesystems/caching/operations.txt | |||
@@ -174,7 +174,7 @@ Operations are used through the following procedure: | |||
174 | necessary (the object might have died whilst the thread was waiting). | 174 | necessary (the object might have died whilst the thread was waiting). |
175 | 175 | ||
176 | When it has finished doing its processing, it should call | 176 | When it has finished doing its processing, it should call |
177 | fscache_put_operation() on it. | 177 | fscache_op_complete() and fscache_put_operation() on it. |
178 | 178 | ||
179 | (4) The operation holds an effective lock upon the object, preventing other | 179 | (4) The operation holds an effective lock upon the object, preventing other |
180 | exclusive ops conflicting until it is released. The operation can be | 180 | exclusive ops conflicting until it is released. The operation can be |
diff --git a/Documentation/hwmon/it87 b/Documentation/hwmon/it87 index 87850d86c559..8386aadc0a82 100644 --- a/Documentation/hwmon/it87 +++ b/Documentation/hwmon/it87 | |||
@@ -209,3 +209,13 @@ doesn't use CPU cycles. | |||
209 | Trip points must be set properly before switching to automatic fan speed | 209 | Trip points must be set properly before switching to automatic fan speed |
210 | control mode. The driver will perform basic integrity checks before | 210 | control mode. The driver will perform basic integrity checks before |
211 | actually switching to automatic control mode. | 211 | actually switching to automatic control mode. |
212 | |||
213 | |||
214 | Temperature offset attributes | ||
215 | ----------------------------- | ||
216 | |||
217 | The driver supports temp[1-3]_offset sysfs attributes to adjust the reported | ||
218 | temperature for thermal diodes or diode-connected thermal transistors. | ||
219 | If a temperature sensor is configured for thermistors, the attribute values | ||
220 | are ignored. If the thermal sensor type is Intel PECI, the temperature offset | ||
221 | must be programmed to the critical CPU temperature. | ||
diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile index 0f441740c22a..d077ef8426df 100644 --- a/arch/arm/boot/dts/Makefile +++ b/arch/arm/boot/dts/Makefile | |||
@@ -107,6 +107,7 @@ dtb-$(CONFIG_ARCH_OMAP2PLUS) += omap2420-h4.dtb \ | |||
107 | omap3-evm.dtb \ | 107 | omap3-evm.dtb \ |
108 | omap3-tobi.dtb \ | 108 | omap3-tobi.dtb \ |
109 | omap4-panda.dtb \ | 109 | omap4-panda.dtb \ |
110 | omap4-panda-a4.dtb \ | ||
110 | omap4-panda-es.dtb \ | 111 | omap4-panda-es.dtb \ |
111 | omap4-var-som.dtb \ | 112 | omap4-var-som.dtb \ |
112 | omap4-sdp.dtb \ | 113 | omap4-sdp.dtb \ |
@@ -131,8 +132,8 @@ dtb-$(CONFIG_ARCH_SPEAR3XX)+= spear300-evb.dtb \ | |||
131 | spear320-evb.dtb \ | 132 | spear320-evb.dtb \ |
132 | spear320-hmi.dtb | 133 | spear320-hmi.dtb |
133 | dtb-$(CONFIG_ARCH_SPEAR6XX)+= spear600-evb.dtb | 134 | dtb-$(CONFIG_ARCH_SPEAR6XX)+= spear600-evb.dtb |
134 | dtb-$(CONFIG_ARCH_SUNXI) += sun4i-cubieboard.dtb \ | 135 | dtb-$(CONFIG_ARCH_SUNXI) += sun4i-a10-cubieboard.dtb \ |
135 | sun5i-olinuxino.dtb | 136 | sun5i-a13-olinuxino.dtb |
136 | dtb-$(CONFIG_ARCH_TEGRA) += tegra20-harmony.dtb \ | 137 | dtb-$(CONFIG_ARCH_TEGRA) += tegra20-harmony.dtb \ |
137 | tegra20-medcom-wide.dtb \ | 138 | tegra20-medcom-wide.dtb \ |
138 | tegra20-paz00.dtb \ | 139 | tegra20-paz00.dtb \ |
diff --git a/arch/arm/boot/dts/at91sam9263.dtsi b/arch/arm/boot/dts/at91sam9263.dtsi index 8e6251f1f7a3..32ec62cf5385 100644 --- a/arch/arm/boot/dts/at91sam9263.dtsi +++ b/arch/arm/boot/dts/at91sam9263.dtsi | |||
@@ -368,14 +368,14 @@ | |||
368 | compatible = "atmel,at91rm9200-ssc"; | 368 | compatible = "atmel,at91rm9200-ssc"; |
369 | reg = <0xfff98000 0x4000>; | 369 | reg = <0xfff98000 0x4000>; |
370 | interrupts = <16 4 5>; | 370 | interrupts = <16 4 5>; |
371 | status = "disable"; | 371 | status = "disabled"; |
372 | }; | 372 | }; |
373 | 373 | ||
374 | ssc1: ssc@fff9c000 { | 374 | ssc1: ssc@fff9c000 { |
375 | compatible = "atmel,at91rm9200-ssc"; | 375 | compatible = "atmel,at91rm9200-ssc"; |
376 | reg = <0xfff9c000 0x4000>; | 376 | reg = <0xfff9c000 0x4000>; |
377 | interrupts = <17 4 5>; | 377 | interrupts = <17 4 5>; |
378 | status = "disable"; | 378 | status = "disabled"; |
379 | }; | 379 | }; |
380 | 380 | ||
381 | macb0: ethernet@fffbc000 { | 381 | macb0: ethernet@fffbc000 { |
diff --git a/arch/arm/boot/dts/at91sam9g45.dtsi b/arch/arm/boot/dts/at91sam9g45.dtsi index fa1ae0c5479c..231858ffd850 100644 --- a/arch/arm/boot/dts/at91sam9g45.dtsi +++ b/arch/arm/boot/dts/at91sam9g45.dtsi | |||
@@ -425,14 +425,14 @@ | |||
425 | compatible = "atmel,at91sam9g45-ssc"; | 425 | compatible = "atmel,at91sam9g45-ssc"; |
426 | reg = <0xfff9c000 0x4000>; | 426 | reg = <0xfff9c000 0x4000>; |
427 | interrupts = <16 4 5>; | 427 | interrupts = <16 4 5>; |
428 | status = "disable"; | 428 | status = "disabled"; |
429 | }; | 429 | }; |
430 | 430 | ||
431 | ssc1: ssc@fffa0000 { | 431 | ssc1: ssc@fffa0000 { |
432 | compatible = "atmel,at91sam9g45-ssc"; | 432 | compatible = "atmel,at91sam9g45-ssc"; |
433 | reg = <0xfffa0000 0x4000>; | 433 | reg = <0xfffa0000 0x4000>; |
434 | interrupts = <17 4 5>; | 434 | interrupts = <17 4 5>; |
435 | status = "disable"; | 435 | status = "disabled"; |
436 | }; | 436 | }; |
437 | 437 | ||
438 | adc0: adc@fffb0000 { | 438 | adc0: adc@fffb0000 { |
diff --git a/arch/arm/boot/dts/at91sam9x5.dtsi b/arch/arm/boot/dts/at91sam9x5.dtsi index 617ede541ca2..40ac3a4eb1ab 100644 --- a/arch/arm/boot/dts/at91sam9x5.dtsi +++ b/arch/arm/boot/dts/at91sam9x5.dtsi | |||
@@ -92,7 +92,7 @@ | |||
92 | compatible = "atmel,at91sam9g45-ssc"; | 92 | compatible = "atmel,at91sam9g45-ssc"; |
93 | reg = <0xf0010000 0x4000>; | 93 | reg = <0xf0010000 0x4000>; |
94 | interrupts = <28 4 5>; | 94 | interrupts = <28 4 5>; |
95 | status = "disable"; | 95 | status = "disabled"; |
96 | }; | 96 | }; |
97 | 97 | ||
98 | tcb0: timer@f8008000 { | 98 | tcb0: timer@f8008000 { |
diff --git a/arch/arm/boot/dts/imx27-3ds.dts b/arch/arm/boot/dts/imx27-3ds.dts index b01c0d745fc5..fa04c7b18bcb 100644 --- a/arch/arm/boot/dts/imx27-3ds.dts +++ b/arch/arm/boot/dts/imx27-3ds.dts | |||
@@ -21,17 +21,17 @@ | |||
21 | }; | 21 | }; |
22 | 22 | ||
23 | soc { | 23 | soc { |
24 | aipi@10000000 { /* aipi */ | 24 | aipi@10000000 { /* aipi1 */ |
25 | |||
26 | uart1: serial@1000a000 { | 25 | uart1: serial@1000a000 { |
27 | fsl,uart-has-rtscts; | 26 | fsl,uart-has-rtscts; |
28 | status = "okay"; | 27 | status = "okay"; |
29 | }; | 28 | }; |
29 | }; | ||
30 | 30 | ||
31 | fec@1002b000 { | 31 | aipi@10020000 { /* aipi2 */ |
32 | ethernet@1002b000 { | ||
32 | status = "okay"; | 33 | status = "okay"; |
33 | }; | 34 | }; |
34 | }; | 35 | }; |
35 | }; | 36 | }; |
36 | |||
37 | }; | 37 | }; |
diff --git a/arch/arm/boot/dts/imx27-phytec-phycore.dts b/arch/arm/boot/dts/imx27-phytec-phycore.dts index af50469e34b2..53b0ec0c228e 100644 --- a/arch/arm/boot/dts/imx27-phytec-phycore.dts +++ b/arch/arm/boot/dts/imx27-phytec-phycore.dts | |||
@@ -21,8 +21,7 @@ | |||
21 | }; | 21 | }; |
22 | 22 | ||
23 | soc { | 23 | soc { |
24 | aipi@10000000 { /* aipi */ | 24 | aipi@10000000 { /* aipi1 */ |
25 | |||
26 | serial@1000a000 { | 25 | serial@1000a000 { |
27 | fsl,uart-has-rtscts; | 26 | fsl,uart-has-rtscts; |
28 | status = "okay"; | 27 | status = "okay"; |
@@ -38,10 +37,6 @@ | |||
38 | status = "okay"; | 37 | status = "okay"; |
39 | }; | 38 | }; |
40 | 39 | ||
41 | ethernet@1002b000 { | ||
42 | status = "okay"; | ||
43 | }; | ||
44 | |||
45 | i2c@1001d000 { | 40 | i2c@1001d000 { |
46 | clock-frequency = <400000>; | 41 | clock-frequency = <400000>; |
47 | status = "okay"; | 42 | status = "okay"; |
@@ -60,6 +55,12 @@ | |||
60 | }; | 55 | }; |
61 | }; | 56 | }; |
62 | }; | 57 | }; |
58 | |||
59 | aipi@10020000 { /* aipi2 */ | ||
60 | ethernet@1002b000 { | ||
61 | status = "okay"; | ||
62 | }; | ||
63 | }; | ||
63 | }; | 64 | }; |
64 | 65 | ||
65 | nor_flash@c0000000 { | 66 | nor_flash@c0000000 { |
diff --git a/arch/arm/boot/dts/imx27.dtsi b/arch/arm/boot/dts/imx27.dtsi index b8d3905915ac..5a82cb5707a8 100644 --- a/arch/arm/boot/dts/imx27.dtsi +++ b/arch/arm/boot/dts/imx27.dtsi | |||
@@ -55,7 +55,7 @@ | |||
55 | compatible = "fsl,aipi-bus", "simple-bus"; | 55 | compatible = "fsl,aipi-bus", "simple-bus"; |
56 | #address-cells = <1>; | 56 | #address-cells = <1>; |
57 | #size-cells = <1>; | 57 | #size-cells = <1>; |
58 | reg = <0x10000000 0x10000000>; | 58 | reg = <0x10000000 0x20000>; |
59 | ranges; | 59 | ranges; |
60 | 60 | ||
61 | wdog: wdog@10002000 { | 61 | wdog: wdog@10002000 { |
@@ -211,6 +211,15 @@ | |||
211 | status = "disabled"; | 211 | status = "disabled"; |
212 | }; | 212 | }; |
213 | 213 | ||
214 | }; | ||
215 | |||
216 | aipi@10020000 { /* AIPI2 */ | ||
217 | compatible = "fsl,aipi-bus", "simple-bus"; | ||
218 | #address-cells = <1>; | ||
219 | #size-cells = <1>; | ||
220 | reg = <0x10020000 0x20000>; | ||
221 | ranges; | ||
222 | |||
214 | fec: ethernet@1002b000 { | 223 | fec: ethernet@1002b000 { |
215 | compatible = "fsl,imx27-fec"; | 224 | compatible = "fsl,imx27-fec"; |
216 | reg = <0x1002b000 0x4000>; | 225 | reg = <0x1002b000 0x4000>; |
diff --git a/arch/arm/boot/dts/omap2420-h4.dts b/arch/arm/boot/dts/omap2420-h4.dts index 77b84e17c477..9b0d07746cba 100644 --- a/arch/arm/boot/dts/omap2420-h4.dts +++ b/arch/arm/boot/dts/omap2420-h4.dts | |||
@@ -15,6 +15,6 @@ | |||
15 | 15 | ||
16 | memory { | 16 | memory { |
17 | device_type = "memory"; | 17 | device_type = "memory"; |
18 | reg = <0x80000000 0x84000000>; /* 64 MB */ | 18 | reg = <0x80000000 0x4000000>; /* 64 MB */ |
19 | }; | 19 | }; |
20 | }; | 20 | }; |
diff --git a/arch/arm/boot/dts/sun4i-cubieboard.dts b/arch/arm/boot/dts/sun4i-cubieboard.dts index f4ca126ad994..5cab82540437 100644 --- a/arch/arm/boot/dts/sun4i-cubieboard.dts +++ b/arch/arm/boot/dts/sun4i-cubieboard.dts | |||
@@ -11,11 +11,11 @@ | |||
11 | */ | 11 | */ |
12 | 12 | ||
13 | /dts-v1/; | 13 | /dts-v1/; |
14 | /include/ "sun4i.dtsi" | 14 | /include/ "sun4i-a10.dtsi" |
15 | 15 | ||
16 | / { | 16 | / { |
17 | model = "Cubietech Cubieboard"; | 17 | model = "Cubietech Cubieboard"; |
18 | compatible = "cubietech,cubieboard", "allwinner,sun4i"; | 18 | compatible = "cubietech,a10-cubieboard", "allwinner,sun4i-a10"; |
19 | 19 | ||
20 | aliases { | 20 | aliases { |
21 | serial0 = &uart0; | 21 | serial0 = &uart0; |
diff --git a/arch/arm/boot/dts/sun5i-olinuxino.dts b/arch/arm/boot/dts/sun5i-olinuxino.dts index d6ff889a5d87..498a091a4ea2 100644 --- a/arch/arm/boot/dts/sun5i-olinuxino.dts +++ b/arch/arm/boot/dts/sun5i-olinuxino.dts | |||
@@ -12,11 +12,11 @@ | |||
12 | */ | 12 | */ |
13 | 13 | ||
14 | /dts-v1/; | 14 | /dts-v1/; |
15 | /include/ "sun5i.dtsi" | 15 | /include/ "sun5i-a13.dtsi" |
16 | 16 | ||
17 | / { | 17 | / { |
18 | model = "Olimex A13-Olinuxino"; | 18 | model = "Olimex A13-Olinuxino"; |
19 | compatible = "olimex,a13-olinuxino", "allwinner,sun5i"; | 19 | compatible = "olimex,a13-olinuxino", "allwinner,sun5i-a13"; |
20 | 20 | ||
21 | chosen { | 21 | chosen { |
22 | bootargs = "earlyprintk console=ttyS0,115200"; | 22 | bootargs = "earlyprintk console=ttyS0,115200"; |
diff --git a/arch/arm/mach-davinci/board-da850-evm.c b/arch/arm/mach-davinci/board-da850-evm.c index 7211772edd9d..0299915575a8 100644 --- a/arch/arm/mach-davinci/board-da850-evm.c +++ b/arch/arm/mach-davinci/board-da850-evm.c | |||
@@ -41,6 +41,7 @@ | |||
41 | #include <mach/cp_intc.h> | 41 | #include <mach/cp_intc.h> |
42 | #include <mach/da8xx.h> | 42 | #include <mach/da8xx.h> |
43 | #include <mach/mux.h> | 43 | #include <mach/mux.h> |
44 | #include <mach/sram.h> | ||
44 | 45 | ||
45 | #include <asm/mach-types.h> | 46 | #include <asm/mach-types.h> |
46 | #include <asm/mach/arch.h> | 47 | #include <asm/mach/arch.h> |
diff --git a/arch/arm/mach-ep93xx/include/mach/uncompress.h b/arch/arm/mach-ep93xx/include/mach/uncompress.h index 16026c2b1c8c..d64274fc5760 100644 --- a/arch/arm/mach-ep93xx/include/mach/uncompress.h +++ b/arch/arm/mach-ep93xx/include/mach/uncompress.h | |||
@@ -47,13 +47,9 @@ static void __raw_writel(unsigned int value, unsigned int ptr) | |||
47 | 47 | ||
48 | static inline void putc(int c) | 48 | static inline void putc(int c) |
49 | { | 49 | { |
50 | int i; | 50 | /* Transmit fifo not full? */ |
51 | 51 | while (__raw_readb(PHYS_UART_FLAG) & UART_FLAG_TXFF) | |
52 | for (i = 0; i < 1000; i++) { | 52 | ; |
53 | /* Transmit fifo not full? */ | ||
54 | if (!(__raw_readb(PHYS_UART_FLAG) & UART_FLAG_TXFF)) | ||
55 | break; | ||
56 | } | ||
57 | 53 | ||
58 | __raw_writeb(c, PHYS_UART_DATA); | 54 | __raw_writeb(c, PHYS_UART_DATA); |
59 | } | 55 | } |
diff --git a/arch/arm/mach-exynos/common.h b/arch/arm/mach-exynos/common.h index dac146df79ac..04744f9c120f 100644 --- a/arch/arm/mach-exynos/common.h +++ b/arch/arm/mach-exynos/common.h | |||
@@ -25,7 +25,7 @@ void exynos_init_late(void); | |||
25 | #ifdef CONFIG_PM_GENERIC_DOMAINS | 25 | #ifdef CONFIG_PM_GENERIC_DOMAINS |
26 | int exynos_pm_late_initcall(void); | 26 | int exynos_pm_late_initcall(void); |
27 | #else | 27 | #else |
28 | static int exynos_pm_late_initcall(void) { return 0; } | 28 | static inline int exynos_pm_late_initcall(void) { return 0; } |
29 | #endif | 29 | #endif |
30 | 30 | ||
31 | #ifdef CONFIG_ARCH_EXYNOS4 | 31 | #ifdef CONFIG_ARCH_EXYNOS4 |
diff --git a/arch/arm/mach-imx/clk-imx51-imx53.c b/arch/arm/mach-imx/clk-imx51-imx53.c index e8c0473c7568..579023f59dc1 100644 --- a/arch/arm/mach-imx/clk-imx51-imx53.c +++ b/arch/arm/mach-imx/clk-imx51-imx53.c | |||
@@ -319,6 +319,7 @@ int __init mx51_clocks_init(unsigned long rate_ckil, unsigned long rate_osc, | |||
319 | unsigned long rate_ckih1, unsigned long rate_ckih2) | 319 | unsigned long rate_ckih1, unsigned long rate_ckih2) |
320 | { | 320 | { |
321 | int i; | 321 | int i; |
322 | u32 val; | ||
322 | struct device_node *np; | 323 | struct device_node *np; |
323 | 324 | ||
324 | clk[pll1_sw] = imx_clk_pllv2("pll1_sw", "osc", MX51_DPLL1_BASE); | 325 | clk[pll1_sw] = imx_clk_pllv2("pll1_sw", "osc", MX51_DPLL1_BASE); |
@@ -390,6 +391,21 @@ int __init mx51_clocks_init(unsigned long rate_ckil, unsigned long rate_osc, | |||
390 | imx_print_silicon_rev("i.MX51", mx51_revision()); | 391 | imx_print_silicon_rev("i.MX51", mx51_revision()); |
391 | clk_disable_unprepare(clk[iim_gate]); | 392 | clk_disable_unprepare(clk[iim_gate]); |
392 | 393 | ||
394 | /* | ||
395 | * Reference Manual says: Functionality of CCDR[18] and CLPCR[23] is no | ||
396 | * longer supported. Set to one for better power saving. | ||
397 | * | ||
398 | * The effect of not setting these bits is that MIPI clocks can't be | ||
399 | * enabled without the IPU clock being enabled aswell. | ||
400 | */ | ||
401 | val = readl(MXC_CCM_CCDR); | ||
402 | val |= 1 << 18; | ||
403 | writel(val, MXC_CCM_CCDR); | ||
404 | |||
405 | val = readl(MXC_CCM_CLPCR); | ||
406 | val |= 1 << 23; | ||
407 | writel(val, MXC_CCM_CLPCR); | ||
408 | |||
393 | return 0; | 409 | return 0; |
394 | } | 410 | } |
395 | 411 | ||
diff --git a/arch/arm/plat-mxc/devices/platform-mx2-emma.c b/arch/arm/mach-imx/devices/platform-mx2-emma.c index 508404ddd4ea..11bd01d402f2 100644 --- a/arch/arm/plat-mxc/devices/platform-mx2-emma.c +++ b/arch/arm/mach-imx/devices/platform-mx2-emma.c | |||
@@ -6,8 +6,8 @@ | |||
6 | * the terms of the GNU General Public License version 2 as published by the | 6 | * the terms of the GNU General Public License version 2 as published by the |
7 | * Free Software Foundation. | 7 | * Free Software Foundation. |
8 | */ | 8 | */ |
9 | #include <mach/hardware.h> | 9 | #include "../hardware.h" |
10 | #include <mach/devices-common.h> | 10 | #include "devices-common.h" |
11 | 11 | ||
12 | #define imx_mx2_emmaprp_data_entry_single(soc) \ | 12 | #define imx_mx2_emmaprp_data_entry_single(soc) \ |
13 | { \ | 13 | { \ |
diff --git a/arch/arm/mach-omap2/Kconfig b/arch/arm/mach-omap2/Kconfig index be0f62bf9037..41b581fd0213 100644 --- a/arch/arm/mach-omap2/Kconfig +++ b/arch/arm/mach-omap2/Kconfig | |||
@@ -26,6 +26,8 @@ config SOC_HAS_OMAP2_SDRC | |||
26 | 26 | ||
27 | config SOC_HAS_REALTIME_COUNTER | 27 | config SOC_HAS_REALTIME_COUNTER |
28 | bool "Real time free running counter" | 28 | bool "Real time free running counter" |
29 | depends on SOC_OMAP5 | ||
30 | default y | ||
29 | 31 | ||
30 | config ARCH_OMAP2 | 32 | config ARCH_OMAP2 |
31 | bool "TI OMAP2" | 33 | bool "TI OMAP2" |
@@ -79,7 +81,6 @@ config SOC_OMAP5 | |||
79 | select ARM_GIC | 81 | select ARM_GIC |
80 | select CPU_V7 | 82 | select CPU_V7 |
81 | select HAVE_SMP | 83 | select HAVE_SMP |
82 | select SOC_HAS_REALTIME_COUNTER | ||
83 | select COMMON_CLK | 84 | select COMMON_CLK |
84 | 85 | ||
85 | comment "OMAP Core Type" | 86 | comment "OMAP Core Type" |
diff --git a/arch/arm/mach-omap2/board-3430sdp.c b/arch/arm/mach-omap2/board-3430sdp.c index 7b201546834d..bb73afc9ac17 100644 --- a/arch/arm/mach-omap2/board-3430sdp.c +++ b/arch/arm/mach-omap2/board-3430sdp.c | |||
@@ -157,6 +157,7 @@ static struct omap_dss_device sdp3430_lcd_device = { | |||
157 | 157 | ||
158 | static struct tfp410_platform_data dvi_panel = { | 158 | static struct tfp410_platform_data dvi_panel = { |
159 | .power_down_gpio = -1, | 159 | .power_down_gpio = -1, |
160 | .i2c_bus_num = -1, | ||
160 | }; | 161 | }; |
161 | 162 | ||
162 | static struct omap_dss_device sdp3430_dvi_device = { | 163 | static struct omap_dss_device sdp3430_dvi_device = { |
diff --git a/arch/arm/mach-omap2/board-am3517evm.c b/arch/arm/mach-omap2/board-am3517evm.c index 4be58fd071f6..f81a303b87ff 100644 --- a/arch/arm/mach-omap2/board-am3517evm.c +++ b/arch/arm/mach-omap2/board-am3517evm.c | |||
@@ -208,6 +208,7 @@ static struct omap_dss_device am3517_evm_tv_device = { | |||
208 | 208 | ||
209 | static struct tfp410_platform_data dvi_panel = { | 209 | static struct tfp410_platform_data dvi_panel = { |
210 | .power_down_gpio = -1, | 210 | .power_down_gpio = -1, |
211 | .i2c_bus_num = -1, | ||
211 | }; | 212 | }; |
212 | 213 | ||
213 | static struct omap_dss_device am3517_evm_dvi_device = { | 214 | static struct omap_dss_device am3517_evm_dvi_device = { |
diff --git a/arch/arm/mach-omap2/board-cm-t35.c b/arch/arm/mach-omap2/board-cm-t35.c index c8e37dc00892..b3102c2f4a3c 100644 --- a/arch/arm/mach-omap2/board-cm-t35.c +++ b/arch/arm/mach-omap2/board-cm-t35.c | |||
@@ -241,6 +241,7 @@ static struct omap_dss_device cm_t35_lcd_device = { | |||
241 | 241 | ||
242 | static struct tfp410_platform_data dvi_panel = { | 242 | static struct tfp410_platform_data dvi_panel = { |
243 | .power_down_gpio = CM_T35_DVI_EN_GPIO, | 243 | .power_down_gpio = CM_T35_DVI_EN_GPIO, |
244 | .i2c_bus_num = -1, | ||
244 | }; | 245 | }; |
245 | 246 | ||
246 | static struct omap_dss_device cm_t35_dvi_device = { | 247 | static struct omap_dss_device cm_t35_dvi_device = { |
diff --git a/arch/arm/mach-omap2/board-devkit8000.c b/arch/arm/mach-omap2/board-devkit8000.c index 7667eb749522..12865af25d3a 100644 --- a/arch/arm/mach-omap2/board-devkit8000.c +++ b/arch/arm/mach-omap2/board-devkit8000.c | |||
@@ -141,6 +141,7 @@ static struct omap_dss_device devkit8000_lcd_device = { | |||
141 | 141 | ||
142 | static struct tfp410_platform_data dvi_panel = { | 142 | static struct tfp410_platform_data dvi_panel = { |
143 | .power_down_gpio = -1, | 143 | .power_down_gpio = -1, |
144 | .i2c_bus_num = 1, | ||
144 | }; | 145 | }; |
145 | 146 | ||
146 | static struct omap_dss_device devkit8000_dvi_device = { | 147 | static struct omap_dss_device devkit8000_dvi_device = { |
diff --git a/arch/arm/mach-omap2/board-h4.c b/arch/arm/mach-omap2/board-h4.c index 9a3878ec2256..3be1311f9e33 100644 --- a/arch/arm/mach-omap2/board-h4.c +++ b/arch/arm/mach-omap2/board-h4.c | |||
@@ -27,14 +27,12 @@ | |||
27 | #include <linux/io.h> | 27 | #include <linux/io.h> |
28 | #include <linux/input/matrix_keypad.h> | 28 | #include <linux/input/matrix_keypad.h> |
29 | #include <linux/mfd/menelaus.h> | 29 | #include <linux/mfd/menelaus.h> |
30 | #include <linux/omap-dma.h> | ||
30 | 31 | ||
31 | #include <asm/mach-types.h> | 32 | #include <asm/mach-types.h> |
32 | #include <asm/mach/arch.h> | 33 | #include <asm/mach/arch.h> |
33 | #include <asm/mach/map.h> | 34 | #include <asm/mach/map.h> |
34 | 35 | ||
35 | #include <linux/omap-dma.h> | ||
36 | #include <plat/debug-devices.h> | ||
37 | |||
38 | #include <video/omapdss.h> | 36 | #include <video/omapdss.h> |
39 | #include <video/omap-panel-generic-dpi.h> | 37 | #include <video/omap-panel-generic-dpi.h> |
40 | 38 | ||
@@ -42,11 +40,9 @@ | |||
42 | #include "mux.h" | 40 | #include "mux.h" |
43 | #include "control.h" | 41 | #include "control.h" |
44 | #include "gpmc.h" | 42 | #include "gpmc.h" |
43 | #include "gpmc-smc91x.h" | ||
45 | 44 | ||
46 | #define H4_FLASH_CS 0 | 45 | #define H4_FLASH_CS 0 |
47 | #define H4_SMC91X_CS 1 | ||
48 | |||
49 | #define H4_ETHR_GPIO_IRQ 92 | ||
50 | 46 | ||
51 | #if defined(CONFIG_KEYBOARD_MATRIX) || defined(CONFIG_KEYBOARD_MATRIX_MODULE) | 47 | #if defined(CONFIG_KEYBOARD_MATRIX) || defined(CONFIG_KEYBOARD_MATRIX_MODULE) |
52 | static const uint32_t board_matrix_keys[] = { | 48 | static const uint32_t board_matrix_keys[] = { |
@@ -250,71 +246,31 @@ static u32 is_gpmc_muxed(void) | |||
250 | return 0; | 246 | return 0; |
251 | } | 247 | } |
252 | 248 | ||
253 | static inline void __init h4_init_debug(void) | 249 | #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91x_MODULE) |
254 | { | ||
255 | int eth_cs; | ||
256 | unsigned long cs_mem_base; | ||
257 | unsigned int muxed, rate; | ||
258 | struct clk *gpmc_fck; | ||
259 | |||
260 | eth_cs = H4_SMC91X_CS; | ||
261 | 250 | ||
262 | gpmc_fck = clk_get(NULL, "gpmc_fck"); /* Always on ENABLE_ON_INIT */ | 251 | static struct omap_smc91x_platform_data board_smc91x_data = { |
263 | if (IS_ERR(gpmc_fck)) { | 252 | .cs = 1, |
264 | WARN_ON(1); | 253 | .gpio_irq = 92, |
265 | return; | 254 | .flags = GPMC_TIMINGS_SMC91C96 | IORESOURCE_IRQ_LOWLEVEL, |
266 | } | 255 | }; |
267 | |||
268 | clk_prepare_enable(gpmc_fck); | ||
269 | rate = clk_get_rate(gpmc_fck); | ||
270 | clk_disable_unprepare(gpmc_fck); | ||
271 | clk_put(gpmc_fck); | ||
272 | 256 | ||
257 | static void __init board_smc91x_init(void) | ||
258 | { | ||
273 | if (is_gpmc_muxed()) | 259 | if (is_gpmc_muxed()) |
274 | muxed = 0x200; | 260 | board_smc91x_data.flags |= GPMC_MUX_ADD_DATA; |
275 | else | ||
276 | muxed = 0; | ||
277 | |||
278 | /* Make sure CS1 timings are correct */ | ||
279 | gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG1, | ||
280 | 0x00011000 | muxed); | ||
281 | |||
282 | if (rate >= 160000000) { | ||
283 | gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG2, 0x001f1f01); | ||
284 | gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG3, 0x00080803); | ||
285 | gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG4, 0x1c0b1c0a); | ||
286 | gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG5, 0x041f1F1F); | ||
287 | gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG6, 0x000004C4); | ||
288 | } else if (rate >= 130000000) { | ||
289 | gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG2, 0x001f1f00); | ||
290 | gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG3, 0x00080802); | ||
291 | gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG4, 0x1C091C09); | ||
292 | gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG5, 0x041f1F1F); | ||
293 | gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG6, 0x000004C4); | ||
294 | } else {/* rate = 100000000 */ | ||
295 | gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG2, 0x001f1f00); | ||
296 | gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG3, 0x00080802); | ||
297 | gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG4, 0x1C091C09); | ||
298 | gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG5, 0x031A1F1F); | ||
299 | gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG6, 0x000003C2); | ||
300 | } | ||
301 | |||
302 | if (gpmc_cs_request(eth_cs, SZ_16M, &cs_mem_base) < 0) { | ||
303 | printk(KERN_ERR "Failed to request GPMC mem for smc91x\n"); | ||
304 | goto out; | ||
305 | } | ||
306 | 261 | ||
307 | udelay(100); | 262 | omap_mux_init_gpio(board_smc91x_data.gpio_irq, OMAP_PIN_INPUT); |
263 | gpmc_smc91x_init(&board_smc91x_data); | ||
264 | } | ||
308 | 265 | ||
309 | omap_mux_init_gpio(92, 0); | 266 | #else |
310 | if (debug_card_init(cs_mem_base, H4_ETHR_GPIO_IRQ) < 0) | ||
311 | gpmc_cs_free(eth_cs); | ||
312 | 267 | ||
313 | out: | 268 | static inline void board_smc91x_init(void) |
314 | clk_disable_unprepare(gpmc_fck); | 269 | { |
315 | clk_put(gpmc_fck); | ||
316 | } | 270 | } |
317 | 271 | ||
272 | #endif | ||
273 | |||
318 | static void __init h4_init_flash(void) | 274 | static void __init h4_init_flash(void) |
319 | { | 275 | { |
320 | unsigned long base; | 276 | unsigned long base; |
@@ -371,6 +327,7 @@ static void __init omap_h4_init(void) | |||
371 | omap_serial_init(); | 327 | omap_serial_init(); |
372 | omap_sdrc_init(NULL, NULL); | 328 | omap_sdrc_init(NULL, NULL); |
373 | h4_init_flash(); | 329 | h4_init_flash(); |
330 | board_smc91x_init(); | ||
374 | 331 | ||
375 | omap_display_init(&h4_dss_data); | 332 | omap_display_init(&h4_dss_data); |
376 | } | 333 | } |
diff --git a/arch/arm/mach-omap2/board-omap3evm.c b/arch/arm/mach-omap2/board-omap3evm.c index 54647d6286b4..3985f35aee06 100644 --- a/arch/arm/mach-omap2/board-omap3evm.c +++ b/arch/arm/mach-omap2/board-omap3evm.c | |||
@@ -240,6 +240,7 @@ static struct omap_dss_device omap3_evm_tv_device = { | |||
240 | 240 | ||
241 | static struct tfp410_platform_data dvi_panel = { | 241 | static struct tfp410_platform_data dvi_panel = { |
242 | .power_down_gpio = OMAP3EVM_DVI_PANEL_EN_GPIO, | 242 | .power_down_gpio = OMAP3EVM_DVI_PANEL_EN_GPIO, |
243 | .i2c_bus_num = -1, | ||
243 | }; | 244 | }; |
244 | 245 | ||
245 | static struct omap_dss_device omap3_evm_dvi_device = { | 246 | static struct omap_dss_device omap3_evm_dvi_device = { |
diff --git a/arch/arm/mach-omap2/board-omap3stalker.c b/arch/arm/mach-omap2/board-omap3stalker.c index d8638b3b4f94..53a6cbcf9747 100644 --- a/arch/arm/mach-omap2/board-omap3stalker.c +++ b/arch/arm/mach-omap2/board-omap3stalker.c | |||
@@ -118,6 +118,7 @@ static struct omap_dss_device omap3_stalker_tv_device = { | |||
118 | 118 | ||
119 | static struct tfp410_platform_data dvi_panel = { | 119 | static struct tfp410_platform_data dvi_panel = { |
120 | .power_down_gpio = DSS_ENABLE_GPIO, | 120 | .power_down_gpio = DSS_ENABLE_GPIO, |
121 | .i2c_bus_num = -1, | ||
121 | }; | 122 | }; |
122 | 123 | ||
123 | static struct omap_dss_device omap3_stalker_dvi_device = { | 124 | static struct omap_dss_device omap3_stalker_dvi_device = { |
diff --git a/arch/arm/mach-omap2/cclock44xx_data.c b/arch/arm/mach-omap2/cclock44xx_data.c index aa56c3e5bb34..5789a5e25563 100644 --- a/arch/arm/mach-omap2/cclock44xx_data.c +++ b/arch/arm/mach-omap2/cclock44xx_data.c | |||
@@ -40,6 +40,14 @@ | |||
40 | #define OMAP4430_MODULEMODE_HWCTRL_SHIFT 0 | 40 | #define OMAP4430_MODULEMODE_HWCTRL_SHIFT 0 |
41 | #define OMAP4430_MODULEMODE_SWCTRL_SHIFT 1 | 41 | #define OMAP4430_MODULEMODE_SWCTRL_SHIFT 1 |
42 | 42 | ||
43 | /* | ||
44 | * OMAP4 ABE DPLL default frequency. In OMAP4460 TRM version V, section | ||
45 | * "3.6.3.2.3 CM1_ABE Clock Generator" states that the "DPLL_ABE_X2_CLK | ||
46 | * must be set to 196.608 MHz" and hence, the DPLL locked frequency is | ||
47 | * half of this value. | ||
48 | */ | ||
49 | #define OMAP4_DPLL_ABE_DEFFREQ 98304000 | ||
50 | |||
43 | /* Root clocks */ | 51 | /* Root clocks */ |
44 | 52 | ||
45 | DEFINE_CLK_FIXED_RATE(extalt_clkin_ck, CLK_IS_ROOT, 59000000, 0x0); | 53 | DEFINE_CLK_FIXED_RATE(extalt_clkin_ck, CLK_IS_ROOT, 59000000, 0x0); |
@@ -124,6 +132,8 @@ static struct dpll_data dpll_abe_dd = { | |||
124 | .enable_mask = OMAP4430_DPLL_EN_MASK, | 132 | .enable_mask = OMAP4430_DPLL_EN_MASK, |
125 | .autoidle_mask = OMAP4430_AUTO_DPLL_MODE_MASK, | 133 | .autoidle_mask = OMAP4430_AUTO_DPLL_MODE_MASK, |
126 | .idlest_mask = OMAP4430_ST_DPLL_CLK_MASK, | 134 | .idlest_mask = OMAP4430_ST_DPLL_CLK_MASK, |
135 | .m4xen_mask = OMAP4430_DPLL_REGM4XEN_MASK, | ||
136 | .lpmode_mask = OMAP4430_DPLL_LPMODE_EN_MASK, | ||
127 | .max_multiplier = 2047, | 137 | .max_multiplier = 2047, |
128 | .max_divider = 128, | 138 | .max_divider = 128, |
129 | .min_divider = 1, | 139 | .min_divider = 1, |
@@ -233,7 +243,7 @@ static struct dpll_data dpll_core_dd = { | |||
233 | 243 | ||
234 | 244 | ||
235 | static const char *dpll_core_ck_parents[] = { | 245 | static const char *dpll_core_ck_parents[] = { |
236 | "sys_clkin_ck", | 246 | "sys_clkin_ck", "core_hsd_byp_clk_mux_ck" |
237 | }; | 247 | }; |
238 | 248 | ||
239 | static struct clk dpll_core_ck; | 249 | static struct clk dpll_core_ck; |
@@ -286,9 +296,9 @@ DEFINE_CLK_DIVIDER(div_core_ck, "dpll_core_m5x2_ck", &dpll_core_m5x2_ck, 0x0, | |||
286 | OMAP4430_CM_CLKSEL_CORE, OMAP4430_CLKSEL_CORE_SHIFT, | 296 | OMAP4430_CM_CLKSEL_CORE, OMAP4430_CLKSEL_CORE_SHIFT, |
287 | OMAP4430_CLKSEL_CORE_WIDTH, 0x0, NULL); | 297 | OMAP4430_CLKSEL_CORE_WIDTH, 0x0, NULL); |
288 | 298 | ||
289 | DEFINE_CLK_OMAP_HSDIVIDER(div_iva_hs_clk, "dpll_core_m5x2_ck", | 299 | DEFINE_CLK_DIVIDER(div_iva_hs_clk, "dpll_core_m5x2_ck", &dpll_core_m5x2_ck, |
290 | &dpll_core_m5x2_ck, 0x0, OMAP4430_CM_BYPCLK_DPLL_IVA, | 300 | 0x0, OMAP4430_CM_BYPCLK_DPLL_IVA, OMAP4430_CLKSEL_0_1_SHIFT, |
291 | OMAP4430_CLKSEL_0_1_MASK); | 301 | OMAP4430_CLKSEL_0_1_WIDTH, CLK_DIVIDER_POWER_OF_TWO, NULL); |
292 | 302 | ||
293 | DEFINE_CLK_DIVIDER(div_mpu_hs_clk, "dpll_core_m5x2_ck", &dpll_core_m5x2_ck, | 303 | DEFINE_CLK_DIVIDER(div_mpu_hs_clk, "dpll_core_m5x2_ck", &dpll_core_m5x2_ck, |
294 | 0x0, OMAP4430_CM_BYPCLK_DPLL_MPU, OMAP4430_CLKSEL_0_1_SHIFT, | 304 | 0x0, OMAP4430_CM_BYPCLK_DPLL_MPU, OMAP4430_CLKSEL_0_1_SHIFT, |
@@ -363,8 +373,21 @@ static struct dpll_data dpll_iva_dd = { | |||
363 | .min_divider = 1, | 373 | .min_divider = 1, |
364 | }; | 374 | }; |
365 | 375 | ||
376 | static const char *dpll_iva_ck_parents[] = { | ||
377 | "sys_clkin_ck", "iva_hsd_byp_clk_mux_ck" | ||
378 | }; | ||
379 | |||
366 | static struct clk dpll_iva_ck; | 380 | static struct clk dpll_iva_ck; |
367 | 381 | ||
382 | static const struct clk_ops dpll_ck_ops = { | ||
383 | .enable = &omap3_noncore_dpll_enable, | ||
384 | .disable = &omap3_noncore_dpll_disable, | ||
385 | .recalc_rate = &omap3_dpll_recalc, | ||
386 | .round_rate = &omap2_dpll_round_rate, | ||
387 | .set_rate = &omap3_noncore_dpll_set_rate, | ||
388 | .get_parent = &omap2_init_dpll_parent, | ||
389 | }; | ||
390 | |||
368 | static struct clk_hw_omap dpll_iva_ck_hw = { | 391 | static struct clk_hw_omap dpll_iva_ck_hw = { |
369 | .hw = { | 392 | .hw = { |
370 | .clk = &dpll_iva_ck, | 393 | .clk = &dpll_iva_ck, |
@@ -373,7 +396,7 @@ static struct clk_hw_omap dpll_iva_ck_hw = { | |||
373 | .ops = &clkhwops_omap3_dpll, | 396 | .ops = &clkhwops_omap3_dpll, |
374 | }; | 397 | }; |
375 | 398 | ||
376 | DEFINE_STRUCT_CLK(dpll_iva_ck, dpll_core_ck_parents, dpll_abe_ck_ops); | 399 | DEFINE_STRUCT_CLK(dpll_iva_ck, dpll_iva_ck_parents, dpll_ck_ops); |
377 | 400 | ||
378 | static const char *dpll_iva_x2_ck_parents[] = { | 401 | static const char *dpll_iva_x2_ck_parents[] = { |
379 | "dpll_iva_ck", | 402 | "dpll_iva_ck", |
@@ -416,6 +439,10 @@ static struct dpll_data dpll_mpu_dd = { | |||
416 | .min_divider = 1, | 439 | .min_divider = 1, |
417 | }; | 440 | }; |
418 | 441 | ||
442 | static const char *dpll_mpu_ck_parents[] = { | ||
443 | "sys_clkin_ck", "div_mpu_hs_clk" | ||
444 | }; | ||
445 | |||
419 | static struct clk dpll_mpu_ck; | 446 | static struct clk dpll_mpu_ck; |
420 | 447 | ||
421 | static struct clk_hw_omap dpll_mpu_ck_hw = { | 448 | static struct clk_hw_omap dpll_mpu_ck_hw = { |
@@ -426,7 +453,7 @@ static struct clk_hw_omap dpll_mpu_ck_hw = { | |||
426 | .ops = &clkhwops_omap3_dpll, | 453 | .ops = &clkhwops_omap3_dpll, |
427 | }; | 454 | }; |
428 | 455 | ||
429 | DEFINE_STRUCT_CLK(dpll_mpu_ck, dpll_core_ck_parents, dpll_abe_ck_ops); | 456 | DEFINE_STRUCT_CLK(dpll_mpu_ck, dpll_mpu_ck_parents, dpll_ck_ops); |
430 | 457 | ||
431 | DEFINE_CLK_FIXED_FACTOR(mpu_periphclk, "dpll_mpu_ck", &dpll_mpu_ck, 0x0, 1, 2); | 458 | DEFINE_CLK_FIXED_FACTOR(mpu_periphclk, "dpll_mpu_ck", &dpll_mpu_ck, 0x0, 1, 2); |
432 | 459 | ||
@@ -464,6 +491,9 @@ static struct dpll_data dpll_per_dd = { | |||
464 | .min_divider = 1, | 491 | .min_divider = 1, |
465 | }; | 492 | }; |
466 | 493 | ||
494 | static const char *dpll_per_ck_parents[] = { | ||
495 | "sys_clkin_ck", "per_hsd_byp_clk_mux_ck" | ||
496 | }; | ||
467 | 497 | ||
468 | static struct clk dpll_per_ck; | 498 | static struct clk dpll_per_ck; |
469 | 499 | ||
@@ -475,7 +505,7 @@ static struct clk_hw_omap dpll_per_ck_hw = { | |||
475 | .ops = &clkhwops_omap3_dpll, | 505 | .ops = &clkhwops_omap3_dpll, |
476 | }; | 506 | }; |
477 | 507 | ||
478 | DEFINE_STRUCT_CLK(dpll_per_ck, dpll_core_ck_parents, dpll_abe_ck_ops); | 508 | DEFINE_STRUCT_CLK(dpll_per_ck, dpll_per_ck_parents, dpll_ck_ops); |
479 | 509 | ||
480 | DEFINE_CLK_DIVIDER(dpll_per_m2_ck, "dpll_per_ck", &dpll_per_ck, 0x0, | 510 | DEFINE_CLK_DIVIDER(dpll_per_m2_ck, "dpll_per_ck", &dpll_per_ck, 0x0, |
481 | OMAP4430_CM_DIV_M2_DPLL_PER, OMAP4430_DPLL_CLKOUT_DIV_SHIFT, | 511 | OMAP4430_CM_DIV_M2_DPLL_PER, OMAP4430_DPLL_CLKOUT_DIV_SHIFT, |
@@ -559,6 +589,10 @@ static struct dpll_data dpll_usb_dd = { | |||
559 | .min_divider = 1, | 589 | .min_divider = 1, |
560 | }; | 590 | }; |
561 | 591 | ||
592 | static const char *dpll_usb_ck_parents[] = { | ||
593 | "sys_clkin_ck", "usb_hs_clk_div_ck" | ||
594 | }; | ||
595 | |||
562 | static struct clk dpll_usb_ck; | 596 | static struct clk dpll_usb_ck; |
563 | 597 | ||
564 | static struct clk_hw_omap dpll_usb_ck_hw = { | 598 | static struct clk_hw_omap dpll_usb_ck_hw = { |
@@ -569,7 +603,7 @@ static struct clk_hw_omap dpll_usb_ck_hw = { | |||
569 | .ops = &clkhwops_omap3_dpll, | 603 | .ops = &clkhwops_omap3_dpll, |
570 | }; | 604 | }; |
571 | 605 | ||
572 | DEFINE_STRUCT_CLK(dpll_usb_ck, dpll_core_ck_parents, dpll_abe_ck_ops); | 606 | DEFINE_STRUCT_CLK(dpll_usb_ck, dpll_usb_ck_parents, dpll_ck_ops); |
573 | 607 | ||
574 | static const char *dpll_usb_clkdcoldo_ck_parents[] = { | 608 | static const char *dpll_usb_clkdcoldo_ck_parents[] = { |
575 | "dpll_usb_ck", | 609 | "dpll_usb_ck", |
@@ -696,9 +730,13 @@ DEFINE_CLK_DIVIDER(syc_clk_div_ck, "sys_clkin_ck", &sys_clkin_ck, 0x0, | |||
696 | OMAP4430_CM_ABE_DSS_SYS_CLKSEL, OMAP4430_CLKSEL_0_0_SHIFT, | 730 | OMAP4430_CM_ABE_DSS_SYS_CLKSEL, OMAP4430_CLKSEL_0_0_SHIFT, |
697 | OMAP4430_CLKSEL_0_0_WIDTH, 0x0, NULL); | 731 | OMAP4430_CLKSEL_0_0_WIDTH, 0x0, NULL); |
698 | 732 | ||
733 | static const char *dbgclk_mux_ck_parents[] = { | ||
734 | "sys_clkin_ck" | ||
735 | }; | ||
736 | |||
699 | static struct clk dbgclk_mux_ck; | 737 | static struct clk dbgclk_mux_ck; |
700 | DEFINE_STRUCT_CLK_HW_OMAP(dbgclk_mux_ck, NULL); | 738 | DEFINE_STRUCT_CLK_HW_OMAP(dbgclk_mux_ck, NULL); |
701 | DEFINE_STRUCT_CLK(dbgclk_mux_ck, dpll_core_ck_parents, | 739 | DEFINE_STRUCT_CLK(dbgclk_mux_ck, dbgclk_mux_ck_parents, |
702 | dpll_usb_clkdcoldo_ck_ops); | 740 | dpll_usb_clkdcoldo_ck_ops); |
703 | 741 | ||
704 | /* Leaf clocks controlled by modules */ | 742 | /* Leaf clocks controlled by modules */ |
@@ -1935,10 +1973,10 @@ static struct omap_clk omap44xx_clks[] = { | |||
1935 | CLK("4803e000.timer", "timer_sys_ck", &sys_clkin_ck, CK_443X), | 1973 | CLK("4803e000.timer", "timer_sys_ck", &sys_clkin_ck, CK_443X), |
1936 | CLK("48086000.timer", "timer_sys_ck", &sys_clkin_ck, CK_443X), | 1974 | CLK("48086000.timer", "timer_sys_ck", &sys_clkin_ck, CK_443X), |
1937 | CLK("48088000.timer", "timer_sys_ck", &sys_clkin_ck, CK_443X), | 1975 | CLK("48088000.timer", "timer_sys_ck", &sys_clkin_ck, CK_443X), |
1938 | CLK("49038000.timer", "timer_sys_ck", &syc_clk_div_ck, CK_443X), | 1976 | CLK("40138000.timer", "timer_sys_ck", &syc_clk_div_ck, CK_443X), |
1939 | CLK("4903a000.timer", "timer_sys_ck", &syc_clk_div_ck, CK_443X), | 1977 | CLK("4013a000.timer", "timer_sys_ck", &syc_clk_div_ck, CK_443X), |
1940 | CLK("4903c000.timer", "timer_sys_ck", &syc_clk_div_ck, CK_443X), | 1978 | CLK("4013c000.timer", "timer_sys_ck", &syc_clk_div_ck, CK_443X), |
1941 | CLK("4903e000.timer", "timer_sys_ck", &syc_clk_div_ck, CK_443X), | 1979 | CLK("4013e000.timer", "timer_sys_ck", &syc_clk_div_ck, CK_443X), |
1942 | CLK(NULL, "cpufreq_ck", &dpll_mpu_ck, CK_443X), | 1980 | CLK(NULL, "cpufreq_ck", &dpll_mpu_ck, CK_443X), |
1943 | }; | 1981 | }; |
1944 | 1982 | ||
@@ -1955,6 +1993,7 @@ int __init omap4xxx_clk_init(void) | |||
1955 | { | 1993 | { |
1956 | u32 cpu_clkflg; | 1994 | u32 cpu_clkflg; |
1957 | struct omap_clk *c; | 1995 | struct omap_clk *c; |
1996 | int rc; | ||
1958 | 1997 | ||
1959 | if (cpu_is_omap443x()) { | 1998 | if (cpu_is_omap443x()) { |
1960 | cpu_mask = RATE_IN_4430; | 1999 | cpu_mask = RATE_IN_4430; |
@@ -1983,5 +2022,18 @@ int __init omap4xxx_clk_init(void) | |||
1983 | omap2_clk_enable_init_clocks(enable_init_clks, | 2022 | omap2_clk_enable_init_clocks(enable_init_clks, |
1984 | ARRAY_SIZE(enable_init_clks)); | 2023 | ARRAY_SIZE(enable_init_clks)); |
1985 | 2024 | ||
2025 | /* | ||
2026 | * On OMAP4460 the ABE DPLL fails to turn on if in idle low-power | ||
2027 | * state when turning the ABE clock domain. Workaround this by | ||
2028 | * locking the ABE DPLL on boot. | ||
2029 | */ | ||
2030 | if (cpu_is_omap446x()) { | ||
2031 | rc = clk_set_parent(&abe_dpll_refclk_mux_ck, &sys_32k_ck); | ||
2032 | if (!rc) | ||
2033 | rc = clk_set_rate(&dpll_abe_ck, OMAP4_DPLL_ABE_DEFFREQ); | ||
2034 | if (rc) | ||
2035 | pr_err("%s: failed to configure ABE DPLL!\n", __func__); | ||
2036 | } | ||
2037 | |||
1986 | return 0; | 2038 | return 0; |
1987 | } | 2039 | } |
diff --git a/arch/arm/mach-omap2/clock.h b/arch/arm/mach-omap2/clock.h index 9917f793c3b6..b40204837bd7 100644 --- a/arch/arm/mach-omap2/clock.h +++ b/arch/arm/mach-omap2/clock.h | |||
@@ -195,6 +195,10 @@ struct clksel { | |||
195 | * @enable_mask: mask of the DPLL mode bitfield in @control_reg | 195 | * @enable_mask: mask of the DPLL mode bitfield in @control_reg |
196 | * @last_rounded_rate: cache of the last rate result of omap2_dpll_round_rate() | 196 | * @last_rounded_rate: cache of the last rate result of omap2_dpll_round_rate() |
197 | * @last_rounded_m: cache of the last M result of omap2_dpll_round_rate() | 197 | * @last_rounded_m: cache of the last M result of omap2_dpll_round_rate() |
198 | * @last_rounded_m4xen: cache of the last M4X result of | ||
199 | * omap4_dpll_regm4xen_round_rate() | ||
200 | * @last_rounded_lpmode: cache of the last lpmode result of | ||
201 | * omap4_dpll_lpmode_recalc() | ||
198 | * @max_multiplier: maximum valid non-bypass multiplier value (actual) | 202 | * @max_multiplier: maximum valid non-bypass multiplier value (actual) |
199 | * @last_rounded_n: cache of the last N result of omap2_dpll_round_rate() | 203 | * @last_rounded_n: cache of the last N result of omap2_dpll_round_rate() |
200 | * @min_divider: minimum valid non-bypass divider value (actual) | 204 | * @min_divider: minimum valid non-bypass divider value (actual) |
@@ -205,6 +209,8 @@ struct clksel { | |||
205 | * @autoidle_mask: mask of the DPLL autoidle mode bitfield in @autoidle_reg | 209 | * @autoidle_mask: mask of the DPLL autoidle mode bitfield in @autoidle_reg |
206 | * @freqsel_mask: mask of the DPLL jitter correction bitfield in @control_reg | 210 | * @freqsel_mask: mask of the DPLL jitter correction bitfield in @control_reg |
207 | * @idlest_mask: mask of the DPLL idle status bitfield in @idlest_reg | 211 | * @idlest_mask: mask of the DPLL idle status bitfield in @idlest_reg |
212 | * @lpmode_mask: mask of the DPLL low-power mode bitfield in @control_reg | ||
213 | * @m4xen_mask: mask of the DPLL M4X multiplier bitfield in @control_reg | ||
208 | * @auto_recal_bit: bitshift of the driftguard enable bit in @control_reg | 214 | * @auto_recal_bit: bitshift of the driftguard enable bit in @control_reg |
209 | * @recal_en_bit: bitshift of the PRM_IRQENABLE_* bit for recalibration IRQs | 215 | * @recal_en_bit: bitshift of the PRM_IRQENABLE_* bit for recalibration IRQs |
210 | * @recal_st_bit: bitshift of the PRM_IRQSTATUS_* bit for recalibration IRQs | 216 | * @recal_st_bit: bitshift of the PRM_IRQSTATUS_* bit for recalibration IRQs |
@@ -233,6 +239,8 @@ struct dpll_data { | |||
233 | u32 enable_mask; | 239 | u32 enable_mask; |
234 | unsigned long last_rounded_rate; | 240 | unsigned long last_rounded_rate; |
235 | u16 last_rounded_m; | 241 | u16 last_rounded_m; |
242 | u8 last_rounded_m4xen; | ||
243 | u8 last_rounded_lpmode; | ||
236 | u16 max_multiplier; | 244 | u16 max_multiplier; |
237 | u8 last_rounded_n; | 245 | u8 last_rounded_n; |
238 | u8 min_divider; | 246 | u8 min_divider; |
@@ -245,6 +253,8 @@ struct dpll_data { | |||
245 | u32 idlest_mask; | 253 | u32 idlest_mask; |
246 | u32 dco_mask; | 254 | u32 dco_mask; |
247 | u32 sddiv_mask; | 255 | u32 sddiv_mask; |
256 | u32 lpmode_mask; | ||
257 | u32 m4xen_mask; | ||
248 | u8 auto_recal_bit; | 258 | u8 auto_recal_bit; |
249 | u8 recal_en_bit; | 259 | u8 recal_en_bit; |
250 | u8 recal_st_bit; | 260 | u8 recal_st_bit; |
diff --git a/arch/arm/mach-omap2/clockdomain.c b/arch/arm/mach-omap2/clockdomain.c index 384873580b23..7faf82d4e85c 100644 --- a/arch/arm/mach-omap2/clockdomain.c +++ b/arch/arm/mach-omap2/clockdomain.c | |||
@@ -998,7 +998,8 @@ int clkdm_clk_disable(struct clockdomain *clkdm, struct clk *clk) | |||
998 | spin_lock_irqsave(&clkdm->lock, flags); | 998 | spin_lock_irqsave(&clkdm->lock, flags); |
999 | 999 | ||
1000 | /* corner case: disabling unused clocks */ | 1000 | /* corner case: disabling unused clocks */ |
1001 | if (__clk_get_enable_count(clk) == 0) | 1001 | if ((__clk_get_enable_count(clk) == 0) && |
1002 | (atomic_read(&clkdm->usecount) == 0)) | ||
1002 | goto ccd_exit; | 1003 | goto ccd_exit; |
1003 | 1004 | ||
1004 | if (atomic_read(&clkdm->usecount) == 0) { | 1005 | if (atomic_read(&clkdm->usecount) == 0) { |
diff --git a/arch/arm/mach-omap2/common.c b/arch/arm/mach-omap2/common.c index 5c2fd4863b2b..2dabb9ecb986 100644 --- a/arch/arm/mach-omap2/common.c +++ b/arch/arm/mach-omap2/common.c | |||
@@ -16,8 +16,6 @@ | |||
16 | #include <linux/init.h> | 16 | #include <linux/init.h> |
17 | #include <linux/platform_data/dsp-omap.h> | 17 | #include <linux/platform_data/dsp-omap.h> |
18 | 18 | ||
19 | #include <plat/vram.h> | ||
20 | |||
21 | #include "common.h" | 19 | #include "common.h" |
22 | #include "omap-secure.h" | 20 | #include "omap-secure.h" |
23 | 21 | ||
@@ -32,7 +30,6 @@ int __weak omap_secure_ram_reserve_memblock(void) | |||
32 | 30 | ||
33 | void __init omap_reserve(void) | 31 | void __init omap_reserve(void) |
34 | { | 32 | { |
35 | omap_vram_reserve_sdram_memblock(); | ||
36 | omap_dsp_reserve_sdram_memblock(); | 33 | omap_dsp_reserve_sdram_memblock(); |
37 | omap_secure_ram_reserve_memblock(); | 34 | omap_secure_ram_reserve_memblock(); |
38 | omap_barrier_reserve_memblock(); | 35 | omap_barrier_reserve_memblock(); |
diff --git a/arch/arm/mach-omap2/cpuidle34xx.c b/arch/arm/mach-omap2/cpuidle34xx.c index bca7a8885703..22590dbe8f14 100644 --- a/arch/arm/mach-omap2/cpuidle34xx.c +++ b/arch/arm/mach-omap2/cpuidle34xx.c | |||
@@ -40,6 +40,8 @@ struct omap3_idle_statedata { | |||
40 | u32 core_state; | 40 | u32 core_state; |
41 | }; | 41 | }; |
42 | 42 | ||
43 | static struct powerdomain *mpu_pd, *core_pd, *per_pd, *cam_pd; | ||
44 | |||
43 | static struct omap3_idle_statedata omap3_idle_data[] = { | 45 | static struct omap3_idle_statedata omap3_idle_data[] = { |
44 | { | 46 | { |
45 | .mpu_state = PWRDM_POWER_ON, | 47 | .mpu_state = PWRDM_POWER_ON, |
@@ -71,7 +73,7 @@ static struct omap3_idle_statedata omap3_idle_data[] = { | |||
71 | }, | 73 | }, |
72 | }; | 74 | }; |
73 | 75 | ||
74 | static struct powerdomain *mpu_pd, *core_pd, *per_pd, *cam_pd; | 76 | /* Private functions */ |
75 | 77 | ||
76 | static int __omap3_enter_idle(struct cpuidle_device *dev, | 78 | static int __omap3_enter_idle(struct cpuidle_device *dev, |
77 | struct cpuidle_driver *drv, | 79 | struct cpuidle_driver *drv, |
@@ -260,11 +262,11 @@ static int omap3_enter_idle_bm(struct cpuidle_device *dev, | |||
260 | return ret; | 262 | return ret; |
261 | } | 263 | } |
262 | 264 | ||
263 | DEFINE_PER_CPU(struct cpuidle_device, omap3_idle_dev); | 265 | static DEFINE_PER_CPU(struct cpuidle_device, omap3_idle_dev); |
264 | 266 | ||
265 | struct cpuidle_driver omap3_idle_driver = { | 267 | static struct cpuidle_driver omap3_idle_driver = { |
266 | .name = "omap3_idle", | 268 | .name = "omap3_idle", |
267 | .owner = THIS_MODULE, | 269 | .owner = THIS_MODULE, |
268 | .states = { | 270 | .states = { |
269 | { | 271 | { |
270 | .enter = omap3_enter_idle_bm, | 272 | .enter = omap3_enter_idle_bm, |
@@ -327,6 +329,8 @@ struct cpuidle_driver omap3_idle_driver = { | |||
327 | .safe_state_index = 0, | 329 | .safe_state_index = 0, |
328 | }; | 330 | }; |
329 | 331 | ||
332 | /* Public functions */ | ||
333 | |||
330 | /** | 334 | /** |
331 | * omap3_idle_init - Init routine for OMAP3 idle | 335 | * omap3_idle_init - Init routine for OMAP3 idle |
332 | * | 336 | * |
diff --git a/arch/arm/mach-omap2/cpuidle44xx.c b/arch/arm/mach-omap2/cpuidle44xx.c index 288bee6cbb76..d639aef0deda 100644 --- a/arch/arm/mach-omap2/cpuidle44xx.c +++ b/arch/arm/mach-omap2/cpuidle44xx.c | |||
@@ -54,6 +54,8 @@ static struct clockdomain *cpu_clkdm[NR_CPUS]; | |||
54 | static atomic_t abort_barrier; | 54 | static atomic_t abort_barrier; |
55 | static bool cpu_done[NR_CPUS]; | 55 | static bool cpu_done[NR_CPUS]; |
56 | 56 | ||
57 | /* Private functions */ | ||
58 | |||
57 | /** | 59 | /** |
58 | * omap4_enter_idle_coupled_[simple/coupled] - OMAP4 cpuidle entry functions | 60 | * omap4_enter_idle_coupled_[simple/coupled] - OMAP4 cpuidle entry functions |
59 | * @dev: cpuidle device | 61 | * @dev: cpuidle device |
@@ -161,9 +163,19 @@ fail: | |||
161 | return index; | 163 | return index; |
162 | } | 164 | } |
163 | 165 | ||
164 | DEFINE_PER_CPU(struct cpuidle_device, omap4_idle_dev); | 166 | /* |
167 | * For each cpu, setup the broadcast timer because local timers | ||
168 | * stops for the states above C1. | ||
169 | */ | ||
170 | static void omap_setup_broadcast_timer(void *arg) | ||
171 | { | ||
172 | int cpu = smp_processor_id(); | ||
173 | clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_ON, &cpu); | ||
174 | } | ||
175 | |||
176 | static DEFINE_PER_CPU(struct cpuidle_device, omap4_idle_dev); | ||
165 | 177 | ||
166 | struct cpuidle_driver omap4_idle_driver = { | 178 | static struct cpuidle_driver omap4_idle_driver = { |
167 | .name = "omap4_idle", | 179 | .name = "omap4_idle", |
168 | .owner = THIS_MODULE, | 180 | .owner = THIS_MODULE, |
169 | .en_core_tk_irqen = 1, | 181 | .en_core_tk_irqen = 1, |
@@ -178,7 +190,7 @@ struct cpuidle_driver omap4_idle_driver = { | |||
178 | .desc = "MPUSS ON" | 190 | .desc = "MPUSS ON" |
179 | }, | 191 | }, |
180 | { | 192 | { |
181 | /* C2 - CPU0 OFF + CPU1 OFF + MPU CSWR */ | 193 | /* C2 - CPU0 OFF + CPU1 OFF + MPU CSWR */ |
182 | .exit_latency = 328 + 440, | 194 | .exit_latency = 328 + 440, |
183 | .target_residency = 960, | 195 | .target_residency = 960, |
184 | .flags = CPUIDLE_FLAG_TIME_VALID | CPUIDLE_FLAG_COUPLED, | 196 | .flags = CPUIDLE_FLAG_TIME_VALID | CPUIDLE_FLAG_COUPLED, |
@@ -200,15 +212,7 @@ struct cpuidle_driver omap4_idle_driver = { | |||
200 | .safe_state_index = 0, | 212 | .safe_state_index = 0, |
201 | }; | 213 | }; |
202 | 214 | ||
203 | /* | 215 | /* Public functions */ |
204 | * For each cpu, setup the broadcast timer because local timers | ||
205 | * stops for the states above C1. | ||
206 | */ | ||
207 | static void omap_setup_broadcast_timer(void *arg) | ||
208 | { | ||
209 | int cpu = smp_processor_id(); | ||
210 | clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_ON, &cpu); | ||
211 | } | ||
212 | 216 | ||
213 | /** | 217 | /** |
214 | * omap4_idle_init - Init routine for OMAP4 idle | 218 | * omap4_idle_init - Init routine for OMAP4 idle |
diff --git a/arch/arm/mach-omap2/dpll3xxx.c b/arch/arm/mach-omap2/dpll3xxx.c index fafb28c0dcbc..2bb18838cba9 100644 --- a/arch/arm/mach-omap2/dpll3xxx.c +++ b/arch/arm/mach-omap2/dpll3xxx.c | |||
@@ -291,16 +291,13 @@ static void _lookup_sddiv(struct clk_hw_omap *clk, u8 *sd_div, u16 m, u8 n) | |||
291 | 291 | ||
292 | /* | 292 | /* |
293 | * _omap3_noncore_dpll_program - set non-core DPLL M,N values directly | 293 | * _omap3_noncore_dpll_program - set non-core DPLL M,N values directly |
294 | * @clk: struct clk * of DPLL to set | 294 | * @clk: struct clk * of DPLL to set |
295 | * @m: DPLL multiplier to set | 295 | * @freqsel: FREQSEL value to set |
296 | * @n: DPLL divider to set | ||
297 | * @freqsel: FREQSEL value to set | ||
298 | * | 296 | * |
299 | * Program the DPLL with the supplied M, N values, and wait for the DPLL to | 297 | * Program the DPLL with the last M, N values calculated, and wait for |
300 | * lock.. Returns -EINVAL upon error, or 0 upon success. | 298 | * the DPLL to lock. Returns -EINVAL upon error, or 0 upon success. |
301 | */ | 299 | */ |
302 | static int omap3_noncore_dpll_program(struct clk_hw_omap *clk, u16 m, u8 n, | 300 | static int omap3_noncore_dpll_program(struct clk_hw_omap *clk, u16 freqsel) |
303 | u16 freqsel) | ||
304 | { | 301 | { |
305 | struct dpll_data *dd = clk->dpll_data; | 302 | struct dpll_data *dd = clk->dpll_data; |
306 | u8 dco, sd_div; | 303 | u8 dco, sd_div; |
@@ -323,23 +320,45 @@ static int omap3_noncore_dpll_program(struct clk_hw_omap *clk, u16 m, u8 n, | |||
323 | /* Set DPLL multiplier, divider */ | 320 | /* Set DPLL multiplier, divider */ |
324 | v = __raw_readl(dd->mult_div1_reg); | 321 | v = __raw_readl(dd->mult_div1_reg); |
325 | v &= ~(dd->mult_mask | dd->div1_mask); | 322 | v &= ~(dd->mult_mask | dd->div1_mask); |
326 | v |= m << __ffs(dd->mult_mask); | 323 | v |= dd->last_rounded_m << __ffs(dd->mult_mask); |
327 | v |= (n - 1) << __ffs(dd->div1_mask); | 324 | v |= (dd->last_rounded_n - 1) << __ffs(dd->div1_mask); |
328 | 325 | ||
329 | /* Configure dco and sd_div for dplls that have these fields */ | 326 | /* Configure dco and sd_div for dplls that have these fields */ |
330 | if (dd->dco_mask) { | 327 | if (dd->dco_mask) { |
331 | _lookup_dco(clk, &dco, m, n); | 328 | _lookup_dco(clk, &dco, dd->last_rounded_m, dd->last_rounded_n); |
332 | v &= ~(dd->dco_mask); | 329 | v &= ~(dd->dco_mask); |
333 | v |= dco << __ffs(dd->dco_mask); | 330 | v |= dco << __ffs(dd->dco_mask); |
334 | } | 331 | } |
335 | if (dd->sddiv_mask) { | 332 | if (dd->sddiv_mask) { |
336 | _lookup_sddiv(clk, &sd_div, m, n); | 333 | _lookup_sddiv(clk, &sd_div, dd->last_rounded_m, |
334 | dd->last_rounded_n); | ||
337 | v &= ~(dd->sddiv_mask); | 335 | v &= ~(dd->sddiv_mask); |
338 | v |= sd_div << __ffs(dd->sddiv_mask); | 336 | v |= sd_div << __ffs(dd->sddiv_mask); |
339 | } | 337 | } |
340 | 338 | ||
341 | __raw_writel(v, dd->mult_div1_reg); | 339 | __raw_writel(v, dd->mult_div1_reg); |
342 | 340 | ||
341 | /* Set 4X multiplier and low-power mode */ | ||
342 | if (dd->m4xen_mask || dd->lpmode_mask) { | ||
343 | v = __raw_readl(dd->control_reg); | ||
344 | |||
345 | if (dd->m4xen_mask) { | ||
346 | if (dd->last_rounded_m4xen) | ||
347 | v |= dd->m4xen_mask; | ||
348 | else | ||
349 | v &= ~dd->m4xen_mask; | ||
350 | } | ||
351 | |||
352 | if (dd->lpmode_mask) { | ||
353 | if (dd->last_rounded_lpmode) | ||
354 | v |= dd->lpmode_mask; | ||
355 | else | ||
356 | v &= ~dd->lpmode_mask; | ||
357 | } | ||
358 | |||
359 | __raw_writel(v, dd->control_reg); | ||
360 | } | ||
361 | |||
343 | /* We let the clock framework set the other output dividers later */ | 362 | /* We let the clock framework set the other output dividers later */ |
344 | 363 | ||
345 | /* REVISIT: Set ramp-up delay? */ | 364 | /* REVISIT: Set ramp-up delay? */ |
@@ -492,8 +511,7 @@ int omap3_noncore_dpll_set_rate(struct clk_hw *hw, unsigned long rate, | |||
492 | pr_debug("%s: %s: set rate: locking rate to %lu.\n", | 511 | pr_debug("%s: %s: set rate: locking rate to %lu.\n", |
493 | __func__, __clk_get_name(hw->clk), rate); | 512 | __func__, __clk_get_name(hw->clk), rate); |
494 | 513 | ||
495 | ret = omap3_noncore_dpll_program(clk, dd->last_rounded_m, | 514 | ret = omap3_noncore_dpll_program(clk, freqsel); |
496 | dd->last_rounded_n, freqsel); | ||
497 | if (!ret) | 515 | if (!ret) |
498 | new_parent = dd->clk_ref; | 516 | new_parent = dd->clk_ref; |
499 | } | 517 | } |
diff --git a/arch/arm/mach-omap2/dpll44xx.c b/arch/arm/mach-omap2/dpll44xx.c index d3326c474fdc..d28b0f726715 100644 --- a/arch/arm/mach-omap2/dpll44xx.c +++ b/arch/arm/mach-omap2/dpll44xx.c | |||
@@ -20,6 +20,15 @@ | |||
20 | #include "clock44xx.h" | 20 | #include "clock44xx.h" |
21 | #include "cm-regbits-44xx.h" | 21 | #include "cm-regbits-44xx.h" |
22 | 22 | ||
23 | /* | ||
24 | * Maximum DPLL input frequency (FINT) and output frequency (FOUT) that | ||
25 | * can supported when using the DPLL low-power mode. Frequencies are | ||
26 | * defined in OMAP4430/60 Public TRM section 3.6.3.3.2 "Enable Control, | ||
27 | * Status, and Low-Power Operation Mode". | ||
28 | */ | ||
29 | #define OMAP4_DPLL_LP_FINT_MAX 1000000 | ||
30 | #define OMAP4_DPLL_LP_FOUT_MAX 100000000 | ||
31 | |||
23 | /* Supported only on OMAP4 */ | 32 | /* Supported only on OMAP4 */ |
24 | int omap4_dpllmx_gatectrl_read(struct clk_hw_omap *clk) | 33 | int omap4_dpllmx_gatectrl_read(struct clk_hw_omap *clk) |
25 | { | 34 | { |
@@ -82,6 +91,31 @@ const struct clk_hw_omap_ops clkhwops_omap4_dpllmx = { | |||
82 | }; | 91 | }; |
83 | 92 | ||
84 | /** | 93 | /** |
94 | * omap4_dpll_lpmode_recalc - compute DPLL low-power setting | ||
95 | * @dd: pointer to the dpll data structure | ||
96 | * | ||
97 | * Calculates if low-power mode can be enabled based upon the last | ||
98 | * multiplier and divider values calculated. If low-power mode can be | ||
99 | * enabled, then the bit to enable low-power mode is stored in the | ||
100 | * last_rounded_lpmode variable. This implementation is based upon the | ||
101 | * criteria for enabling low-power mode as described in the OMAP4430/60 | ||
102 | * Public TRM section 3.6.3.3.2 "Enable Control, Status, and Low-Power | ||
103 | * Operation Mode". | ||
104 | */ | ||
105 | static void omap4_dpll_lpmode_recalc(struct dpll_data *dd) | ||
106 | { | ||
107 | long fint, fout; | ||
108 | |||
109 | fint = __clk_get_rate(dd->clk_ref) / (dd->last_rounded_n + 1); | ||
110 | fout = fint * dd->last_rounded_m; | ||
111 | |||
112 | if ((fint < OMAP4_DPLL_LP_FINT_MAX) && (fout < OMAP4_DPLL_LP_FOUT_MAX)) | ||
113 | dd->last_rounded_lpmode = 1; | ||
114 | else | ||
115 | dd->last_rounded_lpmode = 0; | ||
116 | } | ||
117 | |||
118 | /** | ||
85 | * omap4_dpll_regm4xen_recalc - compute DPLL rate, considering REGM4XEN bit | 119 | * omap4_dpll_regm4xen_recalc - compute DPLL rate, considering REGM4XEN bit |
86 | * @clk: struct clk * of the DPLL to compute the rate for | 120 | * @clk: struct clk * of the DPLL to compute the rate for |
87 | * | 121 | * |
@@ -130,7 +164,6 @@ long omap4_dpll_regm4xen_round_rate(struct clk_hw *hw, | |||
130 | unsigned long *parent_rate) | 164 | unsigned long *parent_rate) |
131 | { | 165 | { |
132 | struct clk_hw_omap *clk = to_clk_hw_omap(hw); | 166 | struct clk_hw_omap *clk = to_clk_hw_omap(hw); |
133 | u32 v; | ||
134 | struct dpll_data *dd; | 167 | struct dpll_data *dd; |
135 | long r; | 168 | long r; |
136 | 169 | ||
@@ -139,18 +172,31 @@ long omap4_dpll_regm4xen_round_rate(struct clk_hw *hw, | |||
139 | 172 | ||
140 | dd = clk->dpll_data; | 173 | dd = clk->dpll_data; |
141 | 174 | ||
142 | /* regm4xen adds a multiplier of 4 to DPLL calculations */ | 175 | dd->last_rounded_m4xen = 0; |
143 | v = __raw_readl(dd->control_reg) & OMAP4430_DPLL_REGM4XEN_MASK; | ||
144 | |||
145 | if (v) | ||
146 | target_rate = target_rate / OMAP4430_REGM4XEN_MULT; | ||
147 | 176 | ||
177 | /* | ||
178 | * First try to compute the DPLL configuration for | ||
179 | * target rate without using the 4X multiplier. | ||
180 | */ | ||
148 | r = omap2_dpll_round_rate(hw, target_rate, NULL); | 181 | r = omap2_dpll_round_rate(hw, target_rate, NULL); |
182 | if (r != ~0) | ||
183 | goto out; | ||
184 | |||
185 | /* | ||
186 | * If we did not find a valid DPLL configuration, try again, but | ||
187 | * this time see if using the 4X multiplier can help. Enabling the | ||
188 | * 4X multiplier is equivalent to dividing the target rate by 4. | ||
189 | */ | ||
190 | r = omap2_dpll_round_rate(hw, target_rate / OMAP4430_REGM4XEN_MULT, | ||
191 | NULL); | ||
149 | if (r == ~0) | 192 | if (r == ~0) |
150 | return r; | 193 | return r; |
151 | 194 | ||
152 | if (v) | 195 | dd->last_rounded_rate *= OMAP4430_REGM4XEN_MULT; |
153 | clk->dpll_data->last_rounded_rate *= OMAP4430_REGM4XEN_MULT; | 196 | dd->last_rounded_m4xen = 1; |
197 | |||
198 | out: | ||
199 | omap4_dpll_lpmode_recalc(dd); | ||
154 | 200 | ||
155 | return clk->dpll_data->last_rounded_rate; | 201 | return dd->last_rounded_rate; |
156 | } | 202 | } |
diff --git a/arch/arm/mach-omap2/i2c.c b/arch/arm/mach-omap2/i2c.c index df6d6acbc9ed..b9074dde3b9c 100644 --- a/arch/arm/mach-omap2/i2c.c +++ b/arch/arm/mach-omap2/i2c.c | |||
@@ -22,6 +22,7 @@ | |||
22 | #include "soc.h" | 22 | #include "soc.h" |
23 | #include "omap_hwmod.h" | 23 | #include "omap_hwmod.h" |
24 | #include "omap_device.h" | 24 | #include "omap_device.h" |
25 | #include "omap-pm.h" | ||
25 | 26 | ||
26 | #include "prm.h" | 27 | #include "prm.h" |
27 | #include "common.h" | 28 | #include "common.h" |
diff --git a/arch/arm/mach-omap2/mux.c b/arch/arm/mach-omap2/mux.c index 26126343d6ac..6a217c98db54 100644 --- a/arch/arm/mach-omap2/mux.c +++ b/arch/arm/mach-omap2/mux.c | |||
@@ -135,10 +135,7 @@ static int __init _omap_mux_init_gpio(struct omap_mux_partition *partition, | |||
135 | 135 | ||
136 | old_mode = omap_mux_read(partition, gpio_mux->reg_offset); | 136 | old_mode = omap_mux_read(partition, gpio_mux->reg_offset); |
137 | mux_mode = val & ~(OMAP_MUX_NR_MODES - 1); | 137 | mux_mode = val & ~(OMAP_MUX_NR_MODES - 1); |
138 | if (partition->flags & OMAP_MUX_GPIO_IN_MODE3) | 138 | mux_mode |= partition->gpio; |
139 | mux_mode |= OMAP_MUX_MODE3; | ||
140 | else | ||
141 | mux_mode |= OMAP_MUX_MODE4; | ||
142 | pr_debug("%s: Setting signal %s.gpio%i 0x%04x -> 0x%04x\n", __func__, | 139 | pr_debug("%s: Setting signal %s.gpio%i 0x%04x -> 0x%04x\n", __func__, |
143 | gpio_mux->muxnames[0], gpio, old_mode, mux_mode); | 140 | gpio_mux->muxnames[0], gpio, old_mode, mux_mode); |
144 | omap_mux_write(partition, mux_mode, gpio_mux->reg_offset); | 141 | omap_mux_write(partition, mux_mode, gpio_mux->reg_offset); |
@@ -800,7 +797,7 @@ int __init omap_mux_late_init(void) | |||
800 | struct omap_mux *m = &e->mux; | 797 | struct omap_mux *m = &e->mux; |
801 | u16 mode = omap_mux_read(partition, m->reg_offset); | 798 | u16 mode = omap_mux_read(partition, m->reg_offset); |
802 | 799 | ||
803 | if (OMAP_MODE_GPIO(mode)) | 800 | if (OMAP_MODE_GPIO(partition, mode)) |
804 | continue; | 801 | continue; |
805 | 802 | ||
806 | #ifndef CONFIG_DEBUG_FS | 803 | #ifndef CONFIG_DEBUG_FS |
@@ -1065,7 +1062,7 @@ static void __init omap_mux_init_list(struct omap_mux_partition *partition, | |||
1065 | } | 1062 | } |
1066 | #else | 1063 | #else |
1067 | /* Skip pins that are not muxed as GPIO by bootloader */ | 1064 | /* Skip pins that are not muxed as GPIO by bootloader */ |
1068 | if (!OMAP_MODE_GPIO(omap_mux_read(partition, | 1065 | if (!OMAP_MODE_GPIO(partition, omap_mux_read(partition, |
1069 | superset->reg_offset))) { | 1066 | superset->reg_offset))) { |
1070 | superset++; | 1067 | superset++; |
1071 | continue; | 1068 | continue; |
@@ -1132,6 +1129,7 @@ int __init omap_mux_init(const char *name, u32 flags, | |||
1132 | 1129 | ||
1133 | partition->name = name; | 1130 | partition->name = name; |
1134 | partition->flags = flags; | 1131 | partition->flags = flags; |
1132 | partition->gpio = flags & OMAP_MUX_MODE7; | ||
1135 | partition->size = mux_size; | 1133 | partition->size = mux_size; |
1136 | partition->phys = mux_pbase; | 1134 | partition->phys = mux_pbase; |
1137 | partition->base = ioremap(mux_pbase, mux_size); | 1135 | partition->base = ioremap(mux_pbase, mux_size); |
diff --git a/arch/arm/mach-omap2/mux.h b/arch/arm/mach-omap2/mux.h index 76f9b3c2f586..fdb22f14021f 100644 --- a/arch/arm/mach-omap2/mux.h +++ b/arch/arm/mach-omap2/mux.h | |||
@@ -58,7 +58,8 @@ | |||
58 | #define OMAP_PIN_OFF_INPUT_PULLDOWN (OMAP_OFF_EN | OMAP_OFF_PULL_EN) | 58 | #define OMAP_PIN_OFF_INPUT_PULLDOWN (OMAP_OFF_EN | OMAP_OFF_PULL_EN) |
59 | #define OMAP_PIN_OFF_WAKEUPENABLE OMAP_WAKEUP_EN | 59 | #define OMAP_PIN_OFF_WAKEUPENABLE OMAP_WAKEUP_EN |
60 | 60 | ||
61 | #define OMAP_MODE_GPIO(x) (((x) & OMAP_MUX_MODE7) == OMAP_MUX_MODE4) | 61 | #define OMAP_MODE_GPIO(partition, x) (((x) & OMAP_MUX_MODE7) == \ |
62 | partition->gpio) | ||
62 | #define OMAP_MODE_UART(x) (((x) & OMAP_MUX_MODE7) == OMAP_MUX_MODE0) | 63 | #define OMAP_MODE_UART(x) (((x) & OMAP_MUX_MODE7) == OMAP_MUX_MODE0) |
63 | 64 | ||
64 | /* Flags for omapX_mux_init */ | 65 | /* Flags for omapX_mux_init */ |
@@ -79,13 +80,20 @@ | |||
79 | /* | 80 | /* |
80 | * omap_mux_init flags definition: | 81 | * omap_mux_init flags definition: |
81 | * | 82 | * |
83 | * OMAP_GPIO_MUX_MODE, bits 0-2: gpio muxing mode, same like pad control | ||
84 | * register which includes values from 0-7. | ||
82 | * OMAP_MUX_REG_8BIT: Ensure that access to padconf is done in 8 bits. | 85 | * OMAP_MUX_REG_8BIT: Ensure that access to padconf is done in 8 bits. |
83 | * The default value is 16 bits. | 86 | * The default value is 16 bits. |
84 | * OMAP_MUX_GPIO_IN_MODE3: The GPIO is selected in mode3. | ||
85 | * The default is mode4. | ||
86 | */ | 87 | */ |
87 | #define OMAP_MUX_REG_8BIT (1 << 0) | 88 | #define OMAP_MUX_GPIO_IN_MODE0 OMAP_MUX_MODE0 |
88 | #define OMAP_MUX_GPIO_IN_MODE3 (1 << 1) | 89 | #define OMAP_MUX_GPIO_IN_MODE1 OMAP_MUX_MODE1 |
90 | #define OMAP_MUX_GPIO_IN_MODE2 OMAP_MUX_MODE2 | ||
91 | #define OMAP_MUX_GPIO_IN_MODE3 OMAP_MUX_MODE3 | ||
92 | #define OMAP_MUX_GPIO_IN_MODE4 OMAP_MUX_MODE4 | ||
93 | #define OMAP_MUX_GPIO_IN_MODE5 OMAP_MUX_MODE5 | ||
94 | #define OMAP_MUX_GPIO_IN_MODE6 OMAP_MUX_MODE6 | ||
95 | #define OMAP_MUX_GPIO_IN_MODE7 OMAP_MUX_MODE7 | ||
96 | #define OMAP_MUX_REG_8BIT (1 << 3) | ||
89 | 97 | ||
90 | /** | 98 | /** |
91 | * struct omap_board_data - board specific device data | 99 | * struct omap_board_data - board specific device data |
@@ -105,6 +113,7 @@ struct omap_board_data { | |||
105 | * struct mux_partition - contain partition related information | 113 | * struct mux_partition - contain partition related information |
106 | * @name: name of the current partition | 114 | * @name: name of the current partition |
107 | * @flags: flags specific to this partition | 115 | * @flags: flags specific to this partition |
116 | * @gpio: gpio mux mode | ||
108 | * @phys: physical address | 117 | * @phys: physical address |
109 | * @size: partition size | 118 | * @size: partition size |
110 | * @base: virtual address after ioremap | 119 | * @base: virtual address after ioremap |
@@ -114,6 +123,7 @@ struct omap_board_data { | |||
114 | struct omap_mux_partition { | 123 | struct omap_mux_partition { |
115 | const char *name; | 124 | const char *name; |
116 | u32 flags; | 125 | u32 flags; |
126 | u32 gpio; | ||
117 | u32 phys; | 127 | u32 phys; |
118 | u32 size; | 128 | u32 size; |
119 | void __iomem *base; | 129 | void __iomem *base; |
diff --git a/arch/arm/mach-omap2/mux34xx.c b/arch/arm/mach-omap2/mux34xx.c index c47140bbbec4..c53609f46294 100644 --- a/arch/arm/mach-omap2/mux34xx.c +++ b/arch/arm/mach-omap2/mux34xx.c | |||
@@ -2053,7 +2053,7 @@ int __init omap3_mux_init(struct omap_board_mux *board_subset, int flags) | |||
2053 | return -EINVAL; | 2053 | return -EINVAL; |
2054 | } | 2054 | } |
2055 | 2055 | ||
2056 | return omap_mux_init("core", 0, | 2056 | return omap_mux_init("core", OMAP_MUX_GPIO_IN_MODE4, |
2057 | OMAP3_CONTROL_PADCONF_MUX_PBASE, | 2057 | OMAP3_CONTROL_PADCONF_MUX_PBASE, |
2058 | OMAP3_CONTROL_PADCONF_MUX_SIZE, | 2058 | OMAP3_CONTROL_PADCONF_MUX_SIZE, |
2059 | omap3_muxmodes, package_subset, board_subset, | 2059 | omap3_muxmodes, package_subset, board_subset, |
diff --git a/arch/arm/mach-omap2/serial.c b/arch/arm/mach-omap2/serial.c index 93d102535c85..04fdbc4c499b 100644 --- a/arch/arm/mach-omap2/serial.c +++ b/arch/arm/mach-omap2/serial.c | |||
@@ -27,8 +27,7 @@ | |||
27 | #include <linux/pm_runtime.h> | 27 | #include <linux/pm_runtime.h> |
28 | #include <linux/console.h> | 28 | #include <linux/console.h> |
29 | #include <linux/omap-dma.h> | 29 | #include <linux/omap-dma.h> |
30 | 30 | #include <linux/platform_data/serial-omap.h> | |
31 | #include <plat/omap-serial.h> | ||
32 | 31 | ||
33 | #include "common.h" | 32 | #include "common.h" |
34 | #include "omap_hwmod.h" | 33 | #include "omap_hwmod.h" |
diff --git a/arch/arm/mach-omap2/timer.c b/arch/arm/mach-omap2/timer.c index 7016637b531c..06e141543623 100644 --- a/arch/arm/mach-omap2/timer.c +++ b/arch/arm/mach-omap2/timer.c | |||
@@ -190,7 +190,7 @@ static struct device_node * __init omap_get_timer_dt(struct of_device_id *match, | |||
190 | * kernel registering these devices remove them dynamically from the device | 190 | * kernel registering these devices remove them dynamically from the device |
191 | * tree on boot. | 191 | * tree on boot. |
192 | */ | 192 | */ |
193 | void __init omap_dmtimer_init(void) | 193 | static void __init omap_dmtimer_init(void) |
194 | { | 194 | { |
195 | struct device_node *np; | 195 | struct device_node *np; |
196 | 196 | ||
@@ -210,7 +210,7 @@ void __init omap_dmtimer_init(void) | |||
210 | * | 210 | * |
211 | * Get the timer errata flags that are specific to the OMAP device being used. | 211 | * Get the timer errata flags that are specific to the OMAP device being used. |
212 | */ | 212 | */ |
213 | u32 __init omap_dm_timer_get_errata(void) | 213 | static u32 __init omap_dm_timer_get_errata(void) |
214 | { | 214 | { |
215 | if (cpu_is_omap24xx()) | 215 | if (cpu_is_omap24xx()) |
216 | return 0; | 216 | return 0; |
@@ -392,7 +392,7 @@ static struct of_device_id omap_counter_match[] __initdata = { | |||
392 | }; | 392 | }; |
393 | 393 | ||
394 | /* Setup free-running counter for clocksource */ | 394 | /* Setup free-running counter for clocksource */ |
395 | static int __init omap2_sync32k_clocksource_init(void) | 395 | static int __init __maybe_unused omap2_sync32k_clocksource_init(void) |
396 | { | 396 | { |
397 | int ret; | 397 | int ret; |
398 | struct device_node *np = NULL; | 398 | struct device_node *np = NULL; |
diff --git a/arch/arm/mach-omap2/usb-host.c b/arch/arm/mach-omap2/usb-host.c index d1dbe125b34f..2e44e8a22884 100644 --- a/arch/arm/mach-omap2/usb-host.c +++ b/arch/arm/mach-omap2/usb-host.c | |||
@@ -508,6 +508,10 @@ void __init usbhs_init(const struct usbhs_omap_board_data *pdata) | |||
508 | if (cpu_is_omap34xx()) { | 508 | if (cpu_is_omap34xx()) { |
509 | setup_ehci_io_mux(pdata->port_mode); | 509 | setup_ehci_io_mux(pdata->port_mode); |
510 | setup_ohci_io_mux(pdata->port_mode); | 510 | setup_ohci_io_mux(pdata->port_mode); |
511 | |||
512 | if (omap_rev() <= OMAP3430_REV_ES2_1) | ||
513 | usbhs_data.single_ulpi_bypass = true; | ||
514 | |||
511 | } else if (cpu_is_omap44xx()) { | 515 | } else if (cpu_is_omap44xx()) { |
512 | setup_4430ehci_io_mux(pdata->port_mode); | 516 | setup_4430ehci_io_mux(pdata->port_mode); |
513 | setup_4430ohci_io_mux(pdata->port_mode); | 517 | setup_4430ohci_io_mux(pdata->port_mode); |
diff --git a/arch/arm/mach-tegra/common.c b/arch/arm/mach-tegra/common.c index 0816562725f6..d54cfc54b9fe 100644 --- a/arch/arm/mach-tegra/common.c +++ b/arch/arm/mach-tegra/common.c | |||
@@ -104,7 +104,7 @@ static __initdata struct tegra_clk_init_table tegra20_clk_init_table[] = { | |||
104 | static __initdata struct tegra_clk_init_table tegra30_clk_init_table[] = { | 104 | static __initdata struct tegra_clk_init_table tegra30_clk_init_table[] = { |
105 | /* name parent rate enabled */ | 105 | /* name parent rate enabled */ |
106 | { "clk_m", NULL, 0, true }, | 106 | { "clk_m", NULL, 0, true }, |
107 | { "pll_p", "clk_m", 408000000, true }, | 107 | { "pll_p", "pll_ref", 408000000, true }, |
108 | { "pll_p_out1", "pll_p", 9600000, true }, | 108 | { "pll_p_out1", "pll_p", 9600000, true }, |
109 | { "pll_p_out4", "pll_p", 102000000, true }, | 109 | { "pll_p_out4", "pll_p", 102000000, true }, |
110 | { "sclk", "pll_p_out4", 102000000, true }, | 110 | { "sclk", "pll_p_out4", 102000000, true }, |
diff --git a/arch/arm/mach-tegra/tegra30_clocks.c b/arch/arm/mach-tegra/tegra30_clocks.c index efc000e32e1c..d7147779f8ea 100644 --- a/arch/arm/mach-tegra/tegra30_clocks.c +++ b/arch/arm/mach-tegra/tegra30_clocks.c | |||
@@ -2045,9 +2045,7 @@ struct clk_ops tegra30_periph_clk_ops = { | |||
2045 | static int tegra30_dsib_clk_set_parent(struct clk_hw *hw, u8 index) | 2045 | static int tegra30_dsib_clk_set_parent(struct clk_hw *hw, u8 index) |
2046 | { | 2046 | { |
2047 | struct clk *d = clk_get_sys(NULL, "pll_d"); | 2047 | struct clk *d = clk_get_sys(NULL, "pll_d"); |
2048 | /* The DSIB parent selection bit is in PLLD base | 2048 | /* The DSIB parent selection bit is in PLLD base register */ |
2049 | register - can not do direct r-m-w, must be | ||
2050 | protected by PLLD lock */ | ||
2051 | tegra_clk_cfg_ex( | 2049 | tegra_clk_cfg_ex( |
2052 | d, TEGRA_CLK_PLLD_MIPI_MUX_SEL, index); | 2050 | d, TEGRA_CLK_PLLD_MIPI_MUX_SEL, index); |
2053 | 2051 | ||
diff --git a/arch/arm/mach-u300/core.c b/arch/arm/mach-u300/core.c index 8b204ae69002..4ce77cdc31cc 100644 --- a/arch/arm/mach-u300/core.c +++ b/arch/arm/mach-u300/core.c | |||
@@ -27,7 +27,6 @@ | |||
27 | #include <linux/mtd/nand.h> | 27 | #include <linux/mtd/nand.h> |
28 | #include <linux/mtd/fsmc.h> | 28 | #include <linux/mtd/fsmc.h> |
29 | #include <linux/pinctrl/machine.h> | 29 | #include <linux/pinctrl/machine.h> |
30 | #include <linux/pinctrl/consumer.h> | ||
31 | #include <linux/pinctrl/pinconf-generic.h> | 30 | #include <linux/pinctrl/pinconf-generic.h> |
32 | #include <linux/dma-mapping.h> | 31 | #include <linux/dma-mapping.h> |
33 | #include <linux/platform_data/clk-u300.h> | 32 | #include <linux/platform_data/clk-u300.h> |
@@ -1553,39 +1552,6 @@ static struct pinctrl_map __initdata u300_pinmux_map[] = { | |||
1553 | pin_highz_conf), | 1552 | pin_highz_conf), |
1554 | }; | 1553 | }; |
1555 | 1554 | ||
1556 | struct u300_mux_hog { | ||
1557 | struct device *dev; | ||
1558 | struct pinctrl *p; | ||
1559 | }; | ||
1560 | |||
1561 | static struct u300_mux_hog u300_mux_hogs[] = { | ||
1562 | { | ||
1563 | .dev = &uart0_device.dev, | ||
1564 | }, | ||
1565 | { | ||
1566 | .dev = &mmcsd_device.dev, | ||
1567 | }, | ||
1568 | }; | ||
1569 | |||
1570 | static int __init u300_pinctrl_fetch(void) | ||
1571 | { | ||
1572 | int i; | ||
1573 | |||
1574 | for (i = 0; i < ARRAY_SIZE(u300_mux_hogs); i++) { | ||
1575 | struct pinctrl *p; | ||
1576 | |||
1577 | p = pinctrl_get_select_default(u300_mux_hogs[i].dev); | ||
1578 | if (IS_ERR(p)) { | ||
1579 | pr_err("u300: could not get pinmux hog for dev %s\n", | ||
1580 | dev_name(u300_mux_hogs[i].dev)); | ||
1581 | continue; | ||
1582 | } | ||
1583 | u300_mux_hogs[i].p = p; | ||
1584 | } | ||
1585 | return 0; | ||
1586 | } | ||
1587 | subsys_initcall(u300_pinctrl_fetch); | ||
1588 | |||
1589 | /* | 1555 | /* |
1590 | * Notice that AMBA devices are initialized before platform devices. | 1556 | * Notice that AMBA devices are initialized before platform devices. |
1591 | * | 1557 | * |
diff --git a/arch/arm/mach-ux500/devices-db8500.h b/arch/arm/mach-ux500/devices-db8500.h index 4b24c9992654..a5e05f6e256f 100644 --- a/arch/arm/mach-ux500/devices-db8500.h +++ b/arch/arm/mach-ux500/devices-db8500.h | |||
@@ -8,6 +8,7 @@ | |||
8 | #ifndef __DEVICES_DB8500_H | 8 | #ifndef __DEVICES_DB8500_H |
9 | #define __DEVICES_DB8500_H | 9 | #define __DEVICES_DB8500_H |
10 | 10 | ||
11 | #include <linux/platform_data/usb-musb-ux500.h> | ||
11 | #include <mach/irqs.h> | 12 | #include <mach/irqs.h> |
12 | #include "devices-common.h" | 13 | #include "devices-common.h" |
13 | 14 | ||
diff --git a/arch/arm/plat-omap/Makefile b/arch/arm/plat-omap/Makefile index 8d885848600a..9d9aa2f55129 100644 --- a/arch/arm/plat-omap/Makefile +++ b/arch/arm/plat-omap/Makefile | |||
@@ -11,7 +11,6 @@ obj- := | |||
11 | # omap_device support (OMAP2+ only at the moment) | 11 | # omap_device support (OMAP2+ only at the moment) |
12 | 12 | ||
13 | obj-$(CONFIG_OMAP_DM_TIMER) += dmtimer.o | 13 | obj-$(CONFIG_OMAP_DM_TIMER) += dmtimer.o |
14 | obj-$(CONFIG_OMAP_DEBUG_DEVICES) += debug-devices.o | ||
15 | obj-$(CONFIG_OMAP_DEBUG_LEDS) += debug-leds.o | 14 | obj-$(CONFIG_OMAP_DEBUG_LEDS) += debug-leds.o |
16 | i2c-omap-$(CONFIG_I2C_OMAP) := i2c.o | 15 | i2c-omap-$(CONFIG_I2C_OMAP) := i2c.o |
17 | obj-y += $(i2c-omap-m) $(i2c-omap-y) | 16 | obj-y += $(i2c-omap-m) $(i2c-omap-y) |
diff --git a/arch/arm/plat-omap/debug-devices.c b/arch/arm/plat-omap/debug-devices.c deleted file mode 100644 index a609e2161817..000000000000 --- a/arch/arm/plat-omap/debug-devices.c +++ /dev/null | |||
@@ -1,92 +0,0 @@ | |||
1 | /* | ||
2 | * linux/arch/arm/plat-omap/debug-devices.c | ||
3 | * | ||
4 | * Copyright (C) 2005 Nokia Corporation | ||
5 | * Modified from mach-omap2/board-h4.c | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License version 2 as | ||
9 | * published by the Free Software Foundation. | ||
10 | */ | ||
11 | #include <linux/gpio.h> | ||
12 | #include <linux/kernel.h> | ||
13 | #include <linux/init.h> | ||
14 | #include <linux/platform_device.h> | ||
15 | #include <linux/io.h> | ||
16 | #include <linux/smc91x.h> | ||
17 | |||
18 | #include <plat/debug-devices.h> | ||
19 | |||
20 | /* Many OMAP development platforms reuse the same "debug board"; these | ||
21 | * platforms include H2, H3, H4, and Perseus2. | ||
22 | */ | ||
23 | |||
24 | static struct smc91x_platdata smc91x_info = { | ||
25 | .flags = SMC91X_USE_16BIT | SMC91X_NOWAIT, | ||
26 | .leda = RPC_LED_100_10, | ||
27 | .ledb = RPC_LED_TX_RX, | ||
28 | }; | ||
29 | |||
30 | static struct resource smc91x_resources[] = { | ||
31 | [0] = { | ||
32 | .flags = IORESOURCE_MEM, | ||
33 | }, | ||
34 | [1] = { | ||
35 | .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWEDGE, | ||
36 | }, | ||
37 | }; | ||
38 | |||
39 | static struct platform_device smc91x_device = { | ||
40 | .name = "smc91x", | ||
41 | .id = -1, | ||
42 | .dev = { | ||
43 | .platform_data = &smc91x_info, | ||
44 | }, | ||
45 | .num_resources = ARRAY_SIZE(smc91x_resources), | ||
46 | .resource = smc91x_resources, | ||
47 | }; | ||
48 | |||
49 | static struct resource led_resources[] = { | ||
50 | [0] = { | ||
51 | .flags = IORESOURCE_MEM, | ||
52 | }, | ||
53 | }; | ||
54 | |||
55 | static struct platform_device led_device = { | ||
56 | .name = "omap_dbg_led", | ||
57 | .id = -1, | ||
58 | .num_resources = ARRAY_SIZE(led_resources), | ||
59 | .resource = led_resources, | ||
60 | }; | ||
61 | |||
62 | static struct platform_device *debug_devices[] __initdata = { | ||
63 | &smc91x_device, | ||
64 | &led_device, | ||
65 | /* ps2 kbd + mouse ports */ | ||
66 | /* 4 extra uarts */ | ||
67 | /* 6 input dip switches */ | ||
68 | /* 8 output pins */ | ||
69 | }; | ||
70 | |||
71 | int __init debug_card_init(u32 addr, unsigned gpio) | ||
72 | { | ||
73 | int status; | ||
74 | |||
75 | smc91x_resources[0].start = addr + 0x300; | ||
76 | smc91x_resources[0].end = addr + 0x30f; | ||
77 | |||
78 | smc91x_resources[1].start = gpio_to_irq(gpio); | ||
79 | smc91x_resources[1].end = gpio_to_irq(gpio); | ||
80 | |||
81 | status = gpio_request(gpio, "SMC91x irq"); | ||
82 | if (status < 0) { | ||
83 | printk(KERN_ERR "GPIO%d unavailable for smc91x IRQ\n", gpio); | ||
84 | return status; | ||
85 | } | ||
86 | gpio_direction_input(gpio); | ||
87 | |||
88 | led_resources[0].start = addr; | ||
89 | led_resources[0].end = addr + SZ_4K - 1; | ||
90 | |||
91 | return platform_add_devices(debug_devices, ARRAY_SIZE(debug_devices)); | ||
92 | } | ||
diff --git a/arch/arm/plat-omap/include/plat/debug-devices.h b/arch/arm/plat-omap/include/plat/debug-devices.h deleted file mode 100644 index 8fc4287222dd..000000000000 --- a/arch/arm/plat-omap/include/plat/debug-devices.h +++ /dev/null | |||
@@ -1,2 +0,0 @@ | |||
1 | /* for TI reference platforms sharing the same debug card */ | ||
2 | extern int debug_card_init(u32 addr, unsigned gpio); | ||
diff --git a/arch/cris/include/arch-v10/arch/Kbuild b/arch/cris/include/arch-v10/arch/Kbuild index 7a192e1290b1..1f0fc7a66f5f 100644 --- a/arch/cris/include/arch-v10/arch/Kbuild +++ b/arch/cris/include/arch-v10/arch/Kbuild | |||
@@ -1,4 +1 @@ | |||
1 | header-y += user.h | # CRISv10 arch | |
2 | header-y += svinto.h | ||
3 | header-y += sv_addr_ag.h | ||
4 | header-y += sv_addr.agh | ||
diff --git a/arch/cris/include/arch-v32/arch/Kbuild b/arch/cris/include/arch-v32/arch/Kbuild index 35f2fc4f993e..2fd65c7e15c9 100644 --- a/arch/cris/include/arch-v32/arch/Kbuild +++ b/arch/cris/include/arch-v32/arch/Kbuild | |||
@@ -1,2 +1 @@ | |||
1 | header-y += user.h | # CRISv32 arch | |
2 | header-y += cryptocop.h | ||
diff --git a/arch/cris/include/arch-v32/arch/cryptocop.h b/arch/cris/include/arch-v32/arch/cryptocop.h index e1cd83dfabb5..716e434e9269 100644 --- a/arch/cris/include/arch-v32/arch/cryptocop.h +++ b/arch/cris/include/arch-v32/arch/cryptocop.h | |||
@@ -2,124 +2,12 @@ | |||
2 | * The device /dev/cryptocop is accessible using this driver using | 2 | * The device /dev/cryptocop is accessible using this driver using |
3 | * CRYPTOCOP_MAJOR (254) and minor number 0. | 3 | * CRYPTOCOP_MAJOR (254) and minor number 0. |
4 | */ | 4 | */ |
5 | |||
6 | #ifndef CRYPTOCOP_H | 5 | #ifndef CRYPTOCOP_H |
7 | #define CRYPTOCOP_H | 6 | #define CRYPTOCOP_H |
8 | 7 | ||
9 | #include <linux/uio.h> | 8 | #include <uapi/arch-v32/arch/cryptocop.h> |
10 | |||
11 | |||
12 | #define CRYPTOCOP_SESSION_ID_NONE (0) | ||
13 | |||
14 | typedef unsigned long long int cryptocop_session_id; | ||
15 | |||
16 | /* cryptocop ioctls */ | ||
17 | #define ETRAXCRYPTOCOP_IOCTYPE (250) | ||
18 | |||
19 | #define CRYPTOCOP_IO_CREATE_SESSION _IOWR(ETRAXCRYPTOCOP_IOCTYPE, 1, struct strcop_session_op) | ||
20 | #define CRYPTOCOP_IO_CLOSE_SESSION _IOW(ETRAXCRYPTOCOP_IOCTYPE, 2, struct strcop_session_op) | ||
21 | #define CRYPTOCOP_IO_PROCESS_OP _IOWR(ETRAXCRYPTOCOP_IOCTYPE, 3, struct strcop_crypto_op) | ||
22 | #define CRYPTOCOP_IO_MAXNR (3) | ||
23 | |||
24 | typedef enum { | ||
25 | cryptocop_cipher_des = 0, | ||
26 | cryptocop_cipher_3des = 1, | ||
27 | cryptocop_cipher_aes = 2, | ||
28 | cryptocop_cipher_m2m = 3, /* mem2mem is essentially a NULL cipher with blocklength=1 */ | ||
29 | cryptocop_cipher_none | ||
30 | } cryptocop_cipher_type; | ||
31 | |||
32 | typedef enum { | ||
33 | cryptocop_digest_sha1 = 0, | ||
34 | cryptocop_digest_md5 = 1, | ||
35 | cryptocop_digest_none | ||
36 | } cryptocop_digest_type; | ||
37 | |||
38 | typedef enum { | ||
39 | cryptocop_csum_le = 0, | ||
40 | cryptocop_csum_be = 1, | ||
41 | cryptocop_csum_none | ||
42 | } cryptocop_csum_type; | ||
43 | |||
44 | typedef enum { | ||
45 | cryptocop_cipher_mode_ecb = 0, | ||
46 | cryptocop_cipher_mode_cbc, | ||
47 | cryptocop_cipher_mode_none | ||
48 | } cryptocop_cipher_mode; | ||
49 | |||
50 | typedef enum { | ||
51 | cryptocop_3des_eee = 0, | ||
52 | cryptocop_3des_eed = 1, | ||
53 | cryptocop_3des_ede = 2, | ||
54 | cryptocop_3des_edd = 3, | ||
55 | cryptocop_3des_dee = 4, | ||
56 | cryptocop_3des_ded = 5, | ||
57 | cryptocop_3des_dde = 6, | ||
58 | cryptocop_3des_ddd = 7 | ||
59 | } cryptocop_3des_mode; | ||
60 | |||
61 | /* Usermode accessible (ioctl) operations. */ | ||
62 | struct strcop_session_op{ | ||
63 | cryptocop_session_id ses_id; | ||
64 | |||
65 | cryptocop_cipher_type cipher; /* AES, DES, 3DES, m2m, none */ | ||
66 | |||
67 | cryptocop_cipher_mode cmode; /* ECB, CBC, none */ | ||
68 | cryptocop_3des_mode des3_mode; | ||
69 | |||
70 | cryptocop_digest_type digest; /* MD5, SHA1, none */ | ||
71 | |||
72 | cryptocop_csum_type csum; /* BE, LE, none */ | ||
73 | |||
74 | unsigned char *key; | ||
75 | size_t keylen; | ||
76 | }; | ||
77 | |||
78 | #define CRYPTOCOP_CSUM_LENGTH (2) | ||
79 | #define CRYPTOCOP_MAX_DIGEST_LENGTH (20) /* SHA-1 20, MD5 16 */ | ||
80 | #define CRYPTOCOP_MAX_IV_LENGTH (16) /* (3)DES==8, AES == 16 */ | ||
81 | #define CRYPTOCOP_MAX_KEY_LENGTH (32) | ||
82 | |||
83 | struct strcop_crypto_op{ | ||
84 | cryptocop_session_id ses_id; | ||
85 | |||
86 | /* Indata. */ | ||
87 | unsigned char *indata; | ||
88 | size_t inlen; /* Total indata length. */ | ||
89 | |||
90 | /* Cipher configuration. */ | ||
91 | unsigned char do_cipher:1; | ||
92 | unsigned char decrypt:1; /* 1 == decrypt, 0 == encrypt */ | ||
93 | unsigned char cipher_explicit:1; | ||
94 | size_t cipher_start; | ||
95 | size_t cipher_len; | ||
96 | /* cipher_iv is used if do_cipher and cipher_explicit and the cipher | ||
97 | mode is CBC. The length is controlled by the type of cipher, | ||
98 | e.g. DES/3DES 8 octets and AES 16 octets. */ | ||
99 | unsigned char cipher_iv[CRYPTOCOP_MAX_IV_LENGTH]; | ||
100 | /* Outdata. */ | ||
101 | unsigned char *cipher_outdata; | ||
102 | size_t cipher_outlen; | ||
103 | |||
104 | /* digest configuration. */ | ||
105 | unsigned char do_digest:1; | ||
106 | size_t digest_start; | ||
107 | size_t digest_len; | ||
108 | /* Outdata. The actual length is determined by the type of the digest. */ | ||
109 | unsigned char digest[CRYPTOCOP_MAX_DIGEST_LENGTH]; | ||
110 | |||
111 | /* Checksum configuration. */ | ||
112 | unsigned char do_csum:1; | ||
113 | size_t csum_start; | ||
114 | size_t csum_len; | ||
115 | /* Outdata. */ | ||
116 | unsigned char csum[CRYPTOCOP_CSUM_LENGTH]; | ||
117 | }; | ||
118 | 9 | ||
119 | 10 | ||
120 | |||
121 | #ifdef __KERNEL__ | ||
122 | |||
123 | /********** The API to use from inside the kernel. ************/ | 11 | /********** The API to use from inside the kernel. ************/ |
124 | 12 | ||
125 | #include <arch/hwregs/dma.h> | 13 | #include <arch/hwregs/dma.h> |
@@ -267,6 +155,4 @@ int cryptocop_job_queue_insert_crypto(struct cryptocop_operation *operation); | |||
267 | 155 | ||
268 | int cryptocop_job_queue_insert_user_job(struct cryptocop_operation *operation); | 156 | int cryptocop_job_queue_insert_user_job(struct cryptocop_operation *operation); |
269 | 157 | ||
270 | #endif /* __KERNEL__ */ | ||
271 | |||
272 | #endif /* CRYPTOCOP_H */ | 158 | #endif /* CRYPTOCOP_H */ |
diff --git a/arch/cris/include/arch-v32/arch/spinlock.h b/arch/cris/include/arch-v32/arch/spinlock.h index f171a6600fbc..f13275522f4d 100644 --- a/arch/cris/include/arch-v32/arch/spinlock.h +++ b/arch/cris/include/arch-v32/arch/spinlock.h | |||
@@ -118,7 +118,7 @@ static inline int arch_write_trylock(arch_rwlock_t *rw) | |||
118 | ret = 1; | 118 | ret = 1; |
119 | } | 119 | } |
120 | arch_spin_unlock(&rw->slock); | 120 | arch_spin_unlock(&rw->slock); |
121 | return 1; | 121 | return ret; |
122 | } | 122 | } |
123 | 123 | ||
124 | #define _raw_read_lock_flags(lock, flags) _raw_read_lock(lock) | 124 | #define _raw_read_lock_flags(lock, flags) _raw_read_lock(lock) |
diff --git a/arch/cris/include/asm/Kbuild b/arch/cris/include/asm/Kbuild index 15a122c3767c..f1e79edc9dd2 100644 --- a/arch/cris/include/asm/Kbuild +++ b/arch/cris/include/asm/Kbuild | |||
@@ -1,12 +1,7 @@ | |||
1 | include include/asm-generic/Kbuild.asm | ||
2 | 1 | ||
3 | header-y += arch-v10/ | 2 | header-y += arch-v10/ |
4 | header-y += arch-v32/ | 3 | header-y += arch-v32/ |
5 | 4 | ||
6 | header-y += ethernet.h | ||
7 | header-y += etraxgpio.h | ||
8 | header-y += rs485.h | ||
9 | header-y += sync_serial.h | ||
10 | 5 | ||
11 | generic-y += clkdev.h | 6 | generic-y += clkdev.h |
12 | generic-y += exec.h | 7 | generic-y += exec.h |
diff --git a/arch/cris/include/asm/ptrace.h b/arch/cris/include/asm/ptrace.h index 6618893bfe8e..2de84d7061c7 100644 --- a/arch/cris/include/asm/ptrace.h +++ b/arch/cris/include/asm/ptrace.h | |||
@@ -1,9 +1,8 @@ | |||
1 | #ifndef _CRIS_PTRACE_H | 1 | #ifndef _CRIS_PTRACE_H |
2 | #define _CRIS_PTRACE_H | 2 | #define _CRIS_PTRACE_H |
3 | 3 | ||
4 | #include <arch/ptrace.h> | 4 | #include <uapi/asm/ptrace.h> |
5 | 5 | ||
6 | #ifdef __KERNEL__ | ||
7 | 6 | ||
8 | /* Arbitrarily choose the same ptrace numbers as used by the Sparc code. */ | 7 | /* Arbitrarily choose the same ptrace numbers as used by the Sparc code. */ |
9 | #define PTRACE_GETREGS 12 | 8 | #define PTRACE_GETREGS 12 |
@@ -11,6 +10,4 @@ | |||
11 | 10 | ||
12 | #define profile_pc(regs) instruction_pointer(regs) | 11 | #define profile_pc(regs) instruction_pointer(regs) |
13 | 12 | ||
14 | #endif /* __KERNEL__ */ | ||
15 | |||
16 | #endif /* _CRIS_PTRACE_H */ | 13 | #endif /* _CRIS_PTRACE_H */ |
diff --git a/arch/cris/include/asm/signal.h b/arch/cris/include/asm/signal.h index 72dbbf59dfae..c0cb1fd4644c 100644 --- a/arch/cris/include/asm/signal.h +++ b/arch/cris/include/asm/signal.h | |||
@@ -1,12 +1,8 @@ | |||
1 | #ifndef _ASM_CRIS_SIGNAL_H | 1 | #ifndef _ASM_CRIS_SIGNAL_H |
2 | #define _ASM_CRIS_SIGNAL_H | 2 | #define _ASM_CRIS_SIGNAL_H |
3 | 3 | ||
4 | #include <linux/types.h> | 4 | #include <uapi/asm/signal.h> |
5 | 5 | ||
6 | /* Avoid too many header ordering problems. */ | ||
7 | struct siginfo; | ||
8 | |||
9 | #ifdef __KERNEL__ | ||
10 | /* Most things should be clean enough to redefine this at will, if care | 6 | /* Most things should be clean enough to redefine this at will, if care |
11 | is taken to make libc match. */ | 7 | is taken to make libc match. */ |
12 | 8 | ||
@@ -20,95 +16,6 @@ typedef struct { | |||
20 | unsigned long sig[_NSIG_WORDS]; | 16 | unsigned long sig[_NSIG_WORDS]; |
21 | } sigset_t; | 17 | } sigset_t; |
22 | 18 | ||
23 | #else | ||
24 | /* Here we must cater to libcs that poke about in kernel headers. */ | ||
25 | |||
26 | #define NSIG 32 | ||
27 | typedef unsigned long sigset_t; | ||
28 | |||
29 | #endif /* __KERNEL__ */ | ||
30 | |||
31 | #define SIGHUP 1 | ||
32 | #define SIGINT 2 | ||
33 | #define SIGQUIT 3 | ||
34 | #define SIGILL 4 | ||
35 | #define SIGTRAP 5 | ||
36 | #define SIGABRT 6 | ||
37 | #define SIGIOT 6 | ||
38 | #define SIGBUS 7 | ||
39 | #define SIGFPE 8 | ||
40 | #define SIGKILL 9 | ||
41 | #define SIGUSR1 10 | ||
42 | #define SIGSEGV 11 | ||
43 | #define SIGUSR2 12 | ||
44 | #define SIGPIPE 13 | ||
45 | #define SIGALRM 14 | ||
46 | #define SIGTERM 15 | ||
47 | #define SIGSTKFLT 16 | ||
48 | #define SIGCHLD 17 | ||
49 | #define SIGCONT 18 | ||
50 | #define SIGSTOP 19 | ||
51 | #define SIGTSTP 20 | ||
52 | #define SIGTTIN 21 | ||
53 | #define SIGTTOU 22 | ||
54 | #define SIGURG 23 | ||
55 | #define SIGXCPU 24 | ||
56 | #define SIGXFSZ 25 | ||
57 | #define SIGVTALRM 26 | ||
58 | #define SIGPROF 27 | ||
59 | #define SIGWINCH 28 | ||
60 | #define SIGIO 29 | ||
61 | #define SIGPOLL SIGIO | ||
62 | /* | ||
63 | #define SIGLOST 29 | ||
64 | */ | ||
65 | #define SIGPWR 30 | ||
66 | #define SIGSYS 31 | ||
67 | #define SIGUNUSED 31 | ||
68 | |||
69 | /* These should not be considered constants from userland. */ | ||
70 | #define SIGRTMIN 32 | ||
71 | #define SIGRTMAX _NSIG | ||
72 | |||
73 | /* | ||
74 | * SA_FLAGS values: | ||
75 | * | ||
76 | * SA_ONSTACK indicates that a registered stack_t will be used. | ||
77 | * SA_RESTART flag to get restarting signals (which were the default long ago) | ||
78 | * SA_NOCLDSTOP flag to turn off SIGCHLD when children stop. | ||
79 | * SA_RESETHAND clears the handler when the signal is delivered. | ||
80 | * SA_NOCLDWAIT flag on SIGCHLD to inhibit zombies. | ||
81 | * SA_NODEFER prevents the current signal from being masked in the handler. | ||
82 | * | ||
83 | * SA_ONESHOT and SA_NOMASK are the historical Linux names for the Single | ||
84 | * Unix names RESETHAND and NODEFER respectively. | ||
85 | */ | ||
86 | |||
87 | #define SA_NOCLDSTOP 0x00000001u | ||
88 | #define SA_NOCLDWAIT 0x00000002u | ||
89 | #define SA_SIGINFO 0x00000004u | ||
90 | #define SA_ONSTACK 0x08000000u | ||
91 | #define SA_RESTART 0x10000000u | ||
92 | #define SA_NODEFER 0x40000000u | ||
93 | #define SA_RESETHAND 0x80000000u | ||
94 | |||
95 | #define SA_NOMASK SA_NODEFER | ||
96 | #define SA_ONESHOT SA_RESETHAND | ||
97 | |||
98 | #define SA_RESTORER 0x04000000 | ||
99 | |||
100 | /* | ||
101 | * sigaltstack controls | ||
102 | */ | ||
103 | #define SS_ONSTACK 1 | ||
104 | #define SS_DISABLE 2 | ||
105 | |||
106 | #define MINSIGSTKSZ 2048 | ||
107 | #define SIGSTKSZ 8192 | ||
108 | |||
109 | #include <asm-generic/signal-defs.h> | ||
110 | |||
111 | #ifdef __KERNEL__ | ||
112 | struct old_sigaction { | 19 | struct old_sigaction { |
113 | __sighandler_t sa_handler; | 20 | __sighandler_t sa_handler; |
114 | old_sigset_t sa_mask; | 21 | old_sigset_t sa_mask; |
@@ -126,32 +33,6 @@ struct sigaction { | |||
126 | struct k_sigaction { | 33 | struct k_sigaction { |
127 | struct sigaction sa; | 34 | struct sigaction sa; |
128 | }; | 35 | }; |
129 | #else | ||
130 | /* Here we must cater to libcs that poke about in kernel headers. */ | ||
131 | |||
132 | struct sigaction { | ||
133 | union { | ||
134 | __sighandler_t _sa_handler; | ||
135 | void (*_sa_sigaction)(int, struct siginfo *, void *); | ||
136 | } _u; | ||
137 | sigset_t sa_mask; | ||
138 | unsigned long sa_flags; | ||
139 | void (*sa_restorer)(void); | ||
140 | }; | ||
141 | |||
142 | #define sa_handler _u._sa_handler | ||
143 | #define sa_sigaction _u._sa_sigaction | ||
144 | |||
145 | #endif /* __KERNEL__ */ | ||
146 | |||
147 | typedef struct sigaltstack { | ||
148 | void *ss_sp; | ||
149 | int ss_flags; | ||
150 | size_t ss_size; | ||
151 | } stack_t; | ||
152 | |||
153 | #ifdef __KERNEL__ | ||
154 | #include <asm/sigcontext.h> | 36 | #include <asm/sigcontext.h> |
155 | #endif /* __KERNEL__ */ | ||
156 | 37 | ||
157 | #endif | 38 | #endif |
diff --git a/arch/cris/include/asm/swab.h b/arch/cris/include/asm/swab.h index 80668e88419c..991b6ace1ba9 100644 --- a/arch/cris/include/asm/swab.h +++ b/arch/cris/include/asm/swab.h | |||
@@ -1,8 +1,7 @@ | |||
1 | #ifndef _CRIS_SWAB_H | 1 | #ifndef _CRIS_SWAB_H |
2 | #define _CRIS_SWAB_H | 2 | #define _CRIS_SWAB_H |
3 | 3 | ||
4 | #ifdef __KERNEL__ | ||
5 | #include <arch/swab.h> | 4 | #include <arch/swab.h> |
6 | #endif /* __KERNEL__ */ | 5 | #include <uapi/asm/swab.h> |
7 | 6 | ||
8 | #endif /* _CRIS_SWAB_H */ | 7 | #endif /* _CRIS_SWAB_H */ |
diff --git a/arch/cris/include/asm/termios.h b/arch/cris/include/asm/termios.h index 1265109f4ce3..1991cd9e4083 100644 --- a/arch/cris/include/asm/termios.h +++ b/arch/cris/include/asm/termios.h | |||
@@ -1,47 +1,8 @@ | |||
1 | #ifndef _CRIS_TERMIOS_H | 1 | #ifndef _CRIS_TERMIOS_H |
2 | #define _CRIS_TERMIOS_H | 2 | #define _CRIS_TERMIOS_H |
3 | 3 | ||
4 | #include <asm/termbits.h> | 4 | #include <uapi/asm/termios.h> |
5 | #include <asm/ioctls.h> | ||
6 | #include <asm/rs485.h> | ||
7 | #include <linux/serial.h> | ||
8 | 5 | ||
9 | struct winsize { | ||
10 | unsigned short ws_row; | ||
11 | unsigned short ws_col; | ||
12 | unsigned short ws_xpixel; | ||
13 | unsigned short ws_ypixel; | ||
14 | }; | ||
15 | |||
16 | #define NCC 8 | ||
17 | struct termio { | ||
18 | unsigned short c_iflag; /* input mode flags */ | ||
19 | unsigned short c_oflag; /* output mode flags */ | ||
20 | unsigned short c_cflag; /* control mode flags */ | ||
21 | unsigned short c_lflag; /* local mode flags */ | ||
22 | unsigned char c_line; /* line discipline */ | ||
23 | unsigned char c_cc[NCC]; /* control characters */ | ||
24 | }; | ||
25 | |||
26 | /* modem lines */ | ||
27 | #define TIOCM_LE 0x001 | ||
28 | #define TIOCM_DTR 0x002 | ||
29 | #define TIOCM_RTS 0x004 | ||
30 | #define TIOCM_ST 0x008 | ||
31 | #define TIOCM_SR 0x010 | ||
32 | #define TIOCM_CTS 0x020 | ||
33 | #define TIOCM_CAR 0x040 | ||
34 | #define TIOCM_RNG 0x080 | ||
35 | #define TIOCM_DSR 0x100 | ||
36 | #define TIOCM_CD TIOCM_CAR | ||
37 | #define TIOCM_RI TIOCM_RNG | ||
38 | #define TIOCM_OUT1 0x2000 | ||
39 | #define TIOCM_OUT2 0x4000 | ||
40 | #define TIOCM_LOOP 0x8000 | ||
41 | |||
42 | /* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */ | ||
43 | |||
44 | #ifdef __KERNEL__ | ||
45 | 6 | ||
46 | /* intr=^C quit=^\ erase=del kill=^U | 7 | /* intr=^C quit=^\ erase=del kill=^U |
47 | eof=^D vtime=\0 vmin=\1 sxtc=\0 | 8 | eof=^D vtime=\0 vmin=\1 sxtc=\0 |
@@ -87,6 +48,4 @@ struct termio { | |||
87 | #define user_termios_to_kernel_termios_1(k, u) copy_from_user(k, u, sizeof(struct termios)) | 48 | #define user_termios_to_kernel_termios_1(k, u) copy_from_user(k, u, sizeof(struct termios)) |
88 | #define kernel_termios_to_user_termios_1(u, k) copy_to_user(u, k, sizeof(struct termios)) | 49 | #define kernel_termios_to_user_termios_1(u, k) copy_to_user(u, k, sizeof(struct termios)) |
89 | 50 | ||
90 | #endif /* __KERNEL__ */ | ||
91 | |||
92 | #endif /* _CRIS_TERMIOS_H */ | 51 | #endif /* _CRIS_TERMIOS_H */ |
diff --git a/arch/cris/include/asm/types.h b/arch/cris/include/asm/types.h index adaf82780bb4..a3cac7757c7f 100644 --- a/arch/cris/include/asm/types.h +++ b/arch/cris/include/asm/types.h | |||
@@ -1,15 +1,12 @@ | |||
1 | #ifndef _ETRAX_TYPES_H | 1 | #ifndef _ETRAX_TYPES_H |
2 | #define _ETRAX_TYPES_H | 2 | #define _ETRAX_TYPES_H |
3 | 3 | ||
4 | #include <asm-generic/int-ll64.h> | 4 | #include <uapi/asm/types.h> |
5 | 5 | ||
6 | /* | 6 | /* |
7 | * These aren't exported outside the kernel to avoid name space clashes | 7 | * These aren't exported outside the kernel to avoid name space clashes |
8 | */ | 8 | */ |
9 | #ifdef __KERNEL__ | ||
10 | 9 | ||
11 | #define BITS_PER_LONG 32 | 10 | #define BITS_PER_LONG 32 |
12 | 11 | ||
13 | #endif /* __KERNEL__ */ | ||
14 | |||
15 | #endif | 12 | #endif |
diff --git a/arch/cris/include/asm/unistd.h b/arch/cris/include/asm/unistd.h index f27b542e0ebc..89680f9eac0d 100644 --- a/arch/cris/include/asm/unistd.h +++ b/arch/cris/include/asm/unistd.h | |||
@@ -1,347 +1,8 @@ | |||
1 | #ifndef _ASM_CRIS_UNISTD_H_ | 1 | #ifndef _ASM_CRIS_UNISTD_H_ |
2 | #define _ASM_CRIS_UNISTD_H_ | 2 | #define _ASM_CRIS_UNISTD_H_ |
3 | 3 | ||
4 | /* | 4 | #include <uapi/asm/unistd.h> |
5 | * This file contains the system call numbers, and stub macros for libc. | ||
6 | */ | ||
7 | |||
8 | #define __NR_restart_syscall 0 | ||
9 | #define __NR_exit 1 | ||
10 | #define __NR_fork 2 | ||
11 | #define __NR_read 3 | ||
12 | #define __NR_write 4 | ||
13 | #define __NR_open 5 | ||
14 | #define __NR_close 6 | ||
15 | #define __NR_waitpid 7 | ||
16 | #define __NR_creat 8 | ||
17 | #define __NR_link 9 | ||
18 | #define __NR_unlink 10 | ||
19 | #define __NR_execve 11 | ||
20 | #define __NR_chdir 12 | ||
21 | #define __NR_time 13 | ||
22 | #define __NR_mknod 14 | ||
23 | #define __NR_chmod 15 | ||
24 | #define __NR_lchown 16 | ||
25 | #define __NR_break 17 | ||
26 | #define __NR_oldstat 18 | ||
27 | #define __NR_lseek 19 | ||
28 | #define __NR_getpid 20 | ||
29 | #define __NR_mount 21 | ||
30 | #define __NR_umount 22 | ||
31 | #define __NR_setuid 23 | ||
32 | #define __NR_getuid 24 | ||
33 | #define __NR_stime 25 | ||
34 | #define __NR_ptrace 26 | ||
35 | #define __NR_alarm 27 | ||
36 | #define __NR_oldfstat 28 | ||
37 | #define __NR_pause 29 | ||
38 | #define __NR_utime 30 | ||
39 | #define __NR_stty 31 | ||
40 | #define __NR_gtty 32 | ||
41 | #define __NR_access 33 | ||
42 | #define __NR_nice 34 | ||
43 | #define __NR_ftime 35 | ||
44 | #define __NR_sync 36 | ||
45 | #define __NR_kill 37 | ||
46 | #define __NR_rename 38 | ||
47 | #define __NR_mkdir 39 | ||
48 | #define __NR_rmdir 40 | ||
49 | #define __NR_dup 41 | ||
50 | #define __NR_pipe 42 | ||
51 | #define __NR_times 43 | ||
52 | #define __NR_prof 44 | ||
53 | #define __NR_brk 45 | ||
54 | #define __NR_setgid 46 | ||
55 | #define __NR_getgid 47 | ||
56 | #define __NR_signal 48 | ||
57 | #define __NR_geteuid 49 | ||
58 | #define __NR_getegid 50 | ||
59 | #define __NR_acct 51 | ||
60 | #define __NR_umount2 52 | ||
61 | #define __NR_lock 53 | ||
62 | #define __NR_ioctl 54 | ||
63 | #define __NR_fcntl 55 | ||
64 | #define __NR_mpx 56 | ||
65 | #define __NR_setpgid 57 | ||
66 | #define __NR_ulimit 58 | ||
67 | #define __NR_oldolduname 59 | ||
68 | #define __NR_umask 60 | ||
69 | #define __NR_chroot 61 | ||
70 | #define __NR_ustat 62 | ||
71 | #define __NR_dup2 63 | ||
72 | #define __NR_getppid 64 | ||
73 | #define __NR_getpgrp 65 | ||
74 | #define __NR_setsid 66 | ||
75 | #define __NR_sigaction 67 | ||
76 | #define __NR_sgetmask 68 | ||
77 | #define __NR_ssetmask 69 | ||
78 | #define __NR_setreuid 70 | ||
79 | #define __NR_setregid 71 | ||
80 | #define __NR_sigsuspend 72 | ||
81 | #define __NR_sigpending 73 | ||
82 | #define __NR_sethostname 74 | ||
83 | #define __NR_setrlimit 75 | ||
84 | #define __NR_getrlimit 76 | ||
85 | #define __NR_getrusage 77 | ||
86 | #define __NR_gettimeofday 78 | ||
87 | #define __NR_settimeofday 79 | ||
88 | #define __NR_getgroups 80 | ||
89 | #define __NR_setgroups 81 | ||
90 | #define __NR_select 82 | ||
91 | #define __NR_symlink 83 | ||
92 | #define __NR_oldlstat 84 | ||
93 | #define __NR_readlink 85 | ||
94 | #define __NR_uselib 86 | ||
95 | #define __NR_swapon 87 | ||
96 | #define __NR_reboot 88 | ||
97 | #define __NR_readdir 89 | ||
98 | #define __NR_mmap 90 | ||
99 | #define __NR_munmap 91 | ||
100 | #define __NR_truncate 92 | ||
101 | #define __NR_ftruncate 93 | ||
102 | #define __NR_fchmod 94 | ||
103 | #define __NR_fchown 95 | ||
104 | #define __NR_getpriority 96 | ||
105 | #define __NR_setpriority 97 | ||
106 | #define __NR_profil 98 | ||
107 | #define __NR_statfs 99 | ||
108 | #define __NR_fstatfs 100 | ||
109 | #define __NR_ioperm 101 | ||
110 | #define __NR_socketcall 102 | ||
111 | #define __NR_syslog 103 | ||
112 | #define __NR_setitimer 104 | ||
113 | #define __NR_getitimer 105 | ||
114 | #define __NR_stat 106 | ||
115 | #define __NR_lstat 107 | ||
116 | #define __NR_fstat 108 | ||
117 | #define __NR_olduname 109 | ||
118 | #define __NR_iopl 110 | ||
119 | #define __NR_vhangup 111 | ||
120 | #define __NR_idle 112 | ||
121 | #define __NR_vm86 113 | ||
122 | #define __NR_wait4 114 | ||
123 | #define __NR_swapoff 115 | ||
124 | #define __NR_sysinfo 116 | ||
125 | #define __NR_ipc 117 | ||
126 | #define __NR_fsync 118 | ||
127 | #define __NR_sigreturn 119 | ||
128 | #define __NR_clone 120 | ||
129 | #define __NR_setdomainname 121 | ||
130 | #define __NR_uname 122 | ||
131 | #define __NR_modify_ldt 123 | ||
132 | #define __NR_adjtimex 124 | ||
133 | #define __NR_mprotect 125 | ||
134 | #define __NR_sigprocmask 126 | ||
135 | #define __NR_create_module 127 | ||
136 | #define __NR_init_module 128 | ||
137 | #define __NR_delete_module 129 | ||
138 | #define __NR_get_kernel_syms 130 | ||
139 | #define __NR_quotactl 131 | ||
140 | #define __NR_getpgid 132 | ||
141 | #define __NR_fchdir 133 | ||
142 | #define __NR_bdflush 134 | ||
143 | #define __NR_sysfs 135 | ||
144 | #define __NR_personality 136 | ||
145 | #define __NR_afs_syscall 137 /* Syscall for Andrew File System */ | ||
146 | #define __NR_setfsuid 138 | ||
147 | #define __NR_setfsgid 139 | ||
148 | #define __NR__llseek 140 | ||
149 | #define __NR_getdents 141 | ||
150 | #define __NR__newselect 142 | ||
151 | #define __NR_flock 143 | ||
152 | #define __NR_msync 144 | ||
153 | #define __NR_readv 145 | ||
154 | #define __NR_writev 146 | ||
155 | #define __NR_getsid 147 | ||
156 | #define __NR_fdatasync 148 | ||
157 | #define __NR__sysctl 149 | ||
158 | #define __NR_mlock 150 | ||
159 | #define __NR_munlock 151 | ||
160 | #define __NR_mlockall 152 | ||
161 | #define __NR_munlockall 153 | ||
162 | #define __NR_sched_setparam 154 | ||
163 | #define __NR_sched_getparam 155 | ||
164 | #define __NR_sched_setscheduler 156 | ||
165 | #define __NR_sched_getscheduler 157 | ||
166 | #define __NR_sched_yield 158 | ||
167 | #define __NR_sched_get_priority_max 159 | ||
168 | #define __NR_sched_get_priority_min 160 | ||
169 | #define __NR_sched_rr_get_interval 161 | ||
170 | #define __NR_nanosleep 162 | ||
171 | #define __NR_mremap 163 | ||
172 | #define __NR_setresuid 164 | ||
173 | #define __NR_getresuid 165 | ||
174 | |||
175 | #define __NR_query_module 167 | ||
176 | #define __NR_poll 168 | ||
177 | #define __NR_nfsservctl 169 | ||
178 | #define __NR_setresgid 170 | ||
179 | #define __NR_getresgid 171 | ||
180 | #define __NR_prctl 172 | ||
181 | #define __NR_rt_sigreturn 173 | ||
182 | #define __NR_rt_sigaction 174 | ||
183 | #define __NR_rt_sigprocmask 175 | ||
184 | #define __NR_rt_sigpending 176 | ||
185 | #define __NR_rt_sigtimedwait 177 | ||
186 | #define __NR_rt_sigqueueinfo 178 | ||
187 | #define __NR_rt_sigsuspend 179 | ||
188 | #define __NR_pread64 180 | ||
189 | #define __NR_pwrite64 181 | ||
190 | #define __NR_chown 182 | ||
191 | #define __NR_getcwd 183 | ||
192 | #define __NR_capget 184 | ||
193 | #define __NR_capset 185 | ||
194 | #define __NR_sigaltstack 186 | ||
195 | #define __NR_sendfile 187 | ||
196 | #define __NR_getpmsg 188 /* some people actually want streams */ | ||
197 | #define __NR_putpmsg 189 /* some people actually want streams */ | ||
198 | #define __NR_vfork 190 | ||
199 | #define __NR_ugetrlimit 191 /* SuS compliant getrlimit */ | ||
200 | #define __NR_mmap2 192 | ||
201 | #define __NR_truncate64 193 | ||
202 | #define __NR_ftruncate64 194 | ||
203 | #define __NR_stat64 195 | ||
204 | #define __NR_lstat64 196 | ||
205 | #define __NR_fstat64 197 | ||
206 | #define __NR_lchown32 198 | ||
207 | #define __NR_getuid32 199 | ||
208 | #define __NR_getgid32 200 | ||
209 | #define __NR_geteuid32 201 | ||
210 | #define __NR_getegid32 202 | ||
211 | #define __NR_setreuid32 203 | ||
212 | #define __NR_setregid32 204 | ||
213 | #define __NR_getgroups32 205 | ||
214 | #define __NR_setgroups32 206 | ||
215 | #define __NR_fchown32 207 | ||
216 | #define __NR_setresuid32 208 | ||
217 | #define __NR_getresuid32 209 | ||
218 | #define __NR_setresgid32 210 | ||
219 | #define __NR_getresgid32 211 | ||
220 | #define __NR_chown32 212 | ||
221 | #define __NR_setuid32 213 | ||
222 | #define __NR_setgid32 214 | ||
223 | #define __NR_setfsuid32 215 | ||
224 | #define __NR_setfsgid32 216 | ||
225 | #define __NR_pivot_root 217 | ||
226 | #define __NR_mincore 218 | ||
227 | #define __NR_madvise 219 | ||
228 | #define __NR_getdents64 220 | ||
229 | #define __NR_fcntl64 221 | ||
230 | /* 223 is unused */ | ||
231 | #define __NR_gettid 224 | ||
232 | #define __NR_readahead 225 | ||
233 | #define __NR_setxattr 226 | ||
234 | #define __NR_lsetxattr 227 | ||
235 | #define __NR_fsetxattr 228 | ||
236 | #define __NR_getxattr 229 | ||
237 | #define __NR_lgetxattr 230 | ||
238 | #define __NR_fgetxattr 231 | ||
239 | #define __NR_listxattr 232 | ||
240 | #define __NR_llistxattr 233 | ||
241 | #define __NR_flistxattr 234 | ||
242 | #define __NR_removexattr 235 | ||
243 | #define __NR_lremovexattr 236 | ||
244 | #define __NR_fremovexattr 237 | ||
245 | #define __NR_tkill 238 | ||
246 | #define __NR_sendfile64 239 | ||
247 | #define __NR_futex 240 | ||
248 | #define __NR_sched_setaffinity 241 | ||
249 | #define __NR_sched_getaffinity 242 | ||
250 | #define __NR_set_thread_area 243 | ||
251 | #define __NR_get_thread_area 244 | ||
252 | #define __NR_io_setup 245 | ||
253 | #define __NR_io_destroy 246 | ||
254 | #define __NR_io_getevents 247 | ||
255 | #define __NR_io_submit 248 | ||
256 | #define __NR_io_cancel 249 | ||
257 | #define __NR_fadvise64 250 | ||
258 | /* 251 is available for reuse (was briefly sys_set_zone_reclaim) */ | ||
259 | #define __NR_exit_group 252 | ||
260 | #define __NR_lookup_dcookie 253 | ||
261 | #define __NR_epoll_create 254 | ||
262 | #define __NR_epoll_ctl 255 | ||
263 | #define __NR_epoll_wait 256 | ||
264 | #define __NR_remap_file_pages 257 | ||
265 | #define __NR_set_tid_address 258 | ||
266 | #define __NR_timer_create 259 | ||
267 | #define __NR_timer_settime (__NR_timer_create+1) | ||
268 | #define __NR_timer_gettime (__NR_timer_create+2) | ||
269 | #define __NR_timer_getoverrun (__NR_timer_create+3) | ||
270 | #define __NR_timer_delete (__NR_timer_create+4) | ||
271 | #define __NR_clock_settime (__NR_timer_create+5) | ||
272 | #define __NR_clock_gettime (__NR_timer_create+6) | ||
273 | #define __NR_clock_getres (__NR_timer_create+7) | ||
274 | #define __NR_clock_nanosleep (__NR_timer_create+8) | ||
275 | #define __NR_statfs64 268 | ||
276 | #define __NR_fstatfs64 269 | ||
277 | #define __NR_tgkill 270 | ||
278 | #define __NR_utimes 271 | ||
279 | #define __NR_fadvise64_64 272 | ||
280 | #define __NR_vserver 273 | ||
281 | #define __NR_mbind 274 | ||
282 | #define __NR_get_mempolicy 275 | ||
283 | #define __NR_set_mempolicy 276 | ||
284 | #define __NR_mq_open 277 | ||
285 | #define __NR_mq_unlink (__NR_mq_open+1) | ||
286 | #define __NR_mq_timedsend (__NR_mq_open+2) | ||
287 | #define __NR_mq_timedreceive (__NR_mq_open+3) | ||
288 | #define __NR_mq_notify (__NR_mq_open+4) | ||
289 | #define __NR_mq_getsetattr (__NR_mq_open+5) | ||
290 | #define __NR_kexec_load 283 | ||
291 | #define __NR_waitid 284 | ||
292 | /* #define __NR_sys_setaltroot 285 */ | ||
293 | #define __NR_add_key 286 | ||
294 | #define __NR_request_key 287 | ||
295 | #define __NR_keyctl 288 | ||
296 | #define __NR_ioprio_set 289 | ||
297 | #define __NR_ioprio_get 290 | ||
298 | #define __NR_inotify_init 291 | ||
299 | #define __NR_inotify_add_watch 292 | ||
300 | #define __NR_inotify_rm_watch 293 | ||
301 | #define __NR_migrate_pages 294 | ||
302 | #define __NR_openat 295 | ||
303 | #define __NR_mkdirat 296 | ||
304 | #define __NR_mknodat 297 | ||
305 | #define __NR_fchownat 298 | ||
306 | #define __NR_futimesat 299 | ||
307 | #define __NR_fstatat64 300 | ||
308 | #define __NR_unlinkat 301 | ||
309 | #define __NR_renameat 302 | ||
310 | #define __NR_linkat 303 | ||
311 | #define __NR_symlinkat 304 | ||
312 | #define __NR_readlinkat 305 | ||
313 | #define __NR_fchmodat 306 | ||
314 | #define __NR_faccessat 307 | ||
315 | #define __NR_pselect6 308 | ||
316 | #define __NR_ppoll 309 | ||
317 | #define __NR_unshare 310 | ||
318 | #define __NR_set_robust_list 311 | ||
319 | #define __NR_get_robust_list 312 | ||
320 | #define __NR_splice 313 | ||
321 | #define __NR_sync_file_range 314 | ||
322 | #define __NR_tee 315 | ||
323 | #define __NR_vmsplice 316 | ||
324 | #define __NR_move_pages 317 | ||
325 | #define __NR_getcpu 318 | ||
326 | #define __NR_epoll_pwait 319 | ||
327 | #define __NR_utimensat 320 | ||
328 | #define __NR_signalfd 321 | ||
329 | #define __NR_timerfd_create 322 | ||
330 | #define __NR_eventfd 323 | ||
331 | #define __NR_fallocate 324 | ||
332 | #define __NR_timerfd_settime 325 | ||
333 | #define __NR_timerfd_gettime 326 | ||
334 | #define __NR_signalfd4 327 | ||
335 | #define __NR_eventfd2 328 | ||
336 | #define __NR_epoll_create1 329 | ||
337 | #define __NR_dup3 330 | ||
338 | #define __NR_pipe2 331 | ||
339 | #define __NR_inotify_init1 332 | ||
340 | #define __NR_preadv 333 | ||
341 | #define __NR_pwritev 334 | ||
342 | #define __NR_setns 335 | ||
343 | 5 | ||
344 | #ifdef __KERNEL__ | ||
345 | 6 | ||
346 | #define NR_syscalls 336 | 7 | #define NR_syscalls 336 |
347 | 8 | ||
@@ -384,5 +45,4 @@ | |||
384 | */ | 45 | */ |
385 | #define cond_syscall(x) asm(".weak\t" #x "\n\t.set\t" #x ",sys_ni_syscall") | 46 | #define cond_syscall(x) asm(".weak\t" #x "\n\t.set\t" #x ",sys_ni_syscall") |
386 | 47 | ||
387 | #endif /* __KERNEL__ */ | ||
388 | #endif /* _ASM_CRIS_UNISTD_H_ */ | 48 | #endif /* _ASM_CRIS_UNISTD_H_ */ |
diff --git a/arch/cris/include/uapi/arch-v10/arch/Kbuild b/arch/cris/include/uapi/arch-v10/arch/Kbuild index aafaa5aa54d4..9048c87a782b 100644 --- a/arch/cris/include/uapi/arch-v10/arch/Kbuild +++ b/arch/cris/include/uapi/arch-v10/arch/Kbuild | |||
@@ -1 +1,5 @@ | |||
1 | # UAPI Header export list | 1 | # UAPI Header export list |
2 | header-y += sv_addr.agh | ||
3 | header-y += sv_addr_ag.h | ||
4 | header-y += svinto.h | ||
5 | header-y += user.h | ||
diff --git a/arch/cris/include/arch-v10/arch/sv_addr.agh b/arch/cris/include/uapi/arch-v10/arch/sv_addr.agh index 6ac3a7bc9760..6ac3a7bc9760 100644 --- a/arch/cris/include/arch-v10/arch/sv_addr.agh +++ b/arch/cris/include/uapi/arch-v10/arch/sv_addr.agh | |||
diff --git a/arch/cris/include/arch-v10/arch/sv_addr_ag.h b/arch/cris/include/uapi/arch-v10/arch/sv_addr_ag.h index 5517f04153a4..5517f04153a4 100644 --- a/arch/cris/include/arch-v10/arch/sv_addr_ag.h +++ b/arch/cris/include/uapi/arch-v10/arch/sv_addr_ag.h | |||
diff --git a/arch/cris/include/arch-v10/arch/svinto.h b/arch/cris/include/uapi/arch-v10/arch/svinto.h index da5c15272652..da5c15272652 100644 --- a/arch/cris/include/arch-v10/arch/svinto.h +++ b/arch/cris/include/uapi/arch-v10/arch/svinto.h | |||
diff --git a/arch/cris/include/arch-v10/arch/user.h b/arch/cris/include/uapi/arch-v10/arch/user.h index 9303ea77c915..9303ea77c915 100644 --- a/arch/cris/include/arch-v10/arch/user.h +++ b/arch/cris/include/uapi/arch-v10/arch/user.h | |||
diff --git a/arch/cris/include/uapi/arch-v32/arch/Kbuild b/arch/cris/include/uapi/arch-v32/arch/Kbuild index aafaa5aa54d4..59efffd16b61 100644 --- a/arch/cris/include/uapi/arch-v32/arch/Kbuild +++ b/arch/cris/include/uapi/arch-v32/arch/Kbuild | |||
@@ -1 +1,3 @@ | |||
1 | # UAPI Header export list | 1 | # UAPI Header export list |
2 | header-y += cryptocop.h | ||
3 | header-y += user.h | ||
diff --git a/arch/cris/include/uapi/arch-v32/arch/cryptocop.h b/arch/cris/include/uapi/arch-v32/arch/cryptocop.h new file mode 100644 index 000000000000..694fd13ce1cf --- /dev/null +++ b/arch/cris/include/uapi/arch-v32/arch/cryptocop.h | |||
@@ -0,0 +1,122 @@ | |||
1 | /* | ||
2 | * The device /dev/cryptocop is accessible using this driver using | ||
3 | * CRYPTOCOP_MAJOR (254) and minor number 0. | ||
4 | */ | ||
5 | |||
6 | #ifndef _UAPICRYPTOCOP_H | ||
7 | #define _UAPICRYPTOCOP_H | ||
8 | |||
9 | #include <linux/uio.h> | ||
10 | |||
11 | |||
12 | #define CRYPTOCOP_SESSION_ID_NONE (0) | ||
13 | |||
14 | typedef unsigned long long int cryptocop_session_id; | ||
15 | |||
16 | /* cryptocop ioctls */ | ||
17 | #define ETRAXCRYPTOCOP_IOCTYPE (250) | ||
18 | |||
19 | #define CRYPTOCOP_IO_CREATE_SESSION _IOWR(ETRAXCRYPTOCOP_IOCTYPE, 1, struct strcop_session_op) | ||
20 | #define CRYPTOCOP_IO_CLOSE_SESSION _IOW(ETRAXCRYPTOCOP_IOCTYPE, 2, struct strcop_session_op) | ||
21 | #define CRYPTOCOP_IO_PROCESS_OP _IOWR(ETRAXCRYPTOCOP_IOCTYPE, 3, struct strcop_crypto_op) | ||
22 | #define CRYPTOCOP_IO_MAXNR (3) | ||
23 | |||
24 | typedef enum { | ||
25 | cryptocop_cipher_des = 0, | ||
26 | cryptocop_cipher_3des = 1, | ||
27 | cryptocop_cipher_aes = 2, | ||
28 | cryptocop_cipher_m2m = 3, /* mem2mem is essentially a NULL cipher with blocklength=1 */ | ||
29 | cryptocop_cipher_none | ||
30 | } cryptocop_cipher_type; | ||
31 | |||
32 | typedef enum { | ||
33 | cryptocop_digest_sha1 = 0, | ||
34 | cryptocop_digest_md5 = 1, | ||
35 | cryptocop_digest_none | ||
36 | } cryptocop_digest_type; | ||
37 | |||
38 | typedef enum { | ||
39 | cryptocop_csum_le = 0, | ||
40 | cryptocop_csum_be = 1, | ||
41 | cryptocop_csum_none | ||
42 | } cryptocop_csum_type; | ||
43 | |||
44 | typedef enum { | ||
45 | cryptocop_cipher_mode_ecb = 0, | ||
46 | cryptocop_cipher_mode_cbc, | ||
47 | cryptocop_cipher_mode_none | ||
48 | } cryptocop_cipher_mode; | ||
49 | |||
50 | typedef enum { | ||
51 | cryptocop_3des_eee = 0, | ||
52 | cryptocop_3des_eed = 1, | ||
53 | cryptocop_3des_ede = 2, | ||
54 | cryptocop_3des_edd = 3, | ||
55 | cryptocop_3des_dee = 4, | ||
56 | cryptocop_3des_ded = 5, | ||
57 | cryptocop_3des_dde = 6, | ||
58 | cryptocop_3des_ddd = 7 | ||
59 | } cryptocop_3des_mode; | ||
60 | |||
61 | /* Usermode accessible (ioctl) operations. */ | ||
62 | struct strcop_session_op{ | ||
63 | cryptocop_session_id ses_id; | ||
64 | |||
65 | cryptocop_cipher_type cipher; /* AES, DES, 3DES, m2m, none */ | ||
66 | |||
67 | cryptocop_cipher_mode cmode; /* ECB, CBC, none */ | ||
68 | cryptocop_3des_mode des3_mode; | ||
69 | |||
70 | cryptocop_digest_type digest; /* MD5, SHA1, none */ | ||
71 | |||
72 | cryptocop_csum_type csum; /* BE, LE, none */ | ||
73 | |||
74 | unsigned char *key; | ||
75 | size_t keylen; | ||
76 | }; | ||
77 | |||
78 | #define CRYPTOCOP_CSUM_LENGTH (2) | ||
79 | #define CRYPTOCOP_MAX_DIGEST_LENGTH (20) /* SHA-1 20, MD5 16 */ | ||
80 | #define CRYPTOCOP_MAX_IV_LENGTH (16) /* (3)DES==8, AES == 16 */ | ||
81 | #define CRYPTOCOP_MAX_KEY_LENGTH (32) | ||
82 | |||
83 | struct strcop_crypto_op{ | ||
84 | cryptocop_session_id ses_id; | ||
85 | |||
86 | /* Indata. */ | ||
87 | unsigned char *indata; | ||
88 | size_t inlen; /* Total indata length. */ | ||
89 | |||
90 | /* Cipher configuration. */ | ||
91 | unsigned char do_cipher:1; | ||
92 | unsigned char decrypt:1; /* 1 == decrypt, 0 == encrypt */ | ||
93 | unsigned char cipher_explicit:1; | ||
94 | size_t cipher_start; | ||
95 | size_t cipher_len; | ||
96 | /* cipher_iv is used if do_cipher and cipher_explicit and the cipher | ||
97 | mode is CBC. The length is controlled by the type of cipher, | ||
98 | e.g. DES/3DES 8 octets and AES 16 octets. */ | ||
99 | unsigned char cipher_iv[CRYPTOCOP_MAX_IV_LENGTH]; | ||
100 | /* Outdata. */ | ||
101 | unsigned char *cipher_outdata; | ||
102 | size_t cipher_outlen; | ||
103 | |||
104 | /* digest configuration. */ | ||
105 | unsigned char do_digest:1; | ||
106 | size_t digest_start; | ||
107 | size_t digest_len; | ||
108 | /* Outdata. The actual length is determined by the type of the digest. */ | ||
109 | unsigned char digest[CRYPTOCOP_MAX_DIGEST_LENGTH]; | ||
110 | |||
111 | /* Checksum configuration. */ | ||
112 | unsigned char do_csum:1; | ||
113 | size_t csum_start; | ||
114 | size_t csum_len; | ||
115 | /* Outdata. */ | ||
116 | unsigned char csum[CRYPTOCOP_CSUM_LENGTH]; | ||
117 | }; | ||
118 | |||
119 | |||
120 | |||
121 | |||
122 | #endif /* _UAPICRYPTOCOP_H */ | ||
diff --git a/arch/cris/include/arch-v32/arch/user.h b/arch/cris/include/uapi/arch-v32/arch/user.h index 03fa1f3c3c00..03fa1f3c3c00 100644 --- a/arch/cris/include/arch-v32/arch/user.h +++ b/arch/cris/include/uapi/arch-v32/arch/user.h | |||
diff --git a/arch/cris/include/uapi/asm/Kbuild b/arch/cris/include/uapi/asm/Kbuild index f50236ae9ca3..7d47b366ad82 100644 --- a/arch/cris/include/uapi/asm/Kbuild +++ b/arch/cris/include/uapi/asm/Kbuild | |||
@@ -3,3 +3,37 @@ include include/uapi/asm-generic/Kbuild.asm | |||
3 | 3 | ||
4 | header-y += arch-v10/ | 4 | header-y += arch-v10/ |
5 | header-y += arch-v32/ | 5 | header-y += arch-v32/ |
6 | header-y += auxvec.h | ||
7 | header-y += bitsperlong.h | ||
8 | header-y += byteorder.h | ||
9 | header-y += errno.h | ||
10 | header-y += ethernet.h | ||
11 | header-y += etraxgpio.h | ||
12 | header-y += fcntl.h | ||
13 | header-y += ioctl.h | ||
14 | header-y += ioctls.h | ||
15 | header-y += ipcbuf.h | ||
16 | header-y += mman.h | ||
17 | header-y += msgbuf.h | ||
18 | header-y += param.h | ||
19 | header-y += poll.h | ||
20 | header-y += posix_types.h | ||
21 | header-y += ptrace.h | ||
22 | header-y += resource.h | ||
23 | header-y += rs485.h | ||
24 | header-y += sembuf.h | ||
25 | header-y += setup.h | ||
26 | header-y += shmbuf.h | ||
27 | header-y += sigcontext.h | ||
28 | header-y += siginfo.h | ||
29 | header-y += signal.h | ||
30 | header-y += socket.h | ||
31 | header-y += sockios.h | ||
32 | header-y += stat.h | ||
33 | header-y += statfs.h | ||
34 | header-y += swab.h | ||
35 | header-y += sync_serial.h | ||
36 | header-y += termbits.h | ||
37 | header-y += termios.h | ||
38 | header-y += types.h | ||
39 | header-y += unistd.h | ||
diff --git a/arch/cris/include/asm/auxvec.h b/arch/cris/include/uapi/asm/auxvec.h index cb30b01bf19f..cb30b01bf19f 100644 --- a/arch/cris/include/asm/auxvec.h +++ b/arch/cris/include/uapi/asm/auxvec.h | |||
diff --git a/arch/cris/include/asm/bitsperlong.h b/arch/cris/include/uapi/asm/bitsperlong.h index 6dc0bb0c13b2..6dc0bb0c13b2 100644 --- a/arch/cris/include/asm/bitsperlong.h +++ b/arch/cris/include/uapi/asm/bitsperlong.h | |||
diff --git a/arch/cris/include/asm/byteorder.h b/arch/cris/include/uapi/asm/byteorder.h index bcd189798e26..bcd189798e26 100644 --- a/arch/cris/include/asm/byteorder.h +++ b/arch/cris/include/uapi/asm/byteorder.h | |||
diff --git a/arch/cris/include/asm/errno.h b/arch/cris/include/uapi/asm/errno.h index 2bf5eb5fa773..2bf5eb5fa773 100644 --- a/arch/cris/include/asm/errno.h +++ b/arch/cris/include/uapi/asm/errno.h | |||
diff --git a/arch/cris/include/asm/ethernet.h b/arch/cris/include/uapi/asm/ethernet.h index 4d58652c3a49..4d58652c3a49 100644 --- a/arch/cris/include/asm/ethernet.h +++ b/arch/cris/include/uapi/asm/ethernet.h | |||
diff --git a/arch/cris/include/asm/etraxgpio.h b/arch/cris/include/uapi/asm/etraxgpio.h index 461c089db765..461c089db765 100644 --- a/arch/cris/include/asm/etraxgpio.h +++ b/arch/cris/include/uapi/asm/etraxgpio.h | |||
diff --git a/arch/cris/include/asm/fcntl.h b/arch/cris/include/uapi/asm/fcntl.h index 46ab12db5739..46ab12db5739 100644 --- a/arch/cris/include/asm/fcntl.h +++ b/arch/cris/include/uapi/asm/fcntl.h | |||
diff --git a/arch/cris/include/asm/ioctl.h b/arch/cris/include/uapi/asm/ioctl.h index b279fe06dfe5..b279fe06dfe5 100644 --- a/arch/cris/include/asm/ioctl.h +++ b/arch/cris/include/uapi/asm/ioctl.h | |||
diff --git a/arch/cris/include/asm/ioctls.h b/arch/cris/include/uapi/asm/ioctls.h index 488fbb3f5e84..488fbb3f5e84 100644 --- a/arch/cris/include/asm/ioctls.h +++ b/arch/cris/include/uapi/asm/ioctls.h | |||
diff --git a/arch/cris/include/asm/ipcbuf.h b/arch/cris/include/uapi/asm/ipcbuf.h index 84c7e51cb6d0..84c7e51cb6d0 100644 --- a/arch/cris/include/asm/ipcbuf.h +++ b/arch/cris/include/uapi/asm/ipcbuf.h | |||
diff --git a/arch/cris/include/asm/mman.h b/arch/cris/include/uapi/asm/mman.h index 8eebf89f5ab1..8eebf89f5ab1 100644 --- a/arch/cris/include/asm/mman.h +++ b/arch/cris/include/uapi/asm/mman.h | |||
diff --git a/arch/cris/include/asm/msgbuf.h b/arch/cris/include/uapi/asm/msgbuf.h index ada63df1d574..ada63df1d574 100644 --- a/arch/cris/include/asm/msgbuf.h +++ b/arch/cris/include/uapi/asm/msgbuf.h | |||
diff --git a/arch/cris/include/asm/param.h b/arch/cris/include/uapi/asm/param.h index 484fcf8667c0..484fcf8667c0 100644 --- a/arch/cris/include/asm/param.h +++ b/arch/cris/include/uapi/asm/param.h | |||
diff --git a/arch/cris/include/asm/poll.h b/arch/cris/include/uapi/asm/poll.h index c98509d3149e..c98509d3149e 100644 --- a/arch/cris/include/asm/poll.h +++ b/arch/cris/include/uapi/asm/poll.h | |||
diff --git a/arch/cris/include/asm/posix_types.h b/arch/cris/include/uapi/asm/posix_types.h index ce4e51793151..ce4e51793151 100644 --- a/arch/cris/include/asm/posix_types.h +++ b/arch/cris/include/uapi/asm/posix_types.h | |||
diff --git a/arch/cris/include/uapi/asm/ptrace.h b/arch/cris/include/uapi/asm/ptrace.h new file mode 100644 index 000000000000..c689c9bbbe50 --- /dev/null +++ b/arch/cris/include/uapi/asm/ptrace.h | |||
@@ -0,0 +1 @@ | |||
#include <arch/ptrace.h> | |||
diff --git a/arch/cris/include/asm/resource.h b/arch/cris/include/uapi/asm/resource.h index b5d29448de4e..b5d29448de4e 100644 --- a/arch/cris/include/asm/resource.h +++ b/arch/cris/include/uapi/asm/resource.h | |||
diff --git a/arch/cris/include/asm/rs485.h b/arch/cris/include/uapi/asm/rs485.h index ad40f9fbcb8a..ad40f9fbcb8a 100644 --- a/arch/cris/include/asm/rs485.h +++ b/arch/cris/include/uapi/asm/rs485.h | |||
diff --git a/arch/cris/include/asm/sembuf.h b/arch/cris/include/uapi/asm/sembuf.h index 7fed9843796d..7fed9843796d 100644 --- a/arch/cris/include/asm/sembuf.h +++ b/arch/cris/include/uapi/asm/sembuf.h | |||
diff --git a/arch/cris/include/asm/setup.h b/arch/cris/include/uapi/asm/setup.h index b90728652d1a..b90728652d1a 100644 --- a/arch/cris/include/asm/setup.h +++ b/arch/cris/include/uapi/asm/setup.h | |||
diff --git a/arch/cris/include/asm/shmbuf.h b/arch/cris/include/uapi/asm/shmbuf.h index 3239e3f000e8..3239e3f000e8 100644 --- a/arch/cris/include/asm/shmbuf.h +++ b/arch/cris/include/uapi/asm/shmbuf.h | |||
diff --git a/arch/cris/include/asm/sigcontext.h b/arch/cris/include/uapi/asm/sigcontext.h index a1d634e120df..a1d634e120df 100644 --- a/arch/cris/include/asm/sigcontext.h +++ b/arch/cris/include/uapi/asm/sigcontext.h | |||
diff --git a/arch/cris/include/asm/siginfo.h b/arch/cris/include/uapi/asm/siginfo.h index c1cd6d16928b..c1cd6d16928b 100644 --- a/arch/cris/include/asm/siginfo.h +++ b/arch/cris/include/uapi/asm/siginfo.h | |||
diff --git a/arch/cris/include/uapi/asm/signal.h b/arch/cris/include/uapi/asm/signal.h new file mode 100644 index 000000000000..21624948a96d --- /dev/null +++ b/arch/cris/include/uapi/asm/signal.h | |||
@@ -0,0 +1,122 @@ | |||
1 | #ifndef _UAPI_ASM_CRIS_SIGNAL_H | ||
2 | #define _UAPI_ASM_CRIS_SIGNAL_H | ||
3 | |||
4 | #include <linux/types.h> | ||
5 | |||
6 | /* Avoid too many header ordering problems. */ | ||
7 | struct siginfo; | ||
8 | |||
9 | #ifndef __KERNEL__ | ||
10 | /* Here we must cater to libcs that poke about in kernel headers. */ | ||
11 | |||
12 | #define NSIG 32 | ||
13 | typedef unsigned long sigset_t; | ||
14 | |||
15 | #endif /* __KERNEL__ */ | ||
16 | |||
17 | #define SIGHUP 1 | ||
18 | #define SIGINT 2 | ||
19 | #define SIGQUIT 3 | ||
20 | #define SIGILL 4 | ||
21 | #define SIGTRAP 5 | ||
22 | #define SIGABRT 6 | ||
23 | #define SIGIOT 6 | ||
24 | #define SIGBUS 7 | ||
25 | #define SIGFPE 8 | ||
26 | #define SIGKILL 9 | ||
27 | #define SIGUSR1 10 | ||
28 | #define SIGSEGV 11 | ||
29 | #define SIGUSR2 12 | ||
30 | #define SIGPIPE 13 | ||
31 | #define SIGALRM 14 | ||
32 | #define SIGTERM 15 | ||
33 | #define SIGSTKFLT 16 | ||
34 | #define SIGCHLD 17 | ||
35 | #define SIGCONT 18 | ||
36 | #define SIGSTOP 19 | ||
37 | #define SIGTSTP 20 | ||
38 | #define SIGTTIN 21 | ||
39 | #define SIGTTOU 22 | ||
40 | #define SIGURG 23 | ||
41 | #define SIGXCPU 24 | ||
42 | #define SIGXFSZ 25 | ||
43 | #define SIGVTALRM 26 | ||
44 | #define SIGPROF 27 | ||
45 | #define SIGWINCH 28 | ||
46 | #define SIGIO 29 | ||
47 | #define SIGPOLL SIGIO | ||
48 | /* | ||
49 | #define SIGLOST 29 | ||
50 | */ | ||
51 | #define SIGPWR 30 | ||
52 | #define SIGSYS 31 | ||
53 | #define SIGUNUSED 31 | ||
54 | |||
55 | /* These should not be considered constants from userland. */ | ||
56 | #define SIGRTMIN 32 | ||
57 | #define SIGRTMAX _NSIG | ||
58 | |||
59 | /* | ||
60 | * SA_FLAGS values: | ||
61 | * | ||
62 | * SA_ONSTACK indicates that a registered stack_t will be used. | ||
63 | * SA_RESTART flag to get restarting signals (which were the default long ago) | ||
64 | * SA_NOCLDSTOP flag to turn off SIGCHLD when children stop. | ||
65 | * SA_RESETHAND clears the handler when the signal is delivered. | ||
66 | * SA_NOCLDWAIT flag on SIGCHLD to inhibit zombies. | ||
67 | * SA_NODEFER prevents the current signal from being masked in the handler. | ||
68 | * | ||
69 | * SA_ONESHOT and SA_NOMASK are the historical Linux names for the Single | ||
70 | * Unix names RESETHAND and NODEFER respectively. | ||
71 | */ | ||
72 | |||
73 | #define SA_NOCLDSTOP 0x00000001u | ||
74 | #define SA_NOCLDWAIT 0x00000002u | ||
75 | #define SA_SIGINFO 0x00000004u | ||
76 | #define SA_ONSTACK 0x08000000u | ||
77 | #define SA_RESTART 0x10000000u | ||
78 | #define SA_NODEFER 0x40000000u | ||
79 | #define SA_RESETHAND 0x80000000u | ||
80 | |||
81 | #define SA_NOMASK SA_NODEFER | ||
82 | #define SA_ONESHOT SA_RESETHAND | ||
83 | |||
84 | #define SA_RESTORER 0x04000000 | ||
85 | |||
86 | /* | ||
87 | * sigaltstack controls | ||
88 | */ | ||
89 | #define SS_ONSTACK 1 | ||
90 | #define SS_DISABLE 2 | ||
91 | |||
92 | #define MINSIGSTKSZ 2048 | ||
93 | #define SIGSTKSZ 8192 | ||
94 | |||
95 | #include <asm-generic/signal-defs.h> | ||
96 | |||
97 | #ifndef __KERNEL__ | ||
98 | /* Here we must cater to libcs that poke about in kernel headers. */ | ||
99 | |||
100 | struct sigaction { | ||
101 | union { | ||
102 | __sighandler_t _sa_handler; | ||
103 | void (*_sa_sigaction)(int, struct siginfo *, void *); | ||
104 | } _u; | ||
105 | sigset_t sa_mask; | ||
106 | unsigned long sa_flags; | ||
107 | void (*sa_restorer)(void); | ||
108 | }; | ||
109 | |||
110 | #define sa_handler _u._sa_handler | ||
111 | #define sa_sigaction _u._sa_sigaction | ||
112 | |||
113 | #endif /* __KERNEL__ */ | ||
114 | |||
115 | typedef struct sigaltstack { | ||
116 | void *ss_sp; | ||
117 | int ss_flags; | ||
118 | size_t ss_size; | ||
119 | } stack_t; | ||
120 | |||
121 | |||
122 | #endif /* _UAPI_ASM_CRIS_SIGNAL_H */ | ||
diff --git a/arch/cris/include/asm/socket.h b/arch/cris/include/uapi/asm/socket.h index b681b043f6c8..b681b043f6c8 100644 --- a/arch/cris/include/asm/socket.h +++ b/arch/cris/include/uapi/asm/socket.h | |||
diff --git a/arch/cris/include/asm/sockios.h b/arch/cris/include/uapi/asm/sockios.h index cfe7bfecf599..cfe7bfecf599 100644 --- a/arch/cris/include/asm/sockios.h +++ b/arch/cris/include/uapi/asm/sockios.h | |||
diff --git a/arch/cris/include/asm/stat.h b/arch/cris/include/uapi/asm/stat.h index 9e558cc3c43b..9e558cc3c43b 100644 --- a/arch/cris/include/asm/stat.h +++ b/arch/cris/include/uapi/asm/stat.h | |||
diff --git a/arch/cris/include/asm/statfs.h b/arch/cris/include/uapi/asm/statfs.h index fdaf921844bc..fdaf921844bc 100644 --- a/arch/cris/include/asm/statfs.h +++ b/arch/cris/include/uapi/asm/statfs.h | |||
diff --git a/arch/cris/include/uapi/asm/swab.h b/arch/cris/include/uapi/asm/swab.h new file mode 100644 index 000000000000..4adf1e9f0b09 --- /dev/null +++ b/arch/cris/include/uapi/asm/swab.h | |||
@@ -0,0 +1,3 @@ | |||
1 | /* | ||
2 | * CRIS byte swapping. | ||
3 | */ | ||
diff --git a/arch/cris/include/asm/sync_serial.h b/arch/cris/include/uapi/asm/sync_serial.h index 7f827fea30e7..7f827fea30e7 100644 --- a/arch/cris/include/asm/sync_serial.h +++ b/arch/cris/include/uapi/asm/sync_serial.h | |||
diff --git a/arch/cris/include/asm/termbits.h b/arch/cris/include/uapi/asm/termbits.h index 1c43bc874ccf..1c43bc874ccf 100644 --- a/arch/cris/include/asm/termbits.h +++ b/arch/cris/include/uapi/asm/termbits.h | |||
diff --git a/arch/cris/include/uapi/asm/termios.h b/arch/cris/include/uapi/asm/termios.h new file mode 100644 index 000000000000..0a0386a55027 --- /dev/null +++ b/arch/cris/include/uapi/asm/termios.h | |||
@@ -0,0 +1,45 @@ | |||
1 | #ifndef _UAPI_CRIS_TERMIOS_H | ||
2 | #define _UAPI_CRIS_TERMIOS_H | ||
3 | |||
4 | #include <asm/termbits.h> | ||
5 | #include <asm/ioctls.h> | ||
6 | #include <asm/rs485.h> | ||
7 | #include <linux/serial.h> | ||
8 | |||
9 | struct winsize { | ||
10 | unsigned short ws_row; | ||
11 | unsigned short ws_col; | ||
12 | unsigned short ws_xpixel; | ||
13 | unsigned short ws_ypixel; | ||
14 | }; | ||
15 | |||
16 | #define NCC 8 | ||
17 | struct termio { | ||
18 | unsigned short c_iflag; /* input mode flags */ | ||
19 | unsigned short c_oflag; /* output mode flags */ | ||
20 | unsigned short c_cflag; /* control mode flags */ | ||
21 | unsigned short c_lflag; /* local mode flags */ | ||
22 | unsigned char c_line; /* line discipline */ | ||
23 | unsigned char c_cc[NCC]; /* control characters */ | ||
24 | }; | ||
25 | |||
26 | /* modem lines */ | ||
27 | #define TIOCM_LE 0x001 | ||
28 | #define TIOCM_DTR 0x002 | ||
29 | #define TIOCM_RTS 0x004 | ||
30 | #define TIOCM_ST 0x008 | ||
31 | #define TIOCM_SR 0x010 | ||
32 | #define TIOCM_CTS 0x020 | ||
33 | #define TIOCM_CAR 0x040 | ||
34 | #define TIOCM_RNG 0x080 | ||
35 | #define TIOCM_DSR 0x100 | ||
36 | #define TIOCM_CD TIOCM_CAR | ||
37 | #define TIOCM_RI TIOCM_RNG | ||
38 | #define TIOCM_OUT1 0x2000 | ||
39 | #define TIOCM_OUT2 0x4000 | ||
40 | #define TIOCM_LOOP 0x8000 | ||
41 | |||
42 | /* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */ | ||
43 | |||
44 | |||
45 | #endif /* _UAPI_CRIS_TERMIOS_H */ | ||
diff --git a/arch/cris/include/uapi/asm/types.h b/arch/cris/include/uapi/asm/types.h new file mode 100644 index 000000000000..9ec9d4c5ac4d --- /dev/null +++ b/arch/cris/include/uapi/asm/types.h | |||
@@ -0,0 +1 @@ | |||
#include <asm-generic/int-ll64.h> | |||
diff --git a/arch/cris/include/uapi/asm/unistd.h b/arch/cris/include/uapi/asm/unistd.h new file mode 100644 index 000000000000..48842896f6c2 --- /dev/null +++ b/arch/cris/include/uapi/asm/unistd.h | |||
@@ -0,0 +1,344 @@ | |||
1 | #ifndef _UAPI_ASM_CRIS_UNISTD_H_ | ||
2 | #define _UAPI_ASM_CRIS_UNISTD_H_ | ||
3 | |||
4 | /* | ||
5 | * This file contains the system call numbers, and stub macros for libc. | ||
6 | */ | ||
7 | |||
8 | #define __NR_restart_syscall 0 | ||
9 | #define __NR_exit 1 | ||
10 | #define __NR_fork 2 | ||
11 | #define __NR_read 3 | ||
12 | #define __NR_write 4 | ||
13 | #define __NR_open 5 | ||
14 | #define __NR_close 6 | ||
15 | #define __NR_waitpid 7 | ||
16 | #define __NR_creat 8 | ||
17 | #define __NR_link 9 | ||
18 | #define __NR_unlink 10 | ||
19 | #define __NR_execve 11 | ||
20 | #define __NR_chdir 12 | ||
21 | #define __NR_time 13 | ||
22 | #define __NR_mknod 14 | ||
23 | #define __NR_chmod 15 | ||
24 | #define __NR_lchown 16 | ||
25 | #define __NR_break 17 | ||
26 | #define __NR_oldstat 18 | ||
27 | #define __NR_lseek 19 | ||
28 | #define __NR_getpid 20 | ||
29 | #define __NR_mount 21 | ||
30 | #define __NR_umount 22 | ||
31 | #define __NR_setuid 23 | ||
32 | #define __NR_getuid 24 | ||
33 | #define __NR_stime 25 | ||
34 | #define __NR_ptrace 26 | ||
35 | #define __NR_alarm 27 | ||
36 | #define __NR_oldfstat 28 | ||
37 | #define __NR_pause 29 | ||
38 | #define __NR_utime 30 | ||
39 | #define __NR_stty 31 | ||
40 | #define __NR_gtty 32 | ||
41 | #define __NR_access 33 | ||
42 | #define __NR_nice 34 | ||
43 | #define __NR_ftime 35 | ||
44 | #define __NR_sync 36 | ||
45 | #define __NR_kill 37 | ||
46 | #define __NR_rename 38 | ||
47 | #define __NR_mkdir 39 | ||
48 | #define __NR_rmdir 40 | ||
49 | #define __NR_dup 41 | ||
50 | #define __NR_pipe 42 | ||
51 | #define __NR_times 43 | ||
52 | #define __NR_prof 44 | ||
53 | #define __NR_brk 45 | ||
54 | #define __NR_setgid 46 | ||
55 | #define __NR_getgid 47 | ||
56 | #define __NR_signal 48 | ||
57 | #define __NR_geteuid 49 | ||
58 | #define __NR_getegid 50 | ||
59 | #define __NR_acct 51 | ||
60 | #define __NR_umount2 52 | ||
61 | #define __NR_lock 53 | ||
62 | #define __NR_ioctl 54 | ||
63 | #define __NR_fcntl 55 | ||
64 | #define __NR_mpx 56 | ||
65 | #define __NR_setpgid 57 | ||
66 | #define __NR_ulimit 58 | ||
67 | #define __NR_oldolduname 59 | ||
68 | #define __NR_umask 60 | ||
69 | #define __NR_chroot 61 | ||
70 | #define __NR_ustat 62 | ||
71 | #define __NR_dup2 63 | ||
72 | #define __NR_getppid 64 | ||
73 | #define __NR_getpgrp 65 | ||
74 | #define __NR_setsid 66 | ||
75 | #define __NR_sigaction 67 | ||
76 | #define __NR_sgetmask 68 | ||
77 | #define __NR_ssetmask 69 | ||
78 | #define __NR_setreuid 70 | ||
79 | #define __NR_setregid 71 | ||
80 | #define __NR_sigsuspend 72 | ||
81 | #define __NR_sigpending 73 | ||
82 | #define __NR_sethostname 74 | ||
83 | #define __NR_setrlimit 75 | ||
84 | #define __NR_getrlimit 76 | ||
85 | #define __NR_getrusage 77 | ||
86 | #define __NR_gettimeofday 78 | ||
87 | #define __NR_settimeofday 79 | ||
88 | #define __NR_getgroups 80 | ||
89 | #define __NR_setgroups 81 | ||
90 | #define __NR_select 82 | ||
91 | #define __NR_symlink 83 | ||
92 | #define __NR_oldlstat 84 | ||
93 | #define __NR_readlink 85 | ||
94 | #define __NR_uselib 86 | ||
95 | #define __NR_swapon 87 | ||
96 | #define __NR_reboot 88 | ||
97 | #define __NR_readdir 89 | ||
98 | #define __NR_mmap 90 | ||
99 | #define __NR_munmap 91 | ||
100 | #define __NR_truncate 92 | ||
101 | #define __NR_ftruncate 93 | ||
102 | #define __NR_fchmod 94 | ||
103 | #define __NR_fchown 95 | ||
104 | #define __NR_getpriority 96 | ||
105 | #define __NR_setpriority 97 | ||
106 | #define __NR_profil 98 | ||
107 | #define __NR_statfs 99 | ||
108 | #define __NR_fstatfs 100 | ||
109 | #define __NR_ioperm 101 | ||
110 | #define __NR_socketcall 102 | ||
111 | #define __NR_syslog 103 | ||
112 | #define __NR_setitimer 104 | ||
113 | #define __NR_getitimer 105 | ||
114 | #define __NR_stat 106 | ||
115 | #define __NR_lstat 107 | ||
116 | #define __NR_fstat 108 | ||
117 | #define __NR_olduname 109 | ||
118 | #define __NR_iopl 110 | ||
119 | #define __NR_vhangup 111 | ||
120 | #define __NR_idle 112 | ||
121 | #define __NR_vm86 113 | ||
122 | #define __NR_wait4 114 | ||
123 | #define __NR_swapoff 115 | ||
124 | #define __NR_sysinfo 116 | ||
125 | #define __NR_ipc 117 | ||
126 | #define __NR_fsync 118 | ||
127 | #define __NR_sigreturn 119 | ||
128 | #define __NR_clone 120 | ||
129 | #define __NR_setdomainname 121 | ||
130 | #define __NR_uname 122 | ||
131 | #define __NR_modify_ldt 123 | ||
132 | #define __NR_adjtimex 124 | ||
133 | #define __NR_mprotect 125 | ||
134 | #define __NR_sigprocmask 126 | ||
135 | #define __NR_create_module 127 | ||
136 | #define __NR_init_module 128 | ||
137 | #define __NR_delete_module 129 | ||
138 | #define __NR_get_kernel_syms 130 | ||
139 | #define __NR_quotactl 131 | ||
140 | #define __NR_getpgid 132 | ||
141 | #define __NR_fchdir 133 | ||
142 | #define __NR_bdflush 134 | ||
143 | #define __NR_sysfs 135 | ||
144 | #define __NR_personality 136 | ||
145 | #define __NR_afs_syscall 137 /* Syscall for Andrew File System */ | ||
146 | #define __NR_setfsuid 138 | ||
147 | #define __NR_setfsgid 139 | ||
148 | #define __NR__llseek 140 | ||
149 | #define __NR_getdents 141 | ||
150 | #define __NR__newselect 142 | ||
151 | #define __NR_flock 143 | ||
152 | #define __NR_msync 144 | ||
153 | #define __NR_readv 145 | ||
154 | #define __NR_writev 146 | ||
155 | #define __NR_getsid 147 | ||
156 | #define __NR_fdatasync 148 | ||
157 | #define __NR__sysctl 149 | ||
158 | #define __NR_mlock 150 | ||
159 | #define __NR_munlock 151 | ||
160 | #define __NR_mlockall 152 | ||
161 | #define __NR_munlockall 153 | ||
162 | #define __NR_sched_setparam 154 | ||
163 | #define __NR_sched_getparam 155 | ||
164 | #define __NR_sched_setscheduler 156 | ||
165 | #define __NR_sched_getscheduler 157 | ||
166 | #define __NR_sched_yield 158 | ||
167 | #define __NR_sched_get_priority_max 159 | ||
168 | #define __NR_sched_get_priority_min 160 | ||
169 | #define __NR_sched_rr_get_interval 161 | ||
170 | #define __NR_nanosleep 162 | ||
171 | #define __NR_mremap 163 | ||
172 | #define __NR_setresuid 164 | ||
173 | #define __NR_getresuid 165 | ||
174 | |||
175 | #define __NR_query_module 167 | ||
176 | #define __NR_poll 168 | ||
177 | #define __NR_nfsservctl 169 | ||
178 | #define __NR_setresgid 170 | ||
179 | #define __NR_getresgid 171 | ||
180 | #define __NR_prctl 172 | ||
181 | #define __NR_rt_sigreturn 173 | ||
182 | #define __NR_rt_sigaction 174 | ||
183 | #define __NR_rt_sigprocmask 175 | ||
184 | #define __NR_rt_sigpending 176 | ||
185 | #define __NR_rt_sigtimedwait 177 | ||
186 | #define __NR_rt_sigqueueinfo 178 | ||
187 | #define __NR_rt_sigsuspend 179 | ||
188 | #define __NR_pread64 180 | ||
189 | #define __NR_pwrite64 181 | ||
190 | #define __NR_chown 182 | ||
191 | #define __NR_getcwd 183 | ||
192 | #define __NR_capget 184 | ||
193 | #define __NR_capset 185 | ||
194 | #define __NR_sigaltstack 186 | ||
195 | #define __NR_sendfile 187 | ||
196 | #define __NR_getpmsg 188 /* some people actually want streams */ | ||
197 | #define __NR_putpmsg 189 /* some people actually want streams */ | ||
198 | #define __NR_vfork 190 | ||
199 | #define __NR_ugetrlimit 191 /* SuS compliant getrlimit */ | ||
200 | #define __NR_mmap2 192 | ||
201 | #define __NR_truncate64 193 | ||
202 | #define __NR_ftruncate64 194 | ||
203 | #define __NR_stat64 195 | ||
204 | #define __NR_lstat64 196 | ||
205 | #define __NR_fstat64 197 | ||
206 | #define __NR_lchown32 198 | ||
207 | #define __NR_getuid32 199 | ||
208 | #define __NR_getgid32 200 | ||
209 | #define __NR_geteuid32 201 | ||
210 | #define __NR_getegid32 202 | ||
211 | #define __NR_setreuid32 203 | ||
212 | #define __NR_setregid32 204 | ||
213 | #define __NR_getgroups32 205 | ||
214 | #define __NR_setgroups32 206 | ||
215 | #define __NR_fchown32 207 | ||
216 | #define __NR_setresuid32 208 | ||
217 | #define __NR_getresuid32 209 | ||
218 | #define __NR_setresgid32 210 | ||
219 | #define __NR_getresgid32 211 | ||
220 | #define __NR_chown32 212 | ||
221 | #define __NR_setuid32 213 | ||
222 | #define __NR_setgid32 214 | ||
223 | #define __NR_setfsuid32 215 | ||
224 | #define __NR_setfsgid32 216 | ||
225 | #define __NR_pivot_root 217 | ||
226 | #define __NR_mincore 218 | ||
227 | #define __NR_madvise 219 | ||
228 | #define __NR_getdents64 220 | ||
229 | #define __NR_fcntl64 221 | ||
230 | /* 223 is unused */ | ||
231 | #define __NR_gettid 224 | ||
232 | #define __NR_readahead 225 | ||
233 | #define __NR_setxattr 226 | ||
234 | #define __NR_lsetxattr 227 | ||
235 | #define __NR_fsetxattr 228 | ||
236 | #define __NR_getxattr 229 | ||
237 | #define __NR_lgetxattr 230 | ||
238 | #define __NR_fgetxattr 231 | ||
239 | #define __NR_listxattr 232 | ||
240 | #define __NR_llistxattr 233 | ||
241 | #define __NR_flistxattr 234 | ||
242 | #define __NR_removexattr 235 | ||
243 | #define __NR_lremovexattr 236 | ||
244 | #define __NR_fremovexattr 237 | ||
245 | #define __NR_tkill 238 | ||
246 | #define __NR_sendfile64 239 | ||
247 | #define __NR_futex 240 | ||
248 | #define __NR_sched_setaffinity 241 | ||
249 | #define __NR_sched_getaffinity 242 | ||
250 | #define __NR_set_thread_area 243 | ||
251 | #define __NR_get_thread_area 244 | ||
252 | #define __NR_io_setup 245 | ||
253 | #define __NR_io_destroy 246 | ||
254 | #define __NR_io_getevents 247 | ||
255 | #define __NR_io_submit 248 | ||
256 | #define __NR_io_cancel 249 | ||
257 | #define __NR_fadvise64 250 | ||
258 | /* 251 is available for reuse (was briefly sys_set_zone_reclaim) */ | ||
259 | #define __NR_exit_group 252 | ||
260 | #define __NR_lookup_dcookie 253 | ||
261 | #define __NR_epoll_create 254 | ||
262 | #define __NR_epoll_ctl 255 | ||
263 | #define __NR_epoll_wait 256 | ||
264 | #define __NR_remap_file_pages 257 | ||
265 | #define __NR_set_tid_address 258 | ||
266 | #define __NR_timer_create 259 | ||
267 | #define __NR_timer_settime (__NR_timer_create+1) | ||
268 | #define __NR_timer_gettime (__NR_timer_create+2) | ||
269 | #define __NR_timer_getoverrun (__NR_timer_create+3) | ||
270 | #define __NR_timer_delete (__NR_timer_create+4) | ||
271 | #define __NR_clock_settime (__NR_timer_create+5) | ||
272 | #define __NR_clock_gettime (__NR_timer_create+6) | ||
273 | #define __NR_clock_getres (__NR_timer_create+7) | ||
274 | #define __NR_clock_nanosleep (__NR_timer_create+8) | ||
275 | #define __NR_statfs64 268 | ||
276 | #define __NR_fstatfs64 269 | ||
277 | #define __NR_tgkill 270 | ||
278 | #define __NR_utimes 271 | ||
279 | #define __NR_fadvise64_64 272 | ||
280 | #define __NR_vserver 273 | ||
281 | #define __NR_mbind 274 | ||
282 | #define __NR_get_mempolicy 275 | ||
283 | #define __NR_set_mempolicy 276 | ||
284 | #define __NR_mq_open 277 | ||
285 | #define __NR_mq_unlink (__NR_mq_open+1) | ||
286 | #define __NR_mq_timedsend (__NR_mq_open+2) | ||
287 | #define __NR_mq_timedreceive (__NR_mq_open+3) | ||
288 | #define __NR_mq_notify (__NR_mq_open+4) | ||
289 | #define __NR_mq_getsetattr (__NR_mq_open+5) | ||
290 | #define __NR_kexec_load 283 | ||
291 | #define __NR_waitid 284 | ||
292 | /* #define __NR_sys_setaltroot 285 */ | ||
293 | #define __NR_add_key 286 | ||
294 | #define __NR_request_key 287 | ||
295 | #define __NR_keyctl 288 | ||
296 | #define __NR_ioprio_set 289 | ||
297 | #define __NR_ioprio_get 290 | ||
298 | #define __NR_inotify_init 291 | ||
299 | #define __NR_inotify_add_watch 292 | ||
300 | #define __NR_inotify_rm_watch 293 | ||
301 | #define __NR_migrate_pages 294 | ||
302 | #define __NR_openat 295 | ||
303 | #define __NR_mkdirat 296 | ||
304 | #define __NR_mknodat 297 | ||
305 | #define __NR_fchownat 298 | ||
306 | #define __NR_futimesat 299 | ||
307 | #define __NR_fstatat64 300 | ||
308 | #define __NR_unlinkat 301 | ||
309 | #define __NR_renameat 302 | ||
310 | #define __NR_linkat 303 | ||
311 | #define __NR_symlinkat 304 | ||
312 | #define __NR_readlinkat 305 | ||
313 | #define __NR_fchmodat 306 | ||
314 | #define __NR_faccessat 307 | ||
315 | #define __NR_pselect6 308 | ||
316 | #define __NR_ppoll 309 | ||
317 | #define __NR_unshare 310 | ||
318 | #define __NR_set_robust_list 311 | ||
319 | #define __NR_get_robust_list 312 | ||
320 | #define __NR_splice 313 | ||
321 | #define __NR_sync_file_range 314 | ||
322 | #define __NR_tee 315 | ||
323 | #define __NR_vmsplice 316 | ||
324 | #define __NR_move_pages 317 | ||
325 | #define __NR_getcpu 318 | ||
326 | #define __NR_epoll_pwait 319 | ||
327 | #define __NR_utimensat 320 | ||
328 | #define __NR_signalfd 321 | ||
329 | #define __NR_timerfd_create 322 | ||
330 | #define __NR_eventfd 323 | ||
331 | #define __NR_fallocate 324 | ||
332 | #define __NR_timerfd_settime 325 | ||
333 | #define __NR_timerfd_gettime 326 | ||
334 | #define __NR_signalfd4 327 | ||
335 | #define __NR_eventfd2 328 | ||
336 | #define __NR_epoll_create1 329 | ||
337 | #define __NR_dup3 330 | ||
338 | #define __NR_pipe2 331 | ||
339 | #define __NR_inotify_init1 332 | ||
340 | #define __NR_preadv 333 | ||
341 | #define __NR_pwritev 334 | ||
342 | #define __NR_setns 335 | ||
343 | |||
344 | #endif /* _UAPI_ASM_CRIS_UNISTD_H_ */ | ||
diff --git a/arch/cris/kernel/asm-offsets.c b/arch/cris/kernel/asm-offsets.c index dd7b8e983221..a5fd88d816a6 100644 --- a/arch/cris/kernel/asm-offsets.c +++ b/arch/cris/kernel/asm-offsets.c | |||
@@ -1,3 +1,4 @@ | |||
1 | #include <linux/kbuild.h> | ||
1 | #include <linux/sched.h> | 2 | #include <linux/sched.h> |
2 | #include <asm/thread_info.h> | 3 | #include <asm/thread_info.h> |
3 | 4 | ||
@@ -7,11 +8,6 @@ | |||
7 | * and format the required data. | 8 | * and format the required data. |
8 | */ | 9 | */ |
9 | 10 | ||
10 | #define DEFINE(sym, val) \ | ||
11 | asm volatile("\n->" #sym " %0 " #val : : "i" (val)) | ||
12 | |||
13 | #define BLANK() asm volatile("\n->" : : ) | ||
14 | |||
15 | #if !defined(CONFIG_ETRAX_ARCH_V10) && !defined(CONFIG_ETRAX_ARCH_V32) | 11 | #if !defined(CONFIG_ETRAX_ARCH_V10) && !defined(CONFIG_ETRAX_ARCH_V32) |
16 | #error One of ARCH v10 and ARCH v32 must be true! | 12 | #error One of ARCH v10 and ARCH v32 must be true! |
17 | #endif | 13 | #endif |
diff --git a/arch/h8300/include/asm/Kbuild b/arch/h8300/include/asm/Kbuild index 4bc8ae73e08a..bebdc36ebb0a 100644 --- a/arch/h8300/include/asm/Kbuild +++ b/arch/h8300/include/asm/Kbuild | |||
@@ -1,4 +1,3 @@ | |||
1 | include include/asm-generic/Kbuild.asm | ||
2 | 1 | ||
3 | generic-y += clkdev.h | 2 | generic-y += clkdev.h |
4 | generic-y += exec.h | 3 | generic-y += exec.h |
diff --git a/arch/h8300/include/asm/param.h b/arch/h8300/include/asm/param.h index 1c72fb8080ff..c3909e7ff178 100644 --- a/arch/h8300/include/asm/param.h +++ b/arch/h8300/include/asm/param.h | |||
@@ -1,20 +1,9 @@ | |||
1 | #ifndef _H8300_PARAM_H | 1 | #ifndef _H8300_PARAM_H |
2 | #define _H8300_PARAM_H | 2 | #define _H8300_PARAM_H |
3 | 3 | ||
4 | #ifdef __KERNEL__ | 4 | #include <uapi/asm/param.h> |
5 | |||
5 | #define HZ CONFIG_HZ | 6 | #define HZ CONFIG_HZ |
6 | #define USER_HZ HZ | 7 | #define USER_HZ HZ |
7 | #define CLOCKS_PER_SEC (USER_HZ) | 8 | #define CLOCKS_PER_SEC (USER_HZ) |
8 | #else | ||
9 | #define HZ 100 | ||
10 | #endif | ||
11 | |||
12 | #define EXEC_PAGESIZE 4096 | ||
13 | |||
14 | #ifndef NOGROUP | ||
15 | #define NOGROUP (-1) | ||
16 | #endif | ||
17 | |||
18 | #define MAXHOSTNAMELEN 64 /* max length of hostname */ | ||
19 | |||
20 | #endif /* _H8300_PARAM_H */ | 9 | #endif /* _H8300_PARAM_H */ |
diff --git a/arch/h8300/include/asm/ptrace.h b/arch/h8300/include/asm/ptrace.h index 7468589a128b..79c9a91e75ef 100644 --- a/arch/h8300/include/asm/ptrace.h +++ b/arch/h8300/include/asm/ptrace.h | |||
@@ -1,46 +1,11 @@ | |||
1 | #ifndef _H8300_PTRACE_H | 1 | #ifndef _H8300_PTRACE_H |
2 | #define _H8300_PTRACE_H | 2 | #define _H8300_PTRACE_H |
3 | 3 | ||
4 | #ifndef __ASSEMBLY__ | 4 | #include <uapi/asm/ptrace.h> |
5 | |||
6 | #define PT_ER1 0 | ||
7 | #define PT_ER2 1 | ||
8 | #define PT_ER3 2 | ||
9 | #define PT_ER4 3 | ||
10 | #define PT_ER5 4 | ||
11 | #define PT_ER6 5 | ||
12 | #define PT_ER0 6 | ||
13 | #define PT_ORIG_ER0 7 | ||
14 | #define PT_CCR 8 | ||
15 | #define PT_PC 9 | ||
16 | #define PT_USP 10 | ||
17 | #define PT_EXR 12 | ||
18 | |||
19 | /* this struct defines the way the registers are stored on the | ||
20 | stack during a system call. */ | ||
21 | 5 | ||
22 | struct pt_regs { | 6 | #ifndef __ASSEMBLY__ |
23 | long retpc; | ||
24 | long er4; | ||
25 | long er5; | ||
26 | long er6; | ||
27 | long er3; | ||
28 | long er2; | ||
29 | long er1; | ||
30 | long orig_er0; | ||
31 | unsigned short ccr; | ||
32 | long er0; | ||
33 | long vector; | ||
34 | #if defined(CONFIG_CPU_H8S) | 7 | #if defined(CONFIG_CPU_H8S) |
35 | unsigned short exr; | ||
36 | #endif | 8 | #endif |
37 | unsigned long pc; | ||
38 | } __attribute__((aligned(2),packed)); | ||
39 | |||
40 | #define PTRACE_GETREGS 12 | ||
41 | #define PTRACE_SETREGS 13 | ||
42 | |||
43 | #ifdef __KERNEL__ | ||
44 | #ifndef PS_S | 9 | #ifndef PS_S |
45 | #define PS_S (0x10) | 10 | #define PS_S (0x10) |
46 | #endif | 11 | #endif |
@@ -63,6 +28,5 @@ struct pt_regs { | |||
63 | #define current_pt_regs() ((struct pt_regs *) \ | 28 | #define current_pt_regs() ((struct pt_regs *) \ |
64 | (THREAD_SIZE + (unsigned long)current_thread_info()) - 1) | 29 | (THREAD_SIZE + (unsigned long)current_thread_info()) - 1) |
65 | #define signal_pt_regs() ((struct pt_regs *)current->thread.esp0) | 30 | #define signal_pt_regs() ((struct pt_regs *)current->thread.esp0) |
66 | #endif /* __KERNEL__ */ | ||
67 | #endif /* __ASSEMBLY__ */ | 31 | #endif /* __ASSEMBLY__ */ |
68 | #endif /* _H8300_PTRACE_H */ | 32 | #endif /* _H8300_PTRACE_H */ |
diff --git a/arch/h8300/include/asm/signal.h b/arch/h8300/include/asm/signal.h index c43c0a7d2c2e..66c81c67e55d 100644 --- a/arch/h8300/include/asm/signal.h +++ b/arch/h8300/include/asm/signal.h | |||
@@ -1,12 +1,8 @@ | |||
1 | #ifndef _H8300_SIGNAL_H | 1 | #ifndef _H8300_SIGNAL_H |
2 | #define _H8300_SIGNAL_H | 2 | #define _H8300_SIGNAL_H |
3 | 3 | ||
4 | #include <linux/types.h> | 4 | #include <uapi/asm/signal.h> |
5 | 5 | ||
6 | /* Avoid too many header ordering problems. */ | ||
7 | struct siginfo; | ||
8 | |||
9 | #ifdef __KERNEL__ | ||
10 | /* Most things should be clean enough to redefine this at will, if care | 6 | /* Most things should be clean enough to redefine this at will, if care |
11 | is taken to make libc match. */ | 7 | is taken to make libc match. */ |
12 | 8 | ||
@@ -20,94 +16,6 @@ typedef struct { | |||
20 | unsigned long sig[_NSIG_WORDS]; | 16 | unsigned long sig[_NSIG_WORDS]; |
21 | } sigset_t; | 17 | } sigset_t; |
22 | 18 | ||
23 | #else | ||
24 | /* Here we must cater to libcs that poke about in kernel headers. */ | ||
25 | |||
26 | #define NSIG 32 | ||
27 | typedef unsigned long sigset_t; | ||
28 | |||
29 | #endif /* __KERNEL__ */ | ||
30 | |||
31 | #define SIGHUP 1 | ||
32 | #define SIGINT 2 | ||
33 | #define SIGQUIT 3 | ||
34 | #define SIGILL 4 | ||
35 | #define SIGTRAP 5 | ||
36 | #define SIGABRT 6 | ||
37 | #define SIGIOT 6 | ||
38 | #define SIGBUS 7 | ||
39 | #define SIGFPE 8 | ||
40 | #define SIGKILL 9 | ||
41 | #define SIGUSR1 10 | ||
42 | #define SIGSEGV 11 | ||
43 | #define SIGUSR2 12 | ||
44 | #define SIGPIPE 13 | ||
45 | #define SIGALRM 14 | ||
46 | #define SIGTERM 15 | ||
47 | #define SIGSTKFLT 16 | ||
48 | #define SIGCHLD 17 | ||
49 | #define SIGCONT 18 | ||
50 | #define SIGSTOP 19 | ||
51 | #define SIGTSTP 20 | ||
52 | #define SIGTTIN 21 | ||
53 | #define SIGTTOU 22 | ||
54 | #define SIGURG 23 | ||
55 | #define SIGXCPU 24 | ||
56 | #define SIGXFSZ 25 | ||
57 | #define SIGVTALRM 26 | ||
58 | #define SIGPROF 27 | ||
59 | #define SIGWINCH 28 | ||
60 | #define SIGIO 29 | ||
61 | #define SIGPOLL SIGIO | ||
62 | /* | ||
63 | #define SIGLOST 29 | ||
64 | */ | ||
65 | #define SIGPWR 30 | ||
66 | #define SIGSYS 31 | ||
67 | #define SIGUNUSED 31 | ||
68 | |||
69 | /* These should not be considered constants from userland. */ | ||
70 | #define SIGRTMIN 32 | ||
71 | #define SIGRTMAX _NSIG | ||
72 | |||
73 | /* | ||
74 | * SA_FLAGS values: | ||
75 | * | ||
76 | * SA_ONSTACK indicates that a registered stack_t will be used. | ||
77 | * SA_RESTART flag to get restarting signals (which were the default long ago) | ||
78 | * SA_NOCLDSTOP flag to turn off SIGCHLD when children stop. | ||
79 | * SA_RESETHAND clears the handler when the signal is delivered. | ||
80 | * SA_NOCLDWAIT flag on SIGCHLD to inhibit zombies. | ||
81 | * SA_NODEFER prevents the current signal from being masked in the handler. | ||
82 | * | ||
83 | * SA_ONESHOT and SA_NOMASK are the historical Linux names for the Single | ||
84 | * Unix names RESETHAND and NODEFER respectively. | ||
85 | */ | ||
86 | #define SA_NOCLDSTOP 0x00000001 | ||
87 | #define SA_NOCLDWAIT 0x00000002 /* not supported yet */ | ||
88 | #define SA_SIGINFO 0x00000004 | ||
89 | #define SA_ONSTACK 0x08000000 | ||
90 | #define SA_RESTART 0x10000000 | ||
91 | #define SA_NODEFER 0x40000000 | ||
92 | #define SA_RESETHAND 0x80000000 | ||
93 | |||
94 | #define SA_NOMASK SA_NODEFER | ||
95 | #define SA_ONESHOT SA_RESETHAND | ||
96 | |||
97 | #define SA_RESTORER 0x04000000 | ||
98 | |||
99 | /* | ||
100 | * sigaltstack controls | ||
101 | */ | ||
102 | #define SS_ONSTACK 1 | ||
103 | #define SS_DISABLE 2 | ||
104 | |||
105 | #define MINSIGSTKSZ 2048 | ||
106 | #define SIGSTKSZ 8192 | ||
107 | |||
108 | #include <asm-generic/signal-defs.h> | ||
109 | |||
110 | #ifdef __KERNEL__ | ||
111 | struct old_sigaction { | 19 | struct old_sigaction { |
112 | __sighandler_t sa_handler; | 20 | __sighandler_t sa_handler; |
113 | old_sigset_t sa_mask; | 21 | old_sigset_t sa_mask; |
@@ -125,35 +33,8 @@ struct sigaction { | |||
125 | struct k_sigaction { | 33 | struct k_sigaction { |
126 | struct sigaction sa; | 34 | struct sigaction sa; |
127 | }; | 35 | }; |
128 | #else | ||
129 | /* Here we must cater to libcs that poke about in kernel headers. */ | ||
130 | |||
131 | struct sigaction { | ||
132 | union { | ||
133 | __sighandler_t _sa_handler; | ||
134 | void (*_sa_sigaction)(int, struct siginfo *, void *); | ||
135 | } _u; | ||
136 | sigset_t sa_mask; | ||
137 | unsigned long sa_flags; | ||
138 | void (*sa_restorer)(void); | ||
139 | }; | ||
140 | |||
141 | #define sa_handler _u._sa_handler | ||
142 | #define sa_sigaction _u._sa_sigaction | ||
143 | |||
144 | #endif /* __KERNEL__ */ | ||
145 | |||
146 | typedef struct sigaltstack { | ||
147 | void *ss_sp; | ||
148 | int ss_flags; | ||
149 | size_t ss_size; | ||
150 | } stack_t; | ||
151 | |||
152 | #ifdef __KERNEL__ | ||
153 | 36 | ||
154 | #include <asm/sigcontext.h> | 37 | #include <asm/sigcontext.h> |
155 | #undef __HAVE_ARCH_SIG_BITOPS | 38 | #undef __HAVE_ARCH_SIG_BITOPS |
156 | 39 | ||
157 | #endif /* __KERNEL__ */ | ||
158 | |||
159 | #endif /* _H8300_SIGNAL_H */ | 40 | #endif /* _H8300_SIGNAL_H */ |
diff --git a/arch/h8300/include/asm/termios.h b/arch/h8300/include/asm/termios.h index 70eea64b4213..93a63df56247 100644 --- a/arch/h8300/include/asm/termios.h +++ b/arch/h8300/include/asm/termios.h | |||
@@ -1,27 +1,8 @@ | |||
1 | #ifndef _H8300_TERMIOS_H | 1 | #ifndef _H8300_TERMIOS_H |
2 | #define _H8300_TERMIOS_H | 2 | #define _H8300_TERMIOS_H |
3 | 3 | ||
4 | #include <asm/termbits.h> | 4 | #include <uapi/asm/termios.h> |
5 | #include <asm/ioctls.h> | ||
6 | |||
7 | struct winsize { | ||
8 | unsigned short ws_row; | ||
9 | unsigned short ws_col; | ||
10 | unsigned short ws_xpixel; | ||
11 | unsigned short ws_ypixel; | ||
12 | }; | ||
13 | 5 | ||
14 | #define NCC 8 | ||
15 | struct termio { | ||
16 | unsigned short c_iflag; /* input mode flags */ | ||
17 | unsigned short c_oflag; /* output mode flags */ | ||
18 | unsigned short c_cflag; /* control mode flags */ | ||
19 | unsigned short c_lflag; /* local mode flags */ | ||
20 | unsigned char c_line; /* line discipline */ | ||
21 | unsigned char c_cc[NCC]; /* control characters */ | ||
22 | }; | ||
23 | |||
24 | #ifdef __KERNEL__ | ||
25 | /* intr=^C quit=^| erase=del kill=^U | 6 | /* intr=^C quit=^| erase=del kill=^U |
26 | eof=^D vtime=\0 vmin=\1 sxtc=\0 | 7 | eof=^D vtime=\0 vmin=\1 sxtc=\0 |
27 | start=^Q stop=^S susp=^Z eol=\0 | 8 | start=^Q stop=^S susp=^Z eol=\0 |
@@ -29,27 +10,6 @@ struct termio { | |||
29 | eol2=\0 | 10 | eol2=\0 |
30 | */ | 11 | */ |
31 | #define INIT_C_CC "\003\034\177\025\004\0\1\0\021\023\032\0\022\017\027\026\0" | 12 | #define INIT_C_CC "\003\034\177\025\004\0\1\0\021\023\032\0\022\017\027\026\0" |
32 | #endif | ||
33 | |||
34 | /* modem lines */ | ||
35 | #define TIOCM_LE 0x001 | ||
36 | #define TIOCM_DTR 0x002 | ||
37 | #define TIOCM_RTS 0x004 | ||
38 | #define TIOCM_ST 0x008 | ||
39 | #define TIOCM_SR 0x010 | ||
40 | #define TIOCM_CTS 0x020 | ||
41 | #define TIOCM_CAR 0x040 | ||
42 | #define TIOCM_RNG 0x080 | ||
43 | #define TIOCM_DSR 0x100 | ||
44 | #define TIOCM_CD TIOCM_CAR | ||
45 | #define TIOCM_RI TIOCM_RNG | ||
46 | #define TIOCM_OUT1 0x2000 | ||
47 | #define TIOCM_OUT2 0x4000 | ||
48 | #define TIOCM_LOOP 0x8000 | ||
49 | |||
50 | /* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */ | ||
51 | |||
52 | #ifdef __KERNEL__ | ||
53 | 13 | ||
54 | /* | 14 | /* |
55 | * Translate a "termio" structure into a "termios". Ugh. | 15 | * Translate a "termio" structure into a "termios". Ugh. |
@@ -87,6 +47,4 @@ struct termio { | |||
87 | #define user_termios_to_kernel_termios_1(k, u) copy_from_user(k, u, sizeof(struct termios)) | 47 | #define user_termios_to_kernel_termios_1(k, u) copy_from_user(k, u, sizeof(struct termios)) |
88 | #define kernel_termios_to_user_termios_1(u, k) copy_to_user(u, k, sizeof(struct termios)) | 48 | #define kernel_termios_to_user_termios_1(u, k) copy_to_user(u, k, sizeof(struct termios)) |
89 | 49 | ||
90 | #endif /* __KERNEL__ */ | ||
91 | |||
92 | #endif /* _H8300_TERMIOS_H */ | 50 | #endif /* _H8300_TERMIOS_H */ |
diff --git a/arch/h8300/include/asm/types.h b/arch/h8300/include/asm/types.h index 07257d9487d8..c012707f6037 100644 --- a/arch/h8300/include/asm/types.h +++ b/arch/h8300/include/asm/types.h | |||
@@ -1,12 +1,9 @@ | |||
1 | #ifndef _H8300_TYPES_H | 1 | #ifndef _H8300_TYPES_H |
2 | #define _H8300_TYPES_H | 2 | #define _H8300_TYPES_H |
3 | 3 | ||
4 | #include <asm-generic/int-ll64.h> | 4 | #include <uapi/asm/types.h> |
5 | 5 | ||
6 | #ifdef __KERNEL__ | ||
7 | 6 | ||
8 | #define BITS_PER_LONG 32 | 7 | #define BITS_PER_LONG 32 |
9 | 8 | ||
10 | #endif /* __KERNEL__ */ | ||
11 | |||
12 | #endif /* _H8300_TYPES_H */ | 9 | #endif /* _H8300_TYPES_H */ |
diff --git a/arch/h8300/include/asm/unistd.h b/arch/h8300/include/asm/unistd.h index c2c2f5c7d6bf..8215518b3f9f 100644 --- a/arch/h8300/include/asm/unistd.h +++ b/arch/h8300/include/asm/unistd.h | |||
@@ -1,333 +1,8 @@ | |||
1 | #ifndef _ASM_H8300_UNISTD_H_ | 1 | #ifndef _ASM_H8300_UNISTD_H_ |
2 | #define _ASM_H8300_UNISTD_H_ | 2 | #define _ASM_H8300_UNISTD_H_ |
3 | 3 | ||
4 | /* | 4 | #include <uapi/asm/unistd.h> |
5 | * This file contains the system call numbers. | ||
6 | */ | ||
7 | |||
8 | #define __NR_restart_syscall 0 | ||
9 | #define __NR_exit 1 | ||
10 | #define __NR_fork 2 | ||
11 | #define __NR_read 3 | ||
12 | #define __NR_write 4 | ||
13 | #define __NR_open 5 | ||
14 | #define __NR_close 6 | ||
15 | #define __NR_waitpid 7 | ||
16 | #define __NR_creat 8 | ||
17 | #define __NR_link 9 | ||
18 | #define __NR_unlink 10 | ||
19 | #define __NR_execve 11 | ||
20 | #define __NR_chdir 12 | ||
21 | #define __NR_time 13 | ||
22 | #define __NR_mknod 14 | ||
23 | #define __NR_chmod 15 | ||
24 | #define __NR_lchown 16 | ||
25 | #define __NR_break 17 | ||
26 | #define __NR_oldstat 18 | ||
27 | #define __NR_lseek 19 | ||
28 | #define __NR_getpid 20 | ||
29 | #define __NR_mount 21 | ||
30 | #define __NR_umount 22 | ||
31 | #define __NR_setuid 23 | ||
32 | #define __NR_getuid 24 | ||
33 | #define __NR_stime 25 | ||
34 | #define __NR_ptrace 26 | ||
35 | #define __NR_alarm 27 | ||
36 | #define __NR_oldfstat 28 | ||
37 | #define __NR_pause 29 | ||
38 | #define __NR_utime 30 | ||
39 | #define __NR_stty 31 | ||
40 | #define __NR_gtty 32 | ||
41 | #define __NR_access 33 | ||
42 | #define __NR_nice 34 | ||
43 | #define __NR_ftime 35 | ||
44 | #define __NR_sync 36 | ||
45 | #define __NR_kill 37 | ||
46 | #define __NR_rename 38 | ||
47 | #define __NR_mkdir 39 | ||
48 | #define __NR_rmdir 40 | ||
49 | #define __NR_dup 41 | ||
50 | #define __NR_pipe 42 | ||
51 | #define __NR_times 43 | ||
52 | #define __NR_prof 44 | ||
53 | #define __NR_brk 45 | ||
54 | #define __NR_setgid 46 | ||
55 | #define __NR_getgid 47 | ||
56 | #define __NR_signal 48 | ||
57 | #define __NR_geteuid 49 | ||
58 | #define __NR_getegid 50 | ||
59 | #define __NR_acct 51 | ||
60 | #define __NR_umount2 52 | ||
61 | #define __NR_lock 53 | ||
62 | #define __NR_ioctl 54 | ||
63 | #define __NR_fcntl 55 | ||
64 | #define __NR_mpx 56 | ||
65 | #define __NR_setpgid 57 | ||
66 | #define __NR_ulimit 58 | ||
67 | #define __NR_oldolduname 59 | ||
68 | #define __NR_umask 60 | ||
69 | #define __NR_chroot 61 | ||
70 | #define __NR_ustat 62 | ||
71 | #define __NR_dup2 63 | ||
72 | #define __NR_getppid 64 | ||
73 | #define __NR_getpgrp 65 | ||
74 | #define __NR_setsid 66 | ||
75 | #define __NR_sigaction 67 | ||
76 | #define __NR_sgetmask 68 | ||
77 | #define __NR_ssetmask 69 | ||
78 | #define __NR_setreuid 70 | ||
79 | #define __NR_setregid 71 | ||
80 | #define __NR_sigsuspend 72 | ||
81 | #define __NR_sigpending 73 | ||
82 | #define __NR_sethostname 74 | ||
83 | #define __NR_setrlimit 75 | ||
84 | #define __NR_getrlimit 76 | ||
85 | #define __NR_getrusage 77 | ||
86 | #define __NR_gettimeofday 78 | ||
87 | #define __NR_settimeofday 79 | ||
88 | #define __NR_getgroups 80 | ||
89 | #define __NR_setgroups 81 | ||
90 | #define __NR_select 82 | ||
91 | #define __NR_symlink 83 | ||
92 | #define __NR_oldlstat 84 | ||
93 | #define __NR_readlink 85 | ||
94 | #define __NR_uselib 86 | ||
95 | #define __NR_swapon 87 | ||
96 | #define __NR_reboot 88 | ||
97 | #define __NR_readdir 89 | ||
98 | #define __NR_mmap 90 | ||
99 | #define __NR_munmap 91 | ||
100 | #define __NR_truncate 92 | ||
101 | #define __NR_ftruncate 93 | ||
102 | #define __NR_fchmod 94 | ||
103 | #define __NR_fchown 95 | ||
104 | #define __NR_getpriority 96 | ||
105 | #define __NR_setpriority 97 | ||
106 | #define __NR_profil 98 | ||
107 | #define __NR_statfs 99 | ||
108 | #define __NR_fstatfs 100 | ||
109 | #define __NR_ioperm 101 | ||
110 | #define __NR_socketcall 102 | ||
111 | #define __NR_syslog 103 | ||
112 | #define __NR_setitimer 104 | ||
113 | #define __NR_getitimer 105 | ||
114 | #define __NR_stat 106 | ||
115 | #define __NR_lstat 107 | ||
116 | #define __NR_fstat 108 | ||
117 | #define __NR_olduname 109 | ||
118 | #define __NR_iopl 110 | ||
119 | #define __NR_vhangup 111 | ||
120 | #define __NR_idle 112 | ||
121 | #define __NR_vm86old 113 | ||
122 | #define __NR_wait4 114 | ||
123 | #define __NR_swapoff 115 | ||
124 | #define __NR_sysinfo 116 | ||
125 | #define __NR_ipc 117 | ||
126 | #define __NR_fsync 118 | ||
127 | #define __NR_sigreturn 119 | ||
128 | #define __NR_clone 120 | ||
129 | #define __NR_setdomainname 121 | ||
130 | #define __NR_uname 122 | ||
131 | #define __NR_modify_ldt 123 | ||
132 | #define __NR_adjtimex 124 | ||
133 | #define __NR_mprotect 125 | ||
134 | #define __NR_sigprocmask 126 | ||
135 | #define __NR_create_module 127 | ||
136 | #define __NR_init_module 128 | ||
137 | #define __NR_delete_module 129 | ||
138 | #define __NR_get_kernel_syms 130 | ||
139 | #define __NR_quotactl 131 | ||
140 | #define __NR_getpgid 132 | ||
141 | #define __NR_fchdir 133 | ||
142 | #define __NR_bdflush 134 | ||
143 | #define __NR_sysfs 135 | ||
144 | #define __NR_personality 136 | ||
145 | #define __NR_afs_syscall 137 /* Syscall for Andrew File System */ | ||
146 | #define __NR_setfsuid 138 | ||
147 | #define __NR_setfsgid 139 | ||
148 | #define __NR__llseek 140 | ||
149 | #define __NR_getdents 141 | ||
150 | #define __NR__newselect 142 | ||
151 | #define __NR_flock 143 | ||
152 | #define __NR_msync 144 | ||
153 | #define __NR_readv 145 | ||
154 | #define __NR_writev 146 | ||
155 | #define __NR_getsid 147 | ||
156 | #define __NR_fdatasync 148 | ||
157 | #define __NR__sysctl 149 | ||
158 | #define __NR_mlock 150 | ||
159 | #define __NR_munlock 151 | ||
160 | #define __NR_mlockall 152 | ||
161 | #define __NR_munlockall 153 | ||
162 | #define __NR_sched_setparam 154 | ||
163 | #define __NR_sched_getparam 155 | ||
164 | #define __NR_sched_setscheduler 156 | ||
165 | #define __NR_sched_getscheduler 157 | ||
166 | #define __NR_sched_yield 158 | ||
167 | #define __NR_sched_get_priority_max 159 | ||
168 | #define __NR_sched_get_priority_min 160 | ||
169 | #define __NR_sched_rr_get_interval 161 | ||
170 | #define __NR_nanosleep 162 | ||
171 | #define __NR_mremap 163 | ||
172 | #define __NR_setresuid 164 | ||
173 | #define __NR_getresuid 165 | ||
174 | #define __NR_vm86 166 | ||
175 | #define __NR_query_module 167 | ||
176 | #define __NR_poll 168 | ||
177 | #define __NR_nfsservctl 169 | ||
178 | #define __NR_setresgid 170 | ||
179 | #define __NR_getresgid 171 | ||
180 | #define __NR_prctl 172 | ||
181 | #define __NR_rt_sigreturn 173 | ||
182 | #define __NR_rt_sigaction 174 | ||
183 | #define __NR_rt_sigprocmask 175 | ||
184 | #define __NR_rt_sigpending 176 | ||
185 | #define __NR_rt_sigtimedwait 177 | ||
186 | #define __NR_rt_sigqueueinfo 178 | ||
187 | #define __NR_rt_sigsuspend 179 | ||
188 | #define __NR_pread64 180 | ||
189 | #define __NR_pwrite64 181 | ||
190 | #define __NR_chown 182 | ||
191 | #define __NR_getcwd 183 | ||
192 | #define __NR_capget 184 | ||
193 | #define __NR_capset 185 | ||
194 | #define __NR_sigaltstack 186 | ||
195 | #define __NR_sendfile 187 | ||
196 | #define __NR_getpmsg 188 /* some people actually want streams */ | ||
197 | #define __NR_putpmsg 189 /* some people actually want streams */ | ||
198 | #define __NR_vfork 190 | ||
199 | #define __NR_ugetrlimit 191 | ||
200 | #define __NR_mmap2 192 | ||
201 | #define __NR_truncate64 193 | ||
202 | #define __NR_ftruncate64 194 | ||
203 | #define __NR_stat64 195 | ||
204 | #define __NR_lstat64 196 | ||
205 | #define __NR_fstat64 197 | ||
206 | #define __NR_lchown32 198 | ||
207 | #define __NR_getuid32 199 | ||
208 | #define __NR_getgid32 200 | ||
209 | #define __NR_geteuid32 201 | ||
210 | #define __NR_getegid32 202 | ||
211 | #define __NR_setreuid32 203 | ||
212 | #define __NR_setregid32 204 | ||
213 | #define __NR_getgroups32 205 | ||
214 | #define __NR_setgroups32 206 | ||
215 | #define __NR_fchown32 207 | ||
216 | #define __NR_setresuid32 208 | ||
217 | #define __NR_getresuid32 209 | ||
218 | #define __NR_setresgid32 210 | ||
219 | #define __NR_getresgid32 211 | ||
220 | #define __NR_chown32 212 | ||
221 | #define __NR_setuid32 213 | ||
222 | #define __NR_setgid32 214 | ||
223 | #define __NR_setfsuid32 215 | ||
224 | #define __NR_setfsgid32 216 | ||
225 | #define __NR_pivot_root 217 | ||
226 | #define __NR_mincore 218 | ||
227 | #define __NR_madvise 219 | ||
228 | #define __NR_madvise1 219 | ||
229 | #define __NR_getdents64 220 | ||
230 | #define __NR_fcntl64 221 | ||
231 | /* 223 is unused */ | ||
232 | #define __NR_gettid 224 | ||
233 | #define __NR_readahead 225 | ||
234 | #define __NR_setxattr 226 | ||
235 | #define __NR_lsetxattr 227 | ||
236 | #define __NR_fsetxattr 228 | ||
237 | #define __NR_getxattr 229 | ||
238 | #define __NR_lgetxattr 230 | ||
239 | #define __NR_fgetxattr 231 | ||
240 | #define __NR_listxattr 232 | ||
241 | #define __NR_llistxattr 233 | ||
242 | #define __NR_flistxattr 234 | ||
243 | #define __NR_removexattr 235 | ||
244 | #define __NR_lremovexattr 236 | ||
245 | #define __NR_fremovexattr 237 | ||
246 | #define __NR_tkill 238 | ||
247 | #define __NR_sendfile64 239 | ||
248 | #define __NR_futex 240 | ||
249 | #define __NR_sched_setaffinity 241 | ||
250 | #define __NR_sched_getaffinity 242 | ||
251 | #define __NR_set_thread_area 243 | ||
252 | #define __NR_get_thread_area 244 | ||
253 | #define __NR_io_setup 245 | ||
254 | #define __NR_io_destroy 246 | ||
255 | #define __NR_io_getevents 247 | ||
256 | #define __NR_io_submit 248 | ||
257 | #define __NR_io_cancel 249 | ||
258 | #define __NR_fadvise64 250 | ||
259 | /* 251 is available for reuse (was briefly sys_set_zone_reclaim) */ | ||
260 | #define __NR_exit_group 252 | ||
261 | #define __NR_lookup_dcookie 253 | ||
262 | #define __NR_epoll_create 254 | ||
263 | #define __NR_epoll_ctl 255 | ||
264 | #define __NR_epoll_wait 256 | ||
265 | #define __NR_remap_file_pages 257 | ||
266 | #define __NR_set_tid_address 258 | ||
267 | #define __NR_timer_create 259 | ||
268 | #define __NR_timer_settime (__NR_timer_create+1) | ||
269 | #define __NR_timer_gettime (__NR_timer_create+2) | ||
270 | #define __NR_timer_getoverrun (__NR_timer_create+3) | ||
271 | #define __NR_timer_delete (__NR_timer_create+4) | ||
272 | #define __NR_clock_settime (__NR_timer_create+5) | ||
273 | #define __NR_clock_gettime (__NR_timer_create+6) | ||
274 | #define __NR_clock_getres (__NR_timer_create+7) | ||
275 | #define __NR_clock_nanosleep (__NR_timer_create+8) | ||
276 | #define __NR_statfs64 268 | ||
277 | #define __NR_fstatfs64 269 | ||
278 | #define __NR_tgkill 270 | ||
279 | #define __NR_utimes 271 | ||
280 | #define __NR_fadvise64_64 272 | ||
281 | #define __NR_vserver 273 | ||
282 | #define __NR_mbind 274 | ||
283 | #define __NR_get_mempolicy 275 | ||
284 | #define __NR_set_mempolicy 276 | ||
285 | #define __NR_mq_open 277 | ||
286 | #define __NR_mq_unlink (__NR_mq_open+1) | ||
287 | #define __NR_mq_timedsend (__NR_mq_open+2) | ||
288 | #define __NR_mq_timedreceive (__NR_mq_open+3) | ||
289 | #define __NR_mq_notify (__NR_mq_open+4) | ||
290 | #define __NR_mq_getsetattr (__NR_mq_open+5) | ||
291 | #define __NR_kexec_load 283 | ||
292 | #define __NR_waitid 284 | ||
293 | /* #define __NR_sys_setaltroot 285 */ | ||
294 | #define __NR_add_key 286 | ||
295 | #define __NR_request_key 287 | ||
296 | #define __NR_keyctl 288 | ||
297 | #define __NR_ioprio_set 289 | ||
298 | #define __NR_ioprio_get 290 | ||
299 | #define __NR_inotify_init 291 | ||
300 | #define __NR_inotify_add_watch 292 | ||
301 | #define __NR_inotify_rm_watch 293 | ||
302 | #define __NR_migrate_pages 294 | ||
303 | #define __NR_openat 295 | ||
304 | #define __NR_mkdirat 296 | ||
305 | #define __NR_mknodat 297 | ||
306 | #define __NR_fchownat 298 | ||
307 | #define __NR_futimesat 299 | ||
308 | #define __NR_fstatat64 300 | ||
309 | #define __NR_unlinkat 301 | ||
310 | #define __NR_renameat 302 | ||
311 | #define __NR_linkat 303 | ||
312 | #define __NR_symlinkat 304 | ||
313 | #define __NR_readlinkat 305 | ||
314 | #define __NR_fchmodat 306 | ||
315 | #define __NR_faccessat 307 | ||
316 | #define __NR_pselect6 308 | ||
317 | #define __NR_ppoll 309 | ||
318 | #define __NR_unshare 310 | ||
319 | #define __NR_set_robust_list 311 | ||
320 | #define __NR_get_robust_list 312 | ||
321 | #define __NR_splice 313 | ||
322 | #define __NR_sync_file_range 314 | ||
323 | #define __NR_tee 315 | ||
324 | #define __NR_vmsplice 316 | ||
325 | #define __NR_move_pages 317 | ||
326 | #define __NR_getcpu 318 | ||
327 | #define __NR_epoll_pwait 319 | ||
328 | #define __NR_setns 320 | ||
329 | 5 | ||
330 | #ifdef __KERNEL__ | ||
331 | 6 | ||
332 | #define NR_syscalls 321 | 7 | #define NR_syscalls 321 |
333 | 8 | ||
@@ -368,5 +43,4 @@ | |||
368 | asm (".weak\t_" #name "\n" \ | 43 | asm (".weak\t_" #name "\n" \ |
369 | ".set\t_" #name ",_sys_ni_syscall"); | 44 | ".set\t_" #name ",_sys_ni_syscall"); |
370 | 45 | ||
371 | #endif /* __KERNEL__ */ | ||
372 | #endif /* _ASM_H8300_UNISTD_H_ */ | 46 | #endif /* _ASM_H8300_UNISTD_H_ */ |
diff --git a/arch/h8300/include/uapi/asm/Kbuild b/arch/h8300/include/uapi/asm/Kbuild index baebb3da1d44..040178cdb3eb 100644 --- a/arch/h8300/include/uapi/asm/Kbuild +++ b/arch/h8300/include/uapi/asm/Kbuild | |||
@@ -1,3 +1,34 @@ | |||
1 | # UAPI Header export list | 1 | # UAPI Header export list |
2 | include include/uapi/asm-generic/Kbuild.asm | 2 | include include/uapi/asm-generic/Kbuild.asm |
3 | 3 | ||
4 | header-y += auxvec.h | ||
5 | header-y += bitsperlong.h | ||
6 | header-y += byteorder.h | ||
7 | header-y += errno.h | ||
8 | header-y += fcntl.h | ||
9 | header-y += ioctl.h | ||
10 | header-y += ioctls.h | ||
11 | header-y += ipcbuf.h | ||
12 | header-y += kvm_para.h | ||
13 | header-y += mman.h | ||
14 | header-y += msgbuf.h | ||
15 | header-y += param.h | ||
16 | header-y += poll.h | ||
17 | header-y += posix_types.h | ||
18 | header-y += ptrace.h | ||
19 | header-y += resource.h | ||
20 | header-y += sembuf.h | ||
21 | header-y += setup.h | ||
22 | header-y += shmbuf.h | ||
23 | header-y += sigcontext.h | ||
24 | header-y += siginfo.h | ||
25 | header-y += signal.h | ||
26 | header-y += socket.h | ||
27 | header-y += sockios.h | ||
28 | header-y += stat.h | ||
29 | header-y += statfs.h | ||
30 | header-y += swab.h | ||
31 | header-y += termbits.h | ||
32 | header-y += termios.h | ||
33 | header-y += types.h | ||
34 | header-y += unistd.h | ||
diff --git a/arch/h8300/include/asm/auxvec.h b/arch/h8300/include/uapi/asm/auxvec.h index 1d36fe38b088..1d36fe38b088 100644 --- a/arch/h8300/include/asm/auxvec.h +++ b/arch/h8300/include/uapi/asm/auxvec.h | |||
diff --git a/arch/h8300/include/asm/bitsperlong.h b/arch/h8300/include/uapi/asm/bitsperlong.h index 6dc0bb0c13b2..6dc0bb0c13b2 100644 --- a/arch/h8300/include/asm/bitsperlong.h +++ b/arch/h8300/include/uapi/asm/bitsperlong.h | |||
diff --git a/arch/h8300/include/asm/byteorder.h b/arch/h8300/include/uapi/asm/byteorder.h index 13539da99efd..13539da99efd 100644 --- a/arch/h8300/include/asm/byteorder.h +++ b/arch/h8300/include/uapi/asm/byteorder.h | |||
diff --git a/arch/h8300/include/asm/errno.h b/arch/h8300/include/uapi/asm/errno.h index 0c2f5641fdcc..0c2f5641fdcc 100644 --- a/arch/h8300/include/asm/errno.h +++ b/arch/h8300/include/uapi/asm/errno.h | |||
diff --git a/arch/h8300/include/asm/fcntl.h b/arch/h8300/include/uapi/asm/fcntl.h index 1952cb2e3b06..1952cb2e3b06 100644 --- a/arch/h8300/include/asm/fcntl.h +++ b/arch/h8300/include/uapi/asm/fcntl.h | |||
diff --git a/arch/h8300/include/asm/ioctl.h b/arch/h8300/include/uapi/asm/ioctl.h index b279fe06dfe5..b279fe06dfe5 100644 --- a/arch/h8300/include/asm/ioctl.h +++ b/arch/h8300/include/uapi/asm/ioctl.h | |||
diff --git a/arch/h8300/include/asm/ioctls.h b/arch/h8300/include/uapi/asm/ioctls.h index 30eaed2facdb..30eaed2facdb 100644 --- a/arch/h8300/include/asm/ioctls.h +++ b/arch/h8300/include/uapi/asm/ioctls.h | |||
diff --git a/arch/h8300/include/asm/ipcbuf.h b/arch/h8300/include/uapi/asm/ipcbuf.h index 84c7e51cb6d0..84c7e51cb6d0 100644 --- a/arch/h8300/include/asm/ipcbuf.h +++ b/arch/h8300/include/uapi/asm/ipcbuf.h | |||
diff --git a/arch/h8300/include/asm/kvm_para.h b/arch/h8300/include/uapi/asm/kvm_para.h index 14fab8f0b957..14fab8f0b957 100644 --- a/arch/h8300/include/asm/kvm_para.h +++ b/arch/h8300/include/uapi/asm/kvm_para.h | |||
diff --git a/arch/h8300/include/asm/mman.h b/arch/h8300/include/uapi/asm/mman.h index 8eebf89f5ab1..8eebf89f5ab1 100644 --- a/arch/h8300/include/asm/mman.h +++ b/arch/h8300/include/uapi/asm/mman.h | |||
diff --git a/arch/h8300/include/asm/msgbuf.h b/arch/h8300/include/uapi/asm/msgbuf.h index 6b148cd09aa5..6b148cd09aa5 100644 --- a/arch/h8300/include/asm/msgbuf.h +++ b/arch/h8300/include/uapi/asm/msgbuf.h | |||
diff --git a/arch/h8300/include/uapi/asm/param.h b/arch/h8300/include/uapi/asm/param.h new file mode 100644 index 000000000000..3dd18ae15f03 --- /dev/null +++ b/arch/h8300/include/uapi/asm/param.h | |||
@@ -0,0 +1,16 @@ | |||
1 | #ifndef _UAPI_H8300_PARAM_H | ||
2 | #define _UAPI_H8300_PARAM_H | ||
3 | |||
4 | #ifndef __KERNEL__ | ||
5 | #define HZ 100 | ||
6 | #endif | ||
7 | |||
8 | #define EXEC_PAGESIZE 4096 | ||
9 | |||
10 | #ifndef NOGROUP | ||
11 | #define NOGROUP (-1) | ||
12 | #endif | ||
13 | |||
14 | #define MAXHOSTNAMELEN 64 /* max length of hostname */ | ||
15 | |||
16 | #endif /* _UAPI_H8300_PARAM_H */ | ||
diff --git a/arch/h8300/include/asm/poll.h b/arch/h8300/include/uapi/asm/poll.h index f61540c22d94..f61540c22d94 100644 --- a/arch/h8300/include/asm/poll.h +++ b/arch/h8300/include/uapi/asm/poll.h | |||
diff --git a/arch/h8300/include/asm/posix_types.h b/arch/h8300/include/uapi/asm/posix_types.h index 91e62ba4c7b0..91e62ba4c7b0 100644 --- a/arch/h8300/include/asm/posix_types.h +++ b/arch/h8300/include/uapi/asm/posix_types.h | |||
diff --git a/arch/h8300/include/uapi/asm/ptrace.h b/arch/h8300/include/uapi/asm/ptrace.h new file mode 100644 index 000000000000..ef39ec5977b6 --- /dev/null +++ b/arch/h8300/include/uapi/asm/ptrace.h | |||
@@ -0,0 +1,44 @@ | |||
1 | #ifndef _UAPI_H8300_PTRACE_H | ||
2 | #define _UAPI_H8300_PTRACE_H | ||
3 | |||
4 | #ifndef __ASSEMBLY__ | ||
5 | |||
6 | #define PT_ER1 0 | ||
7 | #define PT_ER2 1 | ||
8 | #define PT_ER3 2 | ||
9 | #define PT_ER4 3 | ||
10 | #define PT_ER5 4 | ||
11 | #define PT_ER6 5 | ||
12 | #define PT_ER0 6 | ||
13 | #define PT_ORIG_ER0 7 | ||
14 | #define PT_CCR 8 | ||
15 | #define PT_PC 9 | ||
16 | #define PT_USP 10 | ||
17 | #define PT_EXR 12 | ||
18 | |||
19 | /* this struct defines the way the registers are stored on the | ||
20 | stack during a system call. */ | ||
21 | |||
22 | struct pt_regs { | ||
23 | long retpc; | ||
24 | long er4; | ||
25 | long er5; | ||
26 | long er6; | ||
27 | long er3; | ||
28 | long er2; | ||
29 | long er1; | ||
30 | long orig_er0; | ||
31 | unsigned short ccr; | ||
32 | long er0; | ||
33 | long vector; | ||
34 | #if defined(CONFIG_CPU_H8S) | ||
35 | unsigned short exr; | ||
36 | #endif | ||
37 | unsigned long pc; | ||
38 | } __attribute__((aligned(2),packed)); | ||
39 | |||
40 | #define PTRACE_GETREGS 12 | ||
41 | #define PTRACE_SETREGS 13 | ||
42 | |||
43 | #endif /* __ASSEMBLY__ */ | ||
44 | #endif /* _UAPI_H8300_PTRACE_H */ | ||
diff --git a/arch/h8300/include/asm/resource.h b/arch/h8300/include/uapi/asm/resource.h index 46c5f4391607..46c5f4391607 100644 --- a/arch/h8300/include/asm/resource.h +++ b/arch/h8300/include/uapi/asm/resource.h | |||
diff --git a/arch/h8300/include/asm/sembuf.h b/arch/h8300/include/uapi/asm/sembuf.h index e04a3ec0cb92..e04a3ec0cb92 100644 --- a/arch/h8300/include/asm/sembuf.h +++ b/arch/h8300/include/uapi/asm/sembuf.h | |||
diff --git a/arch/h8300/include/asm/setup.h b/arch/h8300/include/uapi/asm/setup.h index e2c600e96733..e2c600e96733 100644 --- a/arch/h8300/include/asm/setup.h +++ b/arch/h8300/include/uapi/asm/setup.h | |||
diff --git a/arch/h8300/include/asm/shmbuf.h b/arch/h8300/include/uapi/asm/shmbuf.h index 64e77993a7a9..64e77993a7a9 100644 --- a/arch/h8300/include/asm/shmbuf.h +++ b/arch/h8300/include/uapi/asm/shmbuf.h | |||
diff --git a/arch/h8300/include/asm/sigcontext.h b/arch/h8300/include/uapi/asm/sigcontext.h index e4b81505f8f8..e4b81505f8f8 100644 --- a/arch/h8300/include/asm/sigcontext.h +++ b/arch/h8300/include/uapi/asm/sigcontext.h | |||
diff --git a/arch/h8300/include/asm/siginfo.h b/arch/h8300/include/uapi/asm/siginfo.h index bc8fbea931a5..bc8fbea931a5 100644 --- a/arch/h8300/include/asm/siginfo.h +++ b/arch/h8300/include/uapi/asm/siginfo.h | |||
diff --git a/arch/h8300/include/uapi/asm/signal.h b/arch/h8300/include/uapi/asm/signal.h new file mode 100644 index 000000000000..913729e581e8 --- /dev/null +++ b/arch/h8300/include/uapi/asm/signal.h | |||
@@ -0,0 +1,121 @@ | |||
1 | #ifndef _UAPI_H8300_SIGNAL_H | ||
2 | #define _UAPI_H8300_SIGNAL_H | ||
3 | |||
4 | #include <linux/types.h> | ||
5 | |||
6 | /* Avoid too many header ordering problems. */ | ||
7 | struct siginfo; | ||
8 | |||
9 | #ifndef __KERNEL__ | ||
10 | /* Here we must cater to libcs that poke about in kernel headers. */ | ||
11 | |||
12 | #define NSIG 32 | ||
13 | typedef unsigned long sigset_t; | ||
14 | |||
15 | #endif /* __KERNEL__ */ | ||
16 | |||
17 | #define SIGHUP 1 | ||
18 | #define SIGINT 2 | ||
19 | #define SIGQUIT 3 | ||
20 | #define SIGILL 4 | ||
21 | #define SIGTRAP 5 | ||
22 | #define SIGABRT 6 | ||
23 | #define SIGIOT 6 | ||
24 | #define SIGBUS 7 | ||
25 | #define SIGFPE 8 | ||
26 | #define SIGKILL 9 | ||
27 | #define SIGUSR1 10 | ||
28 | #define SIGSEGV 11 | ||
29 | #define SIGUSR2 12 | ||
30 | #define SIGPIPE 13 | ||
31 | #define SIGALRM 14 | ||
32 | #define SIGTERM 15 | ||
33 | #define SIGSTKFLT 16 | ||
34 | #define SIGCHLD 17 | ||
35 | #define SIGCONT 18 | ||
36 | #define SIGSTOP 19 | ||
37 | #define SIGTSTP 20 | ||
38 | #define SIGTTIN 21 | ||
39 | #define SIGTTOU 22 | ||
40 | #define SIGURG 23 | ||
41 | #define SIGXCPU 24 | ||
42 | #define SIGXFSZ 25 | ||
43 | #define SIGVTALRM 26 | ||
44 | #define SIGPROF 27 | ||
45 | #define SIGWINCH 28 | ||
46 | #define SIGIO 29 | ||
47 | #define SIGPOLL SIGIO | ||
48 | /* | ||
49 | #define SIGLOST 29 | ||
50 | */ | ||
51 | #define SIGPWR 30 | ||
52 | #define SIGSYS 31 | ||
53 | #define SIGUNUSED 31 | ||
54 | |||
55 | /* These should not be considered constants from userland. */ | ||
56 | #define SIGRTMIN 32 | ||
57 | #define SIGRTMAX _NSIG | ||
58 | |||
59 | /* | ||
60 | * SA_FLAGS values: | ||
61 | * | ||
62 | * SA_ONSTACK indicates that a registered stack_t will be used. | ||
63 | * SA_RESTART flag to get restarting signals (which were the default long ago) | ||
64 | * SA_NOCLDSTOP flag to turn off SIGCHLD when children stop. | ||
65 | * SA_RESETHAND clears the handler when the signal is delivered. | ||
66 | * SA_NOCLDWAIT flag on SIGCHLD to inhibit zombies. | ||
67 | * SA_NODEFER prevents the current signal from being masked in the handler. | ||
68 | * | ||
69 | * SA_ONESHOT and SA_NOMASK are the historical Linux names for the Single | ||
70 | * Unix names RESETHAND and NODEFER respectively. | ||
71 | */ | ||
72 | #define SA_NOCLDSTOP 0x00000001 | ||
73 | #define SA_NOCLDWAIT 0x00000002 /* not supported yet */ | ||
74 | #define SA_SIGINFO 0x00000004 | ||
75 | #define SA_ONSTACK 0x08000000 | ||
76 | #define SA_RESTART 0x10000000 | ||
77 | #define SA_NODEFER 0x40000000 | ||
78 | #define SA_RESETHAND 0x80000000 | ||
79 | |||
80 | #define SA_NOMASK SA_NODEFER | ||
81 | #define SA_ONESHOT SA_RESETHAND | ||
82 | |||
83 | #define SA_RESTORER 0x04000000 | ||
84 | |||
85 | /* | ||
86 | * sigaltstack controls | ||
87 | */ | ||
88 | #define SS_ONSTACK 1 | ||
89 | #define SS_DISABLE 2 | ||
90 | |||
91 | #define MINSIGSTKSZ 2048 | ||
92 | #define SIGSTKSZ 8192 | ||
93 | |||
94 | #include <asm-generic/signal-defs.h> | ||
95 | |||
96 | #ifndef __KERNEL__ | ||
97 | /* Here we must cater to libcs that poke about in kernel headers. */ | ||
98 | |||
99 | struct sigaction { | ||
100 | union { | ||
101 | __sighandler_t _sa_handler; | ||
102 | void (*_sa_sigaction)(int, struct siginfo *, void *); | ||
103 | } _u; | ||
104 | sigset_t sa_mask; | ||
105 | unsigned long sa_flags; | ||
106 | void (*sa_restorer)(void); | ||
107 | }; | ||
108 | |||
109 | #define sa_handler _u._sa_handler | ||
110 | #define sa_sigaction _u._sa_sigaction | ||
111 | |||
112 | #endif /* __KERNEL__ */ | ||
113 | |||
114 | typedef struct sigaltstack { | ||
115 | void *ss_sp; | ||
116 | int ss_flags; | ||
117 | size_t ss_size; | ||
118 | } stack_t; | ||
119 | |||
120 | |||
121 | #endif /* _UAPI_H8300_SIGNAL_H */ | ||
diff --git a/arch/h8300/include/asm/socket.h b/arch/h8300/include/uapi/asm/socket.h index 90a2e573c7e6..90a2e573c7e6 100644 --- a/arch/h8300/include/asm/socket.h +++ b/arch/h8300/include/uapi/asm/socket.h | |||
diff --git a/arch/h8300/include/asm/sockios.h b/arch/h8300/include/uapi/asm/sockios.h index e9c7ec810c23..e9c7ec810c23 100644 --- a/arch/h8300/include/asm/sockios.h +++ b/arch/h8300/include/uapi/asm/sockios.h | |||
diff --git a/arch/h8300/include/asm/stat.h b/arch/h8300/include/uapi/asm/stat.h index 62c3cc24dfe6..62c3cc24dfe6 100644 --- a/arch/h8300/include/asm/stat.h +++ b/arch/h8300/include/uapi/asm/stat.h | |||
diff --git a/arch/h8300/include/asm/statfs.h b/arch/h8300/include/uapi/asm/statfs.h index b96efa712aac..b96efa712aac 100644 --- a/arch/h8300/include/asm/statfs.h +++ b/arch/h8300/include/uapi/asm/statfs.h | |||
diff --git a/arch/h8300/include/asm/swab.h b/arch/h8300/include/uapi/asm/swab.h index 39abbf52807d..39abbf52807d 100644 --- a/arch/h8300/include/asm/swab.h +++ b/arch/h8300/include/uapi/asm/swab.h | |||
diff --git a/arch/h8300/include/asm/termbits.h b/arch/h8300/include/uapi/asm/termbits.h index 3287a6244d74..3287a6244d74 100644 --- a/arch/h8300/include/asm/termbits.h +++ b/arch/h8300/include/uapi/asm/termbits.h | |||
diff --git a/arch/h8300/include/uapi/asm/termios.h b/arch/h8300/include/uapi/asm/termios.h new file mode 100644 index 000000000000..5a67d7e38843 --- /dev/null +++ b/arch/h8300/include/uapi/asm/termios.h | |||
@@ -0,0 +1,44 @@ | |||
1 | #ifndef _UAPI_H8300_TERMIOS_H | ||
2 | #define _UAPI_H8300_TERMIOS_H | ||
3 | |||
4 | #include <asm/termbits.h> | ||
5 | #include <asm/ioctls.h> | ||
6 | |||
7 | struct winsize { | ||
8 | unsigned short ws_row; | ||
9 | unsigned short ws_col; | ||
10 | unsigned short ws_xpixel; | ||
11 | unsigned short ws_ypixel; | ||
12 | }; | ||
13 | |||
14 | #define NCC 8 | ||
15 | struct termio { | ||
16 | unsigned short c_iflag; /* input mode flags */ | ||
17 | unsigned short c_oflag; /* output mode flags */ | ||
18 | unsigned short c_cflag; /* control mode flags */ | ||
19 | unsigned short c_lflag; /* local mode flags */ | ||
20 | unsigned char c_line; /* line discipline */ | ||
21 | unsigned char c_cc[NCC]; /* control characters */ | ||
22 | }; | ||
23 | |||
24 | |||
25 | /* modem lines */ | ||
26 | #define TIOCM_LE 0x001 | ||
27 | #define TIOCM_DTR 0x002 | ||
28 | #define TIOCM_RTS 0x004 | ||
29 | #define TIOCM_ST 0x008 | ||
30 | #define TIOCM_SR 0x010 | ||
31 | #define TIOCM_CTS 0x020 | ||
32 | #define TIOCM_CAR 0x040 | ||
33 | #define TIOCM_RNG 0x080 | ||
34 | #define TIOCM_DSR 0x100 | ||
35 | #define TIOCM_CD TIOCM_CAR | ||
36 | #define TIOCM_RI TIOCM_RNG | ||
37 | #define TIOCM_OUT1 0x2000 | ||
38 | #define TIOCM_OUT2 0x4000 | ||
39 | #define TIOCM_LOOP 0x8000 | ||
40 | |||
41 | /* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */ | ||
42 | |||
43 | |||
44 | #endif /* _UAPI_H8300_TERMIOS_H */ | ||
diff --git a/arch/h8300/include/uapi/asm/types.h b/arch/h8300/include/uapi/asm/types.h new file mode 100644 index 000000000000..9ec9d4c5ac4d --- /dev/null +++ b/arch/h8300/include/uapi/asm/types.h | |||
@@ -0,0 +1 @@ | |||
#include <asm-generic/int-ll64.h> | |||
diff --git a/arch/h8300/include/uapi/asm/unistd.h b/arch/h8300/include/uapi/asm/unistd.h new file mode 100644 index 000000000000..8cb5d429f840 --- /dev/null +++ b/arch/h8300/include/uapi/asm/unistd.h | |||
@@ -0,0 +1,330 @@ | |||
1 | #ifndef _UAPI_ASM_H8300_UNISTD_H_ | ||
2 | #define _UAPI_ASM_H8300_UNISTD_H_ | ||
3 | |||
4 | /* | ||
5 | * This file contains the system call numbers. | ||
6 | */ | ||
7 | |||
8 | #define __NR_restart_syscall 0 | ||
9 | #define __NR_exit 1 | ||
10 | #define __NR_fork 2 | ||
11 | #define __NR_read 3 | ||
12 | #define __NR_write 4 | ||
13 | #define __NR_open 5 | ||
14 | #define __NR_close 6 | ||
15 | #define __NR_waitpid 7 | ||
16 | #define __NR_creat 8 | ||
17 | #define __NR_link 9 | ||
18 | #define __NR_unlink 10 | ||
19 | #define __NR_execve 11 | ||
20 | #define __NR_chdir 12 | ||
21 | #define __NR_time 13 | ||
22 | #define __NR_mknod 14 | ||
23 | #define __NR_chmod 15 | ||
24 | #define __NR_lchown 16 | ||
25 | #define __NR_break 17 | ||
26 | #define __NR_oldstat 18 | ||
27 | #define __NR_lseek 19 | ||
28 | #define __NR_getpid 20 | ||
29 | #define __NR_mount 21 | ||
30 | #define __NR_umount 22 | ||
31 | #define __NR_setuid 23 | ||
32 | #define __NR_getuid 24 | ||
33 | #define __NR_stime 25 | ||
34 | #define __NR_ptrace 26 | ||
35 | #define __NR_alarm 27 | ||
36 | #define __NR_oldfstat 28 | ||
37 | #define __NR_pause 29 | ||
38 | #define __NR_utime 30 | ||
39 | #define __NR_stty 31 | ||
40 | #define __NR_gtty 32 | ||
41 | #define __NR_access 33 | ||
42 | #define __NR_nice 34 | ||
43 | #define __NR_ftime 35 | ||
44 | #define __NR_sync 36 | ||
45 | #define __NR_kill 37 | ||
46 | #define __NR_rename 38 | ||
47 | #define __NR_mkdir 39 | ||
48 | #define __NR_rmdir 40 | ||
49 | #define __NR_dup 41 | ||
50 | #define __NR_pipe 42 | ||
51 | #define __NR_times 43 | ||
52 | #define __NR_prof 44 | ||
53 | #define __NR_brk 45 | ||
54 | #define __NR_setgid 46 | ||
55 | #define __NR_getgid 47 | ||
56 | #define __NR_signal 48 | ||
57 | #define __NR_geteuid 49 | ||
58 | #define __NR_getegid 50 | ||
59 | #define __NR_acct 51 | ||
60 | #define __NR_umount2 52 | ||
61 | #define __NR_lock 53 | ||
62 | #define __NR_ioctl 54 | ||
63 | #define __NR_fcntl 55 | ||
64 | #define __NR_mpx 56 | ||
65 | #define __NR_setpgid 57 | ||
66 | #define __NR_ulimit 58 | ||
67 | #define __NR_oldolduname 59 | ||
68 | #define __NR_umask 60 | ||
69 | #define __NR_chroot 61 | ||
70 | #define __NR_ustat 62 | ||
71 | #define __NR_dup2 63 | ||
72 | #define __NR_getppid 64 | ||
73 | #define __NR_getpgrp 65 | ||
74 | #define __NR_setsid 66 | ||
75 | #define __NR_sigaction 67 | ||
76 | #define __NR_sgetmask 68 | ||
77 | #define __NR_ssetmask 69 | ||
78 | #define __NR_setreuid 70 | ||
79 | #define __NR_setregid 71 | ||
80 | #define __NR_sigsuspend 72 | ||
81 | #define __NR_sigpending 73 | ||
82 | #define __NR_sethostname 74 | ||
83 | #define __NR_setrlimit 75 | ||
84 | #define __NR_getrlimit 76 | ||
85 | #define __NR_getrusage 77 | ||
86 | #define __NR_gettimeofday 78 | ||
87 | #define __NR_settimeofday 79 | ||
88 | #define __NR_getgroups 80 | ||
89 | #define __NR_setgroups 81 | ||
90 | #define __NR_select 82 | ||
91 | #define __NR_symlink 83 | ||
92 | #define __NR_oldlstat 84 | ||
93 | #define __NR_readlink 85 | ||
94 | #define __NR_uselib 86 | ||
95 | #define __NR_swapon 87 | ||
96 | #define __NR_reboot 88 | ||
97 | #define __NR_readdir 89 | ||
98 | #define __NR_mmap 90 | ||
99 | #define __NR_munmap 91 | ||
100 | #define __NR_truncate 92 | ||
101 | #define __NR_ftruncate 93 | ||
102 | #define __NR_fchmod 94 | ||
103 | #define __NR_fchown 95 | ||
104 | #define __NR_getpriority 96 | ||
105 | #define __NR_setpriority 97 | ||
106 | #define __NR_profil 98 | ||
107 | #define __NR_statfs 99 | ||
108 | #define __NR_fstatfs 100 | ||
109 | #define __NR_ioperm 101 | ||
110 | #define __NR_socketcall 102 | ||
111 | #define __NR_syslog 103 | ||
112 | #define __NR_setitimer 104 | ||
113 | #define __NR_getitimer 105 | ||
114 | #define __NR_stat 106 | ||
115 | #define __NR_lstat 107 | ||
116 | #define __NR_fstat 108 | ||
117 | #define __NR_olduname 109 | ||
118 | #define __NR_iopl 110 | ||
119 | #define __NR_vhangup 111 | ||
120 | #define __NR_idle 112 | ||
121 | #define __NR_vm86old 113 | ||
122 | #define __NR_wait4 114 | ||
123 | #define __NR_swapoff 115 | ||
124 | #define __NR_sysinfo 116 | ||
125 | #define __NR_ipc 117 | ||
126 | #define __NR_fsync 118 | ||
127 | #define __NR_sigreturn 119 | ||
128 | #define __NR_clone 120 | ||
129 | #define __NR_setdomainname 121 | ||
130 | #define __NR_uname 122 | ||
131 | #define __NR_modify_ldt 123 | ||
132 | #define __NR_adjtimex 124 | ||
133 | #define __NR_mprotect 125 | ||
134 | #define __NR_sigprocmask 126 | ||
135 | #define __NR_create_module 127 | ||
136 | #define __NR_init_module 128 | ||
137 | #define __NR_delete_module 129 | ||
138 | #define __NR_get_kernel_syms 130 | ||
139 | #define __NR_quotactl 131 | ||
140 | #define __NR_getpgid 132 | ||
141 | #define __NR_fchdir 133 | ||
142 | #define __NR_bdflush 134 | ||
143 | #define __NR_sysfs 135 | ||
144 | #define __NR_personality 136 | ||
145 | #define __NR_afs_syscall 137 /* Syscall for Andrew File System */ | ||
146 | #define __NR_setfsuid 138 | ||
147 | #define __NR_setfsgid 139 | ||
148 | #define __NR__llseek 140 | ||
149 | #define __NR_getdents 141 | ||
150 | #define __NR__newselect 142 | ||
151 | #define __NR_flock 143 | ||
152 | #define __NR_msync 144 | ||
153 | #define __NR_readv 145 | ||
154 | #define __NR_writev 146 | ||
155 | #define __NR_getsid 147 | ||
156 | #define __NR_fdatasync 148 | ||
157 | #define __NR__sysctl 149 | ||
158 | #define __NR_mlock 150 | ||
159 | #define __NR_munlock 151 | ||
160 | #define __NR_mlockall 152 | ||
161 | #define __NR_munlockall 153 | ||
162 | #define __NR_sched_setparam 154 | ||
163 | #define __NR_sched_getparam 155 | ||
164 | #define __NR_sched_setscheduler 156 | ||
165 | #define __NR_sched_getscheduler 157 | ||
166 | #define __NR_sched_yield 158 | ||
167 | #define __NR_sched_get_priority_max 159 | ||
168 | #define __NR_sched_get_priority_min 160 | ||
169 | #define __NR_sched_rr_get_interval 161 | ||
170 | #define __NR_nanosleep 162 | ||
171 | #define __NR_mremap 163 | ||
172 | #define __NR_setresuid 164 | ||
173 | #define __NR_getresuid 165 | ||
174 | #define __NR_vm86 166 | ||
175 | #define __NR_query_module 167 | ||
176 | #define __NR_poll 168 | ||
177 | #define __NR_nfsservctl 169 | ||
178 | #define __NR_setresgid 170 | ||
179 | #define __NR_getresgid 171 | ||
180 | #define __NR_prctl 172 | ||
181 | #define __NR_rt_sigreturn 173 | ||
182 | #define __NR_rt_sigaction 174 | ||
183 | #define __NR_rt_sigprocmask 175 | ||
184 | #define __NR_rt_sigpending 176 | ||
185 | #define __NR_rt_sigtimedwait 177 | ||
186 | #define __NR_rt_sigqueueinfo 178 | ||
187 | #define __NR_rt_sigsuspend 179 | ||
188 | #define __NR_pread64 180 | ||
189 | #define __NR_pwrite64 181 | ||
190 | #define __NR_chown 182 | ||
191 | #define __NR_getcwd 183 | ||
192 | #define __NR_capget 184 | ||
193 | #define __NR_capset 185 | ||
194 | #define __NR_sigaltstack 186 | ||
195 | #define __NR_sendfile 187 | ||
196 | #define __NR_getpmsg 188 /* some people actually want streams */ | ||
197 | #define __NR_putpmsg 189 /* some people actually want streams */ | ||
198 | #define __NR_vfork 190 | ||
199 | #define __NR_ugetrlimit 191 | ||
200 | #define __NR_mmap2 192 | ||
201 | #define __NR_truncate64 193 | ||
202 | #define __NR_ftruncate64 194 | ||
203 | #define __NR_stat64 195 | ||
204 | #define __NR_lstat64 196 | ||
205 | #define __NR_fstat64 197 | ||
206 | #define __NR_lchown32 198 | ||
207 | #define __NR_getuid32 199 | ||
208 | #define __NR_getgid32 200 | ||
209 | #define __NR_geteuid32 201 | ||
210 | #define __NR_getegid32 202 | ||
211 | #define __NR_setreuid32 203 | ||
212 | #define __NR_setregid32 204 | ||
213 | #define __NR_getgroups32 205 | ||
214 | #define __NR_setgroups32 206 | ||
215 | #define __NR_fchown32 207 | ||
216 | #define __NR_setresuid32 208 | ||
217 | #define __NR_getresuid32 209 | ||
218 | #define __NR_setresgid32 210 | ||
219 | #define __NR_getresgid32 211 | ||
220 | #define __NR_chown32 212 | ||
221 | #define __NR_setuid32 213 | ||
222 | #define __NR_setgid32 214 | ||
223 | #define __NR_setfsuid32 215 | ||
224 | #define __NR_setfsgid32 216 | ||
225 | #define __NR_pivot_root 217 | ||
226 | #define __NR_mincore 218 | ||
227 | #define __NR_madvise 219 | ||
228 | #define __NR_madvise1 219 | ||
229 | #define __NR_getdents64 220 | ||
230 | #define __NR_fcntl64 221 | ||
231 | /* 223 is unused */ | ||
232 | #define __NR_gettid 224 | ||
233 | #define __NR_readahead 225 | ||
234 | #define __NR_setxattr 226 | ||
235 | #define __NR_lsetxattr 227 | ||
236 | #define __NR_fsetxattr 228 | ||
237 | #define __NR_getxattr 229 | ||
238 | #define __NR_lgetxattr 230 | ||
239 | #define __NR_fgetxattr 231 | ||
240 | #define __NR_listxattr 232 | ||
241 | #define __NR_llistxattr 233 | ||
242 | #define __NR_flistxattr 234 | ||
243 | #define __NR_removexattr 235 | ||
244 | #define __NR_lremovexattr 236 | ||
245 | #define __NR_fremovexattr 237 | ||
246 | #define __NR_tkill 238 | ||
247 | #define __NR_sendfile64 239 | ||
248 | #define __NR_futex 240 | ||
249 | #define __NR_sched_setaffinity 241 | ||
250 | #define __NR_sched_getaffinity 242 | ||
251 | #define __NR_set_thread_area 243 | ||
252 | #define __NR_get_thread_area 244 | ||
253 | #define __NR_io_setup 245 | ||
254 | #define __NR_io_destroy 246 | ||
255 | #define __NR_io_getevents 247 | ||
256 | #define __NR_io_submit 248 | ||
257 | #define __NR_io_cancel 249 | ||
258 | #define __NR_fadvise64 250 | ||
259 | /* 251 is available for reuse (was briefly sys_set_zone_reclaim) */ | ||
260 | #define __NR_exit_group 252 | ||
261 | #define __NR_lookup_dcookie 253 | ||
262 | #define __NR_epoll_create 254 | ||
263 | #define __NR_epoll_ctl 255 | ||
264 | #define __NR_epoll_wait 256 | ||
265 | #define __NR_remap_file_pages 257 | ||
266 | #define __NR_set_tid_address 258 | ||
267 | #define __NR_timer_create 259 | ||
268 | #define __NR_timer_settime (__NR_timer_create+1) | ||
269 | #define __NR_timer_gettime (__NR_timer_create+2) | ||
270 | #define __NR_timer_getoverrun (__NR_timer_create+3) | ||
271 | #define __NR_timer_delete (__NR_timer_create+4) | ||
272 | #define __NR_clock_settime (__NR_timer_create+5) | ||
273 | #define __NR_clock_gettime (__NR_timer_create+6) | ||
274 | #define __NR_clock_getres (__NR_timer_create+7) | ||
275 | #define __NR_clock_nanosleep (__NR_timer_create+8) | ||
276 | #define __NR_statfs64 268 | ||
277 | #define __NR_fstatfs64 269 | ||
278 | #define __NR_tgkill 270 | ||
279 | #define __NR_utimes 271 | ||
280 | #define __NR_fadvise64_64 272 | ||
281 | #define __NR_vserver 273 | ||
282 | #define __NR_mbind 274 | ||
283 | #define __NR_get_mempolicy 275 | ||
284 | #define __NR_set_mempolicy 276 | ||
285 | #define __NR_mq_open 277 | ||
286 | #define __NR_mq_unlink (__NR_mq_open+1) | ||
287 | #define __NR_mq_timedsend (__NR_mq_open+2) | ||
288 | #define __NR_mq_timedreceive (__NR_mq_open+3) | ||
289 | #define __NR_mq_notify (__NR_mq_open+4) | ||
290 | #define __NR_mq_getsetattr (__NR_mq_open+5) | ||
291 | #define __NR_kexec_load 283 | ||
292 | #define __NR_waitid 284 | ||
293 | /* #define __NR_sys_setaltroot 285 */ | ||
294 | #define __NR_add_key 286 | ||
295 | #define __NR_request_key 287 | ||
296 | #define __NR_keyctl 288 | ||
297 | #define __NR_ioprio_set 289 | ||
298 | #define __NR_ioprio_get 290 | ||
299 | #define __NR_inotify_init 291 | ||
300 | #define __NR_inotify_add_watch 292 | ||
301 | #define __NR_inotify_rm_watch 293 | ||
302 | #define __NR_migrate_pages 294 | ||
303 | #define __NR_openat 295 | ||
304 | #define __NR_mkdirat 296 | ||
305 | #define __NR_mknodat 297 | ||
306 | #define __NR_fchownat 298 | ||
307 | #define __NR_futimesat 299 | ||
308 | #define __NR_fstatat64 300 | ||
309 | #define __NR_unlinkat 301 | ||
310 | #define __NR_renameat 302 | ||
311 | #define __NR_linkat 303 | ||
312 | #define __NR_symlinkat 304 | ||
313 | #define __NR_readlinkat 305 | ||
314 | #define __NR_fchmodat 306 | ||
315 | #define __NR_faccessat 307 | ||
316 | #define __NR_pselect6 308 | ||
317 | #define __NR_ppoll 309 | ||
318 | #define __NR_unshare 310 | ||
319 | #define __NR_set_robust_list 311 | ||
320 | #define __NR_get_robust_list 312 | ||
321 | #define __NR_splice 313 | ||
322 | #define __NR_sync_file_range 314 | ||
323 | #define __NR_tee 315 | ||
324 | #define __NR_vmsplice 316 | ||
325 | #define __NR_move_pages 317 | ||
326 | #define __NR_getcpu 318 | ||
327 | #define __NR_epoll_pwait 319 | ||
328 | #define __NR_setns 320 | ||
329 | |||
330 | #endif /* _UAPI_ASM_H8300_UNISTD_H_ */ | ||
diff --git a/arch/m32r/include/asm/Kbuild b/arch/m32r/include/asm/Kbuild index 4bc8ae73e08a..bebdc36ebb0a 100644 --- a/arch/m32r/include/asm/Kbuild +++ b/arch/m32r/include/asm/Kbuild | |||
@@ -1,4 +1,3 @@ | |||
1 | include include/asm-generic/Kbuild.asm | ||
2 | 1 | ||
3 | generic-y += clkdev.h | 2 | generic-y += clkdev.h |
4 | generic-y += exec.h | 3 | generic-y += exec.h |
diff --git a/arch/m32r/include/asm/ptrace.h b/arch/m32r/include/asm/ptrace.h index c4432f1fb2cf..ba487c554dbb 100644 --- a/arch/m32r/include/asm/ptrace.h +++ b/arch/m32r/include/asm/ptrace.h | |||
@@ -1,6 +1,3 @@ | |||
1 | #ifndef _ASM_M32R_PTRACE_H | ||
2 | #define _ASM_M32R_PTRACE_H | ||
3 | |||
4 | /* | 1 | /* |
5 | * linux/include/asm-m32r/ptrace.h | 2 | * linux/include/asm-m32r/ptrace.h |
6 | * | 3 | * |
@@ -11,111 +8,12 @@ | |||
11 | * M32R version: | 8 | * M32R version: |
12 | * Copyright (C) 2001-2002, 2004 Hirokazu Takata <takata at linux-m32r.org> | 9 | * Copyright (C) 2001-2002, 2004 Hirokazu Takata <takata at linux-m32r.org> |
13 | */ | 10 | */ |
11 | #ifndef _ASM_M32R_PTRACE_H | ||
12 | #define _ASM_M32R_PTRACE_H | ||
14 | 13 | ||
15 | /* 0 - 13 are integer registers (general purpose registers). */ | ||
16 | #define PT_R4 0 | ||
17 | #define PT_R5 1 | ||
18 | #define PT_R6 2 | ||
19 | #define PT_REGS 3 | ||
20 | #define PT_R0 4 | ||
21 | #define PT_R1 5 | ||
22 | #define PT_R2 6 | ||
23 | #define PT_R3 7 | ||
24 | #define PT_R7 8 | ||
25 | #define PT_R8 9 | ||
26 | #define PT_R9 10 | ||
27 | #define PT_R10 11 | ||
28 | #define PT_R11 12 | ||
29 | #define PT_R12 13 | ||
30 | #define PT_SYSCNR 14 | ||
31 | #define PT_R13 PT_FP | ||
32 | #define PT_R14 PT_LR | ||
33 | #define PT_R15 PT_SP | ||
34 | |||
35 | /* processor status and miscellaneous context registers. */ | ||
36 | #define PT_ACC0H 15 | ||
37 | #define PT_ACC0L 16 | ||
38 | #define PT_ACC1H 17 /* ISA_DSP_LEVEL2 only */ | ||
39 | #define PT_ACC1L 18 /* ISA_DSP_LEVEL2 only */ | ||
40 | #define PT_PSW 19 | ||
41 | #define PT_BPC 20 | ||
42 | #define PT_BBPSW 21 | ||
43 | #define PT_BBPC 22 | ||
44 | #define PT_SPU 23 | ||
45 | #define PT_FP 24 | ||
46 | #define PT_LR 25 | ||
47 | #define PT_SPI 26 | ||
48 | #define PT_ORIGR0 27 | ||
49 | |||
50 | /* virtual pt_reg entry for gdb */ | ||
51 | #define PT_PC 30 | ||
52 | #define PT_CBR 31 | ||
53 | #define PT_EVB 32 | ||
54 | |||
55 | |||
56 | /* Control registers. */ | ||
57 | #define SPR_CR0 PT_PSW | ||
58 | #define SPR_CR1 PT_CBR /* read only */ | ||
59 | #define SPR_CR2 PT_SPI | ||
60 | #define SPR_CR3 PT_SPU | ||
61 | #define SPR_CR4 | ||
62 | #define SPR_CR5 PT_EVB /* part of M32R/E, M32R/I core only */ | ||
63 | #define SPR_CR6 PT_BPC | ||
64 | #define SPR_CR7 | ||
65 | #define SPR_CR8 PT_BBPSW | ||
66 | #define SPR_CR9 | ||
67 | #define SPR_CR10 | ||
68 | #define SPR_CR11 | ||
69 | #define SPR_CR12 | ||
70 | #define SPR_CR13 PT_WR | ||
71 | #define SPR_CR14 PT_BBPC | ||
72 | #define SPR_CR15 | ||
73 | |||
74 | /* this struct defines the way the registers are stored on the | ||
75 | stack during a system call. */ | ||
76 | struct pt_regs { | ||
77 | /* Saved main processor registers. */ | ||
78 | unsigned long r4; | ||
79 | unsigned long r5; | ||
80 | unsigned long r6; | ||
81 | struct pt_regs *pt_regs; | ||
82 | unsigned long r0; | ||
83 | unsigned long r1; | ||
84 | unsigned long r2; | ||
85 | unsigned long r3; | ||
86 | unsigned long r7; | ||
87 | unsigned long r8; | ||
88 | unsigned long r9; | ||
89 | unsigned long r10; | ||
90 | unsigned long r11; | ||
91 | unsigned long r12; | ||
92 | long syscall_nr; | ||
93 | |||
94 | /* Saved main processor status and miscellaneous context registers. */ | ||
95 | unsigned long acc0h; | ||
96 | unsigned long acc0l; | ||
97 | unsigned long acc1h; /* ISA_DSP_LEVEL2 only */ | ||
98 | unsigned long acc1l; /* ISA_DSP_LEVEL2 only */ | ||
99 | unsigned long psw; | ||
100 | unsigned long bpc; /* saved PC for TRAP syscalls */ | ||
101 | unsigned long bbpsw; | ||
102 | unsigned long bbpc; | ||
103 | unsigned long spu; /* saved user stack */ | ||
104 | unsigned long fp; | ||
105 | unsigned long lr; /* saved PC for JL syscalls */ | ||
106 | unsigned long spi; /* saved kernel stack */ | ||
107 | unsigned long orig_r0; | ||
108 | }; | ||
109 | |||
110 | /* Arbitrarily choose the same ptrace numbers as used by the Sparc code. */ | ||
111 | #define PTRACE_GETREGS 12 | ||
112 | #define PTRACE_SETREGS 13 | ||
113 | |||
114 | #define PTRACE_OLDSETOPTIONS 21 | ||
115 | |||
116 | #ifdef __KERNEL__ | ||
117 | 14 | ||
118 | #include <asm/m32r.h> /* M32R_PSW_BSM, M32R_PSW_BPM */ | 15 | #include <asm/m32r.h> /* M32R_PSW_BSM, M32R_PSW_BPM */ |
16 | #include <uapi/asm/ptrace.h> | ||
119 | 17 | ||
120 | #define arch_has_single_step() (1) | 18 | #define arch_has_single_step() (1) |
121 | 19 | ||
@@ -142,6 +40,4 @@ extern void withdraw_debug_trap(struct pt_regs *regs); | |||
142 | #define current_pt_regs() ((struct pt_regs *) \ | 40 | #define current_pt_regs() ((struct pt_regs *) \ |
143 | ((unsigned long)current_thread_info() + THREAD_SIZE) - 1) | 41 | ((unsigned long)current_thread_info() + THREAD_SIZE) - 1) |
144 | 42 | ||
145 | #endif /* __KERNEL */ | ||
146 | |||
147 | #endif /* _ASM_M32R_PTRACE_H */ | 43 | #endif /* _ASM_M32R_PTRACE_H */ |
diff --git a/arch/m32r/include/asm/setup.h b/arch/m32r/include/asm/setup.h index c637ab992394..bbe59a9ce8c6 100644 --- a/arch/m32r/include/asm/setup.h +++ b/arch/m32r/include/asm/setup.h | |||
@@ -1,13 +1,8 @@ | |||
1 | #ifndef _ASM_M32R_SETUP_H | 1 | #ifndef _ASM_M32R_SETUP_H |
2 | #define _ASM_M32R_SETUP_H | 2 | #define _ASM_M32R_SETUP_H |
3 | 3 | ||
4 | /* | 4 | #include <uapi/asm/setup.h> |
5 | * This is set up by the setup-routine at boot-time | ||
6 | */ | ||
7 | 5 | ||
8 | #define COMMAND_LINE_SIZE 512 | ||
9 | |||
10 | #ifdef __KERNEL__ | ||
11 | 6 | ||
12 | #define PARAM ((unsigned char *)empty_zero_page) | 7 | #define PARAM ((unsigned char *)empty_zero_page) |
13 | 8 | ||
@@ -33,6 +28,4 @@ | |||
33 | extern unsigned long memory_start; | 28 | extern unsigned long memory_start; |
34 | extern unsigned long memory_end; | 29 | extern unsigned long memory_end; |
35 | 30 | ||
36 | #endif /* __KERNEL__ */ | ||
37 | |||
38 | #endif /* _ASM_M32R_SETUP_H */ | 31 | #endif /* _ASM_M32R_SETUP_H */ |
diff --git a/arch/m32r/include/asm/signal.h b/arch/m32r/include/asm/signal.h index e4d2e2ad5f1e..a5ba4a217fb9 100644 --- a/arch/m32r/include/asm/signal.h +++ b/arch/m32r/include/asm/signal.h | |||
@@ -1,14 +1,8 @@ | |||
1 | #ifndef _ASM_M32R_SIGNAL_H | 1 | #ifndef _ASM_M32R_SIGNAL_H |
2 | #define _ASM_M32R_SIGNAL_H | 2 | #define _ASM_M32R_SIGNAL_H |
3 | 3 | ||
4 | #include <linux/types.h> | 4 | #include <uapi/asm/signal.h> |
5 | #include <linux/time.h> | ||
6 | #include <linux/compiler.h> | ||
7 | 5 | ||
8 | /* Avoid too many header ordering problems. */ | ||
9 | struct siginfo; | ||
10 | |||
11 | #ifdef __KERNEL__ | ||
12 | /* Most things should be clean enough to redefine this at will, if care | 6 | /* Most things should be clean enough to redefine this at will, if care |
13 | is taken to make libc match. */ | 7 | is taken to make libc match. */ |
14 | 8 | ||
@@ -22,94 +16,6 @@ typedef struct { | |||
22 | unsigned long sig[_NSIG_WORDS]; | 16 | unsigned long sig[_NSIG_WORDS]; |
23 | } sigset_t; | 17 | } sigset_t; |
24 | 18 | ||
25 | #else | ||
26 | /* Here we must cater to libcs that poke about in kernel headers. */ | ||
27 | |||
28 | #define NSIG 32 | ||
29 | typedef unsigned long sigset_t; | ||
30 | |||
31 | #endif /* __KERNEL__ */ | ||
32 | |||
33 | #define SIGHUP 1 | ||
34 | #define SIGINT 2 | ||
35 | #define SIGQUIT 3 | ||
36 | #define SIGILL 4 | ||
37 | #define SIGTRAP 5 | ||
38 | #define SIGABRT 6 | ||
39 | #define SIGIOT 6 | ||
40 | #define SIGBUS 7 | ||
41 | #define SIGFPE 8 | ||
42 | #define SIGKILL 9 | ||
43 | #define SIGUSR1 10 | ||
44 | #define SIGSEGV 11 | ||
45 | #define SIGUSR2 12 | ||
46 | #define SIGPIPE 13 | ||
47 | #define SIGALRM 14 | ||
48 | #define SIGTERM 15 | ||
49 | #define SIGSTKFLT 16 | ||
50 | #define SIGCHLD 17 | ||
51 | #define SIGCONT 18 | ||
52 | #define SIGSTOP 19 | ||
53 | #define SIGTSTP 20 | ||
54 | #define SIGTTIN 21 | ||
55 | #define SIGTTOU 22 | ||
56 | #define SIGURG 23 | ||
57 | #define SIGXCPU 24 | ||
58 | #define SIGXFSZ 25 | ||
59 | #define SIGVTALRM 26 | ||
60 | #define SIGPROF 27 | ||
61 | #define SIGWINCH 28 | ||
62 | #define SIGIO 29 | ||
63 | #define SIGPOLL SIGIO | ||
64 | /* | ||
65 | #define SIGLOST 29 | ||
66 | */ | ||
67 | #define SIGPWR 30 | ||
68 | #define SIGSYS 31 | ||
69 | #define SIGUNUSED 31 | ||
70 | |||
71 | /* These should not be considered constants from userland. */ | ||
72 | #define SIGRTMIN 32 | ||
73 | #define SIGRTMAX _NSIG | ||
74 | |||
75 | /* | ||
76 | * SA_FLAGS values: | ||
77 | * | ||
78 | * SA_ONSTACK indicates that a registered stack_t will be used. | ||
79 | * SA_RESTART flag to get restarting signals (which were the default long ago) | ||
80 | * SA_NOCLDSTOP flag to turn off SIGCHLD when children stop. | ||
81 | * SA_RESETHAND clears the handler when the signal is delivered. | ||
82 | * SA_NOCLDWAIT flag on SIGCHLD to inhibit zombies. | ||
83 | * SA_NODEFER prevents the current signal from being masked in the handler. | ||
84 | * | ||
85 | * SA_ONESHOT and SA_NOMASK are the historical Linux names for the Single | ||
86 | * Unix names RESETHAND and NODEFER respectively. | ||
87 | */ | ||
88 | #define SA_NOCLDSTOP 0x00000001u | ||
89 | #define SA_NOCLDWAIT 0x00000002u | ||
90 | #define SA_SIGINFO 0x00000004u | ||
91 | #define SA_ONSTACK 0x08000000u | ||
92 | #define SA_RESTART 0x10000000u | ||
93 | #define SA_NODEFER 0x40000000u | ||
94 | #define SA_RESETHAND 0x80000000u | ||
95 | |||
96 | #define SA_NOMASK SA_NODEFER | ||
97 | #define SA_ONESHOT SA_RESETHAND | ||
98 | |||
99 | #define SA_RESTORER 0x04000000 | ||
100 | |||
101 | /* | ||
102 | * sigaltstack controls | ||
103 | */ | ||
104 | #define SS_ONSTACK 1 | ||
105 | #define SS_DISABLE 2 | ||
106 | |||
107 | #define MINSIGSTKSZ 2048 | ||
108 | #define SIGSTKSZ 8192 | ||
109 | |||
110 | #include <asm-generic/signal-defs.h> | ||
111 | |||
112 | #ifdef __KERNEL__ | ||
113 | struct sigaction { | 19 | struct sigaction { |
114 | __sighandler_t sa_handler; | 20 | __sighandler_t sa_handler; |
115 | unsigned long sa_flags; | 21 | unsigned long sa_flags; |
@@ -120,35 +26,8 @@ struct sigaction { | |||
120 | struct k_sigaction { | 26 | struct k_sigaction { |
121 | struct sigaction sa; | 27 | struct sigaction sa; |
122 | }; | 28 | }; |
123 | #else | ||
124 | /* Here we must cater to libcs that poke about in kernel headers. */ | ||
125 | |||
126 | struct sigaction { | ||
127 | union { | ||
128 | __sighandler_t _sa_handler; | ||
129 | void (*_sa_sigaction)(int, struct siginfo *, void *); | ||
130 | } _u; | ||
131 | sigset_t sa_mask; | ||
132 | unsigned long sa_flags; | ||
133 | void (*sa_restorer)(void); | ||
134 | }; | ||
135 | |||
136 | #define sa_handler _u._sa_handler | ||
137 | #define sa_sigaction _u._sa_sigaction | ||
138 | |||
139 | #endif /* __KERNEL__ */ | ||
140 | |||
141 | typedef struct sigaltstack { | ||
142 | void __user *ss_sp; | ||
143 | int ss_flags; | ||
144 | size_t ss_size; | ||
145 | } stack_t; | ||
146 | |||
147 | #ifdef __KERNEL__ | ||
148 | #include <asm/sigcontext.h> | 29 | #include <asm/sigcontext.h> |
149 | 30 | ||
150 | #undef __HAVE_ARCH_SIG_BITOPS | 31 | #undef __HAVE_ARCH_SIG_BITOPS |
151 | 32 | ||
152 | #endif /* __KERNEL__ */ | ||
153 | |||
154 | #endif /* _ASM_M32R_SIGNAL_H */ | 33 | #endif /* _ASM_M32R_SIGNAL_H */ |
diff --git a/arch/m32r/include/asm/termios.h b/arch/m32r/include/asm/termios.h index 93ce79fd342a..680898f0b3d6 100644 --- a/arch/m32r/include/asm/termios.h +++ b/arch/m32r/include/asm/termios.h | |||
@@ -1,46 +1,8 @@ | |||
1 | #ifndef _M32R_TERMIOS_H | 1 | #ifndef _M32R_TERMIOS_H |
2 | #define _M32R_TERMIOS_H | 2 | #define _M32R_TERMIOS_H |
3 | 3 | ||
4 | #include <asm/termbits.h> | ||
5 | #include <asm/ioctls.h> | ||
6 | |||
7 | struct winsize { | ||
8 | unsigned short ws_row; | ||
9 | unsigned short ws_col; | ||
10 | unsigned short ws_xpixel; | ||
11 | unsigned short ws_ypixel; | ||
12 | }; | ||
13 | |||
14 | #define NCC 8 | ||
15 | struct termio { | ||
16 | unsigned short c_iflag; /* input mode flags */ | ||
17 | unsigned short c_oflag; /* output mode flags */ | ||
18 | unsigned short c_cflag; /* control mode flags */ | ||
19 | unsigned short c_lflag; /* local mode flags */ | ||
20 | unsigned char c_line; /* line discipline */ | ||
21 | unsigned char c_cc[NCC]; /* control characters */ | ||
22 | }; | ||
23 | |||
24 | /* modem lines */ | ||
25 | #define TIOCM_LE 0x001 | ||
26 | #define TIOCM_DTR 0x002 | ||
27 | #define TIOCM_RTS 0x004 | ||
28 | #define TIOCM_ST 0x008 | ||
29 | #define TIOCM_SR 0x010 | ||
30 | #define TIOCM_CTS 0x020 | ||
31 | #define TIOCM_CAR 0x040 | ||
32 | #define TIOCM_RNG 0x080 | ||
33 | #define TIOCM_DSR 0x100 | ||
34 | #define TIOCM_CD TIOCM_CAR | ||
35 | #define TIOCM_RI TIOCM_RNG | ||
36 | #define TIOCM_OUT1 0x2000 | ||
37 | #define TIOCM_OUT2 0x4000 | ||
38 | #define TIOCM_LOOP 0x8000 | ||
39 | |||
40 | /* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */ | ||
41 | |||
42 | #ifdef __KERNEL__ | ||
43 | #include <linux/module.h> | 4 | #include <linux/module.h> |
5 | #include <uapi/asm/termios.h> | ||
44 | 6 | ||
45 | /* intr=^C quit=^\ erase=del kill=^U | 7 | /* intr=^C quit=^\ erase=del kill=^U |
46 | eof=^D vtime=\0 vmin=\1 sxtc=\0 | 8 | eof=^D vtime=\0 vmin=\1 sxtc=\0 |
@@ -86,6 +48,4 @@ struct termio { | |||
86 | #define user_termios_to_kernel_termios_1(k, u) copy_from_user(k, u, sizeof(struct termios)) | 48 | #define user_termios_to_kernel_termios_1(k, u) copy_from_user(k, u, sizeof(struct termios)) |
87 | #define kernel_termios_to_user_termios_1(u, k) copy_to_user(u, k, sizeof(struct termios)) | 49 | #define kernel_termios_to_user_termios_1(u, k) copy_to_user(u, k, sizeof(struct termios)) |
88 | 50 | ||
89 | #endif /* __KERNEL__ */ | ||
90 | |||
91 | #endif /* _M32R_TERMIOS_H */ | 51 | #endif /* _M32R_TERMIOS_H */ |
diff --git a/arch/m32r/include/asm/types.h b/arch/m32r/include/asm/types.h index bb2eeadecf99..04a44c6ee34d 100644 --- a/arch/m32r/include/asm/types.h +++ b/arch/m32r/include/asm/types.h | |||
@@ -1,15 +1,12 @@ | |||
1 | #ifndef _ASM_M32R_TYPES_H | 1 | #ifndef _ASM_M32R_TYPES_H |
2 | #define _ASM_M32R_TYPES_H | 2 | #define _ASM_M32R_TYPES_H |
3 | 3 | ||
4 | #include <asm-generic/int-ll64.h> | 4 | #include <uapi/asm/types.h> |
5 | 5 | ||
6 | /* | 6 | /* |
7 | * These aren't exported outside the kernel to avoid name space clashes | 7 | * These aren't exported outside the kernel to avoid name space clashes |
8 | */ | 8 | */ |
9 | #ifdef __KERNEL__ | ||
10 | 9 | ||
11 | #define BITS_PER_LONG 32 | 10 | #define BITS_PER_LONG 32 |
12 | 11 | ||
13 | #endif /* __KERNEL__ */ | ||
14 | |||
15 | #endif /* _ASM_M32R_TYPES_H */ | 12 | #endif /* _ASM_M32R_TYPES_H */ |
diff --git a/arch/m32r/include/asm/unistd.h b/arch/m32r/include/asm/unistd.h index d9e7351af2a4..1eade32082b8 100644 --- a/arch/m32r/include/asm/unistd.h +++ b/arch/m32r/include/asm/unistd.h | |||
@@ -1,338 +1,8 @@ | |||
1 | #ifndef _ASM_M32R_UNISTD_H | 1 | #ifndef _ASM_M32R_UNISTD_H |
2 | #define _ASM_M32R_UNISTD_H | 2 | #define _ASM_M32R_UNISTD_H |
3 | 3 | ||
4 | /* | 4 | #include <uapi/asm/unistd.h> |
5 | * This file contains the system call numbers. | ||
6 | */ | ||
7 | |||
8 | #define __NR_restart_syscall 0 | ||
9 | #define __NR_exit 1 | ||
10 | #define __NR_fork 2 | ||
11 | #define __NR_read 3 | ||
12 | #define __NR_write 4 | ||
13 | #define __NR_open 5 | ||
14 | #define __NR_close 6 | ||
15 | #define __NR_waitpid 7 | ||
16 | #define __NR_creat 8 | ||
17 | #define __NR_link 9 | ||
18 | #define __NR_unlink 10 | ||
19 | #define __NR_execve 11 | ||
20 | #define __NR_chdir 12 | ||
21 | #define __NR_time 13 | ||
22 | #define __NR_mknod 14 | ||
23 | #define __NR_chmod 15 | ||
24 | /* 16 is unused */ | ||
25 | /* 17 is unused */ | ||
26 | /* 18 is unused */ | ||
27 | #define __NR_lseek 19 | ||
28 | #define __NR_getpid 20 | ||
29 | #define __NR_mount 21 | ||
30 | #define __NR_umount 22 | ||
31 | /* 23 is unused */ | ||
32 | /* 24 is unused */ | ||
33 | #define __NR_stime 25 | ||
34 | #define __NR_ptrace 26 | ||
35 | #define __NR_alarm 27 | ||
36 | /* 28 is unused */ | ||
37 | #define __NR_pause 29 | ||
38 | #define __NR_utime 30 | ||
39 | /* 31 is unused */ | ||
40 | #define __NR_cachectl 32 /* old #define __NR_gtty 32*/ | ||
41 | #define __NR_access 33 | ||
42 | /* 34 is unused */ | ||
43 | /* 35 is unused */ | ||
44 | #define __NR_sync 36 | ||
45 | #define __NR_kill 37 | ||
46 | #define __NR_rename 38 | ||
47 | #define __NR_mkdir 39 | ||
48 | #define __NR_rmdir 40 | ||
49 | #define __NR_dup 41 | ||
50 | #define __NR_pipe 42 | ||
51 | #define __NR_times 43 | ||
52 | /* 44 is unused */ | ||
53 | #define __NR_brk 45 | ||
54 | /* 46 is unused */ | ||
55 | /* 47 is unused (getgid16) */ | ||
56 | /* 48 is unused */ | ||
57 | /* 49 is unused */ | ||
58 | /* 50 is unused */ | ||
59 | #define __NR_acct 51 | ||
60 | #define __NR_umount2 52 | ||
61 | /* 53 is unused */ | ||
62 | #define __NR_ioctl 54 | ||
63 | /* 55 is unused (fcntl) */ | ||
64 | /* 56 is unused */ | ||
65 | #define __NR_setpgid 57 | ||
66 | /* 58 is unused */ | ||
67 | /* 59 is unused */ | ||
68 | #define __NR_umask 60 | ||
69 | #define __NR_chroot 61 | ||
70 | #define __NR_ustat 62 | ||
71 | #define __NR_dup2 63 | ||
72 | #define __NR_getppid 64 | ||
73 | #define __NR_getpgrp 65 | ||
74 | #define __NR_setsid 66 | ||
75 | /* 67 is unused */ | ||
76 | /* 68 is unused*/ | ||
77 | /* 69 is unused*/ | ||
78 | /* 70 is unused */ | ||
79 | /* 71 is unused */ | ||
80 | /* 72 is unused */ | ||
81 | /* 73 is unused */ | ||
82 | #define __NR_sethostname 74 | ||
83 | #define __NR_setrlimit 75 | ||
84 | /* 76 is unused (old getrlimit) */ | ||
85 | #define __NR_getrusage 77 | ||
86 | #define __NR_gettimeofday 78 | ||
87 | #define __NR_settimeofday 79 | ||
88 | /* 80 is unused */ | ||
89 | /* 81 is unused */ | ||
90 | /* 82 is unused */ | ||
91 | #define __NR_symlink 83 | ||
92 | /* 84 is unused */ | ||
93 | #define __NR_readlink 85 | ||
94 | #define __NR_uselib 86 | ||
95 | #define __NR_swapon 87 | ||
96 | #define __NR_reboot 88 | ||
97 | /* 89 is unused */ | ||
98 | /* 90 is unused */ | ||
99 | #define __NR_munmap 91 | ||
100 | #define __NR_truncate 92 | ||
101 | #define __NR_ftruncate 93 | ||
102 | #define __NR_fchmod 94 | ||
103 | /* 95 is unused */ | ||
104 | #define __NR_getpriority 96 | ||
105 | #define __NR_setpriority 97 | ||
106 | /* 98 is unused */ | ||
107 | #define __NR_statfs 99 | ||
108 | #define __NR_fstatfs 100 | ||
109 | /* 101 is unused */ | ||
110 | #define __NR_socketcall 102 | ||
111 | #define __NR_syslog 103 | ||
112 | #define __NR_setitimer 104 | ||
113 | #define __NR_getitimer 105 | ||
114 | #define __NR_stat 106 | ||
115 | #define __NR_lstat 107 | ||
116 | #define __NR_fstat 108 | ||
117 | /* 109 is unused */ | ||
118 | /* 110 is unused */ | ||
119 | #define __NR_vhangup 111 | ||
120 | /* 112 is unused */ | ||
121 | /* 113 is unused */ | ||
122 | #define __NR_wait4 114 | ||
123 | #define __NR_swapoff 115 | ||
124 | #define __NR_sysinfo 116 | ||
125 | #define __NR_ipc 117 | ||
126 | #define __NR_fsync 118 | ||
127 | /* 119 is unused */ | ||
128 | #define __NR_clone 120 | ||
129 | #define __NR_setdomainname 121 | ||
130 | #define __NR_uname 122 | ||
131 | /* 123 is unused */ | ||
132 | #define __NR_adjtimex 124 | ||
133 | #define __NR_mprotect 125 | ||
134 | /* 126 is unused */ | ||
135 | /* 127 is unused */ | ||
136 | #define __NR_init_module 128 | ||
137 | #define __NR_delete_module 129 | ||
138 | /* 130 is unused */ | ||
139 | #define __NR_quotactl 131 | ||
140 | #define __NR_getpgid 132 | ||
141 | #define __NR_fchdir 133 | ||
142 | #define __NR_bdflush 134 | ||
143 | #define __NR_sysfs 135 | ||
144 | #define __NR_personality 136 | ||
145 | /* 137 is unused */ | ||
146 | /* 138 is unused */ | ||
147 | /* 139 is unused */ | ||
148 | #define __NR__llseek 140 | ||
149 | #define __NR_getdents 141 | ||
150 | #define __NR__newselect 142 | ||
151 | #define __NR_flock 143 | ||
152 | #define __NR_msync 144 | ||
153 | #define __NR_readv 145 | ||
154 | #define __NR_writev 146 | ||
155 | #define __NR_getsid 147 | ||
156 | #define __NR_fdatasync 148 | ||
157 | #define __NR__sysctl 149 | ||
158 | #define __NR_mlock 150 | ||
159 | #define __NR_munlock 151 | ||
160 | #define __NR_mlockall 152 | ||
161 | #define __NR_munlockall 153 | ||
162 | #define __NR_sched_setparam 154 | ||
163 | #define __NR_sched_getparam 155 | ||
164 | #define __NR_sched_setscheduler 156 | ||
165 | #define __NR_sched_getscheduler 157 | ||
166 | #define __NR_sched_yield 158 | ||
167 | #define __NR_sched_get_priority_max 159 | ||
168 | #define __NR_sched_get_priority_min 160 | ||
169 | #define __NR_sched_rr_get_interval 161 | ||
170 | #define __NR_nanosleep 162 | ||
171 | #define __NR_mremap 163 | ||
172 | /* 164 is unused */ | ||
173 | /* 165 is unused */ | ||
174 | #define __NR_tas 166 | ||
175 | /* 167 is unused */ | ||
176 | #define __NR_poll 168 | ||
177 | #define __NR_nfsservctl 169 | ||
178 | /* 170 is unused */ | ||
179 | /* 171 is unused */ | ||
180 | #define __NR_prctl 172 | ||
181 | #define __NR_rt_sigreturn 173 | ||
182 | #define __NR_rt_sigaction 174 | ||
183 | #define __NR_rt_sigprocmask 175 | ||
184 | #define __NR_rt_sigpending 176 | ||
185 | #define __NR_rt_sigtimedwait 177 | ||
186 | #define __NR_rt_sigqueueinfo 178 | ||
187 | #define __NR_rt_sigsuspend 179 | ||
188 | #define __NR_pread64 180 | ||
189 | #define __NR_pwrite64 181 | ||
190 | /* 182 is unused */ | ||
191 | #define __NR_getcwd 183 | ||
192 | #define __NR_capget 184 | ||
193 | #define __NR_capset 185 | ||
194 | #define __NR_sigaltstack 186 | ||
195 | #define __NR_sendfile 187 | ||
196 | /* 188 is unused */ | ||
197 | /* 189 is unused */ | ||
198 | #define __NR_vfork 190 | ||
199 | #define __NR_ugetrlimit 191 /* SuS compliant getrlimit */ | ||
200 | #define __NR_mmap2 192 | ||
201 | #define __NR_truncate64 193 | ||
202 | #define __NR_ftruncate64 194 | ||
203 | #define __NR_stat64 195 | ||
204 | #define __NR_lstat64 196 | ||
205 | #define __NR_fstat64 197 | ||
206 | #define __NR_lchown32 198 | ||
207 | #define __NR_getuid32 199 | ||
208 | #define __NR_getgid32 200 | ||
209 | #define __NR_geteuid32 201 | ||
210 | #define __NR_getegid32 202 | ||
211 | #define __NR_setreuid32 203 | ||
212 | #define __NR_setregid32 204 | ||
213 | #define __NR_getgroups32 205 | ||
214 | #define __NR_setgroups32 206 | ||
215 | #define __NR_fchown32 207 | ||
216 | #define __NR_setresuid32 208 | ||
217 | #define __NR_getresuid32 209 | ||
218 | #define __NR_setresgid32 210 | ||
219 | #define __NR_getresgid32 211 | ||
220 | #define __NR_chown32 212 | ||
221 | #define __NR_setuid32 213 | ||
222 | #define __NR_setgid32 214 | ||
223 | #define __NR_setfsuid32 215 | ||
224 | #define __NR_setfsgid32 216 | ||
225 | #define __NR_pivot_root 217 | ||
226 | #define __NR_mincore 218 | ||
227 | #define __NR_madvise 219 | ||
228 | #define __NR_getdents64 220 | ||
229 | #define __NR_fcntl64 221 | ||
230 | /* 222 is unused */ | ||
231 | /* 223 is unused */ | ||
232 | #define __NR_gettid 224 | ||
233 | #define __NR_readahead 225 | ||
234 | #define __NR_setxattr 226 | ||
235 | #define __NR_lsetxattr 227 | ||
236 | #define __NR_fsetxattr 228 | ||
237 | #define __NR_getxattr 229 | ||
238 | #define __NR_lgetxattr 230 | ||
239 | #define __NR_fgetxattr 231 | ||
240 | #define __NR_listxattr 232 | ||
241 | #define __NR_llistxattr 233 | ||
242 | #define __NR_flistxattr 234 | ||
243 | #define __NR_removexattr 235 | ||
244 | #define __NR_lremovexattr 236 | ||
245 | #define __NR_fremovexattr 237 | ||
246 | #define __NR_tkill 238 | ||
247 | #define __NR_sendfile64 239 | ||
248 | #define __NR_futex 240 | ||
249 | #define __NR_sched_setaffinity 241 | ||
250 | #define __NR_sched_getaffinity 242 | ||
251 | #define __NR_set_thread_area 243 | ||
252 | #define __NR_get_thread_area 244 | ||
253 | #define __NR_io_setup 245 | ||
254 | #define __NR_io_destroy 246 | ||
255 | #define __NR_io_getevents 247 | ||
256 | #define __NR_io_submit 248 | ||
257 | #define __NR_io_cancel 249 | ||
258 | #define __NR_fadvise64 250 | ||
259 | /* 251 is unused */ | ||
260 | #define __NR_exit_group 252 | ||
261 | #define __NR_lookup_dcookie 253 | ||
262 | #define __NR_epoll_create 254 | ||
263 | #define __NR_epoll_ctl 255 | ||
264 | #define __NR_epoll_wait 256 | ||
265 | #define __NR_remap_file_pages 257 | ||
266 | #define __NR_set_tid_address 258 | ||
267 | #define __NR_timer_create 259 | ||
268 | #define __NR_timer_settime (__NR_timer_create+1) | ||
269 | #define __NR_timer_gettime (__NR_timer_create+2) | ||
270 | #define __NR_timer_getoverrun (__NR_timer_create+3) | ||
271 | #define __NR_timer_delete (__NR_timer_create+4) | ||
272 | #define __NR_clock_settime (__NR_timer_create+5) | ||
273 | #define __NR_clock_gettime (__NR_timer_create+6) | ||
274 | #define __NR_clock_getres (__NR_timer_create+7) | ||
275 | #define __NR_clock_nanosleep (__NR_timer_create+8) | ||
276 | #define __NR_statfs64 268 | ||
277 | #define __NR_fstatfs64 269 | ||
278 | #define __NR_tgkill 270 | ||
279 | #define __NR_utimes 271 | ||
280 | #define __NR_fadvise64_64 272 | ||
281 | #define __NR_vserver 273 | ||
282 | #define __NR_mbind 274 | ||
283 | #define __NR_get_mempolicy 275 | ||
284 | #define __NR_set_mempolicy 276 | ||
285 | #define __NR_mq_open 277 | ||
286 | #define __NR_mq_unlink (__NR_mq_open+1) | ||
287 | #define __NR_mq_timedsend (__NR_mq_open+2) | ||
288 | #define __NR_mq_timedreceive (__NR_mq_open+3) | ||
289 | #define __NR_mq_notify (__NR_mq_open+4) | ||
290 | #define __NR_mq_getsetattr (__NR_mq_open+5) | ||
291 | #define __NR_kexec_load 283 | ||
292 | #define __NR_waitid 284 | ||
293 | /* 285 is unused */ | ||
294 | #define __NR_add_key 286 | ||
295 | #define __NR_request_key 287 | ||
296 | #define __NR_keyctl 288 | ||
297 | #define __NR_ioprio_set 289 | ||
298 | #define __NR_ioprio_get 290 | ||
299 | #define __NR_inotify_init 291 | ||
300 | #define __NR_inotify_add_watch 292 | ||
301 | #define __NR_inotify_rm_watch 293 | ||
302 | #define __NR_migrate_pages 294 | ||
303 | #define __NR_openat 295 | ||
304 | #define __NR_mkdirat 296 | ||
305 | #define __NR_mknodat 297 | ||
306 | #define __NR_fchownat 298 | ||
307 | #define __NR_futimesat 299 | ||
308 | #define __NR_fstatat64 300 | ||
309 | #define __NR_unlinkat 301 | ||
310 | #define __NR_renameat 302 | ||
311 | #define __NR_linkat 303 | ||
312 | #define __NR_symlinkat 304 | ||
313 | #define __NR_readlinkat 305 | ||
314 | #define __NR_fchmodat 306 | ||
315 | #define __NR_faccessat 307 | ||
316 | #define __NR_pselect6 308 | ||
317 | #define __NR_ppoll 309 | ||
318 | #define __NR_unshare 310 | ||
319 | #define __NR_set_robust_list 311 | ||
320 | #define __NR_get_robust_list 312 | ||
321 | #define __NR_splice 313 | ||
322 | #define __NR_sync_file_range 314 | ||
323 | #define __NR_tee 315 | ||
324 | #define __NR_vmsplice 316 | ||
325 | #define __NR_move_pages 317 | ||
326 | #define __NR_getcpu 318 | ||
327 | #define __NR_epoll_pwait 319 | ||
328 | #define __NR_utimensat 320 | ||
329 | #define __NR_signalfd 321 | ||
330 | /* #define __NR_timerfd 322 removed */ | ||
331 | #define __NR_eventfd 323 | ||
332 | #define __NR_fallocate 324 | ||
333 | #define __NR_setns 325 | ||
334 | 5 | ||
335 | #ifdef __KERNEL__ | ||
336 | 6 | ||
337 | #define NR_syscalls 326 | 7 | #define NR_syscalls 326 |
338 | 8 | ||
@@ -391,5 +61,4 @@ | |||
391 | #define cond_syscall(x) asm(".weak\t" #x "\n\t.set\t" #x ",sys_ni_syscall") | 61 | #define cond_syscall(x) asm(".weak\t" #x "\n\t.set\t" #x ",sys_ni_syscall") |
392 | #endif | 62 | #endif |
393 | 63 | ||
394 | #endif /* __KERNEL__ */ | ||
395 | #endif /* _ASM_M32R_UNISTD_H */ | 64 | #endif /* _ASM_M32R_UNISTD_H */ |
diff --git a/arch/m32r/include/uapi/asm/Kbuild b/arch/m32r/include/uapi/asm/Kbuild index baebb3da1d44..43937a61d6cf 100644 --- a/arch/m32r/include/uapi/asm/Kbuild +++ b/arch/m32r/include/uapi/asm/Kbuild | |||
@@ -1,3 +1,33 @@ | |||
1 | # UAPI Header export list | 1 | # UAPI Header export list |
2 | include include/uapi/asm-generic/Kbuild.asm | 2 | include include/uapi/asm-generic/Kbuild.asm |
3 | 3 | ||
4 | header-y += auxvec.h | ||
5 | header-y += bitsperlong.h | ||
6 | header-y += byteorder.h | ||
7 | header-y += errno.h | ||
8 | header-y += fcntl.h | ||
9 | header-y += ioctl.h | ||
10 | header-y += ioctls.h | ||
11 | header-y += ipcbuf.h | ||
12 | header-y += mman.h | ||
13 | header-y += msgbuf.h | ||
14 | header-y += param.h | ||
15 | header-y += poll.h | ||
16 | header-y += posix_types.h | ||
17 | header-y += ptrace.h | ||
18 | header-y += resource.h | ||
19 | header-y += sembuf.h | ||
20 | header-y += setup.h | ||
21 | header-y += shmbuf.h | ||
22 | header-y += sigcontext.h | ||
23 | header-y += siginfo.h | ||
24 | header-y += signal.h | ||
25 | header-y += socket.h | ||
26 | header-y += sockios.h | ||
27 | header-y += stat.h | ||
28 | header-y += statfs.h | ||
29 | header-y += swab.h | ||
30 | header-y += termbits.h | ||
31 | header-y += termios.h | ||
32 | header-y += types.h | ||
33 | header-y += unistd.h | ||
diff --git a/arch/m32r/include/asm/auxvec.h b/arch/m32r/include/uapi/asm/auxvec.h index f76dcc860fae..f76dcc860fae 100644 --- a/arch/m32r/include/asm/auxvec.h +++ b/arch/m32r/include/uapi/asm/auxvec.h | |||
diff --git a/arch/m32r/include/asm/bitsperlong.h b/arch/m32r/include/uapi/asm/bitsperlong.h index 6dc0bb0c13b2..6dc0bb0c13b2 100644 --- a/arch/m32r/include/asm/bitsperlong.h +++ b/arch/m32r/include/uapi/asm/bitsperlong.h | |||
diff --git a/arch/m32r/include/asm/byteorder.h b/arch/m32r/include/uapi/asm/byteorder.h index 21855d8b028b..21855d8b028b 100644 --- a/arch/m32r/include/asm/byteorder.h +++ b/arch/m32r/include/uapi/asm/byteorder.h | |||
diff --git a/arch/m32r/include/asm/errno.h b/arch/m32r/include/uapi/asm/errno.h index 777149262aad..777149262aad 100644 --- a/arch/m32r/include/asm/errno.h +++ b/arch/m32r/include/uapi/asm/errno.h | |||
diff --git a/arch/m32r/include/asm/fcntl.h b/arch/m32r/include/uapi/asm/fcntl.h index 46ab12db5739..46ab12db5739 100644 --- a/arch/m32r/include/asm/fcntl.h +++ b/arch/m32r/include/uapi/asm/fcntl.h | |||
diff --git a/arch/m32r/include/asm/ioctl.h b/arch/m32r/include/uapi/asm/ioctl.h index b279fe06dfe5..b279fe06dfe5 100644 --- a/arch/m32r/include/asm/ioctl.h +++ b/arch/m32r/include/uapi/asm/ioctl.h | |||
diff --git a/arch/m32r/include/asm/ioctls.h b/arch/m32r/include/uapi/asm/ioctls.h index 349bf87bfbd0..349bf87bfbd0 100644 --- a/arch/m32r/include/asm/ioctls.h +++ b/arch/m32r/include/uapi/asm/ioctls.h | |||
diff --git a/arch/m32r/include/asm/ipcbuf.h b/arch/m32r/include/uapi/asm/ipcbuf.h index 84c7e51cb6d0..84c7e51cb6d0 100644 --- a/arch/m32r/include/asm/ipcbuf.h +++ b/arch/m32r/include/uapi/asm/ipcbuf.h | |||
diff --git a/arch/m32r/include/asm/mman.h b/arch/m32r/include/uapi/asm/mman.h index 8eebf89f5ab1..8eebf89f5ab1 100644 --- a/arch/m32r/include/asm/mman.h +++ b/arch/m32r/include/uapi/asm/mman.h | |||
diff --git a/arch/m32r/include/asm/msgbuf.h b/arch/m32r/include/uapi/asm/msgbuf.h index 0d5a877b813e..0d5a877b813e 100644 --- a/arch/m32r/include/asm/msgbuf.h +++ b/arch/m32r/include/uapi/asm/msgbuf.h | |||
diff --git a/arch/m32r/include/asm/param.h b/arch/m32r/include/uapi/asm/param.h index fa207bdf96e7..fa207bdf96e7 100644 --- a/arch/m32r/include/asm/param.h +++ b/arch/m32r/include/uapi/asm/param.h | |||
diff --git a/arch/m32r/include/asm/poll.h b/arch/m32r/include/uapi/asm/poll.h index c98509d3149e..c98509d3149e 100644 --- a/arch/m32r/include/asm/poll.h +++ b/arch/m32r/include/uapi/asm/poll.h | |||
diff --git a/arch/m32r/include/asm/posix_types.h b/arch/m32r/include/uapi/asm/posix_types.h index 236de26a409b..236de26a409b 100644 --- a/arch/m32r/include/asm/posix_types.h +++ b/arch/m32r/include/uapi/asm/posix_types.h | |||
diff --git a/arch/m32r/include/uapi/asm/ptrace.h b/arch/m32r/include/uapi/asm/ptrace.h new file mode 100644 index 000000000000..f6930a822517 --- /dev/null +++ b/arch/m32r/include/uapi/asm/ptrace.h | |||
@@ -0,0 +1,117 @@ | |||
1 | /* | ||
2 | * linux/include/asm-m32r/ptrace.h | ||
3 | * | ||
4 | * This file is subject to the terms and conditions of the GNU General Public | ||
5 | * License. See the file "COPYING" in the main directory of this archive | ||
6 | * for more details. | ||
7 | * | ||
8 | * M32R version: | ||
9 | * Copyright (C) 2001-2002, 2004 Hirokazu Takata <takata at linux-m32r.org> | ||
10 | */ | ||
11 | #ifndef _UAPI_ASM_M32R_PTRACE_H | ||
12 | #define _UAPI_ASM_M32R_PTRACE_H | ||
13 | |||
14 | |||
15 | /* 0 - 13 are integer registers (general purpose registers). */ | ||
16 | #define PT_R4 0 | ||
17 | #define PT_R5 1 | ||
18 | #define PT_R6 2 | ||
19 | #define PT_REGS 3 | ||
20 | #define PT_R0 4 | ||
21 | #define PT_R1 5 | ||
22 | #define PT_R2 6 | ||
23 | #define PT_R3 7 | ||
24 | #define PT_R7 8 | ||
25 | #define PT_R8 9 | ||
26 | #define PT_R9 10 | ||
27 | #define PT_R10 11 | ||
28 | #define PT_R11 12 | ||
29 | #define PT_R12 13 | ||
30 | #define PT_SYSCNR 14 | ||
31 | #define PT_R13 PT_FP | ||
32 | #define PT_R14 PT_LR | ||
33 | #define PT_R15 PT_SP | ||
34 | |||
35 | /* processor status and miscellaneous context registers. */ | ||
36 | #define PT_ACC0H 15 | ||
37 | #define PT_ACC0L 16 | ||
38 | #define PT_ACC1H 17 /* ISA_DSP_LEVEL2 only */ | ||
39 | #define PT_ACC1L 18 /* ISA_DSP_LEVEL2 only */ | ||
40 | #define PT_PSW 19 | ||
41 | #define PT_BPC 20 | ||
42 | #define PT_BBPSW 21 | ||
43 | #define PT_BBPC 22 | ||
44 | #define PT_SPU 23 | ||
45 | #define PT_FP 24 | ||
46 | #define PT_LR 25 | ||
47 | #define PT_SPI 26 | ||
48 | #define PT_ORIGR0 27 | ||
49 | |||
50 | /* virtual pt_reg entry for gdb */ | ||
51 | #define PT_PC 30 | ||
52 | #define PT_CBR 31 | ||
53 | #define PT_EVB 32 | ||
54 | |||
55 | |||
56 | /* Control registers. */ | ||
57 | #define SPR_CR0 PT_PSW | ||
58 | #define SPR_CR1 PT_CBR /* read only */ | ||
59 | #define SPR_CR2 PT_SPI | ||
60 | #define SPR_CR3 PT_SPU | ||
61 | #define SPR_CR4 | ||
62 | #define SPR_CR5 PT_EVB /* part of M32R/E, M32R/I core only */ | ||
63 | #define SPR_CR6 PT_BPC | ||
64 | #define SPR_CR7 | ||
65 | #define SPR_CR8 PT_BBPSW | ||
66 | #define SPR_CR9 | ||
67 | #define SPR_CR10 | ||
68 | #define SPR_CR11 | ||
69 | #define SPR_CR12 | ||
70 | #define SPR_CR13 PT_WR | ||
71 | #define SPR_CR14 PT_BBPC | ||
72 | #define SPR_CR15 | ||
73 | |||
74 | /* this struct defines the way the registers are stored on the | ||
75 | stack during a system call. */ | ||
76 | struct pt_regs { | ||
77 | /* Saved main processor registers. */ | ||
78 | unsigned long r4; | ||
79 | unsigned long r5; | ||
80 | unsigned long r6; | ||
81 | struct pt_regs *pt_regs; | ||
82 | unsigned long r0; | ||
83 | unsigned long r1; | ||
84 | unsigned long r2; | ||
85 | unsigned long r3; | ||
86 | unsigned long r7; | ||
87 | unsigned long r8; | ||
88 | unsigned long r9; | ||
89 | unsigned long r10; | ||
90 | unsigned long r11; | ||
91 | unsigned long r12; | ||
92 | long syscall_nr; | ||
93 | |||
94 | /* Saved main processor status and miscellaneous context registers. */ | ||
95 | unsigned long acc0h; | ||
96 | unsigned long acc0l; | ||
97 | unsigned long acc1h; /* ISA_DSP_LEVEL2 only */ | ||
98 | unsigned long acc1l; /* ISA_DSP_LEVEL2 only */ | ||
99 | unsigned long psw; | ||
100 | unsigned long bpc; /* saved PC for TRAP syscalls */ | ||
101 | unsigned long bbpsw; | ||
102 | unsigned long bbpc; | ||
103 | unsigned long spu; /* saved user stack */ | ||
104 | unsigned long fp; | ||
105 | unsigned long lr; /* saved PC for JL syscalls */ | ||
106 | unsigned long spi; /* saved kernel stack */ | ||
107 | unsigned long orig_r0; | ||
108 | }; | ||
109 | |||
110 | /* Arbitrarily choose the same ptrace numbers as used by the Sparc code. */ | ||
111 | #define PTRACE_GETREGS 12 | ||
112 | #define PTRACE_SETREGS 13 | ||
113 | |||
114 | #define PTRACE_OLDSETOPTIONS 21 | ||
115 | |||
116 | |||
117 | #endif /* _UAPI_ASM_M32R_PTRACE_H */ | ||
diff --git a/arch/m32r/include/asm/resource.h b/arch/m32r/include/uapi/asm/resource.h index b1ce766e37a0..b1ce766e37a0 100644 --- a/arch/m32r/include/asm/resource.h +++ b/arch/m32r/include/uapi/asm/resource.h | |||
diff --git a/arch/m32r/include/asm/sembuf.h b/arch/m32r/include/uapi/asm/sembuf.h index c9873d6890e2..c9873d6890e2 100644 --- a/arch/m32r/include/asm/sembuf.h +++ b/arch/m32r/include/uapi/asm/sembuf.h | |||
diff --git a/arch/m32r/include/uapi/asm/setup.h b/arch/m32r/include/uapi/asm/setup.h new file mode 100644 index 000000000000..96961a42e5f4 --- /dev/null +++ b/arch/m32r/include/uapi/asm/setup.h | |||
@@ -0,0 +1,11 @@ | |||
1 | #ifndef _UAPI_ASM_M32R_SETUP_H | ||
2 | #define _UAPI_ASM_M32R_SETUP_H | ||
3 | |||
4 | /* | ||
5 | * This is set up by the setup-routine at boot-time | ||
6 | */ | ||
7 | |||
8 | #define COMMAND_LINE_SIZE 512 | ||
9 | |||
10 | |||
11 | #endif /* _UAPI_ASM_M32R_SETUP_H */ | ||
diff --git a/arch/m32r/include/asm/shmbuf.h b/arch/m32r/include/uapi/asm/shmbuf.h index b0cdf0aa7d65..b0cdf0aa7d65 100644 --- a/arch/m32r/include/asm/shmbuf.h +++ b/arch/m32r/include/uapi/asm/shmbuf.h | |||
diff --git a/arch/m32r/include/asm/sigcontext.h b/arch/m32r/include/uapi/asm/sigcontext.h index da4a9c36d09b..da4a9c36d09b 100644 --- a/arch/m32r/include/asm/sigcontext.h +++ b/arch/m32r/include/uapi/asm/sigcontext.h | |||
diff --git a/arch/m32r/include/asm/siginfo.h b/arch/m32r/include/uapi/asm/siginfo.h index 7d9cd9ebfd0e..7d9cd9ebfd0e 100644 --- a/arch/m32r/include/asm/siginfo.h +++ b/arch/m32r/include/uapi/asm/siginfo.h | |||
diff --git a/arch/m32r/include/uapi/asm/signal.h b/arch/m32r/include/uapi/asm/signal.h new file mode 100644 index 000000000000..ef9788fda2ef --- /dev/null +++ b/arch/m32r/include/uapi/asm/signal.h | |||
@@ -0,0 +1,123 @@ | |||
1 | #ifndef _UAPI_ASM_M32R_SIGNAL_H | ||
2 | #define _UAPI_ASM_M32R_SIGNAL_H | ||
3 | |||
4 | #include <linux/types.h> | ||
5 | #include <linux/time.h> | ||
6 | #include <linux/compiler.h> | ||
7 | |||
8 | /* Avoid too many header ordering problems. */ | ||
9 | struct siginfo; | ||
10 | |||
11 | #ifndef __KERNEL__ | ||
12 | /* Here we must cater to libcs that poke about in kernel headers. */ | ||
13 | |||
14 | #define NSIG 32 | ||
15 | typedef unsigned long sigset_t; | ||
16 | |||
17 | #endif /* __KERNEL__ */ | ||
18 | |||
19 | #define SIGHUP 1 | ||
20 | #define SIGINT 2 | ||
21 | #define SIGQUIT 3 | ||
22 | #define SIGILL 4 | ||
23 | #define SIGTRAP 5 | ||
24 | #define SIGABRT 6 | ||
25 | #define SIGIOT 6 | ||
26 | #define SIGBUS 7 | ||
27 | #define SIGFPE 8 | ||
28 | #define SIGKILL 9 | ||
29 | #define SIGUSR1 10 | ||
30 | #define SIGSEGV 11 | ||
31 | #define SIGUSR2 12 | ||
32 | #define SIGPIPE 13 | ||
33 | #define SIGALRM 14 | ||
34 | #define SIGTERM 15 | ||
35 | #define SIGSTKFLT 16 | ||
36 | #define SIGCHLD 17 | ||
37 | #define SIGCONT 18 | ||
38 | #define SIGSTOP 19 | ||
39 | #define SIGTSTP 20 | ||
40 | #define SIGTTIN 21 | ||
41 | #define SIGTTOU 22 | ||
42 | #define SIGURG 23 | ||
43 | #define SIGXCPU 24 | ||
44 | #define SIGXFSZ 25 | ||
45 | #define SIGVTALRM 26 | ||
46 | #define SIGPROF 27 | ||
47 | #define SIGWINCH 28 | ||
48 | #define SIGIO 29 | ||
49 | #define SIGPOLL SIGIO | ||
50 | /* | ||
51 | #define SIGLOST 29 | ||
52 | */ | ||
53 | #define SIGPWR 30 | ||
54 | #define SIGSYS 31 | ||
55 | #define SIGUNUSED 31 | ||
56 | |||
57 | /* These should not be considered constants from userland. */ | ||
58 | #define SIGRTMIN 32 | ||
59 | #define SIGRTMAX _NSIG | ||
60 | |||
61 | /* | ||
62 | * SA_FLAGS values: | ||
63 | * | ||
64 | * SA_ONSTACK indicates that a registered stack_t will be used. | ||
65 | * SA_RESTART flag to get restarting signals (which were the default long ago) | ||
66 | * SA_NOCLDSTOP flag to turn off SIGCHLD when children stop. | ||
67 | * SA_RESETHAND clears the handler when the signal is delivered. | ||
68 | * SA_NOCLDWAIT flag on SIGCHLD to inhibit zombies. | ||
69 | * SA_NODEFER prevents the current signal from being masked in the handler. | ||
70 | * | ||
71 | * SA_ONESHOT and SA_NOMASK are the historical Linux names for the Single | ||
72 | * Unix names RESETHAND and NODEFER respectively. | ||
73 | */ | ||
74 | #define SA_NOCLDSTOP 0x00000001u | ||
75 | #define SA_NOCLDWAIT 0x00000002u | ||
76 | #define SA_SIGINFO 0x00000004u | ||
77 | #define SA_ONSTACK 0x08000000u | ||
78 | #define SA_RESTART 0x10000000u | ||
79 | #define SA_NODEFER 0x40000000u | ||
80 | #define SA_RESETHAND 0x80000000u | ||
81 | |||
82 | #define SA_NOMASK SA_NODEFER | ||
83 | #define SA_ONESHOT SA_RESETHAND | ||
84 | |||
85 | #define SA_RESTORER 0x04000000 | ||
86 | |||
87 | /* | ||
88 | * sigaltstack controls | ||
89 | */ | ||
90 | #define SS_ONSTACK 1 | ||
91 | #define SS_DISABLE 2 | ||
92 | |||
93 | #define MINSIGSTKSZ 2048 | ||
94 | #define SIGSTKSZ 8192 | ||
95 | |||
96 | #include <asm-generic/signal-defs.h> | ||
97 | |||
98 | #ifndef __KERNEL__ | ||
99 | /* Here we must cater to libcs that poke about in kernel headers. */ | ||
100 | |||
101 | struct sigaction { | ||
102 | union { | ||
103 | __sighandler_t _sa_handler; | ||
104 | void (*_sa_sigaction)(int, struct siginfo *, void *); | ||
105 | } _u; | ||
106 | sigset_t sa_mask; | ||
107 | unsigned long sa_flags; | ||
108 | void (*sa_restorer)(void); | ||
109 | }; | ||
110 | |||
111 | #define sa_handler _u._sa_handler | ||
112 | #define sa_sigaction _u._sa_sigaction | ||
113 | |||
114 | #endif /* __KERNEL__ */ | ||
115 | |||
116 | typedef struct sigaltstack { | ||
117 | void __user *ss_sp; | ||
118 | int ss_flags; | ||
119 | size_t ss_size; | ||
120 | } stack_t; | ||
121 | |||
122 | |||
123 | #endif /* _UAPI_ASM_M32R_SIGNAL_H */ | ||
diff --git a/arch/m32r/include/asm/socket.h b/arch/m32r/include/uapi/asm/socket.h index 5e7088a26726..5e7088a26726 100644 --- a/arch/m32r/include/asm/socket.h +++ b/arch/m32r/include/uapi/asm/socket.h | |||
diff --git a/arch/m32r/include/asm/sockios.h b/arch/m32r/include/uapi/asm/sockios.h index 6c1fb9b43bdb..6c1fb9b43bdb 100644 --- a/arch/m32r/include/asm/sockios.h +++ b/arch/m32r/include/uapi/asm/sockios.h | |||
diff --git a/arch/m32r/include/asm/stat.h b/arch/m32r/include/uapi/asm/stat.h index da4518f82d6d..da4518f82d6d 100644 --- a/arch/m32r/include/asm/stat.h +++ b/arch/m32r/include/uapi/asm/stat.h | |||
diff --git a/arch/m32r/include/asm/statfs.h b/arch/m32r/include/uapi/asm/statfs.h index 6eb4c6007e6b..6eb4c6007e6b 100644 --- a/arch/m32r/include/asm/statfs.h +++ b/arch/m32r/include/uapi/asm/statfs.h | |||
diff --git a/arch/m32r/include/asm/swab.h b/arch/m32r/include/uapi/asm/swab.h index 54dab001d6d1..54dab001d6d1 100644 --- a/arch/m32r/include/asm/swab.h +++ b/arch/m32r/include/uapi/asm/swab.h | |||
diff --git a/arch/m32r/include/asm/termbits.h b/arch/m32r/include/uapi/asm/termbits.h index 957a3c688549..957a3c688549 100644 --- a/arch/m32r/include/asm/termbits.h +++ b/arch/m32r/include/uapi/asm/termbits.h | |||
diff --git a/arch/m32r/include/uapi/asm/termios.h b/arch/m32r/include/uapi/asm/termios.h new file mode 100644 index 000000000000..07ad27b8f7db --- /dev/null +++ b/arch/m32r/include/uapi/asm/termios.h | |||
@@ -0,0 +1,43 @@ | |||
1 | #ifndef _UAPI_M32R_TERMIOS_H | ||
2 | #define _UAPI_M32R_TERMIOS_H | ||
3 | |||
4 | #include <asm/termbits.h> | ||
5 | #include <asm/ioctls.h> | ||
6 | |||
7 | struct winsize { | ||
8 | unsigned short ws_row; | ||
9 | unsigned short ws_col; | ||
10 | unsigned short ws_xpixel; | ||
11 | unsigned short ws_ypixel; | ||
12 | }; | ||
13 | |||
14 | #define NCC 8 | ||
15 | struct termio { | ||
16 | unsigned short c_iflag; /* input mode flags */ | ||
17 | unsigned short c_oflag; /* output mode flags */ | ||
18 | unsigned short c_cflag; /* control mode flags */ | ||
19 | unsigned short c_lflag; /* local mode flags */ | ||
20 | unsigned char c_line; /* line discipline */ | ||
21 | unsigned char c_cc[NCC]; /* control characters */ | ||
22 | }; | ||
23 | |||
24 | /* modem lines */ | ||
25 | #define TIOCM_LE 0x001 | ||
26 | #define TIOCM_DTR 0x002 | ||
27 | #define TIOCM_RTS 0x004 | ||
28 | #define TIOCM_ST 0x008 | ||
29 | #define TIOCM_SR 0x010 | ||
30 | #define TIOCM_CTS 0x020 | ||
31 | #define TIOCM_CAR 0x040 | ||
32 | #define TIOCM_RNG 0x080 | ||
33 | #define TIOCM_DSR 0x100 | ||
34 | #define TIOCM_CD TIOCM_CAR | ||
35 | #define TIOCM_RI TIOCM_RNG | ||
36 | #define TIOCM_OUT1 0x2000 | ||
37 | #define TIOCM_OUT2 0x4000 | ||
38 | #define TIOCM_LOOP 0x8000 | ||
39 | |||
40 | /* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */ | ||
41 | |||
42 | |||
43 | #endif /* _UAPI_M32R_TERMIOS_H */ | ||
diff --git a/arch/m32r/include/uapi/asm/types.h b/arch/m32r/include/uapi/asm/types.h new file mode 100644 index 000000000000..9ec9d4c5ac4d --- /dev/null +++ b/arch/m32r/include/uapi/asm/types.h | |||
@@ -0,0 +1 @@ | |||
#include <asm-generic/int-ll64.h> | |||
diff --git a/arch/m32r/include/uapi/asm/unistd.h b/arch/m32r/include/uapi/asm/unistd.h new file mode 100644 index 000000000000..5a54f2ae3b51 --- /dev/null +++ b/arch/m32r/include/uapi/asm/unistd.h | |||
@@ -0,0 +1,335 @@ | |||
1 | #ifndef _UAPI_ASM_M32R_UNISTD_H | ||
2 | #define _UAPI_ASM_M32R_UNISTD_H | ||
3 | |||
4 | /* | ||
5 | * This file contains the system call numbers. | ||
6 | */ | ||
7 | |||
8 | #define __NR_restart_syscall 0 | ||
9 | #define __NR_exit 1 | ||
10 | #define __NR_fork 2 | ||
11 | #define __NR_read 3 | ||
12 | #define __NR_write 4 | ||
13 | #define __NR_open 5 | ||
14 | #define __NR_close 6 | ||
15 | #define __NR_waitpid 7 | ||
16 | #define __NR_creat 8 | ||
17 | #define __NR_link 9 | ||
18 | #define __NR_unlink 10 | ||
19 | #define __NR_execve 11 | ||
20 | #define __NR_chdir 12 | ||
21 | #define __NR_time 13 | ||
22 | #define __NR_mknod 14 | ||
23 | #define __NR_chmod 15 | ||
24 | /* 16 is unused */ | ||
25 | /* 17 is unused */ | ||
26 | /* 18 is unused */ | ||
27 | #define __NR_lseek 19 | ||
28 | #define __NR_getpid 20 | ||
29 | #define __NR_mount 21 | ||
30 | #define __NR_umount 22 | ||
31 | /* 23 is unused */ | ||
32 | /* 24 is unused */ | ||
33 | #define __NR_stime 25 | ||
34 | #define __NR_ptrace 26 | ||
35 | #define __NR_alarm 27 | ||
36 | /* 28 is unused */ | ||
37 | #define __NR_pause 29 | ||
38 | #define __NR_utime 30 | ||
39 | /* 31 is unused */ | ||
40 | #define __NR_cachectl 32 /* old #define __NR_gtty 32*/ | ||
41 | #define __NR_access 33 | ||
42 | /* 34 is unused */ | ||
43 | /* 35 is unused */ | ||
44 | #define __NR_sync 36 | ||
45 | #define __NR_kill 37 | ||
46 | #define __NR_rename 38 | ||
47 | #define __NR_mkdir 39 | ||
48 | #define __NR_rmdir 40 | ||
49 | #define __NR_dup 41 | ||
50 | #define __NR_pipe 42 | ||
51 | #define __NR_times 43 | ||
52 | /* 44 is unused */ | ||
53 | #define __NR_brk 45 | ||
54 | /* 46 is unused */ | ||
55 | /* 47 is unused (getgid16) */ | ||
56 | /* 48 is unused */ | ||
57 | /* 49 is unused */ | ||
58 | /* 50 is unused */ | ||
59 | #define __NR_acct 51 | ||
60 | #define __NR_umount2 52 | ||
61 | /* 53 is unused */ | ||
62 | #define __NR_ioctl 54 | ||
63 | /* 55 is unused (fcntl) */ | ||
64 | /* 56 is unused */ | ||
65 | #define __NR_setpgid 57 | ||
66 | /* 58 is unused */ | ||
67 | /* 59 is unused */ | ||
68 | #define __NR_umask 60 | ||
69 | #define __NR_chroot 61 | ||
70 | #define __NR_ustat 62 | ||
71 | #define __NR_dup2 63 | ||
72 | #define __NR_getppid 64 | ||
73 | #define __NR_getpgrp 65 | ||
74 | #define __NR_setsid 66 | ||
75 | /* 67 is unused */ | ||
76 | /* 68 is unused*/ | ||
77 | /* 69 is unused*/ | ||
78 | /* 70 is unused */ | ||
79 | /* 71 is unused */ | ||
80 | /* 72 is unused */ | ||
81 | /* 73 is unused */ | ||
82 | #define __NR_sethostname 74 | ||
83 | #define __NR_setrlimit 75 | ||
84 | /* 76 is unused (old getrlimit) */ | ||
85 | #define __NR_getrusage 77 | ||
86 | #define __NR_gettimeofday 78 | ||
87 | #define __NR_settimeofday 79 | ||
88 | /* 80 is unused */ | ||
89 | /* 81 is unused */ | ||
90 | /* 82 is unused */ | ||
91 | #define __NR_symlink 83 | ||
92 | /* 84 is unused */ | ||
93 | #define __NR_readlink 85 | ||
94 | #define __NR_uselib 86 | ||
95 | #define __NR_swapon 87 | ||
96 | #define __NR_reboot 88 | ||
97 | /* 89 is unused */ | ||
98 | /* 90 is unused */ | ||
99 | #define __NR_munmap 91 | ||
100 | #define __NR_truncate 92 | ||
101 | #define __NR_ftruncate 93 | ||
102 | #define __NR_fchmod 94 | ||
103 | /* 95 is unused */ | ||
104 | #define __NR_getpriority 96 | ||
105 | #define __NR_setpriority 97 | ||
106 | /* 98 is unused */ | ||
107 | #define __NR_statfs 99 | ||
108 | #define __NR_fstatfs 100 | ||
109 | /* 101 is unused */ | ||
110 | #define __NR_socketcall 102 | ||
111 | #define __NR_syslog 103 | ||
112 | #define __NR_setitimer 104 | ||
113 | #define __NR_getitimer 105 | ||
114 | #define __NR_stat 106 | ||
115 | #define __NR_lstat 107 | ||
116 | #define __NR_fstat 108 | ||
117 | /* 109 is unused */ | ||
118 | /* 110 is unused */ | ||
119 | #define __NR_vhangup 111 | ||
120 | /* 112 is unused */ | ||
121 | /* 113 is unused */ | ||
122 | #define __NR_wait4 114 | ||
123 | #define __NR_swapoff 115 | ||
124 | #define __NR_sysinfo 116 | ||
125 | #define __NR_ipc 117 | ||
126 | #define __NR_fsync 118 | ||
127 | /* 119 is unused */ | ||
128 | #define __NR_clone 120 | ||
129 | #define __NR_setdomainname 121 | ||
130 | #define __NR_uname 122 | ||
131 | /* 123 is unused */ | ||
132 | #define __NR_adjtimex 124 | ||
133 | #define __NR_mprotect 125 | ||
134 | /* 126 is unused */ | ||
135 | /* 127 is unused */ | ||
136 | #define __NR_init_module 128 | ||
137 | #define __NR_delete_module 129 | ||
138 | /* 130 is unused */ | ||
139 | #define __NR_quotactl 131 | ||
140 | #define __NR_getpgid 132 | ||
141 | #define __NR_fchdir 133 | ||
142 | #define __NR_bdflush 134 | ||
143 | #define __NR_sysfs 135 | ||
144 | #define __NR_personality 136 | ||
145 | /* 137 is unused */ | ||
146 | /* 138 is unused */ | ||
147 | /* 139 is unused */ | ||
148 | #define __NR__llseek 140 | ||
149 | #define __NR_getdents 141 | ||
150 | #define __NR__newselect 142 | ||
151 | #define __NR_flock 143 | ||
152 | #define __NR_msync 144 | ||
153 | #define __NR_readv 145 | ||
154 | #define __NR_writev 146 | ||
155 | #define __NR_getsid 147 | ||
156 | #define __NR_fdatasync 148 | ||
157 | #define __NR__sysctl 149 | ||
158 | #define __NR_mlock 150 | ||
159 | #define __NR_munlock 151 | ||
160 | #define __NR_mlockall 152 | ||
161 | #define __NR_munlockall 153 | ||
162 | #define __NR_sched_setparam 154 | ||
163 | #define __NR_sched_getparam 155 | ||
164 | #define __NR_sched_setscheduler 156 | ||
165 | #define __NR_sched_getscheduler 157 | ||
166 | #define __NR_sched_yield 158 | ||
167 | #define __NR_sched_get_priority_max 159 | ||
168 | #define __NR_sched_get_priority_min 160 | ||
169 | #define __NR_sched_rr_get_interval 161 | ||
170 | #define __NR_nanosleep 162 | ||
171 | #define __NR_mremap 163 | ||
172 | /* 164 is unused */ | ||
173 | /* 165 is unused */ | ||
174 | #define __NR_tas 166 | ||
175 | /* 167 is unused */ | ||
176 | #define __NR_poll 168 | ||
177 | #define __NR_nfsservctl 169 | ||
178 | /* 170 is unused */ | ||
179 | /* 171 is unused */ | ||
180 | #define __NR_prctl 172 | ||
181 | #define __NR_rt_sigreturn 173 | ||
182 | #define __NR_rt_sigaction 174 | ||
183 | #define __NR_rt_sigprocmask 175 | ||
184 | #define __NR_rt_sigpending 176 | ||
185 | #define __NR_rt_sigtimedwait 177 | ||
186 | #define __NR_rt_sigqueueinfo 178 | ||
187 | #define __NR_rt_sigsuspend 179 | ||
188 | #define __NR_pread64 180 | ||
189 | #define __NR_pwrite64 181 | ||
190 | /* 182 is unused */ | ||
191 | #define __NR_getcwd 183 | ||
192 | #define __NR_capget 184 | ||
193 | #define __NR_capset 185 | ||
194 | #define __NR_sigaltstack 186 | ||
195 | #define __NR_sendfile 187 | ||
196 | /* 188 is unused */ | ||
197 | /* 189 is unused */ | ||
198 | #define __NR_vfork 190 | ||
199 | #define __NR_ugetrlimit 191 /* SuS compliant getrlimit */ | ||
200 | #define __NR_mmap2 192 | ||
201 | #define __NR_truncate64 193 | ||
202 | #define __NR_ftruncate64 194 | ||
203 | #define __NR_stat64 195 | ||
204 | #define __NR_lstat64 196 | ||
205 | #define __NR_fstat64 197 | ||
206 | #define __NR_lchown32 198 | ||
207 | #define __NR_getuid32 199 | ||
208 | #define __NR_getgid32 200 | ||
209 | #define __NR_geteuid32 201 | ||
210 | #define __NR_getegid32 202 | ||
211 | #define __NR_setreuid32 203 | ||
212 | #define __NR_setregid32 204 | ||
213 | #define __NR_getgroups32 205 | ||
214 | #define __NR_setgroups32 206 | ||
215 | #define __NR_fchown32 207 | ||
216 | #define __NR_setresuid32 208 | ||
217 | #define __NR_getresuid32 209 | ||
218 | #define __NR_setresgid32 210 | ||
219 | #define __NR_getresgid32 211 | ||
220 | #define __NR_chown32 212 | ||
221 | #define __NR_setuid32 213 | ||
222 | #define __NR_setgid32 214 | ||
223 | #define __NR_setfsuid32 215 | ||
224 | #define __NR_setfsgid32 216 | ||
225 | #define __NR_pivot_root 217 | ||
226 | #define __NR_mincore 218 | ||
227 | #define __NR_madvise 219 | ||
228 | #define __NR_getdents64 220 | ||
229 | #define __NR_fcntl64 221 | ||
230 | /* 222 is unused */ | ||
231 | /* 223 is unused */ | ||
232 | #define __NR_gettid 224 | ||
233 | #define __NR_readahead 225 | ||
234 | #define __NR_setxattr 226 | ||
235 | #define __NR_lsetxattr 227 | ||
236 | #define __NR_fsetxattr 228 | ||
237 | #define __NR_getxattr 229 | ||
238 | #define __NR_lgetxattr 230 | ||
239 | #define __NR_fgetxattr 231 | ||
240 | #define __NR_listxattr 232 | ||
241 | #define __NR_llistxattr 233 | ||
242 | #define __NR_flistxattr 234 | ||
243 | #define __NR_removexattr 235 | ||
244 | #define __NR_lremovexattr 236 | ||
245 | #define __NR_fremovexattr 237 | ||
246 | #define __NR_tkill 238 | ||
247 | #define __NR_sendfile64 239 | ||
248 | #define __NR_futex 240 | ||
249 | #define __NR_sched_setaffinity 241 | ||
250 | #define __NR_sched_getaffinity 242 | ||
251 | #define __NR_set_thread_area 243 | ||
252 | #define __NR_get_thread_area 244 | ||
253 | #define __NR_io_setup 245 | ||
254 | #define __NR_io_destroy 246 | ||
255 | #define __NR_io_getevents 247 | ||
256 | #define __NR_io_submit 248 | ||
257 | #define __NR_io_cancel 249 | ||
258 | #define __NR_fadvise64 250 | ||
259 | /* 251 is unused */ | ||
260 | #define __NR_exit_group 252 | ||
261 | #define __NR_lookup_dcookie 253 | ||
262 | #define __NR_epoll_create 254 | ||
263 | #define __NR_epoll_ctl 255 | ||
264 | #define __NR_epoll_wait 256 | ||
265 | #define __NR_remap_file_pages 257 | ||
266 | #define __NR_set_tid_address 258 | ||
267 | #define __NR_timer_create 259 | ||
268 | #define __NR_timer_settime (__NR_timer_create+1) | ||
269 | #define __NR_timer_gettime (__NR_timer_create+2) | ||
270 | #define __NR_timer_getoverrun (__NR_timer_create+3) | ||
271 | #define __NR_timer_delete (__NR_timer_create+4) | ||
272 | #define __NR_clock_settime (__NR_timer_create+5) | ||
273 | #define __NR_clock_gettime (__NR_timer_create+6) | ||
274 | #define __NR_clock_getres (__NR_timer_create+7) | ||
275 | #define __NR_clock_nanosleep (__NR_timer_create+8) | ||
276 | #define __NR_statfs64 268 | ||
277 | #define __NR_fstatfs64 269 | ||
278 | #define __NR_tgkill 270 | ||
279 | #define __NR_utimes 271 | ||
280 | #define __NR_fadvise64_64 272 | ||
281 | #define __NR_vserver 273 | ||
282 | #define __NR_mbind 274 | ||
283 | #define __NR_get_mempolicy 275 | ||
284 | #define __NR_set_mempolicy 276 | ||
285 | #define __NR_mq_open 277 | ||
286 | #define __NR_mq_unlink (__NR_mq_open+1) | ||
287 | #define __NR_mq_timedsend (__NR_mq_open+2) | ||
288 | #define __NR_mq_timedreceive (__NR_mq_open+3) | ||
289 | #define __NR_mq_notify (__NR_mq_open+4) | ||
290 | #define __NR_mq_getsetattr (__NR_mq_open+5) | ||
291 | #define __NR_kexec_load 283 | ||
292 | #define __NR_waitid 284 | ||
293 | /* 285 is unused */ | ||
294 | #define __NR_add_key 286 | ||
295 | #define __NR_request_key 287 | ||
296 | #define __NR_keyctl 288 | ||
297 | #define __NR_ioprio_set 289 | ||
298 | #define __NR_ioprio_get 290 | ||
299 | #define __NR_inotify_init 291 | ||
300 | #define __NR_inotify_add_watch 292 | ||
301 | #define __NR_inotify_rm_watch 293 | ||
302 | #define __NR_migrate_pages 294 | ||
303 | #define __NR_openat 295 | ||
304 | #define __NR_mkdirat 296 | ||
305 | #define __NR_mknodat 297 | ||
306 | #define __NR_fchownat 298 | ||
307 | #define __NR_futimesat 299 | ||
308 | #define __NR_fstatat64 300 | ||
309 | #define __NR_unlinkat 301 | ||
310 | #define __NR_renameat 302 | ||
311 | #define __NR_linkat 303 | ||
312 | #define __NR_symlinkat 304 | ||
313 | #define __NR_readlinkat 305 | ||
314 | #define __NR_fchmodat 306 | ||
315 | #define __NR_faccessat 307 | ||
316 | #define __NR_pselect6 308 | ||
317 | #define __NR_ppoll 309 | ||
318 | #define __NR_unshare 310 | ||
319 | #define __NR_set_robust_list 311 | ||
320 | #define __NR_get_robust_list 312 | ||
321 | #define __NR_splice 313 | ||
322 | #define __NR_sync_file_range 314 | ||
323 | #define __NR_tee 315 | ||
324 | #define __NR_vmsplice 316 | ||
325 | #define __NR_move_pages 317 | ||
326 | #define __NR_getcpu 318 | ||
327 | #define __NR_epoll_pwait 319 | ||
328 | #define __NR_utimensat 320 | ||
329 | #define __NR_signalfd 321 | ||
330 | /* #define __NR_timerfd 322 removed */ | ||
331 | #define __NR_eventfd 323 | ||
332 | #define __NR_fallocate 324 | ||
333 | #define __NR_setns 325 | ||
334 | |||
335 | #endif /* _UAPI_ASM_M32R_UNISTD_H */ | ||
diff --git a/arch/score/include/asm/Kbuild b/arch/score/include/asm/Kbuild index 16e41fe1a419..cebaff8069a1 100644 --- a/arch/score/include/asm/Kbuild +++ b/arch/score/include/asm/Kbuild | |||
@@ -1,4 +1,3 @@ | |||
1 | include include/asm-generic/Kbuild.asm | ||
2 | 1 | ||
3 | header-y += | 2 | header-y += |
4 | 3 | ||
diff --git a/arch/score/include/asm/ptrace.h b/arch/score/include/asm/ptrace.h index e89dc9b1ef49..78fc538db84c 100644 --- a/arch/score/include/asm/ptrace.h +++ b/arch/score/include/asm/ptrace.h | |||
@@ -1,78 +1,8 @@ | |||
1 | #ifndef _ASM_SCORE_PTRACE_H | 1 | #ifndef _ASM_SCORE_PTRACE_H |
2 | #define _ASM_SCORE_PTRACE_H | 2 | #define _ASM_SCORE_PTRACE_H |
3 | 3 | ||
4 | #define PTRACE_GETREGS 12 | 4 | #include <uapi/asm/ptrace.h> |
5 | #define PTRACE_SETREGS 13 | ||
6 | 5 | ||
7 | #define PC 32 | ||
8 | #define CONDITION 33 | ||
9 | #define ECR 34 | ||
10 | #define EMA 35 | ||
11 | #define CEH 36 | ||
12 | #define CEL 37 | ||
13 | #define COUNTER 38 | ||
14 | #define LDCR 39 | ||
15 | #define STCR 40 | ||
16 | #define PSR 41 | ||
17 | |||
18 | #define SINGLESTEP16_INSN 0x7006 | ||
19 | #define SINGLESTEP32_INSN 0x840C8000 | ||
20 | #define BREAKPOINT16_INSN 0x7002 /* work on SPG300 */ | ||
21 | #define BREAKPOINT32_INSN 0x84048000 /* work on SPG300 */ | ||
22 | |||
23 | /* Define instruction mask */ | ||
24 | #define INSN32_MASK 0x80008000 | ||
25 | |||
26 | #define J32 0x88008000 /* 1_00010_0000000000_1_000000000000000 */ | ||
27 | #define J32M 0xFC008000 /* 1_11111_0000000000_1_000000000000000 */ | ||
28 | |||
29 | #define B32 0x90008000 /* 1_00100_0000000000_1_000000000000000 */ | ||
30 | #define B32M 0xFC008000 | ||
31 | #define BL32 0x90008001 /* 1_00100_0000000000_1_000000000000001 */ | ||
32 | #define BL32M B32 | ||
33 | #define BR32 0x80008008 /* 1_00000_0000000000_1_00000000_000100_0 */ | ||
34 | #define BR32M 0xFFE0807E | ||
35 | #define BRL32 0x80008009 /* 1_00000_0000000000_1_00000000_000100_1 */ | ||
36 | #define BRL32M BR32M | ||
37 | |||
38 | #define B32_SET (J32 | B32 | BL32 | BR32 | BRL32) | ||
39 | |||
40 | #define J16 0x3000 /* 0_011_....... */ | ||
41 | #define J16M 0xF000 | ||
42 | #define B16 0x4000 /* 0_100_....... */ | ||
43 | #define B16M 0xF000 | ||
44 | #define BR16 0x0004 /* 0_000.......0100 */ | ||
45 | #define BR16M 0xF00F | ||
46 | #define B16_SET (J16 | B16 | BR16) | ||
47 | |||
48 | |||
49 | /* | ||
50 | * This struct defines the way the registers are stored on the stack during a | ||
51 | * system call/exception. As usual the registers k0/k1 aren't being saved. | ||
52 | */ | ||
53 | struct pt_regs { | ||
54 | unsigned long pad0[6]; /* stack arguments */ | ||
55 | unsigned long orig_r4; | ||
56 | unsigned long orig_r7; | ||
57 | long is_syscall; | ||
58 | |||
59 | unsigned long regs[32]; | ||
60 | |||
61 | unsigned long cel; | ||
62 | unsigned long ceh; | ||
63 | |||
64 | unsigned long sr0; /* cnt */ | ||
65 | unsigned long sr1; /* lcr */ | ||
66 | unsigned long sr2; /* scr */ | ||
67 | |||
68 | unsigned long cp0_epc; | ||
69 | unsigned long cp0_ema; | ||
70 | unsigned long cp0_psr; | ||
71 | unsigned long cp0_ecr; | ||
72 | unsigned long cp0_condition; | ||
73 | }; | ||
74 | |||
75 | #ifdef __KERNEL__ | ||
76 | 6 | ||
77 | struct task_struct; | 7 | struct task_struct; |
78 | 8 | ||
@@ -91,6 +21,4 @@ extern int read_tsk_short(struct task_struct *, unsigned long, | |||
91 | 21 | ||
92 | #define arch_has_single_step() (1) | 22 | #define arch_has_single_step() (1) |
93 | 23 | ||
94 | #endif /* __KERNEL__ */ | ||
95 | |||
96 | #endif /* _ASM_SCORE_PTRACE_H */ | 24 | #endif /* _ASM_SCORE_PTRACE_H */ |
diff --git a/arch/score/include/asm/setup.h b/arch/score/include/asm/setup.h index 3cb944dc68dc..1f3aa7262fa3 100644 --- a/arch/score/include/asm/setup.h +++ b/arch/score/include/asm/setup.h | |||
@@ -1,11 +1,8 @@ | |||
1 | #ifndef _ASM_SCORE_SETUP_H | 1 | #ifndef _ASM_SCORE_SETUP_H |
2 | #define _ASM_SCORE_SETUP_H | 2 | #define _ASM_SCORE_SETUP_H |
3 | 3 | ||
4 | #define COMMAND_LINE_SIZE 256 | 4 | #include <uapi/asm/setup.h> |
5 | #define MEMORY_START 0 | ||
6 | #define MEMORY_SIZE 0x2000000 | ||
7 | 5 | ||
8 | #ifdef __KERNEL__ | ||
9 | 6 | ||
10 | extern void pagetable_init(void); | 7 | extern void pagetable_init(void); |
11 | extern void pgd_init(unsigned long page); | 8 | extern void pgd_init(unsigned long page); |
@@ -36,6 +33,4 @@ extern void debug_exception_vector(void); | |||
36 | extern void general_exception_vector(void); | 33 | extern void general_exception_vector(void); |
37 | extern void interrupt_exception_vector(void); | 34 | extern void interrupt_exception_vector(void); |
38 | 35 | ||
39 | #endif /* __KERNEL__ */ | ||
40 | |||
41 | #endif /* _ASM_SCORE_SETUP_H */ | 36 | #endif /* _ASM_SCORE_SETUP_H */ |
diff --git a/arch/score/include/uapi/asm/Kbuild b/arch/score/include/uapi/asm/Kbuild index baebb3da1d44..040178cdb3eb 100644 --- a/arch/score/include/uapi/asm/Kbuild +++ b/arch/score/include/uapi/asm/Kbuild | |||
@@ -1,3 +1,34 @@ | |||
1 | # UAPI Header export list | 1 | # UAPI Header export list |
2 | include include/uapi/asm-generic/Kbuild.asm | 2 | include include/uapi/asm-generic/Kbuild.asm |
3 | 3 | ||
4 | header-y += auxvec.h | ||
5 | header-y += bitsperlong.h | ||
6 | header-y += byteorder.h | ||
7 | header-y += errno.h | ||
8 | header-y += fcntl.h | ||
9 | header-y += ioctl.h | ||
10 | header-y += ioctls.h | ||
11 | header-y += ipcbuf.h | ||
12 | header-y += kvm_para.h | ||
13 | header-y += mman.h | ||
14 | header-y += msgbuf.h | ||
15 | header-y += param.h | ||
16 | header-y += poll.h | ||
17 | header-y += posix_types.h | ||
18 | header-y += ptrace.h | ||
19 | header-y += resource.h | ||
20 | header-y += sembuf.h | ||
21 | header-y += setup.h | ||
22 | header-y += shmbuf.h | ||
23 | header-y += sigcontext.h | ||
24 | header-y += siginfo.h | ||
25 | header-y += signal.h | ||
26 | header-y += socket.h | ||
27 | header-y += sockios.h | ||
28 | header-y += stat.h | ||
29 | header-y += statfs.h | ||
30 | header-y += swab.h | ||
31 | header-y += termbits.h | ||
32 | header-y += termios.h | ||
33 | header-y += types.h | ||
34 | header-y += unistd.h | ||
diff --git a/arch/score/include/asm/auxvec.h b/arch/score/include/uapi/asm/auxvec.h index f69151565aee..f69151565aee 100644 --- a/arch/score/include/asm/auxvec.h +++ b/arch/score/include/uapi/asm/auxvec.h | |||
diff --git a/arch/score/include/asm/bitsperlong.h b/arch/score/include/uapi/asm/bitsperlong.h index 86ff337aa459..86ff337aa459 100644 --- a/arch/score/include/asm/bitsperlong.h +++ b/arch/score/include/uapi/asm/bitsperlong.h | |||
diff --git a/arch/score/include/asm/byteorder.h b/arch/score/include/uapi/asm/byteorder.h index 88cbebc79212..88cbebc79212 100644 --- a/arch/score/include/asm/byteorder.h +++ b/arch/score/include/uapi/asm/byteorder.h | |||
diff --git a/arch/score/include/asm/errno.h b/arch/score/include/uapi/asm/errno.h index 29ff39d5ab47..29ff39d5ab47 100644 --- a/arch/score/include/asm/errno.h +++ b/arch/score/include/uapi/asm/errno.h | |||
diff --git a/arch/score/include/asm/fcntl.h b/arch/score/include/uapi/asm/fcntl.h index 03968a3103a4..03968a3103a4 100644 --- a/arch/score/include/asm/fcntl.h +++ b/arch/score/include/uapi/asm/fcntl.h | |||
diff --git a/arch/score/include/asm/ioctl.h b/arch/score/include/uapi/asm/ioctl.h index a351d2194bfd..a351d2194bfd 100644 --- a/arch/score/include/asm/ioctl.h +++ b/arch/score/include/uapi/asm/ioctl.h | |||
diff --git a/arch/score/include/asm/ioctls.h b/arch/score/include/uapi/asm/ioctls.h index ed01d2b9aeab..ed01d2b9aeab 100644 --- a/arch/score/include/asm/ioctls.h +++ b/arch/score/include/uapi/asm/ioctls.h | |||
diff --git a/arch/score/include/asm/ipcbuf.h b/arch/score/include/uapi/asm/ipcbuf.h index e082ceff1818..e082ceff1818 100644 --- a/arch/score/include/asm/ipcbuf.h +++ b/arch/score/include/uapi/asm/ipcbuf.h | |||
diff --git a/arch/score/include/asm/kvm_para.h b/arch/score/include/uapi/asm/kvm_para.h index 14fab8f0b957..14fab8f0b957 100644 --- a/arch/score/include/asm/kvm_para.h +++ b/arch/score/include/uapi/asm/kvm_para.h | |||
diff --git a/arch/score/include/asm/mman.h b/arch/score/include/uapi/asm/mman.h index 84d85ddfed8d..84d85ddfed8d 100644 --- a/arch/score/include/asm/mman.h +++ b/arch/score/include/uapi/asm/mman.h | |||
diff --git a/arch/score/include/asm/msgbuf.h b/arch/score/include/uapi/asm/msgbuf.h index 7506721e29fa..7506721e29fa 100644 --- a/arch/score/include/asm/msgbuf.h +++ b/arch/score/include/uapi/asm/msgbuf.h | |||
diff --git a/arch/score/include/asm/param.h b/arch/score/include/uapi/asm/param.h index 916b8690b6aa..916b8690b6aa 100644 --- a/arch/score/include/asm/param.h +++ b/arch/score/include/uapi/asm/param.h | |||
diff --git a/arch/score/include/asm/poll.h b/arch/score/include/uapi/asm/poll.h index 18532db02861..18532db02861 100644 --- a/arch/score/include/asm/poll.h +++ b/arch/score/include/uapi/asm/poll.h | |||
diff --git a/arch/score/include/asm/posix_types.h b/arch/score/include/uapi/asm/posix_types.h index b88acf80048a..b88acf80048a 100644 --- a/arch/score/include/asm/posix_types.h +++ b/arch/score/include/uapi/asm/posix_types.h | |||
diff --git a/arch/score/include/uapi/asm/ptrace.h b/arch/score/include/uapi/asm/ptrace.h new file mode 100644 index 000000000000..f59771a3f127 --- /dev/null +++ b/arch/score/include/uapi/asm/ptrace.h | |||
@@ -0,0 +1,76 @@ | |||
1 | #ifndef _UAPI_ASM_SCORE_PTRACE_H | ||
2 | #define _UAPI_ASM_SCORE_PTRACE_H | ||
3 | |||
4 | #define PTRACE_GETREGS 12 | ||
5 | #define PTRACE_SETREGS 13 | ||
6 | |||
7 | #define PC 32 | ||
8 | #define CONDITION 33 | ||
9 | #define ECR 34 | ||
10 | #define EMA 35 | ||
11 | #define CEH 36 | ||
12 | #define CEL 37 | ||
13 | #define COUNTER 38 | ||
14 | #define LDCR 39 | ||
15 | #define STCR 40 | ||
16 | #define PSR 41 | ||
17 | |||
18 | #define SINGLESTEP16_INSN 0x7006 | ||
19 | #define SINGLESTEP32_INSN 0x840C8000 | ||
20 | #define BREAKPOINT16_INSN 0x7002 /* work on SPG300 */ | ||
21 | #define BREAKPOINT32_INSN 0x84048000 /* work on SPG300 */ | ||
22 | |||
23 | /* Define instruction mask */ | ||
24 | #define INSN32_MASK 0x80008000 | ||
25 | |||
26 | #define J32 0x88008000 /* 1_00010_0000000000_1_000000000000000 */ | ||
27 | #define J32M 0xFC008000 /* 1_11111_0000000000_1_000000000000000 */ | ||
28 | |||
29 | #define B32 0x90008000 /* 1_00100_0000000000_1_000000000000000 */ | ||
30 | #define B32M 0xFC008000 | ||
31 | #define BL32 0x90008001 /* 1_00100_0000000000_1_000000000000001 */ | ||
32 | #define BL32M B32 | ||
33 | #define BR32 0x80008008 /* 1_00000_0000000000_1_00000000_000100_0 */ | ||
34 | #define BR32M 0xFFE0807E | ||
35 | #define BRL32 0x80008009 /* 1_00000_0000000000_1_00000000_000100_1 */ | ||
36 | #define BRL32M BR32M | ||
37 | |||
38 | #define B32_SET (J32 | B32 | BL32 | BR32 | BRL32) | ||
39 | |||
40 | #define J16 0x3000 /* 0_011_....... */ | ||
41 | #define J16M 0xF000 | ||
42 | #define B16 0x4000 /* 0_100_....... */ | ||
43 | #define B16M 0xF000 | ||
44 | #define BR16 0x0004 /* 0_000.......0100 */ | ||
45 | #define BR16M 0xF00F | ||
46 | #define B16_SET (J16 | B16 | BR16) | ||
47 | |||
48 | |||
49 | /* | ||
50 | * This struct defines the way the registers are stored on the stack during a | ||
51 | * system call/exception. As usual the registers k0/k1 aren't being saved. | ||
52 | */ | ||
53 | struct pt_regs { | ||
54 | unsigned long pad0[6]; /* stack arguments */ | ||
55 | unsigned long orig_r4; | ||
56 | unsigned long orig_r7; | ||
57 | long is_syscall; | ||
58 | |||
59 | unsigned long regs[32]; | ||
60 | |||
61 | unsigned long cel; | ||
62 | unsigned long ceh; | ||
63 | |||
64 | unsigned long sr0; /* cnt */ | ||
65 | unsigned long sr1; /* lcr */ | ||
66 | unsigned long sr2; /* scr */ | ||
67 | |||
68 | unsigned long cp0_epc; | ||
69 | unsigned long cp0_ema; | ||
70 | unsigned long cp0_psr; | ||
71 | unsigned long cp0_ecr; | ||
72 | unsigned long cp0_condition; | ||
73 | }; | ||
74 | |||
75 | |||
76 | #endif /* _UAPI_ASM_SCORE_PTRACE_H */ | ||
diff --git a/arch/score/include/asm/resource.h b/arch/score/include/uapi/asm/resource.h index 9ce22bc7b475..9ce22bc7b475 100644 --- a/arch/score/include/asm/resource.h +++ b/arch/score/include/uapi/asm/resource.h | |||
diff --git a/arch/score/include/asm/sembuf.h b/arch/score/include/uapi/asm/sembuf.h index dae5e835ce9e..dae5e835ce9e 100644 --- a/arch/score/include/asm/sembuf.h +++ b/arch/score/include/uapi/asm/sembuf.h | |||
diff --git a/arch/score/include/uapi/asm/setup.h b/arch/score/include/uapi/asm/setup.h new file mode 100644 index 000000000000..ab9dbdb59bba --- /dev/null +++ b/arch/score/include/uapi/asm/setup.h | |||
@@ -0,0 +1,9 @@ | |||
1 | #ifndef _UAPI_ASM_SCORE_SETUP_H | ||
2 | #define _UAPI_ASM_SCORE_SETUP_H | ||
3 | |||
4 | #define COMMAND_LINE_SIZE 256 | ||
5 | #define MEMORY_START 0 | ||
6 | #define MEMORY_SIZE 0x2000000 | ||
7 | |||
8 | |||
9 | #endif /* _UAPI_ASM_SCORE_SETUP_H */ | ||
diff --git a/arch/score/include/asm/shmbuf.h b/arch/score/include/uapi/asm/shmbuf.h index c85b2429ba21..c85b2429ba21 100644 --- a/arch/score/include/asm/shmbuf.h +++ b/arch/score/include/uapi/asm/shmbuf.h | |||
diff --git a/arch/score/include/asm/sigcontext.h b/arch/score/include/uapi/asm/sigcontext.h index 5ffda39ddb90..5ffda39ddb90 100644 --- a/arch/score/include/asm/sigcontext.h +++ b/arch/score/include/uapi/asm/sigcontext.h | |||
diff --git a/arch/score/include/asm/siginfo.h b/arch/score/include/uapi/asm/siginfo.h index 87ca35607a28..87ca35607a28 100644 --- a/arch/score/include/asm/siginfo.h +++ b/arch/score/include/uapi/asm/siginfo.h | |||
diff --git a/arch/score/include/asm/signal.h b/arch/score/include/uapi/asm/signal.h index 2605bc06b64f..2605bc06b64f 100644 --- a/arch/score/include/asm/signal.h +++ b/arch/score/include/uapi/asm/signal.h | |||
diff --git a/arch/score/include/asm/socket.h b/arch/score/include/uapi/asm/socket.h index 612a70e385ba..612a70e385ba 100644 --- a/arch/score/include/asm/socket.h +++ b/arch/score/include/uapi/asm/socket.h | |||
diff --git a/arch/score/include/asm/sockios.h b/arch/score/include/uapi/asm/sockios.h index ba8256480189..ba8256480189 100644 --- a/arch/score/include/asm/sockios.h +++ b/arch/score/include/uapi/asm/sockios.h | |||
diff --git a/arch/score/include/asm/stat.h b/arch/score/include/uapi/asm/stat.h index 5037055500a2..5037055500a2 100644 --- a/arch/score/include/asm/stat.h +++ b/arch/score/include/uapi/asm/stat.h | |||
diff --git a/arch/score/include/asm/statfs.h b/arch/score/include/uapi/asm/statfs.h index 36e41004e996..36e41004e996 100644 --- a/arch/score/include/asm/statfs.h +++ b/arch/score/include/uapi/asm/statfs.h | |||
diff --git a/arch/score/include/asm/swab.h b/arch/score/include/uapi/asm/swab.h index fadc3cc6d8a2..fadc3cc6d8a2 100644 --- a/arch/score/include/asm/swab.h +++ b/arch/score/include/uapi/asm/swab.h | |||
diff --git a/arch/score/include/asm/termbits.h b/arch/score/include/uapi/asm/termbits.h index 9a95c1412437..9a95c1412437 100644 --- a/arch/score/include/asm/termbits.h +++ b/arch/score/include/uapi/asm/termbits.h | |||
diff --git a/arch/score/include/asm/termios.h b/arch/score/include/uapi/asm/termios.h index 40984e811ad6..40984e811ad6 100644 --- a/arch/score/include/asm/termios.h +++ b/arch/score/include/uapi/asm/termios.h | |||
diff --git a/arch/score/include/asm/types.h b/arch/score/include/uapi/asm/types.h index 2140032778ee..2140032778ee 100644 --- a/arch/score/include/asm/types.h +++ b/arch/score/include/uapi/asm/types.h | |||
diff --git a/arch/score/include/asm/unistd.h b/arch/score/include/uapi/asm/unistd.h index 56001c93095a..56001c93095a 100644 --- a/arch/score/include/asm/unistd.h +++ b/arch/score/include/uapi/asm/unistd.h | |||
diff --git a/drivers/amba/tegra-ahb.c b/drivers/amba/tegra-ahb.c index bd5de08ad6fd..0576a7dd32a5 100644 --- a/drivers/amba/tegra-ahb.c +++ b/drivers/amba/tegra-ahb.c | |||
@@ -157,6 +157,7 @@ int tegra_ahb_enable_smmu(struct device_node *dn) | |||
157 | EXPORT_SYMBOL(tegra_ahb_enable_smmu); | 157 | EXPORT_SYMBOL(tegra_ahb_enable_smmu); |
158 | #endif | 158 | #endif |
159 | 159 | ||
160 | #ifdef CONFIG_PM_SLEEP | ||
160 | static int tegra_ahb_suspend(struct device *dev) | 161 | static int tegra_ahb_suspend(struct device *dev) |
161 | { | 162 | { |
162 | int i; | 163 | int i; |
@@ -176,6 +177,7 @@ static int tegra_ahb_resume(struct device *dev) | |||
176 | gizmo_writel(ahb, ahb->ctx[i], tegra_ahb_gizmo[i]); | 177 | gizmo_writel(ahb, ahb->ctx[i], tegra_ahb_gizmo[i]); |
177 | return 0; | 178 | return 0; |
178 | } | 179 | } |
180 | #endif | ||
179 | 181 | ||
180 | static UNIVERSAL_DEV_PM_OPS(tegra_ahb_pm, | 182 | static UNIVERSAL_DEV_PM_OPS(tegra_ahb_pm, |
181 | tegra_ahb_suspend, | 183 | tegra_ahb_suspend, |
diff --git a/drivers/base/dma-buf.c b/drivers/base/dma-buf.c index 460e22dee36d..a3f79c495a41 100644 --- a/drivers/base/dma-buf.c +++ b/drivers/base/dma-buf.c | |||
@@ -298,6 +298,8 @@ void dma_buf_unmap_attachment(struct dma_buf_attachment *attach, | |||
298 | struct sg_table *sg_table, | 298 | struct sg_table *sg_table, |
299 | enum dma_data_direction direction) | 299 | enum dma_data_direction direction) |
300 | { | 300 | { |
301 | might_sleep(); | ||
302 | |||
301 | if (WARN_ON(!attach || !attach->dmabuf || !sg_table)) | 303 | if (WARN_ON(!attach || !attach->dmabuf || !sg_table)) |
302 | return; | 304 | return; |
303 | 305 | ||
diff --git a/drivers/char/virtio_console.c b/drivers/char/virtio_console.c index 90493d4ead1f..c594cb16c37b 100644 --- a/drivers/char/virtio_console.c +++ b/drivers/char/virtio_console.c | |||
@@ -37,8 +37,12 @@ | |||
37 | #include <linux/wait.h> | 37 | #include <linux/wait.h> |
38 | #include <linux/workqueue.h> | 38 | #include <linux/workqueue.h> |
39 | #include <linux/module.h> | 39 | #include <linux/module.h> |
40 | #include <linux/dma-mapping.h> | ||
41 | #include <linux/kconfig.h> | ||
40 | #include "../tty/hvc/hvc_console.h" | 42 | #include "../tty/hvc/hvc_console.h" |
41 | 43 | ||
44 | #define is_rproc_enabled IS_ENABLED(CONFIG_REMOTEPROC) | ||
45 | |||
42 | /* | 46 | /* |
43 | * This is a global struct for storing common data for all the devices | 47 | * This is a global struct for storing common data for all the devices |
44 | * this driver handles. | 48 | * this driver handles. |
@@ -111,6 +115,21 @@ struct port_buffer { | |||
111 | size_t len; | 115 | size_t len; |
112 | /* offset in the buf from which to consume data */ | 116 | /* offset in the buf from which to consume data */ |
113 | size_t offset; | 117 | size_t offset; |
118 | |||
119 | /* DMA address of buffer */ | ||
120 | dma_addr_t dma; | ||
121 | |||
122 | /* Device we got DMA memory from */ | ||
123 | struct device *dev; | ||
124 | |||
125 | /* List of pending dma buffers to free */ | ||
126 | struct list_head list; | ||
127 | |||
128 | /* If sgpages == 0 then buf is used */ | ||
129 | unsigned int sgpages; | ||
130 | |||
131 | /* sg is used if spages > 0. sg must be the last in is struct */ | ||
132 | struct scatterlist sg[0]; | ||
114 | }; | 133 | }; |
115 | 134 | ||
116 | /* | 135 | /* |
@@ -325,6 +344,11 @@ static bool is_console_port(struct port *port) | |||
325 | return false; | 344 | return false; |
326 | } | 345 | } |
327 | 346 | ||
347 | static bool is_rproc_serial(const struct virtio_device *vdev) | ||
348 | { | ||
349 | return is_rproc_enabled && vdev->id.device == VIRTIO_ID_RPROC_SERIAL; | ||
350 | } | ||
351 | |||
328 | static inline bool use_multiport(struct ports_device *portdev) | 352 | static inline bool use_multiport(struct ports_device *portdev) |
329 | { | 353 | { |
330 | /* | 354 | /* |
@@ -336,20 +360,110 @@ static inline bool use_multiport(struct ports_device *portdev) | |||
336 | return portdev->vdev->features[0] & (1 << VIRTIO_CONSOLE_F_MULTIPORT); | 360 | return portdev->vdev->features[0] & (1 << VIRTIO_CONSOLE_F_MULTIPORT); |
337 | } | 361 | } |
338 | 362 | ||
339 | static void free_buf(struct port_buffer *buf) | 363 | static DEFINE_SPINLOCK(dma_bufs_lock); |
364 | static LIST_HEAD(pending_free_dma_bufs); | ||
365 | |||
366 | static void free_buf(struct port_buffer *buf, bool can_sleep) | ||
340 | { | 367 | { |
341 | kfree(buf->buf); | 368 | unsigned int i; |
369 | |||
370 | for (i = 0; i < buf->sgpages; i++) { | ||
371 | struct page *page = sg_page(&buf->sg[i]); | ||
372 | if (!page) | ||
373 | break; | ||
374 | put_page(page); | ||
375 | } | ||
376 | |||
377 | if (!buf->dev) { | ||
378 | kfree(buf->buf); | ||
379 | } else if (is_rproc_enabled) { | ||
380 | unsigned long flags; | ||
381 | |||
382 | /* dma_free_coherent requires interrupts to be enabled. */ | ||
383 | if (!can_sleep) { | ||
384 | /* queue up dma-buffers to be freed later */ | ||
385 | spin_lock_irqsave(&dma_bufs_lock, flags); | ||
386 | list_add_tail(&buf->list, &pending_free_dma_bufs); | ||
387 | spin_unlock_irqrestore(&dma_bufs_lock, flags); | ||
388 | return; | ||
389 | } | ||
390 | dma_free_coherent(buf->dev, buf->size, buf->buf, buf->dma); | ||
391 | |||
392 | /* Release device refcnt and allow it to be freed */ | ||
393 | put_device(buf->dev); | ||
394 | } | ||
395 | |||
342 | kfree(buf); | 396 | kfree(buf); |
343 | } | 397 | } |
344 | 398 | ||
345 | static struct port_buffer *alloc_buf(size_t buf_size) | 399 | static void reclaim_dma_bufs(void) |
400 | { | ||
401 | unsigned long flags; | ||
402 | struct port_buffer *buf, *tmp; | ||
403 | LIST_HEAD(tmp_list); | ||
404 | |||
405 | if (list_empty(&pending_free_dma_bufs)) | ||
406 | return; | ||
407 | |||
408 | /* Create a copy of the pending_free_dma_bufs while holding the lock */ | ||
409 | spin_lock_irqsave(&dma_bufs_lock, flags); | ||
410 | list_cut_position(&tmp_list, &pending_free_dma_bufs, | ||
411 | pending_free_dma_bufs.prev); | ||
412 | spin_unlock_irqrestore(&dma_bufs_lock, flags); | ||
413 | |||
414 | /* Release the dma buffers, without irqs enabled */ | ||
415 | list_for_each_entry_safe(buf, tmp, &tmp_list, list) { | ||
416 | list_del(&buf->list); | ||
417 | free_buf(buf, true); | ||
418 | } | ||
419 | } | ||
420 | |||
421 | static struct port_buffer *alloc_buf(struct virtqueue *vq, size_t buf_size, | ||
422 | int pages) | ||
346 | { | 423 | { |
347 | struct port_buffer *buf; | 424 | struct port_buffer *buf; |
348 | 425 | ||
349 | buf = kmalloc(sizeof(*buf), GFP_KERNEL); | 426 | reclaim_dma_bufs(); |
427 | |||
428 | /* | ||
429 | * Allocate buffer and the sg list. The sg list array is allocated | ||
430 | * directly after the port_buffer struct. | ||
431 | */ | ||
432 | buf = kmalloc(sizeof(*buf) + sizeof(struct scatterlist) * pages, | ||
433 | GFP_KERNEL); | ||
350 | if (!buf) | 434 | if (!buf) |
351 | goto fail; | 435 | goto fail; |
352 | buf->buf = kzalloc(buf_size, GFP_KERNEL); | 436 | |
437 | buf->sgpages = pages; | ||
438 | if (pages > 0) { | ||
439 | buf->dev = NULL; | ||
440 | buf->buf = NULL; | ||
441 | return buf; | ||
442 | } | ||
443 | |||
444 | if (is_rproc_serial(vq->vdev)) { | ||
445 | /* | ||
446 | * Allocate DMA memory from ancestor. When a virtio | ||
447 | * device is created by remoteproc, the DMA memory is | ||
448 | * associated with the grandparent device: | ||
449 | * vdev => rproc => platform-dev. | ||
450 | * The code here would have been less quirky if | ||
451 | * DMA_MEMORY_INCLUDES_CHILDREN had been supported | ||
452 | * in dma-coherent.c | ||
453 | */ | ||
454 | if (!vq->vdev->dev.parent || !vq->vdev->dev.parent->parent) | ||
455 | goto free_buf; | ||
456 | buf->dev = vq->vdev->dev.parent->parent; | ||
457 | |||
458 | /* Increase device refcnt to avoid freeing it */ | ||
459 | get_device(buf->dev); | ||
460 | buf->buf = dma_alloc_coherent(buf->dev, buf_size, &buf->dma, | ||
461 | GFP_KERNEL); | ||
462 | } else { | ||
463 | buf->dev = NULL; | ||
464 | buf->buf = kmalloc(buf_size, GFP_KERNEL); | ||
465 | } | ||
466 | |||
353 | if (!buf->buf) | 467 | if (!buf->buf) |
354 | goto free_buf; | 468 | goto free_buf; |
355 | buf->len = 0; | 469 | buf->len = 0; |
@@ -396,6 +510,8 @@ static int add_inbuf(struct virtqueue *vq, struct port_buffer *buf) | |||
396 | 510 | ||
397 | ret = virtqueue_add_buf(vq, sg, 0, 1, buf, GFP_ATOMIC); | 511 | ret = virtqueue_add_buf(vq, sg, 0, 1, buf, GFP_ATOMIC); |
398 | virtqueue_kick(vq); | 512 | virtqueue_kick(vq); |
513 | if (!ret) | ||
514 | ret = vq->num_free; | ||
399 | return ret; | 515 | return ret; |
400 | } | 516 | } |
401 | 517 | ||
@@ -416,7 +532,7 @@ static void discard_port_data(struct port *port) | |||
416 | port->stats.bytes_discarded += buf->len - buf->offset; | 532 | port->stats.bytes_discarded += buf->len - buf->offset; |
417 | if (add_inbuf(port->in_vq, buf) < 0) { | 533 | if (add_inbuf(port->in_vq, buf) < 0) { |
418 | err++; | 534 | err++; |
419 | free_buf(buf); | 535 | free_buf(buf, false); |
420 | } | 536 | } |
421 | port->inbuf = NULL; | 537 | port->inbuf = NULL; |
422 | buf = get_inbuf(port); | 538 | buf = get_inbuf(port); |
@@ -459,7 +575,7 @@ static ssize_t __send_control_msg(struct ports_device *portdev, u32 port_id, | |||
459 | vq = portdev->c_ovq; | 575 | vq = portdev->c_ovq; |
460 | 576 | ||
461 | sg_init_one(sg, &cpkt, sizeof(cpkt)); | 577 | sg_init_one(sg, &cpkt, sizeof(cpkt)); |
462 | if (virtqueue_add_buf(vq, sg, 1, 0, &cpkt, GFP_ATOMIC) >= 0) { | 578 | if (virtqueue_add_buf(vq, sg, 1, 0, &cpkt, GFP_ATOMIC) == 0) { |
463 | virtqueue_kick(vq); | 579 | virtqueue_kick(vq); |
464 | while (!virtqueue_get_buf(vq, &len)) | 580 | while (!virtqueue_get_buf(vq, &len)) |
465 | cpu_relax(); | 581 | cpu_relax(); |
@@ -476,55 +592,29 @@ static ssize_t send_control_msg(struct port *port, unsigned int event, | |||
476 | return 0; | 592 | return 0; |
477 | } | 593 | } |
478 | 594 | ||
479 | struct buffer_token { | ||
480 | union { | ||
481 | void *buf; | ||
482 | struct scatterlist *sg; | ||
483 | } u; | ||
484 | /* If sgpages == 0 then buf is used, else sg is used */ | ||
485 | unsigned int sgpages; | ||
486 | }; | ||
487 | |||
488 | static void reclaim_sg_pages(struct scatterlist *sg, unsigned int nrpages) | ||
489 | { | ||
490 | int i; | ||
491 | struct page *page; | ||
492 | |||
493 | for (i = 0; i < nrpages; i++) { | ||
494 | page = sg_page(&sg[i]); | ||
495 | if (!page) | ||
496 | break; | ||
497 | put_page(page); | ||
498 | } | ||
499 | kfree(sg); | ||
500 | } | ||
501 | 595 | ||
502 | /* Callers must take the port->outvq_lock */ | 596 | /* Callers must take the port->outvq_lock */ |
503 | static void reclaim_consumed_buffers(struct port *port) | 597 | static void reclaim_consumed_buffers(struct port *port) |
504 | { | 598 | { |
505 | struct buffer_token *tok; | 599 | struct port_buffer *buf; |
506 | unsigned int len; | 600 | unsigned int len; |
507 | 601 | ||
508 | if (!port->portdev) { | 602 | if (!port->portdev) { |
509 | /* Device has been unplugged. vqs are already gone. */ | 603 | /* Device has been unplugged. vqs are already gone. */ |
510 | return; | 604 | return; |
511 | } | 605 | } |
512 | while ((tok = virtqueue_get_buf(port->out_vq, &len))) { | 606 | while ((buf = virtqueue_get_buf(port->out_vq, &len))) { |
513 | if (tok->sgpages) | 607 | free_buf(buf, false); |
514 | reclaim_sg_pages(tok->u.sg, tok->sgpages); | ||
515 | else | ||
516 | kfree(tok->u.buf); | ||
517 | kfree(tok); | ||
518 | port->outvq_full = false; | 608 | port->outvq_full = false; |
519 | } | 609 | } |
520 | } | 610 | } |
521 | 611 | ||
522 | static ssize_t __send_to_port(struct port *port, struct scatterlist *sg, | 612 | static ssize_t __send_to_port(struct port *port, struct scatterlist *sg, |
523 | int nents, size_t in_count, | 613 | int nents, size_t in_count, |
524 | struct buffer_token *tok, bool nonblock) | 614 | void *data, bool nonblock) |
525 | { | 615 | { |
526 | struct virtqueue *out_vq; | 616 | struct virtqueue *out_vq; |
527 | ssize_t ret; | 617 | int err; |
528 | unsigned long flags; | 618 | unsigned long flags; |
529 | unsigned int len; | 619 | unsigned int len; |
530 | 620 | ||
@@ -534,17 +624,17 @@ static ssize_t __send_to_port(struct port *port, struct scatterlist *sg, | |||
534 | 624 | ||
535 | reclaim_consumed_buffers(port); | 625 | reclaim_consumed_buffers(port); |
536 | 626 | ||
537 | ret = virtqueue_add_buf(out_vq, sg, nents, 0, tok, GFP_ATOMIC); | 627 | err = virtqueue_add_buf(out_vq, sg, nents, 0, data, GFP_ATOMIC); |
538 | 628 | ||
539 | /* Tell Host to go! */ | 629 | /* Tell Host to go! */ |
540 | virtqueue_kick(out_vq); | 630 | virtqueue_kick(out_vq); |
541 | 631 | ||
542 | if (ret < 0) { | 632 | if (err) { |
543 | in_count = 0; | 633 | in_count = 0; |
544 | goto done; | 634 | goto done; |
545 | } | 635 | } |
546 | 636 | ||
547 | if (ret == 0) | 637 | if (out_vq->num_free == 0) |
548 | port->outvq_full = true; | 638 | port->outvq_full = true; |
549 | 639 | ||
550 | if (nonblock) | 640 | if (nonblock) |
@@ -572,37 +662,6 @@ done: | |||
572 | return in_count; | 662 | return in_count; |
573 | } | 663 | } |
574 | 664 | ||
575 | static ssize_t send_buf(struct port *port, void *in_buf, size_t in_count, | ||
576 | bool nonblock) | ||
577 | { | ||
578 | struct scatterlist sg[1]; | ||
579 | struct buffer_token *tok; | ||
580 | |||
581 | tok = kmalloc(sizeof(*tok), GFP_ATOMIC); | ||
582 | if (!tok) | ||
583 | return -ENOMEM; | ||
584 | tok->sgpages = 0; | ||
585 | tok->u.buf = in_buf; | ||
586 | |||
587 | sg_init_one(sg, in_buf, in_count); | ||
588 | |||
589 | return __send_to_port(port, sg, 1, in_count, tok, nonblock); | ||
590 | } | ||
591 | |||
592 | static ssize_t send_pages(struct port *port, struct scatterlist *sg, int nents, | ||
593 | size_t in_count, bool nonblock) | ||
594 | { | ||
595 | struct buffer_token *tok; | ||
596 | |||
597 | tok = kmalloc(sizeof(*tok), GFP_ATOMIC); | ||
598 | if (!tok) | ||
599 | return -ENOMEM; | ||
600 | tok->sgpages = nents; | ||
601 | tok->u.sg = sg; | ||
602 | |||
603 | return __send_to_port(port, sg, nents, in_count, tok, nonblock); | ||
604 | } | ||
605 | |||
606 | /* | 665 | /* |
607 | * Give out the data that's requested from the buffer that we have | 666 | * Give out the data that's requested from the buffer that we have |
608 | * queued up. | 667 | * queued up. |
@@ -748,9 +807,10 @@ static ssize_t port_fops_write(struct file *filp, const char __user *ubuf, | |||
748 | size_t count, loff_t *offp) | 807 | size_t count, loff_t *offp) |
749 | { | 808 | { |
750 | struct port *port; | 809 | struct port *port; |
751 | char *buf; | 810 | struct port_buffer *buf; |
752 | ssize_t ret; | 811 | ssize_t ret; |
753 | bool nonblock; | 812 | bool nonblock; |
813 | struct scatterlist sg[1]; | ||
754 | 814 | ||
755 | /* Userspace could be out to fool us */ | 815 | /* Userspace could be out to fool us */ |
756 | if (!count) | 816 | if (!count) |
@@ -766,11 +826,11 @@ static ssize_t port_fops_write(struct file *filp, const char __user *ubuf, | |||
766 | 826 | ||
767 | count = min((size_t)(32 * 1024), count); | 827 | count = min((size_t)(32 * 1024), count); |
768 | 828 | ||
769 | buf = kmalloc(count, GFP_KERNEL); | 829 | buf = alloc_buf(port->out_vq, count, 0); |
770 | if (!buf) | 830 | if (!buf) |
771 | return -ENOMEM; | 831 | return -ENOMEM; |
772 | 832 | ||
773 | ret = copy_from_user(buf, ubuf, count); | 833 | ret = copy_from_user(buf->buf, ubuf, count); |
774 | if (ret) { | 834 | if (ret) { |
775 | ret = -EFAULT; | 835 | ret = -EFAULT; |
776 | goto free_buf; | 836 | goto free_buf; |
@@ -784,13 +844,14 @@ static ssize_t port_fops_write(struct file *filp, const char __user *ubuf, | |||
784 | * through to the host. | 844 | * through to the host. |
785 | */ | 845 | */ |
786 | nonblock = true; | 846 | nonblock = true; |
787 | ret = send_buf(port, buf, count, nonblock); | 847 | sg_init_one(sg, buf->buf, count); |
848 | ret = __send_to_port(port, sg, 1, count, buf, nonblock); | ||
788 | 849 | ||
789 | if (nonblock && ret > 0) | 850 | if (nonblock && ret > 0) |
790 | goto out; | 851 | goto out; |
791 | 852 | ||
792 | free_buf: | 853 | free_buf: |
793 | kfree(buf); | 854 | free_buf(buf, true); |
794 | out: | 855 | out: |
795 | return ret; | 856 | return ret; |
796 | } | 857 | } |
@@ -856,6 +917,7 @@ static ssize_t port_fops_splice_write(struct pipe_inode_info *pipe, | |||
856 | struct port *port = filp->private_data; | 917 | struct port *port = filp->private_data; |
857 | struct sg_list sgl; | 918 | struct sg_list sgl; |
858 | ssize_t ret; | 919 | ssize_t ret; |
920 | struct port_buffer *buf; | ||
859 | struct splice_desc sd = { | 921 | struct splice_desc sd = { |
860 | .total_len = len, | 922 | .total_len = len, |
861 | .flags = flags, | 923 | .flags = flags, |
@@ -863,22 +925,34 @@ static ssize_t port_fops_splice_write(struct pipe_inode_info *pipe, | |||
863 | .u.data = &sgl, | 925 | .u.data = &sgl, |
864 | }; | 926 | }; |
865 | 927 | ||
928 | /* | ||
929 | * Rproc_serial does not yet support splice. To support splice | ||
930 | * pipe_to_sg() must allocate dma-buffers and copy content from | ||
931 | * regular pages to dma pages. And alloc_buf and free_buf must | ||
932 | * support allocating and freeing such a list of dma-buffers. | ||
933 | */ | ||
934 | if (is_rproc_serial(port->out_vq->vdev)) | ||
935 | return -EINVAL; | ||
936 | |||
866 | ret = wait_port_writable(port, filp->f_flags & O_NONBLOCK); | 937 | ret = wait_port_writable(port, filp->f_flags & O_NONBLOCK); |
867 | if (ret < 0) | 938 | if (ret < 0) |
868 | return ret; | 939 | return ret; |
869 | 940 | ||
941 | buf = alloc_buf(port->out_vq, 0, pipe->nrbufs); | ||
942 | if (!buf) | ||
943 | return -ENOMEM; | ||
944 | |||
870 | sgl.n = 0; | 945 | sgl.n = 0; |
871 | sgl.len = 0; | 946 | sgl.len = 0; |
872 | sgl.size = pipe->nrbufs; | 947 | sgl.size = pipe->nrbufs; |
873 | sgl.sg = kmalloc(sizeof(struct scatterlist) * sgl.size, GFP_KERNEL); | 948 | sgl.sg = buf->sg; |
874 | if (unlikely(!sgl.sg)) | ||
875 | return -ENOMEM; | ||
876 | |||
877 | sg_init_table(sgl.sg, sgl.size); | 949 | sg_init_table(sgl.sg, sgl.size); |
878 | ret = __splice_from_pipe(pipe, &sd, pipe_to_sg); | 950 | ret = __splice_from_pipe(pipe, &sd, pipe_to_sg); |
879 | if (likely(ret > 0)) | 951 | if (likely(ret > 0)) |
880 | ret = send_pages(port, sgl.sg, sgl.n, sgl.len, true); | 952 | ret = __send_to_port(port, buf->sg, sgl.n, sgl.len, buf, true); |
881 | 953 | ||
954 | if (unlikely(ret <= 0)) | ||
955 | free_buf(buf, true); | ||
882 | return ret; | 956 | return ret; |
883 | } | 957 | } |
884 | 958 | ||
@@ -927,6 +1001,7 @@ static int port_fops_release(struct inode *inode, struct file *filp) | |||
927 | reclaim_consumed_buffers(port); | 1001 | reclaim_consumed_buffers(port); |
928 | spin_unlock_irq(&port->outvq_lock); | 1002 | spin_unlock_irq(&port->outvq_lock); |
929 | 1003 | ||
1004 | reclaim_dma_bufs(); | ||
930 | /* | 1005 | /* |
931 | * Locks aren't necessary here as a port can't be opened after | 1006 | * Locks aren't necessary here as a port can't be opened after |
932 | * unplug, and if a port isn't unplugged, a kref would already | 1007 | * unplug, and if a port isn't unplugged, a kref would already |
@@ -1031,6 +1106,7 @@ static const struct file_operations port_fops = { | |||
1031 | static int put_chars(u32 vtermno, const char *buf, int count) | 1106 | static int put_chars(u32 vtermno, const char *buf, int count) |
1032 | { | 1107 | { |
1033 | struct port *port; | 1108 | struct port *port; |
1109 | struct scatterlist sg[1]; | ||
1034 | 1110 | ||
1035 | if (unlikely(early_put_chars)) | 1111 | if (unlikely(early_put_chars)) |
1036 | return early_put_chars(vtermno, buf, count); | 1112 | return early_put_chars(vtermno, buf, count); |
@@ -1039,7 +1115,8 @@ static int put_chars(u32 vtermno, const char *buf, int count) | |||
1039 | if (!port) | 1115 | if (!port) |
1040 | return -EPIPE; | 1116 | return -EPIPE; |
1041 | 1117 | ||
1042 | return send_buf(port, (void *)buf, count, false); | 1118 | sg_init_one(sg, buf, count); |
1119 | return __send_to_port(port, sg, 1, count, (void *)buf, false); | ||
1043 | } | 1120 | } |
1044 | 1121 | ||
1045 | /* | 1122 | /* |
@@ -1076,7 +1153,10 @@ static void resize_console(struct port *port) | |||
1076 | return; | 1153 | return; |
1077 | 1154 | ||
1078 | vdev = port->portdev->vdev; | 1155 | vdev = port->portdev->vdev; |
1079 | if (virtio_has_feature(vdev, VIRTIO_CONSOLE_F_SIZE)) | 1156 | |
1157 | /* Don't test F_SIZE at all if we're rproc: not a valid feature! */ | ||
1158 | if (!is_rproc_serial(vdev) && | ||
1159 | virtio_has_feature(vdev, VIRTIO_CONSOLE_F_SIZE)) | ||
1080 | hvc_resize(port->cons.hvc, port->cons.ws); | 1160 | hvc_resize(port->cons.hvc, port->cons.ws); |
1081 | } | 1161 | } |
1082 | 1162 | ||
@@ -1260,7 +1340,7 @@ static unsigned int fill_queue(struct virtqueue *vq, spinlock_t *lock) | |||
1260 | 1340 | ||
1261 | nr_added_bufs = 0; | 1341 | nr_added_bufs = 0; |
1262 | do { | 1342 | do { |
1263 | buf = alloc_buf(PAGE_SIZE); | 1343 | buf = alloc_buf(vq, PAGE_SIZE, 0); |
1264 | if (!buf) | 1344 | if (!buf) |
1265 | break; | 1345 | break; |
1266 | 1346 | ||
@@ -1268,7 +1348,7 @@ static unsigned int fill_queue(struct virtqueue *vq, spinlock_t *lock) | |||
1268 | ret = add_inbuf(vq, buf); | 1348 | ret = add_inbuf(vq, buf); |
1269 | if (ret < 0) { | 1349 | if (ret < 0) { |
1270 | spin_unlock_irq(lock); | 1350 | spin_unlock_irq(lock); |
1271 | free_buf(buf); | 1351 | free_buf(buf, true); |
1272 | break; | 1352 | break; |
1273 | } | 1353 | } |
1274 | nr_added_bufs++; | 1354 | nr_added_bufs++; |
@@ -1356,10 +1436,18 @@ static int add_port(struct ports_device *portdev, u32 id) | |||
1356 | goto free_device; | 1436 | goto free_device; |
1357 | } | 1437 | } |
1358 | 1438 | ||
1359 | /* | 1439 | if (is_rproc_serial(port->portdev->vdev)) |
1360 | * If we're not using multiport support, this has to be a console port | 1440 | /* |
1361 | */ | 1441 | * For rproc_serial assume remote processor is connected. |
1362 | if (!use_multiport(port->portdev)) { | 1442 | * rproc_serial does not want the console port, only |
1443 | * the generic port implementation. | ||
1444 | */ | ||
1445 | port->host_connected = true; | ||
1446 | else if (!use_multiport(port->portdev)) { | ||
1447 | /* | ||
1448 | * If we're not using multiport support, | ||
1449 | * this has to be a console port. | ||
1450 | */ | ||
1363 | err = init_port_console(port); | 1451 | err = init_port_console(port); |
1364 | if (err) | 1452 | if (err) |
1365 | goto free_inbufs; | 1453 | goto free_inbufs; |
@@ -1392,7 +1480,7 @@ static int add_port(struct ports_device *portdev, u32 id) | |||
1392 | 1480 | ||
1393 | free_inbufs: | 1481 | free_inbufs: |
1394 | while ((buf = virtqueue_detach_unused_buf(port->in_vq))) | 1482 | while ((buf = virtqueue_detach_unused_buf(port->in_vq))) |
1395 | free_buf(buf); | 1483 | free_buf(buf, true); |
1396 | free_device: | 1484 | free_device: |
1397 | device_destroy(pdrvdata.class, port->dev->devt); | 1485 | device_destroy(pdrvdata.class, port->dev->devt); |
1398 | free_cdev: | 1486 | free_cdev: |
@@ -1434,7 +1522,11 @@ static void remove_port_data(struct port *port) | |||
1434 | 1522 | ||
1435 | /* Remove buffers we queued up for the Host to send us data in. */ | 1523 | /* Remove buffers we queued up for the Host to send us data in. */ |
1436 | while ((buf = virtqueue_detach_unused_buf(port->in_vq))) | 1524 | while ((buf = virtqueue_detach_unused_buf(port->in_vq))) |
1437 | free_buf(buf); | 1525 | free_buf(buf, true); |
1526 | |||
1527 | /* Free pending buffers from the out-queue. */ | ||
1528 | while ((buf = virtqueue_detach_unused_buf(port->out_vq))) | ||
1529 | free_buf(buf, true); | ||
1438 | } | 1530 | } |
1439 | 1531 | ||
1440 | /* | 1532 | /* |
@@ -1636,7 +1728,7 @@ static void control_work_handler(struct work_struct *work) | |||
1636 | if (add_inbuf(portdev->c_ivq, buf) < 0) { | 1728 | if (add_inbuf(portdev->c_ivq, buf) < 0) { |
1637 | dev_warn(&portdev->vdev->dev, | 1729 | dev_warn(&portdev->vdev->dev, |
1638 | "Error adding buffer to queue\n"); | 1730 | "Error adding buffer to queue\n"); |
1639 | free_buf(buf); | 1731 | free_buf(buf, false); |
1640 | } | 1732 | } |
1641 | } | 1733 | } |
1642 | spin_unlock(&portdev->cvq_lock); | 1734 | spin_unlock(&portdev->cvq_lock); |
@@ -1832,10 +1924,10 @@ static void remove_controlq_data(struct ports_device *portdev) | |||
1832 | return; | 1924 | return; |
1833 | 1925 | ||
1834 | while ((buf = virtqueue_get_buf(portdev->c_ivq, &len))) | 1926 | while ((buf = virtqueue_get_buf(portdev->c_ivq, &len))) |
1835 | free_buf(buf); | 1927 | free_buf(buf, true); |
1836 | 1928 | ||
1837 | while ((buf = virtqueue_detach_unused_buf(portdev->c_ivq))) | 1929 | while ((buf = virtqueue_detach_unused_buf(portdev->c_ivq))) |
1838 | free_buf(buf); | 1930 | free_buf(buf, true); |
1839 | } | 1931 | } |
1840 | 1932 | ||
1841 | /* | 1933 | /* |
@@ -1882,11 +1974,15 @@ static int virtcons_probe(struct virtio_device *vdev) | |||
1882 | 1974 | ||
1883 | multiport = false; | 1975 | multiport = false; |
1884 | portdev->config.max_nr_ports = 1; | 1976 | portdev->config.max_nr_ports = 1; |
1885 | if (virtio_config_val(vdev, VIRTIO_CONSOLE_F_MULTIPORT, | 1977 | |
1886 | offsetof(struct virtio_console_config, | 1978 | /* Don't test MULTIPORT at all if we're rproc: not a valid feature! */ |
1887 | max_nr_ports), | 1979 | if (!is_rproc_serial(vdev) && |
1888 | &portdev->config.max_nr_ports) == 0) | 1980 | virtio_config_val(vdev, VIRTIO_CONSOLE_F_MULTIPORT, |
1981 | offsetof(struct virtio_console_config, | ||
1982 | max_nr_ports), | ||
1983 | &portdev->config.max_nr_ports) == 0) { | ||
1889 | multiport = true; | 1984 | multiport = true; |
1985 | } | ||
1890 | 1986 | ||
1891 | err = init_vqs(portdev); | 1987 | err = init_vqs(portdev); |
1892 | if (err < 0) { | 1988 | if (err < 0) { |
@@ -1996,6 +2092,16 @@ static unsigned int features[] = { | |||
1996 | VIRTIO_CONSOLE_F_MULTIPORT, | 2092 | VIRTIO_CONSOLE_F_MULTIPORT, |
1997 | }; | 2093 | }; |
1998 | 2094 | ||
2095 | static struct virtio_device_id rproc_serial_id_table[] = { | ||
2096 | #if IS_ENABLED(CONFIG_REMOTEPROC) | ||
2097 | { VIRTIO_ID_RPROC_SERIAL, VIRTIO_DEV_ANY_ID }, | ||
2098 | #endif | ||
2099 | { 0 }, | ||
2100 | }; | ||
2101 | |||
2102 | static unsigned int rproc_serial_features[] = { | ||
2103 | }; | ||
2104 | |||
1999 | #ifdef CONFIG_PM | 2105 | #ifdef CONFIG_PM |
2000 | static int virtcons_freeze(struct virtio_device *vdev) | 2106 | static int virtcons_freeze(struct virtio_device *vdev) |
2001 | { | 2107 | { |
@@ -2080,6 +2186,20 @@ static struct virtio_driver virtio_console = { | |||
2080 | #endif | 2186 | #endif |
2081 | }; | 2187 | }; |
2082 | 2188 | ||
2189 | /* | ||
2190 | * virtio_rproc_serial refers to __devinit function which causes | ||
2191 | * section mismatch warnings. So use __refdata to silence warnings. | ||
2192 | */ | ||
2193 | static struct virtio_driver __refdata virtio_rproc_serial = { | ||
2194 | .feature_table = rproc_serial_features, | ||
2195 | .feature_table_size = ARRAY_SIZE(rproc_serial_features), | ||
2196 | .driver.name = "virtio_rproc_serial", | ||
2197 | .driver.owner = THIS_MODULE, | ||
2198 | .id_table = rproc_serial_id_table, | ||
2199 | .probe = virtcons_probe, | ||
2200 | .remove = virtcons_remove, | ||
2201 | }; | ||
2202 | |||
2083 | static int __init init(void) | 2203 | static int __init init(void) |
2084 | { | 2204 | { |
2085 | int err; | 2205 | int err; |
@@ -2104,7 +2224,15 @@ static int __init init(void) | |||
2104 | pr_err("Error %d registering virtio driver\n", err); | 2224 | pr_err("Error %d registering virtio driver\n", err); |
2105 | goto free; | 2225 | goto free; |
2106 | } | 2226 | } |
2227 | err = register_virtio_driver(&virtio_rproc_serial); | ||
2228 | if (err < 0) { | ||
2229 | pr_err("Error %d registering virtio rproc serial driver\n", | ||
2230 | err); | ||
2231 | goto unregister; | ||
2232 | } | ||
2107 | return 0; | 2233 | return 0; |
2234 | unregister: | ||
2235 | unregister_virtio_driver(&virtio_console); | ||
2108 | free: | 2236 | free: |
2109 | if (pdrvdata.debugfs_dir) | 2237 | if (pdrvdata.debugfs_dir) |
2110 | debugfs_remove_recursive(pdrvdata.debugfs_dir); | 2238 | debugfs_remove_recursive(pdrvdata.debugfs_dir); |
@@ -2114,7 +2242,10 @@ free: | |||
2114 | 2242 | ||
2115 | static void __exit fini(void) | 2243 | static void __exit fini(void) |
2116 | { | 2244 | { |
2245 | reclaim_dma_bufs(); | ||
2246 | |||
2117 | unregister_virtio_driver(&virtio_console); | 2247 | unregister_virtio_driver(&virtio_console); |
2248 | unregister_virtio_driver(&virtio_rproc_serial); | ||
2118 | 2249 | ||
2119 | class_destroy(pdrvdata.class); | 2250 | class_destroy(pdrvdata.class); |
2120 | if (pdrvdata.debugfs_dir) | 2251 | if (pdrvdata.debugfs_dir) |
diff --git a/drivers/hwmon/hwmon-vid.c b/drivers/hwmon/hwmon-vid.c index 9f26400713f0..89cfd64b3373 100644 --- a/drivers/hwmon/hwmon-vid.c +++ b/drivers/hwmon/hwmon-vid.c | |||
@@ -115,6 +115,12 @@ int vid_from_reg(int val, u8 vrm) | |||
115 | return (val < 32) ? 1550 - 25 * val | 115 | return (val < 32) ? 1550 - 25 * val |
116 | : 775 - (25 * (val - 31)) / 2; | 116 | : 775 - (25 * (val - 31)) / 2; |
117 | 117 | ||
118 | case 26: /* AMD family 10h to 15h, serial VID */ | ||
119 | val &= 0x7f; | ||
120 | if (val >= 0x7c) | ||
121 | return 0; | ||
122 | return DIV_ROUND_CLOSEST(15500 - 125 * val, 10); | ||
123 | |||
118 | case 91: /* VRM 9.1 */ | 124 | case 91: /* VRM 9.1 */ |
119 | case 90: /* VRM 9.0 */ | 125 | case 90: /* VRM 9.0 */ |
120 | val &= 0x1f; | 126 | val &= 0x1f; |
@@ -195,6 +201,10 @@ static struct vrm_model vrm_models[] = { | |||
195 | {X86_VENDOR_AMD, 0xF, 0x40, 0x7F, ANY, 24}, /* NPT family 0Fh */ | 201 | {X86_VENDOR_AMD, 0xF, 0x40, 0x7F, ANY, 24}, /* NPT family 0Fh */ |
196 | {X86_VENDOR_AMD, 0xF, 0x80, ANY, ANY, 25}, /* future fam. 0Fh */ | 202 | {X86_VENDOR_AMD, 0xF, 0x80, ANY, ANY, 25}, /* future fam. 0Fh */ |
197 | {X86_VENDOR_AMD, 0x10, 0x0, ANY, ANY, 25}, /* NPT family 10h */ | 203 | {X86_VENDOR_AMD, 0x10, 0x0, ANY, ANY, 25}, /* NPT family 10h */ |
204 | {X86_VENDOR_AMD, 0x11, 0x0, ANY, ANY, 26}, /* family 11h */ | ||
205 | {X86_VENDOR_AMD, 0x12, 0x0, ANY, ANY, 26}, /* family 12h */ | ||
206 | {X86_VENDOR_AMD, 0x14, 0x0, ANY, ANY, 26}, /* family 14h */ | ||
207 | {X86_VENDOR_AMD, 0x15, 0x0, ANY, ANY, 26}, /* family 15h */ | ||
198 | 208 | ||
199 | {X86_VENDOR_INTEL, 0x6, 0x0, 0x6, ANY, 82}, /* Pentium Pro, | 209 | {X86_VENDOR_INTEL, 0x6, 0x0, 0x6, ANY, 82}, /* Pentium Pro, |
200 | * Pentium II, Xeon, | 210 | * Pentium II, Xeon, |
diff --git a/drivers/hwmon/hwmon.c b/drivers/hwmon/hwmon.c index c3c471ca202f..646314f7c839 100644 --- a/drivers/hwmon/hwmon.c +++ b/drivers/hwmon/hwmon.c | |||
@@ -84,19 +84,21 @@ static void __init hwmon_pci_quirks(void) | |||
84 | 84 | ||
85 | /* Open access to 0x295-0x296 on MSI MS-7031 */ | 85 | /* Open access to 0x295-0x296 on MSI MS-7031 */ |
86 | sb = pci_get_device(PCI_VENDOR_ID_ATI, 0x436c, NULL); | 86 | sb = pci_get_device(PCI_VENDOR_ID_ATI, 0x436c, NULL); |
87 | if (sb && | 87 | if (sb) { |
88 | (sb->subsystem_vendor == 0x1462 && /* MSI */ | 88 | if (sb->subsystem_vendor == 0x1462 && /* MSI */ |
89 | sb->subsystem_device == 0x0031)) { /* MS-7031 */ | 89 | sb->subsystem_device == 0x0031) { /* MS-7031 */ |
90 | 90 | pci_read_config_byte(sb, 0x48, &enable); | |
91 | pci_read_config_byte(sb, 0x48, &enable); | 91 | pci_read_config_word(sb, 0x64, &base); |
92 | pci_read_config_word(sb, 0x64, &base); | 92 | |
93 | 93 | if (base == 0 && !(enable & BIT(2))) { | |
94 | if (base == 0 && !(enable & BIT(2))) { | 94 | dev_info(&sb->dev, |
95 | dev_info(&sb->dev, | 95 | "Opening wide generic port at 0x295\n"); |
96 | "Opening wide generic port at 0x295\n"); | 96 | pci_write_config_word(sb, 0x64, 0x295); |
97 | pci_write_config_word(sb, 0x64, 0x295); | 97 | pci_write_config_byte(sb, 0x48, |
98 | pci_write_config_byte(sb, 0x48, enable | BIT(2)); | 98 | enable | BIT(2)); |
99 | } | ||
99 | } | 100 | } |
101 | pci_dev_put(sb); | ||
100 | } | 102 | } |
101 | #endif | 103 | #endif |
102 | } | 104 | } |
diff --git a/drivers/hwmon/it87.c b/drivers/hwmon/it87.c index d32aa354cbdf..117d66fcded6 100644 --- a/drivers/hwmon/it87.c +++ b/drivers/hwmon/it87.c | |||
@@ -203,6 +203,8 @@ static const u8 IT87_REG_FAN[] = { 0x0d, 0x0e, 0x0f, 0x80, 0x82 }; | |||
203 | static const u8 IT87_REG_FAN_MIN[] = { 0x10, 0x11, 0x12, 0x84, 0x86 }; | 203 | static const u8 IT87_REG_FAN_MIN[] = { 0x10, 0x11, 0x12, 0x84, 0x86 }; |
204 | static const u8 IT87_REG_FANX[] = { 0x18, 0x19, 0x1a, 0x81, 0x83 }; | 204 | static const u8 IT87_REG_FANX[] = { 0x18, 0x19, 0x1a, 0x81, 0x83 }; |
205 | static const u8 IT87_REG_FANX_MIN[] = { 0x1b, 0x1c, 0x1d, 0x85, 0x87 }; | 205 | static const u8 IT87_REG_FANX_MIN[] = { 0x1b, 0x1c, 0x1d, 0x85, 0x87 }; |
206 | static const u8 IT87_REG_TEMP_OFFSET[] = { 0x56, 0x57, 0x59 }; | ||
207 | |||
206 | #define IT87_REG_FAN_MAIN_CTRL 0x13 | 208 | #define IT87_REG_FAN_MAIN_CTRL 0x13 |
207 | #define IT87_REG_FAN_CTL 0x14 | 209 | #define IT87_REG_FAN_CTL 0x14 |
208 | #define IT87_REG_PWM(nr) (0x15 + (nr)) | 210 | #define IT87_REG_PWM(nr) (0x15 + (nr)) |
@@ -226,6 +228,83 @@ static const u8 IT87_REG_FANX_MIN[] = { 0x1b, 0x1c, 0x1d, 0x85, 0x87 }; | |||
226 | #define IT87_REG_AUTO_TEMP(nr, i) (0x60 + (nr) * 8 + (i)) | 228 | #define IT87_REG_AUTO_TEMP(nr, i) (0x60 + (nr) * 8 + (i)) |
227 | #define IT87_REG_AUTO_PWM(nr, i) (0x65 + (nr) * 8 + (i)) | 229 | #define IT87_REG_AUTO_PWM(nr, i) (0x65 + (nr) * 8 + (i)) |
228 | 230 | ||
231 | struct it87_devices { | ||
232 | const char *name; | ||
233 | u16 features; | ||
234 | u8 peci_mask; | ||
235 | u8 old_peci_mask; | ||
236 | }; | ||
237 | |||
238 | #define FEAT_12MV_ADC (1 << 0) | ||
239 | #define FEAT_NEWER_AUTOPWM (1 << 1) | ||
240 | #define FEAT_OLD_AUTOPWM (1 << 2) | ||
241 | #define FEAT_16BIT_FANS (1 << 3) | ||
242 | #define FEAT_TEMP_OFFSET (1 << 4) | ||
243 | #define FEAT_TEMP_PECI (1 << 5) | ||
244 | #define FEAT_TEMP_OLD_PECI (1 << 6) | ||
245 | |||
246 | static const struct it87_devices it87_devices[] = { | ||
247 | [it87] = { | ||
248 | .name = "it87", | ||
249 | .features = FEAT_OLD_AUTOPWM, /* may need to overwrite */ | ||
250 | }, | ||
251 | [it8712] = { | ||
252 | .name = "it8712", | ||
253 | .features = FEAT_OLD_AUTOPWM, /* may need to overwrite */ | ||
254 | }, | ||
255 | [it8716] = { | ||
256 | .name = "it8716", | ||
257 | .features = FEAT_16BIT_FANS | FEAT_TEMP_OFFSET, | ||
258 | }, | ||
259 | [it8718] = { | ||
260 | .name = "it8718", | ||
261 | .features = FEAT_16BIT_FANS | FEAT_TEMP_OFFSET | ||
262 | | FEAT_TEMP_OLD_PECI, | ||
263 | .old_peci_mask = 0x4, | ||
264 | }, | ||
265 | [it8720] = { | ||
266 | .name = "it8720", | ||
267 | .features = FEAT_16BIT_FANS | FEAT_TEMP_OFFSET | ||
268 | | FEAT_TEMP_OLD_PECI, | ||
269 | .old_peci_mask = 0x4, | ||
270 | }, | ||
271 | [it8721] = { | ||
272 | .name = "it8721", | ||
273 | .features = FEAT_NEWER_AUTOPWM | FEAT_12MV_ADC | FEAT_16BIT_FANS | ||
274 | | FEAT_TEMP_OFFSET | FEAT_TEMP_OLD_PECI | FEAT_TEMP_PECI, | ||
275 | .peci_mask = 0x05, | ||
276 | .old_peci_mask = 0x02, /* Actually reports PCH */ | ||
277 | }, | ||
278 | [it8728] = { | ||
279 | .name = "it8728", | ||
280 | .features = FEAT_NEWER_AUTOPWM | FEAT_12MV_ADC | FEAT_16BIT_FANS | ||
281 | | FEAT_TEMP_OFFSET | FEAT_TEMP_PECI, | ||
282 | .peci_mask = 0x07, | ||
283 | }, | ||
284 | [it8782] = { | ||
285 | .name = "it8782", | ||
286 | .features = FEAT_16BIT_FANS | FEAT_TEMP_OFFSET | ||
287 | | FEAT_TEMP_OLD_PECI, | ||
288 | .old_peci_mask = 0x4, | ||
289 | }, | ||
290 | [it8783] = { | ||
291 | .name = "it8783", | ||
292 | .features = FEAT_16BIT_FANS | FEAT_TEMP_OFFSET | ||
293 | | FEAT_TEMP_OLD_PECI, | ||
294 | .old_peci_mask = 0x4, | ||
295 | }, | ||
296 | }; | ||
297 | |||
298 | #define has_16bit_fans(data) ((data)->features & FEAT_16BIT_FANS) | ||
299 | #define has_12mv_adc(data) ((data)->features & FEAT_12MV_ADC) | ||
300 | #define has_newer_autopwm(data) ((data)->features & FEAT_NEWER_AUTOPWM) | ||
301 | #define has_old_autopwm(data) ((data)->features & FEAT_OLD_AUTOPWM) | ||
302 | #define has_temp_offset(data) ((data)->features & FEAT_TEMP_OFFSET) | ||
303 | #define has_temp_peci(data, nr) (((data)->features & FEAT_TEMP_PECI) && \ | ||
304 | ((data)->peci_mask & (1 << nr))) | ||
305 | #define has_temp_old_peci(data, nr) \ | ||
306 | (((data)->features & FEAT_TEMP_OLD_PECI) && \ | ||
307 | ((data)->old_peci_mask & (1 << nr))) | ||
229 | 308 | ||
230 | struct it87_sio_data { | 309 | struct it87_sio_data { |
231 | enum chips type; | 310 | enum chips type; |
@@ -249,7 +328,9 @@ struct it87_sio_data { | |||
249 | struct it87_data { | 328 | struct it87_data { |
250 | struct device *hwmon_dev; | 329 | struct device *hwmon_dev; |
251 | enum chips type; | 330 | enum chips type; |
252 | u8 revision; | 331 | u16 features; |
332 | u8 peci_mask; | ||
333 | u8 old_peci_mask; | ||
253 | 334 | ||
254 | unsigned short addr; | 335 | unsigned short addr; |
255 | const char *name; | 336 | const char *name; |
@@ -258,17 +339,13 @@ struct it87_data { | |||
258 | unsigned long last_updated; /* In jiffies */ | 339 | unsigned long last_updated; /* In jiffies */ |
259 | 340 | ||
260 | u16 in_scaled; /* Internal voltage sensors are scaled */ | 341 | u16 in_scaled; /* Internal voltage sensors are scaled */ |
261 | u8 in[9]; /* Register value */ | 342 | u8 in[9][3]; /* [nr][0]=in, [1]=min, [2]=max */ |
262 | u8 in_max[8]; /* Register value */ | ||
263 | u8 in_min[8]; /* Register value */ | ||
264 | u8 has_fan; /* Bitfield, fans enabled */ | 343 | u8 has_fan; /* Bitfield, fans enabled */ |
265 | u16 fan[5]; /* Register values, possibly combined */ | 344 | u16 fan[5][2]; /* Register values, [nr][0]=fan, [1]=min */ |
266 | u16 fan_min[5]; /* Register values, possibly combined */ | ||
267 | u8 has_temp; /* Bitfield, temp sensors enabled */ | 345 | u8 has_temp; /* Bitfield, temp sensors enabled */ |
268 | s8 temp[3]; /* Register value */ | 346 | s8 temp[3][4]; /* [nr][0]=temp, [1]=min, [2]=max, [3]=offset */ |
269 | s8 temp_high[3]; /* Register value */ | 347 | u8 sensor; /* Register value (IT87_REG_TEMP_ENABLE) */ |
270 | s8 temp_low[3]; /* Register value */ | 348 | u8 extra; /* Register value (IT87_REG_TEMP_EXTRA) */ |
271 | u8 sensor; /* Register value */ | ||
272 | u8 fan_div[3]; /* Register encoding, shifted right */ | 349 | u8 fan_div[3]; /* Register encoding, shifted right */ |
273 | u8 vid; /* Register encoding, combined */ | 350 | u8 vid; /* Register encoding, combined */ |
274 | u8 vrm; | 351 | u8 vrm; |
@@ -296,26 +373,6 @@ struct it87_data { | |||
296 | s8 auto_temp[3][5]; /* [nr][0] is point1_temp_hyst */ | 373 | s8 auto_temp[3][5]; /* [nr][0] is point1_temp_hyst */ |
297 | }; | 374 | }; |
298 | 375 | ||
299 | static inline int has_12mv_adc(const struct it87_data *data) | ||
300 | { | ||
301 | /* | ||
302 | * IT8721F and later have a 12 mV ADC, also with internal scaling | ||
303 | * on selected inputs. | ||
304 | */ | ||
305 | return data->type == it8721 | ||
306 | || data->type == it8728; | ||
307 | } | ||
308 | |||
309 | static inline int has_newer_autopwm(const struct it87_data *data) | ||
310 | { | ||
311 | /* | ||
312 | * IT8721F and later have separate registers for the temperature | ||
313 | * mapping and the manual duty cycle. | ||
314 | */ | ||
315 | return data->type == it8721 | ||
316 | || data->type == it8728; | ||
317 | } | ||
318 | |||
319 | static int adc_lsb(const struct it87_data *data, int nr) | 376 | static int adc_lsb(const struct it87_data *data, int nr) |
320 | { | 377 | { |
321 | int lsb = has_12mv_adc(data) ? 12 : 16; | 378 | int lsb = has_12mv_adc(data) ? 12 : 16; |
@@ -398,35 +455,6 @@ static const unsigned int pwm_freq[8] = { | |||
398 | 750000 / 128, | 455 | 750000 / 128, |
399 | }; | 456 | }; |
400 | 457 | ||
401 | static inline int has_16bit_fans(const struct it87_data *data) | ||
402 | { | ||
403 | /* | ||
404 | * IT8705F Datasheet 0.4.1, 3h == Version G. | ||
405 | * IT8712F Datasheet 0.9.1, section 8.3.5 indicates 8h == Version J. | ||
406 | * These are the first revisions with 16-bit tachometer support. | ||
407 | */ | ||
408 | return (data->type == it87 && data->revision >= 0x03) | ||
409 | || (data->type == it8712 && data->revision >= 0x08) | ||
410 | || data->type == it8716 | ||
411 | || data->type == it8718 | ||
412 | || data->type == it8720 | ||
413 | || data->type == it8721 | ||
414 | || data->type == it8728 | ||
415 | || data->type == it8782 | ||
416 | || data->type == it8783; | ||
417 | } | ||
418 | |||
419 | static inline int has_old_autopwm(const struct it87_data *data) | ||
420 | { | ||
421 | /* | ||
422 | * The old automatic fan speed control interface is implemented | ||
423 | * by IT8705F chips up to revision F and IT8712F chips up to | ||
424 | * revision G. | ||
425 | */ | ||
426 | return (data->type == it87 && data->revision < 0x03) | ||
427 | || (data->type == it8712 && data->revision < 0x08); | ||
428 | } | ||
429 | |||
430 | static int it87_probe(struct platform_device *pdev); | 458 | static int it87_probe(struct platform_device *pdev); |
431 | static int it87_remove(struct platform_device *pdev); | 459 | static int it87_remove(struct platform_device *pdev); |
432 | 460 | ||
@@ -447,59 +475,22 @@ static struct platform_driver it87_driver = { | |||
447 | }; | 475 | }; |
448 | 476 | ||
449 | static ssize_t show_in(struct device *dev, struct device_attribute *attr, | 477 | static ssize_t show_in(struct device *dev, struct device_attribute *attr, |
450 | char *buf) | 478 | char *buf) |
451 | { | ||
452 | struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); | ||
453 | int nr = sensor_attr->index; | ||
454 | |||
455 | struct it87_data *data = it87_update_device(dev); | ||
456 | return sprintf(buf, "%d\n", in_from_reg(data, nr, data->in[nr])); | ||
457 | } | ||
458 | |||
459 | static ssize_t show_in_min(struct device *dev, struct device_attribute *attr, | ||
460 | char *buf) | ||
461 | { | 479 | { |
462 | struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); | 480 | struct sensor_device_attribute_2 *sattr = to_sensor_dev_attr_2(attr); |
463 | int nr = sensor_attr->index; | 481 | int nr = sattr->nr; |
482 | int index = sattr->index; | ||
464 | 483 | ||
465 | struct it87_data *data = it87_update_device(dev); | 484 | struct it87_data *data = it87_update_device(dev); |
466 | return sprintf(buf, "%d\n", in_from_reg(data, nr, data->in_min[nr])); | 485 | return sprintf(buf, "%d\n", in_from_reg(data, nr, data->in[nr][index])); |
467 | } | 486 | } |
468 | 487 | ||
469 | static ssize_t show_in_max(struct device *dev, struct device_attribute *attr, | 488 | static ssize_t set_in(struct device *dev, struct device_attribute *attr, |
470 | char *buf) | 489 | const char *buf, size_t count) |
471 | { | ||
472 | struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); | ||
473 | int nr = sensor_attr->index; | ||
474 | |||
475 | struct it87_data *data = it87_update_device(dev); | ||
476 | return sprintf(buf, "%d\n", in_from_reg(data, nr, data->in_max[nr])); | ||
477 | } | ||
478 | |||
479 | static ssize_t set_in_min(struct device *dev, struct device_attribute *attr, | ||
480 | const char *buf, size_t count) | ||
481 | { | ||
482 | struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); | ||
483 | int nr = sensor_attr->index; | ||
484 | |||
485 | struct it87_data *data = dev_get_drvdata(dev); | ||
486 | unsigned long val; | ||
487 | |||
488 | if (kstrtoul(buf, 10, &val) < 0) | ||
489 | return -EINVAL; | ||
490 | |||
491 | mutex_lock(&data->update_lock); | ||
492 | data->in_min[nr] = in_to_reg(data, nr, val); | ||
493 | it87_write_value(data, IT87_REG_VIN_MIN(nr), | ||
494 | data->in_min[nr]); | ||
495 | mutex_unlock(&data->update_lock); | ||
496 | return count; | ||
497 | } | ||
498 | static ssize_t set_in_max(struct device *dev, struct device_attribute *attr, | ||
499 | const char *buf, size_t count) | ||
500 | { | 490 | { |
501 | struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); | 491 | struct sensor_device_attribute_2 *sattr = to_sensor_dev_attr_2(attr); |
502 | int nr = sensor_attr->index; | 492 | int nr = sattr->nr; |
493 | int index = sattr->index; | ||
503 | 494 | ||
504 | struct it87_data *data = dev_get_drvdata(dev); | 495 | struct it87_data *data = dev_get_drvdata(dev); |
505 | unsigned long val; | 496 | unsigned long val; |
@@ -508,140 +499,167 @@ static ssize_t set_in_max(struct device *dev, struct device_attribute *attr, | |||
508 | return -EINVAL; | 499 | return -EINVAL; |
509 | 500 | ||
510 | mutex_lock(&data->update_lock); | 501 | mutex_lock(&data->update_lock); |
511 | data->in_max[nr] = in_to_reg(data, nr, val); | 502 | data->in[nr][index] = in_to_reg(data, nr, val); |
512 | it87_write_value(data, IT87_REG_VIN_MAX(nr), | 503 | it87_write_value(data, |
513 | data->in_max[nr]); | 504 | index == 1 ? IT87_REG_VIN_MIN(nr) |
505 | : IT87_REG_VIN_MAX(nr), | ||
506 | data->in[nr][index]); | ||
514 | mutex_unlock(&data->update_lock); | 507 | mutex_unlock(&data->update_lock); |
515 | return count; | 508 | return count; |
516 | } | 509 | } |
517 | 510 | ||
518 | #define show_in_offset(offset) \ | 511 | static SENSOR_DEVICE_ATTR_2(in0_input, S_IRUGO, show_in, NULL, 0, 0); |
519 | static SENSOR_DEVICE_ATTR(in##offset##_input, S_IRUGO, \ | 512 | static SENSOR_DEVICE_ATTR_2(in0_min, S_IRUGO | S_IWUSR, show_in, set_in, |
520 | show_in, NULL, offset); | 513 | 0, 1); |
521 | 514 | static SENSOR_DEVICE_ATTR_2(in0_max, S_IRUGO | S_IWUSR, show_in, set_in, | |
522 | #define limit_in_offset(offset) \ | 515 | 0, 2); |
523 | static SENSOR_DEVICE_ATTR(in##offset##_min, S_IRUGO | S_IWUSR, \ | 516 | |
524 | show_in_min, set_in_min, offset); \ | 517 | static SENSOR_DEVICE_ATTR_2(in1_input, S_IRUGO, show_in, NULL, 1, 0); |
525 | static SENSOR_DEVICE_ATTR(in##offset##_max, S_IRUGO | S_IWUSR, \ | 518 | static SENSOR_DEVICE_ATTR_2(in1_min, S_IRUGO | S_IWUSR, show_in, set_in, |
526 | show_in_max, set_in_max, offset); | 519 | 1, 1); |
527 | 520 | static SENSOR_DEVICE_ATTR_2(in1_max, S_IRUGO | S_IWUSR, show_in, set_in, | |
528 | show_in_offset(0); | 521 | 1, 2); |
529 | limit_in_offset(0); | 522 | |
530 | show_in_offset(1); | 523 | static SENSOR_DEVICE_ATTR_2(in2_input, S_IRUGO, show_in, NULL, 2, 0); |
531 | limit_in_offset(1); | 524 | static SENSOR_DEVICE_ATTR_2(in2_min, S_IRUGO | S_IWUSR, show_in, set_in, |
532 | show_in_offset(2); | 525 | 2, 1); |
533 | limit_in_offset(2); | 526 | static SENSOR_DEVICE_ATTR_2(in2_max, S_IRUGO | S_IWUSR, show_in, set_in, |
534 | show_in_offset(3); | 527 | 2, 2); |
535 | limit_in_offset(3); | 528 | |
536 | show_in_offset(4); | 529 | static SENSOR_DEVICE_ATTR_2(in3_input, S_IRUGO, show_in, NULL, 3, 0); |
537 | limit_in_offset(4); | 530 | static SENSOR_DEVICE_ATTR_2(in3_min, S_IRUGO | S_IWUSR, show_in, set_in, |
538 | show_in_offset(5); | 531 | 3, 1); |
539 | limit_in_offset(5); | 532 | static SENSOR_DEVICE_ATTR_2(in3_max, S_IRUGO | S_IWUSR, show_in, set_in, |
540 | show_in_offset(6); | 533 | 3, 2); |
541 | limit_in_offset(6); | 534 | |
542 | show_in_offset(7); | 535 | static SENSOR_DEVICE_ATTR_2(in4_input, S_IRUGO, show_in, NULL, 4, 0); |
543 | limit_in_offset(7); | 536 | static SENSOR_DEVICE_ATTR_2(in4_min, S_IRUGO | S_IWUSR, show_in, set_in, |
544 | show_in_offset(8); | 537 | 4, 1); |
538 | static SENSOR_DEVICE_ATTR_2(in4_max, S_IRUGO | S_IWUSR, show_in, set_in, | ||
539 | 4, 2); | ||
540 | |||
541 | static SENSOR_DEVICE_ATTR_2(in5_input, S_IRUGO, show_in, NULL, 5, 0); | ||
542 | static SENSOR_DEVICE_ATTR_2(in5_min, S_IRUGO | S_IWUSR, show_in, set_in, | ||
543 | 5, 1); | ||
544 | static SENSOR_DEVICE_ATTR_2(in5_max, S_IRUGO | S_IWUSR, show_in, set_in, | ||
545 | 5, 2); | ||
546 | |||
547 | static SENSOR_DEVICE_ATTR_2(in6_input, S_IRUGO, show_in, NULL, 6, 0); | ||
548 | static SENSOR_DEVICE_ATTR_2(in6_min, S_IRUGO | S_IWUSR, show_in, set_in, | ||
549 | 6, 1); | ||
550 | static SENSOR_DEVICE_ATTR_2(in6_max, S_IRUGO | S_IWUSR, show_in, set_in, | ||
551 | 6, 2); | ||
552 | |||
553 | static SENSOR_DEVICE_ATTR_2(in7_input, S_IRUGO, show_in, NULL, 7, 0); | ||
554 | static SENSOR_DEVICE_ATTR_2(in7_min, S_IRUGO | S_IWUSR, show_in, set_in, | ||
555 | 7, 1); | ||
556 | static SENSOR_DEVICE_ATTR_2(in7_max, S_IRUGO | S_IWUSR, show_in, set_in, | ||
557 | 7, 2); | ||
558 | |||
559 | static SENSOR_DEVICE_ATTR_2(in8_input, S_IRUGO, show_in, NULL, 8, 0); | ||
545 | 560 | ||
546 | /* 3 temperatures */ | 561 | /* 3 temperatures */ |
547 | static ssize_t show_temp(struct device *dev, struct device_attribute *attr, | 562 | static ssize_t show_temp(struct device *dev, struct device_attribute *attr, |
548 | char *buf) | 563 | char *buf) |
549 | { | 564 | { |
550 | struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); | 565 | struct sensor_device_attribute_2 *sattr = to_sensor_dev_attr_2(attr); |
551 | int nr = sensor_attr->index; | 566 | int nr = sattr->nr; |
552 | 567 | int index = sattr->index; | |
553 | struct it87_data *data = it87_update_device(dev); | 568 | struct it87_data *data = it87_update_device(dev); |
554 | return sprintf(buf, "%d\n", TEMP_FROM_REG(data->temp[nr])); | ||
555 | } | ||
556 | static ssize_t show_temp_max(struct device *dev, struct device_attribute *attr, | ||
557 | char *buf) | ||
558 | { | ||
559 | struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); | ||
560 | int nr = sensor_attr->index; | ||
561 | 569 | ||
562 | struct it87_data *data = it87_update_device(dev); | 570 | return sprintf(buf, "%d\n", TEMP_FROM_REG(data->temp[nr][index])); |
563 | return sprintf(buf, "%d\n", TEMP_FROM_REG(data->temp_high[nr])); | ||
564 | } | 571 | } |
565 | static ssize_t show_temp_min(struct device *dev, struct device_attribute *attr, | ||
566 | char *buf) | ||
567 | { | ||
568 | struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); | ||
569 | int nr = sensor_attr->index; | ||
570 | 572 | ||
571 | struct it87_data *data = it87_update_device(dev); | 573 | static ssize_t set_temp(struct device *dev, struct device_attribute *attr, |
572 | return sprintf(buf, "%d\n", TEMP_FROM_REG(data->temp_low[nr])); | 574 | const char *buf, size_t count) |
573 | } | ||
574 | static ssize_t set_temp_max(struct device *dev, struct device_attribute *attr, | ||
575 | const char *buf, size_t count) | ||
576 | { | 575 | { |
577 | struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); | 576 | struct sensor_device_attribute_2 *sattr = to_sensor_dev_attr_2(attr); |
578 | int nr = sensor_attr->index; | 577 | int nr = sattr->nr; |
579 | 578 | int index = sattr->index; | |
580 | struct it87_data *data = dev_get_drvdata(dev); | 579 | struct it87_data *data = dev_get_drvdata(dev); |
581 | long val; | 580 | long val; |
581 | u8 reg, regval; | ||
582 | 582 | ||
583 | if (kstrtol(buf, 10, &val) < 0) | 583 | if (kstrtol(buf, 10, &val) < 0) |
584 | return -EINVAL; | 584 | return -EINVAL; |
585 | 585 | ||
586 | mutex_lock(&data->update_lock); | 586 | mutex_lock(&data->update_lock); |
587 | data->temp_high[nr] = TEMP_TO_REG(val); | ||
588 | it87_write_value(data, IT87_REG_TEMP_HIGH(nr), data->temp_high[nr]); | ||
589 | mutex_unlock(&data->update_lock); | ||
590 | return count; | ||
591 | } | ||
592 | static ssize_t set_temp_min(struct device *dev, struct device_attribute *attr, | ||
593 | const char *buf, size_t count) | ||
594 | { | ||
595 | struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); | ||
596 | int nr = sensor_attr->index; | ||
597 | 587 | ||
598 | struct it87_data *data = dev_get_drvdata(dev); | 588 | switch (index) { |
599 | long val; | 589 | default: |
600 | 590 | case 1: | |
601 | if (kstrtol(buf, 10, &val) < 0) | 591 | reg = IT87_REG_TEMP_LOW(nr); |
602 | return -EINVAL; | 592 | break; |
593 | case 2: | ||
594 | reg = IT87_REG_TEMP_HIGH(nr); | ||
595 | break; | ||
596 | case 3: | ||
597 | regval = it87_read_value(data, IT87_REG_BEEP_ENABLE); | ||
598 | if (!(regval & 0x80)) { | ||
599 | regval |= 0x80; | ||
600 | it87_write_value(data, IT87_REG_BEEP_ENABLE, regval); | ||
601 | } | ||
602 | data->valid = 0; | ||
603 | reg = IT87_REG_TEMP_OFFSET[nr]; | ||
604 | break; | ||
605 | } | ||
603 | 606 | ||
604 | mutex_lock(&data->update_lock); | 607 | data->temp[nr][index] = TEMP_TO_REG(val); |
605 | data->temp_low[nr] = TEMP_TO_REG(val); | 608 | it87_write_value(data, reg, data->temp[nr][index]); |
606 | it87_write_value(data, IT87_REG_TEMP_LOW(nr), data->temp_low[nr]); | ||
607 | mutex_unlock(&data->update_lock); | 609 | mutex_unlock(&data->update_lock); |
608 | return count; | 610 | return count; |
609 | } | 611 | } |
610 | #define show_temp_offset(offset) \ | 612 | |
611 | static SENSOR_DEVICE_ATTR(temp##offset##_input, S_IRUGO, \ | 613 | static SENSOR_DEVICE_ATTR_2(temp1_input, S_IRUGO, show_temp, NULL, 0, 0); |
612 | show_temp, NULL, offset - 1); \ | 614 | static SENSOR_DEVICE_ATTR_2(temp1_min, S_IRUGO | S_IWUSR, show_temp, set_temp, |
613 | static SENSOR_DEVICE_ATTR(temp##offset##_max, S_IRUGO | S_IWUSR, \ | 615 | 0, 1); |
614 | show_temp_max, set_temp_max, offset - 1); \ | 616 | static SENSOR_DEVICE_ATTR_2(temp1_max, S_IRUGO | S_IWUSR, show_temp, set_temp, |
615 | static SENSOR_DEVICE_ATTR(temp##offset##_min, S_IRUGO | S_IWUSR, \ | 617 | 0, 2); |
616 | show_temp_min, set_temp_min, offset - 1); | 618 | static SENSOR_DEVICE_ATTR_2(temp1_offset, S_IRUGO | S_IWUSR, show_temp, |
617 | 619 | set_temp, 0, 3); | |
618 | show_temp_offset(1); | 620 | static SENSOR_DEVICE_ATTR_2(temp2_input, S_IRUGO, show_temp, NULL, 1, 0); |
619 | show_temp_offset(2); | 621 | static SENSOR_DEVICE_ATTR_2(temp2_min, S_IRUGO | S_IWUSR, show_temp, set_temp, |
620 | show_temp_offset(3); | 622 | 1, 1); |
621 | 623 | static SENSOR_DEVICE_ATTR_2(temp2_max, S_IRUGO | S_IWUSR, show_temp, set_temp, | |
622 | static ssize_t show_sensor(struct device *dev, struct device_attribute *attr, | 624 | 1, 2); |
623 | char *buf) | 625 | static SENSOR_DEVICE_ATTR_2(temp2_offset, S_IRUGO | S_IWUSR, show_temp, |
626 | set_temp, 1, 3); | ||
627 | static SENSOR_DEVICE_ATTR_2(temp3_input, S_IRUGO, show_temp, NULL, 2, 0); | ||
628 | static SENSOR_DEVICE_ATTR_2(temp3_min, S_IRUGO | S_IWUSR, show_temp, set_temp, | ||
629 | 2, 1); | ||
630 | static SENSOR_DEVICE_ATTR_2(temp3_max, S_IRUGO | S_IWUSR, show_temp, set_temp, | ||
631 | 2, 2); | ||
632 | static SENSOR_DEVICE_ATTR_2(temp3_offset, S_IRUGO | S_IWUSR, show_temp, | ||
633 | set_temp, 2, 3); | ||
634 | |||
635 | static ssize_t show_temp_type(struct device *dev, struct device_attribute *attr, | ||
636 | char *buf) | ||
624 | { | 637 | { |
625 | struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); | 638 | struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); |
626 | int nr = sensor_attr->index; | 639 | int nr = sensor_attr->index; |
627 | struct it87_data *data = it87_update_device(dev); | 640 | struct it87_data *data = it87_update_device(dev); |
628 | u8 reg = data->sensor; /* In case value is updated while used */ | 641 | u8 reg = data->sensor; /* In case value is updated while used */ |
642 | u8 extra = data->extra; | ||
629 | 643 | ||
644 | if ((has_temp_peci(data, nr) && (reg >> 6 == nr + 1)) | ||
645 | || (has_temp_old_peci(data, nr) && (extra & 0x80))) | ||
646 | return sprintf(buf, "6\n"); /* Intel PECI */ | ||
630 | if (reg & (1 << nr)) | 647 | if (reg & (1 << nr)) |
631 | return sprintf(buf, "3\n"); /* thermal diode */ | 648 | return sprintf(buf, "3\n"); /* thermal diode */ |
632 | if (reg & (8 << nr)) | 649 | if (reg & (8 << nr)) |
633 | return sprintf(buf, "4\n"); /* thermistor */ | 650 | return sprintf(buf, "4\n"); /* thermistor */ |
634 | return sprintf(buf, "0\n"); /* disabled */ | 651 | return sprintf(buf, "0\n"); /* disabled */ |
635 | } | 652 | } |
636 | static ssize_t set_sensor(struct device *dev, struct device_attribute *attr, | 653 | |
637 | const char *buf, size_t count) | 654 | static ssize_t set_temp_type(struct device *dev, struct device_attribute *attr, |
655 | const char *buf, size_t count) | ||
638 | { | 656 | { |
639 | struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); | 657 | struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); |
640 | int nr = sensor_attr->index; | 658 | int nr = sensor_attr->index; |
641 | 659 | ||
642 | struct it87_data *data = dev_get_drvdata(dev); | 660 | struct it87_data *data = dev_get_drvdata(dev); |
643 | long val; | 661 | long val; |
644 | u8 reg; | 662 | u8 reg, extra; |
645 | 663 | ||
646 | if (kstrtol(buf, 10, &val) < 0) | 664 | if (kstrtol(buf, 10, &val) < 0) |
647 | return -EINVAL; | 665 | return -EINVAL; |
@@ -649,33 +667,45 @@ static ssize_t set_sensor(struct device *dev, struct device_attribute *attr, | |||
649 | reg = it87_read_value(data, IT87_REG_TEMP_ENABLE); | 667 | reg = it87_read_value(data, IT87_REG_TEMP_ENABLE); |
650 | reg &= ~(1 << nr); | 668 | reg &= ~(1 << nr); |
651 | reg &= ~(8 << nr); | 669 | reg &= ~(8 << nr); |
670 | if (has_temp_peci(data, nr) && (reg >> 6 == nr + 1 || val == 6)) | ||
671 | reg &= 0x3f; | ||
672 | extra = it87_read_value(data, IT87_REG_TEMP_EXTRA); | ||
673 | if (has_temp_old_peci(data, nr) && ((extra & 0x80) || val == 6)) | ||
674 | extra &= 0x7f; | ||
652 | if (val == 2) { /* backwards compatibility */ | 675 | if (val == 2) { /* backwards compatibility */ |
653 | dev_warn(dev, "Sensor type 2 is deprecated, please use 4 " | 676 | dev_warn(dev, |
654 | "instead\n"); | 677 | "Sensor type 2 is deprecated, please use 4 instead\n"); |
655 | val = 4; | 678 | val = 4; |
656 | } | 679 | } |
657 | /* 3 = thermal diode; 4 = thermistor; 0 = disabled */ | 680 | /* 3 = thermal diode; 4 = thermistor; 6 = Intel PECI; 0 = disabled */ |
658 | if (val == 3) | 681 | if (val == 3) |
659 | reg |= 1 << nr; | 682 | reg |= 1 << nr; |
660 | else if (val == 4) | 683 | else if (val == 4) |
661 | reg |= 8 << nr; | 684 | reg |= 8 << nr; |
685 | else if (has_temp_peci(data, nr) && val == 6) | ||
686 | reg |= (nr + 1) << 6; | ||
687 | else if (has_temp_old_peci(data, nr) && val == 6) | ||
688 | extra |= 0x80; | ||
662 | else if (val != 0) | 689 | else if (val != 0) |
663 | return -EINVAL; | 690 | return -EINVAL; |
664 | 691 | ||
665 | mutex_lock(&data->update_lock); | 692 | mutex_lock(&data->update_lock); |
666 | data->sensor = reg; | 693 | data->sensor = reg; |
694 | data->extra = extra; | ||
667 | it87_write_value(data, IT87_REG_TEMP_ENABLE, data->sensor); | 695 | it87_write_value(data, IT87_REG_TEMP_ENABLE, data->sensor); |
696 | if (has_temp_old_peci(data, nr)) | ||
697 | it87_write_value(data, IT87_REG_TEMP_EXTRA, data->extra); | ||
668 | data->valid = 0; /* Force cache refresh */ | 698 | data->valid = 0; /* Force cache refresh */ |
669 | mutex_unlock(&data->update_lock); | 699 | mutex_unlock(&data->update_lock); |
670 | return count; | 700 | return count; |
671 | } | 701 | } |
672 | #define show_sensor_offset(offset) \ | ||
673 | static SENSOR_DEVICE_ATTR(temp##offset##_type, S_IRUGO | S_IWUSR, \ | ||
674 | show_sensor, set_sensor, offset - 1); | ||
675 | 702 | ||
676 | show_sensor_offset(1); | 703 | static SENSOR_DEVICE_ATTR(temp1_type, S_IRUGO | S_IWUSR, show_temp_type, |
677 | show_sensor_offset(2); | 704 | set_temp_type, 0); |
678 | show_sensor_offset(3); | 705 | static SENSOR_DEVICE_ATTR(temp2_type, S_IRUGO | S_IWUSR, show_temp_type, |
706 | set_temp_type, 1); | ||
707 | static SENSOR_DEVICE_ATTR(temp3_type, S_IRUGO | S_IWUSR, show_temp_type, | ||
708 | set_temp_type, 2); | ||
679 | 709 | ||
680 | /* 3 Fans */ | 710 | /* 3 Fans */ |
681 | 711 | ||
@@ -692,25 +722,21 @@ static int pwm_mode(const struct it87_data *data, int nr) | |||
692 | } | 722 | } |
693 | 723 | ||
694 | static ssize_t show_fan(struct device *dev, struct device_attribute *attr, | 724 | static ssize_t show_fan(struct device *dev, struct device_attribute *attr, |
695 | char *buf) | 725 | char *buf) |
696 | { | 726 | { |
697 | struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); | 727 | struct sensor_device_attribute_2 *sattr = to_sensor_dev_attr_2(attr); |
698 | int nr = sensor_attr->index; | 728 | int nr = sattr->nr; |
699 | 729 | int index = sattr->index; | |
730 | int speed; | ||
700 | struct it87_data *data = it87_update_device(dev); | 731 | struct it87_data *data = it87_update_device(dev); |
701 | return sprintf(buf, "%d\n", FAN_FROM_REG(data->fan[nr], | ||
702 | DIV_FROM_REG(data->fan_div[nr]))); | ||
703 | } | ||
704 | static ssize_t show_fan_min(struct device *dev, struct device_attribute *attr, | ||
705 | char *buf) | ||
706 | { | ||
707 | struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); | ||
708 | int nr = sensor_attr->index; | ||
709 | 732 | ||
710 | struct it87_data *data = it87_update_device(dev); | 733 | speed = has_16bit_fans(data) ? |
711 | return sprintf(buf, "%d\n", FAN_FROM_REG(data->fan_min[nr], | 734 | FAN16_FROM_REG(data->fan[nr][index]) : |
712 | DIV_FROM_REG(data->fan_div[nr]))); | 735 | FAN_FROM_REG(data->fan[nr][index], |
736 | DIV_FROM_REG(data->fan_div[nr])); | ||
737 | return sprintf(buf, "%d\n", speed); | ||
713 | } | 738 | } |
739 | |||
714 | static ssize_t show_fan_div(struct device *dev, struct device_attribute *attr, | 740 | static ssize_t show_fan_div(struct device *dev, struct device_attribute *attr, |
715 | char *buf) | 741 | char *buf) |
716 | { | 742 | { |
@@ -747,11 +773,13 @@ static ssize_t show_pwm_freq(struct device *dev, struct device_attribute *attr, | |||
747 | 773 | ||
748 | return sprintf(buf, "%u\n", pwm_freq[index]); | 774 | return sprintf(buf, "%u\n", pwm_freq[index]); |
749 | } | 775 | } |
750 | static ssize_t set_fan_min(struct device *dev, struct device_attribute *attr, | 776 | |
751 | const char *buf, size_t count) | 777 | static ssize_t set_fan(struct device *dev, struct device_attribute *attr, |
778 | const char *buf, size_t count) | ||
752 | { | 779 | { |
753 | struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); | 780 | struct sensor_device_attribute_2 *sattr = to_sensor_dev_attr_2(attr); |
754 | int nr = sensor_attr->index; | 781 | int nr = sattr->nr; |
782 | int index = sattr->index; | ||
755 | 783 | ||
756 | struct it87_data *data = dev_get_drvdata(dev); | 784 | struct it87_data *data = dev_get_drvdata(dev); |
757 | long val; | 785 | long val; |
@@ -761,24 +789,36 @@ static ssize_t set_fan_min(struct device *dev, struct device_attribute *attr, | |||
761 | return -EINVAL; | 789 | return -EINVAL; |
762 | 790 | ||
763 | mutex_lock(&data->update_lock); | 791 | mutex_lock(&data->update_lock); |
764 | reg = it87_read_value(data, IT87_REG_FAN_DIV); | 792 | |
765 | switch (nr) { | 793 | if (has_16bit_fans(data)) { |
766 | case 0: | 794 | data->fan[nr][index] = FAN16_TO_REG(val); |
767 | data->fan_div[nr] = reg & 0x07; | 795 | it87_write_value(data, IT87_REG_FAN_MIN[nr], |
768 | break; | 796 | data->fan[nr][index] & 0xff); |
769 | case 1: | 797 | it87_write_value(data, IT87_REG_FANX_MIN[nr], |
770 | data->fan_div[nr] = (reg >> 3) & 0x07; | 798 | data->fan[nr][index] >> 8); |
771 | break; | 799 | } else { |
772 | case 2: | 800 | reg = it87_read_value(data, IT87_REG_FAN_DIV); |
773 | data->fan_div[nr] = (reg & 0x40) ? 3 : 1; | 801 | switch (nr) { |
774 | break; | 802 | case 0: |
803 | data->fan_div[nr] = reg & 0x07; | ||
804 | break; | ||
805 | case 1: | ||
806 | data->fan_div[nr] = (reg >> 3) & 0x07; | ||
807 | break; | ||
808 | case 2: | ||
809 | data->fan_div[nr] = (reg & 0x40) ? 3 : 1; | ||
810 | break; | ||
811 | } | ||
812 | data->fan[nr][index] = | ||
813 | FAN_TO_REG(val, DIV_FROM_REG(data->fan_div[nr])); | ||
814 | it87_write_value(data, IT87_REG_FAN_MIN[nr], | ||
815 | data->fan[nr][index]); | ||
775 | } | 816 | } |
776 | 817 | ||
777 | data->fan_min[nr] = FAN_TO_REG(val, DIV_FROM_REG(data->fan_div[nr])); | ||
778 | it87_write_value(data, IT87_REG_FAN_MIN[nr], data->fan_min[nr]); | ||
779 | mutex_unlock(&data->update_lock); | 818 | mutex_unlock(&data->update_lock); |
780 | return count; | 819 | return count; |
781 | } | 820 | } |
821 | |||
782 | static ssize_t set_fan_div(struct device *dev, struct device_attribute *attr, | 822 | static ssize_t set_fan_div(struct device *dev, struct device_attribute *attr, |
783 | const char *buf, size_t count) | 823 | const char *buf, size_t count) |
784 | { | 824 | { |
@@ -797,7 +837,7 @@ static ssize_t set_fan_div(struct device *dev, struct device_attribute *attr, | |||
797 | old = it87_read_value(data, IT87_REG_FAN_DIV); | 837 | old = it87_read_value(data, IT87_REG_FAN_DIV); |
798 | 838 | ||
799 | /* Save fan min limit */ | 839 | /* Save fan min limit */ |
800 | min = FAN_FROM_REG(data->fan_min[nr], DIV_FROM_REG(data->fan_div[nr])); | 840 | min = FAN_FROM_REG(data->fan[nr][1], DIV_FROM_REG(data->fan_div[nr])); |
801 | 841 | ||
802 | switch (nr) { | 842 | switch (nr) { |
803 | case 0: | 843 | case 0: |
@@ -818,8 +858,8 @@ static ssize_t set_fan_div(struct device *dev, struct device_attribute *attr, | |||
818 | it87_write_value(data, IT87_REG_FAN_DIV, val); | 858 | it87_write_value(data, IT87_REG_FAN_DIV, val); |
819 | 859 | ||
820 | /* Restore fan min limit */ | 860 | /* Restore fan min limit */ |
821 | data->fan_min[nr] = FAN_TO_REG(min, DIV_FROM_REG(data->fan_div[nr])); | 861 | data->fan[nr][1] = FAN_TO_REG(min, DIV_FROM_REG(data->fan_div[nr])); |
822 | it87_write_value(data, IT87_REG_FAN_MIN[nr], data->fan_min[nr]); | 862 | it87_write_value(data, IT87_REG_FAN_MIN[nr], data->fan[nr][1]); |
823 | 863 | ||
824 | mutex_unlock(&data->update_lock); | 864 | mutex_unlock(&data->update_lock); |
825 | return count; | 865 | return count; |
@@ -843,8 +883,8 @@ static int check_trip_points(struct device *dev, int nr) | |||
843 | } | 883 | } |
844 | 884 | ||
845 | if (err) { | 885 | if (err) { |
846 | dev_err(dev, "Inconsistent trip points, not switching to " | 886 | dev_err(dev, |
847 | "automatic mode\n"); | 887 | "Inconsistent trip points, not switching to automatic mode\n"); |
848 | dev_err(dev, "Adjust the trip points and try again\n"); | 888 | dev_err(dev, "Adjust the trip points and try again\n"); |
849 | } | 889 | } |
850 | return err; | 890 | return err; |
@@ -1092,118 +1132,106 @@ static ssize_t set_auto_temp(struct device *dev, | |||
1092 | return count; | 1132 | return count; |
1093 | } | 1133 | } |
1094 | 1134 | ||
1095 | #define show_fan_offset(offset) \ | 1135 | static SENSOR_DEVICE_ATTR_2(fan1_input, S_IRUGO, show_fan, NULL, 0, 0); |
1096 | static SENSOR_DEVICE_ATTR(fan##offset##_input, S_IRUGO, \ | 1136 | static SENSOR_DEVICE_ATTR_2(fan1_min, S_IRUGO | S_IWUSR, show_fan, set_fan, |
1097 | show_fan, NULL, offset - 1); \ | 1137 | 0, 1); |
1098 | static SENSOR_DEVICE_ATTR(fan##offset##_min, S_IRUGO | S_IWUSR, \ | 1138 | static SENSOR_DEVICE_ATTR(fan1_div, S_IRUGO | S_IWUSR, show_fan_div, |
1099 | show_fan_min, set_fan_min, offset - 1); \ | 1139 | set_fan_div, 0); |
1100 | static SENSOR_DEVICE_ATTR(fan##offset##_div, S_IRUGO | S_IWUSR, \ | 1140 | |
1101 | show_fan_div, set_fan_div, offset - 1); | 1141 | static SENSOR_DEVICE_ATTR_2(fan2_input, S_IRUGO, show_fan, NULL, 1, 0); |
1102 | 1142 | static SENSOR_DEVICE_ATTR_2(fan2_min, S_IRUGO | S_IWUSR, show_fan, set_fan, | |
1103 | show_fan_offset(1); | 1143 | 1, 1); |
1104 | show_fan_offset(2); | 1144 | static SENSOR_DEVICE_ATTR(fan2_div, S_IRUGO | S_IWUSR, show_fan_div, |
1105 | show_fan_offset(3); | 1145 | set_fan_div, 1); |
1106 | 1146 | ||
1107 | #define show_pwm_offset(offset) \ | 1147 | static SENSOR_DEVICE_ATTR_2(fan3_input, S_IRUGO, show_fan, NULL, 2, 0); |
1108 | static SENSOR_DEVICE_ATTR(pwm##offset##_enable, S_IRUGO | S_IWUSR, \ | 1148 | static SENSOR_DEVICE_ATTR_2(fan3_min, S_IRUGO | S_IWUSR, show_fan, set_fan, |
1109 | show_pwm_enable, set_pwm_enable, offset - 1); \ | 1149 | 2, 1); |
1110 | static SENSOR_DEVICE_ATTR(pwm##offset, S_IRUGO | S_IWUSR, \ | 1150 | static SENSOR_DEVICE_ATTR(fan3_div, S_IRUGO | S_IWUSR, show_fan_div, |
1111 | show_pwm, set_pwm, offset - 1); \ | 1151 | set_fan_div, 2); |
1112 | static DEVICE_ATTR(pwm##offset##_freq, \ | 1152 | |
1113 | (offset == 1 ? S_IRUGO | S_IWUSR : S_IRUGO), \ | 1153 | static SENSOR_DEVICE_ATTR_2(fan4_input, S_IRUGO, show_fan, NULL, 3, 0); |
1114 | show_pwm_freq, (offset == 1 ? set_pwm_freq : NULL)); \ | 1154 | static SENSOR_DEVICE_ATTR_2(fan4_min, S_IRUGO | S_IWUSR, show_fan, set_fan, |
1115 | static SENSOR_DEVICE_ATTR(pwm##offset##_auto_channels_temp, \ | 1155 | 3, 1); |
1116 | S_IRUGO | S_IWUSR, show_pwm_temp_map, set_pwm_temp_map, \ | 1156 | |
1117 | offset - 1); \ | 1157 | static SENSOR_DEVICE_ATTR_2(fan5_input, S_IRUGO, show_fan, NULL, 4, 0); |
1118 | static SENSOR_DEVICE_ATTR_2(pwm##offset##_auto_point1_pwm, \ | 1158 | static SENSOR_DEVICE_ATTR_2(fan5_min, S_IRUGO | S_IWUSR, show_fan, set_fan, |
1119 | S_IRUGO | S_IWUSR, show_auto_pwm, set_auto_pwm, \ | 1159 | 4, 1); |
1120 | offset - 1, 0); \ | 1160 | |
1121 | static SENSOR_DEVICE_ATTR_2(pwm##offset##_auto_point2_pwm, \ | 1161 | static SENSOR_DEVICE_ATTR(pwm1_enable, S_IRUGO | S_IWUSR, |
1122 | S_IRUGO | S_IWUSR, show_auto_pwm, set_auto_pwm, \ | 1162 | show_pwm_enable, set_pwm_enable, 0); |
1123 | offset - 1, 1); \ | 1163 | static SENSOR_DEVICE_ATTR(pwm1, S_IRUGO | S_IWUSR, show_pwm, set_pwm, 0); |
1124 | static SENSOR_DEVICE_ATTR_2(pwm##offset##_auto_point3_pwm, \ | 1164 | static DEVICE_ATTR(pwm1_freq, S_IRUGO | S_IWUSR, show_pwm_freq, set_pwm_freq); |
1125 | S_IRUGO | S_IWUSR, show_auto_pwm, set_auto_pwm, \ | 1165 | static SENSOR_DEVICE_ATTR(pwm1_auto_channels_temp, S_IRUGO | S_IWUSR, |
1126 | offset - 1, 2); \ | 1166 | show_pwm_temp_map, set_pwm_temp_map, 0); |
1127 | static SENSOR_DEVICE_ATTR_2(pwm##offset##_auto_point4_pwm, \ | 1167 | static SENSOR_DEVICE_ATTR_2(pwm1_auto_point1_pwm, S_IRUGO | S_IWUSR, |
1128 | S_IRUGO, show_auto_pwm, NULL, offset - 1, 3); \ | 1168 | show_auto_pwm, set_auto_pwm, 0, 0); |
1129 | static SENSOR_DEVICE_ATTR_2(pwm##offset##_auto_point1_temp, \ | 1169 | static SENSOR_DEVICE_ATTR_2(pwm1_auto_point2_pwm, S_IRUGO | S_IWUSR, |
1130 | S_IRUGO | S_IWUSR, show_auto_temp, set_auto_temp, \ | 1170 | show_auto_pwm, set_auto_pwm, 0, 1); |
1131 | offset - 1, 1); \ | 1171 | static SENSOR_DEVICE_ATTR_2(pwm1_auto_point3_pwm, S_IRUGO | S_IWUSR, |
1132 | static SENSOR_DEVICE_ATTR_2(pwm##offset##_auto_point1_temp_hyst, \ | 1172 | show_auto_pwm, set_auto_pwm, 0, 2); |
1133 | S_IRUGO | S_IWUSR, show_auto_temp, set_auto_temp, \ | 1173 | static SENSOR_DEVICE_ATTR_2(pwm1_auto_point4_pwm, S_IRUGO, |
1134 | offset - 1, 0); \ | 1174 | show_auto_pwm, NULL, 0, 3); |
1135 | static SENSOR_DEVICE_ATTR_2(pwm##offset##_auto_point2_temp, \ | 1175 | static SENSOR_DEVICE_ATTR_2(pwm1_auto_point1_temp, S_IRUGO | S_IWUSR, |
1136 | S_IRUGO | S_IWUSR, show_auto_temp, set_auto_temp, \ | 1176 | show_auto_temp, set_auto_temp, 0, 1); |
1137 | offset - 1, 2); \ | 1177 | static SENSOR_DEVICE_ATTR_2(pwm1_auto_point1_temp_hyst, S_IRUGO | S_IWUSR, |
1138 | static SENSOR_DEVICE_ATTR_2(pwm##offset##_auto_point3_temp, \ | 1178 | show_auto_temp, set_auto_temp, 0, 0); |
1139 | S_IRUGO | S_IWUSR, show_auto_temp, set_auto_temp, \ | 1179 | static SENSOR_DEVICE_ATTR_2(pwm1_auto_point2_temp, S_IRUGO | S_IWUSR, |
1140 | offset - 1, 3); \ | 1180 | show_auto_temp, set_auto_temp, 0, 2); |
1141 | static SENSOR_DEVICE_ATTR_2(pwm##offset##_auto_point4_temp, \ | 1181 | static SENSOR_DEVICE_ATTR_2(pwm1_auto_point3_temp, S_IRUGO | S_IWUSR, |
1142 | S_IRUGO | S_IWUSR, show_auto_temp, set_auto_temp, \ | 1182 | show_auto_temp, set_auto_temp, 0, 3); |
1143 | offset - 1, 4); | 1183 | static SENSOR_DEVICE_ATTR_2(pwm1_auto_point4_temp, S_IRUGO | S_IWUSR, |
1144 | 1184 | show_auto_temp, set_auto_temp, 0, 4); | |
1145 | show_pwm_offset(1); | 1185 | |
1146 | show_pwm_offset(2); | 1186 | static SENSOR_DEVICE_ATTR(pwm2_enable, S_IRUGO | S_IWUSR, |
1147 | show_pwm_offset(3); | 1187 | show_pwm_enable, set_pwm_enable, 1); |
1148 | 1188 | static SENSOR_DEVICE_ATTR(pwm2, S_IRUGO | S_IWUSR, show_pwm, set_pwm, 1); | |
1149 | /* A different set of callbacks for 16-bit fans */ | 1189 | static DEVICE_ATTR(pwm2_freq, S_IRUGO, show_pwm_freq, NULL); |
1150 | static ssize_t show_fan16(struct device *dev, struct device_attribute *attr, | 1190 | static SENSOR_DEVICE_ATTR(pwm2_auto_channels_temp, S_IRUGO | S_IWUSR, |
1151 | char *buf) | 1191 | show_pwm_temp_map, set_pwm_temp_map, 1); |
1152 | { | 1192 | static SENSOR_DEVICE_ATTR_2(pwm2_auto_point1_pwm, S_IRUGO | S_IWUSR, |
1153 | struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); | 1193 | show_auto_pwm, set_auto_pwm, 1, 0); |
1154 | int nr = sensor_attr->index; | 1194 | static SENSOR_DEVICE_ATTR_2(pwm2_auto_point2_pwm, S_IRUGO | S_IWUSR, |
1155 | struct it87_data *data = it87_update_device(dev); | 1195 | show_auto_pwm, set_auto_pwm, 1, 1); |
1156 | return sprintf(buf, "%d\n", FAN16_FROM_REG(data->fan[nr])); | 1196 | static SENSOR_DEVICE_ATTR_2(pwm2_auto_point3_pwm, S_IRUGO | S_IWUSR, |
1157 | } | 1197 | show_auto_pwm, set_auto_pwm, 1, 2); |
1158 | 1198 | static SENSOR_DEVICE_ATTR_2(pwm2_auto_point4_pwm, S_IRUGO, | |
1159 | static ssize_t show_fan16_min(struct device *dev, struct device_attribute *attr, | 1199 | show_auto_pwm, NULL, 1, 3); |
1160 | char *buf) | 1200 | static SENSOR_DEVICE_ATTR_2(pwm2_auto_point1_temp, S_IRUGO | S_IWUSR, |
1161 | { | 1201 | show_auto_temp, set_auto_temp, 1, 1); |
1162 | struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); | 1202 | static SENSOR_DEVICE_ATTR_2(pwm2_auto_point1_temp_hyst, S_IRUGO | S_IWUSR, |
1163 | int nr = sensor_attr->index; | 1203 | show_auto_temp, set_auto_temp, 1, 0); |
1164 | struct it87_data *data = it87_update_device(dev); | 1204 | static SENSOR_DEVICE_ATTR_2(pwm2_auto_point2_temp, S_IRUGO | S_IWUSR, |
1165 | return sprintf(buf, "%d\n", FAN16_FROM_REG(data->fan_min[nr])); | 1205 | show_auto_temp, set_auto_temp, 1, 2); |
1166 | } | 1206 | static SENSOR_DEVICE_ATTR_2(pwm2_auto_point3_temp, S_IRUGO | S_IWUSR, |
1167 | 1207 | show_auto_temp, set_auto_temp, 1, 3); | |
1168 | static ssize_t set_fan16_min(struct device *dev, struct device_attribute *attr, | 1208 | static SENSOR_DEVICE_ATTR_2(pwm2_auto_point4_temp, S_IRUGO | S_IWUSR, |
1169 | const char *buf, size_t count) | 1209 | show_auto_temp, set_auto_temp, 1, 4); |
1170 | { | 1210 | |
1171 | struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); | 1211 | static SENSOR_DEVICE_ATTR(pwm3_enable, S_IRUGO | S_IWUSR, |
1172 | int nr = sensor_attr->index; | 1212 | show_pwm_enable, set_pwm_enable, 2); |
1173 | struct it87_data *data = dev_get_drvdata(dev); | 1213 | static SENSOR_DEVICE_ATTR(pwm3, S_IRUGO | S_IWUSR, show_pwm, set_pwm, 2); |
1174 | long val; | 1214 | static DEVICE_ATTR(pwm3_freq, S_IRUGO, show_pwm_freq, NULL); |
1175 | 1215 | static SENSOR_DEVICE_ATTR(pwm3_auto_channels_temp, S_IRUGO | S_IWUSR, | |
1176 | if (kstrtol(buf, 10, &val) < 0) | 1216 | show_pwm_temp_map, set_pwm_temp_map, 2); |
1177 | return -EINVAL; | 1217 | static SENSOR_DEVICE_ATTR_2(pwm3_auto_point1_pwm, S_IRUGO | S_IWUSR, |
1178 | 1218 | show_auto_pwm, set_auto_pwm, 2, 0); | |
1179 | mutex_lock(&data->update_lock); | 1219 | static SENSOR_DEVICE_ATTR_2(pwm3_auto_point2_pwm, S_IRUGO | S_IWUSR, |
1180 | data->fan_min[nr] = FAN16_TO_REG(val); | 1220 | show_auto_pwm, set_auto_pwm, 2, 1); |
1181 | it87_write_value(data, IT87_REG_FAN_MIN[nr], | 1221 | static SENSOR_DEVICE_ATTR_2(pwm3_auto_point3_pwm, S_IRUGO | S_IWUSR, |
1182 | data->fan_min[nr] & 0xff); | 1222 | show_auto_pwm, set_auto_pwm, 2, 2); |
1183 | it87_write_value(data, IT87_REG_FANX_MIN[nr], | 1223 | static SENSOR_DEVICE_ATTR_2(pwm3_auto_point4_pwm, S_IRUGO, |
1184 | data->fan_min[nr] >> 8); | 1224 | show_auto_pwm, NULL, 2, 3); |
1185 | mutex_unlock(&data->update_lock); | 1225 | static SENSOR_DEVICE_ATTR_2(pwm3_auto_point1_temp, S_IRUGO | S_IWUSR, |
1186 | return count; | 1226 | show_auto_temp, set_auto_temp, 2, 1); |
1187 | } | 1227 | static SENSOR_DEVICE_ATTR_2(pwm3_auto_point1_temp_hyst, S_IRUGO | S_IWUSR, |
1188 | 1228 | show_auto_temp, set_auto_temp, 2, 0); | |
1189 | /* | 1229 | static SENSOR_DEVICE_ATTR_2(pwm3_auto_point2_temp, S_IRUGO | S_IWUSR, |
1190 | * We want to use the same sysfs file names as 8-bit fans, but we need | 1230 | show_auto_temp, set_auto_temp, 2, 2); |
1191 | * different variable names, so we have to use SENSOR_ATTR instead of | 1231 | static SENSOR_DEVICE_ATTR_2(pwm3_auto_point3_temp, S_IRUGO | S_IWUSR, |
1192 | * SENSOR_DEVICE_ATTR. | 1232 | show_auto_temp, set_auto_temp, 2, 3); |
1193 | */ | 1233 | static SENSOR_DEVICE_ATTR_2(pwm3_auto_point4_temp, S_IRUGO | S_IWUSR, |
1194 | #define show_fan16_offset(offset) \ | 1234 | show_auto_temp, set_auto_temp, 2, 4); |
1195 | static struct sensor_device_attribute sensor_dev_attr_fan##offset##_input16 \ | ||
1196 | = SENSOR_ATTR(fan##offset##_input, S_IRUGO, \ | ||
1197 | show_fan16, NULL, offset - 1); \ | ||
1198 | static struct sensor_device_attribute sensor_dev_attr_fan##offset##_min16 \ | ||
1199 | = SENSOR_ATTR(fan##offset##_min, S_IRUGO | S_IWUSR, \ | ||
1200 | show_fan16_min, set_fan16_min, offset - 1) | ||
1201 | |||
1202 | show_fan16_offset(1); | ||
1203 | show_fan16_offset(2); | ||
1204 | show_fan16_offset(3); | ||
1205 | show_fan16_offset(4); | ||
1206 | show_fan16_offset(5); | ||
1207 | 1235 | ||
1208 | /* Alarms */ | 1236 | /* Alarms */ |
1209 | static ssize_t show_alarms(struct device *dev, struct device_attribute *attr, | 1237 | static ssize_t show_alarms(struct device *dev, struct device_attribute *attr, |
@@ -1471,6 +1499,12 @@ static const struct attribute_group it87_group_temp[3] = { | |||
1471 | { .attrs = it87_attributes_temp[2] }, | 1499 | { .attrs = it87_attributes_temp[2] }, |
1472 | }; | 1500 | }; |
1473 | 1501 | ||
1502 | static struct attribute *it87_attributes_temp_offset[] = { | ||
1503 | &sensor_dev_attr_temp1_offset.dev_attr.attr, | ||
1504 | &sensor_dev_attr_temp2_offset.dev_attr.attr, | ||
1505 | &sensor_dev_attr_temp3_offset.dev_attr.attr, | ||
1506 | }; | ||
1507 | |||
1474 | static struct attribute *it87_attributes[] = { | 1508 | static struct attribute *it87_attributes[] = { |
1475 | &dev_attr_alarms.attr, | 1509 | &dev_attr_alarms.attr, |
1476 | &sensor_dev_attr_intrusion0_alarm.dev_attr.attr, | 1510 | &sensor_dev_attr_intrusion0_alarm.dev_attr.attr, |
@@ -1500,73 +1534,47 @@ static struct attribute *it87_attributes_temp_beep[] = { | |||
1500 | &sensor_dev_attr_temp3_beep.dev_attr.attr, | 1534 | &sensor_dev_attr_temp3_beep.dev_attr.attr, |
1501 | }; | 1535 | }; |
1502 | 1536 | ||
1503 | static struct attribute *it87_attributes_fan16[5][3+1] = { { | 1537 | static struct attribute *it87_attributes_fan[5][3+1] = { { |
1504 | &sensor_dev_attr_fan1_input16.dev_attr.attr, | 1538 | &sensor_dev_attr_fan1_input.dev_attr.attr, |
1505 | &sensor_dev_attr_fan1_min16.dev_attr.attr, | 1539 | &sensor_dev_attr_fan1_min.dev_attr.attr, |
1506 | &sensor_dev_attr_fan1_alarm.dev_attr.attr, | 1540 | &sensor_dev_attr_fan1_alarm.dev_attr.attr, |
1507 | NULL | 1541 | NULL |
1508 | }, { | 1542 | }, { |
1509 | &sensor_dev_attr_fan2_input16.dev_attr.attr, | 1543 | &sensor_dev_attr_fan2_input.dev_attr.attr, |
1510 | &sensor_dev_attr_fan2_min16.dev_attr.attr, | 1544 | &sensor_dev_attr_fan2_min.dev_attr.attr, |
1511 | &sensor_dev_attr_fan2_alarm.dev_attr.attr, | 1545 | &sensor_dev_attr_fan2_alarm.dev_attr.attr, |
1512 | NULL | 1546 | NULL |
1513 | }, { | 1547 | }, { |
1514 | &sensor_dev_attr_fan3_input16.dev_attr.attr, | 1548 | &sensor_dev_attr_fan3_input.dev_attr.attr, |
1515 | &sensor_dev_attr_fan3_min16.dev_attr.attr, | 1549 | &sensor_dev_attr_fan3_min.dev_attr.attr, |
1516 | &sensor_dev_attr_fan3_alarm.dev_attr.attr, | 1550 | &sensor_dev_attr_fan3_alarm.dev_attr.attr, |
1517 | NULL | 1551 | NULL |
1518 | }, { | 1552 | }, { |
1519 | &sensor_dev_attr_fan4_input16.dev_attr.attr, | 1553 | &sensor_dev_attr_fan4_input.dev_attr.attr, |
1520 | &sensor_dev_attr_fan4_min16.dev_attr.attr, | 1554 | &sensor_dev_attr_fan4_min.dev_attr.attr, |
1521 | &sensor_dev_attr_fan4_alarm.dev_attr.attr, | 1555 | &sensor_dev_attr_fan4_alarm.dev_attr.attr, |
1522 | NULL | 1556 | NULL |
1523 | }, { | 1557 | }, { |
1524 | &sensor_dev_attr_fan5_input16.dev_attr.attr, | 1558 | &sensor_dev_attr_fan5_input.dev_attr.attr, |
1525 | &sensor_dev_attr_fan5_min16.dev_attr.attr, | 1559 | &sensor_dev_attr_fan5_min.dev_attr.attr, |
1526 | &sensor_dev_attr_fan5_alarm.dev_attr.attr, | 1560 | &sensor_dev_attr_fan5_alarm.dev_attr.attr, |
1527 | NULL | 1561 | NULL |
1528 | } }; | 1562 | } }; |
1529 | 1563 | ||
1530 | static const struct attribute_group it87_group_fan16[5] = { | 1564 | static const struct attribute_group it87_group_fan[5] = { |
1531 | { .attrs = it87_attributes_fan16[0] }, | 1565 | { .attrs = it87_attributes_fan[0] }, |
1532 | { .attrs = it87_attributes_fan16[1] }, | 1566 | { .attrs = it87_attributes_fan[1] }, |
1533 | { .attrs = it87_attributes_fan16[2] }, | 1567 | { .attrs = it87_attributes_fan[2] }, |
1534 | { .attrs = it87_attributes_fan16[3] }, | 1568 | { .attrs = it87_attributes_fan[3] }, |
1535 | { .attrs = it87_attributes_fan16[4] }, | 1569 | { .attrs = it87_attributes_fan[4] }, |
1536 | }; | 1570 | }; |
1537 | 1571 | ||
1538 | static struct attribute *it87_attributes_fan[3][4+1] = { { | 1572 | static const struct attribute *it87_attributes_fan_div[] = { |
1539 | &sensor_dev_attr_fan1_input.dev_attr.attr, | ||
1540 | &sensor_dev_attr_fan1_min.dev_attr.attr, | ||
1541 | &sensor_dev_attr_fan1_div.dev_attr.attr, | 1573 | &sensor_dev_attr_fan1_div.dev_attr.attr, |
1542 | &sensor_dev_attr_fan1_alarm.dev_attr.attr, | ||
1543 | NULL | ||
1544 | }, { | ||
1545 | &sensor_dev_attr_fan2_input.dev_attr.attr, | ||
1546 | &sensor_dev_attr_fan2_min.dev_attr.attr, | ||
1547 | &sensor_dev_attr_fan2_div.dev_attr.attr, | 1574 | &sensor_dev_attr_fan2_div.dev_attr.attr, |
1548 | &sensor_dev_attr_fan2_alarm.dev_attr.attr, | ||
1549 | NULL | ||
1550 | }, { | ||
1551 | &sensor_dev_attr_fan3_input.dev_attr.attr, | ||
1552 | &sensor_dev_attr_fan3_min.dev_attr.attr, | ||
1553 | &sensor_dev_attr_fan3_div.dev_attr.attr, | 1575 | &sensor_dev_attr_fan3_div.dev_attr.attr, |
1554 | &sensor_dev_attr_fan3_alarm.dev_attr.attr, | ||
1555 | NULL | ||
1556 | } }; | ||
1557 | |||
1558 | static const struct attribute_group it87_group_fan[3] = { | ||
1559 | { .attrs = it87_attributes_fan[0] }, | ||
1560 | { .attrs = it87_attributes_fan[1] }, | ||
1561 | { .attrs = it87_attributes_fan[2] }, | ||
1562 | }; | 1576 | }; |
1563 | 1577 | ||
1564 | static const struct attribute_group * | ||
1565 | it87_get_fan_group(const struct it87_data *data) | ||
1566 | { | ||
1567 | return has_16bit_fans(data) ? it87_group_fan16 : it87_group_fan; | ||
1568 | } | ||
1569 | |||
1570 | static struct attribute *it87_attributes_pwm[3][4+1] = { { | 1578 | static struct attribute *it87_attributes_pwm[3][4+1] = { { |
1571 | &sensor_dev_attr_pwm1_enable.dev_attr.attr, | 1579 | &sensor_dev_attr_pwm1_enable.dev_attr.attr, |
1572 | &sensor_dev_attr_pwm1.dev_attr.attr, | 1580 | &sensor_dev_attr_pwm1.dev_attr.attr, |
@@ -1925,7 +1933,6 @@ static void it87_remove_files(struct device *dev) | |||
1925 | { | 1933 | { |
1926 | struct it87_data *data = platform_get_drvdata(pdev); | 1934 | struct it87_data *data = platform_get_drvdata(pdev); |
1927 | struct it87_sio_data *sio_data = dev->platform_data; | 1935 | struct it87_sio_data *sio_data = dev->platform_data; |
1928 | const struct attribute_group *fan_group = it87_get_fan_group(data); | ||
1929 | int i; | 1936 | int i; |
1930 | 1937 | ||
1931 | sysfs_remove_group(&dev->kobj, &it87_group); | 1938 | sysfs_remove_group(&dev->kobj, &it87_group); |
@@ -1941,6 +1948,9 @@ static void it87_remove_files(struct device *dev) | |||
1941 | if (!(data->has_temp & (1 << i))) | 1948 | if (!(data->has_temp & (1 << i))) |
1942 | continue; | 1949 | continue; |
1943 | sysfs_remove_group(&dev->kobj, &it87_group_temp[i]); | 1950 | sysfs_remove_group(&dev->kobj, &it87_group_temp[i]); |
1951 | if (has_temp_offset(data)) | ||
1952 | sysfs_remove_file(&dev->kobj, | ||
1953 | it87_attributes_temp_offset[i]); | ||
1944 | if (sio_data->beep_pin) | 1954 | if (sio_data->beep_pin) |
1945 | sysfs_remove_file(&dev->kobj, | 1955 | sysfs_remove_file(&dev->kobj, |
1946 | it87_attributes_temp_beep[i]); | 1956 | it87_attributes_temp_beep[i]); |
@@ -1948,10 +1958,13 @@ static void it87_remove_files(struct device *dev) | |||
1948 | for (i = 0; i < 5; i++) { | 1958 | for (i = 0; i < 5; i++) { |
1949 | if (!(data->has_fan & (1 << i))) | 1959 | if (!(data->has_fan & (1 << i))) |
1950 | continue; | 1960 | continue; |
1951 | sysfs_remove_group(&dev->kobj, &fan_group[i]); | 1961 | sysfs_remove_group(&dev->kobj, &it87_group_fan[i]); |
1952 | if (sio_data->beep_pin) | 1962 | if (sio_data->beep_pin) |
1953 | sysfs_remove_file(&dev->kobj, | 1963 | sysfs_remove_file(&dev->kobj, |
1954 | it87_attributes_fan_beep[i]); | 1964 | it87_attributes_fan_beep[i]); |
1965 | if (i < 3 && !has_16bit_fans(data)) | ||
1966 | sysfs_remove_file(&dev->kobj, | ||
1967 | it87_attributes_fan_div[i]); | ||
1955 | } | 1968 | } |
1956 | for (i = 0; i < 3; i++) { | 1969 | for (i = 0; i < 3; i++) { |
1957 | if (sio_data->skip_pwm & (1 << 0)) | 1970 | if (sio_data->skip_pwm & (1 << 0)) |
@@ -1972,21 +1985,9 @@ static int it87_probe(struct platform_device *pdev) | |||
1972 | struct resource *res; | 1985 | struct resource *res; |
1973 | struct device *dev = &pdev->dev; | 1986 | struct device *dev = &pdev->dev; |
1974 | struct it87_sio_data *sio_data = dev->platform_data; | 1987 | struct it87_sio_data *sio_data = dev->platform_data; |
1975 | const struct attribute_group *fan_group; | ||
1976 | int err = 0, i; | 1988 | int err = 0, i; |
1977 | int enable_pwm_interface; | 1989 | int enable_pwm_interface; |
1978 | int fan_beep_need_rw; | 1990 | int fan_beep_need_rw; |
1979 | static const char * const names[] = { | ||
1980 | "it87", | ||
1981 | "it8712", | ||
1982 | "it8716", | ||
1983 | "it8718", | ||
1984 | "it8720", | ||
1985 | "it8721", | ||
1986 | "it8728", | ||
1987 | "it8782", | ||
1988 | "it8783", | ||
1989 | }; | ||
1990 | 1991 | ||
1991 | res = platform_get_resource(pdev, IORESOURCE_IO, 0); | 1992 | res = platform_get_resource(pdev, IORESOURCE_IO, 0); |
1992 | if (!devm_request_region(&pdev->dev, res->start, IT87_EC_EXTENT, | 1993 | if (!devm_request_region(&pdev->dev, res->start, IT87_EC_EXTENT, |
@@ -2003,8 +2004,31 @@ static int it87_probe(struct platform_device *pdev) | |||
2003 | 2004 | ||
2004 | data->addr = res->start; | 2005 | data->addr = res->start; |
2005 | data->type = sio_data->type; | 2006 | data->type = sio_data->type; |
2006 | data->revision = sio_data->revision; | 2007 | data->features = it87_devices[sio_data->type].features; |
2007 | data->name = names[sio_data->type]; | 2008 | data->peci_mask = it87_devices[sio_data->type].peci_mask; |
2009 | data->old_peci_mask = it87_devices[sio_data->type].old_peci_mask; | ||
2010 | data->name = it87_devices[sio_data->type].name; | ||
2011 | /* | ||
2012 | * IT8705F Datasheet 0.4.1, 3h == Version G. | ||
2013 | * IT8712F Datasheet 0.9.1, section 8.3.5 indicates 8h == Version J. | ||
2014 | * These are the first revisions with 16-bit tachometer support. | ||
2015 | */ | ||
2016 | switch (data->type) { | ||
2017 | case it87: | ||
2018 | if (sio_data->revision >= 0x03) { | ||
2019 | data->features &= ~FEAT_OLD_AUTOPWM; | ||
2020 | data->features |= FEAT_16BIT_FANS; | ||
2021 | } | ||
2022 | break; | ||
2023 | case it8712: | ||
2024 | if (sio_data->revision >= 0x08) { | ||
2025 | data->features &= ~FEAT_OLD_AUTOPWM; | ||
2026 | data->features |= FEAT_16BIT_FANS; | ||
2027 | } | ||
2028 | break; | ||
2029 | default: | ||
2030 | break; | ||
2031 | } | ||
2008 | 2032 | ||
2009 | /* Now, we do the remaining detection. */ | 2033 | /* Now, we do the remaining detection. */ |
2010 | if ((it87_read_value(data, IT87_REG_CONFIG) & 0x80) | 2034 | if ((it87_read_value(data, IT87_REG_CONFIG) & 0x80) |
@@ -2068,6 +2092,12 @@ static int it87_probe(struct platform_device *pdev) | |||
2068 | err = sysfs_create_group(&dev->kobj, &it87_group_temp[i]); | 2092 | err = sysfs_create_group(&dev->kobj, &it87_group_temp[i]); |
2069 | if (err) | 2093 | if (err) |
2070 | goto error; | 2094 | goto error; |
2095 | if (has_temp_offset(data)) { | ||
2096 | err = sysfs_create_file(&dev->kobj, | ||
2097 | it87_attributes_temp_offset[i]); | ||
2098 | if (err) | ||
2099 | goto error; | ||
2100 | } | ||
2071 | if (sio_data->beep_pin) { | 2101 | if (sio_data->beep_pin) { |
2072 | err = sysfs_create_file(&dev->kobj, | 2102 | err = sysfs_create_file(&dev->kobj, |
2073 | it87_attributes_temp_beep[i]); | 2103 | it87_attributes_temp_beep[i]); |
@@ -2077,15 +2107,21 @@ static int it87_probe(struct platform_device *pdev) | |||
2077 | } | 2107 | } |
2078 | 2108 | ||
2079 | /* Do not create fan files for disabled fans */ | 2109 | /* Do not create fan files for disabled fans */ |
2080 | fan_group = it87_get_fan_group(data); | ||
2081 | fan_beep_need_rw = 1; | 2110 | fan_beep_need_rw = 1; |
2082 | for (i = 0; i < 5; i++) { | 2111 | for (i = 0; i < 5; i++) { |
2083 | if (!(data->has_fan & (1 << i))) | 2112 | if (!(data->has_fan & (1 << i))) |
2084 | continue; | 2113 | continue; |
2085 | err = sysfs_create_group(&dev->kobj, &fan_group[i]); | 2114 | err = sysfs_create_group(&dev->kobj, &it87_group_fan[i]); |
2086 | if (err) | 2115 | if (err) |
2087 | goto error; | 2116 | goto error; |
2088 | 2117 | ||
2118 | if (i < 3 && !has_16bit_fans(data)) { | ||
2119 | err = sysfs_create_file(&dev->kobj, | ||
2120 | it87_attributes_fan_div[i]); | ||
2121 | if (err) | ||
2122 | goto error; | ||
2123 | } | ||
2124 | |||
2089 | if (sio_data->beep_pin) { | 2125 | if (sio_data->beep_pin) { |
2090 | err = sysfs_create_file(&dev->kobj, | 2126 | err = sysfs_create_file(&dev->kobj, |
2091 | it87_attributes_fan_beep[i]); | 2127 | it87_attributes_fan_beep[i]); |
@@ -2221,8 +2257,8 @@ static int it87_check_pwm(struct device *dev) | |||
2221 | * PWM interface). | 2257 | * PWM interface). |
2222 | */ | 2258 | */ |
2223 | if (!((pwm[0] | pwm[1] | pwm[2]) & 0x80)) { | 2259 | if (!((pwm[0] | pwm[1] | pwm[2]) & 0x80)) { |
2224 | dev_info(dev, "Reconfiguring PWM to " | 2260 | dev_info(dev, |
2225 | "active high polarity\n"); | 2261 | "Reconfiguring PWM to active high polarity\n"); |
2226 | it87_write_value(data, IT87_REG_FAN_CTL, | 2262 | it87_write_value(data, IT87_REG_FAN_CTL, |
2227 | tmp | 0x87); | 2263 | tmp | 0x87); |
2228 | for (i = 0; i < 3; i++) | 2264 | for (i = 0; i < 3; i++) |
@@ -2232,16 +2268,16 @@ static int it87_check_pwm(struct device *dev) | |||
2232 | return 1; | 2268 | return 1; |
2233 | } | 2269 | } |
2234 | 2270 | ||
2235 | dev_info(dev, "PWM configuration is " | 2271 | dev_info(dev, |
2236 | "too broken to be fixed\n"); | 2272 | "PWM configuration is too broken to be fixed\n"); |
2237 | } | 2273 | } |
2238 | 2274 | ||
2239 | dev_info(dev, "Detected broken BIOS " | 2275 | dev_info(dev, |
2240 | "defaults, disabling PWM interface\n"); | 2276 | "Detected broken BIOS defaults, disabling PWM interface\n"); |
2241 | return 0; | 2277 | return 0; |
2242 | } else if (fix_pwm_polarity) { | 2278 | } else if (fix_pwm_polarity) { |
2243 | dev_info(dev, "PWM configuration looks " | 2279 | dev_info(dev, |
2244 | "sane, won't touch\n"); | 2280 | "PWM configuration looks sane, won't touch\n"); |
2245 | } | 2281 | } |
2246 | 2282 | ||
2247 | return 1; | 2283 | return 1; |
@@ -2389,42 +2425,46 @@ static struct it87_data *it87_update_device(struct device *dev) | |||
2389 | it87_read_value(data, IT87_REG_CONFIG) | 0x40); | 2425 | it87_read_value(data, IT87_REG_CONFIG) | 0x40); |
2390 | } | 2426 | } |
2391 | for (i = 0; i <= 7; i++) { | 2427 | for (i = 0; i <= 7; i++) { |
2392 | data->in[i] = | 2428 | data->in[i][0] = |
2393 | it87_read_value(data, IT87_REG_VIN(i)); | 2429 | it87_read_value(data, IT87_REG_VIN(i)); |
2394 | data->in_min[i] = | 2430 | data->in[i][1] = |
2395 | it87_read_value(data, IT87_REG_VIN_MIN(i)); | 2431 | it87_read_value(data, IT87_REG_VIN_MIN(i)); |
2396 | data->in_max[i] = | 2432 | data->in[i][2] = |
2397 | it87_read_value(data, IT87_REG_VIN_MAX(i)); | 2433 | it87_read_value(data, IT87_REG_VIN_MAX(i)); |
2398 | } | 2434 | } |
2399 | /* in8 (battery) has no limit registers */ | 2435 | /* in8 (battery) has no limit registers */ |
2400 | data->in[8] = it87_read_value(data, IT87_REG_VIN(8)); | 2436 | data->in[8][0] = it87_read_value(data, IT87_REG_VIN(8)); |
2401 | 2437 | ||
2402 | for (i = 0; i < 5; i++) { | 2438 | for (i = 0; i < 5; i++) { |
2403 | /* Skip disabled fans */ | 2439 | /* Skip disabled fans */ |
2404 | if (!(data->has_fan & (1 << i))) | 2440 | if (!(data->has_fan & (1 << i))) |
2405 | continue; | 2441 | continue; |
2406 | 2442 | ||
2407 | data->fan_min[i] = | 2443 | data->fan[i][1] = |
2408 | it87_read_value(data, IT87_REG_FAN_MIN[i]); | 2444 | it87_read_value(data, IT87_REG_FAN_MIN[i]); |
2409 | data->fan[i] = it87_read_value(data, | 2445 | data->fan[i][0] = it87_read_value(data, |
2410 | IT87_REG_FAN[i]); | 2446 | IT87_REG_FAN[i]); |
2411 | /* Add high byte if in 16-bit mode */ | 2447 | /* Add high byte if in 16-bit mode */ |
2412 | if (has_16bit_fans(data)) { | 2448 | if (has_16bit_fans(data)) { |
2413 | data->fan[i] |= it87_read_value(data, | 2449 | data->fan[i][0] |= it87_read_value(data, |
2414 | IT87_REG_FANX[i]) << 8; | 2450 | IT87_REG_FANX[i]) << 8; |
2415 | data->fan_min[i] |= it87_read_value(data, | 2451 | data->fan[i][1] |= it87_read_value(data, |
2416 | IT87_REG_FANX_MIN[i]) << 8; | 2452 | IT87_REG_FANX_MIN[i]) << 8; |
2417 | } | 2453 | } |
2418 | } | 2454 | } |
2419 | for (i = 0; i < 3; i++) { | 2455 | for (i = 0; i < 3; i++) { |
2420 | if (!(data->has_temp & (1 << i))) | 2456 | if (!(data->has_temp & (1 << i))) |
2421 | continue; | 2457 | continue; |
2422 | data->temp[i] = | 2458 | data->temp[i][0] = |
2423 | it87_read_value(data, IT87_REG_TEMP(i)); | 2459 | it87_read_value(data, IT87_REG_TEMP(i)); |
2424 | data->temp_high[i] = | 2460 | data->temp[i][1] = |
2425 | it87_read_value(data, IT87_REG_TEMP_HIGH(i)); | ||
2426 | data->temp_low[i] = | ||
2427 | it87_read_value(data, IT87_REG_TEMP_LOW(i)); | 2461 | it87_read_value(data, IT87_REG_TEMP_LOW(i)); |
2462 | data->temp[i][2] = | ||
2463 | it87_read_value(data, IT87_REG_TEMP_HIGH(i)); | ||
2464 | if (has_temp_offset(data)) | ||
2465 | data->temp[i][3] = | ||
2466 | it87_read_value(data, | ||
2467 | IT87_REG_TEMP_OFFSET[i]); | ||
2428 | } | 2468 | } |
2429 | 2469 | ||
2430 | /* Newer chips don't have clock dividers */ | 2470 | /* Newer chips don't have clock dividers */ |
@@ -2448,6 +2488,7 @@ static struct it87_data *it87_update_device(struct device *dev) | |||
2448 | it87_update_pwm_ctrl(data, i); | 2488 | it87_update_pwm_ctrl(data, i); |
2449 | 2489 | ||
2450 | data->sensor = it87_read_value(data, IT87_REG_TEMP_ENABLE); | 2490 | data->sensor = it87_read_value(data, IT87_REG_TEMP_ENABLE); |
2491 | data->extra = it87_read_value(data, IT87_REG_TEMP_EXTRA); | ||
2451 | /* | 2492 | /* |
2452 | * The IT8705F does not have VID capability. | 2493 | * The IT8705F does not have VID capability. |
2453 | * The IT8718F and later don't use IT87_REG_VID for the | 2494 | * The IT8718F and later don't use IT87_REG_VID for the |
@@ -2549,8 +2590,7 @@ static void __exit sm_it87_exit(void) | |||
2549 | } | 2590 | } |
2550 | 2591 | ||
2551 | 2592 | ||
2552 | MODULE_AUTHOR("Chris Gauthron, " | 2593 | MODULE_AUTHOR("Chris Gauthron, Jean Delvare <khali@linux-fr.org>"); |
2553 | "Jean Delvare <khali@linux-fr.org>"); | ||
2554 | MODULE_DESCRIPTION("IT8705F/IT871xF/IT872xF hardware monitoring driver"); | 2594 | MODULE_DESCRIPTION("IT8705F/IT871xF/IT872xF hardware monitoring driver"); |
2555 | module_param(update_vbat, bool, 0); | 2595 | module_param(update_vbat, bool, 0); |
2556 | MODULE_PARM_DESC(update_vbat, "Update vbat if set else return powerup value"); | 2596 | MODULE_PARM_DESC(update_vbat, "Update vbat if set else return powerup value"); |
diff --git a/drivers/hwmon/w83627ehf.c b/drivers/hwmon/w83627ehf.c index 55ac41c05561..0e8ffd6059a0 100644 --- a/drivers/hwmon/w83627ehf.c +++ b/drivers/hwmon/w83627ehf.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * w83627ehf - Driver for the hardware monitoring functionality of | 2 | * w83627ehf - Driver for the hardware monitoring functionality of |
3 | * the Winbond W83627EHF Super-I/O chip | 3 | * the Winbond W83627EHF Super-I/O chip |
4 | * Copyright (C) 2005-2011 Jean Delvare <khali@linux-fr.org> | 4 | * Copyright (C) 2005-2012 Jean Delvare <khali@linux-fr.org> |
5 | * Copyright (C) 2006 Yuan Mu (Winbond), | 5 | * Copyright (C) 2006 Yuan Mu (Winbond), |
6 | * Rudolf Marek <r.marek@assembler.cz> | 6 | * Rudolf Marek <r.marek@assembler.cz> |
7 | * David Hubbard <david.c.hubbard@gmail.com> | 7 | * David Hubbard <david.c.hubbard@gmail.com> |
@@ -502,6 +502,13 @@ struct w83627ehf_data { | |||
502 | u16 have_temp_offset; | 502 | u16 have_temp_offset; |
503 | u8 in6_skip:1; | 503 | u8 in6_skip:1; |
504 | u8 temp3_val_only:1; | 504 | u8 temp3_val_only:1; |
505 | |||
506 | #ifdef CONFIG_PM | ||
507 | /* Remember extra register values over suspend/resume */ | ||
508 | u8 vbat; | ||
509 | u8 fandiv1; | ||
510 | u8 fandiv2; | ||
511 | #endif | ||
505 | }; | 512 | }; |
506 | 513 | ||
507 | struct w83627ehf_sio_data { | 514 | struct w83627ehf_sio_data { |
@@ -898,6 +905,8 @@ static struct w83627ehf_data *w83627ehf_update_device(struct device *dev) | |||
898 | data->temp_max_hyst[i] | 905 | data->temp_max_hyst[i] |
899 | = w83627ehf_read_temp(data, | 906 | = w83627ehf_read_temp(data, |
900 | data->reg_temp_hyst[i]); | 907 | data->reg_temp_hyst[i]); |
908 | if (i > 2) | ||
909 | continue; | ||
901 | if (data->have_temp_offset & (1 << i)) | 910 | if (data->have_temp_offset & (1 << i)) |
902 | data->temp_offset[i] | 911 | data->temp_offset[i] |
903 | = w83627ehf_read_value(data, | 912 | = w83627ehf_read_value(data, |
@@ -2608,10 +2617,98 @@ static int w83627ehf_remove(struct platform_device *pdev) | |||
2608 | return 0; | 2617 | return 0; |
2609 | } | 2618 | } |
2610 | 2619 | ||
2620 | #ifdef CONFIG_PM | ||
2621 | static int w83627ehf_suspend(struct device *dev) | ||
2622 | { | ||
2623 | struct w83627ehf_data *data = w83627ehf_update_device(dev); | ||
2624 | struct w83627ehf_sio_data *sio_data = dev->platform_data; | ||
2625 | |||
2626 | mutex_lock(&data->update_lock); | ||
2627 | data->vbat = w83627ehf_read_value(data, W83627EHF_REG_VBAT); | ||
2628 | if (sio_data->kind == nct6775) { | ||
2629 | data->fandiv1 = w83627ehf_read_value(data, NCT6775_REG_FANDIV1); | ||
2630 | data->fandiv2 = w83627ehf_read_value(data, NCT6775_REG_FANDIV2); | ||
2631 | } | ||
2632 | mutex_unlock(&data->update_lock); | ||
2633 | |||
2634 | return 0; | ||
2635 | } | ||
2636 | |||
2637 | static int w83627ehf_resume(struct device *dev) | ||
2638 | { | ||
2639 | struct w83627ehf_data *data = dev_get_drvdata(dev); | ||
2640 | struct w83627ehf_sio_data *sio_data = dev->platform_data; | ||
2641 | int i; | ||
2642 | |||
2643 | mutex_lock(&data->update_lock); | ||
2644 | data->bank = 0xff; /* Force initial bank selection */ | ||
2645 | |||
2646 | /* Restore limits */ | ||
2647 | for (i = 0; i < data->in_num; i++) { | ||
2648 | if ((i == 6) && data->in6_skip) | ||
2649 | continue; | ||
2650 | |||
2651 | w83627ehf_write_value(data, W83627EHF_REG_IN_MIN(i), | ||
2652 | data->in_min[i]); | ||
2653 | w83627ehf_write_value(data, W83627EHF_REG_IN_MAX(i), | ||
2654 | data->in_max[i]); | ||
2655 | } | ||
2656 | |||
2657 | for (i = 0; i < 5; i++) { | ||
2658 | if (!(data->has_fan_min & (1 << i))) | ||
2659 | continue; | ||
2660 | |||
2661 | w83627ehf_write_value(data, data->REG_FAN_MIN[i], | ||
2662 | data->fan_min[i]); | ||
2663 | } | ||
2664 | |||
2665 | for (i = 0; i < NUM_REG_TEMP; i++) { | ||
2666 | if (!(data->have_temp & (1 << i))) | ||
2667 | continue; | ||
2668 | |||
2669 | if (data->reg_temp_over[i]) | ||
2670 | w83627ehf_write_temp(data, data->reg_temp_over[i], | ||
2671 | data->temp_max[i]); | ||
2672 | if (data->reg_temp_hyst[i]) | ||
2673 | w83627ehf_write_temp(data, data->reg_temp_hyst[i], | ||
2674 | data->temp_max_hyst[i]); | ||
2675 | if (i > 2) | ||
2676 | continue; | ||
2677 | if (data->have_temp_offset & (1 << i)) | ||
2678 | w83627ehf_write_value(data, | ||
2679 | W83627EHF_REG_TEMP_OFFSET[i], | ||
2680 | data->temp_offset[i]); | ||
2681 | } | ||
2682 | |||
2683 | /* Restore other settings */ | ||
2684 | w83627ehf_write_value(data, W83627EHF_REG_VBAT, data->vbat); | ||
2685 | if (sio_data->kind == nct6775) { | ||
2686 | w83627ehf_write_value(data, NCT6775_REG_FANDIV1, data->fandiv1); | ||
2687 | w83627ehf_write_value(data, NCT6775_REG_FANDIV2, data->fandiv2); | ||
2688 | } | ||
2689 | |||
2690 | /* Force re-reading all values */ | ||
2691 | data->valid = 0; | ||
2692 | mutex_unlock(&data->update_lock); | ||
2693 | |||
2694 | return 0; | ||
2695 | } | ||
2696 | |||
2697 | static const struct dev_pm_ops w83627ehf_dev_pm_ops = { | ||
2698 | .suspend = w83627ehf_suspend, | ||
2699 | .resume = w83627ehf_resume, | ||
2700 | }; | ||
2701 | |||
2702 | #define W83627EHF_DEV_PM_OPS (&w83627ehf_dev_pm_ops) | ||
2703 | #else | ||
2704 | #define W83627EHF_DEV_PM_OPS NULL | ||
2705 | #endif /* CONFIG_PM */ | ||
2706 | |||
2611 | static struct platform_driver w83627ehf_driver = { | 2707 | static struct platform_driver w83627ehf_driver = { |
2612 | .driver = { | 2708 | .driver = { |
2613 | .owner = THIS_MODULE, | 2709 | .owner = THIS_MODULE, |
2614 | .name = DRVNAME, | 2710 | .name = DRVNAME, |
2711 | .pm = W83627EHF_DEV_PM_OPS, | ||
2615 | }, | 2712 | }, |
2616 | .probe = w83627ehf_probe, | 2713 | .probe = w83627ehf_probe, |
2617 | .remove = w83627ehf_remove, | 2714 | .remove = w83627ehf_remove, |
diff --git a/drivers/hwmon/w83627hf.c b/drivers/hwmon/w83627hf.c index 7f68b8309d10..81f486520cea 100644 --- a/drivers/hwmon/w83627hf.c +++ b/drivers/hwmon/w83627hf.c | |||
@@ -5,7 +5,7 @@ | |||
5 | * Philip Edelbrock <phil@netroedge.com>, | 5 | * Philip Edelbrock <phil@netroedge.com>, |
6 | * and Mark Studebaker <mdsxyz123@yahoo.com> | 6 | * and Mark Studebaker <mdsxyz123@yahoo.com> |
7 | * Ported to 2.6 by Bernhard C. Schrenk <clemy@clemy.org> | 7 | * Ported to 2.6 by Bernhard C. Schrenk <clemy@clemy.org> |
8 | * Copyright (c) 2007 Jean Delvare <khali@linux-fr.org> | 8 | * Copyright (c) 2007 - 1012 Jean Delvare <khali@linux-fr.org> |
9 | * | 9 | * |
10 | * This program is free software; you can redistribute it and/or modify | 10 | * This program is free software; you can redistribute it and/or modify |
11 | * it under the terms of the GNU General Public License as published by | 11 | * it under the terms of the GNU General Public License as published by |
@@ -389,6 +389,12 @@ struct w83627hf_data { | |||
389 | */ | 389 | */ |
390 | u8 vrm; | 390 | u8 vrm; |
391 | u8 vrm_ovt; /* Register value, 627THF/637HF/687THF only */ | 391 | u8 vrm_ovt; /* Register value, 627THF/637HF/687THF only */ |
392 | |||
393 | #ifdef CONFIG_PM | ||
394 | /* Remember extra register values over suspend/resume */ | ||
395 | u8 scfg1; | ||
396 | u8 scfg2; | ||
397 | #endif | ||
392 | }; | 398 | }; |
393 | 399 | ||
394 | 400 | ||
@@ -401,10 +407,77 @@ static void w83627hf_update_fan_div(struct w83627hf_data *data); | |||
401 | static struct w83627hf_data *w83627hf_update_device(struct device *dev); | 407 | static struct w83627hf_data *w83627hf_update_device(struct device *dev); |
402 | static void w83627hf_init_device(struct platform_device *pdev); | 408 | static void w83627hf_init_device(struct platform_device *pdev); |
403 | 409 | ||
410 | #ifdef CONFIG_PM | ||
411 | static int w83627hf_suspend(struct device *dev) | ||
412 | { | ||
413 | struct w83627hf_data *data = w83627hf_update_device(dev); | ||
414 | |||
415 | mutex_lock(&data->update_lock); | ||
416 | data->scfg1 = w83627hf_read_value(data, W83781D_REG_SCFG1); | ||
417 | data->scfg2 = w83627hf_read_value(data, W83781D_REG_SCFG2); | ||
418 | mutex_unlock(&data->update_lock); | ||
419 | |||
420 | return 0; | ||
421 | } | ||
422 | |||
423 | static int w83627hf_resume(struct device *dev) | ||
424 | { | ||
425 | struct w83627hf_data *data = dev_get_drvdata(dev); | ||
426 | int i, num_temps = (data->type == w83697hf) ? 2 : 3; | ||
427 | |||
428 | /* Restore limits */ | ||
429 | mutex_lock(&data->update_lock); | ||
430 | for (i = 0; i <= 8; i++) { | ||
431 | /* skip missing sensors */ | ||
432 | if (((data->type == w83697hf) && (i == 1)) || | ||
433 | ((data->type != w83627hf && data->type != w83697hf) | ||
434 | && (i == 5 || i == 6))) | ||
435 | continue; | ||
436 | w83627hf_write_value(data, W83781D_REG_IN_MAX(i), | ||
437 | data->in_max[i]); | ||
438 | w83627hf_write_value(data, W83781D_REG_IN_MIN(i), | ||
439 | data->in_min[i]); | ||
440 | } | ||
441 | for (i = 0; i <= 2; i++) | ||
442 | w83627hf_write_value(data, W83627HF_REG_FAN_MIN(i), | ||
443 | data->fan_min[i]); | ||
444 | for (i = 0; i < num_temps; i++) { | ||
445 | w83627hf_write_value(data, w83627hf_reg_temp_over[i], | ||
446 | data->temp_max[i]); | ||
447 | w83627hf_write_value(data, w83627hf_reg_temp_hyst[i], | ||
448 | data->temp_max_hyst[i]); | ||
449 | } | ||
450 | |||
451 | /* Fixup BIOS bugs */ | ||
452 | if (data->type == w83627thf || data->type == w83637hf || | ||
453 | data->type == w83687thf) | ||
454 | w83627hf_write_value(data, W83627THF_REG_VRM_OVT_CFG, | ||
455 | data->vrm_ovt); | ||
456 | w83627hf_write_value(data, W83781D_REG_SCFG1, data->scfg1); | ||
457 | w83627hf_write_value(data, W83781D_REG_SCFG2, data->scfg2); | ||
458 | |||
459 | /* Force re-reading all values */ | ||
460 | data->valid = 0; | ||
461 | mutex_unlock(&data->update_lock); | ||
462 | |||
463 | return 0; | ||
464 | } | ||
465 | |||
466 | static const struct dev_pm_ops w83627hf_dev_pm_ops = { | ||
467 | .suspend = w83627hf_suspend, | ||
468 | .resume = w83627hf_resume, | ||
469 | }; | ||
470 | |||
471 | #define W83627HF_DEV_PM_OPS (&w83627hf_dev_pm_ops) | ||
472 | #else | ||
473 | #define W83627HF_DEV_PM_OPS NULL | ||
474 | #endif /* CONFIG_PM */ | ||
475 | |||
404 | static struct platform_driver w83627hf_driver = { | 476 | static struct platform_driver w83627hf_driver = { |
405 | .driver = { | 477 | .driver = { |
406 | .owner = THIS_MODULE, | 478 | .owner = THIS_MODULE, |
407 | .name = DRVNAME, | 479 | .name = DRVNAME, |
480 | .pm = W83627HF_DEV_PM_OPS, | ||
408 | }, | 481 | }, |
409 | .probe = w83627hf_probe, | 482 | .probe = w83627hf_probe, |
410 | .remove = w83627hf_remove, | 483 | .remove = w83627hf_remove, |
@@ -1659,8 +1732,10 @@ static void w83627hf_init_device(struct platform_device *pdev) | |||
1659 | /* Minimize conflicts with other winbond i2c-only clients... */ | 1732 | /* Minimize conflicts with other winbond i2c-only clients... */ |
1660 | /* disable i2c subclients... how to disable main i2c client?? */ | 1733 | /* disable i2c subclients... how to disable main i2c client?? */ |
1661 | /* force i2c address to relatively uncommon address */ | 1734 | /* force i2c address to relatively uncommon address */ |
1662 | w83627hf_write_value(data, W83781D_REG_I2C_SUBADDR, 0x89); | 1735 | if (type == w83627hf) { |
1663 | w83627hf_write_value(data, W83781D_REG_I2C_ADDR, force_i2c); | 1736 | w83627hf_write_value(data, W83781D_REG_I2C_SUBADDR, 0x89); |
1737 | w83627hf_write_value(data, W83781D_REG_I2C_ADDR, force_i2c); | ||
1738 | } | ||
1664 | 1739 | ||
1665 | /* Read VID only once */ | 1740 | /* Read VID only once */ |
1666 | if (type == w83627hf || type == w83637hf) { | 1741 | if (type == w83627hf || type == w83637hf) { |
diff --git a/drivers/lguest/core.c b/drivers/lguest/core.c index b5fdcb78a75b..a5ebc0083d87 100644 --- a/drivers/lguest/core.c +++ b/drivers/lguest/core.c | |||
@@ -225,7 +225,7 @@ int run_guest(struct lg_cpu *cpu, unsigned long __user *user) | |||
225 | * eventfd (ie. the appropriate virtqueue thread)? | 225 | * eventfd (ie. the appropriate virtqueue thread)? |
226 | */ | 226 | */ |
227 | if (!send_notify_to_eventfd(cpu)) { | 227 | if (!send_notify_to_eventfd(cpu)) { |
228 | /* OK, we tell the main Laucher. */ | 228 | /* OK, we tell the main Launcher. */ |
229 | if (put_user(cpu->pending_notify, user)) | 229 | if (put_user(cpu->pending_notify, user)) |
230 | return -EFAULT; | 230 | return -EFAULT; |
231 | return sizeof(cpu->pending_notify); | 231 | return sizeof(cpu->pending_notify); |
diff --git a/drivers/mfd/omap-usb-host.c b/drivers/mfd/omap-usb-host.c index 770a0d01e0b9..05164d7f054b 100644 --- a/drivers/mfd/omap-usb-host.c +++ b/drivers/mfd/omap-usb-host.c | |||
@@ -25,7 +25,6 @@ | |||
25 | #include <linux/dma-mapping.h> | 25 | #include <linux/dma-mapping.h> |
26 | #include <linux/spinlock.h> | 26 | #include <linux/spinlock.h> |
27 | #include <linux/gpio.h> | 27 | #include <linux/gpio.h> |
28 | #include <plat/cpu.h> | ||
29 | #include <linux/platform_device.h> | 28 | #include <linux/platform_device.h> |
30 | #include <linux/platform_data/usb-omap.h> | 29 | #include <linux/platform_data/usb-omap.h> |
31 | #include <linux/pm_runtime.h> | 30 | #include <linux/pm_runtime.h> |
@@ -384,7 +383,7 @@ static void omap_usbhs_init(struct device *dev) | |||
384 | reg &= ~OMAP_UHH_HOSTCONFIG_P3_CONNECT_STATUS; | 383 | reg &= ~OMAP_UHH_HOSTCONFIG_P3_CONNECT_STATUS; |
385 | 384 | ||
386 | /* Bypass the TLL module for PHY mode operation */ | 385 | /* Bypass the TLL module for PHY mode operation */ |
387 | if (cpu_is_omap3430() && (omap_rev() <= OMAP3430_REV_ES2_1)) { | 386 | if (pdata->single_ulpi_bypass) { |
388 | dev_dbg(dev, "OMAP3 ES version <= ES2.1\n"); | 387 | dev_dbg(dev, "OMAP3 ES version <= ES2.1\n"); |
389 | if (is_ehci_phy_mode(pdata->port_mode[0]) || | 388 | if (is_ehci_phy_mode(pdata->port_mode[0]) || |
390 | is_ehci_phy_mode(pdata->port_mode[1]) || | 389 | is_ehci_phy_mode(pdata->port_mode[1]) || |
diff --git a/drivers/mtd/ubi/attach.c b/drivers/mtd/ubi/attach.c index fec406b4553d..c071d410488f 100644 --- a/drivers/mtd/ubi/attach.c +++ b/drivers/mtd/ubi/attach.c | |||
@@ -322,7 +322,6 @@ static struct ubi_ainf_volume *add_volume(struct ubi_attach_info *ai, | |||
322 | int ubi_compare_lebs(struct ubi_device *ubi, const struct ubi_ainf_peb *aeb, | 322 | int ubi_compare_lebs(struct ubi_device *ubi, const struct ubi_ainf_peb *aeb, |
323 | int pnum, const struct ubi_vid_hdr *vid_hdr) | 323 | int pnum, const struct ubi_vid_hdr *vid_hdr) |
324 | { | 324 | { |
325 | void *buf; | ||
326 | int len, err, second_is_newer, bitflips = 0, corrupted = 0; | 325 | int len, err, second_is_newer, bitflips = 0, corrupted = 0; |
327 | uint32_t data_crc, crc; | 326 | uint32_t data_crc, crc; |
328 | struct ubi_vid_hdr *vh = NULL; | 327 | struct ubi_vid_hdr *vh = NULL; |
@@ -393,18 +392,14 @@ int ubi_compare_lebs(struct ubi_device *ubi, const struct ubi_ainf_peb *aeb, | |||
393 | /* Read the data of the copy and check the CRC */ | 392 | /* Read the data of the copy and check the CRC */ |
394 | 393 | ||
395 | len = be32_to_cpu(vid_hdr->data_size); | 394 | len = be32_to_cpu(vid_hdr->data_size); |
396 | buf = vmalloc(len); | ||
397 | if (!buf) { | ||
398 | err = -ENOMEM; | ||
399 | goto out_free_vidh; | ||
400 | } | ||
401 | 395 | ||
402 | err = ubi_io_read_data(ubi, buf, pnum, 0, len); | 396 | mutex_lock(&ubi->buf_mutex); |
397 | err = ubi_io_read_data(ubi, ubi->peb_buf, pnum, 0, len); | ||
403 | if (err && err != UBI_IO_BITFLIPS && !mtd_is_eccerr(err)) | 398 | if (err && err != UBI_IO_BITFLIPS && !mtd_is_eccerr(err)) |
404 | goto out_free_buf; | 399 | goto out_unlock; |
405 | 400 | ||
406 | data_crc = be32_to_cpu(vid_hdr->data_crc); | 401 | data_crc = be32_to_cpu(vid_hdr->data_crc); |
407 | crc = crc32(UBI_CRC32_INIT, buf, len); | 402 | crc = crc32(UBI_CRC32_INIT, ubi->peb_buf, len); |
408 | if (crc != data_crc) { | 403 | if (crc != data_crc) { |
409 | dbg_bld("PEB %d CRC error: calculated %#08x, must be %#08x", | 404 | dbg_bld("PEB %d CRC error: calculated %#08x, must be %#08x", |
410 | pnum, crc, data_crc); | 405 | pnum, crc, data_crc); |
@@ -415,8 +410,8 @@ int ubi_compare_lebs(struct ubi_device *ubi, const struct ubi_ainf_peb *aeb, | |||
415 | dbg_bld("PEB %d CRC is OK", pnum); | 410 | dbg_bld("PEB %d CRC is OK", pnum); |
416 | bitflips = !!err; | 411 | bitflips = !!err; |
417 | } | 412 | } |
413 | mutex_unlock(&ubi->buf_mutex); | ||
418 | 414 | ||
419 | vfree(buf); | ||
420 | ubi_free_vid_hdr(ubi, vh); | 415 | ubi_free_vid_hdr(ubi, vh); |
421 | 416 | ||
422 | if (second_is_newer) | 417 | if (second_is_newer) |
@@ -426,8 +421,8 @@ int ubi_compare_lebs(struct ubi_device *ubi, const struct ubi_ainf_peb *aeb, | |||
426 | 421 | ||
427 | return second_is_newer | (bitflips << 1) | (corrupted << 2); | 422 | return second_is_newer | (bitflips << 1) | (corrupted << 2); |
428 | 423 | ||
429 | out_free_buf: | 424 | out_unlock: |
430 | vfree(buf); | 425 | mutex_unlock(&ubi->buf_mutex); |
431 | out_free_vidh: | 426 | out_free_vidh: |
432 | ubi_free_vid_hdr(ubi, vh); | 427 | ubi_free_vid_hdr(ubi, vh); |
433 | return err; | 428 | return err; |
@@ -1453,7 +1448,7 @@ int ubi_attach(struct ubi_device *ubi, int force_scan) | |||
1453 | goto out_wl; | 1448 | goto out_wl; |
1454 | 1449 | ||
1455 | #ifdef CONFIG_MTD_UBI_FASTMAP | 1450 | #ifdef CONFIG_MTD_UBI_FASTMAP |
1456 | if (ubi->fm && ubi->dbg->chk_gen) { | 1451 | if (ubi->fm && ubi_dbg_chk_gen(ubi)) { |
1457 | struct ubi_attach_info *scan_ai; | 1452 | struct ubi_attach_info *scan_ai; |
1458 | 1453 | ||
1459 | scan_ai = alloc_ai("ubi_ckh_aeb_slab_cache"); | 1454 | scan_ai = alloc_ai("ubi_ckh_aeb_slab_cache"); |
@@ -1503,7 +1498,7 @@ static int self_check_ai(struct ubi_device *ubi, struct ubi_attach_info *ai) | |||
1503 | struct ubi_ainf_peb *aeb, *last_aeb; | 1498 | struct ubi_ainf_peb *aeb, *last_aeb; |
1504 | uint8_t *buf; | 1499 | uint8_t *buf; |
1505 | 1500 | ||
1506 | if (!ubi->dbg->chk_gen) | 1501 | if (!ubi_dbg_chk_gen(ubi)) |
1507 | return 0; | 1502 | return 0; |
1508 | 1503 | ||
1509 | /* | 1504 | /* |
diff --git a/drivers/mtd/ubi/build.c b/drivers/mtd/ubi/build.c index 344b4cb49d4e..a56133585e92 100644 --- a/drivers/mtd/ubi/build.c +++ b/drivers/mtd/ubi/build.c | |||
@@ -825,8 +825,7 @@ static int autoresize(struct ubi_device *ubi, int vol_id) | |||
825 | * No available PEBs to re-size the volume, clear the flag on | 825 | * No available PEBs to re-size the volume, clear the flag on |
826 | * flash and exit. | 826 | * flash and exit. |
827 | */ | 827 | */ |
828 | memcpy(&vtbl_rec, &ubi->vtbl[vol_id], | 828 | vtbl_rec = ubi->vtbl[vol_id]; |
829 | sizeof(struct ubi_vtbl_record)); | ||
830 | err = ubi_change_vtbl_record(ubi, vol_id, &vtbl_rec); | 829 | err = ubi_change_vtbl_record(ubi, vol_id, &vtbl_rec); |
831 | if (err) | 830 | if (err) |
832 | ubi_err("cannot clean auto-resize flag for volume %d", | 831 | ubi_err("cannot clean auto-resize flag for volume %d", |
@@ -986,14 +985,10 @@ int ubi_attach_mtd_dev(struct mtd_info *mtd, int ubi_num, | |||
986 | if (!ubi->fm_buf) | 985 | if (!ubi->fm_buf) |
987 | goto out_free; | 986 | goto out_free; |
988 | #endif | 987 | #endif |
989 | err = ubi_debugging_init_dev(ubi); | ||
990 | if (err) | ||
991 | goto out_free; | ||
992 | |||
993 | err = ubi_attach(ubi, 0); | 988 | err = ubi_attach(ubi, 0); |
994 | if (err) { | 989 | if (err) { |
995 | ubi_err("failed to attach mtd%d, error %d", mtd->index, err); | 990 | ubi_err("failed to attach mtd%d, error %d", mtd->index, err); |
996 | goto out_debugging; | 991 | goto out_free; |
997 | } | 992 | } |
998 | 993 | ||
999 | if (ubi->autoresize_vol_id != -1) { | 994 | if (ubi->autoresize_vol_id != -1) { |
@@ -1060,8 +1055,6 @@ out_detach: | |||
1060 | ubi_wl_close(ubi); | 1055 | ubi_wl_close(ubi); |
1061 | ubi_free_internal_volumes(ubi); | 1056 | ubi_free_internal_volumes(ubi); |
1062 | vfree(ubi->vtbl); | 1057 | vfree(ubi->vtbl); |
1063 | out_debugging: | ||
1064 | ubi_debugging_exit_dev(ubi); | ||
1065 | out_free: | 1058 | out_free: |
1066 | vfree(ubi->peb_buf); | 1059 | vfree(ubi->peb_buf); |
1067 | vfree(ubi->fm_buf); | 1060 | vfree(ubi->fm_buf); |
@@ -1139,7 +1132,6 @@ int ubi_detach_mtd_dev(int ubi_num, int anyway) | |||
1139 | ubi_free_internal_volumes(ubi); | 1132 | ubi_free_internal_volumes(ubi); |
1140 | vfree(ubi->vtbl); | 1133 | vfree(ubi->vtbl); |
1141 | put_mtd_device(ubi->mtd); | 1134 | put_mtd_device(ubi->mtd); |
1142 | ubi_debugging_exit_dev(ubi); | ||
1143 | vfree(ubi->peb_buf); | 1135 | vfree(ubi->peb_buf); |
1144 | vfree(ubi->fm_buf); | 1136 | vfree(ubi->fm_buf); |
1145 | ubi_msg("mtd%d is detached from ubi%d", ubi->mtd->index, ubi->ubi_num); | 1137 | ubi_msg("mtd%d is detached from ubi%d", ubi->mtd->index, ubi->ubi_num); |
diff --git a/drivers/mtd/ubi/debug.c b/drivers/mtd/ubi/debug.c index 26908a59506b..63cb1d7236ce 100644 --- a/drivers/mtd/ubi/debug.c +++ b/drivers/mtd/ubi/debug.c | |||
@@ -217,32 +217,6 @@ void ubi_dump_mkvol_req(const struct ubi_mkvol_req *req) | |||
217 | pr_err("\t1st 16 characters of name: %s\n", nm); | 217 | pr_err("\t1st 16 characters of name: %s\n", nm); |
218 | } | 218 | } |
219 | 219 | ||
220 | /** | ||
221 | * ubi_debugging_init_dev - initialize debugging for an UBI device. | ||
222 | * @ubi: UBI device description object | ||
223 | * | ||
224 | * This function initializes debugging-related data for UBI device @ubi. | ||
225 | * Returns zero in case of success and a negative error code in case of | ||
226 | * failure. | ||
227 | */ | ||
228 | int ubi_debugging_init_dev(struct ubi_device *ubi) | ||
229 | { | ||
230 | ubi->dbg = kzalloc(sizeof(struct ubi_debug_info), GFP_KERNEL); | ||
231 | if (!ubi->dbg) | ||
232 | return -ENOMEM; | ||
233 | |||
234 | return 0; | ||
235 | } | ||
236 | |||
237 | /** | ||
238 | * ubi_debugging_exit_dev - free debugging data for an UBI device. | ||
239 | * @ubi: UBI device description object | ||
240 | */ | ||
241 | void ubi_debugging_exit_dev(struct ubi_device *ubi) | ||
242 | { | ||
243 | kfree(ubi->dbg); | ||
244 | } | ||
245 | |||
246 | /* | 220 | /* |
247 | * Root directory for UBI stuff in debugfs. Contains sub-directories which | 221 | * Root directory for UBI stuff in debugfs. Contains sub-directories which |
248 | * contain the stuff specific to particular UBI devices. | 222 | * contain the stuff specific to particular UBI devices. |
@@ -295,7 +269,7 @@ static ssize_t dfs_file_read(struct file *file, char __user *user_buf, | |||
295 | ubi = ubi_get_device(ubi_num); | 269 | ubi = ubi_get_device(ubi_num); |
296 | if (!ubi) | 270 | if (!ubi) |
297 | return -ENODEV; | 271 | return -ENODEV; |
298 | d = ubi->dbg; | 272 | d = &ubi->dbg; |
299 | 273 | ||
300 | if (dent == d->dfs_chk_gen) | 274 | if (dent == d->dfs_chk_gen) |
301 | val = d->chk_gen; | 275 | val = d->chk_gen; |
@@ -341,7 +315,7 @@ static ssize_t dfs_file_write(struct file *file, const char __user *user_buf, | |||
341 | ubi = ubi_get_device(ubi_num); | 315 | ubi = ubi_get_device(ubi_num); |
342 | if (!ubi) | 316 | if (!ubi) |
343 | return -ENODEV; | 317 | return -ENODEV; |
344 | d = ubi->dbg; | 318 | d = &ubi->dbg; |
345 | 319 | ||
346 | buf_size = min_t(size_t, count, (sizeof(buf) - 1)); | 320 | buf_size = min_t(size_t, count, (sizeof(buf) - 1)); |
347 | if (copy_from_user(buf, user_buf, buf_size)) { | 321 | if (copy_from_user(buf, user_buf, buf_size)) { |
@@ -398,7 +372,7 @@ int ubi_debugfs_init_dev(struct ubi_device *ubi) | |||
398 | unsigned long ubi_num = ubi->ubi_num; | 372 | unsigned long ubi_num = ubi->ubi_num; |
399 | const char *fname; | 373 | const char *fname; |
400 | struct dentry *dent; | 374 | struct dentry *dent; |
401 | struct ubi_debug_info *d = ubi->dbg; | 375 | struct ubi_debug_info *d = &ubi->dbg; |
402 | 376 | ||
403 | if (!IS_ENABLED(CONFIG_DEBUG_FS)) | 377 | if (!IS_ENABLED(CONFIG_DEBUG_FS)) |
404 | return 0; | 378 | return 0; |
@@ -471,5 +445,5 @@ out: | |||
471 | void ubi_debugfs_exit_dev(struct ubi_device *ubi) | 445 | void ubi_debugfs_exit_dev(struct ubi_device *ubi) |
472 | { | 446 | { |
473 | if (IS_ENABLED(CONFIG_DEBUG_FS)) | 447 | if (IS_ENABLED(CONFIG_DEBUG_FS)) |
474 | debugfs_remove_recursive(ubi->dbg->dfs_dir); | 448 | debugfs_remove_recursive(ubi->dbg.dfs_dir); |
475 | } | 449 | } |
diff --git a/drivers/mtd/ubi/debug.h b/drivers/mtd/ubi/debug.h index 3dbc877d9663..33f8f3b2c9b2 100644 --- a/drivers/mtd/ubi/debug.h +++ b/drivers/mtd/ubi/debug.h | |||
@@ -60,51 +60,11 @@ void ubi_dump_aeb(const struct ubi_ainf_peb *aeb, int type); | |||
60 | void ubi_dump_mkvol_req(const struct ubi_mkvol_req *req); | 60 | void ubi_dump_mkvol_req(const struct ubi_mkvol_req *req); |
61 | int ubi_self_check_all_ff(struct ubi_device *ubi, int pnum, int offset, | 61 | int ubi_self_check_all_ff(struct ubi_device *ubi, int pnum, int offset, |
62 | int len); | 62 | int len); |
63 | int ubi_debugging_init_dev(struct ubi_device *ubi); | ||
64 | void ubi_debugging_exit_dev(struct ubi_device *ubi); | ||
65 | int ubi_debugfs_init(void); | 63 | int ubi_debugfs_init(void); |
66 | void ubi_debugfs_exit(void); | 64 | void ubi_debugfs_exit(void); |
67 | int ubi_debugfs_init_dev(struct ubi_device *ubi); | 65 | int ubi_debugfs_init_dev(struct ubi_device *ubi); |
68 | void ubi_debugfs_exit_dev(struct ubi_device *ubi); | 66 | void ubi_debugfs_exit_dev(struct ubi_device *ubi); |
69 | 67 | ||
70 | /* | ||
71 | * The UBI debugfs directory name pattern and maximum name length (3 for "ubi" | ||
72 | * + 2 for the number plus 1 for the trailing zero byte. | ||
73 | */ | ||
74 | #define UBI_DFS_DIR_NAME "ubi%d" | ||
75 | #define UBI_DFS_DIR_LEN (3 + 2 + 1) | ||
76 | |||
77 | /** | ||
78 | * struct ubi_debug_info - debugging information for an UBI device. | ||
79 | * | ||
80 | * @chk_gen: if UBI general extra checks are enabled | ||
81 | * @chk_io: if UBI I/O extra checks are enabled | ||
82 | * @disable_bgt: disable the background task for testing purposes | ||
83 | * @emulate_bitflips: emulate bit-flips for testing purposes | ||
84 | * @emulate_io_failures: emulate write/erase failures for testing purposes | ||
85 | * @dfs_dir_name: name of debugfs directory containing files of this UBI device | ||
86 | * @dfs_dir: direntry object of the UBI device debugfs directory | ||
87 | * @dfs_chk_gen: debugfs knob to enable UBI general extra checks | ||
88 | * @dfs_chk_io: debugfs knob to enable UBI I/O extra checks | ||
89 | * @dfs_disable_bgt: debugfs knob to disable the background task | ||
90 | * @dfs_emulate_bitflips: debugfs knob to emulate bit-flips | ||
91 | * @dfs_emulate_io_failures: debugfs knob to emulate write/erase failures | ||
92 | */ | ||
93 | struct ubi_debug_info { | ||
94 | unsigned int chk_gen:1; | ||
95 | unsigned int chk_io:1; | ||
96 | unsigned int disable_bgt:1; | ||
97 | unsigned int emulate_bitflips:1; | ||
98 | unsigned int emulate_io_failures:1; | ||
99 | char dfs_dir_name[UBI_DFS_DIR_LEN + 1]; | ||
100 | struct dentry *dfs_dir; | ||
101 | struct dentry *dfs_chk_gen; | ||
102 | struct dentry *dfs_chk_io; | ||
103 | struct dentry *dfs_disable_bgt; | ||
104 | struct dentry *dfs_emulate_bitflips; | ||
105 | struct dentry *dfs_emulate_io_failures; | ||
106 | }; | ||
107 | |||
108 | /** | 68 | /** |
109 | * ubi_dbg_is_bgt_disabled - if the background thread is disabled. | 69 | * ubi_dbg_is_bgt_disabled - if the background thread is disabled. |
110 | * @ubi: UBI device description object | 70 | * @ubi: UBI device description object |
@@ -114,7 +74,7 @@ struct ubi_debug_info { | |||
114 | */ | 74 | */ |
115 | static inline int ubi_dbg_is_bgt_disabled(const struct ubi_device *ubi) | 75 | static inline int ubi_dbg_is_bgt_disabled(const struct ubi_device *ubi) |
116 | { | 76 | { |
117 | return ubi->dbg->disable_bgt; | 77 | return ubi->dbg.disable_bgt; |
118 | } | 78 | } |
119 | 79 | ||
120 | /** | 80 | /** |
@@ -125,7 +85,7 @@ static inline int ubi_dbg_is_bgt_disabled(const struct ubi_device *ubi) | |||
125 | */ | 85 | */ |
126 | static inline int ubi_dbg_is_bitflip(const struct ubi_device *ubi) | 86 | static inline int ubi_dbg_is_bitflip(const struct ubi_device *ubi) |
127 | { | 87 | { |
128 | if (ubi->dbg->emulate_bitflips) | 88 | if (ubi->dbg.emulate_bitflips) |
129 | return !(random32() % 200); | 89 | return !(random32() % 200); |
130 | return 0; | 90 | return 0; |
131 | } | 91 | } |
@@ -139,7 +99,7 @@ static inline int ubi_dbg_is_bitflip(const struct ubi_device *ubi) | |||
139 | */ | 99 | */ |
140 | static inline int ubi_dbg_is_write_failure(const struct ubi_device *ubi) | 100 | static inline int ubi_dbg_is_write_failure(const struct ubi_device *ubi) |
141 | { | 101 | { |
142 | if (ubi->dbg->emulate_io_failures) | 102 | if (ubi->dbg.emulate_io_failures) |
143 | return !(random32() % 500); | 103 | return !(random32() % 500); |
144 | return 0; | 104 | return 0; |
145 | } | 105 | } |
@@ -153,9 +113,18 @@ static inline int ubi_dbg_is_write_failure(const struct ubi_device *ubi) | |||
153 | */ | 113 | */ |
154 | static inline int ubi_dbg_is_erase_failure(const struct ubi_device *ubi) | 114 | static inline int ubi_dbg_is_erase_failure(const struct ubi_device *ubi) |
155 | { | 115 | { |
156 | if (ubi->dbg->emulate_io_failures) | 116 | if (ubi->dbg.emulate_io_failures) |
157 | return !(random32() % 400); | 117 | return !(random32() % 400); |
158 | return 0; | 118 | return 0; |
159 | } | 119 | } |
160 | 120 | ||
121 | static inline int ubi_dbg_chk_io(const struct ubi_device *ubi) | ||
122 | { | ||
123 | return ubi->dbg.chk_io; | ||
124 | } | ||
125 | |||
126 | static inline int ubi_dbg_chk_gen(const struct ubi_device *ubi) | ||
127 | { | ||
128 | return ubi->dbg.chk_gen; | ||
129 | } | ||
161 | #endif /* !__UBI_DEBUG_H__ */ | 130 | #endif /* !__UBI_DEBUG_H__ */ |
diff --git a/drivers/mtd/ubi/fastmap.c b/drivers/mtd/ubi/fastmap.c index 1a5f53c090d4..0648c6996d43 100644 --- a/drivers/mtd/ubi/fastmap.c +++ b/drivers/mtd/ubi/fastmap.c | |||
@@ -814,10 +814,8 @@ static int ubi_attach_fastmap(struct ubi_device *ubi, | |||
814 | if (max_sqnum > ai->max_sqnum) | 814 | if (max_sqnum > ai->max_sqnum) |
815 | ai->max_sqnum = max_sqnum; | 815 | ai->max_sqnum = max_sqnum; |
816 | 816 | ||
817 | list_for_each_entry_safe(tmp_aeb, _tmp_aeb, &free, u.list) { | 817 | list_for_each_entry_safe(tmp_aeb, _tmp_aeb, &free, u.list) |
818 | list_del(&tmp_aeb->u.list); | 818 | list_move_tail(&tmp_aeb->u.list, &ai->free); |
819 | list_add_tail(&tmp_aeb->u.list, &ai->free); | ||
820 | } | ||
821 | 819 | ||
822 | /* | 820 | /* |
823 | * If fastmap is leaking PEBs (must not happen), raise a | 821 | * If fastmap is leaking PEBs (must not happen), raise a |
diff --git a/drivers/mtd/ubi/gluebi.c b/drivers/mtd/ubi/gluebi.c index 4bd4db8c84c9..b93807b4c459 100644 --- a/drivers/mtd/ubi/gluebi.c +++ b/drivers/mtd/ubi/gluebi.c | |||
@@ -171,17 +171,17 @@ static void gluebi_put_device(struct mtd_info *mtd) | |||
171 | static int gluebi_read(struct mtd_info *mtd, loff_t from, size_t len, | 171 | static int gluebi_read(struct mtd_info *mtd, loff_t from, size_t len, |
172 | size_t *retlen, unsigned char *buf) | 172 | size_t *retlen, unsigned char *buf) |
173 | { | 173 | { |
174 | int err = 0, lnum, offs, total_read; | 174 | int err = 0, lnum, offs, bytes_left; |
175 | struct gluebi_device *gluebi; | 175 | struct gluebi_device *gluebi; |
176 | 176 | ||
177 | gluebi = container_of(mtd, struct gluebi_device, mtd); | 177 | gluebi = container_of(mtd, struct gluebi_device, mtd); |
178 | lnum = div_u64_rem(from, mtd->erasesize, &offs); | 178 | lnum = div_u64_rem(from, mtd->erasesize, &offs); |
179 | total_read = len; | 179 | bytes_left = len; |
180 | while (total_read) { | 180 | while (bytes_left) { |
181 | size_t to_read = mtd->erasesize - offs; | 181 | size_t to_read = mtd->erasesize - offs; |
182 | 182 | ||
183 | if (to_read > total_read) | 183 | if (to_read > bytes_left) |
184 | to_read = total_read; | 184 | to_read = bytes_left; |
185 | 185 | ||
186 | err = ubi_read(gluebi->desc, lnum, buf, offs, to_read); | 186 | err = ubi_read(gluebi->desc, lnum, buf, offs, to_read); |
187 | if (err) | 187 | if (err) |
@@ -189,11 +189,11 @@ static int gluebi_read(struct mtd_info *mtd, loff_t from, size_t len, | |||
189 | 189 | ||
190 | lnum += 1; | 190 | lnum += 1; |
191 | offs = 0; | 191 | offs = 0; |
192 | total_read -= to_read; | 192 | bytes_left -= to_read; |
193 | buf += to_read; | 193 | buf += to_read; |
194 | } | 194 | } |
195 | 195 | ||
196 | *retlen = len - total_read; | 196 | *retlen = len - bytes_left; |
197 | return err; | 197 | return err; |
198 | } | 198 | } |
199 | 199 | ||
@@ -211,7 +211,7 @@ static int gluebi_read(struct mtd_info *mtd, loff_t from, size_t len, | |||
211 | static int gluebi_write(struct mtd_info *mtd, loff_t to, size_t len, | 211 | static int gluebi_write(struct mtd_info *mtd, loff_t to, size_t len, |
212 | size_t *retlen, const u_char *buf) | 212 | size_t *retlen, const u_char *buf) |
213 | { | 213 | { |
214 | int err = 0, lnum, offs, total_written; | 214 | int err = 0, lnum, offs, bytes_left; |
215 | struct gluebi_device *gluebi; | 215 | struct gluebi_device *gluebi; |
216 | 216 | ||
217 | gluebi = container_of(mtd, struct gluebi_device, mtd); | 217 | gluebi = container_of(mtd, struct gluebi_device, mtd); |
@@ -220,12 +220,12 @@ static int gluebi_write(struct mtd_info *mtd, loff_t to, size_t len, | |||
220 | if (len % mtd->writesize || offs % mtd->writesize) | 220 | if (len % mtd->writesize || offs % mtd->writesize) |
221 | return -EINVAL; | 221 | return -EINVAL; |
222 | 222 | ||
223 | total_written = len; | 223 | bytes_left = len; |
224 | while (total_written) { | 224 | while (bytes_left) { |
225 | size_t to_write = mtd->erasesize - offs; | 225 | size_t to_write = mtd->erasesize - offs; |
226 | 226 | ||
227 | if (to_write > total_written) | 227 | if (to_write > bytes_left) |
228 | to_write = total_written; | 228 | to_write = bytes_left; |
229 | 229 | ||
230 | err = ubi_leb_write(gluebi->desc, lnum, buf, offs, to_write); | 230 | err = ubi_leb_write(gluebi->desc, lnum, buf, offs, to_write); |
231 | if (err) | 231 | if (err) |
@@ -233,11 +233,11 @@ static int gluebi_write(struct mtd_info *mtd, loff_t to, size_t len, | |||
233 | 233 | ||
234 | lnum += 1; | 234 | lnum += 1; |
235 | offs = 0; | 235 | offs = 0; |
236 | total_written -= to_write; | 236 | bytes_left -= to_write; |
237 | buf += to_write; | 237 | buf += to_write; |
238 | } | 238 | } |
239 | 239 | ||
240 | *retlen = len - total_written; | 240 | *retlen = len - bytes_left; |
241 | return err; | 241 | return err; |
242 | } | 242 | } |
243 | 243 | ||
diff --git a/drivers/mtd/ubi/io.c b/drivers/mtd/ubi/io.c index 78a1dcbf2107..bf79def40126 100644 --- a/drivers/mtd/ubi/io.c +++ b/drivers/mtd/ubi/io.c | |||
@@ -1132,7 +1132,7 @@ static int self_check_not_bad(const struct ubi_device *ubi, int pnum) | |||
1132 | { | 1132 | { |
1133 | int err; | 1133 | int err; |
1134 | 1134 | ||
1135 | if (!ubi->dbg->chk_io) | 1135 | if (!ubi_dbg_chk_io(ubi)) |
1136 | return 0; | 1136 | return 0; |
1137 | 1137 | ||
1138 | err = ubi_io_is_bad(ubi, pnum); | 1138 | err = ubi_io_is_bad(ubi, pnum); |
@@ -1159,7 +1159,7 @@ static int self_check_ec_hdr(const struct ubi_device *ubi, int pnum, | |||
1159 | int err; | 1159 | int err; |
1160 | uint32_t magic; | 1160 | uint32_t magic; |
1161 | 1161 | ||
1162 | if (!ubi->dbg->chk_io) | 1162 | if (!ubi_dbg_chk_io(ubi)) |
1163 | return 0; | 1163 | return 0; |
1164 | 1164 | ||
1165 | magic = be32_to_cpu(ec_hdr->magic); | 1165 | magic = be32_to_cpu(ec_hdr->magic); |
@@ -1197,7 +1197,7 @@ static int self_check_peb_ec_hdr(const struct ubi_device *ubi, int pnum) | |||
1197 | uint32_t crc, hdr_crc; | 1197 | uint32_t crc, hdr_crc; |
1198 | struct ubi_ec_hdr *ec_hdr; | 1198 | struct ubi_ec_hdr *ec_hdr; |
1199 | 1199 | ||
1200 | if (!ubi->dbg->chk_io) | 1200 | if (!ubi_dbg_chk_io(ubi)) |
1201 | return 0; | 1201 | return 0; |
1202 | 1202 | ||
1203 | ec_hdr = kzalloc(ubi->ec_hdr_alsize, GFP_NOFS); | 1203 | ec_hdr = kzalloc(ubi->ec_hdr_alsize, GFP_NOFS); |
@@ -1241,7 +1241,7 @@ static int self_check_vid_hdr(const struct ubi_device *ubi, int pnum, | |||
1241 | int err; | 1241 | int err; |
1242 | uint32_t magic; | 1242 | uint32_t magic; |
1243 | 1243 | ||
1244 | if (!ubi->dbg->chk_io) | 1244 | if (!ubi_dbg_chk_io(ubi)) |
1245 | return 0; | 1245 | return 0; |
1246 | 1246 | ||
1247 | magic = be32_to_cpu(vid_hdr->magic); | 1247 | magic = be32_to_cpu(vid_hdr->magic); |
@@ -1282,7 +1282,7 @@ static int self_check_peb_vid_hdr(const struct ubi_device *ubi, int pnum) | |||
1282 | struct ubi_vid_hdr *vid_hdr; | 1282 | struct ubi_vid_hdr *vid_hdr; |
1283 | void *p; | 1283 | void *p; |
1284 | 1284 | ||
1285 | if (!ubi->dbg->chk_io) | 1285 | if (!ubi_dbg_chk_io(ubi)) |
1286 | return 0; | 1286 | return 0; |
1287 | 1287 | ||
1288 | vid_hdr = ubi_zalloc_vid_hdr(ubi, GFP_NOFS); | 1288 | vid_hdr = ubi_zalloc_vid_hdr(ubi, GFP_NOFS); |
@@ -1334,7 +1334,7 @@ static int self_check_write(struct ubi_device *ubi, const void *buf, int pnum, | |||
1334 | void *buf1; | 1334 | void *buf1; |
1335 | loff_t addr = (loff_t)pnum * ubi->peb_size + offset; | 1335 | loff_t addr = (loff_t)pnum * ubi->peb_size + offset; |
1336 | 1336 | ||
1337 | if (!ubi->dbg->chk_io) | 1337 | if (!ubi_dbg_chk_io(ubi)) |
1338 | return 0; | 1338 | return 0; |
1339 | 1339 | ||
1340 | buf1 = __vmalloc(len, GFP_NOFS, PAGE_KERNEL); | 1340 | buf1 = __vmalloc(len, GFP_NOFS, PAGE_KERNEL); |
@@ -1398,7 +1398,7 @@ int ubi_self_check_all_ff(struct ubi_device *ubi, int pnum, int offset, int len) | |||
1398 | void *buf; | 1398 | void *buf; |
1399 | loff_t addr = (loff_t)pnum * ubi->peb_size + offset; | 1399 | loff_t addr = (loff_t)pnum * ubi->peb_size + offset; |
1400 | 1400 | ||
1401 | if (!ubi->dbg->chk_io) | 1401 | if (!ubi_dbg_chk_io(ubi)) |
1402 | return 0; | 1402 | return 0; |
1403 | 1403 | ||
1404 | buf = __vmalloc(len, GFP_NOFS, PAGE_KERNEL); | 1404 | buf = __vmalloc(len, GFP_NOFS, PAGE_KERNEL); |
diff --git a/drivers/mtd/ubi/ubi.h b/drivers/mtd/ubi/ubi.h index 7d57469723cf..8ea6297a208f 100644 --- a/drivers/mtd/ubi/ubi.h +++ b/drivers/mtd/ubi/ubi.h | |||
@@ -85,6 +85,13 @@ | |||
85 | #define UBI_UNKNOWN -1 | 85 | #define UBI_UNKNOWN -1 |
86 | 86 | ||
87 | /* | 87 | /* |
88 | * The UBI debugfs directory name pattern and maximum name length (3 for "ubi" | ||
89 | * + 2 for the number plus 1 for the trailing zero byte. | ||
90 | */ | ||
91 | #define UBI_DFS_DIR_NAME "ubi%d" | ||
92 | #define UBI_DFS_DIR_LEN (3 + 2 + 1) | ||
93 | |||
94 | /* | ||
88 | * Error codes returned by the I/O sub-system. | 95 | * Error codes returned by the I/O sub-system. |
89 | * | 96 | * |
90 | * UBI_IO_FF: the read region of flash contains only 0xFFs | 97 | * UBI_IO_FF: the read region of flash contains only 0xFFs |
@@ -342,6 +349,37 @@ struct ubi_volume_desc { | |||
342 | struct ubi_wl_entry; | 349 | struct ubi_wl_entry; |
343 | 350 | ||
344 | /** | 351 | /** |
352 | * struct ubi_debug_info - debugging information for an UBI device. | ||
353 | * | ||
354 | * @chk_gen: if UBI general extra checks are enabled | ||
355 | * @chk_io: if UBI I/O extra checks are enabled | ||
356 | * @disable_bgt: disable the background task for testing purposes | ||
357 | * @emulate_bitflips: emulate bit-flips for testing purposes | ||
358 | * @emulate_io_failures: emulate write/erase failures for testing purposes | ||
359 | * @dfs_dir_name: name of debugfs directory containing files of this UBI device | ||
360 | * @dfs_dir: direntry object of the UBI device debugfs directory | ||
361 | * @dfs_chk_gen: debugfs knob to enable UBI general extra checks | ||
362 | * @dfs_chk_io: debugfs knob to enable UBI I/O extra checks | ||
363 | * @dfs_disable_bgt: debugfs knob to disable the background task | ||
364 | * @dfs_emulate_bitflips: debugfs knob to emulate bit-flips | ||
365 | * @dfs_emulate_io_failures: debugfs knob to emulate write/erase failures | ||
366 | */ | ||
367 | struct ubi_debug_info { | ||
368 | unsigned int chk_gen:1; | ||
369 | unsigned int chk_io:1; | ||
370 | unsigned int disable_bgt:1; | ||
371 | unsigned int emulate_bitflips:1; | ||
372 | unsigned int emulate_io_failures:1; | ||
373 | char dfs_dir_name[UBI_DFS_DIR_LEN + 1]; | ||
374 | struct dentry *dfs_dir; | ||
375 | struct dentry *dfs_chk_gen; | ||
376 | struct dentry *dfs_chk_io; | ||
377 | struct dentry *dfs_disable_bgt; | ||
378 | struct dentry *dfs_emulate_bitflips; | ||
379 | struct dentry *dfs_emulate_io_failures; | ||
380 | }; | ||
381 | |||
382 | /** | ||
345 | * struct ubi_device - UBI device description structure | 383 | * struct ubi_device - UBI device description structure |
346 | * @dev: UBI device object to use the the Linux device model | 384 | * @dev: UBI device object to use the the Linux device model |
347 | * @cdev: character device object to create character device | 385 | * @cdev: character device object to create character device |
@@ -545,7 +583,7 @@ struct ubi_device { | |||
545 | struct mutex buf_mutex; | 583 | struct mutex buf_mutex; |
546 | struct mutex ckvol_mutex; | 584 | struct mutex ckvol_mutex; |
547 | 585 | ||
548 | struct ubi_debug_info *dbg; | 586 | struct ubi_debug_info dbg; |
549 | }; | 587 | }; |
550 | 588 | ||
551 | /** | 589 | /** |
diff --git a/drivers/mtd/ubi/upd.c b/drivers/mtd/ubi/upd.c index 9f2ebd8750e7..ec2c2dc1c1ca 100644 --- a/drivers/mtd/ubi/upd.c +++ b/drivers/mtd/ubi/upd.c | |||
@@ -64,8 +64,7 @@ static int set_update_marker(struct ubi_device *ubi, struct ubi_volume *vol) | |||
64 | return 0; | 64 | return 0; |
65 | } | 65 | } |
66 | 66 | ||
67 | memcpy(&vtbl_rec, &ubi->vtbl[vol->vol_id], | 67 | vtbl_rec = ubi->vtbl[vol->vol_id]; |
68 | sizeof(struct ubi_vtbl_record)); | ||
69 | vtbl_rec.upd_marker = 1; | 68 | vtbl_rec.upd_marker = 1; |
70 | 69 | ||
71 | mutex_lock(&ubi->device_mutex); | 70 | mutex_lock(&ubi->device_mutex); |
@@ -93,8 +92,7 @@ static int clear_update_marker(struct ubi_device *ubi, struct ubi_volume *vol, | |||
93 | 92 | ||
94 | dbg_gen("clear update marker for volume %d", vol->vol_id); | 93 | dbg_gen("clear update marker for volume %d", vol->vol_id); |
95 | 94 | ||
96 | memcpy(&vtbl_rec, &ubi->vtbl[vol->vol_id], | 95 | vtbl_rec = ubi->vtbl[vol->vol_id]; |
97 | sizeof(struct ubi_vtbl_record)); | ||
98 | ubi_assert(vol->upd_marker && vtbl_rec.upd_marker); | 96 | ubi_assert(vol->upd_marker && vtbl_rec.upd_marker); |
99 | vtbl_rec.upd_marker = 0; | 97 | vtbl_rec.upd_marker = 0; |
100 | 98 | ||
diff --git a/drivers/mtd/ubi/vmt.c b/drivers/mtd/ubi/vmt.c index 9169e58c262e..8330703c098f 100644 --- a/drivers/mtd/ubi/vmt.c +++ b/drivers/mtd/ubi/vmt.c | |||
@@ -535,7 +535,7 @@ int ubi_resize_volume(struct ubi_volume_desc *desc, int reserved_pebs) | |||
535 | } | 535 | } |
536 | 536 | ||
537 | /* Change volume table record */ | 537 | /* Change volume table record */ |
538 | memcpy(&vtbl_rec, &ubi->vtbl[vol_id], sizeof(struct ubi_vtbl_record)); | 538 | vtbl_rec = ubi->vtbl[vol_id]; |
539 | vtbl_rec.reserved_pebs = cpu_to_be32(reserved_pebs); | 539 | vtbl_rec.reserved_pebs = cpu_to_be32(reserved_pebs); |
540 | err = ubi_change_vtbl_record(ubi, vol_id, &vtbl_rec); | 540 | err = ubi_change_vtbl_record(ubi, vol_id, &vtbl_rec); |
541 | if (err) | 541 | if (err) |
@@ -847,7 +847,7 @@ static int self_check_volumes(struct ubi_device *ubi) | |||
847 | { | 847 | { |
848 | int i, err = 0; | 848 | int i, err = 0; |
849 | 849 | ||
850 | if (!ubi->dbg->chk_gen) | 850 | if (!ubi_dbg_chk_gen(ubi)) |
851 | return 0; | 851 | return 0; |
852 | 852 | ||
853 | for (i = 0; i < ubi->vtbl_slots; i++) { | 853 | for (i = 0; i < ubi->vtbl_slots; i++) { |
diff --git a/drivers/mtd/ubi/vtbl.c b/drivers/mtd/ubi/vtbl.c index 926e3df14fb2..d77b1c1d7c72 100644 --- a/drivers/mtd/ubi/vtbl.c +++ b/drivers/mtd/ubi/vtbl.c | |||
@@ -858,7 +858,7 @@ out_free: | |||
858 | */ | 858 | */ |
859 | static void self_vtbl_check(const struct ubi_device *ubi) | 859 | static void self_vtbl_check(const struct ubi_device *ubi) |
860 | { | 860 | { |
861 | if (!ubi->dbg->chk_gen) | 861 | if (!ubi_dbg_chk_gen(ubi)) |
862 | return; | 862 | return; |
863 | 863 | ||
864 | if (vtbl_check(ubi, ubi->vtbl)) { | 864 | if (vtbl_check(ubi, ubi->vtbl)) { |
diff --git a/drivers/mtd/ubi/wl.c b/drivers/mtd/ubi/wl.c index 2144f611196e..5df49d3cb5c7 100644 --- a/drivers/mtd/ubi/wl.c +++ b/drivers/mtd/ubi/wl.c | |||
@@ -1,5 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * @ubi: UBI device description object | ||
3 | * Copyright (c) International Business Machines Corp., 2006 | 2 | * Copyright (c) International Business Machines Corp., 2006 |
4 | * | 3 | * |
5 | * This program is free software; you can redistribute it and/or modify | 4 | * This program is free software; you can redistribute it and/or modify |
@@ -2050,7 +2049,7 @@ static int self_check_ec(struct ubi_device *ubi, int pnum, int ec) | |||
2050 | long long read_ec; | 2049 | long long read_ec; |
2051 | struct ubi_ec_hdr *ec_hdr; | 2050 | struct ubi_ec_hdr *ec_hdr; |
2052 | 2051 | ||
2053 | if (!ubi->dbg->chk_gen) | 2052 | if (!ubi_dbg_chk_gen(ubi)) |
2054 | return 0; | 2053 | return 0; |
2055 | 2054 | ||
2056 | ec_hdr = kzalloc(ubi->ec_hdr_alsize, GFP_NOFS); | 2055 | ec_hdr = kzalloc(ubi->ec_hdr_alsize, GFP_NOFS); |
@@ -2090,7 +2089,7 @@ out_free: | |||
2090 | static int self_check_in_wl_tree(const struct ubi_device *ubi, | 2089 | static int self_check_in_wl_tree(const struct ubi_device *ubi, |
2091 | struct ubi_wl_entry *e, struct rb_root *root) | 2090 | struct ubi_wl_entry *e, struct rb_root *root) |
2092 | { | 2091 | { |
2093 | if (!ubi->dbg->chk_gen) | 2092 | if (!ubi_dbg_chk_gen(ubi)) |
2094 | return 0; | 2093 | return 0; |
2095 | 2094 | ||
2096 | if (in_wl_tree(e, root)) | 2095 | if (in_wl_tree(e, root)) |
@@ -2116,7 +2115,7 @@ static int self_check_in_pq(const struct ubi_device *ubi, | |||
2116 | struct ubi_wl_entry *p; | 2115 | struct ubi_wl_entry *p; |
2117 | int i; | 2116 | int i; |
2118 | 2117 | ||
2119 | if (!ubi->dbg->chk_gen) | 2118 | if (!ubi_dbg_chk_gen(ubi)) |
2120 | return 0; | 2119 | return 0; |
2121 | 2120 | ||
2122 | for (i = 0; i < UBI_PROT_QUEUE_LEN; ++i) | 2121 | for (i = 0; i < UBI_PROT_QUEUE_LEN; ++i) |
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index 68d64f0313ea..a6fcf15adc4f 100644 --- a/drivers/net/virtio_net.c +++ b/drivers/net/virtio_net.c | |||
@@ -130,7 +130,6 @@ struct skb_vnet_hdr { | |||
130 | struct virtio_net_hdr hdr; | 130 | struct virtio_net_hdr hdr; |
131 | struct virtio_net_hdr_mrg_rxbuf mhdr; | 131 | struct virtio_net_hdr_mrg_rxbuf mhdr; |
132 | }; | 132 | }; |
133 | unsigned int num_sg; | ||
134 | }; | 133 | }; |
135 | 134 | ||
136 | struct padded_vnet_hdr { | 135 | struct padded_vnet_hdr { |
@@ -530,10 +529,10 @@ static bool try_fill_recv(struct receive_queue *rq, gfp_t gfp) | |||
530 | err = add_recvbuf_small(rq, gfp); | 529 | err = add_recvbuf_small(rq, gfp); |
531 | 530 | ||
532 | oom = err == -ENOMEM; | 531 | oom = err == -ENOMEM; |
533 | if (err < 0) | 532 | if (err) |
534 | break; | 533 | break; |
535 | ++rq->num; | 534 | ++rq->num; |
536 | } while (err > 0); | 535 | } while (rq->vq->num_free); |
537 | if (unlikely(rq->num > rq->max)) | 536 | if (unlikely(rq->num > rq->max)) |
538 | rq->max = rq->num; | 537 | rq->max = rq->num; |
539 | virtqueue_kick(rq->vq); | 538 | virtqueue_kick(rq->vq); |
@@ -640,10 +639,10 @@ static int virtnet_open(struct net_device *dev) | |||
640 | return 0; | 639 | return 0; |
641 | } | 640 | } |
642 | 641 | ||
643 | static unsigned int free_old_xmit_skbs(struct send_queue *sq) | 642 | static void free_old_xmit_skbs(struct send_queue *sq) |
644 | { | 643 | { |
645 | struct sk_buff *skb; | 644 | struct sk_buff *skb; |
646 | unsigned int len, tot_sgs = 0; | 645 | unsigned int len; |
647 | struct virtnet_info *vi = sq->vq->vdev->priv; | 646 | struct virtnet_info *vi = sq->vq->vdev->priv; |
648 | struct virtnet_stats *stats = this_cpu_ptr(vi->stats); | 647 | struct virtnet_stats *stats = this_cpu_ptr(vi->stats); |
649 | 648 | ||
@@ -655,10 +654,8 @@ static unsigned int free_old_xmit_skbs(struct send_queue *sq) | |||
655 | stats->tx_packets++; | 654 | stats->tx_packets++; |
656 | u64_stats_update_end(&stats->tx_syncp); | 655 | u64_stats_update_end(&stats->tx_syncp); |
657 | 656 | ||
658 | tot_sgs += skb_vnet_hdr(skb)->num_sg; | ||
659 | dev_kfree_skb_any(skb); | 657 | dev_kfree_skb_any(skb); |
660 | } | 658 | } |
661 | return tot_sgs; | ||
662 | } | 659 | } |
663 | 660 | ||
664 | static int xmit_skb(struct send_queue *sq, struct sk_buff *skb) | 661 | static int xmit_skb(struct send_queue *sq, struct sk_buff *skb) |
@@ -666,6 +663,7 @@ static int xmit_skb(struct send_queue *sq, struct sk_buff *skb) | |||
666 | struct skb_vnet_hdr *hdr = skb_vnet_hdr(skb); | 663 | struct skb_vnet_hdr *hdr = skb_vnet_hdr(skb); |
667 | const unsigned char *dest = ((struct ethhdr *)skb->data)->h_dest; | 664 | const unsigned char *dest = ((struct ethhdr *)skb->data)->h_dest; |
668 | struct virtnet_info *vi = sq->vq->vdev->priv; | 665 | struct virtnet_info *vi = sq->vq->vdev->priv; |
666 | unsigned num_sg; | ||
669 | 667 | ||
670 | pr_debug("%s: xmit %p %pM\n", vi->dev->name, skb, dest); | 668 | pr_debug("%s: xmit %p %pM\n", vi->dev->name, skb, dest); |
671 | 669 | ||
@@ -704,8 +702,8 @@ static int xmit_skb(struct send_queue *sq, struct sk_buff *skb) | |||
704 | else | 702 | else |
705 | sg_set_buf(sq->sg, &hdr->hdr, sizeof hdr->hdr); | 703 | sg_set_buf(sq->sg, &hdr->hdr, sizeof hdr->hdr); |
706 | 704 | ||
707 | hdr->num_sg = skb_to_sgvec(skb, sq->sg + 1, 0, skb->len) + 1; | 705 | num_sg = skb_to_sgvec(skb, sq->sg + 1, 0, skb->len) + 1; |
708 | return virtqueue_add_buf(sq->vq, sq->sg, hdr->num_sg, | 706 | return virtqueue_add_buf(sq->vq, sq->sg, num_sg, |
709 | 0, skb, GFP_ATOMIC); | 707 | 0, skb, GFP_ATOMIC); |
710 | } | 708 | } |
711 | 709 | ||
@@ -714,28 +712,20 @@ static netdev_tx_t start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
714 | struct virtnet_info *vi = netdev_priv(dev); | 712 | struct virtnet_info *vi = netdev_priv(dev); |
715 | int qnum = skb_get_queue_mapping(skb); | 713 | int qnum = skb_get_queue_mapping(skb); |
716 | struct send_queue *sq = &vi->sq[qnum]; | 714 | struct send_queue *sq = &vi->sq[qnum]; |
717 | int capacity; | 715 | int err; |
718 | 716 | ||
719 | /* Free up any pending old buffers before queueing new ones. */ | 717 | /* Free up any pending old buffers before queueing new ones. */ |
720 | free_old_xmit_skbs(sq); | 718 | free_old_xmit_skbs(sq); |
721 | 719 | ||
722 | /* Try to transmit */ | 720 | /* Try to transmit */ |
723 | capacity = xmit_skb(sq, skb); | 721 | err = xmit_skb(sq, skb); |
724 | 722 | ||
725 | /* This can happen with OOM and indirect buffers. */ | 723 | /* This should not happen! */ |
726 | if (unlikely(capacity < 0)) { | 724 | if (unlikely(err)) { |
727 | if (likely(capacity == -ENOMEM)) { | 725 | dev->stats.tx_fifo_errors++; |
728 | if (net_ratelimit()) | 726 | if (net_ratelimit()) |
729 | dev_warn(&dev->dev, | 727 | dev_warn(&dev->dev, |
730 | "TXQ (%d) failure: out of memory\n", | 728 | "Unexpected TXQ (%d) queue failure: %d\n", qnum, err); |
731 | qnum); | ||
732 | } else { | ||
733 | dev->stats.tx_fifo_errors++; | ||
734 | if (net_ratelimit()) | ||
735 | dev_warn(&dev->dev, | ||
736 | "Unexpected TXQ (%d) failure: %d\n", | ||
737 | qnum, capacity); | ||
738 | } | ||
739 | dev->stats.tx_dropped++; | 729 | dev->stats.tx_dropped++; |
740 | kfree_skb(skb); | 730 | kfree_skb(skb); |
741 | return NETDEV_TX_OK; | 731 | return NETDEV_TX_OK; |
@@ -748,12 +738,12 @@ static netdev_tx_t start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
748 | 738 | ||
749 | /* Apparently nice girls don't return TX_BUSY; stop the queue | 739 | /* Apparently nice girls don't return TX_BUSY; stop the queue |
750 | * before it gets out of hand. Naturally, this wastes entries. */ | 740 | * before it gets out of hand. Naturally, this wastes entries. */ |
751 | if (capacity < 2+MAX_SKB_FRAGS) { | 741 | if (sq->vq->num_free < 2+MAX_SKB_FRAGS) { |
752 | netif_stop_subqueue(dev, qnum); | 742 | netif_stop_subqueue(dev, qnum); |
753 | if (unlikely(!virtqueue_enable_cb_delayed(sq->vq))) { | 743 | if (unlikely(!virtqueue_enable_cb_delayed(sq->vq))) { |
754 | /* More just got used, free them then recheck. */ | 744 | /* More just got used, free them then recheck. */ |
755 | capacity += free_old_xmit_skbs(sq); | 745 | free_old_xmit_skbs(sq); |
756 | if (capacity >= 2+MAX_SKB_FRAGS) { | 746 | if (sq->vq->num_free >= 2+MAX_SKB_FRAGS) { |
757 | netif_start_subqueue(dev, qnum); | 747 | netif_start_subqueue(dev, qnum); |
758 | virtqueue_disable_cb(sq->vq); | 748 | virtqueue_disable_cb(sq->vq); |
759 | } | 749 | } |
diff --git a/drivers/rpmsg/virtio_rpmsg_bus.c b/drivers/rpmsg/virtio_rpmsg_bus.c index 1859f71372e2..027096fe6a12 100644 --- a/drivers/rpmsg/virtio_rpmsg_bus.c +++ b/drivers/rpmsg/virtio_rpmsg_bus.c | |||
@@ -764,7 +764,7 @@ int rpmsg_send_offchannel_raw(struct rpmsg_channel *rpdev, u32 src, u32 dst, | |||
764 | 764 | ||
765 | /* add message to the remote processor's virtqueue */ | 765 | /* add message to the remote processor's virtqueue */ |
766 | err = virtqueue_add_buf(vrp->svq, &sg, 1, 0, msg, GFP_KERNEL); | 766 | err = virtqueue_add_buf(vrp->svq, &sg, 1, 0, msg, GFP_KERNEL); |
767 | if (err < 0) { | 767 | if (err) { |
768 | /* | 768 | /* |
769 | * need to reclaim the buffer here, otherwise it's lost | 769 | * need to reclaim the buffer here, otherwise it's lost |
770 | * (memory won't leak, but rpmsg won't use it again for TX). | 770 | * (memory won't leak, but rpmsg won't use it again for TX). |
@@ -776,8 +776,6 @@ int rpmsg_send_offchannel_raw(struct rpmsg_channel *rpdev, u32 src, u32 dst, | |||
776 | 776 | ||
777 | /* tell the remote processor it has a pending message to read */ | 777 | /* tell the remote processor it has a pending message to read */ |
778 | virtqueue_kick(vrp->svq); | 778 | virtqueue_kick(vrp->svq); |
779 | |||
780 | err = 0; | ||
781 | out: | 779 | out: |
782 | mutex_unlock(&vrp->tx_lock); | 780 | mutex_unlock(&vrp->tx_lock); |
783 | return err; | 781 | return err; |
@@ -980,7 +978,7 @@ static int rpmsg_probe(struct virtio_device *vdev) | |||
980 | 978 | ||
981 | err = virtqueue_add_buf(vrp->rvq, &sg, 0, 1, cpu_addr, | 979 | err = virtqueue_add_buf(vrp->rvq, &sg, 0, 1, cpu_addr, |
982 | GFP_KERNEL); | 980 | GFP_KERNEL); |
983 | WARN_ON(err < 0); /* sanity check; this can't really happen */ | 981 | WARN_ON(err); /* sanity check; this can't really happen */ |
984 | } | 982 | } |
985 | 983 | ||
986 | /* suppress "tx-complete" interrupts */ | 984 | /* suppress "tx-complete" interrupts */ |
diff --git a/drivers/scsi/virtio_scsi.c b/drivers/scsi/virtio_scsi.c index dd8dc27fa32c..74ab67a169ec 100644 --- a/drivers/scsi/virtio_scsi.c +++ b/drivers/scsi/virtio_scsi.c | |||
@@ -215,7 +215,7 @@ static void virtscsi_ctrl_done(struct virtqueue *vq) | |||
215 | static int virtscsi_kick_event(struct virtio_scsi *vscsi, | 215 | static int virtscsi_kick_event(struct virtio_scsi *vscsi, |
216 | struct virtio_scsi_event_node *event_node) | 216 | struct virtio_scsi_event_node *event_node) |
217 | { | 217 | { |
218 | int ret; | 218 | int err; |
219 | struct scatterlist sg; | 219 | struct scatterlist sg; |
220 | unsigned long flags; | 220 | unsigned long flags; |
221 | 221 | ||
@@ -223,13 +223,14 @@ static int virtscsi_kick_event(struct virtio_scsi *vscsi, | |||
223 | 223 | ||
224 | spin_lock_irqsave(&vscsi->event_vq.vq_lock, flags); | 224 | spin_lock_irqsave(&vscsi->event_vq.vq_lock, flags); |
225 | 225 | ||
226 | ret = virtqueue_add_buf(vscsi->event_vq.vq, &sg, 0, 1, event_node, GFP_ATOMIC); | 226 | err = virtqueue_add_buf(vscsi->event_vq.vq, &sg, 0, 1, event_node, |
227 | if (ret >= 0) | 227 | GFP_ATOMIC); |
228 | if (!err) | ||
228 | virtqueue_kick(vscsi->event_vq.vq); | 229 | virtqueue_kick(vscsi->event_vq.vq); |
229 | 230 | ||
230 | spin_unlock_irqrestore(&vscsi->event_vq.vq_lock, flags); | 231 | spin_unlock_irqrestore(&vscsi->event_vq.vq_lock, flags); |
231 | 232 | ||
232 | return ret; | 233 | return err; |
233 | } | 234 | } |
234 | 235 | ||
235 | static int virtscsi_kick_event_all(struct virtio_scsi *vscsi) | 236 | static int virtscsi_kick_event_all(struct virtio_scsi *vscsi) |
@@ -410,22 +411,23 @@ static int virtscsi_kick_cmd(struct virtio_scsi_target_state *tgt, | |||
410 | { | 411 | { |
411 | unsigned int out_num, in_num; | 412 | unsigned int out_num, in_num; |
412 | unsigned long flags; | 413 | unsigned long flags; |
413 | int ret; | 414 | int err; |
415 | bool needs_kick = false; | ||
414 | 416 | ||
415 | spin_lock_irqsave(&tgt->tgt_lock, flags); | 417 | spin_lock_irqsave(&tgt->tgt_lock, flags); |
416 | virtscsi_map_cmd(tgt, cmd, &out_num, &in_num, req_size, resp_size); | 418 | virtscsi_map_cmd(tgt, cmd, &out_num, &in_num, req_size, resp_size); |
417 | 419 | ||
418 | spin_lock(&vq->vq_lock); | 420 | spin_lock(&vq->vq_lock); |
419 | ret = virtqueue_add_buf(vq->vq, tgt->sg, out_num, in_num, cmd, gfp); | 421 | err = virtqueue_add_buf(vq->vq, tgt->sg, out_num, in_num, cmd, gfp); |
420 | spin_unlock(&tgt->tgt_lock); | 422 | spin_unlock(&tgt->tgt_lock); |
421 | if (ret >= 0) | 423 | if (!err) |
422 | ret = virtqueue_kick_prepare(vq->vq); | 424 | needs_kick = virtqueue_kick_prepare(vq->vq); |
423 | 425 | ||
424 | spin_unlock_irqrestore(&vq->vq_lock, flags); | 426 | spin_unlock_irqrestore(&vq->vq_lock, flags); |
425 | 427 | ||
426 | if (ret > 0) | 428 | if (needs_kick) |
427 | virtqueue_notify(vq->vq); | 429 | virtqueue_notify(vq->vq); |
428 | return ret; | 430 | return err; |
429 | } | 431 | } |
430 | 432 | ||
431 | static int virtscsi_queuecommand(struct Scsi_Host *sh, struct scsi_cmnd *sc) | 433 | static int virtscsi_queuecommand(struct Scsi_Host *sh, struct scsi_cmnd *sc) |
@@ -467,7 +469,7 @@ static int virtscsi_queuecommand(struct Scsi_Host *sh, struct scsi_cmnd *sc) | |||
467 | 469 | ||
468 | if (virtscsi_kick_cmd(tgt, &vscsi->req_vq, cmd, | 470 | if (virtscsi_kick_cmd(tgt, &vscsi->req_vq, cmd, |
469 | sizeof cmd->req.cmd, sizeof cmd->resp.cmd, | 471 | sizeof cmd->req.cmd, sizeof cmd->resp.cmd, |
470 | GFP_ATOMIC) >= 0) | 472 | GFP_ATOMIC) == 0) |
471 | ret = 0; | 473 | ret = 0; |
472 | else | 474 | else |
473 | mempool_free(cmd, virtscsi_cmd_pool); | 475 | mempool_free(cmd, virtscsi_cmd_pool); |
diff --git a/drivers/tty/serial/omap-serial.c b/drivers/tty/serial/omap-serial.c index 23f797eb7a28..57d6b29c039c 100644 --- a/drivers/tty/serial/omap-serial.c +++ b/drivers/tty/serial/omap-serial.c | |||
@@ -41,8 +41,7 @@ | |||
41 | #include <linux/of.h> | 41 | #include <linux/of.h> |
42 | #include <linux/gpio.h> | 42 | #include <linux/gpio.h> |
43 | #include <linux/pinctrl/consumer.h> | 43 | #include <linux/pinctrl/consumer.h> |
44 | 44 | #include <linux/platform_data/serial-omap.h> | |
45 | #include <plat/omap-serial.h> | ||
46 | 45 | ||
47 | #define OMAP_MAX_HSUART_PORTS 6 | 46 | #define OMAP_MAX_HSUART_PORTS 6 |
48 | 47 | ||
diff --git a/drivers/virtio/virtio.c b/drivers/virtio/virtio.c index 809b0de59c09..ee59b74768d9 100644 --- a/drivers/virtio/virtio.c +++ b/drivers/virtio/virtio.c | |||
@@ -10,33 +10,32 @@ static DEFINE_IDA(virtio_index_ida); | |||
10 | static ssize_t device_show(struct device *_d, | 10 | static ssize_t device_show(struct device *_d, |
11 | struct device_attribute *attr, char *buf) | 11 | struct device_attribute *attr, char *buf) |
12 | { | 12 | { |
13 | struct virtio_device *dev = container_of(_d,struct virtio_device,dev); | 13 | struct virtio_device *dev = dev_to_virtio(_d); |
14 | return sprintf(buf, "0x%04x\n", dev->id.device); | 14 | return sprintf(buf, "0x%04x\n", dev->id.device); |
15 | } | 15 | } |
16 | static ssize_t vendor_show(struct device *_d, | 16 | static ssize_t vendor_show(struct device *_d, |
17 | struct device_attribute *attr, char *buf) | 17 | struct device_attribute *attr, char *buf) |
18 | { | 18 | { |
19 | struct virtio_device *dev = container_of(_d,struct virtio_device,dev); | 19 | struct virtio_device *dev = dev_to_virtio(_d); |
20 | return sprintf(buf, "0x%04x\n", dev->id.vendor); | 20 | return sprintf(buf, "0x%04x\n", dev->id.vendor); |
21 | } | 21 | } |
22 | static ssize_t status_show(struct device *_d, | 22 | static ssize_t status_show(struct device *_d, |
23 | struct device_attribute *attr, char *buf) | 23 | struct device_attribute *attr, char *buf) |
24 | { | 24 | { |
25 | struct virtio_device *dev = container_of(_d,struct virtio_device,dev); | 25 | struct virtio_device *dev = dev_to_virtio(_d); |
26 | return sprintf(buf, "0x%08x\n", dev->config->get_status(dev)); | 26 | return sprintf(buf, "0x%08x\n", dev->config->get_status(dev)); |
27 | } | 27 | } |
28 | static ssize_t modalias_show(struct device *_d, | 28 | static ssize_t modalias_show(struct device *_d, |
29 | struct device_attribute *attr, char *buf) | 29 | struct device_attribute *attr, char *buf) |
30 | { | 30 | { |
31 | struct virtio_device *dev = container_of(_d,struct virtio_device,dev); | 31 | struct virtio_device *dev = dev_to_virtio(_d); |
32 | |||
33 | return sprintf(buf, "virtio:d%08Xv%08X\n", | 32 | return sprintf(buf, "virtio:d%08Xv%08X\n", |
34 | dev->id.device, dev->id.vendor); | 33 | dev->id.device, dev->id.vendor); |
35 | } | 34 | } |
36 | static ssize_t features_show(struct device *_d, | 35 | static ssize_t features_show(struct device *_d, |
37 | struct device_attribute *attr, char *buf) | 36 | struct device_attribute *attr, char *buf) |
38 | { | 37 | { |
39 | struct virtio_device *dev = container_of(_d, struct virtio_device, dev); | 38 | struct virtio_device *dev = dev_to_virtio(_d); |
40 | unsigned int i; | 39 | unsigned int i; |
41 | ssize_t len = 0; | 40 | ssize_t len = 0; |
42 | 41 | ||
@@ -71,10 +70,10 @@ static inline int virtio_id_match(const struct virtio_device *dev, | |||
71 | static int virtio_dev_match(struct device *_dv, struct device_driver *_dr) | 70 | static int virtio_dev_match(struct device *_dv, struct device_driver *_dr) |
72 | { | 71 | { |
73 | unsigned int i; | 72 | unsigned int i; |
74 | struct virtio_device *dev = container_of(_dv,struct virtio_device,dev); | 73 | struct virtio_device *dev = dev_to_virtio(_dv); |
75 | const struct virtio_device_id *ids; | 74 | const struct virtio_device_id *ids; |
76 | 75 | ||
77 | ids = container_of(_dr, struct virtio_driver, driver)->id_table; | 76 | ids = drv_to_virtio(_dr)->id_table; |
78 | for (i = 0; ids[i].device; i++) | 77 | for (i = 0; ids[i].device; i++) |
79 | if (virtio_id_match(dev, &ids[i])) | 78 | if (virtio_id_match(dev, &ids[i])) |
80 | return 1; | 79 | return 1; |
@@ -83,7 +82,7 @@ static int virtio_dev_match(struct device *_dv, struct device_driver *_dr) | |||
83 | 82 | ||
84 | static int virtio_uevent(struct device *_dv, struct kobj_uevent_env *env) | 83 | static int virtio_uevent(struct device *_dv, struct kobj_uevent_env *env) |
85 | { | 84 | { |
86 | struct virtio_device *dev = container_of(_dv,struct virtio_device,dev); | 85 | struct virtio_device *dev = dev_to_virtio(_dv); |
87 | 86 | ||
88 | return add_uevent_var(env, "MODALIAS=virtio:d%08Xv%08X", | 87 | return add_uevent_var(env, "MODALIAS=virtio:d%08Xv%08X", |
89 | dev->id.device, dev->id.vendor); | 88 | dev->id.device, dev->id.vendor); |
@@ -98,8 +97,7 @@ void virtio_check_driver_offered_feature(const struct virtio_device *vdev, | |||
98 | unsigned int fbit) | 97 | unsigned int fbit) |
99 | { | 98 | { |
100 | unsigned int i; | 99 | unsigned int i; |
101 | struct virtio_driver *drv = container_of(vdev->dev.driver, | 100 | struct virtio_driver *drv = drv_to_virtio(vdev->dev.driver); |
102 | struct virtio_driver, driver); | ||
103 | 101 | ||
104 | for (i = 0; i < drv->feature_table_size; i++) | 102 | for (i = 0; i < drv->feature_table_size; i++) |
105 | if (drv->feature_table[i] == fbit) | 103 | if (drv->feature_table[i] == fbit) |
@@ -111,9 +109,8 @@ EXPORT_SYMBOL_GPL(virtio_check_driver_offered_feature); | |||
111 | static int virtio_dev_probe(struct device *_d) | 109 | static int virtio_dev_probe(struct device *_d) |
112 | { | 110 | { |
113 | int err, i; | 111 | int err, i; |
114 | struct virtio_device *dev = container_of(_d,struct virtio_device,dev); | 112 | struct virtio_device *dev = dev_to_virtio(_d); |
115 | struct virtio_driver *drv = container_of(dev->dev.driver, | 113 | struct virtio_driver *drv = drv_to_virtio(dev->dev.driver); |
116 | struct virtio_driver, driver); | ||
117 | u32 device_features; | 114 | u32 device_features; |
118 | 115 | ||
119 | /* We have a driver! */ | 116 | /* We have a driver! */ |
@@ -152,9 +149,8 @@ static int virtio_dev_probe(struct device *_d) | |||
152 | 149 | ||
153 | static int virtio_dev_remove(struct device *_d) | 150 | static int virtio_dev_remove(struct device *_d) |
154 | { | 151 | { |
155 | struct virtio_device *dev = container_of(_d,struct virtio_device,dev); | 152 | struct virtio_device *dev = dev_to_virtio(_d); |
156 | struct virtio_driver *drv = container_of(dev->dev.driver, | 153 | struct virtio_driver *drv = drv_to_virtio(dev->dev.driver); |
157 | struct virtio_driver, driver); | ||
158 | 154 | ||
159 | drv->remove(dev); | 155 | drv->remove(dev); |
160 | 156 | ||
diff --git a/drivers/virtio/virtio_balloon.c b/drivers/virtio/virtio_balloon.c index 2a70558b36ea..d19fe3e323b4 100644 --- a/drivers/virtio/virtio_balloon.c +++ b/drivers/virtio/virtio_balloon.c | |||
@@ -139,10 +139,9 @@ static void fill_balloon(struct virtio_balloon *vb, size_t num) | |||
139 | struct page *page = balloon_page_enqueue(vb_dev_info); | 139 | struct page *page = balloon_page_enqueue(vb_dev_info); |
140 | 140 | ||
141 | if (!page) { | 141 | if (!page) { |
142 | if (printk_ratelimit()) | 142 | dev_info_ratelimited(&vb->vdev->dev, |
143 | dev_printk(KERN_INFO, &vb->vdev->dev, | 143 | "Out of puff! Can't get %u pages\n", |
144 | "Out of puff! Can't get %u pages\n", | 144 | VIRTIO_BALLOON_PAGES_PER_PAGE); |
145 | VIRTIO_BALLOON_PAGES_PER_PAGE); | ||
146 | /* Sleep for at least 1/5 of a second before retry. */ | 145 | /* Sleep for at least 1/5 of a second before retry. */ |
147 | msleep(200); | 146 | msleep(200); |
148 | break; | 147 | break; |
diff --git a/drivers/virtio/virtio_mmio.c b/drivers/virtio/virtio_mmio.c index 6b1b7e184939..634f80bcdbd7 100644 --- a/drivers/virtio/virtio_mmio.c +++ b/drivers/virtio/virtio_mmio.c | |||
@@ -225,7 +225,7 @@ static void vm_notify(struct virtqueue *vq) | |||
225 | 225 | ||
226 | /* We write the queue's selector into the notification register to | 226 | /* We write the queue's selector into the notification register to |
227 | * signal the other end */ | 227 | * signal the other end */ |
228 | writel(virtqueue_get_queue_index(vq), vm_dev->base + VIRTIO_MMIO_QUEUE_NOTIFY); | 228 | writel(vq->index, vm_dev->base + VIRTIO_MMIO_QUEUE_NOTIFY); |
229 | } | 229 | } |
230 | 230 | ||
231 | /* Notify all virtqueues on an interrupt. */ | 231 | /* Notify all virtqueues on an interrupt. */ |
@@ -266,7 +266,7 @@ static void vm_del_vq(struct virtqueue *vq) | |||
266 | struct virtio_mmio_device *vm_dev = to_virtio_mmio_device(vq->vdev); | 266 | struct virtio_mmio_device *vm_dev = to_virtio_mmio_device(vq->vdev); |
267 | struct virtio_mmio_vq_info *info = vq->priv; | 267 | struct virtio_mmio_vq_info *info = vq->priv; |
268 | unsigned long flags, size; | 268 | unsigned long flags, size; |
269 | unsigned int index = virtqueue_get_queue_index(vq); | 269 | unsigned int index = vq->index; |
270 | 270 | ||
271 | spin_lock_irqsave(&vm_dev->lock, flags); | 271 | spin_lock_irqsave(&vm_dev->lock, flags); |
272 | list_del(&info->node); | 272 | list_del(&info->node); |
@@ -521,25 +521,33 @@ static int vm_cmdline_set(const char *device, | |||
521 | int err; | 521 | int err; |
522 | struct resource resources[2] = {}; | 522 | struct resource resources[2] = {}; |
523 | char *str; | 523 | char *str; |
524 | long long int base; | 524 | long long int base, size; |
525 | unsigned int irq; | ||
525 | int processed, consumed = 0; | 526 | int processed, consumed = 0; |
526 | struct platform_device *pdev; | 527 | struct platform_device *pdev; |
527 | 528 | ||
528 | resources[0].flags = IORESOURCE_MEM; | 529 | /* Consume "size" part of the command line parameter */ |
529 | resources[1].flags = IORESOURCE_IRQ; | 530 | size = memparse(device, &str); |
530 | |||
531 | resources[0].end = memparse(device, &str) - 1; | ||
532 | 531 | ||
532 | /* Get "@<base>:<irq>[:<id>]" chunks */ | ||
533 | processed = sscanf(str, "@%lli:%u%n:%d%n", | 533 | processed = sscanf(str, "@%lli:%u%n:%d%n", |
534 | &base, &resources[1].start, &consumed, | 534 | &base, &irq, &consumed, |
535 | &vm_cmdline_id, &consumed); | 535 | &vm_cmdline_id, &consumed); |
536 | 536 | ||
537 | if (processed < 2 || processed > 3 || str[consumed]) | 537 | /* |
538 | * sscanf() must processes at least 2 chunks; also there | ||
539 | * must be no extra characters after the last chunk, so | ||
540 | * str[consumed] must be '\0' | ||
541 | */ | ||
542 | if (processed < 2 || str[consumed]) | ||
538 | return -EINVAL; | 543 | return -EINVAL; |
539 | 544 | ||
545 | resources[0].flags = IORESOURCE_MEM; | ||
540 | resources[0].start = base; | 546 | resources[0].start = base; |
541 | resources[0].end += base; | 547 | resources[0].end = base + size - 1; |
542 | resources[1].end = resources[1].start; | 548 | |
549 | resources[1].flags = IORESOURCE_IRQ; | ||
550 | resources[1].start = resources[1].end = irq; | ||
543 | 551 | ||
544 | if (!vm_cmdline_parent_registered) { | 552 | if (!vm_cmdline_parent_registered) { |
545 | err = device_register(&vm_cmdline_parent); | 553 | err = device_register(&vm_cmdline_parent); |
diff --git a/drivers/virtio/virtio_pci.c b/drivers/virtio/virtio_pci.c index c33aea36598a..e3ecc94591ad 100644 --- a/drivers/virtio/virtio_pci.c +++ b/drivers/virtio/virtio_pci.c | |||
@@ -203,8 +203,7 @@ static void vp_notify(struct virtqueue *vq) | |||
203 | 203 | ||
204 | /* we write the queue's selector into the notification register to | 204 | /* we write the queue's selector into the notification register to |
205 | * signal the other end */ | 205 | * signal the other end */ |
206 | iowrite16(virtqueue_get_queue_index(vq), | 206 | iowrite16(vq->index, vp_dev->ioaddr + VIRTIO_PCI_QUEUE_NOTIFY); |
207 | vp_dev->ioaddr + VIRTIO_PCI_QUEUE_NOTIFY); | ||
208 | } | 207 | } |
209 | 208 | ||
210 | /* Handle a configuration change: Tell driver if it wants to know. */ | 209 | /* Handle a configuration change: Tell driver if it wants to know. */ |
@@ -479,8 +478,7 @@ static void vp_del_vq(struct virtqueue *vq) | |||
479 | list_del(&info->node); | 478 | list_del(&info->node); |
480 | spin_unlock_irqrestore(&vp_dev->lock, flags); | 479 | spin_unlock_irqrestore(&vp_dev->lock, flags); |
481 | 480 | ||
482 | iowrite16(virtqueue_get_queue_index(vq), | 481 | iowrite16(vq->index, vp_dev->ioaddr + VIRTIO_PCI_QUEUE_SEL); |
483 | vp_dev->ioaddr + VIRTIO_PCI_QUEUE_SEL); | ||
484 | 482 | ||
485 | if (vp_dev->msix_enabled) { | 483 | if (vp_dev->msix_enabled) { |
486 | iowrite16(VIRTIO_MSI_NO_VECTOR, | 484 | iowrite16(VIRTIO_MSI_NO_VECTOR, |
@@ -830,16 +828,4 @@ static struct pci_driver virtio_pci_driver = { | |||
830 | #endif | 828 | #endif |
831 | }; | 829 | }; |
832 | 830 | ||
833 | static int __init virtio_pci_init(void) | 831 | module_pci_driver(virtio_pci_driver); |
834 | { | ||
835 | return pci_register_driver(&virtio_pci_driver); | ||
836 | } | ||
837 | |||
838 | module_init(virtio_pci_init); | ||
839 | |||
840 | static void __exit virtio_pci_exit(void) | ||
841 | { | ||
842 | pci_unregister_driver(&virtio_pci_driver); | ||
843 | } | ||
844 | |||
845 | module_exit(virtio_pci_exit); | ||
diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c index e639584b2dbd..ffd7e7da5d3b 100644 --- a/drivers/virtio/virtio_ring.c +++ b/drivers/virtio/virtio_ring.c | |||
@@ -93,8 +93,6 @@ struct vring_virtqueue | |||
93 | /* Host publishes avail event idx */ | 93 | /* Host publishes avail event idx */ |
94 | bool event; | 94 | bool event; |
95 | 95 | ||
96 | /* Number of free buffers */ | ||
97 | unsigned int num_free; | ||
98 | /* Head of free buffer list. */ | 96 | /* Head of free buffer list. */ |
99 | unsigned int free_head; | 97 | unsigned int free_head; |
100 | /* Number we've added since last sync. */ | 98 | /* Number we've added since last sync. */ |
@@ -106,9 +104,6 @@ struct vring_virtqueue | |||
106 | /* How to notify other side. FIXME: commonalize hcalls! */ | 104 | /* How to notify other side. FIXME: commonalize hcalls! */ |
107 | void (*notify)(struct virtqueue *vq); | 105 | void (*notify)(struct virtqueue *vq); |
108 | 106 | ||
109 | /* Index of the queue */ | ||
110 | int queue_index; | ||
111 | |||
112 | #ifdef DEBUG | 107 | #ifdef DEBUG |
113 | /* They're supposed to lock for us. */ | 108 | /* They're supposed to lock for us. */ |
114 | unsigned int in_use; | 109 | unsigned int in_use; |
@@ -135,6 +130,13 @@ static int vring_add_indirect(struct vring_virtqueue *vq, | |||
135 | unsigned head; | 130 | unsigned head; |
136 | int i; | 131 | int i; |
137 | 132 | ||
133 | /* | ||
134 | * We require lowmem mappings for the descriptors because | ||
135 | * otherwise virt_to_phys will give us bogus addresses in the | ||
136 | * virtqueue. | ||
137 | */ | ||
138 | gfp &= ~(__GFP_HIGHMEM | __GFP_HIGH); | ||
139 | |||
138 | desc = kmalloc((out + in) * sizeof(struct vring_desc), gfp); | 140 | desc = kmalloc((out + in) * sizeof(struct vring_desc), gfp); |
139 | if (!desc) | 141 | if (!desc) |
140 | return -ENOMEM; | 142 | return -ENOMEM; |
@@ -160,7 +162,7 @@ static int vring_add_indirect(struct vring_virtqueue *vq, | |||
160 | desc[i-1].next = 0; | 162 | desc[i-1].next = 0; |
161 | 163 | ||
162 | /* We're about to use a buffer */ | 164 | /* We're about to use a buffer */ |
163 | vq->num_free--; | 165 | vq->vq.num_free--; |
164 | 166 | ||
165 | /* Use a single buffer which doesn't continue */ | 167 | /* Use a single buffer which doesn't continue */ |
166 | head = vq->free_head; | 168 | head = vq->free_head; |
@@ -174,13 +176,6 @@ static int vring_add_indirect(struct vring_virtqueue *vq, | |||
174 | return head; | 176 | return head; |
175 | } | 177 | } |
176 | 178 | ||
177 | int virtqueue_get_queue_index(struct virtqueue *_vq) | ||
178 | { | ||
179 | struct vring_virtqueue *vq = to_vvq(_vq); | ||
180 | return vq->queue_index; | ||
181 | } | ||
182 | EXPORT_SYMBOL_GPL(virtqueue_get_queue_index); | ||
183 | |||
184 | /** | 179 | /** |
185 | * virtqueue_add_buf - expose buffer to other end | 180 | * virtqueue_add_buf - expose buffer to other end |
186 | * @vq: the struct virtqueue we're talking about. | 181 | * @vq: the struct virtqueue we're talking about. |
@@ -193,10 +188,7 @@ EXPORT_SYMBOL_GPL(virtqueue_get_queue_index); | |||
193 | * Caller must ensure we don't call this with other virtqueue operations | 188 | * Caller must ensure we don't call this with other virtqueue operations |
194 | * at the same time (except where noted). | 189 | * at the same time (except where noted). |
195 | * | 190 | * |
196 | * Returns remaining capacity of queue or a negative error | 191 | * Returns zero or a negative error (ie. ENOSPC, ENOMEM). |
197 | * (ie. ENOSPC). Note that it only really makes sense to treat all | ||
198 | * positive return values as "available": indirect buffers mean that | ||
199 | * we can put an entire sg[] array inside a single queue entry. | ||
200 | */ | 192 | */ |
201 | int virtqueue_add_buf(struct virtqueue *_vq, | 193 | int virtqueue_add_buf(struct virtqueue *_vq, |
202 | struct scatterlist sg[], | 194 | struct scatterlist sg[], |
@@ -228,7 +220,7 @@ int virtqueue_add_buf(struct virtqueue *_vq, | |||
228 | 220 | ||
229 | /* If the host supports indirect descriptor tables, and we have multiple | 221 | /* If the host supports indirect descriptor tables, and we have multiple |
230 | * buffers, then go indirect. FIXME: tune this threshold */ | 222 | * buffers, then go indirect. FIXME: tune this threshold */ |
231 | if (vq->indirect && (out + in) > 1 && vq->num_free) { | 223 | if (vq->indirect && (out + in) > 1 && vq->vq.num_free) { |
232 | head = vring_add_indirect(vq, sg, out, in, gfp); | 224 | head = vring_add_indirect(vq, sg, out, in, gfp); |
233 | if (likely(head >= 0)) | 225 | if (likely(head >= 0)) |
234 | goto add_head; | 226 | goto add_head; |
@@ -237,9 +229,9 @@ int virtqueue_add_buf(struct virtqueue *_vq, | |||
237 | BUG_ON(out + in > vq->vring.num); | 229 | BUG_ON(out + in > vq->vring.num); |
238 | BUG_ON(out + in == 0); | 230 | BUG_ON(out + in == 0); |
239 | 231 | ||
240 | if (vq->num_free < out + in) { | 232 | if (vq->vq.num_free < out + in) { |
241 | pr_debug("Can't add buf len %i - avail = %i\n", | 233 | pr_debug("Can't add buf len %i - avail = %i\n", |
242 | out + in, vq->num_free); | 234 | out + in, vq->vq.num_free); |
243 | /* FIXME: for historical reasons, we force a notify here if | 235 | /* FIXME: for historical reasons, we force a notify here if |
244 | * there are outgoing parts to the buffer. Presumably the | 236 | * there are outgoing parts to the buffer. Presumably the |
245 | * host should service the ring ASAP. */ | 237 | * host should service the ring ASAP. */ |
@@ -250,7 +242,7 @@ int virtqueue_add_buf(struct virtqueue *_vq, | |||
250 | } | 242 | } |
251 | 243 | ||
252 | /* We're about to use some buffers from the free list. */ | 244 | /* We're about to use some buffers from the free list. */ |
253 | vq->num_free -= out + in; | 245 | vq->vq.num_free -= out + in; |
254 | 246 | ||
255 | head = vq->free_head; | 247 | head = vq->free_head; |
256 | for (i = vq->free_head; out; i = vq->vring.desc[i].next, out--) { | 248 | for (i = vq->free_head; out; i = vq->vring.desc[i].next, out--) { |
@@ -296,7 +288,7 @@ add_head: | |||
296 | pr_debug("Added buffer head %i to %p\n", head, vq); | 288 | pr_debug("Added buffer head %i to %p\n", head, vq); |
297 | END_USE(vq); | 289 | END_USE(vq); |
298 | 290 | ||
299 | return vq->num_free; | 291 | return 0; |
300 | } | 292 | } |
301 | EXPORT_SYMBOL_GPL(virtqueue_add_buf); | 293 | EXPORT_SYMBOL_GPL(virtqueue_add_buf); |
302 | 294 | ||
@@ -393,13 +385,13 @@ static void detach_buf(struct vring_virtqueue *vq, unsigned int head) | |||
393 | 385 | ||
394 | while (vq->vring.desc[i].flags & VRING_DESC_F_NEXT) { | 386 | while (vq->vring.desc[i].flags & VRING_DESC_F_NEXT) { |
395 | i = vq->vring.desc[i].next; | 387 | i = vq->vring.desc[i].next; |
396 | vq->num_free++; | 388 | vq->vq.num_free++; |
397 | } | 389 | } |
398 | 390 | ||
399 | vq->vring.desc[i].next = vq->free_head; | 391 | vq->vring.desc[i].next = vq->free_head; |
400 | vq->free_head = head; | 392 | vq->free_head = head; |
401 | /* Plus final descriptor */ | 393 | /* Plus final descriptor */ |
402 | vq->num_free++; | 394 | vq->vq.num_free++; |
403 | } | 395 | } |
404 | 396 | ||
405 | static inline bool more_used(const struct vring_virtqueue *vq) | 397 | static inline bool more_used(const struct vring_virtqueue *vq) |
@@ -599,7 +591,7 @@ void *virtqueue_detach_unused_buf(struct virtqueue *_vq) | |||
599 | return buf; | 591 | return buf; |
600 | } | 592 | } |
601 | /* That should have freed everything. */ | 593 | /* That should have freed everything. */ |
602 | BUG_ON(vq->num_free != vq->vring.num); | 594 | BUG_ON(vq->vq.num_free != vq->vring.num); |
603 | 595 | ||
604 | END_USE(vq); | 596 | END_USE(vq); |
605 | return NULL; | 597 | return NULL; |
@@ -653,12 +645,13 @@ struct virtqueue *vring_new_virtqueue(unsigned int index, | |||
653 | vq->vq.callback = callback; | 645 | vq->vq.callback = callback; |
654 | vq->vq.vdev = vdev; | 646 | vq->vq.vdev = vdev; |
655 | vq->vq.name = name; | 647 | vq->vq.name = name; |
648 | vq->vq.num_free = num; | ||
649 | vq->vq.index = index; | ||
656 | vq->notify = notify; | 650 | vq->notify = notify; |
657 | vq->weak_barriers = weak_barriers; | 651 | vq->weak_barriers = weak_barriers; |
658 | vq->broken = false; | 652 | vq->broken = false; |
659 | vq->last_used_idx = 0; | 653 | vq->last_used_idx = 0; |
660 | vq->num_added = 0; | 654 | vq->num_added = 0; |
661 | vq->queue_index = index; | ||
662 | list_add_tail(&vq->vq.list, &vdev->vqs); | 655 | list_add_tail(&vq->vq.list, &vdev->vqs); |
663 | #ifdef DEBUG | 656 | #ifdef DEBUG |
664 | vq->in_use = false; | 657 | vq->in_use = false; |
@@ -673,7 +666,6 @@ struct virtqueue *vring_new_virtqueue(unsigned int index, | |||
673 | vq->vring.avail->flags |= VRING_AVAIL_F_NO_INTERRUPT; | 666 | vq->vring.avail->flags |= VRING_AVAIL_F_NO_INTERRUPT; |
674 | 667 | ||
675 | /* Put everything in free lists. */ | 668 | /* Put everything in free lists. */ |
676 | vq->num_free = num; | ||
677 | vq->free_head = 0; | 669 | vq->free_head = 0; |
678 | for (i = 0; i < num-1; i++) { | 670 | for (i = 0; i < num-1; i++) { |
679 | vq->vring.desc[i].next = i+1; | 671 | vq->vring.desc[i].next = i+1; |
diff --git a/fs/cachefiles/interface.c b/fs/cachefiles/interface.c index 67bef6d01484..746ce532e130 100644 --- a/fs/cachefiles/interface.c +++ b/fs/cachefiles/interface.c | |||
@@ -41,12 +41,12 @@ static struct fscache_object *cachefiles_alloc_object( | |||
41 | 41 | ||
42 | _enter("{%s},%p,", cache->cache.identifier, cookie); | 42 | _enter("{%s},%p,", cache->cache.identifier, cookie); |
43 | 43 | ||
44 | lookup_data = kmalloc(sizeof(*lookup_data), GFP_KERNEL); | 44 | lookup_data = kmalloc(sizeof(*lookup_data), cachefiles_gfp); |
45 | if (!lookup_data) | 45 | if (!lookup_data) |
46 | goto nomem_lookup_data; | 46 | goto nomem_lookup_data; |
47 | 47 | ||
48 | /* create a new object record and a temporary leaf image */ | 48 | /* create a new object record and a temporary leaf image */ |
49 | object = kmem_cache_alloc(cachefiles_object_jar, GFP_KERNEL); | 49 | object = kmem_cache_alloc(cachefiles_object_jar, cachefiles_gfp); |
50 | if (!object) | 50 | if (!object) |
51 | goto nomem_object; | 51 | goto nomem_object; |
52 | 52 | ||
@@ -63,7 +63,7 @@ static struct fscache_object *cachefiles_alloc_object( | |||
63 | * - stick the length on the front and leave space on the back for the | 63 | * - stick the length on the front and leave space on the back for the |
64 | * encoder | 64 | * encoder |
65 | */ | 65 | */ |
66 | buffer = kmalloc((2 + 512) + 3, GFP_KERNEL); | 66 | buffer = kmalloc((2 + 512) + 3, cachefiles_gfp); |
67 | if (!buffer) | 67 | if (!buffer) |
68 | goto nomem_buffer; | 68 | goto nomem_buffer; |
69 | 69 | ||
@@ -219,7 +219,7 @@ static void cachefiles_update_object(struct fscache_object *_object) | |||
219 | return; | 219 | return; |
220 | } | 220 | } |
221 | 221 | ||
222 | auxdata = kmalloc(2 + 512 + 3, GFP_KERNEL); | 222 | auxdata = kmalloc(2 + 512 + 3, cachefiles_gfp); |
223 | if (!auxdata) { | 223 | if (!auxdata) { |
224 | _leave(" [nomem]"); | 224 | _leave(" [nomem]"); |
225 | return; | 225 | return; |
@@ -441,6 +441,54 @@ truncate_failed: | |||
441 | } | 441 | } |
442 | 442 | ||
443 | /* | 443 | /* |
444 | * Invalidate an object | ||
445 | */ | ||
446 | static void cachefiles_invalidate_object(struct fscache_operation *op) | ||
447 | { | ||
448 | struct cachefiles_object *object; | ||
449 | struct cachefiles_cache *cache; | ||
450 | const struct cred *saved_cred; | ||
451 | struct path path; | ||
452 | uint64_t ni_size; | ||
453 | int ret; | ||
454 | |||
455 | object = container_of(op->object, struct cachefiles_object, fscache); | ||
456 | cache = container_of(object->fscache.cache, | ||
457 | struct cachefiles_cache, cache); | ||
458 | |||
459 | op->object->cookie->def->get_attr(op->object->cookie->netfs_data, | ||
460 | &ni_size); | ||
461 | |||
462 | _enter("{OBJ%x},[%llu]", | ||
463 | op->object->debug_id, (unsigned long long)ni_size); | ||
464 | |||
465 | if (object->backer) { | ||
466 | ASSERT(S_ISREG(object->backer->d_inode->i_mode)); | ||
467 | |||
468 | fscache_set_store_limit(&object->fscache, ni_size); | ||
469 | |||
470 | path.dentry = object->backer; | ||
471 | path.mnt = cache->mnt; | ||
472 | |||
473 | cachefiles_begin_secure(cache, &saved_cred); | ||
474 | ret = vfs_truncate(&path, 0); | ||
475 | if (ret == 0) | ||
476 | ret = vfs_truncate(&path, ni_size); | ||
477 | cachefiles_end_secure(cache, saved_cred); | ||
478 | |||
479 | if (ret != 0) { | ||
480 | fscache_set_store_limit(&object->fscache, 0); | ||
481 | if (ret == -EIO) | ||
482 | cachefiles_io_error_obj(object, | ||
483 | "Invalidate failed"); | ||
484 | } | ||
485 | } | ||
486 | |||
487 | fscache_op_complete(op, true); | ||
488 | _leave(""); | ||
489 | } | ||
490 | |||
491 | /* | ||
444 | * dissociate a cache from all the pages it was backing | 492 | * dissociate a cache from all the pages it was backing |
445 | */ | 493 | */ |
446 | static void cachefiles_dissociate_pages(struct fscache_cache *cache) | 494 | static void cachefiles_dissociate_pages(struct fscache_cache *cache) |
@@ -455,6 +503,7 @@ const struct fscache_cache_ops cachefiles_cache_ops = { | |||
455 | .lookup_complete = cachefiles_lookup_complete, | 503 | .lookup_complete = cachefiles_lookup_complete, |
456 | .grab_object = cachefiles_grab_object, | 504 | .grab_object = cachefiles_grab_object, |
457 | .update_object = cachefiles_update_object, | 505 | .update_object = cachefiles_update_object, |
506 | .invalidate_object = cachefiles_invalidate_object, | ||
458 | .drop_object = cachefiles_drop_object, | 507 | .drop_object = cachefiles_drop_object, |
459 | .put_object = cachefiles_put_object, | 508 | .put_object = cachefiles_put_object, |
460 | .sync_cache = cachefiles_sync_cache, | 509 | .sync_cache = cachefiles_sync_cache, |
diff --git a/fs/cachefiles/internal.h b/fs/cachefiles/internal.h index bd6bc1bde2d7..49382519907a 100644 --- a/fs/cachefiles/internal.h +++ b/fs/cachefiles/internal.h | |||
@@ -23,6 +23,8 @@ extern unsigned cachefiles_debug; | |||
23 | #define CACHEFILES_DEBUG_KLEAVE 2 | 23 | #define CACHEFILES_DEBUG_KLEAVE 2 |
24 | #define CACHEFILES_DEBUG_KDEBUG 4 | 24 | #define CACHEFILES_DEBUG_KDEBUG 4 |
25 | 25 | ||
26 | #define cachefiles_gfp (__GFP_WAIT | __GFP_NORETRY | __GFP_NOMEMALLOC) | ||
27 | |||
26 | /* | 28 | /* |
27 | * node records | 29 | * node records |
28 | */ | 30 | */ |
diff --git a/fs/cachefiles/key.c b/fs/cachefiles/key.c index 81b8b2b3a674..33b58c60f2d1 100644 --- a/fs/cachefiles/key.c +++ b/fs/cachefiles/key.c | |||
@@ -78,7 +78,7 @@ char *cachefiles_cook_key(const u8 *raw, int keylen, uint8_t type) | |||
78 | 78 | ||
79 | _debug("max: %d", max); | 79 | _debug("max: %d", max); |
80 | 80 | ||
81 | key = kmalloc(max, GFP_KERNEL); | 81 | key = kmalloc(max, cachefiles_gfp); |
82 | if (!key) | 82 | if (!key) |
83 | return NULL; | 83 | return NULL; |
84 | 84 | ||
diff --git a/fs/cachefiles/namei.c b/fs/cachefiles/namei.c index b0b5f7cdfffa..8c01c5fcdf75 100644 --- a/fs/cachefiles/namei.c +++ b/fs/cachefiles/namei.c | |||
@@ -40,8 +40,7 @@ void __cachefiles_printk_object(struct cachefiles_object *object, | |||
40 | printk(KERN_ERR "%sobjstate=%s fl=%lx wbusy=%x ev=%lx[%lx]\n", | 40 | printk(KERN_ERR "%sobjstate=%s fl=%lx wbusy=%x ev=%lx[%lx]\n", |
41 | prefix, fscache_object_states[object->fscache.state], | 41 | prefix, fscache_object_states[object->fscache.state], |
42 | object->fscache.flags, work_busy(&object->fscache.work), | 42 | object->fscache.flags, work_busy(&object->fscache.work), |
43 | object->fscache.events, | 43 | object->fscache.events, object->fscache.event_mask); |
44 | object->fscache.event_mask & FSCACHE_OBJECT_EVENTS_MASK); | ||
45 | printk(KERN_ERR "%sops=%u inp=%u exc=%u\n", | 44 | printk(KERN_ERR "%sops=%u inp=%u exc=%u\n", |
46 | prefix, object->fscache.n_ops, object->fscache.n_in_progress, | 45 | prefix, object->fscache.n_ops, object->fscache.n_in_progress, |
47 | object->fscache.n_exclusive); | 46 | object->fscache.n_exclusive); |
diff --git a/fs/cachefiles/rdwr.c b/fs/cachefiles/rdwr.c index c994691d9445..480992259707 100644 --- a/fs/cachefiles/rdwr.c +++ b/fs/cachefiles/rdwr.c | |||
@@ -77,25 +77,25 @@ static int cachefiles_read_reissue(struct cachefiles_object *object, | |||
77 | struct page *backpage = monitor->back_page, *backpage2; | 77 | struct page *backpage = monitor->back_page, *backpage2; |
78 | int ret; | 78 | int ret; |
79 | 79 | ||
80 | kenter("{ino=%lx},{%lx,%lx}", | 80 | _enter("{ino=%lx},{%lx,%lx}", |
81 | object->backer->d_inode->i_ino, | 81 | object->backer->d_inode->i_ino, |
82 | backpage->index, backpage->flags); | 82 | backpage->index, backpage->flags); |
83 | 83 | ||
84 | /* skip if the page was truncated away completely */ | 84 | /* skip if the page was truncated away completely */ |
85 | if (backpage->mapping != bmapping) { | 85 | if (backpage->mapping != bmapping) { |
86 | kleave(" = -ENODATA [mapping]"); | 86 | _leave(" = -ENODATA [mapping]"); |
87 | return -ENODATA; | 87 | return -ENODATA; |
88 | } | 88 | } |
89 | 89 | ||
90 | backpage2 = find_get_page(bmapping, backpage->index); | 90 | backpage2 = find_get_page(bmapping, backpage->index); |
91 | if (!backpage2) { | 91 | if (!backpage2) { |
92 | kleave(" = -ENODATA [gone]"); | 92 | _leave(" = -ENODATA [gone]"); |
93 | return -ENODATA; | 93 | return -ENODATA; |
94 | } | 94 | } |
95 | 95 | ||
96 | if (backpage != backpage2) { | 96 | if (backpage != backpage2) { |
97 | put_page(backpage2); | 97 | put_page(backpage2); |
98 | kleave(" = -ENODATA [different]"); | 98 | _leave(" = -ENODATA [different]"); |
99 | return -ENODATA; | 99 | return -ENODATA; |
100 | } | 100 | } |
101 | 101 | ||
@@ -114,7 +114,7 @@ static int cachefiles_read_reissue(struct cachefiles_object *object, | |||
114 | if (PageUptodate(backpage)) | 114 | if (PageUptodate(backpage)) |
115 | goto unlock_discard; | 115 | goto unlock_discard; |
116 | 116 | ||
117 | kdebug("reissue read"); | 117 | _debug("reissue read"); |
118 | ret = bmapping->a_ops->readpage(NULL, backpage); | 118 | ret = bmapping->a_ops->readpage(NULL, backpage); |
119 | if (ret < 0) | 119 | if (ret < 0) |
120 | goto unlock_discard; | 120 | goto unlock_discard; |
@@ -129,7 +129,7 @@ static int cachefiles_read_reissue(struct cachefiles_object *object, | |||
129 | } | 129 | } |
130 | 130 | ||
131 | /* it'll reappear on the todo list */ | 131 | /* it'll reappear on the todo list */ |
132 | kleave(" = -EINPROGRESS"); | 132 | _leave(" = -EINPROGRESS"); |
133 | return -EINPROGRESS; | 133 | return -EINPROGRESS; |
134 | 134 | ||
135 | unlock_discard: | 135 | unlock_discard: |
@@ -137,7 +137,7 @@ unlock_discard: | |||
137 | spin_lock_irq(&object->work_lock); | 137 | spin_lock_irq(&object->work_lock); |
138 | list_del(&monitor->op_link); | 138 | list_del(&monitor->op_link); |
139 | spin_unlock_irq(&object->work_lock); | 139 | spin_unlock_irq(&object->work_lock); |
140 | kleave(" = %d", ret); | 140 | _leave(" = %d", ret); |
141 | return ret; | 141 | return ret; |
142 | } | 142 | } |
143 | 143 | ||
@@ -174,11 +174,13 @@ static void cachefiles_read_copier(struct fscache_operation *_op) | |||
174 | _debug("- copy {%lu}", monitor->back_page->index); | 174 | _debug("- copy {%lu}", monitor->back_page->index); |
175 | 175 | ||
176 | recheck: | 176 | recheck: |
177 | if (PageUptodate(monitor->back_page)) { | 177 | if (test_bit(FSCACHE_COOKIE_INVALIDATING, |
178 | &object->fscache.cookie->flags)) { | ||
179 | error = -ESTALE; | ||
180 | } else if (PageUptodate(monitor->back_page)) { | ||
178 | copy_highpage(monitor->netfs_page, monitor->back_page); | 181 | copy_highpage(monitor->netfs_page, monitor->back_page); |
179 | 182 | fscache_mark_page_cached(monitor->op, | |
180 | pagevec_add(&pagevec, monitor->netfs_page); | 183 | monitor->netfs_page); |
181 | fscache_mark_pages_cached(monitor->op, &pagevec); | ||
182 | error = 0; | 184 | error = 0; |
183 | } else if (!PageError(monitor->back_page)) { | 185 | } else if (!PageError(monitor->back_page)) { |
184 | /* the page has probably been truncated */ | 186 | /* the page has probably been truncated */ |
@@ -198,6 +200,7 @@ static void cachefiles_read_copier(struct fscache_operation *_op) | |||
198 | 200 | ||
199 | fscache_end_io(op, monitor->netfs_page, error); | 201 | fscache_end_io(op, monitor->netfs_page, error); |
200 | page_cache_release(monitor->netfs_page); | 202 | page_cache_release(monitor->netfs_page); |
203 | fscache_retrieval_complete(op, 1); | ||
201 | fscache_put_retrieval(op); | 204 | fscache_put_retrieval(op); |
202 | kfree(monitor); | 205 | kfree(monitor); |
203 | 206 | ||
@@ -239,7 +242,7 @@ static int cachefiles_read_backing_file_one(struct cachefiles_object *object, | |||
239 | _debug("read back %p{%lu,%d}", | 242 | _debug("read back %p{%lu,%d}", |
240 | netpage, netpage->index, page_count(netpage)); | 243 | netpage, netpage->index, page_count(netpage)); |
241 | 244 | ||
242 | monitor = kzalloc(sizeof(*monitor), GFP_KERNEL); | 245 | monitor = kzalloc(sizeof(*monitor), cachefiles_gfp); |
243 | if (!monitor) | 246 | if (!monitor) |
244 | goto nomem; | 247 | goto nomem; |
245 | 248 | ||
@@ -258,13 +261,14 @@ static int cachefiles_read_backing_file_one(struct cachefiles_object *object, | |||
258 | goto backing_page_already_present; | 261 | goto backing_page_already_present; |
259 | 262 | ||
260 | if (!newpage) { | 263 | if (!newpage) { |
261 | newpage = page_cache_alloc_cold(bmapping); | 264 | newpage = __page_cache_alloc(cachefiles_gfp | |
265 | __GFP_COLD); | ||
262 | if (!newpage) | 266 | if (!newpage) |
263 | goto nomem_monitor; | 267 | goto nomem_monitor; |
264 | } | 268 | } |
265 | 269 | ||
266 | ret = add_to_page_cache(newpage, bmapping, | 270 | ret = add_to_page_cache(newpage, bmapping, |
267 | netpage->index, GFP_KERNEL); | 271 | netpage->index, cachefiles_gfp); |
268 | if (ret == 0) | 272 | if (ret == 0) |
269 | goto installed_new_backing_page; | 273 | goto installed_new_backing_page; |
270 | if (ret != -EEXIST) | 274 | if (ret != -EEXIST) |
@@ -335,11 +339,11 @@ backing_page_already_present: | |||
335 | backing_page_already_uptodate: | 339 | backing_page_already_uptodate: |
336 | _debug("- uptodate"); | 340 | _debug("- uptodate"); |
337 | 341 | ||
338 | pagevec_add(pagevec, netpage); | 342 | fscache_mark_page_cached(op, netpage); |
339 | fscache_mark_pages_cached(op, pagevec); | ||
340 | 343 | ||
341 | copy_highpage(netpage, backpage); | 344 | copy_highpage(netpage, backpage); |
342 | fscache_end_io(op, netpage, 0); | 345 | fscache_end_io(op, netpage, 0); |
346 | fscache_retrieval_complete(op, 1); | ||
343 | 347 | ||
344 | success: | 348 | success: |
345 | _debug("success"); | 349 | _debug("success"); |
@@ -357,10 +361,13 @@ out: | |||
357 | 361 | ||
358 | read_error: | 362 | read_error: |
359 | _debug("read error %d", ret); | 363 | _debug("read error %d", ret); |
360 | if (ret == -ENOMEM) | 364 | if (ret == -ENOMEM) { |
365 | fscache_retrieval_complete(op, 1); | ||
361 | goto out; | 366 | goto out; |
367 | } | ||
362 | io_error: | 368 | io_error: |
363 | cachefiles_io_error_obj(object, "Page read error on backing file"); | 369 | cachefiles_io_error_obj(object, "Page read error on backing file"); |
370 | fscache_retrieval_complete(op, 1); | ||
364 | ret = -ENOBUFS; | 371 | ret = -ENOBUFS; |
365 | goto out; | 372 | goto out; |
366 | 373 | ||
@@ -370,6 +377,7 @@ nomem_monitor: | |||
370 | fscache_put_retrieval(monitor->op); | 377 | fscache_put_retrieval(monitor->op); |
371 | kfree(monitor); | 378 | kfree(monitor); |
372 | nomem: | 379 | nomem: |
380 | fscache_retrieval_complete(op, 1); | ||
373 | _leave(" = -ENOMEM"); | 381 | _leave(" = -ENOMEM"); |
374 | return -ENOMEM; | 382 | return -ENOMEM; |
375 | } | 383 | } |
@@ -408,7 +416,7 @@ int cachefiles_read_or_alloc_page(struct fscache_retrieval *op, | |||
408 | _enter("{%p},{%lx},,,", object, page->index); | 416 | _enter("{%p},{%lx},,,", object, page->index); |
409 | 417 | ||
410 | if (!object->backer) | 418 | if (!object->backer) |
411 | return -ENOBUFS; | 419 | goto enobufs; |
412 | 420 | ||
413 | inode = object->backer->d_inode; | 421 | inode = object->backer->d_inode; |
414 | ASSERT(S_ISREG(inode->i_mode)); | 422 | ASSERT(S_ISREG(inode->i_mode)); |
@@ -417,7 +425,7 @@ int cachefiles_read_or_alloc_page(struct fscache_retrieval *op, | |||
417 | 425 | ||
418 | /* calculate the shift required to use bmap */ | 426 | /* calculate the shift required to use bmap */ |
419 | if (inode->i_sb->s_blocksize > PAGE_SIZE) | 427 | if (inode->i_sb->s_blocksize > PAGE_SIZE) |
420 | return -ENOBUFS; | 428 | goto enobufs; |
421 | 429 | ||
422 | shift = PAGE_SHIFT - inode->i_sb->s_blocksize_bits; | 430 | shift = PAGE_SHIFT - inode->i_sb->s_blocksize_bits; |
423 | 431 | ||
@@ -448,15 +456,20 @@ int cachefiles_read_or_alloc_page(struct fscache_retrieval *op, | |||
448 | &pagevec); | 456 | &pagevec); |
449 | } else if (cachefiles_has_space(cache, 0, 1) == 0) { | 457 | } else if (cachefiles_has_space(cache, 0, 1) == 0) { |
450 | /* there's space in the cache we can use */ | 458 | /* there's space in the cache we can use */ |
451 | pagevec_add(&pagevec, page); | 459 | fscache_mark_page_cached(op, page); |
452 | fscache_mark_pages_cached(op, &pagevec); | 460 | fscache_retrieval_complete(op, 1); |
453 | ret = -ENODATA; | 461 | ret = -ENODATA; |
454 | } else { | 462 | } else { |
455 | ret = -ENOBUFS; | 463 | goto enobufs; |
456 | } | 464 | } |
457 | 465 | ||
458 | _leave(" = %d", ret); | 466 | _leave(" = %d", ret); |
459 | return ret; | 467 | return ret; |
468 | |||
469 | enobufs: | ||
470 | fscache_retrieval_complete(op, 1); | ||
471 | _leave(" = -ENOBUFS"); | ||
472 | return -ENOBUFS; | ||
460 | } | 473 | } |
461 | 474 | ||
462 | /* | 475 | /* |
@@ -465,8 +478,7 @@ int cachefiles_read_or_alloc_page(struct fscache_retrieval *op, | |||
465 | */ | 478 | */ |
466 | static int cachefiles_read_backing_file(struct cachefiles_object *object, | 479 | static int cachefiles_read_backing_file(struct cachefiles_object *object, |
467 | struct fscache_retrieval *op, | 480 | struct fscache_retrieval *op, |
468 | struct list_head *list, | 481 | struct list_head *list) |
469 | struct pagevec *mark_pvec) | ||
470 | { | 482 | { |
471 | struct cachefiles_one_read *monitor = NULL; | 483 | struct cachefiles_one_read *monitor = NULL; |
472 | struct address_space *bmapping = object->backer->d_inode->i_mapping; | 484 | struct address_space *bmapping = object->backer->d_inode->i_mapping; |
@@ -485,7 +497,7 @@ static int cachefiles_read_backing_file(struct cachefiles_object *object, | |||
485 | netpage, netpage->index, page_count(netpage)); | 497 | netpage, netpage->index, page_count(netpage)); |
486 | 498 | ||
487 | if (!monitor) { | 499 | if (!monitor) { |
488 | monitor = kzalloc(sizeof(*monitor), GFP_KERNEL); | 500 | monitor = kzalloc(sizeof(*monitor), cachefiles_gfp); |
489 | if (!monitor) | 501 | if (!monitor) |
490 | goto nomem; | 502 | goto nomem; |
491 | 503 | ||
@@ -500,13 +512,14 @@ static int cachefiles_read_backing_file(struct cachefiles_object *object, | |||
500 | goto backing_page_already_present; | 512 | goto backing_page_already_present; |
501 | 513 | ||
502 | if (!newpage) { | 514 | if (!newpage) { |
503 | newpage = page_cache_alloc_cold(bmapping); | 515 | newpage = __page_cache_alloc(cachefiles_gfp | |
516 | __GFP_COLD); | ||
504 | if (!newpage) | 517 | if (!newpage) |
505 | goto nomem; | 518 | goto nomem; |
506 | } | 519 | } |
507 | 520 | ||
508 | ret = add_to_page_cache(newpage, bmapping, | 521 | ret = add_to_page_cache(newpage, bmapping, |
509 | netpage->index, GFP_KERNEL); | 522 | netpage->index, cachefiles_gfp); |
510 | if (ret == 0) | 523 | if (ret == 0) |
511 | goto installed_new_backing_page; | 524 | goto installed_new_backing_page; |
512 | if (ret != -EEXIST) | 525 | if (ret != -EEXIST) |
@@ -536,10 +549,11 @@ static int cachefiles_read_backing_file(struct cachefiles_object *object, | |||
536 | _debug("- monitor add"); | 549 | _debug("- monitor add"); |
537 | 550 | ||
538 | ret = add_to_page_cache(netpage, op->mapping, netpage->index, | 551 | ret = add_to_page_cache(netpage, op->mapping, netpage->index, |
539 | GFP_KERNEL); | 552 | cachefiles_gfp); |
540 | if (ret < 0) { | 553 | if (ret < 0) { |
541 | if (ret == -EEXIST) { | 554 | if (ret == -EEXIST) { |
542 | page_cache_release(netpage); | 555 | page_cache_release(netpage); |
556 | fscache_retrieval_complete(op, 1); | ||
543 | continue; | 557 | continue; |
544 | } | 558 | } |
545 | goto nomem; | 559 | goto nomem; |
@@ -612,10 +626,11 @@ static int cachefiles_read_backing_file(struct cachefiles_object *object, | |||
612 | _debug("- uptodate"); | 626 | _debug("- uptodate"); |
613 | 627 | ||
614 | ret = add_to_page_cache(netpage, op->mapping, netpage->index, | 628 | ret = add_to_page_cache(netpage, op->mapping, netpage->index, |
615 | GFP_KERNEL); | 629 | cachefiles_gfp); |
616 | if (ret < 0) { | 630 | if (ret < 0) { |
617 | if (ret == -EEXIST) { | 631 | if (ret == -EEXIST) { |
618 | page_cache_release(netpage); | 632 | page_cache_release(netpage); |
633 | fscache_retrieval_complete(op, 1); | ||
619 | continue; | 634 | continue; |
620 | } | 635 | } |
621 | goto nomem; | 636 | goto nomem; |
@@ -626,16 +641,17 @@ static int cachefiles_read_backing_file(struct cachefiles_object *object, | |||
626 | page_cache_release(backpage); | 641 | page_cache_release(backpage); |
627 | backpage = NULL; | 642 | backpage = NULL; |
628 | 643 | ||
629 | if (!pagevec_add(mark_pvec, netpage)) | 644 | fscache_mark_page_cached(op, netpage); |
630 | fscache_mark_pages_cached(op, mark_pvec); | ||
631 | 645 | ||
632 | page_cache_get(netpage); | 646 | page_cache_get(netpage); |
633 | if (!pagevec_add(&lru_pvec, netpage)) | 647 | if (!pagevec_add(&lru_pvec, netpage)) |
634 | __pagevec_lru_add_file(&lru_pvec); | 648 | __pagevec_lru_add_file(&lru_pvec); |
635 | 649 | ||
650 | /* the netpage is unlocked and marked up to date here */ | ||
636 | fscache_end_io(op, netpage, 0); | 651 | fscache_end_io(op, netpage, 0); |
637 | page_cache_release(netpage); | 652 | page_cache_release(netpage); |
638 | netpage = NULL; | 653 | netpage = NULL; |
654 | fscache_retrieval_complete(op, 1); | ||
639 | continue; | 655 | continue; |
640 | } | 656 | } |
641 | 657 | ||
@@ -661,6 +677,7 @@ out: | |||
661 | list_for_each_entry_safe(netpage, _n, list, lru) { | 677 | list_for_each_entry_safe(netpage, _n, list, lru) { |
662 | list_del(&netpage->lru); | 678 | list_del(&netpage->lru); |
663 | page_cache_release(netpage); | 679 | page_cache_release(netpage); |
680 | fscache_retrieval_complete(op, 1); | ||
664 | } | 681 | } |
665 | 682 | ||
666 | _leave(" = %d", ret); | 683 | _leave(" = %d", ret); |
@@ -669,15 +686,17 @@ out: | |||
669 | nomem: | 686 | nomem: |
670 | _debug("nomem"); | 687 | _debug("nomem"); |
671 | ret = -ENOMEM; | 688 | ret = -ENOMEM; |
672 | goto out; | 689 | goto record_page_complete; |
673 | 690 | ||
674 | read_error: | 691 | read_error: |
675 | _debug("read error %d", ret); | 692 | _debug("read error %d", ret); |
676 | if (ret == -ENOMEM) | 693 | if (ret == -ENOMEM) |
677 | goto out; | 694 | goto record_page_complete; |
678 | io_error: | 695 | io_error: |
679 | cachefiles_io_error_obj(object, "Page read error on backing file"); | 696 | cachefiles_io_error_obj(object, "Page read error on backing file"); |
680 | ret = -ENOBUFS; | 697 | ret = -ENOBUFS; |
698 | record_page_complete: | ||
699 | fscache_retrieval_complete(op, 1); | ||
681 | goto out; | 700 | goto out; |
682 | } | 701 | } |
683 | 702 | ||
@@ -709,7 +728,7 @@ int cachefiles_read_or_alloc_pages(struct fscache_retrieval *op, | |||
709 | *nr_pages); | 728 | *nr_pages); |
710 | 729 | ||
711 | if (!object->backer) | 730 | if (!object->backer) |
712 | return -ENOBUFS; | 731 | goto all_enobufs; |
713 | 732 | ||
714 | space = 1; | 733 | space = 1; |
715 | if (cachefiles_has_space(cache, 0, *nr_pages) < 0) | 734 | if (cachefiles_has_space(cache, 0, *nr_pages) < 0) |
@@ -722,7 +741,7 @@ int cachefiles_read_or_alloc_pages(struct fscache_retrieval *op, | |||
722 | 741 | ||
723 | /* calculate the shift required to use bmap */ | 742 | /* calculate the shift required to use bmap */ |
724 | if (inode->i_sb->s_blocksize > PAGE_SIZE) | 743 | if (inode->i_sb->s_blocksize > PAGE_SIZE) |
725 | return -ENOBUFS; | 744 | goto all_enobufs; |
726 | 745 | ||
727 | shift = PAGE_SHIFT - inode->i_sb->s_blocksize_bits; | 746 | shift = PAGE_SHIFT - inode->i_sb->s_blocksize_bits; |
728 | 747 | ||
@@ -762,7 +781,10 @@ int cachefiles_read_or_alloc_pages(struct fscache_retrieval *op, | |||
762 | nrbackpages++; | 781 | nrbackpages++; |
763 | } else if (space && pagevec_add(&pagevec, page) == 0) { | 782 | } else if (space && pagevec_add(&pagevec, page) == 0) { |
764 | fscache_mark_pages_cached(op, &pagevec); | 783 | fscache_mark_pages_cached(op, &pagevec); |
784 | fscache_retrieval_complete(op, 1); | ||
765 | ret = -ENODATA; | 785 | ret = -ENODATA; |
786 | } else { | ||
787 | fscache_retrieval_complete(op, 1); | ||
766 | } | 788 | } |
767 | } | 789 | } |
768 | 790 | ||
@@ -775,18 +797,18 @@ int cachefiles_read_or_alloc_pages(struct fscache_retrieval *op, | |||
775 | /* submit the apparently valid pages to the backing fs to be read from | 797 | /* submit the apparently valid pages to the backing fs to be read from |
776 | * disk */ | 798 | * disk */ |
777 | if (nrbackpages > 0) { | 799 | if (nrbackpages > 0) { |
778 | ret2 = cachefiles_read_backing_file(object, op, &backpages, | 800 | ret2 = cachefiles_read_backing_file(object, op, &backpages); |
779 | &pagevec); | ||
780 | if (ret2 == -ENOMEM || ret2 == -EINTR) | 801 | if (ret2 == -ENOMEM || ret2 == -EINTR) |
781 | ret = ret2; | 802 | ret = ret2; |
782 | } | 803 | } |
783 | 804 | ||
784 | if (pagevec_count(&pagevec) > 0) | ||
785 | fscache_mark_pages_cached(op, &pagevec); | ||
786 | |||
787 | _leave(" = %d [nr=%u%s]", | 805 | _leave(" = %d [nr=%u%s]", |
788 | ret, *nr_pages, list_empty(pages) ? " empty" : ""); | 806 | ret, *nr_pages, list_empty(pages) ? " empty" : ""); |
789 | return ret; | 807 | return ret; |
808 | |||
809 | all_enobufs: | ||
810 | fscache_retrieval_complete(op, *nr_pages); | ||
811 | return -ENOBUFS; | ||
790 | } | 812 | } |
791 | 813 | ||
792 | /* | 814 | /* |
@@ -806,7 +828,6 @@ int cachefiles_allocate_page(struct fscache_retrieval *op, | |||
806 | { | 828 | { |
807 | struct cachefiles_object *object; | 829 | struct cachefiles_object *object; |
808 | struct cachefiles_cache *cache; | 830 | struct cachefiles_cache *cache; |
809 | struct pagevec pagevec; | ||
810 | int ret; | 831 | int ret; |
811 | 832 | ||
812 | object = container_of(op->op.object, | 833 | object = container_of(op->op.object, |
@@ -817,14 +838,12 @@ int cachefiles_allocate_page(struct fscache_retrieval *op, | |||
817 | _enter("%p,{%lx},", object, page->index); | 838 | _enter("%p,{%lx},", object, page->index); |
818 | 839 | ||
819 | ret = cachefiles_has_space(cache, 0, 1); | 840 | ret = cachefiles_has_space(cache, 0, 1); |
820 | if (ret == 0) { | 841 | if (ret == 0) |
821 | pagevec_init(&pagevec, 0); | 842 | fscache_mark_page_cached(op, page); |
822 | pagevec_add(&pagevec, page); | 843 | else |
823 | fscache_mark_pages_cached(op, &pagevec); | ||
824 | } else { | ||
825 | ret = -ENOBUFS; | 844 | ret = -ENOBUFS; |
826 | } | ||
827 | 845 | ||
846 | fscache_retrieval_complete(op, 1); | ||
828 | _leave(" = %d", ret); | 847 | _leave(" = %d", ret); |
829 | return ret; | 848 | return ret; |
830 | } | 849 | } |
@@ -874,6 +893,7 @@ int cachefiles_allocate_pages(struct fscache_retrieval *op, | |||
874 | ret = -ENOBUFS; | 893 | ret = -ENOBUFS; |
875 | } | 894 | } |
876 | 895 | ||
896 | fscache_retrieval_complete(op, *nr_pages); | ||
877 | _leave(" = %d", ret); | 897 | _leave(" = %d", ret); |
878 | return ret; | 898 | return ret; |
879 | } | 899 | } |
diff --git a/fs/cachefiles/xattr.c b/fs/cachefiles/xattr.c index e18b183b47e1..73b46288b54b 100644 --- a/fs/cachefiles/xattr.c +++ b/fs/cachefiles/xattr.c | |||
@@ -174,7 +174,7 @@ int cachefiles_check_object_xattr(struct cachefiles_object *object, | |||
174 | ASSERT(dentry); | 174 | ASSERT(dentry); |
175 | ASSERT(dentry->d_inode); | 175 | ASSERT(dentry->d_inode); |
176 | 176 | ||
177 | auxbuf = kmalloc(sizeof(struct cachefiles_xattr) + 512, GFP_KERNEL); | 177 | auxbuf = kmalloc(sizeof(struct cachefiles_xattr) + 512, cachefiles_gfp); |
178 | if (!auxbuf) { | 178 | if (!auxbuf) { |
179 | _leave(" = -ENOMEM"); | 179 | _leave(" = -ENOMEM"); |
180 | return -ENOMEM; | 180 | return -ENOMEM; |
diff --git a/fs/fscache/cache.c b/fs/fscache/cache.c index 6a3c48abd677..b52aed1dca97 100644 --- a/fs/fscache/cache.c +++ b/fs/fscache/cache.c | |||
@@ -314,10 +314,10 @@ EXPORT_SYMBOL(fscache_add_cache); | |||
314 | */ | 314 | */ |
315 | void fscache_io_error(struct fscache_cache *cache) | 315 | void fscache_io_error(struct fscache_cache *cache) |
316 | { | 316 | { |
317 | set_bit(FSCACHE_IOERROR, &cache->flags); | 317 | if (!test_and_set_bit(FSCACHE_IOERROR, &cache->flags)) |
318 | 318 | printk(KERN_ERR "FS-Cache:" | |
319 | printk(KERN_ERR "FS-Cache: Cache %s stopped due to I/O error\n", | 319 | " Cache '%s' stopped due to I/O error\n", |
320 | cache->ops->name); | 320 | cache->ops->name); |
321 | } | 321 | } |
322 | EXPORT_SYMBOL(fscache_io_error); | 322 | EXPORT_SYMBOL(fscache_io_error); |
323 | 323 | ||
diff --git a/fs/fscache/cookie.c b/fs/fscache/cookie.c index 990535071a8a..8dcb114758e3 100644 --- a/fs/fscache/cookie.c +++ b/fs/fscache/cookie.c | |||
@@ -370,6 +370,66 @@ cant_attach_object: | |||
370 | } | 370 | } |
371 | 371 | ||
372 | /* | 372 | /* |
373 | * Invalidate an object. Callable with spinlocks held. | ||
374 | */ | ||
375 | void __fscache_invalidate(struct fscache_cookie *cookie) | ||
376 | { | ||
377 | struct fscache_object *object; | ||
378 | |||
379 | _enter("{%s}", cookie->def->name); | ||
380 | |||
381 | fscache_stat(&fscache_n_invalidates); | ||
382 | |||
383 | /* Only permit invalidation of data files. Invalidating an index will | ||
384 | * require the caller to release all its attachments to the tree rooted | ||
385 | * there, and if it's doing that, it may as well just retire the | ||
386 | * cookie. | ||
387 | */ | ||
388 | ASSERTCMP(cookie->def->type, ==, FSCACHE_COOKIE_TYPE_DATAFILE); | ||
389 | |||
390 | /* We will be updating the cookie too. */ | ||
391 | BUG_ON(!cookie->def->get_aux); | ||
392 | |||
393 | /* If there's an object, we tell the object state machine to handle the | ||
394 | * invalidation on our behalf, otherwise there's nothing to do. | ||
395 | */ | ||
396 | if (!hlist_empty(&cookie->backing_objects)) { | ||
397 | spin_lock(&cookie->lock); | ||
398 | |||
399 | if (!hlist_empty(&cookie->backing_objects) && | ||
400 | !test_and_set_bit(FSCACHE_COOKIE_INVALIDATING, | ||
401 | &cookie->flags)) { | ||
402 | object = hlist_entry(cookie->backing_objects.first, | ||
403 | struct fscache_object, | ||
404 | cookie_link); | ||
405 | if (object->state < FSCACHE_OBJECT_DYING) | ||
406 | fscache_raise_event( | ||
407 | object, FSCACHE_OBJECT_EV_INVALIDATE); | ||
408 | } | ||
409 | |||
410 | spin_unlock(&cookie->lock); | ||
411 | } | ||
412 | |||
413 | _leave(""); | ||
414 | } | ||
415 | EXPORT_SYMBOL(__fscache_invalidate); | ||
416 | |||
417 | /* | ||
418 | * Wait for object invalidation to complete. | ||
419 | */ | ||
420 | void __fscache_wait_on_invalidate(struct fscache_cookie *cookie) | ||
421 | { | ||
422 | _enter("%p", cookie); | ||
423 | |||
424 | wait_on_bit(&cookie->flags, FSCACHE_COOKIE_INVALIDATING, | ||
425 | fscache_wait_bit_interruptible, | ||
426 | TASK_UNINTERRUPTIBLE); | ||
427 | |||
428 | _leave(""); | ||
429 | } | ||
430 | EXPORT_SYMBOL(__fscache_wait_on_invalidate); | ||
431 | |||
432 | /* | ||
373 | * update the index entries backing a cookie | 433 | * update the index entries backing a cookie |
374 | */ | 434 | */ |
375 | void __fscache_update_cookie(struct fscache_cookie *cookie) | 435 | void __fscache_update_cookie(struct fscache_cookie *cookie) |
@@ -442,16 +502,34 @@ void __fscache_relinquish_cookie(struct fscache_cookie *cookie, int retire) | |||
442 | 502 | ||
443 | event = retire ? FSCACHE_OBJECT_EV_RETIRE : FSCACHE_OBJECT_EV_RELEASE; | 503 | event = retire ? FSCACHE_OBJECT_EV_RETIRE : FSCACHE_OBJECT_EV_RELEASE; |
444 | 504 | ||
505 | try_again: | ||
445 | spin_lock(&cookie->lock); | 506 | spin_lock(&cookie->lock); |
446 | 507 | ||
447 | /* break links with all the active objects */ | 508 | /* break links with all the active objects */ |
448 | while (!hlist_empty(&cookie->backing_objects)) { | 509 | while (!hlist_empty(&cookie->backing_objects)) { |
510 | int n_reads; | ||
449 | object = hlist_entry(cookie->backing_objects.first, | 511 | object = hlist_entry(cookie->backing_objects.first, |
450 | struct fscache_object, | 512 | struct fscache_object, |
451 | cookie_link); | 513 | cookie_link); |
452 | 514 | ||
453 | _debug("RELEASE OBJ%x", object->debug_id); | 515 | _debug("RELEASE OBJ%x", object->debug_id); |
454 | 516 | ||
517 | set_bit(FSCACHE_COOKIE_WAITING_ON_READS, &cookie->flags); | ||
518 | n_reads = atomic_read(&object->n_reads); | ||
519 | if (n_reads) { | ||
520 | int n_ops = object->n_ops; | ||
521 | int n_in_progress = object->n_in_progress; | ||
522 | spin_unlock(&cookie->lock); | ||
523 | printk(KERN_ERR "FS-Cache:" | ||
524 | " Cookie '%s' still has %d outstanding reads (%d,%d)\n", | ||
525 | cookie->def->name, | ||
526 | n_reads, n_ops, n_in_progress); | ||
527 | wait_on_bit(&cookie->flags, FSCACHE_COOKIE_WAITING_ON_READS, | ||
528 | fscache_wait_bit, TASK_UNINTERRUPTIBLE); | ||
529 | printk("Wait finished\n"); | ||
530 | goto try_again; | ||
531 | } | ||
532 | |||
455 | /* detach each cache object from the object cookie */ | 533 | /* detach each cache object from the object cookie */ |
456 | spin_lock(&object->lock); | 534 | spin_lock(&object->lock); |
457 | hlist_del_init(&object->cookie_link); | 535 | hlist_del_init(&object->cookie_link); |
diff --git a/fs/fscache/internal.h b/fs/fscache/internal.h index f6aad48d38a8..ee38fef4be51 100644 --- a/fs/fscache/internal.h +++ b/fs/fscache/internal.h | |||
@@ -121,12 +121,19 @@ extern int fscache_submit_exclusive_op(struct fscache_object *, | |||
121 | struct fscache_operation *); | 121 | struct fscache_operation *); |
122 | extern int fscache_submit_op(struct fscache_object *, | 122 | extern int fscache_submit_op(struct fscache_object *, |
123 | struct fscache_operation *); | 123 | struct fscache_operation *); |
124 | extern int fscache_cancel_op(struct fscache_operation *); | 124 | extern int fscache_cancel_op(struct fscache_operation *, |
125 | void (*)(struct fscache_operation *)); | ||
126 | extern void fscache_cancel_all_ops(struct fscache_object *); | ||
125 | extern void fscache_abort_object(struct fscache_object *); | 127 | extern void fscache_abort_object(struct fscache_object *); |
126 | extern void fscache_start_operations(struct fscache_object *); | 128 | extern void fscache_start_operations(struct fscache_object *); |
127 | extern void fscache_operation_gc(struct work_struct *); | 129 | extern void fscache_operation_gc(struct work_struct *); |
128 | 130 | ||
129 | /* | 131 | /* |
132 | * page.c | ||
133 | */ | ||
134 | extern void fscache_invalidate_writes(struct fscache_cookie *); | ||
135 | |||
136 | /* | ||
130 | * proc.c | 137 | * proc.c |
131 | */ | 138 | */ |
132 | #ifdef CONFIG_PROC_FS | 139 | #ifdef CONFIG_PROC_FS |
@@ -194,6 +201,7 @@ extern atomic_t fscache_n_store_vmscan_not_storing; | |||
194 | extern atomic_t fscache_n_store_vmscan_gone; | 201 | extern atomic_t fscache_n_store_vmscan_gone; |
195 | extern atomic_t fscache_n_store_vmscan_busy; | 202 | extern atomic_t fscache_n_store_vmscan_busy; |
196 | extern atomic_t fscache_n_store_vmscan_cancelled; | 203 | extern atomic_t fscache_n_store_vmscan_cancelled; |
204 | extern atomic_t fscache_n_store_vmscan_wait; | ||
197 | 205 | ||
198 | extern atomic_t fscache_n_marks; | 206 | extern atomic_t fscache_n_marks; |
199 | extern atomic_t fscache_n_uncaches; | 207 | extern atomic_t fscache_n_uncaches; |
@@ -205,6 +213,9 @@ extern atomic_t fscache_n_acquires_ok; | |||
205 | extern atomic_t fscache_n_acquires_nobufs; | 213 | extern atomic_t fscache_n_acquires_nobufs; |
206 | extern atomic_t fscache_n_acquires_oom; | 214 | extern atomic_t fscache_n_acquires_oom; |
207 | 215 | ||
216 | extern atomic_t fscache_n_invalidates; | ||
217 | extern atomic_t fscache_n_invalidates_run; | ||
218 | |||
208 | extern atomic_t fscache_n_updates; | 219 | extern atomic_t fscache_n_updates; |
209 | extern atomic_t fscache_n_updates_null; | 220 | extern atomic_t fscache_n_updates_null; |
210 | extern atomic_t fscache_n_updates_run; | 221 | extern atomic_t fscache_n_updates_run; |
@@ -237,6 +248,7 @@ extern atomic_t fscache_n_cop_alloc_object; | |||
237 | extern atomic_t fscache_n_cop_lookup_object; | 248 | extern atomic_t fscache_n_cop_lookup_object; |
238 | extern atomic_t fscache_n_cop_lookup_complete; | 249 | extern atomic_t fscache_n_cop_lookup_complete; |
239 | extern atomic_t fscache_n_cop_grab_object; | 250 | extern atomic_t fscache_n_cop_grab_object; |
251 | extern atomic_t fscache_n_cop_invalidate_object; | ||
240 | extern atomic_t fscache_n_cop_update_object; | 252 | extern atomic_t fscache_n_cop_update_object; |
241 | extern atomic_t fscache_n_cop_drop_object; | 253 | extern atomic_t fscache_n_cop_drop_object; |
242 | extern atomic_t fscache_n_cop_put_object; | 254 | extern atomic_t fscache_n_cop_put_object; |
@@ -278,6 +290,7 @@ extern const struct file_operations fscache_stats_fops; | |||
278 | static inline void fscache_raise_event(struct fscache_object *object, | 290 | static inline void fscache_raise_event(struct fscache_object *object, |
279 | unsigned event) | 291 | unsigned event) |
280 | { | 292 | { |
293 | BUG_ON(event >= NR_FSCACHE_OBJECT_EVENTS); | ||
281 | if (!test_and_set_bit(event, &object->events) && | 294 | if (!test_and_set_bit(event, &object->events) && |
282 | test_bit(event, &object->event_mask)) | 295 | test_bit(event, &object->event_mask)) |
283 | fscache_enqueue_object(object); | 296 | fscache_enqueue_object(object); |
diff --git a/fs/fscache/object-list.c b/fs/fscache/object-list.c index ebe29c581380..f27c89d17885 100644 --- a/fs/fscache/object-list.c +++ b/fs/fscache/object-list.c | |||
@@ -245,7 +245,7 @@ static int fscache_objlist_show(struct seq_file *m, void *v) | |||
245 | obj->n_in_progress, | 245 | obj->n_in_progress, |
246 | obj->n_exclusive, | 246 | obj->n_exclusive, |
247 | atomic_read(&obj->n_reads), | 247 | atomic_read(&obj->n_reads), |
248 | obj->event_mask & FSCACHE_OBJECT_EVENTS_MASK, | 248 | obj->event_mask, |
249 | obj->events, | 249 | obj->events, |
250 | obj->flags, | 250 | obj->flags, |
251 | work_busy(&obj->work)); | 251 | work_busy(&obj->work)); |
diff --git a/fs/fscache/object.c b/fs/fscache/object.c index b6b897c550ac..50d41c180211 100644 --- a/fs/fscache/object.c +++ b/fs/fscache/object.c | |||
@@ -14,6 +14,7 @@ | |||
14 | 14 | ||
15 | #define FSCACHE_DEBUG_LEVEL COOKIE | 15 | #define FSCACHE_DEBUG_LEVEL COOKIE |
16 | #include <linux/module.h> | 16 | #include <linux/module.h> |
17 | #include <linux/slab.h> | ||
17 | #include "internal.h" | 18 | #include "internal.h" |
18 | 19 | ||
19 | const char *fscache_object_states[FSCACHE_OBJECT__NSTATES] = { | 20 | const char *fscache_object_states[FSCACHE_OBJECT__NSTATES] = { |
@@ -22,6 +23,7 @@ const char *fscache_object_states[FSCACHE_OBJECT__NSTATES] = { | |||
22 | [FSCACHE_OBJECT_CREATING] = "OBJECT_CREATING", | 23 | [FSCACHE_OBJECT_CREATING] = "OBJECT_CREATING", |
23 | [FSCACHE_OBJECT_AVAILABLE] = "OBJECT_AVAILABLE", | 24 | [FSCACHE_OBJECT_AVAILABLE] = "OBJECT_AVAILABLE", |
24 | [FSCACHE_OBJECT_ACTIVE] = "OBJECT_ACTIVE", | 25 | [FSCACHE_OBJECT_ACTIVE] = "OBJECT_ACTIVE", |
26 | [FSCACHE_OBJECT_INVALIDATING] = "OBJECT_INVALIDATING", | ||
25 | [FSCACHE_OBJECT_UPDATING] = "OBJECT_UPDATING", | 27 | [FSCACHE_OBJECT_UPDATING] = "OBJECT_UPDATING", |
26 | [FSCACHE_OBJECT_DYING] = "OBJECT_DYING", | 28 | [FSCACHE_OBJECT_DYING] = "OBJECT_DYING", |
27 | [FSCACHE_OBJECT_LC_DYING] = "OBJECT_LC_DYING", | 29 | [FSCACHE_OBJECT_LC_DYING] = "OBJECT_LC_DYING", |
@@ -39,6 +41,7 @@ const char fscache_object_states_short[FSCACHE_OBJECT__NSTATES][5] = { | |||
39 | [FSCACHE_OBJECT_CREATING] = "CRTN", | 41 | [FSCACHE_OBJECT_CREATING] = "CRTN", |
40 | [FSCACHE_OBJECT_AVAILABLE] = "AVBL", | 42 | [FSCACHE_OBJECT_AVAILABLE] = "AVBL", |
41 | [FSCACHE_OBJECT_ACTIVE] = "ACTV", | 43 | [FSCACHE_OBJECT_ACTIVE] = "ACTV", |
44 | [FSCACHE_OBJECT_INVALIDATING] = "INVL", | ||
42 | [FSCACHE_OBJECT_UPDATING] = "UPDT", | 45 | [FSCACHE_OBJECT_UPDATING] = "UPDT", |
43 | [FSCACHE_OBJECT_DYING] = "DYNG", | 46 | [FSCACHE_OBJECT_DYING] = "DYNG", |
44 | [FSCACHE_OBJECT_LC_DYING] = "LCDY", | 47 | [FSCACHE_OBJECT_LC_DYING] = "LCDY", |
@@ -54,6 +57,7 @@ static void fscache_put_object(struct fscache_object *); | |||
54 | static void fscache_initialise_object(struct fscache_object *); | 57 | static void fscache_initialise_object(struct fscache_object *); |
55 | static void fscache_lookup_object(struct fscache_object *); | 58 | static void fscache_lookup_object(struct fscache_object *); |
56 | static void fscache_object_available(struct fscache_object *); | 59 | static void fscache_object_available(struct fscache_object *); |
60 | static void fscache_invalidate_object(struct fscache_object *); | ||
57 | static void fscache_release_object(struct fscache_object *); | 61 | static void fscache_release_object(struct fscache_object *); |
58 | static void fscache_withdraw_object(struct fscache_object *); | 62 | static void fscache_withdraw_object(struct fscache_object *); |
59 | static void fscache_enqueue_dependents(struct fscache_object *); | 63 | static void fscache_enqueue_dependents(struct fscache_object *); |
@@ -79,6 +83,15 @@ static inline void fscache_done_parent_op(struct fscache_object *object) | |||
79 | } | 83 | } |
80 | 84 | ||
81 | /* | 85 | /* |
86 | * Notify netfs of invalidation completion. | ||
87 | */ | ||
88 | static inline void fscache_invalidation_complete(struct fscache_cookie *cookie) | ||
89 | { | ||
90 | if (test_and_clear_bit(FSCACHE_COOKIE_INVALIDATING, &cookie->flags)) | ||
91 | wake_up_bit(&cookie->flags, FSCACHE_COOKIE_INVALIDATING); | ||
92 | } | ||
93 | |||
94 | /* | ||
82 | * process events that have been sent to an object's state machine | 95 | * process events that have been sent to an object's state machine |
83 | * - initiates parent lookup | 96 | * - initiates parent lookup |
84 | * - does object lookup | 97 | * - does object lookup |
@@ -90,6 +103,7 @@ static void fscache_object_state_machine(struct fscache_object *object) | |||
90 | { | 103 | { |
91 | enum fscache_object_state new_state; | 104 | enum fscache_object_state new_state; |
92 | struct fscache_cookie *cookie; | 105 | struct fscache_cookie *cookie; |
106 | int event; | ||
93 | 107 | ||
94 | ASSERT(object != NULL); | 108 | ASSERT(object != NULL); |
95 | 109 | ||
@@ -101,7 +115,8 @@ static void fscache_object_state_machine(struct fscache_object *object) | |||
101 | /* wait for the parent object to become ready */ | 115 | /* wait for the parent object to become ready */ |
102 | case FSCACHE_OBJECT_INIT: | 116 | case FSCACHE_OBJECT_INIT: |
103 | object->event_mask = | 117 | object->event_mask = |
104 | ULONG_MAX & ~(1 << FSCACHE_OBJECT_EV_CLEARED); | 118 | FSCACHE_OBJECT_EVENTS_MASK & |
119 | ~(1 << FSCACHE_OBJECT_EV_CLEARED); | ||
105 | fscache_initialise_object(object); | 120 | fscache_initialise_object(object); |
106 | goto done; | 121 | goto done; |
107 | 122 | ||
@@ -125,6 +140,16 @@ static void fscache_object_state_machine(struct fscache_object *object) | |||
125 | case FSCACHE_OBJECT_ACTIVE: | 140 | case FSCACHE_OBJECT_ACTIVE: |
126 | goto active_transit; | 141 | goto active_transit; |
127 | 142 | ||
143 | /* Invalidate an object on disk */ | ||
144 | case FSCACHE_OBJECT_INVALIDATING: | ||
145 | clear_bit(FSCACHE_OBJECT_EV_INVALIDATE, &object->events); | ||
146 | fscache_stat(&fscache_n_invalidates_run); | ||
147 | fscache_stat(&fscache_n_cop_invalidate_object); | ||
148 | fscache_invalidate_object(object); | ||
149 | fscache_stat_d(&fscache_n_cop_invalidate_object); | ||
150 | fscache_raise_event(object, FSCACHE_OBJECT_EV_UPDATE); | ||
151 | goto active_transit; | ||
152 | |||
128 | /* update the object metadata on disk */ | 153 | /* update the object metadata on disk */ |
129 | case FSCACHE_OBJECT_UPDATING: | 154 | case FSCACHE_OBJECT_UPDATING: |
130 | clear_bit(FSCACHE_OBJECT_EV_UPDATE, &object->events); | 155 | clear_bit(FSCACHE_OBJECT_EV_UPDATE, &object->events); |
@@ -251,13 +276,17 @@ static void fscache_object_state_machine(struct fscache_object *object) | |||
251 | 276 | ||
252 | /* determine the transition from a lookup state */ | 277 | /* determine the transition from a lookup state */ |
253 | lookup_transit: | 278 | lookup_transit: |
254 | switch (fls(object->events & object->event_mask) - 1) { | 279 | event = fls(object->events & object->event_mask) - 1; |
280 | switch (event) { | ||
255 | case FSCACHE_OBJECT_EV_WITHDRAW: | 281 | case FSCACHE_OBJECT_EV_WITHDRAW: |
256 | case FSCACHE_OBJECT_EV_RETIRE: | 282 | case FSCACHE_OBJECT_EV_RETIRE: |
257 | case FSCACHE_OBJECT_EV_RELEASE: | 283 | case FSCACHE_OBJECT_EV_RELEASE: |
258 | case FSCACHE_OBJECT_EV_ERROR: | 284 | case FSCACHE_OBJECT_EV_ERROR: |
259 | new_state = FSCACHE_OBJECT_LC_DYING; | 285 | new_state = FSCACHE_OBJECT_LC_DYING; |
260 | goto change_state; | 286 | goto change_state; |
287 | case FSCACHE_OBJECT_EV_INVALIDATE: | ||
288 | new_state = FSCACHE_OBJECT_INVALIDATING; | ||
289 | goto change_state; | ||
261 | case FSCACHE_OBJECT_EV_REQUEUE: | 290 | case FSCACHE_OBJECT_EV_REQUEUE: |
262 | goto done; | 291 | goto done; |
263 | case -1: | 292 | case -1: |
@@ -268,13 +297,17 @@ lookup_transit: | |||
268 | 297 | ||
269 | /* determine the transition from an active state */ | 298 | /* determine the transition from an active state */ |
270 | active_transit: | 299 | active_transit: |
271 | switch (fls(object->events & object->event_mask) - 1) { | 300 | event = fls(object->events & object->event_mask) - 1; |
301 | switch (event) { | ||
272 | case FSCACHE_OBJECT_EV_WITHDRAW: | 302 | case FSCACHE_OBJECT_EV_WITHDRAW: |
273 | case FSCACHE_OBJECT_EV_RETIRE: | 303 | case FSCACHE_OBJECT_EV_RETIRE: |
274 | case FSCACHE_OBJECT_EV_RELEASE: | 304 | case FSCACHE_OBJECT_EV_RELEASE: |
275 | case FSCACHE_OBJECT_EV_ERROR: | 305 | case FSCACHE_OBJECT_EV_ERROR: |
276 | new_state = FSCACHE_OBJECT_DYING; | 306 | new_state = FSCACHE_OBJECT_DYING; |
277 | goto change_state; | 307 | goto change_state; |
308 | case FSCACHE_OBJECT_EV_INVALIDATE: | ||
309 | new_state = FSCACHE_OBJECT_INVALIDATING; | ||
310 | goto change_state; | ||
278 | case FSCACHE_OBJECT_EV_UPDATE: | 311 | case FSCACHE_OBJECT_EV_UPDATE: |
279 | new_state = FSCACHE_OBJECT_UPDATING; | 312 | new_state = FSCACHE_OBJECT_UPDATING; |
280 | goto change_state; | 313 | goto change_state; |
@@ -287,7 +320,8 @@ active_transit: | |||
287 | 320 | ||
288 | /* determine the transition from a terminal state */ | 321 | /* determine the transition from a terminal state */ |
289 | terminal_transit: | 322 | terminal_transit: |
290 | switch (fls(object->events & object->event_mask) - 1) { | 323 | event = fls(object->events & object->event_mask) - 1; |
324 | switch (event) { | ||
291 | case FSCACHE_OBJECT_EV_WITHDRAW: | 325 | case FSCACHE_OBJECT_EV_WITHDRAW: |
292 | new_state = FSCACHE_OBJECT_WITHDRAWING; | 326 | new_state = FSCACHE_OBJECT_WITHDRAWING; |
293 | goto change_state; | 327 | goto change_state; |
@@ -320,8 +354,8 @@ done: | |||
320 | 354 | ||
321 | unsupported_event: | 355 | unsupported_event: |
322 | printk(KERN_ERR "FS-Cache:" | 356 | printk(KERN_ERR "FS-Cache:" |
323 | " Unsupported event %lx [mask %lx] in state %s\n", | 357 | " Unsupported event %d [%lx/%lx] in state %s\n", |
324 | object->events, object->event_mask, | 358 | event, object->events, object->event_mask, |
325 | fscache_object_states[object->state]); | 359 | fscache_object_states[object->state]); |
326 | BUG(); | 360 | BUG(); |
327 | } | 361 | } |
@@ -587,8 +621,6 @@ static void fscache_object_available(struct fscache_object *object) | |||
587 | if (object->n_in_progress == 0) { | 621 | if (object->n_in_progress == 0) { |
588 | if (object->n_ops > 0) { | 622 | if (object->n_ops > 0) { |
589 | ASSERTCMP(object->n_ops, >=, object->n_obj_ops); | 623 | ASSERTCMP(object->n_ops, >=, object->n_obj_ops); |
590 | ASSERTIF(object->n_ops > object->n_obj_ops, | ||
591 | !list_empty(&object->pending_ops)); | ||
592 | fscache_start_operations(object); | 624 | fscache_start_operations(object); |
593 | } else { | 625 | } else { |
594 | ASSERT(list_empty(&object->pending_ops)); | 626 | ASSERT(list_empty(&object->pending_ops)); |
@@ -681,6 +713,7 @@ static void fscache_withdraw_object(struct fscache_object *object) | |||
681 | if (object->cookie == cookie) { | 713 | if (object->cookie == cookie) { |
682 | hlist_del_init(&object->cookie_link); | 714 | hlist_del_init(&object->cookie_link); |
683 | object->cookie = NULL; | 715 | object->cookie = NULL; |
716 | fscache_invalidation_complete(cookie); | ||
684 | detached = true; | 717 | detached = true; |
685 | } | 718 | } |
686 | spin_unlock(&cookie->lock); | 719 | spin_unlock(&cookie->lock); |
@@ -890,3 +923,55 @@ enum fscache_checkaux fscache_check_aux(struct fscache_object *object, | |||
890 | return result; | 923 | return result; |
891 | } | 924 | } |
892 | EXPORT_SYMBOL(fscache_check_aux); | 925 | EXPORT_SYMBOL(fscache_check_aux); |
926 | |||
927 | /* | ||
928 | * Asynchronously invalidate an object. | ||
929 | */ | ||
930 | static void fscache_invalidate_object(struct fscache_object *object) | ||
931 | { | ||
932 | struct fscache_operation *op; | ||
933 | struct fscache_cookie *cookie = object->cookie; | ||
934 | |||
935 | _enter("{OBJ%x}", object->debug_id); | ||
936 | |||
937 | /* Reject any new read/write ops and abort any that are pending. */ | ||
938 | fscache_invalidate_writes(cookie); | ||
939 | clear_bit(FSCACHE_OBJECT_PENDING_WRITE, &object->flags); | ||
940 | fscache_cancel_all_ops(object); | ||
941 | |||
942 | /* Now we have to wait for in-progress reads and writes */ | ||
943 | op = kzalloc(sizeof(*op), GFP_KERNEL); | ||
944 | if (!op) { | ||
945 | fscache_raise_event(object, FSCACHE_OBJECT_EV_ERROR); | ||
946 | _leave(" [ENOMEM]"); | ||
947 | return; | ||
948 | } | ||
949 | |||
950 | fscache_operation_init(op, object->cache->ops->invalidate_object, NULL); | ||
951 | op->flags = FSCACHE_OP_ASYNC | (1 << FSCACHE_OP_EXCLUSIVE); | ||
952 | |||
953 | spin_lock(&cookie->lock); | ||
954 | if (fscache_submit_exclusive_op(object, op) < 0) | ||
955 | goto submit_op_failed; | ||
956 | spin_unlock(&cookie->lock); | ||
957 | fscache_put_operation(op); | ||
958 | |||
959 | /* Once we've completed the invalidation, we know there will be no data | ||
960 | * stored in the cache and thus we can reinstate the data-check-skip | ||
961 | * optimisation. | ||
962 | */ | ||
963 | set_bit(FSCACHE_COOKIE_NO_DATA_YET, &cookie->flags); | ||
964 | |||
965 | /* We can allow read and write requests to come in once again. They'll | ||
966 | * queue up behind our exclusive invalidation operation. | ||
967 | */ | ||
968 | fscache_invalidation_complete(cookie); | ||
969 | _leave(""); | ||
970 | return; | ||
971 | |||
972 | submit_op_failed: | ||
973 | spin_unlock(&cookie->lock); | ||
974 | kfree(op); | ||
975 | fscache_raise_event(object, FSCACHE_OBJECT_EV_ERROR); | ||
976 | _leave(" [EIO]"); | ||
977 | } | ||
diff --git a/fs/fscache/operation.c b/fs/fscache/operation.c index 30afdfa7aec7..762a9ec4ffa4 100644 --- a/fs/fscache/operation.c +++ b/fs/fscache/operation.c | |||
@@ -37,6 +37,7 @@ void fscache_enqueue_operation(struct fscache_operation *op) | |||
37 | ASSERT(op->processor != NULL); | 37 | ASSERT(op->processor != NULL); |
38 | ASSERTCMP(op->object->state, >=, FSCACHE_OBJECT_AVAILABLE); | 38 | ASSERTCMP(op->object->state, >=, FSCACHE_OBJECT_AVAILABLE); |
39 | ASSERTCMP(atomic_read(&op->usage), >, 0); | 39 | ASSERTCMP(atomic_read(&op->usage), >, 0); |
40 | ASSERTCMP(op->state, ==, FSCACHE_OP_ST_IN_PROGRESS); | ||
40 | 41 | ||
41 | fscache_stat(&fscache_n_op_enqueue); | 42 | fscache_stat(&fscache_n_op_enqueue); |
42 | switch (op->flags & FSCACHE_OP_TYPE) { | 43 | switch (op->flags & FSCACHE_OP_TYPE) { |
@@ -64,6 +65,9 @@ EXPORT_SYMBOL(fscache_enqueue_operation); | |||
64 | static void fscache_run_op(struct fscache_object *object, | 65 | static void fscache_run_op(struct fscache_object *object, |
65 | struct fscache_operation *op) | 66 | struct fscache_operation *op) |
66 | { | 67 | { |
68 | ASSERTCMP(op->state, ==, FSCACHE_OP_ST_PENDING); | ||
69 | |||
70 | op->state = FSCACHE_OP_ST_IN_PROGRESS; | ||
67 | object->n_in_progress++; | 71 | object->n_in_progress++; |
68 | if (test_and_clear_bit(FSCACHE_OP_WAITING, &op->flags)) | 72 | if (test_and_clear_bit(FSCACHE_OP_WAITING, &op->flags)) |
69 | wake_up_bit(&op->flags, FSCACHE_OP_WAITING); | 73 | wake_up_bit(&op->flags, FSCACHE_OP_WAITING); |
@@ -84,18 +88,21 @@ int fscache_submit_exclusive_op(struct fscache_object *object, | |||
84 | 88 | ||
85 | _enter("{OBJ%x OP%x},", object->debug_id, op->debug_id); | 89 | _enter("{OBJ%x OP%x},", object->debug_id, op->debug_id); |
86 | 90 | ||
91 | ASSERTCMP(op->state, ==, FSCACHE_OP_ST_INITIALISED); | ||
92 | ASSERTCMP(atomic_read(&op->usage), >, 0); | ||
93 | |||
87 | spin_lock(&object->lock); | 94 | spin_lock(&object->lock); |
88 | ASSERTCMP(object->n_ops, >=, object->n_in_progress); | 95 | ASSERTCMP(object->n_ops, >=, object->n_in_progress); |
89 | ASSERTCMP(object->n_ops, >=, object->n_exclusive); | 96 | ASSERTCMP(object->n_ops, >=, object->n_exclusive); |
90 | ASSERT(list_empty(&op->pend_link)); | 97 | ASSERT(list_empty(&op->pend_link)); |
91 | 98 | ||
92 | ret = -ENOBUFS; | 99 | op->state = FSCACHE_OP_ST_PENDING; |
93 | if (fscache_object_is_active(object)) { | 100 | if (fscache_object_is_active(object)) { |
94 | op->object = object; | 101 | op->object = object; |
95 | object->n_ops++; | 102 | object->n_ops++; |
96 | object->n_exclusive++; /* reads and writes must wait */ | 103 | object->n_exclusive++; /* reads and writes must wait */ |
97 | 104 | ||
98 | if (object->n_ops > 1) { | 105 | if (object->n_in_progress > 0) { |
99 | atomic_inc(&op->usage); | 106 | atomic_inc(&op->usage); |
100 | list_add_tail(&op->pend_link, &object->pending_ops); | 107 | list_add_tail(&op->pend_link, &object->pending_ops); |
101 | fscache_stat(&fscache_n_op_pend); | 108 | fscache_stat(&fscache_n_op_pend); |
@@ -121,8 +128,11 @@ int fscache_submit_exclusive_op(struct fscache_object *object, | |||
121 | fscache_stat(&fscache_n_op_pend); | 128 | fscache_stat(&fscache_n_op_pend); |
122 | ret = 0; | 129 | ret = 0; |
123 | } else { | 130 | } else { |
124 | /* not allowed to submit ops in any other state */ | 131 | /* If we're in any other state, there must have been an I/O |
125 | BUG(); | 132 | * error of some nature. |
133 | */ | ||
134 | ASSERT(test_bit(FSCACHE_IOERROR, &object->cache->flags)); | ||
135 | ret = -EIO; | ||
126 | } | 136 | } |
127 | 137 | ||
128 | spin_unlock(&object->lock); | 138 | spin_unlock(&object->lock); |
@@ -186,6 +196,7 @@ int fscache_submit_op(struct fscache_object *object, | |||
186 | _enter("{OBJ%x OP%x},{%u}", | 196 | _enter("{OBJ%x OP%x},{%u}", |
187 | object->debug_id, op->debug_id, atomic_read(&op->usage)); | 197 | object->debug_id, op->debug_id, atomic_read(&op->usage)); |
188 | 198 | ||
199 | ASSERTCMP(op->state, ==, FSCACHE_OP_ST_INITIALISED); | ||
189 | ASSERTCMP(atomic_read(&op->usage), >, 0); | 200 | ASSERTCMP(atomic_read(&op->usage), >, 0); |
190 | 201 | ||
191 | spin_lock(&object->lock); | 202 | spin_lock(&object->lock); |
@@ -196,6 +207,7 @@ int fscache_submit_op(struct fscache_object *object, | |||
196 | ostate = object->state; | 207 | ostate = object->state; |
197 | smp_rmb(); | 208 | smp_rmb(); |
198 | 209 | ||
210 | op->state = FSCACHE_OP_ST_PENDING; | ||
199 | if (fscache_object_is_active(object)) { | 211 | if (fscache_object_is_active(object)) { |
200 | op->object = object; | 212 | op->object = object; |
201 | object->n_ops++; | 213 | object->n_ops++; |
@@ -225,12 +237,15 @@ int fscache_submit_op(struct fscache_object *object, | |||
225 | object->state == FSCACHE_OBJECT_LC_DYING || | 237 | object->state == FSCACHE_OBJECT_LC_DYING || |
226 | object->state == FSCACHE_OBJECT_WITHDRAWING) { | 238 | object->state == FSCACHE_OBJECT_WITHDRAWING) { |
227 | fscache_stat(&fscache_n_op_rejected); | 239 | fscache_stat(&fscache_n_op_rejected); |
240 | op->state = FSCACHE_OP_ST_CANCELLED; | ||
228 | ret = -ENOBUFS; | 241 | ret = -ENOBUFS; |
229 | } else if (!test_bit(FSCACHE_IOERROR, &object->cache->flags)) { | 242 | } else if (!test_bit(FSCACHE_IOERROR, &object->cache->flags)) { |
230 | fscache_report_unexpected_submission(object, op, ostate); | 243 | fscache_report_unexpected_submission(object, op, ostate); |
231 | ASSERT(!fscache_object_is_active(object)); | 244 | ASSERT(!fscache_object_is_active(object)); |
245 | op->state = FSCACHE_OP_ST_CANCELLED; | ||
232 | ret = -ENOBUFS; | 246 | ret = -ENOBUFS; |
233 | } else { | 247 | } else { |
248 | op->state = FSCACHE_OP_ST_CANCELLED; | ||
234 | ret = -ENOBUFS; | 249 | ret = -ENOBUFS; |
235 | } | 250 | } |
236 | 251 | ||
@@ -283,20 +298,28 @@ void fscache_start_operations(struct fscache_object *object) | |||
283 | /* | 298 | /* |
284 | * cancel an operation that's pending on an object | 299 | * cancel an operation that's pending on an object |
285 | */ | 300 | */ |
286 | int fscache_cancel_op(struct fscache_operation *op) | 301 | int fscache_cancel_op(struct fscache_operation *op, |
302 | void (*do_cancel)(struct fscache_operation *)) | ||
287 | { | 303 | { |
288 | struct fscache_object *object = op->object; | 304 | struct fscache_object *object = op->object; |
289 | int ret; | 305 | int ret; |
290 | 306 | ||
291 | _enter("OBJ%x OP%x}", op->object->debug_id, op->debug_id); | 307 | _enter("OBJ%x OP%x}", op->object->debug_id, op->debug_id); |
292 | 308 | ||
309 | ASSERTCMP(op->state, >=, FSCACHE_OP_ST_PENDING); | ||
310 | ASSERTCMP(op->state, !=, FSCACHE_OP_ST_CANCELLED); | ||
311 | ASSERTCMP(atomic_read(&op->usage), >, 0); | ||
312 | |||
293 | spin_lock(&object->lock); | 313 | spin_lock(&object->lock); |
294 | 314 | ||
295 | ret = -EBUSY; | 315 | ret = -EBUSY; |
296 | if (!list_empty(&op->pend_link)) { | 316 | if (op->state == FSCACHE_OP_ST_PENDING) { |
317 | ASSERT(!list_empty(&op->pend_link)); | ||
297 | fscache_stat(&fscache_n_op_cancelled); | 318 | fscache_stat(&fscache_n_op_cancelled); |
298 | list_del_init(&op->pend_link); | 319 | list_del_init(&op->pend_link); |
299 | object->n_ops--; | 320 | if (do_cancel) |
321 | do_cancel(op); | ||
322 | op->state = FSCACHE_OP_ST_CANCELLED; | ||
300 | if (test_bit(FSCACHE_OP_EXCLUSIVE, &op->flags)) | 323 | if (test_bit(FSCACHE_OP_EXCLUSIVE, &op->flags)) |
301 | object->n_exclusive--; | 324 | object->n_exclusive--; |
302 | if (test_and_clear_bit(FSCACHE_OP_WAITING, &op->flags)) | 325 | if (test_and_clear_bit(FSCACHE_OP_WAITING, &op->flags)) |
@@ -311,6 +334,70 @@ int fscache_cancel_op(struct fscache_operation *op) | |||
311 | } | 334 | } |
312 | 335 | ||
313 | /* | 336 | /* |
337 | * Cancel all pending operations on an object | ||
338 | */ | ||
339 | void fscache_cancel_all_ops(struct fscache_object *object) | ||
340 | { | ||
341 | struct fscache_operation *op; | ||
342 | |||
343 | _enter("OBJ%x", object->debug_id); | ||
344 | |||
345 | spin_lock(&object->lock); | ||
346 | |||
347 | while (!list_empty(&object->pending_ops)) { | ||
348 | op = list_entry(object->pending_ops.next, | ||
349 | struct fscache_operation, pend_link); | ||
350 | fscache_stat(&fscache_n_op_cancelled); | ||
351 | list_del_init(&op->pend_link); | ||
352 | |||
353 | ASSERTCMP(op->state, ==, FSCACHE_OP_ST_PENDING); | ||
354 | op->state = FSCACHE_OP_ST_CANCELLED; | ||
355 | |||
356 | if (test_bit(FSCACHE_OP_EXCLUSIVE, &op->flags)) | ||
357 | object->n_exclusive--; | ||
358 | if (test_and_clear_bit(FSCACHE_OP_WAITING, &op->flags)) | ||
359 | wake_up_bit(&op->flags, FSCACHE_OP_WAITING); | ||
360 | fscache_put_operation(op); | ||
361 | cond_resched_lock(&object->lock); | ||
362 | } | ||
363 | |||
364 | spin_unlock(&object->lock); | ||
365 | _leave(""); | ||
366 | } | ||
367 | |||
368 | /* | ||
369 | * Record the completion or cancellation of an in-progress operation. | ||
370 | */ | ||
371 | void fscache_op_complete(struct fscache_operation *op, bool cancelled) | ||
372 | { | ||
373 | struct fscache_object *object = op->object; | ||
374 | |||
375 | _enter("OBJ%x", object->debug_id); | ||
376 | |||
377 | ASSERTCMP(op->state, ==, FSCACHE_OP_ST_IN_PROGRESS); | ||
378 | ASSERTCMP(object->n_in_progress, >, 0); | ||
379 | ASSERTIFCMP(test_bit(FSCACHE_OP_EXCLUSIVE, &op->flags), | ||
380 | object->n_exclusive, >, 0); | ||
381 | ASSERTIFCMP(test_bit(FSCACHE_OP_EXCLUSIVE, &op->flags), | ||
382 | object->n_in_progress, ==, 1); | ||
383 | |||
384 | spin_lock(&object->lock); | ||
385 | |||
386 | op->state = cancelled ? | ||
387 | FSCACHE_OP_ST_CANCELLED : FSCACHE_OP_ST_COMPLETE; | ||
388 | |||
389 | if (test_bit(FSCACHE_OP_EXCLUSIVE, &op->flags)) | ||
390 | object->n_exclusive--; | ||
391 | object->n_in_progress--; | ||
392 | if (object->n_in_progress == 0) | ||
393 | fscache_start_operations(object); | ||
394 | |||
395 | spin_unlock(&object->lock); | ||
396 | _leave(""); | ||
397 | } | ||
398 | EXPORT_SYMBOL(fscache_op_complete); | ||
399 | |||
400 | /* | ||
314 | * release an operation | 401 | * release an operation |
315 | * - queues pending ops if this is the last in-progress op | 402 | * - queues pending ops if this is the last in-progress op |
316 | */ | 403 | */ |
@@ -328,8 +415,9 @@ void fscache_put_operation(struct fscache_operation *op) | |||
328 | return; | 415 | return; |
329 | 416 | ||
330 | _debug("PUT OP"); | 417 | _debug("PUT OP"); |
331 | if (test_and_set_bit(FSCACHE_OP_DEAD, &op->flags)) | 418 | ASSERTIFCMP(op->state != FSCACHE_OP_ST_COMPLETE, |
332 | BUG(); | 419 | op->state, ==, FSCACHE_OP_ST_CANCELLED); |
420 | op->state = FSCACHE_OP_ST_DEAD; | ||
333 | 421 | ||
334 | fscache_stat(&fscache_n_op_release); | 422 | fscache_stat(&fscache_n_op_release); |
335 | 423 | ||
@@ -340,8 +428,14 @@ void fscache_put_operation(struct fscache_operation *op) | |||
340 | 428 | ||
341 | object = op->object; | 429 | object = op->object; |
342 | 430 | ||
343 | if (test_bit(FSCACHE_OP_DEC_READ_CNT, &op->flags)) | 431 | if (test_bit(FSCACHE_OP_DEC_READ_CNT, &op->flags)) { |
344 | atomic_dec(&object->n_reads); | 432 | if (atomic_dec_and_test(&object->n_reads)) { |
433 | clear_bit(FSCACHE_COOKIE_WAITING_ON_READS, | ||
434 | &object->cookie->flags); | ||
435 | wake_up_bit(&object->cookie->flags, | ||
436 | FSCACHE_COOKIE_WAITING_ON_READS); | ||
437 | } | ||
438 | } | ||
345 | 439 | ||
346 | /* now... we may get called with the object spinlock held, so we | 440 | /* now... we may get called with the object spinlock held, so we |
347 | * complete the cleanup here only if we can immediately acquire the | 441 | * complete the cleanup here only if we can immediately acquire the |
@@ -359,16 +453,6 @@ void fscache_put_operation(struct fscache_operation *op) | |||
359 | return; | 453 | return; |
360 | } | 454 | } |
361 | 455 | ||
362 | if (test_bit(FSCACHE_OP_EXCLUSIVE, &op->flags)) { | ||
363 | ASSERTCMP(object->n_exclusive, >, 0); | ||
364 | object->n_exclusive--; | ||
365 | } | ||
366 | |||
367 | ASSERTCMP(object->n_in_progress, >, 0); | ||
368 | object->n_in_progress--; | ||
369 | if (object->n_in_progress == 0) | ||
370 | fscache_start_operations(object); | ||
371 | |||
372 | ASSERTCMP(object->n_ops, >, 0); | 456 | ASSERTCMP(object->n_ops, >, 0); |
373 | object->n_ops--; | 457 | object->n_ops--; |
374 | if (object->n_ops == 0) | 458 | if (object->n_ops == 0) |
@@ -407,23 +491,14 @@ void fscache_operation_gc(struct work_struct *work) | |||
407 | spin_unlock(&cache->op_gc_list_lock); | 491 | spin_unlock(&cache->op_gc_list_lock); |
408 | 492 | ||
409 | object = op->object; | 493 | object = op->object; |
494 | spin_lock(&object->lock); | ||
410 | 495 | ||
411 | _debug("GC DEFERRED REL OBJ%x OP%x", | 496 | _debug("GC DEFERRED REL OBJ%x OP%x", |
412 | object->debug_id, op->debug_id); | 497 | object->debug_id, op->debug_id); |
413 | fscache_stat(&fscache_n_op_gc); | 498 | fscache_stat(&fscache_n_op_gc); |
414 | 499 | ||
415 | ASSERTCMP(atomic_read(&op->usage), ==, 0); | 500 | ASSERTCMP(atomic_read(&op->usage), ==, 0); |
416 | 501 | ASSERTCMP(op->state, ==, FSCACHE_OP_ST_DEAD); | |
417 | spin_lock(&object->lock); | ||
418 | if (test_bit(FSCACHE_OP_EXCLUSIVE, &op->flags)) { | ||
419 | ASSERTCMP(object->n_exclusive, >, 0); | ||
420 | object->n_exclusive--; | ||
421 | } | ||
422 | |||
423 | ASSERTCMP(object->n_in_progress, >, 0); | ||
424 | object->n_in_progress--; | ||
425 | if (object->n_in_progress == 0) | ||
426 | fscache_start_operations(object); | ||
427 | 502 | ||
428 | ASSERTCMP(object->n_ops, >, 0); | 503 | ASSERTCMP(object->n_ops, >, 0); |
429 | object->n_ops--; | 504 | object->n_ops--; |
@@ -431,6 +506,7 @@ void fscache_operation_gc(struct work_struct *work) | |||
431 | fscache_raise_event(object, FSCACHE_OBJECT_EV_CLEARED); | 506 | fscache_raise_event(object, FSCACHE_OBJECT_EV_CLEARED); |
432 | 507 | ||
433 | spin_unlock(&object->lock); | 508 | spin_unlock(&object->lock); |
509 | kfree(op); | ||
434 | 510 | ||
435 | } while (count++ < 20); | 511 | } while (count++ < 20); |
436 | 512 | ||
diff --git a/fs/fscache/page.c b/fs/fscache/page.c index 3f7a59bfa7ad..ff000e52072d 100644 --- a/fs/fscache/page.c +++ b/fs/fscache/page.c | |||
@@ -56,6 +56,7 @@ bool __fscache_maybe_release_page(struct fscache_cookie *cookie, | |||
56 | 56 | ||
57 | _enter("%p,%p,%x", cookie, page, gfp); | 57 | _enter("%p,%p,%x", cookie, page, gfp); |
58 | 58 | ||
59 | try_again: | ||
59 | rcu_read_lock(); | 60 | rcu_read_lock(); |
60 | val = radix_tree_lookup(&cookie->stores, page->index); | 61 | val = radix_tree_lookup(&cookie->stores, page->index); |
61 | if (!val) { | 62 | if (!val) { |
@@ -104,11 +105,19 @@ bool __fscache_maybe_release_page(struct fscache_cookie *cookie, | |||
104 | return true; | 105 | return true; |
105 | 106 | ||
106 | page_busy: | 107 | page_busy: |
107 | /* we might want to wait here, but that could deadlock the allocator as | 108 | /* We will wait here if we're allowed to, but that could deadlock the |
108 | * the work threads writing to the cache may all end up sleeping | 109 | * allocator as the work threads writing to the cache may all end up |
109 | * on memory allocation */ | 110 | * sleeping on memory allocation, so we may need to impose a timeout |
110 | fscache_stat(&fscache_n_store_vmscan_busy); | 111 | * too. */ |
111 | return false; | 112 | if (!(gfp & __GFP_WAIT)) { |
113 | fscache_stat(&fscache_n_store_vmscan_busy); | ||
114 | return false; | ||
115 | } | ||
116 | |||
117 | fscache_stat(&fscache_n_store_vmscan_wait); | ||
118 | __fscache_wait_on_page_write(cookie, page); | ||
119 | gfp &= ~__GFP_WAIT; | ||
120 | goto try_again; | ||
112 | } | 121 | } |
113 | EXPORT_SYMBOL(__fscache_maybe_release_page); | 122 | EXPORT_SYMBOL(__fscache_maybe_release_page); |
114 | 123 | ||
@@ -162,6 +171,7 @@ static void fscache_attr_changed_op(struct fscache_operation *op) | |||
162 | fscache_abort_object(object); | 171 | fscache_abort_object(object); |
163 | } | 172 | } |
164 | 173 | ||
174 | fscache_op_complete(op, true); | ||
165 | _leave(""); | 175 | _leave(""); |
166 | } | 176 | } |
167 | 177 | ||
@@ -223,6 +233,8 @@ static void fscache_release_retrieval_op(struct fscache_operation *_op) | |||
223 | 233 | ||
224 | _enter("{OP%x}", op->op.debug_id); | 234 | _enter("{OP%x}", op->op.debug_id); |
225 | 235 | ||
236 | ASSERTCMP(op->n_pages, ==, 0); | ||
237 | |||
226 | fscache_hist(fscache_retrieval_histogram, op->start_time); | 238 | fscache_hist(fscache_retrieval_histogram, op->start_time); |
227 | if (op->context) | 239 | if (op->context) |
228 | fscache_put_context(op->op.object->cookie, op->context); | 240 | fscache_put_context(op->op.object->cookie, op->context); |
@@ -291,6 +303,17 @@ static int fscache_wait_for_deferred_lookup(struct fscache_cookie *cookie) | |||
291 | } | 303 | } |
292 | 304 | ||
293 | /* | 305 | /* |
306 | * Handle cancellation of a pending retrieval op | ||
307 | */ | ||
308 | static void fscache_do_cancel_retrieval(struct fscache_operation *_op) | ||
309 | { | ||
310 | struct fscache_retrieval *op = | ||
311 | container_of(_op, struct fscache_retrieval, op); | ||
312 | |||
313 | op->n_pages = 0; | ||
314 | } | ||
315 | |||
316 | /* | ||
294 | * wait for an object to become active (or dead) | 317 | * wait for an object to become active (or dead) |
295 | */ | 318 | */ |
296 | static int fscache_wait_for_retrieval_activation(struct fscache_object *object, | 319 | static int fscache_wait_for_retrieval_activation(struct fscache_object *object, |
@@ -307,8 +330,8 @@ static int fscache_wait_for_retrieval_activation(struct fscache_object *object, | |||
307 | fscache_stat(stat_op_waits); | 330 | fscache_stat(stat_op_waits); |
308 | if (wait_on_bit(&op->op.flags, FSCACHE_OP_WAITING, | 331 | if (wait_on_bit(&op->op.flags, FSCACHE_OP_WAITING, |
309 | fscache_wait_bit_interruptible, | 332 | fscache_wait_bit_interruptible, |
310 | TASK_INTERRUPTIBLE) < 0) { | 333 | TASK_INTERRUPTIBLE) != 0) { |
311 | ret = fscache_cancel_op(&op->op); | 334 | ret = fscache_cancel_op(&op->op, fscache_do_cancel_retrieval); |
312 | if (ret == 0) | 335 | if (ret == 0) |
313 | return -ERESTARTSYS; | 336 | return -ERESTARTSYS; |
314 | 337 | ||
@@ -320,7 +343,14 @@ static int fscache_wait_for_retrieval_activation(struct fscache_object *object, | |||
320 | _debug("<<< GO"); | 343 | _debug("<<< GO"); |
321 | 344 | ||
322 | check_if_dead: | 345 | check_if_dead: |
346 | if (op->op.state == FSCACHE_OP_ST_CANCELLED) { | ||
347 | fscache_stat(stat_object_dead); | ||
348 | _leave(" = -ENOBUFS [cancelled]"); | ||
349 | return -ENOBUFS; | ||
350 | } | ||
323 | if (unlikely(fscache_object_is_dead(object))) { | 351 | if (unlikely(fscache_object_is_dead(object))) { |
352 | pr_err("%s() = -ENOBUFS [obj dead %d]\n", __func__, op->op.state); | ||
353 | fscache_cancel_op(&op->op, fscache_do_cancel_retrieval); | ||
324 | fscache_stat(stat_object_dead); | 354 | fscache_stat(stat_object_dead); |
325 | return -ENOBUFS; | 355 | return -ENOBUFS; |
326 | } | 356 | } |
@@ -353,6 +383,11 @@ int __fscache_read_or_alloc_page(struct fscache_cookie *cookie, | |||
353 | if (hlist_empty(&cookie->backing_objects)) | 383 | if (hlist_empty(&cookie->backing_objects)) |
354 | goto nobufs; | 384 | goto nobufs; |
355 | 385 | ||
386 | if (test_bit(FSCACHE_COOKIE_INVALIDATING, &cookie->flags)) { | ||
387 | _leave(" = -ENOBUFS [invalidating]"); | ||
388 | return -ENOBUFS; | ||
389 | } | ||
390 | |||
356 | ASSERTCMP(cookie->def->type, !=, FSCACHE_COOKIE_TYPE_INDEX); | 391 | ASSERTCMP(cookie->def->type, !=, FSCACHE_COOKIE_TYPE_INDEX); |
357 | ASSERTCMP(page, !=, NULL); | 392 | ASSERTCMP(page, !=, NULL); |
358 | 393 | ||
@@ -364,6 +399,7 @@ int __fscache_read_or_alloc_page(struct fscache_cookie *cookie, | |||
364 | _leave(" = -ENOMEM"); | 399 | _leave(" = -ENOMEM"); |
365 | return -ENOMEM; | 400 | return -ENOMEM; |
366 | } | 401 | } |
402 | op->n_pages = 1; | ||
367 | 403 | ||
368 | spin_lock(&cookie->lock); | 404 | spin_lock(&cookie->lock); |
369 | 405 | ||
@@ -375,10 +411,10 @@ int __fscache_read_or_alloc_page(struct fscache_cookie *cookie, | |||
375 | ASSERTCMP(object->state, >, FSCACHE_OBJECT_LOOKING_UP); | 411 | ASSERTCMP(object->state, >, FSCACHE_OBJECT_LOOKING_UP); |
376 | 412 | ||
377 | atomic_inc(&object->n_reads); | 413 | atomic_inc(&object->n_reads); |
378 | set_bit(FSCACHE_OP_DEC_READ_CNT, &op->op.flags); | 414 | __set_bit(FSCACHE_OP_DEC_READ_CNT, &op->op.flags); |
379 | 415 | ||
380 | if (fscache_submit_op(object, &op->op) < 0) | 416 | if (fscache_submit_op(object, &op->op) < 0) |
381 | goto nobufs_unlock; | 417 | goto nobufs_unlock_dec; |
382 | spin_unlock(&cookie->lock); | 418 | spin_unlock(&cookie->lock); |
383 | 419 | ||
384 | fscache_stat(&fscache_n_retrieval_ops); | 420 | fscache_stat(&fscache_n_retrieval_ops); |
@@ -425,6 +461,8 @@ error: | |||
425 | _leave(" = %d", ret); | 461 | _leave(" = %d", ret); |
426 | return ret; | 462 | return ret; |
427 | 463 | ||
464 | nobufs_unlock_dec: | ||
465 | atomic_dec(&object->n_reads); | ||
428 | nobufs_unlock: | 466 | nobufs_unlock: |
429 | spin_unlock(&cookie->lock); | 467 | spin_unlock(&cookie->lock); |
430 | kfree(op); | 468 | kfree(op); |
@@ -472,6 +510,11 @@ int __fscache_read_or_alloc_pages(struct fscache_cookie *cookie, | |||
472 | if (hlist_empty(&cookie->backing_objects)) | 510 | if (hlist_empty(&cookie->backing_objects)) |
473 | goto nobufs; | 511 | goto nobufs; |
474 | 512 | ||
513 | if (test_bit(FSCACHE_COOKIE_INVALIDATING, &cookie->flags)) { | ||
514 | _leave(" = -ENOBUFS [invalidating]"); | ||
515 | return -ENOBUFS; | ||
516 | } | ||
517 | |||
475 | ASSERTCMP(cookie->def->type, !=, FSCACHE_COOKIE_TYPE_INDEX); | 518 | ASSERTCMP(cookie->def->type, !=, FSCACHE_COOKIE_TYPE_INDEX); |
476 | ASSERTCMP(*nr_pages, >, 0); | 519 | ASSERTCMP(*nr_pages, >, 0); |
477 | ASSERT(!list_empty(pages)); | 520 | ASSERT(!list_empty(pages)); |
@@ -482,6 +525,7 @@ int __fscache_read_or_alloc_pages(struct fscache_cookie *cookie, | |||
482 | op = fscache_alloc_retrieval(mapping, end_io_func, context); | 525 | op = fscache_alloc_retrieval(mapping, end_io_func, context); |
483 | if (!op) | 526 | if (!op) |
484 | return -ENOMEM; | 527 | return -ENOMEM; |
528 | op->n_pages = *nr_pages; | ||
485 | 529 | ||
486 | spin_lock(&cookie->lock); | 530 | spin_lock(&cookie->lock); |
487 | 531 | ||
@@ -491,10 +535,10 @@ int __fscache_read_or_alloc_pages(struct fscache_cookie *cookie, | |||
491 | struct fscache_object, cookie_link); | 535 | struct fscache_object, cookie_link); |
492 | 536 | ||
493 | atomic_inc(&object->n_reads); | 537 | atomic_inc(&object->n_reads); |
494 | set_bit(FSCACHE_OP_DEC_READ_CNT, &op->op.flags); | 538 | __set_bit(FSCACHE_OP_DEC_READ_CNT, &op->op.flags); |
495 | 539 | ||
496 | if (fscache_submit_op(object, &op->op) < 0) | 540 | if (fscache_submit_op(object, &op->op) < 0) |
497 | goto nobufs_unlock; | 541 | goto nobufs_unlock_dec; |
498 | spin_unlock(&cookie->lock); | 542 | spin_unlock(&cookie->lock); |
499 | 543 | ||
500 | fscache_stat(&fscache_n_retrieval_ops); | 544 | fscache_stat(&fscache_n_retrieval_ops); |
@@ -541,6 +585,8 @@ error: | |||
541 | _leave(" = %d", ret); | 585 | _leave(" = %d", ret); |
542 | return ret; | 586 | return ret; |
543 | 587 | ||
588 | nobufs_unlock_dec: | ||
589 | atomic_dec(&object->n_reads); | ||
544 | nobufs_unlock: | 590 | nobufs_unlock: |
545 | spin_unlock(&cookie->lock); | 591 | spin_unlock(&cookie->lock); |
546 | kfree(op); | 592 | kfree(op); |
@@ -577,12 +623,18 @@ int __fscache_alloc_page(struct fscache_cookie *cookie, | |||
577 | ASSERTCMP(cookie->def->type, !=, FSCACHE_COOKIE_TYPE_INDEX); | 623 | ASSERTCMP(cookie->def->type, !=, FSCACHE_COOKIE_TYPE_INDEX); |
578 | ASSERTCMP(page, !=, NULL); | 624 | ASSERTCMP(page, !=, NULL); |
579 | 625 | ||
626 | if (test_bit(FSCACHE_COOKIE_INVALIDATING, &cookie->flags)) { | ||
627 | _leave(" = -ENOBUFS [invalidating]"); | ||
628 | return -ENOBUFS; | ||
629 | } | ||
630 | |||
580 | if (fscache_wait_for_deferred_lookup(cookie) < 0) | 631 | if (fscache_wait_for_deferred_lookup(cookie) < 0) |
581 | return -ERESTARTSYS; | 632 | return -ERESTARTSYS; |
582 | 633 | ||
583 | op = fscache_alloc_retrieval(page->mapping, NULL, NULL); | 634 | op = fscache_alloc_retrieval(page->mapping, NULL, NULL); |
584 | if (!op) | 635 | if (!op) |
585 | return -ENOMEM; | 636 | return -ENOMEM; |
637 | op->n_pages = 1; | ||
586 | 638 | ||
587 | spin_lock(&cookie->lock); | 639 | spin_lock(&cookie->lock); |
588 | 640 | ||
@@ -658,9 +710,27 @@ static void fscache_write_op(struct fscache_operation *_op) | |||
658 | spin_lock(&object->lock); | 710 | spin_lock(&object->lock); |
659 | cookie = object->cookie; | 711 | cookie = object->cookie; |
660 | 712 | ||
661 | if (!fscache_object_is_active(object) || !cookie) { | 713 | if (!fscache_object_is_active(object)) { |
714 | /* If we get here, then the on-disk cache object likely longer | ||
715 | * exists, so we should just cancel this write operation. | ||
716 | */ | ||
717 | spin_unlock(&object->lock); | ||
718 | fscache_op_complete(&op->op, false); | ||
719 | _leave(" [inactive]"); | ||
720 | return; | ||
721 | } | ||
722 | |||
723 | if (!cookie) { | ||
724 | /* If we get here, then the cookie belonging to the object was | ||
725 | * detached, probably by the cookie being withdrawn due to | ||
726 | * memory pressure, which means that the pages we might write | ||
727 | * to the cache from no longer exist - therefore, we can just | ||
728 | * cancel this write operation. | ||
729 | */ | ||
662 | spin_unlock(&object->lock); | 730 | spin_unlock(&object->lock); |
663 | _leave(""); | 731 | fscache_op_complete(&op->op, false); |
732 | _leave(" [cancel] op{f=%lx s=%u} obj{s=%u f=%lx}", | ||
733 | _op->flags, _op->state, object->state, object->flags); | ||
664 | return; | 734 | return; |
665 | } | 735 | } |
666 | 736 | ||
@@ -696,6 +766,7 @@ static void fscache_write_op(struct fscache_operation *_op) | |||
696 | fscache_end_page_write(object, page); | 766 | fscache_end_page_write(object, page); |
697 | if (ret < 0) { | 767 | if (ret < 0) { |
698 | fscache_abort_object(object); | 768 | fscache_abort_object(object); |
769 | fscache_op_complete(&op->op, true); | ||
699 | } else { | 770 | } else { |
700 | fscache_enqueue_operation(&op->op); | 771 | fscache_enqueue_operation(&op->op); |
701 | } | 772 | } |
@@ -710,6 +781,38 @@ superseded: | |||
710 | spin_unlock(&cookie->stores_lock); | 781 | spin_unlock(&cookie->stores_lock); |
711 | clear_bit(FSCACHE_OBJECT_PENDING_WRITE, &object->flags); | 782 | clear_bit(FSCACHE_OBJECT_PENDING_WRITE, &object->flags); |
712 | spin_unlock(&object->lock); | 783 | spin_unlock(&object->lock); |
784 | fscache_op_complete(&op->op, true); | ||
785 | _leave(""); | ||
786 | } | ||
787 | |||
788 | /* | ||
789 | * Clear the pages pending writing for invalidation | ||
790 | */ | ||
791 | void fscache_invalidate_writes(struct fscache_cookie *cookie) | ||
792 | { | ||
793 | struct page *page; | ||
794 | void *results[16]; | ||
795 | int n, i; | ||
796 | |||
797 | _enter(""); | ||
798 | |||
799 | while (spin_lock(&cookie->stores_lock), | ||
800 | n = radix_tree_gang_lookup_tag(&cookie->stores, results, 0, | ||
801 | ARRAY_SIZE(results), | ||
802 | FSCACHE_COOKIE_PENDING_TAG), | ||
803 | n > 0) { | ||
804 | for (i = n - 1; i >= 0; i--) { | ||
805 | page = results[i]; | ||
806 | radix_tree_delete(&cookie->stores, page->index); | ||
807 | } | ||
808 | |||
809 | spin_unlock(&cookie->stores_lock); | ||
810 | |||
811 | for (i = n - 1; i >= 0; i--) | ||
812 | page_cache_release(results[i]); | ||
813 | } | ||
814 | |||
815 | spin_unlock(&cookie->stores_lock); | ||
713 | _leave(""); | 816 | _leave(""); |
714 | } | 817 | } |
715 | 818 | ||
@@ -759,7 +862,12 @@ int __fscache_write_page(struct fscache_cookie *cookie, | |||
759 | 862 | ||
760 | fscache_stat(&fscache_n_stores); | 863 | fscache_stat(&fscache_n_stores); |
761 | 864 | ||
762 | op = kzalloc(sizeof(*op), GFP_NOIO); | 865 | if (test_bit(FSCACHE_COOKIE_INVALIDATING, &cookie->flags)) { |
866 | _leave(" = -ENOBUFS [invalidating]"); | ||
867 | return -ENOBUFS; | ||
868 | } | ||
869 | |||
870 | op = kzalloc(sizeof(*op), GFP_NOIO | __GFP_NOMEMALLOC | __GFP_NORETRY); | ||
763 | if (!op) | 871 | if (!op) |
764 | goto nomem; | 872 | goto nomem; |
765 | 873 | ||
@@ -915,6 +1023,40 @@ done: | |||
915 | EXPORT_SYMBOL(__fscache_uncache_page); | 1023 | EXPORT_SYMBOL(__fscache_uncache_page); |
916 | 1024 | ||
917 | /** | 1025 | /** |
1026 | * fscache_mark_page_cached - Mark a page as being cached | ||
1027 | * @op: The retrieval op pages are being marked for | ||
1028 | * @page: The page to be marked | ||
1029 | * | ||
1030 | * Mark a netfs page as being cached. After this is called, the netfs | ||
1031 | * must call fscache_uncache_page() to remove the mark. | ||
1032 | */ | ||
1033 | void fscache_mark_page_cached(struct fscache_retrieval *op, struct page *page) | ||
1034 | { | ||
1035 | struct fscache_cookie *cookie = op->op.object->cookie; | ||
1036 | |||
1037 | #ifdef CONFIG_FSCACHE_STATS | ||
1038 | atomic_inc(&fscache_n_marks); | ||
1039 | #endif | ||
1040 | |||
1041 | _debug("- mark %p{%lx}", page, page->index); | ||
1042 | if (TestSetPageFsCache(page)) { | ||
1043 | static bool once_only; | ||
1044 | if (!once_only) { | ||
1045 | once_only = true; | ||
1046 | printk(KERN_WARNING "FS-Cache:" | ||
1047 | " Cookie type %s marked page %lx" | ||
1048 | " multiple times\n", | ||
1049 | cookie->def->name, page->index); | ||
1050 | } | ||
1051 | } | ||
1052 | |||
1053 | if (cookie->def->mark_page_cached) | ||
1054 | cookie->def->mark_page_cached(cookie->netfs_data, | ||
1055 | op->mapping, page); | ||
1056 | } | ||
1057 | EXPORT_SYMBOL(fscache_mark_page_cached); | ||
1058 | |||
1059 | /** | ||
918 | * fscache_mark_pages_cached - Mark pages as being cached | 1060 | * fscache_mark_pages_cached - Mark pages as being cached |
919 | * @op: The retrieval op pages are being marked for | 1061 | * @op: The retrieval op pages are being marked for |
920 | * @pagevec: The pages to be marked | 1062 | * @pagevec: The pages to be marked |
@@ -925,32 +1067,11 @@ EXPORT_SYMBOL(__fscache_uncache_page); | |||
925 | void fscache_mark_pages_cached(struct fscache_retrieval *op, | 1067 | void fscache_mark_pages_cached(struct fscache_retrieval *op, |
926 | struct pagevec *pagevec) | 1068 | struct pagevec *pagevec) |
927 | { | 1069 | { |
928 | struct fscache_cookie *cookie = op->op.object->cookie; | ||
929 | unsigned long loop; | 1070 | unsigned long loop; |
930 | 1071 | ||
931 | #ifdef CONFIG_FSCACHE_STATS | 1072 | for (loop = 0; loop < pagevec->nr; loop++) |
932 | atomic_add(pagevec->nr, &fscache_n_marks); | 1073 | fscache_mark_page_cached(op, pagevec->pages[loop]); |
933 | #endif | ||
934 | |||
935 | for (loop = 0; loop < pagevec->nr; loop++) { | ||
936 | struct page *page = pagevec->pages[loop]; | ||
937 | |||
938 | _debug("- mark %p{%lx}", page, page->index); | ||
939 | if (TestSetPageFsCache(page)) { | ||
940 | static bool once_only; | ||
941 | if (!once_only) { | ||
942 | once_only = true; | ||
943 | printk(KERN_WARNING "FS-Cache:" | ||
944 | " Cookie type %s marked page %lx" | ||
945 | " multiple times\n", | ||
946 | cookie->def->name, page->index); | ||
947 | } | ||
948 | } | ||
949 | } | ||
950 | 1074 | ||
951 | if (cookie->def->mark_pages_cached) | ||
952 | cookie->def->mark_pages_cached(cookie->netfs_data, | ||
953 | op->mapping, pagevec); | ||
954 | pagevec_reinit(pagevec); | 1075 | pagevec_reinit(pagevec); |
955 | } | 1076 | } |
956 | EXPORT_SYMBOL(fscache_mark_pages_cached); | 1077 | EXPORT_SYMBOL(fscache_mark_pages_cached); |
diff --git a/fs/fscache/stats.c b/fs/fscache/stats.c index 4765190d537f..8179e8bc4a3d 100644 --- a/fs/fscache/stats.c +++ b/fs/fscache/stats.c | |||
@@ -69,6 +69,7 @@ atomic_t fscache_n_store_vmscan_not_storing; | |||
69 | atomic_t fscache_n_store_vmscan_gone; | 69 | atomic_t fscache_n_store_vmscan_gone; |
70 | atomic_t fscache_n_store_vmscan_busy; | 70 | atomic_t fscache_n_store_vmscan_busy; |
71 | atomic_t fscache_n_store_vmscan_cancelled; | 71 | atomic_t fscache_n_store_vmscan_cancelled; |
72 | atomic_t fscache_n_store_vmscan_wait; | ||
72 | 73 | ||
73 | atomic_t fscache_n_marks; | 74 | atomic_t fscache_n_marks; |
74 | atomic_t fscache_n_uncaches; | 75 | atomic_t fscache_n_uncaches; |
@@ -80,6 +81,9 @@ atomic_t fscache_n_acquires_ok; | |||
80 | atomic_t fscache_n_acquires_nobufs; | 81 | atomic_t fscache_n_acquires_nobufs; |
81 | atomic_t fscache_n_acquires_oom; | 82 | atomic_t fscache_n_acquires_oom; |
82 | 83 | ||
84 | atomic_t fscache_n_invalidates; | ||
85 | atomic_t fscache_n_invalidates_run; | ||
86 | |||
83 | atomic_t fscache_n_updates; | 87 | atomic_t fscache_n_updates; |
84 | atomic_t fscache_n_updates_null; | 88 | atomic_t fscache_n_updates_null; |
85 | atomic_t fscache_n_updates_run; | 89 | atomic_t fscache_n_updates_run; |
@@ -112,6 +116,7 @@ atomic_t fscache_n_cop_alloc_object; | |||
112 | atomic_t fscache_n_cop_lookup_object; | 116 | atomic_t fscache_n_cop_lookup_object; |
113 | atomic_t fscache_n_cop_lookup_complete; | 117 | atomic_t fscache_n_cop_lookup_complete; |
114 | atomic_t fscache_n_cop_grab_object; | 118 | atomic_t fscache_n_cop_grab_object; |
119 | atomic_t fscache_n_cop_invalidate_object; | ||
115 | atomic_t fscache_n_cop_update_object; | 120 | atomic_t fscache_n_cop_update_object; |
116 | atomic_t fscache_n_cop_drop_object; | 121 | atomic_t fscache_n_cop_drop_object; |
117 | atomic_t fscache_n_cop_put_object; | 122 | atomic_t fscache_n_cop_put_object; |
@@ -168,6 +173,10 @@ static int fscache_stats_show(struct seq_file *m, void *v) | |||
168 | atomic_read(&fscache_n_object_created), | 173 | atomic_read(&fscache_n_object_created), |
169 | atomic_read(&fscache_n_object_lookups_timed_out)); | 174 | atomic_read(&fscache_n_object_lookups_timed_out)); |
170 | 175 | ||
176 | seq_printf(m, "Invals : n=%u run=%u\n", | ||
177 | atomic_read(&fscache_n_invalidates), | ||
178 | atomic_read(&fscache_n_invalidates_run)); | ||
179 | |||
171 | seq_printf(m, "Updates: n=%u nul=%u run=%u\n", | 180 | seq_printf(m, "Updates: n=%u nul=%u run=%u\n", |
172 | atomic_read(&fscache_n_updates), | 181 | atomic_read(&fscache_n_updates), |
173 | atomic_read(&fscache_n_updates_null), | 182 | atomic_read(&fscache_n_updates_null), |
@@ -224,11 +233,12 @@ static int fscache_stats_show(struct seq_file *m, void *v) | |||
224 | atomic_read(&fscache_n_store_radix_deletes), | 233 | atomic_read(&fscache_n_store_radix_deletes), |
225 | atomic_read(&fscache_n_store_pages_over_limit)); | 234 | atomic_read(&fscache_n_store_pages_over_limit)); |
226 | 235 | ||
227 | seq_printf(m, "VmScan : nos=%u gon=%u bsy=%u can=%u\n", | 236 | seq_printf(m, "VmScan : nos=%u gon=%u bsy=%u can=%u wt=%u\n", |
228 | atomic_read(&fscache_n_store_vmscan_not_storing), | 237 | atomic_read(&fscache_n_store_vmscan_not_storing), |
229 | atomic_read(&fscache_n_store_vmscan_gone), | 238 | atomic_read(&fscache_n_store_vmscan_gone), |
230 | atomic_read(&fscache_n_store_vmscan_busy), | 239 | atomic_read(&fscache_n_store_vmscan_busy), |
231 | atomic_read(&fscache_n_store_vmscan_cancelled)); | 240 | atomic_read(&fscache_n_store_vmscan_cancelled), |
241 | atomic_read(&fscache_n_store_vmscan_wait)); | ||
232 | 242 | ||
233 | seq_printf(m, "Ops : pend=%u run=%u enq=%u can=%u rej=%u\n", | 243 | seq_printf(m, "Ops : pend=%u run=%u enq=%u can=%u rej=%u\n", |
234 | atomic_read(&fscache_n_op_pend), | 244 | atomic_read(&fscache_n_op_pend), |
@@ -246,7 +256,8 @@ static int fscache_stats_show(struct seq_file *m, void *v) | |||
246 | atomic_read(&fscache_n_cop_lookup_object), | 256 | atomic_read(&fscache_n_cop_lookup_object), |
247 | atomic_read(&fscache_n_cop_lookup_complete), | 257 | atomic_read(&fscache_n_cop_lookup_complete), |
248 | atomic_read(&fscache_n_cop_grab_object)); | 258 | atomic_read(&fscache_n_cop_grab_object)); |
249 | seq_printf(m, "CacheOp: upo=%d dro=%d pto=%d atc=%d syn=%d\n", | 259 | seq_printf(m, "CacheOp: inv=%d upo=%d dro=%d pto=%d atc=%d syn=%d\n", |
260 | atomic_read(&fscache_n_cop_invalidate_object), | ||
250 | atomic_read(&fscache_n_cop_update_object), | 261 | atomic_read(&fscache_n_cop_update_object), |
251 | atomic_read(&fscache_n_cop_drop_object), | 262 | atomic_read(&fscache_n_cop_drop_object), |
252 | atomic_read(&fscache_n_cop_put_object), | 263 | atomic_read(&fscache_n_cop_put_object), |
diff --git a/fs/nfs/fscache.c b/fs/nfs/fscache.c index c817787fbdb4..24d1d1c5fcaf 100644 --- a/fs/nfs/fscache.c +++ b/fs/nfs/fscache.c | |||
@@ -307,6 +307,7 @@ void nfs_fscache_set_inode_cookie(struct inode *inode, struct file *filp) | |||
307 | nfs_fscache_inode_unlock(inode); | 307 | nfs_fscache_inode_unlock(inode); |
308 | } | 308 | } |
309 | } | 309 | } |
310 | EXPORT_SYMBOL_GPL(nfs_fscache_set_inode_cookie); | ||
310 | 311 | ||
311 | /* | 312 | /* |
312 | * Replace a per-inode cookie due to revalidation detecting a file having | 313 | * Replace a per-inode cookie due to revalidation detecting a file having |
diff --git a/fs/nfs/fscache.h b/fs/nfs/fscache.h index c5b11b53ff33..277b02782897 100644 --- a/fs/nfs/fscache.h +++ b/fs/nfs/fscache.h | |||
@@ -153,6 +153,22 @@ static inline void nfs_readpage_to_fscache(struct inode *inode, | |||
153 | } | 153 | } |
154 | 154 | ||
155 | /* | 155 | /* |
156 | * Invalidate the contents of fscache for this inode. This will not sleep. | ||
157 | */ | ||
158 | static inline void nfs_fscache_invalidate(struct inode *inode) | ||
159 | { | ||
160 | fscache_invalidate(NFS_I(inode)->fscache); | ||
161 | } | ||
162 | |||
163 | /* | ||
164 | * Wait for an object to finish being invalidated. | ||
165 | */ | ||
166 | static inline void nfs_fscache_wait_on_invalidate(struct inode *inode) | ||
167 | { | ||
168 | fscache_wait_on_invalidate(NFS_I(inode)->fscache); | ||
169 | } | ||
170 | |||
171 | /* | ||
156 | * indicate the client caching state as readable text | 172 | * indicate the client caching state as readable text |
157 | */ | 173 | */ |
158 | static inline const char *nfs_server_fscache_state(struct nfs_server *server) | 174 | static inline const char *nfs_server_fscache_state(struct nfs_server *server) |
@@ -162,7 +178,6 @@ static inline const char *nfs_server_fscache_state(struct nfs_server *server) | |||
162 | return "no "; | 178 | return "no "; |
163 | } | 179 | } |
164 | 180 | ||
165 | |||
166 | #else /* CONFIG_NFS_FSCACHE */ | 181 | #else /* CONFIG_NFS_FSCACHE */ |
167 | static inline int nfs_fscache_register(void) { return 0; } | 182 | static inline int nfs_fscache_register(void) { return 0; } |
168 | static inline void nfs_fscache_unregister(void) {} | 183 | static inline void nfs_fscache_unregister(void) {} |
@@ -205,6 +220,9 @@ static inline int nfs_readpages_from_fscache(struct nfs_open_context *ctx, | |||
205 | static inline void nfs_readpage_to_fscache(struct inode *inode, | 220 | static inline void nfs_readpage_to_fscache(struct inode *inode, |
206 | struct page *page, int sync) {} | 221 | struct page *page, int sync) {} |
207 | 222 | ||
223 | |||
224 | static inline void nfs_fscache_invalidate(struct inode *inode) {} | ||
225 | |||
208 | static inline const char *nfs_server_fscache_state(struct nfs_server *server) | 226 | static inline const char *nfs_server_fscache_state(struct nfs_server *server) |
209 | { | 227 | { |
210 | return "no "; | 228 | return "no "; |
diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c index 2faae14d89f4..ebeb94ce1b0b 100644 --- a/fs/nfs/inode.c +++ b/fs/nfs/inode.c | |||
@@ -161,10 +161,12 @@ static void nfs_zap_caches_locked(struct inode *inode) | |||
161 | nfsi->attrtimeo_timestamp = jiffies; | 161 | nfsi->attrtimeo_timestamp = jiffies; |
162 | 162 | ||
163 | memset(NFS_I(inode)->cookieverf, 0, sizeof(NFS_I(inode)->cookieverf)); | 163 | memset(NFS_I(inode)->cookieverf, 0, sizeof(NFS_I(inode)->cookieverf)); |
164 | if (S_ISREG(mode) || S_ISDIR(mode) || S_ISLNK(mode)) | 164 | if (S_ISREG(mode) || S_ISDIR(mode) || S_ISLNK(mode)) { |
165 | nfsi->cache_validity |= NFS_INO_INVALID_ATTR|NFS_INO_INVALID_DATA|NFS_INO_INVALID_ACCESS|NFS_INO_INVALID_ACL|NFS_INO_REVAL_PAGECACHE; | 165 | nfsi->cache_validity |= NFS_INO_INVALID_ATTR|NFS_INO_INVALID_DATA|NFS_INO_INVALID_ACCESS|NFS_INO_INVALID_ACL|NFS_INO_REVAL_PAGECACHE; |
166 | else | 166 | nfs_fscache_invalidate(inode); |
167 | } else { | ||
167 | nfsi->cache_validity |= NFS_INO_INVALID_ATTR|NFS_INO_INVALID_ACCESS|NFS_INO_INVALID_ACL|NFS_INO_REVAL_PAGECACHE; | 168 | nfsi->cache_validity |= NFS_INO_INVALID_ATTR|NFS_INO_INVALID_ACCESS|NFS_INO_INVALID_ACL|NFS_INO_REVAL_PAGECACHE; |
169 | } | ||
168 | } | 170 | } |
169 | 171 | ||
170 | void nfs_zap_caches(struct inode *inode) | 172 | void nfs_zap_caches(struct inode *inode) |
@@ -179,6 +181,7 @@ void nfs_zap_mapping(struct inode *inode, struct address_space *mapping) | |||
179 | if (mapping->nrpages != 0) { | 181 | if (mapping->nrpages != 0) { |
180 | spin_lock(&inode->i_lock); | 182 | spin_lock(&inode->i_lock); |
181 | NFS_I(inode)->cache_validity |= NFS_INO_INVALID_DATA; | 183 | NFS_I(inode)->cache_validity |= NFS_INO_INVALID_DATA; |
184 | nfs_fscache_invalidate(inode); | ||
182 | spin_unlock(&inode->i_lock); | 185 | spin_unlock(&inode->i_lock); |
183 | } | 186 | } |
184 | } | 187 | } |
@@ -881,7 +884,7 @@ static int nfs_invalidate_mapping(struct inode *inode, struct address_space *map | |||
881 | memset(nfsi->cookieverf, 0, sizeof(nfsi->cookieverf)); | 884 | memset(nfsi->cookieverf, 0, sizeof(nfsi->cookieverf)); |
882 | spin_unlock(&inode->i_lock); | 885 | spin_unlock(&inode->i_lock); |
883 | nfs_inc_stats(inode, NFSIOS_DATAINVALIDATE); | 886 | nfs_inc_stats(inode, NFSIOS_DATAINVALIDATE); |
884 | nfs_fscache_reset_inode_cookie(inode); | 887 | nfs_fscache_wait_on_invalidate(inode); |
885 | dfprintk(PAGECACHE, "NFS: (%s/%Ld) data cache invalidated\n", | 888 | dfprintk(PAGECACHE, "NFS: (%s/%Ld) data cache invalidated\n", |
886 | inode->i_sb->s_id, (long long)NFS_FILEID(inode)); | 889 | inode->i_sb->s_id, (long long)NFS_FILEID(inode)); |
887 | return 0; | 890 | return 0; |
@@ -957,6 +960,10 @@ static unsigned long nfs_wcc_update_inode(struct inode *inode, struct nfs_fattr | |||
957 | i_size_write(inode, nfs_size_to_loff_t(fattr->size)); | 960 | i_size_write(inode, nfs_size_to_loff_t(fattr->size)); |
958 | ret |= NFS_INO_INVALID_ATTR; | 961 | ret |= NFS_INO_INVALID_ATTR; |
959 | } | 962 | } |
963 | |||
964 | if (nfsi->cache_validity & NFS_INO_INVALID_DATA) | ||
965 | nfs_fscache_invalidate(inode); | ||
966 | |||
960 | return ret; | 967 | return ret; |
961 | } | 968 | } |
962 | 969 | ||
@@ -1205,8 +1212,10 @@ static int nfs_post_op_update_inode_locked(struct inode *inode, struct nfs_fattr | |||
1205 | struct nfs_inode *nfsi = NFS_I(inode); | 1212 | struct nfs_inode *nfsi = NFS_I(inode); |
1206 | 1213 | ||
1207 | nfsi->cache_validity |= NFS_INO_INVALID_ATTR|NFS_INO_REVAL_PAGECACHE; | 1214 | nfsi->cache_validity |= NFS_INO_INVALID_ATTR|NFS_INO_REVAL_PAGECACHE; |
1208 | if (S_ISDIR(inode->i_mode)) | 1215 | if (S_ISDIR(inode->i_mode)) { |
1209 | nfsi->cache_validity |= NFS_INO_INVALID_DATA; | 1216 | nfsi->cache_validity |= NFS_INO_INVALID_DATA; |
1217 | nfs_fscache_invalidate(inode); | ||
1218 | } | ||
1210 | if ((fattr->valid & NFS_ATTR_FATTR) == 0) | 1219 | if ((fattr->valid & NFS_ATTR_FATTR) == 0) |
1211 | return 0; | 1220 | return 0; |
1212 | return nfs_refresh_inode_locked(inode, fattr); | 1221 | return nfs_refresh_inode_locked(inode, fattr); |
@@ -1494,6 +1503,9 @@ static int nfs_update_inode(struct inode *inode, struct nfs_fattr *fattr) | |||
1494 | (save_cache_validity & NFS_INO_REVAL_FORCED)) | 1503 | (save_cache_validity & NFS_INO_REVAL_FORCED)) |
1495 | nfsi->cache_validity |= invalid; | 1504 | nfsi->cache_validity |= invalid; |
1496 | 1505 | ||
1506 | if (invalid & NFS_INO_INVALID_DATA) | ||
1507 | nfs_fscache_invalidate(inode); | ||
1508 | |||
1497 | return 0; | 1509 | return 0; |
1498 | out_err: | 1510 | out_err: |
1499 | /* | 1511 | /* |
diff --git a/fs/nfs/nfs4file.c b/fs/nfs/nfs4file.c index e7699308364a..08ddcccb8887 100644 --- a/fs/nfs/nfs4file.c +++ b/fs/nfs/nfs4file.c | |||
@@ -5,6 +5,7 @@ | |||
5 | */ | 5 | */ |
6 | #include <linux/nfs_fs.h> | 6 | #include <linux/nfs_fs.h> |
7 | #include "internal.h" | 7 | #include "internal.h" |
8 | #include "fscache.h" | ||
8 | #include "pnfs.h" | 9 | #include "pnfs.h" |
9 | 10 | ||
10 | #define NFSDBG_FACILITY NFSDBG_FILE | 11 | #define NFSDBG_FACILITY NFSDBG_FILE |
@@ -74,6 +75,7 @@ nfs4_file_open(struct inode *inode, struct file *filp) | |||
74 | 75 | ||
75 | nfs_set_verifier(dentry, nfs_save_change_attribute(dir)); | 76 | nfs_set_verifier(dentry, nfs_save_change_attribute(dir)); |
76 | nfs_file_set_open_context(filp, ctx); | 77 | nfs_file_set_open_context(filp, ctx); |
78 | nfs_fscache_set_inode_cookie(inode, filp); | ||
77 | err = 0; | 79 | err = 0; |
78 | 80 | ||
79 | out_put_ctx: | 81 | out_put_ctx: |
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index 493f0f41c554..5d864fb36578 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c | |||
@@ -64,7 +64,7 @@ | |||
64 | #include "pnfs.h" | 64 | #include "pnfs.h" |
65 | #include "netns.h" | 65 | #include "netns.h" |
66 | #include "nfs4session.h" | 66 | #include "nfs4session.h" |
67 | 67 | #include "fscache.h" | |
68 | 68 | ||
69 | #define NFSDBG_FACILITY NFSDBG_PROC | 69 | #define NFSDBG_FACILITY NFSDBG_PROC |
70 | 70 | ||
@@ -734,6 +734,7 @@ static void update_changeattr(struct inode *dir, struct nfs4_change_info *cinfo) | |||
734 | if (!cinfo->atomic || cinfo->before != dir->i_version) | 734 | if (!cinfo->atomic || cinfo->before != dir->i_version) |
735 | nfs_force_lookup_revalidate(dir); | 735 | nfs_force_lookup_revalidate(dir); |
736 | dir->i_version = cinfo->after; | 736 | dir->i_version = cinfo->after; |
737 | nfs_fscache_invalidate(dir); | ||
737 | spin_unlock(&dir->i_lock); | 738 | spin_unlock(&dir->i_lock); |
738 | } | 739 | } |
739 | 740 | ||
diff --git a/fs/nfs/write.c b/fs/nfs/write.c index 5209916e1222..b673be31590e 100644 --- a/fs/nfs/write.c +++ b/fs/nfs/write.c | |||
@@ -1794,7 +1794,8 @@ int nfs_migrate_page(struct address_space *mapping, struct page *newpage, | |||
1794 | if (PagePrivate(page)) | 1794 | if (PagePrivate(page)) |
1795 | return -EBUSY; | 1795 | return -EBUSY; |
1796 | 1796 | ||
1797 | nfs_fscache_release_page(page, GFP_KERNEL); | 1797 | if (!nfs_fscache_release_page(page, GFP_KERNEL)) |
1798 | return -EBUSY; | ||
1798 | 1799 | ||
1799 | return migrate_page(mapping, newpage, page, mode); | 1800 | return migrate_page(mapping, newpage, page, mode); |
1800 | } | 1801 | } |
@@ -61,33 +61,22 @@ int do_truncate(struct dentry *dentry, loff_t length, unsigned int time_attrs, | |||
61 | return ret; | 61 | return ret; |
62 | } | 62 | } |
63 | 63 | ||
64 | static long do_sys_truncate(const char __user *pathname, loff_t length) | 64 | long vfs_truncate(struct path *path, loff_t length) |
65 | { | 65 | { |
66 | struct path path; | ||
67 | struct inode *inode; | 66 | struct inode *inode; |
68 | int error; | 67 | long error; |
69 | |||
70 | error = -EINVAL; | ||
71 | if (length < 0) /* sorry, but loff_t says... */ | ||
72 | goto out; | ||
73 | 68 | ||
74 | error = user_path(pathname, &path); | 69 | inode = path->dentry->d_inode; |
75 | if (error) | ||
76 | goto out; | ||
77 | inode = path.dentry->d_inode; | ||
78 | 70 | ||
79 | /* For directories it's -EISDIR, for other non-regulars - -EINVAL */ | 71 | /* For directories it's -EISDIR, for other non-regulars - -EINVAL */ |
80 | error = -EISDIR; | ||
81 | if (S_ISDIR(inode->i_mode)) | 72 | if (S_ISDIR(inode->i_mode)) |
82 | goto dput_and_out; | 73 | return -EISDIR; |
83 | |||
84 | error = -EINVAL; | ||
85 | if (!S_ISREG(inode->i_mode)) | 74 | if (!S_ISREG(inode->i_mode)) |
86 | goto dput_and_out; | 75 | return -EINVAL; |
87 | 76 | ||
88 | error = mnt_want_write(path.mnt); | 77 | error = mnt_want_write(path->mnt); |
89 | if (error) | 78 | if (error) |
90 | goto dput_and_out; | 79 | goto out; |
91 | 80 | ||
92 | error = inode_permission(inode, MAY_WRITE); | 81 | error = inode_permission(inode, MAY_WRITE); |
93 | if (error) | 82 | if (error) |
@@ -111,19 +100,34 @@ static long do_sys_truncate(const char __user *pathname, loff_t length) | |||
111 | 100 | ||
112 | error = locks_verify_truncate(inode, NULL, length); | 101 | error = locks_verify_truncate(inode, NULL, length); |
113 | if (!error) | 102 | if (!error) |
114 | error = security_path_truncate(&path); | 103 | error = security_path_truncate(path); |
115 | if (!error) | 104 | if (!error) |
116 | error = do_truncate(path.dentry, length, 0, NULL); | 105 | error = do_truncate(path->dentry, length, 0, NULL); |
117 | 106 | ||
118 | put_write_and_out: | 107 | put_write_and_out: |
119 | put_write_access(inode); | 108 | put_write_access(inode); |
120 | mnt_drop_write_and_out: | 109 | mnt_drop_write_and_out: |
121 | mnt_drop_write(path.mnt); | 110 | mnt_drop_write(path->mnt); |
122 | dput_and_out: | ||
123 | path_put(&path); | ||
124 | out: | 111 | out: |
125 | return error; | 112 | return error; |
126 | } | 113 | } |
114 | EXPORT_SYMBOL_GPL(vfs_truncate); | ||
115 | |||
116 | static long do_sys_truncate(const char __user *pathname, loff_t length) | ||
117 | { | ||
118 | struct path path; | ||
119 | int error; | ||
120 | |||
121 | if (length < 0) /* sorry, but loff_t says... */ | ||
122 | return -EINVAL; | ||
123 | |||
124 | error = user_path(pathname, &path); | ||
125 | if (!error) { | ||
126 | error = vfs_truncate(&path, length); | ||
127 | path_put(&path); | ||
128 | } | ||
129 | return error; | ||
130 | } | ||
127 | 131 | ||
128 | SYSCALL_DEFINE2(truncate, const char __user *, path, long, length) | 132 | SYSCALL_DEFINE2(truncate, const char __user *, path, long, length) |
129 | { | 133 | { |
diff --git a/include/linux/dma-buf.h b/include/linux/dma-buf.h index eb48f3816df9..bd2e52ccc4f2 100644 --- a/include/linux/dma-buf.h +++ b/include/linux/dma-buf.h | |||
@@ -156,7 +156,6 @@ static inline void get_dma_buf(struct dma_buf *dmabuf) | |||
156 | get_file(dmabuf->file); | 156 | get_file(dmabuf->file); |
157 | } | 157 | } |
158 | 158 | ||
159 | #ifdef CONFIG_DMA_SHARED_BUFFER | ||
160 | struct dma_buf_attachment *dma_buf_attach(struct dma_buf *dmabuf, | 159 | struct dma_buf_attachment *dma_buf_attach(struct dma_buf *dmabuf, |
161 | struct device *dev); | 160 | struct device *dev); |
162 | void dma_buf_detach(struct dma_buf *dmabuf, | 161 | void dma_buf_detach(struct dma_buf *dmabuf, |
@@ -184,103 +183,5 @@ int dma_buf_mmap(struct dma_buf *, struct vm_area_struct *, | |||
184 | unsigned long); | 183 | unsigned long); |
185 | void *dma_buf_vmap(struct dma_buf *); | 184 | void *dma_buf_vmap(struct dma_buf *); |
186 | void dma_buf_vunmap(struct dma_buf *, void *vaddr); | 185 | void dma_buf_vunmap(struct dma_buf *, void *vaddr); |
187 | #else | ||
188 | |||
189 | static inline struct dma_buf_attachment *dma_buf_attach(struct dma_buf *dmabuf, | ||
190 | struct device *dev) | ||
191 | { | ||
192 | return ERR_PTR(-ENODEV); | ||
193 | } | ||
194 | |||
195 | static inline void dma_buf_detach(struct dma_buf *dmabuf, | ||
196 | struct dma_buf_attachment *dmabuf_attach) | ||
197 | { | ||
198 | return; | ||
199 | } | ||
200 | |||
201 | static inline struct dma_buf *dma_buf_export(void *priv, | ||
202 | const struct dma_buf_ops *ops, | ||
203 | size_t size, int flags) | ||
204 | { | ||
205 | return ERR_PTR(-ENODEV); | ||
206 | } | ||
207 | |||
208 | static inline int dma_buf_fd(struct dma_buf *dmabuf, int flags) | ||
209 | { | ||
210 | return -ENODEV; | ||
211 | } | ||
212 | |||
213 | static inline struct dma_buf *dma_buf_get(int fd) | ||
214 | { | ||
215 | return ERR_PTR(-ENODEV); | ||
216 | } | ||
217 | |||
218 | static inline void dma_buf_put(struct dma_buf *dmabuf) | ||
219 | { | ||
220 | return; | ||
221 | } | ||
222 | |||
223 | static inline struct sg_table *dma_buf_map_attachment( | ||
224 | struct dma_buf_attachment *attach, enum dma_data_direction write) | ||
225 | { | ||
226 | return ERR_PTR(-ENODEV); | ||
227 | } | ||
228 | |||
229 | static inline void dma_buf_unmap_attachment(struct dma_buf_attachment *attach, | ||
230 | struct sg_table *sg, enum dma_data_direction dir) | ||
231 | { | ||
232 | return; | ||
233 | } | ||
234 | |||
235 | static inline int dma_buf_begin_cpu_access(struct dma_buf *dmabuf, | ||
236 | size_t start, size_t len, | ||
237 | enum dma_data_direction dir) | ||
238 | { | ||
239 | return -ENODEV; | ||
240 | } | ||
241 | |||
242 | static inline void dma_buf_end_cpu_access(struct dma_buf *dmabuf, | ||
243 | size_t start, size_t len, | ||
244 | enum dma_data_direction dir) | ||
245 | { | ||
246 | } | ||
247 | |||
248 | static inline void *dma_buf_kmap_atomic(struct dma_buf *dmabuf, | ||
249 | unsigned long pnum) | ||
250 | { | ||
251 | return NULL; | ||
252 | } | ||
253 | |||
254 | static inline void dma_buf_kunmap_atomic(struct dma_buf *dmabuf, | ||
255 | unsigned long pnum, void *vaddr) | ||
256 | { | ||
257 | } | ||
258 | |||
259 | static inline void *dma_buf_kmap(struct dma_buf *dmabuf, unsigned long pnum) | ||
260 | { | ||
261 | return NULL; | ||
262 | } | ||
263 | |||
264 | static inline void dma_buf_kunmap(struct dma_buf *dmabuf, | ||
265 | unsigned long pnum, void *vaddr) | ||
266 | { | ||
267 | } | ||
268 | |||
269 | static inline int dma_buf_mmap(struct dma_buf *dmabuf, | ||
270 | struct vm_area_struct *vma, | ||
271 | unsigned long pgoff) | ||
272 | { | ||
273 | return -ENODEV; | ||
274 | } | ||
275 | |||
276 | static inline void *dma_buf_vmap(struct dma_buf *dmabuf) | ||
277 | { | ||
278 | return NULL; | ||
279 | } | ||
280 | |||
281 | static inline void dma_buf_vunmap(struct dma_buf *dmabuf, void *vaddr) | ||
282 | { | ||
283 | } | ||
284 | #endif /* CONFIG_DMA_SHARED_BUFFER */ | ||
285 | 186 | ||
286 | #endif /* __DMA_BUF_H__ */ | 187 | #endif /* __DMA_BUF_H__ */ |
diff --git a/include/linux/fs.h b/include/linux/fs.h index 05cd238ad941..7617ee04f066 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h | |||
@@ -1994,6 +1994,7 @@ struct filename { | |||
1994 | bool separate; /* should "name" be freed? */ | 1994 | bool separate; /* should "name" be freed? */ |
1995 | }; | 1995 | }; |
1996 | 1996 | ||
1997 | extern long vfs_truncate(struct path *, loff_t); | ||
1997 | extern int do_truncate(struct dentry *, loff_t start, unsigned int time_attrs, | 1998 | extern int do_truncate(struct dentry *, loff_t start, unsigned int time_attrs, |
1998 | struct file *filp); | 1999 | struct file *filp); |
1999 | extern int do_fallocate(struct file *file, int mode, loff_t offset, | 2000 | extern int do_fallocate(struct file *file, int mode, loff_t offset, |
diff --git a/include/linux/fscache-cache.h b/include/linux/fscache-cache.h index ce31408b1e47..5dfa0aa216b6 100644 --- a/include/linux/fscache-cache.h +++ b/include/linux/fscache-cache.h | |||
@@ -75,6 +75,16 @@ extern wait_queue_head_t fscache_cache_cleared_wq; | |||
75 | typedef void (*fscache_operation_release_t)(struct fscache_operation *op); | 75 | typedef void (*fscache_operation_release_t)(struct fscache_operation *op); |
76 | typedef void (*fscache_operation_processor_t)(struct fscache_operation *op); | 76 | typedef void (*fscache_operation_processor_t)(struct fscache_operation *op); |
77 | 77 | ||
78 | enum fscache_operation_state { | ||
79 | FSCACHE_OP_ST_BLANK, /* Op is not yet submitted */ | ||
80 | FSCACHE_OP_ST_INITIALISED, /* Op is initialised */ | ||
81 | FSCACHE_OP_ST_PENDING, /* Op is blocked from running */ | ||
82 | FSCACHE_OP_ST_IN_PROGRESS, /* Op is in progress */ | ||
83 | FSCACHE_OP_ST_COMPLETE, /* Op is complete */ | ||
84 | FSCACHE_OP_ST_CANCELLED, /* Op has been cancelled */ | ||
85 | FSCACHE_OP_ST_DEAD /* Op is now dead */ | ||
86 | }; | ||
87 | |||
78 | struct fscache_operation { | 88 | struct fscache_operation { |
79 | struct work_struct work; /* record for async ops */ | 89 | struct work_struct work; /* record for async ops */ |
80 | struct list_head pend_link; /* link in object->pending_ops */ | 90 | struct list_head pend_link; /* link in object->pending_ops */ |
@@ -86,10 +96,10 @@ struct fscache_operation { | |||
86 | #define FSCACHE_OP_MYTHREAD 0x0002 /* - processing is done be issuing thread, not pool */ | 96 | #define FSCACHE_OP_MYTHREAD 0x0002 /* - processing is done be issuing thread, not pool */ |
87 | #define FSCACHE_OP_WAITING 4 /* cleared when op is woken */ | 97 | #define FSCACHE_OP_WAITING 4 /* cleared when op is woken */ |
88 | #define FSCACHE_OP_EXCLUSIVE 5 /* exclusive op, other ops must wait */ | 98 | #define FSCACHE_OP_EXCLUSIVE 5 /* exclusive op, other ops must wait */ |
89 | #define FSCACHE_OP_DEAD 6 /* op is now dead */ | 99 | #define FSCACHE_OP_DEC_READ_CNT 6 /* decrement object->n_reads on destruction */ |
90 | #define FSCACHE_OP_DEC_READ_CNT 7 /* decrement object->n_reads on destruction */ | 100 | #define FSCACHE_OP_KEEP_FLAGS 0x0070 /* flags to keep when repurposing an op */ |
91 | #define FSCACHE_OP_KEEP_FLAGS 0xc0 /* flags to keep when repurposing an op */ | ||
92 | 101 | ||
102 | enum fscache_operation_state state; | ||
93 | atomic_t usage; | 103 | atomic_t usage; |
94 | unsigned debug_id; /* debugging ID */ | 104 | unsigned debug_id; /* debugging ID */ |
95 | 105 | ||
@@ -106,6 +116,7 @@ extern atomic_t fscache_op_debug_id; | |||
106 | extern void fscache_op_work_func(struct work_struct *work); | 116 | extern void fscache_op_work_func(struct work_struct *work); |
107 | 117 | ||
108 | extern void fscache_enqueue_operation(struct fscache_operation *); | 118 | extern void fscache_enqueue_operation(struct fscache_operation *); |
119 | extern void fscache_op_complete(struct fscache_operation *, bool); | ||
109 | extern void fscache_put_operation(struct fscache_operation *); | 120 | extern void fscache_put_operation(struct fscache_operation *); |
110 | 121 | ||
111 | /** | 122 | /** |
@@ -122,6 +133,7 @@ static inline void fscache_operation_init(struct fscache_operation *op, | |||
122 | { | 133 | { |
123 | INIT_WORK(&op->work, fscache_op_work_func); | 134 | INIT_WORK(&op->work, fscache_op_work_func); |
124 | atomic_set(&op->usage, 1); | 135 | atomic_set(&op->usage, 1); |
136 | op->state = FSCACHE_OP_ST_INITIALISED; | ||
125 | op->debug_id = atomic_inc_return(&fscache_op_debug_id); | 137 | op->debug_id = atomic_inc_return(&fscache_op_debug_id); |
126 | op->processor = processor; | 138 | op->processor = processor; |
127 | op->release = release; | 139 | op->release = release; |
@@ -138,6 +150,7 @@ struct fscache_retrieval { | |||
138 | void *context; /* netfs read context (pinned) */ | 150 | void *context; /* netfs read context (pinned) */ |
139 | struct list_head to_do; /* list of things to be done by the backend */ | 151 | struct list_head to_do; /* list of things to be done by the backend */ |
140 | unsigned long start_time; /* time at which retrieval started */ | 152 | unsigned long start_time; /* time at which retrieval started */ |
153 | unsigned n_pages; /* number of pages to be retrieved */ | ||
141 | }; | 154 | }; |
142 | 155 | ||
143 | typedef int (*fscache_page_retrieval_func_t)(struct fscache_retrieval *op, | 156 | typedef int (*fscache_page_retrieval_func_t)(struct fscache_retrieval *op, |
@@ -174,8 +187,22 @@ static inline void fscache_enqueue_retrieval(struct fscache_retrieval *op) | |||
174 | } | 187 | } |
175 | 188 | ||
176 | /** | 189 | /** |
190 | * fscache_retrieval_complete - Record (partial) completion of a retrieval | ||
191 | * @op: The retrieval operation affected | ||
192 | * @n_pages: The number of pages to account for | ||
193 | */ | ||
194 | static inline void fscache_retrieval_complete(struct fscache_retrieval *op, | ||
195 | int n_pages) | ||
196 | { | ||
197 | op->n_pages -= n_pages; | ||
198 | if (op->n_pages <= 0) | ||
199 | fscache_op_complete(&op->op, true); | ||
200 | } | ||
201 | |||
202 | /** | ||
177 | * fscache_put_retrieval - Drop a reference to a retrieval operation | 203 | * fscache_put_retrieval - Drop a reference to a retrieval operation |
178 | * @op: The retrieval operation affected | 204 | * @op: The retrieval operation affected |
205 | * @n_pages: The number of pages to account for | ||
179 | * | 206 | * |
180 | * Drop a reference to a retrieval operation. | 207 | * Drop a reference to a retrieval operation. |
181 | */ | 208 | */ |
@@ -227,6 +254,9 @@ struct fscache_cache_ops { | |||
227 | /* store the updated auxiliary data on an object */ | 254 | /* store the updated auxiliary data on an object */ |
228 | void (*update_object)(struct fscache_object *object); | 255 | void (*update_object)(struct fscache_object *object); |
229 | 256 | ||
257 | /* Invalidate an object */ | ||
258 | void (*invalidate_object)(struct fscache_operation *op); | ||
259 | |||
230 | /* discard the resources pinned by an object and effect retirement if | 260 | /* discard the resources pinned by an object and effect retirement if |
231 | * necessary */ | 261 | * necessary */ |
232 | void (*drop_object)(struct fscache_object *object); | 262 | void (*drop_object)(struct fscache_object *object); |
@@ -301,11 +331,30 @@ struct fscache_cookie { | |||
301 | #define FSCACHE_COOKIE_PENDING_FILL 3 /* T if pending initial fill on object */ | 331 | #define FSCACHE_COOKIE_PENDING_FILL 3 /* T if pending initial fill on object */ |
302 | #define FSCACHE_COOKIE_FILLING 4 /* T if filling object incrementally */ | 332 | #define FSCACHE_COOKIE_FILLING 4 /* T if filling object incrementally */ |
303 | #define FSCACHE_COOKIE_UNAVAILABLE 5 /* T if cookie is unavailable (error, etc) */ | 333 | #define FSCACHE_COOKIE_UNAVAILABLE 5 /* T if cookie is unavailable (error, etc) */ |
334 | #define FSCACHE_COOKIE_WAITING_ON_READS 6 /* T if cookie is waiting on reads */ | ||
335 | #define FSCACHE_COOKIE_INVALIDATING 7 /* T if cookie is being invalidated */ | ||
304 | }; | 336 | }; |
305 | 337 | ||
306 | extern struct fscache_cookie fscache_fsdef_index; | 338 | extern struct fscache_cookie fscache_fsdef_index; |
307 | 339 | ||
308 | /* | 340 | /* |
341 | * Event list for fscache_object::{event_mask,events} | ||
342 | */ | ||
343 | enum { | ||
344 | FSCACHE_OBJECT_EV_REQUEUE, /* T if object should be requeued */ | ||
345 | FSCACHE_OBJECT_EV_UPDATE, /* T if object should be updated */ | ||
346 | FSCACHE_OBJECT_EV_INVALIDATE, /* T if cache requested object invalidation */ | ||
347 | FSCACHE_OBJECT_EV_CLEARED, /* T if accessors all gone */ | ||
348 | FSCACHE_OBJECT_EV_ERROR, /* T if fatal error occurred during processing */ | ||
349 | FSCACHE_OBJECT_EV_RELEASE, /* T if netfs requested object release */ | ||
350 | FSCACHE_OBJECT_EV_RETIRE, /* T if netfs requested object retirement */ | ||
351 | FSCACHE_OBJECT_EV_WITHDRAW, /* T if cache requested object withdrawal */ | ||
352 | NR_FSCACHE_OBJECT_EVENTS | ||
353 | }; | ||
354 | |||
355 | #define FSCACHE_OBJECT_EVENTS_MASK ((1UL << NR_FSCACHE_OBJECT_EVENTS) - 1) | ||
356 | |||
357 | /* | ||
309 | * on-disk cache file or index handle | 358 | * on-disk cache file or index handle |
310 | */ | 359 | */ |
311 | struct fscache_object { | 360 | struct fscache_object { |
@@ -317,6 +366,7 @@ struct fscache_object { | |||
317 | /* active states */ | 366 | /* active states */ |
318 | FSCACHE_OBJECT_AVAILABLE, /* cleaning up object after creation */ | 367 | FSCACHE_OBJECT_AVAILABLE, /* cleaning up object after creation */ |
319 | FSCACHE_OBJECT_ACTIVE, /* object is usable */ | 368 | FSCACHE_OBJECT_ACTIVE, /* object is usable */ |
369 | FSCACHE_OBJECT_INVALIDATING, /* object is invalidating */ | ||
320 | FSCACHE_OBJECT_UPDATING, /* object is updating */ | 370 | FSCACHE_OBJECT_UPDATING, /* object is updating */ |
321 | 371 | ||
322 | /* terminal states */ | 372 | /* terminal states */ |
@@ -332,10 +382,10 @@ struct fscache_object { | |||
332 | 382 | ||
333 | int debug_id; /* debugging ID */ | 383 | int debug_id; /* debugging ID */ |
334 | int n_children; /* number of child objects */ | 384 | int n_children; /* number of child objects */ |
335 | int n_ops; /* number of ops outstanding on object */ | 385 | int n_ops; /* number of extant ops on object */ |
336 | int n_obj_ops; /* number of object ops outstanding on object */ | 386 | int n_obj_ops; /* number of object ops outstanding on object */ |
337 | int n_in_progress; /* number of ops in progress */ | 387 | int n_in_progress; /* number of ops in progress */ |
338 | int n_exclusive; /* number of exclusive ops queued */ | 388 | int n_exclusive; /* number of exclusive ops queued or in progress */ |
339 | atomic_t n_reads; /* number of read ops in progress */ | 389 | atomic_t n_reads; /* number of read ops in progress */ |
340 | spinlock_t lock; /* state and operations lock */ | 390 | spinlock_t lock; /* state and operations lock */ |
341 | 391 | ||
@@ -343,14 +393,6 @@ struct fscache_object { | |||
343 | unsigned long event_mask; /* events this object is interested in */ | 393 | unsigned long event_mask; /* events this object is interested in */ |
344 | unsigned long events; /* events to be processed by this object | 394 | unsigned long events; /* events to be processed by this object |
345 | * (order is important - using fls) */ | 395 | * (order is important - using fls) */ |
346 | #define FSCACHE_OBJECT_EV_REQUEUE 0 /* T if object should be requeued */ | ||
347 | #define FSCACHE_OBJECT_EV_UPDATE 1 /* T if object should be updated */ | ||
348 | #define FSCACHE_OBJECT_EV_CLEARED 2 /* T if accessors all gone */ | ||
349 | #define FSCACHE_OBJECT_EV_ERROR 3 /* T if fatal error occurred during processing */ | ||
350 | #define FSCACHE_OBJECT_EV_RELEASE 4 /* T if netfs requested object release */ | ||
351 | #define FSCACHE_OBJECT_EV_RETIRE 5 /* T if netfs requested object retirement */ | ||
352 | #define FSCACHE_OBJECT_EV_WITHDRAW 6 /* T if cache requested object withdrawal */ | ||
353 | #define FSCACHE_OBJECT_EVENTS_MASK 0x7f /* mask of all events*/ | ||
354 | 396 | ||
355 | unsigned long flags; | 397 | unsigned long flags; |
356 | #define FSCACHE_OBJECT_LOCK 0 /* T if object is busy being processed */ | 398 | #define FSCACHE_OBJECT_LOCK 0 /* T if object is busy being processed */ |
@@ -504,6 +546,9 @@ extern void fscache_withdraw_cache(struct fscache_cache *cache); | |||
504 | 546 | ||
505 | extern void fscache_io_error(struct fscache_cache *cache); | 547 | extern void fscache_io_error(struct fscache_cache *cache); |
506 | 548 | ||
549 | extern void fscache_mark_page_cached(struct fscache_retrieval *op, | ||
550 | struct page *page); | ||
551 | |||
507 | extern void fscache_mark_pages_cached(struct fscache_retrieval *op, | 552 | extern void fscache_mark_pages_cached(struct fscache_retrieval *op, |
508 | struct pagevec *pagevec); | 553 | struct pagevec *pagevec); |
509 | 554 | ||
diff --git a/include/linux/fscache.h b/include/linux/fscache.h index 9ec20dec3353..7a086235da4b 100644 --- a/include/linux/fscache.h +++ b/include/linux/fscache.h | |||
@@ -135,14 +135,14 @@ struct fscache_cookie_def { | |||
135 | */ | 135 | */ |
136 | void (*put_context)(void *cookie_netfs_data, void *context); | 136 | void (*put_context)(void *cookie_netfs_data, void *context); |
137 | 137 | ||
138 | /* indicate pages that now have cache metadata retained | 138 | /* indicate page that now have cache metadata retained |
139 | * - this function should mark the specified pages as now being cached | 139 | * - this function should mark the specified page as now being cached |
140 | * - the pages will have been marked with PG_fscache before this is | 140 | * - the page will have been marked with PG_fscache before this is |
141 | * called, so this is optional | 141 | * called, so this is optional |
142 | */ | 142 | */ |
143 | void (*mark_pages_cached)(void *cookie_netfs_data, | 143 | void (*mark_page_cached)(void *cookie_netfs_data, |
144 | struct address_space *mapping, | 144 | struct address_space *mapping, |
145 | struct pagevec *cached_pvec); | 145 | struct page *page); |
146 | 146 | ||
147 | /* indicate the cookie is no longer cached | 147 | /* indicate the cookie is no longer cached |
148 | * - this function is called when the backing store currently caching | 148 | * - this function is called when the backing store currently caching |
@@ -185,6 +185,8 @@ extern struct fscache_cookie *__fscache_acquire_cookie( | |||
185 | extern void __fscache_relinquish_cookie(struct fscache_cookie *, int); | 185 | extern void __fscache_relinquish_cookie(struct fscache_cookie *, int); |
186 | extern void __fscache_update_cookie(struct fscache_cookie *); | 186 | extern void __fscache_update_cookie(struct fscache_cookie *); |
187 | extern int __fscache_attr_changed(struct fscache_cookie *); | 187 | extern int __fscache_attr_changed(struct fscache_cookie *); |
188 | extern void __fscache_invalidate(struct fscache_cookie *); | ||
189 | extern void __fscache_wait_on_invalidate(struct fscache_cookie *); | ||
188 | extern int __fscache_read_or_alloc_page(struct fscache_cookie *, | 190 | extern int __fscache_read_or_alloc_page(struct fscache_cookie *, |
189 | struct page *, | 191 | struct page *, |
190 | fscache_rw_complete_t, | 192 | fscache_rw_complete_t, |
@@ -390,6 +392,42 @@ int fscache_attr_changed(struct fscache_cookie *cookie) | |||
390 | } | 392 | } |
391 | 393 | ||
392 | /** | 394 | /** |
395 | * fscache_invalidate - Notify cache that an object needs invalidation | ||
396 | * @cookie: The cookie representing the cache object | ||
397 | * | ||
398 | * Notify the cache that an object is needs to be invalidated and that it | ||
399 | * should abort any retrievals or stores it is doing on the cache. The object | ||
400 | * is then marked non-caching until such time as the invalidation is complete. | ||
401 | * | ||
402 | * This can be called with spinlocks held. | ||
403 | * | ||
404 | * See Documentation/filesystems/caching/netfs-api.txt for a complete | ||
405 | * description. | ||
406 | */ | ||
407 | static inline | ||
408 | void fscache_invalidate(struct fscache_cookie *cookie) | ||
409 | { | ||
410 | if (fscache_cookie_valid(cookie)) | ||
411 | __fscache_invalidate(cookie); | ||
412 | } | ||
413 | |||
414 | /** | ||
415 | * fscache_wait_on_invalidate - Wait for invalidation to complete | ||
416 | * @cookie: The cookie representing the cache object | ||
417 | * | ||
418 | * Wait for the invalidation of an object to complete. | ||
419 | * | ||
420 | * See Documentation/filesystems/caching/netfs-api.txt for a complete | ||
421 | * description. | ||
422 | */ | ||
423 | static inline | ||
424 | void fscache_wait_on_invalidate(struct fscache_cookie *cookie) | ||
425 | { | ||
426 | if (fscache_cookie_valid(cookie)) | ||
427 | __fscache_wait_on_invalidate(cookie); | ||
428 | } | ||
429 | |||
430 | /** | ||
393 | * fscache_reserve_space - Reserve data space for a cached object | 431 | * fscache_reserve_space - Reserve data space for a cached object |
394 | * @cookie: The cookie representing the cache object | 432 | * @cookie: The cookie representing the cache object |
395 | * @i_size: The amount of space to be reserved | 433 | * @i_size: The amount of space to be reserved |
diff --git a/arch/arm/plat-omap/include/plat/omap-serial.h b/include/linux/platform_data/serial-omap.h index ff9b0aab5281..ff9b0aab5281 100644 --- a/arch/arm/plat-omap/include/plat/omap-serial.h +++ b/include/linux/platform_data/serial-omap.h | |||
diff --git a/include/linux/platform_data/usb-omap.h b/include/linux/platform_data/usb-omap.h index 8570bcfe6311..ef65b67c56c3 100644 --- a/include/linux/platform_data/usb-omap.h +++ b/include/linux/platform_data/usb-omap.h | |||
@@ -59,6 +59,9 @@ struct usbhs_omap_platform_data { | |||
59 | 59 | ||
60 | struct ehci_hcd_omap_platform_data *ehci_data; | 60 | struct ehci_hcd_omap_platform_data *ehci_data; |
61 | struct ohci_hcd_omap_platform_data *ohci_data; | 61 | struct ohci_hcd_omap_platform_data *ohci_data; |
62 | |||
63 | /* OMAP3 <= ES2.1 have a single ulpi bypass control bit */ | ||
64 | unsigned single_ulpi_bypass:1; | ||
62 | }; | 65 | }; |
63 | 66 | ||
64 | /*-------------------------------------------------------------------------*/ | 67 | /*-------------------------------------------------------------------------*/ |
diff --git a/include/linux/virtio.h b/include/linux/virtio.h index 533b1157f22e..cf8adb1f5b2c 100644 --- a/include/linux/virtio.h +++ b/include/linux/virtio.h | |||
@@ -16,12 +16,20 @@ | |||
16 | * @name: the name of this virtqueue (mainly for debugging) | 16 | * @name: the name of this virtqueue (mainly for debugging) |
17 | * @vdev: the virtio device this queue was created for. | 17 | * @vdev: the virtio device this queue was created for. |
18 | * @priv: a pointer for the virtqueue implementation to use. | 18 | * @priv: a pointer for the virtqueue implementation to use. |
19 | * @index: the zero-based ordinal number for this queue. | ||
20 | * @num_free: number of elements we expect to be able to fit. | ||
21 | * | ||
22 | * A note on @num_free: with indirect buffers, each buffer needs one | ||
23 | * element in the queue, otherwise a buffer will need one element per | ||
24 | * sg element. | ||
19 | */ | 25 | */ |
20 | struct virtqueue { | 26 | struct virtqueue { |
21 | struct list_head list; | 27 | struct list_head list; |
22 | void (*callback)(struct virtqueue *vq); | 28 | void (*callback)(struct virtqueue *vq); |
23 | const char *name; | 29 | const char *name; |
24 | struct virtio_device *vdev; | 30 | struct virtio_device *vdev; |
31 | unsigned int index; | ||
32 | unsigned int num_free; | ||
25 | void *priv; | 33 | void *priv; |
26 | }; | 34 | }; |
27 | 35 | ||
@@ -50,7 +58,11 @@ void *virtqueue_detach_unused_buf(struct virtqueue *vq); | |||
50 | 58 | ||
51 | unsigned int virtqueue_get_vring_size(struct virtqueue *vq); | 59 | unsigned int virtqueue_get_vring_size(struct virtqueue *vq); |
52 | 60 | ||
53 | int virtqueue_get_queue_index(struct virtqueue *vq); | 61 | /* FIXME: Obsolete accessor, but required for virtio_net merge. */ |
62 | static inline unsigned int virtqueue_get_queue_index(struct virtqueue *vq) | ||
63 | { | ||
64 | return vq->index; | ||
65 | } | ||
54 | 66 | ||
55 | /** | 67 | /** |
56 | * virtio_device - representation of a device using virtio | 68 | * virtio_device - representation of a device using virtio |
@@ -73,7 +85,11 @@ struct virtio_device { | |||
73 | void *priv; | 85 | void *priv; |
74 | }; | 86 | }; |
75 | 87 | ||
76 | #define dev_to_virtio(dev) container_of(dev, struct virtio_device, dev) | 88 | static inline struct virtio_device *dev_to_virtio(struct device *_dev) |
89 | { | ||
90 | return container_of(_dev, struct virtio_device, dev); | ||
91 | } | ||
92 | |||
77 | int register_virtio_device(struct virtio_device *dev); | 93 | int register_virtio_device(struct virtio_device *dev); |
78 | void unregister_virtio_device(struct virtio_device *dev); | 94 | void unregister_virtio_device(struct virtio_device *dev); |
79 | 95 | ||
@@ -103,6 +119,11 @@ struct virtio_driver { | |||
103 | #endif | 119 | #endif |
104 | }; | 120 | }; |
105 | 121 | ||
122 | static inline struct virtio_driver *drv_to_virtio(struct device_driver *drv) | ||
123 | { | ||
124 | return container_of(drv, struct virtio_driver, driver); | ||
125 | } | ||
126 | |||
106 | int register_virtio_driver(struct virtio_driver *drv); | 127 | int register_virtio_driver(struct virtio_driver *drv); |
107 | void unregister_virtio_driver(struct virtio_driver *drv); | 128 | void unregister_virtio_driver(struct virtio_driver *drv); |
108 | #endif /* _LINUX_VIRTIO_H */ | 129 | #endif /* _LINUX_VIRTIO_H */ |
diff --git a/include/linux/virtio_scsi.h b/include/linux/virtio_scsi.h index d6b4440387b7..4195b97a3def 100644 --- a/include/linux/virtio_scsi.h +++ b/include/linux/virtio_scsi.h | |||
@@ -1,7 +1,31 @@ | |||
1 | /* | ||
2 | * This header is BSD licensed so anyone can use the definitions to implement | ||
3 | * compatible drivers/servers. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions | ||
7 | * are met: | ||
8 | * 1. Redistributions of source code must retain the above copyright | ||
9 | * notice, this list of conditions and the following disclaimer. | ||
10 | * 2. Redistributions in binary form must reproduce the above copyright | ||
11 | * notice, this list of conditions and the following disclaimer in the | ||
12 | * documentation and/or other materials provided with the distribution. | ||
13 | * | ||
14 | * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND | ||
15 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
16 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
17 | * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE | ||
18 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
19 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
20 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
21 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
22 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
23 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
24 | * SUCH DAMAGE. | ||
25 | */ | ||
26 | |||
1 | #ifndef _LINUX_VIRTIO_SCSI_H | 27 | #ifndef _LINUX_VIRTIO_SCSI_H |
2 | #define _LINUX_VIRTIO_SCSI_H | 28 | #define _LINUX_VIRTIO_SCSI_H |
3 | /* This header is BSD licensed so anyone can use the definitions to implement | ||
4 | * compatible drivers/servers. */ | ||
5 | 29 | ||
6 | #define VIRTIO_SCSI_CDB_SIZE 32 | 30 | #define VIRTIO_SCSI_CDB_SIZE 32 |
7 | #define VIRTIO_SCSI_SENSE_SIZE 96 | 31 | #define VIRTIO_SCSI_SENSE_SIZE 96 |
diff --git a/include/sound/soc-dai.h b/include/sound/soc-dai.h index 628db7bca4fd..3953cea0ecfb 100644 --- a/include/sound/soc-dai.h +++ b/include/sound/soc-dai.h | |||
@@ -242,7 +242,6 @@ struct snd_soc_dai { | |||
242 | unsigned int symmetric_rates:1; | 242 | unsigned int symmetric_rates:1; |
243 | struct snd_pcm_runtime *runtime; | 243 | struct snd_pcm_runtime *runtime; |
244 | unsigned int active; | 244 | unsigned int active; |
245 | unsigned char pop_wait:1; | ||
246 | unsigned char probed:1; | 245 | unsigned char probed:1; |
247 | 246 | ||
248 | struct snd_soc_dapm_widget *playback_widget; | 247 | struct snd_soc_dapm_widget *playback_widget; |
diff --git a/include/sound/soc.h b/include/sound/soc.h index 91244a096c19..769e27c774a3 100644 --- a/include/sound/soc.h +++ b/include/sound/soc.h | |||
@@ -1039,6 +1039,7 @@ struct snd_soc_pcm_runtime { | |||
1039 | struct snd_soc_dpcm_runtime dpcm[2]; | 1039 | struct snd_soc_dpcm_runtime dpcm[2]; |
1040 | 1040 | ||
1041 | long pmdown_time; | 1041 | long pmdown_time; |
1042 | unsigned char pop_wait:1; | ||
1042 | 1043 | ||
1043 | /* runtime devices */ | 1044 | /* runtime devices */ |
1044 | struct snd_pcm *pcm; | 1045 | struct snd_pcm *pcm; |
diff --git a/include/uapi/linux/virtio_ids.h b/include/uapi/linux/virtio_ids.h index 270fb22c5811..a7630d04029f 100644 --- a/include/uapi/linux/virtio_ids.h +++ b/include/uapi/linux/virtio_ids.h | |||
@@ -37,5 +37,6 @@ | |||
37 | #define VIRTIO_ID_RPMSG 7 /* virtio remote processor messaging */ | 37 | #define VIRTIO_ID_RPMSG 7 /* virtio remote processor messaging */ |
38 | #define VIRTIO_ID_SCSI 8 /* virtio scsi */ | 38 | #define VIRTIO_ID_SCSI 8 /* virtio scsi */ |
39 | #define VIRTIO_ID_9P 9 /* 9p virtio console */ | 39 | #define VIRTIO_ID_9P 9 /* 9p virtio console */ |
40 | #define VIRTIO_ID_RPROC_SERIAL 11 /* virtio remoteproc serial link */ | ||
40 | 41 | ||
41 | #endif /* _LINUX_VIRTIO_IDS_H */ | 42 | #endif /* _LINUX_VIRTIO_IDS_H */ |
diff --git a/include/video/omap-panel-tfp410.h b/include/video/omap-panel-tfp410.h index 68c31d79c571..aef35e48bc7e 100644 --- a/include/video/omap-panel-tfp410.h +++ b/include/video/omap-panel-tfp410.h | |||
@@ -28,7 +28,7 @@ struct omap_dss_device; | |||
28 | * @power_down_gpio: gpio number for PD pin (or -1 if not available) | 28 | * @power_down_gpio: gpio number for PD pin (or -1 if not available) |
29 | */ | 29 | */ |
30 | struct tfp410_platform_data { | 30 | struct tfp410_platform_data { |
31 | u16 i2c_bus_num; | 31 | int i2c_bus_num; |
32 | int power_down_gpio; | 32 | int power_down_gpio; |
33 | }; | 33 | }; |
34 | 34 | ||
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 4603d6cb9e25..5eea8707234a 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c | |||
@@ -793,8 +793,11 @@ unsigned int sysctl_numa_balancing_scan_delay = 1000; | |||
793 | 793 | ||
794 | static void task_numa_placement(struct task_struct *p) | 794 | static void task_numa_placement(struct task_struct *p) |
795 | { | 795 | { |
796 | int seq = ACCESS_ONCE(p->mm->numa_scan_seq); | 796 | int seq; |
797 | 797 | ||
798 | if (!p->mm) /* for example, ksmd faulting in a user's mm */ | ||
799 | return; | ||
800 | seq = ACCESS_ONCE(p->mm->numa_scan_seq); | ||
798 | if (p->numa_scan_seq == seq) | 801 | if (p->numa_scan_seq == seq) |
799 | return; | 802 | return; |
800 | p->numa_scan_seq = seq; | 803 | p->numa_scan_seq = seq; |
diff --git a/mm/highmem.c b/mm/highmem.c index d999077431df..b32b70cdaed6 100644 --- a/mm/highmem.c +++ b/mm/highmem.c | |||
@@ -105,6 +105,7 @@ struct page *kmap_to_page(void *vaddr) | |||
105 | 105 | ||
106 | return virt_to_page(addr); | 106 | return virt_to_page(addr); |
107 | } | 107 | } |
108 | EXPORT_SYMBOL(kmap_to_page); | ||
108 | 109 | ||
109 | static void flush_all_zero_pkmaps(void) | 110 | static void flush_all_zero_pkmaps(void) |
110 | { | 111 | { |
@@ -1624,7 +1624,7 @@ again: | |||
1624 | struct anon_vma_chain *vmac; | 1624 | struct anon_vma_chain *vmac; |
1625 | struct vm_area_struct *vma; | 1625 | struct vm_area_struct *vma; |
1626 | 1626 | ||
1627 | anon_vma_lock_write(anon_vma); | 1627 | anon_vma_lock_read(anon_vma); |
1628 | anon_vma_interval_tree_foreach(vmac, &anon_vma->rb_root, | 1628 | anon_vma_interval_tree_foreach(vmac, &anon_vma->rb_root, |
1629 | 0, ULONG_MAX) { | 1629 | 0, ULONG_MAX) { |
1630 | vma = vmac->vma; | 1630 | vma = vmac->vma; |
@@ -1648,7 +1648,7 @@ again: | |||
1648 | if (!search_new_forks || !mapcount) | 1648 | if (!search_new_forks || !mapcount) |
1649 | break; | 1649 | break; |
1650 | } | 1650 | } |
1651 | anon_vma_unlock(anon_vma); | 1651 | anon_vma_unlock_read(anon_vma); |
1652 | if (!mapcount) | 1652 | if (!mapcount) |
1653 | goto out; | 1653 | goto out; |
1654 | } | 1654 | } |
@@ -1678,7 +1678,7 @@ again: | |||
1678 | struct anon_vma_chain *vmac; | 1678 | struct anon_vma_chain *vmac; |
1679 | struct vm_area_struct *vma; | 1679 | struct vm_area_struct *vma; |
1680 | 1680 | ||
1681 | anon_vma_lock_write(anon_vma); | 1681 | anon_vma_lock_read(anon_vma); |
1682 | anon_vma_interval_tree_foreach(vmac, &anon_vma->rb_root, | 1682 | anon_vma_interval_tree_foreach(vmac, &anon_vma->rb_root, |
1683 | 0, ULONG_MAX) { | 1683 | 0, ULONG_MAX) { |
1684 | vma = vmac->vma; | 1684 | vma = vmac->vma; |
@@ -1697,11 +1697,11 @@ again: | |||
1697 | ret = try_to_unmap_one(page, vma, | 1697 | ret = try_to_unmap_one(page, vma, |
1698 | rmap_item->address, flags); | 1698 | rmap_item->address, flags); |
1699 | if (ret != SWAP_AGAIN || !page_mapped(page)) { | 1699 | if (ret != SWAP_AGAIN || !page_mapped(page)) { |
1700 | anon_vma_unlock(anon_vma); | 1700 | anon_vma_unlock_read(anon_vma); |
1701 | goto out; | 1701 | goto out; |
1702 | } | 1702 | } |
1703 | } | 1703 | } |
1704 | anon_vma_unlock(anon_vma); | 1704 | anon_vma_unlock_read(anon_vma); |
1705 | } | 1705 | } |
1706 | if (!search_new_forks++) | 1706 | if (!search_new_forks++) |
1707 | goto again; | 1707 | goto again; |
@@ -1731,7 +1731,7 @@ again: | |||
1731 | struct anon_vma_chain *vmac; | 1731 | struct anon_vma_chain *vmac; |
1732 | struct vm_area_struct *vma; | 1732 | struct vm_area_struct *vma; |
1733 | 1733 | ||
1734 | anon_vma_lock_write(anon_vma); | 1734 | anon_vma_lock_read(anon_vma); |
1735 | anon_vma_interval_tree_foreach(vmac, &anon_vma->rb_root, | 1735 | anon_vma_interval_tree_foreach(vmac, &anon_vma->rb_root, |
1736 | 0, ULONG_MAX) { | 1736 | 0, ULONG_MAX) { |
1737 | vma = vmac->vma; | 1737 | vma = vmac->vma; |
@@ -1749,11 +1749,11 @@ again: | |||
1749 | 1749 | ||
1750 | ret = rmap_one(page, vma, rmap_item->address, arg); | 1750 | ret = rmap_one(page, vma, rmap_item->address, arg); |
1751 | if (ret != SWAP_AGAIN) { | 1751 | if (ret != SWAP_AGAIN) { |
1752 | anon_vma_unlock(anon_vma); | 1752 | anon_vma_unlock_read(anon_vma); |
1753 | goto out; | 1753 | goto out; |
1754 | } | 1754 | } |
1755 | } | 1755 | } |
1756 | anon_vma_unlock(anon_vma); | 1756 | anon_vma_unlock_read(anon_vma); |
1757 | } | 1757 | } |
1758 | if (!search_new_forks++) | 1758 | if (!search_new_forks++) |
1759 | goto again; | 1759 | goto again; |
diff --git a/mm/vmscan.c b/mm/vmscan.c index 828530e2794a..adc7e9058181 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c | |||
@@ -2570,7 +2570,7 @@ static bool prepare_kswapd_sleep(pg_data_t *pgdat, int order, long remaining, | |||
2570 | static unsigned long balance_pgdat(pg_data_t *pgdat, int order, | 2570 | static unsigned long balance_pgdat(pg_data_t *pgdat, int order, |
2571 | int *classzone_idx) | 2571 | int *classzone_idx) |
2572 | { | 2572 | { |
2573 | int all_zones_ok; | 2573 | struct zone *unbalanced_zone; |
2574 | unsigned long balanced; | 2574 | unsigned long balanced; |
2575 | int i; | 2575 | int i; |
2576 | int end_zone = 0; /* Inclusive. 0 = ZONE_DMA */ | 2576 | int end_zone = 0; /* Inclusive. 0 = ZONE_DMA */ |
@@ -2604,7 +2604,7 @@ loop_again: | |||
2604 | unsigned long lru_pages = 0; | 2604 | unsigned long lru_pages = 0; |
2605 | int has_under_min_watermark_zone = 0; | 2605 | int has_under_min_watermark_zone = 0; |
2606 | 2606 | ||
2607 | all_zones_ok = 1; | 2607 | unbalanced_zone = NULL; |
2608 | balanced = 0; | 2608 | balanced = 0; |
2609 | 2609 | ||
2610 | /* | 2610 | /* |
@@ -2743,7 +2743,7 @@ loop_again: | |||
2743 | } | 2743 | } |
2744 | 2744 | ||
2745 | if (!zone_balanced(zone, testorder, 0, end_zone)) { | 2745 | if (!zone_balanced(zone, testorder, 0, end_zone)) { |
2746 | all_zones_ok = 0; | 2746 | unbalanced_zone = zone; |
2747 | /* | 2747 | /* |
2748 | * We are still under min water mark. This | 2748 | * We are still under min water mark. This |
2749 | * means that we have a GFP_ATOMIC allocation | 2749 | * means that we have a GFP_ATOMIC allocation |
@@ -2776,7 +2776,7 @@ loop_again: | |||
2776 | pfmemalloc_watermark_ok(pgdat)) | 2776 | pfmemalloc_watermark_ok(pgdat)) |
2777 | wake_up(&pgdat->pfmemalloc_wait); | 2777 | wake_up(&pgdat->pfmemalloc_wait); |
2778 | 2778 | ||
2779 | if (all_zones_ok || (order && pgdat_balanced(pgdat, balanced, *classzone_idx))) | 2779 | if (!unbalanced_zone || (order && pgdat_balanced(pgdat, balanced, *classzone_idx))) |
2780 | break; /* kswapd: all done */ | 2780 | break; /* kswapd: all done */ |
2781 | /* | 2781 | /* |
2782 | * OK, kswapd is getting into trouble. Take a nap, then take | 2782 | * OK, kswapd is getting into trouble. Take a nap, then take |
@@ -2786,7 +2786,7 @@ loop_again: | |||
2786 | if (has_under_min_watermark_zone) | 2786 | if (has_under_min_watermark_zone) |
2787 | count_vm_event(KSWAPD_SKIP_CONGESTION_WAIT); | 2787 | count_vm_event(KSWAPD_SKIP_CONGESTION_WAIT); |
2788 | else | 2788 | else |
2789 | congestion_wait(BLK_RW_ASYNC, HZ/10); | 2789 | wait_iff_congested(unbalanced_zone, BLK_RW_ASYNC, HZ/10); |
2790 | } | 2790 | } |
2791 | 2791 | ||
2792 | /* | 2792 | /* |
@@ -2805,7 +2805,7 @@ out: | |||
2805 | * high-order: Balanced zones must make up at least 25% of the node | 2805 | * high-order: Balanced zones must make up at least 25% of the node |
2806 | * for the node to be balanced | 2806 | * for the node to be balanced |
2807 | */ | 2807 | */ |
2808 | if (!(all_zones_ok || (order && pgdat_balanced(pgdat, balanced, *classzone_idx)))) { | 2808 | if (unbalanced_zone && (!order || !pgdat_balanced(pgdat, balanced, *classzone_idx))) { |
2809 | cond_resched(); | 2809 | cond_resched(); |
2810 | 2810 | ||
2811 | try_to_freeze(); | 2811 | try_to_freeze(); |
diff --git a/net/9p/trans_virtio.c b/net/9p/trans_virtio.c index 35b8911b1c8e..fd05c81cb348 100644 --- a/net/9p/trans_virtio.c +++ b/net/9p/trans_virtio.c | |||
@@ -39,6 +39,7 @@ | |||
39 | #include <linux/inet.h> | 39 | #include <linux/inet.h> |
40 | #include <linux/idr.h> | 40 | #include <linux/idr.h> |
41 | #include <linux/file.h> | 41 | #include <linux/file.h> |
42 | #include <linux/highmem.h> | ||
42 | #include <linux/slab.h> | 43 | #include <linux/slab.h> |
43 | #include <net/9p/9p.h> | 44 | #include <net/9p/9p.h> |
44 | #include <linux/parser.h> | 45 | #include <linux/parser.h> |
@@ -325,7 +326,7 @@ static int p9_get_mapped_pages(struct virtio_chan *chan, | |||
325 | int count = nr_pages; | 326 | int count = nr_pages; |
326 | while (nr_pages) { | 327 | while (nr_pages) { |
327 | s = rest_of_page(data); | 328 | s = rest_of_page(data); |
328 | pages[index++] = virt_to_page(data); | 329 | pages[index++] = kmap_to_page(data); |
329 | data += s; | 330 | data += s; |
330 | nr_pages--; | 331 | nr_pages--; |
331 | } | 332 | } |
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c index 0f3d3db0df71..cca87277baf0 100644 --- a/sound/pci/hda/hda_intel.c +++ b/sound/pci/hda/hda_intel.c | |||
@@ -2876,7 +2876,7 @@ static int azx_free(struct azx *chip) | |||
2876 | azx_notifier_unregister(chip); | 2876 | azx_notifier_unregister(chip); |
2877 | 2877 | ||
2878 | chip->init_failed = 1; /* to be sure */ | 2878 | chip->init_failed = 1; /* to be sure */ |
2879 | complete(&chip->probe_wait); | 2879 | complete_all(&chip->probe_wait); |
2880 | 2880 | ||
2881 | if (use_vga_switcheroo(chip)) { | 2881 | if (use_vga_switcheroo(chip)) { |
2882 | if (chip->disabled && chip->bus) | 2882 | if (chip->disabled && chip->bus) |
@@ -3504,7 +3504,7 @@ static int azx_probe(struct pci_dev *pci, | |||
3504 | pm_runtime_put_noidle(&pci->dev); | 3504 | pm_runtime_put_noidle(&pci->dev); |
3505 | 3505 | ||
3506 | dev++; | 3506 | dev++; |
3507 | complete(&chip->probe_wait); | 3507 | complete_all(&chip->probe_wait); |
3508 | return 0; | 3508 | return 0; |
3509 | 3509 | ||
3510 | out_free: | 3510 | out_free: |
diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c index 0fcfa6f406b8..b6c21ea187ca 100644 --- a/sound/pci/hda/patch_hdmi.c +++ b/sound/pci/hda/patch_hdmi.c | |||
@@ -431,9 +431,11 @@ static void hdmi_init_pin(struct hda_codec *codec, hda_nid_t pin_nid) | |||
431 | if (get_wcaps(codec, pin_nid) & AC_WCAP_OUT_AMP) | 431 | if (get_wcaps(codec, pin_nid) & AC_WCAP_OUT_AMP) |
432 | snd_hda_codec_write(codec, pin_nid, 0, | 432 | snd_hda_codec_write(codec, pin_nid, 0, |
433 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE); | 433 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE); |
434 | /* Disable pin out until stream is active*/ | 434 | /* Enable pin out: some machines with GM965 gets broken output when |
435 | * the pin is disabled or changed while using with HDMI | ||
436 | */ | ||
435 | snd_hda_codec_write(codec, pin_nid, 0, | 437 | snd_hda_codec_write(codec, pin_nid, 0, |
436 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); | 438 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
437 | } | 439 | } |
438 | 440 | ||
439 | static int hdmi_get_channel_count(struct hda_codec *codec, hda_nid_t cvt_nid) | 441 | static int hdmi_get_channel_count(struct hda_codec *codec, hda_nid_t cvt_nid) |
@@ -1341,7 +1343,6 @@ static int generic_hdmi_playback_pcm_prepare(struct hda_pcm_stream *hinfo, | |||
1341 | struct hdmi_spec *spec = codec->spec; | 1343 | struct hdmi_spec *spec = codec->spec; |
1342 | int pin_idx = hinfo_to_pin_index(spec, hinfo); | 1344 | int pin_idx = hinfo_to_pin_index(spec, hinfo); |
1343 | hda_nid_t pin_nid = spec->pins[pin_idx].pin_nid; | 1345 | hda_nid_t pin_nid = spec->pins[pin_idx].pin_nid; |
1344 | int pinctl; | ||
1345 | bool non_pcm; | 1346 | bool non_pcm; |
1346 | 1347 | ||
1347 | non_pcm = check_non_pcm_per_cvt(codec, cvt_nid); | 1348 | non_pcm = check_non_pcm_per_cvt(codec, cvt_nid); |
@@ -1350,11 +1351,6 @@ static int generic_hdmi_playback_pcm_prepare(struct hda_pcm_stream *hinfo, | |||
1350 | 1351 | ||
1351 | hdmi_setup_audio_infoframe(codec, pin_idx, non_pcm, substream); | 1352 | hdmi_setup_audio_infoframe(codec, pin_idx, non_pcm, substream); |
1352 | 1353 | ||
1353 | pinctl = snd_hda_codec_read(codec, pin_nid, 0, | ||
1354 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); | ||
1355 | snd_hda_codec_write(codec, pin_nid, 0, | ||
1356 | AC_VERB_SET_PIN_WIDGET_CONTROL, pinctl | PIN_OUT); | ||
1357 | |||
1358 | return hdmi_setup_stream(codec, cvt_nid, pin_nid, stream_tag, format); | 1354 | return hdmi_setup_stream(codec, cvt_nid, pin_nid, stream_tag, format); |
1359 | } | 1355 | } |
1360 | 1356 | ||
@@ -1374,7 +1370,6 @@ static int hdmi_pcm_close(struct hda_pcm_stream *hinfo, | |||
1374 | int cvt_idx, pin_idx; | 1370 | int cvt_idx, pin_idx; |
1375 | struct hdmi_spec_per_cvt *per_cvt; | 1371 | struct hdmi_spec_per_cvt *per_cvt; |
1376 | struct hdmi_spec_per_pin *per_pin; | 1372 | struct hdmi_spec_per_pin *per_pin; |
1377 | int pinctl; | ||
1378 | 1373 | ||
1379 | if (hinfo->nid) { | 1374 | if (hinfo->nid) { |
1380 | cvt_idx = cvt_nid_to_cvt_index(spec, hinfo->nid); | 1375 | cvt_idx = cvt_nid_to_cvt_index(spec, hinfo->nid); |
@@ -1391,11 +1386,6 @@ static int hdmi_pcm_close(struct hda_pcm_stream *hinfo, | |||
1391 | return -EINVAL; | 1386 | return -EINVAL; |
1392 | per_pin = &spec->pins[pin_idx]; | 1387 | per_pin = &spec->pins[pin_idx]; |
1393 | 1388 | ||
1394 | pinctl = snd_hda_codec_read(codec, per_pin->pin_nid, 0, | ||
1395 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); | ||
1396 | snd_hda_codec_write(codec, per_pin->pin_nid, 0, | ||
1397 | AC_VERB_SET_PIN_WIDGET_CONTROL, | ||
1398 | pinctl & ~PIN_OUT); | ||
1399 | snd_hda_spdif_ctls_unassign(codec, pin_idx); | 1389 | snd_hda_spdif_ctls_unassign(codec, pin_idx); |
1400 | per_pin->chmap_set = false; | 1390 | per_pin->chmap_set = false; |
1401 | memset(per_pin->chmap, 0, sizeof(per_pin->chmap)); | 1391 | memset(per_pin->chmap, 0, sizeof(per_pin->chmap)); |
@@ -1691,6 +1681,30 @@ static const struct hda_codec_ops generic_hdmi_patch_ops = { | |||
1691 | .unsol_event = hdmi_unsol_event, | 1681 | .unsol_event = hdmi_unsol_event, |
1692 | }; | 1682 | }; |
1693 | 1683 | ||
1684 | static void intel_haswell_fixup_connect_list(struct hda_codec *codec) | ||
1685 | { | ||
1686 | unsigned int vendor_param; | ||
1687 | hda_nid_t list[3] = {0x2, 0x3, 0x4}; | ||
1688 | |||
1689 | vendor_param = snd_hda_codec_read(codec, 0x08, 0, 0xf81, 0); | ||
1690 | if (vendor_param == -1 || vendor_param & 0x02) | ||
1691 | return; | ||
1692 | |||
1693 | /* enable DP1.2 mode */ | ||
1694 | vendor_param |= 0x02; | ||
1695 | snd_hda_codec_read(codec, 0x08, 0, 0x781, vendor_param); | ||
1696 | |||
1697 | vendor_param = snd_hda_codec_read(codec, 0x08, 0, 0xf81, 0); | ||
1698 | if (vendor_param == -1 || !(vendor_param & 0x02)) | ||
1699 | return; | ||
1700 | |||
1701 | /* override 3 pins connection list */ | ||
1702 | snd_hda_override_conn_list(codec, 0x05, 3, list); | ||
1703 | snd_hda_override_conn_list(codec, 0x06, 3, list); | ||
1704 | snd_hda_override_conn_list(codec, 0x07, 3, list); | ||
1705 | } | ||
1706 | |||
1707 | |||
1694 | static int patch_generic_hdmi(struct hda_codec *codec) | 1708 | static int patch_generic_hdmi(struct hda_codec *codec) |
1695 | { | 1709 | { |
1696 | struct hdmi_spec *spec; | 1710 | struct hdmi_spec *spec; |
@@ -1700,6 +1714,10 @@ static int patch_generic_hdmi(struct hda_codec *codec) | |||
1700 | return -ENOMEM; | 1714 | return -ENOMEM; |
1701 | 1715 | ||
1702 | codec->spec = spec; | 1716 | codec->spec = spec; |
1717 | |||
1718 | if (codec->vendor_id == 0x80862807) | ||
1719 | intel_haswell_fixup_connect_list(codec); | ||
1720 | |||
1703 | if (hdmi_parse_codec(codec) < 0) { | 1721 | if (hdmi_parse_codec(codec) < 0) { |
1704 | codec->spec = NULL; | 1722 | codec->spec = NULL; |
1705 | kfree(spec); | 1723 | kfree(spec); |
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 7743775f6abb..6ee34593774a 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c | |||
@@ -4373,6 +4373,7 @@ static int alc_alloc_spec(struct hda_codec *codec, hda_nid_t mixer_nid) | |||
4373 | if (!spec) | 4373 | if (!spec) |
4374 | return -ENOMEM; | 4374 | return -ENOMEM; |
4375 | codec->spec = spec; | 4375 | codec->spec = spec; |
4376 | codec->single_adc_amp = 1; | ||
4376 | spec->mixer_nid = mixer_nid; | 4377 | spec->mixer_nid = mixer_nid; |
4377 | snd_hda_gen_init(&spec->gen); | 4378 | snd_hda_gen_init(&spec->gen); |
4378 | snd_array_init(&spec->kctls, sizeof(struct snd_kcontrol_new), 32); | 4379 | snd_array_init(&spec->kctls, sizeof(struct snd_kcontrol_new), 32); |
@@ -6569,8 +6570,8 @@ static void alc861vd_fixup_dallas(struct hda_codec *codec, | |||
6569 | const struct alc_fixup *fix, int action) | 6570 | const struct alc_fixup *fix, int action) |
6570 | { | 6571 | { |
6571 | if (action == ALC_FIXUP_ACT_PRE_PROBE) { | 6572 | if (action == ALC_FIXUP_ACT_PRE_PROBE) { |
6572 | snd_hda_override_pin_caps(codec, 0x18, 0x00001714); | 6573 | snd_hda_override_pin_caps(codec, 0x18, 0x00000734); |
6573 | snd_hda_override_pin_caps(codec, 0x19, 0x0000171c); | 6574 | snd_hda_override_pin_caps(codec, 0x19, 0x0000073c); |
6574 | } | 6575 | } |
6575 | } | 6576 | } |
6576 | 6577 | ||
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index df13c0f84899..a86547ca17c8 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c | |||
@@ -1725,7 +1725,7 @@ static const struct snd_pci_quirk stac92hd83xxx_cfg_tbl[] = { | |||
1725 | SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x1658, | 1725 | SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x1658, |
1726 | "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD), | 1726 | "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD), |
1727 | SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x1659, | 1727 | SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x1659, |
1728 | "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD), | 1728 | "HP Pavilion dv7", STAC_HP_DV7_4000), |
1729 | SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x165A, | 1729 | SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x165A, |
1730 | "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD), | 1730 | "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD), |
1731 | SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x165B, | 1731 | SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x165B, |
diff --git a/sound/soc/codecs/cs42l73.c b/sound/soc/codecs/cs42l73.c index a0791ecf6d95..6361dab48bd1 100644 --- a/sound/soc/codecs/cs42l73.c +++ b/sound/soc/codecs/cs42l73.c | |||
@@ -40,6 +40,7 @@ struct cs42l73_private { | |||
40 | u32 sysclk; | 40 | u32 sysclk; |
41 | u8 mclksel; | 41 | u8 mclksel; |
42 | u32 mclk; | 42 | u32 mclk; |
43 | int shutdwn_delay; | ||
43 | }; | 44 | }; |
44 | 45 | ||
45 | static const struct reg_default cs42l73_reg_defaults[] = { | 46 | static const struct reg_default cs42l73_reg_defaults[] = { |
@@ -588,7 +589,60 @@ static const struct snd_kcontrol_new cs42l73_snd_controls[] = { | |||
588 | SOC_ENUM("XSPOUT Mono/Stereo Select", xsp_output_mux_enum), | 589 | SOC_ENUM("XSPOUT Mono/Stereo Select", xsp_output_mux_enum), |
589 | }; | 590 | }; |
590 | 591 | ||
592 | static int cs42l73_spklo_spk_amp_event(struct snd_soc_dapm_widget *w, | ||
593 | struct snd_kcontrol *kcontrol, int event) | ||
594 | { | ||
595 | struct snd_soc_codec *codec = w->codec; | ||
596 | struct cs42l73_private *priv = snd_soc_codec_get_drvdata(codec); | ||
597 | switch (event) { | ||
598 | case SND_SOC_DAPM_POST_PMD: | ||
599 | /* 150 ms delay between setting PDN and MCLKDIS */ | ||
600 | priv->shutdwn_delay = 150; | ||
601 | break; | ||
602 | default: | ||
603 | pr_err("Invalid event = 0x%x\n", event); | ||
604 | } | ||
605 | return 0; | ||
606 | } | ||
607 | |||
608 | static int cs42l73_ear_amp_event(struct snd_soc_dapm_widget *w, | ||
609 | struct snd_kcontrol *kcontrol, int event) | ||
610 | { | ||
611 | struct snd_soc_codec *codec = w->codec; | ||
612 | struct cs42l73_private *priv = snd_soc_codec_get_drvdata(codec); | ||
613 | switch (event) { | ||
614 | case SND_SOC_DAPM_POST_PMD: | ||
615 | /* 50 ms delay between setting PDN and MCLKDIS */ | ||
616 | if (priv->shutdwn_delay < 50) | ||
617 | priv->shutdwn_delay = 50; | ||
618 | break; | ||
619 | default: | ||
620 | pr_err("Invalid event = 0x%x\n", event); | ||
621 | } | ||
622 | return 0; | ||
623 | } | ||
624 | |||
625 | |||
626 | static int cs42l73_hp_amp_event(struct snd_soc_dapm_widget *w, | ||
627 | struct snd_kcontrol *kcontrol, int event) | ||
628 | { | ||
629 | struct snd_soc_codec *codec = w->codec; | ||
630 | struct cs42l73_private *priv = snd_soc_codec_get_drvdata(codec); | ||
631 | switch (event) { | ||
632 | case SND_SOC_DAPM_POST_PMD: | ||
633 | /* 30 ms delay between setting PDN and MCLKDIS */ | ||
634 | if (priv->shutdwn_delay < 30) | ||
635 | priv->shutdwn_delay = 30; | ||
636 | break; | ||
637 | default: | ||
638 | pr_err("Invalid event = 0x%x\n", event); | ||
639 | } | ||
640 | return 0; | ||
641 | } | ||
642 | |||
591 | static const struct snd_soc_dapm_widget cs42l73_dapm_widgets[] = { | 643 | static const struct snd_soc_dapm_widget cs42l73_dapm_widgets[] = { |
644 | SND_SOC_DAPM_INPUT("DMICA"), | ||
645 | SND_SOC_DAPM_INPUT("DMICB"), | ||
592 | SND_SOC_DAPM_INPUT("LINEINA"), | 646 | SND_SOC_DAPM_INPUT("LINEINA"), |
593 | SND_SOC_DAPM_INPUT("LINEINB"), | 647 | SND_SOC_DAPM_INPUT("LINEINB"), |
594 | SND_SOC_DAPM_INPUT("MIC1"), | 648 | SND_SOC_DAPM_INPUT("MIC1"), |
@@ -604,9 +658,7 @@ static const struct snd_soc_dapm_widget cs42l73_dapm_widgets[] = { | |||
604 | CS42L73_PWRCTL2, 3, 1), | 658 | CS42L73_PWRCTL2, 3, 1), |
605 | SND_SOC_DAPM_AIF_OUT("ASPOUTR", NULL, 0, | 659 | SND_SOC_DAPM_AIF_OUT("ASPOUTR", NULL, 0, |
606 | CS42L73_PWRCTL2, 3, 1), | 660 | CS42L73_PWRCTL2, 3, 1), |
607 | SND_SOC_DAPM_AIF_OUT("VSPOUTL", NULL, 0, | 661 | SND_SOC_DAPM_AIF_OUT("VSPINOUT", NULL, 0, |
608 | CS42L73_PWRCTL2, 4, 1), | ||
609 | SND_SOC_DAPM_AIF_OUT("VSPOUTR", NULL, 0, | ||
610 | CS42L73_PWRCTL2, 4, 1), | 662 | CS42L73_PWRCTL2, 4, 1), |
611 | 663 | ||
612 | SND_SOC_DAPM_PGA("PGA Left", SND_SOC_NOPM, 0, 0, NULL, 0), | 664 | SND_SOC_DAPM_PGA("PGA Left", SND_SOC_NOPM, 0, 0, NULL, 0), |
@@ -632,8 +684,7 @@ static const struct snd_soc_dapm_widget cs42l73_dapm_widgets[] = { | |||
632 | SND_SOC_DAPM_MIXER("ASPR Output Mixer", SND_SOC_NOPM, 0, 0, NULL, 0), | 684 | SND_SOC_DAPM_MIXER("ASPR Output Mixer", SND_SOC_NOPM, 0, 0, NULL, 0), |
633 | SND_SOC_DAPM_MIXER("XSPL Output Mixer", SND_SOC_NOPM, 0, 0, NULL, 0), | 685 | SND_SOC_DAPM_MIXER("XSPL Output Mixer", SND_SOC_NOPM, 0, 0, NULL, 0), |
634 | SND_SOC_DAPM_MIXER("XSPR Output Mixer", SND_SOC_NOPM, 0, 0, NULL, 0), | 686 | SND_SOC_DAPM_MIXER("XSPR Output Mixer", SND_SOC_NOPM, 0, 0, NULL, 0), |
635 | SND_SOC_DAPM_MIXER("VSPL Output Mixer", SND_SOC_NOPM, 0, 0, NULL, 0), | 687 | SND_SOC_DAPM_MIXER("VSP Output Mixer", SND_SOC_NOPM, 0, 0, NULL, 0), |
636 | SND_SOC_DAPM_MIXER("VSPR Output Mixer", SND_SOC_NOPM, 0, 0, NULL, 0), | ||
637 | 688 | ||
638 | SND_SOC_DAPM_AIF_IN("XSPINL", NULL, 0, | 689 | SND_SOC_DAPM_AIF_IN("XSPINL", NULL, 0, |
639 | CS42L73_PWRCTL2, 0, 1), | 690 | CS42L73_PWRCTL2, 0, 1), |
@@ -649,7 +700,7 @@ static const struct snd_soc_dapm_widget cs42l73_dapm_widgets[] = { | |||
649 | SND_SOC_DAPM_AIF_IN("ASPINM", NULL, 0, | 700 | SND_SOC_DAPM_AIF_IN("ASPINM", NULL, 0, |
650 | CS42L73_PWRCTL2, 2, 1), | 701 | CS42L73_PWRCTL2, 2, 1), |
651 | 702 | ||
652 | SND_SOC_DAPM_AIF_IN("VSPIN", NULL, 0, | 703 | SND_SOC_DAPM_AIF_IN("VSPINOUT", NULL, 0, |
653 | CS42L73_PWRCTL2, 4, 1), | 704 | CS42L73_PWRCTL2, 4, 1), |
654 | 705 | ||
655 | SND_SOC_DAPM_MIXER("HL Left Mixer", SND_SOC_NOPM, 0, 0, NULL, 0), | 706 | SND_SOC_DAPM_MIXER("HL Left Mixer", SND_SOC_NOPM, 0, 0, NULL, 0), |
@@ -674,16 +725,20 @@ static const struct snd_soc_dapm_widget cs42l73_dapm_widgets[] = { | |||
674 | SND_SOC_DAPM_PGA("SPK DAC", SND_SOC_NOPM, 0, 0, NULL, 0), | 725 | SND_SOC_DAPM_PGA("SPK DAC", SND_SOC_NOPM, 0, 0, NULL, 0), |
675 | SND_SOC_DAPM_PGA("ESL DAC", SND_SOC_NOPM, 0, 0, NULL, 0), | 726 | SND_SOC_DAPM_PGA("ESL DAC", SND_SOC_NOPM, 0, 0, NULL, 0), |
676 | 727 | ||
677 | SND_SOC_DAPM_SWITCH("HP Amp", CS42L73_PWRCTL3, 0, 1, | 728 | SND_SOC_DAPM_SWITCH_E("HP Amp", CS42L73_PWRCTL3, 0, 1, |
678 | &hp_amp_ctl), | 729 | &hp_amp_ctl, cs42l73_hp_amp_event, |
730 | SND_SOC_DAPM_POST_PMD), | ||
679 | SND_SOC_DAPM_SWITCH("LO Amp", CS42L73_PWRCTL3, 1, 1, | 731 | SND_SOC_DAPM_SWITCH("LO Amp", CS42L73_PWRCTL3, 1, 1, |
680 | &lo_amp_ctl), | 732 | &lo_amp_ctl), |
681 | SND_SOC_DAPM_SWITCH("SPK Amp", CS42L73_PWRCTL3, 2, 1, | 733 | SND_SOC_DAPM_SWITCH_E("SPK Amp", CS42L73_PWRCTL3, 2, 1, |
682 | &spk_amp_ctl), | 734 | &spk_amp_ctl, cs42l73_spklo_spk_amp_event, |
683 | SND_SOC_DAPM_SWITCH("EAR Amp", CS42L73_PWRCTL3, 3, 1, | 735 | SND_SOC_DAPM_POST_PMD), |
684 | &ear_amp_ctl), | 736 | SND_SOC_DAPM_SWITCH_E("EAR Amp", CS42L73_PWRCTL3, 3, 1, |
685 | SND_SOC_DAPM_SWITCH("SPKLO Amp", CS42L73_PWRCTL3, 4, 1, | 737 | &ear_amp_ctl, cs42l73_ear_amp_event, |
686 | &spklo_amp_ctl), | 738 | SND_SOC_DAPM_POST_PMD), |
739 | SND_SOC_DAPM_SWITCH_E("SPKLO Amp", CS42L73_PWRCTL3, 4, 1, | ||
740 | &spklo_amp_ctl, cs42l73_spklo_spk_amp_event, | ||
741 | SND_SOC_DAPM_POST_PMD), | ||
687 | 742 | ||
688 | SND_SOC_DAPM_OUTPUT("HPOUTA"), | 743 | SND_SOC_DAPM_OUTPUT("HPOUTA"), |
689 | SND_SOC_DAPM_OUTPUT("HPOUTB"), | 744 | SND_SOC_DAPM_OUTPUT("HPOUTB"), |
@@ -705,7 +760,7 @@ static const struct snd_soc_dapm_route cs42l73_audio_map[] = { | |||
705 | 760 | ||
706 | {"ESL DAC", "ESL-ASP Mono Volume", "ESL Mixer"}, | 761 | {"ESL DAC", "ESL-ASP Mono Volume", "ESL Mixer"}, |
707 | {"ESL DAC", "ESL-XSP Mono Volume", "ESL Mixer"}, | 762 | {"ESL DAC", "ESL-XSP Mono Volume", "ESL Mixer"}, |
708 | {"ESL DAC", "ESL-VSP Mono Volume", "VSPIN"}, | 763 | {"ESL DAC", "ESL-VSP Mono Volume", "VSPINOUT"}, |
709 | /* Loopback */ | 764 | /* Loopback */ |
710 | {"ESL DAC", "ESL-IP Mono Volume", "Input Left Capture"}, | 765 | {"ESL DAC", "ESL-IP Mono Volume", "Input Left Capture"}, |
711 | {"ESL DAC", "ESL-IP Mono Volume", "Input Right Capture"}, | 766 | {"ESL DAC", "ESL-IP Mono Volume", "Input Right Capture"}, |
@@ -727,7 +782,7 @@ static const struct snd_soc_dapm_route cs42l73_audio_map[] = { | |||
727 | 782 | ||
728 | {"SPK DAC", "SPK-ASP Mono Volume", "SPK Mixer"}, | 783 | {"SPK DAC", "SPK-ASP Mono Volume", "SPK Mixer"}, |
729 | {"SPK DAC", "SPK-XSP Mono Volume", "SPK Mixer"}, | 784 | {"SPK DAC", "SPK-XSP Mono Volume", "SPK Mixer"}, |
730 | {"SPK DAC", "SPK-VSP Mono Volume", "VSPIN"}, | 785 | {"SPK DAC", "SPK-VSP Mono Volume", "VSPINOUT"}, |
731 | /* Loopback */ | 786 | /* Loopback */ |
732 | {"SPK DAC", "SPK-IP Mono Volume", "Input Left Capture"}, | 787 | {"SPK DAC", "SPK-IP Mono Volume", "Input Left Capture"}, |
733 | {"SPK DAC", "SPK-IP Mono Volume", "Input Right Capture"}, | 788 | {"SPK DAC", "SPK-IP Mono Volume", "Input Right Capture"}, |
@@ -770,8 +825,8 @@ static const struct snd_soc_dapm_route cs42l73_audio_map[] = { | |||
770 | {"HL Right Mixer", NULL, "ASPINR"}, | 825 | {"HL Right Mixer", NULL, "ASPINR"}, |
771 | {"HL Left Mixer", NULL, "XSPINL"}, | 826 | {"HL Left Mixer", NULL, "XSPINL"}, |
772 | {"HL Right Mixer", NULL, "XSPINR"}, | 827 | {"HL Right Mixer", NULL, "XSPINR"}, |
773 | {"HL Left Mixer", NULL, "VSPIN"}, | 828 | {"HL Left Mixer", NULL, "VSPINOUT"}, |
774 | {"HL Right Mixer", NULL, "VSPIN"}, | 829 | {"HL Right Mixer", NULL, "VSPINOUT"}, |
775 | 830 | ||
776 | {"ASPINL", NULL, "ASP Playback"}, | 831 | {"ASPINL", NULL, "ASP Playback"}, |
777 | {"ASPINM", NULL, "ASP Playback"}, | 832 | {"ASPINM", NULL, "ASP Playback"}, |
@@ -779,7 +834,7 @@ static const struct snd_soc_dapm_route cs42l73_audio_map[] = { | |||
779 | {"XSPINL", NULL, "XSP Playback"}, | 834 | {"XSPINL", NULL, "XSP Playback"}, |
780 | {"XSPINM", NULL, "XSP Playback"}, | 835 | {"XSPINM", NULL, "XSP Playback"}, |
781 | {"XSPINR", NULL, "XSP Playback"}, | 836 | {"XSPINR", NULL, "XSP Playback"}, |
782 | {"VSPIN", NULL, "VSP Playback"}, | 837 | {"VSPINOUT", NULL, "VSP Playback"}, |
783 | 838 | ||
784 | /* Capture Paths */ | 839 | /* Capture Paths */ |
785 | {"MIC1", NULL, "MIC1 Bias"}, | 840 | {"MIC1", NULL, "MIC1 Bias"}, |
@@ -795,6 +850,8 @@ static const struct snd_soc_dapm_route cs42l73_audio_map[] = { | |||
795 | 850 | ||
796 | {"ADC Left", NULL, "PGA Left"}, | 851 | {"ADC Left", NULL, "PGA Left"}, |
797 | {"ADC Right", NULL, "PGA Right"}, | 852 | {"ADC Right", NULL, "PGA Right"}, |
853 | {"DMIC Left", NULL, "DMICA"}, | ||
854 | {"DMIC Right", NULL, "DMICB"}, | ||
798 | 855 | ||
799 | {"Input Left Capture", "ADC Left Input", "ADC Left"}, | 856 | {"Input Left Capture", "ADC Left Input", "ADC Left"}, |
800 | {"Input Right Capture", "ADC Right Input", "ADC Right"}, | 857 | {"Input Right Capture", "ADC Right Input", "ADC Right"}, |
@@ -819,21 +876,18 @@ static const struct snd_soc_dapm_route cs42l73_audio_map[] = { | |||
819 | {"XSPOUTR", NULL, "XSPR Output Mixer"}, | 876 | {"XSPOUTR", NULL, "XSPR Output Mixer"}, |
820 | 877 | ||
821 | /* Voice Capture */ | 878 | /* Voice Capture */ |
822 | {"VSPL Output Mixer", NULL, "Input Left Capture"}, | 879 | {"VSP Output Mixer", NULL, "Input Left Capture"}, |
823 | {"VSPR Output Mixer", NULL, "Input Left Capture"}, | 880 | {"VSP Output Mixer", NULL, "Input Right Capture"}, |
824 | 881 | ||
825 | {"VSPOUTL", "VSP-IP Volume", "VSPL Output Mixer"}, | 882 | {"VSPINOUT", "VSP-IP Volume", "VSP Output Mixer"}, |
826 | {"VSPOUTR", "VSP-IP Volume", "VSPR Output Mixer"}, | ||
827 | 883 | ||
828 | {"VSPOUTL", NULL, "VSPL Output Mixer"}, | 884 | {"VSPINOUT", NULL, "VSP Output Mixer"}, |
829 | {"VSPOUTR", NULL, "VSPR Output Mixer"}, | ||
830 | 885 | ||
831 | {"ASP Capture", NULL, "ASPOUTL"}, | 886 | {"ASP Capture", NULL, "ASPOUTL"}, |
832 | {"ASP Capture", NULL, "ASPOUTR"}, | 887 | {"ASP Capture", NULL, "ASPOUTR"}, |
833 | {"XSP Capture", NULL, "XSPOUTL"}, | 888 | {"XSP Capture", NULL, "XSPOUTL"}, |
834 | {"XSP Capture", NULL, "XSPOUTR"}, | 889 | {"XSP Capture", NULL, "XSPOUTR"}, |
835 | {"VSP Capture", NULL, "VSPOUTL"}, | 890 | {"VSP Capture", NULL, "VSPINOUT"}, |
836 | {"VSP Capture", NULL, "VSPOUTR"}, | ||
837 | }; | 891 | }; |
838 | 892 | ||
839 | struct cs42l73_mclk_div { | 893 | struct cs42l73_mclk_div { |
@@ -1167,6 +1221,14 @@ static int cs42l73_set_bias_level(struct snd_soc_codec *codec, | |||
1167 | 1221 | ||
1168 | case SND_SOC_BIAS_OFF: | 1222 | case SND_SOC_BIAS_OFF: |
1169 | snd_soc_update_bits(codec, CS42L73_PWRCTL1, PDN, 1); | 1223 | snd_soc_update_bits(codec, CS42L73_PWRCTL1, PDN, 1); |
1224 | if (cs42l73->shutdwn_delay > 0) { | ||
1225 | mdelay(cs42l73->shutdwn_delay); | ||
1226 | cs42l73->shutdwn_delay = 0; | ||
1227 | } else { | ||
1228 | mdelay(15); /* Min amount of time requred to power | ||
1229 | * down. | ||
1230 | */ | ||
1231 | } | ||
1170 | snd_soc_update_bits(codec, CS42L73_DMMCC, MCLKDIS, 1); | 1232 | snd_soc_update_bits(codec, CS42L73_DMMCC, MCLKDIS, 1); |
1171 | break; | 1233 | break; |
1172 | } | 1234 | } |
diff --git a/sound/soc/codecs/sigmadsp.c b/sound/soc/codecs/sigmadsp.c index 5be42bf56996..4068f2491232 100644 --- a/sound/soc/codecs/sigmadsp.c +++ b/sound/soc/codecs/sigmadsp.c | |||
@@ -225,7 +225,7 @@ EXPORT_SYMBOL(process_sigma_firmware); | |||
225 | static int sigma_action_write_regmap(void *control_data, | 225 | static int sigma_action_write_regmap(void *control_data, |
226 | const struct sigma_action *sa, size_t len) | 226 | const struct sigma_action *sa, size_t len) |
227 | { | 227 | { |
228 | return regmap_raw_write(control_data, le16_to_cpu(sa->addr), | 228 | return regmap_raw_write(control_data, be16_to_cpu(sa->addr), |
229 | sa->payload, len - 2); | 229 | sa->payload, len - 2); |
230 | } | 230 | } |
231 | 231 | ||
diff --git a/sound/soc/codecs/tpa6130a2.c b/sound/soc/codecs/tpa6130a2.c index 8d75aa152c8c..c58bee8346ce 100644 --- a/sound/soc/codecs/tpa6130a2.c +++ b/sound/soc/codecs/tpa6130a2.c | |||
@@ -398,7 +398,8 @@ static int tpa6130a2_probe(struct i2c_client *client, | |||
398 | TPA6130A2_MUTE_L; | 398 | TPA6130A2_MUTE_L; |
399 | 399 | ||
400 | if (data->power_gpio >= 0) { | 400 | if (data->power_gpio >= 0) { |
401 | ret = gpio_request(data->power_gpio, "tpa6130a2 enable"); | 401 | ret = devm_gpio_request(dev, data->power_gpio, |
402 | "tpa6130a2 enable"); | ||
402 | if (ret < 0) { | 403 | if (ret < 0) { |
403 | dev_err(dev, "Failed to request power GPIO (%d)\n", | 404 | dev_err(dev, "Failed to request power GPIO (%d)\n", |
404 | data->power_gpio); | 405 | data->power_gpio); |
@@ -419,16 +420,16 @@ static int tpa6130a2_probe(struct i2c_client *client, | |||
419 | break; | 420 | break; |
420 | } | 421 | } |
421 | 422 | ||
422 | data->supply = regulator_get(dev, regulator); | 423 | data->supply = devm_regulator_get(dev, regulator); |
423 | if (IS_ERR(data->supply)) { | 424 | if (IS_ERR(data->supply)) { |
424 | ret = PTR_ERR(data->supply); | 425 | ret = PTR_ERR(data->supply); |
425 | dev_err(dev, "Failed to request supply: %d\n", ret); | 426 | dev_err(dev, "Failed to request supply: %d\n", ret); |
426 | goto err_regulator; | 427 | goto err_gpio; |
427 | } | 428 | } |
428 | 429 | ||
429 | ret = tpa6130a2_power(1); | 430 | ret = tpa6130a2_power(1); |
430 | if (ret != 0) | 431 | if (ret != 0) |
431 | goto err_power; | 432 | goto err_gpio; |
432 | 433 | ||
433 | 434 | ||
434 | /* Read version */ | 435 | /* Read version */ |
@@ -440,15 +441,10 @@ static int tpa6130a2_probe(struct i2c_client *client, | |||
440 | /* Disable the chip */ | 441 | /* Disable the chip */ |
441 | ret = tpa6130a2_power(0); | 442 | ret = tpa6130a2_power(0); |
442 | if (ret != 0) | 443 | if (ret != 0) |
443 | goto err_power; | 444 | goto err_gpio; |
444 | 445 | ||
445 | return 0; | 446 | return 0; |
446 | 447 | ||
447 | err_power: | ||
448 | regulator_put(data->supply); | ||
449 | err_regulator: | ||
450 | if (data->power_gpio >= 0) | ||
451 | gpio_free(data->power_gpio); | ||
452 | err_gpio: | 448 | err_gpio: |
453 | tpa6130a2_client = NULL; | 449 | tpa6130a2_client = NULL; |
454 | 450 | ||
@@ -457,14 +453,7 @@ err_gpio: | |||
457 | 453 | ||
458 | static int tpa6130a2_remove(struct i2c_client *client) | 454 | static int tpa6130a2_remove(struct i2c_client *client) |
459 | { | 455 | { |
460 | struct tpa6130a2_data *data = i2c_get_clientdata(client); | ||
461 | |||
462 | tpa6130a2_power(0); | 456 | tpa6130a2_power(0); |
463 | |||
464 | if (data->power_gpio >= 0) | ||
465 | gpio_free(data->power_gpio); | ||
466 | |||
467 | regulator_put(data->supply); | ||
468 | tpa6130a2_client = NULL; | 457 | tpa6130a2_client = NULL; |
469 | 458 | ||
470 | return 0; | 459 | return 0; |
diff --git a/sound/soc/soc-compress.c b/sound/soc/soc-compress.c index 967d0e173e1b..5fbfb06e8083 100644 --- a/sound/soc/soc-compress.c +++ b/sound/soc/soc-compress.c | |||
@@ -113,7 +113,7 @@ static int soc_compr_free(struct snd_compr_stream *cstream) | |||
113 | SNDRV_PCM_STREAM_PLAYBACK, | 113 | SNDRV_PCM_STREAM_PLAYBACK, |
114 | SND_SOC_DAPM_STREAM_STOP); | 114 | SND_SOC_DAPM_STREAM_STOP); |
115 | } else | 115 | } else |
116 | codec_dai->pop_wait = 1; | 116 | rtd->pop_wait = 1; |
117 | schedule_delayed_work(&rtd->delayed_work, | 117 | schedule_delayed_work(&rtd->delayed_work, |
118 | msecs_to_jiffies(rtd->pmdown_time)); | 118 | msecs_to_jiffies(rtd->pmdown_time)); |
119 | } else { | 119 | } else { |
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index 9c768bcb98a6..91d592ff67b7 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c | |||
@@ -4155,9 +4155,9 @@ int snd_soc_of_parse_audio_routing(struct snd_soc_card *card, | |||
4155 | ret = of_property_read_string_index(np, propname, | 4155 | ret = of_property_read_string_index(np, propname, |
4156 | 2 * i, &routes[i].sink); | 4156 | 2 * i, &routes[i].sink); |
4157 | if (ret) { | 4157 | if (ret) { |
4158 | dev_err(card->dev, "ASoC: Property '%s' index %d" | 4158 | dev_err(card->dev, |
4159 | " could not be read: %d\n", propname, 2 * i, | 4159 | "ASoC: Property '%s' index %d could not be read: %d\n", |
4160 | ret); | 4160 | propname, 2 * i, ret); |
4161 | kfree(routes); | 4161 | kfree(routes); |
4162 | return -EINVAL; | 4162 | return -EINVAL; |
4163 | } | 4163 | } |
@@ -4165,8 +4165,8 @@ int snd_soc_of_parse_audio_routing(struct snd_soc_card *card, | |||
4165 | (2 * i) + 1, &routes[i].source); | 4165 | (2 * i) + 1, &routes[i].source); |
4166 | if (ret) { | 4166 | if (ret) { |
4167 | dev_err(card->dev, | 4167 | dev_err(card->dev, |
4168 | "ASoC: Property '%s' index %d could not be" | 4168 | "ASoC: Property '%s' index %d could not be read: %d\n", |
4169 | " read: %d\n", propname, (2 * i) + 1, ret); | 4169 | propname, (2 * i) + 1, ret); |
4170 | kfree(routes); | 4170 | kfree(routes); |
4171 | return -EINVAL; | 4171 | return -EINVAL; |
4172 | } | 4172 | } |
diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c index 5c3ca2a34661..d7711fce119b 100644 --- a/sound/soc/soc-pcm.c +++ b/sound/soc/soc-pcm.c | |||
@@ -334,11 +334,11 @@ static void close_delayed_work(struct work_struct *work) | |||
334 | dev_dbg(rtd->dev, "ASoC: pop wq checking: %s status: %s waiting: %s\n", | 334 | dev_dbg(rtd->dev, "ASoC: pop wq checking: %s status: %s waiting: %s\n", |
335 | codec_dai->driver->playback.stream_name, | 335 | codec_dai->driver->playback.stream_name, |
336 | codec_dai->playback_active ? "active" : "inactive", | 336 | codec_dai->playback_active ? "active" : "inactive", |
337 | codec_dai->pop_wait ? "yes" : "no"); | 337 | rtd->pop_wait ? "yes" : "no"); |
338 | 338 | ||
339 | /* are we waiting on this codec DAI stream */ | 339 | /* are we waiting on this codec DAI stream */ |
340 | if (codec_dai->pop_wait == 1) { | 340 | if (rtd->pop_wait == 1) { |
341 | codec_dai->pop_wait = 0; | 341 | rtd->pop_wait = 0; |
342 | snd_soc_dapm_stream_event(rtd, SNDRV_PCM_STREAM_PLAYBACK, | 342 | snd_soc_dapm_stream_event(rtd, SNDRV_PCM_STREAM_PLAYBACK, |
343 | SND_SOC_DAPM_STREAM_STOP); | 343 | SND_SOC_DAPM_STREAM_STOP); |
344 | } | 344 | } |
@@ -408,7 +408,7 @@ static int soc_pcm_close(struct snd_pcm_substream *substream) | |||
408 | SND_SOC_DAPM_STREAM_STOP); | 408 | SND_SOC_DAPM_STREAM_STOP); |
409 | } else { | 409 | } else { |
410 | /* start delayed pop wq here for playback streams */ | 410 | /* start delayed pop wq here for playback streams */ |
411 | codec_dai->pop_wait = 1; | 411 | rtd->pop_wait = 1; |
412 | schedule_delayed_work(&rtd->delayed_work, | 412 | schedule_delayed_work(&rtd->delayed_work, |
413 | msecs_to_jiffies(rtd->pmdown_time)); | 413 | msecs_to_jiffies(rtd->pmdown_time)); |
414 | } | 414 | } |
@@ -480,8 +480,8 @@ static int soc_pcm_prepare(struct snd_pcm_substream *substream) | |||
480 | 480 | ||
481 | /* cancel any delayed stream shutdown that is pending */ | 481 | /* cancel any delayed stream shutdown that is pending */ |
482 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK && | 482 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK && |
483 | codec_dai->pop_wait) { | 483 | rtd->pop_wait) { |
484 | codec_dai->pop_wait = 0; | 484 | rtd->pop_wait = 0; |
485 | cancel_delayed_work(&rtd->delayed_work); | 485 | cancel_delayed_work(&rtd->delayed_work); |
486 | } | 486 | } |
487 | 487 | ||
diff --git a/sound/usb/midi.c b/sound/usb/midi.c index 34b9bb7fe87c..c183d34842ac 100644 --- a/sound/usb/midi.c +++ b/sound/usb/midi.c | |||
@@ -2181,6 +2181,10 @@ int snd_usbmidi_create(struct snd_card *card, | |||
2181 | umidi->usb_protocol_ops = &snd_usbmidi_novation_ops; | 2181 | umidi->usb_protocol_ops = &snd_usbmidi_novation_ops; |
2182 | err = snd_usbmidi_detect_per_port_endpoints(umidi, endpoints); | 2182 | err = snd_usbmidi_detect_per_port_endpoints(umidi, endpoints); |
2183 | break; | 2183 | break; |
2184 | case QUIRK_MIDI_MBOX2: | ||
2185 | umidi->usb_protocol_ops = &snd_usbmidi_midiman_ops; | ||
2186 | err = snd_usbmidi_detect_per_port_endpoints(umidi, endpoints); | ||
2187 | break; | ||
2184 | case QUIRK_MIDI_RAW_BYTES: | 2188 | case QUIRK_MIDI_RAW_BYTES: |
2185 | umidi->usb_protocol_ops = &snd_usbmidi_raw_ops; | 2189 | umidi->usb_protocol_ops = &snd_usbmidi_raw_ops; |
2186 | /* | 2190 | /* |
diff --git a/sound/usb/quirks-table.h b/sound/usb/quirks-table.h index 49f9af995d7a..cdcf6b45e8a8 100644 --- a/sound/usb/quirks-table.h +++ b/sound/usb/quirks-table.h | |||
@@ -99,6 +99,42 @@ | |||
99 | }, | 99 | }, |
100 | 100 | ||
101 | /* | 101 | /* |
102 | * HP Wireless Audio | ||
103 | * When not ignored, causes instability issues for some users, forcing them to | ||
104 | * blacklist the entire module. | ||
105 | */ | ||
106 | { | ||
107 | USB_DEVICE(0x0424, 0xb832), | ||
108 | .driver_info = (unsigned long) &(const struct snd_usb_audio_quirk) { | ||
109 | .vendor_name = "Standard Microsystems Corp.", | ||
110 | .product_name = "HP Wireless Audio", | ||
111 | .ifnum = QUIRK_ANY_INTERFACE, | ||
112 | .type = QUIRK_COMPOSITE, | ||
113 | .data = (const struct snd_usb_audio_quirk[]) { | ||
114 | /* Mixer */ | ||
115 | { | ||
116 | .ifnum = 0, | ||
117 | .type = QUIRK_IGNORE_INTERFACE, | ||
118 | }, | ||
119 | /* Playback */ | ||
120 | { | ||
121 | .ifnum = 1, | ||
122 | .type = QUIRK_IGNORE_INTERFACE, | ||
123 | }, | ||
124 | /* Capture */ | ||
125 | { | ||
126 | .ifnum = 2, | ||
127 | .type = QUIRK_IGNORE_INTERFACE, | ||
128 | }, | ||
129 | /* HID Device, .ifnum = 3 */ | ||
130 | { | ||
131 | .ifnum = -1, | ||
132 | } | ||
133 | } | ||
134 | } | ||
135 | }, | ||
136 | |||
137 | /* | ||
102 | * Logitech QuickCam: bDeviceClass is vendor-specific, so generic interface | 138 | * Logitech QuickCam: bDeviceClass is vendor-specific, so generic interface |
103 | * class matches do not take effect without an explicit ID match. | 139 | * class matches do not take effect without an explicit ID match. |
104 | */ | 140 | */ |
@@ -2885,6 +2921,93 @@ YAMAHA_DEVICE(0x7010, "UB99"), | |||
2885 | 2921 | ||
2886 | } | 2922 | } |
2887 | }, | 2923 | }, |
2924 | |||
2925 | /* DIGIDESIGN MBOX 2 */ | ||
2926 | { | ||
2927 | USB_DEVICE(0x0dba, 0x3000), | ||
2928 | .driver_info = (unsigned long) &(const struct snd_usb_audio_quirk) { | ||
2929 | .vendor_name = "Digidesign", | ||
2930 | .product_name = "Mbox 2", | ||
2931 | .ifnum = QUIRK_ANY_INTERFACE, | ||
2932 | .type = QUIRK_COMPOSITE, | ||
2933 | .data = (const struct snd_usb_audio_quirk[]) { | ||
2934 | { | ||
2935 | .ifnum = 0, | ||
2936 | .type = QUIRK_IGNORE_INTERFACE | ||
2937 | }, | ||
2938 | { | ||
2939 | .ifnum = 1, | ||
2940 | .type = QUIRK_IGNORE_INTERFACE | ||
2941 | }, | ||
2942 | { | ||
2943 | .ifnum = 2, | ||
2944 | .type = QUIRK_AUDIO_FIXED_ENDPOINT, | ||
2945 | .data = &(const struct audioformat) { | ||
2946 | .formats = SNDRV_PCM_FMTBIT_S24_3BE, | ||
2947 | .channels = 2, | ||
2948 | .iface = 2, | ||
2949 | .altsetting = 2, | ||
2950 | .altset_idx = 1, | ||
2951 | .attributes = 0x00, | ||
2952 | .endpoint = 0x03, | ||
2953 | .ep_attr = USB_ENDPOINT_SYNC_ASYNC, | ||
2954 | .maxpacksize = 0x128, | ||
2955 | .rates = SNDRV_PCM_RATE_48000, | ||
2956 | .rate_min = 48000, | ||
2957 | .rate_max = 48000, | ||
2958 | .nr_rates = 1, | ||
2959 | .rate_table = (unsigned int[]) { | ||
2960 | 48000 | ||
2961 | } | ||
2962 | } | ||
2963 | }, | ||
2964 | { | ||
2965 | .ifnum = 3, | ||
2966 | .type = QUIRK_IGNORE_INTERFACE | ||
2967 | }, | ||
2968 | { | ||
2969 | .ifnum = 4, | ||
2970 | .type = QUIRK_AUDIO_FIXED_ENDPOINT, | ||
2971 | .data = &(const struct audioformat) { | ||
2972 | .formats = SNDRV_PCM_FMTBIT_S24_3BE, | ||
2973 | .channels = 2, | ||
2974 | .iface = 4, | ||
2975 | .altsetting = 2, | ||
2976 | .altset_idx = 1, | ||
2977 | .attributes = UAC_EP_CS_ATTR_SAMPLE_RATE, | ||
2978 | .endpoint = 0x85, | ||
2979 | .ep_attr = USB_ENDPOINT_SYNC_SYNC, | ||
2980 | .maxpacksize = 0x128, | ||
2981 | .rates = SNDRV_PCM_RATE_48000, | ||
2982 | .rate_min = 48000, | ||
2983 | .rate_max = 48000, | ||
2984 | .nr_rates = 1, | ||
2985 | .rate_table = (unsigned int[]) { | ||
2986 | 48000 | ||
2987 | } | ||
2988 | } | ||
2989 | }, | ||
2990 | { | ||
2991 | .ifnum = 5, | ||
2992 | .type = QUIRK_IGNORE_INTERFACE | ||
2993 | }, | ||
2994 | { | ||
2995 | .ifnum = 6, | ||
2996 | .type = QUIRK_MIDI_MBOX2, | ||
2997 | .data = &(const struct snd_usb_midi_endpoint_info) { | ||
2998 | .out_ep = 0x02, | ||
2999 | .out_cables = 0x0001, | ||
3000 | .in_ep = 0x81, | ||
3001 | .in_interval = 0x01, | ||
3002 | .in_cables = 0x0001 | ||
3003 | } | ||
3004 | }, | ||
3005 | { | ||
3006 | .ifnum = -1 | ||
3007 | } | ||
3008 | } | ||
3009 | } | ||
3010 | }, | ||
2888 | { | 3011 | { |
2889 | /* Tascam US122 MKII - playback-only support */ | 3012 | /* Tascam US122 MKII - playback-only support */ |
2890 | .match_flags = USB_DEVICE_ID_MATCH_DEVICE, | 3013 | .match_flags = USB_DEVICE_ID_MATCH_DEVICE, |
diff --git a/sound/usb/quirks.c b/sound/usb/quirks.c index 007fcecdf5cd..f104c68fe1e0 100644 --- a/sound/usb/quirks.c +++ b/sound/usb/quirks.c | |||
@@ -306,6 +306,7 @@ int snd_usb_create_quirk(struct snd_usb_audio *chip, | |||
306 | [QUIRK_MIDI_YAMAHA] = create_any_midi_quirk, | 306 | [QUIRK_MIDI_YAMAHA] = create_any_midi_quirk, |
307 | [QUIRK_MIDI_MIDIMAN] = create_any_midi_quirk, | 307 | [QUIRK_MIDI_MIDIMAN] = create_any_midi_quirk, |
308 | [QUIRK_MIDI_NOVATION] = create_any_midi_quirk, | 308 | [QUIRK_MIDI_NOVATION] = create_any_midi_quirk, |
309 | [QUIRK_MIDI_MBOX2] = create_any_midi_quirk, | ||
309 | [QUIRK_MIDI_RAW_BYTES] = create_any_midi_quirk, | 310 | [QUIRK_MIDI_RAW_BYTES] = create_any_midi_quirk, |
310 | [QUIRK_MIDI_EMAGIC] = create_any_midi_quirk, | 311 | [QUIRK_MIDI_EMAGIC] = create_any_midi_quirk, |
311 | [QUIRK_MIDI_CME] = create_any_midi_quirk, | 312 | [QUIRK_MIDI_CME] = create_any_midi_quirk, |
@@ -497,6 +498,92 @@ static int snd_usb_nativeinstruments_boot_quirk(struct usb_device *dev) | |||
497 | return -EAGAIN; | 498 | return -EAGAIN; |
498 | } | 499 | } |
499 | 500 | ||
501 | static void mbox2_setup_48_24_magic(struct usb_device *dev) | ||
502 | { | ||
503 | u8 srate[3]; | ||
504 | u8 temp[12]; | ||
505 | |||
506 | /* Choose 48000Hz permanently */ | ||
507 | srate[0] = 0x80; | ||
508 | srate[1] = 0xbb; | ||
509 | srate[2] = 0x00; | ||
510 | |||
511 | /* Send the magic! */ | ||
512 | snd_usb_ctl_msg(dev, usb_rcvctrlpipe(dev, 0), | ||
513 | 0x01, 0x22, 0x0100, 0x0085, &temp, 0x0003); | ||
514 | snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev, 0), | ||
515 | 0x81, 0xa2, 0x0100, 0x0085, &srate, 0x0003); | ||
516 | snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev, 0), | ||
517 | 0x81, 0xa2, 0x0100, 0x0086, &srate, 0x0003); | ||
518 | snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev, 0), | ||
519 | 0x81, 0xa2, 0x0100, 0x0003, &srate, 0x0003); | ||
520 | return; | ||
521 | } | ||
522 | |||
523 | /* Digidesign Mbox 2 needs to load firmware onboard | ||
524 | * and driver must wait a few seconds for initialisation. | ||
525 | */ | ||
526 | |||
527 | #define MBOX2_FIRMWARE_SIZE 646 | ||
528 | #define MBOX2_BOOT_LOADING 0x01 /* Hard coded into the device */ | ||
529 | #define MBOX2_BOOT_READY 0x02 /* Hard coded into the device */ | ||
530 | |||
531 | int snd_usb_mbox2_boot_quirk(struct usb_device *dev) | ||
532 | { | ||
533 | struct usb_host_config *config = dev->actconfig; | ||
534 | int err; | ||
535 | u8 bootresponse; | ||
536 | int fwsize; | ||
537 | int count; | ||
538 | |||
539 | fwsize = le16_to_cpu(get_cfg_desc(config)->wTotalLength); | ||
540 | |||
541 | if (fwsize != MBOX2_FIRMWARE_SIZE) { | ||
542 | snd_printk(KERN_ERR "usb-audio: Invalid firmware size=%d.\n", fwsize); | ||
543 | return -ENODEV; | ||
544 | } | ||
545 | |||
546 | snd_printd("usb-audio: Sending Digidesign Mbox 2 boot sequence...\n"); | ||
547 | |||
548 | count = 0; | ||
549 | bootresponse = MBOX2_BOOT_LOADING; | ||
550 | while ((bootresponse == MBOX2_BOOT_LOADING) && (count < 10)) { | ||
551 | msleep(500); /* 0.5 second delay */ | ||
552 | snd_usb_ctl_msg(dev, usb_rcvctrlpipe(dev, 0), | ||
553 | /* Control magic - load onboard firmware */ | ||
554 | 0x85, 0xc0, 0x0001, 0x0000, &bootresponse, 0x0012); | ||
555 | if (bootresponse == MBOX2_BOOT_READY) | ||
556 | break; | ||
557 | snd_printd("usb-audio: device not ready, resending boot sequence...\n"); | ||
558 | count++; | ||
559 | } | ||
560 | |||
561 | if (bootresponse != MBOX2_BOOT_READY) { | ||
562 | snd_printk(KERN_ERR "usb-audio: Unknown bootresponse=%d, or timed out, ignoring device.\n", bootresponse); | ||
563 | return -ENODEV; | ||
564 | } | ||
565 | |||
566 | snd_printdd("usb-audio: device initialised!\n"); | ||
567 | |||
568 | err = usb_get_descriptor(dev, USB_DT_DEVICE, 0, | ||
569 | &dev->descriptor, sizeof(dev->descriptor)); | ||
570 | config = dev->actconfig; | ||
571 | if (err < 0) | ||
572 | snd_printd("error usb_get_descriptor: %d\n", err); | ||
573 | |||
574 | err = usb_reset_configuration(dev); | ||
575 | if (err < 0) | ||
576 | snd_printd("error usb_reset_configuration: %d\n", err); | ||
577 | snd_printdd("mbox2_boot: new boot length = %d\n", | ||
578 | le16_to_cpu(get_cfg_desc(config)->wTotalLength)); | ||
579 | |||
580 | mbox2_setup_48_24_magic(dev); | ||
581 | |||
582 | snd_printk(KERN_INFO "usb-audio: Digidesign Mbox 2: 24bit 48kHz"); | ||
583 | |||
584 | return 0; /* Successful boot */ | ||
585 | } | ||
586 | |||
500 | /* | 587 | /* |
501 | * Setup quirks | 588 | * Setup quirks |
502 | */ | 589 | */ |
@@ -655,6 +742,10 @@ int snd_usb_apply_boot_quirk(struct usb_device *dev, | |||
655 | case USB_ID(0x0ccd, 0x00b1): /* Terratec Aureon 7.1 USB */ | 742 | case USB_ID(0x0ccd, 0x00b1): /* Terratec Aureon 7.1 USB */ |
656 | return snd_usb_cm6206_boot_quirk(dev); | 743 | return snd_usb_cm6206_boot_quirk(dev); |
657 | 744 | ||
745 | case USB_ID(0x0dba, 0x3000): | ||
746 | /* Digidesign Mbox 2 */ | ||
747 | return snd_usb_mbox2_boot_quirk(dev); | ||
748 | |||
658 | case USB_ID(0x133e, 0x0815): | 749 | case USB_ID(0x133e, 0x0815): |
659 | /* Access Music VirusTI Desktop */ | 750 | /* Access Music VirusTI Desktop */ |
660 | return snd_usb_accessmusic_boot_quirk(dev); | 751 | return snd_usb_accessmusic_boot_quirk(dev); |
diff --git a/sound/usb/usbaudio.h b/sound/usb/usbaudio.h index 1ac3fd9cc5a6..a8172c119796 100644 --- a/sound/usb/usbaudio.h +++ b/sound/usb/usbaudio.h | |||
@@ -76,6 +76,7 @@ enum quirk_type { | |||
76 | QUIRK_MIDI_YAMAHA, | 76 | QUIRK_MIDI_YAMAHA, |
77 | QUIRK_MIDI_MIDIMAN, | 77 | QUIRK_MIDI_MIDIMAN, |
78 | QUIRK_MIDI_NOVATION, | 78 | QUIRK_MIDI_NOVATION, |
79 | QUIRK_MIDI_MBOX2, | ||
79 | QUIRK_MIDI_RAW_BYTES, | 80 | QUIRK_MIDI_RAW_BYTES, |
80 | QUIRK_MIDI_EMAGIC, | 81 | QUIRK_MIDI_EMAGIC, |
81 | QUIRK_MIDI_CME, | 82 | QUIRK_MIDI_CME, |
diff --git a/tools/lguest/lguest.c b/tools/lguest/lguest.c index fd2f9221b241..07a03452c227 100644 --- a/tools/lguest/lguest.c +++ b/tools/lguest/lguest.c | |||
@@ -179,29 +179,6 @@ static struct termios orig_term; | |||
179 | #define wmb() __asm__ __volatile__("" : : : "memory") | 179 | #define wmb() __asm__ __volatile__("" : : : "memory") |
180 | #define mb() __asm__ __volatile__("" : : : "memory") | 180 | #define mb() __asm__ __volatile__("" : : : "memory") |
181 | 181 | ||
182 | /* | ||
183 | * Convert an iovec element to the given type. | ||
184 | * | ||
185 | * This is a fairly ugly trick: we need to know the size of the type and | ||
186 | * alignment requirement to check the pointer is kosher. It's also nice to | ||
187 | * have the name of the type in case we report failure. | ||
188 | * | ||
189 | * Typing those three things all the time is cumbersome and error prone, so we | ||
190 | * have a macro which sets them all up and passes to the real function. | ||
191 | */ | ||
192 | #define convert(iov, type) \ | ||
193 | ((type *)_convert((iov), sizeof(type), __alignof__(type), #type)) | ||
194 | |||
195 | static void *_convert(struct iovec *iov, size_t size, size_t align, | ||
196 | const char *name) | ||
197 | { | ||
198 | if (iov->iov_len != size) | ||
199 | errx(1, "Bad iovec size %zu for %s", iov->iov_len, name); | ||
200 | if ((unsigned long)iov->iov_base % align != 0) | ||
201 | errx(1, "Bad alignment %p for %s", iov->iov_base, name); | ||
202 | return iov->iov_base; | ||
203 | } | ||
204 | |||
205 | /* Wrapper for the last available index. Makes it easier to change. */ | 182 | /* Wrapper for the last available index. Makes it easier to change. */ |
206 | #define lg_last_avail(vq) ((vq)->last_avail_idx) | 183 | #define lg_last_avail(vq) ((vq)->last_avail_idx) |
207 | 184 | ||
@@ -228,7 +205,8 @@ static bool iov_empty(const struct iovec iov[], unsigned int num_iov) | |||
228 | } | 205 | } |
229 | 206 | ||
230 | /* Take len bytes from the front of this iovec. */ | 207 | /* Take len bytes from the front of this iovec. */ |
231 | static void iov_consume(struct iovec iov[], unsigned num_iov, unsigned len) | 208 | static void iov_consume(struct iovec iov[], unsigned num_iov, |
209 | void *dest, unsigned len) | ||
232 | { | 210 | { |
233 | unsigned int i; | 211 | unsigned int i; |
234 | 212 | ||
@@ -236,11 +214,16 @@ static void iov_consume(struct iovec iov[], unsigned num_iov, unsigned len) | |||
236 | unsigned int used; | 214 | unsigned int used; |
237 | 215 | ||
238 | used = iov[i].iov_len < len ? iov[i].iov_len : len; | 216 | used = iov[i].iov_len < len ? iov[i].iov_len : len; |
217 | if (dest) { | ||
218 | memcpy(dest, iov[i].iov_base, used); | ||
219 | dest += used; | ||
220 | } | ||
239 | iov[i].iov_base += used; | 221 | iov[i].iov_base += used; |
240 | iov[i].iov_len -= used; | 222 | iov[i].iov_len -= used; |
241 | len -= used; | 223 | len -= used; |
242 | } | 224 | } |
243 | assert(len == 0); | 225 | if (len != 0) |
226 | errx(1, "iovec too short!"); | ||
244 | } | 227 | } |
245 | 228 | ||
246 | /* The device virtqueue descriptors are followed by feature bitmasks. */ | 229 | /* The device virtqueue descriptors are followed by feature bitmasks. */ |
@@ -864,7 +847,7 @@ static void console_output(struct virtqueue *vq) | |||
864 | warn("Write to stdout gave %i (%d)", len, errno); | 847 | warn("Write to stdout gave %i (%d)", len, errno); |
865 | break; | 848 | break; |
866 | } | 849 | } |
867 | iov_consume(iov, out, len); | 850 | iov_consume(iov, out, NULL, len); |
868 | } | 851 | } |
869 | 852 | ||
870 | /* | 853 | /* |
@@ -1591,9 +1574,9 @@ static void blk_request(struct virtqueue *vq) | |||
1591 | { | 1574 | { |
1592 | struct vblk_info *vblk = vq->dev->priv; | 1575 | struct vblk_info *vblk = vq->dev->priv; |
1593 | unsigned int head, out_num, in_num, wlen; | 1576 | unsigned int head, out_num, in_num, wlen; |
1594 | int ret; | 1577 | int ret, i; |
1595 | u8 *in; | 1578 | u8 *in; |
1596 | struct virtio_blk_outhdr *out; | 1579 | struct virtio_blk_outhdr out; |
1597 | struct iovec iov[vq->vring.num]; | 1580 | struct iovec iov[vq->vring.num]; |
1598 | off64_t off; | 1581 | off64_t off; |
1599 | 1582 | ||
@@ -1603,32 +1586,36 @@ static void blk_request(struct virtqueue *vq) | |||
1603 | */ | 1586 | */ |
1604 | head = wait_for_vq_desc(vq, iov, &out_num, &in_num); | 1587 | head = wait_for_vq_desc(vq, iov, &out_num, &in_num); |
1605 | 1588 | ||
1606 | /* | 1589 | /* Copy the output header from the front of the iov (adjusts iov) */ |
1607 | * Every block request should contain at least one output buffer | 1590 | iov_consume(iov, out_num, &out, sizeof(out)); |
1608 | * (detailing the location on disk and the type of request) and one | 1591 | |
1609 | * input buffer (to hold the result). | 1592 | /* Find and trim end of iov input array, for our status byte. */ |
1610 | */ | 1593 | in = NULL; |
1611 | if (out_num == 0 || in_num == 0) | 1594 | for (i = out_num + in_num - 1; i >= out_num; i--) { |
1612 | errx(1, "Bad virtblk cmd %u out=%u in=%u", | 1595 | if (iov[i].iov_len > 0) { |
1613 | head, out_num, in_num); | 1596 | in = iov[i].iov_base + iov[i].iov_len - 1; |
1597 | iov[i].iov_len--; | ||
1598 | break; | ||
1599 | } | ||
1600 | } | ||
1601 | if (!in) | ||
1602 | errx(1, "Bad virtblk cmd with no room for status"); | ||
1614 | 1603 | ||
1615 | out = convert(&iov[0], struct virtio_blk_outhdr); | ||
1616 | in = convert(&iov[out_num+in_num-1], u8); | ||
1617 | /* | 1604 | /* |
1618 | * For historical reasons, block operations are expressed in 512 byte | 1605 | * For historical reasons, block operations are expressed in 512 byte |
1619 | * "sectors". | 1606 | * "sectors". |
1620 | */ | 1607 | */ |
1621 | off = out->sector * 512; | 1608 | off = out.sector * 512; |
1622 | 1609 | ||
1623 | /* | 1610 | /* |
1624 | * In general the virtio block driver is allowed to try SCSI commands. | 1611 | * In general the virtio block driver is allowed to try SCSI commands. |
1625 | * It'd be nice if we supported eject, for example, but we don't. | 1612 | * It'd be nice if we supported eject, for example, but we don't. |
1626 | */ | 1613 | */ |
1627 | if (out->type & VIRTIO_BLK_T_SCSI_CMD) { | 1614 | if (out.type & VIRTIO_BLK_T_SCSI_CMD) { |
1628 | fprintf(stderr, "Scsi commands unsupported\n"); | 1615 | fprintf(stderr, "Scsi commands unsupported\n"); |
1629 | *in = VIRTIO_BLK_S_UNSUPP; | 1616 | *in = VIRTIO_BLK_S_UNSUPP; |
1630 | wlen = sizeof(*in); | 1617 | wlen = sizeof(*in); |
1631 | } else if (out->type & VIRTIO_BLK_T_OUT) { | 1618 | } else if (out.type & VIRTIO_BLK_T_OUT) { |
1632 | /* | 1619 | /* |
1633 | * Write | 1620 | * Write |
1634 | * | 1621 | * |
@@ -1636,10 +1623,10 @@ static void blk_request(struct virtqueue *vq) | |||
1636 | * if they try to write past end. | 1623 | * if they try to write past end. |
1637 | */ | 1624 | */ |
1638 | if (lseek64(vblk->fd, off, SEEK_SET) != off) | 1625 | if (lseek64(vblk->fd, off, SEEK_SET) != off) |
1639 | err(1, "Bad seek to sector %llu", out->sector); | 1626 | err(1, "Bad seek to sector %llu", out.sector); |
1640 | 1627 | ||
1641 | ret = writev(vblk->fd, iov+1, out_num-1); | 1628 | ret = writev(vblk->fd, iov, out_num); |
1642 | verbose("WRITE to sector %llu: %i\n", out->sector, ret); | 1629 | verbose("WRITE to sector %llu: %i\n", out.sector, ret); |
1643 | 1630 | ||
1644 | /* | 1631 | /* |
1645 | * Grr... Now we know how long the descriptor they sent was, we | 1632 | * Grr... Now we know how long the descriptor they sent was, we |
@@ -1655,7 +1642,7 @@ static void blk_request(struct virtqueue *vq) | |||
1655 | 1642 | ||
1656 | wlen = sizeof(*in); | 1643 | wlen = sizeof(*in); |
1657 | *in = (ret >= 0 ? VIRTIO_BLK_S_OK : VIRTIO_BLK_S_IOERR); | 1644 | *in = (ret >= 0 ? VIRTIO_BLK_S_OK : VIRTIO_BLK_S_IOERR); |
1658 | } else if (out->type & VIRTIO_BLK_T_FLUSH) { | 1645 | } else if (out.type & VIRTIO_BLK_T_FLUSH) { |
1659 | /* Flush */ | 1646 | /* Flush */ |
1660 | ret = fdatasync(vblk->fd); | 1647 | ret = fdatasync(vblk->fd); |
1661 | verbose("FLUSH fdatasync: %i\n", ret); | 1648 | verbose("FLUSH fdatasync: %i\n", ret); |
@@ -1669,10 +1656,9 @@ static void blk_request(struct virtqueue *vq) | |||
1669 | * if they try to read past end. | 1656 | * if they try to read past end. |
1670 | */ | 1657 | */ |
1671 | if (lseek64(vblk->fd, off, SEEK_SET) != off) | 1658 | if (lseek64(vblk->fd, off, SEEK_SET) != off) |
1672 | err(1, "Bad seek to sector %llu", out->sector); | 1659 | err(1, "Bad seek to sector %llu", out.sector); |
1673 | 1660 | ||
1674 | ret = readv(vblk->fd, iov+1, in_num-1); | 1661 | ret = readv(vblk->fd, iov + out_num, in_num); |
1675 | verbose("READ from sector %llu: %i\n", out->sector, ret); | ||
1676 | if (ret >= 0) { | 1662 | if (ret >= 0) { |
1677 | wlen = sizeof(*in) + ret; | 1663 | wlen = sizeof(*in) + ret; |
1678 | *in = VIRTIO_BLK_S_OK; | 1664 | *in = VIRTIO_BLK_S_OK; |
@@ -1758,7 +1744,7 @@ static void rng_input(struct virtqueue *vq) | |||
1758 | len = readv(rng_info->rfd, iov, in_num); | 1744 | len = readv(rng_info->rfd, iov, in_num); |
1759 | if (len <= 0) | 1745 | if (len <= 0) |
1760 | err(1, "Read from /dev/random gave %i", len); | 1746 | err(1, "Read from /dev/random gave %i", len); |
1761 | iov_consume(iov, in_num, len); | 1747 | iov_consume(iov, in_num, NULL, len); |
1762 | totlen += len; | 1748 | totlen += len; |
1763 | } | 1749 | } |
1764 | 1750 | ||
diff --git a/tools/virtio/virtio_test.c b/tools/virtio/virtio_test.c index 6d25dcd2e97a..fcc9aa25fd08 100644 --- a/tools/virtio/virtio_test.c +++ b/tools/virtio/virtio_test.c | |||
@@ -164,7 +164,7 @@ static void run_test(struct vdev_info *dev, struct vq_info *vq, | |||
164 | r = virtqueue_add_buf(vq->vq, &sl, 1, 0, | 164 | r = virtqueue_add_buf(vq->vq, &sl, 1, 0, |
165 | dev->buf + started, | 165 | dev->buf + started, |
166 | GFP_ATOMIC); | 166 | GFP_ATOMIC); |
167 | if (likely(r >= 0)) { | 167 | if (likely(r == 0)) { |
168 | ++started; | 168 | ++started; |
169 | virtqueue_kick(vq->vq); | 169 | virtqueue_kick(vq->vq); |
170 | } | 170 | } |
@@ -177,7 +177,7 @@ static void run_test(struct vdev_info *dev, struct vq_info *vq, | |||
177 | r = 0; | 177 | r = 0; |
178 | } | 178 | } |
179 | 179 | ||
180 | } while (r >= 0); | 180 | } while (r == 0); |
181 | if (completed == completed_before) | 181 | if (completed == completed_before) |
182 | ++spurious; | 182 | ++spurious; |
183 | assert(completed <= bufs); | 183 | assert(completed <= bufs); |