Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge branch 'viro'

+4978 -2176
+9
Documentation/feature-removal-schedule.txt
··· 169 169 When: January 2007 170 170 Why: Is replaced by pci_register_driver(pci_driver). 171 171 Who: Richard Knutsson <ricknu-0@student.ltu.se> and Greg Kroah-Hartman <gregkh@suse.de> 172 + 173 + --------------------------- 174 + 175 + What: I2C interface of the it87 driver 176 + When: January 2007 177 + Why: The ISA interface is faster and should be always available. The I2C 178 + probing is also known to cause trouble in at least one case (see 179 + bug #5889.) 180 + Who: Jean Delvare <khali@linux-fr.org>
+105
Documentation/hwmon/f71805f
··· 1 + Kernel driver f71805f 2 + ===================== 3 + 4 + Supported chips: 5 + * Fintek F71805F/FG 6 + Prefix: 'f71805f' 7 + Addresses scanned: none, address read from Super I/O config space 8 + Datasheet: Provided by Fintek on request 9 + 10 + Author: Jean Delvare <khali@linux-fr.org> 11 + 12 + Thanks to Denis Kieft from Barracuda Networks for the donation of a 13 + test system (custom Jetway K8M8MS motherboard, with CPU and RAM) and 14 + for providing initial documentation. 15 + 16 + Thanks to Kris Chen from Fintek for answering technical questions and 17 + providing additional documentation. 18 + 19 + Thanks to Chris Lin from Jetway for providing wiring schematics and 20 + anwsering technical questions. 21 + 22 + 23 + Description 24 + ----------- 25 + 26 + The Fintek F71805F/FG Super I/O chip includes complete hardware monitoring 27 + capabilities. It can monitor up to 9 voltages (counting its own power 28 + source), 3 fans and 3 temperature sensors. 29 + 30 + This chip also has fan controlling features, using either DC or PWM, in 31 + three different modes (one manual, two automatic). The driver doesn't 32 + support these features yet. 33 + 34 + The driver assumes that no more than one chip is present, which seems 35 + reasonable. 36 + 37 + 38 + Voltage Monitoring 39 + ------------------ 40 + 41 + Voltages are sampled by an 8-bit ADC with a LSB of 8 mV. The supported 42 + range is thus from 0 to 2.040 V. Voltage values outside of this range 43 + need external resistors. An exception is in0, which is used to monitor 44 + the chip's own power source (+3.3V), and is divided internally by a 45 + factor 2. 46 + 47 + The two LSB of the voltage limit registers are not used (always 0), so 48 + you can only set the limits in steps of 32 mV (before scaling). 49 + 50 + The wirings and resistor values suggested by Fintek are as follow: 51 + 52 + pin expected 53 + name use R1 R2 divider raw val. 54 + 55 + in0 VCC VCC3.3V int. int. 2.00 1.65 V 56 + in1 VIN1 VTT1.2V 10K - 1.00 1.20 V 57 + in2 VIN2 VRAM 100K 100K 2.00 ~1.25 V (1) 58 + in3 VIN3 VCHIPSET 47K 100K 1.47 2.24 V (2) 59 + in4 VIN4 VCC5V 200K 47K 5.25 0.95 V 60 + in5 VIN5 +12V 200K 20K 11.00 1.05 V 61 + in6 VIN6 VCC1.5V 10K - 1.00 1.50 V 62 + in7 VIN7 VCORE 10K - 1.00 ~1.40 V (1) 63 + in8 VIN8 VSB5V 200K 47K 1.00 0.95 V 64 + 65 + (1) Depends on your hardware setup. 66 + (2) Obviously not correct, swapping R1 and R2 would make more sense. 67 + 68 + These values can be used as hints at best, as motherboard manufacturers 69 + are free to use a completely different setup. As a matter of fact, the 70 + Jetway K8M8MS uses a significantly different setup. You will have to 71 + find out documentation about your own motherboard, and edit sensors.conf 72 + accordingly. 73 + 74 + Each voltage measured has associated low and high limits, each of which 75 + triggers an alarm when crossed. 76 + 77 + 78 + Fan Monitoring 79 + -------------- 80 + 81 + Fan rotation speeds are reported as 12-bit values from a gated clock 82 + signal. Speeds down to 366 RPM can be measured. There is no theoretical 83 + high limit, but values over 6000 RPM seem to cause problem. The effective 84 + resolution is much lower than you would expect, the step between different 85 + register values being 10 rather than 1. 86 + 87 + The chip assumes 2 pulse-per-revolution fans. 88 + 89 + An alarm is triggered if the rotation speed drops below a programmable 90 + limit or is too low to be measured. 91 + 92 + 93 + Temperature Monitoring 94 + ---------------------- 95 + 96 + Temperatures are reported in degrees Celsius. Each temperature measured 97 + has a high limit, those crossing triggers an alarm. There is an associated 98 + hysteresis value, below which the temperature has to drop before the 99 + alarm is cleared. 100 + 101 + All temperature channels are external, there is no embedded temperature 102 + sensor. Each channel can be used for connecting either a thermal diode 103 + or a thermistor. The driver reports the currently selected mode, but 104 + doesn't allow changing it. In theory, the BIOS should have configured 105 + everything properly.
+1 -1
Documentation/hwmon/it87
··· 9 9 http://www.ite.com.tw/ 10 10 * IT8712F 11 11 Prefix: 'it8712' 12 - Addresses scanned: I2C 0x28 - 0x2f 12 + Addresses scanned: I2C 0x2d 13 13 from Super I/O config space (8 I/O ports) 14 14 Datasheet: Publicly available at the ITE website 15 15 http://www.ite.com.tw/
+17 -1
Documentation/hwmon/sysfs-interface
··· 179 179 **************** 180 180 181 181 temp[1-3]_type Sensor type selection. 182 - Integers 1, 2, 3 or thermistor Beta value (3435) 182 + Integers 1 to 4 or thermistor Beta value (typically 3435) 183 183 Read/Write. 184 184 1: PII/Celeron Diode 185 185 2: 3904 transistor 186 186 3: thermal diode 187 + 4: thermistor (default/unknown Beta) 187 188 Not all types are supported by all chips 188 189 189 190 temp[1-4]_max Temperature max value. ··· 261 260 alarm registers; there is no standard for the position 262 261 of individual bits. 263 262 Bits are defined in kernel/include/sensors.h. 263 + 264 + alarms_in Alarm bitmask relative to in (voltage) channels 265 + Read only 266 + A '1' bit means an alarm, LSB corresponds to in0 and so on 267 + Prefered to 'alarms' for newer chips 268 + 269 + alarms_fan Alarm bitmask relative to fan channels 270 + Read only 271 + A '1' bit means an alarm, LSB corresponds to fan1 and so on 272 + Prefered to 'alarms' for newer chips 273 + 274 + alarms_temp Alarm bitmask relative to temp (temperature) channels 275 + Read only 276 + A '1' bit means an alarm, LSB corresponds to temp1 and so on 277 + Prefered to 'alarms' for newer chips 264 278 265 279 beep_enable Beep/interrupt enable 266 280 0 to disable.
+2 -2
Documentation/i2c/busses/i2c-sis69x Documentation/i2c/busses/i2c-sis96x
··· 7 7 Any combination of these host bridges: 8 8 645, 645DX (aka 646), 648, 650, 651, 655, 735, 745, 746 9 9 and these south bridges: 10 - 961, 962, 963(L) 10 + 961, 962, 963(L) 11 11 12 12 Author: Mark M. Hoffman <mhoffman@lightlink.com> 13 13 ··· 29 29 30 30 or perhaps this... 31 31 32 - 00:00.0 Host bridge: Silicon Integrated Systems [SiS]: Unknown device 0645 32 + 00:00.0 Host bridge: Silicon Integrated Systems [SiS]: Unknown device 0645 33 33 00:02.0 ISA bridge: Silicon Integrated Systems [SiS]: Unknown device 0961 34 34 00:02.1 SMBus: Silicon Integrated Systems [SiS]: Unknown device 0016 35 35
+8
Documentation/powerpc/booting-without-of.txt
··· 880 880 - device_type : Should be "soc" 881 881 - ranges : Should be defined as specified in 1) to describe the 882 882 translation of SOC addresses for memory mapped SOC registers. 883 + - bus-frequency: Contains the bus frequency for the SOC node. 884 + Typically, the value of this field is filled in by the boot 885 + loader. 886 + 883 887 884 888 Recommended properties: 885 889 ··· 923 919 device_type = "soc"; 924 920 ranges = <00000000 e0000000 00100000> 925 921 reg = <e0000000 00003000>; 922 + bus-frequency = <0>; 926 923 } 927 924 928 925 ··· 1175 1170 1176 1171 mdio@24520 { 1177 1172 reg = <24520 20>; 1173 + device_type = "mdio"; 1174 + compatible = "gianfar"; 1178 1175 1179 1176 ethernet-phy@0 { 1180 1177 ...... ··· 1324 1317 device_type = "soc"; 1325 1318 ranges = <00000000 e0000000 00100000> 1326 1319 reg = <e0000000 00003000>; 1320 + bus-frequency = <0>; 1327 1321 1328 1322 mdio@24520 { 1329 1323 reg = <24520 20>;
+17 -6
Documentation/spi/butterfly
··· 12 12 directly to the Butterfly. Or (if you have the parts and skills) you 13 13 can come up with something fancier, providing ciruit protection to the 14 14 Butterfly and the printer port, or with a better power supply than two 15 - signal pins from the printer port. 15 + signal pins from the printer port. Or for that matter, you can use 16 + similar cables to talk to many AVR boards, even a breadboard. 17 + 18 + This is more powerful than "ISP programming" cables since it lets kernel 19 + SPI protocol drivers interact with the AVR, and could even let the AVR 20 + issue interrupts to them. Later, your protocol driver should work 21 + easily with a "real SPI controller", instead of this bitbanger. 16 22 17 23 18 24 The first cable connections will hook Linux up to one SPI bus, with the 19 25 AVR and a DataFlash chip; and to the AVR reset line. This is all you 20 26 need to reflash the firmware, and the pins are the standard Atmel "ISP" 21 - connector pins (used also on non-Butterfly AVR boards). 27 + connector pins (used also on non-Butterfly AVR boards). On the parport 28 + side this is like "sp12" programming cables. 22 29 23 30 Signal Butterfly Parport (DB-25) 24 31 ------ --------- --------------- ··· 47 40 SELECT = J400.PB0/nSS = pin 17/C3,nSELECT 48 41 GND = J400.GND = pin 24/GND 49 42 50 - The "USI" controller, using J405, can be used for a second SPI bus. That 51 - would let you talk to the AVR over SPI, running firmware that makes it act 52 - as an SPI slave, while letting either Linux or the AVR use the DataFlash. 53 - There are plenty of spare parport pins to wire this one up, such as: 43 + Or you could flash firmware making the AVR into an SPI slave (keeping the 44 + DataFlash in reset) and tweak the spi_butterfly driver to make it bind to 45 + the driver for your custom SPI-based protocol. 46 + 47 + The "USI" controller, using J405, can also be used for a second SPI bus. 48 + That would let you talk to the AVR using custom SPI-with-USI firmware, 49 + while letting either Linux or the AVR use the DataFlash. There are plenty 50 + of spare parport pins to wire this one up, such as: 54 51 55 52 Signal Butterfly Parport (DB-25) 56 53 ------ --------- ---------------
+295
Documentation/unshare.txt
··· 1 + 2 + unshare system call: 3 + -------------------- 4 + This document describes the new system call, unshare. The document 5 + provides an overview of the feature, why it is needed, how it can 6 + be used, its interface specification, design, implementation and 7 + how it can be tested. 8 + 9 + Change Log: 10 + ----------- 11 + version 0.1 Initial document, Janak Desai (janak@us.ibm.com), Jan 11, 2006 12 + 13 + Contents: 14 + --------- 15 + 1) Overview 16 + 2) Benefits 17 + 3) Cost 18 + 4) Requirements 19 + 5) Functional Specification 20 + 6) High Level Design 21 + 7) Low Level Design 22 + 8) Test Specification 23 + 9) Future Work 24 + 25 + 1) Overview 26 + ----------- 27 + Most legacy operating system kernels support an abstraction of threads 28 + as multiple execution contexts within a process. These kernels provide 29 + special resources and mechanisms to maintain these "threads". The Linux 30 + kernel, in a clever and simple manner, does not make distinction 31 + between processes and "threads". The kernel allows processes to share 32 + resources and thus they can achieve legacy "threads" behavior without 33 + requiring additional data structures and mechanisms in the kernel. The 34 + power of implementing threads in this manner comes not only from 35 + its simplicity but also from allowing application programmers to work 36 + outside the confinement of all-or-nothing shared resources of legacy 37 + threads. On Linux, at the time of thread creation using the clone system 38 + call, applications can selectively choose which resources to share 39 + between threads. 40 + 41 + unshare system call adds a primitive to the Linux thread model that 42 + allows threads to selectively 'unshare' any resources that were being 43 + shared at the time of their creation. unshare was conceptualized by 44 + Al Viro in the August of 2000, on the Linux-Kernel mailing list, as part 45 + of the discussion on POSIX threads on Linux. unshare augments the 46 + usefulness of Linux threads for applications that would like to control 47 + shared resources without creating a new process. unshare is a natural 48 + addition to the set of available primitives on Linux that implement 49 + the concept of process/thread as a virtual machine. 50 + 51 + 2) Benefits 52 + ----------- 53 + unshare would be useful to large application frameworks such as PAM 54 + where creating a new process to control sharing/unsharing of process 55 + resources is not possible. Since namespaces are shared by default 56 + when creating a new process using fork or clone, unshare can benefit 57 + even non-threaded applications if they have a need to disassociate 58 + from default shared namespace. The following lists two use-cases 59 + where unshare can be used. 60 + 61 + 2.1 Per-security context namespaces 62 + ----------------------------------- 63 + unshare can be used to implement polyinstantiated directories using 64 + the kernel's per-process namespace mechanism. Polyinstantiated directories, 65 + such as per-user and/or per-security context instance of /tmp, /var/tmp or 66 + per-security context instance of a user's home directory, isolate user 67 + processes when working with these directories. Using unshare, a PAM 68 + module can easily setup a private namespace for a user at login. 69 + Polyinstantiated directories are required for Common Criteria certification 70 + with Labeled System Protection Profile, however, with the availability 71 + of shared-tree feature in the Linux kernel, even regular Linux systems 72 + can benefit from setting up private namespaces at login and 73 + polyinstantiating /tmp, /var/tmp and other directories deemed 74 + appropriate by system administrators. 75 + 76 + 2.2 unsharing of virtual memory and/or open files 77 + ------------------------------------------------- 78 + Consider a client/server application where the server is processing 79 + client requests by creating processes that share resources such as 80 + virtual memory and open files. Without unshare, the server has to 81 + decide what needs to be shared at the time of creating the process 82 + which services the request. unshare allows the server an ability to 83 + disassociate parts of the context during the servicing of the 84 + request. For large and complex middleware application frameworks, this 85 + ability to unshare after the process was created can be very 86 + useful. 87 + 88 + 3) Cost 89 + ------- 90 + In order to not duplicate code and to handle the fact that unshare 91 + works on an active task (as opposed to clone/fork working on a newly 92 + allocated inactive task) unshare had to make minor reorganizational 93 + changes to copy_* functions utilized by clone/fork system call. 94 + There is a cost associated with altering existing, well tested and 95 + stable code to implement a new feature that may not get exercised 96 + extensively in the beginning. However, with proper design and code 97 + review of the changes and creation of an unshare test for the LTP 98 + the benefits of this new feature can exceed its cost. 99 + 100 + 4) Requirements 101 + --------------- 102 + unshare reverses sharing that was done using clone(2) system call, 103 + so unshare should have a similar interface as clone(2). That is, 104 + since flags in clone(int flags, void *stack) specifies what should 105 + be shared, similar flags in unshare(int flags) should specify 106 + what should be unshared. Unfortunately, this may appear to invert 107 + the meaning of the flags from the way they are used in clone(2). 108 + However, there was no easy solution that was less confusing and that 109 + allowed incremental context unsharing in future without an ABI change. 110 + 111 + unshare interface should accommodate possible future addition of 112 + new context flags without requiring a rebuild of old applications. 113 + If and when new context flags are added, unshare design should allow 114 + incremental unsharing of those resources on an as needed basis. 115 + 116 + 5) Functional Specification 117 + --------------------------- 118 + NAME 119 + unshare - disassociate parts of the process execution context 120 + 121 + SYNOPSIS 122 + #include <sched.h> 123 + 124 + int unshare(int flags); 125 + 126 + DESCRIPTION 127 + unshare allows a process to disassociate parts of its execution 128 + context that are currently being shared with other processes. Part 129 + of execution context, such as the namespace, is shared by default 130 + when a new process is created using fork(2), while other parts, 131 + such as the virtual memory, open file descriptors, etc, may be 132 + shared by explicit request to share them when creating a process 133 + using clone(2). 134 + 135 + The main use of unshare is to allow a process to control its 136 + shared execution context without creating a new process. 137 + 138 + The flags argument specifies one or bitwise-or'ed of several of 139 + the following constants. 140 + 141 + CLONE_FS 142 + If CLONE_FS is set, file system information of the caller 143 + is disassociated from the shared file system information. 144 + 145 + CLONE_FILES 146 + If CLONE_FILES is set, the file descriptor table of the 147 + caller is disassociated from the shared file descriptor 148 + table. 149 + 150 + CLONE_NEWNS 151 + If CLONE_NEWNS is set, the namespace of the caller is 152 + disassociated from the shared namespace. 153 + 154 + CLONE_VM 155 + If CLONE_VM is set, the virtual memory of the caller is 156 + disassociated from the shared virtual memory. 157 + 158 + RETURN VALUE 159 + On success, zero returned. On failure, -1 is returned and errno is 160 + 161 + ERRORS 162 + EPERM CLONE_NEWNS was specified by a non-root process (process 163 + without CAP_SYS_ADMIN). 164 + 165 + ENOMEM Cannot allocate sufficient memory to copy parts of caller's 166 + context that need to be unshared. 167 + 168 + EINVAL Invalid flag was specified as an argument. 169 + 170 + CONFORMING TO 171 + The unshare() call is Linux-specific and should not be used 172 + in programs intended to be portable. 173 + 174 + SEE ALSO 175 + clone(2), fork(2) 176 + 177 + 6) High Level Design 178 + -------------------- 179 + Depending on the flags argument, the unshare system call allocates 180 + appropriate process context structures, populates it with values from 181 + the current shared version, associates newly duplicated structures 182 + with the current task structure and releases corresponding shared 183 + versions. Helper functions of clone (copy_*) could not be used 184 + directly by unshare because of the following two reasons. 185 + 1) clone operates on a newly allocated not-yet-active task 186 + structure, where as unshare operates on the current active 187 + task. Therefore unshare has to take appropriate task_lock() 188 + before associating newly duplicated context structures 189 + 2) unshare has to allocate and duplicate all context structures 190 + that are being unshared, before associating them with the 191 + current task and releasing older shared structures. Failure 192 + do so will create race conditions and/or oops when trying 193 + to backout due to an error. Consider the case of unsharing 194 + both virtual memory and namespace. After successfully unsharing 195 + vm, if the system call encounters an error while allocating 196 + new namespace structure, the error return code will have to 197 + reverse the unsharing of vm. As part of the reversal the 198 + system call will have to go back to older, shared, vm 199 + structure, which may not exist anymore. 200 + 201 + Therefore code from copy_* functions that allocated and duplicated 202 + current context structure was moved into new dup_* functions. Now, 203 + copy_* functions call dup_* functions to allocate and duplicate 204 + appropriate context structures and then associate them with the 205 + task structure that is being constructed. unshare system call on 206 + the other hand performs the following: 207 + 1) Check flags to force missing, but implied, flags 208 + 2) For each context structure, call the corresponding unshare 209 + helper function to allocate and duplicate a new context 210 + structure, if the appropriate bit is set in the flags argument. 211 + 3) If there is no error in allocation and duplication and there 212 + are new context structures then lock the current task structure, 213 + associate new context structures with the current task structure, 214 + and release the lock on the current task structure. 215 + 4) Appropriately release older, shared, context structures. 216 + 217 + 7) Low Level Design 218 + ------------------- 219 + Implementation of unshare can be grouped in the following 4 different 220 + items: 221 + a) Reorganization of existing copy_* functions 222 + b) unshare system call service function 223 + c) unshare helper functions for each different process context 224 + d) Registration of system call number for different architectures 225 + 226 + 7.1) Reorganization of copy_* functions 227 + Each copy function such as copy_mm, copy_namespace, copy_files, 228 + etc, had roughly two components. The first component allocated 229 + and duplicated the appropriate structure and the second component 230 + linked it to the task structure passed in as an argument to the copy 231 + function. The first component was split into its own function. 232 + These dup_* functions allocated and duplicated the appropriate 233 + context structure. The reorganized copy_* functions invoked 234 + their corresponding dup_* functions and then linked the newly 235 + duplicated structures to the task structure with which the 236 + copy function was called. 237 + 238 + 7.2) unshare system call service function 239 + * Check flags 240 + Force implied flags. If CLONE_THREAD is set force CLONE_VM. 241 + If CLONE_VM is set, force CLONE_SIGHAND. If CLONE_SIGHAND is 242 + set and signals are also being shared, force CLONE_THREAD. If 243 + CLONE_NEWNS is set, force CLONE_FS. 244 + * For each context flag, invoke the corresponding unshare_* 245 + helper routine with flags passed into the system call and a 246 + reference to pointer pointing the new unshared structure 247 + * If any new structures are created by unshare_* helper 248 + functions, take the task_lock() on the current task, 249 + modify appropriate context pointers, and release the 250 + task lock. 251 + * For all newly unshared structures, release the corresponding 252 + older, shared, structures. 253 + 254 + 7.3) unshare_* helper functions 255 + For unshare_* helpers corresponding to CLONE_SYSVSEM, CLONE_SIGHAND, 256 + and CLONE_THREAD, return -EINVAL since they are not implemented yet. 257 + For others, check the flag value to see if the unsharing is 258 + required for that structure. If it is, invoke the corresponding 259 + dup_* function to allocate and duplicate the structure and return 260 + a pointer to it. 261 + 262 + 7.4) Appropriately modify architecture specific code to register the 263 + the new system call. 264 + 265 + 8) Test Specification 266 + --------------------- 267 + The test for unshare should test the following: 268 + 1) Valid flags: Test to check that clone flags for signal and 269 + signal handlers, for which unsharing is not implemented 270 + yet, return -EINVAL. 271 + 2) Missing/implied flags: Test to make sure that if unsharing 272 + namespace without specifying unsharing of filesystem, correctly 273 + unshares both namespace and filesystem information. 274 + 3) For each of the four (namespace, filesystem, files and vm) 275 + supported unsharing, verify that the system call correctly 276 + unshares the appropriate structure. Verify that unsharing 277 + them individually as well as in combination with each 278 + other works as expected. 279 + 4) Concurrent execution: Use shared memory segments and futex on 280 + an address in the shm segment to synchronize execution of 281 + about 10 threads. Have a couple of threads execute execve, 282 + a couple _exit and the rest unshare with different combination 283 + of flags. Verify that unsharing is performed as expected and 284 + that there are no oops or hangs. 285 + 286 + 9) Future Work 287 + -------------- 288 + The current implementation of unshare does not allow unsharing of 289 + signals and signal handlers. Signals are complex to begin with and 290 + to unshare signals and/or signal handlers of a currently running 291 + process is even more complex. If in the future there is a specific 292 + need to allow unsharing of signals and/or signal handlers, it can 293 + be incrementally added to unshare without affecting legacy 294 + applications using unshare. 295 +
+6
MAINTAINERS
··· 931 931 L: ext3-users@redhat.com 932 932 S: Maintained 933 933 934 + F71805F HARDWARE MONITORING DRIVER 935 + P: Jean Delvare 936 + M: khali@linux-fr.org 937 + L: lm-sensors@lm-sensors.org 938 + S: Maintained 939 + 934 940 FARSYNC SYNCHRONOUS DRIVER 935 941 P: Kevin Curtis 936 942 M: kevin.curtis@farsite.co.uk
+4 -21
arch/alpha/kernel/smp.c
··· 73 73 74 74 EXPORT_SYMBOL(cpu_online_map); 75 75 76 - /* cpus reported in the hwrpb */ 77 - static unsigned long hwrpb_cpu_present_mask __initdata = 0; 78 - 79 76 int smp_num_probed; /* Internal processor count */ 80 77 int smp_num_cpus = 1; /* Number that came online. */ 81 78 ··· 439 442 if ((cpu->flags & 0x1cc) == 0x1cc) { 440 443 smp_num_probed++; 441 444 /* Assume here that "whami" == index */ 442 - hwrpb_cpu_present_mask |= (1UL << i); 445 + cpu_set(i, cpu_possible_map); 443 446 cpu->pal_revision = boot_cpu_palrev; 444 447 } 445 448 ··· 450 453 } 451 454 } else { 452 455 smp_num_probed = 1; 453 - hwrpb_cpu_present_mask = (1UL << boot_cpuid); 456 + cpu_set(boot_cpuid, cpu_possible_map); 454 457 } 455 458 cpu_present_mask = cpumask_of_cpu(boot_cpuid); 456 459 457 460 printk(KERN_INFO "SMP: %d CPUs probed -- cpu_present_mask = %lx\n", 458 - smp_num_probed, hwrpb_cpu_present_mask); 461 + smp_num_probed, cpu_possible_map.bits[0]); 459 462 } 460 463 461 464 /* ··· 464 467 void __init 465 468 smp_prepare_cpus(unsigned int max_cpus) 466 469 { 467 - int cpu_count, i; 468 - 469 470 /* Take care of some initial bookkeeping. */ 470 471 memset(ipi_data, 0, sizeof(ipi_data)); 471 472 ··· 481 486 482 487 printk(KERN_INFO "SMP starting up secondaries.\n"); 483 488 484 - cpu_count = 1; 485 - for (i = 0; (i < NR_CPUS) && (cpu_count < max_cpus); i++) { 486 - if (i == boot_cpuid) 487 - continue; 488 - 489 - if (((hwrpb_cpu_present_mask >> i) & 1) == 0) 490 - continue; 491 - 492 - cpu_set(i, cpu_possible_map); 493 - cpu_count++; 494 - } 495 - 496 - smp_num_cpus = cpu_count; 489 + smp_num_cpus = smp_num_probed; 497 490 } 498 491 499 492 void __devinit
+41 -8
arch/arm/Kconfig
··· 10 10 default y 11 11 help 12 12 The ARM series is a line of low-power-consumption RISC chip designs 13 - licensed by ARM ltd and targeted at embedded applications and 13 + licensed by ARM Ltd and targeted at embedded applications and 14 14 handhelds such as the Compaq IPAQ. ARM-based PCs are no longer 15 - manufactured, but legacy ARM-based PC hardware remains popular in 15 + manufactured, but legacy ARM-based PC hardware remains popular in 16 16 Europe. There is an ARM Linux project with a web page at 17 17 <http://www.arm.linux.org.uk/>. 18 18 ··· 69 69 config FIQ 70 70 bool 71 71 72 + config ARCH_MTD_XIP 73 + bool 74 + 72 75 source "init/Kconfig" 73 76 74 77 menu "System Type" ··· 84 81 bool "Cirrus-CL-PS7500FE" 85 82 select TIMER_ACORN 86 83 select ISA 84 + help 85 + Support for the Cirrus Logic PS7500FE system-on-a-chip. 87 86 88 87 config ARCH_CLPS711X 89 88 bool "CLPS711x/EP721x-based" 89 + help 90 + Support for Cirrus Logic 711x/721x based boards. 90 91 91 92 config ARCH_CO285 92 93 bool "Co-EBSA285" 93 94 select FOOTBRIDGE 94 95 select FOOTBRIDGE_ADDIN 96 + help 97 + Support for Intel's EBSA285 companion chip. 95 98 96 99 config ARCH_EBSA110 97 100 bool "EBSA-110" 98 101 select ISA 99 102 help 100 103 This is an evaluation board for the StrongARM processor available 101 - from Digital. It has limited hardware on-board, including an onboard 104 + from Digital. It has limited hardware on-board, including an 102 105 Ethernet interface, two PCMCIA sockets, two serial ports and a 103 106 parallel port. 104 107 105 108 config ARCH_FOOTBRIDGE 106 109 bool "FootBridge" 107 110 select FOOTBRIDGE 111 + help 112 + Support for systems based on the DC21285 companion chip 113 + ("FootBridge"), such as the Simtec CATS and the Rebel NetWinder. 108 114 109 115 config ARCH_INTEGRATOR 110 116 bool "Integrator" 111 117 select ARM_AMBA 112 118 select ICST525 119 + help 120 + Support for ARM's Integrator platform. 113 121 114 122 config ARCH_IOP3XX 115 123 bool "IOP3xx-based" 116 124 select PCI 125 + help 126 + Support for Intel's IOP3XX (XScale) family of processors. 117 127 118 128 config ARCH_IXP4XX 119 129 bool "IXP4xx-based" 120 130 select DMABOUNCE 121 131 select PCI 132 + help 133 + Support for Intel's IXP4XX (XScale) family of processors. 122 134 123 135 config ARCH_IXP2000 124 136 bool "IXP2400/2800-based" 125 137 select PCI 138 + help 139 + Support for Intel's IXP2400/2800 (XScale) family of processors. 126 140 127 141 config ARCH_L7200 128 142 bool "LinkUp-L7200" ··· 156 136 157 137 config ARCH_PXA 158 138 bool "PXA2xx-based" 139 + select ARCH_MTD_XIP 140 + help 141 + Support for Intel's PXA2XX processor line. 159 142 160 143 config ARCH_RPC 161 144 bool "RiscPC" ··· 175 152 bool "SA1100-based" 176 153 select ISA 177 154 select ARCH_DISCONTIGMEM_ENABLE 155 + select ARCH_MTD_XIP 156 + help 157 + Support for StrongARM 11x0 based boards. 178 158 179 159 config ARCH_S3C2410 180 160 bool "Samsung S3C2410" 181 161 help 182 162 Samsung S3C2410X CPU based systems, such as the Simtec Electronics 183 163 BAST (<http://www.simtec.co.uk/products/EB110ITX/>), the IPAQ 1940 or 184 - the Samsung SMDK2410 development board (and derviatives). 164 + the Samsung SMDK2410 development board (and derivatives). 185 165 186 166 config ARCH_SHARK 187 167 bool "Shark" 188 168 select ISA 189 169 select ISA_DMA 190 170 select PCI 171 + help 172 + Support for the StrongARM based Digital DNARD machine, also known 173 + as "Shark" (<http://www.shark-linux.de/shark.html>). 191 174 192 175 config ARCH_LH7A40X 193 176 bool "Sharp LH7A40X" ··· 205 176 206 177 config ARCH_OMAP 207 178 bool "TI OMAP" 179 + help 180 + Support for TI's OMAP platform (OMAP1 and OMAP2). 208 181 209 182 config ARCH_VERSATILE 210 183 bool "Versatile" ··· 225 194 226 195 config ARCH_IMX 227 196 bool "IMX" 197 + help 198 + Support for Motorola's i.MX family of processors (MX1, MXL). 228 199 229 200 config ARCH_H720X 230 201 bool "Hynix-HMS720x-based" ··· 243 210 config ARCH_AT91RM9200 244 211 bool "AT91RM9200" 245 212 help 246 - Say Y here if you intend to run this kernel on an AT91RM9200-based 247 - board. 213 + Say Y here if you intend to run this kernel on an Atmel 214 + AT91RM9200-based board. 248 215 249 216 endchoice 250 217 ··· 450 417 To use this you need GCC version 4.0.0 or later. 451 418 452 419 config OABI_COMPAT 453 - bool "Allow old ABI binaries to run with this kernel" 454 - depends on AEABI 420 + bool "Allow old ABI binaries to run with this kernel (EXPERIMENTAL)" 421 + depends on AEABI && EXPERIMENTAL 455 422 default y 456 423 help 457 424 This option preserves the old syscall interface along with the
+1 -1
arch/arm/configs/enp2611_defconfig
··· 171 171 # 172 172 CONFIG_ZBOOT_ROM_TEXT=0x0 173 173 CONFIG_ZBOOT_ROM_BSS=0x0 174 - CONFIG_CMDLINE="console=ttyS0,57600 root=/dev/nfs ip=bootp mem=64M@0x0 pci=firmware" 174 + CONFIG_CMDLINE="console=ttyS0,57600 root=/dev/nfs ip=bootp mem=64M@0x0" 175 175 # CONFIG_XIP_KERNEL is not set 176 176 177 177 #
+1 -1
arch/arm/configs/ixdp2400_defconfig
··· 172 172 # 173 173 CONFIG_ZBOOT_ROM_TEXT=0x0 174 174 CONFIG_ZBOOT_ROM_BSS=0x0 175 - CONFIG_CMDLINE="console=ttyS0,57600 root=/dev/nfs ip=bootp mem=64M@0x0 pci=firmware" 175 + CONFIG_CMDLINE="console=ttyS0,57600 root=/dev/nfs ip=bootp mem=64M@0x0" 176 176 # CONFIG_XIP_KERNEL is not set 177 177 178 178 #
+1 -1
arch/arm/configs/ixdp2401_defconfig
··· 172 172 # 173 173 CONFIG_ZBOOT_ROM_TEXT=0x0 174 174 CONFIG_ZBOOT_ROM_BSS=0x0 175 - CONFIG_CMDLINE="console=ttyS0,115200 root=/dev/nfs ip=bootp mem=64M@0x0 pci=firmware" 175 + CONFIG_CMDLINE="console=ttyS0,115200 root=/dev/nfs ip=bootp mem=64M@0x0" 176 176 # CONFIG_XIP_KERNEL is not set 177 177 178 178 #
+1 -1
arch/arm/configs/ixdp2801_defconfig
··· 172 172 # 173 173 CONFIG_ZBOOT_ROM_TEXT=0x0 174 174 CONFIG_ZBOOT_ROM_BSS=0x0 175 - CONFIG_CMDLINE="console=ttyS0,115200 root=/dev/nfs ip=bootp mem=64M@0x0 pci=firmware ixdp2x01_clock=50000000" 175 + CONFIG_CMDLINE="console=ttyS0,115200 root=/dev/nfs ip=bootp mem=64M@0x0" 176 176 # CONFIG_XIP_KERNEL is not set 177 177 178 178 #
+38 -13
arch/arm/configs/s3c2410_defconfig
··· 1 1 # 2 2 # Automatically generated make config: don't edit 3 - # Linux kernel version: 2.6.15-rc1 4 - # Sun Nov 13 17:41:24 2005 3 + # Linux kernel version: 2.6.16-rc2 4 + # Mon Feb 6 11:17:23 2006 5 5 # 6 6 CONFIG_ARM=y 7 7 CONFIG_MMU=y 8 - CONFIG_UID16=y 9 8 CONFIG_RWSEM_GENERIC_SPINLOCK=y 10 9 CONFIG_GENERIC_CALIBRATE_DELAY=y 11 10 ··· 27 28 # CONFIG_BSD_PROCESS_ACCT is not set 28 29 CONFIG_SYSCTL=y 29 30 # CONFIG_AUDIT is not set 30 - # CONFIG_HOTPLUG is not set 31 - CONFIG_KOBJECT_UEVENT=y 32 31 # CONFIG_IKCONFIG is not set 33 32 CONFIG_INITRAMFS_SOURCE="" 33 + CONFIG_UID16=y 34 + CONFIG_CC_OPTIMIZE_FOR_SIZE=y 34 35 # CONFIG_EMBEDDED is not set 35 36 CONFIG_KALLSYMS=y 36 37 # CONFIG_KALLSYMS_ALL is not set 37 38 # CONFIG_KALLSYMS_EXTRA_PASS is not set 39 + CONFIG_HOTPLUG=y 38 40 CONFIG_PRINTK=y 39 41 CONFIG_BUG=y 42 + CONFIG_ELF_CORE=y 40 43 CONFIG_BASE_FULL=y 41 44 CONFIG_FUTEX=y 42 45 CONFIG_EPOLL=y 43 - CONFIG_CC_OPTIMIZE_FOR_SIZE=y 44 46 CONFIG_SHMEM=y 45 47 CONFIG_CC_ALIGN_FUNCTIONS=0 46 48 CONFIG_CC_ALIGN_LABELS=0 47 49 CONFIG_CC_ALIGN_LOOPS=0 48 50 CONFIG_CC_ALIGN_JUMPS=0 51 + CONFIG_SLAB=y 49 52 # CONFIG_TINY_SHMEM is not set 50 53 CONFIG_BASE_SMALL=0 54 + # CONFIG_SLOB is not set 55 + CONFIG_OBSOLETE_INTERMODULE=y 51 56 52 57 # 53 58 # Loadable module support ··· 105 102 # CONFIG_ARCH_IMX is not set 106 103 # CONFIG_ARCH_H720X is not set 107 104 # CONFIG_ARCH_AAEC2000 is not set 105 + # CONFIG_ARCH_AT91RM9200 is not set 108 106 109 107 # 110 108 # S3C24XX Implementations ··· 164 160 # Bus support 165 161 # 166 162 CONFIG_ISA=y 167 - CONFIG_ISA_DMA_API=y 168 163 169 164 # 170 165 # PCCARD (PCMCIA/CardBus) support ··· 175 172 # 176 173 # CONFIG_PREEMPT is not set 177 174 # CONFIG_NO_IDLE_HZ is not set 175 + # CONFIG_AEABI is not set 178 176 # CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set 179 177 CONFIG_SELECT_MEMORY_MODEL=y 180 178 CONFIG_FLATMEM_MANUAL=y ··· 218 214 # Power management options 219 215 # 220 216 CONFIG_PM=y 217 + CONFIG_PM_LEGACY=y 218 + # CONFIG_PM_DEBUG is not set 221 219 CONFIG_APM=y 222 220 223 221 # ··· 265 259 # SCTP Configuration (EXPERIMENTAL) 266 260 # 267 261 # CONFIG_IP_SCTP is not set 262 + 263 + # 264 + # TIPC Configuration (EXPERIMENTAL) 265 + # 266 + # CONFIG_TIPC is not set 268 267 # CONFIG_ATM is not set 269 268 # CONFIG_BRIDGE is not set 270 269 # CONFIG_VLAN_8021Q is not set ··· 287 276 # QoS and/or fair queueing 288 277 # 289 278 # CONFIG_NET_SCHED is not set 290 - # CONFIG_NET_CLS_ROUTE is not set 291 279 292 280 # 293 281 # Network testing ··· 308 298 CONFIG_PREVENT_FIRMWARE_BUILD=y 309 299 # CONFIG_FW_LOADER is not set 310 300 # CONFIG_DEBUG_DRIVER is not set 301 + 302 + # 303 + # Connector - unified userspace <-> kernelspace linker 304 + # 305 + # CONFIG_CONNECTOR is not set 311 306 312 307 # 313 308 # Memory Technology Devices (MTD) ··· 427 412 # 428 413 # Block devices 429 414 # 430 - # CONFIG_BLK_DEV_XD is not set 431 - # CONFIG_PARIDE is not set 432 415 # CONFIG_BLK_DEV_COW_COMMON is not set 433 416 CONFIG_BLK_DEV_LOOP=y 434 417 # CONFIG_BLK_DEV_CRYPTOLOOP is not set ··· 515 502 CONFIG_NET_ETHERNET=y 516 503 CONFIG_MII=y 517 504 # CONFIG_NET_VENDOR_3COM is not set 518 - # CONFIG_LANCE is not set 519 505 # CONFIG_NET_VENDOR_SMC is not set 520 506 # CONFIG_SMC91X is not set 521 507 CONFIG_DM9000=y ··· 619 607 # CONFIG_ROCKETPORT is not set 620 608 # CONFIG_CYCLADES is not set 621 609 # CONFIG_DIGIEPCA is not set 622 - # CONFIG_ESPSERIAL is not set 623 610 # CONFIG_MOXA_INTELLIO is not set 624 611 # CONFIG_MOXA_SMARTIO is not set 625 612 # CONFIG_ISI is not set 626 613 # CONFIG_SYNCLINKMP is not set 614 + # CONFIG_SYNCLINK_GT is not set 627 615 # CONFIG_N_HDLC is not set 628 616 # CONFIG_RISCOM8 is not set 629 617 # CONFIG_SPECIALIX is not set ··· 637 625 CONFIG_SERIAL_8250=y 638 626 CONFIG_SERIAL_8250_CONSOLE=y 639 627 CONFIG_SERIAL_8250_NR_UARTS=8 628 + CONFIG_SERIAL_8250_RUNTIME_UARTS=4 640 629 CONFIG_SERIAL_8250_EXTENDED=y 641 630 CONFIG_SERIAL_8250_MANY_PORTS=y 642 631 CONFIG_SERIAL_8250_SHARE_IRQ=y ··· 700 687 # 701 688 # TPM devices 702 689 # 690 + # CONFIG_TCG_TPM is not set 703 691 # CONFIG_TELCLOCK is not set 704 692 705 693 # ··· 743 729 # CONFIG_I2C_DEBUG_ALGO is not set 744 730 # CONFIG_I2C_DEBUG_BUS is not set 745 731 # CONFIG_I2C_DEBUG_CHIP is not set 732 + 733 + # 734 + # SPI support 735 + # 736 + # CONFIG_SPI is not set 737 + # CONFIG_SPI_MASTER is not set 746 738 747 739 # 748 740 # Hardware Monitoring support ··· 883 863 # CONFIG_JFS_FS is not set 884 864 # CONFIG_FS_POSIX_ACL is not set 885 865 # CONFIG_XFS_FS is not set 866 + # CONFIG_OCFS2_FS is not set 886 867 # CONFIG_MINIX_FS is not set 887 868 CONFIG_ROMFS_FS=y 888 869 CONFIG_INOTIFY=y ··· 918 897 # CONFIG_HUGETLB_PAGE is not set 919 898 CONFIG_RAMFS=y 920 899 # CONFIG_RELAYFS_FS is not set 900 + # CONFIG_CONFIGFS_FS is not set 921 901 922 902 # 923 903 # Miscellaneous filesystems ··· 987 965 # CONFIG_SGI_PARTITION is not set 988 966 # CONFIG_ULTRIX_PARTITION is not set 989 967 # CONFIG_SUN_PARTITION is not set 968 + # CONFIG_KARMA_PARTITION is not set 990 969 # CONFIG_EFI_PARTITION is not set 991 970 992 971 # ··· 1043 1020 # Kernel hacking 1044 1021 # 1045 1022 # CONFIG_PRINTK_TIME is not set 1046 - CONFIG_DEBUG_KERNEL=y 1047 1023 CONFIG_MAGIC_SYSRQ=y 1024 + CONFIG_DEBUG_KERNEL=y 1048 1025 CONFIG_LOG_BUF_SHIFT=16 1049 1026 CONFIG_DETECT_SOFTLOCKUP=y 1050 1027 # CONFIG_SCHEDSTATS is not set 1051 1028 # CONFIG_DEBUG_SLAB is not set 1029 + CONFIG_DEBUG_MUTEXES=y 1052 1030 # CONFIG_DEBUG_SPINLOCK is not set 1053 1031 # CONFIG_DEBUG_SPINLOCK_SLEEP is not set 1054 1032 # CONFIG_DEBUG_KOBJECT is not set ··· 1058 1034 # CONFIG_DEBUG_FS is not set 1059 1035 # CONFIG_DEBUG_VM is not set 1060 1036 CONFIG_FRAME_POINTER=y 1037 + CONFIG_FORCED_INLINING=y 1061 1038 # CONFIG_RCU_TORTURE_TEST is not set 1062 1039 CONFIG_DEBUG_USER=y 1063 1040 # CONFIG_DEBUG_WAITQ is not set
+4 -4
arch/arm/kernel/calls.S
··· 291 291 CALL(sys_mq_getsetattr) 292 292 /* 280 */ CALL(sys_waitid) 293 293 CALL(sys_socket) 294 - CALL(sys_bind) 295 - CALL(sys_connect) 294 + CALL(ABI(sys_bind, sys_oabi_bind)) 295 + CALL(ABI(sys_connect, sys_oabi_connect)) 296 296 CALL(sys_listen) 297 297 /* 285 */ CALL(sys_accept) 298 298 CALL(sys_getsockname) 299 299 CALL(sys_getpeername) 300 300 CALL(sys_socketpair) 301 301 CALL(sys_send) 302 - /* 290 */ CALL(sys_sendto) 302 + /* 290 */ CALL(ABI(sys_sendto, sys_oabi_sendto)) 303 303 CALL(sys_recv) 304 304 CALL(sys_recvfrom) 305 305 CALL(sys_shutdown) 306 306 CALL(sys_setsockopt) 307 307 /* 295 */ CALL(sys_getsockopt) 308 - CALL(sys_sendmsg) 308 + CALL(ABI(sys_sendmsg, sys_oabi_sendmsg)) 309 309 CALL(sys_recvmsg) 310 310 CALL(ABI(sys_semop, sys_oabi_semop)) 311 311 CALL(sys_semget)
+16 -1
arch/arm/kernel/entry-armv.S
··· 333 333 @ from the exception stack 334 334 335 335 #if __LINUX_ARM_ARCH__ < 6 && !defined(CONFIG_NEEDS_SYSCALL_FOR_CMPXCHG) 336 + #ifndef CONFIG_MMU 337 + #warning "NPTL on non MMU needs fixing" 338 + #else 336 339 @ make sure our user space atomic helper is aborted 337 340 cmp r2, #TASK_SIZE 338 341 bichs r3, r3, #PSR_Z_BIT 342 + #endif 339 343 #endif 340 344 341 345 @ ··· 709 705 * The C flag is also set if *ptr was changed to allow for assembly 710 706 * optimization in the calling code. 711 707 * 712 - * Note: this routine already includes memory barriers as needed. 708 + * Notes: 709 + * 710 + * - This routine already includes memory barriers as needed. 711 + * 712 + * - A failure might be transient, i.e. it is possible, although unlikely, 713 + * that "failure" be returned even if *ptr == oldval. 713 714 * 714 715 * For example, a user space atomic_add implementation could look like this: 715 716 * ··· 765 756 * exception happening just after the str instruction which would 766 757 * clear the Z flag although the exchange was done. 767 758 */ 759 + #ifdef CONFIG_MMU 768 760 teq ip, ip @ set Z flag 769 761 ldr ip, [r2] @ load current val 770 762 add r3, r2, #1 @ prepare store ptr 771 763 teqeq ip, r0 @ compare with oldval if still allowed 772 764 streq r1, [r3, #-1]! @ store newval if still allowed 773 765 subs r0, r2, r3 @ if r2 == r3 the str occured 766 + #else 767 + #warning "NPTL on non MMU needs fixing" 768 + mov r0, #-1 769 + adds r0, r0, #0 770 + #endif 774 771 mov pc, lr 775 772 776 773 #else
+71
arch/arm/kernel/sys_oabi-compat.c
··· 59 59 * struct sembuf loses its padding with EABI. Since arrays of them are 60 60 * used they have to be copyed to remove the padding. Compatibility wrappers 61 61 * provided below. 62 + * 63 + * sys_bind: 64 + * sys_connect: 65 + * sys_sendmsg: 66 + * sys_sendto: 67 + * 68 + * struct sockaddr_un loses its padding with EABI. Since the size of the 69 + * structure is used as a validation test in unix_mkname(), we need to 70 + * change the length argument to 110 whenever it is 112. Compatibility 71 + * wrappers provided below. 62 72 */ 63 73 64 74 #include <linux/syscalls.h> ··· 77 67 #include <linux/fcntl.h> 78 68 #include <linux/eventpoll.h> 79 69 #include <linux/sem.h> 70 + #include <linux/socket.h> 80 71 #include <asm/ipc.h> 81 72 #include <asm/uaccess.h> 82 73 ··· 348 337 return sys_ipc(call, first, second, third, ptr, fifth); 349 338 } 350 339 } 340 + 341 + asmlinkage long sys_oabi_bind(int fd, struct sockaddr __user *addr, int addrlen) 342 + { 343 + sa_family_t sa_family; 344 + if (addrlen == 112 && 345 + get_user(sa_family, &addr->sa_family) == 0 && 346 + sa_family == AF_UNIX) 347 + addrlen = 110; 348 + return sys_bind(fd, addr, addrlen); 349 + } 350 + 351 + asmlinkage long sys_oabi_connect(int fd, struct sockaddr __user *addr, int addrlen) 352 + { 353 + sa_family_t sa_family; 354 + if (addrlen == 112 && 355 + get_user(sa_family, &addr->sa_family) == 0 && 356 + sa_family == AF_UNIX) 357 + addrlen = 110; 358 + return sys_connect(fd, addr, addrlen); 359 + } 360 + 361 + asmlinkage long sys_oabi_sendto(int fd, void __user *buff, 362 + size_t len, unsigned flags, 363 + struct sockaddr __user *addr, 364 + int addrlen) 365 + { 366 + sa_family_t sa_family; 367 + if (addrlen == 112 && 368 + get_user(sa_family, &addr->sa_family) == 0 && 369 + sa_family == AF_UNIX) 370 + addrlen = 110; 371 + return sys_sendto(fd, buff, len, flags, addr, addrlen); 372 + } 373 + 374 + asmlinkage long sys_oabi_sendmsg(int fd, struct msghdr __user *msg, unsigned flags) 375 + { 376 + struct sockaddr __user *addr; 377 + int msg_namelen; 378 + sa_family_t sa_family; 379 + if (msg && 380 + get_user(msg_namelen, &msg->msg_namelen) == 0 && 381 + msg_namelen == 112 && 382 + get_user(addr, &msg->msg_name) == 0 && 383 + get_user(sa_family, &addr->sa_family) == 0 && 384 + sa_family == AF_UNIX) 385 + { 386 + /* 387 + * HACK ALERT: there is a limit to how much backward bending 388 + * we should do for what is actually a transitional 389 + * compatibility layer. This already has known flaws with 390 + * a few ioctls that we don't intend to fix. Therefore 391 + * consider this blatent hack as another one... and take care 392 + * to run for cover. In most cases it will "just work fine". 393 + * If it doesn't, well, tough. 394 + */ 395 + put_user(110, &msg->msg_namelen); 396 + } 397 + return sys_sendmsg(fd, msg, flags); 398 + } 399 +
+2
arch/arm/mach-clps711x/Kconfig
··· 24 24 25 25 config ARCH_CLEP7312 26 26 bool "CLEP7312" 27 + help 28 + Boards based on the Cirrus Logic 7212/7312 chips. 27 29 28 30 config ARCH_EDB7211 29 31 bool "EDB7211"
-1
arch/arm/mach-imx/mx1ads.c
··· 27 27 #include <asm/mach/arch.h> 28 28 #include <linux/interrupt.h> 29 29 #include "generic.h" 30 - #include <asm/serial.h> 31 30 32 31 static struct resource cs89x0_resources[] = { 33 32 [0] = {
+1
arch/arm/mach-ixp2000/enp2611.c
··· 106 106 { 107 107 ixp2000_reg_write(IXP2000_PCI_ADDR_EXT, 0x00100000); 108 108 ixp2000_pci_preinit(); 109 + pcibios_setup("firmware"); 109 110 } 110 111 111 112 static inline int enp2611_pci_valid_device(struct pci_bus *bus,
+1
arch/arm/mach-ixp2000/ixdp2400.c
··· 68 68 { 69 69 ixp2000_reg_write(IXP2000_PCI_ADDR_EXT, 0x00100000); 70 70 ixp2000_pci_preinit(); 71 + pcibios_setup("firmware"); 71 72 } 72 73 73 74 int ixdp2400_pci_setup(int nr, struct pci_sys_data *sys)
+4 -1
arch/arm/mach-ixp2000/ixdp2x01.c
··· 212 212 { 213 213 ixp2000_reg_write(IXP2000_PCI_ADDR_EXT, 0x00000000); 214 214 ixp2000_pci_preinit(); 215 + pcibios_setup("firmware"); 215 216 } 216 217 217 218 #define DEVPIN(dev, pin) ((pin) | ((dev) << 3)) ··· 300 299 301 300 int __init ixdp2x01_pci_init(void) 302 301 { 303 - pci_common_init(&ixdp2x01_pci); 302 + if (machine_is_ixdp2401() || machine_is_ixdp2801()) 303 + pci_common_init(&ixdp2x01_pci); 304 + 304 305 return 0; 305 306 } 306 307
+2 -1
arch/arm/mach-omap1/board-generic.c
··· 30 30 31 31 static void __init omap_generic_init_irq(void) 32 32 { 33 + omap1_init_common_hw(); 33 34 omap_init_irq(); 34 35 } 35 36 ··· 105 104 106 105 static void __init omap_generic_map_io(void) 107 106 { 108 - omap_map_common_io(); 107 + omap1_map_common_io(); 109 108 } 110 109 111 110 MACHINE_START(OMAP_GENERIC, "Generic OMAP1510/1610/1710")
+2 -1
arch/arm/mach-omap1/board-h2.c
··· 128 128 129 129 static void __init h2_init_irq(void) 130 130 { 131 + omap1_init_common_hw(); 131 132 omap_init_irq(); 132 133 omap_gpio_init(); 133 134 h2_init_smc91x(); ··· 195 194 196 195 static void __init h2_map_io(void) 197 196 { 198 - omap_map_common_io(); 197 + omap1_map_common_io(); 199 198 } 200 199 201 200 MACHINE_START(OMAP_H2, "TI-H2")
+2 -1
arch/arm/mach-omap1/board-h3.c
··· 203 203 204 204 void h3_init_irq(void) 205 205 { 206 + omap1_init_common_hw(); 206 207 omap_init_irq(); 207 208 omap_gpio_init(); 208 209 h3_init_smc91x(); ··· 211 210 212 211 static void __init h3_map_io(void) 213 212 { 214 - omap_map_common_io(); 213 + omap1_map_common_io(); 215 214 } 216 215 217 216 MACHINE_START(OMAP_H3, "TI OMAP1710 H3 board")
+2 -1
arch/arm/mach-omap1/board-innovator.c
··· 181 181 182 182 void innovator_init_irq(void) 183 183 { 184 + omap1_init_common_hw(); 184 185 omap_init_irq(); 185 186 omap_gpio_init(); 186 187 #ifdef CONFIG_ARCH_OMAP15XX ··· 286 285 287 286 static void __init innovator_map_io(void) 288 287 { 289 - omap_map_common_io(); 288 + omap1_map_common_io(); 290 289 291 290 #ifdef CONFIG_ARCH_OMAP15XX 292 291 if (cpu_is_omap1510()) {
+2 -1
arch/arm/mach-omap1/board-netstar.c
··· 65 65 66 66 static void __init netstar_init_irq(void) 67 67 { 68 + omap1_init_common_hw(); 68 69 omap_init_irq(); 69 70 omap_gpio_init(); 70 71 } ··· 109 108 110 109 static void __init netstar_map_io(void) 111 110 { 112 - omap_map_common_io(); 111 + omap1_map_common_io(); 113 112 } 114 113 115 114 #define MACHINE_PANICED 1
+2 -1
arch/arm/mach-omap1/board-osk.c
··· 169 169 170 170 static void __init osk_init_irq(void) 171 171 { 172 + omap1_init_common_hw(); 172 173 omap_init_irq(); 173 174 omap_gpio_init(); 174 175 osk_init_smc91x(); ··· 270 269 271 270 static void __init osk_map_io(void) 272 271 { 273 - omap_map_common_io(); 272 + omap1_map_common_io(); 274 273 } 275 274 276 275 MACHINE_START(OMAP_OSK, "TI-OSK")
+2 -1
arch/arm/mach-omap1/board-palmte.c
··· 34 34 35 35 static void __init omap_generic_init_irq(void) 36 36 { 37 + omap1_init_common_hw(); 37 38 omap_init_irq(); 38 39 } 39 40 ··· 73 72 74 73 static void __init omap_generic_map_io(void) 75 74 { 76 - omap_map_common_io(); 75 + omap1_map_common_io(); 77 76 } 78 77 79 78 MACHINE_START(OMAP_PALMTE, "OMAP310 based Palm Tungsten E")
+2 -1
arch/arm/mach-omap1/board-perseus2.c
··· 144 144 145 145 void omap_perseus2_init_irq(void) 146 146 { 147 + omap1_init_common_hw(); 147 148 omap_init_irq(); 148 149 omap_gpio_init(); 149 150 perseus2_init_smc91x(); ··· 161 160 162 161 static void __init omap_perseus2_map_io(void) 163 162 { 164 - omap_map_common_io(); 163 + omap1_map_common_io(); 165 164 iotable_init(omap_perseus2_io_desc, 166 165 ARRAY_SIZE(omap_perseus2_io_desc)); 167 166
+2 -1
arch/arm/mach-omap1/board-voiceblue.c
··· 162 162 163 163 static void __init voiceblue_init_irq(void) 164 164 { 165 + omap1_init_common_hw(); 165 166 omap_init_irq(); 166 167 omap_gpio_init(); 167 168 } ··· 207 206 208 207 static void __init voiceblue_map_io(void) 209 208 { 210 - omap_map_common_io(); 209 + omap1_map_common_io(); 211 210 } 212 211 213 212 #define MACHINE_PANICED 1
+25 -17
arch/arm/mach-omap1/io.c
··· 13 13 #include <linux/kernel.h> 14 14 #include <linux/init.h> 15 15 16 + #include <asm/tlb.h> 16 17 #include <asm/mach/map.h> 17 18 #include <asm/io.h> 18 19 #include <asm/arch/mux.h> ··· 84 83 }; 85 84 #endif 86 85 87 - static int initialized = 0; 88 - 89 - static void __init _omap_map_io(void) 86 + /* 87 + * Maps common IO regions for omap1. This should only get called from 88 + * board specific init. 89 + */ 90 + void __init omap1_map_common_io(void) 90 91 { 91 - initialized = 1; 92 - 93 - /* We have to initialize the IO space mapping before we can run 94 - * cpu_is_omapxxx() macros. */ 95 92 iotable_init(omap_io_desc, ARRAY_SIZE(omap_io_desc)); 93 + 94 + /* Normally devicemaps_init() would flush caches and tlb after 95 + * mdesc->map_io(), but we must also do it here because of the CPU 96 + * revision check below. 97 + */ 98 + local_flush_tlb_all(); 99 + flush_cache_all(); 100 + 101 + /* We want to check CPU revision early for cpu_is_omapxxxx() macros. 102 + * IO space mapping must be initialized before we can do that. 103 + */ 96 104 omap_check_revision(); 97 105 98 106 #ifdef CONFIG_ARCH_OMAP730 ··· 121 111 #endif 122 112 123 113 omap_sram_init(); 114 + } 124 115 116 + /* 117 + * Common low-level hardware init for omap1. This should only get called from 118 + * board specific init. 119 + */ 120 + void __init omap1_init_common_hw() 121 + { 125 122 /* REVISIT: Refer to OMAP5910 Errata, Advisory SYS_1: "Timeout Abort 126 123 * on a Posted Write in the TIPB Bridge". 127 124 */ ··· 138 121 /* Must init clocks early to assure that timer interrupt works 139 122 */ 140 123 omap1_clk_init(); 141 - } 142 124 143 - /* 144 - * This should only get called from board specific init 145 - */ 146 - void __init omap_map_common_io(void) 147 - { 148 - if (!initialized) { 149 - _omap_map_io(); 150 - omap1_mux_init(); 151 - } 125 + omap1_mux_init(); 152 126 } 153 127
+2 -1
arch/arm/mach-omap2/board-generic.c
··· 33 33 34 34 static void __init omap_generic_init_irq(void) 35 35 { 36 + omap2_init_common_hw(); 36 37 omap_init_irq(); 37 38 } 38 39 ··· 65 64 66 65 static void __init omap_generic_map_io(void) 67 66 { 68 - omap_map_common_io(); 67 + omap2_map_common_io(); 69 68 } 70 69 71 70 MACHINE_START(OMAP_GENERIC, "Generic OMAP24xx")
+2 -1
arch/arm/mach-omap2/board-h4.c
··· 136 136 137 137 static void __init omap_h4_init_irq(void) 138 138 { 139 + omap2_init_common_hw(); 139 140 omap_init_irq(); 140 141 omap_gpio_init(); 141 142 h4_init_smc91x(); ··· 182 181 183 182 static void __init omap_h4_map_io(void) 184 183 { 185 - omap_map_common_io(); 184 + omap2_map_common_io(); 186 185 } 187 186 188 187 MACHINE_START(OMAP_H4, "OMAP2420 H4 board")
+1 -1
arch/arm/mach-realview/core.c
··· 182 182 static void realview_oscvco_set(struct clk *clk, struct icst307_vco vco) 183 183 { 184 184 void __iomem *sys_lock = __io_address(REALVIEW_SYS_BASE) + REALVIEW_SYS_LOCK_OFFSET; 185 - void __iomem *sys_osc = __io_address(REALVIEW_SYS_BASE) + REALVIEW_SYS_OSC1_OFFSET; 185 + void __iomem *sys_osc = __io_address(REALVIEW_SYS_BASE) + REALVIEW_SYS_OSC4_OFFSET; 186 186 u32 val; 187 187 188 188 val = readl(sys_osc) & ~0x7ffff;
+33 -10
arch/arm/mach-s3c2410/clock.c
··· 40 40 #include <linux/mutex.h> 41 41 42 42 #include <asm/hardware.h> 43 - #include <asm/atomic.h> 44 43 #include <asm/irq.h> 45 44 #include <asm/io.h> 46 45 ··· 58 59 void inline s3c24xx_clk_enable(unsigned int clocks, unsigned int enable) 59 60 { 60 61 unsigned long clkcon; 61 - unsigned long flags; 62 - 63 - local_irq_save(flags); 64 62 65 63 clkcon = __raw_readl(S3C2410_CLKCON); 66 - clkcon &= ~clocks; 67 64 68 65 if (enable) 69 66 clkcon |= clocks; 67 + else 68 + clkcon &= ~clocks; 70 69 71 70 /* ensure none of the special function bits set */ 72 71 clkcon &= ~(S3C2410_CLKCON_IDLE|S3C2410_CLKCON_POWER); 73 72 74 73 __raw_writel(clkcon, S3C2410_CLKCON); 75 - 76 - local_irq_restore(flags); 77 74 } 78 75 79 76 /* enable and disable calls for use with the clk struct */ ··· 133 138 134 139 int clk_enable(struct clk *clk) 135 140 { 136 - if (IS_ERR(clk)) 141 + if (IS_ERR(clk) || clk == NULL) 137 142 return -EINVAL; 138 143 139 - return (clk->enable)(clk, 1); 144 + clk_enable(clk->parent); 145 + 146 + mutex_lock(&clocks_mutex); 147 + 148 + if ((clk->usage++) == 0) 149 + (clk->enable)(clk, 1); 150 + 151 + mutex_unlock(&clocks_mutex); 152 + return 0; 140 153 } 141 154 142 155 void clk_disable(struct clk *clk) 143 156 { 144 - if (!IS_ERR(clk)) 157 + if (IS_ERR(clk) || clk == NULL) 158 + return; 159 + 160 + mutex_lock(&clocks_mutex); 161 + 162 + if ((--clk->usage) == 0) 145 163 (clk->enable)(clk, 0); 164 + 165 + mutex_unlock(&clocks_mutex); 166 + clk_disable(clk->parent); 146 167 } 147 168 148 169 ··· 372 361 if (clk->enable == NULL) 373 362 clk->enable = clk_null_enable; 374 363 364 + /* if this is a standard clock, set the usage state */ 365 + 366 + if (clk->ctrlbit) { 367 + unsigned long clkcon = __raw_readl(S3C2410_CLKCON); 368 + 369 + clk->usage = (clkcon & clk->ctrlbit) ? 1 : 0; 370 + } 371 + 375 372 /* add to the list of available clocks */ 376 373 377 374 mutex_lock(&clocks_mutex); ··· 421 402 * the LCD clock if it is not needed. 422 403 */ 423 404 405 + mutex_lock(&clocks_mutex); 406 + 424 407 s3c24xx_clk_enable(S3C2410_CLKCON_NAND, 0); 425 408 s3c24xx_clk_enable(S3C2410_CLKCON_USBH, 0); 426 409 s3c24xx_clk_enable(S3C2410_CLKCON_USBD, 0); 427 410 s3c24xx_clk_enable(S3C2410_CLKCON_ADC, 0); 428 411 s3c24xx_clk_enable(S3C2410_CLKCON_IIC, 0); 429 412 s3c24xx_clk_enable(S3C2410_CLKCON_SPI, 0); 413 + 414 + mutex_unlock(&clocks_mutex); 430 415 431 416 /* assume uart clocks are correctly setup */ 432 417
+1
arch/arm/mach-s3c2410/clock.h
··· 16 16 struct clk *parent; 17 17 const char *name; 18 18 int id; 19 + int usage; 19 20 unsigned long rate; 20 21 unsigned long ctrlbit; 21 22 int (*enable)(struct clk *, int enable);
+5
arch/arm/mach-s3c2410/devs.c
··· 275 275 }, 276 276 [1] = { 277 277 .start = IRQ_TC, 278 + .end = IRQ_TC, 279 + .flags = IORESOURCE_IRQ, 280 + }, 281 + [2] = { 282 + .start = IRQ_ADC, 278 283 .end = IRQ_ADC, 279 284 .flags = IORESOURCE_IRQ, 280 285 }
+9
arch/arm/plat-omap/sram.c
··· 17 17 #include <linux/init.h> 18 18 19 19 #include <asm/mach/map.h> 20 + #include <asm/tlb.h> 20 21 #include <asm/io.h> 21 22 #include <asm/cacheflush.h> 22 23 ··· 95 94 printk(KERN_INFO "SRAM: Mapped pa 0x%08lx to va 0x%08lx size: 0x%lx\n", 96 95 omap_sram_io_desc[0].pfn, omap_sram_io_desc[0].virtual, 97 96 omap_sram_io_desc[0].length); 97 + 98 + /* 99 + * Normally devicemaps_init() would flush caches and tlb after 100 + * mdesc->map_io(), but since we're called from map_io(), we 101 + * must do it here. 102 + */ 103 + local_flush_tlb_all(); 104 + flush_cache_all(); 98 105 99 106 /* 100 107 * Looks like we need to preserve some bootloader code at the
+4 -4
arch/cris/arch-v10/kernel/ptrace.c
··· 202 202 int i; 203 203 unsigned long tmp; 204 204 205 + ret = 0; 205 206 for (i = 0; i <= PT_MAX; i++) { 206 207 tmp = get_reg(child, i); 207 208 208 209 if (put_user(tmp, datap)) { 209 210 ret = -EFAULT; 210 - goto out_tsk; 211 + break; 211 212 } 212 213 213 214 data += sizeof(long); 214 215 } 215 216 216 - ret = 0; 217 217 break; 218 218 } 219 219 ··· 222 222 int i; 223 223 unsigned long tmp; 224 224 225 + ret = 0; 225 226 for (i = 0; i <= PT_MAX; i++) { 226 227 if (get_user(tmp, datap)) { 227 228 ret = -EFAULT; 228 - goto out_tsk; 229 + break; 229 230 } 230 231 231 232 if (i == PT_DCCR) { ··· 238 237 data += sizeof(long); 239 238 } 240 239 241 - ret = 0; 242 240 break; 243 241 } 244 242
-1
arch/cris/kernel/setup.c
··· 24 24 /* 25 25 * Setup options 26 26 */ 27 - struct drive_info_struct { char dummy[32]; } drive_info; 28 27 struct screen_info screen_info; 29 28 30 29 extern int root_mountflags;
+1
arch/i386/kernel/syscall_table.S
··· 309 309 .long sys_faccessat 310 310 .long sys_pselect6 311 311 .long sys_ppoll 312 + .long sys_unshare /* 310 */
-10
arch/ia64/dig/setup.c
··· 25 25 #include <asm/machvec.h> 26 26 #include <asm/system.h> 27 27 28 - /* 29 - * This is here so we can use the CMOS detection in ide-probe.c to 30 - * determine what drives are present. In theory, we don't need this 31 - * as the auto-detection could be done via ide-probe.c:do_probe() but 32 - * in practice that would be much slower, which is painful when 33 - * running in the simulator. Note that passing zeroes in DRIVE_INFO 34 - * is sufficient (the IDE driver will autodetect the drive geometry). 35 - */ 36 - char drive_info[4*16]; 37 - 38 28 void __init 39 29 dig_setup (char **cmdline_p) 40 30 {
+4 -12
arch/ia64/kernel/efi.c
··· 410 410 efi_config_table_t *config_tables; 411 411 efi_char16_t *c16; 412 412 u64 efi_desc_size; 413 - char *cp, *end, vendor[100] = "unknown"; 413 + char *cp, vendor[100] = "unknown"; 414 414 extern char saved_command_line[]; 415 415 int i; 416 416 417 417 /* it's too early to be able to use the standard kernel command line support... */ 418 418 for (cp = saved_command_line; *cp; ) { 419 419 if (memcmp(cp, "mem=", 4) == 0) { 420 - cp += 4; 421 - mem_limit = memparse(cp, &end); 422 - if (end != cp) 423 - break; 424 - cp = end; 420 + mem_limit = memparse(cp + 4, &cp); 425 421 } else if (memcmp(cp, "max_addr=", 9) == 0) { 426 - cp += 9; 427 - max_addr = GRANULEROUNDDOWN(memparse(cp, &end)); 428 - if (end != cp) 429 - break; 430 - cp = end; 422 + max_addr = GRANULEROUNDDOWN(memparse(cp + 9, &cp)); 431 423 } else { 432 424 while (*cp != ' ' && *cp) 433 425 ++cp; ··· 450 458 /* Show what we know for posterity */ 451 459 c16 = __va(efi.systab->fw_vendor); 452 460 if (c16) { 453 - for (i = 0;i < (int) sizeof(vendor) && *c16; ++i) 461 + for (i = 0;i < (int) sizeof(vendor) - 1 && *c16; ++i) 454 462 vendor[i] = *c16++; 455 463 vendor[i] = '\0'; 456 464 }
+1
arch/ia64/kernel/head.S
··· 352 352 mov ar.rsc=0 // place RSE in enforced lazy mode 353 353 ;; 354 354 loadrs // clear the dirty partition 355 + mov IA64_KR(PER_CPU_DATA)=r0 // clear physical per-CPU base 355 356 ;; 356 357 mov ar.bspstore=r2 // establish the new RSE stack 357 358 ;;
+4
arch/ia64/kernel/setup.c
··· 71 71 EXPORT_SYMBOL(__per_cpu_offset); 72 72 #endif 73 73 74 + extern void ia64_setup_printk_clock(void); 75 + 74 76 DEFINE_PER_CPU(struct cpuinfo_ia64, cpu_info); 75 77 DEFINE_PER_CPU(unsigned long, local_per_cpu_offset); 76 78 DEFINE_PER_CPU(unsigned long, ia64_phys_stacked_size_p8); ··· 446 444 447 445 /* process SAL system table: */ 448 446 ia64_sal_init(efi.sal_systab); 447 + 448 + ia64_setup_printk_clock(); 449 449 450 450 #ifdef CONFIG_SMP 451 451 cpu_physical_id(0) = hard_smp_processor_id();
+27
arch/ia64/kernel/time.c
··· 278 278 } 279 279 } 280 280 EXPORT_SYMBOL(udelay); 281 + 282 + static unsigned long long ia64_itc_printk_clock(void) 283 + { 284 + if (ia64_get_kr(IA64_KR_PER_CPU_DATA)) 285 + return sched_clock(); 286 + return 0; 287 + } 288 + 289 + static unsigned long long ia64_default_printk_clock(void) 290 + { 291 + return (unsigned long long)(jiffies_64 - INITIAL_JIFFIES) * 292 + (1000000000/HZ); 293 + } 294 + 295 + unsigned long long (*ia64_printk_clock)(void) = &ia64_default_printk_clock; 296 + 297 + unsigned long long printk_clock(void) 298 + { 299 + return ia64_printk_clock(); 300 + } 301 + 302 + void __init 303 + ia64_setup_printk_clock(void) 304 + { 305 + if (!(sal_platform_features & IA64_SAL_PLATFORM_FEATURE_ITC_DRIFT)) 306 + ia64_printk_clock = ia64_itc_printk_clock; 307 + }
+3 -2
arch/ia64/sn/kernel/mca.c
··· 3 3 * License. See the file "COPYING" in the main directory of this archive 4 4 * for more details. 5 5 * 6 - * Copyright (c) 2000-2004 Silicon Graphics, Inc. All Rights Reserved. 6 + * Copyright (c) 2000-2006 Silicon Graphics, Inc. All Rights Reserved. 7 7 */ 8 8 9 9 #include <linux/types.h> ··· 137 137 138 138 static int __init sn_salinfo_init(void) 139 139 { 140 - salinfo_platform_oemdata = &sn_salinfo_platform_oemdata; 140 + if (ia64_platform_is("sn2")) 141 + salinfo_platform_oemdata = &sn_salinfo_platform_oemdata; 141 142 return 0; 142 143 } 143 144
+27 -27
arch/ia64/sn/kernel/setup.c
··· 67 67 extern void (*ia64_mark_idle) (int); 68 68 extern void snidle(int); 69 69 extern unsigned char acpi_kbd_controller_present; 70 + extern unsigned long long (*ia64_printk_clock)(void); 70 71 71 72 unsigned long sn_rtc_cycles_per_second; 72 73 EXPORT_SYMBOL(sn_rtc_cycles_per_second); ··· 124 123 .orig_video_isVGA = 1, 125 124 .orig_video_points = 16 126 125 }; 127 - 128 - /* 129 - * This is here so we can use the CMOS detection in ide-probe.c to 130 - * determine what drives are present. In theory, we don't need this 131 - * as the auto-detection could be done via ide-probe.c:do_probe() but 132 - * in practice that would be much slower, which is painful when 133 - * running in the simulator. Note that passing zeroes in DRIVE_INFO 134 - * is sufficient (the IDE driver will autodetect the drive geometry). 135 - */ 136 - #ifdef CONFIG_IA64_GENERIC 137 - extern char drive_info[4 * 16]; 138 - #else 139 - char drive_info[4 * 16]; 140 - #endif 141 126 142 127 /* 143 128 * This routine can only be used during init, since ··· 359 372 } 360 373 } 361 374 375 + static unsigned long sn2_rtc_initial; 376 + 377 + static unsigned long long ia64_sn2_printk_clock(void) 378 + { 379 + unsigned long rtc_now = rtc_time(); 380 + 381 + return (rtc_now - sn2_rtc_initial) * 382 + (1000000000 / sn_rtc_cycles_per_second); 383 + } 384 + 362 385 /** 363 386 * sn_setup - SN platform setup routine 364 387 * @cmdline_p: kernel command line ··· 383 386 u32 version = sn_sal_rev(); 384 387 extern void sn_cpu_init(void); 385 388 389 + sn2_rtc_initial = rtc_time(); 386 390 ia64_sn_plat_set_error_handling_features(); // obsolete 387 391 ia64_sn_set_os_feature(OSF_MCA_SLV_TO_OS_INIT_SLV); 388 392 ia64_sn_set_os_feature(OSF_FEAT_LOG_SBES); ··· 435 437 */ 436 438 build_cnode_tables(); 437 439 438 - /* 439 - * Old PROMs do not provide an ACPI FADT. Disable legacy keyboard 440 - * support here so we don't have to listen to failed keyboard probe 441 - * messages. 442 - */ 443 - if (version <= 0x0209 && acpi_kbd_controller_present) { 444 - printk(KERN_INFO "Disabling legacy keyboard support as prom " 445 - "is too old and doesn't provide FADT\n"); 446 - acpi_kbd_controller_present = 0; 447 - } 448 - 449 - printk("SGI SAL version %x.%02x\n", version >> 8, version & 0x00FF); 450 - 451 440 status = 452 441 ia64_sal_freq_base(SAL_FREQ_BASE_REALTIME_CLOCK, &ticks_per_sec, 453 442 &drift); ··· 447 462 sn_rtc_cycles_per_second = ticks_per_sec; 448 463 449 464 platform_intr_list[ACPI_INTERRUPT_CPEI] = IA64_CPE_VECTOR; 465 + 466 + ia64_printk_clock = ia64_sn2_printk_clock; 467 + 468 + /* 469 + * Old PROMs do not provide an ACPI FADT. Disable legacy keyboard 470 + * support here so we don't have to listen to failed keyboard probe 471 + * messages. 472 + */ 473 + if (version <= 0x0209 && acpi_kbd_controller_present) { 474 + printk(KERN_INFO "Disabling legacy keyboard support as prom " 475 + "is too old and doesn't provide FADT\n"); 476 + acpi_kbd_controller_present = 0; 477 + } 478 + 479 + printk("SGI SAL version %x.%02x\n", version >> 8, version & 0x00FF); 450 480 451 481 /* 452 482 * we set the default root device to /dev/hda
+4 -1
arch/ia64/sn/kernel/sn2/sn_hwperf.c
··· 3 3 * License. See the file "COPYING" in the main directory of this archive 4 4 * for more details. 5 5 * 6 - * Copyright (C) 2004-2005 Silicon Graphics, Inc. All rights reserved. 6 + * Copyright (C) 2004-2006 Silicon Graphics, Inc. All rights reserved. 7 7 * 8 8 * SGI Altix topology and hardware performance monitoring API. 9 9 * Mark Goodwin <markgw@sgi.com>. ··· 972 972 static int __devinit sn_hwperf_misc_register_init(void) 973 973 { 974 974 int e; 975 + 976 + if (!ia64_platform_is("sn2")) 977 + return 0; 975 978 976 979 sn_hwperf_init(); 977 980
-5
arch/m32r/kernel/m32r_ksyms.c
··· 18 18 #include <asm/irq.h> 19 19 #include <asm/tlbflush.h> 20 20 21 - #if defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_HD) || defined(CONFIG_BLK_DEV_IDE_MODULE) || defined(CONFIG_BLK_DEV_HD_MODULE) 22 - extern struct drive_info_struct drive_info; 23 - EXPORT_SYMBOL(drive_info); 24 - #endif 25 - 26 21 /* platform dependent support */ 27 22 EXPORT_SYMBOL(boot_cpu_data); 28 23 EXPORT_SYMBOL(dump_fpu);
-6
arch/m32r/kernel/setup.c
··· 37 37 extern void init_mmu(void); 38 38 #endif 39 39 40 - #if defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_HD) \ 41 - || defined(CONFIG_BLK_DEV_IDE_MODULE) \ 42 - || defined(CONFIG_BLK_DEV_HD_MODULE) 43 - struct drive_info_struct { char dummy[32]; } drive_info; 44 - #endif 45 - 46 40 extern char _end[]; 47 41 48 42 /*
+8
arch/m68knommu/kernel/process.c
··· 39 39 40 40 asmlinkage void ret_from_fork(void); 41 41 42 + /* 43 + * The following aren't currently used. 44 + */ 45 + void (*pm_idle)(void); 46 + EXPORT_SYMBOL(pm_idle); 47 + 48 + void (*pm_power_off)(void); 49 + EXPORT_SYMBOL(pm_power_off); 42 50 43 51 /* 44 52 * The idle loop on an m68knommu..
+1 -1
arch/mips/cobalt/setup.c
··· 140 140 uart.type = PORT_UNKNOWN; 141 141 uart.uartclk = 18432000; 142 142 uart.irq = COBALT_SERIAL_IRQ; 143 - uart.flags = STD_COM_FLAGS; 143 + uart.flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST; 144 144 uart.iobase = 0xc800000; 145 145 uart.iotype = UPIO_PORT; 146 146
+3 -2
arch/mips/kernel/process.c
··· 4 4 * for more details. 5 5 * 6 6 * Copyright (C) 1994 - 1999, 2000 by Ralf Baechle and others. 7 + * Copyright (C) 2005, 2006 by Ralf Baechle (ralf@linux-mips.org) 7 8 * Copyright (C) 1999, 2000 Silicon Graphics, Inc. 8 9 * Copyright (C) 2004 Thiemo Seufer 9 10 */ ··· 59 58 } 60 59 } 61 60 62 - extern int do_signal(sigset_t *oldset, struct pt_regs *regs); 63 - extern int do_signal32(sigset_t *oldset, struct pt_regs *regs); 61 + extern void do_signal(struct pt_regs *regs); 62 + extern void do_signal32(struct pt_regs *regs); 64 63 65 64 /* 66 65 * Native o32 and N64 ABI without DSP ASE
+17
arch/mips/kernel/scall32-o32.S
··· 617 617 sys sys_inotify_init 0 618 618 sys sys_inotify_add_watch 3 /* 4285 */ 619 619 sys sys_inotify_rm_watch 2 620 + sys sys_migrate_pages 4 621 + sys sys_openat 4 622 + sys sys_mkdirat 3 623 + sys sys_mknodat 4 /* 4290 */ 624 + sys sys_fchownat 5 625 + sys sys_futimesat 3 626 + sys sys_newfstatat 4 627 + sys sys_unlinkat 3 628 + sys sys_renameat 4 /* 4295 */ 629 + sys sys_linkat 4 630 + sys sys_symlinkat 3 631 + sys sys_readlinkat 4 632 + sys sys_fchmodat 3 633 + sys sys_faccessat 3 /* 4300 */ 634 + sys sys_pselect6 6 635 + sys sys_ppoll 5 636 + sys sys_unshare 1 620 637 .endm 621 638 622 639 /* We pre-compute the number of _instruction_ bytes needed to
+17
arch/mips/kernel/scall64-64.S
··· 443 443 PTR sys_inotify_init 444 444 PTR sys_inotify_add_watch 445 445 PTR sys_inotify_rm_watch /* 5245 */ 446 + PTR sys_migrate_pages 447 + PTR sys_openat 448 + PTR sys_mkdirat 449 + PTR sys_mknodat 450 + PTR sys_fchownat /* 5250 */ 451 + PTR sys_futimesat 452 + PTR sys_newfstatat 453 + PTR sys_unlinkat 454 + PTR sys_renameat 455 + PTR sys_linkat /* 5255 */ 456 + PTR sys_symlinkat 457 + PTR sys_readlinkat 458 + PTR sys_fchmodat 459 + PTR sys_faccessat 460 + PTR sys_pselect6 /* 5260 */ 461 + PTR sys_ppoll 462 + PTR sys_unshare
+17
arch/mips/kernel/scall64-n32.S
··· 369 369 PTR sys_inotify_init 370 370 PTR sys_inotify_add_watch 371 371 PTR sys_inotify_rm_watch 372 + PTR sys_migrate_pages /* 6250 */ 373 + PTR sys_openat 374 + PTR sys_mkdirat 375 + PTR sys_mknodat 376 + PTR sys_fchownat 377 + PTR sys_futimesat /* 6255 */ 378 + PTR sys_newfstatat 379 + PTR sys_unlinkat 380 + PTR sys_renameat 381 + PTR sys_linkat 382 + PTR sys_symlinkat /* 6260 */ 383 + PTR sys_readlinkat 384 + PTR sys_fchmodat 385 + PTR sys_faccessat 386 + PTR sys_pselect6 387 + PTR sys_ppoll /* 6265 */ 388 + PTR sys_unshare
+17
arch/mips/kernel/scall64-o32.S
··· 491 491 PTR sys_inotify_init 492 492 PTR sys_inotify_add_watch /* 4285 */ 493 493 PTR sys_inotify_rm_watch 494 + PTR sys_migrate_pages 495 + PTR compat_sys_openat 496 + PTR sys_mkdirat 497 + PTR sys_mknodat /* 4290 */ 498 + PTR sys_fchownat 499 + PTR compat_sys_futimesat 500 + PTR compat_sys_newfstatat 501 + PTR sys_unlinkat 502 + PTR sys_renameat /* 4295 */ 503 + PTR sys_linkat 504 + PTR sys_symlinkat 505 + PTR sys_readlinkat 506 + PTR sys_fchmodat 507 + PTR sys_faccessat /* 4300 */ 508 + PTR sys_pselect6 509 + PTR sys_ppoll 510 + PTR sys_unshare 494 511 .size sys_call_table,.-sys_call_table
+50 -38
arch/mips/kernel/signal.c
··· 39 39 40 40 #define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP))) 41 41 42 - int do_signal(sigset_t *oldset, struct pt_regs *regs); 43 - 44 42 /* 45 43 * Atomically swap in the new signal mask, and wait for a signal. 46 44 */ ··· 48 50 __attribute_used__ noinline static int 49 51 _sys_sigsuspend(nabi_no_regargs struct pt_regs regs) 50 52 { 51 - sigset_t saveset, newset; 53 + sigset_t newset; 52 54 sigset_t __user *uset; 53 55 54 56 uset = (sigset_t __user *) regs.regs[4]; ··· 57 59 sigdelsetmask(&newset, ~_BLOCKABLE); 58 60 59 61 spin_lock_irq(&current->sighand->siglock); 60 - saveset = current->blocked; 62 + current->saved_sigmask = current->blocked; 61 63 current->blocked = newset; 62 64 recalc_sigpending(); 63 65 spin_unlock_irq(&current->sighand->siglock); 64 66 65 - regs.regs[2] = EINTR; 66 - regs.regs[7] = 1; 67 - while (1) { 68 - current->state = TASK_INTERRUPTIBLE; 69 - schedule(); 70 - if (do_signal(&saveset, &regs)) 71 - return -EINTR; 72 - } 67 + current->state = TASK_INTERRUPTIBLE; 68 + schedule(); 69 + set_thread_flag(TIF_RESTORE_SIGMASK); 70 + return -ERESTARTNOHAND; 73 71 } 74 72 #endif 75 73 ··· 73 79 __attribute_used__ noinline static int 74 80 _sys_rt_sigsuspend(nabi_no_regargs struct pt_regs regs) 75 81 { 76 - sigset_t saveset, newset; 82 + sigset_t newset; 77 83 sigset_t __user *unewset; 78 84 size_t sigsetsize; 79 85 ··· 88 94 sigdelsetmask(&newset, ~_BLOCKABLE); 89 95 90 96 spin_lock_irq(&current->sighand->siglock); 91 - saveset = current->blocked; 97 + current->saved_sigmask = current->blocked; 92 98 current->blocked = newset; 93 99 recalc_sigpending(); 94 100 spin_unlock_irq(&current->sighand->siglock); 95 101 96 - regs.regs[2] = EINTR; 97 - regs.regs[7] = 1; 98 - while (1) { 99 - current->state = TASK_INTERRUPTIBLE; 100 - schedule(); 101 - if (do_signal(&saveset, &regs)) 102 - return -EINTR; 103 - } 102 + current->state = TASK_INTERRUPTIBLE; 103 + schedule(); 104 + set_thread_flag(TIF_RESTORE_SIGMASK); 105 + return -ERESTARTNOHAND; 104 106 } 105 107 106 108 #ifdef CONFIG_TRAD_SIGNALS ··· 305 315 current->comm, current->pid, 306 316 frame, regs->cp0_epc, frame->regs[31]); 307 317 #endif 308 - return 1; 318 + return 0; 309 319 310 320 give_sigsegv: 311 321 force_sigsegv(signr, current); 312 - return 0; 322 + return -EFAULT; 313 323 } 314 324 #endif 315 325 ··· 365 375 current->comm, current->pid, 366 376 frame, regs->cp0_epc, regs->regs[31]); 367 377 #endif 368 - return 1; 378 + return 0; 369 379 370 380 give_sigsegv: 371 381 force_sigsegv(signr, current); 372 - return 0; 382 + return -EFAULT; 373 383 } 374 384 375 385 static inline int handle_signal(unsigned long sig, siginfo_t *info, ··· 383 393 regs->regs[2] = EINTR; 384 394 break; 385 395 case ERESTARTSYS: 386 - if(!(ka->sa.sa_flags & SA_RESTART)) { 396 + if (!(ka->sa.sa_flags & SA_RESTART)) { 387 397 regs->regs[2] = EINTR; 388 398 break; 389 399 } ··· 410 420 return ret; 411 421 } 412 422 413 - int do_signal(sigset_t *oldset, struct pt_regs *regs) 423 + void do_signal(struct pt_regs *regs) 414 424 { 415 425 struct k_sigaction ka; 426 + sigset_t *oldset; 416 427 siginfo_t info; 417 428 int signr; 418 429 ··· 423 432 * if so. 424 433 */ 425 434 if (!user_mode(regs)) 426 - return 1; 435 + return; 427 436 428 437 if (try_to_freeze()) 429 438 goto no_signal; 430 439 431 - if (!oldset) 440 + if (test_thread_flag(TIF_RESTORE_SIGMASK)) 441 + oldset = &current->saved_sigmask; 442 + else 432 443 oldset = &current->blocked; 433 444 445 + 434 446 signr = get_signal_to_deliver(&info, &ka, regs, NULL); 435 - if (signr > 0) 436 - return handle_signal(signr, &info, &ka, oldset, regs); 447 + if (signr > 0) { 448 + /* Whee! Actually deliver the signal. */ 449 + if (handle_signal(signr, &info, &ka, oldset, regs) == 0) { 450 + /* 451 + * A signal was successfully delivered; the saved 452 + * sigmask will have been stored in the signal frame, 453 + * and will be restored by sigreturn, so we can simply 454 + * clear the TIF_RESTORE_SIGMASK flag. 455 + */ 456 + if (test_thread_flag(TIF_RESTORE_SIGMASK)) 457 + clear_thread_flag(TIF_RESTORE_SIGMASK); 458 + } 459 + } 437 460 438 461 no_signal: 439 462 /* ··· 468 463 regs->cp0_epc -= 4; 469 464 } 470 465 } 471 - return 0; 466 + 467 + /* 468 + * If there's no signal to deliver, we just put the saved sigmask 469 + * back 470 + */ 471 + if (test_thread_flag(TIF_RESTORE_SIGMASK)) { 472 + clear_thread_flag(TIF_RESTORE_SIGMASK); 473 + sigprocmask(SIG_SETMASK, &current->saved_sigmask, NULL); 474 + } 472 475 } 473 476 474 477 /* 475 478 * notification of userspace execution resumption 476 - * - triggered by current->work.notify_resume 479 + * - triggered by the TIF_WORK_MASK flags 477 480 */ 478 - asmlinkage void do_notify_resume(struct pt_regs *regs, sigset_t *oldset, 481 + asmlinkage void do_notify_resume(struct pt_regs *regs, void *unused, 479 482 __u32 thread_info_flags) 480 483 { 481 484 /* deal with pending signal delivery */ 482 - if (thread_info_flags & _TIF_SIGPENDING) { 483 - current->thread.abi->do_signal(oldset, regs); 484 - } 485 + if (thread_info_flags & (_TIF_SIGPENDING | _TIF_RESTORE_SIGMASK)) 486 + current->thread.abi->do_signal(regs); 485 487 }
+4 -4
arch/mips/kernel/signal32.c
··· 694 694 current->comm, current->pid, 695 695 frame, regs->cp0_epc, frame->sf_code); 696 696 #endif 697 - return 1; 697 + return 0; 698 698 699 699 give_sigsegv: 700 700 force_sigsegv(signr, current); 701 - return 0; 701 + return -EFAULT; 702 702 } 703 703 704 704 int setup_rt_frame_32(struct k_sigaction * ka, struct pt_regs *regs, ··· 765 765 current->comm, current->pid, 766 766 frame, regs->cp0_epc, frame->rs_code); 767 767 #endif 768 - return 1; 768 + return 0; 769 769 770 770 give_sigsegv: 771 771 force_sigsegv(signr, current); 772 - return 0; 772 + return -EFAULT; 773 773 } 774 774 775 775 static inline int handle_signal(unsigned long sig, siginfo_t *info,
+2 -2
arch/mips/kernel/signal_n32.c
··· 186 186 current->comm, current->pid, 187 187 frame, regs->cp0_epc, regs->regs[31]); 188 188 #endif 189 - return 1; 189 + return 0; 190 190 191 191 give_sigsegv: 192 192 force_sigsegv(signr, current); 193 - return 0; 193 + return -EFAULT; 194 194 }
+26 -22
arch/mips/kernel/syscall.c
··· 212 212 int error; 213 213 char * filename; 214 214 215 - filename = getname((char *) (long)regs.regs[4]); 215 + filename = getname((char __user *) (long)regs.regs[4]); 216 216 error = PTR_ERR(filename); 217 217 if (IS_ERR(filename)) 218 218 goto out; 219 - error = do_execve(filename, (char **) (long)regs.regs[5], 220 - (char **) (long)regs.regs[6], &regs); 219 + error = do_execve(filename, (char __user *__user *) (long)regs.regs[5], 220 + (char __user *__user *) (long)regs.regs[6], &regs); 221 221 putname(filename); 222 222 223 223 out: ··· 227 227 /* 228 228 * Compacrapability ... 229 229 */ 230 - asmlinkage int sys_uname(struct old_utsname * name) 230 + asmlinkage int sys_uname(struct old_utsname __user * name) 231 231 { 232 232 if (name && !copy_to_user(name, &system_utsname, sizeof (*name))) 233 233 return 0; ··· 237 237 /* 238 238 * Compacrapability ... 239 239 */ 240 - asmlinkage int sys_olduname(struct oldold_utsname * name) 240 + asmlinkage int sys_olduname(struct oldold_utsname __user * name) 241 241 { 242 242 int error; 243 243 ··· 274 274 asmlinkage int _sys_sysmips(int cmd, long arg1, int arg2, int arg3) 275 275 { 276 276 int tmp, len; 277 - char *name; 277 + char __user *name; 278 278 279 279 switch(cmd) { 280 280 case SETNAME: { ··· 283 283 if (!capable(CAP_SYS_ADMIN)) 284 284 return -EPERM; 285 285 286 - name = (char *) arg1; 286 + name = (char __user *) arg1; 287 287 288 288 len = strncpy_from_user(nodename, name, __NEW_UTS_LEN); 289 289 if (len < 0) ··· 324 324 * This is really horribly ugly. 325 325 */ 326 326 asmlinkage int sys_ipc (uint call, int first, int second, 327 - unsigned long third, void *ptr, long fifth) 327 + unsigned long third, void __user *ptr, long fifth) 328 328 { 329 329 int version, ret; 330 330 ··· 333 333 334 334 switch (call) { 335 335 case SEMOP: 336 - return sys_semtimedop (first, (struct sembuf *)ptr, second, 337 - NULL); 336 + return sys_semtimedop (first, (struct sembuf __user *)ptr, 337 + second, NULL); 338 338 case SEMTIMEDOP: 339 - return sys_semtimedop (first, (struct sembuf *)ptr, second, 340 - (const struct timespec __user *)fifth); 339 + return sys_semtimedop (first, (struct sembuf __user *)ptr, 340 + second, 341 + (const struct timespec __user *)fifth); 341 342 case SEMGET: 342 343 return sys_semget (first, second, third); 343 344 case SEMCTL: { 344 345 union semun fourth; 345 346 if (!ptr) 346 347 return -EINVAL; 347 - if (get_user(fourth.__pad, (void **) ptr)) 348 + if (get_user(fourth.__pad, (void *__user *) ptr)) 348 349 return -EFAULT; 349 350 return sys_semctl (first, second, third, fourth); 350 351 } 351 352 352 353 case MSGSND: 353 - return sys_msgsnd (first, (struct msgbuf *) ptr, 354 + return sys_msgsnd (first, (struct msgbuf __user *) ptr, 354 355 second, third); 355 356 case MSGRCV: 356 357 switch (version) { ··· 361 360 return -EINVAL; 362 361 363 362 if (copy_from_user(&tmp, 364 - (struct ipc_kludge *) ptr, 363 + (struct ipc_kludge __user *) ptr, 365 364 sizeof (tmp))) 366 365 return -EFAULT; 367 366 return sys_msgrcv (first, tmp.msgp, second, ··· 369 368 } 370 369 default: 371 370 return sys_msgrcv (first, 372 - (struct msgbuf *) ptr, 371 + (struct msgbuf __user *) ptr, 373 372 second, fifth, third); 374 373 } 375 374 case MSGGET: 376 375 return sys_msgget ((key_t) first, second); 377 376 case MSGCTL: 378 - return sys_msgctl (first, second, (struct msqid_ds *) ptr); 377 + return sys_msgctl (first, second, 378 + (struct msqid_ds __user *) ptr); 379 379 380 380 case SHMAT: 381 381 switch (version) { 382 382 default: { 383 383 ulong raddr; 384 - ret = do_shmat (first, (char *) ptr, second, &raddr); 384 + ret = do_shmat (first, (char __user *) ptr, second, 385 + &raddr); 385 386 if (ret) 386 387 return ret; 387 - return put_user (raddr, (ulong *) third); 388 + return put_user (raddr, (ulong __user *) third); 388 389 } 389 390 case 1: /* iBCS2 emulator entry point */ 390 391 if (!segment_eq(get_fs(), get_ds())) 391 392 return -EINVAL; 392 - return do_shmat (first, (char *) ptr, second, (ulong *) third); 393 + return do_shmat (first, (char __user *) ptr, second, 394 + (ulong *) third); 393 395 } 394 396 case SHMDT: 395 - return sys_shmdt ((char *)ptr); 397 + return sys_shmdt ((char __user *)ptr); 396 398 case SHMGET: 397 399 return sys_shmget (first, second, third); 398 400 case SHMCTL: 399 401 return sys_shmctl (first, second, 400 - (struct shmid_ds *) ptr); 402 + (struct shmid_ds __user *) ptr); 401 403 default: 402 404 return -ENOSYS; 403 405 }
+2 -2
arch/mips/lasat/setup.c
··· 134 134 135 135 memset(&s, 0, sizeof(s)); 136 136 137 - s.flags = STD_COM_FLAGS; 138 - s.iotype = SERIAL_IO_MEM; 137 + s.flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST; 138 + s.iotype = UPIO_MEM; 139 139 140 140 if (mips_machtype == MACH_LASAT_100) { 141 141 s.uartclk = LASAT_BASE_BAUD_100 * 16;
+2 -2
arch/mips/mips-boards/atlas/atlas_setup.c
··· 82 82 #endif 83 83 s.irq = ATLASINT_UART; 84 84 s.uartclk = ATLAS_BASE_BAUD * 16; 85 - s.flags = ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST | ASYNC_AUTO_IRQ; 86 - s.iotype = SERIAL_IO_PORT; 85 + s.flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST | UPF_AUTO_IRQ; 86 + s.iotype = UPIO_PORT; 87 87 s.regshift = 3; 88 88 89 89 if (early_serial_setup(&s) != 0) {
+2 -2
arch/mips/mips-boards/sead/sead_setup.c
··· 71 71 #endif 72 72 s.irq = MIPSCPU_INT_BASE + MIPSCPU_INT_UART0; 73 73 s.uartclk = SEAD_BASE_BAUD * 16; 74 - s.flags = ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST | ASYNC_AUTO_IRQ; 75 - s.iotype = 0; 74 + s.flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST | UPF_AUTO_IRQ; 75 + s.iotype = UPIO_PORT; 76 76 s.regshift = 3; 77 77 78 78 if (early_serial_setup(&s) != 0) {
+2 -2
arch/mips/mips-boards/sim/sim_setup.c
··· 88 88 but poll for now */ 89 89 s.irq = 0; 90 90 s.uartclk = BASE_BAUD * 16; 91 - s.flags = ASYNC_BOOT_AUTOCONF | UPF_SKIP_TEST; 92 - s.iotype = SERIAL_IO_PORT | ASYNC_SKIP_TEST; 91 + s.flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST; 92 + s.iotype = UPIO_PORT; 93 93 s.regshift = 0; 94 94 s.timeout = 4; 95 95
+1 -1
arch/mips/momentum/jaguar_atx/ja-console.c
··· 93 93 up.uartclk = JAGUAR_ATX_UART_CLK; 94 94 up.regshift = 2; 95 95 up.iotype = UPIO_MEM; 96 - up.flags = ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST; 96 + up.flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST; 97 97 up.line = 0; 98 98 99 99 if (early_serial_setup(&up))
+4 -4
arch/mips/philips/pnx8550/common/platform.c
··· 66 66 [0] = { 67 67 .port = { 68 68 .type = PORT_IP3106, 69 - .iotype = SERIAL_IO_MEM, 69 + .iotype = UPIO_MEM, 70 70 .membase = (void __iomem *)PNX8550_UART_PORT0, 71 71 .mapbase = PNX8550_UART_PORT0, 72 72 .irq = PNX8550_UART_INT(0), 73 73 .uartclk = 3692300, 74 74 .fifosize = 16, 75 75 .ops = &ip3106_pops, 76 - .flags = ASYNC_BOOT_AUTOCONF, 76 + .flags = UPF_BOOT_AUTOCONF, 77 77 .line = 0, 78 78 }, 79 79 }, 80 80 [1] = { 81 81 .port = { 82 82 .type = PORT_IP3106, 83 - .iotype = SERIAL_IO_MEM, 83 + .iotype = UPIO_MEM, 84 84 .membase = (void __iomem *)PNX8550_UART_PORT1, 85 85 .mapbase = PNX8550_UART_PORT1, 86 86 .irq = PNX8550_UART_INT(1), 87 87 .uartclk = 3692300, 88 88 .fifosize = 16, 89 89 .ops = &ip3106_pops, 90 - .flags = ASYNC_BOOT_AUTOCONF, 90 + .flags = UPF_BOOT_AUTOCONF, 91 91 .line = 1, 92 92 }, 93 93 },
+1 -1
arch/mips/pmc-sierra/yosemite/setup.c
··· 185 185 up.uartclk = TITAN_UART_CLK; 186 186 up.regshift = 0; 187 187 up.iotype = UPIO_MEM; 188 - up.flags = ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST; 188 + up.flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST; 189 189 up.line = 0; 190 190 191 191 if (early_serial_setup(&up))
+4 -9
arch/mips/sgi-ip32/ip32-setup.c
··· 66 66 #include <linux/tty.h> 67 67 #include <linux/serial.h> 68 68 #include <linux/serial_core.h> 69 - extern int early_serial_setup(struct uart_port *port); 70 - 71 - #define STD_COM_FLAGS (ASYNC_SKIP_TEST) 72 - #define BASE_BAUD (1843200 / 16) 73 - 74 69 #endif /* CONFIG_SERIAL_8250 */ 75 70 76 71 /* An arbitrary time; this can be decreased if reliability looks good */ ··· 105 110 o2_serial[0].type = PORT_16550A; 106 111 o2_serial[0].line = 0; 107 112 o2_serial[0].irq = MACEISA_SERIAL1_IRQ; 108 - o2_serial[0].flags = STD_COM_FLAGS; 109 - o2_serial[0].uartclk = BASE_BAUD * 16; 113 + o2_serial[0].flags = UPF_SKIP_TEST; 114 + o2_serial[0].uartclk = 1843200; 110 115 o2_serial[0].iotype = UPIO_MEM; 111 116 o2_serial[0].membase = (char *)&mace->isa.serial1; 112 117 o2_serial[0].fifosize = 14; ··· 116 121 o2_serial[1].type = PORT_16550A; 117 122 o2_serial[1].line = 1; 118 123 o2_serial[1].irq = MACEISA_SERIAL2_IRQ; 119 - o2_serial[1].flags = STD_COM_FLAGS; 120 - o2_serial[1].uartclk = BASE_BAUD * 16; 124 + o2_serial[1].flags = UPF_SKIP_TEST; 125 + o2_serial[1].uartclk = 1843200; 121 126 o2_serial[1].iotype = UPIO_MEM; 122 127 o2_serial[1].membase = (char *)&mace->isa.serial2; 123 128 o2_serial[1].fifosize = 14;
+7 -3
arch/parisc/hpux/sys_hpux.c
··· 468 468 if ( opcode == 1 ) { /* GETFSIND */ 469 469 len = strlen_user((char *)arg1); 470 470 printk(KERN_DEBUG "len of arg1 = %d\n", len); 471 - 472 - fsname = (char *) kmalloc(len+1, GFP_KERNEL); 471 + if (len == 0) 472 + return 0; 473 + fsname = (char *) kmalloc(len, GFP_KERNEL); 473 474 if ( !fsname ) { 474 475 printk(KERN_DEBUG "failed to kmalloc fsname\n"); 475 476 return 0; 476 477 } 477 478 478 - if ( copy_from_user(fsname, (char *)arg1, len+1) ) { 479 + if ( copy_from_user(fsname, (char *)arg1, len) ) { 479 480 printk(KERN_DEBUG "failed to copy_from_user fsname\n"); 480 481 kfree(fsname); 481 482 return 0; 482 483 } 484 + 485 + /* String could be altered by userspace after strlen_user() */ 486 + fsname[len] = '\0'; 483 487 484 488 printk(KERN_DEBUG "that is '%s' as (char *)\n", fsname); 485 489 if ( !strcmp(fsname, "hfs") ) {
+1 -1
arch/powerpc/kernel/fpu.S
··· 66 66 #else 67 67 ld r4,PACACURRENT(r13) 68 68 addi r5,r4,THREAD /* Get THREAD */ 69 - ld r4,THREAD_FPEXC_MODE(r5) 69 + lwz r4,THREAD_FPEXC_MODE(r5) 70 70 ori r12,r12,MSR_FP 71 71 or r12,r12,r4 72 72 std r12,_MSR(r1)
+3 -2
arch/powerpc/kernel/head_64.S
··· 749 749 750 750 .globl decrementer_iSeries_masked 751 751 decrementer_iSeries_masked: 752 + /* We may not have a valid TOC pointer in here. */ 752 753 li r11,1 753 754 ld r12,PACALPPACAPTR(r13) 754 755 stb r11,LPPACADECRINT(r12) 755 - LOAD_REG_ADDRBASE(r12,tb_ticks_per_jiffy) 756 - lwz r12,ADDROFF(tb_ticks_per_jiffy)(r12) 756 + LOAD_REG_IMMEDIATE(r12, tb_ticks_per_jiffy) 757 + lwz r12,0(r12) 757 758 mtspr SPRN_DEC,r12 758 759 /* fall through */ 759 760
+6 -3
arch/powerpc/kernel/iommu.c
··· 334 334 335 335 spin_unlock_irqrestore(&(tbl->it_lock), flags); 336 336 337 - /* Make sure updates are seen by hardware */ 338 - mb(); 339 - 340 337 DBG("mapped %d elements:\n", outcount); 341 338 342 339 /* For the sake of iommu_unmap_sg, we clear out the length in the ··· 344 347 outs->dma_address = DMA_ERROR_CODE; 345 348 outs->dma_length = 0; 346 349 } 350 + 351 + /* Make sure updates are seen by hardware */ 352 + mb(); 353 + 347 354 return outcount; 348 355 349 356 failure: ··· 359 358 npages = (PAGE_ALIGN(s->dma_address + s->dma_length) - vaddr) 360 359 >> PAGE_SHIFT; 361 360 __iommu_free(tbl, vaddr, npages); 361 + s->dma_address = DMA_ERROR_CODE; 362 + s->dma_length = 0; 362 363 } 363 364 } 364 365 spin_unlock_irqrestore(&(tbl->it_lock), flags);
+35 -3
arch/powerpc/kernel/prom.c
··· 491 491 size = 16; 492 492 finish_node(allnodes, &size, 1); 493 493 size -= 16; 494 - end = start = (unsigned long) __va(lmb_alloc(size, 128)); 494 + 495 + if (0 == size) 496 + end = start = 0; 497 + else 498 + end = start = (unsigned long)__va(lmb_alloc(size, 128)); 499 + 495 500 finish_node(allnodes, &end, 0); 496 501 BUG_ON(end != start + size); 497 502 ··· 1403 1398 1404 1399 read_lock(&devtree_lock); 1405 1400 np = from ? from->allnext : allnodes; 1406 - for (; np != 0; np = np->allnext) 1407 - if (np->name != 0 && strcasecmp(np->name, name) == 0 1401 + for (; np != NULL; np = np->allnext) 1402 + if (np->name != NULL && strcasecmp(np->name, name) == 0 1408 1403 && of_node_get(np)) 1409 1404 break; 1410 1405 if (from) ··· 1922 1917 1923 1918 return 0; 1924 1919 } 1920 + 1921 + #ifdef CONFIG_KEXEC 1922 + /* We may have allocated the flat device tree inside the crash kernel region 1923 + * in prom_init. If so we need to move it out into regular memory. */ 1924 + void kdump_move_device_tree(void) 1925 + { 1926 + unsigned long start, end; 1927 + struct boot_param_header *new; 1928 + 1929 + start = __pa((unsigned long)initial_boot_params); 1930 + end = start + initial_boot_params->totalsize; 1931 + 1932 + if (end < crashk_res.start || start > crashk_res.end) 1933 + return; 1934 + 1935 + new = (struct boot_param_header*) 1936 + __va(lmb_alloc(initial_boot_params->totalsize, PAGE_SIZE)); 1937 + 1938 + memcpy(new, initial_boot_params, initial_boot_params->totalsize); 1939 + 1940 + initial_boot_params = new; 1941 + 1942 + DBG("Flat device tree blob moved to %p\n", initial_boot_params); 1943 + 1944 + /* XXX should we unreserve the old DT? */ 1945 + } 1946 + #endif /* CONFIG_KEXEC */
+4
arch/powerpc/kernel/prom_init.c
··· 2098 2098 */ 2099 2099 prom_init_stdout(); 2100 2100 2101 + /* Bail if this is a kdump kernel. */ 2102 + if (PHYSICAL_START > 0) 2103 + prom_panic("Error: You can't boot a kdump kernel from OF!\n"); 2104 + 2101 2105 /* 2102 2106 * Check for an initrd 2103 2107 */
+3 -1
arch/powerpc/kernel/prom_parse.c
··· 465 465 if (parent == NULL) 466 466 return NULL; 467 467 bus = of_match_bus(parent); 468 - if (strcmp(bus->name, "pci")) 468 + if (strcmp(bus->name, "pci")) { 469 + of_node_put(parent); 469 470 return NULL; 471 + } 470 472 bus->count_cells(dev, &na, &ns); 471 473 of_node_put(parent); 472 474 if (!OF_CHECK_COUNTS(na, ns))
+6 -6
arch/powerpc/kernel/rtas.c
··· 22 22 23 23 #include <asm/prom.h> 24 24 #include <asm/rtas.h> 25 + #include <asm/hvcall.h> 25 26 #include <asm/semaphore.h> 26 27 #include <asm/machdep.h> 27 28 #include <asm/page.h> ··· 566 565 #ifdef CONFIG_PPC_PSERIES 567 566 static void rtas_percpu_suspend_me(void *info) 568 567 { 568 + int i; 569 569 long rc; 570 570 long flags; 571 571 struct rtas_suspend_me_data *data = ··· 589 587 590 588 if (rc == H_Continue) { 591 589 data->waiting = 0; 592 - rtas_call(ibm_suspend_me_token, 0, 1, 593 - data->args->args); 590 + data->args->args[data->args->nargs] = 591 + rtas_call(ibm_suspend_me_token, 0, 1, NULL); 592 + for_each_cpu(i) 593 + plpar_hcall_norets(H_PROD,i); 594 594 } else { 595 595 data->waiting = -EBUSY; 596 596 printk(KERN_ERR "Error on H_Join hypervisor call\n"); 597 597 } 598 598 599 599 out: 600 - /* before we restore interrupts, make sure we don't 601 - * generate a spurious soft lockup errors 602 - */ 603 - touch_softlockup_watchdog(); 604 600 local_irq_restore(flags); 605 601 return; 606 602 }
+1 -2
arch/powerpc/kernel/rtas_flash.c
··· 672 672 static void remove_flash_pde(struct proc_dir_entry *dp) 673 673 { 674 674 if (dp) { 675 - if (dp->data != NULL) 676 - kfree(dp->data); 675 + kfree(dp->data); 677 676 dp->owner = NULL; 678 677 remove_proc_entry(dp->name, dp->parent); 679 678 }
+3
arch/powerpc/kernel/setup_64.c
··· 398 398 { 399 399 DBG(" -> setup_system()\n"); 400 400 401 + #ifdef CONFIG_KEXEC 402 + kdump_move_device_tree(); 403 + #endif 401 404 /* 402 405 * Unflatten the device-tree passed by prom_init or kexec 403 406 */
+7 -11
arch/powerpc/kernel/signal_32.c
··· 142 142 return 0; 143 143 } 144 144 145 - static inline compat_uptr_t to_user_ptr(void *kp) 146 - { 147 - return (compat_uptr_t)(u64)kp; 148 - } 149 - 145 + #define to_user_ptr(p) ptr_to_compat(p) 150 146 #define from_user_ptr(p) compat_ptr(p) 151 147 152 148 static inline int save_general_regs(struct pt_regs *regs, ··· 209 213 return 0; 210 214 } 211 215 212 - #define to_user_ptr(p) (p) 213 - #define from_user_ptr(p) (p) 216 + #define to_user_ptr(p) ((unsigned long)(p)) 217 + #define from_user_ptr(p) ((void __user *)(p)) 214 218 215 219 static inline int save_general_regs(struct pt_regs *regs, 216 220 struct mcontext __user *frame) ··· 522 526 523 527 ret = do_sigaction(sig, act ? &new_ka : NULL, oact ? &old_ka : NULL); 524 528 if (!ret && oact) { 525 - ret = put_user((long)old_ka.sa.sa_handler, &oact->sa_handler); 529 + ret = put_user(to_user_ptr(old_ka.sa.sa_handler), &oact->sa_handler); 526 530 ret |= put_sigset_t(&oact->sa_mask, &old_ka.sa.sa_mask); 527 531 ret |= __put_user(old_ka.sa.sa_flags, &oact->sa_flags); 528 532 } ··· 671 675 int compat_sys_sigaltstack(u32 __new, u32 __old, int r5, 672 676 int r6, int r7, int r8, struct pt_regs *regs) 673 677 { 674 - stack_32_t __user * newstack = (stack_32_t __user *)(long) __new; 675 - stack_32_t __user * oldstack = (stack_32_t __user *)(long) __old; 678 + stack_32_t __user * newstack = compat_ptr(__new); 679 + stack_32_t __user * oldstack = compat_ptr(__old); 676 680 stack_t uss, uoss; 677 681 int ret; 678 682 mm_segment_t old_fs; ··· 704 708 set_fs(old_fs); 705 709 /* Copy the stack information to the user output buffer */ 706 710 if (!ret && oldstack && 707 - (put_user((long)uoss.ss_sp, &oldstack->ss_sp) || 711 + (put_user(ptr_to_compat(uoss.ss_sp), &oldstack->ss_sp) || 708 712 __put_user(uoss.ss_flags, &oldstack->ss_flags) || 709 713 __put_user(uoss.ss_size, &oldstack->ss_size))) 710 714 return -EFAULT;
+2 -2
arch/powerpc/kernel/signal_64.c
··· 60 60 struct ucontext uc; 61 61 unsigned long _unused[2]; 62 62 unsigned int tramp[TRAMP_SIZE]; 63 - struct siginfo *pinfo; 64 - void *puc; 63 + struct siginfo __user *pinfo; 64 + void __user *puc; 65 65 struct siginfo info; 66 66 /* 64 bit ABI allows for 288 bytes below sp before decrementing it. */ 67 67 char abigap[288];
+3
arch/powerpc/kernel/smp.c
··· 540 540 if (smp_ops->take_timebase) 541 541 smp_ops->take_timebase(); 542 542 543 + if (system_state > SYSTEM_BOOTING) 544 + per_cpu(last_jiffy, cpu) = get_tb(); 545 + 543 546 spin_lock(&call_lock); 544 547 cpu_set(cpu, cpu_online_map); 545 548 spin_unlock(&call_lock);
+4 -4
arch/powerpc/kernel/time.c
··· 612 612 613 613 ppc_tb_freq = DEFAULT_TB_FREQ; /* hardcoded default */ 614 614 node_found = 0; 615 - if (cpu != 0) { 615 + if (cpu) { 616 616 fp = (unsigned int *)get_property(cpu, "timebase-frequency", 617 617 NULL); 618 - if (fp != 0) { 618 + if (fp) { 619 619 node_found = 1; 620 620 ppc_tb_freq = *fp; 621 621 } ··· 626 626 627 627 ppc_proc_freq = DEFAULT_PROC_FREQ; 628 628 node_found = 0; 629 - if (cpu != 0) { 629 + if (cpu) { 630 630 fp = (unsigned int *)get_property(cpu, "clock-frequency", 631 631 NULL); 632 - if (fp != 0) { 632 + if (fp) { 633 633 node_found = 1; 634 634 ppc_proc_freq = *fp; 635 635 }
+1 -1
arch/powerpc/kernel/udbg_16550.c
··· 144 144 } 145 145 146 146 #ifdef CONFIG_PPC_MAPLE 147 - void udbg_maple_real_putc(unsigned char c) 147 + void udbg_maple_real_putc(char c) 148 148 { 149 149 if (udbg_comport) { 150 150 while ((real_readb(&udbg_comport->lsr) & LSR_THRE) == 0)
+4
arch/powerpc/mm/lmb.c
··· 197 197 { 198 198 struct lmb_region *_rgn = &(lmb.reserved); 199 199 200 + BUG_ON(0 == size); 201 + 200 202 return lmb_add_region(_rgn, base, size); 201 203 } 202 204 ··· 228 226 { 229 227 long i, j; 230 228 unsigned long base = 0; 229 + 230 + BUG_ON(0 == size); 231 231 232 232 #ifdef CONFIG_PPC32 233 233 /* On 32-bit, make sure we allocate lowmem */
+2 -12
arch/powerpc/mm/mem.c
··· 435 435 { 436 436 clear_page(page); 437 437 438 - if (cpu_has_feature(CPU_FTR_COHERENT_ICACHE)) 439 - return; 440 438 /* 441 439 * We shouldnt have to do this, but some versions of glibc 442 440 * require it (ld.so assumes zero filled pages are icache clean) 443 441 * - Anton 444 442 */ 445 - 446 - /* avoid an atomic op if possible */ 447 - if (test_bit(PG_arch_1, &pg->flags)) 448 - clear_bit(PG_arch_1, &pg->flags); 443 + flush_dcache_page(pg); 449 444 } 450 445 EXPORT_SYMBOL(clear_user_page); 451 446 ··· 464 469 return; 465 470 #endif 466 471 467 - if (cpu_has_feature(CPU_FTR_COHERENT_ICACHE)) 468 - return; 469 - 470 - /* avoid an atomic op if possible */ 471 - if (test_bit(PG_arch_1, &pg->flags)) 472 - clear_bit(PG_arch_1, &pg->flags); 472 + flush_dcache_page(pg); 473 473 } 474 474 475 475 void flush_icache_user_range(struct vm_area_struct *vma, struct page *page,
+1 -1
arch/powerpc/platforms/cell/Makefile
··· 2 2 obj-y += pervasive.o 3 3 4 4 obj-$(CONFIG_SMP) += smp.o 5 - obj-$(CONFIG_SPU_FS) += spufs/ spu-base.o 5 + obj-$(CONFIG_SPU_FS) += spu-base.o spufs/ 6 6 7 7 spu-base-y += spu_base.o spu_priv1.o 8 8
-1
arch/powerpc/platforms/chrp/chrp.h
··· 5 5 extern void chrp_nvram_init(void); 6 6 extern void chrp_get_rtc_time(struct rtc_time *); 7 7 extern int chrp_set_rtc_time(struct rtc_time *); 8 - extern void chrp_calibrate_decr(void); 9 8 extern long chrp_time_init(void); 10 9 11 10 extern void chrp_find_bridges(void);
+2
arch/powerpc/platforms/chrp/pci.c
··· 204 204 struct device_node *root = find_path_device("/"); 205 205 struct device_node *rtas; 206 206 207 + of_node_get(root); 207 208 rtas = of_find_node_by_name (root, "rtas"); 208 209 if (rtas) { 209 210 hose->ops = &rtas_pci_ops; 211 + of_node_put(rtas); 210 212 } else { 211 213 printk ("RTAS supporting Pegasos OF not found, please upgrade" 212 214 " your firmware\n");
+1 -1
arch/powerpc/platforms/chrp/setup.c
··· 506 506 ppc_md.halt = rtas_halt; 507 507 508 508 ppc_md.time_init = chrp_time_init; 509 - ppc_md.calibrate_decr = chrp_calibrate_decr; 509 + ppc_md.calibrate_decr = generic_calibrate_decr; 510 510 511 511 /* this may get overridden with rtas routines later... */ 512 512 ppc_md.set_rtc_time = chrp_set_rtc_time;
-21
arch/powerpc/platforms/chrp/time.c
··· 167 167 tm->tm_mon = mon; 168 168 tm->tm_year = year; 169 169 } 170 - 171 - 172 - void __init chrp_calibrate_decr(void) 173 - { 174 - struct device_node *cpu; 175 - unsigned int freq, *fp; 176 - 177 - /* 178 - * The cpu node should have a timebase-frequency property 179 - * to tell us the rate at which the decrementer counts. 180 - */ 181 - freq = 16666000; /* hardcoded default */ 182 - cpu = find_type_devices("cpu"); 183 - if (cpu != 0) { 184 - fp = (unsigned int *) 185 - get_property(cpu, "timebase-frequency", NULL); 186 - if (fp != 0) 187 - freq = *fp; 188 - } 189 - ppc_tb_freq = freq; 190 - }
+1 -2
arch/powerpc/platforms/powermac/low_i2c.c
··· 1052 1052 } 1053 1053 EXPORT_SYMBOL_GPL(pmac_i2c_adapter_to_bus); 1054 1054 1055 - extern int pmac_i2c_match_adapter(struct device_node *dev, 1056 - struct i2c_adapter *adapter) 1055 + int pmac_i2c_match_adapter(struct device_node *dev, struct i2c_adapter *adapter) 1057 1056 { 1058 1057 struct pmac_i2c_bus *bus = pmac_i2c_find_bus(dev); 1059 1058
+43 -46
arch/powerpc/platforms/powermac/pci.c
··· 136 136 |(((unsigned int)(off)) & 0xFCUL) \ 137 137 |1UL) 138 138 139 - static unsigned long macrisc_cfg_access(struct pci_controller* hose, 139 + static volatile void __iomem *macrisc_cfg_access(struct pci_controller* hose, 140 140 u8 bus, u8 dev_fn, u8 offset) 141 141 { 142 142 unsigned int caddr; 143 143 144 144 if (bus == hose->first_busno) { 145 145 if (dev_fn < (11 << 3)) 146 - return 0; 146 + return NULL; 147 147 caddr = MACRISC_CFA0(dev_fn, offset); 148 148 } else 149 149 caddr = MACRISC_CFA1(bus, dev_fn, offset); ··· 154 154 } while (in_le32(hose->cfg_addr) != caddr); 155 155 156 156 offset &= has_uninorth ? 0x07 : 0x03; 157 - return ((unsigned long)hose->cfg_data) + offset; 157 + return hose->cfg_data + offset; 158 158 } 159 159 160 160 static int macrisc_read_config(struct pci_bus *bus, unsigned int devfn, 161 161 int offset, int len, u32 *val) 162 162 { 163 163 struct pci_controller *hose; 164 - unsigned long addr; 164 + volatile void __iomem *addr; 165 165 166 166 hose = pci_bus_to_host(bus); 167 167 if (hose == NULL) ··· 177 177 */ 178 178 switch (len) { 179 179 case 1: 180 - *val = in_8((u8 *)addr); 180 + *val = in_8(addr); 181 181 break; 182 182 case 2: 183 - *val = in_le16((u16 *)addr); 183 + *val = in_le16(addr); 184 184 break; 185 185 default: 186 - *val = in_le32((u32 *)addr); 186 + *val = in_le32(addr); 187 187 break; 188 188 } 189 189 return PCIBIOS_SUCCESSFUL; ··· 193 193 int offset, int len, u32 val) 194 194 { 195 195 struct pci_controller *hose; 196 - unsigned long addr; 196 + volatile void __iomem *addr; 197 197 198 198 hose = pci_bus_to_host(bus); 199 199 if (hose == NULL) ··· 209 209 */ 210 210 switch (len) { 211 211 case 1: 212 - out_8((u8 *)addr, val); 213 - (void) in_8((u8 *)addr); 212 + out_8(addr, val); 213 + (void) in_8(addr); 214 214 break; 215 215 case 2: 216 - out_le16((u16 *)addr, val); 217 - (void) in_le16((u16 *)addr); 216 + out_le16(addr, val); 217 + (void) in_le16(addr); 218 218 break; 219 219 default: 220 - out_le32((u32 *)addr, val); 221 - (void) in_le32((u32 *)addr); 220 + out_le32(addr, val); 221 + (void) in_le32(addr); 222 222 break; 223 223 } 224 224 return PCIBIOS_SUCCESSFUL; ··· 348 348 + (((unsigned int)bus) << 16) \ 349 349 + 0x01000000UL) 350 350 351 - static unsigned long u3_ht_cfg_access(struct pci_controller* hose, 351 + static volatile void __iomem *u3_ht_cfg_access(struct pci_controller* hose, 352 352 u8 bus, u8 devfn, u8 offset) 353 353 { 354 354 if (bus == hose->first_busno) { 355 355 /* For now, we don't self probe U3 HT bridge */ 356 356 if (PCI_SLOT(devfn) == 0) 357 - return 0; 358 - return ((unsigned long)hose->cfg_data) + 359 - U3_HT_CFA0(devfn, offset); 357 + return NULL; 358 + return hose->cfg_data + U3_HT_CFA0(devfn, offset); 360 359 } else 361 - return ((unsigned long)hose->cfg_data) + 362 - U3_HT_CFA1(bus, devfn, offset); 360 + return hose->cfg_data + U3_HT_CFA1(bus, devfn, offset); 363 361 } 364 362 365 363 static int u3_ht_read_config(struct pci_bus *bus, unsigned int devfn, 366 364 int offset, int len, u32 *val) 367 365 { 368 366 struct pci_controller *hose; 369 - unsigned long addr; 367 + volatile void __iomem *addr; 370 368 371 369 hose = pci_bus_to_host(bus); 372 370 if (hose == NULL) ··· 398 400 */ 399 401 switch (len) { 400 402 case 1: 401 - *val = in_8((u8 *)addr); 403 + *val = in_8(addr); 402 404 break; 403 405 case 2: 404 - *val = in_le16((u16 *)addr); 406 + *val = in_le16(addr); 405 407 break; 406 408 default: 407 - *val = in_le32((u32 *)addr); 409 + *val = in_le32(addr); 408 410 break; 409 411 } 410 412 return PCIBIOS_SUCCESSFUL; ··· 414 416 int offset, int len, u32 val) 415 417 { 416 418 struct pci_controller *hose; 417 - unsigned long addr; 419 + volatile void __iomem *addr; 418 420 419 421 hose = pci_bus_to_host(bus); 420 422 if (hose == NULL) ··· 440 442 */ 441 443 switch (len) { 442 444 case 1: 443 - out_8((u8 *)addr, val); 444 - (void) in_8((u8 *)addr); 445 + out_8(addr, val); 446 + (void) in_8(addr); 445 447 break; 446 448 case 2: 447 - out_le16((u16 *)addr, val); 448 - (void) in_le16((u16 *)addr); 449 + out_le16(addr, val); 450 + (void) in_le16(addr); 449 451 break; 450 452 default: 451 - out_le32((u32 *)addr, val); 452 - (void) in_le32((u32 *)addr); 453 + out_le32((u32 __iomem *)addr, val); 454 + (void) in_le32(addr); 453 455 break; 454 456 } 455 457 return PCIBIOS_SUCCESSFUL; ··· 474 476 |(((unsigned int)(off)) & 0xfcU) \ 475 477 |1UL) 476 478 477 - static unsigned long u4_pcie_cfg_access(struct pci_controller* hose, 479 + static volatile void __iomem *u4_pcie_cfg_access(struct pci_controller* hose, 478 480 u8 bus, u8 dev_fn, int offset) 479 481 { 480 482 unsigned int caddr; ··· 490 492 } while (in_le32(hose->cfg_addr) != caddr); 491 493 492 494 offset &= 0x03; 493 - return ((unsigned long)hose->cfg_data) + offset; 495 + return hose->cfg_data + offset; 494 496 } 495 497 496 498 static int u4_pcie_read_config(struct pci_bus *bus, unsigned int devfn, 497 499 int offset, int len, u32 *val) 498 500 { 499 501 struct pci_controller *hose; 500 - unsigned long addr; 502 + volatile void __iomem *addr; 501 503 502 504 hose = pci_bus_to_host(bus); 503 505 if (hose == NULL) ··· 513 515 */ 514 516 switch (len) { 515 517 case 1: 516 - *val = in_8((u8 *)addr); 518 + *val = in_8(addr); 517 519 break; 518 520 case 2: 519 - *val = in_le16((u16 *)addr); 521 + *val = in_le16(addr); 520 522 break; 521 523 default: 522 - *val = in_le32((u32 *)addr); 524 + *val = in_le32(addr); 523 525 break; 524 526 } 525 527 return PCIBIOS_SUCCESSFUL; ··· 529 531 int offset, int len, u32 val) 530 532 { 531 533 struct pci_controller *hose; 532 - unsigned long addr; 534 + volatile void __iomem *addr; 533 535 534 536 hose = pci_bus_to_host(bus); 535 537 if (hose == NULL) ··· 545 547 */ 546 548 switch (len) { 547 549 case 1: 548 - out_8((u8 *)addr, val); 549 - (void) in_8((u8 *)addr); 550 + out_8(addr, val); 551 + (void) in_8(addr); 550 552 break; 551 553 case 2: 552 - out_le16((u16 *)addr, val); 553 - (void) in_le16((u16 *)addr); 554 + out_le16(addr, val); 555 + (void) in_le16(addr); 554 556 break; 555 557 default: 556 - out_le32((u32 *)addr, val); 557 - (void) in_le32((u32 *)addr); 558 + out_le32(addr, val); 559 + (void) in_le32(addr); 558 560 break; 559 561 } 560 562 return PCIBIOS_SUCCESSFUL; ··· 771 773 * the reg address cell, we shall fix that by killing struct 772 774 * reg_property and using some accessor functions instead 773 775 */ 774 - hose->cfg_data = (volatile unsigned char *)ioremap(0xf2000000, 775 - 0x02000000); 776 + hose->cfg_data = ioremap(0xf2000000, 0x02000000); 776 777 777 778 /* 778 779 * /ht node doesn't expose a "ranges" property, so we "remove"
-2
arch/powerpc/platforms/powermac/setup.c
··· 82 82 83 83 #undef SHOW_GATWICK_IRQS 84 84 85 - unsigned char drive_info; 86 - 87 85 int ppc_override_l2cr = 0; 88 86 int ppc_override_l2cr_value; 89 87 int has_l2cache = 0;
+4 -4
arch/powerpc/platforms/pseries/eeh_driver.c
··· 333 333 rc = eeh_reset_device(frozen_pdn, NULL); 334 334 if (rc) 335 335 goto hard_fail; 336 - pci_walk_bus(frozen_bus, eeh_report_reset, 0); 336 + pci_walk_bus(frozen_bus, eeh_report_reset, NULL); 337 337 } 338 338 339 339 /* If all devices reported they can proceed, the re-enable PIO */ ··· 342 342 rc = eeh_reset_device(frozen_pdn, NULL); 343 343 if (rc) 344 344 goto hard_fail; 345 - pci_walk_bus(frozen_bus, eeh_report_reset, 0); 345 + pci_walk_bus(frozen_bus, eeh_report_reset, NULL); 346 346 } 347 347 348 348 /* Tell all device drivers that they can resume operations */ 349 - pci_walk_bus(frozen_bus, eeh_report_resume, 0); 349 + pci_walk_bus(frozen_bus, eeh_report_resume, NULL); 350 350 351 351 return; 352 352 ··· 367 367 eeh_slot_error_detail(frozen_pdn, 2 /* Permanent Error */); 368 368 369 369 /* Notify all devices that they're about to go down. */ 370 - pci_walk_bus(frozen_bus, eeh_report_failure, 0); 370 + pci_walk_bus(frozen_bus, eeh_report_failure, NULL); 371 371 372 372 /* Shut down the device drivers for good. */ 373 373 pcibios_remove_pci_devices(frozen_bus);
+1 -1
arch/powerpc/platforms/pseries/setup.c
··· 585 585 static void pseries_kexec_cpu_down(int crash_shutdown, int secondary) 586 586 { 587 587 /* Don't risk a hypervisor call if we're crashing */ 588 - if (!crash_shutdown) { 588 + if (firmware_has_feature(FW_FEATURE_SPLPAR) && !crash_shutdown) { 589 589 unsigned long vpa = __pa(get_lppaca()); 590 590 591 591 if (unregister_vpa(hard_smp_processor_id(), vpa)) {
+1 -1
arch/powerpc/sysdev/dart_iommu.c
··· 59 59 static u32 *dart_vbase; 60 60 61 61 /* Mapped base address for the dart */ 62 - static unsigned int *__iomem dart; 62 + static unsigned int __iomem *dart; 63 63 64 64 /* Dummy val that entries are set to when unused */ 65 65 static unsigned int dart_emptyval;
+5 -2
arch/ppc/kernel/head_8xx.S
··· 810 810 mtspr SPRN_MD_TWC, r9 811 811 li r11, MI_BOOTINIT /* Create RPN for address 0 */ 812 812 addis r11, r11, 0x0080 /* Add 8M */ 813 - mtspr SPRN_MD_RPN, r8 813 + mtspr SPRN_MD_RPN, r11 814 + 815 + addi r10, r10, 0x0100 816 + mtspr SPRN_MD_CTR, r10 814 817 815 818 addis r8, r8, 0x0080 /* Add 8M */ 816 819 mtspr SPRN_MD_EPN, r8 817 820 mtspr SPRN_MD_TWC, r9 818 821 addis r11, r11, 0x0080 /* Add 8M */ 819 - mtspr SPRN_MD_RPN, r8 822 + mtspr SPRN_MD_RPN, r11 820 823 #endif 821 824 822 825 /* Since the cache is enabled according to the information we
+4
arch/ppc/kernel/ppc_ksyms.c
··· 186 186 EXPORT_SYMBOL(flush_tlb_page); 187 187 EXPORT_SYMBOL(_tlbie); 188 188 #ifdef CONFIG_ALTIVEC 189 + #ifndef CONFIG_SMP 189 190 EXPORT_SYMBOL(last_task_used_altivec); 191 + #endif 190 192 EXPORT_SYMBOL(giveup_altivec); 191 193 #endif /* CONFIG_ALTIVEC */ 192 194 #ifdef CONFIG_SPE 195 + #ifndef CONFIG_SMP 193 196 EXPORT_SYMBOL(last_task_used_spe); 197 + #endif 194 198 EXPORT_SYMBOL(giveup_spe); 195 199 #endif /* CONFIG_SPE */ 196 200 #ifdef CONFIG_SMP
+2 -2
arch/ppc/platforms/4xx/bamboo.c
··· 332 332 port.irq = 0; 333 333 port.uartclk = clocks.uart0; 334 334 port.regshift = 0; 335 - port.iotype = SERIAL_IO_MEM; 336 - port.flags = ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST; 335 + port.iotype = UPIO_MEM; 336 + port.flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST; 337 337 port.line = 0; 338 338 339 339 if (early_serial_setup(&port) != 0) {
+2 -2
arch/ppc/platforms/4xx/bubinga.c
··· 97 97 port.irq = ACTING_UART0_INT; 98 98 port.uartclk = uart_clock; 99 99 port.regshift = 0; 100 - port.iotype = SERIAL_IO_MEM; 101 - port.flags = ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST; 100 + port.iotype = UPIO_MEM; 101 + port.flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST; 102 102 port.line = 0; 103 103 104 104 if (early_serial_setup(&port) != 0) {
+2 -2
arch/ppc/platforms/4xx/ebony.c
··· 225 225 port.irq = 0; 226 226 port.uartclk = clocks.uart0; 227 227 port.regshift = 0; 228 - port.iotype = SERIAL_IO_MEM; 229 - port.flags = ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST; 228 + port.iotype = UPIO_MEM; 229 + port.flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST; 230 230 port.line = 0; 231 231 232 232 if (early_serial_setup(&port) != 0) {
+2 -2
arch/ppc/platforms/4xx/luan.c
··· 279 279 port.irq = UART0_INT; 280 280 port.uartclk = clocks.uart0; 281 281 port.regshift = 0; 282 - port.iotype = SERIAL_IO_MEM; 283 - port.flags = ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST; 282 + port.iotype = UPIO_MEM; 283 + port.flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST; 284 284 port.line = 0; 285 285 286 286 if (early_serial_setup(&port) != 0) {
+2 -2
arch/ppc/platforms/4xx/ocotea.c
··· 248 248 port.irq = UART0_INT; 249 249 port.uartclk = clocks.uart0; 250 250 port.regshift = 0; 251 - port.iotype = SERIAL_IO_MEM; 252 - port.flags = ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST; 251 + port.iotype = UPIO_MEM; 252 + port.flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST; 253 253 port.line = 0; 254 254 255 255 if (early_serial_setup(&port) != 0) {
+2 -2
arch/ppc/platforms/4xx/xilinx_ml300.c
··· 95 95 port.irq = old_ports[i].irq; 96 96 port.uartclk = old_ports[i].baud_base * 16; 97 97 port.regshift = old_ports[i].iomem_reg_shift; 98 - port.iotype = SERIAL_IO_MEM; 99 - port.flags = ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST; 98 + port.iotype = UPIO_MEM; 99 + port.flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST; 100 100 port.line = i; 101 101 102 102 if (early_serial_setup(&port) != 0) {
+2 -2
arch/ppc/platforms/4xx/yucca.c
··· 305 305 port.irq = UART0_INT; 306 306 port.uartclk = clocks.uart0; 307 307 port.regshift = 0; 308 - port.iotype = SERIAL_IO_MEM; 309 - port.flags = ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST; 308 + port.iotype = UPIO_MEM; 309 + port.flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST; 310 310 port.line = 0; 311 311 312 312 if (early_serial_setup(&port) != 0) {
+2 -2
arch/ppc/platforms/83xx/mpc834x_sys.c
··· 301 301 struct uart_port p; 302 302 303 303 memset(&p, 0, sizeof (p)); 304 - p.iotype = SERIAL_IO_MEM; 304 + p.iotype = UPIO_MEM; 305 305 p.membase = (unsigned char __iomem *)(VIRT_IMMRBAR + 0x4500); 306 306 p.uartclk = binfo->bi_busfreq; 307 307 308 308 gen550_init(0, &p); 309 309 310 310 memset(&p, 0, sizeof (p)); 311 - p.iotype = SERIAL_IO_MEM; 311 + p.iotype = UPIO_MEM; 312 312 p.membase = (unsigned char __iomem *)(VIRT_IMMRBAR + 0x4600); 313 313 p.uartclk = binfo->bi_busfreq; 314 314
+2 -2
arch/ppc/platforms/85xx/mpc8540_ads.c
··· 162 162 binfo->bi_immr_base, MPC85xx_CCSRBAR_SIZE, _PAGE_IO, 0); 163 163 164 164 memset(&p, 0, sizeof (p)); 165 - p.iotype = SERIAL_IO_MEM; 165 + p.iotype = UPIO_MEM; 166 166 p.membase = (void *) binfo->bi_immr_base + MPC85xx_UART0_OFFSET; 167 167 p.uartclk = binfo->bi_busfreq; 168 168 169 169 gen550_init(0, &p); 170 170 171 171 memset(&p, 0, sizeof (p)); 172 - p.iotype = SERIAL_IO_MEM; 172 + p.iotype = UPIO_MEM; 173 173 p.membase = (void *) binfo->bi_immr_base + MPC85xx_UART1_OFFSET; 174 174 p.uartclk = binfo->bi_busfreq; 175 175
+2 -2
arch/ppc/platforms/85xx/mpc85xx_cds_common.c
··· 534 534 binfo->bi_immr_base, MPC85xx_CCSRBAR_SIZE, _PAGE_IO, 0); 535 535 536 536 memset(&p, 0, sizeof (p)); 537 - p.iotype = SERIAL_IO_MEM; 537 + p.iotype = UPIO_MEM; 538 538 p.membase = (void *) binfo->bi_immr_base + MPC85xx_UART0_OFFSET; 539 539 p.uartclk = binfo->bi_busfreq; 540 540 541 541 gen550_init(0, &p); 542 542 543 543 memset(&p, 0, sizeof (p)); 544 - p.iotype = SERIAL_IO_MEM; 544 + p.iotype = UPIO_MEM; 545 545 p.membase = (void *) binfo->bi_immr_base + MPC85xx_UART1_OFFSET; 546 546 p.uartclk = binfo->bi_busfreq; 547 547
+1 -1
arch/ppc/platforms/85xx/sbc8560.c
··· 64 64 uart_req.irq = MPC85xx_IRQ_EXT9; 65 65 uart_req.flags = STD_COM_FLAGS; 66 66 uart_req.uartclk = BASE_BAUD * 16; 67 - uart_req.iotype = SERIAL_IO_MEM; 67 + uart_req.iotype = UPIO_MEM; 68 68 uart_req.mapbase = UARTA_ADDR; 69 69 uart_req.membase = ioremap(uart_req.mapbase, MPC85xx_UART0_SIZE); 70 70 uart_req.type = PORT_16650;
+2 -2
arch/ppc/platforms/85xx/tqm85xx.c
··· 346 346 binfo->bi_immr_base, MPC85xx_CCSRBAR_SIZE, _PAGE_IO, 0); 347 347 348 348 memset(&p, 0, sizeof (p)); 349 - p.iotype = SERIAL_IO_MEM; 349 + p.iotype = UPIO_MEM; 350 350 p.membase = (void *) binfo->bi_immr_base + MPC85xx_UART0_OFFSET; 351 351 p.uartclk = binfo->bi_busfreq; 352 352 353 353 gen550_init(0, &p); 354 354 355 355 memset(&p, 0, sizeof (p)); 356 - p.iotype = SERIAL_IO_MEM; 356 + p.iotype = UPIO_MEM; 357 357 p.membase = (void *) binfo->bi_immr_base + MPC85xx_UART1_OFFSET; 358 358 p.uartclk = binfo->bi_busfreq; 359 359
+1 -1
arch/ppc/platforms/chestnut.c
··· 116 116 port.uartclk = BASE_BAUD * 16; 117 117 port.irq = UART0_INT; 118 118 port.flags = STD_COM_FLAGS | UPF_IOREMAP; 119 - port.iotype = SERIAL_IO_MEM; 119 + port.iotype = UPIO_MEM; 120 120 port.mapbase = CHESTNUT_UART0_IO_BASE; 121 121 port.regshift = 0; 122 122
+1 -1
arch/ppc/platforms/ev64260.c
··· 330 330 port.irq = EV64260_UART_0_IRQ; 331 331 port.uartclk = BASE_BAUD * 16; 332 332 port.regshift = 2; 333 - port.iotype = SERIAL_IO_MEM; 333 + port.iotype = UPIO_MEM; 334 334 port.flags = STD_COM_FLAGS; 335 335 336 336 #if defined(CONFIG_SERIAL_TEXT_DEBUG) || defined(CONFIG_KGDB)
+1 -1
arch/ppc/platforms/radstone_ppc7d.c
··· 100 100 serial_req.uartclk = UART_CLK; 101 101 serial_req.irq = 4; 102 102 serial_req.flags = STD_COM_FLAGS; 103 - serial_req.iotype = SERIAL_IO_MEM; 103 + serial_req.iotype = UPIO_MEM; 104 104 serial_req.membase = (u_char *) PPC7D_SERIAL_0; 105 105 106 106 gen550_init(0, &serial_req);
+2 -2
arch/ppc/platforms/spruce.c
··· 176 176 memset(&serial_req, 0, sizeof(serial_req)); 177 177 serial_req.uartclk = uart_clk; 178 178 serial_req.irq = UART0_INT; 179 - serial_req.flags = ASYNC_BOOT_AUTOCONF; 180 - serial_req.iotype = SERIAL_IO_MEM; 179 + serial_req.flags = UPF_BOOT_AUTOCONF; 180 + serial_req.iotype = UPIO_MEM; 181 181 serial_req.membase = (u_char *)UART0_IO_BASE; 182 182 serial_req.regshift = 0; 183 183
+2 -2
arch/ppc/syslib/ocp.c
··· 189 189 struct bus_type ocp_bus_type = { 190 190 .name = "ocp", 191 191 .match = ocp_device_match, 192 - .probe = ocp_driver_probe, 193 - .remove = ocp_driver_remove, 192 + .probe = ocp_device_probe, 193 + .remove = ocp_device_remove, 194 194 .suspend = ocp_device_suspend, 195 195 .resume = ocp_device_resume, 196 196 };
+1 -1
arch/ppc/syslib/ppc83xx_setup.c
··· 108 108 109 109 #if defined(CONFIG_SERIAL_TEXT_DEBUG) || defined(CONFIG_KGDB) 110 110 memset(&serial_req, 0, sizeof (serial_req)); 111 - serial_req.iotype = SERIAL_IO_MEM; 111 + serial_req.iotype = UPIO_MEM; 112 112 serial_req.mapbase = pdata[0].mapbase; 113 113 serial_req.membase = pdata[0].membase; 114 114 serial_req.regshift = 0;
+1 -1
arch/ppc/syslib/ppc85xx_setup.c
··· 90 90 91 91 #if defined(CONFIG_SERIAL_TEXT_DEBUG) || defined(CONFIG_KGDB) 92 92 memset(&serial_req, 0, sizeof (serial_req)); 93 - serial_req.iotype = SERIAL_IO_MEM; 93 + serial_req.iotype = UPIO_MEM; 94 94 serial_req.mapbase = pdata[0].mapbase; 95 95 serial_req.membase = pdata[0].membase; 96 96 serial_req.regshift = 0;
+42 -41
arch/s390/kernel/compat_linux.c
··· 100 100 #define SET_STAT_UID(stat, uid) (stat).st_uid = high2lowuid(uid) 101 101 #define SET_STAT_GID(stat, gid) (stat).st_gid = high2lowgid(gid) 102 102 103 - asmlinkage long sys32_chown16(const char * filename, u16 user, u16 group) 103 + asmlinkage long sys32_chown16(const char __user * filename, u16 user, u16 group) 104 104 { 105 105 return sys_chown(filename, low2highuid(user), low2highgid(group)); 106 106 } 107 107 108 - asmlinkage long sys32_lchown16(const char * filename, u16 user, u16 group) 108 + asmlinkage long sys32_lchown16(const char __user * filename, u16 user, u16 group) 109 109 { 110 110 return sys_lchown(filename, low2highuid(user), low2highgid(group)); 111 111 } ··· 141 141 low2highuid(suid)); 142 142 } 143 143 144 - asmlinkage long sys32_getresuid16(u16 *ruid, u16 *euid, u16 *suid) 144 + asmlinkage long sys32_getresuid16(u16 __user *ruid, u16 __user *euid, u16 __user *suid) 145 145 { 146 146 int retval; 147 147 ··· 158 158 low2highgid(sgid)); 159 159 } 160 160 161 - asmlinkage long sys32_getresgid16(u16 *rgid, u16 *egid, u16 *sgid) 161 + asmlinkage long sys32_getresgid16(u16 __user *rgid, u16 __user *egid, u16 __user *sgid) 162 162 { 163 163 int retval; 164 164 ··· 179 179 return sys_setfsgid((gid_t)gid); 180 180 } 181 181 182 - static int groups16_to_user(u16 *grouplist, struct group_info *group_info) 182 + static int groups16_to_user(u16 __user *grouplist, struct group_info *group_info) 183 183 { 184 184 int i; 185 185 u16 group; ··· 193 193 return 0; 194 194 } 195 195 196 - static int groups16_from_user(struct group_info *group_info, u16 *grouplist) 196 + static int groups16_from_user(struct group_info *group_info, u16 __user *grouplist) 197 197 { 198 198 int i; 199 199 u16 group; ··· 207 207 return 0; 208 208 } 209 209 210 - asmlinkage long sys32_getgroups16(int gidsetsize, u16 *grouplist) 210 + asmlinkage long sys32_getgroups16(int gidsetsize, u16 __user *grouplist) 211 211 { 212 212 int i; 213 213 ··· 231 231 return i; 232 232 } 233 233 234 - asmlinkage long sys32_setgroups16(int gidsetsize, u16 *grouplist) 234 + asmlinkage long sys32_setgroups16(int gidsetsize, u16 __user *grouplist) 235 235 { 236 236 struct group_info *group_info; 237 237 int retval; ··· 278 278 279 279 /* 32-bit timeval and related flotsam. */ 280 280 281 - static inline long get_tv32(struct timeval *o, struct compat_timeval *i) 281 + static inline long get_tv32(struct timeval *o, struct compat_timeval __user *i) 282 282 { 283 283 return (!access_ok(VERIFY_READ, o, sizeof(*o)) || 284 284 (__get_user(o->tv_sec, &i->tv_sec) || 285 285 __get_user(o->tv_usec, &i->tv_usec))); 286 286 } 287 287 288 - static inline long put_tv32(struct compat_timeval *o, struct timeval *i) 288 + static inline long put_tv32(struct compat_timeval __user *o, struct timeval *i) 289 289 { 290 290 return (!access_ok(VERIFY_WRITE, o, sizeof(*o)) || 291 291 (__put_user(i->tv_sec, &o->tv_sec) || ··· 341 341 return -ENOSYS; 342 342 } 343 343 344 - asmlinkage long sys32_truncate64(const char * path, unsigned long high, unsigned long low) 344 + asmlinkage long sys32_truncate64(const char __user * path, unsigned long high, unsigned long low) 345 345 { 346 346 if ((int)high < 0) 347 347 return -EINVAL; ··· 357 357 return sys_ftruncate(fd, (high << 32) | low); 358 358 } 359 359 360 - int cp_compat_stat(struct kstat *stat, struct compat_stat *statbuf) 360 + int cp_compat_stat(struct kstat *stat, struct compat_stat __user *statbuf) 361 361 { 362 362 int err; 363 363 ··· 591 591 592 592 extern struct timezone sys_tz; 593 593 594 - asmlinkage long sys32_gettimeofday(struct compat_timeval *tv, struct timezone *tz) 594 + asmlinkage long sys32_gettimeofday(struct compat_timeval __user *tv, struct timezone __user *tz) 595 595 { 596 596 if (tv) { 597 597 struct timeval ktv; ··· 606 606 return 0; 607 607 } 608 608 609 - static inline long get_ts32(struct timespec *o, struct compat_timeval *i) 609 + static inline long get_ts32(struct timespec *o, struct compat_timeval __user *i) 610 610 { 611 611 long usec; 612 612 ··· 620 620 return 0; 621 621 } 622 622 623 - asmlinkage long sys32_settimeofday(struct compat_timeval *tv, struct timezone *tz) 623 + asmlinkage long sys32_settimeofday(struct compat_timeval __user *tv, struct timezone __user *tz) 624 624 { 625 625 struct timespec kts; 626 626 struct timezone ktz; ··· 645 645 return -ERESTARTNOHAND; 646 646 } 647 647 648 - asmlinkage long sys32_pread64(unsigned int fd, char *ubuf, 648 + asmlinkage long sys32_pread64(unsigned int fd, char __user *ubuf, 649 649 size_t count, u32 poshi, u32 poslo) 650 650 { 651 651 if ((compat_ssize_t) count < 0) ··· 653 653 return sys_pread64(fd, ubuf, count, ((loff_t)AA(poshi) << 32) | AA(poslo)); 654 654 } 655 655 656 - asmlinkage long sys32_pwrite64(unsigned int fd, const char *ubuf, 656 + asmlinkage long sys32_pwrite64(unsigned int fd, const char __user *ubuf, 657 657 size_t count, u32 poshi, u32 poslo) 658 658 { 659 659 if ((compat_ssize_t) count < 0) ··· 666 666 return sys_readahead(fd, ((loff_t)AA(offhi) << 32) | AA(offlo), count); 667 667 } 668 668 669 - asmlinkage long sys32_sendfile(int out_fd, int in_fd, compat_off_t *offset, size_t count) 669 + asmlinkage long sys32_sendfile(int out_fd, int in_fd, compat_off_t __user *offset, size_t count) 670 670 { 671 671 mm_segment_t old_fs = get_fs(); 672 672 int ret; ··· 686 686 } 687 687 688 688 asmlinkage long sys32_sendfile64(int out_fd, int in_fd, 689 - compat_loff_t *offset, s32 count) 689 + compat_loff_t __user *offset, s32 count) 690 690 { 691 691 mm_segment_t old_fs = get_fs(); 692 692 int ret; ··· 722 722 723 723 extern int do_adjtimex(struct timex *); 724 724 725 - asmlinkage long sys32_adjtimex(struct timex32 *utp) 725 + asmlinkage long sys32_adjtimex(struct timex32 __user *utp) 726 726 { 727 727 struct timex txc; 728 728 int ret; ··· 789 789 u32 __unused[4]; 790 790 }; 791 791 792 - asmlinkage long sys32_sysctl(struct __sysctl_args32 *args) 792 + asmlinkage long sys32_sysctl(struct __sysctl_args32 __user *args) 793 793 { 794 794 struct __sysctl_args32 tmp; 795 795 int error; 796 - size_t oldlen, *oldlenp = NULL; 797 - unsigned long addr = (((long)&args->__unused[0]) + 7) & ~7; 796 + size_t oldlen; 797 + size_t __user *oldlenp = NULL; 798 + unsigned long addr = (((unsigned long)&args->__unused[0]) + 7) & ~7; 798 799 799 800 if (copy_from_user(&tmp, args, sizeof(tmp))) 800 801 return -EFAULT; ··· 807 806 basically copy the whole sysctl.c here, and 808 807 glibc's __sysctl uses rw memory for the structure 809 808 anyway. */ 810 - if (get_user(oldlen, (u32 *)A(tmp.oldlenp)) || 811 - put_user(oldlen, (size_t *)addr)) 809 + if (get_user(oldlen, (u32 __user *)compat_ptr(tmp.oldlenp)) || 810 + put_user(oldlen, (size_t __user *)addr)) 812 811 return -EFAULT; 813 - oldlenp = (size_t *)addr; 812 + oldlenp = (size_t __user *)addr; 814 813 } 815 814 816 815 lock_kernel(); 817 - error = do_sysctl((int *)A(tmp.name), tmp.nlen, (void *)A(tmp.oldval), 818 - oldlenp, (void *)A(tmp.newval), tmp.newlen); 816 + error = do_sysctl(compat_ptr(tmp.name), tmp.nlen, compat_ptr(tmp.oldval), 817 + oldlenp, compat_ptr(tmp.newval), tmp.newlen); 819 818 unlock_kernel(); 820 819 if (oldlenp) { 821 820 if (!error) { 822 - if (get_user(oldlen, (size_t *)addr) || 823 - put_user(oldlen, (u32 *)A(tmp.oldlenp))) 821 + if (get_user(oldlen, (size_t __user *)addr) || 822 + put_user(oldlen, (u32 __user *)compat_ptr(tmp.oldlenp))) 824 823 error = -EFAULT; 825 824 } 826 825 copy_to_user(args->__unused, tmp.__unused, sizeof(tmp.__unused)); ··· 854 853 unsigned long st_ino; 855 854 }; 856 855 857 - static int cp_stat64(struct stat64_emu31 *ubuf, struct kstat *stat) 856 + static int cp_stat64(struct stat64_emu31 __user *ubuf, struct kstat *stat) 858 857 { 859 858 struct stat64_emu31 tmp; 860 859 ··· 878 877 return copy_to_user(ubuf,&tmp,sizeof(tmp)) ? -EFAULT : 0; 879 878 } 880 879 881 - asmlinkage long sys32_stat64(char * filename, struct stat64_emu31 * statbuf) 880 + asmlinkage long sys32_stat64(char __user * filename, struct stat64_emu31 __user * statbuf) 882 881 { 883 882 struct kstat stat; 884 883 int ret = vfs_stat(filename, &stat); ··· 887 886 return ret; 888 887 } 889 888 890 - asmlinkage long sys32_lstat64(char * filename, struct stat64_emu31 * statbuf) 889 + asmlinkage long sys32_lstat64(char __user * filename, struct stat64_emu31 __user * statbuf) 891 890 { 892 891 struct kstat stat; 893 892 int ret = vfs_lstat(filename, &stat); ··· 896 895 return ret; 897 896 } 898 897 899 - asmlinkage long sys32_fstat64(unsigned long fd, struct stat64_emu31 * statbuf) 898 + asmlinkage long sys32_fstat64(unsigned long fd, struct stat64_emu31 __user * statbuf) 900 899 { 901 900 struct kstat stat; 902 901 int ret = vfs_fstat(fd, &stat); ··· 953 952 954 953 955 954 asmlinkage unsigned long 956 - old32_mmap(struct mmap_arg_struct_emu31 *arg) 955 + old32_mmap(struct mmap_arg_struct_emu31 __user *arg) 957 956 { 958 957 struct mmap_arg_struct_emu31 a; 959 958 int error = -EFAULT; ··· 971 970 } 972 971 973 972 asmlinkage long 974 - sys32_mmap2(struct mmap_arg_struct_emu31 *arg) 973 + sys32_mmap2(struct mmap_arg_struct_emu31 __user *arg) 975 974 { 976 975 struct mmap_arg_struct_emu31 a; 977 976 int error = -EFAULT; ··· 983 982 return error; 984 983 } 985 984 986 - asmlinkage long sys32_read(unsigned int fd, char * buf, size_t count) 985 + asmlinkage long sys32_read(unsigned int fd, char __user * buf, size_t count) 987 986 { 988 987 if ((compat_ssize_t) count < 0) 989 988 return -EINVAL; ··· 991 990 return sys_read(fd, buf, count); 992 991 } 993 992 994 - asmlinkage long sys32_write(unsigned int fd, char * buf, size_t count) 993 + asmlinkage long sys32_write(unsigned int fd, char __user * buf, size_t count) 995 994 { 996 995 if ((compat_ssize_t) count < 0) 997 996 return -EINVAL; ··· 1003 1002 { 1004 1003 unsigned long clone_flags; 1005 1004 unsigned long newsp; 1006 - int *parent_tidptr, *child_tidptr; 1005 + int __user *parent_tidptr, *child_tidptr; 1007 1006 1008 1007 clone_flags = regs.gprs[3] & 0xffffffffUL; 1009 1008 newsp = regs.orig_gpr2 & 0x7fffffffUL; 1010 - parent_tidptr = (int *) (regs.gprs[4] & 0x7fffffffUL); 1011 - child_tidptr = (int *) (regs.gprs[5] & 0x7fffffffUL); 1009 + parent_tidptr = compat_ptr(regs.gprs[4]); 1010 + child_tidptr = compat_ptr(regs.gprs[5]); 1012 1011 if (!newsp) 1013 1012 newsp = regs.gprs[15]; 1014 1013 return do_fork(clone_flags, newsp, &regs, 0,
+2 -2
arch/s390/kernel/sys_s390.c
··· 122 122 #ifndef CONFIG_64BIT 123 123 struct sel_arg_struct { 124 124 unsigned long n; 125 - fd_set *inp, *outp, *exp; 126 - struct timeval *tvp; 125 + fd_set __user *inp, *outp, *exp; 126 + struct timeval __user *tvp; 127 127 }; 128 128 129 129 asmlinkage long old_select(struct sel_arg_struct __user *arg)
+1 -1
arch/s390/kernel/traps.c
··· 486 486 info.si_signo = signal; 487 487 info.si_errno = 0; 488 488 info.si_code = ILL_ILLOPC; 489 - info.si_addr = (void *) location; 489 + info.si_addr = (void __user *) location; 490 490 do_trap(interruption_code, signal, 491 491 "illegal operation", regs, &info); 492 492 }
+5 -5
arch/s390/mm/cmm.c
··· 42 42 static long cmm_timeout_pages = 0; 43 43 static long cmm_timeout_seconds = 0; 44 44 45 - static struct cmm_page_array *cmm_page_list = 0; 46 - static struct cmm_page_array *cmm_timed_page_list = 0; 45 + static struct cmm_page_array *cmm_page_list = NULL; 46 + static struct cmm_page_array *cmm_timed_page_list = NULL; 47 47 48 48 static unsigned long cmm_thread_active = 0; 49 49 static struct work_struct cmm_thread_starter; ··· 259 259 260 260 static int 261 261 cmm_pages_handler(ctl_table *ctl, int write, struct file *filp, 262 - void *buffer, size_t *lenp, loff_t *ppos) 262 + void __user *buffer, size_t *lenp, loff_t *ppos) 263 263 { 264 264 char buf[16], *p; 265 265 long pages; ··· 300 300 301 301 static int 302 302 cmm_timeout_handler(ctl_table *ctl, int write, struct file *filp, 303 - void *buffer, size_t *lenp, loff_t *ppos) 303 + void __user *buffer, size_t *lenp, loff_t *ppos) 304 304 { 305 305 char buf[64], *p; 306 306 long pages, seconds; ··· 419 419 #ifdef CONFIG_CMM_IUCV 420 420 smsg_register_callback(SMSG_PREFIX, cmm_smsg_target); 421 421 #endif 422 - INIT_WORK(&cmm_thread_starter, (void *) cmm_start_thread, 0); 422 + INIT_WORK(&cmm_thread_starter, (void *) cmm_start_thread, NULL); 423 423 init_waitqueue_head(&cmm_thread_wait); 424 424 init_timer(&cmm_timer); 425 425 return 0;
+18 -12
arch/sh/boards/renesas/rts7751r2d/io.c
··· 216 216 { 217 217 volatile __u8 *bp; 218 218 volatile __u16 *p; 219 + unsigned char *s = addr; 219 220 220 221 if (CHECK_AX88796L_PORT(port)) { 221 222 p = (volatile unsigned short *)port88796l(port, 0); 222 - while (count--) *((unsigned char *) addr)++ = *p & 0xff; 223 + while (count--) *s++ = *p & 0xff; 223 224 } else if (PXSEG(port)) 224 - while (count--) *((unsigned char *) addr)++ = *(volatile unsigned char *)port; 225 + while (count--) *s++ = *(volatile unsigned char *)port; 225 226 else if (CHECK_SH7751_PCIIO(port) || shifted_port(port)) { 226 227 bp = (__u8 *)PCI_IOMAP(port); 227 - while (count--) *((volatile unsigned char *) addr)++ = *bp; 228 + while (count--) *s++ = *bp; 228 229 } else { 229 230 p = (volatile unsigned short *)port2adr(port); 230 - while (count--) *((unsigned char *) addr)++ = *p & 0xff; 231 + while (count--) *s++ = *p & 0xff; 231 232 } 232 233 } 233 234 234 235 void rts7751r2d_insw(unsigned long port, void *addr, unsigned long count) 235 236 { 236 237 volatile __u16 *p; 238 + __u16 *s = addr; 237 239 238 240 if (CHECK_AX88796L_PORT(port)) 239 241 p = (volatile unsigned short *)port88796l(port, 1); ··· 245 243 p = (volatile unsigned short *)PCI_IOMAP(port); 246 244 else 247 245 p = (volatile unsigned short *)port2adr(port); 248 - while (count--) *((__u16 *) addr)++ = *p; 246 + while (count--) *s++ = *p; 249 247 } 250 248 251 249 void rts7751r2d_insl(unsigned long port, void *addr, unsigned long count) ··· 254 252 maybebadio(insl, port); 255 253 else if (CHECK_SH7751_PCIIO(port) || shifted_port(port)) { 256 254 volatile __u32 *p = (__u32 *)PCI_IOMAP(port); 255 + __u32 *s = addr; 257 256 258 - while (count--) *((__u32 *) addr)++ = *p; 257 + while (count--) *s++ = *p; 259 258 } else 260 259 maybebadio(insl, port); 261 260 } ··· 265 262 { 266 263 volatile __u8 *bp; 267 264 volatile __u16 *p; 265 + const __u8 *s = addr; 268 266 269 267 if (CHECK_AX88796L_PORT(port)) { 270 268 p = (volatile unsigned short *)port88796l(port, 0); 271 - while (count--) *p = *((unsigned char *) addr)++; 269 + while (count--) *p = *s++; 272 270 } else if (PXSEG(port)) 273 - while (count--) *(volatile unsigned char *)port = *((unsigned char *) addr)++; 271 + while (count--) *(volatile unsigned char *)port = *s++; 274 272 else if (CHECK_SH7751_PCIIO(port) || shifted_port(port)) { 275 273 bp = (__u8 *)PCI_IOMAP(port); 276 - while (count--) *bp = *((volatile unsigned char *) addr)++; 274 + while (count--) *bp = *s++; 277 275 } else { 278 276 p = (volatile unsigned short *)port2adr(port); 279 - while (count--) *p = *((unsigned char *) addr)++; 277 + while (count--) *p = *s++; 280 278 } 281 279 } 282 280 283 281 void rts7751r2d_outsw(unsigned long port, const void *addr, unsigned long count) 284 282 { 285 283 volatile __u16 *p; 284 + const __u16 *s = addr; 286 285 287 286 if (CHECK_AX88796L_PORT(port)) 288 287 p = (volatile unsigned short *)port88796l(port, 1); ··· 294 289 p = (volatile unsigned short *)PCI_IOMAP(port); 295 290 else 296 291 p = (volatile unsigned short *)port2adr(port); 297 - while (count--) *p = *((__u16 *) addr)++; 292 + while (count--) *p = *s++; 298 293 } 299 294 300 295 void rts7751r2d_outsl(unsigned long port, const void *addr, unsigned long count) ··· 303 298 maybebadio(outsl, port); 304 299 else if (CHECK_SH7751_PCIIO(port) || shifted_port(port)) { 305 300 volatile __u32 *p = (__u32 *)PCI_IOMAP(port); 301 + const __u32 *s = addr; 306 302 307 - while (count--) *p = *((__u32 *) addr)++; 303 + while (count--) *p = *s++; 308 304 } else 309 305 maybebadio(outsl, port); 310 306 }
-8
arch/sh64/kernel/sh_ksyms.c
··· 31 31 32 32 extern int dump_fpu(struct pt_regs *, elf_fpregset_t *); 33 33 34 - #if 0 35 - /* Not yet - there's no declaration of drive_info anywhere. */ 36 - #if defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_HD) || defined(CONFIG_BLK_DEV_IDE_MODULE) || defined(CONFIG_BLK_DEV_HD_MODULE) 37 - extern struct drive_info_struct drive_info; 38 - EXPORT_SYMBOL(drive_info); 39 - #endif 40 - #endif 41 - 42 34 /* platform dependent support */ 43 35 EXPORT_SYMBOL(dump_fpu); 44 36 EXPORT_SYMBOL(iounmap);
+1 -1
arch/sparc/kernel/entry.S
··· 38 38 39 39 #define curptr g6 40 40 41 - #define NR_SYSCALLS 299 /* Each OS is different... */ 41 + #define NR_SYSCALLS 300 /* Each OS is different... */ 42 42 43 43 /* These are just handy. */ 44 44 #define _SV save %sp, -STACKFRAME_SZ, %sp
+1 -1
arch/sparc/kernel/process.c
··· 54 54 * This is done via auxio, but could be used as a fallback 55 55 * handler when auxio is not present-- unused for now... 56 56 */ 57 - void (*pm_power_off)(void); 57 + void (*pm_power_off)(void) = machine_power_off; 58 58 59 59 /* 60 60 * sysctl - toggle power-off restriction for serial console
+2 -1
arch/sparc/kernel/systbls.S
··· 78 78 /*280*/ .long sys_ni_syscall, sys_add_key, sys_request_key, sys_keyctl, sys_openat 79 79 /*285*/ .long sys_mkdirat, sys_mknodat, sys_fchownat, sys_futimesat, sys_newfstatat 80 80 /*290*/ .long sys_unlinkat, sys_renameat, sys_linkat, sys_symlinkat, sys_readlinkat 81 - /*295*/ .long sys_fchmodat, sys_faccessat, sys_pselect6, sys_ppoll 81 + /*295*/ .long sys_fchmodat, sys_faccessat, sys_pselect6, sys_ppoll, sys_unshare 82 82 83 83 #ifdef CONFIG_SUNOS_EMUL 84 84 /* Now the SunOS syscall table. */ ··· 190 190 /*290*/ .long sunos_nosys, sunos_nosys, sunos_nosys 191 191 .long sunos_nosys, sunos_nosys, sunos_nosys 192 192 .long sunos_nosys, sunos_nosys, sunos_nosys 193 + .long sunos_nosys 193 194 194 195 #endif
+3 -2
arch/sparc64/defconfig
··· 1 1 # 2 2 # Automatically generated make config: don't edit 3 3 # Linux kernel version: 2.6.16-rc2 4 - # Sat Feb 4 02:31:38 2006 4 + # Tue Feb 7 17:47:18 2006 5 5 # 6 6 CONFIG_SPARC=y 7 7 CONFIG_SPARC64=y ··· 30 30 # General setup 31 31 # 32 32 CONFIG_LOCALVERSION="" 33 - CONFIG_LOCALVERSION_AUTO=y 33 + # CONFIG_LOCALVERSION_AUTO is not set 34 34 CONFIG_SWAP=y 35 35 CONFIG_SYSVIPC=y 36 36 CONFIG_POSIX_MQUEUE=y ··· 766 766 # CONFIG_SENSORS_ASB100 is not set 767 767 # CONFIG_SENSORS_ATXP1 is not set 768 768 # CONFIG_SENSORS_DS1621 is not set 769 + # CONFIG_SENSORS_F71805F is not set 769 770 # CONFIG_SENSORS_FSCHER is not set 770 771 # CONFIG_SENSORS_FSCPOS is not set 771 772 # CONFIG_SENSORS_GL518SM is not set
+1 -1
arch/sparc64/kernel/entry.S
··· 25 25 26 26 #define curptr g6 27 27 28 - #define NR_SYSCALLS 299 /* Each OS is different... */ 28 + #define NR_SYSCALLS 300 /* Each OS is different... */ 29 29 30 30 .text 31 31 .align 32
+3 -2
arch/sparc64/kernel/systbls.S
··· 79 79 /*280*/ .word sys_ni_syscall, sys_add_key, sys_request_key, sys_keyctl, compat_sys_openat 80 80 .word sys_mkdirat, sys_mknodat, sys_fchownat, compat_sys_futimesat, compat_sys_newfstatat 81 81 /*285*/ .word sys_unlinkat, sys_renameat, sys_linkat, sys_symlinkat, sys_readlinkat 82 - .word sys_fchmodat, sys_faccessat, compat_sys_pselect6, compat_sys_ppoll 82 + .word sys_fchmodat, sys_faccessat, compat_sys_pselect6, compat_sys_ppoll, sys_unshare 83 83 84 84 #endif /* CONFIG_COMPAT */ 85 85 ··· 148 148 /*280*/ .word sys_nis_syscall, sys_add_key, sys_request_key, sys_keyctl, sys_openat 149 149 .word sys_mkdirat, sys_mknodat, sys_fchownat, sys_futimesat, compat_sys_newfstatat 150 150 /*285*/ .word sys_unlinkat, sys_renameat, sys_linkat, sys_symlinkat, sys_readlinkat 151 - .word sys_fchmodat, sys_faccessat, sys_pselect6, sys_ppoll 151 + .word sys_fchmodat, sys_faccessat, sys_pselect6, sys_ppoll, sys_unshare 152 152 153 153 #if defined(CONFIG_SUNOS_EMUL) || defined(CONFIG_SOLARIS_EMUL) || \ 154 154 defined(CONFIG_SOLARIS_EMUL_MODULE) ··· 261 261 /*290*/ .word sunos_nosys, sunos_nosys, sunos_nosys 262 262 .word sunos_nosys, sunos_nosys, sunos_nosys 263 263 .word sunos_nosys, sunos_nosys, sunos_nosys 264 + .word sunos_nosys 264 265 #endif
-29
arch/sparc64/solaris/systbl.S
··· 283 283 .word solaris_unimplemented /* 253 */ 284 284 .word solaris_unimplemented /* 254 */ 285 285 .word solaris_unimplemented /* 255 */ 286 - .word solaris_unimplemented /* 256 */ 287 - .word solaris_unimplemented /* 257 */ 288 - .word solaris_unimplemented /* 258 */ 289 - .word solaris_unimplemented /* 259 */ 290 - .word solaris_unimplemented /* 260 */ 291 - .word solaris_unimplemented /* 261 */ 292 - .word solaris_unimplemented /* 262 */ 293 - .word solaris_unimplemented /* 263 */ 294 - .word solaris_unimplemented /* 264 */ 295 - .word solaris_unimplemented /* 265 */ 296 - .word solaris_unimplemented /* 266 */ 297 - .word solaris_unimplemented /* 267 */ 298 - .word solaris_unimplemented /* 268 */ 299 - .word solaris_unimplemented /* 269 */ 300 - .word solaris_unimplemented /* 270 */ 301 - .word solaris_unimplemented /* 271 */ 302 - .word solaris_unimplemented /* 272 */ 303 - .word solaris_unimplemented /* 273 */ 304 - .word solaris_unimplemented /* 274 */ 305 - .word solaris_unimplemented /* 275 */ 306 - .word solaris_unimplemented /* 276 */ 307 - .word solaris_unimplemented /* 277 */ 308 - .word solaris_unimplemented /* 278 */ 309 - .word solaris_unimplemented /* 279 */ 310 - .word solaris_unimplemented /* 280 */ 311 - .word solaris_unimplemented /* 281 */ 312 - .word solaris_unimplemented /* 282 */ 313 - .word solaris_unimplemented /* 283 */ 314 -
+7 -8
arch/um/drivers/chan_user.c
··· 9 9 #include <termios.h> 10 10 #include <string.h> 11 11 #include <signal.h> 12 + #include <sched.h> 12 13 #include <sys/stat.h> 13 14 #include <sys/ioctl.h> 14 15 #include <sys/socket.h> ··· 74 73 struct winch_data { 75 74 int pty_fd; 76 75 int pipe_fd; 77 - int close_me; 78 76 }; 79 77 80 78 static int winch_thread(void *arg) ··· 84 84 int count, err; 85 85 char c = 1; 86 86 87 - os_close_file(data->close_me); 88 87 pty_fd = data->pty_fd; 89 88 pipe_fd = data->pipe_fd; 90 89 count = os_write_file(pipe_fd, &c, sizeof(c)); ··· 152 153 } 153 154 154 155 data = ((struct winch_data) { .pty_fd = fd, 155 - .pipe_fd = fds[1], 156 - .close_me = fds[0] } ); 157 - err = run_helper_thread(winch_thread, &data, 0, &stack, 0); 156 + .pipe_fd = fds[1] } ); 157 + /* CLONE_FILES so this thread doesn't hold open files which are open 158 + * now, but later closed. This is a problem with /dev/net/tun. 159 + */ 160 + err = run_helper_thread(winch_thread, &data, CLONE_FILES, &stack, 0); 158 161 if(err < 0){ 159 162 printk("fork of winch_thread failed - errno = %d\n", errno); 160 163 goto out_close; 161 164 } 162 165 163 - os_close_file(fds[1]); 164 166 *fd_out = fds[0]; 165 167 n = os_read_file(fds[0], &c, sizeof(c)); 166 168 if(n != sizeof(c)){ ··· 169 169 printk("read failed, err = %d\n", -n); 170 170 printk("fd %d will not support SIGWINCH\n", fd); 171 171 err = -EINVAL; 172 - goto out_close1; 172 + goto out_close; 173 173 } 174 174 return err ; 175 175 176 176 out_close: 177 177 os_close_file(fds[1]); 178 - out_close1: 179 178 os_close_file(fds[0]); 180 179 out: 181 180 return err;
+19 -10
arch/um/drivers/net_kern.c
··· 131 131 SA_INTERRUPT | SA_SHIRQ, dev->name, dev); 132 132 if(err != 0){ 133 133 printk(KERN_ERR "uml_net_open: failed to get irq(%d)\n", err); 134 - if(lp->close != NULL) (*lp->close)(lp->fd, &lp->user); 135 - lp->fd = -1; 136 134 err = -ENETUNREACH; 135 + goto out_close; 137 136 } 138 137 139 138 lp->tl.data = (unsigned long) &lp->user; ··· 144 145 */ 145 146 while((err = uml_net_rx(dev)) > 0) ; 146 147 147 - out: 148 148 spin_unlock(&lp->lock); 149 - return(err); 149 + 150 + spin_lock(&opened_lock); 151 + list_add(&lp->list, &opened); 152 + spin_unlock(&opened_lock); 153 + 154 + return 0; 155 + out_close: 156 + if(lp->close != NULL) (*lp->close)(lp->fd, &lp->user); 157 + lp->fd = -1; 158 + out: 159 + spin_unlock(&lp->lock); 160 + return err; 150 161 } 151 162 152 163 static int uml_net_close(struct net_device *dev) ··· 170 161 if(lp->close != NULL) 171 162 (*lp->close)(lp->fd, &lp->user); 172 163 lp->fd = -1; 173 - list_del(&lp->list); 174 164 175 165 spin_unlock(&lp->lock); 166 + 167 + spin_lock(&opened_lock); 168 + list_del(&lp->list); 169 + spin_unlock(&opened_lock); 170 + 176 171 return 0; 177 172 } 178 173 ··· 423 410 if (device->have_mac) 424 411 set_ether_mac(dev, device->mac); 425 412 426 - spin_lock(&opened_lock); 427 - list_add(&lp->list, &opened); 428 - spin_unlock(&opened_lock); 429 - 430 - return(0); 413 + return 0; 431 414 } 432 415 433 416 static struct uml_net *find_device(int n)
+1 -1
arch/um/include/registers.h
··· 14 14 extern void save_registers(int pid, union uml_pt_regs *regs); 15 15 extern void restore_registers(int pid, union uml_pt_regs *regs); 16 16 extern void init_registers(int pid); 17 - extern void get_safe_registers(unsigned long * regs); 17 + extern void get_safe_registers(unsigned long * regs, unsigned long * fp_regs); 18 18 extern void get_thread_regs(union uml_pt_regs *uml_regs, void *buffer); 19 19 20 20 #endif
-569
arch/um/kernel/skas/process.c
··· 1 - /* 2 - * Copyright (C) 2002- 2004 Jeff Dike (jdike@addtoit.com) 3 - * Licensed under the GPL 4 - */ 5 - 6 - #include <stdlib.h> 7 - #include <string.h> 8 - #include <unistd.h> 9 - #include <errno.h> 10 - #include <signal.h> 11 - #include <setjmp.h> 12 - #include <sched.h> 13 - #include <sys/wait.h> 14 - #include <sys/mman.h> 15 - #include <sys/user.h> 16 - #include <sys/time.h> 17 - #include <asm/unistd.h> 18 - #include <asm/types.h> 19 - #include "user.h" 20 - #include "ptrace_user.h" 21 - #include "sysdep/ptrace.h" 22 - #include "user_util.h" 23 - #include "kern_util.h" 24 - #include "skas.h" 25 - #include "stub-data.h" 26 - #include "mm_id.h" 27 - #include "sysdep/sigcontext.h" 28 - #include "sysdep/stub.h" 29 - #include "os.h" 30 - #include "proc_mm.h" 31 - #include "skas_ptrace.h" 32 - #include "chan_user.h" 33 - #include "registers.h" 34 - #include "mem.h" 35 - #include "uml-config.h" 36 - #include "process.h" 37 - 38 - int is_skas_winch(int pid, int fd, void *data) 39 - { 40 - if(pid != os_getpgrp()) 41 - return(0); 42 - 43 - register_winch_irq(-1, fd, -1, data); 44 - return(1); 45 - } 46 - 47 - void wait_stub_done(int pid, int sig, char * fname) 48 - { 49 - int n, status, err; 50 - 51 - do { 52 - if ( sig != -1 ) { 53 - err = ptrace(PTRACE_CONT, pid, 0, sig); 54 - if(err) 55 - panic("%s : continue failed, errno = %d\n", 56 - fname, errno); 57 - } 58 - sig = 0; 59 - 60 - CATCH_EINTR(n = waitpid(pid, &status, WUNTRACED)); 61 - } while((n >= 0) && WIFSTOPPED(status) && 62 - ((WSTOPSIG(status) == SIGVTALRM) || 63 - /* running UML inside a detached screen can cause 64 - * SIGWINCHes 65 - */ 66 - (WSTOPSIG(status) == SIGWINCH))); 67 - 68 - if((n < 0) || !WIFSTOPPED(status) || 69 - (WSTOPSIG(status) != SIGUSR1 && WSTOPSIG(status) != SIGTRAP)){ 70 - unsigned long regs[HOST_FRAME_SIZE]; 71 - if(ptrace(PTRACE_GETREGS, pid, 0, regs) < 0) 72 - printk("Failed to get registers from stub, " 73 - "errno = %d\n", errno); 74 - else { 75 - int i; 76 - 77 - printk("Stub registers -\n"); 78 - for(i = 0; i < HOST_FRAME_SIZE; i++) 79 - printk("\t%d - %lx\n", i, regs[i]); 80 - } 81 - panic("%s : failed to wait for SIGUSR1/SIGTRAP, " 82 - "pid = %d, n = %d, errno = %d, status = 0x%x\n", 83 - fname, pid, n, errno, status); 84 - } 85 - } 86 - 87 - void get_skas_faultinfo(int pid, struct faultinfo * fi) 88 - { 89 - int err; 90 - 91 - if(ptrace_faultinfo){ 92 - err = ptrace(PTRACE_FAULTINFO, pid, 0, fi); 93 - if(err) 94 - panic("get_skas_faultinfo - PTRACE_FAULTINFO failed, " 95 - "errno = %d\n", errno); 96 - 97 - /* Special handling for i386, which has different structs */ 98 - if (sizeof(struct ptrace_faultinfo) < sizeof(struct faultinfo)) 99 - memset((char *)fi + sizeof(struct ptrace_faultinfo), 0, 100 - sizeof(struct faultinfo) - 101 - sizeof(struct ptrace_faultinfo)); 102 - } 103 - else { 104 - wait_stub_done(pid, SIGSEGV, "get_skas_faultinfo"); 105 - 106 - /* faultinfo is prepared by the stub-segv-handler at start of 107 - * the stub stack page. We just have to copy it. 108 - */ 109 - memcpy(fi, (void *)current_stub_stack(), sizeof(*fi)); 110 - } 111 - } 112 - 113 - static void handle_segv(int pid, union uml_pt_regs * regs) 114 - { 115 - get_skas_faultinfo(pid, &regs->skas.faultinfo); 116 - segv(regs->skas.faultinfo, 0, 1, NULL); 117 - } 118 - 119 - /*To use the same value of using_sysemu as the caller, ask it that value (in local_using_sysemu)*/ 120 - static void handle_trap(int pid, union uml_pt_regs *regs, int local_using_sysemu) 121 - { 122 - int err, status; 123 - 124 - /* Mark this as a syscall */ 125 - UPT_SYSCALL_NR(regs) = PT_SYSCALL_NR(regs->skas.regs); 126 - 127 - if (!local_using_sysemu) 128 - { 129 - err = ptrace(PTRACE_POKEUSR, pid, PT_SYSCALL_NR_OFFSET, __NR_getpid); 130 - if(err < 0) 131 - panic("handle_trap - nullifying syscall failed errno = %d\n", 132 - errno); 133 - 134 - err = ptrace(PTRACE_SYSCALL, pid, 0, 0); 135 - if(err < 0) 136 - panic("handle_trap - continuing to end of syscall failed, " 137 - "errno = %d\n", errno); 138 - 139 - CATCH_EINTR(err = waitpid(pid, &status, WUNTRACED)); 140 - if((err < 0) || !WIFSTOPPED(status) || 141 - (WSTOPSIG(status) != SIGTRAP + 0x80)) 142 - panic("handle_trap - failed to wait at end of syscall, " 143 - "errno = %d, status = %d\n", errno, status); 144 - } 145 - 146 - handle_syscall(regs); 147 - } 148 - 149 - extern int __syscall_stub_start; 150 - int stub_code_fd = -1; 151 - __u64 stub_code_offset; 152 - 153 - static int userspace_tramp(void *stack) 154 - { 155 - void *addr; 156 - 157 - ptrace(PTRACE_TRACEME, 0, 0, 0); 158 - 159 - init_new_thread_signals(1); 160 - enable_timer(); 161 - 162 - if(!proc_mm){ 163 - /* This has a pte, but it can't be mapped in with the usual 164 - * tlb_flush mechanism because this is part of that mechanism 165 - */ 166 - addr = mmap64((void *) UML_CONFIG_STUB_CODE, page_size(), 167 - PROT_EXEC, MAP_FIXED | MAP_PRIVATE, 168 - stub_code_fd, stub_code_offset); 169 - if(addr == MAP_FAILED){ 170 - printk("mapping stub code failed, errno = %d\n", 171 - errno); 172 - exit(1); 173 - } 174 - 175 - if(stack != NULL){ 176 - int fd; 177 - __u64 offset; 178 - 179 - fd = phys_mapping(to_phys(stack), &offset); 180 - addr = mmap((void *) UML_CONFIG_STUB_DATA, page_size(), 181 - PROT_READ | PROT_WRITE, 182 - MAP_FIXED | MAP_SHARED, fd, offset); 183 - if(addr == MAP_FAILED){ 184 - printk("mapping stub stack failed, " 185 - "errno = %d\n", errno); 186 - exit(1); 187 - } 188 - } 189 - } 190 - if(!ptrace_faultinfo){ 191 - unsigned long v = UML_CONFIG_STUB_CODE + 192 - (unsigned long) stub_segv_handler - 193 - (unsigned long) &__syscall_stub_start; 194 - 195 - set_sigstack((void *) UML_CONFIG_STUB_DATA, page_size()); 196 - set_handler(SIGSEGV, (void *) v, SA_ONSTACK, 197 - SIGIO, SIGWINCH, SIGALRM, SIGVTALRM, 198 - SIGUSR1, -1); 199 - } 200 - 201 - os_stop_process(os_getpid()); 202 - return(0); 203 - } 204 - 205 - /* Each element set once, and only accessed by a single processor anyway */ 206 - #undef NR_CPUS 207 - #define NR_CPUS 1 208 - int userspace_pid[NR_CPUS]; 209 - 210 - int start_userspace(unsigned long stub_stack) 211 - { 212 - void *stack; 213 - unsigned long sp; 214 - int pid, status, n, flags; 215 - 216 - if ( stub_code_fd == -1 ) 217 - stub_code_fd = phys_mapping(to_phys(&__syscall_stub_start), 218 - &stub_code_offset); 219 - 220 - stack = mmap(NULL, PAGE_SIZE, PROT_READ | PROT_WRITE | PROT_EXEC, 221 - MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); 222 - if(stack == MAP_FAILED) 223 - panic("start_userspace : mmap failed, errno = %d", errno); 224 - sp = (unsigned long) stack + PAGE_SIZE - sizeof(void *); 225 - 226 - flags = CLONE_FILES | SIGCHLD; 227 - if(proc_mm) flags |= CLONE_VM; 228 - pid = clone(userspace_tramp, (void *) sp, flags, (void *) stub_stack); 229 - if(pid < 0) 230 - panic("start_userspace : clone failed, errno = %d", errno); 231 - 232 - do { 233 - CATCH_EINTR(n = waitpid(pid, &status, WUNTRACED)); 234 - if(n < 0) 235 - panic("start_userspace : wait failed, errno = %d", 236 - errno); 237 - } while(WIFSTOPPED(status) && (WSTOPSIG(status) == SIGVTALRM)); 238 - 239 - if(!WIFSTOPPED(status) || (WSTOPSIG(status) != SIGSTOP)) 240 - panic("start_userspace : expected SIGSTOP, got status = %d", 241 - status); 242 - 243 - if (ptrace(PTRACE_OLDSETOPTIONS, pid, NULL, (void *)PTRACE_O_TRACESYSGOOD) < 0) 244 - panic("start_userspace : PTRACE_SETOPTIONS failed, errno=%d\n", 245 - errno); 246 - 247 - if(munmap(stack, PAGE_SIZE) < 0) 248 - panic("start_userspace : munmap failed, errno = %d\n", errno); 249 - 250 - return(pid); 251 - } 252 - 253 - void userspace(union uml_pt_regs *regs) 254 - { 255 - int err, status, op, pid = userspace_pid[0]; 256 - int local_using_sysemu; /*To prevent races if using_sysemu changes under us.*/ 257 - 258 - while(1){ 259 - restore_registers(pid, regs); 260 - 261 - /* Now we set local_using_sysemu to be used for one loop */ 262 - local_using_sysemu = get_using_sysemu(); 263 - 264 - op = SELECT_PTRACE_OPERATION(local_using_sysemu, singlestepping(NULL)); 265 - 266 - err = ptrace(op, pid, 0, 0); 267 - if(err) 268 - panic("userspace - could not resume userspace process, " 269 - "pid=%d, ptrace operation = %d, errno = %d\n", 270 - op, errno); 271 - 272 - CATCH_EINTR(err = waitpid(pid, &status, WUNTRACED)); 273 - if(err < 0) 274 - panic("userspace - waitpid failed, errno = %d\n", 275 - errno); 276 - 277 - regs->skas.is_user = 1; 278 - save_registers(pid, regs); 279 - UPT_SYSCALL_NR(regs) = -1; /* Assume: It's not a syscall */ 280 - 281 - if(WIFSTOPPED(status)){ 282 - switch(WSTOPSIG(status)){ 283 - case SIGSEGV: 284 - if(PTRACE_FULL_FAULTINFO || !ptrace_faultinfo) 285 - user_signal(SIGSEGV, regs, pid); 286 - else handle_segv(pid, regs); 287 - break; 288 - case SIGTRAP + 0x80: 289 - handle_trap(pid, regs, local_using_sysemu); 290 - break; 291 - case SIGTRAP: 292 - relay_signal(SIGTRAP, regs); 293 - break; 294 - case SIGIO: 295 - case SIGVTALRM: 296 - case SIGILL: 297 - case SIGBUS: 298 - case SIGFPE: 299 - case SIGWINCH: 300 - user_signal(WSTOPSIG(status), regs, pid); 301 - break; 302 - default: 303 - printk("userspace - child stopped with signal " 304 - "%d\n", WSTOPSIG(status)); 305 - } 306 - pid = userspace_pid[0]; 307 - interrupt_end(); 308 - 309 - /* Avoid -ERESTARTSYS handling in host */ 310 - PT_SYSCALL_NR(regs->skas.regs) = -1; 311 - } 312 - } 313 - } 314 - #define INIT_JMP_NEW_THREAD 0 315 - #define INIT_JMP_REMOVE_SIGSTACK 1 316 - #define INIT_JMP_CALLBACK 2 317 - #define INIT_JMP_HALT 3 318 - #define INIT_JMP_REBOOT 4 319 - 320 - 321 - int copy_context_skas0(unsigned long new_stack, int pid) 322 - { 323 - int err; 324 - unsigned long regs[MAX_REG_NR]; 325 - unsigned long current_stack = current_stub_stack(); 326 - struct stub_data *data = (struct stub_data *) current_stack; 327 - struct stub_data *child_data = (struct stub_data *) new_stack; 328 - __u64 new_offset; 329 - int new_fd = phys_mapping(to_phys((void *)new_stack), &new_offset); 330 - 331 - /* prepare offset and fd of child's stack as argument for parent's 332 - * and child's mmap2 calls 333 - */ 334 - *data = ((struct stub_data) { .offset = MMAP_OFFSET(new_offset), 335 - .fd = new_fd, 336 - .timer = ((struct itimerval) 337 - { { 0, 1000000 / hz() }, 338 - { 0, 1000000 / hz() }})}); 339 - get_safe_registers(regs); 340 - 341 - /* Set parent's instruction pointer to start of clone-stub */ 342 - regs[REGS_IP_INDEX] = UML_CONFIG_STUB_CODE + 343 - (unsigned long) stub_clone_handler - 344 - (unsigned long) &__syscall_stub_start; 345 - regs[REGS_SP_INDEX] = UML_CONFIG_STUB_DATA + PAGE_SIZE - 346 - sizeof(void *); 347 - err = ptrace_setregs(pid, regs); 348 - if(err < 0) 349 - panic("copy_context_skas0 : PTRACE_SETREGS failed, " 350 - "pid = %d, errno = %d\n", pid, errno); 351 - 352 - /* set a well known return code for detection of child write failure */ 353 - child_data->err = 12345678; 354 - 355 - /* Wait, until parent has finished its work: read child's pid from 356 - * parent's stack, and check, if bad result. 357 - */ 358 - wait_stub_done(pid, 0, "copy_context_skas0"); 359 - 360 - pid = data->err; 361 - if(pid < 0) 362 - panic("copy_context_skas0 - stub-parent reports error %d\n", 363 - pid); 364 - 365 - /* Wait, until child has finished too: read child's result from 366 - * child's stack and check it. 367 - */ 368 - wait_stub_done(pid, -1, "copy_context_skas0"); 369 - if (child_data->err != UML_CONFIG_STUB_DATA) 370 - panic("copy_context_skas0 - stub-child reports error %d\n", 371 - child_data->err); 372 - 373 - if (ptrace(PTRACE_OLDSETOPTIONS, pid, NULL, 374 - (void *)PTRACE_O_TRACESYSGOOD) < 0) 375 - panic("copy_context_skas0 : PTRACE_SETOPTIONS failed, " 376 - "errno = %d\n", errno); 377 - 378 - return pid; 379 - } 380 - 381 - /* 382 - * This is used only, if stub pages are needed, while proc_mm is 383 - * availabl. Opening /proc/mm creates a new mm_context, which lacks 384 - * the stub-pages. Thus, we map them using /proc/mm-fd 385 - */ 386 - void map_stub_pages(int fd, unsigned long code, 387 - unsigned long data, unsigned long stack) 388 - { 389 - struct proc_mm_op mmop; 390 - int n; 391 - 392 - mmop = ((struct proc_mm_op) { .op = MM_MMAP, 393 - .u = 394 - { .mmap = 395 - { .addr = code, 396 - .len = PAGE_SIZE, 397 - .prot = PROT_EXEC, 398 - .flags = MAP_FIXED | MAP_PRIVATE, 399 - .fd = stub_code_fd, 400 - .offset = stub_code_offset 401 - } } }); 402 - n = os_write_file(fd, &mmop, sizeof(mmop)); 403 - if(n != sizeof(mmop)) 404 - panic("map_stub_pages : /proc/mm map for code failed, " 405 - "err = %d\n", -n); 406 - 407 - if ( stack ) { 408 - __u64 map_offset; 409 - int map_fd = phys_mapping(to_phys((void *)stack), &map_offset); 410 - mmop = ((struct proc_mm_op) 411 - { .op = MM_MMAP, 412 - .u = 413 - { .mmap = 414 - { .addr = data, 415 - .len = PAGE_SIZE, 416 - .prot = PROT_READ | PROT_WRITE, 417 - .flags = MAP_FIXED | MAP_SHARED, 418 - .fd = map_fd, 419 - .offset = map_offset 420 - } } }); 421 - n = os_write_file(fd, &mmop, sizeof(mmop)); 422 - if(n != sizeof(mmop)) 423 - panic("map_stub_pages : /proc/mm map for data failed, " 424 - "err = %d\n", -n); 425 - } 426 - } 427 - 428 - void new_thread(void *stack, void **switch_buf_ptr, void **fork_buf_ptr, 429 - void (*handler)(int)) 430 - { 431 - unsigned long flags; 432 - sigjmp_buf switch_buf, fork_buf; 433 - 434 - *switch_buf_ptr = &switch_buf; 435 - *fork_buf_ptr = &fork_buf; 436 - 437 - /* Somewhat subtle - siglongjmp restores the signal mask before doing 438 - * the longjmp. This means that when jumping from one stack to another 439 - * when the target stack has interrupts enabled, an interrupt may occur 440 - * on the source stack. This is bad when starting up a process because 441 - * it's not supposed to get timer ticks until it has been scheduled. 442 - * So, we disable interrupts around the sigsetjmp to ensure that 443 - * they can't happen until we get back here where they are safe. 444 - */ 445 - flags = get_signals(); 446 - block_signals(); 447 - if(sigsetjmp(fork_buf, 1) == 0) 448 - new_thread_proc(stack, handler); 449 - 450 - remove_sigstack(); 451 - 452 - set_signals(flags); 453 - } 454 - 455 - void thread_wait(void *sw, void *fb) 456 - { 457 - sigjmp_buf buf, **switch_buf = sw, *fork_buf; 458 - 459 - *switch_buf = &buf; 460 - fork_buf = fb; 461 - if(sigsetjmp(buf, 1) == 0) 462 - siglongjmp(*fork_buf, INIT_JMP_REMOVE_SIGSTACK); 463 - } 464 - 465 - void switch_threads(void *me, void *next) 466 - { 467 - sigjmp_buf my_buf, **me_ptr = me, *next_buf = next; 468 - 469 - *me_ptr = &my_buf; 470 - if(sigsetjmp(my_buf, 1) == 0) 471 - siglongjmp(*next_buf, 1); 472 - } 473 - 474 - static sigjmp_buf initial_jmpbuf; 475 - 476 - /* XXX Make these percpu */ 477 - static void (*cb_proc)(void *arg); 478 - static void *cb_arg; 479 - static sigjmp_buf *cb_back; 480 - 481 - int start_idle_thread(void *stack, void *switch_buf_ptr, void **fork_buf_ptr) 482 - { 483 - sigjmp_buf **switch_buf = switch_buf_ptr; 484 - int n; 485 - 486 - set_handler(SIGWINCH, (__sighandler_t) sig_handler, 487 - SA_ONSTACK | SA_RESTART, SIGUSR1, SIGIO, SIGALRM, 488 - SIGVTALRM, -1); 489 - 490 - *fork_buf_ptr = &initial_jmpbuf; 491 - n = sigsetjmp(initial_jmpbuf, 1); 492 - switch(n){ 493 - case INIT_JMP_NEW_THREAD: 494 - new_thread_proc((void *) stack, new_thread_handler); 495 - break; 496 - case INIT_JMP_REMOVE_SIGSTACK: 497 - remove_sigstack(); 498 - break; 499 - case INIT_JMP_CALLBACK: 500 - (*cb_proc)(cb_arg); 501 - siglongjmp(*cb_back, 1); 502 - break; 503 - case INIT_JMP_HALT: 504 - kmalloc_ok = 0; 505 - return(0); 506 - case INIT_JMP_REBOOT: 507 - kmalloc_ok = 0; 508 - return(1); 509 - default: 510 - panic("Bad sigsetjmp return in start_idle_thread - %d\n", n); 511 - } 512 - siglongjmp(**switch_buf, 1); 513 - } 514 - 515 - void initial_thread_cb_skas(void (*proc)(void *), void *arg) 516 - { 517 - sigjmp_buf here; 518 - 519 - cb_proc = proc; 520 - cb_arg = arg; 521 - cb_back = &here; 522 - 523 - block_signals(); 524 - if(sigsetjmp(here, 1) == 0) 525 - siglongjmp(initial_jmpbuf, INIT_JMP_CALLBACK); 526 - unblock_signals(); 527 - 528 - cb_proc = NULL; 529 - cb_arg = NULL; 530 - cb_back = NULL; 531 - } 532 - 533 - void halt_skas(void) 534 - { 535 - block_signals(); 536 - siglongjmp(initial_jmpbuf, INIT_JMP_HALT); 537 - } 538 - 539 - void reboot_skas(void) 540 - { 541 - block_signals(); 542 - siglongjmp(initial_jmpbuf, INIT_JMP_REBOOT); 543 - } 544 - 545 - void switch_mm_skas(struct mm_id *mm_idp) 546 - { 547 - int err; 548 - 549 - #warning need cpu pid in switch_mm_skas 550 - if(proc_mm){ 551 - err = ptrace(PTRACE_SWITCH_MM, userspace_pid[0], 0, 552 - mm_idp->u.mm_fd); 553 - if(err) 554 - panic("switch_mm_skas - PTRACE_SWITCH_MM failed, " 555 - "errno = %d\n", errno); 556 - } 557 - else userspace_pid[0] = mm_idp->u.pid; 558 - } 559 - 560 - /* 561 - * Overrides for Emacs so that we follow Linus's tabbing style. 562 - * Emacs will notice this stuff at the end of the file and automatically 563 - * adjust the settings for this buffer only. This must remain at the end 564 - * of the file. 565 - * --------------------------------------------------------------------------- 566 - * Local variables: 567 - * c-file-style: "linux" 568 - * End: 569 - */
+18
arch/um/kernel/um_arch.c
··· 193 193 " root=/dev/ubd5\n\n" 194 194 ); 195 195 196 + #ifndef CONFIG_MODE_TT 197 + 198 + static int __init no_skas_debug_setup(char *line, int *add) 199 + { 200 + printf("'debug' is not necessary to gdb UML in skas mode - run \n"); 201 + printf("'gdb linux' and disable CONFIG_CMDLINE_ON_HOST if gdb \n"); 202 + printf("doesn't work as expected\n"); 203 + 204 + return 0; 205 + } 206 + 207 + __uml_setup("debug", no_skas_debug_setup, 208 + "debug\n" 209 + " this flag is not needed to run gdb on UML in skas mode\n\n" 210 + ); 211 + 212 + #endif 213 + 196 214 #ifdef CONFIG_SMP 197 215 static int __init uml_ncpus_setup(char *line, int *add) 198 216 {
+3 -1
arch/um/os-Linux/drivers/tuntap_user.c
··· 122 122 return(-EINVAL); 123 123 } 124 124 *fd_out = ((int *) CMSG_DATA(cmsg))[0]; 125 + os_set_exec_close(*fd_out, 1); 125 126 return(0); 126 127 } 127 128 ··· 138 137 return(err); 139 138 140 139 if(pri->fixed_config){ 141 - pri->fd = os_open_file("/dev/net/tun", of_rdwr(OPENFLAGS()), 0); 140 + pri->fd = os_open_file("/dev/net/tun", 141 + of_cloexec(of_rdwr(OPENFLAGS())), 0); 142 142 if(pri->fd < 0){ 143 143 printk("Failed to open /dev/net/tun, err = %d\n", 144 144 -pri->fd);
+1 -1
arch/um/os-Linux/skas/mem.c
··· 60 60 61 61 multi_count++; 62 62 63 - get_safe_registers(regs); 63 + get_safe_registers(regs, NULL); 64 64 regs[REGS_IP_INDEX] = UML_CONFIG_STUB_CODE + 65 65 ((unsigned long) &batch_syscall_stub - 66 66 (unsigned long) &__syscall_stub_start);
+14 -7
arch/um/os-Linux/skas/process.c
··· 310 310 } 311 311 } 312 312 } 313 - #define INIT_JMP_NEW_THREAD 0 314 - #define INIT_JMP_REMOVE_SIGSTACK 1 315 - #define INIT_JMP_CALLBACK 2 316 - #define INIT_JMP_HALT 3 317 - #define INIT_JMP_REBOOT 4 318 313 319 314 int copy_context_skas0(unsigned long new_stack, int pid) 320 315 { 321 316 int err; 322 - unsigned long regs[MAX_REG_NR]; 317 + unsigned long regs[HOST_FRAME_SIZE]; 318 + unsigned long fp_regs[HOST_FP_SIZE]; 323 319 unsigned long current_stack = current_stub_stack(); 324 320 struct stub_data *data = (struct stub_data *) current_stack; 325 321 struct stub_data *child_data = (struct stub_data *) new_stack; ··· 330 334 .timer = ((struct itimerval) 331 335 { { 0, 1000000 / hz() }, 332 336 { 0, 1000000 / hz() }})}); 333 - get_safe_registers(regs); 337 + get_safe_registers(regs, fp_regs); 334 338 335 339 /* Set parent's instruction pointer to start of clone-stub */ 336 340 regs[REGS_IP_INDEX] = UML_CONFIG_STUB_CODE + ··· 344 348 err = ptrace_setregs(pid, regs); 345 349 if(err < 0) 346 350 panic("copy_context_skas0 : PTRACE_SETREGS failed, " 351 + "pid = %d, errno = %d\n", pid, errno); 352 + 353 + err = ptrace_setfpregs(pid, fp_regs); 354 + if(err < 0) 355 + panic("copy_context_skas0 : PTRACE_SETFPREGS failed, " 347 356 "pid = %d, errno = %d\n", pid, errno); 348 357 349 358 /* set a well known return code for detection of child write failure */ ··· 457 456 458 457 set_signals(flags); 459 458 } 459 + 460 + #define INIT_JMP_NEW_THREAD 0 461 + #define INIT_JMP_REMOVE_SIGSTACK 1 462 + #define INIT_JMP_CALLBACK 2 463 + #define INIT_JMP_HALT 3 464 + #define INIT_JMP_REBOOT 4 460 465 461 466 void thread_wait(void *sw, void *fb) 462 467 {
+1
arch/um/os-Linux/start_up.c
··· 49 49 int pid = os_getpid(), ppid = getppid(); 50 50 int sc_result; 51 51 52 + change_sig(SIGWINCH, 0); 52 53 if(ptrace(PTRACE_TRACEME, 0, 0, 0) < 0){ 53 54 perror("ptrace"); 54 55 os_kill_process(pid, 0);
+4 -1
arch/um/os-Linux/sys-i386/registers.c
··· 122 122 err); 123 123 } 124 124 125 - void get_safe_registers(unsigned long *regs) 125 + void get_safe_registers(unsigned long *regs, unsigned long *fp_regs) 126 126 { 127 127 memcpy(regs, exec_regs, HOST_FRAME_SIZE * sizeof(unsigned long)); 128 + if(fp_regs != NULL) 129 + memcpy(fp_regs, exec_fp_regs, 130 + HOST_FP_SIZE * sizeof(unsigned long)); 128 131 } 129 132 130 133 void get_thread_regs(union uml_pt_regs *uml_regs, void *buffer)
+4 -1
arch/um/os-Linux/sys-x86_64/registers.c
··· 70 70 err); 71 71 } 72 72 73 - void get_safe_registers(unsigned long *regs) 73 + void get_safe_registers(unsigned long *regs, unsigned long *fp_regs) 74 74 { 75 75 memcpy(regs, exec_regs, HOST_FRAME_SIZE * sizeof(unsigned long)); 76 + if(fp_regs != NULL) 77 + memcpy(fp_regs, exec_fp_regs, 78 + HOST_FP_SIZE * sizeof(unsigned long)); 76 79 } 77 80 78 81 void get_thread_regs(union uml_pt_regs *uml_regs, void *buffer)
+7
arch/um/sys-x86_64/ptrace_user.c
··· 24 24 return(0); 25 25 } 26 26 27 + int ptrace_setfpregs(long pid, unsigned long *regs) 28 + { 29 + if (ptrace(PTRACE_SETFPREGS, pid, 0, regs) < 0) 30 + return -errno; 31 + return 0; 32 + } 33 + 27 34 void ptrace_pokeuser(unsigned long addr, unsigned long data) 28 35 { 29 36 panic("ptrace_pokeuser");
+1 -1
arch/um/sys-x86_64/user-offsets.c
··· 57 57 #endif 58 58 59 59 DEFINE_LONGS(HOST_FRAME_SIZE, FRAME_SIZE); 60 - DEFINE(HOST_FP_SIZE, 0); 60 + DEFINE(HOST_FP_SIZE, sizeof(struct _fpstate) / sizeof(unsigned long)); 61 61 DEFINE(HOST_XFP_SIZE, 0); 62 62 DEFINE_LONGS(HOST_RBX, RBX); 63 63 DEFINE_LONGS(HOST_RCX, RCX);
+3
arch/x86_64/ia32/ia32entry.S
··· 685 685 .quad sys_readlinkat /* 305 */ 686 686 .quad sys_fchmodat 687 687 .quad sys_faccessat 688 + .quad sys_ni_syscall /* pselect6 for now */ 689 + .quad sys_ni_syscall /* ppoll for now */ 690 + .quad sys_unshare /* 310 */ 688 691 ia32_syscall_end: 689 692 .rept IA32_NR_syscalls-(ia32_syscall_end-ia32_sys_call_table)/8 690 693 .quad ni_syscall
-2
arch/x86_64/kernel/setup.c
··· 94 94 /* 95 95 * Setup options 96 96 */ 97 - struct drive_info_struct { char dummy[32]; } drive_info; 98 97 struct screen_info screen_info; 99 98 struct sys_desc_table_struct { 100 99 unsigned short length; ··· 571 572 unsigned long kernel_end; 572 573 573 574 ROOT_DEV = old_decode_dev(ORIG_ROOT_DEV); 574 - drive_info = DRIVE_INFO; 575 575 screen_info = SCREEN_INFO; 576 576 edid_info = EDID_INFO; 577 577 saved_video_mode = SAVED_VIDEO_MODE;
+3
arch/x86_64/kernel/smpboot.c
··· 59 59 #include <asm/nmi.h> 60 60 #include <asm/irq.h> 61 61 #include <asm/hw_irq.h> 62 + #include <asm/numa.h> 62 63 63 64 /* Number of siblings per CPU package */ 64 65 int smp_num_siblings = 1; ··· 891 890 if (boot_error) { 892 891 cpu_clear(cpu, cpu_callout_map); /* was set here (do_boot_cpu()) */ 893 892 clear_bit(cpu, &cpu_initialized); /* was set by cpu_init() */ 893 + clear_node_cpumask(cpu); /* was set by numa_add_cpu */ 894 894 cpu_clear(cpu, cpu_present_map); 895 895 cpu_clear(cpu, cpu_possible_map); 896 896 x86_cpu_to_apicid[cpu] = BAD_APICID; ··· 1189 1187 cpu_clear(cpu, cpu_callout_map); 1190 1188 cpu_clear(cpu, cpu_callin_map); 1191 1189 clear_bit(cpu, &cpu_initialized); /* was set by cpu_init() */ 1190 + clear_node_cpumask(cpu); 1192 1191 } 1193 1192 1194 1193 int __cpu_disable(void)
+1 -1
arch/x86_64/kernel/time.c
··· 748 748 * Timer0 and Timer1 is used by platform. 749 749 */ 750 750 hd.hd_phys_address = vxtime.hpet_address; 751 - hd.hd_address = (void *)fix_to_virt(FIX_HPET_BASE); 751 + hd.hd_address = (void __iomem *)fix_to_virt(FIX_HPET_BASE); 752 752 hd.hd_nirqs = ntimer; 753 753 hd.hd_flags = HPET_DATA_PLATFORM; 754 754 hpet_reserve_timer(&hd, 0);
-5
arch/x86_64/kernel/x8664_ksyms.c
··· 39 39 extern void __read_lock_failed(rwlock_t *rw); 40 40 #endif 41 41 42 - #if defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_HD) || defined(CONFIG_BLK_DEV_IDE_MODULE) || defined(CONFIG_BLK_DEV_HD_MODULE) 43 - extern struct drive_info_struct drive_info; 44 - EXPORT_SYMBOL(drive_info); 45 - #endif 46 - 47 42 /* platform dependent support */ 48 43 EXPORT_SYMBOL(boot_cpu_data); 49 44 //EXPORT_SYMBOL(dump_fpu);
+1 -1
arch/x86_64/pci/mmconfig.c
··· 49 49 return pci_mmcfg_virt[0].virt; 50 50 51 51 /* Fall back to type 0 */ 52 - return 0; 52 + return NULL; 53 53 } 54 54 55 55 static char __iomem *pci_dev_base(unsigned int seg, unsigned int bus, unsigned int devfn)
+38 -32
block/elevator.c
··· 293 293 294 294 rq->flags &= ~REQ_STARTED; 295 295 296 - __elv_add_request(q, rq, ELEVATOR_INSERT_REQUEUE, 0); 296 + elv_insert(q, rq, ELEVATOR_INSERT_REQUEUE); 297 297 } 298 298 299 299 static void elv_drain_elevator(request_queue_t *q) ··· 310 310 } 311 311 } 312 312 313 - void __elv_add_request(request_queue_t *q, struct request *rq, int where, 314 - int plug) 313 + void elv_insert(request_queue_t *q, struct request *rq, int where) 315 314 { 316 315 struct list_head *pos; 317 316 unsigned ordseq; 318 - 319 - if (q->ordcolor) 320 - rq->flags |= REQ_ORDERED_COLOR; 321 - 322 - if (rq->flags & (REQ_SOFTBARRIER | REQ_HARDBARRIER)) { 323 - /* 324 - * toggle ordered color 325 - */ 326 - if (blk_barrier_rq(rq)) 327 - q->ordcolor ^= 1; 328 - 329 - /* 330 - * barriers implicitly indicate back insertion 331 - */ 332 - if (where == ELEVATOR_INSERT_SORT) 333 - where = ELEVATOR_INSERT_BACK; 334 - 335 - /* 336 - * this request is scheduling boundary, update end_sector 337 - */ 338 - if (blk_fs_request(rq)) { 339 - q->end_sector = rq_end_sector(rq); 340 - q->boundary_rq = rq; 341 - } 342 - } else if (!(rq->flags & REQ_ELVPRIV) && where == ELEVATOR_INSERT_SORT) 343 - where = ELEVATOR_INSERT_BACK; 344 - 345 - if (plug) 346 - blk_plug_device(q); 347 317 348 318 rq->q = q; 349 319 ··· 393 423 if (nrq >= q->unplug_thresh) 394 424 __generic_unplug_device(q); 395 425 } 426 + } 427 + 428 + void __elv_add_request(request_queue_t *q, struct request *rq, int where, 429 + int plug) 430 + { 431 + if (q->ordcolor) 432 + rq->flags |= REQ_ORDERED_COLOR; 433 + 434 + if (rq->flags & (REQ_SOFTBARRIER | REQ_HARDBARRIER)) { 435 + /* 436 + * toggle ordered color 437 + */ 438 + if (blk_barrier_rq(rq)) 439 + q->ordcolor ^= 1; 440 + 441 + /* 442 + * barriers implicitly indicate back insertion 443 + */ 444 + if (where == ELEVATOR_INSERT_SORT) 445 + where = ELEVATOR_INSERT_BACK; 446 + 447 + /* 448 + * this request is scheduling boundary, update 449 + * end_sector 450 + */ 451 + if (blk_fs_request(rq)) { 452 + q->end_sector = rq_end_sector(rq); 453 + q->boundary_rq = rq; 454 + } 455 + } else if (!(rq->flags & REQ_ELVPRIV) && where == ELEVATOR_INSERT_SORT) 456 + where = ELEVATOR_INSERT_BACK; 457 + 458 + if (plug) 459 + blk_plug_device(q); 460 + 461 + elv_insert(q, rq, where); 396 462 } 397 463 398 464 void elv_add_request(request_queue_t *q, struct request *rq, int where,
+2 -2
block/ll_rw_blk.c
··· 454 454 rq->end_io = end_io; 455 455 q->prepare_flush_fn(q, rq); 456 456 457 - __elv_add_request(q, rq, ELEVATOR_INSERT_FRONT, 0); 457 + elv_insert(q, rq, ELEVATOR_INSERT_FRONT); 458 458 } 459 459 460 460 static inline struct request *start_ordered(request_queue_t *q, ··· 490 490 else 491 491 q->ordseq |= QUEUE_ORDSEQ_POSTFLUSH; 492 492 493 - __elv_add_request(q, rq, ELEVATOR_INSERT_FRONT, 0); 493 + elv_insert(q, rq, ELEVATOR_INSERT_FRONT); 494 494 495 495 if (q->ordered & QUEUE_ORDERED_PREFLUSH) { 496 496 queue_flush(q, QUEUE_ORDERED_PREFLUSH);
+3
block/scsi_ioctl.c
··· 310 310 if (!rq->timeout) 311 311 rq->timeout = BLK_DEFAULT_TIMEOUT; 312 312 313 + rq->retries = 0; 314 + 313 315 start_time = jiffies; 314 316 315 317 /* ignore return value. All information is passed back to caller ··· 429 427 rq->data = buffer; 430 428 rq->data_len = bytes; 431 429 rq->flags |= REQ_BLOCK_PC; 430 + rq->retries = 0; 432 431 433 432 blk_execute_rq(q, bd_disk, rq, 0); 434 433 err = rq->errors & 0xff; /* only 8 bit SCSI status */
-1
crypto/scatterwalk.c
··· 17 17 #include <linux/mm.h> 18 18 #include <linux/pagemap.h> 19 19 #include <linux/highmem.h> 20 - #include <asm/bug.h> 21 20 #include <asm/scatterlist.h> 22 21 #include "internal.h" 23 22 #include "scatterwalk.h"
+4
drivers/base/base.h
··· 19 19 extern void driver_detach(struct device_driver * drv); 20 20 extern int driver_probe_device(struct device_driver *, struct device *); 21 21 22 + extern void sysdev_shutdown(void); 23 + extern int sysdev_suspend(pm_message_t state); 24 + extern int sysdev_resume(void); 25 + 22 26 static inline struct class_device *to_class_dev(struct kobject *obj) 23 27 { 24 28 return container_of(obj, struct class_device, kobj);
+3
drivers/base/bus.c
··· 133 133 decl_subsys(bus, &ktype_bus, NULL); 134 134 135 135 136 + #ifdef CONFIG_HOTPLUG 137 + 136 138 /* Manually detach a device from its associated driver. */ 137 139 static int driver_helper(struct device *dev, void *data) 138 140 { ··· 195 193 } 196 194 static DRIVER_ATTR(bind, S_IWUSR, NULL, driver_bind); 197 195 196 + #endif 198 197 199 198 static struct device * next_device(struct klist_iter * i) 200 199 {
+1 -1
drivers/base/memory.c
··· 303 303 */ 304 304 #ifdef CONFIG_ARCH_MEMORY_PROBE 305 305 static ssize_t 306 - memory_probe_store(struct class *class, const char __user *buf, size_t count) 306 + memory_probe_store(struct class *class, const char *buf, size_t count) 307 307 { 308 308 u64 phys_addr; 309 309 int ret;
+1 -2
drivers/base/power/resume.c
··· 9 9 */ 10 10 11 11 #include <linux/device.h> 12 + #include "../base.h" 12 13 #include "power.h" 13 - 14 - extern int sysdev_resume(void); 15 14 16 15 17 16 /**
+1 -1
drivers/base/power/shutdown.c
··· 12 12 #include <linux/device.h> 13 13 #include <asm/semaphore.h> 14 14 15 + #include "../base.h" 15 16 #include "power.h" 16 17 17 18 #define to_dev(node) container_of(node, struct device, kobj.entry) ··· 29 28 * they only get one called once when interrupts are disabled. 30 29 */ 31 30 32 - extern int sysdev_shutdown(void); 33 31 34 32 /** 35 33 * device_shutdown - call ->shutdown() on each device to shutdown.
+1 -2
drivers/base/power/suspend.c
··· 9 9 */ 10 10 11 11 #include <linux/device.h> 12 + #include "../base.h" 12 13 #include "power.h" 13 - 14 - extern int sysdev_suspend(pm_message_t state); 15 14 16 15 /* 17 16 * The entries in the dpm_active list are in a depth first order, simply
+16 -8
drivers/base/power/sysfs.c
··· 27 27 28 28 static ssize_t state_show(struct device * dev, struct device_attribute *attr, char * buf) 29 29 { 30 - return sprintf(buf, "%u\n", dev->power.power_state.event); 30 + if (dev->power.power_state.event) 31 + return sprintf(buf, "2\n"); 32 + else 33 + return sprintf(buf, "0\n"); 31 34 } 32 35 33 36 static ssize_t state_store(struct device * dev, struct device_attribute *attr, const char * buf, size_t n) 34 37 { 35 38 pm_message_t state; 36 - char * rest; 37 - int error = 0; 39 + int error = -EINVAL; 38 40 39 - state.event = simple_strtoul(buf, &rest, 10); 40 - if (*rest) 41 - return -EINVAL; 42 - if (state.event) 41 + state.event = PM_EVENT_SUSPEND; 42 + /* Older apps expected to write "3" here - confused with PCI D3 */ 43 + if ((n == 1) && !strcmp(buf, "3")) 43 44 error = dpm_runtime_suspend(dev, state); 44 - else 45 + 46 + if ((n == 1) && !strcmp(buf, "2")) 47 + error = dpm_runtime_suspend(dev, state); 48 + 49 + if ((n == 1) && !strcmp(buf, "0")) { 45 50 dpm_runtime_resume(dev); 51 + error = 0; 52 + } 53 + 46 54 return error ? error : n; 47 55 } 48 56
+3
drivers/base/sys.c
··· 21 21 #include <linux/slab.h> 22 22 #include <linux/string.h> 23 23 #include <linux/pm.h> 24 + #include <linux/device.h> 24 25 #include <asm/semaphore.h> 26 + 27 + #include "base.h" 25 28 26 29 extern struct subsystem devices_subsys; 27 30
-2
drivers/cdrom/viocd.c
··· 42 42 #include <linux/proc_fs.h> 43 43 #include <linux/seq_file.h> 44 44 45 - #include <asm/bug.h> 46 - 47 45 #include <asm/vio.h> 48 46 #include <asm/scatterlist.h> 49 47 #include <asm/iseries/hv_types.h>
+1 -1
drivers/char/Kconfig
··· 222 222 223 223 config SYNCLINK_GT 224 224 tristate "SyncLink GT/AC support" 225 - depends on SERIAL_NONSTANDARD 225 + depends on SERIAL_NONSTANDARD && PCI 226 226 help 227 227 Support for SyncLink GT and SyncLink AC families of 228 228 synchronous and asynchronous serial adapters
+4 -6
drivers/char/drm/drmP.h
··· 980 980 extern unsigned int drm_debug; 981 981 extern unsigned int drm_cards_limit; 982 982 extern drm_head_t **drm_heads; 983 - extern struct drm_sysfs_class *drm_class; 983 + extern struct class *drm_class; 984 984 extern struct proc_dir_entry *drm_proc_root; 985 985 986 986 /* Proc support (drm_proc.h) */ ··· 1011 1011 extern void drm_pci_free(drm_device_t * dev, drm_dma_handle_t * dmah); 1012 1012 1013 1013 /* sysfs support (drm_sysfs.c) */ 1014 - struct drm_sysfs_class; 1015 - extern struct drm_sysfs_class *drm_sysfs_create(struct module *owner, 1016 - char *name); 1017 - extern void drm_sysfs_destroy(struct drm_sysfs_class *cs); 1018 - extern struct class_device *drm_sysfs_device_add(struct drm_sysfs_class *cs, 1014 + extern struct class *drm_sysfs_create(struct module *owner, char *name); 1015 + extern void drm_sysfs_destroy(struct class *cs); 1016 + extern struct class_device *drm_sysfs_device_add(struct class *cs, 1019 1017 drm_head_t *head); 1020 1018 extern void drm_sysfs_device_remove(struct class_device *class_dev); 1021 1019
+1 -1
drivers/char/drm/drm_stub.c
··· 50 50 module_param_named(debug, drm_debug, int, 0600); 51 51 52 52 drm_head_t **drm_heads; 53 - struct drm_sysfs_class *drm_class; 53 + struct class *drm_class; 54 54 struct proc_dir_entry *drm_proc_root; 55 55 56 56 static int drm_fill_in_dev(drm_device_t * dev, struct pci_dev *pdev,
+28 -99
drivers/char/drm/drm_sysfs.c
··· 1 + 1 2 /* 2 3 * drm_sysfs.c - Modifications to drm_sysfs_class.c to support 3 4 * extra sysfs attribute from DRM. Normal drm_sysfs_class ··· 20 19 #include "drm_core.h" 21 20 #include "drmP.h" 22 21 23 - struct drm_sysfs_class { 24 - struct class_device_attribute attr; 25 - struct class class; 26 - }; 27 - #define to_drm_sysfs_class(d) container_of(d, struct drm_sysfs_class, class) 28 - 29 - struct simple_dev { 30 - dev_t dev; 31 - struct class_device class_dev; 32 - }; 33 - #define to_simple_dev(d) container_of(d, struct simple_dev, class_dev) 34 - 35 - static void release_simple_dev(struct class_device *class_dev) 36 - { 37 - struct simple_dev *s_dev = to_simple_dev(class_dev); 38 - kfree(s_dev); 39 - } 40 - 41 - static ssize_t show_dev(struct class_device *class_dev, char *buf) 42 - { 43 - struct simple_dev *s_dev = to_simple_dev(class_dev); 44 - return print_dev_t(buf, s_dev->dev); 45 - } 46 - 47 - static void drm_sysfs_class_release(struct class *class) 48 - { 49 - struct drm_sysfs_class *cs = to_drm_sysfs_class(class); 50 - kfree(cs); 51 - } 52 - 53 22 /* Display the version of drm_core. This doesn't work right in current design */ 54 23 static ssize_t version_show(struct class *dev, char *buf) 55 24 { ··· 40 69 * Note, the pointer created here is to be destroyed when finished by making a 41 70 * call to drm_sysfs_destroy(). 42 71 */ 43 - struct drm_sysfs_class *drm_sysfs_create(struct module *owner, char *name) 72 + struct class *drm_sysfs_create(struct module *owner, char *name) 44 73 { 45 - struct drm_sysfs_class *cs; 46 - int retval; 74 + struct class *class; 47 75 48 - cs = kmalloc(sizeof(*cs), GFP_KERNEL); 49 - if (!cs) { 50 - retval = -ENOMEM; 51 - goto error; 52 - } 53 - memset(cs, 0x00, sizeof(*cs)); 76 + class = class_create(owner, name); 77 + if (!class) 78 + return class; 54 79 55 - cs->class.name = name; 56 - cs->class.class_release = drm_sysfs_class_release; 57 - cs->class.release = release_simple_dev; 58 - 59 - cs->attr.attr.name = "dev"; 60 - cs->attr.attr.mode = S_IRUGO; 61 - cs->attr.attr.owner = owner; 62 - cs->attr.show = show_dev; 63 - cs->attr.store = NULL; 64 - 65 - retval = class_register(&cs->class); 66 - if (retval) 67 - goto error; 68 - class_create_file(&cs->class, &class_attr_version); 69 - 70 - return cs; 71 - 72 - error: 73 - kfree(cs); 74 - return ERR_PTR(retval); 80 + class_create_file(class, &class_attr_version); 81 + return class; 75 82 } 76 83 77 84 /** ··· 59 110 * Note, the pointer to be destroyed must have been created with a call to 60 111 * drm_sysfs_create(). 61 112 */ 62 - void drm_sysfs_destroy(struct drm_sysfs_class *cs) 113 + void drm_sysfs_destroy(struct class *class) 63 114 { 64 - if ((cs == NULL) || (IS_ERR(cs))) 115 + if ((class == NULL) || (IS_ERR(class))) 65 116 return; 66 117 67 - class_unregister(&cs->class); 118 + class_remove_file(class, &class_attr_version); 119 + class_destroy(class); 68 120 } 69 121 70 122 static ssize_t show_dri(struct class_device *class_device, char *buf) ··· 82 132 83 133 /** 84 134 * drm_sysfs_device_add - adds a class device to sysfs for a character driver 85 - * @cs: pointer to the struct drm_sysfs_class that this device should be registered to. 135 + * @cs: pointer to the struct class that this device should be registered to. 86 136 * @dev: the dev_t for the device to be added. 87 137 * @device: a pointer to a struct device that is assiociated with this class device. 88 138 * @fmt: string for the class device's name ··· 91 141 * class. A "dev" file will be created, showing the dev_t for the device. The 92 142 * pointer to the struct class_device will be returned from the call. Any further 93 143 * sysfs files that might be required can be created using this pointer. 94 - * Note: the struct drm_sysfs_class passed to this function must have previously been 144 + * Note: the struct class passed to this function must have previously been 95 145 * created with a call to drm_sysfs_create(). 96 146 */ 97 - struct class_device *drm_sysfs_device_add(struct drm_sysfs_class *cs, 98 - drm_head_t *head) 147 + struct class_device *drm_sysfs_device_add(struct class *cs, drm_head_t *head) 99 148 { 100 - struct simple_dev *s_dev = NULL; 101 - int i, retval; 149 + struct class_device *class_dev; 150 + int i; 102 151 103 - if ((cs == NULL) || (IS_ERR(cs))) { 104 - retval = -ENODEV; 105 - goto error; 106 - } 152 + class_dev = class_device_create(cs, NULL, 153 + MKDEV(DRM_MAJOR, head->minor), 154 + &(head->dev->pdev)->dev, 155 + "card%d", head->minor); 156 + if (!class_dev) 157 + return NULL; 107 158 108 - s_dev = kmalloc(sizeof(*s_dev), GFP_KERNEL); 109 - if (!s_dev) { 110 - retval = -ENOMEM; 111 - goto error; 112 - } 113 - memset(s_dev, 0x00, sizeof(*s_dev)); 114 - 115 - s_dev->dev = MKDEV(DRM_MAJOR, head->minor); 116 - s_dev->class_dev.dev = &(head->dev->pdev)->dev; 117 - s_dev->class_dev.class = &cs->class; 118 - 119 - snprintf(s_dev->class_dev.class_id, BUS_ID_SIZE, "card%d", head->minor); 120 - retval = class_device_register(&s_dev->class_dev); 121 - if (retval) 122 - goto error; 123 - 124 - class_device_create_file(&s_dev->class_dev, &cs->attr); 125 - class_set_devdata(&s_dev->class_dev, head); 159 + class_set_devdata(class_dev, head); 126 160 127 161 for (i = 0; i < ARRAY_SIZE(class_device_attrs); i++) 128 - class_device_create_file(&s_dev->class_dev, &class_device_attrs[i]); 129 - return &s_dev->class_dev; 130 - 131 - error: 132 - kfree(s_dev); 133 - return ERR_PTR(retval); 162 + class_device_create_file(class_dev, &class_device_attrs[i]); 163 + return class_dev; 134 164 } 135 165 136 166 /** ··· 122 192 */ 123 193 void drm_sysfs_device_remove(struct class_device *class_dev) 124 194 { 125 - struct simple_dev *s_dev = to_simple_dev(class_dev); 126 195 int i; 127 196 128 197 for (i = 0; i < ARRAY_SIZE(class_device_attrs); i++) 129 - class_device_remove_file(&s_dev->class_dev, &class_device_attrs[i]); 130 - class_device_unregister(&s_dev->class_dev); 198 + class_device_remove_file(class_dev, &class_device_attrs[i]); 199 + class_device_unregister(class_dev); 131 200 }
+1
drivers/char/ser_a2232.c
··· 103 103 104 104 #include <linux/serial.h> 105 105 #include <linux/generic_serial.h> 106 + #include <linux/tty_flip.h> 106 107 107 108 #include "ser_a2232.h" 108 109 #include "ser_a2232fw.h"
+7 -8
drivers/char/watchdog/sbc_epx_c3.c
··· 92 92 return 0; 93 93 } 94 94 95 - static ssize_t epx_c3_write(struct file *file, const char *data, 95 + static ssize_t epx_c3_write(struct file *file, const char __user *data, 96 96 size_t len, loff_t *ppos) 97 97 { 98 98 /* Refresh the timer. */ ··· 105 105 unsigned int cmd, unsigned long arg) 106 106 { 107 107 int options, retval = -EINVAL; 108 + int __user *argp = (void __user *)arg; 108 109 static struct watchdog_info ident = { 109 110 .options = WDIOF_KEEPALIVEPING | 110 111 WDIOF_MAGICCLOSE, ··· 115 114 116 115 switch (cmd) { 117 116 case WDIOC_GETSUPPORT: 118 - if (copy_to_user((struct watchdog_info *)arg, 119 - &ident, sizeof(ident))) 117 + if (copy_to_user(argp, &ident, sizeof(ident))) 120 118 return -EFAULT; 121 119 return 0; 122 120 case WDIOC_GETSTATUS: 123 121 case WDIOC_GETBOOTSTATUS: 124 - return put_user(0,(int *)arg); 122 + return put_user(0, argp); 125 123 case WDIOC_KEEPALIVE: 126 124 epx_c3_pet(); 127 125 return 0; 128 126 case WDIOC_GETTIMEOUT: 129 - return put_user(WATCHDOG_TIMEOUT,(int *)arg); 130 - case WDIOC_SETOPTIONS: { 131 - if (get_user(options, (int *)arg)) 127 + return put_user(WATCHDOG_TIMEOUT, argp); 128 + case WDIOC_SETOPTIONS: 129 + if (get_user(options, argp)) 132 130 return -EFAULT; 133 131 134 132 if (options & WDIOS_DISABLECARD) { ··· 141 141 } 142 142 143 143 return retval; 144 - } 145 144 default: 146 145 return -ENOIOCTLCMD; 147 146 }
+1 -1
drivers/edac/i82875p_edac.c
··· 159 159 160 160 struct i82875p_pvt { 161 161 struct pci_dev *ovrfl_pdev; 162 - void *ovrfl_window; 162 + void __iomem *ovrfl_window; 163 163 }; 164 164 165 165
+10
drivers/hwmon/Kconfig
··· 113 113 This driver can also be built as a module. If so, the module 114 114 will be called ds1621. 115 115 116 + config SENSORS_F71805F 117 + tristate "Fintek F71805F/FG" 118 + depends on HWMON && EXPERIMENTAL 119 + help 120 + If you say yes here you get support for hardware monitoring 121 + features of the Fintek F71805F/FG chips. 122 + 123 + This driver can also be built as a module. If so, the module 124 + will be called f71805f. 125 + 116 126 config SENSORS_FSCHER 117 127 tristate "FSC Hermes" 118 128 depends on HWMON && I2C && EXPERIMENTAL
+1
drivers/hwmon/Makefile
··· 18 18 obj-$(CONFIG_SENSORS_ADM9240) += adm9240.o 19 19 obj-$(CONFIG_SENSORS_ATXP1) += atxp1.o 20 20 obj-$(CONFIG_SENSORS_DS1621) += ds1621.o 21 + obj-$(CONFIG_SENSORS_F71805F) += f71805f.o 21 22 obj-$(CONFIG_SENSORS_FSCHER) += fscher.o 22 23 obj-$(CONFIG_SENSORS_FSCPOS) += fscpos.o 23 24 obj-$(CONFIG_SENSORS_GL518SM) += gl518sm.o
+908
drivers/hwmon/f71805f.c
··· 1 + /* 2 + * f71805f.c - driver for the Fintek F71805F/FG Super-I/O chip integrated 3 + * hardware monitoring features 4 + * Copyright (C) 2005 Jean Delvare <khali@linux-fr.org> 5 + * 6 + * The F71805F/FG is a LPC Super-I/O chip made by Fintek. It integrates 7 + * complete hardware monitoring features: voltage, fan and temperature 8 + * sensors, and manual and automatic fan speed control. 9 + * 10 + * This program is free software; you can redistribute it and/or modify 11 + * it under the terms of the GNU General Public License as published by 12 + * the Free Software Foundation; either version 2 of the License, or 13 + * (at your option) any later version. 14 + * 15 + * This program is distributed in the hope that it will be useful, 16 + * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 + * GNU General Public License for more details. 19 + * 20 + * You should have received a copy of the GNU General Public License 21 + * along with this program; if not, write to the Free Software 22 + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 23 + */ 24 + 25 + #include <linux/module.h> 26 + #include <linux/init.h> 27 + #include <linux/slab.h> 28 + #include <linux/jiffies.h> 29 + #include <linux/platform_device.h> 30 + #include <linux/hwmon.h> 31 + #include <linux/hwmon-sysfs.h> 32 + #include <linux/err.h> 33 + #include <asm/io.h> 34 + 35 + static struct platform_device *pdev; 36 + 37 + #define DRVNAME "f71805f" 38 + 39 + /* 40 + * Super-I/O constants and functions 41 + */ 42 + 43 + #define F71805F_LD_HWM 0x04 44 + 45 + #define SIO_REG_LDSEL 0x07 /* Logical device select */ 46 + #define SIO_REG_DEVID 0x20 /* Device ID (2 bytes) */ 47 + #define SIO_REG_DEVREV 0x22 /* Device revision */ 48 + #define SIO_REG_MANID 0x23 /* Fintek ID (2 bytes) */ 49 + #define SIO_REG_ENABLE 0x30 /* Logical device enable */ 50 + #define SIO_REG_ADDR 0x60 /* Logical device address (2 bytes) */ 51 + 52 + #define SIO_FINTEK_ID 0x1934 53 + #define SIO_F71805F_ID 0x0406 54 + 55 + static inline int 56 + superio_inb(int base, int reg) 57 + { 58 + outb(reg, base); 59 + return inb(base + 1); 60 + } 61 + 62 + static int 63 + superio_inw(int base, int reg) 64 + { 65 + int val; 66 + outb(reg++, base); 67 + val = inb(base + 1) << 8; 68 + outb(reg, base); 69 + val |= inb(base + 1); 70 + return val; 71 + } 72 + 73 + static inline void 74 + superio_select(int base, int ld) 75 + { 76 + outb(SIO_REG_LDSEL, base); 77 + outb(ld, base + 1); 78 + } 79 + 80 + static inline void 81 + superio_enter(int base) 82 + { 83 + outb(0x87, base); 84 + outb(0x87, base); 85 + } 86 + 87 + static inline void 88 + superio_exit(int base) 89 + { 90 + outb(0xaa, base); 91 + } 92 + 93 + /* 94 + * ISA constants 95 + */ 96 + 97 + #define REGION_LENGTH 2 98 + #define ADDR_REG_OFFSET 0 99 + #define DATA_REG_OFFSET 1 100 + 101 + static struct resource f71805f_resource __initdata = { 102 + .flags = IORESOURCE_IO, 103 + }; 104 + 105 + /* 106 + * Registers 107 + */ 108 + 109 + /* in nr from 0 to 8 (8-bit values) */ 110 + #define F71805F_REG_IN(nr) (0x10 + (nr)) 111 + #define F71805F_REG_IN_HIGH(nr) (0x40 + 2 * (nr)) 112 + #define F71805F_REG_IN_LOW(nr) (0x41 + 2 * (nr)) 113 + /* fan nr from 0 to 2 (12-bit values, two registers) */ 114 + #define F71805F_REG_FAN(nr) (0x20 + 2 * (nr)) 115 + #define F71805F_REG_FAN_LOW(nr) (0x28 + 2 * (nr)) 116 + #define F71805F_REG_FAN_CTRL(nr) (0x60 + 16 * (nr)) 117 + /* temp nr from 0 to 2 (8-bit values) */ 118 + #define F71805F_REG_TEMP(nr) (0x1B + (nr)) 119 + #define F71805F_REG_TEMP_HIGH(nr) (0x54 + 2 * (nr)) 120 + #define F71805F_REG_TEMP_HYST(nr) (0x55 + 2 * (nr)) 121 + #define F71805F_REG_TEMP_MODE 0x01 122 + 123 + #define F71805F_REG_START 0x00 124 + /* status nr from 0 to 2 */ 125 + #define F71805F_REG_STATUS(nr) (0x36 + (nr)) 126 + 127 + /* 128 + * Data structures and manipulation thereof 129 + */ 130 + 131 + struct f71805f_data { 132 + unsigned short addr; 133 + const char *name; 134 + struct semaphore lock; 135 + struct class_device *class_dev; 136 + 137 + struct semaphore update_lock; 138 + char valid; /* !=0 if following fields are valid */ 139 + unsigned long last_updated; /* In jiffies */ 140 + unsigned long last_limits; /* In jiffies */ 141 + 142 + /* Register values */ 143 + u8 in[9]; 144 + u8 in_high[9]; 145 + u8 in_low[9]; 146 + u16 fan[3]; 147 + u16 fan_low[3]; 148 + u8 fan_enabled; /* Read once at init time */ 149 + u8 temp[3]; 150 + u8 temp_high[3]; 151 + u8 temp_hyst[3]; 152 + u8 temp_mode; 153 + u8 alarms[3]; 154 + }; 155 + 156 + static inline long in_from_reg(u8 reg) 157 + { 158 + return (reg * 8); 159 + } 160 + 161 + /* The 2 least significant bits are not used */ 162 + static inline u8 in_to_reg(long val) 163 + { 164 + if (val <= 0) 165 + return 0; 166 + if (val >= 2016) 167 + return 0xfc; 168 + return (((val + 16) / 32) << 2); 169 + } 170 + 171 + /* in0 is downscaled by a factor 2 internally */ 172 + static inline long in0_from_reg(u8 reg) 173 + { 174 + return (reg * 16); 175 + } 176 + 177 + static inline u8 in0_to_reg(long val) 178 + { 179 + if (val <= 0) 180 + return 0; 181 + if (val >= 4032) 182 + return 0xfc; 183 + return (((val + 32) / 64) << 2); 184 + } 185 + 186 + /* The 4 most significant bits are not used */ 187 + static inline long fan_from_reg(u16 reg) 188 + { 189 + reg &= 0xfff; 190 + if (!reg || reg == 0xfff) 191 + return 0; 192 + return (1500000 / reg); 193 + } 194 + 195 + static inline u16 fan_to_reg(long rpm) 196 + { 197 + /* If the low limit is set below what the chip can measure, 198 + store the largest possible 12-bit value in the registers, 199 + so that no alarm will ever trigger. */ 200 + if (rpm < 367) 201 + return 0xfff; 202 + return (1500000 / rpm); 203 + } 204 + 205 + static inline long temp_from_reg(u8 reg) 206 + { 207 + return (reg * 1000); 208 + } 209 + 210 + static inline u8 temp_to_reg(long val) 211 + { 212 + if (val < 0) 213 + val = 0; 214 + else if (val > 1000 * 0xff) 215 + val = 0xff; 216 + return ((val + 500) / 1000); 217 + } 218 + 219 + /* 220 + * Device I/O access 221 + */ 222 + 223 + static u8 f71805f_read8(struct f71805f_data *data, u8 reg) 224 + { 225 + u8 val; 226 + 227 + down(&data->lock); 228 + outb(reg, data->addr + ADDR_REG_OFFSET); 229 + val = inb(data->addr + DATA_REG_OFFSET); 230 + up(&data->lock); 231 + 232 + return val; 233 + } 234 + 235 + static void f71805f_write8(struct f71805f_data *data, u8 reg, u8 val) 236 + { 237 + down(&data->lock); 238 + outb(reg, data->addr + ADDR_REG_OFFSET); 239 + outb(val, data->addr + DATA_REG_OFFSET); 240 + up(&data->lock); 241 + } 242 + 243 + /* It is important to read the MSB first, because doing so latches the 244 + value of the LSB, so we are sure both bytes belong to the same value. */ 245 + static u16 f71805f_read16(struct f71805f_data *data, u8 reg) 246 + { 247 + u16 val; 248 + 249 + down(&data->lock); 250 + outb(reg, data->addr + ADDR_REG_OFFSET); 251 + val = inb(data->addr + DATA_REG_OFFSET) << 8; 252 + outb(++reg, data->addr + ADDR_REG_OFFSET); 253 + val |= inb(data->addr + DATA_REG_OFFSET); 254 + up(&data->lock); 255 + 256 + return val; 257 + } 258 + 259 + static void f71805f_write16(struct f71805f_data *data, u8 reg, u16 val) 260 + { 261 + down(&data->lock); 262 + outb(reg, data->addr + ADDR_REG_OFFSET); 263 + outb(val >> 8, data->addr + DATA_REG_OFFSET); 264 + outb(++reg, data->addr + ADDR_REG_OFFSET); 265 + outb(val & 0xff, data->addr + DATA_REG_OFFSET); 266 + up(&data->lock); 267 + } 268 + 269 + static struct f71805f_data *f71805f_update_device(struct device *dev) 270 + { 271 + struct f71805f_data *data = dev_get_drvdata(dev); 272 + int nr; 273 + 274 + down(&data->update_lock); 275 + 276 + /* Limit registers cache is refreshed after 60 seconds */ 277 + if (time_after(jiffies, data->last_updated + 60 * HZ) 278 + || !data->valid) { 279 + for (nr = 0; nr < 9; nr++) { 280 + data->in_high[nr] = f71805f_read8(data, 281 + F71805F_REG_IN_HIGH(nr)); 282 + data->in_low[nr] = f71805f_read8(data, 283 + F71805F_REG_IN_LOW(nr)); 284 + } 285 + for (nr = 0; nr < 3; nr++) { 286 + if (data->fan_enabled & (1 << nr)) 287 + data->fan_low[nr] = f71805f_read16(data, 288 + F71805F_REG_FAN_LOW(nr)); 289 + } 290 + for (nr = 0; nr < 3; nr++) { 291 + data->temp_high[nr] = f71805f_read8(data, 292 + F71805F_REG_TEMP_HIGH(nr)); 293 + data->temp_hyst[nr] = f71805f_read8(data, 294 + F71805F_REG_TEMP_HYST(nr)); 295 + } 296 + data->temp_mode = f71805f_read8(data, F71805F_REG_TEMP_MODE); 297 + 298 + data->last_limits = jiffies; 299 + } 300 + 301 + /* Measurement registers cache is refreshed after 1 second */ 302 + if (time_after(jiffies, data->last_updated + HZ) 303 + || !data->valid) { 304 + for (nr = 0; nr < 9; nr++) { 305 + data->in[nr] = f71805f_read8(data, 306 + F71805F_REG_IN(nr)); 307 + } 308 + for (nr = 0; nr < 3; nr++) { 309 + if (data->fan_enabled & (1 << nr)) 310 + data->fan[nr] = f71805f_read16(data, 311 + F71805F_REG_FAN(nr)); 312 + } 313 + for (nr = 0; nr < 3; nr++) { 314 + data->temp[nr] = f71805f_read8(data, 315 + F71805F_REG_TEMP(nr)); 316 + } 317 + for (nr = 0; nr < 3; nr++) { 318 + data->alarms[nr] = f71805f_read8(data, 319 + F71805F_REG_STATUS(nr)); 320 + } 321 + 322 + data->last_updated = jiffies; 323 + data->valid = 1; 324 + } 325 + 326 + up(&data->update_lock); 327 + 328 + return data; 329 + } 330 + 331 + /* 332 + * Sysfs interface 333 + */ 334 + 335 + static ssize_t show_in0(struct device *dev, struct device_attribute *devattr, 336 + char *buf) 337 + { 338 + struct f71805f_data *data = f71805f_update_device(dev); 339 + 340 + return sprintf(buf, "%ld\n", in0_from_reg(data->in[0])); 341 + } 342 + 343 + static ssize_t show_in0_max(struct device *dev, struct device_attribute 344 + *devattr, char *buf) 345 + { 346 + struct f71805f_data *data = f71805f_update_device(dev); 347 + 348 + return sprintf(buf, "%ld\n", in0_from_reg(data->in_high[0])); 349 + } 350 + 351 + static ssize_t show_in0_min(struct device *dev, struct device_attribute 352 + *devattr, char *buf) 353 + { 354 + struct f71805f_data *data = f71805f_update_device(dev); 355 + 356 + return sprintf(buf, "%ld\n", in0_from_reg(data->in_low[0])); 357 + } 358 + 359 + static ssize_t set_in0_max(struct device *dev, struct device_attribute 360 + *devattr, const char *buf, size_t count) 361 + { 362 + struct f71805f_data *data = dev_get_drvdata(dev); 363 + long val = simple_strtol(buf, NULL, 10); 364 + 365 + down(&data->update_lock); 366 + data->in_high[0] = in0_to_reg(val); 367 + f71805f_write8(data, F71805F_REG_IN_HIGH(0), data->in_high[0]); 368 + up(&data->update_lock); 369 + 370 + return count; 371 + } 372 + 373 + static ssize_t set_in0_min(struct device *dev, struct device_attribute 374 + *devattr, const char *buf, size_t count) 375 + { 376 + struct f71805f_data *data = dev_get_drvdata(dev); 377 + long val = simple_strtol(buf, NULL, 10); 378 + 379 + down(&data->update_lock); 380 + data->in_low[0] = in0_to_reg(val); 381 + f71805f_write8(data, F71805F_REG_IN_LOW(0), data->in_low[0]); 382 + up(&data->update_lock); 383 + 384 + return count; 385 + } 386 + 387 + static DEVICE_ATTR(in0_input, S_IRUGO, show_in0, NULL); 388 + static DEVICE_ATTR(in0_max, S_IRUGO| S_IWUSR, show_in0_max, set_in0_max); 389 + static DEVICE_ATTR(in0_min, S_IRUGO| S_IWUSR, show_in0_min, set_in0_min); 390 + 391 + static ssize_t show_in(struct device *dev, struct device_attribute *devattr, 392 + char *buf) 393 + { 394 + struct f71805f_data *data = f71805f_update_device(dev); 395 + struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); 396 + int nr = attr->index; 397 + 398 + return sprintf(buf, "%ld\n", in_from_reg(data->in[nr])); 399 + } 400 + 401 + static ssize_t show_in_max(struct device *dev, struct device_attribute 402 + *devattr, char *buf) 403 + { 404 + struct f71805f_data *data = f71805f_update_device(dev); 405 + struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); 406 + int nr = attr->index; 407 + 408 + return sprintf(buf, "%ld\n", in_from_reg(data->in_high[nr])); 409 + } 410 + 411 + static ssize_t show_in_min(struct device *dev, struct device_attribute 412 + *devattr, char *buf) 413 + { 414 + struct f71805f_data *data = f71805f_update_device(dev); 415 + struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); 416 + int nr = attr->index; 417 + 418 + return sprintf(buf, "%ld\n", in_from_reg(data->in_low[nr])); 419 + } 420 + 421 + static ssize_t set_in_max(struct device *dev, struct device_attribute 422 + *devattr, const char *buf, size_t count) 423 + { 424 + struct f71805f_data *data = dev_get_drvdata(dev); 425 + struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); 426 + int nr = attr->index; 427 + long val = simple_strtol(buf, NULL, 10); 428 + 429 + down(&data->update_lock); 430 + data->in_high[nr] = in_to_reg(val); 431 + f71805f_write8(data, F71805F_REG_IN_HIGH(nr), data->in_high[nr]); 432 + up(&data->update_lock); 433 + 434 + return count; 435 + } 436 + 437 + static ssize_t set_in_min(struct device *dev, struct device_attribute 438 + *devattr, const char *buf, size_t count) 439 + { 440 + struct f71805f_data *data = dev_get_drvdata(dev); 441 + struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); 442 + int nr = attr->index; 443 + long val = simple_strtol(buf, NULL, 10); 444 + 445 + down(&data->update_lock); 446 + data->in_low[nr] = in_to_reg(val); 447 + f71805f_write8(data, F71805F_REG_IN_LOW(nr), data->in_low[nr]); 448 + up(&data->update_lock); 449 + 450 + return count; 451 + } 452 + 453 + #define sysfs_in(offset) \ 454 + static SENSOR_DEVICE_ATTR(in##offset##_input, S_IRUGO, \ 455 + show_in, NULL, offset); \ 456 + static SENSOR_DEVICE_ATTR(in##offset##_max, S_IRUGO | S_IWUSR, \ 457 + show_in_max, set_in_max, offset); \ 458 + static SENSOR_DEVICE_ATTR(in##offset##_min, S_IRUGO | S_IWUSR, \ 459 + show_in_min, set_in_min, offset) 460 + 461 + sysfs_in(1); 462 + sysfs_in(2); 463 + sysfs_in(3); 464 + sysfs_in(4); 465 + sysfs_in(5); 466 + sysfs_in(6); 467 + sysfs_in(7); 468 + sysfs_in(8); 469 + 470 + static ssize_t show_fan(struct device *dev, struct device_attribute *devattr, 471 + char *buf) 472 + { 473 + struct f71805f_data *data = f71805f_update_device(dev); 474 + struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); 475 + int nr = attr->index; 476 + 477 + return sprintf(buf, "%ld\n", fan_from_reg(data->fan[nr])); 478 + } 479 + 480 + static ssize_t show_fan_min(struct device *dev, struct device_attribute 481 + *devattr, char *buf) 482 + { 483 + struct f71805f_data *data = f71805f_update_device(dev); 484 + struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); 485 + int nr = attr->index; 486 + 487 + return sprintf(buf, "%ld\n", fan_from_reg(data->fan_low[nr])); 488 + } 489 + 490 + static ssize_t set_fan_min(struct device *dev, struct device_attribute 491 + *devattr, const char *buf, size_t count) 492 + { 493 + struct f71805f_data *data = dev_get_drvdata(dev); 494 + struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); 495 + int nr = attr->index; 496 + long val = simple_strtol(buf, NULL, 10); 497 + 498 + down(&data->update_lock); 499 + data->fan_low[nr] = fan_to_reg(val); 500 + f71805f_write16(data, F71805F_REG_FAN_LOW(nr), data->fan_low[nr]); 501 + up(&data->update_lock); 502 + 503 + return count; 504 + } 505 + 506 + #define sysfs_fan(offset) \ 507 + static SENSOR_DEVICE_ATTR(fan##offset##_input, S_IRUGO, \ 508 + show_fan, NULL, offset - 1); \ 509 + static SENSOR_DEVICE_ATTR(fan##offset##_min, S_IRUGO | S_IWUSR, \ 510 + show_fan_min, set_fan_min, offset - 1) 511 + 512 + sysfs_fan(1); 513 + sysfs_fan(2); 514 + sysfs_fan(3); 515 + 516 + static ssize_t show_temp(struct device *dev, struct device_attribute *devattr, 517 + char *buf) 518 + { 519 + struct f71805f_data *data = f71805f_update_device(dev); 520 + struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); 521 + int nr = attr->index; 522 + 523 + return sprintf(buf, "%ld\n", temp_from_reg(data->temp[nr])); 524 + } 525 + 526 + static ssize_t show_temp_max(struct device *dev, struct device_attribute 527 + *devattr, char *buf) 528 + { 529 + struct f71805f_data *data = f71805f_update_device(dev); 530 + struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); 531 + int nr = attr->index; 532 + 533 + return sprintf(buf, "%ld\n", temp_from_reg(data->temp_high[nr])); 534 + } 535 + 536 + static ssize_t show_temp_hyst(struct device *dev, struct device_attribute 537 + *devattr, char *buf) 538 + { 539 + struct f71805f_data *data = f71805f_update_device(dev); 540 + struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); 541 + int nr = attr->index; 542 + 543 + return sprintf(buf, "%ld\n", temp_from_reg(data->temp_hyst[nr])); 544 + } 545 + 546 + static ssize_t show_temp_type(struct device *dev, struct device_attribute 547 + *devattr, char *buf) 548 + { 549 + struct f71805f_data *data = f71805f_update_device(dev); 550 + struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); 551 + int nr = attr->index; 552 + 553 + /* 3 is diode, 4 is thermistor */ 554 + return sprintf(buf, "%u\n", (data->temp_mode & (1 << nr)) ? 3 : 4); 555 + } 556 + 557 + static ssize_t set_temp_max(struct device *dev, struct device_attribute 558 + *devattr, const char *buf, size_t count) 559 + { 560 + struct f71805f_data *data = dev_get_drvdata(dev); 561 + struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); 562 + int nr = attr->index; 563 + long val = simple_strtol(buf, NULL, 10); 564 + 565 + down(&data->update_lock); 566 + data->temp_high[nr] = temp_to_reg(val); 567 + f71805f_write8(data, F71805F_REG_TEMP_HIGH(nr), data->temp_high[nr]); 568 + up(&data->update_lock); 569 + 570 + return count; 571 + } 572 + 573 + static ssize_t set_temp_hyst(struct device *dev, struct device_attribute 574 + *devattr, const char *buf, size_t count) 575 + { 576 + struct f71805f_data *data = dev_get_drvdata(dev); 577 + struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); 578 + int nr = attr->index; 579 + long val = simple_strtol(buf, NULL, 10); 580 + 581 + down(&data->update_lock); 582 + data->temp_hyst[nr] = temp_to_reg(val); 583 + f71805f_write8(data, F71805F_REG_TEMP_HYST(nr), data->temp_hyst[nr]); 584 + up(&data->update_lock); 585 + 586 + return count; 587 + } 588 + 589 + #define sysfs_temp(offset) \ 590 + static SENSOR_DEVICE_ATTR(temp##offset##_input, S_IRUGO, \ 591 + show_temp, NULL, offset - 1); \ 592 + static SENSOR_DEVICE_ATTR(temp##offset##_max, S_IRUGO | S_IWUSR, \ 593 + show_temp_max, set_temp_max, offset - 1); \ 594 + static SENSOR_DEVICE_ATTR(temp##offset##_max_hyst, S_IRUGO | S_IWUSR, \ 595 + show_temp_hyst, set_temp_hyst, offset - 1); \ 596 + static SENSOR_DEVICE_ATTR(temp##offset##_type, S_IRUGO, \ 597 + show_temp_type, NULL, offset - 1) 598 + 599 + sysfs_temp(1); 600 + sysfs_temp(2); 601 + sysfs_temp(3); 602 + 603 + static ssize_t show_alarms_in(struct device *dev, struct device_attribute 604 + *devattr, char *buf) 605 + { 606 + struct f71805f_data *data = f71805f_update_device(dev); 607 + 608 + return sprintf(buf, "%d\n", data->alarms[0] | 609 + ((data->alarms[1] & 0x01) << 8)); 610 + } 611 + 612 + static ssize_t show_alarms_fan(struct device *dev, struct device_attribute 613 + *devattr, char *buf) 614 + { 615 + struct f71805f_data *data = f71805f_update_device(dev); 616 + 617 + return sprintf(buf, "%d\n", data->alarms[2] & 0x07); 618 + } 619 + 620 + static ssize_t show_alarms_temp(struct device *dev, struct device_attribute 621 + *devattr, char *buf) 622 + { 623 + struct f71805f_data *data = f71805f_update_device(dev); 624 + 625 + return sprintf(buf, "%d\n", (data->alarms[1] >> 3) & 0x07); 626 + } 627 + 628 + static DEVICE_ATTR(alarms_in, S_IRUGO, show_alarms_in, NULL); 629 + static DEVICE_ATTR(alarms_fan, S_IRUGO, show_alarms_fan, NULL); 630 + static DEVICE_ATTR(alarms_temp, S_IRUGO, show_alarms_temp, NULL); 631 + 632 + static ssize_t show_name(struct device *dev, struct device_attribute 633 + *devattr, char *buf) 634 + { 635 + struct f71805f_data *data = dev_get_drvdata(dev); 636 + 637 + return sprintf(buf, "%s\n", data->name); 638 + } 639 + 640 + static DEVICE_ATTR(name, S_IRUGO, show_name, NULL); 641 + 642 + /* 643 + * Device registration and initialization 644 + */ 645 + 646 + static void __devinit f71805f_init_device(struct f71805f_data *data) 647 + { 648 + u8 reg; 649 + int i; 650 + 651 + reg = f71805f_read8(data, F71805F_REG_START); 652 + if ((reg & 0x41) != 0x01) { 653 + printk(KERN_DEBUG DRVNAME ": Starting monitoring " 654 + "operations\n"); 655 + f71805f_write8(data, F71805F_REG_START, (reg | 0x01) & ~0x40); 656 + } 657 + 658 + /* Fan monitoring can be disabled. If it is, we won't be polling 659 + the register values, and won't create the related sysfs files. */ 660 + for (i = 0; i < 3; i++) { 661 + reg = f71805f_read8(data, F71805F_REG_FAN_CTRL(i)); 662 + if (!(reg & 0x80)) 663 + data->fan_enabled |= (1 << i); 664 + } 665 + } 666 + 667 + static int __devinit f71805f_probe(struct platform_device *pdev) 668 + { 669 + struct f71805f_data *data; 670 + struct resource *res; 671 + int err; 672 + 673 + if (!(data = kzalloc(sizeof(struct f71805f_data), GFP_KERNEL))) { 674 + err = -ENOMEM; 675 + printk(KERN_ERR DRVNAME ": Out of memory\n"); 676 + goto exit; 677 + } 678 + 679 + res = platform_get_resource(pdev, IORESOURCE_IO, 0); 680 + data->addr = res->start; 681 + init_MUTEX(&data->lock); 682 + data->name = "f71805f"; 683 + init_MUTEX(&data->update_lock); 684 + 685 + platform_set_drvdata(pdev, data); 686 + 687 + data->class_dev = hwmon_device_register(&pdev->dev); 688 + if (IS_ERR(data->class_dev)) { 689 + err = PTR_ERR(data->class_dev); 690 + dev_err(&pdev->dev, "Class registration failed (%d)\n", err); 691 + goto exit_free; 692 + } 693 + 694 + /* Initialize the F71805F chip */ 695 + f71805f_init_device(data); 696 + 697 + /* Register sysfs interface files */ 698 + device_create_file(&pdev->dev, &dev_attr_in0_input); 699 + device_create_file(&pdev->dev, &dev_attr_in0_max); 700 + device_create_file(&pdev->dev, &dev_attr_in0_min); 701 + device_create_file(&pdev->dev, &sensor_dev_attr_in1_input.dev_attr); 702 + device_create_file(&pdev->dev, &sensor_dev_attr_in2_input.dev_attr); 703 + device_create_file(&pdev->dev, &sensor_dev_attr_in3_input.dev_attr); 704 + device_create_file(&pdev->dev, &sensor_dev_attr_in4_input.dev_attr); 705 + device_create_file(&pdev->dev, &sensor_dev_attr_in5_input.dev_attr); 706 + device_create_file(&pdev->dev, &sensor_dev_attr_in6_input.dev_attr); 707 + device_create_file(&pdev->dev, &sensor_dev_attr_in7_input.dev_attr); 708 + device_create_file(&pdev->dev, &sensor_dev_attr_in8_input.dev_attr); 709 + device_create_file(&pdev->dev, &sensor_dev_attr_in1_max.dev_attr); 710 + device_create_file(&pdev->dev, &sensor_dev_attr_in2_max.dev_attr); 711 + device_create_file(&pdev->dev, &sensor_dev_attr_in3_max.dev_attr); 712 + device_create_file(&pdev->dev, &sensor_dev_attr_in4_max.dev_attr); 713 + device_create_file(&pdev->dev, &sensor_dev_attr_in5_max.dev_attr); 714 + device_create_file(&pdev->dev, &sensor_dev_attr_in6_max.dev_attr); 715 + device_create_file(&pdev->dev, &sensor_dev_attr_in7_max.dev_attr); 716 + device_create_file(&pdev->dev, &sensor_dev_attr_in8_max.dev_attr); 717 + device_create_file(&pdev->dev, &sensor_dev_attr_in1_min.dev_attr); 718 + device_create_file(&pdev->dev, &sensor_dev_attr_in2_min.dev_attr); 719 + device_create_file(&pdev->dev, &sensor_dev_attr_in3_min.dev_attr); 720 + device_create_file(&pdev->dev, &sensor_dev_attr_in4_min.dev_attr); 721 + device_create_file(&pdev->dev, &sensor_dev_attr_in5_min.dev_attr); 722 + device_create_file(&pdev->dev, &sensor_dev_attr_in6_min.dev_attr); 723 + device_create_file(&pdev->dev, &sensor_dev_attr_in7_min.dev_attr); 724 + device_create_file(&pdev->dev, &sensor_dev_attr_in8_min.dev_attr); 725 + if (data->fan_enabled & (1 << 0)) { 726 + device_create_file(&pdev->dev, 727 + &sensor_dev_attr_fan1_input.dev_attr); 728 + device_create_file(&pdev->dev, 729 + &sensor_dev_attr_fan1_min.dev_attr); 730 + } 731 + if (data->fan_enabled & (1 << 1)) { 732 + device_create_file(&pdev->dev, 733 + &sensor_dev_attr_fan2_input.dev_attr); 734 + device_create_file(&pdev->dev, 735 + &sensor_dev_attr_fan2_min.dev_attr); 736 + } 737 + if (data->fan_enabled & (1 << 2)) { 738 + device_create_file(&pdev->dev, 739 + &sensor_dev_attr_fan3_input.dev_attr); 740 + device_create_file(&pdev->dev, 741 + &sensor_dev_attr_fan3_min.dev_attr); 742 + } 743 + device_create_file(&pdev->dev, 744 + &sensor_dev_attr_temp1_input.dev_attr); 745 + device_create_file(&pdev->dev, 746 + &sensor_dev_attr_temp2_input.dev_attr); 747 + device_create_file(&pdev->dev, 748 + &sensor_dev_attr_temp3_input.dev_attr); 749 + device_create_file(&pdev->dev, &sensor_dev_attr_temp1_max.dev_attr); 750 + device_create_file(&pdev->dev, &sensor_dev_attr_temp2_max.dev_attr); 751 + device_create_file(&pdev->dev, &sensor_dev_attr_temp3_max.dev_attr); 752 + device_create_file(&pdev->dev, 753 + &sensor_dev_attr_temp1_max_hyst.dev_attr); 754 + device_create_file(&pdev->dev, 755 + &sensor_dev_attr_temp2_max_hyst.dev_attr); 756 + device_create_file(&pdev->dev, 757 + &sensor_dev_attr_temp3_max_hyst.dev_attr); 758 + device_create_file(&pdev->dev, &sensor_dev_attr_temp1_type.dev_attr); 759 + device_create_file(&pdev->dev, &sensor_dev_attr_temp2_type.dev_attr); 760 + device_create_file(&pdev->dev, &sensor_dev_attr_temp3_type.dev_attr); 761 + device_create_file(&pdev->dev, &dev_attr_alarms_in); 762 + device_create_file(&pdev->dev, &dev_attr_alarms_fan); 763 + device_create_file(&pdev->dev, &dev_attr_alarms_temp); 764 + device_create_file(&pdev->dev, &dev_attr_name); 765 + 766 + return 0; 767 + 768 + exit_free: 769 + kfree(data); 770 + exit: 771 + return err; 772 + } 773 + 774 + static int __devexit f71805f_remove(struct platform_device *pdev) 775 + { 776 + struct f71805f_data *data = platform_get_drvdata(pdev); 777 + 778 + platform_set_drvdata(pdev, NULL); 779 + hwmon_device_unregister(data->class_dev); 780 + kfree(data); 781 + 782 + return 0; 783 + } 784 + 785 + static struct platform_driver f71805f_driver = { 786 + .driver = { 787 + .owner = THIS_MODULE, 788 + .name = DRVNAME, 789 + }, 790 + .probe = f71805f_probe, 791 + .remove = __devexit_p(f71805f_remove), 792 + }; 793 + 794 + static int __init f71805f_device_add(unsigned short address) 795 + { 796 + int err; 797 + 798 + pdev = platform_device_alloc(DRVNAME, address); 799 + if (!pdev) { 800 + err = -ENOMEM; 801 + printk(KERN_ERR DRVNAME ": Device allocation failed\n"); 802 + goto exit; 803 + } 804 + 805 + f71805f_resource.start = address; 806 + f71805f_resource.end = address + REGION_LENGTH - 1; 807 + f71805f_resource.name = pdev->name; 808 + err = platform_device_add_resources(pdev, &f71805f_resource, 1); 809 + if (err) { 810 + printk(KERN_ERR DRVNAME ": Device resource addition failed " 811 + "(%d)\n", err); 812 + goto exit_device_put; 813 + } 814 + 815 + err = platform_device_add(pdev); 816 + if (err) { 817 + printk(KERN_ERR DRVNAME ": Device addition failed (%d)\n", 818 + err); 819 + goto exit_device_put; 820 + } 821 + 822 + return 0; 823 + 824 + exit_device_put: 825 + platform_device_put(pdev); 826 + exit: 827 + return err; 828 + } 829 + 830 + static int __init f71805f_find(int sioaddr, unsigned short *address) 831 + { 832 + int err = -ENODEV; 833 + u16 devid; 834 + 835 + superio_enter(sioaddr); 836 + 837 + devid = superio_inw(sioaddr, SIO_REG_MANID); 838 + if (devid != SIO_FINTEK_ID) 839 + goto exit; 840 + 841 + devid = superio_inw(sioaddr, SIO_REG_DEVID); 842 + if (devid != SIO_F71805F_ID) { 843 + printk(KERN_INFO DRVNAME ": Unsupported Fintek device, " 844 + "skipping\n"); 845 + goto exit; 846 + } 847 + 848 + superio_select(sioaddr, F71805F_LD_HWM); 849 + if (!(superio_inb(sioaddr, SIO_REG_ENABLE) & 0x01)) { 850 + printk(KERN_WARNING DRVNAME ": Device not activated, " 851 + "skipping\n"); 852 + goto exit; 853 + } 854 + 855 + *address = superio_inw(sioaddr, SIO_REG_ADDR); 856 + if (*address == 0) { 857 + printk(KERN_WARNING DRVNAME ": Base address not set, " 858 + "skipping\n"); 859 + goto exit; 860 + } 861 + 862 + err = 0; 863 + printk(KERN_INFO DRVNAME ": Found F71805F chip at %#x, revision %u\n", 864 + *address, superio_inb(sioaddr, SIO_REG_DEVREV)); 865 + 866 + exit: 867 + superio_exit(sioaddr); 868 + return err; 869 + } 870 + 871 + static int __init f71805f_init(void) 872 + { 873 + int err; 874 + unsigned short address; 875 + 876 + if (f71805f_find(0x2e, &address) 877 + && f71805f_find(0x4e, &address)) 878 + return -ENODEV; 879 + 880 + err = platform_driver_register(&f71805f_driver); 881 + if (err) 882 + goto exit; 883 + 884 + /* Sets global pdev as a side effect */ 885 + err = f71805f_device_add(address); 886 + if (err) 887 + goto exit_driver; 888 + 889 + return 0; 890 + 891 + exit_driver: 892 + platform_driver_unregister(&f71805f_driver); 893 + exit: 894 + return err; 895 + } 896 + 897 + static void __exit f71805f_exit(void) 898 + { 899 + platform_device_unregister(pdev); 900 + platform_driver_unregister(&f71805f_driver); 901 + } 902 + 903 + MODULE_AUTHOR("Jean Delvare <khali@linux-fr>"); 904 + MODULE_LICENSE("GPL"); 905 + MODULE_DESCRIPTION("F71805F hardware monitoring driver"); 906 + 907 + module_init(f71805f_init); 908 + module_exit(f71805f_exit);
+6 -2
drivers/hwmon/it87.c
··· 45 45 46 46 47 47 /* Addresses to scan */ 48 - static unsigned short normal_i2c[] = { 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 49 - 0x2e, 0x2f, I2C_CLIENT_END }; 48 + static unsigned short normal_i2c[] = { 0x2d, I2C_CLIENT_END }; 50 49 static unsigned short isa_address; 51 50 52 51 /* Insmod parameters */ ··· 828 829 /* Tell the I2C layer a new client has arrived */ 829 830 if ((err = i2c_attach_client(new_client))) 830 831 goto ERROR2; 832 + 833 + if (!is_isa) 834 + dev_info(&new_client->dev, "The I2C interface to IT87xxF " 835 + "hardware monitoring chips is deprecated. Please " 836 + "report if you still rely on it.\n"); 831 837 832 838 /* Check PWM configuration */ 833 839 enable_pwm_interface = it87_check_pwm(new_client);
+4 -4
drivers/hwmon/lm77.c
··· 87 87 88 88 /* In the temperature registers, the low 3 bits are not part of the 89 89 temperature values; they are the status bits. */ 90 - static inline u16 LM77_TEMP_TO_REG(int temp) 90 + static inline s16 LM77_TEMP_TO_REG(int temp) 91 91 { 92 92 int ntemp = SENSORS_LIMIT(temp, LM77_TEMP_MIN, LM77_TEMP_MAX); 93 - return (u16)((ntemp / 500) * 8); 93 + return (ntemp / 500) * 8; 94 94 } 95 95 96 - static inline int LM77_TEMP_FROM_REG(u16 reg) 96 + static inline int LM77_TEMP_FROM_REG(s16 reg) 97 97 { 98 - return ((int)reg / 8) * 500; 98 + return (reg / 8) * 500; 99 99 } 100 100 101 101 /* sysfs stuff */
+14 -17
drivers/hwmon/w83792d.c
··· 303 303 static int w83792d_attach_adapter(struct i2c_adapter *adapter); 304 304 static int w83792d_detect(struct i2c_adapter *adapter, int address, int kind); 305 305 static int w83792d_detach_client(struct i2c_client *client); 306 - 307 - static int w83792d_read_value(struct i2c_client *client, u8 register); 308 - static int w83792d_write_value(struct i2c_client *client, u8 register, 309 - u8 value); 310 306 static struct w83792d_data *w83792d_update_device(struct device *dev); 311 307 312 308 #ifdef DEBUG ··· 323 327 { 324 328 /* in7 and in8 do not have low bits, but the formula still works */ 325 329 return ((data->in[nr] << 2) | ((data->low_bits >> (2 * nr)) & 0x03)); 330 + } 331 + 332 + /* The SMBus locks itself. The Winbond W83792D chip has a bank register, 333 + but the driver only accesses registers in bank 0, so we don't have 334 + to switch banks and lock access between switches. */ 335 + static inline int w83792d_read_value(struct i2c_client *client, u8 reg) 336 + { 337 + return i2c_smbus_read_byte_data(client, reg); 338 + } 339 + 340 + static inline int 341 + w83792d_write_value(struct i2c_client *client, u8 reg, u8 value) 342 + { 343 + return i2c_smbus_write_byte_data(client, reg, value); 326 344 } 327 345 328 346 /* following are the sysfs callback functions */ ··· 1394 1384 kfree(client); 1395 1385 1396 1386 return 0; 1397 - } 1398 - 1399 - /* The SMBus locks itself. The Winbond W83792D chip has a bank register, 1400 - but the driver only accesses registers in bank 0, so we don't have 1401 - to switch banks and lock access between switches. */ 1402 - static int w83792d_read_value(struct i2c_client *client, u8 reg) 1403 - { 1404 - return i2c_smbus_read_byte_data(client, reg); 1405 - } 1406 - 1407 - static int w83792d_write_value(struct i2c_client *client, u8 reg, u8 value) 1408 - { 1409 - return i2c_smbus_write_byte_data(client, reg, value); 1410 1387 } 1411 1388 1412 1389 static void
+1 -1
drivers/i2c/algos/i2c-algo-sibyte.c
··· 202 202 #ifdef MODULE 203 203 MODULE_AUTHOR("Kip Walker, Broadcom Corp."); 204 204 MODULE_DESCRIPTION("SiByte I2C-Bus algorithm"); 205 - MODULE_PARM(bit_scan, "i"); 205 + module_param(bit_scan, int, 0); 206 206 MODULE_PARM_DESC(bit_scan, "Scan for active chips on the bus"); 207 207 MODULE_LICENSE("GPL"); 208 208
+1
drivers/i2c/busses/Kconfig
··· 124 124 ICH6 125 125 ICH7 126 126 ESB2 127 + ICH8 127 128 128 129 This driver can also be built as a module. If so, the module 129 130 will be called i2c-i801.
+2
drivers/i2c/busses/i2c-i801.c
··· 32 32 ICH6 266A 33 33 ICH7 27DA 34 34 ESB2 269B 35 + ICH8 283E 35 36 This driver supports several versions of Intel's I/O Controller Hubs (ICH). 36 37 For SMBus support, they are similar to the PIIX4 and are part 37 38 of Intel's '810' and other chipsets. ··· 528 527 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH6_16) }, 529 528 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH7_17) }, 530 529 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ESB2_17) }, 530 + { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH8_5) }, 531 531 { 0, } 532 532 }; 533 533
+3 -6
drivers/i2c/busses/i2c-parport-light.c
··· 121 121 122 122 static int __init i2c_parport_init(void) 123 123 { 124 - int type_count; 125 - 126 - type_count = sizeof(adapter_parm)/sizeof(struct adapter_parm); 127 - if (type < 0 || type >= type_count) { 124 + if (type < 0 || type >= ARRAY_SIZE(adapter_parm)) { 128 125 printk(KERN_WARNING "i2c-parport: invalid type (%d)\n", type); 129 126 type = 0; 130 127 } 131 - 128 + 132 129 if (base == 0) { 133 130 printk(KERN_INFO "i2c-parport: using default base 0x%x\n", DEFAULT_BASE); 134 131 base = DEFAULT_BASE; ··· 149 152 release_region(base, 3); 150 153 return -ENODEV; 151 154 } 152 - 155 + 153 156 return 0; 154 157 } 155 158
+2 -5
drivers/i2c/busses/i2c-parport.c
··· 241 241 242 242 static int __init i2c_parport_init(void) 243 243 { 244 - int type_count; 245 - 246 - type_count = sizeof(adapter_parm)/sizeof(struct adapter_parm); 247 - if (type < 0 || type >= type_count) { 244 + if (type < 0 || type >= ARRAY_SIZE(adapter_parm)) { 248 245 printk(KERN_WARNING "i2c-parport: invalid type (%d)\n", type); 249 246 type = 0; 250 247 } 251 - 248 + 252 249 return parport_register_driver(&i2c_parport_driver); 253 250 } 254 251
+1 -1
drivers/i2c/busses/i2c-pxa.c
··· 861 861 decode_ISR(isr); 862 862 } 863 863 864 - if (i2c->irqlogidx < sizeof(i2c->isrlog)/sizeof(u32)) 864 + if (i2c->irqlogidx < ARRAY_SIZE(i2c->isrlog)) 865 865 i2c->isrlog[i2c->irqlogidx++] = isr; 866 866 867 867 show_state(i2c);
+15
drivers/i2c/i2c-core.c
··· 946 946 } 947 947 } 948 948 949 + s32 i2c_smbus_write_i2c_block_data(struct i2c_client *client, u8 command, 950 + u8 length, u8 *values) 951 + { 952 + union i2c_smbus_data data; 953 + 954 + if (length > I2C_SMBUS_BLOCK_MAX) 955 + length = I2C_SMBUS_BLOCK_MAX; 956 + data.block[0] = length; 957 + memcpy(data.block + 1, values, length); 958 + return i2c_smbus_xfer(client->adapter, client->addr, client->flags, 959 + I2C_SMBUS_WRITE, command, 960 + I2C_SMBUS_I2C_BLOCK_DATA, &data); 961 + } 962 + 949 963 /* Simulate a SMBus command using the i2c protocol 950 964 No checking of parameters is done! */ 951 965 static s32 i2c_smbus_xfer_emulated(struct i2c_adapter * adapter, u16 addr, ··· 1164 1150 EXPORT_SYMBOL(i2c_smbus_write_word_data); 1165 1151 EXPORT_SYMBOL(i2c_smbus_write_block_data); 1166 1152 EXPORT_SYMBOL(i2c_smbus_read_i2c_block_data); 1153 + EXPORT_SYMBOL(i2c_smbus_write_i2c_block_data); 1167 1154 1168 1155 MODULE_AUTHOR("Simon G. Vogl <simon@tk.uni-linz.ac.at>"); 1169 1156 MODULE_DESCRIPTION("I2C-Bus main module");
+4 -2
drivers/ide/ide-disk.c
··· 190 190 if (lba48) { 191 191 task_ioreg_t tasklets[10]; 192 192 193 - pr_debug("%s: LBA=0x%012llx\n", drive->name, block); 193 + pr_debug("%s: LBA=0x%012llx\n", drive->name, 194 + (unsigned long long)block); 194 195 195 196 tasklets[0] = 0; 196 197 tasklets[1] = 0; ··· 318 317 319 318 pr_debug("%s: %sing: block=%llu, sectors=%lu, buffer=0x%08lx\n", 320 319 drive->name, rq_data_dir(rq) == READ ? "read" : "writ", 321 - block, rq->nr_sectors, (unsigned long)rq->buffer); 320 + (unsigned long long)block, rq->nr_sectors, 321 + (unsigned long)rq->buffer); 322 322 323 323 if (hwif->rw_disk) 324 324 hwif->rw_disk(drive, rq);
+1 -12
drivers/infiniband/core/ucm.c
··· 1319 1319 .release = ib_ucm_release_class_dev 1320 1320 }; 1321 1321 1322 - static ssize_t show_dev(struct class_device *class_dev, char *buf) 1323 - { 1324 - struct ib_ucm_device *dev; 1325 - 1326 - dev = container_of(class_dev, struct ib_ucm_device, class_dev); 1327 - return print_dev_t(buf, dev->dev.dev); 1328 - } 1329 - static CLASS_DEVICE_ATTR(dev, S_IRUGO, show_dev, NULL); 1330 - 1331 1322 static ssize_t show_ibdev(struct class_device *class_dev, char *buf) 1332 1323 { 1333 1324 struct ib_ucm_device *dev; ··· 1355 1364 1356 1365 ucm_dev->class_dev.class = &ucm_class; 1357 1366 ucm_dev->class_dev.dev = device->dma_device; 1367 + ucm_dev->class_dev.devt = ucm_dev->dev.dev; 1358 1368 snprintf(ucm_dev->class_dev.class_id, BUS_ID_SIZE, "ucm%d", 1359 1369 ucm_dev->devnum); 1360 1370 if (class_device_register(&ucm_dev->class_dev)) 1361 1371 goto err_cdev; 1362 1372 1363 - if (class_device_create_file(&ucm_dev->class_dev, 1364 - &class_device_attr_dev)) 1365 - goto err_class; 1366 1373 if (class_device_create_file(&ucm_dev->class_dev, 1367 1374 &class_device_attr_ibdev)) 1368 1375 goto err_class;
+1 -1
drivers/isdn/hisax/Kconfig
··· 351 351 352 352 config HISAX_AMD7930 353 353 bool "Am7930 (EXPERIMENTAL)" 354 - depends on EXPERIMENTAL && SPARC 354 + depends on EXPERIMENTAL && SPARC && BROKEN 355 355 help 356 356 This enables HiSax support for the AMD7930 chips on some SPARCs. 357 357 This code is not finished yet.
+8
drivers/macintosh/Kconfig
··· 187 187 This driver provides thermal control for the PowerMac9,1 188 188 which is the recent (SMU based) single CPU desktop G5 189 189 190 + config WINDFARM_PM112 191 + tristate "Support for thermal management on PowerMac11,2" 192 + depends on WINDFARM && I2C && PMAC_SMU 193 + select I2C_POWERMAC 194 + help 195 + This driver provides thermal control for the PowerMac11,2 196 + which are the recent dual and quad G5 machines using the 197 + 970MP dual-core processor. 190 198 191 199 config ANSLCD 192 200 tristate "Support for ANS LCD display"
+5
drivers/macintosh/Makefile
··· 35 35 windfarm_smu_sensors.o \ 36 36 windfarm_lm75_sensor.o windfarm_pid.o \ 37 37 windfarm_cpufreq_clamp.o windfarm_pm91.o 38 + obj-$(CONFIG_WINDFARM_PM112) += windfarm_pm112.o windfarm_smu_sat.o \ 39 + windfarm_smu_controls.o \ 40 + windfarm_smu_sensors.o \ 41 + windfarm_max6690_sensor.o \ 42 + windfarm_lm75_sensor.o windfarm_pid.o
+3
drivers/macintosh/windfarm.h
··· 14 14 #include <linux/list.h> 15 15 #include <linux/module.h> 16 16 #include <linux/notifier.h> 17 + #include <linux/device.h> 17 18 18 19 /* Display a 16.16 fixed point value */ 19 20 #define FIX32TOPRINT(f) ((f) >> 16),((((f) & 0xffff) * 1000) >> 16) ··· 40 39 char *name; 41 40 int type; 42 41 struct kref ref; 42 + struct device_attribute attr; 43 43 }; 44 44 45 45 #define WF_CONTROL_TYPE_GENERIC 0 ··· 89 87 struct wf_sensor_ops *ops; 90 88 char *name; 91 89 struct kref ref; 90 + struct device_attribute attr; 92 91 }; 93 92 94 93 /* Same lifetime rules as controls */
+92 -30
drivers/macintosh/windfarm_core.c
··· 33 33 #include <linux/reboot.h> 34 34 #include <linux/device.h> 35 35 #include <linux/platform_device.h> 36 + #include <linux/mutex.h> 36 37 37 38 #include "windfarm.h" 38 39 ··· 49 48 50 49 static LIST_HEAD(wf_controls); 51 50 static LIST_HEAD(wf_sensors); 52 - static DECLARE_MUTEX(wf_lock); 51 + static DEFINE_MUTEX(wf_lock); 53 52 static struct notifier_block *wf_client_list; 54 53 static int wf_client_count; 55 54 static unsigned int wf_overtemp; 56 55 static unsigned int wf_overtemp_counter; 57 56 struct task_struct *wf_thread; 57 + 58 + static struct platform_device wf_platform_device = { 59 + .name = "windfarm", 60 + }; 58 61 59 62 /* 60 63 * Utilities & tick thread ··· 161 156 kfree(ct); 162 157 } 163 158 159 + static ssize_t wf_show_control(struct device *dev, 160 + struct device_attribute *attr, char *buf) 161 + { 162 + struct wf_control *ctrl = container_of(attr, struct wf_control, attr); 163 + s32 val = 0; 164 + int err; 165 + 166 + err = ctrl->ops->get_value(ctrl, &val); 167 + if (err < 0) 168 + return err; 169 + return sprintf(buf, "%d\n", val); 170 + } 171 + 172 + /* This is really only for debugging... */ 173 + static ssize_t wf_store_control(struct device *dev, 174 + struct device_attribute *attr, 175 + const char *buf, size_t count) 176 + { 177 + struct wf_control *ctrl = container_of(attr, struct wf_control, attr); 178 + int val; 179 + int err; 180 + char *endp; 181 + 182 + val = simple_strtoul(buf, &endp, 0); 183 + while (endp < buf + count && (*endp == ' ' || *endp == '\n')) 184 + ++endp; 185 + if (endp - buf < count) 186 + return -EINVAL; 187 + err = ctrl->ops->set_value(ctrl, val); 188 + if (err < 0) 189 + return err; 190 + return count; 191 + } 192 + 164 193 int wf_register_control(struct wf_control *new_ct) 165 194 { 166 195 struct wf_control *ct; 167 196 168 - down(&wf_lock); 197 + mutex_lock(&wf_lock); 169 198 list_for_each_entry(ct, &wf_controls, link) { 170 199 if (!strcmp(ct->name, new_ct->name)) { 171 200 printk(KERN_WARNING "windfarm: trying to register" 172 201 " duplicate control %s\n", ct->name); 173 - up(&wf_lock); 202 + mutex_unlock(&wf_lock); 174 203 return -EEXIST; 175 204 } 176 205 } 177 206 kref_init(&new_ct->ref); 178 207 list_add(&new_ct->link, &wf_controls); 179 208 209 + new_ct->attr.attr.name = new_ct->name; 210 + new_ct->attr.attr.owner = THIS_MODULE; 211 + new_ct->attr.attr.mode = 0644; 212 + new_ct->attr.show = wf_show_control; 213 + new_ct->attr.store = wf_store_control; 214 + device_create_file(&wf_platform_device.dev, &new_ct->attr); 215 + 180 216 DBG("wf: Registered control %s\n", new_ct->name); 181 217 182 218 wf_notify(WF_EVENT_NEW_CONTROL, new_ct); 183 - up(&wf_lock); 219 + mutex_unlock(&wf_lock); 184 220 185 221 return 0; 186 222 } ··· 229 183 230 184 void wf_unregister_control(struct wf_control *ct) 231 185 { 232 - down(&wf_lock); 186 + mutex_lock(&wf_lock); 233 187 list_del(&ct->link); 234 - up(&wf_lock); 188 + mutex_unlock(&wf_lock); 235 189 236 190 DBG("wf: Unregistered control %s\n", ct->name); 237 191 ··· 243 197 { 244 198 struct wf_control *ct; 245 199 246 - down(&wf_lock); 200 + mutex_lock(&wf_lock); 247 201 list_for_each_entry(ct, &wf_controls, link) { 248 202 if (!strcmp(ct->name, name)) { 249 203 if (wf_get_control(ct)) 250 204 ct = NULL; 251 - up(&wf_lock); 205 + mutex_unlock(&wf_lock); 252 206 return ct; 253 207 } 254 208 } 255 - up(&wf_lock); 209 + mutex_unlock(&wf_lock); 256 210 return NULL; 257 211 } 258 212 EXPORT_SYMBOL_GPL(wf_find_control); ··· 292 246 kfree(sr); 293 247 } 294 248 249 + static ssize_t wf_show_sensor(struct device *dev, 250 + struct device_attribute *attr, char *buf) 251 + { 252 + struct wf_sensor *sens = container_of(attr, struct wf_sensor, attr); 253 + s32 val = 0; 254 + int err; 255 + 256 + err = sens->ops->get_value(sens, &val); 257 + if (err < 0) 258 + return err; 259 + return sprintf(buf, "%d.%03d\n", FIX32TOPRINT(val)); 260 + } 261 + 295 262 int wf_register_sensor(struct wf_sensor *new_sr) 296 263 { 297 264 struct wf_sensor *sr; 298 265 299 - down(&wf_lock); 266 + mutex_lock(&wf_lock); 300 267 list_for_each_entry(sr, &wf_sensors, link) { 301 268 if (!strcmp(sr->name, new_sr->name)) { 302 269 printk(KERN_WARNING "windfarm: trying to register" 303 270 " duplicate sensor %s\n", sr->name); 304 - up(&wf_lock); 271 + mutex_unlock(&wf_lock); 305 272 return -EEXIST; 306 273 } 307 274 } 308 275 kref_init(&new_sr->ref); 309 276 list_add(&new_sr->link, &wf_sensors); 310 277 278 + new_sr->attr.attr.name = new_sr->name; 279 + new_sr->attr.attr.owner = THIS_MODULE; 280 + new_sr->attr.attr.mode = 0444; 281 + new_sr->attr.show = wf_show_sensor; 282 + new_sr->attr.store = NULL; 283 + device_create_file(&wf_platform_device.dev, &new_sr->attr); 284 + 311 285 DBG("wf: Registered sensor %s\n", new_sr->name); 312 286 313 287 wf_notify(WF_EVENT_NEW_SENSOR, new_sr); 314 - up(&wf_lock); 288 + mutex_unlock(&wf_lock); 315 289 316 290 return 0; 317 291 } ··· 339 273 340 274 void wf_unregister_sensor(struct wf_sensor *sr) 341 275 { 342 - down(&wf_lock); 276 + mutex_lock(&wf_lock); 343 277 list_del(&sr->link); 344 - up(&wf_lock); 278 + mutex_unlock(&wf_lock); 345 279 346 280 DBG("wf: Unregistered sensor %s\n", sr->name); 347 281 ··· 353 287 { 354 288 struct wf_sensor *sr; 355 289 356 - down(&wf_lock); 290 + mutex_lock(&wf_lock); 357 291 list_for_each_entry(sr, &wf_sensors, link) { 358 292 if (!strcmp(sr->name, name)) { 359 293 if (wf_get_sensor(sr)) 360 294 sr = NULL; 361 - up(&wf_lock); 295 + mutex_unlock(&wf_lock); 362 296 return sr; 363 297 } 364 298 } 365 - up(&wf_lock); 299 + mutex_unlock(&wf_lock); 366 300 return NULL; 367 301 } 368 302 EXPORT_SYMBOL_GPL(wf_find_sensor); ··· 395 329 struct wf_control *ct; 396 330 struct wf_sensor *sr; 397 331 398 - down(&wf_lock); 332 + mutex_lock(&wf_lock); 399 333 rc = notifier_chain_register(&wf_client_list, nb); 400 334 if (rc != 0) 401 335 goto bail; ··· 407 341 if (wf_client_count == 1) 408 342 wf_start_thread(); 409 343 bail: 410 - up(&wf_lock); 344 + mutex_unlock(&wf_lock); 411 345 return rc; 412 346 } 413 347 EXPORT_SYMBOL_GPL(wf_register_client); 414 348 415 349 int wf_unregister_client(struct notifier_block *nb) 416 350 { 417 - down(&wf_lock); 351 + mutex_lock(&wf_lock); 418 352 notifier_chain_unregister(&wf_client_list, nb); 419 353 wf_client_count++; 420 354 if (wf_client_count == 0) 421 355 wf_stop_thread(); 422 - up(&wf_lock); 356 + mutex_unlock(&wf_lock); 423 357 424 358 return 0; 425 359 } ··· 427 361 428 362 void wf_set_overtemp(void) 429 363 { 430 - down(&wf_lock); 364 + mutex_lock(&wf_lock); 431 365 wf_overtemp++; 432 366 if (wf_overtemp == 1) { 433 367 printk(KERN_WARNING "windfarm: Overtemp condition detected !\n"); 434 368 wf_overtemp_counter = 0; 435 369 wf_notify(WF_EVENT_OVERTEMP, NULL); 436 370 } 437 - up(&wf_lock); 371 + mutex_unlock(&wf_lock); 438 372 } 439 373 EXPORT_SYMBOL_GPL(wf_set_overtemp); 440 374 441 375 void wf_clear_overtemp(void) 442 376 { 443 - down(&wf_lock); 377 + mutex_lock(&wf_lock); 444 378 WARN_ON(wf_overtemp == 0); 445 379 if (wf_overtemp == 0) { 446 - up(&wf_lock); 380 + mutex_unlock(&wf_lock); 447 381 return; 448 382 } 449 383 wf_overtemp--; ··· 451 385 printk(KERN_WARNING "windfarm: Overtemp condition cleared !\n"); 452 386 wf_notify(WF_EVENT_NORMALTEMP, NULL); 453 387 } 454 - up(&wf_lock); 388 + mutex_unlock(&wf_lock); 455 389 } 456 390 EXPORT_SYMBOL_GPL(wf_clear_overtemp); 457 391 ··· 460 394 return (wf_overtemp != 0); 461 395 } 462 396 EXPORT_SYMBOL_GPL(wf_is_overtemp); 463 - 464 - static struct platform_device wf_platform_device = { 465 - .name = "windfarm", 466 - }; 467 397 468 398 static int __init windfarm_core_init(void) 469 399 {
+169
drivers/macintosh/windfarm_max6690_sensor.c
··· 1 + /* 2 + * Windfarm PowerMac thermal control. MAX6690 sensor. 3 + * 4 + * Copyright (C) 2005 Paul Mackerras, IBM Corp. <paulus@samba.org> 5 + * 6 + * Use and redistribute under the terms of the GNU GPL v2. 7 + */ 8 + #include <linux/types.h> 9 + #include <linux/errno.h> 10 + #include <linux/kernel.h> 11 + #include <linux/init.h> 12 + #include <linux/slab.h> 13 + #include <linux/i2c.h> 14 + #include <linux/i2c-dev.h> 15 + #include <asm/prom.h> 16 + #include <asm/pmac_low_i2c.h> 17 + 18 + #include "windfarm.h" 19 + 20 + #define VERSION "0.1" 21 + 22 + /* This currently only exports the external temperature sensor, 23 + since that's all the control loops need. */ 24 + 25 + /* Some MAX6690 register numbers */ 26 + #define MAX6690_INTERNAL_TEMP 0 27 + #define MAX6690_EXTERNAL_TEMP 1 28 + 29 + struct wf_6690_sensor { 30 + struct i2c_client i2c; 31 + struct wf_sensor sens; 32 + }; 33 + 34 + #define wf_to_6690(x) container_of((x), struct wf_6690_sensor, sens) 35 + #define i2c_to_6690(x) container_of((x), struct wf_6690_sensor, i2c) 36 + 37 + static int wf_max6690_attach(struct i2c_adapter *adapter); 38 + static int wf_max6690_detach(struct i2c_client *client); 39 + 40 + static struct i2c_driver wf_max6690_driver = { 41 + .driver = { 42 + .name = "wf_max6690", 43 + }, 44 + .attach_adapter = wf_max6690_attach, 45 + .detach_client = wf_max6690_detach, 46 + }; 47 + 48 + static int wf_max6690_get(struct wf_sensor *sr, s32 *value) 49 + { 50 + struct wf_6690_sensor *max = wf_to_6690(sr); 51 + s32 data; 52 + 53 + if (max->i2c.adapter == NULL) 54 + return -ENODEV; 55 + 56 + /* chip gets initialized by firmware */ 57 + data = i2c_smbus_read_byte_data(&max->i2c, MAX6690_EXTERNAL_TEMP); 58 + if (data < 0) 59 + return data; 60 + *value = data << 16; 61 + return 0; 62 + } 63 + 64 + static void wf_max6690_release(struct wf_sensor *sr) 65 + { 66 + struct wf_6690_sensor *max = wf_to_6690(sr); 67 + 68 + if (max->i2c.adapter) { 69 + i2c_detach_client(&max->i2c); 70 + max->i2c.adapter = NULL; 71 + } 72 + kfree(max); 73 + } 74 + 75 + static struct wf_sensor_ops wf_max6690_ops = { 76 + .get_value = wf_max6690_get, 77 + .release = wf_max6690_release, 78 + .owner = THIS_MODULE, 79 + }; 80 + 81 + static void wf_max6690_create(struct i2c_adapter *adapter, u8 addr) 82 + { 83 + struct wf_6690_sensor *max; 84 + char *name = "u4-temp"; 85 + 86 + max = kzalloc(sizeof(struct wf_6690_sensor), GFP_KERNEL); 87 + if (max == NULL) { 88 + printk(KERN_ERR "windfarm: Couldn't create MAX6690 sensor %s: " 89 + "no memory\n", name); 90 + return; 91 + } 92 + 93 + max->sens.ops = &wf_max6690_ops; 94 + max->sens.name = name; 95 + max->i2c.addr = addr >> 1; 96 + max->i2c.adapter = adapter; 97 + max->i2c.driver = &wf_max6690_driver; 98 + strncpy(max->i2c.name, name, I2C_NAME_SIZE-1); 99 + 100 + if (i2c_attach_client(&max->i2c)) { 101 + printk(KERN_ERR "windfarm: failed to attach MAX6690 sensor\n"); 102 + goto fail; 103 + } 104 + 105 + if (wf_register_sensor(&max->sens)) { 106 + i2c_detach_client(&max->i2c); 107 + goto fail; 108 + } 109 + 110 + return; 111 + 112 + fail: 113 + kfree(max); 114 + } 115 + 116 + static int wf_max6690_attach(struct i2c_adapter *adapter) 117 + { 118 + struct device_node *busnode, *dev = NULL; 119 + struct pmac_i2c_bus *bus; 120 + const char *loc; 121 + u32 *reg; 122 + 123 + bus = pmac_i2c_adapter_to_bus(adapter); 124 + if (bus == NULL) 125 + return -ENODEV; 126 + busnode = pmac_i2c_get_bus_node(bus); 127 + 128 + while ((dev = of_get_next_child(busnode, dev)) != NULL) { 129 + if (!device_is_compatible(dev, "max6690")) 130 + continue; 131 + loc = get_property(dev, "hwsensor-location", NULL); 132 + reg = (u32 *) get_property(dev, "reg", NULL); 133 + if (!loc || !reg) 134 + continue; 135 + printk("found max6690, loc=%s reg=%x\n", loc, *reg); 136 + if (strcmp(loc, "BACKSIDE")) 137 + continue; 138 + wf_max6690_create(adapter, *reg); 139 + } 140 + 141 + return 0; 142 + } 143 + 144 + static int wf_max6690_detach(struct i2c_client *client) 145 + { 146 + struct wf_6690_sensor *max = i2c_to_6690(client); 147 + 148 + max->i2c.adapter = NULL; 149 + wf_unregister_sensor(&max->sens); 150 + 151 + return 0; 152 + } 153 + 154 + static int __init wf_max6690_sensor_init(void) 155 + { 156 + return i2c_add_driver(&wf_max6690_driver); 157 + } 158 + 159 + static void __exit wf_max6690_sensor_exit(void) 160 + { 161 + i2c_del_driver(&wf_max6690_driver); 162 + } 163 + 164 + module_init(wf_max6690_sensor_init); 165 + module_exit(wf_max6690_sensor_exit); 166 + 167 + MODULE_AUTHOR("Paul Mackerras <paulus@samba.org>"); 168 + MODULE_DESCRIPTION("MAX6690 sensor objects for PowerMac thermal control"); 169 + MODULE_LICENSE("GPL");
+4 -4
drivers/macintosh/windfarm_pid.c
··· 88 88 89 89 s32 wf_cpu_pid_run(struct wf_cpu_pid_state *st, s32 new_power, s32 new_temp) 90 90 { 91 - s64 error, integ, deriv, prop; 92 - s32 target, sval, adj; 91 + s64 integ, deriv, prop; 92 + s32 error, target, sval, adj; 93 93 int i, hlen = st->param.history_len; 94 94 95 95 /* Calculate error term */ ··· 117 117 integ += st->errors[(st->index + hlen - i) % hlen]; 118 118 integ *= st->param.interval; 119 119 integ *= st->param.gr; 120 - sval = st->param.tmax - ((integ >> 20) & 0xffffffff); 120 + sval = st->param.tmax - (s32)(integ >> 20); 121 121 adj = min(st->param.ttarget, sval); 122 122 123 123 DBG("integ: %lx, sval: %lx, adj: %lx\n", integ, sval, adj); ··· 129 129 deriv *= st->param.gd; 130 130 131 131 /* Calculate proportional term */ 132 - prop = (new_temp - adj); 132 + prop = st->last_delta = (new_temp - adj); 133 133 prop *= st->param.gp; 134 134 135 135 DBG("deriv: %lx, prop: %lx\n", deriv, prop);
+1
drivers/macintosh/windfarm_pid.h
··· 72 72 int index; /* index of current power */ 73 73 int tindex; /* index of current temp */ 74 74 s32 target; /* current target value */ 75 + s32 last_delta; /* last Tactual - Ttarget */ 75 76 s32 powers[WF_PID_MAX_HISTORY]; /* power history buffer */ 76 77 s32 errors[WF_PID_MAX_HISTORY]; /* error history buffer */ 77 78 s32 temps[2]; /* temp. history buffer */
+698
drivers/macintosh/windfarm_pm112.c
··· 1 + /* 2 + * Windfarm PowerMac thermal control. 3 + * Control loops for machines with SMU and PPC970MP processors. 4 + * 5 + * Copyright (C) 2005 Paul Mackerras, IBM Corp. <paulus@samba.org> 6 + * Copyright (C) 2006 Benjamin Herrenschmidt, IBM Corp. 7 + * 8 + * Use and redistribute under the terms of the GNU GPL v2. 9 + */ 10 + #include <linux/types.h> 11 + #include <linux/errno.h> 12 + #include <linux/kernel.h> 13 + #include <linux/device.h> 14 + #include <linux/platform_device.h> 15 + #include <linux/reboot.h> 16 + #include <asm/prom.h> 17 + #include <asm/smu.h> 18 + 19 + #include "windfarm.h" 20 + #include "windfarm_pid.h" 21 + 22 + #define VERSION "0.2" 23 + 24 + #define DEBUG 25 + #undef LOTSA_DEBUG 26 + 27 + #ifdef DEBUG 28 + #define DBG(args...) printk(args) 29 + #else 30 + #define DBG(args...) do { } while(0) 31 + #endif 32 + 33 + #ifdef LOTSA_DEBUG 34 + #define DBG_LOTS(args...) printk(args) 35 + #else 36 + #define DBG_LOTS(args...) do { } while(0) 37 + #endif 38 + 39 + /* define this to force CPU overtemp to 60 degree, useful for testing 40 + * the overtemp code 41 + */ 42 + #undef HACKED_OVERTEMP 43 + 44 + /* We currently only handle 2 chips, 4 cores... */ 45 + #define NR_CHIPS 2 46 + #define NR_CORES 4 47 + #define NR_CPU_FANS 3 * NR_CHIPS 48 + 49 + /* Controls and sensors */ 50 + static struct wf_sensor *sens_cpu_temp[NR_CORES]; 51 + static struct wf_sensor *sens_cpu_power[NR_CORES]; 52 + static struct wf_sensor *hd_temp; 53 + static struct wf_sensor *slots_power; 54 + static struct wf_sensor *u4_temp; 55 + 56 + static struct wf_control *cpu_fans[NR_CPU_FANS]; 57 + static char *cpu_fan_names[NR_CPU_FANS] = { 58 + "cpu-rear-fan-0", 59 + "cpu-rear-fan-1", 60 + "cpu-front-fan-0", 61 + "cpu-front-fan-1", 62 + "cpu-pump-0", 63 + "cpu-pump-1", 64 + }; 65 + static struct wf_control *cpufreq_clamp; 66 + 67 + /* Second pump isn't required (and isn't actually present) */ 68 + #define CPU_FANS_REQD (NR_CPU_FANS - 2) 69 + #define FIRST_PUMP 4 70 + #define LAST_PUMP 5 71 + 72 + /* We keep a temperature history for average calculation of 180s */ 73 + #define CPU_TEMP_HIST_SIZE 180 74 + 75 + /* Scale factor for fan speed, *100 */ 76 + static int cpu_fan_scale[NR_CPU_FANS] = { 77 + 100, 78 + 100, 79 + 97, /* inlet fans run at 97% of exhaust fan */ 80 + 97, 81 + 100, /* updated later */ 82 + 100, /* updated later */ 83 + }; 84 + 85 + static struct wf_control *backside_fan; 86 + static struct wf_control *slots_fan; 87 + static struct wf_control *drive_bay_fan; 88 + 89 + /* PID loop state */ 90 + static struct wf_cpu_pid_state cpu_pid[NR_CORES]; 91 + static u32 cpu_thist[CPU_TEMP_HIST_SIZE]; 92 + static int cpu_thist_pt; 93 + static s64 cpu_thist_total; 94 + static s32 cpu_all_tmax = 100 << 16; 95 + static int cpu_last_target; 96 + static struct wf_pid_state backside_pid; 97 + static int backside_tick; 98 + static struct wf_pid_state slots_pid; 99 + static int slots_started; 100 + static struct wf_pid_state drive_bay_pid; 101 + static int drive_bay_tick; 102 + 103 + static int nr_cores; 104 + static int have_all_controls; 105 + static int have_all_sensors; 106 + static int started; 107 + 108 + static int failure_state; 109 + #define FAILURE_SENSOR 1 110 + #define FAILURE_FAN 2 111 + #define FAILURE_PERM 4 112 + #define FAILURE_LOW_OVERTEMP 8 113 + #define FAILURE_HIGH_OVERTEMP 16 114 + 115 + /* Overtemp values */ 116 + #define LOW_OVER_AVERAGE 0 117 + #define LOW_OVER_IMMEDIATE (10 << 16) 118 + #define LOW_OVER_CLEAR ((-10) << 16) 119 + #define HIGH_OVER_IMMEDIATE (14 << 16) 120 + #define HIGH_OVER_AVERAGE (10 << 16) 121 + #define HIGH_OVER_IMMEDIATE (14 << 16) 122 + 123 + 124 + /* Implementation... */ 125 + static int create_cpu_loop(int cpu) 126 + { 127 + int chip = cpu / 2; 128 + int core = cpu & 1; 129 + struct smu_sdbp_header *hdr; 130 + struct smu_sdbp_cpupiddata *piddata; 131 + struct wf_cpu_pid_param pid; 132 + struct wf_control *main_fan = cpu_fans[0]; 133 + s32 tmax; 134 + int fmin; 135 + 136 + /* Get PID params from the appropriate SAT */ 137 + hdr = smu_sat_get_sdb_partition(chip, 0xC8 + core, NULL); 138 + if (hdr == NULL) { 139 + printk(KERN_WARNING"windfarm: can't get CPU PID fan config\n"); 140 + return -EINVAL; 141 + } 142 + piddata = (struct smu_sdbp_cpupiddata *)&hdr[1]; 143 + 144 + /* Get FVT params to get Tmax; if not found, assume default */ 145 + hdr = smu_sat_get_sdb_partition(chip, 0xC4 + core, NULL); 146 + if (hdr) { 147 + struct smu_sdbp_fvt *fvt = (struct smu_sdbp_fvt *)&hdr[1]; 148 + tmax = fvt->maxtemp << 16; 149 + } else 150 + tmax = 95 << 16; /* default to 95 degrees C */ 151 + 152 + /* We keep a global tmax for overtemp calculations */ 153 + if (tmax < cpu_all_tmax) 154 + cpu_all_tmax = tmax; 155 + 156 + /* 157 + * Darwin has a minimum fan speed of 1000 rpm for the 4-way and 158 + * 515 for the 2-way. That appears to be overkill, so for now, 159 + * impose a minimum of 750 or 515. 160 + */ 161 + fmin = (nr_cores > 2) ? 750 : 515; 162 + 163 + /* Initialize PID loop */ 164 + pid.interval = 1; /* seconds */ 165 + pid.history_len = piddata->history_len; 166 + pid.gd = piddata->gd; 167 + pid.gp = piddata->gp; 168 + pid.gr = piddata->gr / piddata->history_len; 169 + pid.pmaxadj = (piddata->max_power << 16) - (piddata->power_adj << 8); 170 + pid.ttarget = tmax - (piddata->target_temp_delta << 16); 171 + pid.tmax = tmax; 172 + pid.min = main_fan->ops->get_min(main_fan); 173 + pid.max = main_fan->ops->get_max(main_fan); 174 + if (pid.min < fmin) 175 + pid.min = fmin; 176 + 177 + wf_cpu_pid_init(&cpu_pid[cpu], &pid); 178 + return 0; 179 + } 180 + 181 + static void cpu_max_all_fans(void) 182 + { 183 + int i; 184 + 185 + /* We max all CPU fans in case of a sensor error. We also do the 186 + * cpufreq clamping now, even if it's supposedly done later by the 187 + * generic code anyway, we do it earlier here to react faster 188 + */ 189 + if (cpufreq_clamp) 190 + wf_control_set_max(cpufreq_clamp); 191 + for (i = 0; i < NR_CPU_FANS; ++i) 192 + if (cpu_fans[i]) 193 + wf_control_set_max(cpu_fans[i]); 194 + } 195 + 196 + static int cpu_check_overtemp(s32 temp) 197 + { 198 + int new_state = 0; 199 + s32 t_avg, t_old; 200 + 201 + /* First check for immediate overtemps */ 202 + if (temp >= (cpu_all_tmax + LOW_OVER_IMMEDIATE)) { 203 + new_state |= FAILURE_LOW_OVERTEMP; 204 + if ((failure_state & FAILURE_LOW_OVERTEMP) == 0) 205 + printk(KERN_ERR "windfarm: Overtemp due to immediate CPU" 206 + " temperature !\n"); 207 + } 208 + if (temp >= (cpu_all_tmax + HIGH_OVER_IMMEDIATE)) { 209 + new_state |= FAILURE_HIGH_OVERTEMP; 210 + if ((failure_state & FAILURE_HIGH_OVERTEMP) == 0) 211 + printk(KERN_ERR "windfarm: Critical overtemp due to" 212 + " immediate CPU temperature !\n"); 213 + } 214 + 215 + /* We calculate a history of max temperatures and use that for the 216 + * overtemp management 217 + */ 218 + t_old = cpu_thist[cpu_thist_pt]; 219 + cpu_thist[cpu_thist_pt] = temp; 220 + cpu_thist_pt = (cpu_thist_pt + 1) % CPU_TEMP_HIST_SIZE; 221 + cpu_thist_total -= t_old; 222 + cpu_thist_total += temp; 223 + t_avg = cpu_thist_total / CPU_TEMP_HIST_SIZE; 224 + 225 + DBG_LOTS("t_avg = %d.%03d (out: %d.%03d, in: %d.%03d)\n", 226 + FIX32TOPRINT(t_avg), FIX32TOPRINT(t_old), FIX32TOPRINT(temp)); 227 + 228 + /* Now check for average overtemps */ 229 + if (t_avg >= (cpu_all_tmax + LOW_OVER_AVERAGE)) { 230 + new_state |= FAILURE_LOW_OVERTEMP; 231 + if ((failure_state & FAILURE_LOW_OVERTEMP) == 0) 232 + printk(KERN_ERR "windfarm: Overtemp due to average CPU" 233 + " temperature !\n"); 234 + } 235 + if (t_avg >= (cpu_all_tmax + HIGH_OVER_AVERAGE)) { 236 + new_state |= FAILURE_HIGH_OVERTEMP; 237 + if ((failure_state & FAILURE_HIGH_OVERTEMP) == 0) 238 + printk(KERN_ERR "windfarm: Critical overtemp due to" 239 + " average CPU temperature !\n"); 240 + } 241 + 242 + /* Now handle overtemp conditions. We don't currently use the windfarm 243 + * overtemp handling core as it's not fully suited to the needs of those 244 + * new machine. This will be fixed later. 245 + */ 246 + if (new_state) { 247 + /* High overtemp -> immediate shutdown */ 248 + if (new_state & FAILURE_HIGH_OVERTEMP) 249 + machine_power_off(); 250 + if ((failure_state & new_state) != new_state) 251 + cpu_max_all_fans(); 252 + failure_state |= new_state; 253 + } else if ((failure_state & FAILURE_LOW_OVERTEMP) && 254 + (temp < (cpu_all_tmax + LOW_OVER_CLEAR))) { 255 + printk(KERN_ERR "windfarm: Overtemp condition cleared !\n"); 256 + failure_state &= ~FAILURE_LOW_OVERTEMP; 257 + } 258 + 259 + return failure_state & (FAILURE_LOW_OVERTEMP | FAILURE_HIGH_OVERTEMP); 260 + } 261 + 262 + static void cpu_fans_tick(void) 263 + { 264 + int err, cpu; 265 + s32 greatest_delta = 0; 266 + s32 temp, power, t_max = 0; 267 + int i, t, target = 0; 268 + struct wf_sensor *sr; 269 + struct wf_control *ct; 270 + struct wf_cpu_pid_state *sp; 271 + 272 + DBG_LOTS(KERN_DEBUG); 273 + for (cpu = 0; cpu < nr_cores; ++cpu) { 274 + /* Get CPU core temperature */ 275 + sr = sens_cpu_temp[cpu]; 276 + err = sr->ops->get_value(sr, &temp); 277 + if (err) { 278 + DBG("\n"); 279 + printk(KERN_WARNING "windfarm: CPU %d temperature " 280 + "sensor error %d\n", cpu, err); 281 + failure_state |= FAILURE_SENSOR; 282 + cpu_max_all_fans(); 283 + return; 284 + } 285 + 286 + /* Keep track of highest temp */ 287 + t_max = max(t_max, temp); 288 + 289 + /* Get CPU power */ 290 + sr = sens_cpu_power[cpu]; 291 + err = sr->ops->get_value(sr, &power); 292 + if (err) { 293 + DBG("\n"); 294 + printk(KERN_WARNING "windfarm: CPU %d power " 295 + "sensor error %d\n", cpu, err); 296 + failure_state |= FAILURE_SENSOR; 297 + cpu_max_all_fans(); 298 + return; 299 + } 300 + 301 + /* Run PID */ 302 + sp = &cpu_pid[cpu]; 303 + t = wf_cpu_pid_run(sp, power, temp); 304 + 305 + if (cpu == 0 || sp->last_delta > greatest_delta) { 306 + greatest_delta = sp->last_delta; 307 + target = t; 308 + } 309 + DBG_LOTS("[%d] P=%d.%.3d T=%d.%.3d ", 310 + cpu, FIX32TOPRINT(power), FIX32TOPRINT(temp)); 311 + } 312 + DBG_LOTS("fans = %d, t_max = %d.%03d\n", target, FIX32TOPRINT(t_max)); 313 + 314 + /* Darwin limits decrease to 20 per iteration */ 315 + if (target < (cpu_last_target - 20)) 316 + target = cpu_last_target - 20; 317 + cpu_last_target = target; 318 + for (cpu = 0; cpu < nr_cores; ++cpu) 319 + cpu_pid[cpu].target = target; 320 + 321 + /* Handle possible overtemps */ 322 + if (cpu_check_overtemp(t_max)) 323 + return; 324 + 325 + /* Set fans */ 326 + for (i = 0; i < NR_CPU_FANS; ++i) { 327 + ct = cpu_fans[i]; 328 + if (ct == NULL) 329 + continue; 330 + err = ct->ops->set_value(ct, target * cpu_fan_scale[i] / 100); 331 + if (err) { 332 + printk(KERN_WARNING "windfarm: fan %s reports " 333 + "error %d\n", ct->name, err); 334 + failure_state |= FAILURE_FAN; 335 + break; 336 + } 337 + } 338 + } 339 + 340 + /* Backside/U4 fan */ 341 + static struct wf_pid_param backside_param = { 342 + .interval = 5, 343 + .history_len = 2, 344 + .gd = 48 << 20, 345 + .gp = 5 << 20, 346 + .gr = 0, 347 + .itarget = 64 << 16, 348 + .additive = 1, 349 + }; 350 + 351 + static void backside_fan_tick(void) 352 + { 353 + s32 temp; 354 + int speed; 355 + int err; 356 + 357 + if (!backside_fan || !u4_temp) 358 + return; 359 + if (!backside_tick) { 360 + /* first time; initialize things */ 361 + backside_param.min = backside_fan->ops->get_min(backside_fan); 362 + backside_param.max = backside_fan->ops->get_max(backside_fan); 363 + wf_pid_init(&backside_pid, &backside_param); 364 + backside_tick = 1; 365 + } 366 + if (--backside_tick > 0) 367 + return; 368 + backside_tick = backside_pid.param.interval; 369 + 370 + err = u4_temp->ops->get_value(u4_temp, &temp); 371 + if (err) { 372 + printk(KERN_WARNING "windfarm: U4 temp sensor error %d\n", 373 + err); 374 + failure_state |= FAILURE_SENSOR; 375 + wf_control_set_max(backside_fan); 376 + return; 377 + } 378 + speed = wf_pid_run(&backside_pid, temp); 379 + DBG_LOTS("backside PID temp=%d.%.3d speed=%d\n", 380 + FIX32TOPRINT(temp), speed); 381 + 382 + err = backside_fan->ops->set_value(backside_fan, speed); 383 + if (err) { 384 + printk(KERN_WARNING "windfarm: backside fan error %d\n", err); 385 + failure_state |= FAILURE_FAN; 386 + } 387 + } 388 + 389 + /* Drive bay fan */ 390 + static struct wf_pid_param drive_bay_prm = { 391 + .interval = 5, 392 + .history_len = 2, 393 + .gd = 30 << 20, 394 + .gp = 5 << 20, 395 + .gr = 0, 396 + .itarget = 40 << 16, 397 + .additive = 1, 398 + }; 399 + 400 + static void drive_bay_fan_tick(void) 401 + { 402 + s32 temp; 403 + int speed; 404 + int err; 405 + 406 + if (!drive_bay_fan || !hd_temp) 407 + return; 408 + if (!drive_bay_tick) { 409 + /* first time; initialize things */ 410 + drive_bay_prm.min = drive_bay_fan->ops->get_min(drive_bay_fan); 411 + drive_bay_prm.max = drive_bay_fan->ops->get_max(drive_bay_fan); 412 + wf_pid_init(&drive_bay_pid, &drive_bay_prm); 413 + drive_bay_tick = 1; 414 + } 415 + if (--drive_bay_tick > 0) 416 + return; 417 + drive_bay_tick = drive_bay_pid.param.interval; 418 + 419 + err = hd_temp->ops->get_value(hd_temp, &temp); 420 + if (err) { 421 + printk(KERN_WARNING "windfarm: drive bay temp sensor " 422 + "error %d\n", err); 423 + failure_state |= FAILURE_SENSOR; 424 + wf_control_set_max(drive_bay_fan); 425 + return; 426 + } 427 + speed = wf_pid_run(&drive_bay_pid, temp); 428 + DBG_LOTS("drive_bay PID temp=%d.%.3d speed=%d\n", 429 + FIX32TOPRINT(temp), speed); 430 + 431 + err = drive_bay_fan->ops->set_value(drive_bay_fan, speed); 432 + if (err) { 433 + printk(KERN_WARNING "windfarm: drive bay fan error %d\n", err); 434 + failure_state |= FAILURE_FAN; 435 + } 436 + } 437 + 438 + /* PCI slots area fan */ 439 + /* This makes the fan speed proportional to the power consumed */ 440 + static struct wf_pid_param slots_param = { 441 + .interval = 1, 442 + .history_len = 2, 443 + .gd = 0, 444 + .gp = 0, 445 + .gr = 0x1277952, 446 + .itarget = 0, 447 + .min = 1560, 448 + .max = 3510, 449 + }; 450 + 451 + static void slots_fan_tick(void) 452 + { 453 + s32 power; 454 + int speed; 455 + int err; 456 + 457 + if (!slots_fan || !slots_power) 458 + return; 459 + if (!slots_started) { 460 + /* first time; initialize things */ 461 + wf_pid_init(&slots_pid, &slots_param); 462 + slots_started = 1; 463 + } 464 + 465 + err = slots_power->ops->get_value(slots_power, &power); 466 + if (err) { 467 + printk(KERN_WARNING "windfarm: slots power sensor error %d\n", 468 + err); 469 + failure_state |= FAILURE_SENSOR; 470 + wf_control_set_max(slots_fan); 471 + return; 472 + } 473 + speed = wf_pid_run(&slots_pid, power); 474 + DBG_LOTS("slots PID power=%d.%.3d speed=%d\n", 475 + FIX32TOPRINT(power), speed); 476 + 477 + err = slots_fan->ops->set_value(slots_fan, speed); 478 + if (err) { 479 + printk(KERN_WARNING "windfarm: slots fan error %d\n", err); 480 + failure_state |= FAILURE_FAN; 481 + } 482 + } 483 + 484 + static void set_fail_state(void) 485 + { 486 + int i; 487 + 488 + if (cpufreq_clamp) 489 + wf_control_set_max(cpufreq_clamp); 490 + for (i = 0; i < NR_CPU_FANS; ++i) 491 + if (cpu_fans[i]) 492 + wf_control_set_max(cpu_fans[i]); 493 + if (backside_fan) 494 + wf_control_set_max(backside_fan); 495 + if (slots_fan) 496 + wf_control_set_max(slots_fan); 497 + if (drive_bay_fan) 498 + wf_control_set_max(drive_bay_fan); 499 + } 500 + 501 + static void pm112_tick(void) 502 + { 503 + int i, last_failure; 504 + 505 + if (!started) { 506 + started = 1; 507 + for (i = 0; i < nr_cores; ++i) { 508 + if (create_cpu_loop(i) < 0) { 509 + failure_state = FAILURE_PERM; 510 + set_fail_state(); 511 + break; 512 + } 513 + } 514 + DBG_LOTS("cpu_all_tmax=%d.%03d\n", FIX32TOPRINT(cpu_all_tmax)); 515 + 516 + #ifdef HACKED_OVERTEMP 517 + cpu_all_tmax = 60 << 16; 518 + #endif 519 + } 520 + 521 + /* Permanent failure, bail out */ 522 + if (failure_state & FAILURE_PERM) 523 + return; 524 + /* Clear all failure bits except low overtemp which will be eventually 525 + * cleared by the control loop itself 526 + */ 527 + last_failure = failure_state; 528 + failure_state &= FAILURE_LOW_OVERTEMP; 529 + cpu_fans_tick(); 530 + backside_fan_tick(); 531 + slots_fan_tick(); 532 + drive_bay_fan_tick(); 533 + 534 + DBG_LOTS("last_failure: 0x%x, failure_state: %x\n", 535 + last_failure, failure_state); 536 + 537 + /* Check for failures. Any failure causes cpufreq clamping */ 538 + if (failure_state && last_failure == 0 && cpufreq_clamp) 539 + wf_control_set_max(cpufreq_clamp); 540 + if (failure_state == 0 && last_failure && cpufreq_clamp) 541 + wf_control_set_min(cpufreq_clamp); 542 + 543 + /* That's it for now, we might want to deal with other failures 544 + * differently in the future though 545 + */ 546 + } 547 + 548 + static void pm112_new_control(struct wf_control *ct) 549 + { 550 + int i, max_exhaust; 551 + 552 + if (cpufreq_clamp == NULL && !strcmp(ct->name, "cpufreq-clamp")) { 553 + if (wf_get_control(ct) == 0) 554 + cpufreq_clamp = ct; 555 + } 556 + 557 + for (i = 0; i < NR_CPU_FANS; ++i) { 558 + if (!strcmp(ct->name, cpu_fan_names[i])) { 559 + if (cpu_fans[i] == NULL && wf_get_control(ct) == 0) 560 + cpu_fans[i] = ct; 561 + break; 562 + } 563 + } 564 + if (i >= NR_CPU_FANS) { 565 + /* not a CPU fan, try the others */ 566 + if (!strcmp(ct->name, "backside-fan")) { 567 + if (backside_fan == NULL && wf_get_control(ct) == 0) 568 + backside_fan = ct; 569 + } else if (!strcmp(ct->name, "slots-fan")) { 570 + if (slots_fan == NULL && wf_get_control(ct) == 0) 571 + slots_fan = ct; 572 + } else if (!strcmp(ct->name, "drive-bay-fan")) { 573 + if (drive_bay_fan == NULL && wf_get_control(ct) == 0) 574 + drive_bay_fan = ct; 575 + } 576 + return; 577 + } 578 + 579 + for (i = 0; i < CPU_FANS_REQD; ++i) 580 + if (cpu_fans[i] == NULL) 581 + return; 582 + 583 + /* work out pump scaling factors */ 584 + max_exhaust = cpu_fans[0]->ops->get_max(cpu_fans[0]); 585 + for (i = FIRST_PUMP; i <= LAST_PUMP; ++i) 586 + if ((ct = cpu_fans[i]) != NULL) 587 + cpu_fan_scale[i] = 588 + ct->ops->get_max(ct) * 100 / max_exhaust; 589 + 590 + have_all_controls = 1; 591 + } 592 + 593 + static void pm112_new_sensor(struct wf_sensor *sr) 594 + { 595 + unsigned int i; 596 + 597 + if (have_all_sensors) 598 + return; 599 + if (!strncmp(sr->name, "cpu-temp-", 9)) { 600 + i = sr->name[9] - '0'; 601 + if (sr->name[10] == 0 && i < NR_CORES && 602 + sens_cpu_temp[i] == NULL && wf_get_sensor(sr) == 0) 603 + sens_cpu_temp[i] = sr; 604 + 605 + } else if (!strncmp(sr->name, "cpu-power-", 10)) { 606 + i = sr->name[10] - '0'; 607 + if (sr->name[11] == 0 && i < NR_CORES && 608 + sens_cpu_power[i] == NULL && wf_get_sensor(sr) == 0) 609 + sens_cpu_power[i] = sr; 610 + } else if (!strcmp(sr->name, "hd-temp")) { 611 + if (hd_temp == NULL && wf_get_sensor(sr) == 0) 612 + hd_temp = sr; 613 + } else if (!strcmp(sr->name, "slots-power")) { 614 + if (slots_power == NULL && wf_get_sensor(sr) == 0) 615 + slots_power = sr; 616 + } else if (!strcmp(sr->name, "u4-temp")) { 617 + if (u4_temp == NULL && wf_get_sensor(sr) == 0) 618 + u4_temp = sr; 619 + } else 620 + return; 621 + 622 + /* check if we have all the sensors we need */ 623 + for (i = 0; i < nr_cores; ++i) 624 + if (sens_cpu_temp[i] == NULL || sens_cpu_power[i] == NULL) 625 + return; 626 + 627 + have_all_sensors = 1; 628 + } 629 + 630 + static int pm112_wf_notify(struct notifier_block *self, 631 + unsigned long event, void *data) 632 + { 633 + switch (event) { 634 + case WF_EVENT_NEW_SENSOR: 635 + pm112_new_sensor(data); 636 + break; 637 + case WF_EVENT_NEW_CONTROL: 638 + pm112_new_control(data); 639 + break; 640 + case WF_EVENT_TICK: 641 + if (have_all_controls && have_all_sensors) 642 + pm112_tick(); 643 + } 644 + return 0; 645 + } 646 + 647 + static struct notifier_block pm112_events = { 648 + .notifier_call = pm112_wf_notify, 649 + }; 650 + 651 + static int wf_pm112_probe(struct device *dev) 652 + { 653 + wf_register_client(&pm112_events); 654 + return 0; 655 + } 656 + 657 + static int wf_pm112_remove(struct device *dev) 658 + { 659 + wf_unregister_client(&pm112_events); 660 + /* should release all sensors and controls */ 661 + return 0; 662 + } 663 + 664 + static struct device_driver wf_pm112_driver = { 665 + .name = "windfarm", 666 + .bus = &platform_bus_type, 667 + .probe = wf_pm112_probe, 668 + .remove = wf_pm112_remove, 669 + }; 670 + 671 + static int __init wf_pm112_init(void) 672 + { 673 + struct device_node *cpu; 674 + 675 + if (!machine_is_compatible("PowerMac11,2")) 676 + return -ENODEV; 677 + 678 + /* Count the number of CPU cores */ 679 + nr_cores = 0; 680 + for (cpu = NULL; (cpu = of_find_node_by_type(cpu, "cpu")) != NULL; ) 681 + ++nr_cores; 682 + 683 + printk(KERN_INFO "windfarm: initializing for dual-core desktop G5\n"); 684 + driver_register(&wf_pm112_driver); 685 + return 0; 686 + } 687 + 688 + static void __exit wf_pm112_exit(void) 689 + { 690 + driver_unregister(&wf_pm112_driver); 691 + } 692 + 693 + module_init(wf_pm112_init); 694 + module_exit(wf_pm112_exit); 695 + 696 + MODULE_AUTHOR("Paul Mackerras <paulus@samba.org>"); 697 + MODULE_DESCRIPTION("Thermal control for PowerMac11,2"); 698 + MODULE_LICENSE("GPL");
+12 -75
drivers/macintosh/windfarm_pm81.c
··· 538 538 } 539 539 } 540 540 541 - 542 - /* 543 - * ****** Attributes ****** 544 - * 545 - */ 546 - 547 - #define BUILD_SHOW_FUNC_FIX(name, data) \ 548 - static ssize_t show_##name(struct device *dev, \ 549 - struct device_attribute *attr, \ 550 - char *buf) \ 551 - { \ 552 - ssize_t r; \ 553 - s32 val = 0; \ 554 - data->ops->get_value(data, &val); \ 555 - r = sprintf(buf, "%d.%03d", FIX32TOPRINT(val)); \ 556 - return r; \ 557 - } \ 558 - static DEVICE_ATTR(name,S_IRUGO,show_##name, NULL); 559 - 560 - 561 - #define BUILD_SHOW_FUNC_INT(name, data) \ 562 - static ssize_t show_##name(struct device *dev, \ 563 - struct device_attribute *attr, \ 564 - char *buf) \ 565 - { \ 566 - s32 val = 0; \ 567 - data->ops->get_value(data, &val); \ 568 - return sprintf(buf, "%d", val); \ 569 - } \ 570 - static DEVICE_ATTR(name,S_IRUGO,show_##name, NULL); 571 - 572 - BUILD_SHOW_FUNC_INT(cpu_fan, fan_cpu_main); 573 - BUILD_SHOW_FUNC_INT(sys_fan, fan_system); 574 - BUILD_SHOW_FUNC_INT(hd_fan, fan_hd); 575 - 576 - BUILD_SHOW_FUNC_FIX(cpu_temp, sensor_cpu_temp); 577 - BUILD_SHOW_FUNC_FIX(cpu_power, sensor_cpu_power); 578 - BUILD_SHOW_FUNC_FIX(hd_temp, sensor_hd_temp); 579 - 580 541 /* 581 542 * ****** Setup / Init / Misc ... ****** 582 543 * ··· 615 654 return; 616 655 617 656 if (fan_cpu_main == NULL && !strcmp(ct->name, "cpu-fan")) { 618 - if (wf_get_control(ct) == 0) { 657 + if (wf_get_control(ct) == 0) 619 658 fan_cpu_main = ct; 620 - device_create_file(wf_smu_dev, &dev_attr_cpu_fan); 621 - } 622 659 } 623 660 624 661 if (fan_system == NULL && !strcmp(ct->name, "system-fan")) { 625 - if (wf_get_control(ct) == 0) { 662 + if (wf_get_control(ct) == 0) 626 663 fan_system = ct; 627 - device_create_file(wf_smu_dev, &dev_attr_sys_fan); 628 - } 629 664 } 630 665 631 666 if (cpufreq_clamp == NULL && !strcmp(ct->name, "cpufreq-clamp")) { ··· 640 683 } 641 684 642 685 if (fan_hd == NULL && !strcmp(ct->name, "drive-bay-fan")) { 643 - if (wf_get_control(ct) == 0) { 686 + if (wf_get_control(ct) == 0) 644 687 fan_hd = ct; 645 - device_create_file(wf_smu_dev, &dev_attr_hd_fan); 646 - } 647 688 } 648 689 649 690 if (fan_system && fan_hd && fan_cpu_main && cpufreq_clamp) ··· 654 699 return; 655 700 656 701 if (sensor_cpu_power == NULL && !strcmp(sr->name, "cpu-power")) { 657 - if (wf_get_sensor(sr) == 0) { 702 + if (wf_get_sensor(sr) == 0) 658 703 sensor_cpu_power = sr; 659 - device_create_file(wf_smu_dev, &dev_attr_cpu_power); 660 - } 661 704 } 662 705 663 706 if (sensor_cpu_temp == NULL && !strcmp(sr->name, "cpu-temp")) { 664 - if (wf_get_sensor(sr) == 0) { 707 + if (wf_get_sensor(sr) == 0) 665 708 sensor_cpu_temp = sr; 666 - device_create_file(wf_smu_dev, &dev_attr_cpu_temp); 667 - } 668 709 } 669 710 670 711 if (sensor_hd_temp == NULL && !strcmp(sr->name, "hd-temp")) { 671 - if (wf_get_sensor(sr) == 0) { 712 + if (wf_get_sensor(sr) == 0) 672 713 sensor_hd_temp = sr; 673 - device_create_file(wf_smu_dev, &dev_attr_hd_temp); 674 - } 675 714 } 676 715 677 716 if (sensor_cpu_power && sensor_cpu_temp && sensor_hd_temp) ··· 743 794 * with that except by adding locks all over... I'll do that 744 795 * eventually but heh, who ever rmmod this module anyway ? 745 796 */ 746 - if (sensor_cpu_power) { 747 - device_remove_file(wf_smu_dev, &dev_attr_cpu_power); 797 + if (sensor_cpu_power) 748 798 wf_put_sensor(sensor_cpu_power); 749 - } 750 - if (sensor_cpu_temp) { 751 - device_remove_file(wf_smu_dev, &dev_attr_cpu_temp); 799 + if (sensor_cpu_temp) 752 800 wf_put_sensor(sensor_cpu_temp); 753 - } 754 - if (sensor_hd_temp) { 755 - device_remove_file(wf_smu_dev, &dev_attr_hd_temp); 801 + if (sensor_hd_temp) 756 802 wf_put_sensor(sensor_hd_temp); 757 - } 758 803 759 804 /* Release all controls */ 760 - if (fan_cpu_main) { 761 - device_remove_file(wf_smu_dev, &dev_attr_cpu_fan); 805 + if (fan_cpu_main) 762 806 wf_put_control(fan_cpu_main); 763 - } 764 - if (fan_hd) { 765 - device_remove_file(wf_smu_dev, &dev_attr_hd_fan); 807 + if (fan_hd) 766 808 wf_put_control(fan_hd); 767 - } 768 - if (fan_system) { 769 - device_remove_file(wf_smu_dev, &dev_attr_sys_fan); 809 + if (fan_system) 770 810 wf_put_control(fan_system); 771 - } 772 811 if (cpufreq_clamp) 773 812 wf_put_control(cpufreq_clamp); 774 813
+14 -81
drivers/macintosh/windfarm_pm91.c
··· 458 458 459 459 460 460 /* 461 - * ****** Attributes ****** 462 - * 463 - */ 464 - 465 - #define BUILD_SHOW_FUNC_FIX(name, data) \ 466 - static ssize_t show_##name(struct device *dev, \ 467 - struct device_attribute *attr, \ 468 - char *buf) \ 469 - { \ 470 - ssize_t r; \ 471 - s32 val = 0; \ 472 - data->ops->get_value(data, &val); \ 473 - r = sprintf(buf, "%d.%03d", FIX32TOPRINT(val)); \ 474 - return r; \ 475 - } \ 476 - static DEVICE_ATTR(name,S_IRUGO,show_##name, NULL); 477 - 478 - 479 - #define BUILD_SHOW_FUNC_INT(name, data) \ 480 - static ssize_t show_##name(struct device *dev, \ 481 - struct device_attribute *attr, \ 482 - char *buf) \ 483 - { \ 484 - s32 val = 0; \ 485 - data->ops->get_value(data, &val); \ 486 - return sprintf(buf, "%d", val); \ 487 - } \ 488 - static DEVICE_ATTR(name,S_IRUGO,show_##name, NULL); 489 - 490 - BUILD_SHOW_FUNC_INT(cpu_fan, fan_cpu_main); 491 - BUILD_SHOW_FUNC_INT(hd_fan, fan_hd); 492 - BUILD_SHOW_FUNC_INT(slots_fan, fan_slots); 493 - 494 - BUILD_SHOW_FUNC_FIX(cpu_temp, sensor_cpu_temp); 495 - BUILD_SHOW_FUNC_FIX(cpu_power, sensor_cpu_power); 496 - BUILD_SHOW_FUNC_FIX(hd_temp, sensor_hd_temp); 497 - BUILD_SHOW_FUNC_FIX(slots_power, sensor_slots_power); 498 - 499 - /* 500 461 * ****** Setup / Init / Misc ... ****** 501 462 * 502 463 */ ··· 542 581 return; 543 582 544 583 if (fan_cpu_main == NULL && !strcmp(ct->name, "cpu-rear-fan-0")) { 545 - if (wf_get_control(ct) == 0) { 584 + if (wf_get_control(ct) == 0) 546 585 fan_cpu_main = ct; 547 - device_create_file(wf_smu_dev, &dev_attr_cpu_fan); 548 - } 549 586 } 550 587 551 588 if (fan_cpu_second == NULL && !strcmp(ct->name, "cpu-rear-fan-1")) { ··· 562 603 } 563 604 564 605 if (fan_hd == NULL && !strcmp(ct->name, "drive-bay-fan")) { 565 - if (wf_get_control(ct) == 0) { 606 + if (wf_get_control(ct) == 0) 566 607 fan_hd = ct; 567 - device_create_file(wf_smu_dev, &dev_attr_hd_fan); 568 - } 569 608 } 570 609 571 610 if (fan_slots == NULL && !strcmp(ct->name, "slots-fan")) { 572 - if (wf_get_control(ct) == 0) { 611 + if (wf_get_control(ct) == 0) 573 612 fan_slots = ct; 574 - device_create_file(wf_smu_dev, &dev_attr_slots_fan); 575 - } 576 613 } 577 614 578 615 if (fan_cpu_main && (fan_cpu_second || fan_cpu_third) && fan_hd && ··· 582 627 return; 583 628 584 629 if (sensor_cpu_power == NULL && !strcmp(sr->name, "cpu-power")) { 585 - if (wf_get_sensor(sr) == 0) { 630 + if (wf_get_sensor(sr) == 0) 586 631 sensor_cpu_power = sr; 587 - device_create_file(wf_smu_dev, &dev_attr_cpu_power); 588 - } 589 632 } 590 633 591 634 if (sensor_cpu_temp == NULL && !strcmp(sr->name, "cpu-temp")) { 592 - if (wf_get_sensor(sr) == 0) { 635 + if (wf_get_sensor(sr) == 0) 593 636 sensor_cpu_temp = sr; 594 - device_create_file(wf_smu_dev, &dev_attr_cpu_temp); 595 - } 596 637 } 597 638 598 639 if (sensor_hd_temp == NULL && !strcmp(sr->name, "hd-temp")) { 599 - if (wf_get_sensor(sr) == 0) { 640 + if (wf_get_sensor(sr) == 0) 600 641 sensor_hd_temp = sr; 601 - device_create_file(wf_smu_dev, &dev_attr_hd_temp); 602 - } 603 642 } 604 643 605 644 if (sensor_slots_power == NULL && !strcmp(sr->name, "slots-power")) { 606 - if (wf_get_sensor(sr) == 0) { 645 + if (wf_get_sensor(sr) == 0) 607 646 sensor_slots_power = sr; 608 - device_create_file(wf_smu_dev, &dev_attr_slots_power); 609 - } 610 647 } 611 648 612 649 if (sensor_cpu_power && sensor_cpu_temp && ··· 667 720 * with that except by adding locks all over... I'll do that 668 721 * eventually but heh, who ever rmmod this module anyway ? 669 722 */ 670 - if (sensor_cpu_power) { 671 - device_remove_file(wf_smu_dev, &dev_attr_cpu_power); 723 + if (sensor_cpu_power) 672 724 wf_put_sensor(sensor_cpu_power); 673 - } 674 - if (sensor_cpu_temp) { 675 - device_remove_file(wf_smu_dev, &dev_attr_cpu_temp); 725 + if (sensor_cpu_temp) 676 726 wf_put_sensor(sensor_cpu_temp); 677 - } 678 - if (sensor_hd_temp) { 679 - device_remove_file(wf_smu_dev, &dev_attr_hd_temp); 727 + if (sensor_hd_temp) 680 728 wf_put_sensor(sensor_hd_temp); 681 - } 682 - if (sensor_slots_power) { 683 - device_remove_file(wf_smu_dev, &dev_attr_slots_power); 729 + if (sensor_slots_power) 684 730 wf_put_sensor(sensor_slots_power); 685 - } 686 731 687 732 /* Release all controls */ 688 - if (fan_cpu_main) { 689 - device_remove_file(wf_smu_dev, &dev_attr_cpu_fan); 733 + if (fan_cpu_main) 690 734 wf_put_control(fan_cpu_main); 691 - } 692 735 if (fan_cpu_second) 693 736 wf_put_control(fan_cpu_second); 694 737 if (fan_cpu_third) 695 738 wf_put_control(fan_cpu_third); 696 - if (fan_hd) { 697 - device_remove_file(wf_smu_dev, &dev_attr_hd_fan); 739 + if (fan_hd) 698 740 wf_put_control(fan_hd); 699 - } 700 - if (fan_slots) { 701 - device_remove_file(wf_smu_dev, &dev_attr_slots_fan); 741 + if (fan_slots) 702 742 wf_put_control(fan_slots); 703 - } 704 743 if (cpufreq_clamp) 705 744 wf_put_control(cpufreq_clamp); 706 745
+54 -15
drivers/macintosh/windfarm_smu_controls.c
··· 24 24 25 25 #include "windfarm.h" 26 26 27 - #define VERSION "0.3" 27 + #define VERSION "0.4" 28 28 29 29 #undef DEBUG 30 30 ··· 33 33 #else 34 34 #define DBG(args...) do { } while(0) 35 35 #endif 36 + 37 + static int smu_supports_new_fans_ops = 1; 36 38 37 39 /* 38 40 * SMU fans control object ··· 61 59 62 60 /* Fill SMU command structure */ 63 61 cmd.cmd = SMU_CMD_FAN_COMMAND; 64 - cmd.data_len = 14; 62 + 63 + /* The SMU has an "old" and a "new" way of setting the fan speed 64 + * Unfortunately, I found no reliable way to know which one works 65 + * on a given machine model. After some investigations it appears 66 + * that MacOS X just tries the new one, and if it fails fallbacks 67 + * to the old ones ... Ugh. 68 + */ 69 + retry: 70 + if (smu_supports_new_fans_ops) { 71 + buffer[0] = 0x30; 72 + buffer[1] = id; 73 + *((u16 *)(&buffer[2])) = value; 74 + cmd.data_len = 4; 75 + } else { 76 + if (id > 7) 77 + return -EINVAL; 78 + /* Fill argument buffer */ 79 + memset(buffer, 0, 16); 80 + buffer[0] = pwm ? 0x10 : 0x00; 81 + buffer[1] = 0x01 << id; 82 + *((u16 *)&buffer[2 + id * 2]) = value; 83 + cmd.data_len = 14; 84 + } 85 + 65 86 cmd.reply_len = 16; 66 87 cmd.data_buf = cmd.reply_buf = buffer; 67 88 cmd.status = 0; 68 89 cmd.done = smu_done_complete; 69 90 cmd.misc = &comp; 70 91 71 - /* Fill argument buffer */ 72 - memset(buffer, 0, 16); 73 - buffer[0] = pwm ? 0x10 : 0x00; 74 - buffer[1] = 0x01 << id; 75 - *((u16 *)&buffer[2 + id * 2]) = value; 76 - 77 92 rc = smu_queue_cmd(&cmd); 78 93 if (rc) 79 94 return rc; 80 95 wait_for_completion(&comp); 96 + 97 + /* Handle fallback (see coment above) */ 98 + if (cmd.status != 0 && smu_supports_new_fans_ops) { 99 + printk(KERN_WARNING "windfarm: SMU failed new fan command " 100 + "falling back to old method\n"); 101 + smu_supports_new_fans_ops = 0; 102 + goto retry; 103 + } 104 + 81 105 return cmd.status; 82 106 } 83 107 ··· 186 158 187 159 /* Names used on desktop models */ 188 160 if (!strcmp(l, "Rear Fan 0") || !strcmp(l, "Rear Fan") || 189 - !strcmp(l, "Rear fan 0") || !strcmp(l, "Rear fan")) 161 + !strcmp(l, "Rear fan 0") || !strcmp(l, "Rear fan") || 162 + !strcmp(l, "CPU A EXHAUST")) 190 163 fct->ctrl.name = "cpu-rear-fan-0"; 191 - else if (!strcmp(l, "Rear Fan 1") || !strcmp(l, "Rear fan 1")) 164 + else if (!strcmp(l, "Rear Fan 1") || !strcmp(l, "Rear fan 1") || 165 + !strcmp(l, "CPU B EXHAUST")) 192 166 fct->ctrl.name = "cpu-rear-fan-1"; 193 167 else if (!strcmp(l, "Front Fan 0") || !strcmp(l, "Front Fan") || 194 - !strcmp(l, "Front fan 0") || !strcmp(l, "Front fan")) 168 + !strcmp(l, "Front fan 0") || !strcmp(l, "Front fan") || 169 + !strcmp(l, "CPU A INTAKE")) 195 170 fct->ctrl.name = "cpu-front-fan-0"; 196 - else if (!strcmp(l, "Front Fan 1") || !strcmp(l, "Front fan 1")) 171 + else if (!strcmp(l, "Front Fan 1") || !strcmp(l, "Front fan 1") || 172 + !strcmp(l, "CPU B INTAKE")) 197 173 fct->ctrl.name = "cpu-front-fan-1"; 198 - else if (!strcmp(l, "Slots Fan") || !strcmp(l, "Slots fan")) 174 + else if (!strcmp(l, "CPU A PUMP")) 175 + fct->ctrl.name = "cpu-pump-0"; 176 + else if (!strcmp(l, "Slots Fan") || !strcmp(l, "Slots fan") || 177 + !strcmp(l, "EXPANSION SLOTS INTAKE")) 199 178 fct->ctrl.name = "slots-fan"; 200 - else if (!strcmp(l, "Drive Bay") || !strcmp(l, "Drive bay")) 179 + else if (!strcmp(l, "Drive Bay") || !strcmp(l, "Drive bay") || 180 + !strcmp(l, "DRIVE BAY A INTAKE")) 201 181 fct->ctrl.name = "drive-bay-fan"; 182 + else if (!strcmp(l, "BACKSIDE")) 183 + fct->ctrl.name = "backside-fan"; 202 184 203 185 /* Names used on iMac models */ 204 186 if (!strcmp(l, "System Fan") || !strcmp(l, "System fan")) ··· 261 223 262 224 /* Look for RPM fans */ 263 225 for (fans = NULL; (fans = of_get_next_child(smu, fans)) != NULL;) 264 - if (!strcmp(fans->name, "rpm-fans")) 226 + if (!strcmp(fans->name, "rpm-fans") || 227 + device_is_compatible(fans, "smu-rpm-fans")) 265 228 break; 266 229 for (fan = NULL; 267 230 fans && (fan = of_get_next_child(fans, fan)) != NULL;) {
+418
drivers/macintosh/windfarm_smu_sat.c
··· 1 + /* 2 + * Windfarm PowerMac thermal control. SMU "satellite" controller sensors. 3 + * 4 + * Copyright (C) 2005 Paul Mackerras, IBM Corp. <paulus@samba.org> 5 + * 6 + * Released under the terms of the GNU GPL v2. 7 + */ 8 + 9 + #include <linux/types.h> 10 + #include <linux/errno.h> 11 + #include <linux/kernel.h> 12 + #include <linux/slab.h> 13 + #include <linux/init.h> 14 + #include <linux/wait.h> 15 + #include <linux/i2c.h> 16 + #include <linux/i2c-dev.h> 17 + #include <asm/semaphore.h> 18 + #include <asm/prom.h> 19 + #include <asm/smu.h> 20 + #include <asm/pmac_low_i2c.h> 21 + 22 + #include "windfarm.h" 23 + 24 + #define VERSION "0.2" 25 + 26 + #define DEBUG 27 + 28 + #ifdef DEBUG 29 + #define DBG(args...) printk(args) 30 + #else 31 + #define DBG(args...) do { } while(0) 32 + #endif 33 + 34 + /* If the cache is older than 800ms we'll refetch it */ 35 + #define MAX_AGE msecs_to_jiffies(800) 36 + 37 + struct wf_sat { 38 + int nr; 39 + atomic_t refcnt; 40 + struct semaphore mutex; 41 + unsigned long last_read; /* jiffies when cache last updated */ 42 + u8 cache[16]; 43 + struct i2c_client i2c; 44 + struct device_node *node; 45 + }; 46 + 47 + static struct wf_sat *sats[2]; 48 + 49 + struct wf_sat_sensor { 50 + int index; 51 + int index2; /* used for power sensors */ 52 + int shift; 53 + struct wf_sat *sat; 54 + struct wf_sensor sens; 55 + }; 56 + 57 + #define wf_to_sat(c) container_of(c, struct wf_sat_sensor, sens) 58 + #define i2c_to_sat(c) container_of(c, struct wf_sat, i2c) 59 + 60 + static int wf_sat_attach(struct i2c_adapter *adapter); 61 + static int wf_sat_detach(struct i2c_client *client); 62 + 63 + static struct i2c_driver wf_sat_driver = { 64 + .driver = { 65 + .name = "wf_smu_sat", 66 + }, 67 + .attach_adapter = wf_sat_attach, 68 + .detach_client = wf_sat_detach, 69 + }; 70 + 71 + /* 72 + * XXX i2c_smbus_read_i2c_block_data doesn't pass the requested 73 + * length down to the low-level driver, so we use this, which 74 + * works well enough with the SMU i2c driver code... 75 + */ 76 + static int sat_read_block(struct i2c_client *client, u8 command, 77 + u8 *values, int len) 78 + { 79 + union i2c_smbus_data data; 80 + int err; 81 + 82 + data.block[0] = len; 83 + err = i2c_smbus_xfer(client->adapter, client->addr, client->flags, 84 + I2C_SMBUS_READ, command, I2C_SMBUS_I2C_BLOCK_DATA, 85 + &data); 86 + if (!err) 87 + memcpy(values, data.block, len); 88 + return err; 89 + } 90 + 91 + struct smu_sdbp_header *smu_sat_get_sdb_partition(unsigned int sat_id, int id, 92 + unsigned int *size) 93 + { 94 + struct wf_sat *sat; 95 + int err; 96 + unsigned int i, len; 97 + u8 *buf; 98 + u8 data[4]; 99 + 100 + /* TODO: Add the resulting partition to the device-tree */ 101 + 102 + if (sat_id > 1 || (sat = sats[sat_id]) == NULL) 103 + return NULL; 104 + 105 + err = i2c_smbus_write_word_data(&sat->i2c, 8, id << 8); 106 + if (err) { 107 + printk(KERN_ERR "smu_sat_get_sdb_part wr error %d\n", err); 108 + return NULL; 109 + } 110 + 111 + len = i2c_smbus_read_word_data(&sat->i2c, 9); 112 + if (len < 0) { 113 + printk(KERN_ERR "smu_sat_get_sdb_part rd len error\n"); 114 + return NULL; 115 + } 116 + if (len == 0) { 117 + printk(KERN_ERR "smu_sat_get_sdb_part no partition %x\n", id); 118 + return NULL; 119 + } 120 + 121 + len = le16_to_cpu(len); 122 + len = (len + 3) & ~3; 123 + buf = kmalloc(len, GFP_KERNEL); 124 + if (buf == NULL) 125 + return NULL; 126 + 127 + for (i = 0; i < len; i += 4) { 128 + err = sat_read_block(&sat->i2c, 0xa, data, 4); 129 + if (err) { 130 + printk(KERN_ERR "smu_sat_get_sdb_part rd err %d\n", 131 + err); 132 + goto fail; 133 + } 134 + buf[i] = data[1]; 135 + buf[i+1] = data[0]; 136 + buf[i+2] = data[3]; 137 + buf[i+3] = data[2]; 138 + } 139 + #ifdef DEBUG 140 + DBG(KERN_DEBUG "sat %d partition %x:", sat_id, id); 141 + for (i = 0; i < len; ++i) 142 + DBG(" %x", buf[i]); 143 + DBG("\n"); 144 + #endif 145 + 146 + if (size) 147 + *size = len; 148 + return (struct smu_sdbp_header *) buf; 149 + 150 + fail: 151 + kfree(buf); 152 + return NULL; 153 + } 154 + 155 + /* refresh the cache */ 156 + static int wf_sat_read_cache(struct wf_sat *sat) 157 + { 158 + int err; 159 + 160 + err = sat_read_block(&sat->i2c, 0x3f, sat->cache, 16); 161 + if (err) 162 + return err; 163 + sat->last_read = jiffies; 164 + #ifdef LOTSA_DEBUG 165 + { 166 + int i; 167 + DBG(KERN_DEBUG "wf_sat_get: data is"); 168 + for (i = 0; i < 16; ++i) 169 + DBG(" %.2x", sat->cache[i]); 170 + DBG("\n"); 171 + } 172 + #endif 173 + return 0; 174 + } 175 + 176 + static int wf_sat_get(struct wf_sensor *sr, s32 *value) 177 + { 178 + struct wf_sat_sensor *sens = wf_to_sat(sr); 179 + struct wf_sat *sat = sens->sat; 180 + int i, err; 181 + s32 val; 182 + 183 + if (sat->i2c.adapter == NULL) 184 + return -ENODEV; 185 + 186 + down(&sat->mutex); 187 + if (time_after(jiffies, (sat->last_read + MAX_AGE))) { 188 + err = wf_sat_read_cache(sat); 189 + if (err) 190 + goto fail; 191 + } 192 + 193 + i = sens->index * 2; 194 + val = ((sat->cache[i] << 8) + sat->cache[i+1]) << sens->shift; 195 + if (sens->index2 >= 0) { 196 + i = sens->index2 * 2; 197 + /* 4.12 * 8.8 -> 12.20; shift right 4 to get 16.16 */ 198 + val = (val * ((sat->cache[i] << 8) + sat->cache[i+1])) >> 4; 199 + } 200 + 201 + *value = val; 202 + err = 0; 203 + 204 + fail: 205 + up(&sat->mutex); 206 + return err; 207 + } 208 + 209 + static void wf_sat_release(struct wf_sensor *sr) 210 + { 211 + struct wf_sat_sensor *sens = wf_to_sat(sr); 212 + struct wf_sat *sat = sens->sat; 213 + 214 + if (atomic_dec_and_test(&sat->refcnt)) { 215 + if (sat->i2c.adapter) { 216 + i2c_detach_client(&sat->i2c); 217 + sat->i2c.adapter = NULL; 218 + } 219 + if (sat->nr >= 0) 220 + sats[sat->nr] = NULL; 221 + kfree(sat); 222 + } 223 + kfree(sens); 224 + } 225 + 226 + static struct wf_sensor_ops wf_sat_ops = { 227 + .get_value = wf_sat_get, 228 + .release = wf_sat_release, 229 + .owner = THIS_MODULE, 230 + }; 231 + 232 + static void wf_sat_create(struct i2c_adapter *adapter, struct device_node *dev) 233 + { 234 + struct wf_sat *sat; 235 + struct wf_sat_sensor *sens; 236 + u32 *reg; 237 + char *loc, *type; 238 + u8 addr, chip, core; 239 + struct device_node *child; 240 + int shift, cpu, index; 241 + char *name; 242 + int vsens[2], isens[2]; 243 + 244 + reg = (u32 *) get_property(dev, "reg", NULL); 245 + if (reg == NULL) 246 + return; 247 + addr = *reg; 248 + DBG(KERN_DEBUG "wf_sat: creating sat at address %x\n", addr); 249 + 250 + sat = kzalloc(sizeof(struct wf_sat), GFP_KERNEL); 251 + if (sat == NULL) 252 + return; 253 + sat->nr = -1; 254 + sat->node = of_node_get(dev); 255 + atomic_set(&sat->refcnt, 0); 256 + init_MUTEX(&sat->mutex); 257 + sat->i2c.addr = (addr >> 1) & 0x7f; 258 + sat->i2c.adapter = adapter; 259 + sat->i2c.driver = &wf_sat_driver; 260 + strncpy(sat->i2c.name, "smu-sat", I2C_NAME_SIZE-1); 261 + 262 + if (i2c_attach_client(&sat->i2c)) { 263 + printk(KERN_ERR "windfarm: failed to attach smu-sat to i2c\n"); 264 + goto fail; 265 + } 266 + 267 + vsens[0] = vsens[1] = -1; 268 + isens[0] = isens[1] = -1; 269 + child = NULL; 270 + while ((child = of_get_next_child(dev, child)) != NULL) { 271 + reg = (u32 *) get_property(child, "reg", NULL); 272 + type = get_property(child, "device_type", NULL); 273 + loc = get_property(child, "location", NULL); 274 + if (reg == NULL || loc == NULL) 275 + continue; 276 + 277 + /* the cooked sensors are between 0x30 and 0x37 */ 278 + if (*reg < 0x30 || *reg > 0x37) 279 + continue; 280 + index = *reg - 0x30; 281 + 282 + /* expect location to be CPU [AB][01] ... */ 283 + if (strncmp(loc, "CPU ", 4) != 0) 284 + continue; 285 + chip = loc[4] - 'A'; 286 + core = loc[5] - '0'; 287 + if (chip > 1 || core > 1) { 288 + printk(KERN_ERR "wf_sat_create: don't understand " 289 + "location %s for %s\n", loc, child->full_name); 290 + continue; 291 + } 292 + cpu = 2 * chip + core; 293 + if (sat->nr < 0) 294 + sat->nr = chip; 295 + else if (sat->nr != chip) { 296 + printk(KERN_ERR "wf_sat_create: can't cope with " 297 + "multiple CPU chips on one SAT (%s)\n", loc); 298 + continue; 299 + } 300 + 301 + if (strcmp(type, "voltage-sensor") == 0) { 302 + name = "cpu-voltage"; 303 + shift = 4; 304 + vsens[core] = index; 305 + } else if (strcmp(type, "current-sensor") == 0) { 306 + name = "cpu-current"; 307 + shift = 8; 308 + isens[core] = index; 309 + } else if (strcmp(type, "temp-sensor") == 0) { 310 + name = "cpu-temp"; 311 + shift = 10; 312 + } else 313 + continue; /* hmmm shouldn't happen */ 314 + 315 + /* the +16 is enough for "cpu-voltage-n" */ 316 + sens = kzalloc(sizeof(struct wf_sat_sensor) + 16, GFP_KERNEL); 317 + if (sens == NULL) { 318 + printk(KERN_ERR "wf_sat_create: couldn't create " 319 + "%s sensor %d (no memory)\n", name, cpu); 320 + continue; 321 + } 322 + sens->index = index; 323 + sens->index2 = -1; 324 + sens->shift = shift; 325 + sens->sat = sat; 326 + atomic_inc(&sat->refcnt); 327 + sens->sens.ops = &wf_sat_ops; 328 + sens->sens.name = (char *) (sens + 1); 329 + snprintf(sens->sens.name, 16, "%s-%d", name, cpu); 330 + 331 + if (wf_register_sensor(&sens->sens)) { 332 + atomic_dec(&sat->refcnt); 333 + kfree(sens); 334 + } 335 + } 336 + 337 + /* make the power sensors */ 338 + for (core = 0; core < 2; ++core) { 339 + if (vsens[core] < 0 || isens[core] < 0) 340 + continue; 341 + cpu = 2 * sat->nr + core; 342 + sens = kzalloc(sizeof(struct wf_sat_sensor) + 16, GFP_KERNEL); 343 + if (sens == NULL) { 344 + printk(KERN_ERR "wf_sat_create: couldn't create power " 345 + "sensor %d (no memory)\n", cpu); 346 + continue; 347 + } 348 + sens->index = vsens[core]; 349 + sens->index2 = isens[core]; 350 + sens->shift = 0; 351 + sens->sat = sat; 352 + atomic_inc(&sat->refcnt); 353 + sens->sens.ops = &wf_sat_ops; 354 + sens->sens.name = (char *) (sens + 1); 355 + snprintf(sens->sens.name, 16, "cpu-power-%d", cpu); 356 + 357 + if (wf_register_sensor(&sens->sens)) { 358 + atomic_dec(&sat->refcnt); 359 + kfree(sens); 360 + } 361 + } 362 + 363 + if (sat->nr >= 0) 364 + sats[sat->nr] = sat; 365 + 366 + return; 367 + 368 + fail: 369 + kfree(sat); 370 + } 371 + 372 + static int wf_sat_attach(struct i2c_adapter *adapter) 373 + { 374 + struct device_node *busnode, *dev = NULL; 375 + struct pmac_i2c_bus *bus; 376 + 377 + bus = pmac_i2c_adapter_to_bus(adapter); 378 + if (bus == NULL) 379 + return -ENODEV; 380 + busnode = pmac_i2c_get_bus_node(bus); 381 + 382 + while ((dev = of_get_next_child(busnode, dev)) != NULL) 383 + if (device_is_compatible(dev, "smu-sat")) 384 + wf_sat_create(adapter, dev); 385 + return 0; 386 + } 387 + 388 + static int wf_sat_detach(struct i2c_client *client) 389 + { 390 + struct wf_sat *sat = i2c_to_sat(client); 391 + 392 + /* XXX TODO */ 393 + 394 + sat->i2c.adapter = NULL; 395 + return 0; 396 + } 397 + 398 + static int __init sat_sensors_init(void) 399 + { 400 + int err; 401 + 402 + err = i2c_add_driver(&wf_sat_driver); 403 + if (err < 0) 404 + return err; 405 + return 0; 406 + } 407 + 408 + static void __exit sat_sensors_exit(void) 409 + { 410 + i2c_del_driver(&wf_sat_driver); 411 + } 412 + 413 + module_init(sat_sensors_init); 414 + /*module_exit(sat_sensors_exit); Uncomment when cleanup is implemented */ 415 + 416 + MODULE_AUTHOR("Paul Mackerras <paulus@samba.org>"); 417 + MODULE_DESCRIPTION("SMU satellite sensors for PowerMac thermal control"); 418 + MODULE_LICENSE("GPL");
+23 -20
drivers/macintosh/windfarm_smu_sensors.c
··· 220 220 !strcmp(l, "CPU T-Diode")) { 221 221 ads->sens.ops = &smu_cputemp_ops; 222 222 ads->sens.name = "cpu-temp"; 223 + if (cpudiode == NULL) { 224 + DBG("wf: cpudiode partition (%02x) not found\n", 225 + SMU_SDB_CPUDIODE_ID); 226 + goto fail; 227 + } 223 228 } else if (!strcmp(c, "current-sensor") && 224 229 !strcmp(l, "CPU Current")) { 225 230 ads->sens.ops = &smu_cpuamp_ops; 226 231 ads->sens.name = "cpu-current"; 232 + if (cpuvcp == NULL) { 233 + DBG("wf: cpuvcp partition (%02x) not found\n", 234 + SMU_SDB_CPUVCP_ID); 235 + goto fail; 236 + } 227 237 } else if (!strcmp(c, "voltage-sensor") && 228 238 !strcmp(l, "CPU Voltage")) { 229 239 ads->sens.ops = &smu_cpuvolt_ops; 230 240 ads->sens.name = "cpu-voltage"; 241 + if (cpuvcp == NULL) { 242 + DBG("wf: cpuvcp partition (%02x) not found\n", 243 + SMU_SDB_CPUVCP_ID); 244 + goto fail; 245 + } 231 246 } else if (!strcmp(c, "power-sensor") && 232 247 !strcmp(l, "Slots Power")) { 233 248 ads->sens.ops = &smu_slotspow_ops; ··· 380 365 return NULL; 381 366 } 382 367 383 - static int smu_fetch_param_partitions(void) 368 + static void smu_fetch_param_partitions(void) 384 369 { 385 370 struct smu_sdbp_header *hdr; 386 371 387 372 /* Get CPU voltage/current/power calibration data */ 388 373 hdr = smu_get_sdb_partition(SMU_SDB_CPUVCP_ID, NULL); 389 - if (hdr == NULL) { 390 - DBG("wf: cpuvcp partition (%02x) not found\n", 391 - SMU_SDB_CPUVCP_ID); 392 - return -ENODEV; 374 + if (hdr != NULL) { 375 + cpuvcp = (struct smu_sdbp_cpuvcp *)&hdr[1]; 376 + /* Keep version around */ 377 + cpuvcp_version = hdr->version; 393 378 } 394 - cpuvcp = (struct smu_sdbp_cpuvcp *)&hdr[1]; 395 - /* Keep version around */ 396 - cpuvcp_version = hdr->version; 397 379 398 380 /* Get CPU diode calibration data */ 399 381 hdr = smu_get_sdb_partition(SMU_SDB_CPUDIODE_ID, NULL); 400 - if (hdr == NULL) { 401 - DBG("wf: cpudiode partition (%02x) not found\n", 402 - SMU_SDB_CPUDIODE_ID); 403 - return -ENODEV; 404 - } 405 - cpudiode = (struct smu_sdbp_cpudiode *)&hdr[1]; 382 + if (hdr != NULL) 383 + cpudiode = (struct smu_sdbp_cpudiode *)&hdr[1]; 406 384 407 385 /* Get slots power calibration data if any */ 408 386 hdr = smu_get_sdb_partition(SMU_SDB_SLOTSPOW_ID, NULL); ··· 406 398 hdr = smu_get_sdb_partition(SMU_SDB_DEBUG_SWITCHES_ID, NULL); 407 399 if (hdr != NULL) 408 400 debugswitches = (u8 *)&hdr[1]; 409 - 410 - return 0; 411 401 } 412 402 413 403 static int __init smu_sensors_init(void) 414 404 { 415 405 struct device_node *smu, *sensors, *s; 416 406 struct smu_ad_sensor *volt_sensor = NULL, *curr_sensor = NULL; 417 - int rc; 418 407 419 408 if (!smu_present()) 420 409 return -ENODEV; 421 410 422 411 /* Get parameters partitions */ 423 - rc = smu_fetch_param_partitions(); 424 - if (rc) 425 - return rc; 412 + smu_fetch_param_partitions(); 426 413 427 414 smu = of_find_node_by_type(NULL, "smu"); 428 415 if (smu == NULL)
+2 -2
drivers/media/dvb/dvb-usb/dtt200u.c
··· 151 151 .cold_ids = { &dtt200u_usb_table[0], NULL }, 152 152 .warm_ids = { &dtt200u_usb_table[1], NULL }, 153 153 }, 154 - { 0 }, 154 + { NULL }, 155 155 } 156 156 }; 157 157 ··· 192 192 .cold_ids = { &dtt200u_usb_table[2], NULL }, 193 193 .warm_ids = { &dtt200u_usb_table[3], NULL }, 194 194 }, 195 - { 0 }, 195 + { NULL }, 196 196 } 197 197 }; 198 198
+1 -1
drivers/media/dvb/dvb-usb/vp7045.c
··· 247 247 .cold_ids = { &vp7045_usb_table[2], NULL }, 248 248 .warm_ids = { &vp7045_usb_table[3], NULL }, 249 249 }, 250 - { 0 }, 250 + { NULL }, 251 251 } 252 252 }; 253 253
+41 -48
drivers/media/video/compat_ioctl32.c
··· 167 167 if (kp->clipcount > 2048) 168 168 return -EINVAL; 169 169 if (kp->clipcount) { 170 - struct v4l2_clip32 *uclips = compat_ptr(up->clips); 171 - struct v4l2_clip *kclips; 170 + struct v4l2_clip32 __user *uclips; 171 + struct v4l2_clip __user *kclips; 172 172 int n = kp->clipcount; 173 + compat_caddr_t p; 173 174 175 + if (get_user(p, &up->clips)) 176 + return -EFAULT; 177 + uclips = compat_ptr(p); 174 178 kclips = compat_alloc_user_space(n * sizeof(struct v4l2_clip)); 175 179 kp->clips = kclips; 176 180 while (--n >= 0) { 177 - if (!access_ok(VERIFY_READ, &uclips->c, sizeof(uclips->c)) || 178 - copy_from_user(&kclips->c, &uclips->c, sizeof(uclips->c))) 181 + if (copy_in_user(&kclips->c, &uclips->c, sizeof(uclips->c))) 179 182 return -EFAULT; 180 - kclips->next = n ? kclips + 1 : 0; 183 + if (put_user(n ? kclips + 1 : NULL, &kclips->next)) 184 + return -EFAULT; 181 185 uclips += 1; 182 186 kclips += 1; 183 187 } 184 188 } else 185 - kp->clips = 0; 189 + kp->clips = NULL; 186 190 return 0; 187 191 } 188 192 189 193 static int put_v4l2_window32(struct v4l2_window *kp, struct v4l2_window32 __user *up) 190 194 { 191 - if (!access_ok(VERIFY_WRITE, up, sizeof(struct v4l2_window32)) || 192 - copy_to_user(&up->w, &kp->w, sizeof(up->w)) || 195 + if (copy_to_user(&up->w, &kp->w, sizeof(up->w)) || 193 196 put_user(kp->field, &up->field) || 194 197 put_user(kp->chromakey, &up->chromakey) || 195 198 put_user(kp->clipcount, &up->clipcount)) ··· 202 199 203 200 static inline int get_v4l2_pix_format(struct v4l2_pix_format *kp, struct v4l2_pix_format __user *up) 204 201 { 205 - if (!access_ok(VERIFY_READ, up, sizeof(struct v4l2_pix_format)) || 206 - copy_from_user(kp, up, sizeof(struct v4l2_pix_format))) 207 - return -EFAULT; 202 + if (copy_from_user(kp, up, sizeof(struct v4l2_pix_format))) 203 + return -EFAULT; 208 204 return 0; 209 205 } 210 206 211 207 static inline int put_v4l2_pix_format(struct v4l2_pix_format *kp, struct v4l2_pix_format __user *up) 212 208 { 213 - if (!access_ok(VERIFY_WRITE, up, sizeof(struct v4l2_pix_format)) || 214 - copy_to_user(up, kp, sizeof(struct v4l2_pix_format))) 215 - return -EFAULT; 209 + if (copy_to_user(up, kp, sizeof(struct v4l2_pix_format))) 210 + return -EFAULT; 216 211 return 0; 217 212 } 218 213 219 214 static inline int get_v4l2_vbi_format(struct v4l2_vbi_format *kp, struct v4l2_vbi_format __user *up) 220 215 { 221 - if (!access_ok(VERIFY_READ, up, sizeof(struct v4l2_vbi_format)) || 222 - copy_from_user(kp, up, sizeof(struct v4l2_vbi_format))) 223 - return -EFAULT; 216 + if (copy_from_user(kp, up, sizeof(struct v4l2_vbi_format))) 217 + return -EFAULT; 224 218 return 0; 225 219 } 226 220 227 221 static inline int put_v4l2_vbi_format(struct v4l2_vbi_format *kp, struct v4l2_vbi_format __user *up) 228 222 { 229 - if (!access_ok(VERIFY_WRITE, up, sizeof(struct v4l2_vbi_format)) || 230 - copy_to_user(up, kp, sizeof(struct v4l2_vbi_format))) 231 - return -EFAULT; 223 + if (copy_to_user(up, kp, sizeof(struct v4l2_vbi_format))) 224 + return -EFAULT; 232 225 return 0; 233 226 } 234 227 ··· 278 279 279 280 static inline int get_v4l2_standard(struct v4l2_standard *kp, struct v4l2_standard __user *up) 280 281 { 281 - if (!access_ok(VERIFY_READ, up, sizeof(struct v4l2_standard)) || 282 - copy_from_user(kp, up, sizeof(struct v4l2_standard))) 283 - return -EFAULT; 282 + if (copy_from_user(kp, up, sizeof(struct v4l2_standard))) 283 + return -EFAULT; 284 284 return 0; 285 285 286 286 } 287 287 288 288 static inline int put_v4l2_standard(struct v4l2_standard *kp, struct v4l2_standard __user *up) 289 289 { 290 - if (!access_ok(VERIFY_WRITE, up, sizeof(struct v4l2_standard)) || 291 - copy_to_user(up, kp, sizeof(struct v4l2_standard))) 292 - return -EFAULT; 290 + if (copy_to_user(up, kp, sizeof(struct v4l2_standard))) 291 + return -EFAULT; 293 292 return 0; 294 293 } 295 294 ··· 325 328 326 329 static inline int get_v4l2_tuner(struct v4l2_tuner *kp, struct v4l2_tuner __user *up) 327 330 { 328 - if (!access_ok(VERIFY_READ, up, sizeof(struct v4l2_tuner)) || 329 - copy_from_user(kp, up, sizeof(struct v4l2_tuner))) 330 - return -EFAULT; 331 + if (copy_from_user(kp, up, sizeof(struct v4l2_tuner))) 332 + return -EFAULT; 331 333 return 0; 332 334 333 335 } 334 336 335 337 static inline int put_v4l2_tuner(struct v4l2_tuner *kp, struct v4l2_tuner __user *up) 336 338 { 337 - if (!access_ok(VERIFY_WRITE, up, sizeof(struct v4l2_tuner)) || 338 - copy_to_user(up, kp, sizeof(struct v4l2_tuner))) 339 - return -EFAULT; 339 + if (copy_to_user(up, kp, sizeof(struct v4l2_tuner))) 340 + return -EFAULT; 340 341 return 0; 341 342 } 342 343 ··· 375 380 break; 376 381 case V4L2_MEMORY_USERPTR: 377 382 { 378 - unsigned long tmp = (unsigned long)compat_ptr(up->m.userptr); 383 + compat_long_t tmp; 379 384 380 - if(get_user(kp->length, &up->length) || 381 - get_user(kp->m.userptr, &tmp)) 382 - return -EFAULT; 385 + if (get_user(kp->length, &up->length) || 386 + get_user(tmp, &up->m.userptr)) 387 + return -EFAULT; 388 + 389 + kp->m.userptr = (unsigned long)compat_ptr(tmp); 383 390 } 384 391 break; 385 392 case V4L2_MEMORY_OVERLAY: ··· 465 468 466 469 static inline int get_v4l2_input32(struct v4l2_input *kp, struct v4l2_input __user *up) 467 470 { 468 - if (!access_ok(VERIFY_READ, up, sizeof(struct v4l2_input) - 4) || 469 - copy_from_user(kp, up, sizeof(struct v4l2_input) - 4)) 470 - return -EFAULT; 471 + if (copy_from_user(kp, up, sizeof(struct v4l2_input) - 4)) 472 + return -EFAULT; 471 473 return 0; 472 474 } 473 475 474 476 static inline int put_v4l2_input32(struct v4l2_input *kp, struct v4l2_input __user *up) 475 477 { 476 - if (!access_ok(VERIFY_WRITE, up, sizeof(struct v4l2_input) - 4) || 477 - copy_to_user(up, kp, sizeof(struct v4l2_input) - 4)) 478 - return -EFAULT; 478 + if (copy_to_user(up, kp, sizeof(struct v4l2_input) - 4)) 479 + return -EFAULT; 479 480 return 0; 480 481 } 481 482 482 483 static inline int get_v4l2_input(struct v4l2_input *kp, struct v4l2_input __user *up) 483 484 { 484 - if (!access_ok(VERIFY_READ, up, sizeof(struct v4l2_input)) || 485 - copy_from_user(kp, up, sizeof(struct v4l2_input))) 486 - return -EFAULT; 485 + if (copy_from_user(kp, up, sizeof(struct v4l2_input))) 486 + return -EFAULT; 487 487 return 0; 488 488 } 489 489 490 490 static inline int put_v4l2_input(struct v4l2_input *kp, struct v4l2_input __user *up) 491 491 { 492 - if (!access_ok(VERIFY_WRITE, up, sizeof(struct v4l2_input)) || 493 - copy_to_user(up, kp, sizeof(struct v4l2_input))) 494 - return -EFAULT; 492 + if (copy_to_user(up, kp, sizeof(struct v4l2_input))) 493 + return -EFAULT; 495 494 return 0; 496 495 } 497 496
+1 -1
drivers/mmc/Kconfig
··· 65 65 depends on SOC_AU1X00 && MMC 66 66 help 67 67 This selects the AMD Alchemy(R) Multimedia card interface. 68 - iIf you have a Alchemy platform with a MMC slot, say Y or M here. 68 + If you have a Alchemy platform with a MMC slot, say Y or M here. 69 69 70 70 If unsure, say N. 71 71
+1 -1
drivers/mtd/chips/Kconfig
··· 301 301 302 302 config MTD_XIP 303 303 bool "XIP aware MTD support" 304 - depends on !SMP && (MTD_CFI_INTELEXT || MTD_CFI_AMDSTD) && EXPERIMENTAL && ARM 304 + depends on !SMP && (MTD_CFI_INTELEXT || MTD_CFI_AMDSTD) && EXPERIMENTAL && ARCH_MTD_XIP 305 305 default y if XIP_KERNEL 306 306 help 307 307 This allows MTD support to work with flash memory which is also
+1 -1
drivers/net/7990.c
··· 29 29 #include <linux/slab.h> 30 30 #include <linux/string.h> 31 31 #include <linux/skbuff.h> 32 - #include <linux/irq.h> 32 + #include <asm/irq.h> 33 33 /* Used for the temporal inet entries and routing */ 34 34 #include <linux/socket.h> 35 35 #include <linux/bitops.h>
+1 -1
drivers/net/82596.c
··· 614 614 static int init_i596_mem(struct net_device *dev) 615 615 { 616 616 struct i596_private *lp = dev->priv; 617 - #if !defined(ENABLE_MVME16x_NET) && !defined(ENABLE_BVME6000_NET) 617 + #if !defined(ENABLE_MVME16x_NET) && !defined(ENABLE_BVME6000_NET) || defined(ENABLE_APRICOT) 618 618 short ioaddr = dev->base_addr; 619 619 #endif 620 620 unsigned long flags;
+1 -1
drivers/net/appletalk/cops.h
··· 51 51 struct ltfirmware 52 52 { 53 53 unsigned int length; 54 - unsigned char * data; 54 + const unsigned char * data; 55 55 }; 56 56 57 57 #define DAYNA 1
+49 -19
drivers/net/arcnet/arc-rimi.c
··· 97 97 "must specify the shmem and irq!\n"); 98 98 return -ENODEV; 99 99 } 100 + if (dev->dev_addr[0] == 0) { 101 + BUGMSG(D_NORMAL, "You need to specify your card's station " 102 + "ID!\n"); 103 + return -ENODEV; 104 + } 100 105 /* 101 - * Grab the memory region at mem_start for BUFFER_SIZE bytes. 106 + * Grab the memory region at mem_start for MIRROR_SIZE bytes. 102 107 * Later in arcrimi_found() the real size will be determined 103 108 * and this reserve will be released and the correct size 104 109 * will be taken. 105 110 */ 106 - if (!request_mem_region(dev->mem_start, BUFFER_SIZE, "arcnet (90xx)")) { 111 + if (!request_mem_region(dev->mem_start, MIRROR_SIZE, "arcnet (90xx)")) { 107 112 BUGMSG(D_NORMAL, "Card memory already allocated\n"); 108 - return -ENODEV; 109 - } 110 - if (dev->dev_addr[0] == 0) { 111 - release_mem_region(dev->mem_start, BUFFER_SIZE); 112 - BUGMSG(D_NORMAL, "You need to specify your card's station " 113 - "ID!\n"); 114 113 return -ENODEV; 115 114 } 116 115 return arcrimi_found(dev); 117 116 } 118 117 118 + static int check_mirror(unsigned long addr, size_t size) 119 + { 120 + void __iomem *p; 121 + int res = -1; 122 + 123 + if (!request_mem_region(addr, size, "arcnet (90xx)")) 124 + return -1; 125 + 126 + p = ioremap(addr, size); 127 + if (p) { 128 + if (readb(p) == TESTvalue) 129 + res = 1; 130 + else 131 + res = 0; 132 + iounmap(p); 133 + } 134 + 135 + release_mem_region(addr, size); 136 + return res; 137 + } 119 138 120 139 /* 121 140 * Set up the struct net_device associated with this card. Called after ··· 144 125 { 145 126 struct arcnet_local *lp; 146 127 unsigned long first_mirror, last_mirror, shmem; 128 + void __iomem *p; 147 129 int mirror_size; 148 130 int err; 149 131 132 + p = ioremap(dev->mem_start, MIRROR_SIZE); 133 + if (!p) { 134 + release_mem_region(dev->mem_start, MIRROR_SIZE); 135 + BUGMSG(D_NORMAL, "Can't ioremap\n"); 136 + return -ENODEV; 137 + } 138 + 150 139 /* reserve the irq */ 151 140 if (request_irq(dev->irq, &arcnet_interrupt, 0, "arcnet (RIM I)", dev)) { 152 - release_mem_region(dev->mem_start, BUFFER_SIZE); 141 + iounmap(p); 142 + release_mem_region(dev->mem_start, MIRROR_SIZE); 153 143 BUGMSG(D_NORMAL, "Can't get IRQ %d!\n", dev->irq); 154 144 return -ENODEV; 155 145 } 156 146 157 147 shmem = dev->mem_start; 158 - isa_writeb(TESTvalue, shmem); 159 - isa_writeb(dev->dev_addr[0], shmem + 1); /* actually the node ID */ 148 + writeb(TESTvalue, p); 149 + writeb(dev->dev_addr[0], p + 1); /* actually the node ID */ 160 150 161 151 /* find the real shared memory start/end points, including mirrors */ 162 152 ··· 174 146 * 2k (or there are no mirrors at all) but on some, it's 4k. 175 147 */ 176 148 mirror_size = MIRROR_SIZE; 177 - if (isa_readb(shmem) == TESTvalue 178 - && isa_readb(shmem - mirror_size) != TESTvalue 179 - && isa_readb(shmem - 2 * mirror_size) == TESTvalue) 180 - mirror_size *= 2; 149 + if (readb(p) == TESTvalue 150 + && check_mirror(shmem - MIRROR_SIZE, MIRROR_SIZE) == 0 151 + && check_mirror(shmem - 2 * MIRROR_SIZE, MIRROR_SIZE) == 1) 152 + mirror_size = 2 * MIRROR_SIZE; 181 153 182 - first_mirror = last_mirror = shmem; 183 - while (isa_readb(first_mirror) == TESTvalue) 154 + first_mirror = shmem - mirror_size; 155 + while (check_mirror(first_mirror, mirror_size) == 1) 184 156 first_mirror -= mirror_size; 185 157 first_mirror += mirror_size; 186 158 187 - while (isa_readb(last_mirror) == TESTvalue) 159 + last_mirror = shmem + mirror_size; 160 + while (check_mirror(last_mirror, mirror_size) == 1) 188 161 last_mirror += mirror_size; 189 162 last_mirror -= mirror_size; 190 163 ··· 210 181 * with the correct size. There is a VERY slim chance this could 211 182 * fail. 212 183 */ 213 - release_mem_region(shmem, BUFFER_SIZE); 184 + iounmap(p); 185 + release_mem_region(shmem, MIRROR_SIZE); 214 186 if (!request_mem_region(dev->mem_start, 215 187 dev->mem_end - dev->mem_start + 1, 216 188 "arcnet (90xx)")) {
+94 -38
drivers/net/arcnet/com90xx.c
··· 53 53 54 54 55 55 /* Internal function declarations */ 56 - static int com90xx_found(int ioaddr, int airq, u_long shmem); 56 + static int com90xx_found(int ioaddr, int airq, u_long shmem, void __iomem *); 57 57 static void com90xx_command(struct net_device *dev, int command); 58 58 static int com90xx_status(struct net_device *dev); 59 59 static void com90xx_setmask(struct net_device *dev, int mask); ··· 116 116 unsigned long airqmask; 117 117 int ports[(0x3f0 - 0x200) / 16 + 1] = 118 118 {0}; 119 - u_long shmems[(0xFF800 - 0xA0000) / 2048 + 1] = 120 - {0}; 119 + unsigned long *shmems; 120 + void __iomem **iomem; 121 121 int numports, numshmems, *port; 122 122 u_long *p; 123 + int index; 123 124 124 125 if (!io && !irq && !shmem && !*device && com90xx_skip_probe) 125 126 return; 127 + 128 + shmems = kzalloc(((0x10000-0xa0000) / 0x800) * sizeof(unsigned long), 129 + GFP_KERNEL); 130 + if (!shmems) 131 + return; 132 + iomem = kzalloc(((0x10000-0xa0000) / 0x800) * sizeof(void __iomem *), 133 + GFP_KERNEL); 134 + if (!iomem) { 135 + kfree(shmems); 136 + return; 137 + } 126 138 127 139 BUGLVL(D_NORMAL) printk(VERSION); 128 140 ··· 191 179 192 180 if (!numports) { 193 181 BUGMSG2(D_NORMAL, "S1: No ARCnet cards found.\n"); 182 + kfree(shmems); 183 + kfree(iomem); 194 184 return; 195 185 } 196 186 /* Stage 2: we have now reset any possible ARCnet cards, so we can't ··· 216 202 * 0xD1 byte in the right place, or are read-only. 217 203 */ 218 204 numprint = -1; 219 - for (p = &shmems[0]; p < shmems + numshmems; p++) { 220 - u_long ptr = *p; 205 + for (index = 0, p = &shmems[0]; index < numshmems; p++, index++) { 206 + void __iomem *base; 221 207 222 208 numprint++; 223 209 numprint %= 8; ··· 227 213 } 228 214 BUGMSG2(D_INIT, "%lXh ", *p); 229 215 230 - if (!request_mem_region(*p, BUFFER_SIZE, "arcnet (90xx)")) { 216 + if (!request_mem_region(*p, MIRROR_SIZE, "arcnet (90xx)")) { 231 217 BUGMSG2(D_INIT_REASONS, "(request_mem_region)\n"); 232 218 BUGMSG2(D_INIT_REASONS, "Stage 3: "); 233 219 BUGLVL(D_INIT_REASONS) numprint = 0; 234 - *p-- = shmems[--numshmems]; 235 - continue; 220 + goto out; 236 221 } 237 - if (isa_readb(ptr) != TESTvalue) { 222 + base = ioremap(*p, MIRROR_SIZE); 223 + if (!base) { 224 + BUGMSG2(D_INIT_REASONS, "(ioremap)\n"); 225 + BUGMSG2(D_INIT_REASONS, "Stage 3: "); 226 + BUGLVL(D_INIT_REASONS) numprint = 0; 227 + goto out1; 228 + } 229 + if (readb(base) != TESTvalue) { 238 230 BUGMSG2(D_INIT_REASONS, "(%02Xh != %02Xh)\n", 239 - isa_readb(ptr), TESTvalue); 231 + readb(base), TESTvalue); 240 232 BUGMSG2(D_INIT_REASONS, "S3: "); 241 233 BUGLVL(D_INIT_REASONS) numprint = 0; 242 - release_mem_region(*p, BUFFER_SIZE); 243 - *p-- = shmems[--numshmems]; 244 - continue; 234 + goto out2; 245 235 } 246 236 /* By writing 0x42 to the TESTvalue location, we also make 247 237 * sure no "mirror" shmem areas show up - if they occur 248 238 * in another pass through this loop, they will be discarded 249 239 * because *cptr != TESTvalue. 250 240 */ 251 - isa_writeb(0x42, ptr); 252 - if (isa_readb(ptr) != 0x42) { 241 + writeb(0x42, base); 242 + if (readb(base) != 0x42) { 253 243 BUGMSG2(D_INIT_REASONS, "(read only)\n"); 254 244 BUGMSG2(D_INIT_REASONS, "S3: "); 255 - release_mem_region(*p, BUFFER_SIZE); 256 - *p-- = shmems[--numshmems]; 257 - continue; 245 + goto out2; 258 246 } 259 247 BUGMSG2(D_INIT_REASONS, "\n"); 260 248 BUGMSG2(D_INIT_REASONS, "S3: "); 261 249 BUGLVL(D_INIT_REASONS) numprint = 0; 250 + iomem[index] = base; 251 + continue; 252 + out2: 253 + iounmap(base); 254 + out1: 255 + release_mem_region(*p, MIRROR_SIZE); 256 + out: 257 + *p-- = shmems[--numshmems]; 258 + index--; 262 259 } 263 260 BUGMSG2(D_INIT, "\n"); 264 261 ··· 277 252 BUGMSG2(D_NORMAL, "S3: No ARCnet cards found.\n"); 278 253 for (port = &ports[0]; port < ports + numports; port++) 279 254 release_region(*port, ARCNET_TOTAL_SIZE); 255 + kfree(shmems); 256 + kfree(iomem); 280 257 return; 281 258 } 282 259 /* Stage 4: something of a dummy, to report the shmems that are ··· 378 351 mdelay(RESETtime); 379 352 } else { 380 353 /* just one shmem and port, assume they match */ 381 - isa_writeb(TESTvalue, shmems[0]); 354 + writeb(TESTvalue, iomem[0]); 382 355 } 383 356 #else 384 357 inb(_RESET); 385 358 mdelay(RESETtime); 386 359 #endif 387 360 388 - for (p = &shmems[0]; p < shmems + numshmems; p++) { 389 - u_long ptr = *p; 361 + for (index = 0; index < numshmems; index++) { 362 + u_long ptr = shmems[index]; 363 + void __iomem *base = iomem[index]; 390 364 391 - if (isa_readb(ptr) == TESTvalue) { /* found one */ 365 + if (readb(base) == TESTvalue) { /* found one */ 392 366 BUGMSG2(D_INIT, "%lXh)\n", *p); 393 367 openparen = 0; 394 368 395 369 /* register the card */ 396 - if (com90xx_found(*port, airq, *p) == 0) 370 + if (com90xx_found(*port, airq, ptr, base) == 0) 397 371 found = 1; 398 372 numprint = -1; 399 373 400 374 /* remove shmem from the list */ 401 - *p = shmems[--numshmems]; 375 + shmems[index] = shmems[--numshmems]; 376 + iomem[index] = iomem[numshmems]; 402 377 break; /* go to the next I/O port */ 403 378 } else { 404 - BUGMSG2(D_INIT_REASONS, "%Xh-", isa_readb(ptr)); 379 + BUGMSG2(D_INIT_REASONS, "%Xh-", readb(base)); 405 380 } 406 381 } 407 382 ··· 420 391 BUGLVL(D_INIT_REASONS) printk("\n"); 421 392 422 393 /* Now put back TESTvalue on all leftover shmems. */ 423 - for (p = &shmems[0]; p < shmems + numshmems; p++) { 424 - isa_writeb(TESTvalue, *p); 425 - release_mem_region(*p, BUFFER_SIZE); 394 + for (index = 0; index < numshmems; index++) { 395 + writeb(TESTvalue, iomem[index]); 396 + iounmap(iomem[index]); 397 + release_mem_region(shmems[index], MIRROR_SIZE); 426 398 } 399 + kfree(shmems); 400 + kfree(iomem); 427 401 } 428 402 403 + static int check_mirror(unsigned long addr, size_t size) 404 + { 405 + void __iomem *p; 406 + int res = -1; 407 + 408 + if (!request_mem_region(addr, size, "arcnet (90xx)")) 409 + return -1; 410 + 411 + p = ioremap(addr, size); 412 + if (p) { 413 + if (readb(p) == TESTvalue) 414 + res = 1; 415 + else 416 + res = 0; 417 + iounmap(p); 418 + } 419 + 420 + release_mem_region(addr, size); 421 + return res; 422 + } 429 423 430 424 /* Set up the struct net_device associated with this card. Called after 431 425 * probing succeeds. 432 426 */ 433 - static int __init com90xx_found(int ioaddr, int airq, u_long shmem) 427 + static int __init com90xx_found(int ioaddr, int airq, u_long shmem, void __iomem *p) 434 428 { 435 429 struct net_device *dev = NULL; 436 430 struct arcnet_local *lp; ··· 464 412 dev = alloc_arcdev(device); 465 413 if (!dev) { 466 414 BUGMSG2(D_NORMAL, "com90xx: Can't allocate device!\n"); 467 - release_mem_region(shmem, BUFFER_SIZE); 415 + iounmap(p); 416 + release_mem_region(shmem, MIRROR_SIZE); 468 417 return -ENOMEM; 469 418 } 470 419 lp = dev->priv; ··· 476 423 * 2k (or there are no mirrors at all) but on some, it's 4k. 477 424 */ 478 425 mirror_size = MIRROR_SIZE; 479 - if (isa_readb(shmem) == TESTvalue 480 - && isa_readb(shmem - mirror_size) != TESTvalue 481 - && isa_readb(shmem - 2 * mirror_size) == TESTvalue) 482 - mirror_size *= 2; 426 + if (readb(p) == TESTvalue && 427 + check_mirror(shmem - MIRROR_SIZE, MIRROR_SIZE) == 0 && 428 + check_mirror(shmem - 2 * MIRROR_SIZE, MIRROR_SIZE) == 1) 429 + mirror_size = 2 * MIRROR_SIZE; 483 430 484 - first_mirror = last_mirror = shmem; 485 - while (isa_readb(first_mirror) == TESTvalue) 431 + first_mirror = shmem - mirror_size; 432 + while (check_mirror(first_mirror, mirror_size) == 1) 486 433 first_mirror -= mirror_size; 487 434 first_mirror += mirror_size; 488 435 489 - while (isa_readb(last_mirror) == TESTvalue) 436 + last_mirror = shmem + mirror_size; 437 + while (check_mirror(last_mirror, mirror_size) == 1) 490 438 last_mirror += mirror_size; 491 439 last_mirror -= mirror_size; 492 440 493 441 dev->mem_start = first_mirror; 494 442 dev->mem_end = last_mirror + MIRROR_SIZE - 1; 495 443 496 - release_mem_region(shmem, BUFFER_SIZE); 444 + iounmap(p); 445 + release_mem_region(shmem, MIRROR_SIZE); 446 + 497 447 if (!request_mem_region(dev->mem_start, dev->mem_end - dev->mem_start + 1, "arcnet (90xx)")) 498 448 goto err_free_dev; 499 449
-1
drivers/net/hamradio/baycom_par.c
··· 86 86 #include <linux/bitops.h> 87 87 #include <linux/jiffies.h> 88 88 89 - #include <asm/bug.h> 90 89 #include <asm/system.h> 91 90 #include <asm/uaccess.h> 92 91
+8 -22
drivers/net/hp100.c
··· 1719 1719 hp100_outw(i, FRAGMENT_LEN); /* and first/only fragment length */ 1720 1720 1721 1721 if (lp->mode == 2) { /* memory mapped */ 1722 - if (lp->mem_ptr_virt) { /* high pci memory was remapped */ 1723 - /* Note: The J2585B needs alignment to 32bits here! */ 1724 - memcpy_toio(lp->mem_ptr_virt, skb->data, (skb->len + 3) & ~3); 1725 - if (!ok_flag) 1726 - memset_io(lp->mem_ptr_virt, 0, HP100_MIN_PACKET_SIZE - skb->len); 1727 - } else { 1728 - /* Note: The J2585B needs alignment to 32bits here! */ 1729 - isa_memcpy_toio(lp->mem_ptr_phys, skb->data, (skb->len + 3) & ~3); 1730 - if (!ok_flag) 1731 - isa_memset_io(lp->mem_ptr_phys, 0, HP100_MIN_PACKET_SIZE - skb->len); 1732 - } 1722 + /* Note: The J2585B needs alignment to 32bits here! */ 1723 + memcpy_toio(lp->mem_ptr_virt, skb->data, (skb->len + 3) & ~3); 1724 + if (!ok_flag) 1725 + memset_io(lp->mem_ptr_virt, 0, HP100_MIN_PACKET_SIZE - skb->len); 1733 1726 } else { /* programmed i/o */ 1734 1727 outsl(ioaddr + HP100_REG_DATA32, skb->data, 1735 1728 (skb->len + 3) >> 2); ··· 1792 1799 /* First we get the header, which contains information about the */ 1793 1800 /* actual length of the received packet. */ 1794 1801 if (lp->mode == 2) { /* memory mapped mode */ 1795 - if (lp->mem_ptr_virt) /* if memory was remapped */ 1796 - header = readl(lp->mem_ptr_virt); 1797 - else 1798 - header = isa_readl(lp->mem_ptr_phys); 1802 + header = readl(lp->mem_ptr_virt); 1799 1803 } else /* programmed i/o */ 1800 1804 header = hp100_inl(DATA32); 1801 1805 ··· 1824 1834 ptr = skb->data; 1825 1835 1826 1836 /* Now transfer the data from the card into that area */ 1827 - if (lp->mode == 2) { 1828 - if (lp->mem_ptr_virt) 1829 - memcpy_fromio(ptr, lp->mem_ptr_virt,pkt_len); 1830 - /* Note alignment to 32bit transfers */ 1831 - else 1832 - isa_memcpy_fromio(ptr, lp->mem_ptr_phys, pkt_len); 1833 - } else /* io mapped */ 1837 + if (lp->mode == 2) 1838 + memcpy_fromio(ptr, lp->mem_ptr_virt,pkt_len); 1839 + else /* io mapped */ 1834 1840 insl(ioaddr + HP100_REG_DATA32, ptr, pkt_len >> 2); 1835 1841 1836 1842 skb->protocol = eth_type_trans(skb, dev);
+19 -21
drivers/net/ibm_emac/ibm_emac_core.c
··· 204 204 205 205 static inline void emac_tx_enable(struct ocp_enet_private *dev) 206 206 { 207 - struct emac_regs *p = dev->emacp; 207 + struct emac_regs __iomem *p = dev->emacp; 208 208 unsigned long flags; 209 209 u32 r; 210 210 ··· 220 220 221 221 static void emac_tx_disable(struct ocp_enet_private *dev) 222 222 { 223 - struct emac_regs *p = dev->emacp; 223 + struct emac_regs __iomem *p = dev->emacp; 224 224 unsigned long flags; 225 225 u32 r; 226 226 ··· 244 244 245 245 static void emac_rx_enable(struct ocp_enet_private *dev) 246 246 { 247 - struct emac_regs *p = dev->emacp; 247 + struct emac_regs __iomem *p = dev->emacp; 248 248 unsigned long flags; 249 249 u32 r; 250 250 ··· 275 275 276 276 static void emac_rx_disable(struct ocp_enet_private *dev) 277 277 { 278 - struct emac_regs *p = dev->emacp; 278 + struct emac_regs __iomem *p = dev->emacp; 279 279 unsigned long flags; 280 280 u32 r; 281 281 ··· 299 299 300 300 static inline void emac_rx_disable_async(struct ocp_enet_private *dev) 301 301 { 302 - struct emac_regs *p = dev->emacp; 302 + struct emac_regs __iomem *p = dev->emacp; 303 303 unsigned long flags; 304 304 u32 r; 305 305 ··· 315 315 316 316 static int emac_reset(struct ocp_enet_private *dev) 317 317 { 318 - struct emac_regs *p = dev->emacp; 318 + struct emac_regs __iomem *p = dev->emacp; 319 319 unsigned long flags; 320 320 int n = 20; 321 321 ··· 348 348 349 349 static void emac_hash_mc(struct ocp_enet_private *dev) 350 350 { 351 - struct emac_regs *p = dev->emacp; 351 + struct emac_regs __iomem *p = dev->emacp; 352 352 u16 gaht[4] = { 0 }; 353 353 struct dev_mc_list *dmi; 354 354 ··· 393 393 /* BHs disabled */ 394 394 static int emac_configure(struct ocp_enet_private *dev) 395 395 { 396 - struct emac_regs *p = dev->emacp; 396 + struct emac_regs __iomem *p = dev->emacp; 397 397 struct net_device *ndev = dev->ndev; 398 398 int gige; 399 399 u32 r; ··· 555 555 556 556 static int __emac_mdio_read(struct ocp_enet_private *dev, u8 id, u8 reg) 557 557 { 558 - struct emac_regs *p = dev->emacp; 558 + struct emac_regs __iomem *p = dev->emacp; 559 559 u32 r; 560 560 int n; 561 561 ··· 604 604 static void __emac_mdio_write(struct ocp_enet_private *dev, u8 id, u8 reg, 605 605 u16 val) 606 606 { 607 - struct emac_regs *p = dev->emacp; 607 + struct emac_regs __iomem *p = dev->emacp; 608 608 int n; 609 609 610 610 DBG2("%d: mdio_write(%02x,%02x,%04x)" NL, dev->def->index, id, reg, ··· 666 666 static void emac_set_multicast_list(struct net_device *ndev) 667 667 { 668 668 struct ocp_enet_private *dev = ndev->priv; 669 - struct emac_regs *p = dev->emacp; 669 + struct emac_regs __iomem *p = dev->emacp; 670 670 u32 rmr = emac_iff2rmr(ndev); 671 671 672 672 DBG("%d: multicast %08x" NL, dev->def->index, rmr); ··· 825 825 } 826 826 827 827 static inline int emac_alloc_rx_skb(struct ocp_enet_private *dev, int slot, 828 - int flags) 828 + gfp_t flags) 829 829 { 830 830 struct sk_buff *skb = alloc_skb(dev->rx_skb_size, flags); 831 831 if (unlikely(!skb)) ··· 1047 1047 1048 1048 static inline int emac_xmit_finish(struct ocp_enet_private *dev, int len) 1049 1049 { 1050 - struct emac_regs *p = dev->emacp; 1050 + struct emac_regs __iomem *p = dev->emacp; 1051 1051 struct net_device *ndev = dev->ndev; 1052 1052 1053 1053 /* Send the packet out */ ··· 1519 1519 static irqreturn_t emac_irq(int irq, void *dev_instance, struct pt_regs *regs) 1520 1520 { 1521 1521 struct ocp_enet_private *dev = dev_instance; 1522 - struct emac_regs *p = dev->emacp; 1522 + struct emac_regs __iomem *p = dev->emacp; 1523 1523 struct ibm_emac_error_stats *st = &dev->estats; 1524 1524 1525 1525 u32 isr = in_be32(&p->isr); ··· 1619 1619 1620 1620 DBG("%d: remove" NL, dev->def->index); 1621 1621 1622 - ocp_set_drvdata(ocpdev, 0); 1622 + ocp_set_drvdata(ocpdev, NULL); 1623 1623 unregister_netdev(dev->ndev); 1624 1624 1625 1625 tah_fini(dev->tah_dev); 1626 1626 rgmii_fini(dev->rgmii_dev, dev->rgmii_input); 1627 1627 zmii_fini(dev->zmii_dev, dev->zmii_input); 1628 1628 1629 - emac_dbg_register(dev->def->index, 0); 1629 + emac_dbg_register(dev->def->index, NULL); 1630 1630 1631 1631 mal_unregister_commac(dev->mal, &dev->commac); 1632 - iounmap((void *)dev->emacp); 1632 + iounmap(dev->emacp); 1633 1633 kfree(dev->ndev); 1634 1634 } 1635 1635 ··· 2048 2048 goto out4; 2049 2049 2050 2050 /* Map EMAC regs */ 2051 - dev->emacp = 2052 - (struct emac_regs *)ioremap(dev->def->paddr, 2053 - sizeof(struct emac_regs)); 2051 + dev->emacp = ioremap(dev->def->paddr, sizeof(struct emac_regs)); 2054 2052 if (!dev->emacp) { 2055 2053 printk(KERN_ERR "emac%d: could not ioremap device registers!\n", 2056 2054 dev->def->index); ··· 2208 2210 2209 2211 return 0; 2210 2212 out6: 2211 - iounmap((void *)dev->emacp); 2213 + iounmap(dev->emacp); 2212 2214 out5: 2213 2215 tah_fini(dev->tah_dev); 2214 2216 out4:
+1 -1
drivers/net/ibm_emac/ibm_emac_core.h
··· 155 155 156 156 struct ocp_enet_private { 157 157 struct net_device *ndev; /* 0 */ 158 - struct emac_regs *emacp; 158 + struct emac_regs __iomem *emacp; 159 159 160 160 struct mal_descriptor *tx_desc; 161 161 int tx_cnt;
+1 -1
drivers/net/ibm_emac/ibm_emac_debug.c
··· 58 58 59 59 static void emac_mac_dump(int idx, struct ocp_enet_private *dev) 60 60 { 61 - struct emac_regs *p = dev->emacp; 61 + struct emac_regs __iomem *p = dev->emacp; 62 62 63 63 printk("** EMAC%d registers **\n" 64 64 "MR0 = 0x%08x MR1 = 0x%08x TMR0 = 0x%08x TMR1 = 0x%08x\n"
+1 -1
drivers/net/ibm_emac/ibm_emac_rgmii.h
··· 31 31 32 32 /* RGMII device */ 33 33 struct ibm_ocp_rgmii { 34 - struct rgmii_regs *base; 34 + struct rgmii_regs __iomem *base; 35 35 int users; /* number of EMACs using this RGMII bridge */ 36 36 }; 37 37
+3 -4
drivers/net/ibm_emac/ibm_emac_zmii.c
··· 80 80 static int __init zmii_init(struct ocp_device *ocpdev, int input, int *mode) 81 81 { 82 82 struct ibm_ocp_zmii *dev = ocp_get_drvdata(ocpdev); 83 - struct zmii_regs *p; 83 + struct zmii_regs __iomem *p; 84 84 85 85 ZMII_DBG("%d: init(%d, %d)" NL, ocpdev->def->index, input, *mode); 86 86 ··· 94 94 } 95 95 dev->mode = PHY_MODE_NA; 96 96 97 - p = (struct zmii_regs *)ioremap(ocpdev->def->paddr, 98 - sizeof(struct zmii_regs)); 97 + p = ioremap(ocpdev->def->paddr, sizeof(struct zmii_regs)); 99 98 if (!p) { 100 99 printk(KERN_ERR 101 100 "zmii%d: could not ioremap device registers!\n", ··· 230 231 if (!--dev->users) { 231 232 /* Free everything if this is the last user */ 232 233 ocp_set_drvdata(ocpdev, NULL); 233 - iounmap((void *)dev->base); 234 + iounmap(dev->base); 234 235 kfree(dev); 235 236 } 236 237 }
+1 -1
drivers/net/ibm_emac/ibm_emac_zmii.h
··· 32 32 33 33 /* ZMII device */ 34 34 struct ibm_ocp_zmii { 35 - struct zmii_regs *base; 35 + struct zmii_regs __iomem *base; 36 36 int mode; /* subset of PHY_MODE_XXXX */ 37 37 int users; /* number of EMACs using this ZMII bridge */ 38 38 u32 fer_save; /* FER value left by firmware */
+1 -1
drivers/net/macsonic.c
··· 622 622 return 0; 623 623 624 624 out_unregister: 625 - driver_unregister(&mac_sonic_driver); 625 + platform_driver_unregister(&mac_sonic_driver); 626 626 627 627 return -ENOMEM; 628 628 }
+2
drivers/net/mv643xx_eth.c
··· 32 32 */ 33 33 #include <linux/init.h> 34 34 #include <linux/dma-mapping.h> 35 + #include <linux/in.h> 36 + #include <linux/ip.h> 35 37 #include <linux/tcp.h> 36 38 #include <linux/udp.h> 37 39 #include <linux/etherdevice.h>
+3
drivers/net/tulip/xircom_cb.c
··· 32 32 33 33 #include <asm/uaccess.h> 34 34 #include <asm/io.h> 35 + #ifdef CONFIG_NET_POLL_CONTROLLER 36 + #include <asm/irq.h> 37 + #endif 35 38 36 39 #ifdef DEBUG 37 40 #define enter(x) printk("Enter: %s, %s line %i\n",x,__FILE__,__LINE__)
+1
drivers/net/wan/hostess_sv11.c
··· 29 29 #include <linux/ioport.h> 30 30 #include <net/arp.h> 31 31 32 + #include <asm/irq.h> 32 33 #include <asm/io.h> 33 34 #include <asm/dma.h> 34 35 #include <asm/byteorder.h>
+1 -1
drivers/net/wan/pci200syn.c
··· 29 29 #include <linux/netdevice.h> 30 30 #include <linux/hdlc.h> 31 31 #include <linux/pci.h> 32 - #include <asm/delay.h> 32 + #include <linux/delay.h> 33 33 #include <asm/io.h> 34 34 35 35 #include "hd64572.h"
+1
drivers/net/wan/sealevel.c
··· 23 23 #include <linux/init.h> 24 24 #include <net/arp.h> 25 25 26 + #include <asm/irq.h> 26 27 #include <asm/io.h> 27 28 #include <asm/dma.h> 28 29 #include <asm/byteorder.h>
+1 -1
drivers/net/wan/wanxl.c
··· 27 27 #include <linux/hdlc.h> 28 28 #include <linux/pci.h> 29 29 #include <linux/dma-mapping.h> 30 + #include <linux/delay.h> 30 31 #include <asm/io.h> 31 - #include <asm/delay.h> 32 32 33 33 #include "wanxl.h" 34 34
+1 -1
drivers/net/wireless/prism54/isl_ioctl.c
··· 748 748 if (essid->length) { 749 749 dwrq->flags = 1; /* set ESSID to ON for Wireless Extensions */ 750 750 /* if it is to big, trunk it */ 751 - dwrq->length = min(IW_ESSID_MAX_SIZE, essid->length); 751 + dwrq->length = min((u8)IW_ESSID_MAX_SIZE, essid->length); 752 752 } else { 753 753 dwrq->flags = 0; 754 754 dwrq->length = 0;
+1 -1
drivers/scsi/aacraid/commsup.c
··· 38 38 #include <linux/slab.h> 39 39 #include <linux/completion.h> 40 40 #include <linux/blkdev.h> 41 + #include <linux/delay.h> 41 42 #include <scsi/scsi_host.h> 42 43 #include <scsi/scsi_device.h> 43 44 #include <asm/semaphore.h> 44 - #include <asm/delay.h> 45 45 46 46 #include "aacraid.h" 47 47
+2 -2
drivers/scsi/mac53c94.c
··· 537 537 free_irq(fp->intr, fp); 538 538 539 539 if (fp->regs) 540 - iounmap((void *) fp->regs); 540 + iounmap(fp->regs); 541 541 if (fp->dma) 542 - iounmap((void *) fp->dma); 542 + iounmap(fp->dma); 543 543 kfree(fp->dma_cmd_space); 544 544 545 545 scsi_host_put(host);
+1 -1
drivers/scsi/scsi_transport_iscsi.c
··· 463 463 } 464 464 465 465 static void* 466 - mempool_zone_alloc_skb(unsigned int gfp_mask, void *pool_data) 466 + mempool_zone_alloc_skb(gfp_t gfp_mask, void *pool_data) 467 467 { 468 468 struct mempool_zone *zone = pool_data; 469 469
+1 -1
drivers/scsi/sg.c
··· 1679 1679 sg_build_sgat(Sg_scatter_hold * schp, const Sg_fd * sfp, int tablesize) 1680 1680 { 1681 1681 int sg_bufflen = tablesize * sizeof(struct scatterlist); 1682 - unsigned int gfp_flags = GFP_ATOMIC | __GFP_NOWARN; 1682 + gfp_t gfp_flags = GFP_ATOMIC | __GFP_NOWARN; 1683 1683 1684 1684 /* 1685 1685 * TODO: test without low_dma, we should not need it since
+1 -1
drivers/serial/21285.c
··· 362 362 363 363 static struct uart_port serial21285_port = { 364 364 .mapbase = 0x42000160, 365 - .iotype = SERIAL_IO_MEM, 365 + .iotype = UPIO_MEM, 366 366 .irq = NO_IRQ, 367 367 .fifosize = 16, 368 368 .ops = &serial21285_ops,
+2 -2
drivers/serial/68328serial.c
··· 332 332 * Make sure that we do not overflow the buffer 333 333 */ 334 334 if (tty_request_buffer_room(tty, 1) == 0) { 335 - schedule_work(&tty->flip.work); 335 + tty_schedule_flip(tty); 336 336 return; 337 337 } 338 338 ··· 353 353 } while((rx = uart->urx.w) & URX_DATA_READY); 354 354 #endif 355 355 356 - schedule_work(&tty->flip.work); 356 + tty_schedule_flip(tty); 357 357 358 358 clear_and_exit: 359 359 return;
+2 -2
drivers/serial/68360serial.c
··· 509 509 510 510 info->rx_cur = (QUICC_BD *)bdp; 511 511 512 - schedule_work(&tty->flip.work); 512 + tty_schedule_flip(tty); 513 513 } 514 514 515 515 static _INLINE_ void receive_break(ser_info_t *info) ··· 521 521 * the break. If not, we exit now, losing the break. FIXME 522 522 */ 523 523 tty_insert_flip_char(tty, 0, TTY_BREAK); 524 - schedule_work(&tty->flip.work); 524 + tty_schedule_flip(tty); 525 525 } 526 526 527 527 static _INLINE_ void transmit_chars(ser_info_t *info)
+1
drivers/serial/8250.c
··· 2229 2229 * and restore the IER 2230 2230 */ 2231 2231 wait_for_xmitr(up, BOTH_EMPTY); 2232 + up->ier |= UART_IER_THRI; 2232 2233 serial_out(up, UART_IER, ier | UART_IER_THRI); 2233 2234 } 2234 2235
-1
drivers/serial/8250_au1x00.c
··· 56 56 #elif defined(CONFIG_SOC_AU1550) 57 57 PORT(UART0_ADDR, AU1550_UART0_INT), 58 58 PORT(UART1_ADDR, AU1550_UART1_INT), 59 - PORT(UART2_ADDR, AU1550_UART2_INT), 60 59 PORT(UART3_ADDR, AU1550_UART3_INT), 61 60 #elif defined(CONFIG_SOC_AU1200) 62 61 PORT(UART0_ADDR, AU1200_UART0_INT),
+4
drivers/serial/8250_pci.c
··· 1882 1882 PCI_SUBVENDOR_ID_CONNECT_TECH, 1883 1883 PCI_SUBDEVICE_ID_CONNECT_TECH_TITAN_4, 0, 0, 1884 1884 pbn_b0_4_1843200 }, 1885 + { PCI_VENDOR_ID_OXSEMI, PCI_DEVICE_ID_OXSEMI_16PCI954, 1886 + PCI_VENDOR_ID_AFAVLAB, 1887 + PCI_SUBDEVICE_ID_AFAVLAB_P061, 0, 0, 1888 + pbn_b0_4_1152000 }, 1885 1889 { PCI_VENDOR_ID_EXAR, PCI_DEVICE_ID_EXAR_XR17C152, 1886 1890 PCI_SUBVENDOR_ID_CONNECT_TECH, 1887 1891 PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_2_232, 0, 0,
+2 -2
drivers/serial/amba-pl010.c
··· 561 561 .port = { 562 562 .membase = (void *)IO_ADDRESS(INTEGRATOR_UART0_BASE), 563 563 .mapbase = INTEGRATOR_UART0_BASE, 564 - .iotype = SERIAL_IO_MEM, 564 + .iotype = UPIO_MEM, 565 565 .irq = IRQ_UARTINT0, 566 566 .uartclk = 14745600, 567 567 .fifosize = 16, ··· 576 576 .port = { 577 577 .membase = (void *)IO_ADDRESS(INTEGRATOR_UART1_BASE), 578 578 .mapbase = INTEGRATOR_UART1_BASE, 579 - .iotype = SERIAL_IO_MEM, 579 + .iotype = UPIO_MEM, 580 580 .irq = IRQ_UARTINT1, 581 581 .uartclk = 14745600, 582 582 .fifosize = 16,
+6 -6
drivers/serial/au1x00_uart.c
··· 892 892 int ret = 0; 893 893 894 894 switch (up->port.iotype) { 895 - case SERIAL_IO_MEM: 895 + case UPIO_MEM: 896 896 if (up->port.mapbase) { 897 897 *res = request_mem_region(up->port.mapbase, size, "serial"); 898 898 if (!*res) ··· 900 900 } 901 901 break; 902 902 903 - case SERIAL_IO_HUB6: 904 - case SERIAL_IO_PORT: 903 + case UPIO_HUB6: 904 + case UPIO_PORT: 905 905 *res = request_region(up->port.iobase, size, "serial"); 906 906 if (!*res) 907 907 ret = -EBUSY; ··· 919 919 size <<= up->port.regshift; 920 920 921 921 switch (up->port.iotype) { 922 - case SERIAL_IO_MEM: 922 + case UPIO_MEM: 923 923 if (up->port.mapbase) { 924 924 /* 925 925 * Unmap the area. ··· 935 935 } 936 936 break; 937 937 938 - case SERIAL_IO_HUB6: 939 - case SERIAL_IO_PORT: 938 + case UPIO_HUB6: 939 + case UPIO_PORT: 940 940 start = up->port.iobase; 941 941 942 942 if (size)
+10 -15
drivers/serial/cpm_uart/cpm_uart_core.c
··· 252 252 /* If we have not enough room in tty flip buffer, then we try 253 253 * later, which will be the next rx-interrupt or a timeout 254 254 */ 255 - if ((tty->flip.count + i) >= TTY_FLIPBUF_SIZE) { 256 - tty->flip.work.func((void *)tty); 257 - if ((tty->flip.count + i) >= TTY_FLIPBUF_SIZE) { 258 - printk(KERN_WARNING "TTY_DONT_FLIP set\n"); 259 - return; 260 - } 255 + if(tty_buffer_request_room(tty, i) < i) { 256 + printk(KERN_WARNING "No room in flip buffer\n"); 257 + return; 261 258 } 262 259 263 260 /* get pointer */ ··· 273 276 continue; 274 277 275 278 error_return: 276 - *tty->flip.char_buf_ptr++ = ch; 277 - *tty->flip.flag_buf_ptr++ = flg; 278 - tty->flip.count++; 279 + tty_insert_flip_char(tty, ch, flg); 279 280 280 281 } /* End while (i--) */ 281 282 ··· 903 908 .port = { 904 909 .irq = SMC1_IRQ, 905 910 .ops = &cpm_uart_pops, 906 - .iotype = SERIAL_IO_MEM, 911 + .iotype = UPIO_MEM, 907 912 .lock = SPIN_LOCK_UNLOCKED, 908 913 }, 909 914 .flags = FLAG_SMC, ··· 917 922 .port = { 918 923 .irq = SMC2_IRQ, 919 924 .ops = &cpm_uart_pops, 920 - .iotype = SERIAL_IO_MEM, 925 + .iotype = UPIO_MEM, 921 926 .lock = SPIN_LOCK_UNLOCKED, 922 927 }, 923 928 .flags = FLAG_SMC, ··· 934 939 .port = { 935 940 .irq = SCC1_IRQ, 936 941 .ops = &cpm_uart_pops, 937 - .iotype = SERIAL_IO_MEM, 942 + .iotype = UPIO_MEM, 938 943 .lock = SPIN_LOCK_UNLOCKED, 939 944 }, 940 945 .tx_nrfifos = TX_NUM_FIFO, ··· 948 953 .port = { 949 954 .irq = SCC2_IRQ, 950 955 .ops = &cpm_uart_pops, 951 - .iotype = SERIAL_IO_MEM, 956 + .iotype = UPIO_MEM, 952 957 .lock = SPIN_LOCK_UNLOCKED, 953 958 }, 954 959 .tx_nrfifos = TX_NUM_FIFO, ··· 962 967 .port = { 963 968 .irq = SCC3_IRQ, 964 969 .ops = &cpm_uart_pops, 965 - .iotype = SERIAL_IO_MEM, 970 + .iotype = UPIO_MEM, 966 971 .lock = SPIN_LOCK_UNLOCKED, 967 972 }, 968 973 .tx_nrfifos = TX_NUM_FIFO, ··· 976 981 .port = { 977 982 .irq = SCC4_IRQ, 978 983 .ops = &cpm_uart_pops, 979 - .iotype = SERIAL_IO_MEM, 984 + .iotype = UPIO_MEM, 980 985 .lock = SPIN_LOCK_UNLOCKED, 981 986 }, 982 987 .tx_nrfifos = TX_NUM_FIFO,
+2 -1
drivers/serial/dz.c
··· 262 262 } 263 263 tty_insert_flip_char(tty, ch, flag); 264 264 ignore_char: 265 + ; 265 266 } while (status & DZ_DVAL); 266 267 267 268 if (tty) ··· 651 650 for (i = 0, dport = dz_ports; i < DZ_NB_PORT; i++, dport++) { 652 651 spin_lock_init(&dport->port.lock); 653 652 dport->port.membase = (char *) base; 654 - dport->port.iotype = SERIAL_IO_PORT; 653 + dport->port.iotype = UPIO_PORT; 655 654 dport->port.irq = dec_interrupt[DEC_IRQ_DZ11]; 656 655 dport->port.line = i; 657 656 dport->port.fifosize = 1;
+2 -2
drivers/serial/imx.c
··· 668 668 .rtsirq = UART1_MINT_RTS, 669 669 .port = { 670 670 .type = PORT_IMX, 671 - .iotype = SERIAL_IO_MEM, 671 + .iotype = UPIO_MEM, 672 672 .membase = (void *)IMX_UART1_BASE, 673 673 .mapbase = IMX_UART1_BASE, /* FIXME */ 674 674 .irq = UART1_MINT_RX, ··· 684 684 .rtsirq = UART2_MINT_RTS, 685 685 .port = { 686 686 .type = PORT_IMX, 687 - .iotype = SERIAL_IO_MEM, 687 + .iotype = UPIO_MEM, 688 688 .membase = (void *)IMX_UART2_BASE, 689 689 .mapbase = IMX_UART2_BASE, /* FIXME */ 690 690 .irq = UART2_MINT_RX,
+4 -4
drivers/serial/ip22zilog.c
··· 215 215 /* Lower and upper byte of baud rate generator divisor. */ 216 216 write_zsreg(channel, R12, regs[R12]); 217 217 write_zsreg(channel, R13, regs[R13]); 218 - 218 + 219 219 /* Now rewrite R14, with BRENAB (if set). */ 220 220 write_zsreg(channel, R14, regs[R14]); 221 221 ··· 571 571 else 572 572 clear_bits |= DTR; 573 573 574 - /* NOTE: Not subject to 'transmitter active' rule. */ 574 + /* NOTE: Not subject to 'transmitter active' rule. */ 575 575 up->curregs[R5] |= set_bits; 576 576 up->curregs[R5] &= ~clear_bits; 577 577 write_zsreg(channel, R5, up->curregs[R5]); ··· 654 654 if (new_reg != up->curregs[R15]) { 655 655 up->curregs[R15] = new_reg; 656 656 657 - /* NOTE: Not subject to 'transmitter active' rule. */ 657 + /* NOTE: Not subject to 'transmitter active' rule. */ 658 658 write_zsreg(channel, R15, up->curregs[R15]); 659 659 } 660 660 } ··· 680 680 if (new_reg != up->curregs[R5]) { 681 681 up->curregs[R5] = new_reg; 682 682 683 - /* NOTE: Not subject to 'transmitter active' rule. */ 683 + /* NOTE: Not subject to 'transmitter active' rule. */ 684 684 write_zsreg(channel, R5, up->curregs[R5]); 685 685 } 686 686
+1 -1
drivers/serial/m32r_sio.c
··· 80 80 #include <asm/serial.h> 81 81 82 82 /* Standard COM flags */ 83 - #define STD_COM_FLAGS (ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST) 83 + #define STD_COM_FLAGS (UPF_BOOT_AUTOCONF | UPF_SKIP_TEST) 84 84 85 85 /* 86 86 * SERIAL_PORT_DFNS tells us about built-in ports that have no
+1 -1
drivers/serial/m32r_sio.h
··· 37 37 unsigned int irq; 38 38 unsigned int flags; 39 39 unsigned char io_type; 40 - unsigned char *iomem_base; 40 + unsigned char __iomem *iomem_base; 41 41 unsigned short iomem_reg_shift; 42 42 }; 43 43
+6 -10
drivers/serial/mcfserial.c
··· 57 57 * keep going. Perhaps one day the cflag settings for the 58 58 * console can be used instead. 59 59 */ 60 - #if defined(CONFIG_ARNEWSH) || defined(CONFIG_FREESCALE) || \ 61 - defined(CONFIG_senTec) || defined(CONFIG_SNEHA) 62 - #define CONSOLE_BAUD_RATE 19200 63 - #define DEFAULT_CBAUD B19200 64 - #endif 65 - 66 60 #if defined(CONFIG_HW_FEITH) 67 61 #define CONSOLE_BAUD_RATE 38400 68 62 #define DEFAULT_CBAUD B38400 69 - #endif 70 - 71 - #if defined(CONFIG_MOD5272) || defined(CONFIG_M5208EVB) 63 + #elif defined(CONFIG_MOD5272) || defined(CONFIG_M5208EVB) 72 64 #define CONSOLE_BAUD_RATE 115200 73 65 #define DEFAULT_CBAUD B115200 66 + #elif defined(CONFIG_ARNEWSH) || defined(CONFIG_FREESCALE) || \ 67 + defined(CONFIG_senTec) || defined(CONFIG_SNEHA) 68 + #define CONSOLE_BAUD_RATE 19200 69 + #define DEFAULT_CBAUD B19200 74 70 #endif 75 71 76 72 #ifndef CONSOLE_BAUD_RATE ··· 346 350 } 347 351 tty_insert_flip_char(tty, ch, flag); 348 352 } 349 - tty_flip_buffer_push(tty); 353 + tty_schedule_flip(tty); 350 354 return; 351 355 } 352 356
+1 -1
drivers/serial/mux.c
··· 462 462 port->mapbase = dev->hpa.start + MUX_OFFSET + 463 463 (i * MUX_LINE_OFFSET); 464 464 port->membase = ioremap(port->mapbase, MUX_LINE_OFFSET); 465 - port->iotype = SERIAL_IO_MEM; 465 + port->iotype = UPIO_MEM; 466 466 port->type = PORT_MUX; 467 467 port->irq = NO_IRQ; 468 468 port->uartclk = 0;
+1 -1
drivers/serial/pmac_zilog.c
··· 1492 1492 /* 1493 1493 * Init remaining bits of "port" structure 1494 1494 */ 1495 - uap->port.iotype = SERIAL_IO_MEM; 1495 + uap->port.iotype = UPIO_MEM; 1496 1496 uap->port.irq = np->intrs[0].line; 1497 1497 uap->port.uartclk = ZS_CLOCK; 1498 1498 uap->port.fifosize = 1;
+4
drivers/serial/s3c2410.c
··· 161 161 162 162 /* we can support 3 uarts, but not always use them */ 163 163 164 + #ifdef CONFIG_CPU_S3C2400 165 + #define NR_PORTS (2) 166 + #else 164 167 #define NR_PORTS (3) 168 + #endif 165 169 166 170 /* port irq numbers */ 167 171
+1 -1
drivers/serial/sa1100.c
··· 628 628 sa1100_ports[i].port.ops = &sa1100_pops; 629 629 sa1100_ports[i].port.fifosize = 8; 630 630 sa1100_ports[i].port.line = i; 631 - sa1100_ports[i].port.iotype = SERIAL_IO_MEM; 631 + sa1100_ports[i].port.iotype = UPIO_MEM; 632 632 init_timer(&sa1100_ports[i].timer); 633 633 sa1100_ports[i].timer.function = sa1100_timeout; 634 634 sa1100_ports[i].timer.data = (unsigned long)&sa1100_ports[i];
+3 -3
drivers/serial/serial_lh7a40x.c
··· 501 501 .port = { 502 502 .membase = (void*) io_p2v (UART1_PHYS), 503 503 .mapbase = UART1_PHYS, 504 - .iotype = SERIAL_IO_MEM, 504 + .iotype = UPIO_MEM, 505 505 .irq = IRQ_UART1INTR, 506 506 .uartclk = 14745600/2, 507 507 .fifosize = 16, ··· 514 514 .port = { 515 515 .membase = (void*) io_p2v (UART2_PHYS), 516 516 .mapbase = UART2_PHYS, 517 - .iotype = SERIAL_IO_MEM, 517 + .iotype = UPIO_MEM, 518 518 .irq = IRQ_UART2INTR, 519 519 .uartclk = 14745600/2, 520 520 .fifosize = 16, ··· 527 527 .port = { 528 528 .membase = (void*) io_p2v (UART3_PHYS), 529 529 .mapbase = UART3_PHYS, 530 - .iotype = SERIAL_IO_MEM, 530 + .iotype = UPIO_MEM, 531 531 .irq = IRQ_UART3INTR, 532 532 .uartclk = 14745600/2, 533 533 .fifosize = 16,
+10 -10
drivers/serial/sh-sci.c
··· 1468 1468 .port = { 1469 1469 .membase = (void *)0xff923000, 1470 1470 .mapbase = 0xff923000, 1471 - .iotype = SERIAL_IO_MEM, 1471 + .iotype = UPIO_MEM, 1472 1472 .irq = 61, 1473 1473 .ops = &sci_uart_ops, 1474 - .flags = ASYNC_BOOT_AUTOCONF, 1474 + .flags = UPF_BOOT_AUTOCONF, 1475 1475 .line = 0, 1476 1476 }, 1477 1477 .type = PORT_SCIF, ··· 1482 1482 .port = { 1483 1483 .membase = (void *)0xff924000, 1484 1484 .mapbase = 0xff924000, 1485 - .iotype = SERIAL_IO_MEM, 1485 + .iotype = UPIO_MEM, 1486 1486 .irq = 62, 1487 1487 .ops = &sci_uart_ops, 1488 - .flags = ASYNC_BOOT_AUTOCONF, 1488 + .flags = UPF_BOOT_AUTOCONF, 1489 1489 .line = 1, 1490 1490 }, 1491 1491 .type = PORT_SCIF, ··· 1496 1496 .port = { 1497 1497 .membase = (void *)0xff925000, 1498 1498 .mapbase = 0xff925000, 1499 - .iotype = SERIAL_IO_MEM, 1499 + .iotype = UPIO_MEM, 1500 1500 .irq = 63, 1501 1501 .ops = &sci_uart_ops, 1502 - .flags = ASYNC_BOOT_AUTOCONF, 1502 + .flags = UPF_BOOT_AUTOCONF, 1503 1503 .line = 2, 1504 1504 }, 1505 1505 .type = PORT_SCIF, ··· 1511 1511 .port = { 1512 1512 .membase = (void *)0xffe00000, 1513 1513 .mapbase = 0xffe00000, 1514 - .iotype = SERIAL_IO_MEM, 1514 + .iotype = UPIO_MEM, 1515 1515 .irq = 43, 1516 1516 .ops = &sci_uart_ops, 1517 - .flags = ASYNC_BOOT_AUTOCONF, 1517 + .flags = UPF_BOOT_AUTOCONF, 1518 1518 .line = 0, 1519 1519 }, 1520 1520 .type = PORT_SCIF, ··· 1525 1525 .port = { 1526 1526 .membase = (void *)0xffe10000, 1527 1527 .mapbase = 0xffe10000, 1528 - .iotype = SERIAL_IO_MEM, 1528 + .iotype = UPIO_MEM, 1529 1529 .irq = 79, 1530 1530 .ops = &sci_uart_ops, 1531 - .flags = ASYNC_BOOT_AUTOCONF, 1531 + .flags = UPF_BOOT_AUTOCONF, 1532 1532 .line = 1, 1533 1533 }, 1534 1534 .type = PORT_SCIF,
+1 -1
drivers/serial/sunsab.c
··· 1036 1036 up->port.irq = edev->irqs[0]; 1037 1037 up->port.fifosize = SAB82532_XMIT_FIFO_SIZE; 1038 1038 up->port.mapbase = (unsigned long)up->regs; 1039 - up->port.iotype = SERIAL_IO_MEM; 1039 + up->port.iotype = UPIO_MEM; 1040 1040 1041 1041 writeb(SAB82532_IPC_IC_ACT_LOW, &up->regs->w.ipc); 1042 1042
+5 -5
drivers/serial/sunsu.c
··· 109 109 offset <<= up->port.regshift; 110 110 111 111 switch (up->port.iotype) { 112 - case SERIAL_IO_HUB6: 112 + case UPIO_HUB6: 113 113 outb(up->port.hub6 - 1 + offset, up->port.iobase); 114 114 return inb(up->port.iobase + 1); 115 115 116 - case SERIAL_IO_MEM: 116 + case UPIO_MEM: 117 117 return readb(up->port.membase + offset); 118 118 119 119 default: ··· 139 139 offset <<= up->port.regshift; 140 140 141 141 switch (up->port.iotype) { 142 - case SERIAL_IO_HUB6: 142 + case UPIO_HUB6: 143 143 outb(up->port.hub6 - 1 + offset, up->port.iobase); 144 144 outb(value, up->port.iobase + 1); 145 145 break; 146 146 147 - case SERIAL_IO_MEM: 147 + case UPIO_MEM: 148 148 writeb(value, up->port.membase + offset); 149 149 break; 150 150 ··· 1052 1052 return; 1053 1053 1054 1054 up->type_probed = PORT_UNKNOWN; 1055 - up->port.iotype = SERIAL_IO_MEM; 1055 + up->port.iotype = UPIO_MEM; 1056 1056 1057 1057 /* 1058 1058 * First we look for Ebus-bases su's
+2 -2
drivers/serial/sunzilog.c
··· 1487 1487 up[(chip * 2) + 1].port.membase = (void __iomem *)&rp->channelB; 1488 1488 1489 1489 /* Channel A */ 1490 - up[(chip * 2) + 0].port.iotype = SERIAL_IO_MEM; 1490 + up[(chip * 2) + 0].port.iotype = UPIO_MEM; 1491 1491 up[(chip * 2) + 0].port.irq = zilog_irq; 1492 1492 up[(chip * 2) + 0].port.uartclk = ZS_CLOCK; 1493 1493 up[(chip * 2) + 0].port.fifosize = 1; ··· 1498 1498 up[(chip * 2) + 0].flags |= SUNZILOG_FLAG_IS_CHANNEL_A; 1499 1499 1500 1500 /* Channel B */ 1501 - up[(chip * 2) + 1].port.iotype = SERIAL_IO_MEM; 1501 + up[(chip * 2) + 1].port.iotype = UPIO_MEM; 1502 1502 up[(chip * 2) + 1].port.irq = zilog_irq; 1503 1503 up[(chip * 2) + 1].port.uartclk = ZS_CLOCK; 1504 1504 up[(chip * 2) + 1].port.fifosize = 1;
+1 -1
drivers/serial/v850e_uart.c
··· 496 496 497 497 port->ops = &v850e_uart_ops; 498 498 port->line = chan; 499 - port->iotype = SERIAL_IO_MEM; 499 + port->iotype = UPIO_MEM; 500 500 port->flags = UPF_BOOT_AUTOCONF; 501 501 502 502 /* We actually use multiple IRQs, but the serial
+9 -9
drivers/sn/ioc3.c
··· 38 38 39 39 static int nic_wait(struct ioc3_driver_data *idd) 40 40 { 41 - volatile unsigned mcr; 41 + unsigned mcr; 42 42 43 43 do { 44 - mcr = (volatile unsigned)idd->vma->mcr; 44 + mcr = readl(&idd->vma->mcr); 45 45 } while (!(mcr & 2)); 46 46 47 47 return mcr & 1; ··· 53 53 unsigned long flags; 54 54 55 55 local_irq_save(flags); 56 - idd->vma->mcr = mcr_pack(500, 65); 56 + writel(mcr_pack(500, 65), &idd->vma->mcr); 57 57 presence = nic_wait(idd); 58 58 local_irq_restore(flags); 59 59 ··· 68 68 unsigned long flags; 69 69 70 70 local_irq_save(flags); 71 - idd->vma->mcr = mcr_pack(6, 13); 71 + writel(mcr_pack(6, 13), &idd->vma->mcr); 72 72 result = nic_wait(idd); 73 73 local_irq_restore(flags); 74 74 ··· 80 80 static inline void nic_write_bit(struct ioc3_driver_data *idd, int bit) 81 81 { 82 82 if (bit) 83 - idd->vma->mcr = mcr_pack(6, 110); 83 + writel(mcr_pack(6, 110), &idd->vma->mcr); 84 84 else 85 - idd->vma->mcr = mcr_pack(80, 30); 85 + writel(mcr_pack(80, 30), &idd->vma->mcr); 86 86 87 87 nic_wait(idd); 88 88 } ··· 337 337 int save = 0, loops = 3; 338 338 unsigned long first, addr; 339 339 340 - idd->vma->gpcr_s = GPCR_MLAN_EN; 340 + writel(GPCR_MLAN_EN, &idd->vma->gpcr_s); 341 341 342 342 while(loops>0) { 343 343 idd->nic_part[0] = 0; ··· 408 408 409 409 read_lock_irqsave(&ioc3_submodules_lock, flags); 410 410 411 - if(idd->dual_irq && idd->vma->eisr) { 411 + if(idd->dual_irq && readb(&idd->vma->eisr)) { 412 412 /* send Ethernet IRQ to the driver */ 413 413 if(ioc3_ethernet && idd->active[ioc3_ethernet->id] && 414 414 ioc3_ethernet->intr) { ··· 682 682 idd->id = ioc3_counter++; 683 683 up_write(&ioc3_devices_rwsem); 684 684 685 - idd->gpdr_shadow = idd->vma->gpdr; 685 + idd->gpdr_shadow = readl(&idd->vma->gpdr); 686 686 687 687 /* Read IOC3 NIC contents */ 688 688 probe_nic(idd);
-10
drivers/spi/Kconfig
··· 75 75 inexpensive battery powered microcontroller evaluation board. 76 76 This same cable can be used to flash new firmware. 77 77 78 - config SPI_BUTTERFLY 79 - tristate "Parallel port adapter for AVR Butterfly (DEVELOPMENT)" 80 - depends on SPI_MASTER && PARPORT && EXPERIMENTAL 81 - select SPI_BITBANG 82 - help 83 - This uses a custom parallel port cable to connect to an AVR 84 - Butterfly <http://www.atmel.com/products/avr/butterfly>, an 85 - inexpensive battery powered microcontroller evaluation board. 86 - This same cable can be used to flash new firmware. 87 - 88 78 # 89 79 # Add new SPI master controllers in alphabetical order above this line 90 80 #
+17 -19
drivers/spi/spi_butterfly.c
··· 163 163 struct butterfly *pp = spidev_to_pp(spi); 164 164 165 165 /* set default clock polarity */ 166 - if (value) 166 + if (value != BITBANG_CS_INACTIVE) 167 167 setsck(spi, spi->mode & SPI_CPOL); 168 168 169 169 /* no chipselect on this USI link config */ 170 170 if (is_usidev(spi)) 171 171 return; 172 172 173 - /* here, value == "activate or not" */ 174 - 175 - /* most PARPORT_CONTROL_* bits are negated */ 173 + /* here, value == "activate or not"; 174 + * most PARPORT_CONTROL_* bits are negated, so we must 175 + * morph it to value == "bit value to write in control register" 176 + */ 176 177 if (spi_cs_bit == PARPORT_CONTROL_INIT) 177 178 value = !value; 178 - 179 - /* here, value == "bit value to write in control register" */ 180 179 181 180 parport_frob_control(pp->port, spi_cs_bit, value ? spi_cs_bit : 0); 182 181 } ··· 201 202 202 203 /* override default partitioning with cmdlinepart */ 203 204 static struct mtd_partition partitions[] = { { 204 - /* JFFS2 wants partitions of 4*N blocks for this device ... */ 205 + /* JFFS2 wants partitions of 4*N blocks for this device, 206 + * so sectors 0 and 1 can't be partitions by themselves. 207 + */ 205 208 206 209 /* sector 0 = 8 pages * 264 bytes/page (1 block) 207 210 * sector 1 = 248 pages * 264 bytes/page ··· 317 316 if (status < 0) 318 317 goto clean2; 319 318 320 - /* Bus 1 lets us talk to at45db041b (firmware disables AVR) 321 - * or AVR (firmware resets at45, acts as spi slave) 319 + /* Bus 1 lets us talk to at45db041b (firmware disables AVR SPI), AVR 320 + * (firmware resets at45, acts as spi slave) or neither (we ignore 321 + * both, AVR uses AT45). Here we expect firmware for the first option. 322 322 */ 323 323 pp->info[0].max_speed_hz = 15 * 1000 * 1000; 324 324 strcpy(pp->info[0].modalias, "mtd_dataflash"); ··· 332 330 pp->dataflash->dev.bus_id); 333 331 334 332 #ifdef HAVE_USI 335 - /* even more custom AVR firmware */ 333 + /* Bus 2 is only for talking to the AVR, and it can work no 334 + * matter who masters bus 1; needs appropriate AVR firmware. 335 + */ 336 336 pp->info[1].max_speed_hz = 10 /* ?? */ * 1000 * 1000; 337 337 strcpy(pp->info[1].modalias, "butterfly"); 338 338 // pp->info[1].platform_data = ... TBD ... ; ··· 382 378 pp = butterfly; 383 379 butterfly = NULL; 384 380 385 - #ifdef HAVE_USI 386 - spi_unregister_device(pp->butterfly); 387 - pp->butterfly = NULL; 388 - #endif 389 - spi_unregister_device(pp->dataflash); 390 - pp->dataflash = NULL; 391 - 381 + /* stop() unregisters child devices too */ 382 + pdev = to_platform_device(pp->bitbang.master->cdev.dev); 392 383 status = spi_bitbang_stop(&pp->bitbang); 393 384 394 385 /* turn off VCC */ ··· 392 393 393 394 parport_release(pp->pd); 394 395 parport_unregister_device(pp->pd); 395 - 396 - pdev = to_platform_device(pp->bitbang.master->cdev.dev); 397 396 398 397 (void) spi_master_put(pp->bitbang.master); 399 398 ··· 417 420 } 418 421 module_exit(butterfly_exit); 419 422 423 + MODULE_DESCRIPTION("Parport Adapter driver for AVR Butterfly"); 420 424 MODULE_LICENSE("GPL");
-1
drivers/tc/tc.c
··· 17 17 #include <linux/types.h> 18 18 19 19 #include <asm/addrspace.h> 20 - #include <asm/bug.h> 21 20 #include <asm/errno.h> 22 21 #include <asm/io.h> 23 22 #include <asm/paccess.h>
-1
drivers/video/backlight/backlight.c
··· 13 13 #include <linux/ctype.h> 14 14 #include <linux/err.h> 15 15 #include <linux/fb.h> 16 - #include <asm/bug.h> 17 16 18 17 static ssize_t backlight_show_power(struct class_device *cdev, char *buf) 19 18 {
-1
drivers/video/backlight/lcd.c
··· 13 13 #include <linux/ctype.h> 14 14 #include <linux/err.h> 15 15 #include <linux/fb.h> 16 - #include <asm/bug.h> 17 16 18 17 static ssize_t lcd_show_power(struct class_device *cdev, char *buf) 19 18 {
-1
drivers/video/pmag-ba-fb.c
··· 30 30 #include <linux/module.h> 31 31 #include <linux/types.h> 32 32 33 - #include <asm/bug.h> 34 33 #include <asm/io.h> 35 34 #include <asm/system.h> 36 35
-1
drivers/video/pmagb-b-fb.c
··· 27 27 #include <linux/module.h> 28 28 #include <linux/types.h> 29 29 30 - #include <asm/bug.h> 31 30 #include <asm/io.h> 32 31 #include <asm/system.h> 33 32
+4 -4
fs/compat_ioctl.c
··· 931 931 static int sg_grt_trans(unsigned int fd, unsigned int cmd, unsigned long arg) 932 932 { 933 933 int err, i; 934 - sg_req_info_t *r; 935 - struct compat_sg_req_info *o = (struct compat_sg_req_info *)arg; 934 + sg_req_info_t __user *r; 935 + struct compat_sg_req_info __user *o = (void __user *)arg; 936 936 r = compat_alloc_user_space(sizeof(sg_req_info_t)*SG_MAX_QUEUE); 937 937 err = sys_ioctl(fd,cmd,(unsigned long)r); 938 938 if (err < 0) ··· 2739 2739 static int 2740 2740 lp_timeout_trans(unsigned int fd, unsigned int cmd, unsigned long arg) 2741 2741 { 2742 - struct compat_timeval *tc = (struct compat_timeval *)arg; 2743 - struct timeval *tn = compat_alloc_user_space(sizeof(struct timeval)); 2742 + struct compat_timeval __user *tc = (struct compat_timeval __user *)arg; 2743 + struct timeval __user *tn = compat_alloc_user_space(sizeof(struct timeval)); 2744 2744 struct timeval ts; 2745 2745 if (get_user(ts.tv_sec, &tc->tv_sec) || 2746 2746 get_user(ts.tv_usec, &tc->tv_usec) ||
+3 -3
fs/debugfs/file.c
··· 56 56 DEFINE_SIMPLE_ATTRIBUTE(fops_u8, debugfs_u8_get, debugfs_u8_set, "%llu\n"); 57 57 58 58 /** 59 - * debugfs_create_u8 - create a file in the debugfs filesystem that is used to read and write a unsigned 8 bit value. 59 + * debugfs_create_u8 - create a file in the debugfs filesystem that is used to read and write an unsigned 8 bit value. 60 60 * 61 61 * @name: a pointer to a string containing the name of the file to create. 62 62 * @mode: the permission that the file should have ··· 98 98 DEFINE_SIMPLE_ATTRIBUTE(fops_u16, debugfs_u16_get, debugfs_u16_set, "%llu\n"); 99 99 100 100 /** 101 - * debugfs_create_u16 - create a file in the debugfs filesystem that is used to read and write a unsigned 8 bit value. 101 + * debugfs_create_u16 - create a file in the debugfs filesystem that is used to read and write an unsigned 16 bit value. 102 102 * 103 103 * @name: a pointer to a string containing the name of the file to create. 104 104 * @mode: the permission that the file should have ··· 140 140 DEFINE_SIMPLE_ATTRIBUTE(fops_u32, debugfs_u32_get, debugfs_u32_set, "%llu\n"); 141 141 142 142 /** 143 - * debugfs_create_u32 - create a file in the debugfs filesystem that is used to read and write a unsigned 8 bit value. 143 + * debugfs_create_u32 - create a file in the debugfs filesystem that is used to read and write an unsigned 32 bit value. 144 144 * 145 145 * @name: a pointer to a string containing the name of the file to create. 146 146 * @mode: the permission that the file should have
+1 -1
fs/inotify.c
··· 967 967 mask_add = 1; 968 968 969 969 /* don't let user-space set invalid bits: we don't want flags set */ 970 - mask &= IN_ALL_EVENTS; 970 + mask &= IN_ALL_EVENTS | IN_ONESHOT; 971 971 if (unlikely(!mask)) { 972 972 ret = -EINVAL; 973 973 goto out;
+4 -2
fs/namei.c
··· 1119 1119 current->total_link_count = 0; 1120 1120 retval = link_path_walk(name, nd); 1121 1121 out: 1122 - if (unlikely(current->audit_context 1123 - && nd && nd->dentry && nd->dentry->d_inode)) 1122 + if (likely(retval == 0)) { 1123 + if (unlikely(current->audit_context && nd && nd->dentry && 1124 + nd->dentry->d_inode)) 1124 1125 audit_inode(name, nd->dentry->d_inode, flags); 1126 + } 1125 1127 return retval; 1126 1128 1127 1129 fput_unlock_fail:
+37 -21
fs/namespace.c
··· 494 494 p->mnt_namespace = NULL; 495 495 list_del_init(&p->mnt_child); 496 496 if (p->mnt_parent != p) 497 - mnt->mnt_mountpoint->d_mounted--; 497 + p->mnt_mountpoint->d_mounted--; 498 498 change_mnt_propagation(p, MS_PRIVATE); 499 499 } 500 500 } ··· 1325 1325 return retval; 1326 1326 } 1327 1327 1328 - int copy_namespace(int flags, struct task_struct *tsk) 1328 + /* 1329 + * Allocate a new namespace structure and populate it with contents 1330 + * copied from the namespace of the passed in task structure. 1331 + */ 1332 + struct namespace *dup_namespace(struct task_struct *tsk, struct fs_struct *fs) 1329 1333 { 1330 1334 struct namespace *namespace = tsk->namespace; 1331 1335 struct namespace *new_ns; 1332 1336 struct vfsmount *rootmnt = NULL, *pwdmnt = NULL, *altrootmnt = NULL; 1333 - struct fs_struct *fs = tsk->fs; 1334 1337 struct vfsmount *p, *q; 1335 - 1336 - if (!namespace) 1337 - return 0; 1338 - 1339 - get_namespace(namespace); 1340 - 1341 - if (!(flags & CLONE_NEWNS)) 1342 - return 0; 1343 - 1344 - if (!capable(CAP_SYS_ADMIN)) { 1345 - put_namespace(namespace); 1346 - return -EPERM; 1347 - } 1348 1338 1349 1339 new_ns = kmalloc(sizeof(struct namespace), GFP_KERNEL); 1350 1340 if (!new_ns) ··· 1386 1396 } 1387 1397 up_write(&namespace_sem); 1388 1398 1389 - tsk->namespace = new_ns; 1390 - 1391 1399 if (rootmnt) 1392 1400 mntput(rootmnt); 1393 1401 if (pwdmnt) ··· 1393 1405 if (altrootmnt) 1394 1406 mntput(altrootmnt); 1395 1407 1396 - put_namespace(namespace); 1397 - return 0; 1408 + out: 1409 + return new_ns; 1410 + } 1411 + 1412 + int copy_namespace(int flags, struct task_struct *tsk) 1413 + { 1414 + struct namespace *namespace = tsk->namespace; 1415 + struct namespace *new_ns; 1416 + int err = 0; 1417 + 1418 + if (!namespace) 1419 + return 0; 1420 + 1421 + get_namespace(namespace); 1422 + 1423 + if (!(flags & CLONE_NEWNS)) 1424 + return 0; 1425 + 1426 + if (!capable(CAP_SYS_ADMIN)) { 1427 + err = -EPERM; 1428 + goto out; 1429 + } 1430 + 1431 + new_ns = dup_namespace(tsk, tsk->fs); 1432 + if (!new_ns) { 1433 + err = -ENOMEM; 1434 + goto out; 1435 + } 1436 + 1437 + tsk->namespace = new_ns; 1398 1438 1399 1439 out: 1400 1440 put_namespace(namespace); 1401 - return -ENOMEM; 1441 + return err; 1402 1442 } 1403 1443 1404 1444 asmlinkage long sys_mount(char __user * dev_name, char __user * dir_name,
+2 -1
fs/nfs/nfsroot.c
··· 465 465 "number from server, using default\n"); 466 466 port = nfsd_port; 467 467 } 468 - nfs_port = htons(port); 468 + nfs_port = port; 469 469 dprintk("Root-NFS: Portmapper on server returned %d " 470 470 "as nfsd port\n", port); 471 471 } 472 + nfs_port = htons(nfs_port); 472 473 473 474 if ((port = root_nfs_getport(NFS_MNT_PROGRAM, mountd_ver, proto)) < 0) { 474 475 printk(KERN_ERR "Root-NFS: Unable to get mountd port "
+4 -2
fs/nfsd/nfs4proc.c
··· 195 195 196 196 /* Openowner is now set, so sequence id will get bumped. Now we need 197 197 * these checks before we do any creates: */ 198 + status = nfserr_grace; 198 199 if (nfs4_in_grace() && open->op_claim_type != NFS4_OPEN_CLAIM_PREVIOUS) 199 - return nfserr_grace; 200 + goto out; 201 + status = nfserr_no_grace; 200 202 if (!nfs4_in_grace() && open->op_claim_type == NFS4_OPEN_CLAIM_PREVIOUS) 201 - return nfserr_no_grace; 203 + goto out; 202 204 203 205 switch (open->op_claim_type) { 204 206 case NFS4_OPEN_CLAIM_DELEGATE_CUR:
-1
fs/reiserfs/hashes.c
··· 21 21 #include <linux/kernel.h> 22 22 #include <linux/reiserfs_fs.h> 23 23 #include <asm/types.h> 24 - #include <asm/bug.h> 25 24 26 25 #define DELTA 0x9E3779B9 27 26 #define FULLROUNDS 10 /* 32 is overkill, 16 is strong crypto */
+2 -2
fs/select.c
··· 510 510 511 511 if (sig) { 512 512 if (!access_ok(VERIFY_READ, sig, sizeof(void *)+sizeof(size_t)) 513 - || __get_user(up, (sigset_t * __user *)sig) 513 + || __get_user(up, (sigset_t __user * __user *)sig) 514 514 || __get_user(sigsetsize, 515 - (size_t * __user)(sig+sizeof(void *)))) 515 + (size_t __user *)(sig+sizeof(void *)))) 516 516 return -EFAULT; 517 517 } 518 518
+3 -2
fs/super.c
··· 247 247 248 248 /* Forget any remaining inodes */ 249 249 if (invalidate_inodes(sb)) { 250 - printk("VFS: Busy inodes after unmount. " 251 - "Self-destruct in 5 seconds. Have a nice day...\n"); 250 + printk("VFS: Busy inodes after unmount of %s. " 251 + "Self-destruct in 5 seconds. Have a nice day...\n", 252 + sb->s_id); 252 253 } 253 254 254 255 unlock_kernel();
+2 -1
fs/xfs/linux-2.6/xfs_aops.c
··· 747 747 struct backing_dev_info *bdi; 748 748 749 749 bdi = inode->i_mapping->backing_dev_info; 750 + wbc->nr_to_write--; 750 751 if (bdi_write_congested(bdi)) { 751 752 wbc->encountered_congestion = 1; 752 753 done = 1; 753 - } else if (--wbc->nr_to_write <= 0) { 754 + } else if (wbc->nr_to_write <= 0) { 754 755 done = 1; 755 756 } 756 757 }
+2
fs/xfs/linux-2.6/xfs_iops.c
··· 673 673 if (ia_valid & ATTR_ATIME) { 674 674 vattr.va_mask |= XFS_AT_ATIME; 675 675 vattr.va_atime = attr->ia_atime; 676 + if (ia_valid & ATTR_ATIME_SET) 677 + inode->i_atime = attr->ia_atime; 676 678 } 677 679 if (ia_valid & ATTR_MTIME) { 678 680 vattr.va_mask |= XFS_AT_MTIME;
+1 -1
include/asm-alpha/system.h
··· 572 572 if something tries to do an invalid cmpxchg(). */ 573 573 extern void __cmpxchg_called_with_bad_pointer(void); 574 574 575 - static inline unsigned long 575 + static __always_inline unsigned long 576 576 __cmpxchg(volatile void *ptr, unsigned long old, unsigned long new, int size) 577 577 { 578 578 switch (size) {
+5 -1
include/asm-arm/arch-omap/io.h
··· 116 116 ->offset[((vaddr)&4095)>>2] 117 117 #define __REG32(paddr) __REGV32(io_p2v(paddr)) 118 118 119 - extern void omap_map_common_io(void); 119 + extern void omap1_map_common_io(void); 120 + extern void omap1_init_common_hw(void); 121 + 122 + extern void omap2_map_common_io(void); 123 + extern void omap2_init_common_hw(void); 120 124 121 125 #else 122 126
+64 -65
include/asm-arm/mutex.h
··· 23 23 * simply bail out immediately through the slow path where the lock will be 24 24 * reattempted until it succeeds. 25 25 */ 26 - #define __mutex_fastpath_lock(count, fail_fn) \ 27 - do { \ 28 - int __ex_flag, __res; \ 29 - \ 30 - typecheck(atomic_t *, count); \ 31 - typecheck_fn(fastcall void (*)(atomic_t *), fail_fn); \ 32 - \ 33 - __asm__ ( \ 34 - "ldrex %0, [%2] \n" \ 35 - "sub %0, %0, #1 \n" \ 36 - "strex %1, %0, [%2] \n" \ 37 - \ 38 - : "=&r" (__res), "=&r" (__ex_flag) \ 39 - : "r" (&(count)->counter) \ 40 - : "cc","memory" ); \ 41 - \ 42 - if (unlikely(__res || __ex_flag)) \ 43 - fail_fn(count); \ 44 - } while (0) 26 + static inline void 27 + __mutex_fastpath_lock(atomic_t *count, fastcall void (*fail_fn)(atomic_t *)) 28 + { 29 + int __ex_flag, __res; 45 30 46 - #define __mutex_fastpath_lock_retval(count, fail_fn) \ 47 - ({ \ 48 - int __ex_flag, __res; \ 49 - \ 50 - typecheck(atomic_t *, count); \ 51 - typecheck_fn(fastcall int (*)(atomic_t *), fail_fn); \ 52 - \ 53 - __asm__ ( \ 54 - "ldrex %0, [%2] \n" \ 55 - "sub %0, %0, #1 \n" \ 56 - "strex %1, %0, [%2] \n" \ 57 - \ 58 - : "=&r" (__res), "=&r" (__ex_flag) \ 59 - : "r" (&(count)->counter) \ 60 - : "cc","memory" ); \ 61 - \ 62 - __res |= __ex_flag; \ 63 - if (unlikely(__res != 0)) \ 64 - __res = fail_fn(count); \ 65 - __res; \ 66 - }) 31 + __asm__ ( 32 + 33 + "ldrex %0, [%2] \n\t" 34 + "sub %0, %0, #1 \n\t" 35 + "strex %1, %0, [%2] " 36 + 37 + : "=&r" (__res), "=&r" (__ex_flag) 38 + : "r" (&(count)->counter) 39 + : "cc","memory" ); 40 + 41 + __res |= __ex_flag; 42 + if (unlikely(__res != 0)) 43 + fail_fn(count); 44 + } 45 + 46 + static inline int 47 + __mutex_fastpath_lock_retval(atomic_t *count, fastcall int (*fail_fn)(atomic_t *)) 48 + { 49 + int __ex_flag, __res; 50 + 51 + __asm__ ( 52 + 53 + "ldrex %0, [%2] \n\t" 54 + "sub %0, %0, #1 \n\t" 55 + "strex %1, %0, [%2] " 56 + 57 + : "=&r" (__res), "=&r" (__ex_flag) 58 + : "r" (&(count)->counter) 59 + : "cc","memory" ); 60 + 61 + __res |= __ex_flag; 62 + if (unlikely(__res != 0)) 63 + __res = fail_fn(count); 64 + return __res; 65 + } 67 66 68 67 /* 69 68 * Same trick is used for the unlock fast path. However the original value, 70 69 * rather than the result, is used to test for success in order to have 71 70 * better generated assembly. 72 71 */ 73 - #define __mutex_fastpath_unlock(count, fail_fn) \ 74 - do { \ 75 - int __ex_flag, __res, __orig; \ 76 - \ 77 - typecheck(atomic_t *, count); \ 78 - typecheck_fn(fastcall void (*)(atomic_t *), fail_fn); \ 79 - \ 80 - __asm__ ( \ 81 - "ldrex %0, [%3] \n" \ 82 - "add %1, %0, #1 \n" \ 83 - "strex %2, %1, [%3] \n" \ 84 - \ 85 - : "=&r" (__orig), "=&r" (__res), "=&r" (__ex_flag) \ 86 - : "r" (&(count)->counter) \ 87 - : "cc","memory" ); \ 88 - \ 89 - if (unlikely(__orig || __ex_flag)) \ 90 - fail_fn(count); \ 91 - } while (0) 72 + static inline void 73 + __mutex_fastpath_unlock(atomic_t *count, fastcall void (*fail_fn)(atomic_t *)) 74 + { 75 + int __ex_flag, __res, __orig; 76 + 77 + __asm__ ( 78 + 79 + "ldrex %0, [%3] \n\t" 80 + "add %1, %0, #1 \n\t" 81 + "strex %2, %1, [%3] " 82 + 83 + : "=&r" (__orig), "=&r" (__res), "=&r" (__ex_flag) 84 + : "r" (&(count)->counter) 85 + : "cc","memory" ); 86 + 87 + __orig |= __ex_flag; 88 + if (unlikely(__orig != 0)) 89 + fail_fn(count); 90 + } 92 91 93 92 /* 94 93 * If the unlock was done on a contended lock, or if the unlock simply fails ··· 109 110 110 111 __asm__ ( 111 112 112 - "1: ldrex %0, [%3] \n" 113 - "subs %1, %0, #1 \n" 114 - "strexeq %2, %1, [%3] \n" 115 - "movlt %0, #0 \n" 116 - "cmpeq %2, #0 \n" 117 - "bgt 1b \n" 113 + "1: ldrex %0, [%3] \n\t" 114 + "subs %1, %0, #1 \n\t" 115 + "strexeq %2, %1, [%3] \n\t" 116 + "movlt %0, #0 \n\t" 117 + "cmpeq %2, #0 \n\t" 118 + "bgt 1b " 118 119 119 120 : "=&r" (__orig), "=&r" (__res), "=&r" (__ex_flag) 120 121 : "r" (&count->counter)
+2 -1
include/asm-i386/unistd.h
··· 315 315 #define __NR_faccessat 307 316 316 #define __NR_pselect6 308 317 317 #define __NR_ppoll 309 318 + #define __NR_unshare 310 318 319 319 - #define NR_syscalls 310 320 + #define NR_syscalls 311 320 321 321 322 /* 322 323 * user-visible error numbers are in the range -1 - -128: see
+1
include/asm-m68knommu/hardirq.h
··· 4 4 #include <linux/config.h> 5 5 #include <linux/cache.h> 6 6 #include <linux/threads.h> 7 + #include <asm/irq.h> 7 8 8 9 typedef struct { 9 10 unsigned int __softirq_pending;
+2 -2
include/asm-mips/abi.h
··· 3 3 * License. See the file "COPYING" in the main directory of this archive 4 4 * for more details. 5 5 * 6 - * Copyright (C) 2005 by Ralf Baechle 6 + * Copyright (C) 2005, 06 by Ralf Baechle (ralf@linux-mips.org) 7 7 * Copyright (C) 2005 MIPS Technologies, Inc. 8 8 */ 9 9 #ifndef _ASM_ABI_H ··· 13 13 #include <asm/siginfo.h> 14 14 15 15 struct mips_abi { 16 - int (* const do_signal)(sigset_t *oldset, struct pt_regs *regs); 16 + void (* const do_signal)(struct pt_regs *regs); 17 17 int (* const setup_frame)(struct k_sigaction * ka, 18 18 struct pt_regs *regs, int signr, 19 19 sigset_t *set);
+17 -18
include/asm-mips/io.h
··· 18 18 #include <linux/types.h> 19 19 20 20 #include <asm/addrspace.h> 21 - #include <asm/bug.h> 22 21 #include <asm/byteorder.h> 23 22 #include <asm/cpu.h> 24 23 #include <asm/cpu-features.h> ··· 56 57 * variations of functions: non-prefixed ones that preserve the value 57 58 * and prefixed ones that preserve byte addresses. The latters are 58 59 * typically used for moving raw data between a peripheral and memory (cf. 59 - * string I/O functions), hence the "mem_" prefix. 60 + * string I/O functions), hence the "__mem_" prefix. 60 61 */ 61 62 #if defined(CONFIG_SWAP_IO_SPACE) 62 63 63 64 # define ioswabb(x) (x) 64 - # define mem_ioswabb(x) (x) 65 + # define __mem_ioswabb(x) (x) 65 66 # ifdef CONFIG_SGI_IP22 66 67 /* 67 68 * IP22 seems braindead enough to swap 16bits values in hardware, but 68 69 * not 32bits. Go figure... Can't tell without documentation. 69 70 */ 70 71 # define ioswabw(x) (x) 71 - # define mem_ioswabw(x) le16_to_cpu(x) 72 + # define __mem_ioswabw(x) le16_to_cpu(x) 72 73 # else 73 74 # define ioswabw(x) le16_to_cpu(x) 74 - # define mem_ioswabw(x) (x) 75 + # define __mem_ioswabw(x) (x) 75 76 # endif 76 77 # define ioswabl(x) le32_to_cpu(x) 77 - # define mem_ioswabl(x) (x) 78 + # define __mem_ioswabl(x) (x) 78 79 # define ioswabq(x) le64_to_cpu(x) 79 - # define mem_ioswabq(x) (x) 80 + # define __mem_ioswabq(x) (x) 80 81 81 82 #else 82 83 83 84 # define ioswabb(x) (x) 84 - # define mem_ioswabb(x) (x) 85 + # define __mem_ioswabb(x) (x) 85 86 # define ioswabw(x) (x) 86 - # define mem_ioswabw(x) cpu_to_le16(x) 87 + # define __mem_ioswabw(x) cpu_to_le16(x) 87 88 # define ioswabl(x) (x) 88 - # define mem_ioswabl(x) cpu_to_le32(x) 89 + # define __mem_ioswabl(x) cpu_to_le32(x) 89 90 # define ioswabq(x) (x) 90 - # define mem_ioswabq(x) cpu_to_le32(x) 91 + # define __mem_ioswabq(x) cpu_to_le32(x) 91 92 92 93 #endif 93 94 ··· 342 343 BUG(); \ 343 344 } \ 344 345 \ 345 - static inline type pfx##read##bwlq(volatile void __iomem *mem) \ 346 + static inline type pfx##read##bwlq(const volatile void __iomem *mem) \ 346 347 { \ 347 348 volatile type *__mem; \ 348 349 type __val; \ ··· 417 418 \ 418 419 __BUILD_MEMORY_PFX(__raw_, bwlq, type) \ 419 420 __BUILD_MEMORY_PFX(, bwlq, type) \ 420 - __BUILD_MEMORY_PFX(mem_, bwlq, type) \ 421 + __BUILD_MEMORY_PFX(__mem_, bwlq, type) \ 421 422 422 423 BUILDIO_MEM(b, u8) 423 424 BUILDIO_MEM(w, u16) ··· 430 431 431 432 #define BUILDIO_IOPORT(bwlq, type) \ 432 433 __BUILD_IOPORT_PFX(, bwlq, type) \ 433 - __BUILD_IOPORT_PFX(mem_, bwlq, type) 434 + __BUILD_IOPORT_PFX(__mem_, bwlq, type) 434 435 435 436 BUILDIO_IOPORT(b, u8) 436 437 BUILDIO_IOPORT(w, u16) ··· 464 465 const volatile type *__addr = addr; \ 465 466 \ 466 467 while (count--) { \ 467 - mem_write##bwlq(*__addr, mem); \ 468 + __mem_write##bwlq(*__addr, mem); \ 468 469 __addr++; \ 469 470 } \ 470 471 } \ ··· 475 476 volatile type *__addr = addr; \ 476 477 \ 477 478 while (count--) { \ 478 - *__addr = mem_read##bwlq(mem); \ 479 + *__addr = __mem_read##bwlq(mem); \ 479 480 __addr++; \ 480 481 } \ 481 482 } ··· 488 489 const volatile type *__addr = addr; \ 489 490 \ 490 491 while (count--) { \ 491 - mem_out##bwlq(*__addr, port); \ 492 + __mem_out##bwlq(*__addr, port); \ 492 493 __addr++; \ 493 494 } \ 494 495 } \ ··· 499 500 volatile type *__addr = addr; \ 500 501 \ 501 502 while (count--) { \ 502 - *__addr = mem_in##bwlq(port); \ 503 + *__addr = __mem_in##bwlq(port); \ 503 504 __addr++; \ 504 505 } \ 505 506 }
+2
include/asm-mips/thread_info.h
··· 114 114 #define TIF_NEED_RESCHED 3 /* rescheduling necessary */ 115 115 #define TIF_SYSCALL_AUDIT 4 /* syscall auditing active */ 116 116 #define TIF_SECCOMP 5 /* secure computing */ 117 + #define TIF_RESTORE_SIGMASK 9 /* restore signal mask in do_signal() */ 117 118 #define TIF_USEDFPU 16 /* FPU was used by this task this quantum (SMP) */ 118 119 #define TIF_POLLING_NRFLAG 17 /* true if poll_idle() is polling TIF_NEED_RESCHED */ 119 120 #define TIF_MEMDIE 18 ··· 126 125 #define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED) 127 126 #define _TIF_SYSCALL_AUDIT (1<<TIF_SYSCALL_AUDIT) 128 127 #define _TIF_SECCOMP (1<<TIF_SECCOMP) 128 + #define _TIF_RESTORE_SIGMASK (1<<TIF_RESTORE_SIGMASK) 129 129 #define _TIF_USEDFPU (1<<TIF_USEDFPU) 130 130 #define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG) 131 131
+57 -7
include/asm-mips/unistd.h
··· 307 307 #define __NR_inotify_init (__NR_Linux + 284) 308 308 #define __NR_inotify_add_watch (__NR_Linux + 285) 309 309 #define __NR_inotify_rm_watch (__NR_Linux + 286) 310 - 310 + #define __NR_migrate_pages (__NR_Linux + 287) 311 + #define __NR_openat (__NR_Linux + 288) 312 + #define __NR_mkdirat (__NR_Linux + 289) 313 + #define __NR_mknodat (__NR_Linux + 290) 314 + #define __NR_fchownat (__NR_Linux + 291) 315 + #define __NR_futimesat (__NR_Linux + 292) 316 + #define __NR_newfstatat (__NR_Linux + 293) 317 + #define __NR_unlinkat (__NR_Linux + 294) 318 + #define __NR_renameat (__NR_Linux + 295) 319 + #define __NR_linkat (__NR_Linux + 296) 320 + #define __NR_symlinkat (__NR_Linux + 297) 321 + #define __NR_readlinkat (__NR_Linux + 298) 322 + #define __NR_fchmodat (__NR_Linux + 299) 323 + #define __NR_faccessat (__NR_Linux + 300) 324 + #define __NR_pselect6 (__NR_Linux + 301) 325 + #define __NR_ppoll (__NR_Linux + 302) 326 + #define __NR_unshare (__NR_Linux + 303) 311 327 312 328 /* 313 329 * Offset of the last Linux o32 flavoured syscall 314 330 */ 315 - #define __NR_Linux_syscalls 286 331 + #define __NR_Linux_syscalls 303 316 332 317 333 #endif /* _MIPS_SIM == _MIPS_SIM_ABI32 */ 318 334 319 335 #define __NR_O32_Linux 4000 320 - #define __NR_O32_Linux_syscalls 283 336 + #define __NR_O32_Linux_syscalls 303 321 337 322 338 #if _MIPS_SIM == _MIPS_SIM_ABI64 323 339 ··· 587 571 #define __NR_inotify_init (__NR_Linux + 243) 588 572 #define __NR_inotify_add_watch (__NR_Linux + 244) 589 573 #define __NR_inotify_rm_watch (__NR_Linux + 245) 574 + #define __NR_migrate_pages (__NR_Linux + 246) 575 + #define __NR_openat (__NR_Linux + 247) 576 + #define __NR_mkdirat (__NR_Linux + 248) 577 + #define __NR_mknodat (__NR_Linux + 249) 578 + #define __NR_fchownat (__NR_Linux + 250) 579 + #define __NR_futimesat (__NR_Linux + 251) 580 + #define __NR_newfstatat (__NR_Linux + 252) 581 + #define __NR_unlinkat (__NR_Linux + 253) 582 + #define __NR_renameat (__NR_Linux + 254) 583 + #define __NR_linkat (__NR_Linux + 255) 584 + #define __NR_symlinkat (__NR_Linux + 256) 585 + #define __NR_readlinkat (__NR_Linux + 257) 586 + #define __NR_fchmodat (__NR_Linux + 258) 587 + #define __NR_faccessat (__NR_Linux + 259) 588 + #define __NR_pselect6 (__NR_Linux + 260) 589 + #define __NR_ppoll (__NR_Linux + 261) 590 + #define __NR_unshare (__NR_Linux + 262) 590 591 591 592 /* 592 593 * Offset of the last Linux 64-bit flavoured syscall 593 594 */ 594 - #define __NR_Linux_syscalls 245 595 + #define __NR_Linux_syscalls 262 595 596 596 597 #endif /* _MIPS_SIM == _MIPS_SIM_ABI64 */ 597 598 598 599 #define __NR_64_Linux 5000 599 - #define __NR_64_Linux_syscalls 242 600 + #define __NR_64_Linux_syscalls 262 600 601 601 602 #if _MIPS_SIM == _MIPS_SIM_NABI32 602 603 ··· 871 838 #define __NR_inotify_init (__NR_Linux + 247) 872 839 #define __NR_inotify_add_watch (__NR_Linux + 248) 873 840 #define __NR_inotify_rm_watch (__NR_Linux + 249) 841 + #define __NR_migrate_pages (__NR_Linux + 250) 842 + #define __NR_openat (__NR_Linux + 251) 843 + #define __NR_mkdirat (__NR_Linux + 252) 844 + #define __NR_mknodat (__NR_Linux + 253) 845 + #define __NR_fchownat (__NR_Linux + 254) 846 + #define __NR_futimesat (__NR_Linux + 255) 847 + #define __NR_newfstatat (__NR_Linux + 256) 848 + #define __NR_unlinkat (__NR_Linux + 257) 849 + #define __NR_renameat (__NR_Linux + 258) 850 + #define __NR_linkat (__NR_Linux + 259) 851 + #define __NR_symlinkat (__NR_Linux + 260) 852 + #define __NR_readlinkat (__NR_Linux + 261) 853 + #define __NR_fchmodat (__NR_Linux + 262) 854 + #define __NR_faccessat (__NR_Linux + 263) 855 + #define __NR_pselect6 (__NR_Linux + 264) 856 + #define __NR_ppoll (__NR_Linux + 265) 857 + #define __NR_unshare (__NR_Linux + 266) 874 858 875 859 /* 876 860 * Offset of the last N32 flavoured syscall 877 861 */ 878 - #define __NR_Linux_syscalls 249 862 + #define __NR_Linux_syscalls 266 879 863 880 864 #endif /* _MIPS_SIM == _MIPS_SIM_NABI32 */ 881 865 882 866 #define __NR_N32_Linux 6000 883 - #define __NR_N32_Linux_syscalls 246 867 + #define __NR_N32_Linux_syscalls 266 884 868 885 869 #ifndef __ASSEMBLY__ 886 870
+5
include/asm-powerpc/compat.h
··· 126 126 return (void __user *)(unsigned long)uptr; 127 127 } 128 128 129 + static inline compat_uptr_t ptr_to_compat(void __user *uptr) 130 + { 131 + return (u32)(unsigned long)uptr; 132 + } 133 + 129 134 static inline void __user *compat_alloc_user_space(long len) 130 135 { 131 136 struct pt_regs *regs = current->thread.regs;
-1
include/asm-powerpc/dma-mapping.h
··· 15 15 #include <linux/mm.h> 16 16 #include <asm/scatterlist.h> 17 17 #include <asm/io.h> 18 - #include <asm/bug.h> 19 18 20 19 #define DMA_ERROR_CODE (~(dma_addr_t)0x0) 21 20
+2
include/asm-powerpc/prom.h
··· 222 222 extern int of_pci_address_to_resource(struct device_node *dev, int bar, 223 223 struct resource *r); 224 224 225 + extern void kdump_move_device_tree(void); 226 + 225 227 #endif /* __KERNEL__ */ 226 228 #endif /* _POWERPC_PROM_H */
+5
include/asm-powerpc/smu.h
··· 521 521 extern struct smu_sdbp_header *smu_get_sdb_partition(int id, 522 522 unsigned int *size); 523 523 524 + /* Get "sdb" partition data from an SMU satellite */ 525 + extern struct smu_sdbp_header *smu_sat_get_sdb_partition(unsigned int sat_id, 526 + int id, unsigned int *size); 527 + 528 + 524 529 #endif /* __KERNEL__ */ 525 530 526 531
+1 -1
include/asm-powerpc/thread_info.h
··· 37 37 int preempt_count; /* 0 => preemptable, 38 38 <0 => BUG */ 39 39 struct restart_block restart_block; 40 - void *nvgprs_frame; 40 + void __user *nvgprs_frame; 41 41 /* low level flags - has atomic operations done on it */ 42 42 unsigned long flags ____cacheline_aligned_in_smp; 43 43 };
+5 -5
include/asm-s390/uaccess.h
··· 61 61 #define segment_eq(a,b) ((a).ar4 == (b).ar4) 62 62 63 63 64 - static inline int __access_ok(const void *addr, unsigned long size) 64 + static inline int __access_ok(const void __user *addr, unsigned long size) 65 65 { 66 66 return 1; 67 67 } ··· 208 208 case 1: { \ 209 209 unsigned char __x; \ 210 210 __get_user_asm(__x, ptr, __gu_err); \ 211 - (x) = *(__typeof__(*(ptr)) *) &__x; \ 211 + (x) = *(__force __typeof__(*(ptr)) *) &__x; \ 212 212 break; \ 213 213 }; \ 214 214 case 2: { \ 215 215 unsigned short __x; \ 216 216 __get_user_asm(__x, ptr, __gu_err); \ 217 - (x) = *(__typeof__(*(ptr)) *) &__x; \ 217 + (x) = *(__force __typeof__(*(ptr)) *) &__x; \ 218 218 break; \ 219 219 }; \ 220 220 case 4: { \ 221 221 unsigned int __x; \ 222 222 __get_user_asm(__x, ptr, __gu_err); \ 223 - (x) = *(__typeof__(*(ptr)) *) &__x; \ 223 + (x) = *(__force __typeof__(*(ptr)) *) &__x; \ 224 224 break; \ 225 225 }; \ 226 226 case 8: { \ 227 227 unsigned long long __x; \ 228 228 __get_user_asm(__x, ptr, __gu_err); \ 229 - (x) = *(__typeof__(*(ptr)) *) &__x; \ 229 + (x) = *(__force __typeof__(*(ptr)) *) &__x; \ 230 230 break; \ 231 231 }; \ 232 232 default: \
+4 -3
include/asm-sparc/unistd.h
··· 315 315 #define __NR_faccessat 296 316 316 #define __NR_pselect6 297 317 317 #define __NR_ppoll 298 318 + #define __NR_unshare 299 318 319 319 - /* WARNING: You MAY NOT add syscall numbers larger than 298, since 320 + /* WARNING: You MAY NOT add syscall numbers larger than 299, since 320 321 * all of the syscall tables in the Sparc kernel are 321 - * sized to have 298 entries (starting at zero). Therefore 322 - * find a free slot in the 0-298 range. 322 + * sized to have 299 entries (starting at zero). Therefore 323 + * find a free slot in the 0-299 range. 323 324 */ 324 325 325 326 #define _syscall0(type,name) \
+4 -3
include/asm-sparc64/unistd.h
··· 317 317 #define __NR_faccessat 296 318 318 #define __NR_pselect6 297 319 319 #define __NR_ppoll 298 320 + #define __NR_unshare 299 320 321 321 - /* WARNING: You MAY NOT add syscall numbers larger than 298, since 322 + /* WARNING: You MAY NOT add syscall numbers larger than 299, since 322 323 * all of the syscall tables in the Sparc kernel are 323 - * sized to have 298 entries (starting at zero). Therefore 324 - * find a free slot in the 0-298 range. 324 + * sized to have 299 entries (starting at zero). Therefore 325 + * find a free slot in the 0-299 range. 325 326 */ 326 327 327 328 #define _syscall0(type,name) \
+4 -1
include/asm-x86_64/ia32_unistd.h
··· 313 313 #define __NR_ia32_readlinkat 305 314 314 #define __NR_ia32_fchmodat 306 315 315 #define __NR_ia32_faccessat 307 316 + #define __NR_ia32_pselect6 308 317 + #define __NR_ia32_ppoll 309 318 + #define __NR_ia32_unshare 310 316 319 317 - #define IA32_NR_syscalls 308 /* must be > than biggest syscall! */ 320 + #define IA32_NR_syscalls 315 /* must be > than biggest syscall! */ 318 321 319 322 #endif /* _ASM_X86_64_IA32_UNISTD_H_ */
+7
include/asm-x86_64/numa.h
··· 22 22 extern unsigned char apicid_to_node[256]; 23 23 #ifdef CONFIG_NUMA 24 24 extern void __init init_cpu_to_node(void); 25 + 26 + static inline void clear_node_cpumask(int cpu) 27 + { 28 + clear_bit(cpu, &node_to_cpumask[cpu_to_node(cpu)]); 29 + } 30 + 25 31 #else 26 32 #define init_cpu_to_node() do {} while (0) 33 + #define clear_node_cpumask(cpu) do {} while (0) 27 34 #endif 28 35 29 36 #define NUMA_NO_NODE 0xff
+7 -1
include/asm-x86_64/unistd.h
··· 599 599 __SYSCALL(__NR_fchmodat, sys_fchmodat) 600 600 #define __NR_faccessat 269 601 601 __SYSCALL(__NR_faccessat, sys_faccessat) 602 + #define __NR_pselect6 270 603 + __SYSCALL(__NR_pselect6, sys_ni_syscall) /* for now */ 604 + #define __NR_ppoll 271 605 + __SYSCALL(__NR_ppoll, sys_ni_syscall) /* for now */ 606 + #define __NR_unshare 272 607 + __SYSCALL(__NR_unshare, sys_unshare) 602 608 603 - #define __NR_syscall_max __NR_faccessat 609 + #define __NR_syscall_max __NR_unshare 604 610 605 611 #ifndef __NO_STUBS 606 612
-1
include/linux/cpumask.h
··· 84 84 #include <linux/kernel.h> 85 85 #include <linux/threads.h> 86 86 #include <linux/bitmap.h> 87 - #include <asm/bug.h> 88 87 89 88 typedef struct { DECLARE_BITMAP(bits, NR_CPUS); } cpumask_t; 90 89 extern cpumask_t _unused_cpumask_arg_;
-1
include/linux/dcache.h
··· 8 8 #include <linux/spinlock.h> 9 9 #include <linux/cache.h> 10 10 #include <linux/rcupdate.h> 11 - #include <asm/bug.h> 12 11 13 12 struct nameidata; 14 13 struct vfsmount;
+1 -1
include/linux/dvb/video.h
··· 135 135 136 136 typedef struct video_spu_palette { /* SPU Palette information */ 137 137 int length; 138 - uint8_t *palette; 138 + uint8_t __user *palette; 139 139 } video_spu_palette_t; 140 140 141 141
+1
include/linux/elevator.h
··· 82 82 extern void elv_dispatch_sort(request_queue_t *, struct request *); 83 83 extern void elv_add_request(request_queue_t *, struct request *, int, int); 84 84 extern void __elv_add_request(request_queue_t *, struct request *, int, int); 85 + extern void elv_insert(request_queue_t *, struct request *, int); 85 86 extern int elv_merge(request_queue_t *, struct request **, struct bio *); 86 87 extern void elv_merge_requests(request_queue_t *, struct request *, 87 88 struct request *);
+3
include/linux/i2c.h
··· 100 100 /* Returns the number of read bytes */ 101 101 extern s32 i2c_smbus_read_i2c_block_data(struct i2c_client * client, 102 102 u8 command, u8 *values); 103 + extern s32 i2c_smbus_write_i2c_block_data(struct i2c_client * client, 104 + u8 command, u8 length, 105 + u8 *values); 103 106 104 107 /* 105 108 * A driver is capable of handling one or more physical devices present on
+1 -1
include/linux/ioc3.h
··· 27 27 int id; /* IOC3 sequence number */ 28 28 /* PCI mapping */ 29 29 unsigned long pma; /* physical address */ 30 - struct __iomem ioc3 *vma; /* pointer to registers */ 30 + struct ioc3 __iomem *vma; /* pointer to registers */ 31 31 struct pci_dev *pdev; /* PCI device */ 32 32 /* IRQ stuff */ 33 33 int dual_irq; /* set if separate IRQs are used */
-1
include/linux/jbd.h
··· 239 239 240 240 #include <linux/fs.h> 241 241 #include <linux/sched.h> 242 - #include <asm/bug.h> 243 242 244 243 #define JBD_ASSERTIONS 245 244 #ifdef JBD_ASSERTIONS
+1 -1
include/linux/mm.h
··· 303 303 */ 304 304 #define put_page_testzero(p) \ 305 305 ({ \ 306 - BUG_ON(page_count(p) == 0); \ 306 + BUG_ON(atomic_read(&(p)->_count) == -1);\ 307 307 atomic_add_negative(-1, &(p)->_count); \ 308 308 }) 309 309
-1
include/linux/mtd/map.h
··· 15 15 #include <asm/unaligned.h> 16 16 #include <asm/system.h> 17 17 #include <asm/io.h> 18 - #include <asm/bug.h> 19 18 20 19 #ifdef CONFIG_MTD_MAP_BANK_WIDTH_1 21 20 #define map_bankwidth(map) 1
+1
include/linux/namespace.h
··· 15 15 16 16 extern int copy_namespace(int, struct task_struct *); 17 17 extern void __put_namespace(struct namespace *namespace); 18 + extern struct namespace *dup_namespace(struct task_struct *, struct fs_struct *); 18 19 19 20 static inline void put_namespace(struct namespace *namespace) 20 21 {
-1
include/linux/nodemask.h
··· 84 84 #include <linux/threads.h> 85 85 #include <linux/bitmap.h> 86 86 #include <linux/numa.h> 87 - #include <asm/bug.h> 88 87 89 88 typedef struct { DECLARE_BITMAP(bits, MAX_NUMNODES); } nodemask_t; 90 89 extern nodemask_t _unused_nodemask_arg_;
+1
include/linux/pci_ids.h
··· 1832 1832 #define PCI_VENDOR_ID_AFAVLAB 0x14db 1833 1833 #define PCI_DEVICE_ID_AFAVLAB_P028 0x2180 1834 1834 #define PCI_DEVICE_ID_AFAVLAB_P030 0x2182 1835 + #define PCI_SUBDEVICE_ID_AFAVLAB_P061 0x2150 1835 1836 1836 1837 #define PCI_VENDOR_ID_BROADCOM 0x14e4 1837 1838 #define PCI_DEVICE_ID_TIGON3_5752 0x1600
-1
include/linux/smp.h
··· 17 17 #include <linux/compiler.h> 18 18 #include <linux/thread_info.h> 19 19 #include <asm/smp.h> 20 - #include <asm/bug.h> 21 20 22 21 /* 23 22 * main cross-CPU interfaces, handles INIT, TLB flush, STOP, etc.
+9 -1
include/linux/suspend.h
··· 42 42 #ifdef CONFIG_PM 43 43 /* kernel/power/swsusp.c */ 44 44 extern int software_suspend(void); 45 + 46 + #if defined(CONFIG_VT) && defined(CONFIG_VT_CONSOLE) 47 + extern int pm_prepare_console(void); 48 + extern void pm_restore_console(void); 49 + #else 50 + static inline int pm_prepare_console(void) { return 0; } 51 + static inline void pm_restore_console(void) {} 52 + #endif /* defined(CONFIG_VT) && defined(CONFIG_VT_CONSOLE) */ 45 53 #else 46 54 static inline int software_suspend(void) 47 55 { 48 56 printk("Warning: fake suspend called\n"); 49 57 return -EPERM; 50 58 } 51 - #endif 59 + #endif /* CONFIG_PM */ 52 60 53 61 #ifdef CONFIG_SUSPEND_SMP 54 62 extern void disable_nonboot_cpus(void);
+1 -1
include/linux/videodev2.h
··· 549 549 struct v4l2_clip 550 550 { 551 551 struct v4l2_rect c; 552 - struct v4l2_clip *next; 552 + struct v4l2_clip __user *next; 553 553 }; 554 554 555 555 struct v4l2_window
-1
init/Kconfig
··· 169 169 config AUDIT 170 170 bool "Auditing support" 171 171 depends on NET 172 - default y if SECURITY_SELINUX 173 172 help 174 173 Enable auditing infrastructure that can be used with another 175 174 kernel subsystem, such as SELinux (which requires this for
-1
kernel/compat.c
··· 23 23 #include <linux/security.h> 24 24 25 25 #include <asm/uaccess.h> 26 - #include <asm/bug.h> 27 26 28 27 int get_compat_timespec(struct timespec *ts, const struct compat_timespec __user *cts) 29 28 {
+340 -54
kernel/fork.c
··· 446 446 } 447 447 } 448 448 449 + /* 450 + * Allocate a new mm structure and copy contents from the 451 + * mm structure of the passed in task structure. 452 + */ 453 + static struct mm_struct *dup_mm(struct task_struct *tsk) 454 + { 455 + struct mm_struct *mm, *oldmm = current->mm; 456 + int err; 457 + 458 + if (!oldmm) 459 + return NULL; 460 + 461 + mm = allocate_mm(); 462 + if (!mm) 463 + goto fail_nomem; 464 + 465 + memcpy(mm, oldmm, sizeof(*mm)); 466 + 467 + if (!mm_init(mm)) 468 + goto fail_nomem; 469 + 470 + if (init_new_context(tsk, mm)) 471 + goto fail_nocontext; 472 + 473 + err = dup_mmap(mm, oldmm); 474 + if (err) 475 + goto free_pt; 476 + 477 + mm->hiwater_rss = get_mm_rss(mm); 478 + mm->hiwater_vm = mm->total_vm; 479 + 480 + return mm; 481 + 482 + free_pt: 483 + mmput(mm); 484 + 485 + fail_nomem: 486 + return NULL; 487 + 488 + fail_nocontext: 489 + /* 490 + * If init_new_context() failed, we cannot use mmput() to free the mm 491 + * because it calls destroy_context() 492 + */ 493 + mm_free_pgd(mm); 494 + free_mm(mm); 495 + return NULL; 496 + } 497 + 449 498 static int copy_mm(unsigned long clone_flags, struct task_struct * tsk) 450 499 { 451 500 struct mm_struct * mm, *oldmm; ··· 522 473 } 523 474 524 475 retval = -ENOMEM; 525 - mm = allocate_mm(); 476 + mm = dup_mm(tsk); 526 477 if (!mm) 527 478 goto fail_nomem; 528 - 529 - /* Copy the current MM stuff.. */ 530 - memcpy(mm, oldmm, sizeof(*mm)); 531 - if (!mm_init(mm)) 532 - goto fail_nomem; 533 - 534 - if (init_new_context(tsk,mm)) 535 - goto fail_nocontext; 536 - 537 - retval = dup_mmap(mm, oldmm); 538 - if (retval) 539 - goto free_pt; 540 - 541 - mm->hiwater_rss = get_mm_rss(mm); 542 - mm->hiwater_vm = mm->total_vm; 543 479 544 480 good_mm: 545 481 tsk->mm = mm; 546 482 tsk->active_mm = mm; 547 483 return 0; 548 484 549 - free_pt: 550 - mmput(mm); 551 485 fail_nomem: 552 - return retval; 553 - 554 - fail_nocontext: 555 - /* 556 - * If init_new_context() failed, we cannot use mmput() to free the mm 557 - * because it calls destroy_context() 558 - */ 559 - mm_free_pgd(mm); 560 - free_mm(mm); 561 486 return retval; 562 487 } 563 488 ··· 620 597 return newf; 621 598 } 622 599 623 - static int copy_files(unsigned long clone_flags, struct task_struct * tsk) 600 + /* 601 + * Allocate a new files structure and copy contents from the 602 + * passed in files structure. 603 + */ 604 + static struct files_struct *dup_fd(struct files_struct *oldf, int *errorp) 624 605 { 625 - struct files_struct *oldf, *newf; 606 + struct files_struct *newf; 626 607 struct file **old_fds, **new_fds; 627 - int open_files, size, i, error = 0, expand; 608 + int open_files, size, i, expand; 628 609 struct fdtable *old_fdt, *new_fdt; 629 610 630 - /* 631 - * A background process may not have any files ... 632 - */ 633 - oldf = current->files; 634 - if (!oldf) 635 - goto out; 636 - 637 - if (clone_flags & CLONE_FILES) { 638 - atomic_inc(&oldf->count); 639 - goto out; 640 - } 641 - 642 - /* 643 - * Note: we may be using current for both targets (See exec.c) 644 - * This works because we cache current->files (old) as oldf. Don't 645 - * break this. 646 - */ 647 - tsk->files = NULL; 648 - error = -ENOMEM; 649 611 newf = alloc_files(); 650 612 if (!newf) 651 613 goto out; ··· 659 651 if (expand) { 660 652 spin_unlock(&oldf->file_lock); 661 653 spin_lock(&newf->file_lock); 662 - error = expand_files(newf, open_files-1); 654 + *errorp = expand_files(newf, open_files-1); 663 655 spin_unlock(&newf->file_lock); 664 - if (error < 0) 656 + if (*errorp < 0) 665 657 goto out_release; 666 658 new_fdt = files_fdtable(newf); 667 659 /* ··· 710 702 memset(&new_fdt->close_on_exec->fds_bits[start], 0, left); 711 703 } 712 704 713 - tsk->files = newf; 714 - error = 0; 715 705 out: 716 - return error; 706 + return newf; 717 707 718 708 out_release: 719 709 free_fdset (new_fdt->close_on_exec, new_fdt->max_fdset); ··· 719 713 free_fd_array(new_fdt->fd, new_fdt->max_fds); 720 714 kmem_cache_free(files_cachep, newf); 721 715 goto out; 716 + } 717 + 718 + static int copy_files(unsigned long clone_flags, struct task_struct * tsk) 719 + { 720 + struct files_struct *oldf, *newf; 721 + int error = 0; 722 + 723 + /* 724 + * A background process may not have any files ... 725 + */ 726 + oldf = current->files; 727 + if (!oldf) 728 + goto out; 729 + 730 + if (clone_flags & CLONE_FILES) { 731 + atomic_inc(&oldf->count); 732 + goto out; 733 + } 734 + 735 + /* 736 + * Note: we may be using current for both targets (See exec.c) 737 + * This works because we cache current->files (old) as oldf. Don't 738 + * break this. 739 + */ 740 + tsk->files = NULL; 741 + error = -ENOMEM; 742 + newf = dup_fd(oldf, &error); 743 + if (!newf) 744 + goto out; 745 + 746 + tsk->files = newf; 747 + error = 0; 748 + out: 749 + return error; 722 750 } 723 751 724 752 /* ··· 1362 1322 mm_cachep = kmem_cache_create("mm_struct", 1363 1323 sizeof(struct mm_struct), ARCH_MIN_MMSTRUCT_ALIGN, 1364 1324 SLAB_HWCACHE_ALIGN|SLAB_PANIC, NULL, NULL); 1325 + } 1326 + 1327 + 1328 + /* 1329 + * Check constraints on flags passed to the unshare system call and 1330 + * force unsharing of additional process context as appropriate. 1331 + */ 1332 + static inline void check_unshare_flags(unsigned long *flags_ptr) 1333 + { 1334 + /* 1335 + * If unsharing a thread from a thread group, must also 1336 + * unshare vm. 1337 + */ 1338 + if (*flags_ptr & CLONE_THREAD) 1339 + *flags_ptr |= CLONE_VM; 1340 + 1341 + /* 1342 + * If unsharing vm, must also unshare signal handlers. 1343 + */ 1344 + if (*flags_ptr & CLONE_VM) 1345 + *flags_ptr |= CLONE_SIGHAND; 1346 + 1347 + /* 1348 + * If unsharing signal handlers and the task was created 1349 + * using CLONE_THREAD, then must unshare the thread 1350 + */ 1351 + if ((*flags_ptr & CLONE_SIGHAND) && 1352 + (atomic_read(&current->signal->count) > 1)) 1353 + *flags_ptr |= CLONE_THREAD; 1354 + 1355 + /* 1356 + * If unsharing namespace, must also unshare filesystem information. 1357 + */ 1358 + if (*flags_ptr & CLONE_NEWNS) 1359 + *flags_ptr |= CLONE_FS; 1360 + } 1361 + 1362 + /* 1363 + * Unsharing of tasks created with CLONE_THREAD is not supported yet 1364 + */ 1365 + static int unshare_thread(unsigned long unshare_flags) 1366 + { 1367 + if (unshare_flags & CLONE_THREAD) 1368 + return -EINVAL; 1369 + 1370 + return 0; 1371 + } 1372 + 1373 + /* 1374 + * Unshare the filesystem structure if it is being shared 1375 + */ 1376 + static int unshare_fs(unsigned long unshare_flags, struct fs_struct **new_fsp) 1377 + { 1378 + struct fs_struct *fs = current->fs; 1379 + 1380 + if ((unshare_flags & CLONE_FS) && 1381 + (fs && atomic_read(&fs->count) > 1)) { 1382 + *new_fsp = __copy_fs_struct(current->fs); 1383 + if (!*new_fsp) 1384 + return -ENOMEM; 1385 + } 1386 + 1387 + return 0; 1388 + } 1389 + 1390 + /* 1391 + * Unshare the namespace structure if it is being shared 1392 + */ 1393 + static int unshare_namespace(unsigned long unshare_flags, struct namespace **new_nsp, struct fs_struct *new_fs) 1394 + { 1395 + struct namespace *ns = current->namespace; 1396 + 1397 + if ((unshare_flags & CLONE_NEWNS) && 1398 + (ns && atomic_read(&ns->count) > 1)) { 1399 + if (!capable(CAP_SYS_ADMIN)) 1400 + return -EPERM; 1401 + 1402 + *new_nsp = dup_namespace(current, new_fs ? new_fs : current->fs); 1403 + if (!*new_nsp) 1404 + return -ENOMEM; 1405 + } 1406 + 1407 + return 0; 1408 + } 1409 + 1410 + /* 1411 + * Unsharing of sighand for tasks created with CLONE_SIGHAND is not 1412 + * supported yet 1413 + */ 1414 + static int unshare_sighand(unsigned long unshare_flags, struct sighand_struct **new_sighp) 1415 + { 1416 + struct sighand_struct *sigh = current->sighand; 1417 + 1418 + if ((unshare_flags & CLONE_SIGHAND) && 1419 + (sigh && atomic_read(&sigh->count) > 1)) 1420 + return -EINVAL; 1421 + else 1422 + return 0; 1423 + } 1424 + 1425 + /* 1426 + * Unshare vm if it is being shared 1427 + */ 1428 + static int unshare_vm(unsigned long unshare_flags, struct mm_struct **new_mmp) 1429 + { 1430 + struct mm_struct *mm = current->mm; 1431 + 1432 + if ((unshare_flags & CLONE_VM) && 1433 + (mm && atomic_read(&mm->mm_users) > 1)) { 1434 + *new_mmp = dup_mm(current); 1435 + if (!*new_mmp) 1436 + return -ENOMEM; 1437 + } 1438 + 1439 + return 0; 1440 + } 1441 + 1442 + /* 1443 + * Unshare file descriptor table if it is being shared 1444 + */ 1445 + static int unshare_fd(unsigned long unshare_flags, struct files_struct **new_fdp) 1446 + { 1447 + struct files_struct *fd = current->files; 1448 + int error = 0; 1449 + 1450 + if ((unshare_flags & CLONE_FILES) && 1451 + (fd && atomic_read(&fd->count) > 1)) { 1452 + *new_fdp = dup_fd(fd, &error); 1453 + if (!*new_fdp) 1454 + return error; 1455 + } 1456 + 1457 + return 0; 1458 + } 1459 + 1460 + /* 1461 + * Unsharing of semundo for tasks created with CLONE_SYSVSEM is not 1462 + * supported yet 1463 + */ 1464 + static int unshare_semundo(unsigned long unshare_flags, struct sem_undo_list **new_ulistp) 1465 + { 1466 + if (unshare_flags & CLONE_SYSVSEM) 1467 + return -EINVAL; 1468 + 1469 + return 0; 1470 + } 1471 + 1472 + /* 1473 + * unshare allows a process to 'unshare' part of the process 1474 + * context which was originally shared using clone. copy_* 1475 + * functions used by do_fork() cannot be used here directly 1476 + * because they modify an inactive task_struct that is being 1477 + * constructed. Here we are modifying the current, active, 1478 + * task_struct. 1479 + */ 1480 + asmlinkage long sys_unshare(unsigned long unshare_flags) 1481 + { 1482 + int err = 0; 1483 + struct fs_struct *fs, *new_fs = NULL; 1484 + struct namespace *ns, *new_ns = NULL; 1485 + struct sighand_struct *sigh, *new_sigh = NULL; 1486 + struct mm_struct *mm, *new_mm = NULL, *active_mm = NULL; 1487 + struct files_struct *fd, *new_fd = NULL; 1488 + struct sem_undo_list *new_ulist = NULL; 1489 + 1490 + check_unshare_flags(&unshare_flags); 1491 + 1492 + if ((err = unshare_thread(unshare_flags))) 1493 + goto bad_unshare_out; 1494 + if ((err = unshare_fs(unshare_flags, &new_fs))) 1495 + goto bad_unshare_cleanup_thread; 1496 + if ((err = unshare_namespace(unshare_flags, &new_ns, new_fs))) 1497 + goto bad_unshare_cleanup_fs; 1498 + if ((err = unshare_sighand(unshare_flags, &new_sigh))) 1499 + goto bad_unshare_cleanup_ns; 1500 + if ((err = unshare_vm(unshare_flags, &new_mm))) 1501 + goto bad_unshare_cleanup_sigh; 1502 + if ((err = unshare_fd(unshare_flags, &new_fd))) 1503 + goto bad_unshare_cleanup_vm; 1504 + if ((err = unshare_semundo(unshare_flags, &new_ulist))) 1505 + goto bad_unshare_cleanup_fd; 1506 + 1507 + if (new_fs || new_ns || new_sigh || new_mm || new_fd || new_ulist) { 1508 + 1509 + task_lock(current); 1510 + 1511 + if (new_fs) { 1512 + fs = current->fs; 1513 + current->fs = new_fs; 1514 + new_fs = fs; 1515 + } 1516 + 1517 + if (new_ns) { 1518 + ns = current->namespace; 1519 + current->namespace = new_ns; 1520 + new_ns = ns; 1521 + } 1522 + 1523 + if (new_sigh) { 1524 + sigh = current->sighand; 1525 + current->sighand = new_sigh; 1526 + new_sigh = sigh; 1527 + } 1528 + 1529 + if (new_mm) { 1530 + mm = current->mm; 1531 + active_mm = current->active_mm; 1532 + current->mm = new_mm; 1533 + current->active_mm = new_mm; 1534 + activate_mm(active_mm, new_mm); 1535 + new_mm = mm; 1536 + } 1537 + 1538 + if (new_fd) { 1539 + fd = current->files; 1540 + current->files = new_fd; 1541 + new_fd = fd; 1542 + } 1543 + 1544 + task_unlock(current); 1545 + } 1546 + 1547 + bad_unshare_cleanup_fd: 1548 + if (new_fd) 1549 + put_files_struct(new_fd); 1550 + 1551 + bad_unshare_cleanup_vm: 1552 + if (new_mm) 1553 + mmput(new_mm); 1554 + 1555 + bad_unshare_cleanup_sigh: 1556 + if (new_sigh) 1557 + if (atomic_dec_and_test(&new_sigh->count)) 1558 + kmem_cache_free(sighand_cachep, new_sigh); 1559 + 1560 + bad_unshare_cleanup_ns: 1561 + if (new_ns) 1562 + put_namespace(new_ns); 1563 + 1564 + bad_unshare_cleanup_fs: 1565 + if (new_fs) 1566 + put_fs_struct(new_fs); 1567 + 1568 + bad_unshare_cleanup_thread: 1569 + bad_unshare_out: 1570 + return err; 1365 1571 }
+3
kernel/module.c
··· 1670 1670 goto free_mod; 1671 1671 } 1672 1672 1673 + /* Userspace could have altered the string after the strlen_user() */ 1674 + args[arglen - 1] = '\0'; 1675 + 1673 1676 if (find_module(mod->name)) { 1674 1677 err = -EEXIST; 1675 1678 goto free_mod;
+3 -1
kernel/power/console.c
··· 9 9 #include <linux/console.h> 10 10 #include "power.h" 11 11 12 - #ifdef SUSPEND_CONSOLE 12 + #if defined(CONFIG_VT) && defined(CONFIG_VT_CONSOLE) 13 + #define SUSPEND_CONSOLE (MAX_NR_CONSOLES-1) 14 + 13 15 static int orig_fgconsole, orig_kmsg; 14 16 15 17 int pm_prepare_console(void)
-16
kernel/power/power.h
··· 1 1 #include <linux/suspend.h> 2 2 #include <linux/utsname.h> 3 3 4 - /* With SUSPEND_CONSOLE defined suspend looks *really* cool, but 5 - we probably do not take enough locks for switching consoles, etc, 6 - so bad things might happen. 7 - */ 8 - #if defined(CONFIG_VT) && defined(CONFIG_VT_CONSOLE) 9 - #define SUSPEND_CONSOLE (MAX_NR_CONSOLES-1) 10 - #endif 11 - 12 4 struct swsusp_info { 13 5 struct new_utsname uts; 14 6 u32 version_code; ··· 33 41 } 34 42 35 43 extern struct subsystem power_subsys; 36 - 37 - #ifdef SUSPEND_CONSOLE 38 - extern int pm_prepare_console(void); 39 - extern void pm_restore_console(void); 40 - #else 41 - static int pm_prepare_console(void) { return 0; } 42 - static void pm_restore_console(void) {} 43 - #endif 44 44 45 45 /* References to section boundaries */ 46 46 extern const void __nosave_begin, __nosave_end;
+2 -4
kernel/power/swsusp.c
··· 743 743 if (!bio) 744 744 return -ENOMEM; 745 745 bio->bi_sector = page_off * (PAGE_SIZE >> 9); 746 - bio_get(bio); 747 746 bio->bi_bdev = resume_bdev; 748 747 bio->bi_end_io = end_io; 749 748 ··· 752 753 goto Done; 753 754 } 754 755 755 - if (rw == WRITE) 756 - bio_set_pages_dirty(bio); 757 756 758 757 atomic_set(&io_done, 1); 759 758 submit_bio(rw | (1 << BIO_RW_SYNC), bio); 760 759 while (atomic_read(&io_done)) 761 760 yield(); 762 - 761 + if (rw == READ) 762 + bio_set_pages_dirty(bio); 763 763 Done: 764 764 bio_put(bio); 765 765 return error;
+1 -1
kernel/sys.c
··· 428 428 { 429 429 #ifdef CONFIG_KEXEC 430 430 struct kimage *image; 431 - image = xchg(&kexec_image, 0); 431 + image = xchg(&kexec_image, NULL); 432 432 if (!image) { 433 433 return; 434 434 }
+1 -1
kernel/timer.c
··· 495 495 base = &__get_cpu_var(tvec_bases); 496 496 spin_lock(&base->t_base.lock); 497 497 expires = base->timer_jiffies + (LONG_MAX >> 1); 498 - list = 0; 498 + list = NULL; 499 499 500 500 /* Look for timer events in tv1. */ 501 501 j = base->timer_jiffies & TVR_MASK;
+9
lib/kobject.c
··· 72 72 * Add 1 to strlen for leading '/' of each level. 73 73 */ 74 74 do { 75 + if (kobject_name(parent) == NULL) 76 + return 0; 75 77 length += strlen(kobject_name(parent)) + 1; 76 78 parent = parent->parent; 77 79 } while (parent); ··· 109 107 int len; 110 108 111 109 len = get_kobj_path_length(kobj); 110 + if (len == 0) 111 + return NULL; 112 112 path = kmalloc(len, gfp_mask); 113 113 if (!path) 114 114 return NULL; ··· 166 162 return -ENOENT; 167 163 if (!kobj->k_name) 168 164 kobj->k_name = kobj->name; 165 + if (!kobj->k_name) { 166 + pr_debug("kobject attempted to be registered with no name!\n"); 167 + WARN_ON(1); 168 + return -EINVAL; 169 + } 169 170 parent = kobject_get(kobj->parent); 170 171 171 172 pr_debug("kobject %s: registering. parent: %s, set: %s\n",
+1 -1
lib/kobject_uevent.c
··· 22 22 #include <linux/kobject.h> 23 23 #include <net/sock.h> 24 24 25 - #define BUFFER_SIZE 1024 /* buffer for the variables */ 25 + #define BUFFER_SIZE 2048 /* buffer for the variables */ 26 26 #define NUM_ENVP 32 /* number of env pointers */ 27 27 28 28 #if defined(CONFIG_HOTPLUG) && defined(CONFIG_NET)
+3 -3
lib/spinlock_debug.c
··· 72 72 73 73 for (;;) { 74 74 for (i = 0; i < loops_per_jiffy * HZ; i++) { 75 - cpu_relax(); 76 75 if (__raw_spin_trylock(&lock->raw_lock)) 77 76 return; 77 + __delay(1); 78 78 } 79 79 /* lockup suspected: */ 80 80 if (print_once) { ··· 144 144 145 145 for (;;) { 146 146 for (i = 0; i < loops_per_jiffy * HZ; i++) { 147 - cpu_relax(); 148 147 if (__raw_read_trylock(&lock->raw_lock)) 149 148 return; 149 + __delay(1); 150 150 } 151 151 /* lockup suspected: */ 152 152 if (print_once) { ··· 217 217 218 218 for (;;) { 219 219 for (i = 0; i < loops_per_jiffy * HZ; i++) { 220 - cpu_relax(); 221 220 if (__raw_write_trylock(&lock->raw_lock)) 222 221 return; 222 + __delay(1); 223 223 } 224 224 /* lockup suspected: */ 225 225 if (print_once) {
+3 -16
mm/hugetlb.c
··· 107 107 set_page_count(page, 1); 108 108 page[1].mapping = (void *)free_huge_page; 109 109 for (i = 0; i < (HPAGE_SIZE/PAGE_SIZE); ++i) 110 - clear_highpage(&page[i]); 110 + clear_user_highpage(&page[i], addr); 111 111 return page; 112 112 } 113 113 ··· 391 391 392 392 if (!new_page) { 393 393 page_cache_release(old_page); 394 - 395 - /* Logically this is OOM, not a SIGBUS, but an OOM 396 - * could cause the kernel to go killing other 397 - * processes which won't help the hugepage situation 398 - * at all (?) */ 399 - return VM_FAULT_SIGBUS; 394 + return VM_FAULT_OOM; 400 395 } 401 396 402 397 spin_unlock(&mm->page_table_lock); ··· 439 444 page = alloc_huge_page(vma, address); 440 445 if (!page) { 441 446 hugetlb_put_quota(mapping); 442 - /* 443 - * No huge pages available. So this is an OOM 444 - * condition but we do not want to trigger the OOM 445 - * killer, so we return VM_FAULT_SIGBUS. 446 - * 447 - * A program using hugepages may fault with Bus Error 448 - * because no huge pages are available in the cpuset, per 449 - * memory policy or because all are in use! 450 - */ 447 + ret = VM_FAULT_OOM; 451 448 goto out; 452 449 } 453 450
+1 -1
mm/slob.c
··· 336 336 337 337 #ifdef CONFIG_SMP 338 338 339 - void *__alloc_percpu(size_t size, size_t align) 339 + void *__alloc_percpu(size_t size) 340 340 { 341 341 int i; 342 342 struct percpu_data *pdata = kmalloc(sizeof (*pdata), GFP_KERNEL);
+23 -11
mm/swap.c
··· 34 34 /* How many pages do we try to swap or page in/out together? */ 35 35 int page_cluster; 36 36 37 + static void put_compound_page(struct page *page) 38 + { 39 + page = (struct page *)page_private(page); 40 + if (put_page_testzero(page)) { 41 + void (*dtor)(struct page *page); 42 + 43 + dtor = (void (*)(struct page *))page[1].mapping; 44 + (*dtor)(page); 45 + } 46 + } 47 + 37 48 void put_page(struct page *page) 38 49 { 39 - if (unlikely(PageCompound(page))) { 40 - page = (struct page *)page_private(page); 41 - if (put_page_testzero(page)) { 42 - void (*dtor)(struct page *page); 43 - 44 - dtor = (void (*)(struct page *))page[1].mapping; 45 - (*dtor)(page); 46 - } 47 - return; 48 - } 49 - if (put_page_testzero(page)) 50 + if (unlikely(PageCompound(page))) 51 + put_compound_page(page); 52 + else if (put_page_testzero(page)) 50 53 __page_cache_release(page); 51 54 } 52 55 EXPORT_SYMBOL(put_page); ··· 246 243 for (i = 0; i < nr; i++) { 247 244 struct page *page = pages[i]; 248 245 struct zone *pagezone; 246 + 247 + if (unlikely(PageCompound(page))) { 248 + if (zone) { 249 + spin_unlock_irq(&zone->lru_lock); 250 + zone = NULL; 251 + } 252 + put_compound_page(page); 253 + continue; 254 + } 249 255 250 256 if (!put_page_testzero(page)) 251 257 continue;
-1
net/dccp/ccids/lib/tfrc_equation.c
··· 15 15 #include <linux/config.h> 16 16 #include <linux/module.h> 17 17 18 - #include <asm/bug.h> 19 18 #include <asm/div64.h> 20 19 21 20 #include "tfrc.h"
+1 -1
net/ipv4/igmp.c
··· 1578 1578 new_in = psf->sf_count[MCAST_INCLUDE] != 0; 1579 1579 if (new_in) { 1580 1580 if (!psf->sf_oldin) { 1581 - struct ip_sf_list *prev = 0; 1581 + struct ip_sf_list *prev = NULL; 1582 1582 1583 1583 for (dpsf=pmc->tomb; dpsf; dpsf=dpsf->sf_next) { 1584 1584 if (dpsf->sf_inaddr == psf->sf_inaddr)
-1
net/ipv4/xfrm4_policy.c
··· 8 8 * 9 9 */ 10 10 11 - #include <asm/bug.h> 12 11 #include <linux/compiler.h> 13 12 #include <linux/config.h> 14 13 #include <linux/inetdevice.h>
+3
net/ipv6/addrconf.c
··· 2165 2165 dev->name); 2166 2166 break; 2167 2167 } 2168 + 2169 + if (idev) 2170 + idev->if_flags |= IF_READY; 2168 2171 } else { 2169 2172 if (!netif_carrier_ok(dev)) { 2170 2173 /* device is still not ready. */
+1 -1
net/ipv6/mcast.c
··· 1978 1978 new_in = psf->sf_count[MCAST_INCLUDE] != 0; 1979 1979 if (new_in) { 1980 1980 if (!psf->sf_oldin) { 1981 - struct ip6_sf_list *prev = 0; 1981 + struct ip6_sf_list *prev = NULL; 1982 1982 1983 1983 for (dpsf=pmc->mca_tomb; dpsf; 1984 1984 dpsf=dpsf->sf_next) {
-1
net/ipv6/raw.c
··· 35 35 #include <linux/skbuff.h> 36 36 #include <asm/uaccess.h> 37 37 #include <asm/ioctls.h> 38 - #include <asm/bug.h> 39 38 40 39 #include <net/ip.h> 41 40 #include <net/sock.h>
-1
net/ipv6/xfrm6_policy.c
··· 11 11 * 12 12 */ 13 13 14 - #include <asm/bug.h> 15 14 #include <linux/compiler.h> 16 15 #include <linux/config.h> 17 16 #include <linux/netdevice.h>
-1
net/xfrm/xfrm_policy.c
··· 13 13 * 14 14 */ 15 15 16 - #include <asm/bug.h> 17 16 #include <linux/config.h> 18 17 #include <linux/slab.h> 19 18 #include <linux/kmod.h>
+1 -1
security/selinux/Kconfig
··· 1 1 config SECURITY_SELINUX 2 2 bool "NSA SELinux Support" 3 - depends on SECURITY_NETWORK && NET && INET 3 + depends on SECURITY_NETWORK && AUDIT && NET && INET 4 4 default n 5 5 help 6 6 This selects NSA Security-Enhanced Linux (SELinux).
-2
security/selinux/avc.c
··· 43 43 #undef S_ 44 44 }; 45 45 46 - #ifdef CONFIG_AUDIT 47 46 static const char *class_to_string[] = { 48 47 #define S_(s) s, 49 48 #include "class_to_string.h" 50 49 #undef S_ 51 50 }; 52 - #endif 53 51 54 52 #define TB_(s) static const char * s [] = { 55 53 #define TE_(s) };
+8 -8
sound/oss/dmasound/tas_common.h
··· 178 178 if (write_mode & WRITE_SHADOW) 179 179 memcpy(self->shadow[reg_num],data,reg_width); 180 180 if (write_mode & WRITE_HW) { 181 - rc=i2c_smbus_write_block_data(self->client, 182 - reg_num, 183 - reg_width, 184 - data); 181 + rc=i2c_smbus_write_i2c_block_data(self->client, 182 + reg_num, 183 + reg_width, 184 + data); 185 185 if (rc < 0) { 186 186 printk("tas: I2C block write failed \n"); 187 187 return rc; ··· 199 199 200 200 if (reg_width==0 || self==NULL) 201 201 return -EINVAL; 202 - rc=i2c_smbus_write_block_data(self->client, 203 - reg_num, 204 - reg_width, 205 - self->shadow[reg_num]); 202 + rc=i2c_smbus_write_i2c_block_data(self->client, 203 + reg_num, 204 + reg_width, 205 + self->shadow[reg_num]); 206 206 if (rc < 0) { 207 207 printk("tas: I2C block write failed \n"); 208 208 return rc;
+1 -1
sound/oss/emu10k1/recmgr.c
··· 29 29 ********************************************************************** 30 30 */ 31 31 32 - #include <asm/delay.h> 32 + #include <linux/delay.h> 33 33 #include "8010.h" 34 34 #include "recmgr.h" 35 35
+2 -1
sound/ppc/pmac.c
··· 66 66 67 67 static void snd_pmac_dbdma_free(struct snd_pmac *chip, struct pmac_dbdma *rec) 68 68 { 69 - if (rec) { 69 + if (rec->space) { 70 70 unsigned int rsize = sizeof(struct dbdma_cmd) * (rec->size + 1); 71 71 72 72 dma_free_coherent(&chip->pdev->dev, rsize, rec->space, rec->dma_base); ··· 881 881 chip->can_capture = 1; 882 882 chip->num_freqs = ARRAY_SIZE(awacs_freqs); 883 883 chip->freq_table = awacs_freqs; 884 + chip->pdev = NULL; 884 885 885 886 chip->control_mask = MASK_IEPC | MASK_IEE | 0x11; /* default */ 886 887
+10 -9
sound/ppc/tumbler.c
··· 239 239 block[4] = (right_vol >> 8) & 0xff; 240 240 block[5] = (right_vol >> 0) & 0xff; 241 241 242 - if (i2c_smbus_write_block_data(mix->i2c.client, TAS_REG_VOL, 243 - 6, block) < 0) { 242 + if (i2c_smbus_write_i2c_block_data(mix->i2c.client, TAS_REG_VOL, 6, 243 + block) < 0) { 244 244 snd_printk("failed to set volume \n"); 245 245 return -EINVAL; 246 246 } ··· 345 345 val[1] = 0; 346 346 } 347 347 348 - if (i2c_smbus_write_block_data(mix->i2c.client, TAS_REG_DRC, 349 - 2, val) < 0) { 348 + if (i2c_smbus_write_i2c_block_data(mix->i2c.client, TAS_REG_DRC, 349 + 2, val) < 0) { 350 350 snd_printk("failed to set DRC\n"); 351 351 return -EINVAL; 352 352 } ··· 381 381 val[4] = 0x60; 382 382 val[5] = 0xa0; 383 383 384 - if (i2c_smbus_write_block_data(mix->i2c.client, TAS_REG_DRC, 385 - 6, val) < 0) { 384 + if (i2c_smbus_write_i2c_block_data(mix->i2c.client, TAS_REG_DRC, 385 + 6, val) < 0) { 386 386 snd_printk("failed to set DRC\n"); 387 387 return -EINVAL; 388 388 } ··· 492 492 vol = info->table[vol]; 493 493 for (i = 0; i < info->bytes; i++) 494 494 block[i] = (vol >> ((info->bytes - i - 1) * 8)) & 0xff; 495 - if (i2c_smbus_write_block_data(mix->i2c.client, info->reg, 496 - info->bytes, block) < 0) { 495 + if (i2c_smbus_write_i2c_block_data(mix->i2c.client, info->reg, 496 + info->bytes, block) < 0) { 497 497 snd_printk("failed to set mono volume %d\n", info->index); 498 498 return -EINVAL; 499 499 } ··· 625 625 for (j = 0; j < 3; j++) 626 626 block[i * 3 + j] = (vol >> ((2 - j) * 8)) & 0xff; 627 627 } 628 - if (i2c_smbus_write_block_data(mix->i2c.client, reg, 9, block) < 0) { 628 + if (i2c_smbus_write_i2c_block_data(mix->i2c.client, reg, 629 + 9, block) < 0) { 629 630 snd_printk("failed to set mono volume %d\n", reg); 630 631 return -EINVAL; 631 632 }