diff options
213 files changed, 4686 insertions, 2022 deletions
diff --git a/Documentation/00-INDEX b/Documentation/00-INDEX index a1a643272883..2214f123a976 100644 --- a/Documentation/00-INDEX +++ b/Documentation/00-INDEX | |||
@@ -104,6 +104,8 @@ cpuidle/ | |||
104 | - info on CPU_IDLE, CPU idle state management subsystem. | 104 | - info on CPU_IDLE, CPU idle state management subsystem. |
105 | cputopology.txt | 105 | cputopology.txt |
106 | - documentation on how CPU topology info is exported via sysfs. | 106 | - documentation on how CPU topology info is exported via sysfs. |
107 | crc32.txt | ||
108 | - brief tutorial on CRC computation | ||
107 | cris/ | 109 | cris/ |
108 | - directory with info about Linux on CRIS architecture. | 110 | - directory with info about Linux on CRIS architecture. |
109 | crypto/ | 111 | crypto/ |
diff --git a/Documentation/backlight/lp855x-driver.txt b/Documentation/backlight/lp855x-driver.txt new file mode 100644 index 000000000000..f5e4caafab7d --- /dev/null +++ b/Documentation/backlight/lp855x-driver.txt | |||
@@ -0,0 +1,78 @@ | |||
1 | Kernel driver lp855x | ||
2 | ==================== | ||
3 | |||
4 | Backlight driver for LP855x ICs | ||
5 | |||
6 | Supported chips: | ||
7 | Texas Instruments LP8550, LP8551, LP8552, LP8553 and LP8556 | ||
8 | |||
9 | Author: Milo(Woogyom) Kim <milo.kim@ti.com> | ||
10 | |||
11 | Description | ||
12 | ----------- | ||
13 | |||
14 | * Brightness control | ||
15 | |||
16 | Brightness can be controlled by the pwm input or the i2c command. | ||
17 | The lp855x driver supports both cases. | ||
18 | |||
19 | * Device attributes | ||
20 | |||
21 | 1) bl_ctl_mode | ||
22 | Backlight control mode. | ||
23 | Value : pwm based or register based | ||
24 | |||
25 | 2) chip_id | ||
26 | The lp855x chip id. | ||
27 | Value : lp8550/lp8551/lp8552/lp8553/lp8556 | ||
28 | |||
29 | Platform data for lp855x | ||
30 | ------------------------ | ||
31 | |||
32 | For supporting platform specific data, the lp855x platform data can be used. | ||
33 | |||
34 | * name : Backlight driver name. If it is not defined, default name is set. | ||
35 | * mode : Brightness control mode. PWM or register based. | ||
36 | * device_control : Value of DEVICE CONTROL register. | ||
37 | * initial_brightness : Initial value of backlight brightness. | ||
38 | * pwm_data : Platform specific pwm generation functions. | ||
39 | Only valid when brightness is pwm input mode. | ||
40 | Functions should be implemented by PWM driver. | ||
41 | - pwm_set_intensity() : set duty of PWM | ||
42 | - pwm_get_intensity() : get current duty of PWM | ||
43 | * load_new_rom_data : | ||
44 | 0 : use default configuration data | ||
45 | 1 : update values of eeprom or eprom registers on loading driver | ||
46 | * size_program : Total size of lp855x_rom_data. | ||
47 | * rom_data : List of new eeprom/eprom registers. | ||
48 | |||
49 | example 1) lp8552 platform data : i2c register mode with new eeprom data | ||
50 | |||
51 | #define EEPROM_A5_ADDR 0xA5 | ||
52 | #define EEPROM_A5_VAL 0x4f /* EN_VSYNC=0 */ | ||
53 | |||
54 | static struct lp855x_rom_data lp8552_eeprom_arr[] = { | ||
55 | {EEPROM_A5_ADDR, EEPROM_A5_VAL}, | ||
56 | }; | ||
57 | |||
58 | static struct lp855x_platform_data lp8552_pdata = { | ||
59 | .name = "lcd-bl", | ||
60 | .mode = REGISTER_BASED, | ||
61 | .device_control = I2C_CONFIG(LP8552), | ||
62 | .initial_brightness = INITIAL_BRT, | ||
63 | .load_new_rom_data = 1, | ||
64 | .size_program = ARRAY_SIZE(lp8552_eeprom_arr), | ||
65 | .rom_data = lp8552_eeprom_arr, | ||
66 | }; | ||
67 | |||
68 | example 2) lp8556 platform data : pwm input mode with default rom data | ||
69 | |||
70 | static struct lp855x_platform_data lp8556_pdata = { | ||
71 | .mode = PWM_BASED, | ||
72 | .device_control = PWM_CONFIG(LP8556), | ||
73 | .initial_brightness = INITIAL_BRT, | ||
74 | .pwm_data = { | ||
75 | .pwm_set_intensity = platform_pwm_set_intensity, | ||
76 | .pwm_get_intensity = platform_pwm_get_intensity, | ||
77 | }, | ||
78 | }; | ||
diff --git a/Documentation/crc32.txt b/Documentation/crc32.txt new file mode 100644 index 000000000000..a08a7dd9d625 --- /dev/null +++ b/Documentation/crc32.txt | |||
@@ -0,0 +1,182 @@ | |||
1 | A brief CRC tutorial. | ||
2 | |||
3 | A CRC is a long-division remainder. You add the CRC to the message, | ||
4 | and the whole thing (message+CRC) is a multiple of the given | ||
5 | CRC polynomial. To check the CRC, you can either check that the | ||
6 | CRC matches the recomputed value, *or* you can check that the | ||
7 | remainder computed on the message+CRC is 0. This latter approach | ||
8 | is used by a lot of hardware implementations, and is why so many | ||
9 | protocols put the end-of-frame flag after the CRC. | ||
10 | |||
11 | It's actually the same long division you learned in school, except that | ||
12 | - We're working in binary, so the digits are only 0 and 1, and | ||
13 | - When dividing polynomials, there are no carries. Rather than add and | ||
14 | subtract, we just xor. Thus, we tend to get a bit sloppy about | ||
15 | the difference between adding and subtracting. | ||
16 | |||
17 | Like all division, the remainder is always smaller than the divisor. | ||
18 | To produce a 32-bit CRC, the divisor is actually a 33-bit CRC polynomial. | ||
19 | Since it's 33 bits long, bit 32 is always going to be set, so usually the | ||
20 | CRC is written in hex with the most significant bit omitted. (If you're | ||
21 | familiar with the IEEE 754 floating-point format, it's the same idea.) | ||
22 | |||
23 | Note that a CRC is computed over a string of *bits*, so you have | ||
24 | to decide on the endianness of the bits within each byte. To get | ||
25 | the best error-detecting properties, this should correspond to the | ||
26 | order they're actually sent. For example, standard RS-232 serial is | ||
27 | little-endian; the most significant bit (sometimes used for parity) | ||
28 | is sent last. And when appending a CRC word to a message, you should | ||
29 | do it in the right order, matching the endianness. | ||
30 | |||
31 | Just like with ordinary division, you proceed one digit (bit) at a time. | ||
32 | Each step of the division you take one more digit (bit) of the dividend | ||
33 | and append it to the current remainder. Then you figure out the | ||
34 | appropriate multiple of the divisor to subtract to being the remainder | ||
35 | back into range. In binary, this is easy - it has to be either 0 or 1, | ||
36 | and to make the XOR cancel, it's just a copy of bit 32 of the remainder. | ||
37 | |||
38 | When computing a CRC, we don't care about the quotient, so we can | ||
39 | throw the quotient bit away, but subtract the appropriate multiple of | ||
40 | the polynomial from the remainder and we're back to where we started, | ||
41 | ready to process the next bit. | ||
42 | |||
43 | A big-endian CRC written this way would be coded like: | ||
44 | for (i = 0; i < input_bits; i++) { | ||
45 | multiple = remainder & 0x80000000 ? CRCPOLY : 0; | ||
46 | remainder = (remainder << 1 | next_input_bit()) ^ multiple; | ||
47 | } | ||
48 | |||
49 | Notice how, to get at bit 32 of the shifted remainder, we look | ||
50 | at bit 31 of the remainder *before* shifting it. | ||
51 | |||
52 | But also notice how the next_input_bit() bits we're shifting into | ||
53 | the remainder don't actually affect any decision-making until | ||
54 | 32 bits later. Thus, the first 32 cycles of this are pretty boring. | ||
55 | Also, to add the CRC to a message, we need a 32-bit-long hole for it at | ||
56 | the end, so we have to add 32 extra cycles shifting in zeros at the | ||
57 | end of every message, | ||
58 | |||
59 | These details lead to a standard trick: rearrange merging in the | ||
60 | next_input_bit() until the moment it's needed. Then the first 32 cycles | ||
61 | can be precomputed, and merging in the final 32 zero bits to make room | ||
62 | for the CRC can be skipped entirely. This changes the code to: | ||
63 | |||
64 | for (i = 0; i < input_bits; i++) { | ||
65 | remainder ^= next_input_bit() << 31; | ||
66 | multiple = (remainder & 0x80000000) ? CRCPOLY : 0; | ||
67 | remainder = (remainder << 1) ^ multiple; | ||
68 | } | ||
69 | |||
70 | With this optimization, the little-endian code is particularly simple: | ||
71 | for (i = 0; i < input_bits; i++) { | ||
72 | remainder ^= next_input_bit(); | ||
73 | multiple = (remainder & 1) ? CRCPOLY : 0; | ||
74 | remainder = (remainder >> 1) ^ multiple; | ||
75 | } | ||
76 | |||
77 | The most significant coefficient of the remainder polynomial is stored | ||
78 | in the least significant bit of the binary "remainder" variable. | ||
79 | The other details of endianness have been hidden in CRCPOLY (which must | ||
80 | be bit-reversed) and next_input_bit(). | ||
81 | |||
82 | As long as next_input_bit is returning the bits in a sensible order, we don't | ||
83 | *have* to wait until the last possible moment to merge in additional bits. | ||
84 | We can do it 8 bits at a time rather than 1 bit at a time: | ||
85 | for (i = 0; i < input_bytes; i++) { | ||
86 | remainder ^= next_input_byte() << 24; | ||
87 | for (j = 0; j < 8; j++) { | ||
88 | multiple = (remainder & 0x80000000) ? CRCPOLY : 0; | ||
89 | remainder = (remainder << 1) ^ multiple; | ||
90 | } | ||
91 | } | ||
92 | |||
93 | Or in little-endian: | ||
94 | for (i = 0; i < input_bytes; i++) { | ||
95 | remainder ^= next_input_byte(); | ||
96 | for (j = 0; j < 8; j++) { | ||
97 | multiple = (remainder & 1) ? CRCPOLY : 0; | ||
98 | remainder = (remainder >> 1) ^ multiple; | ||
99 | } | ||
100 | } | ||
101 | |||
102 | If the input is a multiple of 32 bits, you can even XOR in a 32-bit | ||
103 | word at a time and increase the inner loop count to 32. | ||
104 | |||
105 | You can also mix and match the two loop styles, for example doing the | ||
106 | bulk of a message byte-at-a-time and adding bit-at-a-time processing | ||
107 | for any fractional bytes at the end. | ||
108 | |||
109 | To reduce the number of conditional branches, software commonly uses | ||
110 | the byte-at-a-time table method, popularized by Dilip V. Sarwate, | ||
111 | "Computation of Cyclic Redundancy Checks via Table Look-Up", Comm. ACM | ||
112 | v.31 no.8 (August 1998) p. 1008-1013. | ||
113 | |||
114 | Here, rather than just shifting one bit of the remainder to decide | ||
115 | in the correct multiple to subtract, we can shift a byte at a time. | ||
116 | This produces a 40-bit (rather than a 33-bit) intermediate remainder, | ||
117 | and the correct multiple of the polynomial to subtract is found using | ||
118 | a 256-entry lookup table indexed by the high 8 bits. | ||
119 | |||
120 | (The table entries are simply the CRC-32 of the given one-byte messages.) | ||
121 | |||
122 | When space is more constrained, smaller tables can be used, e.g. two | ||
123 | 4-bit shifts followed by a lookup in a 16-entry table. | ||
124 | |||
125 | It is not practical to process much more than 8 bits at a time using this | ||
126 | technique, because tables larger than 256 entries use too much memory and, | ||
127 | more importantly, too much of the L1 cache. | ||
128 | |||
129 | To get higher software performance, a "slicing" technique can be used. | ||
130 | See "High Octane CRC Generation with the Intel Slicing-by-8 Algorithm", | ||
131 | ftp://download.intel.com/technology/comms/perfnet/download/slicing-by-8.pdf | ||
132 | |||
133 | This does not change the number of table lookups, but does increase | ||
134 | the parallelism. With the classic Sarwate algorithm, each table lookup | ||
135 | must be completed before the index of the next can be computed. | ||
136 | |||
137 | A "slicing by 2" technique would shift the remainder 16 bits at a time, | ||
138 | producing a 48-bit intermediate remainder. Rather than doing a single | ||
139 | lookup in a 65536-entry table, the two high bytes are looked up in | ||
140 | two different 256-entry tables. Each contains the remainder required | ||
141 | to cancel out the corresponding byte. The tables are different because the | ||
142 | polynomials to cancel are different. One has non-zero coefficients from | ||
143 | x^32 to x^39, while the other goes from x^40 to x^47. | ||
144 | |||
145 | Since modern processors can handle many parallel memory operations, this | ||
146 | takes barely longer than a single table look-up and thus performs almost | ||
147 | twice as fast as the basic Sarwate algorithm. | ||
148 | |||
149 | This can be extended to "slicing by 4" using 4 256-entry tables. | ||
150 | Each step, 32 bits of data is fetched, XORed with the CRC, and the result | ||
151 | broken into bytes and looked up in the tables. Because the 32-bit shift | ||
152 | leaves the low-order bits of the intermediate remainder zero, the | ||
153 | final CRC is simply the XOR of the 4 table look-ups. | ||
154 | |||
155 | But this still enforces sequential execution: a second group of table | ||
156 | look-ups cannot begin until the previous groups 4 table look-ups have all | ||
157 | been completed. Thus, the processor's load/store unit is sometimes idle. | ||
158 | |||
159 | To make maximum use of the processor, "slicing by 8" performs 8 look-ups | ||
160 | in parallel. Each step, the 32-bit CRC is shifted 64 bits and XORed | ||
161 | with 64 bits of input data. What is important to note is that 4 of | ||
162 | those 8 bytes are simply copies of the input data; they do not depend | ||
163 | on the previous CRC at all. Thus, those 4 table look-ups may commence | ||
164 | immediately, without waiting for the previous loop iteration. | ||
165 | |||
166 | By always having 4 loads in flight, a modern superscalar processor can | ||
167 | be kept busy and make full use of its L1 cache. | ||
168 | |||
169 | Two more details about CRC implementation in the real world: | ||
170 | |||
171 | Normally, appending zero bits to a message which is already a multiple | ||
172 | of a polynomial produces a larger multiple of that polynomial. Thus, | ||
173 | a basic CRC will not detect appended zero bits (or bytes). To enable | ||
174 | a CRC to detect this condition, it's common to invert the CRC before | ||
175 | appending it. This makes the remainder of the message+crc come out not | ||
176 | as zero, but some fixed non-zero value. (The CRC of the inversion | ||
177 | pattern, 0xffffffff.) | ||
178 | |||
179 | The same problem applies to zero bits prepended to the message, and a | ||
180 | similar solution is used. Instead of starting the CRC computation with | ||
181 | a remainder of 0, an initial remainder of all ones is used. As long as | ||
182 | you start the same way on decoding, it doesn't make a difference. | ||
diff --git a/Documentation/leds/leds-lp5521.txt b/Documentation/leds/leds-lp5521.txt index c4d8d151e0fe..0e542ab3d4a0 100644 --- a/Documentation/leds/leds-lp5521.txt +++ b/Documentation/leds/leds-lp5521.txt | |||
@@ -43,17 +43,23 @@ Format: 10x mA i.e 10 means 1.0 mA | |||
43 | example platform data: | 43 | example platform data: |
44 | 44 | ||
45 | Note: chan_nr can have values between 0 and 2. | 45 | Note: chan_nr can have values between 0 and 2. |
46 | The name of each channel can be configurable. | ||
47 | If the name field is not defined, the default name will be set to 'xxxx:channelN' | ||
48 | (XXXX : pdata->label or i2c client name, N : channel number) | ||
46 | 49 | ||
47 | static struct lp5521_led_config lp5521_led_config[] = { | 50 | static struct lp5521_led_config lp5521_led_config[] = { |
48 | { | 51 | { |
52 | .name = "red", | ||
49 | .chan_nr = 0, | 53 | .chan_nr = 0, |
50 | .led_current = 50, | 54 | .led_current = 50, |
51 | .max_current = 130, | 55 | .max_current = 130, |
52 | }, { | 56 | }, { |
57 | .name = "green", | ||
53 | .chan_nr = 1, | 58 | .chan_nr = 1, |
54 | .led_current = 0, | 59 | .led_current = 0, |
55 | .max_current = 130, | 60 | .max_current = 130, |
56 | }, { | 61 | }, { |
62 | .name = "blue", | ||
57 | .chan_nr = 2, | 63 | .chan_nr = 2, |
58 | .led_current = 0, | 64 | .led_current = 0, |
59 | .max_current = 130, | 65 | .max_current = 130, |
@@ -86,3 +92,60 @@ static struct lp5521_platform_data lp5521_platform_data = { | |||
86 | 92 | ||
87 | If the current is set to 0 in the platform data, that channel is | 93 | If the current is set to 0 in the platform data, that channel is |
88 | disabled and it is not visible in the sysfs. | 94 | disabled and it is not visible in the sysfs. |
95 | |||
96 | The 'update_config' : CONFIG register (ADDR 08h) | ||
97 | This value is platform-specific data. | ||
98 | If update_config is not defined, the CONFIG register is set with | ||
99 | 'LP5521_PWRSAVE_EN | LP5521_CP_MODE_AUTO | LP5521_R_TO_BATT'. | ||
100 | (Enable auto-powersave, set charge pump to auto, red to battery) | ||
101 | |||
102 | example of update_config : | ||
103 | |||
104 | #define LP5521_CONFIGS (LP5521_PWM_HF | LP5521_PWRSAVE_EN | \ | ||
105 | LP5521_CP_MODE_AUTO | LP5521_R_TO_BATT | \ | ||
106 | LP5521_CLK_INT) | ||
107 | |||
108 | static struct lp5521_platform_data lp5521_pdata = { | ||
109 | .led_config = lp5521_led_config, | ||
110 | .num_channels = ARRAY_SIZE(lp5521_led_config), | ||
111 | .clock_mode = LP5521_CLOCK_INT, | ||
112 | .update_config = LP5521_CONFIGS, | ||
113 | }; | ||
114 | |||
115 | LED patterns : LP5521 has autonomous operation without external control. | ||
116 | Pattern data can be defined in the platform data. | ||
117 | |||
118 | example of led pattern data : | ||
119 | |||
120 | /* RGB(50,5,0) 500ms on, 500ms off, infinite loop */ | ||
121 | static u8 pattern_red[] = { | ||
122 | 0x40, 0x32, 0x60, 0x00, 0x40, 0x00, 0x60, 0x00, | ||
123 | }; | ||
124 | |||
125 | static u8 pattern_green[] = { | ||
126 | 0x40, 0x05, 0x60, 0x00, 0x40, 0x00, 0x60, 0x00, | ||
127 | }; | ||
128 | |||
129 | static struct lp5521_led_pattern board_led_patterns[] = { | ||
130 | { | ||
131 | .r = pattern_red, | ||
132 | .g = pattern_green, | ||
133 | .size_r = ARRAY_SIZE(pattern_red), | ||
134 | .size_g = ARRAY_SIZE(pattern_green), | ||
135 | }, | ||
136 | }; | ||
137 | |||
138 | static struct lp5521_platform_data lp5521_platform_data = { | ||
139 | .led_config = lp5521_led_config, | ||
140 | .num_channels = ARRAY_SIZE(lp5521_led_config), | ||
141 | .clock_mode = LP5521_CLOCK_EXT, | ||
142 | .patterns = board_led_patterns, | ||
143 | .num_patterns = ARRAY_SIZE(board_led_patterns), | ||
144 | }; | ||
145 | |||
146 | Then predefined led pattern(s) can be executed via the sysfs. | ||
147 | To start the pattern #1, | ||
148 | # echo 1 > /sys/bus/i2c/devices/xxxx/led_pattern | ||
149 | (xxxx : i2c bus & slave address) | ||
150 | To end the pattern, | ||
151 | # echo 0 > /sys/bus/i2c/devices/xxxx/led_pattern | ||
diff --git a/MAINTAINERS b/MAINTAINERS index ec9bcb17c572..f47091abb8f7 100644 --- a/MAINTAINERS +++ b/MAINTAINERS | |||
@@ -163,7 +163,7 @@ M: Greg Kroah-Hartman <gregkh@linuxfoundation.org> | |||
163 | L: linux-serial@vger.kernel.org | 163 | L: linux-serial@vger.kernel.org |
164 | W: http://serial.sourceforge.net | 164 | W: http://serial.sourceforge.net |
165 | S: Maintained | 165 | S: Maintained |
166 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty-2.6.git | 166 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty.git |
167 | F: drivers/tty/serial/8250* | 167 | F: drivers/tty/serial/8250* |
168 | F: include/linux/serial_8250.h | 168 | F: include/linux/serial_8250.h |
169 | 169 | ||
@@ -464,6 +464,7 @@ ALPHA PORT | |||
464 | M: Richard Henderson <rth@twiddle.net> | 464 | M: Richard Henderson <rth@twiddle.net> |
465 | M: Ivan Kokshaysky <ink@jurassic.park.msu.ru> | 465 | M: Ivan Kokshaysky <ink@jurassic.park.msu.ru> |
466 | M: Matt Turner <mattst88@gmail.com> | 466 | M: Matt Turner <mattst88@gmail.com> |
467 | S: Odd Fixes | ||
467 | L: linux-alpha@vger.kernel.org | 468 | L: linux-alpha@vger.kernel.org |
468 | F: arch/alpha/ | 469 | F: arch/alpha/ |
469 | 470 | ||
@@ -715,6 +716,7 @@ S: Maintained | |||
715 | ARM/CLKDEV SUPPORT | 716 | ARM/CLKDEV SUPPORT |
716 | M: Russell King <linux@arm.linux.org.uk> | 717 | M: Russell King <linux@arm.linux.org.uk> |
717 | L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) | 718 | L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) |
719 | S: Maintained | ||
718 | F: arch/arm/include/asm/clkdev.h | 720 | F: arch/arm/include/asm/clkdev.h |
719 | F: drivers/clk/clkdev.c | 721 | F: drivers/clk/clkdev.c |
720 | 722 | ||
@@ -1502,7 +1504,7 @@ F: drivers/i2c/busses/i2c-bfin-twi.c | |||
1502 | 1504 | ||
1503 | BLOCK LAYER | 1505 | BLOCK LAYER |
1504 | M: Jens Axboe <axboe@kernel.dk> | 1506 | M: Jens Axboe <axboe@kernel.dk> |
1505 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux-2.6-block.git | 1507 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux-block.git |
1506 | S: Maintained | 1508 | S: Maintained |
1507 | F: block/ | 1509 | F: block/ |
1508 | 1510 | ||
@@ -1640,7 +1642,7 @@ BTTV VIDEO4LINUX DRIVER | |||
1640 | M: Mauro Carvalho Chehab <mchehab@infradead.org> | 1642 | M: Mauro Carvalho Chehab <mchehab@infradead.org> |
1641 | L: linux-media@vger.kernel.org | 1643 | L: linux-media@vger.kernel.org |
1642 | W: http://linuxtv.org | 1644 | W: http://linuxtv.org |
1643 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-2.6.git | 1645 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media.git |
1644 | S: Maintained | 1646 | S: Maintained |
1645 | F: Documentation/video4linux/bttv/ | 1647 | F: Documentation/video4linux/bttv/ |
1646 | F: drivers/media/video/bt8xx/bttv* | 1648 | F: drivers/media/video/bt8xx/bttv* |
@@ -1670,7 +1672,7 @@ F: fs/cachefiles/ | |||
1670 | CAFE CMOS INTEGRATED CAMERA CONTROLLER DRIVER | 1672 | CAFE CMOS INTEGRATED CAMERA CONTROLLER DRIVER |
1671 | M: Jonathan Corbet <corbet@lwn.net> | 1673 | M: Jonathan Corbet <corbet@lwn.net> |
1672 | L: linux-media@vger.kernel.org | 1674 | L: linux-media@vger.kernel.org |
1673 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-2.6.git | 1675 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media.git |
1674 | S: Maintained | 1676 | S: Maintained |
1675 | F: Documentation/video4linux/cafe_ccic | 1677 | F: Documentation/video4linux/cafe_ccic |
1676 | F: drivers/media/video/marvell-ccic/ | 1678 | F: drivers/media/video/marvell-ccic/ |
@@ -1841,6 +1843,7 @@ F: include/linux/cleancache.h | |||
1841 | 1843 | ||
1842 | CLK API | 1844 | CLK API |
1843 | M: Russell King <linux@arm.linux.org.uk> | 1845 | M: Russell King <linux@arm.linux.org.uk> |
1846 | S: Maintained | ||
1844 | F: include/linux/clk.h | 1847 | F: include/linux/clk.h |
1845 | 1848 | ||
1846 | CISCO FCOE HBA DRIVER | 1849 | CISCO FCOE HBA DRIVER |
@@ -2036,7 +2039,7 @@ CX18 VIDEO4LINUX DRIVER | |||
2036 | M: Andy Walls <awalls@md.metrocast.net> | 2039 | M: Andy Walls <awalls@md.metrocast.net> |
2037 | L: ivtv-devel@ivtvdriver.org (moderated for non-subscribers) | 2040 | L: ivtv-devel@ivtvdriver.org (moderated for non-subscribers) |
2038 | L: linux-media@vger.kernel.org | 2041 | L: linux-media@vger.kernel.org |
2039 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-2.6.git | 2042 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media.git |
2040 | W: http://linuxtv.org | 2043 | W: http://linuxtv.org |
2041 | W: http://www.ivtvdriver.org/index.php/Cx18 | 2044 | W: http://www.ivtvdriver.org/index.php/Cx18 |
2042 | S: Maintained | 2045 | S: Maintained |
@@ -2350,7 +2353,7 @@ F: Documentation/blockdev/drbd/ | |||
2350 | 2353 | ||
2351 | DRIVER CORE, KOBJECTS, DEBUGFS AND SYSFS | 2354 | DRIVER CORE, KOBJECTS, DEBUGFS AND SYSFS |
2352 | M: Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2355 | M: Greg Kroah-Hartman <gregkh@linuxfoundation.org> |
2353 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core-2.6.git | 2356 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core.git |
2354 | S: Supported | 2357 | S: Supported |
2355 | F: Documentation/kobject.txt | 2358 | F: Documentation/kobject.txt |
2356 | F: drivers/base/ | 2359 | F: drivers/base/ |
@@ -2372,7 +2375,7 @@ INTEL DRM DRIVERS (excluding Poulsbo, Moorestown and derivative chipsets) | |||
2372 | M: Keith Packard <keithp@keithp.com> | 2375 | M: Keith Packard <keithp@keithp.com> |
2373 | L: intel-gfx@lists.freedesktop.org (subscribers-only) | 2376 | L: intel-gfx@lists.freedesktop.org (subscribers-only) |
2374 | L: dri-devel@lists.freedesktop.org | 2377 | L: dri-devel@lists.freedesktop.org |
2375 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/keithp/linux-2.6.git | 2378 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/keithp/linux.git |
2376 | S: Supported | 2379 | S: Supported |
2377 | F: drivers/gpu/drm/i915 | 2380 | F: drivers/gpu/drm/i915 |
2378 | F: include/drm/i915* | 2381 | F: include/drm/i915* |
@@ -2966,8 +2969,8 @@ GFS2 FILE SYSTEM | |||
2966 | M: Steven Whitehouse <swhiteho@redhat.com> | 2969 | M: Steven Whitehouse <swhiteho@redhat.com> |
2967 | L: cluster-devel@redhat.com | 2970 | L: cluster-devel@redhat.com |
2968 | W: http://sources.redhat.com/cluster/ | 2971 | W: http://sources.redhat.com/cluster/ |
2969 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/steve/gfs2-2.6-fixes.git | 2972 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/steve/gfs2-3.0-fixes.git |
2970 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/steve/gfs2-2.6-nmw.git | 2973 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/steve/gfs2-3.0-nmw.git |
2971 | S: Supported | 2974 | S: Supported |
2972 | F: Documentation/filesystems/gfs2*.txt | 2975 | F: Documentation/filesystems/gfs2*.txt |
2973 | F: fs/gfs2/ | 2976 | F: fs/gfs2/ |
@@ -3008,42 +3011,42 @@ F: drivers/net/ethernet/aeroflex/ | |||
3008 | GSPCA FINEPIX SUBDRIVER | 3011 | GSPCA FINEPIX SUBDRIVER |
3009 | M: Frank Zago <frank@zago.net> | 3012 | M: Frank Zago <frank@zago.net> |
3010 | L: linux-media@vger.kernel.org | 3013 | L: linux-media@vger.kernel.org |
3011 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-2.6.git | 3014 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media.git |
3012 | S: Maintained | 3015 | S: Maintained |
3013 | F: drivers/media/video/gspca/finepix.c | 3016 | F: drivers/media/video/gspca/finepix.c |
3014 | 3017 | ||
3015 | GSPCA GL860 SUBDRIVER | 3018 | GSPCA GL860 SUBDRIVER |
3016 | M: Olivier Lorin <o.lorin@laposte.net> | 3019 | M: Olivier Lorin <o.lorin@laposte.net> |
3017 | L: linux-media@vger.kernel.org | 3020 | L: linux-media@vger.kernel.org |
3018 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-2.6.git | 3021 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media.git |
3019 | S: Maintained | 3022 | S: Maintained |
3020 | F: drivers/media/video/gspca/gl860/ | 3023 | F: drivers/media/video/gspca/gl860/ |
3021 | 3024 | ||
3022 | GSPCA M5602 SUBDRIVER | 3025 | GSPCA M5602 SUBDRIVER |
3023 | M: Erik Andren <erik.andren@gmail.com> | 3026 | M: Erik Andren <erik.andren@gmail.com> |
3024 | L: linux-media@vger.kernel.org | 3027 | L: linux-media@vger.kernel.org |
3025 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-2.6.git | 3028 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media.git |
3026 | S: Maintained | 3029 | S: Maintained |
3027 | F: drivers/media/video/gspca/m5602/ | 3030 | F: drivers/media/video/gspca/m5602/ |
3028 | 3031 | ||
3029 | GSPCA PAC207 SONIXB SUBDRIVER | 3032 | GSPCA PAC207 SONIXB SUBDRIVER |
3030 | M: Hans de Goede <hdegoede@redhat.com> | 3033 | M: Hans de Goede <hdegoede@redhat.com> |
3031 | L: linux-media@vger.kernel.org | 3034 | L: linux-media@vger.kernel.org |
3032 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-2.6.git | 3035 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media.git |
3033 | S: Maintained | 3036 | S: Maintained |
3034 | F: drivers/media/video/gspca/pac207.c | 3037 | F: drivers/media/video/gspca/pac207.c |
3035 | 3038 | ||
3036 | GSPCA SN9C20X SUBDRIVER | 3039 | GSPCA SN9C20X SUBDRIVER |
3037 | M: Brian Johnson <brijohn@gmail.com> | 3040 | M: Brian Johnson <brijohn@gmail.com> |
3038 | L: linux-media@vger.kernel.org | 3041 | L: linux-media@vger.kernel.org |
3039 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-2.6.git | 3042 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media.git |
3040 | S: Maintained | 3043 | S: Maintained |
3041 | F: drivers/media/video/gspca/sn9c20x.c | 3044 | F: drivers/media/video/gspca/sn9c20x.c |
3042 | 3045 | ||
3043 | GSPCA T613 SUBDRIVER | 3046 | GSPCA T613 SUBDRIVER |
3044 | M: Leandro Costantino <lcostantino@gmail.com> | 3047 | M: Leandro Costantino <lcostantino@gmail.com> |
3045 | L: linux-media@vger.kernel.org | 3048 | L: linux-media@vger.kernel.org |
3046 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-2.6.git | 3049 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media.git |
3047 | S: Maintained | 3050 | S: Maintained |
3048 | F: drivers/media/video/gspca/t613.c | 3051 | F: drivers/media/video/gspca/t613.c |
3049 | 3052 | ||
@@ -3051,7 +3054,7 @@ GSPCA USB WEBCAM DRIVER | |||
3051 | M: Jean-Francois Moine <moinejf@free.fr> | 3054 | M: Jean-Francois Moine <moinejf@free.fr> |
3052 | W: http://moinejf.free.fr | 3055 | W: http://moinejf.free.fr |
3053 | L: linux-media@vger.kernel.org | 3056 | L: linux-media@vger.kernel.org |
3054 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-2.6.git | 3057 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media.git |
3055 | S: Maintained | 3058 | S: Maintained |
3056 | F: drivers/media/video/gspca/ | 3059 | F: drivers/media/video/gspca/ |
3057 | 3060 | ||
@@ -3337,7 +3340,7 @@ IDE SUBSYSTEM | |||
3337 | M: "David S. Miller" <davem@davemloft.net> | 3340 | M: "David S. Miller" <davem@davemloft.net> |
3338 | L: linux-ide@vger.kernel.org | 3341 | L: linux-ide@vger.kernel.org |
3339 | Q: http://patchwork.ozlabs.org/project/linux-ide/list/ | 3342 | Q: http://patchwork.ozlabs.org/project/linux-ide/list/ |
3340 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/davem/ide-2.6.git | 3343 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/davem/ide.git |
3341 | S: Maintained | 3344 | S: Maintained |
3342 | F: Documentation/ide/ | 3345 | F: Documentation/ide/ |
3343 | F: drivers/ide/ | 3346 | F: drivers/ide/ |
@@ -3449,7 +3452,7 @@ F: firmware/isci/ | |||
3449 | INTEL IDLE DRIVER | 3452 | INTEL IDLE DRIVER |
3450 | M: Len Brown <lenb@kernel.org> | 3453 | M: Len Brown <lenb@kernel.org> |
3451 | L: linux-pm@vger.kernel.org | 3454 | L: linux-pm@vger.kernel.org |
3452 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux-idle-2.6.git | 3455 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux.git |
3453 | S: Supported | 3456 | S: Supported |
3454 | F: drivers/idle/intel_idle.c | 3457 | F: drivers/idle/intel_idle.c |
3455 | 3458 | ||
@@ -3756,7 +3759,7 @@ IVTV VIDEO4LINUX DRIVER | |||
3756 | M: Andy Walls <awalls@md.metrocast.net> | 3759 | M: Andy Walls <awalls@md.metrocast.net> |
3757 | L: ivtv-devel@ivtvdriver.org (moderated for non-subscribers) | 3760 | L: ivtv-devel@ivtvdriver.org (moderated for non-subscribers) |
3758 | L: linux-media@vger.kernel.org | 3761 | L: linux-media@vger.kernel.org |
3759 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-2.6.git | 3762 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media.git |
3760 | W: http://www.ivtvdriver.org | 3763 | W: http://www.ivtvdriver.org |
3761 | S: Maintained | 3764 | S: Maintained |
3762 | F: Documentation/video4linux/*.ivtv | 3765 | F: Documentation/video4linux/*.ivtv |
@@ -3852,8 +3855,8 @@ F: fs/autofs4/ | |||
3852 | 3855 | ||
3853 | KERNEL BUILD + files below scripts/ (unless maintained elsewhere) | 3856 | KERNEL BUILD + files below scripts/ (unless maintained elsewhere) |
3854 | M: Michal Marek <mmarek@suse.cz> | 3857 | M: Michal Marek <mmarek@suse.cz> |
3855 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild-2.6.git for-next | 3858 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild.git for-next |
3856 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild-2.6.git rc-fixes | 3859 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild.git rc-fixes |
3857 | L: linux-kbuild@vger.kernel.org | 3860 | L: linux-kbuild@vger.kernel.org |
3858 | S: Maintained | 3861 | S: Maintained |
3859 | F: Documentation/kbuild/ | 3862 | F: Documentation/kbuild/ |
@@ -4233,12 +4236,14 @@ F: Documentation/hwmon/ltc4261 | |||
4233 | F: drivers/hwmon/ltc4261.c | 4236 | F: drivers/hwmon/ltc4261.c |
4234 | 4237 | ||
4235 | LTP (Linux Test Project) | 4238 | LTP (Linux Test Project) |
4236 | M: Rishikesh K Rajak <risrajak@linux.vnet.ibm.com> | 4239 | M: Shubham Goyal <shubham@linux.vnet.ibm.com> |
4237 | M: Garrett Cooper <yanegomi@gmail.com> | ||
4238 | M: Mike Frysinger <vapier@gentoo.org> | 4240 | M: Mike Frysinger <vapier@gentoo.org> |
4239 | M: Subrata Modak <subrata@linux.vnet.ibm.com> | 4241 | M: Cyril Hrubis <chrubis@suse.cz> |
4242 | M: Caspar Zhang <caspar@casparzhang.com> | ||
4243 | M: Wanlong Gao <gaowanlong@cn.fujitsu.com> | ||
4240 | L: ltp-list@lists.sourceforge.net (subscribers-only) | 4244 | L: ltp-list@lists.sourceforge.net (subscribers-only) |
4241 | W: http://ltp.sourceforge.net/ | 4245 | W: http://ltp.sourceforge.net/ |
4246 | T: git git://github.com/linux-test-project/ltp.git | ||
4242 | T: git git://ltp.git.sourceforge.net/gitroot/ltp/ltp-dev | 4247 | T: git git://ltp.git.sourceforge.net/gitroot/ltp/ltp-dev |
4243 | S: Maintained | 4248 | S: Maintained |
4244 | 4249 | ||
@@ -4276,7 +4281,7 @@ MAC80211 | |||
4276 | M: Johannes Berg <johannes@sipsolutions.net> | 4281 | M: Johannes Berg <johannes@sipsolutions.net> |
4277 | L: linux-wireless@vger.kernel.org | 4282 | L: linux-wireless@vger.kernel.org |
4278 | W: http://linuxwireless.org/ | 4283 | W: http://linuxwireless.org/ |
4279 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-2.6.git | 4284 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless.git |
4280 | S: Maintained | 4285 | S: Maintained |
4281 | F: Documentation/networking/mac80211-injection.txt | 4286 | F: Documentation/networking/mac80211-injection.txt |
4282 | F: include/net/mac80211.h | 4287 | F: include/net/mac80211.h |
@@ -4287,7 +4292,7 @@ M: Stefano Brivio <stefano.brivio@polimi.it> | |||
4287 | M: Mattias Nissler <mattias.nissler@gmx.de> | 4292 | M: Mattias Nissler <mattias.nissler@gmx.de> |
4288 | L: linux-wireless@vger.kernel.org | 4293 | L: linux-wireless@vger.kernel.org |
4289 | W: http://linuxwireless.org/en/developers/Documentation/mac80211/RateControl/PID | 4294 | W: http://linuxwireless.org/en/developers/Documentation/mac80211/RateControl/PID |
4290 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-2.6.git | 4295 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless.git |
4291 | S: Maintained | 4296 | S: Maintained |
4292 | F: net/mac80211/rc80211_pid* | 4297 | F: net/mac80211/rc80211_pid* |
4293 | 4298 | ||
@@ -4359,7 +4364,7 @@ P: LinuxTV.org Project | |||
4359 | L: linux-media@vger.kernel.org | 4364 | L: linux-media@vger.kernel.org |
4360 | W: http://linuxtv.org | 4365 | W: http://linuxtv.org |
4361 | Q: http://patchwork.kernel.org/project/linux-media/list/ | 4366 | Q: http://patchwork.kernel.org/project/linux-media/list/ |
4362 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-2.6.git | 4367 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media.git |
4363 | S: Maintained | 4368 | S: Maintained |
4364 | F: Documentation/dvb/ | 4369 | F: Documentation/dvb/ |
4365 | F: Documentation/video4linux/ | 4370 | F: Documentation/video4linux/ |
@@ -4416,6 +4421,13 @@ T: git git://git.monstr.eu/linux-2.6-microblaze.git | |||
4416 | S: Supported | 4421 | S: Supported |
4417 | F: arch/microblaze/ | 4422 | F: arch/microblaze/ |
4418 | 4423 | ||
4424 | MICROCHANNEL ARCHITECTURE (MCA) | ||
4425 | M: James Bottomley <James.Bottomley@HansenPartnership.com> | ||
4426 | S: Maintained | ||
4427 | F: Documentation/mca.txt | ||
4428 | F: drivers/mca/ | ||
4429 | F: include/linux/mca* | ||
4430 | |||
4419 | MICROTEK X6 SCANNER | 4431 | MICROTEK X6 SCANNER |
4420 | M: Oliver Neukum <oliver@neukum.name> | 4432 | M: Oliver Neukum <oliver@neukum.name> |
4421 | S: Maintained | 4433 | S: Maintained |
@@ -4431,14 +4443,6 @@ S: Supported | |||
4431 | F: Documentation/mips/ | 4443 | F: Documentation/mips/ |
4432 | F: arch/mips/ | 4444 | F: arch/mips/ |
4433 | 4445 | ||
4434 | MISCELLANEOUS MCA-SUPPORT | ||
4435 | M: James Bottomley <James.Bottomley@HansenPartnership.com> | ||
4436 | S: Maintained | ||
4437 | F: Documentation/ia64/mca.txt | ||
4438 | F: Documentation/mca.txt | ||
4439 | F: drivers/mca/ | ||
4440 | F: include/linux/mca* | ||
4441 | |||
4442 | MODULE SUPPORT | 4446 | MODULE SUPPORT |
4443 | M: Rusty Russell <rusty@rustcorp.com.au> | 4447 | M: Rusty Russell <rusty@rustcorp.com.au> |
4444 | S: Maintained | 4448 | S: Maintained |
@@ -4646,7 +4650,7 @@ M: James Morris <jmorris@namei.org> | |||
4646 | M: Hideaki YOSHIFUJI <yoshfuji@linux-ipv6.org> | 4650 | M: Hideaki YOSHIFUJI <yoshfuji@linux-ipv6.org> |
4647 | M: Patrick McHardy <kaber@trash.net> | 4651 | M: Patrick McHardy <kaber@trash.net> |
4648 | L: netdev@vger.kernel.org | 4652 | L: netdev@vger.kernel.org |
4649 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6.git | 4653 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/davem/net.git |
4650 | S: Maintained | 4654 | S: Maintained |
4651 | F: net/ipv4/ | 4655 | F: net/ipv4/ |
4652 | F: net/ipv6/ | 4656 | F: net/ipv6/ |
@@ -4662,7 +4666,7 @@ NETWORKING [WIRELESS] | |||
4662 | M: "John W. Linville" <linville@tuxdriver.com> | 4666 | M: "John W. Linville" <linville@tuxdriver.com> |
4663 | L: linux-wireless@vger.kernel.org | 4667 | L: linux-wireless@vger.kernel.org |
4664 | Q: http://patchwork.kernel.org/project/linux-wireless/list/ | 4668 | Q: http://patchwork.kernel.org/project/linux-wireless/list/ |
4665 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-2.6.git | 4669 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless.git |
4666 | S: Maintained | 4670 | S: Maintained |
4667 | F: net/mac80211/ | 4671 | F: net/mac80211/ |
4668 | F: net/rfkill/ | 4672 | F: net/rfkill/ |
@@ -4675,8 +4679,8 @@ F: drivers/net/wireless/ | |||
4675 | NETWORKING DRIVERS | 4679 | NETWORKING DRIVERS |
4676 | L: netdev@vger.kernel.org | 4680 | L: netdev@vger.kernel.org |
4677 | W: http://www.linuxfoundation.org/en/Net | 4681 | W: http://www.linuxfoundation.org/en/Net |
4678 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6.git | 4682 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/davem/net.git |
4679 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next-2.6.git | 4683 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git |
4680 | S: Odd Fixes | 4684 | S: Odd Fixes |
4681 | F: drivers/net/ | 4685 | F: drivers/net/ |
4682 | F: include/linux/if_* | 4686 | F: include/linux/if_* |
@@ -4892,7 +4896,7 @@ F: drivers/char/pcmcia/cm4040_cs.* | |||
4892 | OMNIVISION OV7670 SENSOR DRIVER | 4896 | OMNIVISION OV7670 SENSOR DRIVER |
4893 | M: Jonathan Corbet <corbet@lwn.net> | 4897 | M: Jonathan Corbet <corbet@lwn.net> |
4894 | L: linux-media@vger.kernel.org | 4898 | L: linux-media@vger.kernel.org |
4895 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-2.6.git | 4899 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media.git |
4896 | S: Maintained | 4900 | S: Maintained |
4897 | F: drivers/media/video/ov7670.c | 4901 | F: drivers/media/video/ov7670.c |
4898 | 4902 | ||
@@ -5067,7 +5071,7 @@ M: Helge Deller <deller@gmx.de> | |||
5067 | L: linux-parisc@vger.kernel.org | 5071 | L: linux-parisc@vger.kernel.org |
5068 | W: http://www.parisc-linux.org/ | 5072 | W: http://www.parisc-linux.org/ |
5069 | Q: http://patchwork.kernel.org/project/linux-parisc/list/ | 5073 | Q: http://patchwork.kernel.org/project/linux-parisc/list/ |
5070 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/kyle/parisc-2.6.git | 5074 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/jejb/parisc-2.6.git |
5071 | S: Maintained | 5075 | S: Maintained |
5072 | F: arch/parisc/ | 5076 | F: arch/parisc/ |
5073 | F: drivers/parisc/ | 5077 | F: drivers/parisc/ |
@@ -5123,7 +5127,7 @@ PCI SUBSYSTEM | |||
5123 | M: Bjorn Helgaas <bhelgaas@google.com> | 5127 | M: Bjorn Helgaas <bhelgaas@google.com> |
5124 | L: linux-pci@vger.kernel.org | 5128 | L: linux-pci@vger.kernel.org |
5125 | Q: http://patchwork.kernel.org/project/linux-pci/list/ | 5129 | Q: http://patchwork.kernel.org/project/linux-pci/list/ |
5126 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/jbarnes/pci-2.6.git | 5130 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/jbarnes/pci.git |
5127 | S: Supported | 5131 | S: Supported |
5128 | F: Documentation/PCI/ | 5132 | F: Documentation/PCI/ |
5129 | F: drivers/pci/ | 5133 | F: drivers/pci/ |
@@ -5408,7 +5412,7 @@ M: Mike Isely <isely@pobox.com> | |||
5408 | L: pvrusb2@isely.net (subscribers-only) | 5412 | L: pvrusb2@isely.net (subscribers-only) |
5409 | L: linux-media@vger.kernel.org | 5413 | L: linux-media@vger.kernel.org |
5410 | W: http://www.isely.net/pvrusb2/ | 5414 | W: http://www.isely.net/pvrusb2/ |
5411 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-2.6.git | 5415 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media.git |
5412 | S: Maintained | 5416 | S: Maintained |
5413 | F: Documentation/video4linux/README.pvrusb2 | 5417 | F: Documentation/video4linux/README.pvrusb2 |
5414 | F: drivers/media/video/pvrusb2/ | 5418 | F: drivers/media/video/pvrusb2/ |
@@ -5574,7 +5578,7 @@ RCUTORTURE MODULE | |||
5574 | M: Josh Triplett <josh@freedesktop.org> | 5578 | M: Josh Triplett <josh@freedesktop.org> |
5575 | M: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> | 5579 | M: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> |
5576 | S: Supported | 5580 | S: Supported |
5577 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-2.6-rcu.git | 5581 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu.git |
5578 | F: Documentation/RCU/torture.txt | 5582 | F: Documentation/RCU/torture.txt |
5579 | F: kernel/rcutorture.c | 5583 | F: kernel/rcutorture.c |
5580 | 5584 | ||
@@ -5599,7 +5603,7 @@ M: Dipankar Sarma <dipankar@in.ibm.com> | |||
5599 | M: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> | 5603 | M: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> |
5600 | W: http://www.rdrop.com/users/paulmck/rclock/ | 5604 | W: http://www.rdrop.com/users/paulmck/rclock/ |
5601 | S: Supported | 5605 | S: Supported |
5602 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-2.6-rcu.git | 5606 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu.git |
5603 | F: Documentation/RCU/ | 5607 | F: Documentation/RCU/ |
5604 | F: include/linux/rcu* | 5608 | F: include/linux/rcu* |
5605 | F: include/linux/srcu* | 5609 | F: include/linux/srcu* |
@@ -5753,7 +5757,7 @@ F: drivers/mmc/host/s3cmci.* | |||
5753 | SAA7146 VIDEO4LINUX-2 DRIVER | 5757 | SAA7146 VIDEO4LINUX-2 DRIVER |
5754 | M: Michael Hunold <michael@mihu.de> | 5758 | M: Michael Hunold <michael@mihu.de> |
5755 | L: linux-media@vger.kernel.org | 5759 | L: linux-media@vger.kernel.org |
5756 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-2.6.git | 5760 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media.git |
5757 | W: http://www.mihu.de/linux/saa7146 | 5761 | W: http://www.mihu.de/linux/saa7146 |
5758 | S: Maintained | 5762 | S: Maintained |
5759 | F: drivers/media/common/saa7146* | 5763 | F: drivers/media/common/saa7146* |
@@ -6176,7 +6180,7 @@ F: arch/ia64/sn/ | |||
6176 | SOC-CAMERA V4L2 SUBSYSTEM | 6180 | SOC-CAMERA V4L2 SUBSYSTEM |
6177 | M: Guennadi Liakhovetski <g.liakhovetski@gmx.de> | 6181 | M: Guennadi Liakhovetski <g.liakhovetski@gmx.de> |
6178 | L: linux-media@vger.kernel.org | 6182 | L: linux-media@vger.kernel.org |
6179 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-2.6.git | 6183 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media.git |
6180 | S: Maintained | 6184 | S: Maintained |
6181 | F: include/media/v4l2* | 6185 | F: include/media/v4l2* |
6182 | F: drivers/media/video/v4l2* | 6186 | F: drivers/media/video/v4l2* |
@@ -6248,8 +6252,8 @@ SPARC + UltraSPARC (sparc/sparc64) | |||
6248 | M: "David S. Miller" <davem@davemloft.net> | 6252 | M: "David S. Miller" <davem@davemloft.net> |
6249 | L: sparclinux@vger.kernel.org | 6253 | L: sparclinux@vger.kernel.org |
6250 | Q: http://patchwork.ozlabs.org/project/sparclinux/list/ | 6254 | Q: http://patchwork.ozlabs.org/project/sparclinux/list/ |
6251 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc-2.6.git | 6255 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc.git |
6252 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc-next-2.6.git | 6256 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc-next.git |
6253 | S: Maintained | 6257 | S: Maintained |
6254 | F: arch/sparc/ | 6258 | F: arch/sparc/ |
6255 | F: drivers/sbus/ | 6259 | F: drivers/sbus/ |
@@ -6257,8 +6261,8 @@ F: drivers/sbus/ | |||
6257 | SPARC SERIAL DRIVERS | 6261 | SPARC SERIAL DRIVERS |
6258 | M: "David S. Miller" <davem@davemloft.net> | 6262 | M: "David S. Miller" <davem@davemloft.net> |
6259 | L: sparclinux@vger.kernel.org | 6263 | L: sparclinux@vger.kernel.org |
6260 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc-2.6.git | 6264 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc.git |
6261 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc-next-2.6.git | 6265 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc-next.git |
6262 | S: Maintained | 6266 | S: Maintained |
6263 | F: include/linux/sunserialcore.h | 6267 | F: include/linux/sunserialcore.h |
6264 | F: drivers/tty/serial/suncore.c | 6268 | F: drivers/tty/serial/suncore.c |
@@ -6563,7 +6567,7 @@ L: linux-scsi@vger.kernel.org | |||
6563 | L: target-devel@vger.kernel.org | 6567 | L: target-devel@vger.kernel.org |
6564 | L: http://groups.google.com/group/linux-iscsi-target-dev | 6568 | L: http://groups.google.com/group/linux-iscsi-target-dev |
6565 | W: http://www.linux-iscsi.org | 6569 | W: http://www.linux-iscsi.org |
6566 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/nab/lio-core-2.6.git master | 6570 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/nab/lio-core.git master |
6567 | S: Supported | 6571 | S: Supported |
6568 | F: drivers/target/ | 6572 | F: drivers/target/ |
6569 | F: include/target/ | 6573 | F: include/target/ |
@@ -6754,7 +6758,7 @@ K: ^Subject:.*(?i)trivial | |||
6754 | TTY LAYER | 6758 | TTY LAYER |
6755 | M: Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 6759 | M: Greg Kroah-Hartman <gregkh@linuxfoundation.org> |
6756 | S: Supported | 6760 | S: Supported |
6757 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty-2.6.git | 6761 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty.git |
6758 | F: drivers/tty/ | 6762 | F: drivers/tty/ |
6759 | F: drivers/tty/serial/serial_core.c | 6763 | F: drivers/tty/serial/serial_core.c |
6760 | F: include/linux/serial_core.h | 6764 | F: include/linux/serial_core.h |
@@ -6922,7 +6926,7 @@ USB ET61X[12]51 DRIVER | |||
6922 | M: Luca Risolia <luca.risolia@studio.unibo.it> | 6926 | M: Luca Risolia <luca.risolia@studio.unibo.it> |
6923 | L: linux-usb@vger.kernel.org | 6927 | L: linux-usb@vger.kernel.org |
6924 | L: linux-media@vger.kernel.org | 6928 | L: linux-media@vger.kernel.org |
6925 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-2.6.git | 6929 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media.git |
6926 | W: http://www.linux-projects.org | 6930 | W: http://www.linux-projects.org |
6927 | S: Maintained | 6931 | S: Maintained |
6928 | F: drivers/media/video/et61x251/ | 6932 | F: drivers/media/video/et61x251/ |
@@ -7078,7 +7082,7 @@ USB SN9C1xx DRIVER | |||
7078 | M: Luca Risolia <luca.risolia@studio.unibo.it> | 7082 | M: Luca Risolia <luca.risolia@studio.unibo.it> |
7079 | L: linux-usb@vger.kernel.org | 7083 | L: linux-usb@vger.kernel.org |
7080 | L: linux-media@vger.kernel.org | 7084 | L: linux-media@vger.kernel.org |
7081 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-2.6.git | 7085 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media.git |
7082 | W: http://www.linux-projects.org | 7086 | W: http://www.linux-projects.org |
7083 | S: Maintained | 7087 | S: Maintained |
7084 | F: Documentation/video4linux/sn9c102.txt | 7088 | F: Documentation/video4linux/sn9c102.txt |
@@ -7088,7 +7092,7 @@ USB SUBSYSTEM | |||
7088 | M: Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 7092 | M: Greg Kroah-Hartman <gregkh@linuxfoundation.org> |
7089 | L: linux-usb@vger.kernel.org | 7093 | L: linux-usb@vger.kernel.org |
7090 | W: http://www.linux-usb.org | 7094 | W: http://www.linux-usb.org |
7091 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb-2.6.git | 7095 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git |
7092 | S: Supported | 7096 | S: Supported |
7093 | F: Documentation/usb/ | 7097 | F: Documentation/usb/ |
7094 | F: drivers/net/usb/ | 7098 | F: drivers/net/usb/ |
@@ -7114,7 +7118,7 @@ USB VIDEO CLASS | |||
7114 | M: Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 7118 | M: Laurent Pinchart <laurent.pinchart@ideasonboard.com> |
7115 | L: linux-uvc-devel@lists.berlios.de (subscribers-only) | 7119 | L: linux-uvc-devel@lists.berlios.de (subscribers-only) |
7116 | L: linux-media@vger.kernel.org | 7120 | L: linux-media@vger.kernel.org |
7117 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-2.6.git | 7121 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media.git |
7118 | W: http://www.ideasonboard.org/uvc/ | 7122 | W: http://www.ideasonboard.org/uvc/ |
7119 | S: Maintained | 7123 | S: Maintained |
7120 | F: drivers/media/video/uvc/ | 7124 | F: drivers/media/video/uvc/ |
@@ -7123,7 +7127,7 @@ USB W996[87]CF DRIVER | |||
7123 | M: Luca Risolia <luca.risolia@studio.unibo.it> | 7127 | M: Luca Risolia <luca.risolia@studio.unibo.it> |
7124 | L: linux-usb@vger.kernel.org | 7128 | L: linux-usb@vger.kernel.org |
7125 | L: linux-media@vger.kernel.org | 7129 | L: linux-media@vger.kernel.org |
7126 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-2.6.git | 7130 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media.git |
7127 | W: http://www.linux-projects.org | 7131 | W: http://www.linux-projects.org |
7128 | S: Maintained | 7132 | S: Maintained |
7129 | F: Documentation/video4linux/w9968cf.txt | 7133 | F: Documentation/video4linux/w9968cf.txt |
@@ -7152,7 +7156,7 @@ USB ZR364XX DRIVER | |||
7152 | M: Antoine Jacquet <royale@zerezo.com> | 7156 | M: Antoine Jacquet <royale@zerezo.com> |
7153 | L: linux-usb@vger.kernel.org | 7157 | L: linux-usb@vger.kernel.org |
7154 | L: linux-media@vger.kernel.org | 7158 | L: linux-media@vger.kernel.org |
7155 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-2.6.git | 7159 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media.git |
7156 | W: http://royale.zerezo.com/zr364xx/ | 7160 | W: http://royale.zerezo.com/zr364xx/ |
7157 | S: Maintained | 7161 | S: Maintained |
7158 | F: Documentation/video4linux/zr364xx.txt | 7162 | F: Documentation/video4linux/zr364xx.txt |
@@ -7302,7 +7306,7 @@ M: Liam Girdwood <lrg@ti.com> | |||
7302 | M: Mark Brown <broonie@opensource.wolfsonmicro.com> | 7306 | M: Mark Brown <broonie@opensource.wolfsonmicro.com> |
7303 | W: http://opensource.wolfsonmicro.com/node/15 | 7307 | W: http://opensource.wolfsonmicro.com/node/15 |
7304 | W: http://www.slimlogic.co.uk/?p=48 | 7308 | W: http://www.slimlogic.co.uk/?p=48 |
7305 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/lrg/voltage-2.6.git | 7309 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/lrg/regulator.git |
7306 | S: Supported | 7310 | S: Supported |
7307 | F: drivers/regulator/ | 7311 | F: drivers/regulator/ |
7308 | F: include/linux/regulator/ | 7312 | F: include/linux/regulator/ |
diff --git a/arch/Kconfig b/arch/Kconfig index 5b448a74d0f7..a6f14f622d13 100644 --- a/arch/Kconfig +++ b/arch/Kconfig | |||
@@ -120,6 +120,9 @@ config HAVE_KRETPROBES | |||
120 | 120 | ||
121 | config HAVE_OPTPROBES | 121 | config HAVE_OPTPROBES |
122 | bool | 122 | bool |
123 | |||
124 | config HAVE_NMI_WATCHDOG | ||
125 | bool | ||
123 | # | 126 | # |
124 | # An arch should select this if it provides all these things: | 127 | # An arch should select this if it provides all these things: |
125 | # | 128 | # |
diff --git a/arch/alpha/include/asm/mman.h b/arch/alpha/include/asm/mman.h index 72db984f8781..cbeb3616a28e 100644 --- a/arch/alpha/include/asm/mman.h +++ b/arch/alpha/include/asm/mman.h | |||
@@ -56,6 +56,10 @@ | |||
56 | #define MADV_HUGEPAGE 14 /* Worth backing with hugepages */ | 56 | #define MADV_HUGEPAGE 14 /* Worth backing with hugepages */ |
57 | #define MADV_NOHUGEPAGE 15 /* Not worth backing with hugepages */ | 57 | #define MADV_NOHUGEPAGE 15 /* Not worth backing with hugepages */ |
58 | 58 | ||
59 | #define MADV_DONTDUMP 16 /* Explicity exclude from the core dump, | ||
60 | overrides the coredump filter bits */ | ||
61 | #define MADV_DODUMP 17 /* Clear the MADV_NODUMP flag */ | ||
62 | |||
59 | /* compatibility flags */ | 63 | /* compatibility flags */ |
60 | #define MAP_FILE 0 | 64 | #define MAP_FILE 0 |
61 | 65 | ||
diff --git a/arch/arm/include/asm/pgtable-nommu.h b/arch/arm/include/asm/pgtable-nommu.h index ffc0e85775b4..7ec60d6075bf 100644 --- a/arch/arm/include/asm/pgtable-nommu.h +++ b/arch/arm/include/asm/pgtable-nommu.h | |||
@@ -79,7 +79,6 @@ extern unsigned int kobjsize(const void *objp); | |||
79 | * No page table caches to initialise. | 79 | * No page table caches to initialise. |
80 | */ | 80 | */ |
81 | #define pgtable_cache_init() do { } while (0) | 81 | #define pgtable_cache_init() do { } while (0) |
82 | #define io_remap_page_range remap_page_range | ||
83 | #define io_remap_pfn_range remap_pfn_range | 82 | #define io_remap_pfn_range remap_pfn_range |
84 | 83 | ||
85 | 84 | ||
diff --git a/arch/arm/kernel/process.c b/arch/arm/kernel/process.c index c2ae3cd331fe..219e4efee1a6 100644 --- a/arch/arm/kernel/process.c +++ b/arch/arm/kernel/process.c | |||
@@ -533,8 +533,7 @@ int vectors_user_mapping(void) | |||
533 | struct mm_struct *mm = current->mm; | 533 | struct mm_struct *mm = current->mm; |
534 | return install_special_mapping(mm, 0xffff0000, PAGE_SIZE, | 534 | return install_special_mapping(mm, 0xffff0000, PAGE_SIZE, |
535 | VM_READ | VM_EXEC | | 535 | VM_READ | VM_EXEC | |
536 | VM_MAYREAD | VM_MAYEXEC | | 536 | VM_MAYREAD | VM_MAYEXEC | VM_RESERVED, |
537 | VM_ALWAYSDUMP | VM_RESERVED, | ||
538 | NULL); | 537 | NULL); |
539 | } | 538 | } |
540 | 539 | ||
diff --git a/arch/blackfin/Kconfig b/arch/blackfin/Kconfig index abe5a9e85148..c1269a1085e1 100644 --- a/arch/blackfin/Kconfig +++ b/arch/blackfin/Kconfig | |||
@@ -36,6 +36,7 @@ config BLACKFIN | |||
36 | select GENERIC_ATOMIC64 | 36 | select GENERIC_ATOMIC64 |
37 | select GENERIC_IRQ_PROBE | 37 | select GENERIC_IRQ_PROBE |
38 | select IRQ_PER_CPU if SMP | 38 | select IRQ_PER_CPU if SMP |
39 | select HAVE_NMI_WATCHDOG if NMI_WATCHDOG | ||
39 | 40 | ||
40 | config GENERIC_CSUM | 41 | config GENERIC_CSUM |
41 | def_bool y | 42 | def_bool y |
diff --git a/arch/blackfin/include/asm/irq.h b/arch/blackfin/include/asm/irq.h index 12f4060a31b0..89de539ed010 100644 --- a/arch/blackfin/include/asm/irq.h +++ b/arch/blackfin/include/asm/irq.h | |||
@@ -38,8 +38,4 @@ | |||
38 | 38 | ||
39 | #include <asm-generic/irq.h> | 39 | #include <asm-generic/irq.h> |
40 | 40 | ||
41 | #ifdef CONFIG_NMI_WATCHDOG | ||
42 | # define ARCH_HAS_NMI_WATCHDOG | ||
43 | #endif | ||
44 | |||
45 | #endif /* _BFIN_IRQ_H_ */ | 41 | #endif /* _BFIN_IRQ_H_ */ |
diff --git a/arch/c6x/include/asm/pgtable.h b/arch/c6x/include/asm/pgtable.h index 68c8af4f1f97..38a4312eb2cb 100644 --- a/arch/c6x/include/asm/pgtable.h +++ b/arch/c6x/include/asm/pgtable.h | |||
@@ -73,9 +73,6 @@ extern unsigned long empty_zero_page; | |||
73 | #define pgtable_cache_init() do { } while (0) | 73 | #define pgtable_cache_init() do { } while (0) |
74 | #define io_remap_pfn_range remap_pfn_range | 74 | #define io_remap_pfn_range remap_pfn_range |
75 | 75 | ||
76 | #define io_remap_page_range(vma, vaddr, paddr, size, prot) \ | ||
77 | remap_pfn_range(vma, vaddr, (paddr) >> PAGE_SHIFT, size, prot) | ||
78 | |||
79 | #include <asm-generic/pgtable.h> | 76 | #include <asm-generic/pgtable.h> |
80 | 77 | ||
81 | #endif /* _ASM_C6X_PGTABLE_H */ | 78 | #endif /* _ASM_C6X_PGTABLE_H */ |
diff --git a/arch/hexagon/kernel/signal.c b/arch/hexagon/kernel/signal.c index b45be3181193..ecbab3457606 100644 --- a/arch/hexagon/kernel/signal.c +++ b/arch/hexagon/kernel/signal.c | |||
@@ -192,12 +192,7 @@ static int handle_signal(int sig, siginfo_t *info, struct k_sigaction *ka, | |||
192 | if (rc) | 192 | if (rc) |
193 | return rc; | 193 | return rc; |
194 | 194 | ||
195 | spin_lock_irq(¤t->sighand->siglock); | 195 | block_sigmask(ka, sig); |
196 | sigorsets(¤t->blocked, ¤t->blocked, &ka->sa.sa_mask); | ||
197 | if (!(ka->sa.sa_flags & SA_NODEFER)) | ||
198 | sigaddset(¤t->blocked, sig); | ||
199 | recalc_sigpending(); | ||
200 | spin_unlock_irq(¤t->sighand->siglock); | ||
201 | 196 | ||
202 | return 0; | 197 | return 0; |
203 | } | 198 | } |
@@ -305,10 +300,7 @@ asmlinkage int sys_rt_sigreturn(void) | |||
305 | goto badframe; | 300 | goto badframe; |
306 | 301 | ||
307 | sigdelsetmask(&blocked, ~_BLOCKABLE); | 302 | sigdelsetmask(&blocked, ~_BLOCKABLE); |
308 | spin_lock_irq(¤t->sighand->siglock); | 303 | set_current_blocked(&blocked); |
309 | current->blocked = blocked; | ||
310 | recalc_sigpending(); | ||
311 | spin_unlock_irq(¤t->sighand->siglock); | ||
312 | 304 | ||
313 | if (restore_sigcontext(regs, &frame->uc.uc_mcontext)) | 305 | if (restore_sigcontext(regs, &frame->uc.uc_mcontext)) |
314 | goto badframe; | 306 | goto badframe; |
diff --git a/arch/hexagon/kernel/vdso.c b/arch/hexagon/kernel/vdso.c index 16277c33308a..f212a453b527 100644 --- a/arch/hexagon/kernel/vdso.c +++ b/arch/hexagon/kernel/vdso.c | |||
@@ -78,8 +78,7 @@ int arch_setup_additional_pages(struct linux_binprm *bprm, int uses_interp) | |||
78 | /* MAYWRITE to allow gdb to COW and set breakpoints. */ | 78 | /* MAYWRITE to allow gdb to COW and set breakpoints. */ |
79 | ret = install_special_mapping(mm, vdso_base, PAGE_SIZE, | 79 | ret = install_special_mapping(mm, vdso_base, PAGE_SIZE, |
80 | VM_READ|VM_EXEC| | 80 | VM_READ|VM_EXEC| |
81 | VM_MAYREAD|VM_MAYWRITE|VM_MAYEXEC| | 81 | VM_MAYREAD|VM_MAYWRITE|VM_MAYEXEC, |
82 | VM_ALWAYSDUMP, | ||
83 | &vdso_page); | 82 | &vdso_page); |
84 | 83 | ||
85 | if (ret) | 84 | if (ret) |
diff --git a/arch/microblaze/include/asm/pgtable.h b/arch/microblaze/include/asm/pgtable.h index b2af42311a12..44dc67aa0277 100644 --- a/arch/microblaze/include/asm/pgtable.h +++ b/arch/microblaze/include/asm/pgtable.h | |||
@@ -543,8 +543,6 @@ extern unsigned long iopa(unsigned long addr); | |||
543 | /* Needs to be defined here and not in linux/mm.h, as it is arch dependent */ | 543 | /* Needs to be defined here and not in linux/mm.h, as it is arch dependent */ |
544 | #define kern_addr_valid(addr) (1) | 544 | #define kern_addr_valid(addr) (1) |
545 | 545 | ||
546 | #define io_remap_page_range remap_page_range | ||
547 | |||
548 | /* | 546 | /* |
549 | * No page table caches to initialise | 547 | * No page table caches to initialise |
550 | */ | 548 | */ |
diff --git a/arch/mips/include/asm/mman.h b/arch/mips/include/asm/mman.h index 785b4ea4ec3f..46d3da0d4b92 100644 --- a/arch/mips/include/asm/mman.h +++ b/arch/mips/include/asm/mman.h | |||
@@ -80,6 +80,10 @@ | |||
80 | #define MADV_HUGEPAGE 14 /* Worth backing with hugepages */ | 80 | #define MADV_HUGEPAGE 14 /* Worth backing with hugepages */ |
81 | #define MADV_NOHUGEPAGE 15 /* Not worth backing with hugepages */ | 81 | #define MADV_NOHUGEPAGE 15 /* Not worth backing with hugepages */ |
82 | 82 | ||
83 | #define MADV_DONTDUMP 16 /* Explicity exclude from the core dump, | ||
84 | overrides the coredump filter bits */ | ||
85 | #define MADV_DODUMP 17 /* Clear the MADV_NODUMP flag */ | ||
86 | |||
83 | /* compatibility flags */ | 87 | /* compatibility flags */ |
84 | #define MAP_FILE 0 | 88 | #define MAP_FILE 0 |
85 | 89 | ||
diff --git a/arch/mips/kernel/vdso.c b/arch/mips/kernel/vdso.c index e5cdfd603f8f..0f1af58b036a 100644 --- a/arch/mips/kernel/vdso.c +++ b/arch/mips/kernel/vdso.c | |||
@@ -88,8 +88,7 @@ int arch_setup_additional_pages(struct linux_binprm *bprm, int uses_interp) | |||
88 | 88 | ||
89 | ret = install_special_mapping(mm, addr, PAGE_SIZE, | 89 | ret = install_special_mapping(mm, addr, PAGE_SIZE, |
90 | VM_READ|VM_EXEC| | 90 | VM_READ|VM_EXEC| |
91 | VM_MAYREAD|VM_MAYWRITE|VM_MAYEXEC| | 91 | VM_MAYREAD|VM_MAYWRITE|VM_MAYEXEC, |
92 | VM_ALWAYSDUMP, | ||
93 | &vdso_page); | 92 | &vdso_page); |
94 | 93 | ||
95 | if (ret) | 94 | if (ret) |
diff --git a/arch/mn10300/Kconfig b/arch/mn10300/Kconfig index 8f1c40d5817e..3aa3de017159 100644 --- a/arch/mn10300/Kconfig +++ b/arch/mn10300/Kconfig | |||
@@ -5,6 +5,7 @@ config MN10300 | |||
5 | select GENERIC_IRQ_SHOW | 5 | select GENERIC_IRQ_SHOW |
6 | select HAVE_ARCH_TRACEHOOK | 6 | select HAVE_ARCH_TRACEHOOK |
7 | select HAVE_ARCH_KGDB | 7 | select HAVE_ARCH_KGDB |
8 | select HAVE_NMI_WATCHDOG if MN10300_WD_TIMER | ||
8 | 9 | ||
9 | config AM33_2 | 10 | config AM33_2 |
10 | def_bool n | 11 | def_bool n |
diff --git a/arch/mn10300/include/asm/reset-regs.h b/arch/mn10300/include/asm/reset-regs.h index 10c7502a113f..8ca2a42d365b 100644 --- a/arch/mn10300/include/asm/reset-regs.h +++ b/arch/mn10300/include/asm/reset-regs.h | |||
@@ -17,10 +17,6 @@ | |||
17 | 17 | ||
18 | #ifdef __KERNEL__ | 18 | #ifdef __KERNEL__ |
19 | 19 | ||
20 | #ifdef CONFIG_MN10300_WD_TIMER | ||
21 | #define ARCH_HAS_NMI_WATCHDOG /* See include/linux/nmi.h */ | ||
22 | #endif | ||
23 | |||
24 | /* | 20 | /* |
25 | * watchdog timer registers | 21 | * watchdog timer registers |
26 | */ | 22 | */ |
diff --git a/arch/openrisc/include/asm/pgtable.h b/arch/openrisc/include/asm/pgtable.h index 043505d7f684..14c900cfd30a 100644 --- a/arch/openrisc/include/asm/pgtable.h +++ b/arch/openrisc/include/asm/pgtable.h | |||
@@ -455,7 +455,6 @@ static inline void update_mmu_cache(struct vm_area_struct *vma, | |||
455 | * No page table caches to initialise | 455 | * No page table caches to initialise |
456 | */ | 456 | */ |
457 | #define pgtable_cache_init() do { } while (0) | 457 | #define pgtable_cache_init() do { } while (0) |
458 | #define io_remap_page_range remap_page_range | ||
459 | 458 | ||
460 | typedef pte_t *pte_addr_t; | 459 | typedef pte_t *pte_addr_t; |
461 | 460 | ||
diff --git a/arch/parisc/include/asm/mman.h b/arch/parisc/include/asm/mman.h index f5b7bf5fba68..12219ebce869 100644 --- a/arch/parisc/include/asm/mman.h +++ b/arch/parisc/include/asm/mman.h | |||
@@ -62,6 +62,10 @@ | |||
62 | #define MADV_HUGEPAGE 67 /* Worth backing with hugepages */ | 62 | #define MADV_HUGEPAGE 67 /* Worth backing with hugepages */ |
63 | #define MADV_NOHUGEPAGE 68 /* Not worth backing with hugepages */ | 63 | #define MADV_NOHUGEPAGE 68 /* Not worth backing with hugepages */ |
64 | 64 | ||
65 | #define MADV_DONTDUMP 69 /* Explicity exclude from the core dump, | ||
66 | overrides the coredump filter bits */ | ||
67 | #define MADV_DODUMP 70 /* Clear the MADV_NODUMP flag */ | ||
68 | |||
65 | /* compatibility flags */ | 69 | /* compatibility flags */ |
66 | #define MAP_FILE 0 | 70 | #define MAP_FILE 0 |
67 | #define MAP_VARIABLE 0 | 71 | #define MAP_VARIABLE 0 |
diff --git a/arch/powerpc/kernel/vdso.c b/arch/powerpc/kernel/vdso.c index 7d14bb697d40..d36ee1055f88 100644 --- a/arch/powerpc/kernel/vdso.c +++ b/arch/powerpc/kernel/vdso.c | |||
@@ -263,17 +263,11 @@ int arch_setup_additional_pages(struct linux_binprm *bprm, int uses_interp) | |||
263 | * the "data" page of the vDSO or you'll stop getting kernel updates | 263 | * the "data" page of the vDSO or you'll stop getting kernel updates |
264 | * and your nice userland gettimeofday will be totally dead. | 264 | * and your nice userland gettimeofday will be totally dead. |
265 | * It's fine to use that for setting breakpoints in the vDSO code | 265 | * It's fine to use that for setting breakpoints in the vDSO code |
266 | * pages though | 266 | * pages though. |
267 | * | ||
268 | * Make sure the vDSO gets into every core dump. | ||
269 | * Dumping its contents makes post-mortem fully interpretable later | ||
270 | * without matching up the same kernel and hardware config to see | ||
271 | * what PC values meant. | ||
272 | */ | 267 | */ |
273 | rc = install_special_mapping(mm, vdso_base, vdso_pages << PAGE_SHIFT, | 268 | rc = install_special_mapping(mm, vdso_base, vdso_pages << PAGE_SHIFT, |
274 | VM_READ|VM_EXEC| | 269 | VM_READ|VM_EXEC| |
275 | VM_MAYREAD|VM_MAYWRITE|VM_MAYEXEC| | 270 | VM_MAYREAD|VM_MAYWRITE|VM_MAYEXEC, |
276 | VM_ALWAYSDUMP, | ||
277 | vdso_pagelist); | 271 | vdso_pagelist); |
278 | if (rc) { | 272 | if (rc) { |
279 | current->mm->context.vdso_base = 0; | 273 | current->mm->context.vdso_base = 0; |
diff --git a/arch/s390/kernel/vdso.c b/arch/s390/kernel/vdso.c index e704a9965f90..9c80138206b0 100644 --- a/arch/s390/kernel/vdso.c +++ b/arch/s390/kernel/vdso.c | |||
@@ -241,17 +241,11 @@ int arch_setup_additional_pages(struct linux_binprm *bprm, int uses_interp) | |||
241 | * on the "data" page of the vDSO or you'll stop getting kernel | 241 | * on the "data" page of the vDSO or you'll stop getting kernel |
242 | * updates and your nice userland gettimeofday will be totally dead. | 242 | * updates and your nice userland gettimeofday will be totally dead. |
243 | * It's fine to use that for setting breakpoints in the vDSO code | 243 | * It's fine to use that for setting breakpoints in the vDSO code |
244 | * pages though | 244 | * pages though. |
245 | * | ||
246 | * Make sure the vDSO gets into every core dump. | ||
247 | * Dumping its contents makes post-mortem fully interpretable later | ||
248 | * without matching up the same kernel and hardware config to see | ||
249 | * what PC values meant. | ||
250 | */ | 245 | */ |
251 | rc = install_special_mapping(mm, vdso_base, vdso_pages << PAGE_SHIFT, | 246 | rc = install_special_mapping(mm, vdso_base, vdso_pages << PAGE_SHIFT, |
252 | VM_READ|VM_EXEC| | 247 | VM_READ|VM_EXEC| |
253 | VM_MAYREAD|VM_MAYWRITE|VM_MAYEXEC| | 248 | VM_MAYREAD|VM_MAYWRITE|VM_MAYEXEC, |
254 | VM_ALWAYSDUMP, | ||
255 | vdso_pagelist); | 249 | vdso_pagelist); |
256 | if (rc) | 250 | if (rc) |
257 | current->mm->context.vdso_base = 0; | 251 | current->mm->context.vdso_base = 0; |
diff --git a/arch/sh/kernel/vsyscall/vsyscall.c b/arch/sh/kernel/vsyscall/vsyscall.c index 1d6d51a1ce79..5ca579720a09 100644 --- a/arch/sh/kernel/vsyscall/vsyscall.c +++ b/arch/sh/kernel/vsyscall/vsyscall.c | |||
@@ -73,8 +73,7 @@ int arch_setup_additional_pages(struct linux_binprm *bprm, int uses_interp) | |||
73 | 73 | ||
74 | ret = install_special_mapping(mm, addr, PAGE_SIZE, | 74 | ret = install_special_mapping(mm, addr, PAGE_SIZE, |
75 | VM_READ | VM_EXEC | | 75 | VM_READ | VM_EXEC | |
76 | VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC | | 76 | VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC, |
77 | VM_ALWAYSDUMP, | ||
78 | syscall_pages); | 77 | syscall_pages); |
79 | if (unlikely(ret)) | 78 | if (unlikely(ret)) |
80 | goto up_fail; | 79 | goto up_fail; |
diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig index ca5580e4d813..1666de84d477 100644 --- a/arch/sparc/Kconfig +++ b/arch/sparc/Kconfig | |||
@@ -29,6 +29,7 @@ config SPARC | |||
29 | select GENERIC_IRQ_SHOW | 29 | select GENERIC_IRQ_SHOW |
30 | select USE_GENERIC_SMP_HELPERS if SMP | 30 | select USE_GENERIC_SMP_HELPERS if SMP |
31 | select GENERIC_PCI_IOMAP | 31 | select GENERIC_PCI_IOMAP |
32 | select HAVE_NMI_WATCHDOG if SPARC64 | ||
32 | 33 | ||
33 | config SPARC32 | 34 | config SPARC32 |
34 | def_bool !64BIT | 35 | def_bool !64BIT |
diff --git a/arch/sparc/include/asm/irq_64.h b/arch/sparc/include/asm/irq_64.h index 16dcae6d56e7..abf6afe82ca8 100644 --- a/arch/sparc/include/asm/irq_64.h +++ b/arch/sparc/include/asm/irq_64.h | |||
@@ -95,7 +95,6 @@ void arch_trigger_all_cpu_backtrace(void); | |||
95 | extern void *hardirq_stack[NR_CPUS]; | 95 | extern void *hardirq_stack[NR_CPUS]; |
96 | extern void *softirq_stack[NR_CPUS]; | 96 | extern void *softirq_stack[NR_CPUS]; |
97 | #define __ARCH_HAS_DO_SOFTIRQ | 97 | #define __ARCH_HAS_DO_SOFTIRQ |
98 | #define ARCH_HAS_NMI_WATCHDOG | ||
99 | 98 | ||
100 | #define NO_IRQ 0xffffffff | 99 | #define NO_IRQ 0xffffffff |
101 | 100 | ||
diff --git a/arch/tile/mm/elf.c b/arch/tile/mm/elf.c index 55e58e93bfc5..1a00fb64fc88 100644 --- a/arch/tile/mm/elf.c +++ b/arch/tile/mm/elf.c | |||
@@ -117,17 +117,11 @@ int arch_setup_additional_pages(struct linux_binprm *bprm, | |||
117 | 117 | ||
118 | /* | 118 | /* |
119 | * MAYWRITE to allow gdb to COW and set breakpoints | 119 | * MAYWRITE to allow gdb to COW and set breakpoints |
120 | * | ||
121 | * Make sure the vDSO gets into every core dump. Dumping its | ||
122 | * contents makes post-mortem fully interpretable later | ||
123 | * without matching up the same kernel and hardware config to | ||
124 | * see what PC values meant. | ||
125 | */ | 120 | */ |
126 | vdso_base = VDSO_BASE; | 121 | vdso_base = VDSO_BASE; |
127 | retval = install_special_mapping(mm, vdso_base, PAGE_SIZE, | 122 | retval = install_special_mapping(mm, vdso_base, PAGE_SIZE, |
128 | VM_READ|VM_EXEC| | 123 | VM_READ|VM_EXEC| |
129 | VM_MAYREAD|VM_MAYWRITE|VM_MAYEXEC| | 124 | VM_MAYREAD|VM_MAYWRITE|VM_MAYEXEC, |
130 | VM_ALWAYSDUMP, | ||
131 | vdso_pages); | 125 | vdso_pages); |
132 | 126 | ||
133 | #ifndef __tilegx__ | 127 | #ifndef __tilegx__ |
diff --git a/arch/um/kernel/signal.c b/arch/um/kernel/signal.c index e8b889d3bce7..fb12f4c5e649 100644 --- a/arch/um/kernel/signal.c +++ b/arch/um/kernel/signal.c | |||
@@ -65,21 +65,10 @@ static int handle_signal(struct pt_regs *regs, unsigned long signr, | |||
65 | #endif | 65 | #endif |
66 | err = setup_signal_stack_si(sp, signr, ka, regs, info, oldset); | 66 | err = setup_signal_stack_si(sp, signr, ka, regs, info, oldset); |
67 | 67 | ||
68 | if (err) { | 68 | if (err) |
69 | spin_lock_irq(¤t->sighand->siglock); | ||
70 | current->blocked = *oldset; | ||
71 | recalc_sigpending(); | ||
72 | spin_unlock_irq(¤t->sighand->siglock); | ||
73 | force_sigsegv(signr, current); | 69 | force_sigsegv(signr, current); |
74 | } else { | 70 | else |
75 | spin_lock_irq(¤t->sighand->siglock); | 71 | block_sigmask(ka, signr); |
76 | sigorsets(¤t->blocked, ¤t->blocked, | ||
77 | &ka->sa.sa_mask); | ||
78 | if (!(ka->sa.sa_flags & SA_NODEFER)) | ||
79 | sigaddset(¤t->blocked, signr); | ||
80 | recalc_sigpending(); | ||
81 | spin_unlock_irq(¤t->sighand->siglock); | ||
82 | } | ||
83 | 72 | ||
84 | return err; | 73 | return err; |
85 | } | 74 | } |
@@ -162,12 +151,11 @@ int do_signal(void) | |||
162 | */ | 151 | */ |
163 | long sys_sigsuspend(int history0, int history1, old_sigset_t mask) | 152 | long sys_sigsuspend(int history0, int history1, old_sigset_t mask) |
164 | { | 153 | { |
154 | sigset_t blocked; | ||
155 | |||
165 | mask &= _BLOCKABLE; | 156 | mask &= _BLOCKABLE; |
166 | spin_lock_irq(¤t->sighand->siglock); | 157 | siginitset(&blocked, mask); |
167 | current->saved_sigmask = current->blocked; | 158 | set_current_blocked(&blocked); |
168 | siginitset(¤t->blocked, mask); | ||
169 | recalc_sigpending(); | ||
170 | spin_unlock_irq(¤t->sighand->siglock); | ||
171 | 159 | ||
172 | current->state = TASK_INTERRUPTIBLE; | 160 | current->state = TASK_INTERRUPTIBLE; |
173 | schedule(); | 161 | schedule(); |
diff --git a/arch/unicore32/kernel/process.c b/arch/unicore32/kernel/process.c index 52edc2b62873..432b4291f37b 100644 --- a/arch/unicore32/kernel/process.c +++ b/arch/unicore32/kernel/process.c | |||
@@ -381,7 +381,7 @@ int vectors_user_mapping(void) | |||
381 | return install_special_mapping(mm, 0xffff0000, PAGE_SIZE, | 381 | return install_special_mapping(mm, 0xffff0000, PAGE_SIZE, |
382 | VM_READ | VM_EXEC | | 382 | VM_READ | VM_EXEC | |
383 | VM_MAYREAD | VM_MAYEXEC | | 383 | VM_MAYREAD | VM_MAYEXEC | |
384 | VM_ALWAYSDUMP | VM_RESERVED, | 384 | VM_RESERVED, |
385 | NULL); | 385 | NULL); |
386 | } | 386 | } |
387 | 387 | ||
diff --git a/arch/x86/kernel/cpu/perf_event.c b/arch/x86/kernel/cpu/perf_event.c index 0a18d16cb58d..fa2900c0e398 100644 --- a/arch/x86/kernel/cpu/perf_event.c +++ b/arch/x86/kernel/cpu/perf_event.c | |||
@@ -643,14 +643,14 @@ static bool __perf_sched_find_counter(struct perf_sched *sched) | |||
643 | /* Prefer fixed purpose counters */ | 643 | /* Prefer fixed purpose counters */ |
644 | if (x86_pmu.num_counters_fixed) { | 644 | if (x86_pmu.num_counters_fixed) { |
645 | idx = X86_PMC_IDX_FIXED; | 645 | idx = X86_PMC_IDX_FIXED; |
646 | for_each_set_bit_cont(idx, c->idxmsk, X86_PMC_IDX_MAX) { | 646 | for_each_set_bit_from(idx, c->idxmsk, X86_PMC_IDX_MAX) { |
647 | if (!__test_and_set_bit(idx, sched->state.used)) | 647 | if (!__test_and_set_bit(idx, sched->state.used)) |
648 | goto done; | 648 | goto done; |
649 | } | 649 | } |
650 | } | 650 | } |
651 | /* Grab the first unused counter starting with idx */ | 651 | /* Grab the first unused counter starting with idx */ |
652 | idx = sched->state.counter; | 652 | idx = sched->state.counter; |
653 | for_each_set_bit_cont(idx, c->idxmsk, X86_PMC_IDX_FIXED) { | 653 | for_each_set_bit_from(idx, c->idxmsk, X86_PMC_IDX_FIXED) { |
654 | if (!__test_and_set_bit(idx, sched->state.used)) | 654 | if (!__test_and_set_bit(idx, sched->state.used)) |
655 | goto done; | 655 | goto done; |
656 | } | 656 | } |
diff --git a/arch/x86/kernel/irqinit.c b/arch/x86/kernel/irqinit.c index 313fb5cddbce..43e2b1cff0a7 100644 --- a/arch/x86/kernel/irqinit.c +++ b/arch/x86/kernel/irqinit.c | |||
@@ -306,10 +306,10 @@ void __init native_init_IRQ(void) | |||
306 | * us. (some of these will be overridden and become | 306 | * us. (some of these will be overridden and become |
307 | * 'special' SMP interrupts) | 307 | * 'special' SMP interrupts) |
308 | */ | 308 | */ |
309 | for (i = FIRST_EXTERNAL_VECTOR; i < NR_VECTORS; i++) { | 309 | i = FIRST_EXTERNAL_VECTOR; |
310 | for_each_clear_bit_from(i, used_vectors, NR_VECTORS) { | ||
310 | /* IA32_SYSCALL_VECTOR could be used in trap_init already. */ | 311 | /* IA32_SYSCALL_VECTOR could be used in trap_init already. */ |
311 | if (!test_bit(i, used_vectors)) | 312 | set_intr_gate(i, interrupt[i - FIRST_EXTERNAL_VECTOR]); |
312 | set_intr_gate(i, interrupt[i-FIRST_EXTERNAL_VECTOR]); | ||
313 | } | 313 | } |
314 | 314 | ||
315 | if (!acpi_ioapic && !of_ioapic) | 315 | if (!acpi_ioapic && !of_ioapic) |
diff --git a/arch/x86/um/mem_32.c b/arch/x86/um/mem_32.c index 639900a6fde9..f40281e5d6a2 100644 --- a/arch/x86/um/mem_32.c +++ b/arch/x86/um/mem_32.c | |||
@@ -23,14 +23,6 @@ static int __init gate_vma_init(void) | |||
23 | gate_vma.vm_flags = VM_READ | VM_MAYREAD | VM_EXEC | VM_MAYEXEC; | 23 | gate_vma.vm_flags = VM_READ | VM_MAYREAD | VM_EXEC | VM_MAYEXEC; |
24 | gate_vma.vm_page_prot = __P101; | 24 | gate_vma.vm_page_prot = __P101; |
25 | 25 | ||
26 | /* | ||
27 | * Make sure the vDSO gets into every core dump. | ||
28 | * Dumping its contents makes post-mortem fully interpretable later | ||
29 | * without matching up the same kernel and hardware config to see | ||
30 | * what PC values meant. | ||
31 | */ | ||
32 | gate_vma.vm_flags |= VM_ALWAYSDUMP; | ||
33 | |||
34 | return 0; | 26 | return 0; |
35 | } | 27 | } |
36 | __initcall(gate_vma_init); | 28 | __initcall(gate_vma_init); |
diff --git a/arch/x86/um/vdso/vma.c b/arch/x86/um/vdso/vma.c index 91f4ec9a0a56..af91901babb8 100644 --- a/arch/x86/um/vdso/vma.c +++ b/arch/x86/um/vdso/vma.c | |||
@@ -64,8 +64,7 @@ int arch_setup_additional_pages(struct linux_binprm *bprm, int uses_interp) | |||
64 | 64 | ||
65 | err = install_special_mapping(mm, um_vdso_addr, PAGE_SIZE, | 65 | err = install_special_mapping(mm, um_vdso_addr, PAGE_SIZE, |
66 | VM_READ|VM_EXEC| | 66 | VM_READ|VM_EXEC| |
67 | VM_MAYREAD|VM_MAYWRITE|VM_MAYEXEC| | 67 | VM_MAYREAD|VM_MAYWRITE|VM_MAYEXEC, |
68 | VM_ALWAYSDUMP, | ||
69 | vdsop); | 68 | vdsop); |
70 | 69 | ||
71 | up_write(&mm->mmap_sem); | 70 | up_write(&mm->mmap_sem); |
diff --git a/arch/x86/vdso/vdso32-setup.c b/arch/x86/vdso/vdso32-setup.c index 468d591dde31..a944020fa859 100644 --- a/arch/x86/vdso/vdso32-setup.c +++ b/arch/x86/vdso/vdso32-setup.c | |||
@@ -250,13 +250,7 @@ static int __init gate_vma_init(void) | |||
250 | gate_vma.vm_end = FIXADDR_USER_END; | 250 | gate_vma.vm_end = FIXADDR_USER_END; |
251 | gate_vma.vm_flags = VM_READ | VM_MAYREAD | VM_EXEC | VM_MAYEXEC; | 251 | gate_vma.vm_flags = VM_READ | VM_MAYREAD | VM_EXEC | VM_MAYEXEC; |
252 | gate_vma.vm_page_prot = __P101; | 252 | gate_vma.vm_page_prot = __P101; |
253 | /* | 253 | |
254 | * Make sure the vDSO gets into every core dump. | ||
255 | * Dumping its contents makes post-mortem fully interpretable later | ||
256 | * without matching up the same kernel and hardware config to see | ||
257 | * what PC values meant. | ||
258 | */ | ||
259 | gate_vma.vm_flags |= VM_ALWAYSDUMP; | ||
260 | return 0; | 254 | return 0; |
261 | } | 255 | } |
262 | 256 | ||
@@ -343,17 +337,10 @@ int arch_setup_additional_pages(struct linux_binprm *bprm, int uses_interp) | |||
343 | if (compat_uses_vma || !compat) { | 337 | if (compat_uses_vma || !compat) { |
344 | /* | 338 | /* |
345 | * MAYWRITE to allow gdb to COW and set breakpoints | 339 | * MAYWRITE to allow gdb to COW and set breakpoints |
346 | * | ||
347 | * Make sure the vDSO gets into every core dump. | ||
348 | * Dumping its contents makes post-mortem fully | ||
349 | * interpretable later without matching up the same | ||
350 | * kernel and hardware config to see what PC values | ||
351 | * meant. | ||
352 | */ | 340 | */ |
353 | ret = install_special_mapping(mm, addr, PAGE_SIZE, | 341 | ret = install_special_mapping(mm, addr, PAGE_SIZE, |
354 | VM_READ|VM_EXEC| | 342 | VM_READ|VM_EXEC| |
355 | VM_MAYREAD|VM_MAYWRITE|VM_MAYEXEC| | 343 | VM_MAYREAD|VM_MAYWRITE|VM_MAYEXEC, |
356 | VM_ALWAYSDUMP, | ||
357 | vdso32_pages); | 344 | vdso32_pages); |
358 | 345 | ||
359 | if (ret) | 346 | if (ret) |
diff --git a/arch/x86/vdso/vma.c b/arch/x86/vdso/vma.c index 153407c35b75..17e18279649f 100644 --- a/arch/x86/vdso/vma.c +++ b/arch/x86/vdso/vma.c | |||
@@ -124,8 +124,7 @@ int arch_setup_additional_pages(struct linux_binprm *bprm, int uses_interp) | |||
124 | 124 | ||
125 | ret = install_special_mapping(mm, addr, vdso_size, | 125 | ret = install_special_mapping(mm, addr, vdso_size, |
126 | VM_READ|VM_EXEC| | 126 | VM_READ|VM_EXEC| |
127 | VM_MAYREAD|VM_MAYWRITE|VM_MAYEXEC| | 127 | VM_MAYREAD|VM_MAYWRITE|VM_MAYEXEC, |
128 | VM_ALWAYSDUMP, | ||
129 | vdso_pages); | 128 | vdso_pages); |
130 | if (ret) { | 129 | if (ret) { |
131 | current->mm->context.vdso = NULL; | 130 | current->mm->context.vdso = NULL; |
diff --git a/arch/xtensa/include/asm/mman.h b/arch/xtensa/include/asm/mman.h index 30789010733d..25bc6c1309c3 100644 --- a/arch/xtensa/include/asm/mman.h +++ b/arch/xtensa/include/asm/mman.h | |||
@@ -86,6 +86,10 @@ | |||
86 | #define MADV_HUGEPAGE 14 /* Worth backing with hugepages */ | 86 | #define MADV_HUGEPAGE 14 /* Worth backing with hugepages */ |
87 | #define MADV_NOHUGEPAGE 15 /* Not worth backing with hugepages */ | 87 | #define MADV_NOHUGEPAGE 15 /* Not worth backing with hugepages */ |
88 | 88 | ||
89 | #define MADV_DONTDUMP 16 /* Explicity exclude from the core dump, | ||
90 | overrides the coredump filter bits */ | ||
91 | #define MADV_DODUMP 17 /* Clear the MADV_NODUMP flag */ | ||
92 | |||
89 | /* compatibility flags */ | 93 | /* compatibility flags */ |
90 | #define MAP_FILE 0 | 94 | #define MAP_FILE 0 |
91 | 95 | ||
diff --git a/crypto/Kconfig b/crypto/Kconfig index 6318edd6a457..21ff9d015432 100644 --- a/crypto/Kconfig +++ b/crypto/Kconfig | |||
@@ -308,6 +308,7 @@ comment "Digest" | |||
308 | config CRYPTO_CRC32C | 308 | config CRYPTO_CRC32C |
309 | tristate "CRC32c CRC algorithm" | 309 | tristate "CRC32c CRC algorithm" |
310 | select CRYPTO_HASH | 310 | select CRYPTO_HASH |
311 | select CRC32 | ||
311 | help | 312 | help |
312 | Castagnoli, et al Cyclic Redundancy-Check Algorithm. Used | 313 | Castagnoli, et al Cyclic Redundancy-Check Algorithm. Used |
313 | by iSCSI for header and data digests and by others. | 314 | by iSCSI for header and data digests and by others. |
diff --git a/crypto/crc32c.c b/crypto/crc32c.c index 3f9ad2801052..06f7018c9d95 100644 --- a/crypto/crc32c.c +++ b/crypto/crc32c.c | |||
@@ -40,6 +40,7 @@ | |||
40 | #include <linux/module.h> | 40 | #include <linux/module.h> |
41 | #include <linux/string.h> | 41 | #include <linux/string.h> |
42 | #include <linux/kernel.h> | 42 | #include <linux/kernel.h> |
43 | #include <linux/crc32.h> | ||
43 | 44 | ||
44 | #define CHKSUM_BLOCK_SIZE 1 | 45 | #define CHKSUM_BLOCK_SIZE 1 |
45 | #define CHKSUM_DIGEST_SIZE 4 | 46 | #define CHKSUM_DIGEST_SIZE 4 |
@@ -53,95 +54,6 @@ struct chksum_desc_ctx { | |||
53 | }; | 54 | }; |
54 | 55 | ||
55 | /* | 56 | /* |
56 | * This is the CRC-32C table | ||
57 | * Generated with: | ||
58 | * width = 32 bits | ||
59 | * poly = 0x1EDC6F41 | ||
60 | * reflect input bytes = true | ||
61 | * reflect output bytes = true | ||
62 | */ | ||
63 | |||
64 | static const u32 crc32c_table[256] = { | ||
65 | 0x00000000L, 0xF26B8303L, 0xE13B70F7L, 0x1350F3F4L, | ||
66 | 0xC79A971FL, 0x35F1141CL, 0x26A1E7E8L, 0xD4CA64EBL, | ||
67 | 0x8AD958CFL, 0x78B2DBCCL, 0x6BE22838L, 0x9989AB3BL, | ||
68 | 0x4D43CFD0L, 0xBF284CD3L, 0xAC78BF27L, 0x5E133C24L, | ||
69 | 0x105EC76FL, 0xE235446CL, 0xF165B798L, 0x030E349BL, | ||
70 | 0xD7C45070L, 0x25AFD373L, 0x36FF2087L, 0xC494A384L, | ||
71 | 0x9A879FA0L, 0x68EC1CA3L, 0x7BBCEF57L, 0x89D76C54L, | ||
72 | 0x5D1D08BFL, 0xAF768BBCL, 0xBC267848L, 0x4E4DFB4BL, | ||
73 | 0x20BD8EDEL, 0xD2D60DDDL, 0xC186FE29L, 0x33ED7D2AL, | ||
74 | 0xE72719C1L, 0x154C9AC2L, 0x061C6936L, 0xF477EA35L, | ||
75 | 0xAA64D611L, 0x580F5512L, 0x4B5FA6E6L, 0xB93425E5L, | ||
76 | 0x6DFE410EL, 0x9F95C20DL, 0x8CC531F9L, 0x7EAEB2FAL, | ||
77 | 0x30E349B1L, 0xC288CAB2L, 0xD1D83946L, 0x23B3BA45L, | ||
78 | 0xF779DEAEL, 0x05125DADL, 0x1642AE59L, 0xE4292D5AL, | ||
79 | 0xBA3A117EL, 0x4851927DL, 0x5B016189L, 0xA96AE28AL, | ||
80 | 0x7DA08661L, 0x8FCB0562L, 0x9C9BF696L, 0x6EF07595L, | ||
81 | 0x417B1DBCL, 0xB3109EBFL, 0xA0406D4BL, 0x522BEE48L, | ||
82 | 0x86E18AA3L, 0x748A09A0L, 0x67DAFA54L, 0x95B17957L, | ||
83 | 0xCBA24573L, 0x39C9C670L, 0x2A993584L, 0xD8F2B687L, | ||
84 | 0x0C38D26CL, 0xFE53516FL, 0xED03A29BL, 0x1F682198L, | ||
85 | 0x5125DAD3L, 0xA34E59D0L, 0xB01EAA24L, 0x42752927L, | ||
86 | 0x96BF4DCCL, 0x64D4CECFL, 0x77843D3BL, 0x85EFBE38L, | ||
87 | 0xDBFC821CL, 0x2997011FL, 0x3AC7F2EBL, 0xC8AC71E8L, | ||
88 | 0x1C661503L, 0xEE0D9600L, 0xFD5D65F4L, 0x0F36E6F7L, | ||
89 | 0x61C69362L, 0x93AD1061L, 0x80FDE395L, 0x72966096L, | ||
90 | 0xA65C047DL, 0x5437877EL, 0x4767748AL, 0xB50CF789L, | ||
91 | 0xEB1FCBADL, 0x197448AEL, 0x0A24BB5AL, 0xF84F3859L, | ||
92 | 0x2C855CB2L, 0xDEEEDFB1L, 0xCDBE2C45L, 0x3FD5AF46L, | ||
93 | 0x7198540DL, 0x83F3D70EL, 0x90A324FAL, 0x62C8A7F9L, | ||
94 | 0xB602C312L, 0x44694011L, 0x5739B3E5L, 0xA55230E6L, | ||
95 | 0xFB410CC2L, 0x092A8FC1L, 0x1A7A7C35L, 0xE811FF36L, | ||
96 | 0x3CDB9BDDL, 0xCEB018DEL, 0xDDE0EB2AL, 0x2F8B6829L, | ||
97 | 0x82F63B78L, 0x709DB87BL, 0x63CD4B8FL, 0x91A6C88CL, | ||
98 | 0x456CAC67L, 0xB7072F64L, 0xA457DC90L, 0x563C5F93L, | ||
99 | 0x082F63B7L, 0xFA44E0B4L, 0xE9141340L, 0x1B7F9043L, | ||
100 | 0xCFB5F4A8L, 0x3DDE77ABL, 0x2E8E845FL, 0xDCE5075CL, | ||
101 | 0x92A8FC17L, 0x60C37F14L, 0x73938CE0L, 0x81F80FE3L, | ||
102 | 0x55326B08L, 0xA759E80BL, 0xB4091BFFL, 0x466298FCL, | ||
103 | 0x1871A4D8L, 0xEA1A27DBL, 0xF94AD42FL, 0x0B21572CL, | ||
104 | 0xDFEB33C7L, 0x2D80B0C4L, 0x3ED04330L, 0xCCBBC033L, | ||
105 | 0xA24BB5A6L, 0x502036A5L, 0x4370C551L, 0xB11B4652L, | ||
106 | 0x65D122B9L, 0x97BAA1BAL, 0x84EA524EL, 0x7681D14DL, | ||
107 | 0x2892ED69L, 0xDAF96E6AL, 0xC9A99D9EL, 0x3BC21E9DL, | ||
108 | 0xEF087A76L, 0x1D63F975L, 0x0E330A81L, 0xFC588982L, | ||
109 | 0xB21572C9L, 0x407EF1CAL, 0x532E023EL, 0xA145813DL, | ||
110 | 0x758FE5D6L, 0x87E466D5L, 0x94B49521L, 0x66DF1622L, | ||
111 | 0x38CC2A06L, 0xCAA7A905L, 0xD9F75AF1L, 0x2B9CD9F2L, | ||
112 | 0xFF56BD19L, 0x0D3D3E1AL, 0x1E6DCDEEL, 0xEC064EEDL, | ||
113 | 0xC38D26C4L, 0x31E6A5C7L, 0x22B65633L, 0xD0DDD530L, | ||
114 | 0x0417B1DBL, 0xF67C32D8L, 0xE52CC12CL, 0x1747422FL, | ||
115 | 0x49547E0BL, 0xBB3FFD08L, 0xA86F0EFCL, 0x5A048DFFL, | ||
116 | 0x8ECEE914L, 0x7CA56A17L, 0x6FF599E3L, 0x9D9E1AE0L, | ||
117 | 0xD3D3E1ABL, 0x21B862A8L, 0x32E8915CL, 0xC083125FL, | ||
118 | 0x144976B4L, 0xE622F5B7L, 0xF5720643L, 0x07198540L, | ||
119 | 0x590AB964L, 0xAB613A67L, 0xB831C993L, 0x4A5A4A90L, | ||
120 | 0x9E902E7BL, 0x6CFBAD78L, 0x7FAB5E8CL, 0x8DC0DD8FL, | ||
121 | 0xE330A81AL, 0x115B2B19L, 0x020BD8EDL, 0xF0605BEEL, | ||
122 | 0x24AA3F05L, 0xD6C1BC06L, 0xC5914FF2L, 0x37FACCF1L, | ||
123 | 0x69E9F0D5L, 0x9B8273D6L, 0x88D28022L, 0x7AB90321L, | ||
124 | 0xAE7367CAL, 0x5C18E4C9L, 0x4F48173DL, 0xBD23943EL, | ||
125 | 0xF36E6F75L, 0x0105EC76L, 0x12551F82L, 0xE03E9C81L, | ||
126 | 0x34F4F86AL, 0xC69F7B69L, 0xD5CF889DL, 0x27A40B9EL, | ||
127 | 0x79B737BAL, 0x8BDCB4B9L, 0x988C474DL, 0x6AE7C44EL, | ||
128 | 0xBE2DA0A5L, 0x4C4623A6L, 0x5F16D052L, 0xAD7D5351L | ||
129 | }; | ||
130 | |||
131 | /* | ||
132 | * Steps through buffer one byte at at time, calculates reflected | ||
133 | * crc using table. | ||
134 | */ | ||
135 | |||
136 | static u32 crc32c(u32 crc, const u8 *data, unsigned int length) | ||
137 | { | ||
138 | while (length--) | ||
139 | crc = crc32c_table[(crc ^ *data++) & 0xFFL] ^ (crc >> 8); | ||
140 | |||
141 | return crc; | ||
142 | } | ||
143 | |||
144 | /* | ||
145 | * Steps through buffer one byte at at time, calculates reflected | 57 | * Steps through buffer one byte at at time, calculates reflected |
146 | * crc using table. | 58 | * crc using table. |
147 | */ | 59 | */ |
@@ -179,7 +91,7 @@ static int chksum_update(struct shash_desc *desc, const u8 *data, | |||
179 | { | 91 | { |
180 | struct chksum_desc_ctx *ctx = shash_desc_ctx(desc); | 92 | struct chksum_desc_ctx *ctx = shash_desc_ctx(desc); |
181 | 93 | ||
182 | ctx->crc = crc32c(ctx->crc, data, length); | 94 | ctx->crc = __crc32c_le(ctx->crc, data, length); |
183 | return 0; | 95 | return 0; |
184 | } | 96 | } |
185 | 97 | ||
@@ -193,7 +105,7 @@ static int chksum_final(struct shash_desc *desc, u8 *out) | |||
193 | 105 | ||
194 | static int __chksum_finup(u32 *crcp, const u8 *data, unsigned int len, u8 *out) | 106 | static int __chksum_finup(u32 *crcp, const u8 *data, unsigned int len, u8 *out) |
195 | { | 107 | { |
196 | *(__le32 *)out = ~cpu_to_le32(crc32c(*crcp, data, len)); | 108 | *(__le32 *)out = ~cpu_to_le32(__crc32c_le(*crcp, data, len)); |
197 | return 0; | 109 | return 0; |
198 | } | 110 | } |
199 | 111 | ||
diff --git a/drivers/base/regmap/regcache-lzo.c b/drivers/base/regmap/regcache-lzo.c index 8d0061569326..77dc53272289 100644 --- a/drivers/base/regmap/regcache-lzo.c +++ b/drivers/base/regmap/regcache-lzo.c | |||
@@ -341,7 +341,7 @@ static int regcache_lzo_sync(struct regmap *map, unsigned int min, | |||
341 | 341 | ||
342 | lzo_blocks = map->cache; | 342 | lzo_blocks = map->cache; |
343 | i = min; | 343 | i = min; |
344 | for_each_set_bit_cont(i, lzo_blocks[0]->sync_bmp, | 344 | for_each_set_bit_from(i, lzo_blocks[0]->sync_bmp, |
345 | lzo_blocks[0]->sync_bmp_nbits) { | 345 | lzo_blocks[0]->sync_bmp_nbits) { |
346 | if (i > max) | 346 | if (i > max) |
347 | continue; | 347 | continue; |
diff --git a/drivers/block/drbd/drbd_nl.c b/drivers/block/drbd/drbd_nl.c index e09f9cebbb20..abfaacaaf346 100644 --- a/drivers/block/drbd/drbd_nl.c +++ b/drivers/block/drbd/drbd_nl.c | |||
@@ -179,7 +179,7 @@ int drbd_khelper(struct drbd_conf *mdev, char *cmd) | |||
179 | dev_info(DEV, "helper command: %s %s %s\n", usermode_helper, cmd, mb); | 179 | dev_info(DEV, "helper command: %s %s %s\n", usermode_helper, cmd, mb); |
180 | 180 | ||
181 | drbd_bcast_ev_helper(mdev, cmd); | 181 | drbd_bcast_ev_helper(mdev, cmd); |
182 | ret = call_usermodehelper(usermode_helper, argv, envp, 1); | 182 | ret = call_usermodehelper(usermode_helper, argv, envp, UMH_WAIT_PROC); |
183 | if (ret) | 183 | if (ret) |
184 | dev_warn(DEV, "helper command: %s %s %s exit code %u (0x%x)\n", | 184 | dev_warn(DEV, "helper command: %s %s %s exit code %u (0x%x)\n", |
185 | usermode_helper, cmd, mb, | 185 | usermode_helper, cmd, mb, |
diff --git a/drivers/leds/Kconfig b/drivers/leds/Kconfig index 8c7a75d53101..589ba02d65a2 100644 --- a/drivers/leds/Kconfig +++ b/drivers/leds/Kconfig | |||
@@ -17,7 +17,7 @@ menuconfig NEW_LEDS | |||
17 | if NEW_LEDS | 17 | if NEW_LEDS |
18 | 18 | ||
19 | config LEDS_CLASS | 19 | config LEDS_CLASS |
20 | bool "LED Class Support" | 20 | tristate "LED Class Support" |
21 | help | 21 | help |
22 | This option enables the led sysfs class in /sys/class/leds. You'll | 22 | This option enables the led sysfs class in /sys/class/leds. You'll |
23 | need this to do anything useful with LEDs. If unsure, say N. | 23 | need this to do anything useful with LEDs. If unsure, say N. |
@@ -234,6 +234,14 @@ config LEDS_PCA955X | |||
234 | LED driver chips accessed via the I2C bus. Supported | 234 | LED driver chips accessed via the I2C bus. Supported |
235 | devices include PCA9550, PCA9551, PCA9552, and PCA9553. | 235 | devices include PCA9550, PCA9551, PCA9552, and PCA9553. |
236 | 236 | ||
237 | config LEDS_PCA9633 | ||
238 | tristate "LED support for PCA9633 I2C chip" | ||
239 | depends on LEDS_CLASS | ||
240 | depends on I2C | ||
241 | help | ||
242 | This option enables support for LEDs connected to the PCA9633 | ||
243 | LED driver chip accessed via the I2C bus. | ||
244 | |||
237 | config LEDS_WM831X_STATUS | 245 | config LEDS_WM831X_STATUS |
238 | tristate "LED support for status LEDs on WM831x PMICs" | 246 | tristate "LED support for status LEDs on WM831x PMICs" |
239 | depends on LEDS_CLASS | 247 | depends on LEDS_CLASS |
diff --git a/drivers/leds/Makefile b/drivers/leds/Makefile index 6bcf4f695515..fa0f428b32fe 100644 --- a/drivers/leds/Makefile +++ b/drivers/leds/Makefile | |||
@@ -30,6 +30,7 @@ obj-$(CONFIG_LEDS_HP6XX) += leds-hp6xx.o | |||
30 | obj-$(CONFIG_LEDS_OT200) += leds-ot200.o | 30 | obj-$(CONFIG_LEDS_OT200) += leds-ot200.o |
31 | obj-$(CONFIG_LEDS_FSG) += leds-fsg.o | 31 | obj-$(CONFIG_LEDS_FSG) += leds-fsg.o |
32 | obj-$(CONFIG_LEDS_PCA955X) += leds-pca955x.o | 32 | obj-$(CONFIG_LEDS_PCA955X) += leds-pca955x.o |
33 | obj-$(CONFIG_LEDS_PCA9633) += leds-pca9633.o | ||
33 | obj-$(CONFIG_LEDS_DA903X) += leds-da903x.o | 34 | obj-$(CONFIG_LEDS_DA903X) += leds-da903x.o |
34 | obj-$(CONFIG_LEDS_WM831X_STATUS) += leds-wm831x-status.o | 35 | obj-$(CONFIG_LEDS_WM831X_STATUS) += leds-wm831x-status.o |
35 | obj-$(CONFIG_LEDS_WM8350) += leds-wm8350.o | 36 | obj-$(CONFIG_LEDS_WM8350) += leds-wm8350.o |
diff --git a/drivers/leds/led-class.c b/drivers/leds/led-class.c index 0c8739c448b1..5bff8439dc68 100644 --- a/drivers/leds/led-class.c +++ b/drivers/leds/led-class.c | |||
@@ -110,50 +110,6 @@ static void led_timer_function(unsigned long data) | |||
110 | mod_timer(&led_cdev->blink_timer, jiffies + msecs_to_jiffies(delay)); | 110 | mod_timer(&led_cdev->blink_timer, jiffies + msecs_to_jiffies(delay)); |
111 | } | 111 | } |
112 | 112 | ||
113 | static void led_stop_software_blink(struct led_classdev *led_cdev) | ||
114 | { | ||
115 | /* deactivate previous settings */ | ||
116 | del_timer_sync(&led_cdev->blink_timer); | ||
117 | led_cdev->blink_delay_on = 0; | ||
118 | led_cdev->blink_delay_off = 0; | ||
119 | } | ||
120 | |||
121 | static void led_set_software_blink(struct led_classdev *led_cdev, | ||
122 | unsigned long delay_on, | ||
123 | unsigned long delay_off) | ||
124 | { | ||
125 | int current_brightness; | ||
126 | |||
127 | current_brightness = led_get_brightness(led_cdev); | ||
128 | if (current_brightness) | ||
129 | led_cdev->blink_brightness = current_brightness; | ||
130 | if (!led_cdev->blink_brightness) | ||
131 | led_cdev->blink_brightness = led_cdev->max_brightness; | ||
132 | |||
133 | if (led_get_trigger_data(led_cdev) && | ||
134 | delay_on == led_cdev->blink_delay_on && | ||
135 | delay_off == led_cdev->blink_delay_off) | ||
136 | return; | ||
137 | |||
138 | led_stop_software_blink(led_cdev); | ||
139 | |||
140 | led_cdev->blink_delay_on = delay_on; | ||
141 | led_cdev->blink_delay_off = delay_off; | ||
142 | |||
143 | /* never on - don't blink */ | ||
144 | if (!delay_on) | ||
145 | return; | ||
146 | |||
147 | /* never off - just set to brightness */ | ||
148 | if (!delay_off) { | ||
149 | led_set_brightness(led_cdev, led_cdev->blink_brightness); | ||
150 | return; | ||
151 | } | ||
152 | |||
153 | mod_timer(&led_cdev->blink_timer, jiffies + 1); | ||
154 | } | ||
155 | |||
156 | |||
157 | /** | 113 | /** |
158 | * led_classdev_suspend - suspend an led_classdev. | 114 | * led_classdev_suspend - suspend an led_classdev. |
159 | * @led_cdev: the led_classdev to suspend. | 115 | * @led_cdev: the led_classdev to suspend. |
@@ -262,32 +218,6 @@ void led_classdev_unregister(struct led_classdev *led_cdev) | |||
262 | } | 218 | } |
263 | EXPORT_SYMBOL_GPL(led_classdev_unregister); | 219 | EXPORT_SYMBOL_GPL(led_classdev_unregister); |
264 | 220 | ||
265 | void led_blink_set(struct led_classdev *led_cdev, | ||
266 | unsigned long *delay_on, | ||
267 | unsigned long *delay_off) | ||
268 | { | ||
269 | del_timer_sync(&led_cdev->blink_timer); | ||
270 | |||
271 | if (led_cdev->blink_set && | ||
272 | !led_cdev->blink_set(led_cdev, delay_on, delay_off)) | ||
273 | return; | ||
274 | |||
275 | /* blink with 1 Hz as default if nothing specified */ | ||
276 | if (!*delay_on && !*delay_off) | ||
277 | *delay_on = *delay_off = 500; | ||
278 | |||
279 | led_set_software_blink(led_cdev, *delay_on, *delay_off); | ||
280 | } | ||
281 | EXPORT_SYMBOL(led_blink_set); | ||
282 | |||
283 | void led_brightness_set(struct led_classdev *led_cdev, | ||
284 | enum led_brightness brightness) | ||
285 | { | ||
286 | led_stop_software_blink(led_cdev); | ||
287 | led_cdev->brightness_set(led_cdev, brightness); | ||
288 | } | ||
289 | EXPORT_SYMBOL(led_brightness_set); | ||
290 | |||
291 | static int __init leds_init(void) | 221 | static int __init leds_init(void) |
292 | { | 222 | { |
293 | leds_class = class_create(THIS_MODULE, "leds"); | 223 | leds_class = class_create(THIS_MODULE, "leds"); |
diff --git a/drivers/leds/led-core.c b/drivers/leds/led-core.c index 016d19f5486f..d6860043f6f9 100644 --- a/drivers/leds/led-core.c +++ b/drivers/leds/led-core.c | |||
@@ -23,3 +23,73 @@ EXPORT_SYMBOL_GPL(leds_list_lock); | |||
23 | 23 | ||
24 | LIST_HEAD(leds_list); | 24 | LIST_HEAD(leds_list); |
25 | EXPORT_SYMBOL_GPL(leds_list); | 25 | EXPORT_SYMBOL_GPL(leds_list); |
26 | |||
27 | static void led_stop_software_blink(struct led_classdev *led_cdev) | ||
28 | { | ||
29 | /* deactivate previous settings */ | ||
30 | del_timer_sync(&led_cdev->blink_timer); | ||
31 | led_cdev->blink_delay_on = 0; | ||
32 | led_cdev->blink_delay_off = 0; | ||
33 | } | ||
34 | |||
35 | static void led_set_software_blink(struct led_classdev *led_cdev, | ||
36 | unsigned long delay_on, | ||
37 | unsigned long delay_off) | ||
38 | { | ||
39 | int current_brightness; | ||
40 | |||
41 | current_brightness = led_get_brightness(led_cdev); | ||
42 | if (current_brightness) | ||
43 | led_cdev->blink_brightness = current_brightness; | ||
44 | if (!led_cdev->blink_brightness) | ||
45 | led_cdev->blink_brightness = led_cdev->max_brightness; | ||
46 | |||
47 | if (led_get_trigger_data(led_cdev) && | ||
48 | delay_on == led_cdev->blink_delay_on && | ||
49 | delay_off == led_cdev->blink_delay_off) | ||
50 | return; | ||
51 | |||
52 | led_stop_software_blink(led_cdev); | ||
53 | |||
54 | led_cdev->blink_delay_on = delay_on; | ||
55 | led_cdev->blink_delay_off = delay_off; | ||
56 | |||
57 | /* never on - don't blink */ | ||
58 | if (!delay_on) | ||
59 | return; | ||
60 | |||
61 | /* never off - just set to brightness */ | ||
62 | if (!delay_off) { | ||
63 | led_set_brightness(led_cdev, led_cdev->blink_brightness); | ||
64 | return; | ||
65 | } | ||
66 | |||
67 | mod_timer(&led_cdev->blink_timer, jiffies + 1); | ||
68 | } | ||
69 | |||
70 | |||
71 | void led_blink_set(struct led_classdev *led_cdev, | ||
72 | unsigned long *delay_on, | ||
73 | unsigned long *delay_off) | ||
74 | { | ||
75 | del_timer_sync(&led_cdev->blink_timer); | ||
76 | |||
77 | if (led_cdev->blink_set && | ||
78 | !led_cdev->blink_set(led_cdev, delay_on, delay_off)) | ||
79 | return; | ||
80 | |||
81 | /* blink with 1 Hz as default if nothing specified */ | ||
82 | if (!*delay_on && !*delay_off) | ||
83 | *delay_on = *delay_off = 500; | ||
84 | |||
85 | led_set_software_blink(led_cdev, *delay_on, *delay_off); | ||
86 | } | ||
87 | EXPORT_SYMBOL(led_blink_set); | ||
88 | |||
89 | void led_brightness_set(struct led_classdev *led_cdev, | ||
90 | enum led_brightness brightness) | ||
91 | { | ||
92 | led_stop_software_blink(led_cdev); | ||
93 | led_cdev->brightness_set(led_cdev, brightness); | ||
94 | } | ||
95 | EXPORT_SYMBOL(led_brightness_set); | ||
diff --git a/drivers/leds/leds-gpio.c b/drivers/leds/leds-gpio.c index 7df74cb97e70..f4c470a3bc8d 100644 --- a/drivers/leds/leds-gpio.c +++ b/drivers/leds/leds-gpio.c | |||
@@ -13,6 +13,7 @@ | |||
13 | #include <linux/kernel.h> | 13 | #include <linux/kernel.h> |
14 | #include <linux/init.h> | 14 | #include <linux/init.h> |
15 | #include <linux/platform_device.h> | 15 | #include <linux/platform_device.h> |
16 | #include <linux/gpio.h> | ||
16 | #include <linux/leds.h> | 17 | #include <linux/leds.h> |
17 | #include <linux/of_platform.h> | 18 | #include <linux/of_platform.h> |
18 | #include <linux/of_gpio.h> | 19 | #include <linux/of_gpio.h> |
@@ -20,8 +21,6 @@ | |||
20 | #include <linux/workqueue.h> | 21 | #include <linux/workqueue.h> |
21 | #include <linux/module.h> | 22 | #include <linux/module.h> |
22 | 23 | ||
23 | #include <asm/gpio.h> | ||
24 | |||
25 | struct gpio_led_data { | 24 | struct gpio_led_data { |
26 | struct led_classdev cdev; | 25 | struct led_classdev cdev; |
27 | unsigned gpio; | 26 | unsigned gpio; |
diff --git a/drivers/leds/leds-lm3530.c b/drivers/leds/leds-lm3530.c index e59c166a0ce2..968fd5fef4fc 100644 --- a/drivers/leds/leds-lm3530.c +++ b/drivers/leds/leds-lm3530.c | |||
@@ -26,7 +26,6 @@ | |||
26 | #define LM3530_GEN_CONFIG 0x10 | 26 | #define LM3530_GEN_CONFIG 0x10 |
27 | #define LM3530_ALS_CONFIG 0x20 | 27 | #define LM3530_ALS_CONFIG 0x20 |
28 | #define LM3530_BRT_RAMP_RATE 0x30 | 28 | #define LM3530_BRT_RAMP_RATE 0x30 |
29 | #define LM3530_ALS_ZONE_REG 0x40 | ||
30 | #define LM3530_ALS_IMP_SELECT 0x41 | 29 | #define LM3530_ALS_IMP_SELECT 0x41 |
31 | #define LM3530_BRT_CTRL_REG 0xA0 | 30 | #define LM3530_BRT_CTRL_REG 0xA0 |
32 | #define LM3530_ALS_ZB0_REG 0x60 | 31 | #define LM3530_ALS_ZB0_REG 0x60 |
@@ -38,7 +37,7 @@ | |||
38 | #define LM3530_ALS_Z2T_REG 0x72 | 37 | #define LM3530_ALS_Z2T_REG 0x72 |
39 | #define LM3530_ALS_Z3T_REG 0x73 | 38 | #define LM3530_ALS_Z3T_REG 0x73 |
40 | #define LM3530_ALS_Z4T_REG 0x74 | 39 | #define LM3530_ALS_Z4T_REG 0x74 |
41 | #define LM3530_REG_MAX 15 | 40 | #define LM3530_REG_MAX 14 |
42 | 41 | ||
43 | /* General Control Register */ | 42 | /* General Control Register */ |
44 | #define LM3530_EN_I2C_SHIFT (0) | 43 | #define LM3530_EN_I2C_SHIFT (0) |
@@ -80,6 +79,9 @@ | |||
80 | #define LM3530_DEF_ZT_3 (0x33) | 79 | #define LM3530_DEF_ZT_3 (0x33) |
81 | #define LM3530_DEF_ZT_4 (0x19) | 80 | #define LM3530_DEF_ZT_4 (0x19) |
82 | 81 | ||
82 | /* 7 bits are used for the brightness : LM3530_BRT_CTRL_REG */ | ||
83 | #define MAX_BRIGHTNESS (127) | ||
84 | |||
83 | struct lm3530_mode_map { | 85 | struct lm3530_mode_map { |
84 | const char *mode; | 86 | const char *mode; |
85 | enum lm3530_mode mode_val; | 87 | enum lm3530_mode mode_val; |
@@ -115,7 +117,6 @@ static const u8 lm3530_reg[LM3530_REG_MAX] = { | |||
115 | LM3530_GEN_CONFIG, | 117 | LM3530_GEN_CONFIG, |
116 | LM3530_ALS_CONFIG, | 118 | LM3530_ALS_CONFIG, |
117 | LM3530_BRT_RAMP_RATE, | 119 | LM3530_BRT_RAMP_RATE, |
118 | LM3530_ALS_ZONE_REG, | ||
119 | LM3530_ALS_IMP_SELECT, | 120 | LM3530_ALS_IMP_SELECT, |
120 | LM3530_BRT_CTRL_REG, | 121 | LM3530_BRT_CTRL_REG, |
121 | LM3530_ALS_ZB0_REG, | 122 | LM3530_ALS_ZB0_REG, |
@@ -152,27 +153,35 @@ static int lm3530_init_registers(struct lm3530_data *drvdata) | |||
152 | u8 reg_val[LM3530_REG_MAX]; | 153 | u8 reg_val[LM3530_REG_MAX]; |
153 | u8 zones[LM3530_ALS_ZB_MAX]; | 154 | u8 zones[LM3530_ALS_ZB_MAX]; |
154 | u32 als_vmin, als_vmax, als_vstep; | 155 | u32 als_vmin, als_vmax, als_vstep; |
155 | struct lm3530_platform_data *pltfm = drvdata->pdata; | 156 | struct lm3530_platform_data *pdata = drvdata->pdata; |
156 | struct i2c_client *client = drvdata->client; | 157 | struct i2c_client *client = drvdata->client; |
158 | struct lm3530_pwm_data *pwm = &pdata->pwm_data; | ||
157 | 159 | ||
158 | gen_config = (pltfm->brt_ramp_law << LM3530_RAMP_LAW_SHIFT) | | 160 | gen_config = (pdata->brt_ramp_law << LM3530_RAMP_LAW_SHIFT) | |
159 | ((pltfm->max_current & 7) << LM3530_MAX_CURR_SHIFT); | 161 | ((pdata->max_current & 7) << LM3530_MAX_CURR_SHIFT); |
160 | 162 | ||
161 | if (drvdata->mode == LM3530_BL_MODE_MANUAL || | 163 | switch (drvdata->mode) { |
162 | drvdata->mode == LM3530_BL_MODE_ALS) | 164 | case LM3530_BL_MODE_MANUAL: |
163 | gen_config |= (LM3530_ENABLE_I2C); | 165 | case LM3530_BL_MODE_ALS: |
166 | gen_config |= LM3530_ENABLE_I2C; | ||
167 | break; | ||
168 | case LM3530_BL_MODE_PWM: | ||
169 | gen_config |= LM3530_ENABLE_PWM | LM3530_ENABLE_PWM_SIMPLE | | ||
170 | (pdata->pwm_pol_hi << LM3530_PWM_POL_SHIFT); | ||
171 | break; | ||
172 | } | ||
164 | 173 | ||
165 | if (drvdata->mode == LM3530_BL_MODE_ALS) { | 174 | if (drvdata->mode == LM3530_BL_MODE_ALS) { |
166 | if (pltfm->als_vmax == 0) { | 175 | if (pdata->als_vmax == 0) { |
167 | pltfm->als_vmin = 0; | 176 | pdata->als_vmin = 0; |
168 | pltfm->als_vmax = LM3530_ALS_WINDOW_mV; | 177 | pdata->als_vmax = LM3530_ALS_WINDOW_mV; |
169 | } | 178 | } |
170 | 179 | ||
171 | als_vmin = pltfm->als_vmin; | 180 | als_vmin = pdata->als_vmin; |
172 | als_vmax = pltfm->als_vmax; | 181 | als_vmax = pdata->als_vmax; |
173 | 182 | ||
174 | if ((als_vmax - als_vmin) > LM3530_ALS_WINDOW_mV) | 183 | if ((als_vmax - als_vmin) > LM3530_ALS_WINDOW_mV) |
175 | pltfm->als_vmax = als_vmax = | 184 | pdata->als_vmax = als_vmax = |
176 | als_vmin + LM3530_ALS_WINDOW_mV; | 185 | als_vmin + LM3530_ALS_WINDOW_mV; |
177 | 186 | ||
178 | /* n zone boundary makes n+1 zones */ | 187 | /* n zone boundary makes n+1 zones */ |
@@ -184,44 +193,41 @@ static int lm3530_init_registers(struct lm3530_data *drvdata) | |||
184 | / 1000; | 193 | / 1000; |
185 | 194 | ||
186 | als_config = | 195 | als_config = |
187 | (pltfm->als_avrg_time << LM3530_ALS_AVG_TIME_SHIFT) | | 196 | (pdata->als_avrg_time << LM3530_ALS_AVG_TIME_SHIFT) | |
188 | (LM3530_ENABLE_ALS) | | 197 | (LM3530_ENABLE_ALS) | |
189 | (pltfm->als_input_mode << LM3530_ALS_SEL_SHIFT); | 198 | (pdata->als_input_mode << LM3530_ALS_SEL_SHIFT); |
190 | 199 | ||
191 | als_imp_sel = | 200 | als_imp_sel = |
192 | (pltfm->als1_resistor_sel << LM3530_ALS1_IMP_SHIFT) | | 201 | (pdata->als1_resistor_sel << LM3530_ALS1_IMP_SHIFT) | |
193 | (pltfm->als2_resistor_sel << LM3530_ALS2_IMP_SHIFT); | 202 | (pdata->als2_resistor_sel << LM3530_ALS2_IMP_SHIFT); |
194 | 203 | ||
195 | } | 204 | } |
196 | 205 | ||
197 | if (drvdata->mode == LM3530_BL_MODE_PWM) | 206 | brt_ramp = (pdata->brt_ramp_fall << LM3530_BRT_RAMP_FALL_SHIFT) | |
198 | gen_config |= (LM3530_ENABLE_PWM) | | 207 | (pdata->brt_ramp_rise << LM3530_BRT_RAMP_RISE_SHIFT); |
199 | (pltfm->pwm_pol_hi << LM3530_PWM_POL_SHIFT) | | ||
200 | (LM3530_ENABLE_PWM_SIMPLE); | ||
201 | |||
202 | brt_ramp = (pltfm->brt_ramp_fall << LM3530_BRT_RAMP_FALL_SHIFT) | | ||
203 | (pltfm->brt_ramp_rise << LM3530_BRT_RAMP_RISE_SHIFT); | ||
204 | 208 | ||
205 | if (drvdata->brightness) | 209 | if (drvdata->brightness) |
206 | brightness = drvdata->brightness; | 210 | brightness = drvdata->brightness; |
207 | else | 211 | else |
208 | brightness = drvdata->brightness = pltfm->brt_val; | 212 | brightness = drvdata->brightness = pdata->brt_val; |
213 | |||
214 | if (brightness > drvdata->led_dev.max_brightness) | ||
215 | brightness = drvdata->led_dev.max_brightness; | ||
209 | 216 | ||
210 | reg_val[0] = gen_config; /* LM3530_GEN_CONFIG */ | 217 | reg_val[0] = gen_config; /* LM3530_GEN_CONFIG */ |
211 | reg_val[1] = als_config; /* LM3530_ALS_CONFIG */ | 218 | reg_val[1] = als_config; /* LM3530_ALS_CONFIG */ |
212 | reg_val[2] = brt_ramp; /* LM3530_BRT_RAMP_RATE */ | 219 | reg_val[2] = brt_ramp; /* LM3530_BRT_RAMP_RATE */ |
213 | reg_val[3] = 0x00; /* LM3530_ALS_ZONE_REG */ | 220 | reg_val[3] = als_imp_sel; /* LM3530_ALS_IMP_SELECT */ |
214 | reg_val[4] = als_imp_sel; /* LM3530_ALS_IMP_SELECT */ | 221 | reg_val[4] = brightness; /* LM3530_BRT_CTRL_REG */ |
215 | reg_val[5] = brightness; /* LM3530_BRT_CTRL_REG */ | 222 | reg_val[5] = zones[0]; /* LM3530_ALS_ZB0_REG */ |
216 | reg_val[6] = zones[0]; /* LM3530_ALS_ZB0_REG */ | 223 | reg_val[6] = zones[1]; /* LM3530_ALS_ZB1_REG */ |
217 | reg_val[7] = zones[1]; /* LM3530_ALS_ZB1_REG */ | 224 | reg_val[7] = zones[2]; /* LM3530_ALS_ZB2_REG */ |
218 | reg_val[8] = zones[2]; /* LM3530_ALS_ZB2_REG */ | 225 | reg_val[8] = zones[3]; /* LM3530_ALS_ZB3_REG */ |
219 | reg_val[9] = zones[3]; /* LM3530_ALS_ZB3_REG */ | 226 | reg_val[9] = LM3530_DEF_ZT_0; /* LM3530_ALS_Z0T_REG */ |
220 | reg_val[10] = LM3530_DEF_ZT_0; /* LM3530_ALS_Z0T_REG */ | 227 | reg_val[10] = LM3530_DEF_ZT_1; /* LM3530_ALS_Z1T_REG */ |
221 | reg_val[11] = LM3530_DEF_ZT_1; /* LM3530_ALS_Z1T_REG */ | 228 | reg_val[11] = LM3530_DEF_ZT_2; /* LM3530_ALS_Z2T_REG */ |
222 | reg_val[12] = LM3530_DEF_ZT_2; /* LM3530_ALS_Z2T_REG */ | 229 | reg_val[12] = LM3530_DEF_ZT_3; /* LM3530_ALS_Z3T_REG */ |
223 | reg_val[13] = LM3530_DEF_ZT_3; /* LM3530_ALS_Z3T_REG */ | 230 | reg_val[13] = LM3530_DEF_ZT_4; /* LM3530_ALS_Z4T_REG */ |
224 | reg_val[14] = LM3530_DEF_ZT_4; /* LM3530_ALS_Z4T_REG */ | ||
225 | 231 | ||
226 | if (!drvdata->enable) { | 232 | if (!drvdata->enable) { |
227 | ret = regulator_enable(drvdata->regulator); | 233 | ret = regulator_enable(drvdata->regulator); |
@@ -234,6 +240,15 @@ static int lm3530_init_registers(struct lm3530_data *drvdata) | |||
234 | } | 240 | } |
235 | 241 | ||
236 | for (i = 0; i < LM3530_REG_MAX; i++) { | 242 | for (i = 0; i < LM3530_REG_MAX; i++) { |
243 | /* do not update brightness register when pwm mode */ | ||
244 | if (lm3530_reg[i] == LM3530_BRT_CTRL_REG && | ||
245 | drvdata->mode == LM3530_BL_MODE_PWM) { | ||
246 | if (pwm->pwm_set_intensity) | ||
247 | pwm->pwm_set_intensity(reg_val[i], | ||
248 | drvdata->led_dev.max_brightness); | ||
249 | continue; | ||
250 | } | ||
251 | |||
237 | ret = i2c_smbus_write_byte_data(client, | 252 | ret = i2c_smbus_write_byte_data(client, |
238 | lm3530_reg[i], reg_val[i]); | 253 | lm3530_reg[i], reg_val[i]); |
239 | if (ret) | 254 | if (ret) |
@@ -249,6 +264,9 @@ static void lm3530_brightness_set(struct led_classdev *led_cdev, | |||
249 | int err; | 264 | int err; |
250 | struct lm3530_data *drvdata = | 265 | struct lm3530_data *drvdata = |
251 | container_of(led_cdev, struct lm3530_data, led_dev); | 266 | container_of(led_cdev, struct lm3530_data, led_dev); |
267 | struct lm3530_platform_data *pdata = drvdata->pdata; | ||
268 | struct lm3530_pwm_data *pwm = &pdata->pwm_data; | ||
269 | u8 max_brightness = led_cdev->max_brightness; | ||
252 | 270 | ||
253 | switch (drvdata->mode) { | 271 | switch (drvdata->mode) { |
254 | case LM3530_BL_MODE_MANUAL: | 272 | case LM3530_BL_MODE_MANUAL: |
@@ -264,12 +282,12 @@ static void lm3530_brightness_set(struct led_classdev *led_cdev, | |||
264 | 282 | ||
265 | /* set the brightness in brightness control register*/ | 283 | /* set the brightness in brightness control register*/ |
266 | err = i2c_smbus_write_byte_data(drvdata->client, | 284 | err = i2c_smbus_write_byte_data(drvdata->client, |
267 | LM3530_BRT_CTRL_REG, brt_val / 2); | 285 | LM3530_BRT_CTRL_REG, brt_val); |
268 | if (err) | 286 | if (err) |
269 | dev_err(&drvdata->client->dev, | 287 | dev_err(&drvdata->client->dev, |
270 | "Unable to set brightness: %d\n", err); | 288 | "Unable to set brightness: %d\n", err); |
271 | else | 289 | else |
272 | drvdata->brightness = brt_val / 2; | 290 | drvdata->brightness = brt_val; |
273 | 291 | ||
274 | if (brt_val == 0) { | 292 | if (brt_val == 0) { |
275 | err = regulator_disable(drvdata->regulator); | 293 | err = regulator_disable(drvdata->regulator); |
@@ -282,6 +300,8 @@ static void lm3530_brightness_set(struct led_classdev *led_cdev, | |||
282 | case LM3530_BL_MODE_ALS: | 300 | case LM3530_BL_MODE_ALS: |
283 | break; | 301 | break; |
284 | case LM3530_BL_MODE_PWM: | 302 | case LM3530_BL_MODE_PWM: |
303 | if (pwm->pwm_set_intensity) | ||
304 | pwm->pwm_set_intensity(brt_val, max_brightness); | ||
285 | break; | 305 | break; |
286 | default: | 306 | default: |
287 | break; | 307 | break; |
@@ -291,11 +311,11 @@ static void lm3530_brightness_set(struct led_classdev *led_cdev, | |||
291 | static ssize_t lm3530_mode_get(struct device *dev, | 311 | static ssize_t lm3530_mode_get(struct device *dev, |
292 | struct device_attribute *attr, char *buf) | 312 | struct device_attribute *attr, char *buf) |
293 | { | 313 | { |
294 | struct i2c_client *client = container_of( | 314 | struct led_classdev *led_cdev = dev_get_drvdata(dev); |
295 | dev->parent, struct i2c_client, dev); | 315 | struct lm3530_data *drvdata; |
296 | struct lm3530_data *drvdata = i2c_get_clientdata(client); | ||
297 | int i, len = 0; | 316 | int i, len = 0; |
298 | 317 | ||
318 | drvdata = container_of(led_cdev, struct lm3530_data, led_dev); | ||
299 | for (i = 0; i < ARRAY_SIZE(mode_map); i++) | 319 | for (i = 0; i < ARRAY_SIZE(mode_map); i++) |
300 | if (drvdata->mode == mode_map[i].mode_val) | 320 | if (drvdata->mode == mode_map[i].mode_val) |
301 | len += sprintf(buf + len, "[%s] ", mode_map[i].mode); | 321 | len += sprintf(buf + len, "[%s] ", mode_map[i].mode); |
@@ -310,26 +330,26 @@ static ssize_t lm3530_mode_get(struct device *dev, | |||
310 | static ssize_t lm3530_mode_set(struct device *dev, struct device_attribute | 330 | static ssize_t lm3530_mode_set(struct device *dev, struct device_attribute |
311 | *attr, const char *buf, size_t size) | 331 | *attr, const char *buf, size_t size) |
312 | { | 332 | { |
313 | int err; | 333 | struct led_classdev *led_cdev = dev_get_drvdata(dev); |
314 | struct i2c_client *client = container_of( | 334 | struct lm3530_data *drvdata; |
315 | dev->parent, struct i2c_client, dev); | 335 | struct lm3530_pwm_data *pwm; |
316 | struct lm3530_data *drvdata = i2c_get_clientdata(client); | 336 | u8 max_brightness; |
317 | int mode; | 337 | int mode, err; |
318 | 338 | ||
339 | drvdata = container_of(led_cdev, struct lm3530_data, led_dev); | ||
340 | pwm = &drvdata->pdata->pwm_data; | ||
341 | max_brightness = led_cdev->max_brightness; | ||
319 | mode = lm3530_get_mode_from_str(buf); | 342 | mode = lm3530_get_mode_from_str(buf); |
320 | if (mode < 0) { | 343 | if (mode < 0) { |
321 | dev_err(dev, "Invalid mode\n"); | 344 | dev_err(dev, "Invalid mode\n"); |
322 | return -EINVAL; | 345 | return -EINVAL; |
323 | } | 346 | } |
324 | 347 | ||
325 | if (mode == LM3530_BL_MODE_MANUAL) | 348 | drvdata->mode = mode; |
326 | drvdata->mode = LM3530_BL_MODE_MANUAL; | 349 | |
327 | else if (mode == LM3530_BL_MODE_ALS) | 350 | /* set pwm to low if unnecessary */ |
328 | drvdata->mode = LM3530_BL_MODE_ALS; | 351 | if (mode != LM3530_BL_MODE_PWM && pwm->pwm_set_intensity) |
329 | else if (mode == LM3530_BL_MODE_PWM) { | 352 | pwm->pwm_set_intensity(0, max_brightness); |
330 | dev_err(dev, "PWM mode not supported\n"); | ||
331 | return -EINVAL; | ||
332 | } | ||
333 | 353 | ||
334 | err = lm3530_init_registers(drvdata); | 354 | err = lm3530_init_registers(drvdata); |
335 | if (err) { | 355 | if (err) { |
@@ -380,6 +400,7 @@ static int __devinit lm3530_probe(struct i2c_client *client, | |||
380 | drvdata->enable = false; | 400 | drvdata->enable = false; |
381 | drvdata->led_dev.name = LM3530_LED_DEV; | 401 | drvdata->led_dev.name = LM3530_LED_DEV; |
382 | drvdata->led_dev.brightness_set = lm3530_brightness_set; | 402 | drvdata->led_dev.brightness_set = lm3530_brightness_set; |
403 | drvdata->led_dev.max_brightness = MAX_BRIGHTNESS; | ||
383 | 404 | ||
384 | i2c_set_clientdata(client, drvdata); | 405 | i2c_set_clientdata(client, drvdata); |
385 | 406 | ||
diff --git a/drivers/leds/leds-lp5521.c b/drivers/leds/leds-lp5521.c index d62a7982a5e6..410a723b8691 100644 --- a/drivers/leds/leds-lp5521.c +++ b/drivers/leds/leds-lp5521.c | |||
@@ -81,18 +81,10 @@ | |||
81 | #define LP5521_MASTER_ENABLE 0x40 /* Chip master enable */ | 81 | #define LP5521_MASTER_ENABLE 0x40 /* Chip master enable */ |
82 | #define LP5521_LOGARITHMIC_PWM 0x80 /* Logarithmic PWM adjustment */ | 82 | #define LP5521_LOGARITHMIC_PWM 0x80 /* Logarithmic PWM adjustment */ |
83 | #define LP5521_EXEC_RUN 0x2A | 83 | #define LP5521_EXEC_RUN 0x2A |
84 | 84 | #define LP5521_ENABLE_DEFAULT \ | |
85 | /* Bits in CONFIG register */ | 85 | (LP5521_MASTER_ENABLE | LP5521_LOGARITHMIC_PWM) |
86 | #define LP5521_PWM_HF 0x40 /* PWM: 0 = 256Hz, 1 = 558Hz */ | 86 | #define LP5521_ENABLE_RUN_PROGRAM \ |
87 | #define LP5521_PWRSAVE_EN 0x20 /* 1 = Power save mode */ | 87 | (LP5521_ENABLE_DEFAULT | LP5521_EXEC_RUN) |
88 | #define LP5521_CP_MODE_OFF 0 /* Charge pump (CP) off */ | ||
89 | #define LP5521_CP_MODE_BYPASS 8 /* CP forced to bypass mode */ | ||
90 | #define LP5521_CP_MODE_1X5 0x10 /* CP forced to 1.5x mode */ | ||
91 | #define LP5521_CP_MODE_AUTO 0x18 /* Automatic mode selection */ | ||
92 | #define LP5521_R_TO_BATT 4 /* R out: 0 = CP, 1 = Vbat */ | ||
93 | #define LP5521_CLK_SRC_EXT 0 /* Ext-clk source (CLK_32K) */ | ||
94 | #define LP5521_CLK_INT 1 /* Internal clock */ | ||
95 | #define LP5521_CLK_AUTO 2 /* Automatic clock selection */ | ||
96 | 88 | ||
97 | /* Status */ | 89 | /* Status */ |
98 | #define LP5521_EXT_CLK_USED 0x08 | 90 | #define LP5521_EXT_CLK_USED 0x08 |
@@ -100,6 +92,9 @@ | |||
100 | /* default R channel current register value */ | 92 | /* default R channel current register value */ |
101 | #define LP5521_REG_R_CURR_DEFAULT 0xAF | 93 | #define LP5521_REG_R_CURR_DEFAULT 0xAF |
102 | 94 | ||
95 | /* Pattern Mode */ | ||
96 | #define PATTERN_OFF 0 | ||
97 | |||
103 | struct lp5521_engine { | 98 | struct lp5521_engine { |
104 | int id; | 99 | int id; |
105 | u8 mode; | 100 | u8 mode; |
@@ -241,15 +236,16 @@ static int lp5521_configure(struct i2c_client *client) | |||
241 | { | 236 | { |
242 | struct lp5521_chip *chip = i2c_get_clientdata(client); | 237 | struct lp5521_chip *chip = i2c_get_clientdata(client); |
243 | int ret; | 238 | int ret; |
239 | u8 cfg; | ||
244 | 240 | ||
245 | lp5521_init_engine(chip); | 241 | lp5521_init_engine(chip); |
246 | 242 | ||
247 | /* Set all PWMs to direct control mode */ | 243 | /* Set all PWMs to direct control mode */ |
248 | ret = lp5521_write(client, LP5521_REG_OP_MODE, 0x3F); | 244 | ret = lp5521_write(client, LP5521_REG_OP_MODE, LP5521_CMD_DIRECT); |
249 | 245 | ||
250 | /* Enable auto-powersave, set charge pump to auto, red to battery */ | 246 | cfg = chip->pdata->update_config ? |
251 | ret |= lp5521_write(client, LP5521_REG_CONFIG, | 247 | : (LP5521_PWRSAVE_EN | LP5521_CP_MODE_AUTO | LP5521_R_TO_BATT); |
252 | LP5521_PWRSAVE_EN | LP5521_CP_MODE_AUTO | LP5521_R_TO_BATT); | 248 | ret |= lp5521_write(client, LP5521_REG_CONFIG, cfg); |
253 | 249 | ||
254 | /* Initialize all channels PWM to zero -> leds off */ | 250 | /* Initialize all channels PWM to zero -> leds off */ |
255 | ret |= lp5521_write(client, LP5521_REG_R_PWM, 0); | 251 | ret |= lp5521_write(client, LP5521_REG_R_PWM, 0); |
@@ -258,8 +254,7 @@ static int lp5521_configure(struct i2c_client *client) | |||
258 | 254 | ||
259 | /* Set engines are set to run state when OP_MODE enables engines */ | 255 | /* Set engines are set to run state when OP_MODE enables engines */ |
260 | ret |= lp5521_write(client, LP5521_REG_ENABLE, | 256 | ret |= lp5521_write(client, LP5521_REG_ENABLE, |
261 | LP5521_MASTER_ENABLE | LP5521_LOGARITHMIC_PWM | | 257 | LP5521_ENABLE_RUN_PROGRAM); |
262 | LP5521_EXEC_RUN); | ||
263 | /* enable takes 500us. 1 - 2 ms leaves some margin */ | 258 | /* enable takes 500us. 1 - 2 ms leaves some margin */ |
264 | usleep_range(1000, 2000); | 259 | usleep_range(1000, 2000); |
265 | 260 | ||
@@ -310,8 +305,7 @@ static int lp5521_detect(struct i2c_client *client) | |||
310 | int ret; | 305 | int ret; |
311 | u8 buf; | 306 | u8 buf; |
312 | 307 | ||
313 | ret = lp5521_write(client, LP5521_REG_ENABLE, | 308 | ret = lp5521_write(client, LP5521_REG_ENABLE, LP5521_ENABLE_DEFAULT); |
314 | LP5521_MASTER_ENABLE | LP5521_LOGARITHMIC_PWM); | ||
315 | if (ret) | 309 | if (ret) |
316 | return ret; | 310 | return ret; |
317 | /* enable takes 500us. 1 - 2 ms leaves some margin */ | 311 | /* enable takes 500us. 1 - 2 ms leaves some margin */ |
@@ -319,7 +313,7 @@ static int lp5521_detect(struct i2c_client *client) | |||
319 | ret = lp5521_read(client, LP5521_REG_ENABLE, &buf); | 313 | ret = lp5521_read(client, LP5521_REG_ENABLE, &buf); |
320 | if (ret) | 314 | if (ret) |
321 | return ret; | 315 | return ret; |
322 | if (buf != (LP5521_MASTER_ENABLE | LP5521_LOGARITHMIC_PWM)) | 316 | if (buf != LP5521_ENABLE_DEFAULT) |
323 | return -ENODEV; | 317 | return -ENODEV; |
324 | 318 | ||
325 | return 0; | 319 | return 0; |
@@ -504,7 +498,7 @@ static ssize_t store_current(struct device *dev, | |||
504 | ssize_t ret; | 498 | ssize_t ret; |
505 | unsigned long curr; | 499 | unsigned long curr; |
506 | 500 | ||
507 | if (strict_strtoul(buf, 0, &curr)) | 501 | if (kstrtoul(buf, 0, &curr)) |
508 | return -EINVAL; | 502 | return -EINVAL; |
509 | 503 | ||
510 | if (curr > led->max_current) | 504 | if (curr > led->max_current) |
@@ -536,6 +530,97 @@ static ssize_t lp5521_selftest(struct device *dev, | |||
536 | return sprintf(buf, "%s\n", ret ? "FAIL" : "OK"); | 530 | return sprintf(buf, "%s\n", ret ? "FAIL" : "OK"); |
537 | } | 531 | } |
538 | 532 | ||
533 | static void lp5521_clear_program_memory(struct i2c_client *cl) | ||
534 | { | ||
535 | int i; | ||
536 | u8 rgb_mem[] = { | ||
537 | LP5521_REG_R_PROG_MEM, | ||
538 | LP5521_REG_G_PROG_MEM, | ||
539 | LP5521_REG_B_PROG_MEM, | ||
540 | }; | ||
541 | |||
542 | for (i = 0; i < ARRAY_SIZE(rgb_mem); i++) { | ||
543 | lp5521_write(cl, rgb_mem[i], 0); | ||
544 | lp5521_write(cl, rgb_mem[i] + 1, 0); | ||
545 | } | ||
546 | } | ||
547 | |||
548 | static void lp5521_write_program_memory(struct i2c_client *cl, | ||
549 | u8 base, u8 *rgb, int size) | ||
550 | { | ||
551 | int i; | ||
552 | |||
553 | if (!rgb || size <= 0) | ||
554 | return; | ||
555 | |||
556 | for (i = 0; i < size; i++) | ||
557 | lp5521_write(cl, base + i, *(rgb + i)); | ||
558 | |||
559 | lp5521_write(cl, base + i, 0); | ||
560 | lp5521_write(cl, base + i + 1, 0); | ||
561 | } | ||
562 | |||
563 | static inline struct lp5521_led_pattern *lp5521_get_pattern | ||
564 | (struct lp5521_chip *chip, u8 offset) | ||
565 | { | ||
566 | struct lp5521_led_pattern *ptn; | ||
567 | ptn = chip->pdata->patterns + (offset - 1); | ||
568 | return ptn; | ||
569 | } | ||
570 | |||
571 | static void lp5521_run_led_pattern(int mode, struct lp5521_chip *chip) | ||
572 | { | ||
573 | struct lp5521_led_pattern *ptn; | ||
574 | struct i2c_client *cl = chip->client; | ||
575 | int num_patterns = chip->pdata->num_patterns; | ||
576 | |||
577 | if (mode > num_patterns || !(chip->pdata->patterns)) | ||
578 | return; | ||
579 | |||
580 | if (mode == PATTERN_OFF) { | ||
581 | lp5521_write(cl, LP5521_REG_ENABLE, LP5521_ENABLE_DEFAULT); | ||
582 | usleep_range(1000, 2000); | ||
583 | lp5521_write(cl, LP5521_REG_OP_MODE, LP5521_CMD_DIRECT); | ||
584 | } else { | ||
585 | ptn = lp5521_get_pattern(chip, mode); | ||
586 | if (!ptn) | ||
587 | return; | ||
588 | |||
589 | lp5521_write(cl, LP5521_REG_OP_MODE, LP5521_CMD_LOAD); | ||
590 | usleep_range(1000, 2000); | ||
591 | |||
592 | lp5521_clear_program_memory(cl); | ||
593 | |||
594 | lp5521_write_program_memory(cl, LP5521_REG_R_PROG_MEM, | ||
595 | ptn->r, ptn->size_r); | ||
596 | lp5521_write_program_memory(cl, LP5521_REG_G_PROG_MEM, | ||
597 | ptn->g, ptn->size_g); | ||
598 | lp5521_write_program_memory(cl, LP5521_REG_B_PROG_MEM, | ||
599 | ptn->b, ptn->size_b); | ||
600 | |||
601 | lp5521_write(cl, LP5521_REG_OP_MODE, LP5521_CMD_RUN); | ||
602 | usleep_range(1000, 2000); | ||
603 | lp5521_write(cl, LP5521_REG_ENABLE, LP5521_ENABLE_RUN_PROGRAM); | ||
604 | } | ||
605 | } | ||
606 | |||
607 | static ssize_t store_led_pattern(struct device *dev, | ||
608 | struct device_attribute *attr, | ||
609 | const char *buf, size_t len) | ||
610 | { | ||
611 | struct lp5521_chip *chip = i2c_get_clientdata(to_i2c_client(dev)); | ||
612 | unsigned long val; | ||
613 | int ret; | ||
614 | |||
615 | ret = strict_strtoul(buf, 16, &val); | ||
616 | if (ret) | ||
617 | return ret; | ||
618 | |||
619 | lp5521_run_led_pattern(val, chip); | ||
620 | |||
621 | return len; | ||
622 | } | ||
623 | |||
539 | /* led class device attributes */ | 624 | /* led class device attributes */ |
540 | static DEVICE_ATTR(led_current, S_IRUGO | S_IWUSR, show_current, store_current); | 625 | static DEVICE_ATTR(led_current, S_IRUGO | S_IWUSR, show_current, store_current); |
541 | static DEVICE_ATTR(max_current, S_IRUGO , show_max_current, NULL); | 626 | static DEVICE_ATTR(max_current, S_IRUGO , show_max_current, NULL); |
@@ -561,6 +646,7 @@ static DEVICE_ATTR(engine1_load, S_IWUSR, NULL, store_engine1_load); | |||
561 | static DEVICE_ATTR(engine2_load, S_IWUSR, NULL, store_engine2_load); | 646 | static DEVICE_ATTR(engine2_load, S_IWUSR, NULL, store_engine2_load); |
562 | static DEVICE_ATTR(engine3_load, S_IWUSR, NULL, store_engine3_load); | 647 | static DEVICE_ATTR(engine3_load, S_IWUSR, NULL, store_engine3_load); |
563 | static DEVICE_ATTR(selftest, S_IRUGO, lp5521_selftest, NULL); | 648 | static DEVICE_ATTR(selftest, S_IRUGO, lp5521_selftest, NULL); |
649 | static DEVICE_ATTR(led_pattern, S_IWUSR, NULL, store_led_pattern); | ||
564 | 650 | ||
565 | static struct attribute *lp5521_attributes[] = { | 651 | static struct attribute *lp5521_attributes[] = { |
566 | &dev_attr_engine1_mode.attr, | 652 | &dev_attr_engine1_mode.attr, |
@@ -570,6 +656,7 @@ static struct attribute *lp5521_attributes[] = { | |||
570 | &dev_attr_engine1_load.attr, | 656 | &dev_attr_engine1_load.attr, |
571 | &dev_attr_engine2_load.attr, | 657 | &dev_attr_engine2_load.attr, |
572 | &dev_attr_engine3_load.attr, | 658 | &dev_attr_engine3_load.attr, |
659 | &dev_attr_led_pattern.attr, | ||
573 | NULL | 660 | NULL |
574 | }; | 661 | }; |
575 | 662 | ||
@@ -620,10 +707,15 @@ static int __devinit lp5521_init_led(struct lp5521_led *led, | |||
620 | return -EINVAL; | 707 | return -EINVAL; |
621 | } | 708 | } |
622 | 709 | ||
623 | snprintf(name, sizeof(name), "%s:channel%d", | ||
624 | pdata->label ?: client->name, chan); | ||
625 | led->cdev.brightness_set = lp5521_set_brightness; | 710 | led->cdev.brightness_set = lp5521_set_brightness; |
626 | led->cdev.name = name; | 711 | if (pdata->led_config[chan].name) { |
712 | led->cdev.name = pdata->led_config[chan].name; | ||
713 | } else { | ||
714 | snprintf(name, sizeof(name), "%s:channel%d", | ||
715 | pdata->label ?: client->name, chan); | ||
716 | led->cdev.name = name; | ||
717 | } | ||
718 | |||
627 | res = led_classdev_register(dev, &led->cdev); | 719 | res = led_classdev_register(dev, &led->cdev); |
628 | if (res < 0) { | 720 | if (res < 0) { |
629 | dev_err(dev, "couldn't register led on channel %d\n", chan); | 721 | dev_err(dev, "couldn't register led on channel %d\n", chan); |
@@ -692,9 +784,9 @@ static int __devinit lp5521_probe(struct i2c_client *client, | |||
692 | * otherwise further access to the R G B channels in the | 784 | * otherwise further access to the R G B channels in the |
693 | * LP5521_REG_ENABLE register will not have any effect - strange! | 785 | * LP5521_REG_ENABLE register will not have any effect - strange! |
694 | */ | 786 | */ |
695 | lp5521_read(client, LP5521_REG_R_CURRENT, &buf); | 787 | ret = lp5521_read(client, LP5521_REG_R_CURRENT, &buf); |
696 | if (buf != LP5521_REG_R_CURR_DEFAULT) { | 788 | if (buf != LP5521_REG_R_CURR_DEFAULT) { |
697 | dev_err(&client->dev, "error in reseting chip\n"); | 789 | dev_err(&client->dev, "error in resetting chip\n"); |
698 | goto fail2; | 790 | goto fail2; |
699 | } | 791 | } |
700 | usleep_range(10000, 20000); | 792 | usleep_range(10000, 20000); |
@@ -767,6 +859,7 @@ static int __devexit lp5521_remove(struct i2c_client *client) | |||
767 | struct lp5521_chip *chip = i2c_get_clientdata(client); | 859 | struct lp5521_chip *chip = i2c_get_clientdata(client); |
768 | int i; | 860 | int i; |
769 | 861 | ||
862 | lp5521_run_led_pattern(PATTERN_OFF, chip); | ||
770 | lp5521_unregister_sysfs(client); | 863 | lp5521_unregister_sysfs(client); |
771 | 864 | ||
772 | for (i = 0; i < chip->num_leds; i++) { | 865 | for (i = 0; i < chip->num_leds; i++) { |
diff --git a/drivers/leds/leds-lp5523.c b/drivers/leds/leds-lp5523.c index 73e791ae7259..857a3e15f2dd 100644 --- a/drivers/leds/leds-lp5523.c +++ b/drivers/leds/leds-lp5523.c | |||
@@ -152,7 +152,7 @@ static inline struct lp5523_chip *led_to_lp5523(struct lp5523_led *led) | |||
152 | 152 | ||
153 | static int lp5523_set_mode(struct lp5523_engine *engine, u8 mode); | 153 | static int lp5523_set_mode(struct lp5523_engine *engine, u8 mode); |
154 | static int lp5523_set_engine_mode(struct lp5523_engine *engine, u8 mode); | 154 | static int lp5523_set_engine_mode(struct lp5523_engine *engine, u8 mode); |
155 | static int lp5523_load_program(struct lp5523_engine *engine, u8 *pattern); | 155 | static int lp5523_load_program(struct lp5523_engine *engine, const u8 *pattern); |
156 | 156 | ||
157 | static void lp5523_led_brightness_work(struct work_struct *work); | 157 | static void lp5523_led_brightness_work(struct work_struct *work); |
158 | 158 | ||
@@ -196,7 +196,7 @@ static int lp5523_configure(struct i2c_client *client) | |||
196 | u8 status; | 196 | u8 status; |
197 | 197 | ||
198 | /* one pattern per engine setting led mux start and stop addresses */ | 198 | /* one pattern per engine setting led mux start and stop addresses */ |
199 | u8 pattern[][LP5523_PROGRAM_LENGTH] = { | 199 | static const u8 pattern[][LP5523_PROGRAM_LENGTH] = { |
200 | { 0x9c, 0x30, 0x9c, 0xb0, 0x9d, 0x80, 0xd8, 0x00, 0}, | 200 | { 0x9c, 0x30, 0x9c, 0xb0, 0x9d, 0x80, 0xd8, 0x00, 0}, |
201 | { 0x9c, 0x40, 0x9c, 0xc0, 0x9d, 0x80, 0xd8, 0x00, 0}, | 201 | { 0x9c, 0x40, 0x9c, 0xc0, 0x9d, 0x80, 0xd8, 0x00, 0}, |
202 | { 0x9c, 0x50, 0x9c, 0xd0, 0x9d, 0x80, 0xd8, 0x00, 0}, | 202 | { 0x9c, 0x50, 0x9c, 0xd0, 0x9d, 0x80, 0xd8, 0x00, 0}, |
@@ -301,7 +301,7 @@ static int lp5523_load_mux(struct lp5523_engine *engine, u16 mux) | |||
301 | return ret; | 301 | return ret; |
302 | } | 302 | } |
303 | 303 | ||
304 | static int lp5523_load_program(struct lp5523_engine *engine, u8 *pattern) | 304 | static int lp5523_load_program(struct lp5523_engine *engine, const u8 *pattern) |
305 | { | 305 | { |
306 | struct lp5523_chip *chip = engine_to_lp5523(engine); | 306 | struct lp5523_chip *chip = engine_to_lp5523(engine); |
307 | struct i2c_client *client = chip->client; | 307 | struct i2c_client *client = chip->client; |
diff --git a/drivers/leds/leds-pca9633.c b/drivers/leds/leds-pca9633.c new file mode 100644 index 000000000000..d8926fd031aa --- /dev/null +++ b/drivers/leds/leds-pca9633.c | |||
@@ -0,0 +1,193 @@ | |||
1 | /* | ||
2 | * Copyright 2011 bct electronic GmbH | ||
3 | * | ||
4 | * Author: Peter Meerwald <p.meerwald@bct-electronic.com> | ||
5 | * | ||
6 | * Based on leds-pca955x.c | ||
7 | * | ||
8 | * This file is subject to the terms and conditions of version 2 of | ||
9 | * the GNU General Public License. See the file COPYING in the main | ||
10 | * directory of this archive for more details. | ||
11 | * | ||
12 | * LED driver for the PCA9633 I2C LED driver (7-bit slave address 0x62) | ||
13 | * | ||
14 | */ | ||
15 | |||
16 | #include <linux/module.h> | ||
17 | #include <linux/delay.h> | ||
18 | #include <linux/string.h> | ||
19 | #include <linux/ctype.h> | ||
20 | #include <linux/leds.h> | ||
21 | #include <linux/err.h> | ||
22 | #include <linux/i2c.h> | ||
23 | #include <linux/workqueue.h> | ||
24 | #include <linux/slab.h> | ||
25 | |||
26 | /* LED select registers determine the source that drives LED outputs */ | ||
27 | #define PCA9633_LED_OFF 0x0 /* LED driver off */ | ||
28 | #define PCA9633_LED_ON 0x1 /* LED driver on */ | ||
29 | #define PCA9633_LED_PWM 0x2 /* Controlled through PWM */ | ||
30 | #define PCA9633_LED_GRP_PWM 0x3 /* Controlled through PWM/GRPPWM */ | ||
31 | |||
32 | #define PCA9633_MODE1 0x00 | ||
33 | #define PCA9633_MODE2 0x01 | ||
34 | #define PCA9633_PWM_BASE 0x02 | ||
35 | #define PCA9633_LEDOUT 0x08 | ||
36 | |||
37 | static const struct i2c_device_id pca9633_id[] = { | ||
38 | { "pca9633", 0 }, | ||
39 | { } | ||
40 | }; | ||
41 | MODULE_DEVICE_TABLE(i2c, pca9633_id); | ||
42 | |||
43 | struct pca9633_led { | ||
44 | struct i2c_client *client; | ||
45 | struct work_struct work; | ||
46 | enum led_brightness brightness; | ||
47 | struct led_classdev led_cdev; | ||
48 | int led_num; /* 0 .. 3 potentially */ | ||
49 | char name[32]; | ||
50 | }; | ||
51 | |||
52 | static void pca9633_led_work(struct work_struct *work) | ||
53 | { | ||
54 | struct pca9633_led *pca9633 = container_of(work, | ||
55 | struct pca9633_led, work); | ||
56 | u8 ledout = i2c_smbus_read_byte_data(pca9633->client, PCA9633_LEDOUT); | ||
57 | int shift = 2 * pca9633->led_num; | ||
58 | u8 mask = 0x3 << shift; | ||
59 | |||
60 | switch (pca9633->brightness) { | ||
61 | case LED_FULL: | ||
62 | i2c_smbus_write_byte_data(pca9633->client, PCA9633_LEDOUT, | ||
63 | (ledout & ~mask) | (PCA9633_LED_ON << shift)); | ||
64 | break; | ||
65 | case LED_OFF: | ||
66 | i2c_smbus_write_byte_data(pca9633->client, PCA9633_LEDOUT, | ||
67 | ledout & ~mask); | ||
68 | break; | ||
69 | default: | ||
70 | i2c_smbus_write_byte_data(pca9633->client, | ||
71 | PCA9633_PWM_BASE + pca9633->led_num, | ||
72 | pca9633->brightness); | ||
73 | i2c_smbus_write_byte_data(pca9633->client, PCA9633_LEDOUT, | ||
74 | (ledout & ~mask) | (PCA9633_LED_PWM << shift)); | ||
75 | break; | ||
76 | } | ||
77 | } | ||
78 | |||
79 | static void pca9633_led_set(struct led_classdev *led_cdev, | ||
80 | enum led_brightness value) | ||
81 | { | ||
82 | struct pca9633_led *pca9633; | ||
83 | |||
84 | pca9633 = container_of(led_cdev, struct pca9633_led, led_cdev); | ||
85 | |||
86 | pca9633->brightness = value; | ||
87 | |||
88 | /* | ||
89 | * Must use workqueue for the actual I/O since I2C operations | ||
90 | * can sleep. | ||
91 | */ | ||
92 | schedule_work(&pca9633->work); | ||
93 | } | ||
94 | |||
95 | static int __devinit pca9633_probe(struct i2c_client *client, | ||
96 | const struct i2c_device_id *id) | ||
97 | { | ||
98 | struct pca9633_led *pca9633; | ||
99 | struct led_platform_data *pdata; | ||
100 | int i, err; | ||
101 | |||
102 | pdata = client->dev.platform_data; | ||
103 | |||
104 | if (pdata) { | ||
105 | if (pdata->num_leds <= 0 || pdata->num_leds > 4) { | ||
106 | dev_err(&client->dev, "board info must claim at most 4 LEDs"); | ||
107 | return -EINVAL; | ||
108 | } | ||
109 | } | ||
110 | |||
111 | pca9633 = kcalloc(4, sizeof(*pca9633), GFP_KERNEL); | ||
112 | if (!pca9633) | ||
113 | return -ENOMEM; | ||
114 | |||
115 | i2c_set_clientdata(client, pca9633); | ||
116 | |||
117 | for (i = 0; i < 4; i++) { | ||
118 | pca9633[i].client = client; | ||
119 | pca9633[i].led_num = i; | ||
120 | |||
121 | /* Platform data can specify LED names and default triggers */ | ||
122 | if (pdata && i < pdata->num_leds) { | ||
123 | if (pdata->leds[i].name) | ||
124 | snprintf(pca9633[i].name, | ||
125 | sizeof(pca9633[i].name), "pca9633:%s", | ||
126 | pdata->leds[i].name); | ||
127 | if (pdata->leds[i].default_trigger) | ||
128 | pca9633[i].led_cdev.default_trigger = | ||
129 | pdata->leds[i].default_trigger; | ||
130 | } else { | ||
131 | snprintf(pca9633[i].name, sizeof(pca9633[i].name), | ||
132 | "pca9633:%d", i); | ||
133 | } | ||
134 | |||
135 | pca9633[i].led_cdev.name = pca9633[i].name; | ||
136 | pca9633[i].led_cdev.brightness_set = pca9633_led_set; | ||
137 | |||
138 | INIT_WORK(&pca9633[i].work, pca9633_led_work); | ||
139 | |||
140 | err = led_classdev_register(&client->dev, &pca9633[i].led_cdev); | ||
141 | if (err < 0) | ||
142 | goto exit; | ||
143 | } | ||
144 | |||
145 | /* Disable LED all-call address and set normal mode */ | ||
146 | i2c_smbus_write_byte_data(client, PCA9633_MODE1, 0x00); | ||
147 | |||
148 | /* Turn off LEDs */ | ||
149 | i2c_smbus_write_byte_data(client, PCA9633_LEDOUT, 0x00); | ||
150 | |||
151 | return 0; | ||
152 | |||
153 | exit: | ||
154 | while (i--) { | ||
155 | led_classdev_unregister(&pca9633[i].led_cdev); | ||
156 | cancel_work_sync(&pca9633[i].work); | ||
157 | } | ||
158 | |||
159 | kfree(pca9633); | ||
160 | |||
161 | return err; | ||
162 | } | ||
163 | |||
164 | static int __devexit pca9633_remove(struct i2c_client *client) | ||
165 | { | ||
166 | struct pca9633_led *pca9633 = i2c_get_clientdata(client); | ||
167 | int i; | ||
168 | |||
169 | for (i = 0; i < 4; i++) { | ||
170 | led_classdev_unregister(&pca9633[i].led_cdev); | ||
171 | cancel_work_sync(&pca9633[i].work); | ||
172 | } | ||
173 | |||
174 | kfree(pca9633); | ||
175 | |||
176 | return 0; | ||
177 | } | ||
178 | |||
179 | static struct i2c_driver pca9633_driver = { | ||
180 | .driver = { | ||
181 | .name = "leds-pca9633", | ||
182 | .owner = THIS_MODULE, | ||
183 | }, | ||
184 | .probe = pca9633_probe, | ||
185 | .remove = __devexit_p(pca9633_remove), | ||
186 | .id_table = pca9633_id, | ||
187 | }; | ||
188 | |||
189 | module_i2c_driver(pca9633_driver); | ||
190 | |||
191 | MODULE_AUTHOR("Peter Meerwald <p.meerwald@bct-electronic.com>"); | ||
192 | MODULE_DESCRIPTION("PCA9633 LED driver"); | ||
193 | MODULE_LICENSE("GPL v2"); | ||
diff --git a/drivers/leds/leds-tca6507.c b/drivers/leds/leds-tca6507.c index 133f89fb7071..6c1c14f31635 100644 --- a/drivers/leds/leds-tca6507.c +++ b/drivers/leds/leds-tca6507.c | |||
@@ -687,10 +687,9 @@ static int __devinit tca6507_probe(struct i2c_client *client, | |||
687 | NUM_LEDS); | 687 | NUM_LEDS); |
688 | return -ENODEV; | 688 | return -ENODEV; |
689 | } | 689 | } |
690 | err = -ENOMEM; | ||
691 | tca = kzalloc(sizeof(*tca), GFP_KERNEL); | 690 | tca = kzalloc(sizeof(*tca), GFP_KERNEL); |
692 | if (!tca) | 691 | if (!tca) |
693 | goto exit; | 692 | return -ENOMEM; |
694 | 693 | ||
695 | tca->client = client; | 694 | tca->client = client; |
696 | INIT_WORK(&tca->work, tca6507_work); | 695 | INIT_WORK(&tca->work, tca6507_work); |
@@ -724,11 +723,10 @@ static int __devinit tca6507_probe(struct i2c_client *client, | |||
724 | 723 | ||
725 | return 0; | 724 | return 0; |
726 | exit: | 725 | exit: |
727 | while (i--) | 726 | while (i--) { |
728 | if (tca->leds[i].led_cdev.name) | 727 | if (tca->leds[i].led_cdev.name) |
729 | led_classdev_unregister(&tca->leds[i].led_cdev); | 728 | led_classdev_unregister(&tca->leds[i].led_cdev); |
730 | cancel_work_sync(&tca->work); | 729 | } |
731 | i2c_set_clientdata(client, NULL); | ||
732 | kfree(tca); | 730 | kfree(tca); |
733 | return err; | 731 | return err; |
734 | } | 732 | } |
@@ -745,7 +743,6 @@ static int __devexit tca6507_remove(struct i2c_client *client) | |||
745 | } | 743 | } |
746 | tca6507_remove_gpio(tca); | 744 | tca6507_remove_gpio(tca); |
747 | cancel_work_sync(&tca->work); | 745 | cancel_work_sync(&tca->work); |
748 | i2c_set_clientdata(client, NULL); | ||
749 | kfree(tca); | 746 | kfree(tca); |
750 | 747 | ||
751 | return 0; | 748 | return 0; |
diff --git a/drivers/mtd/chips/cfi_cmdset_0001.c b/drivers/mtd/chips/cfi_cmdset_0001.c index e1e122f2f929..9bcd1f415f43 100644 --- a/drivers/mtd/chips/cfi_cmdset_0001.c +++ b/drivers/mtd/chips/cfi_cmdset_0001.c | |||
@@ -2526,12 +2526,10 @@ static void cfi_intelext_restore_locks(struct mtd_info *mtd) | |||
2526 | if (!region->lockmap) | 2526 | if (!region->lockmap) |
2527 | continue; | 2527 | continue; |
2528 | 2528 | ||
2529 | for (block = 0; block < region->numblocks; block++) { | 2529 | for_each_clear_bit(block, region->lockmap, region->numblocks) { |
2530 | len = region->erasesize; | 2530 | len = region->erasesize; |
2531 | adr = region->offset + block * len; | 2531 | adr = region->offset + block * len; |
2532 | 2532 | cfi_intelext_unlock(mtd, adr, len); | |
2533 | if (!test_bit(block, region->lockmap)) | ||
2534 | cfi_intelext_unlock(mtd, adr, len); | ||
2535 | } | 2533 | } |
2536 | } | 2534 | } |
2537 | } | 2535 | } |
diff --git a/drivers/mtd/mtdchar.c b/drivers/mtd/mtdchar.c index 50c6a1e7f675..c57ae92ebda4 100644 --- a/drivers/mtd/mtdchar.c +++ b/drivers/mtd/mtdchar.c | |||
@@ -31,13 +31,13 @@ | |||
31 | #include <linux/compat.h> | 31 | #include <linux/compat.h> |
32 | #include <linux/mount.h> | 32 | #include <linux/mount.h> |
33 | #include <linux/blkpg.h> | 33 | #include <linux/blkpg.h> |
34 | #include <linux/magic.h> | ||
34 | #include <linux/mtd/mtd.h> | 35 | #include <linux/mtd/mtd.h> |
35 | #include <linux/mtd/partitions.h> | 36 | #include <linux/mtd/partitions.h> |
36 | #include <linux/mtd/map.h> | 37 | #include <linux/mtd/map.h> |
37 | 38 | ||
38 | #include <asm/uaccess.h> | 39 | #include <asm/uaccess.h> |
39 | 40 | ||
40 | #define MTD_INODE_FS_MAGIC 0x11307854 | ||
41 | static DEFINE_MUTEX(mtd_mutex); | 41 | static DEFINE_MUTEX(mtd_mutex); |
42 | static struct vfsmount *mtd_inode_mnt __read_mostly; | 42 | static struct vfsmount *mtd_inode_mnt __read_mostly; |
43 | 43 | ||
diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig index 3a125b835546..4f9fb25f945b 100644 --- a/drivers/rtc/Kconfig +++ b/drivers/rtc/Kconfig | |||
@@ -554,6 +554,13 @@ config RTC_DRV_DS1742 | |||
554 | This driver can also be built as a module. If so, the module | 554 | This driver can also be built as a module. If so, the module |
555 | will be called rtc-ds1742. | 555 | will be called rtc-ds1742. |
556 | 556 | ||
557 | config RTC_DRV_DA9052 | ||
558 | tristate "Dialog DA9052/DA9053 RTC" | ||
559 | depends on PMIC_DA9052 | ||
560 | help | ||
561 | Say y here to support the RTC driver for Dialog Semiconductor | ||
562 | DA9052-BC and DA9053-AA/Bx PMICs. | ||
563 | |||
557 | config RTC_DRV_EFI | 564 | config RTC_DRV_EFI |
558 | tristate "EFI RTC" | 565 | tristate "EFI RTC" |
559 | depends on IA64 | 566 | depends on IA64 |
@@ -1070,4 +1077,14 @@ config RTC_DRV_PUV3 | |||
1070 | This drive can also be built as a module. If so, the module | 1077 | This drive can also be built as a module. If so, the module |
1071 | will be called rtc-puv3. | 1078 | will be called rtc-puv3. |
1072 | 1079 | ||
1080 | config RTC_DRV_LOONGSON1 | ||
1081 | tristate "loongson1 RTC support" | ||
1082 | depends on MACH_LOONGSON1 | ||
1083 | help | ||
1084 | This is a driver for the loongson1 on-chip Counter0 (Time-Of-Year | ||
1085 | counter) to be used as a RTC. | ||
1086 | |||
1087 | This driver can also be built as a module. If so, the module | ||
1088 | will be called rtc-ls1x. | ||
1089 | |||
1073 | endif # RTC_CLASS | 1090 | endif # RTC_CLASS |
diff --git a/drivers/rtc/Makefile b/drivers/rtc/Makefile index 6e6982335c10..727ae7786e6c 100644 --- a/drivers/rtc/Makefile +++ b/drivers/rtc/Makefile | |||
@@ -27,6 +27,7 @@ obj-$(CONFIG_RTC_DRV_BQ32K) += rtc-bq32k.o | |||
27 | obj-$(CONFIG_RTC_DRV_BQ4802) += rtc-bq4802.o | 27 | obj-$(CONFIG_RTC_DRV_BQ4802) += rtc-bq4802.o |
28 | obj-$(CONFIG_RTC_DRV_CMOS) += rtc-cmos.o | 28 | obj-$(CONFIG_RTC_DRV_CMOS) += rtc-cmos.o |
29 | obj-$(CONFIG_RTC_DRV_COH901331) += rtc-coh901331.o | 29 | obj-$(CONFIG_RTC_DRV_COH901331) += rtc-coh901331.o |
30 | obj-$(CONFIG_RTC_DRV_DA9052) += rtc-da9052.o | ||
30 | obj-$(CONFIG_RTC_DRV_DAVINCI) += rtc-davinci.o | 31 | obj-$(CONFIG_RTC_DRV_DAVINCI) += rtc-davinci.o |
31 | obj-$(CONFIG_RTC_DRV_DM355EVM) += rtc-dm355evm.o | 32 | obj-$(CONFIG_RTC_DRV_DM355EVM) += rtc-dm355evm.o |
32 | obj-$(CONFIG_RTC_DRV_VRTC) += rtc-mrst.o | 33 | obj-$(CONFIG_RTC_DRV_VRTC) += rtc-mrst.o |
@@ -53,6 +54,7 @@ obj-$(CONFIG_RTC_DRV_ISL1208) += rtc-isl1208.o | |||
53 | obj-$(CONFIG_RTC_DRV_ISL12022) += rtc-isl12022.o | 54 | obj-$(CONFIG_RTC_DRV_ISL12022) += rtc-isl12022.o |
54 | obj-$(CONFIG_RTC_DRV_JZ4740) += rtc-jz4740.o | 55 | obj-$(CONFIG_RTC_DRV_JZ4740) += rtc-jz4740.o |
55 | obj-$(CONFIG_RTC_DRV_LPC32XX) += rtc-lpc32xx.o | 56 | obj-$(CONFIG_RTC_DRV_LPC32XX) += rtc-lpc32xx.o |
57 | obj-$(CONFIG_RTC_DRV_LOONGSON1) += rtc-ls1x.o | ||
56 | obj-$(CONFIG_RTC_DRV_M41T80) += rtc-m41t80.o | 58 | obj-$(CONFIG_RTC_DRV_M41T80) += rtc-m41t80.o |
57 | obj-$(CONFIG_RTC_DRV_M41T93) += rtc-m41t93.o | 59 | obj-$(CONFIG_RTC_DRV_M41T93) += rtc-m41t93.o |
58 | obj-$(CONFIG_RTC_DRV_M41T94) += rtc-m41t94.o | 60 | obj-$(CONFIG_RTC_DRV_M41T94) += rtc-m41t94.o |
diff --git a/drivers/rtc/rtc-at91sam9.c b/drivers/rtc/rtc-at91sam9.c index ee3c122c0599..274a0aafe42b 100644 --- a/drivers/rtc/rtc-at91sam9.c +++ b/drivers/rtc/rtc-at91sam9.c | |||
@@ -335,7 +335,7 @@ static int __init at91_rtc_probe(struct platform_device *pdev) | |||
335 | 335 | ||
336 | /* register irq handler after we know what name we'll use */ | 336 | /* register irq handler after we know what name we'll use */ |
337 | ret = request_irq(AT91_ID_SYS, at91_rtc_interrupt, | 337 | ret = request_irq(AT91_ID_SYS, at91_rtc_interrupt, |
338 | IRQF_DISABLED | IRQF_SHARED, | 338 | IRQF_SHARED, |
339 | dev_name(&rtc->rtcdev->dev), rtc); | 339 | dev_name(&rtc->rtcdev->dev), rtc); |
340 | if (ret) { | 340 | if (ret) { |
341 | dev_dbg(&pdev->dev, "can't share IRQ %d?\n", AT91_ID_SYS); | 341 | dev_dbg(&pdev->dev, "can't share IRQ %d?\n", AT91_ID_SYS); |
diff --git a/drivers/rtc/rtc-bq32k.c b/drivers/rtc/rtc-bq32k.c index 408cc8f735be..f090159dce4a 100644 --- a/drivers/rtc/rtc-bq32k.c +++ b/drivers/rtc/rtc-bq32k.c | |||
@@ -187,17 +187,7 @@ static struct i2c_driver bq32k_driver = { | |||
187 | .id_table = bq32k_id, | 187 | .id_table = bq32k_id, |
188 | }; | 188 | }; |
189 | 189 | ||
190 | static __init int bq32k_init(void) | 190 | module_i2c_driver(bq32k_driver); |
191 | { | ||
192 | return i2c_add_driver(&bq32k_driver); | ||
193 | } | ||
194 | module_init(bq32k_init); | ||
195 | |||
196 | static __exit void bq32k_exit(void) | ||
197 | { | ||
198 | i2c_del_driver(&bq32k_driver); | ||
199 | } | ||
200 | module_exit(bq32k_exit); | ||
201 | 191 | ||
202 | MODULE_AUTHOR("Semihalf, Piotr Ziecik <kosmo@semihalf.com>"); | 192 | MODULE_AUTHOR("Semihalf, Piotr Ziecik <kosmo@semihalf.com>"); |
203 | MODULE_DESCRIPTION("TI BQ32000 I2C RTC driver"); | 193 | MODULE_DESCRIPTION("TI BQ32000 I2C RTC driver"); |
diff --git a/drivers/rtc/rtc-cmos.c b/drivers/rtc/rtc-cmos.c index d7782aa09943..7d5f56edb8ef 100644 --- a/drivers/rtc/rtc-cmos.c +++ b/drivers/rtc/rtc-cmos.c | |||
@@ -714,7 +714,7 @@ cmos_do_probe(struct device *dev, struct resource *ports, int rtc_irq) | |||
714 | rtc_cmos_int_handler = cmos_interrupt; | 714 | rtc_cmos_int_handler = cmos_interrupt; |
715 | 715 | ||
716 | retval = request_irq(rtc_irq, rtc_cmos_int_handler, | 716 | retval = request_irq(rtc_irq, rtc_cmos_int_handler, |
717 | IRQF_DISABLED, dev_name(&cmos_rtc.rtc->dev), | 717 | 0, dev_name(&cmos_rtc.rtc->dev), |
718 | cmos_rtc.rtc); | 718 | cmos_rtc.rtc); |
719 | if (retval < 0) { | 719 | if (retval < 0) { |
720 | dev_dbg(dev, "IRQ %d is already in use\n", rtc_irq); | 720 | dev_dbg(dev, "IRQ %d is already in use\n", rtc_irq); |
diff --git a/drivers/rtc/rtc-coh901331.c b/drivers/rtc/rtc-coh901331.c index 80f9c88214c5..a5b8a0c4ea84 100644 --- a/drivers/rtc/rtc-coh901331.c +++ b/drivers/rtc/rtc-coh901331.c | |||
@@ -199,7 +199,7 @@ static int __init coh901331_probe(struct platform_device *pdev) | |||
199 | } | 199 | } |
200 | 200 | ||
201 | rtap->irq = platform_get_irq(pdev, 0); | 201 | rtap->irq = platform_get_irq(pdev, 0); |
202 | if (request_irq(rtap->irq, coh901331_interrupt, IRQF_DISABLED, | 202 | if (request_irq(rtap->irq, coh901331_interrupt, 0, |
203 | "RTC COH 901 331 Alarm", rtap)) { | 203 | "RTC COH 901 331 Alarm", rtap)) { |
204 | ret = -EIO; | 204 | ret = -EIO; |
205 | goto out_no_irq; | 205 | goto out_no_irq; |
diff --git a/drivers/rtc/rtc-da9052.c b/drivers/rtc/rtc-da9052.c new file mode 100644 index 000000000000..da6ab5291a41 --- /dev/null +++ b/drivers/rtc/rtc-da9052.c | |||
@@ -0,0 +1,293 @@ | |||
1 | /* | ||
2 | * Real time clock driver for DA9052 | ||
3 | * | ||
4 | * Copyright(c) 2012 Dialog Semiconductor Ltd. | ||
5 | * | ||
6 | * Author: Dajun Dajun Chen <dajun.chen@diasemi.com> | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License as published by | ||
10 | * the Free Software Foundation; either version 2 of the License, or | ||
11 | * (at your option) any later version. | ||
12 | * | ||
13 | */ | ||
14 | |||
15 | #include <linux/module.h> | ||
16 | #include <linux/platform_device.h> | ||
17 | #include <linux/rtc.h> | ||
18 | |||
19 | #include <linux/mfd/da9052/da9052.h> | ||
20 | #include <linux/mfd/da9052/reg.h> | ||
21 | |||
22 | #define rtc_err(da9052, fmt, ...) \ | ||
23 | dev_err(da9052->dev, "%s: " fmt, __func__, ##__VA_ARGS__) | ||
24 | |||
25 | struct da9052_rtc { | ||
26 | struct rtc_device *rtc; | ||
27 | struct da9052 *da9052; | ||
28 | int irq; | ||
29 | }; | ||
30 | |||
31 | static int da9052_rtc_enable_alarm(struct da9052 *da9052, bool enable) | ||
32 | { | ||
33 | int ret; | ||
34 | if (enable) { | ||
35 | ret = da9052_reg_update(da9052, DA9052_ALARM_Y_REG, | ||
36 | DA9052_ALARM_Y_ALARM_ON, | ||
37 | DA9052_ALARM_Y_ALARM_ON); | ||
38 | if (ret != 0) | ||
39 | rtc_err(da9052, "Failed to enable ALM: %d\n", ret); | ||
40 | } else { | ||
41 | ret = da9052_reg_update(da9052, DA9052_ALARM_Y_REG, | ||
42 | DA9052_ALARM_Y_ALARM_ON, 0); | ||
43 | if (ret != 0) | ||
44 | rtc_err(da9052, "Write error: %d\n", ret); | ||
45 | } | ||
46 | return ret; | ||
47 | } | ||
48 | |||
49 | static irqreturn_t da9052_rtc_irq(int irq, void *data) | ||
50 | { | ||
51 | struct da9052_rtc *rtc = data; | ||
52 | int ret; | ||
53 | |||
54 | ret = da9052_reg_read(rtc->da9052, DA9052_ALARM_MI_REG); | ||
55 | if (ret < 0) { | ||
56 | rtc_err(rtc->da9052, "Read error: %d\n", ret); | ||
57 | return IRQ_NONE; | ||
58 | } | ||
59 | |||
60 | if (ret & DA9052_ALARMMI_ALARMTYPE) { | ||
61 | da9052_rtc_enable_alarm(rtc->da9052, 0); | ||
62 | rtc_update_irq(rtc->rtc, 1, RTC_IRQF | RTC_AF); | ||
63 | } else | ||
64 | rtc_update_irq(rtc->rtc, 1, RTC_IRQF | RTC_PF); | ||
65 | |||
66 | return IRQ_HANDLED; | ||
67 | } | ||
68 | |||
69 | static int da9052_read_alarm(struct da9052 *da9052, struct rtc_time *rtc_tm) | ||
70 | { | ||
71 | int ret; | ||
72 | uint8_t v[5]; | ||
73 | |||
74 | ret = da9052_group_read(da9052, DA9052_ALARM_MI_REG, 5, v); | ||
75 | if (ret != 0) { | ||
76 | rtc_err(da9052, "Failed to group read ALM: %d\n", ret); | ||
77 | return ret; | ||
78 | } | ||
79 | |||
80 | rtc_tm->tm_year = (v[4] & DA9052_RTC_YEAR) + 100; | ||
81 | rtc_tm->tm_mon = (v[3] & DA9052_RTC_MONTH) - 1; | ||
82 | rtc_tm->tm_mday = v[2] & DA9052_RTC_DAY; | ||
83 | rtc_tm->tm_hour = v[1] & DA9052_RTC_HOUR; | ||
84 | rtc_tm->tm_min = v[0] & DA9052_RTC_MIN; | ||
85 | |||
86 | ret = rtc_valid_tm(rtc_tm); | ||
87 | if (ret != 0) | ||
88 | return ret; | ||
89 | return ret; | ||
90 | } | ||
91 | |||
92 | static int da9052_set_alarm(struct da9052 *da9052, struct rtc_time *rtc_tm) | ||
93 | { | ||
94 | int ret; | ||
95 | uint8_t v[3]; | ||
96 | |||
97 | rtc_tm->tm_year -= 100; | ||
98 | rtc_tm->tm_mon += 1; | ||
99 | |||
100 | ret = da9052_reg_update(da9052, DA9052_ALARM_MI_REG, | ||
101 | DA9052_RTC_MIN, rtc_tm->tm_min); | ||
102 | if (ret != 0) { | ||
103 | rtc_err(da9052, "Failed to write ALRM MIN: %d\n", ret); | ||
104 | return ret; | ||
105 | } | ||
106 | |||
107 | v[0] = rtc_tm->tm_hour; | ||
108 | v[1] = rtc_tm->tm_mday; | ||
109 | v[2] = rtc_tm->tm_mon; | ||
110 | |||
111 | ret = da9052_group_write(da9052, DA9052_ALARM_H_REG, 3, v); | ||
112 | if (ret < 0) | ||
113 | return ret; | ||
114 | |||
115 | ret = da9052_reg_update(da9052, DA9052_ALARM_Y_REG, | ||
116 | DA9052_RTC_YEAR, rtc_tm->tm_year); | ||
117 | if (ret != 0) | ||
118 | rtc_err(da9052, "Failed to write ALRM YEAR: %d\n", ret); | ||
119 | |||
120 | return ret; | ||
121 | } | ||
122 | |||
123 | static int da9052_rtc_get_alarm_status(struct da9052 *da9052) | ||
124 | { | ||
125 | int ret; | ||
126 | |||
127 | ret = da9052_reg_read(da9052, DA9052_ALARM_Y_REG); | ||
128 | if (ret < 0) { | ||
129 | rtc_err(da9052, "Failed to read ALM: %d\n", ret); | ||
130 | return ret; | ||
131 | } | ||
132 | ret &= DA9052_ALARM_Y_ALARM_ON; | ||
133 | return (ret > 0) ? 1 : 0; | ||
134 | } | ||
135 | |||
136 | static int da9052_rtc_read_time(struct device *dev, struct rtc_time *rtc_tm) | ||
137 | { | ||
138 | struct da9052_rtc *rtc = dev_get_drvdata(dev); | ||
139 | uint8_t v[6]; | ||
140 | int ret; | ||
141 | |||
142 | ret = da9052_group_read(rtc->da9052, DA9052_COUNT_S_REG, 6, v); | ||
143 | if (ret < 0) { | ||
144 | rtc_err(rtc->da9052, "Failed to read RTC time : %d\n", ret); | ||
145 | return ret; | ||
146 | } | ||
147 | |||
148 | rtc_tm->tm_year = (v[5] & DA9052_RTC_YEAR) + 100; | ||
149 | rtc_tm->tm_mon = (v[4] & DA9052_RTC_MONTH) - 1; | ||
150 | rtc_tm->tm_mday = v[3] & DA9052_RTC_DAY; | ||
151 | rtc_tm->tm_hour = v[2] & DA9052_RTC_HOUR; | ||
152 | rtc_tm->tm_min = v[1] & DA9052_RTC_MIN; | ||
153 | rtc_tm->tm_sec = v[0] & DA9052_RTC_SEC; | ||
154 | |||
155 | ret = rtc_valid_tm(rtc_tm); | ||
156 | if (ret != 0) { | ||
157 | rtc_err(rtc->da9052, "rtc_valid_tm failed: %d\n", ret); | ||
158 | return ret; | ||
159 | } | ||
160 | |||
161 | return 0; | ||
162 | } | ||
163 | |||
164 | static int da9052_rtc_set_time(struct device *dev, struct rtc_time *tm) | ||
165 | { | ||
166 | struct da9052_rtc *rtc; | ||
167 | uint8_t v[6]; | ||
168 | |||
169 | rtc = dev_get_drvdata(dev); | ||
170 | |||
171 | v[0] = tm->tm_sec; | ||
172 | v[1] = tm->tm_min; | ||
173 | v[2] = tm->tm_hour; | ||
174 | v[3] = tm->tm_mday; | ||
175 | v[4] = tm->tm_mon + 1; | ||
176 | v[5] = tm->tm_year - 100; | ||
177 | |||
178 | return da9052_group_write(rtc->da9052, DA9052_COUNT_S_REG, 6, v); | ||
179 | } | ||
180 | |||
181 | static int da9052_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alrm) | ||
182 | { | ||
183 | int ret; | ||
184 | struct rtc_time *tm = &alrm->time; | ||
185 | struct da9052_rtc *rtc = dev_get_drvdata(dev); | ||
186 | |||
187 | ret = da9052_read_alarm(rtc->da9052, tm); | ||
188 | |||
189 | if (ret) | ||
190 | return ret; | ||
191 | |||
192 | alrm->enabled = da9052_rtc_get_alarm_status(rtc->da9052); | ||
193 | |||
194 | return 0; | ||
195 | } | ||
196 | |||
197 | static int da9052_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alrm) | ||
198 | { | ||
199 | int ret; | ||
200 | struct rtc_time *tm = &alrm->time; | ||
201 | struct da9052_rtc *rtc = dev_get_drvdata(dev); | ||
202 | |||
203 | ret = da9052_rtc_enable_alarm(rtc->da9052, 0); | ||
204 | if (ret < 0) | ||
205 | return ret; | ||
206 | |||
207 | ret = da9052_set_alarm(rtc->da9052, tm); | ||
208 | if (ret) | ||
209 | return ret; | ||
210 | |||
211 | ret = da9052_rtc_enable_alarm(rtc->da9052, 1); | ||
212 | |||
213 | return ret; | ||
214 | } | ||
215 | |||
216 | static int da9052_rtc_alarm_irq_enable(struct device *dev, unsigned int enabled) | ||
217 | { | ||
218 | struct da9052_rtc *rtc = dev_get_drvdata(dev); | ||
219 | |||
220 | return da9052_rtc_enable_alarm(rtc->da9052, enabled); | ||
221 | } | ||
222 | |||
223 | static const struct rtc_class_ops da9052_rtc_ops = { | ||
224 | .read_time = da9052_rtc_read_time, | ||
225 | .set_time = da9052_rtc_set_time, | ||
226 | .read_alarm = da9052_rtc_read_alarm, | ||
227 | .set_alarm = da9052_rtc_set_alarm, | ||
228 | .alarm_irq_enable = da9052_rtc_alarm_irq_enable, | ||
229 | }; | ||
230 | |||
231 | static int __devinit da9052_rtc_probe(struct platform_device *pdev) | ||
232 | { | ||
233 | struct da9052_rtc *rtc; | ||
234 | int ret; | ||
235 | |||
236 | rtc = devm_kzalloc(&pdev->dev, sizeof(struct da9052_rtc), GFP_KERNEL); | ||
237 | if (!rtc) | ||
238 | return -ENOMEM; | ||
239 | |||
240 | rtc->da9052 = dev_get_drvdata(pdev->dev.parent); | ||
241 | platform_set_drvdata(pdev, rtc); | ||
242 | rtc->irq = platform_get_irq_byname(pdev, "ALM"); | ||
243 | ret = request_threaded_irq(rtc->irq, NULL, da9052_rtc_irq, | ||
244 | IRQF_TRIGGER_LOW | IRQF_ONESHOT, | ||
245 | "ALM", rtc); | ||
246 | if (ret != 0) { | ||
247 | rtc_err(rtc->da9052, "irq registration failed: %d\n", ret); | ||
248 | goto err_mem; | ||
249 | } | ||
250 | |||
251 | rtc->rtc = rtc_device_register(pdev->name, &pdev->dev, | ||
252 | &da9052_rtc_ops, THIS_MODULE); | ||
253 | if (IS_ERR(rtc->rtc)) { | ||
254 | ret = PTR_ERR(rtc->rtc); | ||
255 | goto err_free_irq; | ||
256 | } | ||
257 | |||
258 | return 0; | ||
259 | |||
260 | err_free_irq: | ||
261 | free_irq(rtc->irq, rtc); | ||
262 | err_mem: | ||
263 | devm_kfree(&pdev->dev, rtc); | ||
264 | return ret; | ||
265 | } | ||
266 | |||
267 | static int __devexit da9052_rtc_remove(struct platform_device *pdev) | ||
268 | { | ||
269 | struct da9052_rtc *rtc = pdev->dev.platform_data; | ||
270 | |||
271 | rtc_device_unregister(rtc->rtc); | ||
272 | free_irq(rtc->irq, rtc); | ||
273 | platform_set_drvdata(pdev, NULL); | ||
274 | devm_kfree(&pdev->dev, rtc); | ||
275 | |||
276 | return 0; | ||
277 | } | ||
278 | |||
279 | static struct platform_driver da9052_rtc_driver = { | ||
280 | .probe = da9052_rtc_probe, | ||
281 | .remove = __devexit_p(da9052_rtc_remove), | ||
282 | .driver = { | ||
283 | .name = "da9052-rtc", | ||
284 | .owner = THIS_MODULE, | ||
285 | }, | ||
286 | }; | ||
287 | |||
288 | module_platform_driver(da9052_rtc_driver); | ||
289 | |||
290 | MODULE_AUTHOR("David Dajun Chen <dchen@diasemi.com>"); | ||
291 | MODULE_DESCRIPTION("RTC driver for Dialog DA9052 PMIC"); | ||
292 | MODULE_LICENSE("GPL"); | ||
293 | MODULE_ALIAS("platform:da9052-rtc"); | ||
diff --git a/drivers/rtc/rtc-davinci.c b/drivers/rtc/rtc-davinci.c index 755e1fe914af..14c2109dbaa3 100644 --- a/drivers/rtc/rtc-davinci.c +++ b/drivers/rtc/rtc-davinci.c | |||
@@ -542,7 +542,7 @@ static int __init davinci_rtc_probe(struct platform_device *pdev) | |||
542 | rtcss_write(davinci_rtc, 0, PRTCSS_RTC_CCTRL); | 542 | rtcss_write(davinci_rtc, 0, PRTCSS_RTC_CCTRL); |
543 | 543 | ||
544 | ret = request_irq(davinci_rtc->irq, davinci_rtc_interrupt, | 544 | ret = request_irq(davinci_rtc->irq, davinci_rtc_interrupt, |
545 | IRQF_DISABLED, "davinci_rtc", davinci_rtc); | 545 | 0, "davinci_rtc", davinci_rtc); |
546 | if (ret < 0) { | 546 | if (ret < 0) { |
547 | dev_err(dev, "unable to register davinci RTC interrupt\n"); | 547 | dev_err(dev, "unable to register davinci RTC interrupt\n"); |
548 | goto fail4; | 548 | goto fail4; |
diff --git a/drivers/rtc/rtc-ds1305.c b/drivers/rtc/rtc-ds1305.c index 3a33b1fdbe0f..686a865913e1 100644 --- a/drivers/rtc/rtc-ds1305.c +++ b/drivers/rtc/rtc-ds1305.c | |||
@@ -814,17 +814,7 @@ static struct spi_driver ds1305_driver = { | |||
814 | /* REVISIT add suspend/resume */ | 814 | /* REVISIT add suspend/resume */ |
815 | }; | 815 | }; |
816 | 816 | ||
817 | static int __init ds1305_init(void) | 817 | module_spi_driver(ds1305_driver); |
818 | { | ||
819 | return spi_register_driver(&ds1305_driver); | ||
820 | } | ||
821 | module_init(ds1305_init); | ||
822 | |||
823 | static void __exit ds1305_exit(void) | ||
824 | { | ||
825 | spi_unregister_driver(&ds1305_driver); | ||
826 | } | ||
827 | module_exit(ds1305_exit); | ||
828 | 818 | ||
829 | MODULE_DESCRIPTION("RTC driver for DS1305 and DS1306 chips"); | 819 | MODULE_DESCRIPTION("RTC driver for DS1305 and DS1306 chips"); |
830 | MODULE_LICENSE("GPL"); | 820 | MODULE_LICENSE("GPL"); |
diff --git a/drivers/rtc/rtc-ds1307.c b/drivers/rtc/rtc-ds1307.c index 62b0763b7b9a..cd188ab72f79 100644 --- a/drivers/rtc/rtc-ds1307.c +++ b/drivers/rtc/rtc-ds1307.c | |||
@@ -20,7 +20,8 @@ | |||
20 | 20 | ||
21 | 21 | ||
22 | 22 | ||
23 | /* We can't determine type by probing, but if we expect pre-Linux code | 23 | /* |
24 | * We can't determine type by probing, but if we expect pre-Linux code | ||
24 | * to have set the chip up as a clock (turning on the oscillator and | 25 | * to have set the chip up as a clock (turning on the oscillator and |
25 | * setting the date and time), Linux can ignore the non-clock features. | 26 | * setting the date and time), Linux can ignore the non-clock features. |
26 | * That's a natural job for a factory or repair bench. | 27 | * That's a natural job for a factory or repair bench. |
@@ -36,7 +37,8 @@ enum ds_type { | |||
36 | m41t00, | 37 | m41t00, |
37 | mcp7941x, | 38 | mcp7941x, |
38 | rx_8025, | 39 | rx_8025, |
39 | // rs5c372 too? different address... | 40 | last_ds_type /* always last */ |
41 | /* rs5c372 too? different address... */ | ||
40 | }; | 42 | }; |
41 | 43 | ||
42 | 44 | ||
@@ -58,7 +60,8 @@ enum ds_type { | |||
58 | # define DS1337_BIT_CENTURY 0x80 /* in REG_MONTH */ | 60 | # define DS1337_BIT_CENTURY 0x80 /* in REG_MONTH */ |
59 | #define DS1307_REG_YEAR 0x06 /* 00-99 */ | 61 | #define DS1307_REG_YEAR 0x06 /* 00-99 */ |
60 | 62 | ||
61 | /* Other registers (control, status, alarms, trickle charge, NVRAM, etc) | 63 | /* |
64 | * Other registers (control, status, alarms, trickle charge, NVRAM, etc) | ||
62 | * start at 7, and they differ a LOT. Only control and status matter for | 65 | * start at 7, and they differ a LOT. Only control and status matter for |
63 | * basic RTC date and time functionality; be careful using them. | 66 | * basic RTC date and time functionality; be careful using them. |
64 | */ | 67 | */ |
@@ -102,6 +105,8 @@ enum ds_type { | |||
102 | struct ds1307 { | 105 | struct ds1307 { |
103 | u8 offset; /* register's offset */ | 106 | u8 offset; /* register's offset */ |
104 | u8 regs[11]; | 107 | u8 regs[11]; |
108 | u16 nvram_offset; | ||
109 | struct bin_attribute *nvram; | ||
105 | enum ds_type type; | 110 | enum ds_type type; |
106 | unsigned long flags; | 111 | unsigned long flags; |
107 | #define HAS_NVRAM 0 /* bit 0 == sysfs file active */ | 112 | #define HAS_NVRAM 0 /* bit 0 == sysfs file active */ |
@@ -116,34 +121,35 @@ struct ds1307 { | |||
116 | }; | 121 | }; |
117 | 122 | ||
118 | struct chip_desc { | 123 | struct chip_desc { |
119 | unsigned nvram56:1; | ||
120 | unsigned alarm:1; | 124 | unsigned alarm:1; |
125 | u16 nvram_offset; | ||
126 | u16 nvram_size; | ||
121 | }; | 127 | }; |
122 | 128 | ||
123 | static const struct chip_desc chips[] = { | 129 | static const struct chip_desc chips[last_ds_type] = { |
124 | [ds_1307] = { | 130 | [ds_1307] = { |
125 | .nvram56 = 1, | 131 | .nvram_offset = 8, |
126 | }, | 132 | .nvram_size = 56, |
127 | [ds_1337] = { | 133 | }, |
128 | .alarm = 1, | 134 | [ds_1337] = { |
129 | }, | 135 | .alarm = 1, |
130 | [ds_1338] = { | 136 | }, |
131 | .nvram56 = 1, | 137 | [ds_1338] = { |
132 | }, | 138 | .nvram_offset = 8, |
133 | [ds_1339] = { | 139 | .nvram_size = 56, |
134 | .alarm = 1, | 140 | }, |
135 | }, | 141 | [ds_1339] = { |
136 | [ds_1340] = { | 142 | .alarm = 1, |
137 | }, | 143 | }, |
138 | [ds_3231] = { | 144 | [ds_3231] = { |
139 | .alarm = 1, | 145 | .alarm = 1, |
140 | }, | 146 | }, |
141 | [m41t00] = { | 147 | [mcp7941x] = { |
142 | }, | 148 | /* this is battery backed SRAM */ |
143 | [mcp7941x] = { | 149 | .nvram_offset = 0x20, |
144 | }, | 150 | .nvram_size = 0x40, |
145 | [rx_8025] = { | 151 | }, |
146 | }, }; | 152 | }; |
147 | 153 | ||
148 | static const struct i2c_device_id ds1307_id[] = { | 154 | static const struct i2c_device_id ds1307_id[] = { |
149 | { "ds1307", ds_1307 }, | 155 | { "ds1307", ds_1307 }, |
@@ -372,6 +378,11 @@ static int ds1307_set_time(struct device *dev, struct rtc_time *t) | |||
372 | | DS1340_BIT_CENTURY; | 378 | | DS1340_BIT_CENTURY; |
373 | break; | 379 | break; |
374 | case mcp7941x: | 380 | case mcp7941x: |
381 | /* | ||
382 | * these bits were cleared when preparing the date/time | ||
383 | * values and need to be set again before writing the | ||
384 | * buffer out to the device. | ||
385 | */ | ||
375 | buf[DS1307_REG_SECS] |= MCP7941X_BIT_ST; | 386 | buf[DS1307_REG_SECS] |= MCP7941X_BIT_ST; |
376 | buf[DS1307_REG_WDAY] |= MCP7941X_BIT_VBATEN; | 387 | buf[DS1307_REG_WDAY] |= MCP7941X_BIT_VBATEN; |
377 | break; | 388 | break; |
@@ -417,7 +428,8 @@ static int ds1337_read_alarm(struct device *dev, struct rtc_wkalrm *t) | |||
417 | ds1307->regs[6], ds1307->regs[7], | 428 | ds1307->regs[6], ds1307->regs[7], |
418 | ds1307->regs[8]); | 429 | ds1307->regs[8]); |
419 | 430 | ||
420 | /* report alarm time (ALARM1); assume 24 hour and day-of-month modes, | 431 | /* |
432 | * report alarm time (ALARM1); assume 24 hour and day-of-month modes, | ||
421 | * and that all four fields are checked matches | 433 | * and that all four fields are checked matches |
422 | */ | 434 | */ |
423 | t->time.tm_sec = bcd2bin(ds1307->regs[0] & 0x7f); | 435 | t->time.tm_sec = bcd2bin(ds1307->regs[0] & 0x7f); |
@@ -445,7 +457,7 @@ static int ds1337_read_alarm(struct device *dev, struct rtc_wkalrm *t) | |||
445 | 457 | ||
446 | static int ds1337_set_alarm(struct device *dev, struct rtc_wkalrm *t) | 458 | static int ds1337_set_alarm(struct device *dev, struct rtc_wkalrm *t) |
447 | { | 459 | { |
448 | struct i2c_client *client = to_i2c_client(dev); | 460 | struct i2c_client *client = to_i2c_client(dev); |
449 | struct ds1307 *ds1307 = i2c_get_clientdata(client); | 461 | struct ds1307 *ds1307 = i2c_get_clientdata(client); |
450 | unsigned char *buf = ds1307->regs; | 462 | unsigned char *buf = ds1307->regs; |
451 | u8 control, status; | 463 | u8 control, status; |
@@ -541,8 +553,6 @@ static const struct rtc_class_ops ds13xx_rtc_ops = { | |||
541 | 553 | ||
542 | /*----------------------------------------------------------------------*/ | 554 | /*----------------------------------------------------------------------*/ |
543 | 555 | ||
544 | #define NVRAM_SIZE 56 | ||
545 | |||
546 | static ssize_t | 556 | static ssize_t |
547 | ds1307_nvram_read(struct file *filp, struct kobject *kobj, | 557 | ds1307_nvram_read(struct file *filp, struct kobject *kobj, |
548 | struct bin_attribute *attr, | 558 | struct bin_attribute *attr, |
@@ -555,14 +565,15 @@ ds1307_nvram_read(struct file *filp, struct kobject *kobj, | |||
555 | client = kobj_to_i2c_client(kobj); | 565 | client = kobj_to_i2c_client(kobj); |
556 | ds1307 = i2c_get_clientdata(client); | 566 | ds1307 = i2c_get_clientdata(client); |
557 | 567 | ||
558 | if (unlikely(off >= NVRAM_SIZE)) | 568 | if (unlikely(off >= ds1307->nvram->size)) |
559 | return 0; | 569 | return 0; |
560 | if ((off + count) > NVRAM_SIZE) | 570 | if ((off + count) > ds1307->nvram->size) |
561 | count = NVRAM_SIZE - off; | 571 | count = ds1307->nvram->size - off; |
562 | if (unlikely(!count)) | 572 | if (unlikely(!count)) |
563 | return count; | 573 | return count; |
564 | 574 | ||
565 | result = ds1307->read_block_data(client, 8 + off, count, buf); | 575 | result = ds1307->read_block_data(client, ds1307->nvram_offset + off, |
576 | count, buf); | ||
566 | if (result < 0) | 577 | if (result < 0) |
567 | dev_err(&client->dev, "%s error %d\n", "nvram read", result); | 578 | dev_err(&client->dev, "%s error %d\n", "nvram read", result); |
568 | return result; | 579 | return result; |
@@ -580,14 +591,15 @@ ds1307_nvram_write(struct file *filp, struct kobject *kobj, | |||
580 | client = kobj_to_i2c_client(kobj); | 591 | client = kobj_to_i2c_client(kobj); |
581 | ds1307 = i2c_get_clientdata(client); | 592 | ds1307 = i2c_get_clientdata(client); |
582 | 593 | ||
583 | if (unlikely(off >= NVRAM_SIZE)) | 594 | if (unlikely(off >= ds1307->nvram->size)) |
584 | return -EFBIG; | 595 | return -EFBIG; |
585 | if ((off + count) > NVRAM_SIZE) | 596 | if ((off + count) > ds1307->nvram->size) |
586 | count = NVRAM_SIZE - off; | 597 | count = ds1307->nvram->size - off; |
587 | if (unlikely(!count)) | 598 | if (unlikely(!count)) |
588 | return count; | 599 | return count; |
589 | 600 | ||
590 | result = ds1307->write_block_data(client, 8 + off, count, buf); | 601 | result = ds1307->write_block_data(client, ds1307->nvram_offset + off, |
602 | count, buf); | ||
591 | if (result < 0) { | 603 | if (result < 0) { |
592 | dev_err(&client->dev, "%s error %d\n", "nvram write", result); | 604 | dev_err(&client->dev, "%s error %d\n", "nvram write", result); |
593 | return result; | 605 | return result; |
@@ -595,21 +607,8 @@ ds1307_nvram_write(struct file *filp, struct kobject *kobj, | |||
595 | return count; | 607 | return count; |
596 | } | 608 | } |
597 | 609 | ||
598 | static struct bin_attribute nvram = { | ||
599 | .attr = { | ||
600 | .name = "nvram", | ||
601 | .mode = S_IRUGO | S_IWUSR, | ||
602 | }, | ||
603 | |||
604 | .read = ds1307_nvram_read, | ||
605 | .write = ds1307_nvram_write, | ||
606 | .size = NVRAM_SIZE, | ||
607 | }; | ||
608 | |||
609 | /*----------------------------------------------------------------------*/ | 610 | /*----------------------------------------------------------------------*/ |
610 | 611 | ||
611 | static struct i2c_driver ds1307_driver; | ||
612 | |||
613 | static int __devinit ds1307_probe(struct i2c_client *client, | 612 | static int __devinit ds1307_probe(struct i2c_client *client, |
614 | const struct i2c_device_id *id) | 613 | const struct i2c_device_id *id) |
615 | { | 614 | { |
@@ -630,7 +629,8 @@ static int __devinit ds1307_probe(struct i2c_client *client, | |||
630 | && !i2c_check_functionality(adapter, I2C_FUNC_SMBUS_I2C_BLOCK)) | 629 | && !i2c_check_functionality(adapter, I2C_FUNC_SMBUS_I2C_BLOCK)) |
631 | return -EIO; | 630 | return -EIO; |
632 | 631 | ||
633 | if (!(ds1307 = kzalloc(sizeof(struct ds1307), GFP_KERNEL))) | 632 | ds1307 = kzalloc(sizeof(struct ds1307), GFP_KERNEL); |
633 | if (!ds1307) | ||
634 | return -ENOMEM; | 634 | return -ENOMEM; |
635 | 635 | ||
636 | i2c_set_clientdata(client, ds1307); | 636 | i2c_set_clientdata(client, ds1307); |
@@ -652,11 +652,6 @@ static int __devinit ds1307_probe(struct i2c_client *client, | |||
652 | case ds_1337: | 652 | case ds_1337: |
653 | case ds_1339: | 653 | case ds_1339: |
654 | case ds_3231: | 654 | case ds_3231: |
655 | /* has IRQ? */ | ||
656 | if (ds1307->client->irq > 0 && chip->alarm) { | ||
657 | INIT_WORK(&ds1307->work, ds1307_work); | ||
658 | want_irq = true; | ||
659 | } | ||
660 | /* get registers that the "rtc" read below won't read... */ | 655 | /* get registers that the "rtc" read below won't read... */ |
661 | tmp = ds1307->read_block_data(ds1307->client, | 656 | tmp = ds1307->read_block_data(ds1307->client, |
662 | DS1337_REG_CONTROL, 2, buf); | 657 | DS1337_REG_CONTROL, 2, buf); |
@@ -670,14 +665,19 @@ static int __devinit ds1307_probe(struct i2c_client *client, | |||
670 | if (ds1307->regs[0] & DS1337_BIT_nEOSC) | 665 | if (ds1307->regs[0] & DS1337_BIT_nEOSC) |
671 | ds1307->regs[0] &= ~DS1337_BIT_nEOSC; | 666 | ds1307->regs[0] &= ~DS1337_BIT_nEOSC; |
672 | 667 | ||
673 | /* Using IRQ? Disable the square wave and both alarms. | 668 | /* |
669 | * Using IRQ? Disable the square wave and both alarms. | ||
674 | * For some variants, be sure alarms can trigger when we're | 670 | * For some variants, be sure alarms can trigger when we're |
675 | * running on Vbackup (BBSQI/BBSQW) | 671 | * running on Vbackup (BBSQI/BBSQW) |
676 | */ | 672 | */ |
677 | if (want_irq) { | 673 | if (ds1307->client->irq > 0 && chip->alarm) { |
674 | INIT_WORK(&ds1307->work, ds1307_work); | ||
675 | |||
678 | ds1307->regs[0] |= DS1337_BIT_INTCN | 676 | ds1307->regs[0] |= DS1337_BIT_INTCN |
679 | | bbsqi_bitpos[ds1307->type]; | 677 | | bbsqi_bitpos[ds1307->type]; |
680 | ds1307->regs[0] &= ~(DS1337_BIT_A2IE | DS1337_BIT_A1IE); | 678 | ds1307->regs[0] &= ~(DS1337_BIT_A2IE | DS1337_BIT_A1IE); |
679 | |||
680 | want_irq = true; | ||
681 | } | 681 | } |
682 | 682 | ||
683 | i2c_smbus_write_byte_data(client, DS1337_REG_CONTROL, | 683 | i2c_smbus_write_byte_data(client, DS1337_REG_CONTROL, |
@@ -772,7 +772,8 @@ read_rtc: | |||
772 | goto exit_free; | 772 | goto exit_free; |
773 | } | 773 | } |
774 | 774 | ||
775 | /* minimal sanity checking; some chips (like DS1340) don't | 775 | /* |
776 | * minimal sanity checking; some chips (like DS1340) don't | ||
776 | * specify the extra bits as must-be-zero, but there are | 777 | * specify the extra bits as must-be-zero, but there are |
777 | * still a few values that are clearly out-of-range. | 778 | * still a few values that are clearly out-of-range. |
778 | */ | 779 | */ |
@@ -836,11 +837,7 @@ read_rtc: | |||
836 | } | 837 | } |
837 | 838 | ||
838 | break; | 839 | break; |
839 | case rx_8025: | 840 | default: |
840 | case ds_1337: | ||
841 | case ds_1339: | ||
842 | case ds_1388: | ||
843 | case ds_3231: | ||
844 | break; | 841 | break; |
845 | } | 842 | } |
846 | 843 | ||
@@ -848,7 +845,8 @@ read_rtc: | |||
848 | switch (ds1307->type) { | 845 | switch (ds1307->type) { |
849 | case ds_1340: | 846 | case ds_1340: |
850 | case m41t00: | 847 | case m41t00: |
851 | /* NOTE: ignores century bits; fix before deploying | 848 | /* |
849 | * NOTE: ignores century bits; fix before deploying | ||
852 | * systems that will run through year 2100. | 850 | * systems that will run through year 2100. |
853 | */ | 851 | */ |
854 | break; | 852 | break; |
@@ -858,7 +856,8 @@ read_rtc: | |||
858 | if (!(tmp & DS1307_BIT_12HR)) | 856 | if (!(tmp & DS1307_BIT_12HR)) |
859 | break; | 857 | break; |
860 | 858 | ||
861 | /* Be sure we're in 24 hour mode. Multi-master systems | 859 | /* |
860 | * Be sure we're in 24 hour mode. Multi-master systems | ||
862 | * take note... | 861 | * take note... |
863 | */ | 862 | */ |
864 | tmp = bcd2bin(tmp & 0x1f); | 863 | tmp = bcd2bin(tmp & 0x1f); |
@@ -894,16 +893,31 @@ read_rtc: | |||
894 | dev_dbg(&client->dev, "got IRQ %d\n", client->irq); | 893 | dev_dbg(&client->dev, "got IRQ %d\n", client->irq); |
895 | } | 894 | } |
896 | 895 | ||
897 | if (chip->nvram56) { | 896 | if (chip->nvram_size) { |
898 | err = sysfs_create_bin_file(&client->dev.kobj, &nvram); | 897 | ds1307->nvram = kzalloc(sizeof(struct bin_attribute), |
899 | if (err == 0) { | 898 | GFP_KERNEL); |
900 | set_bit(HAS_NVRAM, &ds1307->flags); | 899 | if (!ds1307->nvram) { |
901 | dev_info(&client->dev, "56 bytes nvram\n"); | 900 | err = -ENOMEM; |
901 | goto exit_nvram; | ||
902 | } | ||
903 | ds1307->nvram->attr.name = "nvram"; | ||
904 | ds1307->nvram->attr.mode = S_IRUGO | S_IWUSR; | ||
905 | ds1307->nvram->read = ds1307_nvram_read, | ||
906 | ds1307->nvram->write = ds1307_nvram_write, | ||
907 | ds1307->nvram->size = chip->nvram_size; | ||
908 | ds1307->nvram_offset = chip->nvram_offset; | ||
909 | err = sysfs_create_bin_file(&client->dev.kobj, ds1307->nvram); | ||
910 | if (err) { | ||
911 | kfree(ds1307->nvram); | ||
912 | goto exit_nvram; | ||
902 | } | 913 | } |
914 | set_bit(HAS_NVRAM, &ds1307->flags); | ||
915 | dev_info(&client->dev, "%zu bytes nvram\n", ds1307->nvram->size); | ||
903 | } | 916 | } |
904 | 917 | ||
905 | return 0; | 918 | return 0; |
906 | 919 | ||
920 | exit_nvram: | ||
907 | exit_irq: | 921 | exit_irq: |
908 | rtc_device_unregister(ds1307->rtc); | 922 | rtc_device_unregister(ds1307->rtc); |
909 | exit_free: | 923 | exit_free: |
@@ -913,15 +927,17 @@ exit_free: | |||
913 | 927 | ||
914 | static int __devexit ds1307_remove(struct i2c_client *client) | 928 | static int __devexit ds1307_remove(struct i2c_client *client) |
915 | { | 929 | { |
916 | struct ds1307 *ds1307 = i2c_get_clientdata(client); | 930 | struct ds1307 *ds1307 = i2c_get_clientdata(client); |
917 | 931 | ||
918 | if (test_and_clear_bit(HAS_ALARM, &ds1307->flags)) { | 932 | if (test_and_clear_bit(HAS_ALARM, &ds1307->flags)) { |
919 | free_irq(client->irq, client); | 933 | free_irq(client->irq, client); |
920 | cancel_work_sync(&ds1307->work); | 934 | cancel_work_sync(&ds1307->work); |
921 | } | 935 | } |
922 | 936 | ||
923 | if (test_and_clear_bit(HAS_NVRAM, &ds1307->flags)) | 937 | if (test_and_clear_bit(HAS_NVRAM, &ds1307->flags)) { |
924 | sysfs_remove_bin_file(&client->dev.kobj, &nvram); | 938 | sysfs_remove_bin_file(&client->dev.kobj, ds1307->nvram); |
939 | kfree(ds1307->nvram); | ||
940 | } | ||
925 | 941 | ||
926 | rtc_device_unregister(ds1307->rtc); | 942 | rtc_device_unregister(ds1307->rtc); |
927 | kfree(ds1307); | 943 | kfree(ds1307); |
@@ -938,17 +954,7 @@ static struct i2c_driver ds1307_driver = { | |||
938 | .id_table = ds1307_id, | 954 | .id_table = ds1307_id, |
939 | }; | 955 | }; |
940 | 956 | ||
941 | static int __init ds1307_init(void) | 957 | module_i2c_driver(ds1307_driver); |
942 | { | ||
943 | return i2c_add_driver(&ds1307_driver); | ||
944 | } | ||
945 | module_init(ds1307_init); | ||
946 | |||
947 | static void __exit ds1307_exit(void) | ||
948 | { | ||
949 | i2c_del_driver(&ds1307_driver); | ||
950 | } | ||
951 | module_exit(ds1307_exit); | ||
952 | 958 | ||
953 | MODULE_DESCRIPTION("RTC driver for DS1307 and similar chips"); | 959 | MODULE_DESCRIPTION("RTC driver for DS1307 and similar chips"); |
954 | MODULE_LICENSE("GPL"); | 960 | MODULE_LICENSE("GPL"); |
diff --git a/drivers/rtc/rtc-ds1374.c b/drivers/rtc/rtc-ds1374.c index e6e71deb188f..966316088b7f 100644 --- a/drivers/rtc/rtc-ds1374.c +++ b/drivers/rtc/rtc-ds1374.c | |||
@@ -446,18 +446,7 @@ static struct i2c_driver ds1374_driver = { | |||
446 | .id_table = ds1374_id, | 446 | .id_table = ds1374_id, |
447 | }; | 447 | }; |
448 | 448 | ||
449 | static int __init ds1374_init(void) | 449 | module_i2c_driver(ds1374_driver); |
450 | { | ||
451 | return i2c_add_driver(&ds1374_driver); | ||
452 | } | ||
453 | |||
454 | static void __exit ds1374_exit(void) | ||
455 | { | ||
456 | i2c_del_driver(&ds1374_driver); | ||
457 | } | ||
458 | |||
459 | module_init(ds1374_init); | ||
460 | module_exit(ds1374_exit); | ||
461 | 450 | ||
462 | MODULE_AUTHOR("Scott Wood <scottwood@freescale.com>"); | 451 | MODULE_AUTHOR("Scott Wood <scottwood@freescale.com>"); |
463 | MODULE_DESCRIPTION("Maxim/Dallas DS1374 RTC Driver"); | 452 | MODULE_DESCRIPTION("Maxim/Dallas DS1374 RTC Driver"); |
diff --git a/drivers/rtc/rtc-ds1390.c b/drivers/rtc/rtc-ds1390.c index b038d2cfef26..b0a99e1b25be 100644 --- a/drivers/rtc/rtc-ds1390.c +++ b/drivers/rtc/rtc-ds1390.c | |||
@@ -175,17 +175,7 @@ static struct spi_driver ds1390_driver = { | |||
175 | .remove = __devexit_p(ds1390_remove), | 175 | .remove = __devexit_p(ds1390_remove), |
176 | }; | 176 | }; |
177 | 177 | ||
178 | static __init int ds1390_init(void) | 178 | module_spi_driver(ds1390_driver); |
179 | { | ||
180 | return spi_register_driver(&ds1390_driver); | ||
181 | } | ||
182 | module_init(ds1390_init); | ||
183 | |||
184 | static __exit void ds1390_exit(void) | ||
185 | { | ||
186 | spi_unregister_driver(&ds1390_driver); | ||
187 | } | ||
188 | module_exit(ds1390_exit); | ||
189 | 179 | ||
190 | MODULE_DESCRIPTION("Dallas/Maxim DS1390/93/94 SPI RTC driver"); | 180 | MODULE_DESCRIPTION("Dallas/Maxim DS1390/93/94 SPI RTC driver"); |
191 | MODULE_AUTHOR("Mark Jackson <mpfj@mimc.co.uk>"); | 181 | MODULE_AUTHOR("Mark Jackson <mpfj@mimc.co.uk>"); |
diff --git a/drivers/rtc/rtc-ds1511.c b/drivers/rtc/rtc-ds1511.c index 761f36bc83a9..1f675f5294f5 100644 --- a/drivers/rtc/rtc-ds1511.c +++ b/drivers/rtc/rtc-ds1511.c | |||
@@ -532,7 +532,7 @@ ds1511_rtc_probe(struct platform_device *pdev) | |||
532 | if (pdata->irq > 0) { | 532 | if (pdata->irq > 0) { |
533 | rtc_read(RTC_CMD1); | 533 | rtc_read(RTC_CMD1); |
534 | if (devm_request_irq(&pdev->dev, pdata->irq, ds1511_interrupt, | 534 | if (devm_request_irq(&pdev->dev, pdata->irq, ds1511_interrupt, |
535 | IRQF_DISABLED | IRQF_SHARED, pdev->name, pdev) < 0) { | 535 | IRQF_SHARED, pdev->name, pdev) < 0) { |
536 | 536 | ||
537 | dev_warn(&pdev->dev, "interrupt not available.\n"); | 537 | dev_warn(&pdev->dev, "interrupt not available.\n"); |
538 | pdata->irq = 0; | 538 | pdata->irq = 0; |
diff --git a/drivers/rtc/rtc-ds1553.c b/drivers/rtc/rtc-ds1553.c index 6f0a1b530f2e..6ccedbbf923c 100644 --- a/drivers/rtc/rtc-ds1553.c +++ b/drivers/rtc/rtc-ds1553.c | |||
@@ -320,7 +320,7 @@ static int __devinit ds1553_rtc_probe(struct platform_device *pdev) | |||
320 | writeb(0, ioaddr + RTC_INTERRUPTS); | 320 | writeb(0, ioaddr + RTC_INTERRUPTS); |
321 | if (devm_request_irq(&pdev->dev, pdata->irq, | 321 | if (devm_request_irq(&pdev->dev, pdata->irq, |
322 | ds1553_rtc_interrupt, | 322 | ds1553_rtc_interrupt, |
323 | IRQF_DISABLED, pdev->name, pdev) < 0) { | 323 | 0, pdev->name, pdev) < 0) { |
324 | dev_warn(&pdev->dev, "interrupt not available.\n"); | 324 | dev_warn(&pdev->dev, "interrupt not available.\n"); |
325 | pdata->irq = 0; | 325 | pdata->irq = 0; |
326 | } | 326 | } |
diff --git a/drivers/rtc/rtc-ds1672.c b/drivers/rtc/rtc-ds1672.c index a319402a5447..7fa67d0df172 100644 --- a/drivers/rtc/rtc-ds1672.c +++ b/drivers/rtc/rtc-ds1672.c | |||
@@ -202,20 +202,9 @@ static struct i2c_driver ds1672_driver = { | |||
202 | .id_table = ds1672_id, | 202 | .id_table = ds1672_id, |
203 | }; | 203 | }; |
204 | 204 | ||
205 | static int __init ds1672_init(void) | 205 | module_i2c_driver(ds1672_driver); |
206 | { | ||
207 | return i2c_add_driver(&ds1672_driver); | ||
208 | } | ||
209 | |||
210 | static void __exit ds1672_exit(void) | ||
211 | { | ||
212 | i2c_del_driver(&ds1672_driver); | ||
213 | } | ||
214 | 206 | ||
215 | MODULE_AUTHOR("Alessandro Zummo <a.zummo@towertech.it>"); | 207 | MODULE_AUTHOR("Alessandro Zummo <a.zummo@towertech.it>"); |
216 | MODULE_DESCRIPTION("Dallas/Maxim DS1672 timekeeper driver"); | 208 | MODULE_DESCRIPTION("Dallas/Maxim DS1672 timekeeper driver"); |
217 | MODULE_LICENSE("GPL"); | 209 | MODULE_LICENSE("GPL"); |
218 | MODULE_VERSION(DRV_VERSION); | 210 | MODULE_VERSION(DRV_VERSION); |
219 | |||
220 | module_init(ds1672_init); | ||
221 | module_exit(ds1672_exit); | ||
diff --git a/drivers/rtc/rtc-ds3232.c b/drivers/rtc/rtc-ds3232.c index 27b7bf672ac6..e1945095814e 100644 --- a/drivers/rtc/rtc-ds3232.c +++ b/drivers/rtc/rtc-ds3232.c | |||
@@ -473,18 +473,7 @@ static struct i2c_driver ds3232_driver = { | |||
473 | .id_table = ds3232_id, | 473 | .id_table = ds3232_id, |
474 | }; | 474 | }; |
475 | 475 | ||
476 | static int __init ds3232_init(void) | 476 | module_i2c_driver(ds3232_driver); |
477 | { | ||
478 | return i2c_add_driver(&ds3232_driver); | ||
479 | } | ||
480 | |||
481 | static void __exit ds3232_exit(void) | ||
482 | { | ||
483 | i2c_del_driver(&ds3232_driver); | ||
484 | } | ||
485 | |||
486 | module_init(ds3232_init); | ||
487 | module_exit(ds3232_exit); | ||
488 | 477 | ||
489 | MODULE_AUTHOR("Srikanth Srinivasan <srikanth.srinivasan@freescale.com>"); | 478 | MODULE_AUTHOR("Srikanth Srinivasan <srikanth.srinivasan@freescale.com>"); |
490 | MODULE_DESCRIPTION("Maxim/Dallas DS3232 RTC Driver"); | 479 | MODULE_DESCRIPTION("Maxim/Dallas DS3232 RTC Driver"); |
diff --git a/drivers/rtc/rtc-ds3234.c b/drivers/rtc/rtc-ds3234.c index bbd26228f532..fda707926f02 100644 --- a/drivers/rtc/rtc-ds3234.c +++ b/drivers/rtc/rtc-ds3234.c | |||
@@ -173,17 +173,7 @@ static struct spi_driver ds3234_driver = { | |||
173 | .remove = __devexit_p(ds3234_remove), | 173 | .remove = __devexit_p(ds3234_remove), |
174 | }; | 174 | }; |
175 | 175 | ||
176 | static __init int ds3234_init(void) | 176 | module_spi_driver(ds3234_driver); |
177 | { | ||
178 | return spi_register_driver(&ds3234_driver); | ||
179 | } | ||
180 | module_init(ds3234_init); | ||
181 | |||
182 | static __exit void ds3234_exit(void) | ||
183 | { | ||
184 | spi_unregister_driver(&ds3234_driver); | ||
185 | } | ||
186 | module_exit(ds3234_exit); | ||
187 | 177 | ||
188 | MODULE_DESCRIPTION("DS3234 SPI RTC driver"); | 178 | MODULE_DESCRIPTION("DS3234 SPI RTC driver"); |
189 | MODULE_AUTHOR("Dennis Aberilla <denzzzhome@yahoo.com>"); | 179 | MODULE_AUTHOR("Dennis Aberilla <denzzzhome@yahoo.com>"); |
diff --git a/drivers/rtc/rtc-em3027.c b/drivers/rtc/rtc-em3027.c index 8414dea5fb14..0104ea7ebe50 100644 --- a/drivers/rtc/rtc-em3027.c +++ b/drivers/rtc/rtc-em3027.c | |||
@@ -144,19 +144,8 @@ static struct i2c_driver em3027_driver = { | |||
144 | .id_table = em3027_id, | 144 | .id_table = em3027_id, |
145 | }; | 145 | }; |
146 | 146 | ||
147 | static int __init em3027_init(void) | 147 | module_i2c_driver(em3027_driver); |
148 | { | ||
149 | return i2c_add_driver(&em3027_driver); | ||
150 | } | ||
151 | |||
152 | static void __exit em3027_exit(void) | ||
153 | { | ||
154 | i2c_del_driver(&em3027_driver); | ||
155 | } | ||
156 | 148 | ||
157 | MODULE_AUTHOR("Mike Rapoport <mike@compulab.co.il>"); | 149 | MODULE_AUTHOR("Mike Rapoport <mike@compulab.co.il>"); |
158 | MODULE_DESCRIPTION("EM Microelectronic EM3027 RTC driver"); | 150 | MODULE_DESCRIPTION("EM Microelectronic EM3027 RTC driver"); |
159 | MODULE_LICENSE("GPL"); | 151 | MODULE_LICENSE("GPL"); |
160 | |||
161 | module_init(em3027_init); | ||
162 | module_exit(em3027_exit); | ||
diff --git a/drivers/rtc/rtc-fm3130.c b/drivers/rtc/rtc-fm3130.c index 4cf2e70c5078..86b6ecce99f0 100644 --- a/drivers/rtc/rtc-fm3130.c +++ b/drivers/rtc/rtc-fm3130.c | |||
@@ -565,17 +565,7 @@ static struct i2c_driver fm3130_driver = { | |||
565 | .id_table = fm3130_id, | 565 | .id_table = fm3130_id, |
566 | }; | 566 | }; |
567 | 567 | ||
568 | static int __init fm3130_init(void) | 568 | module_i2c_driver(fm3130_driver); |
569 | { | ||
570 | return i2c_add_driver(&fm3130_driver); | ||
571 | } | ||
572 | module_init(fm3130_init); | ||
573 | |||
574 | static void __exit fm3130_exit(void) | ||
575 | { | ||
576 | i2c_del_driver(&fm3130_driver); | ||
577 | } | ||
578 | module_exit(fm3130_exit); | ||
579 | 569 | ||
580 | MODULE_DESCRIPTION("RTC driver for FM3130"); | 570 | MODULE_DESCRIPTION("RTC driver for FM3130"); |
581 | MODULE_AUTHOR("Sergey Lapin <slapin@ossfans.org>"); | 571 | MODULE_AUTHOR("Sergey Lapin <slapin@ossfans.org>"); |
diff --git a/drivers/rtc/rtc-isl12022.c b/drivers/rtc/rtc-isl12022.c index 6186833973ee..1850104705c0 100644 --- a/drivers/rtc/rtc-isl12022.c +++ b/drivers/rtc/rtc-isl12022.c | |||
@@ -309,18 +309,7 @@ static struct i2c_driver isl12022_driver = { | |||
309 | .id_table = isl12022_id, | 309 | .id_table = isl12022_id, |
310 | }; | 310 | }; |
311 | 311 | ||
312 | static int __init isl12022_init(void) | 312 | module_i2c_driver(isl12022_driver); |
313 | { | ||
314 | return i2c_add_driver(&isl12022_driver); | ||
315 | } | ||
316 | |||
317 | static void __exit isl12022_exit(void) | ||
318 | { | ||
319 | i2c_del_driver(&isl12022_driver); | ||
320 | } | ||
321 | |||
322 | module_init(isl12022_init); | ||
323 | module_exit(isl12022_exit); | ||
324 | 313 | ||
325 | MODULE_AUTHOR("roman.fietze@telemotive.de"); | 314 | MODULE_AUTHOR("roman.fietze@telemotive.de"); |
326 | MODULE_DESCRIPTION("ISL 12022 RTC driver"); | 315 | MODULE_DESCRIPTION("ISL 12022 RTC driver"); |
diff --git a/drivers/rtc/rtc-isl1208.c b/drivers/rtc/rtc-isl1208.c index da8beb8cae51..dd2aeee6c66a 100644 --- a/drivers/rtc/rtc-isl1208.c +++ b/drivers/rtc/rtc-isl1208.c | |||
@@ -710,22 +710,9 @@ static struct i2c_driver isl1208_driver = { | |||
710 | .id_table = isl1208_id, | 710 | .id_table = isl1208_id, |
711 | }; | 711 | }; |
712 | 712 | ||
713 | static int __init | 713 | module_i2c_driver(isl1208_driver); |
714 | isl1208_init(void) | ||
715 | { | ||
716 | return i2c_add_driver(&isl1208_driver); | ||
717 | } | ||
718 | |||
719 | static void __exit | ||
720 | isl1208_exit(void) | ||
721 | { | ||
722 | i2c_del_driver(&isl1208_driver); | ||
723 | } | ||
724 | 714 | ||
725 | MODULE_AUTHOR("Herbert Valerio Riedel <hvr@gnu.org>"); | 715 | MODULE_AUTHOR("Herbert Valerio Riedel <hvr@gnu.org>"); |
726 | MODULE_DESCRIPTION("Intersil ISL1208 RTC driver"); | 716 | MODULE_DESCRIPTION("Intersil ISL1208 RTC driver"); |
727 | MODULE_LICENSE("GPL"); | 717 | MODULE_LICENSE("GPL"); |
728 | MODULE_VERSION(DRV_VERSION); | 718 | MODULE_VERSION(DRV_VERSION); |
729 | |||
730 | module_init(isl1208_init); | ||
731 | module_exit(isl1208_exit); | ||
diff --git a/drivers/rtc/rtc-lpc32xx.c b/drivers/rtc/rtc-lpc32xx.c index ecc1713b2b4f..63c72189c64b 100644 --- a/drivers/rtc/rtc-lpc32xx.c +++ b/drivers/rtc/rtc-lpc32xx.c | |||
@@ -287,7 +287,7 @@ static int __devinit lpc32xx_rtc_probe(struct platform_device *pdev) | |||
287 | if (rtc->irq >= 0) { | 287 | if (rtc->irq >= 0) { |
288 | if (devm_request_irq(&pdev->dev, rtc->irq, | 288 | if (devm_request_irq(&pdev->dev, rtc->irq, |
289 | lpc32xx_rtc_alarm_interrupt, | 289 | lpc32xx_rtc_alarm_interrupt, |
290 | IRQF_DISABLED, pdev->name, rtc) < 0) { | 290 | 0, pdev->name, rtc) < 0) { |
291 | dev_warn(&pdev->dev, "Can't request interrupt.\n"); | 291 | dev_warn(&pdev->dev, "Can't request interrupt.\n"); |
292 | rtc->irq = -1; | 292 | rtc->irq = -1; |
293 | } else { | 293 | } else { |
diff --git a/drivers/rtc/rtc-ls1x.c b/drivers/rtc/rtc-ls1x.c new file mode 100644 index 000000000000..07e81c5f8247 --- /dev/null +++ b/drivers/rtc/rtc-ls1x.c | |||
@@ -0,0 +1,210 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2011 Zhao Zhang <zhzhl555@gmail.com> | ||
3 | * | ||
4 | * Derived from driver/rtc/rtc-au1xxx.c | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify it | ||
7 | * under the terms of the GNU General Public License as published by the | ||
8 | * Free Software Foundation; either version 2 of the License, or (at your | ||
9 | * option) any later version. | ||
10 | */ | ||
11 | |||
12 | #include <linux/module.h> | ||
13 | #include <linux/kernel.h> | ||
14 | #include <linux/rtc.h> | ||
15 | #include <linux/init.h> | ||
16 | #include <linux/platform_device.h> | ||
17 | #include <linux/delay.h> | ||
18 | #include <linux/types.h> | ||
19 | #include <linux/io.h> | ||
20 | #include <asm/mach-loongson1/loongson1.h> | ||
21 | |||
22 | #define LS1X_RTC_REG_OFFSET (LS1X_RTC_BASE + 0x20) | ||
23 | #define LS1X_RTC_REGS(x) \ | ||
24 | ((void __iomem *)KSEG1ADDR(LS1X_RTC_REG_OFFSET + (x))) | ||
25 | |||
26 | /*RTC programmable counters 0 and 1*/ | ||
27 | #define SYS_COUNTER_CNTRL (LS1X_RTC_REGS(0x20)) | ||
28 | #define SYS_CNTRL_ERS (1 << 23) | ||
29 | #define SYS_CNTRL_RTS (1 << 20) | ||
30 | #define SYS_CNTRL_RM2 (1 << 19) | ||
31 | #define SYS_CNTRL_RM1 (1 << 18) | ||
32 | #define SYS_CNTRL_RM0 (1 << 17) | ||
33 | #define SYS_CNTRL_RS (1 << 16) | ||
34 | #define SYS_CNTRL_BP (1 << 14) | ||
35 | #define SYS_CNTRL_REN (1 << 13) | ||
36 | #define SYS_CNTRL_BRT (1 << 12) | ||
37 | #define SYS_CNTRL_TEN (1 << 11) | ||
38 | #define SYS_CNTRL_BTT (1 << 10) | ||
39 | #define SYS_CNTRL_E0 (1 << 8) | ||
40 | #define SYS_CNTRL_ETS (1 << 7) | ||
41 | #define SYS_CNTRL_32S (1 << 5) | ||
42 | #define SYS_CNTRL_TTS (1 << 4) | ||
43 | #define SYS_CNTRL_TM2 (1 << 3) | ||
44 | #define SYS_CNTRL_TM1 (1 << 2) | ||
45 | #define SYS_CNTRL_TM0 (1 << 1) | ||
46 | #define SYS_CNTRL_TS (1 << 0) | ||
47 | |||
48 | /* Programmable Counter 0 Registers */ | ||
49 | #define SYS_TOYTRIM (LS1X_RTC_REGS(0)) | ||
50 | #define SYS_TOYWRITE0 (LS1X_RTC_REGS(4)) | ||
51 | #define SYS_TOYWRITE1 (LS1X_RTC_REGS(8)) | ||
52 | #define SYS_TOYREAD0 (LS1X_RTC_REGS(0xC)) | ||
53 | #define SYS_TOYREAD1 (LS1X_RTC_REGS(0x10)) | ||
54 | #define SYS_TOYMATCH0 (LS1X_RTC_REGS(0x14)) | ||
55 | #define SYS_TOYMATCH1 (LS1X_RTC_REGS(0x18)) | ||
56 | #define SYS_TOYMATCH2 (LS1X_RTC_REGS(0x1C)) | ||
57 | |||
58 | /* Programmable Counter 1 Registers */ | ||
59 | #define SYS_RTCTRIM (LS1X_RTC_REGS(0x40)) | ||
60 | #define SYS_RTCWRITE0 (LS1X_RTC_REGS(0x44)) | ||
61 | #define SYS_RTCREAD0 (LS1X_RTC_REGS(0x48)) | ||
62 | #define SYS_RTCMATCH0 (LS1X_RTC_REGS(0x4C)) | ||
63 | #define SYS_RTCMATCH1 (LS1X_RTC_REGS(0x50)) | ||
64 | #define SYS_RTCMATCH2 (LS1X_RTC_REGS(0x54)) | ||
65 | |||
66 | #define LS1X_SEC_OFFSET (4) | ||
67 | #define LS1X_MIN_OFFSET (10) | ||
68 | #define LS1X_HOUR_OFFSET (16) | ||
69 | #define LS1X_DAY_OFFSET (21) | ||
70 | #define LS1X_MONTH_OFFSET (26) | ||
71 | |||
72 | |||
73 | #define LS1X_SEC_MASK (0x3f) | ||
74 | #define LS1X_MIN_MASK (0x3f) | ||
75 | #define LS1X_HOUR_MASK (0x1f) | ||
76 | #define LS1X_DAY_MASK (0x1f) | ||
77 | #define LS1X_MONTH_MASK (0x3f) | ||
78 | #define LS1X_YEAR_MASK (0xffffffff) | ||
79 | |||
80 | #define ls1x_get_sec(t) (((t) >> LS1X_SEC_OFFSET) & LS1X_SEC_MASK) | ||
81 | #define ls1x_get_min(t) (((t) >> LS1X_MIN_OFFSET) & LS1X_MIN_MASK) | ||
82 | #define ls1x_get_hour(t) (((t) >> LS1X_HOUR_OFFSET) & LS1X_HOUR_MASK) | ||
83 | #define ls1x_get_day(t) (((t) >> LS1X_DAY_OFFSET) & LS1X_DAY_MASK) | ||
84 | #define ls1x_get_month(t) (((t) >> LS1X_MONTH_OFFSET) & LS1X_MONTH_MASK) | ||
85 | |||
86 | #define RTC_CNTR_OK (SYS_CNTRL_E0 | SYS_CNTRL_32S) | ||
87 | |||
88 | static int ls1x_rtc_read_time(struct device *dev, struct rtc_time *rtm) | ||
89 | { | ||
90 | unsigned long v, t; | ||
91 | |||
92 | v = readl(SYS_TOYREAD0); | ||
93 | t = readl(SYS_TOYREAD1); | ||
94 | |||
95 | memset(rtm, 0, sizeof(struct rtc_time)); | ||
96 | t = mktime((t & LS1X_YEAR_MASK), ls1x_get_month(v), | ||
97 | ls1x_get_day(v), ls1x_get_hour(v), | ||
98 | ls1x_get_min(v), ls1x_get_sec(v)); | ||
99 | rtc_time_to_tm(t, rtm); | ||
100 | |||
101 | return rtc_valid_tm(rtm); | ||
102 | } | ||
103 | |||
104 | static int ls1x_rtc_set_time(struct device *dev, struct rtc_time *rtm) | ||
105 | { | ||
106 | unsigned long v, t, c; | ||
107 | int ret = -ETIMEDOUT; | ||
108 | |||
109 | v = ((rtm->tm_mon + 1) << LS1X_MONTH_OFFSET) | ||
110 | | (rtm->tm_mday << LS1X_DAY_OFFSET) | ||
111 | | (rtm->tm_hour << LS1X_HOUR_OFFSET) | ||
112 | | (rtm->tm_min << LS1X_MIN_OFFSET) | ||
113 | | (rtm->tm_sec << LS1X_SEC_OFFSET); | ||
114 | |||
115 | writel(v, SYS_TOYWRITE0); | ||
116 | c = 0x10000; | ||
117 | /* add timeout check counter, for more safe */ | ||
118 | while ((readl(SYS_COUNTER_CNTRL) & SYS_CNTRL_TS) && --c) | ||
119 | usleep_range(1000, 3000); | ||
120 | |||
121 | if (!c) { | ||
122 | dev_err(dev, "set time timeout!\n"); | ||
123 | goto err; | ||
124 | } | ||
125 | |||
126 | t = rtm->tm_year + 1900; | ||
127 | writel(t, SYS_TOYWRITE1); | ||
128 | c = 0x10000; | ||
129 | while ((readl(SYS_COUNTER_CNTRL) & SYS_CNTRL_TS) && --c) | ||
130 | usleep_range(1000, 3000); | ||
131 | |||
132 | if (!c) { | ||
133 | dev_err(dev, "set time timeout!\n"); | ||
134 | goto err; | ||
135 | } | ||
136 | return 0; | ||
137 | err: | ||
138 | return ret; | ||
139 | } | ||
140 | |||
141 | static struct rtc_class_ops ls1x_rtc_ops = { | ||
142 | .read_time = ls1x_rtc_read_time, | ||
143 | .set_time = ls1x_rtc_set_time, | ||
144 | }; | ||
145 | |||
146 | static int __devinit ls1x_rtc_probe(struct platform_device *pdev) | ||
147 | { | ||
148 | struct rtc_device *rtcdev; | ||
149 | unsigned long v; | ||
150 | int ret; | ||
151 | |||
152 | v = readl(SYS_COUNTER_CNTRL); | ||
153 | if (!(v & RTC_CNTR_OK)) { | ||
154 | dev_err(&pdev->dev, "rtc counters not working\n"); | ||
155 | ret = -ENODEV; | ||
156 | goto err; | ||
157 | } | ||
158 | ret = -ETIMEDOUT; | ||
159 | /* set to 1 HZ if needed */ | ||
160 | if (readl(SYS_TOYTRIM) != 32767) { | ||
161 | v = 0x100000; | ||
162 | while ((readl(SYS_COUNTER_CNTRL) & SYS_CNTRL_TTS) && --v) | ||
163 | usleep_range(1000, 3000); | ||
164 | |||
165 | if (!v) { | ||
166 | dev_err(&pdev->dev, "time out\n"); | ||
167 | goto err; | ||
168 | } | ||
169 | writel(32767, SYS_TOYTRIM); | ||
170 | } | ||
171 | /* this loop coundn't be endless */ | ||
172 | while (readl(SYS_COUNTER_CNTRL) & SYS_CNTRL_TTS) | ||
173 | usleep_range(1000, 3000); | ||
174 | |||
175 | rtcdev = rtc_device_register("ls1x-rtc", &pdev->dev, | ||
176 | &ls1x_rtc_ops , THIS_MODULE); | ||
177 | if (IS_ERR(rtcdev)) { | ||
178 | ret = PTR_ERR(rtcdev); | ||
179 | goto err; | ||
180 | } | ||
181 | |||
182 | platform_set_drvdata(pdev, rtcdev); | ||
183 | return 0; | ||
184 | err: | ||
185 | return ret; | ||
186 | } | ||
187 | |||
188 | static int __devexit ls1x_rtc_remove(struct platform_device *pdev) | ||
189 | { | ||
190 | struct rtc_device *rtcdev = platform_get_drvdata(pdev); | ||
191 | |||
192 | rtc_device_unregister(rtcdev); | ||
193 | platform_set_drvdata(pdev, NULL); | ||
194 | |||
195 | return 0; | ||
196 | } | ||
197 | |||
198 | static struct platform_driver ls1x_rtc_driver = { | ||
199 | .driver = { | ||
200 | .name = "ls1x-rtc", | ||
201 | .owner = THIS_MODULE, | ||
202 | }, | ||
203 | .remove = __devexit_p(ls1x_rtc_remove), | ||
204 | .probe = ls1x_rtc_probe, | ||
205 | }; | ||
206 | |||
207 | module_platform_driver(ls1x_rtc_driver); | ||
208 | |||
209 | MODULE_AUTHOR("zhao zhang <zhzhl555@gmail.com>"); | ||
210 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/rtc/rtc-m41t80.c b/drivers/rtc/rtc-m41t80.c index 64aedd8cc095..4e0f84af99a7 100644 --- a/drivers/rtc/rtc-m41t80.c +++ b/drivers/rtc/rtc-m41t80.c | |||
@@ -900,20 +900,9 @@ static struct i2c_driver m41t80_driver = { | |||
900 | .id_table = m41t80_id, | 900 | .id_table = m41t80_id, |
901 | }; | 901 | }; |
902 | 902 | ||
903 | static int __init m41t80_rtc_init(void) | 903 | module_i2c_driver(m41t80_driver); |
904 | { | ||
905 | return i2c_add_driver(&m41t80_driver); | ||
906 | } | ||
907 | |||
908 | static void __exit m41t80_rtc_exit(void) | ||
909 | { | ||
910 | i2c_del_driver(&m41t80_driver); | ||
911 | } | ||
912 | 904 | ||
913 | MODULE_AUTHOR("Alexander Bigga <ab@mycable.de>"); | 905 | MODULE_AUTHOR("Alexander Bigga <ab@mycable.de>"); |
914 | MODULE_DESCRIPTION("ST Microelectronics M41T80 series RTC I2C Client Driver"); | 906 | MODULE_DESCRIPTION("ST Microelectronics M41T80 series RTC I2C Client Driver"); |
915 | MODULE_LICENSE("GPL"); | 907 | MODULE_LICENSE("GPL"); |
916 | MODULE_VERSION(DRV_VERSION); | 908 | MODULE_VERSION(DRV_VERSION); |
917 | |||
918 | module_init(m41t80_rtc_init); | ||
919 | module_exit(m41t80_rtc_exit); | ||
diff --git a/drivers/rtc/rtc-m41t93.c b/drivers/rtc/rtc-m41t93.c index ef71132ff205..10f1c29436ec 100644 --- a/drivers/rtc/rtc-m41t93.c +++ b/drivers/rtc/rtc-m41t93.c | |||
@@ -206,17 +206,7 @@ static struct spi_driver m41t93_driver = { | |||
206 | .remove = __devexit_p(m41t93_remove), | 206 | .remove = __devexit_p(m41t93_remove), |
207 | }; | 207 | }; |
208 | 208 | ||
209 | static __init int m41t93_init(void) | 209 | module_spi_driver(m41t93_driver); |
210 | { | ||
211 | return spi_register_driver(&m41t93_driver); | ||
212 | } | ||
213 | module_init(m41t93_init); | ||
214 | |||
215 | static __exit void m41t93_exit(void) | ||
216 | { | ||
217 | spi_unregister_driver(&m41t93_driver); | ||
218 | } | ||
219 | module_exit(m41t93_exit); | ||
220 | 210 | ||
221 | MODULE_AUTHOR("Nikolaus Voss <n.voss@weinmann.de>"); | 211 | MODULE_AUTHOR("Nikolaus Voss <n.voss@weinmann.de>"); |
222 | MODULE_DESCRIPTION("Driver for ST M41T93 SPI RTC"); | 212 | MODULE_DESCRIPTION("Driver for ST M41T93 SPI RTC"); |
diff --git a/drivers/rtc/rtc-m41t94.c b/drivers/rtc/rtc-m41t94.c index 2a4721f61797..6e78193e026b 100644 --- a/drivers/rtc/rtc-m41t94.c +++ b/drivers/rtc/rtc-m41t94.c | |||
@@ -153,19 +153,7 @@ static struct spi_driver m41t94_driver = { | |||
153 | .remove = __devexit_p(m41t94_remove), | 153 | .remove = __devexit_p(m41t94_remove), |
154 | }; | 154 | }; |
155 | 155 | ||
156 | static __init int m41t94_init(void) | 156 | module_spi_driver(m41t94_driver); |
157 | { | ||
158 | return spi_register_driver(&m41t94_driver); | ||
159 | } | ||
160 | |||
161 | module_init(m41t94_init); | ||
162 | |||
163 | static __exit void m41t94_exit(void) | ||
164 | { | ||
165 | spi_unregister_driver(&m41t94_driver); | ||
166 | } | ||
167 | |||
168 | module_exit(m41t94_exit); | ||
169 | 157 | ||
170 | MODULE_AUTHOR("Kim B. Heino <Kim.Heino@bluegiga.com>"); | 158 | MODULE_AUTHOR("Kim B. Heino <Kim.Heino@bluegiga.com>"); |
171 | MODULE_DESCRIPTION("Driver for ST M41T94 SPI RTC"); | 159 | MODULE_DESCRIPTION("Driver for ST M41T94 SPI RTC"); |
diff --git a/drivers/rtc/rtc-max6900.c b/drivers/rtc/rtc-max6900.c index 486142c2637a..a00e33204b91 100644 --- a/drivers/rtc/rtc-max6900.c +++ b/drivers/rtc/rtc-max6900.c | |||
@@ -261,20 +261,9 @@ static struct i2c_driver max6900_driver = { | |||
261 | .id_table = max6900_id, | 261 | .id_table = max6900_id, |
262 | }; | 262 | }; |
263 | 263 | ||
264 | static int __init max6900_init(void) | 264 | module_i2c_driver(max6900_driver); |
265 | { | ||
266 | return i2c_add_driver(&max6900_driver); | ||
267 | } | ||
268 | |||
269 | static void __exit max6900_exit(void) | ||
270 | { | ||
271 | i2c_del_driver(&max6900_driver); | ||
272 | } | ||
273 | 265 | ||
274 | MODULE_DESCRIPTION("Maxim MAX6900 RTC driver"); | 266 | MODULE_DESCRIPTION("Maxim MAX6900 RTC driver"); |
275 | MODULE_AUTHOR("Dale Farnsworth <dale@farnsworth.org>"); | 267 | MODULE_AUTHOR("Dale Farnsworth <dale@farnsworth.org>"); |
276 | MODULE_LICENSE("GPL"); | 268 | MODULE_LICENSE("GPL"); |
277 | MODULE_VERSION(DRV_VERSION); | 269 | MODULE_VERSION(DRV_VERSION); |
278 | |||
279 | module_init(max6900_init); | ||
280 | module_exit(max6900_exit); | ||
diff --git a/drivers/rtc/rtc-max6902.c b/drivers/rtc/rtc-max6902.c index 1f6b3cc58e8a..36c74d22e8b5 100644 --- a/drivers/rtc/rtc-max6902.c +++ b/drivers/rtc/rtc-max6902.c | |||
@@ -160,17 +160,7 @@ static struct spi_driver max6902_driver = { | |||
160 | .remove = __devexit_p(max6902_remove), | 160 | .remove = __devexit_p(max6902_remove), |
161 | }; | 161 | }; |
162 | 162 | ||
163 | static __init int max6902_init(void) | 163 | module_spi_driver(max6902_driver); |
164 | { | ||
165 | return spi_register_driver(&max6902_driver); | ||
166 | } | ||
167 | module_init(max6902_init); | ||
168 | |||
169 | static __exit void max6902_exit(void) | ||
170 | { | ||
171 | spi_unregister_driver(&max6902_driver); | ||
172 | } | ||
173 | module_exit(max6902_exit); | ||
174 | 164 | ||
175 | MODULE_DESCRIPTION ("max6902 spi RTC driver"); | 165 | MODULE_DESCRIPTION ("max6902 spi RTC driver"); |
176 | MODULE_AUTHOR ("Raphael Assenat"); | 166 | MODULE_AUTHOR ("Raphael Assenat"); |
diff --git a/drivers/rtc/rtc-max8925.c b/drivers/rtc/rtc-max8925.c index 2d71943bc436..1459055a83aa 100644 --- a/drivers/rtc/rtc-max8925.c +++ b/drivers/rtc/rtc-max8925.c | |||
@@ -193,10 +193,17 @@ static int max8925_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alrm) | |||
193 | ret = max8925_reg_read(info->rtc, MAX8925_RTC_IRQ_MASK); | 193 | ret = max8925_reg_read(info->rtc, MAX8925_RTC_IRQ_MASK); |
194 | if (ret < 0) | 194 | if (ret < 0) |
195 | goto out; | 195 | goto out; |
196 | if ((ret & ALARM0_IRQ) == 0) | 196 | if (ret & ALARM0_IRQ) { |
197 | alrm->enabled = 1; | ||
198 | else | ||
199 | alrm->enabled = 0; | 197 | alrm->enabled = 0; |
198 | } else { | ||
199 | ret = max8925_reg_read(info->rtc, MAX8925_ALARM0_CNTL); | ||
200 | if (ret < 0) | ||
201 | goto out; | ||
202 | if (!ret) | ||
203 | alrm->enabled = 0; | ||
204 | else | ||
205 | alrm->enabled = 1; | ||
206 | } | ||
200 | ret = max8925_reg_read(info->rtc, MAX8925_RTC_STATUS); | 207 | ret = max8925_reg_read(info->rtc, MAX8925_RTC_STATUS); |
201 | if (ret < 0) | 208 | if (ret < 0) |
202 | goto out; | 209 | goto out; |
@@ -204,6 +211,7 @@ static int max8925_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alrm) | |||
204 | alrm->pending = 1; | 211 | alrm->pending = 1; |
205 | else | 212 | else |
206 | alrm->pending = 0; | 213 | alrm->pending = 0; |
214 | return 0; | ||
207 | out: | 215 | out: |
208 | return ret; | 216 | return ret; |
209 | } | 217 | } |
@@ -220,8 +228,11 @@ static int max8925_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alrm) | |||
220 | ret = max8925_bulk_write(info->rtc, MAX8925_ALARM0_SEC, TIME_NUM, buf); | 228 | ret = max8925_bulk_write(info->rtc, MAX8925_ALARM0_SEC, TIME_NUM, buf); |
221 | if (ret < 0) | 229 | if (ret < 0) |
222 | goto out; | 230 | goto out; |
223 | /* only enable alarm on year/month/day/hour/min/sec */ | 231 | if (alrm->enabled) |
224 | ret = max8925_reg_write(info->rtc, MAX8925_ALARM0_CNTL, 0x77); | 232 | /* only enable alarm on year/month/day/hour/min/sec */ |
233 | ret = max8925_reg_write(info->rtc, MAX8925_ALARM0_CNTL, 0x77); | ||
234 | else | ||
235 | ret = max8925_reg_write(info->rtc, MAX8925_ALARM0_CNTL, 0x0); | ||
225 | if (ret < 0) | 236 | if (ret < 0) |
226 | goto out; | 237 | goto out; |
227 | out: | 238 | out: |
diff --git a/drivers/rtc/rtc-mpc5121.c b/drivers/rtc/rtc-mpc5121.c index 9d3caccfc250..e954a759ba85 100644 --- a/drivers/rtc/rtc-mpc5121.c +++ b/drivers/rtc/rtc-mpc5121.c | |||
@@ -327,7 +327,7 @@ static int __devinit mpc5121_rtc_probe(struct platform_device *op) | |||
327 | dev_set_drvdata(&op->dev, rtc); | 327 | dev_set_drvdata(&op->dev, rtc); |
328 | 328 | ||
329 | rtc->irq = irq_of_parse_and_map(op->dev.of_node, 1); | 329 | rtc->irq = irq_of_parse_and_map(op->dev.of_node, 1); |
330 | err = request_irq(rtc->irq, mpc5121_rtc_handler, IRQF_DISABLED, | 330 | err = request_irq(rtc->irq, mpc5121_rtc_handler, 0, |
331 | "mpc5121-rtc", &op->dev); | 331 | "mpc5121-rtc", &op->dev); |
332 | if (err) { | 332 | if (err) { |
333 | dev_err(&op->dev, "%s: could not request irq: %i\n", | 333 | dev_err(&op->dev, "%s: could not request irq: %i\n", |
@@ -337,7 +337,7 @@ static int __devinit mpc5121_rtc_probe(struct platform_device *op) | |||
337 | 337 | ||
338 | rtc->irq_periodic = irq_of_parse_and_map(op->dev.of_node, 0); | 338 | rtc->irq_periodic = irq_of_parse_and_map(op->dev.of_node, 0); |
339 | err = request_irq(rtc->irq_periodic, mpc5121_rtc_handler_upd, | 339 | err = request_irq(rtc->irq_periodic, mpc5121_rtc_handler_upd, |
340 | IRQF_DISABLED, "mpc5121-rtc_upd", &op->dev); | 340 | 0, "mpc5121-rtc_upd", &op->dev); |
341 | if (err) { | 341 | if (err) { |
342 | dev_err(&op->dev, "%s: could not request irq: %i\n", | 342 | dev_err(&op->dev, "%s: could not request irq: %i\n", |
343 | __func__, rtc->irq_periodic); | 343 | __func__, rtc->irq_periodic); |
diff --git a/drivers/rtc/rtc-mrst.c b/drivers/rtc/rtc-mrst.c index 6cd6c7235344..f51719bf4a75 100644 --- a/drivers/rtc/rtc-mrst.c +++ b/drivers/rtc/rtc-mrst.c | |||
@@ -366,7 +366,7 @@ vrtc_mrst_do_probe(struct device *dev, struct resource *iomem, int rtc_irq) | |||
366 | 366 | ||
367 | if (rtc_irq) { | 367 | if (rtc_irq) { |
368 | retval = request_irq(rtc_irq, mrst_rtc_irq, | 368 | retval = request_irq(rtc_irq, mrst_rtc_irq, |
369 | IRQF_DISABLED, dev_name(&mrst_rtc.rtc->dev), | 369 | 0, dev_name(&mrst_rtc.rtc->dev), |
370 | mrst_rtc.rtc); | 370 | mrst_rtc.rtc); |
371 | if (retval < 0) { | 371 | if (retval < 0) { |
372 | dev_dbg(dev, "IRQ %d is already in use, err %d\n", | 372 | dev_dbg(dev, "IRQ %d is already in use, err %d\n", |
diff --git a/drivers/rtc/rtc-mv.c b/drivers/rtc/rtc-mv.c index 768e2edb9678..1300962486d1 100644 --- a/drivers/rtc/rtc-mv.c +++ b/drivers/rtc/rtc-mv.c | |||
@@ -273,7 +273,7 @@ static int __devinit mv_rtc_probe(struct platform_device *pdev) | |||
273 | if (pdata->irq >= 0) { | 273 | if (pdata->irq >= 0) { |
274 | writel(0, pdata->ioaddr + RTC_ALARM_INTERRUPT_MASK_REG_OFFS); | 274 | writel(0, pdata->ioaddr + RTC_ALARM_INTERRUPT_MASK_REG_OFFS); |
275 | if (devm_request_irq(&pdev->dev, pdata->irq, mv_rtc_interrupt, | 275 | if (devm_request_irq(&pdev->dev, pdata->irq, mv_rtc_interrupt, |
276 | IRQF_DISABLED | IRQF_SHARED, | 276 | IRQF_SHARED, |
277 | pdev->name, pdata) < 0) { | 277 | pdev->name, pdata) < 0) { |
278 | dev_warn(&pdev->dev, "interrupt not available.\n"); | 278 | dev_warn(&pdev->dev, "interrupt not available.\n"); |
279 | pdata->irq = -1; | 279 | pdata->irq = -1; |
diff --git a/drivers/rtc/rtc-nuc900.c b/drivers/rtc/rtc-nuc900.c index 781068d62f23..b79010987d1e 100644 --- a/drivers/rtc/rtc-nuc900.c +++ b/drivers/rtc/rtc-nuc900.c | |||
@@ -269,7 +269,7 @@ static int __devinit nuc900_rtc_probe(struct platform_device *pdev) | |||
269 | 269 | ||
270 | nuc900_rtc->irq_num = platform_get_irq(pdev, 0); | 270 | nuc900_rtc->irq_num = platform_get_irq(pdev, 0); |
271 | if (request_irq(nuc900_rtc->irq_num, nuc900_rtc_interrupt, | 271 | if (request_irq(nuc900_rtc->irq_num, nuc900_rtc_interrupt, |
272 | IRQF_DISABLED, "nuc900rtc", nuc900_rtc)) { | 272 | 0, "nuc900rtc", nuc900_rtc)) { |
273 | dev_err(&pdev->dev, "NUC900 RTC request irq failed\n"); | 273 | dev_err(&pdev->dev, "NUC900 RTC request irq failed\n"); |
274 | err = -EBUSY; | 274 | err = -EBUSY; |
275 | goto fail4; | 275 | goto fail4; |
diff --git a/drivers/rtc/rtc-omap.c b/drivers/rtc/rtc-omap.c index 7789002bdd5c..0b614e32653d 100644 --- a/drivers/rtc/rtc-omap.c +++ b/drivers/rtc/rtc-omap.c | |||
@@ -348,14 +348,14 @@ static int __init omap_rtc_probe(struct platform_device *pdev) | |||
348 | rtc_write(OMAP_RTC_STATUS_ALARM, OMAP_RTC_STATUS_REG); | 348 | rtc_write(OMAP_RTC_STATUS_ALARM, OMAP_RTC_STATUS_REG); |
349 | 349 | ||
350 | /* handle periodic and alarm irqs */ | 350 | /* handle periodic and alarm irqs */ |
351 | if (request_irq(omap_rtc_timer, rtc_irq, IRQF_DISABLED, | 351 | if (request_irq(omap_rtc_timer, rtc_irq, 0, |
352 | dev_name(&rtc->dev), rtc)) { | 352 | dev_name(&rtc->dev), rtc)) { |
353 | pr_debug("%s: RTC timer interrupt IRQ%d already claimed\n", | 353 | pr_debug("%s: RTC timer interrupt IRQ%d already claimed\n", |
354 | pdev->name, omap_rtc_timer); | 354 | pdev->name, omap_rtc_timer); |
355 | goto fail1; | 355 | goto fail1; |
356 | } | 356 | } |
357 | if ((omap_rtc_timer != omap_rtc_alarm) && | 357 | if ((omap_rtc_timer != omap_rtc_alarm) && |
358 | (request_irq(omap_rtc_alarm, rtc_irq, IRQF_DISABLED, | 358 | (request_irq(omap_rtc_alarm, rtc_irq, 0, |
359 | dev_name(&rtc->dev), rtc))) { | 359 | dev_name(&rtc->dev), rtc))) { |
360 | pr_debug("%s: RTC alarm interrupt IRQ%d already claimed\n", | 360 | pr_debug("%s: RTC alarm interrupt IRQ%d already claimed\n", |
361 | pdev->name, omap_rtc_alarm); | 361 | pdev->name, omap_rtc_alarm); |
diff --git a/drivers/rtc/rtc-pcf2123.c b/drivers/rtc/rtc-pcf2123.c index b46c4004d8fe..836118795c0b 100644 --- a/drivers/rtc/rtc-pcf2123.c +++ b/drivers/rtc/rtc-pcf2123.c | |||
@@ -346,20 +346,9 @@ static struct spi_driver pcf2123_driver = { | |||
346 | .remove = __devexit_p(pcf2123_remove), | 346 | .remove = __devexit_p(pcf2123_remove), |
347 | }; | 347 | }; |
348 | 348 | ||
349 | static int __init pcf2123_init(void) | 349 | module_spi_driver(pcf2123_driver); |
350 | { | ||
351 | return spi_register_driver(&pcf2123_driver); | ||
352 | } | ||
353 | |||
354 | static void __exit pcf2123_exit(void) | ||
355 | { | ||
356 | spi_unregister_driver(&pcf2123_driver); | ||
357 | } | ||
358 | 350 | ||
359 | MODULE_AUTHOR("Chris Verges <chrisv@cyberswitching.com>"); | 351 | MODULE_AUTHOR("Chris Verges <chrisv@cyberswitching.com>"); |
360 | MODULE_DESCRIPTION("NXP PCF2123 RTC driver"); | 352 | MODULE_DESCRIPTION("NXP PCF2123 RTC driver"); |
361 | MODULE_LICENSE("GPL"); | 353 | MODULE_LICENSE("GPL"); |
362 | MODULE_VERSION(DRV_VERSION); | 354 | MODULE_VERSION(DRV_VERSION); |
363 | |||
364 | module_init(pcf2123_init); | ||
365 | module_exit(pcf2123_exit); | ||
diff --git a/drivers/rtc/rtc-pcf8563.c b/drivers/rtc/rtc-pcf8563.c index 606fdfab34e2..bc0677de1996 100644 --- a/drivers/rtc/rtc-pcf8563.c +++ b/drivers/rtc/rtc-pcf8563.c | |||
@@ -252,20 +252,9 @@ static struct i2c_driver pcf8563_driver = { | |||
252 | .id_table = pcf8563_id, | 252 | .id_table = pcf8563_id, |
253 | }; | 253 | }; |
254 | 254 | ||
255 | static int __init pcf8563_init(void) | 255 | module_i2c_driver(pcf8563_driver); |
256 | { | ||
257 | return i2c_add_driver(&pcf8563_driver); | ||
258 | } | ||
259 | |||
260 | static void __exit pcf8563_exit(void) | ||
261 | { | ||
262 | i2c_del_driver(&pcf8563_driver); | ||
263 | } | ||
264 | 256 | ||
265 | MODULE_AUTHOR("Alessandro Zummo <a.zummo@towertech.it>"); | 257 | MODULE_AUTHOR("Alessandro Zummo <a.zummo@towertech.it>"); |
266 | MODULE_DESCRIPTION("Philips PCF8563/Epson RTC8564 RTC driver"); | 258 | MODULE_DESCRIPTION("Philips PCF8563/Epson RTC8564 RTC driver"); |
267 | MODULE_LICENSE("GPL"); | 259 | MODULE_LICENSE("GPL"); |
268 | MODULE_VERSION(DRV_VERSION); | 260 | MODULE_VERSION(DRV_VERSION); |
269 | |||
270 | module_init(pcf8563_init); | ||
271 | module_exit(pcf8563_exit); | ||
diff --git a/drivers/rtc/rtc-pcf8583.c b/drivers/rtc/rtc-pcf8583.c index 2d201afead3b..019ff3571168 100644 --- a/drivers/rtc/rtc-pcf8583.c +++ b/drivers/rtc/rtc-pcf8583.c | |||
@@ -320,18 +320,7 @@ static struct i2c_driver pcf8583_driver = { | |||
320 | .id_table = pcf8583_id, | 320 | .id_table = pcf8583_id, |
321 | }; | 321 | }; |
322 | 322 | ||
323 | static __init int pcf8583_init(void) | 323 | module_i2c_driver(pcf8583_driver); |
324 | { | ||
325 | return i2c_add_driver(&pcf8583_driver); | ||
326 | } | ||
327 | |||
328 | static __exit void pcf8583_exit(void) | ||
329 | { | ||
330 | i2c_del_driver(&pcf8583_driver); | ||
331 | } | ||
332 | |||
333 | module_init(pcf8583_init); | ||
334 | module_exit(pcf8583_exit); | ||
335 | 324 | ||
336 | MODULE_AUTHOR("Russell King"); | 325 | MODULE_AUTHOR("Russell King"); |
337 | MODULE_DESCRIPTION("PCF8583 I2C RTC driver"); | 326 | MODULE_DESCRIPTION("PCF8583 I2C RTC driver"); |
diff --git a/drivers/rtc/rtc-pl030.c b/drivers/rtc/rtc-pl030.c index 02111fee077e..a4a1e534ed42 100644 --- a/drivers/rtc/rtc-pl030.c +++ b/drivers/rtc/rtc-pl030.c | |||
@@ -123,7 +123,7 @@ static int pl030_probe(struct amba_device *dev, const struct amba_id *id) | |||
123 | 123 | ||
124 | amba_set_drvdata(dev, rtc); | 124 | amba_set_drvdata(dev, rtc); |
125 | 125 | ||
126 | ret = request_irq(dev->irq[0], pl030_interrupt, IRQF_DISABLED, | 126 | ret = request_irq(dev->irq[0], pl030_interrupt, 0, |
127 | "rtc-pl030", rtc); | 127 | "rtc-pl030", rtc); |
128 | if (ret) | 128 | if (ret) |
129 | goto err_irq; | 129 | goto err_irq; |
diff --git a/drivers/rtc/rtc-pl031.c b/drivers/rtc/rtc-pl031.c index a952c8de1dd7..3a470e291282 100644 --- a/drivers/rtc/rtc-pl031.c +++ b/drivers/rtc/rtc-pl031.c | |||
@@ -352,7 +352,7 @@ static int pl031_probe(struct amba_device *adev, const struct amba_id *id) | |||
352 | } | 352 | } |
353 | 353 | ||
354 | if (request_irq(adev->irq[0], pl031_interrupt, | 354 | if (request_irq(adev->irq[0], pl031_interrupt, |
355 | IRQF_DISABLED, "rtc-pl031", ldata)) { | 355 | 0, "rtc-pl031", ldata)) { |
356 | ret = -EIO; | 356 | ret = -EIO; |
357 | goto out_no_irq; | 357 | goto out_no_irq; |
358 | } | 358 | } |
diff --git a/drivers/rtc/rtc-pm8xxx.c b/drivers/rtc/rtc-pm8xxx.c index 9f1d6bcbdf6c..d00bd24342a3 100644 --- a/drivers/rtc/rtc-pm8xxx.c +++ b/drivers/rtc/rtc-pm8xxx.c | |||
@@ -520,7 +520,7 @@ static int pm8xxx_rtc_suspend(struct device *dev) | |||
520 | } | 520 | } |
521 | #endif | 521 | #endif |
522 | 522 | ||
523 | SIMPLE_DEV_PM_OPS(pm8xxx_rtc_pm_ops, pm8xxx_rtc_suspend, pm8xxx_rtc_resume); | 523 | static SIMPLE_DEV_PM_OPS(pm8xxx_rtc_pm_ops, pm8xxx_rtc_suspend, pm8xxx_rtc_resume); |
524 | 524 | ||
525 | static struct platform_driver pm8xxx_rtc_driver = { | 525 | static struct platform_driver pm8xxx_rtc_driver = { |
526 | .probe = pm8xxx_rtc_probe, | 526 | .probe = pm8xxx_rtc_probe, |
diff --git a/drivers/rtc/rtc-pxa.c b/drivers/rtc/rtc-pxa.c index fc9f4991574b..0075c8fd93d8 100644 --- a/drivers/rtc/rtc-pxa.c +++ b/drivers/rtc/rtc-pxa.c | |||
@@ -174,14 +174,14 @@ static int pxa_rtc_open(struct device *dev) | |||
174 | struct pxa_rtc *pxa_rtc = dev_get_drvdata(dev); | 174 | struct pxa_rtc *pxa_rtc = dev_get_drvdata(dev); |
175 | int ret; | 175 | int ret; |
176 | 176 | ||
177 | ret = request_irq(pxa_rtc->irq_1Hz, pxa_rtc_irq, IRQF_DISABLED, | 177 | ret = request_irq(pxa_rtc->irq_1Hz, pxa_rtc_irq, 0, |
178 | "rtc 1Hz", dev); | 178 | "rtc 1Hz", dev); |
179 | if (ret < 0) { | 179 | if (ret < 0) { |
180 | dev_err(dev, "can't get irq %i, err %d\n", pxa_rtc->irq_1Hz, | 180 | dev_err(dev, "can't get irq %i, err %d\n", pxa_rtc->irq_1Hz, |
181 | ret); | 181 | ret); |
182 | goto err_irq_1Hz; | 182 | goto err_irq_1Hz; |
183 | } | 183 | } |
184 | ret = request_irq(pxa_rtc->irq_Alrm, pxa_rtc_irq, IRQF_DISABLED, | 184 | ret = request_irq(pxa_rtc->irq_Alrm, pxa_rtc_irq, 0, |
185 | "rtc Alrm", dev); | 185 | "rtc Alrm", dev); |
186 | if (ret < 0) { | 186 | if (ret < 0) { |
187 | dev_err(dev, "can't get irq %i, err %d\n", pxa_rtc->irq_Alrm, | 187 | dev_err(dev, "can't get irq %i, err %d\n", pxa_rtc->irq_Alrm, |
diff --git a/drivers/rtc/rtc-r9701.c b/drivers/rtc/rtc-r9701.c index 2853c2a6f10f..7f8e6c247935 100644 --- a/drivers/rtc/rtc-r9701.c +++ b/drivers/rtc/rtc-r9701.c | |||
@@ -159,17 +159,7 @@ static struct spi_driver r9701_driver = { | |||
159 | .remove = __devexit_p(r9701_remove), | 159 | .remove = __devexit_p(r9701_remove), |
160 | }; | 160 | }; |
161 | 161 | ||
162 | static __init int r9701_init(void) | 162 | module_spi_driver(r9701_driver); |
163 | { | ||
164 | return spi_register_driver(&r9701_driver); | ||
165 | } | ||
166 | module_init(r9701_init); | ||
167 | |||
168 | static __exit void r9701_exit(void) | ||
169 | { | ||
170 | spi_unregister_driver(&r9701_driver); | ||
171 | } | ||
172 | module_exit(r9701_exit); | ||
173 | 163 | ||
174 | MODULE_DESCRIPTION("r9701 spi RTC driver"); | 164 | MODULE_DESCRIPTION("r9701 spi RTC driver"); |
175 | MODULE_AUTHOR("Magnus Damm <damm@opensource.se>"); | 165 | MODULE_AUTHOR("Magnus Damm <damm@opensource.se>"); |
diff --git a/drivers/rtc/rtc-rs5c348.c b/drivers/rtc/rtc-rs5c348.c index ce2ca8523ddd..77074ccd2850 100644 --- a/drivers/rtc/rtc-rs5c348.c +++ b/drivers/rtc/rtc-rs5c348.c | |||
@@ -235,18 +235,7 @@ static struct spi_driver rs5c348_driver = { | |||
235 | .remove = __devexit_p(rs5c348_remove), | 235 | .remove = __devexit_p(rs5c348_remove), |
236 | }; | 236 | }; |
237 | 237 | ||
238 | static __init int rs5c348_init(void) | 238 | module_spi_driver(rs5c348_driver); |
239 | { | ||
240 | return spi_register_driver(&rs5c348_driver); | ||
241 | } | ||
242 | |||
243 | static __exit void rs5c348_exit(void) | ||
244 | { | ||
245 | spi_unregister_driver(&rs5c348_driver); | ||
246 | } | ||
247 | |||
248 | module_init(rs5c348_init); | ||
249 | module_exit(rs5c348_exit); | ||
250 | 239 | ||
251 | MODULE_AUTHOR("Atsushi Nemoto <anemo@mba.ocn.ne.jp>"); | 240 | MODULE_AUTHOR("Atsushi Nemoto <anemo@mba.ocn.ne.jp>"); |
252 | MODULE_DESCRIPTION("Ricoh RS5C348 RTC driver"); | 241 | MODULE_DESCRIPTION("Ricoh RS5C348 RTC driver"); |
diff --git a/drivers/rtc/rtc-rs5c372.c b/drivers/rtc/rtc-rs5c372.c index d29f5432c6e8..fb4842c3544e 100644 --- a/drivers/rtc/rtc-rs5c372.c +++ b/drivers/rtc/rtc-rs5c372.c | |||
@@ -689,18 +689,7 @@ static struct i2c_driver rs5c372_driver = { | |||
689 | .id_table = rs5c372_id, | 689 | .id_table = rs5c372_id, |
690 | }; | 690 | }; |
691 | 691 | ||
692 | static __init int rs5c372_init(void) | 692 | module_i2c_driver(rs5c372_driver); |
693 | { | ||
694 | return i2c_add_driver(&rs5c372_driver); | ||
695 | } | ||
696 | |||
697 | static __exit void rs5c372_exit(void) | ||
698 | { | ||
699 | i2c_del_driver(&rs5c372_driver); | ||
700 | } | ||
701 | |||
702 | module_init(rs5c372_init); | ||
703 | module_exit(rs5c372_exit); | ||
704 | 693 | ||
705 | MODULE_AUTHOR( | 694 | MODULE_AUTHOR( |
706 | "Pavel Mironchik <pmironchik@optifacio.net>, " | 695 | "Pavel Mironchik <pmironchik@optifacio.net>, " |
diff --git a/drivers/rtc/rtc-rv3029c2.c b/drivers/rtc/rtc-rv3029c2.c index ea09ff211dc6..0fbe57b2f6d2 100644 --- a/drivers/rtc/rtc-rv3029c2.c +++ b/drivers/rtc/rtc-rv3029c2.c | |||
@@ -436,18 +436,7 @@ static struct i2c_driver rv3029c2_driver = { | |||
436 | .id_table = rv3029c2_id, | 436 | .id_table = rv3029c2_id, |
437 | }; | 437 | }; |
438 | 438 | ||
439 | static int __init rv3029c2_init(void) | 439 | module_i2c_driver(rv3029c2_driver); |
440 | { | ||
441 | return i2c_add_driver(&rv3029c2_driver); | ||
442 | } | ||
443 | |||
444 | static void __exit rv3029c2_exit(void) | ||
445 | { | ||
446 | i2c_del_driver(&rv3029c2_driver); | ||
447 | } | ||
448 | |||
449 | module_init(rv3029c2_init); | ||
450 | module_exit(rv3029c2_exit); | ||
451 | 440 | ||
452 | MODULE_AUTHOR("Gregory Hermant <gregory.hermant@calao-systems.com>"); | 441 | MODULE_AUTHOR("Gregory Hermant <gregory.hermant@calao-systems.com>"); |
453 | MODULE_DESCRIPTION("Micro Crystal RV3029C2 RTC driver"); | 442 | MODULE_DESCRIPTION("Micro Crystal RV3029C2 RTC driver"); |
diff --git a/drivers/rtc/rtc-rx8025.c b/drivers/rtc/rtc-rx8025.c index fde172fb2abe..0de902dc1cd5 100644 --- a/drivers/rtc/rtc-rx8025.c +++ b/drivers/rtc/rtc-rx8025.c | |||
@@ -644,19 +644,8 @@ static struct i2c_driver rx8025_driver = { | |||
644 | .id_table = rx8025_id, | 644 | .id_table = rx8025_id, |
645 | }; | 645 | }; |
646 | 646 | ||
647 | static int __init rx8025_init(void) | 647 | module_i2c_driver(rx8025_driver); |
648 | { | ||
649 | return i2c_add_driver(&rx8025_driver); | ||
650 | } | ||
651 | |||
652 | static void __exit rx8025_exit(void) | ||
653 | { | ||
654 | i2c_del_driver(&rx8025_driver); | ||
655 | } | ||
656 | 648 | ||
657 | MODULE_AUTHOR("Wolfgang Grandegger <wg@grandegger.com>"); | 649 | MODULE_AUTHOR("Wolfgang Grandegger <wg@grandegger.com>"); |
658 | MODULE_DESCRIPTION("RX-8025 SA/NB RTC driver"); | 650 | MODULE_DESCRIPTION("RX-8025 SA/NB RTC driver"); |
659 | MODULE_LICENSE("GPL"); | 651 | MODULE_LICENSE("GPL"); |
660 | |||
661 | module_init(rx8025_init); | ||
662 | module_exit(rx8025_exit); | ||
diff --git a/drivers/rtc/rtc-rx8581.c b/drivers/rtc/rtc-rx8581.c index 600b890a3c15..d84825124a7a 100644 --- a/drivers/rtc/rtc-rx8581.c +++ b/drivers/rtc/rtc-rx8581.c | |||
@@ -276,20 +276,9 @@ static struct i2c_driver rx8581_driver = { | |||
276 | .id_table = rx8581_id, | 276 | .id_table = rx8581_id, |
277 | }; | 277 | }; |
278 | 278 | ||
279 | static int __init rx8581_init(void) | 279 | module_i2c_driver(rx8581_driver); |
280 | { | ||
281 | return i2c_add_driver(&rx8581_driver); | ||
282 | } | ||
283 | |||
284 | static void __exit rx8581_exit(void) | ||
285 | { | ||
286 | i2c_del_driver(&rx8581_driver); | ||
287 | } | ||
288 | 280 | ||
289 | MODULE_AUTHOR("Martyn Welch <martyn.welch@ge.com>"); | 281 | MODULE_AUTHOR("Martyn Welch <martyn.welch@ge.com>"); |
290 | MODULE_DESCRIPTION("Epson RX-8581 RTC driver"); | 282 | MODULE_DESCRIPTION("Epson RX-8581 RTC driver"); |
291 | MODULE_LICENSE("GPL"); | 283 | MODULE_LICENSE("GPL"); |
292 | MODULE_VERSION(DRV_VERSION); | 284 | MODULE_VERSION(DRV_VERSION); |
293 | |||
294 | module_init(rx8581_init); | ||
295 | module_exit(rx8581_exit); | ||
diff --git a/drivers/rtc/rtc-s35390a.c b/drivers/rtc/rtc-s35390a.c index f789e002c9b0..c9562ceedef3 100644 --- a/drivers/rtc/rtc-s35390a.c +++ b/drivers/rtc/rtc-s35390a.c | |||
@@ -304,19 +304,8 @@ static struct i2c_driver s35390a_driver = { | |||
304 | .id_table = s35390a_id, | 304 | .id_table = s35390a_id, |
305 | }; | 305 | }; |
306 | 306 | ||
307 | static int __init s35390a_rtc_init(void) | 307 | module_i2c_driver(s35390a_driver); |
308 | { | ||
309 | return i2c_add_driver(&s35390a_driver); | ||
310 | } | ||
311 | |||
312 | static void __exit s35390a_rtc_exit(void) | ||
313 | { | ||
314 | i2c_del_driver(&s35390a_driver); | ||
315 | } | ||
316 | 308 | ||
317 | MODULE_AUTHOR("Byron Bradley <byron.bbradley@gmail.com>"); | 309 | MODULE_AUTHOR("Byron Bradley <byron.bbradley@gmail.com>"); |
318 | MODULE_DESCRIPTION("S35390A RTC driver"); | 310 | MODULE_DESCRIPTION("S35390A RTC driver"); |
319 | MODULE_LICENSE("GPL"); | 311 | MODULE_LICENSE("GPL"); |
320 | |||
321 | module_init(s35390a_rtc_init); | ||
322 | module_exit(s35390a_rtc_exit); | ||
diff --git a/drivers/rtc/rtc-s3c.c b/drivers/rtc/rtc-s3c.c index aef40bd2957b..c543f6f1eec2 100644 --- a/drivers/rtc/rtc-s3c.c +++ b/drivers/rtc/rtc-s3c.c | |||
@@ -543,14 +543,14 @@ static int __devinit s3c_rtc_probe(struct platform_device *pdev) | |||
543 | s3c_rtc_setfreq(&pdev->dev, 1); | 543 | s3c_rtc_setfreq(&pdev->dev, 1); |
544 | 544 | ||
545 | ret = request_irq(s3c_rtc_alarmno, s3c_rtc_alarmirq, | 545 | ret = request_irq(s3c_rtc_alarmno, s3c_rtc_alarmirq, |
546 | IRQF_DISABLED, "s3c2410-rtc alarm", rtc); | 546 | 0, "s3c2410-rtc alarm", rtc); |
547 | if (ret) { | 547 | if (ret) { |
548 | dev_err(&pdev->dev, "IRQ%d error %d\n", s3c_rtc_alarmno, ret); | 548 | dev_err(&pdev->dev, "IRQ%d error %d\n", s3c_rtc_alarmno, ret); |
549 | goto err_alarm_irq; | 549 | goto err_alarm_irq; |
550 | } | 550 | } |
551 | 551 | ||
552 | ret = request_irq(s3c_rtc_tickno, s3c_rtc_tickirq, | 552 | ret = request_irq(s3c_rtc_tickno, s3c_rtc_tickirq, |
553 | IRQF_DISABLED, "s3c2410-rtc tick", rtc); | 553 | 0, "s3c2410-rtc tick", rtc); |
554 | if (ret) { | 554 | if (ret) { |
555 | dev_err(&pdev->dev, "IRQ%d error %d\n", s3c_rtc_tickno, ret); | 555 | dev_err(&pdev->dev, "IRQ%d error %d\n", s3c_rtc_tickno, ret); |
556 | free_irq(s3c_rtc_alarmno, rtc); | 556 | free_irq(s3c_rtc_alarmno, rtc); |
diff --git a/drivers/rtc/rtc-sa1100.c b/drivers/rtc/rtc-sa1100.c index cb9a585312cc..fb758db9d0f4 100644 --- a/drivers/rtc/rtc-sa1100.c +++ b/drivers/rtc/rtc-sa1100.c | |||
@@ -160,14 +160,13 @@ static int sa1100_rtc_open(struct device *dev) | |||
160 | struct platform_device *plat_dev = to_platform_device(dev); | 160 | struct platform_device *plat_dev = to_platform_device(dev); |
161 | struct rtc_device *rtc = platform_get_drvdata(plat_dev); | 161 | struct rtc_device *rtc = platform_get_drvdata(plat_dev); |
162 | 162 | ||
163 | ret = request_irq(IRQ_RTC1Hz, sa1100_rtc_interrupt, IRQF_DISABLED, | 163 | ret = request_irq(IRQ_RTC1Hz, sa1100_rtc_interrupt, 0, "rtc 1Hz", dev); |
164 | "rtc 1Hz", dev); | ||
165 | if (ret) { | 164 | if (ret) { |
166 | dev_err(dev, "IRQ %d already in use.\n", IRQ_RTC1Hz); | 165 | dev_err(dev, "IRQ %d already in use.\n", IRQ_RTC1Hz); |
167 | goto fail_ui; | 166 | goto fail_ui; |
168 | } | 167 | } |
169 | ret = request_irq(IRQ_RTCAlrm, sa1100_rtc_interrupt, IRQF_DISABLED, | 168 | ret = request_irq(IRQ_RTCAlrm, sa1100_rtc_interrupt, 0, |
170 | "rtc Alrm", dev); | 169 | "rtc Alrm", dev); |
171 | if (ret) { | 170 | if (ret) { |
172 | dev_err(dev, "IRQ %d already in use.\n", IRQ_RTCAlrm); | 171 | dev_err(dev, "IRQ %d already in use.\n", IRQ_RTCAlrm); |
173 | goto fail_ai; | 172 | goto fail_ai; |
diff --git a/drivers/rtc/rtc-sh.c b/drivers/rtc/rtc-sh.c index 6ac55fd48413..e55a7635ae5f 100644 --- a/drivers/rtc/rtc-sh.c +++ b/drivers/rtc/rtc-sh.c | |||
@@ -666,7 +666,7 @@ static int __init sh_rtc_probe(struct platform_device *pdev) | |||
666 | if (rtc->carry_irq <= 0) { | 666 | if (rtc->carry_irq <= 0) { |
667 | /* register shared periodic/carry/alarm irq */ | 667 | /* register shared periodic/carry/alarm irq */ |
668 | ret = request_irq(rtc->periodic_irq, sh_rtc_shared, | 668 | ret = request_irq(rtc->periodic_irq, sh_rtc_shared, |
669 | IRQF_DISABLED, "sh-rtc", rtc); | 669 | 0, "sh-rtc", rtc); |
670 | if (unlikely(ret)) { | 670 | if (unlikely(ret)) { |
671 | dev_err(&pdev->dev, | 671 | dev_err(&pdev->dev, |
672 | "request IRQ failed with %d, IRQ %d\n", ret, | 672 | "request IRQ failed with %d, IRQ %d\n", ret, |
@@ -676,7 +676,7 @@ static int __init sh_rtc_probe(struct platform_device *pdev) | |||
676 | } else { | 676 | } else { |
677 | /* register periodic/carry/alarm irqs */ | 677 | /* register periodic/carry/alarm irqs */ |
678 | ret = request_irq(rtc->periodic_irq, sh_rtc_periodic, | 678 | ret = request_irq(rtc->periodic_irq, sh_rtc_periodic, |
679 | IRQF_DISABLED, "sh-rtc period", rtc); | 679 | 0, "sh-rtc period", rtc); |
680 | if (unlikely(ret)) { | 680 | if (unlikely(ret)) { |
681 | dev_err(&pdev->dev, | 681 | dev_err(&pdev->dev, |
682 | "request period IRQ failed with %d, IRQ %d\n", | 682 | "request period IRQ failed with %d, IRQ %d\n", |
@@ -685,7 +685,7 @@ static int __init sh_rtc_probe(struct platform_device *pdev) | |||
685 | } | 685 | } |
686 | 686 | ||
687 | ret = request_irq(rtc->carry_irq, sh_rtc_interrupt, | 687 | ret = request_irq(rtc->carry_irq, sh_rtc_interrupt, |
688 | IRQF_DISABLED, "sh-rtc carry", rtc); | 688 | 0, "sh-rtc carry", rtc); |
689 | if (unlikely(ret)) { | 689 | if (unlikely(ret)) { |
690 | dev_err(&pdev->dev, | 690 | dev_err(&pdev->dev, |
691 | "request carry IRQ failed with %d, IRQ %d\n", | 691 | "request carry IRQ failed with %d, IRQ %d\n", |
@@ -695,7 +695,7 @@ static int __init sh_rtc_probe(struct platform_device *pdev) | |||
695 | } | 695 | } |
696 | 696 | ||
697 | ret = request_irq(rtc->alarm_irq, sh_rtc_alarm, | 697 | ret = request_irq(rtc->alarm_irq, sh_rtc_alarm, |
698 | IRQF_DISABLED, "sh-rtc alarm", rtc); | 698 | 0, "sh-rtc alarm", rtc); |
699 | if (unlikely(ret)) { | 699 | if (unlikely(ret)) { |
700 | dev_err(&pdev->dev, | 700 | dev_err(&pdev->dev, |
701 | "request alarm IRQ failed with %d, IRQ %d\n", | 701 | "request alarm IRQ failed with %d, IRQ %d\n", |
diff --git a/drivers/rtc/rtc-spear.c b/drivers/rtc/rtc-spear.c index 19a28a671a8e..e38da0dc4187 100644 --- a/drivers/rtc/rtc-spear.c +++ b/drivers/rtc/rtc-spear.c | |||
@@ -77,9 +77,11 @@ | |||
77 | #define STATUS_FAIL (LOST_WR_TIME | LOST_WR_DATE) | 77 | #define STATUS_FAIL (LOST_WR_TIME | LOST_WR_DATE) |
78 | 78 | ||
79 | struct spear_rtc_config { | 79 | struct spear_rtc_config { |
80 | struct rtc_device *rtc; | ||
80 | struct clk *clk; | 81 | struct clk *clk; |
81 | spinlock_t lock; | 82 | spinlock_t lock; |
82 | void __iomem *ioaddr; | 83 | void __iomem *ioaddr; |
84 | unsigned int irq_wake; | ||
83 | }; | 85 | }; |
84 | 86 | ||
85 | static inline void spear_rtc_clear_interrupt(struct spear_rtc_config *config) | 87 | static inline void spear_rtc_clear_interrupt(struct spear_rtc_config *config) |
@@ -149,8 +151,7 @@ static void rtc_wait_not_busy(struct spear_rtc_config *config) | |||
149 | 151 | ||
150 | static irqreturn_t spear_rtc_irq(int irq, void *dev_id) | 152 | static irqreturn_t spear_rtc_irq(int irq, void *dev_id) |
151 | { | 153 | { |
152 | struct rtc_device *rtc = (struct rtc_device *)dev_id; | 154 | struct spear_rtc_config *config = dev_id; |
153 | struct spear_rtc_config *config = dev_get_drvdata(&rtc->dev); | ||
154 | unsigned long flags, events = 0; | 155 | unsigned long flags, events = 0; |
155 | unsigned int irq_data; | 156 | unsigned int irq_data; |
156 | 157 | ||
@@ -161,7 +162,7 @@ static irqreturn_t spear_rtc_irq(int irq, void *dev_id) | |||
161 | if ((irq_data & RTC_INT_MASK)) { | 162 | if ((irq_data & RTC_INT_MASK)) { |
162 | spear_rtc_clear_interrupt(config); | 163 | spear_rtc_clear_interrupt(config); |
163 | events = RTC_IRQF | RTC_AF; | 164 | events = RTC_IRQF | RTC_AF; |
164 | rtc_update_irq(rtc, 1, events); | 165 | rtc_update_irq(config->rtc, 1, events); |
165 | return IRQ_HANDLED; | 166 | return IRQ_HANDLED; |
166 | } else | 167 | } else |
167 | return IRQ_NONE; | 168 | return IRQ_NONE; |
@@ -203,9 +204,7 @@ static void bcd2tm(struct rtc_time *tm) | |||
203 | */ | 204 | */ |
204 | static int spear_rtc_read_time(struct device *dev, struct rtc_time *tm) | 205 | static int spear_rtc_read_time(struct device *dev, struct rtc_time *tm) |
205 | { | 206 | { |
206 | struct platform_device *pdev = to_platform_device(dev); | 207 | struct spear_rtc_config *config = dev_get_drvdata(dev); |
207 | struct rtc_device *rtc = platform_get_drvdata(pdev); | ||
208 | struct spear_rtc_config *config = dev_get_drvdata(&rtc->dev); | ||
209 | unsigned int time, date; | 208 | unsigned int time, date; |
210 | 209 | ||
211 | /* we don't report wday/yday/isdst ... */ | 210 | /* we don't report wday/yday/isdst ... */ |
@@ -234,9 +233,7 @@ static int spear_rtc_read_time(struct device *dev, struct rtc_time *tm) | |||
234 | */ | 233 | */ |
235 | static int spear_rtc_set_time(struct device *dev, struct rtc_time *tm) | 234 | static int spear_rtc_set_time(struct device *dev, struct rtc_time *tm) |
236 | { | 235 | { |
237 | struct platform_device *pdev = to_platform_device(dev); | 236 | struct spear_rtc_config *config = dev_get_drvdata(dev); |
238 | struct rtc_device *rtc = platform_get_drvdata(pdev); | ||
239 | struct spear_rtc_config *config = dev_get_drvdata(&rtc->dev); | ||
240 | unsigned int time, date, err = 0; | 237 | unsigned int time, date, err = 0; |
241 | 238 | ||
242 | if (tm2bcd(tm) < 0) | 239 | if (tm2bcd(tm) < 0) |
@@ -266,9 +263,7 @@ static int spear_rtc_set_time(struct device *dev, struct rtc_time *tm) | |||
266 | */ | 263 | */ |
267 | static int spear_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alm) | 264 | static int spear_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alm) |
268 | { | 265 | { |
269 | struct platform_device *pdev = to_platform_device(dev); | 266 | struct spear_rtc_config *config = dev_get_drvdata(dev); |
270 | struct rtc_device *rtc = platform_get_drvdata(pdev); | ||
271 | struct spear_rtc_config *config = dev_get_drvdata(&rtc->dev); | ||
272 | unsigned int time, date; | 267 | unsigned int time, date; |
273 | 268 | ||
274 | rtc_wait_not_busy(config); | 269 | rtc_wait_not_busy(config); |
@@ -298,9 +293,7 @@ static int spear_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alm) | |||
298 | */ | 293 | */ |
299 | static int spear_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alm) | 294 | static int spear_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alm) |
300 | { | 295 | { |
301 | struct platform_device *pdev = to_platform_device(dev); | 296 | struct spear_rtc_config *config = dev_get_drvdata(dev); |
302 | struct rtc_device *rtc = platform_get_drvdata(pdev); | ||
303 | struct spear_rtc_config *config = dev_get_drvdata(&rtc->dev); | ||
304 | unsigned int time, date, err = 0; | 297 | unsigned int time, date, err = 0; |
305 | 298 | ||
306 | if (tm2bcd(&alm->time) < 0) | 299 | if (tm2bcd(&alm->time) < 0) |
@@ -326,17 +319,42 @@ static int spear_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alm) | |||
326 | 319 | ||
327 | return 0; | 320 | return 0; |
328 | } | 321 | } |
322 | |||
323 | static int spear_alarm_irq_enable(struct device *dev, unsigned int enabled) | ||
324 | { | ||
325 | struct spear_rtc_config *config = dev_get_drvdata(dev); | ||
326 | int ret = 0; | ||
327 | |||
328 | spear_rtc_clear_interrupt(config); | ||
329 | |||
330 | switch (enabled) { | ||
331 | case 0: | ||
332 | /* alarm off */ | ||
333 | spear_rtc_disable_interrupt(config); | ||
334 | break; | ||
335 | case 1: | ||
336 | /* alarm on */ | ||
337 | spear_rtc_enable_interrupt(config); | ||
338 | break; | ||
339 | default: | ||
340 | ret = -EINVAL; | ||
341 | break; | ||
342 | } | ||
343 | |||
344 | return ret; | ||
345 | } | ||
346 | |||
329 | static struct rtc_class_ops spear_rtc_ops = { | 347 | static struct rtc_class_ops spear_rtc_ops = { |
330 | .read_time = spear_rtc_read_time, | 348 | .read_time = spear_rtc_read_time, |
331 | .set_time = spear_rtc_set_time, | 349 | .set_time = spear_rtc_set_time, |
332 | .read_alarm = spear_rtc_read_alarm, | 350 | .read_alarm = spear_rtc_read_alarm, |
333 | .set_alarm = spear_rtc_set_alarm, | 351 | .set_alarm = spear_rtc_set_alarm, |
352 | .alarm_irq_enable = spear_alarm_irq_enable, | ||
334 | }; | 353 | }; |
335 | 354 | ||
336 | static int __devinit spear_rtc_probe(struct platform_device *pdev) | 355 | static int __devinit spear_rtc_probe(struct platform_device *pdev) |
337 | { | 356 | { |
338 | struct resource *res; | 357 | struct resource *res; |
339 | struct rtc_device *rtc; | ||
340 | struct spear_rtc_config *config; | 358 | struct spear_rtc_config *config; |
341 | unsigned int status = 0; | 359 | unsigned int status = 0; |
342 | int irq; | 360 | int irq; |
@@ -376,19 +394,17 @@ static int __devinit spear_rtc_probe(struct platform_device *pdev) | |||
376 | } | 394 | } |
377 | 395 | ||
378 | spin_lock_init(&config->lock); | 396 | spin_lock_init(&config->lock); |
397 | platform_set_drvdata(pdev, config); | ||
379 | 398 | ||
380 | rtc = rtc_device_register(pdev->name, &pdev->dev, &spear_rtc_ops, | 399 | config->rtc = rtc_device_register(pdev->name, &pdev->dev, |
381 | THIS_MODULE); | 400 | &spear_rtc_ops, THIS_MODULE); |
382 | if (IS_ERR(rtc)) { | 401 | if (IS_ERR(config->rtc)) { |
383 | dev_err(&pdev->dev, "can't register RTC device, err %ld\n", | 402 | dev_err(&pdev->dev, "can't register RTC device, err %ld\n", |
384 | PTR_ERR(rtc)); | 403 | PTR_ERR(config->rtc)); |
385 | status = PTR_ERR(rtc); | 404 | status = PTR_ERR(config->rtc); |
386 | goto err_iounmap; | 405 | goto err_iounmap; |
387 | } | 406 | } |
388 | 407 | ||
389 | platform_set_drvdata(pdev, rtc); | ||
390 | dev_set_drvdata(&rtc->dev, config); | ||
391 | |||
392 | /* alarm irqs */ | 408 | /* alarm irqs */ |
393 | irq = platform_get_irq(pdev, 0); | 409 | irq = platform_get_irq(pdev, 0); |
394 | if (irq < 0) { | 410 | if (irq < 0) { |
@@ -397,7 +413,7 @@ static int __devinit spear_rtc_probe(struct platform_device *pdev) | |||
397 | goto err_clear_platdata; | 413 | goto err_clear_platdata; |
398 | } | 414 | } |
399 | 415 | ||
400 | status = request_irq(irq, spear_rtc_irq, 0, pdev->name, rtc); | 416 | status = request_irq(irq, spear_rtc_irq, 0, pdev->name, config); |
401 | if (status) { | 417 | if (status) { |
402 | dev_err(&pdev->dev, "Alarm interrupt IRQ%d already \ | 418 | dev_err(&pdev->dev, "Alarm interrupt IRQ%d already \ |
403 | claimed\n", irq); | 419 | claimed\n", irq); |
@@ -411,8 +427,7 @@ static int __devinit spear_rtc_probe(struct platform_device *pdev) | |||
411 | 427 | ||
412 | err_clear_platdata: | 428 | err_clear_platdata: |
413 | platform_set_drvdata(pdev, NULL); | 429 | platform_set_drvdata(pdev, NULL); |
414 | dev_set_drvdata(&rtc->dev, NULL); | 430 | rtc_device_unregister(config->rtc); |
415 | rtc_device_unregister(rtc); | ||
416 | err_iounmap: | 431 | err_iounmap: |
417 | iounmap(config->ioaddr); | 432 | iounmap(config->ioaddr); |
418 | err_disable_clock: | 433 | err_disable_clock: |
@@ -429,8 +444,7 @@ err_release_region: | |||
429 | 444 | ||
430 | static int __devexit spear_rtc_remove(struct platform_device *pdev) | 445 | static int __devexit spear_rtc_remove(struct platform_device *pdev) |
431 | { | 446 | { |
432 | struct rtc_device *rtc = platform_get_drvdata(pdev); | 447 | struct spear_rtc_config *config = platform_get_drvdata(pdev); |
433 | struct spear_rtc_config *config = dev_get_drvdata(&rtc->dev); | ||
434 | int irq; | 448 | int irq; |
435 | struct resource *res; | 449 | struct resource *res; |
436 | 450 | ||
@@ -448,8 +462,7 @@ static int __devexit spear_rtc_remove(struct platform_device *pdev) | |||
448 | if (res) | 462 | if (res) |
449 | release_mem_region(res->start, resource_size(res)); | 463 | release_mem_region(res->start, resource_size(res)); |
450 | platform_set_drvdata(pdev, NULL); | 464 | platform_set_drvdata(pdev, NULL); |
451 | dev_set_drvdata(&rtc->dev, NULL); | 465 | rtc_device_unregister(config->rtc); |
452 | rtc_device_unregister(rtc); | ||
453 | 466 | ||
454 | return 0; | 467 | return 0; |
455 | } | 468 | } |
@@ -458,14 +471,14 @@ static int __devexit spear_rtc_remove(struct platform_device *pdev) | |||
458 | 471 | ||
459 | static int spear_rtc_suspend(struct platform_device *pdev, pm_message_t state) | 472 | static int spear_rtc_suspend(struct platform_device *pdev, pm_message_t state) |
460 | { | 473 | { |
461 | struct rtc_device *rtc = platform_get_drvdata(pdev); | 474 | struct spear_rtc_config *config = platform_get_drvdata(pdev); |
462 | struct spear_rtc_config *config = dev_get_drvdata(&rtc->dev); | ||
463 | int irq; | 475 | int irq; |
464 | 476 | ||
465 | irq = platform_get_irq(pdev, 0); | 477 | irq = platform_get_irq(pdev, 0); |
466 | if (device_may_wakeup(&pdev->dev)) | 478 | if (device_may_wakeup(&pdev->dev)) { |
467 | enable_irq_wake(irq); | 479 | if (!enable_irq_wake(irq)) |
468 | else { | 480 | config->irq_wake = 1; |
481 | } else { | ||
469 | spear_rtc_disable_interrupt(config); | 482 | spear_rtc_disable_interrupt(config); |
470 | clk_disable(config->clk); | 483 | clk_disable(config->clk); |
471 | } | 484 | } |
@@ -475,15 +488,17 @@ static int spear_rtc_suspend(struct platform_device *pdev, pm_message_t state) | |||
475 | 488 | ||
476 | static int spear_rtc_resume(struct platform_device *pdev) | 489 | static int spear_rtc_resume(struct platform_device *pdev) |
477 | { | 490 | { |
478 | struct rtc_device *rtc = platform_get_drvdata(pdev); | 491 | struct spear_rtc_config *config = platform_get_drvdata(pdev); |
479 | struct spear_rtc_config *config = dev_get_drvdata(&rtc->dev); | ||
480 | int irq; | 492 | int irq; |
481 | 493 | ||
482 | irq = platform_get_irq(pdev, 0); | 494 | irq = platform_get_irq(pdev, 0); |
483 | 495 | ||
484 | if (device_may_wakeup(&pdev->dev)) | 496 | if (device_may_wakeup(&pdev->dev)) { |
485 | disable_irq_wake(irq); | 497 | if (config->irq_wake) { |
486 | else { | 498 | disable_irq_wake(irq); |
499 | config->irq_wake = 0; | ||
500 | } | ||
501 | } else { | ||
487 | clk_enable(config->clk); | 502 | clk_enable(config->clk); |
488 | spear_rtc_enable_interrupt(config); | 503 | spear_rtc_enable_interrupt(config); |
489 | } | 504 | } |
@@ -498,8 +513,7 @@ static int spear_rtc_resume(struct platform_device *pdev) | |||
498 | 513 | ||
499 | static void spear_rtc_shutdown(struct platform_device *pdev) | 514 | static void spear_rtc_shutdown(struct platform_device *pdev) |
500 | { | 515 | { |
501 | struct rtc_device *rtc = platform_get_drvdata(pdev); | 516 | struct spear_rtc_config *config = platform_get_drvdata(pdev); |
502 | struct spear_rtc_config *config = dev_get_drvdata(&rtc->dev); | ||
503 | 517 | ||
504 | spear_rtc_disable_interrupt(config); | 518 | spear_rtc_disable_interrupt(config); |
505 | clk_disable(config->clk); | 519 | clk_disable(config->clk); |
diff --git a/drivers/rtc/rtc-stk17ta8.c b/drivers/rtc/rtc-stk17ta8.c index 7621116bd20d..279f5cfa691a 100644 --- a/drivers/rtc/rtc-stk17ta8.c +++ b/drivers/rtc/rtc-stk17ta8.c | |||
@@ -329,7 +329,7 @@ static int __devinit stk17ta8_rtc_probe(struct platform_device *pdev) | |||
329 | writeb(0, ioaddr + RTC_INTERRUPTS); | 329 | writeb(0, ioaddr + RTC_INTERRUPTS); |
330 | if (devm_request_irq(&pdev->dev, pdata->irq, | 330 | if (devm_request_irq(&pdev->dev, pdata->irq, |
331 | stk17ta8_rtc_interrupt, | 331 | stk17ta8_rtc_interrupt, |
332 | IRQF_DISABLED | IRQF_SHARED, | 332 | IRQF_SHARED, |
333 | pdev->name, pdev) < 0) { | 333 | pdev->name, pdev) < 0) { |
334 | dev_warn(&pdev->dev, "interrupt not available.\n"); | 334 | dev_warn(&pdev->dev, "interrupt not available.\n"); |
335 | pdata->irq = 0; | 335 | pdata->irq = 0; |
diff --git a/drivers/rtc/rtc-twl.c b/drivers/rtc/rtc-twl.c index d43b4f6eb4e4..4c2c6df2a9ef 100644 --- a/drivers/rtc/rtc-twl.c +++ b/drivers/rtc/rtc-twl.c | |||
@@ -176,6 +176,10 @@ static int set_rtc_irq_bit(unsigned char bit) | |||
176 | unsigned char val; | 176 | unsigned char val; |
177 | int ret; | 177 | int ret; |
178 | 178 | ||
179 | /* if the bit is set, return from here */ | ||
180 | if (rtc_irq_bits & bit) | ||
181 | return 0; | ||
182 | |||
179 | val = rtc_irq_bits | bit; | 183 | val = rtc_irq_bits | bit; |
180 | val &= ~BIT_RTC_INTERRUPTS_REG_EVERY_M; | 184 | val &= ~BIT_RTC_INTERRUPTS_REG_EVERY_M; |
181 | ret = twl_rtc_write_u8(val, REG_RTC_INTERRUPTS_REG); | 185 | ret = twl_rtc_write_u8(val, REG_RTC_INTERRUPTS_REG); |
@@ -193,6 +197,10 @@ static int mask_rtc_irq_bit(unsigned char bit) | |||
193 | unsigned char val; | 197 | unsigned char val; |
194 | int ret; | 198 | int ret; |
195 | 199 | ||
200 | /* if the bit is clear, return from here */ | ||
201 | if (!(rtc_irq_bits & bit)) | ||
202 | return 0; | ||
203 | |||
196 | val = rtc_irq_bits & ~bit; | 204 | val = rtc_irq_bits & ~bit; |
197 | ret = twl_rtc_write_u8(val, REG_RTC_INTERRUPTS_REG); | 205 | ret = twl_rtc_write_u8(val, REG_RTC_INTERRUPTS_REG); |
198 | if (ret == 0) | 206 | if (ret == 0) |
@@ -357,7 +365,7 @@ out: | |||
357 | 365 | ||
358 | static irqreturn_t twl_rtc_interrupt(int irq, void *rtc) | 366 | static irqreturn_t twl_rtc_interrupt(int irq, void *rtc) |
359 | { | 367 | { |
360 | unsigned long events = 0; | 368 | unsigned long events; |
361 | int ret = IRQ_NONE; | 369 | int ret = IRQ_NONE; |
362 | int res; | 370 | int res; |
363 | u8 rd_reg; | 371 | u8 rd_reg; |
@@ -372,11 +380,11 @@ static irqreturn_t twl_rtc_interrupt(int irq, void *rtc) | |||
372 | * by reading RTS_INTERRUPTS_REGISTER[IT_TIMER,IT_ALARM] | 380 | * by reading RTS_INTERRUPTS_REGISTER[IT_TIMER,IT_ALARM] |
373 | */ | 381 | */ |
374 | if (rd_reg & BIT_RTC_STATUS_REG_ALARM_M) | 382 | if (rd_reg & BIT_RTC_STATUS_REG_ALARM_M) |
375 | events |= RTC_IRQF | RTC_AF; | 383 | events = RTC_IRQF | RTC_AF; |
376 | else | 384 | else |
377 | events |= RTC_IRQF | RTC_UF; | 385 | events = RTC_IRQF | RTC_PF; |
378 | 386 | ||
379 | res = twl_rtc_write_u8(rd_reg | BIT_RTC_STATUS_REG_ALARM_M, | 387 | res = twl_rtc_write_u8(BIT_RTC_STATUS_REG_ALARM_M, |
380 | REG_RTC_STATUS_REG); | 388 | REG_RTC_STATUS_REG); |
381 | if (res) | 389 | if (res) |
382 | goto out; | 390 | goto out; |
@@ -449,19 +457,11 @@ static int __devinit twl_rtc_probe(struct platform_device *pdev) | |||
449 | REG_INT_MSK_STS_A); | 457 | REG_INT_MSK_STS_A); |
450 | } | 458 | } |
451 | 459 | ||
452 | /* Check RTC module status, Enable if it is off */ | 460 | dev_info(&pdev->dev, "Enabling TWL-RTC\n"); |
453 | ret = twl_rtc_read_u8(&rd_reg, REG_RTC_CTRL_REG); | 461 | ret = twl_rtc_write_u8(BIT_RTC_CTRL_REG_STOP_RTC_M, REG_RTC_CTRL_REG); |
454 | if (ret < 0) | 462 | if (ret < 0) |
455 | goto out1; | 463 | goto out1; |
456 | 464 | ||
457 | if (!(rd_reg & BIT_RTC_CTRL_REG_STOP_RTC_M)) { | ||
458 | dev_info(&pdev->dev, "Enabling TWL-RTC.\n"); | ||
459 | rd_reg = BIT_RTC_CTRL_REG_STOP_RTC_M; | ||
460 | ret = twl_rtc_write_u8(rd_reg, REG_RTC_CTRL_REG); | ||
461 | if (ret < 0) | ||
462 | goto out1; | ||
463 | } | ||
464 | |||
465 | /* init cached IRQ enable bits */ | 465 | /* init cached IRQ enable bits */ |
466 | ret = twl_rtc_read_u8(&rtc_irq_bits, REG_RTC_INTERRUPTS_REG); | 466 | ret = twl_rtc_read_u8(&rtc_irq_bits, REG_RTC_INTERRUPTS_REG); |
467 | if (ret < 0) | 467 | if (ret < 0) |
diff --git a/drivers/rtc/rtc-tx4939.c b/drivers/rtc/rtc-tx4939.c index aac0ffed4345..a12bfac49d36 100644 --- a/drivers/rtc/rtc-tx4939.c +++ b/drivers/rtc/rtc-tx4939.c | |||
@@ -266,7 +266,7 @@ static int __init tx4939_rtc_probe(struct platform_device *pdev) | |||
266 | spin_lock_init(&pdata->lock); | 266 | spin_lock_init(&pdata->lock); |
267 | tx4939_rtc_cmd(pdata->rtcreg, TX4939_RTCCTL_COMMAND_NOP); | 267 | tx4939_rtc_cmd(pdata->rtcreg, TX4939_RTCCTL_COMMAND_NOP); |
268 | if (devm_request_irq(&pdev->dev, irq, tx4939_rtc_interrupt, | 268 | if (devm_request_irq(&pdev->dev, irq, tx4939_rtc_interrupt, |
269 | IRQF_DISABLED, pdev->name, &pdev->dev) < 0) | 269 | 0, pdev->name, &pdev->dev) < 0) |
270 | return -EBUSY; | 270 | return -EBUSY; |
271 | rtc = rtc_device_register(pdev->name, &pdev->dev, | 271 | rtc = rtc_device_register(pdev->name, &pdev->dev, |
272 | &tx4939_rtc_ops, THIS_MODULE); | 272 | &tx4939_rtc_ops, THIS_MODULE); |
diff --git a/drivers/rtc/rtc-vr41xx.c b/drivers/rtc/rtc-vr41xx.c index fcbfdda2993b..5f60a7c6a155 100644 --- a/drivers/rtc/rtc-vr41xx.c +++ b/drivers/rtc/rtc-vr41xx.c | |||
@@ -333,7 +333,7 @@ static int __devinit rtc_probe(struct platform_device *pdev) | |||
333 | goto err_device_unregister; | 333 | goto err_device_unregister; |
334 | } | 334 | } |
335 | 335 | ||
336 | retval = request_irq(aie_irq, elapsedtime_interrupt, IRQF_DISABLED, | 336 | retval = request_irq(aie_irq, elapsedtime_interrupt, 0, |
337 | "elapsed_time", pdev); | 337 | "elapsed_time", pdev); |
338 | if (retval < 0) | 338 | if (retval < 0) |
339 | goto err_device_unregister; | 339 | goto err_device_unregister; |
@@ -342,7 +342,7 @@ static int __devinit rtc_probe(struct platform_device *pdev) | |||
342 | if (pie_irq <= 0) | 342 | if (pie_irq <= 0) |
343 | goto err_free_irq; | 343 | goto err_free_irq; |
344 | 344 | ||
345 | retval = request_irq(pie_irq, rtclong1_interrupt, IRQF_DISABLED, | 345 | retval = request_irq(pie_irq, rtclong1_interrupt, 0, |
346 | "rtclong1", pdev); | 346 | "rtclong1", pdev); |
347 | if (retval < 0) | 347 | if (retval < 0) |
348 | goto err_free_irq; | 348 | goto err_free_irq; |
diff --git a/drivers/rtc/rtc-x1205.c b/drivers/rtc/rtc-x1205.c index 8c051d3179db..403b3d41d101 100644 --- a/drivers/rtc/rtc-x1205.c +++ b/drivers/rtc/rtc-x1205.c | |||
@@ -623,15 +623,7 @@ static struct i2c_driver x1205_driver = { | |||
623 | .id_table = x1205_id, | 623 | .id_table = x1205_id, |
624 | }; | 624 | }; |
625 | 625 | ||
626 | static int __init x1205_init(void) | 626 | module_i2c_driver(x1205_driver); |
627 | { | ||
628 | return i2c_add_driver(&x1205_driver); | ||
629 | } | ||
630 | |||
631 | static void __exit x1205_exit(void) | ||
632 | { | ||
633 | i2c_del_driver(&x1205_driver); | ||
634 | } | ||
635 | 627 | ||
636 | MODULE_AUTHOR( | 628 | MODULE_AUTHOR( |
637 | "Karen Spearel <kas111 at gmail dot com>, " | 629 | "Karen Spearel <kas111 at gmail dot com>, " |
@@ -639,6 +631,3 @@ MODULE_AUTHOR( | |||
639 | MODULE_DESCRIPTION("Xicor/Intersil X1205 RTC driver"); | 631 | MODULE_DESCRIPTION("Xicor/Intersil X1205 RTC driver"); |
640 | MODULE_LICENSE("GPL"); | 632 | MODULE_LICENSE("GPL"); |
641 | MODULE_VERSION(DRV_VERSION); | 633 | MODULE_VERSION(DRV_VERSION); |
642 | |||
643 | module_init(x1205_init); | ||
644 | module_exit(x1205_exit); | ||
diff --git a/drivers/s390/char/sclp_cmd.c b/drivers/s390/char/sclp_cmd.c index 0b54a91f8dcd..168525a9c292 100644 --- a/drivers/s390/char/sclp_cmd.c +++ b/drivers/s390/char/sclp_cmd.c | |||
@@ -441,9 +441,8 @@ static int sclp_mem_notifier(struct notifier_block *nb, | |||
441 | start = arg->start_pfn << PAGE_SHIFT; | 441 | start = arg->start_pfn << PAGE_SHIFT; |
442 | size = arg->nr_pages << PAGE_SHIFT; | 442 | size = arg->nr_pages << PAGE_SHIFT; |
443 | mutex_lock(&sclp_mem_mutex); | 443 | mutex_lock(&sclp_mem_mutex); |
444 | for (id = 0; id <= sclp_max_storage_id; id++) | 444 | for_each_clear_bit(id, sclp_storage_ids, sclp_max_storage_id + 1) |
445 | if (!test_bit(id, sclp_storage_ids)) | 445 | sclp_attach_storage(id); |
446 | sclp_attach_storage(id); | ||
447 | switch (action) { | 446 | switch (action) { |
448 | case MEM_ONLINE: | 447 | case MEM_ONLINE: |
449 | case MEM_GOING_OFFLINE: | 448 | case MEM_GOING_OFFLINE: |
diff --git a/drivers/staging/rtl8187se/r8180_core.c b/drivers/staging/rtl8187se/r8180_core.c index e4ade550cfe5..4fe52f6b0034 100644 --- a/drivers/staging/rtl8187se/r8180_core.c +++ b/drivers/staging/rtl8187se/r8180_core.c | |||
@@ -4159,7 +4159,7 @@ void GPIOChangeRFWorkItemCallBack(struct work_struct *work) | |||
4159 | argv[0] = RadioPowerPath; | 4159 | argv[0] = RadioPowerPath; |
4160 | argv[2] = NULL; | 4160 | argv[2] = NULL; |
4161 | 4161 | ||
4162 | call_usermodehelper(RadioPowerPath, argv, envp, 1); | 4162 | call_usermodehelper(RadioPowerPath, argv, envp, UMH_WAIT_PROC); |
4163 | } | 4163 | } |
4164 | } | 4164 | } |
4165 | 4165 | ||
diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c b/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c index a7fa9aad6f2d..f026b7171f62 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c | |||
@@ -208,7 +208,7 @@ static void dm_check_ac_dc_power(struct net_device *dev) | |||
208 | 208 | ||
209 | if (priv->rtllib->state != RTLLIB_LINKED) | 209 | if (priv->rtllib->state != RTLLIB_LINKED) |
210 | return; | 210 | return; |
211 | call_usermodehelper(ac_dc_check_script_path, argv, envp, 1); | 211 | call_usermodehelper(ac_dc_check_script_path, argv, envp, UMH_WAIT_PROC); |
212 | 212 | ||
213 | return; | 213 | return; |
214 | }; | 214 | }; |
@@ -2296,7 +2296,7 @@ void dm_CheckRfCtrlGPIO(void *data) | |||
2296 | 2296 | ||
2297 | argv[0] = RadioPowerPath; | 2297 | argv[0] = RadioPowerPath; |
2298 | argv[2] = NULL; | 2298 | argv[2] = NULL; |
2299 | call_usermodehelper(RadioPowerPath, argv, envp, 1); | 2299 | call_usermodehelper(RadioPowerPath, argv, envp, UMH_WAIT_PROC); |
2300 | } | 2300 | } |
2301 | } | 2301 | } |
2302 | 2302 | ||
diff --git a/drivers/staging/telephony/ixj.c b/drivers/staging/telephony/ixj.c index d5f923bcdffe..f96027921f60 100644 --- a/drivers/staging/telephony/ixj.c +++ b/drivers/staging/telephony/ixj.c | |||
@@ -5927,7 +5927,8 @@ static void add_caps(IXJ *j) | |||
5927 | j->caplist[j->caps].cap = PHONE_VENDOR_QUICKNET; | 5927 | j->caplist[j->caps].cap = PHONE_VENDOR_QUICKNET; |
5928 | strcpy(j->caplist[j->caps].desc, "Quicknet Technologies, Inc. (www.quicknet.net)"); | 5928 | strcpy(j->caplist[j->caps].desc, "Quicknet Technologies, Inc. (www.quicknet.net)"); |
5929 | j->caplist[j->caps].captype = vendor; | 5929 | j->caplist[j->caps].captype = vendor; |
5930 | j->caplist[j->caps].handle = j->caps++; | 5930 | j->caplist[j->caps].handle = j->caps; |
5931 | j->caps++; | ||
5931 | j->caplist[j->caps].captype = device; | 5932 | j->caplist[j->caps].captype = device; |
5932 | switch (j->cardtype) { | 5933 | switch (j->cardtype) { |
5933 | case QTI_PHONEJACK: | 5934 | case QTI_PHONEJACK: |
@@ -5947,11 +5948,13 @@ static void add_caps(IXJ *j) | |||
5947 | break; | 5948 | break; |
5948 | } | 5949 | } |
5949 | j->caplist[j->caps].cap = j->cardtype; | 5950 | j->caplist[j->caps].cap = j->cardtype; |
5950 | j->caplist[j->caps].handle = j->caps++; | 5951 | j->caplist[j->caps].handle = j->caps; |
5952 | j->caps++; | ||
5951 | strcpy(j->caplist[j->caps].desc, "POTS"); | 5953 | strcpy(j->caplist[j->caps].desc, "POTS"); |
5952 | j->caplist[j->caps].captype = port; | 5954 | j->caplist[j->caps].captype = port; |
5953 | j->caplist[j->caps].cap = pots; | 5955 | j->caplist[j->caps].cap = pots; |
5954 | j->caplist[j->caps].handle = j->caps++; | 5956 | j->caplist[j->caps].handle = j->caps; |
5957 | j->caps++; | ||
5955 | 5958 | ||
5956 | /* add devices that can do speaker/mic */ | 5959 | /* add devices that can do speaker/mic */ |
5957 | switch (j->cardtype) { | 5960 | switch (j->cardtype) { |
@@ -5962,7 +5965,8 @@ static void add_caps(IXJ *j) | |||
5962 | strcpy(j->caplist[j->caps].desc, "SPEAKER"); | 5965 | strcpy(j->caplist[j->caps].desc, "SPEAKER"); |
5963 | j->caplist[j->caps].captype = port; | 5966 | j->caplist[j->caps].captype = port; |
5964 | j->caplist[j->caps].cap = speaker; | 5967 | j->caplist[j->caps].cap = speaker; |
5965 | j->caplist[j->caps].handle = j->caps++; | 5968 | j->caplist[j->caps].handle = j->caps; |
5969 | j->caps++; | ||
5966 | default: | 5970 | default: |
5967 | break; | 5971 | break; |
5968 | } | 5972 | } |
@@ -5973,7 +5977,8 @@ static void add_caps(IXJ *j) | |||
5973 | strcpy(j->caplist[j->caps].desc, "HANDSET"); | 5977 | strcpy(j->caplist[j->caps].desc, "HANDSET"); |
5974 | j->caplist[j->caps].captype = port; | 5978 | j->caplist[j->caps].captype = port; |
5975 | j->caplist[j->caps].cap = handset; | 5979 | j->caplist[j->caps].cap = handset; |
5976 | j->caplist[j->caps].handle = j->caps++; | 5980 | j->caplist[j->caps].handle = j->caps; |
5981 | j->caps++; | ||
5977 | break; | 5982 | break; |
5978 | default: | 5983 | default: |
5979 | break; | 5984 | break; |
@@ -5985,7 +5990,8 @@ static void add_caps(IXJ *j) | |||
5985 | strcpy(j->caplist[j->caps].desc, "PSTN"); | 5990 | strcpy(j->caplist[j->caps].desc, "PSTN"); |
5986 | j->caplist[j->caps].captype = port; | 5991 | j->caplist[j->caps].captype = port; |
5987 | j->caplist[j->caps].cap = pstn; | 5992 | j->caplist[j->caps].cap = pstn; |
5988 | j->caplist[j->caps].handle = j->caps++; | 5993 | j->caplist[j->caps].handle = j->caps; |
5994 | j->caps++; | ||
5989 | break; | 5995 | break; |
5990 | default: | 5996 | default: |
5991 | break; | 5997 | break; |
@@ -5995,50 +6001,59 @@ static void add_caps(IXJ *j) | |||
5995 | strcpy(j->caplist[j->caps].desc, "ULAW"); | 6001 | strcpy(j->caplist[j->caps].desc, "ULAW"); |
5996 | j->caplist[j->caps].captype = codec; | 6002 | j->caplist[j->caps].captype = codec; |
5997 | j->caplist[j->caps].cap = ULAW; | 6003 | j->caplist[j->caps].cap = ULAW; |
5998 | j->caplist[j->caps].handle = j->caps++; | 6004 | j->caplist[j->caps].handle = j->caps; |
6005 | j->caps++; | ||
5999 | 6006 | ||
6000 | strcpy(j->caplist[j->caps].desc, "LINEAR 16 bit"); | 6007 | strcpy(j->caplist[j->caps].desc, "LINEAR 16 bit"); |
6001 | j->caplist[j->caps].captype = codec; | 6008 | j->caplist[j->caps].captype = codec; |
6002 | j->caplist[j->caps].cap = LINEAR16; | 6009 | j->caplist[j->caps].cap = LINEAR16; |
6003 | j->caplist[j->caps].handle = j->caps++; | 6010 | j->caplist[j->caps].handle = j->caps; |
6011 | j->caps++; | ||
6004 | 6012 | ||
6005 | strcpy(j->caplist[j->caps].desc, "LINEAR 8 bit"); | 6013 | strcpy(j->caplist[j->caps].desc, "LINEAR 8 bit"); |
6006 | j->caplist[j->caps].captype = codec; | 6014 | j->caplist[j->caps].captype = codec; |
6007 | j->caplist[j->caps].cap = LINEAR8; | 6015 | j->caplist[j->caps].cap = LINEAR8; |
6008 | j->caplist[j->caps].handle = j->caps++; | 6016 | j->caplist[j->caps].handle = j->caps; |
6017 | j->caps++; | ||
6009 | 6018 | ||
6010 | strcpy(j->caplist[j->caps].desc, "Windows Sound System"); | 6019 | strcpy(j->caplist[j->caps].desc, "Windows Sound System"); |
6011 | j->caplist[j->caps].captype = codec; | 6020 | j->caplist[j->caps].captype = codec; |
6012 | j->caplist[j->caps].cap = WSS; | 6021 | j->caplist[j->caps].cap = WSS; |
6013 | j->caplist[j->caps].handle = j->caps++; | 6022 | j->caplist[j->caps].handle = j->caps; |
6023 | j->caps++; | ||
6014 | 6024 | ||
6015 | /* software ALAW codec, made from ULAW */ | 6025 | /* software ALAW codec, made from ULAW */ |
6016 | strcpy(j->caplist[j->caps].desc, "ALAW"); | 6026 | strcpy(j->caplist[j->caps].desc, "ALAW"); |
6017 | j->caplist[j->caps].captype = codec; | 6027 | j->caplist[j->caps].captype = codec; |
6018 | j->caplist[j->caps].cap = ALAW; | 6028 | j->caplist[j->caps].cap = ALAW; |
6019 | j->caplist[j->caps].handle = j->caps++; | 6029 | j->caplist[j->caps].handle = j->caps; |
6030 | j->caps++; | ||
6020 | 6031 | ||
6021 | /* version 12 of the 8020 does the following codecs in a broken way */ | 6032 | /* version 12 of the 8020 does the following codecs in a broken way */ |
6022 | if (j->dsp.low != 0x20 || j->ver.low != 0x12) { | 6033 | if (j->dsp.low != 0x20 || j->ver.low != 0x12) { |
6023 | strcpy(j->caplist[j->caps].desc, "G.723.1 6.3kbps"); | 6034 | strcpy(j->caplist[j->caps].desc, "G.723.1 6.3kbps"); |
6024 | j->caplist[j->caps].captype = codec; | 6035 | j->caplist[j->caps].captype = codec; |
6025 | j->caplist[j->caps].cap = G723_63; | 6036 | j->caplist[j->caps].cap = G723_63; |
6026 | j->caplist[j->caps].handle = j->caps++; | 6037 | j->caplist[j->caps].handle = j->caps; |
6038 | j->caps++; | ||
6027 | 6039 | ||
6028 | strcpy(j->caplist[j->caps].desc, "G.723.1 5.3kbps"); | 6040 | strcpy(j->caplist[j->caps].desc, "G.723.1 5.3kbps"); |
6029 | j->caplist[j->caps].captype = codec; | 6041 | j->caplist[j->caps].captype = codec; |
6030 | j->caplist[j->caps].cap = G723_53; | 6042 | j->caplist[j->caps].cap = G723_53; |
6031 | j->caplist[j->caps].handle = j->caps++; | 6043 | j->caplist[j->caps].handle = j->caps; |
6044 | j->caps++; | ||
6032 | 6045 | ||
6033 | strcpy(j->caplist[j->caps].desc, "TrueSpeech 4.8kbps"); | 6046 | strcpy(j->caplist[j->caps].desc, "TrueSpeech 4.8kbps"); |
6034 | j->caplist[j->caps].captype = codec; | 6047 | j->caplist[j->caps].captype = codec; |
6035 | j->caplist[j->caps].cap = TS48; | 6048 | j->caplist[j->caps].cap = TS48; |
6036 | j->caplist[j->caps].handle = j->caps++; | 6049 | j->caplist[j->caps].handle = j->caps; |
6050 | j->caps++; | ||
6037 | 6051 | ||
6038 | strcpy(j->caplist[j->caps].desc, "TrueSpeech 4.1kbps"); | 6052 | strcpy(j->caplist[j->caps].desc, "TrueSpeech 4.1kbps"); |
6039 | j->caplist[j->caps].captype = codec; | 6053 | j->caplist[j->caps].captype = codec; |
6040 | j->caplist[j->caps].cap = TS41; | 6054 | j->caplist[j->caps].cap = TS41; |
6041 | j->caplist[j->caps].handle = j->caps++; | 6055 | j->caplist[j->caps].handle = j->caps; |
6056 | j->caps++; | ||
6042 | } | 6057 | } |
6043 | 6058 | ||
6044 | /* 8020 chips can do TS8.5 native, and 8021/8022 can load it */ | 6059 | /* 8020 chips can do TS8.5 native, and 8021/8022 can load it */ |
@@ -6046,7 +6061,8 @@ static void add_caps(IXJ *j) | |||
6046 | strcpy(j->caplist[j->caps].desc, "TrueSpeech 8.5kbps"); | 6061 | strcpy(j->caplist[j->caps].desc, "TrueSpeech 8.5kbps"); |
6047 | j->caplist[j->caps].captype = codec; | 6062 | j->caplist[j->caps].captype = codec; |
6048 | j->caplist[j->caps].cap = TS85; | 6063 | j->caplist[j->caps].cap = TS85; |
6049 | j->caplist[j->caps].handle = j->caps++; | 6064 | j->caplist[j->caps].handle = j->caps; |
6065 | j->caps++; | ||
6050 | } | 6066 | } |
6051 | 6067 | ||
6052 | /* 8021 chips can do G728 */ | 6068 | /* 8021 chips can do G728 */ |
@@ -6054,7 +6070,8 @@ static void add_caps(IXJ *j) | |||
6054 | strcpy(j->caplist[j->caps].desc, "G.728 16kbps"); | 6070 | strcpy(j->caplist[j->caps].desc, "G.728 16kbps"); |
6055 | j->caplist[j->caps].captype = codec; | 6071 | j->caplist[j->caps].captype = codec; |
6056 | j->caplist[j->caps].cap = G728; | 6072 | j->caplist[j->caps].cap = G728; |
6057 | j->caplist[j->caps].handle = j->caps++; | 6073 | j->caplist[j->caps].handle = j->caps; |
6074 | j->caps++; | ||
6058 | } | 6075 | } |
6059 | 6076 | ||
6060 | /* 8021/8022 chips can do G729 if loaded */ | 6077 | /* 8021/8022 chips can do G729 if loaded */ |
@@ -6062,13 +6079,15 @@ static void add_caps(IXJ *j) | |||
6062 | strcpy(j->caplist[j->caps].desc, "G.729A 8kbps"); | 6079 | strcpy(j->caplist[j->caps].desc, "G.729A 8kbps"); |
6063 | j->caplist[j->caps].captype = codec; | 6080 | j->caplist[j->caps].captype = codec; |
6064 | j->caplist[j->caps].cap = G729; | 6081 | j->caplist[j->caps].cap = G729; |
6065 | j->caplist[j->caps].handle = j->caps++; | 6082 | j->caplist[j->caps].handle = j->caps; |
6083 | j->caps++; | ||
6066 | } | 6084 | } |
6067 | if (j->dsp.low != 0x20 && j->flags.g729_loaded) { | 6085 | if (j->dsp.low != 0x20 && j->flags.g729_loaded) { |
6068 | strcpy(j->caplist[j->caps].desc, "G.729B 8kbps"); | 6086 | strcpy(j->caplist[j->caps].desc, "G.729B 8kbps"); |
6069 | j->caplist[j->caps].captype = codec; | 6087 | j->caplist[j->caps].captype = codec; |
6070 | j->caplist[j->caps].cap = G729B; | 6088 | j->caplist[j->caps].cap = G729B; |
6071 | j->caplist[j->caps].handle = j->caps++; | 6089 | j->caplist[j->caps].handle = j->caps; |
6090 | j->caps++; | ||
6072 | } | 6091 | } |
6073 | } | 6092 | } |
6074 | 6093 | ||
diff --git a/drivers/uwb/allocator.c b/drivers/uwb/allocator.c index e45e673b8770..6e3e713f0ef7 100644 --- a/drivers/uwb/allocator.c +++ b/drivers/uwb/allocator.c | |||
@@ -334,10 +334,8 @@ int uwb_rsv_find_best_allocation(struct uwb_rsv *rsv, struct uwb_mas_bm *availab | |||
334 | 334 | ||
335 | 335 | ||
336 | /* fill the not available vector from the available bm */ | 336 | /* fill the not available vector from the available bm */ |
337 | for (bit_index = 0; bit_index < UWB_NUM_MAS; bit_index++) { | 337 | for_each_clear_bit(bit_index, available->bm, UWB_NUM_MAS) |
338 | if (!test_bit(bit_index, available->bm)) | 338 | ai->bm[bit_index] = UWB_RSV_MAS_NOT_AVAIL; |
339 | ai->bm[bit_index] = UWB_RSV_MAS_NOT_AVAIL; | ||
340 | } | ||
341 | 339 | ||
342 | if (ai->max_interval == 1) { | 340 | if (ai->max_interval == 1) { |
343 | get_row_descriptors(ai); | 341 | get_row_descriptors(ai); |
diff --git a/drivers/video/backlight/88pm860x_bl.c b/drivers/video/backlight/88pm860x_bl.c index a1376dc73d71..915943af3f21 100644 --- a/drivers/video/backlight/88pm860x_bl.c +++ b/drivers/video/backlight/88pm860x_bl.c | |||
@@ -187,7 +187,8 @@ static int pm860x_backlight_probe(struct platform_device *pdev) | |||
187 | return -EINVAL; | 187 | return -EINVAL; |
188 | } | 188 | } |
189 | 189 | ||
190 | data = kzalloc(sizeof(struct pm860x_backlight_data), GFP_KERNEL); | 190 | data = devm_kzalloc(&pdev->dev, sizeof(struct pm860x_backlight_data), |
191 | GFP_KERNEL); | ||
191 | if (data == NULL) | 192 | if (data == NULL) |
192 | return -ENOMEM; | 193 | return -ENOMEM; |
193 | strncpy(name, res->name, MFD_NAME_SIZE); | 194 | strncpy(name, res->name, MFD_NAME_SIZE); |
@@ -200,7 +201,6 @@ static int pm860x_backlight_probe(struct platform_device *pdev) | |||
200 | data->port = pdata->flags; | 201 | data->port = pdata->flags; |
201 | if (data->port < 0) { | 202 | if (data->port < 0) { |
202 | dev_err(&pdev->dev, "wrong platform data is assigned"); | 203 | dev_err(&pdev->dev, "wrong platform data is assigned"); |
203 | kfree(data); | ||
204 | return -EINVAL; | 204 | return -EINVAL; |
205 | } | 205 | } |
206 | 206 | ||
@@ -211,7 +211,6 @@ static int pm860x_backlight_probe(struct platform_device *pdev) | |||
211 | &pm860x_backlight_ops, &props); | 211 | &pm860x_backlight_ops, &props); |
212 | if (IS_ERR(bl)) { | 212 | if (IS_ERR(bl)) { |
213 | dev_err(&pdev->dev, "failed to register backlight\n"); | 213 | dev_err(&pdev->dev, "failed to register backlight\n"); |
214 | kfree(data); | ||
215 | return PTR_ERR(bl); | 214 | return PTR_ERR(bl); |
216 | } | 215 | } |
217 | bl->props.brightness = MAX_BRIGHTNESS; | 216 | bl->props.brightness = MAX_BRIGHTNESS; |
@@ -247,17 +246,14 @@ static int pm860x_backlight_probe(struct platform_device *pdev) | |||
247 | return 0; | 246 | return 0; |
248 | out: | 247 | out: |
249 | backlight_device_unregister(bl); | 248 | backlight_device_unregister(bl); |
250 | kfree(data); | ||
251 | return ret; | 249 | return ret; |
252 | } | 250 | } |
253 | 251 | ||
254 | static int pm860x_backlight_remove(struct platform_device *pdev) | 252 | static int pm860x_backlight_remove(struct platform_device *pdev) |
255 | { | 253 | { |
256 | struct backlight_device *bl = platform_get_drvdata(pdev); | 254 | struct backlight_device *bl = platform_get_drvdata(pdev); |
257 | struct pm860x_backlight_data *data = bl_get_data(bl); | ||
258 | 255 | ||
259 | backlight_device_unregister(bl); | 256 | backlight_device_unregister(bl); |
260 | kfree(data); | ||
261 | return 0; | 257 | return 0; |
262 | } | 258 | } |
263 | 259 | ||
diff --git a/drivers/video/backlight/Kconfig b/drivers/video/backlight/Kconfig index 681b36929fe4..7ed9991fa747 100644 --- a/drivers/video/backlight/Kconfig +++ b/drivers/video/backlight/Kconfig | |||
@@ -334,6 +334,27 @@ config BACKLIGHT_AAT2870 | |||
334 | If you have a AnalogicTech AAT2870 say Y to enable the | 334 | If you have a AnalogicTech AAT2870 say Y to enable the |
335 | backlight driver. | 335 | backlight driver. |
336 | 336 | ||
337 | config BACKLIGHT_LP855X | ||
338 | tristate "Backlight driver for TI LP855X" | ||
339 | depends on BACKLIGHT_CLASS_DEVICE && I2C | ||
340 | help | ||
341 | This supports TI LP8550, LP8551, LP8552, LP8553 and LP8556 | ||
342 | backlight driver. | ||
343 | |||
344 | config BACKLIGHT_OT200 | ||
345 | tristate "Backlight driver for ot200 visualisation device" | ||
346 | depends on BACKLIGHT_CLASS_DEVICE && CS5535_MFGPT && GPIO_CS5535 | ||
347 | help | ||
348 | To compile this driver as a module, choose M here: the module will be | ||
349 | called ot200_bl. | ||
350 | |||
351 | config BACKLIGHT_PANDORA | ||
352 | tristate "Backlight driver for Pandora console" | ||
353 | depends on TWL4030_CORE | ||
354 | help | ||
355 | If you have a Pandora console, say Y to enable the | ||
356 | backlight driver. | ||
357 | |||
337 | endif # BACKLIGHT_CLASS_DEVICE | 358 | endif # BACKLIGHT_CLASS_DEVICE |
338 | 359 | ||
339 | endif # BACKLIGHT_LCD_SUPPORT | 360 | endif # BACKLIGHT_LCD_SUPPORT |
diff --git a/drivers/video/backlight/Makefile b/drivers/video/backlight/Makefile index af5cf654ec7c..8071eb656147 100644 --- a/drivers/video/backlight/Makefile +++ b/drivers/video/backlight/Makefile | |||
@@ -22,7 +22,9 @@ obj-$(CONFIG_BACKLIGHT_GENERIC) += generic_bl.o | |||
22 | obj-$(CONFIG_BACKLIGHT_HP700) += jornada720_bl.o | 22 | obj-$(CONFIG_BACKLIGHT_HP700) += jornada720_bl.o |
23 | obj-$(CONFIG_BACKLIGHT_HP680) += hp680_bl.o | 23 | obj-$(CONFIG_BACKLIGHT_HP680) += hp680_bl.o |
24 | obj-$(CONFIG_BACKLIGHT_LOCOMO) += locomolcd.o | 24 | obj-$(CONFIG_BACKLIGHT_LOCOMO) += locomolcd.o |
25 | obj-$(CONFIG_BACKLIGHT_LP855X) += lp855x_bl.o | ||
25 | obj-$(CONFIG_BACKLIGHT_OMAP1) += omap1_bl.o | 26 | obj-$(CONFIG_BACKLIGHT_OMAP1) += omap1_bl.o |
27 | obj-$(CONFIG_BACKLIGHT_PANDORA) += pandora_bl.o | ||
26 | obj-$(CONFIG_BACKLIGHT_PROGEAR) += progear_bl.o | 28 | obj-$(CONFIG_BACKLIGHT_PROGEAR) += progear_bl.o |
27 | obj-$(CONFIG_BACKLIGHT_CARILLO_RANCH) += cr_bllcd.o | 29 | obj-$(CONFIG_BACKLIGHT_CARILLO_RANCH) += cr_bllcd.o |
28 | obj-$(CONFIG_BACKLIGHT_PWM) += pwm_bl.o | 30 | obj-$(CONFIG_BACKLIGHT_PWM) += pwm_bl.o |
@@ -38,4 +40,4 @@ obj-$(CONFIG_BACKLIGHT_ADP8870) += adp8870_bl.o | |||
38 | obj-$(CONFIG_BACKLIGHT_88PM860X) += 88pm860x_bl.o | 40 | obj-$(CONFIG_BACKLIGHT_88PM860X) += 88pm860x_bl.o |
39 | obj-$(CONFIG_BACKLIGHT_PCF50633) += pcf50633-backlight.o | 41 | obj-$(CONFIG_BACKLIGHT_PCF50633) += pcf50633-backlight.o |
40 | obj-$(CONFIG_BACKLIGHT_AAT2870) += aat2870_bl.o | 42 | obj-$(CONFIG_BACKLIGHT_AAT2870) += aat2870_bl.o |
41 | 43 | obj-$(CONFIG_BACKLIGHT_OT200) += ot200_bl.o | |
diff --git a/drivers/video/backlight/aat2870_bl.c b/drivers/video/backlight/aat2870_bl.c index 331f1ef1dad5..7ff752288b92 100644 --- a/drivers/video/backlight/aat2870_bl.c +++ b/drivers/video/backlight/aat2870_bl.c | |||
@@ -145,7 +145,9 @@ static int aat2870_bl_probe(struct platform_device *pdev) | |||
145 | goto out; | 145 | goto out; |
146 | } | 146 | } |
147 | 147 | ||
148 | aat2870_bl = kzalloc(sizeof(struct aat2870_bl_driver_data), GFP_KERNEL); | 148 | aat2870_bl = devm_kzalloc(&pdev->dev, |
149 | sizeof(struct aat2870_bl_driver_data), | ||
150 | GFP_KERNEL); | ||
149 | if (!aat2870_bl) { | 151 | if (!aat2870_bl) { |
150 | dev_err(&pdev->dev, | 152 | dev_err(&pdev->dev, |
151 | "Failed to allocate memory for aat2870 backlight\n"); | 153 | "Failed to allocate memory for aat2870 backlight\n"); |
@@ -162,7 +164,7 @@ static int aat2870_bl_probe(struct platform_device *pdev) | |||
162 | dev_err(&pdev->dev, | 164 | dev_err(&pdev->dev, |
163 | "Failed allocate memory for backlight device\n"); | 165 | "Failed allocate memory for backlight device\n"); |
164 | ret = PTR_ERR(bd); | 166 | ret = PTR_ERR(bd); |
165 | goto out_kfree; | 167 | goto out; |
166 | } | 168 | } |
167 | 169 | ||
168 | aat2870_bl->pdev = pdev; | 170 | aat2870_bl->pdev = pdev; |
@@ -199,8 +201,6 @@ static int aat2870_bl_probe(struct platform_device *pdev) | |||
199 | 201 | ||
200 | out_bl_dev_unregister: | 202 | out_bl_dev_unregister: |
201 | backlight_device_unregister(bd); | 203 | backlight_device_unregister(bd); |
202 | out_kfree: | ||
203 | kfree(aat2870_bl); | ||
204 | out: | 204 | out: |
205 | return ret; | 205 | return ret; |
206 | } | 206 | } |
@@ -215,7 +215,6 @@ static int aat2870_bl_remove(struct platform_device *pdev) | |||
215 | backlight_update_status(bd); | 215 | backlight_update_status(bd); |
216 | 216 | ||
217 | backlight_device_unregister(bd); | 217 | backlight_device_unregister(bd); |
218 | kfree(aat2870_bl); | ||
219 | 218 | ||
220 | return 0; | 219 | return 0; |
221 | } | 220 | } |
diff --git a/drivers/video/backlight/adp5520_bl.c b/drivers/video/backlight/adp5520_bl.c index 2e630bf1164c..4911ea7989c8 100644 --- a/drivers/video/backlight/adp5520_bl.c +++ b/drivers/video/backlight/adp5520_bl.c | |||
@@ -289,7 +289,7 @@ static int __devinit adp5520_bl_probe(struct platform_device *pdev) | |||
289 | struct adp5520_bl *data; | 289 | struct adp5520_bl *data; |
290 | int ret = 0; | 290 | int ret = 0; |
291 | 291 | ||
292 | data = kzalloc(sizeof(*data), GFP_KERNEL); | 292 | data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL); |
293 | if (data == NULL) | 293 | if (data == NULL) |
294 | return -ENOMEM; | 294 | return -ENOMEM; |
295 | 295 | ||
@@ -298,7 +298,6 @@ static int __devinit adp5520_bl_probe(struct platform_device *pdev) | |||
298 | 298 | ||
299 | if (data->pdata == NULL) { | 299 | if (data->pdata == NULL) { |
300 | dev_err(&pdev->dev, "missing platform data\n"); | 300 | dev_err(&pdev->dev, "missing platform data\n"); |
301 | kfree(data); | ||
302 | return -ENODEV; | 301 | return -ENODEV; |
303 | } | 302 | } |
304 | 303 | ||
@@ -314,7 +313,6 @@ static int __devinit adp5520_bl_probe(struct platform_device *pdev) | |||
314 | &adp5520_bl_ops, &props); | 313 | &adp5520_bl_ops, &props); |
315 | if (IS_ERR(bl)) { | 314 | if (IS_ERR(bl)) { |
316 | dev_err(&pdev->dev, "failed to register backlight\n"); | 315 | dev_err(&pdev->dev, "failed to register backlight\n"); |
317 | kfree(data); | ||
318 | return PTR_ERR(bl); | 316 | return PTR_ERR(bl); |
319 | } | 317 | } |
320 | 318 | ||
@@ -326,7 +324,6 @@ static int __devinit adp5520_bl_probe(struct platform_device *pdev) | |||
326 | if (ret) { | 324 | if (ret) { |
327 | dev_err(&pdev->dev, "failed to register sysfs\n"); | 325 | dev_err(&pdev->dev, "failed to register sysfs\n"); |
328 | backlight_device_unregister(bl); | 326 | backlight_device_unregister(bl); |
329 | kfree(data); | ||
330 | } | 327 | } |
331 | 328 | ||
332 | platform_set_drvdata(pdev, bl); | 329 | platform_set_drvdata(pdev, bl); |
@@ -348,7 +345,6 @@ static int __devexit adp5520_bl_remove(struct platform_device *pdev) | |||
348 | &adp5520_bl_attr_group); | 345 | &adp5520_bl_attr_group); |
349 | 346 | ||
350 | backlight_device_unregister(bl); | 347 | backlight_device_unregister(bl); |
351 | kfree(data); | ||
352 | 348 | ||
353 | return 0; | 349 | return 0; |
354 | } | 350 | } |
diff --git a/drivers/video/backlight/adp8860_bl.c b/drivers/video/backlight/adp8860_bl.c index 378276c9d3cf..550dbf0bb896 100644 --- a/drivers/video/backlight/adp8860_bl.c +++ b/drivers/video/backlight/adp8860_bl.c | |||
@@ -819,17 +819,7 @@ static struct i2c_driver adp8860_driver = { | |||
819 | .id_table = adp8860_id, | 819 | .id_table = adp8860_id, |
820 | }; | 820 | }; |
821 | 821 | ||
822 | static int __init adp8860_init(void) | 822 | module_i2c_driver(adp8860_driver); |
823 | { | ||
824 | return i2c_add_driver(&adp8860_driver); | ||
825 | } | ||
826 | module_init(adp8860_init); | ||
827 | |||
828 | static void __exit adp8860_exit(void) | ||
829 | { | ||
830 | i2c_del_driver(&adp8860_driver); | ||
831 | } | ||
832 | module_exit(adp8860_exit); | ||
833 | 823 | ||
834 | MODULE_LICENSE("GPL v2"); | 824 | MODULE_LICENSE("GPL v2"); |
835 | MODULE_AUTHOR("Michael Hennerich <hennerich@blackfin.uclinux.org>"); | 825 | MODULE_AUTHOR("Michael Hennerich <hennerich@blackfin.uclinux.org>"); |
diff --git a/drivers/video/backlight/adp8870_bl.c b/drivers/video/backlight/adp8870_bl.c index 6735059376d6..9be58c6f18f1 100644 --- a/drivers/video/backlight/adp8870_bl.c +++ b/drivers/video/backlight/adp8870_bl.c | |||
@@ -991,17 +991,7 @@ static struct i2c_driver adp8870_driver = { | |||
991 | .id_table = adp8870_id, | 991 | .id_table = adp8870_id, |
992 | }; | 992 | }; |
993 | 993 | ||
994 | static int __init adp8870_init(void) | 994 | module_i2c_driver(adp8870_driver); |
995 | { | ||
996 | return i2c_add_driver(&adp8870_driver); | ||
997 | } | ||
998 | module_init(adp8870_init); | ||
999 | |||
1000 | static void __exit adp8870_exit(void) | ||
1001 | { | ||
1002 | i2c_del_driver(&adp8870_driver); | ||
1003 | } | ||
1004 | module_exit(adp8870_exit); | ||
1005 | 995 | ||
1006 | MODULE_LICENSE("GPL v2"); | 996 | MODULE_LICENSE("GPL v2"); |
1007 | MODULE_AUTHOR("Michael Hennerich <hennerich@blackfin.uclinux.org>"); | 997 | MODULE_AUTHOR("Michael Hennerich <hennerich@blackfin.uclinux.org>"); |
diff --git a/drivers/video/backlight/ams369fg06.c b/drivers/video/backlight/ams369fg06.c index 7838a23fbdd1..7bdadc790117 100644 --- a/drivers/video/backlight/ams369fg06.c +++ b/drivers/video/backlight/ams369fg06.c | |||
@@ -629,18 +629,7 @@ static struct spi_driver ams369fg06_driver = { | |||
629 | .resume = ams369fg06_resume, | 629 | .resume = ams369fg06_resume, |
630 | }; | 630 | }; |
631 | 631 | ||
632 | static int __init ams369fg06_init(void) | 632 | module_spi_driver(ams369fg06_driver); |
633 | { | ||
634 | return spi_register_driver(&ams369fg06_driver); | ||
635 | } | ||
636 | |||
637 | static void __exit ams369fg06_exit(void) | ||
638 | { | ||
639 | spi_unregister_driver(&ams369fg06_driver); | ||
640 | } | ||
641 | |||
642 | module_init(ams369fg06_init); | ||
643 | module_exit(ams369fg06_exit); | ||
644 | 633 | ||
645 | MODULE_AUTHOR("Jingoo Han <jg1.han@samsung.com>"); | 634 | MODULE_AUTHOR("Jingoo Han <jg1.han@samsung.com>"); |
646 | MODULE_DESCRIPTION("ams369fg06 LCD Driver"); | 635 | MODULE_DESCRIPTION("ams369fg06 LCD Driver"); |
diff --git a/drivers/video/backlight/corgi_lcd.c b/drivers/video/backlight/corgi_lcd.c index c6533bad26f8..6dab13fe562e 100644 --- a/drivers/video/backlight/corgi_lcd.c +++ b/drivers/video/backlight/corgi_lcd.c | |||
@@ -629,17 +629,7 @@ static struct spi_driver corgi_lcd_driver = { | |||
629 | .resume = corgi_lcd_resume, | 629 | .resume = corgi_lcd_resume, |
630 | }; | 630 | }; |
631 | 631 | ||
632 | static int __init corgi_lcd_init(void) | 632 | module_spi_driver(corgi_lcd_driver); |
633 | { | ||
634 | return spi_register_driver(&corgi_lcd_driver); | ||
635 | } | ||
636 | module_init(corgi_lcd_init); | ||
637 | |||
638 | static void __exit corgi_lcd_exit(void) | ||
639 | { | ||
640 | spi_unregister_driver(&corgi_lcd_driver); | ||
641 | } | ||
642 | module_exit(corgi_lcd_exit); | ||
643 | 633 | ||
644 | MODULE_DESCRIPTION("LCD and backlight driver for SHARP C7x0/Cxx00"); | 634 | MODULE_DESCRIPTION("LCD and backlight driver for SHARP C7x0/Cxx00"); |
645 | MODULE_AUTHOR("Eric Miao <eric.miao@marvell.com>"); | 635 | MODULE_AUTHOR("Eric Miao <eric.miao@marvell.com>"); |
diff --git a/drivers/video/backlight/cr_bllcd.c b/drivers/video/backlight/cr_bllcd.c index 6c8c54041fae..22489eb5f3e0 100644 --- a/drivers/video/backlight/cr_bllcd.c +++ b/drivers/video/backlight/cr_bllcd.c | |||
@@ -212,7 +212,7 @@ static int cr_backlight_probe(struct platform_device *pdev) | |||
212 | &gpio_bar); | 212 | &gpio_bar); |
213 | gpio_bar &= ~0x3F; | 213 | gpio_bar &= ~0x3F; |
214 | 214 | ||
215 | crp = kzalloc(sizeof(*crp), GFP_KERNEL); | 215 | crp = devm_kzalloc(&pdev->dev, sizeof(*crp), GFP_KERNEL); |
216 | if (!crp) { | 216 | if (!crp) { |
217 | lcd_device_unregister(ldp); | 217 | lcd_device_unregister(ldp); |
218 | backlight_device_unregister(bdp); | 218 | backlight_device_unregister(bdp); |
@@ -243,7 +243,6 @@ static int cr_backlight_remove(struct platform_device *pdev) | |||
243 | backlight_device_unregister(crp->cr_backlight_device); | 243 | backlight_device_unregister(crp->cr_backlight_device); |
244 | lcd_device_unregister(crp->cr_lcd_device); | 244 | lcd_device_unregister(crp->cr_lcd_device); |
245 | pci_dev_put(lpc_dev); | 245 | pci_dev_put(lpc_dev); |
246 | kfree(crp); | ||
247 | 246 | ||
248 | return 0; | 247 | return 0; |
249 | } | 248 | } |
diff --git a/drivers/video/backlight/da903x_bl.c b/drivers/video/backlight/da903x_bl.c index abb4a06268f1..30e19681a30b 100644 --- a/drivers/video/backlight/da903x_bl.c +++ b/drivers/video/backlight/da903x_bl.c | |||
@@ -110,7 +110,7 @@ static int da903x_backlight_probe(struct platform_device *pdev) | |||
110 | struct backlight_properties props; | 110 | struct backlight_properties props; |
111 | int max_brightness; | 111 | int max_brightness; |
112 | 112 | ||
113 | data = kzalloc(sizeof(*data), GFP_KERNEL); | 113 | data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL); |
114 | if (data == NULL) | 114 | if (data == NULL) |
115 | return -ENOMEM; | 115 | return -ENOMEM; |
116 | 116 | ||
@@ -124,7 +124,6 @@ static int da903x_backlight_probe(struct platform_device *pdev) | |||
124 | default: | 124 | default: |
125 | dev_err(&pdev->dev, "invalid backlight device ID(%d)\n", | 125 | dev_err(&pdev->dev, "invalid backlight device ID(%d)\n", |
126 | pdev->id); | 126 | pdev->id); |
127 | kfree(data); | ||
128 | return -EINVAL; | 127 | return -EINVAL; |
129 | } | 128 | } |
130 | 129 | ||
@@ -143,7 +142,6 @@ static int da903x_backlight_probe(struct platform_device *pdev) | |||
143 | &da903x_backlight_ops, &props); | 142 | &da903x_backlight_ops, &props); |
144 | if (IS_ERR(bl)) { | 143 | if (IS_ERR(bl)) { |
145 | dev_err(&pdev->dev, "failed to register backlight\n"); | 144 | dev_err(&pdev->dev, "failed to register backlight\n"); |
146 | kfree(data); | ||
147 | return PTR_ERR(bl); | 145 | return PTR_ERR(bl); |
148 | } | 146 | } |
149 | 147 | ||
@@ -157,10 +155,8 @@ static int da903x_backlight_probe(struct platform_device *pdev) | |||
157 | static int da903x_backlight_remove(struct platform_device *pdev) | 155 | static int da903x_backlight_remove(struct platform_device *pdev) |
158 | { | 156 | { |
159 | struct backlight_device *bl = platform_get_drvdata(pdev); | 157 | struct backlight_device *bl = platform_get_drvdata(pdev); |
160 | struct da903x_backlight_data *data = bl_get_data(bl); | ||
161 | 158 | ||
162 | backlight_device_unregister(bl); | 159 | backlight_device_unregister(bl); |
163 | kfree(data); | ||
164 | return 0; | 160 | return 0; |
165 | } | 161 | } |
166 | 162 | ||
diff --git a/drivers/video/backlight/l4f00242t03.c b/drivers/video/backlight/l4f00242t03.c index 27d1d7a29c77..6022b67285ec 100644 --- a/drivers/video/backlight/l4f00242t03.c +++ b/drivers/video/backlight/l4f00242t03.c | |||
@@ -274,18 +274,7 @@ static struct spi_driver l4f00242t03_driver = { | |||
274 | .shutdown = l4f00242t03_shutdown, | 274 | .shutdown = l4f00242t03_shutdown, |
275 | }; | 275 | }; |
276 | 276 | ||
277 | static __init int l4f00242t03_init(void) | 277 | module_spi_driver(l4f00242t03_driver); |
278 | { | ||
279 | return spi_register_driver(&l4f00242t03_driver); | ||
280 | } | ||
281 | |||
282 | static __exit void l4f00242t03_exit(void) | ||
283 | { | ||
284 | spi_unregister_driver(&l4f00242t03_driver); | ||
285 | } | ||
286 | |||
287 | module_init(l4f00242t03_init); | ||
288 | module_exit(l4f00242t03_exit); | ||
289 | 278 | ||
290 | MODULE_AUTHOR("Alberto Panizzo <maramaopercheseimorto@gmail.com>"); | 279 | MODULE_AUTHOR("Alberto Panizzo <maramaopercheseimorto@gmail.com>"); |
291 | MODULE_DESCRIPTION("EPSON L4F00242T03 LCD"); | 280 | MODULE_DESCRIPTION("EPSON L4F00242T03 LCD"); |
diff --git a/drivers/video/backlight/ld9040.c b/drivers/video/backlight/ld9040.c index 78dafc0c8fc5..efd352be21ae 100644 --- a/drivers/video/backlight/ld9040.c +++ b/drivers/video/backlight/ld9040.c | |||
@@ -856,18 +856,7 @@ static struct spi_driver ld9040_driver = { | |||
856 | .resume = ld9040_resume, | 856 | .resume = ld9040_resume, |
857 | }; | 857 | }; |
858 | 858 | ||
859 | static int __init ld9040_init(void) | 859 | module_spi_driver(ld9040_driver); |
860 | { | ||
861 | return spi_register_driver(&ld9040_driver); | ||
862 | } | ||
863 | |||
864 | static void __exit ld9040_exit(void) | ||
865 | { | ||
866 | spi_unregister_driver(&ld9040_driver); | ||
867 | } | ||
868 | |||
869 | module_init(ld9040_init); | ||
870 | module_exit(ld9040_exit); | ||
871 | 860 | ||
872 | MODULE_AUTHOR("Donghwa Lee <dh09.lee@samsung.com>"); | 861 | MODULE_AUTHOR("Donghwa Lee <dh09.lee@samsung.com>"); |
873 | MODULE_DESCRIPTION("ld9040 LCD Driver"); | 862 | MODULE_DESCRIPTION("ld9040 LCD Driver"); |
diff --git a/drivers/video/backlight/lms283gf05.c b/drivers/video/backlight/lms283gf05.c index 4ec78cfe26ea..4161f9e3982a 100644 --- a/drivers/video/backlight/lms283gf05.c +++ b/drivers/video/backlight/lms283gf05.c | |||
@@ -226,18 +226,7 @@ static struct spi_driver lms283gf05_driver = { | |||
226 | .remove = __devexit_p(lms283gf05_remove), | 226 | .remove = __devexit_p(lms283gf05_remove), |
227 | }; | 227 | }; |
228 | 228 | ||
229 | static __init int lms283gf05_init(void) | 229 | module_spi_driver(lms283gf05_driver); |
230 | { | ||
231 | return spi_register_driver(&lms283gf05_driver); | ||
232 | } | ||
233 | |||
234 | static __exit void lms283gf05_exit(void) | ||
235 | { | ||
236 | spi_unregister_driver(&lms283gf05_driver); | ||
237 | } | ||
238 | |||
239 | module_init(lms283gf05_init); | ||
240 | module_exit(lms283gf05_exit); | ||
241 | 230 | ||
242 | MODULE_AUTHOR("Marek Vasut <marek.vasut@gmail.com>"); | 231 | MODULE_AUTHOR("Marek Vasut <marek.vasut@gmail.com>"); |
243 | MODULE_DESCRIPTION("LCD283GF05 LCD"); | 232 | MODULE_DESCRIPTION("LCD283GF05 LCD"); |
diff --git a/drivers/video/backlight/lp855x_bl.c b/drivers/video/backlight/lp855x_bl.c new file mode 100644 index 000000000000..72a0e0c917cf --- /dev/null +++ b/drivers/video/backlight/lp855x_bl.c | |||
@@ -0,0 +1,331 @@ | |||
1 | /* | ||
2 | * TI LP855x Backlight Driver | ||
3 | * | ||
4 | * Copyright (C) 2011 Texas Instruments | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License version 2 as | ||
8 | * published by the Free Software Foundation. | ||
9 | * | ||
10 | */ | ||
11 | |||
12 | #include <linux/module.h> | ||
13 | #include <linux/slab.h> | ||
14 | #include <linux/i2c.h> | ||
15 | #include <linux/backlight.h> | ||
16 | #include <linux/err.h> | ||
17 | #include <linux/lp855x.h> | ||
18 | |||
19 | /* Registers */ | ||
20 | #define BRIGHTNESS_CTRL (0x00) | ||
21 | #define DEVICE_CTRL (0x01) | ||
22 | |||
23 | #define BUF_SIZE 20 | ||
24 | #define DEFAULT_BL_NAME "lcd-backlight" | ||
25 | #define MAX_BRIGHTNESS 255 | ||
26 | |||
27 | struct lp855x { | ||
28 | const char *chipname; | ||
29 | enum lp855x_chip_id chip_id; | ||
30 | struct i2c_client *client; | ||
31 | struct backlight_device *bl; | ||
32 | struct device *dev; | ||
33 | struct mutex xfer_lock; | ||
34 | struct lp855x_platform_data *pdata; | ||
35 | }; | ||
36 | |||
37 | static int lp855x_read_byte(struct lp855x *lp, u8 reg, u8 *data) | ||
38 | { | ||
39 | int ret; | ||
40 | |||
41 | mutex_lock(&lp->xfer_lock); | ||
42 | ret = i2c_smbus_read_byte_data(lp->client, reg); | ||
43 | if (ret < 0) { | ||
44 | mutex_unlock(&lp->xfer_lock); | ||
45 | dev_err(lp->dev, "failed to read 0x%.2x\n", reg); | ||
46 | return ret; | ||
47 | } | ||
48 | mutex_unlock(&lp->xfer_lock); | ||
49 | |||
50 | *data = (u8)ret; | ||
51 | return 0; | ||
52 | } | ||
53 | |||
54 | static int lp855x_write_byte(struct lp855x *lp, u8 reg, u8 data) | ||
55 | { | ||
56 | int ret; | ||
57 | |||
58 | mutex_lock(&lp->xfer_lock); | ||
59 | ret = i2c_smbus_write_byte_data(lp->client, reg, data); | ||
60 | mutex_unlock(&lp->xfer_lock); | ||
61 | |||
62 | return ret; | ||
63 | } | ||
64 | |||
65 | static bool lp855x_is_valid_rom_area(struct lp855x *lp, u8 addr) | ||
66 | { | ||
67 | u8 start, end; | ||
68 | |||
69 | switch (lp->chip_id) { | ||
70 | case LP8550: | ||
71 | case LP8551: | ||
72 | case LP8552: | ||
73 | case LP8553: | ||
74 | start = EEPROM_START; | ||
75 | end = EEPROM_END; | ||
76 | break; | ||
77 | case LP8556: | ||
78 | start = EPROM_START; | ||
79 | end = EPROM_END; | ||
80 | break; | ||
81 | default: | ||
82 | return false; | ||
83 | } | ||
84 | |||
85 | return (addr >= start && addr <= end); | ||
86 | } | ||
87 | |||
88 | static int lp855x_init_registers(struct lp855x *lp) | ||
89 | { | ||
90 | u8 val, addr; | ||
91 | int i, ret; | ||
92 | struct lp855x_platform_data *pd = lp->pdata; | ||
93 | |||
94 | val = pd->initial_brightness; | ||
95 | ret = lp855x_write_byte(lp, BRIGHTNESS_CTRL, val); | ||
96 | if (ret) | ||
97 | return ret; | ||
98 | |||
99 | val = pd->device_control; | ||
100 | ret = lp855x_write_byte(lp, DEVICE_CTRL, val); | ||
101 | if (ret) | ||
102 | return ret; | ||
103 | |||
104 | if (pd->load_new_rom_data && pd->size_program) { | ||
105 | for (i = 0; i < pd->size_program; i++) { | ||
106 | addr = pd->rom_data[i].addr; | ||
107 | val = pd->rom_data[i].val; | ||
108 | if (!lp855x_is_valid_rom_area(lp, addr)) | ||
109 | continue; | ||
110 | |||
111 | ret = lp855x_write_byte(lp, addr, val); | ||
112 | if (ret) | ||
113 | return ret; | ||
114 | } | ||
115 | } | ||
116 | |||
117 | return ret; | ||
118 | } | ||
119 | |||
120 | static int lp855x_bl_update_status(struct backlight_device *bl) | ||
121 | { | ||
122 | struct lp855x *lp = bl_get_data(bl); | ||
123 | enum lp855x_brightness_ctrl_mode mode = lp->pdata->mode; | ||
124 | |||
125 | if (bl->props.state & BL_CORE_SUSPENDED) | ||
126 | bl->props.brightness = 0; | ||
127 | |||
128 | if (mode == PWM_BASED) { | ||
129 | struct lp855x_pwm_data *pd = &lp->pdata->pwm_data; | ||
130 | int br = bl->props.brightness; | ||
131 | int max_br = bl->props.max_brightness; | ||
132 | |||
133 | if (pd->pwm_set_intensity) | ||
134 | pd->pwm_set_intensity(br, max_br); | ||
135 | |||
136 | } else if (mode == REGISTER_BASED) { | ||
137 | u8 val = bl->props.brightness; | ||
138 | lp855x_write_byte(lp, BRIGHTNESS_CTRL, val); | ||
139 | } | ||
140 | |||
141 | return 0; | ||
142 | } | ||
143 | |||
144 | static int lp855x_bl_get_brightness(struct backlight_device *bl) | ||
145 | { | ||
146 | struct lp855x *lp = bl_get_data(bl); | ||
147 | enum lp855x_brightness_ctrl_mode mode = lp->pdata->mode; | ||
148 | |||
149 | if (mode == PWM_BASED) { | ||
150 | struct lp855x_pwm_data *pd = &lp->pdata->pwm_data; | ||
151 | int max_br = bl->props.max_brightness; | ||
152 | |||
153 | if (pd->pwm_get_intensity) | ||
154 | bl->props.brightness = pd->pwm_get_intensity(max_br); | ||
155 | |||
156 | } else if (mode == REGISTER_BASED) { | ||
157 | u8 val = 0; | ||
158 | |||
159 | lp855x_read_byte(lp, BRIGHTNESS_CTRL, &val); | ||
160 | bl->props.brightness = val; | ||
161 | } | ||
162 | |||
163 | return bl->props.brightness; | ||
164 | } | ||
165 | |||
166 | static const struct backlight_ops lp855x_bl_ops = { | ||
167 | .options = BL_CORE_SUSPENDRESUME, | ||
168 | .update_status = lp855x_bl_update_status, | ||
169 | .get_brightness = lp855x_bl_get_brightness, | ||
170 | }; | ||
171 | |||
172 | static int lp855x_backlight_register(struct lp855x *lp) | ||
173 | { | ||
174 | struct backlight_device *bl; | ||
175 | struct backlight_properties props; | ||
176 | struct lp855x_platform_data *pdata = lp->pdata; | ||
177 | char *name = pdata->name ? : DEFAULT_BL_NAME; | ||
178 | |||
179 | props.type = BACKLIGHT_PLATFORM; | ||
180 | props.max_brightness = MAX_BRIGHTNESS; | ||
181 | |||
182 | if (pdata->initial_brightness > props.max_brightness) | ||
183 | pdata->initial_brightness = props.max_brightness; | ||
184 | |||
185 | props.brightness = pdata->initial_brightness; | ||
186 | |||
187 | bl = backlight_device_register(name, lp->dev, lp, | ||
188 | &lp855x_bl_ops, &props); | ||
189 | if (IS_ERR(bl)) | ||
190 | return PTR_ERR(bl); | ||
191 | |||
192 | lp->bl = bl; | ||
193 | |||
194 | return 0; | ||
195 | } | ||
196 | |||
197 | static void lp855x_backlight_unregister(struct lp855x *lp) | ||
198 | { | ||
199 | if (lp->bl) | ||
200 | backlight_device_unregister(lp->bl); | ||
201 | } | ||
202 | |||
203 | static ssize_t lp855x_get_chip_id(struct device *dev, | ||
204 | struct device_attribute *attr, char *buf) | ||
205 | { | ||
206 | struct lp855x *lp = dev_get_drvdata(dev); | ||
207 | return scnprintf(buf, BUF_SIZE, "%s\n", lp->chipname); | ||
208 | } | ||
209 | |||
210 | static ssize_t lp855x_get_bl_ctl_mode(struct device *dev, | ||
211 | struct device_attribute *attr, char *buf) | ||
212 | { | ||
213 | struct lp855x *lp = dev_get_drvdata(dev); | ||
214 | enum lp855x_brightness_ctrl_mode mode = lp->pdata->mode; | ||
215 | char *strmode = NULL; | ||
216 | |||
217 | if (mode == PWM_BASED) | ||
218 | strmode = "pwm based"; | ||
219 | else if (mode == REGISTER_BASED) | ||
220 | strmode = "register based"; | ||
221 | |||
222 | return scnprintf(buf, BUF_SIZE, "%s\n", strmode); | ||
223 | } | ||
224 | |||
225 | static DEVICE_ATTR(chip_id, S_IRUGO, lp855x_get_chip_id, NULL); | ||
226 | static DEVICE_ATTR(bl_ctl_mode, S_IRUGO, lp855x_get_bl_ctl_mode, NULL); | ||
227 | |||
228 | static struct attribute *lp855x_attributes[] = { | ||
229 | &dev_attr_chip_id.attr, | ||
230 | &dev_attr_bl_ctl_mode.attr, | ||
231 | NULL, | ||
232 | }; | ||
233 | |||
234 | static const struct attribute_group lp855x_attr_group = { | ||
235 | .attrs = lp855x_attributes, | ||
236 | }; | ||
237 | |||
238 | static int lp855x_probe(struct i2c_client *cl, const struct i2c_device_id *id) | ||
239 | { | ||
240 | struct lp855x *lp; | ||
241 | struct lp855x_platform_data *pdata = cl->dev.platform_data; | ||
242 | enum lp855x_brightness_ctrl_mode mode; | ||
243 | int ret; | ||
244 | |||
245 | if (!pdata) { | ||
246 | dev_err(&cl->dev, "no platform data supplied\n"); | ||
247 | return -EINVAL; | ||
248 | } | ||
249 | |||
250 | if (!i2c_check_functionality(cl->adapter, I2C_FUNC_SMBUS_I2C_BLOCK)) | ||
251 | return -EIO; | ||
252 | |||
253 | lp = devm_kzalloc(&cl->dev, sizeof(struct lp855x), GFP_KERNEL); | ||
254 | if (!lp) | ||
255 | return -ENOMEM; | ||
256 | |||
257 | mode = pdata->mode; | ||
258 | lp->client = cl; | ||
259 | lp->dev = &cl->dev; | ||
260 | lp->pdata = pdata; | ||
261 | lp->chipname = id->name; | ||
262 | lp->chip_id = id->driver_data; | ||
263 | i2c_set_clientdata(cl, lp); | ||
264 | |||
265 | mutex_init(&lp->xfer_lock); | ||
266 | |||
267 | ret = lp855x_init_registers(lp); | ||
268 | if (ret) { | ||
269 | dev_err(lp->dev, "i2c communication err: %d", ret); | ||
270 | if (mode == REGISTER_BASED) | ||
271 | goto err_dev; | ||
272 | } | ||
273 | |||
274 | ret = lp855x_backlight_register(lp); | ||
275 | if (ret) { | ||
276 | dev_err(lp->dev, | ||
277 | "failed to register backlight. err: %d\n", ret); | ||
278 | goto err_dev; | ||
279 | } | ||
280 | |||
281 | ret = sysfs_create_group(&lp->dev->kobj, &lp855x_attr_group); | ||
282 | if (ret) { | ||
283 | dev_err(lp->dev, "failed to register sysfs. err: %d\n", ret); | ||
284 | goto err_sysfs; | ||
285 | } | ||
286 | |||
287 | backlight_update_status(lp->bl); | ||
288 | return 0; | ||
289 | |||
290 | err_sysfs: | ||
291 | lp855x_backlight_unregister(lp); | ||
292 | err_dev: | ||
293 | return ret; | ||
294 | } | ||
295 | |||
296 | static int __devexit lp855x_remove(struct i2c_client *cl) | ||
297 | { | ||
298 | struct lp855x *lp = i2c_get_clientdata(cl); | ||
299 | |||
300 | lp->bl->props.brightness = 0; | ||
301 | backlight_update_status(lp->bl); | ||
302 | sysfs_remove_group(&lp->dev->kobj, &lp855x_attr_group); | ||
303 | lp855x_backlight_unregister(lp); | ||
304 | |||
305 | return 0; | ||
306 | } | ||
307 | |||
308 | static const struct i2c_device_id lp855x_ids[] = { | ||
309 | {"lp8550", LP8550}, | ||
310 | {"lp8551", LP8551}, | ||
311 | {"lp8552", LP8552}, | ||
312 | {"lp8553", LP8553}, | ||
313 | {"lp8556", LP8556}, | ||
314 | { } | ||
315 | }; | ||
316 | MODULE_DEVICE_TABLE(i2c, lp855x_ids); | ||
317 | |||
318 | static struct i2c_driver lp855x_driver = { | ||
319 | .driver = { | ||
320 | .name = "lp855x", | ||
321 | }, | ||
322 | .probe = lp855x_probe, | ||
323 | .remove = __devexit_p(lp855x_remove), | ||
324 | .id_table = lp855x_ids, | ||
325 | }; | ||
326 | |||
327 | module_i2c_driver(lp855x_driver); | ||
328 | |||
329 | MODULE_DESCRIPTION("Texas Instruments LP855x Backlight driver"); | ||
330 | MODULE_AUTHOR("Milo Kim <milo.kim@ti.com>"); | ||
331 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/video/backlight/ltv350qv.c b/drivers/video/backlight/ltv350qv.c index cca43c06d3c8..333949ff3265 100644 --- a/drivers/video/backlight/ltv350qv.c +++ b/drivers/video/backlight/ltv350qv.c | |||
@@ -321,17 +321,7 @@ static struct spi_driver ltv350qv_driver = { | |||
321 | .resume = ltv350qv_resume, | 321 | .resume = ltv350qv_resume, |
322 | }; | 322 | }; |
323 | 323 | ||
324 | static int __init ltv350qv_init(void) | 324 | module_spi_driver(ltv350qv_driver); |
325 | { | ||
326 | return spi_register_driver(<v350qv_driver); | ||
327 | } | ||
328 | |||
329 | static void __exit ltv350qv_exit(void) | ||
330 | { | ||
331 | spi_unregister_driver(<v350qv_driver); | ||
332 | } | ||
333 | module_init(ltv350qv_init); | ||
334 | module_exit(ltv350qv_exit); | ||
335 | 325 | ||
336 | MODULE_AUTHOR("Haavard Skinnemoen (Atmel)"); | 326 | MODULE_AUTHOR("Haavard Skinnemoen (Atmel)"); |
337 | MODULE_DESCRIPTION("Samsung LTV350QV LCD Driver"); | 327 | MODULE_DESCRIPTION("Samsung LTV350QV LCD Driver"); |
diff --git a/drivers/video/backlight/max8925_bl.c b/drivers/video/backlight/max8925_bl.c index c915e3b53886..e833ac72e063 100644 --- a/drivers/video/backlight/max8925_bl.c +++ b/drivers/video/backlight/max8925_bl.c | |||
@@ -129,7 +129,8 @@ static int __devinit max8925_backlight_probe(struct platform_device *pdev) | |||
129 | return -EINVAL; | 129 | return -EINVAL; |
130 | } | 130 | } |
131 | 131 | ||
132 | data = kzalloc(sizeof(struct max8925_backlight_data), GFP_KERNEL); | 132 | data = devm_kzalloc(&pdev->dev, sizeof(struct max8925_backlight_data), |
133 | GFP_KERNEL); | ||
133 | if (data == NULL) | 134 | if (data == NULL) |
134 | return -ENOMEM; | 135 | return -ENOMEM; |
135 | strncpy(name, res->name, MAX8925_NAME_SIZE); | 136 | strncpy(name, res->name, MAX8925_NAME_SIZE); |
@@ -143,7 +144,6 @@ static int __devinit max8925_backlight_probe(struct platform_device *pdev) | |||
143 | &max8925_backlight_ops, &props); | 144 | &max8925_backlight_ops, &props); |
144 | if (IS_ERR(bl)) { | 145 | if (IS_ERR(bl)) { |
145 | dev_err(&pdev->dev, "failed to register backlight\n"); | 146 | dev_err(&pdev->dev, "failed to register backlight\n"); |
146 | kfree(data); | ||
147 | return PTR_ERR(bl); | 147 | return PTR_ERR(bl); |
148 | } | 148 | } |
149 | bl->props.brightness = MAX_BRIGHTNESS; | 149 | bl->props.brightness = MAX_BRIGHTNESS; |
@@ -165,17 +165,14 @@ static int __devinit max8925_backlight_probe(struct platform_device *pdev) | |||
165 | return 0; | 165 | return 0; |
166 | out: | 166 | out: |
167 | backlight_device_unregister(bl); | 167 | backlight_device_unregister(bl); |
168 | kfree(data); | ||
169 | return ret; | 168 | return ret; |
170 | } | 169 | } |
171 | 170 | ||
172 | static int __devexit max8925_backlight_remove(struct platform_device *pdev) | 171 | static int __devexit max8925_backlight_remove(struct platform_device *pdev) |
173 | { | 172 | { |
174 | struct backlight_device *bl = platform_get_drvdata(pdev); | 173 | struct backlight_device *bl = platform_get_drvdata(pdev); |
175 | struct max8925_backlight_data *data = bl_get_data(bl); | ||
176 | 174 | ||
177 | backlight_device_unregister(bl); | 175 | backlight_device_unregister(bl); |
178 | kfree(data); | ||
179 | return 0; | 176 | return 0; |
180 | } | 177 | } |
181 | 178 | ||
diff --git a/drivers/video/backlight/omap1_bl.c b/drivers/video/backlight/omap1_bl.c index d8cde277ec83..0175bfb08a1c 100644 --- a/drivers/video/backlight/omap1_bl.c +++ b/drivers/video/backlight/omap1_bl.c | |||
@@ -141,7 +141,8 @@ static int omapbl_probe(struct platform_device *pdev) | |||
141 | if (!pdata) | 141 | if (!pdata) |
142 | return -ENXIO; | 142 | return -ENXIO; |
143 | 143 | ||
144 | bl = kzalloc(sizeof(struct omap_backlight), GFP_KERNEL); | 144 | bl = devm_kzalloc(&pdev->dev, sizeof(struct omap_backlight), |
145 | GFP_KERNEL); | ||
145 | if (unlikely(!bl)) | 146 | if (unlikely(!bl)) |
146 | return -ENOMEM; | 147 | return -ENOMEM; |
147 | 148 | ||
@@ -150,10 +151,8 @@ static int omapbl_probe(struct platform_device *pdev) | |||
150 | props.max_brightness = OMAPBL_MAX_INTENSITY; | 151 | props.max_brightness = OMAPBL_MAX_INTENSITY; |
151 | dev = backlight_device_register("omap-bl", &pdev->dev, bl, &omapbl_ops, | 152 | dev = backlight_device_register("omap-bl", &pdev->dev, bl, &omapbl_ops, |
152 | &props); | 153 | &props); |
153 | if (IS_ERR(dev)) { | 154 | if (IS_ERR(dev)) |
154 | kfree(bl); | ||
155 | return PTR_ERR(dev); | 155 | return PTR_ERR(dev); |
156 | } | ||
157 | 156 | ||
158 | bl->powermode = FB_BLANK_POWERDOWN; | 157 | bl->powermode = FB_BLANK_POWERDOWN; |
159 | bl->current_intensity = 0; | 158 | bl->current_intensity = 0; |
@@ -177,10 +176,8 @@ static int omapbl_probe(struct platform_device *pdev) | |||
177 | static int omapbl_remove(struct platform_device *pdev) | 176 | static int omapbl_remove(struct platform_device *pdev) |
178 | { | 177 | { |
179 | struct backlight_device *dev = platform_get_drvdata(pdev); | 178 | struct backlight_device *dev = platform_get_drvdata(pdev); |
180 | struct omap_backlight *bl = dev_get_drvdata(&dev->dev); | ||
181 | 179 | ||
182 | backlight_device_unregister(dev); | 180 | backlight_device_unregister(dev); |
183 | kfree(bl); | ||
184 | 181 | ||
185 | return 0; | 182 | return 0; |
186 | } | 183 | } |
diff --git a/drivers/video/backlight/ot200_bl.c b/drivers/video/backlight/ot200_bl.c new file mode 100644 index 000000000000..f519d55a294c --- /dev/null +++ b/drivers/video/backlight/ot200_bl.c | |||
@@ -0,0 +1,175 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2012 Bachmann electronic GmbH | ||
3 | * Christian Gmeiner <christian.gmeiner@gmail.com> | ||
4 | * | ||
5 | * Backlight driver for ot200 visualisation device from | ||
6 | * Bachmann electronic GmbH. | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify it | ||
9 | * under the terms of the GNU General Public License version 2 as published by | ||
10 | * the Free Software Foundation. | ||
11 | */ | ||
12 | |||
13 | #include <linux/module.h> | ||
14 | #include <linux/fb.h> | ||
15 | #include <linux/backlight.h> | ||
16 | #include <linux/gpio.h> | ||
17 | #include <linux/cs5535.h> | ||
18 | |||
19 | static struct cs5535_mfgpt_timer *pwm_timer; | ||
20 | |||
21 | /* this array defines the mapping of brightness in % to pwm frequency */ | ||
22 | static const u8 dim_table[101] = {0, 0, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, | ||
23 | 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, | ||
24 | 4, 5, 5, 5, 5, 6, 6, 6, 7, 7, 7, 8, 8, 9, 9, | ||
25 | 10, 10, 11, 11, 12, 12, 13, 14, 15, 15, 16, | ||
26 | 17, 18, 19, 20, 21, 22, 23, 24, 26, 27, 28, | ||
27 | 30, 31, 33, 35, 37, 39, 41, 43, 45, 47, 50, | ||
28 | 53, 55, 58, 61, 65, 68, 72, 75, 79, 84, 88, | ||
29 | 93, 97, 103, 108, 114, 120, 126, 133, 140, | ||
30 | 147, 155, 163}; | ||
31 | |||
32 | struct ot200_backlight_data { | ||
33 | int current_brightness; | ||
34 | }; | ||
35 | |||
36 | #define GPIO_DIMM 27 | ||
37 | #define SCALE 1 | ||
38 | #define CMP1MODE 0x2 /* compare on GE; output high on compare | ||
39 | * greater than or equal */ | ||
40 | #define PWM_SETUP (SCALE | CMP1MODE << 6 | MFGPT_SETUP_CNTEN) | ||
41 | #define MAX_COMP2 163 | ||
42 | |||
43 | static int ot200_backlight_update_status(struct backlight_device *bl) | ||
44 | { | ||
45 | struct ot200_backlight_data *data = bl_get_data(bl); | ||
46 | int brightness = bl->props.brightness; | ||
47 | |||
48 | if (bl->props.state & BL_CORE_FBBLANK) | ||
49 | brightness = 0; | ||
50 | |||
51 | /* enable or disable PWM timer */ | ||
52 | if (brightness == 0) | ||
53 | cs5535_mfgpt_write(pwm_timer, MFGPT_REG_SETUP, 0); | ||
54 | else if (data->current_brightness == 0) { | ||
55 | cs5535_mfgpt_write(pwm_timer, MFGPT_REG_COUNTER, 0); | ||
56 | cs5535_mfgpt_write(pwm_timer, MFGPT_REG_SETUP, | ||
57 | MFGPT_SETUP_CNTEN); | ||
58 | } | ||
59 | |||
60 | /* apply new brightness value */ | ||
61 | cs5535_mfgpt_write(pwm_timer, MFGPT_REG_CMP1, | ||
62 | MAX_COMP2 - dim_table[brightness]); | ||
63 | data->current_brightness = brightness; | ||
64 | |||
65 | return 0; | ||
66 | } | ||
67 | |||
68 | static int ot200_backlight_get_brightness(struct backlight_device *bl) | ||
69 | { | ||
70 | struct ot200_backlight_data *data = bl_get_data(bl); | ||
71 | return data->current_brightness; | ||
72 | } | ||
73 | |||
74 | static const struct backlight_ops ot200_backlight_ops = { | ||
75 | .update_status = ot200_backlight_update_status, | ||
76 | .get_brightness = ot200_backlight_get_brightness, | ||
77 | }; | ||
78 | |||
79 | static int ot200_backlight_probe(struct platform_device *pdev) | ||
80 | { | ||
81 | struct backlight_device *bl; | ||
82 | struct ot200_backlight_data *data; | ||
83 | struct backlight_properties props; | ||
84 | int retval = 0; | ||
85 | |||
86 | /* request gpio */ | ||
87 | if (gpio_request(GPIO_DIMM, "ot200 backlight dimmer") < 0) { | ||
88 | dev_err(&pdev->dev, "failed to request GPIO %d\n", GPIO_DIMM); | ||
89 | return -ENODEV; | ||
90 | } | ||
91 | |||
92 | /* request timer */ | ||
93 | pwm_timer = cs5535_mfgpt_alloc_timer(7, MFGPT_DOMAIN_ANY); | ||
94 | if (!pwm_timer) { | ||
95 | dev_err(&pdev->dev, "MFGPT 7 not available\n"); | ||
96 | retval = -ENODEV; | ||
97 | goto error_mfgpt_alloc; | ||
98 | } | ||
99 | |||
100 | data = kzalloc(sizeof(*data), GFP_KERNEL); | ||
101 | if (!data) { | ||
102 | retval = -ENOMEM; | ||
103 | goto error_kzalloc; | ||
104 | } | ||
105 | |||
106 | /* setup gpio */ | ||
107 | cs5535_gpio_set(GPIO_DIMM, GPIO_OUTPUT_ENABLE); | ||
108 | cs5535_gpio_set(GPIO_DIMM, GPIO_OUTPUT_AUX1); | ||
109 | |||
110 | /* setup timer */ | ||
111 | cs5535_mfgpt_write(pwm_timer, MFGPT_REG_CMP1, 0); | ||
112 | cs5535_mfgpt_write(pwm_timer, MFGPT_REG_CMP2, MAX_COMP2); | ||
113 | cs5535_mfgpt_write(pwm_timer, MFGPT_REG_SETUP, PWM_SETUP); | ||
114 | |||
115 | data->current_brightness = 100; | ||
116 | props.max_brightness = 100; | ||
117 | props.brightness = 100; | ||
118 | props.type = BACKLIGHT_RAW; | ||
119 | |||
120 | bl = backlight_device_register(dev_name(&pdev->dev), &pdev->dev, data, | ||
121 | &ot200_backlight_ops, &props); | ||
122 | if (IS_ERR(bl)) { | ||
123 | dev_err(&pdev->dev, "failed to register backlight\n"); | ||
124 | retval = PTR_ERR(bl); | ||
125 | goto error_backlight_device_register; | ||
126 | } | ||
127 | |||
128 | platform_set_drvdata(pdev, bl); | ||
129 | |||
130 | return 0; | ||
131 | |||
132 | error_backlight_device_register: | ||
133 | kfree(data); | ||
134 | error_kzalloc: | ||
135 | cs5535_mfgpt_free_timer(pwm_timer); | ||
136 | error_mfgpt_alloc: | ||
137 | gpio_free(GPIO_DIMM); | ||
138 | return retval; | ||
139 | } | ||
140 | |||
141 | static int ot200_backlight_remove(struct platform_device *pdev) | ||
142 | { | ||
143 | struct backlight_device *bl = platform_get_drvdata(pdev); | ||
144 | struct ot200_backlight_data *data = bl_get_data(bl); | ||
145 | |||
146 | backlight_device_unregister(bl); | ||
147 | |||
148 | /* on module unload set brightness to 100% */ | ||
149 | cs5535_mfgpt_write(pwm_timer, MFGPT_REG_COUNTER, 0); | ||
150 | cs5535_mfgpt_write(pwm_timer, MFGPT_REG_SETUP, MFGPT_SETUP_CNTEN); | ||
151 | cs5535_mfgpt_write(pwm_timer, MFGPT_REG_CMP1, | ||
152 | MAX_COMP2 - dim_table[100]); | ||
153 | |||
154 | cs5535_mfgpt_free_timer(pwm_timer); | ||
155 | gpio_free(GPIO_DIMM); | ||
156 | |||
157 | kfree(data); | ||
158 | return 0; | ||
159 | } | ||
160 | |||
161 | static struct platform_driver ot200_backlight_driver = { | ||
162 | .driver = { | ||
163 | .name = "ot200-backlight", | ||
164 | .owner = THIS_MODULE, | ||
165 | }, | ||
166 | .probe = ot200_backlight_probe, | ||
167 | .remove = ot200_backlight_remove, | ||
168 | }; | ||
169 | |||
170 | module_platform_driver(ot200_backlight_driver); | ||
171 | |||
172 | MODULE_DESCRIPTION("backlight driver for ot200 visualisation device"); | ||
173 | MODULE_AUTHOR("Christian Gmeiner <christian.gmeiner@gmail.com>"); | ||
174 | MODULE_LICENSE("GPL"); | ||
175 | MODULE_ALIAS("platform:ot200-backlight"); | ||
diff --git a/drivers/video/backlight/pandora_bl.c b/drivers/video/backlight/pandora_bl.c new file mode 100644 index 000000000000..4ec30748b447 --- /dev/null +++ b/drivers/video/backlight/pandora_bl.c | |||
@@ -0,0 +1,171 @@ | |||
1 | /* | ||
2 | * Backlight driver for Pandora handheld. | ||
3 | * Pandora uses TWL4030 PWM0 -> TPS61161 combo for control backlight. | ||
4 | * Based on pwm_bl.c | ||
5 | * | ||
6 | * Copyright 2009,2012 Gražvydas Ignotas <notasas@gmail.com> | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License version 2 as | ||
10 | * published by the Free Software Foundation. | ||
11 | */ | ||
12 | |||
13 | #include <linux/module.h> | ||
14 | #include <linux/kernel.h> | ||
15 | #include <linux/platform_device.h> | ||
16 | #include <linux/delay.h> | ||
17 | #include <linux/fb.h> | ||
18 | #include <linux/backlight.h> | ||
19 | #include <linux/i2c/twl.h> | ||
20 | #include <linux/err.h> | ||
21 | |||
22 | #define TWL_PWM0_ON 0x00 | ||
23 | #define TWL_PWM0_OFF 0x01 | ||
24 | |||
25 | #define TWL_INTBR_GPBR1 0x0c | ||
26 | #define TWL_INTBR_PMBR1 0x0d | ||
27 | |||
28 | #define TWL_PMBR1_PWM0_MUXMASK 0x0c | ||
29 | #define TWL_PMBR1_PWM0 0x04 | ||
30 | #define PWM0_CLK_ENABLE BIT(0) | ||
31 | #define PWM0_ENABLE BIT(2) | ||
32 | |||
33 | /* range accepted by hardware */ | ||
34 | #define MIN_VALUE 9 | ||
35 | #define MAX_VALUE 63 | ||
36 | #define MAX_USER_VALUE (MAX_VALUE - MIN_VALUE) | ||
37 | |||
38 | #define PANDORABL_WAS_OFF BL_CORE_DRIVER1 | ||
39 | |||
40 | static int pandora_backlight_update_status(struct backlight_device *bl) | ||
41 | { | ||
42 | int brightness = bl->props.brightness; | ||
43 | u8 r; | ||
44 | |||
45 | if (bl->props.power != FB_BLANK_UNBLANK) | ||
46 | brightness = 0; | ||
47 | if (bl->props.state & BL_CORE_FBBLANK) | ||
48 | brightness = 0; | ||
49 | if (bl->props.state & BL_CORE_SUSPENDED) | ||
50 | brightness = 0; | ||
51 | |||
52 | if ((unsigned int)brightness > MAX_USER_VALUE) | ||
53 | brightness = MAX_USER_VALUE; | ||
54 | |||
55 | if (brightness == 0) { | ||
56 | if (bl->props.state & PANDORABL_WAS_OFF) | ||
57 | goto done; | ||
58 | |||
59 | /* first disable PWM0 output, then clock */ | ||
60 | twl_i2c_read_u8(TWL4030_MODULE_INTBR, &r, TWL_INTBR_GPBR1); | ||
61 | r &= ~PWM0_ENABLE; | ||
62 | twl_i2c_write_u8(TWL4030_MODULE_INTBR, r, TWL_INTBR_GPBR1); | ||
63 | r &= ~PWM0_CLK_ENABLE; | ||
64 | twl_i2c_write_u8(TWL4030_MODULE_INTBR, r, TWL_INTBR_GPBR1); | ||
65 | |||
66 | goto done; | ||
67 | } | ||
68 | |||
69 | if (bl->props.state & PANDORABL_WAS_OFF) { | ||
70 | /* | ||
71 | * set PWM duty cycle to max. TPS61161 seems to use this | ||
72 | * to calibrate it's PWM sensitivity when it starts. | ||
73 | */ | ||
74 | twl_i2c_write_u8(TWL4030_MODULE_PWM0, MAX_VALUE, | ||
75 | TWL_PWM0_OFF); | ||
76 | |||
77 | /* first enable clock, then PWM0 out */ | ||
78 | twl_i2c_read_u8(TWL4030_MODULE_INTBR, &r, TWL_INTBR_GPBR1); | ||
79 | r &= ~PWM0_ENABLE; | ||
80 | r |= PWM0_CLK_ENABLE; | ||
81 | twl_i2c_write_u8(TWL4030_MODULE_INTBR, r, TWL_INTBR_GPBR1); | ||
82 | r |= PWM0_ENABLE; | ||
83 | twl_i2c_write_u8(TWL4030_MODULE_INTBR, r, TWL_INTBR_GPBR1); | ||
84 | |||
85 | /* | ||
86 | * TI made it very easy to enable digital control, so easy that | ||
87 | * it often triggers unintentionally and disabes PWM control, | ||
88 | * so wait until 1 wire mode detection window ends. | ||
89 | */ | ||
90 | usleep_range(2000, 10000); | ||
91 | } | ||
92 | |||
93 | twl_i2c_write_u8(TWL4030_MODULE_PWM0, MIN_VALUE + brightness, | ||
94 | TWL_PWM0_OFF); | ||
95 | |||
96 | done: | ||
97 | if (brightness != 0) | ||
98 | bl->props.state &= ~PANDORABL_WAS_OFF; | ||
99 | else | ||
100 | bl->props.state |= PANDORABL_WAS_OFF; | ||
101 | |||
102 | return 0; | ||
103 | } | ||
104 | |||
105 | static int pandora_backlight_get_brightness(struct backlight_device *bl) | ||
106 | { | ||
107 | return bl->props.brightness; | ||
108 | } | ||
109 | |||
110 | static const struct backlight_ops pandora_backlight_ops = { | ||
111 | .options = BL_CORE_SUSPENDRESUME, | ||
112 | .update_status = pandora_backlight_update_status, | ||
113 | .get_brightness = pandora_backlight_get_brightness, | ||
114 | }; | ||
115 | |||
116 | static int pandora_backlight_probe(struct platform_device *pdev) | ||
117 | { | ||
118 | struct backlight_properties props; | ||
119 | struct backlight_device *bl; | ||
120 | u8 r; | ||
121 | |||
122 | memset(&props, 0, sizeof(props)); | ||
123 | props.max_brightness = MAX_USER_VALUE; | ||
124 | props.type = BACKLIGHT_RAW; | ||
125 | bl = backlight_device_register(pdev->name, &pdev->dev, | ||
126 | NULL, &pandora_backlight_ops, &props); | ||
127 | if (IS_ERR(bl)) { | ||
128 | dev_err(&pdev->dev, "failed to register backlight\n"); | ||
129 | return PTR_ERR(bl); | ||
130 | } | ||
131 | |||
132 | platform_set_drvdata(pdev, bl); | ||
133 | |||
134 | /* 64 cycle period, ON position 0 */ | ||
135 | twl_i2c_write_u8(TWL4030_MODULE_PWM0, 0x80, TWL_PWM0_ON); | ||
136 | |||
137 | bl->props.state |= PANDORABL_WAS_OFF; | ||
138 | bl->props.brightness = MAX_USER_VALUE; | ||
139 | backlight_update_status(bl); | ||
140 | |||
141 | /* enable PWM function in pin mux */ | ||
142 | twl_i2c_read_u8(TWL4030_MODULE_INTBR, &r, TWL_INTBR_PMBR1); | ||
143 | r &= ~TWL_PMBR1_PWM0_MUXMASK; | ||
144 | r |= TWL_PMBR1_PWM0; | ||
145 | twl_i2c_write_u8(TWL4030_MODULE_INTBR, r, TWL_INTBR_PMBR1); | ||
146 | |||
147 | return 0; | ||
148 | } | ||
149 | |||
150 | static int pandora_backlight_remove(struct platform_device *pdev) | ||
151 | { | ||
152 | struct backlight_device *bl = platform_get_drvdata(pdev); | ||
153 | backlight_device_unregister(bl); | ||
154 | return 0; | ||
155 | } | ||
156 | |||
157 | static struct platform_driver pandora_backlight_driver = { | ||
158 | .driver = { | ||
159 | .name = "pandora-backlight", | ||
160 | .owner = THIS_MODULE, | ||
161 | }, | ||
162 | .probe = pandora_backlight_probe, | ||
163 | .remove = pandora_backlight_remove, | ||
164 | }; | ||
165 | |||
166 | module_platform_driver(pandora_backlight_driver); | ||
167 | |||
168 | MODULE_AUTHOR("Gražvydas Ignotas <notasas@gmail.com>"); | ||
169 | MODULE_DESCRIPTION("Pandora Backlight Driver"); | ||
170 | MODULE_LICENSE("GPL"); | ||
171 | MODULE_ALIAS("platform:pandora-backlight"); | ||
diff --git a/drivers/video/backlight/pcf50633-backlight.c b/drivers/video/backlight/pcf50633-backlight.c index 13e88b71daec..c65853cb9740 100644 --- a/drivers/video/backlight/pcf50633-backlight.c +++ b/drivers/video/backlight/pcf50633-backlight.c | |||
@@ -101,14 +101,13 @@ static const struct backlight_ops pcf50633_bl_ops = { | |||
101 | 101 | ||
102 | static int __devinit pcf50633_bl_probe(struct platform_device *pdev) | 102 | static int __devinit pcf50633_bl_probe(struct platform_device *pdev) |
103 | { | 103 | { |
104 | int ret; | ||
105 | struct pcf50633_bl *pcf_bl; | 104 | struct pcf50633_bl *pcf_bl; |
106 | struct device *parent = pdev->dev.parent; | 105 | struct device *parent = pdev->dev.parent; |
107 | struct pcf50633_platform_data *pcf50633_data = parent->platform_data; | 106 | struct pcf50633_platform_data *pcf50633_data = parent->platform_data; |
108 | struct pcf50633_bl_platform_data *pdata = pcf50633_data->backlight_data; | 107 | struct pcf50633_bl_platform_data *pdata = pcf50633_data->backlight_data; |
109 | struct backlight_properties bl_props; | 108 | struct backlight_properties bl_props; |
110 | 109 | ||
111 | pcf_bl = kzalloc(sizeof(*pcf_bl), GFP_KERNEL); | 110 | pcf_bl = devm_kzalloc(&pdev->dev, sizeof(*pcf_bl), GFP_KERNEL); |
112 | if (!pcf_bl) | 111 | if (!pcf_bl) |
113 | return -ENOMEM; | 112 | return -ENOMEM; |
114 | 113 | ||
@@ -129,10 +128,8 @@ static int __devinit pcf50633_bl_probe(struct platform_device *pdev) | |||
129 | pcf_bl->bl = backlight_device_register(pdev->name, &pdev->dev, pcf_bl, | 128 | pcf_bl->bl = backlight_device_register(pdev->name, &pdev->dev, pcf_bl, |
130 | &pcf50633_bl_ops, &bl_props); | 129 | &pcf50633_bl_ops, &bl_props); |
131 | 130 | ||
132 | if (IS_ERR(pcf_bl->bl)) { | 131 | if (IS_ERR(pcf_bl->bl)) |
133 | ret = PTR_ERR(pcf_bl->bl); | 132 | return PTR_ERR(pcf_bl->bl); |
134 | goto err_free; | ||
135 | } | ||
136 | 133 | ||
137 | platform_set_drvdata(pdev, pcf_bl); | 134 | platform_set_drvdata(pdev, pcf_bl); |
138 | 135 | ||
@@ -145,11 +142,6 @@ static int __devinit pcf50633_bl_probe(struct platform_device *pdev) | |||
145 | backlight_update_status(pcf_bl->bl); | 142 | backlight_update_status(pcf_bl->bl); |
146 | 143 | ||
147 | return 0; | 144 | return 0; |
148 | |||
149 | err_free: | ||
150 | kfree(pcf_bl); | ||
151 | |||
152 | return ret; | ||
153 | } | 145 | } |
154 | 146 | ||
155 | static int __devexit pcf50633_bl_remove(struct platform_device *pdev) | 147 | static int __devexit pcf50633_bl_remove(struct platform_device *pdev) |
@@ -160,8 +152,6 @@ static int __devexit pcf50633_bl_remove(struct platform_device *pdev) | |||
160 | 152 | ||
161 | platform_set_drvdata(pdev, NULL); | 153 | platform_set_drvdata(pdev, NULL); |
162 | 154 | ||
163 | kfree(pcf_bl); | ||
164 | |||
165 | return 0; | 155 | return 0; |
166 | } | 156 | } |
167 | 157 | ||
diff --git a/drivers/video/backlight/platform_lcd.c b/drivers/video/backlight/platform_lcd.c index f0bf491ed087..b6672340d6c7 100644 --- a/drivers/video/backlight/platform_lcd.c +++ b/drivers/video/backlight/platform_lcd.c | |||
@@ -121,9 +121,9 @@ static int __devexit platform_lcd_remove(struct platform_device *pdev) | |||
121 | } | 121 | } |
122 | 122 | ||
123 | #ifdef CONFIG_PM | 123 | #ifdef CONFIG_PM |
124 | static int platform_lcd_suspend(struct platform_device *pdev, pm_message_t st) | 124 | static int platform_lcd_suspend(struct device *dev) |
125 | { | 125 | { |
126 | struct platform_lcd *plcd = platform_get_drvdata(pdev); | 126 | struct platform_lcd *plcd = dev_get_drvdata(dev); |
127 | 127 | ||
128 | plcd->suspended = 1; | 128 | plcd->suspended = 1; |
129 | platform_lcd_set_power(plcd->lcd, plcd->power); | 129 | platform_lcd_set_power(plcd->lcd, plcd->power); |
@@ -131,29 +131,30 @@ static int platform_lcd_suspend(struct platform_device *pdev, pm_message_t st) | |||
131 | return 0; | 131 | return 0; |
132 | } | 132 | } |
133 | 133 | ||
134 | static int platform_lcd_resume(struct platform_device *pdev) | 134 | static int platform_lcd_resume(struct device *dev) |
135 | { | 135 | { |
136 | struct platform_lcd *plcd = platform_get_drvdata(pdev); | 136 | struct platform_lcd *plcd = dev_get_drvdata(dev); |
137 | 137 | ||
138 | plcd->suspended = 0; | 138 | plcd->suspended = 0; |
139 | platform_lcd_set_power(plcd->lcd, plcd->power); | 139 | platform_lcd_set_power(plcd->lcd, plcd->power); |
140 | 140 | ||
141 | return 0; | 141 | return 0; |
142 | } | 142 | } |
143 | #else | 143 | |
144 | #define platform_lcd_suspend NULL | 144 | static SIMPLE_DEV_PM_OPS(platform_lcd_pm_ops, platform_lcd_suspend, |
145 | #define platform_lcd_resume NULL | 145 | platform_lcd_resume); |
146 | #endif | 146 | #endif |
147 | 147 | ||
148 | static struct platform_driver platform_lcd_driver = { | 148 | static struct platform_driver platform_lcd_driver = { |
149 | .driver = { | 149 | .driver = { |
150 | .name = "platform-lcd", | 150 | .name = "platform-lcd", |
151 | .owner = THIS_MODULE, | 151 | .owner = THIS_MODULE, |
152 | #ifdef CONFIG_PM | ||
153 | .pm = &platform_lcd_pm_ops, | ||
154 | #endif | ||
152 | }, | 155 | }, |
153 | .probe = platform_lcd_probe, | 156 | .probe = platform_lcd_probe, |
154 | .remove = __devexit_p(platform_lcd_remove), | 157 | .remove = __devexit_p(platform_lcd_remove), |
155 | .suspend = platform_lcd_suspend, | ||
156 | .resume = platform_lcd_resume, | ||
157 | }; | 158 | }; |
158 | 159 | ||
159 | module_platform_driver(platform_lcd_driver); | 160 | module_platform_driver(platform_lcd_driver); |
diff --git a/drivers/video/backlight/pwm_bl.c b/drivers/video/backlight/pwm_bl.c index 7496d04e1d3c..342b7d7cbb63 100644 --- a/drivers/video/backlight/pwm_bl.c +++ b/drivers/video/backlight/pwm_bl.c | |||
@@ -102,7 +102,7 @@ static int pwm_backlight_probe(struct platform_device *pdev) | |||
102 | return ret; | 102 | return ret; |
103 | } | 103 | } |
104 | 104 | ||
105 | pb = kzalloc(sizeof(*pb), GFP_KERNEL); | 105 | pb = devm_kzalloc(&pdev->dev, sizeof(*pb), GFP_KERNEL); |
106 | if (!pb) { | 106 | if (!pb) { |
107 | dev_err(&pdev->dev, "no memory for state\n"); | 107 | dev_err(&pdev->dev, "no memory for state\n"); |
108 | ret = -ENOMEM; | 108 | ret = -ENOMEM; |
@@ -121,7 +121,7 @@ static int pwm_backlight_probe(struct platform_device *pdev) | |||
121 | if (IS_ERR(pb->pwm)) { | 121 | if (IS_ERR(pb->pwm)) { |
122 | dev_err(&pdev->dev, "unable to request PWM for backlight\n"); | 122 | dev_err(&pdev->dev, "unable to request PWM for backlight\n"); |
123 | ret = PTR_ERR(pb->pwm); | 123 | ret = PTR_ERR(pb->pwm); |
124 | goto err_pwm; | 124 | goto err_alloc; |
125 | } else | 125 | } else |
126 | dev_dbg(&pdev->dev, "got pwm for backlight\n"); | 126 | dev_dbg(&pdev->dev, "got pwm for backlight\n"); |
127 | 127 | ||
@@ -144,8 +144,6 @@ static int pwm_backlight_probe(struct platform_device *pdev) | |||
144 | 144 | ||
145 | err_bl: | 145 | err_bl: |
146 | pwm_free(pb->pwm); | 146 | pwm_free(pb->pwm); |
147 | err_pwm: | ||
148 | kfree(pb); | ||
149 | err_alloc: | 147 | err_alloc: |
150 | if (data->exit) | 148 | if (data->exit) |
151 | data->exit(&pdev->dev); | 149 | data->exit(&pdev->dev); |
@@ -162,7 +160,6 @@ static int pwm_backlight_remove(struct platform_device *pdev) | |||
162 | pwm_config(pb->pwm, 0, pb->period); | 160 | pwm_config(pb->pwm, 0, pb->period); |
163 | pwm_disable(pb->pwm); | 161 | pwm_disable(pb->pwm); |
164 | pwm_free(pb->pwm); | 162 | pwm_free(pb->pwm); |
165 | kfree(pb); | ||
166 | if (data->exit) | 163 | if (data->exit) |
167 | data->exit(&pdev->dev); | 164 | data->exit(&pdev->dev); |
168 | return 0; | 165 | return 0; |
diff --git a/drivers/video/backlight/s6e63m0.c b/drivers/video/backlight/s6e63m0.c index 516db703dd24..e264f55b2574 100644 --- a/drivers/video/backlight/s6e63m0.c +++ b/drivers/video/backlight/s6e63m0.c | |||
@@ -909,18 +909,7 @@ static struct spi_driver s6e63m0_driver = { | |||
909 | .resume = s6e63m0_resume, | 909 | .resume = s6e63m0_resume, |
910 | }; | 910 | }; |
911 | 911 | ||
912 | static int __init s6e63m0_init(void) | 912 | module_spi_driver(s6e63m0_driver); |
913 | { | ||
914 | return spi_register_driver(&s6e63m0_driver); | ||
915 | } | ||
916 | |||
917 | static void __exit s6e63m0_exit(void) | ||
918 | { | ||
919 | spi_unregister_driver(&s6e63m0_driver); | ||
920 | } | ||
921 | |||
922 | module_init(s6e63m0_init); | ||
923 | module_exit(s6e63m0_exit); | ||
924 | 913 | ||
925 | MODULE_AUTHOR("InKi Dae <inki.dae@samsung.com>"); | 914 | MODULE_AUTHOR("InKi Dae <inki.dae@samsung.com>"); |
926 | MODULE_DESCRIPTION("S6E63M0 LCD Driver"); | 915 | MODULE_DESCRIPTION("S6E63M0 LCD Driver"); |
diff --git a/drivers/video/backlight/tdo24m.c b/drivers/video/backlight/tdo24m.c index 1997e12a1057..2368b8e5f89e 100644 --- a/drivers/video/backlight/tdo24m.c +++ b/drivers/video/backlight/tdo24m.c | |||
@@ -459,17 +459,7 @@ static struct spi_driver tdo24m_driver = { | |||
459 | .resume = tdo24m_resume, | 459 | .resume = tdo24m_resume, |
460 | }; | 460 | }; |
461 | 461 | ||
462 | static int __init tdo24m_init(void) | 462 | module_spi_driver(tdo24m_driver); |
463 | { | ||
464 | return spi_register_driver(&tdo24m_driver); | ||
465 | } | ||
466 | module_init(tdo24m_init); | ||
467 | |||
468 | static void __exit tdo24m_exit(void) | ||
469 | { | ||
470 | spi_unregister_driver(&tdo24m_driver); | ||
471 | } | ||
472 | module_exit(tdo24m_exit); | ||
473 | 463 | ||
474 | MODULE_AUTHOR("Eric Miao <eric.miao@marvell.com>"); | 464 | MODULE_AUTHOR("Eric Miao <eric.miao@marvell.com>"); |
475 | MODULE_DESCRIPTION("Driver for Toppoly TDO24M LCD Panel"); | 465 | MODULE_DESCRIPTION("Driver for Toppoly TDO24M LCD Panel"); |
diff --git a/drivers/video/backlight/tosa_bl.c b/drivers/video/backlight/tosa_bl.c index 425a7365470b..2b241abced43 100644 --- a/drivers/video/backlight/tosa_bl.c +++ b/drivers/video/backlight/tosa_bl.c | |||
@@ -181,18 +181,7 @@ static struct i2c_driver tosa_bl_driver = { | |||
181 | .id_table = tosa_bl_id, | 181 | .id_table = tosa_bl_id, |
182 | }; | 182 | }; |
183 | 183 | ||
184 | static int __init tosa_bl_init(void) | 184 | module_i2c_driver(tosa_bl_driver); |
185 | { | ||
186 | return i2c_add_driver(&tosa_bl_driver); | ||
187 | } | ||
188 | |||
189 | static void __exit tosa_bl_exit(void) | ||
190 | { | ||
191 | i2c_del_driver(&tosa_bl_driver); | ||
192 | } | ||
193 | |||
194 | module_init(tosa_bl_init); | ||
195 | module_exit(tosa_bl_exit); | ||
196 | 185 | ||
197 | MODULE_AUTHOR("Dmitry Baryshkov"); | 186 | MODULE_AUTHOR("Dmitry Baryshkov"); |
198 | MODULE_LICENSE("GPL v2"); | 187 | MODULE_LICENSE("GPL v2"); |
diff --git a/drivers/video/backlight/tosa_lcd.c b/drivers/video/backlight/tosa_lcd.c index 772f6015219a..a2161f631a83 100644 --- a/drivers/video/backlight/tosa_lcd.c +++ b/drivers/video/backlight/tosa_lcd.c | |||
@@ -285,18 +285,7 @@ static struct spi_driver tosa_lcd_driver = { | |||
285 | .resume = tosa_lcd_resume, | 285 | .resume = tosa_lcd_resume, |
286 | }; | 286 | }; |
287 | 287 | ||
288 | static int __init tosa_lcd_init(void) | 288 | module_spi_driver(tosa_lcd_driver); |
289 | { | ||
290 | return spi_register_driver(&tosa_lcd_driver); | ||
291 | } | ||
292 | |||
293 | static void __exit tosa_lcd_exit(void) | ||
294 | { | ||
295 | spi_unregister_driver(&tosa_lcd_driver); | ||
296 | } | ||
297 | |||
298 | module_init(tosa_lcd_init); | ||
299 | module_exit(tosa_lcd_exit); | ||
300 | 289 | ||
301 | MODULE_AUTHOR("Dmitry Baryshkov"); | 290 | MODULE_AUTHOR("Dmitry Baryshkov"); |
302 | MODULE_LICENSE("GPL v2"); | 291 | MODULE_LICENSE("GPL v2"); |
diff --git a/drivers/video/backlight/vgg2432a4.c b/drivers/video/backlight/vgg2432a4.c index b49063c831e7..b617fae9aa26 100644 --- a/drivers/video/backlight/vgg2432a4.c +++ b/drivers/video/backlight/vgg2432a4.c | |||
@@ -262,20 +262,7 @@ static struct spi_driver vgg2432a4_driver = { | |||
262 | .resume = vgg2432a4_resume, | 262 | .resume = vgg2432a4_resume, |
263 | }; | 263 | }; |
264 | 264 | ||
265 | /* Device driver initialisation */ | 265 | module_spi_driver(vgg2432a4_driver); |
266 | |||
267 | static int __init vgg2432a4_init(void) | ||
268 | { | ||
269 | return spi_register_driver(&vgg2432a4_driver); | ||
270 | } | ||
271 | |||
272 | static void __exit vgg2432a4_exit(void) | ||
273 | { | ||
274 | spi_unregister_driver(&vgg2432a4_driver); | ||
275 | } | ||
276 | |||
277 | module_init(vgg2432a4_init); | ||
278 | module_exit(vgg2432a4_exit); | ||
279 | 266 | ||
280 | MODULE_AUTHOR("Ben Dooks <ben-linux@fluff.org>"); | 267 | MODULE_AUTHOR("Ben Dooks <ben-linux@fluff.org>"); |
281 | MODULE_DESCRIPTION("VGG2432A4 LCD Driver"); | 268 | MODULE_DESCRIPTION("VGG2432A4 LCD Driver"); |
diff --git a/drivers/video/backlight/wm831x_bl.c b/drivers/video/backlight/wm831x_bl.c index 4e915f5eca99..5d365deb5f82 100644 --- a/drivers/video/backlight/wm831x_bl.c +++ b/drivers/video/backlight/wm831x_bl.c | |||
@@ -186,7 +186,7 @@ static int wm831x_backlight_probe(struct platform_device *pdev) | |||
186 | if (ret < 0) | 186 | if (ret < 0) |
187 | return ret; | 187 | return ret; |
188 | 188 | ||
189 | data = kzalloc(sizeof(*data), GFP_KERNEL); | 189 | data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL); |
190 | if (data == NULL) | 190 | if (data == NULL) |
191 | return -ENOMEM; | 191 | return -ENOMEM; |
192 | 192 | ||
@@ -200,7 +200,6 @@ static int wm831x_backlight_probe(struct platform_device *pdev) | |||
200 | &wm831x_backlight_ops, &props); | 200 | &wm831x_backlight_ops, &props); |
201 | if (IS_ERR(bl)) { | 201 | if (IS_ERR(bl)) { |
202 | dev_err(&pdev->dev, "failed to register backlight\n"); | 202 | dev_err(&pdev->dev, "failed to register backlight\n"); |
203 | kfree(data); | ||
204 | return PTR_ERR(bl); | 203 | return PTR_ERR(bl); |
205 | } | 204 | } |
206 | 205 | ||
@@ -211,7 +210,6 @@ static int wm831x_backlight_probe(struct platform_device *pdev) | |||
211 | /* Disable the DCDC if it was started so we can bootstrap */ | 210 | /* Disable the DCDC if it was started so we can bootstrap */ |
212 | wm831x_set_bits(wm831x, WM831X_DCDC_ENABLE, WM831X_DC4_ENA, 0); | 211 | wm831x_set_bits(wm831x, WM831X_DCDC_ENABLE, WM831X_DC4_ENA, 0); |
213 | 212 | ||
214 | |||
215 | backlight_update_status(bl); | 213 | backlight_update_status(bl); |
216 | 214 | ||
217 | return 0; | 215 | return 0; |
@@ -220,10 +218,8 @@ static int wm831x_backlight_probe(struct platform_device *pdev) | |||
220 | static int wm831x_backlight_remove(struct platform_device *pdev) | 218 | static int wm831x_backlight_remove(struct platform_device *pdev) |
221 | { | 219 | { |
222 | struct backlight_device *bl = platform_get_drvdata(pdev); | 220 | struct backlight_device *bl = platform_get_drvdata(pdev); |
223 | struct wm831x_backlight_data *data = bl_get_data(bl); | ||
224 | 221 | ||
225 | backlight_device_unregister(bl); | 222 | backlight_device_unregister(bl); |
226 | kfree(data); | ||
227 | return 0; | 223 | return 0; |
228 | } | 224 | } |
229 | 225 | ||
diff --git a/drivers/video/uvesafb.c b/drivers/video/uvesafb.c index 9db3de3a8418..260cca7ddb41 100644 --- a/drivers/video/uvesafb.c +++ b/drivers/video/uvesafb.c | |||
@@ -121,7 +121,7 @@ static int uvesafb_helper_start(void) | |||
121 | NULL, | 121 | NULL, |
122 | }; | 122 | }; |
123 | 123 | ||
124 | return call_usermodehelper(v86d_path, argv, envp, 1); | 124 | return call_usermodehelper(v86d_path, argv, envp, UMH_WAIT_PROC); |
125 | } | 125 | } |
126 | 126 | ||
127 | /* | 127 | /* |
diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c index 81878b78c9d4..504b6eee50a9 100644 --- a/fs/binfmt_elf.c +++ b/fs/binfmt_elf.c | |||
@@ -1093,6 +1093,29 @@ out: | |||
1093 | */ | 1093 | */ |
1094 | 1094 | ||
1095 | /* | 1095 | /* |
1096 | * The purpose of always_dump_vma() is to make sure that special kernel mappings | ||
1097 | * that are useful for post-mortem analysis are included in every core dump. | ||
1098 | * In that way we ensure that the core dump is fully interpretable later | ||
1099 | * without matching up the same kernel and hardware config to see what PC values | ||
1100 | * meant. These special mappings include - vDSO, vsyscall, and other | ||
1101 | * architecture specific mappings | ||
1102 | */ | ||
1103 | static bool always_dump_vma(struct vm_area_struct *vma) | ||
1104 | { | ||
1105 | /* Any vsyscall mappings? */ | ||
1106 | if (vma == get_gate_vma(vma->vm_mm)) | ||
1107 | return true; | ||
1108 | /* | ||
1109 | * arch_vma_name() returns non-NULL for special architecture mappings, | ||
1110 | * such as vDSO sections. | ||
1111 | */ | ||
1112 | if (arch_vma_name(vma)) | ||
1113 | return true; | ||
1114 | |||
1115 | return false; | ||
1116 | } | ||
1117 | |||
1118 | /* | ||
1096 | * Decide what to dump of a segment, part, all or none. | 1119 | * Decide what to dump of a segment, part, all or none. |
1097 | */ | 1120 | */ |
1098 | static unsigned long vma_dump_size(struct vm_area_struct *vma, | 1121 | static unsigned long vma_dump_size(struct vm_area_struct *vma, |
@@ -1100,10 +1123,13 @@ static unsigned long vma_dump_size(struct vm_area_struct *vma, | |||
1100 | { | 1123 | { |
1101 | #define FILTER(type) (mm_flags & (1UL << MMF_DUMP_##type)) | 1124 | #define FILTER(type) (mm_flags & (1UL << MMF_DUMP_##type)) |
1102 | 1125 | ||
1103 | /* The vma can be set up to tell us the answer directly. */ | 1126 | /* always dump the vdso and vsyscall sections */ |
1104 | if (vma->vm_flags & VM_ALWAYSDUMP) | 1127 | if (always_dump_vma(vma)) |
1105 | goto whole; | 1128 | goto whole; |
1106 | 1129 | ||
1130 | if (vma->vm_flags & VM_NODUMP) | ||
1131 | return 0; | ||
1132 | |||
1107 | /* Hugetlb memory check */ | 1133 | /* Hugetlb memory check */ |
1108 | if (vma->vm_flags & VM_HUGETLB) { | 1134 | if (vma->vm_flags & VM_HUGETLB) { |
1109 | if ((vma->vm_flags & VM_SHARED) && FILTER(HUGETLB_SHARED)) | 1135 | if ((vma->vm_flags & VM_SHARED) && FILTER(HUGETLB_SHARED)) |
diff --git a/fs/binfmt_misc.c b/fs/binfmt_misc.c index 1ffb60355cae..613aa0618235 100644 --- a/fs/binfmt_misc.c +++ b/fs/binfmt_misc.c | |||
@@ -19,6 +19,7 @@ | |||
19 | #include <linux/module.h> | 19 | #include <linux/module.h> |
20 | #include <linux/init.h> | 20 | #include <linux/init.h> |
21 | #include <linux/sched.h> | 21 | #include <linux/sched.h> |
22 | #include <linux/magic.h> | ||
22 | #include <linux/binfmts.h> | 23 | #include <linux/binfmts.h> |
23 | #include <linux/slab.h> | 24 | #include <linux/slab.h> |
24 | #include <linux/ctype.h> | 25 | #include <linux/ctype.h> |
@@ -699,7 +700,7 @@ static int bm_fill_super(struct super_block * sb, void * data, int silent) | |||
699 | [3] = {"register", &bm_register_operations, S_IWUSR}, | 700 | [3] = {"register", &bm_register_operations, S_IWUSR}, |
700 | /* last one */ {""} | 701 | /* last one */ {""} |
701 | }; | 702 | }; |
702 | int err = simple_fill_super(sb, 0x42494e4d, bm_files); | 703 | int err = simple_fill_super(sb, BINFMTFS_MAGIC, bm_files); |
703 | if (!err) | 704 | if (!err) |
704 | sb->s_op = &s_ops; | 705 | sb->s_op = &s_ops; |
705 | return err; | 706 | return err; |
diff --git a/fs/block_dev.c b/fs/block_dev.c index a9ff3000b83d..e08f6a20a5bb 100644 --- a/fs/block_dev.c +++ b/fs/block_dev.c | |||
@@ -16,6 +16,7 @@ | |||
16 | #include <linux/blkdev.h> | 16 | #include <linux/blkdev.h> |
17 | #include <linux/module.h> | 17 | #include <linux/module.h> |
18 | #include <linux/blkpg.h> | 18 | #include <linux/blkpg.h> |
19 | #include <linux/magic.h> | ||
19 | #include <linux/buffer_head.h> | 20 | #include <linux/buffer_head.h> |
20 | #include <linux/swap.h> | 21 | #include <linux/swap.h> |
21 | #include <linux/pagevec.h> | 22 | #include <linux/pagevec.h> |
@@ -506,7 +507,7 @@ static const struct super_operations bdev_sops = { | |||
506 | static struct dentry *bd_mount(struct file_system_type *fs_type, | 507 | static struct dentry *bd_mount(struct file_system_type *fs_type, |
507 | int flags, const char *dev_name, void *data) | 508 | int flags, const char *dev_name, void *data) |
508 | { | 509 | { |
509 | return mount_pseudo(fs_type, "bdev:", &bdev_sops, NULL, 0x62646576); | 510 | return mount_pseudo(fs_type, "bdev:", &bdev_sops, NULL, BDEVFS_MAGIC); |
510 | } | 511 | } |
511 | 512 | ||
512 | static struct file_system_type bd_type = { | 513 | static struct file_system_type bd_type = { |
diff --git a/fs/eventpoll.c b/fs/eventpoll.c index 4d9d3a45e356..629e9ed99d0f 100644 --- a/fs/eventpoll.c +++ b/fs/eventpoll.c | |||
@@ -427,6 +427,31 @@ out_unlock: | |||
427 | return error; | 427 | return error; |
428 | } | 428 | } |
429 | 429 | ||
430 | /* | ||
431 | * As described in commit 0ccf831cb lockdep: annotate epoll | ||
432 | * the use of wait queues used by epoll is done in a very controlled | ||
433 | * manner. Wake ups can nest inside each other, but are never done | ||
434 | * with the same locking. For example: | ||
435 | * | ||
436 | * dfd = socket(...); | ||
437 | * efd1 = epoll_create(); | ||
438 | * efd2 = epoll_create(); | ||
439 | * epoll_ctl(efd1, EPOLL_CTL_ADD, dfd, ...); | ||
440 | * epoll_ctl(efd2, EPOLL_CTL_ADD, efd1, ...); | ||
441 | * | ||
442 | * When a packet arrives to the device underneath "dfd", the net code will | ||
443 | * issue a wake_up() on its poll wake list. Epoll (efd1) has installed a | ||
444 | * callback wakeup entry on that queue, and the wake_up() performed by the | ||
445 | * "dfd" net code will end up in ep_poll_callback(). At this point epoll | ||
446 | * (efd1) notices that it may have some event ready, so it needs to wake up | ||
447 | * the waiters on its poll wait list (efd2). So it calls ep_poll_safewake() | ||
448 | * that ends up in another wake_up(), after having checked about the | ||
449 | * recursion constraints. That are, no more than EP_MAX_POLLWAKE_NESTS, to | ||
450 | * avoid stack blasting. | ||
451 | * | ||
452 | * When CONFIG_DEBUG_LOCK_ALLOC is enabled, make sure lockdep can handle | ||
453 | * this special case of epoll. | ||
454 | */ | ||
430 | #ifdef CONFIG_DEBUG_LOCK_ALLOC | 455 | #ifdef CONFIG_DEBUG_LOCK_ALLOC |
431 | static inline void ep_wake_up_nested(wait_queue_head_t *wqueue, | 456 | static inline void ep_wake_up_nested(wait_queue_head_t *wqueue, |
432 | unsigned long events, int subclass) | 457 | unsigned long events, int subclass) |
@@ -699,9 +724,12 @@ static int ep_read_events_proc(struct eventpoll *ep, struct list_head *head, | |||
699 | void *priv) | 724 | void *priv) |
700 | { | 725 | { |
701 | struct epitem *epi, *tmp; | 726 | struct epitem *epi, *tmp; |
727 | poll_table pt; | ||
702 | 728 | ||
729 | init_poll_funcptr(&pt, NULL); | ||
703 | list_for_each_entry_safe(epi, tmp, head, rdllink) { | 730 | list_for_each_entry_safe(epi, tmp, head, rdllink) { |
704 | if (epi->ffd.file->f_op->poll(epi->ffd.file, NULL) & | 731 | pt._key = epi->event.events; |
732 | if (epi->ffd.file->f_op->poll(epi->ffd.file, &pt) & | ||
705 | epi->event.events) | 733 | epi->event.events) |
706 | return POLLIN | POLLRDNORM; | 734 | return POLLIN | POLLRDNORM; |
707 | else { | 735 | else { |
@@ -1049,13 +1077,11 @@ static int reverse_path_check_proc(void *priv, void *cookie, int call_nests) | |||
1049 | */ | 1077 | */ |
1050 | static int reverse_path_check(void) | 1078 | static int reverse_path_check(void) |
1051 | { | 1079 | { |
1052 | int length = 0; | ||
1053 | int error = 0; | 1080 | int error = 0; |
1054 | struct file *current_file; | 1081 | struct file *current_file; |
1055 | 1082 | ||
1056 | /* let's call this for all tfiles */ | 1083 | /* let's call this for all tfiles */ |
1057 | list_for_each_entry(current_file, &tfile_check_list, f_tfile_llink) { | 1084 | list_for_each_entry(current_file, &tfile_check_list, f_tfile_llink) { |
1058 | length++; | ||
1059 | path_count_init(); | 1085 | path_count_init(); |
1060 | error = ep_call_nested(&poll_loop_ncalls, EP_MAX_NESTS, | 1086 | error = ep_call_nested(&poll_loop_ncalls, EP_MAX_NESTS, |
1061 | reverse_path_check_proc, current_file, | 1087 | reverse_path_check_proc, current_file, |
@@ -1097,6 +1123,7 @@ static int ep_insert(struct eventpoll *ep, struct epoll_event *event, | |||
1097 | /* Initialize the poll table using the queue callback */ | 1123 | /* Initialize the poll table using the queue callback */ |
1098 | epq.epi = epi; | 1124 | epq.epi = epi; |
1099 | init_poll_funcptr(&epq.pt, ep_ptable_queue_proc); | 1125 | init_poll_funcptr(&epq.pt, ep_ptable_queue_proc); |
1126 | epq.pt._key = event->events; | ||
1100 | 1127 | ||
1101 | /* | 1128 | /* |
1102 | * Attach the item to the poll hooks and get current event bits. | 1129 | * Attach the item to the poll hooks and get current event bits. |
@@ -1191,6 +1218,9 @@ static int ep_modify(struct eventpoll *ep, struct epitem *epi, struct epoll_even | |||
1191 | { | 1218 | { |
1192 | int pwake = 0; | 1219 | int pwake = 0; |
1193 | unsigned int revents; | 1220 | unsigned int revents; |
1221 | poll_table pt; | ||
1222 | |||
1223 | init_poll_funcptr(&pt, NULL); | ||
1194 | 1224 | ||
1195 | /* | 1225 | /* |
1196 | * Set the new event interest mask before calling f_op->poll(); | 1226 | * Set the new event interest mask before calling f_op->poll(); |
@@ -1198,13 +1228,14 @@ static int ep_modify(struct eventpoll *ep, struct epitem *epi, struct epoll_even | |||
1198 | * f_op->poll() call and the new event set registering. | 1228 | * f_op->poll() call and the new event set registering. |
1199 | */ | 1229 | */ |
1200 | epi->event.events = event->events; | 1230 | epi->event.events = event->events; |
1231 | pt._key = event->events; | ||
1201 | epi->event.data = event->data; /* protected by mtx */ | 1232 | epi->event.data = event->data; /* protected by mtx */ |
1202 | 1233 | ||
1203 | /* | 1234 | /* |
1204 | * Get current event bits. We can safely use the file* here because | 1235 | * Get current event bits. We can safely use the file* here because |
1205 | * its usage count has been increased by the caller of this function. | 1236 | * its usage count has been increased by the caller of this function. |
1206 | */ | 1237 | */ |
1207 | revents = epi->ffd.file->f_op->poll(epi->ffd.file, NULL); | 1238 | revents = epi->ffd.file->f_op->poll(epi->ffd.file, &pt); |
1208 | 1239 | ||
1209 | /* | 1240 | /* |
1210 | * If the item is "hot" and it is not registered inside the ready | 1241 | * If the item is "hot" and it is not registered inside the ready |
@@ -1239,6 +1270,9 @@ static int ep_send_events_proc(struct eventpoll *ep, struct list_head *head, | |||
1239 | unsigned int revents; | 1270 | unsigned int revents; |
1240 | struct epitem *epi; | 1271 | struct epitem *epi; |
1241 | struct epoll_event __user *uevent; | 1272 | struct epoll_event __user *uevent; |
1273 | poll_table pt; | ||
1274 | |||
1275 | init_poll_funcptr(&pt, NULL); | ||
1242 | 1276 | ||
1243 | /* | 1277 | /* |
1244 | * We can loop without lock because we are passed a task private list. | 1278 | * We can loop without lock because we are passed a task private list. |
@@ -1251,7 +1285,8 @@ static int ep_send_events_proc(struct eventpoll *ep, struct list_head *head, | |||
1251 | 1285 | ||
1252 | list_del_init(&epi->rdllink); | 1286 | list_del_init(&epi->rdllink); |
1253 | 1287 | ||
1254 | revents = epi->ffd.file->f_op->poll(epi->ffd.file, NULL) & | 1288 | pt._key = epi->event.events; |
1289 | revents = epi->ffd.file->f_op->poll(epi->ffd.file, &pt) & | ||
1255 | epi->event.events; | 1290 | epi->event.events; |
1256 | 1291 | ||
1257 | /* | 1292 | /* |
diff --git a/fs/fat/namei_vfat.c b/fs/fat/namei_vfat.c index a81eb2367d39..98ae804f5273 100644 --- a/fs/fat/namei_vfat.c +++ b/fs/fat/namei_vfat.c | |||
@@ -521,57 +521,46 @@ xlate_to_uni(const unsigned char *name, int len, unsigned char *outname, | |||
521 | 521 | ||
522 | op = &outname[*outlen * sizeof(wchar_t)]; | 522 | op = &outname[*outlen * sizeof(wchar_t)]; |
523 | } else { | 523 | } else { |
524 | if (nls) { | 524 | for (i = 0, ip = name, op = outname, *outlen = 0; |
525 | for (i = 0, ip = name, op = outname, *outlen = 0; | 525 | i < len && *outlen < FAT_LFN_LEN; |
526 | i < len && *outlen <= FAT_LFN_LEN; | 526 | *outlen += 1) { |
527 | *outlen += 1) | 527 | if (escape && (*ip == ':')) { |
528 | { | 528 | if (i > len - 5) |
529 | if (escape && (*ip == ':')) { | 529 | return -EINVAL; |
530 | if (i > len - 5) | 530 | ec = 0; |
531 | return -EINVAL; | 531 | for (k = 1; k < 5; k++) { |
532 | ec = 0; | 532 | nc = ip[k]; |
533 | for (k = 1; k < 5; k++) { | 533 | ec <<= 4; |
534 | nc = ip[k]; | 534 | if (nc >= '0' && nc <= '9') { |
535 | ec <<= 4; | 535 | ec |= nc - '0'; |
536 | if (nc >= '0' && nc <= '9') { | 536 | continue; |
537 | ec |= nc - '0'; | ||
538 | continue; | ||
539 | } | ||
540 | if (nc >= 'a' && nc <= 'f') { | ||
541 | ec |= nc - ('a' - 10); | ||
542 | continue; | ||
543 | } | ||
544 | if (nc >= 'A' && nc <= 'F') { | ||
545 | ec |= nc - ('A' - 10); | ||
546 | continue; | ||
547 | } | ||
548 | return -EINVAL; | ||
549 | } | 537 | } |
550 | *op++ = ec & 0xFF; | 538 | if (nc >= 'a' && nc <= 'f') { |
551 | *op++ = ec >> 8; | 539 | ec |= nc - ('a' - 10); |
552 | ip += 5; | 540 | continue; |
553 | i += 5; | 541 | } |
554 | } else { | 542 | if (nc >= 'A' && nc <= 'F') { |
555 | if ((charlen = nls->char2uni(ip, len - i, (wchar_t *)op)) < 0) | 543 | ec |= nc - ('A' - 10); |
556 | return -EINVAL; | 544 | continue; |
557 | ip += charlen; | 545 | } |
558 | i += charlen; | 546 | return -EINVAL; |
559 | op += 2; | ||
560 | } | 547 | } |
548 | *op++ = ec & 0xFF; | ||
549 | *op++ = ec >> 8; | ||
550 | ip += 5; | ||
551 | i += 5; | ||
552 | } else { | ||
553 | charlen = nls->char2uni(ip, len - i, | ||
554 | (wchar_t *)op); | ||
555 | if (charlen < 0) | ||
556 | return -EINVAL; | ||
557 | ip += charlen; | ||
558 | i += charlen; | ||
559 | op += 2; | ||
561 | } | 560 | } |
562 | if (i < len) | ||
563 | return -ENAMETOOLONG; | ||
564 | } else { | ||
565 | for (i = 0, ip = name, op = outname, *outlen = 0; | ||
566 | i < len && *outlen <= FAT_LFN_LEN; | ||
567 | i++, *outlen += 1) | ||
568 | { | ||
569 | *op++ = *ip++; | ||
570 | *op++ = 0; | ||
571 | } | ||
572 | if (i < len) | ||
573 | return -ENAMETOOLONG; | ||
574 | } | 561 | } |
562 | if (i < len) | ||
563 | return -ENAMETOOLONG; | ||
575 | } | 564 | } |
576 | 565 | ||
577 | *longlen = *outlen; | 566 | *longlen = *outlen; |
diff --git a/fs/notify/notification.c b/fs/notify/notification.c index ee188158a224..c887b1378f7e 100644 --- a/fs/notify/notification.c +++ b/fs/notify/notification.c | |||
@@ -447,7 +447,7 @@ struct fsnotify_event *fsnotify_create_event(struct inode *to_tell, __u32 mask, | |||
447 | return event; | 447 | return event; |
448 | } | 448 | } |
449 | 449 | ||
450 | __init int fsnotify_notification_init(void) | 450 | static __init int fsnotify_notification_init(void) |
451 | { | 451 | { |
452 | fsnotify_event_cachep = KMEM_CACHE(fsnotify_event, SLAB_PANIC); | 452 | fsnotify_event_cachep = KMEM_CACHE(fsnotify_event, SLAB_PANIC); |
453 | fsnotify_event_holder_cachep = KMEM_CACHE(fsnotify_event_holder, SLAB_PANIC); | 453 | fsnotify_event_holder_cachep = KMEM_CACHE(fsnotify_event_holder, SLAB_PANIC); |
@@ -461,4 +461,3 @@ __init int fsnotify_notification_init(void) | |||
461 | return 0; | 461 | return 0; |
462 | } | 462 | } |
463 | subsys_initcall(fsnotify_notification_init); | 463 | subsys_initcall(fsnotify_notification_init); |
464 | |||
@@ -13,6 +13,7 @@ | |||
13 | #include <linux/fs.h> | 13 | #include <linux/fs.h> |
14 | #include <linux/log2.h> | 14 | #include <linux/log2.h> |
15 | #include <linux/mount.h> | 15 | #include <linux/mount.h> |
16 | #include <linux/magic.h> | ||
16 | #include <linux/pipe_fs_i.h> | 17 | #include <linux/pipe_fs_i.h> |
17 | #include <linux/uio.h> | 18 | #include <linux/uio.h> |
18 | #include <linux/highmem.h> | 19 | #include <linux/highmem.h> |
diff --git a/fs/proc/array.c b/fs/proc/array.c index c602b8d20f06..fbb53c249086 100644 --- a/fs/proc/array.c +++ b/fs/proc/array.c | |||
@@ -462,59 +462,56 @@ static int do_task_stat(struct seq_file *m, struct pid_namespace *ns, | |||
462 | /* convert nsec -> ticks */ | 462 | /* convert nsec -> ticks */ |
463 | start_time = nsec_to_clock_t(start_time); | 463 | start_time = nsec_to_clock_t(start_time); |
464 | 464 | ||
465 | seq_printf(m, "%d (%s) %c %d %d %d %d %d %u %lu \ | 465 | seq_printf(m, "%d (%s) %c", pid_nr_ns(pid, ns), tcomm, state); |
466 | %lu %lu %lu %lu %lu %ld %ld %ld %ld %d 0 %llu %lu %ld %lu %lu %lu %lu %lu \ | 466 | seq_put_decimal_ll(m, ' ', ppid); |
467 | %lu %lu %lu %lu %lu %lu %lu %lu %d %d %u %u %llu %lu %ld %lu %lu %lu\n", | 467 | seq_put_decimal_ll(m, ' ', pgid); |
468 | pid_nr_ns(pid, ns), | 468 | seq_put_decimal_ll(m, ' ', sid); |
469 | tcomm, | 469 | seq_put_decimal_ll(m, ' ', tty_nr); |
470 | state, | 470 | seq_put_decimal_ll(m, ' ', tty_pgrp); |
471 | ppid, | 471 | seq_put_decimal_ull(m, ' ', task->flags); |
472 | pgid, | 472 | seq_put_decimal_ull(m, ' ', min_flt); |
473 | sid, | 473 | seq_put_decimal_ull(m, ' ', cmin_flt); |
474 | tty_nr, | 474 | seq_put_decimal_ull(m, ' ', maj_flt); |
475 | tty_pgrp, | 475 | seq_put_decimal_ull(m, ' ', cmaj_flt); |
476 | task->flags, | 476 | seq_put_decimal_ull(m, ' ', cputime_to_clock_t(utime)); |
477 | min_flt, | 477 | seq_put_decimal_ull(m, ' ', cputime_to_clock_t(stime)); |
478 | cmin_flt, | 478 | seq_put_decimal_ll(m, ' ', cputime_to_clock_t(cutime)); |
479 | maj_flt, | 479 | seq_put_decimal_ll(m, ' ', cputime_to_clock_t(cstime)); |
480 | cmaj_flt, | 480 | seq_put_decimal_ll(m, ' ', priority); |
481 | cputime_to_clock_t(utime), | 481 | seq_put_decimal_ll(m, ' ', nice); |
482 | cputime_to_clock_t(stime), | 482 | seq_put_decimal_ll(m, ' ', num_threads); |
483 | cputime_to_clock_t(cutime), | 483 | seq_put_decimal_ull(m, ' ', 0); |
484 | cputime_to_clock_t(cstime), | 484 | seq_put_decimal_ull(m, ' ', start_time); |
485 | priority, | 485 | seq_put_decimal_ull(m, ' ', vsize); |
486 | nice, | 486 | seq_put_decimal_ll(m, ' ', mm ? get_mm_rss(mm) : 0); |
487 | num_threads, | 487 | seq_put_decimal_ull(m, ' ', rsslim); |
488 | start_time, | 488 | seq_put_decimal_ull(m, ' ', mm ? (permitted ? mm->start_code : 1) : 0); |
489 | vsize, | 489 | seq_put_decimal_ull(m, ' ', mm ? (permitted ? mm->end_code : 1) : 0); |
490 | mm ? get_mm_rss(mm) : 0, | 490 | seq_put_decimal_ull(m, ' ', (permitted && mm) ? mm->start_stack : 0); |
491 | rsslim, | 491 | seq_put_decimal_ull(m, ' ', esp); |
492 | mm ? (permitted ? mm->start_code : 1) : 0, | 492 | seq_put_decimal_ull(m, ' ', eip); |
493 | mm ? (permitted ? mm->end_code : 1) : 0, | 493 | /* The signal information here is obsolete. |
494 | (permitted && mm) ? mm->start_stack : 0, | 494 | * It must be decimal for Linux 2.0 compatibility. |
495 | esp, | 495 | * Use /proc/#/status for real-time signals. |
496 | eip, | 496 | */ |
497 | /* The signal information here is obsolete. | 497 | seq_put_decimal_ull(m, ' ', task->pending.signal.sig[0] & 0x7fffffffUL); |
498 | * It must be decimal for Linux 2.0 compatibility. | 498 | seq_put_decimal_ull(m, ' ', task->blocked.sig[0] & 0x7fffffffUL); |
499 | * Use /proc/#/status for real-time signals. | 499 | seq_put_decimal_ull(m, ' ', sigign.sig[0] & 0x7fffffffUL); |
500 | */ | 500 | seq_put_decimal_ull(m, ' ', sigcatch.sig[0] & 0x7fffffffUL); |
501 | task->pending.signal.sig[0] & 0x7fffffffUL, | 501 | seq_put_decimal_ull(m, ' ', wchan); |
502 | task->blocked.sig[0] & 0x7fffffffUL, | 502 | seq_put_decimal_ull(m, ' ', 0); |
503 | sigign .sig[0] & 0x7fffffffUL, | 503 | seq_put_decimal_ull(m, ' ', 0); |
504 | sigcatch .sig[0] & 0x7fffffffUL, | 504 | seq_put_decimal_ll(m, ' ', task->exit_signal); |
505 | wchan, | 505 | seq_put_decimal_ll(m, ' ', task_cpu(task)); |
506 | 0UL, | 506 | seq_put_decimal_ull(m, ' ', task->rt_priority); |
507 | 0UL, | 507 | seq_put_decimal_ull(m, ' ', task->policy); |
508 | task->exit_signal, | 508 | seq_put_decimal_ull(m, ' ', delayacct_blkio_ticks(task)); |
509 | task_cpu(task), | 509 | seq_put_decimal_ull(m, ' ', cputime_to_clock_t(gtime)); |
510 | task->rt_priority, | 510 | seq_put_decimal_ll(m, ' ', cputime_to_clock_t(cgtime)); |
511 | task->policy, | 511 | seq_put_decimal_ull(m, ' ', (mm && permitted) ? mm->start_data : 0); |
512 | (unsigned long long)delayacct_blkio_ticks(task), | 512 | seq_put_decimal_ull(m, ' ', (mm && permitted) ? mm->end_data : 0); |
513 | cputime_to_clock_t(gtime), | 513 | seq_put_decimal_ull(m, ' ', (mm && permitted) ? mm->start_brk : 0); |
514 | cputime_to_clock_t(cgtime), | 514 | seq_putc(m, '\n'); |
515 | (mm && permitted) ? mm->start_data : 0, | ||
516 | (mm && permitted) ? mm->end_data : 0, | ||
517 | (mm && permitted) ? mm->start_brk : 0); | ||
518 | if (mm) | 515 | if (mm) |
519 | mmput(mm); | 516 | mmput(mm); |
520 | return 0; | 517 | return 0; |
@@ -542,8 +539,20 @@ int proc_pid_statm(struct seq_file *m, struct pid_namespace *ns, | |||
542 | size = task_statm(mm, &shared, &text, &data, &resident); | 539 | size = task_statm(mm, &shared, &text, &data, &resident); |
543 | mmput(mm); | 540 | mmput(mm); |
544 | } | 541 | } |
545 | seq_printf(m, "%lu %lu %lu %lu 0 %lu 0\n", | 542 | /* |
546 | size, resident, shared, text, data); | 543 | * For quick read, open code by putting numbers directly |
544 | * expected format is | ||
545 | * seq_printf(m, "%lu %lu %lu %lu 0 %lu 0\n", | ||
546 | * size, resident, shared, text, data); | ||
547 | */ | ||
548 | seq_put_decimal_ull(m, 0, size); | ||
549 | seq_put_decimal_ull(m, ' ', resident); | ||
550 | seq_put_decimal_ull(m, ' ', shared); | ||
551 | seq_put_decimal_ull(m, ' ', text); | ||
552 | seq_put_decimal_ull(m, ' ', 0); | ||
553 | seq_put_decimal_ull(m, ' ', text); | ||
554 | seq_put_decimal_ull(m, ' ', 0); | ||
555 | seq_putc(m, '\n'); | ||
547 | 556 | ||
548 | return 0; | 557 | return 0; |
549 | } | 558 | } |
diff --git a/fs/proc/kcore.c b/fs/proc/kcore.c index e5e69aff6c69..86c67eee439f 100644 --- a/fs/proc/kcore.c +++ b/fs/proc/kcore.c | |||
@@ -157,7 +157,8 @@ static int kcore_update_ram(void) | |||
157 | 157 | ||
158 | #ifdef CONFIG_SPARSEMEM_VMEMMAP | 158 | #ifdef CONFIG_SPARSEMEM_VMEMMAP |
159 | /* calculate vmemmap's address from given system ram pfn and register it */ | 159 | /* calculate vmemmap's address from given system ram pfn and register it */ |
160 | int get_sparsemem_vmemmap_info(struct kcore_list *ent, struct list_head *head) | 160 | static int |
161 | get_sparsemem_vmemmap_info(struct kcore_list *ent, struct list_head *head) | ||
161 | { | 162 | { |
162 | unsigned long pfn = __pa(ent->addr) >> PAGE_SHIFT; | 163 | unsigned long pfn = __pa(ent->addr) >> PAGE_SHIFT; |
163 | unsigned long nr_pages = ent->size >> PAGE_SHIFT; | 164 | unsigned long nr_pages = ent->size >> PAGE_SHIFT; |
@@ -189,7 +190,8 @@ int get_sparsemem_vmemmap_info(struct kcore_list *ent, struct list_head *head) | |||
189 | 190 | ||
190 | } | 191 | } |
191 | #else | 192 | #else |
192 | int get_sparsemem_vmemmap_info(struct kcore_list *ent, struct list_head *head) | 193 | static int |
194 | get_sparsemem_vmemmap_info(struct kcore_list *ent, struct list_head *head) | ||
193 | { | 195 | { |
194 | return 1; | 196 | return 1; |
195 | } | 197 | } |
diff --git a/fs/proc/namespaces.c b/fs/proc/namespaces.c index 27da860115c6..3551f1f839eb 100644 --- a/fs/proc/namespaces.c +++ b/fs/proc/namespaces.c | |||
@@ -53,7 +53,7 @@ static struct dentry *proc_ns_instantiate(struct inode *dir, | |||
53 | ei->ns_ops = ns_ops; | 53 | ei->ns_ops = ns_ops; |
54 | ei->ns = ns; | 54 | ei->ns = ns; |
55 | 55 | ||
56 | dentry->d_op = &pid_dentry_operations; | 56 | d_set_d_op(dentry, &pid_dentry_operations); |
57 | d_add(dentry, inode); | 57 | d_add(dentry, inode); |
58 | /* Close the race of the process dying before we return the dentry */ | 58 | /* Close the race of the process dying before we return the dentry */ |
59 | if (pid_revalidate(dentry, NULL)) | 59 | if (pid_revalidate(dentry, NULL)) |
diff --git a/fs/proc/stat.c b/fs/proc/stat.c index 121f77cfef76..6a0c62d6e442 100644 --- a/fs/proc/stat.c +++ b/fs/proc/stat.c | |||
@@ -89,18 +89,19 @@ static int show_stat(struct seq_file *p, void *v) | |||
89 | } | 89 | } |
90 | sum += arch_irq_stat(); | 90 | sum += arch_irq_stat(); |
91 | 91 | ||
92 | seq_printf(p, "cpu %llu %llu %llu %llu %llu %llu %llu %llu %llu " | 92 | seq_puts(p, "cpu "); |
93 | "%llu\n", | 93 | seq_put_decimal_ull(p, ' ', cputime64_to_clock_t(user)); |
94 | (unsigned long long)cputime64_to_clock_t(user), | 94 | seq_put_decimal_ull(p, ' ', cputime64_to_clock_t(nice)); |
95 | (unsigned long long)cputime64_to_clock_t(nice), | 95 | seq_put_decimal_ull(p, ' ', cputime64_to_clock_t(system)); |
96 | (unsigned long long)cputime64_to_clock_t(system), | 96 | seq_put_decimal_ull(p, ' ', cputime64_to_clock_t(idle)); |
97 | (unsigned long long)cputime64_to_clock_t(idle), | 97 | seq_put_decimal_ull(p, ' ', cputime64_to_clock_t(iowait)); |
98 | (unsigned long long)cputime64_to_clock_t(iowait), | 98 | seq_put_decimal_ull(p, ' ', cputime64_to_clock_t(irq)); |
99 | (unsigned long long)cputime64_to_clock_t(irq), | 99 | seq_put_decimal_ull(p, ' ', cputime64_to_clock_t(softirq)); |
100 | (unsigned long long)cputime64_to_clock_t(softirq), | 100 | seq_put_decimal_ull(p, ' ', cputime64_to_clock_t(steal)); |
101 | (unsigned long long)cputime64_to_clock_t(steal), | 101 | seq_put_decimal_ull(p, ' ', cputime64_to_clock_t(guest)); |
102 | (unsigned long long)cputime64_to_clock_t(guest), | 102 | seq_put_decimal_ull(p, ' ', cputime64_to_clock_t(guest_nice)); |
103 | (unsigned long long)cputime64_to_clock_t(guest_nice)); | 103 | seq_putc(p, '\n'); |
104 | |||
104 | for_each_online_cpu(i) { | 105 | for_each_online_cpu(i) { |
105 | /* Copy values here to work around gcc-2.95.3, gcc-2.96 */ | 106 | /* Copy values here to work around gcc-2.95.3, gcc-2.96 */ |
106 | user = kcpustat_cpu(i).cpustat[CPUTIME_USER]; | 107 | user = kcpustat_cpu(i).cpustat[CPUTIME_USER]; |
@@ -113,26 +114,24 @@ static int show_stat(struct seq_file *p, void *v) | |||
113 | steal = kcpustat_cpu(i).cpustat[CPUTIME_STEAL]; | 114 | steal = kcpustat_cpu(i).cpustat[CPUTIME_STEAL]; |
114 | guest = kcpustat_cpu(i).cpustat[CPUTIME_GUEST]; | 115 | guest = kcpustat_cpu(i).cpustat[CPUTIME_GUEST]; |
115 | guest_nice = kcpustat_cpu(i).cpustat[CPUTIME_GUEST_NICE]; | 116 | guest_nice = kcpustat_cpu(i).cpustat[CPUTIME_GUEST_NICE]; |
116 | seq_printf(p, | 117 | seq_printf(p, "cpu%d", i); |
117 | "cpu%d %llu %llu %llu %llu %llu %llu %llu %llu %llu " | 118 | seq_put_decimal_ull(p, ' ', cputime64_to_clock_t(user)); |
118 | "%llu\n", | 119 | seq_put_decimal_ull(p, ' ', cputime64_to_clock_t(nice)); |
119 | i, | 120 | seq_put_decimal_ull(p, ' ', cputime64_to_clock_t(system)); |
120 | (unsigned long long)cputime64_to_clock_t(user), | 121 | seq_put_decimal_ull(p, ' ', cputime64_to_clock_t(idle)); |
121 | (unsigned long long)cputime64_to_clock_t(nice), | 122 | seq_put_decimal_ull(p, ' ', cputime64_to_clock_t(iowait)); |
122 | (unsigned long long)cputime64_to_clock_t(system), | 123 | seq_put_decimal_ull(p, ' ', cputime64_to_clock_t(irq)); |
123 | (unsigned long long)cputime64_to_clock_t(idle), | 124 | seq_put_decimal_ull(p, ' ', cputime64_to_clock_t(softirq)); |
124 | (unsigned long long)cputime64_to_clock_t(iowait), | 125 | seq_put_decimal_ull(p, ' ', cputime64_to_clock_t(steal)); |
125 | (unsigned long long)cputime64_to_clock_t(irq), | 126 | seq_put_decimal_ull(p, ' ', cputime64_to_clock_t(guest)); |
126 | (unsigned long long)cputime64_to_clock_t(softirq), | 127 | seq_put_decimal_ull(p, ' ', cputime64_to_clock_t(guest_nice)); |
127 | (unsigned long long)cputime64_to_clock_t(steal), | 128 | seq_putc(p, '\n'); |
128 | (unsigned long long)cputime64_to_clock_t(guest), | ||
129 | (unsigned long long)cputime64_to_clock_t(guest_nice)); | ||
130 | } | 129 | } |
131 | seq_printf(p, "intr %llu", (unsigned long long)sum); | 130 | seq_printf(p, "intr %llu", (unsigned long long)sum); |
132 | 131 | ||
133 | /* sum again ? it could be updated? */ | 132 | /* sum again ? it could be updated? */ |
134 | for_each_irq_nr(j) | 133 | for_each_irq_nr(j) |
135 | seq_printf(p, " %u", kstat_irqs(j)); | 134 | seq_put_decimal_ull(p, ' ', kstat_irqs(j)); |
136 | 135 | ||
137 | seq_printf(p, | 136 | seq_printf(p, |
138 | "\nctxt %llu\n" | 137 | "\nctxt %llu\n" |
@@ -149,7 +148,7 @@ static int show_stat(struct seq_file *p, void *v) | |||
149 | seq_printf(p, "softirq %llu", (unsigned long long)sum_softirq); | 148 | seq_printf(p, "softirq %llu", (unsigned long long)sum_softirq); |
150 | 149 | ||
151 | for (i = 0; i < NR_SOFTIRQS; i++) | 150 | for (i = 0; i < NR_SOFTIRQS; i++) |
152 | seq_printf(p, " %u", per_softirq_sums[i]); | 151 | seq_put_decimal_ull(p, ' ', per_softirq_sums[i]); |
153 | seq_putc(p, '\n'); | 152 | seq_putc(p, '\n'); |
154 | 153 | ||
155 | return 0; | 154 | return 0; |
@@ -157,11 +156,14 @@ static int show_stat(struct seq_file *p, void *v) | |||
157 | 156 | ||
158 | static int stat_open(struct inode *inode, struct file *file) | 157 | static int stat_open(struct inode *inode, struct file *file) |
159 | { | 158 | { |
160 | unsigned size = 4096 * (1 + num_possible_cpus() / 32); | 159 | unsigned size = 1024 + 128 * num_possible_cpus(); |
161 | char *buf; | 160 | char *buf; |
162 | struct seq_file *m; | 161 | struct seq_file *m; |
163 | int res; | 162 | int res; |
164 | 163 | ||
164 | /* minimum size to display an interrupt count : 2 bytes */ | ||
165 | size += 2 * nr_irqs; | ||
166 | |||
165 | /* don't ask for more than the kmalloc() max size */ | 167 | /* don't ask for more than the kmalloc() max size */ |
166 | if (size > KMALLOC_MAX_SIZE) | 168 | if (size > KMALLOC_MAX_SIZE) |
167 | size = KMALLOC_MAX_SIZE; | 169 | size = KMALLOC_MAX_SIZE; |
@@ -173,7 +175,7 @@ static int stat_open(struct inode *inode, struct file *file) | |||
173 | if (!res) { | 175 | if (!res) { |
174 | m = file->private_data; | 176 | m = file->private_data; |
175 | m->buf = buf; | 177 | m->buf = buf; |
176 | m->size = size; | 178 | m->size = ksize(buf); |
177 | } else | 179 | } else |
178 | kfree(buf); | 180 | kfree(buf); |
179 | return res; | 181 | return res; |
diff --git a/fs/select.c b/fs/select.c index e782258d0de3..ecfd0b125ba2 100644 --- a/fs/select.c +++ b/fs/select.c | |||
@@ -223,7 +223,7 @@ static void __pollwait(struct file *filp, wait_queue_head_t *wait_address, | |||
223 | get_file(filp); | 223 | get_file(filp); |
224 | entry->filp = filp; | 224 | entry->filp = filp; |
225 | entry->wait_address = wait_address; | 225 | entry->wait_address = wait_address; |
226 | entry->key = p->key; | 226 | entry->key = p->_key; |
227 | init_waitqueue_func_entry(&entry->wait, pollwake); | 227 | init_waitqueue_func_entry(&entry->wait, pollwake); |
228 | entry->wait.private = pwq; | 228 | entry->wait.private = pwq; |
229 | add_wait_queue(wait_address, &entry->wait); | 229 | add_wait_queue(wait_address, &entry->wait); |
@@ -386,13 +386,11 @@ get_max: | |||
386 | static inline void wait_key_set(poll_table *wait, unsigned long in, | 386 | static inline void wait_key_set(poll_table *wait, unsigned long in, |
387 | unsigned long out, unsigned long bit) | 387 | unsigned long out, unsigned long bit) |
388 | { | 388 | { |
389 | if (wait) { | 389 | wait->_key = POLLEX_SET; |
390 | wait->key = POLLEX_SET; | 390 | if (in & bit) |
391 | if (in & bit) | 391 | wait->_key |= POLLIN_SET; |
392 | wait->key |= POLLIN_SET; | 392 | if (out & bit) |
393 | if (out & bit) | 393 | wait->_key |= POLLOUT_SET; |
394 | wait->key |= POLLOUT_SET; | ||
395 | } | ||
396 | } | 394 | } |
397 | 395 | ||
398 | int do_select(int n, fd_set_bits *fds, struct timespec *end_time) | 396 | int do_select(int n, fd_set_bits *fds, struct timespec *end_time) |
@@ -414,7 +412,7 @@ int do_select(int n, fd_set_bits *fds, struct timespec *end_time) | |||
414 | poll_initwait(&table); | 412 | poll_initwait(&table); |
415 | wait = &table.pt; | 413 | wait = &table.pt; |
416 | if (end_time && !end_time->tv_sec && !end_time->tv_nsec) { | 414 | if (end_time && !end_time->tv_sec && !end_time->tv_nsec) { |
417 | wait = NULL; | 415 | wait->_qproc = NULL; |
418 | timed_out = 1; | 416 | timed_out = 1; |
419 | } | 417 | } |
420 | 418 | ||
@@ -459,17 +457,17 @@ int do_select(int n, fd_set_bits *fds, struct timespec *end_time) | |||
459 | if ((mask & POLLIN_SET) && (in & bit)) { | 457 | if ((mask & POLLIN_SET) && (in & bit)) { |
460 | res_in |= bit; | 458 | res_in |= bit; |
461 | retval++; | 459 | retval++; |
462 | wait = NULL; | 460 | wait->_qproc = NULL; |
463 | } | 461 | } |
464 | if ((mask & POLLOUT_SET) && (out & bit)) { | 462 | if ((mask & POLLOUT_SET) && (out & bit)) { |
465 | res_out |= bit; | 463 | res_out |= bit; |
466 | retval++; | 464 | retval++; |
467 | wait = NULL; | 465 | wait->_qproc = NULL; |
468 | } | 466 | } |
469 | if ((mask & POLLEX_SET) && (ex & bit)) { | 467 | if ((mask & POLLEX_SET) && (ex & bit)) { |
470 | res_ex |= bit; | 468 | res_ex |= bit; |
471 | retval++; | 469 | retval++; |
472 | wait = NULL; | 470 | wait->_qproc = NULL; |
473 | } | 471 | } |
474 | } | 472 | } |
475 | } | 473 | } |
@@ -481,7 +479,7 @@ int do_select(int n, fd_set_bits *fds, struct timespec *end_time) | |||
481 | *rexp = res_ex; | 479 | *rexp = res_ex; |
482 | cond_resched(); | 480 | cond_resched(); |
483 | } | 481 | } |
484 | wait = NULL; | 482 | wait->_qproc = NULL; |
485 | if (retval || timed_out || signal_pending(current)) | 483 | if (retval || timed_out || signal_pending(current)) |
486 | break; | 484 | break; |
487 | if (table.error) { | 485 | if (table.error) { |
@@ -720,7 +718,7 @@ struct poll_list { | |||
720 | * interested in events matching the pollfd->events mask, and the result | 718 | * interested in events matching the pollfd->events mask, and the result |
721 | * matching that mask is both recorded in pollfd->revents and returned. The | 719 | * matching that mask is both recorded in pollfd->revents and returned. The |
722 | * pwait poll_table will be used by the fd-provided poll handler for waiting, | 720 | * pwait poll_table will be used by the fd-provided poll handler for waiting, |
723 | * if non-NULL. | 721 | * if pwait->_qproc is non-NULL. |
724 | */ | 722 | */ |
725 | static inline unsigned int do_pollfd(struct pollfd *pollfd, poll_table *pwait) | 723 | static inline unsigned int do_pollfd(struct pollfd *pollfd, poll_table *pwait) |
726 | { | 724 | { |
@@ -738,9 +736,7 @@ static inline unsigned int do_pollfd(struct pollfd *pollfd, poll_table *pwait) | |||
738 | if (file != NULL) { | 736 | if (file != NULL) { |
739 | mask = DEFAULT_POLLMASK; | 737 | mask = DEFAULT_POLLMASK; |
740 | if (file->f_op && file->f_op->poll) { | 738 | if (file->f_op && file->f_op->poll) { |
741 | if (pwait) | 739 | pwait->_key = pollfd->events|POLLERR|POLLHUP; |
742 | pwait->key = pollfd->events | | ||
743 | POLLERR | POLLHUP; | ||
744 | mask = file->f_op->poll(file, pwait); | 740 | mask = file->f_op->poll(file, pwait); |
745 | } | 741 | } |
746 | /* Mask out unneeded events. */ | 742 | /* Mask out unneeded events. */ |
@@ -763,7 +759,7 @@ static int do_poll(unsigned int nfds, struct poll_list *list, | |||
763 | 759 | ||
764 | /* Optimise the no-wait case */ | 760 | /* Optimise the no-wait case */ |
765 | if (end_time && !end_time->tv_sec && !end_time->tv_nsec) { | 761 | if (end_time && !end_time->tv_sec && !end_time->tv_nsec) { |
766 | pt = NULL; | 762 | pt->_qproc = NULL; |
767 | timed_out = 1; | 763 | timed_out = 1; |
768 | } | 764 | } |
769 | 765 | ||
@@ -781,22 +777,22 @@ static int do_poll(unsigned int nfds, struct poll_list *list, | |||
781 | for (; pfd != pfd_end; pfd++) { | 777 | for (; pfd != pfd_end; pfd++) { |
782 | /* | 778 | /* |
783 | * Fish for events. If we found one, record it | 779 | * Fish for events. If we found one, record it |
784 | * and kill the poll_table, so we don't | 780 | * and kill poll_table->_qproc, so we don't |
785 | * needlessly register any other waiters after | 781 | * needlessly register any other waiters after |
786 | * this. They'll get immediately deregistered | 782 | * this. They'll get immediately deregistered |
787 | * when we break out and return. | 783 | * when we break out and return. |
788 | */ | 784 | */ |
789 | if (do_pollfd(pfd, pt)) { | 785 | if (do_pollfd(pfd, pt)) { |
790 | count++; | 786 | count++; |
791 | pt = NULL; | 787 | pt->_qproc = NULL; |
792 | } | 788 | } |
793 | } | 789 | } |
794 | } | 790 | } |
795 | /* | 791 | /* |
796 | * All waiters have already been registered, so don't provide | 792 | * All waiters have already been registered, so don't provide |
797 | * a poll_table to them on the next loop iteration. | 793 | * a poll_table->_qproc to them on the next loop iteration. |
798 | */ | 794 | */ |
799 | pt = NULL; | 795 | pt->_qproc = NULL; |
800 | if (!count) { | 796 | if (!count) { |
801 | count = wait->error; | 797 | count = wait->error; |
802 | if (signal_pending(current)) | 798 | if (signal_pending(current)) |
diff --git a/fs/seq_file.c b/fs/seq_file.c index aa242dc99373..46cfb067fc3a 100644 --- a/fs/seq_file.c +++ b/fs/seq_file.c | |||
@@ -13,6 +13,22 @@ | |||
13 | #include <asm/uaccess.h> | 13 | #include <asm/uaccess.h> |
14 | #include <asm/page.h> | 14 | #include <asm/page.h> |
15 | 15 | ||
16 | |||
17 | /* | ||
18 | * seq_files have a buffer which can may overflow. When this happens a larger | ||
19 | * buffer is reallocated and all the data will be printed again. | ||
20 | * The overflow state is true when m->count == m->size. | ||
21 | */ | ||
22 | static bool seq_overflow(struct seq_file *m) | ||
23 | { | ||
24 | return m->count == m->size; | ||
25 | } | ||
26 | |||
27 | static void seq_set_overflow(struct seq_file *m) | ||
28 | { | ||
29 | m->count = m->size; | ||
30 | } | ||
31 | |||
16 | /** | 32 | /** |
17 | * seq_open - initialize sequential file | 33 | * seq_open - initialize sequential file |
18 | * @file: file we initialize | 34 | * @file: file we initialize |
@@ -92,7 +108,7 @@ static int traverse(struct seq_file *m, loff_t offset) | |||
92 | error = 0; | 108 | error = 0; |
93 | m->count = 0; | 109 | m->count = 0; |
94 | } | 110 | } |
95 | if (m->count == m->size) | 111 | if (seq_overflow(m)) |
96 | goto Eoverflow; | 112 | goto Eoverflow; |
97 | if (pos + m->count > offset) { | 113 | if (pos + m->count > offset) { |
98 | m->from = offset - pos; | 114 | m->from = offset - pos; |
@@ -234,7 +250,7 @@ Fill: | |||
234 | break; | 250 | break; |
235 | } | 251 | } |
236 | err = m->op->show(m, p); | 252 | err = m->op->show(m, p); |
237 | if (m->count == m->size || err) { | 253 | if (seq_overflow(m) || err) { |
238 | m->count = offs; | 254 | m->count = offs; |
239 | if (likely(err <= 0)) | 255 | if (likely(err <= 0)) |
240 | break; | 256 | break; |
@@ -361,7 +377,7 @@ int seq_escape(struct seq_file *m, const char *s, const char *esc) | |||
361 | *p++ = '0' + (c & 07); | 377 | *p++ = '0' + (c & 07); |
362 | continue; | 378 | continue; |
363 | } | 379 | } |
364 | m->count = m->size; | 380 | seq_set_overflow(m); |
365 | return -1; | 381 | return -1; |
366 | } | 382 | } |
367 | m->count = p - m->buf; | 383 | m->count = p - m->buf; |
@@ -383,7 +399,7 @@ int seq_printf(struct seq_file *m, const char *f, ...) | |||
383 | return 0; | 399 | return 0; |
384 | } | 400 | } |
385 | } | 401 | } |
386 | m->count = m->size; | 402 | seq_set_overflow(m); |
387 | return -1; | 403 | return -1; |
388 | } | 404 | } |
389 | EXPORT_SYMBOL(seq_printf); | 405 | EXPORT_SYMBOL(seq_printf); |
@@ -512,7 +528,7 @@ int seq_bitmap(struct seq_file *m, const unsigned long *bits, | |||
512 | return 0; | 528 | return 0; |
513 | } | 529 | } |
514 | } | 530 | } |
515 | m->count = m->size; | 531 | seq_set_overflow(m); |
516 | return -1; | 532 | return -1; |
517 | } | 533 | } |
518 | EXPORT_SYMBOL(seq_bitmap); | 534 | EXPORT_SYMBOL(seq_bitmap); |
@@ -528,7 +544,7 @@ int seq_bitmap_list(struct seq_file *m, const unsigned long *bits, | |||
528 | return 0; | 544 | return 0; |
529 | } | 545 | } |
530 | } | 546 | } |
531 | m->count = m->size; | 547 | seq_set_overflow(m); |
532 | return -1; | 548 | return -1; |
533 | } | 549 | } |
534 | EXPORT_SYMBOL(seq_bitmap_list); | 550 | EXPORT_SYMBOL(seq_bitmap_list); |
@@ -639,11 +655,63 @@ int seq_puts(struct seq_file *m, const char *s) | |||
639 | m->count += len; | 655 | m->count += len; |
640 | return 0; | 656 | return 0; |
641 | } | 657 | } |
642 | m->count = m->size; | 658 | seq_set_overflow(m); |
643 | return -1; | 659 | return -1; |
644 | } | 660 | } |
645 | EXPORT_SYMBOL(seq_puts); | 661 | EXPORT_SYMBOL(seq_puts); |
646 | 662 | ||
663 | /* | ||
664 | * A helper routine for putting decimal numbers without rich format of printf(). | ||
665 | * only 'unsigned long long' is supported. | ||
666 | * This routine will put one byte delimiter + number into seq_file. | ||
667 | * This routine is very quick when you show lots of numbers. | ||
668 | * In usual cases, it will be better to use seq_printf(). It's easier to read. | ||
669 | */ | ||
670 | int seq_put_decimal_ull(struct seq_file *m, char delimiter, | ||
671 | unsigned long long num) | ||
672 | { | ||
673 | int len; | ||
674 | |||
675 | if (m->count + 2 >= m->size) /* we'll write 2 bytes at least */ | ||
676 | goto overflow; | ||
677 | |||
678 | if (delimiter) | ||
679 | m->buf[m->count++] = delimiter; | ||
680 | |||
681 | if (num < 10) { | ||
682 | m->buf[m->count++] = num + '0'; | ||
683 | return 0; | ||
684 | } | ||
685 | |||
686 | len = num_to_str(m->buf + m->count, m->size - m->count, num); | ||
687 | if (!len) | ||
688 | goto overflow; | ||
689 | m->count += len; | ||
690 | return 0; | ||
691 | overflow: | ||
692 | seq_set_overflow(m); | ||
693 | return -1; | ||
694 | } | ||
695 | EXPORT_SYMBOL(seq_put_decimal_ull); | ||
696 | |||
697 | int seq_put_decimal_ll(struct seq_file *m, char delimiter, | ||
698 | long long num) | ||
699 | { | ||
700 | if (num < 0) { | ||
701 | if (m->count + 3 >= m->size) { | ||
702 | seq_set_overflow(m); | ||
703 | return -1; | ||
704 | } | ||
705 | if (delimiter) | ||
706 | m->buf[m->count++] = delimiter; | ||
707 | num = -num; | ||
708 | delimiter = '-'; | ||
709 | } | ||
710 | return seq_put_decimal_ull(m, delimiter, num); | ||
711 | |||
712 | } | ||
713 | EXPORT_SYMBOL(seq_put_decimal_ll); | ||
714 | |||
647 | /** | 715 | /** |
648 | * seq_write - write arbitrary data to buffer | 716 | * seq_write - write arbitrary data to buffer |
649 | * @seq: seq_file identifying the buffer to which data should be written | 717 | * @seq: seq_file identifying the buffer to which data should be written |
@@ -659,7 +727,7 @@ int seq_write(struct seq_file *seq, const void *data, size_t len) | |||
659 | seq->count += len; | 727 | seq->count += len; |
660 | return 0; | 728 | return 0; |
661 | } | 729 | } |
662 | seq->count = seq->size; | 730 | seq_set_overflow(seq); |
663 | return -1; | 731 | return -1; |
664 | } | 732 | } |
665 | EXPORT_SYMBOL(seq_write); | 733 | EXPORT_SYMBOL(seq_write); |
diff --git a/include/asm-generic/bug.h b/include/asm-generic/bug.h index 84458b0c38d1..2520a6e241dc 100644 --- a/include/asm-generic/bug.h +++ b/include/asm-generic/bug.h | |||
@@ -134,7 +134,7 @@ extern void warn_slowpath_null(const char *file, const int line); | |||
134 | #endif | 134 | #endif |
135 | 135 | ||
136 | #define WARN_ON_ONCE(condition) ({ \ | 136 | #define WARN_ON_ONCE(condition) ({ \ |
137 | static bool __warned; \ | 137 | static bool __section(.data.unlikely) __warned; \ |
138 | int __ret_warn_once = !!(condition); \ | 138 | int __ret_warn_once = !!(condition); \ |
139 | \ | 139 | \ |
140 | if (unlikely(__ret_warn_once)) \ | 140 | if (unlikely(__ret_warn_once)) \ |
@@ -144,7 +144,7 @@ extern void warn_slowpath_null(const char *file, const int line); | |||
144 | }) | 144 | }) |
145 | 145 | ||
146 | #define WARN_ONCE(condition, format...) ({ \ | 146 | #define WARN_ONCE(condition, format...) ({ \ |
147 | static bool __warned; \ | 147 | static bool __section(.data.unlikely) __warned; \ |
148 | int __ret_warn_once = !!(condition); \ | 148 | int __ret_warn_once = !!(condition); \ |
149 | \ | 149 | \ |
150 | if (unlikely(__ret_warn_once)) \ | 150 | if (unlikely(__ret_warn_once)) \ |
@@ -154,7 +154,7 @@ extern void warn_slowpath_null(const char *file, const int line); | |||
154 | }) | 154 | }) |
155 | 155 | ||
156 | #define WARN_TAINT_ONCE(condition, taint, format...) ({ \ | 156 | #define WARN_TAINT_ONCE(condition, taint, format...) ({ \ |
157 | static bool __warned; \ | 157 | static bool __section(.data.unlikely) __warned; \ |
158 | int __ret_warn_once = !!(condition); \ | 158 | int __ret_warn_once = !!(condition); \ |
159 | \ | 159 | \ |
160 | if (unlikely(__ret_warn_once)) \ | 160 | if (unlikely(__ret_warn_once)) \ |
diff --git a/include/asm-generic/mman-common.h b/include/asm-generic/mman-common.h index 787abbb6d867..d030d2c2647a 100644 --- a/include/asm-generic/mman-common.h +++ b/include/asm-generic/mman-common.h | |||
@@ -48,6 +48,10 @@ | |||
48 | #define MADV_HUGEPAGE 14 /* Worth backing with hugepages */ | 48 | #define MADV_HUGEPAGE 14 /* Worth backing with hugepages */ |
49 | #define MADV_NOHUGEPAGE 15 /* Not worth backing with hugepages */ | 49 | #define MADV_NOHUGEPAGE 15 /* Not worth backing with hugepages */ |
50 | 50 | ||
51 | #define MADV_DONTDUMP 16 /* Explicity exclude from the core dump, | ||
52 | overrides the coredump filter bits */ | ||
53 | #define MADV_DODUMP 17 /* Clear the MADV_NODUMP flag */ | ||
54 | |||
51 | /* compatibility flags */ | 55 | /* compatibility flags */ |
52 | #define MAP_FILE 0 | 56 | #define MAP_FILE 0 |
53 | 57 | ||
diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h index b5e2e4c6b017..798603e8ec38 100644 --- a/include/asm-generic/vmlinux.lds.h +++ b/include/asm-generic/vmlinux.lds.h | |||
@@ -167,6 +167,7 @@ | |||
167 | CPU_KEEP(exit.data) \ | 167 | CPU_KEEP(exit.data) \ |
168 | MEM_KEEP(init.data) \ | 168 | MEM_KEEP(init.data) \ |
169 | MEM_KEEP(exit.data) \ | 169 | MEM_KEEP(exit.data) \ |
170 | *(.data.unlikely) \ | ||
170 | STRUCT_ALIGN(); \ | 171 | STRUCT_ALIGN(); \ |
171 | *(__tracepoints) \ | 172 | *(__tracepoints) \ |
172 | /* implement dynamic printk debug */ \ | 173 | /* implement dynamic printk debug */ \ |
diff --git a/include/drm/drm_mode.h b/include/drm/drm_mode.h index 2a2acda8b437..4a0aae38e160 100644 --- a/include/drm/drm_mode.h +++ b/include/drm/drm_mode.h | |||
@@ -27,6 +27,8 @@ | |||
27 | #ifndef _DRM_MODE_H | 27 | #ifndef _DRM_MODE_H |
28 | #define _DRM_MODE_H | 28 | #define _DRM_MODE_H |
29 | 29 | ||
30 | #include <linux/types.h> | ||
31 | |||
30 | #define DRM_DISPLAY_INFO_LEN 32 | 32 | #define DRM_DISPLAY_INFO_LEN 32 |
31 | #define DRM_CONNECTOR_NAME_LEN 32 | 33 | #define DRM_CONNECTOR_NAME_LEN 32 |
32 | #define DRM_DISPLAY_MODE_LEN 32 | 34 | #define DRM_DISPLAY_MODE_LEN 32 |
diff --git a/include/linux/bitops.h b/include/linux/bitops.h index 94300fe46cce..a3b6b82108b9 100644 --- a/include/linux/bitops.h +++ b/include/linux/bitops.h | |||
@@ -27,11 +27,22 @@ extern unsigned long __sw_hweight64(__u64 w); | |||
27 | (bit) = find_next_bit((addr), (size), (bit) + 1)) | 27 | (bit) = find_next_bit((addr), (size), (bit) + 1)) |
28 | 28 | ||
29 | /* same as for_each_set_bit() but use bit as value to start with */ | 29 | /* same as for_each_set_bit() but use bit as value to start with */ |
30 | #define for_each_set_bit_cont(bit, addr, size) \ | 30 | #define for_each_set_bit_from(bit, addr, size) \ |
31 | for ((bit) = find_next_bit((addr), (size), (bit)); \ | 31 | for ((bit) = find_next_bit((addr), (size), (bit)); \ |
32 | (bit) < (size); \ | 32 | (bit) < (size); \ |
33 | (bit) = find_next_bit((addr), (size), (bit) + 1)) | 33 | (bit) = find_next_bit((addr), (size), (bit) + 1)) |
34 | 34 | ||
35 | #define for_each_clear_bit(bit, addr, size) \ | ||
36 | for ((bit) = find_first_zero_bit((addr), (size)); \ | ||
37 | (bit) < (size); \ | ||
38 | (bit) = find_next_zero_bit((addr), (size), (bit) + 1)) | ||
39 | |||
40 | /* same as for_each_clear_bit() but use bit as value to start with */ | ||
41 | #define for_each_clear_bit_from(bit, addr, size) \ | ||
42 | for ((bit) = find_next_zero_bit((addr), (size), (bit)); \ | ||
43 | (bit) < (size); \ | ||
44 | (bit) = find_next_zero_bit((addr), (size), (bit) + 1)) | ||
45 | |||
35 | static __inline__ int get_bitmask_order(unsigned int count) | 46 | static __inline__ int get_bitmask_order(unsigned int count) |
36 | { | 47 | { |
37 | int order; | 48 | int order; |
diff --git a/include/linux/compiler-gcc.h b/include/linux/compiler-gcc.h index 3fd17c249221..e5834aa24b9e 100644 --- a/include/linux/compiler-gcc.h +++ b/include/linux/compiler-gcc.h | |||
@@ -87,7 +87,8 @@ | |||
87 | */ | 87 | */ |
88 | #define __pure __attribute__((pure)) | 88 | #define __pure __attribute__((pure)) |
89 | #define __aligned(x) __attribute__((aligned(x))) | 89 | #define __aligned(x) __attribute__((aligned(x))) |
90 | #define __printf(a,b) __attribute__((format(printf,a,b))) | 90 | #define __printf(a, b) __attribute__((format(printf, a, b))) |
91 | #define __scanf(a, b) __attribute__((format(scanf, a, b))) | ||
91 | #define noinline __attribute__((noinline)) | 92 | #define noinline __attribute__((noinline)) |
92 | #define __attribute_const__ __attribute__((__const__)) | 93 | #define __attribute_const__ __attribute__((__const__)) |
93 | #define __maybe_unused __attribute__((unused)) | 94 | #define __maybe_unused __attribute__((unused)) |
diff --git a/include/linux/crc32.h b/include/linux/crc32.h index 391a259b2cc9..68267b64bb98 100644 --- a/include/linux/crc32.h +++ b/include/linux/crc32.h | |||
@@ -11,6 +11,8 @@ | |||
11 | extern u32 crc32_le(u32 crc, unsigned char const *p, size_t len); | 11 | extern u32 crc32_le(u32 crc, unsigned char const *p, size_t len); |
12 | extern u32 crc32_be(u32 crc, unsigned char const *p, size_t len); | 12 | extern u32 crc32_be(u32 crc, unsigned char const *p, size_t len); |
13 | 13 | ||
14 | extern u32 __crc32c_le(u32 crc, unsigned char const *p, size_t len); | ||
15 | |||
14 | #define crc32(seed, data, length) crc32_le(seed, (unsigned char const *)(data), length) | 16 | #define crc32(seed, data, length) crc32_le(seed, (unsigned char const *)(data), length) |
15 | 17 | ||
16 | /* | 18 | /* |
diff --git a/include/linux/kernel.h b/include/linux/kernel.h index d801acb5e680..3e140add5360 100644 --- a/include/linux/kernel.h +++ b/include/linux/kernel.h | |||
@@ -312,6 +312,8 @@ extern long long simple_strtoll(const char *,char **,unsigned int); | |||
312 | #define strict_strtoull kstrtoull | 312 | #define strict_strtoull kstrtoull |
313 | #define strict_strtoll kstrtoll | 313 | #define strict_strtoll kstrtoll |
314 | 314 | ||
315 | extern int num_to_str(char *buf, int size, unsigned long long num); | ||
316 | |||
315 | /* lib/printf utilities */ | 317 | /* lib/printf utilities */ |
316 | 318 | ||
317 | extern __printf(2, 3) int sprintf(char *buf, const char * fmt, ...); | 319 | extern __printf(2, 3) int sprintf(char *buf, const char * fmt, ...); |
@@ -328,10 +330,10 @@ extern __printf(2, 3) | |||
328 | char *kasprintf(gfp_t gfp, const char *fmt, ...); | 330 | char *kasprintf(gfp_t gfp, const char *fmt, ...); |
329 | extern char *kvasprintf(gfp_t gfp, const char *fmt, va_list args); | 331 | extern char *kvasprintf(gfp_t gfp, const char *fmt, va_list args); |
330 | 332 | ||
331 | extern int sscanf(const char *, const char *, ...) | 333 | extern __scanf(2, 3) |
332 | __attribute__ ((format (scanf, 2, 3))); | 334 | int sscanf(const char *, const char *, ...); |
333 | extern int vsscanf(const char *, const char *, va_list) | 335 | extern __scanf(2, 0) |
334 | __attribute__ ((format (scanf, 2, 0))); | 336 | int vsscanf(const char *, const char *, va_list); |
335 | 337 | ||
336 | extern int get_option(char **str, int *pint); | 338 | extern int get_option(char **str, int *pint); |
337 | extern char *get_options(const char *str, int nints, int *ints); | 339 | extern char *get_options(const char *str, int nints, int *ints); |
diff --git a/include/linux/kmod.h b/include/linux/kmod.h index 722f477c4ef7..9efeae679106 100644 --- a/include/linux/kmod.h +++ b/include/linux/kmod.h | |||
@@ -48,11 +48,10 @@ static inline int request_module_nowait(const char *name, ...) { return -ENOSYS; | |||
48 | struct cred; | 48 | struct cred; |
49 | struct file; | 49 | struct file; |
50 | 50 | ||
51 | enum umh_wait { | 51 | #define UMH_NO_WAIT 0 /* don't wait at all */ |
52 | UMH_NO_WAIT = -1, /* don't wait at all */ | 52 | #define UMH_WAIT_EXEC 1 /* wait for the exec, but not the process */ |
53 | UMH_WAIT_EXEC = 0, /* wait for the exec, but not the process */ | 53 | #define UMH_WAIT_PROC 2 /* wait for the process to complete */ |
54 | UMH_WAIT_PROC = 1, /* wait for the process to complete */ | 54 | #define UMH_KILLABLE 4 /* wait for EXEC/PROC killable */ |
55 | }; | ||
56 | 55 | ||
57 | struct subprocess_info { | 56 | struct subprocess_info { |
58 | struct work_struct work; | 57 | struct work_struct work; |
@@ -60,7 +59,7 @@ struct subprocess_info { | |||
60 | char *path; | 59 | char *path; |
61 | char **argv; | 60 | char **argv; |
62 | char **envp; | 61 | char **envp; |
63 | enum umh_wait wait; | 62 | int wait; |
64 | int retval; | 63 | int retval; |
65 | int (*init)(struct subprocess_info *info, struct cred *new); | 64 | int (*init)(struct subprocess_info *info, struct cred *new); |
66 | void (*cleanup)(struct subprocess_info *info); | 65 | void (*cleanup)(struct subprocess_info *info); |
@@ -78,15 +77,14 @@ void call_usermodehelper_setfns(struct subprocess_info *info, | |||
78 | void *data); | 77 | void *data); |
79 | 78 | ||
80 | /* Actually execute the sub-process */ | 79 | /* Actually execute the sub-process */ |
81 | int call_usermodehelper_exec(struct subprocess_info *info, enum umh_wait wait); | 80 | int call_usermodehelper_exec(struct subprocess_info *info, int wait); |
82 | 81 | ||
83 | /* Free the subprocess_info. This is only needed if you're not going | 82 | /* Free the subprocess_info. This is only needed if you're not going |
84 | to call call_usermodehelper_exec */ | 83 | to call call_usermodehelper_exec */ |
85 | void call_usermodehelper_freeinfo(struct subprocess_info *info); | 84 | void call_usermodehelper_freeinfo(struct subprocess_info *info); |
86 | 85 | ||
87 | static inline int | 86 | static inline int |
88 | call_usermodehelper_fns(char *path, char **argv, char **envp, | 87 | call_usermodehelper_fns(char *path, char **argv, char **envp, int wait, |
89 | enum umh_wait wait, | ||
90 | int (*init)(struct subprocess_info *info, struct cred *new), | 88 | int (*init)(struct subprocess_info *info, struct cred *new), |
91 | void (*cleanup)(struct subprocess_info *), void *data) | 89 | void (*cleanup)(struct subprocess_info *), void *data) |
92 | { | 90 | { |
@@ -104,7 +102,7 @@ call_usermodehelper_fns(char *path, char **argv, char **envp, | |||
104 | } | 102 | } |
105 | 103 | ||
106 | static inline int | 104 | static inline int |
107 | call_usermodehelper(char *path, char **argv, char **envp, enum umh_wait wait) | 105 | call_usermodehelper(char *path, char **argv, char **envp, int wait) |
108 | { | 106 | { |
109 | return call_usermodehelper_fns(path, argv, envp, wait, | 107 | return call_usermodehelper_fns(path, argv, envp, wait, |
110 | NULL, NULL, NULL); | 108 | NULL, NULL, NULL); |
diff --git a/include/linux/led-lm3530.h b/include/linux/led-lm3530.h index 8eb12357a110..eeae6e742471 100644 --- a/include/linux/led-lm3530.h +++ b/include/linux/led-lm3530.h | |||
@@ -72,6 +72,12 @@ enum lm3530_als_mode { | |||
72 | LM3530_INPUT_CEIL, /* Max of ALS1 and ALS2 */ | 72 | LM3530_INPUT_CEIL, /* Max of ALS1 and ALS2 */ |
73 | }; | 73 | }; |
74 | 74 | ||
75 | /* PWM Platform Specific Data */ | ||
76 | struct lm3530_pwm_data { | ||
77 | void (*pwm_set_intensity) (int brightness, int max_brightness); | ||
78 | int (*pwm_get_intensity) (int max_brightness); | ||
79 | }; | ||
80 | |||
75 | /** | 81 | /** |
76 | * struct lm3530_platform_data | 82 | * struct lm3530_platform_data |
77 | * @mode: mode of operation i.e. Manual, ALS or PWM | 83 | * @mode: mode of operation i.e. Manual, ALS or PWM |
@@ -87,6 +93,7 @@ enum lm3530_als_mode { | |||
87 | * @als_vmin: als input voltage calibrated for max brightness in mV | 93 | * @als_vmin: als input voltage calibrated for max brightness in mV |
88 | * @als_vmax: als input voltage calibrated for min brightness in mV | 94 | * @als_vmax: als input voltage calibrated for min brightness in mV |
89 | * @brt_val: brightness value (0-255) | 95 | * @brt_val: brightness value (0-255) |
96 | * @pwm_data: PWM control functions (only valid when the mode is PWM) | ||
90 | */ | 97 | */ |
91 | struct lm3530_platform_data { | 98 | struct lm3530_platform_data { |
92 | enum lm3530_mode mode; | 99 | enum lm3530_mode mode; |
@@ -107,6 +114,8 @@ struct lm3530_platform_data { | |||
107 | u32 als_vmax; | 114 | u32 als_vmax; |
108 | 115 | ||
109 | u8 brt_val; | 116 | u8 brt_val; |
117 | |||
118 | struct lm3530_pwm_data pwm_data; | ||
110 | }; | 119 | }; |
111 | 120 | ||
112 | #endif /* _LINUX_LED_LM3530_H__ */ | 121 | #endif /* _LINUX_LED_LM3530_H__ */ |
diff --git a/include/linux/leds-lp5521.h b/include/linux/leds-lp5521.h index fd548d2a8775..3f071ec019b2 100644 --- a/include/linux/leds-lp5521.h +++ b/include/linux/leds-lp5521.h | |||
@@ -26,15 +26,37 @@ | |||
26 | /* See Documentation/leds/leds-lp5521.txt */ | 26 | /* See Documentation/leds/leds-lp5521.txt */ |
27 | 27 | ||
28 | struct lp5521_led_config { | 28 | struct lp5521_led_config { |
29 | char *name; | ||
29 | u8 chan_nr; | 30 | u8 chan_nr; |
30 | u8 led_current; /* mA x10, 0 if led is not connected */ | 31 | u8 led_current; /* mA x10, 0 if led is not connected */ |
31 | u8 max_current; | 32 | u8 max_current; |
32 | }; | 33 | }; |
33 | 34 | ||
35 | struct lp5521_led_pattern { | ||
36 | u8 *r; | ||
37 | u8 *g; | ||
38 | u8 *b; | ||
39 | u8 size_r; | ||
40 | u8 size_g; | ||
41 | u8 size_b; | ||
42 | }; | ||
43 | |||
34 | #define LP5521_CLOCK_AUTO 0 | 44 | #define LP5521_CLOCK_AUTO 0 |
35 | #define LP5521_CLOCK_INT 1 | 45 | #define LP5521_CLOCK_INT 1 |
36 | #define LP5521_CLOCK_EXT 2 | 46 | #define LP5521_CLOCK_EXT 2 |
37 | 47 | ||
48 | /* Bits in CONFIG register */ | ||
49 | #define LP5521_PWM_HF 0x40 /* PWM: 0 = 256Hz, 1 = 558Hz */ | ||
50 | #define LP5521_PWRSAVE_EN 0x20 /* 1 = Power save mode */ | ||
51 | #define LP5521_CP_MODE_OFF 0 /* Charge pump (CP) off */ | ||
52 | #define LP5521_CP_MODE_BYPASS 8 /* CP forced to bypass mode */ | ||
53 | #define LP5521_CP_MODE_1X5 0x10 /* CP forced to 1.5x mode */ | ||
54 | #define LP5521_CP_MODE_AUTO 0x18 /* Automatic mode selection */ | ||
55 | #define LP5521_R_TO_BATT 4 /* R out: 0 = CP, 1 = Vbat */ | ||
56 | #define LP5521_CLK_SRC_EXT 0 /* Ext-clk source (CLK_32K) */ | ||
57 | #define LP5521_CLK_INT 1 /* Internal clock */ | ||
58 | #define LP5521_CLK_AUTO 2 /* Automatic clock selection */ | ||
59 | |||
38 | struct lp5521_platform_data { | 60 | struct lp5521_platform_data { |
39 | struct lp5521_led_config *led_config; | 61 | struct lp5521_led_config *led_config; |
40 | u8 num_channels; | 62 | u8 num_channels; |
@@ -43,6 +65,9 @@ struct lp5521_platform_data { | |||
43 | void (*release_resources)(void); | 65 | void (*release_resources)(void); |
44 | void (*enable)(bool state); | 66 | void (*enable)(bool state); |
45 | const char *label; | 67 | const char *label; |
68 | u8 update_config; | ||
69 | struct lp5521_led_pattern *patterns; | ||
70 | int num_patterns; | ||
46 | }; | 71 | }; |
47 | 72 | ||
48 | #endif /* __LINUX_LP5521_H */ | 73 | #endif /* __LINUX_LP5521_H */ |
diff --git a/include/linux/lp855x.h b/include/linux/lp855x.h new file mode 100644 index 000000000000..781a490a451b --- /dev/null +++ b/include/linux/lp855x.h | |||
@@ -0,0 +1,131 @@ | |||
1 | /* | ||
2 | * LP855x Backlight Driver | ||
3 | * | ||
4 | * Copyright (C) 2011 Texas Instruments | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License version 2 as | ||
8 | * published by the Free Software Foundation. | ||
9 | * | ||
10 | */ | ||
11 | |||
12 | #ifndef _LP855X_H | ||
13 | #define _LP855X_H | ||
14 | |||
15 | #define BL_CTL_SHFT (0) | ||
16 | #define BRT_MODE_SHFT (1) | ||
17 | #define BRT_MODE_MASK (0x06) | ||
18 | |||
19 | /* Enable backlight. Only valid when BRT_MODE=10(I2C only) */ | ||
20 | #define ENABLE_BL (1) | ||
21 | #define DISABLE_BL (0) | ||
22 | |||
23 | #define I2C_CONFIG(id) id ## _I2C_CONFIG | ||
24 | #define PWM_CONFIG(id) id ## _PWM_CONFIG | ||
25 | |||
26 | /* DEVICE CONTROL register - LP8550 */ | ||
27 | #define LP8550_PWM_CONFIG (LP8550_PWM_ONLY << BRT_MODE_SHFT) | ||
28 | #define LP8550_I2C_CONFIG ((ENABLE_BL << BL_CTL_SHFT) | \ | ||
29 | (LP8550_I2C_ONLY << BRT_MODE_SHFT)) | ||
30 | |||
31 | /* DEVICE CONTROL register - LP8551 */ | ||
32 | #define LP8551_PWM_CONFIG LP8550_PWM_CONFIG | ||
33 | #define LP8551_I2C_CONFIG LP8550_I2C_CONFIG | ||
34 | |||
35 | /* DEVICE CONTROL register - LP8552 */ | ||
36 | #define LP8552_PWM_CONFIG LP8550_PWM_CONFIG | ||
37 | #define LP8552_I2C_CONFIG LP8550_I2C_CONFIG | ||
38 | |||
39 | /* DEVICE CONTROL register - LP8553 */ | ||
40 | #define LP8553_PWM_CONFIG LP8550_PWM_CONFIG | ||
41 | #define LP8553_I2C_CONFIG LP8550_I2C_CONFIG | ||
42 | |||
43 | /* DEVICE CONTROL register - LP8556 */ | ||
44 | #define LP8556_PWM_CONFIG (LP8556_PWM_ONLY << BRT_MODE_SHFT) | ||
45 | #define LP8556_COMB1_CONFIG (LP8556_COMBINED1 << BRT_MODE_SHFT) | ||
46 | #define LP8556_I2C_CONFIG ((ENABLE_BL << BL_CTL_SHFT) | \ | ||
47 | (LP8556_I2C_ONLY << BRT_MODE_SHFT)) | ||
48 | #define LP8556_COMB2_CONFIG (LP8556_COMBINED2 << BRT_MODE_SHFT) | ||
49 | |||
50 | /* ROM area boundary */ | ||
51 | #define EEPROM_START (0xA0) | ||
52 | #define EEPROM_END (0xA7) | ||
53 | #define EPROM_START (0xA0) | ||
54 | #define EPROM_END (0xAF) | ||
55 | |||
56 | enum lp855x_chip_id { | ||
57 | LP8550, | ||
58 | LP8551, | ||
59 | LP8552, | ||
60 | LP8553, | ||
61 | LP8556, | ||
62 | }; | ||
63 | |||
64 | enum lp855x_brightness_ctrl_mode { | ||
65 | PWM_BASED = 1, | ||
66 | REGISTER_BASED, | ||
67 | }; | ||
68 | |||
69 | enum lp8550_brighntess_source { | ||
70 | LP8550_PWM_ONLY, | ||
71 | LP8550_I2C_ONLY = 2, | ||
72 | }; | ||
73 | |||
74 | enum lp8551_brighntess_source { | ||
75 | LP8551_PWM_ONLY = LP8550_PWM_ONLY, | ||
76 | LP8551_I2C_ONLY = LP8550_I2C_ONLY, | ||
77 | }; | ||
78 | |||
79 | enum lp8552_brighntess_source { | ||
80 | LP8552_PWM_ONLY = LP8550_PWM_ONLY, | ||
81 | LP8552_I2C_ONLY = LP8550_I2C_ONLY, | ||
82 | }; | ||
83 | |||
84 | enum lp8553_brighntess_source { | ||
85 | LP8553_PWM_ONLY = LP8550_PWM_ONLY, | ||
86 | LP8553_I2C_ONLY = LP8550_I2C_ONLY, | ||
87 | }; | ||
88 | |||
89 | enum lp8556_brightness_source { | ||
90 | LP8556_PWM_ONLY, | ||
91 | LP8556_COMBINED1, /* pwm + i2c before the shaper block */ | ||
92 | LP8556_I2C_ONLY, | ||
93 | LP8556_COMBINED2, /* pwm + i2c after the shaper block */ | ||
94 | }; | ||
95 | |||
96 | struct lp855x_pwm_data { | ||
97 | void (*pwm_set_intensity) (int brightness, int max_brightness); | ||
98 | int (*pwm_get_intensity) (int max_brightness); | ||
99 | }; | ||
100 | |||
101 | struct lp855x_rom_data { | ||
102 | u8 addr; | ||
103 | u8 val; | ||
104 | }; | ||
105 | |||
106 | /** | ||
107 | * struct lp855x_platform_data | ||
108 | * @name : Backlight driver name. If it is not defined, default name is set. | ||
109 | * @mode : brightness control by pwm or lp855x register | ||
110 | * @device_control : value of DEVICE CONTROL register | ||
111 | * @initial_brightness : initial value of backlight brightness | ||
112 | * @pwm_data : platform specific pwm generation functions. | ||
113 | Only valid when mode is PWM_BASED. | ||
114 | * @load_new_rom_data : | ||
115 | 0 : use default configuration data | ||
116 | 1 : update values of eeprom or eprom registers on loading driver | ||
117 | * @size_program : total size of lp855x_rom_data | ||
118 | * @rom_data : list of new eeprom/eprom registers | ||
119 | */ | ||
120 | struct lp855x_platform_data { | ||
121 | char *name; | ||
122 | enum lp855x_brightness_ctrl_mode mode; | ||
123 | u8 device_control; | ||
124 | int initial_brightness; | ||
125 | struct lp855x_pwm_data pwm_data; | ||
126 | u8 load_new_rom_data; | ||
127 | int size_program; | ||
128 | struct lp855x_rom_data *rom_data; | ||
129 | }; | ||
130 | |||
131 | #endif | ||
diff --git a/include/linux/magic.h b/include/linux/magic.h index b7ed4759dbb2..e15192cb9cf4 100644 --- a/include/linux/magic.h +++ b/include/linux/magic.h | |||
@@ -9,7 +9,6 @@ | |||
9 | #define CRAMFS_MAGIC 0x28cd3d45 /* some random number */ | 9 | #define CRAMFS_MAGIC 0x28cd3d45 /* some random number */ |
10 | #define CRAMFS_MAGIC_WEND 0x453dcd28 /* magic number with the wrong endianess */ | 10 | #define CRAMFS_MAGIC_WEND 0x453dcd28 /* magic number with the wrong endianess */ |
11 | #define DEBUGFS_MAGIC 0x64626720 | 11 | #define DEBUGFS_MAGIC 0x64626720 |
12 | #define SYSFS_MAGIC 0x62656572 | ||
13 | #define SECURITYFS_MAGIC 0x73636673 | 12 | #define SECURITYFS_MAGIC 0x73636673 |
14 | #define SELINUX_MAGIC 0xf97cff8c | 13 | #define SELINUX_MAGIC 0xf97cff8c |
15 | #define RAMFS_MAGIC 0x858458f6 /* some random number */ | 14 | #define RAMFS_MAGIC 0x858458f6 /* some random number */ |
@@ -27,7 +26,6 @@ | |||
27 | #define HPFS_SUPER_MAGIC 0xf995e849 | 26 | #define HPFS_SUPER_MAGIC 0xf995e849 |
28 | #define ISOFS_SUPER_MAGIC 0x9660 | 27 | #define ISOFS_SUPER_MAGIC 0x9660 |
29 | #define JFFS2_SUPER_MAGIC 0x72b6 | 28 | #define JFFS2_SUPER_MAGIC 0x72b6 |
30 | #define ANON_INODE_FS_MAGIC 0x09041934 | ||
31 | #define PSTOREFS_MAGIC 0x6165676C | 29 | #define PSTOREFS_MAGIC 0x6165676C |
32 | 30 | ||
33 | #define MINIX_SUPER_MAGIC 0x137F /* minix v1 fs, 14 char names */ | 31 | #define MINIX_SUPER_MAGIC 0x137F /* minix v1 fs, 14 char names */ |
@@ -40,7 +38,6 @@ | |||
40 | #define NCP_SUPER_MAGIC 0x564c /* Guess, what 0x564c is :-) */ | 38 | #define NCP_SUPER_MAGIC 0x564c /* Guess, what 0x564c is :-) */ |
41 | #define NFS_SUPER_MAGIC 0x6969 | 39 | #define NFS_SUPER_MAGIC 0x6969 |
42 | #define OPENPROM_SUPER_MAGIC 0x9fa1 | 40 | #define OPENPROM_SUPER_MAGIC 0x9fa1 |
43 | #define PROC_SUPER_MAGIC 0x9fa0 | ||
44 | #define QNX4_SUPER_MAGIC 0x002f /* qnx4 fs detection */ | 41 | #define QNX4_SUPER_MAGIC 0x002f /* qnx4 fs detection */ |
45 | #define QNX6_SUPER_MAGIC 0x68191122 /* qnx6 fs detection */ | 42 | #define QNX6_SUPER_MAGIC 0x68191122 /* qnx6 fs detection */ |
46 | 43 | ||
@@ -52,15 +49,24 @@ | |||
52 | #define REISER2FS_JR_SUPER_MAGIC_STRING "ReIsEr3Fs" | 49 | #define REISER2FS_JR_SUPER_MAGIC_STRING "ReIsEr3Fs" |
53 | 50 | ||
54 | #define SMB_SUPER_MAGIC 0x517B | 51 | #define SMB_SUPER_MAGIC 0x517B |
55 | #define USBDEVICE_SUPER_MAGIC 0x9fa2 | ||
56 | #define CGROUP_SUPER_MAGIC 0x27e0eb | 52 | #define CGROUP_SUPER_MAGIC 0x27e0eb |
57 | 53 | ||
58 | #define FUTEXFS_SUPER_MAGIC 0xBAD1DEA | ||
59 | 54 | ||
60 | #define STACK_END_MAGIC 0x57AC6E9D | 55 | #define STACK_END_MAGIC 0x57AC6E9D |
61 | 56 | ||
57 | #define V9FS_MAGIC 0x01021997 | ||
58 | |||
59 | #define BDEVFS_MAGIC 0x62646576 | ||
60 | #define BINFMTFS_MAGIC 0x42494e4d | ||
62 | #define DEVPTS_SUPER_MAGIC 0x1cd1 | 61 | #define DEVPTS_SUPER_MAGIC 0x1cd1 |
62 | #define FUTEXFS_SUPER_MAGIC 0xBAD1DEA | ||
63 | #define PIPEFS_MAGIC 0x50495045 | ||
64 | #define PROC_SUPER_MAGIC 0x9fa0 | ||
63 | #define SOCKFS_MAGIC 0x534F434B | 65 | #define SOCKFS_MAGIC 0x534F434B |
64 | #define V9FS_MAGIC 0x01021997 | 66 | #define SYSFS_MAGIC 0x62656572 |
67 | #define USBDEVICE_SUPER_MAGIC 0x9fa2 | ||
68 | #define MTD_INODE_FS_MAGIC 0x11307854 | ||
69 | #define ANON_INODE_FS_MAGIC 0x09041934 | ||
70 | |||
65 | 71 | ||
66 | #endif /* __LINUX_MAGIC_H__ */ | 72 | #endif /* __LINUX_MAGIC_H__ */ |
diff --git a/include/linux/mm.h b/include/linux/mm.h index 7330742e7973..a6fabdfd34c5 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h | |||
@@ -111,7 +111,7 @@ extern unsigned int kobjsize(const void *objp); | |||
111 | #define VM_HUGEPAGE 0x01000000 /* MADV_HUGEPAGE marked this vma */ | 111 | #define VM_HUGEPAGE 0x01000000 /* MADV_HUGEPAGE marked this vma */ |
112 | #endif | 112 | #endif |
113 | #define VM_INSERTPAGE 0x02000000 /* The vma has had "vm_insert_page()" done on it */ | 113 | #define VM_INSERTPAGE 0x02000000 /* The vma has had "vm_insert_page()" done on it */ |
114 | #define VM_ALWAYSDUMP 0x04000000 /* Always include in core dumps */ | 114 | #define VM_NODUMP 0x04000000 /* Do not include in the core dump */ |
115 | 115 | ||
116 | #define VM_CAN_NONLINEAR 0x08000000 /* Has ->fault & does nonlinear pages */ | 116 | #define VM_CAN_NONLINEAR 0x08000000 /* Has ->fault & does nonlinear pages */ |
117 | #define VM_MIXEDMAP 0x10000000 /* Can contain "struct page" and pure PFN pages */ | 117 | #define VM_MIXEDMAP 0x10000000 /* Can contain "struct page" and pure PFN pages */ |
diff --git a/include/linux/mmc/ioctl.h b/include/linux/mmc/ioctl.h index 8fa5bc5f8059..1f5e68923929 100644 --- a/include/linux/mmc/ioctl.h +++ b/include/linux/mmc/ioctl.h | |||
@@ -1,5 +1,8 @@ | |||
1 | #ifndef LINUX_MMC_IOCTL_H | 1 | #ifndef LINUX_MMC_IOCTL_H |
2 | #define LINUX_MMC_IOCTL_H | 2 | #define LINUX_MMC_IOCTL_H |
3 | |||
4 | #include <linux/types.h> | ||
5 | |||
3 | struct mmc_ioc_cmd { | 6 | struct mmc_ioc_cmd { |
4 | /* Implies direction of data. true = write, false = read */ | 7 | /* Implies direction of data. true = write, false = read */ |
5 | int write_flag; | 8 | int write_flag; |
diff --git a/include/linux/nmi.h b/include/linux/nmi.h index 2d304efc89df..db50840e6355 100644 --- a/include/linux/nmi.h +++ b/include/linux/nmi.h | |||
@@ -14,7 +14,7 @@ | |||
14 | * may be used to reset the timeout - for code which intentionally | 14 | * may be used to reset the timeout - for code which intentionally |
15 | * disables interrupts for a long time. This call is stateless. | 15 | * disables interrupts for a long time. This call is stateless. |
16 | */ | 16 | */ |
17 | #if defined(ARCH_HAS_NMI_WATCHDOG) || defined(CONFIG_HARDLOCKUP_DETECTOR) | 17 | #if defined(CONFIG_HAVE_NMI_WATCHDOG) || defined(CONFIG_HARDLOCKUP_DETECTOR) |
18 | #include <asm/nmi.h> | 18 | #include <asm/nmi.h> |
19 | extern void touch_nmi_watchdog(void); | 19 | extern void touch_nmi_watchdog(void); |
20 | #else | 20 | #else |
diff --git a/include/linux/pipe_fs_i.h b/include/linux/pipe_fs_i.h index 77257c92155a..6d626ff0cfd0 100644 --- a/include/linux/pipe_fs_i.h +++ b/include/linux/pipe_fs_i.h | |||
@@ -1,8 +1,6 @@ | |||
1 | #ifndef _LINUX_PIPE_FS_I_H | 1 | #ifndef _LINUX_PIPE_FS_I_H |
2 | #define _LINUX_PIPE_FS_I_H | 2 | #define _LINUX_PIPE_FS_I_H |
3 | 3 | ||
4 | #define PIPEFS_MAGIC 0x50495045 | ||
5 | |||
6 | #define PIPE_DEF_BUFFERS 16 | 4 | #define PIPE_DEF_BUFFERS 16 |
7 | 5 | ||
8 | #define PIPE_BUF_FLAG_LRU 0x01 /* page is on the LRU */ | 6 | #define PIPE_BUF_FLAG_LRU 0x01 /* page is on the LRU */ |
diff --git a/include/linux/poll.h b/include/linux/poll.h index cf40010ce0cd..48fe8bc398d1 100644 --- a/include/linux/poll.h +++ b/include/linux/poll.h | |||
@@ -32,21 +32,46 @@ struct poll_table_struct; | |||
32 | */ | 32 | */ |
33 | typedef void (*poll_queue_proc)(struct file *, wait_queue_head_t *, struct poll_table_struct *); | 33 | typedef void (*poll_queue_proc)(struct file *, wait_queue_head_t *, struct poll_table_struct *); |
34 | 34 | ||
35 | /* | ||
36 | * Do not touch the structure directly, use the access functions | ||
37 | * poll_does_not_wait() and poll_requested_events() instead. | ||
38 | */ | ||
35 | typedef struct poll_table_struct { | 39 | typedef struct poll_table_struct { |
36 | poll_queue_proc qproc; | 40 | poll_queue_proc _qproc; |
37 | unsigned long key; | 41 | unsigned long _key; |
38 | } poll_table; | 42 | } poll_table; |
39 | 43 | ||
40 | static inline void poll_wait(struct file * filp, wait_queue_head_t * wait_address, poll_table *p) | 44 | static inline void poll_wait(struct file * filp, wait_queue_head_t * wait_address, poll_table *p) |
41 | { | 45 | { |
42 | if (p && wait_address) | 46 | if (p && p->_qproc && wait_address) |
43 | p->qproc(filp, wait_address, p); | 47 | p->_qproc(filp, wait_address, p); |
48 | } | ||
49 | |||
50 | /* | ||
51 | * Return true if it is guaranteed that poll will not wait. This is the case | ||
52 | * if the poll() of another file descriptor in the set got an event, so there | ||
53 | * is no need for waiting. | ||
54 | */ | ||
55 | static inline bool poll_does_not_wait(const poll_table *p) | ||
56 | { | ||
57 | return p == NULL || p->_qproc == NULL; | ||
58 | } | ||
59 | |||
60 | /* | ||
61 | * Return the set of events that the application wants to poll for. | ||
62 | * This is useful for drivers that need to know whether a DMA transfer has | ||
63 | * to be started implicitly on poll(). You typically only want to do that | ||
64 | * if the application is actually polling for POLLIN and/or POLLOUT. | ||
65 | */ | ||
66 | static inline unsigned long poll_requested_events(const poll_table *p) | ||
67 | { | ||
68 | return p ? p->_key : ~0UL; | ||
44 | } | 69 | } |
45 | 70 | ||
46 | static inline void init_poll_funcptr(poll_table *pt, poll_queue_proc qproc) | 71 | static inline void init_poll_funcptr(poll_table *pt, poll_queue_proc qproc) |
47 | { | 72 | { |
48 | pt->qproc = qproc; | 73 | pt->_qproc = qproc; |
49 | pt->key = ~0UL; /* all events enabled */ | 74 | pt->_key = ~0UL; /* all events enabled */ |
50 | } | 75 | } |
51 | 76 | ||
52 | struct poll_table_entry { | 77 | struct poll_table_entry { |
diff --git a/include/linux/prctl.h b/include/linux/prctl.h index a0413ac3abe8..e0cfec2490aa 100644 --- a/include/linux/prctl.h +++ b/include/linux/prctl.h | |||
@@ -121,4 +121,7 @@ | |||
121 | #define PR_SET_PTRACER 0x59616d61 | 121 | #define PR_SET_PTRACER 0x59616d61 |
122 | # define PR_SET_PTRACER_ANY ((unsigned long)-1) | 122 | # define PR_SET_PTRACER_ANY ((unsigned long)-1) |
123 | 123 | ||
124 | #define PR_SET_CHILD_SUBREAPER 36 | ||
125 | #define PR_GET_CHILD_SUBREAPER 37 | ||
126 | |||
124 | #endif /* _LINUX_PRCTL_H */ | 127 | #endif /* _LINUX_PRCTL_H */ |
diff --git a/include/linux/ptrace.h b/include/linux/ptrace.h index c2f1f6a5fcb8..407c678d2e30 100644 --- a/include/linux/ptrace.h +++ b/include/linux/ptrace.h | |||
@@ -51,20 +51,6 @@ | |||
51 | #define PTRACE_INTERRUPT 0x4207 | 51 | #define PTRACE_INTERRUPT 0x4207 |
52 | #define PTRACE_LISTEN 0x4208 | 52 | #define PTRACE_LISTEN 0x4208 |
53 | 53 | ||
54 | /* flags in @data for PTRACE_SEIZE */ | ||
55 | #define PTRACE_SEIZE_DEVEL 0x80000000 /* temp flag for development */ | ||
56 | |||
57 | /* options set using PTRACE_SETOPTIONS */ | ||
58 | #define PTRACE_O_TRACESYSGOOD 0x00000001 | ||
59 | #define PTRACE_O_TRACEFORK 0x00000002 | ||
60 | #define PTRACE_O_TRACEVFORK 0x00000004 | ||
61 | #define PTRACE_O_TRACECLONE 0x00000008 | ||
62 | #define PTRACE_O_TRACEEXEC 0x00000010 | ||
63 | #define PTRACE_O_TRACEVFORKDONE 0x00000020 | ||
64 | #define PTRACE_O_TRACEEXIT 0x00000040 | ||
65 | |||
66 | #define PTRACE_O_MASK 0x0000007f | ||
67 | |||
68 | /* Wait extended result codes for the above trace options. */ | 54 | /* Wait extended result codes for the above trace options. */ |
69 | #define PTRACE_EVENT_FORK 1 | 55 | #define PTRACE_EVENT_FORK 1 |
70 | #define PTRACE_EVENT_VFORK 2 | 56 | #define PTRACE_EVENT_VFORK 2 |
@@ -72,7 +58,19 @@ | |||
72 | #define PTRACE_EVENT_EXEC 4 | 58 | #define PTRACE_EVENT_EXEC 4 |
73 | #define PTRACE_EVENT_VFORK_DONE 5 | 59 | #define PTRACE_EVENT_VFORK_DONE 5 |
74 | #define PTRACE_EVENT_EXIT 6 | 60 | #define PTRACE_EVENT_EXIT 6 |
75 | #define PTRACE_EVENT_STOP 7 | 61 | /* Extended result codes which enabled by means other than options. */ |
62 | #define PTRACE_EVENT_STOP 128 | ||
63 | |||
64 | /* Options set using PTRACE_SETOPTIONS or using PTRACE_SEIZE @data param */ | ||
65 | #define PTRACE_O_TRACESYSGOOD 1 | ||
66 | #define PTRACE_O_TRACEFORK (1 << PTRACE_EVENT_FORK) | ||
67 | #define PTRACE_O_TRACEVFORK (1 << PTRACE_EVENT_VFORK) | ||
68 | #define PTRACE_O_TRACECLONE (1 << PTRACE_EVENT_CLONE) | ||
69 | #define PTRACE_O_TRACEEXEC (1 << PTRACE_EVENT_EXEC) | ||
70 | #define PTRACE_O_TRACEVFORKDONE (1 << PTRACE_EVENT_VFORK_DONE) | ||
71 | #define PTRACE_O_TRACEEXIT (1 << PTRACE_EVENT_EXIT) | ||
72 | |||
73 | #define PTRACE_O_MASK 0x0000007f | ||
76 | 74 | ||
77 | #include <asm/ptrace.h> | 75 | #include <asm/ptrace.h> |
78 | 76 | ||
@@ -88,13 +86,12 @@ | |||
88 | #define PT_SEIZED 0x00010000 /* SEIZE used, enable new behavior */ | 86 | #define PT_SEIZED 0x00010000 /* SEIZE used, enable new behavior */ |
89 | #define PT_PTRACED 0x00000001 | 87 | #define PT_PTRACED 0x00000001 |
90 | #define PT_DTRACE 0x00000002 /* delayed trace (used on m68k, i386) */ | 88 | #define PT_DTRACE 0x00000002 /* delayed trace (used on m68k, i386) */ |
91 | #define PT_TRACESYSGOOD 0x00000004 | 89 | #define PT_PTRACE_CAP 0x00000004 /* ptracer can follow suid-exec */ |
92 | #define PT_PTRACE_CAP 0x00000008 /* ptracer can follow suid-exec */ | ||
93 | 90 | ||
91 | #define PT_OPT_FLAG_SHIFT 3 | ||
94 | /* PT_TRACE_* event enable flags */ | 92 | /* PT_TRACE_* event enable flags */ |
95 | #define PT_EVENT_FLAG_SHIFT 4 | 93 | #define PT_EVENT_FLAG(event) (1 << (PT_OPT_FLAG_SHIFT + (event))) |
96 | #define PT_EVENT_FLAG(event) (1 << (PT_EVENT_FLAG_SHIFT + (event) - 1)) | 94 | #define PT_TRACESYSGOOD PT_EVENT_FLAG(0) |
97 | |||
98 | #define PT_TRACE_FORK PT_EVENT_FLAG(PTRACE_EVENT_FORK) | 95 | #define PT_TRACE_FORK PT_EVENT_FLAG(PTRACE_EVENT_FORK) |
99 | #define PT_TRACE_VFORK PT_EVENT_FLAG(PTRACE_EVENT_VFORK) | 96 | #define PT_TRACE_VFORK PT_EVENT_FLAG(PTRACE_EVENT_VFORK) |
100 | #define PT_TRACE_CLONE PT_EVENT_FLAG(PTRACE_EVENT_CLONE) | 97 | #define PT_TRACE_CLONE PT_EVENT_FLAG(PTRACE_EVENT_CLONE) |
@@ -102,8 +99,6 @@ | |||
102 | #define PT_TRACE_VFORK_DONE PT_EVENT_FLAG(PTRACE_EVENT_VFORK_DONE) | 99 | #define PT_TRACE_VFORK_DONE PT_EVENT_FLAG(PTRACE_EVENT_VFORK_DONE) |
103 | #define PT_TRACE_EXIT PT_EVENT_FLAG(PTRACE_EVENT_EXIT) | 100 | #define PT_TRACE_EXIT PT_EVENT_FLAG(PTRACE_EVENT_EXIT) |
104 | 101 | ||
105 | #define PT_TRACE_MASK 0x000003f4 | ||
106 | |||
107 | /* single stepping state bits (used on ARM and PA-RISC) */ | 102 | /* single stepping state bits (used on ARM and PA-RISC) */ |
108 | #define PT_SINGLESTEP_BIT 31 | 103 | #define PT_SINGLESTEP_BIT 31 |
109 | #define PT_SINGLESTEP (1<<PT_SINGLESTEP_BIT) | 104 | #define PT_SINGLESTEP (1<<PT_SINGLESTEP_BIT) |
@@ -199,9 +194,10 @@ static inline void ptrace_event(int event, unsigned long message) | |||
199 | if (unlikely(ptrace_event_enabled(current, event))) { | 194 | if (unlikely(ptrace_event_enabled(current, event))) { |
200 | current->ptrace_message = message; | 195 | current->ptrace_message = message; |
201 | ptrace_notify((event << 8) | SIGTRAP); | 196 | ptrace_notify((event << 8) | SIGTRAP); |
202 | } else if (event == PTRACE_EVENT_EXEC && unlikely(current->ptrace)) { | 197 | } else if (event == PTRACE_EVENT_EXEC) { |
203 | /* legacy EXEC report via SIGTRAP */ | 198 | /* legacy EXEC report via SIGTRAP */ |
204 | send_sig(SIGTRAP, current, 0); | 199 | if ((current->ptrace & (PT_PTRACED|PT_SEIZED)) == PT_PTRACED) |
200 | send_sig(SIGTRAP, current, 0); | ||
205 | } | 201 | } |
206 | } | 202 | } |
207 | 203 | ||
diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h index 937217425c47..2c62594b67dd 100644 --- a/include/linux/rcupdate.h +++ b/include/linux/rcupdate.h | |||
@@ -418,7 +418,7 @@ extern int rcu_my_thread_group_empty(void); | |||
418 | */ | 418 | */ |
419 | #define rcu_lockdep_assert(c, s) \ | 419 | #define rcu_lockdep_assert(c, s) \ |
420 | do { \ | 420 | do { \ |
421 | static bool __warned; \ | 421 | static bool __section(.data.unlikely) __warned; \ |
422 | if (debug_lockdep_rcu_enabled() && !__warned && !(c)) { \ | 422 | if (debug_lockdep_rcu_enabled() && !__warned && !(c)) { \ |
423 | __warned = true; \ | 423 | __warned = true; \ |
424 | lockdep_rcu_suspicious(__FILE__, __LINE__, s); \ | 424 | lockdep_rcu_suspicious(__FILE__, __LINE__, s); \ |
diff --git a/include/linux/sched.h b/include/linux/sched.h index 0c147a4260a5..0c3854b0d4b1 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h | |||
@@ -553,6 +553,18 @@ struct signal_struct { | |||
553 | int group_stop_count; | 553 | int group_stop_count; |
554 | unsigned int flags; /* see SIGNAL_* flags below */ | 554 | unsigned int flags; /* see SIGNAL_* flags below */ |
555 | 555 | ||
556 | /* | ||
557 | * PR_SET_CHILD_SUBREAPER marks a process, like a service | ||
558 | * manager, to re-parent orphan (double-forking) child processes | ||
559 | * to this process instead of 'init'. The service manager is | ||
560 | * able to receive SIGCHLD signals and is able to investigate | ||
561 | * the process until it calls wait(). All children of this | ||
562 | * process will inherit a flag if they should look for a | ||
563 | * child_subreaper process at exit. | ||
564 | */ | ||
565 | unsigned int is_child_subreaper:1; | ||
566 | unsigned int has_child_subreaper:1; | ||
567 | |||
556 | /* POSIX.1b Interval Timers */ | 568 | /* POSIX.1b Interval Timers */ |
557 | struct list_head posix_timers; | 569 | struct list_head posix_timers; |
558 | 570 | ||
diff --git a/include/linux/seq_file.h b/include/linux/seq_file.h index 44f1514b00ba..54e5ae7f8adc 100644 --- a/include/linux/seq_file.h +++ b/include/linux/seq_file.h | |||
@@ -121,9 +121,12 @@ int single_release(struct inode *, struct file *); | |||
121 | void *__seq_open_private(struct file *, const struct seq_operations *, int); | 121 | void *__seq_open_private(struct file *, const struct seq_operations *, int); |
122 | int seq_open_private(struct file *, const struct seq_operations *, int); | 122 | int seq_open_private(struct file *, const struct seq_operations *, int); |
123 | int seq_release_private(struct inode *, struct file *); | 123 | int seq_release_private(struct inode *, struct file *); |
124 | int seq_put_decimal_ull(struct seq_file *m, char delimiter, | ||
125 | unsigned long long num); | ||
126 | int seq_put_decimal_ll(struct seq_file *m, char delimiter, | ||
127 | long long num); | ||
124 | 128 | ||
125 | #define SEQ_START_TOKEN ((void *)1) | 129 | #define SEQ_START_TOKEN ((void *)1) |
126 | |||
127 | /* | 130 | /* |
128 | * Helpers for iteration over list_head-s in seq_files | 131 | * Helpers for iteration over list_head-s in seq_files |
129 | */ | 132 | */ |
diff --git a/include/linux/tracehook.h b/include/linux/tracehook.h index a71a2927a6a0..51bd91d911c3 100644 --- a/include/linux/tracehook.h +++ b/include/linux/tracehook.h | |||
@@ -54,12 +54,12 @@ struct linux_binprm; | |||
54 | /* | 54 | /* |
55 | * ptrace report for syscall entry and exit looks identical. | 55 | * ptrace report for syscall entry and exit looks identical. |
56 | */ | 56 | */ |
57 | static inline void ptrace_report_syscall(struct pt_regs *regs) | 57 | static inline int ptrace_report_syscall(struct pt_regs *regs) |
58 | { | 58 | { |
59 | int ptrace = current->ptrace; | 59 | int ptrace = current->ptrace; |
60 | 60 | ||
61 | if (!(ptrace & PT_PTRACED)) | 61 | if (!(ptrace & PT_PTRACED)) |
62 | return; | 62 | return 0; |
63 | 63 | ||
64 | ptrace_notify(SIGTRAP | ((ptrace & PT_TRACESYSGOOD) ? 0x80 : 0)); | 64 | ptrace_notify(SIGTRAP | ((ptrace & PT_TRACESYSGOOD) ? 0x80 : 0)); |
65 | 65 | ||
@@ -72,6 +72,8 @@ static inline void ptrace_report_syscall(struct pt_regs *regs) | |||
72 | send_sig(current->exit_code, current, 1); | 72 | send_sig(current->exit_code, current, 1); |
73 | current->exit_code = 0; | 73 | current->exit_code = 0; |
74 | } | 74 | } |
75 | |||
76 | return fatal_signal_pending(current); | ||
75 | } | 77 | } |
76 | 78 | ||
77 | /** | 79 | /** |
@@ -96,8 +98,7 @@ static inline void ptrace_report_syscall(struct pt_regs *regs) | |||
96 | static inline __must_check int tracehook_report_syscall_entry( | 98 | static inline __must_check int tracehook_report_syscall_entry( |
97 | struct pt_regs *regs) | 99 | struct pt_regs *regs) |
98 | { | 100 | { |
99 | ptrace_report_syscall(regs); | 101 | return ptrace_report_syscall(regs); |
100 | return 0; | ||
101 | } | 102 | } |
102 | 103 | ||
103 | /** | 104 | /** |
diff --git a/include/net/sock.h b/include/net/sock.h index 04bc0b30e9e9..a6ba1f8871fd 100644 --- a/include/net/sock.h +++ b/include/net/sock.h | |||
@@ -1854,7 +1854,7 @@ static inline bool wq_has_sleeper(struct socket_wq *wq) | |||
1854 | static inline void sock_poll_wait(struct file *filp, | 1854 | static inline void sock_poll_wait(struct file *filp, |
1855 | wait_queue_head_t *wait_address, poll_table *p) | 1855 | wait_queue_head_t *wait_address, poll_table *p) |
1856 | { | 1856 | { |
1857 | if (p && wait_address) { | 1857 | if (!poll_does_not_wait(p) && wait_address) { |
1858 | poll_wait(filp, wait_address, p); | 1858 | poll_wait(filp, wait_address, p); |
1859 | /* | 1859 | /* |
1860 | * We need to be sure we are in sync with the | 1860 | * We need to be sure we are in sync with the |
diff --git a/include/scsi/scsi_netlink.h b/include/scsi/scsi_netlink.h index 58ce8fe44783..5cb20ccb1956 100644 --- a/include/scsi/scsi_netlink.h +++ b/include/scsi/scsi_netlink.h | |||
@@ -23,7 +23,7 @@ | |||
23 | #define SCSI_NETLINK_H | 23 | #define SCSI_NETLINK_H |
24 | 24 | ||
25 | #include <linux/netlink.h> | 25 | #include <linux/netlink.h> |
26 | 26 | #include <linux/types.h> | |
27 | 27 | ||
28 | /* | 28 | /* |
29 | * This file intended to be included by both kernel and user space | 29 | * This file intended to be included by both kernel and user space |
diff --git a/include/sound/compress_params.h b/include/sound/compress_params.h index d97d69f81a7d..da4a456de032 100644 --- a/include/sound/compress_params.h +++ b/include/sound/compress_params.h | |||
@@ -51,6 +51,8 @@ | |||
51 | #ifndef __SND_COMPRESS_PARAMS_H | 51 | #ifndef __SND_COMPRESS_PARAMS_H |
52 | #define __SND_COMPRESS_PARAMS_H | 52 | #define __SND_COMPRESS_PARAMS_H |
53 | 53 | ||
54 | #include <linux/types.h> | ||
55 | |||
54 | /* AUDIO CODECS SUPPORTED */ | 56 | /* AUDIO CODECS SUPPORTED */ |
55 | #define MAX_NUM_CODECS 32 | 57 | #define MAX_NUM_CODECS 32 |
56 | #define MAX_NUM_CODEC_DESCRIPTORS 32 | 58 | #define MAX_NUM_CODEC_DESCRIPTORS 32 |
diff --git a/include/xen/xenbus.h b/include/xen/xenbus.h index e8c599b237c2..0a7515c1e3a4 100644 --- a/include/xen/xenbus.h +++ b/include/xen/xenbus.h | |||
@@ -139,9 +139,9 @@ int xenbus_transaction_start(struct xenbus_transaction *t); | |||
139 | int xenbus_transaction_end(struct xenbus_transaction t, int abort); | 139 | int xenbus_transaction_end(struct xenbus_transaction t, int abort); |
140 | 140 | ||
141 | /* Single read and scanf: returns -errno or num scanned if > 0. */ | 141 | /* Single read and scanf: returns -errno or num scanned if > 0. */ |
142 | __scanf(4, 5) | ||
142 | int xenbus_scanf(struct xenbus_transaction t, | 143 | int xenbus_scanf(struct xenbus_transaction t, |
143 | const char *dir, const char *node, const char *fmt, ...) | 144 | const char *dir, const char *node, const char *fmt, ...); |
144 | __attribute__((format(scanf, 4, 5))); | ||
145 | 145 | ||
146 | /* Single printf and write: returns -errno or 0. */ | 146 | /* Single printf and write: returns -errno or 0. */ |
147 | __printf(4, 5) | 147 | __printf(4, 5) |
diff --git a/init/calibrate.c b/init/calibrate.c index 5f117ca9e069..fda0a7b0f06c 100644 --- a/init/calibrate.c +++ b/init/calibrate.c | |||
@@ -267,7 +267,8 @@ void __cpuinit calibrate_delay(void) | |||
267 | 267 | ||
268 | if (per_cpu(cpu_loops_per_jiffy, this_cpu)) { | 268 | if (per_cpu(cpu_loops_per_jiffy, this_cpu)) { |
269 | lpj = per_cpu(cpu_loops_per_jiffy, this_cpu); | 269 | lpj = per_cpu(cpu_loops_per_jiffy, this_cpu); |
270 | pr_info("Calibrating delay loop (skipped) " | 270 | if (!printed) |
271 | pr_info("Calibrating delay loop (skipped) " | ||
271 | "already calibrated this CPU"); | 272 | "already calibrated this CPU"); |
272 | } else if (preset_lpj) { | 273 | } else if (preset_lpj) { |
273 | lpj = preset_lpj; | 274 | lpj = preset_lpj; |
diff --git a/init/do_mounts.c b/init/do_mounts.c index 2974c8b3b351..0e93f92a0345 100644 --- a/init/do_mounts.c +++ b/init/do_mounts.c | |||
@@ -373,8 +373,8 @@ retry: | |||
373 | #ifdef CONFIG_BLOCK | 373 | #ifdef CONFIG_BLOCK |
374 | __bdevname(ROOT_DEV, b); | 374 | __bdevname(ROOT_DEV, b); |
375 | #endif | 375 | #endif |
376 | printk("VFS: Cannot open root device \"%s\" or %s\n", | 376 | printk("VFS: Cannot open root device \"%s\" or %s: error %d\n", |
377 | root_device_name, b); | 377 | root_device_name, b, err); |
378 | printk("Please append a correct \"root=\" boot option; here are the available partitions:\n"); | 378 | printk("Please append a correct \"root=\" boot option; here are the available partitions:\n"); |
379 | 379 | ||
380 | printk_all_partitions(); | 380 | printk_all_partitions(); |
diff --git a/kernel/exit.c b/kernel/exit.c index 16b07bfac224..3db1909faed9 100644 --- a/kernel/exit.c +++ b/kernel/exit.c | |||
@@ -687,11 +687,11 @@ static void exit_mm(struct task_struct * tsk) | |||
687 | } | 687 | } |
688 | 688 | ||
689 | /* | 689 | /* |
690 | * When we die, we re-parent all our children. | 690 | * When we die, we re-parent all our children, and try to: |
691 | * Try to give them to another thread in our thread | 691 | * 1. give them to another thread in our thread group, if such a member exists |
692 | * group, and if no such member exists, give it to | 692 | * 2. give it to the first ancestor process which prctl'd itself as a |
693 | * the child reaper process (ie "init") in our pid | 693 | * child_subreaper for its children (like a service manager) |
694 | * space. | 694 | * 3. give it to the init process (PID 1) in our pid namespace |
695 | */ | 695 | */ |
696 | static struct task_struct *find_new_reaper(struct task_struct *father) | 696 | static struct task_struct *find_new_reaper(struct task_struct *father) |
697 | __releases(&tasklist_lock) | 697 | __releases(&tasklist_lock) |
@@ -711,8 +711,11 @@ static struct task_struct *find_new_reaper(struct task_struct *father) | |||
711 | 711 | ||
712 | if (unlikely(pid_ns->child_reaper == father)) { | 712 | if (unlikely(pid_ns->child_reaper == father)) { |
713 | write_unlock_irq(&tasklist_lock); | 713 | write_unlock_irq(&tasklist_lock); |
714 | if (unlikely(pid_ns == &init_pid_ns)) | 714 | if (unlikely(pid_ns == &init_pid_ns)) { |
715 | panic("Attempted to kill init!"); | 715 | panic("Attempted to kill init! exitcode=0x%08x\n", |
716 | father->signal->group_exit_code ?: | ||
717 | father->exit_code); | ||
718 | } | ||
716 | 719 | ||
717 | zap_pid_ns_processes(pid_ns); | 720 | zap_pid_ns_processes(pid_ns); |
718 | write_lock_irq(&tasklist_lock); | 721 | write_lock_irq(&tasklist_lock); |
@@ -722,6 +725,29 @@ static struct task_struct *find_new_reaper(struct task_struct *father) | |||
722 | * forget_original_parent() must move them somewhere. | 725 | * forget_original_parent() must move them somewhere. |
723 | */ | 726 | */ |
724 | pid_ns->child_reaper = init_pid_ns.child_reaper; | 727 | pid_ns->child_reaper = init_pid_ns.child_reaper; |
728 | } else if (father->signal->has_child_subreaper) { | ||
729 | struct task_struct *reaper; | ||
730 | |||
731 | /* | ||
732 | * Find the first ancestor marked as child_subreaper. | ||
733 | * Note that the code below checks same_thread_group(reaper, | ||
734 | * pid_ns->child_reaper). This is what we need to DTRT in a | ||
735 | * PID namespace. However we still need the check above, see | ||
736 | * http://marc.info/?l=linux-kernel&m=131385460420380 | ||
737 | */ | ||
738 | for (reaper = father->real_parent; | ||
739 | reaper != &init_task; | ||
740 | reaper = reaper->real_parent) { | ||
741 | if (same_thread_group(reaper, pid_ns->child_reaper)) | ||
742 | break; | ||
743 | if (!reaper->signal->is_child_subreaper) | ||
744 | continue; | ||
745 | thread = reaper; | ||
746 | do { | ||
747 | if (!(thread->flags & PF_EXITING)) | ||
748 | return reaper; | ||
749 | } while_each_thread(reaper, thread); | ||
750 | } | ||
725 | } | 751 | } |
726 | 752 | ||
727 | return pid_ns->child_reaper; | 753 | return pid_ns->child_reaper; |
diff --git a/kernel/fork.c b/kernel/fork.c index 37674ec55cde..b9372a0bff18 100644 --- a/kernel/fork.c +++ b/kernel/fork.c | |||
@@ -1051,6 +1051,9 @@ static int copy_signal(unsigned long clone_flags, struct task_struct *tsk) | |||
1051 | sig->oom_score_adj = current->signal->oom_score_adj; | 1051 | sig->oom_score_adj = current->signal->oom_score_adj; |
1052 | sig->oom_score_adj_min = current->signal->oom_score_adj_min; | 1052 | sig->oom_score_adj_min = current->signal->oom_score_adj_min; |
1053 | 1053 | ||
1054 | sig->has_child_subreaper = current->signal->has_child_subreaper || | ||
1055 | current->signal->is_child_subreaper; | ||
1056 | |||
1054 | mutex_init(&sig->cred_guard_mutex); | 1057 | mutex_init(&sig->cred_guard_mutex); |
1055 | 1058 | ||
1056 | return 0; | 1059 | return 0; |
diff --git a/kernel/kmod.c b/kernel/kmod.c index a0a88543934e..957a7aab8ebc 100644 --- a/kernel/kmod.c +++ b/kernel/kmod.c | |||
@@ -60,6 +60,43 @@ static DECLARE_RWSEM(umhelper_sem); | |||
60 | */ | 60 | */ |
61 | char modprobe_path[KMOD_PATH_LEN] = "/sbin/modprobe"; | 61 | char modprobe_path[KMOD_PATH_LEN] = "/sbin/modprobe"; |
62 | 62 | ||
63 | static void free_modprobe_argv(struct subprocess_info *info) | ||
64 | { | ||
65 | kfree(info->argv[3]); /* check call_modprobe() */ | ||
66 | kfree(info->argv); | ||
67 | } | ||
68 | |||
69 | static int call_modprobe(char *module_name, int wait) | ||
70 | { | ||
71 | static char *envp[] = { | ||
72 | "HOME=/", | ||
73 | "TERM=linux", | ||
74 | "PATH=/sbin:/usr/sbin:/bin:/usr/bin", | ||
75 | NULL | ||
76 | }; | ||
77 | |||
78 | char **argv = kmalloc(sizeof(char *[5]), GFP_KERNEL); | ||
79 | if (!argv) | ||
80 | goto out; | ||
81 | |||
82 | module_name = kstrdup(module_name, GFP_KERNEL); | ||
83 | if (!module_name) | ||
84 | goto free_argv; | ||
85 | |||
86 | argv[0] = modprobe_path; | ||
87 | argv[1] = "-q"; | ||
88 | argv[2] = "--"; | ||
89 | argv[3] = module_name; /* check free_modprobe_argv() */ | ||
90 | argv[4] = NULL; | ||
91 | |||
92 | return call_usermodehelper_fns(modprobe_path, argv, envp, | ||
93 | wait | UMH_KILLABLE, NULL, free_modprobe_argv, NULL); | ||
94 | free_argv: | ||
95 | kfree(argv); | ||
96 | out: | ||
97 | return -ENOMEM; | ||
98 | } | ||
99 | |||
63 | /** | 100 | /** |
64 | * __request_module - try to load a kernel module | 101 | * __request_module - try to load a kernel module |
65 | * @wait: wait (or not) for the operation to complete | 102 | * @wait: wait (or not) for the operation to complete |
@@ -81,11 +118,6 @@ int __request_module(bool wait, const char *fmt, ...) | |||
81 | char module_name[MODULE_NAME_LEN]; | 118 | char module_name[MODULE_NAME_LEN]; |
82 | unsigned int max_modprobes; | 119 | unsigned int max_modprobes; |
83 | int ret; | 120 | int ret; |
84 | char *argv[] = { modprobe_path, "-q", "--", module_name, NULL }; | ||
85 | static char *envp[] = { "HOME=/", | ||
86 | "TERM=linux", | ||
87 | "PATH=/sbin:/usr/sbin:/bin:/usr/bin", | ||
88 | NULL }; | ||
89 | static atomic_t kmod_concurrent = ATOMIC_INIT(0); | 121 | static atomic_t kmod_concurrent = ATOMIC_INIT(0); |
90 | #define MAX_KMOD_CONCURRENT 50 /* Completely arbitrary value - KAO */ | 122 | #define MAX_KMOD_CONCURRENT 50 /* Completely arbitrary value - KAO */ |
91 | static int kmod_loop_msg; | 123 | static int kmod_loop_msg; |
@@ -128,9 +160,7 @@ int __request_module(bool wait, const char *fmt, ...) | |||
128 | 160 | ||
129 | trace_module_request(module_name, wait, _RET_IP_); | 161 | trace_module_request(module_name, wait, _RET_IP_); |
130 | 162 | ||
131 | ret = call_usermodehelper_fns(modprobe_path, argv, envp, | 163 | ret = call_modprobe(module_name, wait ? UMH_WAIT_PROC : UMH_WAIT_EXEC); |
132 | wait ? UMH_WAIT_PROC : UMH_WAIT_EXEC, | ||
133 | NULL, NULL, NULL); | ||
134 | 164 | ||
135 | atomic_dec(&kmod_concurrent); | 165 | atomic_dec(&kmod_concurrent); |
136 | return ret; | 166 | return ret; |
@@ -188,7 +218,7 @@ static int ____call_usermodehelper(void *data) | |||
188 | /* Exec failed? */ | 218 | /* Exec failed? */ |
189 | fail: | 219 | fail: |
190 | sub_info->retval = retval; | 220 | sub_info->retval = retval; |
191 | do_exit(0); | 221 | return 0; |
192 | } | 222 | } |
193 | 223 | ||
194 | void call_usermodehelper_freeinfo(struct subprocess_info *info) | 224 | void call_usermodehelper_freeinfo(struct subprocess_info *info) |
@@ -199,6 +229,19 @@ void call_usermodehelper_freeinfo(struct subprocess_info *info) | |||
199 | } | 229 | } |
200 | EXPORT_SYMBOL(call_usermodehelper_freeinfo); | 230 | EXPORT_SYMBOL(call_usermodehelper_freeinfo); |
201 | 231 | ||
232 | static void umh_complete(struct subprocess_info *sub_info) | ||
233 | { | ||
234 | struct completion *comp = xchg(&sub_info->complete, NULL); | ||
235 | /* | ||
236 | * See call_usermodehelper_exec(). If xchg() returns NULL | ||
237 | * we own sub_info, the UMH_KILLABLE caller has gone away. | ||
238 | */ | ||
239 | if (comp) | ||
240 | complete(comp); | ||
241 | else | ||
242 | call_usermodehelper_freeinfo(sub_info); | ||
243 | } | ||
244 | |||
202 | /* Keventd can't block, but this (a child) can. */ | 245 | /* Keventd can't block, but this (a child) can. */ |
203 | static int wait_for_helper(void *data) | 246 | static int wait_for_helper(void *data) |
204 | { | 247 | { |
@@ -235,7 +278,7 @@ static int wait_for_helper(void *data) | |||
235 | sub_info->retval = ret; | 278 | sub_info->retval = ret; |
236 | } | 279 | } |
237 | 280 | ||
238 | complete(sub_info->complete); | 281 | umh_complete(sub_info); |
239 | return 0; | 282 | return 0; |
240 | } | 283 | } |
241 | 284 | ||
@@ -244,7 +287,7 @@ static void __call_usermodehelper(struct work_struct *work) | |||
244 | { | 287 | { |
245 | struct subprocess_info *sub_info = | 288 | struct subprocess_info *sub_info = |
246 | container_of(work, struct subprocess_info, work); | 289 | container_of(work, struct subprocess_info, work); |
247 | enum umh_wait wait = sub_info->wait; | 290 | int wait = sub_info->wait & ~UMH_KILLABLE; |
248 | pid_t pid; | 291 | pid_t pid; |
249 | 292 | ||
250 | /* CLONE_VFORK: wait until the usermode helper has execve'd | 293 | /* CLONE_VFORK: wait until the usermode helper has execve'd |
@@ -269,7 +312,7 @@ static void __call_usermodehelper(struct work_struct *work) | |||
269 | case UMH_WAIT_EXEC: | 312 | case UMH_WAIT_EXEC: |
270 | if (pid < 0) | 313 | if (pid < 0) |
271 | sub_info->retval = pid; | 314 | sub_info->retval = pid; |
272 | complete(sub_info->complete); | 315 | umh_complete(sub_info); |
273 | } | 316 | } |
274 | } | 317 | } |
275 | 318 | ||
@@ -435,8 +478,7 @@ EXPORT_SYMBOL(call_usermodehelper_setfns); | |||
435 | * asynchronously if wait is not set, and runs as a child of keventd. | 478 | * asynchronously if wait is not set, and runs as a child of keventd. |
436 | * (ie. it runs with full root capabilities). | 479 | * (ie. it runs with full root capabilities). |
437 | */ | 480 | */ |
438 | int call_usermodehelper_exec(struct subprocess_info *sub_info, | 481 | int call_usermodehelper_exec(struct subprocess_info *sub_info, int wait) |
439 | enum umh_wait wait) | ||
440 | { | 482 | { |
441 | DECLARE_COMPLETION_ONSTACK(done); | 483 | DECLARE_COMPLETION_ONSTACK(done); |
442 | int retval = 0; | 484 | int retval = 0; |
@@ -456,9 +498,21 @@ int call_usermodehelper_exec(struct subprocess_info *sub_info, | |||
456 | queue_work(khelper_wq, &sub_info->work); | 498 | queue_work(khelper_wq, &sub_info->work); |
457 | if (wait == UMH_NO_WAIT) /* task has freed sub_info */ | 499 | if (wait == UMH_NO_WAIT) /* task has freed sub_info */ |
458 | goto unlock; | 500 | goto unlock; |
501 | |||
502 | if (wait & UMH_KILLABLE) { | ||
503 | retval = wait_for_completion_killable(&done); | ||
504 | if (!retval) | ||
505 | goto wait_done; | ||
506 | |||
507 | /* umh_complete() will see NULL and free sub_info */ | ||
508 | if (xchg(&sub_info->complete, NULL)) | ||
509 | goto unlock; | ||
510 | /* fallthrough, umh_complete() was already called */ | ||
511 | } | ||
512 | |||
459 | wait_for_completion(&done); | 513 | wait_for_completion(&done); |
514 | wait_done: | ||
460 | retval = sub_info->retval; | 515 | retval = sub_info->retval; |
461 | |||
462 | out: | 516 | out: |
463 | call_usermodehelper_freeinfo(sub_info); | 517 | call_usermodehelper_freeinfo(sub_info); |
464 | unlock: | 518 | unlock: |
diff --git a/kernel/pid_namespace.c b/kernel/pid_namespace.c index a8968396046d..17b232869a04 100644 --- a/kernel/pid_namespace.c +++ b/kernel/pid_namespace.c | |||
@@ -168,13 +168,9 @@ void zap_pid_ns_processes(struct pid_namespace *pid_ns) | |||
168 | while (nr > 0) { | 168 | while (nr > 0) { |
169 | rcu_read_lock(); | 169 | rcu_read_lock(); |
170 | 170 | ||
171 | /* | ||
172 | * Any nested-container's init processes won't ignore the | ||
173 | * SEND_SIG_NOINFO signal, see send_signal()->si_fromuser(). | ||
174 | */ | ||
175 | task = pid_task(find_vpid(nr), PIDTYPE_PID); | 171 | task = pid_task(find_vpid(nr), PIDTYPE_PID); |
176 | if (task) | 172 | if (task && !__fatal_signal_pending(task)) |
177 | send_sig_info(SIGKILL, SEND_SIG_NOINFO, task); | 173 | send_sig_info(SIGKILL, SEND_SIG_FORCED, task); |
178 | 174 | ||
179 | rcu_read_unlock(); | 175 | rcu_read_unlock(); |
180 | 176 | ||
diff --git a/kernel/ptrace.c b/kernel/ptrace.c index 00ab2ca5ed11..ee8d49b9c309 100644 --- a/kernel/ptrace.c +++ b/kernel/ptrace.c | |||
@@ -231,26 +231,22 @@ bool ptrace_may_access(struct task_struct *task, unsigned int mode) | |||
231 | } | 231 | } |
232 | 232 | ||
233 | static int ptrace_attach(struct task_struct *task, long request, | 233 | static int ptrace_attach(struct task_struct *task, long request, |
234 | unsigned long addr, | ||
234 | unsigned long flags) | 235 | unsigned long flags) |
235 | { | 236 | { |
236 | bool seize = (request == PTRACE_SEIZE); | 237 | bool seize = (request == PTRACE_SEIZE); |
237 | int retval; | 238 | int retval; |
238 | 239 | ||
239 | /* | ||
240 | * SEIZE will enable new ptrace behaviors which will be implemented | ||
241 | * gradually. SEIZE_DEVEL is used to prevent applications | ||
242 | * expecting full SEIZE behaviors trapping on kernel commits which | ||
243 | * are still in the process of implementing them. | ||
244 | * | ||
245 | * Only test programs for new ptrace behaviors being implemented | ||
246 | * should set SEIZE_DEVEL. If unset, SEIZE will fail with -EIO. | ||
247 | * | ||
248 | * Once SEIZE behaviors are completely implemented, this flag and | ||
249 | * the following test will be removed. | ||
250 | */ | ||
251 | retval = -EIO; | 240 | retval = -EIO; |
252 | if (seize && !(flags & PTRACE_SEIZE_DEVEL)) | 241 | if (seize) { |
253 | goto out; | 242 | if (addr != 0) |
243 | goto out; | ||
244 | if (flags & ~(unsigned long)PTRACE_O_MASK) | ||
245 | goto out; | ||
246 | flags = PT_PTRACED | PT_SEIZED | (flags << PT_OPT_FLAG_SHIFT); | ||
247 | } else { | ||
248 | flags = PT_PTRACED; | ||
249 | } | ||
254 | 250 | ||
255 | audit_ptrace(task); | 251 | audit_ptrace(task); |
256 | 252 | ||
@@ -262,7 +258,7 @@ static int ptrace_attach(struct task_struct *task, long request, | |||
262 | 258 | ||
263 | /* | 259 | /* |
264 | * Protect exec's credential calculations against our interference; | 260 | * Protect exec's credential calculations against our interference; |
265 | * interference; SUID, SGID and LSM creds get determined differently | 261 | * SUID, SGID and LSM creds get determined differently |
266 | * under ptrace. | 262 | * under ptrace. |
267 | */ | 263 | */ |
268 | retval = -ERESTARTNOINTR; | 264 | retval = -ERESTARTNOINTR; |
@@ -282,11 +278,11 @@ static int ptrace_attach(struct task_struct *task, long request, | |||
282 | if (task->ptrace) | 278 | if (task->ptrace) |
283 | goto unlock_tasklist; | 279 | goto unlock_tasklist; |
284 | 280 | ||
285 | task->ptrace = PT_PTRACED; | ||
286 | if (seize) | 281 | if (seize) |
287 | task->ptrace |= PT_SEIZED; | 282 | flags |= PT_SEIZED; |
288 | if (ns_capable(task_user_ns(task), CAP_SYS_PTRACE)) | 283 | if (ns_capable(task_user_ns(task), CAP_SYS_PTRACE)) |
289 | task->ptrace |= PT_PTRACE_CAP; | 284 | flags |= PT_PTRACE_CAP; |
285 | task->ptrace = flags; | ||
290 | 286 | ||
291 | __ptrace_link(task, current); | 287 | __ptrace_link(task, current); |
292 | 288 | ||
@@ -528,30 +524,18 @@ int ptrace_writedata(struct task_struct *tsk, char __user *src, unsigned long ds | |||
528 | 524 | ||
529 | static int ptrace_setoptions(struct task_struct *child, unsigned long data) | 525 | static int ptrace_setoptions(struct task_struct *child, unsigned long data) |
530 | { | 526 | { |
531 | child->ptrace &= ~PT_TRACE_MASK; | 527 | unsigned flags; |
532 | 528 | ||
533 | if (data & PTRACE_O_TRACESYSGOOD) | 529 | if (data & ~(unsigned long)PTRACE_O_MASK) |
534 | child->ptrace |= PT_TRACESYSGOOD; | 530 | return -EINVAL; |
535 | |||
536 | if (data & PTRACE_O_TRACEFORK) | ||
537 | child->ptrace |= PT_TRACE_FORK; | ||
538 | |||
539 | if (data & PTRACE_O_TRACEVFORK) | ||
540 | child->ptrace |= PT_TRACE_VFORK; | ||
541 | |||
542 | if (data & PTRACE_O_TRACECLONE) | ||
543 | child->ptrace |= PT_TRACE_CLONE; | ||
544 | |||
545 | if (data & PTRACE_O_TRACEEXEC) | ||
546 | child->ptrace |= PT_TRACE_EXEC; | ||
547 | |||
548 | if (data & PTRACE_O_TRACEVFORKDONE) | ||
549 | child->ptrace |= PT_TRACE_VFORK_DONE; | ||
550 | 531 | ||
551 | if (data & PTRACE_O_TRACEEXIT) | 532 | /* Avoid intermediate state when all opts are cleared */ |
552 | child->ptrace |= PT_TRACE_EXIT; | 533 | flags = child->ptrace; |
534 | flags &= ~(PTRACE_O_MASK << PT_OPT_FLAG_SHIFT); | ||
535 | flags |= (data << PT_OPT_FLAG_SHIFT); | ||
536 | child->ptrace = flags; | ||
553 | 537 | ||
554 | return (data & ~PTRACE_O_MASK) ? -EINVAL : 0; | 538 | return 0; |
555 | } | 539 | } |
556 | 540 | ||
557 | static int ptrace_getsiginfo(struct task_struct *child, siginfo_t *info) | 541 | static int ptrace_getsiginfo(struct task_struct *child, siginfo_t *info) |
@@ -891,7 +875,7 @@ SYSCALL_DEFINE4(ptrace, long, request, long, pid, unsigned long, addr, | |||
891 | } | 875 | } |
892 | 876 | ||
893 | if (request == PTRACE_ATTACH || request == PTRACE_SEIZE) { | 877 | if (request == PTRACE_ATTACH || request == PTRACE_SEIZE) { |
894 | ret = ptrace_attach(child, request, data); | 878 | ret = ptrace_attach(child, request, addr, data); |
895 | /* | 879 | /* |
896 | * Some architectures need to do book-keeping after | 880 | * Some architectures need to do book-keeping after |
897 | * a ptrace attach. | 881 | * a ptrace attach. |
@@ -1034,7 +1018,7 @@ asmlinkage long compat_sys_ptrace(compat_long_t request, compat_long_t pid, | |||
1034 | } | 1018 | } |
1035 | 1019 | ||
1036 | if (request == PTRACE_ATTACH || request == PTRACE_SEIZE) { | 1020 | if (request == PTRACE_ATTACH || request == PTRACE_SEIZE) { |
1037 | ret = ptrace_attach(child, request, data); | 1021 | ret = ptrace_attach(child, request, addr, data); |
1038 | /* | 1022 | /* |
1039 | * Some architectures need to do book-keeping after | 1023 | * Some architectures need to do book-keeping after |
1040 | * a ptrace attach. | 1024 | * a ptrace attach. |
diff --git a/kernel/signal.c b/kernel/signal.c index e76001ccf5cd..d523da02dd14 100644 --- a/kernel/signal.c +++ b/kernel/signal.c | |||
@@ -58,21 +58,20 @@ static int sig_handler_ignored(void __user *handler, int sig) | |||
58 | (handler == SIG_DFL && sig_kernel_ignore(sig)); | 58 | (handler == SIG_DFL && sig_kernel_ignore(sig)); |
59 | } | 59 | } |
60 | 60 | ||
61 | static int sig_task_ignored(struct task_struct *t, int sig, | 61 | static int sig_task_ignored(struct task_struct *t, int sig, bool force) |
62 | int from_ancestor_ns) | ||
63 | { | 62 | { |
64 | void __user *handler; | 63 | void __user *handler; |
65 | 64 | ||
66 | handler = sig_handler(t, sig); | 65 | handler = sig_handler(t, sig); |
67 | 66 | ||
68 | if (unlikely(t->signal->flags & SIGNAL_UNKILLABLE) && | 67 | if (unlikely(t->signal->flags & SIGNAL_UNKILLABLE) && |
69 | handler == SIG_DFL && !from_ancestor_ns) | 68 | handler == SIG_DFL && !force) |
70 | return 1; | 69 | return 1; |
71 | 70 | ||
72 | return sig_handler_ignored(handler, sig); | 71 | return sig_handler_ignored(handler, sig); |
73 | } | 72 | } |
74 | 73 | ||
75 | static int sig_ignored(struct task_struct *t, int sig, int from_ancestor_ns) | 74 | static int sig_ignored(struct task_struct *t, int sig, bool force) |
76 | { | 75 | { |
77 | /* | 76 | /* |
78 | * Blocked signals are never ignored, since the | 77 | * Blocked signals are never ignored, since the |
@@ -82,7 +81,7 @@ static int sig_ignored(struct task_struct *t, int sig, int from_ancestor_ns) | |||
82 | if (sigismember(&t->blocked, sig) || sigismember(&t->real_blocked, sig)) | 81 | if (sigismember(&t->blocked, sig) || sigismember(&t->real_blocked, sig)) |
83 | return 0; | 82 | return 0; |
84 | 83 | ||
85 | if (!sig_task_ignored(t, sig, from_ancestor_ns)) | 84 | if (!sig_task_ignored(t, sig, force)) |
86 | return 0; | 85 | return 0; |
87 | 86 | ||
88 | /* | 87 | /* |
@@ -855,7 +854,7 @@ static void ptrace_trap_notify(struct task_struct *t) | |||
855 | * Returns true if the signal should be actually delivered, otherwise | 854 | * Returns true if the signal should be actually delivered, otherwise |
856 | * it should be dropped. | 855 | * it should be dropped. |
857 | */ | 856 | */ |
858 | static int prepare_signal(int sig, struct task_struct *p, int from_ancestor_ns) | 857 | static int prepare_signal(int sig, struct task_struct *p, bool force) |
859 | { | 858 | { |
860 | struct signal_struct *signal = p->signal; | 859 | struct signal_struct *signal = p->signal; |
861 | struct task_struct *t; | 860 | struct task_struct *t; |
@@ -915,7 +914,7 @@ static int prepare_signal(int sig, struct task_struct *p, int from_ancestor_ns) | |||
915 | } | 914 | } |
916 | } | 915 | } |
917 | 916 | ||
918 | return !sig_ignored(p, sig, from_ancestor_ns); | 917 | return !sig_ignored(p, sig, force); |
919 | } | 918 | } |
920 | 919 | ||
921 | /* | 920 | /* |
@@ -1059,7 +1058,8 @@ static int __send_signal(int sig, struct siginfo *info, struct task_struct *t, | |||
1059 | assert_spin_locked(&t->sighand->siglock); | 1058 | assert_spin_locked(&t->sighand->siglock); |
1060 | 1059 | ||
1061 | result = TRACE_SIGNAL_IGNORED; | 1060 | result = TRACE_SIGNAL_IGNORED; |
1062 | if (!prepare_signal(sig, t, from_ancestor_ns)) | 1061 | if (!prepare_signal(sig, t, |
1062 | from_ancestor_ns || (info == SEND_SIG_FORCED))) | ||
1063 | goto ret; | 1063 | goto ret; |
1064 | 1064 | ||
1065 | pending = group ? &t->signal->shared_pending : &t->pending; | 1065 | pending = group ? &t->signal->shared_pending : &t->pending; |
@@ -1601,7 +1601,7 @@ int send_sigqueue(struct sigqueue *q, struct task_struct *t, int group) | |||
1601 | 1601 | ||
1602 | ret = 1; /* the signal is ignored */ | 1602 | ret = 1; /* the signal is ignored */ |
1603 | result = TRACE_SIGNAL_IGNORED; | 1603 | result = TRACE_SIGNAL_IGNORED; |
1604 | if (!prepare_signal(sig, t, 0)) | 1604 | if (!prepare_signal(sig, t, false)) |
1605 | goto out; | 1605 | goto out; |
1606 | 1606 | ||
1607 | ret = 0; | 1607 | ret = 0; |
diff --git a/kernel/sys.c b/kernel/sys.c index 888d227fd195..9eb7fcab8df6 100644 --- a/kernel/sys.c +++ b/kernel/sys.c | |||
@@ -1962,6 +1962,14 @@ SYSCALL_DEFINE5(prctl, int, option, unsigned long, arg2, unsigned long, arg3, | |||
1962 | case PR_SET_MM: | 1962 | case PR_SET_MM: |
1963 | error = prctl_set_mm(arg2, arg3, arg4, arg5); | 1963 | error = prctl_set_mm(arg2, arg3, arg4, arg5); |
1964 | break; | 1964 | break; |
1965 | case PR_SET_CHILD_SUBREAPER: | ||
1966 | me->signal->is_child_subreaper = !!arg2; | ||
1967 | error = 0; | ||
1968 | break; | ||
1969 | case PR_GET_CHILD_SUBREAPER: | ||
1970 | error = put_user(me->signal->is_child_subreaper, | ||
1971 | (int __user *) arg2); | ||
1972 | break; | ||
1965 | default: | 1973 | default: |
1966 | error = -EINVAL; | 1974 | error = -EINVAL; |
1967 | break; | 1975 | break; |
diff --git a/kernel/watchdog.c b/kernel/watchdog.c index 14bc092fb12c..df30ee08bdd4 100644 --- a/kernel/watchdog.c +++ b/kernel/watchdog.c | |||
@@ -9,6 +9,8 @@ | |||
9 | * to those contributors as well. | 9 | * to those contributors as well. |
10 | */ | 10 | */ |
11 | 11 | ||
12 | #define pr_fmt(fmt) "NMI watchdog: " fmt | ||
13 | |||
12 | #include <linux/mm.h> | 14 | #include <linux/mm.h> |
13 | #include <linux/cpu.h> | 15 | #include <linux/cpu.h> |
14 | #include <linux/nmi.h> | 16 | #include <linux/nmi.h> |
@@ -319,11 +321,9 @@ static enum hrtimer_restart watchdog_timer_fn(struct hrtimer *hrtimer) | |||
319 | */ | 321 | */ |
320 | static int watchdog(void *unused) | 322 | static int watchdog(void *unused) |
321 | { | 323 | { |
322 | struct sched_param param = { .sched_priority = MAX_RT_PRIO-1 }; | 324 | struct sched_param param = { .sched_priority = 0 }; |
323 | struct hrtimer *hrtimer = &__raw_get_cpu_var(watchdog_hrtimer); | 325 | struct hrtimer *hrtimer = &__raw_get_cpu_var(watchdog_hrtimer); |
324 | 326 | ||
325 | sched_setscheduler(current, SCHED_FIFO, ¶m); | ||
326 | |||
327 | /* initialize timestamp */ | 327 | /* initialize timestamp */ |
328 | __touch_watchdog(); | 328 | __touch_watchdog(); |
329 | 329 | ||
@@ -349,8 +349,11 @@ static int watchdog(void *unused) | |||
349 | 349 | ||
350 | set_current_state(TASK_INTERRUPTIBLE); | 350 | set_current_state(TASK_INTERRUPTIBLE); |
351 | } | 351 | } |
352 | /* | ||
353 | * Drop the policy/priority elevation during thread exit to avoid a | ||
354 | * scheduling latency spike. | ||
355 | */ | ||
352 | __set_current_state(TASK_RUNNING); | 356 | __set_current_state(TASK_RUNNING); |
353 | param.sched_priority = 0; | ||
354 | sched_setscheduler(current, SCHED_NORMAL, ¶m); | 357 | sched_setscheduler(current, SCHED_NORMAL, ¶m); |
355 | return 0; | 358 | return 0; |
356 | } | 359 | } |
@@ -376,18 +379,20 @@ static int watchdog_nmi_enable(int cpu) | |||
376 | /* Try to register using hardware perf events */ | 379 | /* Try to register using hardware perf events */ |
377 | event = perf_event_create_kernel_counter(wd_attr, cpu, NULL, watchdog_overflow_callback, NULL); | 380 | event = perf_event_create_kernel_counter(wd_attr, cpu, NULL, watchdog_overflow_callback, NULL); |
378 | if (!IS_ERR(event)) { | 381 | if (!IS_ERR(event)) { |
379 | printk(KERN_INFO "NMI watchdog enabled, takes one hw-pmu counter.\n"); | 382 | pr_info("enabled, takes one hw-pmu counter.\n"); |
380 | goto out_save; | 383 | goto out_save; |
381 | } | 384 | } |
382 | 385 | ||
383 | 386 | ||
384 | /* vary the KERN level based on the returned errno */ | 387 | /* vary the KERN level based on the returned errno */ |
385 | if (PTR_ERR(event) == -EOPNOTSUPP) | 388 | if (PTR_ERR(event) == -EOPNOTSUPP) |
386 | printk(KERN_INFO "NMI watchdog disabled (cpu%i): not supported (no LAPIC?)\n", cpu); | 389 | pr_info("disabled (cpu%i): not supported (no LAPIC?)\n", cpu); |
387 | else if (PTR_ERR(event) == -ENOENT) | 390 | else if (PTR_ERR(event) == -ENOENT) |
388 | printk(KERN_WARNING "NMI watchdog disabled (cpu%i): hardware events not enabled\n", cpu); | 391 | pr_warning("disabled (cpu%i): hardware events not enabled\n", |
392 | cpu); | ||
389 | else | 393 | else |
390 | printk(KERN_ERR "NMI watchdog disabled (cpu%i): unable to create perf event: %ld\n", cpu, PTR_ERR(event)); | 394 | pr_err("disabled (cpu%i): unable to create perf event: %ld\n", |
395 | cpu, PTR_ERR(event)); | ||
391 | return PTR_ERR(event); | 396 | return PTR_ERR(event); |
392 | 397 | ||
393 | /* success path */ | 398 | /* success path */ |
@@ -439,9 +444,10 @@ static int watchdog_enable(int cpu) | |||
439 | 444 | ||
440 | /* create the watchdog thread */ | 445 | /* create the watchdog thread */ |
441 | if (!p) { | 446 | if (!p) { |
447 | struct sched_param param = { .sched_priority = MAX_RT_PRIO-1 }; | ||
442 | p = kthread_create_on_node(watchdog, NULL, cpu_to_node(cpu), "watchdog/%d", cpu); | 448 | p = kthread_create_on_node(watchdog, NULL, cpu_to_node(cpu), "watchdog/%d", cpu); |
443 | if (IS_ERR(p)) { | 449 | if (IS_ERR(p)) { |
444 | printk(KERN_ERR "softlockup watchdog for %i failed\n", cpu); | 450 | pr_err("softlockup watchdog for %i failed\n", cpu); |
445 | if (!err) { | 451 | if (!err) { |
446 | /* if hardlockup hasn't already set this */ | 452 | /* if hardlockup hasn't already set this */ |
447 | err = PTR_ERR(p); | 453 | err = PTR_ERR(p); |
@@ -450,6 +456,7 @@ static int watchdog_enable(int cpu) | |||
450 | } | 456 | } |
451 | goto out; | 457 | goto out; |
452 | } | 458 | } |
459 | sched_setscheduler(p, SCHED_FIFO, ¶m); | ||
453 | kthread_bind(p, cpu); | 460 | kthread_bind(p, cpu); |
454 | per_cpu(watchdog_touch_ts, cpu) = 0; | 461 | per_cpu(watchdog_touch_ts, cpu) = 0; |
455 | per_cpu(softlockup_watchdog, cpu) = p; | 462 | per_cpu(softlockup_watchdog, cpu) = p; |
@@ -496,7 +503,7 @@ static void watchdog_enable_all_cpus(void) | |||
496 | watchdog_enabled = 1; | 503 | watchdog_enabled = 1; |
497 | 504 | ||
498 | if (!watchdog_enabled) | 505 | if (!watchdog_enabled) |
499 | printk(KERN_ERR "watchdog: failed to be enabled on some cpus\n"); | 506 | pr_err("failed to be enabled on some cpus\n"); |
500 | 507 | ||
501 | } | 508 | } |
502 | 509 | ||
diff --git a/lib/Kconfig b/lib/Kconfig index 028aba9e72af..43359bb1ca90 100644 --- a/lib/Kconfig +++ b/lib/Kconfig | |||
@@ -61,14 +61,67 @@ config CRC_ITU_T | |||
61 | functions require M here. | 61 | functions require M here. |
62 | 62 | ||
63 | config CRC32 | 63 | config CRC32 |
64 | tristate "CRC32 functions" | 64 | tristate "CRC32/CRC32c functions" |
65 | default y | 65 | default y |
66 | select BITREVERSE | 66 | select BITREVERSE |
67 | help | 67 | help |
68 | This option is provided for the case where no in-kernel-tree | 68 | This option is provided for the case where no in-kernel-tree |
69 | modules require CRC32 functions, but a module built outside the | 69 | modules require CRC32/CRC32c functions, but a module built outside |
70 | kernel tree does. Such modules that use library CRC32 functions | 70 | the kernel tree does. Such modules that use library CRC32/CRC32c |
71 | require M here. | 71 | functions require M here. |
72 | |||
73 | config CRC32_SELFTEST | ||
74 | bool "CRC32 perform self test on init" | ||
75 | default n | ||
76 | depends on CRC32 | ||
77 | help | ||
78 | This option enables the CRC32 library functions to perform a | ||
79 | self test on initialization. The self test computes crc32_le | ||
80 | and crc32_be over byte strings with random alignment and length | ||
81 | and computes the total elapsed time and number of bytes processed. | ||
82 | |||
83 | choice | ||
84 | prompt "CRC32 implementation" | ||
85 | depends on CRC32 | ||
86 | default CRC32_SLICEBY8 | ||
87 | |||
88 | config CRC32_SLICEBY8 | ||
89 | bool "Slice by 8 bytes" | ||
90 | help | ||
91 | Calculate checksum 8 bytes at a time with a clever slicing algorithm. | ||
92 | This is the fastest algorithm, but comes with a 8KiB lookup table. | ||
93 | Most modern processors have enough cache to hold this table without | ||
94 | thrashing the cache. | ||
95 | |||
96 | This is the default implementation choice. Choose this one unless | ||
97 | you have a good reason not to. | ||
98 | |||
99 | config CRC32_SLICEBY4 | ||
100 | bool "Slice by 4 bytes" | ||
101 | help | ||
102 | Calculate checksum 4 bytes at a time with a clever slicing algorithm. | ||
103 | This is a bit slower than slice by 8, but has a smaller 4KiB lookup | ||
104 | table. | ||
105 | |||
106 | Only choose this option if you know what you are doing. | ||
107 | |||
108 | config CRC32_SARWATE | ||
109 | bool "Sarwate's Algorithm (one byte at a time)" | ||
110 | help | ||
111 | Calculate checksum a byte at a time using Sarwate's algorithm. This | ||
112 | is not particularly fast, but has a small 256 byte lookup table. | ||
113 | |||
114 | Only choose this option if you know what you are doing. | ||
115 | |||
116 | config CRC32_BIT | ||
117 | bool "Classic Algorithm (one bit at a time)" | ||
118 | help | ||
119 | Calculate checksum one bit at a time. This is VERY slow, but has | ||
120 | no lookup table. This is provided as a debugging option. | ||
121 | |||
122 | Only choose this option if you are debugging crc32. | ||
123 | |||
124 | endchoice | ||
72 | 125 | ||
73 | config CRC7 | 126 | config CRC7 |
74 | tristate "CRC7 functions" | 127 | tristate "CRC7 functions" |
diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug index 05037dc9bde7..391003f7ab46 100644 --- a/lib/Kconfig.debug +++ b/lib/Kconfig.debug | |||
@@ -184,7 +184,7 @@ config LOCKUP_DETECTOR | |||
184 | 184 | ||
185 | config HARDLOCKUP_DETECTOR | 185 | config HARDLOCKUP_DETECTOR |
186 | def_bool LOCKUP_DETECTOR && PERF_EVENTS && HAVE_PERF_EVENTS_NMI && \ | 186 | def_bool LOCKUP_DETECTOR && PERF_EVENTS && HAVE_PERF_EVENTS_NMI && \ |
187 | !ARCH_HAS_NMI_WATCHDOG | 187 | !HAVE_NMI_WATCHDOG |
188 | 188 | ||
189 | config BOOTPARAM_HARDLOCKUP_PANIC | 189 | config BOOTPARAM_HARDLOCKUP_PANIC |
190 | bool "Panic (Reboot) On Hard Lockups" | 190 | bool "Panic (Reboot) On Hard Lockups" |
diff --git a/lib/crc32.c b/lib/crc32.c index 4b35d2b4437c..b0d278fb1d91 100644 --- a/lib/crc32.c +++ b/lib/crc32.c | |||
@@ -1,4 +1,8 @@ | |||
1 | /* | 1 | /* |
2 | * Aug 8, 2011 Bob Pearson with help from Joakim Tjernlund and George Spelvin | ||
3 | * cleaned up code to current version of sparse and added the slicing-by-8 | ||
4 | * algorithm to the closely similar existing slicing-by-4 algorithm. | ||
5 | * | ||
2 | * Oct 15, 2000 Matt Domsch <Matt_Domsch@dell.com> | 6 | * Oct 15, 2000 Matt Domsch <Matt_Domsch@dell.com> |
3 | * Nicer crc32 functions/docs submitted by linux@horizon.com. Thanks! | 7 | * Nicer crc32 functions/docs submitted by linux@horizon.com. Thanks! |
4 | * Code was from the public domain, copyright abandoned. Code was | 8 | * Code was from the public domain, copyright abandoned. Code was |
@@ -20,52 +24,58 @@ | |||
20 | * Version 2. See the file COPYING for more details. | 24 | * Version 2. See the file COPYING for more details. |
21 | */ | 25 | */ |
22 | 26 | ||
27 | /* see: Documentation/crc32.txt for a description of algorithms */ | ||
28 | |||
23 | #include <linux/crc32.h> | 29 | #include <linux/crc32.h> |
24 | #include <linux/kernel.h> | ||
25 | #include <linux/module.h> | 30 | #include <linux/module.h> |
26 | #include <linux/compiler.h> | ||
27 | #include <linux/types.h> | 31 | #include <linux/types.h> |
28 | #include <linux/init.h> | ||
29 | #include <linux/atomic.h> | ||
30 | #include "crc32defs.h" | 32 | #include "crc32defs.h" |
31 | #if CRC_LE_BITS == 8 | 33 | |
32 | # define tole(x) __constant_cpu_to_le32(x) | 34 | #if CRC_LE_BITS > 8 |
35 | # define tole(x) ((__force u32) __constant_cpu_to_le32(x)) | ||
33 | #else | 36 | #else |
34 | # define tole(x) (x) | 37 | # define tole(x) (x) |
35 | #endif | 38 | #endif |
36 | 39 | ||
37 | #if CRC_BE_BITS == 8 | 40 | #if CRC_BE_BITS > 8 |
38 | # define tobe(x) __constant_cpu_to_be32(x) | 41 | # define tobe(x) ((__force u32) __constant_cpu_to_be32(x)) |
39 | #else | 42 | #else |
40 | # define tobe(x) (x) | 43 | # define tobe(x) (x) |
41 | #endif | 44 | #endif |
45 | |||
42 | #include "crc32table.h" | 46 | #include "crc32table.h" |
43 | 47 | ||
44 | MODULE_AUTHOR("Matt Domsch <Matt_Domsch@dell.com>"); | 48 | MODULE_AUTHOR("Matt Domsch <Matt_Domsch@dell.com>"); |
45 | MODULE_DESCRIPTION("Ethernet CRC32 calculations"); | 49 | MODULE_DESCRIPTION("Various CRC32 calculations"); |
46 | MODULE_LICENSE("GPL"); | 50 | MODULE_LICENSE("GPL"); |
47 | 51 | ||
48 | #if CRC_LE_BITS == 8 || CRC_BE_BITS == 8 | 52 | #if CRC_LE_BITS > 8 || CRC_BE_BITS > 8 |
49 | 53 | ||
54 | /* implements slicing-by-4 or slicing-by-8 algorithm */ | ||
50 | static inline u32 | 55 | static inline u32 |
51 | crc32_body(u32 crc, unsigned char const *buf, size_t len, const u32 (*tab)[256]) | 56 | crc32_body(u32 crc, unsigned char const *buf, size_t len, const u32 (*tab)[256]) |
52 | { | 57 | { |
53 | # ifdef __LITTLE_ENDIAN | 58 | # ifdef __LITTLE_ENDIAN |
54 | # define DO_CRC(x) crc = t0[(crc ^ (x)) & 255] ^ (crc >> 8) | 59 | # define DO_CRC(x) crc = t0[(crc ^ (x)) & 255] ^ (crc >> 8) |
55 | # define DO_CRC4 crc = t3[(crc) & 255] ^ \ | 60 | # define DO_CRC4 (t3[(q) & 255] ^ t2[(q >> 8) & 255] ^ \ |
56 | t2[(crc >> 8) & 255] ^ \ | 61 | t1[(q >> 16) & 255] ^ t0[(q >> 24) & 255]) |
57 | t1[(crc >> 16) & 255] ^ \ | 62 | # define DO_CRC8 (t7[(q) & 255] ^ t6[(q >> 8) & 255] ^ \ |
58 | t0[(crc >> 24) & 255] | 63 | t5[(q >> 16) & 255] ^ t4[(q >> 24) & 255]) |
59 | # else | 64 | # else |
60 | # define DO_CRC(x) crc = t0[((crc >> 24) ^ (x)) & 255] ^ (crc << 8) | 65 | # define DO_CRC(x) crc = t0[((crc >> 24) ^ (x)) & 255] ^ (crc << 8) |
61 | # define DO_CRC4 crc = t0[(crc) & 255] ^ \ | 66 | # define DO_CRC4 (t0[(q) & 255] ^ t1[(q >> 8) & 255] ^ \ |
62 | t1[(crc >> 8) & 255] ^ \ | 67 | t2[(q >> 16) & 255] ^ t3[(q >> 24) & 255]) |
63 | t2[(crc >> 16) & 255] ^ \ | 68 | # define DO_CRC8 (t4[(q) & 255] ^ t5[(q >> 8) & 255] ^ \ |
64 | t3[(crc >> 24) & 255] | 69 | t6[(q >> 16) & 255] ^ t7[(q >> 24) & 255]) |
65 | # endif | 70 | # endif |
66 | const u32 *b; | 71 | const u32 *b; |
67 | size_t rem_len; | 72 | size_t rem_len; |
73 | # ifdef CONFIG_X86 | ||
74 | size_t i; | ||
75 | # endif | ||
68 | const u32 *t0=tab[0], *t1=tab[1], *t2=tab[2], *t3=tab[3]; | 76 | const u32 *t0=tab[0], *t1=tab[1], *t2=tab[2], *t3=tab[3]; |
77 | const u32 *t4 = tab[4], *t5 = tab[5], *t6 = tab[6], *t7 = tab[7]; | ||
78 | u32 q; | ||
69 | 79 | ||
70 | /* Align it */ | 80 | /* Align it */ |
71 | if (unlikely((long)buf & 3 && len)) { | 81 | if (unlikely((long)buf & 3 && len)) { |
@@ -73,27 +83,51 @@ crc32_body(u32 crc, unsigned char const *buf, size_t len, const u32 (*tab)[256]) | |||
73 | DO_CRC(*buf++); | 83 | DO_CRC(*buf++); |
74 | } while ((--len) && ((long)buf)&3); | 84 | } while ((--len) && ((long)buf)&3); |
75 | } | 85 | } |
86 | |||
87 | # if CRC_LE_BITS == 32 | ||
76 | rem_len = len & 3; | 88 | rem_len = len & 3; |
77 | /* load data 32 bits wide, xor data 32 bits wide. */ | ||
78 | len = len >> 2; | 89 | len = len >> 2; |
90 | # else | ||
91 | rem_len = len & 7; | ||
92 | len = len >> 3; | ||
93 | # endif | ||
94 | |||
79 | b = (const u32 *)buf; | 95 | b = (const u32 *)buf; |
96 | # ifdef CONFIG_X86 | ||
97 | --b; | ||
98 | for (i = 0; i < len; i++) { | ||
99 | # else | ||
80 | for (--b; len; --len) { | 100 | for (--b; len; --len) { |
81 | crc ^= *++b; /* use pre increment for speed */ | 101 | # endif |
82 | DO_CRC4; | 102 | q = crc ^ *++b; /* use pre increment for speed */ |
103 | # if CRC_LE_BITS == 32 | ||
104 | crc = DO_CRC4; | ||
105 | # else | ||
106 | crc = DO_CRC8; | ||
107 | q = *++b; | ||
108 | crc ^= DO_CRC4; | ||
109 | # endif | ||
83 | } | 110 | } |
84 | len = rem_len; | 111 | len = rem_len; |
85 | /* And the last few bytes */ | 112 | /* And the last few bytes */ |
86 | if (len) { | 113 | if (len) { |
87 | u8 *p = (u8 *)(b + 1) - 1; | 114 | u8 *p = (u8 *)(b + 1) - 1; |
115 | # ifdef CONFIG_X86 | ||
116 | for (i = 0; i < len; i++) | ||
117 | DO_CRC(*++p); /* use pre increment for speed */ | ||
118 | # else | ||
88 | do { | 119 | do { |
89 | DO_CRC(*++p); /* use pre increment for speed */ | 120 | DO_CRC(*++p); /* use pre increment for speed */ |
90 | } while (--len); | 121 | } while (--len); |
122 | # endif | ||
91 | } | 123 | } |
92 | return crc; | 124 | return crc; |
93 | #undef DO_CRC | 125 | #undef DO_CRC |
94 | #undef DO_CRC4 | 126 | #undef DO_CRC4 |
127 | #undef DO_CRC8 | ||
95 | } | 128 | } |
96 | #endif | 129 | #endif |
130 | |||
97 | /** | 131 | /** |
98 | * crc32_le() - Calculate bitwise little-endian Ethernet AUTODIN II CRC32 | 132 | * crc32_le() - Calculate bitwise little-endian Ethernet AUTODIN II CRC32 |
99 | * @crc: seed value for computation. ~0 for Ethernet, sometimes 0 for | 133 | * @crc: seed value for computation. ~0 for Ethernet, sometimes 0 for |
@@ -101,53 +135,66 @@ crc32_body(u32 crc, unsigned char const *buf, size_t len, const u32 (*tab)[256]) | |||
101 | * @p: pointer to buffer over which CRC is run | 135 | * @p: pointer to buffer over which CRC is run |
102 | * @len: length of buffer @p | 136 | * @len: length of buffer @p |
103 | */ | 137 | */ |
104 | u32 __pure crc32_le(u32 crc, unsigned char const *p, size_t len); | 138 | static inline u32 __pure crc32_le_generic(u32 crc, unsigned char const *p, |
105 | 139 | size_t len, const u32 (*tab)[256], | |
106 | #if CRC_LE_BITS == 1 | 140 | u32 polynomial) |
107 | /* | ||
108 | * In fact, the table-based code will work in this case, but it can be | ||
109 | * simplified by inlining the table in ?: form. | ||
110 | */ | ||
111 | |||
112 | u32 __pure crc32_le(u32 crc, unsigned char const *p, size_t len) | ||
113 | { | 141 | { |
142 | #if CRC_LE_BITS == 1 | ||
114 | int i; | 143 | int i; |
115 | while (len--) { | 144 | while (len--) { |
116 | crc ^= *p++; | 145 | crc ^= *p++; |
117 | for (i = 0; i < 8; i++) | 146 | for (i = 0; i < 8; i++) |
118 | crc = (crc >> 1) ^ ((crc & 1) ? CRCPOLY_LE : 0); | 147 | crc = (crc >> 1) ^ ((crc & 1) ? polynomial : 0); |
148 | } | ||
149 | # elif CRC_LE_BITS == 2 | ||
150 | while (len--) { | ||
151 | crc ^= *p++; | ||
152 | crc = (crc >> 2) ^ tab[0][crc & 3]; | ||
153 | crc = (crc >> 2) ^ tab[0][crc & 3]; | ||
154 | crc = (crc >> 2) ^ tab[0][crc & 3]; | ||
155 | crc = (crc >> 2) ^ tab[0][crc & 3]; | ||
119 | } | 156 | } |
120 | return crc; | ||
121 | } | ||
122 | #else /* Table-based approach */ | ||
123 | |||
124 | u32 __pure crc32_le(u32 crc, unsigned char const *p, size_t len) | ||
125 | { | ||
126 | # if CRC_LE_BITS == 8 | ||
127 | const u32 (*tab)[] = crc32table_le; | ||
128 | |||
129 | crc = __cpu_to_le32(crc); | ||
130 | crc = crc32_body(crc, p, len, tab); | ||
131 | return __le32_to_cpu(crc); | ||
132 | # elif CRC_LE_BITS == 4 | 157 | # elif CRC_LE_BITS == 4 |
133 | while (len--) { | 158 | while (len--) { |
134 | crc ^= *p++; | 159 | crc ^= *p++; |
135 | crc = (crc >> 4) ^ crc32table_le[crc & 15]; | 160 | crc = (crc >> 4) ^ tab[0][crc & 15]; |
136 | crc = (crc >> 4) ^ crc32table_le[crc & 15]; | 161 | crc = (crc >> 4) ^ tab[0][crc & 15]; |
137 | } | 162 | } |
138 | return crc; | 163 | # elif CRC_LE_BITS == 8 |
139 | # elif CRC_LE_BITS == 2 | 164 | /* aka Sarwate algorithm */ |
140 | while (len--) { | 165 | while (len--) { |
141 | crc ^= *p++; | 166 | crc ^= *p++; |
142 | crc = (crc >> 2) ^ crc32table_le[crc & 3]; | 167 | crc = (crc >> 8) ^ tab[0][crc & 255]; |
143 | crc = (crc >> 2) ^ crc32table_le[crc & 3]; | ||
144 | crc = (crc >> 2) ^ crc32table_le[crc & 3]; | ||
145 | crc = (crc >> 2) ^ crc32table_le[crc & 3]; | ||
146 | } | 168 | } |
169 | # else | ||
170 | crc = (__force u32) __cpu_to_le32(crc); | ||
171 | crc = crc32_body(crc, p, len, tab); | ||
172 | crc = __le32_to_cpu((__force __le32)crc); | ||
173 | #endif | ||
147 | return crc; | 174 | return crc; |
148 | # endif | 175 | } |
176 | |||
177 | #if CRC_LE_BITS == 1 | ||
178 | u32 __pure crc32_le(u32 crc, unsigned char const *p, size_t len) | ||
179 | { | ||
180 | return crc32_le_generic(crc, p, len, NULL, CRCPOLY_LE); | ||
181 | } | ||
182 | u32 __pure __crc32c_le(u32 crc, unsigned char const *p, size_t len) | ||
183 | { | ||
184 | return crc32_le_generic(crc, p, len, NULL, CRC32C_POLY_LE); | ||
185 | } | ||
186 | #else | ||
187 | u32 __pure crc32_le(u32 crc, unsigned char const *p, size_t len) | ||
188 | { | ||
189 | return crc32_le_generic(crc, p, len, crc32table_le, CRCPOLY_LE); | ||
190 | } | ||
191 | u32 __pure __crc32c_le(u32 crc, unsigned char const *p, size_t len) | ||
192 | { | ||
193 | return crc32_le_generic(crc, p, len, crc32ctable_le, CRC32C_POLY_LE); | ||
149 | } | 194 | } |
150 | #endif | 195 | #endif |
196 | EXPORT_SYMBOL(crc32_le); | ||
197 | EXPORT_SYMBOL(__crc32c_le); | ||
151 | 198 | ||
152 | /** | 199 | /** |
153 | * crc32_be() - Calculate bitwise big-endian Ethernet AUTODIN II CRC32 | 200 | * crc32_be() - Calculate bitwise big-endian Ethernet AUTODIN II CRC32 |
@@ -156,317 +203,913 @@ u32 __pure crc32_le(u32 crc, unsigned char const *p, size_t len) | |||
156 | * @p: pointer to buffer over which CRC is run | 203 | * @p: pointer to buffer over which CRC is run |
157 | * @len: length of buffer @p | 204 | * @len: length of buffer @p |
158 | */ | 205 | */ |
159 | u32 __pure crc32_be(u32 crc, unsigned char const *p, size_t len); | 206 | static inline u32 __pure crc32_be_generic(u32 crc, unsigned char const *p, |
160 | 207 | size_t len, const u32 (*tab)[256], | |
161 | #if CRC_BE_BITS == 1 | 208 | u32 polynomial) |
162 | /* | ||
163 | * In fact, the table-based code will work in this case, but it can be | ||
164 | * simplified by inlining the table in ?: form. | ||
165 | */ | ||
166 | |||
167 | u32 __pure crc32_be(u32 crc, unsigned char const *p, size_t len) | ||
168 | { | 209 | { |
210 | #if CRC_BE_BITS == 1 | ||
169 | int i; | 211 | int i; |
170 | while (len--) { | 212 | while (len--) { |
171 | crc ^= *p++ << 24; | 213 | crc ^= *p++ << 24; |
172 | for (i = 0; i < 8; i++) | 214 | for (i = 0; i < 8; i++) |
173 | crc = | 215 | crc = |
174 | (crc << 1) ^ ((crc & 0x80000000) ? CRCPOLY_BE : | 216 | (crc << 1) ^ ((crc & 0x80000000) ? polynomial : |
175 | 0); | 217 | 0); |
176 | } | 218 | } |
177 | return crc; | 219 | # elif CRC_BE_BITS == 2 |
178 | } | 220 | while (len--) { |
179 | 221 | crc ^= *p++ << 24; | |
180 | #else /* Table-based approach */ | 222 | crc = (crc << 2) ^ tab[0][crc >> 30]; |
181 | u32 __pure crc32_be(u32 crc, unsigned char const *p, size_t len) | 223 | crc = (crc << 2) ^ tab[0][crc >> 30]; |
182 | { | 224 | crc = (crc << 2) ^ tab[0][crc >> 30]; |
183 | # if CRC_BE_BITS == 8 | 225 | crc = (crc << 2) ^ tab[0][crc >> 30]; |
184 | const u32 (*tab)[] = crc32table_be; | 226 | } |
185 | |||
186 | crc = __cpu_to_be32(crc); | ||
187 | crc = crc32_body(crc, p, len, tab); | ||
188 | return __be32_to_cpu(crc); | ||
189 | # elif CRC_BE_BITS == 4 | 227 | # elif CRC_BE_BITS == 4 |
190 | while (len--) { | 228 | while (len--) { |
191 | crc ^= *p++ << 24; | 229 | crc ^= *p++ << 24; |
192 | crc = (crc << 4) ^ crc32table_be[crc >> 28]; | 230 | crc = (crc << 4) ^ tab[0][crc >> 28]; |
193 | crc = (crc << 4) ^ crc32table_be[crc >> 28]; | 231 | crc = (crc << 4) ^ tab[0][crc >> 28]; |
194 | } | 232 | } |
195 | return crc; | 233 | # elif CRC_BE_BITS == 8 |
196 | # elif CRC_BE_BITS == 2 | ||
197 | while (len--) { | 234 | while (len--) { |
198 | crc ^= *p++ << 24; | 235 | crc ^= *p++ << 24; |
199 | crc = (crc << 2) ^ crc32table_be[crc >> 30]; | 236 | crc = (crc << 8) ^ tab[0][crc >> 24]; |
200 | crc = (crc << 2) ^ crc32table_be[crc >> 30]; | ||
201 | crc = (crc << 2) ^ crc32table_be[crc >> 30]; | ||
202 | crc = (crc << 2) ^ crc32table_be[crc >> 30]; | ||
203 | } | 237 | } |
204 | return crc; | 238 | # else |
239 | crc = (__force u32) __cpu_to_be32(crc); | ||
240 | crc = crc32_body(crc, p, len, tab); | ||
241 | crc = __be32_to_cpu((__force __be32)crc); | ||
205 | # endif | 242 | # endif |
243 | return crc; | ||
206 | } | 244 | } |
207 | #endif | ||
208 | 245 | ||
209 | EXPORT_SYMBOL(crc32_le); | 246 | #if CRC_LE_BITS == 1 |
247 | u32 __pure crc32_be(u32 crc, unsigned char const *p, size_t len) | ||
248 | { | ||
249 | return crc32_be_generic(crc, p, len, NULL, CRCPOLY_BE); | ||
250 | } | ||
251 | #else | ||
252 | u32 __pure crc32_be(u32 crc, unsigned char const *p, size_t len) | ||
253 | { | ||
254 | return crc32_be_generic(crc, p, len, crc32table_be, CRCPOLY_BE); | ||
255 | } | ||
256 | #endif | ||
210 | EXPORT_SYMBOL(crc32_be); | 257 | EXPORT_SYMBOL(crc32_be); |
211 | 258 | ||
212 | /* | 259 | #ifdef CONFIG_CRC32_SELFTEST |
213 | * A brief CRC tutorial. | ||
214 | * | ||
215 | * A CRC is a long-division remainder. You add the CRC to the message, | ||
216 | * and the whole thing (message+CRC) is a multiple of the given | ||
217 | * CRC polynomial. To check the CRC, you can either check that the | ||
218 | * CRC matches the recomputed value, *or* you can check that the | ||
219 | * remainder computed on the message+CRC is 0. This latter approach | ||
220 | * is used by a lot of hardware implementations, and is why so many | ||
221 | * protocols put the end-of-frame flag after the CRC. | ||
222 | * | ||
223 | * It's actually the same long division you learned in school, except that | ||
224 | * - We're working in binary, so the digits are only 0 and 1, and | ||
225 | * - When dividing polynomials, there are no carries. Rather than add and | ||
226 | * subtract, we just xor. Thus, we tend to get a bit sloppy about | ||
227 | * the difference between adding and subtracting. | ||
228 | * | ||
229 | * A 32-bit CRC polynomial is actually 33 bits long. But since it's | ||
230 | * 33 bits long, bit 32 is always going to be set, so usually the CRC | ||
231 | * is written in hex with the most significant bit omitted. (If you're | ||
232 | * familiar with the IEEE 754 floating-point format, it's the same idea.) | ||
233 | * | ||
234 | * Note that a CRC is computed over a string of *bits*, so you have | ||
235 | * to decide on the endianness of the bits within each byte. To get | ||
236 | * the best error-detecting properties, this should correspond to the | ||
237 | * order they're actually sent. For example, standard RS-232 serial is | ||
238 | * little-endian; the most significant bit (sometimes used for parity) | ||
239 | * is sent last. And when appending a CRC word to a message, you should | ||
240 | * do it in the right order, matching the endianness. | ||
241 | * | ||
242 | * Just like with ordinary division, the remainder is always smaller than | ||
243 | * the divisor (the CRC polynomial) you're dividing by. Each step of the | ||
244 | * division, you take one more digit (bit) of the dividend and append it | ||
245 | * to the current remainder. Then you figure out the appropriate multiple | ||
246 | * of the divisor to subtract to being the remainder back into range. | ||
247 | * In binary, it's easy - it has to be either 0 or 1, and to make the | ||
248 | * XOR cancel, it's just a copy of bit 32 of the remainder. | ||
249 | * | ||
250 | * When computing a CRC, we don't care about the quotient, so we can | ||
251 | * throw the quotient bit away, but subtract the appropriate multiple of | ||
252 | * the polynomial from the remainder and we're back to where we started, | ||
253 | * ready to process the next bit. | ||
254 | * | ||
255 | * A big-endian CRC written this way would be coded like: | ||
256 | * for (i = 0; i < input_bits; i++) { | ||
257 | * multiple = remainder & 0x80000000 ? CRCPOLY : 0; | ||
258 | * remainder = (remainder << 1 | next_input_bit()) ^ multiple; | ||
259 | * } | ||
260 | * Notice how, to get at bit 32 of the shifted remainder, we look | ||
261 | * at bit 31 of the remainder *before* shifting it. | ||
262 | * | ||
263 | * But also notice how the next_input_bit() bits we're shifting into | ||
264 | * the remainder don't actually affect any decision-making until | ||
265 | * 32 bits later. Thus, the first 32 cycles of this are pretty boring. | ||
266 | * Also, to add the CRC to a message, we need a 32-bit-long hole for it at | ||
267 | * the end, so we have to add 32 extra cycles shifting in zeros at the | ||
268 | * end of every message, | ||
269 | * | ||
270 | * So the standard trick is to rearrage merging in the next_input_bit() | ||
271 | * until the moment it's needed. Then the first 32 cycles can be precomputed, | ||
272 | * and merging in the final 32 zero bits to make room for the CRC can be | ||
273 | * skipped entirely. | ||
274 | * This changes the code to: | ||
275 | * for (i = 0; i < input_bits; i++) { | ||
276 | * remainder ^= next_input_bit() << 31; | ||
277 | * multiple = (remainder & 0x80000000) ? CRCPOLY : 0; | ||
278 | * remainder = (remainder << 1) ^ multiple; | ||
279 | * } | ||
280 | * With this optimization, the little-endian code is simpler: | ||
281 | * for (i = 0; i < input_bits; i++) { | ||
282 | * remainder ^= next_input_bit(); | ||
283 | * multiple = (remainder & 1) ? CRCPOLY : 0; | ||
284 | * remainder = (remainder >> 1) ^ multiple; | ||
285 | * } | ||
286 | * | ||
287 | * Note that the other details of endianness have been hidden in CRCPOLY | ||
288 | * (which must be bit-reversed) and next_input_bit(). | ||
289 | * | ||
290 | * However, as long as next_input_bit is returning the bits in a sensible | ||
291 | * order, we can actually do the merging 8 or more bits at a time rather | ||
292 | * than one bit at a time: | ||
293 | * for (i = 0; i < input_bytes; i++) { | ||
294 | * remainder ^= next_input_byte() << 24; | ||
295 | * for (j = 0; j < 8; j++) { | ||
296 | * multiple = (remainder & 0x80000000) ? CRCPOLY : 0; | ||
297 | * remainder = (remainder << 1) ^ multiple; | ||
298 | * } | ||
299 | * } | ||
300 | * Or in little-endian: | ||
301 | * for (i = 0; i < input_bytes; i++) { | ||
302 | * remainder ^= next_input_byte(); | ||
303 | * for (j = 0; j < 8; j++) { | ||
304 | * multiple = (remainder & 1) ? CRCPOLY : 0; | ||
305 | * remainder = (remainder << 1) ^ multiple; | ||
306 | * } | ||
307 | * } | ||
308 | * If the input is a multiple of 32 bits, you can even XOR in a 32-bit | ||
309 | * word at a time and increase the inner loop count to 32. | ||
310 | * | ||
311 | * You can also mix and match the two loop styles, for example doing the | ||
312 | * bulk of a message byte-at-a-time and adding bit-at-a-time processing | ||
313 | * for any fractional bytes at the end. | ||
314 | * | ||
315 | * The only remaining optimization is to the byte-at-a-time table method. | ||
316 | * Here, rather than just shifting one bit of the remainder to decide | ||
317 | * in the correct multiple to subtract, we can shift a byte at a time. | ||
318 | * This produces a 40-bit (rather than a 33-bit) intermediate remainder, | ||
319 | * but again the multiple of the polynomial to subtract depends only on | ||
320 | * the high bits, the high 8 bits in this case. | ||
321 | * | ||
322 | * The multiple we need in that case is the low 32 bits of a 40-bit | ||
323 | * value whose high 8 bits are given, and which is a multiple of the | ||
324 | * generator polynomial. This is simply the CRC-32 of the given | ||
325 | * one-byte message. | ||
326 | * | ||
327 | * Two more details: normally, appending zero bits to a message which | ||
328 | * is already a multiple of a polynomial produces a larger multiple of that | ||
329 | * polynomial. To enable a CRC to detect this condition, it's common to | ||
330 | * invert the CRC before appending it. This makes the remainder of the | ||
331 | * message+crc come out not as zero, but some fixed non-zero value. | ||
332 | * | ||
333 | * The same problem applies to zero bits prepended to the message, and | ||
334 | * a similar solution is used. Instead of starting with a remainder of | ||
335 | * 0, an initial remainder of all ones is used. As long as you start | ||
336 | * the same way on decoding, it doesn't make a difference. | ||
337 | */ | ||
338 | |||
339 | #ifdef UNITTEST | ||
340 | 260 | ||
341 | #include <stdlib.h> | 261 | /* 4096 random bytes */ |
342 | #include <stdio.h> | 262 | static u8 __attribute__((__aligned__(8))) test_buf[] = |
263 | { | ||
264 | 0x5b, 0x85, 0x21, 0xcb, 0x09, 0x68, 0x7d, 0x30, | ||
265 | 0xc7, 0x69, 0xd7, 0x30, 0x92, 0xde, 0x59, 0xe4, | ||
266 | 0xc9, 0x6e, 0x8b, 0xdb, 0x98, 0x6b, 0xaa, 0x60, | ||
267 | 0xa8, 0xb5, 0xbc, 0x6c, 0xa9, 0xb1, 0x5b, 0x2c, | ||
268 | 0xea, 0xb4, 0x92, 0x6a, 0x3f, 0x79, 0x91, 0xe4, | ||
269 | 0xe9, 0x70, 0x51, 0x8c, 0x7f, 0x95, 0x6f, 0x1a, | ||
270 | 0x56, 0xa1, 0x5c, 0x27, 0x03, 0x67, 0x9f, 0x3a, | ||
271 | 0xe2, 0x31, 0x11, 0x29, 0x6b, 0x98, 0xfc, 0xc4, | ||
272 | 0x53, 0x24, 0xc5, 0x8b, 0xce, 0x47, 0xb2, 0xb9, | ||
273 | 0x32, 0xcb, 0xc1, 0xd0, 0x03, 0x57, 0x4e, 0xd4, | ||
274 | 0xe9, 0x3c, 0xa1, 0x63, 0xcf, 0x12, 0x0e, 0xca, | ||
275 | 0xe1, 0x13, 0xd1, 0x93, 0xa6, 0x88, 0x5c, 0x61, | ||
276 | 0x5b, 0xbb, 0xf0, 0x19, 0x46, 0xb4, 0xcf, 0x9e, | ||
277 | 0xb6, 0x6b, 0x4c, 0x3a, 0xcf, 0x60, 0xf9, 0x7a, | ||
278 | 0x8d, 0x07, 0x63, 0xdb, 0x40, 0xe9, 0x0b, 0x6f, | ||
279 | 0xad, 0x97, 0xf1, 0xed, 0xd0, 0x1e, 0x26, 0xfd, | ||
280 | 0xbf, 0xb7, 0xc8, 0x04, 0x94, 0xf8, 0x8b, 0x8c, | ||
281 | 0xf1, 0xab, 0x7a, 0xd4, 0xdd, 0xf3, 0xe8, 0x88, | ||
282 | 0xc3, 0xed, 0x17, 0x8a, 0x9b, 0x40, 0x0d, 0x53, | ||
283 | 0x62, 0x12, 0x03, 0x5f, 0x1b, 0x35, 0x32, 0x1f, | ||
284 | 0xb4, 0x7b, 0x93, 0x78, 0x0d, 0xdb, 0xce, 0xa4, | ||
285 | 0xc0, 0x47, 0xd5, 0xbf, 0x68, 0xe8, 0x5d, 0x74, | ||
286 | 0x8f, 0x8e, 0x75, 0x1c, 0xb2, 0x4f, 0x9a, 0x60, | ||
287 | 0xd1, 0xbe, 0x10, 0xf4, 0x5c, 0xa1, 0x53, 0x09, | ||
288 | 0xa5, 0xe0, 0x09, 0x54, 0x85, 0x5c, 0xdc, 0x07, | ||
289 | 0xe7, 0x21, 0x69, 0x7b, 0x8a, 0xfd, 0x90, 0xf1, | ||
290 | 0x22, 0xd0, 0xb4, 0x36, 0x28, 0xe6, 0xb8, 0x0f, | ||
291 | 0x39, 0xde, 0xc8, 0xf3, 0x86, 0x60, 0x34, 0xd2, | ||
292 | 0x5e, 0xdf, 0xfd, 0xcf, 0x0f, 0xa9, 0x65, 0xf0, | ||
293 | 0xd5, 0x4d, 0x96, 0x40, 0xe3, 0xdf, 0x3f, 0x95, | ||
294 | 0x5a, 0x39, 0x19, 0x93, 0xf4, 0x75, 0xce, 0x22, | ||
295 | 0x00, 0x1c, 0x93, 0xe2, 0x03, 0x66, 0xf4, 0x93, | ||
296 | 0x73, 0x86, 0x81, 0x8e, 0x29, 0x44, 0x48, 0x86, | ||
297 | 0x61, 0x7c, 0x48, 0xa3, 0x43, 0xd2, 0x9c, 0x8d, | ||
298 | 0xd4, 0x95, 0xdd, 0xe1, 0x22, 0x89, 0x3a, 0x40, | ||
299 | 0x4c, 0x1b, 0x8a, 0x04, 0xa8, 0x09, 0x69, 0x8b, | ||
300 | 0xea, 0xc6, 0x55, 0x8e, 0x57, 0xe6, 0x64, 0x35, | ||
301 | 0xf0, 0xc7, 0x16, 0x9f, 0x5d, 0x5e, 0x86, 0x40, | ||
302 | 0x46, 0xbb, 0xe5, 0x45, 0x88, 0xfe, 0xc9, 0x63, | ||
303 | 0x15, 0xfb, 0xf5, 0xbd, 0x71, 0x61, 0xeb, 0x7b, | ||
304 | 0x78, 0x70, 0x07, 0x31, 0x03, 0x9f, 0xb2, 0xc8, | ||
305 | 0xa7, 0xab, 0x47, 0xfd, 0xdf, 0xa0, 0x78, 0x72, | ||
306 | 0xa4, 0x2a, 0xe4, 0xb6, 0xba, 0xc0, 0x1e, 0x86, | ||
307 | 0x71, 0xe6, 0x3d, 0x18, 0x37, 0x70, 0xe6, 0xff, | ||
308 | 0xe0, 0xbc, 0x0b, 0x22, 0xa0, 0x1f, 0xd3, 0xed, | ||
309 | 0xa2, 0x55, 0x39, 0xab, 0xa8, 0x13, 0x73, 0x7c, | ||
310 | 0x3f, 0xb2, 0xd6, 0x19, 0xac, 0xff, 0x99, 0xed, | ||
311 | 0xe8, 0xe6, 0xa6, 0x22, 0xe3, 0x9c, 0xf1, 0x30, | ||
312 | 0xdc, 0x01, 0x0a, 0x56, 0xfa, 0xe4, 0xc9, 0x99, | ||
313 | 0xdd, 0xa8, 0xd8, 0xda, 0x35, 0x51, 0x73, 0xb4, | ||
314 | 0x40, 0x86, 0x85, 0xdb, 0x5c, 0xd5, 0x85, 0x80, | ||
315 | 0x14, 0x9c, 0xfd, 0x98, 0xa9, 0x82, 0xc5, 0x37, | ||
316 | 0xff, 0x32, 0x5d, 0xd0, 0x0b, 0xfa, 0xdc, 0x04, | ||
317 | 0x5e, 0x09, 0xd2, 0xca, 0x17, 0x4b, 0x1a, 0x8e, | ||
318 | 0x15, 0xe1, 0xcc, 0x4e, 0x52, 0x88, 0x35, 0xbd, | ||
319 | 0x48, 0xfe, 0x15, 0xa0, 0x91, 0xfd, 0x7e, 0x6c, | ||
320 | 0x0e, 0x5d, 0x79, 0x1b, 0x81, 0x79, 0xd2, 0x09, | ||
321 | 0x34, 0x70, 0x3d, 0x81, 0xec, 0xf6, 0x24, 0xbb, | ||
322 | 0xfb, 0xf1, 0x7b, 0xdf, 0x54, 0xea, 0x80, 0x9b, | ||
323 | 0xc7, 0x99, 0x9e, 0xbd, 0x16, 0x78, 0x12, 0x53, | ||
324 | 0x5e, 0x01, 0xa7, 0x4e, 0xbd, 0x67, 0xe1, 0x9b, | ||
325 | 0x4c, 0x0e, 0x61, 0x45, 0x97, 0xd2, 0xf0, 0x0f, | ||
326 | 0xfe, 0x15, 0x08, 0xb7, 0x11, 0x4c, 0xe7, 0xff, | ||
327 | 0x81, 0x53, 0xff, 0x91, 0x25, 0x38, 0x7e, 0x40, | ||
328 | 0x94, 0xe5, 0xe0, 0xad, 0xe6, 0xd9, 0x79, 0xb6, | ||
329 | 0x92, 0xc9, 0xfc, 0xde, 0xc3, 0x1a, 0x23, 0xbb, | ||
330 | 0xdd, 0xc8, 0x51, 0x0c, 0x3a, 0x72, 0xfa, 0x73, | ||
331 | 0x6f, 0xb7, 0xee, 0x61, 0x39, 0x03, 0x01, 0x3f, | ||
332 | 0x7f, 0x94, 0x2e, 0x2e, 0xba, 0x3a, 0xbb, 0xb4, | ||
333 | 0xfa, 0x6a, 0x17, 0xfe, 0xea, 0xef, 0x5e, 0x66, | ||
334 | 0x97, 0x3f, 0x32, 0x3d, 0xd7, 0x3e, 0xb1, 0xf1, | ||
335 | 0x6c, 0x14, 0x4c, 0xfd, 0x37, 0xd3, 0x38, 0x80, | ||
336 | 0xfb, 0xde, 0xa6, 0x24, 0x1e, 0xc8, 0xca, 0x7f, | ||
337 | 0x3a, 0x93, 0xd8, 0x8b, 0x18, 0x13, 0xb2, 0xe5, | ||
338 | 0xe4, 0x93, 0x05, 0x53, 0x4f, 0x84, 0x66, 0xa7, | ||
339 | 0x58, 0x5c, 0x7b, 0x86, 0x52, 0x6d, 0x0d, 0xce, | ||
340 | 0xa4, 0x30, 0x7d, 0xb6, 0x18, 0x9f, 0xeb, 0xff, | ||
341 | 0x22, 0xbb, 0x72, 0x29, 0xb9, 0x44, 0x0b, 0x48, | ||
342 | 0x1e, 0x84, 0x71, 0x81, 0xe3, 0x6d, 0x73, 0x26, | ||
343 | 0x92, 0xb4, 0x4d, 0x2a, 0x29, 0xb8, 0x1f, 0x72, | ||
344 | 0xed, 0xd0, 0xe1, 0x64, 0x77, 0xea, 0x8e, 0x88, | ||
345 | 0x0f, 0xef, 0x3f, 0xb1, 0x3b, 0xad, 0xf9, 0xc9, | ||
346 | 0x8b, 0xd0, 0xac, 0xc6, 0xcc, 0xa9, 0x40, 0xcc, | ||
347 | 0x76, 0xf6, 0x3b, 0x53, 0xb5, 0x88, 0xcb, 0xc8, | ||
348 | 0x37, 0xf1, 0xa2, 0xba, 0x23, 0x15, 0x99, 0x09, | ||
349 | 0xcc, 0xe7, 0x7a, 0x3b, 0x37, 0xf7, 0x58, 0xc8, | ||
350 | 0x46, 0x8c, 0x2b, 0x2f, 0x4e, 0x0e, 0xa6, 0x5c, | ||
351 | 0xea, 0x85, 0x55, 0xba, 0x02, 0x0e, 0x0e, 0x48, | ||
352 | 0xbc, 0xe1, 0xb1, 0x01, 0x35, 0x79, 0x13, 0x3d, | ||
353 | 0x1b, 0xc0, 0x53, 0x68, 0x11, 0xe7, 0x95, 0x0f, | ||
354 | 0x9d, 0x3f, 0x4c, 0x47, 0x7b, 0x4d, 0x1c, 0xae, | ||
355 | 0x50, 0x9b, 0xcb, 0xdd, 0x05, 0x8d, 0x9a, 0x97, | ||
356 | 0xfd, 0x8c, 0xef, 0x0c, 0x1d, 0x67, 0x73, 0xa8, | ||
357 | 0x28, 0x36, 0xd5, 0xb6, 0x92, 0x33, 0x40, 0x75, | ||
358 | 0x0b, 0x51, 0xc3, 0x64, 0xba, 0x1d, 0xc2, 0xcc, | ||
359 | 0xee, 0x7d, 0x54, 0x0f, 0x27, 0x69, 0xa7, 0x27, | ||
360 | 0x63, 0x30, 0x29, 0xd9, 0xc8, 0x84, 0xd8, 0xdf, | ||
361 | 0x9f, 0x68, 0x8d, 0x04, 0xca, 0xa6, 0xc5, 0xc7, | ||
362 | 0x7a, 0x5c, 0xc8, 0xd1, 0xcb, 0x4a, 0xec, 0xd0, | ||
363 | 0xd8, 0x20, 0x69, 0xc5, 0x17, 0xcd, 0x78, 0xc8, | ||
364 | 0x75, 0x23, 0x30, 0x69, 0xc9, 0xd4, 0xea, 0x5c, | ||
365 | 0x4f, 0x6b, 0x86, 0x3f, 0x8b, 0xfe, 0xee, 0x44, | ||
366 | 0xc9, 0x7c, 0xb7, 0xdd, 0x3e, 0xe5, 0xec, 0x54, | ||
367 | 0x03, 0x3e, 0xaa, 0x82, 0xc6, 0xdf, 0xb2, 0x38, | ||
368 | 0x0e, 0x5d, 0xb3, 0x88, 0xd9, 0xd3, 0x69, 0x5f, | ||
369 | 0x8f, 0x70, 0x8a, 0x7e, 0x11, 0xd9, 0x1e, 0x7b, | ||
370 | 0x38, 0xf1, 0x42, 0x1a, 0xc0, 0x35, 0xf5, 0xc7, | ||
371 | 0x36, 0x85, 0xf5, 0xf7, 0xb8, 0x7e, 0xc7, 0xef, | ||
372 | 0x18, 0xf1, 0x63, 0xd6, 0x7a, 0xc6, 0xc9, 0x0e, | ||
373 | 0x4d, 0x69, 0x4f, 0x84, 0xef, 0x26, 0x41, 0x0c, | ||
374 | 0xec, 0xc7, 0xe0, 0x7e, 0x3c, 0x67, 0x01, 0x4c, | ||
375 | 0x62, 0x1a, 0x20, 0x6f, 0xee, 0x47, 0x4d, 0xc0, | ||
376 | 0x99, 0x13, 0x8d, 0x91, 0x4a, 0x26, 0xd4, 0x37, | ||
377 | 0x28, 0x90, 0x58, 0x75, 0x66, 0x2b, 0x0a, 0xdf, | ||
378 | 0xda, 0xee, 0x92, 0x25, 0x90, 0x62, 0x39, 0x9e, | ||
379 | 0x44, 0x98, 0xad, 0xc1, 0x88, 0xed, 0xe4, 0xb4, | ||
380 | 0xaf, 0xf5, 0x8c, 0x9b, 0x48, 0x4d, 0x56, 0x60, | ||
381 | 0x97, 0x0f, 0x61, 0x59, 0x9e, 0xa6, 0x27, 0xfe, | ||
382 | 0xc1, 0x91, 0x15, 0x38, 0xb8, 0x0f, 0xae, 0x61, | ||
383 | 0x7d, 0x26, 0x13, 0x5a, 0x73, 0xff, 0x1c, 0xa3, | ||
384 | 0x61, 0x04, 0x58, 0x48, 0x55, 0x44, 0x11, 0xfe, | ||
385 | 0x15, 0xca, 0xc3, 0xbd, 0xca, 0xc5, 0xb4, 0x40, | ||
386 | 0x5d, 0x1b, 0x7f, 0x39, 0xb5, 0x9c, 0x35, 0xec, | ||
387 | 0x61, 0x15, 0x32, 0x32, 0xb8, 0x4e, 0x40, 0x9f, | ||
388 | 0x17, 0x1f, 0x0a, 0x4d, 0xa9, 0x91, 0xef, 0xb7, | ||
389 | 0xb0, 0xeb, 0xc2, 0x83, 0x9a, 0x6c, 0xd2, 0x79, | ||
390 | 0x43, 0x78, 0x5e, 0x2f, 0xe5, 0xdd, 0x1a, 0x3c, | ||
391 | 0x45, 0xab, 0x29, 0x40, 0x3a, 0x37, 0x5b, 0x6f, | ||
392 | 0xd7, 0xfc, 0x48, 0x64, 0x3c, 0x49, 0xfb, 0x21, | ||
393 | 0xbe, 0xc3, 0xff, 0x07, 0xfb, 0x17, 0xe9, 0xc9, | ||
394 | 0x0c, 0x4c, 0x5c, 0x15, 0x9e, 0x8e, 0x22, 0x30, | ||
395 | 0x0a, 0xde, 0x48, 0x7f, 0xdb, 0x0d, 0xd1, 0x2b, | ||
396 | 0x87, 0x38, 0x9e, 0xcc, 0x5a, 0x01, 0x16, 0xee, | ||
397 | 0x75, 0x49, 0x0d, 0x30, 0x01, 0x34, 0x6a, 0xb6, | ||
398 | 0x9a, 0x5a, 0x2a, 0xec, 0xbb, 0x48, 0xac, 0xd3, | ||
399 | 0x77, 0x83, 0xd8, 0x08, 0x86, 0x4f, 0x48, 0x09, | ||
400 | 0x29, 0x41, 0x79, 0xa1, 0x03, 0x12, 0xc4, 0xcd, | ||
401 | 0x90, 0x55, 0x47, 0x66, 0x74, 0x9a, 0xcc, 0x4f, | ||
402 | 0x35, 0x8c, 0xd6, 0x98, 0xef, 0xeb, 0x45, 0xb9, | ||
403 | 0x9a, 0x26, 0x2f, 0x39, 0xa5, 0x70, 0x6d, 0xfc, | ||
404 | 0xb4, 0x51, 0xee, 0xf4, 0x9c, 0xe7, 0x38, 0x59, | ||
405 | 0xad, 0xf4, 0xbc, 0x46, 0xff, 0x46, 0x8e, 0x60, | ||
406 | 0x9c, 0xa3, 0x60, 0x1d, 0xf8, 0x26, 0x72, 0xf5, | ||
407 | 0x72, 0x9d, 0x68, 0x80, 0x04, 0xf6, 0x0b, 0xa1, | ||
408 | 0x0a, 0xd5, 0xa7, 0x82, 0x3a, 0x3e, 0x47, 0xa8, | ||
409 | 0x5a, 0xde, 0x59, 0x4f, 0x7b, 0x07, 0xb3, 0xe9, | ||
410 | 0x24, 0x19, 0x3d, 0x34, 0x05, 0xec, 0xf1, 0xab, | ||
411 | 0x6e, 0x64, 0x8f, 0xd3, 0xe6, 0x41, 0x86, 0x80, | ||
412 | 0x70, 0xe3, 0x8d, 0x60, 0x9c, 0x34, 0x25, 0x01, | ||
413 | 0x07, 0x4d, 0x19, 0x41, 0x4e, 0x3d, 0x5c, 0x7e, | ||
414 | 0xa8, 0xf5, 0xcc, 0xd5, 0x7b, 0xe2, 0x7d, 0x3d, | ||
415 | 0x49, 0x86, 0x7d, 0x07, 0xb7, 0x10, 0xe3, 0x35, | ||
416 | 0xb8, 0x84, 0x6d, 0x76, 0xab, 0x17, 0xc6, 0x38, | ||
417 | 0xb4, 0xd3, 0x28, 0x57, 0xad, 0xd3, 0x88, 0x5a, | ||
418 | 0xda, 0xea, 0xc8, 0x94, 0xcc, 0x37, 0x19, 0xac, | ||
419 | 0x9c, 0x9f, 0x4b, 0x00, 0x15, 0xc0, 0xc8, 0xca, | ||
420 | 0x1f, 0x15, 0xaa, 0xe0, 0xdb, 0xf9, 0x2f, 0x57, | ||
421 | 0x1b, 0x24, 0xc7, 0x6f, 0x76, 0x29, 0xfb, 0xed, | ||
422 | 0x25, 0x0d, 0xc0, 0xfe, 0xbd, 0x5a, 0xbf, 0x20, | ||
423 | 0x08, 0x51, 0x05, 0xec, 0x71, 0xa3, 0xbf, 0xef, | ||
424 | 0x5e, 0x99, 0x75, 0xdb, 0x3c, 0x5f, 0x9a, 0x8c, | ||
425 | 0xbb, 0x19, 0x5c, 0x0e, 0x93, 0x19, 0xf8, 0x6a, | ||
426 | 0xbc, 0xf2, 0x12, 0x54, 0x2f, 0xcb, 0x28, 0x64, | ||
427 | 0x88, 0xb3, 0x92, 0x0d, 0x96, 0xd1, 0xa6, 0xe4, | ||
428 | 0x1f, 0xf1, 0x4d, 0xa4, 0xab, 0x1c, 0xee, 0x54, | ||
429 | 0xf2, 0xad, 0x29, 0x6d, 0x32, 0x37, 0xb2, 0x16, | ||
430 | 0x77, 0x5c, 0xdc, 0x2e, 0x54, 0xec, 0x75, 0x26, | ||
431 | 0xc6, 0x36, 0xd9, 0x17, 0x2c, 0xf1, 0x7a, 0xdc, | ||
432 | 0x4b, 0xf1, 0xe2, 0xd9, 0x95, 0xba, 0xac, 0x87, | ||
433 | 0xc1, 0xf3, 0x8e, 0x58, 0x08, 0xd8, 0x87, 0x60, | ||
434 | 0xc9, 0xee, 0x6a, 0xde, 0xa4, 0xd2, 0xfc, 0x0d, | ||
435 | 0xe5, 0x36, 0xc4, 0x5c, 0x52, 0xb3, 0x07, 0x54, | ||
436 | 0x65, 0x24, 0xc1, 0xb1, 0xd1, 0xb1, 0x53, 0x13, | ||
437 | 0x31, 0x79, 0x7f, 0x05, 0x76, 0xeb, 0x37, 0x59, | ||
438 | 0x15, 0x2b, 0xd1, 0x3f, 0xac, 0x08, 0x97, 0xeb, | ||
439 | 0x91, 0x98, 0xdf, 0x6c, 0x09, 0x0d, 0x04, 0x9f, | ||
440 | 0xdc, 0x3b, 0x0e, 0x60, 0x68, 0x47, 0x23, 0x15, | ||
441 | 0x16, 0xc6, 0x0b, 0x35, 0xf8, 0x77, 0xa2, 0x78, | ||
442 | 0x50, 0xd4, 0x64, 0x22, 0x33, 0xff, 0xfb, 0x93, | ||
443 | 0x71, 0x46, 0x50, 0x39, 0x1b, 0x9c, 0xea, 0x4e, | ||
444 | 0x8d, 0x0c, 0x37, 0xe5, 0x5c, 0x51, 0x3a, 0x31, | ||
445 | 0xb2, 0x85, 0x84, 0x3f, 0x41, 0xee, 0xa2, 0xc1, | ||
446 | 0xc6, 0x13, 0x3b, 0x54, 0x28, 0xd2, 0x18, 0x37, | ||
447 | 0xcc, 0x46, 0x9f, 0x6a, 0x91, 0x3d, 0x5a, 0x15, | ||
448 | 0x3c, 0x89, 0xa3, 0x61, 0x06, 0x7d, 0x2e, 0x78, | ||
449 | 0xbe, 0x7d, 0x40, 0xba, 0x2f, 0x95, 0xb1, 0x2f, | ||
450 | 0x87, 0x3b, 0x8a, 0xbe, 0x6a, 0xf4, 0xc2, 0x31, | ||
451 | 0x74, 0xee, 0x91, 0xe0, 0x23, 0xaa, 0x5d, 0x7f, | ||
452 | 0xdd, 0xf0, 0x44, 0x8c, 0x0b, 0x59, 0x2b, 0xfc, | ||
453 | 0x48, 0x3a, 0xdf, 0x07, 0x05, 0x38, 0x6c, 0xc9, | ||
454 | 0xeb, 0x18, 0x24, 0x68, 0x8d, 0x58, 0x98, 0xd3, | ||
455 | 0x31, 0xa3, 0xe4, 0x70, 0x59, 0xb1, 0x21, 0xbe, | ||
456 | 0x7e, 0x65, 0x7d, 0xb8, 0x04, 0xab, 0xf6, 0xe4, | ||
457 | 0xd7, 0xda, 0xec, 0x09, 0x8f, 0xda, 0x6d, 0x24, | ||
458 | 0x07, 0xcc, 0x29, 0x17, 0x05, 0x78, 0x1a, 0xc1, | ||
459 | 0xb1, 0xce, 0xfc, 0xaa, 0x2d, 0xe7, 0xcc, 0x85, | ||
460 | 0x84, 0x84, 0x03, 0x2a, 0x0c, 0x3f, 0xa9, 0xf8, | ||
461 | 0xfd, 0x84, 0x53, 0x59, 0x5c, 0xf0, 0xd4, 0x09, | ||
462 | 0xf0, 0xd2, 0x6c, 0x32, 0x03, 0xb0, 0xa0, 0x8c, | ||
463 | 0x52, 0xeb, 0x23, 0x91, 0x88, 0x43, 0x13, 0x46, | ||
464 | 0xf6, 0x1e, 0xb4, 0x1b, 0xf5, 0x8e, 0x3a, 0xb5, | ||
465 | 0x3d, 0x00, 0xf6, 0xe5, 0x08, 0x3d, 0x5f, 0x39, | ||
466 | 0xd3, 0x21, 0x69, 0xbc, 0x03, 0x22, 0x3a, 0xd2, | ||
467 | 0x5c, 0x84, 0xf8, 0x15, 0xc4, 0x80, 0x0b, 0xbc, | ||
468 | 0x29, 0x3c, 0xf3, 0x95, 0x98, 0xcd, 0x8f, 0x35, | ||
469 | 0xbc, 0xa5, 0x3e, 0xfc, 0xd4, 0x13, 0x9e, 0xde, | ||
470 | 0x4f, 0xce, 0x71, 0x9d, 0x09, 0xad, 0xf2, 0x80, | ||
471 | 0x6b, 0x65, 0x7f, 0x03, 0x00, 0x14, 0x7c, 0x15, | ||
472 | 0x85, 0x40, 0x6d, 0x70, 0xea, 0xdc, 0xb3, 0x63, | ||
473 | 0x35, 0x4f, 0x4d, 0xe0, 0xd9, 0xd5, 0x3c, 0x58, | ||
474 | 0x56, 0x23, 0x80, 0xe2, 0x36, 0xdd, 0x75, 0x1d, | ||
475 | 0x94, 0x11, 0x41, 0x8e, 0xe0, 0x81, 0x8e, 0xcf, | ||
476 | 0xe0, 0xe5, 0xf6, 0xde, 0xd1, 0xe7, 0x04, 0x12, | ||
477 | 0x79, 0x92, 0x2b, 0x71, 0x2a, 0x79, 0x8b, 0x7c, | ||
478 | 0x44, 0x79, 0x16, 0x30, 0x4e, 0xf4, 0xf6, 0x9b, | ||
479 | 0xb7, 0x40, 0xa3, 0x5a, 0xa7, 0x69, 0x3e, 0xc1, | ||
480 | 0x3a, 0x04, 0xd0, 0x88, 0xa0, 0x3b, 0xdd, 0xc6, | ||
481 | 0x9e, 0x7e, 0x1e, 0x1e, 0x8f, 0x44, 0xf7, 0x73, | ||
482 | 0x67, 0x1e, 0x1a, 0x78, 0xfa, 0x62, 0xf4, 0xa9, | ||
483 | 0xa8, 0xc6, 0x5b, 0xb8, 0xfa, 0x06, 0x7d, 0x5e, | ||
484 | 0x38, 0x1c, 0x9a, 0x39, 0xe9, 0x39, 0x98, 0x22, | ||
485 | 0x0b, 0xa7, 0xac, 0x0b, 0xf3, 0xbc, 0xf1, 0xeb, | ||
486 | 0x8c, 0x81, 0xe3, 0x48, 0x8a, 0xed, 0x42, 0xc2, | ||
487 | 0x38, 0xcf, 0x3e, 0xda, 0xd2, 0x89, 0x8d, 0x9c, | ||
488 | 0x53, 0xb5, 0x2f, 0x41, 0x01, 0x26, 0x84, 0x9c, | ||
489 | 0xa3, 0x56, 0xf6, 0x49, 0xc7, 0xd4, 0x9f, 0x93, | ||
490 | 0x1b, 0x96, 0x49, 0x5e, 0xad, 0xb3, 0x84, 0x1f, | ||
491 | 0x3c, 0xa4, 0xe0, 0x9b, 0xd1, 0x90, 0xbc, 0x38, | ||
492 | 0x6c, 0xdd, 0x95, 0x4d, 0x9d, 0xb1, 0x71, 0x57, | ||
493 | 0x2d, 0x34, 0xe8, 0xb8, 0x42, 0xc7, 0x99, 0x03, | ||
494 | 0xc7, 0x07, 0x30, 0x65, 0x91, 0x55, 0xd5, 0x90, | ||
495 | 0x70, 0x97, 0x37, 0x68, 0xd4, 0x11, 0xf9, 0xe8, | ||
496 | 0xce, 0xec, 0xdc, 0x34, 0xd5, 0xd3, 0xb7, 0xc4, | ||
497 | 0xb8, 0x97, 0x05, 0x92, 0xad, 0xf8, 0xe2, 0x36, | ||
498 | 0x64, 0x41, 0xc9, 0xc5, 0x41, 0x77, 0x52, 0xd7, | ||
499 | 0x2c, 0xa5, 0x24, 0x2f, 0xd9, 0x34, 0x0b, 0x47, | ||
500 | 0x35, 0xa7, 0x28, 0x8b, 0xc5, 0xcd, 0xe9, 0x46, | ||
501 | 0xac, 0x39, 0x94, 0x3c, 0x10, 0xc6, 0x29, 0x73, | ||
502 | 0x0e, 0x0e, 0x5d, 0xe0, 0x71, 0x03, 0x8a, 0x72, | ||
503 | 0x0e, 0x26, 0xb0, 0x7d, 0x84, 0xed, 0x95, 0x23, | ||
504 | 0x49, 0x5a, 0x45, 0x83, 0x45, 0x60, 0x11, 0x4a, | ||
505 | 0x46, 0x31, 0xd4, 0xd8, 0x16, 0x54, 0x98, 0x58, | ||
506 | 0xed, 0x6d, 0xcc, 0x5d, 0xd6, 0x50, 0x61, 0x9f, | ||
507 | 0x9d, 0xc5, 0x3e, 0x9d, 0x32, 0x47, 0xde, 0x96, | ||
508 | 0xe1, 0x5d, 0xd8, 0xf8, 0xb4, 0x69, 0x6f, 0xb9, | ||
509 | 0x15, 0x90, 0x57, 0x7a, 0xf6, 0xad, 0xb0, 0x5b, | ||
510 | 0xf5, 0xa6, 0x36, 0x94, 0xfd, 0x84, 0xce, 0x1c, | ||
511 | 0x0f, 0x4b, 0xd0, 0xc2, 0x5b, 0x6b, 0x56, 0xef, | ||
512 | 0x73, 0x93, 0x0b, 0xc3, 0xee, 0xd9, 0xcf, 0xd3, | ||
513 | 0xa4, 0x22, 0x58, 0xcd, 0x50, 0x6e, 0x65, 0xf4, | ||
514 | 0xe9, 0xb7, 0x71, 0xaf, 0x4b, 0xb3, 0xb6, 0x2f, | ||
515 | 0x0f, 0x0e, 0x3b, 0xc9, 0x85, 0x14, 0xf5, 0x17, | ||
516 | 0xe8, 0x7a, 0x3a, 0xbf, 0x5f, 0x5e, 0xf8, 0x18, | ||
517 | 0x48, 0xa6, 0x72, 0xab, 0x06, 0x95, 0xe9, 0xc8, | ||
518 | 0xa7, 0xf4, 0x32, 0x44, 0x04, 0x0c, 0x84, 0x98, | ||
519 | 0x73, 0xe3, 0x89, 0x8d, 0x5f, 0x7e, 0x4a, 0x42, | ||
520 | 0x8f, 0xc5, 0x28, 0xb1, 0x82, 0xef, 0x1c, 0x97, | ||
521 | 0x31, 0x3b, 0x4d, 0xe0, 0x0e, 0x10, 0x10, 0x97, | ||
522 | 0x93, 0x49, 0x78, 0x2f, 0x0d, 0x86, 0x8b, 0xa1, | ||
523 | 0x53, 0xa9, 0x81, 0x20, 0x79, 0xe7, 0x07, 0x77, | ||
524 | 0xb6, 0xac, 0x5e, 0xd2, 0x05, 0xcd, 0xe9, 0xdb, | ||
525 | 0x8a, 0x94, 0x82, 0x8a, 0x23, 0xb9, 0x3d, 0x1c, | ||
526 | 0xa9, 0x7d, 0x72, 0x4a, 0xed, 0x33, 0xa3, 0xdb, | ||
527 | 0x21, 0xa7, 0x86, 0x33, 0x45, 0xa5, 0xaa, 0x56, | ||
528 | 0x45, 0xb5, 0x83, 0x29, 0x40, 0x47, 0x79, 0x04, | ||
529 | 0x6e, 0xb9, 0x95, 0xd0, 0x81, 0x77, 0x2d, 0x48, | ||
530 | 0x1e, 0xfe, 0xc3, 0xc2, 0x1e, 0xe5, 0xf2, 0xbe, | ||
531 | 0xfd, 0x3b, 0x94, 0x9f, 0xc4, 0xc4, 0x26, 0x9d, | ||
532 | 0xe4, 0x66, 0x1e, 0x19, 0xee, 0x6c, 0x79, 0x97, | ||
533 | 0x11, 0x31, 0x4b, 0x0d, 0x01, 0xcb, 0xde, 0xa8, | ||
534 | 0xf6, 0x6d, 0x7c, 0x39, 0x46, 0x4e, 0x7e, 0x3f, | ||
535 | 0x94, 0x17, 0xdf, 0xa1, 0x7d, 0xd9, 0x1c, 0x8e, | ||
536 | 0xbc, 0x7d, 0x33, 0x7d, 0xe3, 0x12, 0x40, 0xca, | ||
537 | 0xab, 0x37, 0x11, 0x46, 0xd4, 0xae, 0xef, 0x44, | ||
538 | 0xa2, 0xb3, 0x6a, 0x66, 0x0e, 0x0c, 0x90, 0x7f, | ||
539 | 0xdf, 0x5c, 0x66, 0x5f, 0xf2, 0x94, 0x9f, 0xa6, | ||
540 | 0x73, 0x4f, 0xeb, 0x0d, 0xad, 0xbf, 0xc0, 0x63, | ||
541 | 0x5c, 0xdc, 0x46, 0x51, 0xe8, 0x8e, 0x90, 0x19, | ||
542 | 0xa8, 0xa4, 0x3c, 0x91, 0x79, 0xfa, 0x7e, 0x58, | ||
543 | 0x85, 0x13, 0x55, 0xc5, 0x19, 0x82, 0x37, 0x1b, | ||
544 | 0x0a, 0x02, 0x1f, 0x99, 0x6b, 0x18, 0xf1, 0x28, | ||
545 | 0x08, 0xa2, 0x73, 0xb8, 0x0f, 0x2e, 0xcd, 0xbf, | ||
546 | 0xf3, 0x86, 0x7f, 0xea, 0xef, 0xd0, 0xbb, 0xa6, | ||
547 | 0x21, 0xdf, 0x49, 0x73, 0x51, 0xcc, 0x36, 0xd3, | ||
548 | 0x3e, 0xa0, 0xf8, 0x44, 0xdf, 0xd3, 0xa6, 0xbe, | ||
549 | 0x8a, 0xd4, 0x57, 0xdd, 0x72, 0x94, 0x61, 0x0f, | ||
550 | 0x82, 0xd1, 0x07, 0xb8, 0x7c, 0x18, 0x83, 0xdf, | ||
551 | 0x3a, 0xe5, 0x50, 0x6a, 0x82, 0x20, 0xac, 0xa9, | ||
552 | 0xa8, 0xff, 0xd9, 0xf3, 0x77, 0x33, 0x5a, 0x9e, | ||
553 | 0x7f, 0x6d, 0xfe, 0x5d, 0x33, 0x41, 0x42, 0xe7, | ||
554 | 0x6c, 0x19, 0xe0, 0x44, 0x8a, 0x15, 0xf6, 0x70, | ||
555 | 0x98, 0xb7, 0x68, 0x4d, 0xfa, 0x97, 0x39, 0xb0, | ||
556 | 0x8e, 0xe8, 0x84, 0x8b, 0x75, 0x30, 0xb7, 0x7d, | ||
557 | 0x92, 0x69, 0x20, 0x9c, 0x81, 0xfb, 0x4b, 0xf4, | ||
558 | 0x01, 0x50, 0xeb, 0xce, 0x0c, 0x1c, 0x6c, 0xb5, | ||
559 | 0x4a, 0xd7, 0x27, 0x0c, 0xce, 0xbb, 0xe5, 0x85, | ||
560 | 0xf0, 0xb6, 0xee, 0xd5, 0x70, 0xdd, 0x3b, 0xfc, | ||
561 | 0xd4, 0x99, 0xf1, 0x33, 0xdd, 0x8b, 0xc4, 0x2f, | ||
562 | 0xae, 0xab, 0x74, 0x96, 0x32, 0xc7, 0x4c, 0x56, | ||
563 | 0x3c, 0x89, 0x0f, 0x96, 0x0b, 0x42, 0xc0, 0xcb, | ||
564 | 0xee, 0x0f, 0x0b, 0x8c, 0xfb, 0x7e, 0x47, 0x7b, | ||
565 | 0x64, 0x48, 0xfd, 0xb2, 0x00, 0x80, 0x89, 0xa5, | ||
566 | 0x13, 0x55, 0x62, 0xfc, 0x8f, 0xe2, 0x42, 0x03, | ||
567 | 0xb7, 0x4e, 0x2a, 0x79, 0xb4, 0x82, 0xea, 0x23, | ||
568 | 0x49, 0xda, 0xaf, 0x52, 0x63, 0x1e, 0x60, 0x03, | ||
569 | 0x89, 0x06, 0x44, 0x46, 0x08, 0xc3, 0xc4, 0x87, | ||
570 | 0x70, 0x2e, 0xda, 0x94, 0xad, 0x6b, 0xe0, 0xe4, | ||
571 | 0xd1, 0x8a, 0x06, 0xc2, 0xa8, 0xc0, 0xa7, 0x43, | ||
572 | 0x3c, 0x47, 0x52, 0x0e, 0xc3, 0x77, 0x81, 0x11, | ||
573 | 0x67, 0x0e, 0xa0, 0x70, 0x04, 0x47, 0x29, 0x40, | ||
574 | 0x86, 0x0d, 0x34, 0x56, 0xa7, 0xc9, 0x35, 0x59, | ||
575 | 0x68, 0xdc, 0x93, 0x81, 0x70, 0xee, 0x86, 0xd9, | ||
576 | 0x80, 0x06, 0x40, 0x4f, 0x1a, 0x0d, 0x40, 0x30, | ||
577 | 0x0b, 0xcb, 0x96, 0x47, 0xc1, 0xb7, 0x52, 0xfd, | ||
578 | 0x56, 0xe0, 0x72, 0x4b, 0xfb, 0xbd, 0x92, 0x45, | ||
579 | 0x61, 0x71, 0xc2, 0x33, 0x11, 0xbf, 0x52, 0x83, | ||
580 | 0x79, 0x26, 0xe0, 0x49, 0x6b, 0xb7, 0x05, 0x8b, | ||
581 | 0xe8, 0x0e, 0x87, 0x31, 0xd7, 0x9d, 0x8a, 0xf5, | ||
582 | 0xc0, 0x5f, 0x2e, 0x58, 0x4a, 0xdb, 0x11, 0xb3, | ||
583 | 0x6c, 0x30, 0x2a, 0x46, 0x19, 0xe3, 0x27, 0x84, | ||
584 | 0x1f, 0x63, 0x6e, 0xf6, 0x57, 0xc7, 0xc9, 0xd8, | ||
585 | 0x5e, 0xba, 0xb3, 0x87, 0xd5, 0x83, 0x26, 0x34, | ||
586 | 0x21, 0x9e, 0x65, 0xde, 0x42, 0xd3, 0xbe, 0x7b, | ||
587 | 0xbc, 0x91, 0x71, 0x44, 0x4d, 0x99, 0x3b, 0x31, | ||
588 | 0xe5, 0x3f, 0x11, 0x4e, 0x7f, 0x13, 0x51, 0x3b, | ||
589 | 0xae, 0x79, 0xc9, 0xd3, 0x81, 0x8e, 0x25, 0x40, | ||
590 | 0x10, 0xfc, 0x07, 0x1e, 0xf9, 0x7b, 0x9a, 0x4b, | ||
591 | 0x6c, 0xe3, 0xb3, 0xad, 0x1a, 0x0a, 0xdd, 0x9e, | ||
592 | 0x59, 0x0c, 0xa2, 0xcd, 0xae, 0x48, 0x4a, 0x38, | ||
593 | 0x5b, 0x47, 0x41, 0x94, 0x65, 0x6b, 0xbb, 0xeb, | ||
594 | 0x5b, 0xe3, 0xaf, 0x07, 0x5b, 0xd4, 0x4a, 0xa2, | ||
595 | 0xc9, 0x5d, 0x2f, 0x64, 0x03, 0xd7, 0x3a, 0x2c, | ||
596 | 0x6e, 0xce, 0x76, 0x95, 0xb4, 0xb3, 0xc0, 0xf1, | ||
597 | 0xe2, 0x45, 0x73, 0x7a, 0x5c, 0xab, 0xc1, 0xfc, | ||
598 | 0x02, 0x8d, 0x81, 0x29, 0xb3, 0xac, 0x07, 0xec, | ||
599 | 0x40, 0x7d, 0x45, 0xd9, 0x7a, 0x59, 0xee, 0x34, | ||
600 | 0xf0, 0xe9, 0xd5, 0x7b, 0x96, 0xb1, 0x3d, 0x95, | ||
601 | 0xcc, 0x86, 0xb5, 0xb6, 0x04, 0x2d, 0xb5, 0x92, | ||
602 | 0x7e, 0x76, 0xf4, 0x06, 0xa9, 0xa3, 0x12, 0x0f, | ||
603 | 0xb1, 0xaf, 0x26, 0xba, 0x7c, 0xfc, 0x7e, 0x1c, | ||
604 | 0xbc, 0x2c, 0x49, 0x97, 0x53, 0x60, 0x13, 0x0b, | ||
605 | 0xa6, 0x61, 0x83, 0x89, 0x42, 0xd4, 0x17, 0x0c, | ||
606 | 0x6c, 0x26, 0x52, 0xc3, 0xb3, 0xd4, 0x67, 0xf5, | ||
607 | 0xe3, 0x04, 0xb7, 0xf4, 0xcb, 0x80, 0xb8, 0xcb, | ||
608 | 0x77, 0x56, 0x3e, 0xaa, 0x57, 0x54, 0xee, 0xb4, | ||
609 | 0x2c, 0x67, 0xcf, 0xf2, 0xdc, 0xbe, 0x55, 0xf9, | ||
610 | 0x43, 0x1f, 0x6e, 0x22, 0x97, 0x67, 0x7f, 0xc4, | ||
611 | 0xef, 0xb1, 0x26, 0x31, 0x1e, 0x27, 0xdf, 0x41, | ||
612 | 0x80, 0x47, 0x6c, 0xe2, 0xfa, 0xa9, 0x8c, 0x2a, | ||
613 | 0xf6, 0xf2, 0xab, 0xf0, 0x15, 0xda, 0x6c, 0xc8, | ||
614 | 0xfe, 0xb5, 0x23, 0xde, 0xa9, 0x05, 0x3f, 0x06, | ||
615 | 0x54, 0x4c, 0xcd, 0xe1, 0xab, 0xfc, 0x0e, 0x62, | ||
616 | 0x33, 0x31, 0x73, 0x2c, 0x76, 0xcb, 0xb4, 0x47, | ||
617 | 0x1e, 0x20, 0xad, 0xd8, 0xf2, 0x31, 0xdd, 0xc4, | ||
618 | 0x8b, 0x0c, 0x77, 0xbe, 0xe1, 0x8b, 0x26, 0x00, | ||
619 | 0x02, 0x58, 0xd6, 0x8d, 0xef, 0xad, 0x74, 0x67, | ||
620 | 0xab, 0x3f, 0xef, 0xcb, 0x6f, 0xb0, 0xcc, 0x81, | ||
621 | 0x44, 0x4c, 0xaf, 0xe9, 0x49, 0x4f, 0xdb, 0xa0, | ||
622 | 0x25, 0xa4, 0xf0, 0x89, 0xf1, 0xbe, 0xd8, 0x10, | ||
623 | 0xff, 0xb1, 0x3b, 0x4b, 0xfa, 0x98, 0xf5, 0x79, | ||
624 | 0x6d, 0x1e, 0x69, 0x4d, 0x57, 0xb1, 0xc8, 0x19, | ||
625 | 0x1b, 0xbd, 0x1e, 0x8c, 0x84, 0xb7, 0x7b, 0xe8, | ||
626 | 0xd2, 0x2d, 0x09, 0x41, 0x41, 0x37, 0x3d, 0xb1, | ||
627 | 0x6f, 0x26, 0x5d, 0x71, 0x16, 0x3d, 0xb7, 0x83, | ||
628 | 0x27, 0x2c, 0xa7, 0xb6, 0x50, 0xbd, 0x91, 0x86, | ||
629 | 0xab, 0x24, 0xa1, 0x38, 0xfd, 0xea, 0x71, 0x55, | ||
630 | 0x7e, 0x9a, 0x07, 0x77, 0x4b, 0xfa, 0x61, 0x66, | ||
631 | 0x20, 0x1e, 0x28, 0x95, 0x18, 0x1b, 0xa4, 0xa0, | ||
632 | 0xfd, 0xc0, 0x89, 0x72, 0x43, 0xd9, 0x3b, 0x49, | ||
633 | 0x5a, 0x3f, 0x9d, 0xbf, 0xdb, 0xb4, 0x46, 0xea, | ||
634 | 0x42, 0x01, 0x77, 0x23, 0x68, 0x95, 0xb6, 0x24, | ||
635 | 0xb3, 0xa8, 0x6c, 0x28, 0x3b, 0x11, 0x40, 0x7e, | ||
636 | 0x18, 0x65, 0x6d, 0xd8, 0x24, 0x42, 0x7d, 0x88, | ||
637 | 0xc0, 0x52, 0xd9, 0x05, 0xe4, 0x95, 0x90, 0x87, | ||
638 | 0x8c, 0xf4, 0xd0, 0x6b, 0xb9, 0x83, 0x99, 0x34, | ||
639 | 0x6d, 0xfe, 0x54, 0x40, 0x94, 0x52, 0x21, 0x4f, | ||
640 | 0x14, 0x25, 0xc5, 0xd6, 0x5e, 0x95, 0xdc, 0x0a, | ||
641 | 0x2b, 0x89, 0x20, 0x11, 0x84, 0x48, 0xd6, 0x3a, | ||
642 | 0xcd, 0x5c, 0x24, 0xad, 0x62, 0xe3, 0xb1, 0x93, | ||
643 | 0x25, 0x8d, 0xcd, 0x7e, 0xfc, 0x27, 0xa3, 0x37, | ||
644 | 0xfd, 0x84, 0xfc, 0x1b, 0xb2, 0xf1, 0x27, 0x38, | ||
645 | 0x5a, 0xb7, 0xfc, 0xf2, 0xfa, 0x95, 0x66, 0xd4, | ||
646 | 0xfb, 0xba, 0xa7, 0xd7, 0xa3, 0x72, 0x69, 0x48, | ||
647 | 0x48, 0x8c, 0xeb, 0x28, 0x89, 0xfe, 0x33, 0x65, | ||
648 | 0x5a, 0x36, 0x01, 0x7e, 0x06, 0x79, 0x0a, 0x09, | ||
649 | 0x3b, 0x74, 0x11, 0x9a, 0x6e, 0xbf, 0xd4, 0x9e, | ||
650 | 0x58, 0x90, 0x49, 0x4f, 0x4d, 0x08, 0xd4, 0xe5, | ||
651 | 0x4a, 0x09, 0x21, 0xef, 0x8b, 0xb8, 0x74, 0x3b, | ||
652 | 0x91, 0xdd, 0x36, 0x85, 0x60, 0x2d, 0xfa, 0xd4, | ||
653 | 0x45, 0x7b, 0x45, 0x53, 0xf5, 0x47, 0x87, 0x7e, | ||
654 | 0xa6, 0x37, 0xc8, 0x78, 0x7a, 0x68, 0x9d, 0x8d, | ||
655 | 0x65, 0x2c, 0x0e, 0x91, 0x5c, 0xa2, 0x60, 0xf0, | ||
656 | 0x8e, 0x3f, 0xe9, 0x1a, 0xcd, 0xaa, 0xe7, 0xd5, | ||
657 | 0x77, 0x18, 0xaf, 0xc9, 0xbc, 0x18, 0xea, 0x48, | ||
658 | 0x1b, 0xfb, 0x22, 0x48, 0x70, 0x16, 0x29, 0x9e, | ||
659 | 0x5b, 0xc1, 0x2c, 0x66, 0x23, 0xbc, 0xf0, 0x1f, | ||
660 | 0xef, 0xaf, 0xe4, 0xd6, 0x04, 0x19, 0x82, 0x7a, | ||
661 | 0x0b, 0xba, 0x4b, 0x46, 0xb1, 0x6a, 0x85, 0x5d, | ||
662 | 0xb4, 0x73, 0xd6, 0x21, 0xa1, 0x71, 0x60, 0x14, | ||
663 | 0xee, 0x0a, 0x77, 0xc4, 0x66, 0x2e, 0xf9, 0x69, | ||
664 | 0x30, 0xaf, 0x41, 0x0b, 0xc8, 0x83, 0x3c, 0x53, | ||
665 | 0x99, 0x19, 0x27, 0x46, 0xf7, 0x41, 0x6e, 0x56, | ||
666 | 0xdc, 0x94, 0x28, 0x67, 0x4e, 0xb7, 0x25, 0x48, | ||
667 | 0x8a, 0xc2, 0xe0, 0x60, 0x96, 0xcc, 0x18, 0xf4, | ||
668 | 0x84, 0xdd, 0xa7, 0x5e, 0x3e, 0x05, 0x0b, 0x26, | ||
669 | 0x26, 0xb2, 0x5c, 0x1f, 0x57, 0x1a, 0x04, 0x7e, | ||
670 | 0x6a, 0xe3, 0x2f, 0xb4, 0x35, 0xb6, 0x38, 0x40, | ||
671 | 0x40, 0xcd, 0x6f, 0x87, 0x2e, 0xef, 0xa3, 0xd7, | ||
672 | 0xa9, 0xc2, 0xe8, 0x0d, 0x27, 0xdf, 0x44, 0x62, | ||
673 | 0x99, 0xa0, 0xfc, 0xcf, 0x81, 0x78, 0xcb, 0xfe, | ||
674 | 0xe5, 0xa0, 0x03, 0x4e, 0x6c, 0xd7, 0xf4, 0xaf, | ||
675 | 0x7a, 0xbb, 0x61, 0x82, 0xfe, 0x71, 0x89, 0xb2, | ||
676 | 0x22, 0x7c, 0x8e, 0x83, 0x04, 0xce, 0xf6, 0x5d, | ||
677 | 0x84, 0x8f, 0x95, 0x6a, 0x7f, 0xad, 0xfd, 0x32, | ||
678 | 0x9c, 0x5e, 0xe4, 0x9c, 0x89, 0x60, 0x54, 0xaa, | ||
679 | 0x96, 0x72, 0xd2, 0xd7, 0x36, 0x85, 0xa9, 0x45, | ||
680 | 0xd2, 0x2a, 0xa1, 0x81, 0x49, 0x6f, 0x7e, 0x04, | ||
681 | 0xfa, 0xe2, 0xfe, 0x90, 0x26, 0x77, 0x5a, 0x33, | ||
682 | 0xb8, 0x04, 0x9a, 0x7a, 0xe6, 0x4c, 0x4f, 0xad, | ||
683 | 0x72, 0x96, 0x08, 0x28, 0x58, 0x13, 0xf8, 0xc4, | ||
684 | 0x1c, 0xf0, 0xc3, 0x45, 0x95, 0x49, 0x20, 0x8c, | ||
685 | 0x9f, 0x39, 0x70, 0xe1, 0x77, 0xfe, 0xd5, 0x4b, | ||
686 | 0xaf, 0x86, 0xda, 0xef, 0x22, 0x06, 0x83, 0x36, | ||
687 | 0x29, 0x12, 0x11, 0x40, 0xbc, 0x3b, 0x86, 0xaa, | ||
688 | 0xaa, 0x65, 0x60, 0xc3, 0x80, 0xca, 0xed, 0xa9, | ||
689 | 0xf3, 0xb0, 0x79, 0x96, 0xa2, 0x55, 0x27, 0x28, | ||
690 | 0x55, 0x73, 0x26, 0xa5, 0x50, 0xea, 0x92, 0x4b, | ||
691 | 0x3c, 0x5c, 0x82, 0x33, 0xf0, 0x01, 0x3f, 0x03, | ||
692 | 0xc1, 0x08, 0x05, 0xbf, 0x98, 0xf4, 0x9b, 0x6d, | ||
693 | 0xa5, 0xa8, 0xb4, 0x82, 0x0c, 0x06, 0xfa, 0xff, | ||
694 | 0x2d, 0x08, 0xf3, 0x05, 0x4f, 0x57, 0x2a, 0x39, | ||
695 | 0xd4, 0x83, 0x0d, 0x75, 0x51, 0xd8, 0x5b, 0x1b, | ||
696 | 0xd3, 0x51, 0x5a, 0x32, 0x2a, 0x9b, 0x32, 0xb2, | ||
697 | 0xf2, 0xa4, 0x96, 0x12, 0xf2, 0xae, 0x40, 0x34, | ||
698 | 0x67, 0xa8, 0xf5, 0x44, 0xd5, 0x35, 0x53, 0xfe, | ||
699 | 0xa3, 0x60, 0x96, 0x63, 0x0f, 0x1f, 0x6e, 0xb0, | ||
700 | 0x5a, 0x42, 0xa6, 0xfc, 0x51, 0x0b, 0x60, 0x27, | ||
701 | 0xbc, 0x06, 0x71, 0xed, 0x65, 0x5b, 0x23, 0x86, | ||
702 | 0x4a, 0x07, 0x3b, 0x22, 0x07, 0x46, 0xe6, 0x90, | ||
703 | 0x3e, 0xf3, 0x25, 0x50, 0x1b, 0x4c, 0x7f, 0x03, | ||
704 | 0x08, 0xa8, 0x36, 0x6b, 0x87, 0xe5, 0xe3, 0xdb, | ||
705 | 0x9a, 0x38, 0x83, 0xff, 0x9f, 0x1a, 0x9f, 0x57, | ||
706 | 0xa4, 0x2a, 0xf6, 0x37, 0xbc, 0x1a, 0xff, 0xc9, | ||
707 | 0x1e, 0x35, 0x0c, 0xc3, 0x7c, 0xa3, 0xb2, 0xe5, | ||
708 | 0xd2, 0xc6, 0xb4, 0x57, 0x47, 0xe4, 0x32, 0x16, | ||
709 | 0x6d, 0xa9, 0xae, 0x64, 0xe6, 0x2d, 0x8d, 0xc5, | ||
710 | 0x8d, 0x50, 0x8e, 0xe8, 0x1a, 0x22, 0x34, 0x2a, | ||
711 | 0xd9, 0xeb, 0x51, 0x90, 0x4a, 0xb1, 0x41, 0x7d, | ||
712 | 0x64, 0xf9, 0xb9, 0x0d, 0xf6, 0x23, 0x33, 0xb0, | ||
713 | 0x33, 0xf4, 0xf7, 0x3f, 0x27, 0x84, 0xc6, 0x0f, | ||
714 | 0x54, 0xa5, 0xc0, 0x2e, 0xec, 0x0b, 0x3a, 0x48, | ||
715 | 0x6e, 0x80, 0x35, 0x81, 0x43, 0x9b, 0x90, 0xb1, | ||
716 | 0xd0, 0x2b, 0xea, 0x21, 0xdc, 0xda, 0x5b, 0x09, | ||
717 | 0xf4, 0xcc, 0x10, 0xb4, 0xc7, 0xfe, 0x79, 0x51, | ||
718 | 0xc3, 0xc5, 0xac, 0x88, 0x74, 0x84, 0x0b, 0x4b, | ||
719 | 0xca, 0x79, 0x16, 0x29, 0xfb, 0x69, 0x54, 0xdf, | ||
720 | 0x41, 0x7e, 0xe9, 0xc7, 0x8e, 0xea, 0xa5, 0xfe, | ||
721 | 0xfc, 0x76, 0x0e, 0x90, 0xc4, 0x92, 0x38, 0xad, | ||
722 | 0x7b, 0x48, 0xe6, 0x6e, 0xf7, 0x21, 0xfd, 0x4e, | ||
723 | 0x93, 0x0a, 0x7b, 0x41, 0x83, 0x68, 0xfb, 0x57, | ||
724 | 0x51, 0x76, 0x34, 0xa9, 0x6c, 0x00, 0xaa, 0x4f, | ||
725 | 0x66, 0x65, 0x98, 0x4a, 0x4f, 0xa3, 0xa0, 0xef, | ||
726 | 0x69, 0x3f, 0xe3, 0x1c, 0x92, 0x8c, 0xfd, 0xd8, | ||
727 | 0xe8, 0xde, 0x7c, 0x7f, 0x3e, 0x84, 0x8e, 0x69, | ||
728 | 0x3c, 0xf1, 0xf2, 0x05, 0x46, 0xdc, 0x2f, 0x9d, | ||
729 | 0x5e, 0x6e, 0x4c, 0xfb, 0xb5, 0x99, 0x2a, 0x59, | ||
730 | 0x63, 0xc1, 0x34, 0xbc, 0x57, 0xc0, 0x0d, 0xb9, | ||
731 | 0x61, 0x25, 0xf3, 0x33, 0x23, 0x51, 0xb6, 0x0d, | ||
732 | 0x07, 0xa6, 0xab, 0x94, 0x4a, 0xb7, 0x2a, 0xea, | ||
733 | 0xee, 0xac, 0xa3, 0xc3, 0x04, 0x8b, 0x0e, 0x56, | ||
734 | 0xfe, 0x44, 0xa7, 0x39, 0xe2, 0xed, 0xed, 0xb4, | ||
735 | 0x22, 0x2b, 0xac, 0x12, 0x32, 0x28, 0x91, 0xd8, | ||
736 | 0xa5, 0xab, 0xff, 0x5f, 0xe0, 0x4b, 0xda, 0x78, | ||
737 | 0x17, 0xda, 0xf1, 0x01, 0x5b, 0xcd, 0xe2, 0x5f, | ||
738 | 0x50, 0x45, 0x73, 0x2b, 0xe4, 0x76, 0x77, 0xf4, | ||
739 | 0x64, 0x1d, 0x43, 0xfb, 0x84, 0x7a, 0xea, 0x91, | ||
740 | 0xae, 0xf9, 0x9e, 0xb7, 0xb4, 0xb0, 0x91, 0x5f, | ||
741 | 0x16, 0x35, 0x9a, 0x11, 0xb8, 0xc7, 0xc1, 0x8c, | ||
742 | 0xc6, 0x10, 0x8d, 0x2f, 0x63, 0x4a, 0xa7, 0x57, | ||
743 | 0x3a, 0x51, 0xd6, 0x32, 0x2d, 0x64, 0x72, 0xd4, | ||
744 | 0x66, 0xdc, 0x10, 0xa6, 0x67, 0xd6, 0x04, 0x23, | ||
745 | 0x9d, 0x0a, 0x11, 0x77, 0xdd, 0x37, 0x94, 0x17, | ||
746 | 0x3c, 0xbf, 0x8b, 0x65, 0xb0, 0x2e, 0x5e, 0x66, | ||
747 | 0x47, 0x64, 0xac, 0xdd, 0xf0, 0x84, 0xfd, 0x39, | ||
748 | 0xfa, 0x15, 0x5d, 0xef, 0xae, 0xca, 0xc1, 0x36, | ||
749 | 0xa7, 0x5c, 0xbf, 0xc7, 0x08, 0xc2, 0x66, 0x00, | ||
750 | 0x74, 0x74, 0x4e, 0x27, 0x3f, 0x55, 0x8a, 0xb7, | ||
751 | 0x38, 0x66, 0x83, 0x6d, 0xcf, 0x99, 0x9e, 0x60, | ||
752 | 0x8f, 0xdd, 0x2e, 0x62, 0x22, 0x0e, 0xef, 0x0c, | ||
753 | 0x98, 0xa7, 0x85, 0x74, 0x3b, 0x9d, 0xec, 0x9e, | ||
754 | 0xa9, 0x19, 0x72, 0xa5, 0x7f, 0x2c, 0x39, 0xb7, | ||
755 | 0x7d, 0xb7, 0xf1, 0x12, 0x65, 0x27, 0x4b, 0x5a, | ||
756 | 0xde, 0x17, 0xfe, 0xad, 0x44, 0xf3, 0x20, 0x4d, | ||
757 | 0xfd, 0xe4, 0x1f, 0xb5, 0x81, 0xb0, 0x36, 0x37, | ||
758 | 0x08, 0x6f, 0xc3, 0x0c, 0xe9, 0x85, 0x98, 0x82, | ||
759 | 0xa9, 0x62, 0x0c, 0xc4, 0x97, 0xc0, 0x50, 0xc8, | ||
760 | 0xa7, 0x3c, 0x50, 0x9f, 0x43, 0xb9, 0xcd, 0x5e, | ||
761 | 0x4d, 0xfa, 0x1c, 0x4b, 0x0b, 0xa9, 0x98, 0x85, | ||
762 | 0x38, 0x92, 0xac, 0x8d, 0xe4, 0xad, 0x9b, 0x98, | ||
763 | 0xab, 0xd9, 0x38, 0xac, 0x62, 0x52, 0xa3, 0x22, | ||
764 | 0x63, 0x0f, 0xbf, 0x95, 0x48, 0xdf, 0x69, 0xe7, | ||
765 | 0x8b, 0x33, 0xd5, 0xb2, 0xbd, 0x05, 0x49, 0x49, | ||
766 | 0x9d, 0x57, 0x73, 0x19, 0x33, 0xae, 0xfa, 0x33, | ||
767 | 0xf1, 0x19, 0xa8, 0x80, 0xce, 0x04, 0x9f, 0xbc, | ||
768 | 0x1d, 0x65, 0x82, 0x1b, 0xe5, 0x3a, 0x51, 0xc8, | ||
769 | 0x1c, 0x21, 0xe3, 0x5d, 0xf3, 0x7d, 0x9b, 0x2f, | ||
770 | 0x2c, 0x1d, 0x4a, 0x7f, 0x9b, 0x68, 0x35, 0xa3, | ||
771 | 0xb2, 0x50, 0xf7, 0x62, 0x79, 0xcd, 0xf4, 0x98, | ||
772 | 0x4f, 0xe5, 0x63, 0x7c, 0x3e, 0x45, 0x31, 0x8c, | ||
773 | 0x16, 0xa0, 0x12, 0xc8, 0x58, 0xce, 0x39, 0xa6, | ||
774 | 0xbc, 0x54, 0xdb, 0xc5, 0xe0, 0xd5, 0xba, 0xbc, | ||
775 | 0xb9, 0x04, 0xf4, 0x8d, 0xe8, 0x2f, 0x15, 0x9d, | ||
776 | }; | ||
343 | 777 | ||
344 | #if 0 /*Not used at present */ | 778 | /* 100 test cases */ |
345 | static void | 779 | static struct crc_test { |
346 | buf_dump(char const *prefix, unsigned char const *buf, size_t len) | 780 | u32 crc; /* random starting crc */ |
781 | u32 start; /* random 6 bit offset in buf */ | ||
782 | u32 length; /* random 11 bit length of test */ | ||
783 | u32 crc_le; /* expected crc32_le result */ | ||
784 | u32 crc_be; /* expected crc32_be result */ | ||
785 | u32 crc32c_le; /* expected crc32c_le result */ | ||
786 | } test[] = | ||
347 | { | 787 | { |
348 | fputs(prefix, stdout); | 788 | {0x674bf11d, 0x00000038, 0x00000542, 0x0af6d466, 0xd8b6e4c1, |
349 | while (len--) | 789 | 0xf6e93d6c}, |
350 | printf(" %02x", *buf++); | 790 | {0x35c672c6, 0x0000003a, 0x000001aa, 0xc6d3dfba, 0x28aaf3ad, |
351 | putchar('\n'); | 791 | 0x0fe92aca}, |
792 | {0x496da28e, 0x00000039, 0x000005af, 0xd933660f, 0x5d57e81f, | ||
793 | 0x52e1ebb8}, | ||
794 | {0x09a9b90e, 0x00000027, 0x000001f8, 0xb45fe007, 0xf45fca9a, | ||
795 | 0x0798af9a}, | ||
796 | {0xdc97e5a9, 0x00000025, 0x000003b6, 0xf81a3562, 0xe0126ba2, | ||
797 | 0x18eb3152}, | ||
798 | {0x47c58900, 0x0000000a, 0x000000b9, 0x8e58eccf, 0xf3afc793, | ||
799 | 0xd00d08c7}, | ||
800 | {0x292561e8, 0x0000000c, 0x00000403, 0xa2ba8aaf, 0x0b797aed, | ||
801 | 0x8ba966bc}, | ||
802 | {0x415037f6, 0x00000003, 0x00000676, 0xa17d52e8, 0x7f0fdf35, | ||
803 | 0x11d694a2}, | ||
804 | {0x3466e707, 0x00000026, 0x00000042, 0x258319be, 0x75c484a2, | ||
805 | 0x6ab3208d}, | ||
806 | {0xafd1281b, 0x00000023, 0x000002ee, 0x4428eaf8, 0x06c7ad10, | ||
807 | 0xba4603c5}, | ||
808 | {0xd3857b18, 0x00000028, 0x000004a2, 0x5c430821, 0xb062b7cb, | ||
809 | 0xe6071c6f}, | ||
810 | {0x1d825a8f, 0x0000002b, 0x0000050b, 0xd2c45f0c, 0xd68634e0, | ||
811 | 0x179ec30a}, | ||
812 | {0x5033e3bc, 0x0000000b, 0x00000078, 0xa3ea4113, 0xac6d31fb, | ||
813 | 0x0903beb8}, | ||
814 | {0x94f1fb5e, 0x0000000f, 0x000003a2, 0xfbfc50b1, 0x3cfe50ed, | ||
815 | 0x6a7cb4fa}, | ||
816 | {0xc9a0fe14, 0x00000009, 0x00000473, 0x5fb61894, 0x87070591, | ||
817 | 0xdb535801}, | ||
818 | {0x88a034b1, 0x0000001c, 0x000005ad, 0xc1b16053, 0x46f95c67, | ||
819 | 0x92bed597}, | ||
820 | {0xf0f72239, 0x00000020, 0x0000026d, 0xa6fa58f3, 0xf8c2c1dd, | ||
821 | 0x192a3f1b}, | ||
822 | {0xcc20a5e3, 0x0000003b, 0x0000067a, 0x7740185a, 0x308b979a, | ||
823 | 0xccbaec1a}, | ||
824 | {0xce589c95, 0x0000002b, 0x00000641, 0xd055e987, 0x40aae25b, | ||
825 | 0x7eabae4d}, | ||
826 | {0x78edc885, 0x00000035, 0x000005be, 0xa39cb14b, 0x035b0d1f, | ||
827 | 0x28c72982}, | ||
828 | {0x9d40a377, 0x0000003b, 0x00000038, 0x1f47ccd2, 0x197fbc9d, | ||
829 | 0xc3cd4d18}, | ||
830 | {0x703d0e01, 0x0000003c, 0x000006f1, 0x88735e7c, 0xfed57c5a, | ||
831 | 0xbca8f0e7}, | ||
832 | {0x776bf505, 0x0000000f, 0x000005b2, 0x5cc4fc01, 0xf32efb97, | ||
833 | 0x713f60b3}, | ||
834 | {0x4a3e7854, 0x00000027, 0x000004b8, 0x8d923c82, 0x0cbfb4a2, | ||
835 | 0xebd08fd5}, | ||
836 | {0x209172dd, 0x0000003b, 0x00000356, 0xb89e9c2b, 0xd7868138, | ||
837 | 0x64406c59}, | ||
838 | {0x3ba4cc5b, 0x0000002f, 0x00000203, 0xe51601a9, 0x5b2a1032, | ||
839 | 0x7421890e}, | ||
840 | {0xfc62f297, 0x00000000, 0x00000079, 0x71a8e1a2, 0x5d88685f, | ||
841 | 0xe9347603}, | ||
842 | {0x64280b8b, 0x00000016, 0x000007ab, 0x0fa7a30c, 0xda3a455f, | ||
843 | 0x1bef9060}, | ||
844 | {0x97dd724b, 0x00000033, 0x000007ad, 0x5788b2f4, 0xd7326d32, | ||
845 | 0x34720072}, | ||
846 | {0x61394b52, 0x00000035, 0x00000571, 0xc66525f1, 0xcabe7fef, | ||
847 | 0x48310f59}, | ||
848 | {0x29b4faff, 0x00000024, 0x0000006e, 0xca13751e, 0x993648e0, | ||
849 | 0x783a4213}, | ||
850 | {0x29bfb1dc, 0x0000000b, 0x00000244, 0x436c43f7, 0x429f7a59, | ||
851 | 0x9e8efd41}, | ||
852 | {0x86ae934b, 0x00000035, 0x00000104, 0x0760ec93, 0x9cf7d0f4, | ||
853 | 0xfc3d34a5}, | ||
854 | {0xc4c1024e, 0x0000002e, 0x000006b1, 0x6516a3ec, 0x19321f9c, | ||
855 | 0x17a52ae2}, | ||
856 | {0x3287a80a, 0x00000026, 0x00000496, 0x0b257eb1, 0x754ebd51, | ||
857 | 0x886d935a}, | ||
858 | {0xa4db423e, 0x00000023, 0x0000045d, 0x9b3a66dc, 0x873e9f11, | ||
859 | 0xeaaeaeb2}, | ||
860 | {0x7a1078df, 0x00000015, 0x0000014a, 0x8c2484c5, 0x6a628659, | ||
861 | 0x8e900a4b}, | ||
862 | {0x6048bd5b, 0x00000006, 0x0000006a, 0x897e3559, 0xac9961af, | ||
863 | 0xd74662b1}, | ||
864 | {0xd8f9ea20, 0x0000003d, 0x00000277, 0x60eb905b, 0xed2aaf99, | ||
865 | 0xd26752ba}, | ||
866 | {0xea5ec3b4, 0x0000002a, 0x000004fe, 0x869965dc, 0x6c1f833b, | ||
867 | 0x8b1fcd62}, | ||
868 | {0x2dfb005d, 0x00000016, 0x00000345, 0x6a3b117e, 0xf05e8521, | ||
869 | 0xf54342fe}, | ||
870 | {0x5a214ade, 0x00000020, 0x000005b6, 0x467f70be, 0xcb22ccd3, | ||
871 | 0x5b95b988}, | ||
872 | {0xf0ab9cca, 0x00000032, 0x00000515, 0xed223df3, 0x7f3ef01d, | ||
873 | 0x2e1176be}, | ||
874 | {0x91b444f9, 0x0000002e, 0x000007f8, 0x84e9a983, 0x5676756f, | ||
875 | 0x66120546}, | ||
876 | {0x1b5d2ddb, 0x0000002e, 0x0000012c, 0xba638c4c, 0x3f42047b, | ||
877 | 0xf256a5cc}, | ||
878 | {0xd824d1bb, 0x0000003a, 0x000007b5, 0x6288653b, 0x3a3ebea0, | ||
879 | 0x4af1dd69}, | ||
880 | {0x0470180c, 0x00000034, 0x000001f0, 0x9d5b80d6, 0x3de08195, | ||
881 | 0x56f0a04a}, | ||
882 | {0xffaa3a3f, 0x00000036, 0x00000299, 0xf3a82ab8, 0x53e0c13d, | ||
883 | 0x74f6b6b2}, | ||
884 | {0x6406cfeb, 0x00000023, 0x00000600, 0xa920b8e8, 0xe4e2acf4, | ||
885 | 0x085951fd}, | ||
886 | {0xb24aaa38, 0x0000003e, 0x000004a1, 0x657cc328, 0x5077b2c3, | ||
887 | 0xc65387eb}, | ||
888 | {0x58b2ab7c, 0x00000039, 0x000002b4, 0x3a17ee7e, 0x9dcb3643, | ||
889 | 0x1ca9257b}, | ||
890 | {0x3db85970, 0x00000006, 0x000002b6, 0x95268b59, 0xb9812c10, | ||
891 | 0xfd196d76}, | ||
892 | {0x857830c5, 0x00000003, 0x00000590, 0x4ef439d5, 0xf042161d, | ||
893 | 0x5ef88339}, | ||
894 | {0xe1fcd978, 0x0000003e, 0x000007d8, 0xae8d8699, 0xce0a1ef5, | ||
895 | 0x2c3714d9}, | ||
896 | {0xb982a768, 0x00000016, 0x000006e0, 0x62fad3df, 0x5f8a067b, | ||
897 | 0x58576548}, | ||
898 | {0x1d581ce8, 0x0000001e, 0x0000058b, 0xf0f5da53, 0x26e39eee, | ||
899 | 0xfd7c57de}, | ||
900 | {0x2456719b, 0x00000025, 0x00000503, 0x4296ac64, 0xd50e4c14, | ||
901 | 0xd5fedd59}, | ||
902 | {0xfae6d8f2, 0x00000000, 0x0000055d, 0x057fdf2e, 0x2a31391a, | ||
903 | 0x1cc3b17b}, | ||
904 | {0xcba828e3, 0x00000039, 0x000002ce, 0xe3f22351, 0x8f00877b, | ||
905 | 0x270eed73}, | ||
906 | {0x13d25952, 0x0000000a, 0x0000072d, 0x76d4b4cc, 0x5eb67ec3, | ||
907 | 0x91ecbb11}, | ||
908 | {0x0342be3f, 0x00000015, 0x00000599, 0xec75d9f1, 0x9d4d2826, | ||
909 | 0x05ed8d0c}, | ||
910 | {0xeaa344e0, 0x00000014, 0x000004d8, 0x72a4c981, 0x2064ea06, | ||
911 | 0x0b09ad5b}, | ||
912 | {0xbbb52021, 0x0000003b, 0x00000272, 0x04af99fc, 0xaf042d35, | ||
913 | 0xf8d511fb}, | ||
914 | {0xb66384dc, 0x0000001d, 0x000007fc, 0xd7629116, 0x782bd801, | ||
915 | 0x5ad832cc}, | ||
916 | {0x616c01b6, 0x00000022, 0x000002c8, 0x5b1dab30, 0x783ce7d2, | ||
917 | 0x1214d196}, | ||
918 | {0xce2bdaad, 0x00000016, 0x0000062a, 0x932535c8, 0x3f02926d, | ||
919 | 0x5747218a}, | ||
920 | {0x00fe84d7, 0x00000005, 0x00000205, 0x850e50aa, 0x753d649c, | ||
921 | 0xde8f14de}, | ||
922 | {0xbebdcb4c, 0x00000006, 0x0000055d, 0xbeaa37a2, 0x2d8c9eba, | ||
923 | 0x3563b7b9}, | ||
924 | {0xd8b1a02a, 0x00000010, 0x00000387, 0x5017d2fc, 0x503541a5, | ||
925 | 0x071475d0}, | ||
926 | {0x3b96cad2, 0x00000036, 0x00000347, 0x1d2372ae, 0x926cd90b, | ||
927 | 0x54c79d60}, | ||
928 | {0xc94c1ed7, 0x00000005, 0x0000038b, 0x9e9fdb22, 0x144a9178, | ||
929 | 0x4c53eee6}, | ||
930 | {0x1aad454e, 0x00000025, 0x000002b2, 0xc3f6315c, 0x5c7a35b3, | ||
931 | 0x10137a3c}, | ||
932 | {0xa4fec9a6, 0x00000000, 0x000006d6, 0x90be5080, 0xa4107605, | ||
933 | 0xaa9d6c73}, | ||
934 | {0x1bbe71e2, 0x0000001f, 0x000002fd, 0x4e504c3b, 0x284ccaf1, | ||
935 | 0xb63d23e7}, | ||
936 | {0x4201c7e4, 0x00000002, 0x000002b7, 0x7822e3f9, 0x0cc912a9, | ||
937 | 0x7f53e9cf}, | ||
938 | {0x23fddc96, 0x00000003, 0x00000627, 0x8a385125, 0x07767e78, | ||
939 | 0x13c1cd83}, | ||
940 | {0xd82ba25c, 0x00000016, 0x0000063e, 0x98e4148a, 0x283330c9, | ||
941 | 0x49ff5867}, | ||
942 | {0x786f2032, 0x0000002d, 0x0000060f, 0xf201600a, 0xf561bfcd, | ||
943 | 0x8467f211}, | ||
944 | {0xfebe4e1f, 0x0000002a, 0x000004f2, 0x95e51961, 0xfd80dcab, | ||
945 | 0x3f9683b2}, | ||
946 | {0x1a6e0a39, 0x00000008, 0x00000672, 0x8af6c2a5, 0x78dd84cb, | ||
947 | 0x76a3f874}, | ||
948 | {0x56000ab8, 0x0000000e, 0x000000e5, 0x36bacb8f, 0x22ee1f77, | ||
949 | 0x863b702f}, | ||
950 | {0x4717fe0c, 0x00000000, 0x000006ec, 0x8439f342, 0x5c8e03da, | ||
951 | 0xdc6c58ff}, | ||
952 | {0xd5d5d68e, 0x0000003c, 0x000003a3, 0x46fff083, 0x177d1b39, | ||
953 | 0x0622cc95}, | ||
954 | {0xc25dd6c6, 0x00000024, 0x000006c0, 0x5ceb8eb4, 0x892b0d16, | ||
955 | 0xe85605cd}, | ||
956 | {0xe9b11300, 0x00000023, 0x00000683, 0x07a5d59a, 0x6c6a3208, | ||
957 | 0x31da5f06}, | ||
958 | {0x95cd285e, 0x00000001, 0x00000047, 0x7b3a4368, 0x0202c07e, | ||
959 | 0xa1f2e784}, | ||
960 | {0xd9245a25, 0x0000001e, 0x000003a6, 0xd33c1841, 0x1936c0d5, | ||
961 | 0xb07cc616}, | ||
962 | {0x103279db, 0x00000006, 0x0000039b, 0xca09b8a0, 0x77d62892, | ||
963 | 0xbf943b6c}, | ||
964 | {0x1cba3172, 0x00000027, 0x000001c8, 0xcb377194, 0xebe682db, | ||
965 | 0x2c01af1c}, | ||
966 | {0x8f613739, 0x0000000c, 0x000001df, 0xb4b0bc87, 0x7710bd43, | ||
967 | 0x0fe5f56d}, | ||
968 | {0x1c6aa90d, 0x0000001b, 0x0000053c, 0x70559245, 0xda7894ac, | ||
969 | 0xf8943b2d}, | ||
970 | {0xaabe5b93, 0x0000003d, 0x00000715, 0xcdbf42fa, 0x0c3b99e7, | ||
971 | 0xe4d89272}, | ||
972 | {0xf15dd038, 0x00000006, 0x000006db, 0x6e104aea, 0x8d5967f2, | ||
973 | 0x7c2f6bbb}, | ||
974 | {0x584dd49c, 0x00000020, 0x000007bc, 0x36b6cfd6, 0xad4e23b2, | ||
975 | 0xabbf388b}, | ||
976 | {0x5d8c9506, 0x00000020, 0x00000470, 0x4c62378e, 0x31d92640, | ||
977 | 0x1dca1f4e}, | ||
978 | {0xb80d17b0, 0x00000032, 0x00000346, 0x22a5bb88, 0x9a7ec89f, | ||
979 | 0x5c170e23}, | ||
980 | {0xdaf0592e, 0x00000023, 0x000007b0, 0x3cab3f99, 0x9b1fdd99, | ||
981 | 0xc0e9d672}, | ||
982 | {0x4793cc85, 0x0000000d, 0x00000706, 0xe82e04f6, 0xed3db6b7, | ||
983 | 0xc18bdc86}, | ||
984 | {0x82ebf64e, 0x00000009, 0x000007c3, 0x69d590a9, 0x9efa8499, | ||
985 | 0xa874fcdd}, | ||
986 | {0xb18a0319, 0x00000026, 0x000007db, 0x1cf98dcc, 0x8fa9ad6a, | ||
987 | 0x9dc0bb48}, | ||
988 | }; | ||
352 | 989 | ||
353 | } | 990 | #include <linux/time.h> |
354 | #endif | ||
355 | 991 | ||
356 | static void bytereverse(unsigned char *buf, size_t len) | 992 | static int __init crc32c_test(void) |
357 | { | 993 | { |
358 | while (len--) { | 994 | int i; |
359 | unsigned char x = bitrev8(*buf); | 995 | int errors = 0; |
360 | *buf++ = x; | 996 | int bytes = 0; |
997 | struct timespec start, stop; | ||
998 | u64 nsec; | ||
999 | unsigned long flags; | ||
1000 | |||
1001 | /* keep static to prevent cache warming code from | ||
1002 | * getting eliminated by the compiler */ | ||
1003 | static u32 crc; | ||
1004 | |||
1005 | /* pre-warm the cache */ | ||
1006 | for (i = 0; i < 100; i++) { | ||
1007 | bytes += 2*test[i].length; | ||
1008 | |||
1009 | crc ^= __crc32c_le(test[i].crc, test_buf + | ||
1010 | test[i].start, test[i].length); | ||
361 | } | 1011 | } |
362 | } | ||
363 | 1012 | ||
364 | static void random_garbage(unsigned char *buf, size_t len) | 1013 | /* reduce OS noise */ |
365 | { | 1014 | local_irq_save(flags); |
366 | while (len--) | 1015 | local_irq_disable(); |
367 | *buf++ = (unsigned char) random(); | ||
368 | } | ||
369 | 1016 | ||
370 | #if 0 /* Not used at present */ | 1017 | getnstimeofday(&start); |
371 | static void store_le(u32 x, unsigned char *buf) | 1018 | for (i = 0; i < 100; i++) { |
372 | { | 1019 | if (test[i].crc32c_le != __crc32c_le(test[i].crc, test_buf + |
373 | buf[0] = (unsigned char) x; | 1020 | test[i].start, test[i].length)) |
374 | buf[1] = (unsigned char) (x >> 8); | 1021 | errors++; |
375 | buf[2] = (unsigned char) (x >> 16); | 1022 | } |
376 | buf[3] = (unsigned char) (x >> 24); | 1023 | getnstimeofday(&stop); |
377 | } | ||
378 | #endif | ||
379 | 1024 | ||
380 | static void store_be(u32 x, unsigned char *buf) | 1025 | local_irq_restore(flags); |
381 | { | 1026 | local_irq_enable(); |
382 | buf[0] = (unsigned char) (x >> 24); | 1027 | |
383 | buf[1] = (unsigned char) (x >> 16); | 1028 | nsec = stop.tv_nsec - start.tv_nsec + |
384 | buf[2] = (unsigned char) (x >> 8); | 1029 | 1000000000 * (stop.tv_sec - start.tv_sec); |
385 | buf[3] = (unsigned char) x; | 1030 | |
1031 | pr_info("crc32c: CRC_LE_BITS = %d\n", CRC_LE_BITS); | ||
1032 | |||
1033 | if (errors) | ||
1034 | pr_warn("crc32c: %d self tests failed\n", errors); | ||
1035 | else { | ||
1036 | pr_info("crc32c: self tests passed, processed %d bytes in %lld nsec\n", | ||
1037 | bytes, nsec); | ||
1038 | } | ||
1039 | |||
1040 | return 0; | ||
386 | } | 1041 | } |
387 | 1042 | ||
388 | /* | 1043 | static int __init crc32_test(void) |
389 | * This checks that CRC(buf + CRC(buf)) = 0, and that | ||
390 | * CRC commutes with bit-reversal. This has the side effect | ||
391 | * of bytewise bit-reversing the input buffer, and returns | ||
392 | * the CRC of the reversed buffer. | ||
393 | */ | ||
394 | static u32 test_step(u32 init, unsigned char *buf, size_t len) | ||
395 | { | 1044 | { |
396 | u32 crc1, crc2; | 1045 | int i; |
397 | size_t i; | 1046 | int errors = 0; |
1047 | int bytes = 0; | ||
1048 | struct timespec start, stop; | ||
1049 | u64 nsec; | ||
1050 | unsigned long flags; | ||
1051 | |||
1052 | /* keep static to prevent cache warming code from | ||
1053 | * getting eliminated by the compiler */ | ||
1054 | static u32 crc; | ||
1055 | |||
1056 | /* pre-warm the cache */ | ||
1057 | for (i = 0; i < 100; i++) { | ||
1058 | bytes += 2*test[i].length; | ||
398 | 1059 | ||
399 | crc1 = crc32_be(init, buf, len); | 1060 | crc ^= crc32_le(test[i].crc, test_buf + |
400 | store_be(crc1, buf + len); | 1061 | test[i].start, test[i].length); |
401 | crc2 = crc32_be(init, buf, len + 4); | 1062 | |
402 | if (crc2) | 1063 | crc ^= crc32_be(test[i].crc, test_buf + |
403 | printf("\nCRC cancellation fail: 0x%08x should be 0\n", | 1064 | test[i].start, test[i].length); |
404 | crc2); | ||
405 | |||
406 | for (i = 0; i <= len + 4; i++) { | ||
407 | crc2 = crc32_be(init, buf, i); | ||
408 | crc2 = crc32_be(crc2, buf + i, len + 4 - i); | ||
409 | if (crc2) | ||
410 | printf("\nCRC split fail: 0x%08x\n", crc2); | ||
411 | } | 1065 | } |
412 | 1066 | ||
413 | /* Now swap it around for the other test */ | 1067 | /* reduce OS noise */ |
414 | 1068 | local_irq_save(flags); | |
415 | bytereverse(buf, len + 4); | 1069 | local_irq_disable(); |
416 | init = bitrev32(init); | 1070 | |
417 | crc2 = bitrev32(crc1); | 1071 | getnstimeofday(&start); |
418 | if (crc1 != bitrev32(crc2)) | 1072 | for (i = 0; i < 100; i++) { |
419 | printf("\nBit reversal fail: 0x%08x -> 0x%08x -> 0x%08x\n", | 1073 | if (test[i].crc_le != crc32_le(test[i].crc, test_buf + |
420 | crc1, crc2, bitrev32(crc2)); | 1074 | test[i].start, test[i].length)) |
421 | crc1 = crc32_le(init, buf, len); | 1075 | errors++; |
422 | if (crc1 != crc2) | 1076 | |
423 | printf("\nCRC endianness fail: 0x%08x != 0x%08x\n", crc1, | 1077 | if (test[i].crc_be != crc32_be(test[i].crc, test_buf + |
424 | crc2); | 1078 | test[i].start, test[i].length)) |
425 | crc2 = crc32_le(init, buf, len + 4); | 1079 | errors++; |
426 | if (crc2) | ||
427 | printf("\nCRC cancellation fail: 0x%08x should be 0\n", | ||
428 | crc2); | ||
429 | |||
430 | for (i = 0; i <= len + 4; i++) { | ||
431 | crc2 = crc32_le(init, buf, i); | ||
432 | crc2 = crc32_le(crc2, buf + i, len + 4 - i); | ||
433 | if (crc2) | ||
434 | printf("\nCRC split fail: 0x%08x\n", crc2); | ||
435 | } | 1080 | } |
1081 | getnstimeofday(&stop); | ||
436 | 1082 | ||
437 | return crc1; | 1083 | local_irq_restore(flags); |
438 | } | 1084 | local_irq_enable(); |
439 | 1085 | ||
440 | #define SIZE 64 | 1086 | nsec = stop.tv_nsec - start.tv_nsec + |
441 | #define INIT1 0 | 1087 | 1000000000 * (stop.tv_sec - start.tv_sec); |
442 | #define INIT2 0 | ||
443 | 1088 | ||
444 | int main(void) | 1089 | pr_info("crc32: CRC_LE_BITS = %d, CRC_BE BITS = %d\n", |
445 | { | 1090 | CRC_LE_BITS, CRC_BE_BITS); |
446 | unsigned char buf1[SIZE + 4]; | 1091 | |
447 | unsigned char buf2[SIZE + 4]; | 1092 | if (errors) |
448 | unsigned char buf3[SIZE + 4]; | 1093 | pr_warn("crc32: %d self tests failed\n", errors); |
449 | int i, j; | 1094 | else { |
450 | u32 crc1, crc2, crc3; | 1095 | pr_info("crc32: self tests passed, processed %d bytes in %lld nsec\n", |
451 | 1096 | bytes, nsec); | |
452 | for (i = 0; i <= SIZE; i++) { | ||
453 | printf("\rTesting length %d...", i); | ||
454 | fflush(stdout); | ||
455 | random_garbage(buf1, i); | ||
456 | random_garbage(buf2, i); | ||
457 | for (j = 0; j < i; j++) | ||
458 | buf3[j] = buf1[j] ^ buf2[j]; | ||
459 | |||
460 | crc1 = test_step(INIT1, buf1, i); | ||
461 | crc2 = test_step(INIT2, buf2, i); | ||
462 | /* Now check that CRC(buf1 ^ buf2) = CRC(buf1) ^ CRC(buf2) */ | ||
463 | crc3 = test_step(INIT1 ^ INIT2, buf3, i); | ||
464 | if (crc3 != (crc1 ^ crc2)) | ||
465 | printf("CRC XOR fail: 0x%08x != 0x%08x ^ 0x%08x\n", | ||
466 | crc3, crc1, crc2); | ||
467 | } | 1097 | } |
468 | printf("\nAll test complete. No failures expected.\n"); | 1098 | |
469 | return 0; | 1099 | return 0; |
470 | } | 1100 | } |
471 | 1101 | ||
472 | #endif /* UNITTEST */ | 1102 | static int __init crc32test_init(void) |
1103 | { | ||
1104 | crc32_test(); | ||
1105 | crc32c_test(); | ||
1106 | return 0; | ||
1107 | } | ||
1108 | |||
1109 | static void __exit crc32_exit(void) | ||
1110 | { | ||
1111 | } | ||
1112 | |||
1113 | module_init(crc32test_init); | ||
1114 | module_exit(crc32_exit); | ||
1115 | #endif /* CONFIG_CRC32_SELFTEST */ | ||
diff --git a/lib/crc32defs.h b/lib/crc32defs.h index 9b6773d73749..64cba2c3c700 100644 --- a/lib/crc32defs.h +++ b/lib/crc32defs.h | |||
@@ -6,27 +6,67 @@ | |||
6 | #define CRCPOLY_LE 0xedb88320 | 6 | #define CRCPOLY_LE 0xedb88320 |
7 | #define CRCPOLY_BE 0x04c11db7 | 7 | #define CRCPOLY_BE 0x04c11db7 |
8 | 8 | ||
9 | /* How many bits at a time to use. Requires a table of 4<<CRC_xx_BITS bytes. */ | 9 | /* |
10 | /* For less performance-sensitive, use 4 */ | 10 | * This is the CRC32c polynomial, as outlined by Castagnoli. |
11 | #ifndef CRC_LE_BITS | 11 | * x^32+x^28+x^27+x^26+x^25+x^23+x^22+x^20+x^19+x^18+x^14+x^13+x^11+x^10+x^9+ |
12 | * x^8+x^6+x^0 | ||
13 | */ | ||
14 | #define CRC32C_POLY_LE 0x82F63B78 | ||
15 | |||
16 | /* Try to choose an implementation variant via Kconfig */ | ||
17 | #ifdef CONFIG_CRC32_SLICEBY8 | ||
18 | # define CRC_LE_BITS 64 | ||
19 | # define CRC_BE_BITS 64 | ||
20 | #endif | ||
21 | #ifdef CONFIG_CRC32_SLICEBY4 | ||
22 | # define CRC_LE_BITS 32 | ||
23 | # define CRC_BE_BITS 32 | ||
24 | #endif | ||
25 | #ifdef CONFIG_CRC32_SARWATE | ||
12 | # define CRC_LE_BITS 8 | 26 | # define CRC_LE_BITS 8 |
27 | # define CRC_BE_BITS 8 | ||
28 | #endif | ||
29 | #ifdef CONFIG_CRC32_BIT | ||
30 | # define CRC_LE_BITS 1 | ||
31 | # define CRC_BE_BITS 1 | ||
32 | #endif | ||
33 | |||
34 | /* | ||
35 | * How many bits at a time to use. Valid values are 1, 2, 4, 8, 32 and 64. | ||
36 | * For less performance-sensitive, use 4 or 8 to save table size. | ||
37 | * For larger systems choose same as CPU architecture as default. | ||
38 | * This works well on X86_64, SPARC64 systems. This may require some | ||
39 | * elaboration after experiments with other architectures. | ||
40 | */ | ||
41 | #ifndef CRC_LE_BITS | ||
42 | # ifdef CONFIG_64BIT | ||
43 | # define CRC_LE_BITS 64 | ||
44 | # else | ||
45 | # define CRC_LE_BITS 32 | ||
46 | # endif | ||
13 | #endif | 47 | #endif |
14 | #ifndef CRC_BE_BITS | 48 | #ifndef CRC_BE_BITS |
15 | # define CRC_BE_BITS 8 | 49 | # ifdef CONFIG_64BIT |
50 | # define CRC_BE_BITS 64 | ||
51 | # else | ||
52 | # define CRC_BE_BITS 32 | ||
53 | # endif | ||
16 | #endif | 54 | #endif |
17 | 55 | ||
18 | /* | 56 | /* |
19 | * Little-endian CRC computation. Used with serial bit streams sent | 57 | * Little-endian CRC computation. Used with serial bit streams sent |
20 | * lsbit-first. Be sure to use cpu_to_le32() to append the computed CRC. | 58 | * lsbit-first. Be sure to use cpu_to_le32() to append the computed CRC. |
21 | */ | 59 | */ |
22 | #if CRC_LE_BITS > 8 || CRC_LE_BITS < 1 || CRC_LE_BITS & CRC_LE_BITS-1 | 60 | #if CRC_LE_BITS > 64 || CRC_LE_BITS < 1 || CRC_LE_BITS == 16 || \ |
23 | # error CRC_LE_BITS must be a power of 2 between 1 and 8 | 61 | CRC_LE_BITS & CRC_LE_BITS-1 |
62 | # error "CRC_LE_BITS must be one of {1, 2, 4, 8, 32, 64}" | ||
24 | #endif | 63 | #endif |
25 | 64 | ||
26 | /* | 65 | /* |
27 | * Big-endian CRC computation. Used with serial bit streams sent | 66 | * Big-endian CRC computation. Used with serial bit streams sent |
28 | * msbit-first. Be sure to use cpu_to_be32() to append the computed CRC. | 67 | * msbit-first. Be sure to use cpu_to_be32() to append the computed CRC. |
29 | */ | 68 | */ |
30 | #if CRC_BE_BITS > 8 || CRC_BE_BITS < 1 || CRC_BE_BITS & CRC_BE_BITS-1 | 69 | #if CRC_BE_BITS > 64 || CRC_BE_BITS < 1 || CRC_BE_BITS == 16 || \ |
31 | # error CRC_BE_BITS must be a power of 2 between 1 and 8 | 70 | CRC_BE_BITS & CRC_BE_BITS-1 |
71 | # error "CRC_BE_BITS must be one of {1, 2, 4, 8, 32, 64}" | ||
32 | #endif | 72 | #endif |
diff --git a/lib/gen_crc32table.c b/lib/gen_crc32table.c index 85d0e412a04f..8f8d5439e2d9 100644 --- a/lib/gen_crc32table.c +++ b/lib/gen_crc32table.c | |||
@@ -1,14 +1,29 @@ | |||
1 | #include <stdio.h> | 1 | #include <stdio.h> |
2 | #include "../include/generated/autoconf.h" | ||
2 | #include "crc32defs.h" | 3 | #include "crc32defs.h" |
3 | #include <inttypes.h> | 4 | #include <inttypes.h> |
4 | 5 | ||
5 | #define ENTRIES_PER_LINE 4 | 6 | #define ENTRIES_PER_LINE 4 |
6 | 7 | ||
7 | #define LE_TABLE_SIZE (1 << CRC_LE_BITS) | 8 | #if CRC_LE_BITS > 8 |
8 | #define BE_TABLE_SIZE (1 << CRC_BE_BITS) | 9 | # define LE_TABLE_ROWS (CRC_LE_BITS/8) |
10 | # define LE_TABLE_SIZE 256 | ||
11 | #else | ||
12 | # define LE_TABLE_ROWS 1 | ||
13 | # define LE_TABLE_SIZE (1 << CRC_LE_BITS) | ||
14 | #endif | ||
9 | 15 | ||
10 | static uint32_t crc32table_le[4][LE_TABLE_SIZE]; | 16 | #if CRC_BE_BITS > 8 |
11 | static uint32_t crc32table_be[4][BE_TABLE_SIZE]; | 17 | # define BE_TABLE_ROWS (CRC_BE_BITS/8) |
18 | # define BE_TABLE_SIZE 256 | ||
19 | #else | ||
20 | # define BE_TABLE_ROWS 1 | ||
21 | # define BE_TABLE_SIZE (1 << CRC_BE_BITS) | ||
22 | #endif | ||
23 | |||
24 | static uint32_t crc32table_le[LE_TABLE_ROWS][256]; | ||
25 | static uint32_t crc32table_be[BE_TABLE_ROWS][256]; | ||
26 | static uint32_t crc32ctable_le[LE_TABLE_ROWS][256]; | ||
12 | 27 | ||
13 | /** | 28 | /** |
14 | * crc32init_le() - allocate and initialize LE table data | 29 | * crc32init_le() - allocate and initialize LE table data |
@@ -17,27 +32,38 @@ static uint32_t crc32table_be[4][BE_TABLE_SIZE]; | |||
17 | * fact that crctable[i^j] = crctable[i] ^ crctable[j]. | 32 | * fact that crctable[i^j] = crctable[i] ^ crctable[j]. |
18 | * | 33 | * |
19 | */ | 34 | */ |
20 | static void crc32init_le(void) | 35 | static void crc32init_le_generic(const uint32_t polynomial, |
36 | uint32_t (*tab)[256]) | ||
21 | { | 37 | { |
22 | unsigned i, j; | 38 | unsigned i, j; |
23 | uint32_t crc = 1; | 39 | uint32_t crc = 1; |
24 | 40 | ||
25 | crc32table_le[0][0] = 0; | 41 | tab[0][0] = 0; |
26 | 42 | ||
27 | for (i = 1 << (CRC_LE_BITS - 1); i; i >>= 1) { | 43 | for (i = LE_TABLE_SIZE >> 1; i; i >>= 1) { |
28 | crc = (crc >> 1) ^ ((crc & 1) ? CRCPOLY_LE : 0); | 44 | crc = (crc >> 1) ^ ((crc & 1) ? polynomial : 0); |
29 | for (j = 0; j < LE_TABLE_SIZE; j += 2 * i) | 45 | for (j = 0; j < LE_TABLE_SIZE; j += 2 * i) |
30 | crc32table_le[0][i + j] = crc ^ crc32table_le[0][j]; | 46 | tab[0][i + j] = crc ^ tab[0][j]; |
31 | } | 47 | } |
32 | for (i = 0; i < LE_TABLE_SIZE; i++) { | 48 | for (i = 0; i < LE_TABLE_SIZE; i++) { |
33 | crc = crc32table_le[0][i]; | 49 | crc = tab[0][i]; |
34 | for (j = 1; j < 4; j++) { | 50 | for (j = 1; j < LE_TABLE_ROWS; j++) { |
35 | crc = crc32table_le[0][crc & 0xff] ^ (crc >> 8); | 51 | crc = tab[0][crc & 0xff] ^ (crc >> 8); |
36 | crc32table_le[j][i] = crc; | 52 | tab[j][i] = crc; |
37 | } | 53 | } |
38 | } | 54 | } |
39 | } | 55 | } |
40 | 56 | ||
57 | static void crc32init_le(void) | ||
58 | { | ||
59 | crc32init_le_generic(CRCPOLY_LE, crc32table_le); | ||
60 | } | ||
61 | |||
62 | static void crc32cinit_le(void) | ||
63 | { | ||
64 | crc32init_le_generic(CRC32C_POLY_LE, crc32ctable_le); | ||
65 | } | ||
66 | |||
41 | /** | 67 | /** |
42 | * crc32init_be() - allocate and initialize BE table data | 68 | * crc32init_be() - allocate and initialize BE table data |
43 | */ | 69 | */ |
@@ -55,18 +81,18 @@ static void crc32init_be(void) | |||
55 | } | 81 | } |
56 | for (i = 0; i < BE_TABLE_SIZE; i++) { | 82 | for (i = 0; i < BE_TABLE_SIZE; i++) { |
57 | crc = crc32table_be[0][i]; | 83 | crc = crc32table_be[0][i]; |
58 | for (j = 1; j < 4; j++) { | 84 | for (j = 1; j < BE_TABLE_ROWS; j++) { |
59 | crc = crc32table_be[0][(crc >> 24) & 0xff] ^ (crc << 8); | 85 | crc = crc32table_be[0][(crc >> 24) & 0xff] ^ (crc << 8); |
60 | crc32table_be[j][i] = crc; | 86 | crc32table_be[j][i] = crc; |
61 | } | 87 | } |
62 | } | 88 | } |
63 | } | 89 | } |
64 | 90 | ||
65 | static void output_table(uint32_t table[4][256], int len, char *trans) | 91 | static void output_table(uint32_t (*table)[256], int rows, int len, char *trans) |
66 | { | 92 | { |
67 | int i, j; | 93 | int i, j; |
68 | 94 | ||
69 | for (j = 0 ; j < 4; j++) { | 95 | for (j = 0 ; j < rows; j++) { |
70 | printf("{"); | 96 | printf("{"); |
71 | for (i = 0; i < len - 1; i++) { | 97 | for (i = 0; i < len - 1; i++) { |
72 | if (i % ENTRIES_PER_LINE == 0) | 98 | if (i % ENTRIES_PER_LINE == 0) |
@@ -83,15 +109,30 @@ int main(int argc, char** argv) | |||
83 | 109 | ||
84 | if (CRC_LE_BITS > 1) { | 110 | if (CRC_LE_BITS > 1) { |
85 | crc32init_le(); | 111 | crc32init_le(); |
86 | printf("static const u32 crc32table_le[4][256] = {"); | 112 | printf("static const u32 __cacheline_aligned " |
87 | output_table(crc32table_le, LE_TABLE_SIZE, "tole"); | 113 | "crc32table_le[%d][%d] = {", |
114 | LE_TABLE_ROWS, LE_TABLE_SIZE); | ||
115 | output_table(crc32table_le, LE_TABLE_ROWS, | ||
116 | LE_TABLE_SIZE, "tole"); | ||
88 | printf("};\n"); | 117 | printf("};\n"); |
89 | } | 118 | } |
90 | 119 | ||
91 | if (CRC_BE_BITS > 1) { | 120 | if (CRC_BE_BITS > 1) { |
92 | crc32init_be(); | 121 | crc32init_be(); |
93 | printf("static const u32 crc32table_be[4][256] = {"); | 122 | printf("static const u32 __cacheline_aligned " |
94 | output_table(crc32table_be, BE_TABLE_SIZE, "tobe"); | 123 | "crc32table_be[%d][%d] = {", |
124 | BE_TABLE_ROWS, BE_TABLE_SIZE); | ||
125 | output_table(crc32table_be, LE_TABLE_ROWS, | ||
126 | BE_TABLE_SIZE, "tobe"); | ||
127 | printf("};\n"); | ||
128 | } | ||
129 | if (CRC_LE_BITS > 1) { | ||
130 | crc32cinit_le(); | ||
131 | printf("static const u32 __cacheline_aligned " | ||
132 | "crc32ctable_le[%d][%d] = {", | ||
133 | LE_TABLE_ROWS, LE_TABLE_SIZE); | ||
134 | output_table(crc32ctable_le, LE_TABLE_ROWS, | ||
135 | LE_TABLE_SIZE, "tole"); | ||
95 | printf("};\n"); | 136 | printf("};\n"); |
96 | } | 137 | } |
97 | 138 | ||
diff --git a/lib/prio_tree.c b/lib/prio_tree.c index ccfd850b0dec..8d443af03b4c 100644 --- a/lib/prio_tree.c +++ b/lib/prio_tree.c | |||
@@ -85,6 +85,17 @@ static inline unsigned long prio_tree_maxindex(unsigned int bits) | |||
85 | return index_bits_to_maxindex[bits - 1]; | 85 | return index_bits_to_maxindex[bits - 1]; |
86 | } | 86 | } |
87 | 87 | ||
88 | static void prio_set_parent(struct prio_tree_node *parent, | ||
89 | struct prio_tree_node *child, bool left) | ||
90 | { | ||
91 | if (left) | ||
92 | parent->left = child; | ||
93 | else | ||
94 | parent->right = child; | ||
95 | |||
96 | child->parent = parent; | ||
97 | } | ||
98 | |||
88 | /* | 99 | /* |
89 | * Extend a priority search tree so that it can store a node with heap_index | 100 | * Extend a priority search tree so that it can store a node with heap_index |
90 | * max_heap_index. In the worst case, this algorithm takes O((log n)^2). | 101 | * max_heap_index. In the worst case, this algorithm takes O((log n)^2). |
@@ -94,45 +105,32 @@ static inline unsigned long prio_tree_maxindex(unsigned int bits) | |||
94 | static struct prio_tree_node *prio_tree_expand(struct prio_tree_root *root, | 105 | static struct prio_tree_node *prio_tree_expand(struct prio_tree_root *root, |
95 | struct prio_tree_node *node, unsigned long max_heap_index) | 106 | struct prio_tree_node *node, unsigned long max_heap_index) |
96 | { | 107 | { |
97 | struct prio_tree_node *first = NULL, *prev, *last = NULL; | 108 | struct prio_tree_node *prev; |
98 | 109 | ||
99 | if (max_heap_index > prio_tree_maxindex(root->index_bits)) | 110 | if (max_heap_index > prio_tree_maxindex(root->index_bits)) |
100 | root->index_bits++; | 111 | root->index_bits++; |
101 | 112 | ||
113 | prev = node; | ||
114 | INIT_PRIO_TREE_NODE(node); | ||
115 | |||
102 | while (max_heap_index > prio_tree_maxindex(root->index_bits)) { | 116 | while (max_heap_index > prio_tree_maxindex(root->index_bits)) { |
117 | struct prio_tree_node *tmp = root->prio_tree_node; | ||
118 | |||
103 | root->index_bits++; | 119 | root->index_bits++; |
104 | 120 | ||
105 | if (prio_tree_empty(root)) | 121 | if (prio_tree_empty(root)) |
106 | continue; | 122 | continue; |
107 | 123 | ||
108 | if (first == NULL) { | 124 | prio_tree_remove(root, root->prio_tree_node); |
109 | first = root->prio_tree_node; | 125 | INIT_PRIO_TREE_NODE(tmp); |
110 | prio_tree_remove(root, root->prio_tree_node); | ||
111 | INIT_PRIO_TREE_NODE(first); | ||
112 | last = first; | ||
113 | } else { | ||
114 | prev = last; | ||
115 | last = root->prio_tree_node; | ||
116 | prio_tree_remove(root, root->prio_tree_node); | ||
117 | INIT_PRIO_TREE_NODE(last); | ||
118 | prev->left = last; | ||
119 | last->parent = prev; | ||
120 | } | ||
121 | } | ||
122 | |||
123 | INIT_PRIO_TREE_NODE(node); | ||
124 | |||
125 | if (first) { | ||
126 | node->left = first; | ||
127 | first->parent = node; | ||
128 | } else | ||
129 | last = node; | ||
130 | 126 | ||
131 | if (!prio_tree_empty(root)) { | 127 | prio_set_parent(prev, tmp, true); |
132 | last->left = root->prio_tree_node; | 128 | prev = tmp; |
133 | last->left->parent = last; | ||
134 | } | 129 | } |
135 | 130 | ||
131 | if (!prio_tree_empty(root)) | ||
132 | prio_set_parent(prev, root->prio_tree_node, true); | ||
133 | |||
136 | root->prio_tree_node = node; | 134 | root->prio_tree_node = node; |
137 | return node; | 135 | return node; |
138 | } | 136 | } |
@@ -151,25 +149,15 @@ struct prio_tree_node *prio_tree_replace(struct prio_tree_root *root, | |||
151 | * We can reduce root->index_bits here. However, it is complex | 149 | * We can reduce root->index_bits here. However, it is complex |
152 | * and does not help much to improve performance (IMO). | 150 | * and does not help much to improve performance (IMO). |
153 | */ | 151 | */ |
154 | node->parent = node; | ||
155 | root->prio_tree_node = node; | 152 | root->prio_tree_node = node; |
156 | } else { | 153 | } else |
157 | node->parent = old->parent; | 154 | prio_set_parent(old->parent, node, old->parent->left == old); |
158 | if (old->parent->left == old) | ||
159 | old->parent->left = node; | ||
160 | else | ||
161 | old->parent->right = node; | ||
162 | } | ||
163 | 155 | ||
164 | if (!prio_tree_left_empty(old)) { | 156 | if (!prio_tree_left_empty(old)) |
165 | node->left = old->left; | 157 | prio_set_parent(node, old->left, true); |
166 | old->left->parent = node; | ||
167 | } | ||
168 | 158 | ||
169 | if (!prio_tree_right_empty(old)) { | 159 | if (!prio_tree_right_empty(old)) |
170 | node->right = old->right; | 160 | prio_set_parent(node, old->right, false); |
171 | old->right->parent = node; | ||
172 | } | ||
173 | 161 | ||
174 | return old; | 162 | return old; |
175 | } | 163 | } |
@@ -229,16 +217,14 @@ struct prio_tree_node *prio_tree_insert(struct prio_tree_root *root, | |||
229 | if (index & mask) { | 217 | if (index & mask) { |
230 | if (prio_tree_right_empty(cur)) { | 218 | if (prio_tree_right_empty(cur)) { |
231 | INIT_PRIO_TREE_NODE(node); | 219 | INIT_PRIO_TREE_NODE(node); |
232 | cur->right = node; | 220 | prio_set_parent(cur, node, false); |
233 | node->parent = cur; | ||
234 | return res; | 221 | return res; |
235 | } else | 222 | } else |
236 | cur = cur->right; | 223 | cur = cur->right; |
237 | } else { | 224 | } else { |
238 | if (prio_tree_left_empty(cur)) { | 225 | if (prio_tree_left_empty(cur)) { |
239 | INIT_PRIO_TREE_NODE(node); | 226 | INIT_PRIO_TREE_NODE(node); |
240 | cur->left = node; | 227 | prio_set_parent(cur, node, true); |
241 | node->parent = cur; | ||
242 | return res; | 228 | return res; |
243 | } else | 229 | } else |
244 | cur = cur->left; | 230 | cur = cur->left; |
@@ -305,6 +291,40 @@ void prio_tree_remove(struct prio_tree_root *root, struct prio_tree_node *node) | |||
305 | cur = prio_tree_replace(root, cur->parent, cur); | 291 | cur = prio_tree_replace(root, cur->parent, cur); |
306 | } | 292 | } |
307 | 293 | ||
294 | static void iter_walk_down(struct prio_tree_iter *iter) | ||
295 | { | ||
296 | iter->mask >>= 1; | ||
297 | if (iter->mask) { | ||
298 | if (iter->size_level) | ||
299 | iter->size_level++; | ||
300 | return; | ||
301 | } | ||
302 | |||
303 | if (iter->size_level) { | ||
304 | BUG_ON(!prio_tree_left_empty(iter->cur)); | ||
305 | BUG_ON(!prio_tree_right_empty(iter->cur)); | ||
306 | iter->size_level++; | ||
307 | iter->mask = ULONG_MAX; | ||
308 | } else { | ||
309 | iter->size_level = 1; | ||
310 | iter->mask = 1UL << (BITS_PER_LONG - 1); | ||
311 | } | ||
312 | } | ||
313 | |||
314 | static void iter_walk_up(struct prio_tree_iter *iter) | ||
315 | { | ||
316 | if (iter->mask == ULONG_MAX) | ||
317 | iter->mask = 1UL; | ||
318 | else if (iter->size_level == 1) | ||
319 | iter->mask = 1UL; | ||
320 | else | ||
321 | iter->mask <<= 1; | ||
322 | if (iter->size_level) | ||
323 | iter->size_level--; | ||
324 | if (!iter->size_level && (iter->value & iter->mask)) | ||
325 | iter->value ^= iter->mask; | ||
326 | } | ||
327 | |||
308 | /* | 328 | /* |
309 | * Following functions help to enumerate all prio_tree_nodes in the tree that | 329 | * Following functions help to enumerate all prio_tree_nodes in the tree that |
310 | * overlap with the input interval X [radix_index, heap_index]. The enumeration | 330 | * overlap with the input interval X [radix_index, heap_index]. The enumeration |
@@ -323,21 +343,7 @@ static struct prio_tree_node *prio_tree_left(struct prio_tree_iter *iter, | |||
323 | 343 | ||
324 | if (iter->r_index <= *h_index) { | 344 | if (iter->r_index <= *h_index) { |
325 | iter->cur = iter->cur->left; | 345 | iter->cur = iter->cur->left; |
326 | iter->mask >>= 1; | 346 | iter_walk_down(iter); |
327 | if (iter->mask) { | ||
328 | if (iter->size_level) | ||
329 | iter->size_level++; | ||
330 | } else { | ||
331 | if (iter->size_level) { | ||
332 | BUG_ON(!prio_tree_left_empty(iter->cur)); | ||
333 | BUG_ON(!prio_tree_right_empty(iter->cur)); | ||
334 | iter->size_level++; | ||
335 | iter->mask = ULONG_MAX; | ||
336 | } else { | ||
337 | iter->size_level = 1; | ||
338 | iter->mask = 1UL << (BITS_PER_LONG - 1); | ||
339 | } | ||
340 | } | ||
341 | return iter->cur; | 347 | return iter->cur; |
342 | } | 348 | } |
343 | 349 | ||
@@ -364,22 +370,7 @@ static struct prio_tree_node *prio_tree_right(struct prio_tree_iter *iter, | |||
364 | 370 | ||
365 | if (iter->r_index <= *h_index) { | 371 | if (iter->r_index <= *h_index) { |
366 | iter->cur = iter->cur->right; | 372 | iter->cur = iter->cur->right; |
367 | iter->mask >>= 1; | 373 | iter_walk_down(iter); |
368 | iter->value = value; | ||
369 | if (iter->mask) { | ||
370 | if (iter->size_level) | ||
371 | iter->size_level++; | ||
372 | } else { | ||
373 | if (iter->size_level) { | ||
374 | BUG_ON(!prio_tree_left_empty(iter->cur)); | ||
375 | BUG_ON(!prio_tree_right_empty(iter->cur)); | ||
376 | iter->size_level++; | ||
377 | iter->mask = ULONG_MAX; | ||
378 | } else { | ||
379 | iter->size_level = 1; | ||
380 | iter->mask = 1UL << (BITS_PER_LONG - 1); | ||
381 | } | ||
382 | } | ||
383 | return iter->cur; | 374 | return iter->cur; |
384 | } | 375 | } |
385 | 376 | ||
@@ -389,16 +380,7 @@ static struct prio_tree_node *prio_tree_right(struct prio_tree_iter *iter, | |||
389 | static struct prio_tree_node *prio_tree_parent(struct prio_tree_iter *iter) | 380 | static struct prio_tree_node *prio_tree_parent(struct prio_tree_iter *iter) |
390 | { | 381 | { |
391 | iter->cur = iter->cur->parent; | 382 | iter->cur = iter->cur->parent; |
392 | if (iter->mask == ULONG_MAX) | 383 | iter_walk_up(iter); |
393 | iter->mask = 1UL; | ||
394 | else if (iter->size_level == 1) | ||
395 | iter->mask = 1UL; | ||
396 | else | ||
397 | iter->mask <<= 1; | ||
398 | if (iter->size_level) | ||
399 | iter->size_level--; | ||
400 | if (!iter->size_level && (iter->value & iter->mask)) | ||
401 | iter->value ^= iter->mask; | ||
402 | return iter->cur; | 384 | return iter->cur; |
403 | } | 385 | } |
404 | 386 | ||
diff --git a/lib/string.c b/lib/string.c index dc4a86341f91..3a03782720c8 100644 --- a/lib/string.c +++ b/lib/string.c | |||
@@ -785,12 +785,24 @@ void *memchr_inv(const void *start, int c, size_t bytes) | |||
785 | if (bytes <= 16) | 785 | if (bytes <= 16) |
786 | return check_bytes8(start, value, bytes); | 786 | return check_bytes8(start, value, bytes); |
787 | 787 | ||
788 | value64 = value | value << 8 | value << 16 | value << 24; | 788 | value64 = value; |
789 | value64 = (value64 & 0xffffffff) | value64 << 32; | 789 | #if defined(ARCH_HAS_FAST_MULTIPLIER) && BITS_PER_LONG == 64 |
790 | prefix = 8 - ((unsigned long)start) % 8; | 790 | value64 *= 0x0101010101010101; |
791 | #elif defined(ARCH_HAS_FAST_MULTIPLIER) | ||
792 | value64 *= 0x01010101; | ||
793 | value64 |= value64 << 32; | ||
794 | #else | ||
795 | value64 |= value64 << 8; | ||
796 | value64 |= value64 << 16; | ||
797 | value64 |= value64 << 32; | ||
798 | #endif | ||
791 | 799 | ||
800 | prefix = (unsigned long)start % 8; | ||
792 | if (prefix) { | 801 | if (prefix) { |
793 | u8 *r = check_bytes8(start, value, prefix); | 802 | u8 *r; |
803 | |||
804 | prefix = 8 - prefix; | ||
805 | r = check_bytes8(start, value, prefix); | ||
794 | if (r) | 806 | if (r) |
795 | return r; | 807 | return r; |
796 | start += prefix; | 808 | start += prefix; |
diff --git a/lib/vsprintf.c b/lib/vsprintf.c index 38e612e66da5..385c40291cdb 100644 --- a/lib/vsprintf.c +++ b/lib/vsprintf.c | |||
@@ -212,6 +212,26 @@ char *put_dec(char *buf, unsigned long long num) | |||
212 | } | 212 | } |
213 | } | 213 | } |
214 | 214 | ||
215 | /* | ||
216 | * Convert passed number to decimal string. | ||
217 | * Returns the length of string. On buffer overflow, returns 0. | ||
218 | * | ||
219 | * If speed is not important, use snprintf(). It's easy to read the code. | ||
220 | */ | ||
221 | int num_to_str(char *buf, int size, unsigned long long num) | ||
222 | { | ||
223 | char tmp[21]; /* Enough for 2^64 in decimal */ | ||
224 | int idx, len; | ||
225 | |||
226 | len = put_dec(tmp, num) - tmp; | ||
227 | |||
228 | if (len > size) | ||
229 | return 0; | ||
230 | for (idx = 0; idx < len; ++idx) | ||
231 | buf[idx] = tmp[len - idx - 1]; | ||
232 | return len; | ||
233 | } | ||
234 | |||
215 | #define ZEROPAD 1 /* pad with zero */ | 235 | #define ZEROPAD 1 /* pad with zero */ |
216 | #define SIGN 2 /* unsigned/signed long */ | 236 | #define SIGN 2 /* unsigned/signed long */ |
217 | #define PLUS 4 /* show plus */ | 237 | #define PLUS 4 /* show plus */ |
diff --git a/mm/hugetlb.c b/mm/hugetlb.c index afa057a1d3fe..b8ce6f450956 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c | |||
@@ -2331,16 +2331,23 @@ void __unmap_hugepage_range(struct vm_area_struct *vma, unsigned long start, | |||
2331 | if (huge_pmd_unshare(mm, &address, ptep)) | 2331 | if (huge_pmd_unshare(mm, &address, ptep)) |
2332 | continue; | 2332 | continue; |
2333 | 2333 | ||
2334 | pte = huge_ptep_get(ptep); | ||
2335 | if (huge_pte_none(pte)) | ||
2336 | continue; | ||
2337 | |||
2338 | /* | ||
2339 | * HWPoisoned hugepage is already unmapped and dropped reference | ||
2340 | */ | ||
2341 | if (unlikely(is_hugetlb_entry_hwpoisoned(pte))) | ||
2342 | continue; | ||
2343 | |||
2344 | page = pte_page(pte); | ||
2334 | /* | 2345 | /* |
2335 | * If a reference page is supplied, it is because a specific | 2346 | * If a reference page is supplied, it is because a specific |
2336 | * page is being unmapped, not a range. Ensure the page we | 2347 | * page is being unmapped, not a range. Ensure the page we |
2337 | * are about to unmap is the actual page of interest. | 2348 | * are about to unmap is the actual page of interest. |
2338 | */ | 2349 | */ |
2339 | if (ref_page) { | 2350 | if (ref_page) { |
2340 | pte = huge_ptep_get(ptep); | ||
2341 | if (huge_pte_none(pte)) | ||
2342 | continue; | ||
2343 | page = pte_page(pte); | ||
2344 | if (page != ref_page) | 2351 | if (page != ref_page) |
2345 | continue; | 2352 | continue; |
2346 | 2353 | ||
@@ -2353,16 +2360,6 @@ void __unmap_hugepage_range(struct vm_area_struct *vma, unsigned long start, | |||
2353 | } | 2360 | } |
2354 | 2361 | ||
2355 | pte = huge_ptep_get_and_clear(mm, address, ptep); | 2362 | pte = huge_ptep_get_and_clear(mm, address, ptep); |
2356 | if (huge_pte_none(pte)) | ||
2357 | continue; | ||
2358 | |||
2359 | /* | ||
2360 | * HWPoisoned hugepage is already unmapped and dropped reference | ||
2361 | */ | ||
2362 | if (unlikely(is_hugetlb_entry_hwpoisoned(pte))) | ||
2363 | continue; | ||
2364 | |||
2365 | page = pte_page(pte); | ||
2366 | if (pte_dirty(pte)) | 2363 | if (pte_dirty(pte)) |
2367 | set_page_dirty(page); | 2364 | set_page_dirty(page); |
2368 | list_add(&page->lru, &page_list); | 2365 | list_add(&page->lru, &page_list); |
diff --git a/mm/madvise.c b/mm/madvise.c index f5ab745672b7..1ccbba5b6674 100644 --- a/mm/madvise.c +++ b/mm/madvise.c | |||
@@ -65,6 +65,12 @@ static long madvise_behavior(struct vm_area_struct * vma, | |||
65 | } | 65 | } |
66 | new_flags &= ~VM_DONTCOPY; | 66 | new_flags &= ~VM_DONTCOPY; |
67 | break; | 67 | break; |
68 | case MADV_DONTDUMP: | ||
69 | new_flags |= VM_NODUMP; | ||
70 | break; | ||
71 | case MADV_DODUMP: | ||
72 | new_flags &= ~VM_NODUMP; | ||
73 | break; | ||
68 | case MADV_MERGEABLE: | 74 | case MADV_MERGEABLE: |
69 | case MADV_UNMERGEABLE: | 75 | case MADV_UNMERGEABLE: |
70 | error = ksm_madvise(vma, start, end, behavior, &new_flags); | 76 | error = ksm_madvise(vma, start, end, behavior, &new_flags); |
@@ -293,6 +299,8 @@ madvise_behavior_valid(int behavior) | |||
293 | case MADV_HUGEPAGE: | 299 | case MADV_HUGEPAGE: |
294 | case MADV_NOHUGEPAGE: | 300 | case MADV_NOHUGEPAGE: |
295 | #endif | 301 | #endif |
302 | case MADV_DONTDUMP: | ||
303 | case MADV_DODUMP: | ||
296 | return 1; | 304 | return 1; |
297 | 305 | ||
298 | default: | 306 | default: |
diff --git a/mm/memory.c b/mm/memory.c index 3416b6e018d6..6105f475fa86 100644 --- a/mm/memory.c +++ b/mm/memory.c | |||
@@ -3623,13 +3623,7 @@ static int __init gate_vma_init(void) | |||
3623 | gate_vma.vm_end = FIXADDR_USER_END; | 3623 | gate_vma.vm_end = FIXADDR_USER_END; |
3624 | gate_vma.vm_flags = VM_READ | VM_MAYREAD | VM_EXEC | VM_MAYEXEC; | 3624 | gate_vma.vm_flags = VM_READ | VM_MAYREAD | VM_EXEC | VM_MAYEXEC; |
3625 | gate_vma.vm_page_prot = __P101; | 3625 | gate_vma.vm_page_prot = __P101; |
3626 | /* | 3626 | |
3627 | * Make sure the vDSO gets into every core dump. | ||
3628 | * Dumping its contents makes post-mortem fully interpretable later | ||
3629 | * without matching up the same kernel and hardware config to see | ||
3630 | * what PC values meant. | ||
3631 | */ | ||
3632 | gate_vma.vm_flags |= VM_ALWAYSDUMP; | ||
3633 | return 0; | 3627 | return 0; |
3634 | } | 3628 | } |
3635 | __initcall(gate_vma_init); | 3629 | __initcall(gate_vma_init); |
diff --git a/mm/oom_kill.c b/mm/oom_kill.c index 4198e000f41a..46bf2ed5594c 100644 --- a/mm/oom_kill.c +++ b/mm/oom_kill.c | |||
@@ -521,11 +521,11 @@ static void oom_kill_process(struct task_struct *p, gfp_t gfp_mask, int order, | |||
521 | pr_err("Kill process %d (%s) sharing same memory\n", | 521 | pr_err("Kill process %d (%s) sharing same memory\n", |
522 | task_pid_nr(p), p->comm); | 522 | task_pid_nr(p), p->comm); |
523 | task_unlock(p); | 523 | task_unlock(p); |
524 | force_sig(SIGKILL, p); | 524 | do_send_sig_info(SIGKILL, SEND_SIG_FORCED, p, true); |
525 | } | 525 | } |
526 | 526 | ||
527 | set_tsk_thread_flag(victim, TIF_MEMDIE); | 527 | set_tsk_thread_flag(victim, TIF_MEMDIE); |
528 | force_sig(SIGKILL, victim); | 528 | do_send_sig_info(SIGKILL, SEND_SIG_FORCED, victim, true); |
529 | } | 529 | } |
530 | #undef K | 530 | #undef K |
531 | 531 | ||
diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c index eb4277c33188..d510353ef431 100644 --- a/net/unix/af_unix.c +++ b/net/unix/af_unix.c | |||
@@ -2206,7 +2206,7 @@ static unsigned int unix_dgram_poll(struct file *file, struct socket *sock, | |||
2206 | } | 2206 | } |
2207 | 2207 | ||
2208 | /* No write status requested, avoid expensive OUT tests. */ | 2208 | /* No write status requested, avoid expensive OUT tests. */ |
2209 | if (wait && !(wait->key & (POLLWRBAND | POLLWRNORM | POLLOUT))) | 2209 | if (!(poll_requested_events(wait) & (POLLWRBAND|POLLWRNORM|POLLOUT))) |
2210 | return mask; | 2210 | return mask; |
2211 | 2211 | ||
2212 | writable = unix_writable(sk); | 2212 | writable = unix_writable(sk); |
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index a3b9782441f9..de639eeeed50 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl | |||
@@ -323,17 +323,22 @@ sub build_types { | |||
323 | }x; | 323 | }x; |
324 | $Type = qr{ | 324 | $Type = qr{ |
325 | $NonptrType | 325 | $NonptrType |
326 | (?:[\s\*]+\s*const|[\s\*]+|(?:\s*\[\s*\])+)? | 326 | (?:(?:\s|\*|\[\])+\s*const|(?:\s|\*|\[\])+|(?:\s*\[\s*\])+)? |
327 | (?:\s+$Inline|\s+$Modifier)* | 327 | (?:\s+$Inline|\s+$Modifier)* |
328 | }x; | 328 | }x; |
329 | $Declare = qr{(?:$Storage\s+)?$Type}; | 329 | $Declare = qr{(?:$Storage\s+)?$Type}; |
330 | } | 330 | } |
331 | build_types(); | 331 | build_types(); |
332 | 332 | ||
333 | our $match_balanced_parentheses = qr/(\((?:[^\(\)]+|(-1))*\))/; | ||
334 | 333 | ||
335 | our $Typecast = qr{\s*(\(\s*$NonptrType\s*\)){0,1}\s*}; | 334 | our $Typecast = qr{\s*(\(\s*$NonptrType\s*\)){0,1}\s*}; |
336 | our $LvalOrFunc = qr{($Lval)\s*($match_balanced_parentheses{0,1})\s*}; | 335 | |
336 | # Using $balanced_parens, $LvalOrFunc, or $FuncArg | ||
337 | # requires at least perl version v5.10.0 | ||
338 | # Any use must be runtime checked with $^V | ||
339 | |||
340 | our $balanced_parens = qr/(\((?:[^\(\)]++|(?-1))*\))/; | ||
341 | our $LvalOrFunc = qr{($Lval)\s*($balanced_parens{0,1})\s*}; | ||
337 | our $FuncArg = qr{$Typecast{0,1}($LvalOrFunc|$Constant)}; | 342 | our $FuncArg = qr{$Typecast{0,1}($LvalOrFunc|$Constant)}; |
338 | 343 | ||
339 | sub deparenthesize { | 344 | sub deparenthesize { |
@@ -1330,6 +1335,36 @@ sub check_absolute_file { | |||
1330 | } | 1335 | } |
1331 | } | 1336 | } |
1332 | 1337 | ||
1338 | sub pos_last_openparen { | ||
1339 | my ($line) = @_; | ||
1340 | |||
1341 | my $pos = 0; | ||
1342 | |||
1343 | my $opens = $line =~ tr/\(/\(/; | ||
1344 | my $closes = $line =~ tr/\)/\)/; | ||
1345 | |||
1346 | my $last_openparen = 0; | ||
1347 | |||
1348 | if (($opens == 0) || ($closes >= $opens)) { | ||
1349 | return -1; | ||
1350 | } | ||
1351 | |||
1352 | my $len = length($line); | ||
1353 | |||
1354 | for ($pos = 0; $pos < $len; $pos++) { | ||
1355 | my $string = substr($line, $pos); | ||
1356 | if ($string =~ /^($FuncArg|$balanced_parens)/) { | ||
1357 | $pos += length($1) - 1; | ||
1358 | } elsif (substr($line, $pos, 1) eq '(') { | ||
1359 | $last_openparen = $pos; | ||
1360 | } elsif (index($string, '(') == -1) { | ||
1361 | last; | ||
1362 | } | ||
1363 | } | ||
1364 | |||
1365 | return $last_openparen + 1; | ||
1366 | } | ||
1367 | |||
1333 | sub process { | 1368 | sub process { |
1334 | my $filename = shift; | 1369 | my $filename = shift; |
1335 | 1370 | ||
@@ -1737,6 +1772,21 @@ sub process { | |||
1737 | "line over 80 characters\n" . $herecurr); | 1772 | "line over 80 characters\n" . $herecurr); |
1738 | } | 1773 | } |
1739 | 1774 | ||
1775 | # Check for user-visible strings broken across lines, which breaks the ability | ||
1776 | # to grep for the string. Limited to strings used as parameters (those | ||
1777 | # following an open parenthesis), which almost completely eliminates false | ||
1778 | # positives, as well as warning only once per parameter rather than once per | ||
1779 | # line of the string. Make an exception when the previous string ends in a | ||
1780 | # newline (multiple lines in one string constant) or \n\t (common in inline | ||
1781 | # assembly to indent the instruction on the following line). | ||
1782 | if ($line =~ /^\+\s*"/ && | ||
1783 | $prevline =~ /"\s*$/ && | ||
1784 | $prevline =~ /\(/ && | ||
1785 | $prevrawline !~ /\\n(?:\\t)*"\s*$/) { | ||
1786 | WARN("SPLIT_STRING", | ||
1787 | "quoted string split across lines\n" . $hereprev); | ||
1788 | } | ||
1789 | |||
1740 | # check for spaces before a quoted newline | 1790 | # check for spaces before a quoted newline |
1741 | if ($rawline =~ /^.*\".*\s\\n/) { | 1791 | if ($rawline =~ /^.*\".*\s\\n/) { |
1742 | WARN("QUOTED_WHITESPACE_BEFORE_NEWLINE", | 1792 | WARN("QUOTED_WHITESPACE_BEFORE_NEWLINE", |
@@ -1783,6 +1833,48 @@ sub process { | |||
1783 | "please, no space before tabs\n" . $herevet); | 1833 | "please, no space before tabs\n" . $herevet); |
1784 | } | 1834 | } |
1785 | 1835 | ||
1836 | # check for && or || at the start of a line | ||
1837 | if ($rawline =~ /^\+\s*(&&|\|\|)/) { | ||
1838 | CHK("LOGICAL_CONTINUATIONS", | ||
1839 | "Logical continuations should be on the previous line\n" . $hereprev); | ||
1840 | } | ||
1841 | |||
1842 | # check multi-line statement indentation matches previous line | ||
1843 | if ($^V && $^V ge 5.10.0 && | ||
1844 | $prevline =~ /^\+(\t*)(if \(|$Ident\().*(\&\&|\|\||,)\s*$/) { | ||
1845 | $prevline =~ /^\+(\t*)(.*)$/; | ||
1846 | my $oldindent = $1; | ||
1847 | my $rest = $2; | ||
1848 | |||
1849 | my $pos = pos_last_openparen($rest); | ||
1850 | if ($pos >= 0) { | ||
1851 | $line =~ /^\+([ \t]*)/; | ||
1852 | my $newindent = $1; | ||
1853 | |||
1854 | my $goodtabindent = $oldindent . | ||
1855 | "\t" x ($pos / 8) . | ||
1856 | " " x ($pos % 8); | ||
1857 | my $goodspaceindent = $oldindent . " " x $pos; | ||
1858 | |||
1859 | if ($newindent ne $goodtabindent && | ||
1860 | $newindent ne $goodspaceindent) { | ||
1861 | CHK("PARENTHESIS_ALIGNMENT", | ||
1862 | "Alignment should match open parenthesis\n" . $hereprev); | ||
1863 | } | ||
1864 | } | ||
1865 | } | ||
1866 | |||
1867 | if ($line =~ /^\+.*\*[ \t]*\)[ \t]+/) { | ||
1868 | CHK("SPACING", | ||
1869 | "No space is necessary after a cast\n" . $hereprev); | ||
1870 | } | ||
1871 | |||
1872 | if ($rawline =~ /^\+[ \t]*\/\*[ \t]*$/ && | ||
1873 | $prevrawline =~ /^\+[ \t]*$/) { | ||
1874 | CHK("BLOCK_COMMENT_STYLE", | ||
1875 | "Don't begin block comments with only a /* line, use /* comment...\n" . $hereprev); | ||
1876 | } | ||
1877 | |||
1786 | # check for spaces at the beginning of a line. | 1878 | # check for spaces at the beginning of a line. |
1787 | # Exceptions: | 1879 | # Exceptions: |
1788 | # 1) within comments | 1880 | # 1) within comments |
@@ -2325,7 +2417,7 @@ sub process { | |||
2325 | my ($where, $prefix) = ($-[1], $1); | 2417 | my ($where, $prefix) = ($-[1], $1); |
2326 | if ($prefix !~ /$Type\s+$/ && | 2418 | if ($prefix !~ /$Type\s+$/ && |
2327 | ($where != 0 || $prefix !~ /^.\s+$/) && | 2419 | ($where != 0 || $prefix !~ /^.\s+$/) && |
2328 | $prefix !~ /{\s+$/) { | 2420 | $prefix !~ /[{,]\s+$/) { |
2329 | ERROR("BRACKET_SPACE", | 2421 | ERROR("BRACKET_SPACE", |
2330 | "space prohibited before open square bracket '['\n" . $herecurr); | 2422 | "space prohibited before open square bracket '['\n" . $herecurr); |
2331 | } | 2423 | } |
@@ -2828,6 +2920,12 @@ sub process { | |||
2828 | { | 2920 | { |
2829 | } | 2921 | } |
2830 | 2922 | ||
2923 | # Flatten any obvious string concatentation. | ||
2924 | while ($dstat =~ s/("X*")\s*$Ident/$1/ || | ||
2925 | $dstat =~ s/$Ident\s*("X*")/$1/) | ||
2926 | { | ||
2927 | } | ||
2928 | |||
2831 | my $exceptions = qr{ | 2929 | my $exceptions = qr{ |
2832 | $Declare| | 2930 | $Declare| |
2833 | module_param_named| | 2931 | module_param_named| |
@@ -2844,7 +2942,8 @@ sub process { | |||
2844 | if ($dstat ne '' && | 2942 | if ($dstat ne '' && |
2845 | $dstat !~ /^(?:$Ident|-?$Constant),$/ && # 10, // foo(), | 2943 | $dstat !~ /^(?:$Ident|-?$Constant),$/ && # 10, // foo(), |
2846 | $dstat !~ /^(?:$Ident|-?$Constant);$/ && # foo(); | 2944 | $dstat !~ /^(?:$Ident|-?$Constant);$/ && # foo(); |
2847 | $dstat !~ /^(?:$Ident|-?$Constant)$/ && # 10 // foo() | 2945 | $dstat !~ /^[!~-]?(?:$Ident|$Constant)$/ && # 10 // foo() // !foo // ~foo // -foo |
2946 | $dstat !~ /^'X'$/ && # character constants | ||
2848 | $dstat !~ /$exceptions/ && | 2947 | $dstat !~ /$exceptions/ && |
2849 | $dstat !~ /^\.$Ident\s*=/ && # .foo = | 2948 | $dstat !~ /^\.$Ident\s*=/ && # .foo = |
2850 | $dstat !~ /^do\s*$Constant\s*while\s*$Constant;?$/ && # do {...} while (...); // do {...} while (...) | 2949 | $dstat !~ /^do\s*$Constant\s*while\s*$Constant;?$/ && # do {...} while (...); // do {...} while (...) |
@@ -2888,7 +2987,8 @@ sub process { | |||
2888 | #print "chunks<$#chunks> linenr<$linenr> endln<$endln> level<$level>\n"; | 2987 | #print "chunks<$#chunks> linenr<$linenr> endln<$endln> level<$level>\n"; |
2889 | #print "APW: <<$chunks[1][0]>><<$chunks[1][1]>>\n"; | 2988 | #print "APW: <<$chunks[1][0]>><<$chunks[1][1]>>\n"; |
2890 | if ($#chunks > 0 && $level == 0) { | 2989 | if ($#chunks > 0 && $level == 0) { |
2891 | my $allowed = 0; | 2990 | my @allowed = (); |
2991 | my $allow = 0; | ||
2892 | my $seen = 0; | 2992 | my $seen = 0; |
2893 | my $herectx = $here . "\n"; | 2993 | my $herectx = $here . "\n"; |
2894 | my $ln = $linenr - 1; | 2994 | my $ln = $linenr - 1; |
@@ -2899,6 +2999,7 @@ sub process { | |||
2899 | my ($whitespace) = ($cond =~ /^((?:\s*\n[+-])*\s*)/s); | 2999 | my ($whitespace) = ($cond =~ /^((?:\s*\n[+-])*\s*)/s); |
2900 | my $offset = statement_rawlines($whitespace) - 1; | 3000 | my $offset = statement_rawlines($whitespace) - 1; |
2901 | 3001 | ||
3002 | $allowed[$allow] = 0; | ||
2902 | #print "COND<$cond> whitespace<$whitespace> offset<$offset>\n"; | 3003 | #print "COND<$cond> whitespace<$whitespace> offset<$offset>\n"; |
2903 | 3004 | ||
2904 | # We have looked at and allowed this specific line. | 3005 | # We have looked at and allowed this specific line. |
@@ -2911,23 +3012,34 @@ sub process { | |||
2911 | 3012 | ||
2912 | $seen++ if ($block =~ /^\s*{/); | 3013 | $seen++ if ($block =~ /^\s*{/); |
2913 | 3014 | ||
2914 | #print "cond<$cond> block<$block> allowed<$allowed>\n"; | 3015 | #print "cond<$cond> block<$block> allowed<$allowed[$allow]>\n"; |
2915 | if (statement_lines($cond) > 1) { | 3016 | if (statement_lines($cond) > 1) { |
2916 | #print "APW: ALLOWED: cond<$cond>\n"; | 3017 | #print "APW: ALLOWED: cond<$cond>\n"; |
2917 | $allowed = 1; | 3018 | $allowed[$allow] = 1; |
2918 | } | 3019 | } |
2919 | if ($block =~/\b(?:if|for|while)\b/) { | 3020 | if ($block =~/\b(?:if|for|while)\b/) { |
2920 | #print "APW: ALLOWED: block<$block>\n"; | 3021 | #print "APW: ALLOWED: block<$block>\n"; |
2921 | $allowed = 1; | 3022 | $allowed[$allow] = 1; |
2922 | } | 3023 | } |
2923 | if (statement_block_size($block) > 1) { | 3024 | if (statement_block_size($block) > 1) { |
2924 | #print "APW: ALLOWED: lines block<$block>\n"; | 3025 | #print "APW: ALLOWED: lines block<$block>\n"; |
2925 | $allowed = 1; | 3026 | $allowed[$allow] = 1; |
2926 | } | 3027 | } |
3028 | $allow++; | ||
2927 | } | 3029 | } |
2928 | if ($seen && !$allowed) { | 3030 | if ($seen) { |
2929 | WARN("BRACES", | 3031 | my $sum_allowed = 0; |
2930 | "braces {} are not necessary for any arm of this statement\n" . $herectx); | 3032 | foreach (@allowed) { |
3033 | $sum_allowed += $_; | ||
3034 | } | ||
3035 | if ($sum_allowed == 0) { | ||
3036 | WARN("BRACES", | ||
3037 | "braces {} are not necessary for any arm of this statement\n" . $herectx); | ||
3038 | } elsif ($sum_allowed != $allow && | ||
3039 | $seen != $allow) { | ||
3040 | CHK("BRACES", | ||
3041 | "braces {} should be used on all arms of this statement\n" . $herectx); | ||
3042 | } | ||
2931 | } | 3043 | } |
2932 | } | 3044 | } |
2933 | } | 3045 | } |
@@ -3123,6 +3235,12 @@ sub process { | |||
3123 | "__printf(string-index, first-to-check) is preferred over __attribute__((format(printf, string-index, first-to-check)))\n" . $herecurr); | 3235 | "__printf(string-index, first-to-check) is preferred over __attribute__((format(printf, string-index, first-to-check)))\n" . $herecurr); |
3124 | } | 3236 | } |
3125 | 3237 | ||
3238 | # Check for __attribute__ format(scanf, prefer __scanf | ||
3239 | if ($line =~ /\b__attribute__\s*\(\s*\(\s*format\s*\(\s*scanf\b/) { | ||
3240 | WARN("PREFER_SCANF", | ||
3241 | "__scanf(string-index, first-to-check) is preferred over __attribute__((format(scanf, string-index, first-to-check)))\n" . $herecurr); | ||
3242 | } | ||
3243 | |||
3126 | # check for sizeof(&) | 3244 | # check for sizeof(&) |
3127 | if ($line =~ /\bsizeof\s*\(\s*\&/) { | 3245 | if ($line =~ /\bsizeof\s*\(\s*\&/) { |
3128 | WARN("SIZEOF_ADDRESS", | 3246 | WARN("SIZEOF_ADDRESS", |
@@ -3136,12 +3254,13 @@ sub process { | |||
3136 | } | 3254 | } |
3137 | 3255 | ||
3138 | # Check for misused memsets | 3256 | # Check for misused memsets |
3139 | if (defined $stat && | 3257 | if ($^V && $^V ge 5.10.0 && |
3258 | defined $stat && | ||
3140 | $stat =~ /^\+(?:.*?)\bmemset\s*\(\s*$FuncArg\s*,\s*$FuncArg\s*\,\s*$FuncArg\s*\)/s) { | 3259 | $stat =~ /^\+(?:.*?)\bmemset\s*\(\s*$FuncArg\s*,\s*$FuncArg\s*\,\s*$FuncArg\s*\)/s) { |
3141 | 3260 | ||
3142 | my $ms_addr = $2; | 3261 | my $ms_addr = $2; |
3143 | my $ms_val = $8; | 3262 | my $ms_val = $7; |
3144 | my $ms_size = $14; | 3263 | my $ms_size = $12; |
3145 | 3264 | ||
3146 | if ($ms_size =~ /^(0x|)0$/i) { | 3265 | if ($ms_size =~ /^(0x|)0$/i) { |
3147 | ERROR("MEMSET", | 3266 | ERROR("MEMSET", |
@@ -3153,17 +3272,18 @@ sub process { | |||
3153 | } | 3272 | } |
3154 | 3273 | ||
3155 | # typecasts on min/max could be min_t/max_t | 3274 | # typecasts on min/max could be min_t/max_t |
3156 | if (defined $stat && | 3275 | if ($^V && $^V ge 5.10.0 && |
3276 | defined $stat && | ||
3157 | $stat =~ /^\+(?:.*?)\b(min|max)\s*\(\s*$FuncArg\s*,\s*$FuncArg\s*\)/) { | 3277 | $stat =~ /^\+(?:.*?)\b(min|max)\s*\(\s*$FuncArg\s*,\s*$FuncArg\s*\)/) { |
3158 | if (defined $2 || defined $8) { | 3278 | if (defined $2 || defined $7) { |
3159 | my $call = $1; | 3279 | my $call = $1; |
3160 | my $cast1 = deparenthesize($2); | 3280 | my $cast1 = deparenthesize($2); |
3161 | my $arg1 = $3; | 3281 | my $arg1 = $3; |
3162 | my $cast2 = deparenthesize($8); | 3282 | my $cast2 = deparenthesize($7); |
3163 | my $arg2 = $9; | 3283 | my $arg2 = $8; |
3164 | my $cast; | 3284 | my $cast; |
3165 | 3285 | ||
3166 | if ($cast1 ne "" && $cast2 ne "") { | 3286 | if ($cast1 ne "" && $cast2 ne "" && $cast1 ne $cast2) { |
3167 | $cast = "$cast1 or $cast2"; | 3287 | $cast = "$cast1 or $cast2"; |
3168 | } elsif ($cast1 ne "") { | 3288 | } elsif ($cast1 ne "") { |
3169 | $cast = $cast1; | 3289 | $cast = $cast1; |
@@ -3233,22 +3353,30 @@ sub process { | |||
3233 | "__func__ should be used instead of gcc specific __FUNCTION__\n" . $herecurr); | 3353 | "__func__ should be used instead of gcc specific __FUNCTION__\n" . $herecurr); |
3234 | } | 3354 | } |
3235 | 3355 | ||
3356 | # check for use of yield() | ||
3357 | if ($line =~ /\byield\s*\(\s*\)/) { | ||
3358 | WARN("YIELD", | ||
3359 | "Using yield() is generally wrong. See yield() kernel-doc (sched/core.c)\n" . $herecurr); | ||
3360 | } | ||
3361 | |||
3236 | # check for semaphores initialized locked | 3362 | # check for semaphores initialized locked |
3237 | if ($line =~ /^.\s*sema_init.+,\W?0\W?\)/) { | 3363 | if ($line =~ /^.\s*sema_init.+,\W?0\W?\)/) { |
3238 | WARN("CONSIDER_COMPLETION", | 3364 | WARN("CONSIDER_COMPLETION", |
3239 | "consider using a completion\n" . $herecurr); | 3365 | "consider using a completion\n" . $herecurr); |
3240 | |||
3241 | } | 3366 | } |
3367 | |||
3242 | # recommend kstrto* over simple_strto* and strict_strto* | 3368 | # recommend kstrto* over simple_strto* and strict_strto* |
3243 | if ($line =~ /\b((simple|strict)_(strto(l|ll|ul|ull)))\s*\(/) { | 3369 | if ($line =~ /\b((simple|strict)_(strto(l|ll|ul|ull)))\s*\(/) { |
3244 | WARN("CONSIDER_KSTRTO", | 3370 | WARN("CONSIDER_KSTRTO", |
3245 | "$1 is obsolete, use k$3 instead\n" . $herecurr); | 3371 | "$1 is obsolete, use k$3 instead\n" . $herecurr); |
3246 | } | 3372 | } |
3373 | |||
3247 | # check for __initcall(), use device_initcall() explicitly please | 3374 | # check for __initcall(), use device_initcall() explicitly please |
3248 | if ($line =~ /^.\s*__initcall\s*\(/) { | 3375 | if ($line =~ /^.\s*__initcall\s*\(/) { |
3249 | WARN("USE_DEVICE_INITCALL", | 3376 | WARN("USE_DEVICE_INITCALL", |
3250 | "please use device_initcall() instead of __initcall()\n" . $herecurr); | 3377 | "please use device_initcall() instead of __initcall()\n" . $herecurr); |
3251 | } | 3378 | } |
3379 | |||
3252 | # check for various ops structs, ensure they are const. | 3380 | # check for various ops structs, ensure they are const. |
3253 | my $struct_ops = qr{acpi_dock_ops| | 3381 | my $struct_ops = qr{acpi_dock_ops| |
3254 | address_space_operations| | 3382 | address_space_operations| |
@@ -3385,6 +3513,12 @@ sub process { | |||
3385 | } | 3513 | } |
3386 | 3514 | ||
3387 | if ($quiet == 0) { | 3515 | if ($quiet == 0) { |
3516 | |||
3517 | if ($^V lt 5.10.0) { | ||
3518 | print("NOTE: perl $^V is not modern enough to detect all possible issues.\n"); | ||
3519 | print("An upgrade to at least perl v5.10.0 is suggested.\n\n"); | ||
3520 | } | ||
3521 | |||
3388 | # If there were whitespace errors which cleanpatch can fix | 3522 | # If there were whitespace errors which cleanpatch can fix |
3389 | # then suggest that. | 3523 | # then suggest that. |
3390 | if ($rpt_cleaners) { | 3524 | if ($rpt_cleaners) { |
@@ -3394,13 +3528,12 @@ sub process { | |||
3394 | } | 3528 | } |
3395 | } | 3529 | } |
3396 | 3530 | ||
3397 | if (keys %ignore_type) { | 3531 | if ($quiet == 0 && keys %ignore_type) { |
3398 | print "NOTE: Ignored message types:"; | 3532 | print "NOTE: Ignored message types:"; |
3399 | foreach my $ignore (sort keys %ignore_type) { | 3533 | foreach my $ignore (sort keys %ignore_type) { |
3400 | print " $ignore"; | 3534 | print " $ignore"; |
3401 | } | 3535 | } |
3402 | print "\n"; | 3536 | print "\n\n"; |
3403 | print "\n" if ($quiet == 0); | ||
3404 | } | 3537 | } |
3405 | 3538 | ||
3406 | if ($clean == 1 && $quiet == 0) { | 3539 | if ($clean == 1 && $quiet == 0) { |
diff --git a/scripts/get_maintainer.pl b/scripts/get_maintainer.pl index f32a04c4c5bc..0948c6b5a321 100755 --- a/scripts/get_maintainer.pl +++ b/scripts/get_maintainer.pl | |||
@@ -931,7 +931,7 @@ sub get_maintainer_role { | |||
931 | my $start = find_starting_index($index); | 931 | my $start = find_starting_index($index); |
932 | my $end = find_ending_index($index); | 932 | my $end = find_ending_index($index); |
933 | 933 | ||
934 | my $role; | 934 | my $role = "unknown"; |
935 | my $subsystem = $typevalue[$start]; | 935 | my $subsystem = $typevalue[$start]; |
936 | if (length($subsystem) > 20) { | 936 | if (length($subsystem) > 20) { |
937 | $subsystem = substr($subsystem, 0, 17); | 937 | $subsystem = substr($subsystem, 0, 17); |
@@ -1027,8 +1027,13 @@ sub add_categories { | |||
1027 | if ($email_list) { | 1027 | if ($email_list) { |
1028 | if (!$hash_list_to{lc($list_address)}) { | 1028 | if (!$hash_list_to{lc($list_address)}) { |
1029 | $hash_list_to{lc($list_address)} = 1; | 1029 | $hash_list_to{lc($list_address)} = 1; |
1030 | push(@list_to, [$list_address, | 1030 | if ($list_additional =~ m/moderated/) { |
1031 | "open list${list_role}"]); | 1031 | push(@list_to, [$list_address, |
1032 | "moderated list${list_role}"]); | ||
1033 | } else { | ||
1034 | push(@list_to, [$list_address, | ||
1035 | "open list${list_role}"]); | ||
1036 | } | ||
1032 | } | 1037 | } |
1033 | } | 1038 | } |
1034 | } | 1039 | } |
diff --git a/security/keys/request_key.c b/security/keys/request_key.c index 82465328c39b..cc3790315d2f 100644 --- a/security/keys/request_key.c +++ b/security/keys/request_key.c | |||
@@ -91,7 +91,7 @@ static void umh_keys_cleanup(struct subprocess_info *info) | |||
91 | * Call a usermode helper with a specific session keyring. | 91 | * Call a usermode helper with a specific session keyring. |
92 | */ | 92 | */ |
93 | static int call_usermodehelper_keys(char *path, char **argv, char **envp, | 93 | static int call_usermodehelper_keys(char *path, char **argv, char **envp, |
94 | struct key *session_keyring, enum umh_wait wait) | 94 | struct key *session_keyring, int wait) |
95 | { | 95 | { |
96 | gfp_t gfp_mask = (wait == UMH_NO_WAIT) ? GFP_ATOMIC : GFP_KERNEL; | 96 | gfp_t gfp_mask = (wait == UMH_NO_WAIT) ? GFP_ATOMIC : GFP_KERNEL; |
97 | struct subprocess_info *info = | 97 | struct subprocess_info *info = |
diff --git a/security/tomoyo/load_policy.c b/security/tomoyo/load_policy.c index 67975405140f..078fac0bb4c5 100644 --- a/security/tomoyo/load_policy.c +++ b/security/tomoyo/load_policy.c | |||
@@ -102,7 +102,7 @@ void tomoyo_load_policy(const char *filename) | |||
102 | envp[0] = "HOME=/"; | 102 | envp[0] = "HOME=/"; |
103 | envp[1] = "PATH=/sbin:/bin:/usr/sbin:/usr/bin"; | 103 | envp[1] = "PATH=/sbin:/bin:/usr/sbin:/usr/bin"; |
104 | envp[2] = NULL; | 104 | envp[2] = NULL; |
105 | call_usermodehelper(argv[0], argv, envp, 1); | 105 | call_usermodehelper(argv[0], argv, envp, UMH_WAIT_PROC); |
106 | tomoyo_check_profile(); | 106 | tomoyo_check_profile(); |
107 | } | 107 | } |
108 | 108 | ||
diff --git a/tools/perf/util/include/linux/bitops.h b/tools/perf/util/include/linux/bitops.h index 62cdee78db7b..f1584833bd22 100644 --- a/tools/perf/util/include/linux/bitops.h +++ b/tools/perf/util/include/linux/bitops.h | |||
@@ -15,7 +15,7 @@ | |||
15 | (bit) = find_next_bit((addr), (size), (bit) + 1)) | 15 | (bit) = find_next_bit((addr), (size), (bit) + 1)) |
16 | 16 | ||
17 | /* same as for_each_set_bit() but use bit as value to start with */ | 17 | /* same as for_each_set_bit() but use bit as value to start with */ |
18 | #define for_each_set_bit_cont(bit, addr, size) \ | 18 | #define for_each_set_bit_from(bit, addr, size) \ |
19 | for ((bit) = find_next_bit((addr), (size), (bit)); \ | 19 | for ((bit) = find_next_bit((addr), (size), (bit)); \ |
20 | (bit) < (size); \ | 20 | (bit) < (size); \ |
21 | (bit) = find_next_bit((addr), (size), (bit) + 1)) | 21 | (bit) = find_next_bit((addr), (size), (bit) + 1)) |